diff --git a/dist/index.html b/dist/index.html index 7ca79de7..653bd1b1 100644 --- a/dist/index.html +++ b/dist/index.html @@ -1,6 +1,6 @@ -
\ No newline at end of file + `,document.head.appendChild(F)}clearValues(){this.level<=1&&(this.levelSpeeds=[,,,,,]),this.skip0&&0==this.level&&(this.level=1),this.lastMissileCantBeUndone=!1,this.speedFactor=2,this.speedLimit=10,this.missileSpeed=15,this.shownStatScreen=!1,this.G=100,this.vectorLimit=this.speedLimit*this.speedFactor,this.missileVectorLimit=this.missileSpeed*this.speedFactor,this.missileVectorLimitSum=42426,this.FPS=25,this.P5_FPS_MULTIPLIER=3,this.P5_FPS=this.FPS*this.P5_FPS_MULTIPLIER,this.p?.frameRate(this.P5_FPS),this.timer=(this.level>5?60:IH[this.level])*this.FPS,this.deadOpacity="0.9",this.initialScoreSize=120,this.scoreSize=this.initialScoreSize,this.opac=(this.globalStyle,1),this.tailLength=1,this.tailMod="psycho"==this.globalStyle?2:1,this.explosions=[],this.missiles=[],this.stillVisibleMissiles=[],this.missileInits=[],this.bodies=[],this.witheringBodies=[],this.bodyInits=[],this.bodyFinal=[],this.missileCount=0,this.frames=0,this.p5Frames=0,this.showIt=!0,this.justStopped=!1,this.gameOver=!1,this.firstFrame=!0,this.loaded=!1,this.showPlayAgain=!1,this.handledGameOver=!1,this.statsText="",this.hasStarted=!1,this.buttons={},this.won=!1,this.finalBatchSent=!1,this.solved=!1,this.shaking=0,this.explosionSmoke=[],this.gunSmoke=[],this.date=new Date(1e3*this.day).toISOString().split("T")[0].replace(/-/g,"."),this.framesTook=!1,this.showProblemRankingsScreenAt=-1,this.saveStatus="unsaved",delete this.validatedAt,delete this.validatingAt,delete this.savingAt,delete this.savedAt}init(){this.skipAhead=!1,this.winScreenBaddies=void 0,this.seed=Mx.solidityKeccak256(["uint256"],[this.day]),this.generateBodies(),this.frames=this.alreadyRun,this.startingFrame=this.alreadyRun,this.stopEvery=this.test?20:this.proverTickIndex(this.level+1),this.lastLevel=this.level,this.setPause(this.paused,!0),this.storeInits()}async start(){this.addCSS(),this.addListeners(),this.runSteps(this.preRun),this.freeze&&this.setPause(!0,!0)}destroy(){this.resizeObserver.disconnect(this.p.canvas),this.setPause(!0),this.p.noLoop(),this.removeListener(),this.sound.stop(),this.sound=null,this.p.remove()}storeInits(){this.bodyInits=this.processInits(this.bodies)}processInits(F){return this.convertBodiesToBigInts(F).map(F=>((F=this.convertScaledBigIntBodyToArray(F))[2]=BigInt(F[2]).toString(),F[3]=BigInt(F[3]).toString(),F))}runSteps(F=this.preRun){let A=0,B=!0;for(this.showIt=!1;B;)if(++A>F)B=!1,this.showIt=!0;else{let F=this.step(this.bodies,this.missiles);this.frames++,this.bodies=F.bodies,this.missiles=F.missiles||[]}}addListeners(){this.p.mouseMoved=this.handleMouseMove,this.p.touchStarted=F=>{this.hasTouched=!0,this.handleGameClick(F)},this.p.mouseClicked=this.handleGameClick,this.p.keyPressed=this.handleGameKeyDown}removeListener(){this.p.remove()}getXY(F){let A,B;return F.touches?(A=F.touches[0].pageX-this.canvasRect.left,B=F.touches[0].pageY-this.canvasRect.top):(A=F.offsetX||F.layerX,B=F.offsetY||F.layerY),{x:A=A*this.windowWidth/this.canvasRect.width,y:B=B*this.windowHeight/this.canvasRect.height}}handleMouseMove=F=>{let{x:A,y:B}=this.getXY(F);for(let F in this.mouseX=A,this.mouseY=B,this.buttons){let t=this.buttons[F];t.hover=IP(t,A,B)}};handleGameClick=F=>{this.gameOver&&this.won&&(this.skipAhead=!0);let{x:A,y:B}=this.getXY(F);for(let F in this.buttons){let t=this.buttons[F];if(t.visible&&IP(t,A,B)&&!t.disabled){t.onClick();return}}this.paused||this.gameOver||this.missileClick(A,B)};handleNFTClick=()=>{this.setPause()};handleGameKeyDown=F=>{if(this.gameOver&&this.won&&(this.skipAhead=!0),!(F.shiftKey&&F.altKey&&F.ctrlKey&&F.metaKey))switch(F.code){case"Space":(this.mouseX||this.mouseY)&&(F.preventDefault(),this.missileClick(this.mouseX,this.mouseY)),this.shownStatScreen&&(this.level++,this.restart(null,!1));break;case"KeyR":this.hasQuickReset=!0,this.restart(null,!1);break;case"KeyP":this.gameOver||this.setPause();break;case"KeyM":this.mute=!this.mute}};handleGameOver=({won:F})=>{if(this.handledGameOver)return;if(this.handledGameOver=!0,this.gameoverTickerX=0,0!==this.level&&this.sound?.playGameOver({won:F}),this.gameOver=!0,this.won=F,0!==this.level&&!this.won){let F=this.bodies.slice(1).filter(F=>0n!==F.radius).length,A=this.generateLevelData(this.day,6-F).slice(1);this.bodies.push(...A.map(F=>this.bodyDataToBodies.call(this,F)).map(F=>(F.position.x=0,F.position.y=0,F.py=0n,F.px=0n,F)))}this.P5_FPS*=2,this.p.frameRate(this.P5_FPS);var A=0;let B=this.calculateStats();A=B.timeTook,this.framesTook=B.framesTook,this.emit("done",{level:this.level,won:F,ticks:this.frames-this.startingFrame,timeTook:A,framesTook:this.framesTook}),F&&(this.bodyData=null,this.finish())};restart=(F,A=!0)=>{F&&this.setOptions(F),this.clearValues(),this.level!==this.lastLevel&&1!==this.level&&0!==this.level&&(this.sound?.stop(),this.sound?.playStart(),this.sound?.setSong(),this.sound?.resume()),this.sound?.playbackRate!=="normal"&&this.sound?.setPlaybackRate("normal"),this.init(),this.draw(),A&&this.setPause(!0),this.addCSS()};doubleTextInverted(F){return F.slice(0,-1)+F.split("").reverse().join("")}setPause(F=!this.paused,A=!1){"boolean"!=typeof F&&(F=!this.paused),F?(this.pauseBodies=IX.map(F=>this.bodyDataToBodies.call(this,F)),this.pauseBodies[1].c=this.getBodyColor(this.day+1,0),this.pauseBodies[2].c=this.getBodyColor(this.day+2,0),this.paused=F,this.willUnpause=!1,delete this.beganUnpauseAt):(this.justPaused=!0,this.willUnpause=!0),this.emit("paused",F),F?A||this.sound?.pause():A||this.sound?.resume()}step(){0==this.missiles.length&&this.lastMissileCantBeUndone&&(console.log("LASTMISSILECANTBEUNDONE = FALSE"),this.lastMissileCantBeUndone=!1),this.bodies=this.forceAccumulator(this.bodies);var F=this.detectCollision(this.bodies,this.missiles);if(this.bodies=F.bodies,this.missiles=F.missiles||[],this.missiles.length>0){let F=JSON.parse(JSON.stringify(this.missiles[0]));this.stillVisibleMissiles.push(F)}if(this.missiles.length>0&&0==this.missiles[0].radius)this.missiles.splice(0,1);else if(this.missiles.length>1&&0!==this.missiles[0].radius){let F=this.missiles.splice(0,1);this.missiles.splice(0,1,F[0])}return{bodies:this.bodies,missiles:this.missiles}}started(){this.emit("started",{day:this.day,level:this.level,bodyInits:JSON.parse(JSON.stringify(this.bodyInits))})}processMissileInits(F){return F.map(F=>({step:F.step,x:this.convertFloatToScaledBigInt(F.position.x).toString(),y:this.convertFloatToScaledBigInt(F.position.y).toString(),vx:this.convertFloatToScaledBigInt(F.velocity.x).toString(),vy:this.convertFloatToScaledBigInt(F.velocity.y).toString(),radius:"10"}))}finish(){if(this.finalBatchSent)return;this.calculateBodyFinal();let F=[];if("game"==this.mode){let A=0;for(let B=this.alreadyRun;Bq&&(B=q-o),e=B;e>=0;e--){for(var a=!0,r=0;r239?4:s>223?3:s>191?2:1;if(i+a<=B)switch(a){case 1:s<128&&(h=s);break;case 2:(192&(e=F[i+1]))==128&&(o=(31&s)<<6|63&e)>127&&(h=o);break;case 3:e=F[i+1],V=F[i+2],(192&e)==128&&(192&V)==128&&(o=(15&s)<<12|(63&e)<<6|63&V)>2047&&(o<55296||o>57343)&&(h=o);break;case 4:e=F[i+1],V=F[i+2],q=F[i+3],(192&e)==128&&(192&V)==128&&(192&q)==128&&(o=(15&s)<<18|(63&e)<<12|(63&V)<<6|63&q)>65535&&o<1114112&&(h=o)}null===h?(h=65533,a=1):h>65535&&(h-=65536,t.push(h>>>10&1023|55296),h=56320|1023&h),t.push(h),i+=a}return function(F){var A=F.length;if(A<=4096)return String.fromCharCode.apply(String,F);for(var B="",t=0;tB)throw RangeError("Trying to access beyond buffer length")}function wr(F,A,B,t,i,e){if(!I9.isBuffer(F))throw TypeError('"buffer" argument must be a Buffer instance');if(A>i||A F.length)throw RangeError("Index out of range")}function wM(F,A,B,t,i,e){if(B+t>F.length||B<0)throw RangeError("Index out of range")}function wn(F,A,B,t,i){return A=+A,B>>>=0,i||wM(F,A,B,4,34028234663852886e22,-34028234663852886e22),AT(F,A,B,t,23,4),B+4}function wg(F,A,B,t,i){return A=+A,B>>>=0,i||wM(F,A,B,8,17976931348623157e292,-17976931348623157e292),AT(F,A,B,t,52,8),B+8}I9.TYPED_ARRAY_SUPPORT=function(){try{var F=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf(F,A),42===F.foo()}catch(F){return!1}}(),I9.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(I9.prototype,"parent",{enumerable:!0,get:function(){if(I9.isBuffer(this))return this.buffer}}),Object.defineProperty(I9.prototype,"offset",{enumerable:!0,get:function(){if(I9.isBuffer(this))return this.byteOffset}}),I9.poolSize=8192,I9.from=function(F,A,B){return I7(F,A,B)},Object.setPrototypeOf(I9.prototype,Uint8Array.prototype),Object.setPrototypeOf(I9,Uint8Array),I9.alloc=function(F,A,B){return(wF(F),F<=0)?I3(F):void 0!==A?"string"==typeof B?I3(F).fill(A,B):I3(F).fill(A):I3(F)},I9.allocUnsafe=function(F){return wA(F)},I9.allocUnsafeSlow=function(F){return wA(F)},I9.isBuffer=function(F){return null!=F&&!0===F._isBuffer&&F!==I9.prototype},I9.compare=function(F,A){if(wQ(F,Uint8Array)&&(F=I9.from(F,F.offset,F.byteLength)),wQ(A,Uint8Array)&&(A=I9.from(A,A.offset,A.byteLength)),!I9.isBuffer(F)||!I9.isBuffer(A))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(F===A)return 0;for(var B=F.length,t=A.length,i=0,e=Math.min(B,t);i t.length?I9.from(e).copy(t,i):Uint8Array.prototype.set.call(t,e,i);else if(I9.isBuffer(e))e.copy(t,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=e.length}return t},I9.byteLength=we,I9.prototype._isBuffer=!0,I9.prototype.swap16=function(){var F=this.length;if(F%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var A=0;A 50&&(F+=" ... ")," "},I6&&(I9.prototype[I6]=I9.prototype.inspect),I9.prototype.compare=function(F,A,B,t,i){if(wQ(F,Uint8Array)&&(F=I9.from(F,F.offset,F.byteLength)),!I9.isBuffer(F))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof F);if(void 0===A&&(A=0),void 0===B&&(B=F?F.length:0),void 0===t&&(t=0),void 0===i&&(i=this.length),A<0||B>F.length||t<0||i>this.length)throw RangeError("out of range index");if(t>=i&&A>=B)return 0;if(t>=i)return -1;if(A>=B)return 1;if(A>>>=0,B>>>=0,t>>>=0,i>>>=0,this===F)return 0;for(var e=i-t,V=B-A,q=Math.min(e,V),o=this.slice(t,i),s=F.slice(A,B),h=0;h >>=0,isFinite(B)?(B>>>=0,void 0===t&&(t="utf8")):(t=B,B=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,e,V,q,o,s,h,a,r=this.length-A;if((void 0===B||B>r)&&(B=r),F.length>0&&(B<0||A<0)||A>this.length)throw RangeError("Attempt to write outside buffer bounds");t||(t="utf8");for(var M=!1;;)switch(t){case"hex":return function(F,A,B,t){B=Number(B)||0;var i=F.length-B;t?(t=Number(t))>i&&(t=i):t=i;var e=A.length;t>e/2&&(t=e/2);for(var V=0;V>8,i.push(B%256),i.push(t);return i}(F,this.length-h),this,h,a);default:if(M)throw TypeError("Unknown encoding: "+t);t=(""+t).toLowerCase(),M=!0}},I9.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},I9.prototype.slice=function(F,A){var B=this.length;F=~~F,A=void 0===A?B:~~A,F<0?(F+=B)<0&&(F=0):F>B&&(F=B),A<0?(A+=B)<0&&(A=0):A>B&&(A=B),A >>=0,A>>>=0,B||wa(F,A,this.length);for(var t=this[F],i=1,e=0;++e>>=0,A>>>=0,B||wa(F,A,this.length);for(var t=this[F+--A],i=1;A>0&&(i*=256);)t+=this[F+--A]*i;return t},I9.prototype.readUint8=I9.prototype.readUInt8=function(F,A){return F>>>=0,A||wa(F,1,this.length),this[F]},I9.prototype.readUint16LE=I9.prototype.readUInt16LE=function(F,A){return F>>>=0,A||wa(F,2,this.length),this[F]|this[F+1]<<8},I9.prototype.readUint16BE=I9.prototype.readUInt16BE=function(F,A){return F>>>=0,A||wa(F,2,this.length),this[F]<<8|this[F+1]},I9.prototype.readUint32LE=I9.prototype.readUInt32LE=function(F,A){return F>>>=0,A||wa(F,4,this.length),(this[F]|this[F+1]<<8|this[F+2]<<16)+16777216*this[F+3]},I9.prototype.readUint32BE=I9.prototype.readUInt32BE=function(F,A){return F>>>=0,A||wa(F,4,this.length),16777216*this[F]+(this[F+1]<<16|this[F+2]<<8|this[F+3])},I9.prototype.readIntLE=function(F,A,B){F>>>=0,A>>>=0,B||wa(F,A,this.length);for(var t=this[F],i=1,e=0;++e=(i*=128)&&(t-=Math.pow(2,8*A)),t},I9.prototype.readIntBE=function(F,A,B){F>>>=0,A>>>=0,B||wa(F,A,this.length);for(var t=A,i=1,e=this[F+--t];t>0&&(i*=256);)e+=this[F+--t]*i;return e>=(i*=128)&&(e-=Math.pow(2,8*A)),e},I9.prototype.readInt8=function(F,A){return(F>>>=0,A||wa(F,1,this.length),128&this[F])?-((255-this[F]+1)*1):this[F]},I9.prototype.readInt16LE=function(F,A){F>>>=0,A||wa(F,2,this.length);var B=this[F]|this[F+1]<<8;return 32768&B?4294901760|B:B},I9.prototype.readInt16BE=function(F,A){F>>>=0,A||wa(F,2,this.length);var B=this[F+1]|this[F]<<8;return 32768&B?4294901760|B:B},I9.prototype.readInt32LE=function(F,A){return F>>>=0,A||wa(F,4,this.length),this[F]|this[F+1]<<8|this[F+2]<<16|this[F+3]<<24},I9.prototype.readInt32BE=function(F,A){return F>>>=0,A||wa(F,4,this.length),this[F]<<24|this[F+1]<<16|this[F+2]<<8|this[F+3]},I9.prototype.readFloatLE=function(F,A){return F>>>=0,A||wa(F,4,this.length),Ax(this,F,!0,23,4)},I9.prototype.readFloatBE=function(F,A){return F>>>=0,A||wa(F,4,this.length),Ax(this,F,!1,23,4)},I9.prototype.readDoubleLE=function(F,A){return F>>>=0,A||wa(F,8,this.length),Ax(this,F,!0,52,8)},I9.prototype.readDoubleBE=function(F,A){return F>>>=0,A||wa(F,8,this.length),Ax(this,F,!1,52,8)},I9.prototype.writeUintLE=I9.prototype.writeUIntLE=function(F,A,B,t){if(F=+F,A>>>=0,B>>>=0,!t){var i=Math.pow(2,8*B)-1;wr(this,F,A,B,i,0)}var e=1,V=0;for(this[A]=255&F;++V>>=0,B>>>=0,!t){var i=Math.pow(2,8*B)-1;wr(this,F,A,B,i,0)}var e=B-1,V=1;for(this[A+e]=255&F;--e>=0&&(V*=256);)this[A+e]=F/V&255;return A+B},I9.prototype.writeUint8=I9.prototype.writeUInt8=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,1,255,0),this[A]=255&F,A+1},I9.prototype.writeUint16LE=I9.prototype.writeUInt16LE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,2,65535,0),this[A]=255&F,this[A+1]=F>>>8,A+2},I9.prototype.writeUint16BE=I9.prototype.writeUInt16BE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,2,65535,0),this[A]=F>>>8,this[A+1]=255&F,A+2},I9.prototype.writeUint32LE=I9.prototype.writeUInt32LE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,4,4294967295,0),this[A+3]=F>>>24,this[A+2]=F>>>16,this[A+1]=F>>>8,this[A]=255&F,A+4},I9.prototype.writeUint32BE=I9.prototype.writeUInt32BE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,4,4294967295,0),this[A]=F>>>24,this[A+1]=F>>>16,this[A+2]=F>>>8,this[A+3]=255&F,A+4},I9.prototype.writeIntLE=function(F,A,B,t){if(F=+F,A>>>=0,!t){var i=Math.pow(2,8*B-1);wr(this,F,A,B,i-1,-i)}var e=0,V=1,q=0;for(this[A]=255&F;++e>0)-q&255;return A+B},I9.prototype.writeIntBE=function(F,A,B,t){if(F=+F,A>>>=0,!t){var i=Math.pow(2,8*B-1);wr(this,F,A,B,i-1,-i)}var e=B-1,V=1,q=0;for(this[A+e]=255&F;--e>=0&&(V*=256);)F<0&&0===q&&0!==this[A+e+1]&&(q=1),this[A+e]=(F/V>>0)-q&255;return A+B},I9.prototype.writeInt8=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,1,127,-128),F<0&&(F=255+F+1),this[A]=255&F,A+1},I9.prototype.writeInt16LE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,2,32767,-32768),this[A]=255&F,this[A+1]=F>>>8,A+2},I9.prototype.writeInt16BE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,2,32767,-32768),this[A]=F>>>8,this[A+1]=255&F,A+2},I9.prototype.writeInt32LE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,4,2147483647,-2147483648),this[A]=255&F,this[A+1]=F>>>8,this[A+2]=F>>>16,this[A+3]=F>>>24,A+4},I9.prototype.writeInt32BE=function(F,A,B){return F=+F,A>>>=0,B||wr(this,F,A,4,2147483647,-2147483648),F<0&&(F=4294967295+F+1),this[A]=F>>>24,this[A+1]=F>>>16,this[A+2]=F>>>8,this[A+3]=255&F,A+4},I9.prototype.writeFloatLE=function(F,A,B){return wn(this,F,A,!0,B)},I9.prototype.writeFloatBE=function(F,A,B){return wn(this,F,A,!1,B)},I9.prototype.writeDoubleLE=function(F,A,B){return wg(this,F,A,!0,B)},I9.prototype.writeDoubleBE=function(F,A,B){return wg(this,F,A,!1,B)},I9.prototype.copy=function(F,A,B,t){if(!I9.isBuffer(F))throw TypeError("argument should be a Buffer");if(B||(B=0),t||0===t||(t=this.length),A>=F.length&&(A=F.length),A||(A=0),t>0&&t=this.length)throw RangeError("Index out of range");if(t<0)throw RangeError("sourceEnd out of bounds");t>this.length&&(t=this.length),F.length-A >>=0,B=void 0===B?this.length:B>>>0,F||(F=0),"number"==typeof F)for(i=A;i55295&&B<57344){if(!i){if(B>56319||V+1===t){(A-=3)>-1&&e.push(239,191,189);continue}i=B;continue}if(B<56320){(A-=3)>-1&&e.push(239,191,189),i=B;continue}B=(i-55296<<10|B-56320)+65536}else i&&(A-=3)>-1&&e.push(239,191,189);if(i=null,B<128){if((A-=1)<0)break;e.push(B)}else if(B<2048){if((A-=2)<0)break;e.push(B>>6|192,63&B|128)}else if(B<65536){if((A-=3)<0)break;e.push(B>>12|224,B>>6&63|128,63&B|128)}else if(B<1114112){if((A-=4)<0)break;e.push(B>>18|240,B>>12&63|128,B>>6&63|128,63&B|128)}else throw Error("Invalid code point")}return e}function wI(F){return AR(function(F){if((F=(F=F.split("=")[0]).trim().replace(wl,"")).length<2)return"";for(;F.length%4!=0;)F+="=";return F}(F))}function ww(F,A,B,t){for(var i=0;i =A.length)&&!(i>=F.length);++i)A[i+B]=F[i];return i}function wQ(F,A){return F instanceof A||null!=F&&null!=F.constructor&&null!=F.constructor.name&&F.constructor.name===A.name}var wE=function(){for(var F="0123456789abcdef",A=Array(256),B=0;B<16;++B)for(var t=16*B,i=0;i<16;++i)A[t+i]=F[B]+F[i];return A}();let wc=new function(F,A){return new function F(B){let t="global"==B?window:this;t.canvas=document.createElement("canvas");let i=t.canvas.getContext("2d");t.width=100,t.height=100,t.canvas.width=t.width,t.canvas.height=t.height,"offscreen"!=B&&(A?A.appendChild(t.canvas):document.body?document.body.appendChild(t.canvas):window.addEventListener("load",function(){document.body.appendChild(t.canvas)})),I(),t.MAGIC=161533525,t.RGB=0,t.HSV=1,t.HSB=1,t.CHORD=0,t.PIE=1,t.OPEN=2,t.RADIUS=1,t.CORNER=2,t.CORNERS=3,t.ROUND="round",t.SQUARE="butt",t.PROJECT="square",t.MITER="miter",t.BEVEL="bevel",t.CLOSE=1,t.BLEND="source-over",t.REMOVE="destination-out",t.ADD="lighter",t.DARKEST="darken",t.LIGHTEST="lighten",t.DIFFERENCE="difference",t.SUBTRACT="subtract",t.EXCLUSION="exclusion",t.MULTIPLY="multiply",t.SCREEN="screen",t.REPLACE="copy",t.OVERLAY="overlay",t.HARD_LIGHT="hard-light",t.SOFT_LIGHT="soft-light",t.DODGE="color-dodge",t.BURN="color-burn",t.NORMAL="normal",t.ITALIC="italic",t.BOLD="bold",t.BOLDITALIC="italic bold",t.CENTER="center",t.LEFT="left",t.RIGHT="right",t.TOP="top",t.BOTTOM="bottom",t.BASELINE="alphabetic",t.LANDSCAPE="landscape",t.PORTRAIT="portrait",t.ALT=18,t.BACKSPACE=8,t.CONTROL=17,t.DELETE=46,t.DOWN_ARROW=40,t.ENTER=13,t.ESCAPE=27,t.LEFT_ARROW=37,t.OPTION=18,t.RETURN=13,t.RIGHT_ARROW=39,t.SHIFT=16,t.TAB=9,t.UP_ARROW=38,t.HALF_PI=Math.PI/2,t.PI=Math.PI,t.QUARTER_PI=Math.PI/4,t.TAU=2*Math.PI,t.TWO_PI=2*Math.PI,t.THRESHOLD=1,t.GRAY=2,t.OPAQUE=3,t.INVERT=4,t.POSTERIZE=5,t.DILATE=6,t.ERODE=7,t.BLUR=8,t.ARROW="default",t.CROSS="crosshair",t.HAND="pointer",t.MOVE="move",t.TEXT="text",t.VIDEO={video:!0,audio:!1},t.AUDIO={video:!1,audio:!0},t.SHR3=1,t.LCG=2,t.HARDWARE_FILTERS=!0,t.hint=function(F,A){t[F]=A},t.frameCount=0,t.mouseX=0,t.mouseY=0,t.pmouseX=0,t.pmouseY=0,t.mouseButton=null,t.keyIsPressed=!1,t.mouseIsPressed=!1,t.key=null,t.keyCode=null,t.pixels=null,t.accelerationX=0,t.accelerationY=0,t.accelerationZ=0,t.rotationX=0,t.rotationY=0,t.rotationZ=0,t.relRotationX=0,t.relRotationY=0,t.relRotationZ=0,t.pAccelerationX=0,t.pAccelerationY=0,t.pAccelerationZ=0,t.pRotationX=0,t.pRotationY=0,t.pRotationZ=0,t.pRelRotationX=0,t.pRelRotationY=0,t.pRelRotationZ=0,t.touches=[],t._styleCache=[{colorMode:t.RGB,noStroke:!1,noFill:!1,ellipseMode:t.CENTER,rectMode:t.CORNER,curveDetail:20,curveAlpha:0,textFont:"sans-serif",textSize:12,textLeading:12,textStyle:"normal"}],t._style=t._styleCache[t._styleCache.length-1],t._noLoop=!1,t._pixelDensity=1,t._frameRate=null,t._tint=null;let e=null,V=!0,q=[],o=null,s=0,h={},a=0,r=0,M=0,n=null,g=null,l=null;for(let A of(Object.defineProperty(t,"deviceOrientation",{get:function(){return 90==Math.abs(window.orientation)?t.LANDSCAPE:t.PORTRAIT}}),Object.defineProperty(t,"windowWidth",{get:function(){return window.innerWidth}}),Object.defineProperty(t,"windowHeight",{get:function(){return window.innerHeight}}),Object.defineProperty(t,"drawingContext",{get:function(){return i}}),t.createCanvas=function(F,A){return t.width=F,t.height=A,t.canvas.width=F,t.canvas.height=A,I(),t.canvas},t.resizeCanvas=function(F,A){t.width=F,t.height=A,t.canvas.width=F,t.canvas.height=A},t.createGraphics=t.createImage=function(A,B){let t=new F("offscreen");return t.createCanvas(A,B),t.noLoop(),t},t.pixelDensity=function(F){return void 0==F||(t._pixelDensity=F,t.canvas.width=Math.ceil(t.width*F),t.canvas.height=Math.ceil(t.height*F),t.canvas.style.width=t.width+"px",t.canvas.style.height=t.height+"px",i.scale(t._pixelDensity,t._pixelDensity),I()),t._pixelDensity},t.map=function(F,A,B,t,i,e){let V=t+(F-A)*1/(B-A)*(i-t);return e?tF){let B=F/A;i.x*=B,i.y*=B,i.z*=B,e=F,V=F*F}return i},i.setMag=function(F){o();let A=F/e;return i.x*=A,i.y*=A,i.z*=A,e=F,V=F*F,i},i.heading=function(){return Math.atan2(i.y,i.x)},i.rotate=function(F){let A=Math.cos(F),B=Math.sin(F),t=i.x*A-i.y*B,e=i.x*B+i.y*A;return i.x=t,i.y=e,i},i.angleBetween=function(){let F=q.apply(null,arguments);return Math.acos(Math.min(1,Math.max(-1,i.dot(F)/(i.mag()*F.mag()))))*Math.sign(i.cross(F).z||1)},i.lerp=function(F,A){return i.x=i.x*(1-A)+F.x*A,i.y=i.y*(1-A)+F.y*A,i.z=i.z*(1-A)+F.z*A,s(),i},i.reflect=function(F){return F.normalize(),i.sub(F.mult(2*i.dot(F)))},i.array=function(){return[i.x,i.y,i.z]},i.equals=function(F,A){return void 0==A&&void 0==(A=Number.EPSILON)&&(A=0),Math.abs(F.x-i.x)360&&(V=0),V/=60,q=~~V,o=V-q,s=B*(1-A),h=B*(1-A*o),a=B*(1-A*(1-o)),q){case 0:t=B,i=a,e=s;break;case 1:t=h,i=B,e=s;break;case 2:t=s,i=B,e=a;break;case 3:t=s,i=h,e=B;break;case 4:t=a,i=s,e=B;break;default:t=B,i=s,e=h}return[255*t,255*i,255*e]}function I(){i.fillStyle="white",i.strokeStyle="black",i.lineCap="round",i.lineJoin="miter"}function w(F){if(0<=F&&F<2*Math.PI)return F;for(;F<0;)F+=2*Math.PI;for(;F>=Math.PI;)F-=2*Math.PI;return F}function Q(F,A,B,e,V,q,o,s){if(t._style.noFill&&t._style.noStroke)return;let h=w(V),a=w(q);i.beginPath();for(let V=0;V A?F>B?F:B:A>B?A:B)/255))?[0,V=0,q]:0==(V=100*(e-t)/e)?[0,V,q]:[e==F?0+60*(A-B)/(e-t):e==A?120+60*(B-F)/(e-t):240+60*(F-A)/(e-t),V,q]),i._hsvInferred=!0}},i.toString=function(){return`rgba(${Math.round(i._r)},${Math.round(i._g)},${Math.round(i._b)},${~~(1e3*i._a)/1e3})`}},t.colorMode=function(F){t._style.colorMode=F},t.color=function(){if(1==arguments.length&&786698==arguments[0].MAGIC)return arguments[0];if(t._style.colorMode==t.RGB){if(1==arguments.length)return new t.Color(arguments[0],arguments[0],arguments[0],1);if(2==arguments.length)return new t.Color(arguments[0],arguments[0],arguments[0],arguments[1]/255);if(3==arguments.length)return new t.Color(arguments[0],arguments[1],arguments[2],1);if(4==arguments.length)return new t.Color(arguments[0],arguments[1],arguments[2],arguments[3]/255)}else{if(1==arguments.length)return new t.Color(...C(0,0,arguments[0]/100),1);if(2==arguments.length)return new t.Color(...C(0,0,arguments[0]/100),arguments[1]/255);if(3==arguments.length)return new t.Color(...C(arguments[0],arguments[1]/100,arguments[2]/100),1);if(4==arguments.length)return new t.Color(...C(arguments[0],arguments[1]/100,arguments[2]/100),arguments[3])}return null},t.red=function(F){return F._r},t.green=function(F){return F._g},t.blue=function(F){return F._b},t.alpha=function(F){return 255*F._a},t.hue=function(F){return F._inferHSV(),F._h},t.saturation=function(F){return F._inferHSV(),F._s},t.brightness=function(F){return F._inferHSV(),F._v},t.lightness=function(F){return(.2126*F._r+.7152*F._g+.0722*F._b)*100/255},t.lerpColor=function(F,A,B){var i,e,V;return t._style.colorMode==t.RGB?new t.Color(t.constrain(t.lerp(F._r,A._r,B),0,255),t.constrain(t.lerp(F._g,A._g,B),0,255),t.constrain(t.lerp(F._b,A._b,B),0,255),t.constrain(t.lerp(F._a,A._a,B),0,1)):(F._inferHSV(),A._inferHSV(),new t.Color(t.constrain((i=F._h,(V=[[Math.abs((e=A._h)-i),t.map(B,0,1,i,e)],[Math.abs(e+360-i),t.map(B,0,1,i,e+360)],[Math.abs(e-360-i),t.map(B,0,1,i,e-360)]]).sort((F,A)=>F[0]-A[0]),(V[0][1]+720)%360),0,360),t.constrain(t.lerp(F._s,A._s,B),0,100),t.constrain(t.lerp(F._v,A._v,B),0,100),t.constrain(t.lerp(F._a,A._a,B),0,1)))},t.strokeWeight=function(F){t._style_noStroke=!1,i.lineWidth=F},t.stroke=function(){if(t._style.noStroke=!1,"string"==typeof arguments[0]){i.strokeStyle=arguments[0];return}let F=t.color.apply(null,arguments);if(F._a<=0){t._style.noStroke=!0;return}i.strokeStyle=F},t.noStroke=function(){t._style.noStroke=!0},t.fill=function(){if(t._style.noFill=!1,"string"==typeof arguments[0]){i.fillStyle=arguments[0];return}let F=t.color.apply(null,arguments);if(F._a<=0){t._style.noFill=!0;return}i.fillStyle=F},t.noFill=function(){t._style.noFill=!0},t.blendMode=function(F){i.globalCompositeOperation=F},t.strokeCap=function(F){i.lineCap=F},t.strokeJoin=function(F){i.lineJoin=F},t.ellipseMode=function(F){t._style.ellipseMode=F},t.rectMode=function(F){t._style.rectMode=F},t.curveDetail=function(F){t._style.curveDetail=F},t.curveAlpha=function(F){t._style.curveAlpha=F},t.curveTightness=function(F){console.warn("curveTightness() sets the 'alpha' parameter of Catmull-Rom curve, and is NOT identical to p5.js counterpart. As this might change in the future, please call curveAlpha() directly."),t._style.curveAlpha=F},t.clear=function(){i.clearRect(0,0,t.width,t.height)},t.background=function(){if(arguments[0]&&arguments[0].MAGIC==t.MAGIC)return t.image(arguments[0],0,0,t.width,t.height);i.save(),i.resetTransform(),i.scale(t._pixelDensity,t._pixelDensity),"string"==typeof arguments[0]?i.fillStyle=arguments[0]:i.fillStyle=t.color(...Array.from(arguments)),i.fillRect(0,0,t.width,t.height),i.restore()},t.line=function(F,A,B,e){t._style.noStroke||(i.beginPath(),i.moveTo(F,A),i.lineTo(B,e),i.stroke())},t.arc=function(F,A,B,i,e,V,q,o){if(e==V)return t.ellipse(F,A,B,i);void 0==o&&(o=25),void 0==q&&(q=t.PIE),t._style.ellipseMode==t.CENTER?Q(F,A,B,i,e,V,q,o):t._style.ellipseMode==t.RADIUS?Q(F,A,2*B,2*i,e,V,q,o):t._style.ellipseMode==t.CORNER?Q(F+B/2,A+i/2,B,i,e,V,q,o):t._style.ellipseMode==t.CORNERS&&Q((F+B)/2,(A+i)/2,B-F,i-A,e,V,q,o)},t.ellipse=function(F,A,B,i){void 0==i&&(i=B),t._style.ellipseMode==t.CENTER?E(F,A,B,i):t._style.ellipseMode==t.RADIUS?E(F,A,2*B,2*i):t._style.ellipseMode==t.CORNER?E(F+B/2,A+i/2,B,i):t._style.ellipseMode==t.CORNERS&&E((F+B)/2,(A+i)/2,B-F,i-A)},t.circle=function(F,A,B){return t.ellipse(F,A,B,B)},t.point=function(F,A){F.x&&(A=F.y,F=F.x),i.beginPath(),i.ellipse(F,A,.4,.4,0,0,2*Math.PI),i.stroke()},t.rect=function(F,A,B,i,e,V,q,o){t._style.rectMode==t.CENTER?c(F-B/2,A-i/2,B,i,e,V,q,o):t._style.rectMode==t.RADIUS?c(F-B,A-i,2*B,2*i,e,V,q,o):t._style.rectMode==t.CORNER?c(F,A,B,i,e,V,q,o):t._style.rectMode==t.CORNERS&&c(F,A,B-F,i-A,e,V,q,o)},t.square=function(F,A,B,i,e,V,q){return t.rect(F,A,B,B,i,e,V,q)},t.beginShape=function(){m(),i.beginPath(),V=!0},t.beginContour=function(){i.closePath(),m(),V=!0},t.endContour=function(){m(),V=!0},t.vertex=function(F,A){m(),V?i.moveTo(F,A):i.lineTo(F,A),V=!1},t.bezierVertex=function(F,A,B,t,e,V){m(),i.bezierCurveTo(F,A,B,t,e,V)},t.quadraticVertex=function(F,A,B,t){m(),i.quadraticCurveTo(F,A,B,t)},t.bezier=function(F,A,B,i,e,V,q,o){t.beginShape(),t.vertex(F,A),t.bezierVertex(B,i,e,V,q,o),t.endShape()},t.triangle=function(F,A,B,i,e,V){t.beginShape(),t.vertex(F,A),t.vertex(B,i),t.vertex(e,V),t.endShape(t.CLOSE)},t.quad=function(F,A,B,i,e,V,q,o){t.beginShape(),t.vertex(F,A),t.vertex(B,i),t.vertex(e,V),t.vertex(q,o),t.endShape(t.CLOSE)},t.endShape=function(F){m(),F&&i.closePath(),t._style.noFill||i.fill(),t._style.noStroke||i.stroke(),t._style.noFill&&t._style.noStroke&&(i.save(),i.fillStyle="none",i.fill(),i.restore())},t.curveVertex=function(F,A){if(q.push([F,A]),q.length<4)return;let B=function(F,A,B,t,i,e,V,q,o,s){function h(F,A,B,t,i,e){return Math.pow(Math.pow(t-A,2)+Math.pow(i-B,2),.5*e)+F}let a=[],r=h(0,F,A,B,t,s),M=h(r,B,t,i,e,s),n=h(M,i,e,V,q,s);for(let s=0;s0?(g[F]=1,g[F+1]=0):(g[F]=0,g[F+1]=1));let l=F*g[0]+B*g[1],C=A*g[0]+t*g[1],I=B*g[2]+i*g[3],w=t*g[2]+e*g[3],Q=i*g[4]+V*g[5],E=e*g[4]+q*g[5],c=l*g[6]+I*g[7],m=C*g[6]+w*g[7],Y=I*g[8]+Q*g[9],D=w*g[8]+E*g[9],p=c*g[2]+Y*g[3],G=m*g[2]+D*g[3];a.push([p,G])}return a}(...q[q.length-4],...q[q.length-3],...q[q.length-2],...q[q.length-1],t._style.curveDetail,t._style.curveAlpha);for(let F=0;F =A?255:0}},Y[t.GRAY]=function(F){for(let A=0;A >8)*255/B,F[t+1]=(F[t+1]*A>>8)*255/B,F[t+2]=(F[t+2]*A>>8)*255/B},Y[t.DILATE]=function(F){p(),l.set(F);let[A,B]=[i.canvas.width,i.canvas.height];for(let t=0;t=1&&(s++,r--),M>=1&&(h++,M--),n>=1&&(a++,n--)}return g},t.noiseDetail=function(F,A){F>0&&(S=F),A>0&&(U=A)};let y=function(){let F,A;return{setSeed(B){A=F=(null==B?4294967296*Math.random():B)>>>0},getSeed:()=>F,rand:()=>(A=(1664525*A+1013904223)%4294967296)/4294967296}},K=function(){let F,A;return{setSeed(B){F=A=(null==B?4294967295*Math.random():B)>>>0},getSeed:()=>A,rand:()=>(F^=F<<17,F^=F>>13,((F^=F<<5)>>>0)/4294967295)}},Z=K();Z.setSeed(),t.noiseSeed=function(F){let A=void 0==F?4294967295*Math.random():F;u||(u=new Float32Array(4096));for(var B=0;B<4096;B++)A^=A<<17,A^=A>>13,A^=A<<5,u[B]=(A>>>0)/4294967295},t.randomSeed=function(F){Z.setSeed(F)},t.random=function(F,A){return void 0==F?Z.rand():"number"!=typeof F?F[~~(F.length*Z.rand())]:void 0!=A?Z.rand()*(A-F)+F:Z.rand()*F},t.randomGenerator=function(F){F==t.LCG?Z=y():F==t.SHR3&&(Z=K()),Z.setSeed()};var J=new function(){var F,A,B,t=Array(128),i=Array(256),e=Array(128),V=Array(128),q=Array(256),o=Array(256),s=function(){return 4294967296*Z.rand()-2147483648},h=function(){return .5+(s()<<0)*2328306e-16},a=function(){for(var A,i,q,o;;){if(A=B*e[F],0==F){do q=h(),o=h(),A=-(.2904764*Math.log(q)),i=-Math.log(o);while(i+i0?3.44262+A:-3.44262-A}if(V[F]+h()*(V[F-1]-V[F]) >>0),A =1;A--)B=Math.sqrt(-2*Math.log(.00991256303526217/B+Math.exp(-.5*B*B))),t[A+1]=Math.floor(B/s*2147483648),s=B,V[A]=Math.exp(-.5*B*B),e[A]=B/2147483648;for(A=254,F=.003949659822581572/Math.exp(-h),i[0]=Math.floor(h/F*4294967296),i[1]=0,q[0]=F/4294967296,q[255]=h/4294967296,o[0]=1,o[255]=Math.exp(-h);A>=1;A--)h=-Math.log(.003949659822581572/h+Math.exp(-h)),i[A+1]=Math.floor(h/a*4294967296),a=h,o[A]=Math.exp(-h),q[A]=h/4294967296}};for(let F of(J.hasInit=!1,t.randomGaussian=function(F,A){return J.hasInit||(J.zigset(),J.hasInit=!0),J.RNOR()*A+F},t.randomExponential=function(){return J.hasInit||(J.zigset(),J.hasInit=!0),J.REXP()},t.print=console.log,t.cursor=function(F,A,B){let i="";F.includes(".")&&(F=`url("${F}")`,i=", auto"),void 0!=A&&(F+=" "+A+" "+B),t.canvas.style.cursor=F+i},t.noCursor=function(){t.canvas.style.cursor="none"},t.createCapture=function(F){var A=document.createElement("video");return A.playsinline="playsinline",A.autoplay="autoplay",navigator.mediaDevices.getUserMedia(F).then(function(F){A.srcObject=F}),A.style.position="absolute",A.style.opacity=1e-5,A.style.zIndex=-1e3,document.body.appendChild(A),A},["setup","draw","preload","mouseMoved","mousePressed","mouseReleased","mouseDragged","mouseClicked","keyPressed","keyReleased","keyTyped","touchStarted","touchEnded","touchMoved"])){let A="_"+F+"Fn";t[A]=function(){},t[A].isPlaceHolder=!0,t[F]?t[A]=t[F]:Object.defineProperty(t,F,{set:function(F){t[A]=F}})}function R(){t._noLoop||(e=null==t._frameRate?requestAnimationFrame(R):setTimeout(R,1e3/t._frameRate)),m(),V=!0,t.push(),t._drawFn(),t.pop(),++t.frameCount,t.frameCount%60==0&&(r=window.performance.now()-a,M=t.frameCount)}t.noLoop=function(){t._noLoop=!0,clearTimeout(e),e=null},t.loop=function(){t._noLoop=!1,null==e&&R()},t.redraw=function(){R()},t.frameRate=function(F){t._frameRate=F},setTimeout(function(){t._preloadFn(),a=window.performance.now(),function F(){if(s>0)return setTimeout(F,10);t._setupFn(),R()}()},1),t.canvas.onmousemove=function(F){t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,t.mouseX=F.offsetX,t.mouseY=F.offsetY,t.mouseIsPressed?t._mouseDraggedFn(F):t._mouseMovedFn(F)},t.canvas.onmousedown=function(F){t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,t.mouseX=F.offsetX,t.mouseY=F.offsetY,t.mouseIsPressed=!0,t.mouseButton=[t.LEFT,t.CENTER,t.RIGHT][F.button],t._mousePressedFn(F)},t.canvas.onmouseup=function(F){t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,t.mouseX=F.offsetX,t.mouseY=F.offsetY,t.mouseIsPressed=!1,t._mouseReleasedFn(F)},t.canvas.onclick=function(F){t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,t.mouseX=F.offsetX,t.mouseY=F.offsetY,t.mouseIsPressed=!0,t._mouseClickedFn(F),t.mouseIsPressed=!1};let d=function(F){t.keyIsPressed=!0,t.key=F.key,t.keyCode=F.keyCode,h[t.keyCode]=!0,t._keyPressedFn(F),1==F.key.length&&t._keyTypedFn(F)};window.addEventListener("keydown",d);let x=function(F){t.keyIsPressed=!1,t.key=F.key,t.keyCode=F.keyCode,h[t.keyCode]=!1,t._keyReleasedFn(F)};function T(F){let A=t.canvas.getBoundingClientRect(),B=t.canvas.scrollWidth/t.width||1,i=t.canvas.scrollHeight/t.height||1;return{x:(F.clientX-A.left)/B,y:(F.clientY-A.top)/i,id:F.identifier}}function L(){return t._touchStartedFn.isPlaceHolder&&t._touchMovedFn.isPlaceHolder&&t._touchEndedFn.isPlaceHolder}window.addEventListener("keyup",x),t.keyIsDown=function(F){return!!h[F]},t.canvas.ontouchstart=function(F){t.touches=[...F.touches].map(T),L()&&(t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,t.mouseX=t.touches[0].x,t.mouseY=t.touches[0].y,t.mouseIsPressed=!0,t.mouseButton=t.LEFT,t._mousePressedFn(F)||F.preventDefault()),t._touchStartedFn(F)||F.preventDefault()},t.canvas.ontouchmove=function(F){t.touches=[...F.touches].map(T),L()&&(t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,t.mouseX=t.touches[0].x,t.mouseY=t.touches[0].y,t.mouseIsPressed=!0,t.mouseButton=t.LEFT,t._mouseDraggedFn(F)||F.preventDefault()),t._touchMovedFn(F)||F.preventDefault()},t.canvas.ontouchend=t.canvas.ontouchcancel=function(F){t.touches=[...F.touches].map(T),L()&&(t.pmouseX=t.mouseX,t.pmouseY=t.mouseY,t.mouseX=t.touches[0].x,t.mouseY=t.touches[0].y,t.mouseIsPressed=!1,t._mouseReleasedFn(F)||F.preventDefault()),t._touchEndedFn(F)||F.preventDefault()},t.hasSensorPermission=!window.DeviceOrientationEvent&&!window.DeviceMotionEvent||!(DeviceOrientationEvent.requestPermission||DeviceMotionEvent.requestPermission),t.requestSensorPermissions=function(){DeviceOrientationEvent.requestPermission&&DeviceOrientationEvent.requestPermission().then(F=>{"granted"==F&&DeviceMotionEvent.requestPermission&&DeviceMotionEvent.requestPermission().then(F=>{"granted"==F&&(t.hasSensorPermission=!0)}).catch(alert)}).catch(alert)},t.remove=function(){t.canvas.onmousemove=null,t.canvas.onmousedown=null,t.canvas.onmouseup=null,t.canvas.onclick=null,window.removeEventListener("keydown",d),window.removeEventListener("keyup",x),t.canvas.ontouchstart=null,t.canvas.ontouchmove=null,t.canvas.ontouchend=null,t.canvas.remove()};let N=F=>[1,0,0,0,0,Math.cos(F),-Math.sin(F),0,0,Math.sin(F),Math.cos(F),0,0,0,0,1],j=F=>[Math.cos(F),0,Math.sin(F),0,0,1,0,0,-Math.sin(F),0,Math.cos(F),0,0,0,0,1],W=(F,A)=>[F[0]*A[0]+F[1]*A[4]+F[2]*A[8]+F[3]*A[12],F[0]*A[1]+F[1]*A[5]+F[2]*A[9]+F[3]*A[13],F[0]*A[2]+F[1]*A[6]+F[2]*A[10]+F[3]*A[14],F[0]*A[3]+F[1]*A[7]+F[2]*A[11]+F[3]*A[15],F[4]*A[0]+F[5]*A[4]+F[6]*A[8]+F[7]*A[12],F[4]*A[1]+F[5]*A[5]+F[6]*A[9]+F[7]*A[13],F[4]*A[2]+F[5]*A[6]+F[6]*A[10]+F[7]*A[14],F[4]*A[3]+F[5]*A[7]+F[6]*A[11]+F[7]*A[15],F[8]*A[0]+F[9]*A[4]+F[10]*A[8]+F[11]*A[12],F[8]*A[1]+F[9]*A[5]+F[10]*A[9]+F[11]*A[13],F[8]*A[2]+F[9]*A[6]+F[10]*A[10]+F[11]*A[14],F[8]*A[3]+F[9]*A[7]+F[10]*A[11]+F[11]*A[15],F[12]*A[0]+F[13]*A[4]+F[14]*A[8]+F[15]*A[12],F[12]*A[1]+F[13]*A[5]+F[14]*A[9]+F[15]*A[13],F[12]*A[2]+F[13]*A[6]+F[14]*A[10]+F[15]*A[14],F[12]*A[3]+F[13]*A[7]+F[14]*A[11]+F[15]*A[15]],O=(F,A)=>[(F[0]*A[0]+F[1]*A[1]+F[2]*A[2]+F[3])/(F[12]*A[0]+F[13]*A[1]+F[14]*A[2]+F[15]),(F[4]*A[0]+F[5]*A[1]+F[6]*A[2]+F[7])/(F[12]*A[0]+F[13]*A[1]+F[14]*A[2]+F[15]),(F[8]*A[0]+F[9]*A[1]+F[10]*A[2]+F[11])/(F[12]*A[0]+F[13]*A[1]+F[14]*A[2]+F[15])];window.ondeviceorientation=function(F){t.pRotationX=t.rotationX,t.pRotationY=t.rotationY,t.pRotationZ=t.rotationZ,t.pRelRotationX=t.relRotationX,t.pRelRotationY=t.relRotationY,t.pRelRotationZ=t.relRotationZ,t.rotationX=F.beta*(Math.PI/180),t.rotationY=F.gamma*(Math.PI/180),t.rotationZ=F.alpha*(Math.PI/180),t.relRotationX=[-t.rotationY,-t.rotationX,t.rotationY][~~(window.orientation/90)+1],t.relRotationY=[-t.rotationX,t.rotationY,t.rotationX][~~(window.orientation/90)+1],t.relRotationZ=t.rotationZ},window.ondevicemotion=function(F){if(t.pAccelerationX=t.accelerationX,t.pAccelerationY=t.accelerationY,t.pAccelerationZ=t.accelerationZ,!F.acceleration){let A=O(W(j(t.rotationY),N(t.rotationX)),[0,0,-9.80665]);t.accelerationX=F.accelerationIncludingGravity.x+A[0],t.accelerationY=F.accelerationIncludingGravity.y+A[1],t.accelerationZ=F.accelerationIncludingGravity.z-A[2]}},t.year=function(){return new Date().getFullYear()},t.day=function(){return new Date().getDay()},t.hour=function(){return new Date().getHours()},t.minute=function(){return new Date().getMinutes()},t.second=function(){return new Date().getSeconds()},t.millis=function(){return window.performance.now()-a},t.avgRate=function(){return t.frameCount/(t.millis()/1e3)},t.currRate=function(){return(t.frameCount-M)/(t.millis()-r)*1e3}}(F)},wm=window.location.hash.slice(1),wY=wm.split("-")[0];try{let A=wm.split("-")[1],B=I9.from(A,"base64").toString("utf-8");F=JSON.parse(B)}catch(F){console.log("parsing hash failed",{hash:wm,error:F})}window.anybody,wc.setup=()=>{let A={level:0,todaysRecords:F};wY&&""!==wY&&(A.day=parseInt(wY)),window.anybody=new I$(wc,A),wY||(console.log("no day!"),window.location.hash=window.anybody.day.toString())},wc.draw=()=>{window.anybody.draw()}}();