/*!
Parts of this script are from the TurboWarp Packager <https://packager.turbowarp.org/>, licensed as follows:
Copyright (C) 2021-2024 Thomas Weber

The Source Code Form of this program is available under the terms of the
Mozilla Public License, v. 2.0. You can obtain a copy of the license at
https://www.mozilla.org/en-US/MPL/2.0/.

Parts of this script are from Scratch <https://scratch.mit.edu/>, licensed as follows:
Copyright (c) 2016, Massachusetts Institute of Technology
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/*! For license information please see scaffolding-min.js.LICENSE.txt */
!function(e){function t(t){for(var n,i,s=t[0],o=t[1],a=0,l=[];a<s.length;a++)i=s[a],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&l.push(r[i][0]),r[i]=0;for(n in o)Object.prototype.hasOwnProperty.call(o,n)&&(e[n]=o[n]);for(c&&c(t);l.length;)l.shift()()}var n={},r={0:0};function i(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,i),r.l=!0,r.exports}i.e=function(e){var t=[],n=r[e];if(0!==n)if(n)t.push(n[2]);else{var s=new Promise((function(t,i){n=r[e]=[t,i]}));t.push(n[2]=s);var o,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"scaffolding/"+({1:"vendors~iframe-extension-worker"}[e]||e)+".js"}(e);var c=new Error;o=function(t){a.onerror=a.onload=null,clearTimeout(l);var n=r[e];if(0!==n){if(n){var i=t&&("load"===t.type?"missing":t.type),s=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+i+": "+s+")",c.name="ChunkLoadError",c.type=i,c.request=s,n[1](c)}r[e]=void 0}};var l=setTimeout((function(){o({type:"timeout",target:a})}),12e4);a.onerror=a.onload=o,document.head.appendChild(a)}return Promise.all(t)},i.m=e,i.c=n,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i.oe=function(e){throw console.error(e),e};var s=window.webpackJsonp=window.webpackJsonp||[],o=s.push.bind(s);s.push=t,s=s.slice();for(var a=0;a<s.length;a++)t(s[a]);var c=o;i(i.s=300)}([function(e,t,n){const r=n(29);r.enable(),e.exports=r("vm")},function(e,t,n){const r=n(23),i=e=>{if("string"!=typeof e)return!1;for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(48===n||9===n)return!1}return!0};class s{static toNumber(e){if("number"==typeof e)return Number.isNaN(e)?0:e;const t=Number(e);return Number.isNaN(t)?0:t}static toBoolean(e){return"boolean"==typeof e?e:"string"==typeof e?""!==e&&"0"!==e&&"false"!==e.toLowerCase():Boolean(e)}static toString(e){return String(e)}static toRgbColorList(e){const t=s.toRgbColorObject(e);return[t.r,t.g,t.b]}static toRgbColorObject(e){let t;return"string"==typeof e&&"#"===e.substring(0,1)?(t=r.hexToRgb(e),t||(t={r:0,g:0,b:0,a:255})):t=r.decimalToRgb(s.toNumber(e)),t}static isWhiteSpace(e){return null===e||"string"==typeof e&&0===e.trim().length}static compare(e,t){let n=Number(e),r=Number(t);if(0===n&&i(e)?n=NaN:0===r&&i(t)&&(r=NaN),isNaN(n)||isNaN(r)){const n=String(e).toLowerCase(),r=String(t).toLowerCase();return n<r?-1:n>r?1:0}return n===1/0&&r===1/0||n===-1/0&&r===-1/0?0:n-r}static isInt(e){return"number"==typeof e?!!isNaN(e)||e===Math.floor(e):"boolean"==typeof e||"string"==typeof e&&e.indexOf(".")<0}static get LIST_INVALID(){return"INVALID"}static get LIST_ALL(){return"ALL"}static toListIndex(e,t,n){if("number"!=typeof e){if("all"===e)return n?s.LIST_ALL:s.LIST_INVALID;if("last"===e)return t>0?t:s.LIST_INVALID;if("random"===e||"any"===e)return t>0?1+Math.floor(Math.random()*t):s.LIST_INVALID}return(e=Math.floor(s.toNumber(e)))<1||e>t?s.LIST_INVALID:e}}e.exports=s},function(e,t){e.exports={BOOLEAN:"Boolean",BUTTON:"button",LABEL:"label",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter",XML:"xml"}},function(e,t){e.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image",COSTUME:"costume",SOUND:"sound"}},function(e,t){e.exports=class{static degToRad(e){return e*Math.PI/180}static radToDeg(e){return 180*e/Math.PI}static clamp(e,t,n){return Math.min(Math.max(e,t),n)}static wrapClamp(e,t,n){const r=n-t+1;return e-Math.floor((e-t)/r)*r}static tan(e){switch(e%=360){case-270:case 90:return 1/0;case-90:case 270:return-1/0;default:return Math.round(1e10*Math.tan(Math.PI*e/180))/1e10}}static reducedSortOrdering(e){const t=e.slice(0).sort(((e,t)=>e-t));return e.map((e=>t.indexOf(e)))}static inclusiveRandIntWithout(e,t,n){const r=t-e,i=e+Math.floor(Math.random()*r);return i>=n?i+1:i}static scale(e,t,n,r,i){return(e-t)/(n-t)*(i-r)+r}}},function(e,t,n){"use strict";var r=n(107),i=n(108),s=n(59),o=n(58),a=n(57);function c(e,t){return Object.keys(t).forEach((function(n){e[n]=t[n]})),e}e.exports=function e(){var t=c({},a),n="en",l={},u=function(e){return e},h=null,d="warning",p={};function f(e,t,s){var o="string"==typeof e?e:e.default,a=b(o,"object"==typeof e&&e.id||u(o),s||n);return(a.format||(a.format=i(r(a.message),s||n,p)))(t)}f.rich=function(e,t,s){var o="string"==typeof e?e:e.default,a=b(o,"object"==typeof e&&e.id||u(o),s||n);return(a.toParts||(a.toParts=i.toParts(r(a.message,{tagsType:m}),s||n,p)))(t)};var m="<>";function g(e,t){var n=e[2];return function(e,t){var r="object"==typeof n?function(e,t){return Object.keys(e).reduce((function(n,r){return n[r]=e[r](t),n}),{})}(n,t):n;return"function"==typeof e?e(r):e}}function b(e,t,n){var r=o(n,l)||"en",i=l[r]||(l[r]={}),s=i[t];if("string"==typeof s&&(s=i[t]={message:s}),!s){var a='Translation for "'+t+'" in "'+r+'" is missing';if("warning"===d)"undefined"!=typeof console&&console.warn(a);else if("ignore"!==d)throw new Error(a);var c="function"==typeof h?h(e,t,r)||e:h||e;s=i[t]={message:c}}return s}function y(e,t,r,i,a){"object"==typeof r&&"object"!=typeof i&&(a=i,i=r,r=0);var c=o(a||n,s),l=c&&s[c][e]||E;return i["="+ +t]||i[l(t-r)]||i.other}function E(){return"other"}return p[m]=g,f.setup=function(e){return(e=e||{}).locale&&(n=e.locale),"translations"in e&&(l=e.translations||{}),e.generateId&&(u=e.generateId),"missingReplacement"in e&&(h=e.missingReplacement),e.missingTranslation&&(d=e.missingTranslation),e.formats&&(e.formats.number&&c(t.number,e.formats.number),e.formats.date&&c(t.date,e.formats.date),e.formats.time&&c(t.time,e.formats.time)),e.types&&((p=e.types)[m]=g),{locale:n,translations:l,generateId:u,missingReplacement:h,missingTranslation:d,formats:t,types:p}},f.number=function(e,r,i){var s=r&&t.number[r]||t.parseNumberPattern(r)||t.number.default;return new Intl.NumberFormat(i||n,s).format(e)},f.date=function(e,r,i){var s=r&&t.date[r]||t.parseDatePattern(r)||t.date.default;return new Intl.DateTimeFormat(i||n,s).format(e)},f.time=function(e,r,i){var s=r&&t.time[r]||t.parseDatePattern(r)||t.time.default;return new Intl.DateTimeFormat(i||n,s).format(e)},f.select=function(e,t){return t[e]||t.other},f.custom=function(e,t,n,r){return e[1]in p?p[e[1]](e,t)(n,r):n},f.plural=y.bind(null,"cardinal"),f.selectordinal=y.bind(null,"ordinal"),f.namespace=e,f}()},function(e,t,n){const r=n(0);class i{static withoutTrailingDigits(e){let t=e.length-1;for(;t>=0&&"0123456789".indexOf(e.charAt(t))>-1;)t--;return e.slice(0,t+1)}static unusedName(e,t){if(t.indexOf(e)<0)return e;e=i.withoutTrailingDigits(e);let n=2;for(;t.indexOf(e+n)>=0;)n++;return e+n}static caseInsensitiveUnusedName(e,t){const n=e=>t.some((t=>t.toLowerCase()===e.toLowerCase()));if(!n(e))return e;e=i.withoutTrailingDigits(e);let r=2;for(;n("".concat(e).concat(r));)r++;return"".concat(e).concat(r)}static splitFirst(e,t){const n=e.indexOf(t);return n>=0?[e.substring(0,n),e.substring(n+1)]:[e,null]}static stringify(e){return JSON.stringify(e,((e,t)=>"number"!=typeof t||t!==1/0&&t!==-1/0&&!isNaN(t)?t:0))}static replaceUnsafeChars(e){if("string"!=typeof e){if(!Array.isArray(e))return r.error("Unexpected input recieved in replaceUnsafeChars"),e;e=String(e)}return e.replace(/[<>&'"]/g,(e=>{switch(e){case"<":return"lt";case">":return"gt";case"&":return"amp";case"'":return"apos";case'"':return"quot"}}))}}e.exports=i},function(e,t){const n="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";e.exports=function(){const e=n.length,t=[];for(let r=0;r<20;r++)t[r]=n.charAt(Math.random()*e);return t.join("")}},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){const r=n(7),i=n(31);class s{constructor(e,t,n,i){switch(this.id=e||r(),this.name=t,this.type=n,this.isCloud=i,this.type){case s.SCALAR_TYPE:this.value=0;break;case s.LIST_TYPE:this.value=[];break;case s.BROADCAST_MESSAGE_TYPE:this.value=this.name;break;default:throw new Error("Invalid variable type: ".concat(this.type))}}toXML(e){return e=!0===e,'<variable type="'.concat(this.type,'" id="').concat(this.id,'" islocal="').concat(e,'" iscloud="').concat(this.isCloud,'">').concat(i(this.name),"</variable>")}static get SCALAR_TYPE(){return""}static get LIST_TYPE(){return"list"}static get BROADCAST_MESSAGE_TYPE(){return"broadcast_msg"}}e.exports=s},function(e,t,n){const r=n(1),{InputOpcode:i,InputType:s}=n(15),o=n(0);class a{static getNumberInputType(e){if("number"!=typeof e)throw new Error("Expected a number.");return e===1/0?s.NUMBER_POS_INF:e===-1/0?s.NUMBER_NEG_INF:e<0?Number.isInteger(e)?s.NUMBER_NEG_INT:s.NUMBER_NEG_FRACT:e>0?Number.isInteger(e)?s.NUMBER_POS_INT:s.NUMBER_POS_FRACT:Number.isNaN(e)?s.NUMBER_NAN:Object.is(e,-0)?s.NUMBER_NEG_ZERO:s.NUMBER_ZERO}constructor(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];this.opcode=e,this.type=t,this.inputs=n,this.yields=r}isConstant(e){if(this.opcode!==i.CONSTANT)return!1;let t=this.inputs.value===e;return t||"number"!=typeof e||(t=+this.inputs.value===e),t}isAlwaysType(e){return(this.type&e)===this.type}isSometimesType(e){return!!(this.type&e)}toType(e){let t;switch(e){case s.BOOLEAN:t=i.CAST_BOOLEAN;break;case s.NUMBER:t=i.CAST_NUMBER;break;case s.NUMBER_INDEX:t=i.CAST_NUMBER_INDEX;break;case s.NUMBER_OR_NAN:t=i.CAST_NUMBER_OR_NAN;break;case s.STRING:t=i.CAST_STRING;break;case s.COLOR:t=i.CAST_COLOR;break;default:throw o.warn("Cannot cast to type: ".concat(e),this),new Error("Cannot cast to type: ".concat(e))}if(this.isAlwaysType(e))return this;if(this.opcode===i.CONSTANT){switch(t){case i.CAST_BOOLEAN:this.inputs.value=r.toBoolean(this.inputs.value),this.type=s.BOOLEAN;break;case i.CAST_NUMBER:case i.CAST_NUMBER_INDEX:case i.CAST_NUMBER_OR_NAN:{this.isAlwaysType(s.BOOLEAN_INTERPRETABLE)&&(this.type=s.NUMBER,this.inputs.value=+r.toBoolean(this.inputs.value));const e=+this.inputs.value;e?this.inputs.value=e:Object.is(e,-0)?this.inputs.value=-0:this.inputs.value=0,t===i.CAST_NUMBER_INDEX&&(this.inputs.value|=0),this.type=a.getNumberInputType(this.inputs.value);break}case i.CAST_STRING:this.inputs.value+="",this.type=s.STRING;break;case i.CAST_COLOR:this.inputs.value=r.toRgbColorList(this.inputs.value),this.type=s.COLOR}return this}return new a(t,e,{target:this})}}e.exports={IntermediateStackBlock:class{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.opcode=e,this.inputs=t,this.yields=n,this.ignoreState=!1,this.entryState=null,this.exitState=null}},IntermediateInput:a,IntermediateStack:class{constructor(e){this.blocks=null!=e?e:[]}},IntermediateScript:class{constructor(){this.topBlockId=null,this.stack=null,this.isProcedure=!1,this.procedureVariant="",this.procedureCode="",this.arguments=[],this.isWarp=!1,this.yields=!0,this.warpTimer=!1,this.dependedProcedures=[],this.cachedCompileResult=null,this.cachedAnalysisEndState=null,this.executableHat=!1}},IntermediateRepresentation:class{constructor(e,t){this.entry=e,this.procedures=t}getProcedure(e){return Object.values(this.procedures).find((t=>t.procedureCode===e))}},stringifyType:e=>{let t=[];for(const n in s){const r=s[n];if((r&e)===r){for(const e of t)s[e];t=t.filter((e=>(s[e]&r)!==s[e])),t.push(n)}}let n=null;for(const e of t)n=null===n?e:"".concat(n," | ").concat(e);return null===n?"INVALID":n}}},function(e,t,n){var r;"undefined"!=typeof self&&self,r=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:r})},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=9)}([function(e,t,n){"use strict";t.__esModule=!0,t.copyExistingProperties=function(e,t){Object.keys(t).forEach((function(n){t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&(t[n]=e[n])}))},t.copyNamedProperties=function(e,t,n){e.forEach((function(e){var r=t[e];void 0!==r&&(n[e]=r)}))},t.isBuffer=function(e,t){return o||(o=e.createBuffer()),t instanceof o.constructor},t.isRenderbuffer=function(e,t){return a||(a=e.createRenderbuffer()),t instanceof a.constructor},t.isShader=function(e,t){return c||(c=e.createShader(e.VERTEX_SHADER)),t instanceof c.constructor},t.isTexture=function(e,t){return l||(l=e.createTexture()),t instanceof l.constructor},t.isSampler=function(e,t){if(!u){if(!e.createSampler)return!1;u=e.createSampler()}return t instanceof u.constructor},t.warn=t.error=void 0;var r,i=(r=n(2))&&r.__esModule?r:{default:r},s=i.default.console&&i.default.console.error&&"function"==typeof i.default.console.error?i.default.console.error.bind(i.default.console):function(){};t.error=s;var o,a,c,l,u,h=i.default.console&&i.default.console.warn&&"function"==typeof i.default.console.warn?i.default.console.warn.bind(i.default.console):function(){};t.warn=h},function(e,t,n){"use strict";t.__esModule=!0,t.getGLTypeForTypedArray=function(e){if(e instanceof Int8Array)return s;if(e instanceof Uint8Array)return o;if(e instanceof Uint8ClampedArray)return o;if(e instanceof Int16Array)return a;if(e instanceof Uint16Array)return c;if(e instanceof Int32Array)return l;if(e instanceof Uint32Array)return u;if(e instanceof Float32Array)return h;throw"unsupported typed array type"},t.getGLTypeForTypedArrayType=function(e){if(e===Int8Array)return s;if(e===Uint8Array)return o;if(e===Uint8ClampedArray)return o;if(e===Int16Array)return a;if(e===Uint16Array)return c;if(e===Int32Array)return l;if(e===Uint32Array)return u;if(e===Float32Array)return h;throw"unsupported typed array type"},t.getTypedArrayTypeForGLType=function(e){var t=d[e];if(!t)throw"unknown gl type";return t},t.isArrayBuffer=void 0;var r,i=(r=n(2))&&r.__esModule?r:{default:r},s=5120,o=5121,a=5122,c=5123,l=5124,u=5125,h=5126,d={},p=d;p[s]=Int8Array,p[o]=Uint8Array,p[a]=Int16Array,p[c]=Uint16Array,p[l]=Int32Array,p[u]=Uint32Array,p[h]=Float32Array,p[32819]=Uint16Array,p[32820]=Uint16Array,p[33635]=Uint16Array,p[5131]=Uint16Array,p[33640]=Uint32Array,p[35899]=Uint32Array,p[35902]=Uint32Array,p[36269]=Uint32Array,p[34042]=Uint32Array;var f=i.default.SharedArrayBuffer?function(e){return e&&e.buffer&&(e.buffer instanceof ArrayBuffer||e.buffer instanceof i.default.SharedArrayBuffer)}:function(e){return e&&e.buffer&&e.buffer instanceof ArrayBuffer};t.isArrayBuffer=f},function(e,t,n){"use strict";t.__esModule=!0,t.default=void 0;var r=void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};t.default=r},function(e,t,n){"use strict";t.__esModule=!0,t.add=function(e,t,n){return(n=n||new r(3))[0]=e[0]+t[0],n[1]=e[1]+t[1],n[2]=e[2]+t[2],n},t.copy=function(e,t){return(t=t||new r(3))[0]=e[0],t[1]=e[1],t[2]=e[2],t},t.create=function(e,t,n){var i=new r(3);return e&&(i[0]=e),t&&(i[1]=t),n&&(i[2]=n),i},t.cross=function(e,t,n){n=n||new r(3);var i=e[2]*t[0]-e[0]*t[2],s=e[0]*t[1]-e[1]*t[0];return n[0]=e[1]*t[2]-e[2]*t[1],n[1]=i,n[2]=s,n},t.distance=function(e,t){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return Math.sqrt(n*n+r*r+i*i)},t.distanceSq=function(e,t){var n=e[0]-t[0],r=e[1]-t[1],i=e[2]-t[2];return n*n+r*r+i*i},t.divide=function(e,t,n){return(n=n||new r(3))[0]=e[0]/t[0],n[1]=e[1]/t[1],n[2]=e[2]/t[2],n},t.divScalar=function(e,t,n){return(n=n||new r(3))[0]=e[0]/t,n[1]=e[1]/t,n[2]=e[2]/t,n},t.dot=function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]},t.lerp=function(e,t,n,i){return(i=i||new r(3))[0]=(1-n)*e[0]+n*t[0],i[1]=(1-n)*e[1]+n*t[1],i[2]=(1-n)*e[2]+n*t[2],i},t.length=function(e){return Math.sqrt(e[0]*e[0]+e[1]*e[1]+e[2]*e[2])},t.lengthSq=function(e){return e[0]*e[0]+e[1]*e[1]+e[2]*e[2]},t.mulScalar=function(e,t,n){return(n=n||new r(3))[0]=e[0]*t,n[1]=e[1]*t,n[2]=e[2]*t,n},t.multiply=function(e,t,n){return(n=n||new r(3))[0]=e[0]*t[0],n[1]=e[1]*t[1],n[2]=e[2]*t[2],n},t.negate=function(e,t){return(t=t||new r(3))[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t},t.normalize=function(e,t){t=t||new r(3);var n=e[0]*e[0]+e[1]*e[1]+e[2]*e[2],i=Math.sqrt(n);return i>1e-5?(t[0]=e[0]/i,t[1]=e[1]/i,t[2]=e[2]/i):(t[0]=0,t[1]=0,t[2]=0),t},t.setDefaultType=function(e){var t=r;return r=e,t},t.subtract=function(e,t,n){return(n=n||new r(3))[0]=e[0]-t[0],n[1]=e[1]-t[1],n[2]=e[2]-t[2],n};var r=Float32Array},function(e,t,n){"use strict";t.__esModule=!0,t.isWebGL1=function(e){return!e.texStorage2D},t.isWebGL2=function(e){return!!e.texStorage2D},t.glEnumToString=void 0;var r,i,s=(r={},i={},function(e,t){return function(e){var t=e.constructor.name;if(!r[t]){for(var n in e)if("number"==typeof e[n]){var s=i[e[n]];i[e[n]]=s?"".concat(s," | ").concat(n):n}r[t]=!0}}(e),i[t]||"0x"+t.toString(16)});t.glEnumToString=s},function(e,t,n){"use strict";t.__esModule=!0,t.createAttributeSetters=W,t.createProgram=L,t.createProgramFromScripts=function(e,t,n,r,i){for(var s=M(n,r,i),o=[],a=0;a<t.length;++a){var c=B(e,t[a],e[C[a]],s.errorCallback);if(!c)return null;o.push(c)}return L(e,o,s)},t.createProgramFromSources=U,t.createProgramInfo=function(e,t,n,r,i){var s=M(n,r,i),o=!0;if(t=t.map((function(e){if(e.indexOf("\n")<0){var t=u(e);t?e=t.text:(s.errorCallback("no element with id: "+e),o=!1)}return e})),!o)return null;var a=U(e,t,s);return a?X(e,a):null},t.createProgramInfoFromProgram=X,t.createUniformSetters=j,t.createUniformBlockSpecFromProgram=V,t.createUniformBlockInfoFromProgram=Y,t.createUniformBlockInfo=function(e,t,n){return Y(e,t.program,t.uniformBlockSpec,n)},t.createTransformFeedback=function(e,t,n){var r=e.createTransformFeedback();return e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,r),e.useProgram(t.program),G(e,t,n),e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null),function(e,t,n){for(var r in t.transformFeedbackInfo&&(t=t.transformFeedbackInfo),n.attribs&&(n=n.attribs),n){var i=t[r];i&&e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,i.index,null)}}(e,t,n),r},t.createTransformFeedbackInfo=z,t.bindTransformFeedbackInfo=G,t.setAttributes=K,t.setBuffersAndAttributes=function(e,t,n){n.vertexArrayObject?e.bindVertexArray(n.vertexArrayObject):(K(t.attribSetters||t,n.attribs),n.indices&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,n.indices))},t.setUniforms=function e(t,n){for(var r=t.uniformSetters||t,i=arguments.length,s=1;s<i;++s){var o=arguments[s];if(Array.isArray(o))for(var a=o.length,c=0;c<a;++c)e(r,o[c]);else for(var l in o){var u=r[l];u&&u(o[l])}}},t.setUniformBlock=function(e,t,n){H(e,t,n)&&e.bufferData(e.UNIFORM_BUFFER,n.array,e.DYNAMIC_DRAW)},t.setBlockUniforms=function(e,t){var n=e.uniforms;for(var r in t){var i=n[r];if(i){var s=t[r];s.length?i.set(s):i[0]=s}}},t.bindUniformBlock=H;var r,i=a(n(4)),s=a(n(0)),o=(r=n(2))&&r.__esModule?r:{default:r};function a(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}var c=s.error,l=s.warn,u=o.default&&o.default.document&&o.default.document.getElementById?o.default.document.getElementById.bind(o.default.document):function(){return null},h=3553,d=34067,p=32879,f=35866,m={};function g(e,t){return m[t].bindPoint}function b(e,t){return function(n){e.uniform1i(t,n)}}function y(e,t){return function(n){e.uniform1iv(t,n)}}function E(e,t){return function(n){e.uniform2iv(t,n)}}function T(e,t){return function(n){e.uniform3iv(t,n)}}function v(e,t){return function(n){e.uniform4iv(t,n)}}function A(e,t,n,r){var o=g(0,t);return i.isWebGL2(e)?function(t){var i,a;s.isTexture(e,t)?(i=t,a=null):(i=t.texture,a=t.sampler),e.uniform1i(r,n),e.activeTexture(e.TEXTURE0+n),e.bindTexture(o,i),e.bindSampler(n,a)}:function(t){e.uniform1i(r,n),e.activeTexture(e.TEXTURE0+n),e.bindTexture(o,t)}}function w(e,t,n,r,o){for(var a=g(0,t),c=new Int32Array(o),l=0;l<o;++l)c[l]=n+l;return i.isWebGL2(e)?function(t){e.uniform1iv(r,c),t.forEach((function(t,r){var i,o;e.activeTexture(e.TEXTURE0+c[r]),s.isTexture(e,t)?(i=t,o=null):(i=t.texture,o=t.sampler),e.bindSampler(n,o),e.bindTexture(a,i)}))}:function(t){e.uniform1iv(r,c),t.forEach((function(t,n){e.activeTexture(e.TEXTURE0+c[n]),e.bindTexture(a,t)}))}}function S(e,t){return function(n){e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.enableVertexAttribArray(t),e.vertexAttribPointer(t,n.numComponents||n.size,n.type||e.FLOAT,n.normalize||!1,n.stride||0,n.offset||0),void 0!==n.divisor&&e.vertexAttribDivisor(t,n.divisor)}}function k(e,t){return function(n){e.bindBuffer(e.ARRAY_BUFFER,n.buffer),e.enableVertexAttribArray(t),e.vertexAttribIPointer(t,n.numComponents||n.size,n.type||e.INT,n.stride||0,n.offset||0),void 0!==n.divisor&&e.vertexAttribDivisor(t,n.divisor)}}function O(e,t,n){var r=n.size,i=n.count;return function(n){e.bindBuffer(e.ARRAY_BUFFER,n.buffer);for(var s=n.size||n.numComponents||r,o=s/i,a=n.type||e.FLOAT,c=m[a].size*s,l=n.normalize||!1,u=n.offset||0,h=c/i,d=0;d<i;++d)e.enableVertexAttribArray(t+d),e.vertexAttribPointer(t+d,o,a,l,c,u+h*d),void 0!==n.divisor&&e.vertexAttribDivisor(t+d,n.divisor)}}m[5126]={Type:Float32Array,size:4,setter:function(e,t){return function(n){e.uniform1f(t,n)}},arraySetter:function(e,t){return function(n){e.uniform1fv(t,n)}}},m[35664]={Type:Float32Array,size:8,setter:function(e,t){return function(n){e.uniform2fv(t,n)}}},m[35665]={Type:Float32Array,size:12,setter:function(e,t){return function(n){e.uniform3fv(t,n)}}},m[35666]={Type:Float32Array,size:16,setter:function(e,t){return function(n){e.uniform4fv(t,n)}}},m[5124]={Type:Int32Array,size:4,setter:b,arraySetter:y},m[35667]={Type:Int32Array,size:8,setter:E},m[35668]={Type:Int32Array,size:12,setter:T},m[35669]={Type:Int32Array,size:16,setter:v},m[5125]={Type:Uint32Array,size:4,setter:function(e,t){return function(n){e.uniform1ui(t,n)}},arraySetter:function(e,t){return function(n){e.uniform1uiv(t,n)}}},m[36294]={Type:Uint32Array,size:8,setter:function(e,t){return function(n){e.uniform2uiv(t,n)}}},m[36295]={Type:Uint32Array,size:12,setter:function(e,t){return function(n){e.uniform3uiv(t,n)}}},m[36296]={Type:Uint32Array,size:16,setter:function(e,t){return function(n){e.uniform4uiv(t,n)}}},m[35670]={Type:Uint32Array,size:4,setter:b,arraySetter:y},m[35671]={Type:Uint32Array,size:8,setter:E},m[35672]={Type:Uint32Array,size:12,setter:T},m[35673]={Type:Uint32Array,size:16,setter:v},m[35674]={Type:Float32Array,size:16,setter:function(e,t){return function(n){e.uniformMatrix2fv(t,!1,n)}}},m[35675]={Type:Float32Array,size:36,setter:function(e,t){return function(n){e.uniformMatrix3fv(t,!1,n)}}},m[35676]={Type:Float32Array,size:64,setter:function(e,t){return function(n){e.uniformMatrix4fv(t,!1,n)}}},m[35685]={Type:Float32Array,size:24,setter:function(e,t){return function(n){e.uniformMatrix2x3fv(t,!1,n)}}},m[35686]={Type:Float32Array,size:32,setter:function(e,t){return function(n){e.uniformMatrix2x4fv(t,!1,n)}}},m[35687]={Type:Float32Array,size:24,setter:function(e,t){return function(n){e.uniformMatrix3x2fv(t,!1,n)}}},m[35688]={Type:Float32Array,size:48,setter:function(e,t){return function(n){e.uniformMatrix3x4fv(t,!1,n)}}},m[35689]={Type:Float32Array,size:32,setter:function(e,t){return function(n){e.uniformMatrix4x2fv(t,!1,n)}}},m[35690]={Type:Float32Array,size:48,setter:function(e,t){return function(n){e.uniformMatrix4x3fv(t,!1,n)}}},m[35678]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:h},m[35680]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:d},m[35679]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:p},m[35682]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:h},m[36289]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:f},m[36292]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:f},m[36293]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:d},m[36298]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:h},m[36299]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:p},m[36300]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:d},m[36303]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:f},m[36306]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:h},m[36307]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:p},m[36308]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:d},m[36311]={Type:null,size:0,setter:A,arraySetter:w,bindPoint:f};var I={};I[5126]={size:4,setter:S},I[35664]={size:8,setter:S},I[35665]={size:12,setter:S},I[35666]={size:16,setter:S},I[5124]={size:4,setter:k},I[35667]={size:8,setter:k},I[35668]={size:12,setter:k},I[35669]={size:16,setter:k},I[5125]={size:4,setter:k},I[36294]={size:8,setter:k},I[36295]={size:12,setter:k},I[36296]={size:16,setter:k},I[35670]={size:4,setter:k},I[35671]={size:8,setter:k},I[35672]={size:12,setter:k},I[35673]={size:16,setter:k},I[35674]={size:4,setter:O,count:2},I[35675]={size:9,setter:O,count:3},I[35676]={size:16,setter:O,count:4};var N=void 0,R=/^[ \t]*\n/;function x(e,t,n,r){var i=r||c,s=e.createShader(n),o=0;if(R.test(t)&&(o=1,t=t.replace(R,"")),e.shaderSource(s,t),e.compileShader(s),!e.getShaderParameter(s,e.COMPILE_STATUS)){var a=e.getShaderInfoLog(s);return i(function(e,t){return t=t||0,++t,e.split("\n").map((function(e,n){return n+t+": "+e})).join("\n")}(t,o)+"\n*** Error compiling shader: "+a),e.deleteShader(s),null}return s}function M(e,t,n){var r;if("function"==typeof t&&(n=t,t=void 0),"function"==typeof e)n=e,e=void 0;else if(e&&!Array.isArray(e)){if(e.errorCallback)return e;var i=e;n=i.errorCallback,e=i.attribLocations,r=i.transformFeedbackVaryings}var s={errorCallback:n||c,transformFeedbackVaryings:r};if(e){var o={};Array.isArray(e)?e.forEach((function(e,n){o[e]=t?t[n]:n})):o=e,s.attribLocations=o}return s}var C=["VERTEX_SHADER","FRAGMENT_SHADER"];function P(e){return e.indexOf("frag")>=0?N.FRAGMENT_SHADER:e.indexOf("vert")>=0?N.VERTEX_SHADER:void 0}function D(e,t){t.forEach((function(t){e.deleteShader(t)}))}function L(e,t,n,r,i){for(var o=M(n,r,i),a=[],c=[],l=0;l<t.length;++l){var h=t[l];if("string"==typeof h){var d=u(h),p=d?d.text:h,f=e[C[l]];d&&d.type&&(f=P(d.type)||f),h=x(e,p,f,o.errorCallback),c.push(h)}s.isShader(e,h)&&a.push(h)}if(a.length!==t.length)return o.errorCallback("not enough shaders for program"),D(e,c),null;var m=e.createProgram();a.forEach((function(t){e.attachShader(m,t)})),o.attribLocations&&Object.keys(o.attribLocations).forEach((function(t){e.bindAttribLocation(m,o.attribLocations[t],t)}));var g=o.transformFeedbackVaryings;if(g&&(g.attribs&&(g=g.attribs),Array.isArray(g)||(g=Object.keys(g)),e.transformFeedbackVaryings(m,g,o.transformFeedbackMode||e.SEPARATE_ATTRIBS)),e.linkProgram(m),!e.getProgramParameter(m,e.LINK_STATUS)){var b=e.getProgramInfoLog(m);return o.errorCallback("Error in program linking:"+b),e.deleteProgram(m),D(e,c),null}return m}function B(e,t,n,r){var i,s=u(t);if(!s)throw"*** Error: unknown script element"+t;i=s.text;var o=n||P(s.type);if(!o)throw"*** Error: unknown shader type";return x(e,i,o,r)}function U(e,t,n,r,i){for(var s=M(n,r,i),o=[],a=0;a<t.length;++a){var c=x(e,t[a],e[C[a]],s.errorCallback);if(!c)return null;o.push(c)}return L(e,o,s)}function F(e){var t=e.name;return t.startsWith("gl_")||t.startsWith("webgl_")}function j(e,t){var n=0;function r(t,r){var i,s=e.getUniformLocation(t,r.name),o=r.size>1&&"[0]"===r.name.substr(-3),a=r.type,c=m[a];if(!c)throw"unknown type: 0x"+a.toString(16);if(c.bindPoint){var l=n;n+=r.size,i=o?c.arraySetter(e,a,l,s,r.size):c.setter(e,a,l,s,r.size)}else i=c.arraySetter&&o?c.arraySetter(e,s):c.setter(e,s);return i.location=s,i}for(var i={},s=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),o=0;o<s;++o){var a=e.getActiveUniform(t,o);if(!F(a)){var c=a.name;"[0]"===c.substr(-3)&&(c=c.substr(0,c.length-3));var l=r(t,a);i[c]=l}}return i}function z(e,t){for(var n={},r=e.getProgramParameter(t,e.TRANSFORM_FEEDBACK_VARYINGS),i=0;i<r;++i){var s=e.getTransformFeedbackVarying(t,i);n[s.name]={index:i,type:s.type,size:s.size}}return n}function G(e,t,n){for(var r in t.transformFeedbackInfo&&(t=t.transformFeedbackInfo),n.attribs&&(n=n.attribs),n){var i=t[r];if(i){var s=n[r];s.offset?e.bindBufferRange(e.TRANSFORM_FEEDBACK_BUFFER,i.index,s.buffer,s.offset,s.size):e.bindBufferBase(e.TRANSFORM_FEEDBACK_BUFFER,i.index,s.buffer)}}}function V(e,t){for(var n=e.getProgramParameter(t,e.ACTIVE_UNIFORMS),r=[],i=[],s=0;s<n;++s){i.push(s),r.push({});var o=e.getActiveUniform(t,s);if(F(o))break;r[s].name=o.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach((function(n){var s=n[0],o=n[1];e.getActiveUniforms(t,i,e[s]).forEach((function(e,t){r[t][o]=e}))}));for(var a={},c=e.getProgramParameter(t,e.ACTIVE_UNIFORM_BLOCKS),l=0;l<c;++l){var u=e.getActiveUniformBlockName(t,l),h={index:l,usedByVertexShader:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),usedByFragmentShader:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),size:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_DATA_SIZE),uniformIndices:e.getActiveUniformBlockParameter(t,l,e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES)};h.used=h.usedByVertexSahder||h.usedByFragmentShader,a[u]=h}return{blockSpecs:a,uniformData:r}}var _=/\[\d+\]\.$/;function Y(e,t,n,r){var i=n.blockSpecs,s=n.uniformData,o=i[r];if(!o)return l("no uniform block object named:",r),{name:r,uniforms:{}};var a=new ArrayBuffer(o.size),c=e.createBuffer(),u=o.index;e.bindBuffer(e.UNIFORM_BUFFER,c),e.uniformBlockBinding(t,o.index,u);var h=r+".";_.test(h)&&(h=h.replace(_,"."));var d={};return o.uniformIndices.forEach((function(e){var t=s[e],n=m[t.type],r=n.Type,i=t.size*n.size,o=t.name;o.substr(0,h.length)===h&&(o=o.substr(h.length)),d[o]=new r(a,t.offset,i/r.BYTES_PER_ELEMENT)})),{name:r,array:a,asFloat:new Float32Array(a),buffer:c,uniforms:d}}function H(e,t,n){var r=(t.uniformBlockSpec||t).blockSpecs[n.name];if(r){var i=r.index;return e.bindBufferRange(e.UNIFORM_BUFFER,i,n.buffer,n.offset||0,n.array.byteLength),!0}return!1}function W(e,t){for(var n={},r=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),i=0;i<r;++i){var s=e.getActiveAttrib(t,i);if(!F(s)){var o=e.getAttribLocation(t,s.name),a=I[s.type],c=a.setter(e,o,a);c.location=o,n[s.name]=c}}return n}function K(e,t){for(var n in t){var r=e[n];r&&r(t[n])}}function X(e,t){var n={program:t,uniformSetters:j(e,t),attribSetters:W(e,t)};return i.isWebGL2(e)&&(n.uniformBlockSpec=V(e,t),n.transformFeedbackInfo=z(e,t)),n}},function(e,t,n){"use strict";t.__esModule=!0,t.axisRotate=function(e,t,n,r){r=r||new i(16);var s=t[0],o=t[1],a=t[2],c=Math.sqrt(s*s+o*o+a*a),l=(s/=c)*s,u=(o/=c)*o,h=(a/=c)*a,d=Math.cos(n),p=Math.sin(n),f=1-d,m=l+(1-l)*d,g=s*o*f+a*p,b=s*a*f-o*p,y=s*o*f-a*p,E=u+(1-u)*d,T=o*a*f+s*p,v=s*a*f+o*p,A=o*a*f-s*p,w=h+(1-h)*d,S=e[0],k=e[1],O=e[2],I=e[3],N=e[4],R=e[5],x=e[6],M=e[7],C=e[8],P=e[9],D=e[10],L=e[11];return r[0]=m*S+g*N+b*C,r[1]=m*k+g*R+b*P,r[2]=m*O+g*x+b*D,r[3]=m*I+g*M+b*L,r[4]=y*S+E*N+T*C,r[5]=y*k+E*R+T*P,r[6]=y*O+E*x+T*D,r[7]=y*I+E*M+T*L,r[8]=v*S+A*N+w*C,r[9]=v*k+A*R+w*P,r[10]=v*O+A*x+w*D,r[11]=v*I+A*M+w*L,e!==r&&(r[12]=e[12],r[13]=e[13],r[14]=e[14],r[15]=e[15]),r},t.axisRotation=function(e,t,n){n=n||new i(16);var r=e[0],s=e[1],o=e[2],a=Math.sqrt(r*r+s*s+o*o),c=(r/=a)*r,l=(s/=a)*s,u=(o/=a)*o,h=Math.cos(t),d=Math.sin(t),p=1-h;return n[0]=c+(1-c)*h,n[1]=r*s*p+o*d,n[2]=r*o*p-s*d,n[3]=0,n[4]=r*s*p-o*d,n[5]=l+(1-l)*h,n[6]=s*o*p+r*d,n[7]=0,n[8]=r*o*p+s*d,n[9]=s*o*p-r*d,n[10]=u+(1-u)*h,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},t.copy=c,t.frustum=function(e,t,n,r,s,o,a){a=a||new i(16);var c=t-e,l=r-n,u=s-o;return a[0]=2*s/c,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*s/l,a[6]=0,a[7]=0,a[8]=(e+t)/c,a[9]=(r+n)/l,a[10]=o/u,a[11]=-1,a[12]=0,a[13]=0,a[14]=s*o/u,a[15]=0,a},t.getAxis=function(e,t,n){n=n||r.create();var i=4*t;return n[0]=e[i+0],n[1]=e[i+1],n[2]=e[i+2],n},t.getTranslation=function(e,t){return(t=t||r.create())[0]=e[12],t[1]=e[13],t[2]=e[14],t},t.identity=l,t.inverse=u,t.lookAt=function(e,t,n,c){c=c||new i(16);var l=s,u=o,h=a;return r.normalize(r.subtract(e,t,h),h),r.normalize(r.cross(n,h,l),l),r.normalize(r.cross(h,l,u),u),c[0]=l[0],c[1]=l[1],c[2]=l[2],c[3]=0,c[4]=u[0],c[5]=u[1],c[6]=u[2],c[7]=0,c[8]=h[0],c[9]=h[1],c[10]=h[2],c[11]=0,c[12]=e[0],c[13]=e[1],c[14]=e[2],c[15]=1,c},t.multiply=function(e,t,n){n=n||new i(16);var r=e[0],s=e[1],o=e[2],a=e[3],c=e[4],l=e[5],u=e[6],h=e[7],d=e[8],p=e[9],f=e[10],m=e[11],g=e[12],b=e[13],y=e[14],E=e[15],T=t[0],v=t[1],A=t[2],w=t[3],S=t[4],k=t[5],O=t[6],I=t[7],N=t[8],R=t[9],x=t[10],M=t[11],C=t[12],P=t[13],D=t[14],L=t[15];return n[0]=r*T+c*v+d*A+g*w,n[1]=s*T+l*v+p*A+b*w,n[2]=o*T+u*v+f*A+y*w,n[3]=a*T+h*v+m*A+E*w,n[4]=r*S+c*k+d*O+g*I,n[5]=s*S+l*k+p*O+b*I,n[6]=o*S+u*k+f*O+y*I,n[7]=a*S+h*k+m*O+E*I,n[8]=r*N+c*R+d*x+g*M,n[9]=s*N+l*R+p*x+b*M,n[10]=o*N+u*R+f*x+y*M,n[11]=a*N+h*R+m*x+E*M,n[12]=r*C+c*P+d*D+g*L,n[13]=s*C+l*P+p*D+b*L,n[14]=o*C+u*P+f*D+y*L,n[15]=a*C+h*P+m*D+E*L,n},t.negate=function(e,t){return(t=t||new i(16))[0]=-e[0],t[1]=-e[1],t[2]=-e[2],t[3]=-e[3],t[4]=-e[4],t[5]=-e[5],t[6]=-e[6],t[7]=-e[7],t[8]=-e[8],t[9]=-e[9],t[10]=-e[10],t[11]=-e[11],t[12]=-e[12],t[13]=-e[13],t[14]=-e[14],t[15]=-e[15],t},t.ortho=function(e,t,n,r,s,o,a){return(a=a||new i(16))[0]=2/(t-e),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(r-n),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2/(s-o),a[11]=0,a[12]=(t+e)/(e-t),a[13]=(r+n)/(n-r),a[14]=(o+s)/(s-o),a[15]=1,a},t.perspective=function(e,t,n,r,s){s=s||new i(16);var o=Math.tan(.5*Math.PI-.5*e),a=1/(n-r);return s[0]=o/t,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=o,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=(n+r)*a,s[11]=-1,s[12]=0,s[13]=0,s[14]=n*r*a*2,s[15]=0,s},t.rotateX=function(e,t,n){n=n||new i(16);var r=e[4],s=e[5],o=e[6],a=e[7],c=e[8],l=e[9],u=e[10],h=e[11],d=Math.cos(t),p=Math.sin(t);return n[4]=d*r+p*c,n[5]=d*s+p*l,n[6]=d*o+p*u,n[7]=d*a+p*h,n[8]=d*c-p*r,n[9]=d*l-p*s,n[10]=d*u-p*o,n[11]=d*h-p*a,e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n},t.rotateY=function(e,t,n){n=n||new i(16);var r=e[0],s=e[1],o=e[2],a=e[3],c=e[8],l=e[9],u=e[10],h=e[11],d=Math.cos(t),p=Math.sin(t);return n[0]=d*r-p*c,n[1]=d*s-p*l,n[2]=d*o-p*u,n[3]=d*a-p*h,n[8]=d*c+p*r,n[9]=d*l+p*s,n[10]=d*u+p*o,n[11]=d*h+p*a,e!==n&&(n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n},t.rotateZ=function(e,t,n){n=n||new i(16);var r=e[0],s=e[1],o=e[2],a=e[3],c=e[4],l=e[5],u=e[6],h=e[7],d=Math.cos(t),p=Math.sin(t);return n[0]=d*r+p*c,n[1]=d*s+p*l,n[2]=d*o+p*u,n[3]=d*a+p*h,n[4]=d*c-p*r,n[5]=d*l-p*s,n[6]=d*u-p*o,n[7]=d*h-p*a,e!==n&&(n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11],n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n},t.rotationX=function(e,t){t=t||new i(16);var n=Math.cos(e),r=Math.sin(e);return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=n,t[6]=r,t[7]=0,t[8]=0,t[9]=-r,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.rotationY=function(e,t){t=t||new i(16);var n=Math.cos(e),r=Math.sin(e);return t[0]=n,t[1]=0,t[2]=-r,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=r,t[9]=0,t[10]=n,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.rotationZ=function(e,t){t=t||new i(16);var n=Math.cos(e),r=Math.sin(e);return t[0]=n,t[1]=r,t[2]=0,t[3]=0,t[4]=-r,t[5]=n,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.scale=function(e,t,n){n=n||new i(16);var r=t[0],s=t[1],o=t[2];return n[0]=r*e[0],n[1]=r*e[1],n[2]=r*e[2],n[3]=r*e[3],n[4]=s*e[4],n[5]=s*e[5],n[6]=s*e[6],n[7]=s*e[7],n[8]=o*e[8],n[9]=o*e[9],n[10]=o*e[10],n[11]=o*e[11],e!==n&&(n[12]=e[12],n[13]=e[13],n[14]=e[14],n[15]=e[15]),n},t.scaling=function(e,t){return(t=t||new i(16))[0]=e[0],t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=e[1],t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=e[2],t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t},t.setAxis=function(e,t,n,r){r!==e&&(r=c(e,r));var i=4*n;return r[i+0]=t[0],r[i+1]=t[1],r[i+2]=t[2],r},t.setDefaultType=function(e){var t=i;return i=e,t},t.setTranslation=function(e,t,n){return n=n||l(),e!==n&&(n[0]=e[0],n[1]=e[1],n[2]=e[2],n[3]=e[3],n[4]=e[4],n[5]=e[5],n[6]=e[6],n[7]=e[7],n[8]=e[8],n[9]=e[9],n[10]=e[10],n[11]=e[11]),n[12]=t[0],n[13]=t[1],n[14]=t[2],n[15]=1,n},t.transformDirection=function(e,t,n){n=n||r.create();var i=t[0],s=t[1],o=t[2];return n[0]=i*e[0]+s*e[4]+o*e[8],n[1]=i*e[1]+s*e[5]+o*e[9],n[2]=i*e[2]+s*e[6]+o*e[10],n},t.transformNormal=function(e,t,n){n=n||r.create();var i=u(e),s=t[0],o=t[1],a=t[2];return n[0]=s*i[0]+o*i[1]+a*i[2],n[1]=s*i[4]+o*i[5]+a*i[6],n[2]=s*i[8]+o*i[9]+a*i[10],n},t.transformPoint=function(e,t,n){n=n||r.create();var i=t[0],s=t[1],o=t[2],a=i*e[3]+s*e[7]+o*e[11]+e[15];return n[0]=(i*e[0]+s*e[4]+o*e[8]+e[12])/a,n[1]=(i*e[1]+s*e[5]+o*e[9]+e[13])/a,n[2]=(i*e[2]+s*e[6]+o*e[10]+e[14])/a,n},t.translate=function(e,t,n){n=n||new i(16);var r=t[0],s=t[1],o=t[2],a=e[0],c=e[1],l=e[2],u=e[3],h=e[4],d=e[5],p=e[6],f=e[7],m=e[8],g=e[9],b=e[10],y=e[11],E=e[12],T=e[13],v=e[14],A=e[15];return e!==n&&(n[0]=a,n[1]=c,n[2]=l,n[3]=u,n[4]=h,n[5]=d,n[6]=p,n[7]=f,n[8]=m,n[9]=g,n[10]=b,n[11]=y),n[12]=a*r+h*s+m*o+E,n[13]=c*r+d*s+g*o+T,n[14]=l*r+p*s+b*o+v,n[15]=u*r+f*s+y*o+A,n},t.translation=function(e,t){return(t=t||new i(16))[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e[0],t[13]=e[1],t[14]=e[2],t[15]=1,t},t.transpose=function(e,t){var n;if((t=t||new i(16))===e)return n=e[1],e[1]=e[4],e[4]=n,n=e[2],e[2]=e[8],e[8]=n,n=e[3],e[3]=e[12],e[12]=n,n=e[6],e[6]=e[9],e[9]=n,n=e[7],e[7]=e[13],e[13]=n,n=e[11],e[11]=e[14],e[14]=n,t;var r=e[0],s=e[1],o=e[2],a=e[3],c=e[4],l=e[5],u=e[6],h=e[7],d=e[8],p=e[9],f=e[10],m=e[11],g=e[12],b=e[13],y=e[14],E=e[15];return t[0]=r,t[1]=c,t[2]=d,t[3]=g,t[4]=s,t[5]=l,t[6]=p,t[7]=b,t[8]=o,t[9]=u,t[10]=f,t[11]=y,t[12]=a,t[13]=h,t[14]=m,t[15]=E,t};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}(n(3)),i=Float32Array,s=r.create(),o=r.create(),a=r.create();function c(e,t){return(t=t||new i(16))[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15],t}function l(e){return(e=e||new i(16))[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e}function u(e,t){t=t||new i(16);var n=e[0],r=e[1],s=e[2],o=e[3],a=e[4],c=e[5],l=e[6],u=e[7],h=e[8],d=e[9],p=e[10],f=e[11],m=e[12],g=e[13],b=e[14],y=e[15],E=p*y,T=b*f,v=l*y,A=b*u,w=l*f,S=p*u,k=s*y,O=b*o,I=s*f,N=p*o,R=s*u,x=l*o,M=h*g,C=m*d,P=a*g,D=m*c,L=a*d,B=h*c,U=n*g,F=m*r,j=n*d,z=h*r,G=n*c,V=a*r,_=E*c+A*d+w*g-(T*c+v*d+S*g),Y=T*r+k*d+N*g-(E*r+O*d+I*g),H=v*r+O*c+R*g-(A*r+k*c+x*g),W=S*r+I*c+x*d-(w*r+N*c+R*d),K=1/(n*_+a*Y+h*H+m*W);return t[0]=K*_,t[1]=K*Y,t[2]=K*H,t[3]=K*W,t[4]=K*(T*a+v*h+S*m-(E*a+A*h+w*m)),t[5]=K*(E*n+O*h+I*m-(T*n+k*h+N*m)),t[6]=K*(A*n+k*a+x*m-(v*n+O*a+R*m)),t[7]=K*(w*n+N*a+R*h-(S*n+I*a+x*h)),t[8]=K*(M*u+D*f+L*y-(C*u+P*f+B*y)),t[9]=K*(C*o+U*f+z*y-(M*o+F*f+j*y)),t[10]=K*(P*o+F*u+G*y-(D*o+U*u+V*y)),t[11]=K*(B*o+j*u+V*f-(L*o+z*u+G*f)),t[12]=K*(P*p+B*b+C*l-(L*b+M*l+D*p)),t[13]=K*(j*b+M*s+F*p-(U*p+z*b+C*s)),t[14]=K*(U*l+V*b+D*s-(G*b+P*s+F*l)),t[15]=K*(G*p+L*s+z*l-(j*l+V*p+B*s)),t}},function(e,t,n){"use strict";t.__esModule=!0,t.createAttribsFromArrays=g,t.createBuffersFromArrays=function(e,t){var n={};return Object.keys(t).forEach((function(r){n[r]=y(e,t[r],r)})),t.indices?(n.numElements=t.indices.length,n.elementType=r.getGLTypeForTypedArray(m(t.indices),"indices")):n.numElements=function(e){for(var t,n=0;n<b.length&&!((t=b[n])in e);++n);ii===b.length&&(t=Object.keys(e)[0]);var r=e[t],i=u(r).length,s=f(r,t),o=i/s;if(i%s>0)throw"numComponents "+s+" not correct for length "+i;return o}(t),n},t.createBufferFromArray=y,t.createBufferFromTypedArray=c,t.createBufferInfoFromArrays=function(e,t){var n={attribs:g(e,t)},i=t.indices;if(i){var s=m(i,"indices");n.indices=c(e,s,e.ELEMENT_ARRAY_BUFFER),n.numElements=s.length,n.elementType=r.getGLTypeForTypedArray(s)}else n.numElements=function(e,t){var n,r;for(r=0;r<b.length&&!((n=b[r])in t)&&!((n=o.attribPrefix+n)in t);++r);r===b.length&&(n=Object.keys(t)[0]);var i=t[n];e.bindBuffer(e.ARRAY_BUFFER,i.buffer);var s=e.getBufferParameter(e.ARRAY_BUFFER,e.BUFFER_SIZE);e.bindBuffer(e.ARRAY_BUFFER,null);var a=function(e,t){return t===e.BYTE||t===e.UNSIGNED_BYTE?1:t===e.SHORT||t===e.UNSIGNED_SHORT?2:t===e.INT||t===e.UNSIGNED_INT||t===e.FLOAT?4:0}(e,i.type),c=s/a,l=i.numComponents||i.size,u=c/l;if(u%1!=0)throw"numComponents "+l+" not correct for length "+length;return u}(e,n.attribs);return n},t.setAttribInfoBufferFromArray=function(e,t,n,r){n=m(n),void 0!==r?(e.bindBuffer(e.ARRAY_BUFFER,t.buffer),e.bufferSubData(e.ARRAY_BUFFER,r,n)):a(e,e.ARRAY_BUFFER,t.buffer,n,t.drawType)},t.setAttributePrefix=function(e){o.attribPrefix=e},t.setAttributeDefaults_=function(e){i.copyExistingProperties(e,o)},t.getNumComponents_=f,t.getArray_=u;var r=s(n(1)),i=s(n(0));function s(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}var o={attribPrefix:""};function a(e,t,n,r,i){e.bindBuffer(t,n),e.bufferData(t,r,i||e.STATIC_DRAW)}function c(e,t,n,r){if(i.isBuffer(e,t))return t;n=n||e.ARRAY_BUFFER;var s=e.createBuffer();return a(e,n,s,t,r),s}function l(e){return"indices"===e}function u(e){return e.length?e:e.data}var h=/coord|texture/i,d=/color|colour/i;function p(e,t){var n;if(t%(n=h.test(e)?2:d.test(e)?4:3)>0)throw"Can not guess numComponents for attribute '"+e+"'. Tried "+n+" but "+t+" values is not evenly divisible by "+n+". You should specify it.";return n}function f(e,t){return e.numComponents||e.size||p(t,u(e).length)}function m(e,t){if(r.isArrayBuffer(e))return e;if(r.isArrayBuffer(e.data))return e.data;Array.isArray(e)&&(e={data:e});var n=e.type;return n||(n=l(t)?Uint16Array:Float32Array),new n(e.data)}function g(e,t){var n={};return Object.keys(t).forEach((function(i){if(!l(i)){var s,a,u,h,d,g=t[i],b=g.attrib||g.name||g.attribName||o.attribPrefix+i;if("number"==typeof g||"number"==typeof g.data){d=g.data||g;var y=g.type||Float32Array,E=d*y.BYTES_PER_ELEMENT;a=r.getGLTypeForTypedArrayType(y),u=void 0!==g.normalize?g.normalize:(v=y)===Int8Array||v===Uint8Array,h=g.numComponents||g.size||p(i,d),s=e.createBuffer(),e.bindBuffer(e.ARRAY_BUFFER,s),e.bufferData(e.ARRAY_BUFFER,E,g.drawType||e.STATIC_DRAW)}else{var T=m(g,i);s=c(e,T,void 0,g.drawType),a=r.getGLTypeForTypedArray(T),u=void 0!==g.normalize?g.normalize:function(e){return e instanceof Int8Array||e instanceof Uint8Array}(T),h=f(g,i),d=T.length}n[b]={buffer:s,numComponents:h,type:a,normalize:u,stride:g.stride||0,offset:g.offset||0,divisor:void 0===g.divisor?void 0:g.divisor,drawType:g.drawType}}var v})),e.bindBuffer(e.ARRAY_BUFFER,null),n}var b=["position","positions","a_position"];function y(e,t,n){var r="indices"===n?e.ELEMENT_ARRAY_BUFFER:e.ARRAY_BUFFER;return c(e,m(t,n),r)}},function(e,t,n){"use strict";t.__esModule=!0,t.setTextureDefaults_=function(e){o.copyExistingProperties(e,l),e.textureColor&&Y(e.textureColor)},t.createSampler=$,t.createSamplers=function(e,t){var n={};return Object.keys(t).forEach((function(r){n[r]=$(e,t[r])})),n},t.setSamplerParameters=J,t.createTexture=fe,t.setEmptyTexture=pe,t.setTextureFromArray=de,t.loadTextureFromUrl=le,t.setTextureFromElement=ie,t.setTextureFilteringForSize=ee,t.setTextureParameters=Q,t.setDefaultTextureColor=Y,t.createTextures=function(e,t,n){n=n||se;var r=0,i=[],s={},o={};function a(){0===r&&setTimeout((function(){n(i.length?i:void 0,s,o)}),0)}return Object.keys(t).forEach((function(n){var c,l,u=t[n];("string"==typeof(l=u.src)||Array.isArray(l)&&"string"==typeof l[0])&&(c=function(e,t,s){o[n]=s,--r,e&&i.push(e),a()},++r),s[n]=fe(e,u,c)})),a(),s},t.resizeTexture=function(e,t,n,r,i){r=r||n.width,i=i||n.height;var s=n.target||e.TEXTURE_2D;e.bindTexture(s,t);var o,a=n.level||0,c=n.internalFormat||n.format||e.RGBA,l=z(c),h=n.format||l.format,d=n.src;if(o=d&&(u(d)||Array.isArray(d)&&"number"==typeof d[0])?n.type||V(e,d,l.type):n.type||l.type,s===e.TEXTURE_CUBE_MAP)for(var p=0;p<6;++p)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+p,a,c,r,i,0,h,o,null);else e.texImage2D(s,a,c,r,i,0,h,o,null)},t.getNumComponentsForFormat=function(e){var t=L[e];if(!t)throw"unknown format: "+e;return t.numColorComponents},t.getBytesPerElementForInternalFormat=j;var r,i=c(n(4)),s=c(n(1)),o=c(n(0)),a=(r=n(2))&&r.__esModule?r:{default:r};function c(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}var l={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},u=s.isArrayBuffer,h=a.default.document&&a.default.document.createElement?a.default.document.createElement("canvas").getContext("2d"):null,d=6406,p=6407,f=6408,m=6409,g=6410,b=6402,y=34041,E=5120,T=5121,v=5122,A=5123,w=5124,S=5125,k=5126,O=5131,I=36193,N=33640,R=33319,x=33320,M=6403,C=36244,P=36248,D=36249,L={},B=L;B[6406]={numColorComponents:1},B[6409]={numColorComponents:1},B[6410]={numColorComponents:2},B[p]={numColorComponents:3},B[f]={numColorComponents:4},B[M]={numColorComponents:1},B[36244]={numColorComponents:1},B[R]={numColorComponents:2},B[33320]={numColorComponents:2},B[p]={numColorComponents:3},B[36248]={numColorComponents:3},B[f]={numColorComponents:4},B[36249]={numColorComponents:4},B[6402]={numColorComponents:1},B[34041]={numColorComponents:2};var U={},F=U;function j(e,t){var n=U[e];if(!n)throw"unknown internal format";var r=n.bytesPerElementMap[t];if(void 0===r)throw"unknown internal format";return r}function z(e){var t=U[e];if(!t)throw"unknown internal format";return{format:t.textureFormat,type:Array.isArray(t.type)?t.type[0]:t.type}}function G(e){return!(e&e-1)}function V(e,t,n){return u(t)?s.getGLTypeForTypedArray(t):n||e.UNSIGNED_BYTE}function _(e,t,n,r,i){if(i%1!=0)throw"can't guess dimensions";if(n||r){if(r){if(!n&&(n=i/r)%1)throw"can't guess dimensions"}else if((r=i/n)%1)throw"can't guess dimensions"}else{var s=Math.sqrt(i/(t===e.TEXTURE_CUBE_MAP?6:1));s%1==0?(n=s,r=s):(n=i,r=1)}return{width:n,height:r}}function Y(e){l.textureColor=new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}F[6406]={textureFormat:d,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[T,O,I,k]},F[6409]={textureFormat:m,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[T,O,I,k]},F[6410]={textureFormat:g,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[T,O,I,k]},F[p]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[T,O,I,k,33635]},F[f]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[T,O,I,k,32819,32820]},F[33321]={textureFormat:M,colorRenderable:!0,textureFilterable:!0,bytesPerElement:1,type:T},F[36756]={textureFormat:M,colorRenderable:!1,textureFilterable:!0,bytesPerElement:1,type:E},F[33325]={textureFormat:M,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[k,O]},F[33326]={textureFormat:M,colorRenderable:!1,textureFilterable:!1,bytesPerElement:4,type:k},F[33330]={textureFormat:C,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:T},F[33329]={textureFormat:C,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:E},F[33332]={textureFormat:C,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:A},F[33331]={textureFormat:C,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:v},F[33334]={textureFormat:C,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:S},F[33333]={textureFormat:C,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:w},F[33323]={textureFormat:R,colorRenderable:!0,textureFilterable:!0,bytesPerElement:2,type:T},F[36757]={textureFormat:R,colorRenderable:!1,textureFilterable:!0,bytesPerElement:2,type:E},F[33327]={textureFormat:R,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[k,O]},F[33328]={textureFormat:R,colorRenderable:!1,textureFilterable:!1,bytesPerElement:8,type:k},F[33336]={textureFormat:x,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:T},F[33335]={textureFormat:x,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:E},F[33338]={textureFormat:x,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:A},F[33337]={textureFormat:x,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:v},F[33340]={textureFormat:x,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:S},F[33339]={textureFormat:x,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:w},F[32849]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:3,type:T},F[35905]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:T},F[36194]={textureFormat:p,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[T,33635]},F[36758]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:E},F[35898]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[k,O,35899]},F[35901]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[k,O,35902]},F[34843]={textureFormat:p,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[k,O]},F[34837]={textureFormat:p,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:k},F[36221]={textureFormat:P,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:T},F[36239]={textureFormat:P,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:E},F[36215]={textureFormat:P,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:A},F[36233]={textureFormat:P,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:v},F[36209]={textureFormat:P,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:S},F[36227]={textureFormat:P,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:w},F[32856]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:T},F[35907]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:T},F[36759]={textureFormat:f,colorRenderable:!1,textureFilterable:!0,bytesPerElement:4,type:E},F[32855]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[T,32820,N]},F[32854]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[T,32819]},F[32857]={textureFormat:f,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:N},F[34842]={textureFormat:f,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[k,O]},F[34836]={textureFormat:f,colorRenderable:!1,textureFilterable:!1,bytesPerElement:16,type:k},F[36220]={textureFormat:D,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:T},F[36238]={textureFormat:D,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:E},F[36975]={textureFormat:D,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:N},F[36214]={textureFormat:D,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:A},F[36232]={textureFormat:D,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:v},F[36226]={textureFormat:D,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:w},F[36208]={textureFormat:D,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:S},F[33189]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[A,S]},F[33190]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:S},F[36012]={textureFormat:b,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:k},F[35056]={textureFormat:y,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:34042},F[36013]={textureFormat:y,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:36269},Object.keys(F).forEach((function(e){var t=F[e];if(t.bytesPerElementMap={},Array.isArray(t.bytesPerElement))t.bytesPerElement.forEach((function(e,n){var r=t.type[n];t.bytesPerElementMap[r]=e}));else{var n=t.type;t.bytesPerElementMap[n]=t.bytesPerElement}}));var H={};function W(e,t){void 0!==t.colorspaceConversion&&(H.colorspaceConversion=e.getParameter(e.UNPACK_COLORSPACE_CONVERSION_WEBGL),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.colorspaceConversion)),void 0!==t.premultiplyAlpha&&(H.premultiplyAlpha=e.getParameter(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.premultiplyAlpha)),void 0!==t.flipY&&(H.flipY=e.getParameter(e.UNPACK_FLIP_Y_WEBGL),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,t.flipY))}function K(e,t){void 0!==t.colorspaceConversion&&e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,H.colorspaceConversion),void 0!==t.premultiplyAlpha&&e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,H.premultiplyAlpha),void 0!==t.flipY&&e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,H.flipY)}function X(e){H.unpackAlignment=e.getParameter(e.UNPACK_ALIGNMENT),i.isWebGL2(e)&&(H.unpackRowLength=e.getParameter(e.UNPACK_ROW_LENGTH),H.unpackImageHeight=e.getParameter(e.UNPACK_IMAGE_HEIGHT),H.unpackSkipPixels=e.getParameter(e.UNPACK_SKIP_PIXELS),H.unpackSkipRows=e.getParameter(e.UNPACK_SKIP_ROWS),H.unpackSkipImages=e.getParameter(e.UNPACK_SKIP_IMAGES))}function Z(e){e.pixelStorei(e.UNPACK_ALIGNMENT,H.unpackAlignment),i.isWebGL2(e)&&(e.pixelStorei(e.UNPACK_ROW_LENGTH,H.unpackRowLength),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,H.unpackImageHeight),e.pixelStorei(e.UNPACK_SKIP_PIXELS,H.unpackSkipPixels),e.pixelStorei(e.UNPACK_SKIP_ROWS,H.unpackSkipRows),e.pixelStorei(e.UNPACK_SKIP_IMAGES,H.unpackSkipImages))}function q(e,t,n,r){r.minMag&&(n.call(e,t,e.TEXTURE_MIN_FILTER,r.minMag),n.call(e,t,e.TEXTURE_MAG_FILTER,r.minMag)),r.min&&n.call(e,t,e.TEXTURE_MIN_FILTER,r.min),r.mag&&n.call(e,t,e.TEXTURE_MAG_FILTER,r.mag),r.wrap&&(n.call(e,t,e.TEXTURE_WRAP_S,r.wrap),n.call(e,t,e.TEXTURE_WRAP_T,r.wrap),(t===e.TEXTURE_3D||o.isSampler(e,t))&&n.call(e,t,e.TEXTURE_WRAP_R,r.wrap)),r.wrapR&&n.call(e,t,e.TEXTURE_WRAP_R,r.wrapR),r.wrapS&&n.call(e,t,e.TEXTURE_WRAP_S,r.wrapS),r.wrapT&&n.call(e,t,e.TEXTURE_WRAP_T,r.wrapT),r.minLod&&n.call(e,t,e.TEXTURE_MIN_LOD,r.minLod),r.maxLod&&n.call(e,t,e.TEXTURE_MAX_LOD,r.maxLod),r.baseLevel&&n.call(e,t,e.TEXTURE_BASE_LEVEL,r.baseLevel),r.maxLevel&&n.call(e,t,e.TEXTURE_MAX_LEVEL,r.maxLevel)}function Q(e,t,n){var r=n.target||e.TEXTURE_2D;e.bindTexture(r,t),q(e,r,e.texParameteri,n)}function J(e,t,n){q(e,t,e.samplerParameteri,n)}function $(e,t){var n=e.createSampler();return J(e,n,t),n}function ee(e,t,n,r,s,o,a){n=n||l.textureOptions,o=o||e.RGBA,a=a||e.UNSIGNED_BYTE;var c=n.target||e.TEXTURE_2D;if(r=r||n.width,s=s||n.height,e.bindTexture(c,t),function(e,t,n,r){if(!i.isWebGL2(e))return G(t)&&G(n);var s=U[r];if(!s)throw"unknown internal format";return s.colorRenderable&&s.textureFilterable}(e,r,s,o))e.generateMipmap(c);else{var u=function(e){var t=U[e];if(!t)throw"unknown internal format";return t.textureFilterable}(o)?e.LINEAR:e.NEAREST;e.texParameteri(c,e.TEXTURE_MIN_FILTER,u),e.texParameteri(c,e.TEXTURE_MAG_FILTER,u),e.texParameteri(c,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(c,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE)}}function te(e){return!0===e.auto||void 0===e.auto&&void 0===e.level}function ne(e,t){return(t=t||{}).cubeFaceOrder||[e.TEXTURE_CUBE_MAP_POSITIVE_X,e.TEXTURE_CUBE_MAP_NEGATIVE_X,e.TEXTURE_CUBE_MAP_POSITIVE_Y,e.TEXTURE_CUBE_MAP_NEGATIVE_Y,e.TEXTURE_CUBE_MAP_POSITIVE_Z,e.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function re(e,t){var n=ne(e,t).map((function(e,t){return{face:e,ndx:t}}));return n.sort((function(e,t){return e.face-t.face})),n}function ie(e,t,n,r){var i=(r=r||l.textureOptions).target||e.TEXTURE_2D,s=r.level||0,o=n.width,c=n.height,u=r.internalFormat||r.format||e.RGBA,d=z(u),p=r.format||d.format,f=r.type||d.type;if(W(e,r),e.bindTexture(i,t),i===e.TEXTURE_CUBE_MAP){var m,g,b=n.width,y=n.height;if(b/6===y)m=y,g=[0,0,1,0,2,0,3,0,4,0,5,0];else if(y/6===b)m=b,g=[0,0,0,1,0,2,0,3,0,4,0,5];else if(b/3==y/2)m=b/3,g=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(b/2!=y/3)throw"can't figure out cube map from element: "+(n.src?n.src:n.nodeName);m=b/2,g=[0,0,1,0,0,1,1,1,0,2,1,2]}h?(h.canvas.width=m,h.canvas.height=m,o=m,c=m,re(e,r).forEach((function(t){var r=g[2*t.ndx+0]*m,i=g[2*t.ndx+1]*m;h.drawImage(n,r,i,m,m,0,0,m,m),e.texImage2D(t.face,s,u,p,f,h.canvas)})),h.canvas.width=1,h.canvas.height=1):a.default.createImageBitmap&&(o=m,c=m,re(e,r).forEach((function(l){var h=g[2*l.ndx+0]*m,d=g[2*l.ndx+1]*m;e.texImage2D(l.face,s,u,m,m,0,p,f,null),a.default.createImageBitmap(n,h,d,m,m,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(n){W(e,r),e.bindTexture(i,t),e.texImage2D(l.face,s,u,p,f,n),K(e,r),te(r)&&ee(e,t,r,o,c,u,f)}))})))}else if(i===e.TEXTURE_3D||i===e.TEXTURE_2D_ARRAY){var E=Math.min(n.width,n.height),T=Math.max(n.width,n.height),v=T/E;if(v%1!=0)throw"can not compute 3D dimensions of element";var A=n.width===T?1:0,w=n.height===T?1:0;X(e),e.pixelStorei(e.UNPACK_ALIGNMENT,1),e.pixelStorei(e.UNPACK_ROW_LENGTH,n.width),e.pixelStorei(e.UNPACK_IMAGE_HEIGHT,0),e.pixelStorei(e.UNPACK_SKIP_IMAGES,0),e.texImage3D(i,s,u,E,E,E,0,p,f,null);for(var S=0;S<v;++S){var k=S*E*A,O=S*E*w;e.pixelStorei(e.UNPACK_SKIP_PIXELS,k),e.pixelStorei(e.UNPACK_SKIP_ROWS,O),e.texSubImage3D(i,s,0,0,S,E,E,1,p,f,n)}Z(e)}else e.texImage2D(i,s,u,p,f,n);K(e,r),te(r)&&ee(e,t,r,o,c,u,f),Q(e,t,r)}function se(){}function oe(e){return a.default.ImageBitmap&&e instanceof a.default.ImageBitmap||a.default.ImageData&&e instanceof a.default.ImageData||a.default.HTMLElement&&e instanceof a.default.HTMLElement}function ae(e,t,n){return oe(e)?(setTimeout((function(){n(null,e)})),e):function(e,t,n){var r;if(n=n||se,a.default.Image){r=new a.default.Image,void 0!==(t=void 0!==t?t:l.crossOrigin)&&(r.crossOrigin=t);var i=function(){r.removeEventListener("error",s),r.removeEventListener("load",c),r=null},s=function(){var t="couldn't load image: "+e;o.error(t),n(t,r),i()},c=function(){n(null,r),i()};return r.addEventListener("error",s),r.addEventListener("load",c),r.src=e,r}if(a.default.ImageBitmap){var u,h,d=function(){n(u,h)},p={};t&&(p.mode="cors"),fetch(e,p).then((function(e){if(!e.ok)throw e;return e.blob()})).then((function(e){return a.default.createImageBitmap(e,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(e){h=e,setTimeout(d)})).catch((function(e){u=e,setTimeout(d)})),r=null}return r}(e,t,n)}function ce(e,t,n){var r=(n=n||l.textureOptions).target||e.TEXTURE_2D;if(e.bindTexture(r,t),!1!==n.color){var i=function(e){return e=e||l.textureColor,u(e)?e:new Uint8Array([255*e[0],255*e[1],255*e[2],255*e[3]])}(n.color);if(r===e.TEXTURE_CUBE_MAP)for(var s=0;s<6;++s)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,i);else r===e.TEXTURE_3D||r===e.TEXTURE_2D_ARRAY?e.texImage3D(r,0,e.RGBA,1,1,1,0,e.RGBA,e.UNSIGNED_BYTE,i):e.texImage2D(r,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,i)}}function le(e,t,n,r){return r=r||se,n=n||l.textureOptions,ce(e,t,n),ae((n=Object.assign({},n)).src,n.crossOrigin,(function(i,s){i?r(i,t,s):(ie(e,t,s,n),r(null,t,s))}))}function ue(e,t,n,r){r=r||se;var i=n.src;if(6!==i.length)throw"there must be 6 urls for a cubemap";var s=n.level||0,o=n.internalFormat||n.format||e.RGBA,a=z(o),c=n.format||a.format,l=n.type||e.UNSIGNED_BYTE,u=n.target||e.TEXTURE_2D;if(u!==e.TEXTURE_CUBE_MAP)throw"target must be TEXTURE_CUBE_MAP";ce(e,t,n),n=Object.assign({},n);var h,d=6,p=[],f=ne(e,n);h=i.map((function(i,a){return ae(i,n.crossOrigin,(m=f[a],function(i,a){--d,i?p.push(i):a.width!==a.height?p.push("cubemap face img is not a square: "+a.src):(W(e,n),e.bindTexture(u,t),5===d?ne(e).forEach((function(t){e.texImage2D(t,s,o,c,l,a)})):e.texImage2D(m,s,o,c,l,a),K(e,n),te(n)&&e.generateMipmap(u)),0===d&&r(p.length?p:void 0,t,h)}));var m}))}function he(e,t,n,r){r=r||se;var i=n.src,s=n.internalFormat||n.format||e.RGBA,o=z(s),a=n.format||o.format,c=n.type||e.UNSIGNED_BYTE,l=n.target||e.TEXTURE_2D_ARRAY;if(l!==e.TEXTURE_3D&&l!==e.TEXTURE_2D_ARRAY)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";ce(e,t,n),n=Object.assign({},n);var u,d=i.length,p=[],f=n.level||0,m=n.width,g=n.height,b=i.length,y=!0;u=i.map((function(i,o){return ae(i,n.crossOrigin,(E=o,function(i,o){if(--d,i)p.push(i);else{if(W(e,n),e.bindTexture(l,t),y){y=!1,m=n.width||o.width,g=n.height||o.height,e.texImage3D(l,f,s,m,g,b,0,a,c,null);for(var T=0;T<b;++T)e.texSubImage3D(l,f,0,0,T,m,g,1,a,c,o)}else{var v=o;o.width===m&&o.height===g||(v=h.canvas,h.canvas.width=m,h.canvas.height=g,h.drawImage(o,0,0,m,g)),e.texSubImage3D(l,f,0,0,E,m,g,1,a,c,v),v===h.canvas&&(h.canvas.width=0,h.canvas.height=0)}K(e,n),te(n)&&e.generateMipmap(l)}0===d&&r(p.length?p:void 0,t,u)}));var E}))}function de(e,t,n,r){var o=(r=r||l.textureOptions).target||e.TEXTURE_2D;e.bindTexture(o,t);var a=r.width,c=r.height,h=r.depth,d=r.level||0,p=r.internalFormat||r.format||e.RGBA,f=z(p),m=r.format||f.format,g=r.type||V(e,n,f.type);if(u(n))n instanceof Uint8ClampedArray&&(n=new Uint8Array(n.buffer));else{var b=s.getTypedArrayTypeForGLType(g);n=new b(n)}var y,E=j(p,g),T=n.byteLength/E;if(T%1)throw"length wrong size for format: "+i.glEnumToString(e,m);if(o===e.TEXTURE_3D)if(a||c||h)!a||c&&h?!c||a&&h?(y=_(e,o,a,c,T/h),a=y.width,c=y.height):(y=_(e,o,a,h,T/c),a=y.width,h=y.height):(y=_(e,o,c,h,T/a),c=y.width,h=y.height);else{var v=Math.cbrt(T);if(v%1!=0)throw"can't guess cube size of array of numElements: "+T;a=v,c=v,h=v}else y=_(e,o,a,c,T),a=y.width,c=y.height;if(X(e),e.pixelStorei(e.UNPACK_ALIGNMENT,r.unpackAlignment||1),W(e,r),o===e.TEXTURE_CUBE_MAP){var A=T/6*(E/n.BYTES_PER_ELEMENT);re(e,r).forEach((function(t){var r=A*t.ndx,i=n.subarray(r,r+A);e.texImage2D(t.face,d,p,a,c,0,m,g,i)}))}else o===e.TEXTURE_3D?e.texImage3D(o,d,p,a,c,h,0,m,g,n):e.texImage2D(o,d,p,a,c,0,m,g,n);return K(e,r),Z(e),{width:a,height:c,depth:h,type:g}}function pe(e,t,n){var r=n.target||e.TEXTURE_2D;e.bindTexture(r,t);var i=n.level||0,s=n.internalFormat||n.format||e.RGBA,o=z(s),a=n.format||o.format,c=n.type||o.type;if(W(e,n),r===e.TEXTURE_CUBE_MAP)for(var l=0;l<6;++l)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+l,i,s,n.width,n.height,0,a,c,null);else r===e.TEXTURE_3D?e.texImage3D(r,i,s,n.width,n.height,n.depth,0,a,c,null):e.texImage2D(r,i,s,n.width,n.height,0,a,c,null);K(e,n)}function fe(e,t,n){n=n||se,t=t||l.textureOptions;var r=e.createTexture(),i=t.target||e.TEXTURE_2D,s=t.width||1,o=t.height||1,a=t.internalFormat||e.RGBA,c=z(a),h=t.type||c.type;e.bindTexture(i,r),i===e.TEXTURE_CUBE_MAP&&(e.texParameteri(i,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(i,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE));var d=t.src;if(d)if("function"==typeof d&&(d=d(e,t)),"string"==typeof d)le(e,r,t,n);else if(u(d)||Array.isArray(d)&&("number"==typeof d[0]||Array.isArray(d[0])||u(d[0]))){var p=de(e,r,d,t);s=p.width,o=p.height,h=p.type}else if(Array.isArray(d)&&("string"==typeof d[0]||oe(d[0])))i===e.TEXTURE_CUBE_MAP?ue(e,r,t,n):he(e,r,t,n);else{if(!oe(d))throw"unsupported src type";ie(e,r,d,t),s=d.width,o=d.height}else pe(e,r,t);return te(t)&&ee(e,r,t,s,o,a,h),Q(e,r,t),r}},function(e,t,n){"use strict";t.__esModule=!0;var r={m4:!0,v3:!0,primitives:!0};t.primitives=t.v3=t.m4=void 0;var i=c(n(6));t.m4=i;var s=c(n(3));t.v3=s;var o=c(n(10));t.primitives=o;var a=n(11);function c(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=a[e]))}))},function(e,t,n){"use strict";t.__esModule=!0,t.create3DFVertices=I,t.createAugmentedTypedArray=d,t.createCubeVertices=S,t.createPlaneVertices=v,t.createSphereVertices=A,t.createTruncatedConeVertices=k,t.createXYQuadVertices=T,t.createCresentVertices=N,t.createCylinderVertices=R,t.createTorusVertices=x,t.createDiscVertices=M,t.deindexVertices=function(e){var t=e.indices,n={},r=t.length;return Object.keys(e).filter(p).forEach((function(i){for(var s=e[i],o=s.numComponents,a=d(o,r,s.constructor),c=0;c<r;++c)for(var l=t[c]*o,u=0;u<o;++u)a.push(s[l+u]);n[i]=a})),n},t.flattenNormals=function(e){if(e.indices)throw"can't flatten normals of indexed vertices. deindex them first";for(var t=e.normal,n=t.length,r=0;r<n;r+=9){var i=t[r+0],s=t[r+1],o=t[r+2],a=t[r+3],c=t[r+4],l=t[r+5],u=i+a+t[r+6],h=s+c+t[r+7],d=o+l+t[r+8],p=Math.sqrt(u*u+h*h+d*d);u/=p,h/=p,d/=p,t[r+0]=u,t[r+1]=h,t[r+2]=d,t[r+3]=u,t[r+4]=h,t[r+5]=d,t[r+6]=u,t[r+7]=h,t[r+8]=d}return e},t.makeRandomVertexColors=function(e,t){t=t||{};var n=e.position.numElements,r=d(4,n,Uint8Array),i=t.rand||function(e,t){return t<3?(n=256,Math.random()*n|0):255;var n};if(e.color=r,e.indices)for(var s=0;s<n;++s)r.push(i(s,0),i(s,1),i(s,2),i(s,3));else for(var o=t.vertsPerColor||3,a=n/o,c=0;c<a;++c)for(var l=[i(c,0),i(c,1),i(c,2),i(c,3)],u=0;u<o;++u)r.push(l);return e},t.reorientDirections=g,t.reorientNormals=b,t.reorientPositions=y,t.reorientVertices=E,t.concatVertices=function(e){for(var t,n={},r=function(r){var i=e[r];Object.keys(i).forEach((function(e){n[e]||(n[e]=[]),t||"indices"===e||(t=e);var r=i[e],s=u(r,e),o=l(r).length/s;n[e].push(o)}))},i=0;i<e.length;++i)r(i);var s=n[t],o={};return Object.keys(n).forEach((function(t){var n=function(t){for(var n,r=0,i=0;i<e.length;++i){var s=e[i][t];r+=l(s).length,n&&!s.data||(n=s)}return{length:r,spec:n}}(t),r=B(n.spec,n.length);!function(t,n,r){for(var i=0,s=0,o=0;o<e.length;++o){var a=e[o][t],c=l(a);"indices"===t?(L(c,r,s,i),i+=n[o]):L(c,r,s),s+=c.length}}(t,s,l(r)),o[t]=r})),o},t.duplicateVertices=function(e){var t={};return Object.keys(e).forEach((function(n){var r=e[n],i=l(r),s=B(r,i.length);L(i,l(s),0),t[n]=s})),t},t.createDiscBuffers=t.createDiscBufferInfo=t.createTorusBuffers=t.createTorusBufferInfo=t.createCylinderBuffers=t.createCylinderBufferInfo=t.createCresentBuffers=t.createCresentBufferInfo=t.createXYQuadBuffers=t.createXYQuadBufferInfo=t.createTruncatedConeBuffers=t.createTruncatedConeBufferInfo=t.createSphereBuffers=t.createSphereBufferInfo=t.createPlaneBuffers=t.createPlaneBufferInfo=t.createCubeBuffers=t.createCubeBufferInfo=t.create3DFBuffers=t.create3DFBufferInfo=void 0;var r=c(n(7)),i=c(n(0)),s=c(n(1)),o=c(n(6)),a=c(n(3));function c(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}var l=r.getArray_,u=r.getNumComponents_;function h(e,t){var n=0;return e.push=function(){for(var t=0;t<arguments.length;++t){var r=arguments[t];if(r instanceof Array||s.isArrayBuffer(r))for(var i=0;i<r.length;++i)e[n++]=r[i];else e[n++]=r}},e.reset=function(e){n=e||0},e.numComponents=t,Object.defineProperty(e,"numElements",{get:function(){return this.length/this.numComponents|0}}),e}function d(e,t,n){return h(new(n||Float32Array)(e*t),e)}function p(e){return"indices"!==e}function f(e,t,n){for(var r=e.length,i=new Float32Array(3),s=0;s<r;s+=3)n(t,[e[s],e[s+1],e[s+2]],i),e[s]=i[0],e[s+1]=i[1],e[s+2]=i[2]}function m(e,t,n){n=n||a.create();var r=t[0],i=t[1],s=t[2];return n[0]=r*e[0]+i*e[1]+s*e[2],n[1]=r*e[4]+i*e[5]+s*e[6],n[2]=r*e[8]+i*e[9]+s*e[10],n}function g(e,t){return f(e,t,o.transformDirection),e}function b(e,t){return f(e,o.inverse(t),m),e}function y(e,t){return f(e,t,o.transformPoint),e}function E(e,t){return Object.keys(e).forEach((function(n){var r=e[n];n.indexOf("pos")>=0?y(r,t):n.indexOf("tan")>=0||n.indexOf("binorm")>=0?g(r,t):n.indexOf("norm")>=0&&b(r,t)})),e}function T(e,t,n){return e=e||2,{position:{numComponents:2,data:[(t=t||0)+-1*(e*=.5),(n=n||0)+-1*e,t+1*e,n+-1*e,t+-1*e,n+1*e,t+1*e,n+1*e]},normal:[0,0,1,0,0,1,0,0,1,0,0,1],texcoord:[0,0,1,0,0,1,1,1],indices:[0,1,2,2,1,3]}}function v(e,t,n,r,i){e=e||1,t=t||1,n=n||1,r=r||1,i=i||o.identity();for(var s=(n+1)*(r+1),a=d(3,s),c=d(3,s),l=d(2,s),u=0;u<=r;u++)for(var h=0;h<=n;h++){var p=h/n,f=u/r;a.push(e*p-.5*e,0,t*f-.5*t),c.push(0,1,0),l.push(p,f)}for(var m=n+1,g=d(3,n*r*2,Uint16Array),b=0;b<r;b++)for(var y=0;y<n;y++)g.push((b+0)*m+y,(b+1)*m+y,(b+0)*m+y+1),g.push((b+1)*m+y,(b+1)*m+y+1,(b+0)*m+y+1);return E({position:a,normal:c,texcoord:l,indices:g},i)}function A(e,t,n,r,i,s,o){if(t<=0||n<=0)throw Error("subdivisionAxis and subdivisionHeight must be > 0");r=r||0,s=s||0;for(var a=(i=i||Math.PI)-r,c=(o=o||2*Math.PI)-s,l=(t+1)*(n+1),u=d(3,l),h=d(3,l),p=d(2,l),f=0;f<=n;f++)for(var m=0;m<=t;m++){var g=m/t,b=f/n,y=c*g,E=a*b,T=Math.sin(y),v=Math.cos(y),A=Math.sin(E),w=v*A,S=Math.cos(E),k=T*A;u.push(e*w,e*S,e*k),h.push(w,S,k),p.push(1-g,b)}for(var O=t+1,I=d(3,t*n*2,Uint16Array),N=0;N<t;N++)for(var R=0;R<n;R++)I.push((R+0)*O+N,(R+0)*O+N+1,(R+1)*O+N),I.push((R+1)*O+N,(R+0)*O+N+1,(R+1)*O+N+1);return{position:u,normal:h,texcoord:p,indices:I}}var w=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function S(e){for(var t=(e=e||1)/2,n=[[-t,-t,-t],[+t,-t,-t],[-t,+t,-t],[+t,+t,-t],[-t,-t,+t],[+t,-t,+t],[-t,+t,+t],[+t,+t,+t]],r=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],i=[[1,0],[0,0],[0,1],[1,1]],s=d(3,24),o=d(3,24),a=d(2,24),c=d(3,12,Uint16Array),l=0;l<6;++l){for(var u=w[l],h=0;h<4;++h){var p=n[u[h]],f=r[l],m=i[h];s.push(p),o.push(f),a.push(m)}var g=4*l;c.push(g+0,g+1,g+2),c.push(g+0,g+2,g+3)}return{position:s,normal:o,texcoord:a,indices:c}}function k(e,t,n,r,i,s,o){if(r<3)throw Error("radialSubdivisions must be 3 or greater");if(i<1)throw Error("verticalSubdivisions must be 1 or greater");for(var a=void 0===s||s,c=void 0===o||o,l=(a?2:0)+(c?2:0),u=(r+1)*(i+1+l),h=d(3,u),p=d(3,u),f=d(2,u),m=d(3,r*(i+l)*2,Uint16Array),g=r+1,b=Math.atan2(e-t,n),y=Math.cos(b),E=Math.sin(b),T=i+(c?2:0),v=a?-2:0;v<=T;++v){var A=v/i,w=n*A,S=void 0;v<0?(w=0,A=1,S=e):v>i?(w=n,A=1,S=t):S=e+v/i*(t-e),-2!==v&&v!==i+2||(S=0,A=0),w-=n/2;for(var k=0;k<g;++k){var O=Math.sin(k*Math.PI*2/r),I=Math.cos(k*Math.PI*2/r);h.push(O*S,w,I*S),p.push(v<0||v>i?0:O*y,v<0?-1:v>i?1:E,v<0||v>i?0:I*y),f.push(k/r,1-A)}}for(var N=0;N<i+l;++N)for(var R=0;R<r;++R)m.push(g*(N+0)+0+R,g*(N+0)+1+R,g*(N+1)+1+R),m.push(g*(N+0)+0+R,g*(N+1)+1+R,g*(N+1)+0+R);return{position:h,normal:p,texcoord:f,indices:m}}function O(e,t){t=t||[];for(var n=[],r=0;r<e.length;r+=4){var i=e[r],s=e.slice(r+1,r+4);s.push.apply(s,t);for(var o=0;o<i;++o)n.push.apply(n,s)}return n}function I(){var e=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],t=O([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),n=O([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),r=e.length/3,i={position:d(3,r),texcoord:d(2,r),normal:d(3,r),color:d(4,r,Uint8Array),indices:d(3,r/3,Uint16Array)};i.position.push(e),i.texcoord.push([.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0]),i.normal.push(t),i.color.push(n);for(var s=0;s<r;++s)i.indices.push(s);return i}function N(e,t,n,r,i,s,o){if(i<=0)throw Error("subdivisionDown must be > 0");var c=(o=o||1)-(s=s||0),l=2*(i+1)*4,u=d(3,l),h=d(3,l),p=d(2,l);function f(e,t,n){return e+(t-e)*n}function m(t,n,o,l,d,m){for(var g=0;g<=i;g++){var b=n/1,y=g/i,E=2*(b-.5),T=(s+y*c)*Math.PI,v=Math.sin(T),A=Math.cos(T),w=f(e,t,v),S=E*r,k=A*e,O=v*w;u.push(S,k,O);var I=a.add(a.multiply([0,v,A],o),l);h.push(I),p.push(b*d+m,y)}}for(var g=0;g<2;g++){var b=2*(g/1-.5);m(t,g,[1,1,1],[0,0,0],1,0),m(t,g,[0,0,0],[b,0,0],0,0),m(n,g,[1,1,1],[0,0,0],1,0),m(n,g,[0,0,0],[b,0,0],0,1)}var y=d(3,2*i*4,Uint16Array);function E(e,t){for(var n=0;n<i;++n)y.push(e+n+0,e+n+1,t+n+0),y.push(e+n+1,t+n+1,t+n+0)}var T=i+1;return E(0*T,4*T),E(5*T,7*T),E(6*T,2*T),E(3*T,1*T),{position:u,normal:h,texcoord:p,indices:y}}function R(e,t,n,r,i,s){return k(e,e,t,n,r,i,s)}function x(e,t,n,r,i,s){if(n<3)throw Error("radialSubdivisions must be 3 or greater");if(r<3)throw Error("verticalSubdivisions must be 3 or greater");i=i||0;for(var o=(s=s||2*Math.PI)-i,a=n+1,c=r+1,l=a*c,u=d(3,l),h=d(3,l),p=d(2,l),f=d(3,n*r*2,Uint16Array),m=0;m<c;++m)for(var g=m/r,b=g*Math.PI*2,y=Math.sin(b),E=e+y*t,T=Math.cos(b),v=T*t,A=0;A<a;++A){var w=A/n,S=i+w*o,k=Math.sin(S),O=Math.cos(S),I=k*E,N=O*E,R=k*y,x=O*y;u.push(I,v,N),h.push(R,T,x),p.push(w,1-g)}for(var M=0;M<r;++M)for(var C=0;C<n;++C){var P=1+C,D=1+M;f.push(a*M+C,a*D+C,a*M+P),f.push(a*D+C,a*D+P,a*M+P)}return{position:u,normal:h,texcoord:p,indices:f}}function M(e,t,n,r,i){if(t<3)throw Error("divisions must be at least 3");i=i||1,r=r||0;for(var s=(t+1)*((n=n||1)+1),o=d(3,s),a=d(3,s),c=d(2,s),l=d(3,n*t*2,Uint16Array),u=0,h=e-r,p=t+1,f=0;f<=n;++f){for(var m=r+h*Math.pow(f/n,i),g=0;g<=t;++g){var b=2*Math.PI*g/t,y=m*Math.cos(b),E=m*Math.sin(b);if(o.push(y,0,E),a.push(0,1,0),c.push(1-g/t,f/n),f>0&&g!==t){var T=u+(g+1),v=u+g,A=u+g-p,w=u+(g+1)-p;l.push(T,v,A),l.push(T,A,w)}}u+=t+1}return{position:o,normal:a,texcoord:c,indices:l}}function C(e){return function(t){var n=e.apply(this,Array.prototype.slice.call(arguments,1));return r.createBuffersFromArrays(t,n)}}function P(e){return function(t){var n=e.apply(null,Array.prototype.slice.call(arguments,1));return r.createBufferInfoFromArrays(t,n)}}var D=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function L(e,t,n,r){r=r||0;for(var i=e.length,s=0;s<i;++s)t[n+s]=e[s]+r}function B(e,t){var n=l(e),r=new n.constructor(t),s=r;return n.numComponents&&n.numElements&&h(r,n.numComponents),e.data&&(s={data:r},i.copyNamedProperties(D,e,s)),s}var U=P(I);t.create3DFBufferInfo=U;var F=C(I);t.create3DFBuffers=F;var j=P(S);t.createCubeBufferInfo=j;var z=C(S);t.createCubeBuffers=z;var G=P(v);t.createPlaneBufferInfo=G;var V=C(v);t.createPlaneBuffers=V;var _=P(A);t.createSphereBufferInfo=_;var Y=C(A);t.createSphereBuffers=Y;var H=P(k);t.createTruncatedConeBufferInfo=H;var W=C(k);t.createTruncatedConeBuffers=W;var K=P(T);t.createXYQuadBufferInfo=K;var X=C(T);t.createXYQuadBuffers=X;var Z=P(N);t.createCresentBufferInfo=Z;var q=C(N);t.createCresentBuffers=q;var Q=P(R);t.createCylinderBufferInfo=Q;var J=C(R);t.createCylinderBuffers=J;var $=P(x);t.createTorusBufferInfo=$;var ee=C(x);t.createTorusBuffers=ee;var te=P(M);t.createDiscBufferInfo=te;var ne=C(M);t.createDiscBuffers=ne},function(e,t,n){"use strict";t.__esModule=!0;var r={addExtensionsToContext:!0,getContext:!0,getWebGLContext:!0,resizeCanvasToDisplaySize:!0,setDefaults:!0};t.addExtensionsToContext=y,t.getContext=function(e,t){var n=function(e,t){for(var n=["webgl2","webgl","experimental-webgl"],r=null,i=0;i<n.length;++i)if(r=e.getContext(n[i],t)){f.addExtensionsToContext&&y(r);break}return r}(e,t);return n},t.getWebGLContext=function(e,t){var n=function(e,t){for(var n=["webgl","experimental-webgl"],r=null,i=0;i<n.length;++i)if(r=e.getContext(n[i],t)){f.addExtensionsToContext&&y(r);break}return r}(e,t);return n},t.resizeCanvasToDisplaySize=function(e,t){t=t||1,t=Math.max(0,t);var n=e.clientWidth*t|0,r=e.clientHeight*t|0;return(e.width!==n||e.height!==r)&&(e.width=n,e.height=r,!0)},t.setDefaults=function(e){o.copyExistingProperties(e,f),i.setAttributeDefaults_(e),s.setTextureDefaults_(e)};var i=p(n(7));Object.keys(i).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=i[e]))}));var s=p(n(8));Object.keys(s).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=s[e]))}));var o=p(n(0)),a=p(n(4));Object.keys(a).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=a[e]))}));var c=n(12);Object.keys(c).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=c[e]))}));var l=n(13);Object.keys(l).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=l[e]))}));var u=n(5);Object.keys(u).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=u[e]))}));var h=n(1);Object.keys(h).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=h[e]))}));var d=n(14);function p(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}Object.keys(d).forEach((function(e){"default"!==e&&"__esModule"!==e&&(Object.prototype.hasOwnProperty.call(r,e)||(t[e]=d[e]))}));var f={addExtensionsToContext:!0},m=/^(.*?)_/;function g(e,t){a.glEnumToString(e,0);var n=e.getExtension(t);if(n){var r={},i=m.exec(t)[1],s="_"+i;for(var c in n){var l=n[c],u="function"==typeof l,h=u?i:s,d=c;c.endsWith(h)&&(d=c.substring(0,c.length-h.length)),void 0!==e[d]?u||e[d]===l||o.warn(d,e[d],l,c):u?e[d]=function(e){return function(){return e.apply(n,arguments)}}(l):(e[d]=l,r[d]=l)}r.constructor={name:n.constructor.name},a.glEnumToString(r,0)}return n}var b=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function y(e){for(var t=0;t<b.length;++t)g(e,b[t])}},function(e,t,n){"use strict";t.__esModule=!0,t.drawBufferInfo=i,t.drawObjectList=function(e,t){var n=null,s=null;t.forEach((function(t){if(!1!==t.active){var o=t.programInfo,a=t.vertexArrayInfo||t.bufferInfo,c=!1,l=void 0===t.type?e.TRIANGLES:t.type;o!==n&&(n=o,e.useProgram(o.program),c=!0),(c||a!==s)&&(s&&s.vertexArrayObject&&!a.vertexArrayObject&&e.bindVertexArray(null),s=a,r.setBuffersAndAttributes(e,o,a)),r.setUniforms(o,t.uniforms),i(e,a,l,t.count,t.offset,t.instanceCount)}})),s.vertexArrayObject&&e.bindVertexArray(null)};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}(n(5));function i(e,t,n,r,i,s){n=void 0===n?e.TRIANGLES:n;var o=t.indices,a=t.elementType,c=void 0===r?t.numElements:r;i=void 0===i?0:i,a||o?void 0!==s?e.drawElementsInstanced(n,c,void 0===a?e.UNSIGNED_SHORT:t.elementType,i,s):e.drawElements(n,c,void 0===a?e.UNSIGNED_SHORT:t.elementType,i):void 0!==s?e.drawArraysInstanced(n,i,c,s):e.drawArrays(n,i,c)}},function(e,t,n){"use strict";t.__esModule=!0,t.bindFramebufferInfo=function(e,t,n){n=n||e.FRAMEBUFFER,t?(e.bindFramebuffer(n,t.framebuffer),e.viewport(0,0,t.width,t.height)):(e.bindFramebuffer(n,null),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight))},t.createFramebufferInfo=function(e,t,n,s){var o=e.FRAMEBUFFER,h=e.createFramebuffer();e.bindFramebuffer(o,h),n=n||e.drawingBufferWidth,s=s||e.drawingBufferHeight;var d=0,p={framebuffer:h,attachments:[],width:n,height:s};return(t=t||c).forEach((function(t){var c=t.attachment,h=t.format,f=function(e){return l[e]}(h);if(f||(f=a+d++),!c)if(function(e){return u[e]}(h))c=e.createRenderbuffer(),e.bindRenderbuffer(e.RENDERBUFFER,c),e.renderbufferStorage(e.RENDERBUFFER,h,n,s);else{var m=Object.assign({},t);m.width=n,m.height=s,void 0===m.auto&&(m.auto=!1,m.min=m.min||m.minMag||e.LINEAR,m.mag=m.mag||m.minMag||e.LINEAR,m.wrapS=m.wrapS||m.wrap||e.CLAMP_TO_EDGE,m.wrapT=m.wrapT||m.wrap||e.CLAMP_TO_EDGE),c=r.createTexture(e,m)}if(i.isRenderbuffer(e,c))e.framebufferRenderbuffer(o,f,e.RENDERBUFFER,c);else{if(!i.isTexture(e,c))throw"unknown attachment type";e.framebufferTexture2D(o,f,t.texTarget||e.TEXTURE_2D,c,t.level||0)}p.attachments.push(c)})),p},t.resizeFramebufferInfo=function(e,t,n,s,o){s=s||e.drawingBufferWidth,o=o||e.drawingBufferHeight,t.width=s,t.height=o,(n=n||c).forEach((function(n,a){var c=t.attachments[a],l=n.format;if(i.isRenderbuffer(e,c))e.bindRenderbuffer(e.RENDERBUFFER,c),e.renderbufferStorage(e.RENDERBUFFER,l,s,o);else{if(!i.isTexture(e,c))throw"unknown attachment type";r.resizeTexture(e,c,n,s,o)}}))};var r=s(n(8)),i=s(n(0));function s(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}var o=34041,a=36064,c=[{format:6408,type:5121,min:9729,wrap:33071},{format:o}],l={34041:33306,6401:36128,36168:36128,6402:36096,33189:36096},u={32854:!0,32855:!0,36194:!0,34041:!0,33189:!0,6401:!0,36168:!0}},function(e,t,n){"use strict";t.__esModule=!0,t.createVertexArrayInfo=function(e,t,n){var i=e.createVertexArray();return e.bindVertexArray(i),t.length||(t=[t]),t.forEach((function(t){r.setBuffersAndAttributes(e,t,n)})),e.bindVertexArray(null),{numElements:n.numElements,elementType:n.elementType,vertexArrayObject:i}},t.createVAOAndSetAttributes=i,t.createVAOFromBufferInfo=function(e,t,n){return i(e,t.attribSetters||t,n.attribs,n.indices)};var r=function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(e,n):{};r.get||r.set?Object.defineProperty(t,n,r):t[n]=e[n]}return t.default=e,t}(n(5));function i(e,t,n,i){var s=e.createVertexArray();return e.bindVertexArray(s),r.setAttributes(t,n),i&&e.bindBuffer(e.ELEMENT_ARRAY_BUFFER,i),e.bindVertexArray(null),s}}])},e.exports=r()},function(e,t){e.exports=class{static simple(e){return JSON.parse(JSON.stringify(e))}}},function(e,t){class n{static get BACKGROUND_LAYER(){return"background"}static get VIDEO_LAYER(){return"video"}static get PEN_LAYER(){return"pen"}static get SPRITE_LAYER(){return"sprite"}static get LAYER_GROUPS(){return[n.BACKGROUND_LAYER,n.VIDEO_LAYER,n.PEN_LAYER,n.SPRITE_LAYER]}}e.exports=n},function(e,t,n){(function(t){class n{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:n.nowObj;this.startTime=0,this.nowObj=e}static get USE_PERFORMANCE(){return!1}static get legacyDateCode(){return{now:function(){return(new Date).getTime()}}}static get nowObj(){return n.USE_PERFORMANCE&&"undefined"!=typeof self&&self.performance&&"now"in self.performance?self.performance:Date.now?Date:n.legacyDateCode}time(){return this.nowObj.now()}start(){this.startTime=this.nowObj.now()}timeElapsed(){return this.nowObj.now()-this.startTime}setTimeout(e,n){return t.setTimeout(e,n)}clearTimeout(e){t.clearTimeout(e)}}e.exports=n}).call(this,n(8))},function(e,t){e.exports={StackOpcode:{NOP:"noop",ADDON_CALL:"addons.call",DEBUGGER:"tw.debugger",VISUAL_REPORT:"visualReport",COMPATIBILITY_LAYER:"compat",OLD_COMPILER_COMPATIBILITY_LAYER:"oldCompiler",HAT_EDGE:"hat.edge",HAT_PREDICATE:"hat.predicate",CONTROL_IF_ELSE:"control.if",CONTROL_CLONE_CREATE:"control.createClone",CONTROL_CLONE_DELETE:"control.deleteClone",CONTROL_WHILE:"control.while",CONTROL_FOR:"control.for",CONTROL_REPEAT:"control.repeat",CONTROL_STOP_ALL:"control.stopAll",CONTROL_STOP_OTHERS:"control.stopOthers",CONTROL_STOP_SCRIPT:"control.stopScript",CONTROL_WAIT:"control.wait",CONTROL_WAIT_UNTIL:"control.waitUntil",CONTROL_CLEAR_COUNTER:"control.counterClear",CONTORL_INCR_COUNTER:"control.counterIncr",LIST_ADD:"list.add",LIST_INSERT:"list.instert",LIST_REPLACE:"list.replace",LIST_DELETE_ALL:"list.deleteAll",LIST_DELETE:"list.delete",LIST_SHOW:"list.show",LIST_HIDE:"list.hide",VAR_SET:"var.set",VAR_SHOW:"var.show",VAR_HIDE:"var.hide",EVENT_BROADCAST:"event.broadcast",EVENT_BROADCAST_AND_WAIT:"event.broadcastAndWait",LOOKS_EFFECT_SET:"looks.setEffect",LOOKS_EFFECT_CHANGE:"looks.changeEffect",LOOKS_EFFECT_CLEAR:"looks.clearEffects",LOOKS_SIZE_CHANGE:"looks.changeSize",LOOKS_SIZE_SET:"looks.setSize",LOOKS_LAYER_FORWARD:"looks.forwardLayers",LOOKS_LAYER_BACKWARD:"looks.backwardLayers",LOOKS_LAYER_FRONT:"looks.goToFront",LOOKS_LAYER_BACK:"looks.goToBack",LOOKS_HIDE:"looks.hide",LOOKS_SHOW:"looks.show",LOOKS_BACKDROP_NEXT:"looks.nextBackdrop",LOOKS_BACKDROP_SET:"looks.switchBackdrop",LOOKS_COSTUME_NEXT:"looks.nextCostume",LOOKS_COSTUME_SET:"looks.switchCostume",LOOKS_SAY:"looks.say",LOOKS_THINK:"looks.think",MOTION_X_SET:"motion.setX",MOTION_X_CHANGE:"motion.changeX",MOTION_Y_SET:"motion.setY",MOTION_Y_CHANGE:"motion.changeY",MOTION_XY_SET:"motion.setXY",MOTION_IF_ON_EDGE_BOUNCE:"motion.ifOnEdgeBounce",MOTION_STEP:"motion.step",MOTION_ROTATION_STYLE_SET:"motion.setRotationStyle",MOTION_DIRECTION_SET:"motion.setDirection",PEN_UP:"pen.up",PEN_DOWN:"pen.down",PEN_CLEAR:"pen.clear",PEN_COLOR_PARAM_SET:"pen.setParam",PEN_COLOR_PARAM_CHANGE:"pen.changeParam",PEN_COLOR_HUE_CHANGE_LEGACY:"pen.legacyChangeHue",PEN_COLOR_HUE_SET_LEGACY:"pen_setPenHueToNumber",PEN_COLOR_SHADE_CHANGE_LEGACY:"pen.legacyChangeShade",PEN_COLOR_SHADE_SET_LEGACY:"pen.legacySetShade",PEN_COLOR_SET:"pen.setColor",PEN_SIZE_SET:"pen.setSize",PEN_SIZE_CHANGE:"pen.changeSize",PEN_STAMP:"pen.stamp",SENSING_TIMER_RESET:"timer.reset",PROCEDURE_RETURN:"procedures.return",PROCEDURE_CALL:"procedures.call"},InputOpcode:{NOP:"noop",ADDON_CALL:"addons.call",CONSTANT:"constant",CAST_NUMBER:"cast.toNumber",CAST_NUMBER_INDEX:"cast.toInteger",CAST_NUMBER_OR_NAN:"cast.toNumberOrNaN",CAST_STRING:"cast.toString",CAST_BOOLEAN:"cast.toBoolean",CAST_COLOR:"cast.toColor",COMPATIBILITY_LAYER:"compat",OLD_COMPILER_COMPATIBILITY_LAYER:"oldCompiler",LOOKS_BACKDROP_NUMBER:"looks.backdropNumber",LOOKS_BACKDROP_NAME:"looks.backdropName",LOOKS_COSTUME_NUMBER:"looks.costumeNumber",LOOKS_COSTUME_NAME:"looks.costumeName",LOOKS_SIZE_GET:"looks.size",VAR_GET:"var.get",LIST_GET:"list.get",LIST_LENGTH:"list.length",LIST_CONTAINS:"list.contains",LIST_INDEX_OF:"list.indexOf",LIST_CONTENTS:"list.contents",MOTION_X_GET:"motion.x",MOTION_Y_GET:"motion.y",MOTION_DIRECTION_GET:"motion.direction",OP_ADD:"op.add",OP_AND:"op.and",OP_CONTAINS:"op.contains",OP_DIVIDE:"op.divide",OP_EQUALS:"op.equals",OP_GREATER:"op.greater",OP_LESS:"op.less",OP_JOIN:"op.join",OP_LENGTH:"op.length",OP_LETTER_OF:"op.letterOf",OP_ABS:"op.abs",OP_FLOOR:"op.floor",OP_CEILING:"op.ceiling",OP_SQRT:"op.sqrt",OP_SIN:"op.sin",OP_COS:"op.cos",OP_TAN:"op.tan",OP_ASIN:"op.asin",OP_ACOS:"op.acos",OP_ATAN:"op.atan",OP_LOG_E:"op.ln",OP_LOG_10:"op.log",OP_POW_E:"op.e^",OP_POW_10:"op.10^",OP_MOD:"op.mod",OP_MULTIPLY:"op.multiply",OP_NOT:"op.not",OP_OR:"op.or",OP_RANDOM:"op.random",OP_ROUND:"op.round",OP_SUBTRACT:"op.subtract",SENSING_ANSWER:"sensing.answer",SENSING_COLOR_TOUCHING_COLOR:"sensing.colorTouchingColor",SENSING_TIME_YEAR:"sensing.year",SENSING_TIME_MONTH:"sensing.month",SENSING_TIME_DATE:"sensing.date",SENSING_TIME_WEEKDAY:"sensing.dayofweek",SENSING_TIME_HOUR:"sensing.hour",SENSING_TIME_MINUTE:"sensing.minute",SENSING_TIME_SECOND:"sensing.second",SENSING_TIME_DAYS_SINCE_2000:"sensing.daysSince2000",SENSING_DISTANCE:"sensing.distance",SENSING_KEY_DOWN:"keyboard.pressed",SENSING_MOUSE_DOWN:"mouse.down",SENSING_MOUSE_X:"mouse.x",SENSING_MOUSE_Y:"mouse.y",SENSING_OF:"sensing.of",SENSING_OF_BACKDROP_NAME:"sensing.of.backdropName",SENSING_OF_BACKDROP_NUMBER:"sensing.of.backdropNumber",SENSING_OF_COSTUME_NAME:"sensing.of.costumeName",SENSING_OF_COSTUME_NUMBER:"sensing.of.costumeNumber",SENSING_OF_VOLUME:"sensing.of.volume",SENSING_OF_POS_X:"sensing.of.x",SENSING_OF_POS_Y:"sensing.of.y",SENSING_OF_DIRECTION:"sensing.of.direction",SENSING_OF_SIZE:"sensing.of.size",SENSING_OF_VAR:"sensing.of.var",SENSING_TIMER_GET:"timer.get",SENSING_TOUCHING_COLOR:"sensing.touchingColor",SENSING_TOUCHING_OBJECT:"sensing.touching",SENSING_USERNAME:"sensing.username",PROCEDURE_CALL:"procedures.call",PROCEDURE_ARGUMENT:"procedures.argument",CONTROL_COUNTER:"control.counter",TW_KEY_LAST_PRESSED:"tw.lastKeyPressed"},InputType:{NUMBER_POS_INF:1,NUMBER_POS_INT:2,NUMBER_POS_FRACT:4,NUMBER_POS_REAL:6,NUMBER_ZERO:8,NUMBER_NEG_ZERO:16,NUMBER_NEG_INT:32,NUMBER_NEG_FRACT:64,NUMBER_NEG_REAL:96,NUMBER_NEG_INF:128,NUMBER_NAN:256,NUMBER_ANY_ZERO:24,NUMBER_INF:129,NUMBER_POS:7,NUMBER_NEG:224,NUMBER_WHOLE:10,NUMBER_INT:58,NUMBER_INDEX:443,NUMBER_FRACT:68,NUMBER_REAL:126,NUMBER:255,NUMBER_OR_NAN:511,NUMBER_INTERPRETABLE:4863,STRING_NUM:512,STRING_NAN:1024,STRING_BOOLEAN:2048,STRING:3584,BOOLEAN:4096,BOOLEAN_INTERPRETABLE:6144,ANY:8191,COLOR:8192}}},function(e,t,n){const r=n(113),i=n(115);class s{static base64ToUint8Array(e){const t=r(e),n=t.length,i=new Uint8Array(n);for(let e=0;e<n;e++)i[e]=t.charCodeAt(e);return i}static uint8ArrayToBase64(e){let t="";const n=e.length;for(let r=0;r<n;r++)t+=String.fromCharCode(e[r]);return i(t)}static arrayBufferToBase64(e){return s.uint8ArrayToBase64(new Uint8Array(e))}}e.exports=s},function(e,t,n){const r=n(183),i=n(63),s=n(31),o=n(24),a=n(12),c=n(65),l=n(66),u=n(0),h=n(9),d=n(43);class p{constructor(e,t){this.runtime=e,this._blocks={},this._scripts=[],Object.defineProperty(this,"_cache",{writable:!0,enumerable:!1}),this._cache={inputs:{},procedureParamNames:{},procedureDefinitions:{},_executeCached:{},_monitored:null,scripts:{},compiledScripts:{},compiledProcedures:{},proceduresPopulated:!1},this.forceNoGlow=t||!1}getCachedCompileResult(e){return Object.prototype.hasOwnProperty.call(this._cache.compiledScripts,e)?this._cache.compiledScripts[e]:null}cacheCompileResult(e,t){this._cache.compiledScripts[e]={success:!0,value:t}}cacheCompileError(e,t){this._cache.compiledScripts[e]={success:!1,value:t}}static get BRANCH_INPUT_PREFIX(){return"SUBSTACK"}getBlock(e){return this._blocks[e]}getScripts(){return this._scripts}getNextBlock(e){const t=this._blocks[e];return void 0===t?null:t.next}getBranch(e,t){const n=this._blocks[e];if(void 0===n)return null;t||(t=1);let r=p.BRANCH_INPUT_PREFIX;t>1&&(r+=t);const i=n.inputs[r];return void 0===i?null:i.block}getOpcode(e){return void 0===e?null:e.opcode}getFields(e){return void 0===e?null:e.fields}getInputs(e){if(void 0===e)return null;let t=this._cache.inputs[e.id];if(void 0!==t)return t;t={};for(const n in e.inputs)n.substring(0,p.BRANCH_INPUT_PREFIX.length)!==p.BRANCH_INPUT_PREFIX&&(t[n]=e.inputs[n]);return this._cache.inputs[e.id]=t,t}getMutation(e){return void 0===e?null:e.mutation}getTopLevelScript(e){let t=this._blocks[e];if(void 0===t)return null;for(;null!==t.parent;)t=this._blocks[t.parent];return t.id}getProcedureDefinition(e){const t=this._cache.procedureDefinitions[e];if(void 0!==t)return t;for(const t in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,t))continue;const n=this._blocks[t];if("procedures_definition"===n.opcode){const r=this._getCustomBlockInternal(n);if(r&&r.mutation.proccode===e)return this._cache.procedureDefinitions[e]=t,t}}return this._cache.procedureDefinitions[e]=null,null}getProcedureParamNamesAndIds(e){return this.getProcedureParamNamesIdsAndDefaults(e).slice(0,2)}getProcedureParamNamesIdsAndDefaults(e){const t=this._cache.procedureParamNames[e];if(void 0!==t)return t;for(const t in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,t))continue;const n=this._blocks[t];if("procedures_prototype"===n.opcode&&n.mutation.proccode===e){const t=JSON.parse(n.mutation.argumentnames),r=JSON.parse(n.mutation.argumentids),i=JSON.parse(n.mutation.argumentdefaults);return this._cache.procedureParamNames[e]=[t,r,i],this._cache.procedureParamNames[e]}}const n=this.runtime.getAddonBlock(e);return n?(this._cache.procedureParamNames[e]=n.namesIdsDefaults,n.namesIdsDefaults):(this._cache.procedureParamNames[e]=null,null)}populateProcedureCache(){if(!this._cache.proceduresPopulated){for(const e in this._blocks){if(!Object.prototype.hasOwnProperty.call(this._blocks,e))continue;const t=this._blocks[e];if("procedures_prototype"!==t.opcode){if("procedures_definition"===t.opcode){const n=this._getCustomBlockInternal(t);if(n){const t=n.mutation.proccode;this._cache.procedureDefinitions[t]||(this._cache.procedureDefinitions[t]=e);continue}}}else{const e=t.mutation.proccode;if(!this._cache.procedureParamNames[e]){const n=JSON.parse(t.mutation.argumentnames),r=JSON.parse(t.mutation.argumentids),i=JSON.parse(t.mutation.argumentdefaults);this._cache.procedureParamNames[e]=[n,r,i]}}}this._cache.proceduresPopulated=!0}}duplicate(){const e=new p(this.runtime,this.forceNoGlow);return e._blocks=a.simple(this._blocks),e._scripts=a.simple(this._scripts),e}blocklyListen(e){if("object"!=typeof e)return;if("string"!=typeof e.blockId&&"string"!=typeof e.varId&&"string"!=typeof e.commentId)return;const t=this.runtime.getTargetForStage(),n=this.runtime.getEditingTarget();if("stackclick"!==e.element)switch(e.type){case"create":{const t=r(e);for(let e=0;e<t.length;e++)this.createBlock(t[e]);break}case"change":this.changeBlock({id:e.blockId,element:e.element,name:e.name,value:e.newValue});break;case"move":this.moveBlock({id:e.blockId,oldParent:e.oldParentId,oldInput:e.oldInputName,newParent:e.newParentId,newInput:e.newInputName,newCoordinate:e.newCoordinate});break;case"dragOutside":this.runtime.emitBlockDragUpdate(e.isOutside);break;case"endDrag":if(this.runtime.emitBlockDragUpdate(!1),e.isOutside){const t=r(e);this.runtime.emitBlockEndDrag(t,e.blockId)}break;case"delete":if(!Object.prototype.hasOwnProperty.call(this._blocks,e.blockId)||this._blocks[e.blockId].shadow)return;this._blocks[e.blockId].topLevel&&this.runtime.quietGlow(e.blockId),this.deleteBlock(e.blockId);break;case"var_create":if(this.resetCache(),e.isLocal&&n&&!n.isStage&&!e.isCloud)n.lookupVariableById(e.varId)||(n.createVariable(e.varId,e.varName,e.varType),this.emitProjectChanged());else{if(t.lookupVariableById(e.varId))return;const n=this.runtime.targets.filter((e=>e.isOriginal));for(const t of n)if(t.lookupVariableByNameAndType(e.varName,e.varType,!0))return;t.createVariable(e.varId,e.varName,e.varType,e.isCloud),this.emitProjectChanged()}break;case"var_rename":if(n&&Object.prototype.hasOwnProperty.call(n.variables,e.varId))n.renameVariable(e.varId,e.newName),n.blocks.updateBlocksAfterVarRename(e.varId,e.newName);else{t.renameVariable(e.varId,e.newName);const n=this.runtime.targets;for(let t=0;t<n.length;t++){n[t].blocks.updateBlocksAfterVarRename(e.varId,e.newName)}}this.emitProjectChanged();break;case"var_delete":this.resetCache();(n&&Object.prototype.hasOwnProperty.call(n.variables,e.varId)?n:t).deleteVariable(e.varId),this.emitProjectChanged();break;case"comment_create":if(this.resetCache(),this.runtime.getEditingTarget()){const t=this.runtime.getEditingTarget();t.createComment(e.commentId,e.blockId,e.text,e.xy.x,e.xy.y,e.width,e.height,e.minimized),null===t.comments[e.commentId].x&&null===t.comments[e.commentId].y&&(t.comments[e.commentId].x=e.xy.x,t.comments[e.commentId].y=e.xy.y)}this.emitProjectChanged();break;case"comment_change":if(this.resetCache(),this.runtime.getEditingTarget()){const t=this.runtime.getEditingTarget();if(!Object.prototype.hasOwnProperty.call(t.comments,e.commentId))return void u.warn("Cannot change comment with id ".concat(e.commentId," because it does not exist."));const n=t.comments[e.commentId],r=e.newContents_;Object.prototype.hasOwnProperty.call(r,"minimized")&&(n.minimized=r.minimized),Object.prototype.hasOwnProperty.call(r,"width")&&Object.prototype.hasOwnProperty.call(r,"height")&&(n.width=r.width,n.height=r.height),Object.prototype.hasOwnProperty.call(r,"text")&&(n.text=r.text),this.emitProjectChanged()}break;case"comment_move":if(this.runtime.getEditingTarget()){const t=this.runtime.getEditingTarget();if(t&&!Object.prototype.hasOwnProperty.call(t.comments,e.commentId))return void u.warn("Cannot change comment with id ".concat(e.commentId," because it does not exist."));const n=t.comments[e.commentId],r=e.newCoordinate_;n.x=r.x,n.y=r.y,this.emitProjectChanged()}break;case"comment_delete":if(this.resetCache(),this.runtime.getEditingTarget()){const t=this.runtime.getEditingTarget();if(!Object.prototype.hasOwnProperty.call(t.comments,e.commentId))return;if(delete t.comments[e.commentId],e.blockId){const n=t.blocks.getBlock(e.blockId);if(!n)return void u.warn("Could not find block referenced by comment with id: ".concat(e.commentId));delete n.comment}this.emitProjectChanged()}}else this.runtime.toggleScript(e.blockId,{stackClick:!0})}resetCache(){this._cache.inputs={},this._cache.procedureParamNames={},this._cache.procedureDefinitions={},this._cache._executeCached={},this._cache._monitored=null,this._cache.scripts={},this._cache.compiledScripts={},this._cache.compiledProcedures={},this._cache.proceduresPopulated=!1}emitProjectChanged(){this.forceNoGlow||this.runtime.emitProjectChanged()}createBlock(e){Object.prototype.hasOwnProperty.call(this._blocks,e.id)||(this._blocks[e.id]=e,e.topLevel&&this._addScript(e.id),this.resetCache(),this.emitProjectChanged())}changeBlock(e){if(-1===["field","mutation","checkbox"].indexOf(e.element))return;let t=this._blocks[e.id];if(void 0!==t){switch(e.element){case"field":if(!t.fields[e.name])return;if("VARIABLE"===e.name||"LIST"===e.name||"BROADCAST_OPTION"===e.name){const n=this.runtime.getEditingTarget().lookupVariableById(e.value);n&&(t.fields[e.name].value=n.name,t.fields[e.name].id=e.value)}else{t.fields[e.name].value=e.value,"sensing_of_object_menu"===t.opcode&&("_stage_"===t.fields.OBJECT.value?this._blocks[t.parent].fields.PROPERTY.value="backdrop #":this._blocks[t.parent].fields.PROPERTY.value="x position",this.runtime.requestBlocksUpdate());const n=t.shadow&&t.parent?this._blocks[t.parent]:t;n.isMonitored&&this.runtime.requestUpdateMonitor({id:n.id,params:this._getBlockParams(n)})}break;case"mutation":t.mutation=i(e.value);break;case"checkbox":{if(t.fields&&Object.keys(t.fields).length>0&&"data_variable"!==t.opcode&&"data_listcontents"!==t.opcode){const e=d(t.id,t.fields);let n=this.runtime.monitorBlocks.getBlock(e);n||(n=JSON.parse(JSON.stringify(t)),n.id=e,this.runtime.monitorBlocks.createBlock(n)),t=n}const n=t.isMonitored;t.isMonitored=e.value;let r=!1;"data_variable"===t.opcode?r=!this.runtime.getTargetForStage().variables[t.fields.VARIABLE.id]:"data_listcontents"===t.opcode&&(r=!this.runtime.getTargetForStage().variables[t.fields.LIST.id]);const i=r||Object.prototype.hasOwnProperty.call(this.runtime.monitorBlockInfo,t.opcode)&&this.runtime.monitorBlockInfo[t.opcode].isSpriteSpecific;t.targetId=i?t.targetId||this.runtime.getEditingTarget().id:null,n&&!t.isMonitored?this.runtime.requestHideMonitor(t.id):!n&&t.isMonitored&&(this.runtime.requestShowMonitor(t.id)||this.runtime.requestAddMonitor(new o({id:t.id,targetId:t.targetId,spriteName:t.targetId?this.runtime.getTargetById(t.targetId).getName():null,opcode:t.opcode,params:this._getBlockParams(t),value:"",mode:"data_listcontents"===t.opcode?"list":"default"})));break}}this.emitProjectChanged(),this.resetCache()}}moveBlock(e){if(!Object.prototype.hasOwnProperty.call(this._blocks,e.id))return;const t=this._blocks[e.id];let n=!1;if(e.newCoordinate&&(n=t.x!==e.newCoordinate.x||t.y!==e.newCoordinate.y,t.x=e.newCoordinate.x,t.y=e.newCoordinate.y),void 0!==e.oldParent){const t=this._blocks[e.oldParent];void 0!==e.oldInput&&t.inputs[e.oldInput].block===e.id?t.inputs[e.oldInput].block=null:t.next===e.id&&(t.next=null),this._blocks[e.id].parent=null,n=!0}if(void 0===e.newParent)this._addScript(e.id);else{if(this._deleteScript(e.id),void 0===e.newInput)this._blocks[e.newParent].next=e.id;else{let t=null;Object.prototype.hasOwnProperty.call(this._blocks[e.newParent].inputs,e.newInput)&&(t=this._blocks[e.newParent].inputs[e.newInput].shadow),this._blocks[e.id].shadow&&(t=e.id),this._blocks[e.newParent].inputs[e.newInput]={name:e.newInput,block:e.id,shadow:t}}this._blocks[e.id].parent=e.newParent,n=!0}this.resetCache(),n&&this.emitProjectChanged()}runAllMonitored(e){null===this._cache._monitored&&(this._cache._monitored=Object.keys(this._blocks).filter((e=>this.getBlock(e).isMonitored)).map((t=>{const n=this.getBlock(t).targetId;return{blockId:t,target:n?e.getTargetById(n):null}})));const t=this._cache._monitored;for(let n=0;n<t.length;n++){const{blockId:r,target:i}=t[n];e.addMonitorScript(r,i)}}deleteBlock(e){const t=this._blocks[e];if(t){null!==t.next&&this.deleteBlock(t.next);for(const e in t.inputs)null!==t.inputs[e].block&&this.deleteBlock(t.inputs[e].block),null!==t.inputs[e].shadow&&t.inputs[e].shadow!==t.inputs[e].block&&this.deleteBlock(t.inputs[e].shadow);this._deleteScript(e),delete this._blocks[e],this.resetCache(),this.emitProjectChanged()}}deleteAllBlocks(){Object.keys(this._blocks).forEach((e=>this.deleteBlock(e)))}getAllVariableAndListReferences(e,t){const n=e||this._blocks,r=Object.create(null);for(const e in n){let i=null,s=null;if(n[e].fields.VARIABLE?(i=n[e].fields.VARIABLE,s=h.SCALAR_TYPE):n[e].fields.LIST?(i=n[e].fields.LIST,s=h.LIST_TYPE):t&&n[e].fields.BROADCAST_OPTION&&(i=n[e].fields.BROADCAST_OPTION,s=h.BROADCAST_MESSAGE_TYPE),i){const e=i.id;r[e]?r[e].push({referencingField:i,type:s}):r[e]=[{referencingField:i,type:s}]}}return r}updateBlocksAfterVarRename(e,t){const n=this._blocks;for(const r in n){let i=null;if(n[r].fields.VARIABLE?i=n[r].fields.VARIABLE:n[r].fields.LIST&&(i=n[r].fields.LIST),i){e===i.id&&(i.value=t)}}}updateTargetSpecificBlocks(e){const t=this._blocks;for(const n in t)e&&"event_whenthisspriteclicked"===t[n].opcode?t[n].opcode="event_whenstageclicked":e||"event_whenstageclicked"!==t[n].opcode||(t[n].opcode="event_whenthisspriteclicked")}updateAssetName(e,t,n){let r;if("costume"===n)r=this._getCostumeField.bind(this);else if("sound"===n)r=this._getSoundField.bind(this);else if("backdrop"===n)r=this._getBackdropField.bind(this);else{if("sprite"!==n)return;r=this._getSpriteField.bind(this)}const i=this._blocks;for(const n in i){const i=r(n);i&&i.value===e&&(i.value=t)}this.resetCache()}updateSensingOfReference(e,t,n){const r=this._blocks;let i=!1;for(const s in r){const o=r[s];if("sensing_of"===o.opcode&&o.fields.PROPERTY.value===e&&o.inputs.OBJECT.block===o.inputs.OBJECT.shadow){this.getBlock(o.inputs.OBJECT.block).fields.OBJECT.value===n&&(o.fields.PROPERTY.value=t,i=!0)}}return i&&this.resetCache(),i}_getCostumeField(e){const t=this.getBlock(e);return t&&Object.prototype.hasOwnProperty.call(t.fields,"COSTUME")?t.fields.COSTUME:null}_getSoundField(e){const t=this.getBlock(e);return t&&Object.prototype.hasOwnProperty.call(t.fields,"SOUND_MENU")?t.fields.SOUND_MENU:null}_getBackdropField(e){const t=this.getBlock(e);return t&&Object.prototype.hasOwnProperty.call(t.fields,"BACKDROP")?t.fields.BACKDROP:null}_getSpriteField(e){const t=this.getBlock(e);if(!t)return null;const n=["TOWARDS","TO","OBJECT","VIDEOONMENU2","DISTANCETOMENU","TOUCHINGOBJECTMENU","CLONE_OPTION"];for(let e=0;e<n.length;e++){const r=n[e];if(Object.prototype.hasOwnProperty.call(t.fields,r))return t.fields[r]}return null}toXML(e){return this._scripts.map((t=>this.blockToXML(t,e))).join()}blockToXML(e,t){const n=this._blocks[e];if(!n)return;const r=n.shadow?"shadow":"block";let i="<".concat(r,'\n                id="').concat(s(n.id),'"\n                type="').concat(s(n.opcode),'"\n                ').concat(n.topLevel?'x="'.concat(n.x,'" y="').concat(n.y,'"'):"","\n            >");const o=n.comment;o&&(t?Object.prototype.hasOwnProperty.call(t,o)?i+=t[o].toXML():u.warn("Could not find comment with id: ".concat(o," in provided comment descriptions.")):u.warn("Cannot serialize comment with id: ".concat(o,"; no comment descriptions provided."))),n.mutation&&(i+=this.mutationToXML(n.mutation));for(const e in n.inputs){if(!Object.prototype.hasOwnProperty.call(n.inputs,e))continue;const r=n.inputs[e];(r.block||r.shadow)&&(i+='<value name="'.concat(s(r.name),'">'),r.block&&(i+=this.blockToXML(r.block,t)),r.shadow&&r.shadow!==r.block&&(i+=this.blockToXML(r.shadow,t)),i+="</value>")}for(const e in n.fields){if(!Object.prototype.hasOwnProperty.call(n.fields,e))continue;const t=n.fields[e];i+='<field name="'.concat(s(t.name),'"');const r=t.id;r&&(i+=' id="'.concat(s(r),'"'));const o=t.variableType;"string"==typeof o&&(i+=' variabletype="'.concat(s(o),'"'));let a=t.value;"string"==typeof a&&(a=s(t.value)),i+=">".concat(a,"</field>")}return n.next&&(i+="<next>".concat(this.blockToXML(n.next,t),"</next>")),i+="</".concat(r,">"),i}mutationToXML(e){let t="<".concat(e.tagName);for(const n in e){if("children"===n||"tagName"===n)continue;let r="string"==typeof e[n]?s(e[n]):e[n];"blockInfo"===n&&(r=s(JSON.stringify(e[n]))),t+=" ".concat(n,'="').concat(r,'"')}t+=">";for(let n=0;n<e.children.length;n++)t+=this.mutationToXML(e.children[n]);return t+="</".concat(e.tagName,">"),t}_getBlockParams(e){const t={};for(const n in e.fields)t[n]=e.fields[n].value;for(const n in e.inputs){const r=this._blocks[e.inputs[n].block];for(const e in r.fields)t[e]=r.fields[e].value}return t}_getCustomBlockInternal(e){if(e.inputs&&e.inputs.custom_block)return this._blocks[e.inputs.custom_block.block]}_addScript(e){this._scripts.indexOf(e)>-1||(this._scripts.push(e),this._blocks[e].topLevel=!0)}_deleteScript(e){const t=this._scripts.indexOf(e);t>-1&&this._scripts.splice(t,1),this._blocks[e]&&(this._blocks[e].topLevel=!1)}}c.getCached=function(e,t,n){let r=e._cache._executeCached[t];if(void 0!==r)return r;const i=e.getBlock(t);return void 0===i?null:(r=void 0===n?{id:t,opcode:e.getOpcode(i),fields:e.getFields(i),inputs:e.getInputs(i),mutation:e.getMutation(i)}:new n(e,{id:t,opcode:e.getOpcode(i),fields:e.getFields(i),inputs:e.getInputs(i),mutation:e.getMutation(i)}),e._cache._executeCached[t]=r,r)};const f=l._RuntimeScriptCache;l.getScripts=function(e,t){let n=e._cache.scripts[t];if(!n){n=e._cache.scripts[t]=[];const r=e._scripts;for(let i=0;i<r.length;i++){const s=r[i];e.getBlock(s).opcode===t&&n.push(new f(e,s))}}return n},e.exports=p},function(e,t,n){"use strict";(function(e){var r=n(98),i=n(99),s=n(100);function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return l(this,e,t,n)}function l(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=d(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|f(t,n);e=a(e,r);var i=e.write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|p(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&s(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(u(t),e=a(e,t<0?0:0|p(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|p(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function p(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return V(e).length;default:if(r)return G(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var s,o=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(s=n;s<a;s++)if(l(e,s)===l(t,-1===u?0:s-u)){if(-1===u&&(u=s),s-u+1===c)return u*o}else-1!==u&&(s-=s-u),u=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var h=!0,d=0;d<c;d++)if(l(e,s+d)!==l(t,d)){h=!1;break}if(h)return s}return-1}function E(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[n+o]=a}return o}function T(e,t,n,r){return _(G(t,e.length-n),e,n,r)}function v(e,t,n,r){return _(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function A(e,t,n,r){return v(e,t,n,r)}function w(e,t,n,r){return _(V(t),e,n,r)}function S(e,t,n,r){return _(function(e,t){for(var n,r,i,s=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s,o,a,c,l=e[i],u=null,h=l>239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(u=l);break;case 2:128==(192&(s=e[i+1]))&&(c=(31&l)<<6|63&s)>127&&(u=c);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(c=(15&l)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,h=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=h}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}(r)}t.Buffer=c,t.SlowBuffer=function(e){+e!=e&&(e=0);return c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return l(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return u(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return h(null,e)},c.allocUnsafeSlow=function(e){return h(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i<s;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?O(this,0,e):m.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(r,i),u=e.slice(t,n),h=0;h<a;++h)if(l[h]!==u[h]){s=l[h],o=u[h];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return A(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function N(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function x(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=t;s<n;++s)i+=z(e[s]);return i}function M(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}function C(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i<s;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i<s;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function B(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,s){return s||B(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,s){return s||B(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||C(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||C(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||C(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||C(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||C(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s<n&&(i*=256);)this[t+s]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,s=r-n;if(this===e&&n<t&&t<r)for(i=s-1;i>=0;--i)e[i+t]=this[i+n];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var o=c.isBuffer(e)?e:G(new c(e,r).toString()),a=o.length;for(s=0;s<n-t;++s)this[s+t]=o[s%a]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function z(e){return e<16?"0"+e.toString(16):e.toString(16)}function G(e,t){var n;t=t||1/0;for(var r=e.length,i=null,s=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function V(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function _(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(8))},function(e,t,n){"use strict";var r,i="object"==typeof Reflect?Reflect:null,s=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,s),r(n)}function s(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}b(e,t,s,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&b(e,"error",t,n)}(e,i,{once:!0})}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function u(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function h(e,t,n,r){var i,s,o,a;if(l(n),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),s=e._events),o=s[t]),void 0===o)o=s[t]=n,++e._eventsCount;else if("function"==typeof o?o=s[t]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),(i=u(e))>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,a=c,console&&console.warn&&console.warn(a)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function f(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):g(i,i.length)}function m(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function g(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function b(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(s){r.once&&e.removeEventListener(t,i),n(s)}))}}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||o(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return u(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)s(c,this,t);else{var l=c.length,u=g(c,l);for(n=0;n<l;++n)s(u[n],this,t)}return!0},a.prototype.addListener=function(e,t){return h(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return h(this,e,t,!0)},a.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,r,i,s,o;if(l(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,s=n.length-1;s>=0;s--)if(n[s]===t||n[s].listener===t){o=n[s].listener,i=s;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,o||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,s=Object.keys(n);for(r=0;r<s.length;++r)"removeListener"!==(i=s[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):m.call(e,t)},a.prototype.listenerCount=m,a.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){const r=n(0),i=[];class s{constructor(e){this.isLoop=!1,this.warpMode=e,this.justReported=null,this.reporting="",this.reported=null,this.waitingReporter=null,this.params=null,this.executionContext=null,this.op=null}reset(){return this.isLoop=!1,this.warpMode=!1,this.justReported=null,this.reported=null,this.waitingReporter=null,this.params=null,this.executionContext=null,this.op=null,this}reuse(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.warpMode;return this.reset(),this.warpMode=Boolean(e),this}static create(e){const t=i.pop();return void 0!==t?(t.warpMode=Boolean(e),t):new s(e)}static release(e){void 0!==e&&i.push(e.reset())}}class o{constructor(e){this.topBlock=e,this.stack=[],this.stackFrames=[],this.status=0,this.isKilled=!1,this.target=null,this.blockContainer=null,this.requestScriptGlowInFrame=!1,this.blockGlowInFrame=null,this.warpTimer=null,this.justReported=null,this.triedToCompile=!1,this.isCompiled=!1,this.timer=null,this.generator=null,this.procedures=null,this.executableHat=!1,this.compatibilityStackFrame=null}static get STATUS_RUNNING(){return 0}static get STATUS_PROMISE_WAIT(){return 1}static get STATUS_YIELD(){return 2}static get STATUS_YIELD_TICK(){return 3}static get STATUS_DONE(){return 4}static getIdFromTargetAndBlock(e,t){return"".concat(e.id,"&").concat(t)}getId(){return o.getIdFromTargetAndBlock(this.target,this.topBlock)}pushStack(e){if(this.stack.push(e),this.stack.length>this.stackFrames.length){const e=this.stackFrames[this.stackFrames.length-1];this.stackFrames.push(s.create(void 0!==e&&e.warpMode))}}reuseStackForNextBlock(e){this.stack[this.stack.length-1]=e,this.stackFrames[this.stackFrames.length-1].reuse()}popStack(){return s.release(this.stackFrames.pop()),this.stack.pop()}stopThisScript(){let e=this.peekStack();for(;null!==e;){const t=this.target.blocks.getBlock(e);if(this.peekStackFrame().waitingReporter)break;if(void 0!==t&&"procedures_call"===t.opcode){this.goToNextBlock();break}this.popStack(),e=this.peekStack()}0===this.stack.length&&(this.requestScriptGlowInFrame=!1,this.status=o.STATUS_DONE)}peekStack(){return this.stack.length>0?this.stack[this.stack.length-1]:null}peekStackFrame(){return this.stackFrames.length>0?this.stackFrames[this.stackFrames.length-1]:null}peekParentStackFrame(){return this.stackFrames.length>1?this.stackFrames[this.stackFrames.length-2]:null}pushReportedValue(e){this.justReported=void 0===e?null:e}initParams(){const e=this.peekStackFrame();null===e.params&&(e.params={})}pushParam(e,t){this.peekStackFrame().params[e]=t}getParam(e){for(let t=this.stackFrames.length-1;t>=0;t--){const n=this.stackFrames[t];if(null!==n.params)return Object.prototype.hasOwnProperty.call(n.params,e)?n.params[e]:null}return null}getAllparams(){return this.peekStackFrame().params}atStackTop(){return this.peekStack()===this.topBlock}goToNextBlock(){const e=this.target.blocks.getNextBlock(this.peekStack());this.reuseStackForNextBlock(e)}isRecursiveCall(e){let t=5;for(let n=this.stackFrames.length-1-1;n>=0;n--){const r=this.target.blocks.getBlock(this.stackFrames[n].op.id)||this.target.runtime.flyoutBlocks.getBlock(this.stackFrames[n].op.id);if("procedures_call"===r.opcode&&r.mutation.proccode===e)return!0;if(--t<0)return!1}return!1}tryCompile(){if(!this.blockContainer)return;const e=n(187);this.triedToCompile=!0;const t=!this.stackClick,i=this.topBlock,s=this.blockContainer.getBlock(i)?this.blockContainer:this.target.runtime.flyoutBlocks,o=t&&s.getCachedCompileResult(i);if(o&&!o.success)return;let a;if(o)a=o.value;else try{a=e(this),t&&s.cacheCompileResult(i,a)}catch(e){return r.error("cannot compile script",this.target.getName(),e),t&&s.cacheCompileError(i,e),void this.target.runtime.emitCompileError(this.target,e)}this.procedures={};for(const e of Object.keys(a.procedures))this.procedures[e]=a.procedures[e](this);this.generator=a.startingFunction(this)(),this.executableHat=a.executableHat,this.blockContainer.forceNoGlow||(this.blockGlowInFrame=this.topBlock,this.requestScriptGlowInFrame=!0),this.isCompiled=!0}}o._StackFrame=s,e.exports=o},function(e,t,n){n(104),e.exports={TextEncoder:TextEncoder,TextDecoder:TextDecoder}},function(e,t,n){(function(t,n,r,i){e.exports=function e(t,n,r){function i(o,a){if(!n[o]){if(!t[o]){if(s)return s(o,!0);var c=new Error("Cannot find module '"+o+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[o]={exports:{}};t[o][0].call(l.exports,(function(e){return i(t[o][1][e]||e)}),l,l.exports,e,t,n,r)}return n[o].exports}for(var s=!1,o=0;o<r.length;o++)i(r[o]);return i}({1:[function(e,t,n){"use strict";var r=e("./utils"),i=e("./support"),s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";n.encode=function(e){for(var t,n,i,o,a,c,l,u=[],h=0,d=e.length,p=d,f="string"!==r.getTypeOf(e);h<e.length;)p=d-h,i=f?(t=e[h++],n=h<d?e[h++]:0,h<d?e[h++]:0):(t=e.charCodeAt(h++),n=h<d?e.charCodeAt(h++):0,h<d?e.charCodeAt(h++):0),o=t>>2,a=(3&t)<<4|n>>4,c=1<p?(15&n)<<2|i>>6:64,l=2<p?63&i:64,u.push(s.charAt(o)+s.charAt(a)+s.charAt(c)+s.charAt(l));return u.join("")},n.decode=function(e){var t,n,r,o,a,c,l=0,u=0,h="data:";if(e.substr(0,h.length)===h)throw new Error("Invalid base64 input, it looks like a data url.");var d,p=3*(e=e.replace(/[^A-Za-z0-9+/=]/g,"")).length/4;if(e.charAt(e.length-1)===s.charAt(64)&&p--,e.charAt(e.length-2)===s.charAt(64)&&p--,p%1!=0)throw new Error("Invalid base64 input, bad content length.");for(d=i.uint8array?new Uint8Array(0|p):new Array(0|p);l<e.length;)t=s.indexOf(e.charAt(l++))<<2|(o=s.indexOf(e.charAt(l++)))>>4,n=(15&o)<<4|(a=s.indexOf(e.charAt(l++)))>>2,r=(3&a)<<6|(c=s.indexOf(e.charAt(l++))),d[u++]=t,64!==a&&(d[u++]=n),64!==c&&(d[u++]=r);return d}},{"./support":30,"./utils":32}],2:[function(e,t,n){"use strict";var r=e("./external"),i=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}a.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){"use strict";var r=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new r("STORE compression")},uncompressWorker:function(){return new r("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){"use strict";var r=e("./utils"),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==r.getTypeOf(e)?function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a<o;a++)e=e>>>8^s[255&(e^t[a])];return~e}(0|t,e,e.length,0):function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a<o;a++)e=e>>>8^s[255&(e^t.charCodeAt(a))];return~e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){"use strict";n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){"use strict";var r=null;r="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,i=e("./utils"),s=e("./stream/GenericWorker"),o=r?"uint8array":"array";function a(e,t){s.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",i.inherits(a,s),a.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(i.transformTo(o,e.data),!1)},a.prototype.flush=function(){s.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},a.prototype.cleanUp=function(){s.prototype.cleanUp.call(this),this._pako=null},a.prototype._createPako=function(){var t=e("pako");this._pako=new t[this._pakoAction]({chunkSize:65536,raw:!0,level:this._pakoOptions.level||-1});var n=this;this._pako.onData=function(e){n.push({data:e,meta:n.meta})}},n.compressWorker=function(e){return new a("Deflate",e)},n.uncompressWorker=function(){return new a("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){"use strict";function r(e,t){var n,r="";for(n=0;n<t;n++)r+=String.fromCharCode(255&e),e>>>=8;return r}function i(e,t,n,i,o,u){var h,d,p=e.file,f=e.compression,m=u!==a.utf8encode,g=s.transformTo("string",u(p.name)),b=s.transformTo("string",a.utf8encode(p.name)),y=p.comment,E=s.transformTo("string",u(y)),T=s.transformTo("string",a.utf8encode(y)),v=b.length!==p.name.length,A=T.length!==y.length,w="",S="",k="",O=p.dir,I=p.date,N={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(N.crc32=e.crc32,N.compressedSize=e.compressedSize,N.uncompressedSize=e.uncompressedSize);var R=0;t&&(R|=8),m||!v&&!A||(R|=2048);var x=0,M=0;O&&(x|=16),"UNIX"===o?(M=798,x|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,O)):(M=20,x|=function(e){return 63&(e||0)}(p.dosPermissions)),h=I.getUTCHours(),h<<=6,h|=I.getUTCMinutes(),h<<=5,h|=I.getUTCSeconds()/2,d=I.getUTCFullYear()-1980,d<<=4,d|=I.getUTCMonth()+1,d<<=5,d|=I.getUTCDate(),v&&(S=r(1,1)+r(c(g),4)+b,w+="up"+r(S.length,2)+S),A&&(k=r(1,1)+r(c(E),4)+T,w+="uc"+r(k.length,2)+k);var C="";return C+="\n\0",C+=r(R,2),C+=f.magic,C+=r(h,2),C+=r(d,2),C+=r(N.crc32,4),C+=r(N.compressedSize,4),C+=r(N.uncompressedSize,4),C+=r(g.length,2),C+=r(w.length,2),{fileRecord:l.LOCAL_FILE_HEADER+C+g+w,dirRecord:l.CENTRAL_FILE_HEADER+r(M,2)+C+r(E.length,2)+"\0\0\0\0"+r(x,4)+r(i,4)+g+w+E}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),c=e("../crc32"),l=e("../signature");function u(e,t,n,r){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t<this.dirRecords.length;t++)this.push({data:this.dirRecords[t],meta:{percent:100}});var n=this.bytesWritten-e,i=function(e,t,n,i,o){var a=s.transformTo("string",o(i));return l.CENTRAL_DIRECTORY_END+"\0\0\0\0"+r(e,2)+r(e,2)+r(t,4)+r(n,4)+r(a.length,2)+a}(this.dirRecords.length,n,e,this.zipComment,this.encodeFileName);this.push({data:i,meta:{percent:100}})},u.prototype.prepareNextSource=function(){this.previous=this._sources.shift(),this.openedSource(this.previous.streamInfo),this.isPaused?this.previous.pause():this.previous.resume()},u.prototype.registerPrevious=function(e){this._sources.push(e);var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.closedSource(t.previous.streamInfo),t._sources.length?t.prepareNextSource():t.end()})),e.on("error",(function(e){t.error(e)})),this},u.prototype.resume=function(){return!!o.prototype.resume.call(this)&&(!this.previous&&this._sources.length?(this.prepareNextSource(),!0):this.previous||this._sources.length||this.generatedError?void 0:(this.end(),!0))},u.prototype.error=function(e){var t=this._sources;if(!o.prototype.error.call(this,e))return!1;for(var n=0;n<t.length;n++)try{t[n].error(e)}catch(e){}return!0},u.prototype.lock=function(){o.prototype.lock.call(this);for(var e=this._sources,t=0;t<e.length;t++)e[t].lock()},t.exports=u},{"../crc32":4,"../signature":23,"../stream/GenericWorker":28,"../utf8":31,"../utils":32}],9:[function(e,t,n){"use strict";var r=e("../compressions"),i=e("./ZipFileWorker");n.generateWorker=function(e,t,n){var s=new i(t.streamFiles,n,t.platform,t.encodeFileName),o=0;try{e.forEach((function(e,n){o++;var i=function(e,t){var n=e||t,i=r[n];if(!i)throw new Error(n+" is not a valid compression method !");return i}(n.options.compression,t.compression),a=n.options.compressionOptions||t.compressionOptions||{},c=n.dir,l=n.date;n._compressWorker(i,a).withStreamInfo("file",{name:e,dir:c,date:l,comment:n.comment||"",unixPermissions:n.unixPermissions,dosPermissions:n.dosPermissions}).pipe(s)})),s.entriesCount=o}catch(e){s.error(e)}return s}},{"../compressions":3,"./ZipFileWorker":8}],10:[function(e,t,n){"use strict";function r(){if(!(this instanceof r))return new r;if(arguments.length)throw new Error("The constructor with parameters has been removed in JSZip 3.0, please check the upgrade guide.");this.files=Object.create(null),this.comment=null,this.root="",this.clone=function(){var e=new r;for(var t in this)"function"!=typeof this[t]&&(e[t]=this[t]);return e}}(r.prototype=e("./object")).loadAsync=e("./load"),r.support=e("./support"),r.defaults=e("./defaults"),r.loadAsync=function(e,t){return(new r).loadAsync(e,t)},r.external=e("./external"),t.exports=r},{"./defaults":5,"./external":6,"./load":11,"./object":15,"./support":30}],11:[function(e,t,n){"use strict";var r=e("./utils"),i=e("./external"),s=e("./utf8"),o=e("./zipEntries"),a=e("./stream/Crc32Probe"),c=e("./nodejsUtils");function l(e){return new i.Promise((function(t,n){var r=e.decompressed.getContentWorker().pipe(new a);r.on("error",(function(e){n(e)})).on("end",(function(){r.streamInfo.crc32!==e.decompressed.crc32?n(new Error("Corrupted zip : CRC32 mismatch")):t()})).resume()}))}t.exports=function(e,t){var n=this;return t=r.extend(t||{},{base64:!1,checkCRC32:!1,optimizedBinaryString:!1,createFolders:!1,decodeFileName:s.utf8decode}),c.isNode&&c.isStream(e)?i.Promise.reject(new Error("JSZip can't accept a stream when loading a zip file.")):r.prepareContent("the loaded zip file",e,!0,t.optimizedBinaryString,t.base64).then((function(e){var n=new o(t);return n.load(e),n})).then((function(e){var n=[i.Promise.resolve(e)],r=e.files;if(t.checkCRC32)for(var s=0;s<r.length;s++)n.push(l(r[s]));return i.Promise.all(n)})).then((function(e){for(var i=e.shift(),s=i.files,o=0;o<s.length;o++){var a=s[o],c=a.fileNameStr,l=r.resolve(a.fileNameStr);n.file(l,a.decompressed,{binary:!0,optimizedBinaryString:!0,date:a.date,dir:a.dir,comment:a.fileCommentStr.length?a.fileCommentStr:null,unixPermissions:a.unixPermissions,dosPermissions:a.dosPermissions,createFolders:t.createFolders}),a.dir||(n.file(l).unsafeOriginalName=c)}return i.zipComment.length&&(n.comment=i.zipComment),n}))}},{"./external":6,"./nodejsUtils":14,"./stream/Crc32Probe":25,"./utf8":31,"./utils":32,"./zipEntries":33}],12:[function(e,t,n){"use strict";var r=e("../utils"),i=e("../stream/GenericWorker");function s(e,t){i.call(this,"Nodejs stream input adapter for "+e),this._upstreamEnded=!1,this._bindStream(t)}r.inherits(s,i),s.prototype._bindStream=function(e){var t=this;(this._stream=e).pause(),e.on("data",(function(e){t.push({data:e,meta:{percent:0}})})).on("error",(function(e){t.isPaused?this.generatedError=e:t.error(e)})).on("end",(function(){t.isPaused?t._upstreamEnded=!0:t.end()}))},s.prototype.pause=function(){return!!i.prototype.pause.call(this)&&(this._stream.pause(),!0)},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(this._upstreamEnded?this.end():this._stream.resume(),!0)},t.exports=s},{"../stream/GenericWorker":28,"../utils":32}],13:[function(e,t,n){"use strict";var r=e("readable-stream").Readable;function i(e,t,n){r.call(this,t),this._helper=e;var i=this;e.on("data",(function(e,t){i.push(e)||i._helper.pause(),n&&n(t)})).on("error",(function(e){i.emit("error",e)})).on("end",(function(){i.push(null)}))}e("../utils").inherits(i,r),i.prototype._read=function(){this._helper.resume()},t.exports=i},{"../utils":32,"readable-stream":16}],14:[function(e,n,r){"use strict";n.exports={isNode:void 0!==t,newBufferFrom:function(e,n){if(t.from&&t.from!==Uint8Array.from)return t.from(e,n);if("number"==typeof e)throw new Error('The "data" argument must not be a number');return new t(e,n)},allocBuffer:function(e){if(t.alloc)return t.alloc(e);var n=new t(e);return n.fill(0),n},isBuffer:function(e){return t.isBuffer(e)},isStream:function(e){return e&&"function"==typeof e.on&&"function"==typeof e.pause&&"function"==typeof e.resume}}},{}],15:[function(e,t,n){"use strict";function r(e,t,n){var r,i=s.getTypeOf(t),a=s.extend(n||{},c);a.date=a.date||new Date(1716106843e3),null!==a.compression&&(a.compression=a.compression.toUpperCase()),"string"==typeof a.unixPermissions&&(a.unixPermissions=parseInt(a.unixPermissions,8)),a.unixPermissions&&16384&a.unixPermissions&&(a.dir=!0),a.dosPermissions&&16&a.dosPermissions&&(a.dir=!0),a.dir&&(e=m(e)),a.createFolders&&(r=f(e))&&g.call(this,r,!0);var h="string"===i&&!1===a.binary&&!1===a.base64;n&&void 0!==n.binary||(a.binary=!h),(t instanceof l&&0===t.uncompressedSize||a.dir||!t||0===t.length)&&(a.base64=!1,a.binary=!0,t="",a.compression="STORE",i="string");var b=null;b=t instanceof l||t instanceof o?t:d.isNode&&d.isStream(t)?new p(e,t):s.prepareContent(e,t,a.binary,a.optimizedBinaryString,a.base64);var y=new u(e,b,a);this.files[e]=y}var i=e("./utf8"),s=e("./utils"),o=e("./stream/GenericWorker"),a=e("./stream/StreamHelper"),c=e("./defaults"),l=e("./compressedObject"),u=e("./zipObject"),h=e("./generate"),d=e("./nodejsUtils"),p=e("./nodejs/NodejsStreamInputAdapter"),f=function(e){"/"===e.slice(-1)&&(e=e.substring(0,e.length-1));var t=e.lastIndexOf("/");return 0<t?e.substring(0,t):""},m=function(e){return"/"!==e.slice(-1)&&(e+="/"),e},g=function(e,t){return t=void 0!==t?t:c.createFolders,e=m(e),this.files[e]||r.call(this,e,null,{dir:!0,createFolders:t}),this.files[e]};function b(e){return"[object RegExp]"===Object.prototype.toString.call(e)}var y={load:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},forEach:function(e){var t,n,r;for(t in this.files)r=this.files[t],(n=t.slice(this.root.length,t.length))&&t.slice(0,this.root.length)===this.root&&e(n,r)},filter:function(e){var t=[];return this.forEach((function(n,r){e(n,r)&&t.push(r)})),t},file:function(e,t,n){if(1!==arguments.length)return e=this.root+e,r.call(this,e,t,n),this;if(b(e)){var i=e;return this.filter((function(e,t){return!t.dir&&i.test(e)}))}var s=this.files[this.root+e];return s&&!s.dir?s:null},folder:function(e){if(!e)return this;if(b(e))return this.filter((function(t,n){return n.dir&&e.test(t)}));var t=this.root+e,n=g.call(this,t),r=this.clone();return r.root=n.name,r},remove:function(e){e=this.root+e;var t=this.files[e];if(t||("/"!==e.slice(-1)&&(e+="/"),t=this.files[e]),t&&!t.dir)delete this.files[e];else for(var n=this.filter((function(t,n){return n.name.slice(0,e.length)===e})),r=0;r<n.length;r++)delete this.files[n[r].name];return this},generate:function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},generateInternalStream:function(e){var t,n={};try{if((n=s.extend(e||{},{streamFiles:!1,compression:"STORE",compressionOptions:null,type:"",platform:"DOS",comment:null,mimeType:"application/zip",encodeFileName:i.utf8encode})).type=n.type.toLowerCase(),n.compression=n.compression.toUpperCase(),"binarystring"===n.type&&(n.type="string"),!n.type)throw new Error("No output type specified.");s.checkSupport(n.type),"darwin"!==n.platform&&"freebsd"!==n.platform&&"linux"!==n.platform&&"sunos"!==n.platform||(n.platform="UNIX"),"win32"===n.platform&&(n.platform="DOS");var r=n.comment||this.comment||"";t=h.generateWorker(this,n,r)}catch(e){(t=new o("error")).error(e)}return new a(t,n.type||"string",n.mimeType)},generateAsync:function(e,t){return this.generateInternalStream(e).accumulate(t)},generateNodeStream:function(e,t){return(e=e||{}).type||(e.type="nodebuffer"),this.generateInternalStream(e).toNodejsStream(t)}};t.exports=y},{"./compressedObject":2,"./defaults":5,"./generate":9,"./nodejs/NodejsStreamInputAdapter":12,"./nodejsUtils":14,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31,"./utils":32,"./zipObject":35}],16:[function(e,t,n){"use strict";t.exports=e("stream")},{stream:void 0}],17:[function(e,t,n){"use strict";var r=e("./DataReader");function i(e){r.call(this,e);for(var t=0;t<this.data.length;t++)e[t]=255&e[t]}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data[this.zero+e]},i.prototype.lastIndexOfSignature=function(e){for(var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),s=this.length-4;0<=s;--s)if(this.data[s]===t&&this.data[s+1]===n&&this.data[s+2]===r&&this.data[s+3]===i)return s-this.zero;return-1},i.prototype.readAndCheckSignature=function(e){var t=e.charCodeAt(0),n=e.charCodeAt(1),r=e.charCodeAt(2),i=e.charCodeAt(3),s=this.readData(4);return t===s[0]&&n===s[1]&&r===s[2]&&i===s[3]},i.prototype.readData=function(e){if(this.checkOffset(e),0===e)return[];var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],18:[function(e,t,n){"use strict";var r=e("../utils");function i(e){this.data=e,this.length=e.length,this.index=0,this.zero=0}i.prototype={checkOffset:function(e){this.checkIndex(this.index+e)},checkIndex:function(e){if(this.length<this.zero+e||e<0)throw new Error("End of data reached (data length = "+this.length+", asked index = "+e+"). Corrupted zip ?")},setIndex:function(e){this.checkIndex(e),this.index=e},skip:function(e){this.setIndex(this.index+e)},byteAt:function(){},readInt:function(e){var t,n=0;for(this.checkOffset(e),t=this.index+e-1;t>=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){"use strict";var r=e("./Uint8ArrayReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){"use strict";var r=e("./DataReader");function i(e){r.call(this,e)}e("../utils").inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){"use strict";var r=e("./ArrayReader"),i=e("./DataReader");function s(e){i.call(this,e)}e("../utils").inherits(s,r),s.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=s},{"../utils":32,"./ArrayReader":17,"./DataReader":18}],22:[function(e,t,n){"use strict";var r=e("../utils"),i=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),c=e("./Uint8ArrayReader");t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),"string"!==t||i.uint8array?"nodebuffer"===t?new a(e):i.uint8array?new c(r.transformTo("uint8array",e)):new s(r.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){"use strict";n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../utils");function s(e){r.call(this,"ConvertWorker to "+e),this.destType=e}i.inherits(s,r),s.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){"use strict";var r=e("./GenericWorker"),i=e("../crc32");function s(){r.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,r),s.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(s,i),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){"use strict";var r=e("../utils"),i=e("./GenericWorker");function s(e){i.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}r.inherits(s,i),s.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+65536);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":case"nodebuffer":e=this.data.subarray(this.index,t);break;case"array":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){"use strict";function r(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n<this._listeners[e].length;n++)this._listeners[e][n].call(this,t)},pipe:function(e){return e.registerPrevious(this)},registerPrevious:function(e){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.streamInfo=e.streamInfo,this.mergeStreamInfo(),this.previous=e;var t=this;return e.on("data",(function(e){t.processChunk(e)})),e.on("end",(function(){t.end()})),e.on("error",(function(e){t.error(e)})),this},pause:function(){return!this.isPaused&&!this.isFinished&&(this.isPaused=!0,this.previous&&this.previous.pause(),!0)},resume:function(){if(!this.isPaused||this.isFinished)return!1;var e=this.isPaused=!1;return this.generatedError&&(this.error(this.generatedError),e=!0),this.previous&&this.previous.resume(),!e},flush:function(){},processChunk:function(e){this.push(e)},withStreamInfo:function(e,t){return this.extraStreamInfo[e]=t,this.mergeStreamInfo(),this},mergeStreamInfo:function(){for(var e in this.extraStreamInfo)Object.prototype.hasOwnProperty.call(this.extraStreamInfo,e)&&(this.streamInfo[e]=this.extraStreamInfo[e])},lock:function(){if(this.isLocked)throw new Error("The stream '"+this+"' has already been used.");this.isLocked=!0,this.previous&&this.previous.lock()},toString:function(){var e="Worker "+this.name;return this.previous?this.previous+" -> "+e:e}},t.exports=r},{}],29:[function(e,n,r){"use strict";var i=e("../utils"),s=e("./ConvertWorker"),o=e("./GenericWorker"),a=e("../base64"),c=e("../support"),l=e("../external"),u=null;if(c.nodestream)try{u=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,n){return new l.Promise((function(r,s){var o=[],c=e._internalType,l=e._outputType,u=e._mimeType;e.on("data",(function(e,t){o.push(e),n&&n(t)})).on("error",(function(e){o=[],s(e)})).on("end",(function(){try{var e=function(e,t,n){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),n);case"base64":return a.encode(t);default:return i.transformTo(e,t)}}(l,function(e,n){var r,i=0,s=null,o=0;for(r=0;r<n.length;r++)o+=n[r].length;switch(e){case"string":return n.join("");case"array":return Array.prototype.concat.apply([],n);case"uint8array":for(s=new Uint8Array(o),r=0;r<n.length;r++)s.set(n[r],i),i+=n[r].length;return s;case"nodebuffer":return t.concat(n);default:throw new Error("concat : unsupported type '"+e+"'")}}(c,o),u);r(e)}catch(e){s(e)}o=[]})).resume()}))}function d(e,t,n){var r=t;switch(t){case"blob":case"arraybuffer":r="uint8array";break;case"base64":r="string"}try{this._internalType=r,this._outputType=t,this._mimeType=n,i.checkSupport(r),this._worker=e.pipe(new s(r)),e.lock()}catch(e){this._worker=new o("error"),this._worker.error(e)}}d.prototype={accumulate:function(e){return h(this,e)},on:function(e,t){var n=this;return"data"===e?this._worker.on(e,(function(e){t.call(n,e.data,e.meta)})):this._worker.on(e,(function(){i.delay(t,arguments,n)})),this},resume:function(){return i.delay(this._worker.resume,[],this._worker),this},pause:function(){return this._worker.pause(),this},toNodejsStream:function(e){if(i.checkSupport("nodestream"),"nodebuffer"!==this._outputType)throw new Error(this._outputType+" is not supported by this method");return new u(this,{objectMode:"nodebuffer"!==this._outputType},e)}},n.exports=d},{"../base64":1,"../external":6,"../nodejs/NodejsStreamOutputAdapter":13,"../support":30,"../utils":32,"./ConvertWorker":24,"./GenericWorker":28}],30:[function(e,n,r){"use strict";if(r.base64=!0,r.array=!0,r.string=!0,r.arraybuffer="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof Uint8Array,r.nodebuffer=void 0!==t,r.uint8array="undefined"!=typeof Uint8Array,"undefined"==typeof ArrayBuffer)r.blob=!1;else{var i=new ArrayBuffer(0);try{r.blob=0===new Blob([i],{type:"application/zip"}).size}catch(e){try{var s=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);s.append(i),r.blob=0===s.getBlob("application/zip").size}catch(e){r.blob=!1}}}try{r.nodestream=!!e("readable-stream").Readable}catch(e){r.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){"use strict";for(var r=e("./utils"),i=e("./support"),s=e("./nodejsUtils"),o=e("./stream/GenericWorker"),a=new Array(256),c=0;c<256;c++)a[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;function l(){o.call(this,"utf-8 decode"),this.leftOver=null}function u(){o.call(this,"utf-8 encode")}a[254]=a[254]=1,n.utf8encode=function(e){return i.nodebuffer?s.newBufferFrom(e,"utf-8"):function(e){var t,n,r,s,o,a=e.length,c=0;for(s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=i.uint8array?new Uint8Array(c):new Array(c),s=o=0;o<c;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(r=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(r-56320),s++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,i,s,o=e.length,c=new Array(2*o);for(t=n=0;t<o;)if((i=e[t++])<128)c[n++]=i;else if(4<(s=a[i]))c[n++]=65533,t+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&t<o;)i=i<<6|63&e[t++],s--;1<s?c[n++]=65533:i<65536?c[n++]=i:(i-=65536,c[n++]=55296|i>>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?"uint8array":"array",e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,r){"use strict";var i=e("./support"),s=e("./base64"),o=e("./nodejsUtils"),a=e("./external");function c(e){return e}function l(e,t){for(var n=0;n<e.length;++n)t[n]=255&e.charCodeAt(n);return t}e("setimmediate"),r.newBlob=function(e,t){r.checkSupport("blob");try{return new Blob([e],{type:t})}catch(r){try{var n=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);return n.append(e),n.getBlob(t)}catch(e){throw new Error("Bug : can't construct the Blob.")}}};var u={stringifyByChunk:function(e,t,n){var r=[],i=0,s=e.length;if(s<=n)return String.fromCharCode.apply(null,e);for(;i<s;)"array"===t||"nodebuffer"===t?r.push(String.fromCharCode.apply(null,e.slice(i,Math.min(i+n,s)))):r.push(String.fromCharCode.apply(null,e.subarray(i,Math.min(i+n,s)))),i+=n;return r.join("")},stringifyByChar:function(e){for(var t="",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},applyCanBeUsed:{uint8array:function(){try{return i.uint8array&&1===String.fromCharCode.apply(null,new Uint8Array(1)).length}catch(e){return!1}}(),nodebuffer:function(){try{return i.nodebuffer&&1===String.fromCharCode.apply(null,o.allocBuffer(1)).length}catch(e){return!1}}()}};function h(e){var t=65536,n=r.getTypeOf(e),i=!0;if("uint8array"===n?i=u.applyCanBeUsed.uint8array:"nodebuffer"===n&&(i=u.applyCanBeUsed.nodebuffer),i)for(;1<t;)try{return u.stringifyByChunk(e,n,t)}catch(e){t=Math.floor(t/2)}return u.stringifyByChar(e)}function d(e,t){for(var n=0;n<e.length;n++)t[n]=e[n];return t}r.applyFromCharCode=h;var p={};p.string={string:c,array:function(e){return l(e,new Array(e.length))},arraybuffer:function(e){return p.string.uint8array(e).buffer},uint8array:function(e){return l(e,new Uint8Array(e.length))},nodebuffer:function(e){return l(e,o.allocBuffer(e.length))}},p.array={string:h,array:c,arraybuffer:function(e){return new Uint8Array(e).buffer},uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(e)}},p.arraybuffer={string:function(e){return h(new Uint8Array(e))},array:function(e){return d(new Uint8Array(e),new Array(e.byteLength))},arraybuffer:c,uint8array:function(e){return new Uint8Array(e)},nodebuffer:function(e){return o.newBufferFrom(new Uint8Array(e))}},p.uint8array={string:h,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:c,nodebuffer:function(e){return o.newBufferFrom(e)}},p.nodebuffer={string:h,array:function(e){return d(e,new Array(e.length))},arraybuffer:function(e){return e.buffer},uint8array:function(e){return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)},nodebuffer:c},r.transformTo=function(e,t){if(t=t||"",!e)return t;r.checkSupport(e);var n=r.getTypeOf(t);return p[n][e](t)},r.resolve=function(e){for(var t=e.split("/"),n=[],r=0;r<t.length;r++){var i=t[r];"."===i||""===i&&0!==r&&r!==t.length-1||(".."===i?n.pop():n.push(i))}return n.join("/")},r.getTypeOf=function(e){return"string"==typeof e?"string":"[object Array]"===Object.prototype.toString.call(e)?"array":i.nodebuffer&&o.isBuffer(e)?"nodebuffer":i.uint8array&&e instanceof Uint8Array?"uint8array":i.arraybuffer&&e instanceof ArrayBuffer?"arraybuffer":void 0},r.checkSupport=function(e){if(!i[e.toLowerCase()])throw new Error(e+" is not supported by this platform")},r.MAX_VALUE_16BITS=65535,r.MAX_VALUE_32BITS=-1,r.pretty=function(e){var t,n,r="";for(n=0;n<(e||"").length;n++)r+="\\x"+((t=e.charCodeAt(n))<16?"0":"")+t.toString(16).toUpperCase();return r},r.delay=function(e,t,r){n((function(){e.apply(r||null,t||[])}))},r.inherits=function(e,t){function n(){}n.prototype=t.prototype,e.prototype=new n},r.extend=function(){var e,t,n={};for(e=0;e<arguments.length;e++)for(t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&void 0===n[t]&&(n[t]=arguments[e][t]);return n},r.prepareContent=function(e,t,n,o,c){return a.Promise.resolve(t).then((function(e){var t=i.blob&&(e instanceof Blob||-1!==["[object File]","[object Blob]"].indexOf(Object.prototype.toString.call(e)));return t&&"undefined"!=typeof FileReader?new a.Promise((function(t,n){var r=new FileReader;r.onload=function(e){t(e.target.result)},r.onerror=function(e){n(e.target.error)},r.readAsArrayBuffer(e)})):t&&"function"==typeof e.arrayBuffer?e.arrayBuffer():e})).then((function(t){var u=r.getTypeOf(t);return u?("arraybuffer"===u?t=r.transformTo("uint8array",t):"string"===u&&(c?t=s.decode(t):n&&!0!==o&&(t=function(e){return l(e,i.uint8array?new Uint8Array(e.length):new Array(e.length))}(t))),t):a.Promise.reject(new Error("Can't read the data of '"+e+"'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?"))}))}},{"./base64":1,"./external":6,"./nodejsUtils":14,"./support":30,setimmediate:54}],33:[function(e,t,n){"use strict";var r=e("./reader/readerFor"),i=e("./utils"),s=e("./signature"),o=e("./zipEntry"),a=e("./support");function c(e){this.files=[],this.loadOptions=e}c.prototype={checkSignature:function(e){if(!this.reader.readAndCheckSignature(e)){this.reader.index-=4;var t=this.reader.readString(4);throw new Error("Corrupted zip or bug: unexpected signature ("+i.pretty(t)+", expected "+i.pretty(e)+")")}},isSignature:function(e,t){var n=this.reader.index;this.reader.setIndex(e);var r=this.reader.readString(4)===t;return this.reader.setIndex(n),r},readBlockEndOfCentral:function(){this.diskNumber=this.reader.readInt(2),this.diskWithCentralDirStart=this.reader.readInt(2),this.centralDirRecordsOnThisDisk=this.reader.readInt(2),this.centralDirRecords=this.reader.readInt(2),this.centralDirSize=this.reader.readInt(4),this.centralDirOffset=this.reader.readInt(4),this.zipCommentLength=this.reader.readInt(2);var e=this.reader.readData(this.zipCommentLength),t=a.uint8array?"uint8array":"array",n=i.transformTo(t,e);this.zipComment=this.loadOptions.decodeFileName(n)},readBlockZip64EndOfCentral:function(){this.zip64EndOfCentralSize=this.reader.readInt(8),this.reader.skip(4),this.diskNumber=this.reader.readInt(4),this.diskWithCentralDirStart=this.reader.readInt(4),this.centralDirRecordsOnThisDisk=this.reader.readInt(8),this.centralDirRecords=this.reader.readInt(8),this.centralDirSize=this.reader.readInt(8),this.centralDirOffset=this.reader.readInt(8),this.zip64ExtensibleData={};for(var e,t,n,r=this.zip64EndOfCentralSize-44;0<r;)e=this.reader.readInt(2),t=this.reader.readInt(4),n=this.reader.readData(t),this.zip64ExtensibleData[e]={id:e,length:t,value:n}},readBlockZip64EndOfCentralLocator:function(){if(this.diskWithZip64CentralDirStart=this.reader.readInt(4),this.relativeOffsetEndOfZip64CentralDir=this.reader.readInt(8),this.disksCount=this.reader.readInt(4),1<this.disksCount)throw new Error("Multi-volumes zip are not supported")},readLocalFiles:function(){var e,t;for(e=0;e<this.files.length;e++)t=this.files[e],this.reader.setIndex(t.localHeaderOffset),this.checkSignature(s.LOCAL_FILE_HEADER),t.readLocalPart(this.reader),t.handleUTF8(),t.processAttributes()},readCentralDir:function(){var e;for(this.reader.setIndex(this.centralDirOffset);this.reader.readAndCheckSignature(s.CENTRAL_FILE_HEADER);)(e=new o({zip64:this.zip64},this.loadOptions)).readCentralPart(this.reader),this.files.push(e);if(this.centralDirRecords!==this.files.length&&0!==this.centralDirRecords&&0===this.files.length)throw new Error("Corrupted zip or bug: expected "+this.centralDirRecords+" records in central dir, got "+this.files.length)},readEndOfCentral:function(){var e=this.reader.lastIndexOfSignature(s.CENTRAL_DIRECTORY_END);if(e<0)throw this.isSignature(0,s.LOCAL_FILE_HEADER)?new Error("Corrupted zip: can't find end of central directory"):new Error("Corrupted zip: can't find zip signature or end of central directory");this.reader.setIndex(e);var t=e;if(this.checkSignature(s.CENTRAL_DIRECTORY_END),this.readBlockEndOfCentral(),this.diskNumber===i.MAX_VALUE_16BITS||this.diskWithCentralDirStart===i.MAX_VALUE_16BITS||this.centralDirRecordsOnThisDisk===i.MAX_VALUE_16BITS||this.centralDirRecords===i.MAX_VALUE_16BITS||this.centralDirSize===i.MAX_VALUE_32BITS||this.centralDirOffset===i.MAX_VALUE_32BITS){if(this.zip64=!0,(e=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR))<0)throw new Error("Corrupted zip: can't find the ZIP64 end of central directory locator");if(this.reader.setIndex(e),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_LOCATOR),this.readBlockZip64EndOfCentralLocator(),!this.isSignature(this.relativeOffsetEndOfZip64CentralDir,s.ZIP64_CENTRAL_DIRECTORY_END)&&(this.relativeOffsetEndOfZip64CentralDir=this.reader.lastIndexOfSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.relativeOffsetEndOfZip64CentralDir<0))throw new Error("Corrupted zip: can't find the ZIP64 end of central directory");this.reader.setIndex(this.relativeOffsetEndOfZip64CentralDir),this.checkSignature(s.ZIP64_CENTRAL_DIRECTORY_END),this.readBlockZip64EndOfCentral()}var n=this.centralDirOffset+this.centralDirSize;this.zip64&&(n+=20,n+=12+this.zip64EndOfCentralSize);var r=t-n;if(0<r)this.isSignature(t,s.CENTRAL_FILE_HEADER)||(this.reader.zero=r);else if(r<0)throw new Error("Corrupted zip: missing "+Math.abs(r)+" bytes.")},prepareReader:function(e){this.reader=r(e)},tryRecoverCorruptedZip:function(){this.reader.setIndex(0),this.files=[],this.zipCommentLength=0,this.zipComment=[];for(var e=0,t=this.reader.length,n=0;n<t-4;n++)if(80===this.reader.byteAt(n)&&75===this.reader.byteAt(n+1)&&3===this.reader.byteAt(n+2)&&4===this.reader.byteAt(n+3)){e++;var r=this.tryRecoverFileEntry(n);r&&this.files.push(r)}if(0===this.files.length){if(0===e)throw new Error("Corrupted zip: no central directory or any file headers");throw new Error("Corrupted zip: no central directory, and "+e+" possible local headers could not be recovered")}},tryRecoverFileEntry:function(e){this.reader.setIndex(e);var t=new o({zip64:this.zip64},this.loadOptions);try{return t.readLocalPartFromCorruptedZip(this.reader),t.handleUTF8(),t.processAttributes(),t}catch(e){return this.loadOptions.onUnrecoverableFileEntry&&this.loadOptions.onUnrecoverableFileEntry(e),null}},load:function(e){this.prepareReader(e);try{this.readEndOfCentral(),this.readCentralDir(),this.readLocalFiles()}catch(e){if(!this.loadOptions.recoverCorrupted)throw e;this.loadOptions.onCorruptCentralDirectory&&this.loadOptions.onCorruptCentralDirectory(e),this.tryRecoverCorruptedZip()}}},t.exports=c},{"./reader/readerFor":22,"./signature":23,"./support":30,"./utils":32,"./zipEntry":34}],34:[function(e,t,n){"use strict";function r(e){for(var t in l)if(Object.prototype.hasOwnProperty.call(l,t)&&l[t].magic===e)return l[t];return null}var i=e("./reader/readerFor"),s=e("./utils"),o=e("./compressedObject"),a=e("./crc32"),c=e("./utf8"),l=e("./compressions"),u=e("./support"),h=e("./signature");function d(e,t){this.options=e,this.loadOptions=t}d.prototype={isEncrypted:function(){return!(1&~this.bitFlag)},useUTF8:function(){return!(2048&~this.bitFlag)},readLocalPart:function(e){var t,n;if(e.skip(22),this.fileNameLength=e.readInt(2),n=e.readInt(2),this.fileName=e.readData(this.fileNameLength),e.skip(n),-1===this.compressedSize||-1===this.uncompressedSize)throw new Error("Bug or corrupted zip : didn't get enough information from the central directory (compressedSize === -1 || uncompressedSize === -1)");if(null===(t=r(this.compressionMethod)))throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},readCentralPart:function(e){this.versionMadeBy=e.readInt(2),e.skip(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4);var t=e.readInt(2);if(this.extraFieldsLength=e.readInt(2),this.fileCommentLength=e.readInt(2),this.diskNumberStart=e.readInt(2),this.internalFileAttributes=e.readInt(2),this.externalFileAttributes=e.readInt(4),this.localHeaderOffset=e.readInt(4),this.isEncrypted())throw new Error("Encrypted zip are not supported");e.skip(t),this.readExtraFields(e),this.parseZIP64ExtraField(e),this.fileComment=e.readData(this.fileCommentLength)},readLocalPartFromCorruptedZip:function(e){e.readAndCheckSignature(h.LOCAL_FILE_HEADER),this.versionMadeBy=e.readInt(2),this.bitFlag=e.readInt(2),this.compressionMethod=e.readString(2),this.date=e.readDate(),this.crc32=e.readInt(4),this.compressedSize=e.readInt(4),this.uncompressedSize=e.readInt(4),this.fileNameLength=e.readInt(2),this.extraFieldsLength=e.readInt(2),this.fileName=e.readData(this.fileNameLength),this.readExtraFields(e),this.parseZIP64ExtraField(e);var t=r(this.compressionMethod);if(null===t)throw new Error("Corrupted zip : compression "+s.pretty(this.compressionMethod)+" unknown (inner file : "+s.transformTo("string",this.fileName)+")");this.decompressed=new o(this.compressedSize,this.uncompressedSize,this.crc32,t,e.readData(this.compressedSize))},processAttributes:function(){this.unixPermissions=null,this.dosPermissions=null;var e=this.versionMadeBy>>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===s.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===s.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===s.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===s.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4<i;)t=e.readInt(2),n=e.readInt(2),r=e.readData(n),this.extraFields[t]={id:t,length:n,value:r};e.setIndex(i)},handleUTF8:function(){var e=u.uint8array?"uint8array":"array";if(this.useUTF8())this.fileNameStr=c.utf8decode(this.fileName),this.fileCommentStr=c.utf8decode(this.fileComment);else{var t=this.findExtraFieldUnicodePath();if(null!==t)this.fileNameStr=t;else{var n=s.transformTo(e,this.fileName);this.fileNameStr=this.loadOptions.decodeFileName(n)}var r=this.findExtraFieldUnicodeComment();if(null!==r)this.fileCommentStr=r;else{var i=s.transformTo(e,this.fileComment);this.fileCommentStr=this.loadOptions.decodeFileName(i)}}},findExtraFieldUnicodePath:function(){var e=this.extraFields[28789];if(e){var t=i(e.value);return 1!==t.readInt(1)||a(this.fileName)!==t.readInt(4)?null:c.utf8decode(t.readData(e.length-5))}return null},findExtraFieldUnicodeComment:function(){var e=this.extraFields[25461];if(e){var t=i(e.value);return 1!==t.readInt(1)||a(this.fileComment)!==t.readInt(4)?null:c.utf8decode(t.readData(e.length-5))}return null}},t.exports=d},{"./compressedObject":2,"./compressions":3,"./crc32":4,"./reader/readerFor":22,"./signature":23,"./support":30,"./utf8":31,"./utils":32}],35:[function(e,t,n){"use strict";function r(e,t,n){this.name=e,this.dir=n.dir,this.date=n.date,this.comment=n.comment,this.unixPermissions=n.unixPermissions,this.dosPermissions=n.dosPermissions,this._data=t,this._dataBinary=n.binary,this.options={compression:n.compression,compressionOptions:n.compressionOptions}}var i=e("./stream/StreamHelper"),s=e("./stream/DataWorker"),o=e("./utf8"),a=e("./compressedObject"),c=e("./stream/GenericWorker");r.prototype={internalStream:function(e){var t=null,n="string";try{if(!e)throw new Error("No output type specified.");var r="string"===(n=e.toLowerCase())||"text"===n;"binarystring"!==n&&"text"!==n||(n="string"),t=this._decompressWorker();var s=!this._dataBinary;s&&!r&&(t=t.pipe(new o.Utf8EncodeWorker)),!s&&r&&(t=t.pipe(new o.Utf8DecodeWorker))}catch(e){(t=new c("error")).error(e)}return new i(t,n,"")},async:function(e,t){return this.internalStream(e).accumulate(t)},nodeStream:function(e,t){return this.internalStream(e||"nodebuffer").toNodejsStream(t)},_compressWorker:function(e,t){if(this._data instanceof a&&this._data.compression.magic===e.magic)return this._data.getCompressedWorker();var n=this._decompressWorker();return this._dataBinary||(n=n.pipe(new o.Utf8EncodeWorker)),a.createWorkerFrom(n,e,t)},_decompressWorker:function(){return this._data instanceof a?this._data.getContentWorker():this._data instanceof c?this._data:new s(this._data)}};for(var l=["asText","asBinary","asNodeBuffer","asUint8Array","asArrayBuffer"],u=function(){throw new Error("This method has been removed in JSZip 3.0, please check the upgrade guide.")},h=0;h<l.length;h++)r.prototype[l[h]]=u;t.exports=r},{"./compressedObject":2,"./stream/DataWorker":27,"./stream/GenericWorker":28,"./stream/StreamHelper":29,"./utf8":31}],36:[function(e,t,n){(function(e){"use strict";var n,r,i=e.MutationObserver||e.WebKitMutationObserver;if(i){var s=0,o=new i(u),a=e.document.createTextNode("");o.observe(a,{characterData:!0}),n=function(){a.data=s=++s%2}}else if(e.setImmediate||void 0===e.MessageChannel)n="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var c=new e.MessageChannel;c.port1.onmessage=u,n=function(){c.port2.postMessage(0)}}var l=[];function u(){var e,t;r=!0;for(var n=l.length;n;){for(t=l,l=[],e=-1;++e<n;)t[e]();n=l.length}r=!1}t.exports=function(e){1!==l.push(e)||r||n()}}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],37:[function(e,t,n){"use strict";var r=e("immediate");function i(){}var s={},o=["REJECTED"],a=["FULFILLED"],c=["PENDING"];function l(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=c,this.queue=[],this.outcome=void 0,e!==i&&p(this,e)}function u(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function h(e,t,n){r((function(){var r;try{r=t(n)}catch(r){return s.reject(e,r)}r===e?s.reject(e,new TypeError("Cannot resolve promise with itself")):s.resolve(e,r)}))}function d(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function p(e,t){var n=!1;function r(t){n||(n=!0,s.reject(e,t))}function i(t){n||(n=!0,s.resolve(e,t))}var o=f((function(){t(i,r)}));"error"===o.status&&r(o.value)}function f(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=l).prototype.finally=function(e){if("function"!=typeof e)return this;var t=this.constructor;return this.then((function(n){return t.resolve(e()).then((function(){return n}))}),(function(n){return t.resolve(e()).then((function(){throw n}))}))},l.prototype.catch=function(e){return this.then(null,e)},l.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===o)return this;var n=new this.constructor(i);return this.state!==c?h(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){s.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){h(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){s.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){h(this.promise,this.onRejected,e)},s.resolve=function(e,t){var n=f(d,t);if("error"===n.status)return s.reject(e,n.value);var r=n.value;if(r)p(e,r);else{e.state=a,e.outcome=t;for(var i=-1,o=e.queue.length;++i<o;)e.queue[i].callFulfilled(t)}return e},s.reject=function(e,t){e.state=o,e.outcome=t;for(var n=-1,r=e.queue.length;++n<r;)e.queue[n].callRejected(t);return e},l.resolve=function(e){return e instanceof this?e:s.resolve(new this(i),e)},l.reject=function(e){var t=new this(i);return s.reject(t,e)},l.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var o=new Array(n),a=0,c=-1,l=new this(i);++c<n;)u(e[c],c);return l;function u(e,i){t.resolve(e).then((function(e){o[i]=e,++a!==n||r||(r=!0,s.resolve(l,o))}),(function(e){r||(r=!0,s.reject(l,e))}))}},l.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,r=!1;if(!n)return this.resolve([]);for(var o,a=-1,c=new this(i);++a<n;)o=e[a],t.resolve(o).then((function(e){r||(r=!0,s.resolve(c,e))}),(function(e){r||(r=!0,s.reject(c,e))}));return c}},{immediate:36}],38:[function(e,t,n){"use strict";var r={};(0,e("./lib/utils/common").assign)(r,e("./lib/deflate"),e("./lib/inflate"),e("./lib/zlib/constants")),t.exports=r},{"./lib/deflate":39,"./lib/inflate":40,"./lib/utils/common":41,"./lib/zlib/constants":44}],39:[function(e,t,n){"use strict";var r=e("./zlib/deflate"),i=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/messages"),a=e("./zlib/zstream"),c=Object.prototype.toString,l=0,u=-1,h=0,d=8;function p(e){if(!(this instanceof p))return new p(e);this.options=i.assign({level:u,method:d,chunkSize:16384,windowBits:15,memLevel:8,strategy:h,to:""},e||{});var t=this.options;t.raw&&0<t.windowBits?t.windowBits=-t.windowBits:t.gzip&&0<t.windowBits&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var n=r.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==l)throw new Error(o[n]);if(t.header&&r.deflateSetHeader(this.strm,t.header),t.dictionary){var f;if(f="string"==typeof t.dictionary?s.string2buf(t.dictionary):"[object ArrayBuffer]"===c.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(n=r.deflateSetDictionary(this.strm,f))!==l)throw new Error(o[n]);this._dict_set=!0}}function f(e,t){var n=new p(t);if(n.push(e,!0),n.err)throw n.msg||o[n.err];return n.result}p.prototype.push=function(e,t){var n,o,a=this.strm,u=this.options.chunkSize;if(this.ended)return!1;o=t===~~t?t:!0===t?4:0,"string"==typeof e?a.input=s.string2buf(e):"[object ArrayBuffer]"===c.call(e)?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(0===a.avail_out&&(a.output=new i.Buf8(u),a.next_out=0,a.avail_out=u),1!==(n=r.deflate(a,o))&&n!==l)return this.onEnd(n),!(this.ended=!0);0!==a.avail_out&&(0!==a.avail_in||4!==o&&2!==o)||("string"===this.options.to?this.onData(s.buf2binstring(i.shrinkBuf(a.output,a.next_out))):this.onData(i.shrinkBuf(a.output,a.next_out)))}while((0<a.avail_in||0===a.avail_out)&&1!==n);return 4===o?(n=r.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===l):2!==o||(this.onEnd(l),!(a.avail_out=0))},p.prototype.onData=function(e){this.chunks.push(e)},p.prototype.onEnd=function(e){e===l&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Deflate=p,n.deflate=f,n.deflateRaw=function(e,t){return(t=t||{}).raw=!0,f(e,t)},n.gzip=function(e,t){return(t=t||{}).gzip=!0,f(e,t)}},{"./utils/common":41,"./utils/strings":42,"./zlib/deflate":46,"./zlib/messages":51,"./zlib/zstream":53}],40:[function(e,t,n){"use strict";var r=e("./zlib/inflate"),i=e("./utils/common"),s=e("./utils/strings"),o=e("./zlib/constants"),a=e("./zlib/messages"),c=e("./zlib/zstream"),l=e("./zlib/gzheader"),u=Object.prototype.toString;function h(e){if(!(this instanceof h))return new h(e);this.options=i.assign({chunkSize:16384,windowBits:0,to:""},e||{});var t=this.options;t.raw&&0<=t.windowBits&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(0<=t.windowBits&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),15<t.windowBits&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new c,this.strm.avail_out=0;var n=r.inflateInit2(this.strm,t.windowBits);if(n!==o.Z_OK)throw new Error(a[n]);if(this.header=new l,r.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=s.string2buf(t.dictionary):"[object ArrayBuffer]"===u.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=r.inflateSetDictionary(this.strm,t.dictionary))!==o.Z_OK))throw new Error(a[n])}function d(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}h.prototype.push=function(e,t){var n,a,c,l,h,d=this.strm,p=this.options.chunkSize,f=this.options.dictionary,m=!1;if(this.ended)return!1;a=t===~~t?t:!0===t?o.Z_FINISH:o.Z_NO_FLUSH,"string"==typeof e?d.input=s.binstring2buf(e):"[object ArrayBuffer]"===u.call(e)?d.input=new Uint8Array(e):d.input=e,d.next_in=0,d.avail_in=d.input.length;do{if(0===d.avail_out&&(d.output=new i.Buf8(p),d.next_out=0,d.avail_out=p),(n=r.inflate(d,o.Z_NO_FLUSH))===o.Z_NEED_DICT&&f&&(n=r.inflateSetDictionary(this.strm,f)),n===o.Z_BUF_ERROR&&!0===m&&(n=o.Z_OK,m=!1),n!==o.Z_STREAM_END&&n!==o.Z_OK)return this.onEnd(n),!(this.ended=!0);d.next_out&&(0!==d.avail_out&&n!==o.Z_STREAM_END&&(0!==d.avail_in||a!==o.Z_FINISH&&a!==o.Z_SYNC_FLUSH)||("string"===this.options.to?(c=s.utf8border(d.output,d.next_out),l=d.next_out-c,h=s.buf2string(d.output,c),d.next_out=l,d.avail_out=p-l,l&&i.arraySet(d.output,d.output,c,l,0),this.onData(h)):this.onData(i.shrinkBuf(d.output,d.next_out)))),0===d.avail_in&&0===d.avail_out&&(m=!0)}while((0<d.avail_in||0===d.avail_out)&&n!==o.Z_STREAM_END);return n===o.Z_STREAM_END&&(a=o.Z_FINISH),a===o.Z_FINISH?(n=r.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===o.Z_OK):a!==o.Z_SYNC_FLUSH||(this.onEnd(o.Z_OK),!(d.avail_out=0))},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===o.Z_OK&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=i.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg},n.Inflate=h,n.inflate=d,n.inflateRaw=function(e,t){return(t=t||{}).raw=!0,d(e,t)},n.ungzip=d},{"./utils/common":41,"./utils/strings":42,"./zlib/constants":44,"./zlib/gzheader":47,"./zlib/inflate":49,"./zlib/messages":51,"./zlib/zstream":53}],41:[function(e,t,n){"use strict";var r="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Int32Array;n.assign=function(e){for(var t,n,r=Array.prototype.slice.call(arguments,1);r.length;){var i=r.shift();if(i){if("object"!=typeof i)throw new TypeError(i+"must be non-object");for(var s in i)t=i,n=s,Object.prototype.hasOwnProperty.call(t,n)&&(e[s]=i[s])}}return e},n.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var i={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray)e.set(t.subarray(n,n+r),i);else for(var s=0;s<r;s++)e[i+s]=t[n+s]},flattenChunks:function(e){var t,n,r,i,s,o;for(t=r=0,n=e.length;t<n;t++)r+=e[t].length;for(o=new Uint8Array(r),t=i=0,n=e.length;t<n;t++)s=e[t],o.set(s,i),i+=s.length;return o}},s={arraySet:function(e,t,n,r,i){for(var s=0;s<r;s++)e[i+s]=t[n+s]},flattenChunks:function(e){return[].concat.apply([],e)}};n.setTyped=function(e){e?(n.Buf8=Uint8Array,n.Buf16=Uint16Array,n.Buf32=Int32Array,n.assign(n,i)):(n.Buf8=Array,n.Buf16=Array,n.Buf32=Array,n.assign(n,s))},n.setTyped(r)},{}],42:[function(e,t,n){"use strict";var r=e("./common"),i=!0,s=!0;try{String.fromCharCode.apply(null,[0])}catch(e){i=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){s=!1}for(var o=new r.Buf8(256),a=0;a<256;a++)o[a]=252<=a?6:248<=a?5:240<=a?4:224<=a?3:192<=a?2:1;function c(e,t){if(t<65534&&(e.subarray&&s||!e.subarray&&i))return String.fromCharCode.apply(null,r.shrinkBuf(e,t));for(var n="",o=0;o<t;o++)n+=String.fromCharCode(e[o]);return n}o[254]=o[254]=1,n.string2buf=function(e){var t,n,i,s,o,a=e.length,c=0;for(s=0;s<a;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),c+=n<128?1:n<2048?2:n<65536?3:4;for(t=new r.Buf8(c),s=o=0;o<c;s++)55296==(64512&(n=e.charCodeAt(s)))&&s+1<a&&56320==(64512&(i=e.charCodeAt(s+1)))&&(n=65536+(n-55296<<10)+(i-56320),s++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n<i;n++)t[n]=e.charCodeAt(n);return t},n.buf2string=function(e,t){var n,r,i,s,a=t||e.length,l=new Array(2*a);for(n=r=0;n<a;)if((i=e[n++])<128)l[r++]=i;else if(4<(s=o[i]))l[r++]=65533,n+=s-1;else{for(i&=2===s?31:3===s?15:7;1<s&&n<a;)i=i<<6|63&e[n++],s--;1<s?l[r++]=65533:i<65536?l[r++]=i:(i-=65536,l[r++]=55296|i>>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){"use strict";t.exports=function(e,t,n,r){for(var i=65535&e,s=e>>>16&65535,o=0;0!==n;){for(n-=o=2e3<n?2e3:n;s=s+(i=i+t[r++]|0)|0,--o;);i%=65521,s%=65521}return i|s<<16}},{}],44:[function(e,t,n){"use strict";t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}},{}],45:[function(e,t,n){"use strict";var r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a<o;a++)e=e>>>8^s[255&(e^t[a])];return~e}},{}],46:[function(e,t,n){"use strict";var r,i=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),c=e("./messages"),l=0,u=4,h=0,d=-2,p=-1,f=4,m=2,g=8,b=9,y=286,E=30,T=19,v=2*y+1,A=15,w=3,S=258,k=S+w+1,O=42,I=113,N=1,R=2,x=3,M=4;function C(e,t){return e.msg=c[t],t}function P(e){return(e<<1)-(4<e?9:0)}function D(e){for(var t=e.length;0<=--t;)e[t]=0}function L(e){var t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function B(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,L(e.strm)}function U(e,t){e.pending_buf[e.pending++]=t}function F(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function j(e,t){var n,r,i=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-k?e.strstart-(e.w_size-k):0,l=e.window,u=e.w_mask,h=e.prev,d=e.strstart+S,p=l[s+o-1],f=l[s+o];e.prev_length>=e.good_match&&(i>>=2),a>e.lookahead&&(a=e.lookahead);do{if(l[(n=t)+o]===f&&l[n+o-1]===p&&l[n]===l[s]&&l[++n]===l[s+1]){s+=2,n++;do{}while(l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&l[++s]===l[++n]&&s<d);if(r=S-(d-s),s=d-S,o<r){if(e.match_start=t,a<=(o=r))break;p=l[s+o-1],f=l[s+o]}}}while((t=h[t&u])>c&&0!=--i);return o<=e.lookahead?o:e.lookahead}function z(e){var t,n,r,s,c,l,u,h,d,p,f=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=f+(f-k)){for(i.arraySet(e.window,e.window,f,f,0),e.match_start-=f,e.strstart-=f,e.block_start-=f,t=n=e.hash_size;r=e.head[--t],e.head[t]=f<=r?r-f:0,--n;);for(t=n=f;r=e.prev[--t],e.prev[t]=f<=r?r-f:0,--n;);s+=f}if(0===e.strm.avail_in)break;if(l=e.strm,u=e.window,h=e.strstart+e.lookahead,p=void 0,(d=s)<(p=l.avail_in)&&(p=d),n=0===p?0:(l.avail_in-=p,i.arraySet(u,l.input,l.next_in,p,h),1===l.state.wrap?l.adler=o(l.adler,u,p,h):2===l.state.wrap&&(l.adler=a(l.adler,u,p,h)),l.next_in+=p,l.total_in+=p,p),e.lookahead+=n,e.lookahead+e.insert>=w)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+1])&e.hash_mask;e.insert&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[c+w-1])&e.hash_mask,e.prev[c&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=c,c++,e.insert--,!(e.lookahead+e.insert<w)););}while(e.lookahead<k&&0!==e.strm.avail_in)}function G(e,t){for(var n,r;;){if(e.lookahead<k){if(z(e),e.lookahead<k&&t===l)return N;if(0===e.lookahead)break}if(n=0,e.lookahead>=w&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+w-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-k&&(e.match_length=j(e,n)),e.match_length>=w)if(r=s._tr_tally(e,e.strstart-e.match_start,e.match_length-w),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=w){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+w-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart,0!=--e.match_length;);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+1])&e.hash_mask;else r=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(r&&(B(e,!1),0===e.strm.avail_out))return N}return e.insert=e.strstart<w-1?e.strstart:w-1,t===u?(B(e,!0),0===e.strm.avail_out?x:M):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?N:R}function V(e,t){for(var n,r,i;;){if(e.lookahead<k){if(z(e),e.lookahead<k&&t===l)return N;if(0===e.lookahead)break}if(n=0,e.lookahead>=w&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+w-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=w-1,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-k&&(e.match_length=j(e,n),e.match_length<=5&&(1===e.strategy||e.match_length===w&&4096<e.strstart-e.match_start)&&(e.match_length=w-1)),e.prev_length>=w&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-w,r=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-w),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<<e.hash_shift^e.window[e.strstart+w-1])&e.hash_mask,n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!=--e.prev_length;);if(e.match_available=0,e.match_length=w-1,e.strstart++,r&&(B(e,!1),0===e.strm.avail_out))return N}else if(e.match_available){if((r=s._tr_tally(e,0,e.window[e.strstart-1]))&&B(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return N}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(r=s._tr_tally(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<w-1?e.strstart:w-1,t===u?(B(e,!0),0===e.strm.avail_out?x:M):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?N:R}function _(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}function Y(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=g,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new i.Buf16(2*v),this.dyn_dtree=new i.Buf16(2*(2*E+1)),this.bl_tree=new i.Buf16(2*(2*T+1)),D(this.dyn_ltree),D(this.dyn_dtree),D(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new i.Buf16(A+1),this.heap=new i.Buf16(2*y+1),D(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new i.Buf16(2*y+1),D(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function H(e){var t;return e&&e.state?(e.total_in=e.total_out=0,e.data_type=m,(t=e.state).pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?O:I,e.adler=2===t.wrap?0:1,t.last_flush=l,s._tr_init(t),h):C(e,d)}function W(e){var t=H(e);return t===h&&function(e){e.window_size=2*e.w_size,D(e.head),e.max_lazy_match=r[e.level].max_lazy,e.good_match=r[e.level].good_length,e.nice_match=r[e.level].nice_length,e.max_chain_length=r[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=w-1,e.match_available=0,e.ins_h=0}(e.state),t}function K(e,t,n,r,s,o){if(!e)return d;var a=1;if(t===p&&(t=6),r<0?(a=0,r=-r):15<r&&(a=2,r-=16),s<1||b<s||n!==g||r<8||15<r||t<0||9<t||o<0||f<o)return C(e,d);8===r&&(r=9);var c=new Y;return(e.state=c).strm=e,c.wrap=a,c.gzhead=null,c.w_bits=r,c.w_size=1<<c.w_bits,c.w_mask=c.w_size-1,c.hash_bits=s+7,c.hash_size=1<<c.hash_bits,c.hash_mask=c.hash_size-1,c.hash_shift=~~((c.hash_bits+w-1)/w),c.window=new i.Buf8(2*c.w_size),c.head=new i.Buf16(c.hash_size),c.prev=new i.Buf16(c.w_size),c.lit_bufsize=1<<s+6,c.pending_buf_size=4*c.lit_bufsize,c.pending_buf=new i.Buf8(c.pending_buf_size),c.d_buf=1*c.lit_bufsize,c.l_buf=3*c.lit_bufsize,c.level=t,c.strategy=o,c.method=n,W(e)}r=[new _(0,0,0,0,(function(e,t){var n=65535;for(n>e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(z(e),0===e.lookahead&&t===l)return N;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((0===e.strstart||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,B(e,!1),0===e.strm.avail_out))return N;if(e.strstart-e.block_start>=e.w_size-k&&(B(e,!1),0===e.strm.avail_out))return N}return e.insert=0,t===u?(B(e,!0),0===e.strm.avail_out?x:M):(e.strstart>e.block_start&&(B(e,!1),e.strm.avail_out),N)})),new _(4,4,8,4,G),new _(4,5,16,8,G),new _(4,6,32,32,G),new _(4,4,16,16,V),new _(8,16,32,32,V),new _(8,16,128,128,V),new _(8,32,128,256,V),new _(32,128,258,1024,V),new _(32,258,258,4096,V)],n.deflateInit=function(e,t){return K(e,t,g,15,8,0)},n.deflateInit2=K,n.deflateReset=W,n.deflateResetKeep=H,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,h):d},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5<t||t<0)return e?C(e,d):d;if(i=e.state,!e.output||!e.input&&0!==e.avail_in||666===i.status&&t!==u)return C(e,0===e.avail_out?-5:d);if(i.strm=e,n=i.last_flush,i.last_flush=t,i.status===O)if(2===i.wrap)e.adler=0,U(i,31),U(i,139),U(i,8),i.gzhead?(U(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),U(i,255&i.gzhead.time),U(i,i.gzhead.time>>8&255),U(i,i.gzhead.time>>16&255),U(i,i.gzhead.time>>24&255),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(U(i,255&i.gzhead.extra.length),U(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=a(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(U(i,0),U(i,0),U(i,0),U(i,0),U(i,0),U(i,9===i.level?2:2<=i.strategy||i.level<2?4:0),U(i,3),i.status=I);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:6===i.level?2:3)<<6,0!==i.strstart&&(p|=32),p+=31-p%31,i.status=I,F(i,p),0!==i.strstart&&(F(i,e.adler>>>16),F(i,65535&e.adler)),e.adler=1}if(69===i.status)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),L(e),o=i.pending,i.pending!==i.pending_buf_size));)U(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(73===i.status)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),L(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindex<i.gzhead.name.length?255&i.gzhead.name.charCodeAt(i.gzindex++):0,U(i,c)}while(0!==c);i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===c&&(i.gzindex=0,i.status=91)}else i.status=91;if(91===i.status)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),L(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindex<i.gzhead.comment.length?255&i.gzhead.comment.charCodeAt(i.gzindex++):0,U(i,c)}while(0!==c);i.gzhead.hcrc&&i.pending>o&&(e.adler=a(e.adler,i.pending_buf,i.pending-o,o)),0===c&&(i.status=103)}else i.status=103;if(103===i.status&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&L(e),i.pending+2<=i.pending_buf_size&&(U(i,255&e.adler),U(i,e.adler>>8&255),e.adler=0,i.status=I)):i.status=I),0!==i.pending){if(L(e),0===e.avail_out)return i.last_flush=-1,h}else if(0===e.avail_in&&P(t)<=P(n)&&t!==u)return C(e,-5);if(666===i.status&&0!==e.avail_in)return C(e,-5);if(0!==e.avail_in||0!==i.lookahead||t!==l&&666!==i.status){var f=2===i.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(z(e),0===e.lookahead)){if(t===l)return N;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(B(e,!1),0===e.strm.avail_out))return N}return e.insert=0,t===u?(B(e,!0),0===e.strm.avail_out?x:M):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?N:R}(i,t):3===i.strategy?function(e,t){for(var n,r,i,o,a=e.window;;){if(e.lookahead<=S){if(z(e),e.lookahead<=S&&t===l)return N;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=w&&0<e.strstart&&(r=a[i=e.strstart-1])===a[++i]&&r===a[++i]&&r===a[++i]){o=e.strstart+S;do{}while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&i<o);e.match_length=S-(o-i),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=w?(n=s._tr_tally(e,1,e.match_length-w),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(B(e,!1),0===e.strm.avail_out))return N}return e.insert=0,t===u?(B(e,!0),0===e.strm.avail_out?x:M):e.last_lit&&(B(e,!1),0===e.strm.avail_out)?N:R}(i,t):r[i.level].func(i,t);if(f!==x&&f!==M||(i.status=666),f===N||f===x)return 0===e.avail_out&&(i.last_flush=-1),h;if(f===R&&(1===t?s._tr_align(i):5!==t&&(s._tr_stored_block(i,0,0,!1),3===t&&(D(i.head),0===i.lookahead&&(i.strstart=0,i.block_start=0,i.insert=0))),L(e),0===e.avail_out))return i.last_flush=-1,h}return t!==u?h:i.wrap<=0?1:(2===i.wrap?(U(i,255&e.adler),U(i,e.adler>>8&255),U(i,e.adler>>16&255),U(i,e.adler>>24&255),U(i,255&e.total_in),U(i,e.total_in>>8&255),U(i,e.total_in>>16&255),U(i,e.total_in>>24&255)):(F(i,e.adler>>>16),F(i,65535&e.adler)),L(e),0<i.wrap&&(i.wrap=-i.wrap),0!==i.pending?h:1)},n.deflateEnd=function(e){var t;return e&&e.state?(t=e.state.status)!==O&&69!==t&&73!==t&&91!==t&&103!==t&&t!==I&&666!==t?C(e,d):(e.state=null,t===I?C(e,-3):h):d},n.deflateSetDictionary=function(e,t){var n,r,s,a,c,l,u,p,f=t.length;if(!e||!e.state)return d;if(2===(a=(n=e.state).wrap)||1===a&&n.status!==O||n.lookahead)return d;for(1===a&&(e.adler=o(e.adler,t,f,0)),n.wrap=0,f>=n.w_size&&(0===a&&(D(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,f-n.w_size,n.w_size,0),t=p,f=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=f,e.next_in=0,e.input=t,z(n);n.lookahead>=w;){for(r=n.strstart,s=n.lookahead-(w-1);n.ins_h=(n.ins_h<<n.hash_shift^n.window[r+w-1])&n.hash_mask,n.prev[r&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=r,r++,--s;);n.strstart=r,n.lookahead=w-1,z(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=w-1,n.match_available=0,e.next_in=l,e.input=u,e.avail_in=c,n.wrap=a,h},n.deflateInfo="pako deflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./messages":51,"./trees":52}],47:[function(e,t,n){"use strict";t.exports=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}},{}],48:[function(e,t,n){"use strict";t.exports=function(e,t){var n,r,i,s,o,a,c,l,u,h,d,p,f,m,g,b,y,E,T,v,A,w,S,k,O;n=e.state,r=e.next_in,k=e.input,i=r+(e.avail_in-5),s=e.next_out,O=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),c=n.dmax,l=n.wsize,u=n.whave,h=n.wnext,d=n.window,p=n.hold,f=n.bits,m=n.lencode,g=n.distcode,b=(1<<n.lenbits)-1,y=(1<<n.distbits)-1;e:do{f<15&&(p+=k[r++]<<f,f+=8,p+=k[r++]<<f,f+=8),E=m[p&b];t:for(;;){if(p>>>=T=E>>>24,f-=T,0==(T=E>>>16&255))O[s++]=65535&E;else{if(!(16&T)){if(!(64&T)){E=m[(65535&E)+(p&(1<<T)-1)];continue t}if(32&T){n.mode=12;break e}e.msg="invalid literal/length code",n.mode=30;break e}v=65535&E,(T&=15)&&(f<T&&(p+=k[r++]<<f,f+=8),v+=p&(1<<T)-1,p>>>=T,f-=T),f<15&&(p+=k[r++]<<f,f+=8,p+=k[r++]<<f,f+=8),E=g[p&y];n:for(;;){if(p>>>=T=E>>>24,f-=T,!(16&(T=E>>>16&255))){if(!(64&T)){E=g[(65535&E)+(p&(1<<T)-1)];continue n}e.msg="invalid distance code",n.mode=30;break e}if(A=65535&E,f<(T&=15)&&(p+=k[r++]<<f,(f+=8)<T&&(p+=k[r++]<<f,f+=8)),c<(A+=p&(1<<T)-1)){e.msg="invalid distance too far back",n.mode=30;break e}if(p>>>=T,f-=T,(T=s-o)<A){if(u<(T=A-T)&&n.sane){e.msg="invalid distance too far back",n.mode=30;break e}if(S=d,(w=0)===h){if(w+=l-T,T<v){for(v-=T;O[s++]=d[w++],--T;);w=s-A,S=O}}else if(h<T){if(w+=l+h-T,(T-=h)<v){for(v-=T;O[s++]=d[w++],--T;);if(w=0,h<v){for(v-=T=h;O[s++]=d[w++],--T;);w=s-A,S=O}}}else if(w+=h-T,T<v){for(v-=T;O[s++]=d[w++],--T;);w=s-A,S=O}for(;2<v;)O[s++]=S[w++],O[s++]=S[w++],O[s++]=S[w++],v-=3;v&&(O[s++]=S[w++],1<v&&(O[s++]=S[w++]))}else{for(w=s-A;O[s++]=O[w++],O[s++]=O[w++],O[s++]=O[w++],2<(v-=3););v&&(O[s++]=O[w++],1<v&&(O[s++]=O[w++]))}break}}break}}while(r<i&&s<a);r-=v=f>>3,p&=(1<<(f-=v<<3))-1,e.next_in=r,e.next_out=s,e.avail_in=r<i?i-r+5:5-(r-i),e.avail_out=s<a?a-s+257:257-(s-a),n.hold=p,n.bits=f}},{}],49:[function(e,t,n){"use strict";var r=e("../utils/common"),i=e("./adler32"),s=e("./crc32"),o=e("./inffast"),a=e("./inftrees"),c=1,l=2,u=0,h=-2,d=1,p=852,f=592;function m(e){return(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function b(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=d,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(f),t.sane=1,t.back=-1,u):h}function y(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,b(e)):h}function E(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15<t)?h:(null!==r.window&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,y(e))):h}function T(e,t){var n,r;return e?(r=new g,(e.state=r).window=null,(n=E(e,t))!==u&&(e.state=null),n):h}var v,A,w=!0;function S(e){if(w){var t;for(v=new r.Buf32(512),A=new r.Buf32(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(a(c,e.lens,0,288,v,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;a(l,e.lens,0,32,A,0,e.work,{bits:5}),w=!1}e.lencode=v,e.lenbits=9,e.distcode=A,e.distbits=5}function k(e,t,n,i){var s,o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new r.Buf8(o.wsize)),i>=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(s=o.wsize-o.wnext)&&(s=i),r.arraySet(o.window,t,n-i,s,o.wnext),(i-=s)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=s))),0}n.inflateReset=y,n.inflateReset2=E,n.inflateResetKeep=b,n.inflateInit=function(e){return T(e,15)},n.inflateInit2=T,n.inflate=function(e,t){var n,p,f,g,b,y,E,T,v,A,w,O,I,N,R,x,M,C,P,D,L,B,U,F,j=0,z=new r.Buf8(4),G=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];if(!e||!e.state||!e.output||!e.input&&0!==e.avail_in)return h;12===(n=e.state).mode&&(n.mode=13),b=e.next_out,f=e.output,E=e.avail_out,g=e.next_in,p=e.input,y=e.avail_in,T=n.hold,v=n.bits,A=y,w=E,B=u;e:for(;;)switch(n.mode){case d:if(0===n.wrap){n.mode=13;break}for(;v<16;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(2&n.wrap&&35615===T){z[n.check=0]=255&T,z[1]=T>>>8&255,n.check=s(n.check,z,2,0),v=T=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&T)<<8)+(T>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&T)){e.msg="unknown compression method",n.mode=30;break}if(v-=4,L=8+(15&(T>>>=4)),0===n.wbits)n.wbits=L;else if(L>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<<L,e.adler=n.check=1,n.mode=512&T?10:12,v=T=0;break;case 2:for(;v<16;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(n.flags=T,8!=(255&n.flags)){e.msg="unknown compression method",n.mode=30;break}if(57344&n.flags){e.msg="unknown header flags set",n.mode=30;break}n.head&&(n.head.text=T>>8&1),512&n.flags&&(z[0]=255&T,z[1]=T>>>8&255,n.check=s(n.check,z,2,0)),v=T=0,n.mode=3;case 3:for(;v<32;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}n.head&&(n.head.time=T),512&n.flags&&(z[0]=255&T,z[1]=T>>>8&255,z[2]=T>>>16&255,z[3]=T>>>24&255,n.check=s(n.check,z,4,0)),v=T=0,n.mode=4;case 4:for(;v<16;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}n.head&&(n.head.xflags=255&T,n.head.os=T>>8),512&n.flags&&(z[0]=255&T,z[1]=T>>>8&255,n.check=s(n.check,z,2,0)),v=T=0,n.mode=5;case 5:if(1024&n.flags){for(;v<16;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}n.length=T,n.head&&(n.head.extra_len=T),512&n.flags&&(z[0]=255&T,z[1]=T>>>8&255,n.check=s(n.check,z,2,0)),v=T=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(y<(O=n.length)&&(O=y),O&&(n.head&&(L=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,O,L)),512&n.flags&&(n.check=s(n.check,p,O,g)),y-=O,g+=O,n.length-=O),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===y)break e;for(O=0;L=p[g+O++],n.head&&L&&n.length<65536&&(n.head.name+=String.fromCharCode(L)),L&&O<y;);if(512&n.flags&&(n.check=s(n.check,p,O,g)),y-=O,g+=O,L)break e}else n.head&&(n.head.name=null);n.length=0,n.mode=8;case 8:if(4096&n.flags){if(0===y)break e;for(O=0;L=p[g+O++],n.head&&L&&n.length<65536&&(n.head.comment+=String.fromCharCode(L)),L&&O<y;);if(512&n.flags&&(n.check=s(n.check,p,O,g)),y-=O,g+=O,L)break e}else n.head&&(n.head.comment=null);n.mode=9;case 9:if(512&n.flags){for(;v<16;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(T!==(65535&n.check)){e.msg="header crc mismatch",n.mode=30;break}v=T=0}n.head&&(n.head.hcrc=n.flags>>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;v<32;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}e.adler=n.check=m(T),v=T=0,n.mode=11;case 11:if(0===n.havedict)return e.next_out=b,e.avail_out=E,e.next_in=g,e.avail_in=y,n.hold=T,n.bits=v,2;e.adler=n.check=1,n.mode=12;case 12:if(5===t||6===t)break e;case 13:if(n.last){T>>>=7&v,v-=7&v,n.mode=27;break}for(;v<3;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}switch(n.last=1&T,v-=1,3&(T>>>=1)){case 0:n.mode=14;break;case 1:if(S(n),n.mode=20,6!==t)break;T>>>=2,v-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}T>>>=2,v-=2;break;case 14:for(T>>>=7&v,v-=7&v;v<32;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if((65535&T)!=(T>>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&T,v=T=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(O=n.length){if(y<O&&(O=y),E<O&&(O=E),0===O)break e;r.arraySet(f,p,g,O,b),y-=O,g+=O,E-=O,b+=O,n.length-=O;break}n.mode=12;break;case 17:for(;v<14;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(n.nlen=257+(31&T),T>>>=5,v-=5,n.ndist=1+(31&T),T>>>=5,v-=5,n.ncode=4+(15&T),T>>>=4,v-=4,286<n.nlen||30<n.ndist){e.msg="too many length or distance symbols",n.mode=30;break}n.have=0,n.mode=18;case 18:for(;n.have<n.ncode;){for(;v<3;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}n.lens[G[n.have++]]=7&T,T>>>=3,v-=3}for(;n.have<19;)n.lens[G[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,U={bits:n.lenbits},B=a(0,n.lens,0,19,n.lencode,0,n.work,U),n.lenbits=U.bits,B){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have<n.nlen+n.ndist;){for(;x=(j=n.lencode[T&(1<<n.lenbits)-1])>>>16&255,M=65535&j,!((R=j>>>24)<=v);){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(M<16)T>>>=R,v-=R,n.lens[n.have++]=M;else{if(16===M){for(F=R+2;v<F;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(T>>>=R,v-=R,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}L=n.lens[n.have-1],O=3+(3&T),T>>>=2,v-=2}else if(17===M){for(F=R+3;v<F;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}v-=R,L=0,O=3+(7&(T>>>=R)),T>>>=3,v-=3}else{for(F=R+7;v<F;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}v-=R,L=0,O=11+(127&(T>>>=R)),T>>>=7,v-=7}if(n.have+O>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;O--;)n.lens[n.have++]=L}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,U={bits:n.lenbits},B=a(c,n.lens,0,n.nlen,n.lencode,0,n.work,U),n.lenbits=U.bits,B){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,U={bits:n.distbits},B=a(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,U),n.distbits=U.bits,B){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=y&&258<=E){e.next_out=b,e.avail_out=E,e.next_in=g,e.avail_in=y,n.hold=T,n.bits=v,o(e,w),b=e.next_out,f=e.output,E=e.avail_out,g=e.next_in,p=e.input,y=e.avail_in,T=n.hold,v=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;x=(j=n.lencode[T&(1<<n.lenbits)-1])>>>16&255,M=65535&j,!((R=j>>>24)<=v);){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(x&&!(240&x)){for(C=R,P=x,D=M;x=(j=n.lencode[D+((T&(1<<C+P)-1)>>C)])>>>16&255,M=65535&j,!(C+(R=j>>>24)<=v);){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}T>>>=C,v-=C,n.back+=C}if(T>>>=R,v-=R,n.back+=R,n.length=M,0===x){n.mode=26;break}if(32&x){n.back=-1,n.mode=12;break}if(64&x){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&x,n.mode=22;case 22:if(n.extra){for(F=n.extra;v<F;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}n.length+=T&(1<<n.extra)-1,T>>>=n.extra,v-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;x=(j=n.distcode[T&(1<<n.distbits)-1])>>>16&255,M=65535&j,!((R=j>>>24)<=v);){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(!(240&x)){for(C=R,P=x,D=M;x=(j=n.distcode[D+((T&(1<<C+P)-1)>>C)])>>>16&255,M=65535&j,!(C+(R=j>>>24)<=v);){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}T>>>=C,v-=C,n.back+=C}if(T>>>=R,v-=R,n.back+=R,64&x){e.msg="invalid distance code",n.mode=30;break}n.offset=M,n.extra=15&x,n.mode=24;case 24:if(n.extra){for(F=n.extra;v<F;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}n.offset+=T&(1<<n.extra)-1,T>>>=n.extra,v-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===E)break e;if(O=w-E,n.offset>O){if((O=n.offset-O)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}I=O>n.wnext?(O-=n.wnext,n.wsize-O):n.wnext-O,O>n.length&&(O=n.length),N=n.window}else N=f,I=b-n.offset,O=n.length;for(E<O&&(O=E),E-=O,n.length-=O;f[b++]=N[I++],--O;);0===n.length&&(n.mode=21);break;case 26:if(0===E)break e;f[b++]=n.length,E--,n.mode=21;break;case 27:if(n.wrap){for(;v<32;){if(0===y)break e;y--,T|=p[g++]<<v,v+=8}if(w-=E,e.total_out+=w,n.total+=w,w&&(e.adler=n.check=n.flags?s(n.check,f,w,b-w):i(n.check,f,w,b-w)),w=E,(n.flags?T:m(T))!==n.check){e.msg="incorrect data check",n.mode=30;break}v=T=0}n.mode=28;case 28:if(n.wrap&&n.flags){for(;v<32;){if(0===y)break e;y--,T+=p[g++]<<v,v+=8}if(T!==(4294967295&n.total)){e.msg="incorrect length check",n.mode=30;break}v=T=0}n.mode=29;case 29:B=1;break e;case 30:B=-3;break e;case 31:return-4;default:return h}return e.next_out=b,e.avail_out=E,e.next_in=g,e.avail_in=y,n.hold=T,n.bits=v,(n.wsize||w!==e.avail_out&&n.mode<30&&(n.mode<27||4!==t))&&k(e,e.output,e.next_out,w-e.avail_out)?(n.mode=31,-4):(A-=e.avail_in,w-=e.avail_out,e.total_in+=A,e.total_out+=w,n.total+=w,n.wrap&&w&&(e.adler=n.check=n.flags?s(n.check,f,w,e.next_out-w):i(n.check,f,w,e.next_out-w)),e.data_type=n.bits+(n.last?64:0)+(12===n.mode?128:0)+(20===n.mode||15===n.mode?256:0),(0==A&&0===w||4===t)&&B===u&&(B=-5),B)},n.inflateEnd=function(e){if(!e||!e.state)return h;var t=e.state;return t.window&&(t.window=null),e.state=null,u},n.inflateGetHeader=function(e,t){var n;return e&&e.state&&2&(n=e.state).wrap?((n.head=t).done=!1,u):h},n.inflateSetDictionary=function(e,t){var n,r=t.length;return e&&e.state?0!==(n=e.state).wrap&&11!==n.mode?h:11===n.mode&&i(1,t,r,0)!==n.check?-3:k(e,t,r,r)?(n.mode=31,-4):(n.havedict=1,u):h},n.inflateInfo="pako inflate (from Nodeca project)"},{"../utils/common":41,"./adler32":43,"./crc32":45,"./inffast":48,"./inftrees":50}],50:[function(e,t,n){"use strict";var r=e("../utils/common"),i=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],s=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],o=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],a=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,n,c,l,u,h,d){var p,f,m,g,b,y,E,T,v,A=d.bits,w=0,S=0,k=0,O=0,I=0,N=0,R=0,x=0,M=0,C=0,P=null,D=0,L=new r.Buf16(16),B=new r.Buf16(16),U=null,F=0;for(w=0;w<=15;w++)L[w]=0;for(S=0;S<c;S++)L[t[n+S]]++;for(I=A,O=15;1<=O&&0===L[O];O--);if(O<I&&(I=O),0===O)return l[u++]=20971520,l[u++]=20971520,d.bits=1,0;for(k=1;k<O&&0===L[k];k++);for(I<k&&(I=k),w=x=1;w<=15;w++)if(x<<=1,(x-=L[w])<0)return-1;if(0<x&&(0===e||1!==O))return-1;for(B[1]=0,w=1;w<15;w++)B[w+1]=B[w]+L[w];for(S=0;S<c;S++)0!==t[n+S]&&(h[B[t[n+S]]++]=S);if(y=0===e?(P=U=h,19):1===e?(P=i,D-=257,U=s,F-=257,256):(P=o,U=a,-1),w=k,b=u,R=S=C=0,m=-1,g=(M=1<<(N=I))-1,1===e&&852<M||2===e&&592<M)return 1;for(;;){for(E=w-R,v=h[S]<y?(T=0,h[S]):h[S]>y?(T=U[F+h[S]],P[D+h[S]]):(T=96,0),p=1<<w-R,k=f=1<<N;l[b+(C>>R)+(f-=p)]=E<<24|T<<16|v,0!==f;);for(p=1<<w-1;C&p;)p>>=1;if(0!==p?(C&=p-1,C+=p):C=0,S++,0==--L[w]){if(w===O)break;w=t[n+h[S]]}if(I<w&&(C&g)!==m){for(0===R&&(R=I),b+=k,x=1<<(N=w-R);N+R<O&&!((x-=L[N+R])<=0);)N++,x<<=1;if(M+=1<<N,1===e&&852<M||2===e&&592<M)return 1;l[m=C&g]=I<<24|N<<16|b-u}}return 0!==C&&(l[b+C]=w-R<<24|64<<16),d.bits=I,0}},{"../utils/common":41}],51:[function(e,t,n){"use strict";t.exports={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"}},{}],52:[function(e,t,n){"use strict";var r=e("../utils/common"),i=0,s=1;function o(e){for(var t=e.length;0<=--t;)e[t]=0}var a=0,c=29,l=256,u=l+1+c,h=30,d=19,p=2*u+1,f=15,m=16,g=7,b=256,y=16,E=17,T=18,v=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],A=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],w=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=new Array(2*(u+2));o(k);var O=new Array(2*h);o(O);var I=new Array(512);o(I);var N=new Array(256);o(N);var R=new Array(c);o(R);var x,M,C,P=new Array(h);function D(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}function L(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function B(e){return e<256?I[e]:I[256+(e>>>7)]}function U(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function F(e,t,n){e.bi_valid>m-n?(e.bi_buf|=t<<e.bi_valid&65535,U(e,e.bi_buf),e.bi_buf=t>>m-e.bi_valid,e.bi_valid+=n-m):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)}function j(e,t,n){F(e,n[2*t],n[2*t+1])}function z(e,t){for(var n=0;n|=1&e,e>>>=1,n<<=1,0<--t;);return n>>>1}function G(e,t,n){var r,i,s=new Array(f+1),o=0;for(r=1;r<=f;r++)s[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var a=e[2*i+1];0!==a&&(e[2*i]=z(s[a]++,a))}}function V(e){var t;for(t=0;t<u;t++)e.dyn_ltree[2*t]=0;for(t=0;t<h;t++)e.dyn_dtree[2*t]=0;for(t=0;t<d;t++)e.bl_tree[2*t]=0;e.dyn_ltree[2*b]=1,e.opt_len=e.static_len=0,e.last_lit=e.matches=0}function _(e){8<e.bi_valid?U(e,e.bi_buf):0<e.bi_valid&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function Y(e,t,n,r){var i=2*t,s=2*n;return e[i]<e[s]||e[i]===e[s]&&r[t]<=r[n]}function H(e,t,n){for(var r=e.heap[n],i=n<<1;i<=e.heap_len&&(i<e.heap_len&&Y(t,e.heap[i+1],e.heap[i],e.depth)&&i++,!Y(t,r,e.heap[i],e.depth));)e.heap[n]=e.heap[i],n=i,i<<=1;e.heap[n]=r}function W(e,t,n){var r,i,s,o,a=0;if(0!==e.last_lit)for(;r=e.pending_buf[e.d_buf+2*a]<<8|e.pending_buf[e.d_buf+2*a+1],i=e.pending_buf[e.l_buf+a],a++,0===r?j(e,i,t):(j(e,(s=N[i])+l+1,t),0!==(o=v[s])&&F(e,i-=R[s],o),j(e,s=B(--r),n),0!==(o=A[s])&&F(e,r-=P[s],o)),a<e.last_lit;);j(e,b,t)}function K(e,t){var n,r,i,s=t.dyn_tree,o=t.stat_desc.static_tree,a=t.stat_desc.has_stree,c=t.stat_desc.elems,l=-1;for(e.heap_len=0,e.heap_max=p,n=0;n<c;n++)0!==s[2*n]?(e.heap[++e.heap_len]=l=n,e.depth[n]=0):s[2*n+1]=0;for(;e.heap_len<2;)s[2*(i=e.heap[++e.heap_len]=l<2?++l:0)]=1,e.depth[i]=0,e.opt_len--,a&&(e.static_len-=o[2*i+1]);for(t.max_code=l,n=e.heap_len>>1;1<=n;n--)H(e,s,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],H(e,s,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,s[2*i]=s[2*n]+s[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,s[2*n+1]=s[2*r+1]=i,e.heap[1]=i++,H(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,s,o,a,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,h=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,m=t.stat_desc.extra_base,g=t.stat_desc.max_length,b=0;for(s=0;s<=f;s++)e.bl_count[s]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n<p;n++)g<(s=c[2*c[2*(r=e.heap[n])+1]+1]+1)&&(s=g,b++),c[2*r+1]=s,l<r||(e.bl_count[s]++,o=0,m<=r&&(o=d[r-m]),a=c[2*r],e.opt_len+=a*(s+o),h&&(e.static_len+=a*(u[2*r+1]+o)));if(0!==b){do{for(s=g-1;0===e.bl_count[s];)s--;e.bl_count[s]--,e.bl_count[s+1]+=2,e.bl_count[g]--,b-=2}while(0<b);for(s=g;0!==s;s--)for(r=e.bl_count[s];0!==r;)l<(i=e.heap[--n])||(c[2*i+1]!==s&&(e.opt_len+=(s-c[2*i+1])*c[2*i],c[2*i+1]=s),r--)}}(e,t),G(s,l,e.bl_count)}function X(e,t,n){var r,i,s=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),t[2*(n+1)+1]=65535,r=0;r<=n;r++)i=o,o=t[2*(r+1)+1],++a<c&&i===o||(a<l?e.bl_tree[2*i]+=a:0!==i?(i!==s&&e.bl_tree[2*i]++,e.bl_tree[2*y]++):a<=10?e.bl_tree[2*E]++:e.bl_tree[2*T]++,s=i,l=(a=0)===o?(c=138,3):i===o?(c=6,3):(c=7,4))}function Z(e,t,n){var r,i,s=-1,o=t[1],a=0,c=7,l=4;for(0===o&&(c=138,l=3),r=0;r<=n;r++)if(i=o,o=t[2*(r+1)+1],!(++a<c&&i===o)){if(a<l)for(;j(e,i,e.bl_tree),0!=--a;);else 0!==i?(i!==s&&(j(e,i,e.bl_tree),a--),j(e,y,e.bl_tree),F(e,a-3,2)):a<=10?(j(e,E,e.bl_tree),F(e,a-3,3)):(j(e,T,e.bl_tree),F(e,a-11,7));s=i,l=(a=0)===o?(c=138,3):i===o?(c=6,3):(c=7,4)}}o(P);var q=!1;function Q(e,t,n,i){F(e,(a<<1)+(i?1:0),3),function(e,t,n,i){_(e),i&&(U(e,n),U(e,~n)),r.arraySet(e.pending_buf,e.window,t,n,e.pending),e.pending+=n}(e,t,n,!0)}n._tr_init=function(e){q||(function(){var e,t,n,r,i,s=new Array(f+1);for(r=n=0;r<c-1;r++)for(R[r]=n,e=0;e<1<<v[r];e++)N[n++]=r;for(N[n-1]=r,r=i=0;r<16;r++)for(P[r]=i,e=0;e<1<<A[r];e++)I[i++]=r;for(i>>=7;r<h;r++)for(P[r]=i<<7,e=0;e<1<<A[r]-7;e++)I[256+i++]=r;for(t=0;t<=f;t++)s[t]=0;for(e=0;e<=143;)k[2*e+1]=8,e++,s[8]++;for(;e<=255;)k[2*e+1]=9,e++,s[9]++;for(;e<=279;)k[2*e+1]=7,e++,s[7]++;for(;e<=287;)k[2*e+1]=8,e++,s[8]++;for(G(k,u+1,s),e=0;e<h;e++)O[2*e+1]=5,O[2*e]=z(e,5);x=new D(k,v,l+1,u,f),M=new D(O,A,0,h,f),C=new D(new Array(0),w,0,d,g)}(),q=!0),e.l_desc=new L(e.dyn_ltree,x),e.d_desc=new L(e.dyn_dtree,M),e.bl_desc=new L(e.bl_tree,C),e.bi_buf=0,e.bi_valid=0,V(e)},n._tr_stored_block=Q,n._tr_flush_block=function(e,t,n,r){var o,a,c=0;0<e.level?(2===e.strm.data_type&&(e.strm.data_type=function(e){var t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return i;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t<l;t++)if(0!==e.dyn_ltree[2*t])return s;return i}(e)),K(e,e.l_desc),K(e,e.d_desc),c=function(e){var t;for(X(e,e.dyn_ltree,e.l_desc.max_code),X(e,e.dyn_dtree,e.d_desc.max_code),K(e,e.bl_desc),t=d-1;3<=t&&0===e.bl_tree[2*S[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t}(e),o=e.opt_len+3+7>>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=n+5,n+4<=o&&-1!==t?Q(e,t,n,r):4===e.strategy||a===o?(F(e,2+(r?1:0),3),W(e,k,O)):(F(e,4+(r?1:0),3),function(e,t,n,r){var i;for(F(e,t-257,5),F(e,n-1,5),F(e,r-4,4),i=0;i<r;i++)F(e,e.bl_tree[2*S[i]+1],3);Z(e,e.dyn_ltree,t-1),Z(e,e.dyn_dtree,n-1)}(e,e.l_desc.max_code+1,e.d_desc.max_code+1,c+1),W(e,e.dyn_ltree,e.dyn_dtree)),V(e),r&&_(e)},n._tr_tally=function(e,t,n){return e.pending_buf[e.d_buf+2*e.last_lit]=t>>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(N[n]+l+1)]++,e.dyn_dtree[2*B(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){F(e,2,3),j(e,b,k),function(e){16===e.bi_valid?(U(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){"use strict";t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e,t){"use strict";if(!e.setImmediate){var n,r,s,o,a=1,c={},l=!1,u=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,n="[object process]"==={}.toString.call(e.process)?function(e){i.nextTick((function(){p(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(o="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",f,!1):e.attachEvent("onmessage",f),function(t){e.postMessage(o+t,"*")}):e.MessageChannel?((s=new MessageChannel).port1.onmessage=function(e){p(e.data)},function(e){s.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(r=u.documentElement,function(e){var t=u.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(p,0,e)},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var i={callback:e,args:t};return c[a]=i,n(a),a++},h.clearImmediate=d}function d(e){delete c[e]}function p(e){if(l)setTimeout(p,0,e);else{var n=c[e];if(n){l=!0;try{!function(e){var n=e.callback,r=e.args;switch(r.length){case 0:n();break;case 1:n(r[0]);break;case 2:n(r[0],r[1]);break;case 3:n(r[0],r[1],r[2]);break;default:n.apply(t,r)}}(n)}finally{d(e),l=!1}}}}function f(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(o)&&p(+t.data.slice(o.length))}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,void 0!==r?r:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}]},{},[10])(10)}).call(this,n(18).Buffer,n(101).setImmediate,n(8),n(38))},function(e,t){class n{static get RGB_BLACK(){return{r:0,g:0,b:0}}static get RGB_WHITE(){return{r:255,g:255,b:255}}static decimalToHex(e){e<0&&(e+=16777216);let t=Number(e).toString(16);return t="#".concat("000000".substr(0,6-t.length)).concat(t),t}static decimalToRgb(e){const t=e>>24&255;return{r:e>>16&255,g:e>>8&255,b:255&e,a:t>0?t:255}}static hexToRgb(e){e.startsWith("#")&&(e=e.substring(1));const t=parseInt(e,16);if(isNaN(t))return null;if(6===e.length)return{r:t>>16&255,g:t>>8&255,b:255&t};if(3===e.length){const e=t>>8&15,n=t>>4&15,r=15&t;return{r:e<<4|e,g:n<<4|n,b:r<<4|r}}return null}static rgbToHex(e){return n.decimalToHex(n.rgbToDecimal(e))}static rgbToDecimal(e){return(e.r<<16)+(e.g<<8)+e.b}static hexToDecimal(e){return n.rgbToDecimal(n.hexToRgb(e))}static hsvToRgb(e){let t=e.h%360;t<0&&(t+=360);const n=Math.max(0,Math.min(e.s,1)),r=Math.max(0,Math.min(e.v,1)),i=Math.floor(t/60),s=t/60-i,o=r*(1-n),a=r*(1-n*s),c=r*(1-n*(1-s));let l,u,h;switch(i){default:case 0:l=r,u=c,h=o;break;case 1:l=a,u=r,h=o;break;case 2:l=o,u=r,h=c;break;case 3:l=o,u=a,h=r;break;case 4:l=c,u=o,h=r;break;case 5:l=r,u=o,h=a}return{r:Math.floor(255*l),g:Math.floor(255*u),b:Math.floor(255*h)}}static rgbToHsv(e){const t=e.r/255,n=e.g/255,r=e.b/255,i=Math.min(Math.min(t,n),r),s=Math.max(Math.max(t,n),r);let o=0,a=0;if(i!==s){o=60*((t===i?3:n===i?5:1)-(t===i?n-r:n===i?r-t:t-n)/(s-i))%360,a=(s-i)/s}return{h:o,s:a,v:s}}static mixRgb(e,t,n){if(n<=0)return e;if(n>=1)return t;const r=1-n;return{r:r*e.r+n*t.r,g:r*e.g+n*t.g,b:r*e.b+n*t.b}}}e.exports=n},function(e,t){const n=e=>null!=e;class r{constructor(e){var t,n,r,i,s,o,a,c,l,u,h,d,p,f,m;this.id=null!==(t=e.id)&&void 0!==t?t:null,this.spriteName=null!==(n=e.spriteName)&&void 0!==n?n:null,this.targetId=null!==(r=e.targetId)&&void 0!==r?r:null,this.opcode=null!==(i=e.opcode)&&void 0!==i?i:null,this.value=null!==(s=e.value)&&void 0!==s?s:null,this.params=null!==(o=e.params)&&void 0!==o?o:null,this.mode=null!==(a=e.mode)&&void 0!==a?a:"default",this.sliderMin=null!==(c=e.sliderMin)&&void 0!==c?c:0,this.sliderMax=null!==(l=e.sliderMax)&&void 0!==l?l:100,this.isDiscrete=null===(u=e.isDiscrete)||void 0===u||u,this.x=null!==(h=e.x)&&void 0!==h?h:null,this.y=null!==(d=e.y)&&void 0!==d?d:null,this.width=null!==(p=e.width)&&void 0!==p?p:0,this.height=null!==(f=e.height)&&void 0!==f?f:0,this.visible=null===(m=e.visible)||void 0===m||m}get(e){switch(e){case"id":return this.id;case"spriteName":return this.spriteName;case"targetId":return this.targetId;case"opcode":return this.opcode;case"value":return this.value;case"params":return this.params;case"mode":return this.mode;case"sliderMin":return this.sliderMin;case"sliderMax":return this.sliderMax;case"isDiscrete":return this.isDiscrete;case"x":return this.x;case"y":return this.y;case"width":return this.width;case"height":return this.height;case"visible":return this.visible}return null}merge(e){let t=!1;return n(e.id)&&!Object.is(this.id,e.id)&&(this.id=e.id,t=!0),n(e.spriteName)&&!Object.is(this.spriteName,e.spriteName)&&(this.spriteName=e.spriteName,t=!0),n(e.targetId)&&!Object.is(this.targetId,e.targetId)&&(this.targetId=e.targetId,t=!0),n(e.opcode)&&!Object.is(this.opcode,e.opcode)&&(this.opcode=e.opcode,t=!0),n(e.value)&&!Object.is(this.value,e.value)&&(this.value=e.value,t=!0),n(e.params)&&!Object.is(this.params,e.params)&&(this.params=e.params,t=!0),n(e.mode)&&!Object.is(this.mode,e.mode)&&(this.mode=e.mode,t=!0),n(e.sliderMin)&&!Object.is(this.sliderMin,e.sliderMin)&&(this.sliderMin=e.sliderMin,t=!0),n(e.sliderMax)&&!Object.is(this.sliderMax,e.sliderMax)&&(this.sliderMax=e.sliderMax,t=!0),n(e.isDiscrete)&&!Object.is(this.isDiscrete,e.isDiscrete)&&(this.isDiscrete=e.isDiscrete,t=!0),n(e.x)&&!Object.is(this.x,e.x)&&(this.x=e.x,t=!0),n(e.y)&&!Object.is(this.y,e.y)&&(this.y=e.y,t=!0),n(e.width)&&!Object.is(this.width,e.width)&&(this.width=e.width,t=!0),n(e.height)&&!Object.is(this.height,e.height)&&(this.height=e.height,t=!0),n(e.visible)&&!Object.is(this.visible,e.visible)&&(this.visible=e.visible,t=!0),t}}r.externalDeltaToJS=e=>"function"==typeof e.toJS?e.toJS():e instanceof Map?Object.fromEntries(Array.from(e.entries())):e,e.exports=r},function(e,t,n){const r=n(236),i=n(249),s=n(78),o=n(74),a=n(251),c=n(77),l=n(51),u=n(75),h=n(252),d=n(50);e.exports={BitmapAdapter:i,convertFonts:u,inlineSvgFonts:s,loadSvgString:o,sanitizeSvg:a,serializeSvgToString:c,SvgElement:l,SVGRenderer:r,fixForVanilla:h,DOMPurify:d}},function(e,t,n){const r=n(42),i=n(17),s=n(49),o=n(9),a=n(48),c=n(24),l=n(13),u=n(0),h=n(7),d=n(4),p=n(6),f=n(73),m=n(260),{loadCostume:g}=n(34),{loadSound:b}=n(33),{deserializeCostume:y,deserializeSound:E}=n(82),T=Object.prototype.hasOwnProperty,v=["argument","colour","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],A=12,w=13,S={math_number:[4,"NUM"],math_positive_number:[5,"NUM"],math_whole_number:[6,"NUM"],math_integer:[7,"NUM"],math_angle:[8,"NUM"],colour_picker:[9,"COLOUR"],text:[10,"TEXT"],event_broadcast_menu:[11,"BROADCAST_OPTION"],data_variable:[A,"VARIABLE"],data_listcontents:[w,"LIST"]},k=8e3,O=function(e){const t=function(e){if(T.call(S,e.opcode)){const t=S[e.opcode],n=t[0],r=t[1],i=e.fields[r],s=[n,i.value];return"event_broadcast_menu"===e.opcode?s.push(i.id):"data_variable"!==e.opcode&&"data_listcontents"!==e.opcode||(s.push(i.id),e.topLevel&&(s.push(e.x?Math.round(e.x):0),s.push(e.y?Math.round(e.y):0))),s}return null}(e);if(t)return t;const n=Object.create(null);return n.opcode=e.opcode,n.next=e.next,n.parent=e.parent,n.inputs=function(e){const t=Object.create(null);for(const n in e)T.call(e,n)&&(e[n].block===e[n].shadow?t[n]=[1,e[n].block]:null===e[n].shadow?t[n]=[2,e[n].block]:t[n]=[3,e[n].block,e[n].shadow]);return t}(e.inputs),n.fields=function(e){const t=Object.create(null);for(const n in e)T.call(e,n)&&(t[n]=[e[n].value],Object.prototype.hasOwnProperty.call(e[n],"id")&&t[n].push(e[n].id));return t}(e.fields),n.shadow=e.shadow,e.topLevel?(n.topLevel=!0,n.x=e.x?Math.round(e.x):0,n.y=e.y?Math.round(e.y):0):n.topLevel=!1,e.mutation&&(n.mutation=e.mutation),e.comment&&(n.comment=e.comment),n},I=function(e,t){const n=e.inputs;for(const e in n){const r=n[e];for(let e=1;e<r.length;e++){if(!r[e])continue;const n=r[e],i=t[n];Array.isArray(i)&&(r[e]=i,delete t[n])}}return e},N=function(e){const t=e.indexOf("_"),n=e.substring(0,t).replace(/[^\w-]/g,"-");if(-1===v.indexOf(n)&&""!==n)return n},R=(e,t)=>{if(!t.extensionManager)return null;const n=t.extensionManager.getExtensionURLs(),r={};for(const t of e){const e=n[t];"string"==typeof e&&(r[t]=e)}return 0===Object.keys(r).length?null:r},x=function(e){const t=Object.create(null),n=new Set;for(const r in e){if(!Object.prototype.hasOwnProperty.call(e,r))continue;t[r]=O(e[r]);const i=N(e[r].opcode);i&&n.add(i)}for(const e in t){const n=t[e];t[e]=I(n,t)}for(const e in t){const n=t[e];Array.isArray(n)&&[A,w].indexOf(n[0])<0&&(u.warn("Found an unexpected top level primitive with block ID: ".concat(e,"; deleting it from serialized blocks.")),delete t[e])}return[t,Array.from(n)]},M=function(e){const t=Object.create(null);t.name=e.name;const n=e.broken||e;return t.bitmapResolution=n.bitmapResolution,t.dataFormat=n.dataFormat.toLowerCase(),t.assetId=n.assetId,t.md5ext=n.md5,t.rotationCenterX=n.rotationCenterX,t.rotationCenterY=n.rotationCenterY,t},C=function(e){const t=Object.create(null);t.name=e.name;const n=e.broken||e;return t.assetId=n.assetId,t.dataFormat=n.dataFormat.toLowerCase(),t.format=n.format,t.rate=n.rate,t.sampleCount=n.sampleCount,t.md5ext=n.md5,t},P=function(e,t){const n=Object.create(null);let r=[];n.isStage=e.isStage,n.name=n.isStage?"Stage":e.name;const i=function(e){const t=Object.create(null);t.variables=Object.create(null),t.lists=Object.create(null),t.broadcasts=Object.create(null);for(const n in e){const r=e[n];r.type!==o.BROADCAST_MESSAGE_TYPE?r.type!==o.LIST_TYPE?(t.variables[n]=[r.name,r.value],r.isCloud&&t.variables[n].push(!0)):t.lists[n]=[r.name,r.value]:t.broadcasts[n]=r.value}return t}(e.variables);return n.variables=i.variables,n.lists=i.lists,n.broadcasts=i.broadcasts,[n.blocks,r]=x(e.blocks),n.comments=function(e){const t=Object.create(null);for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n],i=Object.create(null);i.blockId=r.blockId,i.x=r.x,i.y=r.y,i.width=r.width,i.height=r.height,i.minimized=r.minimized,r.text.length>k?(i.text=r.text.substring(0,k),i.extraText=r.text.substring(k)):i.text=r.text,t[n]=i}return t}(e.comments),(e.currentCostume<0||e.currentCostume>=e.costumes.length)&&(u.warn("currentCostume property for target ".concat(e.name," is out of range")),e.currentCostume=d.clamp(e.currentCostume,0,e.costumes.length-1)),n.currentCostume=e.currentCostume,n.costumes=e.costumes.map(M),n.sounds=e.sounds.map(C),Object.prototype.hasOwnProperty.call(e,"volume")&&(n.volume=e.volume),Object.prototype.hasOwnProperty.call(e,"layerOrder")&&(n.layerOrder=e.layerOrder),n.isStage?(Object.prototype.hasOwnProperty.call(e,"tempo")&&(n.tempo=e.tempo),Object.prototype.hasOwnProperty.call(e,"videoTransparency")&&(n.videoTransparency=e.videoTransparency),Object.prototype.hasOwnProperty.call(e,"videoState")&&(n.videoState=e.videoState),Object.prototype.hasOwnProperty.call(e,"textToSpeechLanguage")&&(n.textToSpeechLanguage=e.textToSpeechLanguage)):(n.visible=e.visible,n.x=e.x,n.y=e.y,n.size=e.size,n.direction=e.direction,n.draggable=e.draggable,n.rotationStyle=e.rotationStyle),r.forEach((e=>{t.add(e)})),n},D=(e,t)=>{const n={};let r=!0;for(const[i,s]of Object.entries(e))t.has(i)&&null!=s&&(r=!1,n[i]=e[i]);return r?null:n},L=function(e,t,n,r){if(!Array.isArray(e))return e;const i=Object.create(null),s=h();switch(i.id=s,i.next=null,i.parent=t,i.shadow=n,i.inputs=Object.create(null),e[0]){case 4:i.opcode="math_number",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 5:i.opcode="math_positive_number",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 6:i.opcode="math_whole_number",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 7:i.opcode="math_integer",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 8:i.opcode="math_angle",i.fields={NUM:{name:"NUM",value:e[1]}},i.topLevel=!1;break;case 9:i.opcode="colour_picker",i.fields={COLOUR:{name:"COLOUR",value:e[1]}},i.topLevel=!1;break;case 10:i.opcode="text",i.fields={TEXT:{name:"TEXT",value:e[1]}},i.topLevel=!1;break;case 11:i.opcode="event_broadcast_menu",i.fields={BROADCAST_OPTION:{name:"BROADCAST_OPTION",value:e[1],id:e[2],variableType:o.BROADCAST_MESSAGE_TYPE}},i.topLevel=!1;break;case A:i.opcode="data_variable",i.fields={VARIABLE:{name:"VARIABLE",value:e[1],id:e[2],variableType:o.SCALAR_TYPE}},e.length>3&&(i.topLevel=!0,i.x=e[3],i.y=e[4]);break;case w:i.opcode="data_listcontents",i.fields={LIST:{name:"LIST",value:e[1],id:e[2],variableType:o.LIST_TYPE}},e.length>3&&(i.topLevel=!0,i.x=e[3],i.y=e[4]);break;default:return u.error("Found unknown primitive type during deserialization: ".concat(JSON.stringify(e))),null}return r[s]=i,s},B=function(e,t,n){const r={};for(const i in e){if(!T.call(e,i))continue;const s=e[i];if(!Array.isArray(s))continue;let o=null,a=null;const c=s[0];1===c?o=a=L(s[1],t,!0,n):2===c?o=L(s[1],t,!1,n):(o=L(s[1],t,!1,n),a=L(s[2],t,!0,n)),r[i]={name:i,block:o,shadow:a}}return r},U=function(e){const t={};for(const n in e){if(!T.call(e,n))continue;const r=e[n];Array.isArray(r)&&(t[n]={name:n,value:r[0]},r.length>1&&(t[n].id=r[1]),"BROADCAST_OPTION"===n?t[n].variableType=o.BROADCAST_MESSAGE_TYPE:"VARIABLE"===n?t[n].variableType=o.SCALAR_TYPE:"LIST"===n&&(t[n].variableType=o.LIST_TYPE))}return t},F=function(e){for(const t in e){if(!Object.prototype.hasOwnProperty.call(e,t))continue;const n=e[t];Array.isArray(n)?(delete e[t],L(n,null,!1,e)):(n.id=t,n.inputs=B(n.inputs,t,e),n.fields=U(n.fields))}return e},j=function(e,t,n,r,c){if(!Object.prototype.hasOwnProperty.call(e,"name"))return Promise.resolve(null);const u=new i(t),h=new s(u,t);if(Object.prototype.hasOwnProperty.call(e,"name")&&(h.name=e.name),Object.prototype.hasOwnProperty.call(e,"blocks")){F(e.blocks);for(const t in e.blocks){if(!Object.prototype.hasOwnProperty.call(e.blocks,t))continue;const r=e.blocks[t];u.createBlock(r);const i=N(r.opcode);i&&n.extensionIDs.add(i)}!function(e){for(const n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;const r=e[n];switch(r.opcode){case"procedures_prototype":r.shadow=!0;break;case"argument_reporter_string_number":case"argument_reporter_boolean":{const t=e[r.parent];t&&"procedures_prototype"===t.opcode&&(r.shadow=!0);break}case"control_stop":if(!r.mutation){var t;const e=null===(t=r.fields)||void 0===t||null===(t=t.STOP_OPTION)||void 0===t?void 0:t.value,n="other scripts in sprite"===e||"other scripts in stage"===e;r.mutation={tagName:"mutation",hasnext:n?"true":"false",children:[]}}}}}(e.blocks)}const{costumePromises:p}=c,{soundBank:f,soundPromises:m}=c,g=h.createClone(e.isStage?l.BACKGROUND_LAYER:l.SPRITE_LAYER);if(Object.prototype.hasOwnProperty.call(e,"tempo")&&(g.tempo=e.tempo),Object.prototype.hasOwnProperty.call(e,"volume")&&(g.volume=e.volume),Object.prototype.hasOwnProperty.call(e,"videoTransparency")&&(g.videoTransparency=e.videoTransparency),Object.prototype.hasOwnProperty.call(e,"videoState")&&(g.videoState=e.videoState),Object.prototype.hasOwnProperty.call(e,"textToSpeechLanguage")&&(g.textToSpeechLanguage=e.textToSpeechLanguage),Object.prototype.hasOwnProperty.call(e,"variables"))for(const n in e.variables){const r=e.variables[n],i=3===r.length&&r[2]&&e.isStage&&t.canAddCloudVariable(),s=new o(n,r[0],o.SCALAR_TYPE,i);i&&t.addCloudVariable(),s.value=r[1],g.variables[s.id]=s}if(Object.prototype.hasOwnProperty.call(e,"lists"))for(const t in e.lists){const n=e.lists[t],r=new o(t,n[0],o.LIST_TYPE,!1);r.value=n[1],g.variables[r.id]=r}if(Object.prototype.hasOwnProperty.call(e,"broadcasts"))for(const t in e.broadcasts){const n=e.broadcasts[t],r=new o(t,n,o.BROADCAST_MESSAGE_TYPE,!1);g.variables[r.id]=r}if(Object.prototype.hasOwnProperty.call(e,"comments"))for(const t in e.comments){const n=e.comments[t],r=new a(t,n.text+("string"==typeof n.extraText?n.extraText:""),n.x,n.y,n.width,n.height,n.minimized);n.blockId&&(r.blockId=n.blockId),g.comments[r.id]=r}return Object.prototype.hasOwnProperty.call(e,"x")&&(g.x=e.x),Object.prototype.hasOwnProperty.call(e,"y")&&(g.y=e.y),Object.prototype.hasOwnProperty.call(e,"direction")&&(g.direction=d.wrapClamp(e.direction,-179,180)),Object.prototype.hasOwnProperty.call(e,"size")&&(g.size=e.size),Object.prototype.hasOwnProperty.call(e,"visible")&&(g.visible=e.visible),Object.prototype.hasOwnProperty.call(e,"currentCostume")&&(g.currentCostume=d.clamp(e.currentCostume,0,e.costumes.length-1)),Object.prototype.hasOwnProperty.call(e,"rotationStyle")&&(g.rotationStyle=e.rotationStyle),Object.prototype.hasOwnProperty.call(e,"isStage")&&(g.isStage=e.isStage),Object.prototype.hasOwnProperty.call(e,"targetPaneOrder")&&(g.targetPaneOrder=e.targetPaneOrder),Object.prototype.hasOwnProperty.call(e,"draggable")&&(g.draggable=e.draggable),Object.prototype.hasOwnProperty.call(e,"extensionStorage")&&(g.extensionStorage=e.extensionStorage),Promise.all(p).then((e=>{h.costumes=e})),Promise.all(m).then((e=>{h.sounds=e,h.soundBank=f||null})),Promise.all(p.concat(m)).then((()=>g))};e.exports={serialize:function(e,t){let{allowOptimization:n=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const r=Object.create(null),i=new Set,s=t?[e.getTargetById(t)]:e.targets.filter((e=>e.isOriginal)),o=function(e){const t=e.map((e=>e.getLayerOrder()));return d.reducedSortOrdering(t)}(s),a=s.map((e=>e.toJSON()));e.renderer&&!t&&a.forEach(((e,t)=>{e.layerOrder=o[t]}));const c=a.map((e=>P(e,i))).map(((e,t)=>{const n=s[t],r=D(n.extensionStorage,i);return r&&(e.extensionStorage=r),e})),l=e.fontManager.serializeJSON();if(t){const t=c[0];i.size&&(t.extensions=Array.from(i));const n=R(i,e);return n&&(t.extensionURLs=n),l&&(t.customFonts=l),c[0]}const u=D(e.extensionStorage,i);u&&(r.extensionStorage=u),r.targets=c,r.monitors=function(e,t,n){const r=(t.stageWidth-480)/2,i=(t.stageHeight-360)/2;return e.valueSeq().filter((e=>{const t=N(e.opcode);return!t||!!e.visible&&(n.add(t),!0)})).map((e=>{const t={id:e.id,mode:e.mode,opcode:e.opcode,params:e.params,spriteName:e.spriteName,value:Array.isArray(e.value)?[]:0,width:e.width,height:e.height,x:e.x-r,y:e.y-i,visible:e.visible};return"list"!==e.mode&&(t.sliderMin=e.sliderMin,t.sliderMax=e.sliderMax,t.isDiscrete=e.isDiscrete),t}))}(e.getMonitorState(),e,i),r.extensions=Array.from(i);const h=R(i,e);h&&(r.extensionURLs=h),l&&(r.customFonts=l);const p=Object.create(null);return p.semver="3.0.0",p.vm="0.2.0",e.origin&&(p.origin=e.origin),p.agent="",p.platform=Object.assign({},e.platform),r.meta=p,n&&m(r),r},deserialize:async function(e,t,n,i){await((e,t)=>{if(!e.meta||!e.meta.platform)return;if(e.meta.platform.name===t.platform.name)return;let n=t.listenerCount(r.PLATFORM_MISMATCH);return 0!==n?new Promise((i=>{t.emit(r.PLATFORM_MISMATCH,e.meta.platform,(()=>{n--,0===n&&i()}))})):void 0})(e,t);const s={extensionIDs:new Set,extensionURLs:new Map};if(e.meta&&e.meta.origin?t.origin=e.meta.origin:t.origin=null,e.extensionURLs)for(const[t,n]of Object.entries(e.extensionURLs))s.extensionURLs.set(t,n);let a;a=e.customFonts?t.fontManager.deserialize(e.customFonts,n,i):Promise.resolve();const l=((i?[e]:e.targets)||[]).map(((e,t)=>Object.assign(e,{targetPaneOrder:t}))).sort(((e,t)=>e.layerOrder-t.layerOrder)),h=e.monitors||[];return a.then((()=>l.map((e=>function(e,t,n){if(!Object.prototype.hasOwnProperty.call(e,"name"))return Promise.resolve(null);const r={costumePromises:null,soundPromises:null,soundBank:t.audioEngine&&t.audioEngine.createBank()};return r.costumePromises=(e.costumes||[]).map((e=>{const r={asset:e.asset,assetId:e.assetId,skinId:null,name:e.name,bitmapResolution:e.bitmapResolution,rotationCenterX:e.rotationCenterX,rotationCenterY:e.rotationCenterY},i=e.dataFormat||e.assetType&&e.assetType.runtimeFormat||"png",s=Object.prototype.hasOwnProperty.call(e,"md5ext")?e.md5ext:"".concat(e.assetId,".").concat(i);return r.md5=s,r.dataFormat=i,t.wrapAssetRequest((()=>y(r,t,n).then((()=>g(s,r,t)))))})),r.soundPromises=(e.sounds||[]).map((e=>{const i={assetId:e.assetId,format:e.format,rate:e.rate,sampleCount:e.sampleCount,name:e.name,md5:e.md5ext,dataFormat:e.dataFormat,data:null};return t.wrapAssetRequest((()=>E(i,t,n).then((()=>b(i,t,r.soundBank)))))})),r}(e,t,n))))).then((e=>Promise.resolve(e))).then((e=>Promise.all(l.map(((n,r)=>j(n,t,s,0,e[r])))))).then((e=>e.map(((e,t)=>(e.layerOrder=t,e))).sort(((e,t)=>e.targetPaneOrder-t.targetPaneOrder)).map((e=>(delete e.targetPaneOrder,e))))).then((e=>function(e){const t=f.getAllVarRefsForTargets(e,!0);e.forEach((e=>{Object.keys(e.variables).forEach((t=>{const n=p.replaceUnsafeChars(t);n!==t&&(e.variables[t].id=n,e.variables[n]=e.variables[t],delete e.variables[t])}))}));for(const e in t){const n=p.replaceUnsafeChars(e);e!==n&&f.updateVariableIdentifiers(t[e],n)}return e}(e))).then((n=>(h.map((e=>function(e,t,n,r){const i=(t.stageWidth-480)/2,s=(t.stageHeight-360)/2;if(e.x+=i,e.y+=s,e.x=d.clamp(e.x,0,t.stageWidth),e.y=d.clamp(e.y,0,t.stageHeight),e.spriteName){const t=n.filter((t=>t.sprite.name===e.spriteName));t&&t.length>0?e.targetId=t[0].id:u.warn("Tried to deserialize sprite specific monitor ".concat(e.opcode," but could not find sprite ").concat(e.spriteName,"."))}const a=t.monitorBlockInfo[e.opcode];if("data_listcontents"===e.opcode){const t=e.targetId?n.find((t=>t.id===e.targetId)):n.find((e=>e.isStage));t&&Object.prototype.hasOwnProperty.call(t.variables,e.id)&&(e.params.LIST=t.variables[e.id].name)}const l={};for(const t in e.params){const n={name:t,value:e.params[t]};l[t]=n}"data_variable"!==e.opcode&&"data_listcontents"!==e.opcode&&a&&a.isSpriteSpecific?e.id=a.getId(e.targetId,l):e.id=p.replaceUnsafeChars(e.id);const h=t.monitorBlocks._blocks[e.id];if(h)h.isMonitored=e.visible,h.targetId=e.targetId;else{const n={id:e.id,opcode:e.opcode,inputs:{},fields:l,topLevel:!0,next:null,parent:null,shadow:!1,x:0,y:0,isMonitored:e.visible,targetId:e.targetId};if("data_variable"===e.opcode){const t=n.fields.VARIABLE;t.id=e.id,t.variableType=o.SCALAR_TYPE}else if("data_listcontents"===e.opcode){const t=n.fields.LIST;t.id=e.id,t.variableType=o.LIST_TYPE}t.monitorBlocks.createBlock(n);const i=N(n.opcode);i&&r.extensionIDs.add(i)}t.requestAddMonitor(new c(e))}(e,t,n,s))),Object.prototype.hasOwnProperty.call(e,"extensionStorage")&&(t.extensionStorage=e.extensionStorage),n))).then((e=>({targets:e,extensions:s})))},deserializeBlocks:F,serializeBlocks:x,deserializeStandaloneBlocks:e=>{if((e=JSON.parse(JSON.stringify(e))).extensionURLs){const t=new Map;for(const[n,r]of Object.entries(e.extensionURLs))t.set(n,r);return{blocks:e.blocks,extensionURLs:t}}return{blocks:e,extensionURLs:new Map}},serializeStandaloneBlocks:(e,t)=>{const n=new Set;for(const t of e){const e=N(t.opcode);e&&n.add(e)}const r=R(n,t);return r?{blocks:e,extensionURLs:r}:e},getExtensionIdForOpcode:N}},function(e,t,n){const r=n(11),i=n(35),s=n(269);e.exports=class{constructor(e,t){this._renderer=t,this._id=e,this._rotationCenter=r.v3.create(0,0),this._texture=null,this._uniforms={u_skinSize:[0,0],u_skin:null},this._silhouette=new s,this.private=!1}dispose(){this._id=i.ID_NONE}get id(){return this._id}get rotationCenter(){return this._rotationCenter}get size(){return[0,0]}useNearest(e,t){return!0}calculateRotationCenter(){return[this.size[0]/2,this.size[1]/2]}getTexture(e){return this._emptyImageTexture}isMetricsReady(){return!!this.getTexture([100,100])}getFenceBounds(e,t){return e.getAABB(t)}getUniforms(e){return this._uniforms.u_skin=this.getTexture(e),this._uniforms.u_skinSize=this.size,this._uniforms}emitWasAltered(){this._renderer.skinWasAltered(this)}updateSilhouette(){this._silhouette.unlazy()}_setTexture(e){const t=this._renderer.gl;t.bindTexture(t.TEXTURE_2D,this._texture),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this._silhouette.update(e)}setEmptyImageData(){if(this._texture=null,!this._emptyImageData){this._emptyImageData=new ImageData(1,1);const e=this._renderer.gl,t={auto:!0,wrap:e.CLAMP_TO_EDGE,src:this._emptyImageData};this._emptyImageTexture=r.createTexture(e,t)}this._rotationCenter[0]=0,this._rotationCenter[1]=0,this._silhouette.update(this._emptyImageData),this.emitWasAltered()}isTouchingNearest(e){return this._silhouette.isTouchingNearest(e)}isTouchingLinear(e){return this._silhouette.isTouchingLinear(e)}}},function(e,t,n){const r=n(11);class i{constructor(e){this._gl=e,this._shaderCache={};for(const e in i.DRAW_MODE)Object.prototype.hasOwnProperty.call(i.DRAW_MODE,e)&&(this._shaderCache[e]=[])}getShader(e,t){const n=this._shaderCache[e];e===i.DRAW_MODE.silhouette&&(t&=~(i.EFFECT_INFO.color.mask|i.EFFECT_INFO.brightness.mask));let r=n[t];return r||(r=n[t]=this._buildShader(e,t)),r}_buildShader(e,t){const s=i.EFFECTS.length,o=["#define DRAW_MODE_".concat(e)];for(let e=0;e<s;++e)t&1<<e&&o.push("#define ENABLE_".concat(i.EFFECTS[e]));const a="".concat(o.join("\n"),"\n"),c=a+n(272),l=a+n(273);let u=null;const h=r.createProgramInfo(this._gl,[c,l],null,null,(e=>{console.error(e);const t=e.match(/\*\*\* Error compiling shader: ([\s\S]+)/);u=t?t[1].trim():e}));if(!h)throw new Error("Failed to compile shader (mode ".concat(e,", effects ").concat(t,"): ").concat(u));return h}}i.EFFECT_INFO={color:{uniformName:"u_color",mask:1,converter:e=>e/200%1,shapeChanges:!1},fisheye:{uniformName:"u_fisheye",mask:2,converter:e=>Math.max(0,(e+100)/100),shapeChanges:!0},whirl:{uniformName:"u_whirl",mask:4,converter:e=>-e*Math.PI/180,shapeChanges:!0},pixelate:{uniformName:"u_pixelate",mask:8,converter:e=>Math.abs(e)/10,shapeChanges:!0},mosaic:{uniformName:"u_mosaic",mask:16,converter:e=>(e=Math.round((Math.abs(e)+10)/10),Math.max(1,Math.min(e,512))),shapeChanges:!0},brightness:{uniformName:"u_brightness",mask:32,converter:e=>Math.max(-100,Math.min(e,100))/100,shapeChanges:!1},ghost:{uniformName:"u_ghost",mask:64,converter:e=>1-Math.max(0,Math.min(e,100))/100,shapeChanges:!1}},i.EFFECTS=Object.keys(i.EFFECT_INFO),i.DRAW_MODE={default:"default",straightAlpha:"straightAlpha",silhouette:"silhouette",colorMask:"colorMask",line:"line",background:"background"},e.exports=i},function(e,t){const n="undefined"==typeof document,r=n?"[0m":"",i=n?"[90m":"",s=`${n?"[34m":""}debug${r}`,o=`${n?"[36m":""}info${r}`,a=`${n?"[33m":""}warn${r}`,c=`${n?"[31m":""}error${r}`,l=(e="")=>{const t=t=>l(e?`${e} ${t}`:t),n=e?[`${i}${e}${r}`]:[];return t.debug=t.log=console.debug.bind(console,...n,s),t.info=console.log.bind(console,...n,o),t.warn=t.warning=console.warn.bind(console,...n,a),t.error=console.error.bind(console,...n,c),t};l.enable=l.disable=()=>{},e.exports=l},function(e,t,n){const r=n(60);e.exports=class extends r{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(),this._socket=e.getScratchLinkSocket("BLE"),this._socket.setOnOpen(this.requestPeripheral.bind(this)),this._socket.setOnClose(this.handleDisconnectError.bind(this)),this._socket.setOnError(this._handleRequestError.bind(this)),this._socket.setHandleMessage(this._handleMessage.bind(this)),this._sendMessage=this._socket.sendMessage.bind(this._socket),this._availablePeripherals={},this._connectCallback=r,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=i,this._discoverTimeoutID=null,this._extensionId=t,this._peripheralOptions=n,this._runtime=e,this._socket.open()}requestPeripheral(){this._availablePeripherals={},this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._discoverTimeoutID=window.setTimeout(this._handleDiscoverTimeout.bind(this),15e3),this.sendRemoteRequest("discover",this._peripheralOptions).catch((e=>{this._handleRequestError(e)}))}connectPeripheral(e){this.sendRemoteRequest("connect",{peripheralId:e}).then((()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()})).catch((e=>{this._handleRequestError(e)}))}disconnect(){this._connected&&(this._connected=!1),this._socket.isOpen()&&this._socket.close(),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED)}isConnected(){return this._connected}startNotifications(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r={serviceId:e,characteristicId:t};return this._characteristicDidChangeCallback=n,this.sendRemoteRequest("startNotifications",r).catch((e=>{this.handleDisconnectError(e)}))}read(e,t){let n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const r={serviceId:e,characteristicId:t};return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(r.startNotifications=!0),n&&(this._characteristicDidChangeCallback=n),this.sendRemoteRequest("read",r).catch((e=>{this.handleDisconnectError(e)}))}write(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const s={serviceId:e,characteristicId:t,message:n};return r&&(s.encoding=r),null!==i&&(s.withResponse=i),this.sendRemoteRequest("write",s).catch((e=>{this.handleDisconnectError(e)}))}didReceiveCall(e,t){switch(e){case"didDiscoverPeripheral":this._availablePeripherals[t.peripheralId]=t,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[t.peripheralId]=t,this._runtime.emit(this._runtime.constructor.USER_PICKED_PERIPHERAL,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidNotPickPeripheral":this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"characteristicDidChange":this._characteristicDidChangeCallback&&this._characteristicDidChangeCallback(t.message);break;case"ping":return 42}}handleDisconnectError(){this._connected&&(this.disconnect(),this._resetCallback&&this._resetCallback(),this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId}))}_handleRequestError(){this._runtime.emit(this._runtime.constructor.PERIPHERAL_REQUEST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId})}_handleDiscoverTimeout(){this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT)}}},function(e,t,n){const r=n(0);e.exports=function(e){if("string"!=typeof e){if(!Array.isArray(e))return r.error("Unexpected input recieved in replaceUnsafeChars"),e;e=String(e)}return e.replace(/[<>&'"]/g,(e=>{switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}}))}},function(e,t,n){const r=n(68),i=n(65),s=n(0),o=n(20),a=n(1),c=new r;let l=-1;const u=function(e,t,n,r,i){const s=r.id,c=r.opcode,l=r._isHat,u=r._isConditional,h=r._isLoop;if(n.pushReportedValue(e),l)if(n.stackClick)n.status=o.STATUS_RUNNING;else if(t.runtime.getIsEdgeActivatedHat(c)){const r=n.target.hasEdgeActivatedValue(s),i=n.target.updateEdgeActivatedValue(s,e);(r?!i&&e:e)?n.status=o.STATUS_RUNNING:t.retireThread(n)}else e?n.status=o.STATUS_RUNNING:t.retireThread(n);else if((u||h)&&void 0!==e)t.stepToBranch(n,a.toNumber(e),h);else{if(i&&void 0!==e&&n.atStackTop()&&(n.stackClick&&t.runtime.visualReport(n.target,s,e),n.updateMonitor)){const n=t.runtime.monitorBlocks.getBlock(s).targetId;if(n&&!t.runtime.getTargetById(n))return;t.runtime.requestUpdateMonitor({id:s,spriteName:n?t.runtime.getTargetById(n).getName():null,value:e})}n.status=o.STATUS_RUNNING}},h=(e,t,n,r,i)=>{if(u(e,t,n,r,i),i&&(!r._isHat||n.stackClick)){let e,t;do{const r=n.popStack();if(null===r)return;if(t=n.target.blocks.getNextBlock(r),null!==t)break;e=n.peekStackFrame()}while(null!==e&&!e.isLoop);n.pushStack(t)}},d=(e,t,n,r,i)=>{n.status===o.STATUS_RUNNING&&(n.status=o.STATUS_PROMISE_WAIT),e.then((e=>{h(e,t,n,r,i)}),(e=>{s.warn("Primitive rejected promise: ",e),h("".concat(e),t,n,r,i)}))};class p{constructor(e,t){this.id=t.id,this.opcode=t.opcode,this.fields=t.fields,this.inputs=t.inputs,this.mutation=t.mutation,this._profiler=null,this._profilerFrame=null,this._isHat=!1,this._blockFunction=null,this._definedBlockFunction=!1,this._isShadowBlock=!1,this._shadowValue=null,this._fields=Object.assign({},this.fields),this._inputs=Object.assign({},this.inputs),this._argValues={mutation:this.mutation},this._parentKey=null,this._parentValues=null,this._ops=[];const{runtime:n}=c.sequencer,{opcode:r,fields:s,inputs:o}=this;this._isHat=n.getIsHat(r),this._blockFunction=n.getOpcodeFunction(r),this._definedBlockFunction=void 0!==this._blockFunction;const a=n._flowing[r];this._isConditional=!(!a||!a.conditional),this._isLoop=!(!a||!a.loop);const l=Object.keys(s);this._isShadowBlock=!this._definedBlockFunction&&1===l.length&&0===Object.keys(o).length,this._shadowValue=this._isShadowBlock&&s[l[0]].value;for(const e in s)this._argValues[e]="VARIABLE"===e||"LIST"===e||"BROADCAST_OPTION"===e?{id:s[e].id,name:s[e].value}:s[e].value;if(delete this._inputs.custom_block,"BROADCAST_INPUT"in this._inputs){this._argValues.BROADCAST_OPTION={id:null,name:null};const t=this._inputs.BROADCAST_INPUT;if(t.block===t.shadow){const n=e.getBlock(t.shadow).fields.BROADCAST_OPTION;this._argValues.BROADCAST_OPTION.id=n.id,this._argValues.BROADCAST_OPTION.name=n.value,delete this._inputs.BROADCAST_INPUT}}for(const t in this._inputs){const n=this._inputs[t];if(n.block){const r=i.getCached(e,n.block,p);if(r._isHat)continue;this._ops.push(...r._ops),r._parentKey=t,r._parentValues=this._argValues,r._isShadowBlock&&(this._argValues[t]=r._shadowValue)}}this._definedBlockFunction&&this._ops.push(this)}}e.exports=function(e,t){const n=e.runtime;c.sequencer=e,c.thread=t;const r=t.peekStack(),s=t.peekStackFrame();let h=t.blockContainer,f=i.getCached(h,r,p);if(null===f&&(h=n.flyoutBlocks,f=i.getCached(h,r,p),null===f))return void e.retireThread(t);const m=f._ops,g=m.length;let b=0;if(null!==s.reported){const e=s.reported;for(;b<e.length;b++){const{opCached:t,inputValue:n}=e[b],r=m.find((e=>e.id===t));if(r){const e=r._parentKey,t=r._parentValues;"BROADCAST_INPUT"===e?(t.BROADCAST_OPTION.id=null,t.BROADCAST_OPTION.name=a.toString(n)):t[e]=n}}if(e.length>0){const t=e.reverse().find((e=>m.find((t=>t.id===e.opCached))));b=t?m.findIndex((e=>e.id===t.opCached))+1:0}if(null!==t.justReported&&m[b]&&m[b].id===s.reporting){const e=m[b],n=t.justReported;t.justReported=null;const r=e._parentKey,i=e._parentValues;"BROADCAST_INPUT"===r?(i.BROADCAST_OPTION.id=null,i.BROADCAST_OPTION.name=a.toString(n)):i[r]=n,b+=1}s.reporting=null,s.reported=null,s.waitingReporter=!1}const y=b;for(;b<g;b++){const n=b===g-1,r=m[b];s.op=r;const i=r._blockFunction,l=r._argValues;h.forceNoGlow||(t.requestScriptGlowInFrame=!0);const p=i(l,c),f=null!==(E=p)&&"object"==typeof E&&"function"==typeof E.then;if(f||s.waitingReporter){f&&d(p,e,t,r,n),t.justReported=null,s.reporting=m[b].id,s.reported=m.slice(0,b).map((e=>{const t=e._parentKey,n=e._parentValues;return"BROADCAST_INPUT"===t?{opCached:e.id,inputValue:n[t].BROADCAST_OPTION.name}:{opCached:e.id,inputValue:n[t]}}));break}if(t.status===o.STATUS_RUNNING)if(n)u(p,e,t,r,n);else{const e=r._parentKey,t=r._parentValues;"BROADCAST_INPUT"===e?(t.BROADCAST_OPTION.id=null,t.BROADCAST_OPTION.name=a.toString(p)):t[e]=p}else if(t.status===o.STATUS_DONE)break}var E;if(null!==n.profiler){f._profiler!==n.profiler&&function(e,t){t._profiler=e,-1===l&&(l=e.idByName("blockFunction"));const n=t._ops;for(let t=0;t<n.length;t++)n[t]._profilerFrame=e.frame(l,n[t].opcode)}(n.profiler,f);const e=Math.min(b+1,g);for(let t=y;t<e;t++)m[t]._profilerFrame.count+=1}}},function(e,t,n){const r=n(6),i=n(0),s=function(e,t,n,r){return e.assetId=t.assetId,n.audioEngine?n.audioEngine.decodeSoundPlayer(Object.assign({},e,{data:t.data})).then((t=>{e.soundId=t.id;const i=t.buffer;return e.rate=i.sampleRate,e.sampleCount=i.length,null!==r&&r.addSoundPlayer(t),n.isPackaged&&(e.asset=null),e})):(i.warn("No audio engine present; cannot load sound asset: ",e.md5),Promise.resolve(e))},o=function(e,t,n){const r=e.asset,i=e.assetId,o=e.sampleCount,a=e.rate,c=e.format,l=e.dataFormat;return e.assetId=t.storage.defaultAssetId.Sound,e.asset=t.storage.get(e.assetId),e.md5="".concat(e.assetId,".").concat(e.asset.dataFormat),s(e,e.asset,t,n).then((e=>(e.broken={},e.broken.assetId=i,e.broken.md5="".concat(i,".").concat(l),e.broken.asset=r,e.broken.sampleCount=o,e.broken.rate=a,e.broken.format=c,e.broken.dataFormat=l,e)))};e.exports={loadSound:function(e,t,n){if(!t.storage)return i.warn("No storage module present; cannot load sound asset: ",e.md5),Promise.resolve(e);const a=r.splitFirst(e.md5,"."),c=a[0],l=a[1].toLowerCase();return e.dataFormat=l,(e.asset&&Promise.resolve(e.asset)||t.storage.load(t.storage.AssetType.Sound,c,l)).then((r=>(e.asset=r,r?s(e,r,t,n):(i.warn("Failed to find sound data: ",e.md5),o(e,t,n))))).catch((r=>(i.warn("Failed to load sound: ".concat(e.md5," with error: ").concat(r)),o(e,t,n))))},loadSoundFromAsset:s}},function(e,t,n){const r=n(6),i=n(0),s=n(72),{loadSvgString:o,serializeSvgToString:a}=n(25),{parseVectorMetadata:c}=n(79),l=function(e,t,n,r){return new Promise((i=>{let s=e.asset.decodeText();if(void 0===n){const t=c(s);t&&(n=t,e.rotationCenterX=n[0],e.rotationCenterY=n[1])}if(r&&2===r){const n=a(o(s,!0));if(s!==n){s=n;const r=t.storage;e.asset.encodeTextData(n,r.DataFormat.SVG,!0),e.assetId=e.asset.assetId,e.md5="".concat(e.assetId,".").concat(e.dataFormat)}}e.skinId=t.renderer.createSVGSkin(s,n),e.size=t.renderer.getSkinSize(e.skinId),n||(n=t.renderer.getSkinRotationCenter(e.skinId),e.rotationCenterX=n[0],e.rotationCenterY=n[1],e.bitmapResolution=1),t.isPackaged&&(e.asset=null),i(e)}))},u=new class{constructor(){this.pool=[],this.clearSoon=null}clear(){this.clearSoon||(this.clearSoon=new Promise((e=>setTimeout(e,1e3))).then((()=>{this.pool.length=0,this.clearSoon=null})))}create(){return this.pool.pop()||document.createElement("canvas")}release(e){this.clear(),this.pool.push(e)}},h=e=>new Promise(((t,n)=>{const r=new Image;r.onload=function(){t(r),r.onload=null,r.onerror=null},r.onerror=function(){n(new Error("Costume load failed. Asset could not be read.")),r.onload=null,r.onerror=null},r.src=e})),d=new s((async e=>{let t;for(let n=0;n<3;n++)try{if("function"==typeof createImageBitmap){const t=await createImageBitmap(new Blob([e.data.buffer],{type:e.assetType.contentType}));if(!t)throw new Error("createImageBitmap resolved with ".concat(t));return t}return await h(e.encodeDataURI())}catch(e){t||(t=e),i.warn(e),await new Promise((e=>setTimeout(e,2e3*Math.random())))}throw t}),25),p=function(e,t,n){return function(e,t,n){return e&&e.asset?t.v2BitmapAdapter?Promise.all([e.asset,e.textLayerAsset].map((e=>e?d.do(e):null))).then((r=>{let[i,s]=r;if(!i)throw new Error("Loading bitmap costume base failed.");const o=1===e.bitmapResolution?2:1;let a,c;if(s){c=u.create(),c.width=i.width,c.height=i.height;const e=c.getContext("2d");e.drawImage(i,0,0),e.drawImage(s,0,0),a=c}else a=i;return 1!==o&&(a=t.v2BitmapAdapter.resize(a,a.width*o,a.height*o),c&&u.release(c)),a.reusable=!1,n&&(n[0]=n[0]*o,n[1]=n[1]*o,e.rotationCenterX=n[0],e.rotationCenterY=n[1]),e.bitmapResolution=2,delete e.textLayerMD5,delete e.textLayerAsset,{image:a,rotationCenter:n,assetMatchesBase:1===o&&!s}})).finally((()=>{delete e.textLayerMD5,delete e.textLayerAsset})):Promise.reject("No V2 Bitmap adapter present."):Promise.reject("Costume load failed. Assets were missing.")}(e,t,n).then((n=>(n.assetMatchesBase||function(n){if(!t.v2BitmapAdapter)return Promise.reject("No V2 Bitmap adapter present.");const r=t.storage;e.asset=r.createAsset(r.AssetType.ImageBitmap,r.DataFormat.PNG,t.v2BitmapAdapter.convertDataURIToBinary(n),null,!0),e.dataFormat=r.DataFormat.PNG,e.assetId=e.asset.assetId,e.md5="".concat(e.assetId,".").concat(e.dataFormat)}((e=>{if(e instanceof HTMLCanvasElement)return e.toDataURL();const t=u.create();t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0);const n=t.toDataURL();return u.release(t),n})(n.image)),n))).then((n=>{let r,{image:i,rotationCenter:s}=n;s&&(r=[s[0]/2,s[1]/2]),e.skinId=t.renderer.createBitmapSkin(i,e.bitmapResolution,r);const o=t.renderer.getSkinSize(e.skinId);return e.size=[2*o[0],2*o[1]],s||(s=t.renderer.getSkinRotationCenter(e.skinId),e.rotationCenterX=2*s[0],e.rotationCenterY=2*s[1],e.bitmapResolution=2),t.isPackaged&&(e.asset=null),e}))},f=function(e,t){const n=e.asset,r=e.assetId,i=e.rotationCenterX,s=e.rotationCenterY,o=e.bitmapResolution,a=e.dataFormat,c=t.storage.AssetType,u=e.dataFormat===c.ImageVector.runtimeFormat;e.assetId=u?t.storage.defaultAssetId.ImageVector:t.storage.defaultAssetId.ImageBitmap,e.asset=t.storage.get(e.assetId),e.md5="".concat(e.assetId,".").concat(e.asset.dataFormat);return(u?l(e,t):p(e,t)).then((e=>(e.broken={},e.broken.assetId=r,e.broken.md5="".concat(r,".").concat(a),e.broken.asset=n,e.broken.dataFormat=a,e.broken.rotationCenterX=i,e.broken.rotationCenterY=s,e.broken.bitmapResolution=o,e)))},m=function(e,t,n){e.assetId=e.asset.assetId;if(!t.renderer)return i.warn("No rendering module present; cannot load costume: ",e.name),Promise.resolve(e);const r=t.storage.AssetType;let s;return"number"!=typeof e.rotationCenterX||isNaN(e.rotationCenterX)||"number"!=typeof e.rotationCenterY||isNaN(e.rotationCenterY)||(s=[e.rotationCenterX,e.rotationCenterY]),e.asset.assetType.runtimeFormat===r.ImageVector.runtimeFormat?l(e,t,s,n).catch((n=>(i.warn("Error loading vector image: ".concat(n)),f(e,t)))):p(e,t,s).catch((n=>(i.warn("Error loading bitmap image: ".concat(n)),f(e,t))))};e.exports={loadCostume:function(e,t,n,s){const o=r.splitFirst(e,"."),a=o[0],c=o[1].toLowerCase();if(t.dataFormat=c,t.asset)return m(t,n,s);if(!n.storage)return i.warn("No storage module present; cannot load costume asset: ",e),Promise.resolve(t);if(!n.storage.defaultAssetId)return i.warn("No default assets found"),Promise.resolve(t);const l=n.storage.AssetType,u="svg"===c?l.ImageVector:l.ImageBitmap,h=n.storage.load(u,a,c);let d;return d=t.textLayerMD5?n.storage.load(l.ImageBitmap,t.textLayerMD5,"png"):Promise.resolve(null),Promise.all([h,d]).then((e=>e[0]?(t.asset=e[0],e[1]&&(t.textLayerAsset=e[1]),m(t,n,s)):f(t,n))).catch((e=>(i.warn("Error loading costume: ",e),f(t,n))))},loadCostumeFromAsset:m}},function(e,t){e.exports={ID_NONE:-1,Events:{UseHighQualityRenderChanged:"UseHighQualityRenderChanged",AllowPrivateSkinAccessChanged:"AllowPrivateSkinAccessChanged",NativeSizeChanged:"NativeSizeChanged"}}},function(e,t,n){const r=n(29);r.enable(),e.exports=r("scratch-audioengine")},function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__(259),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t){return new Md5(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t<OUTPUT_TYPES.length;++t){var n=OUTPUT_TYPES[t];e[n]=createOutputMethod(n)}return e},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(e){if("string"==typeof e)return crypto.createHash("md5").update(e,"utf8").digest("hex");if(null==e)throw ERROR;return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===Buffer?crypto.createHash("md5").update(new Buffer(e)).digest("hex"):method(e)};return nodeMethod};function Md5(e){if(e)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw ERROR;if(null===e)throw ERROR;if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw ERROR;t=!0}for(var r,i,s=0,o=e.length,a=this.blocks,c=this.buffer8;s<o;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)c[i++]=e[s];else for(i=this.start;s<o&&i<64;++s)a[i>>2]|=e[s]<<SHIFT[3&i++];else if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)(r=e.charCodeAt(s))<128?c[i++]=r:r<2048?(c[i++]=192|r>>6,c[i++]=128|63&r):r<55296||r>=57344?(c[i++]=224|r>>12,c[i++]=128|r>>6&63,c[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),c[i++]=240|r>>18,c[i++]=128|r>>12&63,c[i++]=128|r>>6&63,c[i++]=128|63&r);else for(i=this.start;s<o&&i<64;++s)(r=e.charCodeAt(s))<128?a[i>>2]|=r<<SHIFT[3&i++]:r<2048?(a[i>>2]|=(192|r>>6)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):r<55296||r>=57344?(a[i>>2]|=(224|r>>12)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),a[i>>2]|=(240|r>>18)<<SHIFT[3&i++],a[i>>2]|=(128|r>>12&63)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var e,t,n,r,i,s,o=this.blocks;this.first?t=((t=((e=((e=o[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+o[1]-117830708)<<12|r>>>20)+e|0)&(-271733879^e))+o[2]-1126478375)<<17|n>>>15)+r|0)&(r^e))+o[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((r=this.h3)^t&(n^r))+o[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[1]-389564586)<<12|r>>>20)+e|0)&(e^t))+o[2]+606105819)<<17|n>>>15)+r|0)&(r^e))+o[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(r^t&(n^r))+o[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[5]+1200080426)<<12|r>>>20)+e|0)&(e^t))+o[6]-1473231341)<<17|n>>>15)+r|0)&(r^e))+o[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+o[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[9]-1958414417)<<12|r>>>20)+e|0)&(e^t))+o[10]-42063)<<17|n>>>15)+r|0)&(r^e))+o[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+o[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[13]-40341101)<<12|r>>>20)+e|0)&(e^t))+o[14]-1502002290)<<17|n>>>15)+r|0)&(r^e))+o[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[1]-165796510)<<5|e>>>27)+t|0)^t))+o[6]-1069501632)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[11]+643717713)<<14|n>>>18)+r|0)^r))+o[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[5]-701558691)<<5|e>>>27)+t|0)^t))+o[10]+38016083)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[15]-660478335)<<14|n>>>18)+r|0)^r))+o[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[9]+568446438)<<5|e>>>27)+t|0)^t))+o[14]-1019803690)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[3]-187363961)<<14|n>>>18)+r|0)^r))+o[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[13]-1444681467)<<5|e>>>27)+t|0)^t))+o[2]-51403784)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[7]+1735328473)<<14|n>>>18)+r|0)^r))+o[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[5]-378558)<<4|e>>>28)+t|0))+o[8]-2022574463)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[11]+1839030562)<<16|n>>>16)+r|0))+o[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[1]-1530992060)<<4|e>>>28)+t|0))+o[4]+1272893353)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[7]-155497632)<<16|n>>>16)+r|0))+o[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[13]+681279174)<<4|e>>>28)+t|0))+o[0]-358537222)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[3]-722521979)<<16|n>>>16)+r|0))+o[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[9]-640364487)<<4|e>>>28)+t|0))+o[12]-421815835)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[15]+530742520)<<16|n>>>16)+r|0))+o[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[0]-198630844)<<6|e>>>26)+t|0)|~n))+o[7]+1126891415)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[14]-1416354905)<<15|n>>>17)+r|0)|~e))+o[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[12]+1700485571)<<6|e>>>26)+t|0)|~n))+o[3]-1894986606)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[10]-1051523)<<15|n>>>17)+r|0)|~e))+o[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[8]+1873313359)<<6|e>>>26)+t|0)|~n))+o[15]-30611744)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[6]-1560198380)<<15|n>>>17)+r|0)|~e))+o[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[4]-145523070)<<6|e>>>26)+t|0)|~n))+o[11]-1120210379)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[2]+718787259)<<15|n>>>17)+r|0)|~e))+o[9]-343485551)<<21|t>>>11)+n|0,this.first?(this.h0=e+1732584193|0,this.h1=t-271733879|0,this.h2=n-1732584194|0,this.h3=r+271733878|0,this.first=!1):(this.h0=this.h0+e|0,this.h1=this.h1+t|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,r="",i=this.array(),s=0;s<15;)e=i[s++],t=i[s++],n=i[s++],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[63&(e<<4|t>>>4)]+BASE64_ENCODE_CHAR[63&(t<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return e=i[s],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__(38),__webpack_require__(8))},function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,l=[],u=!1,h=-1;function d(){u&&c&&(u=!1,c.length?l=c.concat(l):h=-1,l.length&&p())}function p(){if(!u){var e=a(d);u=!0;for(var t=l.length;t;){for(c=l,l=[];++h<t;)c&&c[h].run();h=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||u||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},function(e,t){e.exports={SPRITE:"sprite",STAGE:"stage"}},function(e,t,n){const r=n(14);e.exports=class{constructor(e){this._maxTokens=e,this._refillInterval=1e3/e,this._count=this._maxTokens,this._timer=new r,this._timer.start(),this._lastUpdateTime=this._timer.timeElapsed()}okayToSend(){const e=this._timer.timeElapsed(),t=e-this._lastUpdateTime,n=Math.floor(t/this._refillInterval);return n>0&&(this._lastUpdateTime=e),this._count=Math.min(this._maxTokens,this._count+n),this._count>0&&(this._count--,!0)}}},function(e,t,n){(function(t){let n=t.fetch;e.exports={fetchWithTimeout:(e,t,r)=>{let i=null;const s=window.AbortController?new window.AbortController:null,o=s?s.signal:null;return Promise.race([n(e,Object.assign({signal:o},t)).then((e=>(clearTimeout(i),e)),(e=>{throw clearTimeout(i),e})),new Promise(((e,t)=>{i=setTimeout((()=>{s&&s.abort(),t(new Error("Fetch timed out after ".concat(r," ms")))}),r)}))])},setFetch:e=>{n=e}}}).call(this,n(8))},function(e,t,n){function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}const s=n(19),o=n(62),a=n(301),c=n(3),l=n(17),u=n(66),h=n(2),d=n(185),p=n(186),f=n(32),m=n(46),g=n(69),b=n(39),y=n(20),E=n(0),T=n(56),v=n(13),A=n(9),w=n(31),S=n(193),k=n(194),O=n(41),I=n(196),N=n(197),R=n(198),x=n(199),M=n(200),C=n(201),P=n(202),D=n(203),L=n(204),B=n(70),U=n(6),F=n(7),j={scratch3_control:n(205),scratch3_event:n(206),scratch3_looks:n(207),scratch3_motion:n(208),scratch3_operators:n(209),scratch3_sound:n(210),scratch3_sensing:n(211),scratch3_data:n(212),scratch3_procedures:n(213)},z=n(214),G=n(215),V=n(24),_=["#0FBD8C","#0DA57A","#0B8E69"],Y=" // _twconfig_",H=(()=>{const e={};return e[c.ANGLE]={shadow:{type:"math_angle",fieldName:"NUM"}},e[c.COLOR]={shadow:{type:"colour_picker",fieldName:"COLOUR"}},e[c.NUMBER]={shadow:{type:"math_number",fieldName:"NUM"}},e[c.STRING]={shadow:{type:"text",fieldName:"TEXT"}},e[c.BOOLEAN]={check:"Boolean"},e[c.MATRIX]={shadow:{type:"matrix",fieldName:"MATRIX"}},e[c.NOTE]={shadow:{type:"note",fieldName:"NOTE"}},e[c.IMAGE]={fieldType:"field_image"},e[c.COSTUME]={shadow:{type:"looks_costume",fieldName:"COSTUME"}},e[c.SOUND]={shadow:{type:"sound_sounds_menu",fieldName:"SOUND_MENU"}},e})(),W=e=>{let t=0;return{canAddCloudVariable:()=>t<e.limit,addCloudVariable:()=>{t++},removeCloudVariable:()=>{t--},hasCloudVariables:()=>t>0,getNumberOfCloudVariables:()=>t}};let K=-1,X=-1,Z=-1;class q extends s{constructor(){super(),this.targets=[],this.executableTargets=[],this.threads=[],this.threadMap=new Map,this.sequencer=new p(this),this.flyoutBlocks=new l(this,!0),this.monitorBlocks=new l(this,!0),this._editingTarget=null,this._primitives={},this._blockInfo=[],this._hats={},this._flowing={},this._scriptGlowsPreviousFrame=[],this._nonMonitorThreadCount=0,this._lastStepDoneThreads=null,this._cloneCounter=0,this._refreshTargets=!1,this.monitorBlockInfo={},this._monitorState=new R,this.turboMode=!1,this.frameLoop=new G(this),this.currentStepTime=1e3/30,this.updateCurrentMSecs(),this.redrawRequested=!1,this._registerBlockPackages(),this.ioDevices={clock:new x(this),cloud:new M(this),keyboard:new C(this),mouse:new P(this),mouseWheel:new D(this),userData:new L,video:new B(this)},this.peripheralExtensions={},this.profiler=null,this.cloudOptions={limit:10};const e=W(this.cloudOptions);this.hasCloudData=e.hasCloudVariables,this.canAddCloudVariable=e.canAddCloudVariable,this.getNumberOfCloudVariables=e.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(e),this.removeCloudVariable=this._initializeRemoveCloudVariable(e),this.origin=null,this.platform=Object.assign({},I),this._initScratchLink(),this.resetRunId(),this._stageTarget=null,this.addonBlocks={},this.stageWidth=q.STAGE_WIDTH,this.stageHeight=q.STAGE_HEIGHT,this.runtimeOptions={maxClones:q.MAX_CLONES,miscLimits:!0,fencing:!0},this.compilerOptions={enabled:!0,warpTimer:!1},this.debug=!1,this._lastStepTime=Date.now(),this.interpolationEnabled=!1,this._defaultStoredSettings=this._generateAllProjectOptions(),this.isPackaged=!1,this.externalCommunicationMethods={cloudVariables:!1,customExtensions:!1},this.on(q.HAS_CLOUD_DATA_UPDATE,(e=>{this.setExternalCommunicationMethod("cloudVariables",e)})),this.enforcePrivacy=!0,this.privacyRestrictionsActive=!1,this.extensionButtons=new Map,this.fontManager=new k(this),this.extensionStorage={},this.totalAssetRequests=0,this.finishedAssetRequests=0}static get STAGE_WIDTH(){return 480}static get STAGE_HEIGHT(){return 360}static get SCRIPT_GLOW_ON(){return"SCRIPT_GLOW_ON"}static get SCRIPT_GLOW_OFF(){return"SCRIPT_GLOW_OFF"}static get BLOCK_GLOW_ON(){return"BLOCK_GLOW_ON"}static get BLOCK_GLOW_OFF(){return"BLOCK_GLOW_OFF"}static get HAS_CLOUD_DATA_UPDATE(){return"HAS_CLOUD_DATA_UPDATE"}static get TURBO_MODE_ON(){return"TURBO_MODE_ON"}static get TURBO_MODE_OFF(){return"TURBO_MODE_OFF"}static get RUNTIME_OPTIONS_CHANGED(){return"RUNTIME_OPTIONS_CHANGED"}static get COMPILER_OPTIONS_CHANGED(){return"COMPILER_OPTIONS_CHANGED"}static get FRAMERATE_CHANGED(){return"FRAMERATE_CHANGED"}static get INTERPOLATION_CHANGED(){return"INTERPOLATION_CHANGED"}static get STAGE_SIZE_CHANGED(){return"STAGE_SIZE_CHANGED"}static get COMPILE_ERROR(){return"COMPILE_ERROR"}static get BEFORE_EXECUTE(){return"BEFORE_EXECUTE"}static get AFTER_EXECUTE(){return"AFTER_EXECUTE"}static get ASSET_PROGRESS(){return"ASSET_PROGRESS"}static get PROJECT_START(){return"PROJECT_START"}static get PROJECT_RUN_START(){return"PROJECT_RUN_START"}static get PROJECT_RUN_STOP(){return"PROJECT_RUN_STOP"}static get PROJECT_STOP_ALL(){return"PROJECT_STOP_ALL"}static get STOP_FOR_TARGET(){return"STOP_FOR_TARGET"}static get VISUAL_REPORT(){return"VISUAL_REPORT"}static get PROJECT_LOADED(){return"PROJECT_LOADED"}static get PROJECT_CHANGED(){return"PROJECT_CHANGED"}static get TOOLBOX_EXTENSIONS_NEED_UPDATE(){return"TOOLBOX_EXTENSIONS_NEED_UPDATE"}static get TARGETS_UPDATE(){return"TARGETS_UPDATE"}static get MONITORS_UPDATE(){return"MONITORS_UPDATE"}static get BLOCK_DRAG_UPDATE(){return"BLOCK_DRAG_UPDATE"}static get BLOCK_DRAG_END(){return"BLOCK_DRAG_END"}static get EXTENSION_ADDED(){return"EXTENSION_ADDED"}static get EXTENSION_FIELD_ADDED(){return"EXTENSION_FIELD_ADDED"}static get PERIPHERAL_LIST_UPDATE(){return"PERIPHERAL_LIST_UPDATE"}static get USER_PICKED_PERIPHERAL(){return"USER_PICKED_PERIPHERAL"}static get PERIPHERAL_CONNECTED(){return"PERIPHERAL_CONNECTED"}static get PERIPHERAL_DISCONNECTED(){return"PERIPHERAL_DISCONNECTED"}static get PERIPHERAL_REQUEST_ERROR(){return"PERIPHERAL_REQUEST_ERROR"}static get PERIPHERAL_CONNECTION_LOST_ERROR(){return"PERIPHERAL_CONNECTION_LOST_ERROR"}static get PERIPHERAL_SCAN_TIMEOUT(){return"PERIPHERAL_SCAN_TIMEOUT"}static get MIC_LISTENING(){return"MIC_LISTENING"}static get BLOCKSINFO_UPDATE(){return"BLOCKSINFO_UPDATE"}static get RUNTIME_STARTED(){return"RUNTIME_STARTED"}static get RUNTIME_STOPPED(){return"RUNTIME_STOPPED"}static get RUNTIME_DISPOSED(){return"RUNTIME_DISPOSED"}static get BLOCKS_NEED_UPDATE(){return"BLOCKS_NEED_UPDATE"}static get PLATFORM_MISMATCH(){return"PLATFORM_MISMATCH"}static get THREAD_STEP_INTERVAL(){return 1e3/60}static get THREAD_STEP_INTERVAL_COMPATIBILITY(){return 1e3/30}static get MAX_CLONES(){return 300}_initializeAddCloudVariable(e){return()=>{const t=this.hasCloudData();e.addCloudVariable(),!t&&this.hasCloudData()&&this.emit(q.HAS_CLOUD_DATA_UPDATE,!0)}}_initializeRemoveCloudVariable(e){return()=>{const t=this.hasCloudData();e.removeCloudVariable(),t&&!this.hasCloudData()&&this.emit(q.HAS_CLOUD_DATA_UPDATE,!1)}}_registerBlockPackages(){for(const e in j)if(Object.prototype.hasOwnProperty.call(j,e)){const t=new j[e](this);if(t.getPrimitives){const e=t.getPrimitives();for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(this._primitives[n]=e[n].bind(t))}if(t.getHats){const e=t.getHats();for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&(this._hats[t]=e[t])}t.getMonitored&&(this.monitorBlockInfo=Object.assign({},this.monitorBlockInfo,t.getMonitored())),this.compilerRegisterExtension(e,t)}}compilerRegisterExtension(e,t){this["ext_".concat(e)]=t}getMonitorState(){return this._monitorState}_makeExtensionMenuId(e,t){return"".concat(t,"_menu_").concat(e)}makeMessageContextForTarget(e){const t={};(e=e||this.getEditingTarget()||this.getTargetForStage())&&(t.targetType=e.isStage?b.STAGE:b.SPRITE)}_registerExtensionPrimitives(e){const t={id:e.id,name:T(e.name),showStatusButton:e.showStatusButton,blockIconURI:e.blockIconURI,menuIconURI:e.menuIconURI};e.color1?(t.color1=e.color1,t.color2=e.color2,t.color3=e.color3):(t.color1=_[0],t.color2=_[1],t.color3=_[2]),this._blockInfo.push(t),this._fillExtensionCategory(t,e);for(const n in t.customFieldTypes)if(Object.prototype.hasOwnProperty.call(e.customFieldTypes,n)){const e=t.customFieldTypes[n];this.emit(q.EXTENSION_FIELD_ADDED,{name:"field_".concat(e.extendedName),implementation:e.fieldImplementation})}this.emit(q.EXTENSION_ADDED,t)}_refreshExtensionPrimitives(e){const t=this._blockInfo.find((t=>t.id===e.id));t&&(t.name=T(e.name),this._fillExtensionCategory(t,e),this.emit(q.BLOCKSINFO_UPDATE,t))}_fillExtensionCategory(e,t){e.blocks=[],e.customFieldTypes={},e.menus=[],e.menuInfo={};for(const n in t.menus)if(Object.prototype.hasOwnProperty.call(t.menus,n)){const r=t.menus[n],i=this._buildMenuForScratchBlocks(n,r,e);e.menus.push(i),e.menuInfo[n]=r}for(const n in t.customFieldTypes)if(Object.prototype.hasOwnProperty.call(t.customFieldTypes,n)){const r=t.customFieldTypes[n],i=this._buildCustomFieldInfo(n,r,t.id,e);e.customFieldTypes[n]=i}if(t.docsURI){const n={info:{},xml:"<button "+'text="'.concat(w(T({id:"tw.blocks.openDocs",default:"Open Documentation",description:"Button that opens site with more documentation about an extension"})),'" ')+'callbackKey="OPEN_EXTENSION_DOCS" '+'callbackData="'.concat(w(t.docsURI),'"></button>')};e.blocks.push(n)}for(const n of t.blocks)try{const t=this._convertForScratchBlocks(n,e);if(e.blocks.push(t),t.json){const e=t.json.type;n.blockType!==h.EVENT&&(this._primitives[e]=t.info.func),n.blockType===h.EVENT||n.blockType===h.HAT?this._hats[e]={edgeActivated:n.isEdgeActivated,restartExistingThreads:n.shouldRestartExistingThreads}:n.blockType===h.CONDITIONAL?this._flowing[e]={conditional:!0,loop:!1}:n.blockType===h.LOOP&&(this._flowing[e]={conditional:!1,loop:!0})}}catch(e){E.error("Error parsing block: ",{block:n,error:e})}}_convertMenuItems(e){if("function"!=typeof e){const t=this.makeMessageContextForTarget();return e.map((e=>{const n=T(e,t);switch(typeof n){case"string":return[n,n];case"object":return[T(e.text,t),e.value];default:throw new Error("Can't interpret menu item: ".concat(JSON.stringify(e)))}}))}return e}_buildMenuForScratchBlocks(e,t,n){const r=this._makeExtensionMenuId(e,n.id),i=this._convertMenuItems(t.items);return{json:{message0:"%1",type:r,inputsInline:!0,output:"String",colour:n.color1,colourSecondary:n.color2,colourTertiary:n.color3,outputShape:t.acceptReporters?g.OUTPUT_SHAPE_ROUND:g.OUTPUT_SHAPE_SQUARE,args0:[{type:"field_dropdown",name:e,options:i}]}}}_buildCustomFieldInfo(e,t,n,r){const i="".concat(n,"_").concat(e);return{fieldName:e,extendedName:i,argumentTypeInfo:{shadow:{type:i,fieldName:"field_".concat(i)}},scratchBlocksDefinition:this._buildCustomFieldTypeForScratchBlocks(i,t.output,t.outputShape,r),fieldImplementation:t.implementation}}_buildCustomFieldTypeForScratchBlocks(e,t,n,r){return{json:{type:e,message0:"%1",inputsInline:!0,output:t,colour:r.color1,colourSecondary:r.color2,colourTertiary:r.color3,outputShape:n,args0:[{name:"field_".concat(e),type:"field_".concat(e)}]}}}_convertForScratchBlocks(e,t){return"---"===e?this._convertSeparatorForScratchBlocks(e):e.blockType===h.LABEL?this._convertLabelForScratchBlocks(e):e.blockType===h.BUTTON?this._convertButtonForScratchBlocks(e,t):e.blockType===h.XML?this._convertXmlForScratchBlocks(e):this._convertBlockForScratchBlocks(e,t)}_convertBlockForScratchBlocks(e,t){var n,r,i;const s="".concat(t.id,"_").concat(e.opcode),o={type:s,inputsInline:!0,category:t.name,extensions:[],colour:null!==(n=e.color1)&&void 0!==n?n:t.color1,colourSecondary:null!==(r=e.color2)&&void 0!==r?r:t.color2,colourTertiary:null!==(i=e.color3)&&void 0!==i?i:t.color3},a={argsMap:{},blockJSON:o,categoryInfo:t,blockInfo:e,inputList:[]},c=e.blockIconURI||t.blockIconURI;if(o.extensions.push("from_extension"),o.colour===_[0]&&o.colourSecondary===_[1]&&o.colourTertiary===_[2]&&o.extensions.push("default_extension_colors"),c){o.extensions.push("scratch_extension"),o.message0="%1 %2";const e={type:"field_image",src:c,width:40,height:40},t={type:"field_vertical_separator"};o.args0=[e,t]}switch(e.blockType){case h.COMMAND:o.outputShape=g.OUTPUT_SHAPE_SQUARE,o.previousStatement=null,e.isTerminal||(o.nextStatement=null);break;case h.REPORTER:o.output=e.allowDropAnywhere?null:"String",o.outputShape=g.OUTPUT_SHAPE_ROUND;break;case h.BOOLEAN:o.output="Boolean",o.outputShape=g.OUTPUT_SHAPE_HEXAGONAL;break;case h.HAT:case h.EVENT:Object.prototype.hasOwnProperty.call(e,"isEdgeActivated")||(e.isEdgeActivated=!0),o.outputShape=g.OUTPUT_SHAPE_SQUARE,o.nextStatement=null;break;case h.CONDITIONAL:case h.LOOP:e.branchCount=e.branchCount||1,o.outputShape=g.OUTPUT_SHAPE_SQUARE,o.previousStatement=null,e.isTerminal||(o.nextStatement=null)}e.blockShape&&(o.outputShape=e.blockShape);const l=Array.isArray(e.text)?e.text:[e.text];let u=0,d=0,p=0;const f=this._convertPlaceholders.bind(this,a),m=this.makeMessageContextForTarget();for(;u<l.length||d<e.branchCount;){if(u<l.length){a.outLineNum=p;const e=T(l[u],m).replace(/\[(.+?)]/g,f);o["message".concat(p)]?o["message".concat(p)]+=e:o["message".concat(p)]=e,++u,++p}d<e.branchCount&&(o["message".concat(p)]="%1",o["args".concat(p)]=[{type:"input_statement",name:"SUBSTACK".concat(d>0?d+1:"")}],++d,++p)}if(e.blockType===h.REPORTER||e.blockType===h.BOOLEAN)e.disableMonitor||0!==a.inputList.length||(o.checkboxInFlyout=!0);else if(e.branchIconURI||e.blockType===h.LOOP&&!Object.prototype.hasOwnProperty.call(e,"branchIconURI")){var b;o["lastDummyAlign".concat(p)]="RIGHT",o["message".concat(p)]="%1",o["args".concat(p)]=[{type:"field_image",src:null!==(b=e.branchIconURI)&&void 0!==b?b:"media://repeat.svg",width:24,height:24,alt:"*",flip_rtl:!0}],++p}const y=e.isDynamic?'<mutation blockInfo="'.concat(w(JSON.stringify(e)),'"/>'):"",E=a.inputList.join(""),v='<block type="'.concat(w(s),'">').concat(y).concat(E,"</block>");if(e.extensions)for(const t of e.extensions)o.extensions.includes(t)||o.extensions.push(t);return{info:a.blockInfo,json:a.blockJSON,xml:v}}_convertSeparatorForScratchBlocks(e){return{info:e,xml:'<sep gap="36"/>'}}_convertLabelForScratchBlocks(e){return{info:e,xml:'<label text="'.concat(w(e.text),'"></label>')}}_convertButtonForScratchBlocks(e,t){const n=this.makeMessageContextForTarget(),r=T(e.text,n);if(["MAKE_A_LIST","MAKE_A_PROCEDURE","MAKE_A_VARIABLE"].includes(e.func))return{info:e,xml:'<button text="'.concat(w(r),'" callbackKey="').concat(w(e.func),'"></button>')};const i="".concat(t.id,"_").concat(e.func);return this.extensionButtons.set(i,e.callFunc),{info:e,xml:'<button text="'.concat(w(r),'"')+' callbackKey="EXTENSION_CALLBACK"'+' callbackData="'.concat(w(i),'"></button>')}}_convertXmlForScratchBlocks(e){return{info:e,xml:e.xml}}handleExtensionButtonPress(e){this.extensionButtons.get(e)()}_constructInlineImageJson(e){return e.dataURI||E.warn("Missing data URI in extension block with argument type IMAGE"),{type:"field_image",src:e.dataURI||"",width:24,height:24,flip_rtl:e.flipRTL||!1}}_convertPlaceholders(e,t,n){const r=e.blockInfo.arguments[n]||{};let i,s=H[r.type]||{};if(!H[r.type]&&e.categoryInfo.customFieldTypes[r.type]&&(s=e.categoryInfo.customFieldTypes[r.type].argumentTypeInfo),"field_image"===s.fieldType)i=this._constructInlineImageJson(r);else{i={type:"input_value",name:n};const t=void 0===r.defaultValue?null:T(r.defaultValue,this.makeMessageContextForTarget()).toString();let o,a,c;if(s.check&&(i.check=s.check),r.menu){const t=e.categoryInfo.menuInfo[r.menu];t.acceptReporters?(o=n,a=this._makeExtensionMenuId(r.menu,e.categoryInfo.id),c=r.menu):(i.type="field_dropdown",i.options=this._convertMenuItems(t.items),o=null,a=null,c=n)}else o=n,a=s.shadow&&s.shadow.type||null,c=s.shadow&&s.shadow.fieldName||null;o&&e.inputList.push('<value name="'.concat(w(n),'">')),a&&e.inputList.push('<shadow type="'.concat(w(a),'">')),null!==t&&c&&e.inputList.push('<field name="'.concat(w(c),'">').concat(w(t),"</field>")),a&&e.inputList.push("</shadow>"),o&&e.inputList.push("</value>")}const o="args".concat(e.outLineNum),a=e.blockJSON[o]=e.blockJSON[o]||[];i&&a.push(i);const c=a.length;return e.argsMap[n]=c,"%".concat(c)}getBlocksXML(e){return this._blockInfo.map((t=>{const{name:n,color1:r,color2:i}=t,s=t.blocks.filter((t=>{let n=!0;return e&&t.info.filter&&(n=t.info.filter.includes(e.isStage?b.STAGE:b.SPRITE)),n&&!t.info.hideFromPalette})),o='colour="'.concat(w(r),'" secondaryColour="').concat(w(i),'"');let a="";t.menuIconURI?a=t.menuIconURI:t.blockIconURI&&(a=t.blockIconURI);const c=a?'iconURI="'.concat(w(a),'"'):"";let l="";t.showStatusButton&&(l='showStatusButton="true"');let u='<category name="'.concat(w(n),'"');return u+=' id="'.concat(w(t.id),'"'),u+=" ".concat(l),u+=" ".concat(o),u+=" ".concat(c,">"),u+=s.map((e=>e.xml)).join(""),u+="</category>",{id:t.id,xml:u}}))}getBlocksJSON(){return this._blockInfo.reduce(((e,t)=>e.concat(t.blocks.map((e=>e.json)))),[])}_initScratchLink(){if("undefined"!=typeof self&&"undefined"!=typeof document&&document.getElementById&&self.origin&&"null"!==self.origin&&self.navigator&&self.navigator.userAgent&&!self.navigator.userAgent.includes("Node.js")&&!self.navigator.userAgent.includes("jsdom")){if(!document.getElementById("scratch-link-extension-script")){const e=document.createElement("script");e.id="scratch-link-extension-script",document.body.appendChild(e),self.postMessage("inject-scratch-link-script",self.origin)}}}getScratchLinkSocket(e){return(this._linkSocketFactory||this._defaultScratchLinkSocketFactory)(e)}configureScratchLinkSocketFactory(e){this._linkSocketFactory=e}_defaultScratchLinkSocketFactory(e){const t=self.Scratch,n=t&&t.ScratchLinkSafariSocket;return n&&n.isSafariHelperCompatible()?new n(e):new S(e)}registerPeripheralExtension(e,t){this.peripheralExtensions[e]=t}scanForPeripheral(e){this.peripheralExtensions[e]&&this.peripheralExtensions[e].scan()}connectPeripheral(e,t){this.peripheralExtensions[e]&&this.peripheralExtensions[e].connect(t)}disconnectPeripheral(e){this.peripheralExtensions[e]&&this.peripheralExtensions[e].disconnect()}getPeripheralIsConnected(e){let t=!1;return this.peripheralExtensions[e]&&(t=this.peripheralExtensions[e].isConnected()),t}emitMicListening(e){this.emit(q.MIC_LISTENING,e)}getOpcodeFunction(e){return this._primitives[e]}getIsHat(e){return Object.prototype.hasOwnProperty.call(this._hats,e)}getIsEdgeActivatedHat(e){return Object.prototype.hasOwnProperty.call(this._hats,e)&&this._hats[e].edgeActivated}attachAudioEngine(e){this.audioEngine=e}attachRenderer(e){this.renderer=e,this.renderer.setLayerGroupOrdering(v.LAYER_GROUPS),this.renderer.offscreenTouching=!this.runtimeOptions.fencing,this.updatePrivacy()}attachV2BitmapAdapter(e){this.v2BitmapAdapter=e}attachStorage(e){if(this.storage=e,this.isPackaged){const t=e.createAsset;let n=0;e.createAsset=function(e,r,i,s,o){return s||(s=(++n).toString()),t.call(this,e,r,i,s,!1)}}O.setFetch(e.scratchFetch.scratchFetch),this.resetRunId()}_pushThread(e,t,n){const r=new y(e);return r.target=t,r.stackClick=Boolean(n&&n.stackClick),r.updateMonitor=Boolean(n&&n.updateMonitor),r.blockContainer=r.updateMonitor?this.monitorBlocks:t.blocks,r.pushStack(e),this.threads.push(r),r.stackClick||r.updateMonitor||this.threadMap.set(r.getId(),r),n&&n.updateMonitor||!this.compilerOptions.enabled||r.tryCompile(),r}_stopThread(e){e.isKilled=!0,this.sequencer.retireThread(e)}_restartThread(e){const t=new y(e.topBlock);t.target=e.target,t.stackClick=e.stackClick,t.updateMonitor=e.updateMonitor,t.blockContainer=e.blockContainer,t.pushStack(e.topBlock),e.triedToCompile&&this.compilerOptions.enabled&&t.tryCompile(),t.stackClick||t.updateMonitor||this.threadMap.set(t.getId(),t);const n=this.threads.indexOf(e);return n>-1?(this.threads[n]=t,t):(this.threads.push(e),e)}emitCompileError(e,t){this.emit(q.COMPILE_ERROR,e,t)}isActiveThread(e){return e.stack.length>0&&e.status!==y.STATUS_DONE&&this.threads.indexOf(e)>-1}isWaitingThread(e){return e.status===y.STATUS_PROMISE_WAIT||e.status===y.STATUS_YIELD_TICK||!this.isActiveThread(e)}toggleScript(e,t){t=Object.assign({target:this._editingTarget,stackClick:!1},t);for(let n=0;n<this.threads.length;n++)if(this.threads[n].target===t.target&&this.threads[n].topBlock===e&&this.threads[n].status!==y.STATUS_DONE){const r=t.target.blocks,i=r.getOpcode(r.getBlock(e));if(this.getIsEdgeActivatedHat(i)&&this.threads[n].stackClick!==t.stackClick)continue;return void this._stopThread(this.threads[n])}this._pushThread(e,t.target,t)}addMonitorScript(e,t){t||(t=this._editingTarget);for(let t=0;t<this.threads.length;t++)if(this.threads[t].topBlock===e&&this.threads[t].status!==y.STATUS_DONE&&this.threads[t].updateMonitor)return;this._pushThread(e,t,{updateMonitor:!0})}allScriptsDo(e,t){let n=this.executableTargets;t&&(n=[t]);for(let t=n.length-1;t>=0;t--){const r=n[t],i=r.blocks.getScripts();for(let t=0;t<i.length;t++){e(i[t],r)}}}allScriptsByOpcodeDo(e,t,n){let r=this.executableTargets;n&&(r=[n]);for(let n=r.length-1;n>=0;n--){const i=r[n],s=u.getScripts(i.blocks,e);for(let e=0;e<s.length;e++)t(s[e],i)}}startHats(e,t,n){if(!Object.prototype.hasOwnProperty.call(this._hats,e))return;const r=[],i=this._hats[e];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=t[e].toUpperCase());const s=this.threads.length;return this.allScriptsByOpcodeDo(e,((e,n)=>{const{blockId:o,fieldsOfInputs:a}=e;for(const e in t)if(a[e].value!==t[e])return;if(i.restartExistingThreads){const e=this.threadMap.get(y.getIdFromTargetAndBlock(n,o));if(e)return void r.push(this._restartThread(e))}else for(let e=0;e<s;e++)if(this.threads[e].target===n&&this.threads[e].topBlock===o&&!this.threads[e].stackClick&&this.threads[e].status!==y.STATUS_DONE)return;r.push(this._pushThread(o,n))}),n),r.forEach((e=>{e.isCompiled?e.executableHat&&(m.saveGlobalState(),m(e),m.restoreGlobalState()):(f(this.sequencer,e),e.goToNextBlock())})),r}dispose(){this.stopAll(),this.targets.forEach((e=>{e.isOriginal&&e.deleteMonitors()})),this.targets.map(this.disposeTarget,this),this.extensionStorage={},this._monitorState.empty()||(this._monitorState=new R,this.emit(q.MONITORS_UPDATE,this._monitorState.shallowClone())),this.emit(q.RUNTIME_DISPOSED),this.ioDevices.clock.resetProjectTimer(),this.fontManager.clear(),this.hasCloudData()&&this.emit(q.HAS_CLOUD_DATA_UPDATE,!1),this.ioDevices.cloud.clear();const e=W(this.cloudOptions);this.hasCloudData=e.hasCloudVariables,this.canAddCloudVariable=e.canAddCloudVariable,this.getNumberOfCloudVariables=e.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(e),this.removeCloudVariable=this._initializeRemoveCloudVariable(e),this.resetProgress()}addTarget(e){this.targets.push(e),this.executableTargets.push(e),e.isStage&&!this._stageTarget&&(this._stageTarget=e)}moveExecutable(e,t){const n=this.executableTargets.indexOf(e);this.executableTargets.splice(n,1);let r=n+t;return r>this.executableTargets.length&&(r=this.executableTargets.length),r<=0&&(r=this.executableTargets.length>0&&this.executableTargets[0].isStage?1:0),this.executableTargets.splice(r,0,e),r}setExecutablePosition(e,t){const n=this.executableTargets.indexOf(e);return this.moveExecutable(e,t-n)}removeExecutable(e){const t=this.executableTargets.indexOf(e);t>-1&&this.executableTargets.splice(t,1)}disposeTarget(e){this.targets=this.targets.filter((t=>e!==t||(t.dispose(),!1))),this._stageTarget===e&&(this._stageTarget=null)}stopForTarget(e,t){this.emit(q.STOP_FOR_TARGET,e,t);for(let n=0;n<this.threads.length;n++)this.threads[n]!==t&&this.threads[n].target===e&&this._stopThread(this.threads[n])}resetRunId(){if(!this.storage)return;const e=a.v1();this.storage.scratchFetch.setMetadata(this.storage.scratchFetch.RequestMetadata.RunId,e)}greenFlag(){this.stopAll(),this.emit(q.PROJECT_START),this.updateCurrentMSecs(),this.ioDevices.clock.resetProjectTimer(),this.targets.forEach((e=>e.clearEdgeActivatedValues()));for(let e=0;e<this.targets.length;e++)this.targets[e].onGreenFlag();this.startHats("event_whenflagclicked")}stopAll(){this.emit(q.PROJECT_STOP_ALL);const e=[];for(let t=0;t<this.targets.length;t++)this.targets[t].onStopAll(),Object.prototype.hasOwnProperty.call(this.targets[t],"isOriginal")&&!this.targets[t].isOriginal?this.targets[t].dispose():e.push(this.targets[t]);this.targets=e,null!==this.sequencer.activeThread&&this._stopThread(this.sequencer.activeThread),this.threads=[],this.threadMap.clear(),this.resetRunId()}_renderInterpolatedPositions(){const e=this._lastStepTime,t=Date.now()-e,n=Math.min(1,Math.max(0,t/this.currentStepTime));z.interpolate(this,n),this.renderer&&this.renderer.draw()}updateThreadMap(){this.threadMap.clear();for(const e of this.threads)e.stackClick||e.updateMonitor||this.threadMap.set(e.getId(),e)}_step(){this.interpolationEnabled&&z.setupInitialState(this),null!==this.profiler&&(-1===K&&(K=this.profiler.idByName("Runtime._step")),this.profiler.start(K)),this.threads=this.threads.filter((e=>!e.isKilled)),this.updateThreadMap();for(const e in this._hats){if(!Object.prototype.hasOwnProperty.call(this._hats,e))continue;this._hats[e].edgeActivated&&this.startHats(e)}this.redrawRequested=!1,this._pushMonitors(),null!==this.profiler&&(-1===X&&(X=this.profiler.idByName("Sequencer.stepThreads")),this.profiler.start(X)),this.emit(q.BEFORE_EXECUTE);const e=this.sequencer.stepThreads();null!==this.profiler&&this.profiler.stop(),this.emit(q.AFTER_EXECUTE),this._updateGlows(e),this._emitProjectRunStatus(this.threads.length+e.length-this._getMonitorThreadCount([...this.threads,...e])),this._lastStepDoneThreads=e,this.renderer&&(null!==this.profiler&&(-1===Z&&(Z=this.profiler.idByName("RenderWebGL.draw")),this.profiler.start(Z)),document.hidden||this.frameLoop._interpolationAnimation||this.renderer.draw(),null!==this.profiler&&this.profiler.stop()),this._refreshTargets&&(this.emit(q.TARGETS_UPDATE,!1),this._refreshTargets=!1),this._monitorState.dirty&&(this.emit(q.MONITORS_UPDATE,this._monitorState.shallowClone()),this._monitorState.dirty=!1),null!==this.profiler&&(this.profiler.stop(),this.profiler.reportFrames()),this.interpolationEnabled&&(this._lastStepTime=Date.now())}_getMonitorThreadCount(e){let t=0;return e.forEach((e=>{e.updateMonitor&&t++})),t}_pushMonitors(){0!==this.targets.length&&this.monitorBlocks.runAllMonitored(this)}setEditingTarget(e){const t=this._editingTarget;this._editingTarget=e,this._scriptGlowsPreviousFrame=[],this._updateGlows(),t!==this._editingTarget&&this.requestToolboxExtensionsUpdate()}setCompatibilityMode(e){e?this.setFramerate(30):this.setFramerate(60)}setFramerate(e){e>250&&(e=250),e<0&&(e=1),this.frameLoop.setFramerate(e),this.emit(q.FRAMERATE_CHANGED,e)}setInterpolation(e){this.interpolationEnabled=e,this.frameLoop.setInterpolation(this.interpolationEnabled),this.emit(q.INTERPOLATION_CHANGED,e)}setRuntimeOptions(e){this.runtimeOptions=Object.assign({},this.runtimeOptions,e),this.emit(q.RUNTIME_OPTIONS_CHANGED,this.runtimeOptions),this.renderer&&(this.renderer.offscreenTouching=!this.runtimeOptions.fencing)}setCompilerOptions(e){this.compilerOptions=Object.assign({},this.compilerOptions,e),this.resetAllCaches(),this.emit(q.COMPILER_OPTIONS_CHANGED,this.compilerOptions)}setStageSize(e,t){if(e=Math.round(Math.max(1,e)),t=Math.round(Math.max(1,t)),this.stageWidth!==e||this.stageHeight!==t){const n=e-this.stageWidth,r=t-this.stageHeight;if(this._monitorState.size>0){const e=n/2,t=r/2;for(const n of this._monitorState.valueSeq())this.requestUpdateMonitor({id:n.id,x:n.get("x")+e,y:n.get("y")+t});this.emit(q.MONITORS_UPDATE,this._monitorState.shallowClone())}this.stageWidth=e,this.stageHeight=t,this.renderer&&this.renderer.setStageSize(-e/2,e/2,-t/2,t/2),this.emit(q.STAGE_SIZE_CHANGED,e,t)}}setInEditor(e){}convertToPackagedRuntime(){if(this.storage)throw new Error("convertToPackagedRuntime must be called before attachStorage");this.isPackaged=!0}resetAllCaches(){for(const e of this.targets)e.isOriginal&&e.blocks.resetCache();this.flyoutBlocks.resetCache(),this.monitorBlocks.resetCache()}addAddonBlock(e){const t=e.procedureCode,n=e.arguments||[],s=n,o=n.map(((e,t)=>"arg".concat(t))),a=n.map((()=>""));if(this.addonBlocks[t]=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){i(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({namesIdsDefaults:[s,o,a]},e),!e.hidden){const n="a-b";let r=this._blockInfo.find((e=>e.id===n));if(!r){const e='<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48"><path d="M14.92 1.053A13.835 13.835 0 0 0 1.052 14.919v18.162a13.835 13.835 0 0 0 13.866 13.866h18.162a13.835 13.835 0 0 0 13.866-13.866V14.919A13.835 13.835 0 0 0 33.081 1.053zm16.6 12.746L41.72 24 31.52 34.201l-3.276-3.275L35.17 24l-6.926-6.926Zm-15.116.073 3.278 3.278L12.83 24l6.926 6.926L16.48 34.2 6.28 24Z" style="fill:#29beb8;fill-opacity:1;stroke:none;stroke-width:1.51371;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/></svg>';r={id:n,name:T({id:"tw.blocks.addons",default:"Addons",description:"Name of the addon block category in the extension list"}),color1:"#29beb8",color2:"#3aa8a4",color3:"#3aa8a4",menuIconURI:"data:image/svg+xml;,".concat(encodeURIComponent(e)),blocks:[],customFieldTypes:{},menus:[]},this._blockInfo.unshift(r)}r.blocks.push({info:{},xml:'<block type="procedures_call" gap="16"><mutation generateshadows="true" warp="false"'+' proccode="'.concat(w(t),'"')+' argumentnames="'.concat(w(JSON.stringify(s)),'"')+' argumentids="'.concat(w(JSON.stringify(o)),'"')+' argumentdefaults="'.concat(w(JSON.stringify(a)),'"')+"".concat(e.return?' return="'.concat(w(e.return.toString()),'"'):"")+"></mutation></block>"})}this.resetAllCaches()}getAddonBlock(e){return Object.prototype.hasOwnProperty.call(this.addonBlocks,e)?this.addonBlocks[e]:null}findProjectOptionsComment(){const e=this.getTargetForStage().comments;for(const t of Object.values(e))if(t.text.includes(Y))return t;return null}parseProjectOptions(){const e=this.findProjectOptionsComment();if(!e)return;const t=e.text.split("\n").find((e=>e.endsWith(Y)));if(!t)return void E.warn("Config comment does not contain valid line");const n=t.substr(0,t.length-14);let r;try{if(r=o.parse(n),!r||"object"!=typeof r)throw new Error("Invalid object")}catch(e){return void E.warn("Config comment has invalid JSON",e)}"number"==typeof r.framerate&&this.setFramerate(r.framerate),r.turbo&&(this.turboMode=!0,this.emit(q.TURBO_MODE_ON)),r.interpolation&&this.setInterpolation(!0),r.runtimeOptions&&this.setRuntimeOptions(r.runtimeOptions),r.hq&&this.renderer&&this.renderer.setUseHighQualityRender(!0);const i=+r.width||this.stageWidth,s=+r.height||this.stageHeight;i===this.stageWidth&&s===this.stageHeight||this.setStageSize(i,s)}_generateAllProjectOptions(){return{framerate:this.frameLoop.framerate,runtimeOptions:this.runtimeOptions,interpolation:this.interpolationEnabled,turbo:this.turboMode,hq:!!this.renderer&&this.renderer.useHighQualityRender,width:this.stageWidth,height:this.stageHeight}}generateDifferingProjectOptions(){const e=(t,n)=>{const r={};for(const i of Object.keys(n)){const s=n[i],o=t[i];if("object"==typeof s&&s){const t=e(o,s);Object.keys(t).length>0&&(r[i]=t)}else s!==o&&(r[i]=s)}return r};return e(this._defaultStoredSettings,this._generateAllProjectOptions())}storeProjectOptions(){const e=this.generateDifferingProjectOptions(),t="Configuration for https://turbowarp.org/\nYou can move, resize, and minimize this comment, but don't edit it by hand. This comment can be deleted to remove the stored settings.\n".concat(o.stringify(e)).concat(Y),n=this.findProjectOptionsComment();if(n)n.text=t;else{this.getTargetForStage().createComment(F(),null,t,50,50,350,170,!1)}this.emitProjectChanged()}precompile(){this.allScriptsDo(((e,t)=>{const n=t.blocks.getBlock(e);if(this.getIsHat(n.opcode)){const n=new y(e);n.target=t,n.blockContainer=t.blocks,n.tryCompile()}}))}enableDebug(){this.resetAllCaches(),this.debug=!0}_updateGlows(e){const t=[];t.push(...this.threads),e&&t.push(...e);const n=[],r=[];for(let e=0;e<t.length;e++){const r=t[e],i=r.target;if(i===this._editingTarget){const e=r.blockGlowInFrame;if(r.requestScriptGlowInFrame||r.stackClick){let t=i.blocks.getTopLevelScript(e);t||(t=this.flyoutBlocks.getTopLevelScript(e)),t&&n.push(t)}}}for(let e=0;e<this._scriptGlowsPreviousFrame.length;e++){const t=this._scriptGlowsPreviousFrame[e];n.indexOf(t)<0?this.glowScript(t,!1):r.push(t)}for(let e=0;e<n.length;e++){const t=n[e];this._scriptGlowsPreviousFrame.indexOf(t)<0&&(this.glowScript(t,!0),r.push(t))}this._scriptGlowsPreviousFrame=r}_emitProjectRunStatus(e){0===this._nonMonitorThreadCount&&e>0&&this.emit(q.PROJECT_RUN_START),this._nonMonitorThreadCount>0&&0===e&&this.emit(q.PROJECT_RUN_STOP),this._nonMonitorThreadCount=e}quietGlow(e){const t=this._scriptGlowsPreviousFrame.indexOf(e);t>-1&&this._scriptGlowsPreviousFrame.splice(t,1)}glowBlock(e,t){t?this.emit(q.BLOCK_GLOW_ON,{id:e}):this.emit(q.BLOCK_GLOW_OFF,{id:e})}glowScript(e,t){t?this.emit(q.SCRIPT_GLOW_ON,{id:e}):this.emit(q.SCRIPT_GLOW_OFF,{id:e})}emitBlockDragUpdate(e){this.emit(q.BLOCK_DRAG_UPDATE,e)}emitBlockEndDrag(e,t){this.emit(q.BLOCK_DRAG_END,e,t)}visualReport(e,t,n){e===this.getEditingTarget()&&this.emit(q.VISUAL_REPORT,{id:t,value:N(n)})}requestAddMonitor(e){this.requestUpdateMonitor(e)||this._monitorState.set(e.id,e)}requestUpdateMonitor(e){const t=(e=V.externalDeltaToJS(e)).id;return!!this._monitorState.has(t)&&(this._monitorState.set(t,e),!0)}requestRemoveMonitor(e){this._monitorState.delete(e)}requestHideMonitor(e){return this.requestUpdateMonitor({id:e,visible:!1})}requestShowMonitor(e){return this.requestUpdateMonitor({id:e,visible:!0})}requestRemoveMonitorByTargetId(e){this._monitorState.filter((t=>t.targetId!==e))}getTargetById(e){for(let t=0;t<this.targets.length;t++){const n=this.targets[t];if(n.id===e)return n}}getSpriteTargetByName(e){for(let t=0;t<this.targets.length;t++){const n=this.targets[t];if(!n.isStage&&(n.sprite&&n.sprite.name===e))return n}}getTargetByDrawableId(e){for(let t=0;t<this.targets.length;t++){const n=this.targets[t];if(n.drawableID===e)return n}}changeCloneCounter(e){this._cloneCounter+=e}clonesAvailable(){return this._cloneCounter<this.runtimeOptions.maxClones}handleProjectLoaded(){this.emit(q.PROJECT_LOADED),this.resetRunId()}emitProjectChanged(){this.emit(q.PROJECT_CHANGED)}fireTargetWasCreated(e,t){this.emit("targetWasCreated",e,t)}fireTargetWasRemoved(e){this.emit("targetWasRemoved",e)}getTargetForStage(){if(this._stageTarget)return this._stageTarget;for(let e=0;e<this.targets.length;e++){const t=this.targets[e];if(t.isStage)return this._stageTarget=t,t}}getEditingTarget(){return this._editingTarget}getAllVarNamesOfType(e){let t=[];for(const n of this.targets){const r=n.getAllVariableNamesInScopeByType(e,!0);t=t.concat(r)}return t}getLabelForOpcode(e){const[t,n]=U.splitFirst(e,"_");if(!t||!n)return;const r=this._blockInfo.find((e=>e.id===t));if(!r)return;const i=r.blocks.find((e=>e.info.opcode===n));return i?{category:"extension",label:"".concat(r.name,": ").concat(i.info.text)}:void 0}createNewGlobalVariable(e,t,n){const r="string"==typeof n?n:A.SCALAR_TYPE,i=this.getAllVarNamesOfType(r),s=U.unusedName(e,i),o=new A(t||F(),s,r);return this.getTargetForStage().variables[o.id]=o,o}requestRedraw(){this.redrawRequested=!0}requestTargetsUpdate(e){e.isOriginal&&(this._refreshTargets=!0)}requestBlocksUpdate(){this.emit(q.BLOCKS_NEED_UPDATE)}requestToolboxExtensionsUpdate(){this.emit(q.TOOLBOX_EXTENSIONS_NEED_UPDATE)}start(){this.frameLoop.running||(this.frameLoop.start(),this.emit(q.RUNTIME_STARTED))}stop(){this.quit()}quit(){this.frameLoop.running&&(this.frameLoop.stop(),this.emit(q.RUNTIME_STOPPED))}enableProfiling(e){d.available()&&(this.profiler=new d(e))}disableProfiling(){this.profiler=null}updateCurrentMSecs(){this.currentMSecs=Date.now()}updatePrivacy(){this.privacyRestrictionsActive=this.enforcePrivacy&&Object.values(this.externalCommunicationMethods).some((e=>e)),this.renderer&&this.renderer.setPrivateSkinAccess&&this.renderer.setPrivateSkinAccess(!this.privacyRestrictionsActive)}setEnforcePrivacy(e){this.enforcePrivacy=e,this.updatePrivacy()}setExternalCommunicationMethod(e,t){if(!Object.prototype.hasOwnProperty.call(this.externalCommunicationMethods,e))throw new Error("Unknown method: ".concat(e));this.externalCommunicationMethods[e]=t,this.updatePrivacy()}emitAssetProgress(){this.emit(q.ASSET_PROGRESS,this.finishedAssetRequests,this.totalAssetRequests)}resetProgress(){this.finishedAssetRequests=0,this.totalAssetRequests=0,this.emitAssetProgress()}wrapAssetRequest(e){this.totalAssetRequests++,this.emitAssetProgress();return e().then((e=>(this.finishedAssetRequests++,this.emitAssetProgress(),e)),(e=>{throw this.finishedAssetRequests++,this.emitAssetProgress(),e}))}}e.exports=q},function(e,t){e.exports=function(e,t){let n="";for(const e in t){let r=t[e].value;"CURRENTMENU"===e&&(r=r.toLowerCase()),n+="_".concat(r)}return"".concat(e).concat(n)}},function(e,t,n){const r=n(1),i=n(6),s=n(2),o=n(9),a=n(0),c=n(188),{StackOpcode:l,InputOpcode:u,InputType:h}=n(15),{IntermediateStackBlock:d,IntermediateInput:p,IntermediateStack:f,IntermediateScript:m,IntermediateRepresentation:g}=n(10),b=n(45),y="",E="list",T=e=>e.substring(1);class v{constructor(e){this.thread=e,this.target=e.target,this.blocks=e.blockContainer,this.runtime=this.target.runtime,this.stage=this.runtime.getTargetForStage(),this.script=new m,this.script.warpTimer=this.target.runtime.compilerOptions.warpTimer,this.variableCache={},this.usesTimer=!1,this.namesOfCostumesAndSounds=new Set;for(const e of this.runtime.targets)if(e.isOriginal){const t=e.sprite;for(const e of t.costumes)this.namesOfCostumesAndSounds.add(e.name);for(const e of t.sounds)this.namesOfCostumesAndSounds.add(e.name)}this.oldCompilerStub=b.enabled?new b.ScriptTreeGeneratorStub(this):null}setProcedureVariant(e){const t=T(e);this.script.procedureVariant=e,this.script.procedureCode=t,this.script.isProcedure=!0,this.script.yields=!1;const n=this.blocks.getProcedureParamNamesIdsAndDefaults(t);if(null===n)throw new Error("IR: cannot find procedure: ".concat(e));const[r,i,s]=n;this.script.arguments=r}enableWarp(){this.script.isWarp=!0}getBlockById(e){return this.blocks.getBlock(e)||this.blocks.runtime.flyoutBlocks.getBlock(e)}getBlockInfo(e){const[t,n]=i.splitFirst(e,"_");if(!t||!n)return null;const r=this.runtime._blockInfo.find((e=>e.id===t));if(!r)return null;const s=r.blocks.find((e=>e.info.opcode===n));return s||null}createConstantInput(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(null===e)throw new Error("IR: Constant cannot have a null value.");const n=+(e+=""),r=t&&this.namesOfCostumesAndSounds.has(e);if(!Number.isNaN(n)&&(""!==e.trim()||e.includes("\t")))return r||n.toString()!==e?new p(u.CONSTANT,h.STRING_NUM,{value:e}):new p(u.CONSTANT,p.getNumberInputType(n),{value:n});if(!r){if("true"===e)return new p(u.CONSTANT,h.STRING_BOOLEAN,{value:e});if("false"===e)return new p(u.CONSTANT,h.STRING_BOOLEAN,{value:e})}return new p(u.CONSTANT,h.STRING_NAN,{value:e})}descendInputOfBlock(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const r=e.inputs[t];if(!r)return a.warn("IR: ".concat(e.opcode,": missing input ").concat(t),e),this.createConstantInput(0);const i=r.block,s=this.getBlockById(i);if(!s)return a.warn("IR: ".concat(e.opcode,": could not find input ").concat(t," with ID ").concat(i)),this.createConstantInput(0);const o=this.descendInput(s,n);return this.script.yields=this.script.yields||o.yields,o}descendInput(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.oldCompilerStub){const t=this.oldCompilerStub.descendInputFromNewCompiler(e);if(t)return t}switch(e.opcode){case"colour_picker":return this.createConstantInput(e.fields.COLOUR.value,!0);case"math_angle":case"math_integer":case"math_number":case"math_positive_number":case"math_whole_number":return this.createConstantInput(e.fields.NUM.value,t);case"text":return this.createConstantInput(e.fields.TEXT.value,t);case"argument_reporter_string_number":{const t=e.fields.VALUE.value,n=this.script.arguments.lastIndexOf(t);return-1===n&&"last key pressed"===t.toLowerCase()?new p(u.TW_KEY_LAST_PRESSED,h.STRING):-1===n?this.createConstantInput(0):new p(u.PROCEDURE_ARGUMENT,h.ANY,{index:n})}case"argument_reporter_boolean":{const t=e.fields.VALUE.value,n=this.script.arguments.lastIndexOf(t);return-1===n?"is compiled?"===t.toLowerCase()||"is turbowarp?"===t.toLowerCase()?this.createConstantInput(!0).toType(h.BOOLEAN):this.createConstantInput(0):new p(u.PROCEDURE_ARGUMENT,h.ANY,{index:n})}case"data_variable":return new p(u.VAR_GET,h.ANY,{variable:this.descendVariable(e,"VARIABLE",y)});case"data_itemoflist":return new p(u.LIST_GET,h.ANY,{list:this.descendVariable(e,"LIST",E),index:this.descendInputOfBlock(e,"INDEX")});case"data_lengthoflist":return new p(u.LIST_LENGTH,h.NUMBER_POS_INT|h.NUMBER_ZERO,{list:this.descendVariable(e,"LIST",E)});case"data_listcontainsitem":return new p(u.LIST_CONTAINS,h.BOOLEAN,{list:this.descendVariable(e,"LIST",E),item:this.descendInputOfBlock(e,"ITEM")});case"data_itemnumoflist":return new p(u.LIST_INDEX_OF,h.NUMBER_POS_INT|h.NUMBER_ZERO,{list:this.descendVariable(e,"LIST",E),item:this.descendInputOfBlock(e,"ITEM")});case"data_listcontents":return new p(u.LIST_CONTENTS,h.STRING,{list:this.descendVariable(e,"LIST",E)});case"event_broadcast_menu":{const t=e.fields.BROADCAST_OPTION,n=this.target.lookupBroadcastMsg(t.id,t.value),r=n?n.name:"";return this.createConstantInput(r)}case"looks_backdropnumbername":return"number"===e.fields.NUMBER_NAME.value?new p(u.LOOKS_BACKDROP_NUMBER,h.NUMBER_POS_INT):new p(u.LOOKS_BACKDROP_NAME,h.STRING);case"looks_costumenumbername":return"number"===e.fields.NUMBER_NAME.value?new p(u.LOOKS_COSTUME_NUMBER,h.NUMBER_POS_INT):new p(u.LOOKS_COSTUME_NAME,h.STRING);case"looks_size":return new p(u.LOOKS_SIZE_GET,h.NUMBER_POS|h.NUMBER_ZERO);case"motion_direction":return new p(u.MOTION_DIRECTION_GET,h.NUMBER_REAL);case"motion_xposition":return new p(u.MOTION_X_GET,h.NUMBER);case"motion_yposition":return new p(u.MOTION_Y_GET,h.NUMBER);case"operator_add":return new p(u.OP_ADD,h.NUMBER_OR_NAN,{left:this.descendInputOfBlock(e,"NUM1").toType(h.NUMBER),right:this.descendInputOfBlock(e,"NUM2").toType(h.NUMBER)});case"operator_and":return new p(u.OP_AND,h.BOOLEAN,{left:this.descendInputOfBlock(e,"OPERAND1").toType(h.BOOLEAN),right:this.descendInputOfBlock(e,"OPERAND2").toType(h.BOOLEAN)});case"operator_contains":return new p(u.OP_CONTAINS,h.BOOLEAN,{string:this.descendInputOfBlock(e,"STRING1").toType(h.STRING),contains:this.descendInputOfBlock(e,"STRING2").toType(h.STRING)});case"operator_divide":return new p(u.OP_DIVIDE,h.NUMBER_OR_NAN,{left:this.descendInputOfBlock(e,"NUM1").toType(h.NUMBER),right:this.descendInputOfBlock(e,"NUM2").toType(h.NUMBER)});case"operator_equals":return new p(u.OP_EQUALS,h.BOOLEAN,{left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")});case"operator_gt":return new p(u.OP_GREATER,h.BOOLEAN,{left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")});case"operator_join":return new p(u.OP_JOIN,h.STRING,{left:this.descendInputOfBlock(e,"STRING1").toType(h.STRING),right:this.descendInputOfBlock(e,"STRING2").toType(h.STRING)});case"operator_length":return new p(u.OP_LENGTH,h.NUMBER_POS_INT|h.NUMBER_ZERO,{string:this.descendInputOfBlock(e,"STRING").toType(h.STRING)});case"operator_letter_of":return new p(u.OP_LETTER_OF,h.STRING,{letter:this.descendInputOfBlock(e,"LETTER").toType(h.NUMBER_INDEX),string:this.descendInputOfBlock(e,"STRING").toType(h.STRING)});case"operator_lt":return new p(u.OP_LESS,h.BOOLEAN,{left:this.descendInputOfBlock(e,"OPERAND1"),right:this.descendInputOfBlock(e,"OPERAND2")});case"operator_mathop":{const t=this.descendInputOfBlock(e,"NUM").toType(h.NUMBER);switch(e.fields.OPERATOR.value.toLowerCase()){case"abs":return new p(u.OP_ABS,h.NUMBER_POS|h.NUMBER_ZERO,{value:t});case"floor":return new p(u.OP_FLOOR,h.NUMBER_INT|h.NUMBER_INF,{value:t});case"ceiling":return new p(u.OP_CEILING,h.NUMBER_INT|h.NUMBER_INF,{value:t});case"sqrt":return new p(u.OP_SQRT,h.NUMBER_OR_NAN,{value:t});case"sin":return new p(u.OP_SIN,h.NUMBER_OR_NAN,{value:t});case"cos":return new p(u.OP_COS,h.NUMBER_OR_NAN,{value:t});case"tan":return new p(u.OP_TAN,h.NUMBER_OR_NAN,{value:t});case"asin":return new p(u.OP_ASIN,h.NUMBER_OR_NAN,{value:t});case"acos":return new p(u.OP_ACOS,h.NUMBER_OR_NAN,{value:t});case"atan":return new p(u.OP_ATAN,h.NUMBER,{value:t});case"ln":return new p(u.OP_LOG_E,h.NUMBER_OR_NAN,{value:t});case"log":return new p(u.OP_LOG_10,h.NUMBER_OR_NAN,{value:t});case"e ^":return new p(u.OP_POW_E,h.NUMBER,{value:t});case"10 ^":return new p(u.OP_POW_10,h.NUMBER,{value:t});default:return this.createConstantInput(0)}}case"operator_mod":return new p(u.OP_MOD,h.NUMBER_OR_NAN,{left:this.descendInputOfBlock(e,"NUM1").toType(h.NUMBER),right:this.descendInputOfBlock(e,"NUM2").toType(h.NUMBER)});case"operator_multiply":return new p(u.OP_MULTIPLY,h.NUMBER_OR_NAN,{left:this.descendInputOfBlock(e,"NUM1").toType(h.NUMBER),right:this.descendInputOfBlock(e,"NUM2").toType(h.NUMBER)});case"operator_not":return new p(u.OP_NOT,h.BOOLEAN,{operand:this.descendInputOfBlock(e,"OPERAND").toType(h.BOOLEAN)});case"operator_or":return new p(u.OP_OR,h.BOOLEAN,{left:this.descendInputOfBlock(e,"OPERAND1").toType(h.BOOLEAN),right:this.descendInputOfBlock(e,"OPERAND2").toType(h.BOOLEAN)});case"operator_random":{const t=this.descendInputOfBlock(e,"FROM"),n=this.descendInputOfBlock(e,"TO");if(t.opcode===u.CONSTANT&&n.opcode===u.CONSTANT){const e=t.inputs.value,i=n.inputs.value,s=r.toNumber(e),o=r.toNumber(i);return s===o?this.createConstantInput(s):r.isInt(e)&&r.isInt(i)?new p(u.OP_RANDOM,h.NUMBER,{low:(s<=o?t:n).toType(h.NUMBER),high:(s<=o?n:t).toType(h.NUMBER),useInts:!0,useFloats:!1}):new p(u.OP_RANDOM,h.NUMBER_OR_NAN,{low:(s<=o?t:n).toType(h.NUMBER),high:(s<=o?n:t).toType(h.NUMBER),useInts:!1,useFloats:!0})}if(t.opcode===u.CONSTANT){if(!r.isInt(r.toNumber(t.inputs.value)))return new p(u.OP_RANDOM,h.NUMBER_OR_NAN,{low:t.toType(h.NUMBER),high:n.toType(h.NUMBER),useInts:!1,useFloats:!0})}else if(n.opcode===u.CONSTANT&&!r.isInt(r.toNumber(t.inputs.value)))return new p(u.OP_RANDOM,h.NUMBER_OR_NAN,{low:t.toType(h.NUMBER),high:n.toType(h.NUMBER),useInts:!1,useFloats:!0});return new p(u.OP_RANDOM,h.NUMBER_OR_NAN,{low:t,high:n,useInts:!1,useFloats:!1})}case"operator_round":return new p(u.OP_ROUND,h.NUMBER_INT|h.NUMBER_INF,{value:this.descendInputOfBlock(e,"NUM").toType(h.NUMBER)});case"operator_subtract":return new p(u.OP_SUBTRACT,h.NUMBER_OR_NAN,{left:this.descendInputOfBlock(e,"NUM1").toType(h.NUMBER),right:this.descendInputOfBlock(e,"NUM2").toType(h.NUMBER)});case"procedures_call":{const t=this.getProcedureInfo(e);return new p(t.opcode,h.ANY,t.inputs,t.yields)}case"sensing_answer":return new p(u.SENSING_ANSWER,h.STRING);case"sensing_coloristouchingcolor":return new p(u.SENSING_COLOR_TOUCHING_COLOR,h.BOOLEAN,{target:this.descendInputOfBlock(e,"COLOR2").toType(h.COLOR),mask:this.descendInputOfBlock(e,"COLOR").toType(h.COLOR)});case"sensing_current":switch(e.fields.CURRENTMENU.value.toLowerCase()){case"year":return new p(u.SENSING_TIME_YEAR,h.NUMBER_POS_INT|h.NUMBER_ZERO);case"month":return new p(u.SENSING_TIME_MONTH,h.NUMBER_POS_INT);case"date":return new p(u.SENSING_TIME_DATE,h.NUMBER_POS_INT);case"dayofweek":return new p(u.SENSING_TIME_WEEKDAY,h.NUMBER_POS_INT);case"hour":return new p(u.SENSING_TIME_HOUR,h.NUMBER_POS_INT|h.NUMBER_ZERO);case"minute":return new p(u.SENSING_TIME_MINUTE,h.NUMBER_POS_INT|h.NUMBER_ZERO);case"second":return new p(u.SENSING_TIME_SECOND,h.NUMBER_POS_INT|h.NUMBER_ZERO);default:return this.createConstantInput(0)}case"sensing_dayssince2000":return new p(u.SENSING_TIME_DAYS_SINCE_2000,h.NUMBER);case"sensing_distanceto":return new p(u.SENSING_DISTANCE,h.NUMBER_POS|h.NUMBER_ZERO,{target:this.descendInputOfBlock(e,"DISTANCETOMENU").toType(h.STRING)});case"sensing_keypressed":return new p(u.SENSING_KEY_DOWN,h.BOOLEAN,{key:this.descendInputOfBlock(e,"KEY_OPTION",!0)});case"sensing_mousedown":return new p(u.SENSING_MOUSE_DOWN,h.BOOLEAN);case"sensing_mousex":return new p(u.SENSING_MOUSE_X,h.NUMBER);case"sensing_mousey":return new p(u.SENSING_MOUSE_Y,h.NUMBER);case"sensing_of":{const t=e.fields.PROPERTY.value,n=this.descendInputOfBlock(e,"OBJECT").toType(h.STRING);if(n.opcode!==u.CONSTANT)return new p(u.SENSING_OF,h.ANY,{object:n,property:t});if("volume"===t)return new p(u.SENSING_OF_VOLUME,h.NUMBER_POS_REAL|h.NUMBER_ZERO,{object:n,property:t});if(n.isConstant("_stage_"))switch(t){case"background #":case"backdrop #":return new p(u.SENSING_OF_BACKDROP_NUMBER,h.NUMBER_POS_INT);case"backdrop name":return new p(u.SENSING_OF_BACKDROP_NAME,h.STRING)}else switch(t){case"x position":return new p(u.SENSING_OF_POS_X,h.NUMBER,{object:n});case"y position":return new p(u.SENSING_OF_POS_Y,h.NUMBER,{object:n});case"direction":return new p(u.SENSING_OF_DIRECTION,h.NUMBER_REAL,{object:n});case"costume #":return new p(u.SENSING_OF_COSTUME_NUMBER,h.NUMBER_POS_INT|h.NUMBER_ZERO,{object:n});case"costume name":return new p(u.SENSING_OF_COSTUME_NAME,h.STRING|h.NUMBER_ZERO,{object:n});case"size":return new p(u.SENSING_OF_SIZE,h.NUMBER_POS|h.NUMBER_ZERO,{object:n})}return new p(u.SENSING_OF_VAR,h.ANY,{object:n,property:t})}case"sensing_timer":return this.usesTimer=!0,new p(u.SENSING_TIMER_GET,h.NUMBER_POS_REAL|h.NUMBER_ZERO);case"sensing_touchingcolor":return new p(u.SENSING_TOUCHING_COLOR,h.BOOLEAN,{color:this.descendInputOfBlock(e,"COLOR").toType(h.COLOR)});case"sensing_touchingobject":return new p(u.SENSING_TOUCHING_OBJECT,h.BOOLEAN,{object:this.descendInputOfBlock(e,"TOUCHINGOBJECTMENU")});case"sensing_username":return new p(u.SENSING_USERNAME,h.STRING);case"sound_sounds_menu":return this.createConstantInput(e.fields.SOUND_MENU.value,!0);case"control_get_counter":return new p(u.CONTROL_COUNTER,h.NUMBER_POS_INT|h.NUMBER_ZERO);case"tw_getLastKeyPressed":return new p(u.TW_KEY_LAST_PRESSED,h.STRING);default:{if(this.runtime.getOpcodeFunction(e.opcode)){if(c.inputs.includes(e.opcode))return this.descendCompatLayerInput(e);const t=this.getBlockInfo(e.opcode);if(t){const n=t.info.blockType;if(n===s.REPORTER||n===s.BOOLEAN)return this.descendCompatLayerInput(e)}}const n=Object.keys(e.inputs),r=Object.keys(e.fields);if(0===n.length&&1===r.length)return this.createConstantInput(e.fields[r[0]].value,t);throw a.warn("IR: Unknown input: ".concat(e.opcode),e),new Error("IR: Unknown input: ".concat(e.opcode))}}}descendStackedBlock(e){if(this.oldCompilerStub){const t=this.oldCompilerStub.descendStackedBlockFromNewCompiler(e);if(t)return t}switch(e.opcode){case"control_all_at_once":return new d(l.CONTROL_IF_ELSE,{condition:this.createConstantInput(!0).toType(h.BOOLEAN),whenTrue:this.descendSubstack(e,"SUBSTACK"),whenFalse:new f});case"control_create_clone_of":return new d(l.CONTROL_CLONE_CREATE,{target:this.descendInputOfBlock(e,"CLONE_OPTION").toType(h.STRING)});case"control_delete_this_clone":return new d(l.CONTROL_CLONE_DELETE,{},!0);case"control_forever":return new d(l.CONTROL_WHILE,{condition:this.createConstantInput(!0).toType(h.BOOLEAN),do:this.descendSubstack(e,"SUBSTACK")},this.analyzeLoop());case"control_for_each":return new d(l.CONTROL_FOR,{variable:this.descendVariable(e,"VARIABLE",y),count:this.descendInputOfBlock(e,"VALUE").toType(h.NUMBER),do:this.descendSubstack(e,"SUBSTACK")},this.analyzeLoop());case"control_if":return new d(l.CONTROL_IF_ELSE,{condition:this.descendInputOfBlock(e,"CONDITION").toType(h.BOOLEAN),whenTrue:this.descendSubstack(e,"SUBSTACK"),whenFalse:new f});case"control_if_else":return new d(l.CONTROL_IF_ELSE,{condition:this.descendInputOfBlock(e,"CONDITION").toType(h.BOOLEAN),whenTrue:this.descendSubstack(e,"SUBSTACK"),whenFalse:this.descendSubstack(e,"SUBSTACK2")});case"control_repeat":return new d(l.CONTROL_REPEAT,{times:this.descendInputOfBlock(e,"TIMES").toType(h.NUMBER),do:this.descendSubstack(e,"SUBSTACK")},this.analyzeLoop());case"control_repeat_until":{this.usesTimer=!1;const t=this.descendInputOfBlock(e,"CONDITION").toType(h.BOOLEAN),n=this.usesTimer;return new d(l.CONTROL_WHILE,{condition:new p(u.OP_NOT,h.BOOLEAN,{operand:t}),do:this.descendSubstack(e,"SUBSTACK"),warpTimer:n},this.analyzeLoop()||n)}case"control_stop":{const t=e.fields.STOP_OPTION.value;return"all"===t?new d(l.CONTROL_STOP_ALL,{},!0):new d("other scripts in sprite"===t||"other scripts in stage"===t?l.CONTROL_STOP_OTHERS:"this script"===t?l.CONTROL_STOP_SCRIPT:l.NOP)}case"control_wait":return new d(l.CONTROL_WAIT,{seconds:this.descendInputOfBlock(e,"DURATION").toType(h.NUMBER)},!0);case"control_wait_until":return new d(l.CONTROL_WAIT_UNTIL,{condition:this.descendInputOfBlock(e,"CONDITION").toType(h.BOOLEAN)},!0);case"control_while":return new d(l.CONTROL_WHILE,{condition:this.descendInputOfBlock(e,"CONDITION").toType(h.BOOLEAN),do:this.descendSubstack(e,"SUBSTACK"),warpTimer:!1},this.analyzeLoop());case"control_clear_counter":return new d(l.CONTROL_CLEAR_COUNTER);case"control_incr_counter":return new d(l.CONTORL_INCR_COUNTER);case"data_addtolist":return new d(l.LIST_ADD,{list:this.descendVariable(e,"LIST",E),item:this.descendInputOfBlock(e,"ITEM",!0)});case"data_changevariableby":{const t=this.descendVariable(e,"VARIABLE",y);return new d(l.VAR_SET,{variable:t,value:new p(u.OP_ADD,h.NUMBER_OR_NAN,{left:new p(u.VAR_GET,h.ANY,{variable:t}).toType(h.NUMBER),right:this.descendInputOfBlock(e,"VALUE").toType(h.NUMBER)})})}case"data_deletealloflist":return new d(l.LIST_DELETE_ALL,{list:this.descendVariable(e,"LIST",E)});case"data_deleteoflist":{const t=this.descendInputOfBlock(e,"INDEX");return t.isConstant("all")?new d(l.LIST_DELETE_ALL,{list:this.descendVariable(e,"LIST",E)}):new d(l.LIST_DELETE,{list:this.descendVariable(e,"LIST",E),index:t})}case"data_hidelist":return new d(l.LIST_HIDE,{list:this.descendVariable(e,"LIST",E)});case"data_hidevariable":return new d(l.VAR_HIDE,{variable:this.descendVariable(e,"VARIABLE",y)});case"data_insertatlist":return new d(l.LIST_INSERT,{list:this.descendVariable(e,"LIST",E),index:this.descendInputOfBlock(e,"INDEX"),item:this.descendInputOfBlock(e,"ITEM",!0)});case"data_replaceitemoflist":return new d(l.LIST_REPLACE,{list:this.descendVariable(e,"LIST",E),index:this.descendInputOfBlock(e,"INDEX"),item:this.descendInputOfBlock(e,"ITEM",!0)});case"data_setvariableto":return new d(l.VAR_SET,{variable:this.descendVariable(e,"VARIABLE",y),value:this.descendInputOfBlock(e,"VALUE",!0)});case"data_showlist":return new d(l.LIST_SHOW,{list:this.descendVariable(e,"LIST",E)});case"data_showvariable":return new d(l.VAR_SHOW,{variable:this.descendVariable(e,"VARIABLE",y)});case"event_broadcast":return new d(l.EVENT_BROADCAST,{broadcast:this.descendInputOfBlock(e,"BROADCAST_INPUT").toType(h.STRING)});case"event_broadcastandwait":return new d(l.EVENT_BROADCAST_AND_WAIT,{broadcast:this.descendInputOfBlock(e,"BROADCAST_INPUT").toType(h.STRING)},!0);case"looks_changeeffectby":return new d(l.LOOKS_EFFECT_CHANGE,{effect:e.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(e,"CHANGE").toType(h.NUMBER)});case"looks_changesizeby":return new d(l.LOOKS_SIZE_CHANGE,{size:this.descendInputOfBlock(e,"CHANGE").toType(h.NUMBER)});case"looks_cleargraphiceffects":return new d(l.LOOKS_EFFECT_CLEAR);case"looks_goforwardbackwardlayers":return"forward"===e.fields.FORWARD_BACKWARD.value?new d(l.LOOKS_LAYER_FORWARD,{layers:this.descendInputOfBlock(e,"NUM").toType(h.NUMBER)}):new d(l.LOOKS_LAYER_BACKWARD,{layers:this.descendInputOfBlock(e,"NUM").toType(h.NUMBER)});case"looks_gotofrontback":return"front"===e.fields.FRONT_BACK.value?new d(l.LOOKS_LAYER_FRONT):new d(l.LOOKS_LAYER_BACK);case"looks_hide":return new d(l.LOOKS_HIDE);case"looks_nextbackdrop":return new d(l.LOOKS_BACKDROP_NEXT);case"looks_nextcostume":return new d(l.LOOKS_COSTUME_NEXT);case"looks_say":return new d(l.LOOKS_SAY,{message:this.descendInputOfBlock(e,"MESSAGE")});case"looks_seteffectto":return new d(l.LOOKS_EFFECT_SET,{effect:e.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(e,"VALUE").toType(h.NUMBER)});case"looks_setsizeto":return new d(l.LOOKS_SIZE_SET,{size:this.descendInputOfBlock(e,"SIZE").toType(h.NUMBER)});case"looks_show":return new d(l.LOOKS_SHOW);case"looks_switchbackdropto":return new d(l.LOOKS_BACKDROP_SET,{backdrop:this.descendInputOfBlock(e,"BACKDROP",!0)});case"looks_switchcostumeto":return new d(l.LOOKS_COSTUME_SET,{costume:this.descendInputOfBlock(e,"COSTUME",!0)});case"looks_think":return new d(l.LOOKS_THINK,{message:this.descendInputOfBlock(e,"MESSAGE")});case"motion_changexby":return new d(l.MOTION_X_CHANGE,{dx:this.descendInputOfBlock(e,"DX").toType(h.NUMBER)});case"motion_changeyby":return new d(l.MOTION_Y_CHANGE,{dy:this.descendInputOfBlock(e,"DY").toType(h.NUMBER)});case"motion_gotoxy":return new d(l.MOTION_XY_SET,{x:this.descendInputOfBlock(e,"X").toType(h.NUMBER),y:this.descendInputOfBlock(e,"Y").toType(h.NUMBER)});case"motion_ifonedgebounce":return new d(l.MOTION_IF_ON_EDGE_BOUNCE);case"motion_movesteps":return new d(l.MOTION_STEP,{steps:this.descendInputOfBlock(e,"STEPS").toType(h.NUMBER)});case"motion_pointindirection":return new d(l.MOTION_DIRECTION_SET,{direction:this.descendInputOfBlock(e,"DIRECTION").toType(h.NUMBER)});case"motion_setrotationstyle":return new d(l.MOTION_ROTATION_STYLE_SET,{style:e.fields.STYLE.value});case"motion_setx":return new d(l.MOTION_X_SET,{x:this.descendInputOfBlock(e,"X").toType(h.NUMBER)});case"motion_sety":return new d(l.MOTION_Y_SET,{y:this.descendInputOfBlock(e,"Y").toType(h.NUMBER)});case"motion_turnleft":return new d(l.MOTION_DIRECTION_SET,{direction:new p(u.OP_SUBTRACT,h.NUMBER,{left:new p(u.MOTION_DIRECTION_GET,h.NUMBER),right:this.descendInputOfBlock(e,"DEGREES").toType(h.NUMBER)})});case"motion_turnright":return new d(l.MOTION_DIRECTION_SET,{direction:new p(u.OP_ADD,h.NUMBER,{left:new p(u.MOTION_DIRECTION_GET,h.NUMBER),right:this.descendInputOfBlock(e,"DEGREES").toType(h.NUMBER)})});case"pen_clear":return new d(l.PEN_CLEAR);case"pen_changePenColorParamBy":return new d(l.PEN_COLOR_PARAM_CHANGE,{param:this.descendInputOfBlock(e,"COLOR_PARAM").toType(h.STRING),value:this.descendInputOfBlock(e,"VALUE").toType(h.NUMBER)});case"pen_changePenHueBy":return new d(l.PEN_COLOR_HUE_CHANGE_LEGACY,{hue:this.descendInputOfBlock(e,"HUE").toType(h.NUMBER)});case"pen_changePenShadeBy":return new d(l.PEN_COLOR_SHADE_CHANGE_LEGACY,{shade:this.descendInputOfBlock(e,"SHADE").toType(h.NUMBER)});case"pen_penDown":return new d(l.PEN_DOWN);case"pen_penUp":return new d(l.PEN_UP);case"pen_setPenColorParamTo":return new d(l.PEN_COLOR_PARAM_SET,{param:this.descendInputOfBlock(e,"COLOR_PARAM").toType(h.STRING),value:this.descendInputOfBlock(e,"VALUE").toType(h.NUMBER)});case"pen_setPenColorToColor":return new d(l.PEN_COLOR_SET,{color:this.descendInputOfBlock(e,"COLOR")});case"pen_setPenHueToNumber":return new d(l.PEN_COLOR_HUE_SET_LEGACY,{hue:this.descendInputOfBlock(e,"HUE").toType(h.NUMBER)});case"pen_setPenShadeToNumber":return new d(l.PEN_COLOR_SHADE_SET_LEGACY,{shade:this.descendInputOfBlock(e,"SHADE").toType(h.NUMBER)});case"pen_setPenSizeTo":return new d(l.PEN_SIZE_SET,{size:this.descendInputOfBlock(e,"SIZE").toType(h.NUMBER)});case"pen_changePenSizeBy":return new d(l.PEN_SIZE_CHANGE,{size:this.descendInputOfBlock(e,"SIZE").toType(h.NUMBER)});case"pen_stamp":return new d(l.PEN_STAMP);case"procedures_call":{const t=e.mutation.proccode;if(e.mutation.return){const t=this.descendVisualReport(e);if(t)return t}if("tw:debugger;"===t)return new d(l.DEBUGGER);const n=this.getProcedureInfo(e);return new d(n.opcode,n.inputs,n.yields)}case"procedures_return":return new d(l.PROCEDURE_RETURN,{value:this.descendInputOfBlock(e,"VALUE")});case"sensing_resettimer":return new d(l.SENSING_TIMER_RESET);default:{if(this.runtime.getOpcodeFunction(e.opcode)){if(c.stacked.includes(e.opcode))return this.descendCompatLayerStack(e);const t=this.getBlockInfo(e.opcode);if(t){const n=t.info.blockType;if(n===s.COMMAND||n===s.CONDITIONAL||n===s.LOOP)return this.descendCompatLayerStack(e)}}const t=this.descendVisualReport(e);if(t)return t;throw a.warn("IR: Unknown stacked block: ".concat(e.opcode),e),new Error("IR: Unknown stacked block: ".concat(e.opcode))}}}descendSubstack(e,t){const n=e.inputs[t];if(!n)return new f;const r=n.block;return this.walkStack(r)}walkStack(e){const t=new f;let n=e;for(;null!==n;){const e=this.getBlockById(n);if(!e)break;const r=this.descendStackedBlock(e);this.script.yields=this.script.yields||r.yields,t.blocks.push(r),n=e.next}return t}getProcedureInfo(e){const t=e.mutation.proccode,n=this.blocks.getProcedureParamNamesIdsAndDefaults(t);if(null===n)return{opcode:l.NOP,yields:!1};const[r,i,s]=n;if(this.runtime.getAddonBlock(t)){const n={};for(let t=0;t<i.length;t++){let o;o=e.inputs[i[t]]&&e.inputs[i[t]].block?this.descendInputOfBlock(e,i[t],!0):this.createConstantInput(s[t],!0),n[r[t]]=o}return{opcode:l.ADDON_CALL,inputs:{code:t,arguments:n,blockId:e.id},yields:!0}}const o=this.blocks.getProcedureDefinition(t),a=this.blocks.getBlock(o);if(!a)return{opcode:l.NOP,yields:!1};const c=this.blocks.getBlock(a.inputs.custom_block.block);let u=this.script.isWarp;if(!u&&c&&c.mutation){const e=c.mutation.warp;"boolean"==typeof e?u=e:"string"==typeof e&&(u=JSON.parse(e))}const h=(d=t,u?"W".concat(d):"Z".concat(d));var d;this.script.dependedProcedures.includes(h)||this.script.dependedProcedures.push(h);const p=[];for(let t=0;t<i.length;t++){let n;n=e.inputs[i[t]]&&e.inputs[i[t]].block?this.descendInputOfBlock(e,i[t],!0):this.createConstantInput(s[t],!0),p.push(n)}return{opcode:l.PROCEDURE_CALL,inputs:{code:t,variant:h,arguments:p},yields:!this.script.isWarp&&t===this.script.procedureCode}}descendVisualReport(e){if(!this.thread.stackClick||e.next)return null;try{return new d(l.VISUAL_REPORT,{input:this.descendInput(e)})}catch(e){return null}}descendVariable(e,t,n){const r=e.fields[t],i=r.id;if(i&&Object.prototype.hasOwnProperty.call(this.variableCache,i))return this.variableCache[i];const s=this._descendVariable(i,r.value,n);return this.variableCache[String(s.id)]=s,s}_descendVariable(e,t,n){const r=this.target,i=this.stage;if(Object.prototype.hasOwnProperty.call(r.variables,e)){const t=r.variables[String(e)];return{scope:"target",id:t.id,name:t.name,isCloud:t.isCloud}}if(!r.isStage&&i&&Object.prototype.hasOwnProperty.call(i.variables,e)){const t=i.variables[String(e)];return{scope:"stage",id:t.id,name:t.name,isCloud:t.isCloud}}for(const e in r.variables)if(Object.prototype.hasOwnProperty.call(r.variables,e)){const i=r.variables[e];if(i.name===t&&i.type===n)return{scope:"target",id:i.id,name:i.name,isCloud:i.isCloud}}if(!r.isStage&&i)for(const e in i.variables)if(Object.prototype.hasOwnProperty.call(i.variables,e)){const r=i.variables[e];if(r.name===t&&r.type===n)return{scope:"stage",id:r.id,name:r.name,isCloud:r.isCloud}}const s=new o(e,t,n,!1);if(r.variables[String(e)]=s,r.sprite)for(const i of r.sprite.clones)Object.prototype.hasOwnProperty.call(i.variables,e)||(i.variables[String(e)]=new o(e,t,n,!1));return{scope:"target",id:e,name:s.name,isCloud:s.isCloud}}descendCompatLayerInput(e){const t={},n={};for(const n of Object.keys(e.inputs))t[n]=this.descendInputOfBlock(e,n,!0);for(const t of Object.keys(e.fields))n[t]=e.fields[t].value;return new p(u.COMPATIBILITY_LAYER,h.ANY,{opcode:e.opcode,id:e.id,inputs:t,fields:n},!0)}descendCompatLayerStack(e){const t={};for(const n of Object.keys(e.inputs))n.startsWith("SUBSTACK")||(t[n]=this.descendInputOfBlock(e,n,!0));const n={};for(const t of Object.keys(e.fields))n[t]=e.fields[t].value;const r=this.getBlockInfo(e.opcode),i=r&&r.info&&r.info.blockType||s.COMMAND,o={};if(i===s.CONDITIONAL||i===s.LOOP)for(const t in e.inputs){if(!t.startsWith("SUBSTACK"))continue;const n="SUBSTACK"===t?1:+t.substring(8);isNaN(n)||(o[n]=this.descendSubstack(e,t))}return new d(l.COMPATIBILITY_LAYER,{opcode:e.opcode,id:e.id,blockType:i,inputs:t,fields:n,substacks:o},!0)}analyzeLoop(){return!this.script.isWarp||this.script.warpTimer}readTopBlockComment(e){const t=this.target.comments[e];if(!t)return;const n=t.text;for(const e of n.split("\n")){if(!/^tw\b/.test(e))continue;const t=e.split(" ");for(const e of t)switch(e){case"nocompile":throw new Error("Script explicitly disables compilation");case"stuck":this.script.warpTimer=!0}break}}walkHat(e){const t=e.next,n=e.opcode,r=this.runtime._hats[n];if(this.thread.stackClick){return this.runtime.getOpcodeFunction(n)?new f([this.descendCompatLayerStack(e),...this.walkStack(t).blocks]):this.walkStack(t)}if(r.edgeActivated)return this.script.yields=!0,this.script.executableHat=!0,new f([new d(l.HAT_EDGE,{id:e.id,condition:this.descendCompatLayerInput(e).toType(h.BOOLEAN)}),...this.walkStack(t).blocks]);return this.runtime.getOpcodeFunction(n)?(this.script.yields=!0,this.script.executableHat=!0,new f([new d(l.HAT_PREDICATE,{condition:this.descendCompatLayerInput(e).toType(h.BOOLEAN)}),...this.walkStack(t).blocks])):this.walkStack(t)}generate(e){this.blocks.populateProcedureCache(),this.script.topBlockId=e;const t=this.getBlockById(e);if(!t){if(this.script.isProcedure)return this.script;throw new Error("Cannot find top block")}t.comment&&this.readTopBlockComment(t.comment);if(!!this.runtime._hats[t.opcode])this.script.stack=this.walkHat(t);else{let n;n="procedures_definition"===t.opcode?t.next:e,n&&(this.script.stack=this.walkStack(n))}return this.script}}e.exports={ScriptTreeGenerator:v,IRGenerator:class{constructor(e){this.thread=e,this.blocks=e.blockContainer,this.proceduresToCompile=new Map,this.compilingProcedures=new Map,this.procedures={},this.analyzedProcedures=new Set}addProcedureDependencies(e){for(const t of e){if(Object.prototype.hasOwnProperty.call(this.procedures,t))continue;if(this.compilingProcedures.has(t))continue;if(this.proceduresToCompile.has(t))continue;const e=T(t),n=this.blocks.getProcedureDefinition(e);this.proceduresToCompile.set(t,n)}}generateScriptTree(e,t){const n=e.generate(t);return this.addProcedureDependencies(n.dependedProcedures),n}analyzeScript(e){let t=!1;for(const n of e.dependedProcedures){const r=this.procedures[n];this.analyzedProcedures.has(n)||(this.analyzedProcedures.add(n),this.analyzeScript(r)&&(t=!0)),r.yields&&!e.yields&&(e.yields=!0,t=!0)}return t}generate(){const e=this.generateScriptTree(new v(this.thread),this.thread.topBlock),t=this.blocks._cache.compiledProcedures;for(;this.proceduresToCompile.size>0;){this.compilingProcedures=this.proceduresToCompile,this.proceduresToCompile=new Map;for(const[e,n]of this.compilingProcedures.entries())if(t[e]){const n=t[e];this.procedures[e]=n,this.addProcedureDependencies(n.dependedProcedures)}else{const r="W"===e.charAt(0),i=new v(this.thread);i.setProcedureVariant(e),r&&i.enableWarp();const s=this.generateScriptTree(i,n);this.procedures[e]=s,t[e]=s}}for(;this.analyzeScript(e);)this.analyzedProcedures=new Set;return new g(e,this.procedures)}}}},function(e,t,n){const{InputOpcode:r,InputType:i}=n(15),{IntermediateInput:s,IntermediateStackBlock:o,IntermediateStack:a}=n(10);class c{constructor(e,t){this.source=e,t instanceof s?(this.intermediate=t,this.type=4):(this.intermediate=null,this.type=t)}asNumber(){return"(+".concat(this.source," || 0)")}asNumberOrNaN(){return"(+".concat(this.source,")")}asString(){return'("" + '.concat(this.source,")")}asBoolean(){return"toBoolean(".concat(this.source,")")}asColor(){return this.asUnknown()}asUnknown(){return this.source}asSafe(){return this.asUnknown()}isAlwaysNumber(){return!1}isAlwaysNumberOrNaN(){return!1}isNeverNumber(){return!1}}class l{constructor(e){this.prefix=e,this.count=0}next(){return"".concat(this.prefix).concat(this.count++)}}class u{constructor(e){this.real=e,this.fakeThis={script:e.script,ir:e.ir,target:e.target,get frames(){return e.frames},get currentFrame(){return e.currentFrame},get source(){return e.source},set source(t){e.source=t},localVariables:new l("oldCompilerLocal"),descendInput(t){const n=e.descendInput(t);return new c(n,t)},descendStack(t,n){e.descendStack(t,n)},yieldLoop:()=>e.yieldLoop(),yieldNotWarp:()=>e.yieldNotWarp(),yieldStuckOrNotWarp:()=>e.yieldStuckOrNotWarp(),yielded:()=>e.yielded(),requestRedraw:()=>e.requestRedraw()}}descendInput(e){throw new Error("Unknown input: ".concat(e.kind))}descendStackedBlock(e){throw new Error("Unknown stacked block: ".concat(e.kind))}descendInputFromNewCompiler(e){const t=e.inputs.oldNode;return this.descendInput.call(this.fakeThis,t).asSafe()}descendStackedBlockFromNewCompiler(e){const t=e.inputs.oldNode;this.descendStackedBlock.call(this.fakeThis,t)}}u.unstable_exports={TYPE_NUMBER:1,TYPE_STRING:2,TYPE_BOOLEAN:3,TYPE_UNKNOWN:4,TYPE_NUMBER_NAN:5,VariablePool:l,TypedInput:c,Frame:class{constructor(e){this.isLoop=e,this.isLastBlock=!1}}};const h={enabled:!1,IRGeneratorStub:class{},ScriptTreeGeneratorStub:class{constructor(e){this.real=e,this.fakeThis={thread:e.thread,target:e.target,blocks:e.blocks,runtime:e.runtime,stage:e.stage,script:e.script,descendInputOfBlock:(t,n)=>e.descendInputOfBlock(t,n,!0),descendSubstack:(t,n)=>e.descendSubstack(t,n),analyzeLoop(){e.script.yields=!0}}}descendInput(e){return null}descendStackedBlock(e){return null}descendInputFromNewCompiler(e){const t=this.descendInput.call(this.fakeThis,e);return t?new s(r.OLD_COMPILER_COMPATIBILITY_LAYER,i.ANY,{oldNode:t},!0):null}descendStackedBlockFromNewCompiler(e){const t=this.descendStackedBlock.call(this.fakeThis,e);return t?new o(r.OLD_COMPILER_COMPATIBILITY_LAYER,{oldNode:t},!0):null}},TypedInput:c,JSGeneratorStub:u};e.exports=h},function(e,t,n){const r={Timer:n(14),Cast:n(1),log:n(0),blockUtility:n(191),thread:null};let i="";const s={};i+="let stuckCounter = 0;\nconst isStuck = () => {\n    // The real time is not checked on every call for performance.\n    stuckCounter++;\n    if (stuckCounter === 100) {\n        stuckCounter = 0;\n        return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n    }\n    return false;\n};",s.startHats="const startHats = (requestedHat, optMatchFields) => {\n    const thread = globalState.thread;\n    const threads = thread.target.runtime.startHats(requestedHat, optMatchFields);\n    return threads;\n}",s.waitThreads="const waitThreads = function*(threads) {\n    const thread = globalState.thread;\n    const runtime = thread.target.runtime;\n\n    while (true) {\n        // determine whether any threads are running\n        let anyRunning = false;\n        for (let i = 0; i < threads.length; i++) {\n            if (runtime.threads.indexOf(threads[i]) !== -1) {\n                anyRunning = true;\n                break;\n            }\n        }\n        if (!anyRunning) {\n            // all threads are finished, can resume\n            return;\n        }\n\n        let allWaiting = true;\n        for (let i = 0; i < threads.length; i++) {\n            if (!runtime.isWaitingThread(threads[i])) {\n                allWaiting = false;\n                break;\n            }\n        }\n        if (allWaiting) {\n            thread.status = 3; // STATUS_YIELD_TICK\n        }\n\n        yield;\n    }\n}",s.executeInCompatibilityLayer="let hasResumedFromPromise = false;\nconst waitPromise = function*(promise) {\n    const thread = globalState.thread;\n    let returnValue;\n\n    // enter STATUS_PROMISE_WAIT and yield\n    // this will stop script execution until the promise handlers reset the thread status\n    // because promise handlers might execute immediately, configure thread.status here\n    thread.status = 1; // STATUS_PROMISE_WAIT\n\n    promise\n        .then(value => {\n            returnValue = value;\n            thread.status = 0; // STATUS_RUNNING\n        }, error => {\n            thread.status = 0; // STATUS_RUNNING\n            globalState.log.warn('Promise rejected in compiled script:', error);\n            returnValue = '' + error;\n            thread.status = 0; // STATUS_RUNNING\n        });\n\n    yield;\n\n    return returnValue;\n};\nconst isPromise = value => (\n    // see engine/execute.js\n    value !== null &&\n    typeof value === 'object' &&\n    typeof value.then === 'function'\n);\nconst executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags, blockId, branchInfo) {\n    const thread = globalState.thread;\n    const blockUtility = globalState.blockUtility;\n    const stackFrame = branchInfo ? branchInfo.stackFrame : {};\n\n    const finish = (returnValue) => {\n        if (branchInfo) {\n            if (typeof returnValue === 'undefined' && blockUtility._startedBranch) {\n                branchInfo.isLoop = blockUtility._startedBranch[1];\n                return blockUtility._startedBranch[0];\n            }\n            branchInfo.isLoop = branchInfo.defaultIsLoop;\n            return returnValue;\n        }\n        return returnValue;\n    };\n\n    const executeBlock = () => {\n        blockUtility.init(thread, blockId, stackFrame);\n        return blockFunction(inputs, blockUtility);\n    };\n\n    let returnValue = executeBlock();\n    if (isPromise(returnValue)) {\n        returnValue = finish(yield* waitPromise(returnValue));\n        if (useFlags) hasResumedFromPromise = true;\n        return returnValue;\n    }\n\n    if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n        // Something external is forcing us to stop\n        yield;\n        // Make up a return value because whatever is forcing us to stop can't specify one\n        return '';\n    }\n\n    while (thread.status === 2 /* STATUS_YIELD */ || thread.status === 3 /* STATUS_YIELD_TICK */) {\n        // Yielded threads will run next iteration.\n        if (thread.status === 2 /* STATUS_YIELD */) {\n            thread.status = 0; // STATUS_RUNNING\n            // Yield back to the event loop when stuck or not in warp mode.\n            if (!isWarp || isStuck()) {\n                yield;\n            }\n        } else {\n            // status is STATUS_YIELD_TICK, always yield to the event loop\n            yield;\n        }\n\n        returnValue = executeBlock();\n        if (isPromise(returnValue)) {\n            returnValue = finish(yield* waitPromise(returnValue));\n            if (useFlags) hasResumedFromPromise = true;\n            return returnValue;\n        }\n\n        if (thread.status === 1 /* STATUS_PROMISE_WAIT */ || thread.status === 4 /* STATUS_DONE */) {\n            yield;\n            return finish('');\n        }\n    }\n\n    // todo: do we have to do anything extra if status is STATUS_DONE?\n\n    return finish(returnValue);\n}",s.createBranchInfo="const createBranchInfo = (isLoop) => ({\n    defaultIsLoop: isLoop,\n    isLoop: false,\n    branch: 0,\n    stackFrame: {}\n});",s.retire="const retire = () => {\n    const thread = globalState.thread;\n    thread.target.runtime.sequencer.retireThread(thread);\n}",s.toNotNaN="const toNotNaN = value => Number.isNaN(value) ? 0 : value",s.toBoolean="const toBoolean = value => {\n    if (typeof value === 'boolean') {\n        return value;\n    }\n    if (typeof value === 'string') {\n        if (value === '' || value === '0' || value.toLowerCase() === 'false') {\n            return false;\n        }\n        return true;\n    }\n    return !!value;\n}",s.limitPrecision="const limitPrecision = value => {\n    const rounded = Math.round(value);\n    const delta = value - rounded;\n    return (Math.abs(delta) < 1e-9) ? rounded : value;\n}",i+="const isNotActuallyZero = val => {\n    if (typeof val !== 'string') return false;\n    for (let i = 0; i < val.length; i++) {\n        const code = val.charCodeAt(i);\n        if (code === 48 || code === 9) {\n            return false;\n        }\n    }\n    return true;\n};",i+="const compareEqualSlow = (v1, v2) => {\n    const n1 = +v1;\n    if (Number.isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    const n2 = +v2;\n    if (Number.isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !Number.isNaN(v1) && !Number.isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);",s.compareGreaterThan="const compareGreaterThanSlow = (v1, v2) => {\n    let n1 = +v1;\n    let n2 = +v2;\n    if (n1 === 0 && isNotActuallyZero(v1)) {\n        n1 = NaN;\n    } else if (n2 === 0 && isNotActuallyZero(v2)) {\n        n2 = NaN;\n    }\n    if (Number.isNaN(n1) || Number.isNaN(n2)) {\n        const s1 = ('' + v1).toLowerCase();\n        const s2 = ('' + v2).toLowerCase();\n        return s1 > s2;\n    }\n    return n1 > n2;\n};\nconst compareGreaterThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !Number.isNaN(v1) ? v1 > v2 : compareGreaterThanSlow(v1, v2)",s.compareLessThan="const compareLessThanSlow = (v1, v2) => {\n    let n1 = +v1;\n    let n2 = +v2;\n    if (n1 === 0 && isNotActuallyZero(v1)) {\n        n1 = NaN;\n    } else if (n2 === 0 && isNotActuallyZero(v2)) {\n        n2 = NaN;\n    }\n    if (Number.isNaN(n1) || Number.isNaN(n2)) {\n        const s1 = ('' + v1).toLowerCase();\n        const s2 = ('' + v2).toLowerCase();\n        return s1 < s2;\n    }\n    return n1 < n2;\n};\nconst compareLessThan = (v1, v2) => typeof v1 === 'number' && typeof v2 === 'number' && !Number.isNaN(v2) ? v1 < v2 : compareLessThanSlow(v1, v2)",s.randomInt="const randomInt = (low, high) => low + Math.floor(Math.random() * ((high + 1) - low))",s.randomFloat="const randomFloat = (low, high) => (Math.random() * (high - low)) + low",s.timer="const timer = () => {\n    const t = new globalState.Timer({\n        now: () => globalState.thread.target.runtime.currentMSecs\n    });\n    t.start();\n    return t;\n}",s.daysSince2000="const daysSince2000 = () => (Date.now() - 946684800000) / (24 * 60 * 60 * 1000)",s.distance="const distance = menu => {\n    const thread = globalState.thread;\n    if (thread.target.isStage) return 10000;\n\n    let targetX = 0;\n    let targetY = 0;\n    if (menu === '_mouse_') {\n        targetX = thread.target.runtime.ioDevices.mouse.getScratchX();\n        targetY = thread.target.runtime.ioDevices.mouse.getScratchY();\n    } else {\n        const distTarget = thread.target.runtime.getSpriteTargetByName(menu);\n        if (!distTarget) return 10000;\n        targetX = distTarget.x;\n        targetY = distTarget.y;\n    }\n\n    const dx = thread.target.x - targetX;\n    const dy = thread.target.y - targetY;\n    return Math.sqrt((dx * dx) + (dy * dy));\n}",i+="const listIndexSlow = (index, length) => {\n    if (index === 'last') {\n        return length - 1;\n    } else if (index === 'random' || index === 'any') {\n        if (length > 0) {\n            return (Math.random() * length) | 0;\n        }\n        return -1;\n    }\n    index = (+index || 0) | 0;\n    if (index < 1 || index > length) {\n        return -1;\n    }\n    return index - 1;\n};\nconst listIndex = (index, length) => {\n    if (typeof index !== 'number') {\n      return listIndexSlow(index, length);\n    }\n    index = index | 0;\n    return index < 1 || index > length ? -1 : index - 1;\n};",s.listGet="const listGet = (list, idx) => {\n    const index = listIndex(idx, list.length);\n    if (index === -1) {\n        return '';\n    }\n    return list[index];\n}",s.listReplace="const listReplace = (list, idx, value) => {\n    const index = listIndex(idx, list.value.length);\n    if (index === -1) {\n        return;\n    }\n    list.value[index] = value;\n    list._monitorUpToDate = false;\n}",s.listInsert="const listInsert = (list, idx, value) => {\n    const index = listIndex(idx, list.value.length + 1);\n    if (index === -1) {\n        return;\n    }\n    list.value.splice(index, 0, value);\n    list._monitorUpToDate = false;\n}",s.listDelete="const listDelete = (list, idx) => {\n    if (idx === 'all') {\n        list.value = [];\n        return;\n    }\n    const index = listIndex(idx, list.value.length);\n    if (index === -1) {\n        return;\n    }\n    list.value.splice(index, 1);\n    list._monitorUpToDate = false;\n}",s.listContains="const listContains = (list, item) => {\n    // TODO: evaluate whether indexOf is worthwhile here\n    if (list.value.indexOf(item) !== -1) {\n        return true;\n    }\n    for (let i = 0; i < list.value.length; i++) {\n        if (compareEqual(list.value[i], item)) {\n            return true;\n        }\n    }\n    return false;\n}",s.listIndexOf="const listIndexOf = (list, item) => {\n    for (let i = 0; i < list.value.length; i++) {\n        if (compareEqual(list.value[i], item)) {\n            return i + 1;\n        }\n    }\n    return 0;\n}",s.listContents="const listContents = list => {\n    for (let i = 0; i < list.value.length; i++) {\n        const listItem = list.value[i];\n        // this is an intentional break from what scratch 3 does to address our automatic string -> number conversions\n        // it fixes more than it breaks\n        if ((listItem + '').length !== 1) {\n            return list.value.join(' ');\n        }\n    }\n    return list.value.join('');\n}",s.colorToList="const colorToList = color => globalState.Cast.toRgbColorList(color)",s.mod="const mod = (n, modulus) => {\n    let result = n % modulus;\n    if (result / modulus < 0) result += modulus;\n    return result;\n}",s.tan="const tan = (angle) => {\n    switch (angle % 360) {\n    case -270: case 90: return Infinity;\n    case -90: case 270: return -Infinity;\n    }\n    return Math.round(Math.tan((Math.PI * angle) / 180) * 1e10) / 1e10;\n}",s.yieldThenCall="const yieldThenCall = function* (callback, ...args) {\n    yield;\n    return callback(...args);\n}",s.yieldThenCallGenerator="const yieldThenCallGenerator = function* (callback, ...args) {\n    yield;\n    return yield* callback(...args);\n}";const o=e=>{r.thread=e,e.generator.next()},a=[];o.scopedEval=e=>{const t=(e=>{let t="let stuckCounter = 0;\nconst isStuck = () => {\n    // The real time is not checked on every call for performance.\n    stuckCounter++;\n    if (stuckCounter === 100) {\n        stuckCounter = 0;\n        return globalState.thread.target.runtime.sequencer.timer.timeElapsed() > 500;\n    }\n    return false;\n};const isNotActuallyZero = val => {\n    if (typeof val !== 'string') return false;\n    for (let i = 0; i < val.length; i++) {\n        const code = val.charCodeAt(i);\n        if (code === 48 || code === 9) {\n            return false;\n        }\n    }\n    return true;\n};const compareEqualSlow = (v1, v2) => {\n    const n1 = +v1;\n    if (Number.isNaN(n1) || (n1 === 0 && isNotActuallyZero(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    const n2 = +v2;\n    if (Number.isNaN(n2) || (n2 === 0 && isNotActuallyZero(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n    return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !Number.isNaN(v1) && !Number.isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);const listIndexSlow = (index, length) => {\n    if (index === 'last') {\n        return length - 1;\n    } else if (index === 'random' || index === 'any') {\n        if (length > 0) {\n            return (Math.random() * length) | 0;\n        }\n        return -1;\n    }\n    index = (+index || 0) | 0;\n    if (index < 1 || index > length) {\n        return -1;\n    }\n    return index - 1;\n};\nconst listIndex = (index, length) => {\n    if (typeof index !== 'number') {\n      return listIndexSlow(index, length);\n    }\n    index = index | 0;\n    return index < 1 || index > length ? -1 : index - 1;\n};";for(const n of Object.keys(s))e.includes(n)&&(t+="".concat(s[n],";"));return t+="return ".concat(e),t})(e);try{return new Function("globalState",t)(r)}catch(e){throw r.log.error("was unable to compile script",t),e}},o.runtimeFunctions=s,o.saveGlobalState=()=>{a.push(r.thread)},o.restoreGlobalState=()=>{r.thread=a.pop()},e.exports=o},function(e,t,n){const r=n(4),i=n(6),s=n(1),o=n(12),a=n(235),c=n(13);class l extends a{constructor(e,t){super(t,e.blocks),this.sprite=e,this.renderer=null,this.runtime&&(this.renderer=this.runtime.renderer),this.drawableID=null,this.dragging=!1,this.effects={color:0,fisheye:0,whirl:0,pixelate:0,mosaic:0,brightness:0,ghost:0},this.isOriginal=!0,this.isStage=!1,this.x=0,this.y=0,this.direction=90,this.draggable=!1,this.visible=!0,this.size=100,this.currentCostume=0,this.rotationStyle=l.ROTATION_STYLE_ALL_AROUND,this.volume=100,this.tempo=60,this.videoTransparency=50,this.videoState=l.VIDEO_STATE.ON,this.textToSpeechLanguage=null,this.onTargetMoved=null,this.onTargetVisualChange=null,this.interpolationData=null}initDrawable(e){this.renderer&&(this.drawableID=this.renderer.createDrawable(e)),this.isOriginal||this.runtime.startHats("control_start_as_clone",null,this)}get audioPlayer(){console.warn("get audioPlayer deprecated, please update to use .sprite.soundBank methods"),console.warn(new Error("stack for debug").stack);const e=this.sprite.soundBank,t={playSound:t=>e.play(this,t)};return Object.defineProperty(this,"audioPlayer",{configurable:!1,enumerable:!0,writable:!1,value:t}),t}initAudio(){}static get ROTATION_STYLE_ALL_AROUND(){return"all around"}static get ROTATION_STYLE_LEFT_RIGHT(){return"left-right"}static get ROTATION_STYLE_NONE(){return"don't rotate"}static get VIDEO_STATE(){return{OFF:"off",ON:"on",ON_FLIPPED:"on-flipped"}}emitVisualChange(){this.onTargetVisualChange&&this.onTargetVisualChange(this)}setXY(e,t,n){if(this.isStage)return;if(this.dragging&&!n)return;const r=this.x,i=this.y;if(this.renderer){const n=this.runtime.runtimeOptions.fencing?this.renderer.getFencedPositionOfDrawable(this.drawableID,[e,t]):[e,t];this.x=n[0],this.y=n[1],this.renderer.updateDrawablePosition(this.drawableID,n),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.x=e,this.y=t;this.onTargetMoved&&this.onTargetMoved(this,r,i,n),this.runtime.requestTargetsUpdate(this)}_getRenderedDirectionAndScale(){let e=this.direction,t=[this.size,this.size];if(this.rotationStyle===l.ROTATION_STYLE_NONE)e=90;else if(this.rotationStyle===l.ROTATION_STYLE_LEFT_RIGHT){e=90;t=[(this.direction<0?-1:1)*this.size,this.size]}return{direction:e,scale:t}}setDirection(e){if(!this.isStage&&isFinite(e)){if(this.direction=r.wrapClamp(e,-179,180),this.renderer){const{direction:e,scale:t}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,e,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}}setDraggable(e){this.isStage||(this.draggable=!!e,this.runtime.requestTargetsUpdate(this))}setVisible(e){this.isStage||(this.visible=!!e,this.renderer&&(this.renderer.updateDrawableVisible(this.drawableID,this.visible),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())),this.runtime.requestTargetsUpdate(this))}setSize(e){if(!this.isStage){if(this.renderer){const t=this.renderer.getCurrentSkinSize(this.drawableID),n=t[0],i=t[1],s=this.runtime.runtimeOptions.fencing,o=s?Math.min(1,Math.max(5/n,5/i)):0,a=s?Math.min(1.5*this.runtime.stageWidth/n,1.5*this.runtime.stageHeight/i):1/0;this.size=100*r.clamp(e/100,o,a);const{direction:c,scale:l}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,c,l),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.size=e;this.runtime.requestTargetsUpdate(this)}}setEffect(e,t){Object.prototype.hasOwnProperty.call(this.effects,e)&&(this.effects[e]=t,this.renderer&&(this.renderer.updateDrawableEffect(this.drawableID,e,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())))}clearEffects(){for(const e in this.effects)Object.prototype.hasOwnProperty.call(this.effects,e)&&(this.effects[e]=0);if(this.renderer){for(const e in this.effects)Object.prototype.hasOwnProperty.call(this.effects,e)&&this.renderer.updateDrawableEffect(this.drawableID,e,0);this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}}setCostume(e){if((e=Math.round(e))!==1/0&&e!==-1/0&&e||(e=0),this.currentCostume=r.wrapClamp(e,0,this.sprite.costumes.length-1),this.renderer){const e=this.sprite.costumes[this.currentCostume];this.renderer.updateDrawableSkinId(this.drawableID,e.skinId),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}addCostume(e,t){"number"!=typeof t||isNaN(t)?this.sprite.addCostumeAt(e,this.sprite.costumes.length):this.sprite.addCostumeAt(e,t)}renameCostume(e,t){const n=this.sprite.costumes.filter(((t,n)=>e!==n)).map((e=>e.name)),r=this.getCostumes()[e].name,s=i.unusedName(t,n);if(this.getCostumes()[e].name=s,this.isStage){const e=this.runtime.targets;for(let t=0;t<e.length;t++){e[t].blocks.updateAssetName(r,s,"backdrop")}}else this.blocks.updateAssetName(r,s,"costume")}deleteCostume(e){const t=this.sprite.costumes.length;if(1===t)return null;if(e<0||e>=t)return null;const n=this.sprite.deleteCostumeAt(e);return e===this.currentCostume&&e===t-1?this.setCostume(e-1):e<this.currentCostume?this.setCostume(this.currentCostume-1):this.setCostume(this.currentCostume),this.runtime.requestTargetsUpdate(this),n}addSound(e,t){const n=this.sprite.sounds.map((e=>e.name));e.name=i.unusedName(e.name,n),"number"!=typeof t||isNaN(t)?this.sprite.sounds.push(e):this.sprite.sounds.splice(t,0,e)}renameSound(e,t){const n=this.sprite.sounds.filter(((t,n)=>e!==n)).map((e=>e.name)),r=this.sprite.sounds[e].name,s=i.unusedName(t,n);this.sprite.sounds[e].name=s,this.blocks.updateAssetName(r,s,"sound")}deleteSound(e){if(e<0||e>=this.sprite.sounds.length)return null;const t=this.sprite.sounds.splice(e,1)[0];return this.runtime.requestTargetsUpdate(this),t}setRotationStyle(e){if(e===l.ROTATION_STYLE_NONE?this.rotationStyle=l.ROTATION_STYLE_NONE:e===l.ROTATION_STYLE_ALL_AROUND?this.rotationStyle=l.ROTATION_STYLE_ALL_AROUND:e===l.ROTATION_STYLE_LEFT_RIGHT&&(this.rotationStyle=l.ROTATION_STYLE_LEFT_RIGHT),this.renderer){const{direction:e,scale:t}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,e,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}getCostumeIndexByName(e){const t=this.getCostumes();for(let n=0;n<t.length;n++)if(t[n].name===e)return n;return-1}getCurrentCostume(){return this.getCostumes()[this.currentCostume]}getCostumes(){return this.sprite.costumes}reorderCostume(e,t){if((t=r.clamp(t,0,this.sprite.costumes.length-1))===(e=r.clamp(e,0,this.sprite.costumes.length-1)))return!1;const n=this.getCurrentCostume(),i=this.sprite.costumes[e];return this.sprite.deleteCostumeAt(e),this.addCostume(i,t),this.currentCostume=this.getCostumeIndexByName(n.name),!0}reorderSound(e,t){if((t=r.clamp(t,0,this.sprite.sounds.length-1))===(e=r.clamp(e,0,this.sprite.sounds.length-1)))return!1;const n=this.sprite.sounds[e];return this.deleteSound(e),this.addSound(n,t),!0}getSounds(){return this.sprite.sounds}updateAllDrawableProperties(){if(this.renderer){const{direction:e,scale:t}=this._getRenderedDirectionAndScale();this.renderer.updateDrawablePosition(this.drawableID,[this.x,this.y]),this.renderer.updateDrawableDirectionScale(this.drawableID,e,t),this.renderer.updateDrawableVisible(this.drawableID,this.visible);const n=this.getCostumes()[this.currentCostume];this.renderer.updateDrawableSkinId(this.drawableID,n.skinId);for(const e in this.effects)Object.prototype.hasOwnProperty.call(this.effects,e)&&this.renderer.updateDrawableEffect(this.drawableID,e,this.effects[e]);this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}getName(){return this.sprite.name}isSprite(){return!this.isStage&&this.isOriginal}getBounds(){return this.renderer?this.runtime.renderer.getBounds(this.drawableID):null}getBoundsForBubble(){return this.renderer?this.runtime.renderer.getBoundsForBubble(this.drawableID):null}isTouchingObject(e){if("_mouse_"===e){if(!this.runtime.ioDevices.mouse)return!1;const e=this.runtime.ioDevices.mouse.getClientX(),t=this.runtime.ioDevices.mouse.getClientY();return this.isTouchingPoint(e,t)}return"_edge_"===e?this.isTouchingEdge():this.isTouchingSprite(e)}isTouchingPoint(e,t){return!!this.renderer&&this.renderer.drawableTouching(this.drawableID,e,t)}isTouchingEdge(){if(this.renderer){const e=this.runtime.stageWidth,t=this.runtime.stageHeight,n=this.getBounds();if(n.left<-e/2||n.right>e/2||n.top>t/2||n.bottom<-t/2)return!0}return!1}isTouchingSprite(e){e=s.toString(e);const t=this.runtime.getSpriteTargetByName(e);if(!t||!this.renderer)return!1;const n=t.sprite.clones.filter((e=>!e.dragging)).map((e=>e.drawableID));return this.renderer.isTouchingDrawables(this.drawableID,n)}isTouchingColor(e){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,e)}colorIsTouchingColor(e,t){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,e,t)}getLayerOrder(){return this.renderer?this.renderer.getDrawableOrder(this.drawableID):null}goToFront(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,1/0,c.SPRITE_LAYER),this.runtime.setExecutablePosition(this,1/0)}goToBack(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-1/0,c.SPRITE_LAYER,!1),this.runtime.setExecutablePosition(this,-1/0)}goForwardLayers(e){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,e,c.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,e)}goBackwardLayers(e){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-e,c.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,-e)}goBehindOther(e){if(this.renderer){const t=this.renderer.setDrawableOrder(e.drawableID,0,c.SPRITE_LAYER,!0);this.renderer.setDrawableOrder(this.drawableID,t,c.SPRITE_LAYER)}const t=this.runtime.executableTargets.indexOf(e);this.runtime.setExecutablePosition(this,t)}keepInFence(e,t,n){let r=n;r||(r={left:-this.runtime.stageWidth/2,right:this.runtime.stageWidth/2,top:this.runtime.stageHeight/2,bottom:-this.runtime.stageHeight/2});const i=this.getBounds();if(!i)return;i.left+=e-this.x,i.right+=e-this.x,i.top+=t-this.y,i.bottom+=t-this.y;let s=0,o=0;return i.left<r.left&&(s+=r.left-i.left),i.right>r.right&&(s+=r.right-i.right),i.top>r.top&&(o+=r.top-i.top),i.bottom<r.bottom&&(o+=r.bottom-i.bottom),[e+s,t+o]}makeClone(){if(!this.runtime.clonesAvailable()||this.isStage)return null;this.runtime.changeCloneCounter(1);const e=this.sprite.createClone();return e.x=this.x,e.y=this.y,e.direction=this.direction,e.draggable=this.draggable,e.visible=this.visible,e.size=this.size,e.currentCostume=this.currentCostume,e.rotationStyle=this.rotationStyle,e.effects=o.simple(this.effects),e.variables=this.duplicateVariables(),e._edgeActivatedHatValues=o.simple(this._edgeActivatedHatValues),e.initDrawable(c.SPRITE_LAYER),e.updateAllDrawableProperties(),e}duplicate(){return this.sprite.duplicate().then((e=>{const t=e.createClone();return t.x=400*(Math.random()-.5)/2,t.y=300*(Math.random()-.5)/2,t.direction=this.direction,t.draggable=this.draggable,t.visible=this.visible,t.size=this.size,t.currentCostume=this.currentCostume,t.rotationStyle=this.rotationStyle,t.effects=JSON.parse(JSON.stringify(this.effects)),t.variables=this.duplicateVariables(t.blocks),t.updateAllDrawableProperties(),t}))}onGreenFlag(){this.clearEffects()}onStopAll(){this.clearEffects()}postSpriteInfo(e){const t=Object.prototype.hasOwnProperty.call(e,"force")?e.force:null,n=Object.prototype.hasOwnProperty.call(e,"x"),r=Object.prototype.hasOwnProperty.call(e,"y");(n||r)&&this.setXY(n?e.x:this.x,r?e.y:this.y,t),Object.prototype.hasOwnProperty.call(e,"direction")&&this.setDirection(e.direction),Object.prototype.hasOwnProperty.call(e,"draggable")&&this.setDraggable(e.draggable),Object.prototype.hasOwnProperty.call(e,"rotationStyle")&&this.setRotationStyle(e.rotationStyle),Object.prototype.hasOwnProperty.call(e,"visible")&&this.setVisible(e.visible),Object.prototype.hasOwnProperty.call(e,"size")&&this.setSize(e.size)}startDrag(){this.dragging=!0}stopDrag(){this.dragging=!1}toJSON(){const e=this.getCostumes();return{id:this.id,name:this.getName(),isStage:this.isStage,x:this.x,y:this.y,size:this.size,direction:this.direction,draggable:this.draggable,currentCostume:this.currentCostume,costume:e[this.currentCostume],costumeCount:e.length,visible:this.visible,rotationStyle:this.rotationStyle,comments:this.comments,blocks:this.blocks._blocks,variables:this.variables,costumes:e,sounds:this.getSounds(),textToSpeechLanguage:this.textToSpeechLanguage,tempo:this.tempo,volume:this.volume,videoTransparency:this.videoTransparency,videoState:this.videoState}}dispose(){this.isOriginal||this.runtime.changeCloneCounter(-1),this.runtime.stopForTarget(this),this.runtime.removeExecutable(this),this.sprite.removeClone(this),this.renderer&&null!==this.drawableID&&(this.renderer.destroyDrawable(this.drawableID,this.isStage?c.BACKGROUND_LAYER:c.SPRITE_LAYER),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw()))}}e.exports=l},function(e,t,n){const r=n(7),i=n(31);class s{constructor(e,t,n,i,o,a,c){this.id=e||r(),this.text=t,this.x=n,this.y=i,this.width=Math.max(Number(o),s.MIN_WIDTH),this.height=Math.max(Number(a),s.MIN_HEIGHT),this.minimized=c||!1,this.blockId=null}toXML(){return'<comment id="'.concat(this.id,'" x="').concat(this.x,'" y="').concat(this.y,'" w="').concat(this.width,'" h="').concat(this.height,'" pinned="').concat(null!==this.blockId,'" minimized="').concat(this.minimized,'">').concat(i(this.text),"</comment>")}static get MIN_WIDTH(){return 20}static get MIN_HEIGHT(){return 20}static get DEFAULT_WIDTH(){return 100}static get DEFAULT_HEIGHT(){return 100}}e.exports=s},function(e,t,n){const r=n(47),i=n(17),{loadSoundFromAsset:s}=n(33),{loadCostumeFromAsset:o}=n(34),a=n(80),c=n(6),l=n(13);class u{constructor(e,t){this.runtime=t,e||(e=new i(t)),this.blocks=e,this.name="",this.costumes_=[],this.sounds=[],this.clones=[],this.soundBank=null,this.runtime&&this.runtime.audioEngine&&(this.soundBank=this.runtime.audioEngine.createBank())}set costumes(e){this.costumes_=[];for(const t of e)this.addCostumeAt(t,this.costumes_.length)}get costumes(){return this.costumes_}addCostumeAt(e,t){e.name||(e.name="");const n=this.costumes_.map((e=>e.name));e.name=c.unusedName(e.name,n),this.costumes_.splice(t,0,e)}deleteCostumeAt(e){return this.costumes.splice(e,1)[0]}createClone(e){const t=new r(this,this.runtime);if(t.isOriginal=0===this.clones.length,this.clones.push(t),t.initAudio(),t.isOriginal){const n="string"==typeof e?e:l.SPRITE_LAYER;t.initDrawable(n),this.runtime.fireTargetWasCreated(t)}else this.runtime.fireTargetWasCreated(t,this.clones[0]);return t}removeClone(e){this.runtime.fireTargetWasRemoved(e);const t=this.clones.indexOf(e);t>=0&&this.clones.splice(t,1)}duplicate(){const e=new u(null,this.runtime),t=this.blocks._blocks,n=Object.keys(t).map((e=>t[e])),r=JSON.parse(JSON.stringify(n));a(r),r.forEach((t=>{e.blocks.createBlock(t)}));const i=this.runtime.targets.map((e=>e.sprite.name));e.name=c.unusedName(this.name,i);const l=[];return e.costumes=this.costumes_.map((e=>{const t=Object.assign({},e);return l.push(o(t,this.runtime)),t})),e.sounds=this.sounds.map((t=>{const n=Object.assign({},t),r=t.asset;return l.push(s(n,r,this.runtime,e.soundBank)),n})),Promise.all(l).then((()=>e))}dispose(){this.soundBank&&this.soundBank.dispose()}}e.exports=u},function(e,t,n){e.exports=function(){"use strict";function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function t(e){if(Array.isArray(e))return e}function n(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,s,o,a=[],c=!0,l=!1;try{if(s=(n=n.call(e)).next,0===t);else for(;!(c=(r=s.call(n)).done)&&(a.push(r.value),a.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&null!=n.return&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return a}}function r(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e,i){return t(e)||n(e,i)||s(e,i)||r()}function s(t,n){if(t){if("string"==typeof t)return e(t,n);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?e(t,n):void 0}}const o=Object.entries,a=Object.setPrototypeOf,c=Object.isFrozen,l=Object.getPrototypeOf,u=Object.getOwnPropertyDescriptor;let h=Object.freeze,d=Object.seal,p=Object.create,f="undefined"!=typeof Reflect&&Reflect,m=f.apply,g=f.construct;h||(h=function(e){return e}),d||(d=function(e){return e}),m||(m=function(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return e.apply(t,r)}),g||(g=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];return new e(...n)});const b=U(Array.prototype.forEach),y=U(Array.prototype.lastIndexOf),E=U(Array.prototype.pop),T=U(Array.prototype.push),v=U(Array.prototype.splice),A=Array.isArray,w=U(String.prototype.toLowerCase),S=U(String.prototype.toString),k=U(String.prototype.match),O=U(String.prototype.replace),I=U(String.prototype.indexOf),N=U(String.prototype.trim),R=U(Number.prototype.toString),x=U(Boolean.prototype.toString),M="undefined"==typeof BigInt?null:U(BigInt.prototype.toString),C="undefined"==typeof Symbol?null:U(Symbol.prototype.toString),P=U(Object.prototype.hasOwnProperty),D=U(Object.prototype.toString),L=U(RegExp.prototype.test),B=F(TypeError);function U(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return m(e,t,r)}}function F(e){return function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return g(e,n)}}function j(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:w;if(a&&a(e,null),!A(t))return e;let r=t.length;for(;r--;){let i=t[r];if("string"==typeof i){const e=n(i);e!==i&&(c(t)||(t[r]=e),i=e)}e[i]=!0}return e}function z(e){for(let t=0;t<e.length;t++)P(e,t)||(e[t]=null);return e}function G(e){const t=p(null);for(const r of o(e)){var n=i(r,2);const s=n[0],o=n[1];P(e,s)&&(A(o)?t[s]=z(o):o&&"object"==typeof o&&o.constructor===Object?t[s]=G(o):t[s]=o)}return t}function V(e){switch(typeof e){case"string":return e;case"number":return R(e);case"boolean":return x(e);case"bigint":return M?M(e):"0";case"symbol":return C?C(e):"Symbol()";case"undefined":default:return D(e);case"function":case"object":{if(null===e)return D(e);const t=e,n=_(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:D(e)}return D(e)}}}function _(e,t){for(;null!==e;){const n=u(e,t);if(n){if(n.get)return U(n.get);if("function"==typeof n.value)return U(n.value)}e=l(e)}function n(){return null}return n}function Y(e){try{return L(e,""),!0}catch(e){return!1}}const H=h(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),W=h(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),K=h(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),X=h(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),Z=h(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),q=h(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Q=h(["#text"]),J=h(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),$=h(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ee=h(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),te=h(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),ne=d(/{{[\w\W]*|^[\w\W]*}}/g),re=d(/<%[\w\W]*|^[\w\W]*%>/g),ie=d(/\${[\w\W]*/g),se=d(/^data-[\-\w.\u00B7-\uFFFF]+$/),oe=d(/^aria-[\-\w]+$/),ae=d(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ce=d(/^(?:\w+script|data):/i),le=d(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ue=d(/^html$/i),he=d(/^[a-z][.\w]*(-[.\w]+)+$/i),de={element:1,text:3,progressingInstruction:7,comment:8,document:9},pe=function(){return"undefined"==typeof window?null:window},fe=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const r="data-tt-policy-suffix";t&&t.hasAttribute(r)&&(n=t.getAttribute(r));const i="dompurify"+(n?"#"+n:"");try{return e.createPolicy(i,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+i+" could not be created."),null}},me=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ge(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:pe();const t=e=>ge(e);if(t.version="3.4.5",t.removed=[],!e||!e.document||e.document.nodeType!==de.document||!e.Element)return t.isSupported=!1,t;let n=e.document;const r=n,i=r.currentScript,s=e.DocumentFragment,a=e.HTMLTemplateElement,c=e.Node,l=e.Element,u=e.NodeFilter,d=e.NamedNodeMap,f=void 0===d?e.NamedNodeMap||e.MozNamedAttrMap:d,m=e.HTMLFormElement,g=e.DOMParser,R=e.trustedTypes,x=l.prototype,M=_(x,"cloneNode"),C=_(x,"remove"),D=_(x,"nextSibling"),U=_(x,"childNodes"),F=_(x,"parentNode"),z=c&&c.prototype?_(c.prototype,"nodeType"):null;if("function"==typeof a){const e=n.createElement("template");e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let be,ye="";const Ee=n,Te=Ee.implementation,ve=Ee.createNodeIterator,Ae=Ee.createDocumentFragment,we=Ee.getElementsByTagName,Se=r.importNode;let ke=me();t.isSupported="function"==typeof o&&"function"==typeof F&&Te&&void 0!==Te.createHTMLDocument;const Oe=ne,Ie=re,Ne=ie,Re=se,xe=oe,Me=ce,Ce=le,Pe=he;let De=ae,Le=null;const Be=j({},[...H,...W,...K,...Z,...Q]);let Ue=null;const Fe=j({},[...J,...$,...ee,...te]);let je=Object.seal(p(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ze=null,Ge=null;const Ve=Object.seal(p(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let _e=!0,Ye=!0,He=!1,We=!0,Ke=!1,Xe=!0,Ze=!1,qe=!1,Qe=!1,Je=!1,$e=!1,et=!1,tt=!0,nt=!1;const rt="user-content-";let it=!0,st=!1,ot={},at=null;const ct=j({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let lt=null;const ut=j({},["audio","video","img","source","image","track"]);let ht=null;const dt=j({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),pt="http://www.w3.org/1998/Math/MathML",ft="http://www.w3.org/2000/svg",mt="http://www.w3.org/1999/xhtml";let gt=mt,bt=!1,yt=null;const Et=j({},[pt,ft,mt],S);let Tt=j({},["mi","mo","mn","ms","mtext"]),vt=j({},["annotation-xml"]);const At=j({},["title","style","font","a","script"]);let wt=null;const St=["application/xhtml+xml","text/html"],kt="text/html";let Ot=null,It=null;const Nt=n.createElement("form"),Rt=function(e){return e instanceof RegExp||e instanceof Function},xt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(It&&It===e)return;e&&"object"==typeof e||(e={}),e=G(e),wt=-1===St.indexOf(e.PARSER_MEDIA_TYPE)?kt:e.PARSER_MEDIA_TYPE,Ot="application/xhtml+xml"===wt?S:w,Le=P(e,"ALLOWED_TAGS")&&A(e.ALLOWED_TAGS)?j({},e.ALLOWED_TAGS,Ot):Be,Ue=P(e,"ALLOWED_ATTR")&&A(e.ALLOWED_ATTR)?j({},e.ALLOWED_ATTR,Ot):Fe,yt=P(e,"ALLOWED_NAMESPACES")&&A(e.ALLOWED_NAMESPACES)?j({},e.ALLOWED_NAMESPACES,S):Et,ht=P(e,"ADD_URI_SAFE_ATTR")&&A(e.ADD_URI_SAFE_ATTR)?j(G(dt),e.ADD_URI_SAFE_ATTR,Ot):dt,lt=P(e,"ADD_DATA_URI_TAGS")&&A(e.ADD_DATA_URI_TAGS)?j(G(ut),e.ADD_DATA_URI_TAGS,Ot):ut,at=P(e,"FORBID_CONTENTS")&&A(e.FORBID_CONTENTS)?j({},e.FORBID_CONTENTS,Ot):ct,ze=P(e,"FORBID_TAGS")&&A(e.FORBID_TAGS)?j({},e.FORBID_TAGS,Ot):G({}),Ge=P(e,"FORBID_ATTR")&&A(e.FORBID_ATTR)?j({},e.FORBID_ATTR,Ot):G({}),ot=!!P(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?G(e.USE_PROFILES):e.USE_PROFILES),_e=!1!==e.ALLOW_ARIA_ATTR,Ye=!1!==e.ALLOW_DATA_ATTR,He=e.ALLOW_UNKNOWN_PROTOCOLS||!1,We=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,Ke=e.SAFE_FOR_TEMPLATES||!1,Xe=!1!==e.SAFE_FOR_XML,Ze=e.WHOLE_DOCUMENT||!1,Je=e.RETURN_DOM||!1,$e=e.RETURN_DOM_FRAGMENT||!1,et=e.RETURN_TRUSTED_TYPE||!1,Qe=e.FORCE_BODY||!1,tt=!1!==e.SANITIZE_DOM,nt=e.SANITIZE_NAMED_PROPS||!1,it=!1!==e.KEEP_CONTENT,st=e.IN_PLACE||!1,De=Y(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:ae,gt="string"==typeof e.NAMESPACE?e.NAMESPACE:mt,Tt=P(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?G(e.MATHML_TEXT_INTEGRATION_POINTS):j({},["mi","mo","mn","ms","mtext"]),vt=P(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?G(e.HTML_INTEGRATION_POINTS):j({},["annotation-xml"]);const t=P(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?G(e.CUSTOM_ELEMENT_HANDLING):p(null);if(je=p(null),P(t,"tagNameCheck")&&Rt(t.tagNameCheck)&&(je.tagNameCheck=t.tagNameCheck),P(t,"attributeNameCheck")&&Rt(t.attributeNameCheck)&&(je.attributeNameCheck=t.attributeNameCheck),P(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(je.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),Ke&&(Ye=!1),$e&&(Je=!0),ot&&(Le=j({},Q),Ue=p(null),!0===ot.html&&(j(Le,H),j(Ue,J)),!0===ot.svg&&(j(Le,W),j(Ue,$),j(Ue,te)),!0===ot.svgFilters&&(j(Le,K),j(Ue,$),j(Ue,te)),!0===ot.mathMl&&(j(Le,Z),j(Ue,ee),j(Ue,te))),Ve.tagCheck=null,Ve.attributeCheck=null,P(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?Ve.tagCheck=e.ADD_TAGS:A(e.ADD_TAGS)&&(Le===Be&&(Le=G(Le)),j(Le,e.ADD_TAGS,Ot))),P(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?Ve.attributeCheck=e.ADD_ATTR:A(e.ADD_ATTR)&&(Ue===Fe&&(Ue=G(Ue)),j(Ue,e.ADD_ATTR,Ot))),P(e,"ADD_URI_SAFE_ATTR")&&A(e.ADD_URI_SAFE_ATTR)&&j(ht,e.ADD_URI_SAFE_ATTR,Ot),P(e,"FORBID_CONTENTS")&&A(e.FORBID_CONTENTS)&&(at===ct&&(at=G(at)),j(at,e.FORBID_CONTENTS,Ot)),P(e,"ADD_FORBID_CONTENTS")&&A(e.ADD_FORBID_CONTENTS)&&(at===ct&&(at=G(at)),j(at,e.ADD_FORBID_CONTENTS,Ot)),it&&(Le["#text"]=!0),Ze&&j(Le,["html","head","body"]),Le.table&&(j(Le,["tbody"]),delete ze.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw B('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');be=e.TRUSTED_TYPES_POLICY,ye=be.createHTML("")}else void 0===be&&(be=fe(R,i)),null!==be&&"string"==typeof ye&&(ye=be.createHTML(""));h&&h(e),It=e},Mt=j({},[...W,...K,...X]),Ct=j({},[...Z,...q]),Pt=function(e){let t=F(e);t&&t.tagName||(t={namespaceURI:gt,tagName:"template"});const n=w(e.tagName),r=w(t.tagName);return!!yt[e.namespaceURI]&&(e.namespaceURI===ft?t.namespaceURI===mt?"svg"===n:t.namespaceURI===pt?"svg"===n&&("annotation-xml"===r||Tt[r]):Boolean(Mt[n]):e.namespaceURI===pt?t.namespaceURI===mt?"math"===n:t.namespaceURI===ft?"math"===n&&vt[r]:Boolean(Ct[n]):e.namespaceURI===mt?!(t.namespaceURI===ft&&!vt[r])&&!(t.namespaceURI===pt&&!Tt[r])&&!Ct[n]&&(At[n]||!Mt[n]):!("application/xhtml+xml"!==wt||!yt[e.namespaceURI]))},Dt=function(e){T(t.removed,{element:e});try{F(e).removeChild(e)}catch(t){C(e)}},Lt=function(e,n){try{T(t.removed,{attribute:n.getAttributeNode(e),from:n})}catch(e){T(t.removed,{attribute:null,from:n})}if(n.removeAttribute(e),"is"===e)if(Je||$e)try{Dt(n)}catch(e){}else try{n.setAttribute(e,"")}catch(e){}},Bt=function(e){let t=null,r=null;if(Qe)e="<remove></remove>"+e;else{const t=k(e,/^[\r\n\t ]+/);r=t&&t[0]}"application/xhtml+xml"===wt&&gt===mt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const i=be?be.createHTML(e):e;if(gt===mt)try{t=(new g).parseFromString(i,wt)}catch(e){}if(!t||!t.documentElement){t=Te.createDocument(gt,"template",null);try{t.documentElement.innerHTML=bt?ye:i}catch(e){}}const s=t.body||t.documentElement;return e&&r&&s.insertBefore(n.createTextNode(r),s.childNodes[0]||null),gt===mt?we.call(t,Ze?"html":"body")[0]:Ze?t.documentElement:s},Ut=function(e){return ve.call(e.ownerDocument||e,e,u.SHOW_ELEMENT|u.SHOW_COMMENT|u.SHOW_TEXT|u.SHOW_PROCESSING_INSTRUCTION|u.SHOW_CDATA_SECTION,null)},Ft=function(e){e.normalize();const t=ve.call(e.ownerDocument||e,e,u.SHOW_TEXT|u.SHOW_COMMENT|u.SHOW_CDATA_SECTION|u.SHOW_PROCESSING_INSTRUCTION,null);let n=t.nextNode();for(;n;){let e=n.data;b([Oe,Ie,Ne],(t=>{e=O(e,t," ")})),n.data=e,n=t.nextNode()}},jt=function(e){return e instanceof m&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||!(e.attributes instanceof f)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes)},zt=function(e){if(!z||"object"!=typeof e||null===e)return!1;try{return"number"==typeof z(e)}catch(e){return!1}};function Gt(e,n,r){b(e,(e=>{e.call(t,n,r,It)}))}const Vt=function(e){let n=null;if(Gt(ke.beforeSanitizeElements,e,null),jt(e))return Dt(e),!0;const r=Ot(e.nodeName);if(Gt(ke.uponSanitizeElement,e,{tagName:r,allowedTags:Le}),Xe&&e.hasChildNodes()&&!zt(e.firstElementChild)&&L(/<[/\w!]/g,e.innerHTML)&&L(/<[/\w!]/g,e.textContent))return Dt(e),!0;if(Xe&&e.namespaceURI===mt&&"style"===r&&zt(e.firstElementChild))return Dt(e),!0;if(e.nodeType===de.progressingInstruction)return Dt(e),!0;if(Xe&&e.nodeType===de.comment&&L(/<[/\w]/g,e.data))return Dt(e),!0;if(ze[r]||!(Ve.tagCheck instanceof Function&&Ve.tagCheck(r))&&!Le[r]){if(!ze[r]&&Ht(r)){if(je.tagNameCheck instanceof RegExp&&L(je.tagNameCheck,r))return!1;if(je.tagNameCheck instanceof Function&&je.tagNameCheck(r))return!1}if(it&&!at[r]){const t=F(e)||e.parentNode,n=U(e)||e.childNodes;if(n&&t)for(let r=n.length-1;r>=0;--r){const i=M(n[r],!0);t.insertBefore(i,D(e))}}return Dt(e),!0}return e instanceof l&&!Pt(e)?(Dt(e),!0):"noscript"!==r&&"noembed"!==r&&"noframes"!==r||!L(/<\/no(script|embed|frames)/i,e.innerHTML)?(Ke&&e.nodeType===de.text&&(n=e.textContent,b([Oe,Ie,Ne],(e=>{n=O(n,e," ")})),e.textContent!==n&&(T(t.removed,{element:e.cloneNode()}),e.textContent=n)),Gt(ke.afterSanitizeElements,e,null),!1):(Dt(e),!0)},_t=function(e,t,r){if(Ge[t])return!1;if(tt&&("id"===t||"name"===t)&&(r in n||r in Nt))return!1;const i=Ue[t]||Ve.attributeCheck instanceof Function&&Ve.attributeCheck(t,e);if(Ye&&!Ge[t]&&L(Re,t));else if(_e&&L(xe,t));else if(!i||Ge[t]){if(!(Ht(e)&&(je.tagNameCheck instanceof RegExp&&L(je.tagNameCheck,e)||je.tagNameCheck instanceof Function&&je.tagNameCheck(e))&&(je.attributeNameCheck instanceof RegExp&&L(je.attributeNameCheck,t)||je.attributeNameCheck instanceof Function&&je.attributeNameCheck(t,e))||"is"===t&&je.allowCustomizedBuiltInElements&&(je.tagNameCheck instanceof RegExp&&L(je.tagNameCheck,r)||je.tagNameCheck instanceof Function&&je.tagNameCheck(r))))return!1}else if(ht[t]);else if(L(De,O(r,Ce,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==I(r,"data:")||!lt[e])if(He&&!L(Me,O(r,Ce,"")));else if(r)return!1;return!0},Yt=j({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Ht=function(e){return!Yt[w(e)]&&L(Pe,e)},Wt=function(e){Gt(ke.beforeSanitizeAttributes,e,null);const n=e.attributes;if(!n||jt(e))return;const r={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Ue,forceKeepAttr:void 0};let i=n.length;for(;i--;){const s=n[i],o=s.name,a=s.namespaceURI,c=s.value,l=Ot(o),u=c;let h="value"===o?u:N(u);if(r.attrName=l,r.attrValue=h,r.keepAttr=!0,r.forceKeepAttr=void 0,Gt(ke.uponSanitizeAttribute,e,r),h=r.attrValue,!nt||"id"!==l&&"name"!==l||0===I(h,rt)||(Lt(o,e),h=rt+h),Xe&&L(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,h)){Lt(o,e);continue}if("attributename"===l&&k(h,"href")){Lt(o,e);continue}if(r.forceKeepAttr)continue;if(!r.keepAttr){Lt(o,e);continue}if(!We&&L(/\/>/i,h)){Lt(o,e);continue}Ke&&b([Oe,Ie,Ne],(e=>{h=O(h,e," ")}));const d=Ot(e.nodeName);if(_t(d,l,h)){if(be&&"object"==typeof R&&"function"==typeof R.getAttributeType)if(a);else switch(R.getAttributeType(d,l)){case"TrustedHTML":h=be.createHTML(h);break;case"TrustedScriptURL":h=be.createScriptURL(h)}if(h!==u)try{a?e.setAttributeNS(a,o,h):e.setAttribute(o,h),jt(e)?Dt(e):E(t.removed)}catch(t){Lt(o,e)}}else Lt(o,e)}Gt(ke.afterSanitizeAttributes,e,null)},Kt=function(e){let t=null;const n=Ut(e);for(Gt(ke.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)Gt(ke.uponSanitizeShadowNode,t,null),Vt(t),Wt(t),t.content instanceof s&&Kt(t.content);Gt(ke.afterSanitizeShadowDOM,e,null)},Xt=function(e){if(e.nodeType===de.element&&e.shadowRoot instanceof s){const t=e.shadowRoot;Xt(t),Kt(t)}const t=e.childNodes;if(!t)return;const n=[];b(t,(e=>{T(n,e)}));for(const e of n)Xt(e)};return t.sanitize=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=null,o=null,a=null,c=null;if(bt=!e,bt&&(e="\x3c!--\x3e"),"string"!=typeof e&&!zt(e)&&"string"!=typeof(e=V(e)))throw B("dirty is not a string, aborting");if(!t.isSupported)return e;if(qe||xt(n),t.removed=[],"string"==typeof e&&(st=!1),st){const t=e.nodeName;if("string"==typeof t){const e=Ot(t);if(!Le[e]||ze[e])throw B("root node is forbidden and cannot be sanitized in-place")}Xt(e)}else if(zt(e))i=Bt("\x3c!----\x3e"),o=i.ownerDocument.importNode(e,!0),o.nodeType===de.element&&"BODY"===o.nodeName||"HTML"===o.nodeName?i=o:i.appendChild(o),Xt(o);else{if(!Je&&!Ke&&!Ze&&-1===e.indexOf("<"))return be&&et?be.createHTML(e):e;if(i=Bt(e),!i)return Je?null:et?ye:""}i&&Qe&&Dt(i.firstChild);const l=Ut(st?e:i);for(;a=l.nextNode();)Vt(a),Wt(a),a.content instanceof s&&Kt(a.content);if(st)return Ke&&Ft(e),e;if(Je){if(Ke&&Ft(i),$e)for(c=Ae.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return(Ue.shadowroot||Ue.shadowrootmode)&&(c=Se.call(r,c,!0)),c}let u=Ze?i.outerHTML:i.innerHTML;return Ze&&Le["!doctype"]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&L(ue,i.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+i.ownerDocument.doctype.name+">\n"+u),Ke&&b([Oe,Ie,Ne],(e=>{u=O(u,e," ")})),be&&et?be.createHTML(u):u},t.setConfig=function(){xt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),qe=!0},t.clearConfig=function(){It=null,qe=!1},t.isValidAttribute=function(e,t,n){It||xt({});const r=Ot(e),i=Ot(t);return _t(r,i,n)},t.addHook=function(e,t){"function"==typeof t&&T(ke[e],t)},t.removeHook=function(e,t){if(void 0!==t){const n=y(ke[e],t);return-1===n?void 0:v(ke[e],n,1)[0]}return E(ke[e])},t.removeHooks=function(e){ke[e]=[]},t.removeAllHooks=function(){ke=me()},t}return ge()}()},function(e,t){class n{static get svg(){return"http://www.w3.org/2000/svg"}static get xmlns(){return"http://www.w3.org/2000/xmlns"}static get xlink(){return"http://www.w3.org/1999/xlink"}static attributeNamespace(){return{href:n.xlink,xlink:n.xmlns,xmlns:`${n.xmlns}/`,"xmlns:xlink":`${n.xmlns}/`}}static create(e,t,r){return n.set(document.createElementNS(n.svg,e),t,r)}static get(e,t){const r=n.attributeNamespace[t],i=r?e.getAttributeNS(r,t):e.getAttribute(t);return"null"===i?null:i}static set(e,t,r){for(const i in t){let s=t[i];const o=n.attributeNamespace[i];"number"==typeof s&&r&&(s=r.number(s)),o?e.setAttributeNS(o,i,s):e.setAttribute(i,s)}return e}}e.exports=n},function(e,t){e.exports=class{constructor(e,t,n){this.audioEngine=e,this.audioPlayer=t,this.lastEffect=n,this.value=this.DEFAULT_VALUE,this.initialized=!1,this.inputNode=null,this.outputNode=null,this.target=null}get name(){throw new Error("".concat(this.constructor.name,".name is not implemented"))}get DEFAULT_VALUE(){return 0}get _isPatch(){return this.initialized&&(this.value!==this.DEFAULT_VALUE||null===this.audioPlayer)}getInputNode(){return this._isPatch?this.inputNode:this.target.getInputNode()}initialize(){throw new Error("".concat(this.constructor.name,".initialize is not implemented."))}_set(){throw new Error("".concat(this.constructor.name,"._set is not implemented."))}set(e){this.initialized||this.initialize();const t=this._isPatch;t&&(this._lastPatch=this.audioEngine.currentTime),e!==this.value&&this._set(e),this._isPatch!==t&&null!==this.target&&this.connect(this.target)}update(){}clear(){this.set(this.DEFAULT_VALUE)}connect(e){if(null===e)throw new Error("target may not be null");const t=e=>{if(e)return e===this||t(e.target)};if(t(e))throw new Error("Effect cannot connect to itself");this.target=e,null!==this.outputNode&&this.outputNode.disconnect(),(this._isPatch||this._lastPatch+this.audioEngine.DECAY_DURATION<this.audioEngine.currentTime)&&this.outputNode.connect(e.getInputNode()),null===this.lastEffect?null!==this.audioPlayer&&this.audioPlayer.connect(this):this.lastEffect.connect(this)}dispose(){this.inputNode=null,this.outputNode=null,this.target=null,this.initialized=!1}}},function(e,t,n){"use strict";var r=n(94),i=n.n(r),s=n(95),o=n.n(s),a=n(96),c=i()((function(e){return e[1]})),l=o()(a.a);c.push([e.i,'.sc-root {\n  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n  width: 100%;\n  height: 100%;\n  display: flex;\n  align-items: center;\n  justify-content: center;\n  position: relative;\n  --sc-accent-color: #ff4c4c;\n  --sc-accent-color-transparent: #ff4c4c59;\n}\n.sc-layers {\n  position: relative;\n}\n.sc-layers > * {\n  position: absolute;\n}\n.sc-scaled-overlays-outer {\n  overflow: hidden;\n  width: 100%;\n  height: 100%;\n  pointer-events: none;\n}\n.sc-scaled-overlays-inner {\n  transform-origin: top left;\n}\n.sc-root * {\n  box-sizing: border-box;\n}\n.sc-canvas {\n  width: 100%;\n  height: 100%;\n}\n\n.sc-question-root {\n  bottom: 0;\n  width: 100%;\n  color: black;\n  pointer-events: all;\n}\n.sc-question-inner {\n  margin: 0.5rem;\n  border: 1px solid hsla(0, 0%, 0%, 0.15);\n  border-radius: 0.5rem;\n  border-width: 2px;\n  padding: 1rem;\n  background: white;\n}\n.sc-question-text {\n  font-size: 12px;\n  padding-bottom: 8px;\n  font-weight: bold;\n}\n.sc-question-input-outer {\n  position: relative;\n}\n.sc-question-input {\n  width: 100%;\n  height: 2rem;\n  padding: 0 12px;\n  font-size: 10px;\n  border-width: 1px;\n  border-style: solid;\n  border-color: hsla(0, 0%, 0%, 0.15);\n  border-radius: 2rem;\n  outline: none;\n  transition: 0.25s ease-out;\n  box-shadow: none;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  color: inherit;\n}\n.sc-question-input:focus {\n  border-color: var(--sc-accent-color);\n  box-shadow: 0px 0px 0px 3px var(--sc-accent-color-transparent);\n}\n.sc-question-input:hover {\n  border-color: var(--sc-accent-color);\n}\n.sc-question-submit-button {\n  top: 4px;\n  right: 4px;\n  width: 24px;\n  height: 24px;\n  position: absolute;\n  outline: none;\n  border: none;\n  padding: 2px;\n  margin: 0;\n  border-radius: 100%;\n  background: none;\n  cursor: pointer;\n  color: white;\n  background-color: var(--sc-accent-color);\n  background-image: url('+l+');\n  overflow: hidden;\n}\n.sc-question-submit-button:focus {\n  outline: 2px solid black;\n}\n.sc-question-submit-button-image {\n  width: 100%;\n  height: 100%;\n}\n\n.sc-monitor-overlay {\n\n}\n.sc-monitor-root {\n  position: absolute;\n  top: 0;\n  left: 0;\n  background: hsla(215, 100%, 95%, 1);\n  color: #575e75;\n  border: 1px solid hsla(0, 0%, 0%, 0.15);\n  border-radius: 4px;\n  font-size: 12px;\n  overflow: hidden;\n  user-select: none;\n  -webkit-user-select: none;\n  display: flex;\n  flex-direction: column;\n  pointer-events: all;\n}\n.sc-monitor-inner {\n  display: flex;\n  flex-direction: column;\n  padding: 3px;\n}\n.sc-monitor-row {\n  display: flex;\n  flex-direction: row;\n}\n.sc-monitor-label {\n  font-weight: bold;\n  text-align: center;\n  margin: 0 5px;\n  white-space: nowrap;\n}\n.sc-monitor-slider {\n  margin: 0;\n  width: 100%;\n}\n.sc-monitor-value {\n  min-width: 40px;\n  display: flex;\n  justify-content: center;\n  align-items: center;\n  text-align: center;\n  color: white;\n  margin: 0 5px;\n  border-radius: 4px;\n  padding: 0 2px;\n  white-space: pre-wrap;\n  background-color: #0fbd8c;\n}\n.sc-monitor-root[data-opcode^="motion_"] .sc-monitor-value-color {\n  background-color: #4c97ff;\n}\n.sc-monitor-root[data-opcode^="sensing_"] .sc-monitor-value-color {\n  background-color: #5cb1d6;\n}\n.sc-monitor-root[data-opcode^="data_"] .sc-monitor-value-color {\n  background-color: #ff8c1a;\n}\n.sc-monitor-root[data-opcode^="looks_"] .sc-monitor-value-color {\n  background-color: #9966ff;\n}\n.sc-monitor-root[data-opcode^="sound_"] .sc-monitor-value-color {\n  background-color: #cf63cf;\n}\n.sc-monitor-large-value {\n  min-height: 1.4rem;\n  min-width: 3rem;\n  padding: 0.1rem 0.25rem;\n  text-align: center;\n  color: white;\n  font-size: 1rem;\n  white-space: pre-wrap;\n}\n\n.sc-monitor-list-label {\n  background-color: white;\n  text-align: center;\n  font-weight: bold;\n  border-bottom: 1px solid hsla(0, 0%, 0%, 0.15);\n  padding: 3px;\n}\n.sc-monitor-list-footer {\n  display: flex;\n  background-color: white;\n  text-align: center;\n  font-weight: bold;\n  padding: 3px;\n}\n.sc-monitor-list-footer-text {\n  text-align: center;\n  flex-grow: 1;\n}\n.sc-monitor-row-delete, .sc-monitor-list-add {\n  font-weight: bold;\n  background: none;\n  border: none;\n  outline: none;\n  font-family: inherit;\n  color: inherit;\n  cursor: pointer;\n  margin: 0;\n  padding: 0;\n}\n.sc-monitor-rows-outer {\n  flex-grow: 1;\n}\n.sc-monitor-rows-inner {\n  height: 100%;\n  overflow-y: auto;\n  overflow-x: hidden;\n  position: relative;\n}\n.sc-monitor-rows-endpoint {\n  position: absolute;\n  top: 0;\n  left: 0;\n  width: 1px;\n  height: 1px;\n  pointer-events: none;\n}\n\n.sc-monitor-row-root {\n  position: absolute;\n  top: 0;\n  left: 0;\n  display: flex;\n  justify-content: space-around;\n  align-items: center;\n  padding: 2px;\n  width: 100%;\n}\n.sc-monitor-row-index {\n  font-weight: bold;\n  color: hsla(225, 15%, 40%, 1);\n  margin: 0 3px;\n}\n.sc-monitor-row-value-outer {\n  display: flex;\n  align-items: center;\n  min-width: 40px;\n  height: 22px;\n  border: 1px solid hsla(0, 0%, 0%, 0.15);\n  background-color: #fc662c;\n  color: white;\n  margin: 0 3px;\n  border-radius: calc(0.5rem / 2);\n  flex-grow: 1;\n}\n.sc-monitor-row-value-editing .sc-monitor-row-value-outer {\n  background-color: #e25c28;\n}\n.sc-monitor-row-value-inner {\n  padding: 3px 5px;\n  width: 100%;\n  color: inherit;\n  background: none;\n  border: none;\n  font: inherit;\n  outline: none;\n  overflow: hidden;\n  text-overflow: ellipsis;\n  user-select: text;\n  -webkit-user-select: text;\n  white-space: pre;\n}\n.sc-monitor-row-value-editing .sc-monitor-row-value-inner {\n  padding-right: 0;\n}\n.sc-monitor-row-delete {\n  display: none;\n  font-size: 150%;\n  padding: 0 2px;\n}\n.sc-monitor-row-value-editing .sc-monitor-row-delete {\n  display: block;\n}\n.sc-monitor-empty {\n  text-align: center;\n  padding: 5px;\n}\n\n.sc-controls-bar {\n  transform: translateY(-100%);\n  display: flex;\n  width: 100%;\n  justify-content: space-between;\n  flex-wrap: nowrap;\n}\n.sc-controls-bar > * {\n  display: flex;\n  align-items: center;\n  flex-wrap: nowrap;\n}\n\n.sc-context-menu {\n  position: absolute;\n  color: black;\n  box-shadow: 0px 0px 5px 1px hsla(0, 0%, 0%, 0.25);\n  min-width: 130px;\n  opacity: 0;\n  transition: .2s opacity;\n}\n.sc-context-menu-item {\n  display: block;\n  width: 100%;\n  background-color: white;\n  border: none;\n  border-radius: 0;\n  cursor: pointer;\n  text-align: left;\n  font-family: inherit;\n  font-size: 0.85em;\n  padding: 8px 12px;\n  margin: 0;\n  transition: .1s background-color, .1s color;\n}\n.sc-context-menu-item:focus {\n  outline: 2px solid black;\n}\n.sc-context-menu-item:hover,\n.sc-context-menu-item:active {\n  color: white;\n  background-color: var(--sc-accent-color);\n}\n.sc-context-menu-item:first-child {\n  border-radius: 4px 4px 0 0;\n}\n.sc-context-menu-item:last-child {\n  border-radius: 0 0 4px 4px;\n}\n\n.sc-dropping {\n  background-color: var(--sc-accent-color-transparent);\n}\n',""]),c.locals={root:"sc-root",layers:"sc-layers","scaled-overlays-outer":"sc-scaled-overlays-outer",scaledOverlaysOuter:"sc-scaled-overlays-outer","scaled-overlays-inner":"sc-scaled-overlays-inner",scaledOverlaysInner:"sc-scaled-overlays-inner",canvas:"sc-canvas","question-root":"sc-question-root",questionRoot:"sc-question-root","question-inner":"sc-question-inner",questionInner:"sc-question-inner","question-text":"sc-question-text",questionText:"sc-question-text","question-input-outer":"sc-question-input-outer",questionInputOuter:"sc-question-input-outer","question-input":"sc-question-input",questionInput:"sc-question-input","question-submit-button":"sc-question-submit-button",questionSubmitButton:"sc-question-submit-button","question-submit-button-image":"sc-question-submit-button-image",questionSubmitButtonImage:"sc-question-submit-button-image","monitor-overlay":"sc-monitor-overlay",monitorOverlay:"sc-monitor-overlay","monitor-root":"sc-monitor-root",monitorRoot:"sc-monitor-root","monitor-inner":"sc-monitor-inner",monitorInner:"sc-monitor-inner","monitor-row":"sc-monitor-row",monitorRow:"sc-monitor-row","monitor-label":"sc-monitor-label",monitorLabel:"sc-monitor-label","monitor-slider":"sc-monitor-slider",monitorSlider:"sc-monitor-slider","monitor-value":"sc-monitor-value",monitorValue:"sc-monitor-value","monitor-value-color":"sc-monitor-value-color",monitorValueColor:"sc-monitor-value-color","monitor-large-value":"sc-monitor-large-value",monitorLargeValue:"sc-monitor-large-value","monitor-list-label":"sc-monitor-list-label",monitorListLabel:"sc-monitor-list-label","monitor-list-footer":"sc-monitor-list-footer",monitorListFooter:"sc-monitor-list-footer","monitor-list-footer-text":"sc-monitor-list-footer-text",monitorListFooterText:"sc-monitor-list-footer-text","monitor-row-delete":"sc-monitor-row-delete",monitorRowDelete:"sc-monitor-row-delete","monitor-list-add":"sc-monitor-list-add",monitorListAdd:"sc-monitor-list-add","monitor-rows-outer":"sc-monitor-rows-outer",monitorRowsOuter:"sc-monitor-rows-outer","monitor-rows-inner":"sc-monitor-rows-inner",monitorRowsInner:"sc-monitor-rows-inner","monitor-rows-endpoint":"sc-monitor-rows-endpoint",monitorRowsEndpoint:"sc-monitor-rows-endpoint","monitor-row-root":"sc-monitor-row-root",monitorRowRoot:"sc-monitor-row-root","monitor-row-index":"sc-monitor-row-index",monitorRowIndex:"sc-monitor-row-index","monitor-row-value-outer":"sc-monitor-row-value-outer",monitorRowValueOuter:"sc-monitor-row-value-outer","monitor-row-value-editing":"sc-monitor-row-value-editing",monitorRowValueEditing:"sc-monitor-row-value-editing","monitor-row-value-inner":"sc-monitor-row-value-inner",monitorRowValueInner:"sc-monitor-row-value-inner","monitor-empty":"sc-monitor-empty",monitorEmpty:"sc-monitor-empty","controls-bar":"sc-controls-bar",controlsBar:"sc-controls-bar","context-menu":"sc-context-menu",contextMenu:"sc-context-menu","context-menu-item":"sc-context-menu-item",contextMenuItem:"sc-context-menu-item",dropping:"sc-dropping"},t.a=c},function(e,t,n){const r=n(103);e.exports=r},function(e,t,n){const r=n(105),i=n(0);e.exports=new class extends r{constructor(){super(),this.services={},this.workerClass="undefined"==typeof Worker?null:Worker,this.workers=[]}callSync(e,t){const{provider:n,isRemote:r}=this._getServiceProvider(e);if(n){if(r)throw new Error("Cannot use 'callSync' on remote provider for service ".concat(e,"."));for(var i=arguments.length,s=new Array(i>2?i-2:0),o=2;o<i;o++)s[o-2]=arguments[o];return n[t].apply(n,s)}throw new Error("Provider not found for service: ".concat(e))}setServiceSync(e,t){Object.prototype.hasOwnProperty.call(this.services,e)&&i.warn("Central dispatch replacing existing service provider for ".concat(e)),this.services[e]=t}setService(e,t){try{return this.setServiceSync(e,t),Promise.resolve()}catch(e){return Promise.reject(e)}}addWorker(e){-1===this.workers.indexOf(e)?(this.workers.push(e),e.onmessage=this._onMessage.bind(this,e),this._remoteCall(e,"dispatch","handshake").catch((e=>{i.error("Could not handshake with worker: ".concat(e))}))):i.warn("Central dispatch ignoring attempt to add duplicate worker")}_getServiceProvider(e){const t=this.services[e];return t&&{provider:t,isRemote:Boolean(this.workerClass&&t instanceof this.workerClass||t.isRemote)}}_onDispatchMessage(e,t){let n;if("setService"===t.method)n=this.setService(t.args[0],e);else i.error("Central dispatch received message for unknown method: ".concat(t.method));return n}}},function(e,t,n){const r=n(5);e.exports=function(e,t,n){return e&&e.id&&e.default?r(e,t,n):e}},function(e,t){var n="long",r="short",i="narrow",s="numeric",o="2-digit";e.exports={number:{decimal:{style:"decimal"},integer:{style:"decimal",maximumFractionDigits:0},currency:{style:"currency",currency:"USD"},percent:{style:"percent"},default:{style:"decimal"}},date:{short:{month:s,day:s,year:o},medium:{month:r,day:s,year:s},long:{month:n,day:s,year:s},full:{month:n,day:s,year:s,weekday:n},default:{month:r,day:s,year:s}},time:{short:{hour:s,minute:s},medium:{hour:s,minute:s,second:s},long:{hour:s,minute:s,second:s,timeZoneName:r},full:{hour:s,minute:s,second:s,timeZoneName:r},default:{hour:s,minute:s,second:s}},duration:{default:{hours:{minimumIntegerDigits:1,maximumFractionDigits:0},minutes:{minimumIntegerDigits:2,maximumFractionDigits:0},seconds:{minimumIntegerDigits:2,maximumFractionDigits:3}}},parseNumberPattern:function(e){if(e){var t={},n=e.match(/\b[A-Z]{3}\b/i),r=e.replace(/[^¤]/g,"").length;if(!r&&n&&(r=1),r?(t.style="currency",t.currencyDisplay=1===r?"symbol":2===r?"code":"name",t.currency=n?n[0].toUpperCase():"USD"):e.indexOf("%")>=0&&(t.style="percent"),!/[@#0]/.test(e))return t.style?t:void 0;if(t.useGrouping=e.indexOf(",")>=0,/E\+?[@#0]+/i.test(e)||e.indexOf("@")>=0){var i=e.replace(/E\+?[@#0]+|[^@#0]/gi,"");t.minimumSignificantDigits=Math.min(Math.max(i.replace(/[^@0]/g,"").length,1),21),t.maximumSignificantDigits=Math.min(Math.max(i.length,1),21)}else{for(var s=e.replace(/[^#0.]/g,"").split("."),o=s[0],a=o.length-1;"0"===o[a];)--a;t.minimumIntegerDigits=Math.min(Math.max(o.length-1-a,1),21);var c=s[1]||"";for(a=0;"0"===c[a];)++a;for(t.minimumFractionDigits=Math.min(Math.max(a,0),20);"#"===c[a];)++a;t.maximumFractionDigits=Math.min(Math.max(a,0),20)}return t}},parseDatePattern:function(e){if(e){for(var t={},a=0;a<e.length;){for(var c=e[a],l=1;e[++a]===c;)++l;switch(c){case"G":t.era=5===l?i:4===l?n:r;break;case"y":case"Y":t.year=2===l?o:s;break;case"M":case"L":l=Math.min(Math.max(l-1,0),4),t.month=[s,o,r,n,i][l];break;case"E":case"e":case"c":t.weekday=5===l?i:4===l?n:r;break;case"d":case"D":t.day=2===l?o:s;break;case"h":case"K":t.hour12=!0,t.hour=2===l?o:s;break;case"H":case"k":t.hour12=!1,t.hour=2===l?o:s;break;case"m":t.minute=2===l?o:s;break;case"s":case"S":t.second=2===l?o:s;break;case"z":case"Z":case"v":case"V":t.timeZoneName=1===l?r:n}}return Object.keys(t).length?t:void 0}}}},function(e,t){e.exports=function(e,t){if("string"==typeof e&&t[e])return e;for(var n=[].concat(e||[]),r=0,i=n.length;r<i;++r)for(var s=n[r].split("-");s.length;){var o=s.join("-");if(t[o])return o;s.pop()}}},function(e,t,n){"use strict";var r="zero",i="one",s="two",o="few",a="many",c="other",l=[function(e){return 1===+e?i:c},function(e){var t=+e;return 0<=t&&t<=1?i:c},function(e){return 0===Math.floor(Math.abs(+e))||1===+e?i:c},function(e){var t=+e;return 0===t?r:1===t?i:2===t?s:3<=t%100&&t%100<=10?o:11<=t%100&&t%100<=99?a:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length;return 1===t&&0===n?i:c},function(e){var t=+e;return t%10==1&&t%100!=11?i:2<=t%10&&t%10<=4&&(t%100<12||14<t%100)?o:t%10==0||5<=t%10&&t%10<=9||11<=t%100&&t%100<=14?a:c},function(e){var t=+e;return t%10==1&&t%100!=11&&t%100!=71&&t%100!=91?i:t%10==2&&t%100!=12&&t%100!=72&&t%100!=92?s:(3<=t%10&&t%10<=4||t%10==9)&&(t%100<10||19<t%100)&&(t%100<70||79<t%100)&&(t%100<90||99<t%100)?o:0!==t&&t%1e6==0?a:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length,r=+(e+".").split(".")[1];return 0===n&&t%10==1&&t%100!=11||r%10==1&&r%100!=11?i:0===n&&2<=t%10&&t%10<=4&&(t%100<12||14<t%100)||2<=r%10&&r%10<=4&&(r%100<12||14<r%100)?o:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length;return 1===t&&0===n?i:2<=t&&t<=4&&0===n?o:0!==n?a:c},function(e){var t=+e;return 0===t?r:1===t?i:2===t?s:3===t?o:6===t?a:c},function(e){var t=Math.floor(Math.abs(+e)),n=+(""+e).replace(/^[^.]*.?|0+$/g,"");return 1===+e||0!==n&&(0===t||1===t)?i:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length,r=+(e+".").split(".")[1];return 0===n&&t%100==1||r%100==1?i:0===n&&t%100==2||r%100==2?s:0===n&&3<=t%100&&t%100<=4||3<=r%100&&r%100<=4?o:c},function(e){var t=Math.floor(Math.abs(+e));return 0===t||1===t?i:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length,r=+(e+".").split(".")[1];return 0===n&&(1===t||2===t||3===t)||0===n&&t%10!=4&&t%10!=6&&t%10!=9||0!==n&&r%10!=4&&r%10!=6&&r%10!=9?i:c},function(e){var t=+e;return 1===t?i:2===t?s:3<=t&&t<=6?o:7<=t&&t<=10?a:c},function(e){var t=+e;return 1===t||11===t?i:2===t||12===t?s:3<=t&&t<=10||13<=t&&t<=19?o:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length;return 0===n&&t%10==1?i:0===n&&t%10==2?s:0!==n||t%100!=0&&t%100!=20&&t%100!=40&&t%100!=60&&t%100!=80?0!==n?a:c:o},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length,r=+e;return 1===t&&0===n?i:2===t&&0===n?s:0===n&&(r<0||10<r)&&r%10==0?a:c},function(e){var t=Math.floor(Math.abs(+e)),n=+(""+e).replace(/^[^.]*.?|0+$/g,"");return 0===n&&t%10==1&&t%100!=11||0!==n?i:c},function(e){var t=+e;return 1===t?i:2===t?s:c},function(e){var t=+e;return 0===t?r:1===t?i:c},function(e){var t=Math.floor(Math.abs(+e)),n=+e;return 0===n?r:0!==t&&1!==t||0===n?c:i},function(e){var t=+(e+".").split(".")[1],n=+e;return n%10==1&&(n%100<11||19<n%100)?i:2<=n%10&&n%10<=9&&(n%100<11||19<n%100)?o:0!==t?a:c},function(e){var t=(e+".").split(".")[1].length,n=+(e+".").split(".")[1],s=+e;return s%10==0||11<=s%100&&s%100<=19||2===t&&11<=n%100&&n%100<=19?r:s%10==1&&s%100!=11||2===t&&n%10==1&&n%100!=11||2!==t&&n%10==1?i:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length,r=+(e+".").split(".")[1];return 0===n&&t%10==1&&t%100!=11||r%10==1&&r%100!=11?i:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length,r=+e;return 1===t&&0===n?i:0!==n||0===r||1!==r&&1<=r%100&&r%100<=19?o:c},function(e){var t=+e;return 1===t?i:0===t||2<=t%100&&t%100<=10?o:11<=t%100&&t%100<=19?a:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length;return 1===t&&0===n?i:0===n&&2<=t%10&&t%10<=4&&(t%100<12||14<t%100)?o:0===n&&1!==t&&0<=t%10&&t%10<=1||0===n&&5<=t%10&&t%10<=9||0===n&&12<=t%100&&t%100<=14?a:c},function(e){var t=Math.floor(Math.abs(+e));return 0<=t&&t<=1?i:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length;return 0===n&&t%10==1&&t%100!=11?i:0===n&&2<=t%10&&t%10<=4&&(t%100<12||14<t%100)?o:0===n&&t%10==0||0===n&&5<=t%10&&t%10<=9||0===n&&11<=t%100&&t%100<=14?a:c},function(e){var t=+e;return 0===Math.floor(Math.abs(+e))||1===t?i:2<=t&&t<=10?o:c},function(e){var t=Math.floor(Math.abs(+e)),n=+(e+".").split(".")[1],r=+e;return 0===r||1===r||0===t&&1===n?i:c},function(e){var t=Math.floor(Math.abs(+e)),n=(e+".").split(".")[1].length;return 0===n&&t%100==1?i:0===n&&t%100==2?s:0===n&&3<=t%100&&t%100<=4||0!==n?o:c},function(e){var t=+e;return 0<=t&&t<=1||11<=t&&t<=99?i:c},function(e){var t=+e;return 1===t||5===t||7===t||8===t||9===t||10===t?i:2===t||3===t?s:4===t?o:6===t?a:c},function(e){var t=Math.floor(Math.abs(+e));return t%10==1||t%10==2||t%10==5||t%10==7||t%10==8||t%100==20||t%100==50||t%100==70||t%100==80?i:t%10==3||t%10==4||t%1e3==100||t%1e3==200||t%1e3==300||t%1e3==400||t%1e3==500||t%1e3==600||t%1e3==700||t%1e3==800||t%1e3==900?o:0===t||t%10==6||t%100==40||t%100==60||t%100==90?a:c},function(e){var t=+e;return t%10!=2&&t%10!=3||t%100==12||t%100==13?c:o},function(e){var t=+e;return 1===t||3===t?i:2===t?s:4===t?o:c},function(e){var t=+e;return 0===t||7===t||8===t||9===t?r:1===t?i:2===t?s:3===t||4===t?o:5===t||6===t?a:c},function(e){var t=+e;return t%10==1&&t%100!=11?i:t%10==2&&t%100!=12?s:t%10==3&&t%100!=13?o:c},function(e){var t=+e;return 1===t||11===t?i:2===t||12===t?s:3===t||13===t?o:c},function(e){var t=+e;return 1===t?i:2===t||3===t?s:4===t?o:6===t?a:c},function(e){var t=+e;return 1===t||5===t?i:c},function(e){var t=+e;return 11===t||8===t||80===t||800===t?a:c},function(e){var t=Math.floor(Math.abs(+e));return 1===t?i:0===t||2<=t%100&&t%100<=20||t%100==40||t%100==60||t%100==80?a:c},function(e){var t=+e;return t%10==6||t%10==9||t%10==0&&0!==t?a:c},function(e){var t=Math.floor(Math.abs(+e));return t%10==1&&t%100!=11?i:t%10==2&&t%100!=12?s:t%10!=7&&t%10!=8||t%100==17||t%100==18?c:a},function(e){var t=+e;return 1===t?i:2===t||3===t?s:4===t?o:c},function(e){var t=+e;return 1<=t&&t<=4?i:c},function(e){var t=+e;return 1===t||5===t||7<=t&&t<=9?i:2===t||3===t?s:4===t?o:6===t?a:c},function(e){var t=+e;return 1===t?i:t%10==4&&t%100!=14?a:c},function(e){var t=+e;return t%10!=1&&t%10!=2||t%100==11||t%100==12?c:i},function(e){var t=+e;return t%10==6||t%10==9||10===t?o:c},function(e){var t=+e;return t%10==3&&t%100!=13?o:c}];e.exports={af:{cardinal:l[0]},ak:{cardinal:l[1]},am:{cardinal:l[2]},ar:{cardinal:l[3]},ars:{cardinal:l[3]},as:{cardinal:l[2],ordinal:l[34]},asa:{cardinal:l[0]},ast:{cardinal:l[4]},az:{cardinal:l[0],ordinal:l[35]},be:{cardinal:l[5],ordinal:l[36]},bem:{cardinal:l[0]},bez:{cardinal:l[0]},bg:{cardinal:l[0]},bh:{cardinal:l[1]},bn:{cardinal:l[2],ordinal:l[34]},br:{cardinal:l[6]},brx:{cardinal:l[0]},bs:{cardinal:l[7]},ca:{cardinal:l[4],ordinal:l[37]},ce:{cardinal:l[0]},cgg:{cardinal:l[0]},chr:{cardinal:l[0]},ckb:{cardinal:l[0]},cs:{cardinal:l[8]},cy:{cardinal:l[9],ordinal:l[38]},da:{cardinal:l[10]},de:{cardinal:l[4]},dsb:{cardinal:l[11]},dv:{cardinal:l[0]},ee:{cardinal:l[0]},el:{cardinal:l[0]},en:{cardinal:l[4],ordinal:l[39]},eo:{cardinal:l[0]},es:{cardinal:l[0]},et:{cardinal:l[4]},eu:{cardinal:l[0]},fa:{cardinal:l[2]},ff:{cardinal:l[12]},fi:{cardinal:l[4]},fil:{cardinal:l[13],ordinal:l[0]},fo:{cardinal:l[0]},fr:{cardinal:l[12],ordinal:l[0]},fur:{cardinal:l[0]},fy:{cardinal:l[4]},ga:{cardinal:l[14],ordinal:l[0]},gd:{cardinal:l[15],ordinal:l[40]},gl:{cardinal:l[4]},gsw:{cardinal:l[0]},gu:{cardinal:l[2],ordinal:l[41]},guw:{cardinal:l[1]},gv:{cardinal:l[16]},ha:{cardinal:l[0]},haw:{cardinal:l[0]},he:{cardinal:l[17]},hi:{cardinal:l[2],ordinal:l[41]},hr:{cardinal:l[7]},hsb:{cardinal:l[11]},hu:{cardinal:l[0],ordinal:l[42]},hy:{cardinal:l[12],ordinal:l[0]},ia:{cardinal:l[4]},io:{cardinal:l[4]},is:{cardinal:l[18]},it:{cardinal:l[4],ordinal:l[43]},iu:{cardinal:l[19]},iw:{cardinal:l[17]},jgo:{cardinal:l[0]},ji:{cardinal:l[4]},jmc:{cardinal:l[0]},ka:{cardinal:l[0],ordinal:l[44]},kab:{cardinal:l[12]},kaj:{cardinal:l[0]},kcg:{cardinal:l[0]},kk:{cardinal:l[0],ordinal:l[45]},kkj:{cardinal:l[0]},kl:{cardinal:l[0]},kn:{cardinal:l[2]},ks:{cardinal:l[0]},ksb:{cardinal:l[0]},ksh:{cardinal:l[20]},ku:{cardinal:l[0]},kw:{cardinal:l[19]},ky:{cardinal:l[0]},lag:{cardinal:l[21]},lb:{cardinal:l[0]},lg:{cardinal:l[0]},ln:{cardinal:l[1]},lt:{cardinal:l[22]},lv:{cardinal:l[23]},mas:{cardinal:l[0]},mg:{cardinal:l[1]},mgo:{cardinal:l[0]},mk:{cardinal:l[24],ordinal:l[46]},ml:{cardinal:l[0]},mn:{cardinal:l[0]},mo:{cardinal:l[25],ordinal:l[0]},mr:{cardinal:l[2],ordinal:l[47]},mt:{cardinal:l[26]},nah:{cardinal:l[0]},naq:{cardinal:l[19]},nb:{cardinal:l[0]},nd:{cardinal:l[0]},ne:{cardinal:l[0],ordinal:l[48]},nl:{cardinal:l[4]},nn:{cardinal:l[0]},nnh:{cardinal:l[0]},no:{cardinal:l[0]},nr:{cardinal:l[0]},nso:{cardinal:l[1]},ny:{cardinal:l[0]},nyn:{cardinal:l[0]},om:{cardinal:l[0]},or:{cardinal:l[0],ordinal:l[49]},os:{cardinal:l[0]},pa:{cardinal:l[1]},pap:{cardinal:l[0]},pl:{cardinal:l[27]},prg:{cardinal:l[23]},ps:{cardinal:l[0]},pt:{cardinal:l[28]},"pt-PT":{cardinal:l[4]},rm:{cardinal:l[0]},ro:{cardinal:l[25],ordinal:l[0]},rof:{cardinal:l[0]},ru:{cardinal:l[29]},rwk:{cardinal:l[0]},saq:{cardinal:l[0]},sc:{cardinal:l[4],ordinal:l[43]},scn:{cardinal:l[4],ordinal:l[43]},sd:{cardinal:l[0]},sdh:{cardinal:l[0]},se:{cardinal:l[19]},seh:{cardinal:l[0]},sh:{cardinal:l[7]},shi:{cardinal:l[30]},si:{cardinal:l[31]},sk:{cardinal:l[8]},sl:{cardinal:l[32]},sma:{cardinal:l[19]},smi:{cardinal:l[19]},smj:{cardinal:l[19]},smn:{cardinal:l[19]},sms:{cardinal:l[19]},sn:{cardinal:l[0]},so:{cardinal:l[0]},sq:{cardinal:l[0],ordinal:l[50]},sr:{cardinal:l[7]},ss:{cardinal:l[0]},ssy:{cardinal:l[0]},st:{cardinal:l[0]},sv:{cardinal:l[4],ordinal:l[51]},sw:{cardinal:l[4]},syr:{cardinal:l[0]},ta:{cardinal:l[0]},te:{cardinal:l[0]},teo:{cardinal:l[0]},ti:{cardinal:l[1]},tig:{cardinal:l[0]},tk:{cardinal:l[0],ordinal:l[52]},tl:{cardinal:l[13],ordinal:l[0]},tn:{cardinal:l[0]},tr:{cardinal:l[0]},ts:{cardinal:l[0]},tzm:{cardinal:l[33]},ug:{cardinal:l[0]},uk:{cardinal:l[29],ordinal:l[53]},ur:{cardinal:l[4]},uz:{cardinal:l[0]},ve:{cardinal:l[0]},vo:{cardinal:l[0]},vun:{cardinal:l[0]},wa:{cardinal:l[1]},wae:{cardinal:l[0]},xh:{cardinal:l[0]},xog:{cardinal:l[0]},yi:{cardinal:l[4]},zu:{cardinal:l[2]},lo:{ordinal:l[0]},ms:{ordinal:l[0]},vi:{ordinal:l[0]}}},function(e,t){e.exports=class{constructor(){this._requestID=0,this._openRequests={}}sendRemoteRequest(e,t){const n=this._requestID++,r=new Promise(((e,t)=>{this._openRequests[n]={resolve:e,reject:t}}));return this._sendRequest(e,t,n),r}sendRemoteNotification(e,t){this._sendRequest(e,t)}didReceiveCall(){throw new Error("Must override didReceiveCall")}_sendMessage(){throw new Error("Must override _sendMessage")}_sendRequest(e,t,n){const r={jsonrpc:"2.0",method:e,params:t};null!==n&&(r.id=n),this._sendMessage(r)}_handleMessage(e){if("2.0"!==e.jsonrpc)throw new Error("Bad or missing JSON-RPC version in message: ".concat(e));Object.prototype.hasOwnProperty.call(e,"method")?this._handleRequest(e):this._handleResponse(e)}_sendResponse(e,t,n){const r={jsonrpc:"2.0",id:e};n?r.error=n:r.result=t||null,this._sendMessage(r)}_handleResponse(e){const{result:t,error:n,id:r}=e,i=this._openRequests[r];delete this._openRequests[r],i&&(n?i.reject(n):i.resolve(t))}_handleRequest(e){const{method:t,params:n,id:r}=e,i=this.didReceiveCall(t,n);null!=r&&Promise.resolve(i).then((e=>{this._sendResponse(r,e)}),(e=>{this._sendResponse(r,null,e)}))}}},function(e){e.exports=JSON.parse('{"menuMap":{"am":[{"code":"am","name":"አማርኛ"}],"ar":[{"code":"ar","name":"العربية"}],"el":[{"code":"el","name":"Ελληνικά"}],"id":[{"code":"id","name":"Indonesia"}],"fa":[{"code":"fa","name":"فارسی"}],"pt":[{"code":"pt","name":"Português"}],"pt-br":[{"code":"pt","name":"Português"}],"nl":[{"code":"nl","name":"Nederlands"}],"es":[{"code":"es","name":"español"}],"es-419":[{"code":"es","name":"español"}],"gd":[{"code":"gd","name":"Gàidhlig"}],"pl":[{"code":"pl","name":"polski"}],"is":[{"code":"is","name":"íslenska"}],"hr":[{"code":"hr","name":"hrvatski"}],"fr":[{"code":"fr","name":"Français"}],"nb":[{"code":"nb","name":"norsk"}],"gl":[{"code":"gl","name":"galego"}],"bg":[{"code":"bg","name":"български"}],"lv":[{"code":"lv","name":"latviešu"}],"ca":[{"code":"ca","name":"català"}],"zu":[{"code":"zu","name":"IsiZulu"}],"vi":[{"code":"vi","name":"Việt"}],"hu":[{"code":"hu","name":"magyar"}],"et":[{"code":"et","name":"eesti"}],"lt":[{"code":"lt","name":"lietuvių"}],"uk":[{"code":"uk","name":"українська"}],"az":[{"code":"az","name":"Azərbaycan"}],"zh-tw":[{"code":"zh-tw","name":"中文 (繁體)"}],"mi":[{"code":"mi","name":"Māori"}],"th":[{"code":"th","name":"ไทย"}],"eu":[{"code":"eu","name":"euskara"}],"it":[{"code":"it","name":"Italiano"}],"fi":[{"code":"fi","name":"suomi"}],"en":[{"code":"en","name":"English"}],"tr":[{"code":"tr","name":"Türkçe"}],"ro":[{"code":"ro","name":"Română"}],"zh-cn":[{"code":"zh-cn","name":"中文（简体）"},{"code":"zh-cn","name":"中文（简体）"}],"ko":[{"code":"ko","name":"한국어"}],"de":[{"code":"de","name":"Deutsch"}],"cs":[{"code":"cs","name":"čeština"}],"he":[{"code":"he","name":"עברית"},{"code":"he","name":"עברית"}],"cy":[{"code":"cy","name":"Cymraeg"}],"sv":[{"code":"sv","name":"svenska"}],"ga":[{"code":"ga","name":"Gaeilge"}],"ja":[{"code":"ja","name":"日本語"}],"ja-hira":[{"code":"ja","name":"日本語"}],"sk":[{"code":"sk","name":"slovenčina"}],"da":[{"code":"da","name":"Dansk"}],"sl":[{"code":"sl","name":"slovenščina"}],"sr":[{"code":"sr","name":"српски"}],"ru":[{"code":"ru","name":"русский"}]},"nameMap":{"abkhaz":"ab","albanian":"sq","amharic":"am","arabic":"ar","armenian":"hy","azerbaijani":"az","basque":"eu","belarusian":"be","bulgarian":"bg","catalan":"ca","chinese (simplified)":"zh-cn","chinese (traditional)":"zh-tw","croatian":"hr","czech":"cs","danish":"da","dutch":"nl","english":"en","esperanto":"eo","estonian":"et","finnish":"fi","french":"fr","galician":"gl","german":"de","greek":"el","haitian creole":"ht","hebrew":"he","hindi":"hi","hungarian":"hu","icelandic":"is","indonesian":"id","irish gaelic":"ga","italian":"it","japanese":"ja","kannada":"kn","korean":"ko","kurdish (kurmanji)":"ku","kurdish (sorani)":"ckb","latin":"la","latvian":"lv","lithuanian":"lt","macedonian":"mk","malay":"ms","malayalam":"ml","maltese":"mt","maori":"mi","marathi":"mr","mongolian":"mn","myanmar (burmese)":"my","norwegian":"nb","persian":"fa","polish":"pl","portuguese":"pt","romanian":"ro","russian":"ru","scots gaelic":"gd","serbian":"sr","slovak":"sk","slovenian":"sl","spanish":"es","swedish":"sv","telugu":"te","thai":"th","turkish":"tr","ukrainian":"uk","uzbek":"uz","vietnamese":"vi","welsh":"cy","zulu":"zu","ሀንጋሪኛ":"hu","ህንድኛ":"hi","ሊትዌንኛ":"lt","ላቲንኛ":"la","ላትቪያኛ":"lv","ማላያላምኛ":"ml","ማላይኛ":"ms","ማልቲስኛ":"mt","ማራቲኛ":"mr","ማዮሪኛ":"mi","ሜቄዶኒያኛ":"mk","ሞንጎሊያኛ":"mn","ራሽያኛ":"ru","ሮማኒያንኛ":"ro","ሰርቢያኛ":"sr","ስሎቫክኛ":"sk","ስሎቬንያኛ":"sl","ስዊድንኛ":"sv","ስፓኒሽኛ":"es","በርማኛ":"my","ቡልጋሪያኛ":"bg","ባስክኛ":"eu","ቤላሩስኛ":"be","ቪትናምኛ":"vi","ቱርክኛ":"tr","ታይኛ":"th","ቴሉጉኛ":"te","ቻይንኛ (ቀላሉ)":"zh-cn","ቻይንኛ (ባሕላዊው)":"zh-tw","ቼክኛ":"cs","ኖርዌጅያንኛ":"nb","አልባንያኛ":"sq","አማርኛ":"am","አርመኒያኛ":"hy","አብካዝኛ":"ab","አዜርባይጃንኛ":"az","አይሪሽ":"ga","አይስላንድኛ":"is","ኡዝቤክኛ":"uz","ኤስቶኒያኛ":"et","ኤስፐራንቶኛ":"eo","እንዶኔዢያኛ":"id","እንግሊዝኛ":"en","ኩርድሽኛ (ሶራኒ)":"ckb","ኩርድሽኛ (ኩርማንጂ)":"ku","ካታላንኛ":"ca","ካናዳኛ":"kn","ክሮኤሽያኛ":"hr","ኮሪያኛ":"ko","ዌልሽ":"cy","ዐረብኛ":"ar","ዕብራይስጥ":"he","ዙሉኛ":"zu","የሃይቲ ክረኦሌኛ":"ht","የስኮት ጌልክኛ":"gd","ዩክሬንኛ":"uk","ደችኛ":"nl","ዴንሽኛ":"da","ጀርመንኛ":"de","ጃፓንኛ":"ja","ጋሊሺያኛ":"gl","ግሪክኛ":"el","ጣሊያንኛ":"it","ፈረንሳይኛ":"fr","ፊኒሽኛ":"fi","ፐርሺያኛ":"fa","ፖሊሽኛ":"pl","ፖርቱጋሊኛ":"pt","الآيسلندية":"is","الأبخازية":"ab","الأذرية":"az","الأرمنية":"hy","الإسبانية":"es","الإسبرانتو":"eo","الإستونية":"et","الألبانية":"sq","الألمانية":"de","الأمهرية":"am","الإنجليزية":"en","الإندونيسية":"id","الأوزبكية":"uz","الأوكرانية":"uk","الأيرلندية":"ga","الإيطالية":"it","الباسكية":"eu","البرتغالية":"pt","البلغارية":"bg","البورمية":"my","البولندية":"pl","البيلاروسية":"be","التايلاندية":"th","التركية":"tr","التشيكية":"cs","التيلوغوية":"te","الجاليكية":"gl","الدانمركية":"da","الروسية":"ru","الرومانية":"ro","الزولو":"zu","السلوفاكية":"sk","السلوفينية":"sl","السويدية":"sv","الصربية":"sr","الصينية (التقليدية)":"zh-tw","الصينية (المبسطة)":"zh-cn","العبرية":"he","العربية":"ar","الغيلية الأسكتلندية":"gd","الفارسية":"fa","الفرنسية":"fr","الفنلندية":"fi","الفيتنامية":"vi","القطلونية":"ca","الكردية (السورانية)":"ckb","الكردية (الكرمانجية)":"ku","الكرواتية":"hr","الكريولية الهايتية":"ht","الكنادية":"kn","الكورية":"ko","اللاتفية":"lv","اللاتينية":"la","الليتوانية":"lt","الماراثية":"mr","المالايالامية":"ml","المالطيّة":"mt","الماورية":"mi","المقدونية":"mk","الملايو":"ms","المنغولية":"mn","النرويجية":"nb","الهندية":"hi","الهنغارية":"hu","الهولندية":"nl","الويلزية":"cy","اليابانية":"ja","اليونانية":"el","αγγλικά":"en","αζερμπαϊτζανικά":"az","αλβανικά":"sq","αμπχαζικά":"ab","αμχαρικά":"am","αραβικά":"ar","αρμενικά":"hy","βασκικά":"eu","βιετναμεζικά":"vi","βιρμανικά":"my","βουλγαρικά":"bg","γαελικά σκοτίας":"gd","γαλικιακά":"gl","γαλλικά":"fr","γερμανικά":"de","δανικά":"da","εβραϊκά":"he","ελληνικά":"el","εσθονικά":"et","εσπεράντο":"eo","ζουλού":"zu","ιαπωνικά":"ja","ινδονησιακά":"id","ιρλανδικά":"ga","ισλανδικά":"is","ισπανικά":"es","ιταλικά":"it","κανάντα":"kn","καταλανικά":"ca","κινεζικά (απλοποιημένα)":"zh-cn","κινεζικά (παραδοσιακά)":"zh-tw","κορεατικά":"ko","κουρδικά (κουρμαντζί)":"ku","κουρδικά (σορανί)":"ckb","κρεόλ αϊτής":"ht","κροατικά":"hr","λατινικά":"la","λετονικά":"lv","λευκορωσικά":"be","λιθουανικά":"lt","μαλαγιάλαμ":"ml","μαλέι":"ms","μαλτεζικά":"mt","μαορί":"mi","μαραθικά":"mr","μογγολικά":"mn","νορβηγικά":"nb","ολλανδικά":"nl","ουαλικά":"cy","ουγγρικά":"hu","ουζμπεκικά":"uz","ουκρανικά":"uk","περσικά":"fa","πολωνικά":"pl","πορτογαλικά":"pt","ρουμανικά":"ro","ρωσικά":"ru","σερβικά":"sr","σλαβομακεδονικά":"mk","σλοβακικά":"sk","σλοβενικά":"sl","σουηδικά":"sv","ταϊλανδεζικά":"th","τελούγκου":"te","τουρκικά":"tr","τσεχικά":"cs","φινλανδικά":"fi","χίντι":"hi","albania":"sq","amharik":"am","arab":"ar","armenia":"hy","azerbaijan":"az","bask":"eu","belanda":"nl","belarussia":"be","bulgaria":"bg","ceko":"cs","china (aks. sederhana)":"zh-cn","china (aks. tradisional)":"zh-tw","denmark":"da","estonia":"et","farsi":"fa","finlandia":"fi","gaelig":"ga","gaelik skotlandia":"gd","galisia":"gl","hungaria":"hu","ibrani":"he","indonesia":"id","inggris":"en","islandia":"is","italia":"it","jepang":"ja","jerman":"de","katalan":"ca","korea":"ko","kreol haiti":"ht","kroasia":"hr","kurdi (kurmanji)":"ku","kurdi (sorani)":"ckb","latvia":"lv","lituania":"lt","makedonia":"mk","malta":"mt","melayu":"ms","mongolia":"mn","myanmar":"my","norwegia":"nb","polandia":"pl","portugis":"pt","prancis":"fr","rumania":"ro","rusia":"ru","serb":"sr","slovakia":"sk","slovenia":"sl","spanyol":"es","swedia":"sv","turkiye":"tr","ukraina":"uk","vietnam":"vi","yunani":"el","آبخازی":"ab","آذرباﻳﺠﺎﻧﻰ":"az","آلبانیایی":"sq","آلمانی":"de","ارمنی":"hy","ازبکی":"uz","اسپانیایی":"es","اسپرانتو":"eo","استونيايی":"et","اسلواکی":"sk","اسلونیایی":"sl","اکراينی":"uk","امهری":"am","اندونزيايی":"id","انگلیسی":"en","ایتالیایی":"it","ایرلندی":"ga","ايسلندی":"is","باسکی":"eu","برمه‌ای":"my","بلاروسی":"be","بلغاری":"bg","پرتغالی":"pt","تايلندی":"th","ترکی استانبولی":"tr","تلوگو":"te","چک":"cs","چینی (ساده‌شده)":"zh-cn","چینی (سنتی)":"zh-tw","دانمارکی":"da","روسی":"ru","رومانيايی":"ro","زولو":"zu","ژاپنی":"ja","سوئدی":"sv","صربی":"sr","عبری":"he","عربی":"ar","فارسی":"fa","فرانسوی":"fr","فنلاندی":"fi","کاتالان":"ca","کرئول هائیتی":"ht","کردی (سورانی)":"ckb","کردی (کرمانجی)":"ku","کرواتی":"hr","کره‌ای":"ko","کنادا":"kn","گالیسی":"gl","گاليک اسکاتلندی":"gd","لاتين":"la","لتونيايی":"lv","لهستانی":"pl","ليتوانيايی":"lt","مائوری":"mi","مالایالمی":"ml","مالايی":"ms","مالتی":"mt","مجاری":"hu","مراتی":"mr","مغولی":"mn","مقدونيه‌ای":"mk","نروژی":"nb","ولزی":"cy","ويتنامی":"vi","هلندی":"nl","هندی":"hi","يونانی":"el","abecásio":"ab","albanês":"sq","alemão":"de","amárico":"am","árabe":"ar","armênio":"hy","azerbaijano":"az","basco":"eu","bielorrusso":"be","birmanês":"my","búlgaro":"bg","canarês":"kn","catalão":"ca","chinês (simplificado)":"zh-cn","chinês (tradicional)":"zh-tw","coreano":"ko","crioulo haitiano":"ht","croata":"hr","curdo (kurmanji)":"ku","curdo (sorâni)":"ckb","dinamarquês":"da","eslovaco":"sk","esloveno":"sl","espanhol":"es","estoniano":"et","finlandês":"fi","francês":"fr","gaélico escocês":"gd","galego":"gl","galês":"cy","grego":"el","hebraico":"he","holandês":"nl","húngaro":"hu","indonésio":"id","inglês":"en","irlandês":"ga","islandês":"is","italiano":"it","japonês":"ja","latim":"la","letão":"lv","lituano":"lt","macedônio":"mk","malaiala":"ml","malaio":"ms","maltês":"mt","marata":"mr","mongol":"mn","norueguês":"nb","persa":"fa","polonês":"pl","português":"pt","romeno":"ro","russo":"ru","sérvio":"sr","sueco":"sv","tailandês":"th","tcheco":"cs","telugo":"te","turco":"tr","ucraniano":"uk","uzbeque":"uz","vietnamita":"vi","abchazisch":"ab","albanees":"sq","amharisch":"am","arabisch":"ar","armeens":"hy","azerbeidzjaans":"az","baskisch":"eu","belarussisch":"be","birmaans":"my","bulgaars":"bg","catalaans":"ca","chinees (traditioneel)":"zh-tw","chinees (vereenvoudigd)":"zh-cn","deens":"da","duits":"de","engels":"en","ests":"et","fins":"fi","frans":"fr","galicisch":"gl","grieks":"el","haïtiaans creools":"ht","hebreeuws":"he","hongaars":"hu","iers":"ga","ijslands":"is","indonesisch":"id","italiaans":"it","japans":"ja","koerdisch (kurmanji)":"ku","koerdisch (sorani)":"ckb","koreaans":"ko","kroatisch":"hr","latijn":"la","lets":"lv","litouws":"lt","macedonisch":"mk","maleis":"ms","maltees":"mt","mongools":"mn","nederlands":"nl","noors":"nb","oekraïens":"uk","oezbeeks":"uz","perzisch":"fa","pools":"pl","portugees":"pt","roemeens":"ro","russisch":"ru","schots-gaelisch":"gd","servisch":"sr","slovaaks":"sk","sloveens":"sl","spaans":"es","tsjechisch":"cs","turks":"tr","vietnamees":"vi","zoeloe":"zu","zweeds":"sv","abjasio":"ab","albanés":"sq","alemán":"de","amhárico":"am","armenio":"hy","azerí":"az","bielorruso":"be","birmano":"my","canarés":"kn","catalán":"ca","checo":"cs","chino (simplificado)":"zh-cn","chino (tradicional)":"zh-tw","criollo haitiano":"ht","danés":"da","español":"es","estonio":"et","euskera":"eu","finlandés":"fi","francés":"fr","gaélico escocés":"gd","galés":"cy","gallego":"gl","griego":"el","hebreo":"he","indonesio":"id","inglés":"en","irlandés":"ga","islandés":"is","japonés":"ja","kurdo (kurmanyi)":"ku","kurdo (sorani)":"ckb","latín":"la","letón":"lv","macedonio":"mk","malayo":"ms","maltés":"mt","maorí":"mi","maratí":"mr","neerlandés":"nl","noruego":"nb","polaco":"pl","portugués":"pt","rumano":"ro","ruso":"ru","serbio":"sr","tailandés":"th","uzbeco":"uz","zulú":"zu","abchasais":"ab","airmeinis":"hy","albàinis":"sq","amtharais":"am","arabais":"ar","asarbaideànais":"az","basgais":"eu","bealaruisis":"be","beurla":"en","bhiet-namais":"vi","bulgarais":"bg","cànan nan tàidh":"th","catalanais":"ca","coirèanais":"ko","crìtheol haidhti":"ht","cròthaisis":"hr","cuimris":"cy","cùrdais (kurmanji)":"ku","cùrdais (sorani)":"ckb","danmhairgis":"da","duitsis":"nl","eabhra":"he","eadailtis":"it","eastoinis":"et","fionnlannais":"fi","fraingis":"fr","gaeilge":"ga","gàidhlig":"gd","gailìsis":"gl","gearmailtis":"de","grèigis":"el","hindis":"hi","innd-innsis":"id","innis-tìlis":"is","laideann":"la","laitbheis":"lv","liotuainis":"lt","malaidhis":"ms","maltais":"mt","māori":"mi","masadonais":"mk","miànmar (burmais)":"my","mongolais":"mn","nirribhis":"nb","peirsis":"fa","pòlainnis":"pl","portagailis":"pt","romàinis":"ro","ruisis":"ru","seacais":"cs","seapanais":"ja","sèirbis":"sr","sìonais (seann-nòsach)":"zh-tw","sìonais (sìmplichte)":"zh-cn","slòbhacais":"sk","slòbhainis":"sl","spàinntis":"es","suainis":"sv","turcais":"tr","ucràinis":"uk","ungairis":"hu","usbagais":"uz","abchaski":"ab","albański":"sq","amharski":"am","angielski":"en","arabski":"ar","azerski":"az","baskijski":"eu","białoruski":"be","birmański":"my","bułgarski":"bg","chiński (tradycyjny)":"zh-tw","chiński (uproszczony)":"zh-cn","chorwacki":"hr","czeski":"cs","duński":"da","estoński":"et","fiński":"fi","francuski":"fr","galicyjski":"gl","grecki":"el","hebrajski":"he","hiszpański":"es","indonezyjski":"id","irlandzki":"ga","islandzki":"is","japoński":"ja","kataloński":"ca","koreański":"ko","kreolski (haiti)":"ht","kurdyjski (kurmandżi)":"ku","kurdyjski (sorani)":"ckb","litewski":"lt","łaciński":"la","łotewski":"lv","macedoński":"mk","malajalam":"ml","malajski":"ms","maltański":"mt","maoryski":"mi","mongolski":"mn","niderlandzki":"nl","niemiecki":"de","norweski":"nb","ormiański":"hy","perski":"fa","polski":"pl","portugalski":"pt","rosyjski":"ru","rumuński":"ro","serbski":"sr","słowacki":"sk","słoweński":"sl","szkocki gaelicki":"gd","szwedzki":"sv","tajski":"th","turecki":"tr","ukraiński":"uk","uzbecki":"uz","walijski":"cy","węgierski":"hu","wietnamski":"vi","włoski":"it","abkasíska":"ab","albanska":"sq","amharíska":"am","arabíska":"ar","armenska":"hy","aserska":"az","baskneska":"eu","búlgarska":"bg","búrmíska":"my","danska":"da","eistneska":"et","enska":"en","esperantó":"eo","finnska":"fi","franska":"fr","galisíska":"gl","gríska":"el","haítískt kreólamál":"ht","hebreska":"he","hindí":"hi","hollenska":"nl","hvítrússneska":"be","indónesíska":"id","írska":"ga","íslenska":"is","ítalska":"it","japanska":"ja","katalónska":"ca","kínverska (einfölduð)":"zh-cn","kínverska (hefðbundin)":"zh-tw","kóreska":"ko","króatíska":"hr","kúrdíska (kurmanji)":"ku","kúrdíska (soraní)":"ckb","latína":"la","lettneska":"lv","litháíska":"lt","makedónska":"mk","malajíska":"ms","maltneska":"mt","maoríska":"mi","mongólska":"mn","norska":"nb","persneska":"fa","portúgalska":"pt","pólska":"pl","rúmenska":"ro","rússneska":"ru","serbneska":"sr","skosk-gelíska":"gd","slóvakíska":"sk","slóvenska":"sl","spænska":"es","súlú":"zu","sænska":"sv","taílenska":"th","tékkneska":"cs","tyrkneska":"tr","ungverska":"hu","úkraínska":"uk","úsbekíska":"uz","velska":"cy","víetnamska":"vi","þýska":"de","abhaski":"ab","albanski":"sq","arapski":"ar","armenski":"hy","azerbajdžanski":"az","bjeloruski":"be","bugarski":"bg","burmanski":"my","češki":"cs","danski":"da","engleski":"en","estonski":"et","finski":"fi","galješki":"gl","grčki":"el","haićanski kreolski":"ht","hebrejski":"he","hindu":"hi","hrvatski":"hr","indonezijski":"id","irski":"ga","islandski":"is","japanski":"ja","katalonski":"ca","kineski (pojednostavljeni)":"zh-cn","kineski (tradicionalni)":"zh-tw","korejski":"ko","kurdski (kurmanji)":"ku","kurdski (soranski)":"ckb","latinski":"la","latvijski/letonski":"lv","litvanski":"lt","mađarski":"hu","makedonski":"mk","malajalamski":"ml","malezijski":"ms","malteški":"mt","maorski":"mi","marati":"mr","nizozemski":"nl","norveški":"nb","njemački":"de","perzijski":"fa","poljski":"pl","rumunjski":"ro","ruski":"ru","slovački":"sk","slovenski":"sl","srpski":"sr","škotski gaelski":"gd","španjolski":"es","švedski":"sv","tajlandski":"th","talijanski":"it","turski":"tr","ukrajinski":"uk","uzbekistanski":"uz","velški":"cy","vijetnamski":"vi","abkhaze":"ab","albanais":"sq","allemand":"de","amharique":"am","anglais":"en","arabe":"ar","arménien":"hy","azéri":"az","biélorusse":"be","birman":"my","bulgare":"bg","chinois (simplifié)":"zh-cn","chinois (traditionnel)":"zh-tw","coréen":"ko","créole haïtien":"ht","croate":"hr","danois":"da","espagnol":"es","espéranto":"eo","estonien":"et","finnois":"fi","français":"fr","gaélique (écosse)":"gd","galicien":"gl","gallois":"cy","grec":"el","hébreu":"he","hongrois":"hu","indonésien":"id","irlandais":"ga","islandais":"is","italien":"it","japonais":"ja","kurde (kurmandji)":"ku","kurde (sorani)":"ckb","letton":"lv","lituanien":"lt","macédonien":"mk","malaisien":"ms","néerlandais":"nl","norvégien":"nb","ouzbek":"uz","persan":"fa","polonais":"pl","portugais":"pt","roumain":"ro","russe":"ru","serbe":"sr","slovaque":"sk","slovène":"sl","suédois":"sv","tchèque":"cs","thaï":"th","turc":"tr","ukrainien":"uk","vietnamien":"vi","zoulou":"zu","abkhasisk":"ab","albansk":"sq","amharisk":"am","arabisk":"ar","armensk":"hy","aserbajdsjansk":"az","baskisk":"eu","bulgarsk":"bg","burmesisk":"my","dansk":"da","engelsk":"en","estisk":"et","finsk":"fi","fransk":"fr","galisisk":"gl","gresk":"el","hebraisk":"he","hviterussisk":"be","indonesisk":"id","irsk":"ga","islandsk":"is","italiensk":"it","japansk":"ja","katalansk":"ca","kinesisk (forenklet)":"zh-cn","kinesisk (tradisjonell)":"zh-tw","koreansk":"ko","kreol (haiti)":"ht","kroatisk":"hr","kurdisk (kurmanji)":"ku","kurdisk (sorani)":"ckb","latvisk":"lv","litauisk":"lt","makedonsk":"mk","malayisk":"ms","maltesisk":"mt","mongolsk":"mn","nederlandsk":"nl","norsk":"nb","polsk":"pl","portugisisk":"pt","rumensk":"ro","russisk":"ru","serbisk":"sr","skotsk gælisk":"gd","slovakisk":"sk","slovensk":"sl","spansk":"es","svensk":"sv","tsjekkisk":"cs","tyrkisk":"tr","tysk":"de","ukrainsk":"uk","ungarsk":"hu","usbekisk":"uz","vietnamesisk":"vi","walisisk":"cy","abkhazo":"ab","acerbaixano":"az","chinés (simplificado)":"zh-cn","chinés (tradicional)":"zh-tw","dinamarqués":"da","éuscaro":"eu","finés":"fi","kurdo (kurmanji)":"ku","malabar":"ml","noruegués":"nb","romanés":"ro","telugú":"te","ucraíno":"uk","uzbeko":"uz","xaponés":"ja","абхазки":"ab","азербайджански":"az","албански":"sq","амхарски":"am","английски":"en","арабски":"ar","арменски":"hy","баски":"eu","беларуски":"be","бирмански":"my","български":"bg","виетнамски":"vi","галисийски":"gl","гръцки":"el","датски":"da","есперанто":"eo","естонски":"et","зулу":"zu","иврит":"he","индонезийски":"id","ирландски":"ga","исландски":"is","испански":"es","италиански":"it","каннада":"kn","каталонски":"ca","китайски (опростен)":"zh-cn","китайски (традиционен)":"zh-tw","корейски":"ko","кюрдски (курманджи)":"ku","кюрдски (сорани)":"ckb","латвийски":"lv","латински":"la","литовски":"lt","македонски":"mk","малайски":"ms","малаялам":"ml","малтийски":"mt","маорски":"mi","маратхи":"mr","монголски":"mn","немски":"de","нидерландски":"nl","норвежки":"nb","персийски":"fa","полски":"pl","португалски":"pt","румънски":"ro","руски":"ru","словашки":"sk","словенски":"sl","сръбски":"sr","тайландски":"th","телугу":"te","турски":"tr","уелски":"cy","узбекски":"uz","украински":"uk","унгарски":"hu","финландски":"fi","френски":"fr","хаитянски креолски":"ht","хинди":"hi","хърватски":"hr","чешки":"cs","шведски":"sv","шотландски келтски":"gd","японски":"ja","азербејџански":"az","англиски":"en","апхаски":"ab","арапски":"ar","баскиски":"eu","белоруски":"be","бугарски":"bg","велшки":"cy","галициски":"gl","германски":"de","грчки":"el","дански":"da","ерменски":"hy","индонезиски":"id","ирски":"ga","италијански":"it","јапонски":"ja","канада":"kn","кинески (поедноставен)":"zh-cn","кинески (традиционален)":"zh-tw","корејски":"ko","курдски (курманџи)":"ku","курдски (сорани)":"ckb","латвиски":"lv","литвански":"lt","малајалски":"ml","малајски":"ms","малтешки":"mt","мјанмарски (бурмански)":"my","норвешки":"nb","персиски":"fa","романски":"ro","словачки":"sk","словенечки":"sl","српски":"sr","тајландски":"th","узбечки":"uz","фински":"fi","француски":"fr","хаитски креолски":"ht","хебрејски":"he","холандски":"nl","хрватски":"hr","шкотски галски":"gd","шпански":"es","աբխազերեն":"ab","ադրբեջաներեն":"az","ալբաներեն":"sq","ամհարերեն":"am","անգլերեն":"en","արաբերեն":"ar","բասկերեն":"eu","բելառուսերեն":"be","բիրմաներեն":"my","բուլղարերեն":"bg","գալիսերեն":"gl","գելական շոտլանդերեն":"gd","գերմաներեն":"de","դանիերեն":"da","եբրայերեն":"he","զուլուսերեն":"zu","էսպերանտո":"eo","էստոներեն":"et","թայերեն":"th","թուրքերեն":"tr","ինդոնեզերեն":"id","իռլանդերեն":"ga","իսլանդերեն":"is","իսպաներեն":"es","իտալերեն":"it","լատիներեն":"la","լատվիերեն":"lv","լեհերեն":"pl","լիտվերեն":"lt","խորվաթերեն":"hr","կաննադա":"kn","կատալաներեն":"ca","կորեերեն":"ko","կրեոլերեն (հաիթի)":"ht","հայերեն":"hy","հինդի":"hi","հոլանդերեն":"nl","հունարեն":"el","հունգարերեն":"hu","ճապոներեն":"ja","մալայալամ":"ml","մալայերեն":"ms","մալթայերեն":"mt","մակեդոներեն":"mk","մաորի":"mi","մարաթի":"mr","մոնղոլերեն":"mn","նորվեգերեն":"nb","շվեդերեն":"sv","ուզբեկերեն":"uz","ուկրաիներեն":"uk","չեխերեն":"cs","չինարեն (ավանդական)":"zh-tw","չինարեն (պարզեցված)":"zh-cn","պարսկերեն":"fa","պորտուգալերեն":"pt","ռումիներեն":"ro","ռուսերեն":"ru","սերբերեն":"sr","սլովակերեն":"sk","սլովեներեն":"sl","վալլերեն":"cy","վիետնամերեն":"vi","տելուգու":"te","քրդերեն (սորանի)":"ckb","քրդերեն (քուրմանջի)":"ku","ֆիններեն":"fi","ֆրանսերեն":"fr","abhāzu":"ab","albāņu":"sq","amharu":"am","angļu":"en","arābu":"ar","armēņu":"hy","azerbaidžāņu":"az","baltkrievu":"be","basku":"eu","birmiešu":"my","bulgāru":"bg","čehu":"cs","dāņu":"da","franču":"fr","galisiešu":"gl","grieķu":"el","haitiešu":"ht","holandiešu":"nl","horvātu":"hr","igauņu":"et","indonēziešu":"id","itāļu":"it","ivrits":"he","īru":"ga","īslandiešu":"is","japāņu":"ja","katalāņu":"ca","korejiešu":"ko","krievu":"ru","kurdu (kurmandži)":"ku","kurdu (sorani)":"ckb","ķīniešu (tradicionālā)":"zh-tw","ķīniešu (vienkāršotā)":"zh-cn","latīņu":"la","latviešu":"lv","lietuviešu":"lt","maķedoniešu":"mk","malajalamiešu":"ml","malajiešu":"ms","maltiešu":"mt","maratu":"mr","mongoļu":"mn","norvēģu":"nb","persiešu":"fa","poļu":"pl","portugāļu":"pt","rumāņu":"ro","serbu":"sr","skotu gēlu":"gd","slovāku":"sk","slovēņu":"sl","somu":"fi","spāņu":"es","taju":"th","turku":"tr","ukraiņu":"uk","ungāru":"hu","uzbeku":"uz","vācu":"de","velsiešu":"cy","vjetnamiešu":"vi","zviedru":"sv","albanès":"sq","alemany":"de","amhàric":"am","anglès":"en","àrab":"ar","armeni":"hy","àzeri":"az","basc":"eu","bielorús":"be","birmà":"my","búlgar":"bg","castellà":"es","català":"ca","coreà":"ko","crioll d\'haití":"ht","croat":"hr","danès":"da","eslovac":"sk","eslovè":"sl","estonià":"et","finès":"fi","francès":"fr","gaèlic escocès":"gd","gallec":"gl","gal·lès":"cy","hebreu":"he","hongarès":"hu","indonesi":"id","irlandès":"ga","islandès":"is","italià":"it","japonès":"ja","kurd (kurmanji)":"ku","kurd (sorani)":"ckb","letó":"lv","lituà":"lt","llatí":"la","macedònic":"mk","malai":"ms","malaiàlam":"ml","maltès":"mt","neerlandès":"nl","noruec":"nb","polonès":"pl","portuguès":"pt","romanès":"ro","rus":"ru","serbi":"sr","suec":"sv","tai":"th","txec":"cs","ucraïnès":"uk","xinès (simplificat)":"zh-cn","xinès (tradicional)":"zh-tw","isi-abkhaz":"ab","isi-albania":"sq","isi-amharic":"am","isi-arabic":"ar","isi-armenian":"hy","isi-azerbaijani":"az","isi-dutch":"nl","isi-esperanto":"eo","isi-estonia":"et","isi-icelandic":"is","isi-indonesia":"id","isi-irish":"ga","isi-ukraine":"uk","isi-uzbek":"uz","isibasque":"eu","isibelarus":"be","isibulgaria":"bg","isicatalan":"ca","isichina (esilulana)":"zh-cn","isicreole sasehaiti":"ht","isicroatia":"hr","isiczech":"cs","isidanish":"da","isifinnish":"fi","isifrentshi":"fr","isigalicia":"gl","isigrikhi":"el","isihebheru":"he","isihindi":"hi","isihungary":"hu","isijalimani":"de","isijaphani":"ja","isikannada":"kn","isikorean":"ko","isikurdish (sasekurmanji)":"ku","isikurdish (sasesorani)":"ckb","isilathini":"la","isilatvian":"lv","isilithuania":"lt","isimacedonian":"mk","isimalay":"ms","isimalayalam":"ml","isimaltese":"mt","isimaori":"mi","isimarathi":"mr","isimongolia":"mn","isimyanmar (saseburmese)":"my","isingisi":"en","isinorwegia":"nb","isintaliyani":"it","isipersian":"fa","isipolish":"pl","isiputukezi":"pt","isirashiya":"ru","isiromania":"ro","isiscots gaelic":"gd","isiserbian":"sr","isislovak":"sk","isislovenia":"sl","isiswidi":"sv","isitelugu":"te","isithai":"th","isiturkish":"tr","isivietnam":"vi","isiwelsh":"cy","isizulu":"zu","ispenishi":"es","अंग्रेज़ी":"en","अज़रबैजानी":"az","अबखाज़":"ab","अरबी":"ar","अल्बेनियन":"sq","आइसलैंडिक":"is","आयरिश":"ga","आर्मीनियन":"hy","इंडोनेशियन":"id","इटैलियन":"it","उज़्बेक":"uz","एस्टोनियन":"et","एस्पेरांटो":"eo","ऐम्हेरिक":"am","कन्नड़":"kn","कुर्दिश (कुर्मांजी)":"ku","कुर्दिश (सोरानी)":"ckb","कैटेलन":"ca","कोरियन":"ko","क्रोएशियन":"hr","गैलिशियन":"gl","ग्रीक":"el","चाइनीज़ (ट्रेडिश्नल)":"zh-tw","चाइनीज़ (सिंप्लिफ़ाइड)":"zh-cn","चेक":"cs","जर्मन":"de","ज़ुलु":"zu","जैपनीज़":"ja","डच":"nl","डैनिश":"da","तुर्क":"tr","तेलुगु":"te","थाई":"th","नॉर्वेजियन":"nb","पुर्तगाली":"pt","पोलिश":"pl","फारसी":"fa","फ़िनिश":"fi","फ़्रेंच":"fr","बर्मी":"my","बल्गैरियन":"bg","बेलारशियन":"be","बैस्क":"eu","मंगोलियन":"mn","मराठी":"mr","मलय":"ms","मलयालम":"ml","माऔरी":"mi","माल्टी":"mt","मैसेडोनियन":"mk","यूक्रेनियन":"uk","रूसी":"ru","रोमेनियन":"ro","लातवियन":"lv","लिथुएनियन":"lt","लैटिन":"la","वियतनामी":"vi","वेल्श":"cy","सर्बियाई":"sr","स्कॉट्स गेलिक":"gd","स्पैनिश":"es","स्लोवाक":"sk","स्लोवेनियन":"sl","स्वीडिश":"sv","हंगेरियन":"hu","हिन्दी":"hi","हीब्रू":"he","हैतियन क्रिओल":"ht","ả rập":"ar","anh":"en","ba lan":"pl","ba tư":"fa","belarus":"be","bồ đào nha":"pt","creole (haiti)":"ht","croatia":"hr","do thái":"he","đan mạch":"da","đức":"de","gael scotland":"gd","galicia":"gl","hà lan":"nl","hàn":"ko","hungary":"hu","hy lạp":"el","iceland":"is","ireland":"ga","latinh":"la","litva":"lt","mã lai":"ms","macedonia":"mk","mông cổ":"mn","na uy":"nb","nga":"ru","nhật":"ja","pháp":"fr","phần lan":"fi","quốc tế ngữ":"eo","rumani":"ro","séc":"cs","serbia":"sr","tây ban nha":"es","thái":"th","thổ nhĩ kỳ":"tr","thụy điển":"sv","trung (giản thể)":"zh-cn","trung (phồn thể)":"zh-tw","việt":"vi","xứ wales":"cy","ý":"it","abház":"ab","albán":"sq","amhara":"am","angol":"en","azeri":"az","baszk":"eu","belorusz":"be","bolgár":"bg","burmai":"my","cseh":"cs","dán":"da","eszperantó":"eo","észt":"et","finn":"fi","francia":"fr","galíciai":"gl","görög":"el","haiti kreol":"ht","héber":"he","holland":"nl","horvát":"hr","indonéz":"id","ír":"ga","izlandi":"is","japán":"ja","katalán":"ca","kínai (egyszerűsített)":"zh-cn","kínai (hagyományos)":"zh-tw","koreai":"ko","kurd (kurmandzsi)":"ku","kurd (szoráni)":"ckb","lengyel":"pl","lett":"lv","litván":"lt","macedón":"mk","magyar":"hu","maláj":"ms","malajálam":"ml","máltai":"mt","maráthi":"mr","német":"de","norvég":"nb","olasz":"it","orosz":"ru","örmény":"hy","perzsa":"fa","portugál":"pt","román":"ro","skót gael":"gd","svéd":"sv","szerb":"sr","szlovák":"sk","szlovén":"sl","török":"tr","ukrán":"uk","üzbég":"uz","vietnámi":"vi","walesi":"cy","abhaasi":"ab","albaania":"sq","amhaari":"am","araabia":"ar","armeenia":"hy","aserbaidžaani":"az","baski":"eu","birma":"my","bulgaaria":"bg","eesti":"et","galeegi":"gl","haitikreooli":"ht","heebrea":"he","hiina (lihtsustatud)":"zh-cn","hiina (traditsiooniline)":"zh-tw","hispaania":"es","hollandi":"nl","horvaadi":"hr","iiri":"ga","indoneesia":"id","inglise":"en","islandi":"is","itaalia":"it","jaapani":"ja","katalaani":"ca","kreeka":"el","kurdi (kurmandži)":"ku","ladina":"la","leedu":"lt","läti":"lv","makedoonia":"mk","malajalaami":"ml","maoori":"mi","mongoli":"mn","norra":"nb","poola":"pl","portugali":"pt","prantsuse":"fr","pärsia":"fa","rootsi":"sv","rumeenia":"ro","saksa":"de","slovaki":"sk","sloveeni":"sl","soome":"fi","suulu":"zu","šoti":"gd","taani":"da","tšehhi":"cs","türgi":"tr","uelsi":"cy","ungari":"hu","usbeki":"uz","valgevene":"be","vene":"ru","vietnami":"vi","abchazų":"ab","airių":"ga","albanų":"sq","amharų":"am","anglų":"en","arabų":"ar","armėnų":"hy","azerbaidžaniečių":"az","baltarusių":"be","baskų":"eu","birmiečių":"my","bulgarų":"bg","čekų":"cs","danų":"da","estų":"et","galisų":"gl","graikų":"el","haičio kreolų":"ht","hebrajų":"he","indoneziečių":"id","islandų":"is","ispanų":"es","italų":"it","japonų":"ja","kanadų":"kn","kataloniečių":"ca","kinų (supaprastinta)":"zh-cn","kinų (tradicinė)":"zh-tw","korėjiečių":"ko","kroatų":"hr","kurdų (kurmandžių)":"ku","kurdų (soranių)":"ckb","latvių":"lv","lenkų":"pl","lietuvių":"lt","lotynų":"la","makedoniečių":"mk","malajalių":"ml","malajiečių":"ms","maltiečių":"mt","maorių":"mi","maratų":"mr","mongolų":"mn","norvegų":"nb","olandų":"nl","persų":"fa","portugalų":"pt","prancūzų":"fr","rumunų":"ro","rusų":"ru","serbų":"sr","slovakų":"sk","slovėnų":"sl","suomių":"fi","škotų":"gd","švedų":"sv","tajų":"th","telugų":"te","turkų":"tr","ukrainiečių":"uk","uzbekų":"uz","valų":"cy","vengrų":"hu","vietnamiečių":"vi","vokiečių":"de","zulusų":"zu","абхазька":"ab","азербайджанська":"az","албанська":"sq","амхарська":"am","англійська":"en","арабська":"ar","баскська":"eu","білоруська":"be","бірманська":"my","болгарська":"bg","в’єтнамська":"vi","валлійська":"cy","вірменська":"hy","гаїтянська креольська":"ht","гінді":"hi","грецька":"el","ґалісійська":"gl","данська":"da","естонська":"et","іврит":"he","індонезійська":"id","ірландська":"ga","ісландська":"is","іспанська":"es","італійська":"it","каталанська":"ca","китайська (спрощена)":"zh-cn","китайська (традиційна)":"zh-tw","корейська":"ko","курдська (курманджі)":"ku","курдська (сорані)":"ckb","латинська":"la","латиська":"lv","литовська":"lt","македонська":"mk","малайська":"ms","мальтійська":"mt","маорі":"mi","маратхі":"mr","монгольська":"mn","нідерландська":"nl","німецька":"de","норвезька":"nb","перська":"fa","польська":"pl","португальська":"pt","російська":"ru","румунська":"ro","сербська":"sr","словацька":"sk","словенська":"sl","тайська":"th","телуґу":"te","турецька":"tr","угорська":"hu","узбецька":"uz","українська":"uk","фінська":"fi","французька":"fr","хорватська":"hr","чеська":"cs","шведська":"sv","шотландська (ґельська)":"gd","японська":"ja","अझरबैजानी":"az","अब्काझ":"ab","अम्हारिक":"am","अर्मेनियन":"hy","अल्बानियन":"sq","आइसलँडिक":"is","इंग्रजी":"en","इटालियन":"it","उझ्बेक":"uz","एस्परँटो":"eo","कन्नड":"kn","कॅटलान":"ca","गॅलिशियन":"gl","चीनी (पारंपारिक)":"zh-tw","चीनी (सरलीकृत)":"zh-cn","जपानी":"ja","झुलु":"zu","झेक":"cs","डॅनिश":"da","तुर्की":"tr","पोर्तुगीज":"pt","फिन्निश":"fi","फ्रेंच":"fr","बल्गेरियन":"bg","बास्क":"eu","बेलारुशियन":"be","मल्याळम":"ml","माओरी":"mi","माल्टीज":"mt","मॅसेडोनियन":"mk","म्यानमार (बर्मीज)":"my","युक्रेनियन":"uk","रशियन":"ru","रोमानियन":"ro","लाट्वियन":"lv","लिथुआनियन":"lt","लॅटिन":"la","व्हिएतनामी":"vi","सर्बियन":"sr","स्पॅनिश":"es","स्लोव्हाक":"sk","स्लोव्हेनियन":"sl","हिब्रू":"he","हैतीयन क्रेओल":"ht","abxaz":"ab","alban":"sq","amxar":"am","arman":"hy","bolgar":"bg","dan":"da","eston":"et","fin":"fi","fors":"fa","fransuz":"fr","gaiti-kreol":"ht","galisiy":"gl","golland":"nl","grek":"el","hind":"hi","indonez":"id","ingliz":"en","irland":"ga","island":"is","ispan":"es","italyan":"it","ivrit":"he","koreys":"ko","kurd (kurmonji)":"ku","latish":"lv","lotin":"la","makedon":"mk","maltiy":"mt","maratxi":"mr","nemis":"de","norveg":"nb","ozarbayjon":"az","polyak":"pl","portugal":"pt","rumin":"ro","sloven":"sl","tay":"th","turk":"tr","ukrain":"uk","valliy":"cy","venger":"hu","vyetnam":"vi","xitoy (odatiy)":"zh-tw","xitoy (soddalashgan)":"zh-cn","xorvat":"hr","yapon":"ja","o‘zbek":"uz","shotland-gel":"gd","shved":"sv","chex":"cs","alman":"de","amarik":"am","azərbaycan":"az","bolqar":"bg","çex":"cs","çin (ənənəvi)":"zh-tw","çin (sadələşdirilmiş)":"zh-cn","danimarka":"da","erməni":"hy","ərəb":"ar","fars":"fa","fransız":"fr","ingilis":"en","i̇ndoneziya":"id","i̇rland":"ga","i̇sland":"is","i̇sveç":"sv","i̇talyan":"it","i̇vrit":"he","koreya":"ko","kürd(kurmanci)":"ku","kürd(sorani)":"ckb","qalisian":"gl","latın":"la","latış":"lv","macar":"hu","makedoniya":"mk","monqol":"mn","myanma (birma)":"my","norveç":"nb","özbək":"uz","portuqal":"pt","rumın":"ro","şotland (kelt)":"gd","teluqu":"te","türk":"tr","uels":"cy","ukrayna":"uk","yunan":"el","土耳其文":"tr","中文 (繁體)":"zh-tw","中文 (簡體)":"zh-cn","丹麥文":"da","巴斯克文":"eu","日文":"ja","毛利文":"mi","世界語":"eo","加里西亞文":"gl","加泰隆尼亞文":"ca","卡納達文":"kn","白俄羅斯文":"be","立陶宛文":"lt","冰島文":"is","匈牙利文":"hu","印尼文":"id","印地文":"hi","西班牙文":"es","克羅埃西亞文":"hr","希伯來文":"he","希臘文":"el","亞美尼亞文":"hy","亞塞拜然文":"az","拉丁文":"la","拉脫維亞文":"lv","法文":"fr","波斯文":"fa","波蘭文":"pl","芬蘭文":"fi","阿布哈茲文":"ab","阿姆哈拉文":"am","阿拉伯文":"ar","阿爾巴尼亞文":"sq","俄文":"ru","保加利亞文":"bg","南非祖魯文":"zu","威爾斯文":"cy","英文":"en","庫德文 (庫爾曼吉文)":"ku","庫德文 (索拉尼文)":"ckb","挪威文":"nb","泰文":"th","泰盧固文":"te","海地克里奧文":"ht","烏克蘭文":"uk","烏茲別克文":"uz","馬耳他文":"mt","馬來文":"ms","馬其頓文":"mk","馬拉地文":"mr","馬拉雅拉姆文":"ml","捷克文":"cs","荷蘭文":"nl","斯洛伐克文":"sk","斯洛維尼亞文":"sl","越南文":"vi","塞爾維亞文":"sr","愛沙尼亞文":"et","愛爾蘭文":"ga","瑞典文":"sv","義大利文":"it","葡萄牙文":"pt","蒙古文":"mn","德文":"de","緬甸文":"my","韓文":"ko","羅馬尼亞文":"ro","蘇格蘭蓋爾文":"gd","abkazisht":"ab","amarikisht":"am","anglisht":"en","arabisht":"ar","armenisht":"hy","azerisht":"az","baskisht":"eu","birmanisht":"my","bjellorusisht":"be","bullgarisht":"bg","çekisht":"cs","danisht":"da","estonisht":"et","finlandisht":"fi","frëngjisht":"fr","galicianisht":"gl","galishte skoceze":"gd","greqisht":"el","gjermanisht":"de","hebraisht":"he","hindisht":"hi","holandisht":"nl","hungarisht":"hu","indonezisht":"id","irlandisht":"ga","islandisht":"is","italisht":"it","japonisht":"ja","kanadaisht":"kn","katalonisht":"ca","kinezisht (e thjeshtuar)":"zh-cn","kinezisht (tradicionale)":"zh-tw","koreanisht":"ko","kreolishte haitiane":"ht","kroatisht":"hr","kurdisht (kurmanjisht)":"ku","kurdisht (sorani)":"ckb","latinisht":"la","letonisht":"lv","lituanisht":"lt","malajalamisht":"ml","malajzisht":"ms","maltisht":"mt","maorisht":"mi","maqedonisht":"mk","maratisht":"mr","mongolisht":"mn","norvegjisht":"nb","persisht":"fa","polonisht":"pl","portugalisht":"pt","rumanisht":"ro","rusisht":"ru","serbisht":"sr","sllovakisht":"sk","sllovenisht":"sl","spanjisht":"es","suedisht":"sv","shqip":"sq","tajlandisht":"th","telugisht":"te","turqisht":"tr","uellsisht":"cy","ukrainisht":"uk","uzbekisht":"uz","vietnamisht":"vi","bahasa melayu":"ms","cina (ringkas)":"zh-cn","cina (tradisional)":"zh-tw","finland":"fi","gaelic scotland":"gd","inggeris":"en","itali":"it","jepun":"ja","kurdistan (kurmanji)":"ku","kurdistan (sorani)":"ckb","lithuania":"lt","myanmar (burma)":"my","norway":"nb","parsi":"fa","perancis":"fr","poland":"pl","romania":"ro","sepanyol":"es","sweden":"sv","turki":"tr","ukraine":"uk","wales":"cy","ahepaitani":"az","airihi":"ga","amariki":"am","amēniana":"hy","arapeinia":"sq","arapi":"ar","eperānato":"eo","etōnia":"et","haina (onamata)":"zh-tw","hainamana (kua whakamāmātia)":"zh-cn","hanekeria":"hu","hapanihi":"ja","herepia":"sr","hinerangi":"fi","hīni":"hi","hiperu":"he","horowākia":"sk","horowinia":"sl","huitene":"sv","huru":"zu","ingarihi":"en","initonīhia":"id","itāriana":"it","kanata":"kn","karihia":"gl","katarāna":"ca","kereore haiti":"ht","kiriki":"el","kōreana":"ko","koroātiana":"hr","korukoru":"tr","kūrihi (horani)":"ckb","kūrihi (kurumanihi)":"ku","makerōnia":"mk","māratihi":"mt","marei":"ms","mareiarama":"ml","mongōriana":"mn","nōwei":"nb","pākihi":"eu","pāniora":"es","pēma (purumīhi)":"my","peraruhia":"be","perēhia":"fa","pōrana":"pl","potukīhi":"pt","purukāriana":"bg","rātini":"la","rāwhiana":"lv","rituānia":"lt","romānia":"ro","rūhia":"ru","tati":"nl","tenemāka":"da","teruku":"te","tiamana":"de","tieke":"cs","tiorangi":"is","tuauri kotarangi":"gd","uhipeke":"uz","ūkareiana":"uk","wēra":"cy","whitināmu":"vi","wīwī":"fr","абхазская":"ab","азербайджанская":"az","албанская":"sq","амхарская":"am","англійская":"en","арабская":"ar","армянская":"hy","балгарская":"bg","баскская":"eu","беларуская":"be","бірманская (м’янма)":"my","в’етнамская":"vi","валійская":"cy","венгерская":"hu","гаіцянская крэольская":"ht","галандская":"nl","галісійская":"gl","грэчаская":"el","дацкая":"da","інданезійская":"id","ірландская":"ga","ісландская":"is","іспанская":"es","італьянская":"it","іўрыт":"he","карэйская":"ko","каталанская":"ca","кітайская (спрошчаная)":"zh-cn","кітайская (традыцыйная)":"zh-tw","курдская (курманджы)":"ku","курдская (сарані)":"ckb","латышская":"lv","лацінская":"la","літоўская":"lt","маары":"mi","македонская":"mk","малайская":"ms","мальтыйская":"mt","мангольская":"mn","нарвежская":"nb","нямецкая":"de","партугальская":"pt","персідская":"fa","польская":"pl","румынская":"ro","руская":"ru","сербская":"sr","славацкая":"sk","славенская":"sl","тайская":"th","турэцкая":"tr","тэлугу":"te","узбекская":"uz","украінская":"uk","фінская":"fi","французская":"fr","харвацкая":"hr","хіндзі":"hi","чэшская":"cs","шатландская гэльская":"gd","шведская":"sv","эсперанта":"eo","эстонская":"et","японская":"ja","abkaz":"ab","albanyen":"sq","amenyen":"hy","anglè":"en","azèbajani":"az","belarisyen":"be","bilgaryen":"bg","chinwa (senp)":"zh-cn","chinwa (tradisyonèl)":"zh-tw","danwa":"da","ebre":"he","endonezyen":"id","endou":"hi","estonyen":"et","fenlandè":"fi","franse":"fr","gaelik ekosè":"gd","galisyen":"gl","grèk":"el","ikrenyen":"uk","ilandè":"ga","islandè":"is","italyen":"it","izbèk":"uz","japonè":"ja","kanada":"kn","kid (koumanji)":"ku","kid (sorani)":"ckb","koreyen":"ko","kreyòl ayisyen":"ht","kwoasyen":"hr","laten":"la","letonyen":"lv","lityanyen":"lt","malè":"ms","malt":"mt","masedonyen":"mk","mayori":"mi","mongolyen":"mn","myanma (burmese)":"my","nòvejyen":"nb","olandè, neyèlandè":"nl","onngaryen":"hu","panyòl":"es","pèsyen":"fa","polonè":"pl","pòtigè":"pt","ris":"ru","romanyen":"ro","sèb":"sr","slovenyen":"sl","syedwa":"sv","tuk":"tr","tyèk":"cs","vyetnamyen":"vi","กรีก":"el","กันนาดา":"kn","กาลิเชียน":"gl","เกลิกสกอต":"gd","เกาหลี":"ko","คาตาลัน":"ca","เคิร์ด (กุรมันชี)":"ku","เคิร์ด (โซรานี)":"ckb","โครเอเชีย":"hr","จีน (ตัวเต็ม)":"zh-tw","จีน (ตัวย่อ)":"zh-cn","เช็ก":"cs","ซูลู":"zu","เซอร์เบียน":"sr","ญี่ปุ่น":"ja","ดัตช์":"nl","เดนมาร์ก":"da","ตุรกี":"tr","เตลูกู":"te","ไทย":"th","นอร์เวย์":"nb","บัลแกเรีย":"bg","บาสก์":"eu","เบลารุส":"be","เปอร์เซีย":"fa","โปรตุเกส":"pt","โปแลนด์":"pl","ฝรั่งเศส":"fr","ฟินแลนด์":"fi","มองโกเลีย":"mn","มัลทีส":"mt","มาซีโดเนีย":"mk","มาราฐี":"mr","มาลายาลัม":"ml","มาเลย์":"ms","เมารี":"mi","เมียนมา (พม่า)":"my","ยูเครน":"uk","เยอรมัน":"de","รัสเซีย":"ru","โรมาเนีย":"ro","ละติน":"la","ลัตเวีย":"lv","ลิทัวเนีย":"lt","เวลส์":"cy","เวียดนาม":"vi","สเปน":"es","สโลวัก":"sk","สโลวีเนีย":"sl","สวีเดน":"sv","อังกฤษ":"en","อับคาเซีย":"ab","อัมฮาริก":"am","อาร์เซอร์ไบจัน":"az","อาร์เมเนีย":"hy","อาหรับ":"ar","อิตาลี":"it","อินโดนีเซีย":"id","อุสเบกิสถาน":"uz","เอสโทเนีย":"et","เอสเปอแรนโต":"eo","แอลเบเนีย":"sq","ไอซ์แลนด์":"is","ไอร์แลนด์":"ga","ฮังการี":"hu","ฮินดี":"hi","ฮีบรู":"he","เฮติครีโอล":"ht","abkhaziera":"ab","albaniera":"sq","alemana":"de","amharera":"am","arabiera":"ar","armeniera":"hy","azerbaijanera":"az","bielorrusiera":"be","birmaniera":"my","bulgariera":"bg","daniera":"da","errumaniera":"ro","errusiera":"ru","eskoziako gaelikoa":"gd","eslovakiera":"sk","esloveniera":"sl","esperantoa":"eo","estoniera":"et","euskara":"eu","finlandiera":"fi","frantsesa":"fr","galesa":"cy","galiziera":"gl","gaztelania":"es","greziera":"el","hebreera":"he","hindia":"hi","hungariera":"hu","indonesiera":"id","ingelesa":"en","irlandera":"ga","islandiera":"is","italiera":"it","japoniera":"ja","katalana":"ca","koreera":"ko","kreolera (haiti)":"ht","kroaziera":"hr","kurduera (kurmanji)":"ku","kurduera (sorania)":"ckb","latina":"la","letoniera":"lv","lituaniera":"lt","malabarera":"ml","malaysiera":"ms","maltera":"mt","maoriera":"mi","marathera":"mr","mazedoniera":"mk","mongoliera":"mn","nederlandera":"nl","norvegiera":"nb","persiera":"fa","poloniera":"pl","portugesa":"pt","serbiera":"sr","suediera":"sv","telugua":"te","thailandiera":"th","turkiera":"tr","txekiera":"cs","txinera (sinplifikatua)":"zh-cn","txinera (tradizionala)":"zh-tw","ukrainera":"uk","uzbekera":"uz","vietnamera":"vi","zuluera":"zu","abcaso":"ab","albanese":"sq","amarico":"am","arabo":"ar","armeno":"hy","azero":"az","bielorusso":"be","bulgaro":"bg","catalano":"ca","ceco":"cs","cinese (semplificato)":"zh-cn","cinese (tradizionale)":"zh-tw","creolo haitiano":"ht","croato":"hr","curdo (sorani)":"ckb","danese":"da","ebraico":"he","estone":"et","finlandese":"fi","francese":"fr","gaelico scozzese":"gd","galiziano":"gl","gallese":"cy","giapponese":"ja","greco":"el","indonesiano":"id","inglese":"en","irlandese":"ga","islandese":"is","latino":"la","lettone":"lv","macedone":"mk","malese":"ms","mongolo":"mn","norvegese":"nb","olandese":"nl","persiano":"fa","polacco":"pl","portoghese":"pt","rumeno":"ro","serbo":"sr","slovacco":"sk","sloveno":"sl","spagnolo":"es","svedese":"sv","tedesco":"de","ucraino":"uk","ungherese":"hu","abkaż":"ab","albaniż":"sq","amħari":"am","armen":"hy","ażerbajġani":"az","belarussu":"be","bulgaru":"bg","ċek":"cs","ċiniż (simplifikat)":"zh-cn","ċiniż (tradizzjonali)":"zh-tw","creole haiti":"ht","daniż":"da","ebrajk":"he","estonjan":"et","finlandiż":"fi","franċiż":"fr","ġappuniż":"ja","ġermaniż":"de","gaelic tal-iskoċċiżi":"gd","galizjan":"gl","grieg":"el","għarbi":"ar","ħindi":"hi","indoneżjan":"id","ingliż":"en","irlandiż":"ga","islandiż":"is","kroat":"hr","latvjan":"lv","litwen":"lt","maċedonjan":"mk","malasjan":"ms","malti":"mt","mjanmar (burma)":"my","mongoljan":"mn","norveġiż":"nb","olandiż":"nl","persjan":"fa","pollakk":"pl","portugiż":"pt","rumen":"ro","russu":"ru","slovakk":"sk","spanjol":"es","svediż":"sv","tajlandiż":"th","taljan":"it","tork":"tr","ukren":"uk","ungeriż":"hu","użbek":"uz","vjetnamiż":"vi","żulu":"zu","ಅಜರ್ಬೈಜಾನಿ":"az","ಅಬ್ಖಾಜ್":"ab","ಅಮಹಾರಿಕ್":"am","ಅರಬ್ಬಿ":"ar","ಆರ್ಮೇನಿಯನ್":"hy","ಆಲ್ಬೇನಿಯನ್":"sq","ಇಂಗ್ಲಿಷ್‌‌":"en","ಇಂಡೋನೇಷಿಯನ್":"id","ಇಟಾಲಿಯನ್":"it","ಉಜ್ಬೆಕ್":"uz","ಎಸ್ಟೋನಿಯನ್":"et","ಎಸ್ಪೆರಾಂಟೋ":"eo","ಐರಿಷ್":"ga","ಐಸ್‌ಲ್ಯಾಂಡಿಕ್‌":"is","ಕನ್ನಡ":"kn","ಕುರ್ದಿಶ್ (ಕುರ್ಮಾಂಜಿ)":"ku","ಕುರ್ದಿಶ್ (ಸೊರಾನಿ)":"ckb","ಕೊರಿಯನ್":"ko","ಕ್ಯಾಟಲನ್":"ca","ಕ್ರೊಯೇಷಿಯನ್":"hr","ಗ್ಯಾಲೀಷಿಯನ್":"gl","ಗ್ರೀಕ್":"el","ಚೀನಿ (ಸರಳೀಕೃತ)":"zh-cn","ಚೈನೀಸ್ (ಸಾಂಪ್ರದಾಯಿಕ)":"zh-tw","ಜಪಾನಿ":"ja","ಜರ್ಮನ್":"de","ಜುಲು":"zu","ಝೆಕ್‌":"cs","ಟರ್ಕಿಷ್":"tr","ಡಚ್":"nl","ಡ್ಯಾನಿಷ್":"da","ತೆಲುಗು":"te","ಥಾಯ್":"th","ನಾರ್ವೇಜಿಯನ್‌":"nb","ಪೋರ್ಚುಗೀಸ್":"pt","ಪೋಲಿಷ್":"pl","ಫಾರ್ಸಿ":"fa","ಫಿನ್ನಿಷ್":"fi","ಫ್ರೆಂಚ್":"fr","ಬಲ್ಗೇರಿಯನ್":"bg","ಬಾಸ್ಕ್":"eu","ಬೆಲರೂಸಿಯನ್":"be","ಮಂಗೋಲಿಯನ್":"mn","ಮಯನ್ಮಾರ್ (ಬರ್ಮೀಸ್)":"my","ಮರಾಠಿ":"mr","ಮಲಯ":"ms","ಮಲಯಾಳಂ":"ml","ಮಾಲ್ಟೀಸ್":"mt","ಮಾವೋರಿ":"mi","ಮ್ಯಾಸೆಡೋನಿಯನ್":"mk","ಯುಕ್ರೇನಿಯನ್":"uk","ರಷಿಯನ್":"ru","ರೊಮೇನಿಯನ್":"ro","ಲಿಥುವೇನಿಯನ್":"lt","ಲ್ಯಾಟಿನ್":"la","ಲ್ಯಾಟ್ವಿಯನ್‌":"lv","ವಿಯೆಟ್ನಾಮಿ":"vi","ವೆಲ್ಶ್":"cy","ಸರ್ಬಿಯನ್":"sr","ಸ್ಕಾಟ್ಸ್ ಗ್ಯಾಲಿಕ್":"gd","ಸ್ಪ್ಯಾನಿಷ್":"es","ಸ್ಲೊವಾಕ್":"sk","ಸ್ಲೊವೆನಿಯನ್":"sl","ಸ್ವೀಡಿಷ್":"sv","ಹಂಗೇರಿಯನ್":"hu","ಹಯಥಿಯನ್‌ ಕ್ರಿಯೋಲ್‌":"ht","ಹಿಂದಿ":"hi","ಹೀಬ್ರೂ":"he","arabia":"ar","burma":"my","englanti":"en","espanja":"es","haitinkreoli":"ht","heprea":"he","hollanti":"nl","islanti":"is","japani":"ja","kiina (perinteinen)":"zh-tw","kiina (yksinkertaistettu)":"zh-cn","kreikka":"el","kroatia":"hr","kurdi (soranî)":"ckb","kymri":"cy","liettua":"lt","malaiji":"ms","norja":"nb","persia":"fa","puola":"pl","ranska":"fr","ruotsi":"sv","skottigaeli":"gd","suomi":"fi","tanska":"da","tsekki":"cs","turkki":"tr","unkari":"hu","uzbekki":"uz","valkovenäjä":"be","venäjä":"ru","viro":"et","abhazca":"ab","almanca":"de","arapça":"ar","arnavutça":"sq","azerbaycan dili":"az","baskça":"eu","belarusça":"be","bulgarca":"bg","burmaca":"my","çekçe":"cs","çince (basitleştirilmiş)":"zh-cn","çince (geleneksel)":"zh-tw","danca":"da","endonezce":"id","ermenice":"hy","estonyaca":"et","farsça":"fa","felemenkçe":"nl","fince":"fi","fransızca":"fr","galce":"cy","galiçyaca":"gl","habeşçe":"am","haiti kreyolu":"ht","hırvatça":"hr","hintçe":"hi","i̇branice":"he","i̇ngilizce":"en","i̇rlandaca":"ga","i̇skoç gaelcesi":"gd","i̇spanyolca":"es","i̇sveççe":"sv","i̇talyanca":"it","i̇zlandaca":"is","japonca":"ja","kannada dili":"kn","katalanca":"ca","korece":"ko","kürtçe (kurmançça)":"ku","kürtçe (sorani)":"ckb","latince":"la","lehçe":"pl","letonca":"lv","litvanca":"lt","macarca":"hu","makedonca":"mk","malayalam dili":"ml","malayca":"ms","maltaca":"mt","maori dili":"mi","moğolca":"mn","norveççe":"nb","özbekçe":"uz","portekizce":"pt","romence":"ro","rusça":"ru","sırpça":"sr","slovakça":"sk","slovence":"sl","tayca":"th","telugu dili":"te","türkçe":"tr","ukraynaca":"uk","vietnamca":"vi","yunanca":"el","abhază":"ab","albaneză":"sq","amharică":"am","arabă":"ar","armeană":"hy","azerbaidjană":"az","bască":"eu","bielorusă":"be","birmană":"my","bulgară":"bg","catalană":"ca","cehă":"cs","chineză (simplificată)":"zh-cn","chineză (tradițională)":"zh-tw","coreeană":"ko","creolă haitiană":"ht","croată":"hr","daneză":"da","ebraică":"he","engleză":"en","estonă":"et","finlandeză":"fi","franceză":"fr","galeză":"cy","galica scoțiană":"gd","galiciană":"gl","germană":"de","greacă":"el","indoneziană":"id","irlandeză":"ga","islandeză":"is","italiană":"it","japoneză":"ja","kurdă (kurmanji)":"ku","kurdă (sorani)":"ckb","latină":"la","letonă":"lv","lituaniană":"lt","macedoneană":"mk","maghiară":"hu","malaeză":"ms","malteză":"mt","mongolă":"mn","neerlandeză":"nl","norvegiană":"nb","persană":"fa","poloneză":"pl","portugheză":"pt","română":"ro","rusă":"ru","sârbă":"sr","slovacă":"sk","slovenă":"sl","spaniolă":"es","suedeză":"sv","thailandeză":"th","turcă":"tr","ucraineană":"uk","uzbecă":"uz","vietnameză":"vi","ကနာဒါ":"kn","ကိုရီးယား":"ko","ကက်တလန်":"ca","ကဒ် (ကာမန်ဂျီ)":"ku","ကဒ် (ဆိုရာနီ)":"ckb","ခရိုအေးရှား":"hr","ချက်":"cs","ဂရိ":"el","ဂယ်လိရှ":"gl","ဂျပန်":"ja","ဂျာမန်":"de","စကော့ ဂေးလစ်":"gd","စပိန်":"es","ဆလိုဗေးနီးယား":"sl","ဆလိုဗက်":"sk","ဆားဘီးယား":"sr","ဆွီဒင်":"sv","ဇူးလူး":"zu","တရုတ် (ရိုးရာ)":"zh-tw","တရုတ် (ရိုးရှင်း)":"zh-cn","တူ​ရ​ကီ":"tr","တယ်လူဂူ":"te","ထိုင်း":"th","ဒတ်ချ်":"nl","ဒိန်းမတ်":"da","နော်ဝေး":"nb","ပါရှန်":"fa","ပေါ်တူဂီ":"pt","ပိုလန်":"pl","ပြင်သစ်":"fr","ဖင်လန်":"fi","ဗီယက်နမ်":"vi","ဘီလာရစ်":"be","ဘူဂေးရီးယား":"bg","ဘာစ်ခ်":"eu","မလေယာလမ်":"ml","မလေး":"ms","မာရာသီ":"mr","မော်ရီ":"mi","မော်လတာ":"mt","မက်ဆီဒိုးနီးယား":"mk","မြန်မာ":"my","မွန်ဂိုလီးယား":"mn","ယူ​က​ရိန်း​":"uk","ရုရှား":"ru","ရိုမေးနီးယား":"ro","လက်တင်":"la","လစ်သူဝေးနီးယား":"lt","လတ်ဗီယာ":"lv","ဝေလ":"cy","ဟီဘရူး":"he","ဟေတီ ခရီအိုး":"ht","ဟန်ဂေရီ":"hu","ဟိန္ဒီ":"hi","အဇာဘိုင်ဂျန်":"az","အာမေးနီးယား":"hy","အာရေဗျ":"ar","အီတလီ":"it","ဥဇဘက်":"uz","အက်စတိုးနီးယား":"et","အက်ဘခါ့ဇ်":"ab","အက်စ်ပဲရန်တို":"eo","အိုက်စလန်":"is","အင်္ဂလိပ်":"en","အင်ဒိုနီးရှား":"id","အိုင်းရစ်ရှ်":"ga","အမ်ဟဲရစ်ခ်":"am","အယ်လ်ဘေးနီးယား":"sq","阿布哈兹语":"ab","阿尔巴尼亚语":"sq","阿拉伯语":"ar","阿姆哈拉语":"am","阿塞拜疆语":"az","爱尔兰语":"ga","爱沙尼亚语":"et","巴斯克语":"eu","白俄罗斯语":"be","保加利亚语":"bg","冰岛语":"is","波兰语":"pl","波斯语":"fa","丹麦语":"da","德语":"de","俄语":"ru","法语":"fr","芬兰语":"fi","海地克里奥尔语":"ht","韩语":"ko","荷兰语":"nl","加利西亚语":"gl","加泰罗尼亚语":"ca","捷克语":"cs","卡纳达语":"kn","克罗地亚语":"hr","库尔德语（库尔曼吉语）":"ku","库尔德语（索拉尼）":"ckb","拉丁语":"la","拉脱维亚语":"lv","立陶宛语":"lt","罗马尼亚语":"ro","马耳他语":"mt","马拉地语":"mr","马拉雅拉姆语":"ml","马来语":"ms","马其顿语":"mk","毛利语":"mi","蒙古语":"mn","缅甸语":"my","挪威语":"nb","葡萄牙语":"pt","日语":"ja","瑞典语":"sv","塞尔维亚语":"sr","世界语":"eo","斯洛伐克语":"sk","斯洛文尼亚语":"sl","苏格兰盖尔语":"gd","泰卢固语":"te","泰语":"th","土耳其语":"tr","威尔士语":"cy","乌克兰语":"uk","乌兹别克语":"uz","西班牙语":"es","希伯来语":"he","希腊语":"el","匈牙利语":"hu","亚美尼亚语":"hy","意大利语":"it","印地语":"hi","印尼语":"id","英语":"en","越南语":"vi","中文（繁体）":"zh-tw","中文（简体）":"zh-cn","祖鲁语":"zu","갈리시아어":"gl","그리스어":"el","네덜란드어":"nl","노르웨이어":"nb","덴마크어":"da","독일어":"de","라트비아어":"lv","라틴어":"la","러시아어":"ru","루마니아어":"ro","리투아니아어":"lt","마라티어":"mr","마오리어":"mi","마케도니아어":"mk","말라얄람어":"ml","말레이어":"ms","몰타어":"mt","몽골어":"mn","미얀마어(버마어)":"my","바스크어":"eu","베트남어":"vi","벨라루스어":"be","불가리아어":"bg","세르비아어":"sr","스웨덴어":"sv","스코틀랜드 게일어":"gd","스페인어":"es","슬로바키아어":"sk","슬로베니아어":"sl","아랍어":"ar","아르메니아어":"hy","아이슬란드어":"is","아이티 크리올어":"ht","아일랜드어":"ga","아제르바이잔어":"az","알바니아어":"sq","암하라어":"am","압하지야어":"ab","에스토니아어":"et","에스페란토어":"eo","영어":"en","우즈베크어":"uz","우크라이나어":"uk","웨일즈어":"cy","이탈리아어":"it","인도네시아어":"id","일본어":"ja","줄루어":"zu","중국어(간체)":"zh-cn","중국어(번체)":"zh-tw","체코어":"cs","카탈로니아어":"ca","칸나다어":"kn","쿠르드어(소라니)":"ckb","쿠르드어(쿠르만지)":"ku","크로아티아어":"hr","태국어":"th","터키어":"tr","텔루구어":"te","페르시아어":"fa","포르투갈어":"pt","폴란드어":"pl","프랑스어":"fr","핀란드어":"fi","한국어":"ko","헝가리어":"hu","히브리어":"he","힌디어":"hi","abchasisch":"ab","albanisch":"sq","armenisch":"hy","aserbaidschanisch":"az","birmanisch":"my","bulgarisch":"bg","chinesisch (traditionell)":"zh-tw","chinesisch (vereinfacht)":"zh-cn","dänisch":"da","deutsch":"de","englisch":"en","estnisch":"et","finnisch":"fi","französisch":"fr","galizisch":"gl","griechisch":"el","haitianisch":"ht","hebräisch":"he","irisch":"ga","isländisch":"is","italienisch":"it","japanisch":"ja","katalanisch":"ca","koreanisch":"ko","kurdisch (kurmandschi)":"ku","kurdisch (sorani)":"ckb","latein":"la","lettisch":"lv","litauisch":"lt","malaysisch":"ms","maltesisch":"mt","mazedonisch":"mk","mongolisch":"mn","niederländisch":"nl","norwegisch":"nb","persisch":"fa","polnisch":"pl","portugiesisch":"pt","rumänisch":"ro","schottisch-gälisch":"gd","schwedisch":"sv","serbisch":"sr","slowakisch":"sk","slowenisch":"sl","spanisch":"es","thailändisch":"th","tschechisch":"cs","türkisch":"tr","ukrainisch":"uk","ungarisch":"hu","usbekisch":"uz","vietnamesisch":"vi","walisisch":"cy","abcházština":"ab","albánština":"sq","amharština":"am","angličtina":"en","arabština":"ar","arménština":"hy","ázerbájdžánština":"az","barmština":"my","baskičtina":"eu","běloruština":"be","bulharština":"bg","čeština":"cs","čínština (tradiční)":"zh-tw","čínština (zjednodušená)":"zh-cn","dánština":"da","estonština":"et","finština":"fi","francouzština":"fr","galicijština":"gl","haitská kreolština":"ht","hebrejština":"he","hindština":"hi","holandština":"nl","chorvatština":"hr","indonéština":"id","irština":"ga","islandština":"is","italština":"it","japonština":"ja","kannadština":"kn","katalánština":"ca","korejština":"ko","kurdština":"ku","kurdština (sorání)":"ckb","litevština":"lt","lotyština":"lv","maďarština":"hu","makedonština":"mk","malajálamština":"ml","malajština":"ms","maltština":"mt","maorština":"mi","marátština":"mr","mongolština":"mn","němčina":"de","norština":"nb","perština":"fa","polština":"pl","portugalština":"pt","rumunština":"ro","ruština":"ru","řečtina":"el","skotská gaelština":"gd","slovenština":"sk","slovinština":"sl","srbština":"sr","španělština":"es","švédština":"sv","telužština":"te","thajština":"th","turečtina":"tr","ukrajinština":"uk","uzbečtina":"uz","velština":"cy","vietnamština":"vi","אבחזית":"ab","אוזבקית":"uz","אוקראינית":"uk","אזרית":"az","איטלקית":"it","אינדונזית":"id","איסלנדית":"is","אירית":"ga","אלבנית":"sq","אמהרית":"am","אנגלית":"en","אסטונית":"et","אספרנטו":"eo","ארמנית":"hy","באסקית":"eu","בולגרית":"bg","בורמזית":"my","בלארוסית":"be","גאלית סקוטית":"gd","גליציאנית":"gl","גרמנית":"de","דנית":"da","הולנדית":"nl","הונגרית":"hu","הינדי":"hi","וולשית":"cy","וייטנאמית":"vi","זולו":"zu","טורקית":"tr","טלוגו":"te","יוונית":"el","יפנית":"ja","כורדית (כורמנג\'ית)":"ku","כורדית (סורנית)":"ckb","לטבית":"lv","לטינית":"la","ליטאית":"lt","מאורית":"mi","מונגולית":"mn","מלאית":"ms","מלטית":"mt","מליאלאם":"ml","מקדונית":"mk","מראטהית":"mr","נורווגית":"nb","סינית (מסורתית)":"zh-tw","‏סינית (פשוטה)":"zh-cn","סלובנית":"sl","סלובקית":"sk","ספרדית":"es","סרבית":"sr","עברית":"he","ערבית":"ar","פולנית":"pl","פורטוגזית":"pt","פינית":"fi","פרסית":"fa","צ\'כית":"cs","צרפתית":"fr","קאנאדה":"kn","קוריאנית":"ko","קטלאנית":"ca","קרואטית":"hr","קריאולית האיטית":"ht","רומנית":"ro","רוסית":"ru","שוודית":"sv","תאית":"th","abcaseg":"ab","albaneg":"sq","almaeneg":"de","amhareg":"am","arabeg":"ar","armeneg":"hy","aserbaijaneg":"az","basgeg":"eu","belarwseg":"be","bwlgareg":"bg","catalaneg":"ca","creol haiti":"ht","croateg":"hr","cwrdeg (kurmandji)":"ku","cwrdeg (sorani)":"ckb","cymraeg":"cy","daneg":"da","eidaleg":"it","estoneg":"et","fietnameg":"vi","ffineg":"fi","fflemeg":"nl","ffrangeg":"fr","gaeleg yr alban":"gd","galiseg":"gl","groeg":"el","gwyddeleg":"ga","hebraeg":"he","hwngareg":"hu","iaith corea":"ko","indonesieg":"id","islandeg":"is","japaneg":"ja","latfieg":"lv","lithwaneg":"lt","lladin":"la","macedoneg":"mk","malteseg":"mt","mongoleg":"mn","myanmar (byrma)":"my","norwyeg":"nb","perseg":"fa","portiwgaleg":"pt","pwyleg":"pl","rwmaneg":"ro","rwsieg":"ru","saesneg":"en","sbaeneg":"es","serbeg":"sr","slofaceg":"sk","slofeneg":"sl","swedeg":"sv","swlw":"zu","telwgw":"te","tsieceg":"cs","tsieineeg (traddodiadol)":"zh-tw","tsieineeg (wedi symleiddio)":"zh-cn","twrceg":"tr","usbec":"uz","wcreineg":"uk","abchaziska":"ab","amhariska":"am","arabiska":"ar","armeniska":"hy","azerbajdzjanska":"az","baskiska":"eu","bulgariska":"bg","burmesiska":"my","engelska":"en","estniska":"et","finska":"fi","gaeliska":"gd","galiciska":"gl","grekiska":"el","haitiska":"ht","hebreiska":"he","indonesiska":"id","irländska":"ga","isländska":"is","italienska":"it","kanaresiska":"kn","katalanska":"ca","kinesiska (förenklad)":"zh-cn","kinesiska (traditionell)":"zh-tw","koreanska":"ko","kroatiska":"hr","kurdiska (kurmanji)":"ku","kurdiska (sorani)":"ckb","lettiska":"lv","litauiska":"lt","makedonska":"mk","malaysiska":"ms","maltesiska":"mt","mongoliska":"mn","nederländska":"nl","persiska":"fa","polska":"pl","portugisiska":"pt","rumänska":"ro","ryska":"ru","serbiska":"sr","slovakiska":"sk","slovenska":"sl","spanska":"es","svenska":"sv","thailändska":"th","tjeckiska":"cs","turkiska":"tr","tyska":"de","ukrainska":"uk","ungerska":"hu","uzbekiska":"uz","vietnamesiska":"vi","vitryska":"be","walesiska":"cy","abcáisis":"ab","airméinis":"hy","albáinis":"sq","amáiris":"am","araibis":"ar","asarbaiseáinis":"az","bascais":"eu","bealarúisis":"be","béarla":"en","breatnais":"cy","bulgáiris":"bg","cannadais":"kn","catalóinis":"ca","coirdis (curmainsis)":"ku","coirdis (sóráinis)":"ckb","cóiréis":"ko","criól háítí":"ht","cróitis":"hr","eabhrais":"he","eastóinis":"et","fionlainnis":"fi","fraincis":"fr","gaeilge na halban":"gd","gailísis":"gl","gearmáinis":"de","gréigis":"el","hiondúis":"hi","indinéisis":"id","iodáilis":"it","ioruais":"nb","íoslainnis":"is","laidin":"la","laitvis":"lv","liotuáinis":"lt","macadóinis":"mk","maenmar (burmais)":"my","mailéalaimis":"ml","malaeis":"ms","máltais":"mt","maorais":"mi","maraitis":"mr","mongóilis":"mn","ollainnis":"nl","polainnis":"pl","portaingéilis":"pt","rómáinis":"ro","rúisis":"ru","seapáinis":"ja","seicis":"cs","seirbis":"sr","sínis (simplithe)":"zh-cn","sínis (traidisiúnta)":"zh-tw","slóivéinis":"sl","slóvaicis":"sk","spáinnis":"es","sualainnis":"sv","súlúis":"zu","téalainnis":"th","teileagúis":"te","tuircis":"tr","úcráinis":"uk","úisbéiceastáinis":"uz","ungáiris":"hu","vítneaimis":"vi","アイスランド語":"is","アイルランド語":"ga","アゼルバイジャン語":"az","アブハズ語":"ab","アムハラ語":"am","アラビア語":"ar","アルバニア語":"sq","アルメニア語":"hy","イタリア語":"it","インドネシア語":"id","ウェールズ語":"cy","ウクライナ語":"uk","ウズベク語":"uz","エストニア語":"et","エスペラント語":"eo","オランダ語":"nl","カタルーニャ語":"ca","ガリシア語":"gl","カンナダ語":"kn","ギリシャ語":"el","クルド語（クルマンジー）":"ku","クルド語（ソラニー）":"ckb","クロアチア語":"hr","スウェーデン語":"sv","ズールー語":"zu","スコットランド ゲール語":"gd","スペイン語":"es","スロバキア語":"sk","スロベニア語":"sl","セルビア語":"sr","タイ語":"th","チェコ語":"cs","テルグ語":"te","デンマーク語":"da","ドイツ語":"de","トルコ語":"tr","ノルウェー語":"nb","ハイチ語":"ht","バスク語":"eu","ハンガリー語":"hu","ヒンディー語":"hi","フィンランド語":"fi","フランス語":"fr","ブルガリア語":"bg","ベトナム語":"vi","ヘブライ語":"he","ベラルーシ語":"be","ペルシャ語":"fa","ポーランド語":"pl","ポルトガル語":"pt","マオリ語":"mi","マケドニア語":"mk","マラーティー語":"mr","マラヤーラム語":"ml","マルタ語":"mt","マレー語":"ms","ミャンマー語（ビルマ語）":"my","モンゴル語":"mn","ラテン語":"la","ラトビア語":"lv","リトアニア語":"lt","ルーマニア語":"ro","ロシア語":"ru","英語":"en","韓国語":"ko","中国語（簡体）":"zh-cn","中国語（繁体）":"zh-tw","日本語":"ja","albánčina":"sq","amharčina":"am","arabčina":"ar","arménčina":"hy","azerbajdžančina":"az","barmčina":"my","bieloruština":"be","bulharčina":"bg","čínština (tradičná)":"zh-tw","dánčina":"da","estónčina":"et","fínčina":"fi","francúzština":"fr","galícijčina":"gl","gréčtina":"el","haitská kreolčina":"ht","hebrejčina":"he","hindčina":"hi","holandčina":"nl","chorvátčina":"hr","indonézština":"id","írčina":"ga","islandčina":"is","japončina":"ja","kannadčina":"kn","katalánčina":"ca","kórejčina":"ko","kurdčina (kurmándží)":"ku","kurdčina (sorání)":"ckb","latinčina":"la","litovčina":"lt","macedónčina":"mk","maďarčina":"hu","malajámčina":"ml","malajčina":"ms","maltčina":"mt","maorijčina":"mi","maratčina":"mr","mongolčina":"mn","nemčina":"de","nórčina":"nb","perzština":"fa","poľština":"pl","portugalčina":"pt","rumunčina":"ro","slovenčina":"sk","slovinčina":"sl","srbčina":"sr","škótska gaelčina":"gd","španielčina":"es","švédčina":"sv","taliančina":"it","telugčina":"te","thajčina":"th","ukrajinčina":"uk","vietnamčina":"vi","waleština":"cy","zuluština":"zu","galicisk":"gl","græsk":"el","haitisk kreolsk":"ht","hviderussisk":"be","kinesisk (traditionelt)":"zh-tw","lettisk":"lv","malajisk":"ms","persisk":"fa","rumænsk":"ro","thailandsk":"th","tjekkisk":"cs","అజర్‌బైజాని":"az","అబ్‌ఖాజ్":"ab","అర్మేనియన్":"hy","అల్బేనియన్":"sq","ఆంగ్లము":"en","ఆమ్హారిక్":"am","ఆరబిక్":"ar","ఇండొనేసియన్":"id","ఇటాలియన్":"it","ఉజ్బెక్":"uz","ఎస్పెరాంటో":"eo","ఏస్టోనియన్":"et","ఐరిష్":"ga","ఐస్ లాండిక్":"is","కన్నడ":"kn","కుర్దిష్ (కుర్మాంజి)":"ku","కుర్దిష్ (సొరని)":"ckb","కొరియన్":"ko","క్యాటలాన్":"ca","క్రొయేషియన్":"hr","గాలిసియన్":"gl","గ్రీక్":"el","చెక్":"cs","చైనీస్ (సరళమైన)":"zh-cn","చైనీస్ (సాంప్రదాయమైన)":"zh-tw","జపనీస్":"ja","జర్మన్":"de","జులు":"zu","టర్కిష్":"tr","డచ్":"nl","డానిష్":"da","తెలుగు":"te","థాయ్":"th","నార్విజియన్":"nb","పర్షియన్":"fa","పోర్చుగీస్":"pt","పోలిష్":"pl","ఫిన్నిష్":"fi","ఫ్రెంచ్":"fr","బర్మీస్":"my","బల్గేరియన్":"bg","బాస్క్":"eu","బెలారష్యన్":"be","మంగోలియన్":"mn","మయోరి":"mi","మరాఠీ":"mr","మలయాళం":"ml","మాలై":"ms","మాల్టీస్":"mt","మాసిడోనియన్":"mk","యుక్రేనియన్":"uk","రష్యన్":"ru","రొమేనియన్":"ro","లాటిన్":"la","లాట్వియన్":"lv","లిథువేనియన్":"lt","వియత్నామీస్":"vi","వెల్ష్":"cy","సెర్బియన్":"sr","స్కాట్స్ గేలిక్":"gd","స్పానిష్":"es","స్లోవాక్":"sk","స్లోవేనియన్":"sl","స్వీడిష్":"sv","హంగేరియన్":"hu","హిందీ":"hi","హీబ్రూ":"he","హైయేటియన్ క్రియోల్":"ht","അബ്ഖാസ്":"ab","അമാറിക്":"am","അർമേനിയൻ":"hy","അൽബേനിയൻ":"sq","അസർബൈജാനി":"az","അറബിക്":"ar","ഇന്തോനേഷ്യൻ":"id","ഇംഗ്ലീഷ്":"en","ഇറ്റാലിയൻ":"it","ഉക്രേനിയൻ":"uk","ഉസ്ബെക്ക്":"uz","എസ്‌പെരന്തോ":"eo","എസ്റ്റോണിയൻ":"et","ഐസ്‌ലാൻഡിക്":"is","ഐറിഷ്":"ga","കന്നട":"kn","കാറ്റലൻ":"ca","കുർദ്ദിഷ് (കുർമാൻജി)":"ku","കുർദ്ദിഷ് (സൊറാനി)":"ckb","കൊറിയൻ":"ko","ക്രൊയേഷ്യൻ":"hr","ഗലീഷ്യൻ":"gl","ഗ്രീക്ക്":"el","ചെക്ക്":"cs","ചൈനീസ് (പരമ്പരാഗതം)":"zh-tw","ചൈനീസ് (ലഘൂകരിച്ചത്)":"zh-cn","ജർമ്മൻ":"de","ജാപ്പനീസ്‌":"ja","ടർക്കിഷ്":"tr","ഡച്ച്":"nl","ഡാനിഷ്":"da","തായ്":"th","തെലുങ്ക്":"te","നോർവീജിയൻ":"nb","പേർഷ്യൻ":"fa","പോർച്ചുഗീസ്":"pt","പോളിഷ്":"pl","ഫിന്നിഷ്":"fi","ഫ്രെഞ്ച്":"fr","ബർമീസ്":"my","ബൾഗേറിയൻ":"bg","ബാസ്ക്":"eu","ബെലാറുഷ്യൻ":"be","മംഗോളിയൻ":"mn","മലയാളം":"ml","മലയ്":"ms","മറാഠി":"mr","മാസഡോണിയൻ":"mk","മാൾട്ടീസ്":"mt","മൗറി":"mi","ലാറ്റിൻ":"la","ലാറ്റ്‌വിയൻ":"lv","ലിത്വേനിയൻ":"lt","വിയറ്റ്നാമീസ്":"vi","വെൽഷ്":"cy","സുളു":"zu","സെർബിയൻ":"sr","സ്കോട്ട്സ് ഗ്യാലിക്":"gd","സ്പാനിഷ്":"es","സ്ലോവാക്":"sk","സ്ലോവേനിയൻ":"sl","സ്വീഡിഷ്":"sv","ഹംഗേറിയൻ":"hu","ഹിന്ദി":"hi","ഹീബ്രു":"he","ഹെയ്തിയൻ ക്രയോൾ":"ht","റഷ്യൻ":"ru","റൊമേനിയൻ":"ro","abhaščina":"ab","albanščina":"sq","amharščina":"am","angleščina":"en","arabščina":"ar","armenščina":"hy","azerbajdžanščina":"az","baskovščina":"eu","beloruščina":"be","bolgarščina":"bg","burmanščina":"my","češčina":"cs","danščina":"da","estonščina":"et","finščina":"fi","francoščina":"fr","galicijščina":"gl","grščina":"el","haitijska kreolščina":"ht","hebrejščina":"he","hindijščina":"hi","hrvaščina":"hr","indonezijščina":"id","irščina":"ga","islandščina":"is","italijanščina":"it","japonščina":"ja","kanareščina":"kn","katalonščina":"ca","kitajščina (poenostavljena)":"zh-cn","kitajščina (tradicionalna)":"zh-tw","korejščina":"ko","kurdščina (kurmandži)":"ku","kurdščina (soranščina)":"ckb","latinščina":"la","latvijščina":"lv","litovščina":"lt","madžarščina":"hu","makedonščina":"mk","malajalščina":"ml","malajščina":"ms","malteščina":"mt","maorščina":"mi","maratščina":"mr","mongolščina":"mn","nemščina":"de","nizozemščina":"nl","norveščina":"nb","perzijščina":"fa","poljščina":"pl","portugalščina":"pt","romunščina":"ro","ruščina":"ru","slovaščina":"sk","slovenščina":"sl","srbščina":"sr","škotska gelščina":"gd","španščina":"es","švedščina":"sv","tajščina":"th","teluščina":"te","turščina":"tr","ukrajinščina":"uk","uzbeščina":"uz","valižanščina":"cy","vietnamščina":"vi","zulujščina":"zu","абхаски":"ab","баскијски":"eu","бурмански":"my","вијетнамски":"vi","галски":"gl","енглески":"en","индонежански":"id","јапански":"ja","јерменски":"hy","кинески (поједностављени)":"zh-cn","кинески (традиционални)":"zh-tw","курдски (курмањи)":"ku","летонски":"lv","мађарски":"hu","малајалам":"ml","марати":"mr","немачки":"de","персијски":"fa","пољски":"pl","румунски":"ro","словеначки":"sl","тајски":"th","украјински":"uk","хаићански креолски":"ht"," دانماركی":"da","almanî":"de","ambarîkî":"am","arnawudî":"sq","azerbaycanî":"az","baskî":"eu","belarûsî":"be","bûlgarî":"bg","çînî (hêsankirî)":"zh-cn","çînî (kevneşopî)":"zh-tw","endonezyayî":"id","erebî":"ar","esperantoyî":"eo","estonî":"et","farsî":"fa","fînlandî":"fi","fransî":"fr","gaêlîkî sikotlandî":"gd","galîsî":"gl","hirwatî":"hr","holendî":"nl","hûngarî (macarî)":"hu","îbranî":"he","îngilîzî":"en","îrlandî":"ga","îspanyolî":"es","îzlandî":"is","japonî":"ja","kannadayî":"kn","katalanî":"ca","koreyî":"ko","kreolê haîtî":"ht","kurdî (kurmancî)":"ku","kurdî (soranî)":"ckb","latînî":"la","letonî":"lv","lîtvanî":"lt","makedonî":"mk","malayalamî":"ml","malayî":"ms","maltayî":"mt","maorîyî":"mi","maratî":"mr","moxolî":"mn","myanmarî (burmese)":"my","norwêcî":"nb","ozbekî":"uz","polandî (lehîstanî)":"pl","portekîzî":"pt","romanî":"ro","rûsî":"ru","sirbî":"sr","slovakî":"sk","slovenyayî":"sl","swêdî":"sv","tayî":"th","teleguyî":"te","tirkî":"tr","vîetnamî":"vi","welşî":"cy","yûnanî":"el","zûlûyî":"zu","ئه رمه نی":"hy","ئۆکرانی":"uk","ئیتالی":"it","چه‌كی":"cs","هیندی":"hi","абхаз":"ab","азербайжан":"az","албани":"sq","амхарик":"am","англи":"en","араб":"ar","армени":"hy","баск":"eu","беларусь":"be","бирм":"my","болгар":"bg","вьетнам":"vi","галик":"gl","гаэл":"gd","герман":"de","голланд":"nl","грек":"el","дани":"da","индонез":"id","ирланд":"ga","исланд":"is","испани":"es","итали":"it","каталан":"ca","кипр":"he","курд (курманжи)":"ku","курд (сорани)":"ckb","латви":"lv","латин":"la","литва":"lt","македон":"mk","малай":"ms","малайлам":"ml","малти":"mt","маори":"mi","монгол":"mn","норвег":"nb","орос":"ru","перс":"fa","польш":"pl","португаль":"pt","румын":"ro","серби":"sr","словак":"sk","словени":"sl","солонгос":"ko","тай":"th","турк":"tr","тэлүгү":"te","узбек":"uz","украин":"uk","унгар":"hu","уэльс":"cy","финланд":"fi","франц":"fr","хаитийн креол":"ht","хорват":"hr","хятад (уламжлалт)":"zh-tw","хятад (хялбаршуулсан)":"zh-cn","чех":"cs","швед":"sv","эсперанто":"eo","эстони":"et","япон":"ja","абхазский":"ab","азербайджанский":"az","албанский":"sq","амхарский":"am","английский":"en","арабский":"ar","армянский":"hy","баскский":"eu","белорусский":"be","бирманский":"my","болгарский":"bg","валлийский":"cy","венгерский":"hu","вьетнамский":"vi","гаитянский креольский":"ht","галисийский":"gl","греческий":"el","датский":"da","индонезийский":"id","ирландский":"ga","исландский":"is","испанский":"es","итальянский":"it","каталанский":"ca","китайский (традиционный)":"zh-tw","китайский (упрощенный)":"zh-cn","корейский":"ko","курдский (курманджи)":"ku","курдский (сорани)":"ckb","латинский":"la","латышский":"lv","литовский":"lt","македонский":"mk","малайский":"ms","мальтийский":"mt","монгольский":"mn","немецкий":"de","нидерландский":"nl","норвежский":"nb","польский":"pl","португальский":"pt","румынский":"ro","русский":"ru","сербский":"sr","словацкий":"sk","словенский":"sl","тайский":"th","турецкий":"tr","узбекский":"uz","украинский":"uk","фарси":"fa","финский":"fi","французский":"fr","хорватский":"hr","чешский":"cs","шведский":"sv","шотландский (гэльский)":"gd","эстонский":"et","японский":"ja","にほんご":"ja"},"scratchToGoogleMap":{"zh-cn":"zh","nb":"no","he":"iw","es-419":"es","pt-br":"pt","ja-hira":"ja"},"previouslySupported":["ab","ms","be","eo","hy","hi","kn","ht","ku","la","mk","ml","mt","mr","mn","my","nn","sq","te","uz"]}')},function(e,t,n){"use strict";n.r(t),n.d(t,"_parse",(function(){return r})),n.d(t,"parse",(function(){return i})),n.d(t,"stringify",(function(){return s}));const r=e=>{let t=0;const n=n=>{const{line:r,column:i}=(()=>{let n=0,r=0;for(let i=0;i<t;i++)"\n"===e[i]?(n++,r=0):r++;return{line:n+1,column:r+1}})();throw new SyntaxError(`${n} (Line ${r} Column ${i})`)},r=t=>(t>=e.length&&n("Unexpected end of input"),e[t]),i=()=>r(t),s=()=>{t++},o=e=>{i()!==e&&n(`Expected '${e}' but found '${i()}'`),s()},a=(n=1,i=1)=>{if(t+i+n>e.length)return"";if(1===n)return r(t+i);let s="";for(let e=0;e<n;e++)s+=r(t+i+e);return s},c=()=>{for(;;)if(/\s/.test(i()))s();else{const e=a(2,0);if("//"===e)for(s(),s();"\n"!==i();)s();else{if("/*"!==e)break;for(s(),s();"*/"!==a(2,0);)s();s(),s()}}},l=()=>{c();switch(i()){case'"':return d();case"{":return f();case"[":return p();case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":return h();default:return u()}},u=()=>{if("null"===a(4,0)){for(let e=0;e<4;e++)s();return null}if("true"===a(4,0)){for(let e=0;e<4;e++)s();return!0}if("false"===a(5,0)){for(let e=0;e<5;e++)s();return!1}if("Infinity"===a(8,0)){for(let e=0;e<8;e++)s();return 1/0}if("NaN"===a(3,0)){for(let e=0;e<3;e++)s();return NaN}n(`Unexpected character '${i()}'`)},h=()=>{if("-Infinity"===a(9,0)){for(let e=0;e<9;e++)s();return-1/0}let e="";for(;e+=i(),/[\d.e+-]/i.test(a());)s();s();const t=+e;return Number.isNaN(t)&&n(`Not a number: ${e}`),t},d=()=>{o('"');let e="";for(;;){const t=i();if('"'===t)break;if("\\"===t)switch(s(),i()){case'"':e+='"';break;case"/":e+="/";break;case"\\":e+="\\";break;case"b":e+="\b";break;case"f":e+="\f";break;case"n":e+="\n";break;case"r":e+="\r";break;case"t":e+="\t";break;case"u":{let t="";for(let e=0;e<4;e++){s();const e=i();/[0-9a-f]/i.test(e)||n(`Invalid hex code: ${e}`),t+=e}const r=Number.parseInt(t,16);e+=String.fromCharCode(r);break}default:n(`Invalid escape code: \\${i()}`)}else e+=t;s()}return o('"'),e},p=()=>{o("["),c();const e=[];for(;c(),"]"!==i();){const t=l();if(e.push(t),c(),","!==i())break;s()}return o("]"),e},f=()=>{o("{"),c();const e={};for(;c(),"}"!==i();){const t=d();c(),o(":");const n=l();if(e[t]=n,c(),","!==i())break;s()}return o("}"),e};return l()},i=e=>{try{return JSON.parse(e)}catch(t){try{return r(e)}catch(e){throw t}}},s=e=>{if("string"==typeof e)return JSON.stringify(e);if("number"==typeof e||"boolean"==typeof e)return e.toString();if(null==e||"symbol"==typeof e)return"null";if(Array.isArray(e))return`[${e.map((e=>s(e))).join(",")}]`;if("object"==typeof e){let t="{",n=!0;const r=Object.keys(e);for(let i=0;i<r.length;i++){const o=r[i],a=e[o];void 0!==a&&(n||(t+=","),t+=`${JSON.stringify(o)}:${s(a)}`,n=!1)}return t+="}",t}if("bigint"==typeof e)throw new TypeError("Can not stringify bigint");throw new TypeError(`Can not stringify: ${e}`)}},function(e,t,n){const r=n(64),i=n(184),s=function(e){const t=Object.create(null);t.tagName=e.name,t.children=[];for(const n in e.attribs)"xmlns"!==n&&(t[n]=i(e.attribs[n]),"blockinfo"===n&&(t.blockInfo=JSON.parse(t.blockinfo),delete t.blockinfo));for(let n=0;n<e.children.length;n++)t.children.push(s(e.children[n]));return t};e.exports=function(e){let t;return t="object"==typeof e?e:r.parseDOM(e)[0],s(t)}},function(e,t){e.exports={}},function(e,t,n){t.getCached=function(){throw new Error("blocks.js has not initialized BlocksExecuteCache")},n(17)},function(e,t,n){t.getScripts=function(){throw new Error("blocks.js has not initialized BlocksRuntimeCache")},t._RuntimeScriptCache=class{constructor(e,t){this.container=e,this.blockId=t;const n=e.getBlock(t),r=e.getFields(n);if(this.fieldsOfInputs=Object.assign({},r),0===Object.keys(r).length){const t=e.getInputs(n);for(const n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;const r=t[n].block,i=e.getBlock(r),s=e.getFields(i);Object.assign(this.fieldsOfInputs,s)}}for(const e in this.fieldsOfInputs){const t=this.fieldsOfInputs[e]=Object.assign({},this.fieldsOfInputs[e]);t.value.toUpperCase&&(t.value=t.value.toUpperCase())}}},n(17)},function(e,t,n){const r=n(0),i=n(2),s=n(190),o=n(46),a=n(192),{StackOpcode:c,InputOpcode:l,InputType:u}=n(15),h=n(45),{IntermediateStackBlock:d,IntermediateInput:p,IntermediateStack:f,IntermediateScript:m,IntermediateRepresentation:g}=n(10),b=e=>("string"!=typeof e&&(r.warn("sanitize got unexpected type: ".concat(typeof e)),e=""+e),JSON.stringify(e).slice(1,-1)),y="runtime.ext_pen",E="".concat(y,"._getPenState(target)"),T=new s("factory"),v=new s("fun"),A=new s("gen"),w=(e,t)=>e.opcode===l.CONSTANT&&(!(!e.isAlwaysType(u.NUMBER)&&!e.isAlwaysType(u.STRING_NUM))&&(!t.isSometimesType(u.NUMBER_NAN|u.STRING_NAN|u.BOOLEAN_INTERPRETABLE)||0!=+e.inputs.value));class S{constructor(e){this.isLoop=e,this.isLastBlock=!1}}class k{constructor(e,t,n){this.script=e,this.ir=t,this.target=n,this.source="",this.isWarp=e.isWarp,this.isProcedure=e.isProcedure,this.warpTimer=e.warpTimer,this.frames=[],this.currentFrame=null,this.localVariables=new s("a"),this._setupVariablesPool=new s("b"),this._setupVariables={},this.descendedIntoModulo=!1,this.isInHat=!1,this.debug=this.target.runtime.debug,this.oldCompilerStub=new h.JSGeneratorStub(this)}pushFrame(e){this.frames.push(e),this.currentFrame=e}popFrame(){this.frames.pop(),this.currentFrame=this.frames[this.frames.length-1]}isLastBlockInLoop(){for(let e=this.frames.length-1;e>=0;e--){const t=this.frames[e];if(!t.isLastBlock)return!1;if(t.isLoop)return!0}return!1}descendInput(e){const t=e.inputs;switch(e.opcode){case l.NOP:return'""';case l.PROCEDURE_ARGUMENT:return"p".concat(t.index);case l.ADDON_CALL:return"(".concat(this.descendAddonCall(t),")");case l.CAST_BOOLEAN:return"toBoolean(".concat(this.descendInput(t.target),")");case l.CAST_NUMBER:return t.target.isAlwaysType(u.BOOLEAN_INTERPRETABLE)?"(+".concat(this.descendInput(t.target.toType(u.BOOLEAN)),")"):t.target.isAlwaysType(u.NUMBER_OR_NAN)?"toNotNaN(".concat(this.descendInput(t.target),")"):"toNotNaN(+".concat(this.descendInput(t.target),")");case l.CAST_NUMBER_OR_NAN:return"(+".concat(this.descendInput(t.target),")");case l.CAST_NUMBER_INDEX:return"(".concat(this.descendInput(t.target.toType(u.NUMBER_OR_NAN))," | 0)");case l.CAST_STRING:return'("" + '.concat(this.descendInput(t.target),")");case l.CAST_COLOR:return"colorToList(".concat(this.descendInput(t.target),")");case l.COMPATIBILITY_LAYER:return"(".concat(this.generateCompatibilityLayerCall(t,!1),")");case l.OLD_COMPILER_COMPATIBILITY_LAYER:return this.oldCompilerStub.descendInputFromNewCompiler(e);case l.CONSTANT:if(e.isAlwaysType(u.NUMBER)){if("number"!=typeof t.value)throw new Error("JS: '".concat(e.type,"' type constant had ").concat(typeof t.value," type value. Expected number."));return Object.is(t.value,-0)?"-0":t.value.toString()}if(e.isAlwaysType(u.BOOLEAN)){if("boolean"!=typeof t.value)throw new Error("JS: '".concat(e.type,"' type constant had ").concat(typeof t.value," type value. Expected boolean."));return t.value.toString()}if(e.isAlwaysType(u.COLOR)){if(!Array.isArray(t.value))throw new Error("JS: '".concat(e.type,"' type constant was not an array."));if(3!==t.value.length)throw new Error("JS: '".concat(e.type,"' type constant had an array of length '").concat(t.value.length,"'. Expected 3."));for(let n=0;n<3;n++)if("number"!=typeof t.value[n])throw new Error("JS: '".concat(e.type,"' type constant element ").concat(n," had a value of type '").concat(t.value[n],"'. Expected number."));return"[".concat(t.value[0],",").concat(t.value[1],",").concat(t.value[2],"]")}if(e.isSometimesType(u.STRING))return'"'.concat(b(t.value.toString()),'"');throw new Error("JS: Unknown constant input type '".concat(e.type,"'."));case l.SENSING_KEY_DOWN:return"runtime.ioDevices.keyboard.getKeyIsDown(".concat(this.descendInput(t.key),")");case l.LIST_CONTAINS:return"listContains(".concat(this.referenceVariable(t.list),", ").concat(this.descendInput(t.item),")");case l.LIST_CONTENTS:return"listContents(".concat(this.referenceVariable(t.list),")");case l.LIST_GET:if(a.supportsNullishCoalescing){if(t.index.isAlwaysType(u.NUMBER_INTERPRETABLE|u.NUMBER_NAN))return"(".concat(this.referenceVariable(t.list),".value[").concat(this.descendInput(t.index.toType(u.NUMBER_INDEX)),' - 1] ?? "")');if(t.index.isConstant("last"))return"(".concat(this.referenceVariable(t.list),".value[").concat(this.referenceVariable(t.list),'.value.length - 1] ?? "")')}return"listGet(".concat(this.referenceVariable(t.list),".value, ").concat(this.descendInput(t.index),")");case l.LIST_INDEX_OF:return"listIndexOf(".concat(this.referenceVariable(t.list),", ").concat(this.descendInput(t.item),")");case l.LIST_LENGTH:return"".concat(this.referenceVariable(t.list),".value.length");case l.LOOKS_SIZE_GET:return"Math.round(target.size)";case l.LOOKS_BACKDROP_NAME:return"stage.getCostumes()[stage.currentCostume].name";case l.LOOKS_BACKDROP_NUMBER:return"(stage.currentCostume + 1)";case l.LOOKS_COSTUME_NAME:return"target.getCostumes()[target.currentCostume].name";case l.LOOKS_COSTUME_NUMBER:return"(target.currentCostume + 1)";case l.MOTION_DIRECTION_GET:return"target.direction";case l.MOTION_X_GET:return"limitPrecision(target.x)";case l.MOTION_Y_GET:return"limitPrecision(target.y)";case l.SENSING_MOUSE_DOWN:return"runtime.ioDevices.mouse.getIsDown()";case l.SENSING_MOUSE_X:return"runtime.ioDevices.mouse.getScratchX()";case l.SENSING_MOUSE_Y:return"runtime.ioDevices.mouse.getScratchY()";case l.OP_ABS:return"Math.abs(".concat(this.descendInput(t.value),")");case l.OP_ACOS:return"((Math.acos(".concat(this.descendInput(t.value),") * 180) / Math.PI)");case l.OP_ADD:return"(".concat(this.descendInput(t.left)," + ").concat(this.descendInput(t.right),")");case l.OP_AND:return"(".concat(this.descendInput(t.left)," && ").concat(this.descendInput(t.right),")");case l.OP_ASIN:return"((Math.asin(".concat(this.descendInput(t.value),") * 180) / Math.PI)");case l.OP_ATAN:return"((Math.atan(".concat(this.descendInput(t.value),") * 180) / Math.PI)");case l.OP_CEILING:return"Math.ceil(".concat(this.descendInput(t.value),")");case l.OP_CONTAINS:return"(".concat(this.descendInput(t.string),".toLowerCase().indexOf(").concat(this.descendInput(t.contains),".toLowerCase()) !== -1)");case l.OP_COS:return"(Math.round(Math.cos((Math.PI * ".concat(this.descendInput(t.value),") / 180) * 1e10) / 1e10)");case l.OP_DIVIDE:return"(".concat(this.descendInput(t.left)," / ").concat(this.descendInput(t.right),")");case l.OP_EQUALS:{const e=t.left,n=t.right;return e.isSometimesType(u.NUMBER_INTERPRETABLE)&&n.isSometimesType(u.NUMBER_INTERPRETABLE)?e.isAlwaysType(u.NUMBER_INTERPRETABLE)&&n.isAlwaysType(u.NUMBER_INTERPRETABLE)||w(e,n)||w(n,e)?"(".concat(this.descendInput(e.toType(u.NUMBER))," === ").concat(this.descendInput(n.toType(u.NUMBER)),")"):"compareEqual(".concat(this.descendInput(e),", ").concat(this.descendInput(n),")"):"(".concat(this.descendInput(e.toType(u.STRING)),".toLowerCase() === ").concat(this.descendInput(n.toType(u.STRING)),".toLowerCase())")}case l.OP_POW_E:return"Math.exp(".concat(this.descendInput(t.value),")");case l.OP_FLOOR:return"Math.floor(".concat(this.descendInput(t.value),")");case l.OP_GREATER:{const e=t.left,n=t.right;return e.isAlwaysType(u.NUMBER_INTERPRETABLE)&&n.isAlwaysType(u.NUMBER_INTERPRETABLE|u.NUMBER_NAN)?"(".concat(this.descendInput(e.toType(u.NUMBER))," > ").concat(this.descendInput(n.toType(u.NUMBER_OR_NAN)),")"):e.isAlwaysType(u.NUMBER_INTERPRETABLE|u.NUMBER_NAN)&&n.isAlwaysType(u.NUMBER_INTERPRETABLE)?"!(".concat(this.descendInput(e.toType(u.NUMBER_OR_NAN))," <= ").concat(this.descendInput(n.toType(u.NUMBER)),")"):e.isSometimesType(u.NUMBER_INTERPRETABLE)&&n.isSometimesType(u.NUMBER_INTERPRETABLE)?"compareGreaterThan(".concat(this.descendInput(e),", ").concat(this.descendInput(n),")"):"(".concat(this.descendInput(e.toType(u.STRING)),".toLowerCase() > ").concat(this.descendInput(n.toType(u.STRING)),".toLowerCase())")}case l.OP_JOIN:return"(".concat(this.descendInput(t.left)," + ").concat(this.descendInput(t.right),")");case l.OP_LENGTH:return"".concat(this.descendInput(t.string),".length");case l.OP_LESS:{const e=t.left,n=t.right;return e.isAlwaysType(u.NUMBER_INTERPRETABLE|u.NUMBER_NAN)&&n.isAlwaysType(u.NUMBER_INTERPRETABLE)?"(".concat(this.descendInput(e.toType(u.NUMBER_OR_NAN))," < ").concat(this.descendInput(n.toType(u.NUMBER)),")"):e.isAlwaysType(u.NUMBER_INTERPRETABLE)&&n.isAlwaysType(u.NUMBER_INTERPRETABLE|u.NUMBER_NAN)?"!(".concat(this.descendInput(e.toType(u.NUMBER))," >= ").concat(this.descendInput(n.toType(u.NUMBER_OR_NAN)),")"):e.isSometimesType(u.NUMBER_INTERPRETABLE)&&n.isSometimesType(u.NUMBER_INTERPRETABLE)?"compareLessThan(".concat(this.descendInput(e),", ").concat(this.descendInput(n),")"):"(".concat(this.descendInput(e.toType(u.STRING)),".toLowerCase() < ").concat(this.descendInput(n.toType(u.STRING)),".toLowerCase())")}case l.OP_LETTER_OF:return"((".concat(this.descendInput(t.string),")[").concat(this.descendInput(t.letter),' - 1] || "")');case l.OP_LOG_E:return"Math.log(".concat(this.descendInput(t.value),")");case l.OP_LOG_10:return"(Math.log(".concat(this.descendInput(t.value),") / Math.LN10)");case l.OP_MOD:return this.descendedIntoModulo=!0,"mod(".concat(this.descendInput(t.left),", ").concat(this.descendInput(t.right),")");case l.OP_MULTIPLY:return"(".concat(this.descendInput(t.left)," * ").concat(this.descendInput(t.right),")");case l.OP_NOT:return"!".concat(this.descendInput(t.operand));case l.OP_OR:return"(".concat(this.descendInput(t.left)," || ").concat(this.descendInput(t.right),")");case l.OP_RANDOM:return t.useInts?"randomInt(".concat(this.descendInput(t.low),", ").concat(this.descendInput(t.high),")"):t.useFloats?"randomFloat(".concat(this.descendInput(t.low),", ").concat(this.descendInput(t.high),")"):"runtime.ext_scratch3_operators._random(".concat(this.descendInput(t.low),", ").concat(this.descendInput(t.high),")");case l.OP_ROUND:return"Math.round(".concat(this.descendInput(t.value),")");case l.OP_SIN:return"(Math.round(Math.sin((Math.PI * ".concat(this.descendInput(t.value),") / 180) * 1e10) / 1e10)");case l.OP_SQRT:return"Math.sqrt(".concat(this.descendInput(t.value),")");case l.OP_SUBTRACT:return"(".concat(this.descendInput(t.left)," - ").concat(this.descendInput(t.right),")");case l.OP_TAN:return"tan(".concat(this.descendInput(t.value),")");case l.OP_POW_10:return"(10 ** ".concat(this.descendInput(t.value),")");case l.PROCEDURE_CALL:{const e=t.code,n=t.variant,r=this.ir.procedures[n];if(null===r.stack)return'""';const i='thread.procedures["'.concat(b(n),'"]'),s=[];for(const e of t.arguments)s.push(this.descendInput(e));const o=s.join(","),a=!this.isWarp&&e===this.script.procedureCode,c=this.isInHat;if(a||c){const e=r.yields?"yieldThenCallGenerator":"yieldThenCall";return"(yield* ".concat(e,"(").concat(i,", ").concat(o,"))")}return r.yields?"(yield* ".concat(i,"(").concat(o,"))"):"".concat(i,"(").concat(o,")")}case l.SENSING_ANSWER:return"runtime.ext_scratch3_sensing._answer";case l.SENSING_COLOR_TOUCHING_COLOR:return"target.colorIsTouchingColor(".concat(this.descendInput(t.target),", ").concat(this.descendInput(t.mask),")");case l.SENSING_TIME_DATE:return"(new Date().getDate())";case l.SENSING_TIME_WEEKDAY:return"(new Date().getDay() + 1)";case l.SENSING_TIME_DAYS_SINCE_2000:return"daysSince2000()";case l.SENSING_DISTANCE:return"distance(".concat(this.descendInput(t.target),")");case l.SENSING_TIME_HOUR:return"(new Date().getHours())";case l.SENSING_TIME_MINUTE:return"(new Date().getMinutes())";case l.SENSING_TIME_MONTH:return"(new Date().getMonth() + 1)";case l.SENSING_OF:return"runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ".concat(this.descendInput(t.object),', PROPERTY: "').concat(b(t.property),'" })');case l.SENSING_OF_VOLUME:{const e=this.descendTargetReference(t.object);return"(".concat(e," ? ").concat(e,".volume : 0)")}case l.SENSING_OF_BACKDROP_NUMBER:return"(stage.currentCostume + 1)";case l.SENSING_OF_BACKDROP_NAME:return"stage.getCostumes()[stage.currentCostume].name";case l.SENSING_OF_POS_X:{const e=this.descendTargetReference(t.object);return"(".concat(e," ? ").concat(e,".x : 0)")}case l.SENSING_OF_POS_Y:{const e=this.descendTargetReference(t.object);return"(".concat(e," ? ").concat(e,".y : 0)")}case l.SENSING_OF_DIRECTION:{const e=this.descendTargetReference(t.object);return"(".concat(e," ? ").concat(e,".direction : 0)")}case l.SENSING_OF_COSTUME_NUMBER:{const e=this.descendTargetReference(t.object);return"(".concat(e," ? ").concat(e,".currentCostume + 1 : 0)")}case l.SENSING_OF_COSTUME_NAME:{const e=this.descendTargetReference(t.object);return"(".concat(e," ? ").concat(e,".getCostumes()[").concat(e,".currentCostume].name : 0)")}case l.SENSING_OF_SIZE:{const e=this.descendTargetReference(t.object);return"(".concat(e," ? ").concat(e,".size : 0)")}case l.SENSING_OF_VAR:{const e=this.descendTargetReference(t.object),n=this.evaluateOnce("".concat(e," && ").concat(e,'.lookupVariableByNameAndType("').concat(b(t.property),'", "", true)'));return"(".concat(n," ? ").concat(n,".value : 0)")}case l.SENSING_TIME_SECOND:return"(new Date().getSeconds())";case l.SENSING_TOUCHING_OBJECT:return"target.isTouchingObject(".concat(this.descendInput(t.object),")");case l.SENSING_TOUCHING_COLOR:return"target.isTouchingColor(".concat(this.descendInput(t.color),")");case l.SENSING_USERNAME:return"runtime.ioDevices.userData.getUsername()";case l.SENSING_TIME_YEAR:return"(new Date().getFullYear())";case l.SENSING_TIMER_GET:return"runtime.ioDevices.clock.projectTimer()";case l.CONTROL_COUNTER:return"runtime.ext_scratch3_control._counter";case l.TW_KEY_LAST_PRESSED:return"runtime.ioDevices.keyboard.getLastKeyPressed()";case l.VAR_GET:return"".concat(this.referenceVariable(t.variable),".value");default:throw r.warn("JS: Unknown input: ".concat(e.opcode),t),new Error("JS: Unknown input: ".concat(e.opcode))}}descendStackedBlock(e){const t=e.inputs;switch(e.opcode){case c.ADDON_CALL:this.source+="".concat(this.descendAddonCall(t),";\n");break;case c.COMPATIBILITY_LAYER:{const e=this.isLastBlockInLoop(),n=t.blockType;if(n===i.COMMAND||n===i.HAT)this.source+="".concat(this.generateCompatibilityLayerCall(t,e),";\n");else{if(n!==i.CONDITIONAL&&n!==i.LOOP)throw new Error("Unknown block type: ".concat(n));{const e=this.localVariables.next();this.source+="const ".concat(e," = createBranchInfo(").concat(n===i.LOOP,");\n"),this.source+="while (".concat(e,".branch = +(").concat(this.generateCompatibilityLayerCall(t,!1,e),")) {\n"),this.source+="switch (".concat(e,".branch) {\n");for(const e in t.substacks)this.source+="case ".concat(+e,": {\n"),this.descendStack(t.substacks[e],new S(!1)),this.source+="break;\n",this.source+="}\n";this.source+="}\n",this.source+="if (!".concat(e,".isLoop) break;\n"),this.yieldLoop(),this.source+="}\n"}}e&&(this.source+="if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}\n");break}case l.OLD_COMPILER_COMPATIBILITY_LAYER:return this.oldCompilerStub.descendStackedBlockFromNewCompiler(e);case c.HAT_EDGE:this.isInHat=!0,this.source+="{\n",this.source+="const resolvedValue = ".concat(this.descendInput(t.condition),";\n"),this.source+='const id = "'.concat(b(t.id),'";\n'),this.source+="const hasOldEdgeValue = target.hasEdgeActivatedValue(id);\n",this.source+="const oldEdgeValue = target.updateEdgeActivatedValue(id, resolvedValue);\n",this.source+="const edgeWasActivated = hasOldEdgeValue ? (!oldEdgeValue && resolvedValue) : resolvedValue;\n",this.source+="if (!edgeWasActivated) {\n",this.retire(),this.source+="}\n",this.source+="yield;\n",this.source+="}\n",this.isInHat=!1;break;case c.HAT_PREDICATE:this.isInHat=!0,this.source+="if (!".concat(this.descendInput(t.condition),") {\n"),this.retire(),this.source+="}\n",this.source+="yield;\n",this.isInHat=!1;break;case c.CONTROL_CLONE_CREATE:this.source+="runtime.ext_scratch3_control._createClone(".concat(this.descendInput(t.target),", target);\n");break;case c.CONTROL_CLONE_DELETE:this.source+="if (!target.isOriginal) {\n",this.source+="  runtime.disposeTarget(target);\n",this.source+="  runtime.stopForTarget(target);\n",this.retire(),this.source+="}\n";break;case c.CONTROL_FOR:{const e=this.localVariables.next();this.source+="var ".concat(e," = 0; "),this.source+="while (".concat(e," < ").concat(this.descendInput(t.count),") { "),this.source+="".concat(e,"++; "),this.source+="".concat(this.referenceVariable(t.variable),".value = ").concat(e,";\n"),this.descendStack(t.do,new S(!0)),this.yieldLoop(),this.source+="}\n";break}case c.CONTROL_IF_ELSE:this.source+="if (".concat(this.descendInput(t.condition),") {\n"),this.descendStack(t.whenTrue,new S(!1)),t.whenFalse.blocks.length&&(this.source+="} else {\n",this.descendStack(t.whenFalse,new S(!1))),this.source+="}\n";break;case c.CONTROL_REPEAT:{const e=this.localVariables.next();t.times.isAlwaysType(u.NUMBER_INT|u.NUMBER_INF)?this.source+="for (var ".concat(e," = ").concat(this.descendInput(t.times),"; ").concat(e," > 0; ").concat(e,"--) {\n"):this.source+="for (var ".concat(e," = ").concat(this.descendInput(t.times),"; ").concat(e," >= 0.5; ").concat(e,"--) {\n"),this.descendStack(t.do,new S(!0)),this.yieldLoop(),this.source+="}\n";break}case c.CONTROL_STOP_ALL:this.source+="runtime.stopAll();\n",this.retire();break;case c.CONTROL_STOP_OTHERS:this.source+="runtime.stopForTarget(target, thread);\n";break;case c.CONTROL_STOP_SCRIPT:this.stopScript();break;case c.CONTROL_WAIT:{const e=this.localVariables.next();this.source+="thread.timer = timer();\n",this.source+="var ".concat(e," = Math.max(0, 1000 * ").concat(this.descendInput(t.seconds),");\n"),this.requestRedraw(),this.yieldNotWarp(),this.source+="while (thread.timer.timeElapsed() < ".concat(e,") {\n"),this.yieldStuckOrNotWarp(),this.source+="}\n",this.source+="thread.timer = null;\n";break}case c.CONTROL_WAIT_UNTIL:this.source+="while (!".concat(this.descendInput(t.condition),") {\n"),this.yieldStuckOrNotWarp(),this.source+="}\n";break;case c.CONTROL_WHILE:this.source+="while (".concat(this.descendInput(t.condition),") {\n"),this.descendStack(t.do,new S(!0)),t.warpTimer?this.yieldStuckOrNotWarp():this.yieldLoop(),this.source+="}\n";break;case c.CONTROL_CLEAR_COUNTER:this.source+="runtime.ext_scratch3_control._counter = 0;\n";break;case c.CONTORL_INCR_COUNTER:this.source+="runtime.ext_scratch3_control._counter++;\n";break;case c.EVENT_BROADCAST:this.source+='startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: '.concat(this.descendInput(t.broadcast)," });\n");break;case c.EVENT_BROADCAST_AND_WAIT:this.source+='yield* waitThreads(startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: '.concat(this.descendInput(t.broadcast)," }));\n"),this.yielded();break;case c.LIST_ADD:{const e=this.referenceVariable(t.list);this.source+="".concat(e,".value.push(").concat(this.descendInput(t.item),");\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}case c.LIST_DELETE:{const e=this.referenceVariable(t.list);if(t.index.isConstant("last")){this.source+="".concat(e,".value.pop();\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}if(t.index.isConstant(1)){this.source+="".concat(e,".value.shift();\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}this.source+="listDelete(".concat(e,", ").concat(this.descendInput(t.index),");\n");break}case c.LIST_DELETE_ALL:this.source+="".concat(this.referenceVariable(t.list),".value = [];\n");break;case c.LIST_HIDE:this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(b(t.list.id),'", element: "checkbox", value: false }, runtime);\n');break;case c.LIST_INSERT:{const e=this.referenceVariable(t.list),n=this.descendInput(t.item);if(t.index.isConstant(1)){this.source+="".concat(e,".value.unshift(").concat(n,");\n"),this.source+="".concat(e,"._monitorUpToDate = false;\n");break}this.source+="listInsert(".concat(e,", ").concat(this.descendInput(t.index),", ").concat(n,");\n");break}case c.LIST_REPLACE:this.source+="listReplace(".concat(this.referenceVariable(t.list),", ").concat(this.descendInput(t.index),", ").concat(this.descendInput(t.item),");\n");break;case c.LIST_SHOW:this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(b(t.list.id),'", element: "checkbox", value: true }, runtime);\n');break;case c.LOOKS_LAYER_BACKWARD:this.target.isStage||(this.source+="target.goBackwardLayers(".concat(this.descendInput(t.layers),");\n"));break;case c.LOOKS_EFFECT_CLEAR:this.source+="target.clearEffects();\n";break;case c.LOOKS_EFFECT_CHANGE:Object.prototype.hasOwnProperty.call(this.target.effects,t.effect)&&(this.source+='target.setEffect("'.concat(b(t.effect),'", runtime.ext_scratch3_looks.clampEffect("').concat(b(t.effect),'", ').concat(this.descendInput(t.value),' + target.effects["').concat(b(t.effect),'"]));\n'));break;case c.LOOKS_SIZE_CHANGE:this.source+="target.setSize(target.size + ".concat(this.descendInput(t.size),");\n");break;case c.LOOKS_LAYER_FORWARD:this.target.isStage||(this.source+="target.goForwardLayers(".concat(this.descendInput(t.layers),");\n"));break;case c.LOOKS_LAYER_BACK:this.target.isStage||(this.source+="target.goToBack();\n");break;case c.LOOKS_LAYER_FRONT:this.target.isStage||(this.source+="target.goToFront();\n");break;case c.LOOKS_HIDE:this.source+="target.setVisible(false);\n",this.source+="runtime.ext_scratch3_looks._renderBubble(target);\n";break;case c.LOOKS_BACKDROP_NEXT:this.source+="runtime.ext_scratch3_looks._setBackdrop(stage, stage.currentCostume + 1, true);\n";break;case c.LOOKS_COSTUME_NEXT:this.source+="target.setCostume(target.currentCostume + 1);\n";break;case c.LOOKS_EFFECT_SET:Object.prototype.hasOwnProperty.call(this.target.effects,t.effect)&&(this.source+='target.setEffect("'.concat(b(t.effect),'", runtime.ext_scratch3_looks.clampEffect("').concat(b(t.effect),'", ').concat(this.descendInput(t.value),"));\n"));break;case c.LOOKS_SIZE_SET:this.source+="target.setSize(".concat(this.descendInput(t.size),");\n");break;case c.LOOKS_SHOW:this.source+="target.setVisible(true);\n",this.source+="runtime.ext_scratch3_looks._renderBubble(target);\n";break;case c.LOOKS_BACKDROP_SET:this.source+="runtime.ext_scratch3_looks._setBackdrop(stage, ".concat(this.descendInput(t.backdrop),");\n");break;case c.LOOKS_COSTUME_SET:this.source+="runtime.ext_scratch3_looks._setCostume(target, ".concat(this.descendInput(t.costume),");\n");break;case c.LOOKS_SAY:this.source+="runtime.ext_scratch3_looks._say(".concat(this.descendInput(t.message),", target);\n");break;case c.LOOKS_THINK:this.source+="runtime.ext_scratch3_looks._think(".concat(this.descendInput(t.message),", target);\n");break;case c.MOTION_X_CHANGE:this.source+="target.setXY(target.x + ".concat(this.descendInput(t.dx),", target.y);\n");break;case c.MOTION_Y_CHANGE:this.source+="target.setXY(target.x, target.y + ".concat(this.descendInput(t.dy),");\n");break;case c.MOTION_IF_ON_EDGE_BOUNCE:this.source+="runtime.ext_scratch3_motion._ifOnEdgeBounce(target);\n";break;case c.MOTION_DIRECTION_SET:this.source+="target.setDirection(".concat(this.descendInput(t.direction),");\n");break;case c.MOTION_ROTATION_STYLE_SET:this.source+='target.setRotationStyle("'.concat(b(t.style),'");\n');break;case c.MOTION_X_SET:case c.MOTION_Y_SET:case c.MOTION_XY_SET:{this.descendedIntoModulo=!1;const e="x"in t?this.descendInput(t.x):"target.x",n="y"in t?this.descendInput(t.y):"target.y";this.source+="target.setXY(".concat(e,", ").concat(n,");\n"),this.descendedIntoModulo&&(this.source+="if (target.interpolationData) target.interpolationData = null;\n");break}case c.MOTION_STEP:this.source+="runtime.ext_scratch3_motion._moveSteps(".concat(this.descendInput(t.steps),", target);\n");break;case c.NOP:break;case c.PEN_CLEAR:this.source+="".concat(y,".clear();\n");break;case c.PEN_DOWN:this.source+="".concat(y,"._penDown(target);\n");break;case c.PEN_COLOR_PARAM_CHANGE:this.source+="".concat(y,"._setOrChangeColorParam(").concat(this.descendInput(t.param),", ").concat(this.descendInput(t.value),", ").concat(E,", true);\n");break;case c.PEN_SIZE_CHANGE:this.source+="".concat(y,"._changePenSizeBy(").concat(this.descendInput(t.size),", target);\n");break;case c.PEN_COLOR_HUE_CHANGE_LEGACY:this.source+="".concat(y,"._changePenHueBy(").concat(this.descendInput(t.hue),", target);\n");break;case c.PEN_COLOR_SHADE_CHANGE_LEGACY:this.source+="".concat(y,"._changePenShadeBy(").concat(this.descendInput(t.shade),", target);\n");break;case c.PEN_COLOR_HUE_SET_LEGACY:this.source+="".concat(y,"._setPenHueToNumber(").concat(this.descendInput(t.hue),", target);\n");break;case c.PEN_COLOR_SHADE_SET_LEGACY:this.source+="".concat(y,"._setPenShadeToNumber(").concat(this.descendInput(t.shade),", target);\n");break;case c.PEN_COLOR_SET:this.source+="".concat(y,"._setPenColorToColor(").concat(this.descendInput(t.color),", target);\n");break;case c.PEN_COLOR_PARAM_SET:this.source+="".concat(y,"._setOrChangeColorParam(").concat(this.descendInput(t.param),", ").concat(this.descendInput(t.value),", ").concat(E,", false);\n");break;case c.PEN_SIZE_SET:this.source+="".concat(y,"._setPenSizeTo(").concat(this.descendInput(t.size),", target);\n");break;case c.PEN_STAMP:this.source+="".concat(y,"._stamp(target);\n");break;case c.PEN_UP:this.source+="".concat(y,"._penUp(target);\n");break;case c.PROCEDURE_CALL:{const e=t.code,n=t.variant,r=this.ir.procedures[n];if(null===r.stack)break;if(!this.isWarp&&e===this.script.procedureCode&&this.yieldNotWarp(),r.yields&&(this.source+="yield* ",!this.script.yields))throw new Error("Script uses yielding procedure but is not marked as yielding.");this.source+='thread.procedures["'.concat(b(n),'"](');const i=[];for(const e of t.arguments)i.push(this.descendInput(e));this.source+=i.join(","),this.source+=");\n";break}case c.PROCEDURE_RETURN:this.stopScriptAndReturn(this.descendInput(t.value));break;case c.SENSING_TIMER_RESET:this.source+="runtime.ioDevices.clock.resetProjectTimer();\n";break;case c.DEBUGGER:this.source+="debugger;\n";break;case c.VAR_HIDE:this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(b(t.variable.id),'", element: "checkbox", value: false }, runtime);\n');break;case c.VAR_SET:{const e=this.referenceVariable(t.variable);this.source+="".concat(e,".value = ").concat(this.descendInput(t.value),";\n"),t.variable.isCloud&&(this.source+='runtime.ioDevices.cloud.requestUpdateVariable("'.concat(b(t.variable.name),'", ').concat(e,".value);\n"));break}case c.VAR_SHOW:this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(b(t.variable.id),'", element: "checkbox", value: true }, runtime);\n');break;case c.VISUAL_REPORT:{const e=this.localVariables.next();this.source+="const ".concat(e," = ").concat(this.descendInput(t.input),";"),this.source+="if (".concat(e,' !== undefined) runtime.visualReport(target, "').concat(b(this.script.topBlockId),'", ').concat(e,");\n");break}default:throw r.warn("JS: Unknown stacked block: ".concat(e.opcode),t),new Error("JS: Unknown stacked block: ".concat(e.opcode))}}descendTargetReference(e){if(!e.isAlwaysType(u.STRING))throw new Error("JS: Object references must be strings!");return e.isConstant("_stage_")?"stage":this.evaluateOnce("runtime.getSpriteTargetByName(".concat(this.descendInput(e),")"))}descendInputRecord(e){let t="{";for(const n of Object.keys(e)){const r=e[n];t+='"'.concat(b(n),'":').concat(this.descendInput(r),",")}return t+="}",t}descendStack(e,t){this.pushFrame(t);for(let n=0;n<e.blocks.length;n++)t.isLastBlock=n===e.blocks.length-1,this.descendStackedBlock(e.blocks[n]);this.popFrame()}descendAddonCall(e){const t=this.descendInputRecord(e.arguments),n='runtime.getAddonBlock("'.concat(b(e.code),'").callback'),r='"'.concat(b(e.blockId),'"');return"yield* executeInCompatibilityLayer(".concat(t,", ").concat(n,", ").concat(this.isWarp,", false, ").concat(r,")")}referenceVariable(e){return"target"===e.scope?this.evaluateOnce('target.variables["'.concat(b(e.id),'"]')):this.evaluateOnce('stage.variables["'.concat(b(e.id),'"]'))}evaluateOnce(e){if(Object.prototype.hasOwnProperty.call(this._setupVariables,e))return this._setupVariables[e];const t=this._setupVariablesPool.next();return this._setupVariables[e]=t,t}retire(){this.isProcedure?this.source+="retire(); yield;\n":this.source+="retire(); return;\n"}yieldLoop(){this.warpTimer?this.yieldStuckOrNotWarp():this.yieldNotWarp()}yieldNotWarp(){this.isWarp||(this.source+="yield;\n",this.yielded())}yieldStuckOrNotWarp(){this.isWarp?this.source+="if (isStuck()) yield;\n":this.source+="yield;\n",this.yielded()}yielded(){if(!this.script.yields)throw new Error("Script yielded but is not marked as yielding.")}requestRedraw(){this.source+="runtime.requestRedraw();\n"}generateCompatibilityLayerCall(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const r=e.opcode;let i="yield* executeInCompatibilityLayer({";for(const t of Object.keys(e.inputs)){const n=e.inputs[t],r=this.descendInput(n);i+='"'.concat(b(t),'":').concat(r,",")}for(const t of Object.keys(e.fields)){const n=e.fields[t];i+='"'.concat(b(t),'":"').concat(b(n),'",')}const s=this.evaluateOnce('runtime.getOpcodeFunction("'.concat(b(r),'")'));return i+="}, ".concat(s,", ").concat(this.isWarp,", ").concat(t,', "').concat(b(e.id),'", ').concat(n,")"),this.yielded(),i}getScriptFactoryName(){return T.next()}getScriptName(e){let t=e?A.next():v.next();if(this.isProcedure){const e=this.script.procedureCode.replace(/%[\w]/g,"").replace(/[^a-zA-Z0-9]/g,"_").substring(0,20);t+="_".concat(e)}return t}stopScript(){this.isProcedure?this.source+='return "";\n':this.retire()}stopScriptAndReturn(e){this.isProcedure?this.source+="return ".concat(e,";\n"):this.retire()}createScriptFactory(){let e="";e+="(function ".concat(this.getScriptFactoryName(),"(thread) { "),e+="const target = thread.target; ",e+="const runtime = target.runtime; ",e+="const stage = runtime.getTargetForStage();\n";for(const t of Object.keys(this._setupVariables)){const n=this._setupVariables[t];e+="const ".concat(n," = ").concat(t,";\n")}if(e+="return ",this.script.yields?e+="function* ":e+="function ",e+=this.getScriptName(this.script.yields),e+=" (",this.script.arguments.length){const t=[];for(let e=0;e<this.script.arguments.length;e++)t.push("p".concat(e));e+=t.join(",")}return e+=") {\n",e+=this.source,e+="}; })",e}compile(){this.script.stack&&this.descendStack(this.script.stack,new S(!1)),this.stopScript();const e=this.createScriptFactory(),t=o.scopedEval(e);return this.debug&&r.info("JS: ".concat(this.target.getName(),": compiled ").concat(this.script.procedureCode||"script"),e),k.testingApparatus&&k.testingApparatus.report(this,e),t}}k.unstable_exports={factoryNameVariablePool:T,functionNameVariablePool:v,generatorNameVariablePool:A,VariablePool:s,PEN_EXT:y,PEN_STATE:E,Frame:S,sanitize:b},k.testingApparatus=null,e.exports=k},function(e,t,n){const r=n(20),i=n(14);e.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.sequencer=e,this.thread=t,this._nowObj={now:()=>this.sequencer.runtime.currentMSecs}}get target(){return this.thread.target}get runtime(){return this.sequencer.runtime}get nowObj(){return this.runtime?this._nowObj:null}get stackFrame(){const e=this.thread.peekStackFrame();return null===e.executionContext&&(e.executionContext={}),e.executionContext}stackTimerFinished(){return!(this.stackFrame.timer.timeElapsed()<this.stackFrame.duration)}stackTimerNeedsInit(){return!this.stackFrame.timer}startStackTimer(e){this.nowObj?this.stackFrame.timer=new i(this.nowObj):this.stackFrame.timer=new i,this.stackFrame.timer.start(),this.stackFrame.duration=e}yield(){this.thread.status=r.STATUS_YIELD}yieldTick(){this.thread.status=r.STATUS_YIELD_TICK}startBranch(e,t){this.sequencer.stepToBranch(this.thread,e,t)}stopAll(){this.sequencer.runtime.stopAll()}stopOtherTargetThreads(){this.sequencer.runtime.stopForTarget(this.thread.target,this.thread)}stopThisScript(){this.thread.stopThisScript()}startProcedure(e){this.sequencer.stepToProcedure(this.thread,e)}getProcedureParamNamesAndIds(e){return this.thread.target.blocks.getProcedureParamNamesAndIds(e)}getProcedureParamNamesIdsAndDefaults(e){return this.thread.target.blocks.getProcedureParamNamesIdsAndDefaults(e)}initParams(){this.thread.initParams()}pushParam(e,t){this.thread.pushParam(e,t)}getParam(e){return this.thread.getParam(e)}startHats(e,t,n){const r=this.thread,i=this.sequencer,s=this.sequencer.runtime.startHats(e,t,n);return this.thread=r,this.sequencer=i,s}ioQuery(e,t,n){if(this.sequencer.runtime.ioDevices[e]&&this.sequencer.runtime.ioDevices[e][t]){const r=this.sequencer.runtime.ioDevices[e];return r[t].apply(r,n)}}}},function(e,t){e.exports={OUTPUT_SHAPE_HEXAGONAL:1,OUTPUT_SHAPE_ROUND:2,OUTPUT_SHAPE_SQUARE:3}},function(e,t,n){const r=n(13);class i{constructor(e){this.runtime=e,this.provider=null,this._skinId=-1,this._drawable=-1,this._ghost=0,this._forceTransparentPreview=!1}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}setProvider(e){this.provider=e}enableVideo(){return this.provider?this.provider.enableVideo().then((()=>this._setupPreview())):null}disableVideo(){if(this._disablePreview(),!this.provider)return null;this.provider.disableVideo()}getFrame(e){let{dimensions:t=i.DIMENSIONS,mirror:n=this.mirror,format:r=i.FORMAT_IMAGE_DATA,cacheTimeout:s=this._frameCacheTimeout}=e;return this.provider?this.provider.getFrame({dimensions:t,mirror:n,format:r,cacheTimeout:s}):null}setPreviewGhost(e){this._ghost=e,-1!==this._drawable&&this.runtime.renderer.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:e)}_disablePreview(){-1!==this._skinId&&(this.runtime.renderer.updateBitmapSkin(this._skinId,new ImageData(...i.DIMENSIONS),1),this.runtime.renderer.updateDrawableVisible(this._drawable,!1)),this._renderPreviewFrame=null}_setupPreview(){const{renderer:e}=this.runtime;e&&(-1===this._skinId&&-1===this._drawable&&(this._skinId=e.createBitmapSkin(new ImageData(...i.DIMENSIONS),1),this._drawable=e.createDrawable(r.VIDEO_LAYER),e.updateDrawableSkinId(this._drawable,this._skinId),e.markSkinAsPrivate&&e.markSkinAsPrivate(this._skinId),e.markDrawableAsNoninteractive&&e.markDrawableAsNoninteractive(this._drawable)),this._renderPreviewFrame||(e.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:this._ghost),e.updateDrawableVisible(this._drawable,!0),this._renderPreviewFrame=()=>{if(clearTimeout(this._renderPreviewTimeout),!this._renderPreviewFrame)return;this._renderPreviewTimeout=setTimeout(this._renderPreviewFrame,this.runtime.currentStepTime);const t=this.getFrame({format:i.FORMAT_IMAGE_DATA,cacheTimeout:this.runtime.currentStepTime});t?(e.updateBitmapSkin(this._skinId,t,1),this.runtime.requestRedraw()):e.updateBitmapSkin(this._skinId,new ImageData(...i.DIMENSIONS),1)},this._renderPreviewFrame()))}get videoReady(){return!!this.provider&&this.provider.videoReady}postData(e){let{forceTransparentPreview:t}=e;this._forceTransparentPreview=t,this.setPreviewGhost(this._ghost)}}e.exports=i},function(e,t){e.exports={generateExtensionId:e=>{const t=e.replace(/[^a-z0-9]/gi,"").toLowerCase();return"sbx".concat(t)},argumentIndexToId:e=>e.toString()}},function(e,t){e.exports=class{constructor(e,t){this.callback=e,this.maxConcurrent=t,this._current=0,this._queue=[]}do(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return new Promise(((e,n)=>{this._queue.push([e,n,t]),this._startNext()}))}_startNext(){if(this._current>=this.maxConcurrent||0===this._queue.length)return;this._current++;const[e,t,n]=this._queue.shift();this.callback.apply(null,n).then((t=>{e(t),this._current--,this._startNext()})).catch((e=>{t(e),this._current--,this._startNext()}))}}},function(e,t){class n{static _mergeVarRefObjects(e,t){for(const n in t)e[n]?e[n]=e[n].concat(t[n]):e[n]=t[n];return e}static getAllVarRefsForTargets(e,t){return e.map((e=>e.blocks.getAllVariableAndListReferences(null,t))).reduce(n._mergeVarRefObjects,{})}static updateVariableIdentifiers(e,t,n){e.map((e=>(e.referencingField.id=t,n&&(e.referencingField.value=n),e)))}}e.exports=n},function(e,t,n){const r=n(50),i=n(51),s=n(75),o=n(76),a=n(237),c=n(240),l=(e,t)=>{const n=[],r=e=>{e.localName!==t&&void 0!==t||!e.getAttribute||n.push(e);for(let t=0;t<e.childNodes.length;t++)r(e.childNodes[t])};return r(e),n},u=e=>{const t=c(),n=document.createElement("span"),i=e.outerHTML,s=r.sanitize(i,{USE_PROFILES:{svg:!0},FORBID_TAGS:["a","audio","canvas","video"],ADD_DATA_URI_TAGS:["image"]});let o,a;try{n.innerHTML=s,t.appendChild(n),o=n.children[0].getBBox()}finally{t.removeChild(n)}a=0===o.width||0===o.height?0:(e=>{let t=0;const n=e=>{e.getAttribute&&(e.getAttribute("stroke")&&(t=Math.max(t,1)),e.getAttribute("stroke-width")&&(t=Math.max(t,Number(e.getAttribute("stroke-width"))||0)));for(let t=0;t<e.childNodes.length;t++)n(e.childNodes[t])};return n(e),t})(e)/2;const l=o.width+2*a,u=o.height+2*a,h=o.x-a,d=o.y-a;e.setAttribute("width",l),e.setAttribute("height",u),e.setAttribute("viewBox",`${h} ${d} ${l} ${u}`)},h=(e,t)=>{t&&(e=>{const t=l(e,"linearGradient");for(const e of t)e.getAttribute("x2")||e.setAttribute("x2","0")})(e),a(e,window),(e=>{const t=l(e,"image"),n="image-rendering: optimizespeed; image-rendering: pixelated;";for(const e of t)e.getAttribute("style")?e.setAttribute("style",`${n} ${e.getAttribute("style")}`):e.setAttribute("style",n)})(e),t?((e=>{const t=[],n=e=>{"text"===e.localName&&t.push(e);for(let t=0;t<e.childNodes.length;t++)n(e.childNodes[t])};n(e),s(e);for(const n of t){n.removeAttribute("x"),n.removeAttribute("y"),n.setAttribute("alignment-baseline","text-before-edge"),n.setAttribute("xml:space","preserve"),n.getAttribute("font-size")||n.setAttribute("font-size","18");let t=n.textContent;const r=parseFloat(n.getAttribute("font-size")),s=2;let o=0,a=1.2;if("Handwriting"===n.getAttribute("font-family")?(a=2,o=-11*r/22):"Scratch"===n.getAttribute("font-family")?(a=.89,o=-3*r/22):"Curly"===n.getAttribute("font-family")?(a=1.38,o=-6*r/22):"Marker"===n.getAttribute("font-family")?(a=1.45,o=-6*r/22):"Sans Serif"===n.getAttribute("font-family")?(a=1.13,o=-3*r/22):"Serif"===n.getAttribute("font-family")&&(a=1.25,o=-4*r/22),0===n.transform.baseVal.numberOfItems){const t=e.createSVGTransform();n.transform.baseVal.appendItem(t)}const c=n.transform.baseVal.getItem(0).matrix;if(c.e+=c.a*s+c.c*o,c.f+=c.b*s+c.d*o,t&&0===n.childElementCount){n.textContent="";const e=t.split("\n");t="";for(const t of e){const e=i.create("tspan");e.setAttribute("x","0"),e.setAttribute("style","white-space: pre"),e.setAttribute("dy",`${a}em`),e.textContent=t||" ",n.appendChild(e)}}}})(e),u(e),(e=>{const t=l(e);for(const e of t){if(!e.style)continue;const t=e.style.stroke||e.getAttribute("stroke");t&&t.match(/^url\(#.*\)$/)&&(e.style["stroke-linejoin"]="round",e.style["stroke-linecap"]="round")}})(e)):e.getAttribute("viewBox")?e.getAttribute("width")&&e.getAttribute("height")||(e.setAttribute("width",e.viewBox.baseVal.width),e.setAttribute("height",e.viewBox.baseVal.height)):u(e)};e.exports=(e,t)=>{const n=new DOMParser;e=o(e);const r=n.parseFromString(e,"text/xml");if(r.childNodes.length<1||"svg"!==r.documentElement.localName)throw new Error("Document does not appear to be SVG.");const i=r.documentElement;return h(i,t),i}},function(e,t){e.exports=function(e){const t=[],n=e=>{"text"===e.localName&&t.push(e);for(let t=0;t<e.childNodes.length;t++)n(e.childNodes[t])};n(e);for(const e of t)e.getAttribute("font-family")&&"Helvetica"!==e.getAttribute("font-family")?"Mystery"===e.getAttribute("font-family")?e.setAttribute("font-family","Curly"):"Gloria"===e.getAttribute("font-family")?e.setAttribute("font-family","Handwriting"):"Donegal"===e.getAttribute("font-family")&&e.setAttribute("font-family","Serif"):e.setAttribute("font-family","Sans Serif")}},function(e,t){e.exports=function(e){const t=e.match(/<svg [^>]*>/);t&&-1===t[0].indexOf("xmlns=")&&(e=e.replace("<svg ",'<svg xmlns="http://www.w3.org/2000/svg" ')),t&&-1!==t[0].indexOf("&ns_")&&-1===e.indexOf("<!DOCTYPE")&&(e=e.replace(t[0],t[0].replace(/&ns_[^;]+;/g,"http://ns.adobe.com/Extensibility/1.0/"))),e.includes("data:img/png")&&(e=e.replace(/(<image[^>]+?xlink:href=["'])data:img\/png/g,((e,t)=>`${t}data:image/png`)));const n=/(<[^>]+?xmlns:(?!xml=)[^ ]+=)"http:\/\/www.w3.org\/XML\/1998\/namespace"/g;return null!==e.match(n)&&(e=e.replace(n,((e,t)=>`${t}"http://dummy.namespace"`))),e=(e=(e=e.replace(/<(\/?)\s*svg:/g,"<$1")).replace(/<metadata>[\s\S]*<\/metadata>/,"<metadata></metadata>")).replace(/<script[\s\S]*>[\s\S]*<\/script>/,"<script><\/script>")}},function(e,t,n){const r=n(78);e.exports=(e,t)=>{let n=(new XMLSerializer).serializeToString(e);return t&&(n=r(n,t)),n}},function(e,t,n){const r=n(241);e.exports=function(e,t={}){if("string"!=typeof e)throw new Error("SVG to be inlined is not a string");const n={};if(t&&"object"==typeof t)for(const[e,r]of Object.entries(t))n[(i=e,i.replace(/[<>&'"]/g,(e=>{switch(e){case"<":return"&lt;";case">":return"&gt;";case"&":return"&amp;";case"'":return"&apos;";case'"':return"&quot;"}})))]=r;var i;try{Object.assign(n,r())}catch(e){}const s=new Set,o=/font-family="([^"]*)"/g;let a=o.exec(e);for(;a;)s.add(a[1]),a=o.exec(e);if(s.size>0){let t="<defs><style>";for(const e of s)Object.prototype.hasOwnProperty.call(n,e)&&(t+=`${n[e]}`);return t+="</style></defs>",e=e.replace(/<svg[^>]*>/,`$&${t}`)}return e}},function(e,t,n){let r,i;"undefined"==typeof TextEncoder?(r=n(21).TextEncoder,i=n(21).TextDecoder):(r=TextEncoder,i=TextDecoder);const s="<!".concat("-".repeat(2)),o="".concat("-".repeat(2),">"),a=new RegExp("".concat(s,"rotationCenter:(-?[\\d\\.]+):(-?[\\d\\.]+)").concat(o,"$"));e.exports={parseVectorMetadata:e=>{const t=e.match(a);if(!t)return null;const n=+t[1],r=+t[2];return Number.isNaN(n)||Number.isNaN(r)?null:[n,r]},exportCostume:e=>{const t=e.asset.data;if("svg"!==e.dataFormat)return t;let n=(new i).decode(t);n=n.replace(a,"");const c=e.rotationCenterX,l=e.rotationCenterY;return n+="".concat(s,"rotationCenter:").concat(c,":").concat(l).concat(o),(new r).encode(n)}}},function(e,t,n){const r=n(7);e.exports=e=>{const t={};for(let n=0;n<e.length;n++){const i=r(),s=e[n].id;e[n].id=t[s]=i}for(let n=0;n<e.length;n++){for(const r in e[n].inputs){const i=e[n].inputs[r];i.block=t[i.block],i.shadow=t[i.shadow]}e[n].parent&&(e[n].parent=t[e[n].parent]),e[n].next&&(e[n].next=t[e[n].next])}}},function(e,t,n){const r=e=>function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return new Promise(((t,r)=>{e(...n,((e,n)=>{e?r("string"==typeof e?new Error(e):e):t(n)}))}))};var i=r(n(255)),s=r(n(257)),o=r(n(258));e.exports=function(e,t,n){i(e,t).then((function(e){return s(e[0]).then(o.bind(null,t)).then((function(t){return[t,e[1]]}))})).then(n.bind(null,null),n)}},function(e,t,n){const r=n(22),i=n(0);e.exports={deserializeSound:function(e,t,n,s){const o=s||e.md5,a=t.storage;if(!a)return i.warn("No storage module present; cannot load sound asset: ",o),Promise.resolve(null);if(!n)return Promise.resolve(null);let c=n.file(o);if(!c){const e=new RegExp("^([^/]*/)?".concat(o,"$"));c=n.file(e)[0]}if(!c)return i.error("Could not find sound file associated with the ".concat(e.name," sound.")),Promise.resolve(null);if(!r.support.uint8array)return i.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);const l="mp3"===e.dataFormat.toLowerCase()?a.DataFormat.MP3:a.DataFormat.WAV;return c.async("uint8array").then((e=>a.createAsset(a.AssetType.Sound,l,e,null,!0))).then((t=>{e.asset=t,e.assetId=t.assetId,e.md5="".concat(t.assetId,".").concat(t.dataFormat)}))},deserializeCostume:function(e,t,n,s,o){const a=t.storage,c=e.assetId,l=s||"".concat(c,".").concat(e.dataFormat);if(!a)return i.warn("No storage module present; cannot load costume asset: ",l),Promise.resolve(null);if(e.asset)return Promise.resolve(a.createAsset(e.asset.assetType,e.asset.dataFormat,new Uint8Array(Object.keys(e.asset.data).map((t=>e.asset.data[t]))),null,!0)).then((t=>{e.asset=t,e.assetId=t.assetId,e.md5="".concat(t.assetId,".").concat(t.dataFormat)}));if(!n)return Promise.resolve(null);let u=n.file(l);if(!u){const e=new RegExp("^([^/]*/)?".concat(l,"$"));u=n.file(e)[0]}if(!u)return i.error("Could not find costume file associated with the ".concat(e.name," costume.")),Promise.resolve(null);let h=null;const d=e.dataFormat.toLowerCase();if("svg"===d?h=a.AssetType.ImageVector:["png","bmp","jpeg","jpg","gif"].indexOf(d)>=0?h=a.AssetType.ImageBitmap:i.error("Unexpected file format for costume: ".concat(d)),!r.support.uint8array)return i.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);let p;if(e.textLayerMD5){const t=n.file(o);if(!t)return i.error("Could not find text layer file associated with the ".concat(e.name," costume.")),Promise.resolve(null);p=t.async("uint8array").then((t=>a.createAsset(a.AssetType.ImageBitmap,"png",t,e.textLayerMD5))).then((t=>{e.textLayerAsset=t}))}else p=Promise.resolve(null);return Promise.all([p,u.async("uint8array").then((e=>a.createAsset(h,d,e,null,!0))).then((t=>{e.asset=t,e.assetId=t.assetId,e.md5="".concat(t.assetId,".").concat(t.dataFormat)}))])}}},function(e,t,n){const r=n(17),i=n(47),s=n(49),o=n(23),a=n(0),c=n(7),l=n(6),u=n(4),h=n(261),d=n(48),p=n(9),f=n(24),m=n(13),g=n(71),{loadCostume:b}=n(34),{loadSound:y}=n(33),{deserializeCostume:E,deserializeSound:T}=n(82),v=["argument","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],A=/\u001f|\./,w=e=>{const[t,n]=e.split(A),r=g.generateExtensionId(t);return"".concat(r,"_").concat(n)},S=function(e){const t=[{}];let n=0;const r=e.split(/(?=[^\\]%[nbs])/);for(let e=0;e<r.length;e++){const i=r[e].trim();if("%"===i.substring(0,1)){const e=i.substring(1,2),r={type:"input",inputName:"input"+n++};"n"===e?r.inputOp="math_number":"s"===e?r.inputOp="text":"b"===e&&(r.inputOp="boolean"),t.push(r)}}return t},k=function(e){return S(e).map((e=>e.inputName)).filter((e=>e))},O=function(e){let t=[];for(let n=0;n<e.length;n++){const r=e[n];t.push(r),r.children&&(t=t.concat(O(r.children))),delete r.children}return t},I=function(e,t,n,r,i,s,o){const a=[];let c=null;for(let l=0;l<e.length;l++){const u=e[l],h=L(u,t,n,r,i,s,o),d=h[0];o=h[1],d&&(c&&(d.parent=c.id,c.next=d.id),c=d,a.push(d))}return[a,o]},N=function(){let e={};const t=(e,t,n)=>"".concat(e,"-").concat(l.replaceUnsafeChars(t),"-").concat(n);return function(n,r){return r&&(e={}),function(i,s){return r?(e["".concat(i,"-").concat(s)]=t(n,i,s),e["".concat(i,"-").concat(s)]):e["".concat(i,"-").concat(s)]?e["".concat(i,"-").concat(s)]:t(n,i,s)}}}(),R=function(){let e={};const t=[],n=c();return function(r){return r&&(e={}),{broadcastMsgMapUpdater:function(r,i){return""===(r=r.toLowerCase())&&(r=n),e[r]="broadcastMsgId-".concat(l.replaceUnsafeChars(r)),t.push(i),e[r]},globalBroadcastMsgs:e,allBroadcastFields:t,emptyMsgName:n}}}(),x=(e,t,n,r)=>{if(!h[e.cmd])return void a.warn("Could not find monitor block with opcode: ".concat(e.cmd));const i=h[e.cmd].opcode,s=i.indexOf("_"),o=i.substring(0,s);if("videoSensing"===o)return;if(-1===v.indexOf(o)&&""!==o&&!r.extensionIDs.has(o)&&!e.visible)return;let c=null;if(!Object.prototype.hasOwnProperty.call(e,"target"))for(let t=0;t<n.length;t++){const r=n[t];Object.keys(r.variables).filter((t=>{const n=r.variables[t];return n.type===p.LIST_TYPE&&n.name===e.listName})).length>0&&(c=r,e.target=r.getName())}if(c=c||n.filter((t=>t.getName()===e.target))[0],!c)throw new Error("Cannot create monitor for target that cannot be found by name");const l=N(c.id,!1),[u,d]=L([e.cmd,e.param],null,l,r,{},null,null);"getVar:"===e.cmd?u.id=l(e.param,p.SCALAR_TYPE):"contentsOfList:"===e.cmd?u.id=l(e.param,p.LIST_TYPE):Object.prototype.hasOwnProperty.call(t.monitorBlockInfo,u.opcode)?u.id=t.monitorBlockInfo[u.opcode].getId(c.id,u.fields):u.id=u.opcode,u.targetId=c.isStage?null:c.id,u.isMonitored=e.visible;const m=t.monitorBlocks._blocks[u.id];if(m)m.isMonitored=e.visible,m.targetId=u.targetId;else{const e=O([u]);for(let n=0;n<e.length;n++)t.monitorBlocks.createBlock(e[n])}switch(e.mode){case 1:e.mode="default";break;case 2:e.mode="large";break;case 3:e.mode="slider"}t.requestAddMonitor(new f({id:u.id,targetId:u.targetId,spriteName:u.targetId?e.target:null,opcode:u.opcode,params:t.monitorBlocks._getBlockParams(u),value:"",mode:e.mode,sliderMin:e.sliderMin,sliderMax:e.sliderMax,isDiscrete:e.isDiscrete,x:e.x,y:e.y,width:e.width,height:e.height,visible:e.visible}))},M=function(e,t,n,r){if(!Object.prototype.hasOwnProperty.call(e,"objName"))return null;const i={costumePromises:[],soundPromises:[],soundBank:t.audioEngine&&t.audioEngine.createBank(),children:[]},s=i.costumePromises;if(Object.prototype.hasOwnProperty.call(e,"costumes"))for(let i=0;i<e.costumes.length;i++){const o=e.costumes[i],a=o.bitmapResolution||1,c={name:o.costumeName,bitmapResolution:a,rotationCenterX:n?240*a:o.rotationCenterX,rotationCenterY:n?180*a:o.rotationCenterY,md5:o.baseLayerMD5,skinId:null},u=o.baseLayerMD5,h=l.splitFirst(u,"."),d=h[0];let p;2===h.length&&h[1]?p=h[1]:(p="png",c.md5="".concat(c.md5,".").concat(p)),c.dataFormat=p,c.assetId=d,o.textLayerMD5&&(c.textLayerMD5=l.splitFirst(o.textLayerMD5,".")[0]);const f="".concat(o.baseLayerID,".").concat(p),m=o.textLayerID?"".concat(o.textLayerID,".png"):null;s.push(t.wrapAssetRequest((()=>E(c,t,r,f,m).then((()=>b(c.md5,c,t,2))))))}const{soundBank:o,soundPromises:a}=i;if(Object.prototype.hasOwnProperty.call(e,"sounds"))for(let n=0;n<e.sounds.length;n++){const i=e.sounds[n],s={name:i.soundName,format:i.format,rate:i.rate,sampleCount:i.sampleCount,md5:i.md5,data:null},c=i.md5,u=l.splitFirst(c,"."),h=u[0],d=u[1].toLowerCase();s.dataFormat=d,s.assetId=h;const p="".concat(i.soundID,".").concat(d);a.push(t.wrapAssetRequest((()=>T(s,t,r,p).then((()=>y(s,t,o))))))}const c=i.children;if(e.children)for(let n=0;n<e.children.length;n++)c.push(M(e.children[n],t,!1,r));return i},C=function(e,t,n,o,a,c){if(!Object.prototype.hasOwnProperty.call(e,"objName"))return Object.prototype.hasOwnProperty.call(e,"listName")&&(e.cmd="contentsOfList:",e.param=e.listName,e.mode="list"),e.deferredMonitor=!0,Promise.resolve(e);const l=new r(t),h=new s(l,t);if(Object.prototype.hasOwnProperty.call(e,"objName")){if(o&&"Stage"!==e.objName){for(const t of e.children)Object.prototype.hasOwnProperty.call(t,"objName")||t.target!==e.objName||(t.target="Stage");e.objName="Stage"}h.name=e.objName}const f=c.costumePromises,{soundBank:b,soundPromises:y}=c,E=h.createClone(o?m.BACKGROUND_LAYER:m.SPRITE_LAYER),T=N(E.id,o),v=R(o),A=v.broadcastMsgMapUpdater;if(Object.prototype.hasOwnProperty.call(e,"variables"))for(let n=0;n<e.variables.length;n++){const r=e.variables[n],i=r.isPersistent&&o&&t.canAddCloudVariable(),s=new p(T(r.name,p.SCALAR_TYPE),r.name,p.SCALAR_TYPE,i);i&&t.addCloudVariable(),s.value=r.value,E.variables[s.id]=s}const w={};if(Object.prototype.hasOwnProperty.call(e,"scriptComments")){e.scriptComments.map((e=>{const[t,n,r,i,s,o,a]=e,c=e[5]>=0,l=new d(null,a,c?null:1.5*t,c?null:2.2*n,1.5*r,2.2*i,!s);return c&&(l.blockId=o,Object.prototype.hasOwnProperty.call(w,o)?w[o].push(l):w[o]=[l]),l})).forEach((e=>{E.comments[e.id]=e}))}Object.prototype.hasOwnProperty.call(e,"scripts")&&function(e,t,n,r,i,s){let o=0;for(let a=0;a<e.length;a++){const c=e[a],l=c[0],u=c[1],h=c[2],d={},[p,f]=I(h,n,r,i,d,s,o);o=f,p[0]&&(p[0].x=1.5*l,p[0].y=2.2*u,p[0].topLevel=!0,p[0].parent=null);const m=O(p);for(let e=0;e<m.length;e++)t.createBlock(m[e])}}(e.scripts,l,A,T,n,w);for(const e in w){w[e].forEach((e=>{"number"==typeof e.blockId&&(e.blockId=null)}))}if(l.updateTargetSpecificBlocks(o),Object.prototype.hasOwnProperty.call(e,"lists"))for(let t=0;t<e.lists.length;t++){const n=e.lists[t],r=new p(T(n.listName,p.LIST_TYPE),n.listName,p.LIST_TYPE,!1);r.value=n.contents,E.variables[r.id]=r}Object.prototype.hasOwnProperty.call(e,"scratchX")&&(E.x=e.scratchX),Object.prototype.hasOwnProperty.call(e,"scratchY")&&(E.y=e.scratchY),Object.prototype.hasOwnProperty.call(e,"direction")&&(E.direction=u.wrapClamp(e.direction,-179,180)),Object.prototype.hasOwnProperty.call(e,"isDraggable")&&(E.draggable=e.isDraggable),Object.prototype.hasOwnProperty.call(e,"scale")&&(E.size=100*e.scale),Object.prototype.hasOwnProperty.call(e,"visible")&&(E.visible=e.visible),Object.prototype.hasOwnProperty.call(e,"currentCostumeIndex")&&(E.currentCostume=u.clamp(Math.floor(e.currentCostumeIndex),0,e.costumes.length-1)),Object.prototype.hasOwnProperty.call(e,"rotationStyle")&&("none"===e.rotationStyle?E.rotationStyle=i.ROTATION_STYLE_NONE:"leftRight"===e.rotationStyle?E.rotationStyle=i.ROTATION_STYLE_LEFT_RIGHT:"normal"===e.rotationStyle&&(E.rotationStyle=i.ROTATION_STYLE_ALL_AROUND)),Object.prototype.hasOwnProperty.call(e,"tempoBPM")&&(E.tempo=e.tempoBPM),Object.prototype.hasOwnProperty.call(e,"videoAlpha")&&(E.videoTransparency=100-100*e.videoAlpha),Object.prototype.hasOwnProperty.call(e,"info")&&Object.prototype.hasOwnProperty.call(e.info,"videoOn")&&(e.info.videoOn?E.videoState=i.VIDEO_STATE.ON:E.videoState=i.VIDEO_STATE.OFF),Object.prototype.hasOwnProperty.call(e,"indexInLibrary")&&(E.targetPaneOrder=e.indexInLibrary),E.isStage=o,Promise.all(f).then((e=>{h.costumes=e})),Promise.all(y).then((e=>{h.sounds=e,h.soundBank=b||null}));const S=[];if(e.children)for(let r=0;r<e.children.length;r++)S.push(C(e.children[r],t,n,!1,a,c.children[r]));if(o){const t=e.info&&e.info.savedExtensions;if(Array.isArray(t))for(const e of t){const t=g.generateExtensionId(e.extensionName),r=e.javascriptURL;n.extensionURLs.set(t,r)}}return Promise.all(f.concat(y)).then((()=>Promise.all(S).then((e=>{if(E.isStage){const e=v.globalBroadcastMsgs,t=v.allBroadcastFields,n=v.emptyMsgName;if(e[n]){let r=1;for(;e["message".concat(r)];)r+=1;const i="message".concat(r);e[i]=e[n],delete e[n];for(let e=0;e<t.length;e++)""===t[e].value&&(t[e].value=i)}for(const t in e){const n=e[t],r=new p(n,t,p.BROADCAST_MESSAGE_TYPE,!1);E.variables[r.id]=r}}let r=[E];const i=[];for(let t=0;t<e.length;t++)e[t]&&(e[t].deferredMonitor?i.push(e[t]):r=r.concat(e[t]));for(let e=0;e<i.length;e++)x(i[e],t,r,n);return r}))))},P=function(e){const t=e.map(((e,t)=>(e.layerOrder=t,e))).sort(((e,t)=>e.targetPaneOrder-t.targetPaneOrder));return t.forEach((e=>{delete e.targetPaneOrder})),t},D=function(e){const t=e[0],n=t&&h[t];return n?"function"==typeof n?n(e):n:t&&(e=>A.test(e))(t)?(e=>{const t=e[0],n=e.length-1,r=[];for(let e=0;e<n;e++)r.push({type:"input",inputOp:"text",inputName:g.argumentIndexToId(e)});return{opcode:w(t),argMap:r}})(e):(a.warn("Couldn't find SB2 block: ".concat(t)),null)},L=function(e,t,n,r,i,s,l){const u=s&&"number"==typeof l&&!isNaN(l)?s[l]:null,h=D(e);if(!h)return u&&u.forEach((e=>{e.blockId=null,e.x=e.y=0})),[null,l+1];const d=e[0],f=h.opcode.indexOf("_"),m=h.opcode.substring(0,f);-1===v.indexOf(m)&&""!==m&&r.extensionIDs.add(m);const g={id:c(),opcode:h.opcode,inputs:{},fields:{},next:null,shadow:!1,children:[]};u&&(g.comment=u[u.length-1].id,u.forEach((e=>{e.id===g.comment?e.blockId=g.id:(e.blockId=null,e.x=e.y=0)}))),l++;const b=i.expectedArg;"call"===d&&(h.argMap=S(e[1]));for(let u=0;u<h.argMap.length;u++){const d=h.argMap[u],f=e[u+1];let m=!1;if("input"===d.type){const e=c();if(g.inputs[d.inputName]={name:d.inputName,block:null,shadow:null},"object"==typeof f&&f){let e;if(i.expectedArg=d,"object"==typeof f[0]&&f[0])[e,l]=I(f,t,n,r,i,s,l);else{const o=L(f,t,n,r,i,s,l);e=o[0]?[o[0]]:[],l=o[1]}if(i.expectedArg=b,e.length>0){let t=null;for(let n=0;n<e.length;n++)e[n].parent=0===n?g.id:t,t=e[n].id;g.inputs[d.inputName].block=e[0].id,g.children=g.children.concat(e)}m=!0}if(!d.inputOp){a.warn("Unknown input operation for input ".concat(d.inputName," of opcode ").concat(g.opcode,"."));continue}if("boolean"===d.inputOp||"substack"===d.inputOp)continue;let u=f,h=d.inputName;"math_number"===d.inputOp||"math_whole_number"===d.inputOp||"math_positive_number"===d.inputOp||"math_integer"===d.inputOp||"math_angle"===d.inputOp?(h="NUM",m&&(u=10)):"text"===d.inputOp?(h="TEXT",m&&(u="")):"colour_picker"===d.inputOp?(u=o.decimalToHex(f),h="COLOUR",m&&(u="#990000")):"event_broadcast_menu"===d.inputOp?(h="BROADCAST_OPTION",m&&(u="")):"sensing_of_object_menu"===d.inputOp?(m||"Stage"===u)&&(u="_stage_"):"note"===d.inputOp?m&&(u=60):"music.menu.DRUM"===d.inputOp||"music.menu.INSTRUMENT"===d.inputOp?m&&(u=1):"videoSensing.menu.ATTRIBUTE"===d.inputOp?m&&(u="motion"):"videoSensing.menu.SUBJECT"===d.inputOp?m&&(u="this sprite"):"videoSensing.menu.VIDEO_STATE"===d.inputOp?m&&(u="on"):m&&(u="");const p={};if(p[h]={name:h,value:u},"event_broadcast_menu"===d.inputOp){const e=t(u,p[h]);p[h].id=e,p[h].variableType=d.variableType}g.children.push({id:e,opcode:d.inputOp,inputs:{},fields:p,next:null,topLevel:!1,parent:g.id,shadow:!0}),g.inputs[d.inputName].shadow=e,g.inputs[d.inputName].block||(g.inputs[d.inputName].block=e)}else if("field"===d.type){if(g.fields[d.fieldName]={name:d.fieldName,value:f},"CURRENTMENU"===d.fieldName&&(g.fields[d.fieldName].value=f.toUpperCase(),"day of week"===f&&(g.fields[d.fieldName].value="DAYOFWEEK")),"VARIABLE"===d.fieldName)g.fields[d.fieldName].id=n(f,p.SCALAR_TYPE);else if("LIST"===d.fieldName)g.fields[d.fieldName].id=n(f,p.LIST_TYPE);else if("BROADCAST_OPTION"===d.fieldName){const e=t(f,g.fields[d.fieldName]);g.fields[d.fieldName].id=e}const e=d.variableType;"string"==typeof e&&(g.fields[d.fieldName].variableType=e)}}switch(d){case"comeToFront":g.fields.FRONT_BACK={name:"FRONT_BACK",value:"front"};break;case"goBackByLayers:":g.fields.FORWARD_BACKWARD={name:"FORWARD_BACKWARD",value:"backward"};break;case"backgroundIndex":case"costumeIndex":g.fields.NUMBER_NAME={name:"NUMBER_NAME",value:"number"};break;case"sceneName":case"costumeName":g.fields.NUMBER_NAME={name:"NUMBER_NAME",value:"name"}}if("stopScripts"===d)"other scripts in sprite"!==e[1]&&"other scripts in stage"!==e[1]||(g.mutation={tagName:"mutation",hasnext:"true",children:[]});else if("procDef"===d){const t=e.slice(1),n=c(),r="custom_block";g.inputs[r]={name:r,block:n,shadow:n},g.children=[{id:n,opcode:"procedures_prototype",inputs:{},fields:{},next:null,shadow:!0,children:[],mutation:{tagName:"mutation",proccode:t[0],argumentnames:JSON.stringify(t[1]),argumentids:JSON.stringify(k(t[0])),argumentdefaults:JSON.stringify(t[2]),warp:t[3],children:[]}}]}else if("call"===d)g.mutation={tagName:"mutation",children:[],proccode:e[1],argumentids:JSON.stringify(k(e[1]))};else if("getParam"===d){let t=e[2];switch(b&&"boolean"===b.inputOp&&"b"!==t&&(t="b"),t){case"r":g.opcode="argument_reporter_string_number";break;case"b":g.opcode="argument_reporter_boolean"}}return[g,l]};e.exports={deserialize:function(e,t,n,r){const i={extensionIDs:new Set,extensionURLs:new Map};return Promise.resolve(M(e,t,!n,r)).then((e=>Promise.resolve(e))).then((s=>C(e,t,i,!n,r,s))).then(P).then((e=>({targets:e,extensions:i})))}}},function(e,t,n){const r=n(263);e.exports=r},function(e,t){class n{constructor(){this.left=-1/0,this.right=1/0,this.bottom=-1/0,this.top=1/0}initFromBounds(e,t,n,r){this.left=e,this.right=t,this.bottom=n,this.top=r}initFromPointsAABB(e){this.left=1/0,this.right=-1/0,this.top=-1/0,this.bottom=1/0;for(let t=0;t<e.length;t++){const n=e[t][0],r=e[t][1];n<this.left&&(this.left=n),n>this.right&&(this.right=n),r>this.top&&(this.top=r),r<this.bottom&&(this.bottom=r)}}initFromModelMatrix(e){const t=e[12],n=e[13],r=Math.abs(.5*e[0])+Math.abs(.5*e[4]),i=Math.abs(.5*e[1])+Math.abs(.5*e[5]);this.left=-r+t,this.right=r+t,this.top=i+n,this.bottom=-i+n}intersects(e){return this.left<=e.right&&e.left<=this.right&&this.top>=e.bottom&&e.top>=this.bottom}contains(e){return e.left>this.left&&e.right<this.right&&e.top<this.top&&e.bottom>this.bottom}clamp(e,t,n,r){this.left=Math.max(this.left,e),this.right=Math.min(this.right,t),this.bottom=Math.max(this.bottom,n),this.top=Math.min(this.top,r),this.left=Math.min(this.left,t),this.right=Math.max(this.right,e),this.bottom=Math.min(this.bottom,r),this.top=Math.max(this.top,n)}snapToInt(){this.left=Math.floor(this.left),this.right=Math.ceil(this.right),this.bottom=Math.floor(this.bottom),this.top=Math.ceil(this.top)}static intersect(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new n;return r.left=Math.max(e.left,t.left),r.right=Math.min(e.right,t.right),r.top=Math.min(e.top,t.top),r.bottom=Math.max(e.bottom,t.bottom),r}static union(e,t){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new n;return r.left=Math.min(e.left,t.left),r.right=Math.max(e.right,t.right),r.top=Math.max(e.top,t.top),r.bottom=Math.min(e.bottom,t.bottom),r}get width(){return Math.abs(this.left-this.right)}get height(){return Math.abs(this.top-this.bottom)}}e.exports=n},function(e,t,n){const r=n(11),{rgbToHsv:i,hsvToRgb:s}=n(274),o=n(28),a=.5,c=.5,l=[0,0,0];e.exports=class{static transformColor(e,t,n){if(0===t[3])return t;let r=e.enabledEffects;"number"==typeof n&&(r&=n);const a=e.getUniforms(),c=!!(r&o.EFFECT_INFO.color.mask),u=!!(r&o.EFFECT_INFO.brightness.mask);if(c||u){const e=t[3]/255;if(t[0]/=e,t[1]/=e,t[2]/=e,c){const e=i(t,l),n=.055,r=.09;e[2]<n?(e[0]=0,e[1]=1,e[2]=n):e[1]<r&&(e[0]=0,e[1]=r),e[0]=a.u_color+e[0]+1,s(e,t)}if(u){const e=255*a.u_brightness;t[0]+=e,t[1]+=e,t[2]+=e}t[0]*=e,t[1]*=e,t[2]*=e}return r&o.EFFECT_INFO.ghost.mask&&(t[0]*=a.u_ghost,t[1]*=a.u_ghost,t[2]*=a.u_ghost,t[3]*=a.u_ghost),t}static transformPoint(e,t,n){r.v3.copy(t,n);const i=e.enabledEffects,s=e.getUniforms();if(i&o.EFFECT_INFO.mosaic.mask&&(n[0]=s.u_mosaic*n[0]%1,n[1]=s.u_mosaic*n[1]%1),i&o.EFFECT_INFO.pixelate.mask){const t=e.skin.getUniforms(),r=t.u_skinSize[0]/s.u_pixelate,i=t.u_skinSize[1]/s.u_pixelate;n[0]=(Math.floor(n[0]*r)+a)/r,n[1]=(Math.floor(n[1]*i)+c)/i}if(i&o.EFFECT_INFO.whirl.mask){const e=.5,t=n[0]-a,r=n[1]-c,i=Math.sqrt(Math.pow(t,2)+Math.pow(r,2)),o=Math.max(1-i/e,0),l=s.u_whirl*o*o,u=Math.sin(l),h=Math.cos(l),d=h,p=-u,f=u,m=h;n[0]=d*t+f*r+a,n[1]=p*t+m*r+c}if(i&o.EFFECT_INFO.fisheye.mask){const e=(n[0]-a)/a,t=(n[1]-c)/c,r=Math.sqrt(e*e+t*t),i=Math.pow(Math.min(r,1),s.u_fisheye)*Math.max(1,r),o=e/r,l=t/r;n[0]=a+i*o*a,n[1]=c+i*l*c}return n}}},function(e,t,n){const r=n(29);r.enable(),e.exports=r("scratch-render")},function(e,t){e.exports=class{constructor(e){this._ctx=e,this._cache={}}beginMeasurementSession(){}endMeasurementSession(){}measureText(e){return this._cache[e]||(this._cache[e]=this._ctx.measureText(e).width),this._cache[e]}clearCache(){this._cache={}}}},function(e,t,n){var r,i;i=n(280),r=function(){function e(e){var t,n,r;(t="function"==typeof e.readUInt32BE&&"function"==typeof e.slice)||e instanceof Uint8Array?(t?(this.highStart=e.readUInt32BE(0),this.errorValue=e.readUInt32BE(4),n=e.readUInt32BE(8),e=e.slice(12)):(r=new DataView(e.buffer),this.highStart=r.getUint32(0),this.errorValue=r.getUint32(4),n=r.getUint32(8),e=e.subarray(12)),e=i(e,new Uint8Array(n)),e=i(e,new Uint8Array(n)),this.data=new Uint32Array(e.buffer)):(this.data=e.data,this.highStart=e.highStart,this.errorValue=e.errorValue)}return e.prototype.get=function(e){var t;return e<0||e>1114111?this.errorValue:e<55296||e>56319&&e<=65535?(t=(this.data[e>>5]<<2)+(31&e),this.data[t]):e<=65535?(t=(this.data[2048+(e-55296>>5)]<<2)+(31&e),this.data[t]):e<this.highStart?(t=this.data[2080+(e>>11)],t=((t=this.data[t+(e>>5&63)])<<2)+(31&e),this.data[t]):this.data[this.data.length-4]},e}(),e.exports=r},function(module,exports,__webpack_require__){var factory;window,factory=function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/index.js")}({"./node_modules/@babel/runtime/helpers/objectWithoutProperties.js":function(e,t,n){var r=n("./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js");e.exports=function(e,t){if(null==e)return{};var n,i,s=r(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i<o.length;i++)n=o[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s},e.exports.__esModule=!0,e.exports.default=e.exports},"./node_modules/@babel/runtime/helpers/objectWithoutPropertiesLoose.js":function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},s=Object.keys(e);for(r=0;r<s.length;r++)n=s[r],t.indexOf(n)>=0||(i[n]=e[n]);return i},e.exports.__esModule=!0,e.exports.default=e.exports},"./node_modules/arraybuffer-loader/lib/to-array-buffer.js":function(e,t,n){"use strict";(function(t){e.exports=function(e){for(var n="undefined"!=typeof window&&"function"==typeof window.atob?window.atob(e):t.from(e,"base64").toString("binary"),r=new Uint8Array(n.length),i=0;i<n.length;++i)r[i]=n.charCodeAt(i);return r.buffer}}).call(this,n("./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer)},"./node_modules/base64-js/index.js":function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){for(var t,n=c(e),r=n[0],o=n[1],a=new s(function(e,t,n){return 3*(t+n)/4-n}(0,r,o)),l=0,u=o>0?r-4:r,h=0;h<u;h+=4)t=i[e.charCodeAt(h)]<<18|i[e.charCodeAt(h+1)]<<12|i[e.charCodeAt(h+2)]<<6|i[e.charCodeAt(h+3)],a[l++]=t>>16&255,a[l++]=t>>8&255,a[l++]=255&t;return 2===o&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[l++]=255&t),1===o&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t),a},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=16383,a=0,c=n-i;a<c;a+=o)s.push(l(e,a,a+o>c?c:a+o));return 1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"=")),s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],i[o.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,s,o=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},"./node_modules/cross-fetch/dist/browser-ponyfill.js":function(e,t){var n="undefined"!=typeof self?self:this,r=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();!function(e){!function(t){var n="URLSearchParams"in e,r="Symbol"in e&&"iterator"in Symbol,i="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),s="FormData"in e,o="ArrayBuffer"in e;if(o)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],c=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function l(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function u(e){return"string"!=typeof e&&(e=String(e)),e}function h(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return r&&(t[Symbol.iterator]=function(){return t}),t}function d(e){this.map={},e instanceof d?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function p(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function f(e){return new Promise((function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}}))}function m(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:i&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:s&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:n&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():o&&i&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):o&&(ArrayBuffer.prototype.isPrototypeOf(e)||c(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i&&(this.blob=function(){var e=p(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?p(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,n,r=p(this);if(r)return r;if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=f(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},s&&(this.formData=function(){return this.text().then(T)}),this.json=function(){return this.text().then(JSON.parse)},this}d.prototype.append=function(e,t){e=l(e),t=u(t);var n=this.map[e];this.map[e]=n?n+", "+t:t},d.prototype.delete=function(e){delete this.map[l(e)]},d.prototype.get=function(e){return e=l(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(l(e))},d.prototype.set=function(e,t){this.map[l(e)]=u(t)},d.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},d.prototype.keys=function(){var e=[];return this.forEach((function(t,n){e.push(n)})),h(e)},d.prototype.values=function(){var e=[];return this.forEach((function(t){e.push(t)})),h(e)},d.prototype.entries=function(){var e=[];return this.forEach((function(t,n){e.push([n,t])})),h(e)},r&&(d.prototype[Symbol.iterator]=d.prototype.entries);var y=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];function E(e,t){var n,r,i=(t=t||{}).body;if(e instanceof E){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,i||null==e._bodyInit||(i=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"same-origin",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(n=t.method||this.method||"GET",r=n.toUpperCase(),y.indexOf(r)>-1?r:n),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&i)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(i)}function T(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var n=e.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(i))}})),t}function v(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}E.prototype.clone=function(){return new E(this,{body:this._bodyInit})},b.call(E.prototype),b.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:0,statusText:""});return e.type="error",e};var A=[301,302,303,307,308];v.redirect=function(e,t){if(-1===A.indexOf(t))throw new RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function w(e,n){return new Promise((function(r,s){var o=new E(e,n);if(o.signal&&o.signal.aborted)return s(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function c(){a.abort()}a.onload=function(){var e,t,n={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var n=e.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();t.append(r,i)}})),t)};n.url="responseURL"in a?a.responseURL:n.headers.get("X-Request-URL");var i="response"in a?a.response:a.responseText;r(new v(i,n))},a.onerror=function(){s(new TypeError("Network request failed"))},a.ontimeout=function(){s(new TypeError("Network request failed"))},a.onabort=function(){s(new t.DOMException("Aborted","AbortError"))},a.open(o.method,o.url,!0),"include"===o.credentials?a.withCredentials=!0:"omit"===o.credentials&&(a.withCredentials=!1),"responseType"in a&&i&&(a.responseType="blob"),o.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),o.signal&&(o.signal.addEventListener("abort",c),a.onreadystatechange=function(){4===a.readyState&&o.signal.removeEventListener("abort",c)}),a.send(void 0===o._bodyInit?null:o._bodyInit)}))}w.polyfill=!0,e.fetch||(e.fetch=w,e.Headers=d,e.Request=E,e.Response=v),t.Headers=d,t.Request=E,t.Response=v,t.fetch=w,Object.defineProperty(t,"__esModule",{value:!0})}({})}(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=r;(t=i.fetch).default=i.fetch,t.fetch=i.fetch,t.Headers=i.Headers,t.Request=i.Request,t.Response=i.Response,e.exports=t},"./node_modules/ieee754/index.js":function(e,t){t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,p=e[t+h];for(h+=d,s=p&(1<<-u)-1,p>>=-u,u+=a;u>0;s=256*s+e[t+h],h+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=r;u>0;o=256*o+e[t+h],h+=d,u-=8);if(0===s)s=1-l;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=l}return(p?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,c,l=8*s-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(t*c-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;e[n+p]=255&o,p+=f,o/=256,l-=8);e[n+p-f]|=128*m}},"./node_modules/js-md5/src/md5.js":function(module,exports,__webpack_require__){(function(process,global){var __WEBPACK_AMD_DEFINE_RESULT__;(function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=global:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&"object"==typeof module&&module.exports,AMD=__webpack_require__("./node_modules/webpack/buildin/amd-options.js"),ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),blocks=[],buffer8;if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}!root.JS_MD5_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t){return new Md5(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t<OUTPUT_TYPES.length;++t){var n=OUTPUT_TYPES[t];e[n]=createOutputMethod(n)}return e},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(e){if("string"==typeof e)return crypto.createHash("md5").update(e,"utf8").digest("hex");if(null==e)throw ERROR;return e.constructor===ArrayBuffer&&(e=new Uint8Array(e)),Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===Buffer?crypto.createHash("md5").update(new Buffer(e)).digest("hex"):method(e)};return nodeMethod};function Md5(e){if(e)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){var t=new ArrayBuffer(68);this.buffer8=new Uint8Array(t),this.blocks=new Uint32Array(t)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0}Md5.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"!==n)throw ERROR;if(null===e)throw ERROR;if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||ARRAY_BUFFER&&ArrayBuffer.isView(e)))throw ERROR;t=!0}for(var r,i,s=0,o=e.length,a=this.blocks,c=this.buffer8;s<o;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t)if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)c[i++]=e[s];else for(i=this.start;s<o&&i<64;++s)a[i>>2]|=e[s]<<SHIFT[3&i++];else if(ARRAY_BUFFER)for(i=this.start;s<o&&i<64;++s)(r=e.charCodeAt(s))<128?c[i++]=r:r<2048?(c[i++]=192|r>>6,c[i++]=128|63&r):r<55296||r>=57344?(c[i++]=224|r>>12,c[i++]=128|r>>6&63,c[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),c[i++]=240|r>>18,c[i++]=128|r>>12&63,c[i++]=128|r>>6&63,c[i++]=128|63&r);else for(i=this.start;s<o&&i<64;++s)(r=e.charCodeAt(s))<128?a[i>>2]|=r<<SHIFT[3&i++]:r<2048?(a[i>>2]|=(192|r>>6)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):r<55296||r>=57344?(a[i>>2]|=(224|r>>12)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]):(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),a[i>>2]|=(240|r>>18)<<SHIFT[3&i++],a[i>>2]|=(128|r>>12&63)<<SHIFT[3&i++],a[i>>2]|=(128|r>>6&63)<<SHIFT[3&i++],a[i>>2]|=(128|63&r)<<SHIFT[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296|0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[3&t],t>=56&&(this.hashed||this.hash(),e[0]=e[16],e[16]=e[1]=e[2]=e[3]=e[4]=e[5]=e[6]=e[7]=e[8]=e[9]=e[10]=e[11]=e[12]=e[13]=e[14]=e[15]=0),e[14]=this.bytes<<3,e[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var e,t,n,r,i,s,o=this.blocks;this.first?t=((t=((e=((e=o[0]-680876937)<<7|e>>>25)-271733879|0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&e)+o[1]-117830708)<<12|r>>>20)+e|0)&(-271733879^e))+o[2]-1126478375)<<17|n>>>15)+r|0)&(r^e))+o[3]-1316259209)<<22|t>>>10)+n|0:(e=this.h0,t=this.h1,n=this.h2,t=((t+=((e=((e+=((r=this.h3)^t&(n^r))+o[0]-680876936)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[1]-389564586)<<12|r>>>20)+e|0)&(e^t))+o[2]+606105819)<<17|n>>>15)+r|0)&(r^e))+o[3]-1044525330)<<22|t>>>10)+n|0),t=((t+=((e=((e+=(r^t&(n^r))+o[4]-176418897)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[5]+1200080426)<<12|r>>>20)+e|0)&(e^t))+o[6]-1473231341)<<17|n>>>15)+r|0)&(r^e))+o[7]-45705983)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+o[8]+1770035416)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[9]-1958414417)<<12|r>>>20)+e|0)&(e^t))+o[10]-42063)<<17|n>>>15)+r|0)&(r^e))+o[11]-1990404162)<<22|t>>>10)+n|0,t=((t+=((e=((e+=(r^t&(n^r))+o[12]+1804603682)<<7|e>>>25)+t|0)^(n=((n+=(t^(r=((r+=(n^e&(t^n))+o[13]-40341101)<<12|r>>>20)+e|0)&(e^t))+o[14]-1502002290)<<17|n>>>15)+r|0)&(r^e))+o[15]+1236535329)<<22|t>>>10)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[1]-165796510)<<5|e>>>27)+t|0)^t))+o[6]-1069501632)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[11]+643717713)<<14|n>>>18)+r|0)^r))+o[0]-373897302)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[5]-701558691)<<5|e>>>27)+t|0)^t))+o[10]+38016083)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[15]-660478335)<<14|n>>>18)+r|0)^r))+o[4]-405537848)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[9]+568446438)<<5|e>>>27)+t|0)^t))+o[14]-1019803690)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[3]-187363961)<<14|n>>>18)+r|0)^r))+o[8]+1163531501)<<20|t>>>12)+n|0,t=((t+=((r=((r+=(t^n&((e=((e+=(n^r&(t^n))+o[13]-1444681467)<<5|e>>>27)+t|0)^t))+o[2]-51403784)<<9|r>>>23)+e|0)^e&((n=((n+=(e^t&(r^e))+o[7]+1735328473)<<14|n>>>18)+r|0)^r))+o[12]-1926607734)<<20|t>>>12)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[5]-378558)<<4|e>>>28)+t|0))+o[8]-2022574463)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[11]+1839030562)<<16|n>>>16)+r|0))+o[14]-35309556)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[1]-1530992060)<<4|e>>>28)+t|0))+o[4]+1272893353)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[7]-155497632)<<16|n>>>16)+r|0))+o[10]-1094730640)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[13]+681279174)<<4|e>>>28)+t|0))+o[0]-358537222)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[3]-722521979)<<16|n>>>16)+r|0))+o[6]+76029189)<<23|t>>>9)+n|0,t=((t+=((s=(r=((r+=((i=t^n)^(e=((e+=(i^r)+o[9]-640364487)<<4|e>>>28)+t|0))+o[12]-421815835)<<11|r>>>21)+e|0)^e)^(n=((n+=(s^t)+o[15]+530742520)<<16|n>>>16)+r|0))+o[2]-995338651)<<23|t>>>9)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[0]-198630844)<<6|e>>>26)+t|0)|~n))+o[7]+1126891415)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[14]-1416354905)<<15|n>>>17)+r|0)|~e))+o[5]-57434055)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[12]+1700485571)<<6|e>>>26)+t|0)|~n))+o[3]-1894986606)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[10]-1051523)<<15|n>>>17)+r|0)|~e))+o[1]-2054922799)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[8]+1873313359)<<6|e>>>26)+t|0)|~n))+o[15]-30611744)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[6]-1560198380)<<15|n>>>17)+r|0)|~e))+o[13]+1309151649)<<21|t>>>11)+n|0,t=((t+=((r=((r+=(t^((e=((e+=(n^(t|~r))+o[4]-145523070)<<6|e>>>26)+t|0)|~n))+o[11]-1120210379)<<10|r>>>22)+e|0)^((n=((n+=(e^(r|~t))+o[2]+718787259)<<15|n>>>17)+r|0)|~e))+o[9]-343485551)<<21|t>>>11)+n|0,this.first?(this.h0=e+1732584193|0,this.h1=t-271733879|0,this.h2=n-1732584194|0,this.h3=r+271733878|0,this.first=!1):(this.h0=this.h0+e|0,this.h1=this.h1+t|0,this.h2=this.h2+n|0,this.h3=this.h3+r|0)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[r>>4&15]+HEX_CHARS[15&r]+HEX_CHARS[r>>12&15]+HEX_CHARS[r>>8&15]+HEX_CHARS[r>>20&15]+HEX_CHARS[r>>16&15]+HEX_CHARS[r>>28&15]+HEX_CHARS[r>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,r=this.h3;return[255&e,e>>8&255,e>>16&255,e>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(16),t=new Uint32Array(e);return t[0]=this.h0,t[1]=this.h1,t[2]=this.h2,t[3]=this.h3,e},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,r="",i=this.array(),s=0;s<15;)e=i[s++],t=i[s++],n=i[s++],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[63&(e<<4|t>>>4)]+BASE64_ENCODE_CHAR[63&(t<<2|n>>>6)]+BASE64_ENCODE_CHAR[63&n];return e=i[s],r+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&(__WEBPACK_AMD_DEFINE_RESULT__=function(){return exports}.call(exports,__webpack_require__,exports,module),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)))})()}).call(this,__webpack_require__("./node_modules/process/browser.js"),__webpack_require__("./node_modules/webpack/buildin/global.js"))},"./node_modules/node-libs-browser/node_modules/buffer/index.js":function(e,t,n){"use strict";(function(e){var r=n("./node_modules/base64-js/index.js"),i=n("./node_modules/ieee754/index.js"),s=n("./node_modules/node-libs-browser/node_modules/isarray/index.js");function o(){return c.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(o()<t)throw new RangeError("Invalid typed array length");return c.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=c.prototype:(null===e&&(e=new c(t)),e.length=t),e}function c(e,t,n){if(!(c.TYPED_ARRAY_SUPPORT||this instanceof c))return new c(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return h(this,e)}return l(this,e,t,n)}function l(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");return t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r),c.TYPED_ARRAY_SUPPORT?(e=t).__proto__=c.prototype:e=d(e,t),e}(e,t,n,r):"string"==typeof t?function(e,t,n){if("string"==typeof n&&""!==n||(n="utf8"),!c.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|f(t,n),i=(e=a(e,r)).write(t,n);return i!==r&&(e=e.slice(0,i)),e}(e,t,n):function(e,t){if(c.isBuffer(t)){var n=0|p(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?a(e,0):d(e,t);if("Buffer"===t.type&&s(t.data))return d(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function u(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function h(e,t){if(u(t),e=a(e,t<0?0:0|p(t)),!c.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function d(e,t){var n=t.length<0?0:0|p(t.length);e=a(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function p(e){if(e>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|e}function f(e,t){if(c.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return z(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return G(e).length;default:if(r)return z(e).length;t=(""+t).toLowerCase(),r=!0}}function m(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return O(this,t,n);case"ascii":return N(this,t,n);case"latin1":case"binary":return R(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function b(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=c.from(t,r)),c.isBuffer(t))return 0===t.length?-1:y(e,t,n,r,i);if("number"==typeof t)return t&=255,c.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):y(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function y(e,t,n,r,i){var s,o=1,a=e.length,c=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;o=2,a/=2,c/=2,n/=2}function l(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){var u=-1;for(s=n;s<a;s++)if(l(e,s)===l(t,-1===u?0:s-u)){if(-1===u&&(u=s),s-u+1===c)return u*o}else-1!==u&&(s-=s-u),u=-1}else for(n+c>a&&(n=a-c),s=n;s>=0;s--){for(var h=!0,d=0;d<c;d++)if(l(e,s+d)!==l(t,d)){h=!1;break}if(h)return s}return-1}function E(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=t.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var o=0;o<r;++o){var a=parseInt(t.substr(2*o,2),16);if(isNaN(a))return o;e[n+o]=a}return o}function T(e,t,n,r){return V(z(t,e.length-n),e,n,r)}function v(e,t,n,r){return V(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function A(e,t,n,r){return v(e,t,n,r)}function w(e,t,n,r){return V(G(t),e,n,r)}function S(e,t,n,r){return V(function(e,t){for(var n,r,i,s=[],o=0;o<e.length&&!((t-=2)<0);++o)r=(n=e.charCodeAt(o))>>8,i=n%256,s.push(i),s.push(r);return s}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function O(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var s,o,a,c,l=e[i],u=null,h=l>239?4:l>223?3:l>191?2:1;if(i+h<=n)switch(h){case 1:l<128&&(u=l);break;case 2:128==(192&(s=e[i+1]))&&(c=(31&l)<<6|63&s)>127&&(u=c);break;case 3:s=e[i+1],o=e[i+2],128==(192&s)&&128==(192&o)&&(c=(15&l)<<12|(63&s)<<6|63&o)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:s=e[i+1],o=e[i+2],a=e[i+3],128==(192&s)&&128==(192&o)&&128==(192&a)&&(c=(15&l)<<18|(63&s)<<12|(63&o)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,h=1):u>65535&&(u-=65536,r.push(u>>>10&1023|55296),u=56320|1023&u),r.push(u),i+=h}return function(e){var t=e.length;if(t<=I)return String.fromCharCode.apply(String,e);for(var n="",r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=I));return n}(r)}t.Buffer=c,t.SlowBuffer=function(e){return+e!=e&&(e=0),c.alloc(+e)},t.INSPECT_MAX_BYTES=50,c.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),t.kMaxLength=o(),c.poolSize=8192,c._augment=function(e){return e.__proto__=c.prototype,e},c.from=function(e,t,n){return l(null,e,t,n)},c.TYPED_ARRAY_SUPPORT&&(c.prototype.__proto__=Uint8Array.prototype,c.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&c[Symbol.species]===c&&Object.defineProperty(c,Symbol.species,{value:null,configurable:!0})),c.alloc=function(e,t,n){return function(e,t,n,r){return u(t),t<=0?a(e,t):void 0!==n?"string"==typeof r?a(e,t).fill(n,r):a(e,t).fill(n):a(e,t)}(null,e,t,n)},c.allocUnsafe=function(e){return h(null,e)},c.allocUnsafeSlow=function(e){return h(null,e)},c.isBuffer=function(e){return!(null==e||!e._isBuffer)},c.compare=function(e,t){if(!c.isBuffer(e)||!c.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,s=Math.min(n,r);i<s;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},c.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},c.concat=function(e,t){if(!s(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return c.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=c.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!c.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},c.byteLength=f,c.prototype._isBuffer=!0,c.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)g(this,t,t+1);return this},c.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)g(this,t,t+3),g(this,t+1,t+2);return this},c.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)g(this,t,t+7),g(this,t+1,t+6),g(this,t+2,t+5),g(this,t+3,t+4);return this},c.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?O(this,0,e):m.apply(this,arguments)},c.prototype.equals=function(e){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===c.compare(this,e)},c.prototype.inspect=function(){var e="",n=t.INSPECT_MAX_BYTES;return this.length>0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),"<Buffer "+e+">"},c.prototype.compare=function(e,t,n,r,i){if(!c.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var s=(i>>>=0)-(r>>>=0),o=(n>>>=0)-(t>>>=0),a=Math.min(s,o),l=this.slice(r,i),u=e.slice(t,n),h=0;h<a;++h)if(l[h]!==u[h]){s=l[h],o=u[h];break}return s<o?-1:o<s?1:0},c.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},c.prototype.indexOf=function(e,t,n){return b(this,e,t,n,!0)},c.prototype.lastIndexOf=function(e,t,n){return b(this,e,t,n,!1)},c.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return E(this,e,t,n);case"utf8":case"utf-8":return T(this,e,t,n);case"ascii":return v(this,e,t,n);case"latin1":case"binary":return A(this,e,t,n);case"base64":return w(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function N(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function R(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function x(e,t,n){var r,i=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>i)&&(n=i);for(var s="",o=t;o<n;++o)s+=(r=e[o])<16?"0"+r.toString(16):r.toString(16);return s}function M(e,t,n){for(var r=e.slice(t,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}function C(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,r,i,s){if(!c.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function D(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-n,2);i<s;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function L(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-n,4);i<s;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function B(e,t,n,r,i,s){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function U(e,t,n,r,s){return s||B(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,s){return s||B(e,0,n,8),i.write(e,t,n,r,52,8),n+8}c.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),c.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=c.prototype;else{var i=t-e;n=new c(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+e]}return n},c.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r},c.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},c.prototype.readUInt8=function(e,t){return t||C(e,1,this.length),this[e]},c.prototype.readUInt16LE=function(e,t){return t||C(e,2,this.length),this[e]|this[e+1]<<8},c.prototype.readUInt16BE=function(e,t){return t||C(e,2,this.length),this[e]<<8|this[e+1]},c.prototype.readUInt32LE=function(e,t){return t||C(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},c.prototype.readUInt32BE=function(e,t){return t||C(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},c.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=this[e],i=1,s=0;++s<t&&(i*=256);)r+=this[e+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},c.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||C(e,t,this.length);for(var r=t,i=1,s=this[e+--r];r>0&&(i*=256);)s+=this[e+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},c.prototype.readInt8=function(e,t){return t||C(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},c.prototype.readInt16LE=function(e,t){t||C(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt16BE=function(e,t){t||C(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},c.prototype.readInt32LE=function(e,t){return t||C(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},c.prototype.readInt32BE=function(e,t){return t||C(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},c.prototype.readFloatLE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!0,23,4)},c.prototype.readFloatBE=function(e,t){return t||C(e,4,this.length),i.read(this,e,!1,23,4)},c.prototype.readDoubleLE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!0,52,8)},c.prototype.readDoubleBE=function(e,t){return t||C(e,8,this.length),i.read(this,e,!1,52,8)},c.prototype.writeUIntLE=function(e,t,n,r){e=+e,t|=0,n|=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[t]=255&e;++s<n&&(i*=256);)this[t+s]=e/i&255;return t+n},c.prototype.writeUIntBE=function(e,t,n,r){e=+e,t|=0,n|=0,r||P(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+n},c.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},c.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):L(this,e,t,!0),t+4},c.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=0,o=1,a=0;for(this[t]=255&e;++s<n&&(o*=256);)e<0&&0===a&&0!==this[t+s-1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},c.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);P(this,e,t,n,i-1,-i)}var s=n-1,o=1,a=0;for(this[t+s]=255&e;--s>=0&&(o*=256);)e<0&&0===a&&0!==this[t+s+1]&&(a=1),this[t+s]=(e/o|0)-a&255;return t+n},c.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),c.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},c.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):D(this,e,t,!0),t+2},c.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):D(this,e,t,!1),t+2},c.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),c.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):L(this,e,t,!0),t+4},c.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),c.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):L(this,e,t,!1),t+4},c.prototype.writeFloatLE=function(e,t,n){return U(this,e,t,!0,n)},c.prototype.writeFloatBE=function(e,t,n){return U(this,e,t,!1,n)},c.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},c.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},c.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,s=r-n;if(this===e&&n<t&&t<r)for(i=s-1;i>=0;--i)e[i+t]=this[i+n];else if(s<1e3||!c.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+s),t);return s},c.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!c.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var s;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(s=t;s<n;++s)this[s]=e;else{var o=c.isBuffer(e)?e:z(new c(e,r).toString()),a=o.length;for(s=0;s<n-t;++s)this[s+t]=o[s%a]}return this};var j=/[^+\/0-9A-Za-z-_]/g;function z(e,t){var n;t=t||1/0;for(var r=e.length,i=null,s=[],o=0;o<r;++o){if((n=e.charCodeAt(o))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&s.push(239,191,189);continue}if(o+1===r){(t-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;s.push(n)}else if(n<2048){if((t-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function G(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(j,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n("./node_modules/webpack/buildin/global.js"))},"./node_modules/node-libs-browser/node_modules/isarray/index.js":function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},"./node_modules/process/browser.js":function(e,t){var n,r,i=e.exports={};function s(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function a(e){if(n===setTimeout)return setTimeout(e,0);if((n===s||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:s}catch(e){n=s}try{r="function"==typeof clearTimeout?clearTimeout:o}catch(e){r=o}}();var c,l=[],u=!1,h=-1;function d(){u&&c&&(u=!1,c.length?l=c.concat(l):h=-1,l.length&&p())}function p(){if(!u){var e=a(d);u=!0;for(var t=l.length;t;){for(c=l,l=[];++h<t;)c&&c[h].run();h=-1,t=l.length}c=null,u=!1,function(e){if(r===clearTimeout)return clearTimeout(e);if((r===o||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(e);try{return r(e)}catch(t){try{return r.call(null,e)}catch(t){return r.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function m(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];l.push(new f(e,t)),1!==l.length||u||a(p)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.browser=!0,i.env={},i.argv=[],i.version="",i.versions={},i.on=m,i.addListener=m,i.once=m,i.off=m,i.removeListener=m,i.removeAllListeners=m,i.emit=m,i.prependListener=m,i.prependOnceListener=m,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},"./node_modules/webpack/buildin/amd-options.js":function(e,t){(function(t){e.exports=t}).call(this,{})},"./node_modules/webpack/buildin/global.js":function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},'./node_modules/worker-loader/dist/cjs.js?{"inline":true,"fallback":true}!./src/FetchWorkerTool.worker.js':function(e,t,n){e.exports=function(){return n("./node_modules/worker-loader/dist/workers/InlineWorker.js")("/******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// define __esModule on exports\n/******/ \t__webpack_require__.r = function(exports) {\n/******/ \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n/******/ \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n/******/ \t\t}\n/******/ \t\tObject.defineProperty(exports, '__esModule', { value: true });\n/******/ \t};\n/******/\n/******/ \t// create a fake namespace object\n/******/ \t// mode & 1: value is a module id, require it\n/******/ \t// mode & 2: merge all properties of value into the ns\n/******/ \t// mode & 4: return value when already ns object\n/******/ \t// mode & 8|1: behave like require\n/******/ \t__webpack_require__.t = function(value, mode) {\n/******/ \t\tif(mode & 1) value = __webpack_require__(value);\n/******/ \t\tif(mode & 8) return value;\n/******/ \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n/******/ \t\tvar ns = Object.create(null);\n/******/ \t\t__webpack_require__.r(ns);\n/******/ \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n/******/ \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n/******/ \t\treturn ns;\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\");\n/******/ })\n/************************************************************************/\n/******/ ({\n\n/***/ \"./node_modules/babel-loader/lib/index.js?!./src/FetchWorkerTool.worker.js\":\n/*!*******************************************************************************!*\\\n  !*** ./node_modules/babel-loader/lib??ref--4!./src/FetchWorkerTool.worker.js ***!\n  \\*******************************************************************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* eslint-env worker */\n\nconst isNullResponse = __webpack_require__(/*! ./isNullResponse */ \"./src/isNullResponse.js\");\nconst saferFetch = __webpack_require__(/*! ./safer-fetch */ \"./src/safer-fetch.js\");\nconst complete = [];\nlet timeoutId = null;\nconst checkCompleted = () => {\n  if (timeoutId) return;\n  timeoutId = setTimeout(() => {\n    timeoutId = null;\n    if (complete.length) {\n      // Send our chunk of completed requests and instruct postMessage to\n      // transfer the buffers instead of copying them.\n      postMessage(complete.slice(),\n      // Instruct postMessage that these buffers in the sent message\n      // should use their Transferable trait. After the postMessage\n      // call the \"buffers\" will still be in complete if you looked,\n      // but they will all be length 0 as the data they reference has\n      // been sent to the window. This lets us send a lot of data\n      // without the normal postMessage behaviour of making a copy of\n      // all of the data for the window.\n      complete.map(response => response.buffer).filter(Boolean));\n      complete.length = 0;\n    }\n  });\n};\n\n/**\n * Receive a job from the parent and fetch the requested data.\n * @param {object} options.job A job id, url, and options descriptor to perform.\n */\nconst onMessage = _ref => {\n  let {\n    data: job\n  } = _ref;\n  saferFetch(job.url, job.options).then(result => {\n    if (result.ok) return result.arrayBuffer();\n    if (isNullResponse(result)) return null;\n    return Promise.reject(result.status);\n  }).then(buffer => complete.push({\n    id: job.id,\n    buffer\n  })).catch(error => complete.push({\n    id: job.id,\n    error: error && error.message || \"Failed request: \".concat(job.url)\n  })).then(checkCompleted);\n};\n\n// crossFetch means \"fetch\" is now always supported\npostMessage({\n  support: {\n    fetch: true\n  }\n});\nself.addEventListener('message', onMessage);\n\n/***/ }),\n\n/***/ \"./node_modules/cross-fetch/dist/browser-ponyfill.js\":\n/*!***********************************************************!*\\\n  !*** ./node_modules/cross-fetch/dist/browser-ponyfill.js ***!\n  \\***********************************************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\nvar global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n  var support = {\n    searchParams: 'URLSearchParams' in self,\n    iterable: 'Symbol' in self && 'iterator' in Symbol,\n    blob:\n      'FileReader' in self &&\n      'Blob' in self &&\n      (function() {\n        try {\n          new Blob();\n          return true\n        } catch (e) {\n          return false\n        }\n      })(),\n    formData: 'FormData' in self,\n    arrayBuffer: 'ArrayBuffer' in self\n  };\n\n  function isDataView(obj) {\n    return obj && DataView.prototype.isPrototypeOf(obj)\n  }\n\n  if (support.arrayBuffer) {\n    var viewClasses = [\n      '[object Int8Array]',\n      '[object Uint8Array]',\n      '[object Uint8ClampedArray]',\n      '[object Int16Array]',\n      '[object Uint16Array]',\n      '[object Int32Array]',\n      '[object Uint32Array]',\n      '[object Float32Array]',\n      '[object Float64Array]'\n    ];\n\n    var isArrayBufferView =\n      ArrayBuffer.isView ||\n      function(obj) {\n        return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n      };\n  }\n\n  function normalizeName(name) {\n    if (typeof name !== 'string') {\n      name = String(name);\n    }\n    if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n      throw new TypeError('Invalid character in header field name')\n    }\n    return name.toLowerCase()\n  }\n\n  function normalizeValue(value) {\n    if (typeof value !== 'string') {\n      value = String(value);\n    }\n    return value\n  }\n\n  // Build a destructive iterator for the value list\n  function iteratorFor(items) {\n    var iterator = {\n      next: function() {\n        var value = items.shift();\n        return {done: value === undefined, value: value}\n      }\n    };\n\n    if (support.iterable) {\n      iterator[Symbol.iterator] = function() {\n        return iterator\n      };\n    }\n\n    return iterator\n  }\n\n  function Headers(headers) {\n    this.map = {};\n\n    if (headers instanceof Headers) {\n      headers.forEach(function(value, name) {\n        this.append(name, value);\n      }, this);\n    } else if (Array.isArray(headers)) {\n      headers.forEach(function(header) {\n        this.append(header[0], header[1]);\n      }, this);\n    } else if (headers) {\n      Object.getOwnPropertyNames(headers).forEach(function(name) {\n        this.append(name, headers[name]);\n      }, this);\n    }\n  }\n\n  Headers.prototype.append = function(name, value) {\n    name = normalizeName(name);\n    value = normalizeValue(value);\n    var oldValue = this.map[name];\n    this.map[name] = oldValue ? oldValue + ', ' + value : value;\n  };\n\n  Headers.prototype['delete'] = function(name) {\n    delete this.map[normalizeName(name)];\n  };\n\n  Headers.prototype.get = function(name) {\n    name = normalizeName(name);\n    return this.has(name) ? this.map[name] : null\n  };\n\n  Headers.prototype.has = function(name) {\n    return this.map.hasOwnProperty(normalizeName(name))\n  };\n\n  Headers.prototype.set = function(name, value) {\n    this.map[normalizeName(name)] = normalizeValue(value);\n  };\n\n  Headers.prototype.forEach = function(callback, thisArg) {\n    for (var name in this.map) {\n      if (this.map.hasOwnProperty(name)) {\n        callback.call(thisArg, this.map[name], name, this);\n      }\n    }\n  };\n\n  Headers.prototype.keys = function() {\n    var items = [];\n    this.forEach(function(value, name) {\n      items.push(name);\n    });\n    return iteratorFor(items)\n  };\n\n  Headers.prototype.values = function() {\n    var items = [];\n    this.forEach(function(value) {\n      items.push(value);\n    });\n    return iteratorFor(items)\n  };\n\n  Headers.prototype.entries = function() {\n    var items = [];\n    this.forEach(function(value, name) {\n      items.push([name, value]);\n    });\n    return iteratorFor(items)\n  };\n\n  if (support.iterable) {\n    Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n  }\n\n  function consumed(body) {\n    if (body.bodyUsed) {\n      return Promise.reject(new TypeError('Already read'))\n    }\n    body.bodyUsed = true;\n  }\n\n  function fileReaderReady(reader) {\n    return new Promise(function(resolve, reject) {\n      reader.onload = function() {\n        resolve(reader.result);\n      };\n      reader.onerror = function() {\n        reject(reader.error);\n      };\n    })\n  }\n\n  function readBlobAsArrayBuffer(blob) {\n    var reader = new FileReader();\n    var promise = fileReaderReady(reader);\n    reader.readAsArrayBuffer(blob);\n    return promise\n  }\n\n  function readBlobAsText(blob) {\n    var reader = new FileReader();\n    var promise = fileReaderReady(reader);\n    reader.readAsText(blob);\n    return promise\n  }\n\n  function readArrayBufferAsText(buf) {\n    var view = new Uint8Array(buf);\n    var chars = new Array(view.length);\n\n    for (var i = 0; i < view.length; i++) {\n      chars[i] = String.fromCharCode(view[i]);\n    }\n    return chars.join('')\n  }\n\n  function bufferClone(buf) {\n    if (buf.slice) {\n      return buf.slice(0)\n    } else {\n      var view = new Uint8Array(buf.byteLength);\n      view.set(new Uint8Array(buf));\n      return view.buffer\n    }\n  }\n\n  function Body() {\n    this.bodyUsed = false;\n\n    this._initBody = function(body) {\n      this._bodyInit = body;\n      if (!body) {\n        this._bodyText = '';\n      } else if (typeof body === 'string') {\n        this._bodyText = body;\n      } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n        this._bodyBlob = body;\n      } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n        this._bodyFormData = body;\n      } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n        this._bodyText = body.toString();\n      } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n        this._bodyArrayBuffer = bufferClone(body.buffer);\n        // IE 10-11 can't handle a DataView body.\n        this._bodyInit = new Blob([this._bodyArrayBuffer]);\n      } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n        this._bodyArrayBuffer = bufferClone(body);\n      } else {\n        this._bodyText = body = Object.prototype.toString.call(body);\n      }\n\n      if (!this.headers.get('content-type')) {\n        if (typeof body === 'string') {\n          this.headers.set('content-type', 'text/plain;charset=UTF-8');\n        } else if (this._bodyBlob && this._bodyBlob.type) {\n          this.headers.set('content-type', this._bodyBlob.type);\n        } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n          this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n        }\n      }\n    };\n\n    if (support.blob) {\n      this.blob = function() {\n        var rejected = consumed(this);\n        if (rejected) {\n          return rejected\n        }\n\n        if (this._bodyBlob) {\n          return Promise.resolve(this._bodyBlob)\n        } else if (this._bodyArrayBuffer) {\n          return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n        } else if (this._bodyFormData) {\n          throw new Error('could not read FormData body as blob')\n        } else {\n          return Promise.resolve(new Blob([this._bodyText]))\n        }\n      };\n\n      this.arrayBuffer = function() {\n        if (this._bodyArrayBuffer) {\n          return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n        } else {\n          return this.blob().then(readBlobAsArrayBuffer)\n        }\n      };\n    }\n\n    this.text = function() {\n      var rejected = consumed(this);\n      if (rejected) {\n        return rejected\n      }\n\n      if (this._bodyBlob) {\n        return readBlobAsText(this._bodyBlob)\n      } else if (this._bodyArrayBuffer) {\n        return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n      } else if (this._bodyFormData) {\n        throw new Error('could not read FormData body as text')\n      } else {\n        return Promise.resolve(this._bodyText)\n      }\n    };\n\n    if (support.formData) {\n      this.formData = function() {\n        return this.text().then(decode)\n      };\n    }\n\n    this.json = function() {\n      return this.text().then(JSON.parse)\n    };\n\n    return this\n  }\n\n  // HTTP methods whose capitalization should be normalized\n  var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n  function normalizeMethod(method) {\n    var upcased = method.toUpperCase();\n    return methods.indexOf(upcased) > -1 ? upcased : method\n  }\n\n  function Request(input, options) {\n    options = options || {};\n    var body = options.body;\n\n    if (input instanceof Request) {\n      if (input.bodyUsed) {\n        throw new TypeError('Already read')\n      }\n      this.url = input.url;\n      this.credentials = input.credentials;\n      if (!options.headers) {\n        this.headers = new Headers(input.headers);\n      }\n      this.method = input.method;\n      this.mode = input.mode;\n      this.signal = input.signal;\n      if (!body && input._bodyInit != null) {\n        body = input._bodyInit;\n        input.bodyUsed = true;\n      }\n    } else {\n      this.url = String(input);\n    }\n\n    this.credentials = options.credentials || this.credentials || 'same-origin';\n    if (options.headers || !this.headers) {\n      this.headers = new Headers(options.headers);\n    }\n    this.method = normalizeMethod(options.method || this.method || 'GET');\n    this.mode = options.mode || this.mode || null;\n    this.signal = options.signal || this.signal;\n    this.referrer = null;\n\n    if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n      throw new TypeError('Body not allowed for GET or HEAD requests')\n    }\n    this._initBody(body);\n  }\n\n  Request.prototype.clone = function() {\n    return new Request(this, {body: this._bodyInit})\n  };\n\n  function decode(body) {\n    var form = new FormData();\n    body\n      .trim()\n      .split('&')\n      .forEach(function(bytes) {\n        if (bytes) {\n          var split = bytes.split('=');\n          var name = split.shift().replace(/\\+/g, ' ');\n          var value = split.join('=').replace(/\\+/g, ' ');\n          form.append(decodeURIComponent(name), decodeURIComponent(value));\n        }\n      });\n    return form\n  }\n\n  function parseHeaders(rawHeaders) {\n    var headers = new Headers();\n    // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n    // https://tools.ietf.org/html/rfc7230#section-3.2\n    var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n    preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n      var parts = line.split(':');\n      var key = parts.shift().trim();\n      if (key) {\n        var value = parts.join(':').trim();\n        headers.append(key, value);\n      }\n    });\n    return headers\n  }\n\n  Body.call(Request.prototype);\n\n  function Response(bodyInit, options) {\n    if (!options) {\n      options = {};\n    }\n\n    this.type = 'default';\n    this.status = options.status === undefined ? 200 : options.status;\n    this.ok = this.status >= 200 && this.status < 300;\n    this.statusText = 'statusText' in options ? options.statusText : 'OK';\n    this.headers = new Headers(options.headers);\n    this.url = options.url || '';\n    this._initBody(bodyInit);\n  }\n\n  Body.call(Response.prototype);\n\n  Response.prototype.clone = function() {\n    return new Response(this._bodyInit, {\n      status: this.status,\n      statusText: this.statusText,\n      headers: new Headers(this.headers),\n      url: this.url\n    })\n  };\n\n  Response.error = function() {\n    var response = new Response(null, {status: 0, statusText: ''});\n    response.type = 'error';\n    return response\n  };\n\n  var redirectStatuses = [301, 302, 303, 307, 308];\n\n  Response.redirect = function(url, status) {\n    if (redirectStatuses.indexOf(status) === -1) {\n      throw new RangeError('Invalid status code')\n    }\n\n    return new Response(null, {status: status, headers: {location: url}})\n  };\n\n  exports.DOMException = self.DOMException;\n  try {\n    new exports.DOMException();\n  } catch (err) {\n    exports.DOMException = function(message, name) {\n      this.message = message;\n      this.name = name;\n      var error = Error(message);\n      this.stack = error.stack;\n    };\n    exports.DOMException.prototype = Object.create(Error.prototype);\n    exports.DOMException.prototype.constructor = exports.DOMException;\n  }\n\n  function fetch(input, init) {\n    return new Promise(function(resolve, reject) {\n      var request = new Request(input, init);\n\n      if (request.signal && request.signal.aborted) {\n        return reject(new exports.DOMException('Aborted', 'AbortError'))\n      }\n\n      var xhr = new XMLHttpRequest();\n\n      function abortXhr() {\n        xhr.abort();\n      }\n\n      xhr.onload = function() {\n        var options = {\n          status: xhr.status,\n          statusText: xhr.statusText,\n          headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n        };\n        options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n        var body = 'response' in xhr ? xhr.response : xhr.responseText;\n        resolve(new Response(body, options));\n      };\n\n      xhr.onerror = function() {\n        reject(new TypeError('Network request failed'));\n      };\n\n      xhr.ontimeout = function() {\n        reject(new TypeError('Network request failed'));\n      };\n\n      xhr.onabort = function() {\n        reject(new exports.DOMException('Aborted', 'AbortError'));\n      };\n\n      xhr.open(request.method, request.url, true);\n\n      if (request.credentials === 'include') {\n        xhr.withCredentials = true;\n      } else if (request.credentials === 'omit') {\n        xhr.withCredentials = false;\n      }\n\n      if ('responseType' in xhr && support.blob) {\n        xhr.responseType = 'blob';\n      }\n\n      request.headers.forEach(function(value, name) {\n        xhr.setRequestHeader(name, value);\n      });\n\n      if (request.signal) {\n        request.signal.addEventListener('abort', abortXhr);\n\n        xhr.onreadystatechange = function() {\n          // DONE (success or failure)\n          if (xhr.readyState === 4) {\n            request.signal.removeEventListener('abort', abortXhr);\n          }\n        };\n      }\n\n      xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n    })\n  }\n\n  fetch.polyfill = true;\n\n  if (!self.fetch) {\n    self.fetch = fetch;\n    self.Headers = Headers;\n    self.Request = Request;\n    self.Response = Response;\n  }\n\n  exports.Headers = Headers;\n  exports.Request = Request;\n  exports.Response = Response;\n  exports.fetch = fetch;\n\n  Object.defineProperty(exports, '__esModule', { value: true });\n\n  return exports;\n\n})({});\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n\n\n/***/ }),\n\n/***/ \"./src/isNullResponse.js\":\n/*!*******************************!*\\\n  !*** ./src/isNullResponse.js ***!\n  \\*******************************/\n/*! no static exports found */\n/***/ (function(module, exports) {\n\n/**\n * @param {Response} response the response from fetch()\n * @returns {boolean} true if the response is a \"null response\" where we successfully talked to the\n * source, but the source has no data for us.\n */\nconst isNullResponse = response =>\n// can't access, eg. due to expired/missing project token\nresponse.status === 403 ||\n// assets does not exist\n// assets.scratch.mit.edu also returns 503 for missing assets\nresponse.status === 404 || response.status === 503;\nmodule.exports = isNullResponse;\n\n/***/ }),\n\n/***/ \"./src/safer-fetch.js\":\n/*!****************************!*\\\n  !*** ./src/safer-fetch.js ***!\n  \\****************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* eslint-disable no-use-before-define */\n\nconst {\n  scratchFetch\n} = __webpack_require__(/*! ./scratchFetch */ \"./src/scratchFetch.js\");\n\n// This throttles and retries scratchFetch() to mitigate the effect of random network errors and\n// random browser errors (especially in Chrome)\n\nlet currentFetches = 0;\nconst queue = [];\nconst sleep = ms => new Promise(resolve => setTimeout(resolve, ms));\nconst startNextFetch = _ref => {\n  let [resolve, url, options] = _ref;\n  let failedAttempts = 0;\n\n  /**\n   * @param {Response} result From fetch()\n   */\n  const done = result => {\n    // In macOS WKWebView, requests to file:// URLs return status: 0 and ok: false when they succeed, so we'll\n    // mess with the object so everyone that uses this realizes it succeeded.\n    // If the requests failed (because the file didn't exist) then fetch() rejects instead.\n    if (result.status === 0) {\n      Object.defineProperty(result, 'ok', {\n        value: true\n      });\n      Object.defineProperty(result, 'status', {\n        value: 200\n      });\n    }\n    currentFetches--;\n    checkStartNextFetch();\n    resolve(result);\n  };\n  const attemptToFetch = () => scratchFetch(url, options).then(done).catch(error => {\n    // If fetch() errors, it means there was a network error of some sort.\n    // This is worth retrying, especially as some browser will randomly fail requests\n    // if we send too many at once (as we do).\n\n    console.warn(\"Attempt to fetch \".concat(url, \" failed\"), error);\n    if (failedAttempts < 2) {\n      failedAttempts++;\n      sleep((failedAttempts + Math.random() - 1) * 5000).then(attemptToFetch);\n      return;\n    }\n\n    // The fetch() error is usually very generic, so we'll add enough information\n    // to possibly be useful.\n    done(Promise.reject(new Error(\"Storage request \".concat(url, \" failed: \").concat(error))));\n  });\n  attemptToFetch();\n};\nconst checkStartNextFetch = () => {\n  if (currentFetches < 100 && queue.length > 0) {\n    currentFetches++;\n    startNextFetch(queue.shift());\n  }\n};\nconst saferFetch = (url, options) => new Promise(resolve => {\n  queue.push([resolve, url, options]);\n  checkStartNextFetch();\n});\nmodule.exports = saferFetch;\n\n/***/ }),\n\n/***/ \"./src/scratchFetch.js\":\n/*!*****************************!*\\\n  !*** ./src/scratchFetch.js ***!\n  \\*****************************/\n/*! no static exports found */\n/***/ (function(module, exports, __webpack_require__) {\n\nconst crossFetch = __webpack_require__(/*! cross-fetch */ \"./node_modules/cross-fetch/dist/browser-ponyfill.js\");\n\n/**\n * Metadata header names\n * @enum {string} The enum value is the name of the associated header.\n * @readonly\n */\nconst RequestMetadata = {\n  /** The ID of the project associated with this request */\n  ProjectId: 'X-Project-ID',\n  /** The ID of the project run associated with this request */\n  RunId: 'X-Run-ID'\n};\n\n/**\n * Metadata headers for requests\n * @type {Headers}\n */\nconst metadata = new crossFetch.Headers();\n\n/**\n * Check if there is any metadata to apply.\n * @returns {boolean} true if `metadata` has contents, or false if it is empty.\n */\nconst hasMetadata = () => {\n  /* global self */\n  const searchParams = typeof self !== 'undefined' && self && self.location && self.location.search && self.location.search.split(/[?&]/) || [];\n  if (!searchParams.includes('scratchMetadata=1')) {\n    // for now, disable this feature unless scratchMetadata=1\n    // TODO: remove this check once we're sure the feature works correctly in production\n    return false;\n  }\n  for (const _ of metadata) {\n    return true;\n  }\n  return false;\n};\n\n/**\n * Non-destructively merge any metadata state (if any) with the provided options object (if any).\n * If there is metadata state but no options object is provided, make a new object.\n * If there is no metadata state, return the provided options parameter without modification.\n * If there is metadata and an options object is provided, modify a copy and return it.\n * Headers in the provided options object may override headers generated from metadata state.\n * @param {RequestInit} [options] The initial request options. May be null or undefined.\n * @returns {RequestInit|undefined} the provided options parameter without modification, or a new options object.\n */\nconst applyMetadata = options => {\n  if (hasMetadata()) {\n    const augmentedOptions = Object.assign({}, options);\n    augmentedOptions.headers = new crossFetch.Headers(metadata);\n    if (options && options.headers) {\n      // the Fetch spec says options.headers could be:\n      // \"A Headers object, an object literal, or an array of two-item arrays to set request's headers.\"\n      // turn it into a Headers object to be sure of how to interact with it\n      const overrideHeaders = options.headers instanceof crossFetch.Headers ? options.headers : new crossFetch.Headers(options.headers);\n      for (const [name, value] of overrideHeaders.entries()) {\n        augmentedOptions.headers.set(name, value);\n      }\n    }\n    return augmentedOptions;\n  }\n  return options;\n};\n\n/**\n * Make a network request.\n * This is a wrapper for the global fetch method, adding some Scratch-specific functionality.\n * @param {RequestInfo|URL} resource The resource to fetch.\n * @param {RequestInit} options Optional object containing custom settings for this request.\n * @see {@link https://developer.mozilla.org/docs/Web/API/fetch} for more about the fetch API.\n * @returns {Promise<Response>} A promise for the response to the request.\n */\nconst scratchFetch = (resource, options) => {\n  const augmentedOptions = applyMetadata(options);\n  return crossFetch.fetch(resource, augmentedOptions);\n};\n\n/**\n * Set the value of a named request metadata item.\n * Setting the value to `null` or `undefined` will NOT remove the item.\n * Use `unsetMetadata` for that.\n * @param {RequestMetadata} name The name of the metadata item to set.\n * @param {any} value The value to set (will be converted to a string).\n */\nconst setMetadata = (name, value) => {\n  metadata.set(name, value);\n};\n\n/**\n * Remove a named request metadata item.\n * @param {RequestMetadata} name The name of the metadata item to remove.\n */\nconst unsetMetadata = name => {\n  metadata.delete(name);\n};\nmodule.exports = {\n  default: scratchFetch,\n  Headers: crossFetch.Headers,\n  RequestMetadata,\n  applyMetadata,\n  scratchFetch,\n  setMetadata,\n  unsetMetadata\n};\nif (true) {\n  /**\n   * Retrieve a named request metadata item.\n   * Only for use in tests.\n   * @param {RequestMetadata} name The name of the metadata item to retrieve.\n   * @returns {any} value The value of the metadata item, or `undefined` if it was not found.\n   */\n  const getMetadata = name => metadata.get(name);\n  module.exports.getMetadata = getMetadata;\n}\n\n/***/ })\n\n/******/ });\n//# sourceMappingURL=3385fc4f5b394e2b375c.worker.js.map",n.p+"3385fc4f5b394e2b375c.worker.js")}},"./node_modules/worker-loader/dist/workers/InlineWorker.js":function(e,t,n){"use strict";var r=window.URL||window.webkitURL;e.exports=function(e,t){try{try{var n;try{(n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(e),n=n.getBlob()}catch(t){n=new Blob([e])}return new Worker(r.createObjectURL(n))}catch(t){return new Worker("data:application/javascript,"+encodeURIComponent(e))}}catch(e){if(!t)throw Error("Inline worker is not supported");return new Worker(t)}}},"./src/Asset.js":function(e,t,n){const r=n("./node_modules/js-md5/src/md5.js");let i=null;const s={},o={},a="function"==typeof FinalizationRegistry?new FinalizationRegistry((e=>{const t=o[e];1===t?(delete o[e],delete s[e]):o[e]=t-1})):null,c=a?e=>{const t=e.assetId,n=o[t]||0;o[t]=n+1,a.register(e,t)}:()=>{};e.exports=class{constructor(e,t,n,r,i){this.assetType=e,this.assetId=t,this.setData(r,n||e.runtimeFormat,i),this.dependencies=[],c(this)}setData(e,t,n){if(e&&!t)throw new Error("Data provided without specifying its format");this.dataFormat=t,this.data=e,n&&(this.assetId=r(e)),this.clean=!n}decodeText(){return(new TextDecoder).decode(this.data)}encodeTextData(e,t,n){const r=new TextEncoder;this.setData(r.encode(e),t,n)}encodeDataURI(e){return e=e||this.assetType.contentType,"data:".concat(e,";base64,").concat(((e,t)=>{if(!Object.prototype.hasOwnProperty.call(s,e))if("undefined"==typeof btoa){const r=n("./node_modules/base64-js/index.js");s[e]=r.fromByteArray(t)}else{if(null===i){i=new Array(256);for(let e=0;e<256;e++)i[e]=String.fromCharCode(e)}const{length:n}=t;let r="";for(let e=0,s=0;e<n;e=s){s=Math.min(s+32766,n);let o="";for(let n=e;n<s;n+=1)o+=i[t[n]];r+=btoa(o)}s[e]=r}return s[e]})(this.assetId,this.data))}}},"./src/AssetType.js":function(e,t,n){const r=n("./src/DataFormat.js"),i={ImageBitmap:{contentType:"image/png",name:"ImageBitmap",runtimeFormat:r.PNG,immutable:!0},ImageVector:{contentType:"image/svg+xml",name:"ImageVector",runtimeFormat:r.SVG,immutable:!0},Project:{contentType:"application/json",name:"Project",runtimeFormat:r.JSON,immutable:!1},Sound:{contentType:"audio/x-wav",name:"Sound",runtimeFormat:r.WAV,immutable:!0},Sprite:{contentType:"application/json",name:"Sprite",runtimeFormat:r.JSON,immutable:!0},Font:{contentType:"font/ttf",name:"Font",runtimeFormat:r.TTF,immutable:!0}};e.exports=i},"./src/BuiltinHelper.js":function(e,t,n){(function(t){const r=n("./node_modules/js-md5/src/md5.js"),i=n("./src/Asset.js"),s=n("./src/AssetType.js"),o=n("./src/DataFormat.js"),a=n("./src/Helper.js"),c=[{type:s.ImageBitmap,format:o.PNG,id:null,data:t.from(n("./src/builtins/defaultBitmap.png"))},{type:s.Sound,format:o.WAV,id:null,data:t.from(n("./src/builtins/defaultSound.wav"))},{type:s.ImageVector,format:o.SVG,id:null,data:t.from(n("./src/builtins/defaultVector.svg"))}],l=c.concat([]);e.exports=class extends a{constructor(e){super(e),this.assets={},l.forEach((e=>{e.id=this._store(e.type,e.format,e.data,e.id)}))}registerDefaultAssets(){const e=c.length;for(let t=0;t<e;++t){const e=c[t];this.parent.setDefaultAssetId(e.type,e.id)}}get(e){let t=null;if(Object.prototype.hasOwnProperty.call(this.assets,e)){const n=this.assets[e];t=new i(n.type,n.id,n.format,n.data)}return t}cache(e,t,n,r){return this.store(e,t,n,r)}store(e,t,n,r){return this._store(e,t,n,r)}_store(e,t,n,i){if(!t)throw new Error("Data cached without specifying its format");if(""!==i&&null!=i){if(Object.prototype.hasOwnProperty.call(this.assets,i)&&e.immutable)return i}else{if(!e.immutable)throw new Error("Tried to cache data without an id");i=r(n)}return this.assets[i]={type:e,format:t,id:i,data:n},i}load(e,t){return this.get(t)?Promise.resolve(this.get(t)):null}}}).call(this,n("./node_modules/node-libs-browser/node_modules/buffer/index.js").Buffer)},"./src/DataFormat.js":function(e,t){e.exports={JPG:"jpg",JSON:"json",MP3:"mp3",PNG:"png",SB2:"sb2",SB3:"sb3",SVG:"svg",WAV:"wav",TTF:"ttf",OTF:"otf",WOFF:"woff",WOFF2:"woff2"}},"./src/FetchTool.js":function(e,t,n){var r=n("./node_modules/@babel/runtime/helpers/objectWithoutProperties.js");const i=["url"],s=["url","withCredentials"],{scratchFetch:o}=n("./src/scratchFetch.js"),a=n("./src/safer-fetch.js"),c=n("./src/isNullResponse.js");e.exports=class{get isGetSupported(){return!0}get(e){let{url:t}=e,n=r(e,i);return a(t,Object.assign({method:"GET"},n)).then((e=>e.ok?e.arrayBuffer().then((e=>new Uint8Array(e))):c(e)?null:Promise.reject(e.status)))}get isSendSupported(){return!0}send(e){let{url:t,withCredentials:n=!1}=e,i=r(e,s);return o(t,Object.assign({credentials:n?"include":"omit"},i)).then((e=>e.ok?e.text():Promise.reject(e.status)))}}},"./src/FetchWorkerTool.js":function(e,t,n){var r=n("./node_modules/@babel/runtime/helpers/objectWithoutProperties.js");const i=["url"],{Headers:s,applyMetadata:o}=n("./src/scratchFetch.js");class a{constructor(){this._workerSupport={fetch:"undefined"!=typeof fetch},this._supportError=null,this.worker=null,this.jobs={};try{if(this.isGetSupported){const e=new(n('./node_modules/worker-loader/dist/cjs.js?{"inline":true,"fallback":true}!./src/FetchWorkerTool.worker.js'));e.addEventListener("message",(e=>{let{data:t}=e;if(t.support)this._workerSupport=t.support;else for(const e of t)this.jobs[e.id]&&(e.error?this.jobs[e.id].reject(e.error):this.jobs[e.id].resolve(e.buffer),delete this.jobs[e.id])})),this.worker=e}}catch(e){this._supportError=e}}get isGetSupported(){return"undefined"!=typeof Worker&&this._workerSupport.fetch&&!this._supportError}get(e){let{url:t}=e,n=r(e,i);return new Promise(((e,r)=>{const i=Math.random().toString(16).substring(2),a=o(Object.assign({method:"GET"},n));a&&a.headers instanceof s&&(a.headers=Array.from(a.headers.entries())),this.worker.postMessage({id:i,url:t,options:a}),this.jobs[i]={id:i,resolve:e,reject:r}})).then((e=>e?new Uint8Array(e):null))}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}static get instance(){return this._instance||(this._instance=new a),this._instance}}e.exports=class{constructor(){this.inner=a.instance}get isGetSupported(){return this.inner.isGetSupported}get(e){return this.inner.get(e)}get isSendSupported(){return!1}send(){throw new Error("Not implemented.")}}},"./src/Helper.js":function(e,t){e.exports=class{constructor(e){this.parent=e}load(e,t,n){return Promise.reject(new Error("No asset of type ".concat(e," for ID ").concat(t," with format ").concat(n)))}}},"./src/ProxyTool.js":function(e,t,n){const r=n("./src/FetchWorkerTool.js"),i=n("./src/FetchTool.js");class s{constructor(){let e;e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:s.TOOL_FILTER.ALL)===s.TOOL_FILTER.READY?[new i]:[new r,new i],this.tools=e}get isGetSupported(){return this.tools.some((e=>e.isGetSupported))}get(e){let t=0;const n=r=>{const i=this.tools[t++];if(!i)throw r;return i.isGetSupported?i.get(e).catch(n):n(r)};return n()}get isSendSupported(){return this.tools.some((e=>e.isSendSupported))}send(e){let t=0;const n=r=>{const i=this.tools[t++];if(!i)throw r;return i.isSendSupported?i.send(e).catch(n):n(r)};return n()}}s.TOOL_FILTER={ALL:"all",READY:"ready"},e.exports=s},"./src/ScratchStorage.js":function(e,t,n){const r=n("./src/BuiltinHelper.js"),i=n("./src/WebHelper.js"),s=n("./src/Asset.js"),o=n("./src/AssetType.js"),a=n("./src/DataFormat.js"),c=n("./src/scratchFetch.js");e.exports=class{constructor(){this.defaultAssetId={},this.builtinHelper=new r(this),this.webHelper=new i(this),this.builtinHelper.registerDefaultAssets(this),this._helpers=[{helper:this.builtinHelper,priority:100},{helper:this.webHelper,priority:-100}]}get Asset(){return s}get AssetType(){return o}get DataFormat(){return a}get scratchFetch(){return c}static get Asset(){return s}static get AssetType(){return o}addHelper(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this._helpers.push({helper:e,priority:t}),this._helpers.sort(((e,t)=>t.priority-e.priority))}get(e){return this.builtinHelper.get(e)}cache(e,t,n,r){return this.builtinHelper._store(e,t,n,r)}createAsset(e,t,n,r,i){if(!t)throw new Error("Tried to create asset without a dataFormat");return new s(e,r,t,n,i)}addWebStore(e,t,n,r){this.webHelper.addStore(e,t,n,r)}addWebSource(e,t){this.addWebStore(e,t)}getDefaultAssetId(e){if(Object.prototype.hasOwnProperty.call(this.defaultAssetId,e.name))return this.defaultAssetId[e.name]}setDefaultAssetId(e,t){this.defaultAssetId[e.name]=t}load(e,t,n){const r=this._helpers.map((e=>e.helper)),i=[];n=n||e.runtimeFormat;let s,o=0;const a=c=>{if(c&&i.push(c),s=r[o++],s){const r=s.load(e,t,n);return null===r?a():r.catch(a)}return i.length>0?Promise.reject(i):Promise.resolve(null)};return a()}store(e,t,n,r){return t=t||e.runtimeFormat,new Promise(((i,s)=>this.webHelper.store(e,t,n,r).then((r=>(this.builtinHelper._store(e,t,n,r.id),i(r)))).catch((e=>s(e)))))}}},"./src/WebHelper.js":function(e,t,n){const r=n("./src/Asset.js"),i=n("./src/Helper.js"),s=n("./src/ProxyTool.js"),o=e=>"string"==typeof e?{url:e}:e;e.exports=class extends i{constructor(e){super(e),this.stores=[],this.assetTool=new s,this.projectTool=new s(s.TOOL_FILTER.READY)}addSource(e,t){this.addStore(e,t)}addStore(e,t,n,r){this.stores.push({types:e.map((e=>e.name)),get:t,create:n,update:r})}load(e,t,n){const i=[],s=this.stores.slice().filter((t=>t.types.indexOf(e.name)>=0)),a=new r(e,t,n);let c=this.assetTool;"Project"===e.name&&(c=this.projectTool);let l=0;const u=e=>{e&&i.push(e);const t=s[l++],r=t&&t.get;if(r){const e=o(r(a));return!1===e?u():c.get(e).then((e=>e?(a.setData(e,n),a):u())).catch(u)}return i.length>0?Promise.reject(i):Promise.resolve(null)};return u()}store(e,t,n,i){const s=new r(e,i,t),a=""===i||null==i,c=this.stores.filter((t=>-1!==t.types.indexOf(e.name)&&(a&&t.create||t.update)))[0],l=a?"post":"put";if(!c)return Promise.reject(new Error("No appropriate stores"));let u=this.assetTool;"Project"===e.name&&(u=this.projectTool);const h=o(a?c.create(s):c.update(s)),d=Object.assign({body:n,method:l},h);return u.send(d).then((e=>{if("string"==typeof e)try{e=JSON.parse(e)}catch(t){return e}return Object.assign({id:e["content-name"]||i},e)}))}}},"./src/builtins/defaultBitmap.png":function(e,t,n){e.exports=n("./node_modules/arraybuffer-loader/lib/to-array-buffer.js")("iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAAAAADmVT4XAAADZElEQVR42u3a70vbQBgH8O/7vOibvsmbFUEEWUGGUhQ25nDuhSKIUFDxlYi0SAd94atRmFiHCH2x4W8iiNtwowXRgd1QipJYY3N/1F4kTQ6XLKS9yyHcvWyO8MnT5y53Tw5EcIMESIAESIAESIAESIAEPFVAq/6l8G4oAQCp4aniwbUVJ6BVzafwqKXy1VZMgNb+CHzbyK4ZB+Bi0nnk0VyhsDiSoAmvvnMHmGUVAF6UG+0ffsxRhsRHky/AyCsAUpumX0wAAIs6T4CxDADDtcdZsal6gjmdH8AsAEC6+s8Fa48SFExeAKusAEju+V367AmUCi9ANQ0AU3pwcOw2cMEH0FwAAKz5X228pRLR5AI4TgIAtIDL24oLUE94AB6W7LsH/cONN14Ilh44AOqD9s2LQR1KHiB9zgGgOSGeuA3ocPrME1Q4ANaceyePAzrcjHmAZYs9IBeW4/fzHiAwTCwAgTle9ACZK44ALDT9e6x7gL4aT0BQCHb4AqgA5/1TTOMLoJ7vZSMM0H/GHnCeDnu+CrU8vGYPcN5FADBYD0vCaYPDy+i0p337GSMsS1Z4vA3t9QgAZTt0IuIxFRPSKicAQHlvhk3FXF5GhBByMa8qo/sBO6BarwuYbYrYnFKDYEvE7phKgcxvEQBqnvhgiQCUOgoAO4C3JOS3L/hv23UXxVldBECfcueAqpAa0WGy/QeULREAY6aTXRFDgBuA13+ElOncAERMAGaA9hBQD4gQQHsIRE1AZoD2xrgQS5nOZyHgFKmWDSIG4GRAVidiAE4GRB6AzAB2AKIPQFaA5myHA5AV4ESNugZhC7BLR50lIBPAebrzBGQCKAFQNSIMcDvRTQIwAHxNApM3RBygGK0uyhxwOwGsPAgEnPWj5ycRCNiJtBHlAChGKQVwANzPY+CXSMDNWISiLA9AfRA5IhJQ68UnoQAt+AtOPIBKhJosF8B6UM0yLkAxQk2WCyDX9SiUh1gkQAIkoCuAvjGuquMbuijAtwG7MPL8yBICOHSPk3W8Ne8KcEUdmBi6FADYos+QleIH0N/ogOxd7AD6uAS6WRU8WcBdlgZMG/EnYUlwEpLLoQ4PjzGbiA5UsRMRsbQ+5ziDJmYqJuR6NaMomdXuFuZyPSABEiABEiABEiABEiAc8Bd6VyvCEKGqcQAAAABJRU5ErkJggg==")},"./src/builtins/defaultSound.wav":function(e,t,n){e.exports=n("./node_modules/arraybuffer-loader/lib/to-array-buffer.js")("UklGRiYAAABXQVZFZm10IBAAAAABAAEAIlYAAESsAAACABAAZGF0YQIAAAAAAA==")},"./src/builtins/defaultVector.svg":function(e,t,n){e.exports=n("./node_modules/arraybuffer-loader/lib/to-array-buffer.js")("PD94bWwgdmVyc2lvbj0iMS4wIj8+Cjxzdmcgd2lkdGg9IjEyOCIgaGVpZ2h0PSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6c3ZnPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CiA8Zz4KICA8cmVjdCBmaWxsPSIjQ0NDIiBoZWlnaHQ9IjEyOCIgd2lkdGg9IjEyOCIvPgogIDx0ZXh0IGZpbGw9ImJsYWNrIiB5PSIxMDciIHg9IjM1LjUiIGZvbnQtc2l6ZT0iMTI4Ij4/PC90ZXh0PgogPC9nPgo8L3N2Zz4K")},"./src/index.js":function(e,t,n){const r=n("./src/ScratchStorage.js");e.exports=r},"./src/isNullResponse.js":function(e,t){e.exports=e=>403===e.status||404===e.status||503===e.status},"./src/safer-fetch.js":function(e,t,n){const{scratchFetch:r}=n("./src/scratchFetch.js");let i=0;const s=[],o=e=>{let[t,n,s]=e,o=0;const c=e=>{0===e.status&&(Object.defineProperty(e,"ok",{value:!0}),Object.defineProperty(e,"status",{value:200})),i--,a(),t(e)},l=()=>r(n,s).then(c).catch((e=>{if(console.warn("Attempt to fetch ".concat(n," failed"),e),o<2)return o++,void(t=5e3*(o+Math.random()-1),new Promise((e=>setTimeout(e,t)))).then(l);var t;c(Promise.reject(new Error("Storage request ".concat(n," failed: ").concat(e))))}));l()},a=()=>{i<100&&s.length>0&&(i++,o(s.shift()))};e.exports=(e,t)=>new Promise((n=>{s.push([n,e,t]),a()}))},"./src/scratchFetch.js":function(e,t,n){const r=n("./node_modules/cross-fetch/dist/browser-ponyfill.js"),i=new r.Headers,s=e=>{if((()=>{if(!("undefined"!=typeof self&&self&&self.location&&self.location.search&&self.location.search.split(/[?&]/)||[]).includes("scratchMetadata=1"))return!1;for(const e of i)return!0;return!1})()){const t=Object.assign({},e);if(t.headers=new r.Headers(i),e&&e.headers){const n=e.headers instanceof r.Headers?e.headers:new r.Headers(e.headers);for(const[e,r]of n.entries())t.headers.set(e,r)}return t}return e},o=(e,t)=>{const n=s(t);return r.fetch(e,n)};e.exports={default:o,Headers:r.Headers,RequestMetadata:{ProjectId:"X-Project-ID",RunId:"X-Run-ID"},applyMetadata:s,scratchFetch:o,setMetadata:(e,t)=>{i.set(e,t)},unsetMetadata:e=>{i.delete(e)}};{const t=e=>i.get(e);e.exports.getMetadata=t}}})},module.exports=factory()},function(e,t,n){const r=n(287);e.exports=r},function(e,t,n){const r=n(52);e.exports=class extends r{get DEFAULT_VALUE(){return 100}get name(){return"volume"}initialize(){this.inputNode=this.audioEngine.audioContext.createGain(),this.outputNode=this.inputNode,this.initialized=!0}_set(e){this.value=e;const{gain:t}=this.outputNode,{currentTime:n,DECAY_DURATION:r}=this.audioEngine;t.linearRampToValueAtTime(e/100,n+r)}dispose(){this.initialized&&(this.outputNode.disconnect(),this.inputNode=null,this.outputNode=null,this.target=null,this.initialized=!1)}}},function(e,t,n){"use strict";var r,i=function(){return void 0===r&&(r=Boolean(window&&document&&document.all&&!window.atob)),r},s=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),o=[];function a(e){for(var t=-1,n=0;n<o.length;n++)if(o[n].identifier===e){t=n;break}return t}function c(e,t){for(var n={},r=[],i=0;i<e.length;i++){var s=e[i],c=t.base?s[0]+t.base:s[0],l=n[c]||0,u="".concat(c," ").concat(l);n[c]=l+1;var h=a(u),d={css:s[1],media:s[2],sourceMap:s[3]};-1!==h?(o[h].references++,o[h].updater(d)):o.push({identifier:u,updater:g(d,t),references:1}),r.push(u)}return r}function l(e){var t=document.createElement("style"),r=e.attributes||{};if(void 0===r.nonce){var i=n.nc;i&&(r.nonce=i)}if(Object.keys(r).forEach((function(e){t.setAttribute(e,r[e])})),"function"==typeof e.insert)e.insert(t);else{var o=s(e.insert||"head");if(!o)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");o.appendChild(t)}return t}var u,h=(u=[],function(e,t){return u[e]=t,u.filter(Boolean).join("\n")});function d(e,t,n,r){var i=n?"":r.media?"@media ".concat(r.media," {").concat(r.css,"}"):r.css;if(e.styleSheet)e.styleSheet.cssText=h(t,i);else{var s=document.createTextNode(i),o=e.childNodes;o[t]&&e.removeChild(o[t]),o.length?e.insertBefore(s,o[t]):e.appendChild(s)}}function p(e,t,n){var r=n.css,i=n.media,s=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),s&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleSheet)e.styleSheet.cssText=r;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(r))}}var f=null,m=0;function g(e,t){var n,r,i;if(t.singleton){var s=m++;n=f||(f=l(t)),r=d.bind(null,n,s,!1),i=d.bind(null,n,s,!0)}else n=l(t),r=p.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return r(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;r(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var r=0;r<n.length;r++){var i=a(n[r]);o[i].references--}for(var s=c(e,t),l=0;l<n.length;l++){var u=a(n[l]);0===o[u].references&&(o[u].updater(),o.splice(u,1))}n=s}}}},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=e(t);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,r){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(r)for(var s=0;s<this.length;s++){var o=this[s][0];null!=o&&(i[o]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);r&&i[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},function(e,t,n){"use strict";e.exports=function(e,t){return t||(t={}),"string"!=typeof(e=e&&e.__esModule?e.default:e)?e:(/^['"].*['"]$/.test(e)&&(e=e.slice(1,-1)),t.hash&&(e+=t.hash),/["'() \t\n]/.test(e)||t.needQuotes?'"'.concat(e.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):e)}},function(e,t,n){"use strict";t.a="data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIwIDAgMjQgMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIwLjc3MzU5NSA1LjcyODA1MTlhMS4zMDc3Nzc0IDEuMzA3Nzc3NCAwIDAgMC0xLjg1NzA0MyAwTDkuMTczNjEwNSAxNS40ODQwNzFsLTQuMDkzMzQzMi00LjEwNjQyYTEuMzM2NDQ2OCAxLjMzNjQ0NjggMCAxIDAtMS44NTcwNDM5IDEuOTIyNDMybDUuMDIxODY1MSA1LjAyMTg2NmExLjMwNzc3NzQgMS4zMDc3Nzc0IDAgMCAwIDEuODU3MDQ0NSAwTDIwLjc3MzU5NSA3LjY1MDQ4NDdhMS4zMDc3Nzc0IDEuMzA3Nzc3NCAwIDAgMCAwLTEuOTIyNDMyOHoiIGZpbGw9IiNmZmYiLz48L3N2Zz4="},function(e){e.exports=JSON.parse('{"var-x":"x position","var-y":"y position","var-direction":"direction","var-username":"username","var-costume-number":"costume number","var-costume-name":"costume name","var-backdrop-number":"backdrop number","var-backdrop-name":"backdrop name","var-size":"size","var-answer":"answer","var-mousedown":"mouse down?","var-mousex":"mouse x","var-mousey":"mouse y","var-loudness":"loudness","var-timer":"timer","var-dayssince2000":"days since 2000","var-volume":"volume","var-year":"year","var-month":"month","var-date":"date","var-day-of-week":"day of week","var-hour":"hour","var-minute":"minute","var-second":"second","list-empty":"(empty)","list-length":"length {n}","list-import":"import","list-export":"export"}')},function(e,t,n){"use strict";t.byteLength=function(e){var t=c(e),n=t[0],r=t[1];return 3*(n+r)/4-r},t.toByteArray=function(e){for(var t,n=c(e),r=n[0],o=n[1],a=new s(function(e,t,n){return 3*(t+n)/4-n}(0,r,o)),l=0,u=o>0?r-4:r,h=0;h<u;h+=4)t=i[e.charCodeAt(h)]<<18|i[e.charCodeAt(h+1)]<<12|i[e.charCodeAt(h+2)]<<6|i[e.charCodeAt(h+3)],a[l++]=t>>16&255,a[l++]=t>>8&255,a[l++]=255&t;2===o&&(t=i[e.charCodeAt(h)]<<2|i[e.charCodeAt(h+1)]>>4,a[l++]=255&t);1===o&&(t=i[e.charCodeAt(h)]<<10|i[e.charCodeAt(h+1)]<<4|i[e.charCodeAt(h+2)]>>2,a[l++]=t>>8&255,a[l++]=255&t);return a},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=16383,a=0,c=n-i;a<c;a+=o)s.push(l(e,a,a+o>c?c:a+o));1===i?(t=e[n-1],s.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],s.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],i[o.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,s,o=[],a=t;a<n;a+=3)i=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,r,i){var s,o,a=8*i-r-1,c=(1<<a)-1,l=c>>1,u=-7,h=n?i-1:0,d=n?-1:1,p=e[t+h];for(h+=d,s=p&(1<<-u)-1,p>>=-u,u+=a;u>0;s=256*s+e[t+h],h+=d,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=r;u>0;o=256*o+e[t+h],h+=d,u-=8);if(0===s)s=1-l;else{if(s===c)return o?NaN:1/0*(p?-1:1);o+=Math.pow(2,r),s-=l}return(p?-1:1)*o*Math.pow(2,s-r)},t.write=function(e,t,n,r,i,s){var o,a,c,l=8*s-i-1,u=(1<<l)-1,h=u>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:s-1,f=r?1:-1,m=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),(t+=o+h>=1?d/c:d*Math.pow(2,1-h))*c>=2&&(o++,c/=2),o+h>=u?(a=0,o=u):o+h>=1?(a=(t*c-1)*Math.pow(2,i),o+=h):(a=t*Math.pow(2,h-1)*Math.pow(2,i),o=0));i>=8;e[n+p]=255&a,p+=f,a/=256,i-=8);for(o=o<<i|a,l+=i;l>0;e[n+p]=255&o,p+=f,o/=256,l-=8);e[n+p-f]|=128*m}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){(function(e){var r=void 0!==e&&e||"undefined"!=typeof self&&self||window,i=Function.prototype.apply;function s(e,t){this._id=e,this._clearFn=t}t.setTimeout=function(){return new s(i.call(setTimeout,r,arguments),clearTimeout)},t.setInterval=function(){return new s(i.call(setInterval,r,arguments),clearInterval)},t.clearTimeout=t.clearInterval=function(e){e&&e.close()},s.prototype.unref=s.prototype.ref=function(){},s.prototype.close=function(){this._clearFn.call(r,this._id)},t.enroll=function(e,t){clearTimeout(e._idleTimeoutId),e._idleTimeout=t},t.unenroll=function(e){clearTimeout(e._idleTimeoutId),e._idleTimeout=-1},t._unrefActive=t.active=function(e){clearTimeout(e._idleTimeoutId);var t=e._idleTimeout;t>=0&&(e._idleTimeoutId=setTimeout((function(){e._onTimeout&&e._onTimeout()}),t))},n(102),t.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==e&&e.setImmediate||this&&this.setImmediate,t.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==e&&e.clearImmediate||this&&this.clearImmediate}).call(this,n(8))},function(e,t,n){(function(e,t){!function(e){"use strict";if(!e.setImmediate){var n,r,i,s,o,a=1,c={},l=!1,u=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,"[object process]"==={}.toString.call(e.process)?n=function(e){t.nextTick((function(){p(e)}))}:!function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){p(e.data)},n=function(e){i.port2.postMessage(e)}):u&&"onreadystatechange"in u.createElement("script")?(r=u.documentElement,n=function(e){var t=u.createElement("script");t.onreadystatechange=function(){p(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):n=function(e){setTimeout(p,0,e)}:(s="setImmediate$"+Math.random()+"$",o=function(t){t.source===e&&"string"==typeof t.data&&0===t.data.indexOf(s)&&p(+t.data.slice(s.length))},e.addEventListener?e.addEventListener("message",o,!1):e.attachEvent("onmessage",o),n=function(t){e.postMessage(s+t,"*")}),h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),r=0;r<t.length;r++)t[r]=arguments[r+1];var i={callback:e,args:t};return c[a]=i,n(a),a++},h.clearImmediate=d}function d(e){delete c[e]}function p(e){if(l)setTimeout(p,0,e);else{var t=c[e];if(t){l=!0;try{!function(e){var t=e.callback,n=e.args;switch(n.length){case 0:t();break;case 1:t(n[0]);break;case 2:t(n[0],n[1]);break;case 3:t(n[0],n[1],n[2]);break;default:t.apply(void 0,n)}}(t)}finally{d(e),l=!1}}}}}("undefined"==typeof self?void 0===e?this:e:self)}).call(this,n(8),n(38))},function(e,t,n){let r;r="undefined"==typeof TextEncoder?n(21).TextEncoder:TextEncoder;const i=n(19),s=n(22),o=n(18).Buffer,a=n(55),c=n(106),l=n(0),u=n(4),h=n(42),d=n(47),p=n(49),f=n(6),m=n(5),g=n(9),b=n(80),{loadCostume:y}=n(34),{loadSound:E}=n(33),{serializeSounds:T,serializeCostumes:v}=n(253);n(254);const{exportCostume:A}=n(79),w=n(16),S=["_mouse_","_stage_","_edge_","_myself_","_random_"],k=[];m.setup({missingTranslation:"ignore"});e.exports=class extends i{constructor(){super(),this.runtime=new h,a.setService("runtime",(e=>{const t={};return t._refreshExtensionPrimitives=e._refreshExtensionPrimitives.bind(e),t._registerExtensionPrimitives=e._registerExtensionPrimitives.bind(e),t})(this.runtime)).catch((e=>{l.error("Failed to register runtime service: ".concat(JSON.stringify(e)))})),this.editingTarget=null,this._dragTarget=null,this.runtime.on(h.SCRIPT_GLOW_ON,(e=>{this.emit(h.SCRIPT_GLOW_ON,e)})),this.runtime.on(h.SCRIPT_GLOW_OFF,(e=>{this.emit(h.SCRIPT_GLOW_OFF,e)})),this.runtime.on(h.BLOCK_GLOW_ON,(e=>{this.emit(h.BLOCK_GLOW_ON,e)})),this.runtime.on(h.BLOCK_GLOW_OFF,(e=>{this.emit(h.BLOCK_GLOW_OFF,e)})),this.runtime.on(h.PROJECT_START,(()=>{this.emit(h.PROJECT_START)})),this.runtime.on(h.PROJECT_RUN_START,(()=>{this.emit(h.PROJECT_RUN_START)})),this.runtime.on(h.PROJECT_RUN_STOP,(()=>{this.emit(h.PROJECT_RUN_STOP)})),this.runtime.on(h.PROJECT_CHANGED,(()=>{this.emit(h.PROJECT_CHANGED)})),this.runtime.on(h.VISUAL_REPORT,(e=>{this.emit(h.VISUAL_REPORT,e)})),this.runtime.on(h.TARGETS_UPDATE,(e=>{this.emitTargetsUpdate(e)})),this.runtime.on(h.MONITORS_UPDATE,(e=>{this.emit(h.MONITORS_UPDATE,e)})),this.runtime.on(h.BLOCK_DRAG_UPDATE,(e=>{this.emit(h.BLOCK_DRAG_UPDATE,e)})),this.runtime.on(h.BLOCK_DRAG_END,((e,t)=>{this.emit(h.BLOCK_DRAG_END,e,t)})),this.runtime.on(h.EXTENSION_ADDED,(e=>{this.emit(h.EXTENSION_ADDED,e)})),this.runtime.on(h.EXTENSION_FIELD_ADDED,((e,t)=>{this.emit(h.EXTENSION_FIELD_ADDED,e,t)})),this.runtime.on(h.BLOCKSINFO_UPDATE,(e=>{this.emit(h.BLOCKSINFO_UPDATE,e)})),this.runtime.on(h.BLOCKS_NEED_UPDATE,(()=>{this.emitWorkspaceUpdate()})),this.runtime.on(h.TOOLBOX_EXTENSIONS_NEED_UPDATE,(()=>{this.extensionManager.refreshBlocks()})),this.runtime.on(h.PERIPHERAL_LIST_UPDATE,(e=>{this.emit(h.PERIPHERAL_LIST_UPDATE,e)})),this.runtime.on(h.USER_PICKED_PERIPHERAL,(e=>{this.emit(h.USER_PICKED_PERIPHERAL,e)})),this.runtime.on(h.PERIPHERAL_CONNECTED,(()=>this.emit(h.PERIPHERAL_CONNECTED))),this.runtime.on(h.PERIPHERAL_REQUEST_ERROR,(()=>this.emit(h.PERIPHERAL_REQUEST_ERROR))),this.runtime.on(h.PERIPHERAL_DISCONNECTED,(()=>this.emit(h.PERIPHERAL_DISCONNECTED))),this.runtime.on(h.PERIPHERAL_CONNECTION_LOST_ERROR,(e=>this.emit(h.PERIPHERAL_CONNECTION_LOST_ERROR,e))),this.runtime.on(h.PERIPHERAL_SCAN_TIMEOUT,(()=>this.emit(h.PERIPHERAL_SCAN_TIMEOUT))),this.runtime.on(h.MIC_LISTENING,(e=>{this.emit(h.MIC_LISTENING,e)})),this.runtime.on(h.RUNTIME_STARTED,(()=>{this.emit(h.RUNTIME_STARTED)})),this.runtime.on(h.RUNTIME_STOPPED,(()=>{this.emit(h.RUNTIME_STOPPED)})),this.runtime.on(h.HAS_CLOUD_DATA_UPDATE,(e=>{this.emit(h.HAS_CLOUD_DATA_UPDATE,e)})),this.runtime.on(h.RUNTIME_OPTIONS_CHANGED,(e=>{this.emit(h.RUNTIME_OPTIONS_CHANGED,e)})),this.runtime.on(h.COMPILER_OPTIONS_CHANGED,(e=>{this.emit(h.COMPILER_OPTIONS_CHANGED,e)})),this.runtime.on(h.FRAMERATE_CHANGED,(e=>{this.emit(h.FRAMERATE_CHANGED,e)})),this.runtime.on(h.INTERPOLATION_CHANGED,(e=>{this.emit(h.INTERPOLATION_CHANGED,e)})),this.runtime.on(h.STAGE_SIZE_CHANGED,((e,t)=>{this.emit(h.STAGE_SIZE_CHANGED,e,t)})),this.runtime.on(h.COMPILE_ERROR,((e,t)=>{this.emit(h.COMPILE_ERROR,e,t)})),this.runtime.on(h.ASSET_PROGRESS,((e,t)=>{this.emit(h.ASSET_PROGRESS,e,t)})),this.runtime.on(h.TURBO_MODE_OFF,(()=>{this.emit(h.TURBO_MODE_OFF)})),this.runtime.on(h.TURBO_MODE_ON,(()=>{this.emit(h.TURBO_MODE_ON)})),this.extensionManager=new c(this),this.securityManager=this.extensionManager.securityManager,this.runtime.extensionManager=this.extensionManager;for(const e of k)this.extensionManager.loadExtensionIdSync(e);this.blockListener=this.blockListener.bind(this),this.flyoutBlockListener=this.flyoutBlockListener.bind(this),this.monitorBlockListener=this.monitorBlockListener.bind(this),this.variableListener=this.variableListener.bind(this),this.exports={Sprite:p,RenderedTarget:d,JSZip:s,Variable:g,these_broke_before_and_will_break_again:()=>(console.warn("You are using unsupported APIs. WHEN your code breaks, do not expect help."),{JSGenerator:n(67),IRGenerator:n(44).IRGenerator,ScriptTreeGenerator:n(44).ScriptTreeGenerator,IntermediateStackBlock:n(10).IntermediateStackBlock,IntermediateInput:n(10).IntermediateInput,IntermediateStack:n(10).IntermediateStack,IntermediateScript:n(10).IntermediateScript,IntermediateRepresentation:n(10).IntermediateRepresentation,StackOpcode:n(15).StackOpcode,InputOpcode:n(15).InputOpcode,InputType:n(15).InputType,Thread:n(20),execute:n(32)}),i_will_not_ask_for_help_when_these_break:()=>{this.emit("LEGACY_EXTENSION_API","i_will_not_ask_for_help_when_these_break");const e=n(45);return e.enabled=!0,{IRGenerator:e.IRGeneratorStub,ScriptTreeGenerator:e.ScriptTreeGeneratorStub,JSGenerator:e.JSGeneratorStub,Thread:n(20),execute:n(32)}}}}start(){this.runtime.start()}stop(){this.quit()}quit(){this.runtime.quit()}greenFlag(){this.runtime.greenFlag()}setTurboMode(e){this.runtime.turboMode=!!e,this.runtime.turboMode?this.emit(h.TURBO_MODE_ON):this.emit(h.TURBO_MODE_OFF)}setCompatibilityMode(e){this.runtime.setCompatibilityMode(!!e)}setFramerate(e){this.runtime.setFramerate(e)}setInterpolation(e){this.runtime.setInterpolation(e)}setRuntimeOptions(e){this.runtime.setRuntimeOptions(e)}setCompilerOptions(e){this.runtime.setCompilerOptions(e)}setStageSize(e,t){this.runtime.setStageSize(e,t)}setInEditor(e){this.runtime.setInEditor(e)}convertToPackagedRuntime(){this.runtime.convertToPackagedRuntime()}addAddonBlock(e){this.runtime.addAddonBlock(e)}getAddonBlock(e){return this.runtime.getAddonBlock(e)}storeProjectOptions(){this.runtime.storeProjectOptions(),this.editingTarget.isStage&&this.emitWorkspaceUpdate()}enableDebug(){return this.runtime.enableDebug(),"enabled debug mode"}handleExtensionButtonPress(e){this.runtime.handleExtensionButtonPress(e)}stopAll(){this.runtime.stopAll()}clear(){this.runtime.dispose(),this.editingTarget=null,this.emitTargetsUpdate(!1)}getPlaygroundData(){const e=this,t=this.runtime.threads.filter((t=>t.target===e.editingTarget)),n=JSON.stringify(t,((e,t)=>{if("target"!==e&&"blockContainer"!==e)return t}),2);this.emit("playgroundData",{blocks:this.editingTarget.blocks,threads:n})}postIOData(e,t){this.runtime.ioDevices[e]&&this.runtime.ioDevices[e].postData(t)}setVideoProvider(e){this.runtime.ioDevices.video.setProvider(e)}setCloudProvider(e){this.runtime.ioDevices.cloud.setProvider(e)}scanForPeripheral(e){this.runtime.scanForPeripheral(e)}connectPeripheral(e,t){this.runtime.connectPeripheral(e,t)}disconnectPeripheral(e){this.runtime.disconnectPeripheral(e)}getPeripheralIsConnected(e){return this.runtime.getPeripheralIsConnected(e)}loadProject(e){"object"!=typeof e||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||(e=JSON.stringify(e));return new Promise(((t,r)=>{n(81)(e,!1,((e,n)=>{if(e)return r(e);t(n)}))})).catch((t=>{const{SB1File:r,ValidationError:i}=n(299);try{const t=new r(e),n=t.json;return n.projectVersion=2,Promise.resolve([n,t.zip])}catch(e){if(!(e instanceof i||"".concat(e).includes("Non-ascii character in FixedAsciiString")))return Promise.reject(e)}return Promise.reject(t)})).then((e=>this.deserializeProject(e[0],e[1]))).then((()=>this.runtime.handleProjectLoaded())).catch((e=>Object.prototype.hasOwnProperty.call(e,"validationError")?Promise.reject(JSON.stringify(e)):Promise.reject(e)))}downloadProjectId(e){const t=this.runtime.storage;if(!t)return void l.error("No storage module present; cannot load project: ",e);const n=this;t.load(t.AssetType.Project,e).then((t=>t?n.loadProject(t.data):(l.error("Failed to fetch project with id: ".concat(e)),null)))}_saveProjectZip(){const e=this.toJSON(),t=new s;t.file("project.json",e),this._addFileDescsToZip(this.serializeAssets(),t);const n=new Date(1591657163e3);for(const e of Object.values(t.files))e.date=n;const r=[".json",".svg",".wav",".ttf",".otf"];for(const e of Object.values(t.files))r.some((t=>e.name.endsWith(t)))?e.options.compression="DEFLATE":e.options.compression="STORE";return t}saveProjectSb3(e){return this._saveProjectZip().generateAsync({type:e||"blob",mimeType:"application/x.scratch.sb3"})}saveProjectSb3Stream(e){return this._saveProjectZip().generateInternalStream({type:e||"arraybuffer",mimeType:"application/x.scratch.sb3",compression:"DEFLATE"})}saveProjectSb3DontZip(){const e=this.toJSON(),t={"project.json":(new r).encode(e)};for(const e of this.serializeAssets())t[e.fileName]=e.fileContent;return t}get assets(){return[...this.runtime.targets.reduce(((e,t)=>e.concat(t.sprite.sounds.map((e=>e.asset))).concat(t.sprite.costumes.map((e=>e.asset)))),[]),...this.runtime.fontManager.serializeAssets()]}serializeAssets(e){return[...v(this.runtime,e),...T(this.runtime,e),...this.runtime.fontManager.serializeAssets().map((e=>({fileName:"".concat(e.assetId,".").concat(e.dataFormat),fileContent:e.data})))]}_addFileDescsToZip(e,t){for(let n=0;n<e.length;n++){const r=e[n];t.file(r.fileName,r.fileContent)}}exportSprite(e,t){const n=this.toJSON(e),r=new s;return r.file("sprite.json",n),this._addFileDescsToZip(this.serializeAssets(e),r),r.generateAsync({type:"string"==typeof t?t:"blob",mimeType:"application/x.scratch.sprite3",compression:"DEFLATE",compressionOptions:{level:6}})}toJSON(e,t){const r=n(26);return f.stringify(r.serialize(this.runtime,e,t))}fromJSON(e){return l.warn("fromJSON is now just a wrapper around loadProject, please use that function instead."),this.loadProject(e)}deserializeProject(e,t){this.clear(),"undefined"!=typeof performance&&performance.mark("scratch-vm-deserialize-start");const r=this.runtime;return function(){const i=e.projectVersion;if(2===i){return n(83).deserialize(e,r,!1,t)}if(3===i){return n(26).deserialize(e,r,t)}return Promise.reject("Unable to verify Scratch Project version.")}().then((e=>{let{targets:t,extensions:n}=e;if("undefined"!=typeof performance){performance.mark("scratch-vm-deserialize-end");try{performance.measure("scratch-vm-deserialize","scratch-vm-deserialize-start","scratch-vm-deserialize-end")}catch(e){l.error(e)}}return this.installTargets(t,n,!0)}))}async _loadExtensions(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:new Map;const r=n(262),i=[];for(const n of e)if(this.extensionManager.isExtensionLoaded(n));else if(this.extensionManager.isBuiltinExtension(n))this.extensionManager.loadExtensionIdSync(n);else{let e=t.get(n);if(!e&&Object.prototype.hasOwnProperty.call(r,n)&&(e=r[n]),!e)throw new Error("Unknown extension: ".concat(n));if(!await this.securityManager.canLoadExtensionFromProject(e))throw new Error("Permission to load extension denied: ".concat(n));i.push(this.extensionManager.loadExtensionURL(e))}return Promise.all(i)}async installTargets(e,t,n){return await this.extensionManager.allAsyncExtensionsLoaded(),e=e.filter((e=>!!e)),this._loadExtensions(t.extensionIDs,t.extensionURLs).then((()=>{e.forEach((e=>{this.runtime.addTarget(e),e.updateAllDrawableProperties(),e.isSprite()&&this.renameSprite(e.id,e.getName())})),this.runtime.executableTargets.sort(((e,t)=>e.layerOrder-t.layerOrder)),e.forEach((e=>{delete e.layerOrder})),n&&e.length>1?this.editingTarget=e[1]:this.editingTarget=e[0],n||this.editingTarget.fixUpVariableReferences(),n&&this.runtime.parseProjectOptions(),this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.runtime.ioDevices.cloud.setStage(this.runtime.getTargetForStage())}))}addSprite(e){const t="Sprite Upload Error:";"object"!=typeof e||e instanceof ArrayBuffer||ArrayBuffer.isView(e)||(e=JSON.stringify(e));return new Promise(((t,r)=>{n(81)(e,!0,((e,n)=>{if(e)return r(e);t(n)}))})).then((e=>{const n=e[0].projectVersion;return 2===n?this._addSprite2(e[0],e[1]):3===n?this._addSprite3(e[0],e[1]):Promise.reject("".concat(t," Unable to verify sprite version."))})).then((()=>this.runtime.emitProjectChanged())).catch((e=>Object.prototype.hasOwnProperty.call(e,"validationError")?Promise.reject(JSON.stringify(e)):Promise.reject("".concat(t," ").concat(e))))}_addSprite2(e,t){return n(83).deserialize(e,this.runtime,!0,t).then((e=>{let{targets:t,extensions:n}=e;return this.installTargets(t,n,!1)}))}_addSprite3(e,t){return n(26).deserialize(e,this.runtime,t,!0).then((e=>{let{targets:t,extensions:n}=e;return this.installTargets(t,n,!1)}))}addCostume(e,t,n,r){const i=n?this.runtime.getTargetById(n):this.editingTarget;return i?y(e,t,this.runtime,r).then((()=>{i.addCostume(t),i.setCostume(i.getCostumes().length-1),this.runtime.emitProjectChanged()})):Promise.reject()}addCostumeFromLibrary(e,t){return this.editingTarget?this.addCostume(e,t,this.editingTarget.id,2):Promise.reject()}duplicateCostume(e){const t=this.editingTarget.getCostumes()[e],n=Object.assign({},t),r="".concat(n.assetId,".").concat(n.dataFormat);return y(r,n,this.runtime).then((()=>{this.editingTarget.addCostume(n,e+1),this.editingTarget.setCostume(e+1),this.emitTargetsUpdate()}))}duplicateSound(e){const t=this.editingTarget.getSounds()[e],n=Object.assign({},t);return E(n,this.runtime,this.editingTarget.sprite.soundBank).then((()=>{this.editingTarget.addSound(n,e+1),this.emitTargetsUpdate()}))}renameCostume(e,t){this.editingTarget.renameCostume(e,t),this.emitTargetsUpdate()}deleteCostume(e){const t=this.editingTarget.deleteCostume(e);if(t){const e=this.editingTarget;return this.runtime.emitProjectChanged(),()=>{e.addCostume(t),this.emitTargetsUpdate()}}return null}addSound(e,t){const n=t?this.runtime.getTargetById(t):this.editingTarget;return n?E(e,this.runtime,n.sprite.soundBank).then((()=>{n.addSound(e),this.emitTargetsUpdate()})):Promise.reject(new Error("No target with ID: ".concat(t)))}renameSound(e,t){this.editingTarget.renameSound(e,t),this.emitTargetsUpdate()}getSoundBuffer(e){const t=this.editingTarget.sprite.sounds[e].soundId;return t&&this.runtime&&this.runtime.audioEngine?this.editingTarget.sprite.soundBank.getSoundPlayer(t).buffer:null}updateSoundBuffer(e,t,n){const r=this.editingTarget.sprite.sounds[e];r&&r.broken&&delete r.broken;const i=r?r.soundId:null;if(i&&this.runtime&&this.runtime.audioEngine&&(this.editingTarget.sprite.soundBank.getSoundPlayer(i).buffer=t),n){r.format="";const e=this.runtime.storage;r.asset=e.createAsset(e.AssetType.Sound,e.DataFormat.WAV,n,null,!0),r.assetId=r.asset.assetId,r.dataFormat=e.DataFormat.WAV,r.md5="".concat(r.assetId,".").concat(r.dataFormat),r.sampleCount=t.length,r.rate=t.sampleRate}this.emitTargetsUpdate()}deleteSound(e){const t=this.editingTarget,n=this.editingTarget.deleteSound(e);if(n){this.runtime.emitProjectChanged();return()=>{t.addSound(n),this.emitTargetsUpdate()}}return null}getCostume(e){const t=this.editingTarget.getCostumes()[e].asset;if(!t||!this.runtime||!this.runtime.storage)return null;const n=t.dataFormat;return n===this.runtime.storage.DataFormat.SVG?t.decodeText():n===this.runtime.storage.DataFormat.PNG||n===this.runtime.storage.DataFormat.JPG?t.encodeDataURI():(l.error("Unhandled format: ".concat(t.dataFormat)),null)}getExportedCostume(e){return A(e)}getExportedCostumeBase64(e){const t=this.getExportedCostume(e);return w.uint8ArrayToBase64(t)}updateBitmap(e,t,n,r,i){return this._updateBitmap(this.editingTarget.getCostumes()[e],t,n,r,i)}_updateBitmap(e,t,n,r,i){if(!(e&&this.runtime&&this.runtime.renderer))return;e&&e.broken&&delete e.broken,e.rotationCenterX=n,e.rotationCenterY=r;const s=0===t.sourceWidth?0:t.width,a=0===t.sourceHeight?0:t.height,c=document.createElement("canvas");c.width=s,c.height=a;c.getContext("2d").putImageData(t,0,0),this.runtime.renderer.updateBitmapSkin(e.skinId,c,i,[n/i,r/i]),c.toBlob((t=>{const n=new FileReader;n.addEventListener("loadend",(()=>{const t=this.runtime.storage;e.dataFormat=t.DataFormat.PNG,e.bitmapResolution=i,e.size=[s,a],e.asset=t.createAsset(t.AssetType.ImageBitmap,e.dataFormat,o.from(n.result),null,!0),e.assetId=e.asset.assetId,e.md5="".concat(e.assetId,".").concat(e.dataFormat),this.emitTargetsUpdate()})),t&&n.readAsArrayBuffer(t)}))}updateSvg(e,t,n,r){return this._updateSvg(this.editingTarget.getCostumes()[e],t,n,r)}_updateSvg(e,t,n,i){e&&e.broken&&delete e.broken,e&&this.runtime&&this.runtime.renderer&&(e.rotationCenterX=n,e.rotationCenterY=i,this.runtime.renderer.updateSVGSkin(e.skinId,t,[n,i]),e.size=this.runtime.renderer.getSkinSize(e.skinId));const s=this.runtime.storage;e.dataFormat=s.DataFormat.SVG,e.bitmapResolution=1,e.asset=s.createAsset(s.AssetType.ImageVector,e.dataFormat,(new r).encode(t),null,!0),e.assetId=e.asset.assetId,e.md5="".concat(e.assetId,".").concat(e.dataFormat),this.emitTargetsUpdate()}addBackdrop(e,t){return y(e,t,this.runtime).then((()=>{const e=this.runtime.getTargetForStage();e.addCostume(t),e.setCostume(e.getCostumes().length-1),this.runtime.emitProjectChanged()}))}renameSprite(e,t){const n=this.runtime.getTargetById(e);if(!n)throw new Error("No target with the provided id.");{if(!n.isSprite())throw new Error("Cannot rename non-sprite targets.");const e=n.sprite;if(!e)throw new Error("No sprite associated with this target.");if(t&&-1===S.indexOf(t)){const r=this.runtime.targets.filter((e=>e.isSprite()&&e.id!==n.id)).map((e=>e.sprite.name)),i=e.name,s=f.unusedName(t,r);if(e.name=s,i===s)return;const o=this.runtime.targets;for(let e=0;e<o.length;e++){o[e].blocks.updateAssetName(i,t,"sprite")}s!==i&&this.emitTargetsUpdate()}}}deleteSprite(e){const t=this.runtime.getTargetById(e);if(t){const n=this.runtime.targets.map((e=>e.id)).indexOf(t.id);if(!t.isSprite())throw new Error("Cannot delete non-sprite targets.");const r=t.sprite;if(!r)throw new Error("No sprite associated with this target.");const i=this.exportSprite(e,"uint8array"),s=()=>i.then((e=>this.addSprite(e)));t.deleteMonitors();const o=this.editingTarget;for(let e=0;e<r.clones.length;e++){const t=r.clones[e];if(this.runtime.stopForTarget(r.clones[e]),this.runtime.disposeTarget(r.clones[e]),t===o){const e=Math.min(this.runtime.targets.length-1,n);this.runtime.targets.length>0?this.setEditingTarget(this.runtime.targets[e].id):this.editingTarget=null}}return this.emitTargetsUpdate(),s}throw new Error("No target with the provided id.")}duplicateSprite(e){const t=this.runtime.getTargetById(e);if(!t)throw new Error("No target with the provided id.");if(!t.isSprite())throw new Error("Cannot duplicate non-sprite targets.");if(!t.sprite)throw new Error("No sprite associated with this target.");return t.duplicate().then((e=>{this.runtime.addTarget(e),e.goBehindOther(t),this.setEditingTarget(e.id)}))}attachAudioEngine(e){this.runtime.attachAudioEngine(e)}attachRenderer(e){this.runtime.attachRenderer(e)}get renderer(){return this.runtime&&this.runtime.renderer}attachV2SVGAdapter(){}attachV2BitmapAdapter(e){this.runtime.attachV2BitmapAdapter(e)}attachStorage(e){this.runtime.attachStorage(e)}setLocale(e,t){return e!==m.setup().locale&&m.setup({locale:e,translations:{[e]:t}}),this.emit("LOCALE_CHANGED",e),this.extensionManager.refreshBlocks()}getLocale(){return m.setup().locale}blockListener(e){this.editingTarget&&this.editingTarget.blocks.blocklyListen(e)}flyoutBlockListener(e){this.runtime.flyoutBlocks.blocklyListen(e)}monitorBlockListener(e){-1!==["create","change"].indexOf(e.type)&&this.runtime.monitorBlocks.blocklyListen(e)}variableListener(e){-1!==["var_create","var_rename","var_delete"].indexOf(e.type)&&this.runtime.getTargetForStage().blocks.blocklyListen(e)}clearFlyoutBlocks(){this.runtime.flyoutBlocks.deleteAllBlocks()}setEditingTarget(e){if(this.editingTarget&&e===this.editingTarget.id)return;const t=this.runtime.getTargetById(e);t&&(this.editingTarget=t,this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(t))}exportStandaloneBlocks(e){return n(26).serializeStandaloneBlocks(e,this.runtime)}shareBlocksToTarget(e,t,r){const i=n(26),{blocks:s,extensionURLs:o}=i.deserializeStandaloneBlocks(e);b(s);const a=this.runtime.getTargetById(t);if(r){this.runtime.getTargetById(r).resolveVariableSharingConflictsWithTarget(s,a)}const c=new Set(s.map((e=>i.getExtensionIdForOpcode(e.opcode))).filter((e=>!!e)).filter((e=>!this.extensionManager.isExtensionLoaded(e))));return this._loadExtensions(c,o).then((()=>{s.forEach((e=>{a.blocks.createBlock(e)})),a.blocks.updateTargetSpecificBlocks(a.isStage)}))}shareCostumeToTarget(e,t){const n=this.editingTarget.getCostumes()[e],r=Object.assign({},n),i="".concat(r.assetId,".").concat(r.dataFormat);return y(i,r,this.runtime).then((()=>{const e=this.runtime.getTargetById(t);e&&(e.addCostume(r),e.setCostume(e.getCostumes().length-1))}))}shareSoundToTarget(e,t){const n=this.editingTarget.getSounds()[e],r=Object.assign({},n),i=this.runtime.getTargetById(t);return E(r,this.runtime,i.sprite.soundBank).then((()=>{i&&(i.addSound(r),this.emitTargetsUpdate())}))}refreshWorkspace(){this.editingTarget&&(this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.emitTargetsUpdate(!1))}emitTargetsUpdate(e){let t;void 0===e&&(e=!0);const n=()=>(t||(t=this.runtime.targets.filter((e=>!Object.prototype.hasOwnProperty.call(e,"isOriginal")||e.isOriginal)).map((e=>e.toJSON()))),t);this.emit("targetsUpdate",{get targetList(){return n()},editingTarget:this.editingTarget?this.editingTarget.id:null}),e&&this.runtime.emitProjectChanged()}emitWorkspaceUpdate(){const e=this.runtime.getTargetForStage().variables;let t=[];for(const n in e)e[n].type===g.BROADCAST_MESSAGE_TYPE&&t.push(n);for(let e=0;e<this.runtime.targets.length;e++){const n=this.runtime.targets[e].blocks._blocks;for(const e in n)if(n[e].fields.BROADCAST_OPTION){const r=n[e].fields.BROADCAST_OPTION.id,i=t.indexOf(r);-1!==i&&(t=t.slice(0,i).concat(t.slice(i+1)))}}for(let e=0;e<t.length;e++){const n=t[e];delete this.runtime.getTargetForStage().variables[n]}const n=Object.assign({},this.runtime.getTargetForStage().variables),r=this.editingTarget.isStage?Object.create(null):Object.assign({},this.editingTarget.variables),i=Object.keys(n).map((e=>n[e])),s=Object.keys(r).map((e=>r[e])),o=Object.keys(this.editingTarget.comments).map((e=>this.editingTarget.comments[e])).filter((e=>null===e.blockId)),a='<xml xmlns="http://www.w3.org/1999/xhtml">\n                            <variables>\n                                '.concat(i.map((e=>e.toXML())).join(),"\n                                ").concat(s.map((e=>e.toXML(!0))).join(),"\n                            </variables>\n                            ").concat(o.map((e=>e.toXML())).join(),"\n                            ").concat(this.editingTarget.blocks.toXML(this.editingTarget.comments),"\n                        </xml>");this.emit("workspaceUpdate",{xml:a})}getTargetIdForDrawableId(e){const t=this.runtime.getTargetByDrawableId(e);return t&&Object.prototype.hasOwnProperty.call(t,"id")&&Object.prototype.hasOwnProperty.call(t,"isStage")&&!t.isStage?t.id:null}reorderTarget(e,t){let n=this.runtime.targets;if((e=u.clamp(e,0,n.length-1))===(t=u.clamp(t,0,n.length-1)))return!1;const r=n[e];return n=n.slice(0,e).concat(n.slice(e+1)),n.splice(t,0,r),this.runtime.targets=n,this.emitTargetsUpdate(),!0}reorderCostume(e,t,n){const r=this.runtime.getTargetById(e);if(r){const e=r.reorderCostume(t,n);return e&&this.runtime.emitProjectChanged(),e}return!1}reorderSound(e,t,n){const r=this.runtime.getTargetById(e);if(r){const e=r.reorderSound(t,n);return e&&this.runtime.emitProjectChanged(),e}return!1}startDrag(e){const t=this.runtime.getTargetById(e);t&&(this._dragTarget=t,t.startDrag())}stopDrag(e){const t=this.runtime.getTargetById(e);t&&(this._dragTarget=null,t.stopDrag(),this.setEditingTarget(t.sprite&&t.sprite.clones[0]?t.sprite.clones[0].id:t.id))}postSpriteInfo(e){this._dragTarget?this._dragTarget.postSpriteInfo(e):this.editingTarget.postSpriteInfo(e),this.runtime.emitProjectChanged()}setVariableValue(e,t,n){const r=this.runtime.getTargetById(e);if(r){const e=r.lookupVariableById(t);if(e)return e.value=n,e.isCloud&&this.runtime.ioDevices.cloud.requestUpdateVariable(e.name,e.value),!0}return!1}getVariableValue(e,t){const n=this.runtime.getTargetById(e);if(n){const e=n.lookupVariableById(t);if(e)return e.value}return null}configureScratchLinkSocketFactory(e){this.runtime.configureScratchLinkSocketFactory(e)}}},function(e,t,n){"use strict";(function(e){!function(e){function t(){}function n(){}var r=String.fromCharCode,i={}.toString,s=i.call(e.SharedArrayBuffer),o=i(),a=e.Uint8Array,c=a||Array,l=a?ArrayBuffer:c,u=l.isView||function(e){return e&&"length"in e},h=i.call(l.prototype);l=n.prototype;var d=e.TextEncoder,p=new(a?Uint16Array:c)(32);t.prototype.decode=function(e){if(!u(e)){var t=i.call(e);if(t!==h&&t!==s&&t!==o)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");e=a?new c(e):e||[]}for(var n,l,d,f=t="",m=0,g=0|e.length,b=g-32|0,y=0,E=0,T=0,v=-1;m<g;){for(n=m<=b?32:g-m|0;T<n;m=m+1|0,T=T+1|0){switch((l=255&e[m])>>4){case 15:if(2!=(d=255&e[m=m+1|0])>>6||247<l){m=m-1|0;break}y=(7&l)<<6|63&d,E=5,l=256;case 14:y<<=6,y|=(15&l)<<6|63&(d=255&e[m=m+1|0]),E=2==d>>6?E+4|0:24,l=l+256&768;case 13:case 12:y<<=6,y|=(31&l)<<6|63&(d=255&e[m=m+1|0]),E=E+7|0,m<g&&2==d>>6&&y>>E&&1114112>y?(l=y,0<=(y=y-65536|0)&&(v=55296+(y>>10)|0,l=56320+(1023&y)|0,31>T?(p[T]=v,T=T+1|0,v=-1):(d=v,v=l,l=d))):(m=m-(l>>=8)-1|0,l=65533),y=E=0,n=m<=b?32:g-m|0;default:p[T]=l;continue;case 11:case 10:case 9:case 8:}p[T]=65533}if(f+=r(p[0],p[1],p[2],p[3],p[4],p[5],p[6],p[7],p[8],p[9],p[10],p[11],p[12],p[13],p[14],p[15],p[16],p[17],p[18],p[19],p[20],p[21],p[22],p[23],p[24],p[25],p[26],p[27],p[28],p[29],p[30],p[31]),32>T&&(f=f.slice(0,T-32|0)),m<g){if(p[0]=v,T=~v>>>31,v=-1,f.length<t.length)continue}else-1!==v&&(f+=r(v));t+=f,f=""}return t},l.encode=function(e){var t,n=0|(e=void 0===e?"":""+e).length,r=new c(8+(n<<1)|0),i=0,s=!a;for(t=0;t<n;t=t+1|0,i=i+1|0){var o=0|e.charCodeAt(t);if(127>=o)r[i]=o;else{if(2047>=o)r[i]=192|o>>6;else{e:{if(55296<=o)if(56319>=o){var l=0|e.charCodeAt(t=t+1|0);if(56320<=l&&57343>=l){if(65535<(o=(o<<10)+l-56613888|0)){r[i]=240|o>>18,r[i=i+1|0]=128|o>>12&63,r[i=i+1|0]=128|o>>6&63,r[i=i+1|0]=128|63&o;continue}break e}o=65533}else 57343>=o&&(o=65533);!s&&t<<1<i&&t<<1<(i-7|0)&&(s=!0,(l=new c(3*n)).set(r),r=l)}r[i]=224|o>>12,r[i=i+1|0]=128|o>>6&63}r[i=i+1|0]=128|63&o}}return a?r.subarray(0,i):r.slice(0,i)},d||(e.TextDecoder=t,e.TextEncoder=n)}(""+void 0==typeof e?""+void 0==typeof self?this:self:e)}).call(this,n(8))},function(e,t,n){const r=n(0);e.exports=class{constructor(){this.callbacks=[],this.nextResponseId=0}call(e,t){for(var n=arguments.length,r=new Array(n>2?n-2:0),i=2;i<n;i++)r[i-2]=arguments[i];return this.transferCall(e,t,null,...r)}transferCall(e,t,n){try{const{provider:o,isRemote:a}=this._getServiceProvider(e);if(o){for(var r=arguments.length,i=new Array(r>3?r-3:0),s=3;s<r;s++)i[s-3]=arguments[s];if(a)return this._remoteTransferCall(o,e,t,n,...i);const c=o[t].apply(o,i);return Promise.resolve(c)}return Promise.reject(new Error("Service not found: ".concat(e)))}catch(e){return Promise.reject(e)}}_isRemoteService(e){return this._getServiceProvider(e).isRemote}_remoteCall(e,t,n){for(var r=arguments.length,i=new Array(r>3?r-3:0),s=3;s<r;s++)i[s-3]=arguments[s];return this._remoteTransferCall(e,t,n,null,...i)}_remoteTransferCall(e,t,n,r){for(var i=arguments.length,s=new Array(i>4?i-4:0),o=4;o<i;o++)s[o-4]=arguments[o];return new Promise(((i,o)=>{const a=this._storeCallbacks(i,o);s.length>0&&"function"==typeof s[s.length-1].func&&(s.pop(),s.pop()),r?e.postMessage({service:t,method:n,responseId:a,args:s},r):e.postMessage({service:t,method:n,responseId:a,args:s})}))}_storeCallbacks(e,t){const n=this.nextResponseId++;return this.callbacks[n]=[e,t],n}_deliverResponse(e,t){try{const[n,r]=this.callbacks[e];delete this.callbacks[e],t.error?r(t.error):n(t.result)}catch(e){r.error("Dispatch callback failed: ".concat(e))}}_onMessage(e,t){const n=t.data;let i;n.args=n.args||[],n.service?i="dispatch"===n.service?this._onDispatchMessage(e,n):this.call(n.service,n.method,...n.args):void 0===n.responseId?r.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(t))):this._deliverResponse(n.responseId,n),i&&(void 0===n.responseId?r.error("Dispatch message missing required response ID: ".concat(JSON.stringify(t))):i.then((t=>e.postMessage({responseId:n.responseId,result:t})),(t=>e.postMessage({responseId:n.responseId,error:"".concat(t)}))))}_getServiceProvider(e){throw new Error("Could not get provider for ".concat(e,": _getServiceProvider not implemented"))}_onDispatchMessage(e,t){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(t.method," method"))}}},function(e,t,n){const r=n(55),i=n(0),s=n(56),o=n(2),a=n(109),c={coreExample:()=>n(110),pen:()=>n(111),wedo2:()=>n(112),music:()=>n(116),microbit:()=>n(179),text2speech:()=>n(180),translate:()=>n(181),videoSensing:()=>n(182),ev3:()=>n(218),makeymakey:()=>n(220),boost:()=>n(221),gdxfor:()=>n(222),tw:()=>n(225)};e.exports=class{constructor(e){this.nextExtensionWorker=0,this.pendingExtensions=[],this.pendingWorkers=[],this.workerURLs=[],this._loadedExtensions=new Map,this.securityManager=new a,this.vm=e,this.runtime=e.runtime,this.loadingAsyncExtensions=0,this.asyncExtensionsLoadedCallbacks=[],this.builtinExtensions=Object.assign({},c),r.setService("extensions",(e=>{const t={};return t.registerExtensionServiceSync=e.registerExtensionServiceSync.bind(e),t.allocateWorker=e.allocateWorker.bind(e),t.onWorkerInit=e.onWorkerInit.bind(e),t.registerExtensionService=e.registerExtensionService.bind(e),t})(this)).catch((e=>{i.error("ExtensionManager was unable to register extension service: ".concat(JSON.stringify(e)))}))}isExtensionLoaded(e){return this._loadedExtensions.has(e)}isBuiltinExtension(e){return Object.prototype.hasOwnProperty.call(this.builtinExtensions,e)}loadExtensionIdSync(e){if(!this.isBuiltinExtension(e))return void i.warn("Could not find extension ".concat(e," in the built in extensions."));if(this.isExtensionLoaded(e)){const t="Rejecting attempt to load a second extension with ID ".concat(e);return void i.warn(t)}const t=new(this.builtinExtensions[e]())(this.runtime),n=this._registerInternalExtension(t);this._loadedExtensions.set(e,n),this.runtime.compilerRegisterExtension(e,t)}addBuiltinExtension(e,t){this.builtinExtensions[e]=()=>t}_isValidExtensionURL(e){try{const t=new URL(e);return"https:"===t.protocol||"http:"===t.protocol||"data:"===t.protocol||"file:"===t.protocol}catch(e){return!1}}async loadExtensionURL(e){if(this.isBuiltinExtension(e))return void this.loadExtensionIdSync(e);if(this.isExtensionURLLoaded(e))return;if(!this._isValidExtensionURL(e))throw new Error("Invalid extension URL: ".concat(e));this.runtime.setExternalCommunicationMethod("customExtensions",!0),this.loadingAsyncExtensions++;const t=await this.securityManager.getSandboxMode(e),i=await this.securityManager.rewriteExtensionURL(e);if("unsandboxed"===t){const{load:t}=n(226),s=await t(i,this.vm).catch((e=>this._failedLoadingExtensionScript(e))),o=this.nextExtensionWorker++;this.workerURLs[o]=e;for(const e of s){const t=e.getInfo(),n="unsandboxed.".concat(o,".").concat(t.id);r.setServiceSync(n,e),r.callSync("extensions","registerExtensionServiceSync",n),this._loadedExtensions.set(t.id,n)}return void this._finishedLoadingExtensionScript()}let s;if("worker"===t)s=n(233);else{if("iframe"!==t)throw new Error("Invalid sandbox mode: ".concat(t));s=(await n.e(1).then(n.t.bind(null,302,7))).default}return new Promise(((e,t)=>{this.pendingExtensions.push({extensionURL:i,resolve:e,reject:t}),r.addWorker(new s)})).catch((e=>this._failedLoadingExtensionScript(e)))}allAsyncExtensionsLoaded(){if(0!==this.loadingAsyncExtensions)return new Promise(((e,t)=>{this.asyncExtensionsLoadedCallbacks.push({resolve:e,reject:t})}))}refreshBlocks(e){const t=e=>r.call(e,"getInfo").then((t=>{t=this._prepareExtensionInfo(e,t),r.call("runtime","_refreshExtensionPrimitives",t)})).catch((e=>{i.error("Failed to refresh built-in extension primitives",e)}));if(e)return this._loadedExtensions.has(e)?t(this._loadedExtensions.get(e)):Promise.reject(new Error("Unknown extension: ".concat(e)));const n=Array.from(this._loadedExtensions.values()).map(t);return Promise.all(n)}allocateWorker(){const e=this.nextExtensionWorker++,t=this.pendingExtensions.shift();return this.pendingWorkers[e]=t,this.workerURLs[e]=t.extensionURL,[e,t.extensionURL]}registerExtensionServiceSync(e){const t=r.callSync(e,"getInfo");this._registerExtensionInfo(e,t)}registerExtensionService(e){r.call(e,"getInfo").then((t=>{this._loadedExtensions.set(t.id,e),this._registerExtensionInfo(e,t),this._finishedLoadingExtensionScript()}))}_finishedLoadingExtensionScript(){this.loadingAsyncExtensions--,0===this.loadingAsyncExtensions&&(this.asyncExtensionsLoadedCallbacks.forEach((e=>e.resolve())),this.asyncExtensionsLoadedCallbacks=[])}_failedLoadingExtensionScript(e){throw this.loadingAsyncExtensions--,this.asyncExtensionsLoadedCallbacks.forEach((t=>t.reject(e))),this.asyncExtensionsLoadedCallbacks=[],e}onWorkerInit(e,t){const n=this.pendingWorkers[e];delete this.pendingWorkers[e],t?n.reject(t):n.resolve()}_registerInternalExtension(e){const t=e.getInfo(),n=this.nextExtensionWorker++,i="extension_".concat(n,"_").concat(t.id);return r.setServiceSync(i,e),r.callSync("extensions","registerExtensionServiceSync",i),i}_registerExtensionInfo(e,t){t=this._prepareExtensionInfo(e,t),r.call("runtime","_registerExtensionPrimitives",t).catch((t=>{i.error("Failed to register primitives for extension on service ".concat(e,":"),t)}))}_prepareExtensionInfo(e,t){if(t=Object.assign({},t),!/^[a-z0-9]+$/i.test(t.id))throw new Error("Invalid extension id");return t.name=t.name||t.id,t.blocks=t.blocks||[],t.targetTypes=t.targetTypes||[],t.blocks=t.blocks.reduce(((t,n)=>{try{let r;if("---"===n)r="---";else r=this._prepareBlockInfo(e,n);t.push(r)}catch(e){i.error("Error processing block: ".concat(e.message,", Block:\n").concat(JSON.stringify(n)))}return t}),[]),t.menus=t.menus||{},t.menus=this._prepareMenuInfo(e,t.menus),t}_prepareMenuInfo(e,t){const n=Object.getOwnPropertyNames(t);for(let i=0;i<n.length;i++){const s=n[i];let o=t[s];if(o.items||(o={items:o},t[s]=o),"string"==typeof o.items){const t=o.items,n=r.services[e];o.items=this._getExtensionMenuItems.bind(this,n,t)}}return t}_getExtensionMenuItems(e,t){const n=this.runtime.getEditingTarget()||this.runtime.getTargetForStage(),r=n?n.id:null,i=this.runtime.makeMessageContextForTarget(n),o=e[t].call(e,r).map((e=>{switch(typeof(e=s(e,i))){case"object":return[s(e.text,i),e.value];case"string":return[e,e];default:return e}}));if(!o||o.length<1)throw new Error("Extension menu returned no items: ".concat(t));return o}_prepareBlockInfo(e,t){if(t.blockType===o.XML)return(t=Object.assign({},t)).xml=String(t.xml)||"",t;switch((t=Object.assign({},{blockType:o.COMMAND,terminal:!1,blockAllThreads:!1,arguments:{}},t)).text=t.text||t.opcode,t.blockType){case o.EVENT:t.func&&i.warn('Ignoring function "'.concat(t.func,'" for event block ').concat(t.opcode));break;case o.BUTTON:t.opcode&&i.warn('Ignoring opcode "'.concat(t.opcode,'" for button with text: ').concat(t.text)),t.callFunc=()=>{r.call(e,t.func)};break;case o.LABEL:t.opcode&&i.warn('Ignoring opcode "'.concat(t.opcode,'" for label: ').concat(t.text));break;default:{if(!t.opcode)throw new Error("Missing opcode for block");const n=t.func||t.opcode,s=t.isDynamic?e=>e&&e.mutation&&e.mutation.blockInfo:()=>t,o=(()=>{if(r._isRemoteService(e))return(t,i,s)=>r.call(e,n,t,i,s).then((e=>"number"==typeof e||"string"==typeof e||"boolean"==typeof e?e:"".concat(e)));const t=r.services[e];return t[n]||i.warn("Could not find extension block function called ".concat(n)),(e,r,i)=>t[n](e,r,i)})();t.func=(e,t)=>{const n=s(e);return o(e,t,n)};break}}return t}getExtensionURLs(){const e={};for(const[t,n]of this._loadedExtensions.entries()){if(Object.prototype.hasOwnProperty.call(this.builtinExtensions,t))continue;const r=+n.split(".")[1],i=this.workerURLs[r];"string"==typeof i&&(e[t]=i)}return e}isExtensionURLLoaded(e){return Object.values(this.workerURLs).includes(e)}}},function(e,t,n){"use strict";var r="{",i="}",s=",",o="#",a="<",c=">",l="</",u="/>",h="'",d="offset:",p=["number","date","time","ordinal","duration","spellout"],f=["plural","select","selectordinal"];function m(e,t){var n=e.pattern,r=n.length,s=[],o=e.index,a=g(e,t);for(a&&s.push(a),a&&e.tokens&&e.tokens.push(["text",n.slice(o,e.index)]);e.index<r;){if(n[e.index]===i){if(!t)throw k(e);break}if(t&&e.tagsType&&n.slice(e.index,e.index+2)===l)break;s.push(E(e)),o=e.index,(a=g(e,t))&&s.push(a),a&&e.tokens&&e.tokens.push(["text",n.slice(o,e.index)])}return s}function g(e,t){for(var n=e.pattern,s=n.length,c="plural"===t||"selectordinal"===t,l=!!e.tagsType,u="{style}"===t,d="";e.index<s;){var p=n[e.index];if(p===r||p===i||c&&p===o||l&&p===a||u&&b(p.charCodeAt(0)))break;if(p===h)if((p=n[++e.index])===h)d+=p,++e.index;else if(p===r||p===i||c&&p===o||l&&p===a||u)for(d+=p;++e.index<s;)if((p=n[e.index])===h&&n[e.index+1]===h)d+=h,++e.index;else{if(p===h){++e.index;break}d+=p}else d+=h;else d+=p,++e.index}return d}function b(e){return e>=9&&e<=13||32===e||133===e||160===e||6158===e||e>=8192&&e<=8205||8232===e||8233===e||8239===e||8287===e||8288===e||12288===e||65279===e}function y(e){for(var t=e.pattern,n=t.length,r=e.index;e.index<n&&b(t.charCodeAt(e.index));)++e.index;r<e.index&&e.tokens&&e.tokens.push(["space",e.pattern.slice(r,e.index)])}function E(e){var t=e.pattern;if(t[e.index]===o)return e.tokens&&e.tokens.push(["syntax",o]),++e.index,[o];var n=function(e){var t=e.tagsType;if(!t||e.pattern[e.index]!==a)return;if(e.pattern.slice(e.index,e.index+2)===l)throw k(e,null,"closing tag without matching opening tag");e.tokens&&e.tokens.push(["syntax",a]);++e.index;var n=T(e,!0);if(!n)throw k(e,"placeholder id");e.tokens&&e.tokens.push(["id",n]);if(y(e),e.pattern.slice(e.index,e.index+2)===u)return e.tokens&&e.tokens.push(["syntax",u]),e.index+=2,[n,t];if(e.pattern[e.index]!==c)throw k(e,c);e.tokens&&e.tokens.push(["syntax",c]);++e.index;var r=m(e,t),i=e.index;if(e.pattern.slice(e.index,e.index+2)!==l)throw k(e,l+n+c);e.tokens&&e.tokens.push(["syntax",l]);e.index+=2;var s=T(e,!0);s&&e.tokens&&e.tokens.push(["id",s]);if(n!==s)throw e.index=i,k(e,l+n+c,l+s+c);if(y(e),e.pattern[e.index]!==c)throw k(e,c);e.tokens&&e.tokens.push(["syntax",c]);return++e.index,[n,t,{children:r}]}(e);if(n)return n;if(t[e.index]!==r)throw k(e,r);e.tokens&&e.tokens.push(["syntax",r]),++e.index,y(e);var h=T(e);if(!h)throw k(e,"placeholder id");e.tokens&&e.tokens.push(["id",h]),y(e);var f=t[e.index];if(f===i)return e.tokens&&e.tokens.push(["syntax",i]),++e.index,[h];if(f!==s)throw k(e,", or }");e.tokens&&e.tokens.push(["syntax",s]),++e.index,y(e);var g,b=T(e);if(!b)throw k(e,"placeholder type");if(e.tokens&&e.tokens.push(["type",b]),y(e),(f=t[e.index])===i){if(e.tokens&&e.tokens.push(["syntax",i]),"plural"===b||"selectordinal"===b||"select"===b)throw k(e,b+" sub-messages");return++e.index,[h,b]}if(f!==s)throw k(e,", or }");if(e.tokens&&e.tokens.push(["syntax",s]),++e.index,y(e),"plural"===b||"selectordinal"===b){var E=function(e){var t=e.pattern,n=t.length,r=0;if(t.slice(e.index,e.index+7)===d){e.tokens&&e.tokens.push(["offset","offset"],["syntax",":"]),e.index+=7,y(e);for(var i=e.index;e.index<n&&A(t.charCodeAt(e.index));)++e.index;if(i===e.index)throw k(e,"offset number");e.tokens&&e.tokens.push(["number",t.slice(i,e.index)]),r=+t.slice(i,e.index)}return r}(e);y(e),g=[h,b,E,w(e,b)]}else if("select"===b)g=[h,b,w(e,b)];else if(p.indexOf(b)>=0)g=[h,b,v(e)];else{var S=e.index,O=v(e);y(e),t[e.index]===r&&(e.index=S,O=w(e,b)),g=[h,b,O]}if(y(e),t[e.index]!==i)throw k(e,i);return e.tokens&&e.tokens.push(["syntax",i]),++e.index,g}function T(e,t){for(var n=e.pattern,l=n.length,u="";e.index<l;){var d=n[e.index];if(d===r||d===i||d===s||d===o||d===h||b(d.charCodeAt(0))||t&&(d===a||d===c||"/"===d))break;u+=d,++e.index}return u}function v(e){var t=e.index,n=g(e,"{style}");if(!n)throw k(e,"placeholder style name");return e.tokens&&e.tokens.push(["style",e.pattern.slice(t,e.index)]),n}function A(e){return e>=48&&e<=57}function w(e,t){for(var n=e.pattern,r=n.length,s={};e.index<r&&n[e.index]!==i;){var o=T(e);if(!o)throw k(e,"sub-message selector");e.tokens&&e.tokens.push(["selector",o]),y(e),s[o]=S(e,t),y(e)}if(!s.other&&f.indexOf(t)>=0)throw k(e,null,null,'"other" sub-message must be specified in '+t);return s}function S(e,t){if(e.pattern[e.index]!==r)throw k(e,"{ to start sub-message");e.tokens&&e.tokens.push(["syntax",r]),++e.index;var n=m(e,t);if(e.pattern[e.index]!==i)throw k(e,"} to end sub-message");return e.tokens&&e.tokens.push(["syntax",i]),++e.index,n}function k(e,t,n,r){var i=e.pattern,s=i.slice(0,e.index).split(/\r?\n/),o=e.index,a=s.length,c=s.slice(-1)[0].length;return n=n||(e.index>=i.length?"end of message pattern":T(e)||i[e.index]),r||(r=function(e,t){return e?"Expected "+e+" but found "+t:"Unexpected "+t+" found"}(t,n)),new O(r+=" in "+i.replace(/\r?\n/g,"\n"),t,n,o,a,c)}function O(e,t,n,r,i,s){Error.call(this,e),this.name="SyntaxError",this.message=e,this.expected=t,this.found=n,this.offset=r,this.line=i,this.column=s}t=e.exports=function(e,t){return m({pattern:String(e),index:0,tagsType:t&&t.tagsType||null,tokens:t&&t.tokens||null},"")},O.prototype=Object.create(Error.prototype),t.SyntaxError=O},function(e,t,n){"use strict";var r=n(57),i=n(58),s=n(59);function o(e,t,n,r,i){var s=e.map((function(e){return function(e,t,n,r,i){if("string"==typeof e){var s=e;return function(){return s}}var c,l=e[0],u=e[1];if(t&&"#"===e[0]){l=t[0];var h=t[2],p=(r.number||d.number)([l,"number"],n);return function(e){return p(a(l,e)-h,e)}}"plural"===u||"selectordinal"===u?(c={},Object.keys(e[3]).forEach((function(t){c[t]=o(e[3][t],e,n,r,i)})),e=[e[0],e[1],e[2],c]):e[2]&&"object"==typeof e[2]&&(c={},Object.keys(e[2]).forEach((function(t){c[t]=o(e[2][t],e,n,r,i)})),e=[e[0],e[1],c]);var f=u&&(r[u]||d[u]);if(f){var m=f(e,n);return function(e){return m(a(l,e),e)}}return i?function(e){return String(a(l,e))}:function(e){return a(l,e)}}(e,t,n,r,i)}));return i?1===s.length?s[0]:function(e){for(var t="",n=0;n<s.length;++n)t+=s[n](e);return t}:function(e){return s.reduce((function(t,n){return t.concat(n(e))}),[])}}function a(e,t){if(t&&e in t)return t[e];for(var n=e.split("."),r=t,i=0,s=n.length;r&&i<s;++i)r=r[n[i]];return r}function c(e,t){var n=e[2],i=r.number[n]||r.parseNumberPattern(n)||r.number.default;return new Intl.NumberFormat(t,i).format}function l(e,t){var n=e[1],i=e[2],s=r[n][i]||r.parseDatePattern(i)||r[n].default;return new Intl.DateTimeFormat(t,s).format}function u(e,t){var n,r="selectordinal"===e[1]?"ordinal":"cardinal",o=e[2],a=e[3];if(Intl.PluralRules&&Intl.PluralRules.supportedLocalesOf(t).length>0)n=new Intl.PluralRules(t,{type:r});else{var c=i(t,s),l=c&&s[c][r]||h;n={select:l}}return function(e,t){return(a["="+ +e]||a[n.select(e-o)]||a.other)(t)}}function h(){return"other"}(t=e.exports=function(e,t,n){return o(e,null,t||"en",n||{},!0)}).toParts=function(e,t,n){return o(e,null,t||"en",n||{},!1)};var d={number:c,ordinal:c,spellout:c,duration:function(e,t){var n=e[2],i=r.duration[n]||r.duration.default,s=new Intl.NumberFormat(t,i.seconds).format,o=new Intl.NumberFormat(t,i.minutes).format,a=new Intl.NumberFormat(t,i.hours).format,c=/^fi$|^fi-|^da/.test(String(t))?".":":";return function(e,t){if(e=+e,!isFinite(e))return s(e);var n=~~(e/60/60),r=~~(e/60%60),i=(n?a(Math.abs(n))+c:"")+o(Math.abs(r))+c+s(Math.abs(e%60));return e<0?a(-1).replace(a(1),i):i}},date:l,time:l,plural:u,selectordinal:u,select:function(e,t){var n=e[2];return function(e,t){return(n[e]||n.other)(t)}}};t.types=d},function(e,t){e.exports=class{getSandboxMode(e){return Promise.resolve("worker")}canLoadExtensionFromProject(e){return Promise.resolve(!1)}rewriteExtensionURL(e){return Promise.resolve(e)}canFetch(e){return Promise.resolve(!0)}canOpenWindow(e){return Promise.resolve(!0)}canRedirect(e){return Promise.resolve(!0)}canRecordAudio(){return Promise.resolve(!0)}canRecordVideo(){return Promise.resolve(!0)}canReadClipboard(){return Promise.resolve(!0)}canNotify(){return Promise.resolve(!0)}canGeolocate(){return Promise.resolve(!0)}canEmbed(e){return Promise.resolve(!0)}canDownload(e,t){return Promise.resolve(!0)}}},function(e,t,n){const r=n(2),i=n(3);e.exports=class{constructor(e){this.runtime=e}getInfo(){return{id:"coreExample",name:"CoreEx",blocks:[{func:"MAKE_A_VARIABLE",blockType:r.BUTTON,text:"make a variable (CoreEx)"},{opcode:"exampleOpcode",blockType:r.REPORTER,text:"example block"},{opcode:"exampleWithInlineImage",blockType:r.COMMAND,text:"block with image [CLOCKWISE] inline",arguments:{CLOCKWISE:{type:i.IMAGE,dataURI:'data:image/svg+xml,%3Csvg id="rotate-counter-clockwise" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%233d79cc;%7D.cls-2%7Bfill:%23fff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3Erotate-counter-clockwise%3C/title%3E%3Cpath class="cls-1" d="M22.68,12.2a1.6,1.6,0,0,1-1.27.63H13.72a1.59,1.59,0,0,1-1.16-2.58l1.12-1.41a4.82,4.82,0,0,0-3.14-.77,4.31,4.31,0,0,0-2,.8,4.25,4.25,0,0,0-1.34,1.73,5.06,5.06,0,0,0,.54,4.62A5.58,5.58,0,0,0,12,17.74h0a2.26,2.26,0,0,1-.16,4.52A10.25,10.25,0,0,1,3.74,18,10.14,10.14,0,0,1,2.25,8.78,9.7,9.7,0,0,1,5.08,4.64,9.92,9.92,0,0,1,9.66,2.5a10.66,10.66,0,0,1,7.72,1.68l1.08-1.35a1.57,1.57,0,0,1,1.24-.6,1.6,1.6,0,0,1,1.54,1.21l1.7,7.37A1.57,1.57,0,0,1,22.68,12.2Z"/%3E%3Cpath class="cls-2" d="M21.38,11.83H13.77a.59.59,0,0,1-.43-1l1.75-2.19a5.9,5.9,0,0,0-4.7-1.58,5.07,5.07,0,0,0-4.11,3.17A6,6,0,0,0,7,15.77a6.51,6.51,0,0,0,5,2.92,1.31,1.31,0,0,1-.08,2.62,9.3,9.3,0,0,1-7.35-3.82A9.16,9.16,0,0,1,3.17,9.12,8.51,8.51,0,0,1,5.71,5.4,8.76,8.76,0,0,1,9.82,3.48a9.71,9.71,0,0,1,7.75,2.07l1.67-2.1a.59.59,0,0,1,1,.21L22,11.08A.59.59,0,0,1,21.38,11.83Z"/%3E%3C/svg%3E'}}}]}}exampleOpcode(){const e=this.runtime.getTargetForStage();return e?e.getName():"no stage yet"}exampleWithInlineImage(){}}},function(e,t,n){const r=n(3),i=n(2),s=n(39),o=n(1),a=n(12),c=n(23),l=n(5),u=n(4),h=n(0),d=n(13),p="color",f="saturation",m="brightness",g="transparency";class b{constructor(e){this.runtime=e,this._penDrawableId=-1,this._penSkinId=-1,this._onTargetCreated=this._onTargetCreated.bind(this),this._onTargetMoved=this._onTargetMoved.bind(this),e.on("targetWasCreated",this._onTargetCreated),e.on("RUNTIME_DISPOSED",this.clear.bind(this))}static get DEFAULT_PEN_STATE(){return{penDown:!1,color:66.66,saturation:100,brightness:100,transparency:0,_shade:50,penAttributes:{color4f:[0,0,1,1],diameter:1}}}static get PEN_SIZE_RANGE(){return{min:1,max:1200}}static get STATE_KEY(){return"Scratch.pen"}_clampPenSize(e){return this.runtime.renderer&&this.runtime.renderer.useHighQualityRender||!this.runtime.runtimeOptions.miscLimits?Math.max(0,e):u.clamp(e,b.PEN_SIZE_RANGE.min,b.PEN_SIZE_RANGE.max)}_getPenLayerID(){const e=this.runtime.renderer;return this._penSkinId<0&&e&&(this._penSkinId=e.createPenSkin(),this._penDrawableId=e.createDrawable(d.PEN_LAYER),e.markDrawableAsNoninteractive&&e.markDrawableAsNoninteractive(this._penDrawableId),e.updateDrawableSkinId(this._penDrawableId,this._penSkinId)),this._penSkinId}_getPenState(e){let t=e._customState["Scratch.pen"];return t||(t=a.simple(b.DEFAULT_PEN_STATE),e.setCustomState(b.STATE_KEY,t)),t}_onTargetCreated(e,t){if(t){const n=t.getCustomState(b.STATE_KEY);n&&(e.setCustomState(b.STATE_KEY,a.simple(n)),n.penDown&&(e.onTargetMoved=this._onTargetMoved))}}_onTargetMoved(e,t,n,r){if(!r){const r=this._getPenLayerID();if(r>=0){const i=this._getPenState(e);this.runtime.renderer.penLine(r,i.penAttributes,t,n,e.x,e.y),this.runtime.requestRedraw()}}}_wrapColor(e){return u.wrapClamp(e,0,100)}_initColorParam(){return[{text:l({id:"pen.colorMenu.color",default:"color",description:"label for color element in color picker for pen extension"}),value:p},{text:l({id:"pen.colorMenu.saturation",default:"saturation",description:"label for saturation element in color picker for pen extension"}),value:f},{text:l({id:"pen.colorMenu.brightness",default:"brightness",description:"label for brightness element in color picker for pen extension"}),value:m},{text:l({id:"pen.colorMenu.transparency",default:"transparency",description:"label for transparency element in color picker for pen extension"}),value:g}]}_clampColorParam(e){return u.clamp(e,0,100)}_alphaToTransparency(e){return 100*(1-e)}_transparencyToAlpha(e){return 1-e/100}getInfo(){return{id:"pen",name:l({id:"pen.categoryName",default:"Pen",description:"Label for the pen extension category"}),blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48dGl0bGU+cGVuLWljb248L3RpdGxlPjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlPSIjNTc1ZTc1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Im04Ljc1MyAzNC42MDItNC4yNSAxLjc4IDEuNzgzLTQuMjM3YzEuMjE4LTIuODkyIDIuOTA3LTUuNDIzIDUuMDMtNy41MzhMMzEuMDY2IDQuOTNjLjg0Ni0uODQyIDIuNjUtLjQxIDQuMDMyLjk2NyAxLjM4IDEuMzc1IDEuODE2IDMuMTczLjk3IDQuMDE1TDE2LjMxOCAyOS41OWMtMi4xMjMgMi4xMTYtNC42NjQgMy44LTcuNTY1IDUuMDEyIi8+PHBhdGggZD0iTTI5LjQxIDYuMTFzLTQuNDUtMi4zNzgtOC4yMDIgNS43NzJjLTEuNzM0IDMuNzY2LTQuMzUgMS41NDYtNC4zNSAxLjU0NiIvPjxwYXRoIGZpbGw9IiM0Yzk3ZmYiIGQ9Ik0zNi40MiA4LjgyNWMwIC40NjMtLjE0Ljg3My0uNDMyIDEuMTY0bC05LjMzNSA5LjNjLjI4Mi0uMjkuNDEtLjY2OC40MS0xLjEyIDAtLjg3NC0uNTA3LTEuOTYzLTEuNDA2LTIuODY4LTEuMzYyLTEuMzU4LTMuMTQ3LTEuOC00LjAwMi0uOTlMMzAuOTkgNS4wMWMuODQ0LS44NCAyLjY1LS40MSA0LjAzNS45Ni44OTguOTA0IDEuMzk2IDEuOTgyIDEuMzk2IDIuODU1TTEwLjUxNSAzMy43NzRhMjQgMjQgMCAwIDEtMS43NjQuODNMNC41IDM2LjM4MmwxLjc4Ni00LjIzNWMuMjU4LS42MDQuNTMtMS4xODYuODMzLTEuNzU3LjY5LjE4MyAxLjQ0OC42MjUgMi4xMDggMS4yODIuNjYuNjU4IDEuMTAyIDEuNDEyIDEuMjg3IDIuMTAyIi8+PHBhdGggZmlsbD0iIzU3NWU3NSIgZD0iTTM2LjQ5OCA4Ljc0OGMwIC40NjQtLjE0Ljg3NC0uNDMzIDEuMTY1bC0xOS43NDIgMTkuNjhjLTIuMTMgMi4xMS00LjY3MyAzLjc5My03LjU3MiA1LjAxTDQuNSAzNi4zOGwuOTc0LTIuMzE2IDEuOTI1LS44MDhjMi44OTgtMS4yMTggNS40NC0yLjkgNy41Ny01LjAxbDE5Ljc0My0xOS42OGMuMjkyLS4yOTIuNDMyLS43MDIuNDMyLTEuMTY1IDAtLjY0Ni0uMjctMS40LS43OC0yLjEyMi4yNS4xNzIuNS4zNzcuNzM3LjYxNC44OTguOTA1IDEuMzk2IDEuOTgzIDEuMzk2IDIuODU2IiBvcGFjaXR5PSIuMTUiLz48cGF0aCBmaWxsPSIjNTc1ZTc1IiBkPSJNMTguNDUgMTIuODNhLjkwNC45MDQgMCAxIDEtLjkwMy0uOTAyYy41IDAgLjkwNC40MDQuOTA0LjkwNHoiLz48L2c+PC9zdmc+",blocks:[{blockType:i.LABEL,text:l({id:"tw.pen.stageSelected",default:"Stage selected: less pen blocks",description:"Label that appears in the Pen category when the stage is selected"}),filter:[s.STAGE]},{opcode:"clear",blockType:i.COMMAND,text:l({id:"pen.clear",default:"erase all",description:"erase all pen trails and stamps"})},{opcode:"stamp",blockType:i.COMMAND,text:l({id:"pen.stamp",default:"stamp",description:"render current costume on the background"}),filter:[s.SPRITE]},{opcode:"penDown",blockType:i.COMMAND,text:l({id:"pen.penDown",default:"pen down",description:"start leaving a trail when the sprite moves"}),filter:[s.SPRITE]},{opcode:"penUp",blockType:i.COMMAND,text:l({id:"pen.penUp",default:"pen up",description:"stop leaving a trail behind the sprite"}),filter:[s.SPRITE]},{opcode:"setPenColorToColor",blockType:i.COMMAND,text:l({id:"pen.setColor",default:"set pen color to [COLOR]",description:"set the pen color to a particular (RGB) value"}),arguments:{COLOR:{type:r.COLOR}},filter:[s.SPRITE]},{opcode:"changePenColorParamBy",blockType:i.COMMAND,text:l({id:"pen.changeColorParam",default:"change pen [COLOR_PARAM] by [VALUE]",description:"change the state of a pen color parameter"}),arguments:{COLOR_PARAM:{type:r.STRING,menu:"colorParam",defaultValue:p},VALUE:{type:r.NUMBER,defaultValue:10}},filter:[s.SPRITE]},{opcode:"setPenColorParamTo",blockType:i.COMMAND,text:l({id:"pen.setColorParam",default:"set pen [COLOR_PARAM] to [VALUE]",description:"set the state for a pen color parameter e.g. saturation"}),arguments:{COLOR_PARAM:{type:r.STRING,menu:"colorParam",defaultValue:p},VALUE:{type:r.NUMBER,defaultValue:50}},filter:[s.SPRITE]},{opcode:"changePenSizeBy",blockType:i.COMMAND,text:l({id:"pen.changeSize",default:"change pen size by [SIZE]",description:"change the diameter of the trail left by a sprite"}),arguments:{SIZE:{type:r.NUMBER,defaultValue:1}},filter:[s.SPRITE]},{opcode:"setPenSizeTo",blockType:i.COMMAND,text:l({id:"pen.setSize",default:"set pen size to [SIZE]",description:"set the diameter of a trail left by a sprite"}),arguments:{SIZE:{type:r.NUMBER,defaultValue:1}},filter:[s.SPRITE]},{opcode:"setPenShadeToNumber",blockType:i.COMMAND,text:l({id:"pen.setShade",default:"set pen shade to [SHADE]",description:"legacy pen blocks - set pen shade"}),arguments:{SHADE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenShadeBy",blockType:i.COMMAND,text:l({id:"pen.changeShade",default:"change pen shade by [SHADE]",description:"legacy pen blocks - change pen shade"}),arguments:{SHADE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"setPenHueToNumber",blockType:i.COMMAND,text:l({id:"pen.setHue",default:"set pen color to [HUE]",description:"legacy pen blocks - set pen color to number"}),arguments:{HUE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenHueBy",blockType:i.COMMAND,text:l({id:"pen.changeHue",default:"change pen color by [HUE]",description:"legacy pen blocks - change pen color"}),arguments:{HUE:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0}],menus:{colorParam:{acceptReporters:!0,items:this._initColorParam()}}}}clear(){const e=this._getPenLayerID();e>=0&&(this.runtime.renderer.penClear(e),this.runtime.requestRedraw())}stamp(e,t){this._stamp(t.target)}_stamp(e){const t=this._getPenLayerID();t>=0&&(this.runtime.renderer.penStamp(t,e.drawableID),this.runtime.requestRedraw())}penDown(e,t){this._penDown(t.target)}_penDown(e){const t=this._getPenState(e);t.penDown||(t.penDown=!0,e.onTargetMoved=this._onTargetMoved);const n=this._getPenLayerID();n>=0&&(this.runtime.renderer.penPoint(n,t.penAttributes,e.x,e.y),this.runtime.requestRedraw())}penUp(e,t){this._penUp(t.target)}_penUp(e){const t=this._getPenState(e);t.penDown&&(t.penDown=!1,e.onTargetMoved=null)}setPenColorToColor(e,t){this._setPenColorToColor(e.COLOR,t.target)}_setPenColorToColor(e,t){const n=this._getPenState(t),r=o.toRgbColorObject(e),i=c.rgbToHsv(r);n.color=i.h/360*100,n.saturation=100*i.s,n.brightness=100*i.v,Object.prototype.hasOwnProperty.call(r,"a")?n.transparency=100*(1-r.a/255):n.transparency=0,n._shade=n.brightness/2,this._updatePenColor(n)}_updatePenColor(e){const t=c.hsvToRgb({h:360*e.color/100,s:e.saturation/100,v:e.brightness/100});e.penAttributes.color4f[0]=t.r/255,e.penAttributes.color4f[1]=t.g/255,e.penAttributes.color4f[2]=t.b/255,e.penAttributes.color4f[3]=this._transparencyToAlpha(e.transparency)}_setOrChangeColorParam(e,t,n,r){switch(e){case p:n.color=this._wrapColor(t+(r?n.color:0));break;case f:n.saturation=this._clampColorParam(t+(r?n.saturation:0));break;case m:n.brightness=this._clampColorParam(t+(r?n.brightness:0));break;case g:n.transparency=this._clampColorParam(t+(r?n.transparency:0));break;default:h.warn("Tried to set or change unknown color parameter: ".concat(e))}this._updatePenColor(n)}changePenColorParamBy(e,t){const n=this._getPenState(t.target);this._setOrChangeColorParam(e.COLOR_PARAM,o.toNumber(e.VALUE),n,!0)}setPenColorParamTo(e,t){const n=this._getPenState(t.target);this._setOrChangeColorParam(e.COLOR_PARAM,o.toNumber(e.VALUE),n,!1)}changePenSizeBy(e,t){this._changePenSizeBy(o.toNumber(e.SIZE),t.target)}_changePenSizeBy(e,t){const n=this._getPenState(t).penAttributes;n.diameter=this._clampPenSize(n.diameter+e)}setPenSizeTo(e,t){this._setPenSizeTo(o.toNumber(e.SIZE),t.target)}_setPenSizeTo(e,t){this._getPenState(t).penAttributes.diameter=this._clampPenSize(e)}setPenHueToNumber(e,t){this._setPenHueToNumber(o.toNumber(e.HUE),t.target)}_setPenHueToNumber(e,t){const n=this._getPenState(t),r=e/2;this._setOrChangeColorParam(p,r,n,!1),this._setOrChangeColorParam(g,0,n,!1),this._legacyUpdatePenColor(n)}changePenHueBy(e,t){this._changePenHueBy(o.toNumber(e.HUE),t.target)}_changePenHueBy(e,t){const n=this._getPenState(t),r=e/2;this._setOrChangeColorParam(p,r,n,!0),this._legacyUpdatePenColor(n)}setPenShadeToNumber(e,t){this._setPenShadeToNumber(o.toNumber(e.SHADE),t.target)}_setPenShadeToNumber(e,t){const n=this._getPenState(t);let r=o.toNumber(e);r%=200,r<0&&(r+=200),n._shade=r,this._legacyUpdatePenColor(n)}changePenShadeBy(e,t){this._changePenShadeBy(e.SHADE,t.target)}_changePenShadeBy(e,t){const n=this._getPenState(t),r=o.toNumber(e);this._setPenShadeToNumber(n._shade+r,t)}_legacyUpdatePenColor(e){let t=c.hsvToRgb({h:360*e.color/100,s:1,v:1});const n=e._shade>100?200-e._shade:e._shade;t=n<50?c.mixRgb(c.RGB_BLACK,t,(10+n)/60):c.mixRgb(t,c.RGB_WHITE,(n-50)/60);const r=c.rgbToHsv(t);e.color=100*r.h/360,e.saturation=100*r.s,e.brightness=100*r.v,this._updatePenColor(e)}}e.exports=b},function(e,t,n){const r=n(3),i=n(2),s=n(1),o=n(5),a=n(23),c=n(30),l=n(16),u=n(4),h=n(40),d=n(0),p="00001523-1212-efde-1523-785feabcd123",f="00004f0e-1212-efde-1523-785feabcd123",m="00001527-1212-efde-1523-785feabcd123",g="00001528-1212-efde-1523-785feabcd123",b="00001560-1212-efde-1523-785feabcd123",y="00001563-1212-efde-1523-785feabcd123",E="00001565-1212-efde-1523-785feabcd123",T=100,v=1,A=23,w=34,S=35,k=6,O=5,I=1,N=2,R=3,x=4,M={TILT:0,DISTANCE:0,LED:1},C={TILT:0,DISTANCE:1,LED:0};class P{constructor(e,t){this._parent=e,this._index=t,this._direction=1,this._power=100,this._isOn=!1,this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null,this.startBraking=this.startBraking.bind(this),this.turnOff=this.turnOff.bind(this)}static get BRAKE_TIME_MS(){return 1e3}get direction(){return this._direction}set direction(e){this._direction=e<0?-1:1}get power(){return this._power}set power(e){const t=Math.max(0,Math.min(e,100));if(0===t)this._power=0;else{const e=100/t;this._power=30+70/e}}get isOn(){return this._isOn}get pendingTimeoutStartTime(){return this._pendingTimeoutStartTime}get pendingTimeoutDelay(){return this._pendingTimeoutDelay}turnOn(){const e=this._parent.generateOutputCommand(this._index+1,I,[this._power*this._direction]);this._parent.send(E,e),this._isOn=!0,this._clearTimeout()}turnOnFor(e){0!==this._power&&(e=Math.max(0,e),this.turnOn(),this._setNewTimeout(this.startBraking,e))}startBraking(){if(0===this._power)return;const e=this._parent.generateOutputCommand(this._index+1,I,[127]);this._parent.send(E,e),this._isOn=!1,this._setNewTimeout(this.turnOff,P.BRAKE_TIME_MS)}turnOff(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(0===this._power)return;const t=this._parent.generateOutputCommand(this._index+1,I,[0]);this._parent.send(E,t,e),this._isOn=!1}_clearTimeout(){null!==this._pendingTimeoutId&&(clearTimeout(this._pendingTimeoutId),this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null)}_setNewTimeout(e,t){this._clearTimeout();const n=setTimeout((()=>{this._pendingTimeoutId===n&&(this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null),e()}),t);this._pendingTimeoutId=n,this._pendingTimeoutStartTime=Date.now(),this._pendingTimeoutDelay=t}}class D{constructor(e,t){this._runtime=e,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=t,this._ports=["none","none"],this._motors=[null,null],this._sensors={tiltX:0,tiltY:0,distance:0},this._ble=null,this._runtime.registerPeripheralExtension(t,this),this._rateLimiter=new h(20),this._batteryLevelIntervalId=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this),this._checkBatteryLevel=this._checkBatteryLevel.bind(this)}get tiltX(){return this._sensors.tiltX}get tiltY(){return this._sensors.tiltY}get distance(){return this._sensors.distance}motor(e){return this._motors[e]}stopAllMotors(){this._motors.forEach((e=>{e&&e.turnOff(!1)}))}setLED(e){const t=[e>>16&255,e>>8&255,255&e],n=this.generateOutputCommand(k,x,t);return this.send(E,n)}setLEDMode(){const e=this.generateInputCommand(k,A,M.LED,0,C.LED,!1);return this.send(y,e)}stopLED(){const e=this.generateOutputCommand(k,x,[0,0,0]);return this.send(E,e)}playTone(e,t){const n=this.generateOutputCommand(O,N,[e,e>>8,t,t>>8]);return this.send(E,n)}stopTone(){const e=this.generateOutputCommand(O,R);return this.send(E,e,!1)}stopAll(){this.isConnected()&&(this.stopTone(),this.stopAllMotors())}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{services:[p]}],optionalServices:[f]},this._onConnect,this.reset)}connect(e){this._ble&&this._ble.connectPeripheral(e)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._ports=["none","none"],this._motors=[null,null],this._sensors={tiltX:0,tiltY:0,distance:0},this._batteryLevelIntervalId&&(window.clearInterval(this._batteryLevelIntervalId),this._batteryLevelIntervalId=null)}isConnected(){let e=!1;return this._ble&&(e=this._ble.isConnected()),e}send(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.isConnected()?n&&!this._rateLimiter.okayToSend()?Promise.resolve():this._ble.write(f,e,l.uint8ArrayToBase64(t),"base64"):Promise.resolve()}generateOutputCommand(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=[e,t];return n&&(r=r.concat(n.length).concat(n)),r}generateInputCommand(e,t,n,r,i,s){return[1,2,e,t,n,r,0,0,0,i,s?1:0]}_onConnect(){this.setLEDMode(),this.setLED(255),this._ble.startNotifications(p,m,this._onMessage),this._batteryLevelIntervalId=window.setInterval(this._checkBatteryLevel,5e3)}_onMessage(e){const t=l.base64ToUint8Array(e);switch(t[0]){case 1:case 2:{const e=t[0];0===t[1]?this._clearPort(e):this._registerSensorOrMotor(e,t[3]);break}default:{const e=t[1],n=this._ports[e-1];n===S&&(this._sensors.distance=t[2]),n===w&&(this._sensors.tiltX=t[2],this._sensors.tiltY=t[3]);break}}}_checkBatteryLevel(){this._ble.read(p,g,!1)}_registerSensorOrMotor(e,t){if(this._ports[e-1]=t,t===v)this._motors[e-1]=new P(this,e-1);else{const n=t===S?"DISTANCE":"TILT",r=this.generateInputCommand(e,t,M[n],1,C[n],!0);this.send(y,r),this._ble.startNotifications(f,b,this._onMessage)}}_clearPort(e){const t=this._ports[e-1];t===w&&(this._sensors.tiltX=this._sensors.tiltY=0),t===S&&(this._sensors.distance=0),this._ports[e-1]="none",this._motors[e-1]=null}}const L="motor",B="motor A",U="motor B",F="all motors",j="this way",z="that way",G="reverse",V="up",_="down",Y="left",H="right",W="any";class K{static get EXTENSION_ID(){return"wedo2"}static get TILT_THRESHOLD(){return 15}constructor(e){this.runtime=e,this._peripheral=new D(this.runtime,K.EXTENSION_ID)}getInfo(){return{id:K.EXTENSION_ID,name:"WeDo 2.0",blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAACXBIWXMAABYlAAAWJQFJUiTwAAABQVBMVEX///98h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V8h6V9h6V8h6V8h6V8h6VwhKxyhat8h6V8h6VwhKxwhKx8h6U9ecw+e88/fdJAf9VBgNlDhN9EhuJGgM9GjOxHgM9Hju9Ij/JKk/lLlfxMl/9fkNVtmtlwhKx4hqd5o9x6h6Z8h6V9iKV9iKZ+iKZ+iaaAi6iBjKmCjamEjqqGkKyIkq6Jkq6MlrCOmLKQmbGUnbaVnraWn7WWn7aYobmZormao7qcpbudpbqevOWjq76lrcGqxOmttMevtsi1u8y2zey3vcu6v9C9w9K+w8/FytfLz9fO0t3O3fLS1dvS1uDX2d/a5vXe4ejf4eTm5+jm6O7v8PTz9/z39/n///+zX1z3AAAAInRSTlMAEDBAUFdgcICHkJygr7DAwc/Q3ODv8PD19vf7+/v8/f7+PDte4QAAAe9JREFUeNrt11tvEkEYxvGB1oqIjFVaDxWU0VqpJ2zVxx5kVayKumKp9ihai7vA+/0/gDOZNNbkzdJM9qJJ53cBhGf2n73YmxWe53med3plijIvxLiUWSHyspARWSknhMjJYsZsOSEmzJYp6GNmGxcjFAGMCWgiByAnpgFkxwBIIQ+3abvZY0nOTU6Vgac3Zha1mZvm89bic6BSAVAtVwFcktBkCUDJ/pQynxGsM9fhqCA456sItomeqNkHdWNe1doDordAuE9JugB7f1Ws67Wt7j6uG49U7YCI3mNV55KFbPCK7mn3b+uecU91iGgP6JNT8CwC0n6qubp1Rw2I6A2+kVvwMrZJ66j5uqUWSMMSOQavgYy2eng0uIfXrkGs8sGmczA4QcFPCcFNNWsfm7njB+OVhOCgpg5tHjM4fIeEIB08W7A69H+wF5uLe30i6veG5sZ6dtjAK/BBxr9gCGxQ3ETQpW6AZkzfgXBoj3x2CUKjHQChaWOHoPWIYgRxyAVXwFrCSF1ig2i0GGuwfzfAr029rPNBtCLGD3yIjBb4dTf6heX9VIPRFl5+TDUYfUEj3eCfBlIM2q8XKQbt6hBkuQe3WrzfLsFEPngE1lIOLuOra3AXXLAEuJsUjItlRqV6dWq0C/5NwvM8zzuV/gL7cbih1u2EKwAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"motorOnFor",text:o({id:"wedo2.motorOnFor",default:"turn [MOTOR_ID] on for [DURATION] seconds",description:"turn a motor on for some time"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L},DURATION:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorOn",text:o({id:"wedo2.motorOn",default:"turn [MOTOR_ID] on",description:"turn a motor on indefinitely"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L}}},{opcode:"motorOff",text:o({id:"wedo2.motorOff",default:"turn [MOTOR_ID] off",description:"turn a motor off"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L}}},{opcode:"startMotorPower",text:o({id:"wedo2.startMotorPower",default:"set [MOTOR_ID] power to [POWER]",description:"set the motor's power and turn it on"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L},POWER:{type:r.NUMBER,defaultValue:100}}},{opcode:"setMotorDirection",text:o({id:"wedo2.setMotorDirection",default:"set [MOTOR_ID] direction to [MOTOR_DIRECTION]",description:"set the motor's turn direction"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:L},MOTOR_DIRECTION:{type:r.STRING,menu:"MOTOR_DIRECTION",defaultValue:j}}},{opcode:"setLightHue",text:o({id:"wedo2.setLightHue",default:"set light color to [HUE]",description:"set the LED color"}),blockType:i.COMMAND,arguments:{HUE:{type:r.NUMBER,defaultValue:50}}},{opcode:"playNoteFor",text:o({id:"wedo2.playNoteFor",default:"play note [NOTE] for [DURATION] seconds",description:"play a certain note for some time"}),blockType:i.COMMAND,arguments:{NOTE:{type:r.NUMBER,defaultValue:60},DURATION:{type:r.NUMBER,defaultValue:.5}},hideFromPalette:!0},{opcode:"whenDistance",text:o({id:"wedo2.whenDistance",default:"when distance [OP] [REFERENCE]",description:"check for when distance is < or > than reference"}),blockType:i.HAT,arguments:{OP:{type:r.STRING,menu:"OP",defaultValue:"<"},REFERENCE:{type:r.NUMBER,defaultValue:50}}},{opcode:"whenTilted",text:o({id:"wedo2.whenTilted",default:"when tilted [TILT_DIRECTION_ANY]",description:"check when tilted in a certain direction"}),func:"isTilted",blockType:i.HAT,arguments:{TILT_DIRECTION_ANY:{type:r.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:W}}},{opcode:"getDistance",text:o({id:"wedo2.getDistance",default:"distance",description:"the value returned by the distance sensor"}),blockType:i.REPORTER},{opcode:"isTilted",text:o({id:"wedo2.isTilted",default:"tilted [TILT_DIRECTION_ANY]?",description:"whether the tilt sensor is tilted"}),blockType:i.BOOLEAN,arguments:{TILT_DIRECTION_ANY:{type:r.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:W}}},{opcode:"getTiltAngle",text:o({id:"wedo2.getTiltAngle",default:"tilt angle [TILT_DIRECTION]",description:"the angle returned by the tilt sensor"}),blockType:i.REPORTER,arguments:{TILT_DIRECTION:{type:r.STRING,menu:"TILT_DIRECTION",defaultValue:V}}}],menus:{MOTOR_ID:{acceptReporters:!0,items:[{text:o({id:"wedo2.motorId.default",default:"motor",description:"label for motor element in motor menu for LEGO WeDo 2 extension"}),value:L},{text:o({id:"wedo2.motorId.a",default:"motor A",description:"label for motor A element in motor menu for LEGO WeDo 2 extension"}),value:B},{text:o({id:"wedo2.motorId.b",default:"motor B",description:"label for motor B element in motor menu for LEGO WeDo 2 extension"}),value:U},{text:o({id:"wedo2.motorId.all",default:"all motors",description:"label for all motors element in motor menu for LEGO WeDo 2 extension"}),value:F}]},MOTOR_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"wedo2.motorDirection.forward",default:"this way",description:"label for forward element in motor direction menu for LEGO WeDo 2 extension"}),value:j},{text:o({id:"wedo2.motorDirection.backward",default:"that way",description:"label for backward element in motor direction menu for LEGO WeDo 2 extension"}),value:z},{text:o({id:"wedo2.motorDirection.reverse",default:"reverse",description:"label for reverse element in motor direction menu for LEGO WeDo 2 extension"}),value:G}]},TILT_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"wedo2.tiltDirection.up",default:"up",description:"label for up element in tilt direction menu for LEGO WeDo 2 extension"}),value:V},{text:o({id:"wedo2.tiltDirection.down",default:"down",description:"label for down element in tilt direction menu for LEGO WeDo 2 extension"}),value:_},{text:o({id:"wedo2.tiltDirection.left",default:"left",description:"label for left element in tilt direction menu for LEGO WeDo 2 extension"}),value:Y},{text:o({id:"wedo2.tiltDirection.right",default:"right",description:"label for right element in tilt direction menu for LEGO WeDo 2 extension"}),value:H}]},TILT_DIRECTION_ANY:{acceptReporters:!0,items:[{text:o({id:"wedo2.tiltDirection.up",default:"up"}),value:V},{text:o({id:"wedo2.tiltDirection.down",default:"down"}),value:_},{text:o({id:"wedo2.tiltDirection.left",default:"left"}),value:Y},{text:o({id:"wedo2.tiltDirection.right",default:"right"}),value:H},{text:o({id:"wedo2.tiltDirection.any",default:"any",description:"label for any element in tilt direction menu for LEGO WeDo 2 extension"}),value:W}]},OP:{acceptReporters:!0,items:["<",">"]}}}}motorOnFor(e){let t=1e3*s.toNumber(e.DURATION);return t=u.clamp(t,0,15e3),new Promise((n=>{this._forEachMotor(e.MOTOR_ID,(e=>{const n=this._peripheral.motor(e);n&&n.turnOnFor(t)})),setTimeout(n,t)}))}motorOn(e){return this._forEachMotor(e.MOTOR_ID,(e=>{const t=this._peripheral.motor(e);t&&t.turnOn()})),new Promise((e=>{window.setTimeout((()=>{e()}),T)}))}motorOff(e){return this._forEachMotor(e.MOTOR_ID,(e=>{const t=this._peripheral.motor(e);t&&t.turnOff()})),new Promise((e=>{window.setTimeout((()=>{e()}),T)}))}startMotorPower(e){return this._forEachMotor(e.MOTOR_ID,(t=>{const n=this._peripheral.motor(t);n&&(n.power=u.clamp(s.toNumber(e.POWER),0,100),n.turnOn())})),new Promise((e=>{window.setTimeout((()=>{e()}),T)}))}setMotorDirection(e){return this._forEachMotor(e.MOTOR_ID,(t=>{const n=this._peripheral.motor(t);if(n){switch(e.MOTOR_DIRECTION){case j:n.direction=1;break;case z:n.direction=-1;break;case G:n.direction=-n.direction;break;default:d.warn("Unknown motor direction in setMotorDirection: ".concat(e.DIRECTION))}n.isOn&&(n.pendingTimeoutDelay?n.turnOnFor(n.pendingTimeoutStartTime+n.pendingTimeoutDelay-Date.now()):n.turnOn())}})),new Promise((e=>{window.setTimeout((()=>{e()}),T)}))}setLightHue(e){let t=s.toNumber(e.HUE);t=u.wrapClamp(t,0,100);const n=360*t/100,r=a.hsvToRgb({h:n,s:1,v:1}),i=a.rgbToDecimal(r);return this._peripheral.setLED(i),new Promise((e=>{window.setTimeout((()=>{e()}),T)}))}playNoteFor(e){let t=1e3*s.toNumber(e.DURATION);t=u.clamp(t,0,3e3);const n=u.clamp(s.toNumber(e.NOTE),25,125);if(0!==t)return new Promise((e=>{const r=this._noteToTone(n);this._peripheral.playTone(r,t),setTimeout(e,t)}))}whenDistance(e){switch(e.OP){case"<":return this._peripheral.distance<s.toNumber(e.REFERENCE);case">":return this._peripheral.distance>s.toNumber(e.REFERENCE);default:return d.warn("Unknown comparison operator in whenDistance: ".concat(e.OP)),!1}}whenTilted(e){return this._isTilted(e.TILT_DIRECTION_ANY)}getDistance(){return this._peripheral.distance}isTilted(e){return this._isTilted(e.TILT_DIRECTION_ANY)}getTiltAngle(e){return this._getTiltAngle(e.TILT_DIRECTION)}_isTilted(e){return e===W?this._getTiltAngle(V)>=K.TILT_THRESHOLD||this._getTiltAngle(_)>=K.TILT_THRESHOLD||this._getTiltAngle(Y)>=K.TILT_THRESHOLD||this._getTiltAngle(H)>=K.TILT_THRESHOLD:this._getTiltAngle(e)>=K.TILT_THRESHOLD}_getTiltAngle(e){switch(e){case V:return this._peripheral.tiltY>45?256-this._peripheral.tiltY:-this._peripheral.tiltY;case _:return this._peripheral.tiltY>45?this._peripheral.tiltY-256:this._peripheral.tiltY;case Y:return this._peripheral.tiltX>45?256-this._peripheral.tiltX:-this._peripheral.tiltX;case H:return this._peripheral.tiltX>45?this._peripheral.tiltX-256:this._peripheral.tiltX;default:d.warn("Unknown tilt direction in _getTiltAngle: ".concat(e))}}_forEachMotor(e,t){let n;switch(e){case B:n=[0];break;case U:n=[1];break;case F:case L:n=[0,1];break;default:d.warn("Invalid motor ID: ".concat(e)),n=[]}for(const e of n)t(e)}_noteToTone(e){return 440*Math.pow(2,(e-69)/12)}}e.exports=K},function(e,t,n){(function(e,t){!function(n){"use strict";var r,i="function"==typeof(r=n.atob)?r:"function"==typeof e?function(t){return new e(t,"base64").toString("binary")}:"object"==typeof n.base64js?function(e){var t=n.base64js.b64ToByteArray(e);return Array.prototype.map.call(t,(function(e){return String.fromCharCode(e)})).join("")}:function(){throw new Error("You're probably in an old browser or an iOS webworker. It might help to include beatgammit's base64-js.")};n.atob=i,t&&t.exports&&(t.exports=i)}(window)}).call(this,n(18).Buffer,n(114)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){(function(t){!function(){"use strict";e.exports=function(e){return(e instanceof t?e:t.from(e.toString(),"binary")).toString("base64")}}()}).call(this,n(18).Buffer)},function(e,t,n){const r=n(3),i=n(2),s=n(12),o=n(1),a=n(5),c=n(4),l=n(14);let u={};try{u=n(117)}catch(e){}class h{constructor(e){this.runtime=e,this._concurrencyCounter=0,this._drumPlayers=[],this._instrumentPlayerArrays=[],this._instrumentPlayerNoteArrays=[],this._bufferSources=[],this._loadAllSounds(),this._onTargetCreated=this._onTargetCreated.bind(this),this.runtime.on("targetWasCreated",this._onTargetCreated),this._playNoteForPicker=this._playNoteForPicker.bind(this),this.runtime.on("PLAY_NOTE",this._playNoteForPicker)}_loadAllSounds(){const e=[];this.DRUM_INFO.forEach(((t,n)=>{const r="drums/".concat(t.fileName),i=this._storeSound(r,n,this._drumPlayers);e.push(i)})),this.INSTRUMENT_INFO.forEach(((t,n)=>{this._instrumentPlayerArrays[n]=[],this._instrumentPlayerNoteArrays[n]=[],t.samples.forEach(((r,i)=>{const s="instruments/".concat(t.dirName,"/").concat(r),o=this._storeSound(s,i,this._instrumentPlayerArrays[n]);e.push(o)}))})),Promise.all(e).then((()=>{}))}_storeSound(e,t,n){const r="".concat(e,".mp3");if(!u[r])return;const i=u[r];return fetch(i).then((e=>e.arrayBuffer())).then((e=>this._decodeSound(e))).then((e=>{n[t]=e}))}_decodeSound(e){const t=this.runtime.audioEngine;return t?t.decodeSoundPlayer({data:{buffer:e}}):Promise.reject(new Error("No Audio Context Detected"))}_buildMenu(e){return e.map(((e,t)=>{const n={};return n.text=e.name,n.value=String(t+1),n}))}get DRUM_INFO(){return[{name:a({id:"music.drumSnare",default:"(1) Snare Drum",description:"Sound of snare drum as used in a standard drum kit"}),fileName:"1-snare"},{name:a({id:"music.drumBass",default:"(2) Bass Drum",description:"Sound of bass drum as used in a standard drum kit"}),fileName:"2-bass-drum"},{name:a({id:"music.drumSideStick",default:"(3) Side Stick",description:"Sound of a drum stick hitting the side of a drum (usually the snare)"}),fileName:"3-side-stick"},{name:a({id:"music.drumCrashCymbal",default:"(4) Crash Cymbal",description:"Sound of a drum stick hitting a crash cymbal"}),fileName:"4-crash-cymbal"},{name:a({id:"music.drumOpenHiHat",default:"(5) Open Hi-Hat",description:"Sound of a drum stick hitting a hi-hat while open"}),fileName:"5-open-hi-hat"},{name:a({id:"music.drumClosedHiHat",default:"(6) Closed Hi-Hat",description:"Sound of a drum stick hitting a hi-hat while closed"}),fileName:"6-closed-hi-hat"},{name:a({id:"music.drumTambourine",default:"(7) Tambourine",description:"Sound of a tambourine being struck"}),fileName:"7-tambourine"},{name:a({id:"music.drumHandClap",default:"(8) Hand Clap",description:"Sound of two hands clapping together"}),fileName:"8-hand-clap"},{name:a({id:"music.drumClaves",default:"(9) Claves",description:"Sound of claves being struck together"}),fileName:"9-claves"},{name:a({id:"music.drumWoodBlock",default:"(10) Wood Block",description:"Sound of a wood block being struck"}),fileName:"10-wood-block"},{name:a({id:"music.drumCowbell",default:"(11) Cowbell",description:"Sound of a cowbell being struck"}),fileName:"11-cowbell"},{name:a({id:"music.drumTriangle",default:"(12) Triangle",description:"Sound of a triangle (instrument) being struck"}),fileName:"12-triangle"},{name:a({id:"music.drumBongo",default:"(13) Bongo",description:"Sound of a bongo being struck"}),fileName:"13-bongo"},{name:a({id:"music.drumConga",default:"(14) Conga",description:"Sound of a conga being struck"}),fileName:"14-conga"},{name:a({id:"music.drumCabasa",default:"(15) Cabasa",description:"Sound of a cabasa being shaken"}),fileName:"15-cabasa"},{name:a({id:"music.drumGuiro",default:"(16) Guiro",description:"Sound of a guiro being played"}),fileName:"16-guiro"},{name:a({id:"music.drumVibraslap",default:"(17) Vibraslap",description:"Sound of a Vibraslap being played"}),fileName:"17-vibraslap"},{name:a({id:"music.drumCuica",default:"(18) Cuica",description:"Sound of a cuica being played"}),fileName:"18-cuica"}]}get INSTRUMENT_INFO(){return[{name:a({id:"music.instrumentPiano",default:"(1) Piano",description:"Sound of a piano"}),dirName:"1-piano",releaseTime:.5,samples:[24,36,48,60,72,84,96,108]},{name:a({id:"music.instrumentElectricPiano",default:"(2) Electric Piano",description:"Sound of an electric piano"}),dirName:"2-electric-piano",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentOrgan",default:"(3) Organ",description:"Sound of an organ"}),dirName:"3-organ",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentGuitar",default:"(4) Guitar",description:"Sound of an accoustic guitar"}),dirName:"4-guitar",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentElectricGuitar",default:"(5) Electric Guitar",description:"Sound of an electric guitar"}),dirName:"5-electric-guitar",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentBass",default:"(6) Bass",description:"Sound of an accoustic upright bass"}),dirName:"6-bass",releaseTime:.25,samples:[36,48]},{name:a({id:"music.instrumentPizzicato",default:"(7) Pizzicato",description:"Sound of a string instrument (e.g. violin) being plucked"}),dirName:"7-pizzicato",releaseTime:.25,samples:[60]},{name:a({id:"music.instrumentCello",default:"(8) Cello",description:"Sound of a cello being played with a bow"}),dirName:"8-cello",releaseTime:.1,samples:[36,48,60]},{name:a({id:"music.instrumentTrombone",default:"(9) Trombone",description:"Sound of a trombone being played"}),dirName:"9-trombone",samples:[36,48,60]},{name:a({id:"music.instrumentClarinet",default:"(10) Clarinet",description:"Sound of a clarinet being played"}),dirName:"10-clarinet",samples:[48,60]},{name:a({id:"music.instrumentSaxophone",default:"(11) Saxophone",description:"Sound of a saxophone being played"}),dirName:"11-saxophone",samples:[36,60,84]},{name:a({id:"music.instrumentFlute",default:"(12) Flute",description:"Sound of a flute being played"}),dirName:"12-flute",samples:[60,72]},{name:a({id:"music.instrumentWoodenFlute",default:"(13) Wooden Flute",description:"Sound of a wooden flute being played"}),dirName:"13-wooden-flute",samples:[60,72]},{name:a({id:"music.instrumentBassoon",default:"(14) Bassoon",description:"Sound of a bassoon being played"}),dirName:"14-bassoon",samples:[36,48,60]},{name:a({id:"music.instrumentChoir",default:"(15) Choir",description:"Sound of a choir singing"}),dirName:"15-choir",releaseTime:.25,samples:[48,60,72]},{name:a({id:"music.instrumentVibraphone",default:"(16) Vibraphone",description:"Sound of a vibraphone being struck"}),dirName:"16-vibraphone",releaseTime:.5,samples:[60,72]},{name:a({id:"music.instrumentMusicBox",default:"(17) Music Box",description:"Sound of a music box playing"}),dirName:"17-music-box",releaseTime:.25,samples:[60]},{name:a({id:"music.instrumentSteelDrum",default:"(18) Steel Drum",description:"Sound of a steel drum being struck"}),dirName:"18-steel-drum",releaseTime:.5,samples:[60]},{name:a({id:"music.instrumentMarimba",default:"(19) Marimba",description:"Sound of a marimba being struck"}),dirName:"19-marimba",samples:[60]},{name:a({id:"music.instrumentSynthLead",default:"(20) Synth Lead",description:'Sound of a "lead" synthesizer being played'}),dirName:"20-synth-lead",releaseTime:.1,samples:[60]},{name:a({id:"music.instrumentSynthPad",default:"(21) Synth Pad",description:'Sound of a "pad" synthesizer being played'}),dirName:"21-synth-pad",releaseTime:.25,samples:[60]}]}get MIDI_INSTRUMENTS(){return[1,1,1,1,2,2,4,4,17,17,17,16,19,16,17,17,3,3,3,3,3,3,3,3,4,4,5,5,5,5,5,5,6,6,6,6,6,6,6,6,8,8,8,8,8,7,8,19,8,8,8,8,15,15,15,19,9,9,9,9,9,9,9,9,11,11,11,11,14,14,14,10,12,12,13,13,13,13,12,12,20,20,20,20,20,20,20,20,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,21,4,4,4,4,17,14,8,10,17,17,18,19,1,1,1,1,21,21,21,21,21,21,21,21]}get MIDI_DRUMS(){return[[1,-4],[1,0],[2,0],[0,0],[7,0],[0,2],[1,-6,4],[5,0],[1,-3,3.2],[5,0],[1,0,3],[4,-8],[1,4,3],[1,7,2.7],[3,-8],[1,10,2.7],[4,-2],[3,-11],[4,2],[6,0],[3,0,3.5],[10,0],[3,-8,3.5],[16,-6],[4,2],[12,2],[12,0],[13,0,.2],[13,0,2],[13,-5,2],[12,12],[12,5],[10,19],[10,12],[14,0],[14,0],[17,12],[17,5],[15,0],[15,0],[8,0],[9,0],[9,-4],[17,-5],[17,0],[11,-6,1],[11,-6,3]]}static get STATE_KEY(){return"Scratch.music"}static get DEFAULT_MUSIC_STATE(){return{currentInstrument:0}}static get MIDI_NOTE_RANGE(){return{min:0,max:130}}static get BEAT_RANGE(){return{min:0,max:100}}static get TEMPO_RANGE(){return{min:20,max:500}}static get CONCURRENCY_LIMIT(){return 30}_getMusicState(e){let t=e.getCustomState(h.STATE_KEY);return t||(t=s.simple(h.DEFAULT_MUSIC_STATE),e.setCustomState(h.STATE_KEY,t)),t}_onTargetCreated(e,t){if(t){const n=t.getCustomState(h.STATE_KEY);n&&e.setCustomState(h.STATE_KEY,s.simple(n))}}getInfo(){return{id:"music",name:a({id:"music.categoryName",default:"Music",description:"Label for the Music extension category"}),menuIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCI+PHBhdGggZmlsbD0iIzU3NWU3NSIgZmlsbC1ydWxlPSJldmVub2RkIiBkPSJNMTYuMDkgMTIuOTM3Yy4yMjggMS4xNDEtLjgzMyAyLjA2My0yLjM3MyAyLjA2My0xLjUzNSAwLTIuOTYyLS45MjItMy4xODYtMi4wNjMtLjIzLTEuMTQyLjgzMy0yLjA2OCAyLjM3Mi0yLjA2OC4zMjMgMCAuNjQxLjA0Mi45NDUuMTE3YTMuNSAzLjUgMCAwIDEgLjQ2OC4xNTFjLjQzNS0uMDEtLjA1Mi0xLjE0Ny0uOTE3LTYuMTE0LTEuMDY3LTYuMTUyIDEuNTMtLjkzNSA0LjM4NC0xLjM3N3MuMDM4IDIuNDEtMS44MjUgMS45MjJjLTEuODYyLS40OTMtMi4zMjUtMy41NzcuMTMyIDcuMzd6TTcuNDYgOC41NjNjLTEuODYyLS40OTMtMi4zMjUtMy41NzYuMTMgNy4zN0M3LjgxNiAxNy4wNzMgNi43NTQgMTggNS4yMiAxOHMtMi45NjEtLjkyNi0zLjE5LTIuMDY4Yy0uMjI0LTEuMTQyLjgzNy0yLjA2NyAyLjM3NS0yLjA2Ny41MDEgMCAuOTg3LjA5OCAxLjQyNy4yNzIuNDEyLS4wMjgtLjA3NC0xLjE4OS0uOTMtNi4xMTQtMS4wNjgtNi4xNTMgMS41MjgtLjkzNiA0LjM4LTEuMzc3IDIuODU0LS40NDcuMDM4IDIuNDEtMS44MjMgMS45MTd6Ii8+PC9zdmc+",blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHRpdGxlPm11c2ljLWJsb2NrLWljb248L3RpdGxlPjxkZWZzPjxwYXRoIGlkPSJhIiBkPSJNMzIuMTggMjUuODc0QzMyLjYzNiAyOC4xNTcgMzAuNTEyIDMwIDI3LjQzMyAzMGMtMy4wNyAwLTUuOTIzLTEuODQzLTYuMzcyLTQuMTI2LS40NTgtMi4yODUgMS42NjUtNC4xMzYgNC43NDMtNC4xMzZhOCA4IDAgMCAxIDEuODkuMjM0Yy4zMzguMDg2LjYzNy4xOC45MzguMzAyLjg3LS4wMi0uMTA0LTIuMjk0LTEuODM1LTEyLjIzLTIuMTM0LTEyLjMwMiAzLjA2LTEuODcgOC43NjgtMi43NTIgNS43MDgtLjg4NS4wNzYgNC44Mi0zLjY1IDMuODQ0LTMuNzI0LS45ODctNC42NS03LjE1My4yNjMgMTQuNzM4em0tMTYuOTk4IDUuOTlDMTUuNjMgMzQuMTQ4IDEzLjUwNyAzNiAxMC40NCAzNmMtMy4wNyAwLTUuOTIyLTEuODUyLTYuMzgtNC4xMzYtLjQ0OC0yLjI4NCAxLjY3NC00LjEzNSA0Ljc1LTQuMTM1IDEuMDAzIDAgMS45NzUuMTk2IDIuODU1LjU0My44MjItLjA1NS0uMTUtMi4zNzctMS44NjItMTIuMjI4LTIuMTMzLTEyLjMwMyAzLjA2LTEuODcgOC43NjQtMi43NTMgNS43MDYtLjg5NC4wNzYgNC44Mi0zLjY0OCAzLjgzNHMtNC42NS03LjE1Mi4yNjIgMTQuNzM4eiIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgeGxpbms6aHJlZj0iI2EiIGZpbGw9IiNmZmYiLz48cGF0aCBzdHJva2U9IiMwMDAiIHN0cm9rZS1vcGFjaXR5PSIuMSIgZD0iTTI4LjQ1NiAyMS42NzVjLS4wMS0uMzEyLS4wODctLjgyNS0uMjU2LTEuNzAyLS4wOTYtLjQ5NS0uNjEyLTMuMDIyLS43NTMtMy43My0uMzk1LTEuOTgtLjc2LTMuOTItMS4xNDItNi4xMTMtLjczMi00LjIyMy0uNjkzLTYuMDUuMzQ0LTYuNTI3LjUtLjIzIDEuMDYtLjA4IDEuODQuMzUuNDE0LjIyNyAyLjE4MiAxLjM2NSAyLjA3IDEuMjk2IDEuOTk0IDEuMjQyIDMuNDY0IDEuNzc0IDQuOTMgMS41NDggMS41MjYtLjIzNyAyLjUwNC0uMDYgMi44NzYuNjE4LjM0OC42MzUuMDE1IDEuNDE2LS43MyAyLjE4LTEuNDcyIDEuNTE2LTMuOTc1IDIuNTE0LTUuODQ4IDIuMDIzLS44MjItLjIyLTEuMjM4LS40NjUtMi4zOC0xLjI2N2wtLjA5NS0uMDY2Yy4wNDcuNTkzLjI2NCAxLjc0LjcxNyAzLjgwMy4yOTQgMS4zMzYgMi4wOCA5LjE4NyAyLjYzNyAxMS42NzRsLjAwMi4wMTJjLjUyOCAyLjYzNy0xLjg3MyA0LjcyNC01LjIzNiA0LjcyNC0zLjI5IDAtNi4zNjMtMS45ODgtNi44NjItNC41MjgtLjUzLTIuNjQgMS44NzMtNC43MzQgNS4yMzMtNC43MzRhOC40IDguNCAwIDAgMSAyLjY1LjQzN3ptLTE2Ljk5NiA1Ljk5Yy0uMDEtLjMxOC0uMDktLjgzOC0uMjY2LTEuNzM3LS4wOS0uNDYtLjU5NS0yLjkzNy0uNzUzLTMuNzI3LS4zOS0xLjk2LS43NS0zLjg5LTEuMTMtNi4wNy0uNzMyLTQuMjIzLS42OTItNi4wNS4zNDQtNi41MjYuNTAyLS4yMyAxLjA2LS4wODIgMS44NC4zNS40MTUuMjI3IDIuMTgyIDEuMzY0IDIuMDcgMS4yOTUgMS45OTMgMS4yNDIgMy40NjIgMS43NzQgNC45MjYgMS41NDggMS41MjUtLjI0IDIuNTA0LS4wNjQgMi44NzYuNjE0LjM0OC42MzUuMDE1IDEuNDE1LS43MjggMi4xOC0xLjQ3NCAxLjUxNy0zLjk3NyAyLjUxMy01Ljg0NyAyLjAxNy0uODItLjIyLTEuMjM2LS40NjQtMi4zNzgtMS4yNjdsLS4wOTUtLjA2NWMuMDQ3LjU5My4yNjQgMS43NC43MTcgMy44MDIuMjk0IDEuMzM3IDIuMDc4IDkuMTkgMi42MzYgMTEuNjc1bC4wMDMuMDEzYy41MTcgMi42MzgtMS44ODQgNC43MzItNS4yMzQgNC43MzItMy4yODcgMC02LjM2LTEuOTkzLTYuODctNC41NC0uNTItMi42NCAxLjg4NC00LjczIDUuMjQtNC43My45MDUgMCAxLjgwMy4xNSAyLjY1LjQzNnoiLz48L2c+PC9zdmc+",blocks:[{opcode:"playDrumForBeats",blockType:i.COMMAND,text:a({id:"music.playDrumForBeats",default:"play drum [DRUM] for [BEATS] beats",description:"play drum sample for a number of beats"}),arguments:{DRUM:{type:r.NUMBER,menu:"DRUM",defaultValue:1},BEATS:{type:r.NUMBER,defaultValue:.25}}},{opcode:"midiPlayDrumForBeats",blockType:i.COMMAND,text:a({id:"music.midiPlayDrumForBeats",default:"play drum [DRUM] for [BEATS] beats",description:"play drum sample for a number of beats according to a mapping of MIDI codes"}),arguments:{DRUM:{type:r.NUMBER,menu:"DRUM",defaultValue:1},BEATS:{type:r.NUMBER,defaultValue:.25}},hideFromPalette:!0},{opcode:"restForBeats",blockType:i.COMMAND,text:a({id:"music.restForBeats",default:"rest for [BEATS] beats",description:"rest (play no sound) for a number of beats"}),arguments:{BEATS:{type:r.NUMBER,defaultValue:.25}}},{opcode:"playNoteForBeats",blockType:i.COMMAND,text:a({id:"music.playNoteForBeats",default:"play note [NOTE] for [BEATS] beats",description:"play a note for a number of beats"}),arguments:{NOTE:{type:r.NOTE,defaultValue:60},BEATS:{type:r.NUMBER,defaultValue:.25}}},{opcode:"setInstrument",blockType:i.COMMAND,text:a({id:"music.setInstrument",default:"set instrument to [INSTRUMENT]",description:"set the instrument (e.g. piano, guitar, trombone) for notes played"}),arguments:{INSTRUMENT:{type:r.NUMBER,menu:"INSTRUMENT",defaultValue:1}}},{opcode:"midiSetInstrument",blockType:i.COMMAND,text:a({id:"music.midiSetInstrument",default:"set instrument to [INSTRUMENT]",description:"set the instrument for notes played according to a mapping of MIDI codes"}),arguments:{INSTRUMENT:{type:r.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"setTempo",blockType:i.COMMAND,text:a({id:"music.setTempo",default:"set tempo to [TEMPO]",description:"set tempo (speed) for notes, drums, and rests played"}),arguments:{TEMPO:{type:r.NUMBER,defaultValue:60}}},{opcode:"changeTempo",blockType:i.COMMAND,text:a({id:"music.changeTempo",default:"change tempo by [TEMPO]",description:"change tempo (speed) for notes, drums, and rests played"}),arguments:{TEMPO:{type:r.NUMBER,defaultValue:20}}},{opcode:"getTempo",text:a({id:"music.getTempo",default:"tempo",description:"get the current tempo (speed) for notes, drums, and rests played"}),blockType:i.REPORTER}],menus:{DRUM:{acceptReporters:!0,items:this._buildMenu(this.DRUM_INFO)},INSTRUMENT:{acceptReporters:!0,items:this._buildMenu(this.INSTRUMENT_INFO)}}}}_isConcurrencyLimited(){return this.runtime.runtimeOptions.miscLimits&&this._concurrencyCounter>h.CONCURRENCY_LIMIT}playDrumForBeats(e,t){this._playDrumForBeats(e.DRUM,e.BEATS,t)}midiPlayDrumForBeats(e,t){let n=o.toNumber(e.DRUM);n=Math.round(n);const r=this.MIDI_DRUMS[n-35];n=r?r[0]:2,n+=1,this._playDrumForBeats(n,e.BEATS,t)}_playDrumForBeats(e,t,n){this._stackTimerNeedsInit(n)?(e=o.toNumber(e),e=Math.round(e),e-=1,e=c.wrapClamp(e,0,this.DRUM_INFO.length-1),t=o.toNumber(t),t=this._clampBeats(t),this._playDrumNum(n,e),this._startStackTimer(n,this._beatsToSec(t))):this._checkStackTimer(n)}_playDrumNum(e,t){if(null===e.runtime.audioEngine)return;if(null===e.target.sprite.soundBank)return;if(this._isConcurrencyLimited())return;const n=this._drumPlayers[t];if(void 0===n)return;n.isPlaying&&!n.isStarting&&n.take();const r=e.runtime.audioEngine,i=r.audioContext.createGain();i.gain.setValueAtTime(e.target.volume/100,r.currentTime),i.connect(r.getInputNode()),this._concurrencyCounter++,n.once("stop",(()=>{this._concurrencyCounter--})),n.play(),n.connect({getInputNode:()=>i})}restForBeats(e,t){if(this._stackTimerNeedsInit(t)){let n=o.toNumber(e.BEATS);n=this._clampBeats(n),this._startStackTimer(t,this._beatsToSec(n))}else this._checkStackTimer(t)}playNoteForBeats(e,t){if(this._stackTimerNeedsInit(t)){let n=o.toNumber(e.NOTE);n=c.clamp(n,h.MIDI_NOTE_RANGE.min,h.MIDI_NOTE_RANGE.max);let r=o.toNumber(e.BEATS);if(r=this._clampBeats(r),0===r)return;const i=this._beatsToSec(r);this._playNote(t,n,i),this._startStackTimer(t,i)}else this._checkStackTimer(t)}_playNoteForPicker(e,t){if(t!==this.getInfo().name)return;const n={runtime:this.runtime,target:this.runtime.getEditingTarget()};this._playNote(n,e,.25)}_playNote(e,t,n){if(null===e.runtime.audioEngine)return;if(null===e.target.sprite.soundBank)return;if(this._isConcurrencyLimited())return;const r=this._getMusicState(e.target).currentInstrument,i=this.INSTRUMENT_INFO[r].samples,s=this._selectSampleIndexForNote(t,i);if(void 0===this._instrumentPlayerArrays[r])return;if(void 0===this._instrumentPlayerArrays[r][s])return;const o=e.runtime.audioEngine;this._instrumentPlayerNoteArrays[r][t]||(this._instrumentPlayerNoteArrays[r][t]=this._instrumentPlayerArrays[r][s].take());const a=this._instrumentPlayerNoteArrays[r][t];a.isPlaying&&!a.isStarting&&a.take();const c=i[s],l=this._ratioForPitchInterval(t-c),u=o.audioContext,h=u.createGain();h.gain.setValueAtTime(e.target.volume/100,o.currentTime);const d=u.createGain();h.connect(d),d.connect(o.getInputNode());let p=this.INSTRUMENT_INFO[r].releaseTime;void 0===p&&(p=.01);const f=u.currentTime+n,m=f+p;d.gain.setValueAtTime(1,f),d.gain.linearRampToValueAtTime(1e-4,m),this._concurrencyCounter++,a.once("stop",(()=>{this._concurrencyCounter--})),a.play(),a.connect({getInputNode:()=>h}),a.outputNode.playbackRate.value=l,a.outputNode.stop(m)}_selectSampleIndexForNote(e,t){for(let n=t.length-1;n>=0;n--)if(e>=t[n])return n;return 0}_ratioForPitchInterval(e){return Math.pow(2,e/12)}_clampBeats(e){return c.clamp(e,h.BEAT_RANGE.min,h.BEAT_RANGE.max)}_beatsToSec(e){return 60/this.getTempo()*e}_stackTimerNeedsInit(e){return!e.stackFrame.timer}_startStackTimer(e,t){e.stackFrame.timer=new l,e.stackFrame.timer.start(),e.stackFrame.duration=t,e.yield()}_checkStackTimer(e){e.stackFrame.timer.timeElapsed()<1e3*e.stackFrame.duration&&e.yield()}setInstrument(e,t){this._setInstrument(e.INSTRUMENT,t,!1)}midiSetInstrument(e,t){this._setInstrument(e.INSTRUMENT,t,!0)}_setInstrument(e,t,n){const r=this._getMusicState(t.target);e=o.toNumber(e),e=Math.round(e),e-=1,n&&(e=(this.MIDI_INSTRUMENTS[e]||0)-1),e=c.wrapClamp(e,0,this.INSTRUMENT_INFO.length-1),r.currentInstrument=e}setTempo(e){const t=o.toNumber(e.TEMPO);this._updateTempo(t)}changeTempo(e){const t=o.toNumber(e.TEMPO)+this.getTempo();this._updateTempo(t)}_updateTempo(e){e=c.clamp(e,h.TEMPO_RANGE.min,h.TEMPO_RANGE.max);const t=this.runtime.getTargetForStage();t&&(t.tempo=e)}getTempo(){const e=this.runtime.getTargetForStage();return e?e.tempo:60}}e.exports=h},function(e,t,n){e.exports={"drums/1-snare.mp3":n(118),"drums/2-bass-drum.mp3":n(119),"drums/3-side-stick.mp3":n(120),"drums/4-crash-cymbal.mp3":n(121),"drums/5-open-hi-hat.mp3":n(122),"drums/6-closed-hi-hat.mp3":n(123),"drums/7-tambourine.mp3":n(124),"drums/8-hand-clap.mp3":n(125),"drums/9-claves.mp3":n(126),"drums/10-wood-block.mp3":n(127),"drums/11-cowbell.mp3":n(128),"drums/12-triangle.mp3":n(129),"drums/13-bongo.mp3":n(130),"drums/14-conga.mp3":n(131),"drums/15-cabasa.mp3":n(132),"drums/16-guiro.mp3":n(133),"drums/17-vibraslap.mp3":n(134),"drums/18-cuica.mp3":n(135),"instruments/1-piano/24.mp3":n(136),"instruments/1-piano/36.mp3":n(137),"instruments/1-piano/48.mp3":n(138),"instruments/1-piano/60.mp3":n(139),"instruments/1-piano/72.mp3":n(140),"instruments/1-piano/84.mp3":n(141),"instruments/1-piano/96.mp3":n(142),"instruments/1-piano/108.mp3":n(143),"instruments/2-electric-piano/60.mp3":n(144),"instruments/3-organ/60.mp3":n(145),"instruments/4-guitar/60.mp3":n(146),"instruments/5-electric-guitar/60.mp3":n(147),"instruments/6-bass/36.mp3":n(148),"instruments/6-bass/48.mp3":n(149),"instruments/7-pizzicato/60.mp3":n(150),"instruments/8-cello/36.mp3":n(151),"instruments/8-cello/48.mp3":n(152),"instruments/8-cello/60.mp3":n(153),"instruments/9-trombone/36.mp3":n(154),"instruments/9-trombone/48.mp3":n(155),"instruments/9-trombone/60.mp3":n(156),"instruments/10-clarinet/48.mp3":n(157),"instruments/10-clarinet/60.mp3":n(158),"instruments/11-saxophone/36.mp3":n(159),"instruments/11-saxophone/60.mp3":n(160),"instruments/11-saxophone/84.mp3":n(161),"instruments/12-flute/60.mp3":n(162),"instruments/12-flute/72.mp3":n(163),"instruments/13-wooden-flute/60.mp3":n(164),"instruments/13-wooden-flute/72.mp3":n(165),"instruments/14-bassoon/36.mp3":n(166),"instruments/14-bassoon/48.mp3":n(167),"instruments/14-bassoon/60.mp3":n(168),"instruments/15-choir/48.mp3":n(169),"instruments/15-choir/60.mp3":n(170),"instruments/15-choir/72.mp3":n(171),"instruments/16-vibraphone/60.mp3":n(172),"instruments/16-vibraphone/72.mp3":n(173),"instruments/17-music-box/60.mp3":n(174),"instruments/18-steel-drum/60.mp3":n(175),"instruments/19-marimba/60.mp3":n(176),"instruments/20-synth-lead/60.mp3":n(177),"instruments/21-synth-pad/60.mp3":n(178)}},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t){e.exports=null},function(e,t,n){const r=n(3),i=n(2),s=n(0),o=n(1),a=n(5),c=n(30),l=n(16),u=129,h=130,d="micro:bit extension stopped receiving data",p=61445,f="5261da01-fa7e-42ab-850b-7c80220097cc",m="5261da02-fa7e-42ab-850b-7c80220097cc";class g{constructor(e,t){this._runtime=e,this._ble=null,this._runtime.registerPeripheralExtension(t,this),this._extensionId=t,this._sensors={tiltX:0,tiltY:0,buttonA:0,buttonB:0,touchPins:[0,0,0],gestureState:0,ledMatrixState:new Uint8Array(5)},this._gestures={moving:!1,move:{active:!1,timeout:!1},shake:{active:!1,timeout:!1},jump:{active:!1,timeout:!1}},this._timeoutID=null,this._busy=!1,this._busyTimeoutID=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this)}displayText(e){const t=new Uint8Array(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return this.send(u,t)}displayMatrix(e){return this.send(h,e)}get tiltX(){return this._sensors.tiltX}get tiltY(){return this._sensors.tiltY}get buttonA(){return this._sensors.buttonA}get buttonB(){return this._sensors.buttonB}get gestureState(){return this._sensors.gestureState}get ledMatrixState(){return this._sensors.ledMatrixState}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{services:[p]}]},this._onConnect,this.reset)}connect(e){this._ble&&this._ble.connectPeripheral(e)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._timeoutID&&(window.clearTimeout(this._timeoutID),this._timeoutID=null)}isConnected(){let e=!1;return this._ble&&(e=this._ble.isConnected()),e}send(e,t){if(!this.isConnected())return;if(this._busy)return;this._busy=!0,this._busyTimeoutID=window.setTimeout((()=>{this._busy=!1}),5e3);const n=new Uint8Array(t.length+1);n[0]=e;for(let e=0;e<t.length;e++)n[e+1]=t[e];const r=l.uint8ArrayToBase64(n);this._ble.write(p,m,r,"base64",!0).then((()=>{this._busy=!1,window.clearTimeout(this._busyTimeoutID)}))}_onConnect(){this._ble.read(p,f,!0,this._onMessage),this._timeoutID=window.setTimeout((()=>this._ble.handleDisconnectError(d)),4500)}_onMessage(e){const t=l.base64ToUint8Array(e);this._sensors.tiltX=t[1]|t[0]<<8,this._sensors.tiltX>32768&&(this._sensors.tiltX-=65536),this._sensors.tiltY=t[3]|t[2]<<8,this._sensors.tiltY>32768&&(this._sensors.tiltY-=65536),this._sensors.buttonA=t[4],this._sensors.buttonB=t[5],this._sensors.touchPins[0]=t[6],this._sensors.touchPins[1]=t[7],this._sensors.touchPins[2]=t[8],this._sensors.gestureState=t[9],window.clearTimeout(this._timeoutID),this._timeoutID=window.setTimeout((()=>this._ble.handleDisconnectError(d)),4500)}_checkPinState(e){return this._sensors.touchPins[e]}}const b="front",y="back",E="left",T="right",v="any",A="moved",w="shaken",S="jumped",k="A",O="B",I="any",N="on",R="off";class x{static get EXTENSION_NAME(){return"micro:bit"}static get EXTENSION_ID(){return"microbit"}static get TILT_THRESHOLD(){return 15}get BUTTONS_MENU(){return[{text:"A",value:k},{text:"B",value:O},{text:a({id:"microbit.buttonsMenu.any",default:"any",description:'label for "any" element in button picker for micro:bit extension'}),value:I}]}get GESTURES_MENU(){return[{text:a({id:"microbit.gesturesMenu.moved",default:"moved",description:"label for moved gesture in gesture picker for micro:bit extension"}),value:A},{text:a({id:"microbit.gesturesMenu.shaken",default:"shaken",description:"label for shaken gesture in gesture picker for micro:bit extension"}),value:w},{text:a({id:"microbit.gesturesMenu.jumped",default:"jumped",description:"label for jumped gesture in gesture picker for micro:bit extension"}),value:S}]}get PIN_STATE_MENU(){return[{text:a({id:"microbit.pinStateMenu.on",default:"on",description:"label for on element in pin state picker for micro:bit extension"}),value:N},{text:a({id:"microbit.pinStateMenu.off",default:"off",description:"label for off element in pin state picker for micro:bit extension"}),value:R}]}get TILT_DIRECTION_MENU(){return[{text:a({id:"microbit.tiltDirectionMenu.front",default:"front",description:"label for front element in tilt direction picker for micro:bit extension"}),value:b},{text:a({id:"microbit.tiltDirectionMenu.back",default:"back",description:"label for back element in tilt direction picker for micro:bit extension"}),value:y},{text:a({id:"microbit.tiltDirectionMenu.left",default:"left",description:"label for left element in tilt direction picker for micro:bit extension"}),value:E},{text:a({id:"microbit.tiltDirectionMenu.right",default:"right",description:"label for right element in tilt direction picker for micro:bit extension"}),value:T}]}get TILT_DIRECTION_ANY_MENU(){return[...this.TILT_DIRECTION_MENU,{text:a({id:"microbit.tiltDirectionMenu.any",default:"any",description:"label for any direction element in tilt direction picker for micro:bit extension"}),value:v}]}constructor(e){this.runtime=e,this._peripheral=new g(this.runtime,x.EXTENSION_ID)}getInfo(){return{id:x.EXTENSION_ID,name:x.EXTENSION_NAME,blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAACXBIWXMAABYlAAAWJQFJUiTwAAAChVBMVEX///8jHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyAjHyA5UHZxXSY1OEJvXCY4O0eNcyc/X5GKcCc7P0yFbSY6PkqmhB9eVj9+ai5cVD6WeiaUeCasiB9wYjhXUkSggSVDa6aegCQ9QlFtYDs+Q1KmhSO0jh6RmrKtiiHAlhm0jh9ARVW2kB+7kx2aorjFmhiVnbXCmBrToxNJgdFBR1asiiVJg9bCmRvbqBCRmrLYphFBR1fgqw7irA1zZ0DWpRPmrwvnsArosAuUnLThrA3sswjsswnutAfvtQfwtga6lB/ytwbqsgn2uQT4ugPdqg/psQr5uwL5uwP6vAL1uAX7vAL7vQI5PUk7P009QlA+Q1E/RFM/RFRARVRBR1dCR1dCTGJCUWxDUWxDVndEW4FEYIxFSlpFYpFFZZZFZ5pGaqFHb6tHdLZITFpIecBIfMZJfstJgdBJg9VJhNhKTl1KUF5LUWBLjepLjetLkO9LkfJLkfNLkvVMiuNMl/9NT1JNU2JNhdZNh9tNiN5Nk/ZQgstSV2ZSerpUbJdUcKBVW2lWYX1XXnVZVkxZXmxgZXJhZG5lXkdpbXlqb3txZUFzd4J2cF95fYh9bTyAh5qAh5uBdliFjKCGjJ+JdDaTmq2UfDGborOcn6afoqiggyugiEKlp6ynqrCrjjusiyavsLaxt8a1lDO1t7y4kiC/wcXAmizEmhvFxcjFx8rJys3KoSXLz9fMzdDPoRbQoRXQ0dTS1NbVpx3ZpxHZpxLbqBHcqRDc3eDfrRbf4eTg4eLh4uPirA3jrQ3k5ebm5+josAvpsQrqsgnqsw/rsgnxtgbzuAX0uAX0uQf09PX2uQT/vwCQ+pAlAAAAWHRSTlMAAgMFBwoLDQ8QFBUzMzQ0REpNTVBQU1dbW11maG92eXx+fn+CjZOcoKamt7jDxsjN0NPX2uPj6ert7/Hy9PT19fb29vf3+Pj5+fn6+vz8/P39/f39/v7+zND1kwAAA6hJREFUeNrt2OlbTFEcwPE7YyxF9n1fs4fsy9ijkKGkZPkJ155Bliy52SO0KIlEKRqEEnKpTEW6qbQ4f4+Ze87M7c6985xnmt6Z74tzz3me83yeO/2aXsR48uTpf2nWotVvxBatntQh4IzP9lwANT3mcG07iR9G6xK3DygtmeDlCHadL/OMLH4A9uiN0zmAfeUesPgB2KM31/EVx8g9YPEDiEfP2xlIIBY/gObRQQKx+AFWj42OPiq2pz0ggVgj2DrEcediLMXhj+8qSKAosBfHHbK+WtTeaO6ESyDxFHEccBYx2shyMS6Dkuf2Gyo893+GxFO2/0SMmFHu0UGlR+/glauxsRcOq4Dt8+DI7VscdwpUQOy5DiYkiJ4SVPXS0s4CJKclkiUxLZksEshhTwEOBLUE4SFAqVBAlgKhlCwSKHougA8ASoQ8suQJJWSRQOKpgztxu8BWRMQOgG0RkWSJjNiGF5J0Xx08/SRb7PFuoCe7rw5uf1YtiFU/2kUfivy+KhiZKwg/376vFYTsnfShyO87A3/cBLhfi0HaUKT76uDlype5wnMAOPANg9ShREr3X1deVoBJrR9kIC0J/Chkf21NUoCQdEz2EShDkX/kM0kdPRTqrw19KPL71F9s+lBk9+lfPXr0r55Y1EXWlT9fJOdg1HkOg9Sh0EHiEZA6FDqIvYTrGKQOhQ6K3vU7NwhIjw4ePx976eq1fR02FEXuDkWRu0NR5O5QXI4OZvLN7+IBl2pG6BWA6imer6vjbRcz61DzU3UwM2Csjz8PuLqZI4ahTLCd/Ef7hNlPxQt69pyXD2L30MRBU5rjVUHeT8N0Q6n4lVAfRudXDEBOoxmtr+0EaDDD9DeDWE5wZ6bLwhwnoE7jjdLBWjry0Xr58gDk1K+T1wDeDg7VaociEMsP8NJ2989XB5Gfb7Ad3Ow7NlgCw6YOD5DATeNHrbeBaPnwyWFqYCpfj6z9rqgvr2j8Je7/1tdUfC+vaTTjk3XL19TwSKyx3LKt/yPuv/BKMB01oZYqJNWAH03k1IC3uDJkr8qaGamDpgwklSUDX5jwFuspGXYy5W5KVpYzsKoISZXJwKKyNmCLydSCSIWmT0WFKqD3MnxfUZNyq8yMpnVzAHUjm90BN/fWMA51HjJ77catG0PX6IP0+sAVoZZtyIaglfql+lWB+tAQQ3jIBut28aqVi8NDDAZDaKDesg1aZwg3GLZM79WJUaTRdW1vXXSe/x158uSJ0j/jGCbCo03iNQAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"whenButtonPressed",text:a({id:"microbit.whenButtonPressed",default:"when [BTN] button pressed",description:"when the selected button on the micro:bit is pressed"}),blockType:i.HAT,arguments:{BTN:{type:r.STRING,menu:"buttons",defaultValue:k}}},{opcode:"isButtonPressed",text:a({id:"microbit.isButtonPressed",default:"[BTN] button pressed?",description:"is the selected button on the micro:bit pressed?"}),blockType:i.BOOLEAN,arguments:{BTN:{type:r.STRING,menu:"buttons",defaultValue:k}}},"---",{opcode:"whenGesture",text:a({id:"microbit.whenGesture",default:"when [GESTURE]",description:"when the selected gesture is detected by the micro:bit"}),blockType:i.HAT,arguments:{GESTURE:{type:r.STRING,menu:"gestures",defaultValue:A}}},"---",{opcode:"displaySymbol",text:a({id:"microbit.displaySymbol",default:"display [MATRIX]",description:"display a pattern on the micro:bit display"}),blockType:i.COMMAND,arguments:{MATRIX:{type:r.MATRIX,defaultValue:"0101010101100010101000100"}}},{opcode:"displayText",text:a({id:"microbit.displayText",default:"display text [TEXT]",description:"display text on the micro:bit display"}),blockType:i.COMMAND,arguments:{TEXT:{type:r.STRING,defaultValue:a({id:"microbit.defaultTextToDisplay",default:"Hello!",description:'default text to display.\n                                IMPORTANT - the micro:bit only supports letters a-z, A-Z.\n                                Please substitute a default word in your language\n                                that can be written with those characters,\n                                substitute non-accented characters or leave it as "Hello!".\n                                Check the micro:bit site documentation for details'})}}},{opcode:"displayClear",text:a({id:"microbit.clearDisplay",default:"clear display",description:"display nothing on the micro:bit display"}),blockType:i.COMMAND},"---",{opcode:"whenTilted",text:a({id:"microbit.whenTilted",default:"when tilted [DIRECTION]",description:"when the micro:bit is tilted in a direction"}),blockType:i.HAT,arguments:{DIRECTION:{type:r.STRING,menu:"tiltDirectionAny",defaultValue:v}}},{opcode:"isTilted",text:a({id:"microbit.isTilted",default:"tilted [DIRECTION]?",description:"is the micro:bit is tilted in a direction?"}),blockType:i.BOOLEAN,arguments:{DIRECTION:{type:r.STRING,menu:"tiltDirectionAny",defaultValue:v}}},{opcode:"getTiltAngle",text:a({id:"microbit.tiltAngle",default:"tilt angle [DIRECTION]",description:"how much the micro:bit is tilted in a direction"}),blockType:i.REPORTER,arguments:{DIRECTION:{type:r.STRING,menu:"tiltDirection",defaultValue:b}}},"---",{opcode:"whenPinConnected",text:a({id:"microbit.whenPinConnected",default:"when pin [PIN] connected",description:"when the pin detects a connection to Earth/Ground"}),blockType:i.HAT,arguments:{PIN:{type:r.STRING,menu:"touchPins",defaultValue:"0"}}}],menus:{buttons:{acceptReporters:!0,items:this.BUTTONS_MENU},gestures:{acceptReporters:!0,items:this.GESTURES_MENU},pinState:{acceptReporters:!0,items:this.PIN_STATE_MENU},tiltDirection:{acceptReporters:!0,items:this.TILT_DIRECTION_MENU},tiltDirectionAny:{acceptReporters:!0,items:this.TILT_DIRECTION_ANY_MENU},touchPins:{acceptReporters:!0,items:["0","1","2"]}}}}whenButtonPressed(e){return"any"===e.BTN?this._peripheral.buttonA|this._peripheral.buttonB:"A"===e.BTN?this._peripheral.buttonA:"B"===e.BTN&&this._peripheral.buttonB}isButtonPressed(e){return"any"===e.BTN?!!(this._peripheral.buttonA|this._peripheral.buttonB):"A"===e.BTN?0!==this._peripheral.buttonA:"B"===e.BTN&&0!==this._peripheral.buttonB}whenGesture(e){const t=o.toString(e.GESTURE);return"moved"===t?this._peripheral.gestureState>>2&1:"shaken"===t?1&this._peripheral.gestureState:"jumped"===t&&this._peripheral.gestureState>>1&1}displaySymbol(e){const t=o.toString(e.MATRIX).replace(/\s/g,"").split("").reduce(((e,t,n)=>"0"===t?e:e+Math.pow(2,n)),0);return null!==t&&(this._peripheral.ledMatrixState[0]=31&t,this._peripheral.ledMatrixState[1]=t>>5&31,this._peripheral.ledMatrixState[2]=t>>10&31,this._peripheral.ledMatrixState[3]=t>>15&31,this._peripheral.ledMatrixState[4]=t>>20&31,this._peripheral.displayMatrix(this._peripheral.ledMatrixState)),new Promise((e=>{setTimeout((()=>{e()}),100)}))}displayText(e){const t=String(e.TEXT).substring(0,19);t.length>0&&this._peripheral.displayText(t);const n=120*(6*t.length+6);return new Promise((e=>{setTimeout((()=>{e()}),n)}))}displayClear(){for(let e=0;e<5;e++)this._peripheral.ledMatrixState[e]=0;return this._peripheral.displayMatrix(this._peripheral.ledMatrixState),new Promise((e=>{setTimeout((()=>{e()}),100)}))}whenTilted(e){return this._isTilted(e.DIRECTION)}isTilted(e){return this._isTilted(e.DIRECTION)}getTiltAngle(e){return this._getTiltAngle(e.DIRECTION)}_isTilted(e){return e===v?Math.abs(this._peripheral.tiltX/10)>=x.TILT_THRESHOLD||Math.abs(this._peripheral.tiltY/10)>=x.TILT_THRESHOLD:this._getTiltAngle(e)>=x.TILT_THRESHOLD}_getTiltAngle(e){switch(e){case b:return Math.round(this._peripheral.tiltY/-10);case y:return Math.round(this._peripheral.tiltY/10);case E:return Math.round(this._peripheral.tiltX/-10);case T:return Math.round(this._peripheral.tiltX/10);default:s.warn("Unknown tilt direction in _getTiltAngle: ".concat(e))}}whenPinConnected(e){const t=parseInt(e.PIN,10);if(!isNaN(t))return!(t<0||t>2)&&this._peripheral._checkPinState(t)}}e.exports=x},function(e,t,n){const r=n(5),i=n(61),s=n(3),o=n(2),a=n(1),c=n(4),l=n(12),u=n(0),{fetchWithTimeout:h}=n(41),d="ALTO",p="TENOR",f="SQUEAK",m="GIANT",g="KITTEN",b="ar",y="zh-cn",E="da",T="nl",v="en",A="fr",w="de",S="hi",k="is",O="it",I="ja",N="ko",R="nb",x="pl",M="pt-br",C="pt",P="ro",D="ru",L="es",B="es-419",U="sv",F="tr",j="cy";class z{constructor(e){this.runtime=e,this._soundPlayers=new Map,this._stopAllSpeech=this._stopAllSpeech.bind(this),this.runtime&&this.runtime.on("PROJECT_STOP_ALL",this._stopAllSpeech),this._onTargetCreated=this._onTargetCreated.bind(this),this.runtime&&e.on("targetWasCreated",this._onTargetCreated),this._supportedLocales=this._getSupportedLocales()}get VOICE_INFO(){return{[d]:{name:r({id:"text2speech.alto",default:"alto",description:"Name for a voice with ambiguous gender."}),gender:"female",playbackRate:1},[p]:{name:r({id:"text2speech.tenor",default:"tenor",description:"Name for a voice with ambiguous gender."}),gender:"male",playbackRate:1},[f]:{name:r({id:"text2speech.squeak",default:"squeak",description:"Name for a funny voice with a high pitch."}),gender:"female",playbackRate:1.19},[m]:{name:r({id:"text2speech.giant",default:"giant",description:"Name for a funny voice with a low pitch."}),gender:"male",playbackRate:.84},[g]:{name:r({id:"text2speech.kitten",default:"kitten",description:"A baby cat."}),gender:"female",playbackRate:1.41}}}get LANGUAGE_INFO(){return{[b]:{name:"Arabic",locales:["ar"],speechSynthLocale:"arb",singleGender:!0},[y]:{name:"Chinese (Mandarin)",locales:["zh-cn","zh-tw"],speechSynthLocale:"cmn-CN",singleGender:!0},[E]:{name:"Danish",locales:["da"],speechSynthLocale:"da-DK"},[T]:{name:"Dutch",locales:["nl"],speechSynthLocale:"nl-NL"},[v]:{name:"English",locales:["en"],speechSynthLocale:"en-US"},[A]:{name:"French",locales:["fr"],speechSynthLocale:"fr-FR"},[w]:{name:"German",locales:["de"],speechSynthLocale:"de-DE"},[S]:{name:"Hindi",locales:["hi"],speechSynthLocale:"hi-IN",singleGender:!0},[k]:{name:"Icelandic",locales:["is"],speechSynthLocale:"is-IS"},[O]:{name:"Italian",locales:["it"],speechSynthLocale:"it-IT"},[I]:{name:"Japanese",locales:["ja","ja-hira"],speechSynthLocale:"ja-JP"},[N]:{name:"Korean",locales:["ko"],speechSynthLocale:"ko-KR",singleGender:!0},[R]:{name:"Norwegian",locales:["nb","nn"],speechSynthLocale:"nb-NO",singleGender:!0},[x]:{name:"Polish",locales:["pl"],speechSynthLocale:"pl-PL"},[M]:{name:"Portuguese (Brazilian)",locales:["pt-br"],speechSynthLocale:"pt-BR"},[C]:{name:"Portuguese (European)",locales:["pt"],speechSynthLocale:"pt-PT"},[P]:{name:"Romanian",locales:["ro"],speechSynthLocale:"ro-RO",singleGender:!0},[D]:{name:"Russian",locales:["ru"],speechSynthLocale:"ru-RU"},[L]:{name:"Spanish (European)",locales:["es"],speechSynthLocale:"es-ES"},[B]:{name:"Spanish (Latin American)",locales:["es-419"],speechSynthLocale:"es-US"},[U]:{name:"Swedish",locales:["sv"],speechSynthLocale:"sv-SE",singleGender:!0},[F]:{name:"Turkish",locales:["tr"],speechSynthLocale:"tr-TR",singleGender:!0},[j]:{name:"Welsh",locales:["cy"],speechSynthLocale:"cy-GB",singleGender:!0}}}static get STATE_KEY(){return"Scratch.text2speech"}static get DEFAULT_TEXT2SPEECH_STATE(){return{voiceId:d}}get DEFAULT_LANGUAGE(){return"en"}_getState(e){let t=e.getCustomState(z.STATE_KEY);return t||(t=l.simple(z.DEFAULT_TEXT2SPEECH_STATE),e.setCustomState(z.STATE_KEY,t)),t}_onTargetCreated(e,t){if(t){const n=t.getCustomState(z.STATE_KEY);n&&e.setCustomState(z.STATE_KEY,l.simple(n))}}getInfo(){let e="hello";return this.isSupportedLanguage(this.getEditorLanguage())&&(e=r({id:"text2speech.defaultTextToSpeak",default:"hello",description:"hello: the default text to speak"})),{id:"text2speech",name:r({id:"text2speech.categoryName",default:"Text to Speech",description:"Name of the Text to Speech extension."}),blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48dGl0bGU+RXh0ZW5zaW9ucy9Tb2Z0d2FyZS9UZXh0LXRvLVNwZWVjaC1CbG9jazwvdGl0bGU+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJub256ZXJvIiBzdHJva2U9IiMwMDAiIHN0cm9rZS1vcGFjaXR5PSIuMTUiPjxwYXRoIGZpbGw9IiM0ZDRkNGQiIGQ9Ik0xNS41IDIxLjY3YzAtMS4wMTYtMS40OTQtMS41ODYtMi4zODctLjc4MmwtMi43IDIuMTYzQTUuOTYgNS45NiAwIDAgMSA2LjcgMjQuMzNoLS40Yy0xLjAzNSAwLTEuOC42OS0xLjggMS41NzN2NC4yMzVjMCAuODgzLjc2NSAxLjU3MiAxLjggMS41NzJoLjRjMS40NTggMCAyLjc1NC40MjMgMy44MiAxLjI4N2wyLjU5OCAyLjE2MWMuOTA4Ljc1IDIuMzgyLjE4OCAyLjM4Mi0uODc2eiIvPjxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0yNS42NDQgMjAuNWMtMS42NjcgMS45MzctNC41MzkgMy40MjktNS45NzcgMy40MjlhMS4yNSAxLjI1IDAgMCAxLS41NTctLjEzN2MtLjM3Mi0uMTg2LS42MS0uNTQyLS42MS0xLjAzcTAtLjE1Ny4wNS0uMzA4Yy4wNzYtLjIzNi42MjQtLjk4Ni43MjctMS4xNzMuMjctLjQ4NC40NjItMS4wNzUuNTY2LTEuODY1QTguNSA4LjUgMCAwIDEgMjQgMy41aDRhOC41IDguNSAwIDEgMSAwIDE3eiIvPjwvZz48L3N2Zz4=",menuIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48dGl0bGU+RXh0ZW5zaW9ucy9Tb2Z0d2FyZS9UZXh0LXRvLVNwZWVjaC1NZW51PC90aXRsZT48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9Im5vbnplcm8iPjxwYXRoIGZpbGw9IiM0ZDRkNGQiIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLW9wYWNpdHk9Ii4xNSIgc3Ryb2tlLXdpZHRoPSIuNSIgZD0iTTcuNzUgMTAuODM1YzAtLjUwOC0uNzQ3LS43OTMtMS4xOTQtLjM5bC0xLjM1IDEuMDhjLS41MS40MDgtMS4xNjkuNjQtMS44NTYuNjRoLS4yYy0uNTE3IDAtLjkuMzQ2LS45Ljc4N3YyLjExN2MwIC40NDIuMzgzLjc4Ny45Ljc4N2guMmMuNzI5IDAgMS4zNzcuMjEgMS45MS42NDNsMS4zIDEuMDhjLjQ1My4zNzYgMS4xOS4wOTUgMS4xOS0uNDM3eiIvPjxwYXRoIGZpbGw9IiMwZWJkOGMiIGQ9Ik0xMi43MDUgMTBjLS45MTQgMS4xMzEtMi4zOTggMS43MTQtMi44NzIgMS43MTQgMCAwLS4zMzMgMC0uMzMzLS4zMzMgMC0uMjk2LjU2Mi0uNDguNjktMS44MTNBNCA0IDAgMCAxIDEyIDJoMmE0IDQgMCAxIDEgMCA4eiIvPjwvZz48L3N2Zz4=",blocks:[{opcode:"speakAndWait",text:r({id:"text2speech.speakAndWaitBlock",default:"speak [WORDS]",description:"Speak some words."}),blockType:o.COMMAND,arguments:{WORDS:{type:s.STRING,defaultValue:e}}},{opcode:"setVoice",text:r({id:"text2speech.setVoiceBlock",default:"set voice to [VOICE]",description:"Set the voice for speech synthesis."}),blockType:o.COMMAND,arguments:{VOICE:{type:s.STRING,menu:"voices",defaultValue:d}}},{opcode:"setLanguage",text:r({id:"text2speech.setLanguageBlock",default:"set language to [LANGUAGE]",description:"Set the language for speech synthesis."}),blockType:o.COMMAND,arguments:{LANGUAGE:{type:s.STRING,menu:"languages",defaultValue:this.getCurrentLanguage()}}}],menus:{voices:{acceptReporters:!0,items:this.getVoiceMenu()},languages:{acceptReporters:!0,items:this.getLanguageMenu()}}}}getEditorLanguage(){return(r.setup().locale||navigator.language||navigator.userLanguage||this.DEFAULT_LANGUAGE).toLowerCase()}getCurrentLanguage(){const e=this.runtime.getTargetForStage();return e?(e.textToSpeechLanguage||this.setCurrentLanguage(this.getEditorLanguage()),e.textToSpeechLanguage):this.DEFAULT_LANGUAGE}setCurrentLanguage(e){const t=this.runtime.getTargetForStage();if(!t)return;this.isSupportedLanguage(e)&&(t.textToSpeechLanguage=this._getExtensionLocaleForSupportedLocale(e));const n=i.nameMap[e.toLowerCase()];n&&this.isSupportedLanguage(n)&&(t.textToSpeechLanguage=this._getExtensionLocaleForSupportedLocale(n)),t.textToSpeechLanguage||(t.textToSpeechLanguage=this.DEFAULT_LANGUAGE)}_getExtensionLocaleForSupportedLocale(e){for(const t in this.LANGUAGE_INFO)if(this.LANGUAGE_INFO[t].locales.includes(e))return t;u.error("cannot find extension locale for locale ".concat(e))}_getSpeechSynthLocale(){let e=this.LANGUAGE_INFO[this.DEFAULT_LANGUAGE].speechSynthLocale;return this.LANGUAGE_INFO[this.getCurrentLanguage()]&&(e=this.LANGUAGE_INFO[this.getCurrentLanguage()].speechSynthLocale),e}_getSupportedLocales(){return Object.keys(this.LANGUAGE_INFO).reduce(((e,t)=>e.concat(this.LANGUAGE_INFO[t].locales)),[])}isSupportedLanguage(e){return this._supportedLocales.includes(e)}getVoiceMenu(){return Object.keys(this.VOICE_INFO).map((e=>({text:this.VOICE_INFO[e].name,value:e})))}getLanguageMenu(){const e=this.getEditorLanguage(),t={};let n=i.menuMap[e];if(n){let r=[];i.spokenLanguages&&(r=i.spokenLanguages[e],n=n.concat(r)),n.forEach((e=>{t[e.code]=e.name}))}return Object.keys(this.LANGUAGE_INFO).map((e=>{let n=this.LANGUAGE_INFO[e].name;const r=t[e];return r&&(n=r),n=n.charAt(0).toUpperCase()+n.slice(1),{text:n,value:e}}))}setVoice(e,t){const n=this._getState(t.target);let r=e.VOICE,i=parseInt(r,10);isNaN(i)||(i-=1,i=c.wrapClamp(i,0,Object.keys(this.VOICE_INFO).length-1),r=Object.keys(this.VOICE_INFO)[i]),Object.keys(this.VOICE_INFO).includes(r)&&(n.voiceId=r)}setLanguage(e){this.setCurrentLanguage(e.LANGUAGE)}_stopAllSpeech(){this._soundPlayers.forEach((e=>{e.stop()}))}speakAndWait(e,t){let n=a.toString(e.WORDS),r=this._getSpeechSynthLocale();const i=this._getState(t.target);let s=this.VOICE_INFO[i.voiceId].gender,o=this.VOICE_INFO[i.voiceId].playbackRate;this.LANGUAGE_INFO[this.getCurrentLanguage()].singleGender&&(s="female",i.voiceId===p&&(o=.89),i.voiceId===m&&(o=.79)),i.voiceId===g&&(n=n.replace(/\S+/g,"meow"),r=this.LANGUAGE_INFO[this.DEFAULT_LANGUAGE].speechSynthLocale);let c="".concat("https://synthesis-service.scratch.mit.edu","/synth");return c+="?locale=".concat(r),c+="&gender=".concat(s),c+="&text=".concat(encodeURIComponent(n.substring(0,128))),h(c,{},1e4).then((e=>{if(200!==e.status)throw new Error("HTTP ".concat(e.status," error reaching translation service"));return e.arrayBuffer()})).then((e=>{const t={data:{buffer:e}};return this.runtime.audioEngine.decodeSoundPlayer(t)})).then((e=>{this._soundPlayers.set(e.id,e),e.setPlaybackRate(o);const t=this.runtime.audioEngine.createEffectChain();return t.set("volume",250),e.connect(t),e.play(),new Promise((t=>{e.on("stop",(()=>{this._soundPlayers.delete(e.id),t()}))}))})).catch((e=>{u.warn(e)}))}}e.exports=z},function(e,t,n){const r=n(3),i=n(2),s=n(1),o=n(0),{fetchWithTimeout:a}=n(41),c=n(61),l=n(5);e.exports=class{constructor(){this._viewerLanguageCode=this.getViewerLanguageCode(),this._supportedLanguages=[],this._randomLanguageCode="en",this._translateResult="",this._lastLangTranslated="",this._lastTextTranslated=""}static get STATE_KEY(){return"Scratch.translate"}getInfo(){return this._supportedLanguages=this._getSupportedLanguages(this.getViewerLanguageCode()),this._randomLanguageCode=this._supportedLanguages[Math.floor(Math.random()*this._supportedLanguages.length)].value,{id:"translate",name:l({id:"translate.categoryName",default:"Translate",description:"Name of extension that adds translate blocks"}),blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAACXBIWXMAABYlAAAWJQFJUiTwAAABTVBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABMTExHR0dFRUVtbW1qamoAAACEhISWlpakpKSurq62tra9vb3Dw8PHx8fLy8vPz8/S0tLV1dXX19dGiedMl/9Nl/9PmP9Qmf9Rmf9Smv9WnP9XXnVYnf9Znv9an/9coP9hZ31ho/9jpP9mpf9op/9rcoZrqf9uqv9zrf92fI52r/96otl6sf9/tP+BhpeDtv+LkKCMvP+OrtmPvv+Rv/+WmqibxP+gpLGgx/+rrrqrzf+1uMK10/+41f+5ubm82P/AwsvH3v/KzNTS5f/V19zW19nZ2dnZ4u7b29vd6//e3t7f4eXg4ODi4uLl5eXn5+fp8v/q6urq6+7s7Ozu7u7x8fHz8/P09fb0+P/19fX4+Pj6+vr9/f3///9QAhvhAAAAJHRSTlMAAgUHCgwOERMVGBodHyEkJi8yND9BRk9caniFk6GuvMnX5fIj/n0CAAAEq0lEQVR42u2Y23ebRhDGkdElFhgTEiIkRxcgIFmV29pJXTW9xU0bu7bT+tZusSIhOZEU2Zj//7EL8naxF+agJo/+Hnw4PuLHzM7AN7vcve4Vr9yyKKuyKBaWPgsus1KpGwhLr6pFEJnJC6tyolaFfIYLJNSdi6nnX19OXNRQC8m8grKmI0D6mhLeLaOxfyPPNcvFJF6xbPbGV36irsY9fHcIHNL/jlGlmMCr4AcDoncXq6g/GIw9P9QEVR7E5ltGE4hF7i4XuIxY0spPdfL8ianGVCajmCQ+UGNTwZXhs9m8WDZvMh80YpLOr/X8VOqt5cktJXOek4fUHH8XKOgxAZ7MYkLUBS4UL2nVmyDcmqZJudvAVcTW94/1L0ZsrdEqF2hJ0XFp5oWZDvrIKGW5qGTkM/rV3jjzGSF53hR1J5rT1DGETwOKaOpH5SElCTjbsona5GJrxgDvdNkUyUnAo6bFqHnEpFzrXftU1/1Gcsq/dbsvbPvrbqi2tf6i2/2FSTmj6P3rCE9XeGgNZ7b1Fblox64hxxMi5UFF+c5qhQU5aNqvGGCUSHkw8KxlfxMEuGG1RiwwSqQ8uG227NZb399t2l22baJEj/Jg4FnTao/ObcsescAIsY4GqEF4cGP/iLuvbTV3fQDI8ZK6pkqEBwPx8uGOfu5DQKxslr7DMNA/si2cMABkBAMPWjZewfZJUMaJ6yCiP58kuCEMPP+2ZeE1tK3m96MxoUFuCAPPfmph1KvZ7HnTsp+9/juFG0LAt1tNjNs48bF+X3/2Qzo3TAaerONirO/O/FD/vE7rhokWcNJufXkwI6+9g1K7YaJJjc6jj17YDWEbdYEAGTdMY/QOAurLuGGKUQQhP6WQDAxLIPB9B+svAMiOczBwLwC+gYHRgZOGOQzeXBa4GQA3P0JAOhKLKvL+45klWX7CAE87oY5TAEO3dUlHu2YpH/cV2sHh4SB3UgGzGumSq57+GPNY4MdgAd/gP+/TAFf0i3l4H1D1Ic/FAQ8x6zRI+zANUEZXIc4xNCHDxQJfdjrbYWG20wClmns5HTpGhYyPDPAdjm3P94Oc36UAFh7pyKiVpXzil3xvTjqlrQhXOS+I4jIPWAPOlWgzCQi4IgM87kR0DAKpb68AEe5gzs+hOqQVISCvNNAA1RWeBdLvwks/1HbQigCQTlMenX0Y4CHtvz1yyQKh6YwCaVi0f7ZBIDs/ssD9/f3DyPV+PBCccFcXswCWR4kZxg0XMimhEfAosVcr/r9NJV386Z1RQFx82xuVgrw7GyNx4Y35LYmGEw1x7NSLix4d3Fa2ZKD+YM70Bn2kK0sLHm7cVU7SNGIovaom8eDxy5AGRwZOVnyOWN4E+xN4QFQyh3Rbq4pkJGZUbAyIg5bFfDbLc6zIcYNLuszFDZakJdWckET0p5pWEjNJxMd6j/gj0rKJxAcV0iPeeIBLU018OP+wij7Mg7zQVzgqcGIaAnuSjKAZToi8An4V9ojr0QpCP81JFcMZTi/dmsQBKqgN5E4ur31veuHUBQ5SXirXDKQ/KnCQlopqNWw7o15ZyXCw+GVRFAIPh5EFUZRLsricuz8cvle8/gVmm9beG/mviQAAAABJRU5ErkJggg==",menuIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAACXBIWXMAABYlAAAWJQFJUiTwAAABXFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAOvYwAAACOjo6EhIQOvYx4eHicnJwOvYytra0OvYykpKSfn5/BwcEOvYy0tLSvr6+pqakOvYy1tbXExMQOvYy+vr66urrCwsIOvYzLy8vFxcXAwMC9vb3GxsYOvYzKysrHx8cOvYy9vb20tLTLy8sOvYzR0dHPz88OvYzU1NTS0tIOvYza2trX19fV1dUOvYze3t7c3Nz////9/f36+vr4+Pj0+P/19fXx8fHp8v/u7u7s7Ozq6+7d6//n5+fl5eXS5f/i4uLf4eXg4ODb29vH3v/Z2dnV19y82P/R0dG10/+x0f/KzNSgx/+bxP+rv9uVwf+Rv/+1uMKPvv+huNmIt/h/tP+gpLFsqf9rqf9lpf+Wmqhho/9fov9coP9an/9Znv9Ynf9VnP9Smv9Rmf9Nl/+BhpdJkPMOvYx2fI5rcoZhZ31XXnVRayw6AAAAOXRSTlMAAgUHCgwOEBMbHSAgMTBBQENFTlBSU1ZgZHBwcnOBgI6QkpOgoK2usLS3vMDJydDX1+Dk5OXw8vIZ3wVeAAACCklEQVR42tXU7XPSMBzA8SAoDjYEFcUxrIN1PoHMbaJpC7UFbOfDUKdOUFHLfM6MmP//zoQuCWm90ze+8PsCcsnnfnc0APhvWlipKa0s0M06xljPKa6wbRtwLsPeLgCgNzGtBGSZLc4k3crQgyyjWQkrNj/vtfnKrgBaehNjXcKaGPjtrRhZY67MRmp5ASGtvT8ajdAX+rI/G8tgGYcpcIBEAw5zoasrEHpP0QfP+4gGHuQQlJhrpiUM+4o8D32GUEAmpZPwGTr4hJ5IyMprwkkIJwi9gwLy4rB3gNCkZzh9n3btfFhxMRGBvTeUTdD3F77Tmcvx144r8CFC6Dlsv35lw0j25eQRrJps4PuXd+nbPRfGcs/xL08fih6YcWhWj+CxdQfyHvFF9/CwG3sCydU77myS4z7mh0NChhKKTjYMutG/eOYqP/xByPQ38IILoelXEuKZ7pDplOzEYdUy3capBBBwTIZjMo7DxetrxdT8LU1JEJCff77OPTJrLwbT2lkFBmS8uxuQIArTTYxL85CQLvtAREDpqJQ/NDVDwDqelaPLZTsO7WUOcZhGl6kNK+qsjRSHeY2yzTJgZRpuJ8xiyui4jQyQ6Ri30uEyVbgUdpNJ89ZpOk+WbWHczAKlzA2HSn8JKJVamNIryl5y1e9AK3otWZ3SOlBKLK3fvl8Ef1XqROJf/Xv/Ao6e1+rnxxl1AAAAAElFTkSuQmCC",blocks:[{opcode:"getTranslate",text:l({id:"translate.translateBlock",default:"translate [WORDS] to [LANGUAGE]",description:"translate some text to a different language"}),blockType:i.REPORTER,arguments:{WORDS:{type:r.STRING,defaultValue:l({id:"translate.defaultTextToTranslate",default:"hello",description:"hello: the default text to translate"})},LANGUAGE:{type:r.STRING,menu:"languages",defaultValue:this._randomLanguageCode}}},{opcode:"getViewerLanguage",text:l({id:"translate.viewerLanguage",default:"language",description:"the languge of the project viewer"}),blockType:i.REPORTER,arguments:{}}],menus:{languages:{acceptReporters:!0,items:this._supportedLanguages}}}}_getSupportedLanguages(e){return c.menuMap[e].map((e=>({text:e.name,value:e.code})))}getViewerLanguage(){this._viewerLanguageCode=this.getViewerLanguageCode();const e=c.menuMap[this._viewerLanguageCode];let t=e.find((e=>e.code===this._viewerLanguageCode));if(!t&&c.scratchToGoogleMap[this._viewerLanguageCode]){const n=c.scratchToGoogleMap[this._viewerLanguageCode];t=e.find((e=>e.code===n))}let n=this._viewerLanguageCode;return t&&(n=t.name),n}getViewerLanguageCode(){const e=[l.setup().locale].concat(navigator.languages),t=Object.keys(c.menuMap);return(e.reduce(((e,n)=>e||(t.indexOf(n.toLowerCase())>-1?n:e)),"")||"en").toLowerCase()}getLanguageCodeFromArg(e){const t=s.toString(e).toLowerCase();return Object.prototype.hasOwnProperty.call(c.menuMap,t)?t:Object.prototype.hasOwnProperty.call(c.nameMap,t)?c.nameMap[t]:-1!==c.previouslySupported.indexOf(t)?t:"en"}getTranslate(e){if(/^\d+$/.test(e.WORDS))return Promise.resolve(e.WORDS);if(this._lastTextTranslated===e.WORDS&&this._lastLangTranslated===e.LANGUAGE)return this._translateResult;const t=this.getLanguageCodeFromArg(e.LANGUAGE);let n="".concat("https://trampoline.turbowarp.org/translate/","translate?language=");n+=t,n+="&text=",n+=encodeURIComponent(e.WORDS);const r=this;return a(n,{},1e4).then((e=>e.text())).then((t=>{const n=JSON.parse(t).result;return r._translateResult=n,r._lastTextTranslated=e.WORDS,r._lastLangTranslated=e.LANGUAGE,n})).catch((t=>(o.warn("error fetching translate result! ".concat(t)),e.WORDS)))}}},function(e,t,n){const r=n(42),i=n(3),s=n(2),o=n(12),a=n(1),c=n(5),l=n(70),u=n(216),h={MOTION:"motion",DIRECTION:"direction"},d={STAGE:"Stage",SPRITE:"this sprite"},p={OFF:"off",ON:"on",ON_FLIPPED:"on-flipped"};class f{constructor(e){this.runtime=e,this.detect=new u,this._lastUpdate=null,this.firstInstall=!0,this.runtime.ioDevices&&(this.runtime.on(r.PROJECT_LOADED,this.updateVideoDisplay.bind(this)),this.runtime.on(r.PROJECT_RUN_START,this.reset.bind(this)),this._loop())}static get INTERVAL(){return 33}static get DIMENSIONS(){return[480,360]}static get STATE_KEY(){return"Scratch.videoSensing"}static get DEFAULT_MOTION_STATE(){return{motionFrameNumber:0,motionAmount:0,motionDirection:0}}get globalVideoTransparency(){const e=this.runtime.getTargetForStage();return e?e.videoTransparency:50}set globalVideoTransparency(e){const t=this.runtime.getTargetForStage();t&&(t.videoTransparency=e)}get globalVideoState(){const e=this.runtime.getTargetForStage();return e?e.videoState:p.OFF}set globalVideoState(e){const t=this.runtime.getTargetForStage();t&&(t.videoState=e)}updateVideoDisplay(){this.setVideoTransparency({TRANSPARENCY:this.globalVideoTransparency}),this.videoToggle({VIDEO_STATE:this.globalVideoState})}reset(){this.detect.reset();const e=this.runtime.targets;for(let t=0;t<e.length;t++){const n=e[t].getCustomState(f.STATE_KEY);n&&(n.motionAmount=0,n.motionDirection=0)}}_loop(){const e=Math.max(this.runtime.currentStepTime,f.INTERVAL);this._loopInterval=setTimeout(this._loop.bind(this),e);const t=Date.now();null===this._lastUpdate&&(this._lastUpdate=t);if(t-this._lastUpdate>f.INTERVAL){const e=this.runtime.ioDevices.video.getFrame({format:l.FORMAT_IMAGE_DATA,dimensions:f.DIMENSIONS});e&&(this._lastUpdate=t,this.detect.addFrame(e.data))}}_stopLoop(){clearTimeout(this._loopInterval)}_buildMenu(e){return e.map(((e,t)=>{const n={};return n.text=e.name,n.value=e.value||String(t+1),n}))}_getMotionState(e){let t=e.getCustomState(f.STATE_KEY);return t||(t=o.simple(f.DEFAULT_MOTION_STATE),e.setCustomState(f.STATE_KEY,t)),t}static get SensingAttribute(){return h}get ATTRIBUTE_INFO(){return[{name:c({id:"videoSensing.motion",default:"motion",description:'Attribute for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:h.MOTION},{name:c({id:"videoSensing.direction",default:"direction",description:'Attribute for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:h.DIRECTION}]}static get SensingSubject(){return d}get SUBJECT_INFO(){return[{name:c({id:"videoSensing.sprite",default:"sprite",description:'Subject for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:d.SPRITE},{name:c({id:"videoSensing.stage",default:"stage",description:'Subject for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:d.STAGE}]}static get VideoState(){return p}get VIDEO_STATE_INFO(){return[{name:c({id:"videoSensing.off",default:"off",description:'Option for the "turn video [STATE]" block'}),value:p.OFF},{name:c({id:"videoSensing.on",default:"on",description:'Option for the "turn video [STATE]" block'}),value:p.ON},{name:c({id:"videoSensing.onFlipped",default:"on flipped",description:'Option for the "turn video [STATE]" block that causes the video to be flipped horizontally (reversed as in a mirror)'}),value:p.ON_FLIPPED}]}getInfo(){return this.firstInstall&&(this.globalVideoState=p.ON,this.globalVideoTransparency=50,this.updateVideoDisplay(),this.firstInstall=!1),{id:"videoSensing",name:c({id:"videoSensing.categoryName",default:"Video Sensing",description:"Label for the video sensing extension category"}),blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48dGl0bGU+RXh0ZW5zaW9ucy9Tb2Z0d2FyZS9WaWRlby1TZW5zaW5nLUJsb2NrPC90aXRsZT48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9Im5vbnplcm8iIHN0cm9rZT0iIzAwMCIgc3Ryb2tlLW9wYWNpdHk9Ii4xNSIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAxMCkiPjxjaXJjbGUgY3g9IjMyIiBjeT0iMTYiIHI9IjQuNSIgZmlsbD0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBvcGFjaXR5PSIuMjUiLz48Y2lyY2xlIGN4PSIzMiIgY3k9IjEyIiByPSI0LjUiIGZpbGw9IiNmZmYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgb3BhY2l0eT0iLjUiLz48Y2lyY2xlIGN4PSIzMiIgY3k9IjgiIHI9IjQuNSIgZmlsbD0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBvcGFjaXR5PSIuNzUiLz48Y2lyY2xlIGN4PSIzMiIgY3k9IjQiIHI9IjQuNSIgZmlsbD0iI2ZmZiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIi8+PHBhdGggZmlsbD0iIzRkNGQ0ZCIgZD0ibTIyLjY3MiA0LjQyLTYuMTcyIDRWNi4xYzAtMi4wMS0xLjU2My0zLjYtMy41LTMuNkg0LjFDMi4wNzYgMi41LjUgNC4wNzYuNSA2LjFWMTRjMCAxLjkyNyAxLjU4NCAzLjUxMiAzLjYgMy42SDEzYzEuOTAyIDAgMy41LTEuNjUzIDMuNS0zLjZ2LTIuMjgzbDYuMjU3IDMuNzU0LjA5Ny4wNzVjLjAyLjAyLjA5OC4wNTQuMTQ2LjA1NC4yNjcgMCAuNS0uMjE3LjUtLjVWNC44YzAgLjAzNy0uMDU2LS4wOTQtLjEyOS0uMjQzLS4xNDUtLjI0Mi0uNDMtLjI5OS0uNy0uMTM3WiIvPjwvZz48L3N2Zz4=",menuIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMCIgaGVpZ2h0PSIyMCIgdmlld0JveD0iMCAwIDIwIDIwIj48dGl0bGU+RXh0ZW5zaW9ucy9Tb2Z0d2FyZS9WaWRlby1TZW5zaW5nLU1lbnU8L3RpdGxlPjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0ibm9uemVybyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCA1KSI+PGNpcmNsZSBjeD0iMTYiIGN5PSI4IiByPSIyIiBmaWxsPSIjMGViZDhjIiBvcGFjaXR5PSIuMjUiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjYiIHI9IjIiIGZpbGw9IiMwZWJkOGMiIG9wYWNpdHk9Ii41Ii8+PGNpcmNsZSBjeD0iMTYiIGN5PSI0IiByPSIyIiBmaWxsPSIjMGViZDhjIiBvcGFjaXR5PSIuNzUiLz48Y2lyY2xlIGN4PSIxNiIgY3k9IjIiIHI9IjIiIGZpbGw9IiMwZWJkOGMiLz48cGF0aCBmaWxsPSIjNGQ0ZDRkIiBzdHJva2U9IiMwMDAiIHN0cm9rZS1vcGFjaXR5PSIuMTUiIHN0cm9rZS13aWR0aD0iLjUiIGQ9Im0xMS4zMzYgMi4yMS0zLjA4NiAyVjMuMDVjMC0xLjAwNS0uNzgxLTEuOC0xLjc1LTEuOEgyLjA1Yy0xLjAxMiAwLTEuOC43ODgtMS44IDEuOFY3YzAgLjk2NC43OTIgMS43NTYgMS44IDEuOEg2LjVjLjk1IDAgMS43NS0uODI3IDEuNzUtMS44VjUuODU4bC4zNzkuMjI4IDIuNzk4IDEuNjg3Yy4wMS4wMS4wNDkuMDI3LjA3My4wMjdhLjI1LjI1IDAgMCAwIC4yNS0uMjVWMi40YzAgLjAxOC0uMDI4LS4wNDctLjA2NC0uMTIxLS4wNzMtLjEyMS0uMjE1LS4xNS0uMzUtLjA3WiIvPjwvZz48L3N2Zz4=",blocks:[{opcode:"whenMotionGreaterThan",text:c({id:"videoSensing.whenMotionGreaterThan",default:"when video motion > [REFERENCE]",description:"Event that triggers when the amount of motion is greater than [REFERENCE]"}),blockType:s.HAT,arguments:{REFERENCE:{type:i.NUMBER,defaultValue:10}}},{opcode:"videoOn",blockType:s.REPORTER,text:c({id:"videoSensing.videoOn",default:"video [ATTRIBUTE] on [SUBJECT]",description:"Reporter that returns the amount of [ATTRIBUTE] for the selected [SUBJECT]"}),arguments:{ATTRIBUTE:{type:i.NUMBER,menu:"ATTRIBUTE",defaultValue:h.MOTION},SUBJECT:{type:i.NUMBER,menu:"SUBJECT",defaultValue:d.SPRITE}}},{opcode:"videoToggle",text:c({id:"videoSensing.videoToggle",default:"turn video [VIDEO_STATE]",description:"Controls display of the video preview layer"}),arguments:{VIDEO_STATE:{type:i.NUMBER,menu:"VIDEO_STATE",defaultValue:p.ON}}},{opcode:"setVideoTransparency",text:c({id:"videoSensing.setVideoTransparency",default:"set video transparency to [TRANSPARENCY]",description:"Controls transparency of the video preview layer"}),arguments:{TRANSPARENCY:{type:i.NUMBER,defaultValue:50}}}],menus:{ATTRIBUTE:{acceptReporters:!0,items:this._buildMenu(this.ATTRIBUTE_INFO)},SUBJECT:{acceptReporters:!0,items:this._buildMenu(this.SUBJECT_INFO)},VIDEO_STATE:{acceptReporters:!0,items:this._buildMenu(this.VIDEO_STATE_INFO)}}}}_analyzeLocalMotion(e){const t=this.runtime.renderer._allDrawables[e.drawableID],n=this._getMotionState(e);return this.detect.getLocalMotion(t,n),n}videoOn(e,t){if(this.runtime.privacyRestrictionsActive)return-1;this.detect.analyzeFrame();let n=this.detect;return e.SUBJECT===d.SPRITE&&(n=this._analyzeLocalMotion(t.target)),e.ATTRIBUTE===h.MOTION?n.motionAmount:n.motionDirection}whenMotionGreaterThan(e,t){if(this.runtime.privacyRestrictionsActive)return!1;this.detect.analyzeFrame();return this._analyzeLocalMotion(t.target).motionAmount>Number(e.REFERENCE)}videoToggle(e){const t=e.VIDEO_STATE;this.globalVideoState=t,t===p.OFF?this.runtime.ioDevices.video.disableVideo():(this.runtime.ioDevices.video.enableVideo(),this.runtime.ioDevices.video.mirror=t===p.ON)}setVideoTransparency(e){const t=a.toNumber(e.TRANSPARENCY);this.globalVideoTransparency=t,this.runtime.ioDevices.video.setPreviewGhost(t)}}e.exports=f},function(e,t,n){const r=n(63),i=n(64),s=n(7),o=function(e,t,n,i){e.attribs.id||(e.attribs.id=s());const a={id:e.attribs.id,opcode:e.attribs.type,inputs:{},fields:{},next:null,topLevel:n,parent:i,shadow:"shadow"===e.name,x:e.attribs.x,y:e.attribs.y};t[a.id]=a;for(let n=0;n<e.children.length;n++){const i=e.children[n];let s=null,c=null;for(let e=0;e<i.children.length;e++){const t=i.children[e];if(!t.name)continue;const n=t.name.toLowerCase();"block"===n?s=t:"shadow"===n&&(c=t)}switch(!s&&c&&(s=c),i.name.toLowerCase()){case"field":{const e=i.attribs.name,t=i.attribs.id;let n="";n=i.children.length>0&&i.children[0].data?i.children[0].data:"",a.fields[e]={name:e,id:t,value:n};const r=i.attribs.variabletype;"string"==typeof r&&(a.fields[e].variableType=r);break}case"comment":a.comment=i.attribs.id;break;case"value":case"statement":{o(s,t,!1,a.id),c&&s!==c&&o(c,t,!1,a.id);const e=i.attribs.name;a.inputs[e]={name:e,block:s.attribs.id,shadow:c?c.attribs.id:null};break}case"next":if(!s||!s.attribs)continue;o(s,t,!1,a.id),a.next=s.attribs.id;break;case"mutation":a.mutation=r(i)}}};e.exports=function(e){if("object"==typeof e&&"object"==typeof e.xml)return function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];if(!r.name||!r.attribs)continue;const i=r.name.toLowerCase();"block"!==i&&"shadow"!==i||o(r,t,!0,null)}const n=[];for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&n.push(t[e]);return n}(i.parseDOM(e.xml.outerHTML,{decodeEntities:!0}))}},function(e,t){var n={amp:"&",apos:"'",lt:"<",gt:">",quot:'"',nbsp:" "},r=/&([a-z]+);/gi;e.exports=function(e){return e.replace(r,(function(e,t){return t=t.toLowerCase(),n.hasOwnProperty(t)?n[t]:e}))}},function(e,t){let n=0;const r={},i="object"==typeof window&&window.performance;class s{constructor(e){this.id=-1,this.totalTime=0,this.selfTime=0,this.arg=null,this.depth=e,this.count=0}}class o{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this.records=[],this.increments=[],this.counters=[],this.nullFrame=new s(-1),this._stack=[new s(0)],this.onFrame=e,this.START=0,this.STOP=1}start(e,t){this.records.push(0,e,t,i.now())}stop(){this.records.push(1,i.now())}increment(e){this.increments[e]||(this.increments[e]=new s(-1),this.increments[e].id=e),this.increments[e].count+=1}frame(e,t){for(let n=0;n<this.counters.length;n++)if(this.counters[n].id===e&&this.counters[n].arg===t)return this.counters[n];const n=new s(-1);return n.id=e,n.arg=t,this.counters.push(n),n}reportFrames(){const e=this._stack;let t=1;for(let n=0;n<this.records.length;)if(0===this.records[n]){t>=e.length&&e.push(new s(t));const r=e[t++];r.id=this.records[n+1],r.arg=this.records[n+2],r.totalTime=this.records[n+3],r.selfTime=0,n+=4}else{if(1!==this.records[n])throw this.records.length=0,new Error("Unable to decode Profiler records.");{const r=this.records[n+1],i=e[--t];i.totalTime=r-i.totalTime,i.selfTime+=i.totalTime,e[t-1].selfTime-=i.totalTime,i.count=1,this.onFrame(i),n+=2}}for(let e=0;e<this.increments.length;e++)this.increments[e]&&this.increments[e].count>0&&(this.onFrame(this.increments[e]),this.increments[e].count=0);for(let e=0;e<this.counters.length;e++)this.counters[e].count>0&&(this.onFrame(this.counters[e]),this.counters[e].count=0);this.records.length=0}idByName(e){return o.idByName(e)}nameById(e){return o.nameById(e)}static idByName(e){return"number"!=typeof r[e]&&(r[e]=n++),r[e]}static nameById(e){for(const t in r)if(r[t]===e)return t;return null}static available(){return"object"==typeof window&&void 0!==window.performance}}o.START=0,o.STOP=1,e.exports=o},function(e,t,n){const r=n(14),i=n(20),s=n(32),o=n(46);let a=-1,c=-1,l=-1;class u{constructor(e){this.timer=new r,this.runtime=e,this.activeThread=null}static get WARP_TIME(){return 500}stepThreads(){const e=.75*this.runtime.currentStepTime;this.runtime.updateCurrentMSecs(),this.timer.start();let t=1/0,n=!1;const r=[];for(;this.runtime.threads.length>0&&t>0&&this.timer.timeElapsed()<e&&(this.runtime.turboMode||!this.runtime.redrawRequested);){null!==this.runtime.profiler&&(-1===c&&(c=this.runtime.profiler.idByName("Sequencer.stepThreads#inner")),this.runtime.profiler.start(c)),t=0;let e=!1;const s=this.runtime.threads;for(let r=0;r<s.length;r++){const o=this.activeThread=s[r];0!==o.stack.length&&o.status!==i.STATUS_DONE?(o.status!==i.STATUS_YIELD_TICK||n||(o.status=i.STATUS_RUNNING),o.status!==i.STATUS_RUNNING&&o.status!==i.STATUS_YIELD||(null!==this.runtime.profiler&&(-1===a&&(a=this.runtime.profiler.idByName("Sequencer.stepThread")),this.runtime.profiler.increment(a)),this.stepThread(o),o.warpTimer=null),o.status===i.STATUS_RUNNING&&t++,0!==o.stack.length&&o.status!==i.STATUS_DONE||(e=!0)):e=!0}if(n=!0,null!==this.runtime.profiler&&this.runtime.profiler.stop(),e){let e=0;for(let t=0;t<this.runtime.threads.length;t++){const n=this.runtime.threads[t];0!==n.stack.length&&n.status!==i.STATUS_DONE?(this.runtime.threads[e]=n,e++):(this.runtime.threadMap.delete(n.getId()),r.push(n))}this.runtime.threads.length=e}}return this.activeThread=null,r}stepThread(e){if(e.isCompiled)return void o(e);let t=e.peekStack();if(t||(e.popStack(),0!==e.stack.length))for(;t=e.peekStack();){const n=e.stack.length;let o=e.peekStackFrame().warpMode;if(o&&!e.warpTimer&&(e.warpTimer=new r,e.warpTimer.start()),null!==this.runtime.profiler&&(-1===l&&(l=this.runtime.profiler.idByName("execute")),this.runtime.profiler.increment(l)),null===e.target?this.retireThread(e):s(this,e),e.blockGlowInFrame=t,e.status===i.STATUS_YIELD){if(e.status=i.STATUS_RUNNING,o&&e.warpTimer.timeElapsed()<=u.WARP_TIME)continue;return}if(e.status===i.STATUS_PROMISE_WAIT)return;if(e.status===i.STATUS_YIELD_TICK)return;if(e.status===i.STATUS_DONE)return;for(e.stack.length!==n||e.peekStack()!==t||e.peekStackFrame().waitingReporter||e.goToNextBlock();!e.peekStack();){if(e.popStack(),0===e.stack.length)return void(e.status=i.STATUS_DONE);const t=e.peekStackFrame();if(o=t.warpMode,t.isLoop){if(!o||e.warpTimer.timeElapsed()>u.WARP_TIME)return}else t.waitingReporter||e.goToNextBlock()}}else e.status=i.STATUS_DONE}stepToBranch(e,t,n){t||(t=1);const r=e.peekStack(),i=e.target.blocks.getBranch(r,t);e.peekStackFrame().isLoop=n,i?e.pushStack(i):e.pushStack(null)}stepToProcedure(e,t){const n=e.target.blocks.getProcedureDefinition(t);if(!n)return;const r=e.isRecursiveCall(t);if(e.pushStack(n),e.peekStackFrame().warpMode&&e.warpTimer.timeElapsed()>u.WARP_TIME)e.status=i.STATUS_YIELD;else{const t=e.target.blocks.getBlock(n),s=e.target.blocks.getBlock(t.inputs.custom_block.block);let o=!1;if(s&&s.mutation){const e=s.mutation.warp;"boolean"==typeof e?o=e:"string"==typeof e&&(o=JSON.parse(e))}o?e.peekStackFrame().warpMode=!0:r&&(e.status=i.STATUS_YIELD)}}retireThread(e){e.stack=[],e.stackFrame=[],e.requestScriptGlowInFrame=!1,e.status=i.STATUS_DONE,e.isCompiled&&(e.procedures=null,e.generator=null)}}e.exports=u},function(e,t,n){const{IRGenerator:r}=n(44),{IROptimizer:i}=n(189),s=n(67);e.exports=e=>{const t=new r(e).generate();new i(t).optimize();const n={},o=e.target,a=e=>{if(e.cachedCompileResult)return e.cachedCompileResult;const n=new s(e,t,o).compile();return e.cachedCompileResult=n,n},c=a(t.entry);for(const e of Object.keys(t.procedures)){const r=a(t.procedures[e]);n[e]=r}return{startingFunction:c,procedures:n,executableHat:t.entry.executableHat}}},function(e,t){e.exports={stacked:["looks_changestretchby","looks_hideallsprites","looks_sayforsecs","looks_setstretchto","looks_switchbackdroptoandwait","looks_thinkforsecs","motion_align_scene","motion_glidesecstoxy","motion_glideto","motion_goto","motion_pointtowards","motion_scroll_right","motion_scroll_up","sensing_askandwait","sensing_setdragmode","sound_changeeffectby","sound_changevolumeby","sound_cleareffects","sound_play","sound_playuntildone","sound_seteffectto","sound_setvolumeto","sound_stopallsounds"],inputs:["motion_xscroll","motion_yscroll","sensing_loud","sensing_loudness","sensing_online","sensing_userid","sound_volume"]}},function(e,t,n){const{StackOpcode:r,InputOpcode:i,InputType:s}=n(15),o=n(0),{IntermediateStack:a,IntermediateInput:c,IntermediateScript:l,IntermediateRepresentation:u,IntermediateStackBlock:h}=n(10);class d{constructor(){this.variables=Object.create(null)}clear(){let e=!1;for(const t in this.variables)if(this.variables[t]!==s.ANY){e=!0;break}return this.variables=Object.create(null),e}clone(){const e=new d;for(const t in this.variables)e.variables[t]=this.variables[t];return e}mutate(e,t){let n=!1;for(const r in e.variables){const e=t(r);e!==this.variables[r]&&(this.variables[r]=e,n=n||!0)}for(const r in this.variables)if(!e.variables[r]){const e=t(r);e!==this.variables[r]&&(this.variables[r]=e,n=n||!0)}return n}or(e){return this.mutate(e,(t=>{var n,r;return(null!==(n=this.variables[t])&&void 0!==n?n:s.ANY)|(null!==(r=e.variables[t])&&void 0!==r?r:s.ANY)}))}after(e){return this.mutate(e,(t=>{var n;const r=e.variables[t];return r||(null!==(n=this.variables[t])&&void 0!==n?n:s.ANY)}))}overwrite(e){return this.mutate(e,(t=>{var n;return null!==(n=e.variables[t])&&void 0!==n?n:s.ANY}))}setVariableType(e,t){return this.variables[e.id]!==t&&(this.variables[e.id]=t,!0)}getVariableType(e){var t;return null!==(t=this.variables[e.id])&&void 0!==t?t:s.ANY}}e.exports={IROptimizer:class{constructor(e){this.ir=e,this.ignoreYields=!1,this.exitState=null}getInputType(e,t){const n=e.inputs;switch(e.opcode){case i.VAR_GET:return t.getVariableType(n.variable);case i.ADDON_CALL:break;case i.CAST_BOOLEAN:{const e=n.target.type;return e&s.BOOLEAN?e:s.BOOLEAN}case i.CAST_NUMBER:{const e=n.target.type;return e&s.NUMBER?e:s.NUMBER}case i.CAST_NUMBER_INDEX:{const e=n.target.type;return e&s.NUMBER_INDEX?e:s.NUMBER_INDEX}case i.CAST_NUMBER_OR_NAN:{const e=n.target.type;return e&s.NUMBER_OR_NAN?e:s.NUMBER_OR_NAN}case i.CAST_STRING:{const e=n.target.type;return e&s.STRING?e:s.STRING}case i.OP_ADD:{const e=n.left.type,t=n.right.type;let r=0;(function(){return!!(e&s.NUMBER_POS_INF&&t&s.NUMBER_NEG_INF)||(!!(e&s.NUMBER_NEG_INF&&t&s.NUMBER_POS_INF)||void 0)})()&&(r|=s.NUMBER_NAN);const i=function(){return!!(e&s.NUMBER_FRACT)||(!!(t&s.NUMBER_FRACT)||void 0)}();(function(){return!!(e&s.NUMBER_POS)||(!!(t&s.NUMBER_POS)||void 0)})()&&(r|=s.NUMBER_POS_INT|s.NUMBER_POS_INF,i&&(r|=s.NUMBER_POS_FRACT));(function(){return!!(e&s.NUMBER_NEG)||(!!(t&s.NUMBER_NEG)||void 0)})()&&(r|=s.NUMBER_NEG_INT|s.NUMBER_NEG_INF,i&&(r|=s.NUMBER_NEG_FRACT));(function(){return!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_NEG_REAL)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_ZERO&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_ZERO&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_ZERO)||void 0))))})()&&(r|=s.NUMBER_ZERO);return function(){if(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_NEG_ZERO)return!0}()&&(r|=s.NUMBER_NEG_ZERO),r}case i.OP_SUBTRACT:{const e=n.left.type,t=n.right.type;let r=0;(function(){return!!(e&s.NUMBER_POS_INF&&t&s.NUMBER_POS_INF)||(!!(e&s.NUMBER_NEG_INF&&t&s.NUMBER_NEG_INF)||void 0)})()&&(r|=s.NUMBER_NAN);const i=function(){return!!(e&s.NUMBER_FRACT)||(!!(t&s.NUMBER_FRACT)||void 0)}();(function(){return!!(e&s.NUMBER_POS)||(!!(t&s.NUMBER_NEG)||void 0)})()&&(r|=s.NUMBER_POS_INT|s.NUMBER_POS_INF,i&&(r|=s.NUMBER_POS_FRACT));(function(){return!!(e&s.NUMBER_NEG)||(!!(t&s.NUMBER_POS)||void 0)})()&&(r|=s.NUMBER_NEG_INT|s.NUMBER_NEG_INF,i&&(r|=s.NUMBER_NEG_FRACT));(function(){return!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_NEG_REAL)||(!!(e&s.NUMBER_ZERO&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_ZERO&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_NEG_ZERO)||void 0))))})()&&(r|=s.NUMBER_ZERO);return function(){if(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_ZERO)return!0}()&&(r|=s.NUMBER_NEG_ZERO),r}case i.OP_MULTIPLY:{const e=n.left.type,t=n.right.type;let r=0;(function(){return!!(e&s.NUMBER_INF&&t&s.NUMBER_ANY_ZERO)||(!!(e&s.NUMBER_ANY_ZERO&&t&s.NUMBER_INF)||void 0)})()&&(r|=s.NUMBER_NAN);const i=function(){return!!(e&s.NUMBER_FRACT)||(!!(t&s.NUMBER_FRACT)||void 0)}();(function(){return!!(e&s.NUMBER_POS&&t&s.NUMBER_POS)||(!!(e&s.NUMBER_NEG&&t&s.NUMBER_NEG)||void 0)})()&&(r|=s.NUMBER_POS_INT|s.NUMBER_POS_INF,i&&(r|=s.NUMBER_POS_FRACT));(function(){return!!(e&s.NUMBER_POS&&t&s.NUMBER_NEG)||(!!(e&s.NUMBER_NEG&&t&s.NUMBER_POS)||void 0)})()&&(r|=s.NUMBER_NEG_INT|s.NUMBER_NEG_INF,i&&(r|=s.NUMBER_NEG_FRACT));(function(){return!!(e&s.NUMBER_ZERO&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_ZERO&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_NEG_REAL)||(!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_FRACT&&t&s.NUMBER_FRACT)||void 0))))))})()&&(r|=s.NUMBER_ZERO);return function(){return!!(e&s.NUMBER_ZERO&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_ZERO&&t&s.NUMBER_NEG_REAL)||(!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_NEG_REAL)||void 0)))))))}()&&(r|=s.NUMBER_NEG_ZERO),r}case i.OP_DIVIDE:{const e=n.left.type,t=n.right.type;let r=0;(function(){return!!(e&s.NUMBER_ANY_ZERO&&t&s.NUMBER_ANY_ZERO)||(!!(e&s.NUMBER_INF&&t&s.NUMBER_INF)||(!!(e&s.NUMBER_ANY_ZERO&&t&s.NUMBER_NAN)||void 0))})()&&(r|=s.NUMBER_NAN);(function(){return!!(e&s.NUMBER_POS&&t&s.NUMBER_POS)||(!!(e&s.NUMBER_NEG&&t&s.NUMBER_NEG)||void 0)})()&&(r|=s.NUMBER_POS);(function(){return!!(e&s.NUMBER_NEG&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_POS&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_NEG_REAL)||void 0)))})()&&(r|=s.NUMBER_NEG_INF);(function(){return!!(e&s.NUMBER_POS&&t&s.NUMBER_ZERO)||(!!(e&s.NUMBER_NEG&&t&s.NUMBER_NEG_ZERO)||(!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_NEG_REAL)||void 0)))})()&&(r|=s.NUMBER_POS_INF);(function(){return!!(e&s.NUMBER_POS&&t&s.NUMBER_NEG)||(!!(e&s.NUMBER_NEG&&t&s.NUMBER_POS)||void 0)})()&&(r|=s.NUMBER_NEG);(function(){return!!(e&s.NUMBER_ZERO&&t&s.NUMBER_POS)||(!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_NEG)||(!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_NEG_REAL)||(!!(e&s.NUMBER_POS&&t&s.NUMBER_POS_INF)||(!!(e&s.NUMBER_NEG&&t&s.NUMBER_NEG_INF)||void 0)))))})()&&(r|=s.NUMBER_ZERO);return function(){return!!(e&s.NUMBER_NEG_ZERO&&t&s.NUMBER_POS)||(!!(e&s.NUMBER_ZERO&&t&s.NUMBER_NEG)||(!!(e&s.NUMBER_NEG_REAL&&t&s.NUMBER_POS_REAL)||(!!(e&s.NUMBER_POS_REAL&&t&s.NUMBER_NEG_REAL)||(!!(e&s.NUMBER_POS&&t&s.NUMBER_NEG_INF)||(!!(e&s.NUMBER_NEG&&t&s.NUMBER_POS_INF)||void 0)))))}()&&(r|=s.NUMBER_NEG_ZERO),r}}return e.type}analyzeInputBlock(e,t){const n=e.inputs;let r=this.analyzeInputs(n,t);const s=this.getInputType(e,t);switch(r=r||s!==e.type,e.type=s,e.opcode){case i.ADDON_CALL:r=t.clear()||r;break;case i.PROCEDURE_CALL:{r=this.analyzeInputs(n.inputs,t)||r;const e=this.ir.procedures[n.variant];r=e&&e.cachedAnalysisEndState?e.yields?t.overwrite(e.cachedAnalysisEndState)||r:t.after(e.cachedAnalysisEndState)||r:t.clear()||r;break}}return r}analyzeInputs(e,t){let n=!1;for(const r in e){const i=e[r];i instanceof c&&(n=this.analyzeInputBlock(i,t)||n)}return n}addPossibleExitState(e){null!==this.exitState?this.exitState.or(e):this.exitState=e.clone()}analyzeStackBlock(e,t){const n=e.inputs;let i=!1;switch(e.ignoreState&&(t=t.clone()),e.opcode){case r.VAR_SET:i=this.analyzeInputs(n,t)||i,i=t.setVariableType(n.variable,n.value.type)||i;break;case r.CONTROL_WHILE:case r.CONTROL_FOR:i=this.analyzeInputs(n,t)||i,i=this.analyzeLoopedStack(n.do,t,e,!0)||i;break;case r.CONTROL_REPEAT:i=this.analyzeInputs(n,t)||i,i=this.analyzeLoopedStack(n.do,t,e,!1)||i;break;case r.CONTROL_IF_ELSE:{i=this.analyzeInputs(n,t)||i;const e=t.clone();i=this.analyzeStack(n.whenTrue,e)||i,i=this.analyzeStack(n.whenFalse,t)||i,i=t.or(e)||i;break}case r.CONTROL_STOP_SCRIPT:i=this.analyzeInputs(n,t)||i,this.addPossibleExitState(t);break;case r.CONTROL_WAIT_UNTIL:i=t.clear()||i,i=this.analyzeInputs(n,t)||i;break;case r.PROCEDURE_CALL:{i=this.analyzeInputs(n,t)||i,i=this.analyzeInputs(n.inputs,t)||i;const e=this.ir.procedures[n.variant];i=e&&e.cachedAnalysisEndState?e.yields?t.overwrite(e.cachedAnalysisEndState)||i:t.after(e.cachedAnalysisEndState)||i:t.clear()||i;break}case r.COMPATIBILITY_LAYER:i=this.analyzeInputs(n,t)||i,this.analyzeInputs(n.inputs,t);for(const e in n.substacks){const r=t.clone();i=this.analyzeStack(n.substacks[e],r)||i,i=t.or(r)||i}break;default:i=this.analyzeInputs(n,t)||i}return i}analyzeStack(e,t){if(!e)return!1;let n=!1;for(const r of e.blocks){let e=this.analyzeStackBlock(r,t);r.ignoreState||(r.yields&&!this.ignoreYields&&(e=t.clear()||e),e&&(r.exitState?r.exitState.or(t):r.exitState=t.clone(),n=!0))}return n}analyzeLoopedStack(e,t,n,r){let i=!1;if(n.yields&&!this.ignoreYields)return i=t.clear(),r&&(i=this.analyzeInputs(n.inputs,t)||i),n.entryState=t.clone(),n.exitState=t.clone(),this.analyzeStack(e,t)||i;let s,a=0;do{if(a>1e4)return o.error("analyzeLoopedStack stuck in likely infinite loop; quitting",n,t),i=t.clear(),n.entryState=t.clone(),n.exitState=t.clone(),i=this.analyzeInputs(n.inputs,t)||i,this.analyzeStack(e,t)||i;a++;const c=t.clone();i=this.analyzeStack(e,c)||i,i=(s=t.or(c))||i,r&&(i=this.analyzeInputs(n.inputs,t)||i)}while(s);return n.entryState=t.clone(),i}optimizeInput(e,t){for(const n in e.inputs){const r=e.inputs[n];r instanceof c&&(e.inputs[n]=this.optimizeInput(r,t))}switch(e.opcode){case i.CAST_BOOLEAN:{const t=e.inputs.target.type;return(t&s.BOOLEAN)===t?e.inputs.target:e}case i.CAST_NUMBER:{const t=e.inputs.target.type;return(t&s.NUMBER)===t?e.inputs.target:e}case i.CAST_NUMBER_INDEX:{const t=e.inputs.target.type;return(t&s.NUMBER_INDEX)===t?e.inputs.target:e}case i.CAST_NUMBER_OR_NAN:{const t=e.inputs.target.type;return(t&s.NUMBER_OR_NAN)===t?e.inputs.target:e}case i.CAST_STRING:{const t=e.inputs.target.type;return(t&s.STRING)===t?e.inputs.target:e}}return e}optimizeStack(e,t){if(e)for(const n of e.blocks){n.entryState&&(t=n.entryState);for(const e in n.inputs){const r=n.inputs[e];r instanceof c?n.inputs[e]=this.optimizeInput(r,t):r instanceof a&&this.optimizeStack(r,t)}n.exitState&&(t=n.exitState)}}optimizeScript(e,t){if(e.isProcedure){if(t.has(e.procedureCode))return;t.add(e.procedureCode)}for(const n of e.dependedProcedures)this.optimizeScript(this.ir.procedures[n],t);this.exitState=null;const n=new d;this.analyzeStack(e.stack,n),this.addPossibleExitState(n),e.cachedAnalysisEndState=this.exitState,this.optimizeStack(e.stack,new d)}optimize(){this.optimizeScript(this.ir.entry,new Set)}},TypeState:d}},function(e,t){e.exports=class{constructor(e){if(0===e.trim().length)throw new Error("prefix cannot be empty");this.prefix=e,this.count=0}next(){return"".concat(this.prefix).concat(this.count++)}}},function(e,t,n){const r=n(68);e.exports=new class extends r{constructor(){super(),this._stackFrame={},this._startedBranch=null}get stackFrame(){var e;return null===(e=this.thread)||void 0===e?void 0:e.compatibilityStackFrame}startBranch(e,t){this._startedBranch=[e,t]}startProcedure(){throw new Error("startProcedure is not supported by this BlockUtility")}initParams(){throw new Error("initParams is not supported by this BlockUtility")}pushParam(){throw new Error("pushParam is not supported by this BlockUtility")}getParam(){throw new Error("getParam is not supported by this BlockUtility")}init(e,t,n){this.thread=e,this.sequencer=e.target.runtime.sequencer,this._startedBranch=null,e.stack[0]=t,e.compatibilityStackFrame=n}}},function(e,t){e.exports={supportsNullishCoalescing:(()=>{try{new Function("undefined ?? 3");return!0}catch(e){return!1}})()}},function(e,t){e.exports=class{constructor(e){this._type=e,this._onOpen=null,this._onClose=null,this._onError=null,this._handleMessage=null,this._ws=null}open(){if(!(this._onOpen&&this._onClose&&this._onError&&this._handleMessage))throw new Error("Must set open, close, message and error handlers before calling open on the socket");let e;switch(this._type){case"BLE":e="scratch/ble";break;case"BT":e="scratch/bt";break;default:throw new Error("Unknown ScratchLink socket Type: ".concat(this._type))}const t=(e,t)=>{t.onopen=t.onerror=null,t.close(),this._ws=e,this._ws.onopen=this._onOpen,this._ws.onclose=this._onClose,this._ws.onerror=this._onError,this._ws.onmessage=this._onMessage.bind(this)},n=new WebSocket("ws://127.0.0.1:20111/".concat(e)),r=new WebSocket("wss://device-manager.scratch.mit.edu:20110/".concat(e)),i=setTimeout((()=>{t(n,r),this._ws.onerror(new Event("timeout"))}),15e3);let s,o;n.onopen=e=>{clearTimeout(i),t(n,r),this._ws.onopen(e)},r.onopen=e=>{clearTimeout(i),t(r,n),this._ws.onopen(e)};const a=()=>{s&&o&&(clearTimeout(i),t(n,r),this._ws.onerror(s))};n.onerror=e=>{s=e,a()},r.onerror=e=>{o=e,a()}}close(){this._ws.close(),this._ws=null}sendMessage(e){const t=JSON.stringify(e);this._ws.send(t)}setOnOpen(e){this._onOpen=e}setOnClose(e){this._onClose=e}setOnError(e){this._onError=e}setHandleMessage(e){this._handleMessage=e}isOpen(){return this._ws&&this._ws.readyState===this._ws.OPEN}_onMessage(e){const t=JSON.parse(e.data);this._handleMessage(t)}}},function(e,t,n){const r=n(19),i=n(195),s=n(6),o=n(0),a=e=>e.replace(/[^-\w ]/g,""),c=(e,t)=>{let n;const r=e.findIndex((e=>e.family.toLowerCase()===t.family.toLowerCase()));return-1!==r&&(n=e[r],e.splice(r,1)),e.push(t),n};e.exports=class extends r{constructor(e){super(),this.runtime=e,this.fonts=[],this.restrictedFonts=new Set}restrictFont(e){if(!this.isValidSystemFont(e))throw new Error("Invalid font");this.restrictedFonts.add(e.toLowerCase());const t=this.fonts.length;this.fonts=this.fonts.filter((e=>e.system||this.isValidCustomFont(e.family))),this.fonts.length!==t&&(this.updateRenderer(),this.changed())}isValidSystemFont(e){return/^[-\w ]+$/.test(e)}isValidCustomFont(e){return/^[-\w ]+$/.test(e)&&!this.restrictedFonts.has(e.toLowerCase())}isValidFamily(e){return this.isValidSystemFont(e)&&this.isValidCustomFont(e)}getUnusedSystemFont(e){return s.caseInsensitiveUnusedName(a(e),this.fonts.map((e=>e.family)))}getUnusedCustomFont(e){return s.caseInsensitiveUnusedName(a(e),[...this.fonts.map((e=>e.family)),...this.restrictedFonts])}hasFont(e){return!!this.fonts.find((t=>t.family.toLowerCase()===e.toLowerCase()))}changed(){this.emit("change")}addSystemFont(e,t){if(!this.isValidSystemFont(e))throw new Error("Invalid system font family");const n=c(this.fonts,{system:!0,family:e,fallback:t});n&&!n.system&&this.updateRenderer(),this.changed()}addCustomFont(e,t,n){if(!this.isValidCustomFont(e))throw new Error("Invalid custom font family");c(this.fonts,{system:!1,family:e,fallback:t,asset:n}),this.updateRenderer(),this.changed()}getFonts(){return this.fonts.map((e=>({system:e.system,name:e.family,family:'"'.concat(e.family,'", ').concat(e.fallback),data:e.asset?e.asset.data:null,format:e.asset?e.asset.dataFormat:null})))}deleteFont(e){const[t]=this.fonts.splice(e,1);t.system||this.updateRenderer(),this.changed()}clear(){const e=this.fonts.some((e=>!e.system));this.fonts=[],e&&this.updateRenderer(),this.changed()}updateRenderer(){if(!this.runtime.renderer||!this.runtime.renderer.setCustomFonts)return;const e={};for(const t of this.fonts)if(!t.system){const n=t.asset.encodeDataURI(),r='@font-face { font-family: "'.concat(t.family,'"; src: url("').concat(n,'"); }');e['"'.concat(t.family,'", ').concat(t.fallback)]=r}this.runtime.renderer.setCustomFonts(e)}serializeJSON(){return 0===this.fonts.length?null:this.fonts.map((e=>{const t={system:e.system,family:e.family,fallback:e.fallback};if(!e.system){const n=e.asset;t.md5ext="".concat(n.assetId,".").concat(n.dataFormat)}return t}))}serializeAssets(){return this.fonts.filter((e=>!e.system)).map((e=>e.asset))}async deserialize(e,t,n){if(n||this.clear(),Array.isArray(e))for(const n of e)if(n&&"object"==typeof n)try{const e=n.system,r=n.family,s=n.fallback;if("boolean"!=typeof e||"string"!=typeof r||"string"!=typeof s||this.hasFont(r))continue;if(e)this.addSystemFont(r,s);else{const e=n.md5ext;if("string"!=typeof e)continue;const o=await i.getByMd5ext(this.runtime,t,this.runtime.storage.AssetType.Font,e);this.addCustomFont(r,s,o)}}catch(e){o.error("could not add font",e)}}}},function(e,t,n){const r=n(6);e.exports=class{static getByMd5ext(e,t,n,i){const s=r.splitFirst(i,"."),o=s[0],a=s[1].toLowerCase();if(t){let r=t.file(i);if(!r){const e=new RegExp("^([^/]*/)?".concat(i,"$"));r=t.file(e)[0]}if(r)return e.wrapAssetRequest((()=>r.async("uint8array").then((t=>e.storage.createAsset(n,a,t,o,!1)))))}return e.wrapAssetRequest((()=>e.storage.load(n,o,a)))}}},function(e,t){e.exports={name:"TurboWarp",url:"https://turbowarp.org/"}},function(e,t){e.exports=e=>"object"==typeof e&&null!==e?JSON.stringify(e,(()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return Array.isArray(n)?"[...]":"{...}";e.add(n)}return n}})()):Object.is(e,-0)?"-0":"".concat(e)},function(e,t,n){const r=n(24);class i{constructor(){this.map=new Map,this.dirty=!1}get(e){return this.map.get(e)}has(e){return this.map.has(e)}set(e,t){if(this.map.has(e)){this.map.get(e).merge(t)&&(this.dirty=!0)}else this.map.set(e,t instanceof r?t:new r(t)),this.dirty=!0}delete(e){this.map.has(e)&&(this.map.delete(e),this.dirty=!0)}filter(e){for(const t of Array.from(this.map.keys())){e(this.map.get(t))||(this.map.delete(t),this.dirty=!0)}}empty(){return 0===this.map.size}get size(){return this.map.size}values(){return Array.from(this.map.values())}valueSeq(){return this.values()}shallowClone(){const e=new i;return e.map=this.map,e}}e.exports=i},function(e,t,n){const r=n(14);e.exports=class{constructor(e){this._projectTimer=new r({now:()=>e.currentMSecs}),this._projectTimer.start(),this._pausedTime=null,this._paused=!1,this.runtime=e}projectTimer(){return this._paused?this._pausedTime/1e3:this._projectTimer.timeElapsed()/1e3}pause(){this._paused=!0,this._pausedTime=this._projectTimer.timeElapsed()}resume(){this._paused=!1;const e=this._projectTimer.timeElapsed()-this._pausedTime;this._projectTimer.startTime+=e}resetProjectTimer(){this._projectTimer.start()}}},function(e,t,n){const r=n(9),i=n(0);e.exports=class{constructor(e){this.provider=null,this.runtime=e,this.stage=null}setProvider(e){this.provider=e}setStage(e){this.stage=e}postData(e){e.varUpdate&&this.updateCloudVariable(e.varUpdate)}requestCreateVariable(e){this.runtime.canAddCloudVariable()&&this.provider&&this.provider.createVariable(e.name,e.value)}requestUpdateVariable(e,t){this.provider&&this.provider.updateVariable(e,t)}requestRenameVariable(e,t){this.provider&&this.provider.renameVariable(e,t)}requestDeleteVariable(e){this.provider&&this.provider.deleteVariable(e)}updateCloudVariable(e){const t=e.name,n=this.stage.lookupVariableByNameAndType(t,r.SCALAR_TYPE);n&&n.isCloud?n.value=e.value:i.warn("Received an update for a cloud variable that does not exist: ".concat(t))}clear(){this.provider&&(this.provider.requestCloseConnection(),this.provider=null,this.stage=null)}}},function(e,t,n){const r=n(1),i={SPACE:"space",LEFT:"left arrow",UP:"up arrow",RIGHT:"right arrow",DOWN:"down arrow",ENTER:"enter",BACKSPACE:"backspace",DELETE:"delete",SHIFT:"shift",CAPS_LOCK:"caps lock",SCROLL_LOCK:"scroll lock",CONTROL:"control",ESCAPE:"escape",INSERT:"insert",HOME:"home",END:"end",PAGE_UP:"page up",PAGE_DOWN:"page down"},s=new Set(Object.values(i));e.exports=class{constructor(e){this._keysPressed=[],this.runtime=e,this.lastKeyPressed="",this._numeralKeyCodesToStringKey=new Map,this._usedKeys=new Set}_keyStringToScratchKey(e){switch(e=r.toString(e)){case" ":return i.SPACE;case"ArrowLeft":case"Left":return i.LEFT;case"ArrowUp":case"Up":return i.UP;case"Right":case"ArrowRight":return i.RIGHT;case"Down":case"ArrowDown":return i.DOWN;case"Enter":return i.ENTER;case"Backspace":return i.BACKSPACE;case"Delete":return i.DELETE;case"Shift":return i.SHIFT;case"CapsLock":return i.CAPS_LOCK;case"ScrollLock":return i.SCROLL_LOCK;case"Control":return i.CONTROL;case"Escape":return i.ESCAPE;case"Insert":return i.INSERT;case"Home":return i.HOME;case"End":return i.END;case"PageUp":return i.PAGE_UP;case"PageDown":return i.PAGE_DOWN}return e.length>1?"":e}_keyArgToScratchKey(e){if("number"==typeof e){if(e>=48&&e<=90)return String.fromCharCode(e);switch(e){case 32:return i.SPACE;case 37:return i.LEFT;case 38:return i.UP;case 39:return i.RIGHT;case 40:return i.DOWN}}return(e=r.toString(e)).length>1&&s.has(e)?e:(e.length>1&&(e=e[0])," "===e?i.SPACE:"\r"===e?i.ENTER:""===e?i.ESCAPE:e.toUpperCase())}postData(e){if(!e.key)return;const t=this._keyStringToScratchKey(e.key),n=1===t.length?t.toUpperCase():t;if(""===n)return;const r=this._keysPressed.indexOf(n);if(e.isDown?(this.lastKeyPressed=t,this.runtime.emit("KEY_PRESSED",n),r<0&&this._keysPressed.push(n)):r>-1&&this._keysPressed.splice(r,1),Object.prototype.hasOwnProperty.call(e,"keyCode")){const t=e.keyCode;if(this._numeralKeyCodesToStringKey.has(t)){const e=this._numeralKeyCodesToStringKey.get(t);if(e!==n){const t=this._keysPressed.indexOf(e);-1!==t&&this._keysPressed.splice(t,1)}}this._numeralKeyCodesToStringKey.set(t,n)}}getKeyIsDown(e){if("any"===e)return this._keysPressed.length>0;const t=this._keyArgToScratchKey(e);return this._usedKeys.add(t),this._keysPressed.indexOf(t)>-1}getLastKeyPressed(){return this.lastKeyPressed}hasUsedKey(e){return this._usedKeys.has(e)}}},function(e,t,n){const r=n(4),i=e=>Math.round(1e3*e)/1e3;e.exports=class{constructor(e){this._clientX=0,this._clientY=0,this._scratchX=0,this._scratchY=0,this._buttons=new Set,this.usesRightClickDown=!1,this._isDown=!1,this.runtime=e}_activateClickHats(e){this.runtime.startHats("event_whenthisspriteclicked",null,e),this.runtime.startHats("event_whenstageclicked",null,e)}_pickTarget(e,t){if(this.runtime.renderer){const n=this.runtime.renderer.pick(e,t);for(let e=0;e<this.runtime.targets.length;e++){const t=this.runtime.targets[e];if(Object.prototype.hasOwnProperty.call(t,"drawableID")&&t.drawableID===n)return t}}return this.runtime.getTargetForStage()}postData(e){if("number"==typeof e.x&&(this._clientX=e.x,this._scratchX=r.clamp(this.runtime.stageWidth*(e.x/e.canvasWidth-.5),-this.runtime.stageWidth/2,this.runtime.stageWidth/2)),"number"==typeof e.y&&(this._clientY=e.y,this._scratchY=r.clamp(-this.runtime.stageHeight*(e.y/e.canvasHeight-.5),-this.runtime.stageHeight/2,this.runtime.stageHeight/2)),void 0!==e.isDown){const t=void 0===e.button?0:e.button;e.isDown?this._buttons.add(t):this._buttons.delete(t);const n=this._isDown;if(this._isDown=e.isDown,n===this._isDown)return;if(e.wasDragged)return;if(!(e.x>0&&e.x<e.canvasWidth&&e.y>0&&e.y<e.canvasHeight))return;const r=this._pickTarget(e.x,e.y);if(r){const e=!n&&this._isDown,t=n&&!this._isDown;(r.draggable&&t||!r.draggable&&e)&&this._activateClickHats(r)}}}getClientX(){return this._clientX}getClientY(){return this._clientY}getScratchX(){return this.runtime.runtimeOptions.miscLimits?Math.round(this._scratchX):i(this._scratchX)}getScratchY(){return this.runtime.runtimeOptions.miscLimits?Math.round(this._scratchY):i(this._scratchY)}getIsDown(){return this._isDown}getButtonIsDown(e){return 2===e&&(this.usesRightClickDown=!0),this._buttons.has(e)}}},function(e,t){e.exports=class{constructor(e){this.runtime=e}postData(e){const t={};if(e.deltaY<0)t.KEY_OPTION="up arrow";else{if(!(e.deltaY>0))return;t.KEY_OPTION="down arrow"}this.runtime.startHats("event_whenkeypressed",t)}}},function(e,t){e.exports=class{constructor(){this._username=""}postData(e){this._username=e.username}getUsername(){return this._username}}},function(e,t,n){const r=n(1);e.exports=class{constructor(e){this.runtime=e,this._counter=0,this.runtime.on("RUNTIME_DISPOSED",this.clearCounter.bind(this))}getPrimitives(){return{control_repeat:this.repeat,control_repeat_until:this.repeatUntil,control_while:this.repeatWhile,control_for_each:this.forEach,control_forever:this.forever,control_wait:this.wait,control_wait_until:this.waitUntil,control_if:this.if,control_if_else:this.ifElse,control_stop:this.stop,control_create_clone_of:this.createClone,control_delete_this_clone:this.deleteClone,control_get_counter:this.getCounter,control_incr_counter:this.incrCounter,control_clear_counter:this.clearCounter,control_all_at_once:this.allAtOnce}}getHats(){return{control_start_as_clone:{restartExistingThreads:!1}}}repeat(e,t){const n=Math.round(r.toNumber(e.TIMES));void 0===t.stackFrame.loopCounter&&(t.stackFrame.loopCounter=n),t.stackFrame.loopCounter--,t.stackFrame.loopCounter>=0&&t.startBranch(1,!0)}repeatUntil(e,t){r.toBoolean(e.CONDITION)||t.startBranch(1,!0)}repeatWhile(e,t){r.toBoolean(e.CONDITION)&&t.startBranch(1,!0)}forEach(e,t){const n=t.target.lookupOrCreateVariable(e.VARIABLE.id,e.VARIABLE.name);void 0===t.stackFrame.index&&(t.stackFrame.index=0),t.stackFrame.index<Number(e.VALUE)&&(t.stackFrame.index++,n.value=t.stackFrame.index,t.startBranch(1,!0))}waitUntil(e,t){r.toBoolean(e.CONDITION)||t.yield()}forever(e,t){t.startBranch(1,!0)}wait(e,t){if(t.stackTimerNeedsInit()){const n=Math.max(0,1e3*r.toNumber(e.DURATION));t.startStackTimer(n),this.runtime.requestRedraw(),t.yield()}else t.stackTimerFinished()||t.yield()}if(e,t){r.toBoolean(e.CONDITION)&&t.startBranch(1,!1)}ifElse(e,t){r.toBoolean(e.CONDITION)?t.startBranch(1,!1):t.startBranch(2,!1)}stop(e,t){const n=e.STOP_OPTION;"all"===n?t.stopAll():"other scripts in sprite"===n||"other scripts in stage"===n?t.stopOtherTargetThreads():"this script"===n&&t.stopThisScript()}createClone(e,t){this._createClone(r.toString(e.CLONE_OPTION),t.target)}_createClone(e,t){let n;if(n="_myself_"===e?t:this.runtime.getSpriteTargetByName(e),!n)return;const r=n.makeClone();r&&(this.runtime.addTarget(r),r.goBehindOther(n))}deleteClone(e,t){t.target.isOriginal||(this.runtime.disposeTarget(t.target),this.runtime.stopForTarget(t.target))}getCounter(){return this._counter}clearCounter(){this._counter=0}incrCounter(){this._counter++}allAtOnce(e,t){t.startBranch(1,!1)}}},function(e,t,n){const r=n(1);e.exports=class{constructor(e){this.runtime=e,this.runtime.on("KEY_PRESSED",(e=>{this.runtime.startHats("event_whenkeypressed",{KEY_OPTION:e}),this.runtime.startHats("event_whenkeypressed",{KEY_OPTION:"any"})}))}getPrimitives(){return{event_whentouchingobject:this.touchingObject,event_broadcast:this.broadcast,event_broadcastandwait:this.broadcastAndWait,event_whengreaterthan:this.hatGreaterThanPredicate}}getHats(){return{event_whenflagclicked:{restartExistingThreads:!0},event_whenkeypressed:{restartExistingThreads:!1},event_whenthisspriteclicked:{restartExistingThreads:!0},event_whentouchingobject:{restartExistingThreads:!1,edgeActivated:!0},event_whenstageclicked:{restartExistingThreads:!0},event_whenbackdropswitchesto:{restartExistingThreads:!0},event_whengreaterthan:{restartExistingThreads:!1,edgeActivated:!0},event_whenbroadcastreceived:{restartExistingThreads:!0}}}touchingObject(e,t){return t.target.isTouchingObject(e.TOUCHINGOBJECTMENU)}hatGreaterThanPredicate(e,t){const n=r.toString(e.WHENGREATERTHANMENU).toLowerCase(),i=r.toNumber(e.VALUE);switch(n){case"timer":return t.ioQuery("clock","projectTimer")>i;case"loudness":return this.runtime.audioEngine&&this.runtime.audioEngine.getLoudness()>i}return!1}broadcast(e,t){const n=t.runtime.getTargetForStage().lookupBroadcastMsg(e.BROADCAST_OPTION.id,e.BROADCAST_OPTION.name);if(n){const e=n.name;t.startHats("event_whenbroadcastreceived",{BROADCAST_OPTION:e})}}broadcastAndWait(e,t){if(t.stackFrame.broadcastVar||(t.stackFrame.broadcastVar=t.runtime.getTargetForStage().lookupBroadcastMsg(e.BROADCAST_OPTION.id,e.BROADCAST_OPTION.name)),t.stackFrame.broadcastVar){const e=t.stackFrame.broadcastVar.name;if(!t.stackFrame.startedThreads&&(t.stackFrame.startedThreads=t.startHats("event_whenbroadcastreceived",{BROADCAST_OPTION:e}),0===t.stackFrame.startedThreads.length))return;const n=this;t.stackFrame.startedThreads.some((e=>-1!==n.runtime.threads.indexOf(e)))&&(t.stackFrame.startedThreads.every((e=>n.runtime.isWaitingThread(e)))?t.yieldTick():t.yield())}}}},function(e,t,n){const r=n(1),i=n(12),s=n(7),o=n(13),a=n(43),c=n(4);class l{constructor(e){this.runtime=e,this._onTargetChanged=this._onTargetChanged.bind(this),this._onResetBubbles=this._onResetBubbles.bind(this),this._onTargetWillExit=this._onTargetWillExit.bind(this),this._updateBubble=this._updateBubble.bind(this),this.runtime.on("PROJECT_STOP_ALL",this._onResetBubbles),this.runtime.on("targetWasRemoved",this._onTargetWillExit),this.runtime.on(l.SAY_OR_THINK,this._updateBubble)}static get DEFAULT_BUBBLE_STATE(){return{drawableId:null,onSpriteRight:!0,skinId:null,text:"",type:"say",usageId:null}}static get STATE_KEY(){return"Scratch.looks"}static get SAY_OR_THINK(){return"SAY"}static get SAY_BUBBLE_LIMIT(){return 330}static get EFFECT_GHOST_LIMIT(){return{min:0,max:100}}static get EFFECT_BRIGHTNESS_LIMIT(){return{min:-100,max:100}}_getBubbleState(e){let t=e.getCustomState(l.STATE_KEY);return t||(t=i.simple(l.DEFAULT_BUBBLE_STATE),e.setCustomState(l.STATE_KEY,t)),t}_onTargetChanged(e){this._getBubbleState(e).drawableId&&this._positionBubble(e)}_onTargetWillExit(e){const t=this._getBubbleState(e);t.drawableId&&t.skinId&&(this.runtime.renderer.destroyDrawable(t.drawableId,o.SPRITE_LAYER),this.runtime.renderer.destroySkin(t.skinId),t.drawableId=null,t.skinId=null,this.runtime.requestRedraw()),e.onTargetVisualChange=null}_onResetBubbles(){for(let e=0;e<this.runtime.targets.length;e++){this._getBubbleState(this.runtime.targets[e]).text="",this._onTargetWillExit(this.runtime.targets[e])}clearTimeout(this._bubbleTimeout)}_positionBubble(e){if(!e.visible)return;const t=this._getBubbleState(e),[n,r]=this.runtime.renderer.getCurrentSkinSize(t.drawableId);let i;try{i=e.getBoundsForBubble()}catch(t){i={left:e.x,right:e.x,top:e.y,bottom:e.y}}const s=this.runtime.renderer.getNativeSize(),o={left:-s[0]/2,right:s[0]/2,top:s[1]/2,bottom:-s[1]/2};t.onSpriteRight&&n+i.right>o.right&&i.left-n>o.left?(t.onSpriteRight=!1,this._renderBubble(e)):!t.onSpriteRight&&i.left-n<o.left&&n+i.right<o.right?(t.onSpriteRight=!0,this._renderBubble(e)):(this.runtime.renderer.updateDrawablePosition(t.drawableId,[t.onSpriteRight?Math.max(o.left,Math.min(o.right-n,i.right)):Math.min(o.right-n,Math.max(o.left,i.left-n)),Math.min(o.top,i.bottom+r)]),this.runtime.requestRedraw())}_renderBubble(e){if(!this.runtime.renderer)return;const t=this._getBubbleState(e),{type:n,text:r,onSpriteRight:i}=t;e.visible&&""!==r?(t.skinId?this.runtime.renderer.updateTextSkin(t.skinId,n,r,i,[0,0]):(e.onTargetVisualChange=this._onTargetChanged,t.drawableId=this.runtime.renderer.createDrawable(o.SPRITE_LAYER),t.skinId=this.runtime.renderer.createTextSkin(n,r,t.onSpriteRight,[0,0]),this.runtime.renderer.updateDrawableSkinId(t.drawableId,t.skinId)),this._positionBubble(e)):this._onTargetWillExit(e)}_formatBubbleText(e){return""===e?e:("number"==typeof e&&Math.abs(e)>=.01&&e%1!=0&&(e=e.toFixed(2)),e=String(e).substr(0,l.SAY_BUBBLE_LIMIT))}_updateBubble(e,t,n){const r=this._getBubbleState(e);r.type=t,r.text=this._formatBubbleText(n),r.usageId=s(),this._renderBubble(e)}getPrimitives(){return{looks_say:this.say,looks_sayforsecs:this.sayforsecs,looks_think:this.think,looks_thinkforsecs:this.thinkforsecs,looks_show:this.show,looks_hide:this.hide,looks_hideallsprites:()=>{},looks_switchcostumeto:this.switchCostume,looks_switchbackdropto:this.switchBackdrop,looks_switchbackdroptoandwait:this.switchBackdropAndWait,looks_nextcostume:this.nextCostume,looks_nextbackdrop:this.nextBackdrop,looks_changeeffectby:this.changeEffect,looks_seteffectto:this.setEffect,looks_cleargraphiceffects:this.clearEffects,looks_changesizeby:this.changeSize,looks_setsizeto:this.setSize,looks_changestretchby:()=>{},looks_setstretchto:()=>{},looks_gotofrontback:this.goToFrontBack,looks_goforwardbackwardlayers:this.goForwardBackwardLayers,looks_size:this.getSize,looks_costumenumbername:this.getCostumeNumberName,looks_backdropnumbername:this.getBackdropNumberName}}getMonitored(){return{looks_size:{isSpriteSpecific:!0,getId:e=>"".concat(e,"_size")},looks_costumenumbername:{isSpriteSpecific:!0,getId:(e,t)=>a("".concat(e,"_costumenumbername"),t)},looks_backdropnumbername:{getId:(e,t)=>a("backdropnumbername",t)}}}say(e,t){const n=e.MESSAGE;this._say(n,t.target)}_say(e,t){this.runtime.emit(l.SAY_OR_THINK,t,"say",e)}sayforsecs(e,t){this.say(e,t);const n=t.target,r=this._getBubbleState(n).usageId;return new Promise((t=>{this._bubbleTimeout=setTimeout((()=>{this._bubbleTimeout=null,this._getBubbleState(n).usageId===r&&this._updateBubble(n,"say",""),t()}),1e3*e.SECS)}))}think(e,t){this._think(e.MESSAGE,t.target)}_think(e,t){this.runtime.emit(l.SAY_OR_THINK,t,"think",e)}thinkforsecs(e,t){this.think(e,t);const n=t.target,r=this._getBubbleState(n).usageId;return new Promise((t=>{this._bubbleTimeout=setTimeout((()=>{this._bubbleTimeout=null,this._getBubbleState(n).usageId===r&&this._updateBubble(n,"think",""),t()}),1e3*e.SECS)}))}show(e,t){t.target.setVisible(!0),this._renderBubble(t.target)}hide(e,t){t.target.setVisible(!1),this._renderBubble(t.target)}_setCostume(e,t,n){if("number"==typeof t)e.setCostume(n?t:t-1);else{const i=e.getCostumeIndexByName(t.toString());-1!==i?e.setCostume(i):"next costume"===t?e.setCostume(e.currentCostume+1):"previous costume"===t?e.setCostume(e.currentCostume-1):isNaN(t)||r.isWhiteSpace(t)||e.setCostume(n?Number(t):Number(t)-1)}return[]}_setBackdrop(e,t,n){if("number"==typeof t)e.setCostume(n?t:t-1);else{const i=e.getCostumeIndexByName(t.toString());if(-1!==i)e.setCostume(i);else if("next backdrop"===t)e.setCostume(e.currentCostume+1);else if("previous backdrop"===t)e.setCostume(e.currentCostume-1);else if("random backdrop"===t){const t=e.getCostumes().length;if(t>1){const n=0,r=t-1,i=e.currentCostume,s=c.inclusiveRandIntWithout(n,r,i);e.setCostume(s)}}else isNaN(t)||r.isWhiteSpace(t)||e.setCostume(n?Number(t):Number(t)-1)}const i=e.getCostumes()[e.currentCostume].name;return this.runtime.startHats("event_whenbackdropswitchesto",{BACKDROP:i})}switchCostume(e,t){this._setCostume(t.target,e.COSTUME)}nextCostume(e,t){this._setCostume(t.target,t.target.currentCostume+1,!0)}switchBackdrop(e){this._setBackdrop(this.runtime.getTargetForStage(),e.BACKDROP)}switchBackdropAndWait(e,t){if(!t.stackFrame.startedThreads&&(t.stackFrame.startedThreads=this._setBackdrop(this.runtime.getTargetForStage(),e.BACKDROP),0===t.stackFrame.startedThreads.length))return;const n=this;t.stackFrame.startedThreads.some((e=>-1!==n.runtime.threads.indexOf(e)))&&(t.stackFrame.startedThreads.every((e=>n.runtime.isWaitingThread(e)))?t.yieldTick():t.yield())}nextBackdrop(){const e=this.runtime.getTargetForStage();this._setBackdrop(e,e.currentCostume+1,!0)}clampEffect(e,t){let n=t;switch(e){case"ghost":n=c.clamp(t,l.EFFECT_GHOST_LIMIT.min,l.EFFECT_GHOST_LIMIT.max);break;case"brightness":n=c.clamp(t,l.EFFECT_BRIGHTNESS_LIMIT.min,l.EFFECT_BRIGHTNESS_LIMIT.max)}return n}changeEffect(e,t){const n=r.toString(e.EFFECT).toLowerCase(),i=r.toNumber(e.CHANGE);if(!Object.prototype.hasOwnProperty.call(t.target.effects,n))return;let s=i+t.target.effects[n];s=this.clampEffect(n,s),t.target.setEffect(n,s)}setEffect(e,t){const n=r.toString(e.EFFECT).toLowerCase();let i=r.toNumber(e.VALUE);i=this.clampEffect(n,i),t.target.setEffect(n,i)}clearEffects(e,t){t.target.clearEffects()}changeSize(e,t){const n=r.toNumber(e.CHANGE);t.target.setSize(t.target.size+n)}setSize(e,t){const n=r.toNumber(e.SIZE);t.target.setSize(n)}goToFrontBack(e,t){t.target.isStage||("front"===e.FRONT_BACK?t.target.goToFront():t.target.goToBack())}goForwardBackwardLayers(e,t){t.target.isStage||("forward"===e.FORWARD_BACKWARD?t.target.goForwardLayers(r.toNumber(e.NUM)):t.target.goBackwardLayers(r.toNumber(e.NUM)))}getSize(e,t){return Math.round(t.target.size)}getBackdropNumberName(e){const t=this.runtime.getTargetForStage();return"number"===e.NUMBER_NAME?t.currentCostume+1:t.getCostumes()[t.currentCostume].name}getCostumeNumberName(e,t){return"number"===e.NUMBER_NAME?t.target.currentCostume+1:t.target.getCostumes()[t.target.currentCostume].name}}e.exports=l},function(e,t,n){const r=n(1),i=n(4),s=n(14);e.exports=class{constructor(e){this.runtime=e}getPrimitives(){return{motion_movesteps:this.moveSteps,motion_gotoxy:this.goToXY,motion_goto:this.goTo,motion_turnright:this.turnRight,motion_turnleft:this.turnLeft,motion_pointindirection:this.pointInDirection,motion_pointtowards:this.pointTowards,motion_glidesecstoxy:this.glide,motion_glideto:this.glideTo,motion_ifonedgebounce:this.ifOnEdgeBounce,motion_setrotationstyle:this.setRotationStyle,motion_changexby:this.changeX,motion_setx:this.setX,motion_changeyby:this.changeY,motion_sety:this.setY,motion_xposition:this.getX,motion_yposition:this.getY,motion_direction:this.getDirection,motion_scroll_right:()=>{},motion_scroll_up:()=>{},motion_align_scene:()=>{},motion_xscroll:()=>{},motion_yscroll:()=>{}}}getMonitored(){return{motion_xposition:{isSpriteSpecific:!0,getId:e=>"".concat(e,"_xposition")},motion_yposition:{isSpriteSpecific:!0,getId:e=>"".concat(e,"_yposition")},motion_direction:{isSpriteSpecific:!0,getId:e=>"".concat(e,"_direction")}}}moveSteps(e,t){const n=r.toNumber(e.STEPS);this._moveSteps(n,t.target)}_moveSteps(e,t){const n=i.degToRad(90-t.direction),r=e*Math.cos(n),s=e*Math.sin(n);t.setXY(t.x+r,t.y+s)}goToXY(e,t){const n=r.toNumber(e.X),i=r.toNumber(e.Y);t.target.setXY(n,i)}getTargetXY(e,t){let n=0,i=0;if("_mouse_"===e)n=t.ioQuery("mouse","getScratchX"),i=t.ioQuery("mouse","getScratchY");else if("_random_"===e){const e=this.runtime.stageWidth,t=this.runtime.stageHeight;n=Math.round(e*(Math.random()-.5)),i=Math.round(t*(Math.random()-.5))}else{e=r.toString(e);const t=this.runtime.getSpriteTargetByName(e);if(!t)return;n=t.x,i=t.y}return[n,i]}goTo(e,t){const n=this.getTargetXY(e.TO,t);n&&t.target.setXY(n[0],n[1])}turnRight(e,t){const n=r.toNumber(e.DEGREES);t.target.setDirection(t.target.direction+n)}turnLeft(e,t){const n=r.toNumber(e.DEGREES);t.target.setDirection(t.target.direction-n)}pointInDirection(e,t){const n=r.toNumber(e.DIRECTION);t.target.setDirection(n)}pointTowards(e,t){let n=0,s=0;if("_mouse_"===e.TOWARDS)n=t.ioQuery("mouse","getScratchX"),s=t.ioQuery("mouse","getScratchY");else{if("_random_"===e.TOWARDS)return void t.target.setDirection(Math.round(360*Math.random())-180);{e.TOWARDS=r.toString(e.TOWARDS);const t=this.runtime.getSpriteTargetByName(e.TOWARDS);if(!t)return;n=t.x,s=t.y}}const o=n-t.target.x,a=s-t.target.y,c=90-i.radToDeg(Math.atan2(a,o));t.target.setDirection(c)}glide(e,t){if(t.stackFrame.timer){const e=t.stackFrame.timer.timeElapsed();if(e<1e3*t.stackFrame.duration){const n=e/(1e3*t.stackFrame.duration),r=n*(t.stackFrame.endX-t.stackFrame.startX),i=n*(t.stackFrame.endY-t.stackFrame.startY);t.target.setXY(t.stackFrame.startX+r,t.stackFrame.startY+i),t.yield()}else t.target.setXY(t.stackFrame.endX,t.stackFrame.endY)}else{if(t.stackFrame.timer=new s,t.stackFrame.timer.start(),t.stackFrame.duration=r.toNumber(e.SECS),t.stackFrame.startX=t.target.x,t.stackFrame.startY=t.target.y,t.stackFrame.endX=r.toNumber(e.X),t.stackFrame.endY=r.toNumber(e.Y),t.stackFrame.duration<=0)return void t.target.setXY(t.stackFrame.endX,t.stackFrame.endY);t.yield()}}glideTo(e,t){const n=this.getTargetXY(e.TO,t);n&&this.glide({SECS:e.SECS,X:n[0],Y:n[1]},t)}ifOnEdgeBounce(e,t){this._ifOnEdgeBounce(t.target)}_ifOnEdgeBounce(e){const t=e.getBounds();if(!t)return;const n=this.runtime.stageWidth,r=this.runtime.stageHeight,s=Math.max(0,n/2+t.left),o=Math.max(0,r/2-t.top),a=Math.max(0,n/2-t.right),c=Math.max(0,r/2+t.bottom);let l="",u=1/0;if(s<u&&(u=s,l="left"),o<u&&(u=o,l="top"),a<u&&(u=a,l="right"),c<u&&(u=c,l="bottom"),u>0)return;const h=i.degToRad(90-e.direction);let d=Math.cos(h),p=-Math.sin(h);"left"===l?d=Math.max(.2,Math.abs(d)):"top"===l?p=Math.max(.2,Math.abs(p)):"right"===l?d=0-Math.max(.2,Math.abs(d)):"bottom"===l&&(p=0-Math.max(.2,Math.abs(p)));const f=i.radToDeg(Math.atan2(p,d))+90;e.setDirection(f);const m=e.keepInFence(e.x,e.y);e.setXY(m[0],m[1])}setRotationStyle(e,t){t.target.setRotationStyle(e.STYLE)}changeX(e,t){const n=r.toNumber(e.DX);t.target.setXY(t.target.x+n,t.target.y)}setX(e,t){const n=r.toNumber(e.X);t.target.setXY(n,t.target.y)}changeY(e,t){const n=r.toNumber(e.DY);t.target.setXY(t.target.x,t.target.y+n)}setY(e,t){const n=r.toNumber(e.Y);t.target.setXY(t.target.x,n)}getX(e,t){return this.limitPrecision(t.target.x)}getY(e,t){return this.limitPrecision(t.target.y)}getDirection(e,t){return t.target.direction}limitPrecision(e){const t=Math.round(e),n=e-t;return Math.abs(n)<1e-9?t:e}}},function(e,t,n){const r=n(1),i=n(4);e.exports=class{constructor(e){this.runtime=e}getPrimitives(){return{operator_add:this.add,operator_subtract:this.subtract,operator_multiply:this.multiply,operator_divide:this.divide,operator_lt:this.lt,operator_equals:this.equals,operator_gt:this.gt,operator_and:this.and,operator_or:this.or,operator_not:this.not,operator_random:this.random,operator_join:this.join,operator_letter_of:this.letterOf,operator_length:this.length,operator_contains:this.contains,operator_mod:this.mod,operator_round:this.round,operator_mathop:this.mathop}}add(e){return r.toNumber(e.NUM1)+r.toNumber(e.NUM2)}subtract(e){return r.toNumber(e.NUM1)-r.toNumber(e.NUM2)}multiply(e){return r.toNumber(e.NUM1)*r.toNumber(e.NUM2)}divide(e){return r.toNumber(e.NUM1)/r.toNumber(e.NUM2)}lt(e){return r.compare(e.OPERAND1,e.OPERAND2)<0}equals(e){return 0===r.compare(e.OPERAND1,e.OPERAND2)}gt(e){return r.compare(e.OPERAND1,e.OPERAND2)>0}and(e){return r.toBoolean(e.OPERAND1)&&r.toBoolean(e.OPERAND2)}or(e){return r.toBoolean(e.OPERAND1)||r.toBoolean(e.OPERAND2)}not(e){return!r.toBoolean(e.OPERAND)}random(e){return this._random(e.FROM,e.TO)}_random(e,t){const n=r.toNumber(e),i=r.toNumber(t),s=n<=i?n:i,o=n<=i?i:n;return s===o?s:r.isInt(e)&&r.isInt(t)?s+Math.floor(Math.random()*(o+1-s)):Math.random()*(o-s)+s}join(e){return r.toString(e.STRING1)+r.toString(e.STRING2)}letterOf(e){const t=r.toNumber(e.LETTER)-1,n=r.toString(e.STRING);return t<0||t>=n.length?"":n.charAt(t)}length(e){return r.toString(e.STRING).length}contains(e){const t=function(e){return r.toString(e).toLowerCase()};return t(e.STRING1).includes(t(e.STRING2))}mod(e){const t=r.toNumber(e.NUM1),n=r.toNumber(e.NUM2);let i=t%n;return i/n<0&&(i+=n),i}round(e){return Math.round(r.toNumber(e.NUM))}mathop(e){const t=r.toString(e.OPERATOR).toLowerCase(),n=r.toNumber(e.NUM);switch(t){case"abs":return Math.abs(n);case"floor":return Math.floor(n);case"ceiling":return Math.ceil(n);case"sqrt":return Math.sqrt(n);case"sin":return Math.round(1e10*Math.sin(Math.PI*n/180))/1e10;case"cos":return Math.round(1e10*Math.cos(Math.PI*n/180))/1e10;case"tan":return i.tan(n);case"asin":return 180*Math.asin(n)/Math.PI;case"acos":return 180*Math.acos(n)/Math.PI;case"atan":return 180*Math.atan(n)/Math.PI;case"ln":return Math.log(n);case"log":return Math.log(n)/Math.LN10;case"e ^":return Math.exp(n);case"10 ^":return Math.pow(10,n)}return 0}}},function(e,t,n){const r=n(4),i=n(1),s=n(12),o=!0;class a{constructor(e){this.runtime=e,this.waitingSounds={},this.stopAllSounds=this.stopAllSounds.bind(this),this._stopWaitingSoundsForTarget=this._stopWaitingSoundsForTarget.bind(this),this._clearEffectsForAllTargets=this._clearEffectsForAllTargets.bind(this),this.runtime&&(this.runtime.on("PROJECT_STOP_ALL",this.stopAllSounds),this.runtime.on("PROJECT_STOP_ALL",this._clearEffectsForAllTargets),this.runtime.on("STOP_FOR_TARGET",this._stopWaitingSoundsForTarget),this.runtime.on("PROJECT_START",this._clearEffectsForAllTargets)),this._onTargetCreated=this._onTargetCreated.bind(this),this.runtime&&e.on("targetWasCreated",this._onTargetCreated)}static get STATE_KEY(){return"Scratch.sound"}static get DEFAULT_SOUND_STATE(){return{effects:{pitch:0,pan:0}}}static get MIDI_NOTE_RANGE(){return{min:36,max:96}}static get BEAT_RANGE(){return{min:0,max:100}}static get TEMPO_RANGE(){return{min:20,max:500}}static get EFFECT_RANGE(){return{pitch:{min:-360,max:360},pan:{min:-100,max:100}}}static get LARGER_EFFECT_RANGE(){return{pitch:{min:-1e3,max:1e3},pan:{min:-100,max:100}}}_getSoundState(e){let t=e.getCustomState(a.STATE_KEY);return t||(t=s.simple(a.DEFAULT_SOUND_STATE),e.setCustomState(a.STATE_KEY,t),e.soundEffects=t.effects),t}_onTargetCreated(e,t){if(t){const n=t.getCustomState(a.STATE_KEY);n&&e&&(e.setCustomState(a.STATE_KEY,s.simple(n)),this._syncEffectsForTarget(e))}}getPrimitives(){return{sound_play:this.playSound,sound_playuntildone:this.playSoundAndWait,sound_stopallsounds:this.stopAllSounds,sound_seteffectto:this.setEffect,sound_changeeffectby:this.changeEffect,sound_cleareffects:this.clearEffects,sound_sounds_menu:this.soundsMenu,sound_beats_menu:this.beatsMenu,sound_effects_menu:this.effectsMenu,sound_setvolumeto:this.setVolume,sound_changevolumeby:this.changeVolume,sound_volume:this.getVolume}}getMonitored(){return{sound_volume:{isSpriteSpecific:!0,getId:e=>"".concat(e,"_volume")}}}playSound(e,t){this._playSound(e,t)}playSoundAndWait(e,t){return this._playSound(e,t,o)}_playSound(e,t,n){const r=this._getSoundIndex(e.SOUND_MENU,t);if(r>=0){const{target:e}=t,{sprite:i}=e,{soundId:s}=i.sounds[r];if(i.soundBank)return n===o?this._addWaitingSound(e.id,s):this._removeWaitingSound(e.id,s),i.soundBank.playSound(e,s)}}_addWaitingSound(e,t){this.waitingSounds[e]||(this.waitingSounds[e]=new Set),this.waitingSounds[e].add(t)}_removeWaitingSound(e,t){this.waitingSounds[e]&&this.waitingSounds[e].delete(t)}_getSoundIndex(e,t){const n=t.target.sprite.sounds.length;if(0===n)return-1;const i=this.getSoundIndexByName(e,t);if(-1!==i)return i;const s=parseInt(e,10);return isNaN(s)?-1:r.wrapClamp(s-1,0,n-1)}getSoundIndexByName(e,t){const n=t.target.sprite.sounds;for(let t=0;t<n.length;t++)if(n[t].name===e)return t;return-1}stopAllSounds(){if(null===this.runtime.targets)return;const e=this.runtime.targets;for(let t=0;t<e.length;t++)this._stopAllSoundsForTarget(e[t])}_stopAllSoundsForTarget(e){e.sprite.soundBank&&(e.sprite.soundBank.stopAllSounds(e),this.waitingSounds[e.id]&&this.waitingSounds[e.id].clear())}_stopWaitingSoundsForTarget(e){if(e.sprite.soundBank&&this.waitingSounds[e.id]){for(const t of this.waitingSounds[e.id].values())e.sprite.soundBank.stop(e,t);this.waitingSounds[e.id].clear()}}setEffect(e,t){return this._updateEffect(e,t,!1)}changeEffect(e,t){return this._updateEffect(e,t,!0)}_updateEffect(e,t,n){const s=i.toString(e.EFFECT).toLowerCase(),o=i.toNumber(e.VALUE),c=this._getSoundState(t.target);if(!Object.prototype.hasOwnProperty.call(c.effects,s))return;n?c.effects[s]+=o:c.effects[s]=o;const l=this.runtime.runtimeOptions.miscLimits,{min:u,max:h}=l?a.EFFECT_RANGE[s]:a.LARGER_EFFECT_RANGE[s];if(c.effects[s]=r.clamp(c.effects[s],u,h),this._syncEffectsForTarget(t.target),l)return Promise.resolve();this.runtime.requestRedraw()}_syncEffectsForTarget(e){e&&e.sprite.soundBank&&(e.soundEffects=this._getSoundState(e).effects,e.sprite.soundBank.setEffects(e))}clearEffects(e,t){this._clearEffectsForTarget(t.target)}_clearEffectsForTarget(e){const t=this._getSoundState(e);for(const e in t.effects)Object.prototype.hasOwnProperty.call(t.effects,e)&&(t.effects[e]=0);this._syncEffectsForTarget(e)}_clearEffectsForAllTargets(){if(null===this.runtime.targets)return;const e=this.runtime.targets;for(let t=0;t<e.length;t++)this._clearEffectsForTarget(e[t])}setVolume(e,t){const n=i.toNumber(e.VOLUME);return this._updateVolume(n,t)}changeVolume(e,t){const n=i.toNumber(e.VOLUME)+t.target.volume;return this._updateVolume(n,t)}_updateVolume(e,t){if(e=r.clamp(e,0,100),t.target.volume=e,this._syncEffectsForTarget(t.target),this.runtime.runtimeOptions.miscLimits)return Promise.resolve();this.runtime.requestRedraw()}getVolume(e,t){return t.target.volume}soundsMenu(e){return e.SOUND_MENU}beatsMenu(e){return e.BEATS}effectsMenu(e){return e.EFFECT}}e.exports=a},function(e,t,n){const r=n(1),i=n(14),s=n(43);e.exports=class{constructor(e){this.runtime=e,this._answer="",this._timer=new i,this._cachedLoudness=-1,this._cachedLoudnessTimestamp=0,this._questionList=[],this.runtime.on("ANSWER",this._onAnswer.bind(this)),this.runtime.on("PROJECT_START",this._resetAnswer.bind(this)),this.runtime.on("PROJECT_STOP_ALL",this._clearAllQuestions.bind(this)),this.runtime.on("STOP_FOR_TARGET",this._clearTargetQuestions.bind(this)),this.runtime.on("RUNTIME_DISPOSED",this._resetAnswer.bind(this))}getPrimitives(){return{sensing_touchingobject:this.touchingObject,sensing_touchingcolor:this.touchingColor,sensing_coloristouchingcolor:this.colorTouchingColor,sensing_distanceto:this.distanceTo,sensing_timer:this.getTimer,sensing_resettimer:this.resetTimer,sensing_of:this.getAttributeOf,sensing_mousex:this.getMouseX,sensing_mousey:this.getMouseY,sensing_setdragmode:this.setDragMode,sensing_mousedown:this.getMouseDown,sensing_keypressed:this.getKeyPressed,sensing_current:this.current,sensing_dayssince2000:this.daysSince2000,sensing_loudness:this.getLoudness,sensing_loud:this.isLoud,sensing_askandwait:this.askAndWait,sensing_answer:this.getAnswer,sensing_username:this.getUsername,sensing_userid:()=>{},sensing_online:this.isOnline}}getMonitored(){return{sensing_answer:{getId:()=>"answer"},sensing_mousedown:{getId:()=>"mousedown"},sensing_mousex:{getId:()=>"mousex"},sensing_mousey:{getId:()=>"mousey"},sensing_loudness:{getId:()=>"loudness"},sensing_timer:{getId:()=>"timer"},sensing_dayssince2000:{getId:()=>"dayssince2000"},sensing_current:{getId:(e,t)=>s("current",t)},sensing_online:{getId:()=>"online"}}}_onAnswer(e){this._answer=e;const t=this._questionList.shift();if(t){const[e,n,r,i,s]=t;i&&!s&&this.runtime.emit("SAY",r,"say",""),n(),this._askNextQuestion()}}_resetAnswer(){this._answer=""}_enqueueAsk(e,t,n,r,i){this._questionList.push([e,t,n,r,i])}_askNextQuestion(){if(this._questionList.length>0){const[e,t,n,r,i]=this._questionList[0];r&&!i?(this.runtime.emit("SAY",n,"say",e),this.runtime.emit("QUESTION","")):this.runtime.emit("QUESTION",e)}}_clearAllQuestions(){this._questionList=[],this.runtime.emit("QUESTION",null)}_clearTargetQuestions(e){const t=this._questionList.length>0&&this._questionList[0][2]===e;this._questionList=this._questionList.filter((t=>t[2]!==e)),t&&(this.runtime.emit("SAY",e,"say",""),this._questionList.length>0?this._askNextQuestion():this.runtime.emit("QUESTION",null))}askAndWait(e,t){const n=t.target;return new Promise((t=>{const r=this._questionList.length>0;this._enqueueAsk(String(e.QUESTION),t,n,n.visible,n.isStage),r||this._askNextQuestion()}))}getAnswer(){return this._answer}touchingObject(e,t){return t.target.isTouchingObject(e.TOUCHINGOBJECTMENU)}touchingColor(e,t){const n=r.toRgbColorList(e.COLOR);return t.target.isTouchingColor(n)}colorTouchingColor(e,t){const n=r.toRgbColorList(e.COLOR),i=r.toRgbColorList(e.COLOR2);return t.target.colorIsTouchingColor(i,n)}distanceTo(e,t){if(t.target.isStage)return 1e4;let n=0,i=0;if("_mouse_"===e.DISTANCETOMENU)n=t.ioQuery("mouse","getScratchX"),i=t.ioQuery("mouse","getScratchY");else{e.DISTANCETOMENU=r.toString(e.DISTANCETOMENU);const t=this.runtime.getSpriteTargetByName(e.DISTANCETOMENU);if(!t)return 1e4;n=t.x,i=t.y}const s=t.target.x-n,o=t.target.y-i;return Math.sqrt(s*s+o*o)}setDragMode(e,t){t.target.setDraggable("draggable"===e.DRAG_MODE)}getTimer(e,t){return t.ioQuery("clock","projectTimer")}resetTimer(e,t){t.ioQuery("clock","resetProjectTimer")}getMouseX(e,t){return t.ioQuery("mouse","getScratchX")}getMouseY(e,t){return t.ioQuery("mouse","getScratchY")}getMouseDown(e,t){return t.ioQuery("mouse","getIsDown")}current(e){const t=r.toString(e.CURRENTMENU).toLowerCase(),n=new Date;switch(t){case"year":return n.getFullYear();case"month":return n.getMonth()+1;case"date":return n.getDate();case"dayofweek":return n.getDay()+1;case"hour":return n.getHours();case"minute":return n.getMinutes();case"second":return n.getSeconds()}return 0}getKeyPressed(e,t){return t.ioQuery("keyboard","getKeyIsDown",[e.KEY_OPTION])}daysSince2000(){const e=new Date(2e3,0,1),t=new Date,n=t.getTimezoneOffset()-e.getTimezoneOffset();let r=t.valueOf()-e.valueOf();return r+=60*(t.getTimezoneOffset()-n)*1e3,r/864e5}getLoudness(){if(void 0===this.runtime.audioEngine)return-1;if(null===this.runtime.currentStepTime)return-1;return this._timer.time()-this._cachedLoudnessTimestamp<this.runtime.currentStepTime||(this._cachedLoudnessTimestamp=this._timer.time(),this._cachedLoudness=this.runtime.audioEngine.getLoudness()),this._cachedLoudness}isLoud(){return this.getLoudness()>10}getAttributeOf(e){let t;if("_stage_"===e.OBJECT?t=this.runtime.getTargetForStage():(e.OBJECT=r.toString(e.OBJECT),t=this.runtime.getSpriteTargetByName(e.OBJECT)),!t)return 0;if(t.isStage)switch(e.PROPERTY){case"background #":case"backdrop #":return t.currentCostume+1;case"backdrop name":return t.getCostumes()[t.currentCostume].name;case"volume":return t.volume}else switch(e.PROPERTY){case"x position":return t.x;case"y position":return t.y;case"direction":return t.direction;case"costume #":return t.currentCostume+1;case"costume name":return t.getCostumes()[t.currentCostume].name;case"size":return t.size;case"volume":return t.volume}const n=e.PROPERTY,i=t.lookupVariableByNameAndType(n,"",!0);return i?i.value:0}getUsername(e,t){return t.ioQuery("userData","getUsername")}isOnline(){return"object"!=typeof navigator||"boolean"!=typeof navigator.onLine||navigator.onLine}}},function(e,t,n){const r=n(1);e.exports=class{constructor(e){this.runtime=e}getPrimitives(){return{data_variable:this.getVariable,data_setvariableto:this.setVariableTo,data_changevariableby:this.changeVariableBy,data_hidevariable:this.hideVariable,data_showvariable:this.showVariable,data_listcontents:this.getListContents,data_addtolist:this.addToList,data_deleteoflist:this.deleteOfList,data_deletealloflist:this.deleteAllOfList,data_insertatlist:this.insertAtList,data_replaceitemoflist:this.replaceItemOfList,data_itemoflist:this.getItemOfList,data_itemnumoflist:this.getItemNumOfList,data_lengthoflist:this.lengthOfList,data_listcontainsitem:this.listContainsItem,data_hidelist:this.hideList,data_showlist:this.showList}}getVariable(e,t){return t.target.lookupOrCreateVariable(e.VARIABLE.id,e.VARIABLE.name).value}setVariableTo(e,t){const n=t.target.lookupOrCreateVariable(e.VARIABLE.id,e.VARIABLE.name);n.value=e.VALUE,n.isCloud&&t.ioQuery("cloud","requestUpdateVariable",[n.name,e.VALUE])}changeVariableBy(e,t){const n=t.target.lookupOrCreateVariable(e.VARIABLE.id,e.VARIABLE.name),i=r.toNumber(n.value)+r.toNumber(e.VALUE);n.value=i,n.isCloud&&t.ioQuery("cloud","requestUpdateVariable",[n.name,i])}changeMonitorVisibility(e,t){this.runtime.monitorBlocks.changeBlock({id:e,element:"checkbox",value:t},this.runtime)}showVariable(e){this.changeMonitorVisibility(e.VARIABLE.id,!0)}hideVariable(e){this.changeMonitorVisibility(e.VARIABLE.id,!1)}showList(e){this.changeMonitorVisibility(e.LIST.id,!0)}hideList(e){this.changeMonitorVisibility(e.LIST.id,!1)}getListContents(e,t){const n=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name);if(t.thread.updateMonitor)return n._monitorUpToDate?n.value:(n._monitorUpToDate=!0,n.value.slice());let r=!0;for(let e=0;e<n.value.length;e++){const t=n.value[e];if("string"!=typeof t||1!==t.length){r=!1;break}}return r?n.value.join(""):n.value.join(" ")}addToList(e,t){const n=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name);n.value.push(e.ITEM),n._monitorUpToDate=!1}deleteOfList(e,t){const n=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name),i=r.toListIndex(e.INDEX,n.value.length,!0);i!==r.LIST_INVALID&&(i!==r.LIST_ALL?(n.value.splice(i-1,1),n._monitorUpToDate=!1):n.value=[])}deleteAllOfList(e,t){t.target.lookupOrCreateList(e.LIST.id,e.LIST.name).value=[]}insertAtList(e,t){const n=e.ITEM,i=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name),s=r.toListIndex(e.INDEX,i.value.length+1,!1);s!==r.LIST_INVALID&&(i.value.splice(s-1,0,n),i._monitorUpToDate=!1)}replaceItemOfList(e,t){const n=e.ITEM,i=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name),s=r.toListIndex(e.INDEX,i.value.length,!1);s!==r.LIST_INVALID&&(i.value[s-1]=n,i._monitorUpToDate=!1)}getItemOfList(e,t){const n=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name),i=r.toListIndex(e.INDEX,n.value.length,!1);return i===r.LIST_INVALID?"":n.value[i-1]}getItemNumOfList(e,t){const n=e.ITEM,i=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name);for(let e=0;e<i.value.length;e++)if(0===r.compare(i.value[e],n))return e+1;return 0}lengthOfList(e,t){return t.target.lookupOrCreateList(e.LIST.id,e.LIST.name).value.length}listContainsItem(e,t){const n=e.ITEM,i=t.target.lookupOrCreateList(e.LIST.id,e.LIST.name);if(i.value.indexOf(n)>=0)return!0;for(let e=0;e<i.value.length;e++)if(0===r.compare(i.value[e],n))return!0;return!1}}},function(e,t){e.exports=class{constructor(e){this.runtime=e}getPrimitives(){return{procedures_definition:this.definition,procedures_call:this.call,procedures_return:this.return,argument_reporter_string_number:this.argumentReporterStringNumber,argument_reporter_boolean:this.argumentReporterBoolean}}definition(){}call(e,t){const n=t.stackFrame,r=!!e.mutation.return;if(n.executed){if(r){const e=n.returnValue;return t.thread.peekStackFrame().params=null,delete n.returnValue,delete n.executed,e}return}const i=e.mutation.proccode,s=t.getProcedureParamNamesIdsAndDefaults(i);if(null===s)return r?"":void 0;const[o,a,c]=s;t.initParams();for(let n=0;n<a.length;n++)Object.prototype.hasOwnProperty.call(e,a[n])?t.pushParam(o[n],e[a[n]]):t.pushParam(o[n],c[n]);const l=t.runtime.getAddonBlock(i);if(l){const e=l.callback(t.thread.getAllparams(),t);return 1===t.thread.status&&(n.executed=!0),e}n.executed=!0,r&&(t.thread.peekStackFrame().waitingReporter=!0,n.returnValue=""),t.startProcedure(i)}return(e,t){t.stopThisScript(),t.thread.peekStackFrame()&&(t.stackFrame.returnValue=e.VALUE)}argumentReporterStringNumber(e,t){const n=t.getParam(e.VALUE);return null===n?"last key pressed"===String(e.VALUE).toLowerCase()?t.ioQuery("keyboard","getLastKeyPressed"):0:n}argumentReporterBoolean(e,t){const n=t.getParam(e.VALUE);if(null===n){const n=String(e.VALUE).toLowerCase();return!(!t.target.runtime.compilerOptions.enabled||"is compiled?"!==n)||("is turbowarp?"===n||0)}return n}}},function(e,t){e.exports={setupInitialState:e=>{const t=e.renderer;for(const n of e.targets){const e=n._getRenderedDirectionAndScale();if(t&&n.interpolationData){const r=n.drawableID;t.updateDrawablePosition(r,[n.x,n.y]),t.updateDrawableDirectionScale(r,e.direction,e.scale),t.updateDrawableEffect(r,"ghost",n.effects.ghost)}n.visible&&!n.isStage?n.interpolationData={x:n.x,y:n.y,direction:e.direction,scale:e.scale,costume:n.currentCostume,ghost:n.effects.ghost}:n.interpolationData=null}},interpolate:(e,t)=>{const n=e.renderer;if(n)for(const r of e.targets){const e=r.interpolationData;if(!e)continue;if(!r.visible)continue;const i=r.drawableID,s=r.x-e.x,o=r.y-e.y,a=Math.abs(s),c=Math.abs(o);if(a>.1||c>.1){const r=n._allDrawables[i].getAABB(),l=Math.min(240,Math.max(50,1.5*(r.width+r.height)));if(Math.sqrt(a**2+c**2)<l){const r=e.x+s*t,a=e.y+o*t;n.updateDrawablePosition(i,[r,a])}}const l=r.effects.ghost-e.ghost,u=Math.abs(l);if(u>0&&u<25){const e=r.effects.ghost+l*t;n.updateDrawableEffect(i,"ghost",e)}if(e.costume===r.currentCostume){let{direction:s,scale:o}=r._getRenderedDirectionAndScale(),a=!1;if(s!==e.direction&&(s%90!=0||e.direction%90!=0)){const n=s*Math.PI/180,r=e.direction*Math.PI/180;s=180*Math.atan2(Math.sin(n)*t+Math.sin(r)*(1-t),Math.cos(n)*t+Math.cos(r)*(1-t))/Math.PI,a=!0}const c=e.scale;if((o[0]!==c[0]||o[1]!==c[1])&&Math.sign(o[0])===Math.sign(c[0])&&Math.sign(o[1])===Math.sign(c[1])){const e=o[0]-c[0],n=o[1]-c[1],r=Math.abs(e),i=Math.abs(n);r<100&&i<100&&(o[0]=c[0]+e*t,o[1]=c[1]+n*t,a=!0)}a&&n.updateDrawableDirectionScale(i,s,o)}}}}},function(e,t){const n="function"==typeof requestAnimationFrame?requestAnimationFrame:e=>setTimeout(e,1e3/60),r="function"==typeof requestAnimationFrame?cancelAnimationFrame:clearTimeout,i=e=>{let t;const i=()=>{t=n(i),e()};return t=n(i),{cancel:()=>r(t)}};e.exports=class{constructor(e){this.runtime=e,this.running=!1,this.setFramerate(30),this.setInterpolation(!1),this.stepCallback=this.stepCallback.bind(this),this.interpolationCallback=this.interpolationCallback.bind(this),this._stepInterval=null,this._interpolationAnimation=null,this._stepAnimation=null,this._noopAnimation=null}setFramerate(e){this.framerate=e,this._restart()}setInterpolation(e){this.interpolation=e,this._restart()}stepCallback(){this.runtime._step()}interpolationCallback(){this.runtime._renderInterpolatedPositions()}noopCallback(){}_restart(){this.running&&(this.stop(),this.start())}start(){this.running=!0,0===this.framerate?(this._stepAnimation=i(this.stepCallback),this.runtime.currentStepTime=1e3/60):(this.interpolation?this._interpolationAnimation=i(this.interpolationCallback):this.framerate>=30&&navigator.userAgent.includes("Chrome")&&(navigator.userAgent.includes("Windows")||navigator.userAgent.includes("Android"))&&(this._noopAnimation=i(this.noopCallback)),this._stepInterval=setInterval(this.stepCallback,1e3/this.framerate),this.runtime.currentStepTime=1e3/this.framerate)}stop(){this.running=!1,clearInterval(this._stepInterval),this._interpolationAnimation&&(this._interpolationAnimation.cancel(),this._interpolationAnimation=null),this._stepAnimation&&(this._stepAnimation.cancel(),this._stepAnimation=null),this._noopAnimation&&(this._noopAnimation.cancel(),this._noopAnimation=null)}}},function(e,t,n){const{motionVector:r,scratchAtan2:i}=n(217),s=480,o=10/3;e.exports=class{constructor(){this.frameNumber=0,this.lastAnalyzedFrame=0,this.motionAmount=0,this.motionDirection=0,this.curr=null,this.prev=null,this._arrays=new ArrayBuffer(345600),this._curr=new Uint8ClampedArray(this._arrays,0,172800),this._prev=new Uint8ClampedArray(this._arrays,172800,172800)}reset(){this.frameNumber=0,this.lastAnalyzedFrame=0,this.motionAmount=this.motionDirection=0,this.prev=this.curr=null}addFrame(e){this.frameNumber++,this.prev=this.curr,this.curr=new Uint32Array(e.buffer.slice(0));const t=this._prev;this._prev=this._curr,this._curr=t;for(let e=0;e<this.curr.length;e++)this._curr[e]=255&this.curr[e]}analyzeFrame(){if(!this.curr||!this.prev)return void(this.motionAmount=this.motionDirection=-1);if(this.lastAnalyzedFrame===this.frameNumber)return;this.lastAnalyzedFrame=this.frameNumber;const{_curr:e,_prev:t}=this,n=17;let o=0,a=0,c=0;for(let i=9;i<351;i+=n)for(let l=9;l<471;l+=n){let u=0,h=0,d=0,p=0,f=0,m=(i-8)*s+l-8,g=m+n;const b=(i+8)*s+l+8;for(;m<=b;m+=463,g+=s)for(;m<=g;m+=1){const n=t[m]-e[m],r=e[m-1]-e[m+1],i=e[m-s]-e[m+s];u+=r*r,h+=r*i,d+=i*i,f+=r*n,p+=i*n}const{u:y,v:E}=r(u,h,d,f,p);-17<y&&y<n&&-17<E&&E<n&&(o+=y,a+=E,c++)}o/=c,a/=c,this.motionAmount=Math.round(100*Math.hypot(o,a)),this.motionAmount>10&&(this.motionDirection=i(a,o))}getLocalMotion(e,t){if(this.curr&&this.prev){if(t.motionFrameNumber!==this.frameNumber){const{_prev:n,_curr:a}=this;e.updateCPURenderAttributes();const c=e.getFastBounds(),l=Math.max(Math.floor(c.left+240),1),u=Math.min(Math.floor(c.right+240),479),h=Math.max(Math.floor(180-c.top),1),d=Math.min(Math.floor(180-c.bottom),359);let p=0,f=0,m=0,g=0,b=0,y=0;const E=[0,0,0];for(let t=h;t<d;t++)for(let r=l;r<u;r++)if(E[0]=r-240,E[1]=180-t,e.isTouching(E)){const e=t*s+r,i=n[e]-a[e],o=a[e-1]-a[e+1],c=a[e-s]-a[e+s];p+=o*o,f+=o*c,m+=c*c,b+=o*i,g+=c*i,y++}let{u:T,v:v}=r(p,f,m,b,g),A=0;y&&(A=y,y/=256,T/=y,v/=y),t.motionAmount=Math.round(.02*A*Math.hypot(T,v)),t.motionAmount>100&&(t.motionAmount=100),t.motionAmount>o&&(t.motionDirection=i(v,T)),t.motionFrameNumber=this.frameNumber}}else t.motionAmount=t.motionDirection=-1}}},function(e,t){const n=180/Math.PI,r={u:0,v:0},i=function(e){return(e+270)%360-180};e.exports={motionVector:function(e,t,n,i,s){let o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:r;const a=t*t-e*n;if(a){const r=-(s*t-i*n),c=-(t*i-e*s),l=8/a;o.u=r*l,o.v=c*l}else{const r=(t+e)*(t+e)+(n+t)*(n+t);if(r){const a=-(s+i)*(8/r);o.u=(t+e)*a,o.v=(n+t)*a}else o.u=0,o.v=0}return o},scratchDegrees:i,scratchAtan2:function(e,t){return i(Math.atan2(e,t)*n)}}},function(e,t,n){const r=n(3),i=n(2),s=n(1),o=n(5),a=n(7),c=n(219),l=n(16),u=n(4),h=n(40),d=n(0),p=129,f=130,m=131,g=225,b=32,y=96,E=0,T=128,v=2,A=175,w=163,S=179,k=148,O=1,I=0,N=152,R=157,x=0,M=0,C=1,P=50,D=0,L=32,B={29:"color",30:"ultrasonic",32:"gyro",16:"touch",8:"mediumMotor",7:"largeMotor",126:"none",125:"none"},U={touch:0,color:1,ultrasonic:1,none:0},F={touch:"button",color:"brightness",ultrasonic:"distance"};class j{constructor(e,t,n){this._parent=e,this._index=t,this._type=n,this._direction=1,this._power=50,this._position=0,this._commandID=null,this._coastDelay=1e3}get type(){return this._type}set type(e){this._type=e}get direction(){return this._direction}set direction(e){this._direction=e<0?-1:1}get power(){return this._power}set power(e){this._power=e}get position(){return this._position}set position(e){let t=e[0]+256*e[1]+256*e[2]*256+256*e[3]*256*256;t>2147483647&&(t-=4294967296),this._position=t}turnOnFor(e){if(0===this._power)return;const t=this._portMask(this._index);let n=e,r=this._power*this._direction;const i=P;let s=[];s[0]=A,r<0&&(r*=-1,n*=-1);const o=n<0?256-r:r;n=Math.abs(n);let a=i,c=i,l=n-2*i;l<0&&(a=Math.floor(n/2),l=0,c=n-a);const u=this._runValues(l);s=s.concat([x,t,p,255&o,p,a]).concat(u.concat([p,c,C]));const h=this._parent.generateCommand(T,s);this._parent.send(h),this.coastAfter(e)}coastAfter(e){if(0===this._power)return;const t=a();this._commandID=t,setTimeout((()=>{this._commandID===t&&(this.coast(),this._commandID=null)}),e+this._coastDelay)}coast(){if(0===this._power)return;const e=this._parent.generateCommand(T,[w,x,this._portMask(this._index),M]);this._parent.send(e,!1)}_runValues(e){return e<32767?[f,255&e,e>>8&255]:[m,255&e,e>>8&255,e>>16&255,e>>24&255]}_portMask(e){return Math.pow(2,e)}}class z{constructor(e,t){this._runtime=e,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=t,this._sensorPorts=[],this._motorPorts=[],this._sensors={distance:0,brightness:0,buttons:[0,0,0,0]},this._motors=[null,null,null,null],this._pollingInterval=150,this._pollingIntervalID=null,this._pollingCounter=0,this._bt=null,this._runtime.registerPeripheralExtension(t,this),this._rateLimiter=new h(40),this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this),this._pollValues=this._pollValues.bind(this)}get distance(){let e=this._sensors.distance>100?100:this._sensors.distance;return e=e<0?0:e,e=Math.round(100*e)/100,e}get brightness(){return this._sensors.brightness}motor(e){return this._motors[e]}isButtonPressed(e){return 1===this._sensors.buttons[e]}beep(e,t){const n=this.generateCommand(T,[k,O,p,2,f,e,e>>8,f,t,t>>8]);this.send(n)}stopAll(){this.stopAllMotors(),this.stopSound()}stopSound(){const e=this.generateCommand(T,[k,I]);this.send(e,!1)}stopAllMotors(){this._motors.forEach((e=>{e&&e.coast()}))}scan(){this._bt&&this._bt.disconnect(),this._bt=new c(this._runtime,this._extensionId,{majorDeviceClass:8,minorDeviceClass:1},this._onConnect,this.reset,this._onMessage)}connect(e){this._bt&&this._bt.connectPeripheral(e,"1234")}disconnect(){this._bt&&this._bt.disconnect(),this.reset()}reset(){this._sensorPorts=[],this._motorPorts=[],this._sensors={distance:0,brightness:0,buttons:[0,0,0,0]},this._motors=[null,null,null,null],this._pollingIntervalID&&(window.clearInterval(this._pollingIntervalID),this._pollingIntervalID=null)}isConnected(){let e=!1;return this._bt&&(e=this._bt.isConnected()),e}send(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.isConnected()?t&&!this._rateLimiter.okayToSend()?Promise.resolve():this._bt.sendMessage({message:l.uint8ArrayToBase64(e),encoding:"base64"}):Promise.resolve()}generateCommand(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[];r[2]=0,r[3]=0,r[4]=e,r[5]=255&n,r[6]=n>>8&&255,r=r.concat(t);const i=r.length-2;return r[0]=255&i,r[1]=i>>8&&255,r}_onConnect(){this._pollingIntervalID=window.setInterval(this._pollValues,this._pollingInterval)}_pollValues(){if(!this.isConnected())return void window.clearInterval(this._pollingIntervalID);const e=[];let t=0,n=0;if(this._pollingCounter%20==0)e[0]=N,e[1]=p,e[2]=L,e[3]=y,e[4]=g,e[5]=b,t=33,this._updateDevices=!0;else{let r=0;for(let t=0;t<4;t++)"none"!==this._sensorPorts[t]&&(e[r+0]=R,e[r+1]=x,e[r+2]=t,e[r+3]=D,e[r+4]=U[this._sensorPorts[t]],e[r+5]=g,e[r+6]=4*n,r+=7),n++;for(let t=0;t<4;t++)e[r+0]=S,e[r+1]=x,e[r+2]=t,e[r+3]=g,e[r+4]=4*n,r+=5,n++;t=4*n}const r=this.generateCommand(E,e,t);this.send(r),this._pollingCounter++}_onMessage(e){const t=e.message,n=l.base64ToUint8Array(t);if(n[4]===v)if(this._updateDevices){for(let e=0;e<4;e++){const t=B[n[e+5]];this._sensorPorts[e]=t||"none"}for(let e=0;e<4;e++){const t=B[n[e+21]];this._motorPorts[e]=t||"none"}for(let e=0;e<4;e++){const t=this._motorPorts[e];"none"===t||this._motors[e]||(this._motors[e]=new j(this,e,t)),"none"===t&&this._motors[e]&&(this._motors[e]=null)}this._updateDevices=!1}else if(!this._sensorPorts.includes(void 0)&&!this._motorPorts.includes(void 0)){let e=5;for(let t=0;t<4;t++){const r=new Uint8Array([n[e],n[e+1],n[e+2],n[e+3]]).buffer,i=new DataView(r).getFloat32(0,!0);"button"===F[this._sensorPorts[t]]?this._sensors.buttons[t]=i||0:F[this._sensorPorts[t]]&&(this._sensors[F[this._sensorPorts[t]]]=i||0),e+=4}for(let t=0;t<4;t++){const r=[n[e],n[e+1],n[e+2],n[e+3]];this._motors[t]&&(this._motors[t].position=r),e+=4}}}}const G=["A","B","C","D"],V=["1","2","3","4"];class _{static get EXTENSION_ID(){return"ev3"}constructor(e){this.runtime=e,this._peripheral=new z(this.runtime,_.EXTENSION_ID),this._playNoteForPicker=this._playNoteForPicker.bind(this),this.runtime.on("PLAY_NOTE",this._playNoteForPicker)}getInfo(){return{id:_.EXTENSION_ID,name:"LEGO EV3",blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDQwIDQwIj48dGl0bGU+ZXYzLWJsb2NrLWljb248L3RpdGxlPjxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0ibm9uemVybyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNS41IDMuNSkiPjxyZWN0IHdpZHRoPSIyOCIgaGVpZ2h0PSIyNS44MSIgeD0iLjUiIHk9IjMuNTkiIGZpbGw9IiNmZmYiIHN0cm9rZT0iIzdjODdhNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiByeD0iMSIvPjxyZWN0IHdpZHRoPSIyNCIgaGVpZ2h0PSIzMiIgeD0iMi41IiB5PSIuNSIgZmlsbD0iI2U2ZTdlOCIgc3Ryb2tlPSIjN2M4N2E1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHJ4PSIxIi8+PHBhdGggZmlsbD0iI2ZmZiIgc3Ryb2tlPSIjN2M4N2E1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik0yLjUgMTQuNWgyNHYxM2gtMjR6Ii8+PHBhdGggZmlsbD0iI2U2ZTdlOCIgc3Ryb2tlPSIjN2M4N2E1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik0xNC41IDEwLjV2NCIvPjxyZWN0IHdpZHRoPSIyMCIgaGVpZ2h0PSIxMCIgeD0iNC41IiB5PSIyLjUiIGZpbGw9IiM0MTQ3NTciIHJ4PSIxIi8+PHJlY3Qgd2lkdGg9IjIiIGhlaWdodD0iMiIgeD0iMTMuNSIgeT0iMjAuMTMiIGZpbGw9IiM3Yzg3YTUiIG9wYWNpdHk9Ii41IiByeD0iLjUiLz48cGF0aCBmaWxsPSIjN2M4N2E1IiBkPSJNOS4wNiAyMC4xM2gxLjVhLjUuNSAwIDAgMSAuNS41djFhLjUuNSAwIDAgMS0uNS41aC0xLjVhMSAxIDAgMCAxIDAtMk0xOS45MyAyMi4xM2gtMS41MWEuNS41IDAgMCAxLS41LS41di0xYS41LjUgMCAwIDEgLjUtLjVoMS41YTEgMSAwIDAgMSAuMDEgMk04LjIzIDE3LjVINWEuNS41IDAgMCAxLS41LS41di0yLjVoNmwtMS44NSAyLjc4YS41MS41MSAwIDAgMS0uNDIuMjJNMTguMTUgMTguODVsLS41LjVhLjUuNSAwIDAgMC0uMTUuMzZWMjBhLjUuNSAwIDAgMS0uNS41aC0uNWEuNS41IDAgMCAxLS41LS41LjUuNSAwIDAgMC0uNS0uNWgtMmEuNS41IDAgMCAwLS41LjUuNS41IDAgMCAxLS41LjVIMTJhLjUuNSAwIDAgMS0uNS0uNXYtLjI5YS41LjUgMCAwIDAtLjE1LS4zNmwtLjUtLjVhLjUxLjUxIDAgMCAxIDAtLjcxbDEuNTEtMS40OWEuNDcuNDcgMCAwIDEgLjM1LS4xNWgzLjU4YS40Ny40NyAwIDAgMSAuMzUuMTVsMS41MSAxLjQ5YS41MS41MSAwIDAgMSAwIC43MU0xMC44NSAyMy40NWwuNS0uNWEuNS41IDAgMCAwIC4xNS0uMzZ2LS4yOWEuNS41IDAgMCAxIC41LS41aC41YS41LjUgMCAwIDEgLjUuNS41LjUgMCAwIDAgLjUuNWgyYS41LjUgMCAwIDAgLjUtLjUuNS41IDAgMCAxIC41LS41aC41YS41LjUgMCAwIDEgLjUuNXYuMjlhLjUuNSAwIDAgMCAuMTUuMzZsLjUuNWEuNS41IDAgMCAxIDAgLjdsLTEuNTEgMS41YS40Ny40NyAwIDAgMS0uMzUuMTVoLTMuNThhLjQ3LjQ3IDAgMCAxLS4zNS0uMTVsLTEuNTEtMS41YS41LjUgMCAwIDEgMC0uNyIgb3BhY2l0eT0iLjUiLz48cGF0aCBmaWxsPSIjZjE1YTI5IiBzdHJva2U9IiNjYzRjMjMiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgZD0iTTIxLjUgMjcuNWg1djRhMSAxIDAgMCAxLTEgMWgtNHoiLz48L2c+PC9zdmc+",showStatusButton:!0,blocks:[{opcode:"motorTurnClockwise",text:o({id:"ev3.motorTurnClockwise",default:"motor [PORT] turn this way for [TIME] seconds",description:"turn a motor clockwise for some time"}),blockType:i.COMMAND,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0},TIME:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorTurnCounterClockwise",text:o({id:"ev3.motorTurnCounterClockwise",default:"motor [PORT] turn that way for [TIME] seconds",description:"turn a motor counter-clockwise for some time"}),blockType:i.COMMAND,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0},TIME:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorSetPower",text:o({id:"ev3.motorSetPower",default:"motor [PORT] set power [POWER] %",description:"set a motor's power to some value"}),blockType:i.COMMAND,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0},POWER:{type:r.NUMBER,defaultValue:100}}},{opcode:"getMotorPosition",text:o({id:"ev3.getMotorPosition",default:"motor [PORT] position",description:"get the measured degrees a motor has turned"}),blockType:i.REPORTER,arguments:{PORT:{type:r.STRING,menu:"motorPorts",defaultValue:0}}},{opcode:"whenButtonPressed",text:o({id:"ev3.whenButtonPressed",default:"when button [PORT] pressed",description:"when a button connected to a port is pressed"}),blockType:i.HAT,arguments:{PORT:{type:r.STRING,menu:"sensorPorts",defaultValue:0}}},{opcode:"whenDistanceLessThan",text:o({id:"ev3.whenDistanceLessThan",default:"when distance < [DISTANCE]",description:"when the value measured by the distance sensor is less than some value"}),blockType:i.HAT,arguments:{DISTANCE:{type:r.NUMBER,defaultValue:5}}},{opcode:"whenBrightnessLessThan",text:o({id:"ev3.whenBrightnessLessThan",default:"when brightness < [DISTANCE]",description:"when value measured by brightness sensor is less than some value"}),blockType:i.HAT,arguments:{DISTANCE:{type:r.NUMBER,defaultValue:50}}},{opcode:"buttonPressed",text:o({id:"ev3.buttonPressed",default:"button [PORT] pressed?",description:"is a button on some port pressed?"}),blockType:i.BOOLEAN,arguments:{PORT:{type:r.STRING,menu:"sensorPorts",defaultValue:0}}},{opcode:"getDistance",text:o({id:"ev3.getDistance",default:"distance",description:"gets measured distance"}),blockType:i.REPORTER},{opcode:"getBrightness",text:o({id:"ev3.getBrightness",default:"brightness",description:"gets measured brightness"}),blockType:i.REPORTER},{opcode:"beep",text:o({id:"ev3.beepNote",default:"beep note [NOTE] for [TIME] secs",description:"play some note on EV3 for some time"}),blockType:i.COMMAND,arguments:{NOTE:{type:r.NOTE,defaultValue:60},TIME:{type:r.NUMBER,defaultValue:.5}}}],menus:{motorPorts:{acceptReporters:!0,items:this._formatMenu(G)},sensorPorts:{acceptReporters:!0,items:this._formatMenu(V)}}}}motorTurnClockwise(e){const t=s.toNumber(e.PORT);let n=1e3*s.toNumber(e.TIME);return n=u.clamp(n,0,15e3),new Promise((e=>{this._forEachMotor(t,(e=>{const t=this._peripheral.motor(e);t&&(t.direction=1,t.turnOnFor(n))})),setTimeout(e,n)}))}motorTurnCounterClockwise(e){const t=s.toNumber(e.PORT);let n=1e3*s.toNumber(e.TIME);return n=u.clamp(n,0,15e3),new Promise((e=>{this._forEachMotor(t,(e=>{const t=this._peripheral.motor(e);t&&(t.direction=-1,t.turnOnFor(n))})),setTimeout(e,n)}))}motorSetPower(e){const t=s.toNumber(e.PORT),n=u.clamp(s.toNumber(e.POWER),0,100);this._forEachMotor(t,(e=>{const t=this._peripheral.motor(e);t&&(t.power=n)}))}getMotorPosition(e){const t=s.toNumber(e.PORT);if(![0,1,2,3].includes(t))return;const n=this._peripheral.motor(t);let r=0;return n&&(r=u.wrapClamp(n.position,0,360)),r}whenButtonPressed(e){const t=s.toNumber(e.PORT);if([0,1,2,3].includes(t))return this._peripheral.isButtonPressed(t)}whenDistanceLessThan(e){const t=u.clamp(s.toNumber(e.DISTANCE),0,100);return this._peripheral.distance<t}whenBrightnessLessThan(e){const t=u.clamp(s.toNumber(e.DISTANCE),0,100);return this._peripheral.brightness<t}buttonPressed(e){const t=s.toNumber(e.PORT);if([0,1,2,3].includes(t))return this._peripheral.isButtonPressed(t)}getDistance(){return this._peripheral.distance}getBrightness(){return this._peripheral.brightness}_playNoteForPicker(e,t){t===this.getInfo().name&&this.beep({NOTE:e,TIME:.25})}beep(e){const t=u.clamp(s.toNumber(e.NOTE),47,99);let n=1e3*s.toNumber(e.TIME);if(n=u.clamp(n,0,3e3),0!==n)return new Promise((e=>{const r=440*Math.pow(2,(t-69+12)/12);this._peripheral.beep(r,n),setTimeout(e,n)}))}_forEachMotor(e,t){let n;switch(e){case 0:n=[0];break;case 1:n=[1];break;case 2:n=[2];break;case 3:n=[3];break;default:d.warn("Invalid motor ID: ".concat(e)),n=[]}for(const e of n)t(e)}_formatMenu(e){const t=[];for(let n=0;n<e.length;n++){const r={};r.text=e[n],r.value=n.toString(),t.push(r)}return t}}e.exports=_},function(e,t,n){const r=n(60);e.exports=class extends r{constructor(e,t,n,r){let i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,s=arguments.length>5?arguments[5]:void 0;super(),this._socket=e.getScratchLinkSocket("BT"),this._socket.setOnOpen(this.requestPeripheral.bind(this)),this._socket.setOnError(this._handleRequestError.bind(this)),this._socket.setOnClose(this.handleDisconnectError.bind(this)),this._socket.setHandleMessage(this._handleMessage.bind(this)),this._sendMessage=this._socket.sendMessage.bind(this._socket),this._availablePeripherals={},this._connectCallback=r,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=i,this._discoverTimeoutID=null,this._extensionId=t,this._peripheralOptions=n,this._messageCallback=s,this._runtime=e,this._socket.open()}requestPeripheral(){this._availablePeripherals={},this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._discoverTimeoutID=window.setTimeout(this._handleDiscoverTimeout.bind(this),15e3),this.sendRemoteRequest("discover",this._peripheralOptions).catch((e=>this._handleRequestError(e)))}connectPeripheral(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const n={peripheralId:e};t&&(n.pin=t),this.sendRemoteRequest("connect",n).then((()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()})).catch((e=>{this._handleRequestError(e)}))}disconnect(){this._connected&&(this._connected=!1),this._socket.isOpen()&&this._socket.close(),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_DISCONNECTED)}isConnected(){return this._connected}sendMessage(e){return this.sendRemoteRequest("send",e).catch((e=>{this.handleDisconnectError(e)}))}didReceiveCall(e,t){switch(e){case"didDiscoverPeripheral":this._availablePeripherals[t.peripheralId]=t,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[t.peripheralId]=t,this._runtime.emit(this._runtime.constructor.USER_PICKED_PERIPHERAL,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidNotPickPeripheral":this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"didReceiveMessage":this._messageCallback(t);break;default:return"nah"}}handleDisconnectError(){this._connected&&(this.disconnect(),this._resetCallback&&this._resetCallback(),this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTION_LOST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId}))}_handleRequestError(){this._runtime.emit(this._runtime.constructor.PERIPHERAL_REQUEST_ERROR,{message:"Scratch lost connection to",extensionId:this._extensionId})}_handleDiscoverTimeout(){this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID),this._runtime.emit(this._runtime.constructor.PERIPHERAL_SCAN_TIMEOUT)}}},function(e,t,n){const r=n(5),i=n(3),s=n(2),o=n(1),a="SPACE",c="LEFT",l="RIGHT",u="UP",h="DOWN",d={[a]:"space",[c]:"left arrow",[u]:"up arrow",[l]:"right arrow",[h]:"down arrow"};e.exports=class{constructor(e){this.runtime=e,this.frameToggle=!1,setInterval((()=>{this.frameToggle=!this.frameToggle}),this.runtime.currentStepTime),this.keyPressed=this.keyPressed.bind(this),this.runtime.on("KEY_PRESSED",this.keyPressed),this._clearkeyPressBuffer=this._clearkeyPressBuffer.bind(this),this.runtime.on("PROJECT_STOP_ALL",this._clearkeyPressBuffer),this.sequences={},this.keyPressBuffer=[]}get KEY_TEXT_SHORT(){return{[a]:r({id:"makeymakey.spaceKey",default:"space",description:"The space key on a computer keyboard."}),[c]:r({id:"makeymakey.leftArrowShort",default:"left",description:"Short name for the left arrow key on a computer keyboard."}),[u]:r({id:"makeymakey.upArrowShort",default:"up",description:"Short name for the up arrow key on a computer keyboard."}),[l]:r({id:"makeymakey.rightArrowShort",default:"right",description:"Short name for the right arrow key on a computer keyboard."}),[h]:r({id:"makeymakey.downArrowShort",default:"down",description:"Short name for the down arrow key on a computer keyboard."})}}get DEFAULT_SEQUENCES(){return["".concat(c," ").concat(u," ").concat(l),"".concat(l," ").concat(u," ").concat(c),"".concat(c," ").concat(l),"".concat(l," ").concat(c),"".concat(u," ").concat(h),"".concat(h," ").concat(u),"".concat(u," ").concat(l," ").concat(h," ").concat(c),"".concat(u," ").concat(c," ").concat(h," ").concat(l),"".concat(u," ").concat(u," ").concat(h," ").concat(h," ")+"".concat(c," ").concat(l," ").concat(c," ").concat(l)]}getInfo(){return{id:"makeymakey",name:"Makey Makey",blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHN0eWxlPi5zdDJ7ZmlsbDpyZWR9LnN0M3tmaWxsOiNlMGUwZTB9LnN0NHtmaWxsOm5vbmU7c3Ryb2tlOiM2NjY7c3Ryb2tlLXdpZHRoOi41O3N0cm9rZS1taXRlcmxpbWl0OjEwfTwvc3R5bGU+PHBhdGggaWQ9IkxheWVyXzYiIGZpbGw9IiNmZmYiIGQ9Ik0zNSAyOEg1YTEgMSAwIDAgMS0xLTFWMTJjMC0uNi40LTEgMS0xaDMwYy41IDAgMSAuNCAxIDF2MTVjMCAuNS0uNSAxLTEgMSIvPjxnIGlkPSJMYXllcl80Ij48cGF0aCBkPSJNNCAyNWgzMnYyLjdINHptOS0xaC0yLjJhMSAxIDAgMCAxLTEtMXYtOS43YzAtLjYuNC0xIDEtMUgxM2MuNiAwIDEgLjQgMSAxVjIzYzAgLjYtLjUgMS0xIDEiIGNsYXNzPSJzdDIiLz48cGF0aCBkPSJNNi4xIDE5LjN2LTIuMmMwLS41LjQtMSAxLTFoOS43Yy41IDAgMSAuNSAxIDF2Mi4yYzAgLjUtLjUgMS0xIDFINy4xYTEgMSAwIDAgMS0xLTEiIGNsYXNzPSJzdDIiLz48Y2lyY2xlIGN4PSIyMi44IiBjeT0iMTguMiIgcj0iMy40IiBjbGFzcz0ic3QyIi8+PGNpcmNsZSBjeD0iMzAuNiIgY3k9IjE4LjIiIHI9IjMuNCIgY2xhc3M9InN0MiIvPjxwYXRoIGQ9Ik00LjIgMjdoMzEuOXYuN0g0LjJ6IiBjbGFzcz0ic3QyIi8+PC9nPjxnIGlkPSJMYXllcl81Ij48Y2lyY2xlIGN4PSIyMi44IiBjeT0iMTguMiIgcj0iMi4zIiBjbGFzcz0ic3QzIi8+PGNpcmNsZSBjeD0iMzAuNiIgY3k9IjE4LjIiIHI9IjIuMyIgY2xhc3M9InN0MyIvPjxwYXRoIGQ9Ik0xMi41IDIyLjloLTEuMmMtLjMgMC0uNS0uMi0uNS0uNVYxNGMwLS4zLjItLjUuNS0uNWgxLjJjLjMgMCAuNS4yLjUuNXY4LjRjMCAuMy0uMi41LS41LjUiIGNsYXNzPSJzdDMiLz48cGF0aCBkPSJNNy4yIDE4Ljd2LTEuMmMwLS4zLjItLjUuNS0uNWg4LjRjLjMgMCAuNS4yLjUuNXYxLjJjMCAuMy0uMi41LS41LjVINy43Yy0uMyAwLS41LS4yLS41LS41TTQgMjZoMzJ2Mkg0eiIgY2xhc3M9InN0MyIvPjwvZz48ZyBpZD0iTGF5ZXJfMyI+PHBhdGggZD0iTTM1LjIgMjcuOUg0LjhhMSAxIDAgMCAxLTEtMVYxMi4xYzAtLjYuNS0xIDEtMWgzMC41Yy41IDAgMSAuNCAxIDFWMjdhMSAxIDAgMCAxLTEuMS45eiIgY2xhc3M9InN0NCIvPjxwYXRoIGQ9Ik0zNS4yIDI3LjlINC44YTEgMSAwIDAgMS0xLTFWMTIuMWMwLS42LjUtMSAxLTFoMzAuNWMuNSAwIDEgLjQgMSAxVjI3YTEgMSAwIDAgMS0xLjEuOXoiIGNsYXNzPSJzdDQiLz48L2c+PC9zdmc+",blocks:[{opcode:"whenMakeyKeyPressed",text:r({id:"makeymakey.whenKeyPressed",default:"when [KEY] key pressed",description:"when a keyboard key is pressed"}),blockType:s.HAT,arguments:{KEY:{type:i.STRING,menu:"KEY",defaultValue:a}}},{opcode:"whenCodePressed",text:r({id:"makeymakey.whenKeysPressedInOrder",default:"when [SEQUENCE] pressed in order",description:"when a sequence of keyboard keys is pressed in a specific order"}),blockType:s.HAT,arguments:{SEQUENCE:{type:i.STRING,menu:"SEQUENCE",defaultValue:this.DEFAULT_SEQUENCES[0]}}}],menus:{KEY:{acceptReporters:!0,items:[{text:r({id:"makeymakey.spaceKey",default:"space",description:"The space key on a computer keyboard."}),value:a},{text:r({id:"makeymakey.upArrow",default:"up arrow",description:"The up arrow key on a computer keyboard."}),value:u},{text:r({id:"makeymakey.downArrow",default:"down arrow",description:"The down arrow key on a computer keyboard."}),value:h},{text:r({id:"makeymakey.rightArrow",default:"right arrow",description:"The right arrow key on a computer keyboard."}),value:l},{text:r({id:"makeymakey.leftArrow",default:"left arrow",description:"The left arrow key on a computer keyboard."}),value:c},{text:"w",value:"w"},{text:"a",value:"a"},{text:"s",value:"s"},{text:"d",value:"d"},{text:"f",value:"f"},{text:"g",value:"g"}]},SEQUENCE:{acceptReporters:!0,items:this.buildSequenceMenu(this.DEFAULT_SEQUENCES)}}}}buildSequenceMenu(e){return e.map((e=>this.getMenuItemForSequenceString(e)))}getMenuItemForSequenceString(e){let t=e.split(" ");return t=t.map((e=>this.KEY_TEXT_SHORT[e])),{text:t.join(" "),value:e}}whenMakeyKeyPressed(e,t){let n=e.KEY;d[e.KEY]&&(n=d[e.KEY]);return t.ioQuery("keyboard","getKeyIsDown",[n])&&this.frameToggle}keyPressed(e){e=(e=e.split(" ")[0]).toUpperCase(),this.keyPressBuffer.push(e),this.keyPressBuffer.length>100&&this.keyPressBuffer.shift();for(const e in this.sequences){const t=this.sequences[e].array;if(this.keyPressBuffer.length<t.length)continue;let n=!1;const r=this.keyPressBuffer.slice(-1*t.length);for(let e=0;e<t.length;e++)t[e]!==r[e]&&(n=!0);n||(this.sequences[e].completed=!0,setTimeout((()=>{this.sequences[e].completed=!1}),100))}}_clearkeyPressBuffer(){this.keyPressBuffer=[]}addSequence(e,t){Object.prototype.hasOwnProperty.call(this.sequences,e)||(this.sequences[e]={array:t,completed:!1})}whenCodePressed(e){const t=o.toString(e.SEQUENCE).toUpperCase(),n=t.split(" ");if(!(n.length<2))return this.addSequence(t,n),this.sequences[t].completed}}},function(e,t,n){const r=n(3),i=n(2),s=n(1),o=n(5),a=n(23),c=n(30),l=n(16),u=n(4),h=n(40),d=n(0),p="00001623-1212-efde-1623-785feabcd123",f="00001624-1212-efde-1623-785feabcd123",m=100,g=20,b=20,y=21,E=23,T=37,v=38,A=39,w=40,S=1,k=2,O=4,I={A:55,B:56,C:1,D:2},N={A:0,B:1,C:2,D:3};let R=N;const x="any",M="none",C="red",P="blue",D="green",L="yellow",B="white",U="black",F={[M]:255,[C]:9,[P]:3,[D]:5,[L]:7,[B]:10,[U]:0},j={HUB_PROPERTIES:1,HUB_ACTIONS:2,HUB_ALERTS:3,HUB_ATTACHED_IO:4,ERROR:5,PORT_INPUT_FORMAT_SETUP_SINGLE:65,PORT_INPUT_FORMAT_SETUP_COMBINED:66,PORT_INFORMATION:67,PORT_MODEINFORMATION:68,PORT_VALUE:69,PORT_VALUE_COMBINED:70,PORT_INPUT_FORMAT:71,PORT_INPUT_FORMAT_COMBINED:72,OUTPUT:129,PORT_FEEDBACK:130},z=3,G=5,V=1,_=7,Y=11,H=81,W=16,K=1,X=0,Z=127,q=0,Q=1,J=0,$=0,ee=1,te=0,ne=2,re=0,ie=0,se=1,oe=2,ae=3,ce=function(e){const t=new ArrayBuffer(4),n=new DataView(t);return n.setInt32(0,e),[n.getInt8(3),n.getInt8(2),n.getInt8(1),n.getInt8(0)]},le=function(e){const t=Uint8Array.from(e);return new DataView(t.buffer).getInt32(0,!0)};class ue{constructor(e,t){this._parent=e,this._index=t,this._direction=1,this._power=50,this._position=0,this._status=ie,this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null,this._pendingRotationDestination=null,this._pendingRotationPromise=null,this.turnOff=this.turnOff.bind(this)}get direction(){return this._direction}set direction(e){this._direction=e<0?-1:1}get power(){return this._power}set power(e){this._power=0===e?0:u.scale(e,1,100,10,100)}get position(){return this._position}set position(e){this._position=e}get status(){return this._status}set status(e){this._clearRotationState(),this._clearDurationTimeout(),this._status=e}get pendingDurationTimeoutStartTime(){return this._pendingDurationTimeoutStartTime}get pendingDurationTimeoutDelay(){return this._pendingDurationTimeoutDelay}get pendingRotationDestination(){return this._pendingRotationDestination}get pendingRotationPromise(){return this._pendingRotationPromise}set pendingRotationPromise(e){this._pendingRotationPromise=e}_turnOn(){const e=this._parent.generateOutputCommand(this._index,W,_,[this.power*this.direction,u.clamp(this.power+10,0,100),q]);this._parent.send(f,e)}turnOnForever(){this.status=se,this._turnOn()}turnOnFor(e){e=Math.max(0,e),this.status=oe,this._turnOn(),this._setNewDurationTimeout(this.turnOff,e)}turnOnForDegrees(e,t){e=Math.max(0,e);const n=this._parent.generateOutputCommand(this._index,W^K,Y,[...ce(e),this.power*this.direction*t,u.clamp(this.power+10,0,100),Z,q]);this.status=ae,this._pendingRotationDestination=this.position+e*this.direction*t,this._parent.send(f,n)}turnOff(){let e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const t=this._parent.generateOutputCommand(this._index,W,V,[X]);this.status=ie,this._parent.send(f,t,e)}_clearDurationTimeout(){null!==this._pendingDurationTimeoutId&&(clearTimeout(this._pendingDurationTimeoutId),this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null)}_setNewDurationTimeout(e,t){this._clearDurationTimeout();const n=setTimeout((()=>{this._pendingDurationTimeoutId===n&&(this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null),e()}),t);this._pendingDurationTimeoutId=n,this._pendingDurationTimeoutStartTime=Date.now(),this._pendingDurationTimeoutDelay=t}_clearRotationState(){null!==this._pendingRotationPromise&&(this._pendingRotationPromise(),this._pendingRotationPromise=null),this._pendingRotationDestination=null}}class he{constructor(e,t){this._runtime=e,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=t,this._ports=[],this._motors=[],this._sensors={tiltX:0,tiltY:0,color:M,previousColor:M},this._colorSamples=[],this._ble=null,this._runtime.registerPeripheralExtension(t,this),this._rateLimiter=new h(g),this._pingDeviceId=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this),this._onMessage=this._onMessage.bind(this),this._pingDevice=this._pingDevice.bind(this)}get tiltX(){return this._sensors.tiltX}get tiltY(){return this._sensors.tiltY}get color(){return this._sensors.color}get previousColor(){return this._sensors.previousColor}boostColorForIndex(e){return Object.keys(F).find((t=>F[t]===e))||M}motor(e){return this._motors[e]}stopAllMotors(){this._motors.forEach((e=>{e&&e.turnOff(!1)}))}setLED(e){const t=[e>>16&255,e>>8&255,255&e],n=this.generateOutputCommand(this._ports.indexOf(E),W^K,H,[ee,...t]);return this.send(f,n)}setLEDMode(){const e=this.generateInputCommand(this._ports.indexOf(E),ee,0,!1);return this.send(f,e)}stopAll(){this.isConnected()&&this.stopAllMotors()}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{services:[p],manufacturerData:{919:{dataPrefix:[0,64],mask:[0,255]}}}],optionalServices:[]},this._onConnect,this.reset)}connect(e){this._ble&&this._ble.connectPeripheral(e)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._ports=[],this._motors=[],this._sensors={tiltX:0,tiltY:0,color:M,previousColor:M},this._pingDeviceId&&(window.clearInterval(this._pingDeviceId),this._pingDeviceId=null)}isConnected(){let e=!1;return this._ble&&(e=this._ble.isConnected()),e}send(e,t){let n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.isConnected()?n&&!this._rateLimiter.okayToSend()?Promise.resolve():this._ble.write(p,e,l.uint8ArrayToBase64(t),"base64"):Promise.resolve()}generateOutputCommand(e,t,n,r){const i=[0,j.OUTPUT,e,t,n,...r];return i.unshift(i.length+1),i}generateInputCommand(e,t,n,r){const i=[0,j.PORT_INPUT_FORMAT_SETUP_SINGLE,e,t].concat(ce(n)).concat([r]);return i.unshift(i.length+1),i}_onConnect(){this._ble.startNotifications(p,f,this._onMessage),this._pingDeviceId=window.setInterval(this._pingDevice,5e3),setTimeout((()=>{const e=[0,j.HUB_PROPERTIES,z,G];e.unshift(e.length+1),this.send(f,e,!1)}),500)}_onMessage(e){const t=l.base64ToUint8Array(e),n=t[2],r=t[3];switch(n){case j.HUB_PROPERTIES:switch(t[3]){case z:{const e=le([36,2,0,16]);le(t.slice(5,t.length))<e?(R=I,d.info("Move Hub firmware older than version 1.0.00.0224 detected. Using old port mapping.")):R=N;break}}break;case j.HUB_ATTACHED_IO:{const e=t[4],n=t[5];switch(e){case Q:this._registerSensorOrMotor(r,n);break;case J:this._clearPort(r)}break}case j.PORT_VALUE:{const e=this._ports[r];switch(e){case w:this._sensors.tiltX=t[4],this._sensors.tiltY=t[5];break;case T:this._colorSamples.unshift(t[4]),this._colorSamples.length>5?(this._colorSamples.pop(),this._colorSamples.every(((e,t,n)=>e===n[0]))?(this._sensors.previousColor=this._sensors.color,this._sensors.color=this.boostColorForIndex(this._colorSamples[0])):this._sensors.color=M):this._sensors.color=M;break;case v:case A:this.motor(r).position=le(t.slice(4,8));break;case y:case b:case E:break;default:d.warn("Unknown sensor value! Type: ".concat(e))}break}case j.PORT_FEEDBACK:{const e=t[4],n=this.motor(r);if(n){!(e&S)&&e&(k^O)&&n.status===ae&&(n.status=ie)}break}case j.ERROR:d.warn("Error reported by hub: ".concat(t))}}_pingDevice(){this._ble.read(p,f,!1)}_registerSensorOrMotor(e,t){this._ports[e]=t,t!==A&&t!==v||(this._motors[e]=new ue(this,e));let n=null,r=1;switch(t){case A:case v:n=ne;break;case T:n=te,r=0;break;case E:n=ee,this.setLEDMode(),this.setLED(255);break;case w:n=$;break;default:n=re}const i=this.generateInputCommand(e,n,r,!0);this.send(f,i)}_clearPort(e){const t=this._ports[e];t===w&&(this._sensors.tiltX=this._sensors.tiltY=0),t===T&&(this._sensors.color=M),this._ports[e]="none",this._motors[e]=null}}const de="A",pe="B",fe="C",me="D",ge="AB",be="ABCD",ye="this way",Ee="that way",Te="reverse",ve="up",Ae="down",we="left",Se="right",ke="any";class Oe{static get EXTENSION_ID(){return"boost"}static get TILT_THRESHOLD(){return 15}constructor(e){this.runtime=e,this._peripheral=new he(this.runtime,Oe.EXTENSION_ID)}getInfo(){return{id:Oe.EXTENSION_ID,name:"BOOST",blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACpQTFRF////6+zskJmy3+Hk6N/b+YZO/2Ya6dfO9/j5vsPSlZ62////fIel5ufo1AuBvgAAAAF0Uk5TAEDm2GYAAADNSURBVHja7dfRDoMgDIXhuQmbpbz/645JsspKOiM1u9j5E7gw8YtCSPSCEEII/VlE/aEjskeJ2LEXya6tYDLK79KOfgWm5AhOOU91HgftbJCoN46C+yJvkJ3XEKAJ6ujhBYo4BOaPblcRh0ERvUARh8A5xBhmQ2TW51uffQFDLIXciM0p1meaWCdgXLv3xfZ2eebvYO5VCWGMVVWvbIML89KA9cpmVptig1xqwHplMwso+YJuryy5bIpjZ4HZrZNA19w/OPE3gBBCCB3vCQkmeCf31OYLAAAAAElFTkSuQmCC",showStatusButton:!0,blocks:[{opcode:"motorOnFor",text:o({id:"boost.motorOnFor",default:"turn motor [MOTOR_ID] for [DURATION] seconds",description:"turn a motor on for some time"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:de},DURATION:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorOnForRotation",text:o({id:"boost.motorOnForRotation",default:"turn motor [MOTOR_ID] for [ROTATION] rotations",description:"turn a motor on for rotation"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:de},ROTATION:{type:r.NUMBER,defaultValue:1}}},{opcode:"motorOn",text:o({id:"boost.motorOn",default:"turn motor [MOTOR_ID] on",description:"turn a motor on indefinitely"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:de}}},{opcode:"motorOff",text:o({id:"boost.motorOff",default:"turn motor [MOTOR_ID] off",description:"turn a motor off"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:de}}},{opcode:"setMotorPower",text:o({id:"boost.setMotorPower",default:"set motor [MOTOR_ID] speed to [POWER] %",description:"set the motor's speed without turning it on"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:be},POWER:{type:r.NUMBER,defaultValue:100}}},{opcode:"setMotorDirection",text:o({id:"boost.setMotorDirection",default:"set motor [MOTOR_ID] direction [MOTOR_DIRECTION]",description:"set the motor's turn direction without turning it on"}),blockType:i.COMMAND,arguments:{MOTOR_ID:{type:r.STRING,menu:"MOTOR_ID",defaultValue:de},MOTOR_DIRECTION:{type:r.STRING,menu:"MOTOR_DIRECTION",defaultValue:ye}}},{opcode:"getMotorPosition",text:o({id:"boost.getMotorPosition",default:"motor [MOTOR_REPORTER_ID] position",description:"the position returned by the motor"}),blockType:i.REPORTER,arguments:{MOTOR_REPORTER_ID:{type:r.STRING,menu:"MOTOR_REPORTER_ID",defaultValue:de}}},{opcode:"whenColor",text:o({id:"boost.whenColor",default:"when [COLOR] brick seen",description:"check for when color"}),blockType:i.HAT,arguments:{COLOR:{type:r.STRING,menu:"COLOR",defaultValue:x}}},{opcode:"seeingColor",text:o({id:"boost.seeingColor",default:"seeing [COLOR] brick?",description:"is the color sensor seeing a certain color?"}),blockType:i.BOOLEAN,arguments:{COLOR:{type:r.STRING,menu:"COLOR",defaultValue:x}}},{opcode:"whenTilted",text:o({id:"boost.whenTilted",default:"when tilted [TILT_DIRECTION_ANY]",description:"check when tilted in a certain direction"}),func:"isTilted",blockType:i.HAT,arguments:{TILT_DIRECTION_ANY:{type:r.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:ke}}},{opcode:"getTiltAngle",text:o({id:"boost.getTiltAngle",default:"tilt angle [TILT_DIRECTION]",description:"the angle returned by the tilt sensor"}),blockType:i.REPORTER,arguments:{TILT_DIRECTION:{type:r.STRING,menu:"TILT_DIRECTION",defaultValue:ve}}},{opcode:"setLightHue",text:o({id:"boost.setLightHue",default:"set light color to [HUE]",description:"set the LED color"}),blockType:i.COMMAND,arguments:{HUE:{type:r.NUMBER,defaultValue:50}}}],menus:{MOTOR_ID:{acceptReporters:!0,items:[{text:"A",value:de},{text:"B",value:pe},{text:"C",value:fe},{text:"D",value:me},{text:"AB",value:ge},{text:"ABCD",value:be}]},MOTOR_REPORTER_ID:{acceptReporters:!0,items:[{text:"A",value:de},{text:"B",value:pe},{text:"C",value:fe},{text:"D",value:me}]},MOTOR_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"boost.motorDirection.forward",default:"this way",description:"label for forward element in motor direction menu for LEGO Boost extension"}),value:ye},{text:o({id:"boost.motorDirection.backward",default:"that way",description:"label for backward element in motor direction menu for LEGO Boost extension"}),value:Ee},{text:o({id:"boost.motorDirection.reverse",default:"reverse",description:"label for reverse element in motor direction menu for LEGO Boost extension"}),value:Te}]},TILT_DIRECTION:{acceptReporters:!0,items:[{text:o({id:"boost.tiltDirection.up",default:"up",description:"label for up element in tilt direction menu for LEGO Boost extension"}),value:ve},{text:o({id:"boost.tiltDirection.down",default:"down",description:"label for down element in tilt direction menu for LEGO Boost extension"}),value:Ae},{text:o({id:"boost.tiltDirection.left",default:"left",description:"label for left element in tilt direction menu for LEGO Boost extension"}),value:we},{text:o({id:"boost.tiltDirection.right",default:"right",description:"label for right element in tilt direction menu for LEGO Boost extension"}),value:Se}]},TILT_DIRECTION_ANY:{acceptReporters:!0,items:[{text:o({id:"boost.tiltDirection.up",default:"up"}),value:ve},{text:o({id:"boost.tiltDirection.down",default:"down"}),value:Ae},{text:o({id:"boost.tiltDirection.left",default:"left"}),value:we},{text:o({id:"boost.tiltDirection.right",default:"right"}),value:Se},{text:o({id:"boost.tiltDirection.any",default:"any",description:"label for any element in tilt direction menu for LEGO Boost extension"}),value:ke}]},COLOR:{acceptReporters:!0,items:[{text:o({id:"boost.color.red",default:"red",description:"the color red"}),value:C},{text:o({id:"boost.color.blue",default:"blue",description:"the color blue"}),value:P},{text:o({id:"boost.color.green",default:"green",description:"the color green"}),value:D},{text:o({id:"boost.color.yellow",default:"yellow",description:"the color yellow"}),value:L},{text:o({id:"boost.color.white",default:"white",desription:"the color white"}),value:B},{text:o({id:"boost.color.black",default:"black",description:"the color black"}),value:U},{text:o({id:"boost.color.any",default:"any color",description:"any color"}),value:x}]}}}}motorOnFor(e){let t=1e3*s.toNumber(e.DURATION);return t=u.clamp(t,0,15e3),new Promise((n=>{this._forEachMotor(e.MOTOR_ID,(e=>{const n=this._peripheral.motor(e);n&&n.turnOnFor(t)})),setTimeout(n,t)}))}motorOnForRotation(e){let t=360*s.toNumber(e.ROTATION);const n=Math.sign(t);t=Math.abs(u.clamp(t,-36e4,36e4));const r=[];this._forEachMotor(e.MOTOR_ID,(e=>{r.push(e)}));const i=r.map((e=>{const r=this._peripheral.motor(e);return r?0===r.power?Promise.resolve():new Promise((e=>{r.turnOnForDegrees(t,n),r.pendingRotationPromise=e})):null}));return Promise.all(i).then((()=>{}))}motorOn(e){return this._forEachMotor(e.MOTOR_ID,(e=>{const t=this._peripheral.motor(e);t&&t.turnOnForever()})),new Promise((e=>{window.setTimeout((()=>{e()}),m)}))}motorOff(e){return this._forEachMotor(e.MOTOR_ID,(e=>{const t=this._peripheral.motor(e);t&&t.turnOff()})),new Promise((e=>{window.setTimeout((()=>{e()}),m)}))}setMotorPower(e){return this._forEachMotor(e.MOTOR_ID,(t=>{const n=this._peripheral.motor(t);if(n)switch(n.power=u.clamp(s.toNumber(e.POWER),0,100),n.status){case se:n.turnOnForever();break;case oe:n.turnOnFor(n.pendingDurationTimeoutStartTime+n.pendingDurationTimeoutDelay-Date.now())}})),new Promise((e=>{window.setTimeout((()=>{e()}),m)}))}setMotorDirection(e){return this._forEachMotor(e.MOTOR_ID,(t=>{const n=this._peripheral.motor(t);if(n){switch(e.MOTOR_DIRECTION){case ye:n.direction=1;break;case Ee:n.direction=-1;break;case Te:n.direction=-n.direction;break;default:d.warn("Unknown motor direction in setMotorDirection: ".concat(e.DIRECTION))}if(n)switch(n.status){case se:n.turnOnForever();break;case oe:n.turnOnFor(n.pendingDurationTimeoutStartTime+n.pendingDurationTimeoutDelay-Date.now())}}})),new Promise((e=>{window.setTimeout((()=>{e()}),m)}))}getMotorPosition(e){let t=null;switch(e.MOTOR_REPORTER_ID){case de:t=R.A;break;case pe:t=R.B;break;case fe:t=R.C;break;case me:t=R.D;break;default:return d.warn("Asked for a motor position that doesnt exist!"),!1}if(null!==t&&this._peripheral.motor(t)){let e=this._peripheral.motor(t).position;return t===R.A&&(e*=-1),u.wrapClamp(e,0,360)}return 0}_forEachMotor(e,t){let n;switch(e){case de:n=[R.A];break;case pe:n=[R.B];break;case fe:n=[R.C];break;case me:n=[R.D];break;case ge:n=[R.A,R.B];break;case be:n=[R.A,R.B,R.C,R.D];break;default:d.warn("Invalid motor ID: ".concat(e)),n=[]}for(const e of n)t(e)}whenTilted(e){return this._isTilted(e.TILT_DIRECTION_ANY)}isTilted(e){return this._isTilted(e.TILT_DIRECTION_ANY)}getTiltAngle(e){return this._getTiltAngle(e.TILT_DIRECTION)}_isTilted(e){return e===ke?Math.abs(this._peripheral.tiltX)>=Oe.TILT_THRESHOLD||Math.abs(this._peripheral.tiltY)>=Oe.TILT_THRESHOLD:this._getTiltAngle(e)>=Oe.TILT_THRESHOLD}_getTiltAngle(e){switch(e){case ve:return this._peripheral.tiltY>90?256-this._peripheral.tiltY:-this._peripheral.tiltY;case Ae:return this._peripheral.tiltY>90?this._peripheral.tiltY-256:this._peripheral.tiltY;case we:return this._peripheral.tiltX>90?this._peripheral.tiltX-256:this._peripheral.tiltX;case Se:return this._peripheral.tiltX>90?256-this._peripheral.tiltX:-this._peripheral.tiltX;default:d.warn("Unknown tilt direction in _getTiltAngle: ".concat(e))}}whenColor(e){return e.COLOR===x?this._peripheral.color!==M&&this._peripheral.color!==this._peripheral.previousColor:e.COLOR===this._peripheral.color}seeingColor(e){return e.COLOR===x?this._peripheral.color!==M:e.COLOR===this._peripheral.color}setLightHue(e){let t=s.toNumber(e.HUE);t=u.wrapClamp(t,0,100);const n=360*t/100,r=a.hsvToRgb({h:n,s:1,v:1}),i=a.rgbToDecimal(r);return this._peripheral._led=t,this._peripheral.setLED(i),new Promise((e=>{window.setTimeout((()=>{e()}),m)}))}}e.exports=Oe},function(e,t,n){const r=n(3),i=n(2),s=n(0),o=n(5),a=n(4),c=n(30),l=n(223),u=n(224),h={service:"d91714ef-28b9-4f91-ba16-f0d9a604f112",commandChar:"f4bf14a6-c7d5-4b6d-8aa8-df1a7c83adcb",responseChar:"b41e6675-a329-40e0-aa01-44d2f444babe"},d="Force and Acceleration extension stopped receiving data",p=1,f=2,m=3,g=4,b=5,y=6,E=7;class T{constructor(e,t){this._runtime=e,this._ble=null,this._device=null,this._runtime.registerPeripheralExtension(t,this),this._extensionId=t,this._sensors={force:0,accelerationX:0,accelerationY:0,accelerationZ:0,spinSpeedX:0,spinSpeedY:0,spinSpeedZ:0},this._timeoutID=null,this.reset=this.reset.bind(this),this._onConnect=this._onConnect.bind(this)}scan(){this._ble&&this._ble.disconnect(),this._ble=new c(this._runtime,this._extensionId,{filters:[{namePrefix:"GDX-FOR"}],optionalServices:[h.service]},this._onConnect,this.reset)}connect(e){this._ble&&this._ble.connectPeripheral(e)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._sensors={force:0,accelerationX:0,accelerationY:0,accelerationZ:0,spinSpeedX:0,spinSpeedY:0,spinSpeedZ:0},this._timeoutID&&(window.clearInterval(this._timeoutID),this._timeoutID=null)}isConnected(){let e=!1;return this._ble&&(e=this._ble.isConnected()),e}_onConnect(){const e=new u(this._ble,h);l.createDevice(e,{open:!0,startMeasurements:!1}).then((e=>{this._device=e,this._device.keepValues=!1,this._device.sensors.forEach((e=>{e.setEnabled(!0)})),this._device.on("measurements-started",(()=>{this._device.sensors.filter((e=>e.enabled)).forEach((e=>{e.on("value-changed",(e=>{this._onSensorValueChanged(e)}))})),this._timeoutID=window.setInterval((()=>this._ble.handleDisconnectError(d)),4500)})),this._device.start(80)}))}_onSensorValueChanged(e){switch(e.number){case p:this._sensors.force=a.clamp(2*e.value,-100,100);break;case f:this._sensors.accelerationX=e.value;break;case m:this._sensors.accelerationY=e.value;break;case g:this._sensors.accelerationZ=e.value;break;case b:this._sensors.spinSpeedX=this._spinSpeedFromGyro(e.value);break;case y:this._sensors.spinSpeedY=this._spinSpeedFromGyro(e.value);break;case E:this._sensors.spinSpeedZ=this._spinSpeedFromGyro(e.value)}window.clearInterval(this._timeoutID),this._timeoutID=window.setInterval((()=>this._ble.handleDisconnectError(d)),4500)}_spinSpeedFromGyro(e){const t=1e3/this._runtime.currentStepTime;return e=a.radToDeg(e),e/=t,e*=-1}getForce(){return this._sensors.force}getTiltFrontBack(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.getAccelerationX(),n=this.getAccelerationY(),r=this.getAccelerationZ();let i=n*n+r*r;return i=Math.sqrt(i),i<.35?i=t<0?90:-90:(i=t/i,i=Math.atan(i),i=-1*a.radToDeg(i)),e&&(i*=-1),i}getTiltLeftRight(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const t=this.getAccelerationX(),n=this.getAccelerationY(),r=this.getAccelerationZ();let i=t*t+r*r;return i=Math.sqrt(i),i<.35?i=n<0?90:-90:(i=n/i,i=Math.atan(i),i=-1*a.radToDeg(i)),e&&(i*=-1),i}getAccelerationX(){return this._sensors.accelerationX}getAccelerationY(){return this._sensors.accelerationY}getAccelerationZ(){return this._sensors.accelerationZ}getSpinSpeedX(){return this._sensors.spinSpeedX}getSpinSpeedY(){return this._sensors.spinSpeedY}getSpinSpeedZ(){return this._sensors.spinSpeedZ}}const v="pushed",A="pulled",w="shaken",S="started falling",k="turned face up",O="turned face down",I="front",N="back",R="left",x="right",M="any",C="x",P="y",D="z";class L{static get EXTENSION_NAME(){return"Force and Acceleration"}static get EXTENSION_ID(){return"gdxfor"}get AXIS_MENU(){return[{text:"x",value:C},{text:"y",value:P},{text:"z",value:D}]}get TILT_MENU(){return[{text:o({id:"gdxfor.tiltDirectionMenu.front",default:"front",description:"label for front element in tilt direction picker for gdxfor extension"}),value:I},{text:o({id:"gdxfor.tiltDirectionMenu.back",default:"back",description:"label for back element in tilt direction picker for gdxfor extension"}),value:N},{text:o({id:"gdxfor.tiltDirectionMenu.left",default:"left",description:"label for left element in tilt direction picker for gdxfor extension"}),value:R},{text:o({id:"gdxfor.tiltDirectionMenu.right",default:"right",description:"label for right element in tilt direction picker for gdxfor extension"}),value:x}]}get TILT_MENU_ANY(){return[...this.TILT_MENU,{text:o({id:"gdxfor.tiltDirectionMenu.any",default:"any",description:"label for any direction element in tilt direction picker for gdxfor extension"}),value:M}]}get PUSH_PULL_MENU(){return[{text:o({id:"gdxfor.pushed",default:"pushed",description:"the force sensor was pushed inward"}),value:v},{text:o({id:"gdxfor.pulled",default:"pulled",description:"the force sensor was pulled outward"}),value:A}]}get GESTURE_MENU(){return[{text:o({id:"gdxfor.shaken",default:"shaken",description:"the sensor was shaken"}),value:w},{text:o({id:"gdxfor.startedFalling",default:"started falling",description:"the sensor started free falling"}),value:S},{text:o({id:"gdxfor.turnedFaceUp",default:"turned face up",description:"the sensor was turned to face up"}),value:k},{text:o({id:"gdxfor.turnedFaceDown",default:"turned face down",description:"the sensor was turned to face down"}),value:O}]}constructor(e){this.runtime=e,this._peripheral=new T(this.runtime,L.EXTENSION_ID)}getInfo(){return{id:L.EXTENSION_ID,name:L.EXTENSION_NAME,blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABGdBTUEAALGPC/xhBQAABVNJREFUeNrtnH9MG1UcwMuIiWMaE7c5ptkUhyQaEzWLi8aE+BfRPxbjEowxipMlisxlTFAY9JAQoNfyG/wRGQyH9uj6AyiFzblRuohzxCmYjZ9tZaNlEGPUaNTEQZ/vW97Zs/bWwsKul3y/ySe8e+8Vvvn0vXv3jvY0NxJlHzuSSnihi9MJC1qdkagJyBlyr64+tUGjVGh5ow2SUTMgUTGBnE6YFxMp1XeSysYuUtnUHddAjpCrdCQqJlAiTypRFfKkEpUWKE1MFbA3On4EwrtbwRJSA2yWxJdAaUIv28fjEkm+KBAFytFziexvGyTv1neREr2JFBtM5J2GbpJL67K6LqLA65FtukAK622y566iWmtgn+kbFBiJV63f09F2PBD8Hbzwp1YvVJXXdj1S1ujYrtV1chxv/APaoM9e8wgKDCe/uS/4WipqrqCj43/bq+IGYQtt/4lC8pt6UaCUfaYL4q5gSfeBPVUjExUVnds4nXEJ+mabv0OBIrlHXeLom4n+N4Vp6Jv7yVkUKHKg5cyyQL3xTNT9t15wQt/9bU4UKPLmsS/Za4Xp6HeAhPHgCGzHEfgv2ce/JWz1/ZsQkqCRiUxCEmmfa7QvvAYFSimqsSxv9HnTQdnpy3cWQJ/CGguuwuEcODLAFhLBIy9Q8EKft1qdKDCcvZYRmMIBLW8MwDWfJiwqK21boR14zTqKAiNR0GQXR2FbhMXjKG2DPriVkyPn2JC4Gv+qCQuog7acjiEUKMcr3RdJicEU3A+XGUwZGhZQhrpi2kb7oMDrcfCjz9kljfE3rc78TGnNZ88ul43QhrezYrkrc7jGHByFUqCOtqHA2FbkUXLowxPksMEEQBnq8I403tJHgeoRWNhnJ64vngegjAJXQk7vV+R35x2EDGoAKEMdCoyV2v73QZwUqEOBsVLgOEGWBhNEeVCGOhS4Eo6cLCc/OzcDUF7d5ZB1lLz+6dfBOz35zQ5chWOV9XaTA/79CblIQYEyI0tWFscL5D2DiZTVmEl5vVU1AhUZWeGyKiJ8TlE9ApWXBahW4JpOw4qGaLLUL1BhWeoXqKAs9QuMLqtOVhYKZMexyEKBcgLZ8YrQNVtWAwoEZvsfhP3uqnDbd6JAr+NRsuhMXBVjPU+hQDwHosCbK3Cm72E4f60Jk/ZdKPBGmOh5AqcwTmEUiALx665RgFzjSiAkxOkFNX3hGnKOH4GiPE4FX/mHHFnOyguUPu6kVC+o56ET0tnCC/OKCYRHhkASaqZUJ1gVEwgP3uGqBAs8/kSND97heMFyyGxer1FnyJ9Tr84vRERs12CgQBSIAlEgBgpcC4HyoMAYdjb90eRxvNCHpqJHKiXth5nLozB1W1raXoBjyj2UBNQTPe4GYUPnzlWBwMtXfBMZGRk7UWLskQSykpOTHxJHIf05IpF4FyqKHltBVlZW1pNXZn3TINHt8bigjnErKgrFOjaqdlDup2xiddskEn0g8dTp0wVM4BbUxoLJSwtjo1SizWZ7AwROuT0DrP0+1LYcCeKq6/Z6z46PT3YzQSms/RY43r1nz+Mg0Ofz/8jaU1FdSGAa4PPP/UIlBdLT0x9jdUmU26Gcl5f3NAikU9nN2nagulCkgBS3x+sESQMDg0VwLOX8+WEDtF0aG7Owuu2oLRSbQUp7e/tLIMk/d/Uvp8vFZWZm7oIFhF4P6mj9NcpidV3dbibwTtQWikQ2JdOGh4drYRpTSBiLIFVyflyH2v4bt4EcoLW19cXJqamTs/65BXrO809MTvc2NjY+B22M9agrcmxg14FpMqSgvNim8yZ2nfcA417Kxnictv8ABNVN4ivCsdYAAAAASUVORK5CYII=",menuIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAAppJREFUeNrtmF1r01AYx6OI4CfQG2+88BMIXnjhy5V3XoikHZq+bCsKszChsS9Lk5WONFnbbSKIm5frSdLVrhWldm4qEzoVX5CpeCFeidsnENGZs/OEhcFaxtYl67noA394esp5+uuTf05ODrNdSGrx2JBcwK4pg1ZTqnGGaTeSMkoLqrYmqjoeuTPrqEhNADSTCkJtAw4pmijlilhUNMe7l8qXsEhqCxk0vGdA0MCDBXy1+tUJkVrPsVV3vwCvVb7gwXs1M67qZkw1zPDUvEkVYDQ7YyYyaE1SSqekseIF4q2//NisSQVgsPje8hSJA/a8fL5xBMYCpY+dB+xDb3B81Pi9dW5CNf4FjA+dB+TKyzhBvBcfR0fteZAnFM2E76jw4K27j82kvLmeQQ5j1NwkIfQax1Xjjz0PchijBpArfwYfmmKmkBPkwn24QWCMGkBQUH+HAQzUq73d2ULdfZJs0WL9EohOwOuPGvj/i4MgyOnsoPJkEtQ07n/4CYeml/DNqQUcmahaPhVHjf0HbIapwCKOE7Bdy1p1rG3WMMmTqu44YFsw6fFy02ZVyrkAGJ6c24CZ3w0MyH1AMWuAbzZgZraD6QigXazljz1DfvzKuNJSddTbecB6oQ+/1L0tVZsOdQ5wDgXxos7uSE8L/V1AG7BduQzo/Hsx1HQAUEZIUHXXThbg1ELIaCNtA6Zz2nH4t24Kzn8YtwOsUKk18K+VVUvV2tKuLl0XkHpAQUVnm7wla+cY2sLD8SmPn5cYWsPri15muciyJEmHqASEAySPj6+STuoMrUG6d9jji3z3+qMXqYFiOX6AdC5sfyb5BIEcpAawh+PPE8hvPcHoCbY/dpL48IcnEDvN0BTQMdYXWSH6yfpu33Cq7jqUK06WtbQJQQAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"whenGesture",text:o({id:"gdxfor.whenGesture",default:"when [GESTURE]",description:"when the sensor detects a gesture"}),blockType:i.HAT,arguments:{GESTURE:{type:r.STRING,menu:"gestureOptions",defaultValue:w}}},{opcode:"whenForcePushedOrPulled",text:o({id:"gdxfor.whenForcePushedOrPulled",default:"when force sensor [PUSH_PULL]",description:"when the force sensor is pushed or pulled"}),blockType:i.HAT,arguments:{PUSH_PULL:{type:r.STRING,menu:"pushPullOptions",defaultValue:v}}},{opcode:"getForce",text:o({id:"gdxfor.getForce",default:"force",description:"gets force"}),blockType:i.REPORTER},"---",{opcode:"whenTilted",text:o({id:"gdxfor.whenTilted",default:"when tilted [TILT]",description:"when the sensor detects tilt"}),blockType:i.HAT,arguments:{TILT:{type:r.STRING,menu:"tiltAnyOptions",defaultValue:M}}},{opcode:"isTilted",text:o({id:"gdxfor.isTilted",default:"tilted [TILT]?",description:"is the device tilted?"}),blockType:i.BOOLEAN,arguments:{TILT:{type:r.STRING,menu:"tiltAnyOptions",defaultValue:M}}},{opcode:"getTilt",text:o({id:"gdxfor.getTilt",default:"tilt angle [TILT]",description:"gets tilt"}),blockType:i.REPORTER,arguments:{TILT:{type:r.STRING,menu:"tiltOptions",defaultValue:I}}},"---",{opcode:"isFreeFalling",text:o({id:"gdxfor.isFreeFalling",default:"falling?",description:"is the device in free fall?"}),blockType:i.BOOLEAN},{opcode:"getSpinSpeed",text:o({id:"gdxfor.getSpin",default:"spin speed [DIRECTION]",description:"gets spin speed"}),blockType:i.REPORTER,arguments:{DIRECTION:{type:r.STRING,menu:"axisOptions",defaultValue:D}}},{opcode:"getAcceleration",text:o({id:"gdxfor.getAcceleration",default:"acceleration [DIRECTION]",description:"gets acceleration"}),blockType:i.REPORTER,arguments:{DIRECTION:{type:r.STRING,menu:"axisOptions",defaultValue:C}}}],menus:{pushPullOptions:{acceptReporters:!0,items:this.PUSH_PULL_MENU},gestureOptions:{acceptReporters:!0,items:this.GESTURE_MENU},axisOptions:{acceptReporters:!0,items:this.AXIS_MENU},tiltOptions:{acceptReporters:!0,items:this.TILT_MENU},tiltAnyOptions:{acceptReporters:!0,items:this.TILT_MENU_ANY}}}}whenForcePushedOrPulled(e){switch(e.PUSH_PULL){case v:return this._peripheral.getForce()<-5;case A:return this._peripheral.getForce()>5;default:return s.warn("unknown push/pull value in whenForcePushedOrPulled: ".concat(e.PUSH_PULL)),!1}}getForce(){return Math.round(this._peripheral.getForce())}whenGesture(e){switch(e.GESTURE){case w:return this.gestureMagnitude()>30;case S:return this.isFreeFalling();case k:return this._isFacing(k);case O:return this._isFacing(O);default:return s.warn("unknown gesture value in whenGesture: ".concat(e.GESTURE)),!1}}_isFacing(e){void 0===this._facingUp&&(this._facingUp=!1),void 0===this._facingDown&&(this._facingDown=!1);let t=9;switch((this._facingUp||this._facingDown)&&(t-=5),this._facingUp=this._peripheral.getAccelerationZ()>t,this._facingDown=this._peripheral.getAccelerationZ()<-1*t,e){case k:return this._facingUp;case O:return this._facingDown;default:return!1}}whenTilted(e){return this._isTilted(e.TILT)}isTilted(e){return this._isTilted(e.TILT)}getTilt(e){return this._getTiltAngle(e.TILT)}_isTilted(e){return e===M?this._getTiltAngle(I)>15||this._getTiltAngle(N)>15||this._getTiltAngle(R)>15||this._getTiltAngle(x)>15:this._getTiltAngle(e)>15}_getTiltAngle(e){if(!this._peripheral.isConnected())return 0;switch(e){case I:return Math.round(this._peripheral.getTiltFrontBack(!0));case N:return Math.round(this._peripheral.getTiltFrontBack(!1));case R:return Math.round(this._peripheral.getTiltLeftRight(!0));case x:return Math.round(this._peripheral.getTiltLeftRight(!1));default:s.warn("Unknown direction in getTilt: ".concat(e))}}getSpinSpeed(e){switch(e.DIRECTION){case C:return Math.round(this._peripheral.getSpinSpeedX());case P:return Math.round(this._peripheral.getSpinSpeedY());case D:return Math.round(this._peripheral.getSpinSpeedZ());default:s.warn("Unknown direction in getSpinSpeed: ".concat(e.DIRECTION))}}getAcceleration(e){switch(e.DIRECTION){case C:return Math.round(this._peripheral.getAccelerationX());case P:return Math.round(this._peripheral.getAccelerationY());case D:return Math.round(this._peripheral.getAccelerationZ());default:s.warn("Unknown direction in getAcceleration: ".concat(e.DIRECTION))}}magnitude(e,t,n){return Math.sqrt(e*e+t*t+n*n)}accelMagnitude(){return this.magnitude(this._peripheral.getAccelerationX(),this._peripheral.getAccelerationY(),this._peripheral.getAccelerationZ())}gestureMagnitude(){return this.accelMagnitude()-9.8}spinMagnitude(){return this.magnitude(this._peripheral.getSpinSpeedX(),this._peripheral.getSpinSpeedY(),this._peripheral.getSpinSpeedZ())}isFreeFalling(){if(!this._peripheral.isConnected())return!1;return this.accelMagnitude()<.5+.3*this.spinMagnitude()}}e.exports=L},function(e,t,n){e.exports=function(){"use strict";function t(e,t,n,r,i,s,o){try{var a=e[s](o),c=a.value}catch(e){return void n(e)}a.done?t(c):Promise.resolve(c).then(r,i)}function r(e){return function(){var n=this,r=arguments;return new Promise((function(i,s){var o=e.apply(n,r);function a(e){t(o,i,s,a,c,"next",e)}function c(e){t(o,i,s,a,c,"throw",e)}a(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),e}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&l(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function l(e,t){return(l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}!function(t){var n,r=Object.prototype,i=r.hasOwnProperty,s="function"==typeof Symbol?Symbol:{},o=s.iterator||"@@iterator",a=s.asyncIterator||"@@asyncIterator",c=s.toStringTag||"@@toStringTag",l="object"==typeof e,u=t.regeneratorRuntime;if(u)l&&(e.exports=u);else{(u=t.regeneratorRuntime=l?e.exports:{}).wrap=T;var h="suspendedStart",d="suspendedYield",p="executing",f="completed",m={},g={};g[o]=function(){return this};var b=Object.getPrototypeOf,y=b&&b(b(M([])));y&&y!==r&&i.call(y,o)&&(g=y);var E=S.prototype=A.prototype=Object.create(g);w.prototype=E.constructor=S,S.constructor=w,S[c]=w.displayName="GeneratorFunction",u.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},u.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,S):(e.__proto__=S,c in e||(e[c]="GeneratorFunction")),e.prototype=Object.create(E),e},u.awrap=function(e){return{__await:e}},k(O.prototype),O.prototype[a]=function(){return this},u.AsyncIterator=O,u.async=function(e,t,n,r){var i=new O(T(e,t,n,r));return u.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},k(E),E[c]="Generator",E[o]=function(){return this},E.toString=function(){return"[object Generator]"},u.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},u.values=M,x.prototype={constructor:x,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(R),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=n)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(r,i){return a.type="throw",a.arg=e,t.next=r,i&&(t.method="next",t.arg=n),!!i}for(var s=this.tryEntries.length-1;s>=0;--s){var o=this.tryEntries[s],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var c=i.call(o,"catchLoc"),l=i.call(o,"finallyLoc");if(c&&l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(c){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var s=r;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var o=s?s.completion:{};return o.type=e,o.arg=t,s?(this.method="next",this.next=s.finallyLoc,m):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),R(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;R(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:M(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=n),m}}}function T(e,t,n,r){var i=t&&t.prototype instanceof A?t:A,s=Object.create(i.prototype),o=new x(r||[]);return s._invoke=function(e,t,n){var r=h;return function(i,s){if(r===p)throw new Error("Generator is already running");if(r===f){if("throw"===i)throw s;return C()}for(n.method=i,n.arg=s;;){var o=n.delegate;if(o){var a=I(o,n);if(a){if(a===m)continue;return a}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(r===h)throw r=f,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r=p;var c=v(e,t,n);if("normal"===c.type){if(r=n.done?f:d,c.arg===m)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(r=f,n.method="throw",n.arg=c.arg)}}}(e,n,o),s}function v(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function A(){}function w(){}function S(){}function k(e){["next","throw","return"].forEach((function(t){e[t]=function(e){return this._invoke(t,e)}}))}function O(e){var t;this._invoke=function(n,r){function s(){return new Promise((function(t,s){!function t(n,r,s,o){var a=v(e[n],e,r);if("throw"!==a.type){var c=a.arg,l=c.value;return l&&"object"==typeof l&&i.call(l,"__await")?Promise.resolve(l.__await).then((function(e){t("next",e,s,o)}),(function(e){t("throw",e,s,o)})):Promise.resolve(l).then((function(e){c.value=e,s(c)}),(function(e){return t("throw",e,s,o)}))}o(a.arg)}(n,r,t,s)}))}return t=t?t.then(s,s):s()}}function I(e,t){var r=e.iterator[t.method];if(r===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=n,I(e,t),"throw"===t.method))return m;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return m}var i=v(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,m;var s=i.arg;return s?s.done?(t[e.resultName]=s.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=n),t.delegate=null,m):s:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function R(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function x(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function M(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,s=function t(){for(;++r<e.length;)if(i.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=n,t.done=!0,t};return s.next=s}}return{next:C}}function C(){return{value:n,done:!0}}}(function(){return this||"object"==typeof self&&self}()||Function("return this")());var h=new Uint8Array([88,0,0,0]),d=new Uint8Array([26,165,74,6,73,7,72,8,71,9,70,10,69,11,68,12,67,13,66,14,65]),p=new Uint8Array([24,255,1,0,0,0,0,0,0,0,0,0,0,0,0]),f=new Uint8Array([25,255,0,255,255,255,255]),m=new Uint8Array([27,255,0,0,0,0,0,0,0,0,0]),g={HEADER:h,INIT:d,DISCONNECT:new Uint8Array([84]),START_MEASUREMENTS:p,STOP_MEASUREMENTS:f,SET_MEASUREMENT_PERIOD:m,GET_INFO:new Uint8Array([85]),GET_STATUS:new Uint8Array([16]),GET_SENSOR_IDS:new Uint8Array([81]),GET_SENSOR_INFO:new Uint8Array([80,0]),GET_DEFAULT_SENSORS_MASK:new Uint8Array([86])},b=6,y=7,E=10,T=8,v=9,A=11,w=12,S=13,k=14,O=32,I=function(e){return 0!==e},N=function(){function e(){i(this,e),this._listenerMap=new Map}return o(e,[{key:"on",value:function(e,t){this._listenerMap.has(e)||this._listenerMap.set(e,[]),this._listenerMap.get(e).push(t)}},{key:"off",value:function(e,t){var n=this._listenerMap.get(e);if(n&&n.length){var r=n.reduce((function(e,n,r){return"function"==typeof n&&n===t?e=r:e}),-1);if(r>-1)return n.splice(r,1),this._listenerMap.set(e,n),!0}return!1}},{key:"unbind",value:function(){this._listenerMap.clear()}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];var i=this._listenerMap.get(e);return!(!i||!i.length||(i.forEach((function(e){e.apply(void 0,n)})),0))}}]),e}(),R=function(){},x=function(){};function M(e){return Array.from(new Uint8Array(e)).map((function(e){return e.toString(16).padStart(2,"0")})).join(" ")}var C,P=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.type=t.type,this.mode=t.mode,this.minValue=t.minValue,this.maxValue=t.maxValue,this.uncertainty=t.uncertainty,this.minPeriod=t.minPeriod,this.maxPeriod=t.maxPeriod,this.typicalPeriod=t.typicalPeriod,this.granularity=t.granularity},D=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e),this.number=t.number,this.name=t.name,this.unit=t.unit,this.id=t.id,this.mutalExclusionMask=t.mutalExclusionMask,this.measurementInfo=t.measurementInfo},L=function(){function e(t){var n;return i(this,e),(n=u(this,c(e).call(this))).number=t.number,n.name=t.name,n.unit=t.unit,n.specs=t,n.enabled=!1,n.values=[],n.value=null,n}return a(e,N),o(e,[{key:"clear",value:function(){this.value=null,this.values=[]}},{key:"setValue",value:function(e,t){this.value=e,t&&this.values.push(this.value),this.emit("value-changed",this)}},{key:"setEnabled",value:function(e){this.enabled!==e&&(this.enabled=e,this.emit("state-changed",this))}}]),e}(),B=function(){function e(t){var r;if(i(this,e),r=u(this,c(e).call(this)),"undefined"==typeof TextDecoder){var s=n(21);C=s.TextDecoder}else C=TextDecoder;return r.device=t,r.sensors=[],r.opened=!1,r.rollingCounter=0,r.collecting=!1,r.measurementPeriod=10,r.response=null,r.remainingResponseLength=0,r.defaultSensorsMask=0,r.keepValues=!0,r.minMeasurementPeriod=10,r.serialNumber="",r.orderCode="",r.name="",r}return a(e,N),o(e,[{key:"getBatteryLevel",value:function(){var e=r(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStatus();case 2:return t=e.sent,e.abrupt("return",t.battery);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"getChargingState",value:function(){var e=r(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._getStatus();case 2:return t=e.sent,e.abrupt("return",t.chargingStatus);case 4:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"open",value:function(){var e=r(regeneratorRuntime.mark((function e(){var t,n=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=n.length>0&&void 0!==n[0]&&n[0],e.prev=1,e.next=4,this._connect();case 4:return e.next=6,this._init();case 6:return e.next=8,this._getStatus();case 8:return e.next=10,this._getDeviceInfo();case 10:return e.next=12,this._getDefaultSensorsMask();case 12:return e.next=14,this._getAvailableSensors();case 14:this._onOpened(),t&&this.start(),e.next=21;break;case 18:e.prev=18,e.t0=e.catch(1),console.error(e.t0);case 21:case"end":return e.stop()}}),e,this,[[1,18]])})));return function(){return e.apply(this,arguments)}}()},{key:"close",value:function(){var e=r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._stopMeasurements();case 2:return e.next=4,this._sendCommand(g.DISCONNECT);case 4:return e.abrupt("return",this._disconnect());case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"enableDefaultSensors",value:function(){for(var e=1,t=0;t<32;++t){if((this.defaultSensorsMask&e)===e){var n=this.getSensor(t);n&&n.setEnabled(!0)}e<<=1}}},{key:"start",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=this.sensors.filter((function(e){return e.enabled}));0===t.length&&(this.enableDefaultSensors(),t=this.sensors.filter((function(e){return e.enabled}))),t.forEach((function(e){return e.clear()})),e&&(this.measurementPeriod=e),this._startMeasurements()}},{key:"stop",value:function(){this._stopMeasurements()}},{key:"getSensor",value:function(e){return this.sensors.find((function(t){return t.number===e}))}},{key:"_connect",value:function(){var e=r(regeneratorRuntime.mark((function e(){var t=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.device.setup({onClosed:function(){return t._onClosed()},onResponse:function(e){return t._handleResponse(e)}}));case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_disconnect",value:function(){var e=r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.device.close());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_init",value:function(){return this.collecting=!1,this.rollingCounter=255,this.writeQueue=[],this._sendCommand(g.INIT)}},{key:"_handleResponse",value:function(e){if(R("command notified: ".concat(M(e.buffer))),this.remainingResponseLegnth>0){if(this.remainingResponseLegnth-=e.buffer.byteLength,this.response=new DataView((t=this.response.buffer,n=e.buffer.slice(0),(r=new Uint8Array(t.byteLength+n.byteLength)).set(new Uint8Array(t),0),r.set(new Uint8Array(n),t.byteLength),r.buffer)),this.remainingResponseLegnth>0)return}else this.response=e;var t,n,r,i=this.response.getUint8(1);if(i>this.response.buffer.byteLength)this.remainingResponseLegnth=i-this.response.buffer.byteLength;else if(R("handle command: ".concat(M(this.response.buffer))),this.response.getUint8(0)===O)this._processMeasurements(this.response);else{var s=this.response.getUint8(4),o=this.response.getUint8(5),a=new DataView(this.response.buffer,6);this._resolveWriteCommand(s,o,a),this.remainingResponseLegnth=0,this.response=null}}},{key:"_getSensorsWithMask",value:function(e){for(var t=[],n=1,r=0;r<32;++r){if((e&n)===n){var i=this.getSensor(r);i&&(t.push(i),R("available: [".concat(e,"] ").concat(t[t.length-1].number)))}n<<=1}return t}},{key:"_processMeasurements",value:function(e){var t=[],n=!0,r=0,i=0,s=e.getUint8(4);switch(s){case b:t=this._getSensorsWithMask(e.getUint16(5,!0)),r=e.getUint8(7,!0),i=9;break;case y:t=this._getSensorsWithMask(e.getUint32(5,!0)),r=e.getUint8(9,!0),i=11;break;case E:case T:t[0]=this.getSensor(e.getUint8(6)),r=e.getUint8(7,!0),i=8;break;case A:case v:t[0]=this.getSensor(e.getUint8(6)),r=e.getUint8(7,!0),i=8,n=!1;break;case w:case S:case k:R("Purposely Ignoring packet type: ".concat(s));break;default:R("Unknown packet type: ".concat(s))}for(var o=0;o<r;++o)for(var a=0;a<t.length;++a)n?t[a].setValue(e.getFloat32(i,!0),this.keepValues):t[a].setValue(e.getInt32(i,!0),this.keepValues),i+=4}},{key:"_resolveWriteCommand",value:function(e,t,n){var r=this.writeQueue.find((function(n){return n.command===e&&n.rollingCounter===t}));r&&(r.resolve(n),this.writeQueue=this.writeQueue.filter((function(e){return e!==r})))}},{key:"_onOpened",value:function(){R("opened"),this.opened=!0,this.emit("device-opened")}},{key:"_onClosed",value:function(){R("closed"),this.opened=!1,this.emit("device-closed")}},{key:"_decRollingCounter",value:function(){return this.rollingCounter-=1,this.rollingCounter}},{key:"_calculateChecksum",value:function(e){for(var t=e[1],n=-1*e[3],r=0;r<t;++r)n+=e[r],n&=255;return n<0||n>255?(R("Checksum failed!"),0):n}},{key:"_sendCommand",value:function(e){var t=new Uint8Array(g.HEADER.byteLength+e.byteLength);return t.set(new Uint8Array(g.HEADER),0),t.set(new Uint8Array(e),g.HEADER.byteLength),t[1]=t.length,t[2]=this._decRollingCounter(),t[3]=this._calculateChecksum(t),this._queueWriteCommand(t,0,t.length)}},{key:"_writeCommand",value:function(){var e=r(regeneratorRuntime.mark((function e(t,n,r){var i;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r>0)){e.next=12;break}return e.prev=1,r>20?(i=t.subarray(n,n+20),r-=20,n+=20):(i=t.subarray(n,n+r),r=0),e.next=5,this.device.writeCommand(i);case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(1),R("Write Failure: ".concat(e.t0));case 10:e.next=0;break;case 12:case"end":return e.stop()}}),e,this,[[1,7]])})));return function(t,n,r){return e.apply(this,arguments)}}()},{key:"_queueWriteCommand",value:function(e,t,n){var r=this;R("command queued: ".concat(M(e)));var i=new Promise((function(t,n){r.writeQueue.push({command:e[4],rollingCounter:e[2],resolve:t,reject:n}),setTimeout((function(){r.writeQueue=r.writeQueue.filter((function(t){return t.command===e[4]&&t.rollingCounter!==e[2]})),n(new Error("write command timed out after 5s. Command: ".concat(e[4].toString(16)," Rolling Counter: ").concat(e[2].toString(16))))}),1e4)}));return this._writeCommand(e,t,n),i}},{key:"_getStatus",value:function(){var e=r(regeneratorRuntime.mark((function e(){var t,n;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._sendCommand(g.GET_STATUS);case 2:return t=e.sent,n={masterFirmwareVersion:"".concat(t.getUint8(2),".").concat(t.getUint8(3)),bleFirmwareVersion:"".concat(t.getUint8(6),".").concat(t.getUint8(9)),battery:t.getUint8(10),chargingStatus:"".concat(t.getUint8(11))},e.abrupt("return",n);case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_getAvailableSensors",value:function(){var e=r(regeneratorRuntime.mark((function e(){var t,n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._sendCommand(g.GET_SENSOR_IDS).then((function(e){r.availableSensors=e.getUint32(0,!0),R("Get Available Sensors Returned ".concat(r.availableSensors))}));case 2:t=1,n=0;case 4:if(!(n<31)){e.next=12;break}if((this.availableSensors&t)!==t){e.next=8;break}return e.next=8,this._getSensorInfo(n);case 8:t<<=1;case 9:++n,e.next=4;break;case 12:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"_getDefaultSensorsMask",value:function(){var e=this;return this._sendCommand(g.GET_DEFAULT_SENSORS_MASK).then((function(t){e.defaultSensorsMask=t.getUint32(0,!0),R("Default Sensors:"),x(e)}))}},{key:"_getDeviceInfo",value:function(){var e=this;return this._sendCommand(g.GET_INFO).then((function(t){var n=new C("utf-8");e.orderCode=n.decode(new Uint8Array(t.buffer,6,16).filter(I)),e.serialNumber=n.decode(new Uint8Array(t.buffer,22,16).filter(I)),e.name=n.decode(new Uint8Array(t.buffer,38,32).filter(I)),R("Device Info:"),x(e)}))}},{key:"_getSensorInfo",value:function(){var e=r(regeneratorRuntime.mark((function e(t){var n,r=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(n=new Uint8Array(g.GET_SENSOR_INFO))[1]=t,e.abrupt("return",this._sendCommand(n).then((function(e){var t=e.getUint32(2,!0);if(t>0){var n=new C("utf-8"),i=new P({type:e.getUint8(6),mode:e.getUint8(7),minValue:e.getFloat64(108,!0),maxValue:e.getFloat64(116,!0),uncertainty:e.getFloat64(100,!0),minPeriod:e.getUint32(124,!0)/1e3,maxPeriod:((e.getUint32(132,!0)<<32)+e.getUint32(128,!0))/1e3,typicalPeriod:e.getUint32(136,!0)/1e3,granularity:e.getUint32(140,!0)/1e3}),s=new D({number:e.getUint8(0),name:n.decode(new Uint8Array(e.buffer,14,60).filter(I)),unit:n.decode(new Uint8Array(e.buffer,74,32).filter(I)),mutalExclusiveMask:e.getUint32(144,!0),measurementInfo:i,sensorId:t}),o=new L(s);R("Get Sensor Info Returned"),x(o),r.sensors.push(o),o.on("state-changed",(function(){R("Sensor Restart: ".concat(o.number)),o.enabled&&(r.measurementPeriod=o.specs.measurementInfo.typicalPeriod,r.sensors.forEach((function(e){if(o.number!==e.number&&e.enabled){var t=1<<e.number;(t&o.specs.mutalExclusiveMask)===t?e.enabled=!1:e.specs.measurementInfo.typicalPeriod>r.measurementPeriod&&(r.measurementPeriod=e.specs.measurementInfo.typicalPeriod)}}))),r._restartMeasurements()}))}})));case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"_restartMeasurements",value:function(){var e=r(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t=this.collecting,!this.collecting){e.next=10;break}return e.prev=2,e.next=5,this._stopMeasurements();case 5:e.next=10;break;case 7:e.prev=7,e.t0=e.catch(2),console.error(e.t0);case 10:if(this.collecting||!t){e.next=19;break}return e.prev=11,e.next=14,this._startMeasurements();case 14:e.next=19;break;case 16:e.prev=16,e.t1=e.catch(11),console.error(e.t1);case 19:case"end":return e.stop()}}),e,this,[[2,7],[11,16]])})));return function(){return e.apply(this,arguments)}}()},{key:"_setMeasurementPeriod",value:function(e){var t=new Uint8Array(g.SET_MEASUREMENT_PERIOD),n=1e3*this.minMeasurementPeriod;return e<n&&(e=n),R("MeasurementPeriod: ".concat(e)),t[3]=255&e,t[4]=e>>8&255,t[5]=e>>16&255,t[6]=e>>24&255,this._sendCommand(t)}},{key:"_getEnabledChannelMask",value:function(){var e=0;return this.sensors.filter((function(e){return e.enabled})).forEach((function(t){e+=1<<t.number})),e}},{key:"_startMeasurements",value:function(){var e=this;return this._setMeasurementPeriod(1e3*this.measurementPeriod).then((function(){var t=e._getEnabledChannelMask();R("ChannelMask: ".concat(t));var n=new Uint8Array(g.START_MEASUREMENTS);return n[3]=255&t,n[4]=t>>8&255,n[5]=t>>16&255,n[6]=t>>24&255,e._sendCommand(n).then((function(t){0===t.getUint8(0)&&(e.collecting=!0,e.emit("measurements-started"))}))}))}},{key:"_stopMeasurements",value:function(){var e=this;return this._sendCommand(g.STOP_MEASUREMENTS).then((function(t){0===t.getUint8(0)&&(e.collecting=!1,e.emit("measurements-stopped"))}))}}]),e}(),U=function(){function e(t){i(this,e),this.webBluetoothNativeDevice=t,this.deviceCommand=null,this.deviceResponse=null}return o(e,[{key:"writeCommand",value:function(){var e=r(regeneratorRuntime.mark((function e(t){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.deviceCommand.writeValue(t));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}()},{key:"setup",value:function(){var e=r(regeneratorRuntime.mark((function e(t){var n,r,i,s,o=this;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.onClosed,r=t.onResponse,this.webBluetoothNativeDevice.addEventListener("gattserverdisconnected",n),e.prev=2,e.next=5,this.webBluetoothNativeDevice.gatt.connect();case 5:return i=e.sent,e.next=8,i.getPrimaryService("d91714ef-28b9-4f91-ba16-f0d9a604f112");case 8:return s=e.sent,e.next=11,s.getCharacteristics();case 11:e.sent.forEach((function(e){switch(e.uuid){case"f4bf14a6-c7d5-4b6d-8aa8-df1a7c83adcb":o.deviceCommand=e;break;case"b41e6675-a329-40e0-aa01-44d2f444babe":o.deviceResponse=e,o.deviceResponse.addEventListener("characteristicvaluechanged",(function(e){var t=e.target.value;r(t)})),o.deviceResponse.startNotifications();break;default:R("No case found for ".concat(e.uuid))}})),e.next=18;break;case 15:e.prev=15,e.t0=e.catch(2),console.error(e.t0);case 18:if(this.deviceCommand&&this.deviceResponse){e.next=20;break}throw new Error("Expected command and response characteristics not found.");case 20:case"end":return e.stop()}}),e,this,[[2,15]])})));return function(t){return e.apply(this,arguments)}}()},{key:"close",value:function(){var e=r(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.webBluetoothNativeDevice.gatt.disconnect());case 1:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()},{key:"godirectAdapter",get:function(){return!0}}]),e}(),F={createDevice:function(){var e=r(regeneratorRuntime.mark((function e(t){var n,r,i,s,o,a,c,l=arguments;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=l.length>1&&void 0!==l[1]?l[1]:{},r=n.open,i=void 0===r||r,s=n.startMeasurements,o=void 0===s||s,(a=t).godirectAdapter||(a=new U(t)),c=new B(a),!i){e.next=14;break}return e.prev=5,e.next=8,c.open(o);case 8:e.next=14;break;case 10:throw e.prev=10,e.t0=e.catch(5),console.error(e.t0),e.t0;case 14:return e.abrupt("return",c);case 15:case"end":return e.stop()}}),e,this,[[5,10]])})));return function(t){return e.apply(this,arguments)}}(),selectDevice:function(){var e=r(regeneratorRuntime.mark((function e(){var t;return regeneratorRuntime.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(navigator.bluetooth){e.next=2;break}return e.abrupt("return",Promise.reject(new Error("No Web Bluetooth support.")));case 2:return e.next=4,navigator.bluetooth.requestDevice({filters:[{namePrefix:"GDX"}],optionalServices:["d91714ef-28b9-4f91-ba16-f0d9a604f112"]});case 4:return t=e.sent,e.abrupt("return",F.createDevice(t));case 6:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}()};return F}()},function(e,t,n){const r=n(16);e.exports=class{constructor(e,t){let{service:n,commandChar:r,responseChar:i}=t;this.socket=e,this._service=n,this._commandChar=r,this._responseChar=i,this._onResponse=this._onResponse.bind(this),this._deviceOnResponse=null}get godirectAdapter(){return!0}writeCommand(e){const t=r.uint8ArrayToBase64(e);return this.socket.write(this._service,this._commandChar,t,"base64")}setup(e){let{onResponse:t}=e;return this._deviceOnResponse=t,this.socket.startNotifications(this._service,this._responseChar,this._onResponse)}_onResponse(e){const t=r.base64ToUint8Array(e),n=new DataView(t.buffer);return this._deviceOnResponse(n)}}},function(e,t,n){const r=n(5),i=n(2),s=n(3),o=n(1),a="data:image/svg+xml;base64,".concat(btoa('<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="none" stroke="#fff" stroke-width="11.51815371" d="M24.457 7.707a18.41 18.41 0 0 0-.365 2.31c-.02.224 0 .507.06.852.061.405.092.689.092.851 0 .527-.345.79-1.034.79-.446 0-.74-.131-.881-.395-.02-.446-.01-1.054.03-1.824.04-.912.061-1.52.061-1.824-.02 0-.05-.02-.091-.06a98.522 98.522 0 0 0-5.32.364c-.04.264-.04.588 0 .973l.122 1.094c-.081.629-.122 1.56-.122 2.797.061.527.091 2.786.091 6.779v2.219c0 .344.051.587.152.73h1.885c.77-.102 1.155.222 1.155.972 0 .446-.213.76-.638.942-.264.102-.73.122-1.399.061-.405-.04-.881-.05-1.428-.03-.75.101-1.662.182-2.736.243-1.094.06-1.763-.091-2.006-.456-.162-.243-.162-.496 0-.76.283-.446 1.023-.669 2.219-.669.628 0 .942-.172.942-.516 0-.183-.01-.355-.03-.517 0-.507.01-.953.03-1.338.06-1.094.06-2.634 0-4.62-.081-2.878-.05-5.462.091-7.752l-.09-.09c-.63.04-1.805.03-3.527-.031-.081 0-.7.04-1.854.121.283 1.946.446 3.334.486 4.165l-.06.82c-.021.305-.274.457-.76.457-.386 0-.71-.73-.973-2.19-.122-.87-.244-1.752-.365-2.644 0-.142-.071-.385-.213-.73-.122-.364-.39-.97-.39-1.152 0-.641.593-.489 1.363-.61.06 0 .162.01.304.03.142.02.243.03.304.03H17.1a57.098 57.098 0 0 0 5.411-.486c.122-.06.304-.121.547-.182.426-.04.79.06 1.095.304.304.223.405.547.304.972z"/><path fill="none" stroke="#ff4c4c" stroke-width="5.75909785" d="M24.333 7.71q-.244 1.065-.365 2.311-.03.335.06.851.092.608.092.851 0 .79-1.034.79-.669 0-.881-.394-.03-.67.03-1.824.06-1.368.06-1.824-.03 0-.09-.061-2.827.122-5.32.365-.06.395 0 .973l.122 1.094q-.122.942-.122 2.796.091.79.091 6.78v2.218q0 .517.152.73h1.885q1.155-.152 1.155.973 0 .668-.638.942-.396.152-1.399.06-.608-.06-1.428-.03-1.125.152-2.736.243-1.642.092-2.006-.456-.244-.364 0-.76.425-.668 2.219-.668.942 0 .942-.517 0-.274-.03-.517 0-.76.03-1.337.091-1.642 0-4.62-.122-4.317.091-7.752l-.091-.091q-.942.06-3.526-.03-.122 0-1.854.12.425 2.919.486 4.165l-.06.821q-.031.456-.76.456-.578 0-.974-2.189-.182-1.307-.364-2.644 0-.213-.213-.73-.182-.547-.182-.82 0-.76 1.155-.943.09 0 .304.03.212.03.304.03h7.538q2.797-.12 5.411-.485.182-.092.547-.183.639-.06 1.095.304.456.335.304.973z"/><path fill="#fff" d="M24.31 7.714q-.243 1.064-.365 2.31-.03.335.061.852.091.608.091.85 0 .791-1.033.791-.67 0-.882-.395-.03-.669.03-1.824.061-1.368.061-1.824-.03 0-.09-.06-2.828.121-5.32.364-.061.396 0 .973l.121 1.094q-.121.943-.121 2.797.09.79.09 6.779v2.219q0 .517.153.73h1.884q1.156-.153 1.156.972 0 .669-.639.942-.395.152-1.398.061-.608-.06-1.429-.03-1.125.152-2.736.243-1.641.091-2.006-.456-.243-.365 0-.76.426-.669 2.22-.669.941 0 .941-.516 0-.274-.03-.517 0-.76.03-1.338.092-1.641 0-4.62-.121-4.317.092-7.752l-.092-.09q-.942.06-3.526-.031-.121 0-1.854.121.426 2.919.486 4.165l-.06.82q-.03.457-.76.457-.578 0-.973-2.19-.182-1.306-.365-2.644 0-.212-.213-.73-.182-.546-.182-.82 0-.76 1.155-.942.091 0 .304.03t.304.03h7.539q2.796-.121 5.41-.486.183-.091.548-.182.638-.061 1.094.304.456.334.304.972z"/></svg>'));e.exports=class{constructor(e){this.runtime=e}getInfo(){return{id:"tw",name:"TurboWarp",color1:"#ff4c4c",color2:"#e64444",color3:"#c73a3a",docsURI:"https://docs.turbowarp.org/blocks",menuIconURI:a,blockIconURI:a,blocks:[{opcode:"getLastKeyPressed",text:r({id:"tw.blocks.lastKeyPressed",default:"last key pressed",description:"Block that returns the last key that was pressed"}),blockType:i.REPORTER},{opcode:"getButtonIsDown",text:r({id:"tw.blocks.buttonIsDown",default:"[MOUSE_BUTTON] mouse button down?",description:"Block that returns whether a specific mouse button is down"}),blockType:i.BOOLEAN,arguments:{MOUSE_BUTTON:{type:s.NUMBER,menu:"mouseButton",defaultValue:"0"}}}],menus:{mouseButton:{items:[{text:r({id:"tw.blocks.mouseButton.primary",default:"(0) primary",description:"Dropdown item to select primary (usually left) mouse button"}),value:"0"},{text:r({id:"tw.blocks.mouseButton.middle",default:"(1) middle",description:"Dropdown item to select middle mouse button"}),value:"1"},{text:r({id:"tw.blocks.mouseButton.secondary",default:"(2) secondary",description:"Dropdown item to select secondary (usually right) mouse button"}),value:"2"}],acceptReporters:!0}}}}getLastKeyPressed(e,t){return t.ioQuery("keyboard","getLastKeyPressed")}getButtonIsDown(e,t){const n=o.toNumber(e.MOUSE_BUTTON);return t.ioQuery("mouse","getButtonIsDown",[n])}}},function(e,t,n){(function(t){const r=n(227),i=n(230),s=n(72),o=n(231),a=n(232),c=e=>{try{return new URL(e,location.href)}catch(e){return null}},l=e=>new Promise((n=>{const s=[],l=Object.assign({},t.Scratch||{},r);l.extensions={unsandboxed:!0,register:e=>{s.push(e),n(s)}},l.vm=e,l.renderer=e.runtime.renderer,l.canFetch=async t=>{const n=c(t);return!!n&&("blob:"===n.protocol||"data:"===n.protocol||e.securityManager.canFetch(n.href))},l.canOpenWindow=async t=>{const n=c(t);return!!n&&("javascript:"!==n.protocol&&e.securityManager.canOpenWindow(n.href))},l.canRedirect=async t=>{const n=c(t);return!!n&&("javascript:"!==n.protocol&&e.securityManager.canRedirect(n.href))},l.canRecordAudio=async()=>e.securityManager.canRecordAudio(),l.canRecordVideo=async()=>e.securityManager.canRecordVideo(),l.canReadClipboard=async()=>e.securityManager.canReadClipboard(),l.canNotify=async()=>e.securityManager.canNotify(),l.canGeolocate=async()=>e.securityManager.canGeolocate(),l.canEmbed=async t=>{const n=c(t);return!!n&&e.securityManager.canEmbed(n.href)},l.canDownload=async(t,n)=>{const r=c(t);return!!r&&("javascript:"!==r.protocol&&e.securityManager.canDownload(t,n))},l.fetch=async(e,t)=>{const n=e instanceof Request?e.url:e,r=a(e);if(r)return r;if(!await l.canFetch(n))throw new Error("Permission to fetch ".concat(n," rejected."));return fetch(e,t)},l.openWindow=async(e,t)=>{if(!await l.canOpenWindow(e))throw new Error("Permission to open tab ".concat(e," rejected."));const n="noreferrer";return t=t?"".concat(n,",").concat(t):n,window.open(e,"_blank",t)},l.redirect=async e=>{if(!await l.canRedirect(e))throw new Error("Permission to redirect to ".concat(e," rejected."));location.href=e},l.download=async(e,t)=>{if(!await l.canDownload(e,t))throw new Error("Permission to download ".concat(t," rejected."));const n=document.createElement("a");n.href=e,n.download=t,document.body.appendChild(n),n.click(),n.remove()},l.translate=o(e),t.Scratch=l,t.ScratchExtensions=i(l),e.emit("CREATE_UNSANDBOXED_EXTENSION_API",l)})),u=new s(((e,n)=>new Promise(((t,r)=>{l(n).then(t);const i=document.createElement("script");i.onerror=()=>{r(new Error("Error in unsandboxed script ".concat(e,". Check the console for more information.")))},i.src=e,document.body.appendChild(i)})).then((e=>(t.Scratch.extensions.register=()=>{throw new Error("Too late to register new extensions.")},e)))),1);e.exports={setupUnsandboxedExtensionAPI:l,load:(e,t)=>u.do(e,t)}}).call(this,n(8))},function(e,t,n){const r={ArgumentType:n(3),BlockType:n(2),BlockShape:n(228),TargetType:n(39),Cast:n(1),external:n(229)};e.exports=r},function(e,t,n){const r=n(69),i={HEXAGONAL:r.OUTPUT_SHAPE_HEXAGONAL,ROUND:r.OUTPUT_SHAPE_ROUND,SQUARE:r.OUTPUT_SHAPE_SQUARE};e.exports=i},function(e,t){const n=e=>{if(!(e.startsWith("http:")||e.startsWith("https:")||e.startsWith("data:")||e.startsWith("blob:")))throw new Error("Unsupported URL: ".concat(e))},r={importModule:e=>(n(e),import(e)),fetch:async e=>{n(e);const t=await fetch(e);if(!t.ok)throw new Error("HTTP ".concat(t.status," fetching ").concat(e));return t},dataURL:async e=>{const t=await r.fetch(e),n=await t.blob();return new Promise(((e,t)=>{const r=new FileReader;r.onload=()=>e(r.result),r.onerror=()=>t(r.error),r.readAsDataURL(n)}))},blob:async e=>(await r.fetch(e)).blob(),evalAndReturn:async(e,t)=>{const n=await r.fetch(e),i=await n.text(),s="".concat(i,"\nreturn ").concat(t,";");return new Function(s)()}};e.exports=r},function(e,t,n){const r=n(3),i=n(2),{argumentIndexToId:s,generateExtensionId:o}=n(71),a=e=>{if(""===e||" "===e||"w"===e)return{type:i.COMMAND,async:"w"===e};if("r"===e||"R"===e)return{type:i.REPORTER,async:"R"===e};if("b"===e)return{type:i.BOOLEAN,async:!1};if("h"===e)return{type:i.HAT,async:!1};throw new Error("Unknown ScratchX block type: ".concat(e))},c=(e,t)=>{const n={},i="string"==typeof(s=t)||"number"==typeof s||"boolean"==typeof s;var s;if(i&&"b"!==e&&(n.defaultValue=t),"s"===e)n.type=r.STRING,i||(n.defaultValue="");else if("n"===e)n.type=r.NUMBER,i||(n.defaultValue=0);else if("m"===e[0]){n.type=r.STRING;const t=e.split(/\.|:/)[1];n.menu=t}else{if("b"!==e)throw new Error("Unknown ScratchX argument type: ".concat(e));n.type=r.BOOLEAN}return n},l=(e,t,n)=>r=>{const i=[];for(let e=0;e<t;e++)i.push(r[s(e)]);return n?new Promise((t=>{e(...i,t)})):e(...i)},u=new Map;e.exports=e=>({register:(t,n,r)=>{const i=((e,t,n)=>{const r={id:o(e),name:t.displayName||e,blocks:[],color1:"#4a4a5e",color2:"#31323f",color3:"#191a21"},i={getInfo:()=>r,_getStatus:n._getStatus};t.url&&(r.docsURI=t.url);for(const e of t.blocks){if(1===e.length){r.blocks.push("---");continue}const t=e[0],o=e[1],u=e[2],h=e.slice(3);let d="";const p=[],f=o.split(/%([\w.:]+)/g);for(let e=0;e<f.length;e++){const t=f[e];if(e%2==1){c(t);const n=Math.floor(e/2).toString(),r=h[n],i=s(n);p[i]=c(t,r),d+="[".concat(i,"]")}else d+=t}const m=a(t),g={opcode:u,blockType:m.type,text:d,arguments:p};r.blocks.push(g);const b=n[u],y=p.length;i[u]=l(b,y,m.async)}const u=t.menus;if(u){const e={};for(const t of Object.keys(u)||{}){const n={items:u[t]};e[t]=n}r.menus=e}return i})(t,n,r);u.set(t,i),e.extensions.register(i)},getStatus:e=>{const t=u.get(e);return t?t._getStatus():{status:0,msg:"does not exist"}}})},function(e,t,n){const r=n(5);e.exports=e=>{const t=r.namespace(),n=(e,n)=>{if(e&&"object"==typeof e);else{if("string"!=typeof e)throw new Error("unsupported data type in translate()");e={default:e}}return t(e,n)},i=e=>"_".concat(e),s=()=>e?e.getLocale():"undefined"!=typeof navigator?navigator.language:"en";let o={};return n.setup=e=>{e&&(o=e),t.setup({locale:s(),missingTranslation:"ignore",generateId:i,translations:o})},Object.defineProperty(n,"language",{configurable:!0,enumerable:!0,get:()=>s()}),n.setup({}),e&&e.on("LOCALE_CHANGED",(()=>{n.setup(null)})),n}},function(e,t,n){const r=n(16);e.exports=e=>{try{const t=e.match(/^data:([/-\w\d]*);base64,/i);if(t){const n=t[1].toLowerCase(),i=e.substring(t[0].length),s=r.base64ToUint8Array(i);return new Response(s,{headers:{"content-type":n,"content-length":s.byteLength}})}}catch(e){}return null}},function(e,t,n){e.exports=function(){return n(234)('!function(n){var e={};function t(r){if(e[r])return e[r].exports;var a=e[r]={i:r,l:!1,exports:{}};return n[r].call(a.exports,a,a.exports,t),a.l=!0,a.exports}t.m=n,t.c=e,t.d=function(n,e,r){t.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:r})},t.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},t.t=function(n,e){if(1&e&&(n=t(n)),8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var a in n)t.d(r,a,function(e){return n[e]}.bind(null,a));return r},t.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return t.d(e,"a",e),e},t.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},t.p="",t(t.s=7)}([function(n,e,t){const r=t(20);r.enable(),n.exports=r("vm")},function(n,e){n.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image",COSTUME:"costume",SOUND:"sound"}},function(n,e){n.exports={BOOLEAN:"Boolean",BUTTON:"button",LABEL:"label",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter",XML:"xml"}},function(n,e){n.exports={isWorker:!0,centralDispatchService:self}},function(n,e){var t="long",r="short",a="narrow",i="numeric",o="2-digit";n.exports={number:{decimal:{style:"decimal"},integer:{style:"decimal",maximumFractionDigits:0},currency:{style:"currency",currency:"USD"},percent:{style:"percent"},default:{style:"decimal"}},date:{short:{month:i,day:i,year:o},medium:{month:r,day:i,year:i},long:{month:t,day:i,year:i},full:{month:t,day:i,year:i,weekday:t},default:{month:r,day:i,year:i}},time:{short:{hour:i,minute:i},medium:{hour:i,minute:i,second:i},long:{hour:i,minute:i,second:i,timeZoneName:r},full:{hour:i,minute:i,second:i,timeZoneName:r},default:{hour:i,minute:i,second:i}},duration:{default:{hours:{minimumIntegerDigits:1,maximumFractionDigits:0},minutes:{minimumIntegerDigits:2,maximumFractionDigits:0},seconds:{minimumIntegerDigits:2,maximumFractionDigits:3}}},parseNumberPattern:function(n){if(n){var e={},t=n.match(/\\b[A-Z]{3}\\b/i),r=n.replace(/[^¤]/g,"").length;if(!r&&t&&(r=1),r?(e.style="currency",e.currencyDisplay=1===r?"symbol":2===r?"code":"name",e.currency=t?t[0].toUpperCase():"USD"):n.indexOf("%")>=0&&(e.style="percent"),!/[@#0]/.test(n))return e.style?e:void 0;if(e.useGrouping=n.indexOf(",")>=0,/E\\+?[@#0]+/i.test(n)||n.indexOf("@")>=0){var a=n.replace(/E\\+?[@#0]+|[^@#0]/gi,"");e.minimumSignificantDigits=Math.min(Math.max(a.replace(/[^@0]/g,"").length,1),21),e.maximumSignificantDigits=Math.min(Math.max(a.length,1),21)}else{for(var i=n.replace(/[^#0.]/g,"").split("."),o=i[0],s=o.length-1;"0"===o[s];)--s;e.minimumIntegerDigits=Math.min(Math.max(o.length-1-s,1),21);var c=i[1]||"";for(s=0;"0"===c[s];)++s;for(e.minimumFractionDigits=Math.min(Math.max(s,0),20);"#"===c[s];)++s;e.maximumFractionDigits=Math.min(Math.max(s,0),20)}return e}},parseDatePattern:function(n){if(n){for(var e={},s=0;s<n.length;){for(var c=n[s],l=1;n[++s]===c;)++l;switch(c){case"G":e.era=5===l?a:4===l?t:r;break;case"y":case"Y":e.year=2===l?o:i;break;case"M":case"L":l=Math.min(Math.max(l-1,0),4),e.month=[i,o,r,t,a][l];break;case"E":case"e":case"c":e.weekday=5===l?a:4===l?t:r;break;case"d":case"D":e.day=2===l?o:i;break;case"h":case"K":e.hour12=!0,e.hour=2===l?o:i;break;case"H":case"k":e.hour12=!1,e.hour=2===l?o:i;break;case"m":e.minute=2===l?o:i;break;case"s":case"S":e.second=2===l?o:i;break;case"z":case"Z":case"v":case"V":e.timeZoneName=1===l?r:t}}return Object.keys(e).length?e:void 0}}}},function(n,e){n.exports=function(n,e){if("string"==typeof n&&e[n])return n;for(var t=[].concat(n||[]),r=0,a=t.length;r<a;++r)for(var i=t[r].split("-");i.length;){var o=i.join("-");if(e[o])return o;i.pop()}}},function(n,e,t){"use strict";var r="zero",a="one",i="two",o="few",s="many",c="other",l=[function(n){return 1===+n?a:c},function(n){var e=+n;return 0<=e&&e<=1?a:c},function(n){return 0===Math.floor(Math.abs(+n))||1===+n?a:c},function(n){var e=+n;return 0===e?r:1===e?a:2===e?i:3<=e%100&&e%100<=10?o:11<=e%100&&e%100<=99?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 1===e&&0===t?a:c},function(n){var e=+n;return e%10==1&&e%100!=11?a:2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:e%10==0||5<=e%10&&e%10<=9||11<=e%100&&e%100<=14?s:c},function(n){var e=+n;return e%10==1&&e%100!=11&&e%100!=71&&e%100!=91?a:e%10==2&&e%100!=12&&e%100!=72&&e%100!=92?i:(3<=e%10&&e%10<=4||e%10==9)&&(e%100<10||19<e%100)&&(e%100<70||79<e%100)&&(e%100<90||99<e%100)?o:0!==e&&e%1e6==0?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&e%10==1&&e%100!=11||r%10==1&&r%100!=11?a:0===t&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)||2<=r%10&&r%10<=4&&(r%100<12||14<r%100)?o:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 1===e&&0===t?a:2<=e&&e<=4&&0===t?o:0!==t?s:c},function(n){var e=+n;return 0===e?r:1===e?a:2===e?i:3===e?o:6===e?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=+(""+n).replace(/^[^.]*.?|0+$/g,"");return 1===+n||0!==t&&(0===e||1===e)?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&e%100==1||r%100==1?a:0===t&&e%100==2||r%100==2?i:0===t&&3<=e%100&&e%100<=4||3<=r%100&&r%100<=4?o:c},function(n){var e=Math.floor(Math.abs(+n));return 0===e||1===e?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&(1===e||2===e||3===e)||0===t&&e%10!=4&&e%10!=6&&e%10!=9||0!==t&&r%10!=4&&r%10!=6&&r%10!=9?a:c},function(n){var e=+n;return 1===e?a:2===e?i:3<=e&&e<=6?o:7<=e&&e<=10?s:c},function(n){var e=+n;return 1===e||11===e?a:2===e||12===e?i:3<=e&&e<=10||13<=e&&e<=19?o:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 0===t&&e%10==1?a:0===t&&e%10==2?i:0!==t||e%100!=0&&e%100!=20&&e%100!=40&&e%100!=60&&e%100!=80?0!==t?s:c:o},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+n;return 1===e&&0===t?a:2===e&&0===t?i:0===t&&(r<0||10<r)&&r%10==0?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=+(""+n).replace(/^[^.]*.?|0+$/g,"");return 0===t&&e%10==1&&e%100!=11||0!==t?a:c},function(n){var e=+n;return 1===e?a:2===e?i:c},function(n){var e=+n;return 0===e?r:1===e?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=+n;return 0===t?r:0!==e&&1!==e||0===t?c:a},function(n){var e=+(n+".").split(".")[1],t=+n;return t%10==1&&(t%100<11||19<t%100)?a:2<=t%10&&t%10<=9&&(t%100<11||19<t%100)?o:0!==e?s:c},function(n){var e=(n+".").split(".")[1].length,t=+(n+".").split(".")[1],i=+n;return i%10==0||11<=i%100&&i%100<=19||2===e&&11<=t%100&&t%100<=19?r:i%10==1&&i%100!=11||2===e&&t%10==1&&t%100!=11||2!==e&&t%10==1?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+(n+".").split(".")[1];return 0===t&&e%10==1&&e%100!=11||r%10==1&&r%100!=11?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length,r=+n;return 1===e&&0===t?a:0!==t||0===r||1!==r&&1<=r%100&&r%100<=19?o:c},function(n){var e=+n;return 1===e?a:0===e||2<=e%100&&e%100<=10?o:11<=e%100&&e%100<=19?s:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 1===e&&0===t?a:0===t&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:0===t&&1!==e&&0<=e%10&&e%10<=1||0===t&&5<=e%10&&e%10<=9||0===t&&12<=e%100&&e%100<=14?s:c},function(n){var e=Math.floor(Math.abs(+n));return 0<=e&&e<=1?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 0===t&&e%10==1&&e%100!=11?a:0===t&&2<=e%10&&e%10<=4&&(e%100<12||14<e%100)?o:0===t&&e%10==0||0===t&&5<=e%10&&e%10<=9||0===t&&11<=e%100&&e%100<=14?s:c},function(n){var e=+n;return 0===Math.floor(Math.abs(+n))||1===e?a:2<=e&&e<=10?o:c},function(n){var e=Math.floor(Math.abs(+n)),t=+(n+".").split(".")[1],r=+n;return 0===r||1===r||0===e&&1===t?a:c},function(n){var e=Math.floor(Math.abs(+n)),t=(n+".").split(".")[1].length;return 0===t&&e%100==1?a:0===t&&e%100==2?i:0===t&&3<=e%100&&e%100<=4||0!==t?o:c},function(n){var e=+n;return 0<=e&&e<=1||11<=e&&e<=99?a:c},function(n){var e=+n;return 1===e||5===e||7===e||8===e||9===e||10===e?a:2===e||3===e?i:4===e?o:6===e?s:c},function(n){var e=Math.floor(Math.abs(+n));return e%10==1||e%10==2||e%10==5||e%10==7||e%10==8||e%100==20||e%100==50||e%100==70||e%100==80?a:e%10==3||e%10==4||e%1e3==100||e%1e3==200||e%1e3==300||e%1e3==400||e%1e3==500||e%1e3==600||e%1e3==700||e%1e3==800||e%1e3==900?o:0===e||e%10==6||e%100==40||e%100==60||e%100==90?s:c},function(n){var e=+n;return e%10!=2&&e%10!=3||e%100==12||e%100==13?c:o},function(n){var e=+n;return 1===e||3===e?a:2===e?i:4===e?o:c},function(n){var e=+n;return 0===e||7===e||8===e||9===e?r:1===e?a:2===e?i:3===e||4===e?o:5===e||6===e?s:c},function(n){var e=+n;return e%10==1&&e%100!=11?a:e%10==2&&e%100!=12?i:e%10==3&&e%100!=13?o:c},function(n){var e=+n;return 1===e||11===e?a:2===e||12===e?i:3===e||13===e?o:c},function(n){var e=+n;return 1===e?a:2===e||3===e?i:4===e?o:6===e?s:c},function(n){var e=+n;return 1===e||5===e?a:c},function(n){var e=+n;return 11===e||8===e||80===e||800===e?s:c},function(n){var e=Math.floor(Math.abs(+n));return 1===e?a:0===e||2<=e%100&&e%100<=20||e%100==40||e%100==60||e%100==80?s:c},function(n){var e=+n;return e%10==6||e%10==9||e%10==0&&0!==e?s:c},function(n){var e=Math.floor(Math.abs(+n));return e%10==1&&e%100!=11?a:e%10==2&&e%100!=12?i:e%10!=7&&e%10!=8||e%100==17||e%100==18?c:s},function(n){var e=+n;return 1===e?a:2===e||3===e?i:4===e?o:c},function(n){var e=+n;return 1<=e&&e<=4?a:c},function(n){var e=+n;return 1===e||5===e||7<=e&&e<=9?a:2===e||3===e?i:4===e?o:6===e?s:c},function(n){var e=+n;return 1===e?a:e%10==4&&e%100!=14?s:c},function(n){var e=+n;return e%10!=1&&e%10!=2||e%100==11||e%100==12?c:a},function(n){var e=+n;return e%10==6||e%10==9||10===e?o:c},function(n){var e=+n;return e%10==3&&e%100!=13?o:c}];n.exports={af:{cardinal:l[0]},ak:{cardinal:l[1]},am:{cardinal:l[2]},ar:{cardinal:l[3]},ars:{cardinal:l[3]},as:{cardinal:l[2],ordinal:l[34]},asa:{cardinal:l[0]},ast:{cardinal:l[4]},az:{cardinal:l[0],ordinal:l[35]},be:{cardinal:l[5],ordinal:l[36]},bem:{cardinal:l[0]},bez:{cardinal:l[0]},bg:{cardinal:l[0]},bh:{cardinal:l[1]},bn:{cardinal:l[2],ordinal:l[34]},br:{cardinal:l[6]},brx:{cardinal:l[0]},bs:{cardinal:l[7]},ca:{cardinal:l[4],ordinal:l[37]},ce:{cardinal:l[0]},cgg:{cardinal:l[0]},chr:{cardinal:l[0]},ckb:{cardinal:l[0]},cs:{cardinal:l[8]},cy:{cardinal:l[9],ordinal:l[38]},da:{cardinal:l[10]},de:{cardinal:l[4]},dsb:{cardinal:l[11]},dv:{cardinal:l[0]},ee:{cardinal:l[0]},el:{cardinal:l[0]},en:{cardinal:l[4],ordinal:l[39]},eo:{cardinal:l[0]},es:{cardinal:l[0]},et:{cardinal:l[4]},eu:{cardinal:l[0]},fa:{cardinal:l[2]},ff:{cardinal:l[12]},fi:{cardinal:l[4]},fil:{cardinal:l[13],ordinal:l[0]},fo:{cardinal:l[0]},fr:{cardinal:l[12],ordinal:l[0]},fur:{cardinal:l[0]},fy:{cardinal:l[4]},ga:{cardinal:l[14],ordinal:l[0]},gd:{cardinal:l[15],ordinal:l[40]},gl:{cardinal:l[4]},gsw:{cardinal:l[0]},gu:{cardinal:l[2],ordinal:l[41]},guw:{cardinal:l[1]},gv:{cardinal:l[16]},ha:{cardinal:l[0]},haw:{cardinal:l[0]},he:{cardinal:l[17]},hi:{cardinal:l[2],ordinal:l[41]},hr:{cardinal:l[7]},hsb:{cardinal:l[11]},hu:{cardinal:l[0],ordinal:l[42]},hy:{cardinal:l[12],ordinal:l[0]},ia:{cardinal:l[4]},io:{cardinal:l[4]},is:{cardinal:l[18]},it:{cardinal:l[4],ordinal:l[43]},iu:{cardinal:l[19]},iw:{cardinal:l[17]},jgo:{cardinal:l[0]},ji:{cardinal:l[4]},jmc:{cardinal:l[0]},ka:{cardinal:l[0],ordinal:l[44]},kab:{cardinal:l[12]},kaj:{cardinal:l[0]},kcg:{cardinal:l[0]},kk:{cardinal:l[0],ordinal:l[45]},kkj:{cardinal:l[0]},kl:{cardinal:l[0]},kn:{cardinal:l[2]},ks:{cardinal:l[0]},ksb:{cardinal:l[0]},ksh:{cardinal:l[20]},ku:{cardinal:l[0]},kw:{cardinal:l[19]},ky:{cardinal:l[0]},lag:{cardinal:l[21]},lb:{cardinal:l[0]},lg:{cardinal:l[0]},ln:{cardinal:l[1]},lt:{cardinal:l[22]},lv:{cardinal:l[23]},mas:{cardinal:l[0]},mg:{cardinal:l[1]},mgo:{cardinal:l[0]},mk:{cardinal:l[24],ordinal:l[46]},ml:{cardinal:l[0]},mn:{cardinal:l[0]},mo:{cardinal:l[25],ordinal:l[0]},mr:{cardinal:l[2],ordinal:l[47]},mt:{cardinal:l[26]},nah:{cardinal:l[0]},naq:{cardinal:l[19]},nb:{cardinal:l[0]},nd:{cardinal:l[0]},ne:{cardinal:l[0],ordinal:l[48]},nl:{cardinal:l[4]},nn:{cardinal:l[0]},nnh:{cardinal:l[0]},no:{cardinal:l[0]},nr:{cardinal:l[0]},nso:{cardinal:l[1]},ny:{cardinal:l[0]},nyn:{cardinal:l[0]},om:{cardinal:l[0]},or:{cardinal:l[0],ordinal:l[49]},os:{cardinal:l[0]},pa:{cardinal:l[1]},pap:{cardinal:l[0]},pl:{cardinal:l[27]},prg:{cardinal:l[23]},ps:{cardinal:l[0]},pt:{cardinal:l[28]},"pt-PT":{cardinal:l[4]},rm:{cardinal:l[0]},ro:{cardinal:l[25],ordinal:l[0]},rof:{cardinal:l[0]},ru:{cardinal:l[29]},rwk:{cardinal:l[0]},saq:{cardinal:l[0]},sc:{cardinal:l[4],ordinal:l[43]},scn:{cardinal:l[4],ordinal:l[43]},sd:{cardinal:l[0]},sdh:{cardinal:l[0]},se:{cardinal:l[19]},seh:{cardinal:l[0]},sh:{cardinal:l[7]},shi:{cardinal:l[30]},si:{cardinal:l[31]},sk:{cardinal:l[8]},sl:{cardinal:l[32]},sma:{cardinal:l[19]},smi:{cardinal:l[19]},smj:{cardinal:l[19]},smn:{cardinal:l[19]},sms:{cardinal:l[19]},sn:{cardinal:l[0]},so:{cardinal:l[0]},sq:{cardinal:l[0],ordinal:l[50]},sr:{cardinal:l[7]},ss:{cardinal:l[0]},ssy:{cardinal:l[0]},st:{cardinal:l[0]},sv:{cardinal:l[4],ordinal:l[51]},sw:{cardinal:l[4]},syr:{cardinal:l[0]},ta:{cardinal:l[0]},te:{cardinal:l[0]},teo:{cardinal:l[0]},ti:{cardinal:l[1]},tig:{cardinal:l[0]},tk:{cardinal:l[0],ordinal:l[52]},tl:{cardinal:l[13],ordinal:l[0]},tn:{cardinal:l[0]},tr:{cardinal:l[0]},ts:{cardinal:l[0]},tzm:{cardinal:l[33]},ug:{cardinal:l[0]},uk:{cardinal:l[29],ordinal:l[53]},ur:{cardinal:l[4]},uz:{cardinal:l[0]},ve:{cardinal:l[0]},vo:{cardinal:l[0]},vun:{cardinal:l[0]},wa:{cardinal:l[1]},wae:{cardinal:l[0]},xh:{cardinal:l[0]},xog:{cardinal:l[0]},yi:{cardinal:l[4]},zu:{cardinal:l[2]},lo:{ordinal:l[0]},ms:{ordinal:l[0]},vi:{ordinal:l[0]}}},function(n,e,t){(function(n){const e=t(9),r=t(16),a=t(18),i=t(0),{isWorker:o}=t(3),s=t(21)(null);n.Scratch=n.Scratch||{},Object.assign(n.Scratch,e,{canFetch:()=>Promise.resolve(!0),fetch:function(n){function e(e,t){return n.apply(this,arguments)}return e.toString=function(){return n.toString()},e}(((n,e)=>fetch(n,e))),canOpenWindow:()=>Promise.resolve(!1),openWindow:()=>Promise.reject(new Error("Scratch.openWindow not supported in sandboxed extensions")),canRedirect:()=>Promise.resolve(!1),redirect:()=>Promise.reject(new Error("Scratch.redirect not supported in sandboxed extensions")),canRecordAudio:()=>Promise.resolve(!1),canRecordVideo:()=>Promise.resolve(!1),canReadClipboard:()=>Promise.resolve(!1),canNotify:()=>Promise.resolve(!1),canGeolocate:()=>Promise.resolve(!1),canEmbed:()=>Promise.resolve(!1),canDownload:()=>Promise.resolve(!1),download:()=>Promise.reject(new Error("Scratch.download not supported in sandboxed extensions")),translate:s});const c=new class{constructor(){this.nextExtensionId=0,this.initialRegistrations=[],this.firstRegistrationPromise=new Promise((n=>{this.firstRegistrationCallback=n})),a.waitForConnection.then((()=>{a.call("extensions","allocateWorker").then((async n=>{const[e,t]=n;this.workerId=e;try{await(n=>{if(!o)return new Promise(((e,t)=>{const r=document.createElement("script");r.onload=()=>e(),r.onerror=()=>{t(new Error("Error in sandboxed script: ".concat(n,". Check the console for more information.")))},r.src=n,document.body.appendChild(r)}));importScripts(n)})(t),await this.firstRegistrationPromise;const n=this.initialRegistrations;this.initialRegistrations=null,Promise.all(n).then((()=>a.call("extensions","onWorkerInit",e)))}catch(n){i.error(n),a.call("extensions","onWorkerInit",e,"".concat(n))}}))})),this.extensions=[]}register(n){const e=this.nextExtensionId++;this.extensions.push(n);const t="extension.".concat(this.workerId,".").concat(e),r=a.setService(t,n).then((()=>a.call("extensions","registerExtensionService",t)));return this.initialRegistrations&&(this.firstRegistrationCallback(),this.initialRegistrations.push(r)),r}};n.Scratch.extensions={register:c.register.bind(c)},n.ScratchExtensions=r(n.Scratch)}).call(this,t(8))},function(n,e){var t;t=function(){return this}();try{t=t||new Function("return this")()}catch(n){"object"==typeof window&&(t=window)}n.exports=t},function(n,e,t){const r={ArgumentType:t(1),BlockType:t(2),BlockShape:t(10),TargetType:t(12),Cast:t(13),external:t(15)};n.exports=r},function(n,e,t){const r=t(11),a={HEXAGONAL:r.OUTPUT_SHAPE_HEXAGONAL,ROUND:r.OUTPUT_SHAPE_ROUND,SQUARE:r.OUTPUT_SHAPE_SQUARE};n.exports=a},function(n,e){n.exports={OUTPUT_SHAPE_HEXAGONAL:1,OUTPUT_SHAPE_ROUND:2,OUTPUT_SHAPE_SQUARE:3}},function(n,e){n.exports={SPRITE:"sprite",STAGE:"stage"}},function(n,e,t){const r=t(14),a=n=>{if("string"!=typeof n)return!1;for(let e=0;e<n.length;e++){const t=n.charCodeAt(e);if(48===t||9===t)return!1}return!0};class i{static toNumber(n){if("number"==typeof n)return Number.isNaN(n)?0:n;const e=Number(n);return Number.isNaN(e)?0:e}static toBoolean(n){return"boolean"==typeof n?n:"string"==typeof n?""!==n&&"0"!==n&&"false"!==n.toLowerCase():Boolean(n)}static toString(n){return String(n)}static toRgbColorList(n){const e=i.toRgbColorObject(n);return[e.r,e.g,e.b]}static toRgbColorObject(n){let e;return"string"==typeof n&&"#"===n.substring(0,1)?(e=r.hexToRgb(n),e||(e={r:0,g:0,b:0,a:255})):e=r.decimalToRgb(i.toNumber(n)),e}static isWhiteSpace(n){return null===n||"string"==typeof n&&0===n.trim().length}static compare(n,e){let t=Number(n),r=Number(e);if(0===t&&a(n)?t=NaN:0===r&&a(e)&&(r=NaN),isNaN(t)||isNaN(r)){const t=String(n).toLowerCase(),r=String(e).toLowerCase();return t<r?-1:t>r?1:0}return t===1/0&&r===1/0||t===-1/0&&r===-1/0?0:t-r}static isInt(n){return"number"==typeof n?!!isNaN(n)||n===Math.floor(n):"boolean"==typeof n||"string"==typeof n&&n.indexOf(".")<0}static get LIST_INVALID(){return"INVALID"}static get LIST_ALL(){return"ALL"}static toListIndex(n,e,t){if("number"!=typeof n){if("all"===n)return t?i.LIST_ALL:i.LIST_INVALID;if("last"===n)return e>0?e:i.LIST_INVALID;if("random"===n||"any"===n)return e>0?1+Math.floor(Math.random()*e):i.LIST_INVALID}return(n=Math.floor(i.toNumber(n)))<1||n>e?i.LIST_INVALID:n}}n.exports=i},function(n,e){class t{static get RGB_BLACK(){return{r:0,g:0,b:0}}static get RGB_WHITE(){return{r:255,g:255,b:255}}static decimalToHex(n){n<0&&(n+=16777216);let e=Number(n).toString(16);return e="#".concat("000000".substr(0,6-e.length)).concat(e),e}static decimalToRgb(n){const e=n>>24&255;return{r:n>>16&255,g:n>>8&255,b:255&n,a:e>0?e:255}}static hexToRgb(n){n.startsWith("#")&&(n=n.substring(1));const e=parseInt(n,16);if(isNaN(e))return null;if(6===n.length)return{r:e>>16&255,g:e>>8&255,b:255&e};if(3===n.length){const n=e>>8&15,t=e>>4&15,r=15&e;return{r:n<<4|n,g:t<<4|t,b:r<<4|r}}return null}static rgbToHex(n){return t.decimalToHex(t.rgbToDecimal(n))}static rgbToDecimal(n){return(n.r<<16)+(n.g<<8)+n.b}static hexToDecimal(n){return t.rgbToDecimal(t.hexToRgb(n))}static hsvToRgb(n){let e=n.h%360;e<0&&(e+=360);const t=Math.max(0,Math.min(n.s,1)),r=Math.max(0,Math.min(n.v,1)),a=Math.floor(e/60),i=e/60-a,o=r*(1-t),s=r*(1-t*i),c=r*(1-t*(1-i));let l,u,d;switch(a){default:case 0:l=r,u=c,d=o;break;case 1:l=s,u=r,d=o;break;case 2:l=o,u=r,d=c;break;case 3:l=o,u=s,d=r;break;case 4:l=c,u=o,d=r;break;case 5:l=r,u=o,d=s}return{r:Math.floor(255*l),g:Math.floor(255*u),b:Math.floor(255*d)}}static rgbToHsv(n){const e=n.r/255,t=n.g/255,r=n.b/255,a=Math.min(Math.min(e,t),r),i=Math.max(Math.max(e,t),r);let o=0,s=0;if(a!==i){o=60*((e===a?3:t===a?5:1)-(e===a?t-r:t===a?r-e:e-t)/(i-a))%360,s=(i-a)/i}return{h:o,s:s,v:i}}static mixRgb(n,e,t){if(t<=0)return n;if(t>=1)return e;const r=1-t;return{r:r*n.r+t*e.r,g:r*n.g+t*e.g,b:r*n.b+t*e.b}}}n.exports=t},function(n,e){const t=n=>{if(!(n.startsWith("http:")||n.startsWith("https:")||n.startsWith("data:")||n.startsWith("blob:")))throw new Error("Unsupported URL: ".concat(n))},r={importModule:n=>(t(n),import(n)),fetch:async n=>{t(n);const e=await fetch(n);if(!e.ok)throw new Error("HTTP ".concat(e.status," fetching ").concat(n));return e},dataURL:async n=>{const e=await r.fetch(n),t=await e.blob();return new Promise(((n,e)=>{const r=new FileReader;r.onload=()=>n(r.result),r.onerror=()=>e(r.error),r.readAsDataURL(t)}))},blob:async n=>(await r.fetch(n)).blob(),evalAndReturn:async(n,e)=>{const t=await r.fetch(n),a=await t.text(),i="".concat(a,"\\nreturn ").concat(e,";");return new Function(i)()}};n.exports=r},function(n,e,t){const r=t(1),a=t(2),{argumentIndexToId:i,generateExtensionId:o}=t(17),s=n=>{if(""===n||" "===n||"w"===n)return{type:a.COMMAND,async:"w"===n};if("r"===n||"R"===n)return{type:a.REPORTER,async:"R"===n};if("b"===n)return{type:a.BOOLEAN,async:!1};if("h"===n)return{type:a.HAT,async:!1};throw new Error("Unknown ScratchX block type: ".concat(n))},c=(n,e)=>{const t={},a="string"==typeof(i=e)||"number"==typeof i||"boolean"==typeof i;var i;if(a&&"b"!==n&&(t.defaultValue=e),"s"===n)t.type=r.STRING,a||(t.defaultValue="");else if("n"===n)t.type=r.NUMBER,a||(t.defaultValue=0);else if("m"===n[0]){t.type=r.STRING;const e=n.split(/\\.|:/)[1];t.menu=e}else{if("b"!==n)throw new Error("Unknown ScratchX argument type: ".concat(n));t.type=r.BOOLEAN}return t},l=(n,e,t)=>r=>{const a=[];for(let n=0;n<e;n++)a.push(r[i(n)]);return t?new Promise((e=>{n(...a,e)})):n(...a)},u=new Map;n.exports=n=>({register:(e,t,r)=>{const a=((n,e,t)=>{const r={id:o(n),name:e.displayName||n,blocks:[],color1:"#4a4a5e",color2:"#31323f",color3:"#191a21"},a={getInfo:()=>r,_getStatus:t._getStatus};e.url&&(r.docsURI=e.url);for(const n of e.blocks){if(1===n.length){r.blocks.push("---");continue}const e=n[0],o=n[1],u=n[2],d=n.slice(3);let f="";const h=[],p=o.split(/%([\\w.:]+)/g);for(let n=0;n<p.length;n++){const e=p[n];if(n%2==1){c(e);const t=Math.floor(n/2).toString(),r=d[t],a=i(t);h[a]=c(e,r),f+="[".concat(a,"]")}else f+=e}const m=s(e),g={opcode:u,blockType:m.type,text:f,arguments:h};r.blocks.push(g);const b=t[u],x=h.length;a[u]=l(b,x,m.async)}const u=e.menus;if(u){const n={};for(const e of Object.keys(u)||{}){const t={items:u[e]};n[e]=t}r.menus=n}return a})(e,t,r);u.set(e,a),n.extensions.register(a)},getStatus:n=>{const e=u.get(n);return e?e._getStatus():{status:0,msg:"does not exist"}}})},function(n,e){n.exports={generateExtensionId:n=>{const e=n.replace(/[^a-z0-9]/gi,"").toLowerCase();return"sbx".concat(e)},argumentIndexToId:n=>n.toString()}},function(n,e,t){const r=t(19),a=t(0),{centralDispatchService:i}=t(3);n.exports=new class extends r{constructor(){super(),this._connectionPromise=new Promise((n=>{this._onConnect=n})),this.services={},this._onMessage=this._onMessage.bind(this,i),"undefined"!=typeof self&&(self.onmessage=this._onMessage)}get waitForConnection(){return this._connectionPromise}setService(n,e){return Object.prototype.hasOwnProperty.call(this.services,n)&&a.warn("Worker dispatch replacing existing service provider for ".concat(n)),this.services[n]=e,this.waitForConnection.then((()=>this._remoteCall(i,"dispatch","setService",n)))}_getServiceProvider(n){const e=this.services[n];return{provider:e||i,isRemote:!e}}_onDispatchMessage(n,e){let t;switch(e.method){case"handshake":t=this._onConnect();break;case"terminate":setTimeout((()=>self.close()),0),t=Promise.resolve();break;default:a.error("Worker dispatch received message for unknown method: ".concat(e.method))}return t}}},function(n,e,t){const r=t(0);n.exports=class{constructor(){this.callbacks=[],this.nextResponseId=0}call(n,e){for(var t=arguments.length,r=new Array(t>2?t-2:0),a=2;a<t;a++)r[a-2]=arguments[a];return this.transferCall(n,e,null,...r)}transferCall(n,e,t){try{const{provider:o,isRemote:s}=this._getServiceProvider(n);if(o){for(var r=arguments.length,a=new Array(r>3?r-3:0),i=3;i<r;i++)a[i-3]=arguments[i];if(s)return this._remoteTransferCall(o,n,e,t,...a);const c=o[e].apply(o,a);return Promise.resolve(c)}return Promise.reject(new Error("Service not found: ".concat(n)))}catch(n){return Promise.reject(n)}}_isRemoteService(n){return this._getServiceProvider(n).isRemote}_remoteCall(n,e,t){for(var r=arguments.length,a=new Array(r>3?r-3:0),i=3;i<r;i++)a[i-3]=arguments[i];return this._remoteTransferCall(n,e,t,null,...a)}_remoteTransferCall(n,e,t,r){for(var a=arguments.length,i=new Array(a>4?a-4:0),o=4;o<a;o++)i[o-4]=arguments[o];return new Promise(((a,o)=>{const s=this._storeCallbacks(a,o);i.length>0&&"function"==typeof i[i.length-1].func&&(i.pop(),i.pop()),r?n.postMessage({service:e,method:t,responseId:s,args:i},r):n.postMessage({service:e,method:t,responseId:s,args:i})}))}_storeCallbacks(n,e){const t=this.nextResponseId++;return this.callbacks[t]=[n,e],t}_deliverResponse(n,e){try{const[t,r]=this.callbacks[n];delete this.callbacks[n],e.error?r(e.error):t(e.result)}catch(n){r.error("Dispatch callback failed: ".concat(n))}}_onMessage(n,e){const t=e.data;let a;t.args=t.args||[],t.service?a="dispatch"===t.service?this._onDispatchMessage(n,t):this.call(t.service,t.method,...t.args):void 0===t.responseId?r.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(e))):this._deliverResponse(t.responseId,t),a&&(void 0===t.responseId?r.error("Dispatch message missing required response ID: ".concat(JSON.stringify(e))):a.then((e=>n.postMessage({responseId:t.responseId,result:e})),(e=>n.postMessage({responseId:t.responseId,error:"".concat(e)}))))}_getServiceProvider(n){throw new Error("Could not get provider for ".concat(n,": _getServiceProvider not implemented"))}_onDispatchMessage(n,e){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(e.method," method"))}}},function(n,e){const t="undefined"==typeof document,r=t?"[0m":"",a=t?"[90m":"",i=`${t?"[34m":""}debug${r}`,o=`${t?"[36m":""}info${r}`,s=`${t?"[33m":""}warn${r}`,c=`${t?"[31m":""}error${r}`,l=(n="")=>{const e=e=>l(n?`${n} ${e}`:e),t=n?[`${a}${n}${r}`]:[];return e.debug=e.log=console.debug.bind(console,...t,i),e.info=console.log.bind(console,...t,o),e.warn=e.warning=console.warn.bind(console,...t,s),e.error=console.error.bind(console,...t,c),e};l.enable=l.disable=()=>{},n.exports=l},function(n,e,t){const r=t(22);n.exports=n=>{const e=r.namespace(),t=(n,t)=>{if(n&&"object"==typeof n);else{if("string"!=typeof n)throw new Error("unsupported data type in translate()");n={default:n}}return e(n,t)},a=n=>"_".concat(n),i=()=>n?n.getLocale():"undefined"!=typeof navigator?navigator.language:"en";let o={};return t.setup=n=>{n&&(o=n),e.setup({locale:i(),missingTranslation:"ignore",generateId:a,translations:o})},Object.defineProperty(t,"language",{configurable:!0,enumerable:!0,get:()=>i()}),t.setup({}),n&&n.on("LOCALE_CHANGED",(()=>{t.setup(null)})),t}},function(n,e,t){"use strict";var r=t(23),a=t(24),i=t(6),o=t(5),s=t(4);function c(n,e){return Object.keys(e).forEach((function(t){n[t]=e[t]})),n}n.exports=function n(){var e=c({},s),t="en",l={},u=function(n){return n},d=null,f="warning",h={};function p(n,e,i){var o="string"==typeof n?n:n.default,s=b(o,"object"==typeof n&&n.id||u(o),i||t);return(s.format||(s.format=a(r(s.message),i||t,h)))(e)}p.rich=function(n,e,i){var o="string"==typeof n?n:n.default,s=b(o,"object"==typeof n&&n.id||u(o),i||t);return(s.toParts||(s.toParts=a.toParts(r(s.message,{tagsType:m}),i||t,h)))(e)};var m="<>";function g(n,e){var t=n[2];return function(n,e){var r="object"==typeof t?function(n,e){return Object.keys(n).reduce((function(t,r){return t[r]=n[r](e),t}),{})}(t,e):t;return"function"==typeof n?n(r):n}}function b(n,e,t){var r=o(t,l)||"en",a=l[r]||(l[r]={}),i=a[e];if("string"==typeof i&&(i=a[e]={message:i}),!i){var s=\'Translation for "\'+e+\'" in "\'+r+\'" is missing\';if("warning"===f)"undefined"!=typeof console&&console.warn(s);else if("ignore"!==f)throw new Error(s);var c="function"==typeof d?d(n,e,r)||n:d||n;i=a[e]={message:c}}return i}function x(n,e,r,a,s){"object"==typeof r&&"object"!=typeof a&&(s=a,a=r,r=0);var c=o(s||t,i),l=c&&i[c][n]||v;return a["="+ +e]||a[l(e-r)]||a.other}function v(){return"other"}return h[m]=g,p.setup=function(n){return(n=n||{}).locale&&(t=n.locale),"translations"in n&&(l=n.translations||{}),n.generateId&&(u=n.generateId),"missingReplacement"in n&&(d=n.missingReplacement),n.missingTranslation&&(f=n.missingTranslation),n.formats&&(n.formats.number&&c(e.number,n.formats.number),n.formats.date&&c(e.date,n.formats.date),n.formats.time&&c(e.time,n.formats.time)),n.types&&((h=n.types)[m]=g),{locale:t,translations:l,generateId:u,missingReplacement:d,missingTranslation:f,formats:e,types:h}},p.number=function(n,r,a){var i=r&&e.number[r]||e.parseNumberPattern(r)||e.number.default;return new Intl.NumberFormat(a||t,i).format(n)},p.date=function(n,r,a){var i=r&&e.date[r]||e.parseDatePattern(r)||e.date.default;return new Intl.DateTimeFormat(a||t,i).format(n)},p.time=function(n,r,a){var i=r&&e.time[r]||e.parseDatePattern(r)||e.time.default;return new Intl.DateTimeFormat(a||t,i).format(n)},p.select=function(n,e){return e[n]||e.other},p.custom=function(n,e,t,r){return n[1]in h?h[n[1]](n,e)(t,r):t},p.plural=x.bind(null,"cardinal"),p.selectordinal=x.bind(null,"ordinal"),p.namespace=n,p}()},function(n,e,t){"use strict";var r="{",a="}",i=",",o="#",s="<",c=">",l="</",u="/>",d="\'",f="offset:",h=["number","date","time","ordinal","duration","spellout"],p=["plural","select","selectordinal"];function m(n,e){var t=n.pattern,r=t.length,i=[],o=n.index,s=g(n,e);for(s&&i.push(s),s&&n.tokens&&n.tokens.push(["text",t.slice(o,n.index)]);n.index<r;){if(t[n.index]===a){if(!e)throw T(n);break}if(e&&n.tagsType&&t.slice(n.index,n.index+2)===l)break;i.push(v(n)),o=n.index,(s=g(n,e))&&i.push(s),s&&n.tokens&&n.tokens.push(["text",t.slice(o,n.index)])}return i}function g(n,e){for(var t=n.pattern,i=t.length,c="plural"===e||"selectordinal"===e,l=!!n.tagsType,u="{style}"===e,f="";n.index<i;){var h=t[n.index];if(h===r||h===a||c&&h===o||l&&h===s||u&&b(h.charCodeAt(0)))break;if(h===d)if((h=t[++n.index])===d)f+=h,++n.index;else if(h===r||h===a||c&&h===o||l&&h===s||u)for(f+=h;++n.index<i;)if((h=t[n.index])===d&&t[n.index+1]===d)f+=d,++n.index;else{if(h===d){++n.index;break}f+=h}else f+=d;else f+=h,++n.index}return f}function b(n){return n>=9&&n<=13||32===n||133===n||160===n||6158===n||n>=8192&&n<=8205||8232===n||8233===n||8239===n||8287===n||8288===n||12288===n||65279===n}function x(n){for(var e=n.pattern,t=e.length,r=n.index;n.index<t&&b(e.charCodeAt(n.index));)++n.index;r<n.index&&n.tokens&&n.tokens.push(["space",n.pattern.slice(r,n.index)])}function v(n){var e=n.pattern;if(e[n.index]===o)return n.tokens&&n.tokens.push(["syntax",o]),++n.index,[o];var t=function(n){var e=n.tagsType;if(!e||n.pattern[n.index]!==s)return;if(n.pattern.slice(n.index,n.index+2)===l)throw T(n,null,"closing tag without matching opening tag");n.tokens&&n.tokens.push(["syntax",s]);++n.index;var t=y(n,!0);if(!t)throw T(n,"placeholder id");n.tokens&&n.tokens.push(["id",t]);if(x(n),n.pattern.slice(n.index,n.index+2)===u)return n.tokens&&n.tokens.push(["syntax",u]),n.index+=2,[t,e];if(n.pattern[n.index]!==c)throw T(n,c);n.tokens&&n.tokens.push(["syntax",c]);++n.index;var r=m(n,e),a=n.index;if(n.pattern.slice(n.index,n.index+2)!==l)throw T(n,l+t+c);n.tokens&&n.tokens.push(["syntax",l]);n.index+=2;var i=y(n,!0);i&&n.tokens&&n.tokens.push(["id",i]);if(t!==i)throw n.index=a,T(n,l+t+c,l+i+c);if(x(n),n.pattern[n.index]!==c)throw T(n,c);n.tokens&&n.tokens.push(["syntax",c]);return++n.index,[t,e,{children:r}]}(n);if(t)return t;if(e[n.index]!==r)throw T(n,r);n.tokens&&n.tokens.push(["syntax",r]),++n.index,x(n);var d=y(n);if(!d)throw T(n,"placeholder id");n.tokens&&n.tokens.push(["id",d]),x(n);var p=e[n.index];if(p===a)return n.tokens&&n.tokens.push(["syntax",a]),++n.index,[d];if(p!==i)throw T(n,", or }");n.tokens&&n.tokens.push(["syntax",i]),++n.index,x(n);var g,b=y(n);if(!b)throw T(n,"placeholder type");if(n.tokens&&n.tokens.push(["type",b]),x(n),(p=e[n.index])===a){if(n.tokens&&n.tokens.push(["syntax",a]),"plural"===b||"selectordinal"===b||"select"===b)throw T(n,b+" sub-messages");return++n.index,[d,b]}if(p!==i)throw T(n,", or }");if(n.tokens&&n.tokens.push(["syntax",i]),++n.index,x(n),"plural"===b||"selectordinal"===b){var v=function(n){var e=n.pattern,t=e.length,r=0;if(e.slice(n.index,n.index+7)===f){n.tokens&&n.tokens.push(["offset","offset"],["syntax",":"]),n.index+=7,x(n);for(var a=n.index;n.index<t&&w(e.charCodeAt(n.index));)++n.index;if(a===n.index)throw T(n,"offset number");n.tokens&&n.tokens.push(["number",e.slice(a,n.index)]),r=+e.slice(a,n.index)}return r}(n);x(n),g=[d,b,v,M(n,b)]}else if("select"===b)g=[d,b,M(n,b)];else if(h.indexOf(b)>=0)g=[d,b,k(n)];else{var S=n.index,I=k(n);x(n),e[n.index]===r&&(n.index=S,I=M(n,b)),g=[d,b,I]}if(x(n),e[n.index]!==a)throw T(n,a);return n.tokens&&n.tokens.push(["syntax",a]),++n.index,g}function y(n,e){for(var t=n.pattern,l=t.length,u="";n.index<l;){var f=t[n.index];if(f===r||f===a||f===i||f===o||f===d||b(f.charCodeAt(0))||e&&(f===s||f===c||"/"===f))break;u+=f,++n.index}return u}function k(n){var e=n.index,t=g(n,"{style}");if(!t)throw T(n,"placeholder style name");return n.tokens&&n.tokens.push(["style",n.pattern.slice(e,n.index)]),t}function w(n){return n>=48&&n<=57}function M(n,e){for(var t=n.pattern,r=t.length,i={};n.index<r&&t[n.index]!==a;){var o=y(n);if(!o)throw T(n,"sub-message selector");n.tokens&&n.tokens.push(["selector",o]),x(n),i[o]=S(n,e),x(n)}if(!i.other&&p.indexOf(e)>=0)throw T(n,null,null,\'"other" sub-message must be specified in \'+e);return i}function S(n,e){if(n.pattern[n.index]!==r)throw T(n,"{ to start sub-message");n.tokens&&n.tokens.push(["syntax",r]),++n.index;var t=m(n,e);if(n.pattern[n.index]!==a)throw T(n,"} to end sub-message");return n.tokens&&n.tokens.push(["syntax",a]),++n.index,t}function T(n,e,t,r){var a=n.pattern,i=a.slice(0,n.index).split(/\\r?\\n/),o=n.index,s=i.length,c=i.slice(-1)[0].length;return t=t||(n.index>=a.length?"end of message pattern":y(n)||a[n.index]),r||(r=function(n,e){return n?"Expected "+n+" but found "+e:"Unexpected "+e+" found"}(e,t)),new I(r+=" in "+a.replace(/\\r?\\n/g,"\\n"),e,t,o,s,c)}function I(n,e,t,r,a,i){Error.call(this,n),this.name="SyntaxError",this.message=n,this.expected=e,this.found=t,this.offset=r,this.line=a,this.column=i}e=n.exports=function(n,e){return m({pattern:String(n),index:0,tagsType:e&&e.tagsType||null,tokens:e&&e.tokens||null},"")},I.prototype=Object.create(Error.prototype),e.SyntaxError=I},function(n,e,t){"use strict";var r=t(4),a=t(5),i=t(6);function o(n,e,t,r,a){var i=n.map((function(n){return function(n,e,t,r,a){if("string"==typeof n){var i=n;return function(){return i}}var c,l=n[0],u=n[1];if(e&&"#"===n[0]){l=e[0];var d=e[2],h=(r.number||f.number)([l,"number"],t);return function(n){return h(s(l,n)-d,n)}}"plural"===u||"selectordinal"===u?(c={},Object.keys(n[3]).forEach((function(e){c[e]=o(n[3][e],n,t,r,a)})),n=[n[0],n[1],n[2],c]):n[2]&&"object"==typeof n[2]&&(c={},Object.keys(n[2]).forEach((function(e){c[e]=o(n[2][e],n,t,r,a)})),n=[n[0],n[1],c]);var p=u&&(r[u]||f[u]);if(p){var m=p(n,t);return function(n){return m(s(l,n),n)}}return a?function(n){return String(s(l,n))}:function(n){return s(l,n)}}(n,e,t,r,a)}));return a?1===i.length?i[0]:function(n){for(var e="",t=0;t<i.length;++t)e+=i[t](n);return e}:function(n){return i.reduce((function(e,t){return e.concat(t(n))}),[])}}function s(n,e){if(e&&n in e)return e[n];for(var t=n.split("."),r=e,a=0,i=t.length;r&&a<i;++a)r=r[t[a]];return r}function c(n,e){var t=n[2],a=r.number[t]||r.parseNumberPattern(t)||r.number.default;return new Intl.NumberFormat(e,a).format}function l(n,e){var t=n[1],a=n[2],i=r[t][a]||r.parseDatePattern(a)||r[t].default;return new Intl.DateTimeFormat(e,i).format}function u(n,e){var t,r="selectordinal"===n[1]?"ordinal":"cardinal",o=n[2],s=n[3];if(Intl.PluralRules&&Intl.PluralRules.supportedLocalesOf(e).length>0)t=new Intl.PluralRules(e,{type:r});else{var c=a(e,i),l=c&&i[c][r]||d;t={select:l}}return function(n,e){return(s["="+ +n]||s[t.select(n-o)]||s.other)(e)}}function d(){return"other"}(e=n.exports=function(n,e,t){return o(n,null,e||"en",t||{},!0)}).toParts=function(n,e,t){return o(n,null,e||"en",t||{},!1)};var f={number:c,ordinal:c,spellout:c,duration:function(n,e){var t=n[2],a=r.duration[t]||r.duration.default,i=new Intl.NumberFormat(e,a.seconds).format,o=new Intl.NumberFormat(e,a.minutes).format,s=new Intl.NumberFormat(e,a.hours).format,c=/^fi$|^fi-|^da/.test(String(e))?".":":";return function(n,e){if(n=+n,!isFinite(n))return i(n);var t=~~(n/60/60),r=~~(n/60%60),a=(t?s(Math.abs(t))+c:"")+o(Math.abs(r))+c+i(Math.abs(n%60));return n<0?s(-1).replace(s(1),a):a}},date:l,time:l,plural:u,selectordinal:u,select:function(n,e){var t=n[2];return function(n,e){return(t[n]||t.other)(e)}}};e.types=f}]);',null)}},function(e,t,n){"use strict";var r=window.URL||window.webkitURL;e.exports=function(e,t){try{try{var n;try{(n=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(e),n=n.getBlob()}catch(t){n=new Blob([e])}return new Worker(r.createObjectURL(n))}catch(t){return new Worker("data:application/javascript,"+encodeURIComponent(e))}}catch(e){if(!t)throw Error("Inline worker is not supported");return new Worker(t)}}},function(e,t,n){const r=n(19),i=n(17),s=n(9),o=n(48),a=n(7),c=n(0),l=n(6),u=n(73);e.exports=class extends r{constructor(e,t){super(),t||(t=new i(e)),this.runtime=e,this.id=a(),this.blocks=t,this.variables={},this.comments={},this._customState={},this._edgeActivatedHatValues={},this.extensionStorage={}}onGreenFlag(){}getName(){return this.id}updateEdgeActivatedValue(e,t){const n=this._edgeActivatedHatValues[e];return this._edgeActivatedHatValues[e]=t,n}hasEdgeActivatedValue(e){return Object.prototype.hasOwnProperty.call(this._edgeActivatedHatValues,e)}clearEdgeActivatedValues(){this._edgeActivatedHatValues={}}lookupOrCreateVariable(e,t){let n=this.lookupVariableById(e);if(n)return n;if(n=this.lookupVariableByNameAndType(t,s.SCALAR_TYPE),n)return n;const r=new s(e,t,s.SCALAR_TYPE,!1);return this.variables[e]=r,r}lookupBroadcastMsg(e,t){let n;if(e?n=this.lookupVariableById(e):t?n=this.lookupBroadcastByInputValue(t):c.error("Cannot find broadcast message if neither id nor name are provided."),n)return t&&n.name.toLowerCase()!==t.toLowerCase()&&c.error("Found broadcast message with id: ".concat(e,", but")+"its name, ".concat(n.name," did not match expected name ").concat(t,".")),n.type!==s.BROADCAST_MESSAGE_TYPE&&c.error("Found variable with id: ".concat(e,", but its type ").concat(n.type)+"did not match expected type ".concat(s.BROADCAST_MESSAGE_TYPE)),n}lookupBroadcastByInputValue(e){const t=this.variables;for(const n in t)if(t[n].type===s.BROADCAST_MESSAGE_TYPE&&t[n].name.toLowerCase()===e.toLowerCase())return t[n]}lookupVariableById(e){if(Object.prototype.hasOwnProperty.call(this.variables,e))return this.variables[e];if(this.runtime&&!this.isStage){const t=this.runtime.getTargetForStage();if(t&&Object.prototype.hasOwnProperty.call(t.variables,e))return t.variables[e]}}lookupVariableByNameAndType(e,t,n){if("string"==typeof e){"string"!=typeof t&&(t=s.SCALAR_TYPE),n=n||!1;for(const n in this.variables){const r=this.variables[n];if(r.name===e&&r.type===t)return r}if(!n&&this.runtime&&!this.isStage){const n=this.runtime.getTargetForStage();if(n)for(const r in n.variables){const i=n.variables[r];if(i.name===e&&i.type===t)return i}}return null}}lookupOrCreateList(e,t){let n=this.lookupVariableById(e);if(n)return n;if(n=this.lookupVariableByNameAndType(t,s.LIST_TYPE),n)return n;const r=new s(e,t,s.LIST_TYPE,!1);return this.variables[e]=r,r}createVariable(e,t,n,r){if(!Object.prototype.hasOwnProperty.call(this.variables,e)){const i=new s(e,t,n,!1);r&&this.isStage&&this.runtime.canAddCloudVariable()&&(i.isCloud=!0,this.runtime.addCloudVariable(),this.runtime.ioDevices.cloud.requestCreateVariable(i)),this.variables[e]=i}}createComment(e,t,n,r,i,s,a,l){if(!Object.prototype.hasOwnProperty.call(this.comments,e)){const u=new o(e,n,r,i,s,a,l);if(t){u.blockId=t;const n=this.blocks.getBlock(t);n?n.comment=e:c.warn("Could not find block with id ".concat(t," associated with commentId: ").concat(e))}this.comments[e]=u}}renameVariable(e,t){if(Object.prototype.hasOwnProperty.call(this.variables,e)){const n=this.variables[e];if(n.id===e){const r=n.name;if(n.name=t,this.runtime){if(n.isCloud&&this.isStage&&this.runtime.ioDevices.cloud.requestRenameVariable(r,t),n.type===s.SCALAR_TYPE){let e=!1;this.runtime.targets.forEach((n=>{e=n.blocks.updateSensingOfReference(r,t,this.isStage?"_stage_":this.getName())||e})),e&&this.runtime.requestBlocksUpdate()}const i=this.runtime.monitorBlocks;i.changeBlock({id:e,element:"field",name:n.type===s.LIST_TYPE?"LIST":"VARIABLE",value:e},this.runtime);const o=i.getBlock(n.id);o&&this.runtime.requestUpdateMonitor({id:e,params:i._getBlockParams(o)})}}}}deleteVariable(e){if(Object.prototype.hasOwnProperty.call(this.variables,e)){const t=this.variables[e].name,n=this.variables[e].isCloud;delete this.variables[e],this.runtime&&(n&&this.isStage&&(this.runtime.ioDevices.cloud.requestDeleteVariable(t),this.runtime.removeCloudVariable()),this.runtime.monitorBlocks.deleteBlock(e),this.runtime.requestRemoveMonitor(e))}}deleteMonitors(){let e;this.runtime.requestRemoveMonitorByTargetId(this.id),e=this.isStage?Object.keys(this.variables):Object.keys(this.runtime.monitorBlocks._blocks).filter((e=>this.runtime.monitorBlocks._blocks[e].targetId===this.id));for(const t of e)this.runtime.monitorBlocks.deleteBlock(t)}duplicateVariable(e,t){if(Object.prototype.hasOwnProperty.call(this.variables,e)){const n=this.variables[e],r=new s(t?e:null,n.name,n.type,n.isCloud);return r.type===s.LIST_TYPE?r.value=n.value.slice(0):r.value=n.value,r}return null}duplicateVariables(e){let t;return e&&(t=e.getAllVariableAndListReferences()),Object.keys(this.variables).reduce(((n,r)=>{const i=this.duplicateVariable(r,!e);if(n[i.id]=i,e&&t){const e=t[r];e&&this.mergeVariables(r,i.id,e)}return n}),{})}postSpriteInfo(){}getCustomState(e){return this._customState[e]}setCustomState(e,t){this._customState[e]=t}dispose(){this._customState={},this.runtime&&this.runtime.removeExecutable(this)}getAllVariableNamesInScopeByType(e,t){"string"!=typeof e&&(e=s.SCALAR_TYPE),t=t||!1;const n=Object.values(this.variables).filter((t=>t.type===e)).map((e=>e.name));if(t||this.isStage||!this.runtime)return n;const r=this.runtime.getTargetForStage().getAllVariableNamesInScopeByType(e);return n.concat(r)}mergeVariables(e,t,n,r){const i=n||this.blocks.getAllVariableAndListReferences()[e];u.updateVariableIdentifiers(i,t,r)}shareLocalVariableToStage(e,t){if(!this.runtime)return;const n=this.variables[e];if(!n)return void c.warn("Cannot share a local variable to the stage if it's not local.");const r=this.runtime.getTargetForStage(),i="StageVarFromLocal_".concat(e);let s=r.lookupVariableById(i);if(!s){const e=n.name,t=n.type,r="Stage: ".concat(e);s=this.runtime.createNewGlobalVariable(r,i,t)}this.mergeVariables(e,s.id,t,s.name)}shareLocalVariableToSprite(e,t,n){if(!this.runtime)return;if(this.isStage)return;const r=this.variables[e];if(!r)return void c.warn("Tried to call 'shareLocalVariableToSprite' with a non-local variable.");const i=r.name,o=r.type,a=t.lookupVariableByNameAndType(i,o);let l;if(a)l=a.id;else{const e=new s(null,i,o);l=e.id,t.variables[l]=e}this.mergeVariables(e,l,n)}resolveVariableSharingConflictsWithTarget(e,t){if(this.isStage)return;const n=this.blocks.getAllVariableAndListReferences(e);for(const e in n){if(!this.variables[e])continue;const r=n[e];t.isStage?this.shareLocalVariableToStage(e,r):this.shareLocalVariableToSprite(e,t,r)}}fixUpVariableReferences(){if(!this.runtime)return;if(this.isStage)return;const e=this.runtime.getTargetForStage();if(!e||!e.variables)return;const t=(t,n,r)=>{if(e.lookupVariableByNameAndType(n,r)){const e=l.unusedName("".concat(this.getName(),": ").concat(n),this.getAllVariableNamesInScopeByType(r));return this.renameVariable(t,e),e}return null},n=this.blocks.getAllVariableAndListReferences(),r=[];if(Object.keys(this.variables).length>0)for(const e in this.variables)Object.prototype.hasOwnProperty.call(this.variables,e)&&(n[e]||r.push(e));const i=Object.create(null),s=Object.create(null),o={},a=e=>{const t=o[e];return t||(o[e]=this.runtime.getAllVarNamesOfType(e),o[e])};for(const r in n){const o=n[r][0],c=o.referencingField.value,u=o.type;if(this.lookupVariableById(r)){if(Object.prototype.hasOwnProperty.call(this.variables,r)){const e=t(r,c,u);e&&n[r].map((t=>(t.referencingField.value=e,t)))}}else{const t=e.lookupVariableByNameAndType(c,u);if(t)i[r]||(i[r]=t.id);else{const t=a(u),n=l.unusedName(c,t);e.createVariable(r,n,u),s[r]||(s[r]=n)}}}for(const e in r){const n=r[e];t(n,this.variables[n].name,this.variables[n].type)}for(const e in i){const t=i[e],r=n[e];this.mergeVariables(e,t,r)}for(const e in s){const t=s[e];n[e].map((e=>(e.referencingField.value=t,e)))}}}},function(e,t,n){const r=n(74),i=n(77);e.exports=class{constructor(e){this._canvas=e||document.createElement("canvas"),this._context=this._canvas.getContext("2d"),this._measurements={x:0,y:0,width:0,height:0},this._cachedImage=null,this.loaded=!1}get canvas(){return this._canvas}get size(){return[this._measurements.width,this._measurements.height]}get viewOffset(){return[this._measurements.x,this._measurements.y]}loadString(e,t){this._cachedImage=null;const n=r(e,t);this._svgTag=n,this._measurements={width:n.viewBox.baseVal.width,height:n.viewBox.baseVal.height,x:n.viewBox.baseVal.x,y:n.viewBox.baseVal.y}}loadSVG(e,t,n){this.loadString(e,t),this._createSVGImage(n)}_createSVGImage(e){null===this._cachedImage&&(this._cachedImage=new Image);const t=this._cachedImage;t.onload=()=>{this.loaded=!0,e&&e()};const n=this.toString(!0);t.src=`data:image/svg+xml;utf8,${encodeURIComponent(n)}`,this.loaded=!1}toString(e){return i(this._svgTag,e)}draw(e){if(!this.loaded)throw new Error("SVG image has not finished loading");this._drawFromImage(e)}_drawFromImage(e){if(null===this._cachedImage)return;const t=Number.isFinite(e)?e:1,n=this._measurements;this._canvas.width=n.width*t,this._canvas.height=n.height*t,this._canvas.width<=0||this._canvas.height<=0||this._cachedImage.naturalWidth<=0||this._cachedImage.naturalHeight<=0||(this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.setTransform(t,0,0,t,0,0),this._context.drawImage(this._cachedImage,0,0))}}},function(e,t,n){const r=n(238),i=n(51),s=n(239),o=function(e){return Math.round(1e4*e)/1e4},a=function(e){let t=r.identity();const n=e.attributes&&e.attributes.transform&&e.attributes.transform.value;if(!n)return t;const i=n.split(/\)\s*/g);for(const e of i){if(!e)break;const n=e.split(/\(\s*/),i=n[0].trim(),o=n[1].split(/[\s,]+/g);for(let e=0;e<o.length;e++)o[e]=parseFloat(o[e]);switch(i){case"matrix":t=r.compose(t,{a:o[0],b:o[1],c:o[2],d:o[3],e:o[4],f:o[5]});break;case"rotate":t=r.compose(t,r.rotateDEG(o[0],o[1]||0,o[2]||0));break;case"translate":t=r.compose(t,r.translate(o[0],o[1]||0));break;case"scale":t=r.compose(t,r.scale(o[0],o[1]||o[0]));break;case"skewX":t=r.compose(t,r.skewDEG(o[0],0));break;case"skewY":t=r.compose(t,r.skewDEG(0,o[0]));break;default:s.error(`Couldn't parse: ${i}`)}}return t},c=function(e){const t=e.a,n=e.b,r=e.c,i=e.d,s=t*i-n*r;if(0!==t||0!==n){const e=Math.sqrt(t*t+n*n);return{x:e,y:s/e}}if(0!==r||0!==i){const e=Math.sqrt(r*r+i*i);return{x:s/e,y:e}}return{x:0,y:0}},l=function(e,t,n,r){n=-n*Math.PI/180;const i=r.a,s=-r.c,o=-r.b,a=r.d,c=i*a-s*o;if(0===c)return null;const l=Math.sin(n),u=Math.cos(n),h=Math.sin(2*n),d=u*u/e/e+l*l/t/t,p=h/e/e-h/t/t,f=l*l/e/e+u*u/t/t,m=d*a*a-p*a*o+f*o*o,g=-2*d*s*a+p*i*a+p*s*o-2*f*i*o,b=d*s*s-p*i*s+f*i*i,y=Math.sqrt(2)*Math.sqrt((m+b-Math.sqrt(m*m+g*g-2*m*b+b*b))/(-g*g+4*m*b)),E=1/Math.sqrt(m+b-1/y/y);let T=(m-1/y/y)/(1/E/E-1/y/y);T<0&&Math.abs(T)<1e-8&&(T=0),T=Math.sqrt(T),Math.abs(1-T)<1e-8&&(T=1);let v=Math.asin(T);T=g/(1/y/y-1/E/E);const A=-v;return Math.abs(Math.sin(2*A)-T)<Math.abs(Math.sin(2*v)-T)&&(v=A),{radiusX:y*c,radiusY:E*c,rotation:180*-v/Math.PI}},u=["circle","ellipse","image","line","path","polygon","polyline","rect","text","use"],h=["a","defs","g","marker","glyph","missing-glyph","pattern","svg","switch","symbol"],d=function(e,t){return Math.sqrt((e*e+t*t)/2)},p=function(e,t,n,s){const a=function(e,t,r,s,o,a){let c,l=i.get(e,t);if(null===l?a?(c=a,/%\s*$/.test(c)&&(l=a,c=parseFloat(l))):c=s?null:r?"":0:c=r?l:parseFloat(l),/%\s*$/.test(l)){return c/100*(o?1:n[/x|^width/.test(t)?"width":"height"])}return c},l=function(e,t,n,r,i,s,o){return t=a(e,t||"x",!1,r,i,s),n=a(e,n||"y",!1,r,i,o),!r||null!==t&&null!==n?{x:t,y:n}:null};let u=t.getElementsByTagName("defs");0===u.length?(u=i.create("defs"),t.appendChild(u)):u=u[0];const h=t.getElementById(e);if(!h)return;const p="radialgradient"===h.tagName.toLowerCase(),f=t.getElementById(e).cloneNode(!0);let m=r.toString(s);m=m.substring(8,m.length-1);const g=`${e}-${m}`;if(f.setAttribute("id",g),t.getElementById(g))return`url(#${g})`;const b="userSpaceOnUse"!==a(f,"gradientUnits",!0);let y,E,T,v;if(p)y=l(f,"cx","cy",!1,b,"50%","50%"),T=a(f,"r",!1,!1,b,"50%"),v=l(f,"fx","fy",!0,b);else if(y=l(f,"x1","y1",!1,b),E=l(f,"x2","y2",!1,b,"1"),y.x===E.x&&y.y===E.y){const e=f.getElementsByTagName("stop");return e.length&&e[e.length-1].attributes&&e[e.length-1].attributes["stop-color"]?e[e.length-1].attributes["stop-color"].value:null}if(b){const e=r.compose(r.translate(n.x,n.y),r.scale(n.width,n.height));y=r.applyToPoint(e,y),E&&(E=r.applyToPoint(e,E)),T&&(T=d(n.width,n.height)*T),v&&(v=r.applyToPoint(e,v))}if(p){y=r.applyToPoint(s,y);const e=c(s);T=d(e.x,e.y)*T,v&&(v=r.applyToPoint(s,v))}else{const e=(e,t)=>e.x*t.x+e.y*t.y,t=(e,t)=>({x:e*t.x,y:e*t.y}),n=(e,t)=>({x:e.x+t.x,y:e.y+t.y}),i=(e,t)=>({x:e.x-t.x,y:e.y-t.y});let o=Math.abs(y.x-E.x)<1e-8?n(y,{x:1,y:(y.x-E.x)/(E.y-y.y)}):n(y,{x:(E.y-y.y)/(y.x-E.x),y:1});o=r.applyToPoint(s,o),y=r.applyToPoint(s,y),E=r.applyToPoint(s,E);const a=i(o,y),c=i(E,y),l=Math.abs(a.x)<1e-8?{x:1,y:-a.x/a.y}:{x:-a.y/a.x,y:1},u=t(e(c,l)/e(l,l),l);E={x:y.x+u.x,y:y.y+u.y}}return p?(f.setAttribute("cx",o(y.x)),f.setAttribute("cy",o(y.y)),f.setAttribute("r",o(T)),v&&(f.setAttribute("fx",o(v.x)),f.setAttribute("fy",o(v.y)))):(f.setAttribute("x1",o(y.x)),f.setAttribute("y1",o(y.y)),f.setAttribute("x2",o(E.x)),f.setAttribute("y2",o(E.y))),f.setAttribute("gradientUnits","userSpaceOnUse"),u.appendChild(f),`url(#${g})`},f=(e,t)=>{const n=e&&e.match(/\((?:["'#]*)([^"')]+)/),r=n&&n[1];return r&&t?r.replace(`${t.location.href.split("#")[0]}#`,""):r},m=Object.create(null);let g=null,b=null,y=null;e.exports=function(e,t,n){const s=r.identity(),E=(s,T,v,A,w)=>{if(function(e){return e.tagName&&h.includes(e.tagName.toLowerCase())}(s)){s.attributes["stroke-width"]&&(v=s.attributes["stroke-width"].value),s.attributes&&(s.attributes.fill&&(A=s.attributes.fill.value),s.attributes.stroke&&(w=s.attributes.stroke.value));for(let e=0;e<s.childNodes.length;e++)E(s.childNodes[e],r.compose(T,a(s)),v,A,w);s.removeAttribute("transform"),s.removeAttribute("stroke-width"),s.removeAttribute("fill"),s.removeAttribute("stroke")}else if(function(e,t){return!!e.attributes&&(t=e.attributes["stroke-width"]?Number(e.attributes["stroke-width"].value):Number(t))&&e.tagName&&"path"===e.tagName.toLowerCase()&&e.attributes.d&&e.attributes.d.value}(s,v)){if(s.attributes["stroke-width"]&&(v=s.attributes["stroke-width"].value),s.attributes.fill&&(A=s.attributes.fill.value),s.attributes.stroke&&(w=s.attributes.stroke.value),T=r.compose(T,a(s)),r.toString(T)===r.toString(r.identity()))return s.removeAttribute("transform"),s.setAttribute("stroke-width",v),A&&s.setAttribute("fill",A),void(w&&s.setAttribute("stroke",w));const u=f(A,t),h=f(w,t);if(u||h){const r=n||((e,t)=>{const n=e.attributes.d.value;if(Object.prototype.hasOwnProperty.call(m,n))return m[n];if(!g){const e=t.document;g=e.createElement("span"),b=e.createElementNS(i.svg,"svg"),y=e.createElementNS(i.svg,"path"),g.className="scratch-svg-renderer-bbox",g.style.visibility="hidden",g.style.position="absolute",g.style.top="-10000px",g.style.left="-10000px",g.ariaHidden=!0,b.appendChild(y),g.appendChild(b),document.body.appendChild(g)}y.setAttribute("d",n);const r=b.getBBox();return m[n]=r,r})(s,t);if(u){const t=p(u,e,r,T);t&&(A=t)}if(h){const t=p(h,e,r,T);t&&(w=t)}}s.setAttribute("d",function(e,t){if(!t||r.toString(t)===r.toString(r.identity()))return e;const n=e&&e.match(/[mlhvcsqtaz][^mlhvcsqtaz]*/gi);let i,s,a,u=!1,h={x:0,y:0},d={x:0,y:0},p="";const f=function(e,t){let n=+i[e];return u&&(n+=h[t]),n},m=function(e){return{x:f(e,"x"),y:f(e+1,"y")}},g=function(e){const n=r.applyToPoint(t,e);return`${o(n.x)} ${o(n.y)} `};for(let e=0,r=n&&n.length;e<r;e++){const r=n[e],b=r[0],y=b.toLowerCase();i=r.match(/[+-]?(?:\d*\.\d+|\d+\.?)(?:[eE][+-]?\d+)?/g);const E=i&&i.length;switch(u=b===y,"z"!==s||/[mz]/.test(y)||(p+=`M ${h.x} ${h.y} `),y){case"m":case"l":{let e="m"===y;for(let t=0;t<E;t+=2)p+=e?"M ":"L ",h=m(t),p+=g(h),e&&(d=h,e=!1);a=h;break}case"h":case"v":{const e="h"===y?"x":"y";h={x:h.x,y:h.y};for(let t=0;t<E;t++)h[e]=f(t,e),p+=`L ${g(h)}`;a=h;break}case"c":for(let e=0;e<E;e+=6){const t=m(e);a=m(e+2),h=m(e+4),p+=`C ${g(t)}${g(a)}${g(h)}`}break;case"s":for(let e=0;e<E;e+=4){const t=/[cs]/.test(s)?{x:2*h.x-a.x,y:2*h.y-a.y}:h;a=m(e),h=m(e+2),p+=`C ${g(t)}${g(a)}${g(h)}`,s=y}break;case"q":for(let e=0;e<E;e+=4)a=m(e),h=m(e+2),p+=`Q ${g(a)}${g(h)}`;break;case"t":for(let e=0;e<E;e+=2)a=/[qt]/.test(s)?{x:2*h.x-a.x,y:2*h.y-a.y}:h,h=m(e),p+=`Q ${g(a)}${g(h)}`,s=y;break;case"a":for(let e=0;e<E;e+=7){h=m(e+5);const n=+i[e],r=+i[e+1],s=+i[e+2],a=+i[e+3];let u=+i[e+4];const d=l(n,r,s,t),f=c(t);d?((f.x>0&&f.y<0||f.x<0&&f.y>0)&&(u^=1),p+=`A ${o(Math.abs(d.radiusX))} ${o(Math.abs(d.radiusY))} ${o(d.rotation)} ${a} ${u} ${g(h)}`):p+=`L ${g(h)}`}break;case"z":p+="Z ",h=d}s=y}return p}(s.attributes.d.value,T)),s.removeAttribute("transform");const E=c(T);s.setAttribute("stroke-width",d(E.x,E.y)*v),A&&s.setAttribute("fill",A),w&&s.setAttribute("stroke",w)}else(function(e){return e.tagName&&u.includes(e.tagName.toLowerCase())})(s)&&(v&&!s.attributes["stroke-width"]&&s.setAttribute("stroke-width",v),A&&!s.attributes.fill&&s.setAttribute("fill",A),w&&!s.attributes.stroke&&s.setAttribute("stroke",w),T=r.compose(T,a(s)),r.toString(T)===r.toString(r.identity())?s.removeAttribute("transform"):s.setAttribute("transform",r.toString(T)))};E(e,s,1)}},function(e,t,n){window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";function r(e,t){return Array.isArray(t)?[e.a*t[0]+e.c*t[1]+e.e,e.b*t[0]+e.d*t[1]+e.f]:{x:e.a*t.x+e.c*t.y+e.e,y:e.b*t.x+e.d*t.y+e.f}}function i(e,t){return t.map((function(t){return r(e,t)}))}function s(e){return{a:parseFloat(e.a),b:parseFloat(e.b),c:parseFloat(e.c),d:parseFloat(e.d),e:parseFloat(e.e),f:parseFloat(e.f)}}n.r(t);var o=/^matrix\(\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*,\s*([0-9_+-.e]+)\s*\)$/i;function a(e){var t=e.match(o);if(null===t||t.length<7)throw new Error("'"+e+"' is not a matrix");return{a:parseFloat(t[1]),b:parseFloat(t[2]),c:parseFloat(t[3]),d:parseFloat(t[4]),e:parseFloat(t[5]),f:parseFloat(t[6])}}function c(){return{a:1,c:0,e:0,b:0,d:1,f:0}}function l(e){var t=e.a,n=e.b,r=e.c,i=e.d,s=e.e,o=e.f,a=t*i-n*r;return{a:i/a,b:n/-a,c:r/-a,d:t/a,e:(i*s-r*o)/-a,f:(n*s-t*o)/a}}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h=function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)},d=function(e){return null!=e&&"object"===(void 0===e?"undefined":u(e))};function p(e){return d(e)&&e.hasOwnProperty("a")&&h(e.a)&&e.hasOwnProperty("b")&&h(e.b)&&e.hasOwnProperty("c")&&h(e.c)&&e.hasOwnProperty("d")&&h(e.d)&&e.hasOwnProperty("e")&&h(e.e)&&e.hasOwnProperty("f")&&h(e.f)}function f(e){return void 0===e}function m(e){return{a:1,c:0,e:e,b:0,d:1,f:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}}function g(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];var r=function(e,t){return{a:e.a*t.a+e.c*t.b,c:e.a*t.c+e.c*t.d,e:e.a*t.e+e.c*t.f+e.e,b:e.b*t.a+e.d*t.b,d:e.b*t.c+e.d*t.d,f:e.b*t.e+e.d*t.f+e.f}};switch((t=Array.isArray(t[0])?t[0]:t).length){case 0:throw new Error("no matrices provided");case 1:return t[0];case 2:return r(t[0],t[1]);default:var i=function(e){return Array.isArray(e)?e:Array.from(e)}(t),s=i[0],o=i[1],a=i.slice(2),c=r(s,o);return g.apply(void 0,[c].concat(function(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}(a)))}}function b(){return g.apply(void 0,arguments)}var y=Math.cos,E=Math.sin,T=Math.PI;function v(e,t,n){var r=y(e),i=E(e),s={a:r,c:-i,e:0,b:i,d:r,f:0};return f(t)||f(n)?s:g([m(t,n),s,m(-t,-n)])}function A(e){return v(e*T/180,arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0)}function w(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return f(t)&&(t=e),{a:e,c:0,e:0,b:0,d:t,f:0}}function S(e,t){return{a:1,c:e,e:0,b:t,d:1,f:0}}var k=Math.tan;function O(e,t){return{a:1,c:k(e),e:0,b:k(t),d:1,f:0}}function I(e,t){return O(e*Math.PI/180,t*Math.PI/180)}function N(e){return x(e)}function R(e){return x(e)}function x(e){return"matrix("+e.a+","+e.b+","+e.c+","+e.d+","+e.e+","+e.f+")"}n.d(t,"applyToPoint",(function(){return r})),n.d(t,"applyToPoints",(function(){return i})),n.d(t,"fromObject",(function(){return s})),n.d(t,"fromString",(function(){return a})),n.d(t,"identity",(function(){return c})),n.d(t,"inverse",(function(){return l})),n.d(t,"isAffineMatrix",(function(){return p})),n.d(t,"rotate",(function(){return v})),n.d(t,"rotateDEG",(function(){return A})),n.d(t,"scale",(function(){return w})),n.d(t,"shear",(function(){return S})),n.d(t,"skew",(function(){return O})),n.d(t,"skewDEG",(function(){return I})),n.d(t,"toCSS",(function(){return N})),n.d(t,"toSVG",(function(){return R})),n.d(t,"toString",(function(){return x})),n.d(t,"transform",(function(){return g})),n.d(t,"compose",(function(){return b})),n.d(t,"translate",(function(){return m}))}])},function(e,t,n){const r=n(29);r.enable(),e.exports=r("scratch-svg-render")},function(e,t){let n=null;e.exports=()=>(n||(n=document.createElement("iframe"),n.className="scratch-svg-renderer-sandbox",n.sandbox="allow-same-origin",n.style.position="absolute",n.style.top="-10000px",n.style.left="-10000px",n.style.width="0",n.style.height="0",n.style.opacity="0",n.style.visibility="hidden",n.style.pointerEvents="none",n.tabIndex=-1,n.ariaHidden=!0,document.body.appendChild(n),n.contentDocument.open(),n.contentDocument.write('\n        <!DOCTYPE html>\n        <html>\n            <head>\n                <meta charset="utf-8">\n                <meta http-equiv="Content-Security-Policy" content="default-src \'none\'; style-src \'unsafe-inline\' data:; font-src data:; img-src data:">\n            </head>\n            <body></body>\n        </html>\n        '),n.contentDocument.close()),n.contentDocument.body)},function(e,t,n){let r;e.exports=function(){if(r)return r;r={"Sans Serif":n(242),Serif:n(243),Handwriting:n(244),Marker:n(245),Curly:n(246),Pixel:n(247),Scratch:n(248)};for(const e in r){const t=r[e];r[e]="@font-face {"+'font-family: "'.concat(e,'";src: url("data:font/woff2;base64,').concat(t,'");}')}if(!document.getElementById("scratch-font-styles")){let e="";for(const t in r)e+=r[t];const t=document.createElement("style");t.id="scratch-font-styles",t.textContent=e,document.body.insertBefore(t,document.body.firstChild)}return r}},function(e,t){e.exports=" "},function(e,t){e.exports=" "},function(e,t){e.exports=" "},function(e,t){e.exports=" "},function(e,t){e.exports=" "},function(e,t){e.exports=" "},function(e,t){e.exports=" "},function(e,t,n){const r=n(250);e.exports=class{constructor(e,t){this._makeImage=e||(()=>new Image),this._makeCanvas=t||(()=>document.createElement("canvas")),this.stageWidth=480,this.stageHeight=360}setStageSize(e,t){this.stageWidth=e,this.stageHeight=t}resize(e,t,n){const r=this._makeCanvas();r.width=t,r.height=e.height;let i=r.getContext("2d");i.imageSmoothingEnabled=!1,i.drawImage(e,0,0,r.width,r.height);const s=this._makeCanvas();return s.width=t,s.height=n,i=s.getContext("2d"),i.imageSmoothingEnabled=!1,i.drawImage(r,0,0,s.width,s.height),s}convertResolution1Bitmap(e,t){const n=this._makeImage();n.src=e,n.onload=()=>{t(null,this.resize(n,2*n.width,2*n.height).toDataURL())},n.onerror=()=>{t("Image load failed")}}getResizedWidthHeight(e,t){const n=this.stageWidth,r=this.stageHeight;if(e<=n&&t<=r)return{width:2*e,height:2*t};if(e<=2*n&&t<=2*r)return{width:e,height:t};const i=e/t;return i>=n/r?{width:2*n,height:2*n/i}:{width:2*r*i,height:2*r}}importBitmap(e,t){let n=e;return e instanceof ArrayBuffer&&(n=this.convertBinaryToDataURI(e,t)),new Promise(((e,t)=>{const r=this._makeImage();r.src=n,r.onload=()=>{const t=this.getResizedWidthHeight(r.width,r.height),n=this.resize(r,t.width,t.height).toDataURL();e(this.convertDataURIToBinary(n))},r.onerror=()=>{t("Image load failed")}}))}convertDataURIToBinary(e){const t=";base64,",n=e.indexOf(t)+8,r=e.substring(n),i=window.atob(r),s=i.length,o=new Uint8Array(new ArrayBuffer(s));for(let e=0;e<s;e++)o[e]=i.charCodeAt(e);return o}convertBinaryToDataURI(e,t){return`data:${t};base64,${r.fromByteArray(new Uint8Array(e))}`}}},function(e,t,n){"use strict";t.byteLength=function(e){return 3*e.length/4-c(e)},t.toByteArray=function(e){var t,n,r,o,a,l=e.length;o=c(e),a=new s(3*l/4-o),n=o>0?l-4:l;var u=0;for(t=0;t<n;t+=4)r=i[e.charCodeAt(t)]<<18|i[e.charCodeAt(t+1)]<<12|i[e.charCodeAt(t+2)]<<6|i[e.charCodeAt(t+3)],a[u++]=r>>16&255,a[u++]=r>>8&255,a[u++]=255&r;2===o?(r=i[e.charCodeAt(t)]<<2|i[e.charCodeAt(t+1)]>>4,a[u++]=255&r):1===o&&(r=i[e.charCodeAt(t)]<<10|i[e.charCodeAt(t+1)]<<4|i[e.charCodeAt(t+2)]>>2,a[u++]=r>>8&255,a[u++]=255&r);return a},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s="",o=[],a=16383,c=0,u=n-i;c<u;c+=a)o.push(l(e,c,c+a>u?u:c+a));1===i?(t=e[n-1],s+=r[t>>2],s+=r[t<<4&63],s+="=="):2===i&&(t=(e[n-2]<<8)+e[n-1],s+=r[t>>10],s+=r[t>>4&63],s+=r[t<<2&63],s+="=");return o.push(s),o.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=o[a],i[o.charCodeAt(a)]=a;function c(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===e[t-2]?2:"="===e[t-1]?1:0}function l(e,t,n){for(var i,s,o=[],a=t;a<n;a+=3)i=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return o.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t,n){const r=n(76),i=n(50),s={sanitizeByteStream:function(e){const t=new TextDecoder,n=new TextEncoder,r=s.sanitizeSvgText(t.decode(e));return n.encode(r)}},o=`<!${"-".repeat(2)}`,a=`${"-".repeat(2)}>`,c=new RegExp(`${o}rotationCenter:(-?[\\d\\.]+):(-?[\\d\\.]+)${a}$`);s.sanitizeSvgText=function(e){let t=i.sanitize(e,{USE_PROFILES:{svg:!0}});t.indexOf("]&gt;")>=0&&(t=t.substring(5,t.length)),t=r(t);const n=e.match(c);return n&&(t+=n[0]),t},e.exports=s},function(e,t){e.exports=e=>{const t=(new TextDecoder).decode(e),n=(new DOMParser).parseFromString(t,"image/svg+xml"),r=n.documentElement;let i=!1;if(i=(e=>"100%"===e.getAttribute("width")&&"100%"===e.getAttribute("height")&&(e.removeAttribute("width"),e.removeAttribute("height"),!0))(r)||i,i=(e=>{let t=!1;const n=e=>{"rect"===e.tagName&&(e.hasAttribute("rx")&&!e.hasAttribute("ry")?(t=!0,e.setAttribute("ry",e.getAttribute("rx"))):e.hasAttribute("ry")&&!e.hasAttribute("rx")&&(t=!0,e.setAttribute("rx",e.getAttribute("ry"))));const r=e.childNodes;if(r)for(let e=0;e<r.length;e++)n(r[e])};return n(e),t})(r)||i,i){const e=(new XMLSerializer).serializeToString(n);return(new TextEncoder).encode(e)}return e}},function(e,t){const n=function(e,t,n){const r=n?[e.getTargetById(n)]:e.targets,i=[];for(let e=0;e<r.length;e++){const n=r[e].sprite[t];for(let e=0;e<n.length;e++){const t=n[e],r=t.broken?t.broken.asset:t.asset;r&&i.push({fileName:"".concat(r.assetId,".").concat(r.dataFormat),fileContent:r.data})}}return i};e.exports={serializeSounds:function(e,t){return n(e,"sounds",t)},serializeCostumes:function(e,t){return n(e,"costumes",t)}}},function(e,t){!function(e){"use strict";var t,n=e.Uint8Array,r=e.HTMLCanvasElement,i=r&&r.prototype,s=/\s*;\s*base64\s*(?:;|$)/i,o="toDataURL",a=function(e){for(var r,i,s=e.length,o=new n(s/4*3|0),a=0,c=0,l=[0,0],u=0,h=0;s--;)i=e.charCodeAt(a++),255!==(r=t[i-43])&&undefined!==r&&(l[1]=l[0],l[0]=i,h=h<<6|r,4===++u&&(o[c++]=h>>>16,61!==l[1]&&(o[c++]=h>>>8),61!==l[0]&&(o[c++]=h),u=0));return o};n&&(t=new n([62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,0,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51])),!r||i.toBlob&&i.toBlobHD||(i.toBlob||(i.toBlob=function(e,t){if(t||(t="image/png"),this.mozGetAsFile)e(this.mozGetAsFile("canvas",t));else if(this.msToBlob&&/^\s*image\/png\s*(?:$|;)/i.test(t))e(this.msToBlob());else{var r,i=Array.prototype.slice.call(arguments,1),c=this[o].apply(this,i),l=c.indexOf(","),u=c.substring(l+1),h=s.test(c.substring(0,l));Blob.fake?((r=new Blob).encoding=h?"base64":"URI",r.data=u,r.size=u.length):n&&(r=h?new Blob([a(u)],{type:t}):new Blob([decodeURIComponent(u)],{type:t})),e(r)}}),!i.toBlobHD&&i.toDataURLHD?i.toBlobHD=function(){o="toDataURLHD";var e=this.toBlob();return o="toDataURL",e}:i.toBlobHD=i.toBlob)}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content||this)},function(e,t,n){(function(t){var r=n(256);e.exports=function(e,n,i){if("string"==typeof e)return i(null,[e,null]);if(!t.isBuffer(e))try{e=new t(e)}catch(e){return i("Input must be a Buffer or a string.")}var s=e.slice(0,3).join(" "),o=!1,a=!1;if(0===s.indexOf("83 99 114")&&(o=!0),0===s.indexOf("80 75")&&(a=!0),!a&&!o){return i(null,[(new TextDecoder).decode(e),null])}if(o)return i("Parser only supports Scratch 2.X and above");r(e,n,i)}}).call(this,n(18).Buffer)},function(e,t,n){var r=n(22);e.exports=function(e,t,n){var i="Failed to unzip and extract project.json, with error: ";return r.loadAsync(e).then((function(e){const r=t?e.file(/^([^/]*\/)?sprite\.json$/)[0]:e.file(/^([^/]*\/)?project\.json$/)[0];return r?r.async("string").then((function(t){return n(null,[t,e])})):n(i+"missing project or sprite json")})).catch((function(e){return n(i+e)}))}},function(e,t,n){const r=n(62);e.exports=function(e,t){var n;try{n=r.parse(e.replace(/(\\+)(b|u0008)/g,((e,t,n)=>t.length%2?e.replace("\\"+n,""):e)))}catch(e){return t(e.toString())}return t(null,n)}},function(e,t){e.exports=function(e,t,n){if("objName"in t)return t.projectVersion=2,n(null,t);if(e){if("name"in t)return t.projectVersion=3,n(null,t)}else if("targets"in t)return t.projectVersion=3,n(null,t);n(new Error("Could not parse as a valid SB2 or SB3 project."))}},function(e,t){(function(t){e.exports=t}).call(this,{})},function(e,t){const n="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!#%()*+,-./:;=?@[]^_`{|}~",r=e=>{let t="";for(;e>=0;)t=n[e%77]+t,e=Math.floor(e/77)-1;return t};class i{constructor(){this.generatedIds=new Map,this.references=new Map,this.skippedIds=new Set,this.skippedIds.add("of")}skip(e){this.skippedIds.add(e)}addReference(e){const t=this.references.get(e)||0;this.references.set(e,t+1)}generateNewIds(){const e=Array.from(this.references.entries());e.sort(((e,t)=>t[1]-e[1]));let t=0;for(const n of e){const e=n[0];let i=r(t);for(;this.skippedIds.has(i);)t++,i=r(t);this.generatedIds.set(e,i),t++}}getNewId(e){return this.generatedIds.has(e)?this.generatedIds.get(e):e}}e.exports=e=>{const t=new i;for(const n of e.targets){for(const e of Object.keys(n.variables))t.skip(e);for(const e of Object.keys(n.lists))t.skip(e);for(const e of Object.keys(n.broadcasts))t.skip(e);for(const e of Object.keys(n.blocks)){const r=n.blocks[e];if(t.addReference(e),!Array.isArray(r)){r.parent&&t.addReference(r.parent),r.next&&t.addReference(r.next),r.comment&&t.addReference(r.comment);for(const e of Object.values(r.inputs))for(let n=1;n<e.length;n++){const r=e[n];"string"==typeof r&&t.addReference(r)}}}for(const e of Object.keys(n.comments)){const r=n.comments[e];t.addReference(e),r.blockId&&t.addReference(r.blockId)}}t.generateNewIds();for(const n of e.targets){const e={},r={};for(const r of Object.keys(n.blocks)){const i=n.blocks[r];if(e[t.getNewId(r)]=i,!Array.isArray(i)){i.parent&&(i.parent=t.getNewId(i.parent)),i.next&&(i.next=t.getNewId(i.next)),i.comment&&(i.comment=t.getNewId(i.comment));for(const e of Object.values(i.inputs))for(let n=1;n<e.length;n++){const r=e[n];"string"==typeof r&&(e[n]=t.getNewId(r))}}}for(const e of Object.keys(n.comments)){const i=n.comments[e];r[t.getNewId(e)]=i,i.blockId&&(i.blockId=t.getNewId(i.blockId))}n.blocks=e,n.comments=r}}},function(e,t,n){const r=n(9),i={"forward:":{opcode:"motion_movesteps",argMap:[{type:"input",inputOp:"math_number",inputName:"STEPS"}]},"turnRight:":{opcode:"motion_turnright",argMap:[{type:"input",inputOp:"math_number",inputName:"DEGREES"}]},"turnLeft:":{opcode:"motion_turnleft",argMap:[{type:"input",inputOp:"math_number",inputName:"DEGREES"}]},"heading:":{opcode:"motion_pointindirection",argMap:[{type:"input",inputOp:"math_angle",inputName:"DIRECTION"}]},"pointTowards:":{opcode:"motion_pointtowards",argMap:[{type:"input",inputOp:"motion_pointtowards_menu",inputName:"TOWARDS"}]},"gotoX:y:":{opcode:"motion_gotoxy",argMap:[{type:"input",inputOp:"math_number",inputName:"X"},{type:"input",inputOp:"math_number",inputName:"Y"}]},"gotoSpriteOrMouse:":{opcode:"motion_goto",argMap:[{type:"input",inputOp:"motion_goto_menu",inputName:"TO"}]},"glideSecs:toX:y:elapsed:from:":{opcode:"motion_glidesecstoxy",argMap:[{type:"input",inputOp:"math_number",inputName:"SECS"},{type:"input",inputOp:"math_number",inputName:"X"},{type:"input",inputOp:"math_number",inputName:"Y"}]},"changeXposBy:":{opcode:"motion_changexby",argMap:[{type:"input",inputOp:"math_number",inputName:"DX"}]},"xpos:":{opcode:"motion_setx",argMap:[{type:"input",inputOp:"math_number",inputName:"X"}]},"changeYposBy:":{opcode:"motion_changeyby",argMap:[{type:"input",inputOp:"math_number",inputName:"DY"}]},"ypos:":{opcode:"motion_sety",argMap:[{type:"input",inputOp:"math_number",inputName:"Y"}]},bounceOffEdge:{opcode:"motion_ifonedgebounce",argMap:[]},setRotationStyle:{opcode:"motion_setrotationstyle",argMap:[{type:"field",fieldName:"STYLE"}]},xpos:{opcode:"motion_xposition",argMap:[]},ypos:{opcode:"motion_yposition",argMap:[]},heading:{opcode:"motion_direction",argMap:[]},scrollRight:{opcode:"motion_scroll_right",argMap:[{type:"input",inputOp:"math_number",inputName:"DISTANCE"}]},scrollUp:{opcode:"motion_scroll_up",argMap:[{type:"input",inputOp:"math_number",inputName:"DISTANCE"}]},scrollAlign:{opcode:"motion_align_scene",argMap:[{type:"field",fieldName:"ALIGNMENT"}]},xScroll:{opcode:"motion_xscroll",argMap:[]},yScroll:{opcode:"motion_yscroll",argMap:[]},"say:duration:elapsed:from:":{opcode:"looks_sayforsecs",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"},{type:"input",inputOp:"math_number",inputName:"SECS"}]},"say:":{opcode:"looks_say",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"}]},"think:duration:elapsed:from:":{opcode:"looks_thinkforsecs",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"},{type:"input",inputOp:"math_number",inputName:"SECS"}]},"think:":{opcode:"looks_think",argMap:[{type:"input",inputOp:"text",inputName:"MESSAGE"}]},show:{opcode:"looks_show",argMap:[]},hide:{opcode:"looks_hide",argMap:[]},hideAll:{opcode:"looks_hideallsprites",argMap:[]},"lookLike:":{opcode:"looks_switchcostumeto",argMap:[{type:"input",inputOp:"looks_costume",inputName:"COSTUME"}]},nextCostume:{opcode:"looks_nextcostume",argMap:[]},startScene:{opcode:"looks_switchbackdropto",argMap:[{type:"input",inputOp:"looks_backdrops",inputName:"BACKDROP"}]},"changeGraphicEffect:by:":{opcode:"looks_changeeffectby",argMap:[{type:"field",fieldName:"EFFECT"},{type:"input",inputOp:"math_number",inputName:"CHANGE"}]},"setGraphicEffect:to:":{opcode:"looks_seteffectto",argMap:[{type:"field",fieldName:"EFFECT"},{type:"input",inputOp:"math_number",inputName:"VALUE"}]},filterReset:{opcode:"looks_cleargraphiceffects",argMap:[]},"changeSizeBy:":{opcode:"looks_changesizeby",argMap:[{type:"input",inputOp:"math_number",inputName:"CHANGE"}]},"setSizeTo:":{opcode:"looks_setsizeto",argMap:[{type:"input",inputOp:"math_number",inputName:"SIZE"}]},"changeStretchBy:":{opcode:"looks_changestretchby",argMap:[{type:"input",inputOp:"math_number",inputName:"CHANGE"}]},"setStretchTo:":{opcode:"looks_setstretchto",argMap:[{type:"input",inputOp:"math_number",inputName:"STRETCH"}]},comeToFront:{opcode:"looks_gotofrontback",argMap:[]},"goBackByLayers:":{opcode:"looks_goforwardbackwardlayers",argMap:[{type:"input",inputOp:"math_integer",inputName:"NUM"}]},costumeIndex:{opcode:"looks_costumenumbername",argMap:[]},costumeName:{opcode:"looks_costumenumbername",argMap:[]},sceneName:{opcode:"looks_backdropnumbername",argMap:[]},scale:{opcode:"looks_size",argMap:[]},startSceneAndWait:{opcode:"looks_switchbackdroptoandwait",argMap:[{type:"input",inputOp:"looks_backdrops",inputName:"BACKDROP"}]},nextScene:{opcode:"looks_nextbackdrop",argMap:[]},backgroundIndex:{opcode:"looks_backdropnumbername",argMap:[]},"playSound:":{opcode:"sound_play",argMap:[{type:"input",inputOp:"sound_sounds_menu",inputName:"SOUND_MENU"}]},doPlaySoundAndWait:{opcode:"sound_playuntildone",argMap:[{type:"input",inputOp:"sound_sounds_menu",inputName:"SOUND_MENU"}]},stopAllSounds:{opcode:"sound_stopallsounds",argMap:[]},playDrum:{opcode:"music_playDrumForBeats",argMap:[{type:"input",inputOp:"music_menu_DRUM",inputName:"DRUM"},{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"drum:duration:elapsed:from:":{opcode:"music_midiPlayDrumForBeats",argMap:[{type:"input",inputOp:"math_number",inputName:"DRUM"},{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"rest:elapsed:from:":{opcode:"music_restForBeats",argMap:[{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"noteOn:duration:elapsed:from:":{opcode:"music_playNoteForBeats",argMap:[{type:"input",inputOp:"note",inputName:"NOTE"},{type:"input",inputOp:"math_number",inputName:"BEATS"}]},"instrument:":{opcode:"music_setInstrument",argMap:[{type:"input",inputOp:"music_menu_INSTRUMENT",inputName:"INSTRUMENT"}]},"midiInstrument:":{opcode:"music_midiSetInstrument",argMap:[{type:"input",inputOp:"math_number",inputName:"INSTRUMENT"}]},"changeVolumeBy:":{opcode:"sound_changevolumeby",argMap:[{type:"input",inputOp:"math_number",inputName:"VOLUME"}]},"setVolumeTo:":{opcode:"sound_setvolumeto",argMap:[{type:"input",inputOp:"math_number",inputName:"VOLUME"}]},volume:{opcode:"sound_volume",argMap:[]},"changeTempoBy:":{opcode:"music_changeTempo",argMap:[{type:"input",inputOp:"math_number",inputName:"TEMPO"}]},"setTempoTo:":{opcode:"music_setTempo",argMap:[{type:"input",inputOp:"math_number",inputName:"TEMPO"}]},tempo:{opcode:"music_getTempo",argMap:[]},clearPenTrails:{opcode:"pen_clear",argMap:[]},stampCostume:{opcode:"pen_stamp",argMap:[]},putPenDown:{opcode:"pen_penDown",argMap:[]},putPenUp:{opcode:"pen_penUp",argMap:[]},"penColor:":{opcode:"pen_setPenColorToColor",argMap:[{type:"input",inputOp:"colour_picker",inputName:"COLOR"}]},"changePenHueBy:":{opcode:"pen_changePenHueBy",argMap:[{type:"input",inputOp:"math_number",inputName:"HUE"}]},"setPenHueTo:":{opcode:"pen_setPenHueToNumber",argMap:[{type:"input",inputOp:"math_number",inputName:"HUE"}]},"changePenShadeBy:":{opcode:"pen_changePenShadeBy",argMap:[{type:"input",inputOp:"math_number",inputName:"SHADE"}]},"setPenShadeTo:":{opcode:"pen_setPenShadeToNumber",argMap:[{type:"input",inputOp:"math_number",inputName:"SHADE"}]},"changePenSizeBy:":{opcode:"pen_changePenSizeBy",argMap:[{type:"input",inputOp:"math_number",inputName:"SIZE"}]},"penSize:":{opcode:"pen_setPenSizeTo",argMap:[{type:"input",inputOp:"math_number",inputName:"SIZE"}]},senseVideoMotion:{opcode:"videoSensing_videoOn",argMap:[{type:"input",inputOp:"videoSensing_menu_ATTRIBUTE",inputName:"ATTRIBUTE"},{type:"input",inputOp:"videoSensing_menu_SUBJECT",inputName:"SUBJECT"}]},whenGreenFlag:{opcode:"event_whenflagclicked",argMap:[]},whenKeyPressed:{opcode:"event_whenkeypressed",argMap:[{type:"field",fieldName:"KEY_OPTION"}]},whenClicked:{opcode:"event_whenthisspriteclicked",argMap:[]},whenSceneStarts:{opcode:"event_whenbackdropswitchesto",argMap:[{type:"field",fieldName:"BACKDROP"}]},whenSensorGreaterThan:e=>{let[,t]=e;return"video motion"===t?{opcode:"videoSensing_whenMotionGreaterThan",argMap:[{},{type:"input",inputOp:"math_number",inputName:"REFERENCE"}]}:{opcode:"event_whengreaterthan",argMap:[{type:"field",fieldName:"WHENGREATERTHANMENU"},{type:"input",inputOp:"math_number",inputName:"VALUE"}]}},whenIReceive:{opcode:"event_whenbroadcastreceived",argMap:[{type:"field",fieldName:"BROADCAST_OPTION",variableType:r.BROADCAST_MESSAGE_TYPE}]},"broadcast:":{opcode:"event_broadcast",argMap:[{type:"input",inputOp:"event_broadcast_menu",inputName:"BROADCAST_INPUT",variableType:r.BROADCAST_MESSAGE_TYPE}]},doBroadcastAndWait:{opcode:"event_broadcastandwait",argMap:[{type:"input",inputOp:"event_broadcast_menu",inputName:"BROADCAST_INPUT",variableType:r.BROADCAST_MESSAGE_TYPE}]},"wait:elapsed:from:":{opcode:"control_wait",argMap:[{type:"input",inputOp:"math_positive_number",inputName:"DURATION"}]},doRepeat:{opcode:"control_repeat",argMap:[{type:"input",inputOp:"math_whole_number",inputName:"TIMES"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doForever:{opcode:"control_forever",argMap:[{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doIf:{opcode:"control_if",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doIfElse:{opcode:"control_if_else",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"},{type:"input",inputOp:"substack",inputName:"SUBSTACK2"}]},doWaitUntil:{opcode:"control_wait_until",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"}]},doUntil:{opcode:"control_repeat_until",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doWhile:{opcode:"control_while",argMap:[{type:"input",inputOp:"boolean",inputName:"CONDITION"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},doForLoop:{opcode:"control_for_each",argMap:[{type:"field",fieldName:"VARIABLE"},{type:"input",inputOp:"text",inputName:"VALUE"},{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},stopScripts:{opcode:"control_stop",argMap:[{type:"field",fieldName:"STOP_OPTION"}]},whenCloned:{opcode:"control_start_as_clone",argMap:[]},createCloneOf:{opcode:"control_create_clone_of",argMap:[{type:"input",inputOp:"control_create_clone_of_menu",inputName:"CLONE_OPTION"}]},deleteClone:{opcode:"control_delete_this_clone",argMap:[]},COUNT:{opcode:"control_get_counter",argMap:[]},INCR_COUNT:{opcode:"control_incr_counter",argMap:[]},CLR_COUNT:{opcode:"control_clear_counter",argMap:[]},warpSpeed:{opcode:"control_all_at_once",argMap:[{type:"input",inputOp:"substack",inputName:"SUBSTACK"}]},"touching:":{opcode:"sensing_touchingobject",argMap:[{type:"input",inputOp:"sensing_touchingobjectmenu",inputName:"TOUCHINGOBJECTMENU"}]},"touchingColor:":{opcode:"sensing_touchingcolor",argMap:[{type:"input",inputOp:"colour_picker",inputName:"COLOR"}]},"color:sees:":{opcode:"sensing_coloristouchingcolor",argMap:[{type:"input",inputOp:"colour_picker",inputName:"COLOR"},{type:"input",inputOp:"colour_picker",inputName:"COLOR2"}]},"distanceTo:":{opcode:"sensing_distanceto",argMap:[{type:"input",inputOp:"sensing_distancetomenu",inputName:"DISTANCETOMENU"}]},doAsk:{opcode:"sensing_askandwait",argMap:[{type:"input",inputOp:"text",inputName:"QUESTION"}]},answer:{opcode:"sensing_answer",argMap:[]},"keyPressed:":{opcode:"sensing_keypressed",argMap:[{type:"input",inputOp:"sensing_keyoptions",inputName:"KEY_OPTION"}]},mousePressed:{opcode:"sensing_mousedown",argMap:[]},mouseX:{opcode:"sensing_mousex",argMap:[]},mouseY:{opcode:"sensing_mousey",argMap:[]},soundLevel:{opcode:"sensing_loudness",argMap:[]},isLoud:{opcode:"sensing_loud",argMap:[]},setVideoState:{opcode:"videoSensing_videoToggle",argMap:[{type:"input",inputOp:"videoSensing_menu_VIDEO_STATE",inputName:"VIDEO_STATE"}]},setVideoTransparency:{opcode:"videoSensing_setVideoTransparency",argMap:[{type:"input",inputOp:"math_number",inputName:"TRANSPARENCY"}]},timer:{opcode:"sensing_timer",argMap:[]},timerReset:{opcode:"sensing_resettimer",argMap:[]},"getAttribute:of:":{opcode:"sensing_of",argMap:[{type:"field",fieldName:"PROPERTY"},{type:"input",inputOp:"sensing_of_object_menu",inputName:"OBJECT"}]},timeAndDate:{opcode:"sensing_current",argMap:[{type:"field",fieldName:"CURRENTMENU"}]},timestamp:{opcode:"sensing_dayssince2000",argMap:[]},getUserName:{opcode:"sensing_username",argMap:[]},getUserId:{opcode:"sensing_userid",argMap:[]},"+":{opcode:"operator_add",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"-":{opcode:"operator_subtract",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"*":{opcode:"operator_multiply",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"/":{opcode:"operator_divide",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},"randomFrom:to:":{opcode:"operator_random",argMap:[{type:"input",inputOp:"math_number",inputName:"FROM"},{type:"input",inputOp:"math_number",inputName:"TO"}]},"<":{opcode:"operator_lt",argMap:[{type:"input",inputOp:"text",inputName:"OPERAND1"},{type:"input",inputOp:"text",inputName:"OPERAND2"}]},"=":{opcode:"operator_equals",argMap:[{type:"input",inputOp:"text",inputName:"OPERAND1"},{type:"input",inputOp:"text",inputName:"OPERAND2"}]},">":{opcode:"operator_gt",argMap:[{type:"input",inputOp:"text",inputName:"OPERAND1"},{type:"input",inputOp:"text",inputName:"OPERAND2"}]},"&":{opcode:"operator_and",argMap:[{type:"input",inputOp:"boolean",inputName:"OPERAND1"},{type:"input",inputOp:"boolean",inputName:"OPERAND2"}]},"|":{opcode:"operator_or",argMap:[{type:"input",inputOp:"boolean",inputName:"OPERAND1"},{type:"input",inputOp:"boolean",inputName:"OPERAND2"}]},not:{opcode:"operator_not",argMap:[{type:"input",inputOp:"boolean",inputName:"OPERAND"}]},"concatenate:with:":{opcode:"operator_join",argMap:[{type:"input",inputOp:"text",inputName:"STRING1"},{type:"input",inputOp:"text",inputName:"STRING2"}]},"letter:of:":{opcode:"operator_letter_of",argMap:[{type:"input",inputOp:"math_whole_number",inputName:"LETTER"},{type:"input",inputOp:"text",inputName:"STRING"}]},"stringLength:":{opcode:"operator_length",argMap:[{type:"input",inputOp:"text",inputName:"STRING"}]},"%":{opcode:"operator_mod",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM1"},{type:"input",inputOp:"math_number",inputName:"NUM2"}]},rounded:{opcode:"operator_round",argMap:[{type:"input",inputOp:"math_number",inputName:"NUM"}]},"computeFunction:of:":{opcode:"operator_mathop",argMap:[{type:"field",fieldName:"OPERATOR"},{type:"input",inputOp:"math_number",inputName:"NUM"}]},readVariable:{opcode:"data_variable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"getVar:":{opcode:"data_variable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"setVar:to:":{opcode:"data_setvariableto",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE},{type:"input",inputOp:"text",inputName:"VALUE"}]},"changeVar:by:":{opcode:"data_changevariableby",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE},{type:"input",inputOp:"math_number",inputName:"VALUE"}]},"showVariable:":{opcode:"data_showvariable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"hideVariable:":{opcode:"data_hidevariable",argMap:[{type:"field",fieldName:"VARIABLE",variableType:r.SCALAR_TYPE}]},"contentsOfList:":{opcode:"data_listcontents",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"append:toList:":{opcode:"data_addtolist",argMap:[{type:"input",inputOp:"text",inputName:"ITEM"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"deleteLine:ofList:":{opcode:"data_deleteoflist",argMap:[{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"insert:at:ofList:":{opcode:"data_insertatlist",argMap:[{type:"input",inputOp:"text",inputName:"ITEM"},{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"setLine:ofList:to:":{opcode:"data_replaceitemoflist",argMap:[{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE},{type:"input",inputOp:"text",inputName:"ITEM"}]},"getLine:ofList:":{opcode:"data_itemoflist",argMap:[{type:"input",inputOp:"math_integer",inputName:"INDEX"},{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"lineCountOfList:":{opcode:"data_lengthoflist",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"list:contains:":{opcode:"data_listcontainsitem",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE},{type:"input",inputOp:"text",inputName:"ITEM"}]},"showList:":{opcode:"data_showlist",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},"hideList:":{opcode:"data_hidelist",argMap:[{type:"field",fieldName:"LIST",variableType:r.LIST_TYPE}]},procDef:{opcode:"procedures_definition",argMap:[]},getParam:{opcode:"argument_reporter_string_number",argMap:[{type:"field",fieldName:"VALUE"}]},call:{opcode:"procedures_call",argMap:[]}},s=function(e,t,n){i["".concat(e).concat("").concat(t)]=n,i["".concat(e,".").concat(t)]=n},o="LEGO WeDo 2.0";s(o,"motorOnFor",{opcode:"wedo2_motorOnFor",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"},{type:"input",inputOp:"math_number",inputName:"DURATION"}]}),s(o,"motorOn",{opcode:"wedo2_motorOn",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"}]}),s(o,"motorOff",{opcode:"wedo2_motorOff",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"}]}),s(o,"startMotorPower",{opcode:"wedo2_startMotorPower",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"},{type:"input",inputOp:"math_number",inputName:"POWER"}]}),s(o,"setMotorDirection",{opcode:"wedo2_setMotorDirection",argMap:[{type:"input",inputOp:"wedo2_menu_MOTOR_ID",inputName:"MOTOR_ID"},{type:"input",inputOp:"wedo2_menu_MOTOR_DIRECTION",inputName:"MOTOR_DIRECTION"}]}),s(o,"setLED",{opcode:"wedo2_setLightHue",argMap:[{type:"input",inputOp:"math_number",inputName:"HUE"}]}),s(o,"playNote",{opcode:"wedo2_playNoteFor",argMap:[{type:"input",inputOp:"math_number",inputName:"NOTE"},{type:"input",inputOp:"math_number",inputName:"DURATION"}]}),s(o,"whenDistance",{opcode:"wedo2_whenDistance",argMap:[{type:"input",inputOp:"wedo2_menu_OP",inputName:"OP"},{type:"input",inputOp:"math_number",inputName:"REFERENCE"}]}),s(o,"whenTilted",{opcode:"wedo2_whenTilted",argMap:[{type:"input",inputOp:"wedo2_menu_TILT_DIRECTION_ANY",inputName:"TILT_DIRECTION_ANY"}]}),s(o,"getDistance",{opcode:"wedo2_getDistance",argMap:[]}),s(o,"isTilted",{opcode:"wedo2_isTilted",argMap:[{type:"input",inputOp:"wedo2_menu_TILT_DIRECTION_ANY",inputName:"TILT_DIRECTION_ANY"}]}),s(o,"getTilt",{opcode:"wedo2_getTiltAngle",argMap:[{type:"input",inputOp:"wedo2_menu_TILT_DIRECTION",inputName:"TILT_DIRECTION"}]}),e.exports=i},function(e,t){e.exports={text:"https://extensions.turbowarp.org/lab/text.js",audiostr:"https://extensions.turbowarp.org/turboloader/audiostream.js",faceSensing:"https://extensions.turbowarp.org/lab/face-sensing.js",videoSprites:"https://extensions.turbowarp.org/lab/video-sprites.js"}},function(e,t,n){const r=n(19),i=n(264),s=n(11),o=n(25),a=n(27),c=n(270),l=n(271),u=n(85),h=n(275),d=n(35),p=n(28),f=n(276),m=n(277),g=n(86),b=n(88),y=n(87),E=s.v3.create(),T=new u,v=new u,A=new Uint8ClampedArray(4),w=new Uint8ClampedArray(4),S=[3,3],k=(e,t,n)=>(248&e[0])==(248&t[n+0])&&(248&e[1])==(248&t[n+1])&&(240&e[2])==(240&t[n+2]);let O;let I;class N extends r{static isSupported(e){try{e=e||document.createElement("canvas");const t={alpha:!0,stencil:!0,antialias:!1,powerPreference:N.powerPreference};return!!(e.getContext("webgl2",t)||e.getContext("webgl",t)||e.getContext("experimental-webgl",t))}catch(e){return!1}}static _getContext(e){const t={alpha:!0,stencil:!0,antialias:!1,powerPreference:N.powerPreference};return s.getContext(e,t)}constructor(e,t,r,i,y){super();const E=this._gl=N._getContext(e);if(!E)throw new Error("Could not get WebGL context: this browser or environment may not support WebGL.");this._useGpuMode=N.UseGpuModes.Automatic,this._allDrawables=[],this._allSkins=[],this._drawList=[],this._groupOrdering=[],this._layerGroups={},this._nextDrawableId=d.ID_NONE+1,this._nextSkinId=d.ID_NONE+1,this._projection=s.m4.identity(),this._shaderManager=new p(E),this._regionId=null,this._exitRegion=null,this._backgroundDrawRegionId={enter:()=>this._enterDrawBackground(),exit:()=>this._exitDrawBackground()},this._snapshotCallbacks=[],this._backgroundColor4f=[0,0,0,1],this._backgroundColor3b=new Uint8ClampedArray(3),this._penSkinId=null,this.useHighQualityRender=!1,this.offscreenTouching=!1,this.dirty=!0,this.overlayContainer=document.createElement("div"),this.overlayContainer.className="scratch-render-overlays",this._overlays=[],I||(I=document.createElement("style"),I.textContent=n(286),I.className="scratch-render-styles",document.head.appendChild(I)),this._createGeometry(),this.on(d.Events.NativeSizeChanged,this.onNativeSizeChanged),this.setBackgroundColor(1,1,1),this.setStageSize(t||-240,r||240,i||-180,y||180),this.resize(this._nativeSize[0],this._nativeSize[1]),E.disable(E.DEPTH_TEST),E.enable(E.BLEND),E.blendFunc(E.ONE,E.ONE_MINUS_SRC_ALPHA),this.allowPrivateSkinAccess=!0,this.maxTextureDimension=2048,this.customFonts={},this._customFontStyles=null,this.exports={twgl:s,SVGRenderer:o,Drawable:l,Skin:a,BitmapSkin:c,TextBubbleSkin:m,PenSkin:h,SVGSkin:f,CanvasMeasurementProvider:b,Rectangle:u,EffectTransform:g,ShaderManager:p}}setUseHighQualityRender(e){this.dirty=!0,this.useHighQualityRender=e,this.emit(d.Events.UseHighQualityRenderChanged,e),this._updateRenderQuality()}_updateRenderQuality(){if(null!==this._penSkinId){const e=this._allSkins[this._penSkinId];e&&(this.useHighQualityRender?e.setRenderQuality(this.canvas.width/this._nativeSize[0]):e.setRenderQuality(1))}for(const e of this._allDrawables)e&&e.setHighQuality(this.useHighQualityRender)}setPrivateSkinAccess(e){this.allowPrivateSkinAccess=e,this.emit(d.Events.AllowPrivateSkinAccessChanged,e)}setMaxTextureDimension(e){const t=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE);this.maxTextureDimension=Math.min(e,t)}get gl(){return this._gl}get canvas(){return this._gl&&this._gl.canvas}resize(e,t){const{canvas:n}=this._gl,r=window.devicePixelRatio||1,i=Math.round(e*r),s=Math.round(t*r);n.width===i&&n.height===s||(n.width=i,n.height=s,this._updateRenderQuality(),this._updateOverlays(),this.dirty=!0,this.draw())}setBackgroundColor(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;this.dirty=!0,this._backgroundColor4f[0]=e*r,this._backgroundColor4f[1]=t*r,this._backgroundColor4f[2]=n*r,this._backgroundColor4f[3]=r,this._backgroundColor3b[0]=e*r*255,this._backgroundColor3b[1]=t*r*255,this._backgroundColor3b[2]=n*r*255}setDebugCanvas(e){this._debugCanvas=e}setUseGpuMode(e){this._useGpuMode=e}setStageSize(e,t,n,r){this._xLeft=e,this._xRight=t,this._yBottom=n,this._yTop=r,this._projection=s.m4.ortho(e,t,n,r,-1,1),this._setNativeSize(Math.abs(t-e),Math.abs(n-r))}getNativeSize(){return[this._nativeSize[0],this._nativeSize[1]]}_setNativeSize(e,t){this._nativeSize=[e,t],this._updateOverlays(),this.emit(d.Events.NativeSizeChanged,{newSize:this._nativeSize})}addOverlay(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"scale";const n=document.createElement("div");n.appendChild(e),this.overlayContainer.appendChild(n);const r={container:n,userElement:e,mode:t};return this._overlays.push(r),this._updateOverlays(),r}removeOverlay(e){const t=this._overlays.findIndex((t=>t.userElement===e));-1!==t&&(this._overlays[t].container.remove(),this._overlays.splice(t,1))}_updateOverlays(){const[e,t]=this._nativeSize,n=this.canvas.width/window.devicePixelRatio,r=this.canvas.height/window.devicePixelRatio;this.overlayContainer.style.width="".concat(n,"px"),this.overlayContainer.style.height="".concat(r,"px");for(const i of this._overlays){const s=i.container;if("scale"===i.mode||"scale-centered"===i.mode){const o=n/e,a=r/t;s.style.width="".concat(e,"px"),s.style.height="".concat(t,"px");const c="scale(".concat(o,", ").concat(a,")");if(s.style.transformOrigin="top left","scale"===i.mode)s.style.transform=c;else{const n="translate(".concat(e/2,"px, ").concat(t/2,"px)");s.style.transform="".concat(c," ").concat(n)}}else s.style.transform="",s.style.width="100%",s.style.height="100%"}}createBitmapSkin(e,t,n){const r=this._nextSkinId++,i=new c(r,this);return i.setBitmap(e,t,n),this._allSkins[r]=i,r}createSVGSkin(e,t){const n=this._nextSkinId++,r=new f(n,this);return r.setSVG(e,t),this._allSkins[n]=r,n}createPenSkin(){const e=this._nextSkinId++,t=new h(e,this);return this._allSkins[e]=t,this._penSkinId=e,this._updateRenderQuality(),e}createTextSkin(e,t,n){const r=this._nextSkinId++,i=new m(r,this);return i.setTextBubble(e,t,n),this._allSkins[r]=i,r}updateSVGSkin(e,t,n){if(this._allSkins[e]instanceof f)return void this._allSkins[e].setSVG(t,n);const r=new f(e,this);r.setSVG(t,n),this._reskin(e,r)}updateBitmapSkin(e,t,n,r){if(this._allSkins[e]instanceof c)return void this._allSkins[e].setBitmap(t,n,r);const i=new c(e,this);i.setBitmap(t,n,r),this._reskin(e,i)}_reskin(e,t){const n=this._allSkins[e];this._allSkins[e]=t;for(const e of this._allDrawables)e&&e.skin===n&&(e.skin=t);n.dispose()}updateTextSkin(e,t,n,r){if(this._allSkins[e]instanceof m)return void this._allSkins[e].setTextBubble(t,n,r);const i=new m(e,this);i.setTextBubble(t,n,r),this._reskin(e,i)}destroySkin(e){this._allSkins[e].dispose(),delete this._allSkins[e]}createDrawable(e){if(!e||!Object.prototype.hasOwnProperty.call(this._layerGroups,e))return void y.warn("Cannot create a drawable without a known layer group");const t=this._nextDrawableId++,n=new l(t,this);return this._allDrawables[t]=n,this._addToDrawList(t,e),n.setHighQuality(this.useHighQualityRender),n.skin=null,t}createTextWrapper(e){return new(O||(O=n(278)),O)(e)}markSkinAsPrivate(e){const t=this._allSkins[e];t&&(t.private=!0)}markDrawableAsNoninteractive(e){const t=this._allDrawables[e];t&&(t.interactive=!1)}setLayerGroupOrdering(e){this._groupOrdering=e;for(let e=0;e<this._groupOrdering.length;e++)this._layerGroups[this._groupOrdering[e]]={groupIndex:e,drawListOffset:0}}_addToDrawList(e,t){const n=this._layerGroups[t],r=n.groupIndex,i=this._endIndexForKnownLayerGroup(n);this._drawList.splice(i,0,e),this._updateOffsets("add",r)}_updateOffsets(e,t){for(let n=t+1;n<this._groupOrdering.length;n++){const t=this._groupOrdering[n];"add"===e?this._layerGroups[t].drawListOffset++:"delete"===e&&this._layerGroups[t].drawListOffset--}}get _visibleDrawList(){return this._drawList.filter((e=>this._allDrawables[e]._visible))}_endIndexForKnownLayerGroup(e){const t=e.groupIndex;return t===this._groupOrdering.length-1?this._drawList.length:this._layerGroups[this._groupOrdering[t+1]].drawListOffset}destroyDrawable(e,t){if(!t||!Object.prototype.hasOwnProperty.call(this._layerGroups,t))return void y.warn("Cannot destroy drawable without known layer group.");this.dirty=!0;this._allDrawables[e].dispose(),delete this._allDrawables[e];const n=this._layerGroups[t],r=this._endIndexForKnownLayerGroup(n);let i=n.drawListOffset;for(;i<r&&this._drawList[i]!==e;)i++;i<r?(this._drawList.splice(i,1),this._updateOffsets("delete",n.groupIndex)):y.warn("Could not destroy drawable that could not be found in layer group.")}getDrawableOrder(e){return this._drawList.indexOf(e)}setDrawableOrder(e,t,n,r,i){if(!n||!Object.prototype.hasOwnProperty.call(this._layerGroups,n))return void y.warn("Cannot set the order of a drawable without a known layer group.");this.dirty=!0;const s=this._layerGroups[n],o=s.drawListOffset,a=this._endIndexForKnownLayerGroup(s);let c=o;for(;c<a&&this._drawList[c]!==e;)c++;if(c<a){if(0===t)return c;this._drawList.splice(c,1)[0];let n=t;r&&(n+=c);const s=(i||0)+o,l=s>=o&&s<a?s:o;return n=Math.max(n,l),n=Math.min(n,a),this._drawList.splice(n,0,e),n}return null}skinWasAltered(e){for(let t=0;t<this._drawList.length;t++){const n=this._drawList[t],r=this._allDrawables[n];r._skin===e&&r._skinWasAltered()}}draw(){if(!this.dirty)return;this.dirty=!1,this._doExitDrawRegion();const e=this._gl;s.bindFramebufferInfo(e,null),e.viewport(0,0,e.canvas.width,e.canvas.height),e.clearColor(this._backgroundColor4f[0],this._backgroundColor4f[1],this._backgroundColor4f[2],this._backgroundColor4f[3]),e.clear(e.COLOR_BUFFER_BIT);const t=this._snapshotCallbacks.length>0;if(this._drawThese(this._drawList,p.DRAW_MODE.default,this._projection,{framebufferWidth:e.canvas.width,framebufferHeight:e.canvas.height,skipPrivateSkins:t}),t){const t=e.canvas.toDataURL();this._snapshotCallbacks.forEach((e=>e(t))),this._snapshotCallbacks=[],this.dirty=!0}}getBounds(e){const t=this._allDrawables[e];if(t.needsConvexHullPoints()){const n=this._getConvexHullPointsForDrawable(e);t.setConvexHullPoints(n)}const n=t.getFastBounds();if(this._debugCanvas){const e=this._gl;this._debugCanvas.width=e.canvas.width,this._debugCanvas.height=e.canvas.height;const t=this._debugCanvas.getContext("2d");t.drawImage(e.canvas,0,0),t.strokeStyle="#FF0000";const r=window.devicePixelRatio;t.strokeRect(r*(n.left+this._nativeSize[0]/2),r*(-n.top+this._nativeSize[1]/2),r*(n.right-n.left),r*(-n.bottom+n.top))}return n}getBoundsForBubble(e){const t=this._allDrawables[e];if(t.needsConvexHullPoints()){const n=this._getConvexHullPointsForDrawable(e);t.setConvexHullPoints(n)}const n=t.getBoundsForBubble();if(this._debugCanvas){const e=this._gl;this._debugCanvas.width=e.canvas.width,this._debugCanvas.height=e.canvas.height;const t=this._debugCanvas.getContext("2d");t.drawImage(e.canvas,0,0),t.strokeStyle="#FF0000";const r=window.devicePixelRatio;t.strokeRect(r*(n.left+this._nativeSize[0]/2),r*(-n.top+this._nativeSize[1]/2),r*(n.right-n.left),r*(-n.bottom+n.top))}return n}getCurrentSkinSize(e){const t=this._allDrawables[e];return this.getSkinSize(t.skin.id)}getSkinSize(e){return this._allSkins[e].size}getSkinRotationCenter(e){return this._allSkins[e].calculateRotationCenter()}isTouchingColor(e,t,n){const r=this._candidatesTouching(e,this._visibleDrawList);let i;if(k(t,this._backgroundColor3b,0)){if(i=this._touchingBounds(e),null===i)return!1}else{if(0===r.length)return!1;i=this._candidatesBounds(r)}const s=this._getMaxPixelsForCPU(),o=this._debugCanvas&&this._debugCanvas.getContext("2d");o&&(this._debugCanvas.width=i.width,this._debugCanvas.height=i.height),i.width*i.height*(r.length+1)>=s&&this._isTouchingColorGpuStart(e,r.map((e=>{let{id:t}=e;return t})).reverse(),i,t,n);const a=this._allDrawables[e],c=E,u=A,h=Boolean(n);a.updateCPURenderAttributes();const d=~p.EFFECT_INFO.ghost.mask;for(let e=i.bottom;e<=i.top;e++){if(i.width*(e-i.bottom)*(r.length+1)>=s)return this._isTouchingColorGpuFin(i,t,e-i.bottom);for(let s=i.left;s<=i.right;s++)if(c[1]=e,c[0]=s,(h?(f=l.sampleColor4b(c,a,u,d),m=n,f[3]>0&&(252&f[0])==(252&m[0])&&(252&f[1])==(252&m[1])&&(252&f[2])==(252&m[2])):a.isTouching(c))&&(this.sampleColor4b(c,r,u),o&&(o.fillStyle="rgb(".concat(u[0],",").concat(u[1],",").concat(u[2],")"),o.fillRect(s-i.left,i.bottom-e,1,1)),k(u,t,0)))return!0}var f,m;return!1}_getMaxPixelsForCPU(){switch(this._useGpuMode){case N.UseGpuModes.ForceCPU:return 1/0;case N.UseGpuModes.ForceGPU:return 0;case N.UseGpuModes.Automatic:default:return 4e4}}_enterDrawBackground(){const e=this.gl,t=this._shaderManager.getShader(p.DRAW_MODE.background,0);e.disable(e.BLEND),e.useProgram(t.program),s.setBuffersAndAttributes(e,t,this._bufferInfo)}_exitDrawBackground(){const e=this.gl;e.enable(e.BLEND)}_isTouchingColorGpuStart(e,t,n,r,i){this._doExitDrawRegion();const o=this._gl;s.bindFramebufferInfo(o,this._queryBufferInfo),o.viewport(0,0,n.width,n.height);const a=s.m4.ortho(n.left,n.right,n.top,n.bottom,-1,1);let c;o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT|o.STENCIL_BUFFER_BIT),i&&(c={u_colorMask:[i[0]/255,i[1]/255,i[2]/255],u_colorMaskTolerance:2/255});try{o.enable(o.STENCIL_TEST),o.stencilFunc(o.ALWAYS,1,1),o.stencilOp(o.KEEP,o.KEEP,o.REPLACE),o.colorMask(!1,!1,!1,!1),this._drawThese([e],i?p.DRAW_MODE.colorMask:p.DRAW_MODE.silhouette,a,{extraUniforms:c,ignoreVisibility:!0,effectMask:~p.EFFECT_INFO.ghost.mask}),o.stencilFunc(o.EQUAL,1,1),o.stencilOp(o.KEEP,o.KEEP,o.KEEP),o.colorMask(!0,!0,!0,!0),this.enterDrawRegion(this._backgroundDrawRegionId);const n={u_backgroundColor:this._backgroundColor4f},r=this._shaderManager.getShader(p.DRAW_MODE.background,0);s.setUniforms(r,n),s.drawBufferInfo(o,this._bufferInfo,o.TRIANGLES),this._drawThese(t,p.DRAW_MODE.default,a,{idFilterFunc:t=>t!==e})}finally{o.colorMask(!0,!0,!0,!0),o.disable(o.STENCIL_TEST),this._doExitDrawRegion()}}_isTouchingColorGpuFin(e,t,n){const r=this._gl,i=new Uint8Array(Math.floor(e.width*(e.height-n)*4));if(r.readPixels(0,0,e.width,e.height-n,r.RGBA,r.UNSIGNED_BYTE,i),this._debugCanvas){this._debugCanvas.width=e.width,this._debugCanvas.height=e.height;const t=this._debugCanvas.getContext("2d"),r=t.getImageData(0,0,e.width,e.height-n);r.data.set(i),t.putImageData(r,0,0)}for(let e=0;e<i.length;e+=4)if(0!==i[e+3]&&k(t,i,e))return!0;return!1}isTouchingDrawables(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._drawList;if(!this._allDrawables[e]._visible)return!1;const n=this._candidatesTouching(e,t.filter((e=>this._allDrawables[e]._visible)));if(0===n.length)return!1;const r=this._candidatesBounds(n),i=this._allDrawables[e],s=E;i.updateCPURenderAttributes();for(let e=r.left;e<=r.right;e++){s[0]=e;for(let e=r.bottom;e<=r.top;e++)if(s[1]=e,i.isTouching(s))for(let e=0;e<n.length;e++)if(n[e].drawable.isTouching(s))return!0}return!1}clientSpaceToScratchBounds(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1;const i=this._gl,s=this._nativeSize[0]/i.canvas.clientWidth,o=this._nativeSize[1]/i.canvas.clientHeight;n*=s,r*=o,n=Math.max(1,Math.min(Math.round(n),S[0])),r=Math.max(1,Math.min(Math.round(r),S[1]));const a=e*s-(n-1)/2,c=t*o+(r-1)/2,l=n%2?0:-.5,h=r%2?0:-.5,d=new u;return d.initFromBounds(Math.floor(this._xLeft+a+l),Math.floor(this._xLeft+a+l+n-1),Math.ceil(this._yTop-c+h),Math.ceil(this._yTop-c+h+r-1)),d}drawableTouching(e,t,n,r,i){const o=this._allDrawables[e];if(!o)return!1;const a=this.clientSpaceToScratchBounds(t,n,r,i),c=o.getFastBounds();if(c.snapToInt(),!c.intersects(a))return!1;o.updateCPURenderAttributes();const l=s.v3.create();for(l[1]=a.bottom;l[1]<=a.top;l[1]++)for(l[0]=a.left;l[0]<=a.right;l[0]++)if(o.isTouching(l))return!0;return!1}pick(e,t,n,r,i){const o=this.clientSpaceToScratchBounds(e,t,n,r);if(o.left===-1/0||o.bottom===-1/0)return d.ID_NONE;if(0===(i=(i||this._drawList).filter((e=>{const t=this._allDrawables[e];if(!i&&!t.interactive)return!1;if(t.getVisible()&&0!==t.getUniforms().u_ghost){const e=t.getFastBounds();return!!o.intersects(e)&&(t.updateCPURenderAttributes(),!0)}return!1}))).length)return d.ID_NONE;const a=[],c=s.v3.create(0,0,0);for(c[1]=o.bottom;c[1]<=o.top;c[1]++)for(c[0]=o.left;c[0]<=o.right;c[0]++)for(let e=i.length-1;e>=0;e--){const t=i[e];if(this._allDrawables[t].isTouching(c)){a[t]=(a[t]||0)+1;break}}a[d.ID_NONE]=0;let l=d.ID_NONE;for(const e in a)Object.prototype.hasOwnProperty.call(a,e)&&a[e]>a[l]&&(l=e);return Number(l)}extractDrawableScreenSpace(e){const t=this._allDrawables[e];if(!t)throw new Error("Could not extract drawable with ID ".concat(e,"; it does not exist"));this._doExitDrawRegion();const n=.5*this._nativeSize[0],r=.5*this._nativeSize[1],i=t.getFastBounds(),o=this.canvas,a=o.width/this._nativeSize[0],c=new u;c.initFromBounds((i.left+n)*a,(i.right+n)*a,(r-i.top)*a,(r-i.bottom)*a),c.snapToInt(),i.initFromBounds(c.left/a-n,c.right/a-n,r-c.top/a,r-c.bottom/a);const l=this._gl,h=l.getParameter(l.MAX_TEXTURE_SIZE),d=Math.min(2048,c.width,h),f=Math.min(2048,c.height,h),m=s.createFramebufferInfo(l,[{format:l.RGBA}],d,f);try{s.bindFramebufferInfo(l,m),l.viewport(0,0,d,f);const t=s.m4.ortho(i.left,i.right,i.top,i.bottom,-1,1);l.clearColor(0,0,0,0),l.clear(l.COLOR_BUFFER_BIT),this._drawThese([e],p.DRAW_MODE.straightAlpha,t,{effectMask:~p.EFFECT_INFO.ghost.mask,framebufferWidth:o.width,framebufferHeight:o.height});const n=new Uint8Array(Math.floor(d*f*4));l.readPixels(0,0,d,f,l.RGBA,l.UNSIGNED_BYTE,n);const r=new ImageData(new Uint8ClampedArray(n.buffer),d,f),a=o.getBoundingClientRect().width/o.width;return{imageData:r,x:c.left*a,y:c.bottom*a,width:c.width*a,height:c.height*a}}finally{l.deleteFramebuffer(m.framebuffer)}}extractColor(e,t,n){this._doExitDrawRegion();const r=Math.round(this._nativeSize[0]*(e/this._gl.canvas.clientWidth-.5)),i=Math.round(-this._nativeSize[1]*(t/this._gl.canvas.clientHeight-.5)),o=this._gl;s.bindFramebufferInfo(o,this._queryBufferInfo);const a=new u;a.initFromBounds(r-n,r+n,i-n,i+n);const c=r-a.left,l=a.top-i;o.viewport(0,0,a.width,a.height);const h=s.m4.ortho(a.left,a.right,a.top,a.bottom,-1,1);o.clearColor(this._backgroundColor4f[0],this._backgroundColor4f[1],this._backgroundColor4f[2],this._backgroundColor4f[3]),o.clear(o.COLOR_BUFFER_BIT),this._drawThese(this._drawList,p.DRAW_MODE.default,h);const d=new Uint8Array(Math.floor(a.width*a.height*4));o.readPixels(0,0,a.width,a.height,o.RGBA,o.UNSIGNED_BYTE,d);const f=Math.floor(4*(l*a.width+c)),m={r:d[f],g:d[f+1],b:d[f+2],a:d[f+3]};if(this._debugCanvas){this._debugCanvas.width=a.width,this._debugCanvas.height=a.height;const e=this._debugCanvas.getContext("2d"),t=e.createImageData(a.width,a.height);t.data.set(d),e.putImageData(t,0,0),e.strokeStyle="black",e.fillStyle="rgba(".concat(m.r,", ").concat(m.g,", ").concat(m.b,", ").concat(m.a,")"),e.rect(c-4,l-4,8,8),e.fill(),e.stroke()}return{data:d,width:a.width,height:a.height,color:m}}_touchingBounds(e){const t=this._allDrawables[e];if(!t.skin||!t.skin.getTexture([100,100]))return null;const n=t.getFastBounds();return this.offscreenTouching||n.clamp(this._xLeft,this._xRight,this._yBottom,this._yTop),n.snapToInt(),0===n.width||0===n.height?null:n}_candidatesTouching(e,t){const n=this._touchingBounds(e),r=[];if(null===n)return r;for(let i=t.length-1;i>=0;i--){const s=t[i];if(s!==e){const e=this._allDrawables[s];if(e.skin instanceof m)continue;if(e.skin&&e._visible){if(!this.allowPrivateSkinAccess&&e.skin.private)continue;e.updateCPURenderAttributes();const t=e.getFastBounds();t.snapToInt(),n.intersects(t)&&r.push({id:s,drawable:e,intersection:u.intersect(n,t)})}}}return r}_candidatesBounds(e){return e.reduce(((e,t)=>{let{intersection:n}=t;return e?u.union(e,n,T):n}),null)}updateDrawableSkinId(e,t){const n=this._allDrawables[e];n&&(n.skin=this._allSkins[t])}updateDrawablePosition(e,t){const n=this._allDrawables[e];n&&n.updatePosition(t)}updateDrawableDirection(e,t){const n=this._allDrawables[e];n&&n.updateDirection(t)}updateDrawableScale(e,t){const n=this._allDrawables[e];n&&n.updateScale(t)}updateDrawableDirectionScale(e,t,n){const r=this._allDrawables[e];r&&(r.updateDirection(t),r.updateScale(n))}updateDrawableVisible(e,t){const n=this._allDrawables[e];n&&n.updateVisible(t)}updateDrawableEffect(e,t,n){const r=this._allDrawables[e];r&&r.updateEffect(t,n)}updateDrawableProperties(e,t){const n=this._allDrawables[e];n&&("skinId"in t&&this.updateDrawableSkinId(e,t.skinId),n.updateProperties(t))}getFencedPositionOfDrawable(e,t){let n=t[0],r=t[1];const i=this._allDrawables[e];if(!i)return[n,r];const s=n-i._position[0],o=r-i._position[1],a=i._skin.getFenceBounds(i,v),c=Math.floor(Math.min(a.width,a.height)/2),l=this._xRight-Math.min(15,c);a.right+s<-l?n=Math.ceil(i._position[0]-(l+a.right)):a.left+s>l&&(n=Math.floor(i._position[0]+(l-a.left)));const u=this._yTop-Math.min(15,c);return a.top+o<-u?r=Math.ceil(i._position[1]-(u+a.top)):a.bottom+o>u&&(r=Math.floor(i._position[1]+(u-a.bottom))),[n,r]}penClear(e){this.dirty=!0;this._allSkins[e].clear()}penPoint(e,t,n,r){this.dirty=!0;this._allSkins[e].drawPoint(t,n,r)}penLine(e,t,n,r,i,s){this.dirty=!0;this._allSkins[e].drawLine(t,n,r,i,s)}penStamp(e,t){const n=this._allDrawables[t];if(!n||!n.skin||!n.skin.isMetricsReady())return;const r=n.getFastBounds();if(this.offscreenTouching||r.clamp(this._xLeft,this._xRight,this._yBottom,this._yTop),0===r.width||0===r.height)return;this._doExitDrawRegion();const i=this._allSkins[e],o=this._gl;s.bindFramebufferInfo(o,i._framebuffer);const a=i.renderQuality;r.left*=a,r.right*=a,r.top*=a,r.bottom*=a,r.snapToInt(),o.viewport(.5*this._nativeSize[0]*a+r.left,.5*this._nativeSize[1]*a-r.top,r.width,r.height);const c=s.m4.ortho(r.left/a,r.right/a,r.top/a,r.bottom/a,-1,1);this._drawThese([t],p.DRAW_MODE.default,c,{ignoreVisibility:!0,framebufferWidth:this._nativeSize[0]*a,framebufferHeight:this._nativeSize[1]*a}),i._silhouetteDirty=!0,this.dirty=!0}_createGeometry(){this._bufferInfo=s.createBufferInfoFromArrays(this._gl,{a_position:{numComponents:2,data:[-.5,-.5,.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5]},a_texCoord:{numComponents:2,data:[1,0,0,0,1,1,1,1,0,0,0,1]}})}onNativeSizeChanged(e){this.dirty=!0;const[t,n]=e.newSize,r=this._gl,i=[{format:r.RGBA},{format:r.DEPTH_STENCIL}];this._pickBufferInfo||(this._pickBufferInfo=s.createFramebufferInfo(r,i,S[0],S[1])),this._queryBufferInfo?s.resizeFramebufferInfo(r,this._queryBufferInfo,i,t,n):this._queryBufferInfo=s.createFramebufferInfo(r,i,t,n)}enterDrawRegion(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.enter,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.exit;this._regionId!==e&&(this._doExitDrawRegion(),this._regionId=e,t(),this._exitRegion=n)}_doExitDrawRegion(){null!==this._exitRegion&&this._exitRegion(),this._exitRegion=null,this._regionId=null}_drawThese(e,t,n){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const i=this._gl;let o=null;const a="framebufferWidth"in r&&"framebufferHeight"in r&&r.framebufferWidth!==this._nativeSize[0]&&r.framebufferHeight!==this._nativeSize[1],c=e.length;for(let l=0;l<c;++l){const c=e[l];if(r.filter&&!r.filter(c))continue;const u=this._allDrawables[c];if(!u.getVisible()&&!r.ignoreVisibility)continue;const h=a?[u.scale[0]*r.framebufferWidth/this._nativeSize[0],u.scale[1]*r.framebufferHeight/this._nativeSize[1]]:u.scale;if(!u.skin)continue;if(r.skipPrivateSkins&&u.skin.private)continue;if(!u.skin.getTexture(h))continue;const d={};let p=u.enabledEffects;p&=Object.prototype.hasOwnProperty.call(r,"effectMask")?r.effectMask:p;const f=this._shaderManager.getShader(t,p);this._regionId!==f&&(this._doExitDrawRegion(),this._regionId=f,o=f,i.useProgram(o.program),s.setBuffersAndAttributes(i,o,this._bufferInfo),Object.assign(d,{u_projectionMatrix:n})),Object.assign(d,u.skin.getUniforms(h),u.getUniforms()),r.extraUniforms&&Object.assign(d,r.extraUniforms),d.u_skin&&s.setTextureParameters(i,d.u_skin,{minMag:u.skin.useNearest(h,u)?i.NEAREST:i.LINEAR}),s.setUniforms(o,d),s.drawBufferInfo(i,this._bufferInfo,i.TRIANGLES)}this._regionId=null}_getConvexHullPointsForDrawable(e){const t=this._allDrawables[e],[n,r]=t.skin.size;if(!t.getVisible()||0===n||0===r)return[];t.updateCPURenderAttributes();const o=function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])},a=[],c=[];let l=-1,u=-1;const h=s.v3.create(),d=s.v3.create();let p;for(let e=0;e<r;e++){h[1]=e/r;let i=0;for(;i<n;i++)if(h[0]=i/n,g.transformPoint(t,h,d),t.skin.isTouchingLinear(d)){p=[i,e];break}if(!(i>=n)){for(;l>0&&!(o(a[l],a[l-1],p)>0);)--l;for(a[++l]=p,i=n-1;i>=0;i--)if(h[0]=i/n,g.transformPoint(t,h,d),t.skin.isTouchingLinear(d)){p=[i,e];break}for(;u>0&&!(o(c[u],c[u-1],p)<0);)--u;c[++u]=p}}const f=a;f.length=l+1;for(let e=u;e>=0;--e)f.push(c[e]);return i(f,1/0)}sampleColor4b(e,t,n){(n=n||new Uint8ClampedArray(4))[0]=0,n[1]=0,n[2]=0;let r=1;for(let i=0;0!==r&&i<t.length;i++)l.sampleColor4b(e,t[i].drawable,w),n[0]+=w[0]*r,n[1]+=w[1]*r,n[2]+=w[2]*r,r*=1-w[3]/255;return n[0]+=255*this._backgroundColor4f[0]*r,n[1]+=255*this._backgroundColor4f[1]*r,n[2]+=255*this._backgroundColor4f[2]*r,r*=1-this._backgroundColor4f[3],n[3]=255*(1-r),n}requestSnapshot(e){this.dirty=!0,this._snapshotCallbacks.push(e)}setCustomFonts(e){this.customFonts=e;const t=Object.values(e).join("\n");if(t.length?(this._customFontStyles||(this._customFontStyles=document.createElement("style"),this._customFontStyles.className="renderer-custom-fonts",document.head.appendChild(this._customFontStyles)),this._customFontStyles.textContent=t):this._customFontStyles&&(this._customFontStyles.remove(),this._customFontStyles=null),"object"==typeof document&&"object"==typeof document.fonts&&"function"==typeof document.fonts.load){const t=Object.keys(e);for(const e of t)document.fonts.load("12px ".concat(e))}}}N.prototype.canHazPixels=N.prototype.extractDrawableScreenSpace,N.UseGpuModes={Automatic:"Automatic",ForceGPU:"ForceGPU",ForceCPU:"ForceCPU"},N.powerPreference="default",e.exports=N},function(e,t,n){"use strict";var r=n(265),i=n(266),s=n(267),o=n(268);function a(e,t){return Math.pow(t[0]-e[0],2)+Math.pow(t[1]-e[1],2)}function c(e,t,n){var r=[t[0]-e[0],t[1]-e[1]],i=[n[0]-e[0],n[1]-e[1]],s=a(e,t),o=a(e,n);return(r[0]*i[0]+r[1]*i[1])/Math.sqrt(s*o)}function l(e,t){for(var n=0;n<t.length-1;n++){var i=[t[n],t[n+1]];if(!(e[0][0]===i[0][0]&&e[0][1]===i[0][1]||e[0][0]===i[1][0]&&e[0][1]===i[1][1])&&r(e,i))return!0}return!1}function u(e){return[Math.min(e[0][0],e[1][0]),Math.min(e[0][1],e[1][1]),Math.max(e[0][0],e[1][0]),Math.max(e[0][1],e[1][1])]}function h(e,t,n){for(var r,i,s=null,o=p,a=p,u=0;u<t.length;u++)r=c(e[0],e[1],t[u]),i=c(e[1],e[0],t[u]),r>o&&i>a&&!l([e[0],t[u]],n)&&!l([e[1],t[u]],n)&&(o=r,a=i,s=t[u]);return s}function d(e,t,n,r,i){for(var s,o,c,l,p,f,m,g=!1,b=0;b<e.length-1;b++)if(o=(s=[e[b],e[b+1]])[0].join()+","+s[1].join(),!(a(s[0],s[1])<t||!0===i[o])){c=0,p=u(s);do{f=(p=r.extendBbox(p,c))[2]-p[0],m=p[3]-p[1],l=h(s,r.rangePoints(p),e),c++}while(null===l&&(n[0]>f||n[1]>m));f>=n[0]&&m>=n[1]&&(i[o]=!0),null!==l&&(e.splice(b+1,0,l),r.removePoint(l),g=!0)}return g?d(e,t,n,r,i):e}var p=Math.cos(90/(180/Math.PI)),f=.6;e.exports=function(e,t,n){var r,a,c,l,u,h,p,m=t||20;return e.length<4?e.slice():(p=function(e){return e.filter((function(e,t,n){var r=n[t-1];return 0===t||!(r[0]===e[0]&&r[1]===e[1])}))}(function(e){return e.sort((function(e,t){return e[0]==t[0]?e[1]-t[1]:e[0]-t[0]}))}(s.toXy(e,n))),l=function(e){for(var t=1/0,n=1/0,r=-1/0,i=-1/0,s=e.length-1;s>=0;s--)e[s][0]<t&&(t=e[s][0]),e[s][1]<n&&(n=e[s][1]),e[s][0]>r&&(r=e[s][0]),e[s][1]>i&&(i=e[s][1]);return[r-t,i-n]}(p),u=[l[0]*f,l[1]*f],r=o(p),c=p.filter((function(e){return r.indexOf(e)<0})),h=Math.ceil(1/(p.length/(l[0]*l[1]))),a=d(r,Math.pow(m,2),u,i(c,h),{}),s.fromXy(a,n))}},function(e,t){function n(e,t,n,r,i,s){var o=(s-t)*(n-e)-(r-t)*(i-e);return o>0||!(o<0)}e.exports=function(e,t){var r=e[0][0],i=e[0][1],s=e[1][0],o=e[1][1],a=t[0][0],c=t[0][1],l=t[1][0],u=t[1][1];return n(r,i,a,c,l,u)!==n(s,o,a,c,l,u)&&n(r,i,s,o,a,c)!==n(r,i,s,o,l,u)}},function(e,t){function n(e,t){this._cells=[],this._cellSize=t,e.forEach((function(e){var t=this.point2CellXY(e),n=t[0],r=t[1];void 0===this._cells[n]&&(this._cells[n]=[]),void 0===this._cells[n][r]&&(this._cells[n][r]=[]),this._cells[n][r].push(e)}),this)}n.prototype={cellPoints:function(e,t){return void 0!==this._cells[e]&&void 0!==this._cells[e][t]?this._cells[e][t]:[]},rangePoints:function(e){for(var t=this.point2CellXY([e[0],e[1]]),n=this.point2CellXY([e[2],e[3]]),r=[],i=t[0];i<=n[0];i++)for(var s=t[1];s<=n[1];s++)r=r.concat(this.cellPoints(i,s));return r},removePoint:function(e){for(var t,n=this.point2CellXY(e),r=this._cells[n[0]][n[1]],i=0;i<r.length;i++)if(r[i][0]===e[0]&&r[i][1]===e[1]){t=i;break}return r.splice(t,1),r},point2CellXY:function(e){return[parseInt(e[0]/this._cellSize),parseInt(e[1]/this._cellSize)]},extendBbox:function(e,t){return[e[0]-t*this._cellSize,e[1]-t*this._cellSize,e[2]+t*this._cellSize,e[3]+t*this._cellSize]}},e.exports=function(e,t){return new n(e,t)}},function(e,t){e.exports={toXy:function(e,t){if(void 0===t)return e.slice();const n=t[0].slice(1),r=t[1].slice(1);return e.map((function(e){return[e[n],e[r]]}))},fromXy:function(e,t){if(void 0===t)return e.slice();const n=t[0].slice(1),r=t[1].slice(1);return e.map((function(e){return function(e){const t={};return t[n]=e[0],t[r]=e[1],t}(e)}))}}},function(e,t){function n(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(t[1]-e[1])*(n[0]-e[0])}e.exports=function(e){var t,r=function(e){for(var t=[],r=0;r<e.length;r++){for(;t.length>=2&&n(t[t.length-2],t[t.length-1],e[r])<=0;)t.pop();t.push(e[r])}return t.pop(),t}(e),i=function(e){for(var t=e.reverse(),r=[],i=0;i<t.length;i++){for(;r.length>=2&&n(r[r.length-2],r[r.length-1],t[i])<=0;)r.pop();r.push(t[i])}return r.pop(),r}(e);return(t=i.concat(r)).push(e[0]),t}},function(e,t){let n;const r=(e,t)=>t^(e^t)&e-t>>31,i=(e,t)=>e^(e^t)&e-t>>31,s=(e,t,n)=>{let{_width:r,_height:i,_colorData:s}=e;return t>=r||n>=i||t<0||n<0?0:s[4*(n*r+t)+3]},o=[new Uint8ClampedArray(4),new Uint8ClampedArray(4),new Uint8ClampedArray(4),new Uint8ClampedArray(4)],a=(e,t,n,s)=>{let{_width:o,_height:a,_colorData:c}=e;if(t=i(0,r(t,o-1)),n=i(0,r(n,a-1)),t>=o||n>=a||t<0||n<0)return s.fill(0);const l=4*(n*o+t),u=c[l+3]/255;return s[0]=c[l]*u,s[1]=c[l+1]*u,s[2]=c[l+2]*u,s[3]=c[l+3],s},c=(e,t,n,s)=>{let{_width:o,_height:a,_colorData:c}=e;t=i(0,r(t,o-1));const l=4*((n=i(0,r(n,a-1)))*o+t);return s[0]=c[l],s[1]=c[l+1],s[2]=c[l+2],s[3]=c[l+3],s};class l{constructor(){this._width=0,this._height=0,this._lazyData=null,this._colorData=null,this._getColor=a,this.colorAtNearest=this.colorAtLinear=(e,t)=>t.fill(0)}update(e){let t,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof ImageData)t=e,this._width=e.width,this._height=e.height,this._lazyData=null,this._colorData=t.data;else{if(this._width=e.width,this._height=e.height,!this._width||!this._height)return;this._lazyData=e,this._colorData=null}this._getColor=n?c:a,delete this.colorAtNearest,delete this.colorAtLinear}unlazy(){if(!this._lazyData)return;const e=this._lazyData.width,t=this._lazyData.height;if(e&&t){const n=l._updateCanvas();n.width=e,n.height=t;const r=n.getContext("2d");r.clearRect(0,0,e,t),r.drawImage(this._lazyData,0,0,e,t);const i=r.getImageData(0,0,e,t);this._colorData=i.data}this._lazyData=null}colorAtNearest(e,t){return this._getColor(this,Math.floor(e[0]*(this._width-1)),Math.floor(e[1]*(this._height-1)),t)}colorAtLinear(e,t){const n=e[0]*(this._width-1),r=e[1]*(this._height-1),i=n%1,s=r%1,a=1-i,c=1-s,l=Math.floor(n),u=Math.floor(r),h=this._getColor(this,l,u,o[0]),d=this._getColor(this,l+1,u,o[1]),p=this._getColor(this,l,u+1,o[2]),f=this._getColor(this,l+1,u+1,o[3]);return t[0]=h[0]*a*c+p[0]*a*s+d[0]*i*c+f[0]*i*s,t[1]=h[1]*a*c+p[1]*a*s+d[1]*i*c+f[1]*i*s,t[2]=h[2]*a*c+p[2]*a*s+d[2]*i*c+f[2]*i*s,t[3]=h[3]*a*c+p[3]*a*s+d[3]*i*c+f[3]*i*s,t}isTouchingNearest(e){if(this._colorData)return s(this,Math.floor(e[0]*(this._width-1)),Math.floor(e[1]*(this._height-1)))>0}isTouchingLinear(e){if(!this._colorData)return;const t=Math.floor(e[0]*(this._width-1)),n=Math.floor(e[1]*(this._height-1));return s(this,t,n)>0||s(this,t+1,n)>0||s(this,t,n+1)>0||s(this,t+1,n+1)>0}static _updateCanvas(){return void 0===n&&(n=document.createElement("canvas")),n}}e.exports=l},function(e,t,n){const r=n(11),i=n(27);class s extends i{constructor(e,t){super(e,t),this._costumeResolution=1,this._textureSize=[0,0]}dispose(){this._texture&&(this._renderer.gl.deleteTexture(this._texture),this._texture=null),super.dispose()}get size(){return[this._textureSize[0]/this._costumeResolution,this._textureSize[1]/this._costumeResolution]}getTexture(e){return this._texture||super.getTexture()}setBitmap(e,t,n){if(!e.width||!e.height)return void super.setEmptyImageData();const i=this._renderer.gl;let o=e;if(e instanceof HTMLCanvasElement&&!1!==e.reusable){o=e.getContext("2d").getImageData(0,0,e.width,e.height)}if(null===this._texture){const e={auto:!1,wrap:i.CLAMP_TO_EDGE};this._texture=r.createTexture(i,e)}this._setTexture(o),this._costumeResolution=t||2,this._textureSize=s._getBitmapSize(e),void 0===n&&(n=this.calculateRotationCenter()),this._rotationCenter[0]=n[0],this._rotationCenter[1]=n[1],this.emitWasAltered()}static _getBitmapSize(e){return e instanceof HTMLImageElement?[e.naturalWidth||e.width,e.naturalHeight||e.height]:e instanceof HTMLVideoElement?[e.videoWidth||e.width,e.videoHeight||e.height]:[e.width,e.height]}}e.exports=s},function(e,t,n){const r=n(11),i=n(85),s=n(35),o=n(28),a=n(86),c=n(87),l=r.v3.create(),u=1e-6,h=(e,t)=>{const n=l,r=t[0],i=t[1],s=e._inverseMatrix,o=r*s[3]+i*s[7]+s[15];return n[0]=.5-(r*s[0]+i*s[4]+s[12])/o,n[1]=(r*s[1]+i*s[5]+s[13])/o+.5,Math.abs(n[0])<u&&(n[0]=0),Math.abs(n[1])<u&&(n[1]=0),0!==e.enabledEffects&&n[0]>=0&&n[0]<1&&n[1]>=0&&n[1]<1&&a.transformPoint(e,n,n),n};class d{constructor(e,t){this._id=e,this._renderer=t,this._uniforms={u_modelMatrix:r.m4.identity(),u_silhouetteColor:d.color4fFromID(this._id)};const n=o.EFFECTS.length;for(let e=0;e<n;++e){const t=o.EFFECTS[e],n=o.EFFECT_INFO[t],r=n.converter;this._uniforms[n.uniformName]=r(0)}this._position=r.v3.create(0,0),this._scale=r.v3.create(100,100),this._direction=90,this._transformDirty=!0,this._rotationMatrix=r.m4.identity(),this._rotationTransformDirty=!0,this._rotationAdjusted=r.v3.create(),this._rotationCenterDirty=!0,this._skinScale=r.v3.create(0,0,0),this._skinScaleDirty=!0,this._inverseMatrix=r.m4.identity(),this._inverseTransformDirty=!0,this._visible=!0,this.enabledEffects=0,this._convexHullPoints=null,this._convexHullDirty=!0,this._transformedHullPoints=null,this._transformedHullDirty=!0,this._skinWasAltered=this._skinWasAltered.bind(this),this.isTouching=this._isTouchingNever,this._highQuality=!1,this.interactive=!0}setHighQuality(e){this._highQuality=e}dispose(){this.skin=null}setTransformDirty(){this._transformDirty=!0,this._inverseTransformDirty=!0,this._transformedHullDirty=!0}get id(){return this._id}get skin(){return this._skin}set skin(e){this._skin!==e&&(this._skin=e,this._skinWasAltered())}get scale(){return[this._scale[0],this._scale[1]]}getUniforms(){return this._transformDirty&&this._calculateTransform(),this._uniforms}getVisible(){return this._visible}updatePosition(e){this._position[0]===e[0]&&this._position[1]===e[1]||(this._highQuality?(this._position[0]=e[0],this._position[1]=e[1]):(this._position[0]=Math.round(e[0]),this._position[1]=Math.round(e[1])),this._renderer.dirty=!0,this.setTransformDirty())}updateDirection(e){this._direction!==e&&(this._direction=e,this._renderer.dirty=!0,this._rotationTransformDirty=!0,this.setTransformDirty())}updateScale(e){this._scale[0]===e[0]&&this._scale[1]===e[1]||(this._scale[0]=e[0],this._scale[1]=e[1],this._renderer.dirty=!0,this._rotationCenterDirty=!0,this._skinScaleDirty=!0,this.setTransformDirty())}updateVisible(e){this._visible!==e&&(this._visible=e,this._renderer.dirty=!0,this.setConvexHullDirty())}updateEffect(e,t){this._renderer.dirty=!0;const n=o.EFFECT_INFO[e];t?this.enabledEffects|=n.mask:this.enabledEffects&=~n.mask;const r=n.converter;this._uniforms[n.uniformName]=r(t),n.shapeChanges&&this.setConvexHullDirty()}updateProperties(e){"position"in e&&this.updatePosition(e.position),"direction"in e&&this.updateDirection(e.direction),"scale"in e&&this.updateScale(e.scale),"visible"in e&&this.updateVisible(e.visible);const t=o.EFFECTS.length;for(let n=0;n<t;++n){const t=o.EFFECTS[n];t in e&&this.updateEffect(t,e[t])}}_calculateTransform(){if(this._rotationTransformDirty){const e=(270-this._direction)*Math.PI/180,t=Math.cos(e),n=Math.sin(e);this._rotationMatrix[0]=t,this._rotationMatrix[1]=n,this._rotationMatrix[4]=-n,this._rotationMatrix[5]=t,this._rotationTransformDirty=!1}if(this._rotationCenterDirty&&null!==this.skin){const e=this.skin.rotationCenter,t=this.skin.size,n=e[0],r=e[1],i=t[0],s=t[1],o=this._scale[0],a=this._scale[1],c=this._rotationAdjusted;c[0]=(n-i/2)*o/100,c[1]=(r-s/2)*a/100*-1,this._rotationCenterDirty=!1}if(this._skinScaleDirty&&null!==this.skin){const e=this.skin.size,t=this._skinScale;t[0]=e[0]*this._scale[0]/100,t[1]=e[1]*this._scale[1]/100,this._skinScaleDirty=!1}const e=this._uniforms.u_modelMatrix,t=this._skinScale[0],n=this._skinScale[1],r=this._rotationMatrix[0],i=this._rotationMatrix[1],s=this._rotationMatrix[4],o=this._rotationMatrix[5],a=this._rotationAdjusted[0],c=this._rotationAdjusted[1],l=this._position[0],u=this._position[1];e[0]=t*r,e[1]=t*i,e[4]=n*s,e[5]=n*o,e[12]=r*a+s*c+l,e[13]=i*a+o*c+u,this._transformDirty=!1}needsConvexHullPoints(){return!this._convexHullPoints||this._convexHullDirty||0===this._convexHullPoints.length}setConvexHullDirty(){this._convexHullDirty=!0}setConvexHullPoints(e){this._convexHullPoints=e,this._convexHullDirty=!1,this._transformedHullPoints=[];for(let t=0;t<e.length;t++)this._transformedHullPoints.push(r.v3.create());this._transformedHullDirty=!0}_isTouchingNever(e){return!1}_isTouchingNearest(e){return this.skin.isTouchingNearest(h(this,e))}_isTouchingLinear(e){return this.skin.isTouchingLinear(h(this,e))}getBounds(e){if(this.needsConvexHullPoints())throw new Error("Needs updated convex hull points before bounds calculation.");this._transformDirty&&this._calculateTransform();const t=this._getTransformedHullPoints();return(e=e||new i).initFromPointsAABB(t),e}getBoundsForBubble(e){if(this.needsConvexHullPoints())throw new Error("Needs updated convex hull points before bubble bounds calculation.");this._transformDirty&&this._calculateTransform();const t=this._getTransformedHullPoints(),n=Math.max.apply(null,t.map((e=>e[1]))),r=t.filter((e=>e[1]>n-8));return(e=e||new i).initFromPointsAABB(r),e}getAABB(e){this._transformDirty&&this._calculateTransform();const t=this._uniforms.u_modelMatrix;return(e=e||new i).initFromModelMatrix(t),e}getFastBounds(e){return this.needsConvexHullPoints()?this.getAABB(e):this.getBounds(e)}_getTransformedHullPoints(){if(!this._transformedHullDirty)return this._transformedHullPoints;const e=r.m4.ortho(-1,1,-1,1,-1,1),t=this.skin.size,n=1/t[0]/2,i=1/t[1]/2,s=r.m4.multiply(this._uniforms.u_modelMatrix,e);for(let e=0;e<this._convexHullPoints.length;e++){const o=this._convexHullPoints[e],a=this._transformedHullPoints[e];a[0]=.5+-o[0]/t[0]-n,a[1]=o[1]/t[1]-.5+i,r.m4.transformPoint(s,a,a)}return this._transformedHullDirty=!1,this._transformedHullPoints}updateMatrix(){if(this._transformDirty&&this._calculateTransform(),this._inverseTransformDirty){const e=this._inverseMatrix;r.m4.copy(this._uniforms.u_modelMatrix,e),e[10]=1,r.m4.inverse(e,e),this._inverseTransformDirty=!1}}updateCPURenderAttributes(){this.updateMatrix(),this.skin?(this.skin.updateSilhouette(this._scale),this.skin.useNearest(this._scale,this)?this.isTouching=this._isTouchingNearest:this.isTouching=this._isTouchingLinear):(c.warn("Could not find skin for drawable with id: ".concat(this._id)),this.isTouching=this._isTouchingNever)}_skinWasAltered(){this._renderer.dirty=!0,this._rotationCenterDirty=!0,this._skinScaleDirty=!0,this.setConvexHullDirty(),this.setTransformDirty()}static color4fFromID(e){return[(255&(e-=s.ID_NONE))/255,(e>>8&255)/255,(e>>16&255)/255,1]}static color3bToID(e,t,n){let r;return r=255&e,r|=(255&t)<<8,r|=(255&n)<<16,r+s.ID_NONE}static sampleColor4b(e,t,n,r){const i=h(t,e);if(i[0]<0||i[1]<0||i[0]>1||i[1]>1)return n[0]=0,n[1]=0,n[2]=0,n[3]=0,n;const s=t.skin._silhouette.colorAtNearest(i,n);return 0===t.enabledEffects?s:a.transformColor(t,s,r)}}e.exports=d},function(e,t){e.exports="precision mediump float;\n\n#ifdef DRAW_MODE_line\nuniform vec2 u_stageSize;\nattribute vec2 a_lineThicknessAndLength;\nattribute vec4 a_penPoints;\nattribute vec4 a_lineColor;\n\nvarying vec4 v_lineColor;\nvarying float v_lineThickness;\nvarying float v_lineLength;\nvarying vec4 v_penPoints;\n\n// Add this to divisors to prevent division by 0, which results in NaNs propagating through calculations.\n// Smaller values can cause problems on some mobile devices.\nconst float epsilon = 1e-3;\n#endif\n\n#if !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_modelMatrix;\nattribute vec2 a_texCoord;\n#endif\n\nattribute vec2 a_position;\n\nvarying vec2 v_texCoord;\n\nvoid main() {\n\t#ifdef DRAW_MODE_line\n\t// Calculate a rotated (\"tight\") bounding box around the two pen points.\n\t// Yes, we're doing this 6 times (once per vertex), but on actual GPU hardware,\n\t// it's still faster than doing it in JS combined with the cost of uniformMatrix4fv.\n\n\t// Expand line bounds by sqrt(2) / 2 each side-- this ensures that all antialiased pixels\n\t// fall within the quad, even at a 45-degree diagonal\n\tvec2 position = a_position;\n\tfloat expandedRadius = (a_lineThicknessAndLength.x * 0.5) + 1.4142135623730951;\n\n\t// The X coordinate increases along the length of the line. It's 0 at the center of the origin point\n\t// and is in pixel-space (so at n pixels along the line, its value is n).\n\tv_texCoord.x = mix(0.0, a_lineThicknessAndLength.y + (expandedRadius * 2.0), a_position.x) - expandedRadius;\n\t// The Y coordinate is perpendicular to the line. It's also in pixel-space.\n\tv_texCoord.y = ((a_position.y - 0.5) * expandedRadius) + 0.5;\n\n\tposition.x *= a_lineThicknessAndLength.y + (2.0 * expandedRadius);\n\tposition.y *= 2.0 * expandedRadius;\n\n\t// 1. Center around first pen point\n\tposition -= expandedRadius;\n\n\t// 2. Rotate quad to line angle\n\tvec2 pointDiff = a_penPoints.zw;\n\t// Ensure line has a nonzero length so it's rendered properly\n\t// As long as either component is nonzero, the line length will be nonzero\n\t// If the line is zero-length, give it a bit of horizontal length\n\tpointDiff.x = (abs(pointDiff.x) < epsilon && abs(pointDiff.y) < epsilon) ? epsilon : pointDiff.x;\n\t// The `normalized` vector holds rotational values equivalent to sine/cosine\n\t// We're applying the standard rotation matrix formula to the position to rotate the quad to the line angle\n\t// pointDiff can hold large values so we must divide by u_lineLength instead of calling GLSL's normalize function:\n\t// https://asawicki.info/news_1596_watch_out_for_reduced_precision_normalizelength_in_opengl_es\n\tvec2 normalized = pointDiff / max(a_lineThicknessAndLength.y, epsilon);\n\tposition = mat2(normalized.x, normalized.y, -normalized.y, normalized.x) * position;\n\n\t// 3. Translate quad\n\tposition += a_penPoints.xy;\n\n\t// 4. Apply view transform\n\tposition *= 2.0 / u_stageSize;\n\tgl_Position = vec4(position, 0, 1);\n\n\tv_lineColor = a_lineColor;\n\tv_lineThickness = a_lineThicknessAndLength.x;\n\tv_lineLength = a_lineThicknessAndLength.y;\n\tv_penPoints = a_penPoints;\n\t#elif defined(DRAW_MODE_background)\n\tgl_Position = vec4(a_position * 2.0, 0, 1);\n\t#else\n\tgl_Position = u_projectionMatrix * u_modelMatrix * vec4(a_position, 0, 1);\n\tv_texCoord = a_texCoord;\n\t#endif\n}\n"},function(e,t){e.exports='precision mediump float;\n\n#ifdef DRAW_MODE_silhouette\nuniform vec4 u_silhouetteColor;\n#else // DRAW_MODE_silhouette\n# ifdef ENABLE_color\nuniform float u_color;\n# endif // ENABLE_color\n# ifdef ENABLE_brightness\nuniform float u_brightness;\n# endif // ENABLE_brightness\n#endif // DRAW_MODE_silhouette\n\n#ifdef DRAW_MODE_colorMask\nuniform vec3 u_colorMask;\nuniform float u_colorMaskTolerance;\n#endif // DRAW_MODE_colorMask\n\n#ifdef ENABLE_fisheye\nuniform float u_fisheye;\n#endif // ENABLE_fisheye\n#ifdef ENABLE_whirl\nuniform float u_whirl;\n#endif // ENABLE_whirl\n#ifdef ENABLE_pixelate\nuniform float u_pixelate;\nuniform vec2 u_skinSize;\n#endif // ENABLE_pixelate\n#ifdef ENABLE_mosaic\nuniform float u_mosaic;\n#endif // ENABLE_mosaic\n#ifdef ENABLE_ghost\nuniform float u_ghost;\n#endif // ENABLE_ghost\n\n#ifdef DRAW_MODE_line\nvarying vec4 v_lineColor;\nvarying float v_lineThickness;\nvarying float v_lineLength;\n#endif // DRAW_MODE_line\n\n#ifdef DRAW_MODE_background\nuniform vec4 u_backgroundColor;\n#endif // DRAW_MODE_background\n\nuniform sampler2D u_skin;\n\n#ifndef DRAW_MODE_background\nvarying vec2 v_texCoord;\n#endif\n\n// Add this to divisors to prevent division by 0, which results in NaNs propagating through calculations.\n// Smaller values can cause problems on some mobile devices.\nconst float epsilon = 1e-3;\n\n#if !defined(DRAW_MODE_silhouette) && (defined(ENABLE_color))\n// Branchless color conversions based on code from:\n// http://www.chilliant.com/rgb2hsv.html by Ian Taylor\n// Based in part on work by Sam Hocevar and Emil Persson\n// See also: https://en.wikipedia.org/wiki/HSL_and_HSV#Formal_derivation\n\n\n// Convert an RGB color to Hue, Saturation, and Value.\n// All components of input and output are expected to be in the [0,1] range.\nvec3 convertRGB2HSV(vec3 rgb)\n{\n\t// Hue calculation has 3 cases, depending on which RGB component is largest, and one of those cases involves a "mod"\n\t// operation. In order to avoid that "mod" we split the M==R case in two: one for G<B and one for B>G. The B>G case\n\t// will be calculated in the negative and fed through abs() in the hue calculation at the end.\n\t// See also: https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma\n\tconst vec4 hueOffsets = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\n\t// temp1.xy = sort B & G (largest first)\n\t// temp1.z = the hue offset we\'ll use if it turns out that R is the largest component (M==R)\n\t// temp1.w = the hue offset we\'ll use if it turns out that R is not the largest component (M==G or M==B)\n\tvec4 temp1 = rgb.b > rgb.g ? vec4(rgb.bg, hueOffsets.wz) : vec4(rgb.gb, hueOffsets.xy);\n\n\t// temp2.x = the largest component of RGB ("M" / "Max")\n\t// temp2.yw = the smaller components of RGB, ordered for the hue calculation (not necessarily sorted by magnitude!)\n\t// temp2.z = the hue offset we\'ll use in the hue calculation\n\tvec4 temp2 = rgb.r > temp1.x ? vec4(rgb.r, temp1.yzx) : vec4(temp1.xyw, rgb.r);\n\n\t// m = the smallest component of RGB ("min")\n\tfloat m = min(temp2.y, temp2.w);\n\n\t// Chroma = M - m\n\tfloat C = temp2.x - m;\n\n\t// Value = M\n\tfloat V = temp2.x;\n\n\treturn vec3(\n\t\tabs(temp2.z + (temp2.w - temp2.y) / (6.0 * C + epsilon)), // Hue\n\t\tC / (temp2.x + epsilon), // Saturation\n\t\tV); // Value\n}\n\nvec3 convertHue2RGB(float hue)\n{\n\tfloat r = abs(hue * 6.0 - 3.0) - 1.0;\n\tfloat g = 2.0 - abs(hue * 6.0 - 2.0);\n\tfloat b = 2.0 - abs(hue * 6.0 - 4.0);\n\treturn clamp(vec3(r, g, b), 0.0, 1.0);\n}\n\nvec3 convertHSV2RGB(vec3 hsv)\n{\n\tvec3 rgb = convertHue2RGB(hsv.x);\n\tfloat c = hsv.z * hsv.y;\n\treturn rgb * c + hsv.z - c;\n}\n#endif // !defined(DRAW_MODE_silhouette) && (defined(ENABLE_color))\n\nconst vec2 kCenter = vec2(0.5, 0.5);\n\nvoid main()\n{\n\t#if !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\n\tvec2 texcoord0 = v_texCoord;\n\n\t#ifdef ENABLE_mosaic\n\ttexcoord0 = fract(u_mosaic * texcoord0);\n\t#endif // ENABLE_mosaic\n\n\t#ifdef ENABLE_pixelate\n\t{\n\t\t// TODO: clean up "pixel" edges\n\t\tvec2 pixelTexelSize = u_skinSize / u_pixelate;\n\t\ttexcoord0 = (floor(texcoord0 * pixelTexelSize) + kCenter) / pixelTexelSize;\n\t}\n\t#endif // ENABLE_pixelate\n\n\t#ifdef ENABLE_whirl\n\t{\n\t\tconst float kRadius = 0.5;\n\t\tvec2 offset = texcoord0 - kCenter;\n\t\tfloat offsetMagnitude = length(offset);\n\t\tfloat whirlFactor = max(1.0 - (offsetMagnitude / kRadius), 0.0);\n\t\tfloat whirlActual = u_whirl * whirlFactor * whirlFactor;\n\t\tfloat sinWhirl = sin(whirlActual);\n\t\tfloat cosWhirl = cos(whirlActual);\n\t\tmat2 rotationMatrix = mat2(\n\t\t\tcosWhirl, -sinWhirl,\n\t\t\tsinWhirl, cosWhirl\n\t\t);\n\n\t\ttexcoord0 = rotationMatrix * offset + kCenter;\n\t}\n\t#endif // ENABLE_whirl\n\n\t#ifdef ENABLE_fisheye\n\t{\n\t\tvec2 vec = (texcoord0 - kCenter) / kCenter;\n\t\tfloat vecLength = length(vec);\n\t\tfloat r = pow(min(vecLength, 1.0), u_fisheye) * max(1.0, vecLength);\n\t\tvec2 unit = vec / vecLength;\n\n\t\ttexcoord0 = kCenter + r * unit * kCenter;\n\t}\n\t#endif // ENABLE_fisheye\n\n\tgl_FragColor = texture2D(u_skin, texcoord0);\n\n\t#if defined(ENABLE_color) || defined(ENABLE_brightness)\n\t// Divide premultiplied alpha values for proper color processing\n\t// Add epsilon to avoid dividing by 0 for fully transparent pixels\n\tgl_FragColor.rgb = clamp(gl_FragColor.rgb / (gl_FragColor.a + epsilon), 0.0, 1.0);\n\n\t#ifdef ENABLE_color\n\t{\n\t\tvec3 hsv = convertRGB2HSV(gl_FragColor.xyz);\n\n\t\t// this code forces grayscale values to be slightly saturated\n\t\t// so that some slight change of hue will be visible\n\t\tconst float minLightness = 0.11 / 2.0;\n\t\tconst float minSaturation = 0.09;\n\t\tif (hsv.z < minLightness) hsv = vec3(0.0, 1.0, minLightness);\n\t\telse if (hsv.y < minSaturation) hsv = vec3(0.0, minSaturation, hsv.z);\n\n\t\thsv.x = mod(hsv.x + u_color, 1.0);\n\t\tif (hsv.x < 0.0) hsv.x += 1.0;\n\n\t\tgl_FragColor.rgb = convertHSV2RGB(hsv);\n\t}\n\t#endif // ENABLE_color\n\n\t#ifdef ENABLE_brightness\n\tgl_FragColor.rgb = clamp(gl_FragColor.rgb + vec3(u_brightness), vec3(0), vec3(1));\n\t#endif // ENABLE_brightness\n\n\t// Re-multiply color values\n\tgl_FragColor.rgb *= gl_FragColor.a + epsilon;\n\n\t#endif // defined(ENABLE_color) || defined(ENABLE_brightness)\n\n\t#ifdef ENABLE_ghost\n\tgl_FragColor *= u_ghost;\n\t#endif // ENABLE_ghost\n\n\t#ifdef DRAW_MODE_silhouette\n\t// Discard fully transparent pixels for stencil test\n\tif (gl_FragColor.a == 0.0) {\n\t\tdiscard;\n\t}\n\t// switch to u_silhouetteColor only AFTER the alpha test\n\tgl_FragColor = u_silhouetteColor;\n\t#else // DRAW_MODE_silhouette\n\n\t#ifdef DRAW_MODE_colorMask\n\tvec3 maskDistance = abs(gl_FragColor.rgb - u_colorMask);\n\tvec3 colorMaskTolerance = vec3(u_colorMaskTolerance, u_colorMaskTolerance, u_colorMaskTolerance);\n\tif (any(greaterThan(maskDistance, colorMaskTolerance)))\n\t{\n\t\tdiscard;\n\t}\n\t#endif // DRAW_MODE_colorMask\n\t#endif // DRAW_MODE_silhouette\n\n\t#ifdef DRAW_MODE_straightAlpha\n\t// Un-premultiply alpha.\n\tgl_FragColor.rgb /= gl_FragColor.a + epsilon;\n\t#endif\n\n\t#endif // !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\n\n\t#ifdef DRAW_MODE_line\n\t// Maaaaagic antialiased-line-with-round-caps shader.\n\n\t// "along-the-lineness". This increases parallel to the line.\n\t// It goes from negative before the start point, to 0.5 through the start to the end, then ramps up again\n\t// past the end point.\n\tfloat d = ((v_texCoord.x - clamp(v_texCoord.x, 0.0, v_lineLength)) * 0.5) + 0.5;\n\n\t// Distance from (0.5, 0.5) to (d, the perpendicular coordinate). When we\'re in the middle of the line,\n\t// d will be 0.5, so the distance will be 0 at points close to the line and will grow at points further from it.\n\t// For the "caps", d will ramp down/up, giving us rounding.\n\t// See https://www.youtube.com/watch?v=PMltMdi1Wzg for a rough outline of the technique used to round the lines.\n\tfloat line = distance(vec2(0.5), vec2(d, v_texCoord.y)) * 2.0;\n\t// Expand out the line by its thickness.\n\tline -= ((v_lineThickness - 1.0) * 0.5);\n\t// Because "distance to the center of the line" decreases the closer we get to the line, but we want more opacity\n\t// the closer we are to the line, invert it.\n\tgl_FragColor = v_lineColor * clamp(1.0 - line, 0.0, 1.0);\n\t#endif // DRAW_MODE_line\n\n\t#ifdef DRAW_MODE_background\n\tgl_FragColor = u_backgroundColor;\n\t#endif\n}\n'},function(e,t){e.exports={rgbToHsv:(e,t)=>{let[n,r,i]=e,s=0;n/=255,r/=255,i/=255;let o=0;r<i&&(o=r,r=i,i=o,s=-1),n<r&&(o=n,n=r,r=o,s=-2/6-s);const a=n-Math.min(r,i),c=Math.abs(s+(r-i)/(6*a+Number.EPSILON)),l=a/(n+Number.EPSILON),u=n;return t[0]=c,t[1]=l,t[2]=u,t},hsvToRgb:(e,t)=>{let[n,r,i]=e;if(0===r)return t[0]=t[1]=t[2]=255*i+.5,t;n%=1;const s=6*n|0,o=6*n-s,a=i*(1-r),c=i*(1-r*o),l=i*(1-r*(1-o));let u=0,h=0,d=0;switch(s){case 0:u=i,h=l,d=a;break;case 1:u=c,h=i,d=a;break;case 2:u=a,h=i,d=l;break;case 3:u=a,h=c,d=i;break;case 4:u=l,h=a,d=i;break;case 5:u=i,h=a,d=c}return t[0]=255*u+.5,t[1]=255*h+.5,t[2]=255*d+.5,t}}},function(e,t,n){const r=n(11),i=n(35),s=n(27),o=n(28),a={color4f:[0,0,1,1],diameter:1},c=163800;e.exports=class extends s{constructor(e,t){super(e,t),this._size=null,this._framebuffer=null,this._silhouetteDirty=!1,this._silhouettePixels=null,this._silhouetteImageData=null,this._lineOnBufferDrawRegionId={enter:()=>this._enterDrawLineOnBuffer(),exit:()=>this._exitDrawLineOnBuffer()},this._usePenBufferDrawRegionId={enter:()=>this._enterUsePenBuffer(),exit:()=>this._exitUsePenBuffer()};const n=this._renderer.gl;this.renderQuality=1,this._nativeSize=t.getNativeSize();if(this._lineShader=this._renderer._shaderManager.getShader(o.DRAW_MODE.line,0),this._drawTextureShader=this._renderer._shaderManager.getShader(o.DRAW_MODE.default,0),this._drawTextureRegionId={enter:()=>this._enterDrawTexture(),exit:()=>this._exitDrawTexture()},this.a_position_glbuffer=n.createBuffer(),this.a_position_loc=n.getAttribLocation(this._lineShader.program,"a_position"),this.a_lineColor_loc=n.getAttribLocation(this._lineShader.program,"a_lineColor"),this.a_lineThicknessAndLength_loc=n.getAttribLocation(this._lineShader.program,"a_lineThicknessAndLength"),this.a_penPoints_loc=n.getAttribLocation(this._lineShader.program,"a_penPoints"),this.attribute_glbuffer=n.createBuffer(),this.attribute_index=0,this.attribute_data=new Float32Array(c),n.bindBuffer(n.ARRAY_BUFFER,this.attribute_glbuffer),n.bufferData(n.ARRAY_BUFFER,4*this.attribute_data.length,n.STREAM_DRAW),n.drawArraysInstanced)this.instancedRendering=!0,this.glDrawArraysInstanced=n.drawArraysInstanced.bind(n),this.glVertexAttribDivisor=n.vertexAttribDivisor.bind(n);else{const e=n.getExtension("ANGLE_instanced_arrays");e?(this.instancedRendering=!0,this.glDrawArraysInstanced=e.drawArraysInstancedANGLE.bind(e),this.glVertexAttribDivisor=e.vertexAttribDivisorANGLE.bind(e)):this.instancedRendering=!1}if(this.instancedRendering)n.bindBuffer(n.ARRAY_BUFFER,this.a_position_glbuffer),n.bufferData(n.ARRAY_BUFFER,new Float32Array([1,0,0,0,1,1,0,1]),n.STATIC_DRAW);else{const e=new Float32Array(32760);for(let t=0;t<e.length;t+=12)e[t+0]=1,e[t+1]=0,e[t+2]=0,e[t+3]=0,e[t+4]=1,e[t+5]=1,e[t+6]=1,e[t+7]=1,e[t+8]=0,e[t+9]=0,e[t+10]=0,e[t+11]=1;n.bindBuffer(n.ARRAY_BUFFER,this.a_position_glbuffer),n.bufferData(n.ARRAY_BUFFER,e,n.STATIC_DRAW)}this.onNativeSizeChanged=this.onNativeSizeChanged.bind(this),this._renderer.on(i.Events.NativeSizeChanged,this.onNativeSizeChanged),this._setCanvasSize(t.getNativeSize())}dispose(){this._renderer.removeListener(i.Events.NativeSizeChanged,this.onNativeSizeChanged),this._renderer.gl.deleteTexture(this._texture),this._texture=null,super.dispose()}get size(){return this._nativeSize}useNearest(e){return Math.max(e[0],e[1])>=100}getTexture(e){return this._texture}clear(){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const e=this._renderer.gl;e.clearColor(0,0,0,0),e.clear(e.COLOR_BUFFER_BIT),this._silhouetteDirty=!0}drawPoint(e,t,n){this.drawLine(e,t,n,t,n)}drawLine(e,t,n,r,i){const s=e.diameter||a.diameter,o=1===s||3===s?.5:0;this._drawLineOnBuffer(e,t+o,n+o,r+o,i+o),this._silhouetteDirty=!0}_enterDrawLineOnBuffer(){const e=this._renderer.gl;r.bindFramebufferInfo(e,this._framebuffer),e.viewport(0,0,this._size[0],this._size[1]);const t=this._lineShader;e.useProgram(t.program);const n={u_skin:this._texture,u_stageSize:this._size};r.setUniforms(t,n),e.bindBuffer(e.ARRAY_BUFFER,this.a_position_glbuffer),e.enableVertexAttribArray(this.a_position_loc),e.vertexAttribPointer(this.a_position_loc,2,e.FLOAT,!1,8,0),this.attribute_index=0}_exitDrawLineOnBuffer(){this.attribute_index&&this._flushLines();const e=this._renderer.gl;r.bindFramebufferInfo(e,null)}_enterUsePenBuffer(){r.bindFramebufferInfo(this._renderer.gl,this._framebuffer)}_exitUsePenBuffer(){r.bindFramebufferInfo(this._renderer.gl,null)}_enterDrawTexture(){this._enterUsePenBuffer();const e=this._renderer.gl;e.viewport(0,0,this._size[0],this._size[1]),e.useProgram(this._drawTextureShader.program),r.setBuffersAndAttributes(e,this._drawTextureShader,this._renderer._bufferInfo)}_exitDrawTexture(){this._exitUsePenBuffer()}_drawPenTexture(e){this._renderer.enterDrawRegion(this._drawTextureRegionId);const t=this._renderer.gl,n=this._size[0],i=this._size[1],s={u_skin:e,u_projectionMatrix:r.m4.ortho(n/2,n/-2,i/-2,i/2,-1,1,r.m4.identity()),u_modelMatrix:r.m4.scaling(r.v3.create(n,i,0),r.m4.identity())};r.setTextureParameters(t,e,{minMag:t.NEAREST}),r.setUniforms(this._drawTextureShader,s),r.drawBufferInfo(t,this._renderer._bufferInfo,t.TRIANGLES)}_drawLineOnBuffer(e,t,n,r,i){this._renderer.enterDrawRegion(this._lineOnBufferDrawRegionId);const s=this.instancedRendering?1:6;this.attribute_index+10*s>c&&this._flushLines();const o=e.color4f||a.color4f;t*=this.renderQuality,n*=this.renderQuality;const l=(r*=this.renderQuality)-t,u=(i*=this.renderQuality)-n,h=Math.sqrt(l*l+u*u),d=(e.diameter||a.diameter)*this.renderQuality;for(let e=0;e<s;e++)this.attribute_data[this.attribute_index]=o[0]*o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=o[1]*o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=o[2]*o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=o[3],this.attribute_index++,this.attribute_data[this.attribute_index]=d,this.attribute_index++,this.attribute_data[this.attribute_index]=h,this.attribute_index++,this.attribute_data[this.attribute_index]=t,this.attribute_index++,this.attribute_data[this.attribute_index]=-n,this.attribute_index++,this.attribute_data[this.attribute_index]=l,this.attribute_index++,this.attribute_data[this.attribute_index]=-u,this.attribute_index++}_flushLines(){const e=this._renderer.gl;e.bindBuffer(e.ARRAY_BUFFER,this.attribute_glbuffer),e.bufferSubData(e.ARRAY_BUFFER,0,new Float32Array(this.attribute_data.buffer,0,this.attribute_index)),e.enableVertexAttribArray(this.a_lineColor_loc),e.vertexAttribPointer(this.a_lineColor_loc,4,e.FLOAT,!1,40,0),e.enableVertexAttribArray(this.a_lineThicknessAndLength_loc),e.vertexAttribPointer(this.a_lineThicknessAndLength_loc,2,e.FLOAT,!1,40,16),e.enableVertexAttribArray(this.a_penPoints_loc),e.vertexAttribPointer(this.a_penPoints_loc,4,e.FLOAT,!1,40,24),this.instancedRendering?(this.glVertexAttribDivisor(this.a_lineColor_loc,1),this.glVertexAttribDivisor(this.a_lineThicknessAndLength_loc,1),this.glVertexAttribDivisor(this.a_penPoints_loc,1),this.glDrawArraysInstanced(e.TRIANGLE_STRIP,0,4,this.attribute_index/10),this.glVertexAttribDivisor(this.a_lineColor_loc,0),this.glVertexAttribDivisor(this.a_lineThicknessAndLength_loc,0),this.glVertexAttribDivisor(this.a_penPoints_loc,0)):e.drawArrays(e.TRIANGLES,0,this.attribute_index/10),this.attribute_index=0,this._silhouetteDirty=!0}onNativeSizeChanged(e){this._nativeSize=e.newSize,this._setCanvasSize([e.newSize[0]*this.renderQuality,e.newSize[1]*this.renderQuality]),this.emitWasAltered()}_setCanvasSize(e){const[t,n]=e;if(this._size&&this._size[0]===t&&this._size[1]===n)return;this._size=e,this._rotationCenter[0]=this._nativeSize[0]/2,this._rotationCenter[1]=this._nativeSize[1]/2;const i=this._renderer.gl,s=this._texture;this._texture=r.createTexture(i,{mag:i.NEAREST,min:i.NEAREST,wrap:i.CLAMP_TO_EDGE,width:t,height:n});const o=[{format:i.RGBA,attachment:this._texture}];this._framebuffer,this._framebuffer=r.createFramebufferInfo(i,o,t,n),i.clearColor(0,0,0,0),i.clear(i.COLOR_BUFFER_BIT),s&&this._drawPenTexture(s),this._silhouettePixels=new Uint8Array(Math.floor(t*n*4)),this._silhouetteImageData=new ImageData(t,n),this._silhouetteDirty=!0}setRenderQuality(e){this.renderQuality!==e&&(this.renderQuality=e,this._setCanvasSize([Math.round(this._nativeSize[0]*e),Math.round(this._nativeSize[1]*e)]))}updateSilhouette(){if(this._silhouetteDirty){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const e=this._renderer.gl;e.readPixels(0,0,this._size[0],this._size[1],e.RGBA,e.UNSIGNED_BYTE,this._silhouettePixels),this._silhouetteImageData.data.set(this._silhouettePixels),this._silhouette.update(this._silhouetteImageData,!0),this._silhouetteDirty=!1}}}},function(e,t,n){const r=n(11),i=n(27),{loadSvgString:s,serializeSvgToString:o}=n(25),a=n(28);e.exports=class extends i{constructor(e,t){super(e,t),this._svgImage=document.createElement("img"),this._svgImageLoaded=!1,this._size=[0,0],this._canvas=document.createElement("canvas"),this._context=this._canvas.getContext("2d"),this._scaledMIPs=[],this._largestMIPScale=0,this._maxTextureScale=1}dispose(){this.resetMIPs(),super.dispose()}get size(){return[this._size[0],this._size[1]]}useNearest(e,t){return!(t.enabledEffects&(a.EFFECT_INFO.fisheye.mask|a.EFFECT_INFO.whirl.mask|a.EFFECT_INFO.pixelate.mask|a.EFFECT_INFO.mosaic.mask))&&(t._direction%90==0&&(Math.abs(e[0])>99&&Math.abs(e[0])<101&&Math.abs(e[1])>99&&Math.abs(e[1])<101))}createMIP(e){const t=this._largestMIPScale<e;t||this._silhouette.unlazy();const[n,i]=this._size;if(this._canvas.width=n*e,this._canvas.height=i*e,this._canvas.width<=0||this._canvas.height<=0||this._svgImage.naturalWidth<=0||this._svgImage.naturalHeight<=0)return super.getTexture();this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.setTransform(e,0,0,e,0,0),this._context.drawImage(this._svgImage,0,0);const s=this._canvas,o={auto:!1,wrap:this._renderer.gl.CLAMP_TO_EDGE,src:s,premultiplyAlpha:!0},a=r.createTexture(this._renderer.gl,o);return t&&(this._silhouette.update(s),this._largestMIPScale=e),a}updateSilhouette(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(e),this._silhouette.unlazy()}getTexture(e){const t=e?Math.max(Math.abs(e[0]),Math.abs(e[1])):100,n=Math.min(t/100,this._maxTextureScale),r=Math.max(Math.ceil(Math.log2(n))+8,0),i=Math.pow(2,r-8);return this._svgImageLoaded&&!this._scaledMIPs[r]&&(this._scaledMIPs[r]=this.createMIP(i)),this._scaledMIPs[r]||super.getTexture()}resetMIPs(){this._scaledMIPs.forEach((e=>this._renderer.gl.deleteTexture(e))),this._scaledMIPs.length=0,this._largestMIPScale=0}setSVG(e,t){const n=s(e),r=o(n,this._renderer.customFonts);this._svgImageLoaded=!1;const{x:i,y:a,width:c,height:l}=n.viewBox.baseVal;this._size[0]=c,this._size[1]=l,this._svgImage.onload=()=>{if(0===c||0===l)return void super.setEmptyImageData();const e=Math.ceil(Math.max(c,l)),n=this._renderer.maxTextureDimension;let r=2;for(;e*r<=n;r*=2)this._maxTextureScale=r;this.resetMIPs(),void 0===t&&(t=this.calculateRotationCenter()),this._rotationCenter[0]=t[0]-i,this._rotationCenter[1]=t[1]-a,this._svgImageLoaded=!0,this.emitWasAltered()},this._svgImage.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(r))}}},function(e,t,n){const r=n(11),i=n(88),s=n(27),o={maxLineWidth:170,minWidth:50,strokeWidth:4,padding:10,cornerRadius:16,tailHeight:12,font:"Helvetica",fontSize:14,fontHeightRatio:.9,lineHeight:16,bubbleFill:"white",bubbleStroke:"rgba(0, 0, 0, 0.15)",textFill:"#575E75"};e.exports=class extends s{constructor(e,t){super(e,t),this._canvas=document.createElement("canvas"),this._size=[0,0],this._renderedScale=0,this._lines=[],this._textAreaSize={width:0,height:0},this._bubbleType="",this._pointsLeft=!1,this._textDirty=!0,this._textureDirty=!0,this._style=o,this.measurementProvider=new i(this._canvas.getContext("2d")),this.textWrapper=t.createTextWrapper(this.measurementProvider),this._restyleCanvas()}dispose(){this._texture&&(this._renderer.gl.deleteTexture(this._texture),this._texture=null),this._canvas=null,super.dispose()}get size(){return this._textDirty&&this._reflowLines(),this._size}setTextBubble(e,t,n){this._text=t,this._bubbleType=e,this._pointsLeft=n,this._textDirty=!0,this._textureDirty=!0,this.emitWasAltered()}setStyle(e){this._style=Object.assign({},this._style,e),this.measurementProvider.clearCache(),this._restyleCanvas(),this._textDirty=!0,this._textureDirty=!0,this.emitWasAltered()}_restyleCanvas(){this._canvas.getContext("2d").font="".concat(this._style.fontSize,"px ").concat(this._style.font,", sans-serif")}_reflowLines(){this._lines=this.textWrapper.wrapText(this._style.maxLineWidth,this._text);let e=0;for(const t of this._lines)e=Math.max(e,this.measurementProvider.measureText(t));const t=Math.max(e,this._style.minWidth)+2*this._style.padding,n=this._style.lineHeight*this._lines.length+2*this._style.padding;this._textAreaSize.width=t,this._textAreaSize.height=n,this._size[0]=t+this._style.strokeWidth,this._size[1]=n+this._style.strokeWidth+this._style.tailHeight,this._textDirty=!1}_renderTextBubble(e){const t=this._canvas.getContext("2d");this._textDirty&&this._reflowLines();const n=this._textAreaSize.width,r=this._textAreaSize.height;this._canvas.width=Math.ceil(this._size[0]*e),this._canvas.height=Math.ceil(this._size[1]*e),this._restyleCanvas(),t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,this._canvas.width,this._canvas.height),t.scale(e,e),t.translate(.5*this._style.strokeWidth,.5*this._style.strokeWidth),t.save(),this._pointsLeft&&(t.scale(-1,1),t.translate(-n,0)),t.beginPath(),t.moveTo(this._style.cornerRadius,r),t.arcTo(0,r,0,r-this._style.cornerRadius,this._style.cornerRadius),t.arcTo(0,0,n,0,this._style.cornerRadius),t.arcTo(n,0,n,r,this._style.cornerRadius),t.arcTo(n,r,n-this._style.cornerRadius,r,this._style.cornerRadius),t.save(),t.translate(n-this._style.cornerRadius,r),"say"===this._bubbleType?(t.bezierCurveTo(0,4,4,8,4,10),t.arcTo(4,12,2,12,2),t.bezierCurveTo(-1,12,-11,8,-16,0),t.closePath()):(t.arc(-16,0,4,0,Math.PI),t.closePath(),t.moveTo(-7,7.25),t.arc(-9.25,7.25,2.25,0,2*Math.PI),t.moveTo(0,9.5),t.arc(-1.5,9.5,1.5,0,2*Math.PI)),t.restore(),t.fillStyle=this._style.bubbleFill,t.strokeStyle=this._style.bubbleStroke,t.lineWidth=this._style.strokeWidth,t.stroke(),t.fill(),t.restore(),t.fillStyle=this._style.textFill;const i=this._lines;for(let e=0;e<i.length;e++){const n=i[e];t.fillText(n,this._style.padding,this._style.padding+this._style.lineHeight*e+this._style.fontHeightRatio*this._style.fontSize)}this._renderedScale=e}updateSilhouette(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(e)}getTexture(e){const t=e?Math.max(Math.abs(e[0]),Math.abs(e[1])):100,n=Math.min(10,t/100);if(this._textureDirty||this._renderedScale!==n){this._renderTextBubble(n),this._textureDirty=!1;const e=this._canvas.getContext("2d").getImageData(0,0,this._canvas.width,this._canvas.height),t=this._renderer.gl;if(null===this._texture){const e={auto:!1,wrap:t.CLAMP_TO_EDGE};this._texture=r.createTexture(t,e)}this._setTexture(e)}return this._texture}}},function(e,t,n){const r=n(279),i=n(284);e.exports=class{constructor(e){this._measurementProvider=e,this._cache={}}wrapText(e,t){t=t.normalize();const n="".concat(e,"-").concat(t);if(this._cache[n])return this._cache[n];const s=this._measurementProvider.beginMeasurementSession(),o=new r(t);let a,c=0,l=null;const u=[];for(;a=o.nextBreak();){const n=t.slice(c,a.position).replace(/\n+$/,"");let r=(l||"").concat(n),s=this._measurementProvider.measureText(r);if(s>e){if(this._measurementProvider.measureText(n)>e){let t,o=0;for(;o!==(t=i.nextBreak(n,o));){const i=n.substring(o,t);r=(l||"").concat(i),s=this._measurementProvider.measureText(r),null===l||s<=e?l=r:(u.push(l),l=i),o=t}}else null!==l&&u.push(l),l=n}else l=r;a.required&&(null!==l&&u.push(l),l=null),c=a.position}return l=l||"",(l.length>0||0===u.length)&&u.push(l),this._cache[n]=u,this._measurementProvider.endMeasurementSession(s),u}}},function(e,t,n){(function(){var t,r,i,s,o,a,c,l,u,h,d,p,f,m,g,b,y,E,T,v,A,w,S,k,O,I,N;T=n(89),w=n(281),I=n(282),I.BK,u=I.CR,I.LF,I.NL,o=I.CB,i=I.BA,I.SP,v=I.WJ,E=I.SP,s=I.BK,p=I.LF,m=I.NL,t=I.AI,r=I.AL,b=I.SA,y=I.SG,A=I.XX,c=I.CJ,I.ID,g=I.NS,I.characterClasses,N=n(283),h=N.DI_BRK,d=N.IN_BRK,a=N.CI_BRK,l=N.CP_BRK,N.PR_BRK,O=N.pairTable,k=w.toByteArray(" "),S=new T(k),f=function(){var e,n,f;function T(e){this.string=e,this.pos=0,this.lastPos=0,this.curClass=null,this.nextClass=null}return T.prototype.nextCodePoint=function(){var e,t;return e=this.string.charCodeAt(this.pos++),t=this.string.charCodeAt(this.pos),55296<=e&&e<=56319&&56320<=t&&t<=57343?(this.pos++,1024*(e-55296)+(t-56320)+65536):e},n=function(e){switch(e){case t:case b:case y:case A:return r;case c:return g;default:return e}},f=function(e){switch(e){case p:case m:return s;case o:return i;case E:return v;default:return e}},T.prototype.nextCharClass=function(e){return null==e&&(e=!1),n(S.get(this.nextCodePoint()))},e=function(e,t){this.position=e,this.required=null!=t&&t},T.prototype.nextBreak=function(){var t,r,c;for(null==this.curClass&&(this.curClass=f(this.nextCharClass()));this.pos<this.string.length;){if(this.lastPos=this.pos,r=this.nextClass,this.nextClass=this.nextCharClass(),this.curClass===s||this.curClass===u&&this.nextClass!==p)return this.curClass=f(n(this.nextClass)),new e(this.lastPos,!0);if(null==(t=function(){switch(this.nextClass){case E:return this.curClass;case s:case p:case m:return s;case u:return u;case o:return i}}.call(this))){switch(c=!1,O[this.curClass][this.nextClass]){case h:c=!0;break;case d:c=r===E;break;case a:if(!(c=r===E))continue;break;case l:if(r!==E)continue}if(this.curClass=this.nextClass,c)return new e(this.lastPos)}else if(this.curClass=t,this.nextClass===o)return new e(this.lastPos)}if(this.pos>=this.string.length)return this.lastPos<this.string.length?(this.lastPos=this.string.length,new e(this.string.length)):null},T}(),e.exports=f}).call(this)},function(e,t){function n(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function r(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new n,this.dtree=new n}var i=new n,s=new n,o=new Uint8Array(30),a=new Uint16Array(30),c=new Uint8Array(30),l=new Uint16Array(30),u=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new n,d=new Uint8Array(320);function p(e,t,n,r){var i,s;for(i=0;i<n;++i)e[i]=0;for(i=0;i<30-n;++i)e[i+n]=i/n|0;for(s=r,i=0;i<30;++i)t[i]=s,s+=1<<e[i]}var f=new Uint16Array(16);function m(e,t,n,r){var i,s;for(i=0;i<16;++i)e.table[i]=0;for(i=0;i<r;++i)e.table[t[n+i]]++;for(e.table[0]=0,s=0,i=0;i<16;++i)f[i]=s,s+=e.table[i];for(i=0;i<r;++i)t[n+i]&&(e.trans[f[t[n+i]]++]=i)}function g(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function b(e,t,n){if(!t)return n;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var r=e.tag&65535>>>16-t;return e.tag>>>=t,e.bitcount-=t,r+n}function y(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=0,r=0,i=0,s=e.tag;do{r=2*r+(1&s),s>>>=1,++i,n+=t.table[i],r-=t.table[i]}while(r>=0);return e.tag=s,e.bitcount-=i,t.trans[n+r]}function E(e,t,n){var r,i,s,o,a,c;for(r=b(e,5,257),i=b(e,5,1),s=b(e,4,4),o=0;o<19;++o)d[o]=0;for(o=0;o<s;++o){var l=b(e,3,0);d[u[o]]=l}for(m(h,d,0,19),a=0;a<r+i;){var p=y(e,h);switch(p){case 16:var f=d[a-1];for(c=b(e,2,3);c;--c)d[a++]=f;break;case 17:for(c=b(e,3,3);c;--c)d[a++]=0;break;case 18:for(c=b(e,7,11);c;--c)d[a++]=0;break;default:d[a++]=p}}m(t,d,0,r),m(n,d,r,i)}function T(e,t,n){for(;;){var r,i,s,u,h=y(e,t);if(256===h)return 0;if(h<256)e.dest[e.destLen++]=h;else for(r=b(e,o[h-=257],a[h]),i=y(e,n),u=s=e.destLen-b(e,c[i],l[i]);u<s+r;++u)e.dest[e.destLen++]=e.dest[u]}}function v(e){for(var t,n;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return-3;for(e.sourceIndex+=4,n=t;n;--n)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,0}!function(e,t){var n;for(n=0;n<7;++n)e.table[n]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,n=0;n<24;++n)e.trans[n]=256+n;for(n=0;n<144;++n)e.trans[24+n]=n;for(n=0;n<8;++n)e.trans[168+n]=280+n;for(n=0;n<112;++n)e.trans[176+n]=144+n;for(n=0;n<5;++n)t.table[n]=0;for(t.table[5]=32,n=0;n<32;++n)t.trans[n]=n}(i,s),p(o,a,4,3),p(c,l,2,1),o[28]=0,a[28]=258,e.exports=function(e,t){var n,o,a=new r(e,t);do{switch(n=g(a),b(a,2,0)){case 0:o=v(a);break;case 1:o=T(a,i,s);break;case 2:E(a,a.ltree,a.dtree),o=T(a,a.ltree,a.dtree);break;default:o=-3}if(0!==o)throw new Error("Data error")}while(!n);return a.destLen<a.dest.length?"function"==typeof a.dest.slice?a.dest.slice(0,a.destLen):a.dest.subarray(0,a.destLen):a.dest}},function(e,t,n){!function(e){"use strict";var t="undefined"!=typeof Uint8Array?Uint8Array:Array,n="+".charCodeAt(0),r="/".charCodeAt(0),i="0".charCodeAt(0),s="a".charCodeAt(0),o="A".charCodeAt(0),a="-".charCodeAt(0),c="_".charCodeAt(0);function l(e){var t=e.charCodeAt(0);return t===n||t===a?62:t===r||t===c?63:t<i?-1:t<i+10?t-i+26+26:t<o+26?t-o:t<s+26?t-s+26:void 0}e.toByteArray=function(e){var n,r,i,s,o,a;if(e.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var c=e.length;o="="===e.charAt(c-2)?2:"="===e.charAt(c-1)?1:0,a=new t(3*e.length/4-o),i=o>0?e.length-4:e.length;var u=0;function h(e){a[u++]=e}for(n=0,r=0;n<i;n+=4,r+=3)h((16711680&(s=l(e.charAt(n))<<18|l(e.charAt(n+1))<<12|l(e.charAt(n+2))<<6|l(e.charAt(n+3))))>>16),h((65280&s)>>8),h(255&s);return 2===o?h(255&(s=l(e.charAt(n))<<2|l(e.charAt(n+1))>>4)):1===o&&(h((s=l(e.charAt(n))<<10|l(e.charAt(n+1))<<4|l(e.charAt(n+2))>>2)>>8&255),h(255&s)),a},e.fromByteArray=function(e){var t,n,r,i,s=e.length%3,o="";function a(e){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e)}for(t=0,r=e.length-s;t<r;t+=3)n=(e[t]<<16)+(e[t+1]<<8)+e[t+2],o+=a((i=n)>>18&63)+a(i>>12&63)+a(i>>6&63)+a(63&i);switch(s){case 1:o+=a((n=e[e.length-1])>>2),o+=a(n<<4&63),o+="==";break;case 2:o+=a((n=(e[e.length-2]<<8)+e[e.length-1])>>10),o+=a(n>>4&63),o+=a(n<<2&63),o+="="}return o}}(t)},function(e,t){(function(){t.OP=0,t.CL=1,t.CP=2,t.QU=3,t.GL=4,t.NS=5,t.EX=6,t.SY=7,t.IS=8,t.PR=9,t.PO=10,t.NU=11,t.AL=12,t.HL=13,t.ID=14,t.IN=15,t.HY=16,t.BA=17,t.BB=18,t.B2=19,t.ZW=20,t.CM=21,t.WJ=22,t.H2=23,t.H3=24,t.JL=25,t.JV=26,t.JT=27,t.RI=28,t.AI=29,t.BK=30,t.CB=31,t.CJ=32,t.CR=33,t.LF=34,t.NL=35,t.SA=36,t.SG=37,t.SP=38,t.XX=39}).call(this)},function(e,t){(function(){t.DI_BRK=0,t.IN_BRK=1,t.CI_BRK=2,t.CP_BRK=3,t.PR_BRK=4,t.pairTable=[[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4],[0,4,4,1,1,4,4,4,4,1,1,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,4,4,4,4,1,1,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[4,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,1,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,1,0,1,1,0,0,4,2,4,1,1,1,1,1,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,0,1,4,4,4,0,0,1,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,0,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,4,4,2,4,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,1,1,1,1,0,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,1]]}).call(this)},function(e,t,n){(function(e){(function(){var r,i,s,o,a,c,l,u,h,d,p,f,m,g,b,y;y=n(285),r=y.CR,a=y.LF,i=y.Control,s=y.Extend,u=y.Regional_Indicator,h=y.SpacingMark,o=y.L,f=y.V,d=y.T,c=y.LV,l=y.LVT,p=n(89),m=new p(e("AA4QAAAAAAAAAHbgAQgG9/ntmkuIXjUUxzN+r3k4bUWQVotSHVCsoov6qIoiToWKFYvMuLHVtlaoLqQilLrwtakuxFYoLmQQYWalRYpUKYJV0am4mMUooojgSEG7EC2CdiHq/3rzMcc0yT333jyu0xz4kdwkN+ckOXncfN9QS4jzwCqwBqwHt5O0uuFGsBlsAhOM8lvATkv+LrAb7AXPgRfBAfAqeJ2UmwZvgcPgKDgGjoNZMAe+AN+C5W0hLgAXtvN3KZci7UpwFVgHbgHjYAPYJJ8nwCTYCnaQ58dI+cfBHvn8DFgL9kl9LyP8LLOflJ8CM+Q5K39IPo/28vfeyd6X8fcR/5jYP4v4nHyeR/iNjC8gPAl+BU+T8qcRFx0hBsGKzn/74LreIrdKxsGkRO0zE48wy7lmZSfnYkmWdhnCtTK+oHnnWqUPbuyY679N5t2J8B4ZnyTltyK+Dezq5P62G+Femf+sDPdp6n8JaQcterN5NWXJ5/Ij+FnGR0n6BvCbZk4kwjGjjO8rGh9woedNoudtBz6VSCQSiUQikUgkEomET97t5Hdp/ecvGfcXH+CdWfLNu6onxGowh7SvZPp3CE+A63v5feBJxMcQPyXz/0D4N2h18+cRhEcQnt+1674I+Q+inofANrAd7AAPg529lJfyUl7KS3mu8+4G94H7e/H3rPWRid3+RGIpc0nBGbAuE63F39VV1mjS6Pn4VCv++jN9bs4JMM5gbFSIdaNnpj+ppE3j+QQYWybEA8vytP0IPwF/gpXLsQ+AhWH0xYgQPwwJMTjA46YRXrnVw4vxzYjvke8dzvQx60gkEonE0uQA9oU3wB04J7yH/fDDVv4/j+x/QqfJXv0RuEueJe7t5vkTCLeQ88V2zVkjq+tRpD/Rzf+39hTC55lnkhdQbr+l7EHkTZH8GcTnSf4hkpf9/+uI57NQFT6HTSsC6hMYg3no/FrTF983sH84FJ3xNlroteOfQWNTp+8vL/CZeeX5mgb62A2w6WaDXa/9D/6DeFTafqwBfXtFT4irwacObMnm50/dPPwF4e/grwa0kUsTxiMEnQbcY9ZlsDXwL4iyOIfEB5jvcEgST1L/u/PjkP7vctzaZzkuJZSepknsMaw67jQ0xZe61F2XyvZ5k/ecJq4voXzQ1oZWQRm1Dl1ZH0LtiiVN8pUmy9nQD77bppuTLqWl1O9Ch+9vv9Dfm12COrZqOrXRJv13TX6i00XHyISLNamp3/e6eWWab9xyoYSr1+XeUoWug7ZWFTonhLDPO9M8pOX7cVHwbhn7Yu1VantC61ZtMPWhaiMtX0YXp1wsf7X5p65sW/OslnXpV3XrN803WneXlC0zvj5EZ5sP/6yyXsQQ01rRVdJV/+XWXUZ/rPmp7gf9dNuZoKjOmOOZibqv6fY43fi6bp9pfoXyL1tZ0x5Fy6u+UcVOrm1FZxdOPS7OLi7sFaKaXt+2c/X71qELqbhcD4v8wgRnb6+rr459rqgr3H5T21tmza0r3LOnj/6oWkcmnP6pa7OPvve9dvmqm+PD1HdteyP3e7xsX/mcK7Y26tJV0bXfVI/vOa9bZ3wIbS9nraehKHiH248cn/KxtpX1bV3bQoptnGx+S9ND2xujn6jo+ku3Jvic16oO3djo7CsrnHWdM1dd9UPR/OFQ9rtKl2ZaQ4vaWWe9KGOzSV8dcenPZdvhUny1QZdW1ce4fuhSdGuYb/F1h8IV3/PPlR0+pOya6dofdPuDbt8oug9uis+YvguqjiHnnVDz1KbfR30637f1Y5U+1o2VrVxZMX37qvfcof1XJzFtCKG76plJCJ7fhTq/FJ0hqI/FFtMaGWOv69vjUsrePZTZQ331h8lm07dj1fpCn2Fi3EX09atn2L6Ynsv4AFfUernj4HucbGc8dU0w+aDL+4M6YmtLX0z3I7Ha4Fpn1bufKucck2/YfIhrP3dfci0h5puv9TfUPs21g8bbmvzQZ4tQfhNSiuZ4HVzp4rShTHt9icl2l31YVTqB6Eus81pd/U2xuwyxpYrNPsik1wCoDEZmyDMjCmXFZVtV8d12DqoMizP7zCeh9anyDw==","base64")),g=function(e,t){var n,r,i;return t=t||0,55296<=(n=e.charCodeAt(t))&&n<=56319?(r=n,56320<=(i=e.charCodeAt(t+1))&&i<=57343?1024*(r-55296)+(i-56320)+65536:r):56320<=n&&n<=57343?(i=n,55296<=(r=e.charCodeAt(t-1))&&r<=56319?1024*(r-55296)+(i-56320)+65536:i):n},b=function(e,t){return(e!==r||t!==a)&&(e===i||e===r||e===a||(t===i||t===r||t===a||(e!==o||t!==o&&t!==f&&t!==c&&t!==l)&&((e!==c&&e!==f||t!==f&&t!==d)&&((e!==l&&e!==d||t!==d)&&((e!==u||t!==u)&&(t!==s&&t!==h))))))},t.nextBreak=function(e,t){var n,r,i,s,o,a,c;if(null==t&&(t=0),t<0)return 0;if(t>=e.length-1)return e.length;for(i=m.get(g(e,t)),n=s=t+1,o=e.length;s<o;n=s+=1)if(!(55296<=(a=e.charCodeAt(n-1))&&a<=56319&&56320<=(c=e.charCodeAt(n))&&c<=57343)){if(r=m.get(g(e,n)),b(i,r))return n;i=r}return e.length},t.previousBreak=function(e,t){var n,r,i,s,o,a;if(null==t&&(t=e.length),t>e.length)return e.length;if(t<=1)return 0;for(t--,r=m.get(g(e,t)),n=s=t-1;s>=0;n=s+=-1)if(!(55296<=(o=e.charCodeAt(n))&&o<=56319&&56320<=(a=e.charCodeAt(n+1))&&a<=57343)){if(i=m.get(g(e,n)),b(i,r))return n+1;r=i}return 0},t.break=function(e){var n,r,i;for(i=[],r=0;(n=t.nextBreak(e,r))<e.length;)i.push(e.slice(r,n)),r=n;return r<e.length&&i.push(e.slice(r)),i},t.countBreaks=function(e){var n,r,i;for(r=0,i=0;(n=t.nextBreak(e,i))<e.length;)i=n,r++;return i<e.length&&r++,r}}).call(this)}).call(this,n(18).Buffer)},function(e){e.exports=JSON.parse('{"Other":0,"CR":1,"LF":2,"Control":3,"Extend":4,"Regional_Indicator":5,"SpacingMark":6,"L":7,"V":8,"T":9,"LV":10,"LVT":11}')},function(e,t){e.exports=".scratch-render-overlays {\n    position: absolute;\n    top: 0;\n    left: 0;\n    pointer-events: none;\n    overflow: hidden;\n}\n.scratch-render-overlays > * {\n    position: absolute;\n    top: 0;\n    left: 0;\n}\n"},function(e,t,n){const r=n(288),i=n(36),s=n(290),o=n(291),a=n(293),c=n(294),l=n(295),u=n(296),h=n(297),d=n(92),p=n(298);e.exports=class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:(()=>{const e=window.AudioContext||window.webkitAudioContext;if(!e)throw new Error("Browser does not support AudioContext");return new e})();this.audioContext=e,this.inputNode=this.audioContext.createGain(),this.inputNode.connect(this.audioContext.destination),this.audioBuffers={},this.loudness=null,this.effects=[u,h,d],r(this.audioContext)}get currentTime(){return this.audioContext.currentTime}get EFFECT_NAMES(){return{pitch:"pitch",pan:"pan"}}get DECAY_DURATION(){return.025}get DECAY_WAIT(){return.05}getInputNode(){return this.inputNode}_decodeSound(e){const t=e.data.buffer.slice(0),n=s();var r,a;return(r=this.audioContext,a=t,1===r.decodeAudioData.length?r.decodeAudioData(a):new Promise(((e,t)=>{r.decodeAudioData(a,(t=>e(t)),(e=>t(e)))}))).catch((()=>{if(0===e.data.length)return this._emptySound();const t=e.data.buffer.slice(0);return new o(this.audioContext).decode(t).catch((()=>this._emptySound()))})).then((e=>[n,e]),(e=>{i.warn("audio data could not be decoded",e)}))}_emptySound(){return this.audioContext.createBuffer(1,1,this.audioContext.sampleRate)}decodeSound(e){return this._decodeSound(e).then((e=>{let[t,n]=e;return this.audioBuffers[t]=n,t}))}decodeSoundPlayer(e){return this._decodeSound(e).then((e=>{let[t,n]=e;return new c(this,{id:t,buffer:n})}))}getLoudness(){return this.loudness||(this.loudness=new a(this.audioContext)),this.loudness.getLoudness()}createEffectChain(){const e=new l(this,this.effects);return e.connect(this),e}createBank(){return new p(this,this.createEffectChain())}}},function(e,t,n){const r=n(289);e.exports=function(e){if("undefined"!=typeof document)return r(e)}},function(e,t){const n=["mousedown","mouseup","keydown","keyup","touchstart","touchend"];e.exports=e=>{if("running"===e.state)return;const t=()=>{"running"===e.state&&(()=>{e.removeEventListener("statechange",t);for(const e of n)document.body.removeEventListener(e,r)})()};e.addEventListener("statechange",t);const r=()=>{e.resume()};for(const e of n)document.body.addEventListener(e,r)}},function(e,t){const n="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";e.exports=function(){const e=n.length,t=[];for(let r=0;r<20;r++)t[r]=n.charAt(Math.random()*e);return t.join("")}},function(e,t,n){const r=n(292),i=n(36),s=[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],o=[-1,-1,-1,-1,2,4,6,8,-1,-1,-1,-1,2,4,6,8];let a=null;e.exports=class{constructor(e){this.audioContext=e}static get STEP_TABLE(){return s}static get INDEX_TABLE(){return o}decode(e){return new Promise(((t,n)=>{const s=new r(e);"RIFF"!==s.readUint8String(4)&&(i.warn("incorrect adpcm wav header"),n(new Error("incorrect adpcm wav header")));const o=s.readInt32();o+8!==e.byteLength&&i.warn("adpcm wav length in header: ".concat(o," is incorrect"));"WAVE"!==s.readUint8String(4)&&(i.warn("incorrect adpcm wav header"),n(new Error("incorrect adpcm wav header")));const a=this.extractChunk("fmt ",s);this.encoding=a.readUint16(),this.channels=a.readUint16(),this.samplesPerSecond=a.readUint32(),this.bytesPerSecond=a.readUint32(),this.blockAlignment=a.readUint16(),this.bitsPerSample=a.readUint16(),a.position+=2,this.samplesPerBlock=a.readUint16(),this.adpcmBlockSize=(this.samplesPerBlock-1)/2+4;const c=this.extractChunk("data",s),l=this.numberOfSamples(c,this.adpcmBlockSize),u=this.audioContext.createBuffer(1,l,this.samplesPerSecond);this.imaDecompress(c,this.adpcmBlockSize,u.getChannelData(0)),t(u)}))}extractChunk(e,t){for(t.position=12;t.position<t.getLength()-8;){const n=t.readUint8String(4),r=t.readInt32();if(n===e){return t.extract(r)}t.position+=r}}numberOfSamples(e,t){if(!e)return 0;e.position=0;const n=e.getBytesAvailable();return(n/t|0)*(2*(t-4))+1+2*Math.max(n%t-4,0)+Math.min(n%t,1)}imaDecompress(e,t,n){let r,i,c,l=0,u=-1;if(!e)return;e.position=0;const h=n.length,d=2*(t-4),p=function(){if(null===a){const e=s.length,t=o.length;a=new Array(e*t).fill(0);let n=0;for(let r=0;r<e;r++)for(let e=0;e<t;e++){const t=s[r];let i=0;4&e&&(i+=t),2&e&&(i+=t>>1),1&e&&(i+=t>>2),i+=t>>3,a[n++]=8&e?-i:i}}return a}();let f=0;for(;f<h;){r=e.readInt16(),l=e.readUint8(),e.position++,l>88&&(l=88),n[f++]=r/32768;const t=Math.min(d,h-f),s=f;for(;f-s<t;)u=e.readUint8(),i=15&u,c=p[16*l+i],l+=o[i],l>88?l=88:l<0&&(l=0),r+=c,r>32767?r=32767:r<-32768&&(r=-32768),n[f++]=r/32768,i=u>>4&15,c=p[16*l+i],l+=o[i],l>88?l=88:l<0&&(l=0),r+=c,r>32767?r=32767:r<-32768&&(r=-32768),n[f++]=r/32768}}}},function(e,t){class n{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.byteLength,{_uint8View:r=new Uint8Array(e)}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.arrayBuffer=e,this.start=t,this.end=n,this._uint8View=r,this._position=t}extract(e){return new n(this.arrayBuffer,this._position,this._position+e,this)}getLength(){return this.end-this.start}getBytesAvailable(){return this.end-this._position}get position(){return this._position-this.start}set position(e){this._position=e+this.start}readUint8(){const e=this._uint8View[this._position];return this._position+=1,e}readUint8String(e){const t=this._uint8View;let n="";const r=this._position+e;for(let e=this._position;e<r;e++)n+=String.fromCharCode(t[e]);return this._position+=e,n}readInt16(){const e=new Int16Array(this.arrayBuffer,this._position,1)[0];return this._position+=2,e}readUint16(){const e=new Uint16Array(this.arrayBuffer,this._position,1)[0];return this._position+=2,e}readInt32(){let e;return e=this._position%4==0?new Int32Array(this.arrayBuffer,this._position,1)[0]:new Int32Array(this.arrayBuffer.slice(this._position,this._position+4))[0],this._position+=4,e}readUint32(){const e=new Uint32Array(this.arrayBuffer,this._position,1)[0];return this._position+=4,e}}e.exports=n},function(e,t,n){const r=n(36);e.exports=class{constructor(e){this.audioContext=e,this.connectingToMic=!1,this.mic=null}getLoudness(){if(this.mic||this.connectingToMic||(this.connectingToMic=!0,navigator.mediaDevices.getUserMedia({audio:!0}).then((e=>{this.audioStream=e,this.mic=this.audioContext.createMediaStreamSource(e),this.analyser=this.audioContext.createAnalyser(),this.mic.connect(this.analyser),this.micDataArray=new Float32Array(this.analyser.fftSize)})).catch((e=>{r.warn(e)}))),this.mic&&this.audioStream.active){this.analyser.getFloatTimeDomainData(this.micDataArray);let e=0;for(let t=0;t<this.micDataArray.length;t++)e+=Math.pow(this.micDataArray[t],2);let t=Math.sqrt(e/this.micDataArray.length);return this._lastValue&&(t=Math.max(t,.6*this._lastValue)),this._lastValue=t,t*=1.63,t=Math.sqrt(t),t=Math.round(100*t),t=Math.min(t,100),t}return-1}}},function(e,t,n){const{EventEmitter:r}=n(19),i=n(92),s="ended";class o extends r{constructor(e,t){let{id:n,buffer:r}=t;super(),this.id=n,this.audioEngine=e,this.buffer=r,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(e){e.type===s&&this.onEnded()}onEnded(){this.emit("stop"),this.isPlaying=!1}_createSource(){null!==this.outputNode&&(this.outputNode.removeEventListener(s,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(s,this.handleEvent),null!==this.target&&this.connect(this.target)}initialize(){this.initialized=!0,this._createSource()}connect(e){return e===this.volumeEffect?(this.outputNode.disconnect(),void this.outputNode.connect(this.volumeEffect.getInputNode())):(this.target=e,this.initialized?(null===this.volumeEffect?(this.outputNode.disconnect(),this.outputNode.connect(e.getInputNode())):this.volumeEffect.connect(e),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(s,this.handleEvent);const e=new o(this.audioEngine,this);return e.playbackRate=this.playbackRate,this.isPlaying&&(e.startingUntil=this.startingUntil,e.isPlaying=this.isPlaying,e.initialized=this.initialized,e.outputNode=this.outputNode,e.outputNode.addEventListener(s,e.handleEvent),e.volumeEffect=this.volumeEffect,e.volumeEffect&&(e.volumeEffect.audioPlayer=e),null!==this.target&&e.connect(this.target),this.emit("stop"),e.emit("play")),this.outputNode=null,this.volumeEffect=null,this.initialized=!1,this.startingUntil=0,this.isPlaying=!1,e}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:e,DECAY_DURATION:t}=this.audioEngine;this.startingUntil=e+t,this.emit("play")}stop(){if(!this.isPlaying)return;const e=this.take();e.volumeEffect=new i(e.audioEngine,e,null),e.volumeEffect.connect(e.target),e.finished().then((()=>e.dispose())),e.volumeEffect.set(0);const{currentTime:t,DECAY_DURATION:n}=this.audioEngine;e.outputNode.stop(t+n)}stopImmediately(){this.isPlaying&&(this.outputNode.stop(),this.isPlaying=!1,this.startingUntil=0,this.emit("stop"))}finished(){return new Promise((e=>{this.once("stop",e)}))}setPlaybackRate(e){this.playbackRate=e,this.initialized&&(this.outputNode.playbackRate.value=e)}}e.exports=o},function(e,t){class n{constructor(e,t){this.audioEngine=e,this.inputNode=this.audioEngine.audioContext.createGain(),this.effects=t;let n=null;this._effects=t.reverse().map((t=>{const r=new t(e,this,n);return this[r.name]=r,n=r,r})).reverse(),this.firstEffect=this._effects[0],this.lastEffect=this._effects[this._effects.length-1],this._soundPlayers=new Set}clone(){const e=new n(this.audioEngine,this.effects);return this.target&&e.connect(this.target),e}addSoundPlayer(e){this._soundPlayers.has(e)||(this._soundPlayers.add(e),this.update())}removeSoundPlayer(e){this._soundPlayers.remove(e)}getInputNode(){return this.inputNode}connect(e){const{firstEffect:t,lastEffect:n}=this;if(e===n)return this.inputNode.disconnect(),void this.inputNode.connect(n.getInputNode());e!==t&&(this.target=e,t.connect(e))}getSoundPlayers(){return[...this._soundPlayers]}setEffectsFromTarget(e){this._effects.forEach((t=>{"soundEffects"in e&&t.name in e.soundEffects?t.set(e.soundEffects[t.name]):t.name in e&&t.set(e[t.name])}))}set(e,t){e in this&&this[e].set(t)}update(){this._effects.forEach((e=>e.update()))}clear(){this._effects.forEach((e=>e.clear()))}dispose(){this._soundPlayers=null,this._effects.forEach((e=>e.dispose())),this._effects=null}}e.exports=n},function(e,t,n){const r=n(52);e.exports=class extends r{constructor(e,t,n){super(e,t,n),this.leftGain=null,this.rightGain=null,this.channelMerger=null}get name(){return"pan"}initialize(){const e=this.audioEngine.audioContext;this.inputNode=e.createGain(),this.leftGain=e.createGain(),this.rightGain=e.createGain(),this.channelMerger=e.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(e){this.value=e;const t=(e+100)/200,n=Math.cos(t*Math.PI/2),r=Math.sin(t*Math.PI/2),{currentTime:i,DECAY_WAIT:s,DECAY_DURATION:o}=this.audioEngine;this.leftGain.gain.setTargetAtTime(n,i+s,o),this.rightGain.gain.setTargetAtTime(r,i+s,o)}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(e,t,n){const r=n(52);e.exports=class extends r{constructor(e,t,n){super(e,t,n),this.ratio=1}get name(){return"pitch"}get _isPatch(){return!1}getInputNode(){return this.target.getInputNode()}initialize(){this.initialized=!0}_set(e){this.value=e,this.ratio=this.getRatio(this.value),this.updatePlayers(this.audioPlayer.getSoundPlayers())}update(){this.updatePlayers(this.audioPlayer.getSoundPlayers())}getRatio(e){const t=e/10;return Math.pow(2,t/12)}updatePlayer(e){e.setPlaybackRate(this.ratio)}updatePlayers(e){if(e)for(const t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.updatePlayer(e[t])}}},function(e,t,n){const r=n(36);e.exports=class{constructor(e,t){this.audioEngine=e,this.soundPlayers={},this.playerTargets=new Map,this.soundEffects=new Map,this.effectChainPrime=t}addSoundPlayer(e){this.soundPlayers[e.id]=e}getSoundPlayer(e){return this.soundPlayers[e]||r.error("SoundBank.getSoundPlayer(".concat(e,"): called missing sound in bank")),this.soundPlayers[e]}getSoundEffects(e){return this.soundEffects.has(e)||this.soundEffects.set(e,this.effectChainPrime.clone()),this.soundEffects.get(e)}playSound(e,t){const n=this.getSoundEffects(t),r=this.getSoundPlayer(t);return this.playerTargets.get(t)!==e&&r.stop(),this.playerTargets.set(t,e),n.addSoundPlayer(r),n.setEffectsFromTarget(e),r.connect(n),r.play(),r.finished()}setEffects(e){this.playerTargets.forEach(((t,n)=>{t===e&&this.getSoundEffects(n).setEffectsFromTarget(e)}))}stop(e,t){this.playerTargets.get(t)===e&&this.soundPlayers[t].stop()}stopAllSounds(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";this.playerTargets.forEach(((t,n)=>{"*"!==e&&t!==e||this.getSoundPlayer(n).stop()}))}dispose(){this.playerTargets.clear(),this.soundEffects.forEach((e=>e.dispose())),this.soundEffects.clear();for(const e in this.soundPlayers)Object.prototype.hasOwnProperty.call(this.soundPlayers,e)&&this.soundPlayers[e].dispose();this.soundPlayers={}}}},function(e,t,n){"use strict";n.r(t),n.d(t,"SB1File",(function(){return st})),n.d(t,"AssertionError",(function(){return r})),n.d(t,"ValidationError",(function(){return i}));class r extends Error{}class i extends r{}const s=function(e,t){if(!e)throw new r(t)};s.validate=function(e,t){if(!e)throw new i(t)};class o{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.buffer=e,this.position=t,this.uint8a=new Uint8Array(this.buffer)}read(e){const t=e.read(this.uint8a,this.position);return 0===e.size?this.position+=e.sizeOf(this.uint8a,this.position):this.position+=e.size,t}readStruct(e){const t=new e(this.uint8a,this.position);return this.position+=e.size,t}resize(e){if(this.buffer.byteLength<e){const t=this.uint8a,n=Math.pow(2,Math.ceil(Math.log(e)/Math.log(2)));this.buffer=new ArrayBuffer(n),this.uint8a=new Uint8Array(this.buffer),this.uint8a.set(t)}}write(e,t){return 0===e.size?this.resize(this.position+e.writeSizeOf(t)):this.resize(this.position+e.size),e.write(this.uint8a,this.position,t),0===e.size?this.position+=e.writeSizeOf(this.uint8a,this.position):this.position+=e.size,t}writeStruct(e,t){this.resize(this.position+e.size);const n=Object.assign(new e(this.uint8a,this.position),t);return this.position+=e.size,n}writeBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length;s(e instanceof Uint8Array,"writeBytes must be passed an Uint8Array"),this.resize(this.position+(n-t));for(let r=t;r<n;r++)this.uint8a[this.position+r-t]=e[r];return this.position+=n-t,e}}class a{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/0;this.iter=e,this.maxPosition=t}[Symbol.iterator](){return this}next(){return this.iter.stream.position>=this.maxPosition?{value:null,done:!0}:this.iter.next()}}const c=()=>{throw new Error("Not implemented")},l=(()=>{const e=new Uint16Array(1),t=new Uint8Array(e.buffer);return e[0]=43707,187===t[0]})();class u{constructor(e){let{size:t=0,sizeOf:n=()=>t,writeSizeOf:r=c,toBytes:i=new Uint8Array(1),read:s,write:o=c}=e;this.size=t,this.sizeOf=n,this.writeSizeOf=r,this.toBytes=i,this.bytes=new Uint8Array(i.buffer),this.read=s,this.write=o}asPropertyObject(e){const t=this;return{get(){return t.read(this.uint8a,e+this.offset)},set(n){return t.write(this.uint8a,e+this.offset,n)},enumerable:!0}}read(){return null}}const h=new u({size:1,read:(e,t)=>e[t],write:(e,t,n)=>(e[t]=n,n)}),d={size:2,read(e,t){return this.bytes[1]=e[t+0],this.bytes[0]=e[t+1],this.toBytes[0]},write(e,t,n){return this.toBytes[0]=n,e[t+0]=this.bytes[1],e[t+1]=this.bytes[0],n}},p={size:2,read(e,t){return this.bytes[0]=e[t+0],this.bytes[1]=e[t+1],this.toBytes[0]},write(e,t,n){return this.toBytes[0]=n,e[t+0]=this.bytes[0],e[t+1]=this.bytes[1],n}};let f;f=l?d:p;new u(Object.assign({},f,{toBytes:new Uint16Array(1)}));const m=new u(Object.assign({},f,{toBytes:new Int16Array(1)})),g={size:4,read(e,t){return this.bytes[3]=e[t+0],this.bytes[2]=e[t+1],this.bytes[1]=e[t+2],this.bytes[0]=e[t+3],this.toBytes[0]},write(e,t,n){return this.toBytes[0]=n,e[t+0]=this.bytes[3],e[t+1]=this.bytes[2],e[t+2]=this.bytes[1],e[t+3]=this.bytes[0],n}},b={size:4,read(e,t){return this.bytes[0]=e[t+0],this.bytes[1]=e[t+1],this.bytes[2]=e[t+2],this.bytes[3]=e[t+3],this.toBytes[0]},write(e,t,n){return this.toBytes[0]=n,e[t+0]=this.bytes[0],e[t+1]=this.bytes[1],e[t+2]=this.bytes[2],e[t+3]=this.bytes[3],n}};let y;y=l?g:b;const E=new u(Object.assign({},y,{toBytes:new Int32Array(1)})),T=new u(Object.assign({},y,{toBytes:new Uint32Array(1)}));let v;v=l?p:d;const A=new u(Object.assign({},v,{toBytes:new Uint16Array(1)}));let w;w=l?b:g;const S=new u(Object.assign({},w,{toBytes:new Uint32Array(1)}));let k;k=l?{size:8,read(e,t){return this.bytes[7]=e[t+0],this.bytes[6]=e[t+1],this.bytes[5]=e[t+2],this.bytes[4]=e[t+3],this.bytes[3]=e[t+4],this.bytes[2]=e[t+5],this.bytes[1]=e[t+6],this.bytes[0]=e[t+7],this.toBytes[0]}}:{size:8,read(e,t){return this.bytes[7]=e[t+0],this.bytes[6]=e[t+1],this.bytes[5]=e[t+2],this.bytes[4]=e[t+3],this.bytes[3]=e[t+4],this.bytes[2]=e[t+5],this.bytes[1]=e[t+6],this.bytes[0]=e[t+7],this.toBytes[0]}};const O=new u(Object.assign({},k,{toBytes:new Float64Array(1)}));class I extends u{constructor(e){super({size:e,read(t,n){let r="";for(let i=0;i<e;i++){const e=t[n+i];s(e<=127,"Non-ascii character in FixedAsciiString"),r+=String.fromCharCode(e)}return r},write(t,n,r){for(let i=0;i<e;i++){const e=r.charCodeAt(i);s(e<=127,"Non-ascii character in FixedAsciiString"),t[n+i]=e}return r}})}}var N=n(21);const R=10485760;let x;x=new u(l?{size:3,read:(e,t)=>e[t+0]<<16|e[t+1]<<8|e[t+2]}:{size:3,read:(e,t)=>e[t+2]<<16|e[t+1]<<8|e[t+0]});const M=new u({sizeOf(e,t){const n=m.read(e,t);return m.size+n},read(e,t){let n=0,r=0;const i=m.read(e,t);for(let s=0;s<i;s++)n+=r*h.read(e,t++),r*=256;return n}}),C=new u({sizeOf(e,t){const n=T.read(e,t);return T.size+n},read(e,t){const n=T.read(e,t);s(n<R,"asciiString too big"),t+=4;let r="";for(let i=0;i<n;i++)r+=String.fromCharCode(e[t++]);return r}}),P=new u({sizeOf:(e,t)=>T.size+T.read(e,t),read(e,t){const n=T.read(e,t);return s(n<R,"bytes too big"),t+=T.size,s(n<R,"uint8a array too big"),new Uint8Array(e.buffer,t,n)}}),D=new u({sizeOf:(e,t)=>T.size+2*T.read(e,t),read(e,t){const n=T.read(e,t);s(n<R,"sound too big"),t+=T.size;const r=2*n;return s(r<R,"uint8a array too big"),new Uint8Array(e.buffer,t,r)}}),L=new u({sizeOf:(e,t)=>T.size+T.read(e,t)*T.size,read(e,t){const n=T.read(e,t);s(n<R,"bitmap too big"),t+=T.size,s(n<R,"uint8a array too big");const r=new Uint32Array(n);for(let i=0;i<n;i++)r[i]=T.read(e,t),t+=T.size;return r}});let B;B="undefined"==typeof TextDecoder?new N.TextDecoder:new TextDecoder;const U=new u({sizeOf:(e,t)=>T.size+T.read(e,t),read(e,t){const n=T.read(e,t);return s(n<R,"utf8 too big"),t+=T.size,s(n<R,"uint8a array too big"),B.decode(new Uint8Array(e.buffer,t,n))}}),F=new u({size:4,read(e,t){const n=T.read(e,t);return(255<<24|(n>>22&255)<<16|(n>>12&255)<<8|n>>2&255)>>>0}}),j=new u({size:5,read(e,t){const n=T.read(e,t);return(h.read(e,t)<<24|(n>>22&255)<<16|(n>>12&255)<<8|n>>2&255)>>>0}}),z={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},G=Object.entries(z).reduce(((e,t)=>{let[n,r]=t;return e[r]=n,e}),{});class V{constructor(e,t){this.classId=e,this.position=t}}const _=e=>"object"==typeof e&&e?e.valueOf():e;class Y extends V{constructor(e,t,n){super(e,t),this.value=n}valueOf(){return this.value}toJSON(){return this.classId===z.TRANSLUCENT_COLOR||this.classId===z.COLOR?16777215&this.value:this.value}toString(){return this.value}}class H extends V{constructor(e,t,n){super(e,t),this.size=n}}class W extends V{constructor(e,t,n){super(e,t),this.index=n}valueOf(){return"Ref(".concat(this.index,")")}}class K extends H{constructor(e,t,n,r){super(e,t,r),this.version=n}}class X{constructor(e){let{type:t=Y,read:n,value:r=(n?e=>e.read(n):null)}=e;this.type=t,this.value=r}next(e,t,n){return{value:new this.type(t,n,this.value(e)),done:!1}}}const Z={[z.NULL]:{value:()=>null},[z.TRUE]:{value:()=>!0},[z.FALSE]:{value:()=>!1},[z.SMALL_INT]:{read:E},[z.SMALL_INT_16]:{read:m},[z.LARGE_INT_POSITIVE]:{read:M},[z.LARGE_INT_NEGATIVE]:{read:M},[z.FLOATING]:{read:O},[z.STRING]:{read:C},[z.SYMBOL]:{read:C},[z.BYTES]:{read:P},[z.SOUND]:{read:D},[z.BITMAP]:{read:L},[z.UTF8]:{read:U},[z.ARRAY]:{type:H,read:E},[z.ORDERED_COLLECTION]:{type:H,read:E},[z.SET]:{type:H,read:E},[z.IDENTITY_SET]:{type:H,read:E},[z.DICTIONARY]:{type:H,value:e=>2*e.read(E)},[z.IDENTITY_DICTIONARY]:{type:H,value:e=>2*e.read(E)},[z.COLOR]:{read:F},[z.TRANSLUCENT_COLOR]:{read:j},[z.POINT]:{type:H,value:()=>2},[z.RECTANGLE]:{type:H,value:()=>4},[z.FORM]:{type:H,value:()=>5},[z.SQUEAK]:{type:H,value:()=>6},[z.OBJECT_REF]:{type:W,read:x}},q=Array.from({length:256},((e,t)=>Z[t]?new X(Z[t]):null)),Q=new X({type:class extends H{constructor(e,t){super(e,t,0)}},value:()=>null});class J{constructor(e,t){this.buffer=e,this.stream=new o(e,t)}[Symbol.iterator](){return this}next(){if(this.stream.position>=this.stream.uint8a.length)return{value:null,done:!0};const e=this.stream.position,t=this.stream.read(h),n=q[t];if(null!==n)return n.next(this.stream,t,e);if(t<z.OBJECT_REF)return Q.next(this.stream,t,e);const r=this.stream.read(h),i=this.stream.read(h);return{value:new K(t,e,r,i),done:!1}}}class ${constructor(e){let{classId:t,version:n,fields:r}=e;this.classId=t,this.version=n,this.fields=r}get FIELDS(){return[]}get RAW_FIELDS(){return this.fields}string(e){return String(this.fields[e])}number(e){return+this.fields[e]}boolean(e){return!!this.fields[e]}toString(){return this.constructor===$?"".concat(this.constructor.name," ").concat(this.classId," ").concat(G[this.classId]):this.constructor.name}static define(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:$;class n extends t{get FIELDS(){return e}static get FIELDS(){return e}}return Object.keys(e).forEach((t=>{const r=e[t];Object.defineProperty(n.prototype,t.toLowerCase().replace(/_(\w)/g,(e=>{let[,t]=e;return t.toUpperCase()})),{get(){return this.fields[r]}})})),n}}class ee{constructor(){let e;this.bit=new Uint32Array(1),this.crc=0,this.c=0,this.table=[];for(let t=0;t<256;t++){e=t;for(let t=0;t<8;t++)e=1&e?3988292384^e>>>1:e>>>1;this.table[t]=e>>>0}}update(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=~this.crc>>>0;for(let i=0;i<n;i++)r=r>>>8^this.table[255&(r^e[t+i])];return this.crc=~r>>>0,this}get digest(){return this.crc}}const te=[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],ne=[4294967295,4278190080],re=new u({sizeOf(e,t){const n=e[t];return n<=223?1:n<=254?2:5},read(e,t){const n=e[t];return n<=223?n:n<=254?256*(n-224)+e[t+1]:T.read(e,t+1)}});class ie{decode(e,t,n,r,i){const s=this.decodePixels(r,32===n);if(n<=8)return i||(i=1===n?ne:te),this.unpackPixels(s,e,t,n,i);if(16===n)return this.raster16To32(s,e,t);if(32===n)return s;throw new Error("Unhandled Squeak Image depth.")}decodePixels(e,t){let n;if(Array.isArray(e)||e instanceof Uint32Array){if(n=new Uint32Array(e),t)for(let e=0;e<n.length;e++)0!==n[e]&&(n[e]=4278190080|n[e]);return n}const r=new o(e.buffer,e.byteOffset),i=r.read(re);n=new Uint32Array(i);let s=0;for(;s<i;){const e=r.read(re),i=e>>2;let o;switch(3&e){case 0:s+=i;break;case 1:o=r.read(h),o|=o<<24|o<<16|o<<8,t&&0!==o&&(o|=4278190080);for(let e=0;e<i;e++)n[s++]=o;break;case 2:o=r.read(T),t&&0!==o&&(o|=4278190080);for(let e=0;e<i;e++)n[s++]=o;break;case 3:for(let e=0;e<i;e++)o=r.read(T),t&&0!==o&&(o|=4278190080),n[s++]=o}}return n}unpackPixels(e,t,n,r,i){const s=new Uint32Array(t*n),o=(1<<r)-1,a=32/r;let c=0,l=0;for(let u=0;u<n;u++){let n,u=-1;for(let h=0;h<t;h++)u<0&&(u=r*(a-1),n=e[l++]),s[c++]=i[n>>u&o],u-=r}return s}raster16To32(e,t,n){const r=new Uint32Array(2*e.length);let i,s,o,a=0,c=0;for(let l=0;l<n;l++){i=-1;for(let n=0;n<t;n++){if(i<0&&(i=16,s=e[a++]),o=s>>i&65535,0!==o){o=4278190080|(o>>7&248)<<16|(o>>2&248)<<8|o<<3&248}r[c++]=o,i-=16}}return r}buildCustomColormap(e,t,n){const r=new Uint32Array(1<<e);for(let e=0;e<t.length;e++)r[e]=n[t[e].index-1];return r}}const se=[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],oe={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 ae{constructor(e){this.bitsPerSample=e,this.indexTable=oe[e],this.signMask=1<<e-1,this.valueMask=this.signMask-1,this.valueHighBit=this.signMask>>1,this.bitPosition=0,this.currentByte=0,this.stream=null,this.end=0}decode(e){this.bitPosition=0,this.currentByte=0,this.stream=new o(e.buffer,e.byteOffset),this.end=e.byteOffset+e.length;const t=Math.floor(8*e.length/this.bitsPerSample),n=new Int16Array(t);let r=0,i=0;for(let e=0;e<t;e++){const t=this.nextCode();s(t>=0,"Ran out of bits in Squeak Sound");let o=se[i],a=0;for(let e=this.valueHighBit;e>0;e>>=1)t&e&&(a+=o),o>>=1;a+=o,r+=t&this.signMask?-a:a,i+=this.indexTable[t],i<0&&(i=0),i>88&&(i=88),r>32767&&(r=32767),r<-32768&&(r=-32768),n[e]=r}return n}nextCode(){let e=this.bitsPerSample,t=e-this.bitPosition,n=t<0?this.currentByte>>-t:this.currentByte<<t;for(;t>0;){if(e-=this.bitPosition,!(this.end-this.stream.position>0))return this.currentByte=0,this.bitPosition=0,-1;this.currentByte=this.stream.read(h),this.bitPosition=8,t=e-this.bitPosition,n+=t<0?this.currentByte>>-t:this.currentByte<<t}return this.bitPosition-=e,this.currentByte=this.currentByte&255>>8-this.bitPosition,n}static samples(e,t){return 8*t.length/e}}class ce{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(this.size),t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.uint8a=e,this.offset=t}equals(e){for(const t in e)if(this[t]!==e[t])return!1;return!0}view(){const e=this.constructor.name,t={toString:()=>e};for(const e in this.shape)t[e]=this[e];return t}static initConstructor(e){return e.size=e.prototype.size,e}static extend(e){const t=class extends ce{get shape(){return e}};let n=0;return Object.keys(e).forEach((r=>{if(Object.defineProperty(t.prototype,r,e[r].asPropertyObject(n)),0===e[r].size)throw new Error("Packet cannot be defined with variable sized members.");n+=e[r].size})),t.prototype.size=n,t.size=n,t}}class le extends(ce.extend({riff:new I(4),length:S,wave:new I(4)})){}ce.initConstructor(le);class ue extends(ce.extend({chunkType:new I(4),length:S})){}ce.initConstructor(ue);class he extends(ce.extend({format:A,channels:A,sampleRate:S,bytesPerSec:S,blockAlignment:A,bitsPerSample:A})){}ce.initConstructor(he);class de{encode(e){let{channels:t=1,sampleRate:n=22050}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const r=new Uint8Array(e.buffer,e.byteOffset,e.byteLength),i=le.size+ue.size+he.size+ue.size+r.length,s=new o(new ArrayBuffer(i));return s.writeStruct(le,{riff:"RIFF",length:i-8,wave:"WAVE"}),s.writeStruct(ue,{chunkType:"fmt ",length:he.size}),s.writeStruct(he,{format:1,channels:t,sampleRate:n,bytesPerSec:2*n*t,blockAlignment:2*t,bitsPerSample:16}),s.writeStruct(ue,{chunkType:"data",length:i-s.position-ue.size}),s.writeBytes(r),s.uint8a}static encode(e,t){return(new de).encode(e,t)}static samples(e){const t=new ue(e,le.size).length;return new ue(e,le.size+ue.size+t).length/2}}var pe=n(37),fe=n.n(pe);class me extends($.define({X:0,Y:1})){}class ge extends($.define({X:0,Y:1,X2:2,Y2:3})){get width(){return this.x2-this.x}get height(){return this.y2-this.y}}class be extends($.define({WIDTH:0,HEIGHT:1,DEPTH:2,BYTES:4,COLORMAP:5})){get decoded(){return this._decoded||(this._decoded=(e=>{for(let t=0;t<e.length;t+=4){const n=e[t+2],r=e[t+0];e[t+2]=r,e[t+0]=n}return e})(new Uint8Array((new ie).decode(this.width.value,this.height.value,this.depth.value,this.bytes.value,this.colormap&&this.colormap.map((e=>e.valueOf()))).buffer))),this._decoded}get extension(){return"uncompressed"}}class ye extends($.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 Ee extends($.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!(1&this.fields[this.FIELDS.VISIBLE])}get tempoBPM(){return this.fields[this.FIELDS.TEMPO_BPM]||0}get lists(){return this.fields[this.FIELDS.LISTS]||[]}}$.define({RECTANGLE:0,FONT:8,COLOR:9,LINES:11});class Te extends($.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 be?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 e=(new ee).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=e.digest}return this._crc}get extension(){return this.oldComposite instanceof be?"uncompressed":this.baseLayerData.value?"jpg":"uncompressed"}toString(){return'ImageMediaData "'.concat(this.costumeName,'"')}}class ve extends($.define({DATA:3,RATE:4})){}class Ae extends($.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 ae(this.bitsPerSample.value).decode(this.data.value):this._decoded=new Int16Array((e=>{const t=new Uint8Array(e);for(let n=0;n<t.length;n+=2)t[n]=e[n+1],t[n+1]=e[n];return t})(this.uncompressed.data.value.slice()).buffer)),this._decoded}get crc(){return this._crc||(this._crc=(new ee).update(new Uint32Array([this.rate])).update(this.rawBytes).digest),this._crc}get sampleCount(){return this.data&&this.data.value?ae.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(de.encode(this.decoded,{sampleRate:this.rate&&this.rate.value}))),this._wavEncodedData}get md5(){return this._md5||(this._md5=fe()(this.wavEncodedData)),this._md5}toString(){return'SoundMediaData "'.concat(this.name,'"')}}class we extends($.define({BOX:0,HIDDEN_WHEN_NULL:1,LIST_NAME:8,CONTENTS:9,TARGET:10})){get x(){return null===_(this.hiddenWhenNull)?5:this.box.x+1}get y(){return null===_(this.hiddenWhenNull)?5:this.box.y+1}get width(){return this.box.width-2}get height(){return this.box.height-2}}class Se extends($.define({BOX:0,PARENT:1,FRAMES:2,COLOR:3,DIRECTION:8,ALIGNMENT:9})){}class ke extends($.define({BOX:0,PARENT:1,COLOR:3})){}class Oe extends($.define({BOX:0,COLOR:3,VALUE:8})){}class Ie extends($.define({BOX:0,READOUT_FRAME:1,COLOR:3,FONT:6,VALUE:8,TARGET:10,CMD:11,PARAM:13})){}class Ne extends($.define({BOX:0})){}const Re=1,xe=2,Me=3;class Ce extends($.define({BOX:0,TARGET:1,SHAPE:2,READOUT:14,READOUT_FRAME:15,SLIDER:16,ALIGNMENT:17,SLIDER_MIN:20,SLIDER_MAX:21})){get x(){return this.box.x}get y(){return this.box.y}get mode(){return null===_(this.slider)?this.readoutFrame.box.height<=14?Re:xe:Me}get isDiscrete(){return Math.floor(this.sliderMin)===this.sliderMin&&Math.floor(this.sliderMax)===this.sliderMax&&Math.floor(this.readout.value)===this.readout.value}}const Pe={[z.POINT]:me,[z.RECTANGLE]:ge,[z.FORM]:be,[z.SQUEAK]:be,[z.SAMPLED_SOUND]:ve,[z.SPRITE]:Ee,[z.STAGE]:ye,[z.IMAGE_MEDIA]:Te,[z.SOUND_MEDIA]:Ae,[z.ALIGNMENT]:Se,[z.MORPH]:ke,[z.WATCHER_READOUT_FRAME]:Ne,[z.STATIC_STRING]:Oe,[z.UPDATING_STRING]:Ie,[z.WATCHER]:Ce,[z.LIST_WATCHER]:we},De=Array.from({length:256},((e,t)=>Pe[t]||null));class Le{constructor(e){this.valueIterator=e}[Symbol.iterator](){return this}next(){const e=this.valueIterator.next();if(e.done)return e;const t=e.value,{classId:n}=t;let r=t;if(t instanceof H){r=[];for(let e=0;e<t.size;e++)r.push(this.next().value)}if(null!==De[n]||t instanceof K){r=new(De[t.classId]||$)({classId:t.classId,version:t.version,fields:r})}return{value:r,done:!1}}}class Be{constructor(e){this.table=Array.from(e),this.fixed=this.fix(this.table)}fix(){const e=[];for(let t=0;t<this.table.length;t++)this.fixItem(this.table[t]),e.push(this.table[t]);return e}fixItem(e){if(void 0!==e.fields&&(e=e.fields),Array.isArray(e))for(let t=0;t<e.length;t++)e[t]=this.deref(e[t])}deref(e){return e instanceof W?this.table[e.index-1]:e}}class Ue extends(ce.extend({support8Bit:h,png:new I(3),dosLineEnding:new I(2),dosEndOfFile:new I(1),unixLineEnding:new I(1)})){static validate(){s(this.equals({support8Bit:137,png:"PNG",dosLineEnding:"\r\n",dosEndOfFile:"",unixLineEnding:"\n"}),"PNGSignature does not match the expected values")}}ce.initConstructor(Ue);class Fe extends(ce.extend({length:T,chunkType:new I(4)})){}ce.initConstructor(Fe);class je extends(ce.extend({checksum:T})){}ce.initConstructor(je);class ze extends(ce.extend({width:T,height:T,bitDepth:h,colorType:h,compressionMethod:h,filterMethod:h,interlaceMethod:h})){}ce.initConstructor(ze);class Ge extends(ce.extend({method:h})){}ce.initConstructor(Ge);class Ve{constructor(){this.adler=1}update(e,t,n){let r=65535&this.adler,i=this.adler>>>16;for(let s=0;s<n;s++)r=(r+e[t+s])%65521,i=(i+r)%65521;return this.adler=i<<16|r,this}get digest(){return this.adler}}const _e=65535;class Ye extends(ce.extend({cmf:h,flag:h})){}ce.initConstructor(Ye);class He extends(ce.extend({lastPacket:h,length:A,lengthCheck:A})){}ce.initConstructor(He);class We extends(ce.extend({checksum:S})){}ce.initConstructor(We);class Ke{constructor(e){this.stream=e}get uint8a(){return this.stream.uint8a}set uint8a(e){return this.stream.uint8a=e,this.stream.uint8a}get position(){return this.stream.position}set position(e){return this.stream.position=e,this.stream.position}writeStruct(e,t){return this.stream.writeStruct(e,t)}writeBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length;return this.stream.writeBytes(e,t,n)}}class Xe extends Ke{constructor(e){super(e),this.stream.writeStruct(Ye,{cmf:8,flag:29}),this.adler=new Ve,this.chunk=this.stream.writeStruct(He,{lastPacket:0,length:0,lengthCheck:65535})}get _deflateIndex(){return this.chunk.length}set _deflateIndex(e){return this.chunk.length=e,this.chunk.lengthCheck=65535^e,this.chunk.length}writeStruct(e,t){this.writeBytes(Object.assign(new e,t).uint8a)}writeBytes(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.length,r=t;for(;n-r>0;){this._deflateIndex===_e&&(this.chunk=this.stream.writeStruct(He,{lastPacket:0,length:0,lengthCheck:65535}));const t=Math.min(n-r,_e-this._deflateIndex);this.stream.writeBytes(e,r,r+t),this._deflateIndex+=t,r+=t}this.adler.update(e,t,n-t)}finish(){this.chunk.lastPacket=1,this.stream.writeStruct(We,{checksum:this.adler.digest})}static estimateSize(e){const t=Math.ceil(e/_e);return Ye.size+t*He.size+We.size+e}}class Ze extends Ke{constructor(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"IHDR";super(e),this.start=this.stream.writeStruct(Fe,{length:0,chunkType:t}),this.crc=new ee}finish(){const e=this.start.offset+this.start.size,t=this.position-e;this.start.length=t,this.crc.update(this.stream.uint8a,e-T.size,t+T.size),this.stream.writeStruct(je,{checksum:this.crc.digest})}static size(e){return Fe.size+e+je.size}}class qe{encode(e,t,n){const r=4*e+Ge.size,i=r*t,s=Ue.size+Ze.size(ze.size)+Ze.size(Xe.estimateSize(i))+Ze.size(0),a=new o(new ArrayBuffer(s));a.writeStruct(Ue,{support8Bit:137,png:"PNG",dosLineEnding:"\r\n",dosEndOfFile:"",unixLineEnding:"\n"});const c=new Ze(a,"IHDR");c.writeStruct(ze,{width:e,height:t,bitDepth:8,colorType:6,compressionMethod:0,filterMethod:0,interlaceMethod:0}),c.finish();const l=new Ze(a,"IDAT"),u=new Xe(l);let h=0;for(;h<n.length;){u.writeStruct(Ge,{method:0});const e=Math.min(n.length-h,r-Ge.size);u.writeBytes(n,h,h+e),h+=e}u.finish(),l.finish();return new Ze(a,"IEND").finish(),a.buffer}static encode(e,t,n){return(new qe).encode(e,t,n)}}class Qe{constructor(e){this.file=e}async(e){return s("uint8array"===e,"SB1FakeZipFile only supports uint8array"),Promise.resolve(this.file.bytes)}}class Je{constructor(e){this.files=e}file(e){if(e in this.files)return new Qe(this.files[e])}}const $e=e=>"uncompressed"===e.extension?new Uint8Array(qe.encode(e.width,e.height,e.decoded)):e.decoded,et=e=>{const t=String(e[e.length-1]),n=e.length-1;return"mouse"===t?e[n]="_mouse_":"edge"===t?e[n]="_edge_":e[e.length-1]instanceof ye&&(e[n]="_stage_"),e},tt={getParam:e=>{let[t,n,r,i]=e;return[t,n,r,i||"r"]},changeVariable:e=>[e[2],e[1],e[3]],EventHatMorph:e=>"Scratch-StartClicked"===String(e[1])?["whenGreenFlag"]:["whenIReceive",e[1]],MouseClickEventHatMorph:()=>["whenClicked"],KeyEventHatMorph:e=>["whenKeyPressed",e[1]],stopScripts:e=>"other scripts"===String(e[1])?[e[0],"other scripts in sprite"]:e,abs:e=>["computeFunction:of:","abs",e[1]],sqrt:e=>["computeFunction:of:","sqrt",e[1]],"\\\\":e=>["%",...e.slice(1)],doReturn:()=>["stopScripts","this script"],stopAll:()=>["stopScripts","all"],"showBackground:":e=>["startScene",e[1]],nextBackground:()=>["nextScene"],doForeverIf:e=>["doForever",[["doIf",e[1],e[2]]]],"getAttribute:of:":et,"gotoSpriteOrMouse:":et,"distanceTo:":et,"pointTowards:":et,"touching:":et},nt=e=>{const{info:t,stageData:n,images:r,sounds:i}=e,s=e=>{const t=[];for(let n=0;n<e.length;n+=2)t.push([e[n],e[n+1]]);return t},o=e=>{let[t,n]=e;return{name:t,value:n,isPersistent:!1}},a=e=>{let[,{listName:t,contents:n,x:r,y:i,width:s,height:o,hiddenWhenNull:a}]=e;return{listName:t,contents:n,isPersistent:!1,x:r,y:i,width:s,height:o,visible:null!==(c=a,"object"==typeof c&&c?c.valueOf():c)};var c},c=e=>{const t=i.findIndex((t=>t.crc===e.crc));return{soundName:e.name,soundID:t,md5:"".concat(e.md5,".wav"),sampleCount:e.sampleCount,rate:e.rate,format:""}},l=e=>{const t=r.findIndex((t=>t.crc===e.crc));return{costumeName:e.costumeName,baseLayerID:t,baseLayerMD5:"".concat(fe()(e.rawBytes),".").concat((n=e,"uncompressed"===n.extension?"png":"jpg")),bitmapResolution:1,rotationCenterX:e.rotationCenter.x,rotationCenterY:e.rotationCenter.y};var n},u=e=>{let t=e.map(d);const n=tt[t[0]];return n&&(t=n(t)),t},h=e=>e.map(u),d=e=>e instanceof Ee?e.objName:Array.isArray(e)?0===e.length||Array.isArray(e[0])?h(e):u(e):e,p=e=>[e[0].x,e[0].y,h(e[1])],f=e=>e instanceof Ee?(e=>{const t=e.media.filter((e=>e instanceof Te)),r=e.media.filter((e=>e instanceof Ae));return{objName:e.objName,variables:s(e.vars).map(o),lists:s(e.lists).map(a),scripts:e.blocksBin.map(p),costumes:t.map(l),currentCostumeIndex:t.findIndex((t=>t.crc===e.currentCostume.crc)),sounds:r.map(c),scratchX:e.scratchX,scratchY:e.scratchY,scale:e.scalePoint.x,direction:Math.round(1e6*e.rotationDegrees)/1e6-270,rotationStyle:e.rotationStyle,isDraggable:e.draggable,indexInLibrary:n.spriteOrderInLibrary.indexOf(e),visible:e.visible,spriteInfo:{}}})(e):null;return JSON.parse(JSON.stringify(Object.assign((e=>{const t=e.media.filter((e=>e instanceof Te)),n=e.media.filter((e=>e instanceof Ae));return{objName:e.objName,variables:s(e.vars).map(o),lists:s(e.lists).map(a),scripts:e.blocksBin.map(p),costumes:t.map(l),currentCostumeIndex:t.findIndex((t=>t.crc===e.currentCostume.crc)),sounds:n.map(c),penLayerMD5:"5c81a336fab8be57adc039a8a2b33ca9.png",penLayerID:0,tempoBPM:e.tempoBPM,videoAlpha:.5,children:e.stageContents.map(f).filter(Boolean).reverse()}})(n),{info:(e=>{const t={};for(let n=0;n<e.length;n+=2)"thumbnail"!==String(e[n])&&(t[String(e[n])]=String(e[n+1]));return t})(t)})))};class rt extends(ce.extend({version:new I(10),infoByteLength:T})){validate(){s.validate(this.equals({version:"ScratchV01"})||this.equals({version:"ScratchV02"}),"Invalid Scratch file signature.")}}ce.initConstructor(rt);class it extends(ce.extend({ObjS:new I(4),ObjSValue:h,Stch:new I(4),StchValue:h,numObjects:T})){validate(){s.validate(this.equals({ObjS:"ObjS",ObjSValue:1,Stch:"Stch",StchValue:1}),"Invalid Scratch file info packet header.")}}ce.initConstructor(it);class st{constructor(e){this.buffer=e,this.stream=new o(e),this.signature=this.stream.readStruct(rt),this.signature.validate(),this.infoHeader=this.stream.readStruct(it),this.infoHeader.validate(),this.stream.position+=this.signature.infoByteLength-it.size,this.dataHeader=this.stream.readStruct(it),this.dataHeader.validate()}get json(){return nt({info:this.info(),stageData:this.data(),images:this.images(),sounds:this.sounds()})}get zip(){return(e=>{let{images:t,sounds:n}=e;const r={};let i=0;for(const e of t)r["".concat(i++,".").concat((s=e,"uncompressed"===s.extension?"png":"jpg"))]={bytes:$e(e)};var s,o;i=0;for(const e of n)r["".concat(i++,".wav")]={bytes:(o=e,o.wavEncodedData)};return new Je(r)})({images:this.images(),sounds:this.sounds()})}view(){return{signature:this.signature,infoHeader:this.infoHeader,dataHeader:this.dataHeader,toString:()=>"SB1File"}}infoRaw(){return new a(new J(this.buffer,this.infoHeader.offset+it.size),this.signature.infoByteLength+rt.size)}infoTable(){return new Le(this.infoRaw())}info(){return this._info||(this._info=new Be(this.infoTable()).table[0]),this._info}dataRaw(){return new a(new J(this.buffer,this.dataHeader.offset+it.size),this.stream.uint8a.length)}dataTable(){return new Le(this.dataRaw())}dataFixed(){return this._data||(this._data=new Be(this.dataTable()).table),this._data}data(){return this.dataFixed()[0]}images(){const e=new Set;return this.dataFixed().filter((t=>t instanceof Te&&(!e.has(t.crc)&&(e.add(t.crc),!0))))}sounds(){const e=new Set;return this.dataFixed().filter((t=>t instanceof Ae&&(!e.has(t.crc)&&(e.add(t.crc),!0))))}}},function(e,t,n){"use strict";n.r(t);var r={};n.r(r),n.d(r,"Scaffolding",(function(){return _})),n.d(r,"Cloud",(function(){return A})),n.d(r,"VM",(function(){return a.a})),n.d(r,"Renderer",(function(){return l.a})),n.d(r,"Storage",(function(){return g})),n.d(r,"AudioEngine",(function(){return p.a})),n.d(r,"JSZip",(function(){return s.a}));var i=n(22),s=n.n(i),o=n(54),a=n.n(o),c=n(84),l=n.n(c),u=n(90),h=n.n(u),d=n(91),p=n.n(d),f=n(25);class m extends h.a{constructor(){super(),this._totalAssets=0,this._loadedAssets=0}_updateProgress(){this.onprogress&&this.onprogress(this._totalAssets,this._loadedAssets)}load(e,t,n){return e===this.AssetType.ImageBitmap||e===this.AssetType.ImageVector||e===this.AssetType.Sound||e===this.AssetType.Font?(this._totalAssets++,this._updateProgress(),super.load(e,t,n).then((e=>(this._loadedAssets++,this._updateProgress(),e)))):super.load(e,t,n)}}var g=m;class b{constructor(){this._events={}}addEventListener(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}removeEventListener(e,t){const n=this._events[e];n&&(this._events[e]=n.filter((e=>e!==t)))}dispatchEvent(e){const t=this._events[e.type];if(t)for(const n of t)n(e)}}const y=[],E=e=>{let t;var n;return 0===y.length?(n={audio:!1,video:e},t=navigator.mediaDevices?navigator.mediaDevices.getUserMedia(n):Promise.reject(new Error("video is not supported in this context (insecure domain?)")),y.push(t)):y.length>0&&(t=y[0],y.push(!0)),t};class T{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((e=>this.onError(e)))}_teardown(){if(!1===this.enabled){const e=(y.pop(),!(y.length>0));this._singleSetup=null,this._video=null,this._track&&e&&this._track.stop(),this._track=null}}getFrame(e){let{dimensions:t=T.DIMENSIONS,mirror:n=this.mirror,format:r=T.FORMAT_IMAGE_DATA,cacheTimeout:i=this._frameCacheTimeout}=e;if(!this.videoReady)return null;const[s,o]=t,a=this._getWorkspace({dimensions:t,mirror:Boolean(n)}),{videoWidth:c,videoHeight:l}=this._video,{canvas:u,context:h,lastUpdate:d,cacheData:p}=a,f=Date.now();d+i<f&&(n&&(h.scale(-1,1),h.translate(-1*s,0)),h.drawImage(this._video,0,0,c,l,0,0,s,o),h.setTransform(1,0,0,1,0,0),a.lastUpdate=f),p[r]||(p[r]={lastUpdate:0});const m=p[r];return m.lastUpdate+i<f&&(r===T.FORMAT_IMAGE_DATA?m.lastData=h.getImageData(0,0,s,o):r===T.FORMAT_CANVAS?(m.lastUpdate=1/0,m.lastData=u):(console.error("video io error - unimplemented format ".concat(r)),m.lastUpdate=1/0,m.lastData=null),m.lastUpdate=Math.max(a.lastUpdate,m.lastUpdate)),m.lastData}onError(e){console.error("Unhandled video io device error",e)}_setupVideo(){return this._singleSetup||(this._singleSetup=E({width:{min:480,ideal:640},height:{min:360,ideal:480}}).then((e=>{this._video=document.createElement("video");try{this._video.srcObject=e}catch(t){this._video.src=window.URL.createObjectURL(e)}return this._video.play(),this._track=e.getTracks()[0],this})).catch((e=>{this._singleSetup=null,this.onError(e)}))),this._singleSetup}get videoReady(){if(!this.enabled)return!1;if(!this._video)return!1;if(!this._track)return!1;const{videoWidth:e,videoHeight:t}=this._video;return"number"==typeof e&&"number"==typeof t&&(0!==e&&0!==t)}_getWorkspace(e){let{dimensions:t,mirror:n}=e,r=this._workspace.find((e=>e.dimensions.join("-")===t.join("-")&&e.mirror===n));return r||(r={dimensions:t,mirror:n,canvas:document.createElement("canvas"),lastUpdate:0,cacheData:{}},r.canvas.width=t[0],r.canvas.height=t[1],r.context=r.canvas.getContext("2d"),this._workspace.push(r)),r}}var v=T;var A={CloudManager:class{constructor(e){this.parent=e,this.providers=[],this.overrides=new Map}hasCloudData(){return this.parent.vm.runtime.hasCloudData()}projectReady(){if(this.hasCloudData())for(const e of this.providers)e.enable()}setVariable(e,t,n){this.overrides.has(t)&&this.overrides.get(t)!==e||this.parent.vm.postIOData("cloud",{varUpdate:{name:t,value:n}})}getUsername(){return this.parent._username}addProvider(e){e.manager=this,this.hasCloudData()&&e.enable(),this.providers.push(e)}requestCloseConnection(){}createVariable(e,t){}renameVariable(e,t){}deleteVariable(e){}addProviderOverride(e,t){if(t&&!this.providers.includes(t))throw new Error("Manager is not aware of this provider");this.overrides.set(e,t)}updateVariable(e,t){if(this.overrides.has(e)){const n=this.overrides.get(e);n&&n.handleUpdateVariable(e,t)}else for(const n of this.providers)n.handleUpdateVariable(e,t)}},WebSocketProvider:class{constructor(e,t){this.cloudHosts=Array.isArray(e)?e:[e],this.projectId=t,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(e){this.projectId=e,this.closeAndReconnect()}openConnection(){this.projectId||console.warn("Project ID is empty. Cloud variable connection is unlikely to work."),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(e){throw console.error(e),new Error("Cloud host ".concat(this.currentCloudHost," is invalid: ").concat(e))}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(e){console.error("WebSocket error",e)}onmessage(e){for(const t of e.data.split("\n"))if(t){const e=JSON.parse(t);"set"===e.method&&this.manager.setVariable(this,e.name,e.value)}}onopen(){this.attemptedConnections=0,this.writeToServer({method:"handshake"}),this.sendBufferedMessages(),console.log("WebSocket connected")}onclose(e){if(e&&4002===e.code)return void console.log("Username is invalid; not reconnecting.");if(e&&4003===e.code)return void console.log("Cloud variable server is full; not reconnecting.");if(e&&4004===e.code)return void console.log("Project is blocked; not reconnecting.");const t=Math.random()*(Math.pow(2,Math.min(this.attemptedConnections+1,5))-1)*1e3;console.log("Connection lost; reconnecting in ".concat(Math.round(t),"ms")),this.reconnectTimeout=setTimeout(this.openConnection,t)}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 e of this.bufferedMessages)this.writeToServer(e);this.bufferedMessages.length=0}bufferedWriteToServer(e){this.bufferedMessages.push(e),this.scheduleBufferedSend()}writeToServer(e){e.project_id=this.projectId,e.user=this.manager.getUsername(),this.ws.send(JSON.stringify(e))}handleUpdateVariable(e,t){for(const n of this.bufferedMessages)if(n.name===e)return void(n.value=t);this.bufferedWriteToServer({method:"set",name:e,value:t})}},LocalStorageProvider:class{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"p4:cloudvariables";this.key=e,this.variables={},this.handleStorageEvent=this.handleStorageEvent.bind(this)}readFromLocalStorage(){let e;try{if(e=JSON.parse(localStorage.getItem(this.key)),!e||"object"!=typeof e)return}catch(e){return}this.variables=e;for(const e of Object.keys(this.variables))this.manager.setVariable(this,e,this.variables[e])}storeToLocalStorage(){try{localStorage.setItem(this.key,JSON.stringify(this.variables))}catch(e){}}handleStorageEvent(e){e.key===this.key&&e.storageArea===localStorage&&this.readFromLocalStorage()}enable(){this.readFromLocalStorage(),window.addEventListener("storage",this.handleStorageEvent)}handleUpdateVariable(e,t){this.variables[e]=t,this.storeToLocalStorage()}}},w=n(93),S=n.n(w),k=n(53),O={insert:e=>{var t=document.head||document.body||document.documentElement;t.insertBefore(e,t.firstChild)},singleton:!1},I=(S()(k.a,O),k.a.locals||{});const N=e=>new Promise(((t,n)=>{const r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(new Error("Cannot read as text: ".concat(r.error))),r.readAsText(e)}));var R=class{constructor(e,t){this.el=e,this.callback=t,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(e){e.dataTransfer.types.includes("Files")&&(e.preventDefault(),e.dataTransfer.dropEffect="copy",this.el.classList.add(I.dropping))}ondragleave(e){e.preventDefault(),this.el.classList.remove(I.dropping)}ondrop(e){e.preventDefault(),this.el.classList.remove(I.dropping),e.dataTransfer.types.includes("Files")&&e.dataTransfer.files.length>0&&Promise.all(Array.from(e.dataTransfer.files).map(N)).then((e=>{this.callback(e)}))}};var x=class{constructor(e,t){this.parent=e,this.text=t,this.root=document.createElement("div"),this.root.className=I.questionRoot,this.inner=document.createElement("div"),this.inner.className=I.questionInner,t&&(this.textElement=document.createElement("div"),this.textElement.textContent=t,this.textElement.className=I.questionText),this.inputContainer=document.createElement("div"),this.inputContainer.className=I.questionInputOuter,this.input=document.createElement("input"),this.input.className=I.questionInput,this.input.addEventListener("keypress",this.onkeypress.bind(this)),this.dropper=new R(this.input,this.dropperCallback.bind(this)),this.submitButton=document.createElement("button"),this.submitButton.className=I.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((e=>{this.callback=e}))}answer(){return this.answerCallback}submit(){this.callback(this.input.value),this.destroy()}onkeypress(e){"Enter"===e.key&&this.submit()}dropperCallback(e){const t=e.join("").replace(/\r?\n/g," ");this.input.value=t}onsubmitpressclick(){this.submit()}destroy(){this.root.remove(),this.parent.question=null}};var M=class{constructor(e){this.parent=e,this.root=document.createElement("div"),this.root.className=I.contextMenu,this._onmousedown=this._onmousedown.bind(this),this._onresize=this._onresize.bind(this),this._onblur=this._onblur.bind(this)}_onmousedown(e){this.root.contains(e.target)||this.destroy()}_onresize(){this.destroy()}_onblur(){this.destroy()}add(e){const t=document.createElement("button");t.className=I.contextMenuItem,t.textContent=e.text,t.addEventListener("click",(()=>{this.destroy(),e.callback()})),t.addEventListener("contextmenu",(e=>{e.preventDefault()})),this.root.appendChild(t)}show(e){document.addEventListener("mousedown",this._onmousedown),window.addEventListener("resize",this._onresize),window.addEventListener("blur",this._onblur),this.parent._addLayer(this.root);const t=this.parent.layersRect,n=this.root.getBoundingClientRect();let r=e.clientX-t.left,i=e.clientY-t.top;r+n.width>t.width&&(r-=n.width),i+n.height>t.height&&(i-=n.height),this.root.style.transform="translate(".concat(r,"px, ").concat(i,"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 C=(e,t)=>{if("undefined"!=typeof ExternalDownloadHelper)return void ExternalDownloadHelper.download(e,t);const n=document.createElement("a");if(document.body.appendChild(n),navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(t,e);else if("download"in HTMLAnchorElement.prototype){const r=window.URL.createObjectURL(t);n.href=r,n.download=e,n.type=t.type,n.click(),window.setTimeout((()=>{document.body.removeChild(n),window.URL.revokeObjectURL(r)}),1e3)}else{let e=window.open("","_blank");const n=new FileReader;n.onloadend=function(){e.location.href=n.result,e=null},n.readAsDataURL(t)}};const P=e=>"object"==typeof e&&null!==e?JSON.stringify(e,(()=>{const e=new WeakSet;return(t,n)=>{if("object"==typeof n&&null!==n){if(e.has(n))return Array.isArray(n)?"[...]":"{...}";e.add(n)}return n}})()):Object.is(e,-0)?"-0":"".concat(e);class D{constructor(e,t){this.parent=e,this.id=t.get("id"),this.spriteName=t.get("spriteName"),this.targetId=t.get("targetId"),this.opcode=t.get("opcode"),this.params=t.get("params"),this.root=document.createElement("div"),this.root.className=I.monitorRoot,this.root.dataset.id=this.id,this.root.dataset.opcode=this.opcode,this.parent._monitorOverlay.appendChild(this.root)}getLabel(){let e;if("data_variable"===this.opcode)e=this.params.VARIABLE;else if("data_listcontents"===this.opcode)e=this.params.LIST;else if("motion_xposition"===this.opcode)e=this.parent.getMessage("var-x");else if("motion_yposition"===this.opcode)e=this.parent.getMessage("var-y");else if("motion_direction"===this.opcode)e=this.parent.getMessage("var-direction");else if("sensing_username"===this.opcode)e=this.parent.getMessage("var-username");else if("looks_costumenumbername"===this.opcode)e="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-costume-number"):this.parent.getMessage("var-costume-name");else if("looks_backdropnumbername"===this.opcode)e="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-backdrop-number"):this.parent.getMessage("var-backdrop-name");else if("looks_size"===this.opcode)e=this.parent.getMessage("var-size");else if("sensing_answer"===this.opcode)e=this.parent.getMessage("var-answer");else if("sensing_mousedown"===this.opcode)e=this.parent.getMessage("var-mousedown");else if("sensing_mousex"===this.opcode)e=this.parent.getMessage("var-mousex");else if("sensing_mousey"===this.opcode)e=this.parent.getMessage("var-mousey");else if("sensing_loudness"===this.opcode)e=this.parent.getMessage("var-loudness");else if("sensing_timer"===this.opcode)e=this.parent.getMessage("var-timer");else if("sensing_dayssince2000"===this.opcode)e=this.parent.getMessage("var-dayssince2000");else if("sound_volume"===this.opcode)e=this.parent.getMessage("var-volume");else if("sensing_current"===this.opcode){const t=this.params.CURRENTMENU.toLowerCase();"year"===t?e=this.parent.getMessage("var-year"):"month"===t?e=this.parent.getMessage("var-month"):"date"===t?e=this.parent.getMessage("var-date"):"dayofweek"===t?e=this.parent.getMessage("var-day-of-week"):"hour"===t?e=this.parent.getMessage("var-hour"):"minute"===t?e=this.parent.getMessage("var-minute"):"second"===t&&(e=this.parent.getMessage("var-second"))}else{const t=this.parent.vm.runtime.getLabelForOpcode(this.opcode);e=t?t.label:this.opcode}return this.spriteName?"".concat(this.spriteName,": ").concat(e):e}getTarget(){return this.targetId?this.parent.vm.runtime.getTargetById(this.targetId):this.parent.vm.runtime.getTargetForStage()}getVmVariable(){return this.getTarget().variables[this.id]}update(e){this.x=e.get("x"),this.y=e.get("y"),this.visible=e.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 L extends D{constructor(e,t){super(e,t),this.mode=t.get("mode"),"large"===this.mode?(this.valueElement=document.createElement("div"),this.valueElement.className=I.monitorLargeValue+" "+I.monitorValueColor,this.root.appendChild(this.valueElement)):(this.inner=document.createElement("div"),this.inner.className=I.monitorInner,this.valueRow=document.createElement("div"),this.valueRow.className=I.monitorRow,this.label=document.createElement("div"),this.label.className=I.monitorLabel,this.label.textContent=this.getLabel(),this.valueElement=document.createElement("div"),this.valueElement.className=I.monitorValue+" "+I.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=I.monitorRow,this.slider=document.createElement("input"),this.slider.className=I.monitorSlider,this.slider.type="range",this.slider.min=t.get("sliderMin"),this.slider.max=t.get("sliderMax"),this.slider.step=t.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(e){const t=this.getVmVariable();if(t.value=e,t.isCloud){this.parent.vm.runtime.ioDevices.cloud.requestUpdateVariable(t.name,t.value)}this._value=e,this.valueElement.textContent=e}onsliderchange(e){this.setVariableValue(+e.target.value)}update(e){if(super.update(e),!this.visible)return;let t=e.get("value");"number"!=typeof t||Object.is(t,-0)||(t=Number(t.toFixed(6))),t=P(t),this._value!==t&&(this._value=t,this.valueElement.textContent=t,this.slider&&(this.slider.value=t))}}class B{constructor(e){this.monitor=e,this.index=-1,this.value="",this.isFocused=!1,this.root=document.createElement("label"),this.root.className=I.monitorRowRoot,this.indexEl=document.createElement("div"),this.indexEl.className=I.monitorRowIndex,this.valueOuter=document.createElement("div"),this.valueOuter.className=I.monitorRowValueOuter,this.editable=this.monitor.editable,this.editable?(this.valueInner=document.createElement("input"),this.valueInner.className=I.monitorRowValueInner,this.valueInner.addEventListener("focusin",this._onfocusin.bind(this)),this.valueInner.addEventListener("focusout",this._onfocusout.bind(this)),this.valueInner.addEventListener("keypress",this._onkeypress.bind(this)),this.valueInner.addEventListener("keydown",this._onkeydown.bind(this)),this.valueInner.addEventListener("input",this._oninput.bind(this)),this.valueOuter.appendChild(this.valueInner),this.deleteButton=document.createElement("button"),this.deleteButton.className=I.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=I.monitorRowValueInner,this.valueOuter.appendChild(this.valueInner)),this.valueInner.addEventListener("contextmenu",this._oncontextmenu.bind(this)),this.root.appendChild(this.indexEl),this.root.appendChild(this.valueOuter)}isLocked(){return this.isFocused}_onfocusin(){this.isFocused||(this.isFocused=!0,this.valueInner.select(),this.root.classList.add(I.monitorRowValueEditing),this.addNewValue=!1,this.deleteValue=!1,this.valueWasChanged=!1)}_onfocusout(){if(this.isFocused)if(this.value=this.valueInner.value,this.isFocused=!1,this.root.classList.remove(I.monitorRowValueEditing),this.deleteValue){const e=[...this.monitor.value];e.splice(this.index,1),this.monitor.setValue(e),this.monitor.tryToFocusRow(Math.min(e.length-1,this.index))}else if(this.valueWasChanged||this.addNewValue){const e=[...this.monitor.value];e[this.index]=this.value,this.addNewValue&&e.splice(this.index+1,0,""),this.monitor.setValue(e),this.addNewValue&&this.monitor.tryToFocusRow(this.index+1)}}_oninput(){this.valueWasChanged=!0}_onkeypress(e){"Enter"===e.key&&(this.addNewValue=!0,this.valueInner.blur())}_onkeydown(e){if("Escape"===e.key)this.valueInner.blur();else if("ArrowUp"===e.key||"ArrowDown"===e.key||"Tab"===e.key){e.preventDefault();let t=this.index;"ArrowUp"===e.key||"Tab"===e.key&&e.shiftKey?(t--,t<0&&(t=this.monitor.value.length-1)):(t++,t>=this.monitor.value.length&&(t=0)),this.monitor.tryToFocusRow(t)}}_onclickdelete(e){e.preventDefault(),this.deleteValue=!0,this.valueInner.blur()}_oncontextmenu(e){if(this.editable)e.stopPropagation();else{const t=getSelection();this.valueInner.contains(t.anchorNode)&&!t.isCollapsed&&e.stopPropagation()}}setIndex(e){this.index!==e&&(this.index=e,this.root.dataset.index=e,this.root.style.transform="translateY(".concat(24*e,"px)"),this.indexEl.textContent=e+1)}setValue(e){e=P(e),this.value===e||this.isFocused||(this.value=e,this.editable?this.valueInner.value=e:this.valueInner.textContent=e)}focus(){this.isFocused||this.valueInner.focus()}unfocus(){this.isFocused&&this.valueInner.blur()}}class U extends D{constructor(e,t){super(e,t),this.editable=e.editableLists,this.rows=new Map,this.cachedRows=[],this.scrollTop=0,this.oldLength=-1,this.label=document.createElement("div"),this.label.className=I.monitorListLabel,this.label.textContent=this.getLabel(),this.footer=document.createElement("div"),this.footer.className=I.monitorListFooter,this.footerText=document.createElement("div"),this.footerText.className=I.monitorListFooterText,this.rowsOuter=document.createElement("div"),this.rowsOuter.className=I.monitorRowsOuter,this.rowsInner=document.createElement("div"),this.rowsInner.className=I.monitorRowsInner,this.rowsInner.addEventListener("scroll",this._onscroll.bind(this),{passive:!0}),this.endPoint=document.createElement("div"),this.endPoint.className=I.monitorRowsEndpoint,this.emptyLabel=document.createElement("div"),this.emptyLabel.textContent=e.getMessage("list-empty"),this.emptyLabel.className=I.monitorEmpty,this.editable&&(this.addButton=document.createElement("button"),this.addButton.className=I.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 R(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(e){this.setValue([...this.value,""]),this.tryToFocusRow(this.value.length-1)}unfocusAllRows(){for(const e of this.rows.values())e.unfocus()}tryToFocusRow(e){if(e>=0&&e<this.value.length){this.unfocusAllRows();let t=this.rows.get(e);t||(t=this.createRow(e)),t.focus()}}_onscroll(e){this.scrollTop=e.target.scrollTop,this.updateValue(this.value)}_oncontextmenu(e){e.preventDefault();const t=new M(this.parent);t.add({text:this.parent.getMessage("list-import"),callback:this.handleImport}),t.add({text:this.parent.getMessage("list-export"),callback:this.handleExport}),t.show(e)}handleImport(){const e=document.createElement("input");e.type="file",e.accept=".txt,.csv,.tsv",e.style.display="none",document.body.appendChild(e),e.addEventListener("change",(e=>{const t=e.target.files;if(0===t.length)return;const n=t[0];N(n).then((e=>this.import(e)))})),e.click()}import(e){const t=e.split(/\r?\n/);this.setValue(t)}handleExport(){const e=this.getValue().join("\n"),t=new Blob([e],{type:"text/plain"});C("".concat(this.getLabel(),".txt"),t)}dropperCallback(e){this.import(e.join("\n"))}getValue(){return this.getVmVariable().value}setValue(e){this.getVmVariable().value=e,this.updateValue(e)}update(e){super.update(e),this.visible&&(this.width=e.get("width")||100,this.height=e.get("height")||200,this.root.style.width="".concat(this.width,"px"),this.root.style.height="".concat(this.height,"px"),this.updateValue(e.get("value")))}createRow(e){const t=this.cachedRows.pop()||new B(this);t.setIndex(e),t.setValue(this.value[e]),this.rows.set(e,t);let n=!1;for(const r of this.rowsInner.children){const i=r.dataset.index;if(!i)continue;if(+i>e){this.rowsInner.insertBefore(t.root,r),n=!0;break}}return n||this.rowsInner.appendChild(t.root),t}updateValue(e){this.value=e,e.length!==this.oldLength&&(this.oldLength=e.length,this.footerText.textContent=this.parent.getMessage("list-length").replace("{n}",e.length),this.endPoint.style.transform="translateY(".concat(24*e.length,"px)"),this.emptyLabel.style.display=e.length?"none":"");let t=Math.floor(this.scrollTop/24)-5;t<0&&(t=0);let n=Math.ceil((this.scrollTop+this.height)/24)+3;n>e.length-1&&(n=e.length-1);for(const r of this.rows.keys())if(r<t||r>n){const t=this.rows.get(r);(!t.isLocked()||r>=e.length)&&(t.unfocus(),t.root.remove(),this.rows.delete(r),this.cachedRows.length<10&&this.cachedRows.push(t))}for(let r=t;r<=n;r++){const t=this.rows.get(r);t?t.setValue(e[r]):this.createRow(r)}}}var F=class{constructor(){this.hasItem=!1,this.root=document.createElement("div"),this.root.className=I.controlsBar,this.start=document.createElement("div"),this.end=document.createElement("div"),this.root.appendChild(this.start),this.root.appendChild(this.end)}addToStart(e){this.hasItem=!0,this.start.appendChild(e)}addToEnd(e){this.hasItem=!0,this.end.appendChild(e)}computeHeight(){return this.hasItem?this.root.getBoundingClientRect().height:0}};const j=e=>"number"==typeof e||"string"==typeof e||"boolean"==typeof e;var z=n(97);const G=e=>e.touches&&e.touches[0]?{x:e.touches[0].clientX,y:e.touches[0].clientY}:e.changedTouches&&e.changedTouches[0]?{x:e.changedTouches[0].clientX,y:e.changedTouches[0].clientY}:{x:e.clientX,y:e.clientY},V=e=>"function"==typeof e?e:()=>e;class _ extends b{constructor(){super(),this.width=480,this.height=360,this.resizeMode="preserve-ratio",this.editableLists=!1,this.shouldConnectPeripherals=!0,this.usePackagedRuntime=!1,this.messages=z,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=I.root,this._layers=document.createElement("div"),this._layers.className=I.layers,this._root.appendChild(this._layers),this._canvas=document.createElement("canvas"),this._canvas.className=I.canvas,this._addLayer(this._canvas),this._overlays=document.createElement("div"),this._overlays.className=I.scaledOverlaysInner,this._overlaysOuter=document.createElement("div"),this._overlaysOuter.className=I.scaledOverlaysOuter,this._overlaysOuter.appendChild(this._overlays),this._addLayer(this._overlaysOuter),this._monitorOverlay=document.createElement("div"),this._monitorOverlay.className=I.monitorOverlay,this._overlays.appendChild(this._monitorOverlay),this._topControls=new F,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(e){this._layers.appendChild(e)}_scratchCoordinates(e,t){return{x:this.width/this.layersRect.width*(e-this.layersRect.width/2),y:-this.height/this.layersRect.height*(t-this.layersRect.height/2)}}_onmousemove(e){const{x:t,y:n}=G(e),r={x:t-this.layersRect.left,y:n-this.layersRect.top,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height};if(this._mousedownPosition&&!this._draggingId){Math.sqrt(Math.pow(r.x-this._mousedownPosition.x,2)+Math.pow(r.y-this._mousedownPosition.y,2))>3&&(this._startDragging(r.x,r.y),this._cancelDragTimeout())}else if(this._draggingId){const e=this._scratchCoordinates(r.x,r.y);this.vm.postSpriteInfo({x:e.x-this._draggingStartMousePosition.x+this._draggingStartSpritePosition.x,y:e.y-this._draggingStartMousePosition.y+this._draggingStartSpritePosition.y,force:!0})}this.vm.postIOData("mouse",r)}_startDragging(e,t){if(this._draggingId)return;const n=this.renderer.pick(e,t);if(-1===n||!1===n)return;const r=this.vm.getTargetIdForDrawableId(n);if(null===r)return;const i=this.vm.runtime.getTargetById(r);i.draggable&&(i.goToFront(),this._draggingId=r,this._draggingStartMousePosition=this._scratchCoordinates(e,t),this._draggingStartSpritePosition={x:i.x,y:i.y},this.vm.startDrag(r))}_cancelDragTimeout(){clearTimeout(this._dragTimeout),this._dragTimeout=null}_onmousedown(e){const{x:t,y:n}=G(e),r={x:t-this.layersRect.left,y:n-this.layersRect.top,button:e.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!0},i="undefined"!=typeof TouchEvent&&e instanceof TouchEvent;(0===e.button||i)&&(this._dragTimeout=setTimeout(this._startDragging.bind(this,r.x,r.y),400)),i&&(e.preventDefault(),document.activeElement&&document.activeElement.blur&&document.activeElement.blur()),this._mousedownPosition={x:r.x,y:r.y},this.vm.postIOData("mouse",r)}_onmouseup(e){this._cancelDragTimeout();const{x:t,y:n}=G(e),r={x:t-this.layersRect.left,y:n-this.layersRect.top,button:e.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!1,wasDragged:null!==this._draggingId};this._mousedownPosition=null,this.vm.postIOData("mouse",r),this._draggingId&&(this.vm.stopDrag(this._draggingId),this._draggingStartMousePosition=null,this._draggingStartSpritePosition=null,this._draggingId=null)}_ontouchstart(e){this._onmousedown(e)}_ontouchmove(e){this._onmousemove(e)}_ontouchend(e){this._onmouseup(e)}_oncontextmenu(e){e.preventDefault()}_onwheel(e){const t={deltaX:e.deltaX,deltaY:e.deltaY};this.vm.postIOData("mouseWheel",t)}_onkeydown(e){if(e.target!==document&&e.target!==document.body)return;const t={key:e.key,keyCode:e.keyCode,isDown:!0};this.vm.postIOData("keyboard",t),(32===e.keyCode||e.keyCode>=37&&e.keyCode<=40||8===e.keyCode||222===e.keyCode||191===e.keyCode)&&e.preventDefault()}_onkeyup(e){const t={key:e.key,keyCode:e.keyCode,isDown:!1};this.vm.postIOData("keyboard",t),e.target!==document&&e.target!==document.body&&e.preventDefault()}_onresize(){this.relayout()}relayout(){const e=this._root.getBoundingClientRect(),t=Math.max(1,e.width),n=Math.max(1,e.height),r=this._offsetFromTop+this._topControls.computeHeight(),i=this._offsetFromBottom,s=this._offsetFromLeft,o=this._offsetFromRight,a=Math.max(1,t-s-o),c=Math.max(1,n-r-i);"dynamic-resize"===this.resizeMode&&(this.vm.setStageSize?(this.width=a,this.height=c,this.vm.setStageSize(this.width,this.height)):console.warn("dynamic-resize not supported: vm does not implement setStageSize"));let l=a,u=c;"stretch"!==this.resizeMode&&(l=u/this.height*this.width,l>a&&(u=a/this.width*this.height,l=a));const h=window.devicePixelRatio||1,d=e=>Math.round(e*h)/h;l=d(l),u=d(u);const p=n-u,f=t-l,m=d((f-s-o)/2+s-f/2),g=d((p-r-i)/2+r-p/2);this._layers.style.transform="translate(".concat(m,"px, ").concat(g,"px)"),this._layers.style.width="".concat(l,"px"),this._layers.style.height="".concat(u,"px"),this._overlays.style.transform="scale(".concat(l/this.width,", ").concat(u/this.height,")"),this.renderer.resize(l,u),this.layersRect=this._layers.getBoundingClientRect()}appendTo(e){e.appendChild(this._root),this.relayout()}setup(){this.vm=new a.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",((e,t)=>{this.width===e&&this.height===t||(this.width=e,this.height=t,this.relayout())})),this.cloudManager=new A.CloudManager(this),this.renderer=new l.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 g,this.vm.attachStorage(this.storage),"undefined"!=typeof AudioContext||"undefined"!=typeof webkitAudioContext?(this.audioEngine=new p.a,this.vm.attachAudioEngine(this.audioEngine)):console.warn("AudioContext not supported. Sound will not work."),this.bitmapAdapter=new f.BitmapAdapter,this.vm.attachV2BitmapAdapter(this.bitmapAdapter),this.videoProvider=new v,this.vm.setVideoProvider(this.videoProvider)}async _connectPeripherals(){const e=e=>new Promise((t=>{const n=t=>{const n=Object.keys(t).map((e=>t[e]));if(n.length>0){const t=n[0];console.log("Connecting to peripheral",t),this.vm.connectPeripheral(e,t.peripheralId)}else console.error("No peripherals found for",e);i()},r=()=>{console.error("Peripheral scan timed out for",e),i()},i=()=>{this.vm.removeListener("PERIPHERAL_LIST_UPDATE",n),this.vm.removeListener("PERIPHERAL_SCAN_TIMEOUT",r),t()};this.vm.on("PERIPHERAL_LIST_UPDATE",n),this.vm.on("PERIPHERAL_SCAN_TIMEOUT",r),this.vm.scanForPeripheral(e)}));for(const t of Object.keys(this.vm.runtime.peripheralExtensions))await e(t)}_onmonitorsupdate(e){for(const t of e.valueSeq()){const e=t.get("id");if(!this._monitors.has(e)){if(!t.get("visible"))continue;"list"===t.get("mode")?this._monitors.set(e,new U(this,t)):this._monitors.set(e,new L(this,t))}this._monitors.get(e).update(t)}}ask(e){return this._question=new x(this,e),this._question.answer()}_onquestion(e){this._question&&this._question.destroy(),null!==e&&this.ask(e).then((e=>{this.vm.runtime.emit("ANSWER",e)}))}loadProject(e){return this.vm.loadProject(e).then((()=>{this.vm.setCloudProvider(this.cloudManager),this.cloudManager.projectReady(),this.renderer.draw(),setTimeout((()=>{this.renderer.draw()})),this.shouldConnectPeripherals&&this._connectPeripherals()}))}setUsername(e){this._username=e,this.vm.postIOData("userData",{username:e})}addCloudProvider(e){this.cloudManager.addProvider(e)}addCloudProviderOverride(e,t){this.cloudManager.addProviderOverride(e,t)}addControlButton(e){let{element:t,where:n}=e;if("top-left"===n)this._topControls.addToStart(t);else{if("top-right"!==n)throw new Error("Unknown 'where': ".concat(n));this._topControls.addToEnd(t)}this.relayout()}getMessage(e){return this.messages[e]||e}setAccentColor(e){this._root.style.setProperty("--sc-accent-color",e),this._root.style.setProperty("--sc-accent-color-transparent","".concat(e,"59"))}start(){this.vm.start(),this.vm.greenFlag()}greenFlag(){this.start()}stopAll(){this.vm.stopAll()}_lookupVariable(e,t){const n=this.vm.runtime.getTargetForStage().lookupVariableByNameAndType(e,t);if(!n)throw new Error("Global ".concat(t||"variable"," does not exist: ").concat(e));return n}setExtensionSecurityManager(e){const t=this.vm.extensionManager.securityManager;if(t)for(const[n,r]of Object.entries(e))t[n]=V(r);else console.warn("setExtensionSecurityManager not supported: there is no security manager")}getVariable(e){return this._lookupVariable(e,"").value}setVariable(e,t){if(!j(t))throw new Error("Invalid variable value");this._lookupVariable(e,"").value=t}getList(e){return this._lookupVariable(e,"list").value}setList(e,t){if(!(e=>{if(!Array.isArray(e))return!1;for(let t=0;t<e.length;t++)if(!j(e[t]))return!1;return!0})(t))throw new Error("Invalid list value");this._lookupVariable(e,"list").value=t}}if(window.Scaffolding)throw new Error("Scaffolding already exists on this page");window.Scaffolding=r},function(e,t,n){"use strict";var r;n.r(t),n.d(t,"v1",(function(){return m})),n.d(t,"v3",(function(){return k})),n.d(t,"v4",(function(){return O})),n.d(t,"v5",(function(){return R})),n.d(t,"NIL",(function(){return x})),n.d(t,"version",(function(){return M})),n.d(t,"validate",(function(){return a})),n.d(t,"stringify",(function(){return d})),n.d(t,"parse",(function(){return g}));var i=new Uint8Array(16);function s(){if(!r&&!(r="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return r(i)}var o=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var a=function(e){return"string"==typeof e&&o.test(e)},c=[],l=0;l<256;++l)c.push((l+256).toString(16).substr(1));var u,h,d=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=(c[e[t+0]]+c[e[t+1]]+c[e[t+2]]+c[e[t+3]]+"-"+c[e[t+4]]+c[e[t+5]]+"-"+c[e[t+6]]+c[e[t+7]]+"-"+c[e[t+8]]+c[e[t+9]]+"-"+c[e[t+10]]+c[e[t+11]]+c[e[t+12]]+c[e[t+13]]+c[e[t+14]]+c[e[t+15]]).toLowerCase();if(!a(n))throw TypeError("Stringified UUID is invalid");return n},p=0,f=0;var m=function(e,t,n){var r=t&&n||0,i=t||new Array(16),o=(e=e||{}).node||u,a=void 0!==e.clockseq?e.clockseq:h;if(null==o||null==a){var c=e.random||(e.rng||s)();null==o&&(o=u=[1|c[0],c[1],c[2],c[3],c[4],c[5]]),null==a&&(a=h=16383&(c[6]<<8|c[7]))}var l=void 0!==e.msecs?e.msecs:Date.now(),m=void 0!==e.nsecs?e.nsecs:f+1,g=l-p+(m-f)/1e4;if(g<0&&void 0===e.clockseq&&(a=a+1&16383),(g<0||l>p)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");p=l,f=m,h=a;var b=(1e4*(268435455&(l+=122192928e5))+m)%4294967296;i[r++]=b>>>24&255,i[r++]=b>>>16&255,i[r++]=b>>>8&255,i[r++]=255&b;var y=l/4294967296*1e4&268435455;i[r++]=y>>>8&255,i[r++]=255&y,i[r++]=y>>>24&15|16,i[r++]=y>>>16&255,i[r++]=a>>>8|128,i[r++]=255&a;for(var E=0;E<6;++E)i[r+E]=o[E];return t||d(i)};var g=function(e){if(!a(e))throw TypeError("Invalid UUID");var t,n=new Uint8Array(16);return n[0]=(t=parseInt(e.slice(0,8),16))>>>24,n[1]=t>>>16&255,n[2]=t>>>8&255,n[3]=255&t,n[4]=(t=parseInt(e.slice(9,13),16))>>>8,n[5]=255&t,n[6]=(t=parseInt(e.slice(14,18),16))>>>8,n[7]=255&t,n[8]=(t=parseInt(e.slice(19,23),16))>>>8,n[9]=255&t,n[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,n[11]=t/4294967296&255,n[12]=t>>>24&255,n[13]=t>>>16&255,n[14]=t>>>8&255,n[15]=255&t,n};var b=function(e,t,n){function r(e,r,i,s){if("string"==typeof e&&(e=function(e){e=unescape(encodeURIComponent(e));for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n));return t}(e)),"string"==typeof r&&(r=g(r)),16!==r.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var o=new Uint8Array(16+e.length);if(o.set(r),o.set(e,r.length),(o=n(o))[6]=15&o[6]|t,o[8]=63&o[8]|128,i){s=s||0;for(var a=0;a<16;++a)i[s+a]=o[a];return i}return d(o)}try{r.name=e}catch(e){}return r.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8",r.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8",r};function y(e){return 14+(e+64>>>9<<4)+1}function E(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function T(e,t,n,r,i,s){return E((o=E(E(t,e),E(r,s)))<<(a=i)|o>>>32-a,n);var o,a}function v(e,t,n,r,i,s,o){return T(t&n|~t&r,e,t,i,s,o)}function A(e,t,n,r,i,s,o){return T(t&r|n&~r,e,t,i,s,o)}function w(e,t,n,r,i,s,o){return T(t^n^r,e,t,i,s,o)}function S(e,t,n,r,i,s,o){return T(n^(t|~r),e,t,i,s,o)}var k=b("v3",48,(function(e){if("string"==typeof e){var t=unescape(encodeURIComponent(e));e=new Uint8Array(t.length);for(var n=0;n<t.length;++n)e[n]=t.charCodeAt(n)}return function(e){for(var t=[],n=32*e.length,r="0123456789abcdef",i=0;i<n;i+=8){var s=e[i>>5]>>>i%32&255,o=parseInt(r.charAt(s>>>4&15)+r.charAt(15&s),16);t.push(o)}return t}(function(e,t){e[t>>5]|=128<<t%32,e[y(t)-1]=t;for(var n=1732584193,r=-271733879,i=-1732584194,s=271733878,o=0;o<e.length;o+=16){var a=n,c=r,l=i,u=s;n=v(n,r,i,s,e[o],7,-680876936),s=v(s,n,r,i,e[o+1],12,-389564586),i=v(i,s,n,r,e[o+2],17,606105819),r=v(r,i,s,n,e[o+3],22,-1044525330),n=v(n,r,i,s,e[o+4],7,-176418897),s=v(s,n,r,i,e[o+5],12,1200080426),i=v(i,s,n,r,e[o+6],17,-1473231341),r=v(r,i,s,n,e[o+7],22,-45705983),n=v(n,r,i,s,e[o+8],7,1770035416),s=v(s,n,r,i,e[o+9],12,-1958414417),i=v(i,s,n,r,e[o+10],17,-42063),r=v(r,i,s,n,e[o+11],22,-1990404162),n=v(n,r,i,s,e[o+12],7,1804603682),s=v(s,n,r,i,e[o+13],12,-40341101),i=v(i,s,n,r,e[o+14],17,-1502002290),n=A(n,r=v(r,i,s,n,e[o+15],22,1236535329),i,s,e[o+1],5,-165796510),s=A(s,n,r,i,e[o+6],9,-1069501632),i=A(i,s,n,r,e[o+11],14,643717713),r=A(r,i,s,n,e[o],20,-373897302),n=A(n,r,i,s,e[o+5],5,-701558691),s=A(s,n,r,i,e[o+10],9,38016083),i=A(i,s,n,r,e[o+15],14,-660478335),r=A(r,i,s,n,e[o+4],20,-405537848),n=A(n,r,i,s,e[o+9],5,568446438),s=A(s,n,r,i,e[o+14],9,-1019803690),i=A(i,s,n,r,e[o+3],14,-187363961),r=A(r,i,s,n,e[o+8],20,1163531501),n=A(n,r,i,s,e[o+13],5,-1444681467),s=A(s,n,r,i,e[o+2],9,-51403784),i=A(i,s,n,r,e[o+7],14,1735328473),n=w(n,r=A(r,i,s,n,e[o+12],20,-1926607734),i,s,e[o+5],4,-378558),s=w(s,n,r,i,e[o+8],11,-2022574463),i=w(i,s,n,r,e[o+11],16,1839030562),r=w(r,i,s,n,e[o+14],23,-35309556),n=w(n,r,i,s,e[o+1],4,-1530992060),s=w(s,n,r,i,e[o+4],11,1272893353),i=w(i,s,n,r,e[o+7],16,-155497632),r=w(r,i,s,n,e[o+10],23,-1094730640),n=w(n,r,i,s,e[o+13],4,681279174),s=w(s,n,r,i,e[o],11,-358537222),i=w(i,s,n,r,e[o+3],16,-722521979),r=w(r,i,s,n,e[o+6],23,76029189),n=w(n,r,i,s,e[o+9],4,-640364487),s=w(s,n,r,i,e[o+12],11,-421815835),i=w(i,s,n,r,e[o+15],16,530742520),n=S(n,r=w(r,i,s,n,e[o+2],23,-995338651),i,s,e[o],6,-198630844),s=S(s,n,r,i,e[o+7],10,1126891415),i=S(i,s,n,r,e[o+14],15,-1416354905),r=S(r,i,s,n,e[o+5],21,-57434055),n=S(n,r,i,s,e[o+12],6,1700485571),s=S(s,n,r,i,e[o+3],10,-1894986606),i=S(i,s,n,r,e[o+10],15,-1051523),r=S(r,i,s,n,e[o+1],21,-2054922799),n=S(n,r,i,s,e[o+8],6,1873313359),s=S(s,n,r,i,e[o+15],10,-30611744),i=S(i,s,n,r,e[o+6],15,-1560198380),r=S(r,i,s,n,e[o+13],21,1309151649),n=S(n,r,i,s,e[o+4],6,-145523070),s=S(s,n,r,i,e[o+11],10,-1120210379),i=S(i,s,n,r,e[o+2],15,718787259),r=S(r,i,s,n,e[o+9],21,-343485551),n=E(n,a),r=E(r,c),i=E(i,l),s=E(s,u)}return[n,r,i,s]}(function(e){if(0===e.length)return[];for(var t=8*e.length,n=new Uint32Array(y(t)),r=0;r<t;r+=8)n[r>>5]|=(255&e[r/8])<<r%32;return n}(e),8*e.length))}));var O=function(e,t,n){var r=(e=e||{}).random||(e.rng||s)();if(r[6]=15&r[6]|64,r[8]=63&r[8]|128,t){n=n||0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return d(r)};function I(e,t,n,r){switch(e){case 0:return t&n^~t&r;case 1:case 3:return t^n^r;case 2:return t&n^t&r^n&r}}function N(e,t){return e<<t|e>>>32-t}var R=b("v5",80,(function(e){var t=[1518500249,1859775393,2400959708,3395469782],n=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"==typeof e){var r=unescape(encodeURIComponent(e));e=[];for(var i=0;i<r.length;++i)e.push(r.charCodeAt(i))}else Array.isArray(e)||(e=Array.prototype.slice.call(e));e.push(128);for(var s=e.length/4+2,o=Math.ceil(s/16),a=new Array(o),c=0;c<o;++c){for(var l=new Uint32Array(16),u=0;u<16;++u)l[u]=e[64*c+4*u]<<24|e[64*c+4*u+1]<<16|e[64*c+4*u+2]<<8|e[64*c+4*u+3];a[c]=l}a[o-1][14]=8*(e.length-1)/Math.pow(2,32),a[o-1][14]=Math.floor(a[o-1][14]),a[o-1][15]=8*(e.length-1)&4294967295;for(var h=0;h<o;++h){for(var d=new Uint32Array(80),p=0;p<16;++p)d[p]=a[h][p];for(var f=16;f<80;++f)d[f]=N(d[f-3]^d[f-8]^d[f-14]^d[f-16],1);for(var m=n[0],g=n[1],b=n[2],y=n[3],E=n[4],T=0;T<80;++T){var v=Math.floor(T/20),A=N(m,5)+I(v,g,b,y)+E+t[v]+d[T]>>>0;E=y,y=b,b=N(g,30)>>>0,g=m,m=A}n[0]=n[0]+m>>>0,n[1]=n[1]+g>>>0,n[2]=n[2]+b>>>0,n[3]=n[3]+y>>>0,n[4]=n[4]+E>>>0}return[n[0]>>24&255,n[0]>>16&255,n[0]>>8&255,255&n[0],n[1]>>24&255,n[1]>>16&255,n[1]>>8&255,255&n[1],n[2]>>24&255,n[2]>>16&255,n[2]>>8&255,255&n[2],n[3]>>24&255,n[3]>>16&255,n[3]>>8&255,255&n[3],n[4]>>24&255,n[4]>>16&255,n[4]>>8&255,255&n[4]]})),x="00000000-0000-0000-0000-000000000000";var M=function(e){if(!a(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}}]);
// bf56fd0de481636955d36d50912975ace64f38c8107494ac52cf243b2780155a =^..^=
!function(e){var t={};function n(s){if(t[s])return t[s].exports;var i=t[s]={i:s,l:!1,exports:{}};return e[s].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,s){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:s})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(s,i,function(t){return e[t]}.bind(null,i));return s},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=305)}({100:function(module,__webpack_exports__,__webpack_require__){"use strict";const isPromise=e=>!!e&&"function"==typeof e.then,jsValueToScratchValue=e=>"boolean"==typeof e||"number"==typeof e||"string"==typeof e?e:""+e;class UnsafeCloudBehaviorsProvider{enable(){}setEvalValue(e){this.manager.setVariable(this,"☁ eval output",jsValueToScratchValue(e))}setEvalError(e){console.error("Error evaluating ☁ eval",e),this.manager.setVariable(this,"☁ eval error",jsValueToScratchValue(e))}evaluateAsync(js){try{const value=eval(js);isPromise(value)?value.then((e=>this.setEvalValue(e))).catch((e=>this.setEvalError(e))):this.setEvalValue(value)}catch(e){this.setEvalError(e)}}handleUpdateVariable(e,t){"☁ eval"===e&&this.evaluateAsync(t)}}__webpack_exports__.a=function(e){let{scaffolding:t}=e;const n=new UnsafeCloudBehaviorsProvider;t.addCloudProvider(n),t.addCloudProviderOverride("☁ eval",n),t.addCloudProviderOverride("☁ eval output",n),t.addCloudProviderOverride("☁ eval error",n)}},305:function(e,t,n){"use strict";n.r(t);var s=n(7);let i=window.console;const r=[{type:"key",high:"ArrowRight",low:"ArrowLeft",deadZone:.5},{type:"key",high:"ArrowDown",low:"ArrowUp",deadZone:.5}],o=[{type:"key",high:"d",low:"a",deadZone:.5},{type:"key",high:"s",low:"w",deadZone:.5}],a=[{type:"virtual_cursor",high:"+x",low:"-x",sensitivity:.6,deadZone:.2},{type:"virtual_cursor",high:"-y",low:"+y",sensitivity:.6,deadZone:.2}],d=e=>{if("object"!=typeof e||!e)return i.warn("invalid mapping",e),{type:"key",high:null,low:null};const t=Object.assign({},e);if("key"===t.type)void 0===t.deadZone&&(t.deadZone=.5),void 0===t.high&&(t.high=""),void 0===t.low&&(t.low="");else if("mousedown"===t.type)void 0===t.deadZone&&(t.deadZone=.5),void 0===t.button&&(t.button=0);else{if("virtual_cursor"!==t.type)return i.warn("unknown mapping type",t.type),{type:"key",high:null,low:null};void 0===t.high&&(t.high=""),void 0===t.low&&(t.low=""),void 0===t.sensitivity&&(t.sensitivity=10),void 0===t.deadZone&&(t.deadZone=.5)}return t},u=(e,t)=>{for(;e.length<t;)e.push({type:"key",high:null,low:null});return e.length=t,e},c=e=>u([],e),l=e=>({usesArrows:e.has("ArrowUp")||e.has("ArrowDown")||e.has("ArrowRight")||e.has("ArrowLeft"),usesWASD:e.has("w")&&e.has("s")||e.has("a")&&e.has("d")}),h=e=>"".concat(e.id," (").concat(e.index,")");class p{constructor(e,t){this.gamepad=e,this.gamepadLib=t,this.resetMappings()}resetMappings(){this.hints=this.gamepadLib.getHints(),this.buttonMappings=this.getDefaultButtonMappings().map(d),this.axesMappings=this.getDefaultAxisMappings().map(d)}clearMappings(){this.buttonMappings=c(this.gamepad.buttons.length),this.axesMappings=c(this.gamepad.axes.length)}getDefaultButtonMappings(){let e;if(this.hints.importedSettings)e=this.hints.importedSettings.buttons;else{const t=this.hints.usedKeys,n=new Set,{usesArrows:s,usesWASD:i}=l(t);i&&(n.add("w"),n.add("a"),n.add("s"),n.add("d"));const r=["p","q","r"],o=[" ","Enter","e","f","z","x","c",...Array.from(t).filter((e=>1===e.length&&!r.includes(e)))],a=e=>{for(const s of e)if(t.has(s)&&!n.has(s))return n.add(s),s;return null},d=()=>a(o),u=()=>a(r),c=()=>s||!i?"ArrowUp":"w",h=()=>s||!i?"ArrowDown":"s",p=()=>s||!i?"ArrowRight":"d",m=()=>s||!i?"ArrowLeft":"a",g=(()=>s&&t.has("ArrowUp")?"ArrowUp":i&&t.has("w")?"w":a(o))();let v=d(),f=d(),y=d();!g||v||f||y||(v=g,f=g,y=g),g&&v&&!f&&!y&&(f=g,y=v),e=[],e[0]={type:"key",high:g},e[1]={type:"key",high:v},e[2]={type:"key",high:f},e[3]={type:"key",high:y},e[4]={type:"mousedown"},e[5]={type:"mousedown"},e[6]={type:"mousedown"},e[7]={type:"mousedown"},e[9]={type:"key",high:u()},e[8]={type:"key",high:u()},e[10]={type:"key",high:null,low:null},e[11]={type:"key",high:null,low:null},e[12]={type:"key",high:c()},e[13]={type:"key",high:h()},e[14]={type:"key",high:m()},e[15]={type:"key",high:p()}}return u(e,this.gamepad.buttons.length)}getDefaultAxisMappings(){let e=[];if(this.hints.importedSettings)e=this.hints.importedSettings.axes;else if(4===this.gamepad.axes.length){const t=this.hints.usedKeys,{usesArrows:n,usesWASD:s}=l(t);s?(e.push(o[0]),e.push(o[1])):n?(e.push(r[0]),e.push(r[1])):(e.push(a[0]),e.push(a[1])),e.push(a[0]),e.push(a[1])}return u(e,this.gamepad.axes.length)}}class m extends s.b{constructor(){super(),this.gamepads=new Map,this.handleConnect=this.handleConnect.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.update=this.update.bind(this),this.animationFrame=null,this.currentTime=null,this.deltaTime=0,this.virtualCursor={x:0,y:0,maxX:1/0,minX:-1/0,maxY:1/0,minY:-1/0,modified:!1},this._editor=null,this.connectCallbacks=[],this.keysPressedThisFrame=new Set,this.oldKeysPressed=new Set,this.mouseButtonsPressedThisFrame=new Set,this.oldMouseDown=new Set,this.addEventHandlers()}addEventHandlers(){window.addEventListener("gamepadconnected",this.handleConnect),window.addEventListener("gamepaddisconnected",this.handleDisconnect)}removeEventHandlers(){window.removeEventListener("gamepadconnected",this.handleConnect),window.removeEventListener("gamepaddisconnected",this.handleDisconnect)}gamepadConnected(){return this.gamepads.size>0?Promise.resolve():new Promise((e=>{this.connectCallbacks.push(e)}))}getHints(){return Object.assign({usedKeys:new Set,importedSettings:null,generated:!1},this.getUserHints())}getUserHints(){return{}}resetControls(){for(const e of this.gamepads.values())e.resetMappings()}clearControls(){for(const e of this.gamepads.values())e.clearMappings()}handleConnect(e){for(const e of this.connectCallbacks)e();this.connectCallbacks=[];const t=e.gamepad,n=h(t);i.log("connected",t);const r=new p(t,this);this.gamepads.set(n,r),null===this.animationFrame&&(this.animationFrame=requestAnimationFrame(this.update)),this.dispatchEvent(new s.a("gamepadconnected",{detail:r}))}handleDisconnect(e){const t=e.gamepad,n=h(t);i.log("disconnected",t);const r=this.gamepads.get(n);this.gamepads.delete(n),this.dispatchEvent(new s.a("gamepaddisconnected",{detail:r})),0===this.gamepads.size&&(cancelAnimationFrame(this.animationFrame),this.animationFrame=null,this.currentTime=null)}dispatchKey(e,t){t?this.dispatchEvent(new s.a("keydown",{detail:e})):this.dispatchEvent(new s.a("keyup",{detail:e}))}dispatchMouse(e,t){t?this.dispatchEvent(new s.a("mousedown",{detail:e})):this.dispatchEvent(new s.a("mouseup",{detail:e}))}dispatchMouseMove(e,t){this.dispatchEvent(new s.a("mousemove",{detail:{x:e,y:t}}))}updateButton(e,t){if("key"===t.type)e>=t.deadZone?t.high&&this.keysPressedThisFrame.add(t.high):e<=-t.deadZone&&t.low&&this.keysPressedThisFrame.add(t.low);else if("mousedown"===t.type){Math.abs(e)>=t.deadZone&&this.mouseButtonsPressedThisFrame.add(t.button)}else if("virtual_cursor"===t.type){const n=t.deadZone;let s;if(e>=n&&(s=t.high),e<=-n&&(s=t.low),s){const i=(Math.abs(e)-n)/(1-n),r=i*i*t.sensitivity*this.deltaTime;"+x"===s?this.virtualCursor.x+=r:"-x"===s?this.virtualCursor.x-=r:"+y"===s?this.virtualCursor.y+=r:"-y"===s&&(this.virtualCursor.y-=r),this.virtualCursor.modified=!0}}}update(e){this.oldKeysPressed=this.keysPressedThisFrame,this.oldMouseButtonsPressed=this.mouseButtonsPressedThisFrame,this.keysPressedThisFrame=new Set,this.mouseButtonsPressedThisFrame=new Set,null===this.currentTime?this.deltaTime=0:this.deltaTime=e-this.currentTime,this.deltaTime=Math.max(Math.min(this.deltaTime,1e3),0),this.currentTime=e,this.animationFrame=requestAnimationFrame(this.update);const t=navigator.getGamepads();for(const e of t){if(null===e)continue;const t=h(e),n=this.gamepads.get(t);for(let t=0;t<e.buttons.length;t++){const s=e.buttons[t].value,i=n.buttonMappings[t];this.updateButton(s,i)}for(let t=0;t<e.axes.length;t++){const s=e.axes[t],i=n.axesMappings[t];this.updateButton(s,i)}}this._editor&&this._editor.update(t);for(const e of this.keysPressedThisFrame)this.oldKeysPressed.has(e)||this.dispatchKey(e,!0);for(const e of this.oldKeysPressed)this.keysPressedThisFrame.has(e)||this.dispatchKey(e,!1);for(const e of this.mouseButtonsPressedThisFrame)this.oldMouseButtonsPressed.has(e)||this.dispatchMouse(e,!0);for(const e of this.oldMouseButtonsPressed)this.mouseButtonsPressedThisFrame.has(e)||this.dispatchMouse(e,!1);this.virtualCursor.modified&&(this.virtualCursor.modified=!1,this.virtualCursor.x>this.virtualCursor.maxX&&(this.virtualCursor.x=this.virtualCursor.maxX),this.virtualCursor.x<this.virtualCursor.minX&&(this.virtualCursor.x=this.virtualCursor.minX),this.virtualCursor.y>this.virtualCursor.maxY&&(this.virtualCursor.y=this.virtualCursor.maxY),this.virtualCursor.y<this.virtualCursor.minY&&(this.virtualCursor.y=this.virtualCursor.minY),this.dispatchMouseMove(this.virtualCursor.x,this.virtualCursor.y))}}m.browserHasBrokenGamepadAPI=()=>!navigator.getGamepads||(!(!navigator.userAgent.includes("Firefox")||!navigator.userAgent.includes("Linux"))||!(!navigator.userAgent.includes("Firefox")||!navigator.userAgent.includes("Mac OS"))),m.setConsole=e=>i=e;var g=m;function v(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,s)}return n}function f(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?v(Object(n),!0).forEach((function(t){y(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function y(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var s=n.call(e,t||"default");if("object"!=typeof s)return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var w=async function(e,t){const n=e.vm;await new Promise((e=>{if(n.editingTarget)return e();n.runtime.once("PROJECT_LOADED",e)}));const s=()=>null!==n.runtime._steppingInterval,i=e=>{switch(e){case"right arrow":return"ArrowRight";case"up arrow":return"ArrowUp";case"left arrow":return"ArrowLeft";case"down arrow":return"ArrowDown";case"enter":return"Enter";case"space":return" "}return e.toLowerCase().charAt(0)},r=()=>{const e=[n.runtime.getTargetForStage(),...n.runtime.targets].filter((e=>e.isOriginal)).map((e=>e.blocks)),t=new Set;for(const n of e)for(const e of Object.values(n._blocks))if("event_whenkeypressed"===e.opcode||"sensing_keyoptions"===e.opcode){if("sensing_keyoptions"===e.opcode&&!e.parent)continue;const n=e.fields.KEY_OPTION.value;t.add(i(n))}return t},o=" // _gamepad_";g.setConsole(console);const a=new g,d=(()=>{const e=(()=>{const e=n.runtime.getTargetForStage().comments;for(const t of Object.values(e))if(t.text.includes(o))return t;return null})();if(!e)return null;const t=e.text.split("\n").find((e=>e.endsWith(o)));if(!t)return console.warn("Gamepad comment does not contain valid line"),null;const s=t.substr(0,t.length-13);let i;try{if(i=JSON.parse(s),!i||"object"!=typeof i||!Array.isArray(i.buttons)||!Array.isArray(i.axes))throw new Error("Invalid data")}catch(e){return console.warn("Gamepad comment has invalid JSON",e),null}return i})();a.getUserHints=()=>d?{importedSettings:d}:{usedKeys:r()};const u=n.runtime.renderer,c=u._xRight-u._xLeft,l=u._yTop-u._yBottom,h=u.canvas,p=document.createElement("img");let m;p.hidden=!0,p.className="sa-gamepad-cursor",p.src=(e=>{if("/active.png"===e)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAIAAABvrngfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAgSURBVBhXY/z//z8DKmCC0kgAKsQIBhA2FlXEmMXAAAC+2gYLeDM0CAAAAABJRU5ErkJggg==";if("/close.svg"===e)return"data:image/svg+xml;base64,PHN2ZyBkYXRhLW5hbWU9IkxheWVyIDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDcuNDggNy40OCI+PHBhdGggZD0iTTMuNzQgNi40OFYxTTEgMy43NGg1LjQ4IiBzdHlsZT0iZmlsbDpub25lO3N0cm9rZTojZmZmO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2Utd2lkdGg6MnB4Ii8+PC9zdmc+Cg==";if("/cursor.png"===e)return"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAYAAAAGCAIAAABvrngfAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsIAAA7CARUoSoAAAAAVSURBVBhXYyAF/AcDCJsJQpEKGBgAjmQF/WBrfi0AAAAASUVORK5CYII=";if("/dot.svg"===e)return"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI4IiBoZWlnaHQ9IjgiIHZpZXdCb3g9IjAgMCAyLjExNyAyLjExNyI+PGNpcmNsZSBjeD0iMS4wNTgiIGN5PSIxLjA1OCIgcj0iMS4wNTgiIGZpbGw9InJlZCIvPjwvc3ZnPgo=";throw new Error("Unknown asset: ".concat(e))})("/cursor.png");const v=e=>{p.hidden=!e,clearTimeout(m),e&&(document.body.classList.add("sa-gamepad-hide-cursor"),m=setTimeout(y,8e3))},y=()=>{v(!1)},w=e=>{v(!0),p.classList.toggle("sa-gamepad-cursor-down",e)};let A;if(document.addEventListener("mousemove",(()=>{v(!1),document.body.classList.remove("sa-gamepad-hide-cursor")})),window.ResizeObserver){let e=c,t=l;new ResizeObserver((n=>{for(const s of n)e=s.contentRect.width,t=s.contentRect.height})).observe(h),A=()=>[e,t]}else A=()=>{const e=h.getBoundingClientRect();return[e.width,e.height]};let b=0,C=0;const x=e=>{if(!s())return;const[t,i]=A();n.postIOData("mouse",f(f({},e),{},{canvasWidth:t,canvasHeight:i,x:(b+c/2)*(t/c),y:i/l*(l/2-C)}))},P=(e,t)=>{s()&&n.postIOData("keyboard",{key:e,isDown:t})};t||(a.virtualCursor.maxX=u._xRight,a.virtualCursor.minX=u._xLeft,a.virtualCursor.maxY=u._yTop,a.virtualCursor.minY=u._yBottom),a.addEventListener("keydown",(e=>P(e.detail,!0))),a.addEventListener("keyup",(e=>P(e.detail,!1))),a.addEventListener("mousedown",(e=>{w(!0),x({isDown:!0,button:e.detail})})),a.addEventListener("mouseup",(e=>{w(!1),x({isDown:!1,button:e.detail})})),a.addEventListener("mousemove",(s=>{const{x:i,y:r}=s.detail;if(t){const t=i-b,s=-(r-C);b=i,C=r;const o=4,a=e.layersRect.width/n.runtime.stageWidth,d=e.layersRect.height/n.runtime.stageHeight;n.pointerLockMove(t*o*a,s*o*d)}else b=i,C=r,((e,t)=>{v(!0);const n=c/2+e-3,s=l/2-t-3;p.style.transform="translate(".concat(n,"px, ").concat(s,"px)")})(b,C),x({})})),t||e._overlays.appendChild(p)},A=n(99),b=n.n(A);var C=e=>{let{scaffolding:t,options:n}=e;w(t,n.pointerlock),(e=>{const t=document.createElement("style");t.textContent=e,document.head.appendChild(t)})(b.a)};var x=e=>{let{scaffolding:t}=e;const n=t._canvas,s=t.vm,i=s.runtime.ioDevices.mouse;let r=!1;const o=(e,n)=>{const{movementX:r,movementY:o}=e,{width:a,height:d}=t.layersRect,u=i._clientX+r,c=i._clientY-o;if(i._clientX=u,i._scratchX=i.runtime.stageWidth*(u/a-.5),i._clientY=c,i._scratchY=i.runtime.stageWidth*(c/d-.5),"boolean"==typeof n){const t={button:e.button,isDown:n};s.postIOData("mouse",t)}};document.addEventListener("mousedown",(e=>{n.contains(e.target)&&(e.stopPropagation(),r?o(e,!0):n.requestPointerLock())}),!0),document.addEventListener("mouseup",(e=>{e.stopPropagation(),r?o(e,!1):n.contains(e.target)&&n.requestPointerLock()}),!0),document.addEventListener("mousemove",(e=>{e.stopPropagation(),r&&o(e)}),!0),t.addEventListener("PROJECT_RUN_START",(()=>{r||n.requestPointerLock()})),document.addEventListener("pointerlockchange",(()=>{r=document.pointerLockElement===n})),document.addEventListener("pointerlockerror",(e=>{console.error("Pointer lock error",e)})),s.pointerLockMove=(e,t)=>{o({movementX:e,movementY:t})};const a=s.runtime._step;s.runtime._step=function(){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];const r=a.call(this,...n),{width:o,height:d}=t.layersRect;return i._clientX=o/2,i._clientY=d/2,i._scratchX=0,i._scratchY=0,r}};const P=["http:","https:","data:","file:","mailto:"],k=e=>{try{const t=new URL(e,location.href);return P.includes(t.protocol)}catch(e){return!1}},_=e=>{window.open(e)},E=e=>{location.href=e};class S{enable(){this.manager.setVariable(this,"☁ url",location.href),document.addEventListener("paste",(e=>{const t=(e.clipboardData||window.clipboardData).getData("text");this.manager.setVariable(this,"☁ pasted",t)})),this.webSocketProvider=this.manager.providers.find((e=>"function"==typeof e.setProjectId)),this.initialProjectId=this.webSocketProvider?this.webSocketProvider.projectId:null}handleUpdateVariable(e,t){if("☁ redirect"===e)k(t)&&((e=>{try{return"data:"===new URL(e,location.href).protocol}catch(e){return!1}})(t)?_(t):E(t));else if("☁ open link"===e)k(t)&&((e=>{try{return"mailto:"===new URL(e,location.href).protocol}catch(e){return!1}})(t)?E(t):_(t));else if("☁ username"===e)this.manager.parent.setUsername(t);else if("☁ set clipboard"===e)navigator.clipboard.writeText(t);else if("☁ room id"===e&&this.webSocketProvider){t=""+t;const e=this.initialProjectId+(t?"-".concat(t):"");this.webSocketProvider.setProjectId(e)}}}var O=n(100);window.ScaffoldingAddons={run:(e,t)=>{const n={scaffolding:e,options:t};t.gamepad&&C(n),t.pointerlock&&x(n),t.specialCloudBehaviors&&function(e){let{scaffolding:t}=e;const n=new S;t.addCloudProvider(n),t.addCloudProviderOverride("☁ url",n),t.addCloudProviderOverride("☁ redirect",n),t.addCloudProviderOverride("☁ open link",n),t.addCloudProviderOverride("☁ username",n),t.addCloudProviderOverride("☁ set clipboard",n),t.addCloudProviderOverride("☁ pasted",n),t.addCloudProviderOverride("☁ room id",n)}(n),t.unsafeCloudBehaviors&&Object(O.a)(n),t.pause&&function(e){let{scaffolding:t}=e;const n=t.vm;let s=!1,i=new WeakMap,r=Promise.resolve();const o=e=>{if(s=e,s){r=r.then((()=>n.runtime.audioEngine.audioContext.suspend())),n.runtime.ioDevices.clock._paused||n.runtime.ioDevices.clock.pause();for(const e of n.runtime.threads)if(!e.updateMonitor&&!i.has(e)){const t={pauseTime:n.runtime.currentMSecs,status:e.status};i.set(e,t),e.status=1}n.runtime.emit("PROJECT_RUN_STOP"),n.runtime.emit("RUNTIME_PAUSED")}else{r=r.then((()=>n.runtime.audioEngine.audioContext.resume())),n.runtime.ioDevices.clock.resume();const e=Date.now();for(const t of n.runtime.threads){const n=i.get(t);if(n){const s=t.peekStackFrame();if(s&&s.executionContext&&s.executionContext.timer){const t=e-n.pauseTime;s.executionContext.timer.startTime+=t}if(t.compatibilityStackFrame&&t.compatibilityStackFrame.timer&&(t.compatibilityStackFrame.timer.startTime+=e-n.pauseTime),t.timer){const s=e-n.pauseTime;t.timer.startTime+=s}t.status=n.status}}i=new WeakMap,n.runtime.emit("RUNTIME_UNPAUSED")}},a=e=>{if(4===e.status)return;const t=i.get(e);t&&1!==e.status&&(t.status=e.status,e.status=1)},d=n.runtime.sequencer.stepThreads;n.runtime.sequencer.stepThreads=function(){if(s)for(const e of this.runtime.threads)a(e);return d.call(this)};const u=n.runtime.greenFlag;n.runtime.greenFlag=function(){return o(!1),u.call(this)};const c=n.runtime.startHats;n.runtime.startHats=function(){if(s)return[];for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.apply(this,t)};const l=n.runtime._getMonitorThreadCount;n.runtime._getMonitorThreadCount=function(e){let t=l.call(this,e);if(s)for(const n of e)i.has(n)&&t++;return t},n.setPaused=o,n.isPaused=()=>s}(n)}}},7:function(e,t,n){"use strict";n.d(t,"b",(function(){return s})),n.d(t,"a",(function(){return i}));class s{constructor(){this._events={}}addEventListener(e,t){this._events[e]||(this._events[e]=[]),this._events[e].push(t)}removeEventListener(e,t){const n=this._events[e];n&&(this._events[e]=n.filter((e=>e!==t)))}dispatchEvent(e){const t=this._events[e.type];if(t)for(const n of t)n(e)}}class i{constructor(e,t){this.type=e,this.detail=t?t.detail:{}}}},99:function(e,t){e.exports='.sa-gamepad-container {\n  margin-right: 0.2rem;\n}\n\n.sa-gamepad-spacer {\n  display: flex;\n  width: 100%;\n  justify-content: flex-end;\n}\n\n.sa-gamepad-popup-outer {\n  /* above fullscreen */\n  z-index: 99999;\n}\n.sa-gamepad-popup {\n  box-sizing: border-box;\n  width: 700px;\n  max-height: min(800px, 85vh);\n  height: 100%;\n  max-width: 85%;\n  margin: 50px auto;\n  display: flex;\n  flex-direction: column;\n}\n.sa-gamepad-popup-content {\n  background-color: white;\n  padding: 1.5rem 2.25rem;\n  height: 100%;\n  overflow-y: auto;\n}\n\n.sa-gamepad-popup [class*="modal_header-item-title"] {\n  margin: 0 -20rem 0 0;\n}\n\n.sa-gamepad-cursor {\n  position: absolute;\n  top: 0;\n  left: 0;\n  z-index: 9999;\n  user-select: none;\n  pointer-events: none;\n  will-change: transform;\n  image-rendering: optimizeSpeed;\n  image-rendering: crisp-edges;\n  image-rendering: pixelated;\n}\n.sa-gamepad-cursor-down {\n  filter: invert(100%);\n}\n\n.sa-gamepad-small .sa-gamepad-container[data-editor-mode="editor"] {\n  display: none !important;\n}\n\n.sa-gamepad-hide-cursor {\n  cursor: none;\n}\n\n.sa-gamepad-browser-support-warning {\n  font-weight: bold;\n  margin-bottom: 10px;\n}\n\n.sa-gamepad-store-settings {\n  display: none;\n}\n.sa-gamepad-store-settings > input {\n  margin-right: 4px;\n}\n.sa-gamepad-has-controller .sa-gamepad-store-settings {\n  display: block;\n}\n'}});
// bf56fd0de481636955d36d50912975ace64f38c8107494ac52cf243b2780155a =^..^=