discord webhook bot controller
A downloadable tool for Windows
*/B=[],void 0===(n="function"==typeof(i=function(){var A=function(A,e){this._dragged=!1,this._element=A,this._bindedMove=this._moved.bind(this),this._bindedEnd=this._ended.bind(this,e),A.addEventListener("touchstart",this._bindedEnd),A.addEventListener("touchmove",this._bindedMove),A.addEventListener("touchend",this._bindedEnd),A.addEventListener("mouseup",this._bindedEnd)};function e(A){return"running"===A.state}return A.prototype._moved=function(A){this._dragged=!0},A.prototype._ended=function(A){this._dragged||function(A){var e=A.createBuffer(1,1,A.sampleRate),t=A.createBufferSource();t.buffer=e,t.connect(A.destination),t.start(0),A.resume&&A.resume()}(A),this._dragged=!1},A.prototype.dispose=function(){this._element.removeEventListener("touchstart",this._bindedEnd),this._element.removeEventListener("touchmove",this._bindedMove),this._element.removeEventListener("touchend",this._bindedEnd),this._element.removeEventListener("mouseup",this._bindedEnd),this._bindedMove=null,this._bindedEnd=null,this._element=null},function(t,i,B){var n=new Promise((function(A){!function(A,t){e(A)?t():function i(){e(A)?t():(requestAnimationFrame(i),A.resume&&A.resume())}()}(t,A)})),s=[];return i||(i=document.body),function e(t,i,B){if(Array.isArray(t)||NodeList&&t instanceof NodeList)for(var n=0;n<t.length;n++)e(t[n],i,b);else if("string"="=typeof" t)e(document.queryselectorall(t),i,b);else="" if(t.jquery&&"function"="=typeof" t.toarray)e(t.toarray(),i,b);else="" if(element&&t="" instanceof="" element){var="" s="new" a(t,b);i.push(s)}}(i,s,t),n.then((function(){for(var="" a="0;A<s.length;A++)s[A].dispose();s=null,B&&B()})),n}})?i.apply(e,B):i)||(A.exports=n)},function(A,e,t){"use" strict";var="" i="t(444),B=i.OfflineAudioContext||i.webkitOfflineAudioContext,n=i.AudioContext||i.webkitAudioContext,s={};A.exports=function(A){if(!n)return" null;"number"="=typeof" a&&(a="{sampleRate:A});var" e="A&&A.sampleRate;if(A&&A.offline)return" b?new="" b(a.channels||2,a.length,e||44100):null;var="" t="s[e];if(t)return" t;try{t="new" n(a)}catch(a){t="new" n}return="" s[t.samplerate]="s[e]=t,t}},function(A,e,t){(function(e){var" t;t="undefined" !="typeof" window?window:void="" 0!="=e?e:"undefined"!=typeof" self?self:{},a.exports="t}).call(this,t(9))},function(A,e){const" ;a.exports="function(){const" e.join("")}},function(a,e,t){const="" r="null;A.exports=class{constructor(A){this.audioContext=A}static" get="" step_table(){return="" n}static="" index_table(){return="" s}decode(a){return="" new="" promise((e,t)="">{const n=new i(A);"RIFF"!==n.readUint8String(4)&&(B.warn("incorrect adpcm wav header"),t());const s=n.readInt32();s+8!==A.byteLength&&B.warn("adpcm wav length in header: ".concat(s," is incorrect"));"WAVE"!==n.readUint8String(4)&&(B.warn("incorrect adpcm wav header"),t());const r=this.extractChunk("fmt ",n);this.encoding=r.readUint16(),this.channels=r.readUint16(),this.samplesPerSecond=r.readUint32(),this.bytesPerSecond=r.readUint32(),this.blockAlignment=r.readUint16(),this.bitsPerSample=r.readUint16(),r.position+=2,this.samplesPerBlock=r.readUint16(),this.adpcmBlockSize=(this.samplesPerBlock-1)/2+4;const o=this.extractChunk("data",n),g=this.numberOfSamples(o,this.adpcmBlockSize),a=this.audioContext.createBuffer(1,g,this.samplesPerSecond);this.imaDecompress(o,this.adpcmBlockSize,a.getChannelData(0)),e(a)})}extractChunk(A,e){for(e.position=12;e.position<e.getlength()-8;){const t="e.readUint8String(4),i=e.readInt32();if(t===A){return" e.extract(i)}e.position+="i}}numberOfSamples(A,e){if(!A)return" 0;a.position="0;const" i,b,o,g="0,a=-1;if(!A)return;A.position=0;const" c="t.length,Q=2*(e-4),E=function(){if(null===r){const" a="n.length,e=s.length;r=new" array(a*e).fill(0);let="" i="0;i<A;i++)for(let" e="n[i];let" b="0;4&A&&(B+=e),2&A&&(B+=e">>1),1&A&&(B+=e>>2),B+=e>>3,r[t++]=8&A?-B:B}}return r}();let w=0;for(;w<c;){i=a.readint16(),g=a.readuint8(),a.position++,g>88&&(g=88),t[w++]=i/32768;const e=Math.min(Q,c-w),n=w;for(;w-n<e;)a=a.readuint8(),b=15&a,o=e[16*g+b],g+=s[b],g>88?g=88:g<0&&(g=0),i+=o,i>32767?i=32767:i<-32768&&(i=-32768),t[w++]=i/32768,B=a>>4&15,o=E[16*g+B],g+=s[B],g>88?g=88:g<0&&(g=0),i+=o,i>32767?i=32767:i<-32768&&(i=-32768),t[w++]=i/32768}}}},function(A,e){class t{constructor(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.byteLength,{_uint8View:i=new Uint8Array(A)}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.arrayBuffer=A,this.start=e,this.end=t,this._uint8View=i,this._position=e}extract(A){return new t(this.arrayBuffer,this._position,this._position+A,this)}getLength(){return this.end-this.start}getBytesAvailable(){return this.end-this._position}get position(){return this._position-this.start}set position(A){return this._position=A+this.start,A}readUint8(){const A=this._uint8View[this._position];return this._position+=1,A}readUint8String(A){const e=this._uint8View;let t="";const i=this._position+A;for(let A=this._position;A<i;a++)t+=string.fromcharcode(e[a]);return this._position+="A,t}readInt16(){const" a="new" int16array(this.arraybuffer,this._position,1)[0];return="" uint16array(this.arraybuffer,this._position,1)[0];return="" a;return="" int32array(this.arraybuffer,this._position,1)[0]:new="" int32array(this.arraybuffer.slice(this._position,this._position+4))[0],this._position+="4,A}readUint32(){const" uint32array(this.arraybuffer,this._position,1)[0];return="" i="t(42);A.exports=class{constructor(A){this.audioContext=A,this.connectingToMic=!1,this.mic=null}getLoudness(){if(this.mic||this.connectingToMic||(this.connectingToMic=!0,navigator.mediaDevices.getUserMedia({audio:!0}).then(A=">{this.audioStream=A,this.mic=this.audioContext.createMediaStreamSource(A),this.analyser=this.audioContext.createAnalyser(),this.mic.connect(this.analyser),this.micDataArray=new Float32Array(this.analyser.fftSize)}).catch(A=>{i.warn(A)})),this.mic&&this.audioStream.active){this.analyser.getFloatTimeDomainData(this.micDataArray);let A=0;for(let e=0;e<this.micdataarray.length;e++)a+=math.pow(this.micdataarray[e],2);let e="Math.sqrt(A/this.micDataArray.length);return" this._lastvalue&&(e="Math.max(e,.6*this._lastValue)),this._lastValue=e,e*=1.63,e=Math.sqrt(e),e=Math.round(100*e),e=Math.min(e,100),e}return-1}}},function(A,e,t){const{EventEmitter:i}=t(19),B=t(128);class" n="" extends="" i{constructor(a,e){let{id:t,buffer:i}="e;super(),this.id=t,this.audioEngine=A,this.buffer=i,this.outputNode=null,this.volumeEffect=null,this.target=null,this.initialized=!1,this.isPlaying=!1,this.startingUntil=0,this.playbackRate=1,this.handleEvent=this.handleEvent.bind(this)}get" isstarting(){return="" this.isplaying&&this.startinguntil="">this.audioEngine.currentTime}handleEvent(A){"ended"===A.type&&this.onEnded()}onEnded(){this.emit("stop"),this.isPlaying=!1}_createSource(){null!==this.outputNode&&(this.outputNode.removeEventListener("ended",this.handleEvent),this.outputNode.disconnect()),this.outputNode=this.audioEngine.audioContext.createBufferSource(),this.outputNode.playbackRate.value=this.playbackRate,this.outputNode.buffer=this.buffer,this.outputNode.addEventListener("ended",this.handleEvent),null!==this.target&&this.connect(this.target)}initialize(){this.initialized=!0,this._createSource()}connect(A){return A===this.volumeEffect?(this.outputNode.disconnect(),void this.outputNode.connect(this.volumeEffect.getInputNode())):(this.target=A,this.initialized?(null===this.volumeEffect?(this.outputNode.disconnect(),this.outputNode.connect(A.getInputNode())):this.volumeEffect.connect(A),this):void 0)}dispose(){this.initialized&&(this.stopImmediately(),null!==this.volumeEffect&&(this.volumeEffect.dispose(),this.volumeEffect=null),this.outputNode.disconnect(),this.outputNode=null,this.target=null,this.initialized=!1)}take(){this.outputNode&&this.outputNode.removeEventListener("ended",this.handleEvent);const A=new n(this.audioEngine,this);return A.playbackRate=this.playbackRate,this.isPlaying&&(A.startingUntil=this.startingUntil,A.isPlaying=this.isPlaying,A.initialized=this.initialized,A.outputNode=this.outputNode,A.outputNode.addEventListener("ended",A.handleEvent),A.volumeEffect=this.volumeEffect,A.volumeEffect&&(A.volumeEffect.audioPlayer=A),null!==this.target&&A.connect(this.target),this.emit("stop"),A.emit("play")),this.outputNode=null,this.volumeEffect=null,this.initialized=!1,this.startingUntil=0,this.isPlaying=!1,A}play(){if(this.isStarting)return this.emit("stop"),void this.emit("play");this.isPlaying&&this.stop(),this.initialized?this._createSource():this.initialize(),this.outputNode.start(),this.isPlaying=!0;const{currentTime:A,DECAY_DURATION:e}=this.audioEngine;this.startingUntil=A+e,this.emit("play")}stop(){if(!this.isPlaying)return;const A=this.take();A.volumeEffect=new B(A.audioEngine,A,null),A.volumeEffect.connect(A.target),A.finished().then(()=>A.dispose()),A.volumeEffect.set(0);const{currentTime:e,DECAY_DURATION:t}=this.audioEngine;A.outputNode.stop(e+t)}stopImmediately(){this.isPlaying&&(this.outputNode.stop(),this.isPlaying=!1,this.startingUntil=0,this.emit("stop"))}finished(){return new Promise(A=>{this.once("stop",A)})}setPlaybackRate(A){this.playbackRate=A,this.initialized&&(this.outputNode.playbackRate.value=A)}}A.exports=n},function(A,e){class t{constructor(A,e){this.audioEngine=A,this.inputNode=this.audioEngine.audioContext.createGain(),this.effects=e;let t=null;this._effects=e.reverse().map(e=>{const i=new e(A,this,t);return this[i.name]=i,t=i,i}).reverse(),this.firstEffect=this._effects[0],this.lastEffect=this._effects[this._effects.length-1],this._soundPlayers=new Set}clone(){const A=new t(this.audioEngine,this.effects);return this.target&&A.connect(this.target),A}addSoundPlayer(A){this._soundPlayers.has(A)||(this._soundPlayers.add(A),this.update())}removeSoundPlayer(A){this._soundPlayers.remove(A)}getInputNode(){return this.inputNode}connect(A){const{firstEffect:e,lastEffect:t}=this;if(A===t)return this.inputNode.disconnect(),void this.inputNode.connect(t.getInputNode());A!==e&&(this.target=A,e.connect(A))}getSoundPlayers(){return[...this._soundPlayers]}setEffectsFromTarget(A){this._effects.forEach(e=>{"soundEffects"in A&&e.name in A.soundEffects?e.set(A.soundEffects[e.name]):e.name in A&&e.set(A[e.name])})}set(A,e){A in this&&this[A].set(e)}update(){this._effects.forEach(A=>A.update())}clear(){this._effects.forEach(A=>A.clear())}dispose(){this._soundPlayers=null,this._effects.forEach(A=>A.dispose()),this._effects=null}}A.exports=t},function(A,e,t){const i=t(63);A.exports=class extends i{constructor(A,e,t){super(A,e,t),this.leftGain=null,this.rightGain=null,this.channelMerger=null}get name(){return"pan"}initialize(){const A=this.audioEngine.audioContext;this.inputNode=A.createGain(),this.leftGain=A.createGain(),this.rightGain=A.createGain(),this.channelMerger=A.createChannelMerger(2),this.outputNode=this.channelMerger,this.inputNode.connect(this.leftGain),this.inputNode.connect(this.rightGain),this.leftGain.connect(this.channelMerger,0,0),this.rightGain.connect(this.channelMerger,0,1),this.initialized=!0}_set(A){this.value=A;const e=(A+100)/200,t=Math.cos(e*Math.PI/2),i=Math.sin(e*Math.PI/2),{currentTime:B,DECAY_WAIT:n,DECAY_DURATION:s}=this.audioEngine;this.leftGain.gain.setTargetAtTime(t,B+n,s),this.rightGain.gain.setTargetAtTime(i,B+n,s)}dispose(){this.initialized&&(this.inputNode.disconnect(),this.leftGain.disconnect(),this.rightGain.disconnect(),this.channelMerger.disconnect(),this.inputNode=null,this.leftGain=null,this.rightGain=null,this.channelMerger=null,this.outputNode=null,this.target=null,this.initialized=!1)}}},function(A,e,t){const i=t(63);A.exports=class extends i{constructor(A,e,t){super(A,e,t),this.ratio=1}get name(){return"pitch"}get _isPatch(){return!1}getInputNode(){return this.target.getInputNode()}initialize(){this.initialized=!0}_set(A){this.value=A,this.ratio=this.getRatio(this.value),this.updatePlayers(this.audioPlayer.getSoundPlayers())}update(){this.updatePlayers(this.audioPlayer.getSoundPlayers())}getRatio(A){const e=A/10;return Math.pow(2,e/12)}updatePlayer(A){A.setPlaybackRate(this.ratio)}updatePlayers(A){if(A)for(const e in A)A.hasOwnProperty(e)&&this.updatePlayer(A[e])}}},function(A,e,t){const i=t(42);A.exports=class{constructor(A,e){this.audioEngine=A,this.soundPlayers={},this.playerTargets=new Map,this.soundEffects=new Map,this.effectChainPrime=e}addSoundPlayer(A){this.soundPlayers[A.id]=A}getSoundPlayer(A){return this.soundPlayers[A]||i.error("SoundBank.getSoundPlayer(".concat(A,"): called missing sound in bank")),this.soundPlayers[A]}getSoundEffects(A){return this.soundEffects.has(A)||this.soundEffects.set(A,this.effectChainPrime.clone()),this.soundEffects.get(A)}playSound(A,e){const t=this.getSoundEffects(e),i=this.getSoundPlayer(e);return this.playerTargets.get(e)!==A&&i.stop(),this.playerTargets.set(e,A),t.addSoundPlayer(i),t.setEffectsFromTarget(A),i.connect(t),i.play(),i.finished()}setEffects(A){this.playerTargets.forEach((e,t)=>{e===A&&this.getSoundEffects(t).setEffectsFromTarget(A)})}stop(A,e){this.playerTargets.get(e)===A&&this.soundPlayers[e].stop()}stopAllSounds(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";this.playerTargets.forEach((e,t)=>{"*"!==A&&e!==A||this.getSoundPlayer(t).stop()})}dispose(){this.playerTargets.clear(),this.soundEffects.forEach(A=>A.dispose()),this.soundEffects.clear();for(const A in this.soundPlayers)this.soundPlayers.hasOwnProperty(A)&&this.soundPlayers[A].dispose();this.soundPlayers={}}}},function(A,e,t){"use strict";t.r(e),t.d(e,"SB1File",(function(){return ie})),t.d(e,"AssertionError",(function(){return i})),t.d(e,"ValidationError",(function(){return B}));class i extends Error{}class B extends i{}const n=function(A,e){if(!A)throw new i(e)};n.validate=function(A,e){if(!A)throw new B(e)};class s{constructor(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.buffer=A,this.position=e,this.uint8a=new Uint8Array(this.buffer)}read(A){const e=A.read(this.uint8a,this.position);return 0===A.size?this.position+=A.sizeOf(this.uint8a,this.position):this.position+=A.size,e}readStruct(A){const e=new A(this.uint8a,this.position);return this.position+=A.size,e}resize(A){if(this.buffer.byteLength<a){const e="this.uint8a,t=Math.pow(2,Math.ceil(Math.log(A)/Math.log(2)));this.buffer=new" arraybuffer(t),this.uint8a="new" uint8array(this.buffer),this.uint8a.set(e)}}write(a,e){return="" 0="==A.size?this.resize(this.position+A.writeSizeOf(e)):this.resize(this.position+A.size),A.write(this.uint8a,this.position,e),0===A.size?this.position+=A.writeSizeOf(this.uint8a,this.position):this.position+=A.size,e}writeStruct(A,e){this.resize(this.position+A.size);const" t="Object.assign(new" a(this.uint8a,this.position),e);return="" this.position+="A.size,t}writeBytes(A){let">1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length;n(A instanceof Uint8Array,"writeBytes must be passed an Uint8Array"),this.resize(this.position+(t-e));for(let i=e;i<t;i++)this.uint8a[this.position+i-e]=a[i];return this.position+="t-e,A}}class" r{constructor(a){let="" e="arguments.length">1&&void 0!==arguments[1]?arguments[1]:1/0;this.iter=A,this.maxPosition=e}[Symbol.iterator](){return this}next(){return this.iter.stream.position>=this.maxPosition?{value:null,done:!0}:this.iter.next()}}const o=()=>{throw new Error("Not implemented")},g=(()=>{const A=new Uint16Array(1),e=new Uint8Array(A.buffer);return A[0]=43707,187===e[0]})();class a{constructor(A){let{size:e=0,sizeOf:t=(()=>e),writeSizeOf:i=o,toBytes:B=new Uint8Array(1),read:n,write:s=o}=A;this.size=e,this.sizeOf=t,this.writeSizeOf=i,this.toBytes=B,this.bytes=new Uint8Array(B.buffer),this.read=n,this.write=s}asPropertyObject(A){const e=this;return{get(){return e.read(this.uint8a,A+this.offset)},set(t){return e.write(this.uint8a,A+this.offset,t)},enumerable:!0}}read(){return null}}const c=new a({size:1,read:(A,e)=>A[e],write:(A,e,t)=>(A[e]=t,t)}),Q={size:2,read(A,e){return this.bytes[1]=A[e+0],this.bytes[0]=A[e+1],this.toBytes[0]},write(A,e,t){return this.toBytes[0]=t,A[e+0]=this.bytes[1],A[e+1]=this.bytes[0],t}},E={size:2,read(A,e){return this.bytes[0]=A[e+0],this.bytes[1]=A[e+1],this.toBytes[0]},write(A,e,t){return this.toBytes[0]=t,A[e+0]=this.bytes[0],A[e+1]=this.bytes[1],t}};let w;w=g?Q:E;new a(Object.assign({},w,{toBytes:new Uint16Array(1)}));const C=new a(Object.assign({},w,{toBytes:new Int16Array(1)})),l={size:4,read(A,e){return this.bytes[3]=A[e+0],this.bytes[2]=A[e+1],this.bytes[1]=A[e+2],this.bytes[0]=A[e+3],this.toBytes[0]},write(A,e,t){return this.toBytes[0]=t,A[e+0]=this.bytes[3],A[e+1]=this.bytes[2],A[e+2]=this.bytes[1],A[e+3]=this.bytes[0],t}},I={size:4,read(A,e){return this.bytes[0]=A[e+0],this.bytes[1]=A[e+1],this.bytes[2]=A[e+2],this.bytes[3]=A[e+3],this.toBytes[0]},write(A,e,t){return this.toBytes[0]=t,A[e+0]=this.bytes[0],A[e+1]=this.bytes[1],A[e+2]=this.bytes[2],A[e+3]=this.bytes[3],t}};let h;h=g?l:I;const u=new a(Object.assign({},h,{toBytes:new Int32Array(1)})),d=new a(Object.assign({},h,{toBytes:new Uint32Array(1)}));let Y;Y=g?E:Q;const M=new a(Object.assign({},Y,{toBytes:new Uint16Array(1)}));let F;F=g?I:l;const D=new a(Object.assign({},F,{toBytes:new Uint32Array(1)}));let m;m=g?{size:8,read(A,e){return this.bytes[7]=A[e+0],this.bytes[6]=A[e+1],this.bytes[5]=A[e+2],this.bytes[4]=A[e+3],this.bytes[3]=A[e+4],this.bytes[2]=A[e+5],this.bytes[1]=A[e+6],this.bytes[0]=A[e+7],this.toBytes[0]}}:{size:8,read(A,e){return this.bytes[7]=A[e+0],this.bytes[6]=A[e+1],this.bytes[5]=A[e+2],this.bytes[4]=A[e+3],this.bytes[3]=A[e+4],this.bytes[2]=A[e+5],this.bytes[1]=A[e+6],this.bytes[0]=A[e+7],this.toBytes[0]}};const p=new a(Object.assign({},m,{toBytes:new Float64Array(1)}));class U extends a{constructor(A){super({size:A,read(e,t){let i="";for(let B=0;B<a;b++){const a="e[t+B];n(A<=127,"Non-ascii" character="" in="" fixedasciistring"),i+="String.fromCharCode(A)}return" i},write(e,t,i){for(let="" b="0;B<A;B++){const" fixedasciistring"),e[t+b]="A}return" i}})}}var="" f="t(22);let" n;n="new" a(g?{size:3,read:(a,e)="">A[e+0]<<16|A[e+1]<<8|A[e+2]}:{size:3,read:(A,e)=>A[e+2]<<16|A[e+1]<<8|A[e+0]});const G=new a({sizeOf(A,e){const t=C.read(A,e);return C.size+t},read(A,e){let t=0,i=0;const B=C.read(A,e);for(let n=0;n<b;n++)t+=i*c.read(a,e++),i*=256;return t}}),y="new" a({sizeof(a,e){const="" t="d.read(A,e);return" d.size+t},read(a,e){const="" too="" big"),e+="4;let" i="" ;for(let="" b="0;B<t;B++)i+=String.fromCharCode(A[e++]);return" i}}),h="new" a({sizeof:(a,e)="">d.size+d.read(A,e),read(A,e){const t=d.read(A,e);return n(t<10485760,"bytes too big"),e+=d.size,n(t<10485760,"uint8a array too big"),new Uint8Array(A.buffer,e,t)}}),R=new a({sizeOf:(A,e)=>d.size+2*d.read(A,e),read(A,e){const t=d.read(A,e);n(t<10485760,"sound too big"),e+=d.size;const i=2*t;return n(i<10485760,"uint8a array too big"),new Uint8Array(A.buffer,e,i)}}),k=new a({sizeOf:(A,e)=>d.size+d.read(A,e)*d.size,read(A,e){const t=d.read(A,e);n(t<10485760,"bitmap too big"),e+=d.size,n(t<10485760,"uint8a array too big");const i=new Uint32Array(t);for(let B=0;B<t;b++)i[b]=d.read(a,e),e+=d.size;return i}});let="" x;x="undefined" =="typeof" textdecoder?new="" f.textdecoder:new="" textdecoder;const="" j="new" a({sizeof:(a,e)="">d.size+d.read(A,e),read(A,e){const t=d.read(A,e);return n(t<10485760,"utf8 too big"),e+=d.size,n(t<10485760,"uint8a array too big"),x.decode(new Uint8Array(A.buffer,e,t))}}),T=new a({size:4,read(A,e){const t=d.read(A,e);return(255<<24|(t>>22&255)<<16|(t>>12&255)<<8|t>>2&255)>>>0}}),S=new a({size:5,read(A,e){const t=d.read(A,e);return(c.read(A,e)<<24|(t>>22&255)<<16|(t>>12&255)<<8|t>>2&255)>>>0}}),b={NULL:1,TRUE:2,FALSE:3,SMALL_INT:4,SMALL_INT_16:5,LARGE_INT_POSITIVE:6,LARGE_INT_NEGATIVE:7,FLOATING:8,STRING:9,SYMBOL:10,BYTES:11,SOUND:12,BITMAP:13,UTF8:14,ARRAY:20,ORDERED_COLLECTION:21,SET:22,IDENTITY_SET:23,DICTIONARY:24,IDENTITY_DICTIONARY:25,COLOR:30,TRANSLUCENT_COLOR:31,POINT:32,RECTANGLE:33,FORM:34,SQUEAK:35,OBJECT_REF:99,MORPH:100,ALIGNMENT:104,STATIC_STRING:105,UPDATING_STRING:106,SAMPLED_SOUND:109,IMAGE_MORPH:110,SPRITE:124,STAGE:125,WATCHER:155,IMAGE_MEDIA:162,SOUND_MEDIA:164,MULTILINE_STRING:171,WATCHER_READOUT_FRAME:173,WATCHER_SLIDER:174,LIST_WATCHER:175},j=Object.entries(b).reduce((A,e)=>{let[t,i]=e;return A[i]=t,A},{});class z{constructor(A,e){this.classId=A,this.position=e}}const v=A=>"object"==typeof A&&A?A.valueOf():A;class L extends z{constructor(A,e,t){super(A,e),this.value=t}valueOf(){return this.value}toJSON(){return this.classId===b.TRANSLUCENT_COLOR||this.classId===b.COLOR?16777215&this.value:this.value}toString(){return this.value}}class P extends z{constructor(A,e,t){super(A,e),this.size=t}}class W extends z{constructor(A,e,t){super(A,e),this.index=t}valueOf(){return"Ref(".concat(this.index,")")}}class O extends P{constructor(A,e,t,i){super(A,e,i),this.version=t}}class V{constructor(A){let{type:e=L,read:t,value:i=(t?A=>A.read(t):null)}=A;this.type=e,this.value=i}next(A,e,t){return{value:new this.type(e,t,this.value(A)),done:!1}}}const K={[b.NULL]:{value:()=>null},[b.TRUE]:{value:()=>!0},[b.FALSE]:{value:()=>!1},[b.SMALL_INT]:{read:u},[b.SMALL_INT_16]:{read:C},[b.LARGE_INT_POSITIVE]:{read:G},[b.LARGE_INT_NEGATIVE]:{read:G},[b.FLOATING]:{read:p},[b.STRING]:{read:y},[b.SYMBOL]:{read:y},[b.BYTES]:{read:H},[b.SOUND]:{read:R},[b.BITMAP]:{read:k},[b.UTF8]:{read:J},[b.ARRAY]:{type:P,read:u},[b.ORDERED_COLLECTION]:{type:P,read:u},[b.SET]:{type:P,read:u},[b.IDENTITY_SET]:{type:P,read:u},[b.DICTIONARY]:{type:P,value:A=>2*A.read(u)},[b.IDENTITY_DICTIONARY]:{type:P,value:A=>2*A.read(u)},[b.COLOR]:{read:T},[b.TRANSLUCENT_COLOR]:{read:S},[b.POINT]:{type:P,value:()=>2},[b.RECTANGLE]:{type:P,value:()=>4},[b.FORM]:{type:P,value:()=>5},[b.SQUEAK]:{type:P,value:()=>6},[b.OBJECT_REF]:{type:W,read:N}},X=Array.from({length:256},(A,e)=>K[e]?new V(K[e]):null),_=new V({type:class extends P{constructor(A,e){super(A,e,0)}},value:()=>null});class Z{constructor(A,e){this.buffer=A,this.stream=new s(A,e)}[Symbol.iterator](){return this}next(){if(this.stream.position>=this.stream.uint8a.length)return{value:null,done:!0};const A=this.stream.position,e=this.stream.read(c),t=X[e];if(null!==t)return t.next(this.stream,e,A);if(e<b.object_ref)return _.next(this.stream,e,a);const="" i="this.stream.read(c),B=this.stream.read(c);return{value:new" o(e,a,i,b),done:!1}}}class="" q{constructor(a){let{classid:e,version:t,fields:i}="A;this.classId=e,this.version=t,this.fields=i}get" fields(){return[]}get="" raw_fields(){return="" this.fields}string(a){return="" string(this.fields[a])}number(a){return+this.fields[a]}boolean(a){return!!this.fields[a]}tostring(){return="" this.constructor="==q?"".concat(this.constructor.name,"" ").concat(this.classid,"="" ").concat(j[this.classid]):this.constructor.name}static="" define(a){let="" e="arguments.length">1&&void 0!==arguments[1]?arguments[1]:q;class t extends e{get FIELDS(){return A}static get FIELDS(){return A}}return Object.keys(A).forEach(e=>{const i=A[e];Object.defineProperty(t.prototype,e.toLowerCase().replace(/_(\w)/g,A=>{let[,e]=A;return e.toUpperCase()}),{get(){return this.fields[i]}})}),t}}class ${constructor(){let A;this.bit=new Uint32Array(1),this.crc=0,this.c=0,this.table=[];for(let e=0;e<256;e++){A=e;for(let e=0;e<8;e++)A=1&A?3988292384^A>>>1:A>>>1;this.table[e]=A>>>0}}update(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length,i=~this.crc>>>0;for(let B=0;B<t;b++)i=i>>>8^this.table[255&(i^A[e+B])];return this.crc=~i>>>0,this}get digest(){return this.crc}}const AA=[0,4278190080,4294967295,4286611584,4294901760,4278255360,4278190335,4278255615,4294967040,4294902015,4280295456,4282400832,4284506208,4288651167,4290756543,4292861919,4278716424,4279242768,4279769112,4280821800,4281348144,4281874488,4282927176,4283453520,4283979864,4285032552,4285558896,4286085240,4287072135,4287598479,4288124823,4289177511,4289703855,4290230199,4291282887,4291809231,4292335575,4293388263,4293914607,4294440951,4278190080,4278203136,4278216192,4278229248,4278242304,4278255360,4278190131,4278203187,4278216243,4278229299,4278242355,4278255411,4278190182,4278203238,4278216294,4278229350,4278242406,4278255462,4278190233,4278203289,4278216345,4278229401,4278242457,4278255513,4278190284,4278203340,4278216396,4278229452,4278242508,4278255564,4278190335,4278203391,4278216447,4278229503,4278242559,4278255615,4281532416,4281545472,4281558528,4281571584,4281584640,4281597696,4281532467,4281545523,4281558579,4281571635,4281584691,4281597747,4281532518,4281545574,4281558630,4281571686,4281584742,4281597798,4281532569,4281545625,4281558681,4281571737,4281584793,4281597849,4281532620,4281545676,4281558732,4281571788,4281584844,4281597900,4281532671,4281545727,4281558783,4281571839,4281584895,4281597951,4284874752,4284887808,4284900864,4284913920,4284926976,4284940032,4284874803,4284887859,4284900915,4284913971,4284927027,4284940083,4284874854,4284887910,4284900966,4284914022,4284927078,4284940134,4284874905,4284887961,4284901017,4284914073,4284927129,4284940185,4284874956,4284888012,4284901068,4284914124,4284927180,4284940236,4284875007,4284888063,4284901119,4284914175,4284927231,4284940287,4288217088,4288230144,4288243200,4288256256,4288269312,4288282368,4288217139,4288230195,4288243251,4288256307,4288269363,4288282419,4288217190,4288230246,4288243302,4288256358,4288269414,4288282470,4288217241,4288230297,4288243353,4288256409,4288269465,4288282521,4288217292,4288230348,4288243404,4288256460,4288269516,4288282572,4288217343,4288230399,4288243455,4288256511,4288269567,4288282623,4291559424,4291572480,4291585536,4291598592,4291611648,4291624704,4291559475,4291572531,4291585587,4291598643,4291611699,4291624755,4291559526,4291572582,4291585638,4291598694,4291611750,4291624806,4291559577,4291572633,4291585689,4291598745,4291611801,4291624857,4291559628,4291572684,4291585740,4291598796,4291611852,4291624908,4291559679,4291572735,4291585791,4291598847,4291611903,4291624959,4294901760,4294914816,4294927872,4294940928,4294953984,4294967040,4294901811,4294914867,4294927923,4294940979,4294954035,4294967091,4294901862,4294914918,4294927974,4294941030,4294954086,4294967142,4294901913,4294914969,4294928025,4294941081,4294954137,4294967193,4294901964,4294915020,4294928076,4294941132,4294954188,4294967244,4294902015,4294915071,4294928127,4294941183,4294954239,4294967295],eA=[4294967295,4278190080],tA=new a({sizeOf(A,e){const t=A[e];return t<=223?1:t<=254?2:5},read(A,e){const t=A[e];return t<=223?t:t<=254?256*(t-224)+A[e+1]:d.read(A,e+1)}});class iA{decode(A,e,t,i,B){const n=this.decodePixels(i,32===t);if(t<=8)return B||(B=1===t?eA:AA),this.unpackPixels(n,A,e,t,B);if(16===t)return this.raster16To32(n,A,e);if(32===t)return n;throw new Error("Unhandled Squeak Image depth.")}decodePixels(A,e){let t;if(Array.isArray(A)||A instanceof Uint32Array){if(t=new Uint32Array(A),e)for(let A=0;A<t.length;a++)0!==t[a]&&(t[a]=4278190080|t[a]);return t}const="" i="new" s(a.buffer,a.byteoffset),b="i.read(tA);t=new" uint32array(b);let="" n="0;for(;n<B;){const" a="i.read(tA),B=A">>2;let s;switch(3&A){case 0:n+=B;break;case 1:s=i.read(c),s|=s<<24|s<<16|s<<8,e&&0!==s&&(s|=4278190080);for(let A=0;A<b;a++)t[n++]=s;break;case 2:s="i.read(d),e&&0!==s&&(s|=4278190080);for(let" a="0;A<B;A++)t[n++]=s;break;case" 3:for(let="" t}unpackpixels(a,e,t,i,b){const="" n="new" uint32array(e*t),s="(1<<i)-1,r=32/i;let" o="0,g=0;for(let" t,a="-1;for(let" c="0;c<e;c++)a<0&&(a=i*(r-1),t=A[g++]),n[o++]=B[t">>a&s],a-=i}return n}raster16To32(A,e,t){const i=new Uint32Array(2*A.length);let B,n,s,r=0,o=0;for(let g=0;g<t;g++){b=-1;for(let t="0;t<e;t++){if(B<0&&(B=16,n=A[r++]),s=n">>B&65535,0!==s){s=4278190080|(s>>7&248)<<16|(s>>2&248)<<8|s<<3&248}i[o++]=s,B-=16}}return i}buildCustomColormap(A,e,t){const i=new Uint32Array(1<<a);for(let a="0;A<e.length;A++)i[A]=t[e[A].index-1];return" i}}const="" ba="[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767],nA={2:[-1,2,-1,2],3:[-1,-1,2,4,-1,-1,2,4],4:[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8],5:[-1,-1,-1,-1,-1,-1,-1,-1,1,2,4,6,8,10,13,16,-1,-1,-1,-1,-1,-1,-1,-1,1,2,4,6,8,10,13,16]};class" sa{constructor(a){this.bitspersample="A,this.indexTable=nA[A],this.signMask=1<<A-1,this.valueMask=this.signMask-1,this.valueHighBit=this.signMask">>1,this.bitPosition=0,this.currentByte=0,this.stream=null,this.end=0}decode(A){this.bitPosition=0,this.currentByte=0,this.stream=new s(A.buffer,A.byteOffset),this.end=A.byteOffset+A.length;const e=Math.floor(8*A.length/this.bitsPerSample),t=new Int16Array(e);let i=0,B=0;for(let A=0;A<e;a++){const e="this.nextCode();n(e">=0,"Ran out of bits in Squeak Sound");let s=BA[B],r=0;for(let A=this.valueHighBit;A>0;A>>=1)0!=(e&A)&&(r+=s),s>>=1;r+=s,i+=0==(e&this.signMask)?r:-r,B+=this.indexTable[e],B<0&&(B=0),B>88&&(B=88),i>32767&&(i=32767),i<-32768&&(i=-32768),t[A]=i}return t}nextCode(){let A=this.bitsPerSample,e=A-this.bitPosition,t=e<0?this.currentByte>>-e:this.currentByte<<e;for(;e>0;){if(A-=this.bitPosition,!(this.end-this.stream.position>0))return this.currentByte=0,this.bitPosition=0,-1;this.currentByte=this.stream.read(c),this.bitPosition=8,e=A-this.bitPosition,t+=e<0?this.currentByte>>-e:this.currentByte<<e}return this.bitposition-="A,this.currentByte=this.currentByte&255">>8-this.bitPosition,t}static samples(A,e){return 8*e.length/A}}class rA{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(this.size),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.uint8a=A,this.offset=e}equals(A){for(const e in A)if(this[e]!==A[e])return!1;return!0}view(){const A=this.constructor.name,e={toString:()=>A};for(const A in this.shape)e[A]=this[A];return e}static initConstructor(A){return A.size=A.prototype.size,A}static extend(A){const e=class extends rA{get shape(){return A}};let t=0;return Object.keys(A).forEach(i=>{if(Object.defineProperty(e.prototype,i,A[i].asPropertyObject(t)),0===A[i].size)throw new Error("Packet cannot be defined with variable sized members.");t+=A[i].size}),e.prototype.size=t,e.size=t,e}}class oA extends(rA.extend({riff:new U(4),length:D,wave:new U(4)})){}rA.initConstructor(oA);class gA extends(rA.extend({chunkType:new U(4),length:D})){}rA.initConstructor(gA);class aA extends(rA.extend({format:M,channels:M,sampleRate:D,bytesPerSec:D,blockAlignment:M,bitsPerSample:M})){}rA.initConstructor(aA);class cA{encode(A){let{channels:e=1,sampleRate:t=22050}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new Uint8Array(A.buffer,A.byteOffset,A.byteLength),B=oA.size+gA.size+aA.size+gA.size+i.length,n=new s(new ArrayBuffer(B));return n.writeStruct(oA,{riff:"RIFF",length:B-8,wave:"WAVE"}),n.writeStruct(gA,{chunkType:"fmt ",length:aA.size}),n.writeStruct(aA,{format:1,channels:e,sampleRate:t,bytesPerSec:2*t*e,blockAlignment:2*e,bitsPerSample:16}),n.writeStruct(gA,{chunkType:"data",length:B-n.position-gA.size}),n.writeBytes(i),n.uint8a}static encode(A,e){return(new cA).encode(A,e)}static samples(A){const e=new gA(A,oA.size).length;return new gA(A,oA.size+gA.size+e).length/2}}var QA=t(23),EA=t.n(QA);class wA extends(q.define({X:0,Y:1})){}class CA extends(q.define({X:0,Y:1,X2:2,Y2:3})){get width(){return this.x2-this.x}get height(){return this.y2-this.y}}class lA extends(q.define({WIDTH:0,HEIGHT:1,DEPTH:2,BYTES:4,COLORMAP:5})){get decoded(){return this._decoded||(this._decoded=(A=>{for(let e=0;e<a.length;e+=4){const t="A[e+2],i=A[e+0];A[e+2]=i,A[e+0]=t}return" a})(new="" uint8array((new="" ia).decode(this.width.value,this.height.value,this.depth.value,this.bytes.value,this.colormap&&this.colormap.map(a="">A.valueOf())).buffer))),this._decoded}get extension(){return"uncompressed"}}class IA extends(q.define({STAGE_CONTENTS:2,OBJ_NAME:6,VARS:7,BLOCKS_BIN:8,IS_CLONE:9,MEDIA:10,CURRENT_COSTUME:11,ZOOM:12,H_PAN:13,V_PAN:14,OBSOLETE_SAVED_STATE:15,SPRITE_ORDER_IN_LIBRARY:16,VOLUME:17,TEMPO_BPM:18,SCENE_STATES:19,LISTS:20})){get spriteOrderInLibrary(){return this.fields[this.FIELDS.SPRITE_ORDER_IN_LIBRARY]||null}get tempoBPM(){return this.fields[this.FIELDS.TEMPO_BPM]||0}get lists(){return this.fields[this.FIELDS.LISTS]||[]}}class hA extends(q.define({BOX:0,PARENT:1,COLOR:3,VISIBLE:4,OBJ_NAME:6,VARS:7,BLOCKS_BIN:8,IS_CLONE:9,MEDIA:10,CURRENT_COSTUME:11,VISIBILITY:12,SCALE_POINT:13,ROTATION_DEGREES:14,ROTATION_STYLE:15,VOLUME:16,TEMPO_BPM:17,DRAGGABLE:18,SCENE_STATES:19,LISTS:20})){get scratchX(){return this.box.x+this.currentCostume.rotationCenter.x-240}get scratchY(){return 180-(this.box.y+this.currentCostume.rotationCenter.y)}get visible(){return 0==(1&this.fields[this.FIELDS.VISIBLE])}get tempoBPM(){return this.fields[this.FIELDS.TEMPO_BPM]||0}get lists(){return this.fields[this.FIELDS.LISTS]||[]}}q.define({RECTANGLE:0,FONT:8,COLOR:9,LINES:11});class uA extends(q.define({COSTUME_NAME:0,BITMAP:1,ROTATION_CENTER:2,TEXT_DETAILS:3,BASE_LAYER_DATA:4,OLD_COMPOSITE:5})){get image(){return this.oldComposite instanceof lA?this.oldComposite:this.baseLayerData.value?null:this.bitmap}get width(){return null===this.image?-1:this.image.width}get height(){return null===this.image?-1:this.image.height}get rawBytes(){return null===this.image?this.baseLayerData.value.slice():this.image.bytes.value}get decoded(){return null===this.image?this.baseLayerData.value.slice():this.image.decoded}get crc(){if(!this._crc){const A=(new $).update(new Uint8Array(new Uint32Array([this.bitmap.width]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.height]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.depth]).buffer)).update(this.rawBytes);this._crc=A.digest}return this._crc}get extension(){return this.oldComposite instanceof lA?"uncompressed":this.baseLayerData.value?"jpg":"uncompressed"}toString(){return'ImageMediaData "'.concat(this.costumeName,'"')}}class dA extends(q.define({DATA:3,RATE:4})){}class YA extends(q.define({NAME:0,UNCOMPRESSED:1,RATE:4,BITS_PER_SAMPLE:5,DATA:6})){get rate(){return 0!==this.uncompressed.data.value.length?this.uncompressed.rate:this.fields[this.FIELDS.RATE]}get rawBytes(){return this.data&&this.data.value?this.data.value:this.uncompressed.data.value}get decoded(){return this._decoded||(this.data&&this.data.value?this._decoded=new sA(this.bitsPerSample.value).decode(this.data.value):this._decoded=new Int16Array((A=>{const e=new Uint8Array(A);for(let t=0;t<e.length;t+=2)e[t]=a[t+1],e[t+1]=a[t];return e})(this.uncompressed.data.value.slice()).buffer)),this._decoded}get="" crc(){return="" this._crc||(this._crc="(new" $).update(new="" uint32array([this.rate])).update(this.rawbytes).digest),this._crc}get="" samplecount(){return="" this.data&&this.data.value?sa.samples(this.bitspersample.value,this.data.value):this.uncompressed.data.value.length="" 2}get="" extension(){return"pcm"}get="" wavencodeddata(){return="" this._wavencodeddata||(this._wavencodeddata="new" uint8array(ca.encode(this.decoded,{samplerate:this.rate&&this.rate.value}))),this._wavencodeddata}get="" md5(){return="" this._md5||(this._md5="EA()(this.wavEncodedData)),this._md5}toString(){return'SoundMediaData" "'.concat(this.name,'"')}}class="" ma="" extends(q.define({box:0,hidden_when_null:1,list_name:8,contents:9,target:10})){get="" x(){return="" null="==v(this.hiddenWhenNull)?5:this.box.x+1}get" y(){return="" width(){return="" this.box.width-2}get="" height(){return="" this.box.height-2}}class="" fa="" extends(q.define({box:0,parent:1,frames:2,color:3,direction:8,alignment:9})){}class="" da="" extends(q.define({box:0,parent:1,color:3})){}class="" extends(q.define({box:0,color:3,value:8})){}class="" pa="" extends(q.define({box:0,readout_frame:1,color:3,font:6,value:8,target:10,cmd:11,param:13})){}class="" ua="" extends(q.define({box:0})){}const="" ya="" extends(q.define({box:0,target:1,shape:2,readout:14,readout_frame:15,slider:16,alignment:17,slider_min:20,slider_max:21})){get="" this.box.x}get="" this.box.y}get="" mode(){return="" isdiscrete(){return="" math.floor(this.slidermin)="==this.sliderMin&&Math.floor(this.sliderMax)===this.sliderMax&&Math.floor(this.readout.value)===this.readout.value}}const" ha="{[b.POINT]:wA,[b.RECTANGLE]:CA,[b.FORM]:lA,[b.SQUEAK]:lA,[b.SAMPLED_SOUND]:dA,[b.SPRITE]:hA,[b.STAGE]:IA,[b.IMAGE_MEDIA]:uA,[b.SOUND_MEDIA]:YA,[b.ALIGNMENT]:FA,[b.MORPH]:DA,[b.WATCHER_READOUT_FRAME]:UA,[b.STATIC_STRING]:mA,[b.UPDATING_STRING]:pA,[b.WATCHER]:yA,[b.LIST_WATCHER]:MA},RA=Array.from({length:256},(A,e)=">HA[e]||null);class kA{constructor(A){this.valueIterator=A}[Symbol.iterator](){return this}next(){const A=this.valueIterator.next();if(A.done)return A;const e=A.value,{classId:t}=e;let i=e;if(e instanceof P){i=[];for(let A=0;A<e.size;a++)i.push(this.next().value)}if(null!==ra[t]||e instanceof="" o){i="new(RA[e.classId]||q)({classId:e.classId,version:e.version,fields:i})}return{value:i,done:!1}}}class" xa{constructor(a){this.table="Array.from(A),this.fixed=this.fix(this.table)}fix(){const" a="[];for(let" e="0;e<this.table.length;e++)this.fixItem(this.table[e]),A.push(this.table[e]);return" a}fixitem(a){if(void="" 0!="=A.fields&&(A=A.fields),Array.isArray(A))for(let" w?this.table[a.index-1]:a}}class="" ja="" extends(ra.extend({support8bit:c,png:new="" u(3),doslineending:new="" u(2),dosendoffile:new="" u(1),unixlineending:new="" u(1)})){static="" validate(){n(this.equals({support8bit:137,png:"png",doslineending:"\r\n",dosendoffile:"",unixlineending:"\n"}),"pngsignature="" does="" not="" match="" the="" expected="" values")}}ra.initconstructor(ja);class="" ta="" extends(ra.extend({length:d,chunktype:new="" u(4)})){}ra.initconstructor(ta);class="" sa="" extends(ra.extend({checksum:d})){}ra.initconstructor(sa);class="" ba="" extends(ra.extend({width:d,height:d,bitdepth:c,colortype:c,compressionmethod:c,filtermethod:c,interlacemethod:c})){}ra.initconstructor(ba);class="" extends(ra.extend({method:c})){}ra.initconstructor(ja);class="" za{constructor(){this.adler="1}update(A,e,t){let" i="65535&this.adler,B=this.adler">>>16;for(let n=0;n<t;n++)i=(i+a[e+n])%65521,b=(b+i)%65521;return this.adler="B<<16|i,this}get" digest(){return="" this.adler}}class="" va="" extends(ra.extend({cmf:c,flag:c})){}ra.initconstructor(va);class="" la="" extends(ra.extend({lastpacket:c,length:m,lengthcheck:m})){}ra.initconstructor(la);class="" pa="" extends(ra.extend({checksum:d})){}ra.initconstructor(pa);class="" wa{constructor(a){this.stream="A}get" uint8a(){return="" this.stream.uint8a}set="" uint8a(a){return="" this.stream.uint8a="A,this.stream.uint8a}get" position(){return="" this.stream.position}set="" position(a){return="" this.stream.position="A,this.stream.position}writeStruct(A,e){return" this.stream.writestruct(a,e)}writebytes(a){let="" e="arguments.length">1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length;return this.stream.writeBytes(A,e,t)}}class OA extends WA{constructor(A){super(A),this.stream.writeStruct(vA,{cmf:8,flag:29}),this.adler=new zA,this.chunk=this.stream.writeStruct(LA,{lastPacket:0,length:0,lengthCheck:65535})}get _deflateIndex(){return this.chunk.length}set _deflateIndex(A){return this.chunk.length=A,this.chunk.lengthCheck=65535^A,this.chunk.length}writeStruct(A,e){this.writeBytes(Object.assign(new A,e).uint8a)}writeBytes(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length,i=e;for(;t-i>0;){65535===this._deflateIndex&&(this.chunk=this.stream.writeStruct(LA,{lastPacket:0,length:0,lengthCheck:65535}));const e=Math.min(t-i,65535-this._deflateIndex);this.stream.writeBytes(A,i,i+e),this._deflateIndex+=e,i+=e}this.adler.update(A,e,t-e)}finish(){this.chunk.lastPacket=1,this.stream.writeStruct(PA,{checksum:this.adler.digest})}static estimateSize(A){const e=Math.ceil(A/65535);return vA.size+e*LA.size+PA.size+A}}class VA extends WA{constructor(A){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"IHDR";super(A),this.start=this.stream.writeStruct(TA,{length:0,chunkType:e}),this.crc=new $}finish(){const A=this.start.offset+this.start.size,e=this.position-A;this.start.length=e,this.crc.update(this.stream.uint8a,A-d.size,e+d.size),this.stream.writeStruct(SA,{checksum:this.crc.digest})}static size(A){return TA.size+A+SA.size}}class KA{encode(A,e,t){const i=4*A+jA.size,B=i*e,n=JA.size+VA.size(bA.size)+VA.size(OA.estimateSize(B))+VA.size(0),r=new s(new ArrayBuffer(n));r.writeStruct(JA,{support8Bit:137,png:"PNG",dosLineEnding:"\r\n",dosEndOfFile:"",unixLineEnding:"\n"});const o=new VA(r,"IHDR");o.writeStruct(bA,{width:A,height:e,bitDepth:8,colorType:6,compressionMethod:0,filterMethod:0,interlaceMethod:0}),o.finish();const g=new VA(r,"IDAT"),a=new OA(g);let c=0;for(;c<t.length;){a.writestruct(ja,{method:0});const a="Math.min(t.length-c,i-jA.size);a.writeBytes(t,c,c+A),c+=A}a.finish(),g.finish();return" new="" va(r,"iend").finish(),r.buffer}static="" encode(a,e,t){return(new="" ka).encode(a,e,t)}}class="" xa{constructor(a){this.file="A}async(A){return" n("uint8array"="==A,"SB1FakeZipFile" only="" supports="" uint8array"),promise.resolve(this.file.bytes)}}class="" _a{constructor(a){this.files="A}file(A){if(A" in="" this.files)return="" xa(this.files[a])}}const="" za="A=">"uncompressed"===A.extension?new Uint8Array(KA.encode(A.width,A.height,A.decoded)):A.decoded,qA=A=>{const e=String(A[A.length-1]),t=A.length-1;return"mouse"===e?A[t]="_mouse_":"edge"===e?A[t]="_edge_":A[A.length-1]instanceof IA&&(A[t]="_stage_"),A},$A={getParam:A=>{let[e,t,i,B]=A;return[e,t,i,B||"r"]},changeVariable:A=>[A[2],A[1],A[3]],EventHatMorph:A=>"Scratch-StartClicked"===String(A[1])?["whenGreenFlag"]:["whenIReceive",A[1]],MouseClickEventHatMorph:()=>["whenClicked"],KeyEventHatMorph:A=>["whenKeyPressed",A[1]],stopScripts:A=>"other scripts"===String(A[1])?[A[0],"other scripts in sprite"]:A,abs:A=>["computeFunction:of:","abs",A[1]],sqrt:A=>["computeFunction:of:","sqrt",A[1]],"\\\\":A=>["%",...A.slice(1)],doReturn:()=>["stopScripts","this script"],stopAll:()=>["stopScripts","all"],"showBackground:":A=>["startScene",A[1]],nextBackground:()=>["nextScene"],doForeverIf:A=>["doForever",[["doIf",A[1],A[2]]]],"getAttribute:of:":qA,"gotoSpriteOrMouse:":qA,"distanceTo:":qA,"pointTowards:":qA,"touching:":qA},Ae=A=>{const{info:e,stageData:t,images:i,sounds:B}=A,n=A=>{const e=[];for(let t=0;t<a.length;t+=2)e.push([a[t],a[t+1]]);return e},s="A=">{let[e,t]=A;return{name:e,value:t,isPersistent:!1}},r=A=>{let[,{listName:e,contents:t,x:i,y:B,width:n,height:s,hiddenWhenNull:r}]=A;return{listName:e,contents:t,isPersistent:!1,x:i,y:B,width:n,height:s,visible:null!==(o=r,"object"==typeof o&&o?o.valueOf():o)};var o},o=A=>{const e=B.findIndex(e=>e.crc===A.crc);return{soundName:A.name,soundID:e,md5:"".concat(A.md5,".wav"),sampleCount:A.sampleCount,rate:A.rate,format:""}},g=A=>{const e=i.findIndex(e=>e.crc===A.crc);return{costumeName:A.costumeName,baseLayerID:e,baseLayerMD5:"".concat(EA()(A.rawBytes),".").concat((t=A,"uncompressed"===t.extension?"png":"jpg")),bitmapResolution:1,rotationCenterX:A.rotationCenter.x,rotationCenterY:A.rotationCenter.y};var t},a=A=>{let e=A.map(Q);const t=$A[e[0]];return t&&(e=t(e)),e},c=A=>A.map(a),Q=A=>A instanceof hA?A.objName:Array.isArray(A)?0===A.length||Array.isArray(A[0])?c(A):a(A):A,E=A=>[A[0].x,A[0].y,c(A[1])],w=A=>A instanceof hA?(A=>{const e=A.media.filter(A=>A instanceof uA),i=A.media.filter(A=>A instanceof YA);return{objName:A.objName,variables:n(A.vars).map(s),lists:n(A.lists).map(r),scripts:A.blocksBin.map(E),costumes:e.map(g),currentCostumeIndex:e.findIndex(e=>e.crc===A.currentCostume.crc),sounds:i.map(o),scratchX:A.scratchX,scratchY:A.scratchY,scale:A.scalePoint.x,direction:Math.round(1e6*A.rotationDegrees)/1e6-270,rotationStyle:A.rotationStyle,isDraggable:A.draggable,indexInLibrary:t.spriteOrderInLibrary.indexOf(A),visible:A.visible,spriteInfo:{}}})(A):null;return JSON.parse(JSON.stringify(Object.assign((A=>{const e=A.media.filter(A=>A instanceof uA),t=A.media.filter(A=>A instanceof YA);return{objName:A.objName,variables:n(A.vars).map(s),lists:n(A.lists).map(r),scripts:A.blocksBin.map(E),costumes:e.map(g),currentCostumeIndex:e.findIndex(e=>e.crc===A.currentCostume.crc),sounds:t.map(o),penLayerMD5:"5c81a336fab8be57adc039a8a2b33ca9.png",penLayerID:0,tempoBPM:A.tempoBPM,videoAlpha:.5,children:A.stageContents.map(w).filter(Boolean).reverse()}})(t),{info:(A=>{const e={};for(let t=0;t<a.length;t+=2)"thumbnail"!==string(a[t])&&(e[string(a[t])]=string(a[t+1]));return e})(e)})))};class="" ee="" extends(ra.extend({version:new="" u(10),infobytelength:d})){validate(){n.validate(this.equals({version:"scratchv01"})||this.equals({version:"scratchv02"}),"invalid="" scratch="" file="" signature.")}}ra.initconstructor(ee);class="" te="" extends(ra.extend({objs:new="" u(4),objsvalue:c,stch:new="" u(4),stchvalue:c,numobjects:d})){validate(){n.validate(this.equals({objs:"objs",objsvalue:1,stch:"stch",stchvalue:1}),"invalid="" info="" packet="" header.")}}ra.initconstructor(te);class="" ie{constructor(a){this.buffer="A,this.stream=new" s(a),this.signature="this.stream.readStruct(ee),this.signature.validate(),this.infoHeader=this.stream.readStruct(te),this.infoHeader.validate(),this.stream.position+=this.signature.infoByteLength-te.size,this.dataHeader=this.stream.readStruct(te),this.dataHeader.validate()}get" json(){return="" ae({info:this.info(),stagedata:this.data(),images:this.images(),sounds:this.sounds()})}get="" zip(){return(a="">{let{images:e,sounds:t}=A;const i={};let B=0;for(const A of e)i["".concat(B++,".").concat((n=A,"uncompressed"===n.extension?"png":"jpg"))]={bytes:ZA(A)};var n,s;B=0;for(const A of t)i["".concat(B++,".wav")]={bytes:(s=A,s.wavEncodedData)};return new _A(i)})({images:this.images(),sounds:this.sounds()})}view(){return{signature:this.signature,infoHeader:this.infoHeader,dataHeader:this.dataHeader,toString:()=>"SB1File"}}infoRaw(){return new r(new Z(this.buffer,this.infoHeader.offset+te.size),this.signature.infoByteLength+ee.size)}infoTable(){return new kA(this.infoRaw())}info(){return this._info||(this._info=new xA(this.infoTable()).table[0]),this._info}dataRaw(){return new r(new Z(this.buffer,this.dataHeader.offset+te.size),this.stream.uint8a.length)}dataTable(){return new kA(this.dataRaw())}dataFixed(){return this._data||(this._data=new xA(this.dataTable()).table),this._data}data(){return this.dataFixed()[0]}images(){const A=new Set;return this.dataFixed().filter(e=>e instanceof uA&&(!A.has(e.crc)&&(A.add(e.crc),!0)))}sounds(){const A=new Set;return this.dataFixed().filter(e=>e instanceof YA&&(!A.has(e.crc)&&(A.add(e.crc),!0)))}}},function(A,e,t){"use strict";t.r(e);var i={};t.r(i),t.d(i,"Scaffolding",(function(){return z})),t.d(i,"Cloud",(function(){return Y})),t.d(i,"VM",(function(){return n.a})),t.d(i,"Renderer",(function(){return r.a})),t.d(i,"Storage",(function(){return c})),t.d(i,"AudioEngine",(function(){return E.a})),t.d(i,"JSZip",(function(){return l.a}));var B=t(64),n=t.n(B),s=t(66),r=t.n(s),o=t(129),g=t.n(o);class a extends g.a{constructor(){super(),this._totalAssets=0,this._loadedAssets=0}_updateProgress(){this.onprogress&&this.onprogress(this._totalAssets,this._loadedAssets)}load(A,e,t){return A===this.AssetType.ImageBitmap||A===this.AssetType.ImageVector||A===this.AssetType.Sound||A===this.AssetType.Font?(this._totalAssets++,this._updateProgress(),super.load(A,e,t).then(A=>(this._loadedAssets++,this._updateProgress(),A))):super.load(A,e,t)}}var c=a,Q=t(67),E=t.n(Q),w=t(65),C=t(24),l=t.n(C);const I=[],h=A=>{let e;var t;return 0===I.length?(t={audio:!1,video:A},e=navigator.mediaDevices?navigator.mediaDevices.getUserMedia(t):Promise.reject(new Error("video is not supported in this context (insecure domain?)")),I.push(e)):I.length>0&&(e=I[0],I.push(!0)),e};class u{constructor(){this.mirror=!0,this._frameCacheTimeout=16,this._video=null,this._track=null,this._workspace=[]}static get FORMAT_IMAGE_DATA(){return"image-data"}static get FORMAT_CANVAS(){return"canvas"}static get DIMENSIONS(){return[480,360]}static get ORDER(){return 1}get video(){return this._video}enableVideo(){return this.enabled=!0,this._setupVideo()}disableVideo(){this.enabled=!1,this._singleSetup&&this._singleSetup.then(this._teardown.bind(this)).catch(A=>this.onError(A))}_teardown(){if(!1===this.enabled){const A=(I.pop(),!(I.length>0));this._singleSetup=null,this._video=null,this._track&&A&&this._track.stop(),this._track=null}}getFrame(A){let{dimensions:e=u.DIMENSIONS,mirror:t=this.mirror,format:i=u.FORMAT_IMAGE_DATA,cacheTimeout:B=this._frameCacheTimeout}=A;if(!this.videoReady)return null;const[n,s]=e,r=this._getWorkspace({dimensions:e,mirror:Boolean(t)}),{videoWidth:o,videoHeight:g}=this._video,{canvas:a,context:c,lastUpdate:Q,cacheData:E}=r,w=Date.now();Q+B<w&&(t&&(c.scale(-1,1),c.translate(-1*n,0)),c.drawimage(this._video,0,0,o,g,0,0,n,s),c.settransform(1,0,0,1,0,0),r.lastupdate=w),e[i]||(e[i]={lastupdate:0});const c="E[i];return" c.lastupdate+b<w&&(i="==u.FORMAT_IMAGE_DATA?C.lastData=c.getImageData(0,0,n,s):i===u.FORMAT_CANVAS?(C.lastUpdate=1/0,C.lastData=a):(console.error("video" io="" error="" -="" unimplemented="" format="" ".concat(i)),c.lastupdate="1/0,C.lastData=null),C.lastUpdate=Math.max(r.lastUpdate,C.lastUpdate)),C.lastData}onError(A){console.error("Unhandled" video="" device="" error",a)}_setupvideo(){return="" this._singlesetup||(this._singlesetup="h({width:{min:480,ideal:640},height:{min:360,ideal:480}}).then(A=">{this._video=document.createElement("video");try{this._video.srcObject=A}catch(e){this._video.src=window.URL.createObjectURL(A)}return this._video.play(),this._track=A.getTracks()[0],this}).catch(A=>{this._singleSetup=null,this.onError(A)})),this._singleSetup}get videoReady(){if(!this.enabled)return!1;if(!this._video)return!1;if(!this._track)return!1;const{videoWidth:A,videoHeight:e}=this._video;return"number"==typeof A&&"number"==typeof e&&(0!==A&&0!==e)}_getWorkspace(A){let{dimensions:e,mirror:t}=A,i=this._workspace.find(A=>A.dimensions.join("-")===e.join("-")&&A.mirror===t);return i||(i={dimensions:e,mirror:t,canvas:document.createElement("canvas"),lastUpdate:0,cacheData:{}},i.canvas.width=e[0],i.canvas.height=e[1],i.context=i.canvas.getContext("2d"),this._workspace.push(i)),i}}var d=u;var Y={CloudManager:class{constructor(A){this.parent=A,this.providers=[],this.overrides=new Map}hasCloudData(){return this.parent.vm.runtime.hasCloudData()}projectReady(){if(this.hasCloudData())for(const A of this.providers)A.enable()}setVariable(A,e,t){this.overrides.has(e)&&this.overrides.get(e)!==A||this.parent.vm.postIOData("cloud",{varUpdate:{name:e,value:t}})}getUsername(){return this.parent._username}addProvider(A){A.manager=this,this.hasCloudData()&&A.enable(),this.providers.push(A)}requestCloseConnection(){}createVariable(A,e){}renameVariable(A,e){}deleteVariable(A){}addProviderOverride(A,e){if(e&&!this.providers.includes(e))throw new Error("Manager is not aware of this provider");this.overrides.set(A,e)}updateVariable(A,e){if(this.overrides.has(A)){const t=this.overrides.get(A);t&&t.handleUpdateVariable(A,e)}else for(const t of this.providers)t.handleUpdateVariable(A,e)}},WebSocketProvider:class{constructor(A,e){this.cloudHosts=Array.isArray(A)?A:[A],this.projectId=e,this.attemptedConnections=0,this.bufferedMessages=[],this.scheduledBufferedSend=null,this.reconnectTimeout=null,this.openConnection=this.openConnection.bind(this),this._scheduledSendBufferedMessages=this._scheduledSendBufferedMessages.bind(this)}enable(){this.openConnection()}setProjectId(A){this.projectId=A,this.closeAndReconnect()}openConnection(){this.currentCloudHost=this.cloudHosts[this.attemptedConnections%this.cloudHosts.length],this.attemptedConnections++,console.log("Connecting to ".concat(this.currentCloudHost," with ID ").concat(this.projectId,", username ").concat(this.manager.getUsername()));try{this.ws=new WebSocket(this.currentCloudHost)}catch(A){throw console.error(A),new Error("Cloud host ".concat(this.currentCloudHost," is invalid: ").concat(A))}this.ws.onerror=this.onerror.bind(this),this.ws.onmessage=this.onmessage.bind(this),this.ws.onopen=this.onopen.bind(this),this.ws.onclose=this.onclose.bind(this)}onerror(A){console.error("WebSocket error",A)}onmessage(A){for(const e of A.data.split("\n"))if(e){const A=JSON.parse(e);"set"===A.method&&this.manager.setVariable(this,A.name,A.value)}}onopen(){this.attemptedConnections=0,this.writeToServer({method:"handshake"}),this.sendBufferedMessages(),console.log("WebSocket connected")}onclose(A){if(A&&4002===A.code)return void console.log("Username is invalid; not reconnecting.");if(A&&4004===A.code)return void console.log("Project is blocked; not reconnecting.");const e=Math.random()*(Math.pow(2,Math.min(this.attemptedConnections+1,5))-1)*1e3;console.log("Connection lost; reconnecting in ".concat(Math.round(e),"ms")),this.reconnectTimeout=setTimeout(this.openConnection,e)}closeAndReconnect(){console.log("Closing connection and reconnecting."),this.ws&&(this.ws.onclose=null,this.ws.onerror=null,this.ws.close()),clearTimeout(this.reconnectTimeout);this.reconnectTimeout=setTimeout(this.openConnection,1e3/30)}canWriteToServer(){return this.ws&&this.ws.readyState===WebSocket.OPEN}scheduleBufferedSend(){this.scheduledBufferedSend||(this.scheduledBufferedSend=!0,Promise.resolve().then(this._scheduledSendBufferedMessages))}_scheduledSendBufferedMessages(){this.scheduledBufferedSend=!1,this.canWriteToServer()&&this.sendBufferedMessages()}sendBufferedMessages(){for(const A of this.bufferedMessages)this.writeToServer(A);this.bufferedMessages.length=0}bufferedWriteToServer(A){this.bufferedMessages.push(A),this.scheduleBufferedSend()}writeToServer(A){A.project_id=this.projectId,A.user=this.manager.getUsername(),this.ws.send(JSON.stringify(A))}handleUpdateVariable(A,e){for(const t of this.bufferedMessages)if(t.name===A)return void(t.value=e);this.bufferedWriteToServer({method:"set",name:A,value:e})}},LocalStorageProvider:class{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"p4:cloudvariables";this.key=A,this.variables={},this.handleStorageEvent=this.handleStorageEvent.bind(this)}readFromLocalStorage(){let A;try{if(A=JSON.parse(localStorage.getItem(this.key)),!A||"object"!=typeof A)return}catch(A){return}this.variables=A;for(const A of Object.keys(this.variables))this.manager.setVariable(this,A,this.variables[A])}storeToLocalStorage(){try{localStorage.setItem(this.key,JSON.stringify(this.variables))}catch(A){}}handleStorageEvent(A){A.key===this.key&&A.storageArea===localStorage&&this.readFromLocalStorage()}enable(){this.readFromLocalStorage(),window.addEventListener("storage",this.handleStorageEvent)}handleUpdateVariable(A,e){this.variables[A]=e,this.storeToLocalStorage()}}},M=t(130),F=t.n(M),D=t(68),m={insert:A=>{var e=document.head||document.body||document.documentElement;e.insertBefore(A,e.firstChild)},singleton:!1},p=(F()(D.a,m),D.a.locals||{});const U=A=>new Promise((e,t)=>{const i=new FileReader;i.onload=()=>e(i.result),i.onerror=()=>t(new Error("Cannot read as text: ".concat(i.error))),i.readAsText(A)});var f=class{constructor(A,e){this.el=A,this.callback=e,this.el.addEventListener("dragover",this.ondragover.bind(this)),this.el.addEventListener("dragleave",this.ondragleave.bind(this)),this.el.addEventListener("drop",this.ondrop.bind(this))}ondragover(A){A.dataTransfer.types.includes("Files")&&(A.preventDefault(),A.dataTransfer.dropEffect="copy",this.el.classList.add(p.dropping))}ondragleave(A){A.preventDefault(),this.el.classList.remove(p.dropping)}ondrop(A){A.preventDefault(),this.el.classList.remove(p.dropping),A.dataTransfer.types.includes("Files")&&A.dataTransfer.files.length>0&&Promise.all(Array.from(A.dataTransfer.files).map(U)).then(A=>{this.callback(A)})}};var N=class{constructor(A,e){this.parent=A,this.text=e,this.root=document.createElement("div"),this.root.className=p.questionRoot,this.inner=document.createElement("div"),this.inner.className=p.questionInner,e&&(this.textElement=document.createElement("div"),this.textElement.textContent=e,this.textElement.className=p.questionText),this.inputContainer=document.createElement("div"),this.inputContainer.className=p.questionInputOuter,this.input=document.createElement("input"),this.input.className=p.questionInput,this.input.addEventListener("keypress",this.onkeypress.bind(this)),this.dropper=new f(this.input,this.dropperCallback.bind(this)),this.submitButton=document.createElement("button"),this.submitButton.className=p.questionSubmitButton,this.submitButton.addEventListener("click",this.onsubmitpressclick.bind(this)),this.inputContainer.appendChild(this.input),this.inputContainer.appendChild(this.submitButton),this.textElement&&this.inner.appendChild(this.textElement),this.inner.appendChild(this.inputContainer),this.root.appendChild(this.inner),this.parent._addLayer(this.root),this.input.focus(),this.answerCallback=new Promise(A=>{this.callback=A})}answer(){return this.answerCallback}submit(){this.callback(this.input.value),this.destroy()}onkeypress(A){"Enter"===A.key&&this.submit()}dropperCallback(A){const e=A.join("").replace(/\r?\n/g," ");this.input.value=e}onsubmitpressclick(){this.submit()}destroy(){this.root.remove(),this.parent.question=null}};var G=class{constructor(A){this.parent=A,this.root=document.createElement("div"),this.root.className=p.contextMenu,this._onmousedown=this._onmousedown.bind(this),this._onresize=this._onresize.bind(this),this._onblur=this._onblur.bind(this)}_onmousedown(A){this.root.contains(A.target)||this.destroy()}_onresize(){this.destroy()}_onblur(){this.destroy()}add(A){const e=document.createElement("button");e.className=p.contextMenuItem,e.textContent=A.text,e.addEventListener("click",()=>{this.destroy(),A.callback()}),e.addEventListener("contextmenu",A=>{A.preventDefault()}),this.root.appendChild(e)}show(A){document.addEventListener("mousedown",this._onmousedown),window.addEventListener("resize",this._onresize),window.addEventListener("blur",this._onblur),this.parent._addLayer(this.root);const e=this.parent.layersRect,t=this.root.getBoundingClientRect();let i=A.clientX-e.left,B=A.clientY-e.top;i+t.width>e.width&&(i-=t.width),B+t.height>e.height&&(B-=t.height),this.root.style.transform="translate(".concat(i,"px, ").concat(B,"px)"),getComputedStyle(this.root).opacity,this.root.style.opacity="1"}destroy(){document.removeEventListener("mousedown",this._onmousedown),window.removeEventListener("resize",this._onresize),window.removeEventListener("blur",this._onblur),this.root.style.opacity="0",this.root.style.pointerEvents="none",setTimeout(()=>{this.root.remove()},200)}};var y=(A,e)=>{if("undefined"!=typeof ExternalDownloadHelper)return void ExternalDownloadHelper.download(A,e);const t=document.createElement("a");if(document.body.appendChild(t),navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(e,A);else if("download"in HTMLAnchorElement.prototype){const i=window.URL.createObjectURL(e);t.href=i,t.download=A,t.type=e.type,t.click(),window.setTimeout(()=>{document.body.removeChild(t),window.URL.revokeObjectURL(i)},1e3)}else{let A=window.open("","_blank");const t=new FileReader;t.onloadend=function(){A.location.href=t.result,A=null},t.readAsDataURL(e)}};class H{constructor(A,e){this.parent=A,this.id=e.get("id"),this.spriteName=e.get("spriteName"),this.targetId=e.get("targetId"),this.opcode=e.get("opcode"),this.params=e.get("params"),this.root=document.createElement("div"),this.root.className=p.monitorRoot,this.root.dataset.id=this.id,this.root.dataset.opcode=this.opcode,this.parent._monitorOverlay.appendChild(this.root)}getLabel(){let A;if("data_variable"===this.opcode)A=this.params.VARIABLE;else if("data_listcontents"===this.opcode)A=this.params.LIST;else if("motion_xposition"===this.opcode)A=this.parent.getMessage("var-x");else if("motion_yposition"===this.opcode)A=this.parent.getMessage("var-y");else if("motion_direction"===this.opcode)A=this.parent.getMessage("var-direction");else if("sensing_username"===this.opcode)A=this.parent.getMessage("var-username");else if("looks_costumenumbername"===this.opcode)A="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-costume-number"):this.parent.getMessage("var-costume-name");else if("looks_backdropnumbername"===this.opcode)A="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-backdrop-number"):this.parent.getMessage("var-backdrop-name");else if("looks_size"===this.opcode)A=this.parent.getMessage("var-size");else if("sensing_answer"===this.opcode)A=this.parent.getMessage("var-answer");else if("sensing_mousedown"===this.opcode)A=this.parent.getMessage("var-mousedown");else if("sensing_mousex"===this.opcode)A=this.parent.getMessage("var-mousex");else if("sensing_mousey"===this.opcode)A=this.parent.getMessage("var-mousey");else if("sensing_loudness"===this.opcode)A=this.parent.getMessage("var-loudness");else if("sensing_timer"===this.opcode)A=this.parent.getMessage("var-timer");else if("sensing_dayssince2000"===this.opcode)A=this.parent.getMessage("var-dayssince2000");else if("sound_volume"===this.opcode)A=this.parent.getMessage("var-volume");else if("sensing_current"===this.opcode){const e=this.params.CURRENTMENU.toLowerCase();"year"===e?A=this.parent.getMessage("var-year"):"month"===e?A=this.parent.getMessage("var-month"):"date"===e?A=this.parent.getMessage("var-date"):"dayofweek"===e?A=this.parent.getMessage("var-day-of-week"):"hour"===e?A=this.parent.getMessage("var-hour"):"minute"===e?A=this.parent.getMessage("var-minute"):"second"===e&&(A=this.parent.getMessage("var-second"))}else{const e=this.parent.vm.runtime.getLabelForOpcode(this.opcode);A=e?e.label:this.opcode}return this.spriteName?"".concat(this.spriteName,": ").concat(A):A}getTarget(){return this.targetId?this.parent.vm.runtime.getTargetById(this.targetId):this.parent.vm.runtime.getTargetForStage()}getVmVariable(){return this.getTarget().variables[this.id]}update(A){this.x=A.get("x"),this.y=A.get("y"),this.visible=A.get("visible"),this.root.style.transform="translate(".concat(Math.round(this.x),"px, ").concat(Math.round(this.y),"px)"),this.root.style.display=this.visible?"":"none"}}class R extends H{constructor(A,e){super(A,e),this.mode=e.get("mode"),"large"===this.mode?(this.valueElement=document.createElement("div"),this.valueElement.className=p.monitorLargeValue+" "+p.monitorValueColor,this.root.appendChild(this.valueElement)):(this.inner=document.createElement("div"),this.inner.className=p.monitorInner,this.valueRow=document.createElement("div"),this.valueRow.className=p.monitorRow,this.label=document.createElement("div"),this.label.className=p.monitorLabel,this.label.textContent=this.getLabel(),this.valueElement=document.createElement("div"),this.valueElement.className=p.monitorValue+" "+p.monitorValueColor,this.valueRow.appendChild(this.label),this.valueRow.appendChild(this.valueElement),this.inner.appendChild(this.valueRow),"slider"===this.mode&&(this.sliderRow=document.createElement("div"),this.sliderRow.className=p.monitorRow,this.slider=document.createElement("input"),this.slider.className=p.monitorSlider,this.slider.type="range",this.slider.min=e.get("sliderMin"),this.slider.max=e.get("sliderMax"),this.slider.step=e.get("isDiscrete")?1:.01,this.slider.addEventListener("input",this.onsliderchange.bind(this)),this.sliderRow.appendChild(this.slider),this.inner.appendChild(this.sliderRow)),this.root.appendChild(this.inner)),this.parent._monitorOverlay.appendChild(this.root),this._value=""}setVariableValue(A){const e=this.getVmVariable();if(e.value=A,e.isCloud){this.parent.vm.runtime.ioDevices.cloud.requestUpdateVariable(e.name,e.value)}this._value=A,this.valueElement.textContent=A}onsliderchange(A){this.setVariableValue(+A.target.value)}update(A){if(super.update(A),!this.visible)return;let e=A.get("value");"number"==typeof e&&(e=Number(e.toFixed(6))),this._value!==e&&(this._value=e,this.valueElement.textContent=e,this.slider&&(this.slider.value=e))}}class k{constructor(A){this.monitor=A,this.index=-1,this.value="",this.locked=!1,this.root=document.createElement("label"),this.root.className=p.monitorRowRoot,this.indexEl=document.createElement("div"),this.indexEl.className=p.monitorRowIndex,this.valueOuter=document.createElement("div"),this.valueOuter.className=p.monitorRowValueOuter,this.editable=this.monitor.editable,this.editable?(this.valueInner=document.createElement("input"),this.valueInner.tabIndex=-1,this.valueInner.className=p.monitorRowValueInner,this.valueInner.readOnly=!0,this.valueInner.addEventListener("click",this._onclickinput.bind(this)),this.valueInner.addEventListener("blur",this._onblurinput.bind(this)),this.valueInner.addEventListener("keypress",this._onkeypressinput.bind(this)),this.valueInner.addEventListener("keydown",this._onkeypressdown.bind(this)),this.valueInner.addEventListener("contextmenu",this._oncontextmenu.bind(this)),this.valueInner.addEventListener("input",this._oninput.bind(this)),this.valueOuter.appendChild(this.valueInner),this.deleteButton=document.createElement("button"),this.deleteButton.className=p.monitorRowDelete,this.deleteButton.textContent="×",this.deleteButton.addEventListener("mousedown",this._onclickdelete.bind(this)),this.valueOuter.appendChild(this.deleteButton)):(this.valueInner=document.createElement("div"),this.valueInner.className=p.monitorRowValueInner,this.valueOuter.appendChild(this.valueInner),this.valueInner.addEventListener("contextmenu",this._oncontextmenuuneditable.bind(this))),this.root.appendChild(this.indexEl),this.root.appendChild(this.valueOuter)}_onclickinput(){this.valueInner.focus(),this.locked||(this.valueInner.select(),this.valueInner.readOnly=!1,this.locked=!0,this.root.classList.add(p.monitorRowValueEditing),this.addNewValue=!1,this.deleteValue=!1,this.valueWasChanged=!1)}_onblurinput(){if(this.locked)if(this.unfocus(),this.deleteValue){const A=[...this.monitor.value];A.splice(this.index,1),this.monitor.setValue(A),this.monitor.tryToFocusRow(Math.min(A.length-1,this.index))}else if(this.valueWasChanged||this.addNewValue){const A=[...this.monitor.value];A[this.index]=this.valueInner.value,this.addNewValue&&A.splice(this.index+1,0,""),this.monitor.setValue(A),this.addNewValue&&this.monitor.tryToFocusRow(this.index+1)}}_oninput(){this.valueWasChanged=!0}_onkeypressinput(A){"Enter"===A.key&&(this.addNewValue=!0,this.valueInner.blur())}_onkeypressdown(A){if("Escape"===A.key)this.valueInner.blur();else if("ArrowUp"===A.key||"ArrowDown"===A.key||"Tab"===A.key){A.preventDefault();let e=this.index;"ArrowUp"===A.key||"Tab"===A.key&&A.shiftKey?(e--,e<0&&(e=this.monitor.value.length-1)):(e++,e>=this.monitor.value.length&&(e=0)),this.monitor.tryToFocusRow(e)}}_onclickdelete(A){A.preventDefault(),this.deleteValue=!0,this.valueInner.blur()}_oncontextmenu(A){this.locked?A.stopPropagation():A.preventDefault()}_oncontextmenuuneditable(A){const e=getSelection();this.valueInner.contains(e.anchorNode)&&!e.isCollapsed&&A.stopPropagation()}setIndex(A){this.index!==A&&(this.index=A,this.root.dataset.index=A,this.root.style.transform="translateY(".concat(24*A,"px)"),this.indexEl.textContent=A+1)}setValue(A){this.value===A||this.locked||(this.value=A,this.editable?this.valueInner.value=A:this.valueInner.textContent=A)}focus(){this.valueInner.click(),document.activeElement!==this.valueInner&&setTimeout(()=>this.valueInner.click())}unfocus(){this.locked&&(this.locked=!1,this.valueInner.readOnly=!0,this.root.classList.remove(p.monitorRowValueEditing))}}class x extends H{constructor(A,e){super(A,e),this.editable=A.editableLists,this.rows=new Map,this.cachedRows=[],this.scrollTop=0,this.oldLength=-1,this.label=document.createElement("div"),this.label.className=p.monitorListLabel,this.label.textContent=this.getLabel(),this.footer=document.createElement("div"),this.footer.className=p.monitorListFooter,this.footerText=document.createElement("div"),this.footerText.className=p.monitorListFooterText,this.rowsOuter=document.createElement("div"),this.rowsOuter.className=p.monitorRowsOuter,this.rowsInner=document.createElement("div"),this.rowsInner.className=p.monitorRowsInner,this.rowsInner.addEventListener("scroll",this._onscroll.bind(this),{passive:!0}),this.endPoint=document.createElement("div"),this.endPoint.className=p.monitorRowsEndpoint,this.emptyLabel=document.createElement("div"),this.emptyLabel.textContent=A.getMessage("list-empty"),this.emptyLabel.className=p.monitorEmpty,this.editable&&(this.addButton=document.createElement("button"),this.addButton.className=p.monitorListAdd,this.addButton.textContent="+",this.addButton.addEventListener("click",this._onclickaddbutton.bind(this)),this.footer.appendChild(this.addButton)),this.rowsInner.appendChild(this.endPoint),this.rowsInner.appendChild(this.emptyLabel),this.rowsOuter.appendChild(this.rowsInner),this.footer.appendChild(this.footerText),this.root.appendChild(this.label),this.root.appendChild(this.rowsOuter),this.root.appendChild(this.footer),this.dropper=new f(this.rowsOuter,this.dropperCallback.bind(this)),this.handleImport=this.handleImport.bind(this),this.handleExport=this.handleExport.bind(this),this.root.addEventListener("contextmenu",this._oncontextmenu.bind(this))}_onclickaddbutton(A){this.setValue([...this.value,""]),this.tryToFocusRow(this.value.length-1)}unfocusAllRows(){for(const A of this.rows.values())A.unfocus()}tryToFocusRow(A){if(A>=0&&A<this.value.length){this.unfocusallrows();let e="this.rows.get(A);e||(e=this.createRow(A)),e.focus()}}_onscroll(A){this.scrollTop=A.target.scrollTop,this.updateValue(this.value)}_oncontextmenu(A){A.preventDefault();const" g(this.parent);e.add({text:this.parent.getmessage("list-import"),callback:this.handleimport}),e.add({text:this.parent.getmessage("list-export"),callback:this.handleexport}),e.show(a)}handleimport(){const="" a="document.createElement("input");A.type="file",A.accept=".txt,.csv,.tsv",A.style.display="none",document.body.appendChild(A),A.addEventListener("change",A=">{const e=A.target.files;if(0===e.length)return;const t=e[0];U(t).then(A=>this.import(A))}),A.click()}import(A){const e=A.split(/\r?\n/);this.setValue(e)}handleExport(){const A=this.getValue().join("\n"),e=new Blob([A],{type:"text/plain"});y("".concat(this.getLabel(),".txt"),e)}dropperCallback(A){this.import(A.join("\n"))}getValue(){return this.getVmVariable().value}setValue(A){this.getVmVariable().value=A,this.updateValue(A)}update(A){super.update(A),this.visible&&(this.width=A.get("width")||100,this.height=A.get("height")||200,this.root.style.width="".concat(this.width,"px"),this.root.style.height="".concat(this.height,"px"),this.updateValue(A.get("value")))}createRow(A){const e=this.cachedRows.pop()||new k(this);e.setIndex(A),e.setValue(this.value[A]),this.rows.set(A,e);let t=!1;for(const i of this.rowsInner.children){const B=i.dataset.index;if(!B)continue;if(+B>A){this.rowsInner.insertBefore(e.root,i),t=!0;break}}return t||this.rowsInner.appendChild(e.root),e}updateValue(A){this.value=A,A.length!==this.oldLength&&(this.oldLength=A.length,this.footerText.textContent=this.parent.getMessage("list-length").replace("{n}",A.length),this.endPoint.style.transform="translateY(".concat(24*A.length,"px)"),this.emptyLabel.style.display=A.length?"none":"");let e=Math.floor(this.scrollTop/24)-5;e<0&&(e=0);let t=Math.ceil((this.scrollTop+this.height)/24)+3;t>A.length-1&&(t=A.length-1);for(const i of this.rows.keys())if(i<e||i>t){const e=this.rows.get(i);(!e.locked||i>=A.length)&&(e.unfocus(),e.root.remove(),this.rows.delete(i),this.cachedRows.length<10&&this.cachedRows.push(e))}for(let i=e;i<=t;i++){const e=this.rows.get(i);e?e.setValue(A[i]):this.createRow(i)}}}var J=class{constructor(){this.hasItem=!1,this.root=document.createElement("div"),this.root.className=p.controlsBar,this.start=document.createElement("div"),this.end=document.createElement("div"),this.root.appendChild(this.start),this.root.appendChild(this.end)}addToStart(A){this.hasItem=!0,this.start.appendChild(A)}addToEnd(A){this.hasItem=!0,this.end.appendChild(A)}computeHeight(){return this.hasItem?this.root.getBoundingClientRect().height:0}};const T=A=>"number"==typeof A||"string"==typeof A||"boolean"==typeof A;var S=t(134);const b=A=>A.touches&&A.touches[0]?{x:A.touches[0].clientX,y:A.touches[0].clientY}:A.changedTouches&&A.changedTouches[0]?{x:A.changedTouches[0].clientX,y:A.changedTouches[0].clientY}:{x:A.clientX,y:A.clientY},j=A=>"function"==typeof A?A:()=>A;class z extends class{constructor(){this._events={}}addEventListener(A,e){this._events[A]||(this._events[A]=[]),this._events[A].push(e)}removeEventListener(A,e){const t=this._events[A];t&&(this._events[A]=t.filter(A=>A!==e))}dispatchEvent(A){const e=this._events[A.type];if(e)for(const t of e)t(A)}}{constructor(){super(),this.width=480,this.height=360,this.resizeMode="preserve-ratio",this.editableLists=!1,this.shouldConnectPeripherals=!0,this.usePackagedRuntime=!1,this.messages=S,this._monitors=new Map,this._mousedownPosition=null,this._draggingId=null,this._draggingStartMousePosition=null,this._draggingStartSpritePosition=null,this._offsetFromTop=0,this._offsetFromBottom=0,this._offsetFromLeft=0,this._offsetFromRight=0,this._root=document.createElement("div"),this._root.className=p.root,this._layers=document.createElement("div"),this._layers.className=p.layers,this._root.appendChild(this._layers),this._canvas=document.createElement("canvas"),this._canvas.className=p.canvas,this._addLayer(this._canvas),this._overlays=document.createElement("div"),this._overlays.className=p.scaledOverlaysInner,this._overlaysOuter=document.createElement("div"),this._overlaysOuter.className=p.scaledOverlaysOuter,this._overlaysOuter.appendChild(this._overlays),this._addLayer(this._overlaysOuter),this._monitorOverlay=document.createElement("div"),this._monitorOverlay.className=p.monitorOverlay,this._overlays.appendChild(this._monitorOverlay),this._topControls=new J,this._layers.appendChild(this._topControls.root),document.addEventListener("mousemove",this._onmousemove.bind(this)),this._canvas.addEventListener("mousedown",this._onmousedown.bind(this)),document.addEventListener("mouseup",this._onmouseup.bind(this)),this._canvas.addEventListener("touchstart",this._ontouchstart.bind(this)),document.addEventListener("touchmove",this._ontouchmove.bind(this)),document.addEventListener("touchend",this._ontouchend.bind(this)),this._canvas.addEventListener("contextmenu",this._oncontextmenu.bind(this)),this._canvas.addEventListener("wheel",this._onwheel.bind(this)),document.addEventListener("keydown",this._onkeydown.bind(this)),document.addEventListener("keyup",this._onkeyup.bind(this)),window.addEventListener("resize",this._onresize.bind(this))}_addLayer(A){this._layers.appendChild(A)}_scratchCoordinates(A,e){return{x:this.width/this.layersRect.width*(A-this.layersRect.width/2),y:-this.height/this.layersRect.height*(e-this.layersRect.height/2)}}_onmousemove(A){const{x:e,y:t}=b(A),i={x:e-this.layersRect.left,y:t-this.layersRect.top,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height};if(this._mousedownPosition&&!this._draggingId){Math.sqrt(Math.pow(i.x-this._mousedownPosition.x,2)+Math.pow(i.y-this._mousedownPosition.y,2))>3&&(this._startDragging(i.x,i.y),this._cancelDragTimeout())}else if(this._draggingId){const A=this._scratchCoordinates(i.x,i.y);this.vm.postSpriteInfo({x:A.x-this._draggingStartMousePosition.x+this._draggingStartSpritePosition.x,y:A.y-this._draggingStartMousePosition.y+this._draggingStartSpritePosition.y,force:!0})}this.vm.postIOData("mouse",i)}_startDragging(A,e){if(this._draggingId)return;const t=this.renderer.pick(A,e);if(null===t)return;const i=this.vm.getTargetIdForDrawableId(t);if(null===i)return;const B=this.vm.runtime.getTargetById(i);B.draggable&&(B.goToFront(),this._draggingId=i,this._draggingStartMousePosition=this._scratchCoordinates(A,e),this._draggingStartSpritePosition={x:B.x,y:B.y},this.vm.startDrag(i))}_cancelDragTimeout(){clearTimeout(this._dragTimeout),this._dragTimeout=null}_onmousedown(A){const{x:e,y:t}=b(A),i={x:e-this.layersRect.left,y:t-this.layersRect.top,button:A.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!0},B="undefined"!=typeof TouchEvent&&A instanceof TouchEvent;(0===A.button||B)&&(this._dragTimeout=setTimeout(this._startDragging.bind(this,i.x,i.y),400)),B&&(A.preventDefault(),document.activeElement&&document.activeElement.blur&&document.activeElement.blur()),this._mousedownPosition={x:i.x,y:i.y},this.vm.postIOData("mouse",i)}_onmouseup(A){this._cancelDragTimeout();const{x:e,y:t}=b(A),i={x:e-this.layersRect.left,y:t-this.layersRect.top,button:A.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!1,wasDragged:null!==this._draggingId};this._mousedownPosition=null,this.vm.postIOData("mouse",i),this._draggingId&&(this.vm.stopDrag(this._draggingId),this._draggingStartMousePosition=null,this._draggingStartSpritePosition=null,this._draggingId=null)}_ontouchstart(A){this._onmousedown(A)}_ontouchmove(A){this._onmousemove(A)}_ontouchend(A){this._onmouseup(A)}_oncontextmenu(A){A.preventDefault()}_onwheel(A){const e={deltaX:A.deltaX,deltaY:A.deltaY};this.vm.postIOData("mouseWheel",e)}_onkeydown(A){if(A.target!==document&&A.target!==document.body)return;const e={key:A.key,keyCode:A.keyCode,isDown:!0};this.vm.postIOData("keyboard",e),(32===A.keyCode||A.keyCode>=37&&A.keyCode<=40||8===A.keyCode||222===A.keyCode||191===A.keyCode)&&A.preventDefault()}_onkeyup(A){const e={key:A.key,keyCode:A.keyCode,isDown:!1};this.vm.postIOData("keyboard",e),A.target!==document&&A.target!==document.body&&A.preventDefault()}_onresize(){this.relayout()}relayout(){const A=Math.max(1,this._root.offsetWidth),e=Math.max(1,this._root.offsetHeight),t=this._offsetFromTop+this._topControls.computeHeight(),i=this._offsetFromBottom,B=this._offsetFromLeft,n=this._offsetFromRight,s=Math.max(1,A-B-n),r=Math.max(1,e-t-i);"dynamic-resize"===this.resizeMode&&(this.vm.setStageSize?(this.width=s,this.height=r,this.vm.setStageSize(this.width,this.height)):console.warn("dynamic-resize not supported: vm does not implement setStageSize"));let o=s,g=r;"stretch"!==this.resizeMode&&(o=g/this.height*this.width,o>s&&(g=s/this.width*this.height,o=s));const a=e-g,c=A-o,Q=(c-B-n)/2+B-c/2,E=(a-t-i)/2+t-a/2;this._layers.style.transform="translate(".concat(Q,"px, ").concat(E,"px)"),this._layers.style.width="".concat(o,"px"),this._layers.style.height="".concat(g,"px"),this._overlays.style.transform="scale(".concat(o/this.width,", ").concat(g/this.height,")"),this.renderer.resize(o,g),this.layersRect=this._layers.getBoundingClientRect()}appendTo(A){A.appendChild(this._root),this.relayout()}setup(){this.vm=new n.a,this.vm.setCompatibilityMode(!0),this.vm.setLocale(navigator.language),this.vm.on("MONITORS_UPDATE",this._onmonitorsupdate.bind(this)),this.vm.runtime.on("QUESTION",this._onquestion.bind(this)),this.vm.on("PROJECT_RUN_START",()=>this.dispatchEvent(new Event("PROJECT_RUN_START"))),this.vm.on("PROJECT_RUN_STOP",()=>this.dispatchEvent(new Event("PROJECT_RUN_STOP"))),this.usePackagedRuntime&&this.vm.convertToPackagedRuntime&&this.vm.convertToPackagedRuntime(),this.vm.setStageSize&&this.vm.setStageSize(this.width,this.height),this.vm.runtime.cloudOptions&&(this.vm.runtime.cloudOptions.limit=1/0),this.vm.on("STAGE_SIZE_CHANGED",(A,e)=>{this.width===A&&this.height===e||(this.width=A,this.height=e,this.relayout())}),this.cloudManager=new Y.CloudManager(this),this.renderer=new r.a(this._canvas,-this.width/2,this.width/2,-this.height/2,this.height/2),this.vm.attachRenderer(this.renderer),this.renderer.overlayContainer&&this._layers.insertBefore(this.renderer.overlayContainer,this._overlaysOuter),this.storage=new c,this.vm.attachStorage(this.storage),"undefined"!=typeof AudioContext||"undefined"!=typeof webkitAudioContext?(this.audioEngine=new E.a,this.vm.attachAudioEngine(this.audioEngine)):console.warn("AudioContext not supported. Sound will not work."),this.bitmapAdapter=new w.BitmapAdapter,this.vm.attachV2BitmapAdapter(this.bitmapAdapter),this.videoProvider=new d,this.vm.setVideoProvider(this.videoProvider)}async _connectPeripherals(){const A=A=>new Promise(e=>{const t=e=>{const t=Object.keys(e).map(A=>e[A]);if(t.length>0){const e=t[0];console.log("Connecting to peripheral",e),this.vm.connectPeripheral(A,e.peripheralId)}else console.error("No peripherals found for",A);B()},i=()=>{console.error("Peripheral scan timed out for",A),B()},B=()=>{this.vm.removeListener("PERIPHERAL_LIST_UPDATE",t),this.vm.removeListener("PERIPHERAL_SCAN_TIMEOUT",i),e()};this.vm.on("PERIPHERAL_LIST_UPDATE",t),this.vm.on("PERIPHERAL_SCAN_TIMEOUT",i),this.vm.scanForPeripheral(A)});for(const e of Object.keys(this.vm.runtime.peripheralExtensions))await A(e)}_onmonitorsupdate(A){for(const e of A.valueSeq()){const A=e.get("id");if(!this._monitors.has(A)){if(!e.get("visible"))continue;"list"===e.get("mode")?this._monitors.set(A,new x(this,e)):this._monitors.set(A,new R(this,e))}this._monitors.get(A).update(e)}}ask(A){return this._question=new N(this,A),this._question.answer()}_onquestion(A){this._question&&this._question.destroy(),null!==A&&this.ask(A).then(A=>{this.vm.runtime.emit("ANSWER",A)})}loadProject(A){return this.vm.loadProject(A).then(()=>{this.vm.setCloudProvider(this.cloudManager),this.cloudManager.projectReady(),this.renderer.draw(),setTimeout(()=>{this.renderer.draw()}),this.shouldConnectPeripherals&&this._connectPeripherals()})}setUsername(A){this._username=A,this.vm.postIOData("userData",{username:A})}addCloudProvider(A){this.cloudManager.addProvider(A)}addCloudProviderOverride(A,e){this.cloudManager.addProviderOverride(A,e)}addControlButton(A){let{element:e,where:t}=A;if("top-left"===t)this._topControls.addToStart(e);else{if("top-right"!==t)throw new Error("Unknown 'where': ".concat(t));this._topControls.addToEnd(e)}this.relayout()}getMessage(A){return this.messages[A]||A}setAccentColor(A){this._root.style.setProperty("--sc-accent-color",A),this._root.style.setProperty("--sc-accent-color-transparent","".concat(A,"59"))}start(){this.vm.start(),this.vm.greenFlag()}greenFlag(){this.start()}stopAll(){this.vm.stopAll()}_lookupVariable(A,e){const t=this.vm.runtime.getTargetForStage().lookupVariableByNameAndType(A,e);if(!t)throw new Error("Global ".concat(e||"variable"," does not exist: ").concat(A));return t}setExtensionSecurityManager(A){const e=this.vm.extensionManager.securityManager;if(e)for(const[t,i]of Object.entries(A))e[t]=j(i);else console.warn("setExtensionSecurityManager not supported: there is no security manager")}getVariable(A){return this._lookupVariable(A,"").value}setVariable(A,e){if(!T(e))throw new Error("Invalid variable value");this._lookupVariable(A,"").value=e}getList(A){return this._lookupVariable(A,"list").value}setList(A,e){if(!(A=>{if(!Array.isArray(A))return!1;for(let e=0;e</e||i></this.value.length){this.unfocusallrows();let></w&&(t&&(c.scale(-1,1),c.translate(-1*n,0)),c.drawimage(this._video,0,0,o,g,0,0,n,s),c.settransform(1,0,0,1,0,0),r.lastupdate=w),e[i]||(e[i]={lastupdate:0});const></a.length;t+=2)"thumbnail"!==string(a[t])&&(e[string(a[t])]=string(a[t+1]));return></a.length;t+=2)e.push([a[t],a[t+1]]);return></t.length;){a.writestruct(ja,{method:0});const></t;n++)i=(i+a[e+n])%65521,b=(b+i)%65521;return></e.size;a++)i.push(this.next().value)}if(null!==ra[t]||e></e.length;t+=2)e[t]=a[t+1],e[t+1]=a[t];return></a.length;e+=4){const></e}return></e;for(;e></e;a++){const></a);for(let></t;g++){b=-1;for(let></b;a++)t[n++]=s;break;case></t.length;a++)0!==t[a]&&(t[a]=4278190080|t[a]);return></t;b++)i=i></b.object_ref)return></t;b++)i[b]=d.read(a,e),e+=d.size;return></b;n++)t+=i*c.read(a,e++),i*=256;return></a;b++){const></t;i++)this.uint8a[this.position+i-e]=a[i];return></a){const></this.micdataarray.length;e++)a+=math.pow(this.micdataarray[e],2);let></i;a++)t+=string.fromcharcode(e[a]);return></e;)a=a.readuint8(),b=15&a,o=e[16*g+b],g+=s[b],g></c;){i=a.readint16(),g=a.readuint8(),a.position++,g></e.getlength()-8;){const></t.length;n++)e(t[n],i,b);else>
Download
This tool is currently unavailable
Leave a comment
Log in with itch.io to leave a comment.