diff --git a/dist/index.html b/dist/index.html index 3aab986..fb1254e 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.totalIntroStages=3,this.lastMissileCantBeUndone=!1,this.speedFactor=2,this.speedLimit=10,this.missileSpeed=22,this.shownStatScreen=!1,this.G=100,this.vectorLimit=this.speedLimit*this.speedFactor,this.missileVectorLimit=this.missileSpeed*this.speedFactor,this.missileVectorLimitSum=Math.floor(this.missileSpeed*this.speedFactor*1e3*Math.sqrt(2)),console.log({missileVectorLimitSum:this.missileVectorLimitSum}),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:IP[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).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric"}),this.framesTook=!1,this.showProblemRankingsScreenAt=-1,this.saveStatus="unsaved",this.shareCanvasBlob=void 0,delete this.validatedAt,delete this.validatingAt,delete this.savingAt,delete this.savedAt}init(){if(this.hits=[],this.skipAhead=!1,this.winScreenBaddies=void 0,this.seed=rI.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(),!this.opensea&&!this.util)try{this.mute=JSON.parse(sessionStorage.getItem("muted"))||!1}catch(F){this.mute=!1,sessionStorage.removeItem("muted")}this.sound?.setMuted(this.mute)}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,t=!0;for(this.showIt=!1;t;)if(++A>F)t=!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.handleKeyPressed}removeListener(){this.p.remove()}getXY(F){let A,t;return F.touches?(A=F.touches[0].pageX-this.canvasRect.left,t=F.touches[0].pageY-this.canvasRect.top):(A=F.offsetX||F.layerX,t=F.offsetY||F.layerY),{x:A=A*this.windowWidth/this.canvasRect.width,y:t=t*this.windowHeight/this.canvasRect.height}}handleMouseMove=F=>{let{x:A,y:t}=this.getXY(F);for(let F in this.mouseX=A,this.mouseY=t,this.buttons){let B=this.buttons[F];B.hover=I_(B,A,t)}};handleGameClick=F=>{this.gameOver&&this.won&&(this.skipAhead=!0);let{x:A,y:t}=this.getXY(F);for(let F in this.buttons){let B=this.buttons[F];if(B.visible&&I_(B,A,t)&&!B.disabled){B.onClick();return}}if(this.introStage>1,r=23===i?5960464477539062e-23:0,n=B?0:e-1,M=B?1:-1,g=A<0||0===A&&1/A<0?1:0;for(isNaN(A=Math.abs(A))||A===1/0?(s=isNaN(A)?1:0,V=h):(V=Math.floor(Math.log(A)/Math.LN2),A*(o=Math.pow(2,-V))<1&&(V--,o*=2),V+a>=1?A+=r/o:A+=r*Math.pow(2,1-a),A*o>=2&&(V++,o/=2),V+a>=h?(s=0,V=h):V+a>=1?(s=(A*o-1)*Math.pow(2,i),V+=a):(s=A*Math.pow(2,a-1)*Math.pow(2,i),V=0));i>=8;F[t+n]=255&s,n+=M,s/=256,i-=8);for(V=V<0;F[t+n]=255&V,n+=M,V/=256,q-=8);F[t+n-M]|=128*g};var I3="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function I9(F){if(F>2147483647)throw RangeError('The value "'+F+'" is invalid for option "size"');var A=new Uint8Array(F);return Object.setPrototypeOf(A,I7.prototype),A}function I7(F,A,t){if("number"==typeof F){if("string"==typeof A)throw TypeError('The "string" argument must be of type string. Received type number');return wt(F)}return wF(F,A,t)}function wF(F,A,t){if("string"==typeof F)return function(F,A){if(("string"!=typeof A||""===A)&&(A="utf8"),!I7.isEncoding(A))throw TypeError("Unknown encoding: "+A);var t=0|wV(F,A),B=I9(t),i=B.write(F,A);return i!==t&&(B=B.slice(0,i)),B}(F,A);if(ArrayBuffer.isView(F))return function(F){if(wc(F,Uint8Array)){var A=new Uint8Array(F);return wi(A.buffer,A.byteOffset,A.byteLength)}return wB(F)}(F);if(null==F)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof F);if(wc(F,ArrayBuffer)||F&&wc(F.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(wc(F,SharedArrayBuffer)||F&&wc(F.buffer,SharedArrayBuffer)))return wi(F,A,t);if("number"==typeof F)throw TypeError('The "value" argument must not be of type number. Received type number');var B=F.valueOf&&F.valueOf();if(null!=B&&B!==F)return I7.from(B,A,t);var i=function(F){if(I7.isBuffer(F)){var A,t=0|we(F.length),B=I9(t);return 0===B.length||F.copy(B,0,0,t),B}return void 0!==F.length?"number"!=typeof F.length||(A=F.length)!=A?I9(0):wB(F):"Buffer"===F.type&&Array.isArray(F.data)?wB(F.data):void 0}(F);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof F[Symbol.toPrimitive])return I7.from(F[Symbol.toPrimitive]("string"),A,t);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof F)}function wA(F){if("number"!=typeof F)throw TypeError('"size" argument must be of type number');if(F<0)throw RangeError('The value "'+F+'" is invalid for option "size"')}function wt(F){return wA(F),I9(F<0?0:0|we(F))}function wB(F){for(var A=F.length<0?0:0|we(F.length),t=I9(A),B=0;B=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|F}function wV(F,A){if(I7.isBuffer(F))return F.length;if(ArrayBuffer.isView(F)||wc(F,ArrayBuffer))return F.byteLength;if("string"!=typeof F)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof F);var t=F.length,B=arguments.length>2&&!0===arguments[2];if(!B&&0===t)return 0;for(var i=!1;;)switch(A){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return wI(F).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return ww(F).length;default:if(i)return B?-1:wI(F).length;A=(""+A).toLowerCase(),i=!0}}function ws(F,A,t){var B,i,e=!1;if((void 0===A||A<0)&&(A=0),A>this.length||((void 0===t||t>this.length)&&(t=this.length),t<=0||(t>>>=0)<=(A>>>=0)))return"";for(F||(F="utf8");;)switch(F){case"hex":return function(F,A,t){var B=F.length;(!A||A<0)&&(A=0),(!t||t<0||t>B)&&(t=B);for(var i="",e=A;e2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),(e=t=+t)!=e&&(t=i?0:F.length-1),t<0&&(t=F.length+t),t>=F.length){if(i)return -1;t=F.length-1}else if(t<0){if(!i)return -1;t=0}if("string"==typeof A&&(A=I7.from(A,B)),I7.isBuffer(A))return 0===A.length?-1:wh(F,A,t,B,i);if("number"==typeof A)return(A&=255,"function"==typeof Uint8Array.prototype.indexOf)?i?Uint8Array.prototype.indexOf.call(F,A,t):Uint8Array.prototype.lastIndexOf.call(F,A,t):wh(F,[A],t,B,i);throw TypeError("val must be string, number or Buffer")}function wh(F,A,t,B,i){var e,V=1,s=F.length,o=A.length;if(void 0!==B&&("ucs2"===(B=String(B).toLowerCase())||"ucs-2"===B||"utf16le"===B||"utf-16le"===B)){if(F.length<2||A.length<2)return -1;V=2,s/=2,o/=2,t/=2}function q(F,A){return 1===V?F[A]:F.readUInt16BE(A*V)}if(i){var h=-1;for(e=t;e s&&(t=s-o),e=t;e>=0;e--){for(var a=!0,r=0;r239?4:q>223?3:q>191?2:1;if(i+a<=t)switch(a){case 1:q<128&&(h=q);break;case 2:(192&(e=F[i+1]))==128&&(o=(31&q)<<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&q)<<12|(63&e)<<6|63&V)>2047&&(o<55296||o>57343)&&(h=o);break;case 4:e=F[i+1],V=F[i+2],s=F[i+3],(192&e)==128&&(192&V)==128&&(192&s)==128&&(o=(15&q)<<18|(63&e)<<12|(63&V)<<6|63&s)>65535&&o<1114112&&(h=o)}null===h?(h=65533,a=1):h>65535&&(h-=65536,B.push(h>>>10&1023|55296),h=56320|1023&h),B.push(h),i+=a}return function(F){var A=F.length;if(A<=4096)return String.fromCharCode.apply(String,F);for(var t="",B=0;Bt)throw RangeError("Trying to access beyond buffer length")}function wn(F,A,t,B,i,e){if(!I7.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,t,B,i,e){if(t+B>F.length||t<0)throw RangeError("Index out of range")}function wg(F,A,t,B,i){return A=+A,t>>>=0,i||wM(F,A,t,4,34028234663852886e22,-34028234663852886e22),AT(F,A,t,B,23,4),t+4}function wl(F,A,t,B,i){return A=+A,t>>>=0,i||wM(F,A,t,8,17976931348623157e292,-17976931348623157e292),AT(F,A,t,B,52,8),t+8}I7.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}}(),I7.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(I7.prototype,"parent",{enumerable:!0,get:function(){if(I7.isBuffer(this))return this.buffer}}),Object.defineProperty(I7.prototype,"offset",{enumerable:!0,get:function(){if(I7.isBuffer(this))return this.byteOffset}}),I7.poolSize=8192,I7.from=function(F,A,t){return wF(F,A,t)},Object.setPrototypeOf(I7.prototype,Uint8Array.prototype),Object.setPrototypeOf(I7,Uint8Array),I7.alloc=function(F,A,t){return(wA(F),F<=0)?I9(F):void 0!==A?"string"==typeof t?I9(F).fill(A,t):I9(F).fill(A):I9(F)},I7.allocUnsafe=function(F){return wt(F)},I7.allocUnsafeSlow=function(F){return wt(F)},I7.isBuffer=function(F){return null!=F&&!0===F._isBuffer&&F!==I7.prototype},I7.compare=function(F,A){if(wc(F,Uint8Array)&&(F=I7.from(F,F.offset,F.byteLength)),wc(A,Uint8Array)&&(A=I7.from(A,A.offset,A.byteLength)),!I7.isBuffer(F)||!I7.isBuffer(A))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(F===A)return 0;for(var t=F.length,B=A.length,i=0,e=Math.min(t,B);i B.length?I7.from(e).copy(B,i):Uint8Array.prototype.set.call(B,e,i);else if(I7.isBuffer(e))e.copy(B,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=e.length}return B},I7.byteLength=wV,I7.prototype._isBuffer=!0,I7.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+=" ... ")," "},I3&&(I7.prototype[I3]=I7.prototype.inspect),I7.prototype.compare=function(F,A,t,B,i){if(wc(F,Uint8Array)&&(F=I7.from(F,F.offset,F.byteLength)),!I7.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===t&&(t=F?F.length:0),void 0===B&&(B=0),void 0===i&&(i=this.length),A<0||t>F.length||B<0||i>this.length)throw RangeError("out of range index");if(B>=i&&A>=t)return 0;if(B>=i)return -1;if(A>=t)return 1;if(A>>>=0,t>>>=0,B>>>=0,i>>>=0,this===F)return 0;for(var e=i-B,V=t-A,s=Math.min(e,V),o=this.slice(B,i),q=F.slice(A,t),h=0;h >>=0,isFinite(t)?(t>>>=0,void 0===B&&(B="utf8")):(B=t,t=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var i,e,V,s,o,q,h,a,r=this.length-A;if((void 0===t||t>r)&&(t=r),F.length>0&&(t<0||A<0)||A>this.length)throw RangeError("Attempt to write outside buffer bounds");B||(B="utf8");for(var n=!1;;)switch(B){case"hex":return function(F,A,t,B){t=Number(t)||0;var i=F.length-t;B?(B=Number(B))>i&&(B=i):B=i;var e=A.length;B>e/2&&(B=e/2);for(var V=0;V>8,i.push(t%256),i.push(B);return i}(F,this.length-h),this,h,a);default:if(n)throw TypeError("Unknown encoding: "+B);B=(""+B).toLowerCase(),n=!0}},I7.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},I7.prototype.slice=function(F,A){var t=this.length;F=~~F,A=void 0===A?t:~~A,F<0?(F+=t)<0&&(F=0):F>t&&(F=t),A<0?(A+=t)<0&&(A=0):A>t&&(A=t),A>>=0,A>>>=0,t||wr(F,A,this.length);for(var B=this[F],i=1,e=0;++e>>=0,A>>>=0,t||wr(F,A,this.length);for(var B=this[F+--A],i=1;A>0&&(i*=256);)B+=this[F+--A]*i;return B},I7.prototype.readUint8=I7.prototype.readUInt8=function(F,A){return F>>>=0,A||wr(F,1,this.length),this[F]},I7.prototype.readUint16LE=I7.prototype.readUInt16LE=function(F,A){return F>>>=0,A||wr(F,2,this.length),this[F]|this[F+1]<<8},I7.prototype.readUint16BE=I7.prototype.readUInt16BE=function(F,A){return F>>>=0,A||wr(F,2,this.length),this[F]<<8|this[F+1]},I7.prototype.readUint32LE=I7.prototype.readUInt32LE=function(F,A){return F>>>=0,A||wr(F,4,this.length),(this[F]|this[F+1]<<8|this[F+2]<<16)+16777216*this[F+3]},I7.prototype.readUint32BE=I7.prototype.readUInt32BE=function(F,A){return F>>>=0,A||wr(F,4,this.length),16777216*this[F]+(this[F+1]<<16|this[F+2]<<8|this[F+3])},I7.prototype.readIntLE=function(F,A,t){F>>>=0,A>>>=0,t||wr(F,A,this.length);for(var B=this[F],i=1,e=0;++e=(i*=128)&&(B-=Math.pow(2,8*A)),B},I7.prototype.readIntBE=function(F,A,t){F>>>=0,A>>>=0,t||wr(F,A,this.length);for(var B=A,i=1,e=this[F+--B];B>0&&(i*=256);)e+=this[F+--B]*i;return e>=(i*=128)&&(e-=Math.pow(2,8*A)),e},I7.prototype.readInt8=function(F,A){return(F>>>=0,A||wr(F,1,this.length),128&this[F])?-((255-this[F]+1)*1):this[F]},I7.prototype.readInt16LE=function(F,A){F>>>=0,A||wr(F,2,this.length);var t=this[F]|this[F+1]<<8;return 32768&t?4294901760|t:t},I7.prototype.readInt16BE=function(F,A){F>>>=0,A||wr(F,2,this.length);var t=this[F+1]|this[F]<<8;return 32768&t?4294901760|t:t},I7.prototype.readInt32LE=function(F,A){return F>>>=0,A||wr(F,4,this.length),this[F]|this[F+1]<<8|this[F+2]<<16|this[F+3]<<24},I7.prototype.readInt32BE=function(F,A){return F>>>=0,A||wr(F,4,this.length),this[F]<<24|this[F+1]<<16|this[F+2]<<8|this[F+3]},I7.prototype.readFloatLE=function(F,A){return F>>>=0,A||wr(F,4,this.length),Ax(this,F,!0,23,4)},I7.prototype.readFloatBE=function(F,A){return F>>>=0,A||wr(F,4,this.length),Ax(this,F,!1,23,4)},I7.prototype.readDoubleLE=function(F,A){return F>>>=0,A||wr(F,8,this.length),Ax(this,F,!0,52,8)},I7.prototype.readDoubleBE=function(F,A){return F>>>=0,A||wr(F,8,this.length),Ax(this,F,!1,52,8)},I7.prototype.writeUintLE=I7.prototype.writeUIntLE=function(F,A,t,B){if(F=+F,A>>>=0,t>>>=0,!B){var i=Math.pow(2,8*t)-1;wn(this,F,A,t,i,0)}var e=1,V=0;for(this[A]=255&F;++V >>=0,t>>>=0,!B){var i=Math.pow(2,8*t)-1;wn(this,F,A,t,i,0)}var e=t-1,V=1;for(this[A+e]=255&F;--e>=0&&(V*=256);)this[A+e]=F/V&255;return A+t},I7.prototype.writeUint8=I7.prototype.writeUInt8=function(F,A,t){return F=+F,A>>>=0,t||wn(this,F,A,1,255,0),this[A]=255&F,A+1},I7.prototype.writeUint16LE=I7.prototype.writeUInt16LE=function(F,A,t){return F=+F,A>>>=0,t||wn(this,F,A,2,65535,0),this[A]=255&F,this[A+1]=F>>>8,A+2},I7.prototype.writeUint16BE=I7.prototype.writeUInt16BE=function(F,A,t){return F=+F,A>>>=0,t||wn(this,F,A,2,65535,0),this[A]=F>>>8,this[A+1]=255&F,A+2},I7.prototype.writeUint32LE=I7.prototype.writeUInt32LE=function(F,A,t){return F=+F,A>>>=0,t||wn(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},I7.prototype.writeUint32BE=I7.prototype.writeUInt32BE=function(F,A,t){return F=+F,A>>>=0,t||wn(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},I7.prototype.writeIntLE=function(F,A,t,B){if(F=+F,A>>>=0,!B){var i=Math.pow(2,8*t-1);wn(this,F,A,t,i-1,-i)}var e=0,V=1,s=0;for(this[A]=255&F;++e >0)-s&255;return A+t},I7.prototype.writeIntBE=function(F,A,t,B){if(F=+F,A>>>=0,!B){var i=Math.pow(2,8*t-1);wn(this,F,A,t,i-1,-i)}var e=t-1,V=1,s=0;for(this[A+e]=255&F;--e>=0&&(V*=256);)F<0&&0===s&&0!==this[A+e+1]&&(s=1),this[A+e]=(F/V>>0)-s&255;return A+t},I7.prototype.writeInt8=function(F,A,t){return F=+F,A>>>=0,t||wn(this,F,A,1,127,-128),F<0&&(F=255+F+1),this[A]=255&F,A+1},I7.prototype.writeInt16LE=function(F,A,t){return F=+F,A>>>=0,t||wn(this,F,A,2,32767,-32768),this[A]=255&F,this[A+1]=F>>>8,A+2},I7.prototype.writeInt16BE=function(F,A,t){return F=+F,A>>>=0,t||wn(this,F,A,2,32767,-32768),this[A]=F>>>8,this[A+1]=255&F,A+2},I7.prototype.writeInt32LE=function(F,A,t){return F=+F,A>>>=0,t||wn(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},I7.prototype.writeInt32BE=function(F,A,t){return F=+F,A>>>=0,t||wn(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},I7.prototype.writeFloatLE=function(F,A,t){return wg(this,F,A,!0,t)},I7.prototype.writeFloatBE=function(F,A,t){return wg(this,F,A,!1,t)},I7.prototype.writeDoubleLE=function(F,A,t){return wl(this,F,A,!0,t)},I7.prototype.writeDoubleBE=function(F,A,t){return wl(this,F,A,!1,t)},I7.prototype.copy=function(F,A,t,B){if(!I7.isBuffer(F))throw TypeError("argument should be a Buffer");if(t||(t=0),B||0===B||(B=this.length),A>=F.length&&(A=F.length),A||(A=0),B>0&&B =this.length)throw RangeError("Index out of range");if(B<0)throw RangeError("sourceEnd out of bounds");B>this.length&&(B=this.length),F.length-A >>=0,t=void 0===t?this.length:t>>>0,F||(F=0),"number"==typeof F)for(i=A;i 55295&&t<57344){if(!i){if(t>56319||V+1===B){(A-=3)>-1&&e.push(239,191,189);continue}i=t;continue}if(t<56320){(A-=3)>-1&&e.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(A-=3)>-1&&e.push(239,191,189);if(i=null,t<128){if((A-=1)<0)break;e.push(t)}else if(t<2048){if((A-=2)<0)break;e.push(t>>6|192,63&t|128)}else if(t<65536){if((A-=3)<0)break;e.push(t>>12|224,t>>6&63|128,63&t|128)}else if(t<1114112){if((A-=4)<0)break;e.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}else throw Error("Invalid code point")}return e}function ww(F){return AR(function(F){if((F=(F=F.split("=")[0]).trim().replace(wC,"")).length<2)return"";for(;F.length%4!=0;)F+="=";return F}(F))}function wQ(F,A,t,B){for(var i=0;i=A.length)&&!(i>=F.length);++i)A[i+t]=F[i];return i}function wc(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),t=0;t<16;++t)for(var B=16*t,i=0;i<16;++i)A[B+i]=F[t]+F[i];return A}();let wm=new function(F,A){return new function F(t){let B="global"==t?window:this;B.canvas=document.createElement("canvas");let i=B.canvas.getContext("2d");B.width=100,B.height=100,B.canvas.width=B.width,B.canvas.height=B.height,"offscreen"!=t&&(A?A.appendChild(B.canvas):document.body?document.body.appendChild(B.canvas):window.addEventListener("load",function(){document.body.appendChild(B.canvas)})),I(),B.MAGIC=161533525,B.RGB=0,B.HSV=1,B.HSB=1,B.CHORD=0,B.PIE=1,B.OPEN=2,B.RADIUS=1,B.CORNER=2,B.CORNERS=3,B.ROUND="round",B.SQUARE="butt",B.PROJECT="square",B.MITER="miter",B.BEVEL="bevel",B.CLOSE=1,B.BLEND="source-over",B.REMOVE="destination-out",B.ADD="lighter",B.DARKEST="darken",B.LIGHTEST="lighten",B.DIFFERENCE="difference",B.SUBTRACT="subtract",B.EXCLUSION="exclusion",B.MULTIPLY="multiply",B.SCREEN="screen",B.REPLACE="copy",B.OVERLAY="overlay",B.HARD_LIGHT="hard-light",B.SOFT_LIGHT="soft-light",B.DODGE="color-dodge",B.BURN="color-burn",B.NORMAL="normal",B.ITALIC="italic",B.BOLD="bold",B.BOLDITALIC="italic bold",B.CENTER="center",B.LEFT="left",B.RIGHT="right",B.TOP="top",B.BOTTOM="bottom",B.BASELINE="alphabetic",B.LANDSCAPE="landscape",B.PORTRAIT="portrait",B.ALT=18,B.BACKSPACE=8,B.CONTROL=17,B.DELETE=46,B.DOWN_ARROW=40,B.ENTER=13,B.ESCAPE=27,B.LEFT_ARROW=37,B.OPTION=18,B.RETURN=13,B.RIGHT_ARROW=39,B.SHIFT=16,B.TAB=9,B.UP_ARROW=38,B.HALF_PI=Math.PI/2,B.PI=Math.PI,B.QUARTER_PI=Math.PI/4,B.TAU=2*Math.PI,B.TWO_PI=2*Math.PI,B.THRESHOLD=1,B.GRAY=2,B.OPAQUE=3,B.INVERT=4,B.POSTERIZE=5,B.DILATE=6,B.ERODE=7,B.BLUR=8,B.ARROW="default",B.CROSS="crosshair",B.HAND="pointer",B.MOVE="move",B.TEXT="text",B.VIDEO={video:!0,audio:!1},B.AUDIO={video:!1,audio:!0},B.SHR3=1,B.LCG=2,B.HARDWARE_FILTERS=!0,B.hint=function(F,A){B[F]=A},B.frameCount=0,B.mouseX=0,B.mouseY=0,B.pmouseX=0,B.pmouseY=0,B.mouseButton=null,B.keyIsPressed=!1,B.mouseIsPressed=!1,B.key=null,B.keyCode=null,B.pixels=null,B.accelerationX=0,B.accelerationY=0,B.accelerationZ=0,B.rotationX=0,B.rotationY=0,B.rotationZ=0,B.relRotationX=0,B.relRotationY=0,B.relRotationZ=0,B.pAccelerationX=0,B.pAccelerationY=0,B.pAccelerationZ=0,B.pRotationX=0,B.pRotationY=0,B.pRotationZ=0,B.pRelRotationX=0,B.pRelRotationY=0,B.pRelRotationZ=0,B.touches=[],B._styleCache=[{colorMode:B.RGB,noStroke:!1,noFill:!1,ellipseMode:B.CENTER,rectMode:B.CORNER,curveDetail:20,curveAlpha:0,textFont:"sans-serif",textSize:12,textLeading:12,textStyle:"normal"}],B._style=B._styleCache[B._styleCache.length-1],B._noLoop=!1,B._pixelDensity=1,B._frameRate=null,B._tint=null;let e=null,V=!0,s=[],o=null,q=0,h={},a=0,r=0,n=0,M=null,g=null,l=null;for(let A of(Object.defineProperty(B,"deviceOrientation",{get:function(){return 90==Math.abs(window.orientation)?B.LANDSCAPE:B.PORTRAIT}}),Object.defineProperty(B,"windowWidth",{get:function(){return window.innerWidth}}),Object.defineProperty(B,"windowHeight",{get:function(){return window.innerHeight}}),Object.defineProperty(B,"drawingContext",{get:function(){return i}}),B.createCanvas=function(F,A){return B.width=F,B.height=A,B.canvas.width=F,B.canvas.height=A,I(),B.canvas},B.resizeCanvas=function(F,A){B.width=F,B.height=A,B.canvas.width=F,B.canvas.height=A},B.createGraphics=B.createImage=function(A,t){let B=new F("offscreen");return B.createCanvas(A,t),B.noLoop(),B},B.pixelDensity=function(F){return void 0==F||(B._pixelDensity=F,B.canvas.width=Math.ceil(B.width*F),B.canvas.height=Math.ceil(B.height*F),B.canvas.style.width=B.width+"px",B.canvas.style.height=B.height+"px",i.scale(B._pixelDensity,B._pixelDensity),I()),B._pixelDensity},B.map=function(F,A,t,B,i,e){let V=B+(F-A)*1/(t-A)*(i-B);return e?BF){let t=F/A;i.x*=t,i.y*=t,i.z*=t,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),t=Math.sin(F),B=i.x*A-i.y*t,e=i.x*t+i.y*A;return i.x=B,i.y=e,i},i.angleBetween=function(){let F=s.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,q(),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,s=~~V,o=V-s,q=t*(1-A),h=t*(1-A*o),a=t*(1-A*(1-o)),s){case 0:B=t,i=a,e=q;break;case 1:B=h,i=t,e=q;break;case 2:B=q,i=t,e=a;break;case 3:B=q,i=h,e=t;break;case 4:B=a,i=q,e=t;break;default:B=t,i=q,e=h}return[255*B,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,t,e,V,s,o,q){if(B._style.noFill&&B._style.noStroke)return;let h=w(V),a=w(s);i.beginPath();for(let V=0;V A?F>t?F:t:A>t?A:t)/255))?[0,V=0,s]:0==(V=100*(e-B)/e)?[0,V,s]:[e==F?0+60*(A-t)/(e-B):e==A?120+60*(t-F)/(e-B):240+60*(F-A)/(e-B),V,s]),i._hsvInferred=!0}},i.toString=function(){return`rgba(${Math.round(i._r)},${Math.round(i._g)},${Math.round(i._b)},${~~(1e3*i._a)/1e3})`}},B.colorMode=function(F){B._style.colorMode=F},B.color=function(){if(1==arguments.length&&786698==arguments[0].MAGIC)return arguments[0];if(B._style.colorMode==B.RGB){if(1==arguments.length)return new B.Color(arguments[0],arguments[0],arguments[0],1);if(2==arguments.length)return new B.Color(arguments[0],arguments[0],arguments[0],arguments[1]/255);if(3==arguments.length)return new B.Color(arguments[0],arguments[1],arguments[2],1);if(4==arguments.length)return new B.Color(arguments[0],arguments[1],arguments[2],arguments[3]/255)}else{if(1==arguments.length)return new B.Color(...C(0,0,arguments[0]/100),1);if(2==arguments.length)return new B.Color(...C(0,0,arguments[0]/100),arguments[1]/255);if(3==arguments.length)return new B.Color(...C(arguments[0],arguments[1]/100,arguments[2]/100),1);if(4==arguments.length)return new B.Color(...C(arguments[0],arguments[1]/100,arguments[2]/100),arguments[3])}return null},B.red=function(F){return F._r},B.green=function(F){return F._g},B.blue=function(F){return F._b},B.alpha=function(F){return 255*F._a},B.hue=function(F){return F._inferHSV(),F._h},B.saturation=function(F){return F._inferHSV(),F._s},B.brightness=function(F){return F._inferHSV(),F._v},B.lightness=function(F){return(.2126*F._r+.7152*F._g+.0722*F._b)*100/255},B.lerpColor=function(F,A,t){var i,e,V;return B._style.colorMode==B.RGB?new B.Color(B.constrain(B.lerp(F._r,A._r,t),0,255),B.constrain(B.lerp(F._g,A._g,t),0,255),B.constrain(B.lerp(F._b,A._b,t),0,255),B.constrain(B.lerp(F._a,A._a,t),0,1)):(F._inferHSV(),A._inferHSV(),new B.Color(B.constrain((i=F._h,(V=[[Math.abs((e=A._h)-i),B.map(t,0,1,i,e)],[Math.abs(e+360-i),B.map(t,0,1,i,e+360)],[Math.abs(e-360-i),B.map(t,0,1,i,e-360)]]).sort((F,A)=>F[0]-A[0]),(V[0][1]+720)%360),0,360),B.constrain(B.lerp(F._s,A._s,t),0,100),B.constrain(B.lerp(F._v,A._v,t),0,100),B.constrain(B.lerp(F._a,A._a,t),0,1)))},B.strokeWeight=function(F){B._style_noStroke=!1,i.lineWidth=F},B.stroke=function(){if(B._style.noStroke=!1,"string"==typeof arguments[0]){i.strokeStyle=arguments[0];return}let F=B.color.apply(null,arguments);if(F._a<=0){B._style.noStroke=!0;return}i.strokeStyle=F},B.noStroke=function(){B._style.noStroke=!0},B.fill=function(){if(B._style.noFill=!1,"string"==typeof arguments[0]){i.fillStyle=arguments[0];return}let F=B.color.apply(null,arguments);if(F._a<=0){B._style.noFill=!0;return}i.fillStyle=F},B.noFill=function(){B._style.noFill=!0},B.blendMode=function(F){i.globalCompositeOperation=F},B.strokeCap=function(F){i.lineCap=F},B.strokeJoin=function(F){i.lineJoin=F},B.ellipseMode=function(F){B._style.ellipseMode=F},B.rectMode=function(F){B._style.rectMode=F},B.curveDetail=function(F){B._style.curveDetail=F},B.curveAlpha=function(F){B._style.curveAlpha=F},B.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."),B._style.curveAlpha=F},B.clear=function(){i.clearRect(0,0,B.width,B.height)},B.background=function(){if(arguments[0]&&arguments[0].MAGIC==B.MAGIC)return B.image(arguments[0],0,0,B.width,B.height);i.save(),i.resetTransform(),i.scale(B._pixelDensity,B._pixelDensity),"string"==typeof arguments[0]?i.fillStyle=arguments[0]:i.fillStyle=B.color(...Array.from(arguments)),i.fillRect(0,0,B.width,B.height),i.restore()},B.line=function(F,A,t,e){B._style.noStroke||(i.beginPath(),i.moveTo(F,A),i.lineTo(t,e),i.stroke())},B.arc=function(F,A,t,i,e,V,s,o){if(e==V)return B.ellipse(F,A,t,i);void 0==o&&(o=25),void 0==s&&(s=B.PIE),B._style.ellipseMode==B.CENTER?Q(F,A,t,i,e,V,s,o):B._style.ellipseMode==B.RADIUS?Q(F,A,2*t,2*i,e,V,s,o):B._style.ellipseMode==B.CORNER?Q(F+t/2,A+i/2,t,i,e,V,s,o):B._style.ellipseMode==B.CORNERS&&Q((F+t)/2,(A+i)/2,t-F,i-A,e,V,s,o)},B.ellipse=function(F,A,t,i){void 0==i&&(i=t),B._style.ellipseMode==B.CENTER?c(F,A,t,i):B._style.ellipseMode==B.RADIUS?c(F,A,2*t,2*i):B._style.ellipseMode==B.CORNER?c(F+t/2,A+i/2,t,i):B._style.ellipseMode==B.CORNERS&&c((F+t)/2,(A+i)/2,t-F,i-A)},B.circle=function(F,A,t){return B.ellipse(F,A,t,t)},B.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()},B.rect=function(F,A,t,i,e,V,s,o){B._style.rectMode==B.CENTER?E(F-t/2,A-i/2,t,i,e,V,s,o):B._style.rectMode==B.RADIUS?E(F-t,A-i,2*t,2*i,e,V,s,o):B._style.rectMode==B.CORNER?E(F,A,t,i,e,V,s,o):B._style.rectMode==B.CORNERS&&E(F,A,t-F,i-A,e,V,s,o)},B.square=function(F,A,t,i,e,V,s){return B.rect(F,A,t,t,i,e,V,s)},B.beginShape=function(){m(),i.beginPath(),V=!0},B.beginContour=function(){i.closePath(),m(),V=!0},B.endContour=function(){m(),V=!0},B.vertex=function(F,A){m(),V?i.moveTo(F,A):i.lineTo(F,A),V=!1},B.bezierVertex=function(F,A,t,B,e,V){m(),i.bezierCurveTo(F,A,t,B,e,V)},B.quadraticVertex=function(F,A,t,B){m(),i.quadraticCurveTo(F,A,t,B)},B.bezier=function(F,A,t,i,e,V,s,o){B.beginShape(),B.vertex(F,A),B.bezierVertex(t,i,e,V,s,o),B.endShape()},B.triangle=function(F,A,t,i,e,V){B.beginShape(),B.vertex(F,A),B.vertex(t,i),B.vertex(e,V),B.endShape(B.CLOSE)},B.quad=function(F,A,t,i,e,V,s,o){B.beginShape(),B.vertex(F,A),B.vertex(t,i),B.vertex(e,V),B.vertex(s,o),B.endShape(B.CLOSE)},B.endShape=function(F){m(),F&&i.closePath(),B._style.noFill||i.fill(),B._style.noStroke||i.stroke(),B._style.noFill&&B._style.noStroke&&(i.save(),i.fillStyle="none",i.fill(),i.restore())},B.curveVertex=function(F,A){if(s.push([F,A]),s.length<4)return;let t=function(F,A,t,B,i,e,V,s,o,q){function h(F,A,t,B,i,e){return Math.pow(Math.pow(B-A,2)+Math.pow(i-t,2),.5*e)+F}let a=[],r=h(0,F,A,t,B,q),n=h(r,t,B,i,e,q),M=h(n,i,e,V,s,q);for(let q=0;q0?(g[F]=1,g[F+1]=0):(g[F]=0,g[F+1]=1));let l=F*g[0]+t*g[1],C=A*g[0]+B*g[1],I=t*g[2]+i*g[3],w=B*g[2]+e*g[3],Q=i*g[4]+V*g[5],c=e*g[4]+s*g[5],E=l*g[6]+I*g[7],m=C*g[6]+w*g[7],Y=I*g[8]+Q*g[9],D=w*g[8]+c*g[9],p=E*g[2]+Y*g[3],u=m*g[2]+D*g[3];a.push([p,u])}return a}(...s[s.length-4],...s[s.length-3],...s[s.length-2],...s[s.length-1],B._style.curveDetail,B._style.curveAlpha);for(let F=0;F =A?255:0}},Y[B.GRAY]=function(F){for(let A=0;A >8)*255/t,F[B+1]=(F[B+1]*A>>8)*255/t,F[B+2]=(F[B+2]*A>>8)*255/t},Y[B.DILATE]=function(F){p(),l.set(F);let[A,t]=[i.canvas.width,i.canvas.height];for(let B=0;B =1&&(q++,r--),n>=1&&(h++,n--),M>=1&&(a++,M--)}return g},B.noiseDetail=function(F,A){F>0&&(S=F),A>0&&(k=A)};let y=function(){let F,A;return{setSeed(t){A=F=(null==t?4294967296*Math.random():t)>>>0},getSeed:()=>F,rand:()=>(A=(1664525*A+1013904223)%4294967296)/4294967296}},K=function(){let F,A;return{setSeed(t){F=A=(null==t?4294967295*Math.random():t)>>>0},getSeed:()=>A,rand:()=>(F^=F<<17,F^=F>>13,((F^=F<<5)>>>0)/4294967295)}},Z=K();Z.setSeed(),B.noiseSeed=function(F){let A=void 0==F?4294967295*Math.random():F;G||(G=new Float32Array(4096));for(var t=0;t<4096;t++)A^=A<<17,A^=A>>13,A^=A<<5,G[t]=(A>>>0)/4294967295},B.randomSeed=function(F){Z.setSeed(F)},B.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},B.randomGenerator=function(F){F==B.LCG?Z=y():F==B.SHR3&&(Z=K()),Z.setSeed()};var J=new function(){var F,A,t,B=Array(128),i=Array(256),e=Array(128),V=Array(128),s=Array(256),o=Array(256),q=function(){return 4294967296*Z.rand()-2147483648},h=function(){return .5+(q()<<0)*2328306e-16},a=function(){for(var A,i,s,o;;){if(A=t*e[F],0==F){do s=h(),o=h(),A=-(.2904764*Math.log(s)),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--)t=Math.sqrt(-2*Math.log(.00991256303526217/t+Math.exp(-.5*t*t))),B[A+1]=Math.floor(t/q*2147483648),q=t,V[A]=Math.exp(-.5*t*t),e[A]=t/2147483648;for(A=254,F=.003949659822581572/Math.exp(-h),i[0]=Math.floor(h/F*4294967296),i[1]=0,s[0]=F/4294967296,s[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),s[A]=h/4294967296}};for(let F of(J.hasInit=!1,B.randomGaussian=function(F,A){return J.hasInit||(J.zigset(),J.hasInit=!0),J.RNOR()*A+F},B.randomExponential=function(){return J.hasInit||(J.zigset(),J.hasInit=!0),J.REXP()},B.print=console.log,B.cursor=function(F,A,t){let i="";F.includes(".")&&(F=`url("${F}")`,i=", auto"),void 0!=A&&(F+=" "+A+" "+t),B.canvas.style.cursor=F+i},B.noCursor=function(){B.canvas.style.cursor="none"},B.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";B[A]=function(){},B[A].isPlaceHolder=!0,B[F]?B[A]=B[F]:Object.defineProperty(B,F,{set:function(F){B[A]=F}})}function R(){B._noLoop||(e=null==B._frameRate?requestAnimationFrame(R):setTimeout(R,1e3/B._frameRate)),m(),V=!0,B.push(),B._drawFn(),B.pop(),++B.frameCount,B.frameCount%60==0&&(r=window.performance.now()-a,n=B.frameCount)}B.noLoop=function(){B._noLoop=!0,clearTimeout(e),e=null},B.loop=function(){B._noLoop=!1,null==e&&R()},B.redraw=function(){R()},B.frameRate=function(F){B._frameRate=F},setTimeout(function(){B._preloadFn(),a=window.performance.now(),function F(){if(q>0)return setTimeout(F,10);B._setupFn(),R()}()},1),B.canvas.onmousemove=function(F){B.pmouseX=B.mouseX,B.pmouseY=B.mouseY,B.mouseX=F.offsetX,B.mouseY=F.offsetY,B.mouseIsPressed?B._mouseDraggedFn(F):B._mouseMovedFn(F)},B.canvas.onmousedown=function(F){B.pmouseX=B.mouseX,B.pmouseY=B.mouseY,B.mouseX=F.offsetX,B.mouseY=F.offsetY,B.mouseIsPressed=!0,B.mouseButton=[B.LEFT,B.CENTER,B.RIGHT][F.button],B._mousePressedFn(F)},B.canvas.onmouseup=function(F){B.pmouseX=B.mouseX,B.pmouseY=B.mouseY,B.mouseX=F.offsetX,B.mouseY=F.offsetY,B.mouseIsPressed=!1,B._mouseReleasedFn(F)},B.canvas.onclick=function(F){B.pmouseX=B.mouseX,B.pmouseY=B.mouseY,B.mouseX=F.offsetX,B.mouseY=F.offsetY,B.mouseIsPressed=!0,B._mouseClickedFn(F),B.mouseIsPressed=!1};let d=function(F){B.keyIsPressed=!0,B.key=F.key,B.keyCode=F.keyCode,h[B.keyCode]=!0,B._keyPressedFn(F),1==F.key.length&&B._keyTypedFn(F)};window.addEventListener("keydown",d);let x=function(F){B.keyIsPressed=!1,B.key=F.key,B.keyCode=F.keyCode,h[B.keyCode]=!1,B._keyReleasedFn(F)};function T(F){let A=B.canvas.getBoundingClientRect(),t=B.canvas.scrollWidth/B.width||1,i=B.canvas.scrollHeight/B.height||1;return{x:(F.clientX-A.left)/t,y:(F.clientY-A.top)/i,id:F.identifier}}function L(){return B._touchStartedFn.isPlaceHolder&&B._touchMovedFn.isPlaceHolder&&B._touchEndedFn.isPlaceHolder}window.addEventListener("keyup",x),B.keyIsDown=function(F){return!!h[F]},B.canvas.ontouchstart=function(F){B.touches=[...F.touches].map(T),L()&&(B.pmouseX=B.mouseX,B.pmouseY=B.mouseY,B.mouseX=B.touches[0].x,B.mouseY=B.touches[0].y,B.mouseIsPressed=!0,B.mouseButton=B.LEFT,B._mousePressedFn(F)||F.preventDefault()),B._touchStartedFn(F)||F.preventDefault()},B.canvas.ontouchmove=function(F){B.touches=[...F.touches].map(T),L()&&(B.pmouseX=B.mouseX,B.pmouseY=B.mouseY,B.mouseX=B.touches[0].x,B.mouseY=B.touches[0].y,B.mouseIsPressed=!0,B.mouseButton=B.LEFT,B._mouseDraggedFn(F)||F.preventDefault()),B._touchMovedFn(F)||F.preventDefault()},B.canvas.ontouchend=B.canvas.ontouchcancel=function(F){B.touches=[...F.touches].map(T),L()&&(B.pmouseX=B.mouseX,B.pmouseY=B.mouseY,B.mouseX=B.touches[0].x,B.mouseY=B.touches[0].y,B.mouseIsPressed=!1,B._mouseReleasedFn(F)||F.preventDefault()),B._touchEndedFn(F)||F.preventDefault()},B.hasSensorPermission=!window.DeviceOrientationEvent&&!window.DeviceMotionEvent||!(DeviceOrientationEvent.requestPermission||DeviceMotionEvent.requestPermission),B.requestSensorPermissions=function(){DeviceOrientationEvent.requestPermission&&DeviceOrientationEvent.requestPermission().then(F=>{"granted"==F&&DeviceMotionEvent.requestPermission&&DeviceMotionEvent.requestPermission().then(F=>{"granted"==F&&(B.hasSensorPermission=!0)}).catch(alert)}).catch(alert)},B.remove=function(){B.canvas.onmousemove=null,B.canvas.onmousedown=null,B.canvas.onmouseup=null,B.canvas.onclick=null,window.removeEventListener("keydown",d),window.removeEventListener("keyup",x),B.canvas.ontouchstart=null,B.canvas.ontouchmove=null,B.canvas.ontouchend=null,B.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){B.pRotationX=B.rotationX,B.pRotationY=B.rotationY,B.pRotationZ=B.rotationZ,B.pRelRotationX=B.relRotationX,B.pRelRotationY=B.relRotationY,B.pRelRotationZ=B.relRotationZ,B.rotationX=F.beta*(Math.PI/180),B.rotationY=F.gamma*(Math.PI/180),B.rotationZ=F.alpha*(Math.PI/180),B.relRotationX=[-B.rotationY,-B.rotationX,B.rotationY][~~(window.orientation/90)+1],B.relRotationY=[-B.rotationX,B.rotationY,B.rotationX][~~(window.orientation/90)+1],B.relRotationZ=B.rotationZ},window.ondevicemotion=function(F){if(B.pAccelerationX=B.accelerationX,B.pAccelerationY=B.accelerationY,B.pAccelerationZ=B.accelerationZ,!F.acceleration){let A=O(W(j(B.rotationY),N(B.rotationX)),[0,0,-9.80665]);B.accelerationX=F.accelerationIncludingGravity.x+A[0],B.accelerationY=F.accelerationIncludingGravity.y+A[1],B.accelerationZ=F.accelerationIncludingGravity.z-A[2]}},B.year=function(){return new Date().getFullYear()},B.day=function(){return new Date().getDay()},B.hour=function(){return new Date().getHours()},B.minute=function(){return new Date().getMinutes()},B.second=function(){return new Date().getSeconds()},B.millis=function(){return window.performance.now()-a},B.avgRate=function(){return B.frameCount/(B.millis()/1e3)},B.currRate=function(){return(B.frameCount-n)/(B.millis()-r)*1e3}}(F)},wY=window.location.hash.slice(1),wD=wY.split("-")[0];try{let A=wY.split("-")[1],t=I7.from(A,"base64").toString("utf-8");F=JSON.parse(t)}catch(F){console.log("parsing hash failed",{hash:wY,error:F})}window.anybody,wm.setup=()=>{let A={level:0,opensea:!0,todaysRecords:F};wD&&""!==wD&&(A.day=parseInt(wD)),window.anybody=new I2(wm,A),wD||(console.log("no day!"),window.location.hash=window.anybody.day.toString())},wm.draw=()=>{window.anybody.draw()}}();