From 413b2a9216e22a3366d8c1e6957732ab9e5d699c Mon Sep 17 00:00:00 2001 From: arne Date: Sat, 10 Sep 2022 21:03:31 +0200 Subject: [PATCH] update click the witch --- static/html/witch.html | 67 ++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 19 deletions(-) diff --git a/static/html/witch.html b/static/html/witch.html index 6e008c3..1dbd4d2 100644 --- a/static/html/witch.html +++ b/static/html/witch.html @@ -138,6 +138,12 @@ .sc-monitor-root[opcode^="data_"] .sc-monitor-value-color { background-color: #ff8c1a; } + .sc-monitor-row-value-outer { + background-color: #fc662c; + } + .sc-monitor-row-value-editing .sc-monitor-row-value-outer { + background-color: #e25b27; + } @@ -202,20 +208,20 @@ Redistribution and use in source and binary forms, with or without modification, 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. */ -!function(A){function B(B){for(var t,g,i=B[0],Q=B[1],s=0,r=[];se?1:0}return t===1/0&&e===1/0||t===-1/0&&e===-1/0?0:t-e}static isInt(A){return"number"==typeof A?!!isNaN(A)||A===Math.floor(A):"boolean"==typeof A||"string"==typeof A&&A.indexOf(".")<0}static get LIST_INVALID(){return"INVALID"}static get LIST_ALL(){return"ALL"}static toListIndex(A,B,t){if("number"!=typeof A){if("all"===A)return t?g.LIST_ALL:g.LIST_INVALID;if("last"===A)return B>0?B:g.LIST_INVALID;if("random"===A||"any"===A)return B>0?1+Math.floor(Math.random()*B):g.LIST_INVALID}return(A=Math.floor(g.toNumber(A)))<1||A>B?g.LIST_INVALID:A}}A.exports=g},function(A,B){A.exports={BOOLEAN:"Boolean",BUTTON:"button",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter"}},function(A,B){A.exports=class{static degToRad(A){return A*Math.PI/180}static radToDeg(A){return 180*A/Math.PI}static clamp(A,B,t){return Math.min(Math.max(A,B),t)}static wrapClamp(A,B,t){const e=t-B+1;return A-Math.floor((A-B)/e)*e}static tan(A){switch(A%=360){case-270:case 90:return 1/0;case-90:case 270:return-1/0;default:return Math.round(1e10*Math.tan(Math.PI*A/180))/1e10}}static reducedSortOrdering(A){const B=A.slice(0).sort((A,B)=>A-B);return A.map(A=>B.indexOf(A))}static inclusiveRandIntWithout(A,B,t){const e=B-A,g=A+Math.floor(Math.random()*e);return g>=t?g+1:g}static scale(A,B,t,e,g){return(A-B)/(t-B)*(g-e)+e}}},function(A,B,t){"use strict";var e=t(122),g=t(123),i=t(59),Q=t(58),s=t(57);function n(A,B){return Object.keys(B).forEach((function(t){A[t]=B[t]})),A}A.exports=function A(){var B=n({},s),t="en",r={},E=function(A){return A},c=null,o="warning",w={};function C(A,B,i){var Q="string"==typeof A?A:A.default,s=Y(Q,"object"==typeof A&&A.id||E(Q),i||t);return(s.format||(s.format=g(e(s.message),i||t,w)))(B)}C.rich=function(A,B,i){var Q="string"==typeof A?A:A.default,s=Y(Q,"object"==typeof A&&A.id||E(Q),i||t);return(s.toParts||(s.toParts=g.toParts(e(s.message,{tagsType:a}),i||t,w)))(B)};var a="<>";function I(A,B){var t=A[2];return function(A,B){var e="object"==typeof t?function(A,B){return Object.keys(A).reduce((function(t,e){return t[e]=A[e](B),t}),{})}(t,B):t;return"function"==typeof A?A(e):A}}function Y(A,B,t){var e=Q(t,r)||"en",g=r[e]||(r[e]={}),i=g[B];if("string"==typeof i&&(i=g[B]={message:i}),!i){var s='Translation for "'+B+'" in "'+e+'" is missing';if("warning"===o)"undefined"!=typeof console&&console.warn(s);else if("ignore"!==o)throw new Error(s);var n="function"==typeof c?c(A,B,e)||A:c||A;i=g[B]={message:n}}return i}function h(A,B,e,g,s){"object"==typeof e&&"object"!=typeof g&&(s=g,g=e,e=0);var n=Q(s||t,i),r=n&&i[n][A]||M;return g["="+ +B]||g[r(B-e)]||g.other}function M(){return"other"}return w[a]=I,C.setup=function(A){return(A=A||{}).locale&&(t=A.locale),"translations"in A&&(r=A.translations||{}),A.generateId&&(E=A.generateId),"missingReplacement"in A&&(c=A.missingReplacement),A.missingTranslation&&(o=A.missingTranslation),A.formats&&(A.formats.number&&n(B.number,A.formats.number),A.formats.date&&n(B.date,A.formats.date),A.formats.time&&n(B.time,A.formats.time)),A.types&&((w=A.types)[a]=I),{locale:t,translations:r,generateId:E,missingReplacement:c,missingTranslation:o,formats:B,types:w}},C.number=function(A,e,g){var i=e&&B.number[e]||B.parseNumberPattern(e)||B.number.default;return new Intl.NumberFormat(g||t,i).format(A)},C.date=function(A,e,g){var i=e&&B.date[e]||B.parseDatePattern(e)||B.date.default;return new Intl.DateTimeFormat(g||t,i).format(A)},C.time=function(A,e,g){var i=e&&B.time[e]||B.parseDatePattern(e)||B.time.default;return new Intl.DateTimeFormat(g||t,i).format(A)},C.select=function(A,B){return B[A]||B.other},C.custom=function(A,B,t,e){return A[1]in w?w[A[1]](A,B)(t,e):t},C.plural=h.bind(null,"cardinal"),C.selectordinal=h.bind(null,"ordinal"),C.namespace=A,C}()},function(A,B){A.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image"}},function(A,B){const t="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";A.exports=function(){const A=t.length,B=[];for(let e=0;e<20;e++)B[e]=t.charAt(Math.random()*A);return B.join("")}},function(A,B,t){const e=t(0);class g{static withoutTrailingDigits(A){let B=A.length-1;for(;B>=0&&"0123456789".indexOf(A.charAt(B))>-1;)B--;return A.slice(0,B+1)}static unusedName(A,B){if(B.indexOf(A)<0)return A;A=g.withoutTrailingDigits(A);let t=2;for(;B.indexOf(A+t)>=0;)t++;return A+t}static splitFirst(A,B){const t=A.indexOf(B);return t>=0?[A.substring(0,t),A.substring(t+1)]:[A,null]}static stringify(A){return JSON.stringify(A,(A,B)=>"number"!=typeof B||B!==1/0&&B!==-1/0&&!isNaN(B)?B:0)}static replaceUnsafeChars(A){if("string"!=typeof A){if(!Array.isArray(A))return e.error("Unexpected input recieved in replaceUnsafeChars"),A;A=String(A)}return A.replace(/[<>&'"]/g,A=>{switch(A){case"<":return"lt";case">":return"gt";case"&":return"amp";case"'":return"apos";case'"':return"quot"}})}}A.exports=g},function(A,B,t){const e=t(6),g=t(27);class i{constructor(A,B,t,g){switch(this.id=A||e(),this.name=B,this.type=t,this.isCloud=g,this.type){case i.SCALAR_TYPE:this.value=0;break;case i.LIST_TYPE:this.value=[];break;case i.BROADCAST_MESSAGE_TYPE:this.value=this.name;break;default:throw new Error("Invalid variable type: ".concat(this.type))}}toXML(A){return A=!0===A,'').concat(g(this.name),"")}static get SCALAR_TYPE(){return""}static get LIST_TYPE(){return"list"}static get BROADCAST_MESSAGE_TYPE(){return"broadcast_msg"}}A.exports=i},function(A,B,t){ +!function(A){function B(B){for(var t,g,i=B[0],Q=B[1],s=0,r=[];se?1:0}return t===1/0&&e===1/0||t===-1/0&&e===-1/0?0:t-e}static isInt(A){return"number"==typeof A?!!isNaN(A)||A===Math.floor(A):"boolean"==typeof A||"string"==typeof A&&A.indexOf(".")<0}static get LIST_INVALID(){return"INVALID"}static get LIST_ALL(){return"ALL"}static toListIndex(A,B,t){if("number"!=typeof A){if("all"===A)return t?g.LIST_ALL:g.LIST_INVALID;if("last"===A)return B>0?B:g.LIST_INVALID;if("random"===A||"any"===A)return B>0?1+Math.floor(Math.random()*B):g.LIST_INVALID}return(A=Math.floor(g.toNumber(A)))<1||A>B?g.LIST_INVALID:A}}A.exports=g},function(A,B){A.exports={BOOLEAN:"Boolean",BUTTON:"button",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter"}},function(A,B){A.exports=class{static degToRad(A){return A*Math.PI/180}static radToDeg(A){return 180*A/Math.PI}static clamp(A,B,t){return Math.min(Math.max(A,B),t)}static wrapClamp(A,B,t){const e=t-B+1;return A-Math.floor((A-B)/e)*e}static tan(A){switch(A%=360){case-270:case 90:return 1/0;case-90:case 270:return-1/0;default:return Math.round(1e10*Math.tan(Math.PI*A/180))/1e10}}static reducedSortOrdering(A){const B=A.slice(0).sort((A,B)=>A-B);return A.map(A=>B.indexOf(A))}static inclusiveRandIntWithout(A,B,t){const e=B-A,g=A+Math.floor(Math.random()*e);return g>=t?g+1:g}static scale(A,B,t,e,g){return(A-B)/(t-B)*(g-e)+e}}},function(A,B,t){"use strict";var e=t(123),g=t(124),i=t(59),Q=t(58),s=t(57);function n(A,B){return Object.keys(B).forEach((function(t){A[t]=B[t]})),A}A.exports=function A(){var B=n({},s),t="en",r={},c=function(A){return A},E=null,o="warning",w={};function C(A,B,i){var Q="string"==typeof A?A:A.default,s=Y(Q,"object"==typeof A&&A.id||c(Q),i||t);return(s.format||(s.format=g(e(s.message),i||t,w)))(B)}C.rich=function(A,B,i){var Q="string"==typeof A?A:A.default,s=Y(Q,"object"==typeof A&&A.id||c(Q),i||t);return(s.toParts||(s.toParts=g.toParts(e(s.message,{tagsType:a}),i||t,w)))(B)};var a="<>";function I(A,B){var t=A[2];return function(A,B){var e="object"==typeof t?function(A,B){return Object.keys(A).reduce((function(t,e){return t[e]=A[e](B),t}),{})}(t,B):t;return"function"==typeof A?A(e):A}}function Y(A,B,t){var e=Q(t,r)||"en",g=r[e]||(r[e]={}),i=g[B];if("string"==typeof i&&(i=g[B]={message:i}),!i){var s='Translation for "'+B+'" in "'+e+'" is missing';if("warning"===o)"undefined"!=typeof console&&console.warn(s);else if("ignore"!==o)throw new Error(s);var n="function"==typeof E?E(A,B,e)||A:E||A;i=g[B]={message:n}}return i}function h(A,B,e,g,s){"object"==typeof e&&"object"!=typeof g&&(s=g,g=e,e=0);var n=Q(s||t,i),r=n&&i[n][A]||M;return g["="+ +B]||g[r(B-e)]||g.other}function M(){return"other"}return w[a]=I,C.setup=function(A){return(A=A||{}).locale&&(t=A.locale),"translations"in A&&(r=A.translations||{}),A.generateId&&(c=A.generateId),"missingReplacement"in A&&(E=A.missingReplacement),A.missingTranslation&&(o=A.missingTranslation),A.formats&&(A.formats.number&&n(B.number,A.formats.number),A.formats.date&&n(B.date,A.formats.date),A.formats.time&&n(B.time,A.formats.time)),A.types&&((w=A.types)[a]=I),{locale:t,translations:r,generateId:c,missingReplacement:E,missingTranslation:o,formats:B,types:w}},C.number=function(A,e,g){var i=e&&B.number[e]||B.parseNumberPattern(e)||B.number.default;return new Intl.NumberFormat(g||t,i).format(A)},C.date=function(A,e,g){var i=e&&B.date[e]||B.parseDatePattern(e)||B.date.default;return new Intl.DateTimeFormat(g||t,i).format(A)},C.time=function(A,e,g){var i=e&&B.time[e]||B.parseDatePattern(e)||B.time.default;return new Intl.DateTimeFormat(g||t,i).format(A)},C.select=function(A,B){return B[A]||B.other},C.custom=function(A,B,t,e){return A[1]in w?w[A[1]](A,B)(t,e):t},C.plural=h.bind(null,"cardinal"),C.selectordinal=h.bind(null,"ordinal"),C.namespace=A,C}()},function(A,B){A.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image"}},function(A,B){const t="!#%()*+,-./:;=?@[]^_`{|}~ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";A.exports=function(){const A=t.length,B=[];for(let e=0;e<20;e++)B[e]=t.charAt(Math.random()*A);return B.join("")}},function(A,B,t){const e=t(0);class g{static withoutTrailingDigits(A){let B=A.length-1;for(;B>=0&&"0123456789".indexOf(A.charAt(B))>-1;)B--;return A.slice(0,B+1)}static unusedName(A,B){if(B.indexOf(A)<0)return A;A=g.withoutTrailingDigits(A);let t=2;for(;B.indexOf(A+t)>=0;)t++;return A+t}static splitFirst(A,B){const t=A.indexOf(B);return t>=0?[A.substring(0,t),A.substring(t+1)]:[A,null]}static stringify(A){return JSON.stringify(A,(A,B)=>"number"!=typeof B||B!==1/0&&B!==-1/0&&!isNaN(B)?B:0)}static replaceUnsafeChars(A){if("string"!=typeof A){if(!Array.isArray(A))return e.error("Unexpected input recieved in replaceUnsafeChars"),A;A=String(A)}return A.replace(/[<>&'"]/g,A=>{switch(A){case"<":return"lt";case">":return"gt";case"&":return"amp";case"'":return"apos";case'"':return"quot"}})}}A.exports=g},function(A,B,t){const e=t(6),g=t(28);class i{constructor(A,B,t,g){switch(this.id=A||e(),this.name=B,this.type=t,this.isCloud=g,this.type){case i.SCALAR_TYPE:this.value=0;break;case i.LIST_TYPE:this.value=[];break;case i.BROADCAST_MESSAGE_TYPE:this.value=this.name;break;default:throw new Error("Invalid variable type: ".concat(this.type))}}toXML(A){return A=!0===A,'').concat(g(this.name),"")}static get SCALAR_TYPE(){return""}static get LIST_TYPE(){return"list"}static get BROADCAST_MESSAGE_TYPE(){return"broadcast_msg"}}A.exports=i},function(A,B,t){ /*! * @license twgl.js 4.4.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved. * Available via the MIT license. * see: http://github.com/greggman/twgl.js for details */ -var e;"undefined"!=typeof self&&self,e=function(){return function(A){var B={};function t(e){if(B[e])return B[e].exports;var g=B[e]={i:e,l:!1,exports:{}};return A[e].call(g.exports,g,g.exports,t),g.l=!0,g.exports}return t.m=A,t.c=B,t.d=function(A,B,e){t.o(A,B)||Object.defineProperty(A,B,{configurable:!1,enumerable:!0,get:e})},t.n=function(A){var B=A&&A.__esModule?function(){return A.default}:function(){return A};return t.d(B,"a",B),B},t.o=function(A,B){return Object.prototype.hasOwnProperty.call(A,B)},t.p="",t(t.s=9)}([function(A,B,t){"use strict";B.__esModule=!0,B.copyExistingProperties=function(A,B){Object.keys(B).forEach((function(t){B.hasOwnProperty(t)&&A.hasOwnProperty(t)&&(B[t]=A[t])}))},B.copyNamedProperties=function(A,B,t){A.forEach((function(A){var e=B[A];void 0!==e&&(t[A]=e)}))},B.isBuffer=function(A,B){return Q||(Q=A.createBuffer()),B instanceof Q.constructor},B.isRenderbuffer=function(A,B){return s||(s=A.createRenderbuffer()),B instanceof s.constructor},B.isShader=function(A,B){return n||(n=A.createShader(A.VERTEX_SHADER)),B instanceof n.constructor},B.isTexture=function(A,B){return r||(r=A.createTexture()),B instanceof r.constructor},B.isSampler=function(A,B){if(!E){if(!A.createSampler)return!1;E=A.createSampler()}return B instanceof E.constructor},B.warn=B.error=void 0;var e,g=(e=t(2))&&e.__esModule?e:{default:e},i=g.default.console&&g.default.console.error&&"function"==typeof g.default.console.error?g.default.console.error.bind(g.default.console):function(){};B.error=i;var Q,s,n,r,E,c=g.default.console&&g.default.console.warn&&"function"==typeof g.default.console.warn?g.default.console.warn.bind(g.default.console):function(){};B.warn=c},function(A,B,t){"use strict";B.__esModule=!0,B.getGLTypeForTypedArray=function(A){if(A instanceof Int8Array)return 5120;if(A instanceof Uint8Array)return 5121;if(A instanceof Uint8ClampedArray)return 5121;if(A instanceof Int16Array)return 5122;if(A instanceof Uint16Array)return 5123;if(A instanceof Int32Array)return 5124;if(A instanceof Uint32Array)return 5125;if(A instanceof Float32Array)return 5126;throw"unsupported typed array type"},B.getGLTypeForTypedArrayType=function(A){if(A===Int8Array)return 5120;if(A===Uint8Array)return 5121;if(A===Uint8ClampedArray)return 5121;if(A===Int16Array)return 5122;if(A===Uint16Array)return 5123;if(A===Int32Array)return 5124;if(A===Uint32Array)return 5125;if(A===Float32Array)return 5126;throw"unsupported typed array type"},B.getTypedArrayTypeForGLType=function(A){var B=i[A];if(!B)throw"unknown gl type";return B},B.isArrayBuffer=void 0;var e,g=(e=t(2))&&e.__esModule?e:{default:e},i={},Q=i;Q[5120]=Int8Array,Q[5121]=Uint8Array,Q[5122]=Int16Array,Q[5123]=Uint16Array,Q[5124]=Int32Array,Q[5125]=Uint32Array,Q[5126]=Float32Array,Q[32819]=Uint16Array,Q[32820]=Uint16Array,Q[33635]=Uint16Array,Q[5131]=Uint16Array,Q[33640]=Uint32Array,Q[35899]=Uint32Array,Q[35902]=Uint32Array,Q[36269]=Uint32Array,Q[34042]=Uint32Array;var s=g.default.SharedArrayBuffer?function(A){return A&&A.buffer&&(A.buffer instanceof ArrayBuffer||A.buffer instanceof g.default.SharedArrayBuffer)}:function(A){return A&&A.buffer&&A.buffer instanceof ArrayBuffer};B.isArrayBuffer=s},function(A,B,t){"use strict";B.__esModule=!0,B.default=void 0;var e=void 0!==e?e:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};B.default=e},function(A,B,t){"use strict";B.__esModule=!0,B.add=function(A,B,t){return(t=t||new e(3))[0]=A[0]+B[0],t[1]=A[1]+B[1],t[2]=A[2]+B[2],t},B.copy=function(A,B){return(B=B||new e(3))[0]=A[0],B[1]=A[1],B[2]=A[2],B},B.create=function(A,B,t){var g=new e(3);return A&&(g[0]=A),B&&(g[1]=B),t&&(g[2]=t),g},B.cross=function(A,B,t){t=t||new e(3);var g=A[2]*B[0]-A[0]*B[2],i=A[0]*B[1]-A[1]*B[0];return t[0]=A[1]*B[2]-A[2]*B[1],t[1]=g,t[2]=i,t},B.distance=function(A,B){var t=A[0]-B[0],e=A[1]-B[1],g=A[2]-B[2];return Math.sqrt(t*t+e*e+g*g)},B.distanceSq=function(A,B){var t=A[0]-B[0],e=A[1]-B[1],g=A[2]-B[2];return t*t+e*e+g*g},B.divide=function(A,B,t){return(t=t||new e(3))[0]=A[0]/B[0],t[1]=A[1]/B[1],t[2]=A[2]/B[2],t},B.divScalar=function(A,B,t){return(t=t||new e(3))[0]=A[0]/B,t[1]=A[1]/B,t[2]=A[2]/B,t},B.dot=function(A,B){return A[0]*B[0]+A[1]*B[1]+A[2]*B[2]},B.lerp=function(A,B,t,g){return(g=g||new e(3))[0]=(1-t)*A[0]+t*B[0],g[1]=(1-t)*A[1]+t*B[1],g[2]=(1-t)*A[2]+t*B[2],g},B.length=function(A){return Math.sqrt(A[0]*A[0]+A[1]*A[1]+A[2]*A[2])},B.lengthSq=function(A){return A[0]*A[0]+A[1]*A[1]+A[2]*A[2]},B.mulScalar=function(A,B,t){return(t=t||new e(3))[0]=A[0]*B,t[1]=A[1]*B,t[2]=A[2]*B,t},B.multiply=function(A,B,t){return(t=t||new e(3))[0]=A[0]*B[0],t[1]=A[1]*B[1],t[2]=A[2]*B[2],t},B.negate=function(A,B){return(B=B||new e(3))[0]=-A[0],B[1]=-A[1],B[2]=-A[2],B},B.normalize=function(A,B){B=B||new e(3);var t=A[0]*A[0]+A[1]*A[1]+A[2]*A[2],g=Math.sqrt(t);return g>1e-5?(B[0]=A[0]/g,B[1]=A[1]/g,B[2]=A[2]/g):(B[0]=0,B[1]=0,B[2]=0),B},B.setDefaultType=function(A){var B=e;return e=A,B},B.subtract=function(A,B,t){return(t=t||new e(3))[0]=A[0]-B[0],t[1]=A[1]-B[1],t[2]=A[2]-B[2],t};var e=Float32Array},function(A,B,t){"use strict";B.__esModule=!0,B.isWebGL1=function(A){return!A.texStorage2D},B.isWebGL2=function(A){return!!A.texStorage2D},B.glEnumToString=void 0;var e,g,i=(e={},g={},function(A,B){return function(A){var B=A.constructor.name;if(!e[B]){for(var t in A)if("number"==typeof A[t]){var i=g[A[t]];g[A[t]]=i?"".concat(i," | ").concat(t):t}e[B]=!0}}(A),g[B]||"0x"+B.toString(16)});B.glEnumToString=i},function(A,B,t){"use strict";B.__esModule=!0,B.createAttributeSetters=z,B.createProgram=H,B.createProgramFromScripts=function(A,B,t,e,g){for(var i=N(t,e,g),Q=[],s=0;s=0?(void 0).FRAGMENT_SHADER:A.indexOf("vert")>=0?(void 0).VERTEX_SHADER:void 0}function f(A,B){B.forEach((function(B){A.deleteShader(B)}))}function H(A,B,t,e,g){for(var Q=N(t,e,g),s=[],n=[],r=0;r1&&"[0]"===e.name.substr(-3),s=e.type,n=c[s];if(!n)throw"unknown type: 0x"+s.toString(16);if(n.bindPoint){var r=t;t+=e.size,g=Q?n.arraySetter(A,s,r,i,e.size):n.setter(A,s,r,i,e.size)}else g=n.arraySetter&&Q?n.arraySetter(A,i):n.setter(A,i);return g.location=i,g}for(var g={},i=A.getProgramParameter(B,A.ACTIVE_UNIFORMS),Q=0;Q0)throw"numComponents "+i+" not correct for length "+g;return Q}(B),t},B.createBufferFromArray=h,B.createBufferFromTypedArray=n,B.createBufferInfoFromArrays=function(A,B){var t={attribs:I(A,B)},g=B.indices;if(g){var i=a(g,"indices");t.indices=n(A,i,A.ELEMENT_ARRAY_BUFFER),t.numElements=i.length,t.elementType=e.getGLTypeForTypedArray(i)}else t.numElements=function(A,B){var t,e;for(e=0;e0)throw"Can not guess numComponents for attribute '"+A+"'. Tried "+t+" but "+B+" values is not evenly divisible by "+t+". You should specify it.";return t}function C(A,B){return A.numComponents||A.size||w(B,E(A).length)}function a(A,B){if(e.isArrayBuffer(A))return A;if(e.isArrayBuffer(A.data))return A.data;Array.isArray(A)&&(A={data:A});var t=A.type;return t||(t=r(B)?Uint16Array:Float32Array),new t(A.data)}function I(A,B){var t={};return Object.keys(B).forEach((function(g){if(!r(g)){var i,s,E,c,o,I=B[g],Y=I.attrib||I.name||I.attribName||Q.attribPrefix+g;if("number"==typeof I||"number"==typeof I.data){o=I.data||I;var h=I.type||Float32Array,M=o*h.BYTES_PER_ELEMENT;s=e.getGLTypeForTypedArrayType(h),E=void 0!==I.normalize?I.normalize:(D=h)===Int8Array||D===Uint8Array,c=I.numComponents||I.size||w(g,o),i=A.createBuffer(),A.bindBuffer(A.ARRAY_BUFFER,i),A.bufferData(A.ARRAY_BUFFER,M,I.drawType||A.STATIC_DRAW)}else{var F=a(I,g);i=n(A,F,void 0,I.drawType),s=e.getGLTypeForTypedArray(F),E=void 0!==I.normalize?I.normalize:function(A){return A instanceof Int8Array||A instanceof Uint8Array}(F),c=C(I,g),o=F.length}t[Y]={buffer:i,numComponents:c,type:s,normalize:E,stride:I.stride||0,offset:I.offset||0,divisor:void 0===I.divisor?void 0:I.divisor,drawType:I.drawType}}var D})),A.bindBuffer(A.ARRAY_BUFFER,null),t}var Y=["position","positions","a_position"];function h(A,B,t){var e="indices"===t?A.ELEMENT_ARRAY_BUFFER:A.ARRAY_BUFFER;return n(A,a(B,t),e)}},function(A,B,t){"use strict";B.__esModule=!0,B.setTextureDefaults_=function(A){Q.copyExistingProperties(A,r),A.textureColor&&l(A.textureColor)},B.createSampler=p,B.createSamplers=function(A,B){var t={};return Object.keys(B).forEach((function(e){t[e]=p(A,B[e])})),t},B.setSamplerParameters=R,B.createTexture=K,B.setEmptyTexture=V,B.setTextureFromArray=W,B.loadTextureFromUrl=L,B.setTextureFromElement=j,B.setTextureFilteringForSize=J,B.setTextureParameters=H,B.setDefaultTextureColor=l,B.createTextures=function(A,B,t){t=t||x;var e=0,g=[],i={},Q={};function s(){0===e&&setTimeout((function(){t(g.length?g:void 0,i,Q)}),0)}return Object.keys(B).forEach((function(t){var n,r,E=B[t];("string"==typeof(r=E.src)||Array.isArray(r)&&"string"==typeof r[0])&&(n=function(A,B,i){Q[t]=i,--e,A&&g.push(A),s()},++e),i[t]=K(A,E,n)})),s(),i},B.resizeTexture=function(A,B,t,e,g){e=e||t.width,g=g||t.height;var i=t.target||A.TEXTURE_2D;A.bindTexture(i,B);var Q,s=t.level||0,n=t.internalFormat||t.format||A.RGBA,r=M(n),c=t.format||r.format,o=t.src;if(Q=o&&(E(o)||Array.isArray(o)&&"number"==typeof o[0])?t.type||D(A,o,r.type):t.type||r.type,i===A.TEXTURE_CUBE_MAP)for(var w=0;w<6;++w)A.texImage2D(A.TEXTURE_CUBE_MAP_POSITIVE_X+w,s,n,e,g,0,c,Q,null);else A.texImage2D(i,s,n,e,g,0,c,Q,null)},B.getNumComponentsForFormat=function(A){var B=C[A];if(!B)throw"unknown format: "+A;return B.numColorComponents},B.getBytesPerElementForInternalFormat=h;var e,g=n(t(4)),i=n(t(1)),Q=n(t(0)),s=(e=t(2))&&e.__esModule?e:{default:e};function n(A){if(A&&A.__esModule)return A;var B={};if(null!=A)for(var t in A)if(Object.prototype.hasOwnProperty.call(A,t)){var e=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(A,t):{};e.get||e.set?Object.defineProperty(B,t,e):B[t]=A[t]}return B.default=A,B}var r={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},E=i.isArrayBuffer,c=s.default.document&&s.default.document.createElement?s.default.document.createElement("canvas").getContext("2d"):null,o=6407,w=33319,C={},a=C;a[6406]={numColorComponents:1},a[6409]={numColorComponents:1},a[6410]={numColorComponents:2},a[o]={numColorComponents:3},a[6408]={numColorComponents:4},a[6403]={numColorComponents:1},a[36244]={numColorComponents:1},a[w]={numColorComponents:2},a[33320]={numColorComponents:2},a[o]={numColorComponents:3},a[36248]={numColorComponents:3},a[6408]={numColorComponents:4},a[36249]={numColorComponents:4},a[6402]={numColorComponents:1},a[34041]={numColorComponents:2};var I={},Y=I;function h(A,B){var t=I[A];if(!t)throw"unknown internal format";var e=t.bytesPerElementMap[B];if(void 0===e)throw"unknown internal format";return e}function M(A){var B=I[A];if(!B)throw"unknown internal format";return{format:B.textureFormat,type:Array.isArray(B.type)?B.type[0]:B.type}}function F(A){return 0==(A&A-1)}function D(A,B,t){return E(B)?i.getGLTypeForTypedArray(B):t||A.UNSIGNED_BYTE}function u(A,B,t,e,g){if(g%1!=0)throw"can't guess dimensions";if(t||e){if(e){if(!t&&(t=g/e)%1)throw"can't guess dimensions"}else if((e=g/t)%1)throw"can't guess dimensions"}else{var i=Math.sqrt(g/(B===A.TEXTURE_CUBE_MAP?6:1));i%1==0?(t=i,e=i):(t=g,e=1)}return{width:t,height:e}}function l(A){r.textureColor=new Uint8Array([255*A[0],255*A[1],255*A[2],255*A[3]])}Y[6406]={textureFormat:6406,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[5121,5131,36193,5126]},Y[6409]={textureFormat:6409,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[5121,5131,36193,5126]},Y[6410]={textureFormat:6410,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[5121,5131,36193,5126]},Y[o]={textureFormat:o,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[5121,5131,36193,5126,33635]},Y[6408]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[5121,5131,36193,5126,32819,32820]},Y[33321]={textureFormat:6403,colorRenderable:!0,textureFilterable:!0,bytesPerElement:1,type:5121},Y[36756]={textureFormat:6403,colorRenderable:!1,textureFilterable:!0,bytesPerElement:1,type:5120},Y[33325]={textureFormat:6403,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[5126,5131]},Y[33326]={textureFormat:6403,colorRenderable:!1,textureFilterable:!1,bytesPerElement:4,type:5126},Y[33330]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:5121},Y[33329]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:5120},Y[33332]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5123},Y[33331]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5122},Y[33334]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5125},Y[33333]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5124},Y[33323]={textureFormat:w,colorRenderable:!0,textureFilterable:!0,bytesPerElement:2,type:5121},Y[36757]={textureFormat:w,colorRenderable:!1,textureFilterable:!0,bytesPerElement:2,type:5120},Y[33327]={textureFormat:w,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[5126,5131]},Y[33328]={textureFormat:w,colorRenderable:!1,textureFilterable:!1,bytesPerElement:8,type:5126},Y[33336]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5121},Y[33335]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5120},Y[33338]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5123},Y[33337]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5122},Y[33340]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5125},Y[33339]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5124},Y[32849]={textureFormat:o,colorRenderable:!0,textureFilterable:!0,bytesPerElement:3,type:5121},Y[35905]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:5121},Y[36194]={textureFormat:o,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[5121,33635]},Y[36758]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:5120},Y[35898]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[5126,5131,35899]},Y[35901]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[5126,5131,35902]},Y[34843]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[5126,5131]},Y[34837]={textureFormat:o,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:5126},Y[36221]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:5121},Y[36239]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:5120},Y[36215]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:5123},Y[36233]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:5122},Y[36209]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:5125},Y[36227]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:5124},Y[32856]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:5121},Y[35907]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:5121},Y[36759]={textureFormat:6408,colorRenderable:!1,textureFilterable:!0,bytesPerElement:4,type:5120},Y[32855]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[5121,32820,33640]},Y[32854]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[5121,32819]},Y[32857]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:33640},Y[34842]={textureFormat:6408,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[5126,5131]},Y[34836]={textureFormat:6408,colorRenderable:!1,textureFilterable:!1,bytesPerElement:16,type:5126},Y[36220]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5121},Y[36238]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5120},Y[36975]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:33640},Y[36214]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5123},Y[36232]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5122},Y[36226]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:5124},Y[36208]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:5125},Y[33189]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[5123,5125]},Y[33190]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5125},Y[36012]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5126},Y[35056]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:34042},Y[36013]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:36269},Object.keys(Y).forEach((function(A){var B=Y[A];if(B.bytesPerElementMap={},Array.isArray(B.bytesPerElement))B.bytesPerElement.forEach((function(A,t){var e=B.type[t];B.bytesPerElementMap[e]=A}));else{var t=B.type;B.bytesPerElementMap[t]=B.bytesPerElement}}));var d={};function U(A,B){void 0!==B.colorspaceConversion&&(d.colorspaceConversion=A.getParameter(A.UNPACK_COLORSPACE_CONVERSION_WEBGL),A.pixelStorei(A.UNPACK_COLORSPACE_CONVERSION_WEBGL,B.colorspaceConversion)),void 0!==B.premultiplyAlpha&&(d.premultiplyAlpha=A.getParameter(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha)),void 0!==B.flipY&&(d.flipY=A.getParameter(A.UNPACK_FLIP_Y_WEBGL),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,B.flipY))}function N(A,B){void 0!==B.colorspaceConversion&&A.pixelStorei(A.UNPACK_COLORSPACE_CONVERSION_WEBGL,d.colorspaceConversion),void 0!==B.premultiplyAlpha&&A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha),void 0!==B.flipY&&A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,d.flipY)}function m(A){d.unpackAlignment=A.getParameter(A.UNPACK_ALIGNMENT),g.isWebGL2(A)&&(d.unpackRowLength=A.getParameter(A.UNPACK_ROW_LENGTH),d.unpackImageHeight=A.getParameter(A.UNPACK_IMAGE_HEIGHT),d.unpackSkipPixels=A.getParameter(A.UNPACK_SKIP_PIXELS),d.unpackSkipRows=A.getParameter(A.UNPACK_SKIP_ROWS),d.unpackSkipImages=A.getParameter(A.UNPACK_SKIP_IMAGES))}function G(A){A.pixelStorei(A.UNPACK_ALIGNMENT,d.unpackAlignment),g.isWebGL2(A)&&(A.pixelStorei(A.UNPACK_ROW_LENGTH,d.unpackRowLength),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,d.unpackImageHeight),A.pixelStorei(A.UNPACK_SKIP_PIXELS,d.unpackSkipPixels),A.pixelStorei(A.UNPACK_SKIP_ROWS,d.unpackSkipRows),A.pixelStorei(A.UNPACK_SKIP_IMAGES,d.unpackSkipImages))}function f(A,B,t,e){e.minMag&&(t.call(A,B,A.TEXTURE_MIN_FILTER,e.minMag),t.call(A,B,A.TEXTURE_MAG_FILTER,e.minMag)),e.min&&t.call(A,B,A.TEXTURE_MIN_FILTER,e.min),e.mag&&t.call(A,B,A.TEXTURE_MAG_FILTER,e.mag),e.wrap&&(t.call(A,B,A.TEXTURE_WRAP_S,e.wrap),t.call(A,B,A.TEXTURE_WRAP_T,e.wrap),(B===A.TEXTURE_3D||Q.isSampler(A,B))&&t.call(A,B,A.TEXTURE_WRAP_R,e.wrap)),e.wrapR&&t.call(A,B,A.TEXTURE_WRAP_R,e.wrapR),e.wrapS&&t.call(A,B,A.TEXTURE_WRAP_S,e.wrapS),e.wrapT&&t.call(A,B,A.TEXTURE_WRAP_T,e.wrapT),e.minLod&&t.call(A,B,A.TEXTURE_MIN_LOD,e.minLod),e.maxLod&&t.call(A,B,A.TEXTURE_MAX_LOD,e.maxLod),e.baseLevel&&t.call(A,B,A.TEXTURE_BASE_LEVEL,e.baseLevel),e.maxLevel&&t.call(A,B,A.TEXTURE_MAX_LEVEL,e.maxLevel)}function H(A,B,t){var e=t.target||A.TEXTURE_2D;A.bindTexture(e,B),f(A,e,A.texParameteri,t)}function R(A,B,t){f(A,B,A.samplerParameteri,t)}function p(A,B){var t=A.createSampler();return R(A,t,B),t}function J(A,B,t,e,i,Q,s){t=t||r.textureOptions,Q=Q||A.RGBA,s=s||A.UNSIGNED_BYTE;var n=t.target||A.TEXTURE_2D;if(e=e||t.width,i=i||t.height,A.bindTexture(n,B),function(A,B,t,e){if(!g.isWebGL2(A))return F(B)&&F(t);var i=I[e];if(!i)throw"unknown internal format";return i.colorRenderable&&i.textureFilterable}(A,e,i,Q))A.generateMipmap(n);else{var E=function(A){var B=I[A];if(!B)throw"unknown internal format";return B.textureFilterable}(Q)?A.LINEAR:A.NEAREST;A.texParameteri(n,A.TEXTURE_MIN_FILTER,E),A.texParameteri(n,A.TEXTURE_MAG_FILTER,E),A.texParameteri(n,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(n,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE)}}function y(A){return!0===A.auto||void 0===A.auto&&void 0===A.level}function k(A,B){return(B=B||{}).cubeFaceOrder||[A.TEXTURE_CUBE_MAP_POSITIVE_X,A.TEXTURE_CUBE_MAP_NEGATIVE_X,A.TEXTURE_CUBE_MAP_POSITIVE_Y,A.TEXTURE_CUBE_MAP_NEGATIVE_Y,A.TEXTURE_CUBE_MAP_POSITIVE_Z,A.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function T(A,B){var t=k(A,B).map((function(A,B){return{face:A,ndx:B}}));return t.sort((function(A,B){return A.face-B.face})),t}function j(A,B,t,e){var g=(e=e||r.textureOptions).target||A.TEXTURE_2D,i=e.level||0,Q=t.width,n=t.height,E=e.internalFormat||e.format||A.RGBA,o=M(E),w=e.format||o.format,C=e.type||o.type;if(U(A,e),A.bindTexture(g,B),g===A.TEXTURE_CUBE_MAP){var a,I,Y=t.width,h=t.height;if(Y/6===h)a=h,I=[0,0,1,0,2,0,3,0,4,0,5,0];else if(h/6===Y)a=Y,I=[0,0,0,1,0,2,0,3,0,4,0,5];else if(Y/3==h/2)a=Y/3,I=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(Y/2!=h/3)throw"can't figure out cube map from element: "+(t.src?t.src:t.nodeName);a=Y/2,I=[0,0,1,0,0,1,1,1,0,2,1,2]}c?(c.canvas.width=a,c.canvas.height=a,Q=a,n=a,T(A,e).forEach((function(B){var e=I[2*B.ndx+0]*a,g=I[2*B.ndx+1]*a;c.drawImage(t,e,g,a,a,0,0,a,a),A.texImage2D(B.face,i,E,w,C,c.canvas)})),c.canvas.width=1,c.canvas.height=1):s.default.createImageBitmap&&(Q=a,n=a,T(A,e).forEach((function(r){var c=I[2*r.ndx+0]*a,o=I[2*r.ndx+1]*a;A.texImage2D(r.face,i,E,a,a,0,w,C,null),s.default.createImageBitmap(t,c,o,a,a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(t){U(A,e),A.bindTexture(g,B),A.texImage2D(r.face,i,E,w,C,t),N(A,e),y(e)&&J(A,B,e,Q,n,E,C)}))})))}else if(g===A.TEXTURE_3D||g===A.TEXTURE_2D_ARRAY){var F=Math.min(t.width,t.height),D=Math.max(t.width,t.height),u=D/F;if(u%1!=0)throw"can not compute 3D dimensions of element";var l=t.width===D?1:0,d=t.height===D?1:0;m(A),A.pixelStorei(A.UNPACK_ALIGNMENT,1),A.pixelStorei(A.UNPACK_ROW_LENGTH,t.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,0),A.pixelStorei(A.UNPACK_SKIP_IMAGES,0),A.texImage3D(g,i,E,F,F,F,0,w,C,null);for(var f=0;f=0?h(e,B):t.indexOf("tan")>=0||t.indexOf("binorm")>=0?I(e,B):t.indexOf("norm")>=0&&Y(e,B)})),A}function F(A,B,t){return A=A||2,{position:{numComponents:2,data:[(B=B||0)+-1*(A*=.5),(t=t||0)+-1*A,B+1*A,t+-1*A,B+-1*A,t+1*A,B+1*A,t+1*A]},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 D(A,B,t,e,g){A=A||1,B=B||1,t=t||1,e=e||1,g=g||Q.identity();for(var i=(t+1)*(e+1),s=o(3,i),n=o(3,i),r=o(2,i),E=0;E<=e;E++)for(var c=0;c<=t;c++){var w=c/t,C=E/e;s.push(A*w-.5*A,0,B*C-.5*B),n.push(0,1,0),r.push(w,C)}for(var a=t+1,I=o(3,t*e*2,Uint16Array),Y=0;Y 0");e=e||0,i=i||0;for(var s=(g=g||Math.PI)-e,n=(Q=Q||2*Math.PI)-i,r=(B+1)*(t+1),E=o(3,r),c=o(3,r),w=o(2,r),C=0;C<=t;C++)for(var a=0;a<=B;a++){var I=a/B,Y=C/t,h=n*I,M=s*Y,F=Math.sin(h),D=Math.cos(h),u=Math.sin(M),l=D*u,d=Math.cos(M),U=F*u;E.push(A*l,A*d,A*U),c.push(l,d,U),w.push(1-I,Y)}for(var N=B+1,m=o(3,B*t*2,Uint16Array),G=0;Gg?(l=t,u=1,d=B):d=A+D/g*(B-A),-2!==D&&D!==g+2||(d=0,u=0),l-=t/2;for(var U=0;Ug?0:N*h,D<0?-1:D>g?1:M,D<0||D>g?0:m*h),C.push(U/e,1-u)}}for(var G=0;G 0");var n=(Q=Q||1)-(i=i||0),r=2*(g+1)*4,E=o(3,r),c=o(3,r),w=o(2,r);function C(A,B,t){return A+(B-A)*t}function a(B,t,Q,r,o,a){for(var I=0;I<=g;I++){var Y=t/1,h=I/g,M=2*(Y-.5),F=(i+h*n)*Math.PI,D=Math.sin(F),u=Math.cos(F),l=C(A,B,D),d=M*e,U=u*A,N=D*l;E.push(d,U,N);var m=s.add(s.multiply([0,D,u],Q),r);c.push(m),w.push(Y*o+a,h)}}for(var I=0;I<2;I++){var Y=2*(I/1-.5);a(B,I,[1,1,1],[0,0,0],1,0),a(B,I,[0,0,0],[Y,0,0],0,0),a(t,I,[1,1,1],[0,0,0],1,0),a(t,I,[0,0,0],[Y,0,0],0,1)}var h=o(3,2*g*4,Uint16Array);function M(A,B){for(var t=0;t0&&I!==B){var F=E+(I+1),D=E+I,u=E+I-w,l=E+(I+1)-w;r.push(F,D,u),r.push(F,u,l)}}E+=B+1}return{position:Q,normal:s,texcoord:n,indices:r}}function p(A){return function(B){var t=A.apply(this,Array.prototype.slice.call(arguments,1));return e.createBuffersFromArrays(B,t)}}function J(A){return function(B){var t=A.apply(null,Array.prototype.slice.call(arguments,1));return e.createBufferInfoFromArrays(B,t)}}var y=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function k(A,B,t,e){e=e||0;for(var g=A.length,i=0;i1e-5?(B[0]=A[0]/g,B[1]=A[1]/g,B[2]=A[2]/g):(B[0]=0,B[1]=0,B[2]=0),B},B.setDefaultType=function(A){var B=e;return e=A,B},B.subtract=function(A,B,t){return(t=t||new e(3))[0]=A[0]-B[0],t[1]=A[1]-B[1],t[2]=A[2]-B[2],t};var e=Float32Array},function(A,B,t){"use strict";B.__esModule=!0,B.isWebGL1=function(A){return!A.texStorage2D},B.isWebGL2=function(A){return!!A.texStorage2D},B.glEnumToString=void 0;var e,g,i=(e={},g={},function(A,B){return function(A){var B=A.constructor.name;if(!e[B]){for(var t in A)if("number"==typeof A[t]){var i=g[A[t]];g[A[t]]=i?"".concat(i," | ").concat(t):t}e[B]=!0}}(A),g[B]||"0x"+B.toString(16)});B.glEnumToString=i},function(A,B,t){"use strict";B.__esModule=!0,B.createAttributeSetters=z,B.createProgram=H,B.createProgramFromScripts=function(A,B,t,e,g){for(var i=N(t,e,g),Q=[],s=0;s=0?(void 0).FRAGMENT_SHADER:A.indexOf("vert")>=0?(void 0).VERTEX_SHADER:void 0}function f(A,B){B.forEach((function(B){A.deleteShader(B)}))}function H(A,B,t,e,g){for(var Q=N(t,e,g),s=[],n=[],r=0;r1&&"[0]"===e.name.substr(-3),s=e.type,n=E[s];if(!n)throw"unknown type: 0x"+s.toString(16);if(n.bindPoint){var r=t;t+=e.size,g=Q?n.arraySetter(A,s,r,i,e.size):n.setter(A,s,r,i,e.size)}else g=n.arraySetter&&Q?n.arraySetter(A,i):n.setter(A,i);return g.location=i,g}for(var g={},i=A.getProgramParameter(B,A.ACTIVE_UNIFORMS),Q=0;Q0)throw"numComponents "+i+" not correct for length "+g;return Q}(B),t},B.createBufferFromArray=h,B.createBufferFromTypedArray=n,B.createBufferInfoFromArrays=function(A,B){var t={attribs:I(A,B)},g=B.indices;if(g){var i=a(g,"indices");t.indices=n(A,i,A.ELEMENT_ARRAY_BUFFER),t.numElements=i.length,t.elementType=e.getGLTypeForTypedArray(i)}else t.numElements=function(A,B){var t,e;for(e=0;e0)throw"Can not guess numComponents for attribute '"+A+"'. Tried "+t+" but "+B+" values is not evenly divisible by "+t+". You should specify it.";return t}function C(A,B){return A.numComponents||A.size||w(B,c(A).length)}function a(A,B){if(e.isArrayBuffer(A))return A;if(e.isArrayBuffer(A.data))return A.data;Array.isArray(A)&&(A={data:A});var t=A.type;return t||(t=r(B)?Uint16Array:Float32Array),new t(A.data)}function I(A,B){var t={};return Object.keys(B).forEach((function(g){if(!r(g)){var i,s,c,E,o,I=B[g],Y=I.attrib||I.name||I.attribName||Q.attribPrefix+g;if("number"==typeof I||"number"==typeof I.data){o=I.data||I;var h=I.type||Float32Array,M=o*h.BYTES_PER_ELEMENT;s=e.getGLTypeForTypedArrayType(h),c=void 0!==I.normalize?I.normalize:(D=h)===Int8Array||D===Uint8Array,E=I.numComponents||I.size||w(g,o),i=A.createBuffer(),A.bindBuffer(A.ARRAY_BUFFER,i),A.bufferData(A.ARRAY_BUFFER,M,I.drawType||A.STATIC_DRAW)}else{var F=a(I,g);i=n(A,F,void 0,I.drawType),s=e.getGLTypeForTypedArray(F),c=void 0!==I.normalize?I.normalize:function(A){return A instanceof Int8Array||A instanceof Uint8Array}(F),E=C(I,g),o=F.length}t[Y]={buffer:i,numComponents:E,type:s,normalize:c,stride:I.stride||0,offset:I.offset||0,divisor:void 0===I.divisor?void 0:I.divisor,drawType:I.drawType}}var D})),A.bindBuffer(A.ARRAY_BUFFER,null),t}var Y=["position","positions","a_position"];function h(A,B,t){var e="indices"===t?A.ELEMENT_ARRAY_BUFFER:A.ARRAY_BUFFER;return n(A,a(B,t),e)}},function(A,B,t){"use strict";B.__esModule=!0,B.setTextureDefaults_=function(A){Q.copyExistingProperties(A,r),A.textureColor&&l(A.textureColor)},B.createSampler=p,B.createSamplers=function(A,B){var t={};return Object.keys(B).forEach((function(e){t[e]=p(A,B[e])})),t},B.setSamplerParameters=R,B.createTexture=K,B.setEmptyTexture=V,B.setTextureFromArray=W,B.loadTextureFromUrl=L,B.setTextureFromElement=j,B.setTextureFilteringForSize=J,B.setTextureParameters=H,B.setDefaultTextureColor=l,B.createTextures=function(A,B,t){t=t||x;var e=0,g=[],i={},Q={};function s(){0===e&&setTimeout((function(){t(g.length?g:void 0,i,Q)}),0)}return Object.keys(B).forEach((function(t){var n,r,c=B[t];("string"==typeof(r=c.src)||Array.isArray(r)&&"string"==typeof r[0])&&(n=function(A,B,i){Q[t]=i,--e,A&&g.push(A),s()},++e),i[t]=K(A,c,n)})),s(),i},B.resizeTexture=function(A,B,t,e,g){e=e||t.width,g=g||t.height;var i=t.target||A.TEXTURE_2D;A.bindTexture(i,B);var Q,s=t.level||0,n=t.internalFormat||t.format||A.RGBA,r=M(n),E=t.format||r.format,o=t.src;if(Q=o&&(c(o)||Array.isArray(o)&&"number"==typeof o[0])?t.type||D(A,o,r.type):t.type||r.type,i===A.TEXTURE_CUBE_MAP)for(var w=0;w<6;++w)A.texImage2D(A.TEXTURE_CUBE_MAP_POSITIVE_X+w,s,n,e,g,0,E,Q,null);else A.texImage2D(i,s,n,e,g,0,E,Q,null)},B.getNumComponentsForFormat=function(A){var B=C[A];if(!B)throw"unknown format: "+A;return B.numColorComponents},B.getBytesPerElementForInternalFormat=h;var e,g=n(t(4)),i=n(t(1)),Q=n(t(0)),s=(e=t(2))&&e.__esModule?e:{default:e};function n(A){if(A&&A.__esModule)return A;var B={};if(null!=A)for(var t in A)if(Object.prototype.hasOwnProperty.call(A,t)){var e=Object.defineProperty&&Object.getOwnPropertyDescriptor?Object.getOwnPropertyDescriptor(A,t):{};e.get||e.set?Object.defineProperty(B,t,e):B[t]=A[t]}return B.default=A,B}var r={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},c=i.isArrayBuffer,E=s.default.document&&s.default.document.createElement?s.default.document.createElement("canvas").getContext("2d"):null,o=6407,w=33319,C={},a=C;a[6406]={numColorComponents:1},a[6409]={numColorComponents:1},a[6410]={numColorComponents:2},a[o]={numColorComponents:3},a[6408]={numColorComponents:4},a[6403]={numColorComponents:1},a[36244]={numColorComponents:1},a[w]={numColorComponents:2},a[33320]={numColorComponents:2},a[o]={numColorComponents:3},a[36248]={numColorComponents:3},a[6408]={numColorComponents:4},a[36249]={numColorComponents:4},a[6402]={numColorComponents:1},a[34041]={numColorComponents:2};var I={},Y=I;function h(A,B){var t=I[A];if(!t)throw"unknown internal format";var e=t.bytesPerElementMap[B];if(void 0===e)throw"unknown internal format";return e}function M(A){var B=I[A];if(!B)throw"unknown internal format";return{format:B.textureFormat,type:Array.isArray(B.type)?B.type[0]:B.type}}function F(A){return 0==(A&A-1)}function D(A,B,t){return c(B)?i.getGLTypeForTypedArray(B):t||A.UNSIGNED_BYTE}function u(A,B,t,e,g){if(g%1!=0)throw"can't guess dimensions";if(t||e){if(e){if(!t&&(t=g/e)%1)throw"can't guess dimensions"}else if((e=g/t)%1)throw"can't guess dimensions"}else{var i=Math.sqrt(g/(B===A.TEXTURE_CUBE_MAP?6:1));i%1==0?(t=i,e=i):(t=g,e=1)}return{width:t,height:e}}function l(A){r.textureColor=new Uint8Array([255*A[0],255*A[1],255*A[2],255*A[3]])}Y[6406]={textureFormat:6406,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[5121,5131,36193,5126]},Y[6409]={textureFormat:6409,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[5121,5131,36193,5126]},Y[6410]={textureFormat:6410,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[5121,5131,36193,5126]},Y[o]={textureFormat:o,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[5121,5131,36193,5126,33635]},Y[6408]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[5121,5131,36193,5126,32819,32820]},Y[33321]={textureFormat:6403,colorRenderable:!0,textureFilterable:!0,bytesPerElement:1,type:5121},Y[36756]={textureFormat:6403,colorRenderable:!1,textureFilterable:!0,bytesPerElement:1,type:5120},Y[33325]={textureFormat:6403,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[5126,5131]},Y[33326]={textureFormat:6403,colorRenderable:!1,textureFilterable:!1,bytesPerElement:4,type:5126},Y[33330]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:5121},Y[33329]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:1,type:5120},Y[33332]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5123},Y[33331]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5122},Y[33334]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5125},Y[33333]={textureFormat:36244,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5124},Y[33323]={textureFormat:w,colorRenderable:!0,textureFilterable:!0,bytesPerElement:2,type:5121},Y[36757]={textureFormat:w,colorRenderable:!1,textureFilterable:!0,bytesPerElement:2,type:5120},Y[33327]={textureFormat:w,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[5126,5131]},Y[33328]={textureFormat:w,colorRenderable:!1,textureFilterable:!1,bytesPerElement:8,type:5126},Y[33336]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5121},Y[33335]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:2,type:5120},Y[33338]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5123},Y[33337]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5122},Y[33340]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5125},Y[33339]={textureFormat:33320,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5124},Y[32849]={textureFormat:o,colorRenderable:!0,textureFilterable:!0,bytesPerElement:3,type:5121},Y[35905]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:5121},Y[36194]={textureFormat:o,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[5121,33635]},Y[36758]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:3,type:5120},Y[35898]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[5126,5131,35899]},Y[35901]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[5126,5131,35902]},Y[34843]={textureFormat:o,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[5126,5131]},Y[34837]={textureFormat:o,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:5126},Y[36221]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:5121},Y[36239]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:3,type:5120},Y[36215]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:5123},Y[36233]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:6,type:5122},Y[36209]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:5125},Y[36227]={textureFormat:36248,colorRenderable:!1,textureFilterable:!1,bytesPerElement:12,type:5124},Y[32856]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:5121},Y[35907]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:5121},Y[36759]={textureFormat:6408,colorRenderable:!1,textureFilterable:!0,bytesPerElement:4,type:5120},Y[32855]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[5121,32820,33640]},Y[32854]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[5121,32819]},Y[32857]={textureFormat:6408,colorRenderable:!0,textureFilterable:!0,bytesPerElement:4,type:33640},Y[34842]={textureFormat:6408,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[5126,5131]},Y[34836]={textureFormat:6408,colorRenderable:!1,textureFilterable:!1,bytesPerElement:16,type:5126},Y[36220]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5121},Y[36238]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5120},Y[36975]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:33640},Y[36214]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5123},Y[36232]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:8,type:5122},Y[36226]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:5124},Y[36208]={textureFormat:36249,colorRenderable:!0,textureFilterable:!1,bytesPerElement:16,type:5125},Y[33189]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[5123,5125]},Y[33190]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5125},Y[36012]={textureFormat:6402,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:5126},Y[35056]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:34042},Y[36013]={textureFormat:34041,colorRenderable:!0,textureFilterable:!1,bytesPerElement:4,type:36269},Object.keys(Y).forEach((function(A){var B=Y[A];if(B.bytesPerElementMap={},Array.isArray(B.bytesPerElement))B.bytesPerElement.forEach((function(A,t){var e=B.type[t];B.bytesPerElementMap[e]=A}));else{var t=B.type;B.bytesPerElementMap[t]=B.bytesPerElement}}));var d={};function U(A,B){void 0!==B.colorspaceConversion&&(d.colorspaceConversion=A.getParameter(A.UNPACK_COLORSPACE_CONVERSION_WEBGL),A.pixelStorei(A.UNPACK_COLORSPACE_CONVERSION_WEBGL,B.colorspaceConversion)),void 0!==B.premultiplyAlpha&&(d.premultiplyAlpha=A.getParameter(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL),A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,B.premultiplyAlpha)),void 0!==B.flipY&&(d.flipY=A.getParameter(A.UNPACK_FLIP_Y_WEBGL),A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,B.flipY))}function N(A,B){void 0!==B.colorspaceConversion&&A.pixelStorei(A.UNPACK_COLORSPACE_CONVERSION_WEBGL,d.colorspaceConversion),void 0!==B.premultiplyAlpha&&A.pixelStorei(A.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d.premultiplyAlpha),void 0!==B.flipY&&A.pixelStorei(A.UNPACK_FLIP_Y_WEBGL,d.flipY)}function m(A){d.unpackAlignment=A.getParameter(A.UNPACK_ALIGNMENT),g.isWebGL2(A)&&(d.unpackRowLength=A.getParameter(A.UNPACK_ROW_LENGTH),d.unpackImageHeight=A.getParameter(A.UNPACK_IMAGE_HEIGHT),d.unpackSkipPixels=A.getParameter(A.UNPACK_SKIP_PIXELS),d.unpackSkipRows=A.getParameter(A.UNPACK_SKIP_ROWS),d.unpackSkipImages=A.getParameter(A.UNPACK_SKIP_IMAGES))}function G(A){A.pixelStorei(A.UNPACK_ALIGNMENT,d.unpackAlignment),g.isWebGL2(A)&&(A.pixelStorei(A.UNPACK_ROW_LENGTH,d.unpackRowLength),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,d.unpackImageHeight),A.pixelStorei(A.UNPACK_SKIP_PIXELS,d.unpackSkipPixels),A.pixelStorei(A.UNPACK_SKIP_ROWS,d.unpackSkipRows),A.pixelStorei(A.UNPACK_SKIP_IMAGES,d.unpackSkipImages))}function f(A,B,t,e){e.minMag&&(t.call(A,B,A.TEXTURE_MIN_FILTER,e.minMag),t.call(A,B,A.TEXTURE_MAG_FILTER,e.minMag)),e.min&&t.call(A,B,A.TEXTURE_MIN_FILTER,e.min),e.mag&&t.call(A,B,A.TEXTURE_MAG_FILTER,e.mag),e.wrap&&(t.call(A,B,A.TEXTURE_WRAP_S,e.wrap),t.call(A,B,A.TEXTURE_WRAP_T,e.wrap),(B===A.TEXTURE_3D||Q.isSampler(A,B))&&t.call(A,B,A.TEXTURE_WRAP_R,e.wrap)),e.wrapR&&t.call(A,B,A.TEXTURE_WRAP_R,e.wrapR),e.wrapS&&t.call(A,B,A.TEXTURE_WRAP_S,e.wrapS),e.wrapT&&t.call(A,B,A.TEXTURE_WRAP_T,e.wrapT),e.minLod&&t.call(A,B,A.TEXTURE_MIN_LOD,e.minLod),e.maxLod&&t.call(A,B,A.TEXTURE_MAX_LOD,e.maxLod),e.baseLevel&&t.call(A,B,A.TEXTURE_BASE_LEVEL,e.baseLevel),e.maxLevel&&t.call(A,B,A.TEXTURE_MAX_LEVEL,e.maxLevel)}function H(A,B,t){var e=t.target||A.TEXTURE_2D;A.bindTexture(e,B),f(A,e,A.texParameteri,t)}function R(A,B,t){f(A,B,A.samplerParameteri,t)}function p(A,B){var t=A.createSampler();return R(A,t,B),t}function J(A,B,t,e,i,Q,s){t=t||r.textureOptions,Q=Q||A.RGBA,s=s||A.UNSIGNED_BYTE;var n=t.target||A.TEXTURE_2D;if(e=e||t.width,i=i||t.height,A.bindTexture(n,B),function(A,B,t,e){if(!g.isWebGL2(A))return F(B)&&F(t);var i=I[e];if(!i)throw"unknown internal format";return i.colorRenderable&&i.textureFilterable}(A,e,i,Q))A.generateMipmap(n);else{var c=function(A){var B=I[A];if(!B)throw"unknown internal format";return B.textureFilterable}(Q)?A.LINEAR:A.NEAREST;A.texParameteri(n,A.TEXTURE_MIN_FILTER,c),A.texParameteri(n,A.TEXTURE_MAG_FILTER,c),A.texParameteri(n,A.TEXTURE_WRAP_S,A.CLAMP_TO_EDGE),A.texParameteri(n,A.TEXTURE_WRAP_T,A.CLAMP_TO_EDGE)}}function y(A){return!0===A.auto||void 0===A.auto&&void 0===A.level}function k(A,B){return(B=B||{}).cubeFaceOrder||[A.TEXTURE_CUBE_MAP_POSITIVE_X,A.TEXTURE_CUBE_MAP_NEGATIVE_X,A.TEXTURE_CUBE_MAP_POSITIVE_Y,A.TEXTURE_CUBE_MAP_NEGATIVE_Y,A.TEXTURE_CUBE_MAP_POSITIVE_Z,A.TEXTURE_CUBE_MAP_NEGATIVE_Z]}function T(A,B){var t=k(A,B).map((function(A,B){return{face:A,ndx:B}}));return t.sort((function(A,B){return A.face-B.face})),t}function j(A,B,t,e){var g=(e=e||r.textureOptions).target||A.TEXTURE_2D,i=e.level||0,Q=t.width,n=t.height,c=e.internalFormat||e.format||A.RGBA,o=M(c),w=e.format||o.format,C=e.type||o.type;if(U(A,e),A.bindTexture(g,B),g===A.TEXTURE_CUBE_MAP){var a,I,Y=t.width,h=t.height;if(Y/6===h)a=h,I=[0,0,1,0,2,0,3,0,4,0,5,0];else if(h/6===Y)a=Y,I=[0,0,0,1,0,2,0,3,0,4,0,5];else if(Y/3==h/2)a=Y/3,I=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(Y/2!=h/3)throw"can't figure out cube map from element: "+(t.src?t.src:t.nodeName);a=Y/2,I=[0,0,1,0,0,1,1,1,0,2,1,2]}E?(E.canvas.width=a,E.canvas.height=a,Q=a,n=a,T(A,e).forEach((function(B){var e=I[2*B.ndx+0]*a,g=I[2*B.ndx+1]*a;E.drawImage(t,e,g,a,a,0,0,a,a),A.texImage2D(B.face,i,c,w,C,E.canvas)})),E.canvas.width=1,E.canvas.height=1):s.default.createImageBitmap&&(Q=a,n=a,T(A,e).forEach((function(r){var E=I[2*r.ndx+0]*a,o=I[2*r.ndx+1]*a;A.texImage2D(r.face,i,c,a,a,0,w,C,null),s.default.createImageBitmap(t,E,o,a,a,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(t){U(A,e),A.bindTexture(g,B),A.texImage2D(r.face,i,c,w,C,t),N(A,e),y(e)&&J(A,B,e,Q,n,c,C)}))})))}else if(g===A.TEXTURE_3D||g===A.TEXTURE_2D_ARRAY){var F=Math.min(t.width,t.height),D=Math.max(t.width,t.height),u=D/F;if(u%1!=0)throw"can not compute 3D dimensions of element";var l=t.width===D?1:0,d=t.height===D?1:0;m(A),A.pixelStorei(A.UNPACK_ALIGNMENT,1),A.pixelStorei(A.UNPACK_ROW_LENGTH,t.width),A.pixelStorei(A.UNPACK_IMAGE_HEIGHT,0),A.pixelStorei(A.UNPACK_SKIP_IMAGES,0),A.texImage3D(g,i,c,F,F,F,0,w,C,null);for(var f=0;f=0?h(e,B):t.indexOf("tan")>=0||t.indexOf("binorm")>=0?I(e,B):t.indexOf("norm")>=0&&Y(e,B)})),A}function F(A,B,t){return A=A||2,{position:{numComponents:2,data:[(B=B||0)+-1*(A*=.5),(t=t||0)+-1*A,B+1*A,t+-1*A,B+-1*A,t+1*A,B+1*A,t+1*A]},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 D(A,B,t,e,g){A=A||1,B=B||1,t=t||1,e=e||1,g=g||Q.identity();for(var i=(t+1)*(e+1),s=o(3,i),n=o(3,i),r=o(2,i),c=0;c<=e;c++)for(var E=0;E<=t;E++){var w=E/t,C=c/e;s.push(A*w-.5*A,0,B*C-.5*B),n.push(0,1,0),r.push(w,C)}for(var a=t+1,I=o(3,t*e*2,Uint16Array),Y=0;Y 0");e=e||0,i=i||0;for(var s=(g=g||Math.PI)-e,n=(Q=Q||2*Math.PI)-i,r=(B+1)*(t+1),c=o(3,r),E=o(3,r),w=o(2,r),C=0;C<=t;C++)for(var a=0;a<=B;a++){var I=a/B,Y=C/t,h=n*I,M=s*Y,F=Math.sin(h),D=Math.cos(h),u=Math.sin(M),l=D*u,d=Math.cos(M),U=F*u;c.push(A*l,A*d,A*U),E.push(l,d,U),w.push(1-I,Y)}for(var N=B+1,m=o(3,B*t*2,Uint16Array),G=0;Gg?(l=t,u=1,d=B):d=A+D/g*(B-A),-2!==D&&D!==g+2||(d=0,u=0),l-=t/2;for(var U=0;Ug?0:N*h,D<0?-1:D>g?1:M,D<0||D>g?0:m*h),C.push(U/e,1-u)}}for(var G=0;G 0");var n=(Q=Q||1)-(i=i||0),r=2*(g+1)*4,c=o(3,r),E=o(3,r),w=o(2,r);function C(A,B,t){return A+(B-A)*t}function a(B,t,Q,r,o,a){for(var I=0;I<=g;I++){var Y=t/1,h=I/g,M=2*(Y-.5),F=(i+h*n)*Math.PI,D=Math.sin(F),u=Math.cos(F),l=C(A,B,D),d=M*e,U=u*A,N=D*l;c.push(d,U,N);var m=s.add(s.multiply([0,D,u],Q),r);E.push(m),w.push(Y*o+a,h)}}for(var I=0;I<2;I++){var Y=2*(I/1-.5);a(B,I,[1,1,1],[0,0,0],1,0),a(B,I,[0,0,0],[Y,0,0],0,0),a(t,I,[1,1,1],[0,0,0],1,0),a(t,I,[0,0,0],[Y,0,0],0,1)}var h=o(3,2*g*4,Uint16Array);function M(A,B){for(var t=0;t0&&I!==B){var F=c+(I+1),D=c+I,u=c+I-w,l=c+(I+1)-w;r.push(F,D,u),r.push(F,u,l)}}c+=B+1}return{position:Q,normal:s,texcoord:n,indices:r}}function p(A){return function(B){var t=A.apply(this,Array.prototype.slice.call(arguments,1));return e.createBuffersFromArrays(B,t)}}function J(A){return function(B){var t=A.apply(null,Array.prototype.slice.call(arguments,1));return e.createBufferInfoFromArrays(B,t)}}var y=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function k(A,B,t,e){e=e||0;for(var g=A.length,i=0;i * @license MIT */ -var e=t(106),g=t(107),i=t(108);function Q(){return n.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function s(A,B){if(Q()=Q())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q().toString(16)+" bytes");return 0|A}function C(A,B){if(n.isBuffer(A))return A.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(A)||A instanceof ArrayBuffer))return A.byteLength;"string"!=typeof A&&(A=""+A);var t=A.length;if(0===t)return 0;for(var e=!1;;)switch(B){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return b(A).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return z(A).length;default:if(e)return b(A).length;B=(""+B).toLowerCase(),e=!0}}function a(A,B,t){var e=!1;if((void 0===B||B<0)&&(B=0),B>this.length)return"";if((void 0===t||t>this.length)&&(t=this.length),t<=0)return"";if((t>>>=0)<=(B>>>=0))return"";for(A||(A="utf8");;)switch(A){case"hex":return f(this,B,t);case"utf8":case"utf-8":return N(this,B,t);case"ascii":return m(this,B,t);case"latin1":case"binary":return G(this,B,t);case"base64":return U(this,B,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,B,t);default:if(e)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),e=!0}}function I(A,B,t){var e=A[B];A[B]=A[t],A[t]=e}function Y(A,B,t,e,g){if(0===A.length)return-1;if("string"==typeof t?(e=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=g?0:A.length-1),t<0&&(t=A.length+t),t>=A.length){if(g)return-1;t=A.length-1}else if(t<0){if(!g)return-1;t=0}if("string"==typeof B&&(B=n.from(B,e)),n.isBuffer(B))return 0===B.length?-1:h(A,B,t,e,g);if("number"==typeof B)return B&=255,n.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?g?Uint8Array.prototype.indexOf.call(A,B,t):Uint8Array.prototype.lastIndexOf.call(A,B,t):h(A,[B],t,e,g);throw new TypeError("val must be string, number or Buffer")}function h(A,B,t,e,g){var i,Q=1,s=A.length,n=B.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(A.length<2||B.length<2)return-1;Q=2,s/=2,n/=2,t/=2}function r(A,B){return 1===Q?A[B]:A.readUInt16BE(B*Q)}if(g){var E=-1;for(i=t;is&&(t=s-n),i=t;i>=0;i--){for(var c=!0,o=0;og&&(e=g):e=g;var i=B.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var Q=0;Q>8,g=t%256,i.push(g),i.push(e);return i}(B,A.length-t),A,t,e)}function U(A,B,t){return 0===B&&t===A.length?e.fromByteArray(A):e.fromByteArray(A.slice(B,t))}function N(A,B,t){t=Math.min(A.length,t);for(var e=[],g=B;g239?4:r>223?3:r>191?2:1;if(g+c<=t)switch(c){case 1:r<128&&(E=r);break;case 2:128==(192&(i=A[g+1]))&&(n=(31&r)<<6|63&i)>127&&(E=n);break;case 3:i=A[g+1],Q=A[g+2],128==(192&i)&&128==(192&Q)&&(n=(15&r)<<12|(63&i)<<6|63&Q)>2047&&(n<55296||n>57343)&&(E=n);break;case 4:i=A[g+1],Q=A[g+2],s=A[g+3],128==(192&i)&&128==(192&Q)&&128==(192&s)&&(n=(15&r)<<18|(63&i)<<12|(63&Q)<<6|63&s)>65535&&n<1114112&&(E=n)}null===E?(E=65533,c=1):E>65535&&(E-=65536,e.push(E>>>10&1023|55296),E=56320|1023&E),e.push(E),g+=c}return function(A){var B=A.length;if(B<=4096)return String.fromCharCode.apply(String,A);var t="",e=0;for(;e0&&(A=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(A+=" ... ")),""},n.prototype.compare=function(A,B,t,e,g){if(!n.isBuffer(A))throw new TypeError("Argument must be a Buffer");if(void 0===B&&(B=0),void 0===t&&(t=A?A.length:0),void 0===e&&(e=0),void 0===g&&(g=this.length),B<0||t>A.length||e<0||g>this.length)throw new RangeError("out of range index");if(e>=g&&B>=t)return 0;if(e>=g)return-1;if(B>=t)return 1;if(this===A)return 0;for(var i=(g>>>=0)-(e>>>=0),Q=(t>>>=0)-(B>>>=0),s=Math.min(i,Q),r=this.slice(e,g),E=A.slice(B,t),c=0;cg)&&(t=g),A.length>0&&(t<0||B<0)||B>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return M(this,A,B,t);case"utf8":case"utf-8":return F(this,A,B,t);case"ascii":return D(this,A,B,t);case"latin1":case"binary":return u(this,A,B,t);case"base64":return l(this,A,B,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d(this,A,B,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function m(A,B,t){var e="";t=Math.min(A.length,t);for(var g=B;ge)&&(t=e);for(var g="",i=B;it)throw new RangeError("Trying to access beyond buffer length")}function p(A,B,t,e,g,i){if(!n.isBuffer(A))throw new TypeError('"buffer" argument must be a Buffer instance');if(B>g||BA.length)throw new RangeError("Index out of range")}function J(A,B,t,e){B<0&&(B=65535+B+1);for(var g=0,i=Math.min(A.length-t,2);g>>8*(e?g:1-g)}function y(A,B,t,e){B<0&&(B=4294967295+B+1);for(var g=0,i=Math.min(A.length-t,4);g>>8*(e?g:3-g)&255}function k(A,B,t,e,g,i){if(t+e>A.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function T(A,B,t,e,i){return i||k(A,0,t,4),g.write(A,B,t,e,23,4),t+4}function j(A,B,t,e,i){return i||k(A,0,t,8),g.write(A,B,t,e,52,8),t+8}n.prototype.slice=function(A,B){var t,e=this.length;if((A=~~A)<0?(A+=e)<0&&(A=0):A>e&&(A=e),(B=void 0===B?e:~~B)<0?(B+=e)<0&&(B=0):B>e&&(B=e),B0&&(g*=256);)e+=this[A+--B]*g;return e},n.prototype.readUInt8=function(A,B){return B||R(A,1,this.length),this[A]},n.prototype.readUInt16LE=function(A,B){return B||R(A,2,this.length),this[A]|this[A+1]<<8},n.prototype.readUInt16BE=function(A,B){return B||R(A,2,this.length),this[A]<<8|this[A+1]},n.prototype.readUInt32LE=function(A,B){return B||R(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+16777216*this[A+3]},n.prototype.readUInt32BE=function(A,B){return B||R(A,4,this.length),16777216*this[A]+(this[A+1]<<16|this[A+2]<<8|this[A+3])},n.prototype.readIntLE=function(A,B,t){A|=0,B|=0,t||R(A,B,this.length);for(var e=this[A],g=1,i=0;++i=(g*=128)&&(e-=Math.pow(2,8*B)),e},n.prototype.readIntBE=function(A,B,t){A|=0,B|=0,t||R(A,B,this.length);for(var e=B,g=1,i=this[A+--e];e>0&&(g*=256);)i+=this[A+--e]*g;return i>=(g*=128)&&(i-=Math.pow(2,8*B)),i},n.prototype.readInt8=function(A,B){return B||R(A,1,this.length),128&this[A]?-1*(255-this[A]+1):this[A]},n.prototype.readInt16LE=function(A,B){B||R(A,2,this.length);var t=this[A]|this[A+1]<<8;return 32768&t?4294901760|t:t},n.prototype.readInt16BE=function(A,B){B||R(A,2,this.length);var t=this[A+1]|this[A]<<8;return 32768&t?4294901760|t:t},n.prototype.readInt32LE=function(A,B){return B||R(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},n.prototype.readInt32BE=function(A,B){return B||R(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},n.prototype.readFloatLE=function(A,B){return B||R(A,4,this.length),g.read(this,A,!0,23,4)},n.prototype.readFloatBE=function(A,B){return B||R(A,4,this.length),g.read(this,A,!1,23,4)},n.prototype.readDoubleLE=function(A,B){return B||R(A,8,this.length),g.read(this,A,!0,52,8)},n.prototype.readDoubleBE=function(A,B){return B||R(A,8,this.length),g.read(this,A,!1,52,8)},n.prototype.writeUIntLE=function(A,B,t,e){(A=+A,B|=0,t|=0,e)||p(this,A,B,t,Math.pow(2,8*t)-1,0);var g=1,i=0;for(this[B]=255&A;++i=0&&(i*=256);)this[B+g]=A/i&255;return B+t},n.prototype.writeUInt8=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,1,255,0),n.TYPED_ARRAY_SUPPORT||(A=Math.floor(A)),this[B]=255&A,B+1},n.prototype.writeUInt16LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[B]=255&A,this[B+1]=A>>>8):J(this,A,B,!0),B+2},n.prototype.writeUInt16BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>8,this[B+1]=255&A):J(this,A,B,!1),B+2},n.prototype.writeUInt32LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[B+3]=A>>>24,this[B+2]=A>>>16,this[B+1]=A>>>8,this[B]=255&A):y(this,A,B,!0),B+4},n.prototype.writeUInt32BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>24,this[B+1]=A>>>16,this[B+2]=A>>>8,this[B+3]=255&A):y(this,A,B,!1),B+4},n.prototype.writeIntLE=function(A,B,t,e){if(A=+A,B|=0,!e){var g=Math.pow(2,8*t-1);p(this,A,B,t,g-1,-g)}var i=0,Q=1,s=0;for(this[B]=255&A;++i>0)-s&255;return B+t},n.prototype.writeIntBE=function(A,B,t,e){if(A=+A,B|=0,!e){var g=Math.pow(2,8*t-1);p(this,A,B,t,g-1,-g)}var i=t-1,Q=1,s=0;for(this[B+i]=255&A;--i>=0&&(Q*=256);)A<0&&0===s&&0!==this[B+i+1]&&(s=1),this[B+i]=(A/Q>>0)-s&255;return B+t},n.prototype.writeInt8=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,1,127,-128),n.TYPED_ARRAY_SUPPORT||(A=Math.floor(A)),A<0&&(A=255+A+1),this[B]=255&A,B+1},n.prototype.writeInt16LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[B]=255&A,this[B+1]=A>>>8):J(this,A,B,!0),B+2},n.prototype.writeInt16BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>8,this[B+1]=255&A):J(this,A,B,!1),B+2},n.prototype.writeInt32LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,2147483647,-2147483648),n.TYPED_ARRAY_SUPPORT?(this[B]=255&A,this[B+1]=A>>>8,this[B+2]=A>>>16,this[B+3]=A>>>24):y(this,A,B,!0),B+4},n.prototype.writeInt32BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>24,this[B+1]=A>>>16,this[B+2]=A>>>8,this[B+3]=255&A):y(this,A,B,!1),B+4},n.prototype.writeFloatLE=function(A,B,t){return T(this,A,B,!0,t)},n.prototype.writeFloatBE=function(A,B,t){return T(this,A,B,!1,t)},n.prototype.writeDoubleLE=function(A,B,t){return j(this,A,B,!0,t)},n.prototype.writeDoubleBE=function(A,B,t){return j(this,A,B,!1,t)},n.prototype.copy=function(A,B,t,e){if(t||(t=0),e||0===e||(e=this.length),B>=A.length&&(B=A.length),B||(B=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),A.length-B=0;--g)A[g+B]=this[g+t];else if(i<1e3||!n.TYPED_ARRAY_SUPPORT)for(g=0;g>>=0,t=void 0===t?this.length:t>>>0,A||(A=0),"number"==typeof A)for(i=B;i55295&&t<57344){if(!g){if(t>56319){(B-=3)>-1&&i.push(239,191,189);continue}if(Q+1===e){(B-=3)>-1&&i.push(239,191,189);continue}g=t;continue}if(t<56320){(B-=3)>-1&&i.push(239,191,189),g=t;continue}t=65536+(g-55296<<10|t-56320)}else g&&(B-=3)>-1&&i.push(239,191,189);if(g=null,t<128){if((B-=1)<0)break;i.push(t)}else if(t<2048){if((B-=2)<0)break;i.push(t>>6|192,63&t|128)}else if(t<65536){if((B-=3)<0)break;i.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((B-=4)<0)break;i.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return i}function z(A){return e.toByteArray(function(A){if((A=function(A){return A.trim?A.trim():A.replace(/^\s+|\s+$/g,"")}(A).replace(x,"")).length<2)return"";for(;A.length%4!=0;)A+="=";return A}(A))}function L(A,B,t,e){for(var g=0;g=B.length||g>=A.length);++g)B[g+t]=A[g];return g}}).call(this,t(10))},function(A,B,t){function e(){}t(113).mixin(e),e.prototype.write=function(A,B,t){this.emit("item",A,B,t)},e.prototype.end=function(){this.emit("end"),this.removeAllListeners()},e.prototype.pipe=function(A){var B=this;function t(){A.write.apply(A,Array.prototype.slice.call(arguments))}function e(){!A._isStdio&&A.end()}return B.emit("unpipe",A),A.emit("pipe",B),B.on("item",t),B.on("end",e),B.when("unpipe",(function(g){var i=g===A||void 0===g;return i&&(B.removeListener("item",t),B.removeListener("end",e),A.emit("unpipe")),i})),A},e.prototype.unpipe=function(A){return this.emit("unpipe",A),this},e.prototype.format=function(A){throw new Error(["Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:","var Minilog = require('minilog');","Minilog"," .pipe(Minilog.backends.console.formatClean)"," .pipe(Minilog.backends.console);"].join("\n"))},e.mixin=function(A){var B,t=e.prototype;for(B in t)t.hasOwnProperty(B)&&(A.prototype[B]=t[B])},A.exports=e},function(A,B){A.exports=class{static simple(A){return JSON.parse(JSON.stringify(A))}}},function(A,B){class t{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[t.BACKGROUND_LAYER,t.VIDEO_LAYER,t.PEN_LAYER,t.SPRITE_LAYER]}}A.exports=t},function(A,B,t){(function(B){class t{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.nowObj;this.startTime=0,this.nowObj=A}static get USE_PERFORMANCE(){return!1}static get legacyDateCode(){return{now:function(){return(new Date).getTime()}}}static get nowObj(){return t.USE_PERFORMANCE&&"undefined"!=typeof self&&self.performance&&"now"in self.performance?self.performance:Date.now?Date:t.legacyDateCode}time(){return this.nowObj.now()}relativeTime(){return this.nowObj.now()}start(){this.startTime=this.nowObj.now()}timeElapsed(){return this.nowObj.now()-this.startTime}setTimeout(A,t){return B.setTimeout(A,t)}clearTimeout(A){B.clearTimeout(A)}}A.exports=t}).call(this,t(10))},function(A,B,t){const e=t(127),g=t(61),i=t(27),Q=t(38),s=t(13),{Map:n}=t(22),r=t(63),E=t(64),c=t(0),o=t(8),w=t(39);class C{constructor(A,B){this.runtime=A,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=B||!1}getCachedCompileResult(A){return this._cache.compiledScripts.hasOwnProperty(A)?this._cache.compiledScripts[A]:null}cacheCompileResult(A,B){this._cache.compiledScripts[A]={success:!0,value:B}}cacheCompileError(A,B){this._cache.compiledScripts[A]={success:!1,value:B}}static get BRANCH_INPUT_PREFIX(){return"SUBSTACK"}getBlock(A){return this._blocks[A]}getScripts(){return this._scripts}getNextBlock(A){const B=this._blocks[A];return void 0===B?null:B.next}getBranch(A,B){const t=this._blocks[A];if(void 0===t)return null;B||(B=1);let e=C.BRANCH_INPUT_PREFIX;B>1&&(e+=B);const g=t.inputs[e];return void 0===g?null:g.block}getOpcode(A){return void 0===A?null:A.opcode}getFields(A){return void 0===A?null:A.fields}getInputs(A){if(void 0===A)return null;let B=this._cache.inputs[A.id];if(void 0!==B)return B;B={};for(const t in A.inputs)t.substring(0,C.BRANCH_INPUT_PREFIX.length)!==C.BRANCH_INPUT_PREFIX&&(B[t]=A.inputs[t]);return this._cache.inputs[A.id]=B,B}getMutation(A){return void 0===A?null:A.mutation}getTopLevelScript(A){let B=this._blocks[A];if(void 0===B)return null;for(;null!==B.parent;)B=this._blocks[B.parent];return B.id}getProcedureDefinition(A){const B=this._cache.procedureDefinitions[A];if(void 0!==B)return B;for(const B in this._blocks){if(!this._blocks.hasOwnProperty(B))continue;const t=this._blocks[B];if("procedures_definition"===t.opcode){const e=this._getCustomBlockInternal(t);if(e&&e.mutation.proccode===A)return this._cache.procedureDefinitions[A]=B,B}}return this._cache.procedureDefinitions[A]=null,null}getProcedureParamNamesAndIds(A){return this.getProcedureParamNamesIdsAndDefaults(A).slice(0,2)}getProcedureParamNamesIdsAndDefaults(A){const B=this._cache.procedureParamNames[A];if(void 0!==B)return B;for(const B in this._blocks){if(!this._blocks.hasOwnProperty(B))continue;const t=this._blocks[B];if("procedures_prototype"===t.opcode&&t.mutation.proccode===A){const B=JSON.parse(t.mutation.argumentnames),e=JSON.parse(t.mutation.argumentids),g=JSON.parse(t.mutation.argumentdefaults);return this._cache.procedureParamNames[A]=[B,e,g],this._cache.procedureParamNames[A]}}const t=this.runtime.getAddonBlock(A);return t?(this._cache.procedureParamNames[A]=t.namesIdsDefaults,t.namesIdsDefaults):(this._cache.procedureParamNames[A]=null,null)}populateProcedureCache(){if(!this._cache.proceduresPopulated){for(const A in this._blocks){if(!this._blocks.hasOwnProperty(A))continue;const B=this._blocks[A];if("procedures_prototype"!==B.opcode){if("procedures_definition"===B.opcode){const t=this._getCustomBlockInternal(B);if(t){const B=t.mutation.proccode;this._cache.procedureDefinitions[B]||(this._cache.procedureDefinitions[B]=A);continue}}}else{const A=B.mutation.proccode;if(!this._cache.procedureParamNames[A]){const t=JSON.parse(B.mutation.argumentnames),e=JSON.parse(B.mutation.argumentids),g=JSON.parse(B.mutation.argumentdefaults);this._cache.procedureParamNames[A]=[t,e,g]}}}this._cache.proceduresPopulated=!0}}duplicate(){const A=new C(this.runtime,this.forceNoGlow);return A._blocks=s.simple(this._blocks),A._scripts=s.simple(this._scripts),A}blocklyListen(A){if("object"!=typeof A)return;if("string"!=typeof A.blockId&&"string"!=typeof A.varId&&"string"!=typeof A.commentId)return;const B=this.runtime.getTargetForStage(),t=this.runtime.getEditingTarget();if("stackclick"!==A.element)switch(A.type){case"create":{const B=e(A);for(let A=0;AA.isOriginal);for(const B of t)if(B.lookupVariableByNameAndType(A.varName,A.varType,!0))return;B.createVariable(A.varId,A.varName,A.varType,A.isCloud),this.emitProjectChanged()}break;case"var_rename":if(t&&t.variables.hasOwnProperty(A.varId))t.renameVariable(A.varId,A.newName),t.blocks.updateBlocksAfterVarRename(A.varId,A.newName);else{B.renameVariable(A.varId,A.newName);const t=this.runtime.targets;for(let B=0;B0&&"data_variable"!==B.opcode&&"data_listcontents"!==B.opcode){const A=w(B.id,B.fields);let t=this.runtime.monitorBlocks.getBlock(A);t||(t=JSON.parse(JSON.stringify(B)),t.id=A,this.runtime.monitorBlocks.createBlock(t)),B=t}const t=B.isMonitored;B.isMonitored=A.value;let e=!1;"data_variable"===B.opcode?e=!this.runtime.getTargetForStage().variables[B.fields.VARIABLE.id]:"data_listcontents"===B.opcode&&(e=!this.runtime.getTargetForStage().variables[B.fields.LIST.id]);const g=e||this.runtime.monitorBlockInfo.hasOwnProperty(B.opcode)&&this.runtime.monitorBlockInfo[B.opcode].isSpriteSpecific;B.targetId=g?B.targetId||this.runtime.getEditingTarget().id:null,t&&!B.isMonitored?this.runtime.requestHideMonitor(B.id):!t&&B.isMonitored&&(this.runtime.requestShowMonitor(B.id)||this.runtime.requestAddMonitor(Q({id:B.id,targetId:B.targetId,spriteName:B.targetId?this.runtime.getTargetById(B.targetId).getName():null,opcode:B.opcode,params:this._getBlockParams(B),value:"",mode:"data_listcontents"===B.opcode?"list":"default"})));break}}this.emitProjectChanged(),this.resetCache()}}moveBlock(A){if(!this._blocks.hasOwnProperty(A.id))return;const B=this._blocks[A.id];let t=!1;if(A.newCoordinate&&(t=B.x!==A.newCoordinate.x||B.y!==A.newCoordinate.y,B.x=A.newCoordinate.x,B.y=A.newCoordinate.y),void 0!==A.oldParent){const B=this._blocks[A.oldParent];void 0!==A.oldInput&&B.inputs[A.oldInput].block===A.id?B.inputs[A.oldInput].block=null:B.next===A.id&&(B.next=null),this._blocks[A.id].parent=null,t=!0}if(void 0===A.newParent)this._addScript(A.id);else{if(this._deleteScript(A.id),void 0===A.newInput)this._blocks[A.newParent].next=A.id;else{let B=null;this._blocks[A.newParent].inputs.hasOwnProperty(A.newInput)&&(B=this._blocks[A.newParent].inputs[A.newInput].shadow),this._blocks[A.id].shadow&&(B=A.id),this._blocks[A.newParent].inputs[A.newInput]={name:A.newInput,block:A.id,shadow:B}}this._blocks[A.id].parent=A.newParent,t=!0}this.resetCache(),t&&this.emitProjectChanged()}runAllMonitored(A){null===this._cache._monitored&&(this._cache._monitored=Object.keys(this._blocks).filter(A=>this.getBlock(A).isMonitored).map(B=>{const t=this.getBlock(B).targetId;return{blockId:B,target:t?A.getTargetById(t):null}}));const B=this._cache._monitored;for(let t=0;tthis.blockToXML(B,A)).join()}blockToXML(A,B){const t=this._blocks[A];if(!t)return;const e=t.shadow?"shadow":"block";let g="<".concat(e,'\n id="').concat(t.id,'"\n type="').concat(t.opcode,'"\n ').concat(t.topLevel?'x="'.concat(t.x,'" y="').concat(t.y,'"'):"","\n >");const Q=t.comment;Q&&(B?B.hasOwnProperty(Q)?g+=B[Q].toXML():c.warn("Could not find comment with id: ".concat(Q," in provided comment descriptions.")):c.warn("Cannot serialize comment with id: ".concat(Q,"; no comment descriptions provided."))),t.mutation&&(g+=this.mutationToXML(t.mutation));for(const A in t.inputs){if(!t.inputs.hasOwnProperty(A))continue;const e=t.inputs[A];(e.block||e.shadow)&&(g+=''),e.block&&(g+=this.blockToXML(e.block,B)),e.shadow&&e.shadow!==e.block&&(g+=this.blockToXML(e.shadow,B)),g+="")}for(const A in t.fields){if(!t.fields.hasOwnProperty(A))continue;const B=t.fields[A];g+='".concat(s,"")}return t.next&&(g+="".concat(this.blockToXML(t.next,B),"")),g+=""),g}mutationToXML(A){let B="<".concat(A.tagName);for(const t in A){if("children"===t||"tagName"===t)continue;let e="string"==typeof A[t]?i(A[t]):A[t];"blockInfo"===t&&(e=i(JSON.stringify(A[t]))),B+=" ".concat(t,'="').concat(e,'"')}B+=">";for(let t=0;t"),B}_getBlockParams(A){const B={};for(const t in A.fields)B[t]=A.fields[t].value;for(const t in A.inputs){const e=this._blocks[A.inputs[t].block];for(const A in e.fields)B[A]=e.fields[A].value}return B}_getCustomBlockInternal(A){if(A.inputs&&A.inputs.custom_block)return this._blocks[A.inputs.custom_block.block]}_addScript(A){this._scripts.indexOf(A)>-1||(this._scripts.push(A),this._blocks[A].topLevel=!0)}_deleteScript(A){const B=this._scripts.indexOf(A);B>-1&&this._scripts.splice(B,1),this._blocks[A]&&(this._blocks[A].topLevel=!1)}}r.getCached=function(A,B,t){let e=A._cache._executeCached[B];if(void 0!==e)return e;const g=A.getBlock(B);return void 0===g?null:(e=void 0===t?{id:B,opcode:A.getOpcode(g),fields:A.getFields(g),inputs:A.getInputs(g),mutation:A.getMutation(g)}:new t(A,{id:B,opcode:A.getOpcode(g),fields:A.getFields(g),inputs:A.getInputs(g),mutation:A.getMutation(g)}),A._cache._executeCached[B]=e,e)};const a=E._RuntimeScriptCache;E.getScripts=function(A,B){let t=A._cache.scripts[B];if(!t){t=A._cache.scripts[B]=[];const e=A._scripts;for(let g=0;g=Q())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q().toString(16)+" bytes");return 0|A}function C(A,B){if(n.isBuffer(A))return A.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(A)||A instanceof ArrayBuffer))return A.byteLength;"string"!=typeof A&&(A=""+A);var t=A.length;if(0===t)return 0;for(var e=!1;;)switch(B){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":case void 0:return b(A).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*t;case"hex":return t>>>1;case"base64":return z(A).length;default:if(e)return b(A).length;B=(""+B).toLowerCase(),e=!0}}function a(A,B,t){var e=!1;if((void 0===B||B<0)&&(B=0),B>this.length)return"";if((void 0===t||t>this.length)&&(t=this.length),t<=0)return"";if((t>>>=0)<=(B>>>=0))return"";for(A||(A="utf8");;)switch(A){case"hex":return f(this,B,t);case"utf8":case"utf-8":return N(this,B,t);case"ascii":return m(this,B,t);case"latin1":case"binary":return G(this,B,t);case"base64":return U(this,B,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,B,t);default:if(e)throw new TypeError("Unknown encoding: "+A);A=(A+"").toLowerCase(),e=!0}}function I(A,B,t){var e=A[B];A[B]=A[t],A[t]=e}function Y(A,B,t,e,g){if(0===A.length)return-1;if("string"==typeof t?(e=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,isNaN(t)&&(t=g?0:A.length-1),t<0&&(t=A.length+t),t>=A.length){if(g)return-1;t=A.length-1}else if(t<0){if(!g)return-1;t=0}if("string"==typeof B&&(B=n.from(B,e)),n.isBuffer(B))return 0===B.length?-1:h(A,B,t,e,g);if("number"==typeof B)return B&=255,n.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?g?Uint8Array.prototype.indexOf.call(A,B,t):Uint8Array.prototype.lastIndexOf.call(A,B,t):h(A,[B],t,e,g);throw new TypeError("val must be string, number or Buffer")}function h(A,B,t,e,g){var i,Q=1,s=A.length,n=B.length;if(void 0!==e&&("ucs2"===(e=String(e).toLowerCase())||"ucs-2"===e||"utf16le"===e||"utf-16le"===e)){if(A.length<2||B.length<2)return-1;Q=2,s/=2,n/=2,t/=2}function r(A,B){return 1===Q?A[B]:A.readUInt16BE(B*Q)}if(g){var c=-1;for(i=t;is&&(t=s-n),i=t;i>=0;i--){for(var E=!0,o=0;og&&(e=g):e=g;var i=B.length;if(i%2!=0)throw new TypeError("Invalid hex string");e>i/2&&(e=i/2);for(var Q=0;Q>8,g=t%256,i.push(g),i.push(e);return i}(B,A.length-t),A,t,e)}function U(A,B,t){return 0===B&&t===A.length?e.fromByteArray(A):e.fromByteArray(A.slice(B,t))}function N(A,B,t){t=Math.min(A.length,t);for(var e=[],g=B;g239?4:r>223?3:r>191?2:1;if(g+E<=t)switch(E){case 1:r<128&&(c=r);break;case 2:128==(192&(i=A[g+1]))&&(n=(31&r)<<6|63&i)>127&&(c=n);break;case 3:i=A[g+1],Q=A[g+2],128==(192&i)&&128==(192&Q)&&(n=(15&r)<<12|(63&i)<<6|63&Q)>2047&&(n<55296||n>57343)&&(c=n);break;case 4:i=A[g+1],Q=A[g+2],s=A[g+3],128==(192&i)&&128==(192&Q)&&128==(192&s)&&(n=(15&r)<<18|(63&i)<<12|(63&Q)<<6|63&s)>65535&&n<1114112&&(c=n)}null===c?(c=65533,E=1):c>65535&&(c-=65536,e.push(c>>>10&1023|55296),c=56320|1023&c),e.push(c),g+=E}return function(A){var B=A.length;if(B<=4096)return String.fromCharCode.apply(String,A);var t="",e=0;for(;e0&&(A=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(A+=" ... ")),""},n.prototype.compare=function(A,B,t,e,g){if(!n.isBuffer(A))throw new TypeError("Argument must be a Buffer");if(void 0===B&&(B=0),void 0===t&&(t=A?A.length:0),void 0===e&&(e=0),void 0===g&&(g=this.length),B<0||t>A.length||e<0||g>this.length)throw new RangeError("out of range index");if(e>=g&&B>=t)return 0;if(e>=g)return-1;if(B>=t)return 1;if(this===A)return 0;for(var i=(g>>>=0)-(e>>>=0),Q=(t>>>=0)-(B>>>=0),s=Math.min(i,Q),r=this.slice(e,g),c=A.slice(B,t),E=0;Eg)&&(t=g),A.length>0&&(t<0||B<0)||B>this.length)throw new RangeError("Attempt to write outside buffer bounds");e||(e="utf8");for(var i=!1;;)switch(e){case"hex":return M(this,A,B,t);case"utf8":case"utf-8":return F(this,A,B,t);case"ascii":return D(this,A,B,t);case"latin1":case"binary":return u(this,A,B,t);case"base64":return l(this,A,B,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d(this,A,B,t);default:if(i)throw new TypeError("Unknown encoding: "+e);e=(""+e).toLowerCase(),i=!0}},n.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function m(A,B,t){var e="";t=Math.min(A.length,t);for(var g=B;ge)&&(t=e);for(var g="",i=B;it)throw new RangeError("Trying to access beyond buffer length")}function p(A,B,t,e,g,i){if(!n.isBuffer(A))throw new TypeError('"buffer" argument must be a Buffer instance');if(B>g||BA.length)throw new RangeError("Index out of range")}function J(A,B,t,e){B<0&&(B=65535+B+1);for(var g=0,i=Math.min(A.length-t,2);g>>8*(e?g:1-g)}function y(A,B,t,e){B<0&&(B=4294967295+B+1);for(var g=0,i=Math.min(A.length-t,4);g>>8*(e?g:3-g)&255}function k(A,B,t,e,g,i){if(t+e>A.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function T(A,B,t,e,i){return i||k(A,0,t,4),g.write(A,B,t,e,23,4),t+4}function j(A,B,t,e,i){return i||k(A,0,t,8),g.write(A,B,t,e,52,8),t+8}n.prototype.slice=function(A,B){var t,e=this.length;if((A=~~A)<0?(A+=e)<0&&(A=0):A>e&&(A=e),(B=void 0===B?e:~~B)<0?(B+=e)<0&&(B=0):B>e&&(B=e),B0&&(g*=256);)e+=this[A+--B]*g;return e},n.prototype.readUInt8=function(A,B){return B||R(A,1,this.length),this[A]},n.prototype.readUInt16LE=function(A,B){return B||R(A,2,this.length),this[A]|this[A+1]<<8},n.prototype.readUInt16BE=function(A,B){return B||R(A,2,this.length),this[A]<<8|this[A+1]},n.prototype.readUInt32LE=function(A,B){return B||R(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+16777216*this[A+3]},n.prototype.readUInt32BE=function(A,B){return B||R(A,4,this.length),16777216*this[A]+(this[A+1]<<16|this[A+2]<<8|this[A+3])},n.prototype.readIntLE=function(A,B,t){A|=0,B|=0,t||R(A,B,this.length);for(var e=this[A],g=1,i=0;++i=(g*=128)&&(e-=Math.pow(2,8*B)),e},n.prototype.readIntBE=function(A,B,t){A|=0,B|=0,t||R(A,B,this.length);for(var e=B,g=1,i=this[A+--e];e>0&&(g*=256);)i+=this[A+--e]*g;return i>=(g*=128)&&(i-=Math.pow(2,8*B)),i},n.prototype.readInt8=function(A,B){return B||R(A,1,this.length),128&this[A]?-1*(255-this[A]+1):this[A]},n.prototype.readInt16LE=function(A,B){B||R(A,2,this.length);var t=this[A]|this[A+1]<<8;return 32768&t?4294901760|t:t},n.prototype.readInt16BE=function(A,B){B||R(A,2,this.length);var t=this[A+1]|this[A]<<8;return 32768&t?4294901760|t:t},n.prototype.readInt32LE=function(A,B){return B||R(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},n.prototype.readInt32BE=function(A,B){return B||R(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},n.prototype.readFloatLE=function(A,B){return B||R(A,4,this.length),g.read(this,A,!0,23,4)},n.prototype.readFloatBE=function(A,B){return B||R(A,4,this.length),g.read(this,A,!1,23,4)},n.prototype.readDoubleLE=function(A,B){return B||R(A,8,this.length),g.read(this,A,!0,52,8)},n.prototype.readDoubleBE=function(A,B){return B||R(A,8,this.length),g.read(this,A,!1,52,8)},n.prototype.writeUIntLE=function(A,B,t,e){(A=+A,B|=0,t|=0,e)||p(this,A,B,t,Math.pow(2,8*t)-1,0);var g=1,i=0;for(this[B]=255&A;++i=0&&(i*=256);)this[B+g]=A/i&255;return B+t},n.prototype.writeUInt8=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,1,255,0),n.TYPED_ARRAY_SUPPORT||(A=Math.floor(A)),this[B]=255&A,B+1},n.prototype.writeUInt16LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[B]=255&A,this[B+1]=A>>>8):J(this,A,B,!0),B+2},n.prototype.writeUInt16BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,65535,0),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>8,this[B+1]=255&A):J(this,A,B,!1),B+2},n.prototype.writeUInt32LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[B+3]=A>>>24,this[B+2]=A>>>16,this[B+1]=A>>>8,this[B]=255&A):y(this,A,B,!0),B+4},n.prototype.writeUInt32BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,4294967295,0),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>24,this[B+1]=A>>>16,this[B+2]=A>>>8,this[B+3]=255&A):y(this,A,B,!1),B+4},n.prototype.writeIntLE=function(A,B,t,e){if(A=+A,B|=0,!e){var g=Math.pow(2,8*t-1);p(this,A,B,t,g-1,-g)}var i=0,Q=1,s=0;for(this[B]=255&A;++i>0)-s&255;return B+t},n.prototype.writeIntBE=function(A,B,t,e){if(A=+A,B|=0,!e){var g=Math.pow(2,8*t-1);p(this,A,B,t,g-1,-g)}var i=t-1,Q=1,s=0;for(this[B+i]=255&A;--i>=0&&(Q*=256);)A<0&&0===s&&0!==this[B+i+1]&&(s=1),this[B+i]=(A/Q>>0)-s&255;return B+t},n.prototype.writeInt8=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,1,127,-128),n.TYPED_ARRAY_SUPPORT||(A=Math.floor(A)),A<0&&(A=255+A+1),this[B]=255&A,B+1},n.prototype.writeInt16LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[B]=255&A,this[B+1]=A>>>8):J(this,A,B,!0),B+2},n.prototype.writeInt16BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,2,32767,-32768),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>8,this[B+1]=255&A):J(this,A,B,!1),B+2},n.prototype.writeInt32LE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,2147483647,-2147483648),n.TYPED_ARRAY_SUPPORT?(this[B]=255&A,this[B+1]=A>>>8,this[B+2]=A>>>16,this[B+3]=A>>>24):y(this,A,B,!0),B+4},n.prototype.writeInt32BE=function(A,B,t){return A=+A,B|=0,t||p(this,A,B,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),n.TYPED_ARRAY_SUPPORT?(this[B]=A>>>24,this[B+1]=A>>>16,this[B+2]=A>>>8,this[B+3]=255&A):y(this,A,B,!1),B+4},n.prototype.writeFloatLE=function(A,B,t){return T(this,A,B,!0,t)},n.prototype.writeFloatBE=function(A,B,t){return T(this,A,B,!1,t)},n.prototype.writeDoubleLE=function(A,B,t){return j(this,A,B,!0,t)},n.prototype.writeDoubleBE=function(A,B,t){return j(this,A,B,!1,t)},n.prototype.copy=function(A,B,t,e){if(t||(t=0),e||0===e||(e=this.length),B>=A.length&&(B=A.length),B||(B=0),e>0&&e=this.length)throw new RangeError("sourceStart out of bounds");if(e<0)throw new RangeError("sourceEnd out of bounds");e>this.length&&(e=this.length),A.length-B=0;--g)A[g+B]=this[g+t];else if(i<1e3||!n.TYPED_ARRAY_SUPPORT)for(g=0;g>>=0,t=void 0===t?this.length:t>>>0,A||(A=0),"number"==typeof A)for(i=B;i55295&&t<57344){if(!g){if(t>56319){(B-=3)>-1&&i.push(239,191,189);continue}if(Q+1===e){(B-=3)>-1&&i.push(239,191,189);continue}g=t;continue}if(t<56320){(B-=3)>-1&&i.push(239,191,189),g=t;continue}t=65536+(g-55296<<10|t-56320)}else g&&(B-=3)>-1&&i.push(239,191,189);if(g=null,t<128){if((B-=1)<0)break;i.push(t)}else if(t<2048){if((B-=2)<0)break;i.push(t>>6|192,63&t|128)}else if(t<65536){if((B-=3)<0)break;i.push(t>>12|224,t>>6&63|128,63&t|128)}else{if(!(t<1114112))throw new Error("Invalid code point");if((B-=4)<0)break;i.push(t>>18|240,t>>12&63|128,t>>6&63|128,63&t|128)}}return i}function z(A){return e.toByteArray(function(A){if((A=function(A){return A.trim?A.trim():A.replace(/^\s+|\s+$/g,"")}(A).replace(x,"")).length<2)return"";for(;A.length%4!=0;)A+="=";return A}(A))}function L(A,B,t,e){for(var g=0;g=B.length||g>=A.length);++g)B[g+t]=A[g];return g}}).call(this,t(10))},function(A,B,t){function e(){}t(114).mixin(e),e.prototype.write=function(A,B,t){this.emit("item",A,B,t)},e.prototype.end=function(){this.emit("end"),this.removeAllListeners()},e.prototype.pipe=function(A){var B=this;function t(){A.write.apply(A,Array.prototype.slice.call(arguments))}function e(){!A._isStdio&&A.end()}return B.emit("unpipe",A),A.emit("pipe",B),B.on("item",t),B.on("end",e),B.when("unpipe",(function(g){var i=g===A||void 0===g;return i&&(B.removeListener("item",t),B.removeListener("end",e),A.emit("unpipe")),i})),A},e.prototype.unpipe=function(A){return this.emit("unpipe",A),this},e.prototype.format=function(A){throw new Error(["Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:","var Minilog = require('minilog');","Minilog"," .pipe(Minilog.backends.console.formatClean)"," .pipe(Minilog.backends.console);"].join("\n"))},e.mixin=function(A){var B,t=e.prototype;for(B in t)t.hasOwnProperty(B)&&(A.prototype[B]=t[B])},A.exports=e},function(A,B){A.exports=class{static simple(A){return JSON.parse(JSON.stringify(A))}}},function(A,B){class t{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[t.BACKGROUND_LAYER,t.VIDEO_LAYER,t.PEN_LAYER,t.SPRITE_LAYER]}}A.exports=t},function(A,B,t){(function(B){class t{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:t.nowObj;this.startTime=0,this.nowObj=A}static get USE_PERFORMANCE(){return!1}static get legacyDateCode(){return{now:function(){return(new Date).getTime()}}}static get nowObj(){return t.USE_PERFORMANCE&&"undefined"!=typeof self&&self.performance&&"now"in self.performance?self.performance:Date.now?Date:t.legacyDateCode}time(){return this.nowObj.now()}relativeTime(){return this.nowObj.now()}start(){this.startTime=this.nowObj.now()}timeElapsed(){return this.nowObj.now()-this.startTime}setTimeout(A,t){return B.setTimeout(A,t)}clearTimeout(A){B.clearTimeout(A)}}A.exports=t}).call(this,t(10))},function(A,B,t){const e=t(128),g=t(61),i=t(28),Q=t(38),s=t(13),{Map:n}=t(24),r=t(63),c=t(64),E=t(0),o=t(8),w=t(39);class C{constructor(A,B){this.runtime=A,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=B||!1}getCachedCompileResult(A){return this._cache.compiledScripts.hasOwnProperty(A)?this._cache.compiledScripts[A]:null}cacheCompileResult(A,B){this._cache.compiledScripts[A]={success:!0,value:B}}cacheCompileError(A,B){this._cache.compiledScripts[A]={success:!1,value:B}}static get BRANCH_INPUT_PREFIX(){return"SUBSTACK"}getBlock(A){return this._blocks[A]}getScripts(){return this._scripts}getNextBlock(A){const B=this._blocks[A];return void 0===B?null:B.next}getBranch(A,B){const t=this._blocks[A];if(void 0===t)return null;B||(B=1);let e=C.BRANCH_INPUT_PREFIX;B>1&&(e+=B);const g=t.inputs[e];return void 0===g?null:g.block}getOpcode(A){return void 0===A?null:A.opcode}getFields(A){return void 0===A?null:A.fields}getInputs(A){if(void 0===A)return null;let B=this._cache.inputs[A.id];if(void 0!==B)return B;B={};for(const t in A.inputs)t.substring(0,C.BRANCH_INPUT_PREFIX.length)!==C.BRANCH_INPUT_PREFIX&&(B[t]=A.inputs[t]);return this._cache.inputs[A.id]=B,B}getMutation(A){return void 0===A?null:A.mutation}getTopLevelScript(A){let B=this._blocks[A];if(void 0===B)return null;for(;null!==B.parent;)B=this._blocks[B.parent];return B.id}getProcedureDefinition(A){const B=this._cache.procedureDefinitions[A];if(void 0!==B)return B;for(const B in this._blocks){if(!this._blocks.hasOwnProperty(B))continue;const t=this._blocks[B];if("procedures_definition"===t.opcode){const e=this._getCustomBlockInternal(t);if(e&&e.mutation.proccode===A)return this._cache.procedureDefinitions[A]=B,B}}return this._cache.procedureDefinitions[A]=null,null}getProcedureParamNamesAndIds(A){return this.getProcedureParamNamesIdsAndDefaults(A).slice(0,2)}getProcedureParamNamesIdsAndDefaults(A){const B=this._cache.procedureParamNames[A];if(void 0!==B)return B;for(const B in this._blocks){if(!this._blocks.hasOwnProperty(B))continue;const t=this._blocks[B];if("procedures_prototype"===t.opcode&&t.mutation.proccode===A){const B=JSON.parse(t.mutation.argumentnames),e=JSON.parse(t.mutation.argumentids),g=JSON.parse(t.mutation.argumentdefaults);return this._cache.procedureParamNames[A]=[B,e,g],this._cache.procedureParamNames[A]}}const t=this.runtime.getAddonBlock(A);return t?(this._cache.procedureParamNames[A]=t.namesIdsDefaults,t.namesIdsDefaults):(this._cache.procedureParamNames[A]=null,null)}populateProcedureCache(){if(!this._cache.proceduresPopulated){for(const A in this._blocks){if(!this._blocks.hasOwnProperty(A))continue;const B=this._blocks[A];if("procedures_prototype"!==B.opcode){if("procedures_definition"===B.opcode){const t=this._getCustomBlockInternal(B);if(t){const B=t.mutation.proccode;this._cache.procedureDefinitions[B]||(this._cache.procedureDefinitions[B]=A);continue}}}else{const A=B.mutation.proccode;if(!this._cache.procedureParamNames[A]){const t=JSON.parse(B.mutation.argumentnames),e=JSON.parse(B.mutation.argumentids),g=JSON.parse(B.mutation.argumentdefaults);this._cache.procedureParamNames[A]=[t,e,g]}}}this._cache.proceduresPopulated=!0}}duplicate(){const A=new C(this.runtime,this.forceNoGlow);return A._blocks=s.simple(this._blocks),A._scripts=s.simple(this._scripts),A}blocklyListen(A){if("object"!=typeof A)return;if("string"!=typeof A.blockId&&"string"!=typeof A.varId&&"string"!=typeof A.commentId)return;const B=this.runtime.getTargetForStage(),t=this.runtime.getEditingTarget();if("stackclick"!==A.element)switch(A.type){case"create":{const B=e(A);for(let A=0;AA.isOriginal);for(const B of t)if(B.lookupVariableByNameAndType(A.varName,A.varType,!0))return;B.createVariable(A.varId,A.varName,A.varType,A.isCloud),this.emitProjectChanged()}break;case"var_rename":if(t&&t.variables.hasOwnProperty(A.varId))t.renameVariable(A.varId,A.newName),t.blocks.updateBlocksAfterVarRename(A.varId,A.newName);else{B.renameVariable(A.varId,A.newName);const t=this.runtime.targets;for(let B=0;B0&&"data_variable"!==B.opcode&&"data_listcontents"!==B.opcode){const A=w(B.id,B.fields);let t=this.runtime.monitorBlocks.getBlock(A);t||(t=JSON.parse(JSON.stringify(B)),t.id=A,this.runtime.monitorBlocks.createBlock(t)),B=t}const t=B.isMonitored;B.isMonitored=A.value;let e=!1;"data_variable"===B.opcode?e=!this.runtime.getTargetForStage().variables[B.fields.VARIABLE.id]:"data_listcontents"===B.opcode&&(e=!this.runtime.getTargetForStage().variables[B.fields.LIST.id]);const g=e||this.runtime.monitorBlockInfo.hasOwnProperty(B.opcode)&&this.runtime.monitorBlockInfo[B.opcode].isSpriteSpecific;B.targetId=g?B.targetId||this.runtime.getEditingTarget().id:null,t&&!B.isMonitored?this.runtime.requestHideMonitor(B.id):!t&&B.isMonitored&&(this.runtime.requestShowMonitor(B.id)||this.runtime.requestAddMonitor(Q({id:B.id,targetId:B.targetId,spriteName:B.targetId?this.runtime.getTargetById(B.targetId).getName():null,opcode:B.opcode,params:this._getBlockParams(B),value:"",mode:"data_listcontents"===B.opcode?"list":"default"})));break}}this.emitProjectChanged(),this.resetCache()}}moveBlock(A){if(!this._blocks.hasOwnProperty(A.id))return;const B=this._blocks[A.id];let t=!1;if(A.newCoordinate&&(t=B.x!==A.newCoordinate.x||B.y!==A.newCoordinate.y,B.x=A.newCoordinate.x,B.y=A.newCoordinate.y),void 0!==A.oldParent){const B=this._blocks[A.oldParent];void 0!==A.oldInput&&B.inputs[A.oldInput].block===A.id?B.inputs[A.oldInput].block=null:B.next===A.id&&(B.next=null),this._blocks[A.id].parent=null,t=!0}if(void 0===A.newParent)this._addScript(A.id);else{if(this._deleteScript(A.id),void 0===A.newInput)this._blocks[A.newParent].next=A.id;else{let B=null;this._blocks[A.newParent].inputs.hasOwnProperty(A.newInput)&&(B=this._blocks[A.newParent].inputs[A.newInput].shadow),this._blocks[A.id].shadow&&(B=A.id),this._blocks[A.newParent].inputs[A.newInput]={name:A.newInput,block:A.id,shadow:B}}this._blocks[A.id].parent=A.newParent,t=!0}this.resetCache(),t&&this.emitProjectChanged()}runAllMonitored(A){null===this._cache._monitored&&(this._cache._monitored=Object.keys(this._blocks).filter(A=>this.getBlock(A).isMonitored).map(B=>{const t=this.getBlock(B).targetId;return{blockId:B,target:t?A.getTargetById(t):null}}));const B=this._cache._monitored;for(let t=0;tthis.blockToXML(B,A)).join()}blockToXML(A,B){const t=this._blocks[A];if(!t)return;const e=t.shadow?"shadow":"block";let g="<".concat(e,'\n id="').concat(t.id,'"\n type="').concat(t.opcode,'"\n ').concat(t.topLevel?'x="'.concat(t.x,'" y="').concat(t.y,'"'):"","\n >");const Q=t.comment;Q&&(B?B.hasOwnProperty(Q)?g+=B[Q].toXML():E.warn("Could not find comment with id: ".concat(Q," in provided comment descriptions.")):E.warn("Cannot serialize comment with id: ".concat(Q,"; no comment descriptions provided."))),t.mutation&&(g+=this.mutationToXML(t.mutation));for(const A in t.inputs){if(!t.inputs.hasOwnProperty(A))continue;const e=t.inputs[A];(e.block||e.shadow)&&(g+=''),e.block&&(g+=this.blockToXML(e.block,B)),e.shadow&&e.shadow!==e.block&&(g+=this.blockToXML(e.shadow,B)),g+="")}for(const A in t.fields){if(!t.fields.hasOwnProperty(A))continue;const B=t.fields[A];g+='".concat(s,"")}return t.next&&(g+="".concat(this.blockToXML(t.next,B),"")),g+=""),g}mutationToXML(A){let B="<".concat(A.tagName);for(const t in A){if("children"===t||"tagName"===t)continue;let e="string"==typeof A[t]?i(A[t]):A[t];"blockInfo"===t&&(e=i(JSON.stringify(A[t]))),B+=" ".concat(t,'="').concat(e,'"')}B+=">";for(let t=0;t"),B}_getBlockParams(A){const B={};for(const t in A.fields)B[t]=A.fields[t].value;for(const t in A.inputs){const e=this._blocks[A.inputs[t].block];for(const A in e.fields)B[A]=e.fields[A].value}return B}_getCustomBlockInternal(A){if(A.inputs&&A.inputs.custom_block)return this._blocks[A.inputs.custom_block.block]}_addScript(A){this._scripts.indexOf(A)>-1||(this._scripts.push(A),this._blocks[A].topLevel=!0)}_deleteScript(A){const B=this._scripts.indexOf(A);B>-1&&this._scripts.splice(B,1),this._blocks[A]&&(this._blocks[A].topLevel=!1)}}r.getCached=function(A,B,t){let e=A._cache._executeCached[B];if(void 0!==e)return e;const g=A.getBlock(B);return void 0===g?null:(e=void 0===t?{id:B,opcode:A.getOpcode(g),fields:A.getFields(g),inputs:A.getInputs(g),mutation:A.getMutation(g)}:new t(A,{id:B,opcode:A.getOpcode(g),fields:A.getFields(g),inputs:A.getInputs(g),mutation:A.getMutation(g)}),A._cache._executeCached[B]=e,e)};const a=c._RuntimeScriptCache;c.getScripts=function(A,B){let t=A._cache.scripts[B];if(!t){t=A._cache.scripts[B]=[];const e=A._scripts;for(let g=0;g>2]|=A[i]<>6,n[g++]=128|63&e):e<55296||e>=57344?(n[g++]=224|e>>12,n[g++]=128|e>>6&63,n[g++]=128|63&e):(e=65536+((1023&e)<<10|1023&A.charCodeAt(++i)),n[g++]=240|e>>18,n[g++]=128|e>>12&63,n[g++]=128|e>>6&63,n[g++]=128|63&e);else for(g=this.start;i>2]|=e<>2]|=(192|e>>6)<>2]|=(128|63&e)<=57344?(s[g>>2]|=(224|e>>12)<>2]|=(128|e>>6&63)<>2]|=(128|63&e)<>2]|=(240|e>>18)<>2]|=(128|e>>12&63)<>2]|=(128|e>>6&63)<>2]|=(128|63&e)<=64?(this.start=g-64,this.hash(),this.hashed=!0):this.start=g}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 A=this.blocks,B=this.lastByteIndex;A[B>>2]|=EXTRA[3&B],B>=56&&(this.hashed||this.hash(),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),A[14]=this.bytes<<3,A[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var A,B,t,e,g,i,Q=this.blocks;this.first?B=((B=((A=((A=Q[0]-680876937)<<7|A>>>25)-271733879<<0)^(t=((t=(-271733879^(e=((e=(-1732584194^2004318071&A)+Q[1]-117830708)<<12|e>>>20)+A<<0)&(-271733879^A))+Q[2]-1126478375)<<17|t>>>15)+e<<0)&(e^A))+Q[3]-1316259209)<<22|B>>>10)+t<<0:(A=this.h0,B=this.h1,t=this.h2,B=((B+=((A=((A+=((e=this.h3)^B&(t^e))+Q[0]-680876936)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[1]-389564586)<<12|e>>>20)+A<<0)&(A^B))+Q[2]+606105819)<<17|t>>>15)+e<<0)&(e^A))+Q[3]-1044525330)<<22|B>>>10)+t<<0),B=((B+=((A=((A+=(e^B&(t^e))+Q[4]-176418897)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[5]+1200080426)<<12|e>>>20)+A<<0)&(A^B))+Q[6]-1473231341)<<17|t>>>15)+e<<0)&(e^A))+Q[7]-45705983)<<22|B>>>10)+t<<0,B=((B+=((A=((A+=(e^B&(t^e))+Q[8]+1770035416)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[9]-1958414417)<<12|e>>>20)+A<<0)&(A^B))+Q[10]-42063)<<17|t>>>15)+e<<0)&(e^A))+Q[11]-1990404162)<<22|B>>>10)+t<<0,B=((B+=((A=((A+=(e^B&(t^e))+Q[12]+1804603682)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[13]-40341101)<<12|e>>>20)+A<<0)&(A^B))+Q[14]-1502002290)<<17|t>>>15)+e<<0)&(e^A))+Q[15]+1236535329)<<22|B>>>10)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[1]-165796510)<<5|A>>>27)+B<<0)^B))+Q[6]-1069501632)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[11]+643717713)<<14|t>>>18)+e<<0)^e))+Q[0]-373897302)<<20|B>>>12)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[5]-701558691)<<5|A>>>27)+B<<0)^B))+Q[10]+38016083)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[15]-660478335)<<14|t>>>18)+e<<0)^e))+Q[4]-405537848)<<20|B>>>12)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[9]+568446438)<<5|A>>>27)+B<<0)^B))+Q[14]-1019803690)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[3]-187363961)<<14|t>>>18)+e<<0)^e))+Q[8]+1163531501)<<20|B>>>12)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[13]-1444681467)<<5|A>>>27)+B<<0)^B))+Q[2]-51403784)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[7]+1735328473)<<14|t>>>18)+e<<0)^e))+Q[12]-1926607734)<<20|B>>>12)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[5]-378558)<<4|A>>>28)+B<<0))+Q[8]-2022574463)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[11]+1839030562)<<16|t>>>16)+e<<0))+Q[14]-35309556)<<23|B>>>9)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[1]-1530992060)<<4|A>>>28)+B<<0))+Q[4]+1272893353)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[7]-155497632)<<16|t>>>16)+e<<0))+Q[10]-1094730640)<<23|B>>>9)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[13]+681279174)<<4|A>>>28)+B<<0))+Q[0]-358537222)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[3]-722521979)<<16|t>>>16)+e<<0))+Q[6]+76029189)<<23|B>>>9)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[9]-640364487)<<4|A>>>28)+B<<0))+Q[12]-421815835)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[15]+530742520)<<16|t>>>16)+e<<0))+Q[2]-995338651)<<23|B>>>9)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[0]-198630844)<<6|A>>>26)+B<<0)|~t))+Q[7]+1126891415)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[14]-1416354905)<<15|t>>>17)+e<<0)|~A))+Q[5]-57434055)<<21|B>>>11)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[12]+1700485571)<<6|A>>>26)+B<<0)|~t))+Q[3]-1894986606)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[10]-1051523)<<15|t>>>17)+e<<0)|~A))+Q[1]-2054922799)<<21|B>>>11)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[8]+1873313359)<<6|A>>>26)+B<<0)|~t))+Q[15]-30611744)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[6]-1560198380)<<15|t>>>17)+e<<0)|~A))+Q[13]+1309151649)<<21|B>>>11)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[4]-145523070)<<6|A>>>26)+B<<0)|~t))+Q[11]-1120210379)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[2]+718787259)<<15|t>>>17)+e<<0)|~A))+Q[9]-343485551)<<21|B>>>11)+t<<0,this.first?(this.h0=A+1732584193<<0,this.h1=B-271733879<<0,this.h2=t-1732584194<<0,this.h3=e+271733878<<0,this.first=!1):(this.h0=this.h0+A<<0,this.h1=this.h1+B<<0,this.h2=this.h2+t<<0,this.h3=this.h3+e<<0)},Md5.prototype.hex=function(){this.finalize();var A=this.h0,B=this.h1,t=this.h2,e=this.h3;return HEX_CHARS[A>>4&15]+HEX_CHARS[15&A]+HEX_CHARS[A>>12&15]+HEX_CHARS[A>>8&15]+HEX_CHARS[A>>20&15]+HEX_CHARS[A>>16&15]+HEX_CHARS[A>>28&15]+HEX_CHARS[A>>24&15]+HEX_CHARS[B>>4&15]+HEX_CHARS[15&B]+HEX_CHARS[B>>12&15]+HEX_CHARS[B>>8&15]+HEX_CHARS[B>>20&15]+HEX_CHARS[B>>16&15]+HEX_CHARS[B>>28&15]+HEX_CHARS[B>>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[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]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var A=this.h0,B=this.h1,t=this.h2,e=this.h3;return[255&A,A>>8&255,A>>16&255,A>>24&255,255&B,B>>8&255,B>>16&255,B>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var A=new ArrayBuffer(16),B=new Uint32Array(A);return B[0]=this.h0,B[1]=this.h1,B[2]=this.h2,B[3]=this.h3,A},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var A,B,t,e="",g=this.array(),i=0;i<15;)A=g[i++],B=g[i++],t=g[i++],e+=BASE64_ENCODE_CHAR[A>>>2]+BASE64_ENCODE_CHAR[63&(A<<4|B>>>4)]+BASE64_ENCODE_CHAR[63&(B<<2|t>>>6)]+BASE64_ENCODE_CHAR[63&t];return A=g[i],e+=BASE64_ENCODE_CHAR[A>>>2]+BASE64_ENCODE_CHAR[A<<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__(37),__webpack_require__(10))},function(A,B,t){"use strict";var e,g="object"==typeof Reflect?Reflect:null,i=g&&"function"==typeof g.apply?g.apply:function(A,B,t){return Function.prototype.apply.call(A,B,t)};e=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(A){return Object.getOwnPropertyNames(A).concat(Object.getOwnPropertySymbols(A))}:function(A){return Object.getOwnPropertyNames(A)};var Q=Number.isNaN||function(A){return A!=A};function s(){s.init.call(this)}A.exports=s,A.exports.once=function(A,B){return new Promise((function(t,e){function g(t){A.removeListener(B,i),e(t)}function i(){"function"==typeof A.removeListener&&A.removeListener("error",g),t([].slice.call(arguments))}Y(A,B,i,{once:!0}),"error"!==B&&function(A,B,t){"function"==typeof A.on&&Y(A,"error",B,t)}(A,g,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var n=10;function r(A){if("function"!=typeof A)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}function E(A){return void 0===A._maxListeners?s.defaultMaxListeners:A._maxListeners}function c(A,B,t,e){var g,i,Q,s;if(r(t),void 0===(i=A._events)?(i=A._events=Object.create(null),A._eventsCount=0):(void 0!==i.newListener&&(A.emit("newListener",B,t.listener?t.listener:t),i=A._events),Q=i[B]),void 0===Q)Q=i[B]=t,++A._eventsCount;else if("function"==typeof Q?Q=i[B]=e?[t,Q]:[Q,t]:e?Q.unshift(t):Q.push(t),(g=E(A))>0&&Q.length>g&&!Q.warned){Q.warned=!0;var n=new Error("Possible EventEmitter memory leak detected. "+Q.length+" "+String(B)+" listeners added. Use emitter.setMaxListeners() to increase limit");n.name="MaxListenersExceededWarning",n.emitter=A,n.type=B,n.count=Q.length,s=n,console&&console.warn&&console.warn(s)}return A}function o(){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 w(A,B,t){var e={fired:!1,wrapFn:void 0,target:A,type:B,listener:t},g=o.bind(e);return g.listener=t,e.wrapFn=g,g}function C(A,B,t){var e=A._events;if(void 0===e)return[];var g=e[B];return void 0===g?[]:"function"==typeof g?t?[g.listener||g]:[g]:t?function(A){for(var B=new Array(A.length),t=0;t0&&(Q=B[0]),Q instanceof Error)throw Q;var s=new Error("Unhandled error."+(Q?" ("+Q.message+")":""));throw s.context=Q,s}var n=g[A];if(void 0===n)return!1;if("function"==typeof n)i(n,this,B);else{var r=n.length,E=I(n,r);for(t=0;t=0;i--)if(t[i]===B||t[i].listener===B){Q=t[i].listener,g=i;break}if(g<0)return this;0===g?t.shift():function(A,B){for(;B+1=0;e--)this.removeListener(A,B[e]);return this},s.prototype.listeners=function(A){return C(this,A,!0)},s.prototype.rawListeners=function(A){return C(this,A,!1)},s.listenerCount=function(A,B){return"function"==typeof A.listenerCount?A.listenerCount(B):a.call(A,B)},s.prototype.listenerCount=a,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},function(A,B,t){(function(B,t,e,g){A.exports=function A(B,t,e){function g(Q,s){if(!t[Q]){if(!B[Q]){if(i)return i(Q,!0);var n=new Error("Cannot find module '"+Q+"'");throw n.code="MODULE_NOT_FOUND",n}var r=t[Q]={exports:{}};B[Q][0].call(r.exports,(function(A){return g(B[Q][1][A]||A)}),r,r.exports,A,B,t,e)}return t[Q].exports}for(var i=!1,Q=0;Q>2,s=(3&B)<<4|t>>4,n=1>6:64,r=2>4,t=(15&Q)<<4|(s=i.indexOf(A.charAt(r++)))>>2,e=(3&s)<<6|(n=i.indexOf(A.charAt(r++))),o[E++]=B,64!==s&&(o[E++]=t),64!==n&&(o[E++]=e);return o}},{"./support":30,"./utils":32}],2:[function(A,B,t){"use strict";var e=A("./external"),g=A("./stream/DataWorker"),i=A("./stream/Crc32Probe"),Q=A("./stream/DataLengthProbe");function s(A,B,t,e,g){this.compressedSize=A,this.uncompressedSize=B,this.crc32=t,this.compression=e,this.compressedContent=g}s.prototype={getContentWorker:function(){var A=new g(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Q("data_length")),B=this;return A.on("end",(function(){if(this.streamInfo.data_length!==B.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),A},getCompressedWorker:function(){return new g(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(A,B,t){return A.pipe(new i).pipe(new Q("uncompressedSize")).pipe(B.compressWorker(t)).pipe(new Q("compressedSize")).withStreamInfo("compression",B)},B.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(A,B,t){"use strict";var e=A("./stream/GenericWorker");t.STORE={magic:"\0\0",compressWorker:function(A){return new e("STORE compression")},uncompressWorker:function(){return new e("STORE decompression")}},t.DEFLATE=A("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(A,B,t){"use strict";var e=A("./utils"),g=function(){for(var A,B=[],t=0;t<256;t++){A=t;for(var e=0;e<8;e++)A=1&A?3988292384^A>>>1:A>>>1;B[t]=A}return B}();B.exports=function(A,B){return void 0!==A&&A.length?"string"!==e.getTypeOf(A)?function(A,B,t,e){var i=g,Q=0+t;A^=-1;for(var s=0;s>>8^i[255&(A^B[s])];return-1^A}(0|B,A,A.length):function(A,B,t,e){var i=g,Q=0+t;A^=-1;for(var s=0;s>>8^i[255&(A^B.charCodeAt(s))];return-1^A}(0|B,A,A.length):0}},{"./utils":32}],5:[function(A,B,t){"use strict";t.base64=!1,t.binary=!1,t.dir=!1,t.createFolders=!0,t.date=null,t.compression=null,t.compressionOptions=null,t.comment=null,t.unixPermissions=null,t.dosPermissions=null},{}],6:[function(A,B,t){"use strict";var e;e="undefined"!=typeof Promise?Promise:A("lie"),B.exports={Promise:e}},{lie:37}],7:[function(A,B,t){"use strict";var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,g=A("pako"),i=A("./utils"),Q=A("./stream/GenericWorker"),s=e?"uint8array":"array";function n(A,B){Q.call(this,"FlateWorker/"+A),this._pako=null,this._pakoAction=A,this._pakoOptions=B,this.meta={}}t.magic="\b\0",i.inherits(n,Q),n.prototype.processChunk=function(A){this.meta=A.meta,null===this._pako&&this._createPako(),this._pako.push(i.transformTo(s,A.data),!1)},n.prototype.flush=function(){Q.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},n.prototype.cleanUp=function(){Q.prototype.cleanUp.call(this),this._pako=null},n.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var A=this;this._pako.onData=function(B){A.push({data:B,meta:A.meta})}},t.compressWorker=function(A){return new n("Deflate",A)},t.uncompressWorker=function(){return new n("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(A,B,t){"use strict";function e(A,B){var t,e="";for(t=0;t>>=8;return e}function g(A,B,t,g,Q,E){var c,o,w=A.file,C=A.compression,a=E!==s.utf8encode,I=i.transformTo("string",E(w.name)),Y=i.transformTo("string",s.utf8encode(w.name)),h=w.comment,M=i.transformTo("string",E(h)),F=i.transformTo("string",s.utf8encode(h)),D=Y.length!==w.name.length,u=F.length!==h.length,l="",d="",U="",N=w.dir,m=w.date,G={crc32:0,compressedSize:0,uncompressedSize:0};B&&!t||(G.crc32=A.crc32,G.compressedSize=A.compressedSize,G.uncompressedSize=A.uncompressedSize);var f=0;B&&(f|=8),a||!D&&!u||(f|=2048);var H=0,R=0;N&&(H|=16),"UNIX"===Q?(R=798,H|=function(A,B){var t=A;return A||(t=B?16893:33204),(65535&t)<<16}(w.unixPermissions,N)):(R=20,H|=function(A){return 63&(A||0)}(w.dosPermissions)),c=m.getUTCHours(),c<<=6,c|=m.getUTCMinutes(),c<<=5,c|=m.getUTCSeconds()/2,o=m.getUTCFullYear()-1980,o<<=4,o|=m.getUTCMonth()+1,o<<=5,o|=m.getUTCDate(),D&&(d=e(1,1)+e(n(I),4)+Y,l+="up"+e(d.length,2)+d),u&&(U=e(1,1)+e(n(M),4)+F,l+="uc"+e(U.length,2)+U);var p="";return p+="\n\0",p+=e(f,2),p+=C.magic,p+=e(c,2),p+=e(o,2),p+=e(G.crc32,4),p+=e(G.compressedSize,4),p+=e(G.uncompressedSize,4),p+=e(I.length,2),p+=e(l.length,2),{fileRecord:r.LOCAL_FILE_HEADER+p+I+l,dirRecord:r.CENTRAL_FILE_HEADER+e(R,2)+p+e(M.length,2)+"\0\0\0\0"+e(H,4)+e(g,4)+I+l+M}}var i=A("../utils"),Q=A("../stream/GenericWorker"),s=A("../utf8"),n=A("../crc32"),r=A("../signature");function E(A,B,t,e){Q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=B,this.zipPlatform=t,this.encodeFileName=e,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(E,Q),E.prototype.push=function(A){var B=A.meta.percent||0,t=this.entriesCount,e=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,Q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:t?(B+100*(t-e-1))/t:100}}))},E.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var B=this.streamFiles&&!A.file.dir;if(B){var t=g(A,B,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:t.fileRecord,meta:{percent:0}})}else this.accumulate=!0},E.prototype.closedSource=function(A){this.accumulate=!1;var B=this.streamFiles&&!A.file.dir,t=g(A,B,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(t.dirRecord),B)this.push({data:function(A){return r.DATA_DESCRIPTOR+e(A.crc32,4)+e(A.compressedSize,4)+e(A.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:t.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},E.prototype.flush=function(){for(var A=this.bytesWritten,B=0;B=this.index;B--)t=(t<<8)+this.byteAt(B);return this.index+=A,t},readString:function(A){return e.transformTo("string",this.readData(A))},readData:function(A){},lastIndexOfSignature:function(A){},readAndCheckSignature:function(A){},readDate:function(){var A=this.readInt(4);return new Date(Date.UTC(1980+(A>>25&127),(A>>21&15)-1,A>>16&31,A>>11&31,A>>5&63,(31&A)<<1))}},B.exports=g},{"../utils":32}],19:[function(A,B,t){"use strict";var e=A("./Uint8ArrayReader");function g(A){e.call(this,A)}A("../utils").inherits(g,e),g.prototype.readData=function(A){this.checkOffset(A);var B=this.data.slice(this.zero+this.index,this.zero+this.index+A);return this.index+=A,B},B.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(A,B,t){"use strict";var e=A("./DataReader");function g(A){e.call(this,A)}A("../utils").inherits(g,e),g.prototype.byteAt=function(A){return this.data.charCodeAt(this.zero+A)},g.prototype.lastIndexOfSignature=function(A){return this.data.lastIndexOf(A)-this.zero},g.prototype.readAndCheckSignature=function(A){return A===this.readData(4)},g.prototype.readData=function(A){this.checkOffset(A);var B=this.data.slice(this.zero+this.index,this.zero+this.index+A);return this.index+=A,B},B.exports=g},{"../utils":32,"./DataReader":18}],21:[function(A,B,t){"use strict";var e=A("./ArrayReader");function g(A){e.call(this,A)}A("../utils").inherits(g,e),g.prototype.readData=function(A){if(this.checkOffset(A),0===A)return new Uint8Array(0);var B=this.data.subarray(this.zero+this.index,this.zero+this.index+A);return this.index+=A,B},B.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(A,B,t){"use strict";var e=A("../utils"),g=A("../support"),i=A("./ArrayReader"),Q=A("./StringReader"),s=A("./NodeBufferReader"),n=A("./Uint8ArrayReader");B.exports=function(A){var B=e.getTypeOf(A);return e.checkSupport(B),"string"!==B||g.uint8array?"nodebuffer"===B?new s(A):g.uint8array?new n(e.transformTo("uint8array",A)):new i(e.transformTo("array",A)):new Q(A)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(A,B,t){"use strict";t.LOCAL_FILE_HEADER="PK",t.CENTRAL_FILE_HEADER="PK",t.CENTRAL_DIRECTORY_END="PK",t.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",t.ZIP64_CENTRAL_DIRECTORY_END="PK",t.DATA_DESCRIPTOR="PK\b"},{}],24:[function(A,B,t){"use strict";var e=A("./GenericWorker"),g=A("../utils");function i(A){e.call(this,"ConvertWorker to "+A),this.destType=A}g.inherits(i,e),i.prototype.processChunk=function(A){this.push({data:g.transformTo(this.destType,A.data),meta:A.meta})},B.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(A,B,t){"use strict";var e=A("./GenericWorker"),g=A("../crc32");function i(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}A("../utils").inherits(i,e),i.prototype.processChunk=function(A){this.streamInfo.crc32=g(A.data,this.streamInfo.crc32||0),this.push(A)},B.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(A,B,t){"use strict";var e=A("../utils"),g=A("./GenericWorker");function i(A){g.call(this,"DataLengthProbe for "+A),this.propName=A,this.withStreamInfo(A,0)}e.inherits(i,g),i.prototype.processChunk=function(A){if(A){var B=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=B+A.data.length}g.prototype.processChunk.call(this,A)},B.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(A,B,t){"use strict";var e=A("../utils"),g=A("./GenericWorker");function i(A){g.call(this,"DataWorker");var B=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,A.then((function(A){B.dataIsReady=!0,B.data=A,B.max=A&&A.length||0,B.type=e.getTypeOf(A),B.isPaused||B._tickAndRepeat()}),(function(A){B.error(A)}))}e.inherits(i,g),i.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var A=null,B=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":A=this.data.substring(this.index,B);break;case"uint8array":A=this.data.subarray(this.index,B);break;case"array":case"nodebuffer":A=this.data.slice(this.index,B)}return this.index=B,this.push({data:A,meta:{percent:this.max?this.index/this.max*100:0}})},B.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(A,B,t){"use strict";function e(A){this.name=A||"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}e.prototype={push:function(A){this.emit("data",A)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(A){this.emit("error",A)}return!0},error:function(A){return!this.isFinished&&(this.isPaused?this.generatedError=A:(this.isFinished=!0,this.emit("error",A),this.previous&&this.previous.error(A),this.cleanUp()),!0)},on:function(A,B){return this._listeners[A].push(B),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(A,B){if(this._listeners[A])for(var t=0;t "+A:A}},B.exports=e},{}],29:[function(A,t,e){"use strict";var g=A("../utils"),i=A("./ConvertWorker"),Q=A("./GenericWorker"),s=A("../base64"),n=A("../support"),r=A("../external"),E=null;if(n.nodestream)try{E=A("../nodejs/NodejsStreamOutputAdapter")}catch(A){}function c(A,B,t){var e=B;switch(B){case"blob":case"arraybuffer":e="uint8array";break;case"base64":e="string"}try{this._internalType=e,this._outputType=B,this._mimeType=t,g.checkSupport(e),this._worker=A.pipe(new i(e)),A.lock()}catch(A){this._worker=new Q("error"),this._worker.error(A)}}c.prototype={accumulate:function(A){return function(A,t){return new r.Promise((function(e,i){var Q=[],n=A._internalType,r=A._outputType,E=A._mimeType;A.on("data",(function(A,B){Q.push(A),t&&t(B)})).on("error",(function(A){Q=[],i(A)})).on("end",(function(){try{var A=function(A,B,t){switch(A){case"blob":return g.newBlob(g.transformTo("arraybuffer",B),t);case"base64":return s.encode(B);default:return g.transformTo(A,B)}}(r,function(A,t){var e,g=0,i=null,Q=0;for(e=0;e>>6:(t<65536?B[Q++]=224|t>>>12:(B[Q++]=240|t>>>18,B[Q++]=128|t>>>12&63),B[Q++]=128|t>>>6&63),B[Q++]=128|63&t);return B}(A)},t.utf8decode=function(A){return g.nodebuffer?e.transformTo("nodebuffer",A).toString("utf-8"):function(A){var B,t,g,i,Q=A.length,n=new Array(2*Q);for(B=t=0;B>10&1023,n[t++]=56320|1023&g)}return n.length!==t&&(n.subarray?n=n.subarray(0,t):n.length=t),e.applyFromCharCode(n)}(A=e.transformTo(g.uint8array?"uint8array":"array",A))},e.inherits(r,Q),r.prototype.processChunk=function(A){var B=e.transformTo(g.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var i=B;(B=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),B.set(i,this.leftOver.length)}else B=this.leftOver.concat(B);this.leftOver=null}var Q=function(A,B){var t;for((B=B||A.length)>A.length&&(B=A.length),t=B-1;0<=t&&128==(192&A[t]);)t--;return t<0||0===t?B:t+s[A[t]]>B?t:B}(B),n=B;Q!==B.length&&(g.uint8array?(n=B.subarray(0,Q),this.leftOver=B.subarray(Q,B.length)):(n=B.slice(0,Q),this.leftOver=B.slice(Q,B.length))),this.push({data:t.utf8decode(n),meta:A.meta})},r.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=r,e.inherits(E,Q),E.prototype.processChunk=function(A){this.push({data:t.utf8encode(A.data),meta:A.meta})},t.Utf8EncodeWorker=E},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(A,B,e){"use strict";var g=A("./support"),i=A("./base64"),Q=A("./nodejsUtils"),s=A("./external");function n(A){return A}function r(A,B){for(var t=0;t>8;this.dir=!!(16&this.externalFileAttributes),0==A&&(this.dosPermissions=63&this.externalFileAttributes),3==A&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(A){if(this.extraFields[1]){var B=e(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=B.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=B.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=B.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=B.readInt(4))}},readExtraFields:function(A){var B,t,e,g=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(t<65536?B[Q++]=224|t>>>12:(B[Q++]=240|t>>>18,B[Q++]=128|t>>>12&63),B[Q++]=128|t>>>6&63),B[Q++]=128|63&t);return B},t.buf2binstring=function(A){return n(A,A.length)},t.binstring2buf=function(A){for(var B=new e.Buf8(A.length),t=0,g=B.length;t>10&1023,r[e++]=56320|1023&g)}return n(r,e)},t.utf8border=function(A,B){var t;for((B=B||A.length)>A.length&&(B=A.length),t=B-1;0<=t&&128==(192&A[t]);)t--;return t<0||0===t?B:t+Q[A[t]]>B?t:B}},{"./common":41}],43:[function(A,B,t){"use strict";B.exports=function(A,B,t,e){for(var g=65535&A|0,i=A>>>16&65535|0,Q=0;0!==t;){for(t-=Q=2e3>>1:A>>>1;B[t]=A}return B}();B.exports=function(A,B,t,g){var i=e,Q=g+t;A^=-1;for(var s=g;s>>8^i[255&(A^B[s])];return-1^A}},{}],46:[function(A,B,t){"use strict";var e,g=A("../utils/common"),i=A("./trees"),Q=A("./adler32"),s=A("./crc32"),n=A("./messages"),r=-2,E=258,c=262,o=113;function w(A,B){return A.msg=n[B],B}function C(A){return(A<<1)-(4A.avail_out&&(t=A.avail_out),0!==t&&(g.arraySet(A.output,B.pending_buf,B.pending_out,t,A.next_out),A.next_out+=t,B.pending_out+=t,A.total_out+=t,A.avail_out-=t,B.pending-=t,0===B.pending&&(B.pending_out=0))}function Y(A,B){i._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,B),A.block_start=A.strstart,I(A.strm)}function h(A,B){A.pending_buf[A.pending++]=B}function M(A,B){A.pending_buf[A.pending++]=B>>>8&255,A.pending_buf[A.pending++]=255&B}function F(A,B){var t,e,g=A.max_chain_length,i=A.strstart,Q=A.prev_length,s=A.nice_match,n=A.strstart>A.w_size-c?A.strstart-(A.w_size-c):0,r=A.window,o=A.w_mask,w=A.prev,C=A.strstart+E,a=r[i+Q-1],I=r[i+Q];A.prev_length>=A.good_match&&(g>>=2),s>A.lookahead&&(s=A.lookahead);do{if(r[(t=B)+Q]===I&&r[t+Q-1]===a&&r[t]===r[i]&&r[++t]===r[i+1]){i+=2,t++;do{}while(r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&in&&0!=--g);return Q<=A.lookahead?Q:A.lookahead}function D(A){var B,t,e,i,n,r,E,o,w,C,a=A.w_size;do{if(i=A.window_size-A.lookahead-A.strstart,A.strstart>=a+(a-c)){for(g.arraySet(A.window,A.window,a,a,0),A.match_start-=a,A.strstart-=a,A.block_start-=a,B=t=A.hash_size;e=A.head[--B],A.head[B]=a<=e?e-a:0,--t;);for(B=t=a;e=A.prev[--B],A.prev[B]=a<=e?e-a:0,--t;);i+=a}if(0===A.strm.avail_in)break;if(r=A.strm,E=A.window,o=A.strstart+A.lookahead,C=void 0,(w=i)<(C=r.avail_in)&&(C=w),t=0===C?0:(r.avail_in-=C,g.arraySet(E,r.input,r.next_in,C,o),1===r.state.wrap?r.adler=Q(r.adler,E,C,o):2===r.state.wrap&&(r.adler=s(r.adler,E,C,o)),r.next_in+=C,r.total_in+=C,C),A.lookahead+=t,A.lookahead+A.insert>=3)for(n=A.strstart-A.insert,A.ins_h=A.window[n],A.ins_h=(A.ins_h<=3&&(A.ins_h=(A.ins_h<=3)if(e=i._tr_tally(A,A.strstart-A.match_start,A.match_length-3),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=3){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<=3&&(A.ins_h=(A.ins_h<=3&&A.match_length<=A.prev_length){for(g=A.strstart+A.lookahead-3,e=i._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-3),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=g&&(A.ins_h=(A.ins_h<A.pending_buf_size-5&&(t=A.pending_buf_size-5);;){if(A.lookahead<=1){if(D(A),0===A.lookahead&&0===B)return 1;if(0===A.lookahead)break}A.strstart+=A.lookahead,A.lookahead=0;var e=A.block_start+t;if((0===A.strstart||A.strstart>=e)&&(A.lookahead=A.strstart-e,A.strstart=e,Y(A,!1),0===A.strm.avail_out))return 1;if(A.strstart-A.block_start>=A.w_size-c&&(Y(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,4===B?(Y(A,!0),0===A.strm.avail_out?3:4):(A.strstart>A.block_start&&(Y(A,!1),A.strm.avail_out),1)})),new d(4,4,8,4,u),new d(4,5,16,8,u),new d(4,6,32,32,u),new d(4,4,16,16,l),new d(8,16,32,32,l),new d(8,16,128,128,l),new d(8,32,128,256,l),new d(32,128,258,1024,l),new d(32,258,258,4096,l)],t.deflateInit=function(A,B){return G(A,B,8,15,8,0)},t.deflateInit2=G,t.deflateReset=m,t.deflateResetKeep=N,t.deflateSetHeader=function(A,B){return A&&A.state?2!==A.state.wrap?r:(A.state.gzhead=B,0):r},t.deflate=function(A,B){var t,g,Q,n;if(!A||!A.state||5>8&255),h(g,g.gzhead.time>>16&255),h(g,g.gzhead.time>>24&255),h(g,9===g.level?2:2<=g.strategy||g.level<2?4:0),h(g,255&g.gzhead.os),g.gzhead.extra&&g.gzhead.extra.length&&(h(g,255&g.gzhead.extra.length),h(g,g.gzhead.extra.length>>8&255)),g.gzhead.hcrc&&(A.adler=s(A.adler,g.pending_buf,g.pending,0)),g.gzindex=0,g.status=69):(h(g,0),h(g,0),h(g,0),h(g,0),h(g,0),h(g,9===g.level?2:2<=g.strategy||g.level<2?4:0),h(g,3),g.status=o);else{var c=8+(g.w_bits-8<<4)<<8;c|=(2<=g.strategy||g.level<2?0:g.level<6?1:6===g.level?2:3)<<6,0!==g.strstart&&(c|=32),c+=31-c%31,g.status=o,M(g,c),0!==g.strstart&&(M(g,A.adler>>>16),M(g,65535&A.adler)),A.adler=1}if(69===g.status)if(g.gzhead.extra){for(Q=g.pending;g.gzindex<(65535&g.gzhead.extra.length)&&(g.pending!==g.pending_buf_size||(g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),I(A),Q=g.pending,g.pending!==g.pending_buf_size));)h(g,255&g.gzhead.extra[g.gzindex]),g.gzindex++;g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),g.gzindex===g.gzhead.extra.length&&(g.gzindex=0,g.status=73)}else g.status=73;if(73===g.status)if(g.gzhead.name){Q=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),I(A),Q=g.pending,g.pending===g.pending_buf_size)){n=1;break}n=g.gzindexQ&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),0===n&&(g.gzindex=0,g.status=91)}else g.status=91;if(91===g.status)if(g.gzhead.comment){Q=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),I(A),Q=g.pending,g.pending===g.pending_buf_size)){n=1;break}n=g.gzindexQ&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),0===n&&(g.status=103)}else g.status=103;if(103===g.status&&(g.gzhead.hcrc?(g.pending+2>g.pending_buf_size&&I(A),g.pending+2<=g.pending_buf_size&&(h(g,255&A.adler),h(g,A.adler>>8&255),A.adler=0,g.status=o)):g.status=o),0!==g.pending){if(I(A),0===A.avail_out)return g.last_flush=-1,0}else if(0===A.avail_in&&C(B)<=C(t)&&4!==B)return w(A,-5);if(666===g.status&&0!==A.avail_in)return w(A,-5);if(0!==A.avail_in||0!==g.lookahead||0!==B&&666!==g.status){var F=2===g.strategy?function(A,B){for(var t;;){if(0===A.lookahead&&(D(A),0===A.lookahead)){if(0===B)return 1;break}if(A.match_length=0,t=i._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,t&&(Y(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,4===B?(Y(A,!0),0===A.strm.avail_out?3:4):A.last_lit&&(Y(A,!1),0===A.strm.avail_out)?1:2}(g,B):3===g.strategy?function(A,B){for(var t,e,g,Q,s=A.window;;){if(A.lookahead<=E){if(D(A),A.lookahead<=E&&0===B)return 1;if(0===A.lookahead)break}if(A.match_length=0,A.lookahead>=3&&0A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=3?(t=i._tr_tally(A,1,A.match_length-3),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(t=i._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),t&&(Y(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,4===B?(Y(A,!0),0===A.strm.avail_out?3:4):A.last_lit&&(Y(A,!1),0===A.strm.avail_out)?1:2}(g,B):e[g.level].func(g,B);if(3!==F&&4!==F||(g.status=666),1===F||3===F)return 0===A.avail_out&&(g.last_flush=-1),0;if(2===F&&(1===B?i._tr_align(g):5!==B&&(i._tr_stored_block(g,0,0,!1),3===B&&(a(g.head),0===g.lookahead&&(g.strstart=0,g.block_start=0,g.insert=0))),I(A),0===A.avail_out))return g.last_flush=-1,0}return 4!==B?0:g.wrap<=0?1:(2===g.wrap?(h(g,255&A.adler),h(g,A.adler>>8&255),h(g,A.adler>>16&255),h(g,A.adler>>24&255),h(g,255&A.total_in),h(g,A.total_in>>8&255),h(g,A.total_in>>16&255),h(g,A.total_in>>24&255)):(M(g,A.adler>>>16),M(g,65535&A.adler)),I(A),0=t.w_size&&(0===s&&(a(t.head),t.strstart=0,t.block_start=0,t.insert=0),o=new g.Buf8(t.w_size),g.arraySet(o,B,w-t.w_size,t.w_size,0),B=o,w=t.w_size),n=A.avail_in,E=A.next_in,c=A.input,A.avail_in=w,A.next_in=0,A.input=B,D(t);t.lookahead>=3;){for(e=t.strstart,i=t.lookahead-2;t.ins_h=(t.ins_h<>>=F=M>>>24,C-=F,0==(F=M>>>16&255))N[i++]=65535&M;else{if(!(16&F)){if(0==(64&F)){M=a[(65535&M)+(w&(1<>>=F,C-=F),C<15&&(w+=U[e++]<>>=F=M>>>24,C-=F,!(16&(F=M>>>16&255))){if(0==(64&F)){M=I[(65535&M)+(w&(1<>>=F,C-=F,(F=i-Q)>3,w&=(1<<(C-=D<<3))-1,A.next_in=e,A.next_out=i,A.avail_in=e>>24&255)+(A>>>8&65280)+((65280&A)<<8)+((255&A)<<24)}function E(){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 e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function c(A){var B;return A&&A.state?(B=A.state,A.total_in=A.total_out=B.total=0,A.msg="",B.wrap&&(A.adler=1&B.wrap),B.mode=1,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new e.Buf32(852),B.distcode=B.distdyn=new e.Buf32(592),B.sane=1,B.back=-1,0):n}function o(A){var B;return A&&A.state?((B=A.state).wsize=0,B.whave=0,B.wnext=0,c(A)):n}function w(A,B){var t,e;return A&&A.state?(e=A.state,B<0?(t=0,B=-B):(t=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=Q.wsize?(e.arraySet(Q.window,B,t-Q.wsize,Q.wsize,0),Q.wnext=0,Q.whave=Q.wsize):(g<(i=Q.wsize-Q.wnext)&&(i=g),e.arraySet(Q.window,B,t-g,i,Q.wnext),(g-=i)?(e.arraySet(Q.window,B,t-g,g,0),Q.wnext=g,Q.whave=Q.wsize):(Q.wnext+=i,Q.wnext===Q.wsize&&(Q.wnext=0),Q.whave>>8&255,t.check=i(t.check,T,2,0),Y=I=0,t.mode=2;break}if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&I)<<8)+(I>>8))%31){A.msg="incorrect header check",t.mode=30;break}if(8!=(15&I)){A.msg="unknown compression method",t.mode=30;break}if(Y-=4,R=8+(15&(I>>>=4)),0===t.wbits)t.wbits=R;else if(R>t.wbits){A.msg="invalid window size",t.mode=30;break}t.dmax=1<>8&1),512&t.flags&&(T[0]=255&I,T[1]=I>>>8&255,t.check=i(t.check,T,2,0)),Y=I=0,t.mode=3;case 3:for(;Y<32;){if(0===C)break A;C--,I+=E[o++]<>>8&255,T[2]=I>>>16&255,T[3]=I>>>24&255,t.check=i(t.check,T,4,0)),Y=I=0,t.mode=4;case 4:for(;Y<16;){if(0===C)break A;C--,I+=E[o++]<>8),512&t.flags&&(T[0]=255&I,T[1]=I>>>8&255,t.check=i(t.check,T,2,0)),Y=I=0,t.mode=5;case 5:if(1024&t.flags){for(;Y<16;){if(0===C)break A;C--,I+=E[o++]<>>8&255,t.check=i(t.check,T,2,0)),Y=I=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&(C<(u=t.length)&&(u=C),u&&(t.head&&(R=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),e.arraySet(t.head.extra,E,o,u,R)),512&t.flags&&(t.check=i(t.check,E,u,o)),C-=u,o+=u,t.length-=u),t.length))break A;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===C)break A;for(u=0;R=E[o+u++],t.head&&R&&t.length<65536&&(t.head.name+=String.fromCharCode(R)),R&&u>9&1,t.head.done=!0),A.adler=t.check=0,t.mode=12;break;case 10:for(;Y<32;){if(0===C)break A;C--,I+=E[o++]<>>=7&Y,Y-=7&Y,t.mode=27;break}for(;Y<3;){if(0===C)break A;C--,I+=E[o++]<>>=1)){case 0:t.mode=14;break;case 1:if(h(t),t.mode=20,6!==B)break;I>>>=2,Y-=2;break A;case 2:t.mode=17;break;case 3:A.msg="invalid block type",t.mode=30}I>>>=2,Y-=2;break;case 14:for(I>>>=7&Y,Y-=7&Y;Y<32;){if(0===C)break A;C--,I+=E[o++]<>>16^65535)){A.msg="invalid stored block lengths",t.mode=30;break}if(t.length=65535&I,Y=I=0,t.mode=15,6===B)break A;case 15:t.mode=16;case 16:if(u=t.length){if(C>>=5,Y-=5,t.ndist=1+(31&I),I>>>=5,Y-=5,t.ncode=4+(15&I),I>>>=4,Y-=4,286>>=3,Y-=3}for(;t.have<19;)t.lens[j[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,J={bits:t.lenbits},p=s(0,t.lens,0,19,t.lencode,0,t.work,J),t.lenbits=J.bits,p){A.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have>>16&255,m=65535&k,!((U=k>>>24)<=Y);){if(0===C)break A;C--,I+=E[o++]<>>=U,Y-=U,t.lens[t.have++]=m;else{if(16===m){for(y=U+2;Y>>=U,Y-=U,0===t.have){A.msg="invalid bit length repeat",t.mode=30;break}R=t.lens[t.have-1],u=3+(3&I),I>>>=2,Y-=2}else if(17===m){for(y=U+3;Y>>=U)),I>>>=3,Y-=3}else{for(y=U+7;Y>>=U)),I>>>=7,Y-=7}if(t.have+u>t.nlen+t.ndist){A.msg="invalid bit length repeat",t.mode=30;break}for(;u--;)t.lens[t.have++]=R}}if(30===t.mode)break;if(0===t.lens[256]){A.msg="invalid code -- missing end-of-block",t.mode=30;break}if(t.lenbits=9,J={bits:t.lenbits},p=s(1,t.lens,0,t.nlen,t.lencode,0,t.work,J),t.lenbits=J.bits,p){A.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,J={bits:t.distbits},p=s(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,J),t.distbits=J.bits,p){A.msg="invalid distances set",t.mode=30;break}if(t.mode=20,6===B)break A;case 20:t.mode=21;case 21:if(6<=C&&258<=a){A.next_out=w,A.avail_out=a,A.next_in=o,A.avail_in=C,t.hold=I,t.bits=Y,Q(A,D),w=A.next_out,c=A.output,a=A.avail_out,o=A.next_in,E=A.input,C=A.avail_in,I=t.hold,Y=t.bits,12===t.mode&&(t.back=-1);break}for(t.back=0;N=(k=t.lencode[I&(1<>>16&255,m=65535&k,!((U=k>>>24)<=Y);){if(0===C)break A;C--,I+=E[o++]<>G)])>>>16&255,m=65535&k,!(G+(U=k>>>24)<=Y);){if(0===C)break A;C--,I+=E[o++]<>>=G,Y-=G,t.back+=G}if(I>>>=U,Y-=U,t.back+=U,t.length=m,0===N){t.mode=26;break}if(32&N){t.back=-1,t.mode=12;break}if(64&N){A.msg="invalid literal/length code",t.mode=30;break}t.extra=15&N,t.mode=22;case 22:if(t.extra){for(y=t.extra;Y>>=t.extra,Y-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;N=(k=t.distcode[I&(1<>>16&255,m=65535&k,!((U=k>>>24)<=Y);){if(0===C)break A;C--,I+=E[o++]<>G)])>>>16&255,m=65535&k,!(G+(U=k>>>24)<=Y);){if(0===C)break A;C--,I+=E[o++]<>>=G,Y-=G,t.back+=G}if(I>>>=U,Y-=U,t.back+=U,64&N){A.msg="invalid distance code",t.mode=30;break}t.offset=m,t.extra=15&N,t.mode=24;case 24:if(t.extra){for(y=t.extra;Y>>=t.extra,Y-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){A.msg="invalid distance too far back",t.mode=30;break}t.mode=25;case 25:if(0===a)break A;if(u=D-a,t.offset>u){if((u=t.offset-u)>t.whave&&t.sane){A.msg="invalid distance too far back",t.mode=30;break}l=u>t.wnext?(u-=t.wnext,t.wsize-u):t.wnext-u,u>t.length&&(u=t.length),d=t.window}else d=c,l=w-t.offset,u=t.length;for(ah?(F=j[x+c[d]],J[y+c[d]]):(F=96,0),w=1<>f)+(C-=w)]=M<<24|F<<16|D|0,0!==C;);for(w=1<>=1;if(0!==w?(p&=w-1,p+=w):p=0,d++,0==--k[l]){if(l===N)break;l=B[t+c[d]]}if(m>>7)]}function U(A,B){A.pending_buf[A.pending++]=255&B,A.pending_buf[A.pending++]=B>>>8&255}function N(A,B,t){A.bi_valid>16-t?(A.bi_buf|=B<>16-A.bi_valid,A.bi_valid+=t-16):(A.bi_buf|=B<>>=1,t<<=1,0<--B;);return t>>>1}function f(A,B,t){var e,g,i=new Array(16),Q=0;for(e=1;e<=n;e++)i[e]=Q=Q+t[e-1]<<1;for(g=0;g<=B;g++){var s=A[2*g+1];0!==s&&(A[2*g]=G(i[s]++,s))}}function H(A){var B;for(B=0;B>1;1<=t;t--)J(A,i,t);for(g=r;t=A.heap[1],A.heap[1]=A.heap[A.heap_len--],J(A,i,1),e=A.heap[1],A.heap[--A.heap_max]=t,A.heap[--A.heap_max]=e,i[2*g]=i[2*t]+i[2*e],A.depth[g]=(A.depth[t]>=A.depth[e]?A.depth[t]:A.depth[e])+1,i[2*t+1]=i[2*e+1]=g,A.heap[1]=g++,J(A,i,1),2<=A.heap_len;);A.heap[--A.heap_max]=A.heap[1],function(A,B){var t,e,g,i,Q,s,r=B.dyn_tree,E=B.max_code,c=B.stat_desc.static_tree,o=B.stat_desc.has_stree,w=B.stat_desc.extra_bits,C=B.stat_desc.extra_base,a=B.stat_desc.max_length,I=0;for(i=0;i<=n;i++)A.bl_count[i]=0;for(r[2*A.heap[A.heap_max]+1]=0,t=A.heap_max+1;t<573;t++)a<(i=r[2*r[2*(e=A.heap[t])+1]+1]+1)&&(i=a,I++),r[2*e+1]=i,E>=7;e>>=1)if(1&t&&0!==A.dyn_ltree[2*B])return 0;if(0!==A.dyn_ltree[18]||0!==A.dyn_ltree[20]||0!==A.dyn_ltree[26])return 1;for(B=32;B>>3,(Q=A.static_len+3+7>>>3)<=g&&(g=Q)):g=Q=t+5,t+4<=g&&-1!==B?S(A,B,t,e):4===A.strategy||Q===g?(N(A,2+(e?1:0),3),y(A,w,C)):(N(A,4+(e?1:0),3),function(A,B,t,e){var g;for(N(A,B-257,5),N(A,t-1,5),N(A,e-4,4),g=0;g>>8&255,A.pending_buf[A.d_buf+2*A.last_lit+1]=255&B,A.pending_buf[A.l_buf+A.last_lit]=255&t,A.last_lit++,0===B?A.dyn_ltree[2*t]++:(A.matches++,B--,A.dyn_ltree[2*(I[t]+i+1)]++,A.dyn_dtree[2*d(B)]++),A.last_lit===A.lit_bufsize-1},t._tr_align=function(A){N(A,2,3),m(A,256,w),function(A){16===A.bi_valid?(U(A,A.bi_buf),A.bi_buf=0,A.bi_valid=0):8<=A.bi_valid&&(A.pending_buf[A.pending++]=255&A.bi_buf,A.bi_buf>>=8,A.bi_valid-=8)}(A)}},{"../utils/common":41}],53:[function(A,B,t){"use strict";B.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(A,B,t){(function(A){!function(A,B){"use strict";if(!A.setImmediate){var t,e,i,Q,s=1,n={},r=!1,E=A.document,c=Object.getPrototypeOf&&Object.getPrototypeOf(A);c=c&&c.setTimeout?c:A,t="[object process]"==={}.toString.call(A.process)?function(A){g.nextTick((function(){w(A)}))}:function(){if(A.postMessage&&!A.importScripts){var B=!0,t=A.onmessage;return A.onmessage=function(){B=!1},A.postMessage("","*"),A.onmessage=t,B}}()?(Q="setImmediate$"+Math.random()+"$",A.addEventListener?A.addEventListener("message",C,!1):A.attachEvent("onmessage",C),function(B){A.postMessage(Q+B,"*")}):A.MessageChannel?((i=new MessageChannel).port1.onmessage=function(A){w(A.data)},function(A){i.port2.postMessage(A)}):E&&"onreadystatechange"in E.createElement("script")?(e=E.documentElement,function(A){var B=E.createElement("script");B.onreadystatechange=function(){w(A),B.onreadystatechange=null,e.removeChild(B),B=null},e.appendChild(B)}):function(A){setTimeout(w,0,A)},c.setImmediate=function(A){"function"!=typeof A&&(A=new Function(""+A));for(var B=new Array(arguments.length-1),e=0;e>24&255;return{r:A>>16&255,g:A>>8&255,b:255&A,a:B>0?B:255}}static hexToRgb(A){A.startsWith("#")&&(A=A.substring(1));const B=parseInt(A,16);if(isNaN(B))return null;if(6===A.length)return{r:B>>16&255,g:B>>8&255,b:255&B};if(3===A.length){const A=B>>8&15,t=B>>4&15,e=15&B;return{r:A<<4|A,g:t<<4|t,b:e<<4|e}}return null}static rgbToHex(A){return t.decimalToHex(t.rgbToDecimal(A))}static rgbToDecimal(A){return(A.r<<16)+(A.g<<8)+A.b}static hexToDecimal(A){return t.rgbToDecimal(t.hexToRgb(A))}static hsvToRgb(A){let B=A.h%360;B<0&&(B+=360);const t=Math.max(0,Math.min(A.s,1)),e=Math.max(0,Math.min(A.v,1)),g=Math.floor(B/60),i=B/60-g,Q=e*(1-t),s=e*(1-t*i),n=e*(1-t*(1-i));let r,E,c;switch(g){default:case 0:r=e,E=n,c=Q;break;case 1:r=s,E=e,c=Q;break;case 2:r=Q,E=e,c=n;break;case 3:r=Q,E=s,c=e;break;case 4:r=n,E=Q,c=e;break;case 5:r=e,E=Q,c=s}return{r:Math.floor(255*r),g:Math.floor(255*E),b:Math.floor(255*c)}}static rgbToHsv(A){const B=A.r/255,t=A.g/255,e=A.b/255,g=Math.min(Math.min(B,t),e),i=Math.max(Math.max(B,t),e);let Q=0,s=0;if(g!==i){Q=60*((B===g?3:t===g?5:1)-(B===g?t-e:t===g?e-B:B-t)/(i-g))%360,s=(i-g)/i}return{h:Q,s:s,v:i}}static mixRgb(A,B,t){if(t<=0)return A;if(t>=1)return B;const e=1-t;return{r:e*A.r+t*B.r,g:e*A.g+t*B.g,b:e*A.b+t*B.b}}}A.exports=t},function(A,B,t){A.exports=function(){"use strict";var A=Array.prototype.slice;function B(A,B){B&&(A.prototype=Object.create(B.prototype)),A.prototype.constructor=A}function t(A){return Q(A)?A:L(A)}function e(A){return s(A)?A:P(A)}function g(A){return n(A)?A:v(A)}function i(A){return Q(A)&&!r(A)?A:W(A)}function Q(A){return!(!A||!A[c])}function s(A){return!(!A||!A[o])}function n(A){return!(!A||!A[w])}function r(A){return s(A)||n(A)}function E(A){return!(!A||!A[C])}B(e,t),B(g,t),B(i,t),t.isIterable=Q,t.isKeyed=s,t.isIndexed=n,t.isAssociative=r,t.isOrdered=E,t.Keyed=e,t.Indexed=g,t.Set=i;var c="@@__IMMUTABLE_ITERABLE__@@",o="@@__IMMUTABLE_KEYED__@@",w="@@__IMMUTABLE_INDEXED__@@",C="@@__IMMUTABLE_ORDERED__@@",a={},I={value:!1},Y={value:!1};function h(A){return A.value=!1,A}function M(A){A&&(A.value=!0)}function F(){}function D(A,B){B=B||0;for(var t=Math.max(0,A.length-B),e=new Array(t),g=0;g>>0;if(""+t!==B||4294967295===t)return NaN;B=t}return B<0?u(A)+B:B}function d(){return!0}function U(A,B,t){return(0===A||void 0!==t&&A<=-t)&&(void 0===B||void 0!==t&&B>=t)}function N(A,B){return G(A,B,0)}function m(A,B){return G(A,B,B)}function G(A,B,t){return void 0===A?t:A<0?Math.max(0,B+A):void 0===B?A:Math.min(B,A)}var f,H,R,p="function"==typeof Symbol&&Symbol.iterator,J=p||"@@iterator";function y(A){this.next=A}function k(A,B,t,e){var g=0===A?B:1===A?t:[B,t];return e?e.value=g:e={value:g,done:!1},e}function T(){return{value:void 0,done:!0}}function j(A){return!!b(A)}function x(A){return A&&"function"==typeof A.next}function S(A){var B=b(A);return B&&B.call(A)}function b(A){var B=A&&(p&&A[p]||A["@@iterator"]);if("function"==typeof B)return B}function z(A){return A&&"number"==typeof A.length}function L(A){return null==A?_():Q(A)?A.toSeq():function(A){var B=AA(A)||"object"==typeof A&&new K(A);if(!B)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+A);return B}(A)}function P(A){return null==A?_().toKeyedSeq():Q(A)?s(A)?A.toSeq():A.fromEntrySeq():q(A)}function v(A){return null==A?_():Q(A)?s(A)?A.entrySeq():A.toIndexedSeq():$(A)}function W(A){return(null==A?_():Q(A)?s(A)?A.entrySeq():A:$(A)).toSetSeq()}function V(A){this._array=A,this.size=A.length}function K(A){var B=Object.keys(A);this._object=A,this._keys=B,this.size=B.length}function O(A){this._iterable=A,this.size=A.length||A.size}function X(A){this._iterator=A,this._iteratorCache=[]}function Z(A){return!(!A||!A["@@__IMMUTABLE_SEQ__@@"])}function _(){return f||(f=new V([]))}function q(A){var B=Array.isArray(A)?new V(A).fromEntrySeq():x(A)?new X(A).fromEntrySeq():j(A)?new O(A).fromEntrySeq():"object"==typeof A?new K(A):void 0;if(!B)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+A);return B}function $(A){var B=AA(A);if(!B)throw new TypeError("Expected Array or iterable object of values: "+A);return B}function AA(A){return z(A)?new V(A):x(A)?new X(A):j(A)?new O(A):void 0}function BA(A,B,t,e){var g=A._cache;if(g){for(var i=g.length-1,Q=0;Q<=i;Q++){var s=g[t?i-Q:Q];if(!1===B(s[1],e?s[0]:Q,A))return Q+1}return Q}return A.__iterateUncached(B,t)}function tA(A,B,t,e){var g=A._cache;if(g){var i=g.length-1,Q=0;return new y((function(){var A=g[t?i-Q:Q];return Q++>i?{value:void 0,done:!0}:k(B,e?A[0]:Q-1,A[1])}))}return A.__iteratorUncached(B,t)}function eA(A,B){return B?function A(B,t,e,g){return Array.isArray(t)?B.call(g,e,v(t).map((function(e,g){return A(B,e,g,t)}))):iA(t)?B.call(g,e,P(t).map((function(e,g){return A(B,e,g,t)}))):t}(B,A,"",{"":A}):gA(A)}function gA(A){return Array.isArray(A)?v(A).map(gA).toList():iA(A)?P(A).map(gA).toMap():A}function iA(A){return A&&(A.constructor===Object||void 0===A.constructor)}function QA(A,B){if(A===B||A!=A&&B!=B)return!0;if(!A||!B)return!1;if("function"==typeof A.valueOf&&"function"==typeof B.valueOf){if((A=A.valueOf())===(B=B.valueOf())||A!=A&&B!=B)return!0;if(!A||!B)return!1}return!("function"!=typeof A.equals||"function"!=typeof B.equals||!A.equals(B))}function sA(A,B){if(A===B)return!0;if(!Q(B)||void 0!==A.size&&void 0!==B.size&&A.size!==B.size||void 0!==A.__hash&&void 0!==B.__hash&&A.__hash!==B.__hash||s(A)!==s(B)||n(A)!==n(B)||E(A)!==E(B))return!1;if(0===A.size&&0===B.size)return!0;var t=!r(A);if(E(A)){var e=A.entries();return B.every((function(A,B){var g=e.next().value;return g&&QA(g[1],A)&&(t||QA(g[0],B))}))&&e.next().done}var g=!1;if(void 0===A.size)if(void 0===B.size)"function"==typeof A.cacheResult&&A.cacheResult();else{g=!0;var i=A;A=B,B=i}var c=!0,o=B.__iterate((function(B,e){if(t?!A.has(B):g?!QA(B,A.get(e,a)):!QA(A.get(e,a),B))return c=!1,!1}));return c&&A.size===o}function nA(A,B){if(!(this instanceof nA))return new nA(A,B);if(this._value=A,this.size=void 0===B?1/0:Math.max(0,B),0===this.size){if(H)return H;H=this}}function rA(A,B){if(!A)throw new Error(B)}function EA(A,B,t){if(!(this instanceof EA))return new EA(A,B,t);if(rA(0!==t,"Cannot step a Range by 0"),A=A||0,void 0===B&&(B=1/0),t=void 0===t?1:Math.abs(t),Be?{value:void 0,done:!0}:k(A,g,t[B?e-g++:g++])}))},B(K,P),K.prototype.get=function(A,B){return void 0===B||this.has(A)?this._object[A]:B},K.prototype.has=function(A){return this._object.hasOwnProperty(A)},K.prototype.__iterate=function(A,B){for(var t=this._object,e=this._keys,g=e.length-1,i=0;i<=g;i++){var Q=e[B?g-i:i];if(!1===A(t[Q],Q,this))return i+1}return i},K.prototype.__iterator=function(A,B){var t=this._object,e=this._keys,g=e.length-1,i=0;return new y((function(){var Q=e[B?g-i:i];return i++>g?{value:void 0,done:!0}:k(A,Q,t[Q])}))},K.prototype[C]=!0,B(O,v),O.prototype.__iterateUncached=function(A,B){if(B)return this.cacheResult().__iterate(A,B);var t=S(this._iterable),e=0;if(x(t))for(var g;!(g=t.next()).done&&!1!==A(g.value,e++,this););return e},O.prototype.__iteratorUncached=function(A,B){if(B)return this.cacheResult().__iterator(A,B);var t=S(this._iterable);if(!x(t))return new y(T);var e=0;return new y((function(){var B=t.next();return B.done?B:k(A,e++,B.value)}))},B(X,v),X.prototype.__iterateUncached=function(A,B){if(B)return this.cacheResult().__iterate(A,B);for(var t,e=this._iterator,g=this._iteratorCache,i=0;i=e.length){var B=t.next();if(B.done)return B;e[g]=B.value}return k(A,g,e[g++])}))},B(nA,v),nA.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},nA.prototype.get=function(A,B){return this.has(A)?this._value:B},nA.prototype.includes=function(A){return QA(this._value,A)},nA.prototype.slice=function(A,B){var t=this.size;return U(A,B,t)?this:new nA(this._value,m(B,t)-N(A,t))},nA.prototype.reverse=function(){return this},nA.prototype.indexOf=function(A){return QA(this._value,A)?0:-1},nA.prototype.lastIndexOf=function(A){return QA(this._value,A)?this.size:-1},nA.prototype.__iterate=function(A,B){for(var t=0;t=0&&B=0&&tt?{value:void 0,done:!0}:k(A,i++,Q)}))},EA.prototype.equals=function(A){return A instanceof EA?this._start===A._start&&this._end===A._end&&this._step===A._step:sA(this,A)},B(cA,t),B(oA,cA),B(wA,cA),B(CA,cA),cA.Keyed=oA,cA.Indexed=wA,cA.Set=CA;var aA="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(A,B){var t=65535&(A|=0),e=65535&(B|=0);return t*e+((A>>>16)*e+t*(B>>>16)<<16>>>0)|0};function IA(A){return A>>>1&1073741824|3221225471&A}function YA(A){if(!1===A||null==A)return 0;if("function"==typeof A.valueOf&&(!1===(A=A.valueOf())||null==A))return 0;if(!0===A)return 1;var B=typeof A;if("number"===B){if(A!=A||A===1/0)return 0;var t=0|A;for(t!==A&&(t^=4294967295*A);A>4294967295;)t^=A/=4294967295;return IA(t)}if("string"===B)return A.length>UA?function(A){var B=GA[A];return void 0===B&&(B=hA(A),mA===NA&&(mA=0,GA={}),mA++,GA[A]=B),B}(A):hA(A);if("function"==typeof A.hashCode)return A.hashCode();if("object"===B)return function(A){var B;if(uA&&void 0!==(B=MA.get(A)))return B;if(void 0!==(B=A[dA]))return B;if(!DA){if(void 0!==(B=A.propertyIsEnumerable&&A.propertyIsEnumerable[dA]))return B;if(void 0!==(B=function(A){if(A&&A.nodeType>0)switch(A.nodeType){case 1:return A.uniqueID;case 9:return A.documentElement&&A.documentElement.uniqueID}}(A)))return B}if(B=++lA,1073741824&lA&&(lA=0),uA)MA.set(A,B);else{if(void 0!==FA&&!1===FA(A))throw new Error("Non-extensible objects are not allowed as keys.");if(DA)Object.defineProperty(A,dA,{enumerable:!1,configurable:!1,writable:!1,value:B});else if(void 0!==A.propertyIsEnumerable&&A.propertyIsEnumerable===A.constructor.prototype.propertyIsEnumerable)A.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},A.propertyIsEnumerable[dA]=B;else{if(void 0===A.nodeType)throw new Error("Unable to set a non-enumerable property on object.");A[dA]=B}}return B}(A);if("function"==typeof A.toString)return hA(A.toString());throw new Error("Value type "+B+" cannot be hashed.")}function hA(A){for(var B=0,t=0;t=B.length)throw new Error("Missing value for key: "+B[t]);A.set(B[t],B[t+1])}}))},HA.prototype.toString=function(){return this.__toString("Map {","}")},HA.prototype.get=function(A,B){return this._root?this._root.get(0,void 0,A,B):B},HA.prototype.set=function(A,B){return WA(this,A,B)},HA.prototype.setIn=function(A,B){return this.updateIn(A,a,(function(){return B}))},HA.prototype.remove=function(A){return WA(this,A,a)},HA.prototype.deleteIn=function(A){return this.updateIn(A,(function(){return a}))},HA.prototype.update=function(A,B,t){return 1===arguments.length?A(this):this.updateIn([A],B,t)},HA.prototype.updateIn=function(A,B,t){t||(t=B,B=void 0);var e=function A(B,t,e,g){var i=B===a,Q=t.next();if(Q.done){var s=i?e:B,n=g(s);return n===s?B:n}rA(i||B&&B.set,"invalid keyPath");var r=Q.value,E=i?a:B.get(r,a),c=A(E,t,e,g);return c===E?B:c===a?B.remove(r):(i?vA():B).set(r,c)}(this,XB(A),B,t);return e===a?void 0:e},HA.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):vA()},HA.prototype.merge=function(){return XA(this,void 0,arguments)},HA.prototype.mergeWith=function(B){var t=A.call(arguments,1);return XA(this,B,t)},HA.prototype.mergeIn=function(B){var t=A.call(arguments,1);return this.updateIn(B,vA(),(function(A){return"function"==typeof A.merge?A.merge.apply(A,t):t[t.length-1]}))},HA.prototype.mergeDeep=function(){return XA(this,ZA,arguments)},HA.prototype.mergeDeepWith=function(B){var t=A.call(arguments,1);return XA(this,_A(B),t)},HA.prototype.mergeDeepIn=function(B){var t=A.call(arguments,1);return this.updateIn(B,vA(),(function(A){return"function"==typeof A.mergeDeep?A.mergeDeep.apply(A,t):t[t.length-1]}))},HA.prototype.sort=function(A){return DB(xB(this,A))},HA.prototype.sortBy=function(A,B){return DB(xB(this,B,A))},HA.prototype.withMutations=function(A){var B=this.asMutable();return A(B),B.wasAltered()?B.__ensureOwner(this.__ownerID):this},HA.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new F)},HA.prototype.asImmutable=function(){return this.__ensureOwner()},HA.prototype.wasAltered=function(){return this.__altered},HA.prototype.__iterator=function(A,B){return new bA(this,A,B)},HA.prototype.__iterate=function(A,B){var t=this,e=0;return this._root&&this._root.iterate((function(B){return e++,A(B[1],B[0],t)}),B),e},HA.prototype.__ensureOwner=function(A){return A===this.__ownerID?this:A?PA(this.size,this._root,A,this.__hash):(this.__ownerID=A,this.__altered=!1,this)},HA.isMap=RA;var pA,JA="@@__IMMUTABLE_MAP__@@",yA=HA.prototype;function kA(A,B){this.ownerID=A,this.entries=B}function TA(A,B,t){this.ownerID=A,this.bitmap=B,this.nodes=t}function jA(A,B,t){this.ownerID=A,this.count=B,this.nodes=t}function xA(A,B,t){this.ownerID=A,this.keyHash=B,this.entries=t}function SA(A,B,t){this.ownerID=A,this.keyHash=B,this.entry=t}function bA(A,B,t){this._type=B,this._reverse=t,this._stack=A._root&&LA(A._root)}function zA(A,B){return k(A,B[0],B[1])}function LA(A,B){return{node:A,index:0,__prev:B}}function PA(A,B,t,e){var g=Object.create(yA);return g.size=A,g._root=B,g.__ownerID=t,g.__hash=e,g.__altered=!1,g}function vA(){return pA||(pA=PA(0))}function WA(A,B,t){var e,g;if(A._root){var i=h(I),Q=h(Y);if(e=VA(A._root,A.__ownerID,0,void 0,B,t,i,Q),!Q.value)return A;g=A.size+(i.value?t===a?-1:1:0)}else{if(t===a)return A;g=1,e=new kA(A.__ownerID,[[B,t]])}return A.__ownerID?(A.size=g,A._root=e,A.__hash=void 0,A.__altered=!0,A):e?PA(g,e):vA()}function VA(A,B,t,e,g,i,Q,s){return A?A.update(B,t,e,g,i,Q,s):i===a?A:(M(s),M(Q),new SA(B,e,[g,i]))}function KA(A){return A.constructor===SA||A.constructor===xA}function OA(A,B,t,e,g){if(A.keyHash===e)return new xA(B,e,[A.entry,g]);var i,Q=31&(0===t?A.keyHash:A.keyHash>>>t),s=31&(0===t?e:e>>>t);return new TA(B,1<>1&1431655765))+(A>>2&858993459))+(A>>4)&252645135,A+=A>>8,127&(A+=A>>16)}function AB(A,B,t,e){var g=e?A:D(A);return g[B]=t,g}yA[JA]=!0,yA.delete=yA.remove,yA.removeIn=yA.deleteIn,kA.prototype.get=function(A,B,t,e){for(var g=this.entries,i=0,Q=g.length;i=BB)return function(A,B,t,e){A||(A=new F);for(var g=new SA(A,YA(t),[t,e]),i=0;i>>A)),i=this.bitmap;return 0==(i&g)?e:this.nodes[$A(i&g-1)].get(A+5,B,t,e)},TA.prototype.update=function(A,B,t,e,g,i,Q){void 0===t&&(t=YA(e));var s=31&(0===B?t:t>>>B),n=1<=tB)return function(A,B,t,e,g){for(var i=0,Q=new Array(32),s=0;0!==t;s++,t>>>=1)Q[s]=1&t?B[i++]:void 0;return Q[e]=g,new jA(A,i+1,Q)}(A,o,r,s,C);if(E&&!C&&2===o.length&&KA(o[1^c]))return o[1^c];if(E&&C&&1===o.length&&KA(C))return C;var I=A&&A===this.ownerID,Y=E?C?r:r^n:r|n,h=E?C?AB(o,c,C,I):function(A,B,t){var e=A.length-1;if(t&&B===e)return A.pop(),A;for(var g=new Array(e),i=0,Q=0;Q>>A),i=this.nodes[g];return i?i.get(A+5,B,t,e):e},jA.prototype.update=function(A,B,t,e,g,i,Q){void 0===t&&(t=YA(e));var s=31&(0===B?t:t>>>B),n=g===a,r=this.nodes,E=r[s];if(n&&!E)return this;var c=VA(E,A,B+5,t,e,g,i,Q);if(c===E)return this;var o=this.count;if(E){if(!c&&--o0&&e<32?wB(0,e,5,null,new nB(t.toArray())):B.withMutations((function(A){A.setSize(e),t.forEach((function(B,t){return A.set(t,B)}))})))}function iB(A){return!(!A||!A[QB])}B(gB,wA),gB.of=function(){return this(arguments)},gB.prototype.toString=function(){return this.__toString("List [","]")},gB.prototype.get=function(A,B){if((A=l(this,A))>=0&&A=A.size||B<0)return A.withMutations((function(A){B<0?hB(A,B).set(0,t):hB(A,0,B+1).set(B,t)}));B+=A._origin;var e=A._tail,g=A._root,i=h(Y);return B>=FB(A._capacity)?e=aB(e,A.__ownerID,0,B,t,i):g=aB(g,A.__ownerID,A._level,B,t,i),i.value?A.__ownerID?(A._root=g,A._tail=e,A.__hash=void 0,A.__altered=!0,A):wB(A._origin,A._capacity,A._level,g,e):A}(this,A,B)},gB.prototype.remove=function(A){return this.has(A)?0===A?this.shift():A===this.size-1?this.pop():this.splice(A,1):this},gB.prototype.insert=function(A,B){return this.splice(A,0,B)},gB.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):CB()},gB.prototype.push=function(){var A=arguments,B=this.size;return this.withMutations((function(t){hB(t,0,B+A.length);for(var e=0;e>>B&31;if(e>=this.array.length)return new nB([],A);var g,i=0===e;if(B>0){var Q=this.array[e];if((g=Q&&Q.removeBefore(A,B-5,t))===Q&&i)return this}if(i&&!g)return this;var s=IB(this,A);if(!i)for(var n=0;n>>B&31;if(g>=this.array.length)return this;if(B>0){var i=this.array[g];if((e=i&&i.removeAfter(A,B-5,t))===i&&g===this.array.length-1)return this}var Q=IB(this,A);return Q.array.splice(g+1),e&&(Q.array[g]=e),Q};var rB,EB,cB={};function oB(A,B){var t=A._origin,e=A._capacity,g=FB(e),i=A._tail;return Q(A._root,A._level,0);function Q(A,s,n){return 0===s?function(A,Q){var s=Q===g?i&&i.array:A&&A.array,n=Q>t?0:t-Q,r=e-Q;return r>32&&(r=32),function(){if(n===r)return cB;var A=B?--r:n++;return s&&s[A]}}(A,n):function(A,g,i){var s,n=A&&A.array,r=i>t?0:t-i>>g,E=1+(e-i>>g);return E>32&&(E=32),function(){for(;;){if(s){var A=s();if(A!==cB)return A;s=null}if(r===E)return cB;var t=B?--E:r++;s=Q(n&&n[t],g-5,i+(t<>>t&31,n=A&&s0){var r=A&&A.array[s],E=aB(r,B,t-5,e,g,i);return E===r?A:((Q=IB(A,B)).array[s]=E,Q)}return n&&A.array[s]===g?A:(M(i),Q=IB(A,B),void 0===g&&s===Q.array.length-1?Q.array.pop():Q.array[s]=g,Q)}function IB(A,B){return B&&A&&B===A.ownerID?A:new nB(A?A.array.slice():[],B)}function YB(A,B){if(B>=FB(A._capacity))return A._tail;if(B<1<0;)t=t.array[B>>>e&31],e-=5;return t}}function hB(A,B,t){void 0!==B&&(B|=0),void 0!==t&&(t|=0);var e=A.__ownerID||new F,g=A._origin,i=A._capacity,Q=g+B,s=void 0===t?i:t<0?i+t:g+t;if(Q===g&&s===i)return A;if(Q>=s)return A.clear();for(var n=A._level,r=A._root,E=0;Q+E<0;)r=new nB(r&&r.array.length?[void 0,r]:[],e),E+=1<<(n+=5);E&&(Q+=E,g+=E,s+=E,i+=E);for(var c=FB(i),o=FB(s);o>=1<c?new nB([],e):w;if(w&&o>c&&Q5;I-=5){var Y=c>>>I&31;a=a.array[Y]=IB(a.array[Y],e)}a.array[c>>>5&31]=w}if(s=o)Q-=o,s-=o,n=5,r=null,C=C&&C.removeBefore(e,0,Q);else if(Q>g||o>>n&31;if(h!==o>>>n&31)break;h&&(E+=(1<g&&(r=r.removeBefore(e,n,Q-E)),r&&oi&&(i=r.size),Q(n)||(r=r.map((function(A){return eA(A)}))),e.push(r)}return i>A.size&&(A=A.setSize(i)),qA(A,B,e)}function FB(A){return A<32?0:A-1>>>5<<5}function DB(A){return null==A?dB():uB(A)?A:dB().withMutations((function(B){var t=e(A);fA(t.size),t.forEach((function(A,t){return B.set(t,A)}))}))}function uB(A){return RA(A)&&E(A)}function lB(A,B,t,e){var g=Object.create(DB.prototype);return g.size=A?A.size:0,g._map=A,g._list=B,g.__ownerID=t,g.__hash=e,g}function dB(){return EB||(EB=lB(vA(),CB()))}function UB(A,B,t){var e,g,i=A._map,Q=A._list,s=i.get(B),n=void 0!==s;if(t===a){if(!n)return A;Q.size>=32&&Q.size>=2*i.size?(e=(g=Q.filter((function(A,B){return void 0!==A&&s!==B}))).toKeyedSeq().map((function(A){return A[0]})).flip().toMap(),A.__ownerID&&(e.__ownerID=g.__ownerID=A.__ownerID)):(e=i.remove(B),g=s===Q.size-1?Q.pop():Q.set(s,void 0))}else if(n){if(t===Q.get(s)[1])return A;e=i,g=Q.set(s,[B,t])}else e=i.set(B,Q.size),g=Q.set(Q.size,[B,t]);return A.__ownerID?(A.size=e.size,A._map=e,A._list=g,A.__hash=void 0,A):lB(e,g)}function NB(A,B){this._iter=A,this._useKeys=B,this.size=A.size}function mB(A){this._iter=A,this.size=A.size}function GB(A){this._iter=A,this.size=A.size}function fB(A){this._iter=A,this.size=A.size}function HB(A){var B=VB(A);return B._iter=A,B.size=A.size,B.flip=function(){return A},B.reverse=function(){var B=A.reverse.apply(this);return B.flip=function(){return A.reverse()},B},B.has=function(B){return A.includes(B)},B.includes=function(B){return A.has(B)},B.cacheResult=KB,B.__iterateUncached=function(B,t){var e=this;return A.__iterate((function(A,t){return!1!==B(t,A,e)}),t)},B.__iteratorUncached=function(B,t){if(2===B){var e=A.__iterator(B,t);return new y((function(){var A=e.next();if(!A.done){var B=A.value[0];A.value[0]=A.value[1],A.value[1]=B}return A}))}return A.__iterator(1===B?0:1,t)},B}function RB(A,B,t){var e=VB(A);return e.size=A.size,e.has=function(B){return A.has(B)},e.get=function(e,g){var i=A.get(e,a);return i===a?g:B.call(t,i,e,A)},e.__iterateUncached=function(e,g){var i=this;return A.__iterate((function(A,g,Q){return!1!==e(B.call(t,A,g,Q),g,i)}),g)},e.__iteratorUncached=function(e,g){var i=A.__iterator(2,g);return new y((function(){var g=i.next();if(g.done)return g;var Q=g.value,s=Q[0];return k(e,s,B.call(t,Q[1],s,A),g)}))},e}function pB(A,B){var t=VB(A);return t._iter=A,t.size=A.size,t.reverse=function(){return A},A.flip&&(t.flip=function(){var B=HB(A);return B.reverse=function(){return A.flip()},B}),t.get=function(t,e){return A.get(B?t:-1-t,e)},t.has=function(t){return A.has(B?t:-1-t)},t.includes=function(B){return A.includes(B)},t.cacheResult=KB,t.__iterate=function(B,t){var e=this;return A.__iterate((function(A,t){return B(A,t,e)}),!t)},t.__iterator=function(B,t){return A.__iterator(B,!t)},t}function JB(A,B,t,e){var g=VB(A);return e&&(g.has=function(e){var g=A.get(e,a);return g!==a&&!!B.call(t,g,e,A)},g.get=function(e,g){var i=A.get(e,a);return i!==a&&B.call(t,i,e,A)?i:g}),g.__iterateUncached=function(g,i){var Q=this,s=0;return A.__iterate((function(A,i,n){if(B.call(t,A,i,n))return s++,g(A,e?i:s-1,Q)}),i),s},g.__iteratorUncached=function(g,i){var Q=A.__iterator(2,i),s=0;return new y((function(){for(;;){var i=Q.next();if(i.done)return i;var n=i.value,r=n[0],E=n[1];if(B.call(t,E,r,A))return k(g,e?r:s++,E,i)}}))},g}function yB(A,B,t,e){var g=A.size;if(void 0!==B&&(B|=0),void 0!==t&&(t===1/0?t=g:t|=0),U(B,t,g))return A;var i=N(B,g),Q=m(t,g);if(i!=i||Q!=Q)return yB(A.toSeq().cacheResult(),B,t,e);var s,n=Q-i;n==n&&(s=n<0?0:n);var r=VB(A);return r.size=0===s?s:A.size&&s||void 0,!e&&Z(A)&&s>=0&&(r.get=function(B,t){return(B=l(this,B))>=0&&Bs)return{value:void 0,done:!0};var A=g.next();return e||1===B?A:k(B,n-1,0===B?void 0:A.value[1],A)}))},r}function kB(A,B,t,e){var g=VB(A);return g.__iterateUncached=function(g,i){var Q=this;if(i)return this.cacheResult().__iterate(g,i);var s=!0,n=0;return A.__iterate((function(A,i,r){if(!s||!(s=B.call(t,A,i,r)))return n++,g(A,e?i:n-1,Q)})),n},g.__iteratorUncached=function(g,i){var Q=this;if(i)return this.cacheResult().__iterator(g,i);var s=A.__iterator(2,i),n=!0,r=0;return new y((function(){var A,i,E;do{if((A=s.next()).done)return e||1===g?A:k(g,r++,0===g?void 0:A.value[1],A);var c=A.value;i=c[0],E=c[1],n&&(n=B.call(t,E,i,Q))}while(n);return 2===g?A:k(g,i,E,A)}))},g}function TB(A,B){var t=s(A),g=[A].concat(B).map((function(A){return Q(A)?t&&(A=e(A)):A=t?q(A):$(Array.isArray(A)?A:[A]),A})).filter((function(A){return 0!==A.size}));if(0===g.length)return A;if(1===g.length){var i=g[0];if(i===A||t&&s(i)||n(A)&&n(i))return i}var r=new V(g);return t?r=r.toKeyedSeq():n(A)||(r=r.toSetSeq()),(r=r.flatten(!0)).size=g.reduce((function(A,B){if(void 0!==A){var t=B.size;if(void 0!==t)return A+t}}),0),r}function jB(A,B,t){var e=VB(A);return e.__iterateUncached=function(e,g){var i=0,s=!1;return function A(n,r){var E=this;n.__iterate((function(g,n){return(!B||r0}function zB(A,B,e){var g=VB(A);return g.size=new V(e).map((function(A){return A.size})).min(),g.__iterate=function(A,B){for(var t,e=this.__iterator(1,B),g=0;!(t=e.next()).done&&!1!==A(t.value,g++,this););return g},g.__iteratorUncached=function(A,g){var i=e.map((function(A){return A=t(A),S(g?A.reverse():A)})),Q=0,s=!1;return new y((function(){var t;return s||(t=i.map((function(A){return A.next()})),s=t.some((function(A){return A.done}))),s?{value:void 0,done:!0}:k(A,Q++,B.apply(null,t.map((function(A){return A.value}))))}))},g}function LB(A,B){return Z(A)?B:A.constructor(B)}function PB(A){if(A!==Object(A))throw new TypeError("Expected [K, V] tuple: "+A)}function vB(A){return fA(A.size),u(A)}function WB(A){return s(A)?e:n(A)?g:i}function VB(A){return Object.create((s(A)?P:n(A)?v:W).prototype)}function KB(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):L.prototype.cacheResult.call(this)}function OB(A,B){return A>B?1:A=0;t--)B={value:arguments[t],next:B};return this.__ownerID?(this.size=A,this._head=B,this.__hash=void 0,this.__altered=!0,this):Ft(A,B)},at.prototype.pushAll=function(A){if(0===(A=g(A)).size)return this;fA(A.size);var B=this.size,t=this._head;return A.reverse().forEach((function(A){B++,t={value:A,next:t}})),this.__ownerID?(this.size=B,this._head=t,this.__hash=void 0,this.__altered=!0,this):Ft(B,t)},at.prototype.pop=function(){return this.slice(1)},at.prototype.unshift=function(){return this.push.apply(this,arguments)},at.prototype.unshiftAll=function(A){return this.pushAll(A)},at.prototype.shift=function(){return this.pop.apply(this,arguments)},at.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Dt()},at.prototype.slice=function(A,B){if(U(A,B,this.size))return this;var t=N(A,this.size);if(m(B,this.size)!==this.size)return wA.prototype.slice.call(this,A,B);for(var e=this.size-t,g=this._head;t--;)g=g.next;return this.__ownerID?(this.size=e,this._head=g,this.__hash=void 0,this.__altered=!0,this):Ft(e,g)},at.prototype.__ensureOwner=function(A){return A===this.__ownerID?this:A?Ft(this.size,this._head,A,this.__hash):(this.__ownerID=A,this.__altered=!1,this)},at.prototype.__iterate=function(A,B){if(B)return this.reverse().__iterate(A);for(var t=0,e=this._head;e&&!1!==A(e.value,t++,this);)e=e.next;return t},at.prototype.__iterator=function(A,B){if(B)return this.reverse().__iterator(A);var t=0,e=this._head;return new y((function(){if(e){var B=e.value;return e=e.next,k(A,t++,B)}return{value:void 0,done:!0}}))},at.isStack=It;var Yt,ht="@@__IMMUTABLE_STACK__@@",Mt=at.prototype;function Ft(A,B,t,e){var g=Object.create(Mt);return g.size=A,g._head=B,g.__ownerID=t,g.__hash=e,g.__altered=!1,g}function Dt(){return Yt||(Yt=Ft(0))}function ut(A,B){var t=function(t){A.prototype[t]=B[t]};return Object.keys(B).forEach(t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(B).forEach(t),A}Mt[ht]=!0,Mt.withMutations=yA.withMutations,Mt.asMutable=yA.asMutable,Mt.asImmutable=yA.asImmutable,Mt.wasAltered=yA.wasAltered,t.Iterator=y,ut(t,{toArray:function(){fA(this.size);var A=new Array(this.size||0);return this.valueSeq().__iterate((function(B,t){A[t]=B})),A},toIndexedSeq:function(){return new mB(this)},toJS:function(){return this.toSeq().map((function(A){return A&&"function"==typeof A.toJS?A.toJS():A})).__toJS()},toJSON:function(){return this.toSeq().map((function(A){return A&&"function"==typeof A.toJSON?A.toJSON():A})).__toJS()},toKeyedSeq:function(){return new NB(this,!0)},toMap:function(){return HA(this.toKeyedSeq())},toObject:function(){fA(this.size);var A={};return this.__iterate((function(B,t){A[t]=B})),A},toOrderedMap:function(){return DB(this.toKeyedSeq())},toOrderedSet:function(){return rt(s(this)?this.valueSeq():this)},toSet:function(){return Bt(s(this)?this.valueSeq():this)},toSetSeq:function(){return new GB(this)},toSeq:function(){return n(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return at(s(this)?this.valueSeq():this)},toList:function(){return gB(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(A,B){return 0===this.size?A+B:A+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+B},concat:function(){var B=A.call(arguments,0);return LB(this,TB(this,B))},includes:function(A){return this.some((function(B){return QA(B,A)}))},entries:function(){return this.__iterator(2)},every:function(A,B){fA(this.size);var t=!0;return this.__iterate((function(e,g,i){if(!A.call(B,e,g,i))return t=!1,!1})),t},filter:function(A,B){return LB(this,JB(this,A,B,!0))},find:function(A,B,t){var e=this.findEntry(A,B);return e?e[1]:t},forEach:function(A,B){return fA(this.size),this.__iterate(B?A.bind(B):A)},join:function(A){fA(this.size),A=void 0!==A?""+A:",";var B="",t=!0;return this.__iterate((function(e){t?t=!1:B+=A,B+=null!=e?e.toString():""})),B},keys:function(){return this.__iterator(0)},map:function(A,B){return LB(this,RB(this,A,B))},reduce:function(A,B,t){var e,g;return fA(this.size),arguments.length<2?g=!0:e=B,this.__iterate((function(B,i,Q){g?(g=!1,e=B):e=A.call(t,e,B,i,Q)})),e},reduceRight:function(A,B,t){var e=this.toKeyedSeq().reverse();return e.reduce.apply(e,arguments)},reverse:function(){return LB(this,pB(this,!0))},slice:function(A,B){return LB(this,yB(this,A,B,!0))},some:function(A,B){return!this.every(mt(A),B)},sort:function(A){return LB(this,xB(this,A))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(A,B){return u(A?this.toSeq().filter(A,B):this)},countBy:function(A,B){return function(A,B,t){var e=HA().asMutable();return A.__iterate((function(g,i){e.update(B.call(t,g,i,A),0,(function(A){return A+1}))})),e.asImmutable()}(this,A,B)},equals:function(A){return sA(this,A)},entrySeq:function(){var A=this;if(A._cache)return new V(A._cache);var B=A.toSeq().map(Nt).toIndexedSeq();return B.fromEntrySeq=function(){return A.toSeq()},B},filterNot:function(A,B){return this.filter(mt(A),B)},findEntry:function(A,B,t){var e=t;return this.__iterate((function(t,g,i){if(A.call(B,t,g,i))return e=[g,t],!1})),e},findKey:function(A,B){var t=this.findEntry(A,B);return t&&t[0]},findLast:function(A,B,t){return this.toKeyedSeq().reverse().find(A,B,t)},findLastEntry:function(A,B,t){return this.toKeyedSeq().reverse().findEntry(A,B,t)},findLastKey:function(A,B){return this.toKeyedSeq().reverse().findKey(A,B)},first:function(){return this.find(d)},flatMap:function(A,B){return LB(this,function(A,B,t){var e=WB(A);return A.toSeq().map((function(g,i){return e(B.call(t,g,i,A))})).flatten(!0)}(this,A,B))},flatten:function(A){return LB(this,jB(this,A,!0))},fromEntrySeq:function(){return new fB(this)},get:function(A,B){return this.find((function(B,t){return QA(t,A)}),void 0,B)},getIn:function(A,B){for(var t,e=this,g=XB(A);!(t=g.next()).done;){var i=t.value;if((e=e&&e.get?e.get(i,a):a)===a)return B}return e},groupBy:function(A,B){return function(A,B,t){var e=s(A),g=(E(A)?DB():HA()).asMutable();A.__iterate((function(i,Q){g.update(B.call(t,i,Q,A),(function(A){return(A=A||[]).push(e?[Q,i]:i),A}))}));var i=WB(A);return g.map((function(B){return LB(A,i(B))}))}(this,A,B)},has:function(A){return this.get(A,a)!==a},hasIn:function(A){return this.getIn(A,a)!==a},isSubset:function(A){return A="function"==typeof A.includes?A:t(A),this.every((function(B){return A.includes(B)}))},isSuperset:function(A){return(A="function"==typeof A.isSubset?A:t(A)).isSubset(this)},keyOf:function(A){return this.findKey((function(B){return QA(B,A)}))},keySeq:function(){return this.toSeq().map(Ut).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(A){return this.toKeyedSeq().reverse().keyOf(A)},max:function(A){return SB(this,A)},maxBy:function(A,B){return SB(this,B,A)},min:function(A){return SB(this,A?Gt(A):Rt)},minBy:function(A,B){return SB(this,B?Gt(B):Rt,A)},rest:function(){return this.slice(1)},skip:function(A){return this.slice(Math.max(0,A))},skipLast:function(A){return LB(this,this.toSeq().reverse().skip(A).reverse())},skipWhile:function(A,B){return LB(this,kB(this,A,B,!0))},skipUntil:function(A,B){return this.skipWhile(mt(A),B)},sortBy:function(A,B){return LB(this,xB(this,B,A))},take:function(A){return this.slice(0,Math.max(0,A))},takeLast:function(A){return LB(this,this.toSeq().reverse().take(A).reverse())},takeWhile:function(A,B){return LB(this,function(A,B,t){var e=VB(A);return e.__iterateUncached=function(e,g){var i=this;if(g)return this.cacheResult().__iterate(e,g);var Q=0;return A.__iterate((function(A,g,s){return B.call(t,A,g,s)&&++Q&&e(A,g,i)})),Q},e.__iteratorUncached=function(e,g){var i=this;if(g)return this.cacheResult().__iterator(e,g);var Q=A.__iterator(2,g),s=!0;return new y((function(){if(!s)return{value:void 0,done:!0};var A=Q.next();if(A.done)return A;var g=A.value,n=g[0],r=g[1];return B.call(t,r,n,i)?2===e?A:k(e,n,r,A):(s=!1,{value:void 0,done:!0})}))},e}(this,A,B))},takeUntil:function(A,B){return this.takeWhile(mt(A),B)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(A){if(A.size===1/0)return 0;var B=E(A),t=s(A),e=B?1:0;return function(A,B){return B=aA(B,3432918353),B=aA(B<<15|B>>>-15,461845907),B=aA(B<<13|B>>>-13,5),B=aA((B=(B+3864292196|0)^A)^B>>>16,2246822507),B=IA((B=aA(B^B>>>13,3266489909))^B>>>16)}(A.__iterate(t?B?function(A,B){e=31*e+pt(YA(A),YA(B))|0}:function(A,B){e=e+pt(YA(A),YA(B))|0}:B?function(A){e=31*e+YA(A)|0}:function(A){e=e+YA(A)|0}),e)}(this))}});var lt=t.prototype;lt[c]=!0,lt[J]=lt.values,lt.__toJS=lt.toArray,lt.__toStringMapper=ft,lt.inspect=lt.toSource=function(){return this.toString()},lt.chain=lt.flatMap,lt.contains=lt.includes,ut(e,{flip:function(){return LB(this,HB(this))},mapEntries:function(A,B){var t=this,e=0;return LB(this,this.toSeq().map((function(g,i){return A.call(B,[i,g],e++,t)})).fromEntrySeq())},mapKeys:function(A,B){var t=this;return LB(this,this.toSeq().flip().map((function(e,g){return A.call(B,e,g,t)})).flip())}});var dt=e.prototype;function Ut(A,B){return B}function Nt(A,B){return[B,A]}function mt(A){return function(){return!A.apply(this,arguments)}}function Gt(A){return function(){return-A.apply(this,arguments)}}function ft(A){return"string"==typeof A?JSON.stringify(A):String(A)}function Ht(){return D(arguments)}function Rt(A,B){return AB?-1:0}function pt(A,B){return A^B+2654435769+(A<<6)+(A>>2)|0}return dt[o]=!0,dt[J]=lt.entries,dt.__toJS=lt.toObject,dt.__toStringMapper=function(A,B){return JSON.stringify(B)+": "+ft(A)},ut(g,{toKeyedSeq:function(){return new NB(this,!1)},filter:function(A,B){return LB(this,JB(this,A,B,!1))},findIndex:function(A,B){var t=this.findEntry(A,B);return t?t[0]:-1},indexOf:function(A){var B=this.keyOf(A);return void 0===B?-1:B},lastIndexOf:function(A){var B=this.lastKeyOf(A);return void 0===B?-1:B},reverse:function(){return LB(this,pB(this,!1))},slice:function(A,B){return LB(this,yB(this,A,B,!1))},splice:function(A,B){var t=arguments.length;if(B=Math.max(0|B,0),0===t||2===t&&!B)return this;A=N(A,A<0?this.count():this.size);var e=this.slice(0,A);return LB(this,1===t?e:e.concat(D(arguments,2),this.slice(A+B)))},findLastIndex:function(A,B){var t=this.findLastEntry(A,B);return t?t[0]:-1},first:function(){return this.get(0)},flatten:function(A){return LB(this,jB(this,A,!1))},get:function(A,B){return(A=l(this,A))<0||this.size===1/0||void 0!==this.size&&A>this.size?B:this.find((function(B,t){return t===A}),void 0,B)},has:function(A){return(A=l(this,A))>=0&&(void 0!==this.size?this.size===1/0||AA/200%1,shapeChanges:!1},fisheye:{uniformName:"u_fisheye",mask:2,converter:A=>Math.max(0,(A+100)/100),shapeChanges:!0},whirl:{uniformName:"u_whirl",mask:4,converter:A=>-A*Math.PI/180,shapeChanges:!0},pixelate:{uniformName:"u_pixelate",mask:8,converter:A=>Math.abs(A)/10,shapeChanges:!0},mosaic:{uniformName:"u_mosaic",mask:16,converter:A=>(A=Math.round((Math.abs(A)+10)/10),Math.max(1,Math.min(A,512))),shapeChanges:!0},brightness:{uniformName:"u_brightness",mask:32,converter:A=>Math.max(-100,Math.min(A,100))/100,shapeChanges:!1},ghost:{uniformName:"u_ghost",mask:64,converter:A=>1-Math.max(0,Math.min(A,100))/100,shapeChanges:!1}},g.EFFECTS=Object.keys(g.EFFECT_INFO),g.DRAW_MODE={default:"default",straightAlpha:"straightAlpha",silhouette:"silhouette",colorMask:"colorMask",line:"line",background:"background"},A.exports=g},function(A,B,t){const e=t(294);A.exports=e},function(A,B,t){const e=t(3),g=t(7),i=t(1),Q=t(13),s=t(126),n=t(14);class r extends s{constructor(A,B){super(B,A.blocks),this.sprite=A,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=r.ROTATION_STYLE_ALL_AROUND,this.volume=100,this.tempo=60,this.videoTransparency=50,this.videoState=r.VIDEO_STATE.ON,this.textToSpeechLanguage=null,this.onTargetMoved=null,this.onTargetVisualChange=null,this.interpolationData=null}initDrawable(A){this.renderer&&(this.drawableID=this.renderer.createDrawable(A)),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 A=this.sprite.soundBank,B={playSound:B=>A.play(this,B)};return Object.defineProperty(this,"audioPlayer",{configurable:!1,enumerable:!0,writable:!1,value:B}),B}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(A,B,t){if(this.isStage)return;if(this.dragging&&!t)return;const e=this.x,g=this.y;if(this.renderer){const t=this.runtime.runtimeOptions.fencing?this.renderer.getFencedPositionOfDrawable(this.drawableID,[A,B]):[A,B];this.x=t[0],this.y=t[1],this.renderer.updateDrawablePosition(this.drawableID,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.x=A,this.y=B;this.onTargetMoved&&this.onTargetMoved(this,e,g,t),this.runtime.requestTargetsUpdate(this)}_getRenderedDirectionAndScale(){let A=this.direction,B=[this.size,this.size];if(this.rotationStyle===r.ROTATION_STYLE_NONE)A=90;else if(this.rotationStyle===r.ROTATION_STYLE_LEFT_RIGHT){A=90;B=[(this.direction<0?-1:1)*this.size,this.size]}return{direction:A,scale:B}}setDirection(A){if(!this.isStage&&isFinite(A)){if(this.direction=e.wrapClamp(A,-179,180),this.renderer){const{direction:A,scale:B}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,A,B),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}}setDraggable(A){this.isStage||(this.draggable=!!A,this.runtime.requestTargetsUpdate(this))}setVisible(A){this.isStage||(this.visible=!!A,this.renderer&&(this.renderer.updateDrawableVisible(this.drawableID,this.visible),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())),this.runtime.requestTargetsUpdate(this))}setSize(A){if(!this.isStage){if(this.renderer){const B=this.renderer.getCurrentSkinSize(this.drawableID),t=B[0],g=B[1],i=this.runtime.runtimeOptions.fencing,Q=i?Math.min(1,Math.max(5/t,5/g)):0,s=i?Math.min(1.5*this.runtime.stageWidth/t,1.5*this.runtime.stageHeight/g):1/0;this.size=100*e.clamp(A/100,Q,s);const{direction:n,scale:r}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,n,r),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.size=A;this.runtime.requestTargetsUpdate(this)}}setEffect(A,B){this.effects.hasOwnProperty(A)&&(this.effects[A]=B,this.renderer&&(this.renderer.updateDrawableEffect(this.drawableID,A,B),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())))}clearEffects(){for(const A in this.effects)this.effects.hasOwnProperty(A)&&(this.effects[A]=0);if(this.renderer){for(const A in this.effects)this.effects.hasOwnProperty(A)&&this.renderer.updateDrawableEffect(this.drawableID,A,0);this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}}setCostume(A){if((A=Math.round(A))!==1/0&&A!==-1/0&&A||(A=0),this.currentCostume=e.wrapClamp(A,0,this.sprite.costumes.length-1),this.renderer){const A=this.sprite.costumes[this.currentCostume];this.renderer.updateDrawableSkinId(this.drawableID,A.skinId),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}addCostume(A,B){"number"!=typeof B||isNaN(B)?this.sprite.addCostumeAt(A,this.sprite.costumes.length):this.sprite.addCostumeAt(A,B)}renameCostume(A,B){const t=this.sprite.costumes.filter((B,t)=>A!==t).map(A=>A.name),e=this.getCostumes()[A].name,i=g.unusedName(B,t);if(this.getCostumes()[A].name=i,this.isStage){const A=this.runtime.targets;for(let B=0;B=B)return null;const t=this.sprite.deleteCostumeAt(A);return A===this.currentCostume&&A===B-1?this.setCostume(A-1):AA.name);A.name=g.unusedName(A.name,t),"number"!=typeof B||isNaN(B)?this.sprite.sounds.push(A):this.sprite.sounds.splice(B,0,A)}renameSound(A,B){const t=this.sprite.sounds.filter((B,t)=>A!==t).map(A=>A.name),e=this.sprite.sounds[A].name,i=g.unusedName(B,t);this.sprite.sounds[A].name=i,this.blocks.updateAssetName(e,i,"sound")}deleteSound(A){if(A<0||A>=this.sprite.sounds.length)return null;const B=this.sprite.sounds.splice(A,1)[0];return this.runtime.requestTargetsUpdate(this),B}setRotationStyle(A){if(A===r.ROTATION_STYLE_NONE?this.rotationStyle=r.ROTATION_STYLE_NONE:A===r.ROTATION_STYLE_ALL_AROUND?this.rotationStyle=r.ROTATION_STYLE_ALL_AROUND:A===r.ROTATION_STYLE_LEFT_RIGHT&&(this.rotationStyle=r.ROTATION_STYLE_LEFT_RIGHT),this.renderer){const{direction:A,scale:B}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,A,B),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}getCostumeIndexByName(A){const B=this.getCostumes();for(let t=0;tA/2||t.top>B/2||t.bottom<-B/2)return!0}return!1}isTouchingSprite(A){A=i.toString(A);const B=this.runtime.getSpriteTargetByName(A);if(!B||!this.renderer)return!1;const t=B.sprite.clones.filter(A=>!A.dragging).map(A=>A.drawableID);return this.renderer.isTouchingDrawables(this.drawableID,t)}isTouchingColor(A){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,A)}colorIsTouchingColor(A,B){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,A,B)}getLayerOrder(){return this.renderer?this.renderer.getDrawableOrder(this.drawableID):null}goToFront(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,1/0,n.SPRITE_LAYER),this.runtime.setExecutablePosition(this,1/0)}goToBack(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-1/0,n.SPRITE_LAYER,!1),this.runtime.setExecutablePosition(this,-1/0)}goForwardLayers(A){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,A,n.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,A)}goBackwardLayers(A){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-A,n.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,-A)}goBehindOther(A){if(this.renderer){const B=this.renderer.setDrawableOrder(A.drawableID,0,n.SPRITE_LAYER,!0);this.renderer.setDrawableOrder(this.drawableID,B,n.SPRITE_LAYER)}const B=this.runtime.executableTargets.indexOf(A);this.runtime.setExecutablePosition(this,B)}keepInFence(A,B,t){let e=t;e||(e={left:-this.runtime.stageWidth/2,right:this.runtime.stageWidth/2,top:this.runtime.stageHeight/2,bottom:-this.runtime.stageHeight/2});const g=this.getBounds();if(!g)return;g.left+=A-this.x,g.right+=A-this.x,g.top+=B-this.y,g.bottom+=B-this.y;let i=0,Q=0;return g.lefte.right&&(i+=e.right-g.right),g.top>e.top&&(Q+=e.top-g.top),g.bottom{const B=A.createClone();return B.x=400*(Math.random()-.5)/2,B.y=300*(Math.random()-.5)/2,B.direction=this.direction,B.draggable=this.draggable,B.visible=this.visible,B.size=this.size,B.currentCostume=this.currentCostume,B.rotationStyle=this.rotationStyle,B.effects=JSON.parse(JSON.stringify(this.effects)),B.variables=this.duplicateVariables(B.blocks),B.updateAllDrawableProperties(),B})}onGreenFlag(){this.clearEffects()}onStopAll(){this.clearEffects()}postSpriteInfo(A){const B=A.hasOwnProperty("force")?A.force:null,t=A.hasOwnProperty("x"),e=A.hasOwnProperty("y");(t||e)&&this.setXY(t?A.x:this.x,e?A.y:this.y,B),A.hasOwnProperty("direction")&&this.setDirection(A.direction),A.hasOwnProperty("draggable")&&this.setDraggable(A.draggable),A.hasOwnProperty("rotationStyle")&&this.setRotationStyle(A.rotationStyle),A.hasOwnProperty("visible")&&this.setVisible(A.visible),A.hasOwnProperty("size")&&this.setSize(A.size)}startDrag(){this.dragging=!0}stopDrag(){this.dragging=!1}toJSON(){const A=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:A[this.currentCostume],costumeCount:A.length,visible:this.visible,rotationStyle:this.rotationStyle,comments:this.comments,blocks:this.blocks._blocks,variables:this.variables,costumes:A,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?n.BACKGROUND_LAYER:n.SPRITE_LAYER),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw()))}}A.exports=r},function(A,B,t){const e=t(0);A.exports=function(A){if("string"!=typeof A){if(!Array.isArray(A))return e.error("Unexpected input recieved in replaceUnsafeChars"),A;A=String(A)}return A.replace(/[<>&'"]/g,A=>{switch(A){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return"""}})}},function(A,B,t){const e=t(66);A.exports=class extends e{constructor(A,B,t,e){let g=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(),this._socket=A.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=e,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=g,this._discoverTimeoutID=null,this._extensionId=B,this._peripheralOptions=t,this._runtime=A,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(A=>{this._handleRequestError(A)})}connectPeripheral(A){this.sendRemoteRequest("connect",{peripheralId:A}).then(()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()}).catch(A=>{this._handleRequestError(A)})}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(A,B){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const e={serviceId:A,characteristicId:B};return this._characteristicDidChangeCallback=t,this.sendRemoteRequest("startNotifications",e).catch(A=>{this.handleDisconnectError(A)})}read(A,B){let t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const e={serviceId:A,characteristicId:B};return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(e.startNotifications=!0),t&&(this._characteristicDidChangeCallback=t),this.sendRemoteRequest("read",e).catch(A=>{this.handleDisconnectError(A)})}write(A,B,t){let e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,g=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i={serviceId:A,characteristicId:B,message:t};return e&&(i.encoding=e),null!==g&&(i.withResponse=g),this.sendRemoteRequest("write",i).catch(A=>{this.handleDisconnectError(A)})}didReceiveCall(A,B){switch(A){case"didDiscoverPeripheral":this._availablePeripherals[B.peripheralId]=B,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[B.peripheralId]=B,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(B.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(A,B,t){const e=t(0),g=[];class i{constructor(A){this.isLoop=!1,this.warpMode=A,this.justReported=null,this.reporting="",this.reported=null,this.waitingReporter=null,this.params=null,this.executionContext=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}reuse(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.warpMode;return this.reset(),this.warpMode=Boolean(A),this}static create(A){const B=g.pop();return void 0!==B?(B.warpMode=Boolean(A),B):new i(A)}static release(A){void 0!==A&&g.push(A.reset())}}class Q{constructor(A){this.topBlock=A,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}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(A,B){return"".concat(A.id,"&").concat(B)}getId(){return Q.getIdFromTargetAndBlock(this.target,this.topBlock)}pushStack(A){if(this.stack.push(A),this.stack.length>this.stackFrames.length){const A=this.stackFrames[this.stackFrames.length-1];this.stackFrames.push(i.create(void 0!==A&&A.warpMode))}}reuseStackForNextBlock(A){this.stack[this.stack.length-1]=A,this.stackFrames[this.stackFrames.length-1].reuse()}popStack(){return i.release(this.stackFrames.pop()),this.stack.pop()}stopThisScript(){let A=this.peekStack();for(;null!==A;){const B=this.target.blocks.getBlock(A);if(void 0!==B&&"procedures_call"===B.opcode)break;this.popStack(),A=this.peekStack()}0===this.stack.length&&(this.requestScriptGlowInFrame=!1,this.status=Q.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(A){this.justReported=void 0===A?null:A}initParams(){const A=this.peekStackFrame();null===A.params&&(A.params={})}pushParam(A,B){this.peekStackFrame().params[A]=B}getParam(A){for(let B=this.stackFrames.length-1;B>=0;B--){const t=this.stackFrames[B];if(null!==t.params)return t.params.hasOwnProperty(A)?t.params[A]:null}return null}getAllparams(){return this.peekStackFrame().params}atStackTop(){return this.peekStack()===this.topBlock}goToNextBlock(){const A=this.target.blocks.getNextBlock(this.peekStack());this.reuseStackForNextBlock(A)}isRecursiveCall(A){let B=5;for(let t=this.stack.length-1-1;t>=0;t--){const e=this.target.blocks.getBlock(this.stack[t]);if("procedures_call"===e.opcode&&e.mutation.proccode===A)return!0;if(--B<0)return!1}return!1}tryCompile(){if(!this.blockContainer)return;const A=t(202);this.triedToCompile=!0;const B=this.topBlock,g=this.blockContainer.getBlock(B)?this.blockContainer:this.target.runtime.flyoutBlocks,i=g.getCachedCompileResult(B);if(i&&!i.success)return;let Q;if(i)Q=i.value;else try{Q=A(this),g.cacheCompileResult(B,Q)}catch(A){return e.error("cannot compile script",this.target.getName(),A),g.cacheCompileError(B,A),void this.target.runtime.emitCompileError(this.target,A)}this.procedures={};for(const A of Object.keys(Q.procedures))this.procedures[A]=Q.procedures[A](this);this.generator=Q.startingFunction(this)(),this.blockContainer.forceNoGlow||(this.blockGlowInFrame=this.topBlock,this.requestScriptGlowInFrame=!0),this.isCompiled=!0}}A.exports=Q},function(A,B,t){const e=t(7),g=t(0),{loadSvgString:i,serializeSvgToString:Q}=t(49),s=function(A,B,t,e){return new Promise(g=>{let s=A.asset.decodeText();if(e&&2===e){const t=Q(i(s,!0));if(s!==t){s=t;const e=B.storage;A.asset.encodeTextData(t,e.DataFormat.SVG,!0),A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat)}}A.skinId=B.renderer.createSVGSkin(s,t),A.size=B.renderer.getSkinSize(A.skinId),t||(t=B.renderer.getSkinRotationCenter(A.skinId),A.rotationCenterX=t[0],A.rotationCenterY=t[1],A.bitmapResolution=1),g(A)})},n=new class{constructor(){this.pool=[],this.clearSoon=null}clear(){this.clearSoon||(this.clearSoon=new Promise(A=>setTimeout(A,1e3)).then(()=>{this.pool.length=0,this.clearSoon=null}))}create(){return this.pool.pop()||document.createElement("canvas")}release(A){this.clear(),this.pool.push(A)}},r=A=>new Promise((B,t)=>{const e=new Image;e.onload=function(){B(e),e.onload=null,e.onerror=null},e.onerror=function(){t(new Error("Costume load failed. Asset could not be read.")),e.onload=null,e.onerror=null},e.src=A}),E=function(A,B,t){return A&&A.asset?B.v2BitmapAdapter?Promise.all([A.asset,A.textLayerAsset].map(A=>A?(async A=>{let B;for(let t=0;t<3;t++)try{return await r(A)}catch(A){B||(B=A),g.warn(A),await new Promise(A=>setTimeout(A,2e3*Math.random()))}throw B})(A.encodeDataURI()):null)).then(e=>{let[g,i]=e;if(!g)throw new Error("Loading bitmap costume base failed.");const Q=1===A.bitmapResolution?2:1;let s,r;if(i){r=n.create(),r.width=g.width,r.height=g.height;const A=r.getContext("2d");A.drawImage(g,0,0),A.drawImage(i,0,0),s=r}else s=g;return 1!==Q&&(s=B.v2BitmapAdapter.resize(s,s.width*Q,s.height*Q)),r&&n.release(r),t&&(t[0]=t[0]*Q,t[1]=t[1]*Q,A.rotationCenterX=t[0],A.rotationCenterY=t[1]),A.bitmapResolution=2,delete A.textLayerMD5,delete A.textLayerAsset,{image:s,rotationCenter:t,assetMatchesBase:1===Q&&!i}}).finally(()=>{delete A.textLayerMD5,delete A.textLayerAsset}):Promise.reject("No V2 Bitmap adapter present."):Promise.reject("Costume load failed. Assets were missing.")},c=function(A,B,t){return E(A,B,t).then(t=>(t.assetMatchesBase||function(t){if(!B.v2BitmapAdapter)return Promise.reject("No V2 Bitmap adapter present.");const e=B.storage;A.asset=e.createAsset(e.AssetType.ImageBitmap,e.DataFormat.PNG,B.v2BitmapAdapter.convertDataURIToBinary(t),null,!0),A.dataFormat=e.DataFormat.PNG,A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat)}((A=>{if(A instanceof HTMLCanvasElement)return A.toDataURL();const B=n.create();B.width=A.width,B.height=A.height;B.getContext("2d").drawImage(A,0,0);const t=B.toDataURL();return n.release(B),t})(t.image)),t)).then(t=>{let e,{image:g,rotationCenter:i}=t;i&&(e=[i[0]/2,i[1]/2]),A.skinId=B.renderer.createBitmapSkin(g,A.bitmapResolution,e);const Q=B.renderer.getSkinSize(A.skinId);return A.size=[2*Q[0],2*Q[1]],i||(i=B.renderer.getSkinRotationCenter(A.skinId),A.rotationCenterX=2*i[0],A.rotationCenterY=2*i[1],A.bitmapResolution=2),A})},o=function(A,B){const t=A.asset,e=A.assetId,g=A.rotationCenterX,i=A.rotationCenterY,Q=A.bitmapResolution,n=A.dataFormat,r=B.storage.AssetType,E=A.dataFormat===r.ImageVector.runtimeFormat;A.assetId=E?B.storage.defaultAssetId.ImageVector:B.storage.defaultAssetId.ImageBitmap,A.asset=B.storage.get(A.assetId),A.md5="".concat(A.assetId,".").concat(A.asset.dataFormat);return(E?s(A,B):c(A,B)).then(A=>(A.broken={},A.broken.assetId=e,A.broken.md5="".concat(e,".").concat(n),A.broken.asset=t,A.broken.dataFormat=n,A.broken.rotationCenterX=g,A.broken.rotationCenterY=i,A.broken.bitmapResolution=Q,A))},w=function(A,B,t){A.assetId=A.asset.assetId;if(!B.renderer)return g.warn("No rendering module present; cannot load costume: ",A.name),Promise.resolve(A);const e=B.storage.AssetType;let i;return"number"!=typeof A.rotationCenterX||isNaN(A.rotationCenterX)||"number"!=typeof A.rotationCenterY||isNaN(A.rotationCenterY)||(i=[A.rotationCenterX,A.rotationCenterY]),A.asset.assetType.runtimeFormat===e.ImageVector.runtimeFormat?s(A,B,i,t).catch(t=>(g.warn("Error loading vector image: ".concat(t)),o(A,B))):c(A,B,i).catch(t=>(g.warn("Error loading bitmap image: ".concat(t)),o(A,B)))};A.exports={loadCostume:function(A,B,t,i){const Q=e.splitFirst(A,"."),s=Q[0],n=Q[1].toLowerCase();if(B.dataFormat=n,B.asset)return w(B,t,i);if(!t.storage)return g.warn("No storage module present; cannot load costume asset: ",A),Promise.resolve(B);if(!t.storage.defaultAssetId)return g.warn("No default assets found"),Promise.resolve(B);const r=t.storage.AssetType,E="svg"===n?r.ImageVector:r.ImageBitmap,c=t.storage.load(E,s,n);let C;return C=B.textLayerMD5?t.storage.load(r.ImageBitmap,B.textLayerMD5,"png"):Promise.resolve(null),Promise.all([c,C]).then(A=>A[0]?(B.asset=A[0],A[1]&&(B.textLayerAsset=A[1]),w(B,t,i)):o(B,t)).catch(A=>(g.warn("Error loading costume: ",A),o(B,t)))},loadCostumeFromAsset:w}},function(A,B,t){const e=t(7),g=t(0),i=function(A,B,t,e){return A.assetId=B.assetId,t.audioEngine?t.audioEngine.decodeSoundPlayer(Object.assign({},A,{data:B.data})).then(B=>{A.soundId=B.id;const t=B.buffer;return A.rate=t.sampleRate,A.sampleCount=t.length,null!==e&&e.addSoundPlayer(B),A}):(g.warn("No audio engine present; cannot load sound asset: ",A.md5),Promise.resolve(A))},Q=function(A,B,t){const e=A.asset,g=A.assetId,Q=A.sampleCount,s=A.rate,n=A.format,r=A.dataFormat;return A.assetId=B.storage.defaultAssetId.Sound,A.asset=B.storage.get(A.assetId),A.md5="".concat(A.assetId,".").concat(A.asset.dataFormat),i(A,A.asset,B,t).then(A=>(A.broken={},A.broken.assetId=g,A.broken.md5="".concat(g,".").concat(r),A.broken.asset=e,A.broken.sampleCount=Q,A.broken.rate=s,A.broken.format=n,A.broken.dataFormat=r,A))};A.exports={loadSound:function(A,B,t){if(!B.storage)return g.warn("No storage module present; cannot load sound asset: ",A.md5),Promise.resolve(A);const s=e.splitFirst(A.md5,"."),n=s[0],r=s[1].toLowerCase();return A.dataFormat=r,(A.asset&&Promise.resolve(A.asset)||B.storage.load(B.storage.AssetType.Sound,n,r)).then(e=>(A.asset=e,e?i(A,e,B,t):(g.warn("Failed to find sound data: ",A.md5),Q(A,B,t)))).catch(e=>(g.warn("Failed to load sound: ".concat(A.md5," with error: ").concat(e)),Q(A,B,t)))},loadSoundFromAsset:i}},function(A,B,t){const e=t(16),g=t(86),i=t(8),Q=t(40),s=t(38),n=t(14),r=t(0),E=t(6),c=t(3),o=t(7),w=t(65),C=t(261),{loadCostume:a}=t(30),{loadSound:I}=t(31),{deserializeCostume:Y,deserializeSound:h}=t(87),M=Object.prototype.hasOwnProperty,F=["argument","colour","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],D=12,u=13,l={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:[D,"VARIABLE"],data_listcontents:[u,"LIST"]},d=function(A){const B=function(A){if(M.call(l,A.opcode)){const B=l[A.opcode],t=B[0],e=B[1],g=A.fields[e],i=[t,g.value];return"event_broadcast_menu"===A.opcode?i.push(g.id):"data_variable"!==A.opcode&&"data_listcontents"!==A.opcode||(i.push(g.id),A.topLevel&&(i.push(A.x?Math.round(A.x):0),i.push(A.y?Math.round(A.y):0))),i}return null}(A);if(B)return B;const t=Object.create(null);return t.opcode=A.opcode,t.next=A.next,t.parent=A.parent,t.inputs=function(A){const B=Object.create(null);for(const t in A)M.call(A,t)&&(A[t].block===A[t].shadow?B[t]=[1,A[t].block]:null===A[t].shadow?B[t]=[2,A[t].block]:B[t]=[3,A[t].block,A[t].shadow]);return B}(A.inputs),t.fields=function(A){const B=Object.create(null);for(const t in A)M.call(A,t)&&(B[t]=[A[t].value],A[t].hasOwnProperty("id")&&B[t].push(A[t].id));return B}(A.fields),t.shadow=A.shadow,A.topLevel?(t.topLevel=!0,t.x=A.x?Math.round(A.x):0,t.y=A.y?Math.round(A.y):0):t.topLevel=!1,A.mutation&&(t.mutation=A.mutation),A.comment&&(t.comment=A.comment),t},U=function(A,B){const t=A.inputs;for(const A in t){const e=t[A];for(let A=1;A"number"==typeof A||"string"==typeof A||"boolean"==typeof A,R=A=>{if(Array.isArray(A)){let B=null;for(let t=0;t=A.costumes.length)&&(r.warn("currentCostume property for target ".concat(A.name," is out of range")),A.currentCostume=c.clamp(A.currentCostume,0,A.costumes.length-1)),t.currentCostume=A.currentCostume,t.costumes=A.costumes.map(G),t.sounds=A.sounds.map(f),A.hasOwnProperty("volume")&&(t.volume=A.volume),A.hasOwnProperty("layerOrder")&&(t.layerOrder=A.layerOrder),t.isStage?(A.hasOwnProperty("tempo")&&(t.tempo=A.tempo),A.hasOwnProperty("videoTransparency")&&(t.videoTransparency=A.videoTransparency),A.hasOwnProperty("videoState")&&(t.videoState=A.videoState),A.hasOwnProperty("textToSpeechLanguage")&&(t.textToSpeechLanguage=A.textToSpeechLanguage)):(t.visible=A.visible,t.x=A.x,t.y=A.y,t.size=A.size,t.direction=A.direction,t.draggable=A.draggable,t.rotationStyle=A.rotationStyle),e.forEach(A=>{B.add(A)}),t},J=function(A){const B=A.map(A=>A.getLayerOrder());return c.reducedSortOrdering(B)},y=function(A,B){const t=(B.stageWidth-480)/2,e=(B.stageHeight-360)/2;return A.valueSeq().filter(A=>"tw_getLastKeyPressed"!==A.id).map(A=>{const B={id:A.id,mode:A.mode,opcode:A.opcode,params:A.params,spriteName:A.spriteName,value:Array.isArray(A.value)?[]:0,width:A.width,height:A.height,x:A.x-t,y:A.y-e,visible:A.visible};return"list"!==A.mode&&(B.sliderMin=A.sliderMin,B.sliderMax=A.sliderMax,B.isDiscrete=A.isDiscrete),B})},k=function(A,B,t,e){if(!Array.isArray(A))return A;const g=Object.create(null),Q=E();switch(g.id=Q,g.next=null,g.parent=B,g.shadow=t,g.inputs=Object.create(null),A[0]){case 4:g.opcode="math_number",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 5:g.opcode="math_positive_number",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 6:g.opcode="math_whole_number",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 7:g.opcode="math_integer",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 8:g.opcode="math_angle",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 9:g.opcode="colour_picker",g.fields={COLOUR:{name:"COLOUR",value:A[1]}},g.topLevel=!1;break;case 10:g.opcode="text",g.fields={TEXT:{name:"TEXT",value:A[1]}},g.topLevel=!1;break;case 11:g.opcode="event_broadcast_menu",g.fields={BROADCAST_OPTION:{name:"BROADCAST_OPTION",value:A[1],id:A[2],variableType:i.BROADCAST_MESSAGE_TYPE}},g.topLevel=!1;break;case D:g.opcode="data_variable",g.fields={VARIABLE:{name:"VARIABLE",value:A[1],id:A[2],variableType:i.SCALAR_TYPE}},A.length>3&&(g.topLevel=!0,g.x=A[3],g.y=A[4]);break;case u:g.opcode="data_listcontents",g.fields={LIST:{name:"LIST",value:A[1],id:A[2],variableType:i.LIST_TYPE}},A.length>3&&(g.topLevel=!0,g.x=A[3],g.y=A[4]);break;default:return r.error("Found unknown primitive type during deserialization: ".concat(JSON.stringify(A))),null}return e[Q]=g,Q},T=function(A,B,t){const e={};for(const g in A){if(!M.call(A,g))continue;const i=A[g];if(!Array.isArray(i))continue;let Q=null,s=null;const n=i[0];1===n?Q=s=k(i[1],B,!0,t):2===n?Q=k(i[1],B,!1,t):(Q=k(i[1],B,!1,t),s=k(i[2],B,!0,t)),e[g]={name:g,block:Q,shadow:s}}return e},j=function(A){const B={};for(const t in A){if(!M.call(A,t))continue;const e=A[t];Array.isArray(e)&&(B[t]={name:t,value:e[0]},e.length>1&&(B[t].id=e[1]),"BROADCAST_OPTION"===t?B[t].variableType=i.BROADCAST_MESSAGE_TYPE:"VARIABLE"===t?B[t].variableType=i.SCALAR_TYPE:"LIST"===t&&(B[t].variableType=i.LIST_TYPE))}return B},x=function(A){for(const B in A){if(!Object.prototype.hasOwnProperty.call(A,B))continue;const t=A[B];Array.isArray(t)?(delete A[B],k(t,null,!1,A)):(t.id=B,t.inputs=T(t.inputs,B,A),t.fields=j(t.fields))}return A};A.exports={serialize:function(A,B){let{allowOptimization:t=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const e=Object.create(null),g=new Set,i=B?[A.getTargetById(B)]:A.targets.filter(A=>A.isOriginal),Q=J(i),s=i.map(A=>A.toJSON());A.renderer&&!B&&s.forEach((A,B)=>{A.layerOrder=Q[B]});const n=s.map(A=>p(A,g));if(B)return n[0];e.targets=n,e.monitors=y(A.getMonitorState(),A),e.extensions=Array.from(g);const r=Object.create(null);return r.semver="3.0.0",r.vm="0.2.0",A.origin&&(r.origin=A.origin),r.agent="",e.meta=r,t&&C(e),e},deserialize:function(A,B,t,E){const C={extensionIDs:new Set,extensionURLs:new Map};A.meta&&A.meta.origin?B.origin=A.meta.origin:B.origin=null;const M=((E?[A]:A.targets)||[]).map((A,B)=>Object.assign(A,{targetPaneOrder:B})).sort((A,B)=>A.layerOrder-B.layerOrder),F=A.monitors||[];return Promise.resolve(M.map(A=>function(A,B,t){if(!A.hasOwnProperty("name"))return Promise.resolve(null);const e={costumePromises:null,soundPromises:null,soundBank:B.audioEngine&&B.audioEngine.createBank()};return e.costumePromises=(A.costumes||[]).map(A=>{const e={asset:A.asset,assetId:A.assetId,skinId:null,name:A.name,bitmapResolution:A.bitmapResolution,rotationCenterX:A.rotationCenterX,rotationCenterY:A.rotationCenterY},g=A.dataFormat||A.assetType&&A.assetType.runtimeFormat||"png",i=A.hasOwnProperty("md5ext")?A.md5ext:"".concat(A.assetId,".").concat(g);return e.md5=i,e.dataFormat=g,Y(e,B,t).then(()=>a(i,e,B))}),e.soundPromises=(A.sounds||[]).map(A=>{const g={assetId:A.assetId,format:A.format,rate:A.rate,sampleCount:A.sampleCount,name:A.name,md5:A.md5ext,dataFormat:A.dataFormat,data:null};return h(g,B,t).then(()=>I(g,B,e.soundBank))}),e}(A,B,t))).then(A=>Promise.resolve(A)).then(A=>Promise.all(M.map((t,s)=>function(A,B,t,s,r){if(!A.hasOwnProperty("name"))return Promise.resolve(null);const E=new e(B),o=new g(E,B);if(A.hasOwnProperty("name")&&(o.name=A.name),A.hasOwnProperty("blocks")){x(A.blocks);for(const B in A.blocks){if(!A.blocks.hasOwnProperty(B))continue;const e=A.blocks[B];E.createBlock(e);const g=N(e.opcode);g&&t.extensionIDs.add(g)}}const{costumePromises:w}=r,{soundBank:C,soundPromises:a}=r,I=o.createClone(A.isStage?n.BACKGROUND_LAYER:n.SPRITE_LAYER);if(A.hasOwnProperty("tempo")&&(I.tempo=A.tempo),A.hasOwnProperty("volume")&&(I.volume=A.volume),A.hasOwnProperty("videoTransparency")&&(I.videoTransparency=A.videoTransparency),A.hasOwnProperty("videoState")&&(I.videoState=A.videoState),A.hasOwnProperty("textToSpeechLanguage")&&(I.textToSpeechLanguage=A.textToSpeechLanguage),A.hasOwnProperty("variables"))for(const t in A.variables){const e=A.variables[t],g=3===e.length&&e[2]&&A.isStage&&B.canAddCloudVariable(),Q=new i(t,e[0],i.SCALAR_TYPE,g);g&&B.addCloudVariable(),Q.value=e[1],I.variables[Q.id]=Q}if(A.hasOwnProperty("lists"))for(const B in A.lists){const t=A.lists[B],e=new i(B,t[0],i.LIST_TYPE,!1);e.value=t[1],I.variables[e.id]=e}if(A.hasOwnProperty("broadcasts"))for(const B in A.broadcasts){const t=A.broadcasts[B],e=new i(B,t,i.BROADCAST_MESSAGE_TYPE,!1);I.variables[e.id]=e}if(A.hasOwnProperty("comments"))for(const B in A.comments){const t=A.comments[B],e=new Q(B,t.text,t.x,t.y,t.width,t.height,t.minimized);t.blockId&&(e.blockId=t.blockId),I.comments[e.id]=e}return A.hasOwnProperty("x")&&(I.x=A.x),A.hasOwnProperty("y")&&(I.y=A.y),A.hasOwnProperty("direction")&&(I.direction=A.direction),A.hasOwnProperty("size")&&(I.size=A.size),A.hasOwnProperty("visible")&&(I.visible=A.visible),A.hasOwnProperty("currentCostume")&&(I.currentCostume=c.clamp(A.currentCostume,0,A.costumes.length-1)),A.hasOwnProperty("rotationStyle")&&(I.rotationStyle=A.rotationStyle),A.hasOwnProperty("isStage")&&(I.isStage=A.isStage),A.hasOwnProperty("targetPaneOrder")&&(I.targetPaneOrder=A.targetPaneOrder),A.hasOwnProperty("draggable")&&(I.draggable=A.draggable),Promise.all(w).then(A=>{o.costumes=A}),Promise.all(a).then(A=>{o.sounds=A,o.soundBank=C||null}),Promise.all(w.concat(a)).then(()=>I)}(t,B,C,0,A[s])))).then(A=>A.map((A,B)=>(A.layerOrder=B,A)).sort((A,B)=>A.targetPaneOrder-B.targetPaneOrder).map(A=>(delete A.targetPaneOrder,A))).then(A=>function(A){const B=w.getAllVarRefsForTargets(A,!0);A.forEach(A=>{Object.keys(A.variables).forEach(B=>{const t=o.replaceUnsafeChars(B);t!==B&&(A.variables[B].id=t,A.variables[t]=A.variables[B],delete A.variables[B])})});for(const A in B){const t=o.replaceUnsafeChars(A);A!==t&&w.updateVariableIdentifiers(B[A],t)}return A}(A)).then(A=>(F.map(t=>function(A,B,t,e){const g=(B.stageWidth-480)/2,Q=(B.stageHeight-360)/2;if(A.x+=g,A.y+=Q,A.x=c.clamp(A.x,0,B.stageWidth),A.y=c.clamp(A.y,0,B.stageHeight),A.spriteName){const B=t.filter(B=>B.sprite.name===A.spriteName);B&&B.length>0?A.targetId=B[0].id:r.warn("Tried to deserialize sprite specific monitor ".concat(A.opcode," but could not find sprite ").concat(A.spriteName,"."))}const n=B.monitorBlockInfo[A.opcode];if("data_listcontents"===A.opcode){const B=A.targetId?t.find(B=>B.id===A.targetId):t.find(A=>A.isStage);B&&Object.prototype.hasOwnProperty.call(B.variables,A.id)&&(A.params.LIST=B.variables[A.id].name)}const E={};for(const B in A.params){const t={name:B,value:A.params[B]};E[B]=t}"data_variable"!==A.opcode&&"data_listcontents"!==A.opcode&&n&&n.isSpriteSpecific?A.id=n.getId(A.targetId,E):A.id=o.replaceUnsafeChars(A.id);const w=B.monitorBlocks._blocks[A.id];if(w)w.isMonitored=A.visible,w.targetId=A.targetId;else{const t={id:A.id,opcode:A.opcode,inputs:{},fields:E,topLevel:!0,next:null,parent:null,shadow:!1,x:0,y:0,isMonitored:A.visible,targetId:A.targetId};if("data_variable"===A.opcode){const B=t.fields.VARIABLE;B.id=A.id,B.variableType=i.SCALAR_TYPE}else if("data_listcontents"===A.opcode){const B=t.fields.LIST;B.id=A.id,B.variableType=i.LIST_TYPE}B.monitorBlocks.createBlock(t);const g=N(t.opcode);g&&e.extensionIDs.add(g)}B.requestAddMonitor(s(A))}(t,B,A,C)),A)).then(A=>({targets:A,extensions:C}))},deserializeBlocks:x,serializeBlocks:m,getExtensionIdForOpcode:N}},function(A,B,t){const e=t(9),g=t(34),i=t(270);A.exports=class{constructor(A,B){this._renderer=B,this._id=A,this._rotationCenter=e.v3.create(0,0),this._texture=null,this._uniforms={u_skinSize:[0,0],u_skin:null},this._silhouette=new i}dispose(){this._id=g.ID_NONE}get id(){return this._id}get rotationCenter(){return this._rotationCenter}get size(){return[0,0]}useNearest(A,B){return!0}calculateRotationCenter(){return[this.size[0]/2,this.size[1]/2]}getTexture(A){return this._emptyImageTexture}getFenceBounds(A,B){return A.getAABB(B)}getUniforms(A){return this._uniforms.u_skin=this.getTexture(A),this._uniforms.u_skinSize=this.size,this._uniforms}emitWasAltered(){this._renderer.skinWasAltered(this)}updateSilhouette(){this._silhouette.unlazy()}_setTexture(A){const B=this._renderer.gl;B.bindTexture(B.TEXTURE_2D,this._texture),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),B.texImage2D(B.TEXTURE_2D,0,B.RGBA,B.RGBA,B.UNSIGNED_BYTE,A),B.pixelStorei(B.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this._silhouette.update(A)}setEmptyImageData(){if(this._texture=null,!this._emptyImageData){this._emptyImageData=new ImageData(1,1);const A=this._renderer.gl,B={auto:!0,wrap:A.CLAMP_TO_EDGE,src:this._emptyImageData};this._emptyImageTexture=e.createTexture(A,B)}this._rotationCenter[0]=0,this._rotationCenter[1]=0,this._silhouette.update(this._emptyImageData),this.emitWasAltered()}isTouchingNearest(A){return this._silhouette.isTouchingNearest(A)}isTouchingLinear(A){return this._silhouette.isTouchingLinear(A)}}},function(A,B){A.exports={ID_NONE:-1,Events:{UseHighQualityRenderChanged:"UseHighQualityRenderChanged",NativeSizeChanged:"NativeSizeChanged"}}},function(A,B,t){const e=t(20);e.enable(),A.exports=e("scratch-audioengine")},function(A,B,t){t(53),A.exports={TextEncoder:TextEncoder,TextDecoder:TextDecoder}},function(A,B){var t,e,g=A.exports={};function i(){throw new Error("setTimeout has not been defined")}function Q(){throw new Error("clearTimeout has not been defined")}function s(A){if(t===setTimeout)return setTimeout(A,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(A,0);try{return t(A,0)}catch(B){try{return t.call(null,A,0)}catch(B){return t.call(this,A,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(A){t=i}try{e="function"==typeof clearTimeout?clearTimeout:Q}catch(A){e=Q}}();var n,r=[],E=!1,c=-1;function o(){E&&n&&(E=!1,n.length?r=n.concat(r):c=-1,r.length&&w())}function w(){if(!E){var A=s(o);E=!0;for(var B=r.length;B;){for(n=r,r=[];++c1)for(var t=1;t').concat(g(this.text),"")}static get MIN_WIDTH(){return 20}static get MIN_HEIGHT(){return 20}static get DEFAULT_WIDTH(){return 100}static get DEFAULT_HEIGHT(){return 100}}A.exports=i},function(A,B,t){const e=t(15);A.exports=class{constructor(A){this._maxTokens=A,this._refillInterval=1e3/A,this._count=this._maxTokens,this._timer=new e,this._timer.start(),this._lastUpdateTime=this._timer.timeElapsed()}okayToSend(){const A=this._timer.timeElapsed(),B=A-this._lastUpdateTime,t=Math.floor(B/this._refillInterval);return t>0&&(this._lastUpdateTime=A),this._count=Math.min(this._maxTokens,this._count+t),this._count>0&&(this._count--,!0)}}},function(A,B){class t{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:t.xlink,xlink:t.xmlns,xmlns:"".concat(t.xmlns,"/"),"xmlns:xlink":"".concat(t.xmlns,"/")}}static create(A,B,e){return t.set(document.createElementNS(t.svg,A),B,e)}static get(A,B){const e=t.attributeNamespace[B],g=e?A.getAttributeNS(e,B):A.getAttribute(B);return"null"===g?null:g}static set(A,B,e){for(const g in B){let i=B[g];const Q=t.attributeNamespace[g];"number"==typeof i&&e&&(i=e.number(i)),Q?A.setAttributeNS(Q,g,i):A.setAttribute(g,i)}return A}}A.exports=t},function(A,B){class t{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:t.xlink,xlink:t.xmlns,xmlns:"".concat(t.xmlns,"/"),"xmlns:xlink":"".concat(t.xmlns,"/")}}static create(A,B,e){return t.set(document.createElementNS(t.svg,A),B,e)}static get(A,B){const e=t.attributeNamespace[B],g=e?A.getAttributeNS(e,B):A.getAttribute(B);return"null"===g?null:g}static set(A,B,e){for(const g in B){let i=B[g];const Q=t.attributeNamespace[g];"number"==typeof i&&e&&(i=e.number(i)),Q?A.setAttributeNS(Q,g,i):A.setAttribute(g,i)}return A}}A.exports=t},function(A,B,t){"undefined"!=typeof TextDecoder&&"undefined"!=typeof TextEncoder||t(53);const e=t(17);let g=null;const i={},Q={},s="function"==typeof FinalizationRegistry?new FinalizationRegistry(A=>{const B=Q[A];1===B?(delete Q[A],delete i[A]):Q[A]=B-1}):null,n=s?A=>{const B=A.assetId,t=Q[B]||0;Q[B]=t+1,s.register(A,B)}:()=>{};A.exports=class{constructor(A,B,t,e,g){this.assetType=A,this.assetId=B,this.setData(e,t||A.runtimeFormat,g),this.dependencies=[],n(this)}setData(A,B,t){if(A&&!B)throw new Error("Data provided without specifying its format");this.dataFormat=B,this.data=A,t&&(this.assetId=e(A)),this.clean=!t}decodeText(){return(new TextDecoder).decode(this.data)}encodeTextData(A,B,t){const e=new TextEncoder;this.setData(e.encode(A),B,t)}encodeDataURI(A){return A=A||this.assetType.contentType,"data:".concat(A,";base64,").concat(((A,B)=>{if(!Object.prototype.hasOwnProperty.call(i,A))if("undefined"==typeof btoa){const e=t(296);i[A]=e.fromByteArray(B)}else{if(null===g){g=new Array(256);for(let A=0;A<256;A++)g[A]=String.fromCharCode(A)}const{length:t}=B;let e="";for(let A=0,i=0;A{if(A)return A===this||B(A.target)};if(B(A))throw new Error("Effect cannot connect to itself");this.target=A,null!==this.outputNode&&this.outputNode.disconnect(),(this._isPatch||this._lastPatch+this.audioEngine.DECAY_DURATION * {\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('+r+');\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[opcode^="motion_"] .sc-monitor-value-color {\n background-color: #4c97ff;\n}\n.sc-monitor-root[opcode^="sensing_"] .sc-monitor-value-color {\n background-color: #5cb1d6;\n}\n.sc-monitor-root[opcode^="data_"] .sc-monitor-value-color {\n background-color: #ff8c1a;\n}\n.sc-monitor-root[opcode^="looks_"] .sc-monitor-value-color {\n background-color: #9966ff;\n}\n.sc-monitor-root[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: rgb(252, 102, 44);\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: rgb(226, 92, 40);\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',""]),n.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"},B.a=n},function(A,B,t){"use strict";(function(A){!function(A){function B(){}function t(){}var e=String.fromCharCode,g={}.toString,i=g.call(A.SharedArrayBuffer),Q=g(),s=A.Uint8Array,n=s||Array,r=s?ArrayBuffer:n,E=r.isView||function(A){return A&&"length"in A},c=g.call(r.prototype);r=t.prototype;var o=A.TextEncoder,w=new(s?Uint16Array:n)(32);B.prototype.decode=function(A){if(!E(A)){var B=g.call(A);if(B!==c&&B!==i&&B!==Q)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");A=s?new n(A):A||[]}for(var t,r,o,C=B="",a=0,I=0|A.length,Y=I-32|0,h=0,M=0,F=0,D=-1;a>4){case 15:if(2!=(o=255&A[a=a+1|0])>>6||247>6?M+4|0:24,r=r+256&768;case 13:case 12:h<<=6,h|=(31&r)<<6|63&(o=255&A[a=a+1|0]),M=M+7|0,a>6&&h>>M&&1114112>h?(r=h,0<=(h=h-65536|0)&&(D=55296+(h>>10)|0,r=56320+(1023&h)|0,31>F?(w[F]=D,F=F+1|0,D=-1):(o=D,D=r,r=o))):(a=a-(r>>=8)-1|0,r=65533),h=M=0,t=a<=Y?32:I-a|0;default:w[F]=r;continue;case 11:case 10:case 9:case 8:}w[F]=65533}if(C+=e(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],w[8],w[9],w[10],w[11],w[12],w[13],w[14],w[15],w[16],w[17],w[18],w[19],w[20],w[21],w[22],w[23],w[24],w[25],w[26],w[27],w[28],w[29],w[30],w[31]),32>F&&(C=C.slice(0,F-32|0)),a>>31,D=-1,C.length=Q)e[g]=Q;else{if(2047>=Q)e[g]=192|Q>>6;else{A:{if(55296<=Q)if(56319>=Q){var r=0|A.charCodeAt(B=B+1|0);if(56320<=r&&57343>=r){if(65535<(Q=(Q<<10)+r-56613888|0)){e[g]=240|Q>>18,e[g=g+1|0]=128|Q>>12&63,e[g=g+1|0]=128|Q>>6&63,e[g=g+1|0]=128|63&Q;continue}break A}Q=65533}else 57343>=Q&&(Q=65533);!i&&B<<1>12,e[g=g+1|0]=128|Q>>6&63}e[g=g+1|0]=128|63&Q}}return s?e.subarray(0,g):e.slice(0,g)},o||(A.TextDecoder=B,A.TextEncoder=t)}(""+void 0==typeof A?""+void 0==typeof self?this:self:A)}).call(this,t(10))},function(A,B,t){const e=t(111),g=t(0);A.exports=new class extends e{constructor(){super(),this.services={},this.workerClass="undefined"==typeof Worker?null:Worker,this.workers=[]}callSync(A,B){const{provider:t,isRemote:e}=this._getServiceProvider(A);if(t){if(e)throw new Error("Cannot use 'callSync' on remote provider for service ".concat(A,"."));for(var g=arguments.length,i=new Array(g>2?g-2:0),Q=2;Q{g.error("Could not handshake with worker: ".concat(A))})):g.warn("Central dispatch ignoring attempt to add duplicate worker")}_getServiceProvider(A){const B=this.services[A];return B&&{provider:B,isRemote:Boolean(this.workerClass&&B instanceof this.workerClass||B.isRemote)}}_onDispatchMessage(A,B){let t;switch(B.method){case"setService":t=this.setService(B.args[0],A);break;default:g.error("Central dispatch received message for unknown method: ".concat(B.method))}return t}}},function(A,B){var t={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};A.exports=function(A,B){return B?"color: #fff; background: "+t[A]+";":"color: "+t[A]+";"}},function(A,B,t){const e=t(4);A.exports=function(A,B,t){return A&&A.id&&A.default?e(A,B,t):A}},function(A,B){var t="long",e="short",g="numeric";A.exports={number:{decimal:{style:"decimal"},integer:{style:"decimal",maximumFractionDigits:0},currency:{style:"currency",currency:"USD"},percent:{style:"percent"},default:{style:"decimal"}},date:{short:{month:g,day:g,year:"2-digit"},medium:{month:e,day:g,year:g},long:{month:t,day:g,year:g},full:{month:t,day:g,year:g,weekday:t},default:{month:e,day:g,year:g}},time:{short:{hour:g,minute:g},medium:{hour:g,minute:g,second:g},long:{hour:g,minute:g,second:g,timeZoneName:e},full:{hour:g,minute:g,second:g,timeZoneName:e},default:{hour:g,minute:g,second:g}},duration:{default:{hours:{minimumIntegerDigits:1,maximumFractionDigits:0},minutes:{minimumIntegerDigits:2,maximumFractionDigits:0},seconds:{minimumIntegerDigits:2,maximumFractionDigits:3}}},parseNumberPattern:function(A){if(A){var B={},t=A.match(/\b[A-Z]{3}\b/i),e=A.replace(/[^¤]/g,"").length;if(!e&&t&&(e=1),e?(B.style="currency",B.currencyDisplay=1===e?"symbol":2===e?"code":"name",B.currency=t?t[0].toUpperCase():"USD"):A.indexOf("%")>=0&&(B.style="percent"),!/[@#0]/.test(A))return B.style?B:void 0;if(B.useGrouping=A.indexOf(",")>=0,/E\+?[@#0]+/i.test(A)||A.indexOf("@")>=0){var g=A.replace(/E\+?[@#0]+|[^@#0]/gi,"");B.minimumSignificantDigits=Math.min(Math.max(g.replace(/[^@0]/g,"").length,1),21),B.maximumSignificantDigits=Math.min(Math.max(g.length,1),21)}else{for(var i=A.replace(/[^#0.]/g,"").split("."),Q=i[0],s=Q.length-1;"0"===Q[s];)--s;B.minimumIntegerDigits=Math.min(Math.max(Q.length-1-s,1),21);var n=i[1]||"";for(s=0;"0"===n[s];)++s;for(B.minimumFractionDigits=Math.min(Math.max(s,0),20);"#"===n[s];)++s;B.maximumFractionDigits=Math.min(Math.max(s,0),20)}return B}},parseDatePattern:function(A){if(A){for(var B={},i=0;iA.blocks.getAllVariableAndListReferences(null,B)).reduce(t._mergeVarRefObjects,{})}static updateVariableIdentifiers(A,B,t){A.map(A=>(A.referencingField.id=B,t&&(A.referencingField.value=t),A))}}A.exports=t},function(A,B){A.exports=class{constructor(){this._requestID=0,this._openRequests={}}sendRemoteRequest(A,B){const t=this._requestID++,e=new Promise((A,B)=>{this._openRequests[t]={resolve:A,reject:B}});return this._sendRequest(A,B,t),e}sendRemoteNotification(A,B){this._sendRequest(A,B)}didReceiveCall(){throw new Error("Must override didReceiveCall")}_sendMessage(){throw new Error("Must override _sendMessage")}_sendRequest(A,B,t){const e={jsonrpc:"2.0",method:A,params:B};null!==t&&(e.id=t),this._sendMessage(e)}_handleMessage(A){if("2.0"!==A.jsonrpc)throw new Error("Bad or missing JSON-RPC version in message: ".concat(A));A.hasOwnProperty("method")?this._handleRequest(A):this._handleResponse(A)}_sendResponse(A,B,t){const e={jsonrpc:"2.0",id:A};t?e.error=t:e.result=B||null,this._sendMessage(e)}_handleResponse(A){const{result:B,error:t,id:e}=A,g=this._openRequests[e];delete this._openRequests[e],g&&(t?g.reject(t):g.resolve(B))}_handleRequest(A){const{method:B,params:t,id:e}=A,g=this.didReceiveCall(B,t);e&&Promise.resolve(g).then(A=>{this._sendResponse(e,A)},A=>{this._sendResponse(e,null,A)})}}},function(A){A.exports=JSON.parse('{"menuMap":{"cs":[{"code":"cs","name":"čeština"}],"da":[{"code":"da","name":"Dansk"}],"gl":[{"code":"gl","name":"galego"}],"sl":[{"code":"sl","name":"slovenščina"}],"fr":[{"code":"fr","name":"Français"}],"hu":[{"code":"hu","name":"magyar"}],"uk":[{"code":"uk","name":"українська"}],"zh-tw":[{"code":"zh-tw","name":"中文(繁體)"}],"pt":[{"code":"pt","name":"Portuguese"}],"pt-br":[{"code":"pt","name":"Português"}],"tr":[{"code":"tr","name":"Türkçe"}],"ga":[{"code":"ga","name":"Gaeilge"}],"th":[{"code":"th","name":"ภาษาไทย"}],"ja":[{"code":"ja","name":"日本語"}],"ja-hira":[{"code":"ja","name":"日本語"}],"nl":[{"code":"nl","name":"Nederlands"}],"gd":[{"code":"gd","name":"Gàidhlig"}],"nb":[{"code":"nb","name":"norsk"}],"de":[{"code":"de","name":"Deutsch"}],"he":[{"code":"he","name":"עברית"}],"sk":[{"code":"sk","name":"slovenčina"}],"zu":[{"code":"zu","name":"isiZulu"}],"ru":[{"code":"ru","name":"русский"}],"pl":[{"code":"pl","name":"polski"}],"am":[{"code":"am","name":"አማርኛ"}],"az":[{"code":"az","name":"Azərbaycan dili"}],"hr":[{"code":"hr","name":"hrvatski"}],"fa":[{"code":"fa","name":"فارسی"}],"mi":[{"code":"mi","name":"Māori"}],"el":[{"code":"el","name":"Ελληνικά"}],"is":[{"code":"is","name":"íslenska"}],"fi":[{"code":"fi","name":"suomi"}],"eu":[{"code":"eu","name":"euskara"}],"ca":[{"code":"ca","name":"català"}],"lv":[{"code":"lv","name":"latviešu"}],"id":[{"code":"id","name":"Indonesia"}],"es":[{"code":"es","name":"español"}],"es-419":[{"code":"es","name":"español"}],"et":[{"code":"et","name":"eesti"}],"cy":[{"code":"cy","name":"Cymraeg"}],"zh-cn":[{"code":"zh-cn","name":"中文(简体)"}],"bg":[{"code":"bg","name":"български"}],"ar":[{"code":"ar","name":"العربية"}],"en":[{"code":"en","name":"English"}],"sr":[{"code":"sr","name":"српски"}],"sv":[{"code":"sv","name":"svenska"}],"ro":[{"code":"ro","name":"Română"}],"lt":[{"code":"lt","name":"lietuvių"}],"ko":[{"code":"ko","name":"한국어"}],"it":[{"code":"it","name":"Italiano"}],"vi":[{"code":"vi","name":"Tiếng Việt"}]},"nameMap":{"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","esperanto":"eo","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","latina":"la","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","zulu":"zu","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","galicisk":"gl","græsk":"el","haitisk kreolsk":"ht","hebraisk":"he","hindi":"hi","hollandsk":"nl","hviderussisk":"be","indonesisk":"id","irsk":"ga","islandsk":"is","italiensk":"it","japansk":"ja","kannada":"kn","katalansk":"ca","kinesisk (forenklet)":"zh-cn","kinesisk (traditionelt)":"zh-tw","koreansk":"ko","kroatisk":"hr","kurdisk":"ku","latin":"la","lettisk":"lv","litauisk":"lt","makedonsk":"mk","malajisk":"ms","malayalam":"ml","maltesisk":"mt","maori":"mi","marathi":"mr","mongolsk":"mn","norsk":"nb","persisk":"fa","polsk":"pl","portugisisk":"pt","rumænsk":"ro","russisk":"ru","serbisk":"sr","skotsk gælisk":"gd","slovakisk":"sk","slovensk":"sl","spansk":"es","svensk":"sv","telugu":"te","thailandsk":"th","tjekkisk":"cs","tyrkisk":"tr","tysk":"de","ukrainsk":"uk","ungarsk":"hu","usbekisk":"uz","vietnamesisk":"vi","walisisk":"cy","acerbaixano":"az","albanés":"sq","alemán":"de","amárico":"am","árabe":"ar","armenio":"hy","bielorruso":"be","birmano":"my","búlgaro":"bg","canarés":"kn","catalán":"ca","checo":"cs","chinés (simplificado)":"zh-cn","chinés (tradicional)":"zh-tw","coreano":"ko","crioulo haitiano":"ht","croata":"hr","curdo":"ku","dinamarqués":"da","eslovaco":"sk","esloveno":"sl","español":"es","estoniano":"et","éuscaro":"eu","finés":"fi","francés":"fr","gaélico escocés":"gd","galego":"gl","galés":"cy","grego":"el","hebreo":"he","húngaro":"hu","indonesio":"id","inglés":"en","irlandés":"ga","islandés":"is","italiano":"it","latín":"la","letón":"lv","lituano":"lt","macedonio":"mk","malabar":"ml","malaio":"ms","maltés":"mt","maorí":"mi","mongol":"mn","neerlandés":"nl","noruegués":"nb","persa":"fa","polaco":"pl","portugués":"pt","romanés":"ro","ruso":"ru","serbio":"sr","sueco":"sv","tailandés":"th","telugú":"te","turco":"tr","ucraíno":"uk","usbeco":"uz","vietnamita":"vi","xaponés":"ja","zulú":"zu","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":"ku","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","albanais":"sq","allemand":"de","amharique":"am","anglais":"en","arabe":"ar","arménien":"hy","azéri":"az","basque":"eu","biélorusse":"be","birman":"my","bulgare":"bg","catalan":"ca","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":"ku","letton":"lv","lituanien":"lt","macédonien":"mk","malaisien":"ms","maltais":"mt","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","albán":"sq","amhara":"am","angol":"en","arab":"ar","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":"ku","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","spanyol":"es","svéd":"sv","szerb":"sr","szlovák":"sk","szlovén":"sl","thai":"th","török":"tr","ukrán":"uk","üzbég":"uz","vietnami":"vi","walesi":"cy","азербайджанська":"az","албанська":"sq","амхарська":"am","англійська":"en","арабська":"ar","баскська":"eu","білоруська":"be","бірманська":"my","болгарська":"bg","в’єтнамська":"vi","валлійська":"cy","вірменська":"hy","гаїтянська креольська":"ht","гінді":"hi","грецька":"el","ґалісійська":"gl","данська":"da","есперанто":"eo","естонська":"et","зулу":"zu","іврит":"he","індонезійська":"id","ірландська":"ga","ісландська":"is","іспанська":"es","італійська":"it","каннада":"kn","каталанська":"ca","китайська (спрощена)":"zh-cn","китайська (традиційна)":"zh-tw","корейська":"ko","курдська":"ku","латинська":"la","латиська":"lv","литовська":"lt","македонська":"mk","малайська":"ms","малаялам":"ml","мальтійська":"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","土耳其文":"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","阿姆哈拉文":"am","阿拉伯文":"ar","阿爾巴尼亞文":"sq","俄文":"ru","保加利亞文":"bg","南非祖魯文":"zu","威爾斯文":"cy","英文":"en","庫德文":"ku","挪威文":"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","अझरबैजानी":"az","अम्हारिक":"am","अरबी":"ar","अर्मेनियन":"hy","अल्बानियन":"sq","आइसलँडिक":"is","आयरिश":"ga","इंग्रजी":"en","इंडोनेशियन":"id","इटालियन":"it","उझ्बेक":"uz","एस्टोनियन":"et","एस्परँटो":"eo","कन्नड":"kn","कुर्दिश (कुर्मांजी)":"ku","कॅटलान":"ca","कोरियन":"ko","क्रोएशियन":"hr","गॅलिशियन":"gl","ग्रीक":"el","चीनी (पारंपारिक)":"zh-tw","चीनी (सरलीकृत)":"zh-cn","जपानी":"ja","जर्मन":"de","झुलु":"zu","झेक":"cs","डच":"nl","डॅनिश":"da","तुर्की":"tr","तेलगू":"te","थाई":"th","नॉर्वेजियन":"nb","पोर्तुगीज":"pt","पोलिश":"pl","फारसी":"fa","फिन्निश":"fi","फ्रेंच":"fr","बल्गेरियन":"bg","बास्क":"eu","बेलारुशियन":"be","मंगोलियन":"mn","मराठी":"mr","मलय":"ms","मल्याळम":"ml","माओरी":"mi","माल्टीज":"mt","मॅसेडोनियन":"mk","म्यानमार (बर्मीज)":"my","युक्रेनियन":"uk","रशियन":"ru","रोमानियन":"ro","लाट्वियन":"lv","लिथुआनियन":"lt","लॅटिन":"la","वेल्श":"cy","व्हिएतनामी":"vi","सर्बियन":"sr","स्कॉट्स गेलिक":"gd","स्पॅनिश":"es","स्लोव्हाक":"sk","स्लोव्हेनियन":"sl","स्वीडिश":"sv","हंगेरियन":"hu","हिन्दी":"hi","हिब्रू":"he","हैतीयन क्रेओल":"ht","albanian":"sq","amharic":"am","arabic":"ar","armenian":"hy","azerbaijani":"az","belarusian":"be","bulgarian":"bg","chinese (simplified)":"zh-cn","chinese (traditional)":"zh-tw","croatian":"hr","czech":"cs","danish":"da","dutch":"nl","english":"en","estonian":"et","finnish":"fi","french":"fr","galician":"gl","german":"de","greek":"el","haitian creole":"ht","hebrew":"he","hungarian":"hu","icelandic":"is","indonesian":"id","irish":"ga","italian":"it","japanese":"ja","korean":"ko","kurdish (kurmanji)":"ku","latvian":"lv","lithuanian":"lt","macedonian":"mk","malay":"ms","maltese":"mt","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","turkish":"tr","ukrainian":"uk","uzbek":"uz","vietnamese":"vi","welsh":"cy","albanês":"sq","alemão":"de","armênio":"hy","azerbaijano":"az","basco":"eu","bielo-russo":"be","birmanês":"my","canarês":"kn","catalão":"ca","chinês (simplificado)":"zh-cn","chinês (tradicional)":"zh-tw","dinamarquês":"da","espanhol":"es","finlandês":"fi","francês":"fr","gaélico escocês":"gd","galês":"cy","hebraico":"he","holandês":"nl","indonésio":"id","inglês":"en","irlandês":"ga","islandês":"is","japonês":"ja","latim":"la","letão":"lv","macedônio":"mk","malaiala":"ml","maltês":"mt","marata":"mr","norueguês":"nb","polonês":"pl","português":"pt","romeno":"ro","russo":"ru","sérvio":"sr","tailandês":"th","tcheco":"cs","telugo":"te","ucraniano":"uk","uzbeque":"uz","almanca":"de","arapça":"ar","arnavutça":"sq","azerice":"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","endonezya dili":"id","ermenice":"hy","esperantoca":"eo","estonyaca":"et","farsça":"fa","felemenkçe":"nl","fince":"fi","fransızca":"fr","galce":"cy","galiçyaca":"gl","habeşçe":"am","haiti creole dili":"ht","hırvatça":"hr","hintçe":"hi","i̇branice":"he","i̇ngilizce":"en","i̇rlandaca":"ga","i̇spanyolca":"es","i̇sveççe":"sv","i̇talyanca":"it","i̇zlandaca":"is","japonca":"ja","katalanca":"ca","korece":"ko","kuzey i̇skoç dili":"gd","kürtçe":"ku","latince":"la","lehçe":"pl","letonca":"lv","litvanca":"lt","macarca":"hu","makedonca":"mk","malezya dili":"ms","malta dili":"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","tay dili":"th","telugu dili":"te","türkçe":"tr","ukraynaca":"uk","vietnamca":"vi","yunanca":"el","airméinis":"hy","albáinis":"sq","amárais":"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","cóiréis":"ko","criól háítí":"ht","cróitis":"hr","danmhairgis":"da","eabhrais":"he","eastóinis":"et","fionlainnis":"fi","fraincis":"fr","gaeilge":"ga","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","peirsis":"fa","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","ภาษากรีก":"el","ภาษากันนาดา":"kn","ภาษากาลิเชียน":"gl","ภาษาเกลิกในสก็อต":"gd","ภาษาเกาหลี":"ko","ภาษาคาตาลัน":"ca","ภาษาเคิร์ด":"ku","ภาษาโครเอเชีย":"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","ภาษาอัมฮาริก":"am","ภาษาอัลบาเนีย":"sq","ภาษาอาร์เซอร์ไบจัน":"az","ภาษาอาร์เมเนีย":"hy","ภาษาอาหรับ":"ar","ภาษาอิตาลี":"it","ภาษาอินโดนีเซีย":"id","ภาษาอุสเบกิสถาน":"uz","ภาษาเอสโทเนีย":"et","ภาษาเอสเปอแรนโต":"eo","ภาษาไอซ์แลนดิก":"is","ภาษาไอริช":"ga","ภาษาฮังการี":"hu","ภาษาฮินดี":"hi","ภาษาฮิบรู":"he","ภาษาเฮติครีโอล":"ht","アイスランド語":"is","アイルランド語":"ga","アゼルバイジャン語":"az","アムハラ語":"am","アラビア語":"ar","アルバニア語":"sq","アルメニア語":"hy","イタリア語":"it","インドネシア語":"id","ウェールズ語":"cy","ウクライナ語":"uk","ウズベク語":"uz","エストニア語":"et","エスペラント語":"eo","オランダ語":"nl","カタルーニャ語":"ca","ガリシア語":"gl","カンナダ語":"kn","ギリシャ語":"el","クルド語":"ku","クロアチア語":"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","albanees":"sq","amharisch":"am","arabisch":"ar","armeens":"hy","azerbeidzjaans":"az","baskisch":"eu","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":"ku","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 keltisch":"gd","servisch":"sr","slovaaks":"sk","sloveens":"sl","spaans":"es","tsjechisch":"cs","turks":"tr","vietnamees":"vi","wels":"cy","wit-russisch":"be","zoeloe":"zu","zweeds":"sv","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","duitsis":"nl","eabhra":"he","eadailtis":"it","eastoinis":"et","fionnlannais":"fi","fraingis":"fr","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","māori":"mi","masadonais":"mk","miànmar (burmais)":"my","mongolais":"mn","nirribhis":"nb","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","farsi":"fa","galisisk":"gl","gresk":"el","hviterussisk":"be","kinesisk (tradisjonell)":"zh-tw","kreol (haiti)":"ht","latvisk":"lv","malayisk":"ms","nederlandsk":"nl","rumensk":"ro","tsjekkisk":"cs","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","lateinisch":"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","weißrussisch":"be","ကနာဒါ":"kn","ကာ့ဒ် (ကာမန်ဂျီ)":"ku","ကိုရီးယား":"ko","ကက်တလန်":"ca","ခရိုအေးရှား":"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","ဘာ့စ်":"eu","ဘူဂေးရီးယား":"bg","ဘယ်လာရုစ်":"be","မလေယာလမ်":"ml","မလေး":"ms","မာရာသီ":"mr","မော်ရီ":"mi","မော်လတာ":"mt","မက်ဆီဒိုးနီးယား":"mk","မြန်မာ (မြန်မာ)":"my","မွန်ဂိုလီးယား":"mn","ယူ​က​ရိန်း​":"uk","ရုရှား":"ru","ရိုမေးနီးယား":"ro","လက်တင်":"la","လစ်သူယေးနီးယား":"lt","လတ်ဗီယာ":"lv","ဝေလ":"cy","ဟီဘရူး":"he","ဟေတီ ခရီအိုး":"ht","ဟင်ဒီ":"hi","ဟန်ဂေရီ":"hu","အဇာဘိုင်ဂျန်":"az","အာမေးနီးယား":"hy","အာရေဗျ":"ar","အီတလီ":"it","ဥဇဘက်":"uz","အက်စတိုးနီးယား":"et","အက်စ်ပဲရန်တို":"eo","အိုက်စလန်":"is","အင်္ဂလိပ်":"en","အင်ဒိုနီးရှား":"id","အိုင်းရစ်ရှ်":"ga","အမ်ဟဲရစ်ခ်":"am","အယ်လ်ဘေးနီးယား":"sq","אוזבקית":"uz","אוקראינית":"uk","אזרית":"az","איטלקית":"it","אינדונזית":"id","איסלנדית":"is","אירית":"ga","אלבנית":"sq","אמהרית":"am","אנגלית":"en","אסטונית":"et","אספרנטו":"eo","ארמנית":"hy","באסקית":"eu","בולגרית":"bg","בורמזית":"my","בלארוסית":"be","גליציאנית":"gl","גרמנית":"de","דנית":"da","הולנדית":"nl","הונגרית":"hu","הינדי":"hi","וולשית":"cy","וייטנאמית":"vi","זולו":"zu","טורקית":"tr","טלוגו":"te","יוונית":"el","יפנית":"ja","כורדית":"ku","לטווית":"lv","לטינית":"la","ליטאית":"lt","מאורית":"mi","מאלאיאלם":"ml","מאלזית":"ms","מאראתי":"mr","מונגולית":"mn","מלטית":"mt","מקדונית":"mk","נורווגית":"nb","סינית (מסורתית)":"zh-tw","סינית (פשוטה)":"zh-cn","סלובנית":"sl","סלובקית":"sk","ספרדית":"es","סקוטית גאלית":"gd","סרבית":"sr","עברית":"he","ערבית":"ar","פולנית":"pl","פורטוגזית":"pt","פינית":"fi","פרסית":"fa","צ\'כית":"cs","צרפתית":"fr","קאנאדה":"kn","קוריאנית":"ko","קטלאנית":"ca","קרואטית":"hr","קריאולית האיטית":"ht","רומנית":"ro","רוסית":"ru","שוודית":"sv","תאילנדית":"th","азербејџански":"az","албански":"sq","амхарски":"am","англиски":"en","арапски":"ar","баскиски":"eu","белоруски":"be","бугарски":"bg","бурмански":"my","велшки":"cy","виетнамски":"vi","галициски":"gl","германски":"de","грчки":"el","дански":"da","ерменски":"hy","естонски":"et","индонезиски":"id","ирски":"ga","исландски":"is","италијански":"it","јапонски":"ja","канада":"kn","каталонски":"ca","кинески (поедноставен)":"zh-cn","кинески (традиционален)":"zh-tw","корејски":"ko","курдски":"ku","латвиски":"lv","латински":"la","литвански":"lt","македонски":"mk","малајалам":"ml","малајски":"ms","малтешки":"mt","маорски":"mi","маратхи":"mr","монголски":"mn","норвешки":"nb","персиски":"fa","полски":"pl","португалски":"pt","романски":"ro","руски":"ru","словачки":"sk","словенечки":"sl","српски":"sr","тајландски":"th","телугу":"te","турски":"tr","узбечки":"uz","украински":"uk","унгарски":"hu","фински":"fi","француски":"fr","хаитски креолски":"ht","хебрејски":"he","хиндиски":"hi","холандски":"nl","хрватски":"hr","чешки":"cs","шведски":"sv","шкотски галски":"gd","шпански":"es","ಅಜರ್ಬೈಜಾನಿ":"az","ಅಮಹಾರಿಕ್":"am","ಅರಬ್ಬಿ":"ar","ಆರ್ಮೇನಿಯನ್":"hy","ಆಲ್ಬೇನಿಯನ್":"sq","ಇಂಗ್ಲಿಷ್‌‌":"en","ಇಂಡೋನೇಷಿಯನ್":"id","ಇಟಾಲಿಯನ್":"it","ಉಜ್ಬೆಕ್":"uz","ಎಸ್ಟೋನಿಯನ್":"et","ಎಸ್ಪೆರಾಂಟೋ":"eo","ಐರಿಷ್":"ga","ಐಸ್‌ಲ್ಯಾಂಡಿಕ್‌":"is","ಕನ್ನಡ":"kn","ಕುರ್ದಿಶ್":"ku","ಕೊರಿಯನ್":"ko","ಕ್ಯಾಟಲನ್":"ca","ಕ್ರೊಯೇಷಿಯನ್":"hr","ಗ್ಯಾಲೀಷಿಯನ್":"gl","ಗ್ರೀಕ್":"el","ಚೀನಿ (ಸರಳೀಕೃತ)":"zh-cn","ಚೀನಿ (ಸಾಂಪ್ರದಾಯಿಕ)":"zh-tw","ಜಪಾನಿ":"ja","ಜರ್ಮನ್":"de","ಜುಲು":"zu","ಝೆಕ್‌":"cs","ಟರ್ಕಿಷ್":"tr","ಡಚ್":"nl","ಡ್ಯಾನಿಷ್":"da","ತೆಲುಗು":"te","ಥಾಯ್":"th","ನಾರ್ವೇಜಿಯನ್‌":"nb","ಪೋರ್ಚುಗೀಸ್":"pt","ಪೋಲಿಷ್":"pl","ಫಾರ್ಸಿ":"fa","ಫಿನ್ನಿಷ್":"fi","ಫ್ರೆಂಚ್":"fr","ಬರ್ಮೀಸ್":"my","ಬಲ್ಗೇರಿಯನ್":"bg","ಬಾಸ್ಕ್":"eu","ಬೆಲರೂಸಿಯನ್":"be","ಮಂಗೋಲಿಯನ್":"mn","ಮರಾಠಿ":"mr","ಮಲಯ":"ms","ಮಲಯಾಳಂ":"ml","ಮಾಲ್ಟೀಸ್":"mt","ಮಾವೋರಿ":"mi","ಮ್ಯಾಸೆಡೋನಿಯನ್":"mk","ಯುಕ್ರೇನಿಯನ್":"uk","ರಷಿಯನ್":"ru","ರೊಮೇನಿಯನ್":"ro","ಲಿಥುವೇನಿಯನ್":"lt","ಲ್ಯಾಟಿನ್":"la","ಲ್ಯಾಟ್ವಿಯನ್‌":"lv","ವಿಯೆಟ್ನಾಮಿ":"vi","ವೆಲ್ಶ್":"cy","ಸರ್ಬಿಯನ್":"sr","ಸ್ಕಾಟ್ಸ್ ಗ್ಯಾಲಿಕ್":"gd","ಸ್ಪ್ಯಾನಿಷ್":"es","ಸ್ಲೊವಾಕ್":"sk","ಸ್ಲೊವೆನಿಯನ್":"sl","ಸ್ವೀಡಿಷ್":"sv","ಹಂಗೇರಿಯನ್":"hu","ಹಯಥಿಯನ್‌ ಕ್ರಿಯೋಲ್‌":"ht","ಹಿಂದಿ":"hi","ಹೀಬ್ರೂ":"he","അമാറിക്":"am","അർമേനിയൻ":"hy","അൽബേനിയൻ":"sq","അസർബൈജാനി":"az","അറബിക്":"ar","ഇന്തോനേഷ്യൻ":"id","ഇംഗ്ലീഷ്":"en","ഇറ്റാലിയൻ":"it","ഉക്രേനിയൻ":"uk","ഉസ്ബെക്ക്":"uz","എസ്‌പെരന്തോ":"eo","എസ്റ്റോണിയൻ":"et","ഐസ്‌ലാൻഡിക്":"is","ഐറിഷ്":"ga","കന്നട":"kn","കാറ്റലൻ":"ca","കുർദ്ദിഷ്":"ku","കൊറിയൻ":"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","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":"ku","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","isi-albania":"sq","isi-amharic":"am","isi-arabic":"ar","isi-armenian":"hy","isi-azerbaijani":"az","isi-basque":"eu","isi-belarusian":"be","isi-bulgarian":"bg","isi-burmese":"my","isi-catalan":"ca","isi-chinese (simplified)":"zh-cn","isi-chinese (traditional)":"zh-tw","isi-croatian":"hr","isi-czech":"cs","isi-danish":"da","isi-dutch":"nl","isi-english":"en","isi-esperanto":"eo","isi-estonian":"et","isi-finnish":"fi","isi-french":"fr","isi-galician":"gl","isi-german":"de","isi-greek":"el","isi-haitian creole":"ht","isi-hangarian":"hu","isi-hebrew":"he","isi-hindi":"hi","isi-icelandic":"is","isi-indonesian":"id","isi-irish":"ga","isi-italian":"it","isi-japanese":"ja","isi-kannada":"kn","isi-korean":"ko","isi-kurdish":"ku","isi-latin":"la","isi-latvian":"lv","isi-lithuanian":"lt","isi-macedonian":"mk","isi-malay":"ms","isi-malayalam":"ml","isi-maltese":"mt","isi-maori":"mi","isi-marathi":"mr","isi-mongolian":"mn","isi-norwegian":"nb","isi-persian":"fa","isi-polish":"pl","isi-portuguese":"pt","isi-romanian":"ro","isi-russian":"ru","isi-scots gaelic":"gd","isi-serbian":"sr","isi-slovak":"sk","isi-slovenian":"sl","isi-spanish":"es","isi-swedish":"sv","isi-telugu":"te","isi-thai":"th","isi-turkish":"tr","isi-ukrainian":"uk","isi-uzbek":"uz","isi-vietnamese":"vi","isi-welsh":"cy","isizulu":"zu","albania":"sq","armenia":"hy","azerbaijan":"az","belanda":"nl","belarus":"be","bulgaria":"bg","cina (mudah)":"zh-cn","cina (tradisional)":"zh-tw","croatia":"hr","denmark":"da","estonia":"et","finland":"fi","gaelic scotland":"gd","galicia":"gl","hungary":"hu","ibrani":"he","iceland":"is","indonesia":"id","inggeris":"en","ireland":"ga","itali":"it","jepun":"ja","jerman":"de","korea":"ko","kreol haiti":"ht","kurdistan":"ku","latvia":"lv","lithuania":"lt","macedonia":"mk","malta":"mt","melayu":"ms","mongolia":"mn","myanmar":"my","norway":"nb","parsi":"fa","perancis":"fr","poland":"pl","portugis":"pt","romania":"ro","rusia":"ru","sepanyol":"es","serbia":"sr","slovenia":"sl","sweden":"sv","turki":"tr","ukraine":"uk","vietnam":"vi","wales":"cy","азербайджанский":"az","албанский":"sq","амхарский":"am","английский":"en","арабский":"ar","армянский":"hy","баскский":"eu","белорусский":"be","бирманский":"my","болгарский":"bg","валлийский":"cy","венгерский":"hu","вьетнамский":"vi","галисийский":"gl","греческий":"el","датский":"da","иврит":"he","индонезийский":"id","ирландский":"ga","исландский":"is","испанский":"es","итальянский":"it","каталанский":"ca","китайский (традиционный)":"zh-tw","китайский (упрощенный)":"zh-cn","корейский":"ko","креольский (гаити)":"ht","курманджи":"ku","латинский":"la","латышский":"lv","литовский":"lt","македонский":"mk","малайский":"ms","мальтийский":"mt","маори":"mi","монгольский":"mn","немецкий":"de","нидерландский":"nl","норвежский":"nb","персидский":"fa","польский":"pl","португальский":"pt","румынский":"ro","русский":"ru","сербский":"sr","словацкий":"sk","словенский":"sl","тайский":"th","турецкий":"tr","узбекский":"uz","украинский":"uk","финский":"fi","французский":"fr","хинди":"hi","хорватский":"hr","чешский":"cs","шведский":"sv","шотландский (гэльский)":"gd","эсперанто":"eo","эстонский":"et","японский":"ja","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":"ku","litewski":"lt","łaciński":"la","łotewski":"lv","macedoński":"mk","malajalam":"ml","malajski":"ms","maltański":"mt","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","азербайджанская":"az","албанская":"sq","амхарская":"am","англійская":"en","арабская":"ar","армянская":"hy","балгарская":"bg","баскская":"eu","беларуская":"be","в\'етнамская":"vi","валійская":"cy","венгерская":"hu","гаіцянская крэольская":"ht","галандская":"nl","галісійская":"gl","грэчаская":"el","дацкая":"da","інданезійская":"id","ірландская":"ga","ісландская":"is","іспанская":"es","італьянская":"it","іўрыт":"he","карэйская":"ko","каталонская":"ca","кітайская (спрошчаная)":"zh-cn","кітайская (традыцыйная)":"zh-tw","курдская (курманджы)":"ku","латышская":"lv","лацінская":"la","літоўская":"lt","м\'янманская (бірманская)":"my","маары":"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","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","kanada":"kn","katalonisht":"ca","kinezisht (e thjeshtuar)":"zh-cn","kinezisht (tradicionale)":"zh-tw","koreanisht":"ko","kreolishte haitiane":"ht","kroatisht":"hr","latinisht":"la","letonisht":"lv","lituanisht":"lt","malajalamisht":"ml","malajzisht":"ms","malteze":"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","ሀንጋሪኛ":"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","አዜርባይጃንኛ":"az","አይሪሽ":"ga","አይስላንድኛ":"is","ኡዝቤክኛ":"uz","ኤስቶኒያኛ":"et","ኤስፐራንቶ":"eo","እንዶኔዢያኛ":"id","እንግሊዝኛ":"en","ኩርድሽኛ":"ku","ካታላንኛ":"ca","ካናዳኛ":"kn","ክሮኤሽያኛ":"hr","ኮሪያኛ":"ko","ዌልሽ":"cy","ዐረብኛ":"ar","ዕብራይስጥ":"he","ዙሉኛ":"zu","የሃይቲ ክረኦሌኛ":"ht","የስኮት ጌልክኛ":"gd","ዩክሬንኛ":"uk","ደችኛ":"nl","ዴንሽኛ":"da","ጀርመንኛ":"de","ጃፓንኛ":"ja","ጋሊሺያኛ":"gl","ግሪክኛ":"el","ጣሊያንኛ":"it","ፈረንሳይኛ":"fr","ፊኒሽኛ":"fi","ፐርሺያኛ":"fa","ፖሊሽኛ":"pl","ፖርቱጋሊኛ":"pt","alban":"sq","alman":"de","amarikcə":"am","azərbaycan dili":"az","bask":"eu","belarusca":"be","bolqar":"bg","çex":"cs","çin (ən\'ənəvi)":"zh-tw","çin (sadələşdirilmiş)":"zh-cn","danimarka":"da","erməni":"hy","eston":"et","ərəb":"ar","fars dili":"fa","fin":"fi","fransız":"fr","haiti kreol dili":"ht","hind":"hi","xorvat":"hr","ispan":"es","i̇ndoneziya":"id","i̇ngilis":"en","i̇rland":"ga","i̇sland":"is","i̇sveç":"sv","i̇talyan":"it","i̇vrit":"he","katalan":"ca","koreya":"ko","kürd dili (kurmanci)":"ku","qalisian":"gl","latın":"la","latış":"lv","litva":"lt","macar":"hu","makedoniya":"mk","maoricə":"mi","monqolca":"mn","myanma (birma) dili":"my","norveç":"nb","özbək":"uz","polyak":"pl","portuqal":"pt","rumın":"ro","rus":"ru","serb":"sr","sloven":"sl","şotland (kelt)":"gd","tayca":"th","teluqu":"te","türk":"tr","uels":"cy","ukrayna":"uk","vyetnam":"vi","yapon":"ja","yunan":"el","zulu dili":"zu","albaniż":"sq","amħari":"am","armen":"hy","ażerbajġani":"az","belarussu":"be","bulgaru":"bg","ċek":"cs","ċiniż (semplifikat)":"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","kurd (kurmanji)":"ku","latvjan":"lv","litwen":"lt","maċedonjan":"mk","malasjan":"ms","malti":"mt","marati":"mr","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","albanski":"sq","amharik":"am","arapski":"ar","armenijski":"hy","azerbajdžanski":"az","bjeloruski":"be","bugarski":"bg","burmanski":"my","češki":"cs","danski":"da","engleski":"en","estonski":"et","finski":"fi","galski":"gl","grčki":"el","haićansko-kreolski":"ht","hebrejski":"he","hindu":"hi","hrvatski":"hr","indonezijski":"id","irski":"ga","islandski":"is","japanski":"ja","katalonski":"ca","kineski (pojednost.)":"zh-cn","kineski (tradicionalni)":"zh-tw","korejski":"ko","kurdski":"ku","latinski":"la","latvijski/letonski":"lv","litvanski":"lt","mađarski":"hu","makedonski":"mk","malezijski":"ms","malteški":"mt","nizozemski":"nl","norveški":"nb","njemački":"de","perzijski":"fa","poljski":"pl","rumunjski":"ro","ruski":"ru","slovački":"sk","slovenski":"sl","srpski":"sr","škotski keltski":"gd","španjolski":"es","švedski":"sv","tajlandski":"th","talijanski":"it","turski":"tr","ukrajinski":"uk","uzbekistanski":"uz","velški":"cy","vijetnamski":"vi","آذرباﻳﺠﺎﻧﻰ":"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","کانارا":"kn","کرئول هائیتی":"ht","کردی":"ku","کرواتی":"hr","کره‌ای":"ko","گالیسی":"gl","گاليک اسکاتلندی":"gd","لاتين":"la","لتونيايی":"lv","لهستانی":"pl","ليتوانيايی":"lt","مائوری":"mi","مالایالمی":"ml","مالايی":"ms","مالتی":"mt","مجاری":"hu","مراتی":"mr","مغولی":"mn","مقدونيه‌ای":"mk","نروژی":"nb","ولزی":"cy","ويتنامی":"vi","هلندی":"nl","هندی":"hi","يونانی":"el","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":"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","tai":"th","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","αγγλικά":"en","αζερμπαϊτζανικά":"az","αλβανικά":"sq","αμχαρικά":"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","κρεόλ αϊτής":"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","amxar":"am","arman":"hy","bolgar":"bg","dat":"da","fors":"fa","fransuz":"fr","gaiti-kreol":"ht","galisiy":"gl","golland":"nl","grek":"el","ibroniy":"he","indonez":"id","ingliz":"en","irland":"ga","island":"is","italyan":"it","koreys":"ko","kurd (kurmonji)":"ku","latish":"lv","lotin":"la","makedon":"mk","maltiy":"mt","maratxi":"mr","mo‘g‘ul":"mn","nemis":"de","norveg":"nb","ozarbayjon":"az","portugal":"pt","rumin":"ro","tay":"th","turk":"tr","ukrain":"uk","valliy":"cy","venger":"hu","xitoy (an’anaviy)":"zh-tw","xitoy (soddalashgan)":"zh-cn","o‘zbek":"uz","shotland-gel":"gd","shved":"sv","chex":"cs","albanska":"sq","amharísku":"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":"ku","latína":"la","lettneska":"lv","litháíska":"lt","makedónska":"mk","malajíska":"ms","maltneska":"mt","maoríska":"mi","maratí":"mr","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","ադրբեջաներեն":"az","ալբաներեն":"sq","ամհարերեն":"am","անգլերեն":"en","արաբերեն":"ar","բասկերեն":"eu","բելառուսերեն":"be","բիրմաներեն":"my","բուլղարերեն":"bg","գալիսերեն":"gl","գերմաներեն":"de","դանիերեն":"da","եբրայերեն":"he","զուլուսերեն":"zu","էսպերանտո":"eo","էստոներեն":"et","թայերեն":"th","թուրքերեն":"tr","ինդոնեզերեն":"id","իռլանդերեն":"ga","իսլանդերեն":"is","իսպաներեն":"es","իտալերեն":"it","լատիներեն":"la","լատվիերեն":"lv","լեհերեն":"pl","լիտվերեն":"lt","խորվաթերեն":"hr","կաննադա":"kn","կատալաներեն":"ca","կելտական շոտլանդերեն":"gd","կորեերեն":"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","քրդերեն (քուրմանջի)":"ku","ֆիններեն":"fi","ֆրանսերեն":"fr","arabia":"ar","baski":"eu","burma":"my","englanti":"en","espanja":"es","haitinkreoli":"ht","heprea":"he","hollanti":"nl","iiri":"ga","islanti":"is","italia":"it","japani":"ja","katalaani":"ca","kiina (perinteinen)":"zh-tw","kiina (yksinkert.)":"zh-cn","kreikka":"el","kroatia":"hr","kurdi":"ku","kymri":"cy","liettua":"lt","makedonia":"mk","malaiji":"ms","norja":"nb","persia":"fa","portugali":"pt","puola":"pl","ranska":"fr","ruotsi":"sv","saksa":"de","skottigaeli":"gd","slovakia":"sk","suomi":"fi","tanska":"da","tsekki":"cs","turkki":"tr","ukraina":"uk","unkari":"hu","uzbekki":"uz","valkovenäjä":"be","venäjä":"ru","viro":"et","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 gaelera":"gd","eslovakiera":"sk","esloveniera":"sl","esperantoa":"eo","estoniera":"et","euskara":"eu","frantsesa":"fr","gaelera":"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":"ku","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","suomiera":"fi","telugua":"te","thaiera":"th","turkiera":"tr","txekiera":"cs","txinera (soildua)":"zh-cn","txinera (tradizionala)":"zh-tw","ukrainera":"uk","uzbekera":"uz","vietnamera":"vi","zuluera":"zu","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","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","serbi":"sr","suec":"sv","txec":"cs","ucraïnès":"uk","xinès (simplificat)":"zh-cn","xinès (tradicional)":"zh-tw","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","ebreju (ivrits)":"he","franču":"fr","galisiešu":"gl","grieķu":"el","holandiešu":"nl","horvātu":"hr","igauņu":"et","indonēziešu":"id","īru":"ga","īslandiešu":"is","itāļu":"it","japāņu":"ja","katalāņu":"ca","korejiešu":"ko","kreolu (haiti)":"ht","krievu":"ru","kurdu":"ku","ķī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","belarussia":"be","cek":"cs","china (aks. sederhana)":"zh-cn","china (aks. tradisional)":"zh-tw","finlandia":"fi","gaelig":"ga","gaelik skotlandia":"gd","galisia":"gl","inggris":"en","islan":"is","jepang":"ja","katala":"ca","lituania":"lt","polandia":"pl","prancis":"fr","rumania":"ro","swensk":"sv","yunani":"el","అజర్‌బైజాని":"az","అర్మేనియన్":"hy","అల్బేనియన్":"sq","ఆంగ్లము":"en","ఆమ్హారిక్":"am","ఆరబిక్":"ar","ఇండొనేసియన్":"id","ఇటాలియన్":"it","ఉజ్బెక్":"uz","ఎస్పెరాంటో":"eo","ఏస్టోనియన్":"et","ఐరిష్":"ga","ఐస్ లాండిక్":"is","కన్నడ":"kn","కర్డిష్":"ku","కొరియన్":"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","amhárico":"am","azerí":"az","chino (simplificado)":"zh-cn","chino (tradicional)":"zh-tw","criollo haitiano":"ht","danés":"da","estonio":"et","euskera":"eu","finlandés":"fi","gallego":"gl","griego":"el","japonés":"ja","kurdo":"ku","malayo":"ms","noruego":"nb","rumano":"ro","uzbeco":"uz","albaania":"sq","amhaari":"am","araabia":"ar","armeenia":"hy","aserbaidžaani":"az","birma":"my","bulgaaria":"bg","eesti":"et","galeegi":"gl","haitikreooli":"ht","heebrea":"he","hispaania":"es","hollandi":"nl","horvaadi":"hr","indoneesia":"id","inglise":"en","islandi":"is","itaalia":"it","jaapani":"ja","kreeka":"el","ladina":"la","leedu":"lt","lihtsustatud hiina":"zh-cn","läti":"lv","makedoonia":"mk","malajalaami":"ml","maoori":"mi","mongoli":"mn","norra":"nb","poola":"pl","prantsuse":"fr","pärsia":"fa","rootsi":"sv","rumeenia":"ro","slovaki":"sk","sloveeni":"sl","soome":"fi","suulu":"zu","šoti":"gd","taani":"da","traditsiooniline hiina":"zh-tw","tšehhi":"cs","türgi":"tr","uelsi":"cy","ungari":"hu","usbeki":"uz","valgevene":"be","vene":"ru","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","koreyen":"ko","kreyòl ayisyen":"ht","kurde (kurmandji)":"ku","kwoasyen":"hr","laten":"la","letonyen":"lv","lityanyen":"lt","malè":"ms","malt":"mt","masedonyen":"mk","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","albaneg":"sq","almaeneg":"de","arabeg":"ar","armeneg":"hy","aserbaijaneg":"az","basgeg":"eu","belarwseg":"be","bwlgaraidd":"bg","catalaneg":"ca","creol haiti":"ht","croateg":"hr","cymraeg":"cy","cyrdeg (kurmandji)":"ku","daneg":"da","eidaleg":"it","estoneg":"et","fietnameg":"vi","ffineg":"fi","fflemeg":"nl","ffrangeg":"fr","gaeleg yr alban":"gd","galisaidd":"gl","groeg":"el","gwyddeleg":"ga","hebraeg":"he","hwngareg":"hu","iaith corea":"ko","indonesieg":"id","islandeg":"is","iwcraineg":"uk","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","slofac":"sk","slofenia":"sl","swedeg":"sv","swlw":"zu","tsieceg":"cs","tsieineeg (traddodiadol)":"zh-tw","tsieineeg (wedi symleiddio)":"zh-cn","twrceg":"tr","usbec":"uz","अंग्रेज़ी":"en","अज़रबैजानी":"az","अल्बेनियन":"sq","आइसलैंडिक":"is","आर्मेनियन":"hy","इटैलियन":"it","उज़्बेक":"uz","एस्तोनियन":"et","एस्पेरांटो":"eo","ऐम्हेरिक":"am","कन्नड़":"kn","कुर्दिश (करमंजी)":"ku","कैटेलन":"ca","गैलिशियन":"gl","चीनी (परंपरागत)":"zh-tw","चेक":"cs","जापानी":"ja","ज़ुलु":"zu","डैनिश":"da","तुर्क":"tr","तेलुगु":"te","पुर्तगाली":"pt","फ़िनिश":"fi","फ़्रेंच":"fr","बर्मी":"my","बुल्गारियन":"bg","बेलारूसीयन":"be","बैस्क":"eu","मलयालम":"ml","माऔरी":"mi","माल्टी":"mt","मेसीडोनियन":"mk","यूक्रेनियन":"uk","रूसी":"ru","रोमेनियन":"ro","लातवियन":"lv","लैटिन":"la","वियतनामी":"vi","सर्बियाई":"sr","स्पैनिश":"es","स्लोवाक":"sk","स्लोवेनियन":"sl","हंगरियन":"hu","हीब्रू":"he","हैतियन क्रिओल":"ht","阿尔巴尼亚语":"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","拉丁语":"la","拉脱维亚语":"lv","立陶宛语":"lt","罗马尼亚语":"ro","马耳他语":"mt","马拉地语":"mr","马拉雅拉姆语":"ml","马来语":"ms","马其顿语":"mk","毛利语":"mi","蒙古语":"mn","缅甸语":"my","南非祖鲁语":"zu","挪威语":"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","азербайджански":"az","английски":"en","арабски":"ar","арменски":"hy","баски":"eu","беларуски":"be","бирмански":"my","български":"bg","галисийски":"gl","гръцки":"el","датски":"da","индонезийски":"id","ирландски":"ga","испански":"es","италиански":"it","китайски (опростен)":"zh-cn","китайски (традиционен)":"zh-tw","корейски":"ko","кюрдски":"ku","латвийски":"lv","литовски":"lt","малайски":"ms","малтийски":"mt","немски":"de","нидерландски":"nl","норвежки":"nb","персийски":"fa","румънски":"ro","словашки":"sk","словенски":"sl","сръбски":"sr","тайландски":"th","уелски":"cy","узбекски":"uz","финландски":"fi","френски":"fr","хаитянски креолски":"ht","хърватски":"hr","шотландски келтски":"gd","японски":"ja","الآيسلندية":"is","الأذرية":"az","الارمنية":"hy","الإسبانية":"es","الاسبرانتو":"eo","الإستونية":"et","الاسكتلندية الغالية":"gd","الألبانية":"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","الفارسية":"fa","الفرنسية":"fr","الفنلندية":"fi","الفيتنامية":"vi","القطلونية":"ca","الكانادا":"kn","الكردية":"ku","الكرواتية":"hr","الكورية":"ko","اللاتفية":"lv","اللاتينية":"la","اللغة الكريولية الهايتية":"ht","الليتوانية":"lt","المالايالامية":"ml","المالطيّة":"mt","الماورية":"mi","المقدونية":"mk","الملايو":"ms","المنغولية":"mn","المهراتية":"mr","النرويجية":"nb","الهندية":"hi","الهنغارية":"hu","الهولندية":"nl","الويلزية":"cy","اليابانية":"ja","اليونانية":"el","баскијски":"eu","вијетнамски":"vi","галски":"gl","енглески":"en","индонежански":"id","јапански":"ja","јерменски":"hy","кинески (поједностављени)":"zh-cn","кинески (традиционални)":"zh-tw","креолски (хаити)":"ht","летонски":"lv","мађарски":"hu","марати":"mr","немачки":"de","персијски":"fa","пољски":"pl","румунски":"ro","словеначки":"sl","тајски":"th","украјински":"uk","азербайжан":"az","албани":"sq","амхарик":"am","англи":"en","араб":"ar","армени":"hy","баск":"eu","беларусь":"be","бирм":"my","болгар":"bg","вьетнам":"vi","гаити креол":"ht","галик":"gl","гаэл":"gd","герман":"de","голланд":"nl","грек":"el","дани":"da","индонези":"id","ирланд":"ga","исланд":"is","испани":"es","итали":"it","каталан":"ca","кипр":"he","курд":"ku","латви":"lv","латин":"la","литва":"lt","македон":"mk","малай":"ms","малайлам":"ml","малти":"mt","монгол":"mn","норвеги":"nb","орос":"ru","перс":"fa","польш":"pl","португаль":"pt","румын":"ro","серби":"sr","словак":"sk","словени":"sl","солонгос":"ko","тай":"th","турк":"tr","тэлүгү":"te","узбек":"uz","украин":"uk","унгар":"hu","уэльс":"cy","финлянд":"fi","франц":"fr","хорват":"hr","хятад (ердийн)":"zh-cn","хятад (уламжлалт)":"zh-tw","чех":"cs","швед":"sv","эстони":"et","япон":"ja","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":"ku","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","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ă":"ku","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","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ų":"ku","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ų (gėlų)":"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","갈리시아어":"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","에스토니아어":"et","에스페란토어":"eo","영어":"en","우즈베크어":"uz","우크라이나어":"uk","웨일즈어":"cy","이탈리아어":"it","인도네시아어":"id","일본어":"ja","줄루어":"zu","중국어(간체)":"zh-cn","중국어(번체)":"zh-tw","체코어":"cs","카탈로니아어":"ca","칸나다어":"kn","쿠르드어":"ku","크로아티아어":"hr","태국어":"th","터키어":"tr","텔루구어":"te","페르시아어":"fa","포르투갈어":"pt","폴란드어":"pl","프랑스어":"fr","핀란드어":"fi","한국어":"ko","헝가리어":"hu","히브리어":"he","힌디어":"hi","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 (kurmanji)":"ku","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","tailandese":"th","tedesco":"de","ucraino":"uk","ungherese":"hu","quốc tế ngữ":"eo","tiếng ả rập":"ar","tiếng albania":"sq","tiếng amharic":"am","tiếng anh":"en","tiếng armenia":"hy","tiếng azerbaijan":"az","tiếng ba lan":"pl","tiếng ba tư":"fa","tiếng basque":"eu","tiếng belarus":"be","tiếng bồ đào nha":"pt","tiếng bulgaria":"bg","tiếng catalan":"ca","tiếng creole ở haiti":"ht","tiếng croatia":"hr","tiếng do thái":"he","tiếng đan mạch":"da","tiếng đức":"de","tiếng estonia":"et","tiếng gael scotland":"gd","tiếng galicia":"gl","tiếng hà lan":"nl","tiếng hàn":"ko","tiếng hindi":"hi","tiếng hungary":"hu","tiếng hy lạp":"el","tiếng iceland":"is","tiếng indonesia":"id","tiếng ireland":"ga","tiếng kannada":"kn","tiếng kurd":"ku","tiếng latinh":"la","tiếng latvia":"lv","tiếng litva":"lt","tiếng mã lai":"ms","tiếng macedonia":"mk","tiếng malayalam":"ml","tiếng malta":"mt","tiếng maori":"mi","tiếng marathi":"mr","tiếng mông cổ":"mn","tiếng myanmar":"my","tiếng na uy":"nb","tiếng nga":"ru","tiếng nhật":"ja","tiếng pháp":"fr","tiếng phần lan":"fi","tiếng rumani":"ro","tiếng séc":"cs","tiếng serbia":"sr","tiếng slovak":"sk","tiếng slovenia":"sl","tiếng tây ban nha":"es","tiếng telugu":"te","tiếng thái":"th","tiếng thổ nhĩ kỳ":"tr","tiếng thụy điển":"sv","tiếng trung (giản thể)":"zh-cn","tiếng trung (phồn thể)":"zh-tw","tiếng ukraina":"uk","tiếng uzbek":"uz","tiếng việt":"vi","tiếng xứ wales":"cy","tiếng ý":"it","tiếng zulu":"zu","にほんご":"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(A,B){A.exports=(A,B,t)=>{let e=null;const g=window.AbortController?new window.AbortController:null,i=g?g.signal:null;return Promise.race([fetch(A,Object.assign({signal:i},B)).then(A=>(clearTimeout(e),A)),new Promise((A,B)=>{e=setTimeout(()=>{g&&g.abort(),B(new Error("Fetch timed out after ".concat(t," ms")))},t)})])}},function(A,B,t){function e(A,B){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(A);B&&(e=e.filter((function(B){return Object.getOwnPropertyDescriptor(A,B).enumerable}))),t.push.apply(t,e)}return t}function g(A,B,t){return B in A?Object.defineProperty(A,B,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[B]=t,A}const i=t(18),{OrderedMap:Q}=t(22),s=t(5),n=t(16),r=t(64),E=t(2),c=t(200),o=t(201),w=t(73),C=t(209),a=t(60),I=t(29),Y=t(0),h=t(56),M=t(14),F=t(8),D=t(27),u=t(210),l=t(74),d=t(211),U=t(212),N=t(213),m=t(214),G=t(215),f=t(216),H=t(75),R=t(7),p=t(6),J={scratch3_control:t(217),scratch3_event:t(218),scratch3_looks:t(219),scratch3_motion:t(220),scratch3_operators:t(221),scratch3_sound:t(222),scratch3_sensing:t(223),scratch3_data:t(224),scratch3_procedures:t(225)},y=t(226),k=t(227),T=["#0FBD8C","#0DA57A","#0B8E69"],j=(()=>{const A={};return A[s.ANGLE]={shadow:{type:"math_angle",fieldName:"NUM"}},A[s.COLOR]={shadow:{type:"colour_picker",fieldName:"COLOUR"}},A[s.NUMBER]={shadow:{type:"math_number",fieldName:"NUM"}},A[s.STRING]={shadow:{type:"text",fieldName:"TEXT"}},A[s.BOOLEAN]={check:"Boolean"},A[s.MATRIX]={shadow:{type:"matrix",fieldName:"MATRIX"}},A[s.NOTE]={shadow:{type:"note",fieldName:"NOTE"}},A[s.IMAGE]={fieldType:"field_image"},A})(),x=A=>{let B=0;return{canAddCloudVariable:()=>B{B++},removeCloudVariable:()=>{B--},hasCloudVariables:()=>B>0,getNumberOfCloudVariables:()=>B}};let S=-1,b=-1,z=-1;class L extends i{constructor(){super(),this.targets=[],this.executableTargets=[],this.threads=[],this.threadMap=new Map,this.sequencer=new o(this),this.flyoutBlocks=new n(this,!0),this.monitorBlocks=new n(this,!0),this._editingTarget=null,this._primitives={},this._blockInfo=[],this._hats={},this._scriptGlowsPreviousFrame=[],this._nonMonitorThreadCount=0,this._lastStepDoneThreads=null,this._cloneCounter=0,this._refreshTargets=!1,this.monitorBlockInfo={},this._monitorState=Q({}),this._prevMonitorState=Q({}),this.turboMode=!1,this.frameLoop=new k(this),this.currentStepTime=null,this.updateCurrentMSecs(),this.redrawRequested=!1,this._registerBlockPackages(),this.ioDevices={clock:new d(this),cloud:new U(this),keyboard:new N(this),mouse:new m(this),mouseWheel:new G(this),userData:new f,video:new H(this)},this.peripheralExtensions={},this.profiler=null,this.cloudOptions={limit:10};const A=x(this.cloudOptions);this.hasCloudData=A.hasCloudVariables,this.canAddCloudVariable=A.canAddCloudVariable,this.getNumberOfCloudVariables=A.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(A),this.removeCloudVariable=this._initializeRemoveCloudVariable(A),this.origin=null,this._stageTarget=null,this.addonBlocks={},this.stageWidth=L.STAGE_WIDTH,this.stageHeight=L.STAGE_HEIGHT,this.runtimeOptions={maxClones:L.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()}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 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 THREAD_STEP_INTERVAL(){return 1e3/60}static get THREAD_STEP_INTERVAL_COMPATIBILITY(){return 1e3/30}static get MAX_CLONES(){return 300}_initializeAddCloudVariable(A){return()=>{const B=this.hasCloudData();A.addCloudVariable(),!B&&this.hasCloudData()&&this.emit(L.HAS_CLOUD_DATA_UPDATE,!0)}}_initializeRemoveCloudVariable(A){return()=>{const B=this.hasCloudData();A.removeCloudVariable(),B&&!this.hasCloudData()&&this.emit(L.HAS_CLOUD_DATA_UPDATE,!1)}}_registerBlockPackages(){for(const A in J)if(J.hasOwnProperty(A)){const B=new J[A](this);if(B.getPrimitives){const A=B.getPrimitives();for(const t in A)A.hasOwnProperty(t)&&(this._primitives[t]=A[t].bind(B))}if(B.getHats){const A=B.getHats();for(const B in A)A.hasOwnProperty(B)&&(this._hats[B]=A[B])}B.getMonitored&&(this.monitorBlockInfo=Object.assign({},this.monitorBlockInfo,B.getMonitored())),this.compilerRegisterExtension(A,B)}}compilerRegisterExtension(A,B){this["ext_".concat(A)]=B}getMonitorState(){return this._monitorState}_makeExtensionMenuId(A,B){return"".concat(B,"_menu_").concat(D(A))}makeMessageContextForTarget(A){const B={};(A=A||this.getEditingTarget()||this.getTargetForStage())&&(B.targetType=A.isStage?a.STAGE:a.SPRITE)}_registerExtensionPrimitives(A){const B={id:A.id,name:h(A.name),showStatusButton:A.showStatusButton,blockIconURI:A.blockIconURI,menuIconURI:A.menuIconURI};A.color1?(B.color1=A.color1,B.color2=A.color2,B.color3=A.color3):(B.color1=T[0],B.color2=T[1],B.color3=T[2]),this._blockInfo.push(B),this._fillExtensionCategory(B,A);for(const t in B.customFieldTypes)if(A.customFieldTypes.hasOwnProperty(t)){const A=B.customFieldTypes[t];this.emit(L.EXTENSION_FIELD_ADDED,{name:"field_".concat(A.extendedName),implementation:A.fieldImplementation})}this.emit(L.EXTENSION_ADDED,B)}_refreshExtensionPrimitives(A){const B=this._blockInfo.find(B=>B.id===A.id);B&&(B.name=h(A.name),this._fillExtensionCategory(B,A),this.emit(L.BLOCKSINFO_UPDATE,B))}_fillExtensionCategory(A,B){A.blocks=[],A.customFieldTypes={},A.menus=[],A.menuInfo={};for(const t in B.menus)if(B.menus.hasOwnProperty(t)){const e=B.menus[t],g=this._buildMenuForScratchBlocks(t,e,A);A.menus.push(g),A.menuInfo[t]=e}for(const t in B.customFieldTypes)if(B.customFieldTypes.hasOwnProperty(t)){const e=B.customFieldTypes[t],g=this._buildCustomFieldInfo(t,e,B.id,A);A.customFieldTypes[t]=g}if(B.docsURI)try{const t=new URL(B.docsURI);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new Error("invalid protocol");const e={info:{},xml:"')};A.blocks.push(e)}catch(A){Y.warn("cannot create docsURI button",A)}for(const t of B.blocks)try{const B=this._convertForScratchBlocks(t,A);if(A.blocks.push(B),B.json){const A=B.json.type;t.blockType!==E.EVENT&&(this._primitives[A]=B.info.func),t.blockType!==E.EVENT&&t.blockType!==E.HAT||(this._hats[A]={edgeActivated:t.isEdgeActivated,restartExistingThreads:t.shouldRestartExistingThreads})}}catch(A){Y.error("Error parsing block: ",{block:t,error:A})}}_convertMenuItems(A){if("function"!=typeof A){const B=this.makeMessageContextForTarget();return A.map(A=>{const t=h(A,B);switch(typeof t){case"string":return[t,t];case"object":return[h(A.text,B),A.value];default:throw new Error("Can't interpret menu item: ".concat(JSON.stringify(A)))}})}return A}_buildMenuForScratchBlocks(A,B,t){const e=this._makeExtensionMenuId(A,t.id),g=this._convertMenuItems(B.items);return{json:{message0:"%1",type:e,inputsInline:!0,output:"String",colour:t.color1,colourSecondary:t.color2,colourTertiary:t.color3,outputShape:B.acceptReporters?C.OUTPUT_SHAPE_ROUND:C.OUTPUT_SHAPE_SQUARE,args0:[{type:"field_dropdown",name:A,options:g}]}}}_buildCustomFieldInfo(A,B,t,e){const g="".concat(t,"_").concat(A);return{fieldName:A,extendedName:g,argumentTypeInfo:{shadow:{type:g,fieldName:"field_".concat(g)}},scratchBlocksDefinition:this._buildCustomFieldTypeForScratchBlocks(g,B.output,B.outputShape,e),fieldImplementation:B.implementation}}_buildCustomFieldTypeForScratchBlocks(A,B,t,e){return{json:{type:A,message0:"%1",inputsInline:!0,output:B,colour:e.color1,colourSecondary:e.color2,colourTertiary:e.color3,outputShape:t,args0:[{name:"field_".concat(A),type:"field_".concat(A)}]}}}_convertForScratchBlocks(A,B){return"---"===A?this._convertSeparatorForScratchBlocks(A):A.blockType===E.BUTTON?this._convertButtonForScratchBlocks(A):this._convertBlockForScratchBlocks(A,B)}_convertBlockForScratchBlocks(A,B){const t="".concat(B.id,"_").concat(A.opcode),e={type:t,inputsInline:!0,category:B.name,colour:B.color1,colourSecondary:B.color2,colourTertiary:B.color3},g={argsMap:{},blockJSON:e,categoryInfo:B,blockInfo:A,inputList:[]},i=A.blockIconURI||B.blockIconURI;if(i){e.extensions=["scratch_extension"],e.message0="%1 %2";const A={type:"field_image",src:i,width:40,height:40},B={type:"field_vertical_separator"};e.args0=[A,B]}switch(A.blockType){case E.COMMAND:e.outputShape=C.OUTPUT_SHAPE_SQUARE,e.previousStatement=null,A.isTerminal||(e.nextStatement=null);break;case E.REPORTER:e.output="String",e.outputShape=C.OUTPUT_SHAPE_ROUND;break;case E.BOOLEAN:e.output="Boolean",e.outputShape=C.OUTPUT_SHAPE_HEXAGONAL;break;case E.HAT:case E.EVENT:A.hasOwnProperty("isEdgeActivated")||(A.isEdgeActivated=!0),e.outputShape=C.OUTPUT_SHAPE_SQUARE,e.nextStatement=null;break;case E.CONDITIONAL:case E.LOOP:A.branchCount=A.branchCount||1,e.outputShape=C.OUTPUT_SHAPE_SQUARE,e.previousStatement=null,A.isTerminal||(e.nextStatement=null)}const Q=Array.isArray(A.text)?A.text:[A.text];let s=0,n=0,r=0;const c=this._convertPlaceholders.bind(this,g),o=this.makeMessageContextForTarget();for(;s0?n+1:"")}],++n,++r)}A.blockType===E.REPORTER?A.disableMonitor||0!==g.inputList.length||(e.checkboxInFlyout=!0):A.blockType===E.LOOP&&(e["lastDummyAlign".concat(r)]="RIGHT",e["message".concat(r)]="%1",e["args".concat(r)]=[{type:"field_image",src:"./static/blocks-media/repeat.svg",width:24,height:24,alt:"*",flip_rtl:!0}],++r);const w=A.isDynamic?''):"",a=g.inputList.join(""),I='').concat(w).concat(a,"");return{info:g.blockInfo,json:g.blockJSON,xml:I}}_convertSeparatorForScratchBlocks(A){return{info:A,xml:''}}_convertButtonForScratchBlocks(A){["MAKE_A_LIST","MAKE_A_PROCEDURE","MAKE_A_VARIABLE"].indexOf(A.func)<0&&Y.error("Custom button callbacks not supported yet: ".concat(A.func));const B=this.makeMessageContextForTarget(),t=h(A.text,B);return{info:A,xml:'')}}_constructInlineImageJson(A){return A.dataURI||Y.warn("Missing data URI in extension block with argument type IMAGE"),{type:"field_image",src:A.dataURI||"",width:24,height:24,flip_rtl:A.flipRTL||!1}}_convertPlaceholders(A,B,t){t=t.replace(/[<"&]/,"_");const e=A.blockInfo.arguments[t]||{};let g,i=j[e.type]||{};if(!j[e.type]&&A.categoryInfo.customFieldTypes[e.type]&&(i=A.categoryInfo.customFieldTypes[e.type].argumentTypeInfo),"field_image"===i.fieldType)g=this._constructInlineImageJson(e);else{g={type:"input_value",name:t};const B=void 0===e.defaultValue?"":D(h(e.defaultValue,this.makeMessageContextForTarget()).toString());let Q,s,n;if(i.check&&(g.check=i.check),e.menu){const B=A.categoryInfo.menuInfo[e.menu];B.acceptReporters?(Q=t,s=this._makeExtensionMenuId(e.menu,A.categoryInfo.id),n=e.menu):(g.type="field_dropdown",g.options=this._convertMenuItems(B.items),Q=null,s=null,n=t)}else Q=t,s=i.shadow&&i.shadow.type||null,n=i.shadow&&i.shadow.fieldName||null;Q&&A.inputList.push('')),s&&A.inputList.push('')),B&&n&&A.inputList.push('').concat(B,"")),s&&A.inputList.push(""),Q&&A.inputList.push("")}const Q="args".concat(A.outLineNum),s=A.blockJSON[Q]=A.blockJSON[Q]||[];g&&s.push(g);const n=s.length;return A.argsMap[t]=n,"%".concat(n)}getBlocksXML(A){return this._blockInfo.map(B=>{const{name:t,color1:e,color2:g}=B,i=B.blocks.filter(B=>{let t=!0;return A&&B.info.filter&&(t=B.info.filter.includes(A.isStage?a.STAGE:a.SPRITE)),t&&!B.info.hideFromPalette}),Q='colour="'.concat(e,'" secondaryColour="').concat(g,'"');let s="";B.menuIconURI?s=B.menuIconURI:B.blockIconURI&&(s=B.blockIconURI);const n=s?'iconURI="'.concat(s,'"'):"";let r="";return B.showStatusButton&&(r='showStatusButton="true"'),{id:B.id,xml:'").concat(i.map(A=>A.xml).join(""),"")}})}getBlocksJSON(){return this._blockInfo.reduce((A,B)=>A.concat(B.blocks.map(A=>A.json)),[])}getScratchLinkSocket(A){return(this._linkSocketFactory||this._defaultScratchLinkSocketFactory)(A)}configureScratchLinkSocketFactory(A){this._linkSocketFactory=A}_defaultScratchLinkSocketFactory(A){return new u(A)}registerPeripheralExtension(A,B){this.peripheralExtensions[A]=B}scanForPeripheral(A){this.peripheralExtensions[A]&&this.peripheralExtensions[A].scan()}connectPeripheral(A,B){this.peripheralExtensions[A]&&this.peripheralExtensions[A].connect(B)}disconnectPeripheral(A){this.peripheralExtensions[A]&&this.peripheralExtensions[A].disconnect()}getPeripheralIsConnected(A){let B=!1;return this.peripheralExtensions[A]&&(B=this.peripheralExtensions[A].isConnected()),B}emitMicListening(A){this.emit(L.MIC_LISTENING,A)}getOpcodeFunction(A){return this._primitives[A]}getIsHat(A){return this._hats.hasOwnProperty(A)}getIsEdgeActivatedHat(A){return this._hats.hasOwnProperty(A)&&this._hats[A].edgeActivated}attachAudioEngine(A){this.audioEngine=A,t(228)(A)}attachRenderer(A){this.renderer=A,this.renderer.setLayerGroupOrdering(M.LAYER_GROUPS),this.renderer.offscreenTouching=!this.runtimeOptions.fencing}attachV2BitmapAdapter(A){this.v2BitmapAdapter=A}attachStorage(A){this.storage=A}_pushThread(A,B,t){const e=new I(A);return e.target=B,e.stackClick=Boolean(t&&t.stackClick),e.updateMonitor=Boolean(t&&t.updateMonitor),e.blockContainer=e.updateMonitor?this.monitorBlocks:B.blocks,e.pushStack(A),this.threads.push(e),e.stackClick||e.updateMonitor||this.threadMap.set(e.getId(),e),t&&t.updateMonitor||!this.compilerOptions.enabled||e.tryCompile(),e}_stopThread(A){A.isKilled=!0,this.sequencer.retireThread(A)}_restartThread(A){const B=new I(A.topBlock);B.target=A.target,B.stackClick=A.stackClick,B.updateMonitor=A.updateMonitor,B.blockContainer=A.blockContainer,B.pushStack(A.topBlock),A.triedToCompile&&this.compilerOptions.enabled&&B.tryCompile(),B.stackClick||B.updateMonitor||this.threadMap.set(B.getId(),B);const t=this.threads.indexOf(A);return t>-1?(this.threads[t]=B,B):(this.threads.push(A),A)}emitCompileError(A,B){this.emit(L.COMPILE_ERROR,A,B)}isActiveThread(A){return A.stack.length>0&&A.status!==I.STATUS_DONE&&this.threads.indexOf(A)>-1}isWaitingThread(A){return A.status===I.STATUS_PROMISE_WAIT||A.status===I.STATUS_YIELD_TICK||!this.isActiveThread(A)}toggleScript(A,B){B=Object.assign({target:this._editingTarget,stackClick:!1},B);for(let t=0;t=0;B--){const e=t[B],g=e.blocks.getScripts();for(let B=0;B=0;t--){const g=e[t],i=r.getScripts(g.blocks,A);for(let A=0;A{const{blockId:Q,fieldsOfInputs:s}=A;for(const A in B)if(s[A].value!==B[A])return;if(g.restartExistingThreads){const A=this.threadMap.get(I.getIdFromTargetAndBlock(t,Q));if(A)return void e.push(this._restartThread(A))}else for(let A=0;A{A.isCompiled||(w(this.sequencer,A),A.goToNextBlock())}),e}dispose(){this.stopAll(),this.targets.forEach(A=>{A.isOriginal&&A.deleteMonitors()}),this.targets.map(this.disposeTarget,this);const A=Q({});A.equals(this._monitorState)||(this._monitorState=A,this.emit(L.MONITORS_UPDATE,this._monitorState)),this.emit(L.RUNTIME_DISPOSED),this.ioDevices.clock.resetProjectTimer(),this.hasCloudData()&&this.emit(L.HAS_CLOUD_DATA_UPDATE,!1),this.ioDevices.cloud.clear();const B=x(this.cloudOptions);this.hasCloudData=B.hasCloudVariables,this.canAddCloudVariable=B.canAddCloudVariable,this.getNumberOfCloudVariables=B.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(B),this.removeCloudVariable=this._initializeRemoveCloudVariable(B)}addTarget(A){this.targets.push(A),this.executableTargets.push(A),A.isStage&&!this._stageTarget&&(this._stageTarget=A)}moveExecutable(A,B){const t=this.executableTargets.indexOf(A);this.executableTargets.splice(t,1);let e=t+B;return e>this.executableTargets.length&&(e=this.executableTargets.length),e<=0&&(e=this.executableTargets.length>0&&this.executableTargets[0].isStage?1:0),this.executableTargets.splice(e,0,A),e}setExecutablePosition(A,B){const t=this.executableTargets.indexOf(A);return this.moveExecutable(A,B-t)}removeExecutable(A){const B=this.executableTargets.indexOf(A);B>-1&&this.executableTargets.splice(B,1)}disposeTarget(A){this.targets=this.targets.filter(B=>A!==B||(B.dispose(),!1)),this._stageTarget===A&&(this._stageTarget=null)}stopForTarget(A,B){this.emit(L.STOP_FOR_TARGET,A,B);for(let t=0;tA.clearEdgeActivatedValues());for(let A=0;A!A.isKilled),this.updateThreadMap();for(const A in this._hats){if(!this._hats.hasOwnProperty(A))continue;this._hats[A].edgeActivated&&this.startHats(A)}this.redrawRequested=!1,this._pushMonitors(),null!==this.profiler&&(-1===b&&(b=this.profiler.idByName("Sequencer.stepThreads")),this.profiler.start(b));const A=this.sequencer.stepThreads();null!==this.profiler&&this.profiler.stop(),this._updateGlows(A),this._emitProjectRunStatus(this.threads.length+A.length-this._getMonitorThreadCount([...this.threads,...A])),this._lastStepDoneThreads=A,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(L.TARGETS_UPDATE,!1),this._refreshTargets=!1),this._prevMonitorState.equals(this._monitorState)||(this.emit(L.MONITORS_UPDATE,this._monitorState),this._prevMonitorState=this._monitorState),null!==this.profiler&&(this.profiler.stop(),this.profiler.reportFrames()),this.interpolationEnabled&&(this._lastStepTime=Date.now())}_getMonitorThreadCount(A){let B=0;return A.forEach(A=>{A.updateMonitor&&B++}),B}_pushMonitors(){this.monitorBlocks.runAllMonitored(this)}setEditingTarget(A){const B=this._editingTarget;this._editingTarget=A,this._scriptGlowsPreviousFrame=[],this._updateGlows(),B!==this._editingTarget&&this.requestToolboxExtensionsUpdate()}setCompatibilityMode(A){A?this.setFramerate(30):this.setFramerate(60)}setFramerate(A){A>250&&(A=250),A<0&&(A=1),this.frameLoop.setFramerate(A),this.emit(L.FRAMERATE_CHANGED,A)}setInterpolation(A){this.interpolationEnabled=A,this.frameLoop.setInterpolation(this.interpolationEnabled),this.emit(L.INTERPOLATION_CHANGED,A)}setRuntimeOptions(A){this.runtimeOptions=Object.assign({},this.runtimeOptions,A),this.emit(L.RUNTIME_OPTIONS_CHANGED,this.runtimeOptions),this.renderer&&(this.renderer.offscreenTouching=!this.runtimeOptions.fencing)}setCompilerOptions(A){this.compilerOptions=Object.assign({},this.compilerOptions,A),this.resetAllCaches(),this.emit(L.COMPILER_OPTIONS_CHANGED,this.compilerOptions)}setStageSize(A,B){if(A=Math.round(Math.max(1,A)),B=Math.round(Math.max(1,B)),this.stageWidth!==A||this.stageHeight!==B){const t=A-this.stageWidth,e=B-this.stageHeight;if(this._monitorState.size>0){const A=t/2,B=e/2;for(const t of this._monitorState.valueSeq()){const e=t.set("x",t.get("x")+A).set("y",t.get("y")+B);this.requestUpdateMonitor(e)}this.emit(L.MONITORS_UPDATE,this._monitorState)}this.stageWidth=A,this.stageHeight=B,this.renderer&&this.renderer.setStageSize(-A/2,A/2,-B/2,B/2)}this.emit(L.STAGE_SIZE_CHANGED,A,B)}setInEditor(A){}convertToPackagedRuntime(){}resetAllCaches(){for(const A of this.targets)A.isOriginal&&A.blocks.resetCache();this.flyoutBlocks.resetCache(),this.monitorBlocks.resetCache()}addAddonBlock(A){const B=A.procedureCode,t=A.arguments,i=A.arguments.map((A,B)=>"arg".concat(B)),Q=A.arguments.map(()=>"");this.addonBlocks[B]=function(A){for(var B=1;B"a-b"===A.id);s||(s={id:"a-b",name:"Addons",color1:A.color,color2:A.secondaryColor,color3:A.secondaryColor,blocks:[],customFieldTypes:{},menus:[]},this._blockInfo.unshift(s)),s.blocks.push({info:{},xml:'"}),this.resetAllCaches()}getAddonBlock(A){return Object.prototype.hasOwnProperty.call(this.addonBlocks,A)?this.addonBlocks[A]:null}findProjectOptionsComment(){const A=this.getTargetForStage().comments;for(const B of Object.values(A))if(B.text.includes(" // _twconfig_"))return B;return null}parseProjectOptions(){const A=this.findProjectOptionsComment();if(!A)return;const B=A.text.split("\n").find(A=>A.endsWith(" // _twconfig_"));if(!B)return void Y.warn("Config comment does not contain valid line");const t=B.substr(0,B.length-" // _twconfig_".length);let e;try{if(e=l.parse(t),!e||"object"!=typeof e)throw new Error("Invalid object")}catch(A){return void Y.warn("Config comment has invalid JSON",A)}"number"==typeof e.framerate&&this.setFramerate(e.framerate),e.turbo&&(this.turboMode=!0,this.emit(L.TURBO_MODE_ON)),e.interpolation&&this.setInterpolation(!0),e.runtimeOptions&&this.setRuntimeOptions(e.runtimeOptions),e.hq&&this.renderer&&this.renderer.setUseHighQualityRender(!0);const g=+e.width||this.stageWidth,i=+e.height||this.stageHeight;g===this.stageWidth&&i===this.stageHeight||this.setStageSize(g,i)}_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 A=(B,t)=>{const e={};for(const g of Object.keys(t)){const i=t[g],Q=B[g];if("object"==typeof i&&i){const B=A(Q,i);Object.keys(B).length>0&&(e[g]=B)}else i!==Q&&(e[g]=i)}return e};return A(this._defaultStoredSettings,this._generateAllProjectOptions())}storeProjectOptions(){const A=this.generateDifferingProjectOptions(),B="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(l.stringify(A)).concat(" // _twconfig_"),t=this.findProjectOptionsComment();if(t)t.text=B;else{this.getTargetForStage().createComment(p(),null,B,50,50,350,170,!1)}this.emitProjectChanged()}precompile(){this.allScriptsDo((A,B)=>{const t=B.blocks.getBlock(A);if(this.getIsHat(t.opcode)){const t=new I(A);t.target=B,t.blockContainer=B.blocks,t.tryCompile()}})}enableDebug(){this.resetAllCaches(),this.debug=!0}_updateGlows(A){const B=[];B.push.apply(B,this.threads),A&&B.push.apply(B,A);const t=[],e=[];for(let A=0;A0&&this.emit(L.PROJECT_RUN_START),this._nonMonitorThreadCount>0&&0===A&&this.emit(L.PROJECT_RUN_STOP),this._nonMonitorThreadCount=A}quietGlow(A){const B=this._scriptGlowsPreviousFrame.indexOf(A);B>-1&&this._scriptGlowsPreviousFrame.splice(B,1)}glowBlock(A,B){B?this.emit(L.BLOCK_GLOW_ON,{id:A}):this.emit(L.BLOCK_GLOW_OFF,{id:A})}glowScript(A,B){B?this.emit(L.SCRIPT_GLOW_ON,{id:A}):this.emit(L.SCRIPT_GLOW_OFF,{id:A})}emitBlockDragUpdate(A){this.emit(L.BLOCK_DRAG_UPDATE,A)}emitBlockEndDrag(A,B){this.emit(L.BLOCK_DRAG_END,A,B)}visualReport(A,B){this.emit(L.VISUAL_REPORT,{id:A,value:String(B)})}requestAddMonitor(A){const B=A.get("id");this.requestUpdateMonitor(A)||(this._monitorState=this._monitorState.set(B,A))}requestUpdateMonitor(A){const B=A.get("id");return!!this._monitorState.has(B)&&(this._monitorState=this._monitorState.set(B,this._monitorState.get(B).mergeWith((A,B)=>null==B?A:B,A)),!0)}requestRemoveMonitor(A){this._monitorState=this._monitorState.delete(A)}requestHideMonitor(A){return this.requestUpdateMonitor(new Map([["id",A],["visible",!1]]))}requestShowMonitor(A){return this.requestUpdateMonitor(new Map([["id",A],["visible",!0]]))}requestRemoveMonitorByTargetId(A){this._monitorState=this._monitorState.filterNot(B=>B.targetId===A)}getTargetById(A){for(let B=0;BA.id===B);if(!e)return;const g=e.blocks.find(A=>A.info.opcode===t);return g?{category:"extension",label:"".concat(e.name,": ").concat(g.info.text)}:void 0}createNewGlobalVariable(A,B,t){const e="string"==typeof t?t:F.SCALAR_TYPE,g=this.getAllVarNamesOfType(e),i=R.unusedName(A,g),Q=new F(B||p(),i,e);return this.getTargetForStage().variables[Q.id]=Q,Q}requestRedraw(){this.redrawRequested=!0}requestTargetsUpdate(A){A.isOriginal&&(this._refreshTargets=!0)}requestBlocksUpdate(){this.emit(L.BLOCKS_NEED_UPDATE)}requestToolboxExtensionsUpdate(){this.emit(L.TOOLBOX_EXTENSIONS_NEED_UPDATE)}start(){this.frameLoop.running||(this.frameLoop.start(),this.emit(L.RUNTIME_STARTED))}stop(){this.frameLoop.running&&(this.frameLoop.stop(),this.emit(L.RUNTIME_STOPPED))}enableProfiling(A){c.available()&&(this.profiler=new c(A))}disableProfiling(){this.profiler=null}updateCurrentMSecs(){this.currentMSecs=Date.now()}}A.exports=L},function(A,B){A.exports={IntermediateScript:class{constructor(){this.topBlockId=null,this.stack=null,this.isProcedure=!1,this.procedureCode="",this.arguments=[],this.isWarp=!1,this.yields=!0,this.warpTimer=!1,this.dependedProcedures=[],this.cachedCompileResult=null}},IntermediateRepresentation:class{constructor(){this.entry=null,this.procedures={}}}}},function(A,B,t){const e={Timer:t(15),Cast:t(1),log:t(0),compatibilityLayerBlockUtility:t(207),thread:null};let g="";const i={};g+="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};",i.startHats="const startHats = (requestedHat, optMatchFields) => {\n const thread = globalState.thread;\n const threads = thread.target.runtime.startHats(requestedHat, optMatchFields);\n return threads;\n}",i.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}",i.executeInCompatibilityLayer="let hasResumedFromPromise = false;\nconst waitPromise = function*(promise) {\n const thread = globalState.thread;\n let returnValue;\n\n promise\n .then(value => {\n returnValue = value;\n thread.status = 0; // STATUS_RUNNING\n })\n .catch(error => {\n thread.status = 0; // STATUS_RUNNING\n globalState.log.warn('Promise rejected in compiled script:', error);\n });\n\n // enter STATUS_PROMISE_WAIT and yield\n // this will stop script execution until the promise handlers reset the thread status\n thread.status = 1; // STATUS_PROMISE_WAIT\n yield;\n\n return returnValue;\n};\nconst executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags) {\n const thread = globalState.thread;\n\n // reset the stackframe\n // we only ever use one stackframe at a time, so this shouldn't cause issues\n thread.stackFrames[thread.stackFrames.length - 1].reuse(isWarp);\n\n const executeBlock = () => {\n const compatibilityLayerBlockUtility = globalState.compatibilityLayerBlockUtility;\n compatibilityLayerBlockUtility.thread = thread;\n compatibilityLayerBlockUtility.sequencer = thread.target.runtime.sequencer;\n return blockFunction(inputs, compatibilityLayerBlockUtility);\n };\n\n const isPromise = value => (\n // see engine/execute.js\n value !== null &&\n typeof value === 'object' &&\n typeof value.then === 'function'\n );\n\n let returnValue = executeBlock();\n\n if (isPromise(returnValue)) {\n returnValue = yield* waitPromise(returnValue);\n if (useFlags) {\n hasResumedFromPromise = true;\n }\n return returnValue;\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\n if (isPromise(returnValue)) {\n returnValue = yield* waitPromise(returnValue);\n if (useFlags) {\n hasResumedFromPromise = true;\n }\n return returnValue;\n }\n }\n\n // todo: do we have to do anything extra if status is STATUS_DONE?\n\n return returnValue;\n}",i.callAddonBlock="const callAddonBlock = function*(procedureCode, blockId, args) {\n const thread = globalState.thread;\n const addonBlock = thread.target.runtime.getAddonBlock(procedureCode);\n if (addonBlock) {\n const target = thread.target;\n addonBlock.callback(args, {\n // Shim enough of BlockUtility to make addons work\n peekStack () {\n return blockId;\n },\n target\n });\n if (thread.status === 1 /* STATUS_PROMISE_WAIT */) {\n yield;\n }\n }\n}",i.retire="const retire = () => {\n const thread = globalState.thread;\n thread.target.runtime.sequencer.retireThread(thread);\n}",i.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}",i.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}",g+="const isWhiteSpace = val => typeof val === 'string' && val.trim().length === 0;",g+="const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isWhiteSpace(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isWhiteSpace(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);",i.compareGreaterThan="const compareGreaterThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isWhiteSpace(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isWhiteSpace(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || 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' && !isNaN(v1) ? v1 > v2 : compareGreaterThanSlow(v1, v2)",i.compareLessThan="const compareLessThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isWhiteSpace(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isWhiteSpace(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || 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' && !isNaN(v2) ? v1 < v2 : compareLessThanSlow(v1, v2)",i.randomInt="const randomInt = (low, high) => low + Math.floor(Math.random() * ((high + 1) - low))",i.randomFloat="const randomFloat = (low, high) => (Math.random() * (high - low)) + low",i.timer="const timer = () => {\n const t = new globalState.Timer({\n now: () => globalState.thread.target.runtime.currentMSecs\n });\n t.start();\n return t;\n}",i.daysSince2000="const daysSince2000 = () => (Date.now() - 946684800000) / (24 * 60 * 60 * 1000)",i.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}",g+="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};",i.listGet="const listGet = (list, idx) => {\n const index = listIndex(idx, list.length);\n if (index === -1) {\n return '';\n }\n return list[index];\n}",i.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}",i.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}",i.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}",i.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}",i.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}",i.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}",i.colorToList="const colorToList = color => globalState.Cast.toRgbColorList(color)",i.mod="const mod = (n, modulus) => {\n let result = n % modulus;\n if (result / modulus < 0) result += modulus;\n return result;\n}";const Q=A=>{e.thread=A,A.generator.next()};Q.scopedEval=A=>{const B=(A=>{let B="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 isWhiteSpace = val => typeof val === 'string' && val.trim().length === 0;const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isWhiteSpace(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isWhiteSpace(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !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 t of Object.keys(i))A.includes(t)&&(B+="".concat(i[t],";"));return B+="return ".concat(A),B})(A);try{return new Function("globalState",B)(e)}catch(A){throw e.log.error("was unable to compile script",B),A}},Q.runtimeFunctions=i,A.exports=Q},function(A,B,t){const e=t(29),g=t(15);A.exports=class{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.sequencer=A,this.thread=B,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 A=this.thread.peekStackFrame();return null===A.executionContext&&(A.executionContext={}),A.executionContext}stackTimerFinished(){return!(this.stackFrame.timer.timeElapsed(){t.status===Q.STATUS_RUNNING&&(t.status=Q.STATUS_PROMISE_WAIT),A.then(A=>{if(c(A,B,t,e,g),g){let A,B;do{const e=t.popStack();if(null===e)return;if(B=t.target.blocks.getNextBlock(e),null!==B)break;A=t.peekStackFrame()}while(null!==A&&!A.isLoop);t.pushStack(B)}},A=>{i.warn("Primitive rejected promise: ",A),t.status=Q.STATUS_RUNNING,t.popStack()})};class w{constructor(A,B){this.id=B.id,this.opcode=B.opcode,this.fields=B.fields,this.inputs=B.inputs,this.mutation=B.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:t}=r.sequencer,{opcode:e,fields:i,inputs:Q}=this;this._isHat=t.getIsHat(e),this._blockFunction=t.getOpcodeFunction(e),this._definedBlockFunction=void 0!==this._blockFunction;const s=Object.keys(i);this._isShadowBlock=!this._definedBlockFunction&&1===s.length&&0===Object.keys(Q).length,this._shadowValue=this._isShadowBlock&&i[s[0]].value;for(const A in i)this._argValues[A]="VARIABLE"===A||"LIST"===A||"BROADCAST_OPTION"===A?{id:i[A].id,name:i[A].value}:i[A].value;if(delete this._inputs.custom_block,"BROADCAST_INPUT"in this._inputs){this._argValues.BROADCAST_OPTION={id:null,name:null};const B=this._inputs.BROADCAST_INPUT;if(B.block===B.shadow){const t=A.getBlock(B.shadow).fields.BROADCAST_OPTION;this._argValues.BROADCAST_OPTION.id=t.id,this._argValues.BROADCAST_OPTION.name=t.value,delete this._inputs.BROADCAST_INPUT}}for(const B in this._inputs){const t=this._inputs[B];if(t.block){const e=g.getCached(A,t.block,w);if(e._isHat)continue;this._ops.push(...e._ops),e._parentKey=B,e._parentValues=this._argValues,e._isShadowBlock&&(this._argValues[B]=e._shadowValue)}}this._definedBlockFunction&&this._ops.push(this)}}A.exports=function(A,B){const t=A.runtime;r.sequencer=A,r.thread=B;const e=B.peekStack(),i=B.peekStackFrame();let s=B.blockContainer,C=g.getCached(s,e,w);if(null===C&&(s=t.flyoutBlocks,C=g.getCached(s,e,w),null===C))return void A.retireThread(B);const a=C._ops,I=a.length;let Y=0;if(null!==i.reported){const A=i.reported;for(;YA.id===B);if(e){const A=e._parentKey,B=e._parentValues;"BROADCAST_INPUT"===A?(B.BROADCAST_OPTION.id=null,B.BROADCAST_OPTION.name=n.toString(t)):B[A]=t}}if(A.length>0){const B=A.reverse().find(A=>a.find(B=>B.id===A.opCached));Y=B?a.findIndex(A=>A.id===B.opCached)+1:0}if(null!==B.justReported&&a[Y]&&a[Y].id===i.reporting){const A=a[Y],t=B.justReported;B.justReported=null;const e=A._parentKey,g=A._parentValues;"BROADCAST_INPUT"===e?(g.BROADCAST_OPTION.id=null,g.BROADCAST_OPTION.name=n.toString(t)):g[e]=t,Y+=1}i.reporting=null,i.reported=null}const h=Y;for(;Y{const B=A._parentKey,t=A._parentValues;return"BROADCAST_INPUT"===B?{opCached:A.id,inputValue:t[B].BROADCAST_OPTION.name}:{opCached:A.id,inputValue:t[B]}});break}if(B.status===Q.STATUS_RUNNING)if(t)c(w,A,B,e,t);else{const A=e._parentKey,B=e._parentValues;"BROADCAST_INPUT"===A?(B.BROADCAST_OPTION.id=null,B.BROADCAST_OPTION.name=n.toString(w)):B[A]=w}}var M;if(null!==t.profiler){C._profiler!==t.profiler&&function(A,B){B._profiler=A,-1===E&&(E=A.idByName("blockFunction"));const t=B._ops;for(let B=0;B=this.source.length&&this.error("Unexpected end of input"),this.source[A]}next(){this.index++}expect(A){this.char()!==A&&this.error("Expected '".concat(A,"' but found '").concat(this.char(),"'")),this.next()}peek(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.index+B+A>this.source.length)return"";if(1===A)return this.charAt(this.index+B);let t="";for(let e=0;e{if("string"==typeof A)return JSON.stringify(A);if("number"==typeof A)return Number.isNaN(A)?"0":A.toString();if("boolean"==typeof A)return A.toString();if(null===A)return"null";if(Array.isArray(A))return"[".concat(A.map(A=>e(A)).join(","),"]");if("object"==typeof A){let B="{";const t=Object.keys(A);for(let g=0;gnew t(A).parse(),stringify:e}},function(A,B,t){const e=t(14);class g{constructor(A){this.runtime=A,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(A){this.provider=A}enableVideo(){return this.provider?this.provider.enableVideo().then(()=>this._setupPreview()):null}disableVideo(){if(this._disablePreview(),!this.provider)return null;this.provider.disableVideo()}getFrame(A){let{dimensions:B=g.DIMENSIONS,mirror:t=this.mirror,format:e=g.FORMAT_IMAGE_DATA,cacheTimeout:i=this._frameCacheTimeout}=A;return this.provider?this.provider.getFrame({dimensions:B,mirror:t,format:e,cacheTimeout:i}):null}setPreviewGhost(A){this._ghost=A,-1!==this._drawable&&this.runtime.renderer.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:A)}_disablePreview(){-1!==this._skinId&&(this.runtime.renderer.updateBitmapSkin(this._skinId,new ImageData(...g.DIMENSIONS),1),this.runtime.renderer.updateDrawableVisible(this._drawable,!1)),this._renderPreviewFrame=null}_setupPreview(){const{renderer:A}=this.runtime;A&&(-1===this._skinId&&-1===this._drawable&&(this._skinId=A.createBitmapSkin(new ImageData(...g.DIMENSIONS),1),this._drawable=A.createDrawable(e.VIDEO_LAYER),A.updateDrawableSkinId(this._drawable,this._skinId)),this._renderPreviewFrame||(A.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:this._ghost),A.updateDrawableVisible(this._drawable,!0),this._renderPreviewFrame=()=>{if(clearTimeout(this._renderPreviewTimeout),!this._renderPreviewFrame)return;this._renderPreviewTimeout=setTimeout(this._renderPreviewFrame,this.runtime.currentStepTime);const B=this.getFrame({format:g.FORMAT_IMAGE_DATA,cacheTimeout:this.runtime.currentStepTime});B?(A.updateBitmapSkin(this._skinId,B,1),this.runtime.requestRedraw()):A.updateBitmapSkin(this._skinId,new ImageData(...g.DIMENSIONS),1)},this._renderPreviewFrame()))}get videoReady(){return!!this.provider&&this.provider.videoReady}postData(A){let{forceTransparentPreview:B}=A;this._forceTransparentPreview=B,this.setPreviewGhost(this._ghost)}}A.exports=g},function(A,B,t){"use strict";var e=window.URL||window.webkitURL;A.exports=function(A,B){try{try{var t;try{(t=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(A),t=t.getBlob()}catch(B){t=new Blob([A])}return new Worker(e.createObjectURL(t))}catch(B){return new Worker("data:application/javascript,"+encodeURIComponent(A))}}catch(A){if(!B)throw Error("Inline worker is not supported");return new Worker(B)}}},function(A,B,t){const e=t(6);A.exports=A=>{const B={};for(let t=0;t{const t=[],e=A=>{A.localName!==B&&void 0!==B||!A.getAttribute||t.push(A);for(let B=0;B{const B=document.createElement("span"),t=A.outerHTML,g=e.sanitize(t,{USE_PROFILES:{svg:!0},FORBID_TAGS:["a","audio","canvas","video"],ADD_DATA_URI_TAGS:["image"]});let i,Q;try{B.innerHTML=g,document.body.appendChild(B),i=B.children[0].getBBox()}finally{document.body.removeChild(B)}Q=0===i.width||0===i.height?0:(A=>{let B=0;const t=A=>{A.getAttribute&&(A.getAttribute("stroke")&&(B=Math.max(B,1)),A.getAttribute("stroke-width")&&(B=Math.max(B,Number(A.getAttribute("stroke-width"))||0)));for(let B=0;B{B&&(A=>{const B=n(A,"linearGradient");for(const A of B)A.getAttribute("x2")||A.setAttribute("x2","0")})(A),s(A,window),(A=>{const B=n(A,"image"),t="image-rendering: optimizespeed; image-rendering: pixelated;";for(const A of B)A.getAttribute("style")?A.setAttribute("style","".concat(t," ").concat(A.getAttribute("style"))):A.setAttribute("style",t)})(A),B?((A=>{const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B{const B=n(A);for(const A of B){if(!A.style)continue;const B=A.style.stroke||A.getAttribute("stroke");B&&B.match(/^url\(#.*\)$/)&&(A.style["stroke-linejoin"]="round",A.style["stroke-linecap"]="round")}})(A)):A.getAttribute("viewBox")?A.getAttribute("width")&&A.getAttribute("height")||(A.setAttribute("width",A.viewBox.baseVal.width),A.setAttribute("height",A.viewBox.baseVal.height)):r(A)};A.exports=(A,B)=>{const t=new DOMParser;A=Q(A);const e=t.parseFromString(A,"text/xml");if(e.childNodes.length<1||"svg"!==e.documentElement.localName)throw new Error("Document does not appear to be SVG.");const g=e.documentElement;return E(g,B),g}},function(A,B,t){ + */!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__(262),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(A){return"[object Array]"===Object.prototype.toString.call(A)}),!ARRAY_BUFFER||!root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(A){return"object"==typeof A&&A.buffer&&A.buffer.constructor===ArrayBuffer});var createOutputMethod=function(A){return function(B){return new Md5(!0).update(B)[A]()}},createMethod=function(){var A=createOutputMethod("hex");NODE_JS&&(A=nodeWrap(A)),A.create=function(){return new Md5},A.update=function(B){return A.create().update(B)};for(var B=0;B>2]|=A[i]<>6,n[g++]=128|63&e):e<55296||e>=57344?(n[g++]=224|e>>12,n[g++]=128|e>>6&63,n[g++]=128|63&e):(e=65536+((1023&e)<<10|1023&A.charCodeAt(++i)),n[g++]=240|e>>18,n[g++]=128|e>>12&63,n[g++]=128|e>>6&63,n[g++]=128|63&e);else for(g=this.start;i>2]|=e<>2]|=(192|e>>6)<>2]|=(128|63&e)<=57344?(s[g>>2]|=(224|e>>12)<>2]|=(128|e>>6&63)<>2]|=(128|63&e)<>2]|=(240|e>>18)<>2]|=(128|e>>12&63)<>2]|=(128|e>>6&63)<>2]|=(128|63&e)<=64?(this.start=g-64,this.hash(),this.hashed=!0):this.start=g}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 A=this.blocks,B=this.lastByteIndex;A[B>>2]|=EXTRA[3&B],B>=56&&(this.hashed||this.hash(),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),A[14]=this.bytes<<3,A[15]=this.hBytes<<3|this.bytes>>>29,this.hash()}},Md5.prototype.hash=function(){var A,B,t,e,g,i,Q=this.blocks;this.first?B=((B=((A=((A=Q[0]-680876937)<<7|A>>>25)-271733879<<0)^(t=((t=(-271733879^(e=((e=(-1732584194^2004318071&A)+Q[1]-117830708)<<12|e>>>20)+A<<0)&(-271733879^A))+Q[2]-1126478375)<<17|t>>>15)+e<<0)&(e^A))+Q[3]-1316259209)<<22|B>>>10)+t<<0:(A=this.h0,B=this.h1,t=this.h2,B=((B+=((A=((A+=((e=this.h3)^B&(t^e))+Q[0]-680876936)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[1]-389564586)<<12|e>>>20)+A<<0)&(A^B))+Q[2]+606105819)<<17|t>>>15)+e<<0)&(e^A))+Q[3]-1044525330)<<22|B>>>10)+t<<0),B=((B+=((A=((A+=(e^B&(t^e))+Q[4]-176418897)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[5]+1200080426)<<12|e>>>20)+A<<0)&(A^B))+Q[6]-1473231341)<<17|t>>>15)+e<<0)&(e^A))+Q[7]-45705983)<<22|B>>>10)+t<<0,B=((B+=((A=((A+=(e^B&(t^e))+Q[8]+1770035416)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[9]-1958414417)<<12|e>>>20)+A<<0)&(A^B))+Q[10]-42063)<<17|t>>>15)+e<<0)&(e^A))+Q[11]-1990404162)<<22|B>>>10)+t<<0,B=((B+=((A=((A+=(e^B&(t^e))+Q[12]+1804603682)<<7|A>>>25)+B<<0)^(t=((t+=(B^(e=((e+=(t^A&(B^t))+Q[13]-40341101)<<12|e>>>20)+A<<0)&(A^B))+Q[14]-1502002290)<<17|t>>>15)+e<<0)&(e^A))+Q[15]+1236535329)<<22|B>>>10)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[1]-165796510)<<5|A>>>27)+B<<0)^B))+Q[6]-1069501632)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[11]+643717713)<<14|t>>>18)+e<<0)^e))+Q[0]-373897302)<<20|B>>>12)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[5]-701558691)<<5|A>>>27)+B<<0)^B))+Q[10]+38016083)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[15]-660478335)<<14|t>>>18)+e<<0)^e))+Q[4]-405537848)<<20|B>>>12)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[9]+568446438)<<5|A>>>27)+B<<0)^B))+Q[14]-1019803690)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[3]-187363961)<<14|t>>>18)+e<<0)^e))+Q[8]+1163531501)<<20|B>>>12)+t<<0,B=((B+=((e=((e+=(B^t&((A=((A+=(t^e&(B^t))+Q[13]-1444681467)<<5|A>>>27)+B<<0)^B))+Q[2]-51403784)<<9|e>>>23)+A<<0)^A&((t=((t+=(A^B&(e^A))+Q[7]+1735328473)<<14|t>>>18)+e<<0)^e))+Q[12]-1926607734)<<20|B>>>12)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[5]-378558)<<4|A>>>28)+B<<0))+Q[8]-2022574463)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[11]+1839030562)<<16|t>>>16)+e<<0))+Q[14]-35309556)<<23|B>>>9)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[1]-1530992060)<<4|A>>>28)+B<<0))+Q[4]+1272893353)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[7]-155497632)<<16|t>>>16)+e<<0))+Q[10]-1094730640)<<23|B>>>9)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[13]+681279174)<<4|A>>>28)+B<<0))+Q[0]-358537222)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[3]-722521979)<<16|t>>>16)+e<<0))+Q[6]+76029189)<<23|B>>>9)+t<<0,B=((B+=((i=(e=((e+=((g=B^t)^(A=((A+=(g^e)+Q[9]-640364487)<<4|A>>>28)+B<<0))+Q[12]-421815835)<<11|e>>>21)+A<<0)^A)^(t=((t+=(i^B)+Q[15]+530742520)<<16|t>>>16)+e<<0))+Q[2]-995338651)<<23|B>>>9)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[0]-198630844)<<6|A>>>26)+B<<0)|~t))+Q[7]+1126891415)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[14]-1416354905)<<15|t>>>17)+e<<0)|~A))+Q[5]-57434055)<<21|B>>>11)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[12]+1700485571)<<6|A>>>26)+B<<0)|~t))+Q[3]-1894986606)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[10]-1051523)<<15|t>>>17)+e<<0)|~A))+Q[1]-2054922799)<<21|B>>>11)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[8]+1873313359)<<6|A>>>26)+B<<0)|~t))+Q[15]-30611744)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[6]-1560198380)<<15|t>>>17)+e<<0)|~A))+Q[13]+1309151649)<<21|B>>>11)+t<<0,B=((B+=((e=((e+=(B^((A=((A+=(t^(B|~e))+Q[4]-145523070)<<6|A>>>26)+B<<0)|~t))+Q[11]-1120210379)<<10|e>>>22)+A<<0)^((t=((t+=(A^(e|~B))+Q[2]+718787259)<<15|t>>>17)+e<<0)|~A))+Q[9]-343485551)<<21|B>>>11)+t<<0,this.first?(this.h0=A+1732584193<<0,this.h1=B-271733879<<0,this.h2=t-1732584194<<0,this.h3=e+271733878<<0,this.first=!1):(this.h0=this.h0+A<<0,this.h1=this.h1+B<<0,this.h2=this.h2+t<<0,this.h3=this.h3+e<<0)},Md5.prototype.hex=function(){this.finalize();var A=this.h0,B=this.h1,t=this.h2,e=this.h3;return HEX_CHARS[A>>4&15]+HEX_CHARS[15&A]+HEX_CHARS[A>>12&15]+HEX_CHARS[A>>8&15]+HEX_CHARS[A>>20&15]+HEX_CHARS[A>>16&15]+HEX_CHARS[A>>28&15]+HEX_CHARS[A>>24&15]+HEX_CHARS[B>>4&15]+HEX_CHARS[15&B]+HEX_CHARS[B>>12&15]+HEX_CHARS[B>>8&15]+HEX_CHARS[B>>20&15]+HEX_CHARS[B>>16&15]+HEX_CHARS[B>>28&15]+HEX_CHARS[B>>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[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]},Md5.prototype.toString=Md5.prototype.hex,Md5.prototype.digest=function(){this.finalize();var A=this.h0,B=this.h1,t=this.h2,e=this.h3;return[255&A,A>>8&255,A>>16&255,A>>24&255,255&B,B>>8&255,B>>16&255,B>>24&255,255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255]},Md5.prototype.array=Md5.prototype.digest,Md5.prototype.arrayBuffer=function(){this.finalize();var A=new ArrayBuffer(16),B=new Uint32Array(A);return B[0]=this.h0,B[1]=this.h1,B[2]=this.h2,B[3]=this.h3,A},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var A,B,t,e="",g=this.array(),i=0;i<15;)A=g[i++],B=g[i++],t=g[i++],e+=BASE64_ENCODE_CHAR[A>>>2]+BASE64_ENCODE_CHAR[63&(A<<4|B>>>4)]+BASE64_ENCODE_CHAR[63&(B<<2|t>>>6)]+BASE64_ENCODE_CHAR[63&t];return A=g[i],e+=BASE64_ENCODE_CHAR[A>>>2]+BASE64_ENCODE_CHAR[A<<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__(37),__webpack_require__(10))},function(A,B,t){"use strict";var e,g="object"==typeof Reflect?Reflect:null,i=g&&"function"==typeof g.apply?g.apply:function(A,B,t){return Function.prototype.apply.call(A,B,t)};e=g&&"function"==typeof g.ownKeys?g.ownKeys:Object.getOwnPropertySymbols?function(A){return Object.getOwnPropertyNames(A).concat(Object.getOwnPropertySymbols(A))}:function(A){return Object.getOwnPropertyNames(A)};var Q=Number.isNaN||function(A){return A!=A};function s(){s.init.call(this)}A.exports=s,A.exports.once=function(A,B){return new Promise((function(t,e){function g(t){A.removeListener(B,i),e(t)}function i(){"function"==typeof A.removeListener&&A.removeListener("error",g),t([].slice.call(arguments))}Y(A,B,i,{once:!0}),"error"!==B&&function(A,B,t){"function"==typeof A.on&&Y(A,"error",B,t)}(A,g,{once:!0})}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var n=10;function r(A){if("function"!=typeof A)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof A)}function c(A){return void 0===A._maxListeners?s.defaultMaxListeners:A._maxListeners}function E(A,B,t,e){var g,i,Q,s;if(r(t),void 0===(i=A._events)?(i=A._events=Object.create(null),A._eventsCount=0):(void 0!==i.newListener&&(A.emit("newListener",B,t.listener?t.listener:t),i=A._events),Q=i[B]),void 0===Q)Q=i[B]=t,++A._eventsCount;else if("function"==typeof Q?Q=i[B]=e?[t,Q]:[Q,t]:e?Q.unshift(t):Q.push(t),(g=c(A))>0&&Q.length>g&&!Q.warned){Q.warned=!0;var n=new Error("Possible EventEmitter memory leak detected. "+Q.length+" "+String(B)+" listeners added. Use emitter.setMaxListeners() to increase limit");n.name="MaxListenersExceededWarning",n.emitter=A,n.type=B,n.count=Q.length,s=n,console&&console.warn&&console.warn(s)}return A}function o(){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 w(A,B,t){var e={fired:!1,wrapFn:void 0,target:A,type:B,listener:t},g=o.bind(e);return g.listener=t,e.wrapFn=g,g}function C(A,B,t){var e=A._events;if(void 0===e)return[];var g=e[B];return void 0===g?[]:"function"==typeof g?t?[g.listener||g]:[g]:t?function(A){for(var B=new Array(A.length),t=0;t0&&(Q=B[0]),Q instanceof Error)throw Q;var s=new Error("Unhandled error."+(Q?" ("+Q.message+")":""));throw s.context=Q,s}var n=g[A];if(void 0===n)return!1;if("function"==typeof n)i(n,this,B);else{var r=n.length,c=I(n,r);for(t=0;t=0;i--)if(t[i]===B||t[i].listener===B){Q=t[i].listener,g=i;break}if(g<0)return this;0===g?t.shift():function(A,B){for(;B+1=0;e--)this.removeListener(A,B[e]);return this},s.prototype.listeners=function(A){return C(this,A,!0)},s.prototype.rawListeners=function(A){return C(this,A,!1)},s.listenerCount=function(A,B){return"function"==typeof A.listenerCount?A.listenerCount(B):a.call(A,B)},s.prototype.listenerCount=a,s.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]}},function(A,B,t){(function(B,t,e,g){A.exports=function A(B,t,e){function g(Q,s){if(!t[Q]){if(!B[Q]){if(i)return i(Q,!0);var n=new Error("Cannot find module '"+Q+"'");throw n.code="MODULE_NOT_FOUND",n}var r=t[Q]={exports:{}};B[Q][0].call(r.exports,(function(A){return g(B[Q][1][A]||A)}),r,r.exports,A,B,t,e)}return t[Q].exports}for(var i=!1,Q=0;Q>2,s=(3&B)<<4|t>>4,n=1>6:64,r=2>4,t=(15&Q)<<4|(s=i.indexOf(A.charAt(r++)))>>2,e=(3&s)<<6|(n=i.indexOf(A.charAt(r++))),o[c++]=B,64!==s&&(o[c++]=t),64!==n&&(o[c++]=e);return o}},{"./support":30,"./utils":32}],2:[function(A,B,t){"use strict";var e=A("./external"),g=A("./stream/DataWorker"),i=A("./stream/Crc32Probe"),Q=A("./stream/DataLengthProbe");function s(A,B,t,e,g){this.compressedSize=A,this.uncompressedSize=B,this.crc32=t,this.compression=e,this.compressedContent=g}s.prototype={getContentWorker:function(){var A=new g(e.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new Q("data_length")),B=this;return A.on("end",(function(){if(this.streamInfo.data_length!==B.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),A},getCompressedWorker:function(){return new g(e.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},s.createWorkerFrom=function(A,B,t){return A.pipe(new i).pipe(new Q("uncompressedSize")).pipe(B.compressWorker(t)).pipe(new Q("compressedSize")).withStreamInfo("compression",B)},B.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(A,B,t){"use strict";var e=A("./stream/GenericWorker");t.STORE={magic:"\0\0",compressWorker:function(A){return new e("STORE compression")},uncompressWorker:function(){return new e("STORE decompression")}},t.DEFLATE=A("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(A,B,t){"use strict";var e=A("./utils"),g=function(){for(var A,B=[],t=0;t<256;t++){A=t;for(var e=0;e<8;e++)A=1&A?3988292384^A>>>1:A>>>1;B[t]=A}return B}();B.exports=function(A,B){return void 0!==A&&A.length?"string"!==e.getTypeOf(A)?function(A,B,t,e){var i=g,Q=0+t;A^=-1;for(var s=0;s>>8^i[255&(A^B[s])];return-1^A}(0|B,A,A.length):function(A,B,t,e){var i=g,Q=0+t;A^=-1;for(var s=0;s>>8^i[255&(A^B.charCodeAt(s))];return-1^A}(0|B,A,A.length):0}},{"./utils":32}],5:[function(A,B,t){"use strict";t.base64=!1,t.binary=!1,t.dir=!1,t.createFolders=!0,t.date=null,t.compression=null,t.compressionOptions=null,t.comment=null,t.unixPermissions=null,t.dosPermissions=null},{}],6:[function(A,B,t){"use strict";var e;e="undefined"!=typeof Promise?Promise:A("lie"),B.exports={Promise:e}},{lie:37}],7:[function(A,B,t){"use strict";var e="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,g=A("pako"),i=A("./utils"),Q=A("./stream/GenericWorker"),s=e?"uint8array":"array";function n(A,B){Q.call(this,"FlateWorker/"+A),this._pako=null,this._pakoAction=A,this._pakoOptions=B,this.meta={}}t.magic="\b\0",i.inherits(n,Q),n.prototype.processChunk=function(A){this.meta=A.meta,null===this._pako&&this._createPako(),this._pako.push(i.transformTo(s,A.data),!1)},n.prototype.flush=function(){Q.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},n.prototype.cleanUp=function(){Q.prototype.cleanUp.call(this),this._pako=null},n.prototype._createPako=function(){this._pako=new g[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var A=this;this._pako.onData=function(B){A.push({data:B,meta:A.meta})}},t.compressWorker=function(A){return new n("Deflate",A)},t.uncompressWorker=function(){return new n("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(A,B,t){"use strict";function e(A,B){var t,e="";for(t=0;t>>=8;return e}function g(A,B,t,g,Q,c){var E,o,w=A.file,C=A.compression,a=c!==s.utf8encode,I=i.transformTo("string",c(w.name)),Y=i.transformTo("string",s.utf8encode(w.name)),h=w.comment,M=i.transformTo("string",c(h)),F=i.transformTo("string",s.utf8encode(h)),D=Y.length!==w.name.length,u=F.length!==h.length,l="",d="",U="",N=w.dir,m=w.date,G={crc32:0,compressedSize:0,uncompressedSize:0};B&&!t||(G.crc32=A.crc32,G.compressedSize=A.compressedSize,G.uncompressedSize=A.uncompressedSize);var f=0;B&&(f|=8),a||!D&&!u||(f|=2048);var H=0,R=0;N&&(H|=16),"UNIX"===Q?(R=798,H|=function(A,B){var t=A;return A||(t=B?16893:33204),(65535&t)<<16}(w.unixPermissions,N)):(R=20,H|=function(A){return 63&(A||0)}(w.dosPermissions)),E=m.getUTCHours(),E<<=6,E|=m.getUTCMinutes(),E<<=5,E|=m.getUTCSeconds()/2,o=m.getUTCFullYear()-1980,o<<=4,o|=m.getUTCMonth()+1,o<<=5,o|=m.getUTCDate(),D&&(d=e(1,1)+e(n(I),4)+Y,l+="up"+e(d.length,2)+d),u&&(U=e(1,1)+e(n(M),4)+F,l+="uc"+e(U.length,2)+U);var p="";return p+="\n\0",p+=e(f,2),p+=C.magic,p+=e(E,2),p+=e(o,2),p+=e(G.crc32,4),p+=e(G.compressedSize,4),p+=e(G.uncompressedSize,4),p+=e(I.length,2),p+=e(l.length,2),{fileRecord:r.LOCAL_FILE_HEADER+p+I+l,dirRecord:r.CENTRAL_FILE_HEADER+e(R,2)+p+e(M.length,2)+"\0\0\0\0"+e(H,4)+e(g,4)+I+l+M}}var i=A("../utils"),Q=A("../stream/GenericWorker"),s=A("../utf8"),n=A("../crc32"),r=A("../signature");function c(A,B,t,e){Q.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=B,this.zipPlatform=t,this.encodeFileName=e,this.streamFiles=A,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(c,Q),c.prototype.push=function(A){var B=A.meta.percent||0,t=this.entriesCount,e=this._sources.length;this.accumulate?this.contentBuffer.push(A):(this.bytesWritten+=A.data.length,Q.prototype.push.call(this,{data:A.data,meta:{currentFile:this.currentFile,percent:t?(B+100*(t-e-1))/t:100}}))},c.prototype.openedSource=function(A){this.currentSourceOffset=this.bytesWritten,this.currentFile=A.file.name;var B=this.streamFiles&&!A.file.dir;if(B){var t=g(A,B,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:t.fileRecord,meta:{percent:0}})}else this.accumulate=!0},c.prototype.closedSource=function(A){this.accumulate=!1;var B=this.streamFiles&&!A.file.dir,t=g(A,B,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(t.dirRecord),B)this.push({data:function(A){return r.DATA_DESCRIPTOR+e(A.crc32,4)+e(A.compressedSize,4)+e(A.uncompressedSize,4)}(A),meta:{percent:100}});else for(this.push({data:t.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},c.prototype.flush=function(){for(var A=this.bytesWritten,B=0;B=this.index;B--)t=(t<<8)+this.byteAt(B);return this.index+=A,t},readString:function(A){return e.transformTo("string",this.readData(A))},readData:function(A){},lastIndexOfSignature:function(A){},readAndCheckSignature:function(A){},readDate:function(){var A=this.readInt(4);return new Date(Date.UTC(1980+(A>>25&127),(A>>21&15)-1,A>>16&31,A>>11&31,A>>5&63,(31&A)<<1))}},B.exports=g},{"../utils":32}],19:[function(A,B,t){"use strict";var e=A("./Uint8ArrayReader");function g(A){e.call(this,A)}A("../utils").inherits(g,e),g.prototype.readData=function(A){this.checkOffset(A);var B=this.data.slice(this.zero+this.index,this.zero+this.index+A);return this.index+=A,B},B.exports=g},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(A,B,t){"use strict";var e=A("./DataReader");function g(A){e.call(this,A)}A("../utils").inherits(g,e),g.prototype.byteAt=function(A){return this.data.charCodeAt(this.zero+A)},g.prototype.lastIndexOfSignature=function(A){return this.data.lastIndexOf(A)-this.zero},g.prototype.readAndCheckSignature=function(A){return A===this.readData(4)},g.prototype.readData=function(A){this.checkOffset(A);var B=this.data.slice(this.zero+this.index,this.zero+this.index+A);return this.index+=A,B},B.exports=g},{"../utils":32,"./DataReader":18}],21:[function(A,B,t){"use strict";var e=A("./ArrayReader");function g(A){e.call(this,A)}A("../utils").inherits(g,e),g.prototype.readData=function(A){if(this.checkOffset(A),0===A)return new Uint8Array(0);var B=this.data.subarray(this.zero+this.index,this.zero+this.index+A);return this.index+=A,B},B.exports=g},{"../utils":32,"./ArrayReader":17}],22:[function(A,B,t){"use strict";var e=A("../utils"),g=A("../support"),i=A("./ArrayReader"),Q=A("./StringReader"),s=A("./NodeBufferReader"),n=A("./Uint8ArrayReader");B.exports=function(A){var B=e.getTypeOf(A);return e.checkSupport(B),"string"!==B||g.uint8array?"nodebuffer"===B?new s(A):g.uint8array?new n(e.transformTo("uint8array",A)):new i(e.transformTo("array",A)):new Q(A)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(A,B,t){"use strict";t.LOCAL_FILE_HEADER="PK",t.CENTRAL_FILE_HEADER="PK",t.CENTRAL_DIRECTORY_END="PK",t.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",t.ZIP64_CENTRAL_DIRECTORY_END="PK",t.DATA_DESCRIPTOR="PK\b"},{}],24:[function(A,B,t){"use strict";var e=A("./GenericWorker"),g=A("../utils");function i(A){e.call(this,"ConvertWorker to "+A),this.destType=A}g.inherits(i,e),i.prototype.processChunk=function(A){this.push({data:g.transformTo(this.destType,A.data),meta:A.meta})},B.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(A,B,t){"use strict";var e=A("./GenericWorker"),g=A("../crc32");function i(){e.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}A("../utils").inherits(i,e),i.prototype.processChunk=function(A){this.streamInfo.crc32=g(A.data,this.streamInfo.crc32||0),this.push(A)},B.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(A,B,t){"use strict";var e=A("../utils"),g=A("./GenericWorker");function i(A){g.call(this,"DataLengthProbe for "+A),this.propName=A,this.withStreamInfo(A,0)}e.inherits(i,g),i.prototype.processChunk=function(A){if(A){var B=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=B+A.data.length}g.prototype.processChunk.call(this,A)},B.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(A,B,t){"use strict";var e=A("../utils"),g=A("./GenericWorker");function i(A){g.call(this,"DataWorker");var B=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,A.then((function(A){B.dataIsReady=!0,B.data=A,B.max=A&&A.length||0,B.type=e.getTypeOf(A),B.isPaused||B._tickAndRepeat()}),(function(A){B.error(A)}))}e.inherits(i,g),i.prototype.cleanUp=function(){g.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!g.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,e.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(e.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var A=null,B=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":A=this.data.substring(this.index,B);break;case"uint8array":A=this.data.subarray(this.index,B);break;case"array":case"nodebuffer":A=this.data.slice(this.index,B)}return this.index=B,this.push({data:A,meta:{percent:this.max?this.index/this.max*100:0}})},B.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(A,B,t){"use strict";function e(A){this.name=A||"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}e.prototype={push:function(A){this.emit("data",A)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(A){this.emit("error",A)}return!0},error:function(A){return!this.isFinished&&(this.isPaused?this.generatedError=A:(this.isFinished=!0,this.emit("error",A),this.previous&&this.previous.error(A),this.cleanUp()),!0)},on:function(A,B){return this._listeners[A].push(B),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(A,B){if(this._listeners[A])for(var t=0;t "+A:A}},B.exports=e},{}],29:[function(A,t,e){"use strict";var g=A("../utils"),i=A("./ConvertWorker"),Q=A("./GenericWorker"),s=A("../base64"),n=A("../support"),r=A("../external"),c=null;if(n.nodestream)try{c=A("../nodejs/NodejsStreamOutputAdapter")}catch(A){}function E(A,B,t){var e=B;switch(B){case"blob":case"arraybuffer":e="uint8array";break;case"base64":e="string"}try{this._internalType=e,this._outputType=B,this._mimeType=t,g.checkSupport(e),this._worker=A.pipe(new i(e)),A.lock()}catch(A){this._worker=new Q("error"),this._worker.error(A)}}E.prototype={accumulate:function(A){return function(A,t){return new r.Promise((function(e,i){var Q=[],n=A._internalType,r=A._outputType,c=A._mimeType;A.on("data",(function(A,B){Q.push(A),t&&t(B)})).on("error",(function(A){Q=[],i(A)})).on("end",(function(){try{var A=function(A,B,t){switch(A){case"blob":return g.newBlob(g.transformTo("arraybuffer",B),t);case"base64":return s.encode(B);default:return g.transformTo(A,B)}}(r,function(A,t){var e,g=0,i=null,Q=0;for(e=0;e>>6:(t<65536?B[Q++]=224|t>>>12:(B[Q++]=240|t>>>18,B[Q++]=128|t>>>12&63),B[Q++]=128|t>>>6&63),B[Q++]=128|63&t);return B}(A)},t.utf8decode=function(A){return g.nodebuffer?e.transformTo("nodebuffer",A).toString("utf-8"):function(A){var B,t,g,i,Q=A.length,n=new Array(2*Q);for(B=t=0;B>10&1023,n[t++]=56320|1023&g)}return n.length!==t&&(n.subarray?n=n.subarray(0,t):n.length=t),e.applyFromCharCode(n)}(A=e.transformTo(g.uint8array?"uint8array":"array",A))},e.inherits(r,Q),r.prototype.processChunk=function(A){var B=e.transformTo(g.uint8array?"uint8array":"array",A.data);if(this.leftOver&&this.leftOver.length){if(g.uint8array){var i=B;(B=new Uint8Array(i.length+this.leftOver.length)).set(this.leftOver,0),B.set(i,this.leftOver.length)}else B=this.leftOver.concat(B);this.leftOver=null}var Q=function(A,B){var t;for((B=B||A.length)>A.length&&(B=A.length),t=B-1;0<=t&&128==(192&A[t]);)t--;return t<0||0===t?B:t+s[A[t]]>B?t:B}(B),n=B;Q!==B.length&&(g.uint8array?(n=B.subarray(0,Q),this.leftOver=B.subarray(Q,B.length)):(n=B.slice(0,Q),this.leftOver=B.slice(Q,B.length))),this.push({data:t.utf8decode(n),meta:A.meta})},r.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:t.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},t.Utf8DecodeWorker=r,e.inherits(c,Q),c.prototype.processChunk=function(A){this.push({data:t.utf8encode(A.data),meta:A.meta})},t.Utf8EncodeWorker=c},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(A,B,e){"use strict";var g=A("./support"),i=A("./base64"),Q=A("./nodejsUtils"),s=A("./external");function n(A){return A}function r(A,B){for(var t=0;t>8;this.dir=!!(16&this.externalFileAttributes),0==A&&(this.dosPermissions=63&this.externalFileAttributes),3==A&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(A){if(this.extraFields[1]){var B=e(this.extraFields[1].value);this.uncompressedSize===g.MAX_VALUE_32BITS&&(this.uncompressedSize=B.readInt(8)),this.compressedSize===g.MAX_VALUE_32BITS&&(this.compressedSize=B.readInt(8)),this.localHeaderOffset===g.MAX_VALUE_32BITS&&(this.localHeaderOffset=B.readInt(8)),this.diskNumberStart===g.MAX_VALUE_32BITS&&(this.diskNumberStart=B.readInt(4))}},readExtraFields:function(A){var B,t,e,g=A.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});A.index+4>>6:(t<65536?B[Q++]=224|t>>>12:(B[Q++]=240|t>>>18,B[Q++]=128|t>>>12&63),B[Q++]=128|t>>>6&63),B[Q++]=128|63&t);return B},t.buf2binstring=function(A){return n(A,A.length)},t.binstring2buf=function(A){for(var B=new e.Buf8(A.length),t=0,g=B.length;t>10&1023,r[e++]=56320|1023&g)}return n(r,e)},t.utf8border=function(A,B){var t;for((B=B||A.length)>A.length&&(B=A.length),t=B-1;0<=t&&128==(192&A[t]);)t--;return t<0||0===t?B:t+Q[A[t]]>B?t:B}},{"./common":41}],43:[function(A,B,t){"use strict";B.exports=function(A,B,t,e){for(var g=65535&A|0,i=A>>>16&65535|0,Q=0;0!==t;){for(t-=Q=2e3>>1:A>>>1;B[t]=A}return B}();B.exports=function(A,B,t,g){var i=e,Q=g+t;A^=-1;for(var s=g;s>>8^i[255&(A^B[s])];return-1^A}},{}],46:[function(A,B,t){"use strict";var e,g=A("../utils/common"),i=A("./trees"),Q=A("./adler32"),s=A("./crc32"),n=A("./messages"),r=-2,c=258,E=262,o=113;function w(A,B){return A.msg=n[B],B}function C(A){return(A<<1)-(4A.avail_out&&(t=A.avail_out),0!==t&&(g.arraySet(A.output,B.pending_buf,B.pending_out,t,A.next_out),A.next_out+=t,B.pending_out+=t,A.total_out+=t,A.avail_out-=t,B.pending-=t,0===B.pending&&(B.pending_out=0))}function Y(A,B){i._tr_flush_block(A,0<=A.block_start?A.block_start:-1,A.strstart-A.block_start,B),A.block_start=A.strstart,I(A.strm)}function h(A,B){A.pending_buf[A.pending++]=B}function M(A,B){A.pending_buf[A.pending++]=B>>>8&255,A.pending_buf[A.pending++]=255&B}function F(A,B){var t,e,g=A.max_chain_length,i=A.strstart,Q=A.prev_length,s=A.nice_match,n=A.strstart>A.w_size-E?A.strstart-(A.w_size-E):0,r=A.window,o=A.w_mask,w=A.prev,C=A.strstart+c,a=r[i+Q-1],I=r[i+Q];A.prev_length>=A.good_match&&(g>>=2),s>A.lookahead&&(s=A.lookahead);do{if(r[(t=B)+Q]===I&&r[t+Q-1]===a&&r[t]===r[i]&&r[++t]===r[i+1]){i+=2,t++;do{}while(r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&r[++i]===r[++t]&&in&&0!=--g);return Q<=A.lookahead?Q:A.lookahead}function D(A){var B,t,e,i,n,r,c,o,w,C,a=A.w_size;do{if(i=A.window_size-A.lookahead-A.strstart,A.strstart>=a+(a-E)){for(g.arraySet(A.window,A.window,a,a,0),A.match_start-=a,A.strstart-=a,A.block_start-=a,B=t=A.hash_size;e=A.head[--B],A.head[B]=a<=e?e-a:0,--t;);for(B=t=a;e=A.prev[--B],A.prev[B]=a<=e?e-a:0,--t;);i+=a}if(0===A.strm.avail_in)break;if(r=A.strm,c=A.window,o=A.strstart+A.lookahead,C=void 0,(w=i)<(C=r.avail_in)&&(C=w),t=0===C?0:(r.avail_in-=C,g.arraySet(c,r.input,r.next_in,C,o),1===r.state.wrap?r.adler=Q(r.adler,c,C,o):2===r.state.wrap&&(r.adler=s(r.adler,c,C,o)),r.next_in+=C,r.total_in+=C,C),A.lookahead+=t,A.lookahead+A.insert>=3)for(n=A.strstart-A.insert,A.ins_h=A.window[n],A.ins_h=(A.ins_h<=3&&(A.ins_h=(A.ins_h<=3)if(e=i._tr_tally(A,A.strstart-A.match_start,A.match_length-3),A.lookahead-=A.match_length,A.match_length<=A.max_lazy_match&&A.lookahead>=3){for(A.match_length--;A.strstart++,A.ins_h=(A.ins_h<=3&&(A.ins_h=(A.ins_h<=3&&A.match_length<=A.prev_length){for(g=A.strstart+A.lookahead-3,e=i._tr_tally(A,A.strstart-1-A.prev_match,A.prev_length-3),A.lookahead-=A.prev_length-1,A.prev_length-=2;++A.strstart<=g&&(A.ins_h=(A.ins_h<A.pending_buf_size-5&&(t=A.pending_buf_size-5);;){if(A.lookahead<=1){if(D(A),0===A.lookahead&&0===B)return 1;if(0===A.lookahead)break}A.strstart+=A.lookahead,A.lookahead=0;var e=A.block_start+t;if((0===A.strstart||A.strstart>=e)&&(A.lookahead=A.strstart-e,A.strstart=e,Y(A,!1),0===A.strm.avail_out))return 1;if(A.strstart-A.block_start>=A.w_size-E&&(Y(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,4===B?(Y(A,!0),0===A.strm.avail_out?3:4):(A.strstart>A.block_start&&(Y(A,!1),A.strm.avail_out),1)})),new d(4,4,8,4,u),new d(4,5,16,8,u),new d(4,6,32,32,u),new d(4,4,16,16,l),new d(8,16,32,32,l),new d(8,16,128,128,l),new d(8,32,128,256,l),new d(32,128,258,1024,l),new d(32,258,258,4096,l)],t.deflateInit=function(A,B){return G(A,B,8,15,8,0)},t.deflateInit2=G,t.deflateReset=m,t.deflateResetKeep=N,t.deflateSetHeader=function(A,B){return A&&A.state?2!==A.state.wrap?r:(A.state.gzhead=B,0):r},t.deflate=function(A,B){var t,g,Q,n;if(!A||!A.state||5>8&255),h(g,g.gzhead.time>>16&255),h(g,g.gzhead.time>>24&255),h(g,9===g.level?2:2<=g.strategy||g.level<2?4:0),h(g,255&g.gzhead.os),g.gzhead.extra&&g.gzhead.extra.length&&(h(g,255&g.gzhead.extra.length),h(g,g.gzhead.extra.length>>8&255)),g.gzhead.hcrc&&(A.adler=s(A.adler,g.pending_buf,g.pending,0)),g.gzindex=0,g.status=69):(h(g,0),h(g,0),h(g,0),h(g,0),h(g,0),h(g,9===g.level?2:2<=g.strategy||g.level<2?4:0),h(g,3),g.status=o);else{var E=8+(g.w_bits-8<<4)<<8;E|=(2<=g.strategy||g.level<2?0:g.level<6?1:6===g.level?2:3)<<6,0!==g.strstart&&(E|=32),E+=31-E%31,g.status=o,M(g,E),0!==g.strstart&&(M(g,A.adler>>>16),M(g,65535&A.adler)),A.adler=1}if(69===g.status)if(g.gzhead.extra){for(Q=g.pending;g.gzindex<(65535&g.gzhead.extra.length)&&(g.pending!==g.pending_buf_size||(g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),I(A),Q=g.pending,g.pending!==g.pending_buf_size));)h(g,255&g.gzhead.extra[g.gzindex]),g.gzindex++;g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),g.gzindex===g.gzhead.extra.length&&(g.gzindex=0,g.status=73)}else g.status=73;if(73===g.status)if(g.gzhead.name){Q=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),I(A),Q=g.pending,g.pending===g.pending_buf_size)){n=1;break}n=g.gzindexQ&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),0===n&&(g.gzindex=0,g.status=91)}else g.status=91;if(91===g.status)if(g.gzhead.comment){Q=g.pending;do{if(g.pending===g.pending_buf_size&&(g.gzhead.hcrc&&g.pending>Q&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),I(A),Q=g.pending,g.pending===g.pending_buf_size)){n=1;break}n=g.gzindexQ&&(A.adler=s(A.adler,g.pending_buf,g.pending-Q,Q)),0===n&&(g.status=103)}else g.status=103;if(103===g.status&&(g.gzhead.hcrc?(g.pending+2>g.pending_buf_size&&I(A),g.pending+2<=g.pending_buf_size&&(h(g,255&A.adler),h(g,A.adler>>8&255),A.adler=0,g.status=o)):g.status=o),0!==g.pending){if(I(A),0===A.avail_out)return g.last_flush=-1,0}else if(0===A.avail_in&&C(B)<=C(t)&&4!==B)return w(A,-5);if(666===g.status&&0!==A.avail_in)return w(A,-5);if(0!==A.avail_in||0!==g.lookahead||0!==B&&666!==g.status){var F=2===g.strategy?function(A,B){for(var t;;){if(0===A.lookahead&&(D(A),0===A.lookahead)){if(0===B)return 1;break}if(A.match_length=0,t=i._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++,t&&(Y(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,4===B?(Y(A,!0),0===A.strm.avail_out?3:4):A.last_lit&&(Y(A,!1),0===A.strm.avail_out)?1:2}(g,B):3===g.strategy?function(A,B){for(var t,e,g,Q,s=A.window;;){if(A.lookahead<=c){if(D(A),A.lookahead<=c&&0===B)return 1;if(0===A.lookahead)break}if(A.match_length=0,A.lookahead>=3&&0A.lookahead&&(A.match_length=A.lookahead)}if(A.match_length>=3?(t=i._tr_tally(A,1,A.match_length-3),A.lookahead-=A.match_length,A.strstart+=A.match_length,A.match_length=0):(t=i._tr_tally(A,0,A.window[A.strstart]),A.lookahead--,A.strstart++),t&&(Y(A,!1),0===A.strm.avail_out))return 1}return A.insert=0,4===B?(Y(A,!0),0===A.strm.avail_out?3:4):A.last_lit&&(Y(A,!1),0===A.strm.avail_out)?1:2}(g,B):e[g.level].func(g,B);if(3!==F&&4!==F||(g.status=666),1===F||3===F)return 0===A.avail_out&&(g.last_flush=-1),0;if(2===F&&(1===B?i._tr_align(g):5!==B&&(i._tr_stored_block(g,0,0,!1),3===B&&(a(g.head),0===g.lookahead&&(g.strstart=0,g.block_start=0,g.insert=0))),I(A),0===A.avail_out))return g.last_flush=-1,0}return 4!==B?0:g.wrap<=0?1:(2===g.wrap?(h(g,255&A.adler),h(g,A.adler>>8&255),h(g,A.adler>>16&255),h(g,A.adler>>24&255),h(g,255&A.total_in),h(g,A.total_in>>8&255),h(g,A.total_in>>16&255),h(g,A.total_in>>24&255)):(M(g,A.adler>>>16),M(g,65535&A.adler)),I(A),0=t.w_size&&(0===s&&(a(t.head),t.strstart=0,t.block_start=0,t.insert=0),o=new g.Buf8(t.w_size),g.arraySet(o,B,w-t.w_size,t.w_size,0),B=o,w=t.w_size),n=A.avail_in,c=A.next_in,E=A.input,A.avail_in=w,A.next_in=0,A.input=B,D(t);t.lookahead>=3;){for(e=t.strstart,i=t.lookahead-2;t.ins_h=(t.ins_h<>>=F=M>>>24,C-=F,0==(F=M>>>16&255))N[i++]=65535&M;else{if(!(16&F)){if(0==(64&F)){M=a[(65535&M)+(w&(1<>>=F,C-=F),C<15&&(w+=U[e++]<>>=F=M>>>24,C-=F,!(16&(F=M>>>16&255))){if(0==(64&F)){M=I[(65535&M)+(w&(1<>>=F,C-=F,(F=i-Q)>3,w&=(1<<(C-=D<<3))-1,A.next_in=e,A.next_out=i,A.avail_in=e>>24&255)+(A>>>8&65280)+((65280&A)<<8)+((255&A)<<24)}function c(){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 e.Buf16(320),this.work=new e.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function E(A){var B;return A&&A.state?(B=A.state,A.total_in=A.total_out=B.total=0,A.msg="",B.wrap&&(A.adler=1&B.wrap),B.mode=1,B.last=0,B.havedict=0,B.dmax=32768,B.head=null,B.hold=0,B.bits=0,B.lencode=B.lendyn=new e.Buf32(852),B.distcode=B.distdyn=new e.Buf32(592),B.sane=1,B.back=-1,0):n}function o(A){var B;return A&&A.state?((B=A.state).wsize=0,B.whave=0,B.wnext=0,E(A)):n}function w(A,B){var t,e;return A&&A.state?(e=A.state,B<0?(t=0,B=-B):(t=1+(B>>4),B<48&&(B&=15)),B&&(B<8||15=Q.wsize?(e.arraySet(Q.window,B,t-Q.wsize,Q.wsize,0),Q.wnext=0,Q.whave=Q.wsize):(g<(i=Q.wsize-Q.wnext)&&(i=g),e.arraySet(Q.window,B,t-g,i,Q.wnext),(g-=i)?(e.arraySet(Q.window,B,t-g,g,0),Q.wnext=g,Q.whave=Q.wsize):(Q.wnext+=i,Q.wnext===Q.wsize&&(Q.wnext=0),Q.whave>>8&255,t.check=i(t.check,T,2,0),Y=I=0,t.mode=2;break}if(t.flags=0,t.head&&(t.head.done=!1),!(1&t.wrap)||(((255&I)<<8)+(I>>8))%31){A.msg="incorrect header check",t.mode=30;break}if(8!=(15&I)){A.msg="unknown compression method",t.mode=30;break}if(Y-=4,R=8+(15&(I>>>=4)),0===t.wbits)t.wbits=R;else if(R>t.wbits){A.msg="invalid window size",t.mode=30;break}t.dmax=1<>8&1),512&t.flags&&(T[0]=255&I,T[1]=I>>>8&255,t.check=i(t.check,T,2,0)),Y=I=0,t.mode=3;case 3:for(;Y<32;){if(0===C)break A;C--,I+=c[o++]<>>8&255,T[2]=I>>>16&255,T[3]=I>>>24&255,t.check=i(t.check,T,4,0)),Y=I=0,t.mode=4;case 4:for(;Y<16;){if(0===C)break A;C--,I+=c[o++]<>8),512&t.flags&&(T[0]=255&I,T[1]=I>>>8&255,t.check=i(t.check,T,2,0)),Y=I=0,t.mode=5;case 5:if(1024&t.flags){for(;Y<16;){if(0===C)break A;C--,I+=c[o++]<>>8&255,t.check=i(t.check,T,2,0)),Y=I=0}else t.head&&(t.head.extra=null);t.mode=6;case 6:if(1024&t.flags&&(C<(u=t.length)&&(u=C),u&&(t.head&&(R=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),e.arraySet(t.head.extra,c,o,u,R)),512&t.flags&&(t.check=i(t.check,c,u,o)),C-=u,o+=u,t.length-=u),t.length))break A;t.length=0,t.mode=7;case 7:if(2048&t.flags){if(0===C)break A;for(u=0;R=c[o+u++],t.head&&R&&t.length<65536&&(t.head.name+=String.fromCharCode(R)),R&&u>9&1,t.head.done=!0),A.adler=t.check=0,t.mode=12;break;case 10:for(;Y<32;){if(0===C)break A;C--,I+=c[o++]<>>=7&Y,Y-=7&Y,t.mode=27;break}for(;Y<3;){if(0===C)break A;C--,I+=c[o++]<>>=1)){case 0:t.mode=14;break;case 1:if(h(t),t.mode=20,6!==B)break;I>>>=2,Y-=2;break A;case 2:t.mode=17;break;case 3:A.msg="invalid block type",t.mode=30}I>>>=2,Y-=2;break;case 14:for(I>>>=7&Y,Y-=7&Y;Y<32;){if(0===C)break A;C--,I+=c[o++]<>>16^65535)){A.msg="invalid stored block lengths",t.mode=30;break}if(t.length=65535&I,Y=I=0,t.mode=15,6===B)break A;case 15:t.mode=16;case 16:if(u=t.length){if(C>>=5,Y-=5,t.ndist=1+(31&I),I>>>=5,Y-=5,t.ncode=4+(15&I),I>>>=4,Y-=4,286>>=3,Y-=3}for(;t.have<19;)t.lens[j[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,J={bits:t.lenbits},p=s(0,t.lens,0,19,t.lencode,0,t.work,J),t.lenbits=J.bits,p){A.msg="invalid code lengths set",t.mode=30;break}t.have=0,t.mode=19;case 19:for(;t.have>>16&255,m=65535&k,!((U=k>>>24)<=Y);){if(0===C)break A;C--,I+=c[o++]<>>=U,Y-=U,t.lens[t.have++]=m;else{if(16===m){for(y=U+2;Y>>=U,Y-=U,0===t.have){A.msg="invalid bit length repeat",t.mode=30;break}R=t.lens[t.have-1],u=3+(3&I),I>>>=2,Y-=2}else if(17===m){for(y=U+3;Y>>=U)),I>>>=3,Y-=3}else{for(y=U+7;Y>>=U)),I>>>=7,Y-=7}if(t.have+u>t.nlen+t.ndist){A.msg="invalid bit length repeat",t.mode=30;break}for(;u--;)t.lens[t.have++]=R}}if(30===t.mode)break;if(0===t.lens[256]){A.msg="invalid code -- missing end-of-block",t.mode=30;break}if(t.lenbits=9,J={bits:t.lenbits},p=s(1,t.lens,0,t.nlen,t.lencode,0,t.work,J),t.lenbits=J.bits,p){A.msg="invalid literal/lengths set",t.mode=30;break}if(t.distbits=6,t.distcode=t.distdyn,J={bits:t.distbits},p=s(2,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,J),t.distbits=J.bits,p){A.msg="invalid distances set",t.mode=30;break}if(t.mode=20,6===B)break A;case 20:t.mode=21;case 21:if(6<=C&&258<=a){A.next_out=w,A.avail_out=a,A.next_in=o,A.avail_in=C,t.hold=I,t.bits=Y,Q(A,D),w=A.next_out,E=A.output,a=A.avail_out,o=A.next_in,c=A.input,C=A.avail_in,I=t.hold,Y=t.bits,12===t.mode&&(t.back=-1);break}for(t.back=0;N=(k=t.lencode[I&(1<>>16&255,m=65535&k,!((U=k>>>24)<=Y);){if(0===C)break A;C--,I+=c[o++]<>G)])>>>16&255,m=65535&k,!(G+(U=k>>>24)<=Y);){if(0===C)break A;C--,I+=c[o++]<>>=G,Y-=G,t.back+=G}if(I>>>=U,Y-=U,t.back+=U,t.length=m,0===N){t.mode=26;break}if(32&N){t.back=-1,t.mode=12;break}if(64&N){A.msg="invalid literal/length code",t.mode=30;break}t.extra=15&N,t.mode=22;case 22:if(t.extra){for(y=t.extra;Y>>=t.extra,Y-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=23;case 23:for(;N=(k=t.distcode[I&(1<>>16&255,m=65535&k,!((U=k>>>24)<=Y);){if(0===C)break A;C--,I+=c[o++]<>G)])>>>16&255,m=65535&k,!(G+(U=k>>>24)<=Y);){if(0===C)break A;C--,I+=c[o++]<>>=G,Y-=G,t.back+=G}if(I>>>=U,Y-=U,t.back+=U,64&N){A.msg="invalid distance code",t.mode=30;break}t.offset=m,t.extra=15&N,t.mode=24;case 24:if(t.extra){for(y=t.extra;Y>>=t.extra,Y-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){A.msg="invalid distance too far back",t.mode=30;break}t.mode=25;case 25:if(0===a)break A;if(u=D-a,t.offset>u){if((u=t.offset-u)>t.whave&&t.sane){A.msg="invalid distance too far back",t.mode=30;break}l=u>t.wnext?(u-=t.wnext,t.wsize-u):t.wnext-u,u>t.length&&(u=t.length),d=t.window}else d=E,l=w-t.offset,u=t.length;for(ah?(F=j[x+E[d]],J[y+E[d]]):(F=96,0),w=1<>f)+(C-=w)]=M<<24|F<<16|D|0,0!==C;);for(w=1<>=1;if(0!==w?(p&=w-1,p+=w):p=0,d++,0==--k[l]){if(l===N)break;l=B[t+E[d]]}if(m>>7)]}function U(A,B){A.pending_buf[A.pending++]=255&B,A.pending_buf[A.pending++]=B>>>8&255}function N(A,B,t){A.bi_valid>16-t?(A.bi_buf|=B<>16-A.bi_valid,A.bi_valid+=t-16):(A.bi_buf|=B<>>=1,t<<=1,0<--B;);return t>>>1}function f(A,B,t){var e,g,i=new Array(16),Q=0;for(e=1;e<=n;e++)i[e]=Q=Q+t[e-1]<<1;for(g=0;g<=B;g++){var s=A[2*g+1];0!==s&&(A[2*g]=G(i[s]++,s))}}function H(A){var B;for(B=0;B>1;1<=t;t--)J(A,i,t);for(g=r;t=A.heap[1],A.heap[1]=A.heap[A.heap_len--],J(A,i,1),e=A.heap[1],A.heap[--A.heap_max]=t,A.heap[--A.heap_max]=e,i[2*g]=i[2*t]+i[2*e],A.depth[g]=(A.depth[t]>=A.depth[e]?A.depth[t]:A.depth[e])+1,i[2*t+1]=i[2*e+1]=g,A.heap[1]=g++,J(A,i,1),2<=A.heap_len;);A.heap[--A.heap_max]=A.heap[1],function(A,B){var t,e,g,i,Q,s,r=B.dyn_tree,c=B.max_code,E=B.stat_desc.static_tree,o=B.stat_desc.has_stree,w=B.stat_desc.extra_bits,C=B.stat_desc.extra_base,a=B.stat_desc.max_length,I=0;for(i=0;i<=n;i++)A.bl_count[i]=0;for(r[2*A.heap[A.heap_max]+1]=0,t=A.heap_max+1;t<573;t++)a<(i=r[2*r[2*(e=A.heap[t])+1]+1]+1)&&(i=a,I++),r[2*e+1]=i,c>=7;e>>=1)if(1&t&&0!==A.dyn_ltree[2*B])return 0;if(0!==A.dyn_ltree[18]||0!==A.dyn_ltree[20]||0!==A.dyn_ltree[26])return 1;for(B=32;B>>3,(Q=A.static_len+3+7>>>3)<=g&&(g=Q)):g=Q=t+5,t+4<=g&&-1!==B?S(A,B,t,e):4===A.strategy||Q===g?(N(A,2+(e?1:0),3),y(A,w,C)):(N(A,4+(e?1:0),3),function(A,B,t,e){var g;for(N(A,B-257,5),N(A,t-1,5),N(A,e-4,4),g=0;g>>8&255,A.pending_buf[A.d_buf+2*A.last_lit+1]=255&B,A.pending_buf[A.l_buf+A.last_lit]=255&t,A.last_lit++,0===B?A.dyn_ltree[2*t]++:(A.matches++,B--,A.dyn_ltree[2*(I[t]+i+1)]++,A.dyn_dtree[2*d(B)]++),A.last_lit===A.lit_bufsize-1},t._tr_align=function(A){N(A,2,3),m(A,256,w),function(A){16===A.bi_valid?(U(A,A.bi_buf),A.bi_buf=0,A.bi_valid=0):8<=A.bi_valid&&(A.pending_buf[A.pending++]=255&A.bi_buf,A.bi_buf>>=8,A.bi_valid-=8)}(A)}},{"../utils/common":41}],53:[function(A,B,t){"use strict";B.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(A,B,t){(function(A){!function(A,B){"use strict";if(!A.setImmediate){var t,e,i,Q,s=1,n={},r=!1,c=A.document,E=Object.getPrototypeOf&&Object.getPrototypeOf(A);E=E&&E.setTimeout?E:A,t="[object process]"==={}.toString.call(A.process)?function(A){g.nextTick((function(){w(A)}))}:function(){if(A.postMessage&&!A.importScripts){var B=!0,t=A.onmessage;return A.onmessage=function(){B=!1},A.postMessage("","*"),A.onmessage=t,B}}()?(Q="setImmediate$"+Math.random()+"$",A.addEventListener?A.addEventListener("message",C,!1):A.attachEvent("onmessage",C),function(B){A.postMessage(Q+B,"*")}):A.MessageChannel?((i=new MessageChannel).port1.onmessage=function(A){w(A.data)},function(A){i.port2.postMessage(A)}):c&&"onreadystatechange"in c.createElement("script")?(e=c.documentElement,function(A){var B=c.createElement("script");B.onreadystatechange=function(){w(A),B.onreadystatechange=null,e.removeChild(B),B=null},e.appendChild(B)}):function(A){setTimeout(w,0,A)},E.setImmediate=function(A){"function"!=typeof A&&(A=new Function(""+A));for(var B=new Array(arguments.length-1),e=0;e>24&255;return{r:A>>16&255,g:A>>8&255,b:255&A,a:B>0?B:255}}static hexToRgb(A){A.startsWith("#")&&(A=A.substring(1));const B=parseInt(A,16);if(isNaN(B))return null;if(6===A.length)return{r:B>>16&255,g:B>>8&255,b:255&B};if(3===A.length){const A=B>>8&15,t=B>>4&15,e=15&B;return{r:A<<4|A,g:t<<4|t,b:e<<4|e}}return null}static rgbToHex(A){return t.decimalToHex(t.rgbToDecimal(A))}static rgbToDecimal(A){return(A.r<<16)+(A.g<<8)+A.b}static hexToDecimal(A){return t.rgbToDecimal(t.hexToRgb(A))}static hsvToRgb(A){let B=A.h%360;B<0&&(B+=360);const t=Math.max(0,Math.min(A.s,1)),e=Math.max(0,Math.min(A.v,1)),g=Math.floor(B/60),i=B/60-g,Q=e*(1-t),s=e*(1-t*i),n=e*(1-t*(1-i));let r,c,E;switch(g){default:case 0:r=e,c=n,E=Q;break;case 1:r=s,c=e,E=Q;break;case 2:r=Q,c=e,E=n;break;case 3:r=Q,c=s,E=e;break;case 4:r=n,c=Q,E=e;break;case 5:r=e,c=Q,E=s}return{r:Math.floor(255*r),g:Math.floor(255*c),b:Math.floor(255*E)}}static rgbToHsv(A){const B=A.r/255,t=A.g/255,e=A.b/255,g=Math.min(Math.min(B,t),e),i=Math.max(Math.max(B,t),e);let Q=0,s=0;if(g!==i){Q=60*((B===g?3:t===g?5:1)-(B===g?t-e:t===g?e-B:B-t)/(i-g))%360,s=(i-g)/i}return{h:Q,s:s,v:i}}static mixRgb(A,B,t){if(t<=0)return A;if(t>=1)return B;const e=1-t;return{r:e*A.r+t*B.r,g:e*A.g+t*B.g,b:e*A.b+t*B.b}}}A.exports=t},function(A,B,t){A.exports=function(){"use strict";var A=Array.prototype.slice;function B(A,B){B&&(A.prototype=Object.create(B.prototype)),A.prototype.constructor=A}function t(A){return Q(A)?A:L(A)}function e(A){return s(A)?A:P(A)}function g(A){return n(A)?A:v(A)}function i(A){return Q(A)&&!r(A)?A:W(A)}function Q(A){return!(!A||!A[E])}function s(A){return!(!A||!A[o])}function n(A){return!(!A||!A[w])}function r(A){return s(A)||n(A)}function c(A){return!(!A||!A[C])}B(e,t),B(g,t),B(i,t),t.isIterable=Q,t.isKeyed=s,t.isIndexed=n,t.isAssociative=r,t.isOrdered=c,t.Keyed=e,t.Indexed=g,t.Set=i;var E="@@__IMMUTABLE_ITERABLE__@@",o="@@__IMMUTABLE_KEYED__@@",w="@@__IMMUTABLE_INDEXED__@@",C="@@__IMMUTABLE_ORDERED__@@",a={},I={value:!1},Y={value:!1};function h(A){return A.value=!1,A}function M(A){A&&(A.value=!0)}function F(){}function D(A,B){B=B||0;for(var t=Math.max(0,A.length-B),e=new Array(t),g=0;g>>0;if(""+t!==B||4294967295===t)return NaN;B=t}return B<0?u(A)+B:B}function d(){return!0}function U(A,B,t){return(0===A||void 0!==t&&A<=-t)&&(void 0===B||void 0!==t&&B>=t)}function N(A,B){return G(A,B,0)}function m(A,B){return G(A,B,B)}function G(A,B,t){return void 0===A?t:A<0?Math.max(0,B+A):void 0===B?A:Math.min(B,A)}var f,H,R,p="function"==typeof Symbol&&Symbol.iterator,J=p||"@@iterator";function y(A){this.next=A}function k(A,B,t,e){var g=0===A?B:1===A?t:[B,t];return e?e.value=g:e={value:g,done:!1},e}function T(){return{value:void 0,done:!0}}function j(A){return!!b(A)}function x(A){return A&&"function"==typeof A.next}function S(A){var B=b(A);return B&&B.call(A)}function b(A){var B=A&&(p&&A[p]||A["@@iterator"]);if("function"==typeof B)return B}function z(A){return A&&"number"==typeof A.length}function L(A){return null==A?_():Q(A)?A.toSeq():function(A){var B=AA(A)||"object"==typeof A&&new K(A);if(!B)throw new TypeError("Expected Array or iterable object of values, or keyed object: "+A);return B}(A)}function P(A){return null==A?_().toKeyedSeq():Q(A)?s(A)?A.toSeq():A.fromEntrySeq():q(A)}function v(A){return null==A?_():Q(A)?s(A)?A.entrySeq():A.toIndexedSeq():$(A)}function W(A){return(null==A?_():Q(A)?s(A)?A.entrySeq():A:$(A)).toSetSeq()}function V(A){this._array=A,this.size=A.length}function K(A){var B=Object.keys(A);this._object=A,this._keys=B,this.size=B.length}function O(A){this._iterable=A,this.size=A.length||A.size}function X(A){this._iterator=A,this._iteratorCache=[]}function Z(A){return!(!A||!A["@@__IMMUTABLE_SEQ__@@"])}function _(){return f||(f=new V([]))}function q(A){var B=Array.isArray(A)?new V(A).fromEntrySeq():x(A)?new X(A).fromEntrySeq():j(A)?new O(A).fromEntrySeq():"object"==typeof A?new K(A):void 0;if(!B)throw new TypeError("Expected Array or iterable object of [k, v] entries, or keyed object: "+A);return B}function $(A){var B=AA(A);if(!B)throw new TypeError("Expected Array or iterable object of values: "+A);return B}function AA(A){return z(A)?new V(A):x(A)?new X(A):j(A)?new O(A):void 0}function BA(A,B,t,e){var g=A._cache;if(g){for(var i=g.length-1,Q=0;Q<=i;Q++){var s=g[t?i-Q:Q];if(!1===B(s[1],e?s[0]:Q,A))return Q+1}return Q}return A.__iterateUncached(B,t)}function tA(A,B,t,e){var g=A._cache;if(g){var i=g.length-1,Q=0;return new y((function(){var A=g[t?i-Q:Q];return Q++>i?{value:void 0,done:!0}:k(B,e?A[0]:Q-1,A[1])}))}return A.__iteratorUncached(B,t)}function eA(A,B){return B?function A(B,t,e,g){return Array.isArray(t)?B.call(g,e,v(t).map((function(e,g){return A(B,e,g,t)}))):iA(t)?B.call(g,e,P(t).map((function(e,g){return A(B,e,g,t)}))):t}(B,A,"",{"":A}):gA(A)}function gA(A){return Array.isArray(A)?v(A).map(gA).toList():iA(A)?P(A).map(gA).toMap():A}function iA(A){return A&&(A.constructor===Object||void 0===A.constructor)}function QA(A,B){if(A===B||A!=A&&B!=B)return!0;if(!A||!B)return!1;if("function"==typeof A.valueOf&&"function"==typeof B.valueOf){if((A=A.valueOf())===(B=B.valueOf())||A!=A&&B!=B)return!0;if(!A||!B)return!1}return!("function"!=typeof A.equals||"function"!=typeof B.equals||!A.equals(B))}function sA(A,B){if(A===B)return!0;if(!Q(B)||void 0!==A.size&&void 0!==B.size&&A.size!==B.size||void 0!==A.__hash&&void 0!==B.__hash&&A.__hash!==B.__hash||s(A)!==s(B)||n(A)!==n(B)||c(A)!==c(B))return!1;if(0===A.size&&0===B.size)return!0;var t=!r(A);if(c(A)){var e=A.entries();return B.every((function(A,B){var g=e.next().value;return g&&QA(g[1],A)&&(t||QA(g[0],B))}))&&e.next().done}var g=!1;if(void 0===A.size)if(void 0===B.size)"function"==typeof A.cacheResult&&A.cacheResult();else{g=!0;var i=A;A=B,B=i}var E=!0,o=B.__iterate((function(B,e){if(t?!A.has(B):g?!QA(B,A.get(e,a)):!QA(A.get(e,a),B))return E=!1,!1}));return E&&A.size===o}function nA(A,B){if(!(this instanceof nA))return new nA(A,B);if(this._value=A,this.size=void 0===B?1/0:Math.max(0,B),0===this.size){if(H)return H;H=this}}function rA(A,B){if(!A)throw new Error(B)}function cA(A,B,t){if(!(this instanceof cA))return new cA(A,B,t);if(rA(0!==t,"Cannot step a Range by 0"),A=A||0,void 0===B&&(B=1/0),t=void 0===t?1:Math.abs(t),Be?{value:void 0,done:!0}:k(A,g,t[B?e-g++:g++])}))},B(K,P),K.prototype.get=function(A,B){return void 0===B||this.has(A)?this._object[A]:B},K.prototype.has=function(A){return this._object.hasOwnProperty(A)},K.prototype.__iterate=function(A,B){for(var t=this._object,e=this._keys,g=e.length-1,i=0;i<=g;i++){var Q=e[B?g-i:i];if(!1===A(t[Q],Q,this))return i+1}return i},K.prototype.__iterator=function(A,B){var t=this._object,e=this._keys,g=e.length-1,i=0;return new y((function(){var Q=e[B?g-i:i];return i++>g?{value:void 0,done:!0}:k(A,Q,t[Q])}))},K.prototype[C]=!0,B(O,v),O.prototype.__iterateUncached=function(A,B){if(B)return this.cacheResult().__iterate(A,B);var t=S(this._iterable),e=0;if(x(t))for(var g;!(g=t.next()).done&&!1!==A(g.value,e++,this););return e},O.prototype.__iteratorUncached=function(A,B){if(B)return this.cacheResult().__iterator(A,B);var t=S(this._iterable);if(!x(t))return new y(T);var e=0;return new y((function(){var B=t.next();return B.done?B:k(A,e++,B.value)}))},B(X,v),X.prototype.__iterateUncached=function(A,B){if(B)return this.cacheResult().__iterate(A,B);for(var t,e=this._iterator,g=this._iteratorCache,i=0;i=e.length){var B=t.next();if(B.done)return B;e[g]=B.value}return k(A,g,e[g++])}))},B(nA,v),nA.prototype.toString=function(){return 0===this.size?"Repeat []":"Repeat [ "+this._value+" "+this.size+" times ]"},nA.prototype.get=function(A,B){return this.has(A)?this._value:B},nA.prototype.includes=function(A){return QA(this._value,A)},nA.prototype.slice=function(A,B){var t=this.size;return U(A,B,t)?this:new nA(this._value,m(B,t)-N(A,t))},nA.prototype.reverse=function(){return this},nA.prototype.indexOf=function(A){return QA(this._value,A)?0:-1},nA.prototype.lastIndexOf=function(A){return QA(this._value,A)?this.size:-1},nA.prototype.__iterate=function(A,B){for(var t=0;t=0&&B=0&&tt?{value:void 0,done:!0}:k(A,i++,Q)}))},cA.prototype.equals=function(A){return A instanceof cA?this._start===A._start&&this._end===A._end&&this._step===A._step:sA(this,A)},B(EA,t),B(oA,EA),B(wA,EA),B(CA,EA),EA.Keyed=oA,EA.Indexed=wA,EA.Set=CA;var aA="function"==typeof Math.imul&&-2===Math.imul(4294967295,2)?Math.imul:function(A,B){var t=65535&(A|=0),e=65535&(B|=0);return t*e+((A>>>16)*e+t*(B>>>16)<<16>>>0)|0};function IA(A){return A>>>1&1073741824|3221225471&A}function YA(A){if(!1===A||null==A)return 0;if("function"==typeof A.valueOf&&(!1===(A=A.valueOf())||null==A))return 0;if(!0===A)return 1;var B=typeof A;if("number"===B){if(A!=A||A===1/0)return 0;var t=0|A;for(t!==A&&(t^=4294967295*A);A>4294967295;)t^=A/=4294967295;return IA(t)}if("string"===B)return A.length>UA?function(A){var B=GA[A];return void 0===B&&(B=hA(A),mA===NA&&(mA=0,GA={}),mA++,GA[A]=B),B}(A):hA(A);if("function"==typeof A.hashCode)return A.hashCode();if("object"===B)return function(A){var B;if(uA&&void 0!==(B=MA.get(A)))return B;if(void 0!==(B=A[dA]))return B;if(!DA){if(void 0!==(B=A.propertyIsEnumerable&&A.propertyIsEnumerable[dA]))return B;if(void 0!==(B=function(A){if(A&&A.nodeType>0)switch(A.nodeType){case 1:return A.uniqueID;case 9:return A.documentElement&&A.documentElement.uniqueID}}(A)))return B}if(B=++lA,1073741824&lA&&(lA=0),uA)MA.set(A,B);else{if(void 0!==FA&&!1===FA(A))throw new Error("Non-extensible objects are not allowed as keys.");if(DA)Object.defineProperty(A,dA,{enumerable:!1,configurable:!1,writable:!1,value:B});else if(void 0!==A.propertyIsEnumerable&&A.propertyIsEnumerable===A.constructor.prototype.propertyIsEnumerable)A.propertyIsEnumerable=function(){return this.constructor.prototype.propertyIsEnumerable.apply(this,arguments)},A.propertyIsEnumerable[dA]=B;else{if(void 0===A.nodeType)throw new Error("Unable to set a non-enumerable property on object.");A[dA]=B}}return B}(A);if("function"==typeof A.toString)return hA(A.toString());throw new Error("Value type "+B+" cannot be hashed.")}function hA(A){for(var B=0,t=0;t=B.length)throw new Error("Missing value for key: "+B[t]);A.set(B[t],B[t+1])}}))},HA.prototype.toString=function(){return this.__toString("Map {","}")},HA.prototype.get=function(A,B){return this._root?this._root.get(0,void 0,A,B):B},HA.prototype.set=function(A,B){return WA(this,A,B)},HA.prototype.setIn=function(A,B){return this.updateIn(A,a,(function(){return B}))},HA.prototype.remove=function(A){return WA(this,A,a)},HA.prototype.deleteIn=function(A){return this.updateIn(A,(function(){return a}))},HA.prototype.update=function(A,B,t){return 1===arguments.length?A(this):this.updateIn([A],B,t)},HA.prototype.updateIn=function(A,B,t){t||(t=B,B=void 0);var e=function A(B,t,e,g){var i=B===a,Q=t.next();if(Q.done){var s=i?e:B,n=g(s);return n===s?B:n}rA(i||B&&B.set,"invalid keyPath");var r=Q.value,c=i?a:B.get(r,a),E=A(c,t,e,g);return E===c?B:E===a?B.remove(r):(i?vA():B).set(r,E)}(this,XB(A),B,t);return e===a?void 0:e},HA.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._root=null,this.__hash=void 0,this.__altered=!0,this):vA()},HA.prototype.merge=function(){return XA(this,void 0,arguments)},HA.prototype.mergeWith=function(B){var t=A.call(arguments,1);return XA(this,B,t)},HA.prototype.mergeIn=function(B){var t=A.call(arguments,1);return this.updateIn(B,vA(),(function(A){return"function"==typeof A.merge?A.merge.apply(A,t):t[t.length-1]}))},HA.prototype.mergeDeep=function(){return XA(this,ZA,arguments)},HA.prototype.mergeDeepWith=function(B){var t=A.call(arguments,1);return XA(this,_A(B),t)},HA.prototype.mergeDeepIn=function(B){var t=A.call(arguments,1);return this.updateIn(B,vA(),(function(A){return"function"==typeof A.mergeDeep?A.mergeDeep.apply(A,t):t[t.length-1]}))},HA.prototype.sort=function(A){return DB(xB(this,A))},HA.prototype.sortBy=function(A,B){return DB(xB(this,B,A))},HA.prototype.withMutations=function(A){var B=this.asMutable();return A(B),B.wasAltered()?B.__ensureOwner(this.__ownerID):this},HA.prototype.asMutable=function(){return this.__ownerID?this:this.__ensureOwner(new F)},HA.prototype.asImmutable=function(){return this.__ensureOwner()},HA.prototype.wasAltered=function(){return this.__altered},HA.prototype.__iterator=function(A,B){return new bA(this,A,B)},HA.prototype.__iterate=function(A,B){var t=this,e=0;return this._root&&this._root.iterate((function(B){return e++,A(B[1],B[0],t)}),B),e},HA.prototype.__ensureOwner=function(A){return A===this.__ownerID?this:A?PA(this.size,this._root,A,this.__hash):(this.__ownerID=A,this.__altered=!1,this)},HA.isMap=RA;var pA,JA="@@__IMMUTABLE_MAP__@@",yA=HA.prototype;function kA(A,B){this.ownerID=A,this.entries=B}function TA(A,B,t){this.ownerID=A,this.bitmap=B,this.nodes=t}function jA(A,B,t){this.ownerID=A,this.count=B,this.nodes=t}function xA(A,B,t){this.ownerID=A,this.keyHash=B,this.entries=t}function SA(A,B,t){this.ownerID=A,this.keyHash=B,this.entry=t}function bA(A,B,t){this._type=B,this._reverse=t,this._stack=A._root&&LA(A._root)}function zA(A,B){return k(A,B[0],B[1])}function LA(A,B){return{node:A,index:0,__prev:B}}function PA(A,B,t,e){var g=Object.create(yA);return g.size=A,g._root=B,g.__ownerID=t,g.__hash=e,g.__altered=!1,g}function vA(){return pA||(pA=PA(0))}function WA(A,B,t){var e,g;if(A._root){var i=h(I),Q=h(Y);if(e=VA(A._root,A.__ownerID,0,void 0,B,t,i,Q),!Q.value)return A;g=A.size+(i.value?t===a?-1:1:0)}else{if(t===a)return A;g=1,e=new kA(A.__ownerID,[[B,t]])}return A.__ownerID?(A.size=g,A._root=e,A.__hash=void 0,A.__altered=!0,A):e?PA(g,e):vA()}function VA(A,B,t,e,g,i,Q,s){return A?A.update(B,t,e,g,i,Q,s):i===a?A:(M(s),M(Q),new SA(B,e,[g,i]))}function KA(A){return A.constructor===SA||A.constructor===xA}function OA(A,B,t,e,g){if(A.keyHash===e)return new xA(B,e,[A.entry,g]);var i,Q=31&(0===t?A.keyHash:A.keyHash>>>t),s=31&(0===t?e:e>>>t);return new TA(B,1<>1&1431655765))+(A>>2&858993459))+(A>>4)&252645135,A+=A>>8,127&(A+=A>>16)}function AB(A,B,t,e){var g=e?A:D(A);return g[B]=t,g}yA[JA]=!0,yA.delete=yA.remove,yA.removeIn=yA.deleteIn,kA.prototype.get=function(A,B,t,e){for(var g=this.entries,i=0,Q=g.length;i=BB)return function(A,B,t,e){A||(A=new F);for(var g=new SA(A,YA(t),[t,e]),i=0;i>>A)),i=this.bitmap;return 0==(i&g)?e:this.nodes[$A(i&g-1)].get(A+5,B,t,e)},TA.prototype.update=function(A,B,t,e,g,i,Q){void 0===t&&(t=YA(e));var s=31&(0===B?t:t>>>B),n=1<=tB)return function(A,B,t,e,g){for(var i=0,Q=new Array(32),s=0;0!==t;s++,t>>>=1)Q[s]=1&t?B[i++]:void 0;return Q[e]=g,new jA(A,i+1,Q)}(A,o,r,s,C);if(c&&!C&&2===o.length&&KA(o[1^E]))return o[1^E];if(c&&C&&1===o.length&&KA(C))return C;var I=A&&A===this.ownerID,Y=c?C?r:r^n:r|n,h=c?C?AB(o,E,C,I):function(A,B,t){var e=A.length-1;if(t&&B===e)return A.pop(),A;for(var g=new Array(e),i=0,Q=0;Q>>A),i=this.nodes[g];return i?i.get(A+5,B,t,e):e},jA.prototype.update=function(A,B,t,e,g,i,Q){void 0===t&&(t=YA(e));var s=31&(0===B?t:t>>>B),n=g===a,r=this.nodes,c=r[s];if(n&&!c)return this;var E=VA(c,A,B+5,t,e,g,i,Q);if(E===c)return this;var o=this.count;if(c){if(!E&&--o0&&e<32?wB(0,e,5,null,new nB(t.toArray())):B.withMutations((function(A){A.setSize(e),t.forEach((function(B,t){return A.set(t,B)}))})))}function iB(A){return!(!A||!A[QB])}B(gB,wA),gB.of=function(){return this(arguments)},gB.prototype.toString=function(){return this.__toString("List [","]")},gB.prototype.get=function(A,B){if((A=l(this,A))>=0&&A=A.size||B<0)return A.withMutations((function(A){B<0?hB(A,B).set(0,t):hB(A,0,B+1).set(B,t)}));B+=A._origin;var e=A._tail,g=A._root,i=h(Y);return B>=FB(A._capacity)?e=aB(e,A.__ownerID,0,B,t,i):g=aB(g,A.__ownerID,A._level,B,t,i),i.value?A.__ownerID?(A._root=g,A._tail=e,A.__hash=void 0,A.__altered=!0,A):wB(A._origin,A._capacity,A._level,g,e):A}(this,A,B)},gB.prototype.remove=function(A){return this.has(A)?0===A?this.shift():A===this.size-1?this.pop():this.splice(A,1):this},gB.prototype.insert=function(A,B){return this.splice(A,0,B)},gB.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=this._origin=this._capacity=0,this._level=5,this._root=this._tail=null,this.__hash=void 0,this.__altered=!0,this):CB()},gB.prototype.push=function(){var A=arguments,B=this.size;return this.withMutations((function(t){hB(t,0,B+A.length);for(var e=0;e>>B&31;if(e>=this.array.length)return new nB([],A);var g,i=0===e;if(B>0){var Q=this.array[e];if((g=Q&&Q.removeBefore(A,B-5,t))===Q&&i)return this}if(i&&!g)return this;var s=IB(this,A);if(!i)for(var n=0;n>>B&31;if(g>=this.array.length)return this;if(B>0){var i=this.array[g];if((e=i&&i.removeAfter(A,B-5,t))===i&&g===this.array.length-1)return this}var Q=IB(this,A);return Q.array.splice(g+1),e&&(Q.array[g]=e),Q};var rB,cB,EB={};function oB(A,B){var t=A._origin,e=A._capacity,g=FB(e),i=A._tail;return Q(A._root,A._level,0);function Q(A,s,n){return 0===s?function(A,Q){var s=Q===g?i&&i.array:A&&A.array,n=Q>t?0:t-Q,r=e-Q;return r>32&&(r=32),function(){if(n===r)return EB;var A=B?--r:n++;return s&&s[A]}}(A,n):function(A,g,i){var s,n=A&&A.array,r=i>t?0:t-i>>g,c=1+(e-i>>g);return c>32&&(c=32),function(){for(;;){if(s){var A=s();if(A!==EB)return A;s=null}if(r===c)return EB;var t=B?--c:r++;s=Q(n&&n[t],g-5,i+(t<>>t&31,n=A&&s0){var r=A&&A.array[s],c=aB(r,B,t-5,e,g,i);return c===r?A:((Q=IB(A,B)).array[s]=c,Q)}return n&&A.array[s]===g?A:(M(i),Q=IB(A,B),void 0===g&&s===Q.array.length-1?Q.array.pop():Q.array[s]=g,Q)}function IB(A,B){return B&&A&&B===A.ownerID?A:new nB(A?A.array.slice():[],B)}function YB(A,B){if(B>=FB(A._capacity))return A._tail;if(B<1<0;)t=t.array[B>>>e&31],e-=5;return t}}function hB(A,B,t){void 0!==B&&(B|=0),void 0!==t&&(t|=0);var e=A.__ownerID||new F,g=A._origin,i=A._capacity,Q=g+B,s=void 0===t?i:t<0?i+t:g+t;if(Q===g&&s===i)return A;if(Q>=s)return A.clear();for(var n=A._level,r=A._root,c=0;Q+c<0;)r=new nB(r&&r.array.length?[void 0,r]:[],e),c+=1<<(n+=5);c&&(Q+=c,g+=c,s+=c,i+=c);for(var E=FB(i),o=FB(s);o>=1<E?new nB([],e):w;if(w&&o>E&&Q5;I-=5){var Y=E>>>I&31;a=a.array[Y]=IB(a.array[Y],e)}a.array[E>>>5&31]=w}if(s=o)Q-=o,s-=o,n=5,r=null,C=C&&C.removeBefore(e,0,Q);else if(Q>g||o>>n&31;if(h!==o>>>n&31)break;h&&(c+=(1<g&&(r=r.removeBefore(e,n,Q-c)),r&&oi&&(i=r.size),Q(n)||(r=r.map((function(A){return eA(A)}))),e.push(r)}return i>A.size&&(A=A.setSize(i)),qA(A,B,e)}function FB(A){return A<32?0:A-1>>>5<<5}function DB(A){return null==A?dB():uB(A)?A:dB().withMutations((function(B){var t=e(A);fA(t.size),t.forEach((function(A,t){return B.set(t,A)}))}))}function uB(A){return RA(A)&&c(A)}function lB(A,B,t,e){var g=Object.create(DB.prototype);return g.size=A?A.size:0,g._map=A,g._list=B,g.__ownerID=t,g.__hash=e,g}function dB(){return cB||(cB=lB(vA(),CB()))}function UB(A,B,t){var e,g,i=A._map,Q=A._list,s=i.get(B),n=void 0!==s;if(t===a){if(!n)return A;Q.size>=32&&Q.size>=2*i.size?(e=(g=Q.filter((function(A,B){return void 0!==A&&s!==B}))).toKeyedSeq().map((function(A){return A[0]})).flip().toMap(),A.__ownerID&&(e.__ownerID=g.__ownerID=A.__ownerID)):(e=i.remove(B),g=s===Q.size-1?Q.pop():Q.set(s,void 0))}else if(n){if(t===Q.get(s)[1])return A;e=i,g=Q.set(s,[B,t])}else e=i.set(B,Q.size),g=Q.set(Q.size,[B,t]);return A.__ownerID?(A.size=e.size,A._map=e,A._list=g,A.__hash=void 0,A):lB(e,g)}function NB(A,B){this._iter=A,this._useKeys=B,this.size=A.size}function mB(A){this._iter=A,this.size=A.size}function GB(A){this._iter=A,this.size=A.size}function fB(A){this._iter=A,this.size=A.size}function HB(A){var B=VB(A);return B._iter=A,B.size=A.size,B.flip=function(){return A},B.reverse=function(){var B=A.reverse.apply(this);return B.flip=function(){return A.reverse()},B},B.has=function(B){return A.includes(B)},B.includes=function(B){return A.has(B)},B.cacheResult=KB,B.__iterateUncached=function(B,t){var e=this;return A.__iterate((function(A,t){return!1!==B(t,A,e)}),t)},B.__iteratorUncached=function(B,t){if(2===B){var e=A.__iterator(B,t);return new y((function(){var A=e.next();if(!A.done){var B=A.value[0];A.value[0]=A.value[1],A.value[1]=B}return A}))}return A.__iterator(1===B?0:1,t)},B}function RB(A,B,t){var e=VB(A);return e.size=A.size,e.has=function(B){return A.has(B)},e.get=function(e,g){var i=A.get(e,a);return i===a?g:B.call(t,i,e,A)},e.__iterateUncached=function(e,g){var i=this;return A.__iterate((function(A,g,Q){return!1!==e(B.call(t,A,g,Q),g,i)}),g)},e.__iteratorUncached=function(e,g){var i=A.__iterator(2,g);return new y((function(){var g=i.next();if(g.done)return g;var Q=g.value,s=Q[0];return k(e,s,B.call(t,Q[1],s,A),g)}))},e}function pB(A,B){var t=VB(A);return t._iter=A,t.size=A.size,t.reverse=function(){return A},A.flip&&(t.flip=function(){var B=HB(A);return B.reverse=function(){return A.flip()},B}),t.get=function(t,e){return A.get(B?t:-1-t,e)},t.has=function(t){return A.has(B?t:-1-t)},t.includes=function(B){return A.includes(B)},t.cacheResult=KB,t.__iterate=function(B,t){var e=this;return A.__iterate((function(A,t){return B(A,t,e)}),!t)},t.__iterator=function(B,t){return A.__iterator(B,!t)},t}function JB(A,B,t,e){var g=VB(A);return e&&(g.has=function(e){var g=A.get(e,a);return g!==a&&!!B.call(t,g,e,A)},g.get=function(e,g){var i=A.get(e,a);return i!==a&&B.call(t,i,e,A)?i:g}),g.__iterateUncached=function(g,i){var Q=this,s=0;return A.__iterate((function(A,i,n){if(B.call(t,A,i,n))return s++,g(A,e?i:s-1,Q)}),i),s},g.__iteratorUncached=function(g,i){var Q=A.__iterator(2,i),s=0;return new y((function(){for(;;){var i=Q.next();if(i.done)return i;var n=i.value,r=n[0],c=n[1];if(B.call(t,c,r,A))return k(g,e?r:s++,c,i)}}))},g}function yB(A,B,t,e){var g=A.size;if(void 0!==B&&(B|=0),void 0!==t&&(t===1/0?t=g:t|=0),U(B,t,g))return A;var i=N(B,g),Q=m(t,g);if(i!=i||Q!=Q)return yB(A.toSeq().cacheResult(),B,t,e);var s,n=Q-i;n==n&&(s=n<0?0:n);var r=VB(A);return r.size=0===s?s:A.size&&s||void 0,!e&&Z(A)&&s>=0&&(r.get=function(B,t){return(B=l(this,B))>=0&&Bs)return{value:void 0,done:!0};var A=g.next();return e||1===B?A:k(B,n-1,0===B?void 0:A.value[1],A)}))},r}function kB(A,B,t,e){var g=VB(A);return g.__iterateUncached=function(g,i){var Q=this;if(i)return this.cacheResult().__iterate(g,i);var s=!0,n=0;return A.__iterate((function(A,i,r){if(!s||!(s=B.call(t,A,i,r)))return n++,g(A,e?i:n-1,Q)})),n},g.__iteratorUncached=function(g,i){var Q=this;if(i)return this.cacheResult().__iterator(g,i);var s=A.__iterator(2,i),n=!0,r=0;return new y((function(){var A,i,c;do{if((A=s.next()).done)return e||1===g?A:k(g,r++,0===g?void 0:A.value[1],A);var E=A.value;i=E[0],c=E[1],n&&(n=B.call(t,c,i,Q))}while(n);return 2===g?A:k(g,i,c,A)}))},g}function TB(A,B){var t=s(A),g=[A].concat(B).map((function(A){return Q(A)?t&&(A=e(A)):A=t?q(A):$(Array.isArray(A)?A:[A]),A})).filter((function(A){return 0!==A.size}));if(0===g.length)return A;if(1===g.length){var i=g[0];if(i===A||t&&s(i)||n(A)&&n(i))return i}var r=new V(g);return t?r=r.toKeyedSeq():n(A)||(r=r.toSetSeq()),(r=r.flatten(!0)).size=g.reduce((function(A,B){if(void 0!==A){var t=B.size;if(void 0!==t)return A+t}}),0),r}function jB(A,B,t){var e=VB(A);return e.__iterateUncached=function(e,g){var i=0,s=!1;return function A(n,r){var c=this;n.__iterate((function(g,n){return(!B||r0}function zB(A,B,e){var g=VB(A);return g.size=new V(e).map((function(A){return A.size})).min(),g.__iterate=function(A,B){for(var t,e=this.__iterator(1,B),g=0;!(t=e.next()).done&&!1!==A(t.value,g++,this););return g},g.__iteratorUncached=function(A,g){var i=e.map((function(A){return A=t(A),S(g?A.reverse():A)})),Q=0,s=!1;return new y((function(){var t;return s||(t=i.map((function(A){return A.next()})),s=t.some((function(A){return A.done}))),s?{value:void 0,done:!0}:k(A,Q++,B.apply(null,t.map((function(A){return A.value}))))}))},g}function LB(A,B){return Z(A)?B:A.constructor(B)}function PB(A){if(A!==Object(A))throw new TypeError("Expected [K, V] tuple: "+A)}function vB(A){return fA(A.size),u(A)}function WB(A){return s(A)?e:n(A)?g:i}function VB(A){return Object.create((s(A)?P:n(A)?v:W).prototype)}function KB(){return this._iter.cacheResult?(this._iter.cacheResult(),this.size=this._iter.size,this):L.prototype.cacheResult.call(this)}function OB(A,B){return A>B?1:A=0;t--)B={value:arguments[t],next:B};return this.__ownerID?(this.size=A,this._head=B,this.__hash=void 0,this.__altered=!0,this):Ft(A,B)},at.prototype.pushAll=function(A){if(0===(A=g(A)).size)return this;fA(A.size);var B=this.size,t=this._head;return A.reverse().forEach((function(A){B++,t={value:A,next:t}})),this.__ownerID?(this.size=B,this._head=t,this.__hash=void 0,this.__altered=!0,this):Ft(B,t)},at.prototype.pop=function(){return this.slice(1)},at.prototype.unshift=function(){return this.push.apply(this,arguments)},at.prototype.unshiftAll=function(A){return this.pushAll(A)},at.prototype.shift=function(){return this.pop.apply(this,arguments)},at.prototype.clear=function(){return 0===this.size?this:this.__ownerID?(this.size=0,this._head=void 0,this.__hash=void 0,this.__altered=!0,this):Dt()},at.prototype.slice=function(A,B){if(U(A,B,this.size))return this;var t=N(A,this.size);if(m(B,this.size)!==this.size)return wA.prototype.slice.call(this,A,B);for(var e=this.size-t,g=this._head;t--;)g=g.next;return this.__ownerID?(this.size=e,this._head=g,this.__hash=void 0,this.__altered=!0,this):Ft(e,g)},at.prototype.__ensureOwner=function(A){return A===this.__ownerID?this:A?Ft(this.size,this._head,A,this.__hash):(this.__ownerID=A,this.__altered=!1,this)},at.prototype.__iterate=function(A,B){if(B)return this.reverse().__iterate(A);for(var t=0,e=this._head;e&&!1!==A(e.value,t++,this);)e=e.next;return t},at.prototype.__iterator=function(A,B){if(B)return this.reverse().__iterator(A);var t=0,e=this._head;return new y((function(){if(e){var B=e.value;return e=e.next,k(A,t++,B)}return{value:void 0,done:!0}}))},at.isStack=It;var Yt,ht="@@__IMMUTABLE_STACK__@@",Mt=at.prototype;function Ft(A,B,t,e){var g=Object.create(Mt);return g.size=A,g._head=B,g.__ownerID=t,g.__hash=e,g.__altered=!1,g}function Dt(){return Yt||(Yt=Ft(0))}function ut(A,B){var t=function(t){A.prototype[t]=B[t]};return Object.keys(B).forEach(t),Object.getOwnPropertySymbols&&Object.getOwnPropertySymbols(B).forEach(t),A}Mt[ht]=!0,Mt.withMutations=yA.withMutations,Mt.asMutable=yA.asMutable,Mt.asImmutable=yA.asImmutable,Mt.wasAltered=yA.wasAltered,t.Iterator=y,ut(t,{toArray:function(){fA(this.size);var A=new Array(this.size||0);return this.valueSeq().__iterate((function(B,t){A[t]=B})),A},toIndexedSeq:function(){return new mB(this)},toJS:function(){return this.toSeq().map((function(A){return A&&"function"==typeof A.toJS?A.toJS():A})).__toJS()},toJSON:function(){return this.toSeq().map((function(A){return A&&"function"==typeof A.toJSON?A.toJSON():A})).__toJS()},toKeyedSeq:function(){return new NB(this,!0)},toMap:function(){return HA(this.toKeyedSeq())},toObject:function(){fA(this.size);var A={};return this.__iterate((function(B,t){A[t]=B})),A},toOrderedMap:function(){return DB(this.toKeyedSeq())},toOrderedSet:function(){return rt(s(this)?this.valueSeq():this)},toSet:function(){return Bt(s(this)?this.valueSeq():this)},toSetSeq:function(){return new GB(this)},toSeq:function(){return n(this)?this.toIndexedSeq():s(this)?this.toKeyedSeq():this.toSetSeq()},toStack:function(){return at(s(this)?this.valueSeq():this)},toList:function(){return gB(s(this)?this.valueSeq():this)},toString:function(){return"[Iterable]"},__toString:function(A,B){return 0===this.size?A+B:A+" "+this.toSeq().map(this.__toStringMapper).join(", ")+" "+B},concat:function(){var B=A.call(arguments,0);return LB(this,TB(this,B))},includes:function(A){return this.some((function(B){return QA(B,A)}))},entries:function(){return this.__iterator(2)},every:function(A,B){fA(this.size);var t=!0;return this.__iterate((function(e,g,i){if(!A.call(B,e,g,i))return t=!1,!1})),t},filter:function(A,B){return LB(this,JB(this,A,B,!0))},find:function(A,B,t){var e=this.findEntry(A,B);return e?e[1]:t},forEach:function(A,B){return fA(this.size),this.__iterate(B?A.bind(B):A)},join:function(A){fA(this.size),A=void 0!==A?""+A:",";var B="",t=!0;return this.__iterate((function(e){t?t=!1:B+=A,B+=null!=e?e.toString():""})),B},keys:function(){return this.__iterator(0)},map:function(A,B){return LB(this,RB(this,A,B))},reduce:function(A,B,t){var e,g;return fA(this.size),arguments.length<2?g=!0:e=B,this.__iterate((function(B,i,Q){g?(g=!1,e=B):e=A.call(t,e,B,i,Q)})),e},reduceRight:function(A,B,t){var e=this.toKeyedSeq().reverse();return e.reduce.apply(e,arguments)},reverse:function(){return LB(this,pB(this,!0))},slice:function(A,B){return LB(this,yB(this,A,B,!0))},some:function(A,B){return!this.every(mt(A),B)},sort:function(A){return LB(this,xB(this,A))},values:function(){return this.__iterator(1)},butLast:function(){return this.slice(0,-1)},isEmpty:function(){return void 0!==this.size?0===this.size:!this.some((function(){return!0}))},count:function(A,B){return u(A?this.toSeq().filter(A,B):this)},countBy:function(A,B){return function(A,B,t){var e=HA().asMutable();return A.__iterate((function(g,i){e.update(B.call(t,g,i,A),0,(function(A){return A+1}))})),e.asImmutable()}(this,A,B)},equals:function(A){return sA(this,A)},entrySeq:function(){var A=this;if(A._cache)return new V(A._cache);var B=A.toSeq().map(Nt).toIndexedSeq();return B.fromEntrySeq=function(){return A.toSeq()},B},filterNot:function(A,B){return this.filter(mt(A),B)},findEntry:function(A,B,t){var e=t;return this.__iterate((function(t,g,i){if(A.call(B,t,g,i))return e=[g,t],!1})),e},findKey:function(A,B){var t=this.findEntry(A,B);return t&&t[0]},findLast:function(A,B,t){return this.toKeyedSeq().reverse().find(A,B,t)},findLastEntry:function(A,B,t){return this.toKeyedSeq().reverse().findEntry(A,B,t)},findLastKey:function(A,B){return this.toKeyedSeq().reverse().findKey(A,B)},first:function(){return this.find(d)},flatMap:function(A,B){return LB(this,function(A,B,t){var e=WB(A);return A.toSeq().map((function(g,i){return e(B.call(t,g,i,A))})).flatten(!0)}(this,A,B))},flatten:function(A){return LB(this,jB(this,A,!0))},fromEntrySeq:function(){return new fB(this)},get:function(A,B){return this.find((function(B,t){return QA(t,A)}),void 0,B)},getIn:function(A,B){for(var t,e=this,g=XB(A);!(t=g.next()).done;){var i=t.value;if((e=e&&e.get?e.get(i,a):a)===a)return B}return e},groupBy:function(A,B){return function(A,B,t){var e=s(A),g=(c(A)?DB():HA()).asMutable();A.__iterate((function(i,Q){g.update(B.call(t,i,Q,A),(function(A){return(A=A||[]).push(e?[Q,i]:i),A}))}));var i=WB(A);return g.map((function(B){return LB(A,i(B))}))}(this,A,B)},has:function(A){return this.get(A,a)!==a},hasIn:function(A){return this.getIn(A,a)!==a},isSubset:function(A){return A="function"==typeof A.includes?A:t(A),this.every((function(B){return A.includes(B)}))},isSuperset:function(A){return(A="function"==typeof A.isSubset?A:t(A)).isSubset(this)},keyOf:function(A){return this.findKey((function(B){return QA(B,A)}))},keySeq:function(){return this.toSeq().map(Ut).toIndexedSeq()},last:function(){return this.toSeq().reverse().first()},lastKeyOf:function(A){return this.toKeyedSeq().reverse().keyOf(A)},max:function(A){return SB(this,A)},maxBy:function(A,B){return SB(this,B,A)},min:function(A){return SB(this,A?Gt(A):Rt)},minBy:function(A,B){return SB(this,B?Gt(B):Rt,A)},rest:function(){return this.slice(1)},skip:function(A){return this.slice(Math.max(0,A))},skipLast:function(A){return LB(this,this.toSeq().reverse().skip(A).reverse())},skipWhile:function(A,B){return LB(this,kB(this,A,B,!0))},skipUntil:function(A,B){return this.skipWhile(mt(A),B)},sortBy:function(A,B){return LB(this,xB(this,B,A))},take:function(A){return this.slice(0,Math.max(0,A))},takeLast:function(A){return LB(this,this.toSeq().reverse().take(A).reverse())},takeWhile:function(A,B){return LB(this,function(A,B,t){var e=VB(A);return e.__iterateUncached=function(e,g){var i=this;if(g)return this.cacheResult().__iterate(e,g);var Q=0;return A.__iterate((function(A,g,s){return B.call(t,A,g,s)&&++Q&&e(A,g,i)})),Q},e.__iteratorUncached=function(e,g){var i=this;if(g)return this.cacheResult().__iterator(e,g);var Q=A.__iterator(2,g),s=!0;return new y((function(){if(!s)return{value:void 0,done:!0};var A=Q.next();if(A.done)return A;var g=A.value,n=g[0],r=g[1];return B.call(t,r,n,i)?2===e?A:k(e,n,r,A):(s=!1,{value:void 0,done:!0})}))},e}(this,A,B))},takeUntil:function(A,B){return this.takeWhile(mt(A),B)},valueSeq:function(){return this.toIndexedSeq()},hashCode:function(){return this.__hash||(this.__hash=function(A){if(A.size===1/0)return 0;var B=c(A),t=s(A),e=B?1:0;return function(A,B){return B=aA(B,3432918353),B=aA(B<<15|B>>>-15,461845907),B=aA(B<<13|B>>>-13,5),B=aA((B=(B+3864292196|0)^A)^B>>>16,2246822507),B=IA((B=aA(B^B>>>13,3266489909))^B>>>16)}(A.__iterate(t?B?function(A,B){e=31*e+pt(YA(A),YA(B))|0}:function(A,B){e=e+pt(YA(A),YA(B))|0}:B?function(A){e=31*e+YA(A)|0}:function(A){e=e+YA(A)|0}),e)}(this))}});var lt=t.prototype;lt[E]=!0,lt[J]=lt.values,lt.__toJS=lt.toArray,lt.__toStringMapper=ft,lt.inspect=lt.toSource=function(){return this.toString()},lt.chain=lt.flatMap,lt.contains=lt.includes,ut(e,{flip:function(){return LB(this,HB(this))},mapEntries:function(A,B){var t=this,e=0;return LB(this,this.toSeq().map((function(g,i){return A.call(B,[i,g],e++,t)})).fromEntrySeq())},mapKeys:function(A,B){var t=this;return LB(this,this.toSeq().flip().map((function(e,g){return A.call(B,e,g,t)})).flip())}});var dt=e.prototype;function Ut(A,B){return B}function Nt(A,B){return[B,A]}function mt(A){return function(){return!A.apply(this,arguments)}}function Gt(A){return function(){return-A.apply(this,arguments)}}function ft(A){return"string"==typeof A?JSON.stringify(A):String(A)}function Ht(){return D(arguments)}function Rt(A,B){return AB?-1:0}function pt(A,B){return A^B+2654435769+(A<<6)+(A>>2)|0}return dt[o]=!0,dt[J]=lt.entries,dt.__toJS=lt.toObject,dt.__toStringMapper=function(A,B){return JSON.stringify(B)+": "+ft(A)},ut(g,{toKeyedSeq:function(){return new NB(this,!1)},filter:function(A,B){return LB(this,JB(this,A,B,!1))},findIndex:function(A,B){var t=this.findEntry(A,B);return t?t[0]:-1},indexOf:function(A){var B=this.keyOf(A);return void 0===B?-1:B},lastIndexOf:function(A){var B=this.lastKeyOf(A);return void 0===B?-1:B},reverse:function(){return LB(this,pB(this,!1))},slice:function(A,B){return LB(this,yB(this,A,B,!1))},splice:function(A,B){var t=arguments.length;if(B=Math.max(0|B,0),0===t||2===t&&!B)return this;A=N(A,A<0?this.count():this.size);var e=this.slice(0,A);return LB(this,1===t?e:e.concat(D(arguments,2),this.slice(A+B)))},findLastIndex:function(A,B){var t=this.findLastEntry(A,B);return t?t[0]:-1},first:function(){return this.get(0)},flatten:function(A){return LB(this,jB(this,A,!1))},get:function(A,B){return(A=l(this,A))<0||this.size===1/0||void 0!==this.size&&A>this.size?B:this.find((function(B,t){return t===A}),void 0,B)},has:function(A){return(A=l(this,A))>=0&&(void 0!==this.size?this.size===1/0||AA/200%1,shapeChanges:!1},fisheye:{uniformName:"u_fisheye",mask:2,converter:A=>Math.max(0,(A+100)/100),shapeChanges:!0},whirl:{uniformName:"u_whirl",mask:4,converter:A=>-A*Math.PI/180,shapeChanges:!0},pixelate:{uniformName:"u_pixelate",mask:8,converter:A=>Math.abs(A)/10,shapeChanges:!0},mosaic:{uniformName:"u_mosaic",mask:16,converter:A=>(A=Math.round((Math.abs(A)+10)/10),Math.max(1,Math.min(A,512))),shapeChanges:!0},brightness:{uniformName:"u_brightness",mask:32,converter:A=>Math.max(-100,Math.min(A,100))/100,shapeChanges:!1},ghost:{uniformName:"u_ghost",mask:64,converter:A=>1-Math.max(0,Math.min(A,100))/100,shapeChanges:!1}},g.EFFECTS=Object.keys(g.EFFECT_INFO),g.DRAW_MODE={default:"default",straightAlpha:"straightAlpha",silhouette:"silhouette",colorMask:"colorMask",line:"line",background:"background"},A.exports=g},function(A,B,t){const e=t(297);A.exports=e},function(A,B,t){const e=t(3),g=t(7),i=t(1),Q=t(13),s=t(127),n=t(14);class r extends s{constructor(A,B){super(B,A.blocks),this.sprite=A,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=r.ROTATION_STYLE_ALL_AROUND,this.volume=100,this.tempo=60,this.videoTransparency=50,this.videoState=r.VIDEO_STATE.ON,this.textToSpeechLanguage=null,this.onTargetMoved=null,this.onTargetVisualChange=null,this.interpolationData=null}initDrawable(A){this.renderer&&(this.drawableID=this.renderer.createDrawable(A)),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 A=this.sprite.soundBank,B={playSound:B=>A.play(this,B)};return Object.defineProperty(this,"audioPlayer",{configurable:!1,enumerable:!0,writable:!1,value:B}),B}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(A,B,t){if(this.isStage)return;if(this.dragging&&!t)return;const e=this.x,g=this.y;if(this.renderer){const t=this.runtime.runtimeOptions.fencing?this.renderer.getFencedPositionOfDrawable(this.drawableID,[A,B]):[A,B];this.x=t[0],this.y=t[1],this.renderer.updateDrawablePosition(this.drawableID,t),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.x=A,this.y=B;this.onTargetMoved&&this.onTargetMoved(this,e,g,t),this.runtime.requestTargetsUpdate(this)}_getRenderedDirectionAndScale(){let A=this.direction,B=[this.size,this.size];if(this.rotationStyle===r.ROTATION_STYLE_NONE)A=90;else if(this.rotationStyle===r.ROTATION_STYLE_LEFT_RIGHT){A=90;B=[(this.direction<0?-1:1)*this.size,this.size]}return{direction:A,scale:B}}setDirection(A){if(!this.isStage&&isFinite(A)){if(this.direction=e.wrapClamp(A,-179,180),this.renderer){const{direction:A,scale:B}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,A,B),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}}setDraggable(A){this.isStage||(this.draggable=!!A,this.runtime.requestTargetsUpdate(this))}setVisible(A){this.isStage||(this.visible=!!A,this.renderer&&(this.renderer.updateDrawableVisible(this.drawableID,this.visible),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())),this.runtime.requestTargetsUpdate(this))}setSize(A){if(!this.isStage){if(this.renderer){const B=this.renderer.getCurrentSkinSize(this.drawableID),t=B[0],g=B[1],i=this.runtime.runtimeOptions.fencing,Q=i?Math.min(1,Math.max(5/t,5/g)):0,s=i?Math.min(1.5*this.runtime.stageWidth/t,1.5*this.runtime.stageHeight/g):1/0;this.size=100*e.clamp(A/100,Q,s);const{direction:n,scale:r}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,n,r),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}else this.size=A;this.runtime.requestTargetsUpdate(this)}}setEffect(A,B){this.effects.hasOwnProperty(A)&&(this.effects[A]=B,this.renderer&&(this.renderer.updateDrawableEffect(this.drawableID,A,B),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())))}clearEffects(){for(const A in this.effects)this.effects.hasOwnProperty(A)&&(this.effects[A]=0);if(this.renderer){for(const A in this.effects)this.effects.hasOwnProperty(A)&&this.renderer.updateDrawableEffect(this.drawableID,A,0);this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}}setCostume(A){if((A=Math.round(A))!==1/0&&A!==-1/0&&A||(A=0),this.currentCostume=e.wrapClamp(A,0,this.sprite.costumes.length-1),this.renderer){const A=this.sprite.costumes[this.currentCostume];this.renderer.updateDrawableSkinId(this.drawableID,A.skinId),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}addCostume(A,B){"number"!=typeof B||isNaN(B)?this.sprite.addCostumeAt(A,this.sprite.costumes.length):this.sprite.addCostumeAt(A,B)}renameCostume(A,B){const t=this.sprite.costumes.filter((B,t)=>A!==t).map(A=>A.name),e=this.getCostumes()[A].name,i=g.unusedName(B,t);if(this.getCostumes()[A].name=i,this.isStage){const A=this.runtime.targets;for(let B=0;B=B)return null;const t=this.sprite.deleteCostumeAt(A);return A===this.currentCostume&&A===B-1?this.setCostume(A-1):AA.name);A.name=g.unusedName(A.name,t),"number"!=typeof B||isNaN(B)?this.sprite.sounds.push(A):this.sprite.sounds.splice(B,0,A)}renameSound(A,B){const t=this.sprite.sounds.filter((B,t)=>A!==t).map(A=>A.name),e=this.sprite.sounds[A].name,i=g.unusedName(B,t);this.sprite.sounds[A].name=i,this.blocks.updateAssetName(e,i,"sound")}deleteSound(A){if(A<0||A>=this.sprite.sounds.length)return null;const B=this.sprite.sounds.splice(A,1)[0];return this.runtime.requestTargetsUpdate(this),B}setRotationStyle(A){if(A===r.ROTATION_STYLE_NONE?this.rotationStyle=r.ROTATION_STYLE_NONE:A===r.ROTATION_STYLE_ALL_AROUND?this.rotationStyle=r.ROTATION_STYLE_ALL_AROUND:A===r.ROTATION_STYLE_LEFT_RIGHT&&(this.rotationStyle=r.ROTATION_STYLE_LEFT_RIGHT),this.renderer){const{direction:A,scale:B}=this._getRenderedDirectionAndScale();this.renderer.updateDrawableDirectionScale(this.drawableID,A,B),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw())}this.runtime.requestTargetsUpdate(this)}getCostumeIndexByName(A){const B=this.getCostumes();for(let t=0;tA/2||t.top>B/2||t.bottom<-B/2)return!0}return!1}isTouchingSprite(A){A=i.toString(A);const B=this.runtime.getSpriteTargetByName(A);if(!B||!this.renderer)return!1;const t=B.sprite.clones.filter(A=>!A.dragging).map(A=>A.drawableID);return this.renderer.isTouchingDrawables(this.drawableID,t)}isTouchingColor(A){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,A)}colorIsTouchingColor(A,B){return!!this.renderer&&this.renderer.isTouchingColor(this.drawableID,A,B)}getLayerOrder(){return this.renderer?this.renderer.getDrawableOrder(this.drawableID):null}goToFront(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,1/0,n.SPRITE_LAYER),this.runtime.setExecutablePosition(this,1/0)}goToBack(){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-1/0,n.SPRITE_LAYER,!1),this.runtime.setExecutablePosition(this,-1/0)}goForwardLayers(A){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,A,n.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,A)}goBackwardLayers(A){this.renderer&&this.renderer.setDrawableOrder(this.drawableID,-A,n.SPRITE_LAYER,!0),this.runtime.moveExecutable(this,-A)}goBehindOther(A){if(this.renderer){const B=this.renderer.setDrawableOrder(A.drawableID,0,n.SPRITE_LAYER,!0);this.renderer.setDrawableOrder(this.drawableID,B,n.SPRITE_LAYER)}const B=this.runtime.executableTargets.indexOf(A);this.runtime.setExecutablePosition(this,B)}keepInFence(A,B,t){let e=t;e||(e={left:-this.runtime.stageWidth/2,right:this.runtime.stageWidth/2,top:this.runtime.stageHeight/2,bottom:-this.runtime.stageHeight/2});const g=this.getBounds();if(!g)return;g.left+=A-this.x,g.right+=A-this.x,g.top+=B-this.y,g.bottom+=B-this.y;let i=0,Q=0;return g.lefte.right&&(i+=e.right-g.right),g.top>e.top&&(Q+=e.top-g.top),g.bottom{const B=A.createClone();return B.x=400*(Math.random()-.5)/2,B.y=300*(Math.random()-.5)/2,B.direction=this.direction,B.draggable=this.draggable,B.visible=this.visible,B.size=this.size,B.currentCostume=this.currentCostume,B.rotationStyle=this.rotationStyle,B.effects=JSON.parse(JSON.stringify(this.effects)),B.variables=this.duplicateVariables(B.blocks),B.updateAllDrawableProperties(),B})}onGreenFlag(){this.clearEffects()}onStopAll(){this.clearEffects()}postSpriteInfo(A){const B=A.hasOwnProperty("force")?A.force:null,t=A.hasOwnProperty("x"),e=A.hasOwnProperty("y");(t||e)&&this.setXY(t?A.x:this.x,e?A.y:this.y,B),A.hasOwnProperty("direction")&&this.setDirection(A.direction),A.hasOwnProperty("draggable")&&this.setDraggable(A.draggable),A.hasOwnProperty("rotationStyle")&&this.setRotationStyle(A.rotationStyle),A.hasOwnProperty("visible")&&this.setVisible(A.visible),A.hasOwnProperty("size")&&this.setSize(A.size)}startDrag(){this.dragging=!0}stopDrag(){this.dragging=!1}toJSON(){const A=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:A[this.currentCostume],costumeCount:A.length,visible:this.visible,rotationStyle:this.rotationStyle,comments:this.comments,blocks:this.blocks._blocks,variables:this.variables,costumes:A,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?n.BACKGROUND_LAYER:n.SPRITE_LAYER),this.visible&&(this.emitVisualChange(),this.runtime.requestRedraw()))}}A.exports=r},function(A,B,t){const e=t(0);A.exports=function(A){if("string"!=typeof A){if(!Array.isArray(A))return e.error("Unexpected input recieved in replaceUnsafeChars"),A;A=String(A)}return A.replace(/[<>&'"]/g,A=>{switch(A){case"<":return"<";case">":return">";case"&":return"&";case"'":return"'";case'"':return"""}})}},function(A,B,t){const e=t(66);A.exports=class extends e{constructor(A,B,t,e){let g=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;super(),this._socket=A.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=e,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=g,this._discoverTimeoutID=null,this._extensionId=B,this._peripheralOptions=t,this._runtime=A,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(A=>{this._handleRequestError(A)})}connectPeripheral(A){this.sendRemoteRequest("connect",{peripheralId:A}).then(()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()}).catch(A=>{this._handleRequestError(A)})}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(A,B){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;const e={serviceId:A,characteristicId:B};return this._characteristicDidChangeCallback=t,this.sendRemoteRequest("startNotifications",e).catch(A=>{this.handleDisconnectError(A)})}read(A,B){let t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;const e={serviceId:A,characteristicId:B};return arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&(e.startNotifications=!0),t&&(this._characteristicDidChangeCallback=t),this.sendRemoteRequest("read",e).catch(A=>{this.handleDisconnectError(A)})}write(A,B,t){let e=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,g=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;const i={serviceId:A,characteristicId:B,message:t};return e&&(i.encoding=e),null!==g&&(i.withResponse=g),this.sendRemoteRequest("write",i).catch(A=>{this.handleDisconnectError(A)})}didReceiveCall(A,B){switch(A){case"didDiscoverPeripheral":this._availablePeripherals[B.peripheralId]=B,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[B.peripheralId]=B,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(B.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(A,B,t){const e=t(0),g=[];class i{constructor(A){this.isLoop=!1,this.warpMode=A,this.justReported=null,this.reporting="",this.reported=null,this.waitingReporter=null,this.params=null,this.executionContext=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}reuse(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.warpMode;return this.reset(),this.warpMode=Boolean(A),this}static create(A){const B=g.pop();return void 0!==B?(B.warpMode=Boolean(A),B):new i(A)}static release(A){void 0!==A&&g.push(A.reset())}}class Q{constructor(A){this.topBlock=A,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}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(A,B){return"".concat(A.id,"&").concat(B)}getId(){return Q.getIdFromTargetAndBlock(this.target,this.topBlock)}pushStack(A){if(this.stack.push(A),this.stack.length>this.stackFrames.length){const A=this.stackFrames[this.stackFrames.length-1];this.stackFrames.push(i.create(void 0!==A&&A.warpMode))}}reuseStackForNextBlock(A){this.stack[this.stack.length-1]=A,this.stackFrames[this.stackFrames.length-1].reuse()}popStack(){return i.release(this.stackFrames.pop()),this.stack.pop()}stopThisScript(){let A=this.peekStack();for(;null!==A;){const B=this.target.blocks.getBlock(A);if(void 0!==B&&"procedures_call"===B.opcode)break;this.popStack(),A=this.peekStack()}0===this.stack.length&&(this.requestScriptGlowInFrame=!1,this.status=Q.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(A){this.justReported=void 0===A?null:A}initParams(){const A=this.peekStackFrame();null===A.params&&(A.params={})}pushParam(A,B){this.peekStackFrame().params[A]=B}getParam(A){for(let B=this.stackFrames.length-1;B>=0;B--){const t=this.stackFrames[B];if(null!==t.params)return t.params.hasOwnProperty(A)?t.params[A]:null}return null}getAllparams(){return this.peekStackFrame().params}atStackTop(){return this.peekStack()===this.topBlock}goToNextBlock(){const A=this.target.blocks.getNextBlock(this.peekStack());this.reuseStackForNextBlock(A)}isRecursiveCall(A){let B=5;for(let t=this.stack.length-1-1;t>=0;t--){const e=this.target.blocks.getBlock(this.stack[t]);if("procedures_call"===e.opcode&&e.mutation.proccode===A)return!0;if(--B<0)return!1}return!1}tryCompile(){if(!this.blockContainer)return;const A=t(203);this.triedToCompile=!0;const B=this.topBlock,g=this.blockContainer.getBlock(B)?this.blockContainer:this.target.runtime.flyoutBlocks,i=g.getCachedCompileResult(B);if(i&&!i.success)return;let Q;if(i)Q=i.value;else try{Q=A(this),g.cacheCompileResult(B,Q)}catch(A){return e.error("cannot compile script",this.target.getName(),A),g.cacheCompileError(B,A),void this.target.runtime.emitCompileError(this.target,A)}this.procedures={};for(const A of Object.keys(Q.procedures))this.procedures[A]=Q.procedures[A](this);this.generator=Q.startingFunction(this)(),this.blockContainer.forceNoGlow||(this.blockGlowInFrame=this.topBlock,this.requestScriptGlowInFrame=!0),this.isCompiled=!0}}A.exports=Q},function(A,B,t){const e=t(7),g=t(0),i=t(241),{loadSvgString:Q,serializeSvgToString:s}=t(49),{parseVectorMetadata:n}=t(85),r=function(A,B,t,e){return new Promise(g=>{let i=A.asset.decodeText();if(void 0===t){const B=n(i);B&&(t=B,A.rotationCenterX=t[0],A.rotationCenterY=t[1])}if(e&&2===e){const t=s(Q(i,!0));if(i!==t){i=t;const e=B.storage;A.asset.encodeTextData(t,e.DataFormat.SVG,!0),A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat)}}A.skinId=B.renderer.createSVGSkin(i,t),A.size=B.renderer.getSkinSize(A.skinId),t||(t=B.renderer.getSkinRotationCenter(A.skinId),A.rotationCenterX=t[0],A.rotationCenterY=t[1],A.bitmapResolution=1),B.isPackaged&&(A.asset=null),g(A)})},c=new class{constructor(){this.pool=[],this.clearSoon=null}clear(){this.clearSoon||(this.clearSoon=new Promise(A=>setTimeout(A,1e3)).then(()=>{this.pool.length=0,this.clearSoon=null}))}create(){return this.pool.pop()||document.createElement("canvas")}release(A){this.clear(),this.pool.push(A)}},E=A=>new Promise((B,t)=>{const e=new Image;e.onload=function(){B(e),e.onload=null,e.onerror=null},e.onerror=function(){t(new Error("Costume load failed. Asset could not be read.")),e.onload=null,e.onerror=null},e.src=A}),o=new i(async A=>{let B;for(let t=0;t<3;t++)try{if("function"==typeof createImageBitmap){const B=await createImageBitmap(new Blob([A.data.buffer],{type:A.assetType.contentType}));if(!B)throw new Error("createImageBitmap resolved with ".concat(B));return B}return await E(A.encodeDataURI())}catch(A){B||(B=A),g.warn(A),await new Promise(A=>setTimeout(A,2e3*Math.random()))}throw B},25),w=function(A,B,t){return function(A,B,t){return A&&A.asset?B.v2BitmapAdapter?Promise.all([A.asset,A.textLayerAsset].map(A=>A?o.do(A):null)).then(e=>{let[g,i]=e;if(!g)throw new Error("Loading bitmap costume base failed.");const Q=1===A.bitmapResolution?2:1;let s,n;if(i){n=c.create(),n.width=g.width,n.height=g.height;const A=n.getContext("2d");A.drawImage(g,0,0),A.drawImage(i,0,0),s=n}else s=g;return 1!==Q&&(s=B.v2BitmapAdapter.resize(s,s.width*Q,s.height*Q),n&&c.release(n)),s.reusable=!1,t&&(t[0]=t[0]*Q,t[1]=t[1]*Q,A.rotationCenterX=t[0],A.rotationCenterY=t[1]),A.bitmapResolution=2,delete A.textLayerMD5,delete A.textLayerAsset,{image:s,rotationCenter:t,assetMatchesBase:1===Q&&!i}}).finally(()=>{delete A.textLayerMD5,delete A.textLayerAsset}):Promise.reject("No V2 Bitmap adapter present."):Promise.reject("Costume load failed. Assets were missing.")}(A,B,t).then(t=>(t.assetMatchesBase||function(t){if(!B.v2BitmapAdapter)return Promise.reject("No V2 Bitmap adapter present.");const e=B.storage;A.asset=e.createAsset(e.AssetType.ImageBitmap,e.DataFormat.PNG,B.v2BitmapAdapter.convertDataURIToBinary(t),null,!0),A.dataFormat=e.DataFormat.PNG,A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat)}((A=>{if(A instanceof HTMLCanvasElement)return A.toDataURL();const B=c.create();B.width=A.width,B.height=A.height;B.getContext("2d").drawImage(A,0,0);const t=B.toDataURL();return c.release(B),t})(t.image)),t)).then(t=>{let e,{image:g,rotationCenter:i}=t;i&&(e=[i[0]/2,i[1]/2]),A.skinId=B.renderer.createBitmapSkin(g,A.bitmapResolution,e);const Q=B.renderer.getSkinSize(A.skinId);return A.size=[2*Q[0],2*Q[1]],i||(i=B.renderer.getSkinRotationCenter(A.skinId),A.rotationCenterX=2*i[0],A.rotationCenterY=2*i[1],A.bitmapResolution=2),B.isPackaged&&(A.asset=null),A})},C=function(A,B){const t=A.asset,e=A.assetId,g=A.rotationCenterX,i=A.rotationCenterY,Q=A.bitmapResolution,s=A.dataFormat,n=B.storage.AssetType,c=A.dataFormat===n.ImageVector.runtimeFormat;A.assetId=c?B.storage.defaultAssetId.ImageVector:B.storage.defaultAssetId.ImageBitmap,A.asset=B.storage.get(A.assetId),A.md5="".concat(A.assetId,".").concat(A.asset.dataFormat);return(c?r(A,B):w(A,B)).then(A=>(A.broken={},A.broken.assetId=e,A.broken.md5="".concat(e,".").concat(s),A.broken.asset=t,A.broken.dataFormat=s,A.broken.rotationCenterX=g,A.broken.rotationCenterY=i,A.broken.bitmapResolution=Q,A))},a=function(A,B,t){A.assetId=A.asset.assetId;if(!B.renderer)return g.warn("No rendering module present; cannot load costume: ",A.name),Promise.resolve(A);const e=B.storage.AssetType;let i;return"number"!=typeof A.rotationCenterX||isNaN(A.rotationCenterX)||"number"!=typeof A.rotationCenterY||isNaN(A.rotationCenterY)||(i=[A.rotationCenterX,A.rotationCenterY]),A.asset.assetType.runtimeFormat===e.ImageVector.runtimeFormat?r(A,B,i,t).catch(t=>(g.warn("Error loading vector image: ".concat(t)),C(A,B))):w(A,B,i).catch(t=>(g.warn("Error loading bitmap image: ".concat(t)),C(A,B)))};A.exports={loadCostume:function(A,B,t,i){const Q=e.splitFirst(A,"."),s=Q[0],n=Q[1].toLowerCase();if(B.dataFormat=n,B.asset)return a(B,t,i);if(!t.storage)return g.warn("No storage module present; cannot load costume asset: ",A),Promise.resolve(B);if(!t.storage.defaultAssetId)return g.warn("No default assets found"),Promise.resolve(B);const r=t.storage.AssetType,c="svg"===n?r.ImageVector:r.ImageBitmap,E=t.storage.load(c,s,n);let o;return o=B.textLayerMD5?t.storage.load(r.ImageBitmap,B.textLayerMD5,"png"):Promise.resolve(null),Promise.all([E,o]).then(A=>A[0]?(B.asset=A[0],A[1]&&(B.textLayerAsset=A[1]),a(B,t,i)):C(B,t)).catch(A=>(g.warn("Error loading costume: ",A),C(B,t)))},loadCostumeFromAsset:a}},function(A,B,t){const e=t(7),g=t(0),i=function(A,B,t,e){return A.assetId=B.assetId,t.audioEngine?t.audioEngine.decodeSoundPlayer(Object.assign({},A,{data:B.data})).then(B=>{A.soundId=B.id;const g=B.buffer;return A.rate=g.sampleRate,A.sampleCount=g.length,null!==e&&e.addSoundPlayer(B),t.isPackaged&&(A.asset=null),A}):(g.warn("No audio engine present; cannot load sound asset: ",A.md5),Promise.resolve(A))},Q=function(A,B,t){const e=A.asset,g=A.assetId,Q=A.sampleCount,s=A.rate,n=A.format,r=A.dataFormat;return A.assetId=B.storage.defaultAssetId.Sound,A.asset=B.storage.get(A.assetId),A.md5="".concat(A.assetId,".").concat(A.asset.dataFormat),i(A,A.asset,B,t).then(A=>(A.broken={},A.broken.assetId=g,A.broken.md5="".concat(g,".").concat(r),A.broken.asset=e,A.broken.sampleCount=Q,A.broken.rate=s,A.broken.format=n,A.broken.dataFormat=r,A))};A.exports={loadSound:function(A,B,t){if(!B.storage)return g.warn("No storage module present; cannot load sound asset: ",A.md5),Promise.resolve(A);const s=e.splitFirst(A.md5,"."),n=s[0],r=s[1].toLowerCase();return A.dataFormat=r,(A.asset&&Promise.resolve(A.asset)||B.storage.load(B.storage.AssetType.Sound,n,r)).then(e=>(A.asset=e,e?i(A,e,B,t):(g.warn("Failed to find sound data: ",A.md5),Q(A,B,t)))).catch(e=>(g.warn("Failed to load sound: ".concat(A.md5," with error: ").concat(e)),Q(A,B,t)))},loadSoundFromAsset:i}},function(A,B,t){const e=t(16),g=t(87),i=t(8),Q=t(40),s=t(38),n=t(14),r=t(0),c=t(6),E=t(3),o=t(7),w=t(65),C=t(263),{loadCostume:a}=t(31),{loadSound:I}=t(32),{deserializeCostume:Y,deserializeSound:h}=t(88),M=Object.prototype.hasOwnProperty,F=["argument","colour","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],D=12,u=13,l={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:[D,"VARIABLE"],data_listcontents:[u,"LIST"]},d=function(A){const B=function(A){if(M.call(l,A.opcode)){const B=l[A.opcode],t=B[0],e=B[1],g=A.fields[e],i=[t,g.value];return"event_broadcast_menu"===A.opcode?i.push(g.id):"data_variable"!==A.opcode&&"data_listcontents"!==A.opcode||(i.push(g.id),A.topLevel&&(i.push(A.x?Math.round(A.x):0),i.push(A.y?Math.round(A.y):0))),i}return null}(A);if(B)return B;const t=Object.create(null);return t.opcode=A.opcode,t.next=A.next,t.parent=A.parent,t.inputs=function(A){const B=Object.create(null);for(const t in A)M.call(A,t)&&(A[t].block===A[t].shadow?B[t]=[1,A[t].block]:null===A[t].shadow?B[t]=[2,A[t].block]:B[t]=[3,A[t].block,A[t].shadow]);return B}(A.inputs),t.fields=function(A){const B=Object.create(null);for(const t in A)M.call(A,t)&&(B[t]=[A[t].value],A[t].hasOwnProperty("id")&&B[t].push(A[t].id));return B}(A.fields),t.shadow=A.shadow,A.topLevel?(t.topLevel=!0,t.x=A.x?Math.round(A.x):0,t.y=A.y?Math.round(A.y):0):t.topLevel=!1,A.mutation&&(t.mutation=A.mutation),A.comment&&(t.comment=A.comment),t},U=function(A,B){const t=A.inputs;for(const A in t){const e=t[A];for(let A=1;A"number"==typeof A||"string"==typeof A||"boolean"==typeof A,R=A=>{if(Array.isArray(A)){let B=null;for(let t=0;t=A.costumes.length)&&(r.warn("currentCostume property for target ".concat(A.name," is out of range")),A.currentCostume=E.clamp(A.currentCostume,0,A.costumes.length-1)),t.currentCostume=A.currentCostume,t.costumes=A.costumes.map(G),t.sounds=A.sounds.map(f),A.hasOwnProperty("volume")&&(t.volume=A.volume),A.hasOwnProperty("layerOrder")&&(t.layerOrder=A.layerOrder),t.isStage?(A.hasOwnProperty("tempo")&&(t.tempo=A.tempo),A.hasOwnProperty("videoTransparency")&&(t.videoTransparency=A.videoTransparency),A.hasOwnProperty("videoState")&&(t.videoState=A.videoState),A.hasOwnProperty("textToSpeechLanguage")&&(t.textToSpeechLanguage=A.textToSpeechLanguage)):(t.visible=A.visible,t.x=A.x,t.y=A.y,t.size=A.size,t.direction=A.direction,t.draggable=A.draggable,t.rotationStyle=A.rotationStyle),e.forEach(A=>{B.add(A)}),t},J=function(A){const B=A.map(A=>A.getLayerOrder());return E.reducedSortOrdering(B)},y=function(A,B){const t=(B.stageWidth-480)/2,e=(B.stageHeight-360)/2;return A.valueSeq().filter(A=>"tw_getLastKeyPressed"!==A.id).map(A=>{const B={id:A.id,mode:A.mode,opcode:A.opcode,params:A.params,spriteName:A.spriteName,value:Array.isArray(A.value)?[]:0,width:A.width,height:A.height,x:A.x-t,y:A.y-e,visible:A.visible};return"list"!==A.mode&&(B.sliderMin=A.sliderMin,B.sliderMax=A.sliderMax,B.isDiscrete=A.isDiscrete),B})},k=function(A,B,t,e){if(!Array.isArray(A))return A;const g=Object.create(null),Q=c();switch(g.id=Q,g.next=null,g.parent=B,g.shadow=t,g.inputs=Object.create(null),A[0]){case 4:g.opcode="math_number",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 5:g.opcode="math_positive_number",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 6:g.opcode="math_whole_number",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 7:g.opcode="math_integer",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 8:g.opcode="math_angle",g.fields={NUM:{name:"NUM",value:A[1]}},g.topLevel=!1;break;case 9:g.opcode="colour_picker",g.fields={COLOUR:{name:"COLOUR",value:A[1]}},g.topLevel=!1;break;case 10:g.opcode="text",g.fields={TEXT:{name:"TEXT",value:A[1]}},g.topLevel=!1;break;case 11:g.opcode="event_broadcast_menu",g.fields={BROADCAST_OPTION:{name:"BROADCAST_OPTION",value:A[1],id:A[2],variableType:i.BROADCAST_MESSAGE_TYPE}},g.topLevel=!1;break;case D:g.opcode="data_variable",g.fields={VARIABLE:{name:"VARIABLE",value:A[1],id:A[2],variableType:i.SCALAR_TYPE}},A.length>3&&(g.topLevel=!0,g.x=A[3],g.y=A[4]);break;case u:g.opcode="data_listcontents",g.fields={LIST:{name:"LIST",value:A[1],id:A[2],variableType:i.LIST_TYPE}},A.length>3&&(g.topLevel=!0,g.x=A[3],g.y=A[4]);break;default:return r.error("Found unknown primitive type during deserialization: ".concat(JSON.stringify(A))),null}return e[Q]=g,Q},T=function(A,B,t){const e={};for(const g in A){if(!M.call(A,g))continue;const i=A[g];if(!Array.isArray(i))continue;let Q=null,s=null;const n=i[0];1===n?Q=s=k(i[1],B,!0,t):2===n?Q=k(i[1],B,!1,t):(Q=k(i[1],B,!1,t),s=k(i[2],B,!0,t)),e[g]={name:g,block:Q,shadow:s}}return e},j=function(A){const B={};for(const t in A){if(!M.call(A,t))continue;const e=A[t];Array.isArray(e)&&(B[t]={name:t,value:e[0]},e.length>1&&(B[t].id=e[1]),"BROADCAST_OPTION"===t?B[t].variableType=i.BROADCAST_MESSAGE_TYPE:"VARIABLE"===t?B[t].variableType=i.SCALAR_TYPE:"LIST"===t&&(B[t].variableType=i.LIST_TYPE))}return B},x=function(A){for(const B in A){if(!Object.prototype.hasOwnProperty.call(A,B))continue;const t=A[B];Array.isArray(t)?(delete A[B],k(t,null,!1,A)):(t.id=B,t.inputs=T(t.inputs,B,A),t.fields=j(t.fields))}return A};A.exports={serialize:function(A,B){let{allowOptimization:t=!0}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const e=Object.create(null),g=new Set,i=B?[A.getTargetById(B)]:A.targets.filter(A=>A.isOriginal),Q=J(i),s=i.map(A=>A.toJSON());A.renderer&&!B&&s.forEach((A,B)=>{A.layerOrder=Q[B]});const n=s.map(A=>p(A,g));if(B)return n[0];e.targets=n,e.monitors=y(A.getMonitorState(),A),e.extensions=Array.from(g);const r=Object.create(null);return r.semver="3.0.0",r.vm="0.2.0",A.origin&&(r.origin=A.origin),r.agent="",e.meta=r,t&&C(e),e},deserialize:function(A,B,t,c){const C={extensionIDs:new Set,extensionURLs:new Map};A.meta&&A.meta.origin?B.origin=A.meta.origin:B.origin=null;const M=((c?[A]:A.targets)||[]).map((A,B)=>Object.assign(A,{targetPaneOrder:B})).sort((A,B)=>A.layerOrder-B.layerOrder),F=A.monitors||[];return Promise.resolve(M.map(A=>function(A,B,t){if(!A.hasOwnProperty("name"))return Promise.resolve(null);const e={costumePromises:null,soundPromises:null,soundBank:B.audioEngine&&B.audioEngine.createBank()};return e.costumePromises=(A.costumes||[]).map(A=>{const e={asset:A.asset,assetId:A.assetId,skinId:null,name:A.name,bitmapResolution:A.bitmapResolution,rotationCenterX:A.rotationCenterX,rotationCenterY:A.rotationCenterY},g=A.dataFormat||A.assetType&&A.assetType.runtimeFormat||"png",i=A.hasOwnProperty("md5ext")?A.md5ext:"".concat(A.assetId,".").concat(g);return e.md5=i,e.dataFormat=g,Y(e,B,t).then(()=>a(i,e,B))}),e.soundPromises=(A.sounds||[]).map(A=>{const g={assetId:A.assetId,format:A.format,rate:A.rate,sampleCount:A.sampleCount,name:A.name,md5:A.md5ext,dataFormat:A.dataFormat,data:null};return h(g,B,t).then(()=>I(g,B,e.soundBank))}),e}(A,B,t))).then(A=>Promise.resolve(A)).then(A=>Promise.all(M.map((t,s)=>function(A,B,t,s,r){if(!A.hasOwnProperty("name"))return Promise.resolve(null);const c=new e(B),o=new g(c,B);if(A.hasOwnProperty("name")&&(o.name=A.name),A.hasOwnProperty("blocks")){x(A.blocks);for(const B in A.blocks){if(!A.blocks.hasOwnProperty(B))continue;const e=A.blocks[B];c.createBlock(e);const g=N(e.opcode);g&&t.extensionIDs.add(g)}}const{costumePromises:w}=r,{soundBank:C,soundPromises:a}=r,I=o.createClone(A.isStage?n.BACKGROUND_LAYER:n.SPRITE_LAYER);if(A.hasOwnProperty("tempo")&&(I.tempo=A.tempo),A.hasOwnProperty("volume")&&(I.volume=A.volume),A.hasOwnProperty("videoTransparency")&&(I.videoTransparency=A.videoTransparency),A.hasOwnProperty("videoState")&&(I.videoState=A.videoState),A.hasOwnProperty("textToSpeechLanguage")&&(I.textToSpeechLanguage=A.textToSpeechLanguage),A.hasOwnProperty("variables"))for(const t in A.variables){const e=A.variables[t],g=3===e.length&&e[2]&&A.isStage&&B.canAddCloudVariable(),Q=new i(t,e[0],i.SCALAR_TYPE,g);g&&B.addCloudVariable(),Q.value=e[1],I.variables[Q.id]=Q}if(A.hasOwnProperty("lists"))for(const B in A.lists){const t=A.lists[B],e=new i(B,t[0],i.LIST_TYPE,!1);e.value=t[1],I.variables[e.id]=e}if(A.hasOwnProperty("broadcasts"))for(const B in A.broadcasts){const t=A.broadcasts[B],e=new i(B,t,i.BROADCAST_MESSAGE_TYPE,!1);I.variables[e.id]=e}if(A.hasOwnProperty("comments"))for(const B in A.comments){const t=A.comments[B],e=new Q(B,t.text,t.x,t.y,t.width,t.height,t.minimized);t.blockId&&(e.blockId=t.blockId),I.comments[e.id]=e}return A.hasOwnProperty("x")&&(I.x=A.x),A.hasOwnProperty("y")&&(I.y=A.y),A.hasOwnProperty("direction")&&(I.direction=A.direction),A.hasOwnProperty("size")&&(I.size=A.size),A.hasOwnProperty("visible")&&(I.visible=A.visible),A.hasOwnProperty("currentCostume")&&(I.currentCostume=E.clamp(A.currentCostume,0,A.costumes.length-1)),A.hasOwnProperty("rotationStyle")&&(I.rotationStyle=A.rotationStyle),A.hasOwnProperty("isStage")&&(I.isStage=A.isStage),A.hasOwnProperty("targetPaneOrder")&&(I.targetPaneOrder=A.targetPaneOrder),A.hasOwnProperty("draggable")&&(I.draggable=A.draggable),Promise.all(w).then(A=>{o.costumes=A}),Promise.all(a).then(A=>{o.sounds=A,o.soundBank=C||null}),Promise.all(w.concat(a)).then(()=>I)}(t,B,C,0,A[s])))).then(A=>A.map((A,B)=>(A.layerOrder=B,A)).sort((A,B)=>A.targetPaneOrder-B.targetPaneOrder).map(A=>(delete A.targetPaneOrder,A))).then(A=>function(A){const B=w.getAllVarRefsForTargets(A,!0);A.forEach(A=>{Object.keys(A.variables).forEach(B=>{const t=o.replaceUnsafeChars(B);t!==B&&(A.variables[B].id=t,A.variables[t]=A.variables[B],delete A.variables[B])})});for(const A in B){const t=o.replaceUnsafeChars(A);A!==t&&w.updateVariableIdentifiers(B[A],t)}return A}(A)).then(A=>(F.map(t=>function(A,B,t,e){const g=(B.stageWidth-480)/2,Q=(B.stageHeight-360)/2;if(A.x+=g,A.y+=Q,A.x=E.clamp(A.x,0,B.stageWidth),A.y=E.clamp(A.y,0,B.stageHeight),A.spriteName){const B=t.filter(B=>B.sprite.name===A.spriteName);B&&B.length>0?A.targetId=B[0].id:r.warn("Tried to deserialize sprite specific monitor ".concat(A.opcode," but could not find sprite ").concat(A.spriteName,"."))}const n=B.monitorBlockInfo[A.opcode];if("data_listcontents"===A.opcode){const B=A.targetId?t.find(B=>B.id===A.targetId):t.find(A=>A.isStage);B&&Object.prototype.hasOwnProperty.call(B.variables,A.id)&&(A.params.LIST=B.variables[A.id].name)}const c={};for(const B in A.params){const t={name:B,value:A.params[B]};c[B]=t}"data_variable"!==A.opcode&&"data_listcontents"!==A.opcode&&n&&n.isSpriteSpecific?A.id=n.getId(A.targetId,c):A.id=o.replaceUnsafeChars(A.id);const w=B.monitorBlocks._blocks[A.id];if(w)w.isMonitored=A.visible,w.targetId=A.targetId;else{const t={id:A.id,opcode:A.opcode,inputs:{},fields:c,topLevel:!0,next:null,parent:null,shadow:!1,x:0,y:0,isMonitored:A.visible,targetId:A.targetId};if("data_variable"===A.opcode){const B=t.fields.VARIABLE;B.id=A.id,B.variableType=i.SCALAR_TYPE}else if("data_listcontents"===A.opcode){const B=t.fields.LIST;B.id=A.id,B.variableType=i.LIST_TYPE}B.monitorBlocks.createBlock(t);const g=N(t.opcode);g&&e.extensionIDs.add(g)}B.requestAddMonitor(s(A))}(t,B,A,C)),A)).then(A=>({targets:A,extensions:C}))},deserializeBlocks:x,serializeBlocks:m,getExtensionIdForOpcode:N}},function(A,B,t){const e=t(9),g=t(35),i=t(273);A.exports=class{constructor(A,B){this._renderer=B,this._id=A,this._rotationCenter=e.v3.create(0,0),this._texture=null,this._uniforms={u_skinSize:[0,0],u_skin:null},this._silhouette=new i,this._textureOutOfDate=!1,this.private=!1}dispose(){this._id=g.ID_NONE}get id(){return this._id}get rotationCenter(){return this._rotationCenter}get size(){return[0,0]}useNearest(A,B){return!0}calculateRotationCenter(){return[this.size[0]/2,this.size[1]/2]}getTexture(A){return this._emptyImageTexture}getFenceBounds(A,B){return A.getAABB(B)}getUniforms(A){return this._uniforms.u_skin=this.getTexture(A),this._uniforms.u_skinSize=this.size,this._uniforms}emitWasAltered(){this._renderer.skinWasAltered(this)}updateSilhouette(){this._silhouette.unlazy()}_setTexture(A){this._textureOutOfDate=!0,this._silhouette.update(A)}prepareForGPU(){if(!this._textureOutOfDate)return;this._textureOutOfDate=!1;const A=this._silhouette._width,B=this._silhouette._height;if(0===A||0===B)return;const t=this._renderer.gl;t.bindTexture(t.TEXTURE_2D,this._texture),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);const e=this._silhouette.getRawTexture();ArrayBuffer.isView(e)?t.texImage2D(t.TEXTURE_2D,0,t.RGBA,A,B,0,t.RGBA,t.UNSIGNED_BYTE,e):t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1)}setEmptyImageData(){if(this._texture=null,this._textureOutOfDate=!1,!this._emptyImageData){this._emptyImageData=new ImageData(1,1);const A=this._renderer.gl,B={auto:!0,wrap:A.CLAMP_TO_EDGE,src:this._emptyImageData};this._emptyImageTexture=e.createTexture(A,B)}this._rotationCenter[0]=0,this._rotationCenter[1]=0,this._silhouette.update(this._emptyImageData),this.emitWasAltered()}isTouchingNearest(A){return this._silhouette.isTouchingNearest(A)}isTouchingLinear(A){return this._silhouette.isTouchingLinear(A)}}},function(A,B){A.exports={ID_NONE:-1,Events:{UseHighQualityRenderChanged:"UseHighQualityRenderChanged",AllowPrivateSkinAccessChanged:"AllowPrivateSkinAccessChanged",NativeSizeChanged:"NativeSizeChanged"}}},function(A,B,t){const e=t(22);e.enable(),A.exports=e("scratch-audioengine")},function(A,B){var t,e,g=A.exports={};function i(){throw new Error("setTimeout has not been defined")}function Q(){throw new Error("clearTimeout has not been defined")}function s(A){if(t===setTimeout)return setTimeout(A,0);if((t===i||!t)&&setTimeout)return t=setTimeout,setTimeout(A,0);try{return t(A,0)}catch(B){try{return t.call(null,A,0)}catch(B){return t.call(this,A,0)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:i}catch(A){t=i}try{e="function"==typeof clearTimeout?clearTimeout:Q}catch(A){e=Q}}();var n,r=[],c=!1,E=-1;function o(){c&&n&&(c=!1,n.length?r=n.concat(r):E=-1,r.length&&w())}function w(){if(!c){var A=s(o);c=!0;for(var B=r.length;B;){for(n=r,r=[];++E1)for(var t=1;t').concat(g(this.text),"")}static get MIN_WIDTH(){return 20}static get MIN_HEIGHT(){return 20}static get DEFAULT_WIDTH(){return 100}static get DEFAULT_HEIGHT(){return 100}}A.exports=i},function(A,B,t){const e=t(15);A.exports=class{constructor(A){this._maxTokens=A,this._refillInterval=1e3/A,this._count=this._maxTokens,this._timer=new e,this._timer.start(),this._lastUpdateTime=this._timer.timeElapsed()}okayToSend(){const A=this._timer.timeElapsed(),B=A-this._lastUpdateTime,t=Math.floor(B/this._refillInterval);return t>0&&(this._lastUpdateTime=A),this._count=Math.min(this._maxTokens,this._count+t),this._count>0&&(this._count--,!0)}}},function(A,B){class t{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:t.xlink,xlink:t.xmlns,xmlns:"".concat(t.xmlns,"/"),"xmlns:xlink":"".concat(t.xmlns,"/")}}static create(A,B,e){return t.set(document.createElementNS(t.svg,A),B,e)}static get(A,B){const e=t.attributeNamespace[B],g=e?A.getAttributeNS(e,B):A.getAttribute(B);return"null"===g?null:g}static set(A,B,e){for(const g in B){let i=B[g];const Q=t.attributeNamespace[g];"number"==typeof i&&e&&(i=e.number(i)),Q?A.setAttributeNS(Q,g,i):A.setAttribute(g,i)}return A}}A.exports=t},function(A,B){class t{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:t.xlink,xlink:t.xmlns,xmlns:"".concat(t.xmlns,"/"),"xmlns:xlink":"".concat(t.xmlns,"/")}}static create(A,B,e){return t.set(document.createElementNS(t.svg,A),B,e)}static get(A,B){const e=t.attributeNamespace[B],g=e?A.getAttributeNS(e,B):A.getAttribute(B);return"null"===g?null:g}static set(A,B,e){for(const g in B){let i=B[g];const Q=t.attributeNamespace[g];"number"==typeof i&&e&&(i=e.number(i)),Q?A.setAttributeNS(Q,g,i):A.setAttribute(g,i)}return A}}A.exports=t},function(A,B,t){"undefined"!=typeof TextDecoder&&"undefined"!=typeof TextEncoder||t(53);const e=t(19);let g=null;const i={},Q={},s="function"==typeof FinalizationRegistry?new FinalizationRegistry(A=>{const B=Q[A];1===B?(delete Q[A],delete i[A]):Q[A]=B-1}):null,n=s?A=>{const B=A.assetId,t=Q[B]||0;Q[B]=t+1,s.register(A,B)}:()=>{};A.exports=class{constructor(A,B,t,e,g){this.assetType=A,this.assetId=B,this.setData(e,t||A.runtimeFormat,g),this.dependencies=[],n(this)}setData(A,B,t){if(A&&!B)throw new Error("Data provided without specifying its format");this.dataFormat=B,this.data=A,t&&(this.assetId=e(A)),this.clean=!t}decodeText(){return(new TextDecoder).decode(this.data)}encodeTextData(A,B,t){const e=new TextEncoder;this.setData(e.encode(A),B,t)}encodeDataURI(A){return A=A||this.assetType.contentType,"data:".concat(A,";base64,").concat(((A,B)=>{if(!Object.prototype.hasOwnProperty.call(i,A))if("undefined"==typeof btoa){const e=t(299);i[A]=e.fromByteArray(B)}else{if(null===g){g=new Array(256);for(let A=0;A<256;A++)g[A]=String.fromCharCode(A)}const{length:t}=B;let e="";for(let A=0,i=0;A{if(A)return A===this||B(A.target)};if(B(A))throw new Error("Effect cannot connect to itself");this.target=A,null!==this.outputNode&&this.outputNode.disconnect(),(this._isPatch||this._lastPatch+this.audioEngine.DECAY_DURATION * {\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('+r+');\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[opcode^="motion_"] .sc-monitor-value-color {\n background-color: #4c97ff;\n}\n.sc-monitor-root[opcode^="sensing_"] .sc-monitor-value-color {\n background-color: #5cb1d6;\n}\n.sc-monitor-root[opcode^="data_"] .sc-monitor-value-color {\n background-color: #ff8c1a;\n}\n.sc-monitor-root[opcode^="looks_"] .sc-monitor-value-color {\n background-color: #9966ff;\n}\n.sc-monitor-root[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',""]),n.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"},B.a=n},function(A,B,t){"use strict";(function(A){!function(A){function B(){}function t(){}var e=String.fromCharCode,g={}.toString,i=g.call(A.SharedArrayBuffer),Q=g(),s=A.Uint8Array,n=s||Array,r=s?ArrayBuffer:n,c=r.isView||function(A){return A&&"length"in A},E=g.call(r.prototype);r=t.prototype;var o=A.TextEncoder,w=new(s?Uint16Array:n)(32);B.prototype.decode=function(A){if(!c(A)){var B=g.call(A);if(B!==E&&B!==i&&B!==Q)throw TypeError("Failed to execute 'decode' on 'TextDecoder': The provided value is not of type '(ArrayBuffer or ArrayBufferView)'");A=s?new n(A):A||[]}for(var t,r,o,C=B="",a=0,I=0|A.length,Y=I-32|0,h=0,M=0,F=0,D=-1;a>4){case 15:if(2!=(o=255&A[a=a+1|0])>>6||247>6?M+4|0:24,r=r+256&768;case 13:case 12:h<<=6,h|=(31&r)<<6|63&(o=255&A[a=a+1|0]),M=M+7|0,a>6&&h>>M&&1114112>h?(r=h,0<=(h=h-65536|0)&&(D=55296+(h>>10)|0,r=56320+(1023&h)|0,31>F?(w[F]=D,F=F+1|0,D=-1):(o=D,D=r,r=o))):(a=a-(r>>=8)-1|0,r=65533),h=M=0,t=a<=Y?32:I-a|0;default:w[F]=r;continue;case 11:case 10:case 9:case 8:}w[F]=65533}if(C+=e(w[0],w[1],w[2],w[3],w[4],w[5],w[6],w[7],w[8],w[9],w[10],w[11],w[12],w[13],w[14],w[15],w[16],w[17],w[18],w[19],w[20],w[21],w[22],w[23],w[24],w[25],w[26],w[27],w[28],w[29],w[30],w[31]),32>F&&(C=C.slice(0,F-32|0)),a>>31,D=-1,C.length=Q)e[g]=Q;else{if(2047>=Q)e[g]=192|Q>>6;else{A:{if(55296<=Q)if(56319>=Q){var r=0|A.charCodeAt(B=B+1|0);if(56320<=r&&57343>=r){if(65535<(Q=(Q<<10)+r-56613888|0)){e[g]=240|Q>>18,e[g=g+1|0]=128|Q>>12&63,e[g=g+1|0]=128|Q>>6&63,e[g=g+1|0]=128|63&Q;continue}break A}Q=65533}else 57343>=Q&&(Q=65533);!i&&B<<1>12,e[g=g+1|0]=128|Q>>6&63}e[g=g+1|0]=128|63&Q}}return s?e.subarray(0,g):e.slice(0,g)},o||(A.TextDecoder=B,A.TextEncoder=t)}(""+void 0==typeof A?""+void 0==typeof self?this:self:A)}).call(this,t(10))},function(A,B,t){const e=t(112),g=t(0);A.exports=new class extends e{constructor(){super(),this.services={},this.workerClass="undefined"==typeof Worker?null:Worker,this.workers=[]}callSync(A,B){const{provider:t,isRemote:e}=this._getServiceProvider(A);if(t){if(e)throw new Error("Cannot use 'callSync' on remote provider for service ".concat(A,"."));for(var g=arguments.length,i=new Array(g>2?g-2:0),Q=2;Q{g.error("Could not handshake with worker: ".concat(A))})):g.warn("Central dispatch ignoring attempt to add duplicate worker")}_getServiceProvider(A){const B=this.services[A];return B&&{provider:B,isRemote:Boolean(this.workerClass&&B instanceof this.workerClass||B.isRemote)}}_onDispatchMessage(A,B){let t;switch(B.method){case"setService":t=this.setService(B.args[0],A);break;default:g.error("Central dispatch received message for unknown method: ".concat(B.method))}return t}}},function(A,B){var t={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};A.exports=function(A,B){return B?"color: #fff; background: "+t[A]+";":"color: "+t[A]+";"}},function(A,B,t){const e=t(4);A.exports=function(A,B,t){return A&&A.id&&A.default?e(A,B,t):A}},function(A,B){var t="long",e="short",g="numeric";A.exports={number:{decimal:{style:"decimal"},integer:{style:"decimal",maximumFractionDigits:0},currency:{style:"currency",currency:"USD"},percent:{style:"percent"},default:{style:"decimal"}},date:{short:{month:g,day:g,year:"2-digit"},medium:{month:e,day:g,year:g},long:{month:t,day:g,year:g},full:{month:t,day:g,year:g,weekday:t},default:{month:e,day:g,year:g}},time:{short:{hour:g,minute:g},medium:{hour:g,minute:g,second:g},long:{hour:g,minute:g,second:g,timeZoneName:e},full:{hour:g,minute:g,second:g,timeZoneName:e},default:{hour:g,minute:g,second:g}},duration:{default:{hours:{minimumIntegerDigits:1,maximumFractionDigits:0},minutes:{minimumIntegerDigits:2,maximumFractionDigits:0},seconds:{minimumIntegerDigits:2,maximumFractionDigits:3}}},parseNumberPattern:function(A){if(A){var B={},t=A.match(/\b[A-Z]{3}\b/i),e=A.replace(/[^¤]/g,"").length;if(!e&&t&&(e=1),e?(B.style="currency",B.currencyDisplay=1===e?"symbol":2===e?"code":"name",B.currency=t?t[0].toUpperCase():"USD"):A.indexOf("%")>=0&&(B.style="percent"),!/[@#0]/.test(A))return B.style?B:void 0;if(B.useGrouping=A.indexOf(",")>=0,/E\+?[@#0]+/i.test(A)||A.indexOf("@")>=0){var g=A.replace(/E\+?[@#0]+|[^@#0]/gi,"");B.minimumSignificantDigits=Math.min(Math.max(g.replace(/[^@0]/g,"").length,1),21),B.maximumSignificantDigits=Math.min(Math.max(g.length,1),21)}else{for(var i=A.replace(/[^#0.]/g,"").split("."),Q=i[0],s=Q.length-1;"0"===Q[s];)--s;B.minimumIntegerDigits=Math.min(Math.max(Q.length-1-s,1),21);var n=i[1]||"";for(s=0;"0"===n[s];)++s;for(B.minimumFractionDigits=Math.min(Math.max(s,0),20);"#"===n[s];)++s;B.maximumFractionDigits=Math.min(Math.max(s,0),20)}return B}},parseDatePattern:function(A){if(A){for(var B={},i=0;iA.blocks.getAllVariableAndListReferences(null,B)).reduce(t._mergeVarRefObjects,{})}static updateVariableIdentifiers(A,B,t){A.map(A=>(A.referencingField.id=B,t&&(A.referencingField.value=t),A))}}A.exports=t},function(A,B){A.exports=class{constructor(){this._requestID=0,this._openRequests={}}sendRemoteRequest(A,B){const t=this._requestID++,e=new Promise((A,B)=>{this._openRequests[t]={resolve:A,reject:B}});return this._sendRequest(A,B,t),e}sendRemoteNotification(A,B){this._sendRequest(A,B)}didReceiveCall(){throw new Error("Must override didReceiveCall")}_sendMessage(){throw new Error("Must override _sendMessage")}_sendRequest(A,B,t){const e={jsonrpc:"2.0",method:A,params:B};null!==t&&(e.id=t),this._sendMessage(e)}_handleMessage(A){if("2.0"!==A.jsonrpc)throw new Error("Bad or missing JSON-RPC version in message: ".concat(A));A.hasOwnProperty("method")?this._handleRequest(A):this._handleResponse(A)}_sendResponse(A,B,t){const e={jsonrpc:"2.0",id:A};t?e.error=t:e.result=B||null,this._sendMessage(e)}_handleResponse(A){const{result:B,error:t,id:e}=A,g=this._openRequests[e];delete this._openRequests[e],g&&(t?g.reject(t):g.resolve(B))}_handleRequest(A){const{method:B,params:t,id:e}=A,g=this.didReceiveCall(B,t);e&&Promise.resolve(g).then(A=>{this._sendResponse(e,A)},A=>{this._sendResponse(e,null,A)})}}},function(A){A.exports=JSON.parse('{"menuMap":{"cs":[{"code":"cs","name":"čeština"}],"da":[{"code":"da","name":"Dansk"}],"gl":[{"code":"gl","name":"galego"}],"sl":[{"code":"sl","name":"slovenščina"}],"fr":[{"code":"fr","name":"Français"}],"hu":[{"code":"hu","name":"magyar"}],"uk":[{"code":"uk","name":"українська"}],"zh-tw":[{"code":"zh-tw","name":"中文(繁體)"}],"pt":[{"code":"pt","name":"Portuguese"}],"pt-br":[{"code":"pt","name":"Português"}],"tr":[{"code":"tr","name":"Türkçe"}],"ga":[{"code":"ga","name":"Gaeilge"}],"th":[{"code":"th","name":"ภาษาไทย"}],"ja":[{"code":"ja","name":"日本語"}],"ja-hira":[{"code":"ja","name":"日本語"}],"nl":[{"code":"nl","name":"Nederlands"}],"gd":[{"code":"gd","name":"Gàidhlig"}],"nb":[{"code":"nb","name":"norsk"}],"de":[{"code":"de","name":"Deutsch"}],"he":[{"code":"he","name":"עברית"}],"sk":[{"code":"sk","name":"slovenčina"}],"zu":[{"code":"zu","name":"isiZulu"}],"ru":[{"code":"ru","name":"русский"}],"pl":[{"code":"pl","name":"polski"}],"am":[{"code":"am","name":"አማርኛ"}],"az":[{"code":"az","name":"Azərbaycan dili"}],"hr":[{"code":"hr","name":"hrvatski"}],"fa":[{"code":"fa","name":"فارسی"}],"mi":[{"code":"mi","name":"Māori"}],"el":[{"code":"el","name":"Ελληνικά"}],"is":[{"code":"is","name":"íslenska"}],"fi":[{"code":"fi","name":"suomi"}],"eu":[{"code":"eu","name":"euskara"}],"ca":[{"code":"ca","name":"català"}],"lv":[{"code":"lv","name":"latviešu"}],"id":[{"code":"id","name":"Indonesia"}],"es":[{"code":"es","name":"español"}],"es-419":[{"code":"es","name":"español"}],"et":[{"code":"et","name":"eesti"}],"cy":[{"code":"cy","name":"Cymraeg"}],"zh-cn":[{"code":"zh-cn","name":"中文(简体)"}],"bg":[{"code":"bg","name":"български"}],"ar":[{"code":"ar","name":"العربية"}],"en":[{"code":"en","name":"English"}],"sr":[{"code":"sr","name":"српски"}],"sv":[{"code":"sv","name":"svenska"}],"ro":[{"code":"ro","name":"Română"}],"lt":[{"code":"lt","name":"lietuvių"}],"ko":[{"code":"ko","name":"한국어"}],"it":[{"code":"it","name":"Italiano"}],"vi":[{"code":"vi","name":"Tiếng Việt"}]},"nameMap":{"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","esperanto":"eo","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","latina":"la","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","zulu":"zu","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","galicisk":"gl","græsk":"el","haitisk kreolsk":"ht","hebraisk":"he","hindi":"hi","hollandsk":"nl","hviderussisk":"be","indonesisk":"id","irsk":"ga","islandsk":"is","italiensk":"it","japansk":"ja","kannada":"kn","katalansk":"ca","kinesisk (forenklet)":"zh-cn","kinesisk (traditionelt)":"zh-tw","koreansk":"ko","kroatisk":"hr","kurdisk":"ku","latin":"la","lettisk":"lv","litauisk":"lt","makedonsk":"mk","malajisk":"ms","malayalam":"ml","maltesisk":"mt","maori":"mi","marathi":"mr","mongolsk":"mn","norsk":"nb","persisk":"fa","polsk":"pl","portugisisk":"pt","rumænsk":"ro","russisk":"ru","serbisk":"sr","skotsk gælisk":"gd","slovakisk":"sk","slovensk":"sl","spansk":"es","svensk":"sv","telugu":"te","thailandsk":"th","tjekkisk":"cs","tyrkisk":"tr","tysk":"de","ukrainsk":"uk","ungarsk":"hu","usbekisk":"uz","vietnamesisk":"vi","walisisk":"cy","acerbaixano":"az","albanés":"sq","alemán":"de","amárico":"am","árabe":"ar","armenio":"hy","bielorruso":"be","birmano":"my","búlgaro":"bg","canarés":"kn","catalán":"ca","checo":"cs","chinés (simplificado)":"zh-cn","chinés (tradicional)":"zh-tw","coreano":"ko","crioulo haitiano":"ht","croata":"hr","curdo":"ku","dinamarqués":"da","eslovaco":"sk","esloveno":"sl","español":"es","estoniano":"et","éuscaro":"eu","finés":"fi","francés":"fr","gaélico escocés":"gd","galego":"gl","galés":"cy","grego":"el","hebreo":"he","húngaro":"hu","indonesio":"id","inglés":"en","irlandés":"ga","islandés":"is","italiano":"it","latín":"la","letón":"lv","lituano":"lt","macedonio":"mk","malabar":"ml","malaio":"ms","maltés":"mt","maorí":"mi","mongol":"mn","neerlandés":"nl","noruegués":"nb","persa":"fa","polaco":"pl","portugués":"pt","romanés":"ro","ruso":"ru","serbio":"sr","sueco":"sv","tailandés":"th","telugú":"te","turco":"tr","ucraíno":"uk","usbeco":"uz","vietnamita":"vi","xaponés":"ja","zulú":"zu","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":"ku","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","albanais":"sq","allemand":"de","amharique":"am","anglais":"en","arabe":"ar","arménien":"hy","azéri":"az","basque":"eu","biélorusse":"be","birman":"my","bulgare":"bg","catalan":"ca","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":"ku","letton":"lv","lituanien":"lt","macédonien":"mk","malaisien":"ms","maltais":"mt","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","albán":"sq","amhara":"am","angol":"en","arab":"ar","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":"ku","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","spanyol":"es","svéd":"sv","szerb":"sr","szlovák":"sk","szlovén":"sl","thai":"th","török":"tr","ukrán":"uk","üzbég":"uz","vietnami":"vi","walesi":"cy","азербайджанська":"az","албанська":"sq","амхарська":"am","англійська":"en","арабська":"ar","баскська":"eu","білоруська":"be","бірманська":"my","болгарська":"bg","в’єтнамська":"vi","валлійська":"cy","вірменська":"hy","гаїтянська креольська":"ht","гінді":"hi","грецька":"el","ґалісійська":"gl","данська":"da","есперанто":"eo","естонська":"et","зулу":"zu","іврит":"he","індонезійська":"id","ірландська":"ga","ісландська":"is","іспанська":"es","італійська":"it","каннада":"kn","каталанська":"ca","китайська (спрощена)":"zh-cn","китайська (традиційна)":"zh-tw","корейська":"ko","курдська":"ku","латинська":"la","латиська":"lv","литовська":"lt","македонська":"mk","малайська":"ms","малаялам":"ml","мальтійська":"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","土耳其文":"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","阿姆哈拉文":"am","阿拉伯文":"ar","阿爾巴尼亞文":"sq","俄文":"ru","保加利亞文":"bg","南非祖魯文":"zu","威爾斯文":"cy","英文":"en","庫德文":"ku","挪威文":"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","अझरबैजानी":"az","अम्हारिक":"am","अरबी":"ar","अर्मेनियन":"hy","अल्बानियन":"sq","आइसलँडिक":"is","आयरिश":"ga","इंग्रजी":"en","इंडोनेशियन":"id","इटालियन":"it","उझ्बेक":"uz","एस्टोनियन":"et","एस्परँटो":"eo","कन्नड":"kn","कुर्दिश (कुर्मांजी)":"ku","कॅटलान":"ca","कोरियन":"ko","क्रोएशियन":"hr","गॅलिशियन":"gl","ग्रीक":"el","चीनी (पारंपारिक)":"zh-tw","चीनी (सरलीकृत)":"zh-cn","जपानी":"ja","जर्मन":"de","झुलु":"zu","झेक":"cs","डच":"nl","डॅनिश":"da","तुर्की":"tr","तेलगू":"te","थाई":"th","नॉर्वेजियन":"nb","पोर्तुगीज":"pt","पोलिश":"pl","फारसी":"fa","फिन्निश":"fi","फ्रेंच":"fr","बल्गेरियन":"bg","बास्क":"eu","बेलारुशियन":"be","मंगोलियन":"mn","मराठी":"mr","मलय":"ms","मल्याळम":"ml","माओरी":"mi","माल्टीज":"mt","मॅसेडोनियन":"mk","म्यानमार (बर्मीज)":"my","युक्रेनियन":"uk","रशियन":"ru","रोमानियन":"ro","लाट्वियन":"lv","लिथुआनियन":"lt","लॅटिन":"la","वेल्श":"cy","व्हिएतनामी":"vi","सर्बियन":"sr","स्कॉट्स गेलिक":"gd","स्पॅनिश":"es","स्लोव्हाक":"sk","स्लोव्हेनियन":"sl","स्वीडिश":"sv","हंगेरियन":"hu","हिन्दी":"hi","हिब्रू":"he","हैतीयन क्रेओल":"ht","albanian":"sq","amharic":"am","arabic":"ar","armenian":"hy","azerbaijani":"az","belarusian":"be","bulgarian":"bg","chinese (simplified)":"zh-cn","chinese (traditional)":"zh-tw","croatian":"hr","czech":"cs","danish":"da","dutch":"nl","english":"en","estonian":"et","finnish":"fi","french":"fr","galician":"gl","german":"de","greek":"el","haitian creole":"ht","hebrew":"he","hungarian":"hu","icelandic":"is","indonesian":"id","irish":"ga","italian":"it","japanese":"ja","korean":"ko","kurdish (kurmanji)":"ku","latvian":"lv","lithuanian":"lt","macedonian":"mk","malay":"ms","maltese":"mt","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","turkish":"tr","ukrainian":"uk","uzbek":"uz","vietnamese":"vi","welsh":"cy","albanês":"sq","alemão":"de","armênio":"hy","azerbaijano":"az","basco":"eu","bielo-russo":"be","birmanês":"my","canarês":"kn","catalão":"ca","chinês (simplificado)":"zh-cn","chinês (tradicional)":"zh-tw","dinamarquês":"da","espanhol":"es","finlandês":"fi","francês":"fr","gaélico escocês":"gd","galês":"cy","hebraico":"he","holandês":"nl","indonésio":"id","inglês":"en","irlandês":"ga","islandês":"is","japonês":"ja","latim":"la","letão":"lv","macedônio":"mk","malaiala":"ml","maltês":"mt","marata":"mr","norueguês":"nb","polonês":"pl","português":"pt","romeno":"ro","russo":"ru","sérvio":"sr","tailandês":"th","tcheco":"cs","telugo":"te","ucraniano":"uk","uzbeque":"uz","almanca":"de","arapça":"ar","arnavutça":"sq","azerice":"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","endonezya dili":"id","ermenice":"hy","esperantoca":"eo","estonyaca":"et","farsça":"fa","felemenkçe":"nl","fince":"fi","fransızca":"fr","galce":"cy","galiçyaca":"gl","habeşçe":"am","haiti creole dili":"ht","hırvatça":"hr","hintçe":"hi","i̇branice":"he","i̇ngilizce":"en","i̇rlandaca":"ga","i̇spanyolca":"es","i̇sveççe":"sv","i̇talyanca":"it","i̇zlandaca":"is","japonca":"ja","katalanca":"ca","korece":"ko","kuzey i̇skoç dili":"gd","kürtçe":"ku","latince":"la","lehçe":"pl","letonca":"lv","litvanca":"lt","macarca":"hu","makedonca":"mk","malezya dili":"ms","malta dili":"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","tay dili":"th","telugu dili":"te","türkçe":"tr","ukraynaca":"uk","vietnamca":"vi","yunanca":"el","airméinis":"hy","albáinis":"sq","amárais":"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","cóiréis":"ko","criól háítí":"ht","cróitis":"hr","danmhairgis":"da","eabhrais":"he","eastóinis":"et","fionlainnis":"fi","fraincis":"fr","gaeilge":"ga","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","peirsis":"fa","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","ภาษากรีก":"el","ภาษากันนาดา":"kn","ภาษากาลิเชียน":"gl","ภาษาเกลิกในสก็อต":"gd","ภาษาเกาหลี":"ko","ภาษาคาตาลัน":"ca","ภาษาเคิร์ด":"ku","ภาษาโครเอเชีย":"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","ภาษาอัมฮาริก":"am","ภาษาอัลบาเนีย":"sq","ภาษาอาร์เซอร์ไบจัน":"az","ภาษาอาร์เมเนีย":"hy","ภาษาอาหรับ":"ar","ภาษาอิตาลี":"it","ภาษาอินโดนีเซีย":"id","ภาษาอุสเบกิสถาน":"uz","ภาษาเอสโทเนีย":"et","ภาษาเอสเปอแรนโต":"eo","ภาษาไอซ์แลนดิก":"is","ภาษาไอริช":"ga","ภาษาฮังการี":"hu","ภาษาฮินดี":"hi","ภาษาฮิบรู":"he","ภาษาเฮติครีโอล":"ht","アイスランド語":"is","アイルランド語":"ga","アゼルバイジャン語":"az","アムハラ語":"am","アラビア語":"ar","アルバニア語":"sq","アルメニア語":"hy","イタリア語":"it","インドネシア語":"id","ウェールズ語":"cy","ウクライナ語":"uk","ウズベク語":"uz","エストニア語":"et","エスペラント語":"eo","オランダ語":"nl","カタルーニャ語":"ca","ガリシア語":"gl","カンナダ語":"kn","ギリシャ語":"el","クルド語":"ku","クロアチア語":"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","albanees":"sq","amharisch":"am","arabisch":"ar","armeens":"hy","azerbeidzjaans":"az","baskisch":"eu","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":"ku","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 keltisch":"gd","servisch":"sr","slovaaks":"sk","sloveens":"sl","spaans":"es","tsjechisch":"cs","turks":"tr","vietnamees":"vi","wels":"cy","wit-russisch":"be","zoeloe":"zu","zweeds":"sv","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","duitsis":"nl","eabhra":"he","eadailtis":"it","eastoinis":"et","fionnlannais":"fi","fraingis":"fr","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","māori":"mi","masadonais":"mk","miànmar (burmais)":"my","mongolais":"mn","nirribhis":"nb","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","farsi":"fa","galisisk":"gl","gresk":"el","hviterussisk":"be","kinesisk (tradisjonell)":"zh-tw","kreol (haiti)":"ht","latvisk":"lv","malayisk":"ms","nederlandsk":"nl","rumensk":"ro","tsjekkisk":"cs","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","lateinisch":"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","weißrussisch":"be","ကနာဒါ":"kn","ကာ့ဒ် (ကာမန်ဂျီ)":"ku","ကိုရီးယား":"ko","ကက်တလန်":"ca","ခရိုအေးရှား":"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","ဘာ့စ်":"eu","ဘူဂေးရီးယား":"bg","ဘယ်လာရုစ်":"be","မလေယာလမ်":"ml","မလေး":"ms","မာရာသီ":"mr","မော်ရီ":"mi","မော်လတာ":"mt","မက်ဆီဒိုးနီးယား":"mk","မြန်မာ (မြန်မာ)":"my","မွန်ဂိုလီးယား":"mn","ယူ​က​ရိန်း​":"uk","ရုရှား":"ru","ရိုမေးနီးယား":"ro","လက်တင်":"la","လစ်သူယေးနီးယား":"lt","လတ်ဗီယာ":"lv","ဝေလ":"cy","ဟီဘရူး":"he","ဟေတီ ခရီအိုး":"ht","ဟင်ဒီ":"hi","ဟန်ဂေရီ":"hu","အဇာဘိုင်ဂျန်":"az","အာမေးနီးယား":"hy","အာရေဗျ":"ar","အီတလီ":"it","ဥဇဘက်":"uz","အက်စတိုးနီးယား":"et","အက်စ်ပဲရန်တို":"eo","အိုက်စလန်":"is","အင်္ဂလိပ်":"en","အင်ဒိုနီးရှား":"id","အိုင်းရစ်ရှ်":"ga","အမ်ဟဲရစ်ခ်":"am","အယ်လ်ဘေးနီးယား":"sq","אוזבקית":"uz","אוקראינית":"uk","אזרית":"az","איטלקית":"it","אינדונזית":"id","איסלנדית":"is","אירית":"ga","אלבנית":"sq","אמהרית":"am","אנגלית":"en","אסטונית":"et","אספרנטו":"eo","ארמנית":"hy","באסקית":"eu","בולגרית":"bg","בורמזית":"my","בלארוסית":"be","גליציאנית":"gl","גרמנית":"de","דנית":"da","הולנדית":"nl","הונגרית":"hu","הינדי":"hi","וולשית":"cy","וייטנאמית":"vi","זולו":"zu","טורקית":"tr","טלוגו":"te","יוונית":"el","יפנית":"ja","כורדית":"ku","לטווית":"lv","לטינית":"la","ליטאית":"lt","מאורית":"mi","מאלאיאלם":"ml","מאלזית":"ms","מאראתי":"mr","מונגולית":"mn","מלטית":"mt","מקדונית":"mk","נורווגית":"nb","סינית (מסורתית)":"zh-tw","סינית (פשוטה)":"zh-cn","סלובנית":"sl","סלובקית":"sk","ספרדית":"es","סקוטית גאלית":"gd","סרבית":"sr","עברית":"he","ערבית":"ar","פולנית":"pl","פורטוגזית":"pt","פינית":"fi","פרסית":"fa","צ\'כית":"cs","צרפתית":"fr","קאנאדה":"kn","קוריאנית":"ko","קטלאנית":"ca","קרואטית":"hr","קריאולית האיטית":"ht","רומנית":"ro","רוסית":"ru","שוודית":"sv","תאילנדית":"th","азербејџански":"az","албански":"sq","амхарски":"am","англиски":"en","арапски":"ar","баскиски":"eu","белоруски":"be","бугарски":"bg","бурмански":"my","велшки":"cy","виетнамски":"vi","галициски":"gl","германски":"de","грчки":"el","дански":"da","ерменски":"hy","естонски":"et","индонезиски":"id","ирски":"ga","исландски":"is","италијански":"it","јапонски":"ja","канада":"kn","каталонски":"ca","кинески (поедноставен)":"zh-cn","кинески (традиционален)":"zh-tw","корејски":"ko","курдски":"ku","латвиски":"lv","латински":"la","литвански":"lt","македонски":"mk","малајалам":"ml","малајски":"ms","малтешки":"mt","маорски":"mi","маратхи":"mr","монголски":"mn","норвешки":"nb","персиски":"fa","полски":"pl","португалски":"pt","романски":"ro","руски":"ru","словачки":"sk","словенечки":"sl","српски":"sr","тајландски":"th","телугу":"te","турски":"tr","узбечки":"uz","украински":"uk","унгарски":"hu","фински":"fi","француски":"fr","хаитски креолски":"ht","хебрејски":"he","хиндиски":"hi","холандски":"nl","хрватски":"hr","чешки":"cs","шведски":"sv","шкотски галски":"gd","шпански":"es","ಅಜರ್ಬೈಜಾನಿ":"az","ಅಮಹಾರಿಕ್":"am","ಅರಬ್ಬಿ":"ar","ಆರ್ಮೇನಿಯನ್":"hy","ಆಲ್ಬೇನಿಯನ್":"sq","ಇಂಗ್ಲಿಷ್‌‌":"en","ಇಂಡೋನೇಷಿಯನ್":"id","ಇಟಾಲಿಯನ್":"it","ಉಜ್ಬೆಕ್":"uz","ಎಸ್ಟೋನಿಯನ್":"et","ಎಸ್ಪೆರಾಂಟೋ":"eo","ಐರಿಷ್":"ga","ಐಸ್‌ಲ್ಯಾಂಡಿಕ್‌":"is","ಕನ್ನಡ":"kn","ಕುರ್ದಿಶ್":"ku","ಕೊರಿಯನ್":"ko","ಕ್ಯಾಟಲನ್":"ca","ಕ್ರೊಯೇಷಿಯನ್":"hr","ಗ್ಯಾಲೀಷಿಯನ್":"gl","ಗ್ರೀಕ್":"el","ಚೀನಿ (ಸರಳೀಕೃತ)":"zh-cn","ಚೀನಿ (ಸಾಂಪ್ರದಾಯಿಕ)":"zh-tw","ಜಪಾನಿ":"ja","ಜರ್ಮನ್":"de","ಜುಲು":"zu","ಝೆಕ್‌":"cs","ಟರ್ಕಿಷ್":"tr","ಡಚ್":"nl","ಡ್ಯಾನಿಷ್":"da","ತೆಲುಗು":"te","ಥಾಯ್":"th","ನಾರ್ವೇಜಿಯನ್‌":"nb","ಪೋರ್ಚುಗೀಸ್":"pt","ಪೋಲಿಷ್":"pl","ಫಾರ್ಸಿ":"fa","ಫಿನ್ನಿಷ್":"fi","ಫ್ರೆಂಚ್":"fr","ಬರ್ಮೀಸ್":"my","ಬಲ್ಗೇರಿಯನ್":"bg","ಬಾಸ್ಕ್":"eu","ಬೆಲರೂಸಿಯನ್":"be","ಮಂಗೋಲಿಯನ್":"mn","ಮರಾಠಿ":"mr","ಮಲಯ":"ms","ಮಲಯಾಳಂ":"ml","ಮಾಲ್ಟೀಸ್":"mt","ಮಾವೋರಿ":"mi","ಮ್ಯಾಸೆಡೋನಿಯನ್":"mk","ಯುಕ್ರೇನಿಯನ್":"uk","ರಷಿಯನ್":"ru","ರೊಮೇನಿಯನ್":"ro","ಲಿಥುವೇನಿಯನ್":"lt","ಲ್ಯಾಟಿನ್":"la","ಲ್ಯಾಟ್ವಿಯನ್‌":"lv","ವಿಯೆಟ್ನಾಮಿ":"vi","ವೆಲ್ಶ್":"cy","ಸರ್ಬಿಯನ್":"sr","ಸ್ಕಾಟ್ಸ್ ಗ್ಯಾಲಿಕ್":"gd","ಸ್ಪ್ಯಾನಿಷ್":"es","ಸ್ಲೊವಾಕ್":"sk","ಸ್ಲೊವೆನಿಯನ್":"sl","ಸ್ವೀಡಿಷ್":"sv","ಹಂಗೇರಿಯನ್":"hu","ಹಯಥಿಯನ್‌ ಕ್ರಿಯೋಲ್‌":"ht","ಹಿಂದಿ":"hi","ಹೀಬ್ರೂ":"he","അമാറിക്":"am","അർമേനിയൻ":"hy","അൽബേനിയൻ":"sq","അസർബൈജാനി":"az","അറബിക്":"ar","ഇന്തോനേഷ്യൻ":"id","ഇംഗ്ലീഷ്":"en","ഇറ്റാലിയൻ":"it","ഉക്രേനിയൻ":"uk","ഉസ്ബെക്ക്":"uz","എസ്‌പെരന്തോ":"eo","എസ്റ്റോണിയൻ":"et","ഐസ്‌ലാൻഡിക്":"is","ഐറിഷ്":"ga","കന്നട":"kn","കാറ്റലൻ":"ca","കുർദ്ദിഷ്":"ku","കൊറിയൻ":"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","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":"ku","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","isi-albania":"sq","isi-amharic":"am","isi-arabic":"ar","isi-armenian":"hy","isi-azerbaijani":"az","isi-basque":"eu","isi-belarusian":"be","isi-bulgarian":"bg","isi-burmese":"my","isi-catalan":"ca","isi-chinese (simplified)":"zh-cn","isi-chinese (traditional)":"zh-tw","isi-croatian":"hr","isi-czech":"cs","isi-danish":"da","isi-dutch":"nl","isi-english":"en","isi-esperanto":"eo","isi-estonian":"et","isi-finnish":"fi","isi-french":"fr","isi-galician":"gl","isi-german":"de","isi-greek":"el","isi-haitian creole":"ht","isi-hangarian":"hu","isi-hebrew":"he","isi-hindi":"hi","isi-icelandic":"is","isi-indonesian":"id","isi-irish":"ga","isi-italian":"it","isi-japanese":"ja","isi-kannada":"kn","isi-korean":"ko","isi-kurdish":"ku","isi-latin":"la","isi-latvian":"lv","isi-lithuanian":"lt","isi-macedonian":"mk","isi-malay":"ms","isi-malayalam":"ml","isi-maltese":"mt","isi-maori":"mi","isi-marathi":"mr","isi-mongolian":"mn","isi-norwegian":"nb","isi-persian":"fa","isi-polish":"pl","isi-portuguese":"pt","isi-romanian":"ro","isi-russian":"ru","isi-scots gaelic":"gd","isi-serbian":"sr","isi-slovak":"sk","isi-slovenian":"sl","isi-spanish":"es","isi-swedish":"sv","isi-telugu":"te","isi-thai":"th","isi-turkish":"tr","isi-ukrainian":"uk","isi-uzbek":"uz","isi-vietnamese":"vi","isi-welsh":"cy","isizulu":"zu","albania":"sq","armenia":"hy","azerbaijan":"az","belanda":"nl","belarus":"be","bulgaria":"bg","cina (mudah)":"zh-cn","cina (tradisional)":"zh-tw","croatia":"hr","denmark":"da","estonia":"et","finland":"fi","gaelic scotland":"gd","galicia":"gl","hungary":"hu","ibrani":"he","iceland":"is","indonesia":"id","inggeris":"en","ireland":"ga","itali":"it","jepun":"ja","jerman":"de","korea":"ko","kreol haiti":"ht","kurdistan":"ku","latvia":"lv","lithuania":"lt","macedonia":"mk","malta":"mt","melayu":"ms","mongolia":"mn","myanmar":"my","norway":"nb","parsi":"fa","perancis":"fr","poland":"pl","portugis":"pt","romania":"ro","rusia":"ru","sepanyol":"es","serbia":"sr","slovenia":"sl","sweden":"sv","turki":"tr","ukraine":"uk","vietnam":"vi","wales":"cy","азербайджанский":"az","албанский":"sq","амхарский":"am","английский":"en","арабский":"ar","армянский":"hy","баскский":"eu","белорусский":"be","бирманский":"my","болгарский":"bg","валлийский":"cy","венгерский":"hu","вьетнамский":"vi","галисийский":"gl","греческий":"el","датский":"da","иврит":"he","индонезийский":"id","ирландский":"ga","исландский":"is","испанский":"es","итальянский":"it","каталанский":"ca","китайский (традиционный)":"zh-tw","китайский (упрощенный)":"zh-cn","корейский":"ko","креольский (гаити)":"ht","курманджи":"ku","латинский":"la","латышский":"lv","литовский":"lt","македонский":"mk","малайский":"ms","мальтийский":"mt","маори":"mi","монгольский":"mn","немецкий":"de","нидерландский":"nl","норвежский":"nb","персидский":"fa","польский":"pl","португальский":"pt","румынский":"ro","русский":"ru","сербский":"sr","словацкий":"sk","словенский":"sl","тайский":"th","турецкий":"tr","узбекский":"uz","украинский":"uk","финский":"fi","французский":"fr","хинди":"hi","хорватский":"hr","чешский":"cs","шведский":"sv","шотландский (гэльский)":"gd","эсперанто":"eo","эстонский":"et","японский":"ja","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":"ku","litewski":"lt","łaciński":"la","łotewski":"lv","macedoński":"mk","malajalam":"ml","malajski":"ms","maltański":"mt","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","азербайджанская":"az","албанская":"sq","амхарская":"am","англійская":"en","арабская":"ar","армянская":"hy","балгарская":"bg","баскская":"eu","беларуская":"be","в\'етнамская":"vi","валійская":"cy","венгерская":"hu","гаіцянская крэольская":"ht","галандская":"nl","галісійская":"gl","грэчаская":"el","дацкая":"da","інданезійская":"id","ірландская":"ga","ісландская":"is","іспанская":"es","італьянская":"it","іўрыт":"he","карэйская":"ko","каталонская":"ca","кітайская (спрошчаная)":"zh-cn","кітайская (традыцыйная)":"zh-tw","курдская (курманджы)":"ku","латышская":"lv","лацінская":"la","літоўская":"lt","м\'янманская (бірманская)":"my","маары":"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","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","kanada":"kn","katalonisht":"ca","kinezisht (e thjeshtuar)":"zh-cn","kinezisht (tradicionale)":"zh-tw","koreanisht":"ko","kreolishte haitiane":"ht","kroatisht":"hr","latinisht":"la","letonisht":"lv","lituanisht":"lt","malajalamisht":"ml","malajzisht":"ms","malteze":"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","ሀንጋሪኛ":"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","አዜርባይጃንኛ":"az","አይሪሽ":"ga","አይስላንድኛ":"is","ኡዝቤክኛ":"uz","ኤስቶኒያኛ":"et","ኤስፐራንቶ":"eo","እንዶኔዢያኛ":"id","እንግሊዝኛ":"en","ኩርድሽኛ":"ku","ካታላንኛ":"ca","ካናዳኛ":"kn","ክሮኤሽያኛ":"hr","ኮሪያኛ":"ko","ዌልሽ":"cy","ዐረብኛ":"ar","ዕብራይስጥ":"he","ዙሉኛ":"zu","የሃይቲ ክረኦሌኛ":"ht","የስኮት ጌልክኛ":"gd","ዩክሬንኛ":"uk","ደችኛ":"nl","ዴንሽኛ":"da","ጀርመንኛ":"de","ጃፓንኛ":"ja","ጋሊሺያኛ":"gl","ግሪክኛ":"el","ጣሊያንኛ":"it","ፈረንሳይኛ":"fr","ፊኒሽኛ":"fi","ፐርሺያኛ":"fa","ፖሊሽኛ":"pl","ፖርቱጋሊኛ":"pt","alban":"sq","alman":"de","amarikcə":"am","azərbaycan dili":"az","bask":"eu","belarusca":"be","bolqar":"bg","çex":"cs","çin (ən\'ənəvi)":"zh-tw","çin (sadələşdirilmiş)":"zh-cn","danimarka":"da","erməni":"hy","eston":"et","ərəb":"ar","fars dili":"fa","fin":"fi","fransız":"fr","haiti kreol dili":"ht","hind":"hi","xorvat":"hr","ispan":"es","i̇ndoneziya":"id","i̇ngilis":"en","i̇rland":"ga","i̇sland":"is","i̇sveç":"sv","i̇talyan":"it","i̇vrit":"he","katalan":"ca","koreya":"ko","kürd dili (kurmanci)":"ku","qalisian":"gl","latın":"la","latış":"lv","litva":"lt","macar":"hu","makedoniya":"mk","maoricə":"mi","monqolca":"mn","myanma (birma) dili":"my","norveç":"nb","özbək":"uz","polyak":"pl","portuqal":"pt","rumın":"ro","rus":"ru","serb":"sr","sloven":"sl","şotland (kelt)":"gd","tayca":"th","teluqu":"te","türk":"tr","uels":"cy","ukrayna":"uk","vyetnam":"vi","yapon":"ja","yunan":"el","zulu dili":"zu","albaniż":"sq","amħari":"am","armen":"hy","ażerbajġani":"az","belarussu":"be","bulgaru":"bg","ċek":"cs","ċiniż (semplifikat)":"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","kurd (kurmanji)":"ku","latvjan":"lv","litwen":"lt","maċedonjan":"mk","malasjan":"ms","malti":"mt","marati":"mr","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","albanski":"sq","amharik":"am","arapski":"ar","armenijski":"hy","azerbajdžanski":"az","bjeloruski":"be","bugarski":"bg","burmanski":"my","češki":"cs","danski":"da","engleski":"en","estonski":"et","finski":"fi","galski":"gl","grčki":"el","haićansko-kreolski":"ht","hebrejski":"he","hindu":"hi","hrvatski":"hr","indonezijski":"id","irski":"ga","islandski":"is","japanski":"ja","katalonski":"ca","kineski (pojednost.)":"zh-cn","kineski (tradicionalni)":"zh-tw","korejski":"ko","kurdski":"ku","latinski":"la","latvijski/letonski":"lv","litvanski":"lt","mađarski":"hu","makedonski":"mk","malezijski":"ms","malteški":"mt","nizozemski":"nl","norveški":"nb","njemački":"de","perzijski":"fa","poljski":"pl","rumunjski":"ro","ruski":"ru","slovački":"sk","slovenski":"sl","srpski":"sr","škotski keltski":"gd","španjolski":"es","švedski":"sv","tajlandski":"th","talijanski":"it","turski":"tr","ukrajinski":"uk","uzbekistanski":"uz","velški":"cy","vijetnamski":"vi","آذرباﻳﺠﺎﻧﻰ":"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","کانارا":"kn","کرئول هائیتی":"ht","کردی":"ku","کرواتی":"hr","کره‌ای":"ko","گالیسی":"gl","گاليک اسکاتلندی":"gd","لاتين":"la","لتونيايی":"lv","لهستانی":"pl","ليتوانيايی":"lt","مائوری":"mi","مالایالمی":"ml","مالايی":"ms","مالتی":"mt","مجاری":"hu","مراتی":"mr","مغولی":"mn","مقدونيه‌ای":"mk","نروژی":"nb","ولزی":"cy","ويتنامی":"vi","هلندی":"nl","هندی":"hi","يونانی":"el","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":"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","tai":"th","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","αγγλικά":"en","αζερμπαϊτζανικά":"az","αλβανικά":"sq","αμχαρικά":"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","κρεόλ αϊτής":"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","amxar":"am","arman":"hy","bolgar":"bg","dat":"da","fors":"fa","fransuz":"fr","gaiti-kreol":"ht","galisiy":"gl","golland":"nl","grek":"el","ibroniy":"he","indonez":"id","ingliz":"en","irland":"ga","island":"is","italyan":"it","koreys":"ko","kurd (kurmonji)":"ku","latish":"lv","lotin":"la","makedon":"mk","maltiy":"mt","maratxi":"mr","mo‘g‘ul":"mn","nemis":"de","norveg":"nb","ozarbayjon":"az","portugal":"pt","rumin":"ro","tay":"th","turk":"tr","ukrain":"uk","valliy":"cy","venger":"hu","xitoy (an’anaviy)":"zh-tw","xitoy (soddalashgan)":"zh-cn","o‘zbek":"uz","shotland-gel":"gd","shved":"sv","chex":"cs","albanska":"sq","amharísku":"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":"ku","latína":"la","lettneska":"lv","litháíska":"lt","makedónska":"mk","malajíska":"ms","maltneska":"mt","maoríska":"mi","maratí":"mr","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","ադրբեջաներեն":"az","ալբաներեն":"sq","ամհարերեն":"am","անգլերեն":"en","արաբերեն":"ar","բասկերեն":"eu","բելառուսերեն":"be","բիրմաներեն":"my","բուլղարերեն":"bg","գալիսերեն":"gl","գերմաներեն":"de","դանիերեն":"da","եբրայերեն":"he","զուլուսերեն":"zu","էսպերանտո":"eo","էստոներեն":"et","թայերեն":"th","թուրքերեն":"tr","ինդոնեզերեն":"id","իռլանդերեն":"ga","իսլանդերեն":"is","իսպաներեն":"es","իտալերեն":"it","լատիներեն":"la","լատվիերեն":"lv","լեհերեն":"pl","լիտվերեն":"lt","խորվաթերեն":"hr","կաննադա":"kn","կատալաներեն":"ca","կելտական շոտլանդերեն":"gd","կորեերեն":"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","քրդերեն (քուրմանջի)":"ku","ֆիններեն":"fi","ֆրանսերեն":"fr","arabia":"ar","baski":"eu","burma":"my","englanti":"en","espanja":"es","haitinkreoli":"ht","heprea":"he","hollanti":"nl","iiri":"ga","islanti":"is","italia":"it","japani":"ja","katalaani":"ca","kiina (perinteinen)":"zh-tw","kiina (yksinkert.)":"zh-cn","kreikka":"el","kroatia":"hr","kurdi":"ku","kymri":"cy","liettua":"lt","makedonia":"mk","malaiji":"ms","norja":"nb","persia":"fa","portugali":"pt","puola":"pl","ranska":"fr","ruotsi":"sv","saksa":"de","skottigaeli":"gd","slovakia":"sk","suomi":"fi","tanska":"da","tsekki":"cs","turkki":"tr","ukraina":"uk","unkari":"hu","uzbekki":"uz","valkovenäjä":"be","venäjä":"ru","viro":"et","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 gaelera":"gd","eslovakiera":"sk","esloveniera":"sl","esperantoa":"eo","estoniera":"et","euskara":"eu","frantsesa":"fr","gaelera":"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":"ku","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","suomiera":"fi","telugua":"te","thaiera":"th","turkiera":"tr","txekiera":"cs","txinera (soildua)":"zh-cn","txinera (tradizionala)":"zh-tw","ukrainera":"uk","uzbekera":"uz","vietnamera":"vi","zuluera":"zu","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","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","serbi":"sr","suec":"sv","txec":"cs","ucraïnès":"uk","xinès (simplificat)":"zh-cn","xinès (tradicional)":"zh-tw","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","ebreju (ivrits)":"he","franču":"fr","galisiešu":"gl","grieķu":"el","holandiešu":"nl","horvātu":"hr","igauņu":"et","indonēziešu":"id","īru":"ga","īslandiešu":"is","itāļu":"it","japāņu":"ja","katalāņu":"ca","korejiešu":"ko","kreolu (haiti)":"ht","krievu":"ru","kurdu":"ku","ķī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","belarussia":"be","cek":"cs","china (aks. sederhana)":"zh-cn","china (aks. tradisional)":"zh-tw","finlandia":"fi","gaelig":"ga","gaelik skotlandia":"gd","galisia":"gl","inggris":"en","islan":"is","jepang":"ja","katala":"ca","lituania":"lt","polandia":"pl","prancis":"fr","rumania":"ro","swensk":"sv","yunani":"el","అజర్‌బైజాని":"az","అర్మేనియన్":"hy","అల్బేనియన్":"sq","ఆంగ్లము":"en","ఆమ్హారిక్":"am","ఆరబిక్":"ar","ఇండొనేసియన్":"id","ఇటాలియన్":"it","ఉజ్బెక్":"uz","ఎస్పెరాంటో":"eo","ఏస్టోనియన్":"et","ఐరిష్":"ga","ఐస్ లాండిక్":"is","కన్నడ":"kn","కర్డిష్":"ku","కొరియన్":"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","amhárico":"am","azerí":"az","chino (simplificado)":"zh-cn","chino (tradicional)":"zh-tw","criollo haitiano":"ht","danés":"da","estonio":"et","euskera":"eu","finlandés":"fi","gallego":"gl","griego":"el","japonés":"ja","kurdo":"ku","malayo":"ms","noruego":"nb","rumano":"ro","uzbeco":"uz","albaania":"sq","amhaari":"am","araabia":"ar","armeenia":"hy","aserbaidžaani":"az","birma":"my","bulgaaria":"bg","eesti":"et","galeegi":"gl","haitikreooli":"ht","heebrea":"he","hispaania":"es","hollandi":"nl","horvaadi":"hr","indoneesia":"id","inglise":"en","islandi":"is","itaalia":"it","jaapani":"ja","kreeka":"el","ladina":"la","leedu":"lt","lihtsustatud hiina":"zh-cn","läti":"lv","makedoonia":"mk","malajalaami":"ml","maoori":"mi","mongoli":"mn","norra":"nb","poola":"pl","prantsuse":"fr","pärsia":"fa","rootsi":"sv","rumeenia":"ro","slovaki":"sk","sloveeni":"sl","soome":"fi","suulu":"zu","šoti":"gd","taani":"da","traditsiooniline hiina":"zh-tw","tšehhi":"cs","türgi":"tr","uelsi":"cy","ungari":"hu","usbeki":"uz","valgevene":"be","vene":"ru","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","koreyen":"ko","kreyòl ayisyen":"ht","kurde (kurmandji)":"ku","kwoasyen":"hr","laten":"la","letonyen":"lv","lityanyen":"lt","malè":"ms","malt":"mt","masedonyen":"mk","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","albaneg":"sq","almaeneg":"de","arabeg":"ar","armeneg":"hy","aserbaijaneg":"az","basgeg":"eu","belarwseg":"be","bwlgaraidd":"bg","catalaneg":"ca","creol haiti":"ht","croateg":"hr","cymraeg":"cy","cyrdeg (kurmandji)":"ku","daneg":"da","eidaleg":"it","estoneg":"et","fietnameg":"vi","ffineg":"fi","fflemeg":"nl","ffrangeg":"fr","gaeleg yr alban":"gd","galisaidd":"gl","groeg":"el","gwyddeleg":"ga","hebraeg":"he","hwngareg":"hu","iaith corea":"ko","indonesieg":"id","islandeg":"is","iwcraineg":"uk","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","slofac":"sk","slofenia":"sl","swedeg":"sv","swlw":"zu","tsieceg":"cs","tsieineeg (traddodiadol)":"zh-tw","tsieineeg (wedi symleiddio)":"zh-cn","twrceg":"tr","usbec":"uz","अंग्रेज़ी":"en","अज़रबैजानी":"az","अल्बेनियन":"sq","आइसलैंडिक":"is","आर्मेनियन":"hy","इटैलियन":"it","उज़्बेक":"uz","एस्तोनियन":"et","एस्पेरांटो":"eo","ऐम्हेरिक":"am","कन्नड़":"kn","कुर्दिश (करमंजी)":"ku","कैटेलन":"ca","गैलिशियन":"gl","चीनी (परंपरागत)":"zh-tw","चेक":"cs","जापानी":"ja","ज़ुलु":"zu","डैनिश":"da","तुर्क":"tr","तेलुगु":"te","पुर्तगाली":"pt","फ़िनिश":"fi","फ़्रेंच":"fr","बर्मी":"my","बुल्गारियन":"bg","बेलारूसीयन":"be","बैस्क":"eu","मलयालम":"ml","माऔरी":"mi","माल्टी":"mt","मेसीडोनियन":"mk","यूक्रेनियन":"uk","रूसी":"ru","रोमेनियन":"ro","लातवियन":"lv","लैटिन":"la","वियतनामी":"vi","सर्बियाई":"sr","स्पैनिश":"es","स्लोवाक":"sk","स्लोवेनियन":"sl","हंगरियन":"hu","हीब्रू":"he","हैतियन क्रिओल":"ht","阿尔巴尼亚语":"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","拉丁语":"la","拉脱维亚语":"lv","立陶宛语":"lt","罗马尼亚语":"ro","马耳他语":"mt","马拉地语":"mr","马拉雅拉姆语":"ml","马来语":"ms","马其顿语":"mk","毛利语":"mi","蒙古语":"mn","缅甸语":"my","南非祖鲁语":"zu","挪威语":"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","азербайджански":"az","английски":"en","арабски":"ar","арменски":"hy","баски":"eu","беларуски":"be","бирмански":"my","български":"bg","галисийски":"gl","гръцки":"el","датски":"da","индонезийски":"id","ирландски":"ga","испански":"es","италиански":"it","китайски (опростен)":"zh-cn","китайски (традиционен)":"zh-tw","корейски":"ko","кюрдски":"ku","латвийски":"lv","литовски":"lt","малайски":"ms","малтийски":"mt","немски":"de","нидерландски":"nl","норвежки":"nb","персийски":"fa","румънски":"ro","словашки":"sk","словенски":"sl","сръбски":"sr","тайландски":"th","уелски":"cy","узбекски":"uz","финландски":"fi","френски":"fr","хаитянски креолски":"ht","хърватски":"hr","шотландски келтски":"gd","японски":"ja","الآيسلندية":"is","الأذرية":"az","الارمنية":"hy","الإسبانية":"es","الاسبرانتو":"eo","الإستونية":"et","الاسكتلندية الغالية":"gd","الألبانية":"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","الفارسية":"fa","الفرنسية":"fr","الفنلندية":"fi","الفيتنامية":"vi","القطلونية":"ca","الكانادا":"kn","الكردية":"ku","الكرواتية":"hr","الكورية":"ko","اللاتفية":"lv","اللاتينية":"la","اللغة الكريولية الهايتية":"ht","الليتوانية":"lt","المالايالامية":"ml","المالطيّة":"mt","الماورية":"mi","المقدونية":"mk","الملايو":"ms","المنغولية":"mn","المهراتية":"mr","النرويجية":"nb","الهندية":"hi","الهنغارية":"hu","الهولندية":"nl","الويلزية":"cy","اليابانية":"ja","اليونانية":"el","баскијски":"eu","вијетнамски":"vi","галски":"gl","енглески":"en","индонежански":"id","јапански":"ja","јерменски":"hy","кинески (поједностављени)":"zh-cn","кинески (традиционални)":"zh-tw","креолски (хаити)":"ht","летонски":"lv","мађарски":"hu","марати":"mr","немачки":"de","персијски":"fa","пољски":"pl","румунски":"ro","словеначки":"sl","тајски":"th","украјински":"uk","азербайжан":"az","албани":"sq","амхарик":"am","англи":"en","араб":"ar","армени":"hy","баск":"eu","беларусь":"be","бирм":"my","болгар":"bg","вьетнам":"vi","гаити креол":"ht","галик":"gl","гаэл":"gd","герман":"de","голланд":"nl","грек":"el","дани":"da","индонези":"id","ирланд":"ga","исланд":"is","испани":"es","итали":"it","каталан":"ca","кипр":"he","курд":"ku","латви":"lv","латин":"la","литва":"lt","македон":"mk","малай":"ms","малайлам":"ml","малти":"mt","монгол":"mn","норвеги":"nb","орос":"ru","перс":"fa","польш":"pl","португаль":"pt","румын":"ro","серби":"sr","словак":"sk","словени":"sl","солонгос":"ko","тай":"th","турк":"tr","тэлүгү":"te","узбек":"uz","украин":"uk","унгар":"hu","уэльс":"cy","финлянд":"fi","франц":"fr","хорват":"hr","хятад (ердийн)":"zh-cn","хятад (уламжлалт)":"zh-tw","чех":"cs","швед":"sv","эстони":"et","япон":"ja","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":"ku","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","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ă":"ku","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","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ų":"ku","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ų (gėlų)":"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","갈리시아어":"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","에스토니아어":"et","에스페란토어":"eo","영어":"en","우즈베크어":"uz","우크라이나어":"uk","웨일즈어":"cy","이탈리아어":"it","인도네시아어":"id","일본어":"ja","줄루어":"zu","중국어(간체)":"zh-cn","중국어(번체)":"zh-tw","체코어":"cs","카탈로니아어":"ca","칸나다어":"kn","쿠르드어":"ku","크로아티아어":"hr","태국어":"th","터키어":"tr","텔루구어":"te","페르시아어":"fa","포르투갈어":"pt","폴란드어":"pl","프랑스어":"fr","핀란드어":"fi","한국어":"ko","헝가리어":"hu","히브리어":"he","힌디어":"hi","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 (kurmanji)":"ku","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","tailandese":"th","tedesco":"de","ucraino":"uk","ungherese":"hu","quốc tế ngữ":"eo","tiếng ả rập":"ar","tiếng albania":"sq","tiếng amharic":"am","tiếng anh":"en","tiếng armenia":"hy","tiếng azerbaijan":"az","tiếng ba lan":"pl","tiếng ba tư":"fa","tiếng basque":"eu","tiếng belarus":"be","tiếng bồ đào nha":"pt","tiếng bulgaria":"bg","tiếng catalan":"ca","tiếng creole ở haiti":"ht","tiếng croatia":"hr","tiếng do thái":"he","tiếng đan mạch":"da","tiếng đức":"de","tiếng estonia":"et","tiếng gael scotland":"gd","tiếng galicia":"gl","tiếng hà lan":"nl","tiếng hàn":"ko","tiếng hindi":"hi","tiếng hungary":"hu","tiếng hy lạp":"el","tiếng iceland":"is","tiếng indonesia":"id","tiếng ireland":"ga","tiếng kannada":"kn","tiếng kurd":"ku","tiếng latinh":"la","tiếng latvia":"lv","tiếng litva":"lt","tiếng mã lai":"ms","tiếng macedonia":"mk","tiếng malayalam":"ml","tiếng malta":"mt","tiếng maori":"mi","tiếng marathi":"mr","tiếng mông cổ":"mn","tiếng myanmar":"my","tiếng na uy":"nb","tiếng nga":"ru","tiếng nhật":"ja","tiếng pháp":"fr","tiếng phần lan":"fi","tiếng rumani":"ro","tiếng séc":"cs","tiếng serbia":"sr","tiếng slovak":"sk","tiếng slovenia":"sl","tiếng tây ban nha":"es","tiếng telugu":"te","tiếng thái":"th","tiếng thổ nhĩ kỳ":"tr","tiếng thụy điển":"sv","tiếng trung (giản thể)":"zh-cn","tiếng trung (phồn thể)":"zh-tw","tiếng ukraina":"uk","tiếng uzbek":"uz","tiếng việt":"vi","tiếng xứ wales":"cy","tiếng ý":"it","tiếng zulu":"zu","にほんご":"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(A,B){A.exports=(A,B,t)=>{let e=null;const g=window.AbortController?new window.AbortController:null,i=g?g.signal:null;return Promise.race([fetch(A,Object.assign({signal:i},B)).then(A=>(clearTimeout(e),A)),new Promise((A,B)=>{e=setTimeout(()=>{g&&g.abort(),B(new Error("Fetch timed out after ".concat(t," ms")))},t)})])}},function(A,B,t){function e(A,B){var t=Object.keys(A);if(Object.getOwnPropertySymbols){var e=Object.getOwnPropertySymbols(A);B&&(e=e.filter((function(B){return Object.getOwnPropertyDescriptor(A,B).enumerable}))),t.push.apply(t,e)}return t}function g(A,B,t){return B in A?Object.defineProperty(A,B,{value:t,enumerable:!0,configurable:!0,writable:!0}):A[B]=t,A}const i=t(20),{OrderedMap:Q}=t(24),s=t(70),n=t(5),r=t(16),c=t(64),E=t(2),o=t(201),w=t(202),C=t(74),a=t(210),I=t(60),Y=t(30),h=t(0),M=t(56),F=t(14),D=t(8),u=t(28),l=t(211),d=t(212),U=t(213),N=t(214),m=t(215),G=t(216),f=t(217),H=t(75),R=t(7),p=t(6),J={scratch3_control:t(218),scratch3_event:t(219),scratch3_looks:t(220),scratch3_motion:t(221),scratch3_operators:t(222),scratch3_sound:t(223),scratch3_sensing:t(224),scratch3_data:t(225),scratch3_procedures:t(226)},y=t(227),k=t(228),T=["#0FBD8C","#0DA57A","#0B8E69"],j=(()=>{const A={};return A[n.ANGLE]={shadow:{type:"math_angle",fieldName:"NUM"}},A[n.COLOR]={shadow:{type:"colour_picker",fieldName:"COLOUR"}},A[n.NUMBER]={shadow:{type:"math_number",fieldName:"NUM"}},A[n.STRING]={shadow:{type:"text",fieldName:"TEXT"}},A[n.BOOLEAN]={check:"Boolean"},A[n.MATRIX]={shadow:{type:"matrix",fieldName:"MATRIX"}},A[n.NOTE]={shadow:{type:"note",fieldName:"NOTE"}},A[n.IMAGE]={fieldType:"field_image"},A})(),x=A=>{let B=0;return{canAddCloudVariable:()=>B{B++},removeCloudVariable:()=>{B--},hasCloudVariables:()=>B>0,getNumberOfCloudVariables:()=>B}};let S=-1,b=-1,z=-1;class L extends i{constructor(){super(),this.targets=[],this.executableTargets=[],this.threads=[],this.threadMap=new Map,this.sequencer=new w(this),this.flyoutBlocks=new r(this,!0),this.monitorBlocks=new r(this,!0),this._editingTarget=null,this._primitives={},this._blockInfo=[],this._hats={},this._scriptGlowsPreviousFrame=[],this._nonMonitorThreadCount=0,this._lastStepDoneThreads=null,this._cloneCounter=0,this._refreshTargets=!1,this.monitorBlockInfo={},this._monitorState=Q({}),this._prevMonitorState=Q({}),this.turboMode=!1,this.frameLoop=new k(this),this.currentStepTime=1e3/30,this.updateCurrentMSecs(),this.redrawRequested=!1,this._registerBlockPackages(),this.ioDevices={clock:new d(this),cloud:new U(this),keyboard:new N(this),mouse:new m(this),mouseWheel:new G(this),userData:new f,video:new H(this)},this.peripheralExtensions={},this.profiler=null,this.cloudOptions={limit:10};const A=x(this.cloudOptions);this.hasCloudData=A.hasCloudVariables,this.canAddCloudVariable=A.canAddCloudVariable,this.getNumberOfCloudVariables=A.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(A),this.removeCloudVariable=this._initializeRemoveCloudVariable(A),this.origin=null,this._stageTarget=null,this.addonBlocks={},this.stageWidth=L.STAGE_WIDTH,this.stageHeight=L.STAGE_HEIGHT,this.runtimeOptions={maxClones:L.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}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 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 THREAD_STEP_INTERVAL(){return 1e3/60}static get THREAD_STEP_INTERVAL_COMPATIBILITY(){return 1e3/30}static get MAX_CLONES(){return 300}_initializeAddCloudVariable(A){return()=>{const B=this.hasCloudData();A.addCloudVariable(),!B&&this.hasCloudData()&&this.emit(L.HAS_CLOUD_DATA_UPDATE,!0)}}_initializeRemoveCloudVariable(A){return()=>{const B=this.hasCloudData();A.removeCloudVariable(),B&&!this.hasCloudData()&&this.emit(L.HAS_CLOUD_DATA_UPDATE,!1)}}_registerBlockPackages(){for(const A in J)if(J.hasOwnProperty(A)){const B=new J[A](this);if(B.getPrimitives){const A=B.getPrimitives();for(const t in A)A.hasOwnProperty(t)&&(this._primitives[t]=A[t].bind(B))}if(B.getHats){const A=B.getHats();for(const B in A)A.hasOwnProperty(B)&&(this._hats[B]=A[B])}B.getMonitored&&(this.monitorBlockInfo=Object.assign({},this.monitorBlockInfo,B.getMonitored())),this.compilerRegisterExtension(A,B)}}compilerRegisterExtension(A,B){this["ext_".concat(A)]=B}getMonitorState(){return this._monitorState}_makeExtensionMenuId(A,B){return"".concat(B,"_menu_").concat(u(A))}makeMessageContextForTarget(A){const B={};(A=A||this.getEditingTarget()||this.getTargetForStage())&&(B.targetType=A.isStage?I.STAGE:I.SPRITE)}_registerExtensionPrimitives(A){const B={id:A.id,name:M(A.name),showStatusButton:A.showStatusButton,blockIconURI:A.blockIconURI,menuIconURI:A.menuIconURI};A.color1?(B.color1=A.color1,B.color2=A.color2,B.color3=A.color3):(B.color1=T[0],B.color2=T[1],B.color3=T[2]),this._blockInfo.push(B),this._fillExtensionCategory(B,A);for(const t in B.customFieldTypes)if(A.customFieldTypes.hasOwnProperty(t)){const A=B.customFieldTypes[t];this.emit(L.EXTENSION_FIELD_ADDED,{name:"field_".concat(A.extendedName),implementation:A.fieldImplementation})}this.emit(L.EXTENSION_ADDED,B)}_refreshExtensionPrimitives(A){const B=this._blockInfo.find(B=>B.id===A.id);B&&(B.name=M(A.name),this._fillExtensionCategory(B,A),this.emit(L.BLOCKSINFO_UPDATE,B))}_fillExtensionCategory(A,B){A.blocks=[],A.customFieldTypes={},A.menus=[],A.menuInfo={};for(const t in B.menus)if(B.menus.hasOwnProperty(t)){const e=B.menus[t],g=this._buildMenuForScratchBlocks(t,e,A);A.menus.push(g),A.menuInfo[t]=e}for(const t in B.customFieldTypes)if(B.customFieldTypes.hasOwnProperty(t)){const e=B.customFieldTypes[t],g=this._buildCustomFieldInfo(t,e,B.id,A);A.customFieldTypes[t]=g}if(B.docsURI)try{const t=new URL(B.docsURI);if("http:"!==t.protocol&&"https:"!==t.protocol)throw new Error("invalid protocol");const e={info:{},xml:"')};A.blocks.push(e)}catch(A){h.warn("cannot create docsURI button",A)}for(const t of B.blocks)try{const B=this._convertForScratchBlocks(t,A);if(A.blocks.push(B),B.json){const A=B.json.type;t.blockType!==E.EVENT&&(this._primitives[A]=B.info.func),t.blockType!==E.EVENT&&t.blockType!==E.HAT||(this._hats[A]={edgeActivated:t.isEdgeActivated,restartExistingThreads:t.shouldRestartExistingThreads})}}catch(A){h.error("Error parsing block: ",{block:t,error:A})}}_convertMenuItems(A){if("function"!=typeof A){const B=this.makeMessageContextForTarget();return A.map(A=>{const t=M(A,B);switch(typeof t){case"string":return[t,t];case"object":return[M(A.text,B),A.value];default:throw new Error("Can't interpret menu item: ".concat(JSON.stringify(A)))}})}return A}_buildMenuForScratchBlocks(A,B,t){const e=this._makeExtensionMenuId(A,t.id),g=this._convertMenuItems(B.items);return{json:{message0:"%1",type:e,inputsInline:!0,output:"String",colour:t.color1,colourSecondary:t.color2,colourTertiary:t.color3,outputShape:B.acceptReporters?a.OUTPUT_SHAPE_ROUND:a.OUTPUT_SHAPE_SQUARE,args0:[{type:"field_dropdown",name:A,options:g}]}}}_buildCustomFieldInfo(A,B,t,e){const g="".concat(t,"_").concat(A);return{fieldName:A,extendedName:g,argumentTypeInfo:{shadow:{type:g,fieldName:"field_".concat(g)}},scratchBlocksDefinition:this._buildCustomFieldTypeForScratchBlocks(g,B.output,B.outputShape,e),fieldImplementation:B.implementation}}_buildCustomFieldTypeForScratchBlocks(A,B,t,e){return{json:{type:A,message0:"%1",inputsInline:!0,output:B,colour:e.color1,colourSecondary:e.color2,colourTertiary:e.color3,outputShape:t,args0:[{name:"field_".concat(A),type:"field_".concat(A)}]}}}_convertForScratchBlocks(A,B){return"---"===A?this._convertSeparatorForScratchBlocks(A):A.blockType===E.BUTTON?this._convertButtonForScratchBlocks(A):this._convertBlockForScratchBlocks(A,B)}_convertBlockForScratchBlocks(A,B){const t="".concat(B.id,"_").concat(A.opcode),e={type:t,inputsInline:!0,category:B.name,colour:B.color1,colourSecondary:B.color2,colourTertiary:B.color3},g={argsMap:{},blockJSON:e,categoryInfo:B,blockInfo:A,inputList:[]},i=A.blockIconURI||B.blockIconURI;if(i){e.extensions=["scratch_extension"],e.message0="%1 %2";const A={type:"field_image",src:i,width:40,height:40},B={type:"field_vertical_separator"};e.args0=[A,B]}switch(A.blockType){case E.COMMAND:e.outputShape=a.OUTPUT_SHAPE_SQUARE,e.previousStatement=null,A.isTerminal||(e.nextStatement=null);break;case E.REPORTER:e.output="String",e.outputShape=a.OUTPUT_SHAPE_ROUND;break;case E.BOOLEAN:e.output="Boolean",e.outputShape=a.OUTPUT_SHAPE_HEXAGONAL;break;case E.HAT:case E.EVENT:A.hasOwnProperty("isEdgeActivated")||(A.isEdgeActivated=!0),e.outputShape=a.OUTPUT_SHAPE_SQUARE,e.nextStatement=null;break;case E.CONDITIONAL:case E.LOOP:A.branchCount=A.branchCount||1,e.outputShape=a.OUTPUT_SHAPE_SQUARE,e.previousStatement=null,A.isTerminal||(e.nextStatement=null)}const Q=Array.isArray(A.text)?A.text:[A.text];let s=0,n=0,r=0;const c=this._convertPlaceholders.bind(this,g),o=this.makeMessageContextForTarget();for(;s0?n+1:"")}],++n,++r)}A.blockType===E.REPORTER?A.disableMonitor||0!==g.inputList.length||(e.checkboxInFlyout=!0):A.blockType===E.LOOP&&(e["lastDummyAlign".concat(r)]="RIGHT",e["message".concat(r)]="%1",e["args".concat(r)]=[{type:"field_image",src:"./static/blocks-media/repeat.svg",width:24,height:24,alt:"*",flip_rtl:!0}],++r);const w=A.isDynamic?''):"",C=g.inputList.join(""),I='').concat(w).concat(C,"");return{info:g.blockInfo,json:g.blockJSON,xml:I}}_convertSeparatorForScratchBlocks(A){return{info:A,xml:''}}_convertButtonForScratchBlocks(A){["MAKE_A_LIST","MAKE_A_PROCEDURE","MAKE_A_VARIABLE"].indexOf(A.func)<0&&h.error("Custom button callbacks not supported yet: ".concat(A.func));const B=this.makeMessageContextForTarget(),t=M(A.text,B);return{info:A,xml:'')}}_constructInlineImageJson(A){return A.dataURI||h.warn("Missing data URI in extension block with argument type IMAGE"),{type:"field_image",src:A.dataURI||"",width:24,height:24,flip_rtl:A.flipRTL||!1}}_convertPlaceholders(A,B,t){t=t.replace(/[<"&]/,"_");const e=A.blockInfo.arguments[t]||{};let g,i=j[e.type]||{};if(!j[e.type]&&A.categoryInfo.customFieldTypes[e.type]&&(i=A.categoryInfo.customFieldTypes[e.type].argumentTypeInfo),"field_image"===i.fieldType)g=this._constructInlineImageJson(e);else{g={type:"input_value",name:t};const B=void 0===e.defaultValue?"":u(M(e.defaultValue,this.makeMessageContextForTarget()).toString());let Q,s,n;if(i.check&&(g.check=i.check),e.menu){const B=A.categoryInfo.menuInfo[e.menu];B.acceptReporters?(Q=t,s=this._makeExtensionMenuId(e.menu,A.categoryInfo.id),n=e.menu):(g.type="field_dropdown",g.options=this._convertMenuItems(B.items),Q=null,s=null,n=t)}else Q=t,s=i.shadow&&i.shadow.type||null,n=i.shadow&&i.shadow.fieldName||null;Q&&A.inputList.push('')),s&&A.inputList.push('')),B&&n&&A.inputList.push('').concat(B,"")),s&&A.inputList.push(""),Q&&A.inputList.push("")}const Q="args".concat(A.outLineNum),s=A.blockJSON[Q]=A.blockJSON[Q]||[];g&&s.push(g);const n=s.length;return A.argsMap[t]=n,"%".concat(n)}getBlocksXML(A){return this._blockInfo.map(B=>{const{name:t,color1:e,color2:g}=B,i=B.blocks.filter(B=>{let t=!0;return A&&B.info.filter&&(t=B.info.filter.includes(A.isStage?I.STAGE:I.SPRITE)),t&&!B.info.hideFromPalette}),Q='colour="'.concat(e,'" secondaryColour="').concat(g,'"');let s="";B.menuIconURI?s=B.menuIconURI:B.blockIconURI&&(s=B.blockIconURI);const n=s?'iconURI="'.concat(s,'"'):"";let r="";return B.showStatusButton&&(r='showStatusButton="true"'),{id:B.id,xml:'").concat(i.map(A=>A.xml).join(""),"")}})}getBlocksJSON(){return this._blockInfo.reduce((A,B)=>A.concat(B.blocks.map(A=>A.json)),[])}getScratchLinkSocket(A){return(this._linkSocketFactory||this._defaultScratchLinkSocketFactory)(A)}configureScratchLinkSocketFactory(A){this._linkSocketFactory=A}_defaultScratchLinkSocketFactory(A){return new l(A)}registerPeripheralExtension(A,B){this.peripheralExtensions[A]=B}scanForPeripheral(A){this.peripheralExtensions[A]&&this.peripheralExtensions[A].scan()}connectPeripheral(A,B){this.peripheralExtensions[A]&&this.peripheralExtensions[A].connect(B)}disconnectPeripheral(A){this.peripheralExtensions[A]&&this.peripheralExtensions[A].disconnect()}getPeripheralIsConnected(A){let B=!1;return this.peripheralExtensions[A]&&(B=this.peripheralExtensions[A].isConnected()),B}emitMicListening(A){this.emit(L.MIC_LISTENING,A)}getOpcodeFunction(A){return this._primitives[A]}getIsHat(A){return this._hats.hasOwnProperty(A)}getIsEdgeActivatedHat(A){return this._hats.hasOwnProperty(A)&&this._hats[A].edgeActivated}attachAudioEngine(A){this.audioEngine=A,t(229)(A)}attachRenderer(A){this.renderer=A,this.renderer.setLayerGroupOrdering(F.LAYER_GROUPS),this.renderer.offscreenTouching=!this.runtimeOptions.fencing}attachV2BitmapAdapter(A){this.v2BitmapAdapter=A}attachStorage(A){if(this.storage=A,this.isPackaged){const B=A.createAsset;let t=0;A.createAsset=function(A,e,g,i,Q){return i||(i=(++t).toString()),B.call(this,A,e,g,i,!1)}}}_pushThread(A,B,t){const e=new Y(A);return e.target=B,e.stackClick=Boolean(t&&t.stackClick),e.updateMonitor=Boolean(t&&t.updateMonitor),e.blockContainer=e.updateMonitor?this.monitorBlocks:B.blocks,e.pushStack(A),this.threads.push(e),e.stackClick||e.updateMonitor||this.threadMap.set(e.getId(),e),t&&t.updateMonitor||!this.compilerOptions.enabled||e.tryCompile(),e}_stopThread(A){A.isKilled=!0,this.sequencer.retireThread(A)}_restartThread(A){const B=new Y(A.topBlock);B.target=A.target,B.stackClick=A.stackClick,B.updateMonitor=A.updateMonitor,B.blockContainer=A.blockContainer,B.pushStack(A.topBlock),A.triedToCompile&&this.compilerOptions.enabled&&B.tryCompile(),B.stackClick||B.updateMonitor||this.threadMap.set(B.getId(),B);const t=this.threads.indexOf(A);return t>-1?(this.threads[t]=B,B):(this.threads.push(A),A)}emitCompileError(A,B){this.emit(L.COMPILE_ERROR,A,B)}isActiveThread(A){return A.stack.length>0&&A.status!==Y.STATUS_DONE&&this.threads.indexOf(A)>-1}isWaitingThread(A){return A.status===Y.STATUS_PROMISE_WAIT||A.status===Y.STATUS_YIELD_TICK||!this.isActiveThread(A)}toggleScript(A,B){B=Object.assign({target:this._editingTarget,stackClick:!1},B);for(let t=0;t=0;B--){const e=t[B],g=e.blocks.getScripts();for(let B=0;B=0;t--){const g=e[t],i=c.getScripts(g.blocks,A);for(let A=0;A{const{blockId:Q,fieldsOfInputs:s}=A;for(const A in B)if(s[A].value!==B[A])return;if(g.restartExistingThreads){const A=this.threadMap.get(Y.getIdFromTargetAndBlock(t,Q));if(A)return void e.push(this._restartThread(A))}else for(let A=0;A{A.isCompiled||(C(this.sequencer,A),A.goToNextBlock())}),e}dispose(){this.stopAll(),this.targets.forEach(A=>{A.isOriginal&&A.deleteMonitors()}),this.targets.map(this.disposeTarget,this);const A=Q({});A.equals(this._monitorState)||(this._monitorState=A,this.emit(L.MONITORS_UPDATE,this._monitorState)),this.emit(L.RUNTIME_DISPOSED),this.ioDevices.clock.resetProjectTimer(),this.hasCloudData()&&this.emit(L.HAS_CLOUD_DATA_UPDATE,!1),this.ioDevices.cloud.clear();const B=x(this.cloudOptions);this.hasCloudData=B.hasCloudVariables,this.canAddCloudVariable=B.canAddCloudVariable,this.getNumberOfCloudVariables=B.getNumberOfCloudVariables,this.addCloudVariable=this._initializeAddCloudVariable(B),this.removeCloudVariable=this._initializeRemoveCloudVariable(B)}addTarget(A){this.targets.push(A),this.executableTargets.push(A),A.isStage&&!this._stageTarget&&(this._stageTarget=A)}moveExecutable(A,B){const t=this.executableTargets.indexOf(A);this.executableTargets.splice(t,1);let e=t+B;return e>this.executableTargets.length&&(e=this.executableTargets.length),e<=0&&(e=this.executableTargets.length>0&&this.executableTargets[0].isStage?1:0),this.executableTargets.splice(e,0,A),e}setExecutablePosition(A,B){const t=this.executableTargets.indexOf(A);return this.moveExecutable(A,B-t)}removeExecutable(A){const B=this.executableTargets.indexOf(A);B>-1&&this.executableTargets.splice(B,1)}disposeTarget(A){this.targets=this.targets.filter(B=>A!==B||(B.dispose(),!1)),this._stageTarget===A&&(this._stageTarget=null)}stopForTarget(A,B){this.emit(L.STOP_FOR_TARGET,A,B);for(let t=0;tA.clearEdgeActivatedValues());for(let A=0;A!A.isKilled),this.updateThreadMap();for(const A in this._hats){if(!this._hats.hasOwnProperty(A))continue;this._hats[A].edgeActivated&&this.startHats(A)}this.redrawRequested=!1,this._pushMonitors(),null!==this.profiler&&(-1===b&&(b=this.profiler.idByName("Sequencer.stepThreads")),this.profiler.start(b));const A=this.sequencer.stepThreads();null!==this.profiler&&this.profiler.stop(),this._updateGlows(A),this._emitProjectRunStatus(this.threads.length+A.length-this._getMonitorThreadCount([...this.threads,...A])),this._lastStepDoneThreads=A,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(L.TARGETS_UPDATE,!1),this._refreshTargets=!1),this._prevMonitorState.equals(this._monitorState)||(this.emit(L.MONITORS_UPDATE,this._monitorState),this._prevMonitorState=this._monitorState),null!==this.profiler&&(this.profiler.stop(),this.profiler.reportFrames()),this.interpolationEnabled&&(this._lastStepTime=Date.now())}_getMonitorThreadCount(A){let B=0;return A.forEach(A=>{A.updateMonitor&&B++}),B}_pushMonitors(){this.monitorBlocks.runAllMonitored(this)}setEditingTarget(A){const B=this._editingTarget;this._editingTarget=A,this._scriptGlowsPreviousFrame=[],this._updateGlows(),B!==this._editingTarget&&this.requestToolboxExtensionsUpdate()}setCompatibilityMode(A){A?this.setFramerate(30):this.setFramerate(60)}setFramerate(A){A>250&&(A=250),A<0&&(A=1),this.frameLoop.setFramerate(A),this.emit(L.FRAMERATE_CHANGED,A)}setInterpolation(A){this.interpolationEnabled=A,this.frameLoop.setInterpolation(this.interpolationEnabled),this.emit(L.INTERPOLATION_CHANGED,A)}setRuntimeOptions(A){this.runtimeOptions=Object.assign({},this.runtimeOptions,A),this.emit(L.RUNTIME_OPTIONS_CHANGED,this.runtimeOptions),this.renderer&&(this.renderer.offscreenTouching=!this.runtimeOptions.fencing)}setCompilerOptions(A){this.compilerOptions=Object.assign({},this.compilerOptions,A),this.resetAllCaches(),this.emit(L.COMPILER_OPTIONS_CHANGED,this.compilerOptions)}setStageSize(A,B){if(A=Math.round(Math.max(1,A)),B=Math.round(Math.max(1,B)),this.stageWidth!==A||this.stageHeight!==B){const t=A-this.stageWidth,e=B-this.stageHeight;if(this._monitorState.size>0){const A=t/2,B=e/2;for(const t of this._monitorState.valueSeq()){const e=t.set("x",t.get("x")+A).set("y",t.get("y")+B);this.requestUpdateMonitor(e)}this.emit(L.MONITORS_UPDATE,this._monitorState)}this.stageWidth=A,this.stageHeight=B,this.renderer&&this.renderer.setStageSize(-A/2,A/2,-B/2,B/2)}this.emit(L.STAGE_SIZE_CHANGED,A,B)}setInEditor(A){}convertToPackagedRuntime(){if(this.storage)throw new Error("convertToPackagedRuntime must be called before attachStorage");this.isPackaged=!0}resetAllCaches(){for(const A of this.targets)A.isOriginal&&A.blocks.resetCache();this.flyoutBlocks.resetCache(),this.monitorBlocks.resetCache()}addAddonBlock(A){const B=A.procedureCode,t=A.arguments,i=A.arguments.map((A,B)=>"arg".concat(B)),Q=A.arguments.map(()=>"");this.addonBlocks[B]=function(A){for(var B=1;B"a-b"===A.id);s||(s={id:"a-b",name:"Addons",color1:A.color,color2:A.secondaryColor,color3:A.secondaryColor,blocks:[],customFieldTypes:{},menus:[]},this._blockInfo.unshift(s)),s.blocks.push({info:{},xml:'"}),this.resetAllCaches()}getAddonBlock(A){return Object.prototype.hasOwnProperty.call(this.addonBlocks,A)?this.addonBlocks[A]:null}findProjectOptionsComment(){const A=this.getTargetForStage().comments;for(const B of Object.values(A))if(B.text.includes(" // _twconfig_"))return B;return null}parseProjectOptions(){const A=this.findProjectOptionsComment();if(!A)return;const B=A.text.split("\n").find(A=>A.endsWith(" // _twconfig_"));if(!B)return void h.warn("Config comment does not contain valid line");const t=B.substr(0,B.length-" // _twconfig_".length);let e;try{if(e=s.parse(t),!e||"object"!=typeof e)throw new Error("Invalid object")}catch(A){return void h.warn("Config comment has invalid JSON",A)}"number"==typeof e.framerate&&this.setFramerate(e.framerate),e.turbo&&(this.turboMode=!0,this.emit(L.TURBO_MODE_ON)),e.interpolation&&this.setInterpolation(!0),e.runtimeOptions&&this.setRuntimeOptions(e.runtimeOptions),e.hq&&this.renderer&&this.renderer.setUseHighQualityRender(!0);const g=+e.width||this.stageWidth,i=+e.height||this.stageHeight;g===this.stageWidth&&i===this.stageHeight||this.setStageSize(g,i)}_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 A=(B,t)=>{const e={};for(const g of Object.keys(t)){const i=t[g],Q=B[g];if("object"==typeof i&&i){const B=A(Q,i);Object.keys(B).length>0&&(e[g]=B)}else i!==Q&&(e[g]=i)}return e};return A(this._defaultStoredSettings,this._generateAllProjectOptions())}storeProjectOptions(){const A=this.generateDifferingProjectOptions(),B="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(s.stringify(A)).concat(" // _twconfig_"),t=this.findProjectOptionsComment();if(t)t.text=B;else{this.getTargetForStage().createComment(p(),null,B,50,50,350,170,!1)}this.emitProjectChanged()}precompile(){this.allScriptsDo((A,B)=>{const t=B.blocks.getBlock(A);if(this.getIsHat(t.opcode)){const t=new Y(A);t.target=B,t.blockContainer=B.blocks,t.tryCompile()}})}enableDebug(){this.resetAllCaches(),this.debug=!0}_updateGlows(A){const B=[];B.push.apply(B,this.threads),A&&B.push.apply(B,A);const t=[],e=[];for(let A=0;A0&&this.emit(L.PROJECT_RUN_START),this._nonMonitorThreadCount>0&&0===A&&this.emit(L.PROJECT_RUN_STOP),this._nonMonitorThreadCount=A}quietGlow(A){const B=this._scriptGlowsPreviousFrame.indexOf(A);B>-1&&this._scriptGlowsPreviousFrame.splice(B,1)}glowBlock(A,B){B?this.emit(L.BLOCK_GLOW_ON,{id:A}):this.emit(L.BLOCK_GLOW_OFF,{id:A})}glowScript(A,B){B?this.emit(L.SCRIPT_GLOW_ON,{id:A}):this.emit(L.SCRIPT_GLOW_OFF,{id:A})}emitBlockDragUpdate(A){this.emit(L.BLOCK_DRAG_UPDATE,A)}emitBlockEndDrag(A,B){this.emit(L.BLOCK_DRAG_END,A,B)}visualReport(A,B){this.emit(L.VISUAL_REPORT,{id:A,value:String(B)})}requestAddMonitor(A){const B=A.get("id");this.requestUpdateMonitor(A)||(this._monitorState=this._monitorState.set(B,A))}requestUpdateMonitor(A){const B=A.get("id");return!!this._monitorState.has(B)&&(this._monitorState=this._monitorState.set(B,this._monitorState.get(B).mergeWith((A,B)=>null==B?A:B,A)),!0)}requestRemoveMonitor(A){this._monitorState=this._monitorState.delete(A)}requestHideMonitor(A){return this.requestUpdateMonitor(new Map([["id",A],["visible",!1]]))}requestShowMonitor(A){return this.requestUpdateMonitor(new Map([["id",A],["visible",!0]]))}requestRemoveMonitorByTargetId(A){this._monitorState=this._monitorState.filterNot(B=>B.targetId===A)}getTargetById(A){for(let B=0;BA.id===B);if(!e)return;const g=e.blocks.find(A=>A.info.opcode===t);return g?{category:"extension",label:"".concat(e.name,": ").concat(g.info.text)}:void 0}createNewGlobalVariable(A,B,t){const e="string"==typeof t?t:D.SCALAR_TYPE,g=this.getAllVarNamesOfType(e),i=R.unusedName(A,g),Q=new D(B||p(),i,e);return this.getTargetForStage().variables[Q.id]=Q,Q}requestRedraw(){this.redrawRequested=!0}requestTargetsUpdate(A){A.isOriginal&&(this._refreshTargets=!0)}requestBlocksUpdate(){this.emit(L.BLOCKS_NEED_UPDATE)}requestToolboxExtensionsUpdate(){this.emit(L.TOOLBOX_EXTENSIONS_NEED_UPDATE)}start(){this.frameLoop.running||(this.frameLoop.start(),this.emit(L.RUNTIME_STARTED))}stop(){this.frameLoop.running&&(this.frameLoop.stop(),this.emit(L.RUNTIME_STOPPED))}enableProfiling(A){o.available()&&(this.profiler=new o(A))}disableProfiling(){this.profiler=null}updateCurrentMSecs(){this.currentMSecs=Date.now()}}A.exports=L},function(A,B,t){"use strict";t.r(B),t.d(B,"_parse",(function(){return e})),t.d(B,"parse",(function(){return g})),t.d(B,"stringify",(function(){return i}));const e=A=>{let B=0;const t=t=>{const{line:e,column:g}=(()=>{let t=0,e=0;for(let g=0;g(B>=A.length&&t("Unexpected end of input"),A[B]),g=()=>e(B),i=()=>{B++},Q=A=>{g()!==A&&t(`Expected '${A}' but found '${g()}'`),i()},s=(t=1,g=1)=>{if(B+g+t>A.length)return"";if(1===t)return e(B+g);let i="";for(let A=0;A{for(;;)if(/\s/.test(g()))i();else if("//"===s(2,0))for(i(),i();"\n"!==g();)i();else{if("/*"!==s(2,0))break;for(i(),i();"*/"!==s(2,0);)i();i(),i()}},r=()=>{n();switch(g()){case'"':return o();case"{":return C();case"[":return w();case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"-":return E();default:return c()}},c=()=>{if("null"===s(4,0)){for(let A=0;A<4;A++)i();return null}if("true"===s(4,0)){for(let A=0;A<4;A++)i();return!0}if("false"===s(5,0)){for(let A=0;A<5;A++)i();return!1}if("Infinity"===s(8,0)){for(let A=0;A<8;A++)i();return 1/0}if("NaN"===s(3,0)){for(let A=0;A<3;A++)i();return NaN}t(`Unexpected character '${g()}'`)},E=()=>{if("-Infinity"===s(9,0)){for(let A=0;A<9;A++)i();return-1/0}let A="";for(;A+=g(),/[\d.e+-]/i.test(s());)i();i();const B=+A;return Number.isNaN(B)&&t("Not a number: "+A),B},o=()=>{Q('"');let A="";if('"'===g())return i(),"";for(;;){const B=g();if("\\"===B)switch(i(),g()){case'"':A+='"';break;case"/":A+="/";break;case"\\":A+="\\";break;case"b":A+="\b";break;case"f":A+="\f";break;case"n":A+="\n";break;case"r":A+="\r";break;case"t":A+="\t";break;case"u":{let B="";for(let A=0;A<4;A++){i();const A=g();/[0-9a-f]/i.test(A)||t("Invalid hex code: "+A),B+=A}const e=Number.parseInt(B,16);A+=String.fromCharCode(e);break}default:t("Invalid escape code: \\"+g())}else A+=B;if('"'===s())break;i()}return i(),Q('"'),A},w=()=>{Q("["),n();const A=[];for(;n(),"]"!==g();){const B=r();if(A.push(B),n(),","!==g())break;i()}return Q("]"),A},C=()=>{Q("{"),n();const A={};for(;n(),"}"!==g();){const B=o();n(),Q(":");const t=r();if(A[B]=t,n(),","!==g())break;i()}return Q("}"),A};return r()},g=A=>{try{return JSON.parse(A)}catch(B){try{return e(A)}catch(A){throw B}}},i=A=>{if("string"==typeof A)return JSON.stringify(A);if("number"==typeof A||"boolean"==typeof A)return A.toString();if(null==A||"symbol"==typeof A)return"null";if(Array.isArray(A))return`[${A.map(A=>i(A)).join(",")}]`;if("object"==typeof A){let B="{",t=!0;const e=Object.keys(A);for(let g=0;g {\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};",i.startHats="const startHats = (requestedHat, optMatchFields) => {\n const thread = globalState.thread;\n const threads = thread.target.runtime.startHats(requestedHat, optMatchFields);\n return threads;\n}",i.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}",i.executeInCompatibilityLayer="let hasResumedFromPromise = false;\nconst waitPromise = function*(promise) {\n const thread = globalState.thread;\n let returnValue;\n\n promise\n .then(value => {\n returnValue = value;\n thread.status = 0; // STATUS_RUNNING\n })\n .catch(error => {\n thread.status = 0; // STATUS_RUNNING\n globalState.log.warn('Promise rejected in compiled script:', error);\n });\n\n // enter STATUS_PROMISE_WAIT and yield\n // this will stop script execution until the promise handlers reset the thread status\n thread.status = 1; // STATUS_PROMISE_WAIT\n yield;\n\n return returnValue;\n};\nconst executeInCompatibilityLayer = function*(inputs, blockFunction, isWarp, useFlags) {\n const thread = globalState.thread;\n\n // reset the stackframe\n // we only ever use one stackframe at a time, so this shouldn't cause issues\n thread.stackFrames[thread.stackFrames.length - 1].reuse(isWarp);\n\n const executeBlock = () => {\n const compatibilityLayerBlockUtility = globalState.compatibilityLayerBlockUtility;\n compatibilityLayerBlockUtility.thread = thread;\n compatibilityLayerBlockUtility.sequencer = thread.target.runtime.sequencer;\n return blockFunction(inputs, compatibilityLayerBlockUtility);\n };\n\n const isPromise = value => (\n // see engine/execute.js\n value !== null &&\n typeof value === 'object' &&\n typeof value.then === 'function'\n );\n\n let returnValue = executeBlock();\n\n if (isPromise(returnValue)) {\n returnValue = yield* waitPromise(returnValue);\n if (useFlags) {\n hasResumedFromPromise = true;\n }\n return returnValue;\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\n if (isPromise(returnValue)) {\n returnValue = yield* waitPromise(returnValue);\n if (useFlags) {\n hasResumedFromPromise = true;\n }\n return returnValue;\n }\n }\n\n // todo: do we have to do anything extra if status is STATUS_DONE?\n\n return returnValue;\n}",i.callAddonBlock="const callAddonBlock = function*(procedureCode, blockId, args) {\n const thread = globalState.thread;\n const addonBlock = thread.target.runtime.getAddonBlock(procedureCode);\n if (addonBlock) {\n const target = thread.target;\n addonBlock.callback(args, {\n // Shim enough of BlockUtility to make addons work\n peekStack () {\n return blockId;\n },\n target\n });\n if (thread.status === 1 /* STATUS_PROMISE_WAIT */) {\n yield;\n }\n }\n}",i.retire="const retire = () => {\n const thread = globalState.thread;\n thread.target.runtime.sequencer.retireThread(thread);\n}",i.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}",i.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}",g+="const isWhiteSpace = val => typeof val === 'string' && val.trim().length === 0;",g+="const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isWhiteSpace(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isWhiteSpace(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !isNaN(v2) || v1 === v2) ? v1 === v2 : compareEqualSlow(v1, v2);",i.compareGreaterThan="const compareGreaterThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isWhiteSpace(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isWhiteSpace(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || 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' && !isNaN(v1) ? v1 > v2 : compareGreaterThanSlow(v1, v2)",i.compareLessThan="const compareLessThanSlow = (v1, v2) => {\n let n1 = +v1;\n let n2 = +v2;\n if (n1 === 0 && isWhiteSpace(v1)) {\n n1 = NaN;\n } else if (n2 === 0 && isWhiteSpace(v2)) {\n n2 = NaN;\n }\n if (isNaN(n1) || 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' && !isNaN(v2) ? v1 < v2 : compareLessThanSlow(v1, v2)",i.randomInt="const randomInt = (low, high) => low + Math.floor(Math.random() * ((high + 1) - low))",i.randomFloat="const randomFloat = (low, high) => (Math.random() * (high - low)) + low",i.timer="const timer = () => {\n const t = new globalState.Timer({\n now: () => globalState.thread.target.runtime.currentMSecs\n });\n t.start();\n return t;\n}",i.daysSince2000="const daysSince2000 = () => (Date.now() - 946684800000) / (24 * 60 * 60 * 1000)",i.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}",g+="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};",i.listGet="const listGet = (list, idx) => {\n const index = listIndex(idx, list.length);\n if (index === -1) {\n return '';\n }\n return list[index];\n}",i.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}",i.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}",i.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}",i.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}",i.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}",i.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}",i.colorToList="const colorToList = color => globalState.Cast.toRgbColorList(color)",i.mod="const mod = (n, modulus) => {\n let result = n % modulus;\n if (result / modulus < 0) result += modulus;\n return result;\n}",i.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}";const Q=A=>{e.thread=A,A.generator.next()};Q.scopedEval=A=>{const B=(A=>{let B="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 isWhiteSpace = val => typeof val === 'string' && val.trim().length === 0;const compareEqualSlow = (v1, v2) => {\n const n1 = +v1;\n if (isNaN(n1) || (n1 === 0 && isWhiteSpace(v1))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n const n2 = +v2;\n if (isNaN(n2) || (n2 === 0 && isWhiteSpace(v2))) return ('' + v1).toLowerCase() === ('' + v2).toLowerCase();\n return n1 === n2;\n};\nconst compareEqual = (v1, v2) => (typeof v1 === 'number' && typeof v2 === 'number' && !isNaN(v1) && !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 t of Object.keys(i))A.includes(t)&&(B+="".concat(i[t],";"));return B+="return ".concat(A),B})(A);try{return new Function("globalState",B)(e)}catch(A){throw e.log.error("was unable to compile script",B),A}},Q.runtimeFunctions=i,A.exports=Q},function(A,B,t){const e=t(30),g=t(15);A.exports=class{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.sequencer=A,this.thread=B,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 A=this.thread.peekStackFrame();return null===A.executionContext&&(A.executionContext={}),A.executionContext}stackTimerFinished(){return!(this.stackFrame.timer.timeElapsed(){t.status===Q.STATUS_RUNNING&&(t.status=Q.STATUS_PROMISE_WAIT),A.then(A=>{if(E(A,B,t,e,g),g&&!e._isHat){let A,B;do{const e=t.popStack();if(null===e)return;if(B=t.target.blocks.getNextBlock(e),null!==B)break;A=t.peekStackFrame()}while(null!==A&&!A.isLoop);t.pushStack(B)}},A=>{i.warn("Primitive rejected promise: ",A),t.status=Q.STATUS_RUNNING,t.popStack()})};class w{constructor(A,B){this.id=B.id,this.opcode=B.opcode,this.fields=B.fields,this.inputs=B.inputs,this.mutation=B.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:t}=r.sequencer,{opcode:e,fields:i,inputs:Q}=this;this._isHat=t.getIsHat(e),this._blockFunction=t.getOpcodeFunction(e),this._definedBlockFunction=void 0!==this._blockFunction;const s=Object.keys(i);this._isShadowBlock=!this._definedBlockFunction&&1===s.length&&0===Object.keys(Q).length,this._shadowValue=this._isShadowBlock&&i[s[0]].value;for(const A in i)this._argValues[A]="VARIABLE"===A||"LIST"===A||"BROADCAST_OPTION"===A?{id:i[A].id,name:i[A].value}:i[A].value;if(delete this._inputs.custom_block,"BROADCAST_INPUT"in this._inputs){this._argValues.BROADCAST_OPTION={id:null,name:null};const B=this._inputs.BROADCAST_INPUT;if(B.block===B.shadow){const t=A.getBlock(B.shadow).fields.BROADCAST_OPTION;this._argValues.BROADCAST_OPTION.id=t.id,this._argValues.BROADCAST_OPTION.name=t.value,delete this._inputs.BROADCAST_INPUT}}for(const B in this._inputs){const t=this._inputs[B];if(t.block){const e=g.getCached(A,t.block,w);if(e._isHat)continue;this._ops.push(...e._ops),e._parentKey=B,e._parentValues=this._argValues,e._isShadowBlock&&(this._argValues[B]=e._shadowValue)}}this._definedBlockFunction&&this._ops.push(this)}}A.exports=function(A,B){const t=A.runtime;r.sequencer=A,r.thread=B;const e=B.peekStack(),i=B.peekStackFrame();let s=B.blockContainer,C=g.getCached(s,e,w);if(null===C&&(s=t.flyoutBlocks,C=g.getCached(s,e,w),null===C))return void A.retireThread(B);const a=C._ops,I=a.length;let Y=0;if(null!==i.reported){const A=i.reported;for(;YA.id===B);if(e){const A=e._parentKey,B=e._parentValues;"BROADCAST_INPUT"===A?(B.BROADCAST_OPTION.id=null,B.BROADCAST_OPTION.name=n.toString(t)):B[A]=t}}if(A.length>0){const B=A.reverse().find(A=>a.find(B=>B.id===A.opCached));Y=B?a.findIndex(A=>A.id===B.opCached)+1:0}if(null!==B.justReported&&a[Y]&&a[Y].id===i.reporting){const A=a[Y],t=B.justReported;B.justReported=null;const e=A._parentKey,g=A._parentValues;"BROADCAST_INPUT"===e?(g.BROADCAST_OPTION.id=null,g.BROADCAST_OPTION.name=n.toString(t)):g[e]=t,Y+=1}i.reporting=null,i.reported=null}const h=Y;for(;Y{const B=A._parentKey,t=A._parentValues;return"BROADCAST_INPUT"===B?{opCached:A.id,inputValue:t[B].BROADCAST_OPTION.name}:{opCached:A.id,inputValue:t[B]}});break}if(B.status===Q.STATUS_RUNNING)if(t)E(w,A,B,e,t);else{const A=e._parentKey,B=e._parentValues;"BROADCAST_INPUT"===A?(B.BROADCAST_OPTION.id=null,B.BROADCAST_OPTION.name=n.toString(w)):B[A]=w}}var M;if(null!==t.profiler){C._profiler!==t.profiler&&function(A,B){B._profiler=A,-1===c&&(c=A.idByName("blockFunction"));const t=B._ops;for(let B=0;Bthis._setupPreview()):null}disableVideo(){if(this._disablePreview(),!this.provider)return null;this.provider.disableVideo()}getFrame(A){let{dimensions:B=g.DIMENSIONS,mirror:t=this.mirror,format:e=g.FORMAT_IMAGE_DATA,cacheTimeout:i=this._frameCacheTimeout}=A;return this.provider?this.provider.getFrame({dimensions:B,mirror:t,format:e,cacheTimeout:i}):null}setPreviewGhost(A){this._ghost=A,-1!==this._drawable&&this.runtime.renderer.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:A)}_disablePreview(){-1!==this._skinId&&(this.runtime.renderer.updateBitmapSkin(this._skinId,new ImageData(...g.DIMENSIONS),1),this.runtime.renderer.updateDrawableVisible(this._drawable,!1)),this._renderPreviewFrame=null}_setupPreview(){const{renderer:A}=this.runtime;A&&(-1===this._skinId&&-1===this._drawable&&(this._skinId=A.createBitmapSkin(new ImageData(...g.DIMENSIONS),1),this._drawable=A.createDrawable(e.VIDEO_LAYER),A.updateDrawableSkinId(this._drawable,this._skinId),A.markSkinAsPrivate&&A.markSkinAsPrivate(this._skinId)),this._renderPreviewFrame||(A.updateDrawableEffect(this._drawable,"ghost",this._forceTransparentPreview?100:this._ghost),A.updateDrawableVisible(this._drawable,!0),this._renderPreviewFrame=()=>{if(clearTimeout(this._renderPreviewTimeout),!this._renderPreviewFrame)return;this._renderPreviewTimeout=setTimeout(this._renderPreviewFrame,this.runtime.currentStepTime);const B=this.getFrame({format:g.FORMAT_IMAGE_DATA,cacheTimeout:this.runtime.currentStepTime});B?(A.updateBitmapSkin(this._skinId,B,1),this.runtime.requestRedraw()):A.updateBitmapSkin(this._skinId,new ImageData(...g.DIMENSIONS),1)},this._renderPreviewFrame()))}get videoReady(){return!!this.provider&&this.provider.videoReady}postData(A){let{forceTransparentPreview:B}=A;this._forceTransparentPreview=B,this.setPreviewGhost(this._ghost)}}A.exports=g},function(A,B,t){"use strict";var e=window.URL||window.webkitURL;A.exports=function(A,B){try{try{var t;try{(t=new(window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)).append(A),t=t.getBlob()}catch(B){t=new Blob([A])}return new Worker(e.createObjectURL(t))}catch(B){return new Worker("data:application/javascript,"+encodeURIComponent(A))}}catch(A){if(!B)throw Error("Inline worker is not supported");return new Worker(B)}}},function(A,B,t){const e=t(6);A.exports=A=>{const B={};for(let t=0;t{const t=[],e=A=>{A.localName!==B&&void 0!==B||!A.getAttribute||t.push(A);for(let B=0;B{const B=document.createElement("span"),t=A.outerHTML,g=e.sanitize(t,{USE_PROFILES:{svg:!0},FORBID_TAGS:["a","audio","canvas","video"],ADD_DATA_URI_TAGS:["image"]});let i,Q;try{B.innerHTML=g,document.body.appendChild(B),i=B.children[0].getBBox()}finally{document.body.removeChild(B)}Q=0===i.width||0===i.height?0:(A=>{let B=0;const t=A=>{A.getAttribute&&(A.getAttribute("stroke")&&(B=Math.max(B,1)),A.getAttribute("stroke-width")&&(B=Math.max(B,Number(A.getAttribute("stroke-width"))||0)));for(let B=0;B{B&&(A=>{const B=n(A,"linearGradient");for(const A of B)A.getAttribute("x2")||A.setAttribute("x2","0")})(A),s(A,window),(A=>{const B=n(A,"image"),t="image-rendering: optimizespeed; image-rendering: pixelated;";for(const A of B)A.getAttribute("style")?A.setAttribute("style","".concat(t," ").concat(A.getAttribute("style"))):A.setAttribute("style",t)})(A),B?((A=>{const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B{const B=n(A);for(const A of B){if(!A.style)continue;const B=A.style.stroke||A.getAttribute("stroke");B&&B.match(/^url\(#.*\)$/)&&(A.style["stroke-linejoin"]="round",A.style["stroke-linecap"]="round")}})(A)):A.getAttribute("viewBox")?A.getAttribute("width")&&A.getAttribute("height")||(A.setAttribute("width",A.viewBox.baseVal.width),A.setAttribute("height",A.viewBox.baseVal.height)):r(A)};A.exports=(A,B)=>{const t=new DOMParser;A=Q(A);const e=t.parseFromString(A,"text/xml");if(e.childNodes.length<1||"svg"!==e.documentElement.localName)throw new Error("Document does not appear to be SVG.");const g=e.documentElement;return c(g,B),g}},function(A,B,t){ /*! @license DOMPurify | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.2.2/LICENSE */ -A.exports=function(){"use strict";var A=Object.hasOwnProperty,B=Object.setPrototypeOf,t=Object.isFrozen,e=Object.getPrototypeOf,g=Object.getOwnPropertyDescriptor,i=Object.freeze,Q=Object.seal,s=Object.create,n="undefined"!=typeof Reflect&&Reflect,r=n.apply,E=n.construct;r||(r=function(A,B,t){return A.apply(B,t)}),i||(i=function(A){return A}),Q||(Q=function(A){return A}),E||(E=function(A,B){return new(Function.prototype.bind.apply(A,[null].concat(function(A){if(Array.isArray(A)){for(var B=0,t=Array(A.length);B1?t-1:0),g=1;g/gm),S=Q(/^data-[\-\w.\u00B7-\uFFFF]/),b=Q(/^aria-[\-\w]+$/),z=Q(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),L=Q(/^(?:\w+script|data):/i),P=Q(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A};function W(A){if(Array.isArray(A)){for(var B=0,t=Array(A.length);B0&&void 0!==arguments[0]?arguments[0]:V(),t=function(B){return A(B)};if(t.version="2.2.7",t.removed=[],!B||!B.document||9!==B.document.nodeType)return t.isSupported=!1,t;var e=B.document,g=B.document,Q=B.DocumentFragment,s=B.HTMLTemplateElement,n=B.Node,r=B.Element,E=B.NodeFilter,c=B.NamedNodeMap,u=void 0===c?B.NamedNodeMap||B.MozNamedAttrMap:c,O=B.Text,X=B.Comment,Z=B.DOMParser,_=B.trustedTypes,q=r.prototype,$=U(q,"cloneNode"),AA=U(q,"nextSibling"),BA=U(q,"childNodes"),tA=U(q,"parentNode");if("function"==typeof s){var eA=g.createElement("template");eA.content&&eA.content.ownerDocument&&(g=eA.content.ownerDocument)}var gA=K(_,e),iA=gA&&jA?gA.createHTML(""):"",QA=g,sA=QA.implementation,nA=QA.createNodeIterator,rA=QA.getElementsByTagName,EA=QA.createDocumentFragment,cA=e.importNode,oA={};try{oA=d(g).documentMode?g.documentMode:{}}catch(A){}var wA={};t.isSupported="function"==typeof tA&&sA&&void 0!==sA.createHTMLDocument&&9!==oA;var CA=j,aA=x,IA=S,YA=b,hA=L,MA=P,FA=z,DA=null,uA=l({},[].concat(W(N),W(m),W(G),W(H),W(p))),lA=null,dA=l({},[].concat(W(J),W(y),W(k),W(T))),UA=null,NA=null,mA=!0,GA=!0,fA=!1,HA=!1,RA=!1,pA=!1,JA=!1,yA=!1,kA=!1,TA=!0,jA=!1,xA=!0,SA=!0,bA=!1,zA={},LA=l({},["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"]),PA=null,vA=l({},["audio","video","img","source","image","track"]),WA=null,VA=l({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),KA=null,OA=g.createElement("form"),XA=function(A){KA&&KA===A||(A&&"object"===(void 0===A?"undefined":v(A))||(A={}),A=d(A),DA="ALLOWED_TAGS"in A?l({},A.ALLOWED_TAGS):uA,lA="ALLOWED_ATTR"in A?l({},A.ALLOWED_ATTR):dA,WA="ADD_URI_SAFE_ATTR"in A?l(d(VA),A.ADD_URI_SAFE_ATTR):VA,PA="ADD_DATA_URI_TAGS"in A?l(d(vA),A.ADD_DATA_URI_TAGS):vA,UA="FORBID_TAGS"in A?l({},A.FORBID_TAGS):{},NA="FORBID_ATTR"in A?l({},A.FORBID_ATTR):{},zA="USE_PROFILES"in A&&A.USE_PROFILES,mA=!1!==A.ALLOW_ARIA_ATTR,GA=!1!==A.ALLOW_DATA_ATTR,fA=A.ALLOW_UNKNOWN_PROTOCOLS||!1,HA=A.SAFE_FOR_TEMPLATES||!1,RA=A.WHOLE_DOCUMENT||!1,yA=A.RETURN_DOM||!1,kA=A.RETURN_DOM_FRAGMENT||!1,TA=!1!==A.RETURN_DOM_IMPORT,jA=A.RETURN_TRUSTED_TYPE||!1,JA=A.FORCE_BODY||!1,xA=!1!==A.SANITIZE_DOM,SA=!1!==A.KEEP_CONTENT,bA=A.IN_PLACE||!1,FA=A.ALLOWED_URI_REGEXP||FA,HA&&(GA=!1),kA&&(yA=!0),zA&&(DA=l({},[].concat(W(p))),lA=[],!0===zA.html&&(l(DA,N),l(lA,J)),!0===zA.svg&&(l(DA,m),l(lA,y),l(lA,T)),!0===zA.svgFilters&&(l(DA,G),l(lA,y),l(lA,T)),!0===zA.mathMl&&(l(DA,H),l(lA,k),l(lA,T))),A.ADD_TAGS&&(DA===uA&&(DA=d(DA)),l(DA,A.ADD_TAGS)),A.ADD_ATTR&&(lA===dA&&(lA=d(lA)),l(lA,A.ADD_ATTR)),A.ADD_URI_SAFE_ATTR&&l(WA,A.ADD_URI_SAFE_ATTR),SA&&(DA["#text"]=!0),RA&&l(DA,["html","head","body"]),DA.table&&(l(DA,["tbody"]),delete UA.tbody),i&&i(A),KA=A)},ZA=l({},["mi","mo","mn","ms","mtext"]),_A=l({},["foreignobject","desc","title","annotation-xml"]),qA=l({},m);l(qA,G),l(qA,f);var $A=l({},H);l($A,R);var AB="http://www.w3.org/1998/Math/MathML",BB="http://www.w3.org/2000/svg",tB="http://www.w3.org/1999/xhtml",eB=function(A){var B=tA(A);B&&B.tagName||(B={namespaceURI:tB,tagName:"template"});var t=a(A.tagName),e=a(B.tagName);if(A.namespaceURI===BB)return B.namespaceURI===tB?"svg"===t:B.namespaceURI===AB?"svg"===t&&("annotation-xml"===e||ZA[e]):Boolean(qA[t]);if(A.namespaceURI===AB)return B.namespaceURI===tB?"math"===t:B.namespaceURI===BB?"math"===t&&_A[e]:Boolean($A[t]);if(A.namespaceURI===tB){if(B.namespaceURI===BB&&!_A[e])return!1;if(B.namespaceURI===AB&&!ZA[e])return!1;var g=l({},["title","style","font","a","script"]);return!$A[t]&&(g[t]||!qA[t])}return!1},gB=function(A){C(t.removed,{element:A});try{A.parentNode.removeChild(A)}catch(B){try{A.outerHTML=iA}catch(B){A.remove()}}},iB=function(A,B){try{C(t.removed,{attribute:B.getAttributeNode(A),from:B})}catch(A){C(t.removed,{attribute:null,from:B})}if(B.removeAttribute(A),"is"===A&&!lA[A])if(yA||kA)try{gB(B)}catch(A){}else try{B.setAttribute(A,"")}catch(A){}},QB=function(A){var B=void 0,t=void 0;if(JA)A=""+A;else{var e=I(A,/^[\r\n\t ]+/);t=e&&e[0]}var i=gA?gA.createHTML(A):A;try{B=(new Z).parseFromString(i,"text/html")}catch(A){}if(!B||!B.documentElement){var Q=(B=sA.createHTMLDocument("")).body;Q.parentNode.removeChild(Q.parentNode.firstElementChild),Q.outerHTML=i}return A&&t&&B.body.insertBefore(g.createTextNode(t),B.body.childNodes[0]||null),rA.call(B,RA?"html":"body")[0]},sB=function(A){return nA.call(A.ownerDocument||A,A,E.SHOW_ELEMENT|E.SHOW_COMMENT|E.SHOW_TEXT,(function(){return E.FILTER_ACCEPT}),!1)},nB=function(A){return!(A instanceof O||A instanceof X||"string"==typeof A.nodeName&&"string"==typeof A.textContent&&"function"==typeof A.removeChild&&A.attributes instanceof u&&"function"==typeof A.removeAttribute&&"function"==typeof A.setAttribute&&"string"==typeof A.namespaceURI&&"function"==typeof A.insertBefore)},rB=function(A){return"object"===(void 0===n?"undefined":v(n))?A instanceof n:A&&"object"===(void 0===A?"undefined":v(A))&&"number"==typeof A.nodeType&&"string"==typeof A.nodeName},EB=function(A,B,e){wA[A]&&o(wA[A],(function(A){A.call(t,B,e,KA)}))},cB=function(A){var B=void 0;if(EB("beforeSanitizeElements",A,null),nB(A))return gB(A),!0;if(I(A.nodeName,/[\u0080-\uFFFF]/))return gB(A),!0;var e=a(A.nodeName);if(EB("uponSanitizeElement",A,{tagName:e,allowedTags:DA}),!rB(A.firstElementChild)&&(!rB(A.content)||!rB(A.content.firstElementChild))&&F(/<[/\w]/g,A.innerHTML)&&F(/<[/\w]/g,A.textContent))return gB(A),!0;if(!DA[e]||UA[e]){if(SA&&!LA[e]){var g=tA(A),i=BA(A);if(i&&g)for(var Q=i.length-1;Q>=0;--Q)g.insertBefore($(i[Q],!0),AA(A))}return gB(A),!0}return A instanceof r&&!eB(A)?(gB(A),!0):"noscript"!==e&&"noembed"!==e||!F(/<\/no(script|embed)/i,A.innerHTML)?(HA&&3===A.nodeType&&(B=A.textContent,B=Y(B,CA," "),B=Y(B,aA," "),A.textContent!==B&&(C(t.removed,{element:A.cloneNode()}),A.textContent=B)),EB("afterSanitizeElements",A,null),!1):(gB(A),!0)},oB=function(A,B,t){if(xA&&("id"===B||"name"===B)&&(t in g||t in OA))return!1;if(GA&&F(IA,B));else if(mA&&F(YA,B));else{if(!lA[B]||NA[B])return!1;if(WA[B]);else if(F(FA,Y(t,MA,"")));else if("src"!==B&&"xlink:href"!==B&&"href"!==B||"script"===A||0!==h(t,"data:")||!PA[A])if(fA&&!F(hA,Y(t,MA,"")));else if(t)return!1}return!0},wB=function(A){var B=void 0,e=void 0,g=void 0,i=void 0;EB("beforeSanitizeAttributes",A,null);var Q=A.attributes;if(Q){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:lA};for(i=Q.length;i--;){var n=B=Q[i],r=n.name,E=n.namespaceURI;if(e=M(B.value),g=a(r),s.attrName=g,s.attrValue=e,s.keepAttr=!0,s.forceKeepAttr=void 0,EB("uponSanitizeAttribute",A,s),e=s.attrValue,!s.forceKeepAttr&&(iB(r,A),s.keepAttr))if(F(/\/>/i,e))iB(r,A);else{HA&&(e=Y(e,CA," "),e=Y(e,aA," "));var c=A.nodeName.toLowerCase();if(oB(c,g,e))try{E?A.setAttributeNS(E,r,e):A.setAttribute(r,e),w(t.removed)}catch(A){}}}EB("afterSanitizeAttributes",A,null)}},CB=function A(B){var t=void 0,e=sB(B);for(EB("beforeSanitizeShadowDOM",B,null);t=e.nextNode();)EB("uponSanitizeShadowNode",t,null),cB(t)||(t.content instanceof Q&&A(t.content),wB(t));EB("afterSanitizeShadowDOM",B,null)};return t.sanitize=function(A,g){var i=void 0,s=void 0,r=void 0,E=void 0,c=void 0;if(A||(A="\x3c!--\x3e"),"string"!=typeof A&&!rB(A)){if("function"!=typeof A.toString)throw D("toString is not a function");if("string"!=typeof(A=A.toString()))throw D("dirty is not a string, aborting")}if(!t.isSupported){if("object"===v(B.toStaticHTML)||"function"==typeof B.toStaticHTML){if("string"==typeof A)return B.toStaticHTML(A);if(rB(A))return B.toStaticHTML(A.outerHTML)}return A}if(pA||XA(g),t.removed=[],"string"==typeof A&&(bA=!1),bA);else if(A instanceof n)1===(s=(i=QB("\x3c!----\x3e")).ownerDocument.importNode(A,!0)).nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?i=s:i.appendChild(s);else{if(!yA&&!HA&&!RA&&-1===A.indexOf("<"))return gA&&jA?gA.createHTML(A):A;if(!(i=QB(A)))return yA?null:iA}i&&JA&&gB(i.firstChild);for(var o=sB(bA?A:i);r=o.nextNode();)3===r.nodeType&&r===E||cB(r)||(r.content instanceof Q&&CB(r.content),wB(r),E=r);if(E=null,bA)return A;if(yA){if(kA)for(c=EA.call(i.ownerDocument);i.firstChild;)c.appendChild(i.firstChild);else c=i;return TA&&(c=cA.call(e,c,!0)),c}var w=RA?i.outerHTML:i.innerHTML;return HA&&(w=Y(w,CA," "),w=Y(w,aA," ")),gA&&jA?gA.createHTML(w):w},t.setConfig=function(A){XA(A),pA=!0},t.clearConfig=function(){KA=null,pA=!1},t.isValidAttribute=function(A,B,t){KA||XA({});var e=a(A),g=a(B);return oB(e,g,t)},t.addHook=function(A,B){"function"==typeof B&&(wA[A]=wA[A]||[],C(wA[A],B))},t.removeHook=function(A){wA[A]&&w(wA[A])},t.removeHooks=function(A){wA[A]&&(wA[A]=[])},t.removeAllHooks=function(){wA={}},t}()}()},function(A,B){A.exports=function(A){const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B1&&void 0!==arguments[1]?arguments[1]:0}}function a(){for(var A=arguments.length,B=Array(A),t=0;t1&&void 0!==arguments[1]?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return F(A*M/180,B,t)}function u(A){var B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return w(B)&&(B=A),{a:A,c:0,e:0,b:0,d:B,f:0}}function l(A,B){return{a:1,c:A,e:0,b:B,d:1,f:0}}var d=Math.tan;function U(A,B){return{a:1,c:d(A),e:0,b:d(B),d:1,f:0}}function N(A,B){return U(A*Math.PI/180,B*Math.PI/180)}function m(A){return f(A)}function G(A){return f(A)}function f(A){return"matrix("+A.a+","+A.b+","+A.c+","+A.d+","+A.e+","+A.f+")"}t.d(B,"applyToPoint",(function(){return e})),t.d(B,"applyToPoints",(function(){return g})),t.d(B,"fromObject",(function(){return i})),t.d(B,"fromString",(function(){return s})),t.d(B,"identity",(function(){return n})),t.d(B,"inverse",(function(){return r})),t.d(B,"isAffineMatrix",(function(){return o})),t.d(B,"rotate",(function(){return F})),t.d(B,"rotateDEG",(function(){return D})),t.d(B,"scale",(function(){return u})),t.d(B,"shear",(function(){return l})),t.d(B,"skew",(function(){return U})),t.d(B,"skewDEG",(function(){return N})),t.d(B,"toCSS",(function(){return m})),t.d(B,"toSVG",(function(){return G})),t.d(B,"toString",(function(){return f})),t.d(B,"transform",(function(){return a})),t.d(B,"compose",(function(){return I})),t.d(B,"translate",(function(){return C}))}])},function(A,B,t){const e=t(83);A.exports=(A,B)=>{let t=(new XMLSerializer).serializeToString(A);return B&&(t=e(t)),t}},function(A,B,t){const e=t(84);A.exports=function(A){const B=e();if("string"!=typeof A)throw new Error("SVG to be inlined is not a string");const t=new Set,g=/font-family="([^"]*)"/g;let i=g.exec(A);for(;i;)t.add(i[1]),i=g.exec(A);if(t.size>0){let e="",A=A.replace(/]*>/,"$&".concat(e))}return A}},function(A,B,t){let e;A.exports=function(){if(e)return e;e={"Sans Serif":t(244),Serif:t(245),Handwriting:t(246),Marker:t(247),Curly:t(248),Pixel:t(249),Scratch:t(250)};for(const A in e){const B=e[A];e[A]="@font-face {"+'font-family: "'.concat(A,'";src: url("data:application/x-font-ttf;charset=utf-8;base64,').concat(B,'");}')}if(!document.getElementById("scratch-font-styles")){const A=document.createElement("style");A.id="scratch-font-styles";for(const B in e)A.textContent+=e[B];document.body.insertBefore(A,document.body.firstChild)}return e}},function(A,B,t){var e=t(255),g=e(t(256)),i=e(t(258)),Q=e(t(259));A.exports=function(A,B,t){g(A,B).then((function(A){return i(A[0]).then(Q.bind(null,B)).then((function(B){return[B,A[1]]}))})).then(t.bind(null,null),t)}},function(A,B,t){const e=t(26),g=t(16),{loadSoundFromAsset:i}=t(31),{loadCostumeFromAsset:Q}=t(30),s=t(77),n=t(7),r=t(14);class E{constructor(A,B){this.runtime=B,A||(A=new g(B)),this.blocks=A,this.name="",this.costumes_=[],this.sounds=[],this.clones=[],this.soundBank=null,this.runtime&&this.runtime.audioEngine&&(this.soundBank=this.runtime.audioEngine.createBank())}set costumes(A){this.costumes_=[];for(const B of A)this.addCostumeAt(B,this.costumes_.length)}get costumes(){return this.costumes_}addCostumeAt(A,B){A.name||(A.name="");const t=this.costumes_.map(A=>A.name);A.name=n.unusedName(A.name,t),this.costumes_.splice(B,0,A)}deleteCostumeAt(A){return this.costumes.splice(A,1)[0]}createClone(A){const B=new e(this,this.runtime);if(B.isOriginal=0===this.clones.length,this.clones.push(B),B.initAudio(),B.isOriginal){const t="string"==typeof A?A:r.SPRITE_LAYER;B.initDrawable(t),this.runtime.fireTargetWasCreated(B)}else this.runtime.fireTargetWasCreated(B,this.clones[0]);return B}removeClone(A){this.runtime.fireTargetWasRemoved(A);const B=this.clones.indexOf(A);B>=0&&this.clones.splice(B,1)}duplicate(){const A=new E(null,this.runtime),B=this.blocks._blocks,t=Object.keys(B).map(A=>B[A]),e=JSON.parse(JSON.stringify(t));s(e),e.forEach(B=>{A.blocks.createBlock(B)});const g=this.runtime.targets.map(A=>A.sprite.name);A.name=n.unusedName(this.name,g);const r=[];return A.costumes=this.costumes_.map(A=>{const B=Object.assign({},A);return r.push(Q(B,this.runtime)),B}),A.sounds=this.sounds.map(B=>{const t=Object.assign({},B),e=B.asset;return r.push(i(t,e,this.runtime,A.soundBank)),t}),Promise.all(r).then(()=>A)}dispose(){this.soundBank&&this.soundBank.dispose()}}A.exports=E},function(A,B,t){const e=t(19),g=t(0);A.exports={deserializeSound:function(A,B,t,i){const Q=i||A.md5,s=B.storage;if(!s)return g.warn("No storage module present; cannot load sound asset: ",Q),Promise.resolve(null);if(!t)return Promise.resolve(null);let n=t.file(Q);if(!n){const A=new RegExp("^([^/]*/)?".concat(Q,"$"));n=t.file(A)[0]}if(!n)return g.error("Could not find sound file associated with the ".concat(A.name," sound.")),Promise.resolve(null);if(!e.support.uint8array)return g.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);const r="mp3"===A.dataFormat.toLowerCase()?s.DataFormat.MP3:s.DataFormat.WAV;return n.async("uint8array").then(A=>s.createAsset(s.AssetType.Sound,r,A,null,!0)).then(B=>{A.asset=B,A.assetId=B.assetId,A.md5="".concat(B.assetId,".").concat(B.dataFormat)})},deserializeCostume:function(A,B,t,i,Q){const s=B.storage,n=A.assetId,r=i||"".concat(n,".").concat(A.dataFormat);if(!s)return g.warn("No storage module present; cannot load costume asset: ",r),Promise.resolve(null);if(A.asset)return Promise.resolve(s.createAsset(A.asset.assetType,A.asset.dataFormat,new Uint8Array(Object.keys(A.asset.data).map(B=>A.asset.data[B])),null,!0)).then(B=>{A.asset=B,A.assetId=B.assetId,A.md5="".concat(B.assetId,".").concat(B.dataFormat)});if(!t)return Promise.resolve(null);let E=t.file(r);if(!E){const A=new RegExp("^([^/]*/)?".concat(r,"$"));E=t.file(A)[0]}if(!E)return g.error("Could not find costume file associated with the ".concat(A.name," costume.")),Promise.resolve(null);let c=null;const o=A.dataFormat.toLowerCase();if("svg"===o?c=s.AssetType.ImageVector:["png","bmp","jpeg","jpg","gif"].indexOf(o)>=0?c=s.AssetType.ImageBitmap:g.error("Unexpected file format for costume: ".concat(o)),!e.support.uint8array)return g.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);let w;if(A.textLayerMD5){const B=t.file(Q);if(!B)return g.error("Could not find text layer file associated with the ".concat(A.name," costume.")),Promise.resolve(null);w=B.async("uint8array").then(B=>s.createAsset(s.AssetType.ImageBitmap,"png",B,A.textLayerMD5)).then(B=>{A.textLayerAsset=B})}else w=Promise.resolve(null);return Promise.all([w,E.async("uint8array").then(A=>s.createAsset(c,o,A,null,!0)).then(B=>{A.asset=B,A.assetId=B.assetId,A.md5="".concat(B.assetId,".").concat(B.dataFormat)})])}}},function(A,B,t){const e=t(16),g=t(26),i=t(86),Q=t(21),s=t(0),n=t(6),r=t(7),E=t(3),c=t(262),o=t(40),w=t(8),C=t(38),a=t(14),{loadCostume:I}=t(30),{loadSound:Y}=t(31),{deserializeCostume:h,deserializeSound:M}=t(87),F=["argument","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],D=function(A){const B=[{}];let t=0;const e=A.split(/(?=[^\\]%[nbs])/);for(let A=0;AA.inputName).filter(A=>A)},l=function A(B){let t=[];for(let e=0;e"".concat(A,"-").concat(r.replaceUnsafeChars(B),"-").concat(t);return function(t,e){return e&&(A={}),function(g,i){return e?(A["".concat(g,"-").concat(i)]=B(t,g,i),A["".concat(g,"-").concat(i)]):A["".concat(g,"-").concat(i)]?A["".concat(g,"-").concat(i)]:B(t,g,i)}}}(),N=function(){let A={};const B=[],t=n();return function(e){return e&&(A={}),{broadcastMsgMapUpdater:function(e,g){return""===(e=e.toLowerCase())&&(e=t),A[e]="broadcastMsgId-".concat(r.replaceUnsafeChars(e)),B.push(g),A[e]},globalBroadcastMsgs:A,allBroadcastFields:B,emptyMsgName:t}}}(),m=(A,B,t,e)=>{if(!c[A.cmd])return void s.warn("Could not find monitor block with opcode: ".concat(A.cmd));const g=c[A.cmd].opcode,i=g.indexOf("_"),Q=g.substring(0,i);if("videoSensing"===Q)return;if(-1===F.indexOf(Q)&&""!==Q&&!e.extensionIDs.has(Q)&&!A.visible)return;let n=null;if(!A.hasOwnProperty("target"))for(let B=0;B{const t=e.variables[B];return t.type===w.LIST_TYPE&&t.name===A.listName}).length>0&&(n=e,A.target=e.getName())}if(n=n||t.filter(B=>B.getName()===A.target)[0],!n)throw new Error("Cannot create monitor for target that cannot be found by name");const r=U(n.id,!1),[E,o]=H([A.cmd,A.param],null,r,e,{},null,null);"getVar:"===A.cmd?E.id=r(A.param,w.SCALAR_TYPE):"contentsOfList:"===A.cmd?E.id=r(A.param,w.LIST_TYPE):B.monitorBlockInfo.hasOwnProperty(E.opcode)?E.id=B.monitorBlockInfo[E.opcode].getId(n.id,E.fields):E.id=E.opcode,E.targetId=n.isStage?null:n.id,E.isMonitored=A.visible;const a=B.monitorBlocks._blocks[E.id];if(a)a.isMonitored=A.visible,a.targetId=E.targetId;else{const A=l([E]);for(let t=0;t{const[B,t,e,g,i,Q,s]=A,n=A[5]>=0,r=new o(null,s,n?null:1.5*B,n?null:2.2*t,1.5*e,2.2*g,!i);return n&&(r.blockId=Q,G.hasOwnProperty(Q)?G[Q].push(r):G[Q]=[r]),r}).forEach(A=>{M.comments[A.id]=A})}B.hasOwnProperty("scripts")&&function(A,B,t,e,g,i){let Q=0;for(let s=0;s{"number"==typeof A.blockId&&(A.blockId=null)})}if(c.updateTargetSpecificBlocks(s),B.hasOwnProperty("lists"))for(let A=0;A{C.costumes=A}),Promise.all(h).then(A=>{C.sounds=A,C.soundBank=Y||null});const f=[];if(B.children)for(let e=0;ePromise.all(f).then(A=>{if(M.isStage){const A=D.globalBroadcastMsgs,B=D.allBroadcastFields,t=D.emptyMsgName;if(A[t]){let e=1;for(;A["message".concat(e)];)e+=1;const g="message".concat(e);A[g]=A[t],delete A[t];for(let A=0;A(A.layerOrder=B,A)).sort((A,B)=>A.targetPaneOrder-B.targetPaneOrder);return B.forEach(A=>{delete A.targetPaneOrder}),B},H=function A(B,t,e,g,i,r,E){const o=r&&"number"==typeof E&&!isNaN(E)?r[E]:null,C=function(A){const B=A[0],t=B&&c[B];return t?"function"==typeof t?t(A):t:(s.warn("Couldn't find SB2 block: ".concat(B)),null)}(B);if(!C)return o&&o.forEach(A=>{A.blockId=null,A.x=A.y=0}),[null,E+1];const a=B[0],I=C.opcode.indexOf("_"),Y=C.opcode.substring(0,I);-1===F.indexOf(Y)&&""!==Y&&g.extensionIDs.add(Y);const h={id:n(),opcode:C.opcode,inputs:{},fields:{},next:null,shadow:!1,children:[]};o&&(h.comment=o[o.length-1].id,o.forEach(A=>{A.id===h.comment?A.blockId=h.id:(A.blockId=null,A.x=A.y=0)})),E++;const M=i.expectedArg;"call"===a&&(C.argMap=D(B[1]));for(let c=0;c0){let A=null;for(let t=0;tI(n.md5,n,t,2)))}const{soundBank:s,soundPromises:n}=i;if(B.hasOwnProperty("sounds"))for(let A=0;AY(i,t,s)))}const E=i.children;if(B.children)for(let e=0;ePromise.resolve(A)).then(i=>G(A,B,g,!t,e,i)).then(f).then(A=>({targets:A,extensions:g}))}}},function(A,B){class t{constructor(){this.left=-1/0,this.right=1/0,this.bottom=-1/0,this.top=1/0}initFromBounds(A,B,t,e){this.left=A,this.right=B,this.bottom=t,this.top=e}initFromPointsAABB(A){this.left=1/0,this.right=-1/0,this.top=-1/0,this.bottom=1/0;for(let B=0;Bthis.right&&(this.right=t),e>this.top&&(this.top=e),e=A.bottom&&A.top>=this.bottom}contains(A){return A.left>this.left&&A.rightthis.bottom}clamp(A,B,t,e){this.left=Math.max(this.left,A),this.right=Math.min(this.right,B),this.bottom=Math.max(this.bottom,t),this.top=Math.min(this.top,e),this.left=Math.min(this.left,B),this.right=Math.max(this.right,A),this.bottom=Math.min(this.bottom,e),this.top=Math.max(this.top,t)}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(A,B){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t;return e.left=Math.max(A.left,B.left),e.right=Math.min(A.right,B.right),e.top=Math.min(A.top,B.top),e.bottom=Math.max(A.bottom,B.bottom),e}static union(A,B){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t;return e.left=Math.min(A.left,B.left),e.right=Math.max(A.right,B.right),e.top=Math.max(A.top,B.top),e.bottom=Math.min(A.bottom,B.bottom),e}get width(){return Math.abs(this.left-this.right)}get height(){return Math.abs(this.top-this.bottom)}}A.exports=t},function(A,B,t){const e=t(9),{rgbToHsv:g,hsvToRgb:i}=t(274),Q=t(24),s=[0,0,0];A.exports=class{static transformColor(A,B,t){if(0===B[3])return B;let e=A.enabledEffects;"number"==typeof t&&(e&=t);const n=A.getUniforms(),r=0!=(e&Q.EFFECT_INFO.color.mask),E=0!=(e&Q.EFFECT_INFO.brightness.mask);if(r||E){const A=B[3]/255;if(B[0]/=A,B[1]/=A,B[2]/=A,r){const A=g(B,s),t=.055,e=.09;A[2]{const t=[],e=A=>{A.localName!==B&&void 0!==B||!A.getAttribute||t.push(A);for(let B=0;B{const B=document.createElement("span"),t=A.outerHTML,g=e.sanitize(t,{USE_PROFILES:{svg:!0},FORBID_TAGS:["a","audio","canvas","video"],ADD_DATA_URI_TAGS:["image"]});let i,Q;try{B.innerHTML=g,document.body.appendChild(B),i=B.children[0].getBBox()}finally{document.body.removeChild(B)}Q=0===i.width||0===i.height?0:(A=>{let B=0;const t=A=>{A.getAttribute&&(A.getAttribute("stroke")&&(B=Math.max(B,1)),A.getAttribute("stroke-width")&&(B=Math.max(B,Number(A.getAttribute("stroke-width"))||0)));for(let B=0;B{B&&(A=>{const B=n(A,"linearGradient");for(const A of B)A.getAttribute("x2")||A.setAttribute("x2","0")})(A),s(A,window),(A=>{const B=n(A,"image"),t="image-rendering: optimizespeed; image-rendering: pixelated;";for(const A of B)A.getAttribute("style")?A.setAttribute("style","".concat(t," ").concat(A.getAttribute("style"))):A.setAttribute("style",t)})(A),B?((A=>{const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B{const B=n(A);for(const A of B){if(!A.style)continue;const B=A.style.stroke||A.getAttribute("stroke");B&&B.match(/^url\(#.*\)$/)&&(A.style["stroke-linejoin"]="round",A.style["stroke-linecap"]="round")}})(A)):A.getAttribute("viewBox")?A.getAttribute("width")&&A.getAttribute("height")||(A.setAttribute("width",A.viewBox.baseVal.width),A.setAttribute("height",A.viewBox.baseVal.height)):r(A)};A.exports=(A,B)=>{const t=new DOMParser;A=Q(A);const e=t.parseFromString(A,"text/xml");if(e.childNodes.length<1||"svg"!==e.documentElement.localName)throw new Error("Document does not appear to be SVG.");const g=e.documentElement;return E(g,B),g}},function(A,B){A.exports=function(A){const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B{let t=(new XMLSerializer).serializeToString(A);return B&&(t=e(t)),t}},function(A,B,t){const e=t(84);A.exports=function(A){const B=e();if("string"!=typeof A)throw new Error("SVG to be inlined is not a string");const t=new Set,g=/font-family="([^"]*)"/g;let i=g.exec(A);for(;i;)t.add(i[1]),i=g.exec(A);if(t.size>0){let e="",A=A.replace(/]*>/,"$&".concat(e))}return A}},function(A,B,t){var e,g;g=t(288),e=function(){function A(A){var B,t,e;(B="function"==typeof A.readUInt32BE&&"function"==typeof A.slice)||A instanceof Uint8Array?(B?(this.highStart=A.readUInt32BE(0),this.errorValue=A.readUInt32BE(4),t=A.readUInt32BE(8),A=A.slice(12)):(e=new DataView(A.buffer),this.highStart=e.getUint32(0),this.errorValue=e.getUint32(4),t=e.getUint32(8),A=A.subarray(12)),A=g(A,new Uint8Array(t)),A=g(A,new Uint8Array(t)),this.data=new Uint32Array(A.buffer)):(this.data=A.data,this.highStart=A.highStart,this.errorValue=A.errorValue)}return 11,5,6,32,64,63,2,32,31,2048,32,2080,2080,32,2112,4,A.prototype.get=function(A){var B;return A<0||A>1114111?this.errorValue:A<55296||A>56319&&A<=65535?(B=(this.data[A>>5]<<2)+(31&A),this.data[B]):A<=65535?(B=(this.data[2048+(A-55296>>5)]<<2)+(31&A),this.data[B]):A>11)],B=((B=this.data[B+(A>>5&63)])<<2)+(31&A),this.data[B]):this.data[this.data.length-4]},A}(),A.exports=e},function(A,B,t){const e=t(45),g={ImageBitmap:{contentType:"image/png",name:"ImageBitmap",runtimeFormat:e.PNG,immutable:!0},ImageVector:{contentType:"image/svg+xml",name:"ImageVector",runtimeFormat:e.SVG,immutable:!0},Project:{contentType:"application/json",name:"Project",runtimeFormat:e.JSON,immutable:!1},Sound:{contentType:"audio/x-wav",name:"Sound",runtimeFormat:e.WAV,immutable:!0},Sprite:{contentType:"application/json",name:"Sprite",runtimeFormat:e.JSON,immutable:!0}};A.exports=g},function(A,B){A.exports=class{constructor(A){this.parent=A}load(A,B,t){return Promise.reject(new Error("No asset of type ".concat(A," for ID ").concat(B," with format ").concat(t)))}}},function(A,B,t){const e=t(47);A.exports=class extends e{get DEFAULT_VALUE(){return 100}get name(){return"volume"}initialize(){this.inputNode=this.audioEngine.audioContext.createGain(),this.outputNode=this.inputNode,this.initialized=!0}_set(A){this.value=A;const{gain:B}=this.outputNode,{currentTime:t,DECAY_DURATION:e}=this.audioEngine;B.linearRampToValueAtTime(A/100,t+e)}dispose(){this.initialized&&(this.outputNode.disconnect(),this.inputNode=null,this.outputNode=null,this.target=null,this.initialized=!1)}}},function(A,B,t){"use strict";var e,g=function(){return void 0===e&&(e=Boolean(window&&document&&document.all&&!window.atob)),e},i=function(){var A={};return function(B){if(void 0===A[B]){var t=document.querySelector(B);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(A){t=null}A[B]=t}return A[B]}}(),Q=[];function s(A){for(var B=-1,t=0;t{const B={};return B._refreshExtensionPrimitives=A._refreshExtensionPrimitives.bind(A),B._registerExtensionPrimitives=A._registerExtensionPrimitives.bind(A),B})(this.runtime)).catch(A=>{r.error("Failed to register runtime service: ".concat(JSON.stringify(A)))}),this.editingTarget=null,this._dragTarget=null,this.runtime.on(c.SCRIPT_GLOW_ON,A=>{this.emit(c.SCRIPT_GLOW_ON,A)}),this.runtime.on(c.SCRIPT_GLOW_OFF,A=>{this.emit(c.SCRIPT_GLOW_OFF,A)}),this.runtime.on(c.BLOCK_GLOW_ON,A=>{this.emit(c.BLOCK_GLOW_ON,A)}),this.runtime.on(c.BLOCK_GLOW_OFF,A=>{this.emit(c.BLOCK_GLOW_OFF,A)}),this.runtime.on(c.PROJECT_START,()=>{this.emit(c.PROJECT_START)}),this.runtime.on(c.PROJECT_RUN_START,()=>{this.emit(c.PROJECT_RUN_START)}),this.runtime.on(c.PROJECT_RUN_STOP,()=>{this.emit(c.PROJECT_RUN_STOP)}),this.runtime.on(c.PROJECT_CHANGED,()=>{this.emit(c.PROJECT_CHANGED)}),this.runtime.on(c.VISUAL_REPORT,A=>{this.emit(c.VISUAL_REPORT,A)}),this.runtime.on(c.TARGETS_UPDATE,A=>{this.emitTargetsUpdate(A)}),this.runtime.on(c.MONITORS_UPDATE,A=>{this.emit(c.MONITORS_UPDATE,A)}),this.runtime.on(c.BLOCK_DRAG_UPDATE,A=>{this.emit(c.BLOCK_DRAG_UPDATE,A)}),this.runtime.on(c.BLOCK_DRAG_END,(A,B)=>{this.emit(c.BLOCK_DRAG_END,A,B)}),this.runtime.on(c.EXTENSION_ADDED,A=>{this.emit(c.EXTENSION_ADDED,A)}),this.runtime.on(c.EXTENSION_FIELD_ADDED,(A,B)=>{this.emit(c.EXTENSION_FIELD_ADDED,A,B)}),this.runtime.on(c.BLOCKSINFO_UPDATE,A=>{this.emit(c.BLOCKSINFO_UPDATE,A)}),this.runtime.on(c.BLOCKS_NEED_UPDATE,()=>{this.emitWorkspaceUpdate()}),this.runtime.on(c.TOOLBOX_EXTENSIONS_NEED_UPDATE,()=>{this.extensionManager.refreshBlocks()}),this.runtime.on(c.PERIPHERAL_LIST_UPDATE,A=>{this.emit(c.PERIPHERAL_LIST_UPDATE,A)}),this.runtime.on(c.USER_PICKED_PERIPHERAL,A=>{this.emit(c.USER_PICKED_PERIPHERAL,A)}),this.runtime.on(c.PERIPHERAL_CONNECTED,()=>this.emit(c.PERIPHERAL_CONNECTED)),this.runtime.on(c.PERIPHERAL_REQUEST_ERROR,()=>this.emit(c.PERIPHERAL_REQUEST_ERROR)),this.runtime.on(c.PERIPHERAL_DISCONNECTED,()=>this.emit(c.PERIPHERAL_DISCONNECTED)),this.runtime.on(c.PERIPHERAL_CONNECTION_LOST_ERROR,A=>this.emit(c.PERIPHERAL_CONNECTION_LOST_ERROR,A)),this.runtime.on(c.PERIPHERAL_SCAN_TIMEOUT,()=>this.emit(c.PERIPHERAL_SCAN_TIMEOUT)),this.runtime.on(c.MIC_LISTENING,A=>{this.emit(c.MIC_LISTENING,A)}),this.runtime.on(c.RUNTIME_STARTED,()=>{this.emit(c.RUNTIME_STARTED)}),this.runtime.on(c.RUNTIME_STOPPED,()=>{this.emit(c.RUNTIME_STOPPED)}),this.runtime.on(c.HAS_CLOUD_DATA_UPDATE,A=>{this.emit(c.HAS_CLOUD_DATA_UPDATE,A)}),this.runtime.on(c.RUNTIME_OPTIONS_CHANGED,A=>{this.emit(c.RUNTIME_OPTIONS_CHANGED,A)}),this.runtime.on(c.COMPILER_OPTIONS_CHANGED,A=>{this.emit(c.COMPILER_OPTIONS_CHANGED,A)}),this.runtime.on(c.FRAMERATE_CHANGED,A=>{this.emit(c.FRAMERATE_CHANGED,A)}),this.runtime.on(c.INTERPOLATION_CHANGED,A=>{this.emit(c.INTERPOLATION_CHANGED,A)}),this.runtime.on(c.STAGE_SIZE_CHANGED,(A,B)=>{this.emit(c.STAGE_SIZE_CHANGED,A,B)}),this.runtime.on(c.COMPILE_ERROR,(A,B)=>{this.emit(c.COMPILE_ERROR,A,B)}),this.extensionManager=new n(this.runtime);for(const A of u)this.extensionManager.loadExtensionIdSync(A);this.blockListener=this.blockListener.bind(this),this.flyoutBlockListener=this.flyoutBlockListener.bind(this),this.monitorBlockListener=this.monitorBlockListener.bind(this),this.variableListener=this.variableListener.bind(this)}start(){this.runtime.start()}stop(){this.runtime.stop()}greenFlag(){this.runtime.greenFlag()}setTurboMode(A){this.runtime.turboMode=!!A,this.runtime.turboMode?this.emit(c.TURBO_MODE_ON):this.emit(c.TURBO_MODE_OFF)}setCompatibilityMode(A){this.runtime.setCompatibilityMode(!!A)}setFramerate(A){this.runtime.setFramerate(A)}setInterpolation(A){this.runtime.setInterpolation(A)}setRuntimeOptions(A){this.runtime.setRuntimeOptions(A)}setCompilerOptions(A){this.runtime.setCompilerOptions(A)}setStageSize(A,B){this.runtime.setStageSize(A,B)}setInEditor(A){this.runtime.setInEditor(A)}convertToPackagedRuntime(){this.runtime.convertToPackagedRuntime()}addAddonBlock(A){this.runtime.addAddonBlock(A)}getAddonBlock(A){return this.runtime.getAddonBlock(A)}storeProjectOptions(){this.runtime.storeProjectOptions(),this.editingTarget.isStage&&this.emitWorkspaceUpdate()}enableDebug(){return this.runtime.enableDebug(),"enabled debug mode"}stopAll(){this.runtime.stopAll()}clear(){this.runtime.dispose(),this.editingTarget=null,this.emitTargetsUpdate(!1)}getPlaygroundData(){const A=this,B=this.runtime.threads.filter(B=>B.target===A.editingTarget),t=JSON.stringify(B,(A,B)=>{if("target"!==A&&"blockContainer"!==A)return B},2);this.emit("playgroundData",{blocks:this.editingTarget.blocks,threads:t})}postIOData(A,B){this.runtime.ioDevices[A]&&this.runtime.ioDevices[A].postData(B)}setVideoProvider(A){this.runtime.ioDevices.video.setProvider(A)}setCloudProvider(A){this.runtime.ioDevices.cloud.setProvider(A)}scanForPeripheral(A){this.runtime.scanForPeripheral(A)}connectPeripheral(A,B){this.runtime.connectPeripheral(A,B)}disconnectPeripheral(A){this.runtime.disconnectPeripheral(A)}getPeripheralIsConnected(A){return this.runtime.getPeripheralIsConnected(A)}loadProject(A){"object"!=typeof A||A instanceof ArrayBuffer||ArrayBuffer.isView(A)||(A=JSON.stringify(A));return new Promise((B,e)=>{const g=t(85);g(A,!1,(t,i)=>{if(t)return"{"!==A[0]&&A[0]!=="{".charCodeAt(0)?e(t):("string"!=typeof A&&(A=(new TextDecoder).decode(A)),A=I.parse(A),A=JSON.stringify(A),g(A,!1,(A,g)=>{if(A)return e(t);B(g)}));B(i)})}).catch(B=>{const{SB1File:e,ValidationError:g}=t(320);try{const B=new e(A),t=B.json;return t.projectVersion=2,Promise.resolve([t,B.zip])}catch(A){if(!(A instanceof g||"".concat(A).includes("Non-ascii character in FixedAsciiString")))return Promise.reject(A)}return Promise.reject(B)}).then(A=>this.deserializeProject(A[0],A[1])).then(()=>this.runtime.emitProjectLoaded()).catch(A=>A.hasOwnProperty("validationError")?Promise.reject(JSON.stringify(A)):Promise.reject(A))}downloadProjectId(A){const B=this.runtime.storage;if(!B)return void r.error("No storage module present; cannot load project: ",A);const t=this;B.load(B.AssetType.Project,A).then(B=>B?t.loadProject(B.data):(r.error("Failed to fetch project with id: ".concat(A)),null))}saveProjectSb3(){const A=M(this.runtime),B=F(this.runtime),t=this.toJSON(),e=new i;return e.file("project.json",t),this._addFileDescsToZip(A.concat(B),e),e.generateAsync({type:"blob",mimeType:"application/x.scratch.sb3",compression:"DEFLATE",compressionOptions:{level:6}})}saveProjectSb3DontZip(){const A=M(this.runtime),B=F(this.runtime),t=this.toJSON(),g={"project.json":(new e).encode(t)};for(const t of A.concat(B))g[t.fileName]=t.fileContent;return g}get assets(){return this.runtime.targets.reduce((A,B)=>A.concat(B.sprite.sounds.map(A=>A.asset)).concat(B.sprite.costumes.map(A=>A.asset)),[])}_addFileDescsToZip(A,B){for(let t=0;t{let{targets:B,extensions:t}=A;return"undefined"!=typeof performance&&(performance.mark("scratch-vm-deserialize-end"),performance.measure("scratch-vm-deserialize","scratch-vm-deserialize-start","scratch-vm-deserialize-end")),this.installTargets(B,t,!0)})}async installTargets(A,B,t){await this.extensionManager.allAsyncExtensionsLoaded();const e=[];return B.extensionIDs.forEach(A=>{if(!this.extensionManager.isExtensionLoaded(A)){const t=B.extensionURLs.get(A)||A;e.push(this.extensionManager.loadExtensionURL(t))}}),A=A.filter(A=>!!A),Promise.all(e).then(()=>{A.forEach(A=>{this.runtime.addTarget(A),A.updateAllDrawableProperties(),A.isSprite()&&this.renameSprite(A.id,A.getName())}),this.runtime.executableTargets.sort((A,B)=>A.layerOrder-B.layerOrder),A.forEach(A=>{delete A.layerOrder}),t&&A.length>1?this.editingTarget=A[1]:this.editingTarget=A[0],t||this.editingTarget.fixUpVariableReferences(),t&&this.runtime.parseProjectOptions(),this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.runtime.ioDevices.cloud.setStage(this.runtime.getTargetForStage())})}addSprite(A){"object"!=typeof A||A instanceof ArrayBuffer||ArrayBuffer.isView(A)||(A=JSON.stringify(A));return new Promise((B,e)=>{t(85)(A,!0,(A,t)=>{if(A)return e(A);B(t)})}).then(A=>{const B=A[0].projectVersion;return 2===B?this._addSprite2(A[0],A[1]):3===B?this._addSprite3(A[0],A[1]):Promise.reject("".concat("Sprite Upload Error:"," Unable to verify sprite version."))}).then(()=>this.runtime.emitProjectChanged()).catch(A=>A.hasOwnProperty("validationError")?Promise.reject(JSON.stringify(A)):Promise.reject("".concat("Sprite Upload Error:"," ").concat(A)))}_addSprite2(A,B){return t(88).deserialize(A,this.runtime,!0,B).then(A=>{let{targets:B,extensions:t}=A;return this.installTargets(B,t,!1)})}_addSprite3(A,B){return t(32).deserialize(A,this.runtime,B,!0).then(A=>{let{targets:B,extensions:t}=A;return this.installTargets(B,t,!1)})}addCostume(A,B,t,e){const g=t?this.runtime.getTargetById(t):this.editingTarget;return g?Y(A,B,this.runtime,e).then(()=>{g.addCostume(B),g.setCostume(g.getCostumes().length-1),this.runtime.emitProjectChanged()}):Promise.reject()}addCostumeFromLibrary(A,B){return this.editingTarget?this.addCostume(A,B,this.editingTarget.id,2):Promise.reject()}duplicateCostume(A){const B=this.editingTarget.getCostumes()[A],t=Object.assign({},B),e="".concat(t.assetId,".").concat(t.dataFormat);return Y(e,t,this.runtime).then(()=>{this.editingTarget.addCostume(t,A+1),this.editingTarget.setCostume(A+1),this.emitTargetsUpdate()})}duplicateSound(A){const B=this.editingTarget.getSounds()[A],t=Object.assign({},B);return h(t,this.runtime,this.editingTarget.sprite.soundBank).then(()=>{this.editingTarget.addSound(t,A+1),this.emitTargetsUpdate()})}renameCostume(A,B){this.editingTarget.renameCostume(A,B),this.emitTargetsUpdate()}deleteCostume(A){const B=this.editingTarget.deleteCostume(A);if(B){const A=this.editingTarget;return this.runtime.emitProjectChanged(),()=>{A.addCostume(B),this.emitTargetsUpdate()}}return null}addSound(A,B){const t=B?this.runtime.getTargetById(B):this.editingTarget;return t?h(A,this.runtime,t.sprite.soundBank).then(()=>{t.addSound(A),this.emitTargetsUpdate()}):new Promise.reject}renameSound(A,B){this.editingTarget.renameSound(A,B),this.emitTargetsUpdate()}getSoundBuffer(A){const B=this.editingTarget.sprite.sounds[A].soundId;return B&&this.runtime&&this.runtime.audioEngine?this.editingTarget.sprite.soundBank.getSoundPlayer(B).buffer:null}updateSoundBuffer(A,B,t){const e=this.editingTarget.sprite.sounds[A];e&&e.broken&&delete e.broken;const g=e?e.soundId:null;if(g&&this.runtime&&this.runtime.audioEngine&&(this.editingTarget.sprite.soundBank.getSoundPlayer(g).buffer=B),t){e.format="";const A=this.runtime.storage;e.asset=A.createAsset(A.AssetType.Sound,A.DataFormat.WAV,t,null,!0),e.assetId=e.asset.assetId,e.dataFormat=A.DataFormat.WAV,e.md5="".concat(e.assetId,".").concat(e.dataFormat),e.sampleCount=B.length,e.rate=B.sampleRate}this.emitTargetsUpdate()}deleteSound(A){const B=this.editingTarget,t=this.editingTarget.deleteSound(A);if(t){this.runtime.emitProjectChanged();return()=>{B.addSound(t),this.emitTargetsUpdate()}}return null}getCostume(A){const B=this.editingTarget.getCostumes()[A].asset;if(!B||!this.runtime||!this.runtime.storage)return null;const t=B.dataFormat;return t===this.runtime.storage.DataFormat.SVG?B.decodeText():t===this.runtime.storage.DataFormat.PNG||t===this.runtime.storage.DataFormat.JPG?B.encodeDataURI():(r.error("Unhandled format: ".concat(B.dataFormat)),null)}updateBitmap(A,B,t,e,g){return this._updateBitmap(this.editingTarget.getCostumes()[A],B,t,e,g)}_updateBitmap(A,B,t,e,g){if(!(A&&this.runtime&&this.runtime.renderer))return;A&&A.broken&&delete A.broken,A.rotationCenterX=t,A.rotationCenterY=e;const i=0===B.sourceWidth?0:B.width,s=0===B.sourceHeight?0:B.height,n=document.createElement("canvas");n.width=i,n.height=s;n.getContext("2d").putImageData(B,0,0),this.runtime.renderer.updateBitmapSkin(A.skinId,n,g,[t/g,e/g]),n.toBlob(B=>{const t=new FileReader;t.addEventListener("loadend",()=>{const B=this.runtime.storage;A.dataFormat=B.DataFormat.PNG,A.bitmapResolution=g,A.size=[i,s],A.asset=B.createAsset(B.AssetType.ImageBitmap,A.dataFormat,Q.from(t.result),null,!0),A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat),this.emitTargetsUpdate()}),B&&t.readAsArrayBuffer(B)})}updateSvg(A,B,t,e){return this._updateSvg(this.editingTarget.getCostumes()[A],B,t,e)}_updateSvg(A,B,t,g){A&&A.broken&&delete A.broken,A&&this.runtime&&this.runtime.renderer&&(A.rotationCenterX=t,A.rotationCenterY=g,this.runtime.renderer.updateSVGSkin(A.skinId,B,[t,g]),A.size=this.runtime.renderer.getSkinSize(A.skinId));const i=this.runtime.storage;A.dataFormat=i.DataFormat.SVG,A.bitmapResolution=1,A.asset=i.createAsset(i.AssetType.ImageVector,A.dataFormat,(new e).encode(B),null,!0),A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat),this.emitTargetsUpdate()}addBackdrop(A,B){return Y(A,B,this.runtime).then(()=>{const A=this.runtime.getTargetForStage();A.addCostume(B),A.setCostume(A.getCostumes().length-1),this.runtime.emitProjectChanged()})}renameSprite(A,B){const t=this.runtime.getTargetById(A);if(!t)throw new Error("No target with the provided id.");{if(!t.isSprite())throw new Error("Cannot rename non-sprite targets.");const A=t.sprite;if(!A)throw new Error("No sprite associated with this target.");if(B&&-1===D.indexOf(B)){const e=this.runtime.targets.filter(A=>A.isSprite()&&A.id!==t.id).map(A=>A.sprite.name),g=A.name,i=o.unusedName(B,e);if(A.name=i,g===i)return;const Q=this.runtime.targets;for(let A=0;AA.id).indexOf(B.id);if(!B.isSprite())throw new Error("Cannot delete non-sprite targets.");const e=B.sprite;if(!e)throw new Error("No sprite associated with this target.");const g=this.exportSprite(A,"uint8array"),i=()=>g.then(A=>this.addSprite(A));B.deleteMonitors();const Q=this.editingTarget;for(let A=0;A0?this.setEditingTarget(this.runtime.targets[A].id):this.editingTarget=null}}return this.emitTargetsUpdate(),i}throw new Error("No target with the provided id.")}duplicateSprite(A){const B=this.runtime.getTargetById(A);if(!B)throw new Error("No target with the provided id.");if(!B.isSprite())throw new Error("Cannot duplicate non-sprite targets.");if(!B.sprite)throw new Error("No sprite associated with this target.");return B.duplicate().then(A=>{this.runtime.addTarget(A),A.goBehindOther(B),this.setEditingTarget(A.id)})}attachAudioEngine(A){this.runtime.attachAudioEngine(A)}attachRenderer(A){this.runtime.attachRenderer(A)}get renderer(){return this.runtime&&this.runtime.renderer}attachV2SVGAdapter(){}attachV2BitmapAdapter(A){this.runtime.attachV2BitmapAdapter(A)}attachStorage(A){this.runtime.attachStorage(A)}setLocale(A,B){return A!==w.setup().locale&&w.setup({locale:A,translations:{[A]:B}}),this.extensionManager.refreshBlocks()}getLocale(){return w.setup().locale}blockListener(A){this.editingTarget&&this.editingTarget.blocks.blocklyListen(A)}flyoutBlockListener(A){this.runtime.flyoutBlocks.blocklyListen(A)}monitorBlockListener(A){-1!==["create","change"].indexOf(A.type)&&this.runtime.monitorBlocks.blocklyListen(A)}variableListener(A){-1!==["var_create","var_rename","var_delete"].indexOf(A.type)&&this.runtime.getTargetForStage().blocks.blocklyListen(A)}setEditingTarget(A){if(this.editingTarget&&A===this.editingTarget.id)return;const B=this.runtime.getTargetById(A);B&&(this.editingTarget=B,this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(B))}shareBlocksToTarget(A,B,e){const g=t(32),i=JSON.parse(JSON.stringify(A));a(i);const Q=this.runtime.getTargetById(B);if(e){this.runtime.getTargetById(e).resolveVariableSharingConflictsWithTarget(i,Q)}const s=new Set(i.map(A=>g.getExtensionIdForOpcode(A.opcode)).filter(A=>!!A).filter(A=>!this.extensionManager.isExtensionLoaded(A))),n=Array.from(s,A=>this.extensionManager.loadExtensionURL(A));return Promise.all(n).then(()=>{i.forEach(A=>{Q.blocks.createBlock(A)}),Q.blocks.updateTargetSpecificBlocks(Q.isStage)})}shareCostumeToTarget(A,B){const t=this.editingTarget.getCostumes()[A],e=Object.assign({},t),g="".concat(e.assetId,".").concat(e.dataFormat);return Y(g,e,this.runtime).then(()=>{const A=this.runtime.getTargetById(B);A&&(A.addCostume(e),A.setCostume(A.getCostumes().length-1))})}shareSoundToTarget(A,B){const t=this.editingTarget.getSounds()[A],e=Object.assign({},t),g=this.runtime.getTargetById(B);return h(e,this.runtime,g.sprite.soundBank).then(()=>{g&&(g.addSound(e),this.emitTargetsUpdate())})}refreshWorkspace(){this.editingTarget&&(this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.emitTargetsUpdate(!1))}emitTargetsUpdate(A){let B;void 0===A&&(A=!0);const t=()=>(B||(B=this.runtime.targets.filter(A=>!A.hasOwnProperty("isOriginal")||A.isOriginal).map(A=>A.toJSON())),B);this.emit("targetsUpdate",{get targetList(){return t()},editingTarget:this.editingTarget?this.editingTarget.id:null}),A&&this.runtime.emitProjectChanged()}emitWorkspaceUpdate(){const A=this.runtime.getTargetForStage().variables;let B=[];for(const t in A)A[t].type===C.BROADCAST_MESSAGE_TYPE&&B.push(t);for(let A=0;At[A]),i=Object.keys(e).map(A=>e[A]),Q=Object.keys(this.editingTarget.comments).map(A=>this.editingTarget.comments[A]).filter(A=>null===A.blockId),s='\n \n '.concat(g.map(A=>A.toXML()).join(),"\n ").concat(i.map(A=>A.toXML(!0)).join(),"\n \n ").concat(Q.map(A=>A.toXML()).join(),"\n ").concat(this.editingTarget.blocks.toXML(this.editingTarget.comments),"\n ");this.emit("workspaceUpdate",{xml:s})}getTargetIdForDrawableId(A){const B=this.runtime.getTargetByDrawableId(A);return B&&B.hasOwnProperty("id")&&B.hasOwnProperty("isStage")&&!B.isStage?B.id:null}reorderTarget(A,B){let t=this.runtime.targets;if((A=E.clamp(A,0,t.length-1))===(B=E.clamp(B,0,t.length-1)))return!1;const e=t[A];return t=t.slice(0,A).concat(t.slice(A+1)),t.splice(B,0,e),this.runtime.targets=t,this.emitTargetsUpdate(),!0}reorderCostume(A,B,t){const e=this.runtime.getTargetById(A);if(e){const A=e.reorderCostume(B,t);return A&&this.runtime.emitProjectChanged(),A}return!1}reorderSound(A,B,t){const e=this.runtime.getTargetById(A);if(e){const A=e.reorderSound(B,t);return A&&this.runtime.emitProjectChanged(),A}return!1}startDrag(A){const B=this.runtime.getTargetById(A);B&&(this._dragTarget=B,B.startDrag())}stopDrag(A){const B=this.runtime.getTargetById(A);B&&(this._dragTarget=null,B.stopDrag(),this.setEditingTarget(B.sprite&&B.sprite.clones[0]?B.sprite.clones[0].id:B.id))}postSpriteInfo(A){this._dragTarget?this._dragTarget.postSpriteInfo(A):this.editingTarget.postSpriteInfo(A),this.runtime.emitProjectChanged()}setVariableValue(A,B,t){const e=this.runtime.getTargetById(A);if(e){const A=e.lookupVariableById(B);if(A)return A.value=t,A.isCloud&&this.runtime.ioDevices.cloud.requestUpdateVariable(A.name,A.value),!0}return!1}getVariableValue(A,B){const t=this.runtime.getTargetById(A);if(t){const A=t.lookupVariableById(B);if(A)return A.value}return null}configureScratchLinkSocketFactory(A){this.runtime.configureScratchLinkSocketFactory(A)}}},function(A,B,t){"use strict";B.byteLength=function(A){var B=r(A),t=B[0],e=B[1];return 3*(t+e)/4-e},B.toByteArray=function(A){var B,t,e=r(A),Q=e[0],s=e[1],n=new i(function(A,B,t){return 3*(B+t)/4-t}(0,Q,s)),E=0,c=s>0?Q-4:Q;for(t=0;t>16&255,n[E++]=B>>8&255,n[E++]=255&B;2===s&&(B=g[A.charCodeAt(t)]<<2|g[A.charCodeAt(t+1)]>>4,n[E++]=255&B);1===s&&(B=g[A.charCodeAt(t)]<<10|g[A.charCodeAt(t+1)]<<4|g[A.charCodeAt(t+2)]>>2,n[E++]=B>>8&255,n[E++]=255&B);return n},B.fromByteArray=function(A){for(var B,t=A.length,g=t%3,i=[],Q=0,s=t-g;Qs?s:Q+16383));1===g?(B=A[t-1],i.push(e[B>>2]+e[B<<4&63]+"==")):2===g&&(B=(A[t-2]<<8)+A[t-1],i.push(e[B>>10]+e[B>>4&63]+e[B<<2&63]+"="));return i.join("")};for(var e=[],g=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,n=Q.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=A.indexOf("=");return-1===t&&(t=B),[t,t===B?0:4-t%4]}function E(A,B,t){for(var g,i,Q=[],s=B;s>18&63]+e[i>>12&63]+e[i>>6&63]+e[63&i]);return Q.join("")}g["-".charCodeAt(0)]=62,g["_".charCodeAt(0)]=63},function(A,B){ +A.exports=function(){"use strict";var A=Object.hasOwnProperty,B=Object.setPrototypeOf,t=Object.isFrozen,e=Object.getPrototypeOf,g=Object.getOwnPropertyDescriptor,i=Object.freeze,Q=Object.seal,s=Object.create,n="undefined"!=typeof Reflect&&Reflect,r=n.apply,c=n.construct;r||(r=function(A,B,t){return A.apply(B,t)}),i||(i=function(A){return A}),Q||(Q=function(A){return A}),c||(c=function(A,B){return new(Function.prototype.bind.apply(A,[null].concat(function(A){if(Array.isArray(A)){for(var B=0,t=Array(A.length);B1?t-1:0),g=1;g/gm),S=Q(/^data-[\-\w.\u00B7-\uFFFF]/),b=Q(/^aria-[\-\w]+$/),z=Q(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),L=Q(/^(?:\w+script|data):/i),P=Q(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),v="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(A){return typeof A}:function(A){return A&&"function"==typeof Symbol&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A};function W(A){if(Array.isArray(A)){for(var B=0,t=Array(A.length);B0&&void 0!==arguments[0]?arguments[0]:V(),t=function(B){return A(B)};if(t.version="2.2.7",t.removed=[],!B||!B.document||9!==B.document.nodeType)return t.isSupported=!1,t;var e=B.document,g=B.document,Q=B.DocumentFragment,s=B.HTMLTemplateElement,n=B.Node,r=B.Element,c=B.NodeFilter,E=B.NamedNodeMap,u=void 0===E?B.NamedNodeMap||B.MozNamedAttrMap:E,O=B.Text,X=B.Comment,Z=B.DOMParser,_=B.trustedTypes,q=r.prototype,$=U(q,"cloneNode"),AA=U(q,"nextSibling"),BA=U(q,"childNodes"),tA=U(q,"parentNode");if("function"==typeof s){var eA=g.createElement("template");eA.content&&eA.content.ownerDocument&&(g=eA.content.ownerDocument)}var gA=K(_,e),iA=gA&&jA?gA.createHTML(""):"",QA=g,sA=QA.implementation,nA=QA.createNodeIterator,rA=QA.getElementsByTagName,cA=QA.createDocumentFragment,EA=e.importNode,oA={};try{oA=d(g).documentMode?g.documentMode:{}}catch(A){}var wA={};t.isSupported="function"==typeof tA&&sA&&void 0!==sA.createHTMLDocument&&9!==oA;var CA=j,aA=x,IA=S,YA=b,hA=L,MA=P,FA=z,DA=null,uA=l({},[].concat(W(N),W(m),W(G),W(H),W(p))),lA=null,dA=l({},[].concat(W(J),W(y),W(k),W(T))),UA=null,NA=null,mA=!0,GA=!0,fA=!1,HA=!1,RA=!1,pA=!1,JA=!1,yA=!1,kA=!1,TA=!0,jA=!1,xA=!0,SA=!0,bA=!1,zA={},LA=l({},["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"]),PA=null,vA=l({},["audio","video","img","source","image","track"]),WA=null,VA=l({},["alt","class","for","id","label","name","pattern","placeholder","summary","title","value","style","xmlns"]),KA=null,OA=g.createElement("form"),XA=function(A){KA&&KA===A||(A&&"object"===(void 0===A?"undefined":v(A))||(A={}),A=d(A),DA="ALLOWED_TAGS"in A?l({},A.ALLOWED_TAGS):uA,lA="ALLOWED_ATTR"in A?l({},A.ALLOWED_ATTR):dA,WA="ADD_URI_SAFE_ATTR"in A?l(d(VA),A.ADD_URI_SAFE_ATTR):VA,PA="ADD_DATA_URI_TAGS"in A?l(d(vA),A.ADD_DATA_URI_TAGS):vA,UA="FORBID_TAGS"in A?l({},A.FORBID_TAGS):{},NA="FORBID_ATTR"in A?l({},A.FORBID_ATTR):{},zA="USE_PROFILES"in A&&A.USE_PROFILES,mA=!1!==A.ALLOW_ARIA_ATTR,GA=!1!==A.ALLOW_DATA_ATTR,fA=A.ALLOW_UNKNOWN_PROTOCOLS||!1,HA=A.SAFE_FOR_TEMPLATES||!1,RA=A.WHOLE_DOCUMENT||!1,yA=A.RETURN_DOM||!1,kA=A.RETURN_DOM_FRAGMENT||!1,TA=!1!==A.RETURN_DOM_IMPORT,jA=A.RETURN_TRUSTED_TYPE||!1,JA=A.FORCE_BODY||!1,xA=!1!==A.SANITIZE_DOM,SA=!1!==A.KEEP_CONTENT,bA=A.IN_PLACE||!1,FA=A.ALLOWED_URI_REGEXP||FA,HA&&(GA=!1),kA&&(yA=!0),zA&&(DA=l({},[].concat(W(p))),lA=[],!0===zA.html&&(l(DA,N),l(lA,J)),!0===zA.svg&&(l(DA,m),l(lA,y),l(lA,T)),!0===zA.svgFilters&&(l(DA,G),l(lA,y),l(lA,T)),!0===zA.mathMl&&(l(DA,H),l(lA,k),l(lA,T))),A.ADD_TAGS&&(DA===uA&&(DA=d(DA)),l(DA,A.ADD_TAGS)),A.ADD_ATTR&&(lA===dA&&(lA=d(lA)),l(lA,A.ADD_ATTR)),A.ADD_URI_SAFE_ATTR&&l(WA,A.ADD_URI_SAFE_ATTR),SA&&(DA["#text"]=!0),RA&&l(DA,["html","head","body"]),DA.table&&(l(DA,["tbody"]),delete UA.tbody),i&&i(A),KA=A)},ZA=l({},["mi","mo","mn","ms","mtext"]),_A=l({},["foreignobject","desc","title","annotation-xml"]),qA=l({},m);l(qA,G),l(qA,f);var $A=l({},H);l($A,R);var AB="http://www.w3.org/1998/Math/MathML",BB="http://www.w3.org/2000/svg",tB="http://www.w3.org/1999/xhtml",eB=function(A){var B=tA(A);B&&B.tagName||(B={namespaceURI:tB,tagName:"template"});var t=a(A.tagName),e=a(B.tagName);if(A.namespaceURI===BB)return B.namespaceURI===tB?"svg"===t:B.namespaceURI===AB?"svg"===t&&("annotation-xml"===e||ZA[e]):Boolean(qA[t]);if(A.namespaceURI===AB)return B.namespaceURI===tB?"math"===t:B.namespaceURI===BB?"math"===t&&_A[e]:Boolean($A[t]);if(A.namespaceURI===tB){if(B.namespaceURI===BB&&!_A[e])return!1;if(B.namespaceURI===AB&&!ZA[e])return!1;var g=l({},["title","style","font","a","script"]);return!$A[t]&&(g[t]||!qA[t])}return!1},gB=function(A){C(t.removed,{element:A});try{A.parentNode.removeChild(A)}catch(B){try{A.outerHTML=iA}catch(B){A.remove()}}},iB=function(A,B){try{C(t.removed,{attribute:B.getAttributeNode(A),from:B})}catch(A){C(t.removed,{attribute:null,from:B})}if(B.removeAttribute(A),"is"===A&&!lA[A])if(yA||kA)try{gB(B)}catch(A){}else try{B.setAttribute(A,"")}catch(A){}},QB=function(A){var B=void 0,t=void 0;if(JA)A=""+A;else{var e=I(A,/^[\r\n\t ]+/);t=e&&e[0]}var i=gA?gA.createHTML(A):A;try{B=(new Z).parseFromString(i,"text/html")}catch(A){}if(!B||!B.documentElement){var Q=(B=sA.createHTMLDocument("")).body;Q.parentNode.removeChild(Q.parentNode.firstElementChild),Q.outerHTML=i}return A&&t&&B.body.insertBefore(g.createTextNode(t),B.body.childNodes[0]||null),rA.call(B,RA?"html":"body")[0]},sB=function(A){return nA.call(A.ownerDocument||A,A,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT,(function(){return c.FILTER_ACCEPT}),!1)},nB=function(A){return!(A instanceof O||A instanceof X||"string"==typeof A.nodeName&&"string"==typeof A.textContent&&"function"==typeof A.removeChild&&A.attributes instanceof u&&"function"==typeof A.removeAttribute&&"function"==typeof A.setAttribute&&"string"==typeof A.namespaceURI&&"function"==typeof A.insertBefore)},rB=function(A){return"object"===(void 0===n?"undefined":v(n))?A instanceof n:A&&"object"===(void 0===A?"undefined":v(A))&&"number"==typeof A.nodeType&&"string"==typeof A.nodeName},cB=function(A,B,e){wA[A]&&o(wA[A],(function(A){A.call(t,B,e,KA)}))},EB=function(A){var B=void 0;if(cB("beforeSanitizeElements",A,null),nB(A))return gB(A),!0;if(I(A.nodeName,/[\u0080-\uFFFF]/))return gB(A),!0;var e=a(A.nodeName);if(cB("uponSanitizeElement",A,{tagName:e,allowedTags:DA}),!rB(A.firstElementChild)&&(!rB(A.content)||!rB(A.content.firstElementChild))&&F(/<[/\w]/g,A.innerHTML)&&F(/<[/\w]/g,A.textContent))return gB(A),!0;if(!DA[e]||UA[e]){if(SA&&!LA[e]){var g=tA(A),i=BA(A);if(i&&g)for(var Q=i.length-1;Q>=0;--Q)g.insertBefore($(i[Q],!0),AA(A))}return gB(A),!0}return A instanceof r&&!eB(A)?(gB(A),!0):"noscript"!==e&&"noembed"!==e||!F(/<\/no(script|embed)/i,A.innerHTML)?(HA&&3===A.nodeType&&(B=A.textContent,B=Y(B,CA," "),B=Y(B,aA," "),A.textContent!==B&&(C(t.removed,{element:A.cloneNode()}),A.textContent=B)),cB("afterSanitizeElements",A,null),!1):(gB(A),!0)},oB=function(A,B,t){if(xA&&("id"===B||"name"===B)&&(t in g||t in OA))return!1;if(GA&&F(IA,B));else if(mA&&F(YA,B));else{if(!lA[B]||NA[B])return!1;if(WA[B]);else if(F(FA,Y(t,MA,"")));else if("src"!==B&&"xlink:href"!==B&&"href"!==B||"script"===A||0!==h(t,"data:")||!PA[A])if(fA&&!F(hA,Y(t,MA,"")));else if(t)return!1}return!0},wB=function(A){var B=void 0,e=void 0,g=void 0,i=void 0;cB("beforeSanitizeAttributes",A,null);var Q=A.attributes;if(Q){var s={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:lA};for(i=Q.length;i--;){var n=B=Q[i],r=n.name,c=n.namespaceURI;if(e=M(B.value),g=a(r),s.attrName=g,s.attrValue=e,s.keepAttr=!0,s.forceKeepAttr=void 0,cB("uponSanitizeAttribute",A,s),e=s.attrValue,!s.forceKeepAttr&&(iB(r,A),s.keepAttr))if(F(/\/>/i,e))iB(r,A);else{HA&&(e=Y(e,CA," "),e=Y(e,aA," "));var E=A.nodeName.toLowerCase();if(oB(E,g,e))try{c?A.setAttributeNS(c,r,e):A.setAttribute(r,e),w(t.removed)}catch(A){}}}cB("afterSanitizeAttributes",A,null)}},CB=function A(B){var t=void 0,e=sB(B);for(cB("beforeSanitizeShadowDOM",B,null);t=e.nextNode();)cB("uponSanitizeShadowNode",t,null),EB(t)||(t.content instanceof Q&&A(t.content),wB(t));cB("afterSanitizeShadowDOM",B,null)};return t.sanitize=function(A,g){var i=void 0,s=void 0,r=void 0,c=void 0,E=void 0;if(A||(A="\x3c!--\x3e"),"string"!=typeof A&&!rB(A)){if("function"!=typeof A.toString)throw D("toString is not a function");if("string"!=typeof(A=A.toString()))throw D("dirty is not a string, aborting")}if(!t.isSupported){if("object"===v(B.toStaticHTML)||"function"==typeof B.toStaticHTML){if("string"==typeof A)return B.toStaticHTML(A);if(rB(A))return B.toStaticHTML(A.outerHTML)}return A}if(pA||XA(g),t.removed=[],"string"==typeof A&&(bA=!1),bA);else if(A instanceof n)1===(s=(i=QB("\x3c!----\x3e")).ownerDocument.importNode(A,!0)).nodeType&&"BODY"===s.nodeName||"HTML"===s.nodeName?i=s:i.appendChild(s);else{if(!yA&&!HA&&!RA&&-1===A.indexOf("<"))return gA&&jA?gA.createHTML(A):A;if(!(i=QB(A)))return yA?null:iA}i&&JA&&gB(i.firstChild);for(var o=sB(bA?A:i);r=o.nextNode();)3===r.nodeType&&r===c||EB(r)||(r.content instanceof Q&&CB(r.content),wB(r),c=r);if(c=null,bA)return A;if(yA){if(kA)for(E=cA.call(i.ownerDocument);i.firstChild;)E.appendChild(i.firstChild);else E=i;return TA&&(E=EA.call(e,E,!0)),E}var w=RA?i.outerHTML:i.innerHTML;return HA&&(w=Y(w,CA," "),w=Y(w,aA," ")),gA&&jA?gA.createHTML(w):w},t.setConfig=function(A){XA(A),pA=!0},t.clearConfig=function(){KA=null,pA=!1},t.isValidAttribute=function(A,B,t){KA||XA({});var e=a(A),g=a(B);return oB(e,g,t)},t.addHook=function(A,B){"function"==typeof B&&(wA[A]=wA[A]||[],C(wA[A],B))},t.removeHook=function(A){wA[A]&&w(wA[A])},t.removeHooks=function(A){wA[A]&&(wA[A]=[])},t.removeAllHooks=function(){wA={}},t}()}()},function(A,B){A.exports=function(A){const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B1&&void 0!==arguments[1]?arguments[1]:0}}function a(){for(var A=arguments.length,B=Array(A),t=0;t1&&void 0!==arguments[1]?arguments[1]:void 0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return F(A*M/180,B,t)}function u(A){var B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return w(B)&&(B=A),{a:A,c:0,e:0,b:0,d:B,f:0}}function l(A,B){return{a:1,c:A,e:0,b:B,d:1,f:0}}var d=Math.tan;function U(A,B){return{a:1,c:d(A),e:0,b:d(B),d:1,f:0}}function N(A,B){return U(A*Math.PI/180,B*Math.PI/180)}function m(A){return f(A)}function G(A){return f(A)}function f(A){return"matrix("+A.a+","+A.b+","+A.c+","+A.d+","+A.e+","+A.f+")"}t.d(B,"applyToPoint",(function(){return e})),t.d(B,"applyToPoints",(function(){return g})),t.d(B,"fromObject",(function(){return i})),t.d(B,"fromString",(function(){return s})),t.d(B,"identity",(function(){return n})),t.d(B,"inverse",(function(){return r})),t.d(B,"isAffineMatrix",(function(){return o})),t.d(B,"rotate",(function(){return F})),t.d(B,"rotateDEG",(function(){return D})),t.d(B,"scale",(function(){return u})),t.d(B,"shear",(function(){return l})),t.d(B,"skew",(function(){return U})),t.d(B,"skewDEG",(function(){return N})),t.d(B,"toCSS",(function(){return m})),t.d(B,"toSVG",(function(){return G})),t.d(B,"toString",(function(){return f})),t.d(B,"transform",(function(){return a})),t.d(B,"compose",(function(){return I})),t.d(B,"translate",(function(){return C}))}])},function(A,B,t){const e=t(83);A.exports=(A,B)=>{let t=(new XMLSerializer).serializeToString(A);return B&&(t=e(t)),t}},function(A,B,t){const e=t(84);A.exports=function(A){const B=e();if("string"!=typeof A)throw new Error("SVG to be inlined is not a string");const t=new Set,g=/font-family="([^"]*)"/g;let i=g.exec(A);for(;i;)t.add(i[1]),i=g.exec(A);if(t.size>0){let e="",A=A.replace(/]*>/,"$&".concat(e))}return A}},function(A,B,t){let e;A.exports=function(){if(e)return e;e={"Sans Serif":t(246),Serif:t(247),Handwriting:t(248),Marker:t(249),Curly:t(250),Pixel:t(251),Scratch:t(252)};for(const A in e){const B=e[A];e[A]="@font-face {"+'font-family: "'.concat(A,'";src: url("data:application/x-font-ttf;charset=utf-8;base64,').concat(B,'");}')}if(!document.getElementById("scratch-font-styles")){const A=document.createElement("style");A.id="scratch-font-styles";for(const B in e)A.textContent+=e[B];document.body.insertBefore(A,document.body.firstChild)}return e}},function(A,B,t){let e,g;"undefined"==typeof TextEncoder?(e=t(18).TextEncoder,g=t(18).TextDecoder):(e=TextEncoder,g=TextDecoder);const i=""),s=new RegExp("".concat(i,"rotationCenter:(-?[\\d\\.]+):(-?[\\d\\.]+)").concat(Q,"$"));A.exports={parseVectorMetadata:A=>{const B=A.match(s);if(!B)return null;const t=+B[1],e=+B[2];return Number.isNaN(t)||Number.isNaN(e)?null:[t,e]},exportCostume:A=>{const B=A.asset.data;if("svg"!==A.dataFormat)return B;let t=(new g).decode(B);t=t.replace(s,"");const n=A.rotationCenterX,r=A.rotationCenterY;return t+="".concat(i,"rotationCenter:").concat(n,":").concat(r).concat(Q),(new e).encode(t)}}},function(A,B,t){var e=t(257),g=e(t(258)),i=e(t(260)),Q=e(t(261));A.exports=function(A,B,t){g(A,B).then((function(A){return i(A[0]).then(Q.bind(null,B)).then((function(B){return[B,A[1]]}))})).then(t.bind(null,null),t)}},function(A,B,t){const e=t(27),g=t(16),{loadSoundFromAsset:i}=t(32),{loadCostumeFromAsset:Q}=t(31),s=t(77),n=t(7),r=t(14);class c{constructor(A,B){this.runtime=B,A||(A=new g(B)),this.blocks=A,this.name="",this.costumes_=[],this.sounds=[],this.clones=[],this.soundBank=null,this.runtime&&this.runtime.audioEngine&&(this.soundBank=this.runtime.audioEngine.createBank())}set costumes(A){this.costumes_=[];for(const B of A)this.addCostumeAt(B,this.costumes_.length)}get costumes(){return this.costumes_}addCostumeAt(A,B){A.name||(A.name="");const t=this.costumes_.map(A=>A.name);A.name=n.unusedName(A.name,t),this.costumes_.splice(B,0,A)}deleteCostumeAt(A){return this.costumes.splice(A,1)[0]}createClone(A){const B=new e(this,this.runtime);if(B.isOriginal=0===this.clones.length,this.clones.push(B),B.initAudio(),B.isOriginal){const t="string"==typeof A?A:r.SPRITE_LAYER;B.initDrawable(t),this.runtime.fireTargetWasCreated(B)}else this.runtime.fireTargetWasCreated(B,this.clones[0]);return B}removeClone(A){this.runtime.fireTargetWasRemoved(A);const B=this.clones.indexOf(A);B>=0&&this.clones.splice(B,1)}duplicate(){const A=new c(null,this.runtime),B=this.blocks._blocks,t=Object.keys(B).map(A=>B[A]),e=JSON.parse(JSON.stringify(t));s(e),e.forEach(B=>{A.blocks.createBlock(B)});const g=this.runtime.targets.map(A=>A.sprite.name);A.name=n.unusedName(this.name,g);const r=[];return A.costumes=this.costumes_.map(A=>{const B=Object.assign({},A);return r.push(Q(B,this.runtime)),B}),A.sounds=this.sounds.map(B=>{const t=Object.assign({},B),e=B.asset;return r.push(i(t,e,this.runtime,A.soundBank)),t}),Promise.all(r).then(()=>A)}dispose(){this.soundBank&&this.soundBank.dispose()}}A.exports=c},function(A,B,t){const e=t(21),g=t(0);A.exports={deserializeSound:function(A,B,t,i){const Q=i||A.md5,s=B.storage;if(!s)return g.warn("No storage module present; cannot load sound asset: ",Q),Promise.resolve(null);if(!t)return Promise.resolve(null);let n=t.file(Q);if(!n){const A=new RegExp("^([^/]*/)?".concat(Q,"$"));n=t.file(A)[0]}if(!n)return g.error("Could not find sound file associated with the ".concat(A.name," sound.")),Promise.resolve(null);if(!e.support.uint8array)return g.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);const r="mp3"===A.dataFormat.toLowerCase()?s.DataFormat.MP3:s.DataFormat.WAV;return n.async("uint8array").then(A=>s.createAsset(s.AssetType.Sound,r,A,null,!0)).then(B=>{A.asset=B,A.assetId=B.assetId,A.md5="".concat(B.assetId,".").concat(B.dataFormat)})},deserializeCostume:function(A,B,t,i,Q){const s=B.storage,n=A.assetId,r=i||"".concat(n,".").concat(A.dataFormat);if(!s)return g.warn("No storage module present; cannot load costume asset: ",r),Promise.resolve(null);if(A.asset)return Promise.resolve(s.createAsset(A.asset.assetType,A.asset.dataFormat,new Uint8Array(Object.keys(A.asset.data).map(B=>A.asset.data[B])),null,!0)).then(B=>{A.asset=B,A.assetId=B.assetId,A.md5="".concat(B.assetId,".").concat(B.dataFormat)});if(!t)return Promise.resolve(null);let c=t.file(r);if(!c){const A=new RegExp("^([^/]*/)?".concat(r,"$"));c=t.file(A)[0]}if(!c)return g.error("Could not find costume file associated with the ".concat(A.name," costume.")),Promise.resolve(null);let E=null;const o=A.dataFormat.toLowerCase();if("svg"===o?E=s.AssetType.ImageVector:["png","bmp","jpeg","jpg","gif"].indexOf(o)>=0?E=s.AssetType.ImageBitmap:g.error("Unexpected file format for costume: ".concat(o)),!e.support.uint8array)return g.error("JSZip uint8array is not supported in this browser."),Promise.resolve(null);let w;if(A.textLayerMD5){const B=t.file(Q);if(!B)return g.error("Could not find text layer file associated with the ".concat(A.name," costume.")),Promise.resolve(null);w=B.async("uint8array").then(B=>s.createAsset(s.AssetType.ImageBitmap,"png",B,A.textLayerMD5)).then(B=>{A.textLayerAsset=B})}else w=Promise.resolve(null);return Promise.all([w,c.async("uint8array").then(A=>s.createAsset(E,o,A,null,!0)).then(B=>{A.asset=B,A.assetId=B.assetId,A.md5="".concat(B.assetId,".").concat(B.dataFormat)})])}}},function(A,B,t){const e=t(16),g=t(27),i=t(87),Q=t(23),s=t(0),n=t(6),r=t(7),c=t(3),E=t(264),o=t(40),w=t(8),C=t(38),a=t(14),I=t(265),{loadCostume:Y}=t(31),{loadSound:h}=t(32),{deserializeCostume:M,deserializeSound:F}=t(88),D=["argument","control","data","event","looks","math","motion","operator","procedures","sensing","sound"],u=/\u001f|\./,l=A=>{const[B,t]=A.split(u),e=I.generateExtensionId(B);return"".concat(e,"_").concat(t)},d=function(A){const B=[{}];let t=0;const e=A.split(/(?=[^\\]%[nbs])/);for(let A=0;AA.inputName).filter(A=>A)},N=function A(B){let t=[];for(let e=0;e"".concat(A,"-").concat(r.replaceUnsafeChars(B),"-").concat(t);return function(t,e){return e&&(A={}),function(g,i){return e?(A["".concat(g,"-").concat(i)]=B(t,g,i),A["".concat(g,"-").concat(i)]):A["".concat(g,"-").concat(i)]?A["".concat(g,"-").concat(i)]:B(t,g,i)}}}(),f=function(){let A={};const B=[],t=n();return function(e){return e&&(A={}),{broadcastMsgMapUpdater:function(e,g){return""===(e=e.toLowerCase())&&(e=t),A[e]="broadcastMsgId-".concat(r.replaceUnsafeChars(e)),B.push(g),A[e]},globalBroadcastMsgs:A,allBroadcastFields:B,emptyMsgName:t}}}(),H=(A,B,t,e)=>{if(!E[A.cmd])return void s.warn("Could not find monitor block with opcode: ".concat(A.cmd));const g=E[A.cmd].opcode,i=g.indexOf("_"),Q=g.substring(0,i);if("videoSensing"===Q)return;if(-1===D.indexOf(Q)&&""!==Q&&!e.extensionIDs.has(Q)&&!A.visible)return;let n=null;if(!A.hasOwnProperty("target"))for(let B=0;B{const t=e.variables[B];return t.type===w.LIST_TYPE&&t.name===A.listName}).length>0&&(n=e,A.target=e.getName())}if(n=n||t.filter(B=>B.getName()===A.target)[0],!n)throw new Error("Cannot create monitor for target that cannot be found by name");const r=G(n.id,!1),[c,o]=y([A.cmd,A.param],null,r,e,{},null,null);"getVar:"===A.cmd?c.id=r(A.param,w.SCALAR_TYPE):"contentsOfList:"===A.cmd?c.id=r(A.param,w.LIST_TYPE):B.monitorBlockInfo.hasOwnProperty(c.opcode)?c.id=B.monitorBlockInfo[c.opcode].getId(n.id,c.fields):c.id=c.opcode,c.targetId=n.isStage?null:n.id,c.isMonitored=A.visible;const a=B.monitorBlocks._blocks[c.id];if(a)a.isMonitored=A.visible,a.targetId=c.targetId;else{const A=N([c]);for(let t=0;t{const[B,t,e,g,i,Q,s]=A,n=A[5]>=0,r=new o(null,s,n?null:1.5*B,n?null:2.2*t,1.5*e,2.2*g,!i);return n&&(r.blockId=Q,l.hasOwnProperty(Q)?l[Q].push(r):l[Q]=[r]),r}).forEach(A=>{M.comments[A.id]=A})}B.hasOwnProperty("scripts")&&function(A,B,t,e,g,i){let Q=0;for(let s=0;s{"number"==typeof A.blockId&&(A.blockId=null)})}if(E.updateTargetSpecificBlocks(s),B.hasOwnProperty("lists"))for(let A=0;A{C.costumes=A}),Promise.all(h).then(A=>{C.sounds=A,C.soundBank=Y||null});const d=[];if(B.children)for(let e=0;ePromise.all(d).then(A=>{if(M.isStage){const A=D.globalBroadcastMsgs,B=D.allBroadcastFields,t=D.emptyMsgName;if(A[t]){let e=1;for(;A["message".concat(e)];)e+=1;const g="message".concat(e);A[g]=A[t],delete A[t];for(let A=0;A(A.layerOrder=B,A)).sort((A,B)=>A.targetPaneOrder-B.targetPaneOrder);return B.forEach(A=>{delete A.targetPaneOrder}),B},J=function(A){const B=A[0],t=B&&E[B];return t?"function"==typeof t?t(A):t:B&&(A=>u.test(A))(B)?(A=>{const B=A[0],t=A.length-1,e=[];for(let A=0;A{A.blockId=null,A.x=A.y=0}),[null,c+1];const C=B[0],a=o.opcode.indexOf("_"),I=o.opcode.substring(0,a);-1===D.indexOf(I)&&""!==I&&g.extensionIDs.add(I);const Y={id:n(),opcode:o.opcode,inputs:{},fields:{},next:null,shadow:!1,children:[]};E&&(Y.comment=E[E.length-1].id,E.forEach(A=>{A.id===Y.comment?A.blockId=Y.id:(A.blockId=null,A.x=A.y=0)})),c++;const h=i.expectedArg;"call"===C&&(o.argMap=d(B[1]));for(let E=0;E0){let A=null;for(let t=0;tY(n.md5,n,t,2)))}const{soundBank:s,soundPromises:n}=i;if(B.hasOwnProperty("sounds"))for(let A=0;Ah(i,t,s)))}const c=i.children;if(B.children)for(let e=0;ePromise.resolve(A)).then(i=>R(A,B,g,!t,e,i)).then(p).then(A=>({targets:A,extensions:g}))}}},function(A,B){class t{constructor(){this.left=-1/0,this.right=1/0,this.bottom=-1/0,this.top=1/0}initFromBounds(A,B,t,e){this.left=A,this.right=B,this.bottom=t,this.top=e}initFromPointsAABB(A){this.left=1/0,this.right=-1/0,this.top=-1/0,this.bottom=1/0;for(let B=0;Bthis.right&&(this.right=t),e>this.top&&(this.top=e),e=A.bottom&&A.top>=this.bottom}contains(A){return A.left>this.left&&A.rightthis.bottom}clamp(A,B,t,e){this.left=Math.max(this.left,A),this.right=Math.min(this.right,B),this.bottom=Math.max(this.bottom,t),this.top=Math.min(this.top,e),this.left=Math.min(this.left,B),this.right=Math.max(this.right,A),this.bottom=Math.min(this.bottom,e),this.top=Math.max(this.top,t)}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(A,B){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t;return e.left=Math.max(A.left,B.left),e.right=Math.min(A.right,B.right),e.top=Math.min(A.top,B.top),e.bottom=Math.max(A.bottom,B.bottom),e}static union(A,B){let e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t;return e.left=Math.min(A.left,B.left),e.right=Math.max(A.right,B.right),e.top=Math.max(A.top,B.top),e.bottom=Math.min(A.bottom,B.bottom),e}get width(){return Math.abs(this.left-this.right)}get height(){return Math.abs(this.top-this.bottom)}}A.exports=t},function(A,B,t){const e=t(9),{rgbToHsv:g,hsvToRgb:i}=t(277),Q=t(25),s=[0,0,0];A.exports=class{static transformColor(A,B,t){if(0===B[3])return B;let e=A.enabledEffects;"number"==typeof t&&(e&=t);const n=A.getUniforms(),r=0!=(e&Q.EFFECT_INFO.color.mask),c=0!=(e&Q.EFFECT_INFO.brightness.mask);if(r||c){const A=B[3]/255;if(B[0]/=A,B[1]/=A,B[2]/=A,r){const A=g(B,s),t=.055,e=.09;A[2]{const t=[],e=A=>{A.localName!==B&&void 0!==B||!A.getAttribute||t.push(A);for(let B=0;B{const B=document.createElement("span"),t=A.outerHTML,g=e.sanitize(t,{USE_PROFILES:{svg:!0},FORBID_TAGS:["a","audio","canvas","video"],ADD_DATA_URI_TAGS:["image"]});let i,Q;try{B.innerHTML=g,document.body.appendChild(B),i=B.children[0].getBBox()}finally{document.body.removeChild(B)}Q=0===i.width||0===i.height?0:(A=>{let B=0;const t=A=>{A.getAttribute&&(A.getAttribute("stroke")&&(B=Math.max(B,1)),A.getAttribute("stroke-width")&&(B=Math.max(B,Number(A.getAttribute("stroke-width"))||0)));for(let B=0;B{B&&(A=>{const B=n(A,"linearGradient");for(const A of B)A.getAttribute("x2")||A.setAttribute("x2","0")})(A),s(A,window),(A=>{const B=n(A,"image"),t="image-rendering: optimizespeed; image-rendering: pixelated;";for(const A of B)A.getAttribute("style")?A.setAttribute("style","".concat(t," ").concat(A.getAttribute("style"))):A.setAttribute("style",t)})(A),B?((A=>{const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B{const B=n(A);for(const A of B){if(!A.style)continue;const B=A.style.stroke||A.getAttribute("stroke");B&&B.match(/^url\(#.*\)$/)&&(A.style["stroke-linejoin"]="round",A.style["stroke-linecap"]="round")}})(A)):A.getAttribute("viewBox")?A.getAttribute("width")&&A.getAttribute("height")||(A.setAttribute("width",A.viewBox.baseVal.width),A.setAttribute("height",A.viewBox.baseVal.height)):r(A)};A.exports=(A,B)=>{const t=new DOMParser;A=Q(A);const e=t.parseFromString(A,"text/xml");if(e.childNodes.length<1||"svg"!==e.documentElement.localName)throw new Error("Document does not appear to be SVG.");const g=e.documentElement;return c(g,B),g}},function(A,B){A.exports=function(A){const B=[],t=A=>{"text"===A.localName&&B.push(A);for(let B=0;B{let t=(new XMLSerializer).serializeToString(A);return B&&(t=e(t)),t}},function(A,B,t){const e=t(84);A.exports=function(A){const B=e();if("string"!=typeof A)throw new Error("SVG to be inlined is not a string");const t=new Set,g=/font-family="([^"]*)"/g;let i=g.exec(A);for(;i;)t.add(i[1]),i=g.exec(A);if(t.size>0){let e="",A=A.replace(/]*>/,"$&".concat(e))}return A}},function(A,B,t){var e,g;g=t(291),e=function(){function A(A){var B,t,e;(B="function"==typeof A.readUInt32BE&&"function"==typeof A.slice)||A instanceof Uint8Array?(B?(this.highStart=A.readUInt32BE(0),this.errorValue=A.readUInt32BE(4),t=A.readUInt32BE(8),A=A.slice(12)):(e=new DataView(A.buffer),this.highStart=e.getUint32(0),this.errorValue=e.getUint32(4),t=e.getUint32(8),A=A.subarray(12)),A=g(A,new Uint8Array(t)),A=g(A,new Uint8Array(t)),this.data=new Uint32Array(A.buffer)):(this.data=A.data,this.highStart=A.highStart,this.errorValue=A.errorValue)}return 11,5,6,32,64,63,2,32,31,2048,32,2080,2080,32,2112,4,A.prototype.get=function(A){var B;return A<0||A>1114111?this.errorValue:A<55296||A>56319&&A<=65535?(B=(this.data[A>>5]<<2)+(31&A),this.data[B]):A<=65535?(B=(this.data[2048+(A-55296>>5)]<<2)+(31&A),this.data[B]):A>11)],B=((B=this.data[B+(A>>5&63)])<<2)+(31&A),this.data[B]):this.data[this.data.length-4]},A}(),A.exports=e},function(A,B,t){const e=t(45),g={ImageBitmap:{contentType:"image/png",name:"ImageBitmap",runtimeFormat:e.PNG,immutable:!0},ImageVector:{contentType:"image/svg+xml",name:"ImageVector",runtimeFormat:e.SVG,immutable:!0},Project:{contentType:"application/json",name:"Project",runtimeFormat:e.JSON,immutable:!1},Sound:{contentType:"audio/x-wav",name:"Sound",runtimeFormat:e.WAV,immutable:!0},Sprite:{contentType:"application/json",name:"Sprite",runtimeFormat:e.JSON,immutable:!0}};A.exports=g},function(A,B){A.exports=class{constructor(A){this.parent=A}load(A,B,t){return Promise.reject(new Error("No asset of type ".concat(A," for ID ").concat(B," with format ").concat(t)))}}},function(A,B,t){const e=t(47);A.exports=class extends e{get DEFAULT_VALUE(){return 100}get name(){return"volume"}initialize(){this.inputNode=this.audioEngine.audioContext.createGain(),this.outputNode=this.inputNode,this.initialized=!0}_set(A){this.value=A;const{gain:B}=this.outputNode,{currentTime:t,DECAY_DURATION:e}=this.audioEngine;B.linearRampToValueAtTime(A/100,t+e)}dispose(){this.initialized&&(this.outputNode.disconnect(),this.inputNode=null,this.outputNode=null,this.target=null,this.initialized=!1)}}},function(A,B,t){"use strict";var e,g=function(){return void 0===e&&(e=Boolean(window&&document&&document.all&&!window.atob)),e},i=function(){var A={};return function(B){if(void 0===A[B]){var t=document.querySelector(B);if(window.HTMLIFrameElement&&t instanceof window.HTMLIFrameElement)try{t=t.contentDocument.head}catch(A){t=null}A[B]=t}return A[B]}}(),Q=[];function s(A){for(var B=-1,t=0;t{const B={};return B._refreshExtensionPrimitives=A._refreshExtensionPrimitives.bind(A),B._registerExtensionPrimitives=A._registerExtensionPrimitives.bind(A),B})(this.runtime)).catch(A=>{r.error("Failed to register runtime service: ".concat(JSON.stringify(A)))}),this.editingTarget=null,this._dragTarget=null,this.runtime.on(E.SCRIPT_GLOW_ON,A=>{this.emit(E.SCRIPT_GLOW_ON,A)}),this.runtime.on(E.SCRIPT_GLOW_OFF,A=>{this.emit(E.SCRIPT_GLOW_OFF,A)}),this.runtime.on(E.BLOCK_GLOW_ON,A=>{this.emit(E.BLOCK_GLOW_ON,A)}),this.runtime.on(E.BLOCK_GLOW_OFF,A=>{this.emit(E.BLOCK_GLOW_OFF,A)}),this.runtime.on(E.PROJECT_START,()=>{this.emit(E.PROJECT_START)}),this.runtime.on(E.PROJECT_RUN_START,()=>{this.emit(E.PROJECT_RUN_START)}),this.runtime.on(E.PROJECT_RUN_STOP,()=>{this.emit(E.PROJECT_RUN_STOP)}),this.runtime.on(E.PROJECT_CHANGED,()=>{this.emit(E.PROJECT_CHANGED)}),this.runtime.on(E.VISUAL_REPORT,A=>{this.emit(E.VISUAL_REPORT,A)}),this.runtime.on(E.TARGETS_UPDATE,A=>{this.emitTargetsUpdate(A)}),this.runtime.on(E.MONITORS_UPDATE,A=>{this.emit(E.MONITORS_UPDATE,A)}),this.runtime.on(E.BLOCK_DRAG_UPDATE,A=>{this.emit(E.BLOCK_DRAG_UPDATE,A)}),this.runtime.on(E.BLOCK_DRAG_END,(A,B)=>{this.emit(E.BLOCK_DRAG_END,A,B)}),this.runtime.on(E.EXTENSION_ADDED,A=>{this.emit(E.EXTENSION_ADDED,A)}),this.runtime.on(E.EXTENSION_FIELD_ADDED,(A,B)=>{this.emit(E.EXTENSION_FIELD_ADDED,A,B)}),this.runtime.on(E.BLOCKSINFO_UPDATE,A=>{this.emit(E.BLOCKSINFO_UPDATE,A)}),this.runtime.on(E.BLOCKS_NEED_UPDATE,()=>{this.emitWorkspaceUpdate()}),this.runtime.on(E.TOOLBOX_EXTENSIONS_NEED_UPDATE,()=>{this.extensionManager.refreshBlocks()}),this.runtime.on(E.PERIPHERAL_LIST_UPDATE,A=>{this.emit(E.PERIPHERAL_LIST_UPDATE,A)}),this.runtime.on(E.USER_PICKED_PERIPHERAL,A=>{this.emit(E.USER_PICKED_PERIPHERAL,A)}),this.runtime.on(E.PERIPHERAL_CONNECTED,()=>this.emit(E.PERIPHERAL_CONNECTED)),this.runtime.on(E.PERIPHERAL_REQUEST_ERROR,()=>this.emit(E.PERIPHERAL_REQUEST_ERROR)),this.runtime.on(E.PERIPHERAL_DISCONNECTED,()=>this.emit(E.PERIPHERAL_DISCONNECTED)),this.runtime.on(E.PERIPHERAL_CONNECTION_LOST_ERROR,A=>this.emit(E.PERIPHERAL_CONNECTION_LOST_ERROR,A)),this.runtime.on(E.PERIPHERAL_SCAN_TIMEOUT,()=>this.emit(E.PERIPHERAL_SCAN_TIMEOUT)),this.runtime.on(E.MIC_LISTENING,A=>{this.emit(E.MIC_LISTENING,A)}),this.runtime.on(E.RUNTIME_STARTED,()=>{this.emit(E.RUNTIME_STARTED)}),this.runtime.on(E.RUNTIME_STOPPED,()=>{this.emit(E.RUNTIME_STOPPED)}),this.runtime.on(E.HAS_CLOUD_DATA_UPDATE,A=>{this.emit(E.HAS_CLOUD_DATA_UPDATE,A)}),this.runtime.on(E.RUNTIME_OPTIONS_CHANGED,A=>{this.emit(E.RUNTIME_OPTIONS_CHANGED,A)}),this.runtime.on(E.COMPILER_OPTIONS_CHANGED,A=>{this.emit(E.COMPILER_OPTIONS_CHANGED,A)}),this.runtime.on(E.FRAMERATE_CHANGED,A=>{this.emit(E.FRAMERATE_CHANGED,A)}),this.runtime.on(E.INTERPOLATION_CHANGED,A=>{this.emit(E.INTERPOLATION_CHANGED,A)}),this.runtime.on(E.STAGE_SIZE_CHANGED,(A,B)=>{this.emit(E.STAGE_SIZE_CHANGED,A,B)}),this.runtime.on(E.COMPILE_ERROR,(A,B)=>{this.emit(E.COMPILE_ERROR,A,B)}),this.runtime.on(E.TURBO_MODE_OFF,()=>{this.emit(E.TURBO_MODE_OFF)}),this.runtime.on(E.TURBO_MODE_ON,()=>{this.emit(E.TURBO_MODE_ON)}),this.extensionManager=new n(this.runtime);for(const A of l)this.extensionManager.loadExtensionIdSync(A);this.blockListener=this.blockListener.bind(this),this.flyoutBlockListener=this.flyoutBlockListener.bind(this),this.monitorBlockListener=this.monitorBlockListener.bind(this),this.variableListener=this.variableListener.bind(this)}start(){this.runtime.start()}stop(){this.runtime.stop()}greenFlag(){this.runtime.greenFlag()}setTurboMode(A){this.runtime.turboMode=!!A,this.runtime.turboMode?this.emit(E.TURBO_MODE_ON):this.emit(E.TURBO_MODE_OFF)}setCompatibilityMode(A){this.runtime.setCompatibilityMode(!!A)}setFramerate(A){this.runtime.setFramerate(A)}setInterpolation(A){this.runtime.setInterpolation(A)}setRuntimeOptions(A){this.runtime.setRuntimeOptions(A)}setCompilerOptions(A){this.runtime.setCompilerOptions(A)}setStageSize(A,B){this.runtime.setStageSize(A,B)}setInEditor(A){this.runtime.setInEditor(A)}convertToPackagedRuntime(){this.runtime.convertToPackagedRuntime()}addAddonBlock(A){this.runtime.addAddonBlock(A)}getAddonBlock(A){return this.runtime.getAddonBlock(A)}storeProjectOptions(){this.runtime.storeProjectOptions(),this.editingTarget.isStage&&this.emitWorkspaceUpdate()}enableDebug(){return this.runtime.enableDebug(),"enabled debug mode"}stopAll(){this.runtime.stopAll()}clear(){this.runtime.dispose(),this.editingTarget=null,this.emitTargetsUpdate(!1)}getPlaygroundData(){const A=this,B=this.runtime.threads.filter(B=>B.target===A.editingTarget),t=JSON.stringify(B,(A,B)=>{if("target"!==A&&"blockContainer"!==A)return B},2);this.emit("playgroundData",{blocks:this.editingTarget.blocks,threads:t})}postIOData(A,B){this.runtime.ioDevices[A]&&this.runtime.ioDevices[A].postData(B)}setVideoProvider(A){this.runtime.ioDevices.video.setProvider(A)}setCloudProvider(A){this.runtime.ioDevices.cloud.setProvider(A)}scanForPeripheral(A){this.runtime.scanForPeripheral(A)}connectPeripheral(A,B){this.runtime.connectPeripheral(A,B)}disconnectPeripheral(A){this.runtime.disconnectPeripheral(A)}getPeripheralIsConnected(A){return this.runtime.getPeripheralIsConnected(A)}loadProject(A){"object"!=typeof A||A instanceof ArrayBuffer||ArrayBuffer.isView(A)||(A=JSON.stringify(A));return new Promise((B,e)=>{t(86)(A,!1,(A,t)=>{if(A)return e(A);B(t)})}).catch(B=>{const{SB1File:e,ValidationError:g}=t(323);try{const B=new e(A),t=B.json;return t.projectVersion=2,Promise.resolve([t,B.zip])}catch(A){if(!(A instanceof g||"".concat(A).includes("Non-ascii character in FixedAsciiString")))return Promise.reject(A)}return Promise.reject(B)}).then(A=>this.deserializeProject(A[0],A[1])).then(()=>this.runtime.emitProjectLoaded()).catch(A=>A.hasOwnProperty("validationError")?Promise.reject(JSON.stringify(A)):Promise.reject(A))}downloadProjectId(A){const B=this.runtime.storage;if(!B)return void r.error("No storage module present; cannot load project: ",A);const t=this;B.load(B.AssetType.Project,A).then(B=>B?t.loadProject(B.data):(r.error("Failed to fetch project with id: ".concat(A)),null))}saveProjectSb3(){const A=h(this.runtime),B=M(this.runtime),t=this.toJSON(),e=new i;return e.file("project.json",t),this._addFileDescsToZip(A.concat(B),e),e.generateAsync({type:"blob",mimeType:"application/x.scratch.sb3",compression:"DEFLATE",compressionOptions:{level:6}})}saveProjectSb3DontZip(){const A=h(this.runtime),B=M(this.runtime),t=this.toJSON(),g={"project.json":(new e).encode(t)};for(const t of A.concat(B))g[t.fileName]=t.fileContent;return g}get assets(){return this.runtime.targets.reduce((A,B)=>A.concat(B.sprite.sounds.map(A=>A.asset)).concat(B.sprite.costumes.map(A=>A.asset)),[])}_addFileDescsToZip(A,B){for(let t=0;t{let{targets:B,extensions:t}=A;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(A){r.error(A)}}return this.installTargets(B,t,!0)})}async installTargets(A,B,t){await this.extensionManager.allAsyncExtensionsLoaded();const e=[];return B.extensionIDs.forEach(A=>{if(!this.extensionManager.isExtensionLoaded(A)){const t=B.extensionURLs.get(A)||A;e.push(this.extensionManager.loadExtensionURL(t))}}),A=A.filter(A=>!!A),Promise.all(e).then(()=>{A.forEach(A=>{this.runtime.addTarget(A),A.updateAllDrawableProperties(),A.isSprite()&&this.renameSprite(A.id,A.getName())}),this.runtime.executableTargets.sort((A,B)=>A.layerOrder-B.layerOrder),A.forEach(A=>{delete A.layerOrder}),t&&A.length>1?this.editingTarget=A[1]:this.editingTarget=A[0],t||this.editingTarget.fixUpVariableReferences(),t&&this.runtime.parseProjectOptions(),this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.runtime.ioDevices.cloud.setStage(this.runtime.getTargetForStage())})}addSprite(A){"object"!=typeof A||A instanceof ArrayBuffer||ArrayBuffer.isView(A)||(A=JSON.stringify(A));return new Promise((B,e)=>{t(86)(A,!0,(A,t)=>{if(A)return e(A);B(t)})}).then(A=>{const B=A[0].projectVersion;return 2===B?this._addSprite2(A[0],A[1]):3===B?this._addSprite3(A[0],A[1]):Promise.reject("".concat("Sprite Upload Error:"," Unable to verify sprite version."))}).then(()=>this.runtime.emitProjectChanged()).catch(A=>A.hasOwnProperty("validationError")?Promise.reject(JSON.stringify(A)):Promise.reject("".concat("Sprite Upload Error:"," ").concat(A)))}_addSprite2(A,B){return t(89).deserialize(A,this.runtime,!0,B).then(A=>{let{targets:B,extensions:t}=A;return this.installTargets(B,t,!1)})}_addSprite3(A,B){return t(33).deserialize(A,this.runtime,B,!0).then(A=>{let{targets:B,extensions:t}=A;return this.installTargets(B,t,!1)})}addCostume(A,B,t,e){const g=t?this.runtime.getTargetById(t):this.editingTarget;return g?I(A,B,this.runtime,e).then(()=>{g.addCostume(B),g.setCostume(g.getCostumes().length-1),this.runtime.emitProjectChanged()}):Promise.reject()}addCostumeFromLibrary(A,B){return this.editingTarget?this.addCostume(A,B,this.editingTarget.id,2):Promise.reject()}duplicateCostume(A){const B=this.editingTarget.getCostumes()[A],t=Object.assign({},B),e="".concat(t.assetId,".").concat(t.dataFormat);return I(e,t,this.runtime).then(()=>{this.editingTarget.addCostume(t,A+1),this.editingTarget.setCostume(A+1),this.emitTargetsUpdate()})}duplicateSound(A){const B=this.editingTarget.getSounds()[A],t=Object.assign({},B);return Y(t,this.runtime,this.editingTarget.sprite.soundBank).then(()=>{this.editingTarget.addSound(t,A+1),this.emitTargetsUpdate()})}renameCostume(A,B){this.editingTarget.renameCostume(A,B),this.emitTargetsUpdate()}deleteCostume(A){const B=this.editingTarget.deleteCostume(A);if(B){const A=this.editingTarget;return this.runtime.emitProjectChanged(),()=>{A.addCostume(B),this.emitTargetsUpdate()}}return null}addSound(A,B){const t=B?this.runtime.getTargetById(B):this.editingTarget;return t?Y(A,this.runtime,t.sprite.soundBank).then(()=>{t.addSound(A),this.emitTargetsUpdate()}):Promise.reject(new Error("No target with ID: ".concat(B)))}renameSound(A,B){this.editingTarget.renameSound(A,B),this.emitTargetsUpdate()}getSoundBuffer(A){const B=this.editingTarget.sprite.sounds[A].soundId;return B&&this.runtime&&this.runtime.audioEngine?this.editingTarget.sprite.soundBank.getSoundPlayer(B).buffer:null}updateSoundBuffer(A,B,t){const e=this.editingTarget.sprite.sounds[A];e&&e.broken&&delete e.broken;const g=e?e.soundId:null;if(g&&this.runtime&&this.runtime.audioEngine&&(this.editingTarget.sprite.soundBank.getSoundPlayer(g).buffer=B),t){e.format="";const A=this.runtime.storage;e.asset=A.createAsset(A.AssetType.Sound,A.DataFormat.WAV,t,null,!0),e.assetId=e.asset.assetId,e.dataFormat=A.DataFormat.WAV,e.md5="".concat(e.assetId,".").concat(e.dataFormat),e.sampleCount=B.length,e.rate=B.sampleRate}this.emitTargetsUpdate()}deleteSound(A){const B=this.editingTarget,t=this.editingTarget.deleteSound(A);if(t){this.runtime.emitProjectChanged();return()=>{B.addSound(t),this.emitTargetsUpdate()}}return null}getCostume(A){const B=this.editingTarget.getCostumes()[A].asset;if(!B||!this.runtime||!this.runtime.storage)return null;const t=B.dataFormat;return t===this.runtime.storage.DataFormat.SVG?B.decodeText():t===this.runtime.storage.DataFormat.PNG||t===this.runtime.storage.DataFormat.JPG?B.encodeDataURI():(r.error("Unhandled format: ".concat(B.dataFormat)),null)}getExportedCostume(A){return F(A)}getExportedCostumeBase64(A){const B=this.getExportedCostume(A);return D.uint8ArrayToBase64(B)}updateBitmap(A,B,t,e,g){return this._updateBitmap(this.editingTarget.getCostumes()[A],B,t,e,g)}_updateBitmap(A,B,t,e,g){if(!(A&&this.runtime&&this.runtime.renderer))return;A&&A.broken&&delete A.broken,A.rotationCenterX=t,A.rotationCenterY=e;const i=0===B.sourceWidth?0:B.width,s=0===B.sourceHeight?0:B.height,n=document.createElement("canvas");n.width=i,n.height=s;n.getContext("2d").putImageData(B,0,0),this.runtime.renderer.updateBitmapSkin(A.skinId,n,g,[t/g,e/g]),n.toBlob(B=>{const t=new FileReader;t.addEventListener("loadend",()=>{const B=this.runtime.storage;A.dataFormat=B.DataFormat.PNG,A.bitmapResolution=g,A.size=[i,s],A.asset=B.createAsset(B.AssetType.ImageBitmap,A.dataFormat,Q.from(t.result),null,!0),A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat),this.emitTargetsUpdate()}),B&&t.readAsArrayBuffer(B)})}updateSvg(A,B,t,e){return this._updateSvg(this.editingTarget.getCostumes()[A],B,t,e)}_updateSvg(A,B,t,g){A&&A.broken&&delete A.broken,A&&this.runtime&&this.runtime.renderer&&(A.rotationCenterX=t,A.rotationCenterY=g,this.runtime.renderer.updateSVGSkin(A.skinId,B,[t,g]),A.size=this.runtime.renderer.getSkinSize(A.skinId));const i=this.runtime.storage;A.dataFormat=i.DataFormat.SVG,A.bitmapResolution=1,A.asset=i.createAsset(i.AssetType.ImageVector,A.dataFormat,(new e).encode(B),null,!0),A.assetId=A.asset.assetId,A.md5="".concat(A.assetId,".").concat(A.dataFormat),this.emitTargetsUpdate()}addBackdrop(A,B){return I(A,B,this.runtime).then(()=>{const A=this.runtime.getTargetForStage();A.addCostume(B),A.setCostume(A.getCostumes().length-1),this.runtime.emitProjectChanged()})}renameSprite(A,B){const t=this.runtime.getTargetById(A);if(!t)throw new Error("No target with the provided id.");{if(!t.isSprite())throw new Error("Cannot rename non-sprite targets.");const A=t.sprite;if(!A)throw new Error("No sprite associated with this target.");if(B&&-1===u.indexOf(B)){const e=this.runtime.targets.filter(A=>A.isSprite()&&A.id!==t.id).map(A=>A.sprite.name),g=A.name,i=o.unusedName(B,e);if(A.name=i,g===i)return;const Q=this.runtime.targets;for(let A=0;AA.id).indexOf(B.id);if(!B.isSprite())throw new Error("Cannot delete non-sprite targets.");const e=B.sprite;if(!e)throw new Error("No sprite associated with this target.");const g=this.exportSprite(A,"uint8array"),i=()=>g.then(A=>this.addSprite(A));B.deleteMonitors();const Q=this.editingTarget;for(let A=0;A0?this.setEditingTarget(this.runtime.targets[A].id):this.editingTarget=null}}return this.emitTargetsUpdate(),i}throw new Error("No target with the provided id.")}duplicateSprite(A){const B=this.runtime.getTargetById(A);if(!B)throw new Error("No target with the provided id.");if(!B.isSprite())throw new Error("Cannot duplicate non-sprite targets.");if(!B.sprite)throw new Error("No sprite associated with this target.");return B.duplicate().then(A=>{this.runtime.addTarget(A),A.goBehindOther(B),this.setEditingTarget(A.id)})}attachAudioEngine(A){this.runtime.attachAudioEngine(A)}attachRenderer(A){this.runtime.attachRenderer(A)}get renderer(){return this.runtime&&this.runtime.renderer}attachV2SVGAdapter(){}attachV2BitmapAdapter(A){this.runtime.attachV2BitmapAdapter(A)}attachStorage(A){this.runtime.attachStorage(A)}setLocale(A,B){return A!==w.setup().locale&&w.setup({locale:A,translations:{[A]:B}}),this.extensionManager.refreshBlocks()}getLocale(){return w.setup().locale}blockListener(A){this.editingTarget&&this.editingTarget.blocks.blocklyListen(A)}flyoutBlockListener(A){this.runtime.flyoutBlocks.blocklyListen(A)}monitorBlockListener(A){-1!==["create","change"].indexOf(A.type)&&this.runtime.monitorBlocks.blocklyListen(A)}variableListener(A){-1!==["var_create","var_rename","var_delete"].indexOf(A.type)&&this.runtime.getTargetForStage().blocks.blocklyListen(A)}setEditingTarget(A){if(this.editingTarget&&A===this.editingTarget.id)return;const B=this.runtime.getTargetById(A);B&&(this.editingTarget=B,this.emitTargetsUpdate(!1),this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(B))}shareBlocksToTarget(A,B,e){const g=t(33),i=JSON.parse(JSON.stringify(A));a(i);const Q=this.runtime.getTargetById(B);if(e){this.runtime.getTargetById(e).resolveVariableSharingConflictsWithTarget(i,Q)}const s=new Set(i.map(A=>g.getExtensionIdForOpcode(A.opcode)).filter(A=>!!A).filter(A=>!this.extensionManager.isExtensionLoaded(A))),n=Array.from(s,A=>this.extensionManager.loadExtensionURL(A));return Promise.all(n).then(()=>{i.forEach(A=>{Q.blocks.createBlock(A)}),Q.blocks.updateTargetSpecificBlocks(Q.isStage)})}shareCostumeToTarget(A,B){const t=this.editingTarget.getCostumes()[A],e=Object.assign({},t),g="".concat(e.assetId,".").concat(e.dataFormat);return I(g,e,this.runtime).then(()=>{const A=this.runtime.getTargetById(B);A&&(A.addCostume(e),A.setCostume(A.getCostumes().length-1))})}shareSoundToTarget(A,B){const t=this.editingTarget.getSounds()[A],e=Object.assign({},t),g=this.runtime.getTargetById(B);return Y(e,this.runtime,g.sprite.soundBank).then(()=>{g&&(g.addSound(e),this.emitTargetsUpdate())})}refreshWorkspace(){this.editingTarget&&(this.emitWorkspaceUpdate(),this.runtime.setEditingTarget(this.editingTarget),this.emitTargetsUpdate(!1))}emitTargetsUpdate(A){let B;void 0===A&&(A=!0);const t=()=>(B||(B=this.runtime.targets.filter(A=>!A.hasOwnProperty("isOriginal")||A.isOriginal).map(A=>A.toJSON())),B);this.emit("targetsUpdate",{get targetList(){return t()},editingTarget:this.editingTarget?this.editingTarget.id:null}),A&&this.runtime.emitProjectChanged()}emitWorkspaceUpdate(){const A=this.runtime.getTargetForStage().variables;let B=[];for(const t in A)A[t].type===C.BROADCAST_MESSAGE_TYPE&&B.push(t);for(let A=0;At[A]),i=Object.keys(e).map(A=>e[A]),Q=Object.keys(this.editingTarget.comments).map(A=>this.editingTarget.comments[A]).filter(A=>null===A.blockId),s='\n \n '.concat(g.map(A=>A.toXML()).join(),"\n ").concat(i.map(A=>A.toXML(!0)).join(),"\n \n ").concat(Q.map(A=>A.toXML()).join(),"\n ").concat(this.editingTarget.blocks.toXML(this.editingTarget.comments),"\n ");this.emit("workspaceUpdate",{xml:s})}getTargetIdForDrawableId(A){const B=this.runtime.getTargetByDrawableId(A);return B&&B.hasOwnProperty("id")&&B.hasOwnProperty("isStage")&&!B.isStage?B.id:null}reorderTarget(A,B){let t=this.runtime.targets;if((A=c.clamp(A,0,t.length-1))===(B=c.clamp(B,0,t.length-1)))return!1;const e=t[A];return t=t.slice(0,A).concat(t.slice(A+1)),t.splice(B,0,e),this.runtime.targets=t,this.emitTargetsUpdate(),!0}reorderCostume(A,B,t){const e=this.runtime.getTargetById(A);if(e){const A=e.reorderCostume(B,t);return A&&this.runtime.emitProjectChanged(),A}return!1}reorderSound(A,B,t){const e=this.runtime.getTargetById(A);if(e){const A=e.reorderSound(B,t);return A&&this.runtime.emitProjectChanged(),A}return!1}startDrag(A){const B=this.runtime.getTargetById(A);B&&(this._dragTarget=B,B.startDrag())}stopDrag(A){const B=this.runtime.getTargetById(A);B&&(this._dragTarget=null,B.stopDrag(),this.setEditingTarget(B.sprite&&B.sprite.clones[0]?B.sprite.clones[0].id:B.id))}postSpriteInfo(A){this._dragTarget?this._dragTarget.postSpriteInfo(A):this.editingTarget.postSpriteInfo(A),this.runtime.emitProjectChanged()}setVariableValue(A,B,t){const e=this.runtime.getTargetById(A);if(e){const A=e.lookupVariableById(B);if(A)return A.value=t,A.isCloud&&this.runtime.ioDevices.cloud.requestUpdateVariable(A.name,A.value),!0}return!1}getVariableValue(A,B){const t=this.runtime.getTargetById(A);if(t){const A=t.lookupVariableById(B);if(A)return A.value}return null}configureScratchLinkSocketFactory(A){this.runtime.configureScratchLinkSocketFactory(A)}}},function(A,B,t){"use strict";B.byteLength=function(A){var B=r(A),t=B[0],e=B[1];return 3*(t+e)/4-e},B.toByteArray=function(A){var B,t,e=r(A),Q=e[0],s=e[1],n=new i(function(A,B,t){return 3*(B+t)/4-t}(0,Q,s)),c=0,E=s>0?Q-4:Q;for(t=0;t>16&255,n[c++]=B>>8&255,n[c++]=255&B;2===s&&(B=g[A.charCodeAt(t)]<<2|g[A.charCodeAt(t+1)]>>4,n[c++]=255&B);1===s&&(B=g[A.charCodeAt(t)]<<10|g[A.charCodeAt(t+1)]<<4|g[A.charCodeAt(t+2)]>>2,n[c++]=B>>8&255,n[c++]=255&B);return n},B.fromByteArray=function(A){for(var B,t=A.length,g=t%3,i=[],Q=0,s=t-g;Qs?s:Q+16383));1===g?(B=A[t-1],i.push(e[B>>2]+e[B<<4&63]+"==")):2===g&&(B=(A[t-2]<<8)+A[t-1],i.push(e[B>>10]+e[B>>4&63]+e[B<<2&63]+"="));return i.join("")};for(var e=[],g=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,Q="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,n=Q.length;s0)throw new Error("Invalid string. Length must be a multiple of 4");var t=A.indexOf("=");return-1===t&&(t=B),[t,t===B?0:4-t%4]}function c(A,B,t){for(var g,i,Q=[],s=B;s>18&63]+e[i>>12&63]+e[i>>6&63]+e[63&i]);return Q.join("")}g["-".charCodeAt(0)]=62,g["_".charCodeAt(0)]=63},function(A,B){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -B.read=function(A,B,t,e,g){var i,Q,s=8*g-e-1,n=(1<>1,E=-7,c=t?g-1:0,o=t?-1:1,w=A[B+c];for(c+=o,i=w&(1<<-E)-1,w>>=-E,E+=s;E>0;i=256*i+A[B+c],c+=o,E-=8);for(Q=i&(1<<-E)-1,i>>=-E,E+=e;E>0;Q=256*Q+A[B+c],c+=o,E-=8);if(0===i)i=1-r;else{if(i===n)return Q?NaN:1/0*(w?-1:1);Q+=Math.pow(2,e),i-=r}return(w?-1:1)*Q*Math.pow(2,i-e)},B.write=function(A,B,t,e,g,i){var Q,s,n,r=8*i-g-1,E=(1<>1,o=23===g?Math.pow(2,-24)-Math.pow(2,-77):0,w=e?0:i-1,C=e?1:-1,a=B<0||0===B&&1/B<0?1:0;for(B=Math.abs(B),isNaN(B)||B===1/0?(s=isNaN(B)?1:0,Q=E):(Q=Math.floor(Math.log(B)/Math.LN2),B*(n=Math.pow(2,-Q))<1&&(Q--,n*=2),(B+=Q+c>=1?o/n:o*Math.pow(2,1-c))*n>=2&&(Q++,n/=2),Q+c>=E?(s=0,Q=E):Q+c>=1?(s=(B*n-1)*Math.pow(2,g),Q+=c):(s=B*Math.pow(2,c-1)*Math.pow(2,g),Q=0));g>=8;A[t+w]=255&s,w+=C,s/=256,g-=8);for(Q=Q<0;A[t+w]=255&Q,w+=C,Q/=256,r-=8);A[t+w-C]|=128*a}},function(A,B){var t={}.toString;A.exports=Array.isArray||function(A){return"[object Array]"==t.call(A)}},function(A,B,t){(function(A){var e=void 0!==A&&A||"undefined"!=typeof self&&self||window,g=Function.prototype.apply;function i(A,B){this._id=A,this._clearFn=B}B.setTimeout=function(){return new i(g.call(setTimeout,e,arguments),clearTimeout)},B.setInterval=function(){return new i(g.call(setInterval,e,arguments),clearInterval)},B.clearTimeout=B.clearInterval=function(A){A&&A.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(e,this._id)},B.enroll=function(A,B){clearTimeout(A._idleTimeoutId),A._idleTimeout=B},B.unenroll=function(A){clearTimeout(A._idleTimeoutId),A._idleTimeout=-1},B._unrefActive=B.active=function(A){clearTimeout(A._idleTimeoutId);var B=A._idleTimeout;B>=0&&(A._idleTimeoutId=setTimeout((function(){A._onTimeout&&A._onTimeout()}),B))},t(110),B.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==A&&A.setImmediate||this&&this.setImmediate,B.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==A&&A.clearImmediate||this&&this.clearImmediate}).call(this,t(10))},function(A,B,t){(function(A,B){!function(A,t){"use strict";if(!A.setImmediate){var e,g,i,Q,s,n=1,r={},E=!1,c=A.document,o=Object.getPrototypeOf&&Object.getPrototypeOf(A);o=o&&o.setTimeout?o:A,"[object process]"==={}.toString.call(A.process)?e=function(A){B.nextTick((function(){C(A)}))}:!function(){if(A.postMessage&&!A.importScripts){var B=!0,t=A.onmessage;return A.onmessage=function(){B=!1},A.postMessage("","*"),A.onmessage=t,B}}()?A.MessageChannel?((i=new MessageChannel).port1.onmessage=function(A){C(A.data)},e=function(A){i.port2.postMessage(A)}):c&&"onreadystatechange"in c.createElement("script")?(g=c.documentElement,e=function(A){var B=c.createElement("script");B.onreadystatechange=function(){C(A),B.onreadystatechange=null,g.removeChild(B),B=null},g.appendChild(B)}):e=function(A){setTimeout(C,0,A)}:(Q="setImmediate$"+Math.random()+"$",s=function(B){B.source===A&&"string"==typeof B.data&&0===B.data.indexOf(Q)&&C(+B.data.slice(Q.length))},A.addEventListener?A.addEventListener("message",s,!1):A.attachEvent("onmessage",s),e=function(B){A.postMessage(Q+B,"*")}),o.setImmediate=function(A){"function"!=typeof A&&(A=new Function(""+A));for(var B=new Array(arguments.length-1),t=0;t2?t-2:0),g=2;g3?e-3:0),i=3;i3?e-3:0),i=3;i4?g-4:0),Q=4;Q{const s=this._storeCallbacks(g,Q);i.length>0&&"function"==typeof i[i.length-1].func&&(i.pop(),i.pop()),e?A.postMessage({service:B,method:t,responseId:s,args:i},e):A.postMessage({service:B,method:t,responseId:s,args:i})})}_storeCallbacks(A,B){const t=this.nextResponseId++;return this.callbacks[t]=[A,B],t}_deliverResponse(A,B){try{const[t,e]=this.callbacks[A];delete this.callbacks[A],B.error?e(B.error):t(B.result)}catch(A){e.error("Dispatch callback failed: ".concat(A))}}_onMessage(A,B){const t=B.data;let g;t.args=t.args||[],t.service?g="dispatch"===t.service?this._onDispatchMessage(A,t):this.call(t.service,t.method,...t.args):void 0===t.responseId?e.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(B))):this._deliverResponse(t.responseId,t),g&&(void 0===t.responseId?e.error("Dispatch message missing required response ID: ".concat(JSON.stringify(B))):g.then(B=>A.postMessage({responseId:t.responseId,result:B}),B=>A.postMessage({responseId:t.responseId,error:"".concat(B)})))}_getServiceProvider(A){throw new Error("Could not get provider for ".concat(A,": _getServiceProvider not implemented"))}_onDispatchMessage(A,B){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(B.method," method"))}}},function(A,B,t){var e=t(12),g=t(114),i=new e,Q=Array.prototype.slice;(B=A.exports=function(A){var t=function(){return i.write(A,void 0,Q.call(arguments)),t};return t.debug=function(){return i.write(A,"debug",Q.call(arguments)),t},t.info=function(){return i.write(A,"info",Q.call(arguments)),t},t.warn=function(){return i.write(A,"warn",Q.call(arguments)),t},t.error=function(){return i.write(A,"error",Q.call(arguments)),t},t.log=t.debug,t.suggest=B.suggest,t.format=i.format,t}).defaultBackend=B.defaultFormatter=null,B.pipe=function(A){return i.pipe(A)},B.end=B.unpipe=B.disable=function(A){return i.unpipe(A)},B.Transform=e,B.Filter=g,B.suggest=new g,B.enable=function(){return B.defaultFormatter?i.pipe(B.suggest).pipe(B.defaultFormatter).pipe(B.defaultBackend):i.pipe(B.suggest).pipe(B.defaultBackend)}},function(A,B){function t(){this._events={}}t.prototype={on:function(A,B){this._events||(this._events={});var t=this._events;return(t[A]||(t[A]=[])).push(B),this},removeListener:function(A,B){var t,e=this._events[A]||[];for(t=e.length-1;t>=0&&e[t];t--)e[t]!==B&&e[t].cb!==B||e.splice(t,1)},removeAllListeners:function(A){A?this._events[A]&&(this._events[A]=[]):this._events={}},listeners:function(A){return this._events&&this._events[A]||[]},emit:function(A){this._events||(this._events={});var B,t=Array.prototype.slice.call(arguments,1),e=this._events[A]||[];for(B=e.length-1;B>=0&&e[B];B--)e[B].apply(this,t);return this},when:function(A,B){return this.once(A,B,!0)},once:function(A,B,t){if(!B)return this;function e(){t||this.removeListener(A,e),B.apply(this,arguments)&&t&&this.removeListener(A,e)}return e.cb=B,this.on(A,e),this}},t.mixin=function(A){var B,e=t.prototype;for(B in e)e.hasOwnProperty(B)&&(A.prototype[B]=e[B])},A.exports=t},function(A,B,t){var e=t(12),g={debug:1,info:2,warn:3,error:4};function i(){this.enabled=!0,this.defaultResult=!0,this.clear()}function Q(A,B){return A.n.test?A.n.test(B):A.n==B}e.mixin(i),i.prototype.allow=function(A,B){return this._white.push({n:A,l:g[B]}),this},i.prototype.deny=function(A,B){return this._black.push({n:A,l:g[B]}),this},i.prototype.clear=function(){return this._white=[],this._black=[],this},i.prototype.test=function(A,B){var t,e=Math.max(this._white.length,this._black.length);for(t=0;t=this._white[t].l)return!0;if(this._black[t]&&Q(this._black[t],A)&&g[B]<=this._black[t].l)return!1}return this.defaultResult},i.prototype.write=function(A,B,t){if(!this.enabled||this.test(A,B))return this.emit("item",A,B,t)},A.exports=i},function(A,B,t){var e=t(12),g=/\n+$/,i=new e;i.write=function(A,B,t){var e=t.length-1;if("undefined"!=typeof console&&console.log){if(console.log.apply)return console.log.apply(console,[A,B].concat(t));if(JSON&&JSON.stringify){t[e]&&"string"==typeof t[e]&&(t[e]=t[e].replace(g,""));try{for(e=0;et(124),pen:()=>t(125),wedo2:()=>t(129),music:()=>t(133),microbit:()=>t(196),text2speech:()=>t(197),translate:()=>t(198),videoSensing:()=>t(199),ev3:()=>t(231),makeymakey:()=>t(233),boost:()=>t(234),gdxfor:()=>t(235),tw:()=>t(238)};A.exports=class{constructor(A){this.nextExtensionWorker=0,this.pendingExtensions=[],this.pendingWorkers=[],this._loadedExtensions=new Map,this.workerMode="worker",this.runtime=A,this.loadingAsyncExtensions=0,this.asyncExtensionsLoadedCallbacks=[],e.setService("extensions",(A=>{const B={};return B.registerExtensionServiceSync=A.registerExtensionServiceSync.bind(A),B.allocateWorker=A.allocateWorker.bind(A),B.onWorkerInit=A.onWorkerInit.bind(A),B.registerExtensionService=A.registerExtensionService.bind(A),B})(this)).catch(A=>{g.error("ExtensionManager was unable to register extension service: ".concat(JSON.stringify(A)))})}isExtensionLoaded(A){return this._loadedExtensions.has(A)}loadExtensionIdSync(A){if(!s.hasOwnProperty(A))return void g.warn("Could not find extension ".concat(A," in the built in extensions."));if(this.isExtensionLoaded(A)){const B="Rejecting attempt to load a second extension with ID ".concat(A);return void g.warn(B)}const B=new(s[A]())(this.runtime),t=this._registerInternalExtension(B);this._loadedExtensions.set(A,t),this.runtime.compilerRegisterExtension(A,B)}loadExtensionURL(A){if(s.hasOwnProperty(A)){if(this.isExtensionLoaded(A)){const B="Rejecting attempt to load a second extension with ID ".concat(A);return g.warn(B),Promise.resolve()}const B=new(s[A]())(this.runtime),t=this._registerInternalExtension(B);return this._loadedExtensions.set(A,t),this.runtime.compilerRegisterExtension(A,B),Promise.resolve()}return this.loadingAsyncExtensions++,new Promise((B,t)=>{this.pendingExtensions.push({extensionURL:A,resolve:B,reject:t}),this.createExtensionWorker().then(A=>e.addWorker(A)).catch(A=>t(A))})}allAsyncExtensionsLoaded(){if(0!==this.loadingAsyncExtensions)return new Promise(A=>{this.asyncExtensionsLoadedCallbacks.push(A)})}createExtensionWorker(){if("worker"===this.workerMode){const A=t(239);return Promise.resolve(new A)}return"iframe"===this.workerMode?t.e(0).then(t.t.bind(null,322,7)).then(A=>new A.default):Promise.reject(new Error("Unknown extension worker mode"))}refreshBlocks(){const A=Array.from(this._loadedExtensions.values()).map(A=>e.call(A,"getInfo").then(B=>{B=this._prepareExtensionInfo(A,B),e.call("runtime","_refreshExtensionPrimitives",B)}).catch(A=>{g.error("Failed to refresh built-in extension primitives: ".concat(JSON.stringify(A)))}));return Promise.all(A)}allocateWorker(){const A=this.nextExtensionWorker++,B=this.pendingExtensions.shift();return this.pendingWorkers[A]=B,[A,B.extensionURL]}registerExtensionServiceSync(A){const B=e.callSync(A,"getInfo");this._registerExtensionInfo(A,B)}registerExtensionService(A){e.call(A,"getInfo").then(B=>{this._loadedExtensions.set(B.id,A),this._registerExtensionInfo(A,B),this.loadingAsyncExtensions--,0===this.loadingAsyncExtensions&&(this.asyncExtensionsLoadedCallbacks.forEach(A=>A()),this.asyncExtensionsLoadedCallbacks=[])})}onWorkerInit(A,B){const t=this.pendingWorkers[A];delete this.pendingWorkers[A],B?t.reject(B):t.resolve(A)}_registerInternalExtension(A){const B=A.getInfo(),t=this.nextExtensionWorker++,g="extension_".concat(t,"_").concat(B.id);return e.setServiceSync(g,A),e.callSync("extensions","registerExtensionServiceSync",g),g}_registerExtensionInfo(A,B){B=this._prepareExtensionInfo(A,B),e.call("runtime","_registerExtensionPrimitives",B).catch(B=>{g.error("Failed to register primitives for extension on service ".concat(A,":"),B)})}_sanitizeID(A){return A.toString().replace(/[<"&]/,"_")}_prepareExtensionInfo(A,B){if(B=Object.assign({},B),!/^[a-z0-9]+$/i.test(B.id))throw new Error("Invalid extension id");return B.name=B.name||B.id,B.blocks=B.blocks||[],B.targetTypes=B.targetTypes||[],B.blocks=B.blocks.reduce((B,t)=>{try{let e;switch(t){case"---":e="---";break;default:e=this._prepareBlockInfo(A,t)}B.push(e)}catch(A){g.error("Error processing block: ".concat(A.message,", Block:\n").concat(JSON.stringify(t)))}return B},[]),B.menus=B.menus||{},B.menus=this._prepareMenuInfo(A,B.menus),B}_prepareMenuInfo(A,B){const t=Object.getOwnPropertyNames(B);for(let g=0;g{switch(typeof(A=i(A,g))){case"object":return[i(A.text,g),A.value];case"string":return[A,A];default:return A}});if(!Q||Q.length<1)throw new Error("Extension menu returned no items: ".concat(B));return Q}_prepareBlockInfo(A,B){switch((B=Object.assign({},{blockType:Q.COMMAND,terminal:!1,blockAllThreads:!1,arguments:{}},B)).opcode=B.opcode&&this._sanitizeID(B.opcode),B.text=B.text||B.opcode,B.blockType){case Q.EVENT:B.func&&g.warn('Ignoring function "'.concat(B.func,'" for event block ').concat(B.opcode));break;case Q.BUTTON:B.opcode&&g.warn('Ignoring opcode "'.concat(B.opcode,'" for button with text: ').concat(B.text));break;default:{if(!B.opcode)throw new Error("Missing opcode for block");const t=B.func?this._sanitizeID(B.func):B.opcode,i=B.isDynamic?A=>A&&A.mutation&&A.mutation.blockInfo:()=>B,Q=(()=>{if(e._isRemoteService(A))return(B,g,i)=>e.call(A,t,B,g,i).then(A=>"number"==typeof A||"string"==typeof A||"boolean"==typeof A?A:"".concat(A)).catch(A=>"".concat(A));const B=e.services[A];return B[t]||g.warn("Could not find extension block function called ".concat(t)),(A,e,g)=>B[t](A,e,g)})();B.func=(A,B)=>{const t=i(A);return Q(A,B,t)};break}}return B}}},function(A,B,t){"use strict";var e=["number","date","time","ordinal","duration","spellout"],g=["plural","select","selectordinal"];function i(A,B){var t=A.pattern,e=t.length,g=[],i=A.index,s=Q(A,B);for(s&&g.push(s),s&&A.tokens&&A.tokens.push(["text",t.slice(i,A.index)]);A.index=9&&A<=13||32===A||133===A||160===A||6158===A||A>=8192&&A<=8205||8232===A||8233===A||8239===A||8287===A||8288===A||12288===A||65279===A}function n(A){for(var B=A.pattern,t=B.length,e=A.index;A.index"===A.pattern.slice(A.index,A.index+"/>".length))return A.tokens&&A.tokens.push(["syntax","/>"]),A.index+="/>".length,[t,B];if(">"!==A.pattern[A.index])throw C(A,">");A.tokens&&A.tokens.push(["syntax",">"]);++A.index;var e=i(A,B),g=A.index;if("");A.tokens&&A.tokens.push(["syntax","","");if(n(A),">"!==A.pattern[A.index])throw C(A,">");A.tokens&&A.tokens.push(["syntax",">"]);return++A.index,[t,B,{children:e}]}(A);if(t)return t;if("{"!==B[A.index])throw C(A,"{");A.tokens&&A.tokens.push(["syntax","{"]),++A.index,n(A);var g=E(A);if(!g)throw C(A,"placeholder id");A.tokens&&A.tokens.push(["id",g]),n(A);var Q=B[A.index];if("}"===Q)return A.tokens&&A.tokens.push(["syntax","}"]),++A.index,[g];if(","!==Q)throw C(A,", or }");A.tokens&&A.tokens.push(["syntax",","]),++A.index,n(A);var s,r=E(A);if(!r)throw C(A,"placeholder type");if(A.tokens&&A.tokens.push(["type",r]),n(A),"}"===(Q=B[A.index])){if(A.tokens&&A.tokens.push(["syntax","}"]),"plural"===r||"selectordinal"===r||"select"===r)throw C(A,r+" sub-messages");return++A.index,[g,r]}if(","!==Q)throw C(A,", or }");if(A.tokens&&A.tokens.push(["syntax",","]),++A.index,n(A),"plural"===r||"selectordinal"===r){var w=function(A){var B=A.pattern,t=B.length,e=0;if("offset:"===B.slice(A.index,A.index+"offset:".length)){A.tokens&&A.tokens.push(["offset","offset"],["syntax",":"]),A.index+="offset:".length,n(A);for(var g=A.index;A.index=48&&i<=57);)++A.index;if(g===A.index)throw C(A,"offset number");A.tokens&&A.tokens.push(["number",B.slice(g,A.index)]),e=+B.slice(g,A.index)}var i;return e}(A);n(A),s=[g,r,w,o(A,r)]}else if("select"===r)s=[g,r,o(A,r)];else if(e.indexOf(r)>=0)s=[g,r,c(A)];else{var a=A.index,I=c(A);n(A),"{"===B[A.index]&&(A.index=a,I=o(A,r)),s=[g,r,I]}if(n(A),"}"!==B[A.index])throw C(A,"}");return A.tokens&&A.tokens.push(["syntax","}"]),++A.index,s}function E(A,B){for(var t=A.pattern,e=t.length,g="";A.index"===i||"/"===i))break;g+=i,++A.index}return g}function c(A){var B=A.index,t=Q(A,"{style}");if(!t)throw C(A,"placeholder style name");return A.tokens&&A.tokens.push(["style",A.pattern.slice(B,A.index)]),t}function o(A,B){for(var t=A.pattern,e=t.length,i={};A.index=0)throw C(A,null,null,'"other" sub-message must be specified in '+B);return i}function w(A,B){if("{"!==A.pattern[A.index])throw C(A,"{ to start sub-message");A.tokens&&A.tokens.push(["syntax","{"]),++A.index;var t=i(A,B);if("}"!==A.pattern[A.index])throw C(A,"} to end sub-message");return A.tokens&&A.tokens.push(["syntax","}"]),++A.index,t}function C(A,B,t,e){var g=A.pattern,i=g.slice(0,A.index).split(/\r?\n/),Q=A.index,s=i.length,n=i.slice(-1)[0].length;return t=t||(A.index>=g.length?"end of message pattern":E(A)||g[A.index]),e||(e=function(A,B){return A?"Expected "+A+" but found "+B:"Unexpected "+B+" found"}(B,t)),new a(e+=" in "+g.replace(/\r?\n/g,"\n"),B,t,Q,s,n)}function a(A,B,t,e,g,i){Error.call(this,A),this.name="SyntaxError",this.message=A,this.expected=B,this.found=t,this.offset=e,this.line=g,this.column=i}B=A.exports=function(A,B){return i({pattern:String(A),index:0,tagsType:B&&B.tagsType||null,tokens:B&&B.tokens||null},"")},a.prototype=Object.create(Error.prototype),B.SyntaxError=a},function(A,B,t){"use strict";var e=t(57),g=t(58),i=t(59);function Q(A,B,t,e,g){var i=A.map((function(A){return function(A,B,t,e,g){if("string"==typeof A){var i=A;return function(){return i}}var n,r=A[0],E=A[1];if(B&&"#"===A[0]){r=B[0];var c=B[2],w=(e.number||o.number)([r,"number"],t);return function(A){return w(s(r,A)-c,A)}}"plural"===E||"selectordinal"===E?(n={},Object.keys(A[3]).forEach((function(B){n[B]=Q(A[3][B],A,t,e,g)})),A=[A[0],A[1],A[2],n]):A[2]&&"object"==typeof A[2]&&(n={},Object.keys(A[2]).forEach((function(B){n[B]=Q(A[2][B],A,t,e,g)})),A=[A[0],A[1],n]);var C=E&&(e[E]||o[E]);if(C){var a=C(A,t);return function(A){return a(s(r,A),A)}}return g?function(A){return String(s(r,A))}:function(A){return s(r,A)}}(A,B,t,e,g)}));return g?1===i.length?i[0]:function(A){for(var B="",t=0;t0)t=new Intl.PluralRules(B,{type:e});else{var n=g(B,i),r=n&&i[n][e]||c;t={select:r}}return function(A,B){return(s["="+ +A]||s[t.select(A-Q)]||s.other)(B)}}function c(){return"other"}(B=A.exports=function(A,B,t){return Q(A,null,B||"en",t||{},!0)}).toParts=function(A,B,t){return Q(A,null,B||"en",t||{},!1)};var o={number:n,ordinal:n,spellout:n,duration:function(A,B){var t=A[2],g=e.duration[t]||e.duration.default,i=new Intl.NumberFormat(B,g.seconds).format,Q=new Intl.NumberFormat(B,g.minutes).format,s=new Intl.NumberFormat(B,g.hours).format,n=/^fi$|^fi-|^da/.test(String(B))?".":":";return function(A,B){if(A=+A,!isFinite(A))return i(A);var t=~~(A/60/60),e=~~(A/60%60),g=(t?s(Math.abs(t))+n:"")+Q(Math.abs(e))+n+i(Math.abs(A%60));return A<0?s(-1).replace(s(1),g):g}},date:r,time:r,plural:E,selectordinal:E,select:function(A,B){var t=A[2];return function(A,B){return(t[A]||t.other)(B)}}};B.types=o},function(A,B,t){const e=t(2),g=t(5);A.exports=class{constructor(A){this.runtime=A}getInfo(){return{id:"coreExample",name:"CoreEx",blocks:[{func:"MAKE_A_VARIABLE",blockType:e.BUTTON,text:"make a variable (CoreEx)"},{opcode:"exampleOpcode",blockType:e.REPORTER,text:"example block"},{opcode:"exampleWithInlineImage",blockType:e.COMMAND,text:"block with image [CLOCKWISE] inline",arguments:{CLOCKWISE:{type:g.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 A=this.runtime.getTargetForStage();return A?A.getName():"no stage yet"}exampleWithInlineImage(){}}},function(A,B,t){const e=t(5),g=t(2),i=t(60),Q=t(1),s=t(13),n=t(21),r=t(4),E=t(3),c=(t(26),t(0)),o=t(14),w="color",C="saturation",a="brightness",I="transparency";class Y{constructor(A){this.runtime=A,this._penDrawableId=-1,this._penSkinId=-1,this._onTargetCreated=this._onTargetCreated.bind(this),this._onTargetMoved=this._onTargetMoved.bind(this),A.on("targetWasCreated",this._onTargetCreated),A.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(A){return this.runtime.renderer&&this.runtime.renderer.useHighQualityRender||!this.runtime.runtimeOptions.miscLimits?Math.max(0,A):E.clamp(A,Y.PEN_SIZE_RANGE.min,Y.PEN_SIZE_RANGE.max)}_getPenLayerID(){return this._penSkinId<0&&this.runtime.renderer&&(this._penSkinId=this.runtime.renderer.createPenSkin(),this._penDrawableId=this.runtime.renderer.createDrawable(o.PEN_LAYER),this.runtime.renderer.updateDrawableSkinId(this._penDrawableId,this._penSkinId)),this._penSkinId}_getPenState(A){let B=A._customState["Scratch.pen"];return B||(B=s.simple(Y.DEFAULT_PEN_STATE),A.setCustomState(Y.STATE_KEY,B)),B}_onTargetCreated(A,B){if(B){const t=B.getCustomState(Y.STATE_KEY);t&&(A.setCustomState(Y.STATE_KEY,s.simple(t)),t.penDown&&(A.onTargetMoved=this._onTargetMoved))}}_onTargetMoved(A,B,t,e){if(!e){const e=this._getPenLayerID();if(e>=0){const g=this._getPenState(A);this.runtime.renderer.penLine(e,g.penAttributes,B,t,A.x,A.y),this.runtime.requestRedraw()}}}_wrapColor(A){return E.wrapClamp(A,0,100)}_initColorParam(){return[{text:r({id:"pen.colorMenu.color",default:"color",description:"label for color element in color picker for pen extension"}),value:w},{text:r({id:"pen.colorMenu.saturation",default:"saturation",description:"label for saturation element in color picker for pen extension"}),value:C},{text:r({id:"pen.colorMenu.brightness",default:"brightness",description:"label for brightness element in color picker for pen extension"}),value:a},{text:r({id:"pen.colorMenu.transparency",default:"transparency",description:"label for transparency element in color picker for pen extension"}),value:I}]}_clampColorParam(A){return E.clamp(A,0,100)}_alphaToTransparency(A){return 100*(1-A)}_transparencyToAlpha(A){return 1-A/100}getInfo(){return{id:"pen",name:r({id:"pen.categoryName",default:"Pen",description:"Label for the pen extension category"}),blockIconURI:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+cGVuLWljb248L3RpdGxlPjxnIHN0cm9rZT0iIzU3NUU3NSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik04Ljc1MyAzNC42MDJsLTQuMjUgMS43OCAxLjc4My00LjIzN2MxLjIxOC0yLjg5MiAyLjkwNy01LjQyMyA1LjAzLTcuNTM4TDMxLjA2NiA0LjkzYy44NDYtLjg0MiAyLjY1LS40MSA0LjAzMi45NjcgMS4zOCAxLjM3NSAxLjgxNiAzLjE3My45NyA0LjAxNUwxNi4zMTggMjkuNTljLTIuMTIzIDIuMTE2LTQuNjY0IDMuOC03LjU2NSA1LjAxMiIgZmlsbD0iI0ZGRiIvPjxwYXRoIGQ9Ik0yOS40MSA2LjExcy00LjQ1LTIuMzc4LTguMjAyIDUuNzcyYy0xLjczNCAzLjc2Ni00LjM1IDEuNTQ2LTQuMzUgMS41NDYiLz48cGF0aCBkPSJNMzYuNDIgOC44MjVjMCAuNDYzLS4xNC44NzMtLjQzMiAxLjE2NGwtOS4zMzUgOS4zYy4yODItLjI5LjQxLS42NjguNDEtMS4xMiAwLS44NzQtLjUwNy0xLjk2My0xLjQwNi0yLjg2OC0xLjM2Mi0xLjM1OC0zLjE0Ny0xLjgtNC4wMDItLjk5TDMwLjk5IDUuMDFjLjg0NC0uODQgMi42NS0uNDEgNC4wMzUuOTYuODk4LjkwNCAxLjM5NiAxLjk4MiAxLjM5NiAyLjg1NU0xMC41MTUgMzMuNzc0Yy0uNTczLjMwMi0xLjE1Ny41Ny0xLjc2NC44M0w0LjUgMzYuMzgybDEuNzg2LTQuMjM1Yy4yNTgtLjYwNC41My0xLjE4Ni44MzMtMS43NTcuNjkuMTgzIDEuNDQ4LjYyNSAyLjEwOCAxLjI4Mi42Ni42NTggMS4xMDIgMS40MTIgMS4yODcgMi4xMDIiIGZpbGw9IiM0Qzk3RkYiLz48cGF0aCBkPSJNMzYuNDk4IDguNzQ4YzAgLjQ2NC0uMTQuODc0LS40MzMgMS4xNjVsLTE5Ljc0MiAxOS42OGMtMi4xMyAyLjExLTQuNjczIDMuNzkzLTcuNTcyIDUuMDFMNC41IDM2LjM4bC45NzQtMi4zMTYgMS45MjUtLjgwOGMyLjg5OC0xLjIxOCA1LjQ0LTIuOSA3LjU3LTUuMDFsMTkuNzQzLTE5LjY4Yy4yOTItLjI5Mi40MzItLjcwMi40MzItMS4xNjUgMC0uNjQ2LS4yNy0xLjQtLjc4LTIuMTIyLjI1LjE3Mi41LjM3Ny43MzcuNjE0Ljg5OC45MDUgMS4zOTYgMS45ODMgMS4zOTYgMi44NTYiIGZpbGw9IiM1NzVFNzUiIG9wYWNpdHk9Ii4xNSIvPjxwYXRoIGQ9Ik0xOC40NSAxMi44M2MwIC41LS40MDQuOTA1LS45MDQuOTA1cy0uOTA1LS40MDUtLjkwNS0uOTA0YzAtLjUuNDA3LS45MDMuOTA2LS45MDMuNSAwIC45MDQuNDA0LjkwNC45MDR6IiBmaWxsPSIjNTc1RTc1Ii8+PC9nPjwvc3ZnPg==",blocks:[{opcode:"clear",blockType:g.COMMAND,text:r({id:"pen.clear",default:"erase all",description:"erase all pen trails and stamps"})},{opcode:"stamp",blockType:g.COMMAND,text:r({id:"pen.stamp",default:"stamp",description:"render current costume on the background"}),filter:[i.SPRITE]},{opcode:"penDown",blockType:g.COMMAND,text:r({id:"pen.penDown",default:"pen down",description:"start leaving a trail when the sprite moves"}),filter:[i.SPRITE]},{opcode:"penUp",blockType:g.COMMAND,text:r({id:"pen.penUp",default:"pen up",description:"stop leaving a trail behind the sprite"}),filter:[i.SPRITE]},{opcode:"setPenColorToColor",blockType:g.COMMAND,text:r({id:"pen.setColor",default:"set pen color to [COLOR]",description:"set the pen color to a particular (RGB) value"}),arguments:{COLOR:{type:e.COLOR}},filter:[i.SPRITE]},{opcode:"changePenColorParamBy",blockType:g.COMMAND,text:r({id:"pen.changeColorParam",default:"change pen [COLOR_PARAM] by [VALUE]",description:"change the state of a pen color parameter"}),arguments:{COLOR_PARAM:{type:e.STRING,menu:"colorParam",defaultValue:w},VALUE:{type:e.NUMBER,defaultValue:10}},filter:[i.SPRITE]},{opcode:"setPenColorParamTo",blockType:g.COMMAND,text:r({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:e.STRING,menu:"colorParam",defaultValue:w},VALUE:{type:e.NUMBER,defaultValue:50}},filter:[i.SPRITE]},{opcode:"changePenSizeBy",blockType:g.COMMAND,text:r({id:"pen.changeSize",default:"change pen size by [SIZE]",description:"change the diameter of the trail left by a sprite"}),arguments:{SIZE:{type:e.NUMBER,defaultValue:1}},filter:[i.SPRITE]},{opcode:"setPenSizeTo",blockType:g.COMMAND,text:r({id:"pen.setSize",default:"set pen size to [SIZE]",description:"set the diameter of a trail left by a sprite"}),arguments:{SIZE:{type:e.NUMBER,defaultValue:1}},filter:[i.SPRITE]},{opcode:"setPenShadeToNumber",blockType:g.COMMAND,text:r({id:"pen.setShade",default:"set pen shade to [SHADE]",description:"legacy pen blocks - set pen shade"}),arguments:{SHADE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenShadeBy",blockType:g.COMMAND,text:r({id:"pen.changeShade",default:"change pen shade by [SHADE]",description:"legacy pen blocks - change pen shade"}),arguments:{SHADE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"setPenHueToNumber",blockType:g.COMMAND,text:r({id:"pen.setHue",default:"set pen color to [HUE]",description:"legacy pen blocks - set pen color to number"}),arguments:{HUE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenHueBy",blockType:g.COMMAND,text:r({id:"pen.changeHue",default:"change pen color by [HUE]",description:"legacy pen blocks - change pen color"}),arguments:{HUE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0}],menus:{colorParam:{acceptReporters:!0,items:this._initColorParam()}}}}clear(){const A=this._getPenLayerID();A>=0&&(this.runtime.renderer.penClear(A),this.runtime.requestRedraw())}stamp(A,B){this._stamp(B.target)}_stamp(A){const B=this._getPenLayerID();B>=0&&(this.runtime.renderer.penStamp(B,A.drawableID),this.runtime.requestRedraw())}penDown(A,B){this._penDown(B.target)}_penDown(A){const B=this._getPenState(A);B.penDown||(B.penDown=!0,A.onTargetMoved=this._onTargetMoved);const t=this._getPenLayerID();t>=0&&(this.runtime.renderer.penPoint(t,B.penAttributes,A.x,A.y),this.runtime.requestRedraw())}penUp(A,B){this._penUp(B.target)}_penUp(A){const B=this._getPenState(A);B.penDown&&(B.penDown=!1,A.onTargetMoved=null)}setPenColorToColor(A,B){this._setPenColorToColor(A.COLOR,B.target)}_setPenColorToColor(A,B){const t=this._getPenState(B),e=Q.toRgbColorObject(A),g=n.rgbToHsv(e);t.color=g.h/360*100,t.saturation=100*g.s,t.brightness=100*g.v,e.hasOwnProperty("a")?t.transparency=100*(1-e.a/255):t.transparency=0,t._shade=t.brightness/2,this._updatePenColor(t)}_updatePenColor(A){const B=n.hsvToRgb({h:360*A.color/100,s:A.saturation/100,v:A.brightness/100});A.penAttributes.color4f[0]=B.r/255,A.penAttributes.color4f[1]=B.g/255,A.penAttributes.color4f[2]=B.b/255,A.penAttributes.color4f[3]=this._transparencyToAlpha(A.transparency)}_setOrChangeColorParam(A,B,t,e){switch(A){case w:t.color=this._wrapColor(B+(e?t.color:0));break;case C:t.saturation=this._clampColorParam(B+(e?t.saturation:0));break;case a:t.brightness=this._clampColorParam(B+(e?t.brightness:0));break;case I:t.transparency=this._clampColorParam(B+(e?t.transparency:0));break;default:c.warn("Tried to set or change unknown color parameter: ".concat(A))}this._updatePenColor(t)}changePenColorParamBy(A,B){const t=this._getPenState(B.target);this._setOrChangeColorParam(A.COLOR_PARAM,Q.toNumber(A.VALUE),t,!0)}setPenColorParamTo(A,B){const t=this._getPenState(B.target);this._setOrChangeColorParam(A.COLOR_PARAM,Q.toNumber(A.VALUE),t,!1)}changePenSizeBy(A,B){this._changePenSizeBy(Q.toNumber(A.SIZE),B.target)}_changePenSizeBy(A,B){const t=this._getPenState(B).penAttributes;t.diameter=this._clampPenSize(t.diameter+A)}setPenSizeTo(A,B){this._setPenSizeTo(Q.toNumber(A.SIZE),B.target)}_setPenSizeTo(A,B){this._getPenState(B).penAttributes.diameter=this._clampPenSize(A)}setPenHueToNumber(A,B){this._setPenHueToNumber(Q.toNumber(A.HUE),B.target)}_setPenHueToNumber(A,B){const t=this._getPenState(B),e=A/2;this._setOrChangeColorParam(w,e,t,!1),this._setOrChangeColorParam(I,0,t,!1),this._legacyUpdatePenColor(t)}changePenHueBy(A,B){this._changePenHueBy(Q.toNumber(A.HUE),B.target)}_changePenHueBy(A,B){const t=this._getPenState(B),e=A/2;this._setOrChangeColorParam(w,e,t,!0),this._legacyUpdatePenColor(t)}setPenShadeToNumber(A,B){this._setPenShadeToNumber(Q.toNumber(A.SHADE),B.target)}_setPenShadeToNumber(A,B){const t=this._getPenState(B);let e=Q.toNumber(A);e%=200,e<0&&(e+=200),t._shade=e,this._legacyUpdatePenColor(t)}changePenShadeBy(A,B){this._changePenShadeBy(A.SHADE,B.target)}_changePenShadeBy(A,B){const t=this._getPenState(B),e=Q.toNumber(A);this._setPenShadeToNumber(t._shade+e,B)}_legacyUpdatePenColor(A){let B=n.hsvToRgb({h:360*A.color/100,s:1,v:1});const t=A._shade>100?200-A._shade:A._shade;B=t<50?n.mixRgb(n.RGB_BLACK,B,(10+t)/60):n.mixRgb(B,n.RGB_WHITE,(t-50)/60);const e=n.rgbToHsv(B);A.color=100*e.h/360,A.saturation=100*e.s,A.brightness=100*e.v,this._updatePenColor(A)}}A.exports=Y},function(A,B,t){const e=t(18),g=t(16),i=t(8),Q=t(40),s=t(6),{Map:n}=t(22),r=t(0),E=t(7),c=t(65);A.exports=class extends e{constructor(A,B){super(),B||(B=new g(A)),this.runtime=A,this.id=s(),this.blocks=B,this.variables={},this.comments={},this._customState={},this._edgeActivatedHatValues={}}onGreenFlag(){}getName(){return this.id}updateEdgeActivatedValue(A,B){const t=this._edgeActivatedHatValues[A];return this._edgeActivatedHatValues[A]=B,t}hasEdgeActivatedValue(A){return this._edgeActivatedHatValues.hasOwnProperty(A)}clearEdgeActivatedValues(){this._edgeActivatedHatValues={}}lookupOrCreateVariable(A,B){let t=this.lookupVariableById(A);if(t)return t;if(t=this.lookupVariableByNameAndType(B,i.SCALAR_TYPE),t)return t;const e=new i(A,B,i.SCALAR_TYPE,!1);return this.variables[A]=e,e}lookupBroadcastMsg(A,B){let t;if(A?t=this.lookupVariableById(A):B?t=this.lookupBroadcastByInputValue(B):r.error("Cannot find broadcast message if neither id nor name are provided."),t)return B&&t.name.toLowerCase()!==B.toLowerCase()&&r.error("Found broadcast message with id: ".concat(A,", but")+"its name, ".concat(t.name," did not match expected name ").concat(B,".")),t.type!==i.BROADCAST_MESSAGE_TYPE&&r.error("Found variable with id: ".concat(A,", but its type ").concat(t.type)+"did not match expected type ".concat(i.BROADCAST_MESSAGE_TYPE)),t}lookupBroadcastByInputValue(A){const B=this.variables;for(const t in B)if(B[t].type===i.BROADCAST_MESSAGE_TYPE&&B[t].name.toLowerCase()===A.toLowerCase())return B[t]}lookupVariableById(A){if(this.variables.hasOwnProperty(A))return this.variables[A];if(this.runtime&&!this.isStage){const B=this.runtime.getTargetForStage();if(B&&B.variables.hasOwnProperty(A))return B.variables[A]}}lookupVariableByNameAndType(A,B,t){if("string"==typeof A){"string"!=typeof B&&(B=i.SCALAR_TYPE),t=t||!1;for(const t in this.variables){const e=this.variables[t];if(e.name===A&&e.type===B)return e}if(!t&&this.runtime&&!this.isStage){const t=this.runtime.getTargetForStage();if(t)for(const e in t.variables){const g=t.variables[e];if(g.name===A&&g.type===B)return g}}return null}}lookupOrCreateList(A,B){let t=this.lookupVariableById(A);if(t)return t;if(t=this.lookupVariableByNameAndType(B,i.LIST_TYPE),t)return t;const e=new i(A,B,i.LIST_TYPE,!1);return this.variables[A]=e,e}createVariable(A,B,t,e){if(!this.variables.hasOwnProperty(A)){const g=new i(A,B,t,!1);e&&this.isStage&&this.runtime.canAddCloudVariable()&&(g.isCloud=!0,this.runtime.addCloudVariable(),this.runtime.ioDevices.cloud.requestCreateVariable(g)),this.variables[A]=g}}createComment(A,B,t,e,g,i,s,n){if(!this.comments.hasOwnProperty(A)){const E=new Q(A,t,e,g,i,s,n);if(B){E.blockId=B;const t=this.blocks.getBlock(B);t?t.comment=A:r.warn("Could not find block with id ".concat(B," associated with commentId: ").concat(A))}this.comments[A]=E}}renameVariable(A,B){if(this.variables.hasOwnProperty(A)){const t=this.variables[A];if(t.id===A){const e=t.name;if(t.name=B,this.runtime){if(t.isCloud&&this.isStage&&this.runtime.ioDevices.cloud.requestRenameVariable(e,B),t.type===i.SCALAR_TYPE){let A=!1;this.runtime.targets.forEach(t=>{A=t.blocks.updateSensingOfReference(e,B,this.isStage?"_stage_":this.getName())||A}),A&&this.runtime.requestBlocksUpdate()}const g=this.runtime.monitorBlocks;g.changeBlock({id:A,element:"field",name:t.type===i.LIST_TYPE?"LIST":"VARIABLE",value:A},this.runtime);const Q=g.getBlock(t.id);Q&&this.runtime.requestUpdateMonitor(n({id:A,params:g._getBlockParams(Q)}))}}}}deleteVariable(A){if(this.variables.hasOwnProperty(A)){const B=this.variables[A].name,t=this.variables[A].isCloud;delete this.variables[A],this.runtime&&(t&&this.isStage&&(this.runtime.ioDevices.cloud.requestDeleteVariable(B),this.runtime.removeCloudVariable()),this.runtime.monitorBlocks.deleteBlock(A),this.runtime.requestRemoveMonitor(A))}}deleteMonitors(){let A;this.runtime.requestRemoveMonitorByTargetId(this.id),A=this.isStage?Object.keys(this.variables):Object.keys(this.runtime.monitorBlocks._blocks).filter(A=>this.runtime.monitorBlocks._blocks[A].targetId===this.id);for(const B of A)this.runtime.monitorBlocks.deleteBlock(B)}duplicateVariable(A,B){if(this.variables.hasOwnProperty(A)){const t=this.variables[A],e=new i(B?A:null,t.name,t.type,t.isCloud);return e.type===i.LIST_TYPE?e.value=t.value.slice(0):e.value=t.value,e}return null}duplicateVariables(A){let B;return A&&(B=A.getAllVariableAndListReferences()),Object.keys(this.variables).reduce((t,e)=>{const g=this.duplicateVariable(e,!A);if(t[g.id]=g,A&&B){const A=B[e];A&&this.mergeVariables(e,g.id,A)}return t},{})}postSpriteInfo(){}getCustomState(A){return this._customState[A]}setCustomState(A,B){this._customState[A]=B}dispose(){this._customState={},this.runtime&&this.runtime.removeExecutable(this)}getAllVariableNamesInScopeByType(A,B){"string"!=typeof A&&(A=i.SCALAR_TYPE),B=B||!1;const t=Object.values(this.variables).filter(B=>B.type===A).map(A=>A.name);if(B||this.isStage||!this.runtime)return t;const e=this.runtime.getTargetForStage().getAllVariableNamesInScopeByType(A);return t.concat(e)}mergeVariables(A,B,t,e){const g=t||this.blocks.getAllVariableAndListReferences()[A];c.updateVariableIdentifiers(g,B,e)}shareLocalVariableToStage(A,B){if(!this.runtime)return;const t=this.variables[A];if(!t)return void r.warn("Cannot share a local variable to the stage if it's not local.");const e=this.runtime.getTargetForStage(),g="StageVarFromLocal_".concat(A);let i=e.lookupVariableById(g);if(!i){const A=t.name,B=t.type,e="Stage: ".concat(A);i=this.runtime.createNewGlobalVariable(e,g,B)}this.mergeVariables(A,i.id,B,i.name)}shareLocalVariableToSprite(A,B,t){if(!this.runtime)return;if(this.isStage)return;const e=this.variables[A];if(!e)return void r.warn("Tried to call 'shareLocalVariableToSprite' with a non-local variable.");const g=e.name,Q=e.type,s=B.lookupVariableByNameAndType(g,Q);let n;if(s)n=s.id;else{const A=new i(null,g,Q);n=A.id,B.variables[n]=A}this.mergeVariables(A,n,t)}resolveVariableSharingConflictsWithTarget(A,B){if(this.isStage)return;const t=this.blocks.getAllVariableAndListReferences(A);for(const A in t){if(!this.variables[A])continue;const e=t[A];B.isStage?this.shareLocalVariableToStage(A,e):this.shareLocalVariableToSprite(A,B,e)}}fixUpVariableReferences(){if(!this.runtime)return;if(this.isStage)return;const A=this.runtime.getTargetForStage();if(!A||!A.variables)return;const B=(B,t,e)=>{if(A.lookupVariableByNameAndType(t,e)){const A=E.unusedName("".concat(this.getName(),": ").concat(t),this.getAllVariableNamesInScopeByType(e));return this.renameVariable(B,A),A}return null},t=this.blocks.getAllVariableAndListReferences(),e=[];if(Object.keys(this.variables).length>0)for(const A in this.variables)this.variables.hasOwnProperty(A)&&(t[A]||e.push(A));const g=Object.create(null),i=Object.create(null),Q={},s=A=>{const B=Q[A];return B||(Q[A]=this.runtime.getAllVarNamesOfType(A),Q[A])};for(const e in t){const Q=t[e][0],n=Q.referencingField.value,r=Q.type;if(this.lookupVariableById(e)){if(this.variables.hasOwnProperty(e)){const A=B(e,n,r);A&&t[e].map(B=>(B.referencingField.value=A,B))}}else{const B=A.lookupVariableByNameAndType(n,r);if(B)g[e]||(g[e]=B.id);else{const B=s(r),t=E.unusedName(n,B);A.createVariable(e,t,r),i[e]||(i[e]=t)}}}for(const A in e){const t=e[A];B(t,this.variables[t].name,this.variables[t].type)}for(const A in g){const B=g[A],e=t[A];this.mergeVariables(A,B,e)}for(const A in i){const B=i[A];t[A].map(A=>(A.referencingField.value=B,A))}}}},function(A,B,t){const e=t(61),g=t(62),i=t(6),Q=function A(B,t,g,Q){B.attribs.id||(B.attribs.id=i());const s={id:B.attribs.id,opcode:B.attribs.type,inputs:{},fields:{},next:null,topLevel:g,parent:Q,shadow:"shadow"===B.name,x:B.attribs.x,y:B.attribs.y};t[s.id]=s;for(let g=0;g0&&i.children[0].data?i.children[0].data:"",s.fields[A]={name:A,id:B,value:t};const e=i.attribs.variabletype;"string"==typeof e&&(s.fields[A].variableType=e);break}case"comment":s.comment=i.attribs.id;break;case"value":case"statement":{A(Q,t,!1,s.id),n&&Q!==n&&A(n,t,!1,s.id);const B=i.attribs.name;s.inputs[B]={name:B,block:Q.attribs.id,shadow:n?n.attribs.id:null};break}case"next":if(!Q||!Q.attribs)continue;A(Q,t,!1,s.id),s.next=Q.attribs.id;break;case"mutation":s.mutation=e(i)}}};A.exports=function(A){if("object"==typeof A&&"object"==typeof A.xml)return function(A){const B={};for(let t=0;t",quot:'"',nbsp:" "},e=/&([a-z]+);/gi;A.exports=function(A){return A.replace(e,(function(A,B){return B=B.toLowerCase(),t.hasOwnProperty(B)?t[B]:A}))}},function(A,B,t){const e=t(5),g=t(2),i=t(1),Q=t(4),s=t(21),n=t(28),r=t(23),E=t(3),c=t(41),o=t(0),w="00001523-1212-efde-1523-785feabcd123",C="00004f0e-1212-efde-1523-785feabcd123",a="00001527-1212-efde-1523-785feabcd123",I="00001528-1212-efde-1523-785feabcd123",Y="00001560-1212-efde-1523-785feabcd123",h="00001563-1212-efde-1523-785feabcd123",M="00001565-1212-efde-1523-785feabcd123",F=1,D=23,u=34,l=35,d=6,U=5,N=1,m=2,G=3,f=4,H={TILT:0,DISTANCE:0,LED:1},R={TILT:0,DISTANCE:1,LED:0};class p{constructor(A,B){this._parent=A,this._index=B,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(A){this._direction=A<0?-1:1}get power(){return this._power}set power(A){const B=Math.max(0,Math.min(A,100));if(0===B)this._power=0;else{const A=100/B;this._power=30+70/A}}get isOn(){return this._isOn}get pendingTimeoutStartTime(){return this._pendingTimeoutStartTime}get pendingTimeoutDelay(){return this._pendingTimeoutDelay}turnOn(){if(0===this._power)return;const A=this._parent.generateOutputCommand(this._index+1,N,[this._power*this._direction]);this._parent.send(M,A),this._isOn=!0,this._clearTimeout()}turnOnFor(A){0!==this._power&&(A=Math.max(0,A),this.turnOn(),this._setNewTimeout(this.startBraking,A))}startBraking(){if(0===this._power)return;const A=this._parent.generateOutputCommand(this._index+1,N,[127]);this._parent.send(M,A),this._isOn=!1,this._setNewTimeout(this.turnOff,p.BRAKE_TIME_MS)}turnOff(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(0===this._power)return;const B=this._parent.generateOutputCommand(this._index+1,N,[0]);this._parent.send(M,B,A),this._isOn=!1}_clearTimeout(){null!==this._pendingTimeoutId&&(clearTimeout(this._pendingTimeoutId),this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null)}_setNewTimeout(A,B){this._clearTimeout();const t=setTimeout(()=>{this._pendingTimeoutId===t&&(this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null),A()},B);this._pendingTimeoutId=t,this._pendingTimeoutStartTime=Date.now(),this._pendingTimeoutDelay=B}}class J{constructor(A,B){this._runtime=A,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=B,this._ports=["none","none"],this._motors=[null,null],this._sensors={tiltX:0,tiltY:0,distance:0},this._ble=null,this._runtime.registerPeripheralExtension(B,this),this._rateLimiter=new c(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(A){return this._motors[A]}stopAllMotors(){this._motors.forEach(A=>{A&&A.turnOff(!1)})}setLED(A){const B=[A>>16&255,A>>8&255,255&A],t=this.generateOutputCommand(d,f,B);return this.send(M,t)}setLEDMode(){const A=this.generateInputCommand(d,D,H.LED,0,R.LED,!1);return this.send(h,A)}stopLED(){const A=this.generateOutputCommand(d,f,[0,0,0]);return this.send(M,A)}playTone(A,B){const t=this.generateOutputCommand(U,m,[A,A>>8,B,B>>8]);return this.send(M,t)}stopTone(){const A=this.generateOutputCommand(U,G);return this.send(M,A,!1)}stopAll(){this.isConnected()&&(this.stopTone(),this.stopAllMotors())}scan(){this._ble&&this._ble.disconnect(),this._ble=new n(this._runtime,this._extensionId,{filters:[{services:[w]}],optionalServices:[C]},this._onConnect,this.reset)}connect(A){this._ble&&this._ble.connectPeripheral(A)}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 A=!1;return this._ble&&(A=this._ble.isConnected()),A}send(A,B){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.isConnected()?t&&!this._rateLimiter.okayToSend()?Promise.resolve():this._ble.write(C,A,r.uint8ArrayToBase64(B),"base64"):Promise.resolve()}generateOutputCommand(A,B){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,e=[A,B];return t&&(e=e.concat(t.length).concat(t)),e}generateInputCommand(A,B,t,e,g,i){return[1,2,A,B,t,e,0,0,0,g,i?1:0]}_onConnect(){this.setLEDMode(),this.setLED(255),this._ble.startNotifications(w,a,this._onMessage),this._batteryLevelIntervalId=window.setInterval(this._checkBatteryLevel,5e3)}_onMessage(A){const B=r.base64ToUint8Array(A);switch(B[0]){case 1:case 2:{const A=B[0];0===B[1]?this._clearPort(A):this._registerSensorOrMotor(A,B[3]);break}default:{const A=B[1],t=this._ports[A-1];t===l&&(this._sensors.distance=B[2]),t===u&&(this._sensors.tiltX=B[2],this._sensors.tiltY=B[3]);break}}}_checkBatteryLevel(){this._ble.read(w,I,!1)}_registerSensorOrMotor(A,B){if(this._ports[A-1]=B,B===F)this._motors[A-1]=new p(this,A-1);else{const t=B===l?"DISTANCE":"TILT",e=this.generateInputCommand(A,B,H[t],1,R[t],!0);this.send(h,e),this._ble.startNotifications(C,Y,this._onMessage)}}_clearPort(A){const B=this._ports[A-1];B===u&&(this._sensors.tiltX=this._sensors.tiltY=0),B===l&&(this._sensors.distance=0),this._ports[A-1]="none",this._motors[A-1]=null}}const y="motor",k="motor A",T="motor B",j="all motors",x="this way",S="that way",b="reverse",z="up",L="down",P="left",v="right",W="any";class V{static get EXTENSION_ID(){return"wedo2"}static get TILT_THRESHOLD(){return 15}constructor(A){this.runtime=A,this._peripheral=new J(this.runtime,V.EXTENSION_ID)}getInfo(){return{id:V.EXTENSION_ID,name:"WeDo 2.0",blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAF8klEQVR4Ae2cbWxTVRjH/7ctbVc2tyEMNpWBk0VIkLcEjSAQgglTE5HEaKqJi1E/mbCP/dJA0kQbvzgTQ0Ki2T7V6AeYGoEPLJmGKPiyzZDwEpYJCHSbQIcbdLvres1zOa13Xbvdu2eTDp9fst329Lnn5XfPPfece7tphmFAmDkuccdDBDIRgUxEIBMRyEQEMhGBTEQgExHIRAQyEYFMRCATEchEBDIRgUxEIBMRyEQEMhGBTEQgExHIxMPNIByNVQBoBUDb7kgo2KTS9wBoUmFNkVCwW6U3A1gP4JJKHwxHY/S+WcW2RkLBVhV7AMAOAIMAGlWstbyOSCh4QMU2Uoy1PBVL+a7IqZu1vOZIKNg20/azBarGvKxebw9HY22RULADwBFLTBcATQnZl4lVEimN4ssteXQrQfstebQpmW1q30xshyqvxRLbofYnYW9ZYgeV8C5LLOWlzbTxM3ouHI7GPgSwWx3Z0syBSBku6IYnlTbM+uQenJQaMnKHDaqAFnDrcCFbl3G1defEjas0a4N/Vz10OybyvapfrSX1sjpo+WIz0ME7QL3djgtHPTAcjb2mepw/b2ZaGh5NL5RnofR8R99dIC5fHusK5JsrCUpm7TSx21XvbcwTNwnbAsPR2GcA3qaG+H0LsHlDPZ7fca/ujZ+cRW9/Em5vCXzlNVhQUjFpf/3OTSRvXkKJz43Xt1bh1S1LUeq/5+njQ9/iVmLIfL1ieRU2b1iFtavztXNu6TrTi8PfnYI67WdPoOp5przV9Y8iuHdb9rOW9uumPI+vDIElddBckztPOqVn5X36Xj1WVQeynx1sOWbK83jc2PviM/dFXIYNax9H55leXLoyYHsfWwI14JCRRx7x5ckBU1oheYQ+1G9u39lVM0Hej7+cR7w/Yb7e9+5LqChfaLvixcK088BwNNZkAOV02ubK6+odwt3RcfOULSSPGEveG48bNj08If3kqXPmdtO6unkpDzYn0u/TLxrzcumJJ80Ut79sygzoFF6/siw75mUYupOEpmnY0/A0pw33FTsCa+hX5oJhZXgkZb5zub2O20CnL7EwkPeCPm+wI7CEBvi5wuOZ36tJW7X3uGXJXAgxk8P4eNpRPEvgskqfuR0Z/BNGejxvDM3/5gs0pboWv+motqybCc+tqUCzz43kaBJ/X+2eMjZ3ClNsjIzo5ioknXZ2b4AlkKYltLJoaY9jOJm/B0KJbtg4c4F/XOmH3+dF9dLKbBo1OD6QQGV56YQ55ODtO0jcHkZ1VSX8/n9nB9S7RkZ1rFy+NG8ZR9s70TeQQKDEh7vJUdt1Y9/OopXFB2/WcbMpyOexE9mlFS21aLlHMmKHfzBl0QT/hV2bzM9oLXv0xG8YGR0zpdLEn6RT2k+/XjDzoLX2G3u3TZBLUyral/Z5qCyAK1f/sl2/or+IWNel1Eji3MWrpjyCZHWqdNrSe6ieSHFERl4mP+q5GehgHGvvRGal5XI5uzU47f3A/R99YTgdF2wXrmkolr9ToZ5NvTjT4yOhoC2T057CJM/r9WDxoqmXa07R9THcuDVcMO8bt4ag6ynULKvkFjWBTLl0ugZKvNlyqLeSQKfYGgOpgXt2b5zVhlzrS+Dr451YvKg0b95txztxvS8xZ+VuXFuLJ5+oNgV+9c3PuHDxGs6cu+w4v//9RJo6x5bN9UgbBo4cPY1U6j+cSD8orFvzGFYuX4KxsRQGbth6FCICc9m5dY05HtN46AQRqPB5PWjY+ZT5RnMwkxGBFh5ZVmle9Z3MrGbjwfqccrC1vajrV7QCaVCfS6qrJj96nQlFK5CujPRT7MgYyEQEMhGBTGwJpAW4kJ9pBbo0zbx70X7y7AOv8HxP3LyB4YTpb2cZBt2iqL3QEwf9zDbX+waLca439QMeC7a+YBmOxugLiM/OTt2yaOoMoO+H6LOcNwf6xusrthsh/7mIh1yFmYhAJiKQiQhkIgKZiEAmIpCJCGQiApmIQCYikIkIZCICmYhAJiKQiQhkIgKZiEAmIpCJCGQiAjkA+AeOwQKMcWZqHgAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"motorOnFor",text:Q({id:"wedo2.motorOnFor",default:"turn [MOTOR_ID] on for [DURATION] seconds",description:"turn a motor on for some time"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y},DURATION:{type:e.NUMBER,defaultValue:1}}},{opcode:"motorOn",text:Q({id:"wedo2.motorOn",default:"turn [MOTOR_ID] on",description:"turn a motor on indefinitely"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y}}},{opcode:"motorOff",text:Q({id:"wedo2.motorOff",default:"turn [MOTOR_ID] off",description:"turn a motor off"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y}}},{opcode:"startMotorPower",text:Q({id:"wedo2.startMotorPower",default:"set [MOTOR_ID] power to [POWER]",description:"set the motor's power and turn it on"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y},POWER:{type:e.NUMBER,defaultValue:100}}},{opcode:"setMotorDirection",text:Q({id:"wedo2.setMotorDirection",default:"set [MOTOR_ID] direction to [MOTOR_DIRECTION]",description:"set the motor's turn direction"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y},MOTOR_DIRECTION:{type:e.STRING,menu:"MOTOR_DIRECTION",defaultValue:x}}},{opcode:"setLightHue",text:Q({id:"wedo2.setLightHue",default:"set light color to [HUE]",description:"set the LED color"}),blockType:g.COMMAND,arguments:{HUE:{type:e.NUMBER,defaultValue:50}}},{opcode:"playNoteFor",text:Q({id:"wedo2.playNoteFor",default:"play note [NOTE] for [DURATION] seconds",description:"play a certain note for some time"}),blockType:g.COMMAND,arguments:{NOTE:{type:e.NUMBER,defaultValue:60},DURATION:{type:e.NUMBER,defaultValue:.5}},hideFromPalette:!0},{opcode:"whenDistance",text:Q({id:"wedo2.whenDistance",default:"when distance [OP] [REFERENCE]",description:"check for when distance is < or > than reference"}),blockType:g.HAT,arguments:{OP:{type:e.STRING,menu:"OP",defaultValue:"<"},REFERENCE:{type:e.NUMBER,defaultValue:50}}},{opcode:"whenTilted",text:Q({id:"wedo2.whenTilted",default:"when tilted [TILT_DIRECTION_ANY]",description:"check when tilted in a certain direction"}),func:"isTilted",blockType:g.HAT,arguments:{TILT_DIRECTION_ANY:{type:e.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:W}}},{opcode:"getDistance",text:Q({id:"wedo2.getDistance",default:"distance",description:"the value returned by the distance sensor"}),blockType:g.REPORTER},{opcode:"isTilted",text:Q({id:"wedo2.isTilted",default:"tilted [TILT_DIRECTION_ANY]?",description:"whether the tilt sensor is tilted"}),blockType:g.BOOLEAN,arguments:{TILT_DIRECTION_ANY:{type:e.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:W}}},{opcode:"getTiltAngle",text:Q({id:"wedo2.getTiltAngle",default:"tilt angle [TILT_DIRECTION]",description:"the angle returned by the tilt sensor"}),blockType:g.REPORTER,arguments:{TILT_DIRECTION:{type:e.STRING,menu:"TILT_DIRECTION",defaultValue:z}}}],menus:{MOTOR_ID:{acceptReporters:!0,items:[{text:Q({id:"wedo2.motorId.default",default:"motor",description:"label for motor element in motor menu for LEGO WeDo 2 extension"}),value:y},{text:Q({id:"wedo2.motorId.a",default:"motor A",description:"label for motor A element in motor menu for LEGO WeDo 2 extension"}),value:k},{text:Q({id:"wedo2.motorId.b",default:"motor B",description:"label for motor B element in motor menu for LEGO WeDo 2 extension"}),value:T},{text:Q({id:"wedo2.motorId.all",default:"all motors",description:"label for all motors element in motor menu for LEGO WeDo 2 extension"}),value:j}]},MOTOR_DIRECTION:{acceptReporters:!0,items:[{text:Q({id:"wedo2.motorDirection.forward",default:"this way",description:"label for forward element in motor direction menu for LEGO WeDo 2 extension"}),value:x},{text:Q({id:"wedo2.motorDirection.backward",default:"that way",description:"label for backward element in motor direction menu for LEGO WeDo 2 extension"}),value:S},{text:Q({id:"wedo2.motorDirection.reverse",default:"reverse",description:"label for reverse element in motor direction menu for LEGO WeDo 2 extension"}),value:b}]},TILT_DIRECTION:{acceptReporters:!0,items:[{text:Q({id:"wedo2.tiltDirection.up",default:"up",description:"label for up element in tilt direction menu for LEGO WeDo 2 extension"}),value:z},{text:Q({id:"wedo2.tiltDirection.down",default:"down",description:"label for down element in tilt direction menu for LEGO WeDo 2 extension"}),value:L},{text:Q({id:"wedo2.tiltDirection.left",default:"left",description:"label for left element in tilt direction menu for LEGO WeDo 2 extension"}),value:P},{text:Q({id:"wedo2.tiltDirection.right",default:"right",description:"label for right element in tilt direction menu for LEGO WeDo 2 extension"}),value:v}]},TILT_DIRECTION_ANY:{acceptReporters:!0,items:[{text:Q({id:"wedo2.tiltDirection.up",default:"up"}),value:z},{text:Q({id:"wedo2.tiltDirection.down",default:"down"}),value:L},{text:Q({id:"wedo2.tiltDirection.left",default:"left"}),value:P},{text:Q({id:"wedo2.tiltDirection.right",default:"right"}),value:v},{text:Q({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(A){let B=1e3*i.toNumber(A.DURATION);return B=E.clamp(B,0,15e3),new Promise(t=>{this._forEachMotor(A.MOTOR_ID,A=>{const t=this._peripheral.motor(A);t&&t.turnOnFor(B)}),setTimeout(t,B)})}motorOn(A){return this._forEachMotor(A.MOTOR_ID,A=>{const B=this._peripheral.motor(A);B&&B.turnOn()}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}motorOff(A){return this._forEachMotor(A.MOTOR_ID,A=>{const B=this._peripheral.motor(A);B&&B.turnOff()}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}startMotorPower(A){return this._forEachMotor(A.MOTOR_ID,B=>{const t=this._peripheral.motor(B);t&&(t.power=E.clamp(i.toNumber(A.POWER),0,100),t.turnOn())}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}setMotorDirection(A){return this._forEachMotor(A.MOTOR_ID,B=>{const t=this._peripheral.motor(B);if(t){switch(A.MOTOR_DIRECTION){case x:t.direction=1;break;case S:t.direction=-1;break;case b:t.direction=-t.direction;break;default:o.warn("Unknown motor direction in setMotorDirection: ".concat(A.DIRECTION))}t.isOn&&(t.pendingTimeoutDelay?t.turnOnFor(t.pendingTimeoutStartTime+t.pendingTimeoutDelay-Date.now()):t.turnOn())}}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}setLightHue(A){let B=i.toNumber(A.HUE);B=E.wrapClamp(B,0,100);const t=360*B/100,e=s.hsvToRgb({h:t,s:1,v:1}),g=s.rgbToDecimal(e);return this._peripheral.setLED(g),new Promise(A=>{window.setTimeout(()=>{A()},100)})}playNoteFor(A){let B=1e3*i.toNumber(A.DURATION);B=E.clamp(B,0,3e3);const t=E.clamp(i.toNumber(A.NOTE),25,125);if(0!==B)return new Promise(A=>{const e=this._noteToTone(t);this._peripheral.playTone(e,B),setTimeout(A,B)})}whenDistance(A){switch(A.OP){case"<":return this._peripheral.distance":return this._peripheral.distance>i.toNumber(A.REFERENCE);default:return o.warn("Unknown comparison operator in whenDistance: ".concat(A.OP)),!1}}whenTilted(A){return this._isTilted(A.TILT_DIRECTION_ANY)}getDistance(){return this._peripheral.distance}isTilted(A){return this._isTilted(A.TILT_DIRECTION_ANY)}getTiltAngle(A){return this._getTiltAngle(A.TILT_DIRECTION)}_isTilted(A){switch(A){case W:return this._getTiltAngle(z)>=V.TILT_THRESHOLD||this._getTiltAngle(L)>=V.TILT_THRESHOLD||this._getTiltAngle(P)>=V.TILT_THRESHOLD||this._getTiltAngle(v)>=V.TILT_THRESHOLD;default:return this._getTiltAngle(A)>=V.TILT_THRESHOLD}}_getTiltAngle(A){switch(A){case z:return this._peripheral.tiltY>45?256-this._peripheral.tiltY:-this._peripheral.tiltY;case L:return this._peripheral.tiltY>45?this._peripheral.tiltY-256:this._peripheral.tiltY;case P:return this._peripheral.tiltX>45?256-this._peripheral.tiltX:-this._peripheral.tiltX;case v:return this._peripheral.tiltX>45?this._peripheral.tiltX-256:this._peripheral.tiltX;default:o.warn("Unknown tilt direction in _getTiltAngle: ".concat(A))}}_forEachMotor(A,B){let t;switch(A){case k:t=[0];break;case T:t=[1];break;case j:case y:t=[0,1];break;default:o.warn("Invalid motor ID: ".concat(A)),t=[]}for(const A of t)B(A)}_noteToTone(A){return 440*Math.pow(2,(A-69)/12)}}A.exports=V},function(A,B,t){(function(A,B){!function(t){"use strict";var e,g="function"==typeof(e=t.atob)?e:"function"==typeof A?function(B){ +B.read=function(A,B,t,e,g){var i,Q,s=8*g-e-1,n=(1<>1,c=-7,E=t?g-1:0,o=t?-1:1,w=A[B+E];for(E+=o,i=w&(1<<-c)-1,w>>=-c,c+=s;c>0;i=256*i+A[B+E],E+=o,c-=8);for(Q=i&(1<<-c)-1,i>>=-c,c+=e;c>0;Q=256*Q+A[B+E],E+=o,c-=8);if(0===i)i=1-r;else{if(i===n)return Q?NaN:1/0*(w?-1:1);Q+=Math.pow(2,e),i-=r}return(w?-1:1)*Q*Math.pow(2,i-e)},B.write=function(A,B,t,e,g,i){var Q,s,n,r=8*i-g-1,c=(1<>1,o=23===g?Math.pow(2,-24)-Math.pow(2,-77):0,w=e?0:i-1,C=e?1:-1,a=B<0||0===B&&1/B<0?1:0;for(B=Math.abs(B),isNaN(B)||B===1/0?(s=isNaN(B)?1:0,Q=c):(Q=Math.floor(Math.log(B)/Math.LN2),B*(n=Math.pow(2,-Q))<1&&(Q--,n*=2),(B+=Q+E>=1?o/n:o*Math.pow(2,1-E))*n>=2&&(Q++,n/=2),Q+E>=c?(s=0,Q=c):Q+E>=1?(s=(B*n-1)*Math.pow(2,g),Q+=E):(s=B*Math.pow(2,E-1)*Math.pow(2,g),Q=0));g>=8;A[t+w]=255&s,w+=C,s/=256,g-=8);for(Q=Q<0;A[t+w]=255&Q,w+=C,Q/=256,r-=8);A[t+w-C]|=128*a}},function(A,B){var t={}.toString;A.exports=Array.isArray||function(A){return"[object Array]"==t.call(A)}},function(A,B,t){(function(A){var e=void 0!==A&&A||"undefined"!=typeof self&&self||window,g=Function.prototype.apply;function i(A,B){this._id=A,this._clearFn=B}B.setTimeout=function(){return new i(g.call(setTimeout,e,arguments),clearTimeout)},B.setInterval=function(){return new i(g.call(setInterval,e,arguments),clearInterval)},B.clearTimeout=B.clearInterval=function(A){A&&A.close()},i.prototype.unref=i.prototype.ref=function(){},i.prototype.close=function(){this._clearFn.call(e,this._id)},B.enroll=function(A,B){clearTimeout(A._idleTimeoutId),A._idleTimeout=B},B.unenroll=function(A){clearTimeout(A._idleTimeoutId),A._idleTimeout=-1},B._unrefActive=B.active=function(A){clearTimeout(A._idleTimeoutId);var B=A._idleTimeout;B>=0&&(A._idleTimeoutId=setTimeout((function(){A._onTimeout&&A._onTimeout()}),B))},t(111),B.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==A&&A.setImmediate||this&&this.setImmediate,B.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==A&&A.clearImmediate||this&&this.clearImmediate}).call(this,t(10))},function(A,B,t){(function(A,B){!function(A,t){"use strict";if(!A.setImmediate){var e,g,i,Q,s,n=1,r={},c=!1,E=A.document,o=Object.getPrototypeOf&&Object.getPrototypeOf(A);o=o&&o.setTimeout?o:A,"[object process]"==={}.toString.call(A.process)?e=function(A){B.nextTick((function(){C(A)}))}:!function(){if(A.postMessage&&!A.importScripts){var B=!0,t=A.onmessage;return A.onmessage=function(){B=!1},A.postMessage("","*"),A.onmessage=t,B}}()?A.MessageChannel?((i=new MessageChannel).port1.onmessage=function(A){C(A.data)},e=function(A){i.port2.postMessage(A)}):E&&"onreadystatechange"in E.createElement("script")?(g=E.documentElement,e=function(A){var B=E.createElement("script");B.onreadystatechange=function(){C(A),B.onreadystatechange=null,g.removeChild(B),B=null},g.appendChild(B)}):e=function(A){setTimeout(C,0,A)}:(Q="setImmediate$"+Math.random()+"$",s=function(B){B.source===A&&"string"==typeof B.data&&0===B.data.indexOf(Q)&&C(+B.data.slice(Q.length))},A.addEventListener?A.addEventListener("message",s,!1):A.attachEvent("onmessage",s),e=function(B){A.postMessage(Q+B,"*")}),o.setImmediate=function(A){"function"!=typeof A&&(A=new Function(""+A));for(var B=new Array(arguments.length-1),t=0;t2?t-2:0),g=2;g3?e-3:0),i=3;i3?e-3:0),i=3;i4?g-4:0),Q=4;Q{const s=this._storeCallbacks(g,Q);i.length>0&&"function"==typeof i[i.length-1].func&&(i.pop(),i.pop()),e?A.postMessage({service:B,method:t,responseId:s,args:i},e):A.postMessage({service:B,method:t,responseId:s,args:i})})}_storeCallbacks(A,B){const t=this.nextResponseId++;return this.callbacks[t]=[A,B],t}_deliverResponse(A,B){try{const[t,e]=this.callbacks[A];delete this.callbacks[A],B.error?e(B.error):t(B.result)}catch(A){e.error("Dispatch callback failed: ".concat(A))}}_onMessage(A,B){const t=B.data;let g;t.args=t.args||[],t.service?g="dispatch"===t.service?this._onDispatchMessage(A,t):this.call(t.service,t.method,...t.args):void 0===t.responseId?e.error("Dispatch caught malformed message from a worker: ".concat(JSON.stringify(B))):this._deliverResponse(t.responseId,t),g&&(void 0===t.responseId?e.error("Dispatch message missing required response ID: ".concat(JSON.stringify(B))):g.then(B=>A.postMessage({responseId:t.responseId,result:B}),B=>A.postMessage({responseId:t.responseId,error:"".concat(B)})))}_getServiceProvider(A){throw new Error("Could not get provider for ".concat(A,": _getServiceProvider not implemented"))}_onDispatchMessage(A,B){throw new Error("Unimplemented dispatch message handler cannot handle ".concat(B.method," method"))}}},function(A,B,t){var e=t(12),g=t(115),i=new e,Q=Array.prototype.slice;(B=A.exports=function(A){var t=function(){return i.write(A,void 0,Q.call(arguments)),t};return t.debug=function(){return i.write(A,"debug",Q.call(arguments)),t},t.info=function(){return i.write(A,"info",Q.call(arguments)),t},t.warn=function(){return i.write(A,"warn",Q.call(arguments)),t},t.error=function(){return i.write(A,"error",Q.call(arguments)),t},t.log=t.debug,t.suggest=B.suggest,t.format=i.format,t}).defaultBackend=B.defaultFormatter=null,B.pipe=function(A){return i.pipe(A)},B.end=B.unpipe=B.disable=function(A){return i.unpipe(A)},B.Transform=e,B.Filter=g,B.suggest=new g,B.enable=function(){return B.defaultFormatter?i.pipe(B.suggest).pipe(B.defaultFormatter).pipe(B.defaultBackend):i.pipe(B.suggest).pipe(B.defaultBackend)}},function(A,B){function t(){this._events={}}t.prototype={on:function(A,B){this._events||(this._events={});var t=this._events;return(t[A]||(t[A]=[])).push(B),this},removeListener:function(A,B){var t,e=this._events[A]||[];for(t=e.length-1;t>=0&&e[t];t--)e[t]!==B&&e[t].cb!==B||e.splice(t,1)},removeAllListeners:function(A){A?this._events[A]&&(this._events[A]=[]):this._events={}},listeners:function(A){return this._events&&this._events[A]||[]},emit:function(A){this._events||(this._events={});var B,t=Array.prototype.slice.call(arguments,1),e=this._events[A]||[];for(B=e.length-1;B>=0&&e[B];B--)e[B].apply(this,t);return this},when:function(A,B){return this.once(A,B,!0)},once:function(A,B,t){if(!B)return this;function e(){t||this.removeListener(A,e),B.apply(this,arguments)&&t&&this.removeListener(A,e)}return e.cb=B,this.on(A,e),this}},t.mixin=function(A){var B,e=t.prototype;for(B in e)e.hasOwnProperty(B)&&(A.prototype[B]=e[B])},A.exports=t},function(A,B,t){var e=t(12),g={debug:1,info:2,warn:3,error:4};function i(){this.enabled=!0,this.defaultResult=!0,this.clear()}function Q(A,B){return A.n.test?A.n.test(B):A.n==B}e.mixin(i),i.prototype.allow=function(A,B){return this._white.push({n:A,l:g[B]}),this},i.prototype.deny=function(A,B){return this._black.push({n:A,l:g[B]}),this},i.prototype.clear=function(){return this._white=[],this._black=[],this},i.prototype.test=function(A,B){var t,e=Math.max(this._white.length,this._black.length);for(t=0;t=this._white[t].l)return!0;if(this._black[t]&&Q(this._black[t],A)&&g[B]<=this._black[t].l)return!1}return this.defaultResult},i.prototype.write=function(A,B,t){if(!this.enabled||this.test(A,B))return this.emit("item",A,B,t)},A.exports=i},function(A,B,t){var e=t(12),g=/\n+$/,i=new e;i.write=function(A,B,t){var e=t.length-1;if("undefined"!=typeof console&&console.log){if(console.log.apply)return console.log.apply(console,[A,B].concat(t));if(JSON&&JSON.stringify){t[e]&&"string"==typeof t[e]&&(t[e]=t[e].replace(g,""));try{for(e=0;et(125),pen:()=>t(126),wedo2:()=>t(130),music:()=>t(134),microbit:()=>t(197),text2speech:()=>t(198),translate:()=>t(199),videoSensing:()=>t(200),ev3:()=>t(232),makeymakey:()=>t(234),boost:()=>t(235),gdxfor:()=>t(236),tw:()=>t(239)};A.exports=class{constructor(A){this.nextExtensionWorker=0,this.pendingExtensions=[],this.pendingWorkers=[],this._loadedExtensions=new Map,this.workerMode="worker",this.runtime=A,this.loadingAsyncExtensions=0,this.asyncExtensionsLoadedCallbacks=[],e.setService("extensions",(A=>{const B={};return B.registerExtensionServiceSync=A.registerExtensionServiceSync.bind(A),B.allocateWorker=A.allocateWorker.bind(A),B.onWorkerInit=A.onWorkerInit.bind(A),B.registerExtensionService=A.registerExtensionService.bind(A),B})(this)).catch(A=>{g.error("ExtensionManager was unable to register extension service: ".concat(JSON.stringify(A)))})}isExtensionLoaded(A){return this._loadedExtensions.has(A)}loadExtensionIdSync(A){if(!s.hasOwnProperty(A))return void g.warn("Could not find extension ".concat(A," in the built in extensions."));if(this.isExtensionLoaded(A)){const B="Rejecting attempt to load a second extension with ID ".concat(A);return void g.warn(B)}const B=new(s[A]())(this.runtime),t=this._registerInternalExtension(B);this._loadedExtensions.set(A,t),this.runtime.compilerRegisterExtension(A,B)}loadExtensionURL(A){if(s.hasOwnProperty(A)){if(this.isExtensionLoaded(A)){const B="Rejecting attempt to load a second extension with ID ".concat(A);return g.warn(B),Promise.resolve()}const B=new(s[A]())(this.runtime),t=this._registerInternalExtension(B);return this._loadedExtensions.set(A,t),this.runtime.compilerRegisterExtension(A,B),Promise.resolve()}return this.loadingAsyncExtensions++,new Promise((B,t)=>{this.pendingExtensions.push({extensionURL:A,resolve:B,reject:t}),this.createExtensionWorker().then(A=>e.addWorker(A)).catch(A=>t(A))})}allAsyncExtensionsLoaded(){if(0!==this.loadingAsyncExtensions)return new Promise(A=>{this.asyncExtensionsLoadedCallbacks.push(A)})}createExtensionWorker(){if("worker"===this.workerMode){const A=t(240);return Promise.resolve(new A)}return"iframe"===this.workerMode?t.e(0).then(t.t.bind(null,325,7)).then(A=>new A.default):Promise.reject(new Error("Unknown extension worker mode"))}refreshBlocks(){const A=Array.from(this._loadedExtensions.values()).map(A=>e.call(A,"getInfo").then(B=>{B=this._prepareExtensionInfo(A,B),e.call("runtime","_refreshExtensionPrimitives",B)}).catch(A=>{g.error("Failed to refresh built-in extension primitives: ".concat(JSON.stringify(A)))}));return Promise.all(A)}allocateWorker(){const A=this.nextExtensionWorker++,B=this.pendingExtensions.shift();return this.pendingWorkers[A]=B,[A,B.extensionURL]}registerExtensionServiceSync(A){const B=e.callSync(A,"getInfo");this._registerExtensionInfo(A,B)}registerExtensionService(A){e.call(A,"getInfo").then(B=>{this._loadedExtensions.set(B.id,A),this._registerExtensionInfo(A,B),this.loadingAsyncExtensions--,0===this.loadingAsyncExtensions&&(this.asyncExtensionsLoadedCallbacks.forEach(A=>A()),this.asyncExtensionsLoadedCallbacks=[])})}onWorkerInit(A,B){const t=this.pendingWorkers[A];delete this.pendingWorkers[A],B?t.reject(B):t.resolve(A)}_registerInternalExtension(A){const B=A.getInfo(),t=this.nextExtensionWorker++,g="extension_".concat(t,"_").concat(B.id);return e.setServiceSync(g,A),e.callSync("extensions","registerExtensionServiceSync",g),g}_registerExtensionInfo(A,B){B=this._prepareExtensionInfo(A,B),e.call("runtime","_registerExtensionPrimitives",B).catch(B=>{g.error("Failed to register primitives for extension on service ".concat(A,":"),B)})}_sanitizeID(A){return A.toString().replace(/[<"&]/,"_")}_prepareExtensionInfo(A,B){if(B=Object.assign({},B),!/^[a-z0-9]+$/i.test(B.id))throw new Error("Invalid extension id");return B.name=B.name||B.id,B.blocks=B.blocks||[],B.targetTypes=B.targetTypes||[],B.blocks=B.blocks.reduce((B,t)=>{try{let e;switch(t){case"---":e="---";break;default:e=this._prepareBlockInfo(A,t)}B.push(e)}catch(A){g.error("Error processing block: ".concat(A.message,", Block:\n").concat(JSON.stringify(t)))}return B},[]),B.menus=B.menus||{},B.menus=this._prepareMenuInfo(A,B.menus),B}_prepareMenuInfo(A,B){const t=Object.getOwnPropertyNames(B);for(let g=0;g{switch(typeof(A=i(A,g))){case"object":return[i(A.text,g),A.value];case"string":return[A,A];default:return A}});if(!Q||Q.length<1)throw new Error("Extension menu returned no items: ".concat(B));return Q}_prepareBlockInfo(A,B){switch((B=Object.assign({},{blockType:Q.COMMAND,terminal:!1,blockAllThreads:!1,arguments:{}},B)).opcode=B.opcode&&this._sanitizeID(B.opcode),B.text=B.text||B.opcode,B.blockType){case Q.EVENT:B.func&&g.warn('Ignoring function "'.concat(B.func,'" for event block ').concat(B.opcode));break;case Q.BUTTON:B.opcode&&g.warn('Ignoring opcode "'.concat(B.opcode,'" for button with text: ').concat(B.text));break;default:{if(!B.opcode)throw new Error("Missing opcode for block");const t=B.func?this._sanitizeID(B.func):B.opcode,i=B.isDynamic?A=>A&&A.mutation&&A.mutation.blockInfo:()=>B,Q=(()=>{if(e._isRemoteService(A))return(B,g,i)=>e.call(A,t,B,g,i).then(A=>"number"==typeof A||"string"==typeof A||"boolean"==typeof A?A:"".concat(A)).catch(A=>(console.error("Custom extension block error",A),"".concat(A)));const B=e.services[A];return B[t]||g.warn("Could not find extension block function called ".concat(t)),(A,e,g)=>B[t](A,e,g)})();B.func=(A,B)=>{const t=i(A);return Q(A,B,t)};break}}return B}}},function(A,B,t){"use strict";var e=["number","date","time","ordinal","duration","spellout"],g=["plural","select","selectordinal"];function i(A,B){var t=A.pattern,e=t.length,g=[],i=A.index,s=Q(A,B);for(s&&g.push(s),s&&A.tokens&&A.tokens.push(["text",t.slice(i,A.index)]);A.index=9&&A<=13||32===A||133===A||160===A||6158===A||A>=8192&&A<=8205||8232===A||8233===A||8239===A||8287===A||8288===A||12288===A||65279===A}function n(A){for(var B=A.pattern,t=B.length,e=A.index;A.index"===A.pattern.slice(A.index,A.index+"/>".length))return A.tokens&&A.tokens.push(["syntax","/>"]),A.index+="/>".length,[t,B];if(">"!==A.pattern[A.index])throw C(A,">");A.tokens&&A.tokens.push(["syntax",">"]);++A.index;var e=i(A,B),g=A.index;if("");A.tokens&&A.tokens.push(["syntax","","");if(n(A),">"!==A.pattern[A.index])throw C(A,">");A.tokens&&A.tokens.push(["syntax",">"]);return++A.index,[t,B,{children:e}]}(A);if(t)return t;if("{"!==B[A.index])throw C(A,"{");A.tokens&&A.tokens.push(["syntax","{"]),++A.index,n(A);var g=c(A);if(!g)throw C(A,"placeholder id");A.tokens&&A.tokens.push(["id",g]),n(A);var Q=B[A.index];if("}"===Q)return A.tokens&&A.tokens.push(["syntax","}"]),++A.index,[g];if(","!==Q)throw C(A,", or }");A.tokens&&A.tokens.push(["syntax",","]),++A.index,n(A);var s,r=c(A);if(!r)throw C(A,"placeholder type");if(A.tokens&&A.tokens.push(["type",r]),n(A),"}"===(Q=B[A.index])){if(A.tokens&&A.tokens.push(["syntax","}"]),"plural"===r||"selectordinal"===r||"select"===r)throw C(A,r+" sub-messages");return++A.index,[g,r]}if(","!==Q)throw C(A,", or }");if(A.tokens&&A.tokens.push(["syntax",","]),++A.index,n(A),"plural"===r||"selectordinal"===r){var w=function(A){var B=A.pattern,t=B.length,e=0;if("offset:"===B.slice(A.index,A.index+"offset:".length)){A.tokens&&A.tokens.push(["offset","offset"],["syntax",":"]),A.index+="offset:".length,n(A);for(var g=A.index;A.index=48&&i<=57);)++A.index;if(g===A.index)throw C(A,"offset number");A.tokens&&A.tokens.push(["number",B.slice(g,A.index)]),e=+B.slice(g,A.index)}var i;return e}(A);n(A),s=[g,r,w,o(A,r)]}else if("select"===r)s=[g,r,o(A,r)];else if(e.indexOf(r)>=0)s=[g,r,E(A)];else{var a=A.index,I=E(A);n(A),"{"===B[A.index]&&(A.index=a,I=o(A,r)),s=[g,r,I]}if(n(A),"}"!==B[A.index])throw C(A,"}");return A.tokens&&A.tokens.push(["syntax","}"]),++A.index,s}function c(A,B){for(var t=A.pattern,e=t.length,g="";A.index"===i||"/"===i))break;g+=i,++A.index}return g}function E(A){var B=A.index,t=Q(A,"{style}");if(!t)throw C(A,"placeholder style name");return A.tokens&&A.tokens.push(["style",A.pattern.slice(B,A.index)]),t}function o(A,B){for(var t=A.pattern,e=t.length,i={};A.index=0)throw C(A,null,null,'"other" sub-message must be specified in '+B);return i}function w(A,B){if("{"!==A.pattern[A.index])throw C(A,"{ to start sub-message");A.tokens&&A.tokens.push(["syntax","{"]),++A.index;var t=i(A,B);if("}"!==A.pattern[A.index])throw C(A,"} to end sub-message");return A.tokens&&A.tokens.push(["syntax","}"]),++A.index,t}function C(A,B,t,e){var g=A.pattern,i=g.slice(0,A.index).split(/\r?\n/),Q=A.index,s=i.length,n=i.slice(-1)[0].length;return t=t||(A.index>=g.length?"end of message pattern":c(A)||g[A.index]),e||(e=function(A,B){return A?"Expected "+A+" but found "+B:"Unexpected "+B+" found"}(B,t)),new a(e+=" in "+g.replace(/\r?\n/g,"\n"),B,t,Q,s,n)}function a(A,B,t,e,g,i){Error.call(this,A),this.name="SyntaxError",this.message=A,this.expected=B,this.found=t,this.offset=e,this.line=g,this.column=i}B=A.exports=function(A,B){return i({pattern:String(A),index:0,tagsType:B&&B.tagsType||null,tokens:B&&B.tokens||null},"")},a.prototype=Object.create(Error.prototype),B.SyntaxError=a},function(A,B,t){"use strict";var e=t(57),g=t(58),i=t(59);function Q(A,B,t,e,g){var i=A.map((function(A){return function(A,B,t,e,g){if("string"==typeof A){var i=A;return function(){return i}}var n,r=A[0],c=A[1];if(B&&"#"===A[0]){r=B[0];var E=B[2],w=(e.number||o.number)([r,"number"],t);return function(A){return w(s(r,A)-E,A)}}"plural"===c||"selectordinal"===c?(n={},Object.keys(A[3]).forEach((function(B){n[B]=Q(A[3][B],A,t,e,g)})),A=[A[0],A[1],A[2],n]):A[2]&&"object"==typeof A[2]&&(n={},Object.keys(A[2]).forEach((function(B){n[B]=Q(A[2][B],A,t,e,g)})),A=[A[0],A[1],n]);var C=c&&(e[c]||o[c]);if(C){var a=C(A,t);return function(A){return a(s(r,A),A)}}return g?function(A){return String(s(r,A))}:function(A){return s(r,A)}}(A,B,t,e,g)}));return g?1===i.length?i[0]:function(A){for(var B="",t=0;t0)t=new Intl.PluralRules(B,{type:e});else{var n=g(B,i),r=n&&i[n][e]||E;t={select:r}}return function(A,B){return(s["="+ +A]||s[t.select(A-Q)]||s.other)(B)}}function E(){return"other"}(B=A.exports=function(A,B,t){return Q(A,null,B||"en",t||{},!0)}).toParts=function(A,B,t){return Q(A,null,B||"en",t||{},!1)};var o={number:n,ordinal:n,spellout:n,duration:function(A,B){var t=A[2],g=e.duration[t]||e.duration.default,i=new Intl.NumberFormat(B,g.seconds).format,Q=new Intl.NumberFormat(B,g.minutes).format,s=new Intl.NumberFormat(B,g.hours).format,n=/^fi$|^fi-|^da/.test(String(B))?".":":";return function(A,B){if(A=+A,!isFinite(A))return i(A);var t=~~(A/60/60),e=~~(A/60%60),g=(t?s(Math.abs(t))+n:"")+Q(Math.abs(e))+n+i(Math.abs(A%60));return A<0?s(-1).replace(s(1),g):g}},date:r,time:r,plural:c,selectordinal:c,select:function(A,B){var t=A[2];return function(A,B){return(t[A]||t.other)(B)}}};B.types=o},function(A,B,t){const e=t(2),g=t(5);A.exports=class{constructor(A){this.runtime=A}getInfo(){return{id:"coreExample",name:"CoreEx",blocks:[{func:"MAKE_A_VARIABLE",blockType:e.BUTTON,text:"make a variable (CoreEx)"},{opcode:"exampleOpcode",blockType:e.REPORTER,text:"example block"},{opcode:"exampleWithInlineImage",blockType:e.COMMAND,text:"block with image [CLOCKWISE] inline",arguments:{CLOCKWISE:{type:g.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 A=this.runtime.getTargetForStage();return A?A.getName():"no stage yet"}exampleWithInlineImage(){}}},function(A,B,t){const e=t(5),g=t(2),i=t(60),Q=t(1),s=t(13),n=t(23),r=t(4),c=t(3),E=(t(27),t(0)),o=t(14),w="color",C="saturation",a="brightness",I="transparency";class Y{constructor(A){this.runtime=A,this._penDrawableId=-1,this._penSkinId=-1,this._onTargetCreated=this._onTargetCreated.bind(this),this._onTargetMoved=this._onTargetMoved.bind(this),A.on("targetWasCreated",this._onTargetCreated),A.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(A){return this.runtime.renderer&&this.runtime.renderer.useHighQualityRender||!this.runtime.runtimeOptions.miscLimits?Math.max(0,A):c.clamp(A,Y.PEN_SIZE_RANGE.min,Y.PEN_SIZE_RANGE.max)}_getPenLayerID(){return this._penSkinId<0&&this.runtime.renderer&&(this._penSkinId=this.runtime.renderer.createPenSkin(),this._penDrawableId=this.runtime.renderer.createDrawable(o.PEN_LAYER),this.runtime.renderer.updateDrawableSkinId(this._penDrawableId,this._penSkinId)),this._penSkinId}_getPenState(A){let B=A._customState["Scratch.pen"];return B||(B=s.simple(Y.DEFAULT_PEN_STATE),A.setCustomState(Y.STATE_KEY,B)),B}_onTargetCreated(A,B){if(B){const t=B.getCustomState(Y.STATE_KEY);t&&(A.setCustomState(Y.STATE_KEY,s.simple(t)),t.penDown&&(A.onTargetMoved=this._onTargetMoved))}}_onTargetMoved(A,B,t,e){if(!e){const e=this._getPenLayerID();if(e>=0){const g=this._getPenState(A);this.runtime.renderer.penLine(e,g.penAttributes,B,t,A.x,A.y),this.runtime.requestRedraw()}}}_wrapColor(A){return c.wrapClamp(A,0,100)}_initColorParam(){return[{text:r({id:"pen.colorMenu.color",default:"color",description:"label for color element in color picker for pen extension"}),value:w},{text:r({id:"pen.colorMenu.saturation",default:"saturation",description:"label for saturation element in color picker for pen extension"}),value:C},{text:r({id:"pen.colorMenu.brightness",default:"brightness",description:"label for brightness element in color picker for pen extension"}),value:a},{text:r({id:"pen.colorMenu.transparency",default:"transparency",description:"label for transparency element in color picker for pen extension"}),value:I}]}_clampColorParam(A){return c.clamp(A,0,100)}_alphaToTransparency(A){return 100*(1-A)}_transparencyToAlpha(A){return 1-A/100}getInfo(){return{id:"pen",name:r({id:"pen.categoryName",default:"Pen",description:"Label for the pen extension category"}),blockIconURI:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48dGl0bGU+cGVuLWljb248L3RpdGxlPjxnIHN0cm9rZT0iIzU3NUU3NSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiPjxwYXRoIGQ9Ik04Ljc1MyAzNC42MDJsLTQuMjUgMS43OCAxLjc4My00LjIzN2MxLjIxOC0yLjg5MiAyLjkwNy01LjQyMyA1LjAzLTcuNTM4TDMxLjA2NiA0LjkzYy44NDYtLjg0MiAyLjY1LS40MSA0LjAzMi45NjcgMS4zOCAxLjM3NSAxLjgxNiAzLjE3My45NyA0LjAxNUwxNi4zMTggMjkuNTljLTIuMTIzIDIuMTE2LTQuNjY0IDMuOC03LjU2NSA1LjAxMiIgZmlsbD0iI0ZGRiIvPjxwYXRoIGQ9Ik0yOS40MSA2LjExcy00LjQ1LTIuMzc4LTguMjAyIDUuNzcyYy0xLjczNCAzLjc2Ni00LjM1IDEuNTQ2LTQuMzUgMS41NDYiLz48cGF0aCBkPSJNMzYuNDIgOC44MjVjMCAuNDYzLS4xNC44NzMtLjQzMiAxLjE2NGwtOS4zMzUgOS4zYy4yODItLjI5LjQxLS42NjguNDEtMS4xMiAwLS44NzQtLjUwNy0xLjk2My0xLjQwNi0yLjg2OC0xLjM2Mi0xLjM1OC0zLjE0Ny0xLjgtNC4wMDItLjk5TDMwLjk5IDUuMDFjLjg0NC0uODQgMi42NS0uNDEgNC4wMzUuOTYuODk4LjkwNCAxLjM5NiAxLjk4MiAxLjM5NiAyLjg1NU0xMC41MTUgMzMuNzc0Yy0uNTczLjMwMi0xLjE1Ny41Ny0xLjc2NC44M0w0LjUgMzYuMzgybDEuNzg2LTQuMjM1Yy4yNTgtLjYwNC41My0xLjE4Ni44MzMtMS43NTcuNjkuMTgzIDEuNDQ4LjYyNSAyLjEwOCAxLjI4Mi42Ni42NTggMS4xMDIgMS40MTIgMS4yODcgMi4xMDIiIGZpbGw9IiM0Qzk3RkYiLz48cGF0aCBkPSJNMzYuNDk4IDguNzQ4YzAgLjQ2NC0uMTQuODc0LS40MzMgMS4xNjVsLTE5Ljc0MiAxOS42OGMtMi4xMyAyLjExLTQuNjczIDMuNzkzLTcuNTcyIDUuMDFMNC41IDM2LjM4bC45NzQtMi4zMTYgMS45MjUtLjgwOGMyLjg5OC0xLjIxOCA1LjQ0LTIuOSA3LjU3LTUuMDFsMTkuNzQzLTE5LjY4Yy4yOTItLjI5Mi40MzItLjcwMi40MzItMS4xNjUgMC0uNjQ2LS4yNy0xLjQtLjc4LTIuMTIyLjI1LjE3Mi41LjM3Ny43MzcuNjE0Ljg5OC45MDUgMS4zOTYgMS45ODMgMS4zOTYgMi44NTYiIGZpbGw9IiM1NzVFNzUiIG9wYWNpdHk9Ii4xNSIvPjxwYXRoIGQ9Ik0xOC40NSAxMi44M2MwIC41LS40MDQuOTA1LS45MDQuOTA1cy0uOTA1LS40MDUtLjkwNS0uOTA0YzAtLjUuNDA3LS45MDMuOTA2LS45MDMuNSAwIC45MDQuNDA0LjkwNC45MDR6IiBmaWxsPSIjNTc1RTc1Ii8+PC9nPjwvc3ZnPg==",blocks:[{opcode:"clear",blockType:g.COMMAND,text:r({id:"pen.clear",default:"erase all",description:"erase all pen trails and stamps"})},{opcode:"stamp",blockType:g.COMMAND,text:r({id:"pen.stamp",default:"stamp",description:"render current costume on the background"}),filter:[i.SPRITE]},{opcode:"penDown",blockType:g.COMMAND,text:r({id:"pen.penDown",default:"pen down",description:"start leaving a trail when the sprite moves"}),filter:[i.SPRITE]},{opcode:"penUp",blockType:g.COMMAND,text:r({id:"pen.penUp",default:"pen up",description:"stop leaving a trail behind the sprite"}),filter:[i.SPRITE]},{opcode:"setPenColorToColor",blockType:g.COMMAND,text:r({id:"pen.setColor",default:"set pen color to [COLOR]",description:"set the pen color to a particular (RGB) value"}),arguments:{COLOR:{type:e.COLOR}},filter:[i.SPRITE]},{opcode:"changePenColorParamBy",blockType:g.COMMAND,text:r({id:"pen.changeColorParam",default:"change pen [COLOR_PARAM] by [VALUE]",description:"change the state of a pen color parameter"}),arguments:{COLOR_PARAM:{type:e.STRING,menu:"colorParam",defaultValue:w},VALUE:{type:e.NUMBER,defaultValue:10}},filter:[i.SPRITE]},{opcode:"setPenColorParamTo",blockType:g.COMMAND,text:r({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:e.STRING,menu:"colorParam",defaultValue:w},VALUE:{type:e.NUMBER,defaultValue:50}},filter:[i.SPRITE]},{opcode:"changePenSizeBy",blockType:g.COMMAND,text:r({id:"pen.changeSize",default:"change pen size by [SIZE]",description:"change the diameter of the trail left by a sprite"}),arguments:{SIZE:{type:e.NUMBER,defaultValue:1}},filter:[i.SPRITE]},{opcode:"setPenSizeTo",blockType:g.COMMAND,text:r({id:"pen.setSize",default:"set pen size to [SIZE]",description:"set the diameter of a trail left by a sprite"}),arguments:{SIZE:{type:e.NUMBER,defaultValue:1}},filter:[i.SPRITE]},{opcode:"setPenShadeToNumber",blockType:g.COMMAND,text:r({id:"pen.setShade",default:"set pen shade to [SHADE]",description:"legacy pen blocks - set pen shade"}),arguments:{SHADE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenShadeBy",blockType:g.COMMAND,text:r({id:"pen.changeShade",default:"change pen shade by [SHADE]",description:"legacy pen blocks - change pen shade"}),arguments:{SHADE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"setPenHueToNumber",blockType:g.COMMAND,text:r({id:"pen.setHue",default:"set pen color to [HUE]",description:"legacy pen blocks - set pen color to number"}),arguments:{HUE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"changePenHueBy",blockType:g.COMMAND,text:r({id:"pen.changeHue",default:"change pen color by [HUE]",description:"legacy pen blocks - change pen color"}),arguments:{HUE:{type:e.NUMBER,defaultValue:1}},hideFromPalette:!0}],menus:{colorParam:{acceptReporters:!0,items:this._initColorParam()}}}}clear(){const A=this._getPenLayerID();A>=0&&(this.runtime.renderer.penClear(A),this.runtime.requestRedraw())}stamp(A,B){this._stamp(B.target)}_stamp(A){const B=this._getPenLayerID();B>=0&&(this.runtime.renderer.penStamp(B,A.drawableID),this.runtime.requestRedraw())}penDown(A,B){this._penDown(B.target)}_penDown(A){const B=this._getPenState(A);B.penDown||(B.penDown=!0,A.onTargetMoved=this._onTargetMoved);const t=this._getPenLayerID();t>=0&&(this.runtime.renderer.penPoint(t,B.penAttributes,A.x,A.y),this.runtime.requestRedraw())}penUp(A,B){this._penUp(B.target)}_penUp(A){const B=this._getPenState(A);B.penDown&&(B.penDown=!1,A.onTargetMoved=null)}setPenColorToColor(A,B){this._setPenColorToColor(A.COLOR,B.target)}_setPenColorToColor(A,B){const t=this._getPenState(B),e=Q.toRgbColorObject(A),g=n.rgbToHsv(e);t.color=g.h/360*100,t.saturation=100*g.s,t.brightness=100*g.v,e.hasOwnProperty("a")?t.transparency=100*(1-e.a/255):t.transparency=0,t._shade=t.brightness/2,this._updatePenColor(t)}_updatePenColor(A){const B=n.hsvToRgb({h:360*A.color/100,s:A.saturation/100,v:A.brightness/100});A.penAttributes.color4f[0]=B.r/255,A.penAttributes.color4f[1]=B.g/255,A.penAttributes.color4f[2]=B.b/255,A.penAttributes.color4f[3]=this._transparencyToAlpha(A.transparency)}_setOrChangeColorParam(A,B,t,e){switch(A){case w:t.color=this._wrapColor(B+(e?t.color:0));break;case C:t.saturation=this._clampColorParam(B+(e?t.saturation:0));break;case a:t.brightness=this._clampColorParam(B+(e?t.brightness:0));break;case I:t.transparency=this._clampColorParam(B+(e?t.transparency:0));break;default:E.warn("Tried to set or change unknown color parameter: ".concat(A))}this._updatePenColor(t)}changePenColorParamBy(A,B){const t=this._getPenState(B.target);this._setOrChangeColorParam(A.COLOR_PARAM,Q.toNumber(A.VALUE),t,!0)}setPenColorParamTo(A,B){const t=this._getPenState(B.target);this._setOrChangeColorParam(A.COLOR_PARAM,Q.toNumber(A.VALUE),t,!1)}changePenSizeBy(A,B){this._changePenSizeBy(Q.toNumber(A.SIZE),B.target)}_changePenSizeBy(A,B){const t=this._getPenState(B).penAttributes;t.diameter=this._clampPenSize(t.diameter+A)}setPenSizeTo(A,B){this._setPenSizeTo(Q.toNumber(A.SIZE),B.target)}_setPenSizeTo(A,B){this._getPenState(B).penAttributes.diameter=this._clampPenSize(A)}setPenHueToNumber(A,B){this._setPenHueToNumber(Q.toNumber(A.HUE),B.target)}_setPenHueToNumber(A,B){const t=this._getPenState(B),e=A/2;this._setOrChangeColorParam(w,e,t,!1),this._setOrChangeColorParam(I,0,t,!1),this._legacyUpdatePenColor(t)}changePenHueBy(A,B){this._changePenHueBy(Q.toNumber(A.HUE),B.target)}_changePenHueBy(A,B){const t=this._getPenState(B),e=A/2;this._setOrChangeColorParam(w,e,t,!0),this._legacyUpdatePenColor(t)}setPenShadeToNumber(A,B){this._setPenShadeToNumber(Q.toNumber(A.SHADE),B.target)}_setPenShadeToNumber(A,B){const t=this._getPenState(B);let e=Q.toNumber(A);e%=200,e<0&&(e+=200),t._shade=e,this._legacyUpdatePenColor(t)}changePenShadeBy(A,B){this._changePenShadeBy(A.SHADE,B.target)}_changePenShadeBy(A,B){const t=this._getPenState(B),e=Q.toNumber(A);this._setPenShadeToNumber(t._shade+e,B)}_legacyUpdatePenColor(A){let B=n.hsvToRgb({h:360*A.color/100,s:1,v:1});const t=A._shade>100?200-A._shade:A._shade;B=t<50?n.mixRgb(n.RGB_BLACK,B,(10+t)/60):n.mixRgb(B,n.RGB_WHITE,(t-50)/60);const e=n.rgbToHsv(B);A.color=100*e.h/360,A.saturation=100*e.s,A.brightness=100*e.v,this._updatePenColor(A)}}A.exports=Y},function(A,B,t){const e=t(20),g=t(16),i=t(8),Q=t(40),s=t(6),{Map:n}=t(24),r=t(0),c=t(7),E=t(65);A.exports=class extends e{constructor(A,B){super(),B||(B=new g(A)),this.runtime=A,this.id=s(),this.blocks=B,this.variables={},this.comments={},this._customState={},this._edgeActivatedHatValues={}}onGreenFlag(){}getName(){return this.id}updateEdgeActivatedValue(A,B){const t=this._edgeActivatedHatValues[A];return this._edgeActivatedHatValues[A]=B,t}hasEdgeActivatedValue(A){return this._edgeActivatedHatValues.hasOwnProperty(A)}clearEdgeActivatedValues(){this._edgeActivatedHatValues={}}lookupOrCreateVariable(A,B){let t=this.lookupVariableById(A);if(t)return t;if(t=this.lookupVariableByNameAndType(B,i.SCALAR_TYPE),t)return t;const e=new i(A,B,i.SCALAR_TYPE,!1);return this.variables[A]=e,e}lookupBroadcastMsg(A,B){let t;if(A?t=this.lookupVariableById(A):B?t=this.lookupBroadcastByInputValue(B):r.error("Cannot find broadcast message if neither id nor name are provided."),t)return B&&t.name.toLowerCase()!==B.toLowerCase()&&r.error("Found broadcast message with id: ".concat(A,", but")+"its name, ".concat(t.name," did not match expected name ").concat(B,".")),t.type!==i.BROADCAST_MESSAGE_TYPE&&r.error("Found variable with id: ".concat(A,", but its type ").concat(t.type)+"did not match expected type ".concat(i.BROADCAST_MESSAGE_TYPE)),t}lookupBroadcastByInputValue(A){const B=this.variables;for(const t in B)if(B[t].type===i.BROADCAST_MESSAGE_TYPE&&B[t].name.toLowerCase()===A.toLowerCase())return B[t]}lookupVariableById(A){if(this.variables.hasOwnProperty(A))return this.variables[A];if(this.runtime&&!this.isStage){const B=this.runtime.getTargetForStage();if(B&&B.variables.hasOwnProperty(A))return B.variables[A]}}lookupVariableByNameAndType(A,B,t){if("string"==typeof A){"string"!=typeof B&&(B=i.SCALAR_TYPE),t=t||!1;for(const t in this.variables){const e=this.variables[t];if(e.name===A&&e.type===B)return e}if(!t&&this.runtime&&!this.isStage){const t=this.runtime.getTargetForStage();if(t)for(const e in t.variables){const g=t.variables[e];if(g.name===A&&g.type===B)return g}}return null}}lookupOrCreateList(A,B){let t=this.lookupVariableById(A);if(t)return t;if(t=this.lookupVariableByNameAndType(B,i.LIST_TYPE),t)return t;const e=new i(A,B,i.LIST_TYPE,!1);return this.variables[A]=e,e}createVariable(A,B,t,e){if(!this.variables.hasOwnProperty(A)){const g=new i(A,B,t,!1);e&&this.isStage&&this.runtime.canAddCloudVariable()&&(g.isCloud=!0,this.runtime.addCloudVariable(),this.runtime.ioDevices.cloud.requestCreateVariable(g)),this.variables[A]=g}}createComment(A,B,t,e,g,i,s,n){if(!this.comments.hasOwnProperty(A)){const c=new Q(A,t,e,g,i,s,n);if(B){c.blockId=B;const t=this.blocks.getBlock(B);t?t.comment=A:r.warn("Could not find block with id ".concat(B," associated with commentId: ").concat(A))}this.comments[A]=c}}renameVariable(A,B){if(this.variables.hasOwnProperty(A)){const t=this.variables[A];if(t.id===A){const e=t.name;if(t.name=B,this.runtime){if(t.isCloud&&this.isStage&&this.runtime.ioDevices.cloud.requestRenameVariable(e,B),t.type===i.SCALAR_TYPE){let A=!1;this.runtime.targets.forEach(t=>{A=t.blocks.updateSensingOfReference(e,B,this.isStage?"_stage_":this.getName())||A}),A&&this.runtime.requestBlocksUpdate()}const g=this.runtime.monitorBlocks;g.changeBlock({id:A,element:"field",name:t.type===i.LIST_TYPE?"LIST":"VARIABLE",value:A},this.runtime);const Q=g.getBlock(t.id);Q&&this.runtime.requestUpdateMonitor(n({id:A,params:g._getBlockParams(Q)}))}}}}deleteVariable(A){if(this.variables.hasOwnProperty(A)){const B=this.variables[A].name,t=this.variables[A].isCloud;delete this.variables[A],this.runtime&&(t&&this.isStage&&(this.runtime.ioDevices.cloud.requestDeleteVariable(B),this.runtime.removeCloudVariable()),this.runtime.monitorBlocks.deleteBlock(A),this.runtime.requestRemoveMonitor(A))}}deleteMonitors(){let A;this.runtime.requestRemoveMonitorByTargetId(this.id),A=this.isStage?Object.keys(this.variables):Object.keys(this.runtime.monitorBlocks._blocks).filter(A=>this.runtime.monitorBlocks._blocks[A].targetId===this.id);for(const B of A)this.runtime.monitorBlocks.deleteBlock(B)}duplicateVariable(A,B){if(this.variables.hasOwnProperty(A)){const t=this.variables[A],e=new i(B?A:null,t.name,t.type,t.isCloud);return e.type===i.LIST_TYPE?e.value=t.value.slice(0):e.value=t.value,e}return null}duplicateVariables(A){let B;return A&&(B=A.getAllVariableAndListReferences()),Object.keys(this.variables).reduce((t,e)=>{const g=this.duplicateVariable(e,!A);if(t[g.id]=g,A&&B){const A=B[e];A&&this.mergeVariables(e,g.id,A)}return t},{})}postSpriteInfo(){}getCustomState(A){return this._customState[A]}setCustomState(A,B){this._customState[A]=B}dispose(){this._customState={},this.runtime&&this.runtime.removeExecutable(this)}getAllVariableNamesInScopeByType(A,B){"string"!=typeof A&&(A=i.SCALAR_TYPE),B=B||!1;const t=Object.values(this.variables).filter(B=>B.type===A).map(A=>A.name);if(B||this.isStage||!this.runtime)return t;const e=this.runtime.getTargetForStage().getAllVariableNamesInScopeByType(A);return t.concat(e)}mergeVariables(A,B,t,e){const g=t||this.blocks.getAllVariableAndListReferences()[A];E.updateVariableIdentifiers(g,B,e)}shareLocalVariableToStage(A,B){if(!this.runtime)return;const t=this.variables[A];if(!t)return void r.warn("Cannot share a local variable to the stage if it's not local.");const e=this.runtime.getTargetForStage(),g="StageVarFromLocal_".concat(A);let i=e.lookupVariableById(g);if(!i){const A=t.name,B=t.type,e="Stage: ".concat(A);i=this.runtime.createNewGlobalVariable(e,g,B)}this.mergeVariables(A,i.id,B,i.name)}shareLocalVariableToSprite(A,B,t){if(!this.runtime)return;if(this.isStage)return;const e=this.variables[A];if(!e)return void r.warn("Tried to call 'shareLocalVariableToSprite' with a non-local variable.");const g=e.name,Q=e.type,s=B.lookupVariableByNameAndType(g,Q);let n;if(s)n=s.id;else{const A=new i(null,g,Q);n=A.id,B.variables[n]=A}this.mergeVariables(A,n,t)}resolveVariableSharingConflictsWithTarget(A,B){if(this.isStage)return;const t=this.blocks.getAllVariableAndListReferences(A);for(const A in t){if(!this.variables[A])continue;const e=t[A];B.isStage?this.shareLocalVariableToStage(A,e):this.shareLocalVariableToSprite(A,B,e)}}fixUpVariableReferences(){if(!this.runtime)return;if(this.isStage)return;const A=this.runtime.getTargetForStage();if(!A||!A.variables)return;const B=(B,t,e)=>{if(A.lookupVariableByNameAndType(t,e)){const A=c.unusedName("".concat(this.getName(),": ").concat(t),this.getAllVariableNamesInScopeByType(e));return this.renameVariable(B,A),A}return null},t=this.blocks.getAllVariableAndListReferences(),e=[];if(Object.keys(this.variables).length>0)for(const A in this.variables)this.variables.hasOwnProperty(A)&&(t[A]||e.push(A));const g=Object.create(null),i=Object.create(null),Q={},s=A=>{const B=Q[A];return B||(Q[A]=this.runtime.getAllVarNamesOfType(A),Q[A])};for(const e in t){const Q=t[e][0],n=Q.referencingField.value,r=Q.type;if(this.lookupVariableById(e)){if(this.variables.hasOwnProperty(e)){const A=B(e,n,r);A&&t[e].map(B=>(B.referencingField.value=A,B))}}else{const B=A.lookupVariableByNameAndType(n,r);if(B)g[e]||(g[e]=B.id);else{const B=s(r),t=c.unusedName(n,B);A.createVariable(e,t,r),i[e]||(i[e]=t)}}}for(const A in e){const t=e[A];B(t,this.variables[t].name,this.variables[t].type)}for(const A in g){const B=g[A],e=t[A];this.mergeVariables(A,B,e)}for(const A in i){const B=i[A];t[A].map(A=>(A.referencingField.value=B,A))}}}},function(A,B,t){const e=t(61),g=t(62),i=t(6),Q=function A(B,t,g,Q){B.attribs.id||(B.attribs.id=i());const s={id:B.attribs.id,opcode:B.attribs.type,inputs:{},fields:{},next:null,topLevel:g,parent:Q,shadow:"shadow"===B.name,x:B.attribs.x,y:B.attribs.y};t[s.id]=s;for(let g=0;g0&&i.children[0].data?i.children[0].data:"",s.fields[A]={name:A,id:B,value:t};const e=i.attribs.variabletype;"string"==typeof e&&(s.fields[A].variableType=e);break}case"comment":s.comment=i.attribs.id;break;case"value":case"statement":{A(Q,t,!1,s.id),n&&Q!==n&&A(n,t,!1,s.id);const B=i.attribs.name;s.inputs[B]={name:B,block:Q.attribs.id,shadow:n?n.attribs.id:null};break}case"next":if(!Q||!Q.attribs)continue;A(Q,t,!1,s.id),s.next=Q.attribs.id;break;case"mutation":s.mutation=e(i)}}};A.exports=function(A){if("object"==typeof A&&"object"==typeof A.xml)return function(A){const B={};for(let t=0;t",quot:'"',nbsp:" "},e=/&([a-z]+);/gi;A.exports=function(A){return A.replace(e,(function(A,B){return B=B.toLowerCase(),t.hasOwnProperty(B)?t[B]:A}))}},function(A,B,t){const e=t(5),g=t(2),i=t(1),Q=t(4),s=t(23),n=t(29),r=t(17),c=t(3),E=t(41),o=t(0),w="00001523-1212-efde-1523-785feabcd123",C="00004f0e-1212-efde-1523-785feabcd123",a="00001527-1212-efde-1523-785feabcd123",I="00001528-1212-efde-1523-785feabcd123",Y="00001560-1212-efde-1523-785feabcd123",h="00001563-1212-efde-1523-785feabcd123",M="00001565-1212-efde-1523-785feabcd123",F=1,D=23,u=34,l=35,d=6,U=5,N=1,m=2,G=3,f=4,H={TILT:0,DISTANCE:0,LED:1},R={TILT:0,DISTANCE:1,LED:0};class p{constructor(A,B){this._parent=A,this._index=B,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(A){this._direction=A<0?-1:1}get power(){return this._power}set power(A){const B=Math.max(0,Math.min(A,100));if(0===B)this._power=0;else{const A=100/B;this._power=30+70/A}}get isOn(){return this._isOn}get pendingTimeoutStartTime(){return this._pendingTimeoutStartTime}get pendingTimeoutDelay(){return this._pendingTimeoutDelay}turnOn(){if(0===this._power)return;const A=this._parent.generateOutputCommand(this._index+1,N,[this._power*this._direction]);this._parent.send(M,A),this._isOn=!0,this._clearTimeout()}turnOnFor(A){0!==this._power&&(A=Math.max(0,A),this.turnOn(),this._setNewTimeout(this.startBraking,A))}startBraking(){if(0===this._power)return;const A=this._parent.generateOutputCommand(this._index+1,N,[127]);this._parent.send(M,A),this._isOn=!1,this._setNewTimeout(this.turnOff,p.BRAKE_TIME_MS)}turnOff(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(0===this._power)return;const B=this._parent.generateOutputCommand(this._index+1,N,[0]);this._parent.send(M,B,A),this._isOn=!1}_clearTimeout(){null!==this._pendingTimeoutId&&(clearTimeout(this._pendingTimeoutId),this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null)}_setNewTimeout(A,B){this._clearTimeout();const t=setTimeout(()=>{this._pendingTimeoutId===t&&(this._pendingTimeoutId=null,this._pendingTimeoutStartTime=null,this._pendingTimeoutDelay=null),A()},B);this._pendingTimeoutId=t,this._pendingTimeoutStartTime=Date.now(),this._pendingTimeoutDelay=B}}class J{constructor(A,B){this._runtime=A,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=B,this._ports=["none","none"],this._motors=[null,null],this._sensors={tiltX:0,tiltY:0,distance:0},this._ble=null,this._runtime.registerPeripheralExtension(B,this),this._rateLimiter=new E(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(A){return this._motors[A]}stopAllMotors(){this._motors.forEach(A=>{A&&A.turnOff(!1)})}setLED(A){const B=[A>>16&255,A>>8&255,255&A],t=this.generateOutputCommand(d,f,B);return this.send(M,t)}setLEDMode(){const A=this.generateInputCommand(d,D,H.LED,0,R.LED,!1);return this.send(h,A)}stopLED(){const A=this.generateOutputCommand(d,f,[0,0,0]);return this.send(M,A)}playTone(A,B){const t=this.generateOutputCommand(U,m,[A,A>>8,B,B>>8]);return this.send(M,t)}stopTone(){const A=this.generateOutputCommand(U,G);return this.send(M,A,!1)}stopAll(){this.isConnected()&&(this.stopTone(),this.stopAllMotors())}scan(){this._ble&&this._ble.disconnect(),this._ble=new n(this._runtime,this._extensionId,{filters:[{services:[w]}],optionalServices:[C]},this._onConnect,this.reset)}connect(A){this._ble&&this._ble.connectPeripheral(A)}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 A=!1;return this._ble&&(A=this._ble.isConnected()),A}send(A,B){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.isConnected()?t&&!this._rateLimiter.okayToSend()?Promise.resolve():this._ble.write(C,A,r.uint8ArrayToBase64(B),"base64"):Promise.resolve()}generateOutputCommand(A,B){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,e=[A,B];return t&&(e=e.concat(t.length).concat(t)),e}generateInputCommand(A,B,t,e,g,i){return[1,2,A,B,t,e,0,0,0,g,i?1:0]}_onConnect(){this.setLEDMode(),this.setLED(255),this._ble.startNotifications(w,a,this._onMessage),this._batteryLevelIntervalId=window.setInterval(this._checkBatteryLevel,5e3)}_onMessage(A){const B=r.base64ToUint8Array(A);switch(B[0]){case 1:case 2:{const A=B[0];0===B[1]?this._clearPort(A):this._registerSensorOrMotor(A,B[3]);break}default:{const A=B[1],t=this._ports[A-1];t===l&&(this._sensors.distance=B[2]),t===u&&(this._sensors.tiltX=B[2],this._sensors.tiltY=B[3]);break}}}_checkBatteryLevel(){this._ble.read(w,I,!1)}_registerSensorOrMotor(A,B){if(this._ports[A-1]=B,B===F)this._motors[A-1]=new p(this,A-1);else{const t=B===l?"DISTANCE":"TILT",e=this.generateInputCommand(A,B,H[t],1,R[t],!0);this.send(h,e),this._ble.startNotifications(C,Y,this._onMessage)}}_clearPort(A){const B=this._ports[A-1];B===u&&(this._sensors.tiltX=this._sensors.tiltY=0),B===l&&(this._sensors.distance=0),this._ports[A-1]="none",this._motors[A-1]=null}}const y="motor",k="motor A",T="motor B",j="all motors",x="this way",S="that way",b="reverse",z="up",L="down",P="left",v="right",W="any";class V{static get EXTENSION_ID(){return"wedo2"}static get TILT_THRESHOLD(){return 15}constructor(A){this.runtime=A,this._peripheral=new J(this.runtime,V.EXTENSION_ID)}getInfo(){return{id:V.EXTENSION_ID,name:"WeDo 2.0",blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAF8klEQVR4Ae2cbWxTVRjH/7ctbVc2tyEMNpWBk0VIkLcEjSAQgglTE5HEaKqJi1E/mbCP/dJA0kQbvzgTQ0Ki2T7V6AeYGoEPLJmGKPiyzZDwEpYJCHSbQIcbdLvres1zOa13Xbvdu2eTDp9fst329Lnn5XfPPfece7tphmFAmDkuccdDBDIRgUxEIBMRyEQEMhGBTEQgExHIRAQyEYFMRCATEchEBDIRgUxEIBMRyEQEMhGBTEQgExHIxMPNIByNVQBoBUDb7kgo2KTS9wBoUmFNkVCwW6U3A1gP4JJKHwxHY/S+WcW2RkLBVhV7AMAOAIMAGlWstbyOSCh4QMU2Uoy1PBVL+a7IqZu1vOZIKNg20/azBarGvKxebw9HY22RULADwBFLTBcATQnZl4lVEimN4ssteXQrQfstebQpmW1q30xshyqvxRLbofYnYW9ZYgeV8C5LLOWlzbTxM3ouHI7GPgSwWx3Z0syBSBku6IYnlTbM+uQenJQaMnKHDaqAFnDrcCFbl3G1defEjas0a4N/Vz10OybyvapfrSX1sjpo+WIz0ME7QL3djgtHPTAcjb2mepw/b2ZaGh5NL5RnofR8R99dIC5fHusK5JsrCUpm7TSx21XvbcwTNwnbAsPR2GcA3qaG+H0LsHlDPZ7fca/ujZ+cRW9/Em5vCXzlNVhQUjFpf/3OTSRvXkKJz43Xt1bh1S1LUeq/5+njQ9/iVmLIfL1ieRU2b1iFtavztXNu6TrTi8PfnYI67WdPoOp5przV9Y8iuHdb9rOW9uumPI+vDIElddBckztPOqVn5X36Xj1WVQeynx1sOWbK83jc2PviM/dFXIYNax9H55leXLoyYHsfWwI14JCRRx7x5ckBU1oheYQ+1G9u39lVM0Hej7+cR7w/Yb7e9+5LqChfaLvixcK088BwNNZkAOV02ubK6+odwt3RcfOULSSPGEveG48bNj08If3kqXPmdtO6unkpDzYn0u/TLxrzcumJJ80Ut79sygzoFF6/siw75mUYupOEpmnY0/A0pw33FTsCa+hX5oJhZXgkZb5zub2O20CnL7EwkPeCPm+wI7CEBvi5wuOZ36tJW7X3uGXJXAgxk8P4eNpRPEvgskqfuR0Z/BNGejxvDM3/5gs0pboWv+motqybCc+tqUCzz43kaBJ/X+2eMjZ3ClNsjIzo5ioknXZ2b4AlkKYltLJoaY9jOJm/B0KJbtg4c4F/XOmH3+dF9dLKbBo1OD6QQGV56YQ55ODtO0jcHkZ1VSX8/n9nB9S7RkZ1rFy+NG8ZR9s70TeQQKDEh7vJUdt1Y9/OopXFB2/WcbMpyOexE9mlFS21aLlHMmKHfzBl0QT/hV2bzM9oLXv0xG8YGR0zpdLEn6RT2k+/XjDzoLX2G3u3TZBLUyral/Z5qCyAK1f/sl2/or+IWNel1Eji3MWrpjyCZHWqdNrSe6ieSHFERl4mP+q5GehgHGvvRGal5XI5uzU47f3A/R99YTgdF2wXrmkolr9ToZ5NvTjT4yOhoC2T057CJM/r9WDxoqmXa07R9THcuDVcMO8bt4ag6ynULKvkFjWBTLl0ugZKvNlyqLeSQKfYGgOpgXt2b5zVhlzrS+Dr451YvKg0b95txztxvS8xZ+VuXFuLJ5+oNgV+9c3PuHDxGs6cu+w4v//9RJo6x5bN9UgbBo4cPY1U6j+cSD8orFvzGFYuX4KxsRQGbth6FCICc9m5dY05HtN46AQRqPB5PWjY+ZT5RnMwkxGBFh5ZVmle9Z3MrGbjwfqccrC1vajrV7QCaVCfS6qrJj96nQlFK5CujPRT7MgYyEQEMhGBTGwJpAW4kJ9pBbo0zbx70X7y7AOv8HxP3LyB4YTpb2cZBt2iqL3QEwf9zDbX+waLca439QMeC7a+YBmOxugLiM/OTt2yaOoMoO+H6LOcNwf6xusrthsh/7mIh1yFmYhAJiKQiQhkIgKZiEAmIpCJCGQiApmIQCYikIkIZCICmYhAJiKQiQhkIgKZiEAmIpCJCGQiAjkA+AeOwQKMcWZqHgAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"motorOnFor",text:Q({id:"wedo2.motorOnFor",default:"turn [MOTOR_ID] on for [DURATION] seconds",description:"turn a motor on for some time"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y},DURATION:{type:e.NUMBER,defaultValue:1}}},{opcode:"motorOn",text:Q({id:"wedo2.motorOn",default:"turn [MOTOR_ID] on",description:"turn a motor on indefinitely"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y}}},{opcode:"motorOff",text:Q({id:"wedo2.motorOff",default:"turn [MOTOR_ID] off",description:"turn a motor off"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y}}},{opcode:"startMotorPower",text:Q({id:"wedo2.startMotorPower",default:"set [MOTOR_ID] power to [POWER]",description:"set the motor's power and turn it on"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y},POWER:{type:e.NUMBER,defaultValue:100}}},{opcode:"setMotorDirection",text:Q({id:"wedo2.setMotorDirection",default:"set [MOTOR_ID] direction to [MOTOR_DIRECTION]",description:"set the motor's turn direction"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:y},MOTOR_DIRECTION:{type:e.STRING,menu:"MOTOR_DIRECTION",defaultValue:x}}},{opcode:"setLightHue",text:Q({id:"wedo2.setLightHue",default:"set light color to [HUE]",description:"set the LED color"}),blockType:g.COMMAND,arguments:{HUE:{type:e.NUMBER,defaultValue:50}}},{opcode:"playNoteFor",text:Q({id:"wedo2.playNoteFor",default:"play note [NOTE] for [DURATION] seconds",description:"play a certain note for some time"}),blockType:g.COMMAND,arguments:{NOTE:{type:e.NUMBER,defaultValue:60},DURATION:{type:e.NUMBER,defaultValue:.5}},hideFromPalette:!0},{opcode:"whenDistance",text:Q({id:"wedo2.whenDistance",default:"when distance [OP] [REFERENCE]",description:"check for when distance is < or > than reference"}),blockType:g.HAT,arguments:{OP:{type:e.STRING,menu:"OP",defaultValue:"<"},REFERENCE:{type:e.NUMBER,defaultValue:50}}},{opcode:"whenTilted",text:Q({id:"wedo2.whenTilted",default:"when tilted [TILT_DIRECTION_ANY]",description:"check when tilted in a certain direction"}),func:"isTilted",blockType:g.HAT,arguments:{TILT_DIRECTION_ANY:{type:e.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:W}}},{opcode:"getDistance",text:Q({id:"wedo2.getDistance",default:"distance",description:"the value returned by the distance sensor"}),blockType:g.REPORTER},{opcode:"isTilted",text:Q({id:"wedo2.isTilted",default:"tilted [TILT_DIRECTION_ANY]?",description:"whether the tilt sensor is tilted"}),blockType:g.BOOLEAN,arguments:{TILT_DIRECTION_ANY:{type:e.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:W}}},{opcode:"getTiltAngle",text:Q({id:"wedo2.getTiltAngle",default:"tilt angle [TILT_DIRECTION]",description:"the angle returned by the tilt sensor"}),blockType:g.REPORTER,arguments:{TILT_DIRECTION:{type:e.STRING,menu:"TILT_DIRECTION",defaultValue:z}}}],menus:{MOTOR_ID:{acceptReporters:!0,items:[{text:Q({id:"wedo2.motorId.default",default:"motor",description:"label for motor element in motor menu for LEGO WeDo 2 extension"}),value:y},{text:Q({id:"wedo2.motorId.a",default:"motor A",description:"label for motor A element in motor menu for LEGO WeDo 2 extension"}),value:k},{text:Q({id:"wedo2.motorId.b",default:"motor B",description:"label for motor B element in motor menu for LEGO WeDo 2 extension"}),value:T},{text:Q({id:"wedo2.motorId.all",default:"all motors",description:"label for all motors element in motor menu for LEGO WeDo 2 extension"}),value:j}]},MOTOR_DIRECTION:{acceptReporters:!0,items:[{text:Q({id:"wedo2.motorDirection.forward",default:"this way",description:"label for forward element in motor direction menu for LEGO WeDo 2 extension"}),value:x},{text:Q({id:"wedo2.motorDirection.backward",default:"that way",description:"label for backward element in motor direction menu for LEGO WeDo 2 extension"}),value:S},{text:Q({id:"wedo2.motorDirection.reverse",default:"reverse",description:"label for reverse element in motor direction menu for LEGO WeDo 2 extension"}),value:b}]},TILT_DIRECTION:{acceptReporters:!0,items:[{text:Q({id:"wedo2.tiltDirection.up",default:"up",description:"label for up element in tilt direction menu for LEGO WeDo 2 extension"}),value:z},{text:Q({id:"wedo2.tiltDirection.down",default:"down",description:"label for down element in tilt direction menu for LEGO WeDo 2 extension"}),value:L},{text:Q({id:"wedo2.tiltDirection.left",default:"left",description:"label for left element in tilt direction menu for LEGO WeDo 2 extension"}),value:P},{text:Q({id:"wedo2.tiltDirection.right",default:"right",description:"label for right element in tilt direction menu for LEGO WeDo 2 extension"}),value:v}]},TILT_DIRECTION_ANY:{acceptReporters:!0,items:[{text:Q({id:"wedo2.tiltDirection.up",default:"up"}),value:z},{text:Q({id:"wedo2.tiltDirection.down",default:"down"}),value:L},{text:Q({id:"wedo2.tiltDirection.left",default:"left"}),value:P},{text:Q({id:"wedo2.tiltDirection.right",default:"right"}),value:v},{text:Q({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(A){let B=1e3*i.toNumber(A.DURATION);return B=c.clamp(B,0,15e3),new Promise(t=>{this._forEachMotor(A.MOTOR_ID,A=>{const t=this._peripheral.motor(A);t&&t.turnOnFor(B)}),setTimeout(t,B)})}motorOn(A){return this._forEachMotor(A.MOTOR_ID,A=>{const B=this._peripheral.motor(A);B&&B.turnOn()}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}motorOff(A){return this._forEachMotor(A.MOTOR_ID,A=>{const B=this._peripheral.motor(A);B&&B.turnOff()}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}startMotorPower(A){return this._forEachMotor(A.MOTOR_ID,B=>{const t=this._peripheral.motor(B);t&&(t.power=c.clamp(i.toNumber(A.POWER),0,100),t.turnOn())}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}setMotorDirection(A){return this._forEachMotor(A.MOTOR_ID,B=>{const t=this._peripheral.motor(B);if(t){switch(A.MOTOR_DIRECTION){case x:t.direction=1;break;case S:t.direction=-1;break;case b:t.direction=-t.direction;break;default:o.warn("Unknown motor direction in setMotorDirection: ".concat(A.DIRECTION))}t.isOn&&(t.pendingTimeoutDelay?t.turnOnFor(t.pendingTimeoutStartTime+t.pendingTimeoutDelay-Date.now()):t.turnOn())}}),new Promise(A=>{window.setTimeout(()=>{A()},100)})}setLightHue(A){let B=i.toNumber(A.HUE);B=c.wrapClamp(B,0,100);const t=360*B/100,e=s.hsvToRgb({h:t,s:1,v:1}),g=s.rgbToDecimal(e);return this._peripheral.setLED(g),new Promise(A=>{window.setTimeout(()=>{A()},100)})}playNoteFor(A){let B=1e3*i.toNumber(A.DURATION);B=c.clamp(B,0,3e3);const t=c.clamp(i.toNumber(A.NOTE),25,125);if(0!==B)return new Promise(A=>{const e=this._noteToTone(t);this._peripheral.playTone(e,B),setTimeout(A,B)})}whenDistance(A){switch(A.OP){case"<":return this._peripheral.distance":return this._peripheral.distance>i.toNumber(A.REFERENCE);default:return o.warn("Unknown comparison operator in whenDistance: ".concat(A.OP)),!1}}whenTilted(A){return this._isTilted(A.TILT_DIRECTION_ANY)}getDistance(){return this._peripheral.distance}isTilted(A){return this._isTilted(A.TILT_DIRECTION_ANY)}getTiltAngle(A){return this._getTiltAngle(A.TILT_DIRECTION)}_isTilted(A){switch(A){case W:return this._getTiltAngle(z)>=V.TILT_THRESHOLD||this._getTiltAngle(L)>=V.TILT_THRESHOLD||this._getTiltAngle(P)>=V.TILT_THRESHOLD||this._getTiltAngle(v)>=V.TILT_THRESHOLD;default:return this._getTiltAngle(A)>=V.TILT_THRESHOLD}}_getTiltAngle(A){switch(A){case z:return this._peripheral.tiltY>45?256-this._peripheral.tiltY:-this._peripheral.tiltY;case L:return this._peripheral.tiltY>45?this._peripheral.tiltY-256:this._peripheral.tiltY;case P:return this._peripheral.tiltX>45?256-this._peripheral.tiltX:-this._peripheral.tiltX;case v:return this._peripheral.tiltX>45?this._peripheral.tiltX-256:this._peripheral.tiltX;default:o.warn("Unknown tilt direction in _getTiltAngle: ".concat(A))}}_forEachMotor(A,B){let t;switch(A){case k:t=[0];break;case T:t=[1];break;case j:case y:t=[0,1];break;default:o.warn("Invalid motor ID: ".concat(A)),t=[]}for(const A of t)B(A)}_noteToTone(A){return 440*Math.pow(2,(A-69)/12)}}A.exports=V},function(A,B,t){(function(A,B){!function(t){"use strict";var e,g="function"==typeof(e=t.atob)?e:"function"==typeof A?function(B){ //!! Deliberately using an API that's deprecated in node.js because //!! this file is for browsers and we expect them to cope with it. //!! Discussion: github.com/node-browser-compat/atob/pull/9 -return new A(B,"base64").toString("binary")}:"object"==typeof t.base64js?function(A){var B=t.base64js.b64ToByteArray(A);return Array.prototype.map.call(B,(function(A){return String.fromCharCode(A)})).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.")};t.atob=g,B&&B.exports&&(B.exports=g)}(window)}).call(this,t(11).Buffer,t(131)(A))},function(A,B){A.exports=function(A){return A.webpackPolyfill||(A.deprecate=function(){},A.paths=[],A.children||(A.children=[]),Object.defineProperty(A,"loaded",{enumerable:!0,get:function(){return A.l}}),Object.defineProperty(A,"id",{enumerable:!0,get:function(){return A.i}}),A.webpackPolyfill=1),A}},function(A,B,t){(function(B){!function(){"use strict";A.exports=function(A){return(A instanceof B?A:B.from(A.toString(),"binary")).toString("base64")}}()}).call(this,t(11).Buffer)},function(A,B,t){const e=t(5),g=t(2),i=t(13),Q=t(1),s=t(4),n=t(3),r=t(15);let E={};try{E=t(134)}catch(A){}class c{constructor(A){this.runtime=A,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 A=[];this.DRUM_INFO.forEach((B,t)=>{const e="drums/".concat(B.fileName),g=this._storeSound(e,t,this._drumPlayers);A.push(g)}),this.INSTRUMENT_INFO.forEach((B,t)=>{this._instrumentPlayerArrays[t]=[],this._instrumentPlayerNoteArrays[t]=[],B.samples.forEach((e,g)=>{const i="instruments/".concat(B.dirName,"/").concat(e),Q=this._storeSound(i,g,this._instrumentPlayerArrays[t]);A.push(Q)})}),Promise.all(A).then(()=>{})}_storeSound(A,B,t){const e="".concat(A,".mp3");if(!E[e])return;const g=E[e];return fetch(g).then(A=>A.arrayBuffer()).then(A=>this._decodeSound(A)).then(A=>{t[B]=A})}_decodeSound(A){const B=this.runtime.audioEngine;return B?B.decodeSoundPlayer({data:{buffer:A}}):Promise.reject(new Error("No Audio Context Detected"))}_buildMenu(A){return A.map((A,B)=>{const t={};return t.text=A.name,t.value=String(B+1),t})}get DRUM_INFO(){return[{name:s({id:"music.drumSnare",default:"(1) Snare Drum",description:"Sound of snare drum as used in a standard drum kit"}),fileName:"1-snare"},{name:s({id:"music.drumBass",default:"(2) Bass Drum",description:"Sound of bass drum as used in a standard drum kit"}),fileName:"2-bass-drum"},{name:s({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:s({id:"music.drumCrashCymbal",default:"(4) Crash Cymbal",description:"Sound of a drum stick hitting a crash cymbal"}),fileName:"4-crash-cymbal"},{name:s({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:s({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:s({id:"music.drumTambourine",default:"(7) Tambourine",description:"Sound of a tambourine being struck"}),fileName:"7-tambourine"},{name:s({id:"music.drumHandClap",default:"(8) Hand Clap",description:"Sound of two hands clapping together"}),fileName:"8-hand-clap"},{name:s({id:"music.drumClaves",default:"(9) Claves",description:"Sound of claves being struck together"}),fileName:"9-claves"},{name:s({id:"music.drumWoodBlock",default:"(10) Wood Block",description:"Sound of a wood block being struck"}),fileName:"10-wood-block"},{name:s({id:"music.drumCowbell",default:"(11) Cowbell",description:"Sound of a cowbell being struck"}),fileName:"11-cowbell"},{name:s({id:"music.drumTriangle",default:"(12) Triangle",description:"Sound of a triangle (instrument) being struck"}),fileName:"12-triangle"},{name:s({id:"music.drumBongo",default:"(13) Bongo",description:"Sound of a bongo being struck"}),fileName:"13-bongo"},{name:s({id:"music.drumConga",default:"(14) Conga",description:"Sound of a conga being struck"}),fileName:"14-conga"},{name:s({id:"music.drumCabasa",default:"(15) Cabasa",description:"Sound of a cabasa being shaken"}),fileName:"15-cabasa"},{name:s({id:"music.drumGuiro",default:"(16) Guiro",description:"Sound of a guiro being played"}),fileName:"16-guiro"},{name:s({id:"music.drumVibraslap",default:"(17) Vibraslap",description:"Sound of a Vibraslap being played"}),fileName:"17-vibraslap"},{name:s({id:"music.drumCuica",default:"(18) Cuica",description:"Sound of a cuica being played"}),fileName:"18-cuica"}]}get INSTRUMENT_INFO(){return[{name:s({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:s({id:"music.instrumentElectricPiano",default:"(2) Electric Piano",description:"Sound of an electric piano"}),dirName:"2-electric-piano",releaseTime:.5,samples:[60]},{name:s({id:"music.instrumentOrgan",default:"(3) Organ",description:"Sound of an organ"}),dirName:"3-organ",releaseTime:.5,samples:[60]},{name:s({id:"music.instrumentGuitar",default:"(4) Guitar",description:"Sound of an accoustic guitar"}),dirName:"4-guitar",releaseTime:.5,samples:[60]},{name:s({id:"music.instrumentElectricGuitar",default:"(5) Electric Guitar",description:"Sound of an electric guitar"}),dirName:"5-electric-guitar",releaseTime:.5,samples:[60]},{name:s({id:"music.instrumentBass",default:"(6) Bass",description:"Sound of an accoustic upright bass"}),dirName:"6-bass",releaseTime:.25,samples:[36,48]},{name:s({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:s({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:s({id:"music.instrumentTrombone",default:"(9) Trombone",description:"Sound of a trombone being played"}),dirName:"9-trombone",samples:[36,48,60]},{name:s({id:"music.instrumentClarinet",default:"(10) Clarinet",description:"Sound of a clarinet being played"}),dirName:"10-clarinet",samples:[48,60]},{name:s({id:"music.instrumentSaxophone",default:"(11) Saxophone",description:"Sound of a saxophone being played"}),dirName:"11-saxophone",samples:[36,60,84]},{name:s({id:"music.instrumentFlute",default:"(12) Flute",description:"Sound of a flute being played"}),dirName:"12-flute",samples:[60,72]},{name:s({id:"music.instrumentWoodenFlute",default:"(13) Wooden Flute",description:"Sound of a wooden flute being played"}),dirName:"13-wooden-flute",samples:[60,72]},{name:s({id:"music.instrumentBassoon",default:"(14) Bassoon",description:"Sound of a bassoon being played"}),dirName:"14-bassoon",samples:[36,48,60]},{name:s({id:"music.instrumentChoir",default:"(15) Choir",description:"Sound of a choir singing"}),dirName:"15-choir",releaseTime:.25,samples:[48,60,72]},{name:s({id:"music.instrumentVibraphone",default:"(16) Vibraphone",description:"Sound of a vibraphone being struck"}),dirName:"16-vibraphone",releaseTime:.5,samples:[60,72]},{name:s({id:"music.instrumentMusicBox",default:"(17) Music Box",description:"Sound of a music box playing"}),dirName:"17-music-box",releaseTime:.25,samples:[60]},{name:s({id:"music.instrumentSteelDrum",default:"(18) Steel Drum",description:"Sound of a steel drum being struck"}),dirName:"18-steel-drum",releaseTime:.5,samples:[60]},{name:s({id:"music.instrumentMarimba",default:"(19) Marimba",description:"Sound of a marimba being struck"}),dirName:"19-marimba",samples:[60]},{name:s({id:"music.instrumentSynthLead",default:"(20) Synth Lead",description:'Sound of a "lead" synthesizer being played'}),dirName:"20-synth-lead",releaseTime:.1,samples:[60]},{name:s({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(A){let B=A.getCustomState(c.STATE_KEY);return B||(B=i.simple(c.DEFAULT_MUSIC_STATE),A.setCustomState(c.STATE_KEY,B)),B}_onTargetCreated(A,B){if(B){const t=B.getCustomState(c.STATE_KEY);t&&A.setCustomState(c.STATE_KEY,i.simple(t))}}getInfo(){return{id:"music",name:s({id:"music.categoryName",default:"Music",description:"Label for the Music extension category"}),menuIconURI:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjAiIGhlaWdodD0iMjAiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE2LjA5IDEyLjkzN2MuMjI4IDEuMTQxLS44MzMgMi4wNjMtMi4zNzMgMi4wNjMtMS41MzUgMC0yLjk2Mi0uOTIyLTMuMTg2LTIuMDYzLS4yMy0xLjE0Mi44MzMtMi4wNjggMi4zNzItMi4wNjguMzIzIDAgLjY0MS4wNDIuOTQ1LjExN2EzLjUgMy41IDAgMCAxIC40NjguMTUxYy40MzUtLjAxLS4wNTItMS4xNDctLjkxNy02LjExNC0xLjA2Ny02LjE1MiAxLjUzLS45MzUgNC4zODQtMS4zNzcgMi44NTQtLjQ0Mi4wMzggMi40MS0xLjgyNSAxLjkyMi0xLjg2Mi0uNDkzLTIuMzI1LTMuNTc3LjEzMiA3LjM3ek03LjQ2IDguNTYzYy0xLjg2Mi0uNDkzLTIuMzI1LTMuNTc2LjEzIDcuMzdDNy44MTYgMTcuMDczIDYuNzU0IDE4IDUuMjIgMThjLTEuNTM1IDAtMi45NjEtLjkyNi0zLjE5LTIuMDY4LS4yMjQtMS4xNDIuODM3LTIuMDY3IDIuMzc1LTIuMDY3LjUwMSAwIC45ODcuMDk4IDEuNDI3LjI3Mi40MTItLjAyOC0uMDc0LTEuMTg5LS45My02LjExNEMzLjgzNCAxLjg3IDYuNDMgNy4wODcgOS4yODIgNi42NDZjMi44NTQtLjQ0Ny4wMzggMi40MS0xLjgyMyAxLjkxN3oiIGZpbGw9IiM1NzVFNzUiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvc3ZnPg==",blockIconURI:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PHRpdGxlPm11c2ljLWJsb2NrLWljb248L3RpdGxlPjxkZWZzPjxwYXRoIGQ9Ik0zMi4xOCAyNS44NzRDMzIuNjM2IDI4LjE1NyAzMC41MTIgMzAgMjcuNDMzIDMwYy0zLjA3IDAtNS45MjMtMS44NDMtNi4zNzItNC4xMjYtLjQ1OC0yLjI4NSAxLjY2NS00LjEzNiA0Ljc0My00LjEzNi42NDcgMCAxLjI4My4wODQgMS44OS4yMzQuMzM4LjA4Ni42MzcuMTguOTM4LjMwMi44Ny0uMDItLjEwNC0yLjI5NC0xLjgzNS0xMi4yMy0yLjEzNC0xMi4zMDIgMy4wNi0xLjg3IDguNzY4LTIuNzUyIDUuNzA4LS44ODUuMDc2IDQuODItMy42NSAzLjg0NC0zLjcyNC0uOTg3LTQuNjUtNy4xNTMuMjYzIDE0LjczOHptLTE2Ljk5OCA1Ljk5QzE1LjYzIDM0LjE0OCAxMy41MDcgMzYgMTAuNDQgMzZjLTMuMDcgMC01LjkyMi0xLjg1Mi02LjM4LTQuMTM2LS40NDgtMi4yODQgMS42NzQtNC4xMzUgNC43NS00LjEzNSAxLjAwMyAwIDEuOTc1LjE5NiAyLjg1NS41NDMuODIyLS4wNTUtLjE1LTIuMzc3LTEuODYyLTEyLjIyOC0yLjEzMy0xMi4zMDMgMy4wNi0xLjg3IDguNzY0LTIuNzUzIDUuNzA2LS44OTQuMDc2IDQuODItMy42NDggMy44MzQtMy43MjQtLjk4Ny00LjY1LTcuMTUyLjI2MiAxNC43Mzh6IiBpZD0iYSIvPjwvZGVmcz48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjx1c2UgZmlsbD0iI0ZGRiIgeGxpbms6aHJlZj0iI2EiLz48cGF0aCBzdHJva2Utb3BhY2l0eT0iLjEiIHN0cm9rZT0iIzAwMCIgZD0iTTI4LjQ1NiAyMS42NzVjLS4wMS0uMzEyLS4wODctLjgyNS0uMjU2LTEuNzAyLS4wOTYtLjQ5NS0uNjEyLTMuMDIyLS43NTMtMy43My0uMzk1LTEuOTgtLjc2LTMuOTItMS4xNDItNi4xMTMtLjczMi00LjIyMy0uNjkzLTYuMDUuMzQ0LTYuNTI3LjUtLjIzIDEuMDYtLjA4IDEuODQuMzUuNDE0LjIyNyAyLjE4MiAxLjM2NSAyLjA3IDEuMjk2IDEuOTk0IDEuMjQyIDMuNDY0IDEuNzc0IDQuOTMgMS41NDggMS41MjYtLjIzNyAyLjUwNC0uMDYgMi44NzYuNjE4LjM0OC42MzUuMDE1IDEuNDE2LS43MyAyLjE4LTEuNDcyIDEuNTE2LTMuOTc1IDIuNTE0LTUuODQ4IDIuMDIzLS44MjItLjIyLTEuMjM4LS40NjUtMi4zOC0xLjI2N2wtLjA5NS0uMDY2Yy4wNDcuNTkzLjI2NCAxLjc0LjcxNyAzLjgwMy4yOTQgMS4zMzYgMi4wOCA5LjE4NyAyLjYzNyAxMS42NzRsLjAwMi4wMTJjLjUyOCAyLjYzNy0xLjg3MyA0LjcyNC01LjIzNiA0LjcyNC0zLjI5IDAtNi4zNjMtMS45ODgtNi44NjItNC41MjgtLjUzLTIuNjQgMS44NzMtNC43MzQgNS4yMzMtNC43MzQuNjcyIDAgMS4zNDcuMDg1IDIuMDE0LjI1LjIyNy4wNTcuNDM2LjExOC42MzYuMTg3em0tMTYuOTk2IDUuOTljLS4wMS0uMzE4LS4wOS0uODM4LS4yNjYtMS43MzctLjA5LS40Ni0uNTk1LTIuOTM3LS43NTMtMy43MjctLjM5LTEuOTYtLjc1LTMuODktMS4xMy02LjA3LS43MzItNC4yMjMtLjY5Mi02LjA1LjM0NC02LjUyNi41MDItLjIzIDEuMDYtLjA4MiAxLjg0LjM1LjQxNS4yMjcgMi4xODIgMS4zNjQgMi4wNyAxLjI5NSAxLjk5MyAxLjI0MiAzLjQ2MiAxLjc3NCA0LjkyNiAxLjU0OCAxLjUyNS0uMjQgMi41MDQtLjA2NCAyLjg3Ni42MTQuMzQ4LjYzNS4wMTUgMS40MTUtLjcyOCAyLjE4LTEuNDc0IDEuNTE3LTMuOTc3IDIuNTEzLTUuODQ3IDIuMDE3LS44Mi0uMjItMS4yMzYtLjQ2NC0yLjM3OC0xLjI2N2wtLjA5NS0uMDY1Yy4wNDcuNTkzLjI2NCAxLjc0LjcxNyAzLjgwMi4yOTQgMS4zMzcgMi4wNzggOS4xOSAyLjYzNiAxMS42NzVsLjAwMy4wMTNjLjUxNyAyLjYzOC0xLjg4NCA0LjczMi01LjIzNCA0LjczMi0zLjI4NyAwLTYuMzYtMS45OTMtNi44Ny00LjU0LS41Mi0yLjY0IDEuODg0LTQuNzMgNS4yNC00LjczLjkwNSAwIDEuODAzLjE1IDIuNjUuNDM2eiIvPjwvZz48L3N2Zz4=",blocks:[{opcode:"playDrumForBeats",blockType:g.COMMAND,text:s({id:"music.playDrumForBeats",default:"play drum [DRUM] for [BEATS] beats",description:"play drum sample for a number of beats"}),arguments:{DRUM:{type:e.NUMBER,menu:"DRUM",defaultValue:1},BEATS:{type:e.NUMBER,defaultValue:.25}}},{opcode:"midiPlayDrumForBeats",blockType:g.COMMAND,text:s({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:e.NUMBER,menu:"DRUM",defaultValue:1},BEATS:{type:e.NUMBER,defaultValue:.25}},hideFromPalette:!0},{opcode:"restForBeats",blockType:g.COMMAND,text:s({id:"music.restForBeats",default:"rest for [BEATS] beats",description:"rest (play no sound) for a number of beats"}),arguments:{BEATS:{type:e.NUMBER,defaultValue:.25}}},{opcode:"playNoteForBeats",blockType:g.COMMAND,text:s({id:"music.playNoteForBeats",default:"play note [NOTE] for [BEATS] beats",description:"play a note for a number of beats"}),arguments:{NOTE:{type:e.NOTE,defaultValue:60},BEATS:{type:e.NUMBER,defaultValue:.25}}},{opcode:"setInstrument",blockType:g.COMMAND,text:s({id:"music.setInstrument",default:"set instrument to [INSTRUMENT]",description:"set the instrument (e.g. piano, guitar, trombone) for notes played"}),arguments:{INSTRUMENT:{type:e.NUMBER,menu:"INSTRUMENT",defaultValue:1}}},{opcode:"midiSetInstrument",blockType:g.COMMAND,text:s({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:e.NUMBER,defaultValue:1}},hideFromPalette:!0},{opcode:"setTempo",blockType:g.COMMAND,text:s({id:"music.setTempo",default:"set tempo to [TEMPO]",description:"set tempo (speed) for notes, drums, and rests played"}),arguments:{TEMPO:{type:e.NUMBER,defaultValue:60}}},{opcode:"changeTempo",blockType:g.COMMAND,text:s({id:"music.changeTempo",default:"change tempo by [TEMPO]",description:"change tempo (speed) for notes, drums, and rests played"}),arguments:{TEMPO:{type:e.NUMBER,defaultValue:20}}},{opcode:"getTempo",text:s({id:"music.getTempo",default:"tempo",description:"get the current tempo (speed) for notes, drums, and rests played"}),blockType:g.REPORTER}],menus:{DRUM:{acceptReporters:!0,items:this._buildMenu(this.DRUM_INFO)},INSTRUMENT:{acceptReporters:!0,items:this._buildMenu(this.INSTRUMENT_INFO)}}}}playDrumForBeats(A,B){this._playDrumForBeats(A.DRUM,A.BEATS,B)}midiPlayDrumForBeats(A,B){let t=Q.toNumber(A.DRUM);t=Math.round(t);const e=this.MIDI_DRUMS[t-35];t=e?e[0]:2,t+=1,this._playDrumForBeats(t,A.BEATS,B)}_playDrumForBeats(A,B,t){this._stackTimerNeedsInit(t)?(A=Q.toNumber(A),A=Math.round(A),A-=1,A=n.wrapClamp(A,0,this.DRUM_INFO.length-1),B=Q.toNumber(B),B=this._clampBeats(B),this._playDrumNum(t,A),this._startStackTimer(t,this._beatsToSec(B))):this._checkStackTimer(t)}_playDrumNum(A,B){if(null===A.runtime.audioEngine)return;if(null===A.target.sprite.soundBank)return;if(this._concurrencyCounter>c.CONCURRENCY_LIMIT)return;const t=this._drumPlayers[B];if(void 0===t)return;t.isPlaying&&!t.isStarting&&t.take();const e=A.runtime.audioEngine,g=e.audioContext.createGain();g.gain.setValueAtTime(A.target.volume/100,e.currentTime),g.connect(e.getInputNode()),this._concurrencyCounter++,t.once("stop",()=>{this._concurrencyCounter--}),t.play(),t.connect({getInputNode:()=>g})}restForBeats(A,B){if(this._stackTimerNeedsInit(B)){let t=Q.toNumber(A.BEATS);t=this._clampBeats(t),this._startStackTimer(B,this._beatsToSec(t))}else this._checkStackTimer(B)}playNoteForBeats(A,B){if(this._stackTimerNeedsInit(B)){let t=Q.toNumber(A.NOTE);t=n.clamp(t,c.MIDI_NOTE_RANGE.min,c.MIDI_NOTE_RANGE.max);let e=Q.toNumber(A.BEATS);if(e=this._clampBeats(e),0===e)return;const g=this._beatsToSec(e);this._playNote(B,t,g),this._startStackTimer(B,g)}else this._checkStackTimer(B)}_playNoteForPicker(A,B){if(B!==this.getInfo().name)return;const t={runtime:this.runtime,target:this.runtime.getEditingTarget()};this._playNote(t,A,.25)}_playNote(A,B,t){if(null===A.runtime.audioEngine)return;if(null===A.target.sprite.soundBank)return;if(this._concurrencyCounter>c.CONCURRENCY_LIMIT)return;const e=this._getMusicState(A.target).currentInstrument,g=this.INSTRUMENT_INFO[e].samples,i=this._selectSampleIndexForNote(B,g);if(void 0===this._instrumentPlayerArrays[e])return;if(void 0===this._instrumentPlayerArrays[e][i])return;const Q=A.runtime.audioEngine;this._instrumentPlayerNoteArrays[e][B]||(this._instrumentPlayerNoteArrays[e][B]=this._instrumentPlayerArrays[e][i].take());const s=this._instrumentPlayerNoteArrays[e][B];s.isPlaying&&!s.isStarting&&s.take();const n=g[i],r=this._ratioForPitchInterval(B-n),E=Q.audioContext,o=E.createGain();o.gain.setValueAtTime(A.target.volume/100,Q.currentTime);const w=E.createGain();o.connect(w),w.connect(Q.getInputNode());let C=this.INSTRUMENT_INFO[e].releaseTime;void 0===C&&(C=.01);const a=E.currentTime+t,I=a+C;w.gain.setValueAtTime(1,a),w.gain.linearRampToValueAtTime(1e-4,I),this._concurrencyCounter++,s.once("stop",()=>{this._concurrencyCounter--}),s.play(),s.connect({getInputNode:()=>o}),s.outputNode.playbackRate.value=r,s.outputNode.stop(I)}_selectSampleIndexForNote(A,B){for(let t=B.length-1;t>=0;t--)if(A>=B[t])return t;return 0}_ratioForPitchInterval(A){return Math.pow(2,A/12)}_clampBeats(A){return n.clamp(A,c.BEAT_RANGE.min,c.BEAT_RANGE.max)}_beatsToSec(A){return 60/this.getTempo()*A}_stackTimerNeedsInit(A){return!A.stackFrame.timer}_startStackTimer(A,B){A.stackFrame.timer=new r,A.stackFrame.timer.start(),A.stackFrame.duration=B,A.yield()}_checkStackTimer(A){A.stackFrame.timer.timeElapsed()<1e3*A.stackFrame.duration&&A.yield()}setInstrument(A,B){this._setInstrument(A.INSTRUMENT,B,!1)}midiSetInstrument(A,B){this._setInstrument(A.INSTRUMENT,B,!0)}_setInstrument(A,B,t){const e=this._getMusicState(B.target);A=Q.toNumber(A),A=Math.round(A),A-=1,t&&(A=(this.MIDI_INSTRUMENTS[A]||0)-1),A=n.wrapClamp(A,0,this.INSTRUMENT_INFO.length-1),e.currentInstrument=A}setTempo(A){const B=Q.toNumber(A.TEMPO);this._updateTempo(B)}changeTempo(A){const B=Q.toNumber(A.TEMPO)+this.getTempo();this._updateTempo(B)}_updateTempo(A){A=n.clamp(A,c.TEMPO_RANGE.min,c.TEMPO_RANGE.max);const B=this.runtime.getTargetForStage();B&&(B.tempo=A)}getTempo(){const A=this.runtime.getTargetForStage();return A?A.tempo:60}}A.exports=c},function(A,B,t){A.exports={"drums/1-snare.mp3":t(135),"drums/2-bass-drum.mp3":t(136),"drums/3-side-stick.mp3":t(137),"drums/4-crash-cymbal.mp3":t(138),"drums/5-open-hi-hat.mp3":t(139),"drums/6-closed-hi-hat.mp3":t(140),"drums/7-tambourine.mp3":t(141),"drums/8-hand-clap.mp3":t(142),"drums/9-claves.mp3":t(143),"drums/10-wood-block.mp3":t(144),"drums/11-cowbell.mp3":t(145),"drums/12-triangle.mp3":t(146),"drums/13-bongo.mp3":t(147),"drums/14-conga.mp3":t(148),"drums/15-cabasa.mp3":t(149),"drums/16-guiro.mp3":t(150),"drums/17-vibraslap.mp3":t(151),"drums/18-cuica.mp3":t(152),"instruments/1-piano/24.mp3":t(153),"instruments/1-piano/36.mp3":t(154),"instruments/1-piano/48.mp3":t(155),"instruments/1-piano/60.mp3":t(156),"instruments/1-piano/72.mp3":t(157),"instruments/1-piano/84.mp3":t(158),"instruments/1-piano/96.mp3":t(159),"instruments/1-piano/108.mp3":t(160),"instruments/2-electric-piano/60.mp3":t(161),"instruments/3-organ/60.mp3":t(162),"instruments/4-guitar/60.mp3":t(163),"instruments/5-electric-guitar/60.mp3":t(164),"instruments/6-bass/36.mp3":t(165),"instruments/6-bass/48.mp3":t(166),"instruments/7-pizzicato/60.mp3":t(167),"instruments/8-cello/36.mp3":t(168),"instruments/8-cello/48.mp3":t(169),"instruments/8-cello/60.mp3":t(170),"instruments/9-trombone/36.mp3":t(171),"instruments/9-trombone/48.mp3":t(172),"instruments/9-trombone/60.mp3":t(173),"instruments/10-clarinet/48.mp3":t(174),"instruments/10-clarinet/60.mp3":t(175),"instruments/11-saxophone/36.mp3":t(176),"instruments/11-saxophone/60.mp3":t(177),"instruments/11-saxophone/84.mp3":t(178),"instruments/12-flute/60.mp3":t(179),"instruments/12-flute/72.mp3":t(180),"instruments/13-wooden-flute/60.mp3":t(181),"instruments/13-wooden-flute/72.mp3":t(182),"instruments/14-bassoon/36.mp3":t(183),"instruments/14-bassoon/48.mp3":t(184),"instruments/14-bassoon/60.mp3":t(185),"instruments/15-choir/48.mp3":t(186),"instruments/15-choir/60.mp3":t(187),"instruments/15-choir/72.mp3":t(188),"instruments/16-vibraphone/60.mp3":t(189),"instruments/16-vibraphone/72.mp3":t(190),"instruments/17-music-box/60.mp3":t(191),"instruments/18-steel-drum/60.mp3":t(192),"instruments/19-marimba/60.mp3":t(193),"instruments/20-synth-lead/60.mp3":t(194),"instruments/21-synth-pad/60.mp3":t(195)}},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B){A.exports=null},function(A,B,t){const e=t(5),g=t(2),i=t(0),Q=t(1),s=t(4),n=t(28),r=t(23),E=129,c=130,o=61445,w="5261da01-fa7e-42ab-850b-7c80220097cc",C="5261da02-fa7e-42ab-850b-7c80220097cc";class a{constructor(A,B){this._runtime=A,this._ble=null,this._runtime.registerPeripheralExtension(B,this),this._extensionId=B,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(A){const B=new Uint8Array(A.length);for(let t=0;t{this._busy=!1},5e3);const t=new Uint8Array(B.length+1);t[0]=A;for(let A=0;A{this._busy=!1,window.clearTimeout(this._busyTimeoutID)})}_onConnect(){this._ble.read(o,w,!0,this._onMessage),this._timeoutID=window.setTimeout(()=>this._ble.handleDisconnectError("micro:bit extension stopped receiving data"),4500)}_onMessage(A){const B=r.base64ToUint8Array(A);this._sensors.tiltX=B[1]|B[0]<<8,this._sensors.tiltX>32768&&(this._sensors.tiltX-=65536),this._sensors.tiltY=B[3]|B[2]<<8,this._sensors.tiltY>32768&&(this._sensors.tiltY-=65536),this._sensors.buttonA=B[4],this._sensors.buttonB=B[5],this._sensors.touchPins[0]=B[6],this._sensors.touchPins[1]=B[7],this._sensors.touchPins[2]=B[8],this._sensors.gestureState=B[9],window.clearTimeout(this._timeoutID),this._timeoutID=window.setTimeout(()=>this._ble.handleDisconnectError("micro:bit extension stopped receiving data"),4500)}_checkPinState(A){return this._sensors.touchPins[A]}}const I="front",Y="back",h="left",M="right",F="any",D="moved",u="shaken",l="jumped",d="A",U="B",N="any",m="on",G="off";class f{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:d},{text:"B",value:U},{text:s({id:"microbit.buttonsMenu.any",default:"any",description:'label for "any" element in button picker for micro:bit extension'}),value:N}]}get GESTURES_MENU(){return[{text:s({id:"microbit.gesturesMenu.moved",default:"moved",description:"label for moved gesture in gesture picker for micro:bit extension"}),value:D},{text:s({id:"microbit.gesturesMenu.shaken",default:"shaken",description:"label for shaken gesture in gesture picker for micro:bit extension"}),value:u},{text:s({id:"microbit.gesturesMenu.jumped",default:"jumped",description:"label for jumped gesture in gesture picker for micro:bit extension"}),value:l}]}get PIN_STATE_MENU(){return[{text:s({id:"microbit.pinStateMenu.on",default:"on",description:"label for on element in pin state picker for micro:bit extension"}),value:m},{text:s({id:"microbit.pinStateMenu.off",default:"off",description:"label for off element in pin state picker for micro:bit extension"}),value:G}]}get TILT_DIRECTION_MENU(){return[{text:s({id:"microbit.tiltDirectionMenu.front",default:"front",description:"label for front element in tilt direction picker for micro:bit extension"}),value:I},{text:s({id:"microbit.tiltDirectionMenu.back",default:"back",description:"label for back element in tilt direction picker for micro:bit extension"}),value:Y},{text:s({id:"microbit.tiltDirectionMenu.left",default:"left",description:"label for left element in tilt direction picker for micro:bit extension"}),value:h},{text:s({id:"microbit.tiltDirectionMenu.right",default:"right",description:"label for right element in tilt direction picker for micro:bit extension"}),value:M}]}get TILT_DIRECTION_ANY_MENU(){return[...this.TILT_DIRECTION_MENU,{text:s({id:"microbit.tiltDirectionMenu.any",default:"any",description:"label for any direction element in tilt direction picker for micro:bit extension"}),value:F}]}constructor(A){this.runtime=A,this._peripheral=new a(this.runtime,f.EXTENSION_ID)}getInfo(){return{id:f.EXTENSION_ID,name:f.EXTENSION_NAME,blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAKcElEQVR42u2cfXAU9RnHv7u3L3d7l9yR5PIGXO7MkQKaYiCUWqJhFGvRMk4JZXSc8aXVaSmiYlthVHQEW99FxiIdrVY6teiMdoa+ICqhIqgQAsjwMgYDOQKXl7uY17u9293b3f5x5JKYe8+FJGSfvzbP/n77e/azz+95nt9v90KoqgpN0hdSQ6AB1ABqADWAmmgANYAaQA2gJhpADeBEE2q8GPLaWzu/CslyiY4k9dOn5uijtXGd7+jWkaReVpT3Hrhv6d0awEFC07rgD+ZeYYnXprhwigUAvjj0zbjxQCLebozT7iDzK1ZUWCru2K7L//6MVC8ue45Blz8n6rlQ815QtuohOlXiEdy/AUqPa6y59Mkh6Q1345GNja6m7pHEQKNl3t0704EXat4L6fSOmOeEI1vHKzwAyNJR9MPFpRUPOu0ONm2A0xatWaTLm5WfDrzvAppA8AbiG03fC8CQNkDKZK2YrPAuRrhpifJERsuYywveJc7CqcIDMAyeLm82dEXzw39I/qjXkpr3QuW9lxfAdOABGAKPslWDnbsy7Jl8BxTeM3SqmO0gaA5U6c3jymup0YSn9JyLee67wpTfBQAQjmyF3HFqiJcRtDECjy5dAmbmcgQPvjjxl3Lx4IVjnD/5cE1zkWtyP34VBGcdKLJnLgc9cznk1kMXFdzEn8KJ4KUqqsSHvcxWDf7j1UM8UPr6/YgHhhX8xAaYaXgAIB7fBnbuSrBzV8aNgarEQ/z6/YkLcDTg9V9XlXjQtuqoU1TpcUHlvZDOfDiuyh5qPMCLrJ1bDw3EuUtx81N/BH3pjQBJQ2HMF5V6iKfeRchVm9kkMtrwxmSdobeA9daBde8GwVlBcFYofS1Jw0vaAy9HeJHQwBUPzIBvGxDc92Rmp/BowJs10wkAONfsBs8HAAAltqngOAO8HZ3o6OiMqcvLy4E1Lwc8H8C5ZndMXdLJa/qNacNLCDBw/O8nFUNWxp/64+tWAwBefe1tHKg7CgC4/9d3ori4EHv3HcDrb26PqVt2602ovvaHaGlpw+8ffSamLqXYmya8jG8mpFy6iGLkWLh4HAwG4+r6j4VBfaPpLgU8IMGO9MLqW2pYQ9aQokuR5dgXIwCC1CUcNMj3hpdvLAdSF54EYpCHooRA0Swomo2pC0kCQpIAkqTA6LmYupgxL0X7m78+aG10NXVkpIwxsAwWXncDCESHLkohfPbpbiT6ZFPPZQ9fC0e58Wi6wTDj6UbT/rQAyiERS2pW4Kc3LQDLRO8miCEAKj7d83FcTxyLJJJJ+9MCqKoq9HomMrgkSThxsgEcZ8AMpwMkSYJlKDA0DVUFiHGWRDJp/4jXwqIo4uFHnkZXdw8AYGbZFXhs3WqQJDkhkkim7E8KoMlkxKbnn8DBunrwUli3e8/+yOAA0HjmHDq7upGXm5PUoDUr7hmWRB5Zt3FYwoime+vtd/H6G9uGJIxouniSyP6H7v8FystnY80jGzIA0MihsMAKu20aTp3JzFb6WCWRuDUvHwByw8cOhw2FBVaYjNzIAba1e3Hfb9aiq7MTNStuBwAsvr4KO3d9GnmKztIS5EyxTJiVSDT7p04tipx/9MnnYc7ORlu7NzMxsK3di5AkDHgGw2DTC+uHBeGJshJJZL/fxyMQEDKbRAiCQDAoQhBDYBkKNE2j4uqrhpUBoiSBIMZfEhkN+1NeiWSqEB2rlUg69md0JRIQRHy86z8jXsqNVRLJlP0jqgNJXXgAgjbCcONmCHUvQ+44NWG2s/rtH5Mt/ciToo0wLH4JBGO6LLazRiJk2vBYy4gHHw/bWSN+LZBKEhkMjzn/CaSiKgQOvJDyFB7L7axUJWNJZDA8IhQA1boPin7KZbMSGfUYyFx9b3hXg/cCsoBA2Z0AoYOaxlcC4+mdyCUDKBzanLFBJ3USyaRMuiSSKZmUSSSTMimTCABUlblRU9kAZ0E39p+eii21c+EL0jHbOwu6sfaWgyjND//U4oP6MmzZnfi79XT7mfQSNi7bh0JzOLG19XBY/89r49pYVebGqhuOosDsh1+gsWV3BXYdd2Q+BlaVuXFv9bHgkSbzk+vfcVRyjHhi47J9cftsXLYf7T36Ix8cLHlo6ydlv6qpPI2qssRZcuOy/Wjp4k5s+2zG+offKqtcUt6kJtNv7S0H0RtkvEufXTB/6bML5je2Wy7UVDbEbF9o9mPDsv2oP5v75vbPS26rP5u3fdXiozDppcwDrKlswOlWy9E//DX09Mt/azh8zzNM1RybF86C7pheVGD240CDeX3NWtfml94Rt+0+Mf3Lm8qbEnpfgdmPs+3G9+564vTT//pM/GrHYduWRP0AYOEMN/5S61xT92Vtfd2XtfWb/vu91fHALyxzw9tnkB/cTD5w+2Ou9375HHtfa7exM5mxRpKFaafdQQKgAcDERs98/foLHrXdaXfoABi8vczhWO2/28/TRR5z2h00gKymNl1ton79oigq6bQ7dE67Q+ew9mb1h4FYYwVESgLAXLSRa+3mWpIdK+UYuPiq89f8+XfT/+ftZQ4vLm9ZmUyfdcsv1M2fWfRaUCK8i8vdK1u6ktuAWPWTsztm24o/cnnYHUsrWzd1+fVJ9XtqxbG3XzFdNcPTawjcueibpxK1t+X26f/9R8a953jub4typOvm2b1XnvUmv8JKWMZcaZffX3XDERRP8cGaFRjWxtPLoZvXY4oxgPBNEsgxBhCUKEzL6Ru+JydS8Ak0giKFgESDJFQoKmCgQzAwIfQEWETzmoBIwd2VNaStu8uEHGO4Buz06zHHFv0dRkefAZ1+PQx0KNK2eIoPLCUj2zDc275qzgcBFWv+cf3IyxgTK2KOzQufEM5kfpGF12eGPSf8DXN+No/87HDWiwYYALw+M6ym8AscAxO++X7xCTRM7EDQzht0Da8v/NWo1dQDAxNCocUXs+303IGHdaptOmYXnh/SLlZbV+fwnwJm6UXEm/ojqgM/PFmJQ81OPHfrtqT7bN23BE8seTflYLvz5DwYGQHLKz5Puo/XZ8aLtT+D1dSDuxbsGQIymmz48DbwIguOESJOcce8XaO3oVpZ8k3Em5KVVAAMFnuOB9as1MbimCBunn04vBmR40ls29Wfgxf1KMn1gBdY+MXUCvK4ANvPndpLzrLzALjBN2VPwrDBksgLYkn1jBMp90nVY2++8vAw3RlPeLNYVZSPAEgjKWP6ZCn4lF+gMdnE08spQb73RQB9aXtgo6tJcNodf8rWz3L//Br340UW3sExEkXrFFKSSUVHqkRfkJZ8QSZk5gS6hw9H+GyDQAclSs41BVmSUIn+toAKIUTJskKoQUknCxKlkISKb/sM0NMyyVAhXW+AlYosfgOgQlUJVadTSUWBKoQoudvPioPbenq5oIUTaRUqenhWKi3oyVIUqKpKREoLggDhF6hQb4CV9LRM9rctMPN6glChp2SdTqeSskwoAECSKnG61fzFR/XsGu+FhmONriYl7TImsjoYKJyZSeB8CoBQo6spqU8TCO1fgE7gDVUNoCYaQA2gBlADqAHURAOoAdQAagA10QCOgfwfNp/hXbfBMCAAAAAASUVORK5CYII=",showStatusButton:!0,blocks:[{opcode:"whenButtonPressed",text:s({id:"microbit.whenButtonPressed",default:"when [BTN] button pressed",description:"when the selected button on the micro:bit is pressed"}),blockType:g.HAT,arguments:{BTN:{type:e.STRING,menu:"buttons",defaultValue:d}}},{opcode:"isButtonPressed",text:s({id:"microbit.isButtonPressed",default:"[BTN] button pressed?",description:"is the selected button on the micro:bit pressed?"}),blockType:g.BOOLEAN,arguments:{BTN:{type:e.STRING,menu:"buttons",defaultValue:d}}},"---",{opcode:"whenGesture",text:s({id:"microbit.whenGesture",default:"when [GESTURE]",description:"when the selected gesture is detected by the micro:bit"}),blockType:g.HAT,arguments:{GESTURE:{type:e.STRING,menu:"gestures",defaultValue:D}}},"---",{opcode:"displaySymbol",text:s({id:"microbit.displaySymbol",default:"display [MATRIX]",description:"display a pattern on the micro:bit display"}),blockType:g.COMMAND,arguments:{MATRIX:{type:e.MATRIX,defaultValue:"0101010101100010101000100"}}},{opcode:"displayText",text:s({id:"microbit.displayText",default:"display text [TEXT]",description:"display text on the micro:bit display"}),blockType:g.COMMAND,arguments:{TEXT:{type:e.STRING,defaultValue:s({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:s({id:"microbit.clearDisplay",default:"clear display",description:"display nothing on the micro:bit display"}),blockType:g.COMMAND},"---",{opcode:"whenTilted",text:s({id:"microbit.whenTilted",default:"when tilted [DIRECTION]",description:"when the micro:bit is tilted in a direction"}),blockType:g.HAT,arguments:{DIRECTION:{type:e.STRING,menu:"tiltDirectionAny",defaultValue:F}}},{opcode:"isTilted",text:s({id:"microbit.isTilted",default:"tilted [DIRECTION]?",description:"is the micro:bit is tilted in a direction?"}),blockType:g.BOOLEAN,arguments:{DIRECTION:{type:e.STRING,menu:"tiltDirectionAny",defaultValue:F}}},{opcode:"getTiltAngle",text:s({id:"microbit.tiltAngle",default:"tilt angle [DIRECTION]",description:"how much the micro:bit is tilted in a direction"}),blockType:g.REPORTER,arguments:{DIRECTION:{type:e.STRING,menu:"tiltDirection",defaultValue:I}}},"---",{opcode:"whenPinConnected",text:s({id:"microbit.whenPinConnected",default:"when pin [PIN] connected",description:"when the pin detects a connection to Earth/Ground"}),blockType:g.HAT,arguments:{PIN:{type:e.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(A){return"any"===A.BTN?this._peripheral.buttonA|this._peripheral.buttonB:"A"===A.BTN?this._peripheral.buttonA:"B"===A.BTN&&this._peripheral.buttonB}isButtonPressed(A){return"any"===A.BTN?0!=(this._peripheral.buttonA|this._peripheral.buttonB):"A"===A.BTN?0!==this._peripheral.buttonA:"B"===A.BTN&&0!==this._peripheral.buttonB}whenGesture(A){const B=Q.toString(A.GESTURE);return"moved"===B?this._peripheral.gestureState>>2&1:"shaken"===B?1&this._peripheral.gestureState:"jumped"===B&&this._peripheral.gestureState>>1&1}displaySymbol(A){const B=Q.toString(A.MATRIX).replace(/\s/g,"").split("").reduce((A,B,t)=>"0"===B?A:A+Math.pow(2,t),0);return null!==B&&(this._peripheral.ledMatrixState[0]=31&B,this._peripheral.ledMatrixState[1]=B>>5&31,this._peripheral.ledMatrixState[2]=B>>10&31,this._peripheral.ledMatrixState[3]=B>>15&31,this._peripheral.ledMatrixState[4]=B>>20&31,this._peripheral.displayMatrix(this._peripheral.ledMatrixState)),new Promise(A=>{setTimeout(()=>{A()},100)})}displayText(A){const B=String(A.TEXT).substring(0,19);B.length>0&&this._peripheral.displayText(B);const t=120*(6*B.length+6);return new Promise(A=>{setTimeout(()=>{A()},t)})}displayClear(){for(let A=0;A<5;A++)this._peripheral.ledMatrixState[A]=0;return this._peripheral.displayMatrix(this._peripheral.ledMatrixState),new Promise(A=>{setTimeout(()=>{A()},100)})}whenTilted(A){return this._isTilted(A.DIRECTION)}isTilted(A){return this._isTilted(A.DIRECTION)}getTiltAngle(A){return this._getTiltAngle(A.DIRECTION)}_isTilted(A){switch(A){case F:return Math.abs(this._peripheral.tiltX/10)>=f.TILT_THRESHOLD||Math.abs(this._peripheral.tiltY/10)>=f.TILT_THRESHOLD;default:return this._getTiltAngle(A)>=f.TILT_THRESHOLD}}_getTiltAngle(A){switch(A){case I:return Math.round(this._peripheral.tiltY/-10);case Y:return Math.round(this._peripheral.tiltY/10);case h:return Math.round(this._peripheral.tiltX/-10);case M:return Math.round(this._peripheral.tiltX/10);default:i.warn("Unknown tilt direction in _getTiltAngle: ".concat(A))}}whenPinConnected(A){const B=parseInt(A.PIN,10);if(!isNaN(B))return!(B<0||B>2)&&this._peripheral._checkPinState(B)}}A.exports=f},function(A,B,t){const e=t(4),g=t(67),i=t(5),Q=t(2),s=t(1),n=t(3),r=t(13),E=t(0),c=t(68);class o{constructor(A){this.runtime=A,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&&A.on("targetWasCreated",this._onTargetCreated),this._supportedLocales=this._getSupportedLocales()}get VOICE_INFO(){return{ALTO:{name:e({id:"text2speech.alto",default:"alto",description:"Name for a voice with ambiguous gender."}),gender:"female",playbackRate:1},TENOR:{name:e({id:"text2speech.tenor",default:"tenor",description:"Name for a voice with ambiguous gender."}),gender:"male",playbackRate:1},SQUEAK:{name:e({id:"text2speech.squeak",default:"squeak",description:"Name for a funny voice with a high pitch."}),gender:"female",playbackRate:1.19},GIANT:{name:e({id:"text2speech.giant",default:"giant",description:"Name for a funny voice with a low pitch."}),gender:"male",playbackRate:.84},KITTEN:{name:e({id:"text2speech.kitten",default:"kitten",description:"A baby cat."}),gender:"female",playbackRate:1.41}}}get LANGUAGE_INFO(){return{ar:{name:"Arabic",locales:["ar"],speechSynthLocale:"arb",singleGender:!0},"zh-cn":{name:"Chinese (Mandarin)",locales:["zh-cn","zh-tw"],speechSynthLocale:"cmn-CN",singleGender:!0},da:{name:"Danish",locales:["da"],speechSynthLocale:"da-DK"},nl:{name:"Dutch",locales:["nl"],speechSynthLocale:"nl-NL"},en:{name:"English",locales:["en"],speechSynthLocale:"en-US"},fr:{name:"French",locales:["fr"],speechSynthLocale:"fr-FR"},de:{name:"German",locales:["de"],speechSynthLocale:"de-DE"},hi:{name:"Hindi",locales:["hi"],speechSynthLocale:"hi-IN",singleGender:!0},is:{name:"Icelandic",locales:["is"],speechSynthLocale:"is-IS"},it:{name:"Italian",locales:["it"],speechSynthLocale:"it-IT"},ja:{name:"Japanese",locales:["ja","ja-hira"],speechSynthLocale:"ja-JP"},ko:{name:"Korean",locales:["ko"],speechSynthLocale:"ko-KR",singleGender:!0},nb:{name:"Norwegian",locales:["nb","nn"],speechSynthLocale:"nb-NO",singleGender:!0},pl:{name:"Polish",locales:["pl"],speechSynthLocale:"pl-PL"},"pt-br":{name:"Portuguese (Brazilian)",locales:["pt-br"],speechSynthLocale:"pt-BR"},pt:{name:"Portuguese (European)",locales:["pt"],speechSynthLocale:"pt-PT"},ro:{name:"Romanian",locales:["ro"],speechSynthLocale:"ro-RO",singleGender:!0},ru:{name:"Russian",locales:["ru"],speechSynthLocale:"ru-RU"},es:{name:"Spanish (European)",locales:["es"],speechSynthLocale:"es-ES"},"es-419":{name:"Spanish (Latin American)",locales:["es-419"],speechSynthLocale:"es-US"},sv:{name:"Swedish",locales:["sv"],speechSynthLocale:"sv-SE",singleGender:!0},tr:{name:"Turkish",locales:["tr"],speechSynthLocale:"tr-TR",singleGender:!0},cy:{name:"Welsh",locales:["cy"],speechSynthLocale:"cy-GB",singleGender:!0}}}static get STATE_KEY(){return"Scratch.text2speech"}static get DEFAULT_TEXT2SPEECH_STATE(){return{voiceId:"ALTO"}}get DEFAULT_LANGUAGE(){return"en"}_getState(A){let B=A.getCustomState(o.STATE_KEY);return B||(B=r.simple(o.DEFAULT_TEXT2SPEECH_STATE),A.setCustomState(o.STATE_KEY,B)),B}_onTargetCreated(A,B){if(B){const t=B.getCustomState(o.STATE_KEY);t&&A.setCustomState(o.STATE_KEY,r.simple(t))}}getInfo(){let A="hello";return this.isSupportedLanguage(this.getEditorLanguage())&&(A=e({id:"text2speech.defaultTextToSpeak",default:"hello",description:"hello: the default text to speak"})),{id:"text2speech",name:e({id:"text2speech.categoryName",default:"Text to Speech",description:"Name of the Text to Speech extension."}),blockIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1RleHQtdG8tU3BlZWNoLUJsb2NrPC90aXRsZT4KICAgIDxkZXNjPkNyZWF0ZWQgd2l0aCBTa2V0Y2guPC9kZXNjPgogICAgPGcgaWQ9IkV4dGVuc2lvbnMvU29mdHdhcmUvVGV4dC10by1TcGVlY2gtQmxvY2siIHN0cm9rZT0ibm9uZSIgc3Ryb2tlLXdpZHRoPSIxIiBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIHN0cm9rZS1vcGFjaXR5PSIwLjE1Ij4KICAgICAgICA8ZyBpZD0idGV4dDJzcGVlY2giIHRyYW5zZm9ybT0idHJhbnNsYXRlKDQuMDAwMDAwLCA0LjAwMDAwMCkiIGZpbGwtcnVsZT0ibm9uemVybyIgc3Ryb2tlPSIjMDAwMDAwIj4KICAgICAgICAgICAgPHBhdGggZD0iTTExLjUsMTcuNjY5MzQzNSBDMTEuNSwxNi42NTM5MjY5IDEwLjAwNjAxNDUsMTYuMDg0NDI3NCA5LjExMjU2MDI0LDE2Ljg4ODMgTDYuNDEyNTYwMjQsMTkuMDUwNzE0IEM1LjM5MzQ2NzU1LDE5Ljg2Njg5OTQgNC4wNzQ5NzM1MSwyMC4zMzE3NTc1IDIuNywyMC4zMzE3NTc1IEwyLjMsMjAuMzMxNzU3NSBDMS4yNjUxOTIzMywyMC4zMzE3NTc1IDAuNSwyMS4wMjEyMDAzIDAuNSwyMS45MDQwNzEgTDAuNSwyNi4xMzg3OTg2IEMwLjUsMjcuMDIxNjY5MyAxLjI2NTE5MjMzLDI3LjcxMTExMiAyLjMsMjcuNzExMTEyIEwyLjcsMjcuNzExMTEyIEM0LjE1NzU1NjgyLDI3LjcxMTExMiA1LjQ1MzcyMzIyLDI4LjEzMzUyNzEgNi41MTk3MjA5OCwyOC45OTggTDkuMTE4NDAyOTMsMzEuMTU5MzIxNiBDMTAuMDI2MTg1NSwzMS45MDkwNzkzIDExLjUsMzEuMzQ3MjY4OSAxMS41LDMwLjI4MzQyNTUgTDExLjUsMTcuNjY5MzQzNSBaIiBpZD0ic3BlYWtlciIgZmlsbD0iIzRENEQ0RCI+PC9wYXRoPgogICAgICAgICAgICA8cGF0aCBkPSJNMjEuNjQzNjA2NiwxNi41IEMxOS45NzcwMDk5LDE4LjQzNzAyMzQgMTcuMTA1MDI3NSwxOS45Mjg1NzE0IDE1LjY2NjY2NjcsMTkuOTI4NTcxNCBDMTUuNTEyNjM5NywxOS45Mjg1NzE0IDE1LjMxNjYyOTIsMTkuODk1OTAzIDE1LjEwOTcyNjUsMTkuNzkyNDUxNyBDMTQuNzM3NjAzOSwxOS42MDYzOTA0IDE0LjUsMTkuMjQ5OTg0NiAxNC41LDE4Ljc2MTkwNDggQzE0LjUsMTguNjU2ODA0MSAxNC41MTcwNTU1LDE4LjU1NDUwNzYgMTQuNTQ5NDQ2NywxOC40NTQwODQ0IEMxNC42MjU3NTQ1LDE4LjIxNzUwNjMgMTUuMTczNTcyMSwxNy40Njc1MzEgMTUuMjc3MjA3MSwxNy4yODA5ODgxIEMxNS41NDYzNTI2LDE2Ljc5NjUyNjEgMTUuNzM5MDI1LDE2LjIwNjM1NjEgMTUuODQzMjg5MSwxNS40MTYwMDM0IEMxMy4xODk3MDA1LDEzLjkyNjgzNjkgMTEuNSwxMS4xMTM5NjY4IDExLjUsOCBDMTEuNSwzLjMwNTU3OTYzIDE1LjMwNTU3OTYsLTAuNSAyMCwtMC41IEwyNCwtMC41IEMyOC42OTQ0MjA0LC0wLjUgMzIuNSwzLjMwNTU3OTYzIDMyLjUsOCBDMzIuNSwxMi42OTQ0MjA0IDI4LjY5NDQyMDQsMTYuNSAyNCwxNi41IEwyMS42NDM2MDY2LDE2LjUgWiIgaWQ9InNwZWVjaCIgZmlsbD0iI0ZGRkZGRiI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",menuIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1RleHQtdG8tU3BlZWNoLU1lbnU8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZyBpZD0iRXh0ZW5zaW9ucy9Tb2Z0d2FyZS9UZXh0LXRvLVNwZWVjaC1NZW51IiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj4KICAgICAgICA8ZyBpZD0idGV4dDJzcGVlY2giIHRyYW5zZm9ybT0idHJhbnNsYXRlKDIuMDAwMDAwLCAyLjAwMDAwMCkiIGZpbGwtcnVsZT0ibm9uemVybyI+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik01Ljc1LDguODM0NjcxNzMgQzUuNzUsOC4zMjY5NjM0NCA1LjAwMzAwNzI3LDguMDQyMjEzNzEgNC41NTYyODAxMiw4LjQ0NDE0OTk5IEwzLjIwNjI4MDEyLDkuNTI1MzU3MDIgQzIuNjk2NzMzNzgsOS45MzM0NDk2OCAyLjAzNzQ4Njc1LDEwLjE2NTg3ODggMS4zNSwxMC4xNjU4Nzg4IEwxLjE1LDEwLjE2NTg3ODggQzAuNjMyNTk2MTY1LDEwLjE2NTg3ODggMC4yNSwxMC41MTA2MDAyIDAuMjUsMTAuOTUyMDM1NSBMMC4yNSwxMy4wNjkzOTkzIEMwLjI1LDEzLjUxMDgzNDYgMC42MzI1OTYxNjUsMTMuODU1NTU2IDEuMTUsMTMuODU1NTU2IEwxLjM1LDEzLjg1NTU1NiBDMi4wNzg3Nzg0MSwxMy44NTU1NTYgMi43MjY4NjE2MSwxNC4wNjY3NjM2IDMuMjU5ODYwNDksMTQuNDk5IEw0LjU1OTIwMTQ3LDE1LjU3OTY2MDggQzUuMDEzMDkyNzYsMTUuOTU0NTM5NiA1Ljc1LDE1LjY3MzYzNDQgNS43NSwxNS4xNDE3MTI4IEw1Ljc1LDguODM0NjcxNzMgWiIgaWQ9InNwZWFrZXIiIHN0cm9rZS1vcGFjaXR5PSIwLjE1IiBzdHJva2U9IiMwMDAwMDAiIHN0cm9rZS13aWR0aD0iMC41IiBmaWxsPSIjNEQ0RDREIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xMC43MDQ4MzEzLDggQzkuNzkwNjc0NjgsOS4xMzExNDg0NyA4LjMwNjYxODQsOS43MTQyODU3MSA3LjgzMzMzMzMzLDkuNzE0Mjg1NzEgQzcuODMzMzMzMzMsOS43MTQyODU3MSA3LjUsOS43MTQyODU3MSA3LjUsOS4zODA5NTIzOCBDNy41LDkuMDg1MjI2ODQgOC4wNjIyMDE2OCw4LjkwMTk0MTY0IDguMTg5MDYwNjcsNy41Njc1NDA1OCBDNi44ODk5Njk5MSw2LjkwNjc5MDA1IDYsNS41NTczMjY4MyA2LDQgQzYsMS43OTA4NjEgNy43OTA4NjEsNC4wNTgxMjI1MWUtMTYgMTAsMCBMMTIsMCBDMTQuMjA5MTM5LC00LjA1ODEyMjUxZS0xNiAxNiwxLjc5MDg2MSAxNiw0IEMxNiw2LjIwOTEzOSAxNC4yMDkxMzksOCAxMiw4IEwxMC43MDQ4MzEzLDggWiIgaWQ9InNwZWVjaCIgZmlsbD0iIzBFQkQ4QyI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",blocks:[{opcode:"speakAndWait",text:e({id:"text2speech.speakAndWaitBlock",default:"speak [WORDS]",description:"Speak some words."}),blockType:Q.COMMAND,arguments:{WORDS:{type:i.STRING,defaultValue:A}}},{opcode:"setVoice",text:e({id:"text2speech.setVoiceBlock",default:"set voice to [VOICE]",description:"Set the voice for speech synthesis."}),blockType:Q.COMMAND,arguments:{VOICE:{type:i.STRING,menu:"voices",defaultValue:"ALTO"}}},{opcode:"setLanguage",text:e({id:"text2speech.setLanguageBlock",default:"set language to [LANGUAGE]",description:"Set the language for speech synthesis."}),blockType:Q.COMMAND,arguments:{LANGUAGE:{type:i.STRING,menu:"languages",defaultValue:this.getCurrentLanguage()}}}],menus:{voices:{acceptReporters:!0,items:this.getVoiceMenu()},languages:{acceptReporters:!0,items:this.getLanguageMenu()}}}}getEditorLanguage(){return(e.setup().locale||navigator.language||navigator.userLanguage||this.DEFAULT_LANGUAGE).toLowerCase()}getCurrentLanguage(){const A=this.runtime.getTargetForStage();return A?(A.textToSpeechLanguage||this.setCurrentLanguage(this.getEditorLanguage()),A.textToSpeechLanguage):this.DEFAULT_LANGUAGE}setCurrentLanguage(A){const B=this.runtime.getTargetForStage();if(!B)return;this.isSupportedLanguage(A)&&(B.textToSpeechLanguage=this._getExtensionLocaleForSupportedLocale(A));const t=g.nameMap[A.toLowerCase()];t&&this.isSupportedLanguage(t)&&(B.textToSpeechLanguage=this._getExtensionLocaleForSupportedLocale(t)),B.textToSpeechLanguage||(B.textToSpeechLanguage=this.DEFAULT_LANGUAGE)}_getExtensionLocaleForSupportedLocale(A){for(const B in this.LANGUAGE_INFO)if(this.LANGUAGE_INFO[B].locales.includes(A))return B;E.error("cannot find extension locale for locale ".concat(A))}_getSpeechSynthLocale(){let A=this.LANGUAGE_INFO[this.DEFAULT_LANGUAGE].speechSynthLocale;return this.LANGUAGE_INFO[this.getCurrentLanguage()]&&(A=this.LANGUAGE_INFO[this.getCurrentLanguage()].speechSynthLocale),A}_getSupportedLocales(){return Object.keys(this.LANGUAGE_INFO).reduce((A,B)=>A.concat(this.LANGUAGE_INFO[B].locales),[])}isSupportedLanguage(A){return this._supportedLocales.includes(A)}getVoiceMenu(){return Object.keys(this.VOICE_INFO).map(A=>({text:this.VOICE_INFO[A].name,value:A}))}getLanguageMenu(){const A=this.getEditorLanguage(),B={};let t=g.menuMap[A];if(t){let e=[];g.spokenLanguages&&(e=g.spokenLanguages[A],t=t.concat(e)),t.forEach(A=>{B[A.code]=A.name})}return Object.keys(this.LANGUAGE_INFO).map(A=>{let t=this.LANGUAGE_INFO[A].name;const e=B[A];return e&&(t=e),t=t.charAt(0).toUpperCase()+t.slice(1),{text:t,value:A}})}setVoice(A,B){const t=this._getState(B.target);let e=A.VOICE,g=parseInt(e,10);isNaN(g)||(g-=1,g=n.wrapClamp(g,0,Object.keys(this.VOICE_INFO).length-1),e=Object.keys(this.VOICE_INFO)[g]),Object.keys(this.VOICE_INFO).includes(e)&&(t.voiceId=e)}setLanguage(A){this.setCurrentLanguage(A.LANGUAGE)}_stopAllSpeech(){this._soundPlayers.forEach(A=>{A.stop()})}speakAndWait(A,B){let t=s.toString(A.WORDS),e=this._getSpeechSynthLocale();const g=this._getState(B.target);let i=this.VOICE_INFO[g.voiceId].gender,Q=this.VOICE_INFO[g.voiceId].playbackRate;this.LANGUAGE_INFO[this.getCurrentLanguage()].singleGender&&(i="female","TENOR"===g.voiceId&&(Q=.89),"GIANT"===g.voiceId&&(Q=.79)),"KITTEN"===g.voiceId&&(t=t.replace(/\S+/g,"meow"),e=this.LANGUAGE_INFO[this.DEFAULT_LANGUAGE].speechSynthLocale);let n="".concat("https://synthesis-service.scratch.mit.edu","/synth");return n+="?locale=".concat(e),n+="&gender=".concat(i),n+="&text=".concat(encodeURIComponent(t.substring(0,128))),c(n,{},1e4).then(A=>{if(200!==A.status)throw new Error("HTTP ".concat(A.status," error reaching translation service"));return A.arrayBuffer()}).then(A=>{const B={data:{buffer:A}};return this.runtime.audioEngine.decodeSoundPlayer(B)}).then(A=>{this._soundPlayers.set(A.id,A),A.setPlaybackRate(Q);const B=this.runtime.audioEngine.createEffectChain();return B.set("volume",250),A.connect(B),A.play(),new Promise(B=>{A.on("stop",()=>{this._soundPlayers.delete(A.id),B()})})}).catch(A=>{E.warn(A)})}}A.exports=o},function(A,B,t){const e=t(5),g=t(2),i=t(1),Q=t(0),s=t(68),n=t(67),r=t(4);A.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:r({id:"translate.categoryName",default:"Translate",description:"Name of extension that adds translate blocks"}),blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAN+UlEQVR4Ae1ce2xT1xn/Tkhq4hqHJKRLDAlQGI+GUfFc14HaLmxuGd0ab93GgK6Vmm01y9BUsaU0RfyRFTakaRHq3So6jVapWEUxa9dRuU8x6IAGCoO6wa1KXiSQOE9jkjivO/2u7yWOuff6XvvekFb5SUdx7ON7v/vz9zrnO+cwnudpAokjZYK75DBBYJKYIDBJTBCYJCYITBJfOgIZYzbGWA5jLJ8xNm/z5s334a/4P1omYyzNsPt9WdIYxhiUId/j8azPz89fY7VaF6ampjqi+4TD4Qvd3d0f7t+/fx/HcTVE1M7z/EBS99VDoCikTWzWMdTgYSLqIaIQGs/zwzKyOaqrq1+aOnVqUUZGBqWnp5PFYqG0tDQaHh6mvr4+GhwcpFAoJLSenp4P9+7dW8Zx3Fme5zsTFSxVa0eovtPpnL1ly5YfzJgxw2WxWBYketNEAO25dOmSp7Ky8iBjrFbmoW12u70oOzubMjMzR32QkpJCVqtVeG2322lgYIACgcDK0tLS1+6+++4yxpiH5/krCQkGDYzXiCi3qqrKXVNTE7x48SLf0dHB9/X18WMF3Av3xL0hA2SBTNFyE9E8v9/PX758WbNUuCa+4/F4ymKvp7XF1UDGWK7H43m0sLBwZ05Ozg2/7lgApoiGe3d2dk5ZsWLFcx6Px84Y2xelOcHW1taXiOiRcDgsaJ2gljab0GDKscD1Jk2ahHd3ejwePOtenufb9TySKoEw26qqKhfIy83NFdT/ZiP6oauqqoKMsf2iObeuXr26vKKiwpOVlTXFbrfb8/LyFubk5KyBu1H68aVnGh4e3uZ2u08yxo7pCixKqgrX4XQ6l8JkoOrjDZAJskFGyBolt0UMcGhgJ19yP2rm3dDQwJ85c+akXlNWI9B++PDh38PvjFdANsgIWVUfksheUVHxfZDY3d0t+zT9/f2CP3S73feJWYZFC4FqJmxDtJ06daphRnuiluhrDqJbLcZcD7JBRiJ6Dj5Qrg9jDHfLhlm3tbUdslgsj8i5IvhI+MpNmzaVLlq0yCN+9wMiCvA8H1KSQY1AK3yHFP6ThfcTouePEaVNItrzI6LbpiR/TcgmplOyQmLE4XQ6C3fv3v0y+iEQIbggjZELKiB2+vTpxXl5ecUIRD6fr/nQoUNuxtjbPM/3yN1DLREWPsNNjUBNC9HgMFEKI2q5asglo2VTeo7sioqKP6anpwtBZObMmZSfny9LHokRG5+jn8PhoFtuucVRXFzMQdmVZPiyTyakIblGBqE3/QKZIBLDQafTmavUT/NIRA3XwkSlB4jaFD3FCPqHiJ5+Xb3PNBvRnoeN85UYyiUCmDHg9XoVn8wQDTxRR9RxjQjxLl4DgfH64Fq4pgEY6OjoONTe3q6bRPTH9zBmFsfgsjBEA4vmE/kuE30eiPzfN0B0WYyJGelEWQpx6FJXhNC0FKIcG9Fk0TUVZEWuaQBad+zYUbF79+6FjY2NC+DfpBGKGkBeY2MjBYPBC2VlZU9g1sZUAoFf3zvyGia9/u8RbRrmiSofvrG/1IeEaEn0/E+NkmQEmLVhjPmIaAMisRYSo8nbunXrBq/X6+N5PqzU35QgAt8177bI655+ovPNN/Z50xeJyIyIlswwQ4oI8PAgAWSAFJCjZM56ySMzo/DP7iJKTSEaGibi/jP6M2jfwbNEQzzRpBSin68yS4oItJCYCHlkJoEYcWSKvu9KkOjwxyOf7T9F1DsQ0b6CTGOS6niQIxEJNSVBHhnpA+Xwm28RPfOvSAL9t+NEy2cShcJEr5+P+EcQ+PT9ZkowGiBF8olIsMPhcBFmrnt7e4Voi4Chhzwym0BoYWFexAcODBGVvUbU3RshbxIjWrdobLQvGhKJXq+3xO12z1q3bt2aN9544x2O45A4Neshj8wmENjmJHr8ZaJQ/0iizcRk+fFvmn13eYgk1TLGWjiOwxQWKY1148H0oRwiMohiUYky8Oz3zL5zfIA0qSV6DdM18NWPiF4+FXnNogh84h9EW9cQ3TV7pC+ceVTVTNPooa5OGLLMYkgmE0fcqp8STCPwYhvRn94jauqKBBHJbOED4Q8xAtn1FtH8rxA9WUSUNthJiQy5Zs2aRX6/35usvBqqfrJQrAujmu/3+/3z5s3TJQgCxsEzRP9riuSAUsBYXhCJysCWVyP+EHkgiA0Hr9D9Xw3S/QuJJlvShIlSca4vASr0A5MG0Piuri68vnr69OmyjRs3aip1GqaByPNePRuZCMDwTSIuPY1oy32jTfWFDUQvniB67RzRta4rtDwvSN8tJBrnVT9ZGEIgpupf+C/RgGh90CpMEKwtJFq/XH5aCiOVb0zvpH+fipD3Baj6yUKNQIEOqLcWU4IPx9ANGue6k+iBQvX5PPi6lHD7dc0bD+RJgCxDQ0O0bNmyXU6n8wRjrFsxsKhUshznzp2r0VrSbAny/OcB7eU7VMdQBfuiV/3U8sAQohIcqxZgRHH7NO2/MlIVEitr4xVRVT+bkoiqBCKkIyp1dia8eEkRiHokVtbGK+JV/VQJhM17vd5ahPRAIICZCkMfU8r3xipVSQQaqn7qURjRB0u/ENIRleBYb0aaEQ+Btk4qfXLnqF7bn/oF3bFgjun3jjsWRh7kcrn2VVdXb25pablaW1uLXOl6xWo84LD36A1SHDl6akwk05QHgkTkQwjpsQsstSa/V65cGeUGMIbFMMwIyJFVfdpHj2zopVut6YbcQwmaZ2Ngzl6v9+zatWv/sHjx4u9UVlYKAzMUoOMB5HV1dV09cODAQ/NFOJ1OpxEPAKJ6evtueB/vnTrtM+IWqtA1nYXAwvM81GgAi3CUFi5KQKBobm4WyDt48OCm8vLy93me/xQNSmjEAxw5NqJ91vTJQpNQ/dE4I5AikwxWjuPWZGVlFWM9shLgI+vr6zHDcoHjuAdF8gwN5dd6eulUFEkrlhUKTQI+Q4AxE4lMqOasWrXqafg9uRREquiDvKamppe2bdv2kz179pwwmjyS8X3Lly4SWjSqT38s/2WDkMhkggUBJHbsCuIQndH6+/ubjxw58ju32/0eXKCeCUo9iDbfadMyr2sfzFjyi4ffOkZrnatNoi8xAoX1JjabrRhDnehZZBDn9/v3uFyuV+ItTEwWdQ3NVN9w+fpVViwdMV0QeeTYaeF1W1un0HdWgcNoEQQkYsJd27dvfxa+7dKlS9TQ0NBcV1d36OTJk5sLCwtXuVwujuf5WjPJIxnzvWf18uuvY834TZk80Sjo1kBxdPLp4sWLizBnKr4NewnqLQkmg1gCy575s+LVkOo8UWKOHAlV5cSAgGmadnG/WWCsyZPL/ZSAvmaNTHRroLho2xFdlGaMXRSDxZiQGJvf3bHgdtl+n1y4OOo70WZuFHQRCPKwaHvXrl1/sVqtK7EsYs6cOdsee+yxd8vLy3+Lir/ZJCKvi879Zhbk0fanfinb91dP7hSCCEXlhDnTjJ0M0WzCEnlYZ5eZmbly7ty5woLs2bNnYzxchPfxuaihpiE2r7tnlbJWRUdmMikn1ERgNHl2u33UIkUM5fA/3h8LEpHXRWPFskWKfWNNNva7RkDLZkNF8iTgf7yPFaDoh9VPZpnzvVEaZ7VOVjVJ5H4/fOjbRoswGnG2SIG8pSgu1dXV8UNDQ6pFGHyOfugv7mFT3C5FRHNRVBrLbbN6AdkgI2RNZK+cLvIkyJCYonB9XVW/mwHIBhkhayJVuWxEWyWzVYJkzjabbcGOHTvKUbBT6Kqr6nczANkgo9o2BzVWbEhVMGWllbzrF01JIXwPU16IMwrdTK36JQuxbHEVMiZEoNPpFKaaE62axSPd7KpfMoAskAmyQUa12STFKOz1egODg4PN9fX1Dqxb0TJ1LwG/HuYEg8Hgu5i9Ueo3Hqt+kB3k+Xy+p8QVWqrmoZbGtGOrJ3YrNjc3O6StonhAOTKx4h21D0xvYTYa6+0wOlHb5UMjBat9WMiDtShdXV1TvkjL21TPjcEpQJiB5jhOWM28ZMkSV0FBQTG2gsoBJU/MQp8/f/5tt9v9gZ5F20Yeq4LJXlhNPEjaRjELLEWz1eaYNR57AlWwYTs88iJsj5cDFgxhWz2218fbhq90ToN4zgF+obk4ykRvk7b2azn+JGabf754b9m0S3ceqPCAuTiYAQc0KAGCR53tIgklHQKh6RyCZFr0+QhNTU1x81f0OX78uMe0c2Ni0I7jknDiTzAYxNEiN3SA6VgsFmGV57lz50oDgcA7fr9f2ErQ0dFxlTH2ERE1mVUnwVwlY+z9lpaWB0tKSv4aDocXwOUo+VOkW6FQqJjjOI94gpG+FfsJmFk2TvqB6iudgCGZBzJ5aCsaRif4ztGjR19M9NfWKadl3bp1d+J+uG9bW5uiNra2tkojjpm675OgcLkSiXqGYjBvcWw5z2wC+RGf6uA4bqPP52v67LPPZImMGvPqliuhNdKxqUdvb+8UrJFRW6VAN2Epm+gmmhlj/ySiDzwez4/nz59f2tnZ6ZCOhEJqhvQFlUa1nFUJCS8ylxYcud3umpKSkl2hUGilJFRqaipNnjz5+hEjyLOwoa+7u1tKrk2t2MnIKmygYYzhBI5XqqqqHpgzZ84au93+dRwqgRQGlUaxzqMLSR/AKJ4Gme12uxeuX7/+0YyMjJWxORxGND09PTWNjY3vuFyu/UTUaFYQ0SizRcwOpIU0Q2JVUf8Pa6C/AZGZYuqSL+VkYh6H/3OQS46F7xvLNnGSeZKYOMU3SUwQmCQmCEwSEwQmiQkCkwER/R+aET3lwEIlXgAAAABJRU5ErkJggg==",menuIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAACXBIWXMAABYlAAAWJQFJUiTwAAAGAklEQVRYhe1YbUxTVxh+rh02o0KtkOEgKA4U4yeRWCdgxDoxCnH6h22iqSz76aasZlnijzkTBlvS4TJ/LGaJsmiyESe4hAVJvMJGxwQhLKECcRWkpWNZERs6Ctb2Lm97C/fe3n6Jyfzhk5y09z3nPPe57znnPe85DMdxeJ6x6LlW90LgM8BLchR1dXUZeXl5b3Ect+ppXsEwzHBfX98PVVVVY0GbmjW2AdgpaFYP4JxTZ+iLyCVdJFeuXNmdn59fn56enrFkyRIsWhSfk30+H1wuF+x2+1hPT4++oqLiJi/wEoA8AJslXSqdOsOlmARWV1dnlpeXd2ZnZ2fEK0xOqMViGWtoaNh++vRpa9CuZo1ZAJokQlc5dYYROR6RCq1WW56WlhZV3H0H8O9sZIHEQVzEKbTzQooBPBCYz4TlET4oFIosGtZoOHUN+Ph61GYgLuIU2tSscSmAYwAeCcx6NWs8o2aNxVKOkEUi9R55qv428Ng7b3viA/6eAs7dmrctVgD6bYBKGZ6LB4mrk7F/whcmokApfh8BWu6G2mc8ADsktuWmAbtzozGiLUJdu9QQVSC98JUkYNgBfPsboH4Z+GhPoK62FZiaAU7sCrTZmB5VHM3BPjVrrARwUVL1B4CD0vYxLVV68YFNQIICcLrn7SROtTjwEbGIE4iksFIpEVfs1BkeSdvGFUsObAz8Gm8CNTcC/49q42EIEbkLwKfhxCGWIRZC/zrQ/ifgcAWMK5YB+zc8nUBeZFuUORmfQIp/PsHGM/04YMta5oPT6cTs7Cw8Ho+oj9vtzmloaCgPZQtApVI96ejo6K2trR3lOM4nrRftJCzLfq3T6Y7LCfvuNtDL7wepfKgkTz6ZdeHdzePYlq30xz2lUintHhH0UbQ12my2+oKCguMcx7mE7aOHmWHgsxvzzzQP3ysMxMfzt2bxKmNHyZblSE5OjktYEImJidBoNFCr1frOzs5khmHe4Thubp8SCVQoFBwNUUJCwpyNwsfyZGBDOvB2fuCZQAH56KYJKJUpTy1OCOJYvXr1ocbGxjIAPwarRKvYZrNdn5iYEHV8LRW4cBj4oHheXBDT09PPRFwQxKXRaIQpmVjgkSNHfrFardcmJydjIqSMRehtOfzjmMTZmm/8hf5HAnF5vV7RVicSyHGcR6vVHh4YGPjKYrFMkTelq5JAH0B1MzMzUT+iu6cfdwfv+wv9jxchgZomaEFBwcmcnJxVY2NjXQqFQlQ/Pj6O/v7+s2az+U2Hw9Ec7X3tHXfm/v/c2hG3wLCruLm5+VBGRoY2mJGQJ0nc4ODgqZKSkjqKWSzL7olEPjJqx4PRv5CaqvE/OxyTflvWitj3xbBbnUql2kRxjYTRcA4MDHR1d3frguJiIW//NeC9/SVF2LplvcgWK8J6sKWl5UuVSrXO4/HYHj58+FNZWVkLx3HT8Rz0u3vN/t8Ho3aRaH3FgYULrKmpodT8jeBzvDcQ3T1m/5D6RXX0zNmn3TP+uq356xcmkE/NTwLoc+oMTXGpA3CnN7Bi99Hw5s8PL4mlulgFys5BXlwbn4I3qlnjsXgFBr22f+8OrFub7S/79u4Q1cWCEA8KxAmPhRfVrBFy51cK1nJnj+/rvwix0eqVswu5pJDzoPTMKhSZJzQolUoLZSLPCsRFnEI6OYE7I7xPdGYoKiq6YLVaByllWiiIg7iIM5rAYBouBB2yq5w6g+iATWGnqampZGhoqItiJSUP4YrcR9CQUh31JQ7iIk5hm7AXmPxdip5/dNIUCnduYBgm8fLly9tzc3NLwzlSqVTuW7NmzVphQkubwL179+xdXV3HKisrTVJxiJKwnuGHVM2XNjVrPCh3h8IT3+SLLKqrq+tKS0uvrly5UksJKvjsJSkpKd3r9TrkxCGSBxHwIoWXc7zAIOiIOOLUGULOsNHAMIzSZDJ9npmZeSIlJcWfTdPQm0ym8zqd7n257hGPnXxYyePv8py8mVb40ji1+UGZUmFh4Yetra1bzGbzteHh4SlKQNxu961wff7XS3Sau/w0c4VLQF7c8i8IAP4DcHKth/4Ur7MAAAAASUVORK5CYII=",blocks:[{opcode:"getTranslate",text:r({id:"translate.translateBlock",default:"translate [WORDS] to [LANGUAGE]",description:"translate some text to a different language"}),blockType:g.REPORTER,arguments:{WORDS:{type:e.STRING,defaultValue:r({id:"translate.defaultTextToTranslate",default:"hello",description:"hello: the default text to translate"})},LANGUAGE:{type:e.STRING,menu:"languages",defaultValue:this._randomLanguageCode}}},{opcode:"getViewerLanguage",text:r({id:"translate.viewerLanguage",default:"language",description:"the languge of the project viewer"}),blockType:g.REPORTER,arguments:{}}],menus:{languages:{acceptReporters:!0,items:this._supportedLanguages}}}}_getSupportedLanguages(A){return n.menuMap[A].map(A=>({text:A.name,value:A.code}))}getViewerLanguage(){this._viewerLanguageCode=this.getViewerLanguageCode();const A=n.menuMap[this._viewerLanguageCode];let B=A.find(A=>A.code===this._viewerLanguageCode);if(!B&&n.scratchToGoogleMap[this._viewerLanguageCode]){const t=n.scratchToGoogleMap[this._viewerLanguageCode];B=A.find(A=>A.code===t)}let t=this._viewerLanguageCode;return B&&(t=B.name),t}getViewerLanguageCode(){const A=[r.setup().locale].concat(navigator.languages),B=Object.keys(n.menuMap);return(A.reduce((A,t)=>A||(B.indexOf(t.toLowerCase())>-1?t:A),"")||"en").toLowerCase()}getLanguageCodeFromArg(A){const B=i.toString(A).toLowerCase();return n.menuMap.hasOwnProperty(B)?B:n.nameMap.hasOwnProperty(B)?n.nameMap[B]:-1!==n.previouslySupported.indexOf(B)?B:"en"}getTranslate(A){if(/^\d+$/.test(A.WORDS))return Promise.resolve(A.WORDS);if(this._lastTextTranslated===A.WORDS&&this._lastLangTranslated===A.LANGUAGE)return this._translateResult;const B=this.getLanguageCodeFromArg(A.LANGUAGE);let t="".concat("https://trampoline.turbowarp.org/translate/","translate?language=");t+=B,t+="&text=",t+=encodeURIComponent(A.WORDS);const e=this;return s(t,{},1e4).then(A=>A.text()).then(B=>{const t=JSON.parse(B).result;return e._translateResult=t,e._lastTextTranslated=A.WORDS,e._lastLangTranslated=A.LANGUAGE,t}).catch(A=>(Q.warn("error fetching translate result! ".concat(A)),""))}}},function(A,B,t){const e=t(69),g=t(5),i=t(2),Q=t(13),s=t(1),n=t(4),r=t(75),E=t(229),c={MOTION:"motion",DIRECTION:"direction"},o={STAGE:"Stage",SPRITE:"this sprite"},w={OFF:"off",ON:"on",ON_FLIPPED:"on-flipped"};class C{constructor(A){this.runtime=A,this.detect=new E,this._lastUpdate=null,this.firstInstall=!0,this.runtime.ioDevices&&(this.runtime.on(e.PROJECT_LOADED,this.updateVideoDisplay.bind(this)),this.runtime.on(e.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 A=this.runtime.getTargetForStage();return A?A.videoTransparency:50}set globalVideoTransparency(A){const B=this.runtime.getTargetForStage();return B&&(B.videoTransparency=A),A}get globalVideoState(){const A=this.runtime.getTargetForStage();return A?A.videoState:w.OFF}set globalVideoState(A){const B=this.runtime.getTargetForStage();return B&&(B.videoState=A),A}updateVideoDisplay(){this.setVideoTransparency({TRANSPARENCY:this.globalVideoTransparency}),this.videoToggle({VIDEO_STATE:this.globalVideoState})}reset(){this.detect.reset();const A=this.runtime.targets;for(let B=0;BC.INTERVAL){const B=this.runtime.ioDevices.video.getFrame({format:r.FORMAT_IMAGE_DATA,dimensions:C.DIMENSIONS});B&&(this._lastUpdate=A,this.detect.addFrame(B.data))}}_buildMenu(A){return A.map((A,B)=>{const t={};return t.text=A.name,t.value=A.value||String(B+1),t})}_getMotionState(A){let B=A.getCustomState(C.STATE_KEY);return B||(B=Q.simple(C.DEFAULT_MOTION_STATE),A.setCustomState(C.STATE_KEY,B)),B}static get SensingAttribute(){return c}get ATTRIBUTE_INFO(){return[{name:n({id:"videoSensing.motion",default:"motion",description:'Attribute for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:c.MOTION},{name:n({id:"videoSensing.direction",default:"direction",description:'Attribute for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:c.DIRECTION}]}static get SensingSubject(){return o}get SUBJECT_INFO(){return[{name:n({id:"videoSensing.sprite",default:"sprite",description:'Subject for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:o.SPRITE},{name:n({id:"videoSensing.stage",default:"stage",description:'Subject for the "video [ATTRIBUTE] on [SUBJECT]" block'}),value:o.STAGE}]}static get VideoState(){return w}get VIDEO_STATE_INFO(){return[{name:n({id:"videoSensing.off",default:"off",description:'Option for the "turn video [STATE]" block'}),value:w.OFF},{name:n({id:"videoSensing.on",default:"on",description:'Option for the "turn video [STATE]" block'}),value:w.ON},{name:n({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:w.ON_FLIPPED}]}getInfo(){return this.firstInstall&&(this.globalVideoState=w.ON,this.globalVideoTransparency=50,this.updateVideoDisplay(),this.firstInstall=!1),{id:"videoSensing",name:n({id:"videoSensing.categoryName",default:"Video Sensing",description:"Label for the video sensing extension category"}),blockIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1ZpZGVvLVNlbnNpbmctQmxvY2s8L3RpdGxlPgogICAgPGRlc2M+Q3JlYXRlZCB3aXRoIFNrZXRjaC48L2Rlc2M+CiAgICA8ZyBpZD0iRXh0ZW5zaW9ucy9Tb2Z0d2FyZS9WaWRlby1TZW5zaW5nLUJsb2NrIiBzdHJva2U9Im5vbmUiIHN0cm9rZS13aWR0aD0iMSIgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIiBzdHJva2Utb3BhY2l0eT0iMC4xNSI+CiAgICAgICAgPGcgaWQ9InZpZGVvLW1vdGlvbiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDEwLjAwMDAwMCkiIGZpbGwtcnVsZT0ibm9uemVybyIgc3Ryb2tlPSIjMDAwMDAwIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjRkZGRkZGIiBvcGFjaXR5PSIwLjI1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGN4PSIzMiIgY3k9IjE2IiByPSI0LjUiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsLUNvcHkiIGZpbGw9IiNGRkZGRkYiIG9wYWNpdHk9IjAuNSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBjeD0iMzIiIGN5PSIxMiIgcj0iNC41Ij48L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjRkZGRkZGIiBvcGFjaXR5PSIwLjc1IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGN4PSIzMiIgY3k9IjgiIHI9IjQuNSI+PC9jaXJjbGU+CiAgICAgICAgICAgIDxjaXJjbGUgaWQ9Ik92YWwiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgY3g9IjMyIiBjeT0iNCIgcj0iNC41Ij48L2NpcmNsZT4KICAgICAgICAgICAgPHBhdGggZD0iTTIyLjY3MTk0NzcsNC40MTk1NzY0OSBMMTYuNSw4LjQxOTkxMjk4IEwxNi41LDYuMSBDMTYuNSw0LjA4OTc2NDU0IDE0LjkzNzE4MDYsMi41IDEzLDIuNSBMNC4xLDIuNSBDMi4wNzYxNDIzNywyLjUgMC41LDQuMDc2MTQyMzcgMC41LDYuMSBMMC41LDE0IEMwLjUsMTUuOTI3Mzk4NyAyLjA4NDQ5ODM5LDE3LjUxMTg5NzEgNC4xLDE3LjYgTDEzLDE3LjYgQzE0LjkwMTY2MDIsMTcuNiAxNi41LDE1Ljk0NjU0NSAxNi41LDE0IEwxNi41LDExLjcxNjkwNDggTDIyLjc1NzI0NzksMTUuNDcxMjUzNSBMMjIuODUzNTUzNCwxNS41NDY0NDY2IEMyMi44NzM3ODg2LDE1LjU2NjY4MTggMjIuOTUxNTMxLDE1LjYgMjMsMTUuNiBDMjMuMjY2OTg2NSwxNS42IDIzLjUsMTUuMzgyNTIwNyAyMy41LDE1LjEgTDIzLjUsNC44IEMyMy41LDQuODM2NzY1MzggMjMuNDQzODA1OCw0LjcwNTY0NTYzIDIzLjM3MTI1MzUsNC41NTcyNDc4OCBDMjMuMjI1OTA1Niw0LjMxNTAwMTM5IDIyLjk0MTU5MzcsNC4yNTgxMzg5OSAyMi42NzE5NDc3LDQuNDE5NTc2NDkgWiIgaWQ9InZpZGVvXzM3XyIgZmlsbD0iIzRENEQ0RCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",menuIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjBweCIgaGVpZ2h0PSIyMHB4IiB2aWV3Qm94PSIwIDAgMjAgMjAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUyLjIgKDY3MTQ1KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5FeHRlbnNpb25zL1NvZnR3YXJlL1ZpZGVvLVNlbnNpbmctTWVudTwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxnIGlkPSJFeHRlbnNpb25zL1NvZnR3YXJlL1ZpZGVvLVNlbnNpbmctTWVudSIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9InZpZGVvLW1vdGlvbiIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMC4wMDAwMDAsIDUuMDAwMDAwKSIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjMEVCRDhDIiBvcGFjaXR5PSIwLjI1IiBjeD0iMTYiIGN5PSI4IiByPSIyIj48L2NpcmNsZT4KICAgICAgICAgICAgPGNpcmNsZSBpZD0iT3ZhbC1Db3B5IiBmaWxsPSIjMEVCRDhDIiBvcGFjaXR5PSIwLjUiIGN4PSIxNiIgY3k9IjYiIHI9IjIiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsLUNvcHkiIGZpbGw9IiMwRUJEOEMiIG9wYWNpdHk9IjAuNzUiIGN4PSIxNiIgY3k9IjQiIHI9IjIiPjwvY2lyY2xlPgogICAgICAgICAgICA8Y2lyY2xlIGlkPSJPdmFsIiBmaWxsPSIjMEVCRDhDIiBjeD0iMTYiIGN5PSIyIiByPSIyIj48L2NpcmNsZT4KICAgICAgICAgICAgPHBhdGggZD0iTTExLjMzNTk3MzksMi4yMDk3ODgyNSBMOC4yNSw0LjIwOTk1NjQ5IEw4LjI1LDMuMDUgQzguMjUsMi4wNDQ4ODIyNyA3LjQ2ODU5MDMxLDEuMjUgNi41LDEuMjUgTDIuMDUsMS4yNSBDMS4wMzgwNzExOSwxLjI1IDAuMjUsMi4wMzgwNzExOSAwLjI1LDMuMDUgTDAuMjUsNyBDMC4yNSw3Ljk2MzY5OTM3IDEuMDQyMjQ5MTksOC43NTU5NDg1NiAyLjA1LDguOCBMNi41LDguOCBDNy40NTA4MzAwOSw4LjggOC4yNSw3Ljk3MzI3MjUgOC4yNSw3IEw4LjI1LDUuODU4NDUyNDEgTDguNjI4NjIzOTQsNi4wODU2MjY3NyBMMTEuNDI2Nzc2Nyw3Ljc3MzIyMzMgQzExLjQzNjg5NDMsNy43ODMzNDA5MSAxMS40NzU3NjU1LDcuOCAxMS41LDcuOCBDMTEuNjMzNDkzMiw3LjggMTEuNzUsNy42OTEyNjAzNCAxMS43NSw3LjU1IEwxMS43NSwyLjQgQzExLjc1LDIuNDE4MzgyNjkgMTEuNzIxOTAyOSwyLjM1MjgyMjgyIDExLjY4NTYyNjgsMi4yNzg2MjM5NCBDMTEuNjEyOTUyOCwyLjE1NzUwMDY5IDExLjQ3MDc5NjgsMi4xMjkwNjk1IDExLjMzNTk3MzksMi4yMDk3ODgyNSBaIiBpZD0idmlkZW9fMzdfIiBzdHJva2Utb3BhY2l0eT0iMC4xNSIgc3Ryb2tlPSIjMDAwMDAwIiBzdHJva2Utd2lkdGg9IjAuNSIgZmlsbD0iIzRENEQ0RCI+PC9wYXRoPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+",blocks:[{opcode:"whenMotionGreaterThan",text:n({id:"videoSensing.whenMotionGreaterThan",default:"when video motion > [REFERENCE]",description:"Event that triggers when the amount of motion is greater than [REFERENCE]"}),blockType:i.HAT,arguments:{REFERENCE:{type:g.NUMBER,defaultValue:10}}},{opcode:"videoOn",blockType:i.REPORTER,text:n({id:"videoSensing.videoOn",default:"video [ATTRIBUTE] on [SUBJECT]",description:"Reporter that returns the amount of [ATTRIBUTE] for the selected [SUBJECT]"}),arguments:{ATTRIBUTE:{type:g.NUMBER,menu:"ATTRIBUTE",defaultValue:c.MOTION},SUBJECT:{type:g.NUMBER,menu:"SUBJECT",defaultValue:o.SPRITE}}},{opcode:"videoToggle",text:n({id:"videoSensing.videoToggle",default:"turn video [VIDEO_STATE]",description:"Controls display of the video preview layer"}),arguments:{VIDEO_STATE:{type:g.NUMBER,menu:"VIDEO_STATE",defaultValue:w.ON}}},{opcode:"setVideoTransparency",text:n({id:"videoSensing.setVideoTransparency",default:"set video transparency to [TRANSPARENCY]",description:"Controls transparency of the video preview layer"}),arguments:{TRANSPARENCY:{type:g.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(A){const B=this.runtime.renderer._allDrawables[A.drawableID],t=this._getMotionState(A);return this.detect.getLocalMotion(B,t),t}videoOn(A,B){this.detect.analyzeFrame();let t=this.detect;return A.SUBJECT===o.SPRITE&&(t=this._analyzeLocalMotion(B.target)),A.ATTRIBUTE===c.MOTION?t.motionAmount:t.motionDirection}whenMotionGreaterThan(A,B){this.detect.analyzeFrame();return this._analyzeLocalMotion(B.target).motionAmount>Number(A.REFERENCE)}videoToggle(A){const B=A.VIDEO_STATE;this.globalVideoState=B,B===w.OFF?this.runtime.ioDevices.video.disableVideo():(this.runtime.ioDevices.video.enableVideo(),this.runtime.ioDevices.video.mirror=B===w.ON)}setVideoTransparency(A){const B=s.toNumber(A.TRANSPARENCY);this.globalVideoTransparency=B,this.runtime.ioDevices.video.setPreviewGhost(B)}}A.exports=C},function(A,B){let t=0;const e={},g="object"==typeof window&&window.performance;class i{constructor(A){this.id=-1,this.totalTime=0,this.selfTime=0,this.arg=null,this.depth=A,this.count=0}}class Q{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){};this.records=[],this.increments=[],this.counters=[],this.nullFrame=new i(-1),this._stack=[new i(0)],this.onFrame=A,this.START=0,this.STOP=1}start(A,B){this.records.push(0,A,B,g.now())}stop(){this.records.push(1,g.now())}increment(A){this.increments[A]||(this.increments[A]=new i(-1),this.increments[A].id=A),this.increments[A].count+=1}frame(A,B){for(let t=0;t=A.length&&A.push(new i(B));const e=A[B++];e.id=this.records[t+1],e.arg=this.records[t+2],e.totalTime=this.records[t+3],e.selfTime=0,t+=4}else{if(1!==this.records[t])throw this.records.length=0,new Error("Unable to decode Profiler records.");{const e=this.records[t+1],g=A[--B];g.totalTime=e-g.totalTime,g.selfTime+=g.totalTime,A[B-1].selfTime-=g.totalTime,g.count=1,this.onFrame(g),t+=2}}for(let A=0;A0&&(this.onFrame(this.increments[A]),this.increments[A].count=0);for(let A=0;A0&&(this.onFrame(this.counters[A]),this.counters[A].count=0);this.records.length=0}idByName(A){return Q.idByName(A)}nameById(A){return Q.nameById(A)}static idByName(A){return"number"!=typeof e[A]&&(e[A]=t++),e[A]}static nameById(A){for(const B in e)if(e[B]===A)return B;return null}static available(){return"object"==typeof window&&void 0!==window.performance}}Q.START=0,Q.STOP=1,A.exports=Q},function(A,B,t){const e=t(15),g=t(29),i=t(73),Q=t(71);let s=-1,n=-1,r=-1;class E{constructor(A){this.timer=new e,this.runtime=A,this.activeThread=null}static get WARP_TIME(){return 500}stepThreads(){const A=.75*this.runtime.currentStepTime;this.runtime.updateCurrentMSecs(),this.timer.start();let B=1/0,t=!1;const e=[];for(;this.runtime.threads.length>0&&B>0&&this.timer.timeElapsed()E.WARP_TIME)return}else{if(B.waitingReporter)return;A.goToNextBlock()}}}else A.status=g.STATUS_DONE}stepToBranch(A,B,t){B||(B=1);const e=A.peekStack(),g=A.target.blocks.getBranch(e,B);A.peekStackFrame().isLoop=t,g?A.pushStack(g):A.pushStack(null)}stepToProcedure(A,B){const t=A.target.blocks.getProcedureDefinition(B);if(!t)return;const e=A.isRecursiveCall(B);if(A.pushStack(t),A.peekStackFrame().warpMode&&A.warpTimer.timeElapsed()>E.WARP_TIME)A.status=g.STATUS_YIELD;else{const B=A.target.blocks.getBlock(t),i=A.target.blocks.getBlock(B.inputs.custom_block.block);let Q=!1;if(i&&i.mutation){const A=i.mutation.warp;"boolean"==typeof A?Q=A:"string"==typeof A&&(Q=JSON.parse(A))}Q?A.peekStackFrame().warpMode=!0:e&&(A.status=g.STATUS_YIELD)}}retireThread(A){A.stack=[],A.stackFrame=[],A.requestScriptGlowInFrame=!1,A.status=g.STATUS_DONE,A.isCompiled&&(A.procedures=null,A.generator=null)}}A.exports=E},function(A,B,t){const e=t(203),g=t(205);A.exports=A=>{const B=new e(A).generate(),t={},i=A.target,Q=A=>{if(A.cachedCompileResult)return A.cachedCompileResult;const t=new g(A,B,i).compile();return A.cachedCompileResult=t,t},s=Q(B.entry);for(const A of Object.keys(B.procedures)){const e=Q(B.procedures[A]);t[A]=e}return{startingFunction:s,procedures:t}}},function(A,B,t){const e=t(1),g=t(7),i=t(2),Q=t(8),s=t(0),{IntermediateScript:n,IntermediateRepresentation:r}=t(70),E=t(204),c=(A,B)=>({scope:A,id:B.id,name:B.name,isCloud:B.isCloud}),o=A=>A.substring(1);class w{constructor(A){this.thread=A,this.target=A.target,this.blocks=A.blockContainer,this.runtime=this.target.runtime,this.stage=this.runtime.getTargetForStage(),this.script=new n,this.script.warpTimer=this.target.runtime.compilerOptions.warpTimer,this.variableCache={},this.usesTimer=!1}setProcedureVariant(A){const B=o(A);this.script.procedureCode=B,this.script.isProcedure=!0,this.script.yields=!1;const t=this.blocks.getProcedureParamNamesIdsAndDefaults(B);if(null===t)throw new Error("IR: cannot find procedure: ".concat(A));const[e,g,i]=t;this.script.arguments=e}enableWarp(){this.script.isWarp=!0}getBlockById(A){return this.blocks.getBlock(A)||this.blocks.runtime.flyoutBlocks.getBlock(A)}getBlockInfo(A){const[B,t]=g.splitFirst(A,"_");if(!B||!t)return null;const e=this.runtime._blockInfo.find(A=>A.id===B);if(!e)return null;const i=e.blocks.find(A=>A.info.opcode===t);return i||null}descendInputOfBlock(A,B){const t=A.inputs[B];if(!t)return s.warn("IR: ".concat(A.opcode,": missing input ").concat(B),A),{kind:"constant",value:0};const e=t.block,g=this.getBlockById(e);return g?this.descendInput(g):(s.warn("IR: ".concat(A.opcode,": could not find input ").concat(B," with ID ").concat(e)),{kind:"constant",value:0})}descendInput(A){switch(A.opcode){case"colour_picker":{const B=A.fields.COLOUR.value,t=B.substr(1);return/^[0-9a-f]{6,8}$/.test(t)?{kind:"constant",value:Number.parseInt(t,16)}:{kind:"constant",value:B}}case"math_angle":case"math_integer":case"math_number":case"math_positive_number":case"math_whole_number":return{kind:"constant",value:A.fields.NUM.value};case"text":return{kind:"constant",value:A.fields.TEXT.value};case"argument_reporter_string_number":{const B=A.fields.VALUE.value,t=this.script.arguments.lastIndexOf(B);return-1===t&&"last key pressed"===B.toLowerCase()?{kind:"tw.lastKeyPressed"}:-1===t?{kind:"constant",value:0}:{kind:"args.stringNumber",index:t}}case"argument_reporter_boolean":{const B=A.fields.VALUE.value,t=this.script.arguments.lastIndexOf(B);return-1===t?"is compiled?"===B.toLowerCase()||"is turbowarp?"===B.toLowerCase()?{kind:"constant",value:!0}:{kind:"constant",value:0}:{kind:"args.boolean",index:t}}case"data_variable":return{kind:"var.get",variable:this.descendVariable(A,"VARIABLE","")};case"data_itemoflist":return{kind:"list.get",list:this.descendVariable(A,"LIST","list"),index:this.descendInputOfBlock(A,"INDEX")};case"data_lengthoflist":return{kind:"list.length",list:this.descendVariable(A,"LIST","list")};case"data_listcontainsitem":return{kind:"list.contains",list:this.descendVariable(A,"LIST","list"),item:this.descendInputOfBlock(A,"ITEM")};case"data_itemnumoflist":return{kind:"list.indexOf",list:this.descendVariable(A,"LIST","list"),item:this.descendInputOfBlock(A,"ITEM")};case"data_listcontents":return{kind:"list.contents",list:this.descendVariable(A,"LIST","list")};case"event_broadcast_menu":{const B=A.fields.BROADCAST_OPTION,t=this.target.lookupBroadcastMsg(B.id,B.value);return{kind:"constant",value:t?t.name:""}}case"looks_backdropnumbername":return"number"===A.fields.NUMBER_NAME.value?{kind:"looks.backdropNumber"}:{kind:"looks.backdropName"};case"looks_costumenumbername":return"number"===A.fields.NUMBER_NAME.value?{kind:"looks.costumeNumber"}:{kind:"looks.costumeName"};case"looks_size":return{kind:"looks.size"};case"motion_direction":return{kind:"motion.direction"};case"motion_xposition":return{kind:"motion.x"};case"motion_yposition":return{kind:"motion.y"};case"operator_add":return{kind:"op.add",left:this.descendInputOfBlock(A,"NUM1"),right:this.descendInputOfBlock(A,"NUM2")};case"operator_and":return{kind:"op.and",left:this.descendInputOfBlock(A,"OPERAND1"),right:this.descendInputOfBlock(A,"OPERAND2")};case"operator_contains":return{kind:"op.contains",string:this.descendInputOfBlock(A,"STRING1"),contains:this.descendInputOfBlock(A,"STRING2")};case"operator_divide":return{kind:"op.divide",left:this.descendInputOfBlock(A,"NUM1"),right:this.descendInputOfBlock(A,"NUM2")};case"operator_equals":return{kind:"op.equals",left:this.descendInputOfBlock(A,"OPERAND1"),right:this.descendInputOfBlock(A,"OPERAND2")};case"operator_gt":return{kind:"op.greater",left:this.descendInputOfBlock(A,"OPERAND1"),right:this.descendInputOfBlock(A,"OPERAND2")};case"operator_join":return{kind:"op.join",left:this.descendInputOfBlock(A,"STRING1"),right:this.descendInputOfBlock(A,"STRING2")};case"operator_length":return{kind:"op.length",string:this.descendInputOfBlock(A,"STRING")};case"operator_letter_of":return{kind:"op.letterOf",letter:this.descendInputOfBlock(A,"LETTER"),string:this.descendInputOfBlock(A,"STRING")};case"operator_lt":return{kind:"op.less",left:this.descendInputOfBlock(A,"OPERAND1"),right:this.descendInputOfBlock(A,"OPERAND2")};case"operator_mathop":{const B=this.descendInputOfBlock(A,"NUM");switch(A.fields.OPERATOR.value.toLowerCase()){case"abs":return{kind:"op.abs",value:B};case"floor":return{kind:"op.floor",value:B};case"ceiling":return{kind:"op.ceiling",value:B};case"sqrt":return{kind:"op.sqrt",value:B};case"sin":return{kind:"op.sin",value:B};case"cos":return{kind:"op.cos",value:B};case"tan":return{kind:"op.tan",value:B};case"asin":return{kind:"op.asin",value:B};case"acos":return{kind:"op.acos",value:B};case"atan":return{kind:"op.atan",value:B};case"ln":return{kind:"op.ln",value:B};case"log":return{kind:"op.log",value:B};case"e ^":return{kind:"op.e^",value:B};case"10 ^":return{kind:"op.10^",value:B};default:return{kind:"constant",value:0}}}case"operator_mod":return{kind:"op.mod",left:this.descendInputOfBlock(A,"NUM1"),right:this.descendInputOfBlock(A,"NUM2")};case"operator_multiply":return{kind:"op.multiply",left:this.descendInputOfBlock(A,"NUM1"),right:this.descendInputOfBlock(A,"NUM2")};case"operator_not":return{kind:"op.not",operand:this.descendInputOfBlock(A,"OPERAND")};case"operator_or":return{kind:"op.or",left:this.descendInputOfBlock(A,"OPERAND1"),right:this.descendInputOfBlock(A,"OPERAND2")};case"operator_random":{const B=this.descendInputOfBlock(A,"FROM"),t=this.descendInputOfBlock(A,"TO");if("constant"===B.kind&&"constant"===t.kind){const A=B.value,g=t.value,i=e.toNumber(A),Q=e.toNumber(g);return i===Q?{kind:"constant",value:i}:e.isInt(A)&&e.isInt(g)?{kind:"op.random",low:i<=Q?B:t,high:i<=Q?t:B,useInts:!0,useFloats:!1}:{kind:"op.random",low:i<=Q?B:t,high:i<=Q?t:B,useInts:!1,useFloats:!0}}if("constant"===B.kind){if(!e.isInt(e.toNumber(B.value)))return{kind:"op.random",low:B,high:t,useInts:!1,useFloats:!0}}else if("constant"===t.kind&&!e.isInt(e.toNumber(t.value)))return{kind:"op.random",low:B,high:t,useInts:!1,useFloats:!0};return{kind:"op.random",low:B,high:t,useInts:!1,useFloats:!1}}case"operator_round":return{kind:"op.round",value:this.descendInputOfBlock(A,"NUM")};case"operator_subtract":return{kind:"op.subtract",left:this.descendInputOfBlock(A,"NUM1"),right:this.descendInputOfBlock(A,"NUM2")};case"sensing_answer":return{kind:"sensing.answer"};case"sensing_coloristouchingcolor":return{kind:"sensing.colorTouchingColor",target:this.descendInputOfBlock(A,"COLOR2"),mask:this.descendInputOfBlock(A,"COLOR")};case"sensing_current":switch(A.fields.CURRENTMENU.value.toLowerCase()){case"year":return{kind:"sensing.year"};case"month":return{kind:"sensing.month"};case"date":return{kind:"sensing.date"};case"dayofweek":return{kind:"sensing.dayofweek"};case"hour":return{kind:"sensing.hour"};case"minute":return{kind:"sensing.minute"};case"second":return{kind:"sensing.second"}}return{kind:"constant",value:0};case"sensing_dayssince2000":return{kind:"sensing.daysSince2000"};case"sensing_distanceto":return{kind:"sensing.distance",target:this.descendInputOfBlock(A,"DISTANCETOMENU")};case"sensing_keypressed":return{kind:"keyboard.pressed",key:this.descendInputOfBlock(A,"KEY_OPTION")};case"sensing_mousedown":return{kind:"mouse.down"};case"sensing_mousex":return{kind:"mouse.x"};case"sensing_mousey":return{kind:"mouse.y"};case"sensing_of":return{kind:"sensing.of",property:A.fields.PROPERTY.value,object:this.descendInputOfBlock(A,"OBJECT")};case"sensing_timer":return this.usesTimer=!0,{kind:"timer.get"};case"sensing_touchingcolor":return{kind:"sensing.touchingColor",color:this.descendInputOfBlock(A,"COLOR")};case"sensing_touchingobject":return{kind:"sensing.touching",object:this.descendInputOfBlock(A,"TOUCHINGOBJECTMENU")};case"sensing_username":return{kind:"sensing.username"};case"sound_sounds_menu":return{kind:"constant",value:A.fields.SOUND_MENU.value};case"tw_getLastKeyPressed":return{kind:"tw.lastKeyPressed"};default:{if(this.runtime.getOpcodeFunction(A.opcode)){if(E.inputs.includes(A.opcode))return this.descendCompatLayer(A);const B=this.getBlockInfo(A.opcode);if(B){const t=B.info.blockType;if(t===i.REPORTER||t===i.BOOLEAN)return this.descendCompatLayer(A)}}const B=Object.keys(A.inputs),t=Object.keys(A.fields);if(0===B.length&&1===t.length)return{kind:"constant",value:A.fields[t[0]].value};throw s.warn("IR: Unknown input: ".concat(A.opcode),A),new Error("IR: Unknown input: ".concat(A.opcode))}}}descendStackedBlock(A){switch(A.opcode){case"control_all_at_once":return{kind:"control.if",condition:{kind:"constant",value:!0},whenTrue:this.descendSubstack(A,"SUBSTACK"),whenFalse:[]};case"control_create_clone_of":return{kind:"control.createClone",target:this.descendInputOfBlock(A,"CLONE_OPTION")};case"control_delete_this_clone":return this.script.yields=!0,{kind:"control.deleteClone"};case"control_forever":return this.analyzeLoop(),{kind:"control.while",condition:{kind:"constant",value:!0},do:this.descendSubstack(A,"SUBSTACK")};case"control_for_each":return this.analyzeLoop(),{kind:"control.for",variable:this.descendVariable(A,"VARIABLE",""),count:this.descendInputOfBlock(A,"VALUE"),do:this.descendSubstack(A,"SUBSTACK")};case"control_if":return{kind:"control.if",condition:this.descendInputOfBlock(A,"CONDITION"),whenTrue:this.descendSubstack(A,"SUBSTACK"),whenFalse:[]};case"control_if_else":return{kind:"control.if",condition:this.descendInputOfBlock(A,"CONDITION"),whenTrue:this.descendSubstack(A,"SUBSTACK"),whenFalse:this.descendSubstack(A,"SUBSTACK2")};case"control_repeat":return this.analyzeLoop(),{kind:"control.repeat",times:this.descendInputOfBlock(A,"TIMES"),do:this.descendSubstack(A,"SUBSTACK")};case"control_repeat_until":{this.analyzeLoop(),this.usesTimer=!1;const B=this.descendInputOfBlock(A,"CONDITION"),t=this.usesTimer;return t&&(this.script.yields=!0),{kind:"control.while",condition:{kind:"op.not",operand:B},do:this.descendSubstack(A,"SUBSTACK"),warpTimer:t}}case"control_stop":{const B=A.fields.STOP_OPTION.value;return"all"===B?(this.script.yields=!0,{kind:"control.stopAll"}):"other scripts in sprite"===B||"other scripts in stage"===B?{kind:"control.stopOthers"}:"this script"===B?{kind:"control.stopScript"}:{kind:"noop"}}case"control_wait":return this.script.yields=!0,{kind:"control.wait",seconds:this.descendInputOfBlock(A,"DURATION")};case"control_wait_until":return this.script.yields=!0,{kind:"control.waitUntil",condition:this.descendInputOfBlock(A,"CONDITION")};case"control_while":return this.analyzeLoop(),{kind:"control.while",condition:this.descendInputOfBlock(A,"CONDITION"),do:this.descendSubstack(A,"SUBSTACK"),warpTimer:!1};case"data_addtolist":return{kind:"list.add",list:this.descendVariable(A,"LIST","list"),item:this.descendInputOfBlock(A,"ITEM")};case"data_changevariableby":{const B=this.descendVariable(A,"VARIABLE","");return{kind:"var.set",variable:B,value:{kind:"op.add",left:{kind:"var.get",variable:B},right:this.descendInputOfBlock(A,"VALUE")}}}case"data_deletealloflist":return{kind:"list.deleteAll",list:this.descendVariable(A,"LIST","list")};case"data_deleteoflist":{const B=this.descendInputOfBlock(A,"INDEX");return"constant"===B.kind&&"all"===B.value?{kind:"list.deleteAll",list:this.descendVariable(A,"LIST","list")}:{kind:"list.delete",list:this.descendVariable(A,"LIST","list"),index:B}}case"data_hidelist":return{kind:"list.hide",list:this.descendVariable(A,"LIST","list")};case"data_hidevariable":return{kind:"var.hide",variable:this.descendVariable(A,"VARIABLE","")};case"data_insertatlist":return{kind:"list.insert",list:this.descendVariable(A,"LIST","list"),index:this.descendInputOfBlock(A,"INDEX"),item:this.descendInputOfBlock(A,"ITEM")};case"data_replaceitemoflist":return{kind:"list.replace",list:this.descendVariable(A,"LIST","list"),index:this.descendInputOfBlock(A,"INDEX"),item:this.descendInputOfBlock(A,"ITEM")};case"data_setvariableto":return{kind:"var.set",variable:this.descendVariable(A,"VARIABLE",""),value:this.descendInputOfBlock(A,"VALUE")};case"data_showlist":return{kind:"list.show",list:this.descendVariable(A,"LIST","list")};case"data_showvariable":return{kind:"var.show",variable:this.descendVariable(A,"VARIABLE","")};case"event_broadcast":return{kind:"event.broadcast",broadcast:this.descendInputOfBlock(A,"BROADCAST_INPUT")};case"event_broadcastandwait":return this.script.yields=!0,{kind:"event.broadcastAndWait",broadcast:this.descendInputOfBlock(A,"BROADCAST_INPUT")};case"looks_changeeffectby":return{kind:"looks.changeEffect",effect:A.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(A,"CHANGE")};case"looks_changesizeby":return{kind:"looks.changeSize",size:this.descendInputOfBlock(A,"CHANGE")};case"looks_cleargraphiceffects":return{kind:"looks.clearEffects"};case"looks_goforwardbackwardlayers":return"forward"===A.fields.FORWARD_BACKWARD.value?{kind:"looks.forwardLayers",layers:this.descendInputOfBlock(A,"NUM")}:{kind:"looks.backwardLayers",layers:this.descendInputOfBlock(A,"NUM")};case"looks_gotofrontback":return"front"===A.fields.FRONT_BACK.value?{kind:"looks.goToFront"}:{kind:"looks.goToBack"};case"looks_hide":return{kind:"looks.hide"};case"looks_nextbackdrop":return{kind:"looks.nextBackdrop"};case"looks_nextcostume":return{kind:"looks.nextCostume"};case"looks_seteffectto":return{kind:"looks.setEffect",effect:A.fields.EFFECT.value.toLowerCase(),value:this.descendInputOfBlock(A,"VALUE")};case"looks_setsizeto":return{kind:"looks.setSize",size:this.descendInputOfBlock(A,"SIZE")};case"looks_show":return{kind:"looks.show"};case"looks_switchbackdropto":return{kind:"looks.switchBackdrop",backdrop:this.descendInputOfBlock(A,"BACKDROP")};case"looks_switchcostumeto":return{kind:"looks.switchCostume",costume:this.descendInputOfBlock(A,"COSTUME")};case"motion_changexby":return{kind:"motion.changeX",dx:this.descendInputOfBlock(A,"DX")};case"motion_changeyby":return{kind:"motion.changeY",dy:this.descendInputOfBlock(A,"DY")};case"motion_gotoxy":return{kind:"motion.setXY",x:this.descendInputOfBlock(A,"X"),y:this.descendInputOfBlock(A,"Y")};case"motion_ifonedgebounce":return{kind:"motion.ifOnEdgeBounce"};case"motion_movesteps":return{kind:"motion.step",steps:this.descendInputOfBlock(A,"STEPS")};case"motion_pointindirection":return{kind:"motion.setDirection",direction:this.descendInputOfBlock(A,"DIRECTION")};case"motion_setrotationstyle":return{kind:"motion.setRotationStyle",style:A.fields.STYLE.value};case"motion_setx":return{kind:"motion.setX",x:this.descendInputOfBlock(A,"X")};case"motion_sety":return{kind:"motion.setY",y:this.descendInputOfBlock(A,"Y")};case"motion_turnleft":return{kind:"motion.setDirection",direction:{kind:"op.subtract",left:{kind:"motion.direction"},right:this.descendInputOfBlock(A,"DEGREES")}};case"motion_turnright":return{kind:"motion.setDirection",direction:{kind:"op.add",left:{kind:"motion.direction"},right:this.descendInputOfBlock(A,"DEGREES")}};case"pen_clear":return{kind:"pen.clear"};case"pen_changePenColorParamBy":return{kind:"pen.changeParam",param:this.descendInputOfBlock(A,"COLOR_PARAM"),value:this.descendInputOfBlock(A,"VALUE")};case"pen_changePenHueBy":return{kind:"pen.legacyChangeHue",hue:this.descendInputOfBlock(A,"HUE")};case"pen_changePenShadeBy":return{kind:"pen.legacyChangeShade",shade:this.descendInputOfBlock(A,"SHADE")};case"pen_penDown":return{kind:"pen.down"};case"pen_penUp":return{kind:"pen.up"};case"pen_setPenColorParamTo":return{kind:"pen.setParam",param:this.descendInputOfBlock(A,"COLOR_PARAM"),value:this.descendInputOfBlock(A,"VALUE")};case"pen_setPenColorToColor":return{kind:"pen.setColor",color:this.descendInputOfBlock(A,"COLOR")};case"pen_setPenHueToNumber":return{kind:"pen.legacySetHue",hue:this.descendInputOfBlock(A,"HUE")};case"pen_setPenShadeToNumber":return{kind:"pen.legacySetShade",shade:this.descendInputOfBlock(A,"SHADE")};case"pen_setPenSizeTo":return{kind:"pen.setSize",size:this.descendInputOfBlock(A,"SIZE")};case"pen_changePenSizeBy":return{kind:"pen.changeSize",size:this.descendInputOfBlock(A,"SIZE")};case"pen_stamp":return{kind:"pen.stamp"};case"procedures_call":{const t=A.mutation.proccode;if("tw:debugger;"===t)return{kind:"tw.debugger"};const e=this.blocks.getProcedureParamNamesIdsAndDefaults(t);if(null===e)return{kind:"noop"};const[g,i,Q]=e;if(this.runtime.getAddonBlock(t)){this.script.yields=!0;const B={};for(let t=0;t0;){this.compilingProcedures=this.proceduresToCompile,this.proceduresToCompile=new Map;for(const[A,t]of this.compilingProcedures.entries())if(B[A]){const t=B[A];this.procedures[A]=t,this.addProcedureDependencies(t.dependedProcedures)}else{const e="W"===A.charAt(0),g=new w(this.thread);g.setProcedureVariant(A),e&&g.enableWarp();const i=this.generateScriptTree(g,t);this.procedures[A]=i,B[A]=i}}for(;this.analyzeScript(A););const t=new r;return t.entry=A,t.procedures=this.procedures,t}}},function(A,B){A.exports={stacked:["control_clear_counter","control_incr_counter","looks_changestretchby","looks_hideallsprites","looks_say","looks_sayforsecs","looks_setstretchto","looks_switchbackdroptoandwait","looks_think","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:["control_get_counter","motion_xscroll","motion_yscroll","sensing_loud","sensing_loudness","sensing_userid","sound_volume"]}},function(A,B,t){const e=t(0),g=t(1),i=t(206),Q=t(71),s=t(208),{IntermediateScript:n,IntermediateRepresentation:r}=t(70),E=A=>("string"!=typeof A&&(e.warn("sanitize got unexpected type: ".concat(typeof A)),A=""+A),JSON.stringify(A).slice(1,-1)),c="runtime.ext_pen",o="".concat(c,"._getPenState(target)"),w=new i("factory"),C=new i("fun"),a=new i("gen");class I{constructor(A,B){if("number"!=typeof B)throw new Error("type is invalid");this.source=A,this.type=B}asNumber(){return 1===this.type?this.source:5===this.type?"(".concat(this.source," || 0)"):"(+".concat(this.source," || 0)")}asNumberOrNaN(){return 1===this.type||5===this.type?this.source:"(+".concat(this.source,")")}asString(){return 2===this.type?this.source:'("" + '.concat(this.source,")")}asBoolean(){return 3===this.type?this.source:"toBoolean(".concat(this.source,")")}asUnknown(){return this.source}asSafe(){return this.asUnknown()}isAlwaysNumber(){return 1===this.type}isAlwaysNumberOrNaN(){return 1===this.type||5===this.type}isNeverNumber(){return!1}}class Y{constructor(A,B){this.constantValue=A,this.safe=B}asNumber(){const A=+this.constantValue;return A?A.toString():Object.is(A,-0)?"-0":"0"}asNumberOrNaN(){return this.asNumber()}asString(){return'"'.concat(E(""+this.constantValue),'"')}asBoolean(){return g.toBoolean(this.constantValue).toString()}asUnknown(){if("number"==typeof this.constantValue)return this.constantValue;return(+this.constantValue).toString()===this.constantValue?this.constantValue:this.asString()}asSafe(){return this.safe?this.asUnknown():this.asString()}isAlwaysNumber(){const A=+this.constantValue;return!Number.isNaN(A)&&(0!==A||""!==this.constantValue.toString().trim())}isAlwaysNumberOrNaN(){return this.isAlwaysNumber()}isNeverNumber(){return Number.isNaN(+this.constantValue)}}class h{constructor(A){this.source=A,this.type=4,this._value=null}setInput(A){if(A instanceof h){if(!A._value)return this.type=4,void(this._value=null);A=A._value}this._value=A,this.type=A instanceof I?A.type:4}asNumber(){return 1===this.type?this.source:5===this.type?"(".concat(this.source," || 0)"):"(+".concat(this.source," || 0)")}asNumberOrNaN(){return 1===this.type||5===this.type?this.source:"(+".concat(this.source,")")}asString(){return 2===this.type?this.source:'("" + '.concat(this.source,")")}asBoolean(){return 3===this.type?this.source:"toBoolean(".concat(this.source,")")}asUnknown(){return this.source}asSafe(){return this.asUnknown()}isAlwaysNumber(){return!!this._value&&this._value.isAlwaysNumber()}isAlwaysNumberOrNaN(){return!!this._value&&this._value.isAlwaysNumberOrNaN()}isNeverNumber(){return!!this._value&&this._value.isNeverNumber()}}const M=A=>{const B=+A.constantValue;return!!B&&B.toString()===A.constantValue.toString()};class F{constructor(A){this.isLoop=A,this.isLastBlock=!1}}A.exports=class{constructor(A,B,t){this.script=A,this.ir=B,this.target=t,this.source="",this.variableInputs={},this.isWarp=A.isWarp,this.isProcedure=A.isProcedure,this.warpTimer=A.warpTimer,this.frames=[],this.currentFrame=null,this.namesOfCostumesAndSounds=(A=>{const B=new Set;for(const t of A.targets)if(t.isOriginal){const A=t.sprite;for(const t of A.costumes)B.add(t.name);for(const t of A.sounds)B.add(t.name)}return B})(t.runtime),this.localVariables=new i("a"),this._setupVariablesPool=new i("b"),this._setupVariables={},this.descendedIntoModulo=!1,this.debug=this.target.runtime.debug}pushFrame(A){this.frames.push(A),this.currentFrame=A}popFrame(){this.frames.pop(),this.currentFrame=this.frames[this.frames.length-1]}isLastBlockInLoop(){for(let A=this.frames.length-1;A>=0;A--){const B=this.frames[A];if(!B.isLastBlock)return!1;if(B.isLoop)return!0}return!1}descendInput(A){switch(A.kind){case"args.boolean":return new I("toBoolean(p".concat(A.index,")"),3);case"args.stringNumber":return new I("p".concat(A.index),4);case"compat":return new I("(".concat(this.generateCompatibilityLayerCall(A,!1),")"),4);case"constant":return this.safeConstantInput(A.value);case"keyboard.pressed":return new I("runtime.ioDevices.keyboard.getKeyIsDown(".concat(this.descendInput(A.key).asSafe(),")"),3);case"list.contains":return new I("listContains(".concat(this.referenceVariable(A.list),", ").concat(this.descendInput(A.item).asUnknown(),")"),3);case"list.contents":return new I("listContents(".concat(this.referenceVariable(A.list),")"),2);case"list.get":{const B=this.descendInput(A.index);if(s.supportsNullishCoalescing){if(B.isAlwaysNumberOrNaN())return new I("(".concat(this.referenceVariable(A.list),".value[(").concat(B.asNumber(),' | 0) - 1] ?? "")'),4);if(B instanceof Y&&"last"===B.constantValue)return new I("(".concat(this.referenceVariable(A.list),".value[").concat(this.referenceVariable(A.list),'.value.length - 1] ?? "")'),4)}return new I("listGet(".concat(this.referenceVariable(A.list),".value, ").concat(B.asUnknown(),")"),4)}case"list.indexOf":return new I("listIndexOf(".concat(this.referenceVariable(A.list),", ").concat(this.descendInput(A.item).asUnknown(),")"),1);case"list.length":return new I("".concat(this.referenceVariable(A.list),".value.length"),1);case"looks.size":return new I("Math.round(target.size)",1);case"looks.backdropName":return new I("stage.getCostumes()[stage.currentCostume].name",2);case"looks.backdropNumber":return new I("(stage.currentCostume + 1)",1);case"looks.costumeName":return new I("target.getCostumes()[target.currentCostume].name",2);case"looks.costumeNumber":return new I("(target.currentCostume + 1)",1);case"motion.direction":return new I("target.direction",1);case"motion.x":return new I("limitPrecision(target.x)",1);case"motion.y":return new I("limitPrecision(target.y)",1);case"mouse.down":return new I("runtime.ioDevices.mouse.getIsDown()",3);case"mouse.x":return new I("runtime.ioDevices.mouse.getScratchX()",1);case"mouse.y":return new I("runtime.ioDevices.mouse.getScratchY()",1);case"op.abs":return new I("Math.abs(".concat(this.descendInput(A.value).asNumber(),")"),1);case"op.acos":return new I("((Math.acos(".concat(this.descendInput(A.value).asNumber(),") * 180) / Math.PI)"),5);case"op.add":return new I("(".concat(this.descendInput(A.left).asNumber()," + ").concat(this.descendInput(A.right).asNumber(),")"),5);case"op.and":return new I("(".concat(this.descendInput(A.left).asBoolean()," && ").concat(this.descendInput(A.right).asBoolean(),")"),3);case"op.asin":return new I("((Math.asin(".concat(this.descendInput(A.value).asNumber(),") * 180) / Math.PI)"),5);case"op.atan":return new I("((Math.atan(".concat(this.descendInput(A.value).asNumber(),") * 180) / Math.PI)"),1);case"op.ceiling":return new I("Math.ceil(".concat(this.descendInput(A.value).asNumber(),")"),1);case"op.contains":return new I("(".concat(this.descendInput(A.string).asString(),".toLowerCase().indexOf(").concat(this.descendInput(A.contains).asString(),".toLowerCase()) !== -1)"),3);case"op.cos":return new I("(Math.round(Math.cos((Math.PI * ".concat(this.descendInput(A.value).asNumber(),") / 180) * 1e10) / 1e10)"),1);case"op.divide":return new I("(".concat(this.descendInput(A.left).asNumber()," / ").concat(this.descendInput(A.right).asNumber(),")"),5);case"op.equals":{const B=this.descendInput(A.left),t=this.descendInput(A.right);if(B.isNeverNumber()||t.isNeverNumber())return new I("(".concat(B.asString(),".toLowerCase() === ").concat(t.asString(),".toLowerCase())"),3);const e=B.isAlwaysNumber(),g=t.isAlwaysNumber();return e&&g||(e&&B instanceof Y&&M(B)||g&&t instanceof Y&&M(t))?new I("(".concat(B.asNumber()," === ").concat(t.asNumber(),")"),3):new I("compareEqual(".concat(B.asUnknown(),", ").concat(t.asUnknown(),")"),3)}case"op.e^":return new I("Math.exp(".concat(this.descendInput(A.value).asNumber(),")"),1);case"op.floor":return new I("Math.floor(".concat(this.descendInput(A.value).asNumber(),")"),1);case"op.greater":{const B=this.descendInput(A.left),t=this.descendInput(A.right);return B.isAlwaysNumber()&&t.isAlwaysNumberOrNaN()?new I("(".concat(B.asNumber()," > ").concat(t.asNumberOrNaN(),")"),3):B.isAlwaysNumberOrNaN()&&t.isAlwaysNumber()?new I("!(".concat(B.asNumberOrNaN()," <= ").concat(t.asNumber(),")"),3):B.isNeverNumber()||t.isNeverNumber()?new I("(".concat(B.asString(),".toLowerCase() > ").concat(t.asString(),".toLowerCase())"),3):new I("compareGreaterThan(".concat(B.asUnknown(),", ").concat(t.asUnknown(),")"),3)}case"op.join":return new I("(".concat(this.descendInput(A.left).asString()," + ").concat(this.descendInput(A.right).asString(),")"),2);case"op.length":return new I("".concat(this.descendInput(A.string).asString(),".length"),1);case"op.less":{const B=this.descendInput(A.left),t=this.descendInput(A.right);return B.isAlwaysNumberOrNaN()&&t.isAlwaysNumber()?new I("(".concat(B.asNumberOrNaN()," < ").concat(t.asNumber(),")"),3):B.isAlwaysNumber()&&t.isAlwaysNumberOrNaN()?new I("!(".concat(B.asNumber()," >= ").concat(t.asNumberOrNaN(),")"),3):B.isNeverNumber()||t.isNeverNumber()?new I("(".concat(B.asString(),".toLowerCase() < ").concat(t.asString(),".toLowerCase())"),3):new I("compareLessThan(".concat(B.asUnknown(),", ").concat(t.asUnknown(),")"),3)}case"op.letterOf":return new I("((".concat(this.descendInput(A.string).asString(),")[(").concat(this.descendInput(A.letter).asNumber(),' | 0) - 1] || "")'),2);case"op.ln":return new I("Math.log(".concat(this.descendInput(A.value).asNumber(),")"),5);case"op.log":return new I("(Math.log(".concat(this.descendInput(A.value).asNumber(),") / Math.LN10)"),5);case"op.mod":return this.descendedIntoModulo=!0,new I("mod(".concat(this.descendInput(A.left).asNumber(),", ").concat(this.descendInput(A.right).asNumber(),")"),5);case"op.multiply":return new I("(".concat(this.descendInput(A.left).asNumber()," * ").concat(this.descendInput(A.right).asNumber(),")"),5);case"op.not":return new I("!".concat(this.descendInput(A.operand).asBoolean()),3);case"op.or":return new I("(".concat(this.descendInput(A.left).asBoolean()," || ").concat(this.descendInput(A.right).asBoolean(),")"),3);case"op.random":return A.useInts?new I("randomInt(".concat(this.descendInput(A.low).asNumber(),", ").concat(this.descendInput(A.high).asNumber(),")"),1):A.useFloats?new I("randomFloat(".concat(this.descendInput(A.low).asNumber(),", ").concat(this.descendInput(A.high).asNumber(),")"),1):new I("runtime.ext_scratch3_operators._random(".concat(this.descendInput(A.low).asUnknown(),", ").concat(this.descendInput(A.high).asUnknown(),")"),1);case"op.round":return new I("Math.round(".concat(this.descendInput(A.value).asNumber(),")"),1);case"op.sin":return new I("(Math.round(Math.sin((Math.PI * ".concat(this.descendInput(A.value).asNumber(),") / 180) * 1e10) / 1e10)"),1);case"op.sqrt":return new I("Math.sqrt(".concat(this.descendInput(A.value).asNumber(),")"),5);case"op.subtract":return new I("(".concat(this.descendInput(A.left).asNumber()," - ").concat(this.descendInput(A.right).asNumber(),")"),5);case"op.tan":return new I("Math.tan(".concat(this.descendInput(A.value).asNumber()," * Math.PI / 180)"),1);case"op.10^":return new I("(10 ** ".concat(this.descendInput(A.value).asNumber(),")"),1);case"sensing.answer":return new I("runtime.ext_scratch3_sensing._answer",2);case"sensing.colorTouchingColor":return new I("target.colorIsTouchingColor(colorToList(".concat(this.descendInput(A.target).asUnknown(),"), colorToList(").concat(this.descendInput(A.mask).asUnknown(),"))"),3);case"sensing.date":return new I("(new Date().getDate())",1);case"sensing.dayofweek":return new I("(new Date().getDay() + 1)",1);case"sensing.daysSince2000":return new I("daysSince2000()",1);case"sensing.distance":return new I("distance(".concat(this.descendInput(A.target).asString(),")"),1);case"sensing.hour":return new I("(new Date().getHours())",1);case"sensing.minute":return new I("(new Date().getMinutes())",1);case"sensing.month":return new I("(new Date().getMonth() + 1)",1);case"sensing.of":{const B=this.descendInput(A.object).asString(),t=A.property;if("constant"===A.object.kind){const e="_stage_"===A.object.value,g=e?"stage":this.evaluateOnce("runtime.getSpriteTargetByName(".concat(B,")"));if("volume"===t)return new I("(".concat(g," ? ").concat(g,".volume : 0)"),1);if(e)switch(t){case"background #":case"backdrop #":return new I("(".concat(g,".currentCostume + 1)"),1);case"backdrop name":return new I("".concat(g,".getCostumes()[").concat(g,".currentCostume].name"),2)}else switch(t){case"x position":return new I("(".concat(g," ? ").concat(g,".x : 0)"),1);case"y position":return new I("(".concat(g," ? ").concat(g,".y : 0)"),1);case"direction":return new I("(".concat(g," ? ").concat(g,".direction : 0)"),1);case"costume #":return new I("(".concat(g," ? ").concat(g,".currentCostume + 1 : 0)"),1);case"costume name":return new I("(".concat(g," ? ").concat(g,".getCostumes()[").concat(g,".currentCostume].name : 0)"),4);case"size":return new I("(".concat(g," ? ").concat(g,".size : 0)"),1)}const i=this.evaluateOnce("".concat(g," && ").concat(g,'.lookupVariableByNameAndType("').concat(E(t),'", "", true)'));return new I("(".concat(i," ? ").concat(i,".value : 0)"),4)}return new I("runtime.ext_scratch3_sensing.getAttributeOf({OBJECT: ".concat(B,', PROPERTY: "').concat(E(t),'" })'),4)}case"sensing.second":return new I("(new Date().getSeconds())",1);case"sensing.touching":return new I("target.isTouchingObject(".concat(this.descendInput(A.object).asUnknown(),")"),3);case"sensing.touchingColor":return new I("target.isTouchingColor(colorToList(".concat(this.descendInput(A.color).asUnknown(),"))"),3);case"sensing.username":return new I("runtime.ioDevices.userData.getUsername()",2);case"sensing.year":return new I("(new Date().getFullYear())",1);case"timer.get":return new I("runtime.ioDevices.clock.projectTimer()",1);case"tw.lastKeyPressed":return new I("runtime.ioDevices.keyboard.getLastKeyPressed()",2);case"var.get":return this.descendVariable(A.variable);default:throw e.warn("JS: Unknown input: ".concat(A.kind),A),new Error("JS: Unknown input: ".concat(A.kind))}}descendStackedBlock(A){switch(A.kind){case"addons.call":this.source+='yield* callAddonBlock("'.concat(E(A.code),'","').concat(E(A.blockId),'",{'),this.yielded();for(const B of Object.keys(A.arguments)){const t=A.arguments[B];this.source+='"'.concat(E(B),'":').concat(this.descendInput(t).asSafe(),",")}this.source+="});\n";break;case"compat":{const B=this.isLastBlockInLoop();this.source+="".concat(this.generateCompatibilityLayerCall(A,B),";\n"),B&&(this.source+="if (hasResumedFromPromise) {hasResumedFromPromise = false;continue;}\n");break}case"control.createClone":this.source+="runtime.ext_scratch3_control._createClone(".concat(this.descendInput(A.target).asString(),", target);\n");break;case"control.deleteClone":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"control.for":{this.resetVariableInputs();const B=this.localVariables.next();this.source+="var ".concat(B," = 0; "),this.source+="while (".concat(B," < ").concat(this.descendInput(A.count).asNumber(),") { "),this.source+="".concat(B,"++; "),this.source+="".concat(this.referenceVariable(A.variable),".value = ").concat(B,";\n"),this.descendStack(A.do,new F(!0)),this.yieldLoop(),this.source+="}\n";break}case"control.if":this.source+="if (".concat(this.descendInput(A.condition).asBoolean(),") {\n"),this.descendStack(A.whenTrue,new F(!1)),A.whenFalse.length&&(this.source+="} else {\n",this.descendStack(A.whenFalse,new F(!1))),this.source+="}\n";break;case"control.repeat":{const B=this.localVariables.next();this.source+="for (var ".concat(B," = ").concat(this.descendInput(A.times).asNumber(),"; ").concat(B," >= 0.5; ").concat(B,"--) {\n"),this.descendStack(A.do,new F(!0)),this.yieldLoop(),this.source+="}\n";break}case"control.stopAll":this.source+="runtime.stopAll();\n",this.retire();break;case"control.stopOthers":this.source+="runtime.stopForTarget(target, thread);\n";break;case"control.stopScript":this.isProcedure?this.source+="return;\n":this.retire();break;case"control.wait":{const B=this.localVariables.next();this.source+="thread.timer = timer();\n",this.source+="var ".concat(B," = Math.max(0, 1000 * ").concat(this.descendInput(A.seconds).asNumber(),");\n"),this.requestRedraw(),this.yieldNotWarp(),this.source+="while (thread.timer.timeElapsed() < ".concat(B,") {\n"),this.yieldStuckOrNotWarp(),this.source+="}\n",this.source+="thread.timer = null;\n";break}case"control.waitUntil":this.resetVariableInputs(),this.source+="while (!".concat(this.descendInput(A.condition).asBoolean(),") {\n"),this.yieldStuckOrNotWarp(),this.source+="}\n";break;case"control.while":this.resetVariableInputs(),this.source+="while (".concat(this.descendInput(A.condition).asBoolean(),") {\n"),this.descendStack(A.do,new F(!0)),A.warpTimer?this.yieldStuckOrNotWarp():this.yieldLoop(),this.source+="}\n";break;case"event.broadcast":this.source+='startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: '.concat(this.descendInput(A.broadcast).asString()," });\n"),this.resetVariableInputs();break;case"event.broadcastAndWait":this.source+='yield* waitThreads(startHats("event_whenbroadcastreceived", { BROADCAST_OPTION: '.concat(this.descendInput(A.broadcast).asString()," }));\n"),this.yielded();break;case"list.add":{const B=this.referenceVariable(A.list);this.source+="".concat(B,".value.push(").concat(this.descendInput(A.item).asSafe(),");\n"),this.source+="".concat(B,"._monitorUpToDate = false;\n");break}case"list.delete":{const B=this.referenceVariable(A.list),t=this.descendInput(A.index);if(t instanceof Y){if("last"===t.constantValue){this.source+="".concat(B,".value.pop();\n"),this.source+="".concat(B,"._monitorUpToDate = false;\n");break}if(1==+t.constantValue){this.source+="".concat(B,".value.shift();\n"),this.source+="".concat(B,"._monitorUpToDate = false;\n");break}}this.source+="listDelete(".concat(B,", ").concat(t.asUnknown(),");\n");break}case"list.deleteAll":this.source+="".concat(this.referenceVariable(A.list),".value = [];\n");break;case"list.hide":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(E(A.list.id),'", element: "checkbox", value: false }, runtime);\n');break;case"list.insert":{const B=this.referenceVariable(A.list),t=this.descendInput(A.index),e=this.descendInput(A.item);if(t instanceof Y&&1==+t.constantValue){this.source+="".concat(B,".value.unshift(").concat(e.asSafe(),");\n"),this.source+="".concat(B,"._monitorUpToDate = false;\n");break}this.source+="listInsert(".concat(B,", ").concat(t.asUnknown(),", ").concat(e.asSafe(),");\n");break}case"list.replace":this.source+="listReplace(".concat(this.referenceVariable(A.list),", ").concat(this.descendInput(A.index).asUnknown(),", ").concat(this.descendInput(A.item).asSafe(),");\n");break;case"list.show":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(E(A.list.id),'", element: "checkbox", value: true }, runtime);\n');break;case"looks.backwardLayers":this.target.isStage||(this.source+="target.goBackwardLayers(".concat(this.descendInput(A.layers).asNumber(),");\n"));break;case"looks.clearEffects":this.source+="target.clearEffects();\n";break;case"looks.changeEffect":this.target.effects.hasOwnProperty(A.effect)&&(this.source+='target.setEffect("'.concat(E(A.effect),'", runtime.ext_scratch3_looks.clampEffect("').concat(E(A.effect),'", ').concat(this.descendInput(A.value).asNumber(),' + target.effects["').concat(E(A.effect),'"]));\n'));break;case"looks.changeSize":this.source+="target.setSize(target.size + ".concat(this.descendInput(A.size).asNumber(),");\n");break;case"looks.forwardLayers":this.target.isStage||(this.source+="target.goForwardLayers(".concat(this.descendInput(A.layers).asNumber(),");\n"));break;case"looks.goToBack":this.target.isStage||(this.source+="target.goToBack();\n");break;case"looks.goToFront":this.target.isStage||(this.source+="target.goToFront();\n");break;case"looks.hide":this.source+="target.setVisible(false);\n",this.source+="runtime.ext_scratch3_looks._renderBubble(target);\n";break;case"looks.nextBackdrop":this.source+="runtime.ext_scratch3_looks._setBackdrop(stage, stage.currentCostume + 1, true);\n";break;case"looks.nextCostume":this.source+="target.setCostume(target.currentCostume + 1);\n";break;case"looks.setEffect":this.target.effects.hasOwnProperty(A.effect)&&(this.source+='target.setEffect("'.concat(E(A.effect),'", runtime.ext_scratch3_looks.clampEffect("').concat(E(A.effect),'", ').concat(this.descendInput(A.value).asNumber(),"));\n"));break;case"looks.setSize":this.source+="target.setSize(".concat(this.descendInput(A.size).asNumber(),");\n");break;case"looks.show":this.source+="target.setVisible(true);\n",this.source+="runtime.ext_scratch3_looks._renderBubble(target);\n";break;case"looks.switchBackdrop":this.source+="runtime.ext_scratch3_looks._setBackdrop(stage, ".concat(this.descendInput(A.backdrop).asSafe(),");\n");break;case"looks.switchCostume":this.source+="runtime.ext_scratch3_looks._setCostume(target, ".concat(this.descendInput(A.costume).asSafe(),");\n");break;case"motion.changeX":this.source+="target.setXY(target.x + ".concat(this.descendInput(A.dx).asNumber(),", target.y);\n");break;case"motion.changeY":this.source+="target.setXY(target.x, target.y + ".concat(this.descendInput(A.dy).asNumber(),");\n");break;case"motion.ifOnEdgeBounce":this.source+="runtime.ext_scratch3_motion._ifOnEdgeBounce(target);\n";break;case"motion.setDirection":this.source+="target.setDirection(".concat(this.descendInput(A.direction).asNumber(),");\n");break;case"motion.setRotationStyle":this.source+='target.setRotationStyle("'.concat(E(A.style),'");\n');break;case"motion.setX":case"motion.setY":case"motion.setXY":{this.descendedIntoModulo=!1;const B="x"in A?this.descendInput(A.x).asNumber():"target.x",t="y"in A?this.descendInput(A.y).asNumber():"target.y";this.source+="target.setXY(".concat(B,", ").concat(t,");\n"),this.descendedIntoModulo&&(this.source+="if (target.interpolationData) target.interpolationData = null;\n");break}case"motion.step":this.source+="runtime.ext_scratch3_motion._moveSteps(".concat(this.descendInput(A.steps).asNumber(),", target);\n");break;case"noop":break;case"pen.clear":this.source+="".concat(c,".clear();\n");break;case"pen.down":this.source+="".concat(c,"._penDown(target);\n");break;case"pen.changeParam":this.source+="".concat(c,"._setOrChangeColorParam(").concat(this.descendInput(A.param).asString(),", ").concat(this.descendInput(A.value).asNumber(),", ").concat(o,", true);\n");break;case"pen.changeSize":this.source+="".concat(c,"._changePenSizeBy(").concat(this.descendInput(A.size).asNumber(),", target);\n");break;case"pen.legacyChangeHue":this.source+="".concat(c,"._changePenHueBy(").concat(this.descendInput(A.hue).asNumber(),", target);\n");break;case"pen.legacyChangeShade":this.source+="".concat(c,"._changePenShadeBy(").concat(this.descendInput(A.shade).asNumber(),", target);\n");break;case"pen.legacySetHue":this.source+="".concat(c,"._setPenHueToNumber(").concat(this.descendInput(A.hue).asNumber(),", target);\n");break;case"pen.legacySetShade":this.source+="".concat(c,"._setPenShadeToNumber(").concat(this.descendInput(A.shade).asNumber(),", target);\n");break;case"pen.setColor":this.source+="".concat(c,"._setPenColorToColor(").concat(this.descendInput(A.color).asUnknown(),", target);\n");break;case"pen.setParam":this.source+="".concat(c,"._setOrChangeColorParam(").concat(this.descendInput(A.param).asString(),", ").concat(this.descendInput(A.value).asNumber(),", ").concat(o,", false);\n");break;case"pen.setSize":this.source+="".concat(c,"._setPenSizeTo(").concat(this.descendInput(A.size).asNumber(),", target);\n");break;case"pen.stamp":this.source+="".concat(c,"._stamp(target);\n");break;case"pen.up":this.source+="".concat(c,"._penUp(target);\n");break;case"procedures.call":{const B=A.code,t=A.variant,e=this.ir.procedures[t];if(null===e.stack)break;if(this.isWarp||B!==this.script.procedureCode||this.yieldNotWarp(),e.yields&&(this.source+="yield* ",!this.script.yields))throw new Error("Script uses yielding procedure but is not marked as yielding.");if(this.source+='thread.procedures["'.concat(E(t),'"]('),e.arguments.length){const B=[];for(const t of A.arguments)B.push(this.descendInput(t).asSafe());this.source+=B.join(",")}this.source+=");\n",this.resetVariableInputs();break}case"timer.reset":this.source+="runtime.ioDevices.clock.resetProjectTimer();\n";break;case"tw.debugger":this.source+="debugger;\n";break;case"var.hide":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(E(A.variable.id),'", element: "checkbox", value: false }, runtime);\n');break;case"var.set":{const B=this.descendVariable(A.variable),t=this.descendInput(A.value);B.setInput(t),this.source+="".concat(B.source," = ").concat(t.asSafe(),";\n"),A.variable.isCloud&&(this.source+='runtime.ioDevices.cloud.requestUpdateVariable("'.concat(E(A.variable.name),'", ').concat(B.source,");\n"));break}case"var.show":this.source+='runtime.monitorBlocks.changeBlock({ id: "'.concat(E(A.variable.id),'", element: "checkbox", value: true }, runtime);\n');break;case"visualReport":{const B=this.localVariables.next();this.source+="const ".concat(B," = ").concat(this.descendInput(A.input).asUnknown(),";"),this.source+="if (".concat(B,' !== undefined) runtime.visualReport("').concat(E(this.script.topBlockId),'", ').concat(B,");\n");break}default:throw e.warn("JS: Unknown stacked block: ".concat(A.kind),A),new Error("JS: Unknown stacked block: ".concat(A.kind))}}resetVariableInputs(){this.variableInputs={}}descendStack(A,B){this.resetVariableInputs(),this.pushFrame(B);for(let t=0;t{try{new Function("undefined ?? 3");return!0}catch(A){return!1}})()}},function(A,B){A.exports={OUTPUT_SHAPE_HEXAGONAL:1,OUTPUT_SHAPE_ROUND:2,OUTPUT_SHAPE_SQUARE:3}},function(A,B){A.exports=class{constructor(A){this._type=A,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 A;switch(this._type){case"BLE":A="scratch/ble";break;case"BT":A="scratch/bt";break;default:throw new Error("Unknown ScratchLink socket Type: ".concat(this._type))}const B=(A,B)=>{B.onopen=B.onerror=null,B.close(),this._ws=A,this._ws.onopen=this._onOpen,this._ws.onclose=this._onClose,this._ws.onerror=this._onError,this._ws.onmessage=this._onMessage.bind(this)},t=new WebSocket("ws://127.0.0.1:20111/".concat(A)),e=new WebSocket("wss://device-manager.scratch.mit.edu:20110/".concat(A)),g=setTimeout(()=>{B(t,e),this._ws.onerror(new Event("timeout"))},15e3);let i,Q;t.onopen=A=>{clearTimeout(g),B(t,e),this._ws.onopen(A)},e.onopen=A=>{clearTimeout(g),B(e,t),this._ws.onopen(A)};const s=()=>{i&&Q&&(clearTimeout(g),B(t,e),this._ws.onerror(i))};t.onerror=A=>{i=A,s()},e.onerror=A=>{Q=A,s()}}close(){this._ws.close(),this._ws=null}sendMessage(A){const B=JSON.stringify(A);this._ws.send(B)}setOnOpen(A){this._onOpen=A}setOnClose(A){this._onClose=A}setOnError(A){this._onError=A}setHandleMessage(A){this._handleMessage=A}isOpen(){return this._ws&&this._ws.readyState===this._ws.OPEN}_onMessage(A){const B=JSON.parse(A.data);this._handleMessage(B)}}},function(A,B,t){const e=t(15);A.exports=class{constructor(A){this._projectTimer=new e({now:()=>A.currentMSecs}),this._projectTimer.start(),this._pausedTime=null,this._paused=!1,this.runtime=A}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 A=this._projectTimer.timeElapsed()-this._pausedTime;this._projectTimer.startTime+=A}resetProjectTimer(){this._projectTimer.start()}}},function(A,B,t){const e=t(8),g=t(0);A.exports=class{constructor(A){this.provider=null,this.runtime=A,this.stage=null}setProvider(A){this.provider=A}setStage(A){this.stage=A}postData(A){A.varUpdate&&this.updateCloudVariable(A.varUpdate)}requestCreateVariable(A){this.runtime.canAddCloudVariable()&&this.provider&&this.provider.createVariable(A.name,A.value)}requestUpdateVariable(A,B){this.provider&&this.provider.updateVariable(A,B)}requestRenameVariable(A,B){this.provider&&this.provider.renameVariable(A,B)}requestDeleteVariable(A){this.provider&&this.provider.deleteVariable(A)}updateCloudVariable(A){const B=A.name,t=this.stage.lookupVariableByNameAndType(B,e.SCALAR_TYPE);t&&t.isCloud?t.value=A.value:g.warn("Received an update for a cloud variable that does not exist: ".concat(B))}clear(){this.provider&&(this.provider.requestCloseConnection(),this.provider=null,this.stage=null)}}},function(A,B,t){const e=t(1),g={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"},i=Object.keys(g).map(A=>g[A]);A.exports=class{constructor(A){this._keysPressed=[],this.runtime=A,this.lastKeyPressed="",this._numeralKeyCodesToStringKey=new Map}_keyStringToScratchKey(A){switch(A=e.toString(A)){case" ":return g.SPACE;case"ArrowLeft":case"Left":return g.LEFT;case"ArrowUp":case"Up":return g.UP;case"Right":case"ArrowRight":return g.RIGHT;case"Down":case"ArrowDown":return g.DOWN;case"Enter":return g.ENTER;case"Backspace":return g.BACKSPACE;case"Delete":return g.DELETE;case"Shift":return g.SHIFT;case"CapsLock":return g.CAPS_LOCK;case"ScrollLock":return g.SCROLL_LOCK;case"Control":return g.CONTROL;case"Escape":return g.ESCAPE;case"Insert":return g.INSERT;case"Home":return g.HOME;case"End":return g.END;case"PageUp":return g.PAGE_UP;case"PageDown":return g.PAGE_DOWN}return A.length>1?"":A}_keyArgToScratchKey(A){if("number"==typeof A){if(A>=48&&A<=90)return String.fromCharCode(A);switch(A){case 32:return g.SPACE;case 37:return g.LEFT;case 38:return g.UP;case 39:return g.RIGHT;case 40:return g.DOWN}}return A=e.toString(A),i.includes(A)?A:(A.length>1&&(A=A[0])," "===A?g.SPACE:"\r"===A?g.ENTER:""===A?g.ESCAPE:A.toUpperCase())}postData(A){if(!A.key)return;const B=this._keyStringToScratchKey(A.key),t=1===B.length?B.toUpperCase():B;if(""===t)return;const e=this._keysPressed.indexOf(t);if(A.isDown?(this.lastKeyPressed=B,this.runtime.emit("KEY_PRESSED",t),e<0&&this._keysPressed.push(t)):e>-1&&this._keysPressed.splice(e,1),A.hasOwnProperty("keyCode")){const B=A.keyCode;if(this._numeralKeyCodesToStringKey.has(B)){const A=this._numeralKeyCodesToStringKey.get(B);if(A!==t){const B=this._keysPressed.indexOf(A);-1!==B&&this._keysPressed.splice(B,1)}}this._numeralKeyCodesToStringKey.set(B,t)}}getKeyIsDown(A){if("any"===A)return this._keysPressed.length>0;const B=this._keyArgToScratchKey(A);return this._keysPressed.indexOf(B)>-1}getLastKeyPressed(){return this.lastKeyPressed}}},function(A,B,t){const e=t(3),g=A=>Math.round(1e3*A)/1e3;A.exports=class{constructor(A){this._clientX=0,this._clientY=0,this._scratchX=0,this._scratchY=0,this._buttons=new Set,this.usesRightClickDown=!1,this._isDown=!1,this.runtime=A}_activateClickHats(A){this.runtime.startHats("event_whenthisspriteclicked",null,A),this.runtime.startHats("event_whenstageclicked",null,A)}_pickTarget(A,B){if(this.runtime.renderer){const t=this.runtime.renderer.pick(A,B);for(let A=0;A0&&A.x0&&A.y0))return;B.KEY_OPTION="down arrow"}this.runtime.startHats("event_whenkeypressed",B)}}},function(A,B){A.exports=class{constructor(){this._username=""}postData(A){this._username=A.username}getUsername(){return this._username}}},function(A,B,t){const e=t(1);A.exports=class{constructor(A){this.runtime=A,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(A,B){const t=Math.round(e.toNumber(A.TIMES));void 0===B.stackFrame.loopCounter&&(B.stackFrame.loopCounter=t),B.stackFrame.loopCounter--,B.stackFrame.loopCounter>=0&&B.startBranch(1,!0)}repeatUntil(A,B){e.toBoolean(A.CONDITION)||B.startBranch(1,!0)}repeatWhile(A,B){e.toBoolean(A.CONDITION)&&B.startBranch(1,!0)}forEach(A,B){const t=B.target.lookupOrCreateVariable(A.VARIABLE.id,A.VARIABLE.name);void 0===B.stackFrame.index&&(B.stackFrame.index=0),B.stackFrame.index{this.runtime.startHats("event_whenkeypressed",{KEY_OPTION:A}),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(A,B){return B.target.isTouchingObject(A.TOUCHINGOBJECTMENU)}hatGreaterThanPredicate(A,B){const t=e.toString(A.WHENGREATERTHANMENU).toLowerCase(),g=e.toNumber(A.VALUE);switch(t){case"timer":return B.ioQuery("clock","projectTimer")>g;case"loudness":return this.runtime.audioEngine&&this.runtime.audioEngine.getLoudness()>g}return!1}broadcast(A,B){const t=B.runtime.getTargetForStage().lookupBroadcastMsg(A.BROADCAST_OPTION.id,A.BROADCAST_OPTION.name);if(t){const A=t.name;B.startHats("event_whenbroadcastreceived",{BROADCAST_OPTION:A})}}broadcastAndWait(A,B){if(B.stackFrame.broadcastVar||(B.stackFrame.broadcastVar=B.runtime.getTargetForStage().lookupBroadcastMsg(A.BROADCAST_OPTION.id,A.BROADCAST_OPTION.name)),B.stackFrame.broadcastVar){const A=B.stackFrame.broadcastVar.name;if(!B.stackFrame.startedThreads&&(B.stackFrame.startedThreads=B.startHats("event_whenbroadcastreceived",{BROADCAST_OPTION:A}),0===B.stackFrame.startedThreads.length))return;const t=this;B.stackFrame.startedThreads.some(A=>-1!==t.runtime.threads.indexOf(A))&&(B.stackFrame.startedThreads.every(A=>t.runtime.isWaitingThread(A))?B.yieldTick():B.yield())}}}},function(A,B,t){const e=t(1),g=t(13),i=(t(26),t(6)),Q=t(14),s=t(39),n=t(3);class r{constructor(A){this.runtime=A,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(r.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(A){let B=A.getCustomState(r.STATE_KEY);return B||(B=g.simple(r.DEFAULT_BUBBLE_STATE),A.setCustomState(r.STATE_KEY,B)),B}_onTargetChanged(A){this._getBubbleState(A).drawableId&&this._positionBubble(A)}_onTargetWillExit(A){const B=this._getBubbleState(A);B.drawableId&&B.skinId&&(this.runtime.renderer.destroyDrawable(B.drawableId,Q.SPRITE_LAYER),this.runtime.renderer.destroySkin(B.skinId),B.drawableId=null,B.skinId=null,this.runtime.requestRedraw()),A.onTargetVisualChange=null}_onResetBubbles(){for(let A=0;AQ.right&&g.left-t>Q.left?(B.onSpriteRight=!1,this._renderBubble(A)):!B.onSpriteRight&&g.left-t=.01&&A%1!=0&&(A=A.toFixed(2)),A=String(A).substr(0,r.SAY_BUBBLE_LIMIT))}_updateBubble(A,B,t){const e=this._getBubbleState(A);e.type=B,e.text=this._formatBubbleText(t),e.usageId=i(),this._renderBubble(A)}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:A=>"".concat(A,"_size")},looks_costumenumbername:{isSpriteSpecific:!0,getId:(A,B)=>s("".concat(A,"_costumenumbername"),B)},looks_backdropnumbername:{getId:(A,B)=>s("backdropnumbername",B)}}}say(A,B){const t=A.MESSAGE;this._say(t,B.target)}_say(A,B){this.runtime.emit(r.SAY_OR_THINK,B,"say",A)}sayforsecs(A,B){this.say(A,B);const t=B.target,e=this._getBubbleState(t).usageId;return new Promise(B=>{this._bubbleTimeout=setTimeout(()=>{this._bubbleTimeout=null,this._getBubbleState(t).usageId===e&&this._updateBubble(t,"say",""),B()},1e3*A.SECS)})}think(A,B){this.runtime.emit(r.SAY_OR_THINK,B.target,"think",A.MESSAGE)}thinkforsecs(A,B){this.think(A,B);const t=B.target,e=this._getBubbleState(t).usageId;return new Promise(B=>{this._bubbleTimeout=setTimeout(()=>{this._bubbleTimeout=null,this._getBubbleState(t).usageId===e&&this._updateBubble(t,"think",""),B()},1e3*A.SECS)})}show(A,B){B.target.setVisible(!0),this._renderBubble(B.target)}hide(A,B){B.target.setVisible(!1),this._renderBubble(B.target)}_setCostume(A,B,t){if("number"==typeof B)A.setCostume(t?B:B-1);else{const g=A.getCostumeIndexByName(B.toString());-1!==g?A.setCostume(g):"next costume"===B?A.setCostume(A.currentCostume+1):"previous costume"===B?A.setCostume(A.currentCostume-1):isNaN(B)||e.isWhiteSpace(B)||A.setCostume(t?Number(B):Number(B)-1)}return[]}_setBackdrop(A,B,t){if("number"==typeof B)A.setCostume(t?B:B-1);else{const g=A.getCostumeIndexByName(B.toString());if(-1!==g)A.setCostume(g);else if("next backdrop"===B)A.setCostume(A.currentCostume+1);else if("previous backdrop"===B)A.setCostume(A.currentCostume-1);else if("random backdrop"===B){const B=A.getCostumes().length;if(B>1){const t=0,e=B-1,g=A.currentCostume,i=n.inclusiveRandIntWithout(t,e,g);A.setCostume(i)}}else isNaN(B)||e.isWhiteSpace(B)||A.setCostume(t?Number(B):Number(B)-1)}const g=A.getCostumes()[A.currentCostume].name;return this.runtime.startHats("event_whenbackdropswitchesto",{BACKDROP:g})}switchCostume(A,B){this._setCostume(B.target,A.COSTUME)}nextCostume(A,B){this._setCostume(B.target,B.target.currentCostume+1,!0)}switchBackdrop(A){this._setBackdrop(this.runtime.getTargetForStage(),A.BACKDROP)}switchBackdropAndWait(A,B){if(!B.stackFrame.startedThreads&&(B.stackFrame.startedThreads=this._setBackdrop(this.runtime.getTargetForStage(),A.BACKDROP),0===B.stackFrame.startedThreads.length))return;const t=this;B.stackFrame.startedThreads.some(A=>-1!==t.runtime.threads.indexOf(A))&&(B.stackFrame.startedThreads.every(A=>t.runtime.isWaitingThread(A))?B.yieldTick():B.yield())}nextBackdrop(){const A=this.runtime.getTargetForStage();this._setBackdrop(A,A.currentCostume+1,!0)}clampEffect(A,B){let t=B;switch(A){case"ghost":t=n.clamp(B,r.EFFECT_GHOST_LIMIT.min,r.EFFECT_GHOST_LIMIT.max);break;case"brightness":t=n.clamp(B,r.EFFECT_BRIGHTNESS_LIMIT.min,r.EFFECT_BRIGHTNESS_LIMIT.max)}return t}changeEffect(A,B){const t=e.toString(A.EFFECT).toLowerCase(),g=e.toNumber(A.CHANGE);if(!B.target.effects.hasOwnProperty(t))return;let i=g+B.target.effects[t];i=this.clampEffect(t,i),B.target.setEffect(t,i)}setEffect(A,B){const t=e.toString(A.EFFECT).toLowerCase();let g=e.toNumber(A.VALUE);g=this.clampEffect(t,g),B.target.setEffect(t,g)}clearEffects(A,B){B.target.clearEffects()}changeSize(A,B){const t=e.toNumber(A.CHANGE);B.target.setSize(B.target.size+t)}setSize(A,B){const t=e.toNumber(A.SIZE);B.target.setSize(t)}goToFrontBack(A,B){B.target.isStage||("front"===A.FRONT_BACK?B.target.goToFront():B.target.goToBack())}goForwardBackwardLayers(A,B){B.target.isStage||("forward"===A.FORWARD_BACKWARD?B.target.goForwardLayers(e.toNumber(A.NUM)):B.target.goBackwardLayers(e.toNumber(A.NUM)))}getSize(A,B){return Math.round(B.target.size)}getBackdropNumberName(A){const B=this.runtime.getTargetForStage();return"number"===A.NUMBER_NAME?B.currentCostume+1:B.getCostumes()[B.currentCostume].name}getCostumeNumberName(A,B){return"number"===A.NUMBER_NAME?B.target.currentCostume+1:B.target.getCostumes()[B.target.currentCostume].name}}A.exports=r},function(A,B,t){const e=t(1),g=t(3),i=t(15);A.exports=class{constructor(A){this.runtime=A}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:A=>"".concat(A,"_xposition")},motion_yposition:{isSpriteSpecific:!0,getId:A=>"".concat(A,"_yposition")},motion_direction:{isSpriteSpecific:!0,getId:A=>"".concat(A,"_direction")}}}moveSteps(A,B){const t=e.toNumber(A.STEPS);this._moveSteps(t,B.target)}_moveSteps(A,B){const t=g.degToRad(90-B.direction),e=A*Math.cos(t),i=A*Math.sin(t);B.setXY(B.x+e,B.y+i)}goToXY(A,B){const t=e.toNumber(A.X),g=e.toNumber(A.Y);B.target.setXY(t,g)}getTargetXY(A,B){let t=0,g=0;if("_mouse_"===A)t=B.ioQuery("mouse","getScratchX"),g=B.ioQuery("mouse","getScratchY");else if("_random_"===A){const A=this.runtime.stageWidth,B=this.runtime.stageHeight;t=Math.round(A*(Math.random()-.5)),g=Math.round(B*(Math.random()-.5))}else{A=e.toString(A);const B=this.runtime.getSpriteTargetByName(A);if(!B)return;t=B.x,g=B.y}return[t,g]}goTo(A,B){const t=this.getTargetXY(A.TO,B);t&&B.target.setXY(t[0],t[1])}turnRight(A,B){const t=e.toNumber(A.DEGREES);B.target.setDirection(B.target.direction+t)}turnLeft(A,B){const t=e.toNumber(A.DEGREES);B.target.setDirection(B.target.direction-t)}pointInDirection(A,B){const t=e.toNumber(A.DIRECTION);B.target.setDirection(t)}pointTowards(A,B){let t=0,i=0;if("_mouse_"===A.TOWARDS)t=B.ioQuery("mouse","getScratchX"),i=B.ioQuery("mouse","getScratchY");else{if("_random_"===A.TOWARDS)return void B.target.setDirection(Math.round(360*Math.random())-180);{A.TOWARDS=e.toString(A.TOWARDS);const B=this.runtime.getSpriteTargetByName(A.TOWARDS);if(!B)return;t=B.x,i=B.y}}const Q=t-B.target.x,s=i-B.target.y,n=90-g.radToDeg(Math.atan2(s,Q));B.target.setDirection(n)}glide(A,B){if(B.stackFrame.timer){const A=B.stackFrame.timer.timeElapsed();if(A<1e3*B.stackFrame.duration){const t=A/(1e3*B.stackFrame.duration),e=t*(B.stackFrame.endX-B.stackFrame.startX),g=t*(B.stackFrame.endY-B.stackFrame.startY);B.target.setXY(B.stackFrame.startX+e,B.stackFrame.startY+g),B.yield()}else B.target.setXY(B.stackFrame.endX,B.stackFrame.endY)}else{if(B.stackFrame.timer=new i,B.stackFrame.timer.start(),B.stackFrame.duration=e.toNumber(A.SECS),B.stackFrame.startX=B.target.x,B.stackFrame.startY=B.target.y,B.stackFrame.endX=e.toNumber(A.X),B.stackFrame.endY=e.toNumber(A.Y),B.stackFrame.duration<=0)return void B.target.setXY(B.stackFrame.endX,B.stackFrame.endY);B.yield()}}glideTo(A,B){const t=this.getTargetXY(A.TO,B);t&&this.glide({SECS:A.SECS,X:t[0],Y:t[1]},B)}ifOnEdgeBounce(A,B){this._ifOnEdgeBounce(B.target)}_ifOnEdgeBounce(A){const B=A.getBounds();if(!B)return;const t=this.runtime.stageWidth,e=this.runtime.stageHeight,i=Math.max(0,t/2+B.left),Q=Math.max(0,e/2-B.top),s=Math.max(0,t/2-B.right),n=Math.max(0,e/2+B.bottom);let r="",E=1/0;if(i0)return;const c=g.degToRad(90-A.direction);let o=Math.cos(c),w=-Math.sin(c);"left"===r?o=Math.max(.2,Math.abs(o)):"top"===r?w=Math.max(.2,Math.abs(w)):"right"===r?o=0-Math.max(.2,Math.abs(o)):"bottom"===r&&(w=0-Math.max(.2,Math.abs(w)));const C=g.radToDeg(Math.atan2(w,o))+90;A.setDirection(C);const a=A.keepInFence(A.x,A.y);A.setXY(a[0],a[1])}setRotationStyle(A,B){B.target.setRotationStyle(A.STYLE)}changeX(A,B){const t=e.toNumber(A.DX);B.target.setXY(B.target.x+t,B.target.y)}setX(A,B){const t=e.toNumber(A.X);B.target.setXY(t,B.target.y)}changeY(A,B){const t=e.toNumber(A.DY);B.target.setXY(B.target.x,B.target.y+t)}setY(A,B){const t=e.toNumber(A.Y);B.target.setXY(B.target.x,t)}getX(A,B){return this.limitPrecision(B.target.x)}getY(A,B){return this.limitPrecision(B.target.y)}getDirection(A,B){return B.target.direction}limitPrecision(A){const B=Math.round(A),t=A-B;return Math.abs(t)<1e-9?B:A}}},function(A,B,t){const e=t(1),g=t(3);A.exports=class{constructor(A){this.runtime=A}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(A){return e.toNumber(A.NUM1)+e.toNumber(A.NUM2)}subtract(A){return e.toNumber(A.NUM1)-e.toNumber(A.NUM2)}multiply(A){return e.toNumber(A.NUM1)*e.toNumber(A.NUM2)}divide(A){return e.toNumber(A.NUM1)/e.toNumber(A.NUM2)}lt(A){return e.compare(A.OPERAND1,A.OPERAND2)<0}equals(A){return 0===e.compare(A.OPERAND1,A.OPERAND2)}gt(A){return e.compare(A.OPERAND1,A.OPERAND2)>0}and(A){return e.toBoolean(A.OPERAND1)&&e.toBoolean(A.OPERAND2)}or(A){return e.toBoolean(A.OPERAND1)||e.toBoolean(A.OPERAND2)}not(A){return!e.toBoolean(A.OPERAND)}random(A){return this._random(A.FROM,A.TO)}_random(A,B){const t=e.toNumber(A),g=e.toNumber(B),i=t<=g?t:g,Q=t<=g?g:t;return i===Q?i:e.isInt(A)&&e.isInt(B)?i+Math.floor(Math.random()*(Q+1-i)):Math.random()*(Q-i)+i}join(A){return e.toString(A.STRING1)+e.toString(A.STRING2)}letterOf(A){const B=e.toNumber(A.LETTER)-1,t=e.toString(A.STRING);return B<0||B>=t.length?"":t.charAt(B)}length(A){return e.toString(A.STRING).length}contains(A){const B=function(A){return e.toString(A).toLowerCase()};return B(A.STRING1).includes(B(A.STRING2))}mod(A){const B=e.toNumber(A.NUM1),t=e.toNumber(A.NUM2);let g=B%t;return g/t<0&&(g+=t),g}round(A){return Math.round(e.toNumber(A.NUM))}mathop(A){const B=e.toString(A.OPERATOR).toLowerCase(),t=e.toNumber(A.NUM);switch(B){case"abs":return Math.abs(t);case"floor":return Math.floor(t);case"ceiling":return Math.ceil(t);case"sqrt":return Math.sqrt(t);case"sin":return Math.round(1e10*Math.sin(Math.PI*t/180))/1e10;case"cos":return Math.round(1e10*Math.cos(Math.PI*t/180))/1e10;case"tan":return g.tan(t);case"asin":return 180*Math.asin(t)/Math.PI;case"acos":return 180*Math.acos(t)/Math.PI;case"atan":return 180*Math.atan(t)/Math.PI;case"ln":return Math.log(t);case"log":return Math.log(t)/Math.LN10;case"e ^":return Math.exp(t);case"10 ^":return Math.pow(10,t)}return 0}}},function(A,B,t){const e=t(3),g=t(1),i=t(13);class Q{constructor(A){this.runtime=A,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&&A.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(A){let B=A.getCustomState(Q.STATE_KEY);return B||(B=i.simple(Q.DEFAULT_SOUND_STATE),A.setCustomState(Q.STATE_KEY,B),A.soundEffects=B.effects),B}_onTargetCreated(A,B){if(B){const t=B.getCustomState(Q.STATE_KEY);t&&A&&(A.setCustomState(Q.STATE_KEY,i.simple(t)),this._syncEffectsForTarget(A))}}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:A=>"".concat(A,"_volume")}}}playSound(A,B){this._playSound(A,B)}playSoundAndWait(A,B){return this._playSound(A,B,!0)}_playSound(A,B,t){const e=this._getSoundIndex(A.SOUND_MENU,B);if(e>=0){const{target:A}=B,{sprite:g}=A,{soundId:i}=g.sounds[e];if(g.soundBank)return!0===t?this._addWaitingSound(A.id,i):this._removeWaitingSound(A.id,i),g.soundBank.playSound(A,i)}}_addWaitingSound(A,B){this.waitingSounds[A]||(this.waitingSounds[A]=new Set),this.waitingSounds[A].add(B)}_removeWaitingSound(A,B){this.waitingSounds[A]&&this.waitingSounds[A].delete(B)}_getSoundIndex(A,B){const t=B.target.sprite.sounds.length;if(0===t)return-1;const g=this.getSoundIndexByName(A,B);if(-1!==g)return g;const i=parseInt(A,10);return isNaN(i)?-1:e.wrapClamp(i-1,0,t-1)}getSoundIndexByName(A,B){const t=B.target.sprite.sounds;for(let B=0;B{}}}getMonitored(){return{sensing_answer:{getId:()=>"answer"},sensing_loudness:{getId:()=>"loudness"},sensing_timer:{getId:()=>"timer"},sensing_current:{getId:(A,B)=>i("current",B)}}}_onAnswer(A){this._answer=A;const B=this._questionList.shift();if(B){const[A,t,e,g,i]=B;g&&!i&&this.runtime.emit("SAY",e,"say",""),t(),this._askNextQuestion()}}_resetAnswer(){this._answer=""}_enqueueAsk(A,B,t,e,g){this._questionList.push([A,B,t,e,g])}_askNextQuestion(){if(this._questionList.length>0){const[A,B,t,e,g]=this._questionList[0];e&&!g?(this.runtime.emit("SAY",t,"say",A),this.runtime.emit("QUESTION","")):this.runtime.emit("QUESTION",A)}}_clearAllQuestions(){this._questionList=[],this.runtime.emit("QUESTION",null)}_clearTargetQuestions(A){const B=this._questionList.length>0&&this._questionList[0][2]===A;this._questionList=this._questionList.filter(B=>B[2]!==A),B&&(this.runtime.emit("SAY",A,"say",""),this._questionList.length>0?this._askNextQuestion():this.runtime.emit("QUESTION",null))}askAndWait(A,B){const t=B.target;return new Promise(B=>{const e=this._questionList.length>0;this._enqueueAsk(String(A.QUESTION),B,t,t.visible,t.isStage),e||this._askNextQuestion()})}getAnswer(){return this._answer}touchingObject(A,B){return B.target.isTouchingObject(A.TOUCHINGOBJECTMENU)}touchingColor(A,B){const t=e.toRgbColorList(A.COLOR);return B.target.isTouchingColor(t)}colorTouchingColor(A,B){const t=e.toRgbColorList(A.COLOR),g=e.toRgbColorList(A.COLOR2);return B.target.colorIsTouchingColor(g,t)}distanceTo(A,B){if(B.target.isStage)return 1e4;let t=0,g=0;if("_mouse_"===A.DISTANCETOMENU)t=B.ioQuery("mouse","getScratchX"),g=B.ioQuery("mouse","getScratchY");else{A.DISTANCETOMENU=e.toString(A.DISTANCETOMENU);const B=this.runtime.getSpriteTargetByName(A.DISTANCETOMENU);if(!B)return 1e4;t=B.x,g=B.y}const i=B.target.x-t,Q=B.target.y-g;return Math.sqrt(i*i+Q*Q)}setDragMode(A,B){B.target.setDraggable("draggable"===A.DRAG_MODE)}getTimer(A,B){return B.ioQuery("clock","projectTimer")}resetTimer(A,B){B.ioQuery("clock","resetProjectTimer")}getMouseX(A,B){return B.ioQuery("mouse","getScratchX")}getMouseY(A,B){return B.ioQuery("mouse","getScratchY")}getMouseDown(A,B){return B.ioQuery("mouse","getIsDown")}current(A){const B=e.toString(A.CURRENTMENU).toLowerCase(),t=new Date;switch(B){case"year":return t.getFullYear();case"month":return t.getMonth()+1;case"date":return t.getDate();case"dayofweek":return t.getDay()+1;case"hour":return t.getHours();case"minute":return t.getMinutes();case"second":return t.getSeconds()}return 0}getKeyPressed(A,B){return B.ioQuery("keyboard","getKeyIsDown",[A.KEY_OPTION])}daysSince2000(){const A=new Date(2e3,0,1),B=new Date,t=B.getTimezoneOffset()-A.getTimezoneOffset();let e=B.valueOf()-A.valueOf();return e+=60*(B.getTimezoneOffset()-t)*1e3,e/864e5}getLoudness(){if(void 0===this.runtime.audioEngine)return-1;if(null===this.runtime.currentStepTime)return-1;return this._timer.time()-this._cachedLoudnessTimestamp10}getAttributeOf(A){let B;if("_stage_"===A.OBJECT?B=this.runtime.getTargetForStage():(A.OBJECT=e.toString(A.OBJECT),B=this.runtime.getSpriteTargetByName(A.OBJECT)),!B)return 0;if(B.isStage)switch(A.PROPERTY){case"background #":case"backdrop #":return B.currentCostume+1;case"backdrop name":return B.getCostumes()[B.currentCostume].name;case"volume":return B.volume}else switch(A.PROPERTY){case"x position":return B.x;case"y position":return B.y;case"direction":return B.direction;case"costume #":return B.currentCostume+1;case"costume name":return B.getCostumes()[B.currentCostume].name;case"size":return B.size;case"volume":return B.volume}const t=A.PROPERTY,g=B.lookupVariableByNameAndType(t,"",!0);return g?g.value:0}getUsername(A,B){return B.ioQuery("userData","getUsername")}}},function(A,B,t){const e=t(1);A.exports=class{constructor(A){this.runtime=A}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(A,B){return B.target.lookupOrCreateVariable(A.VARIABLE.id,A.VARIABLE.name).value}setVariableTo(A,B){const t=B.target.lookupOrCreateVariable(A.VARIABLE.id,A.VARIABLE.name);t.value=A.VALUE,t.isCloud&&B.ioQuery("cloud","requestUpdateVariable",[t.name,A.VALUE])}changeVariableBy(A,B){const t=B.target.lookupOrCreateVariable(A.VARIABLE.id,A.VARIABLE.name),g=e.toNumber(t.value)+e.toNumber(A.VALUE);t.value=g,t.isCloud&&B.ioQuery("cloud","requestUpdateVariable",[t.name,g])}changeMonitorVisibility(A,B){this.runtime.monitorBlocks.changeBlock({id:A,element:"checkbox",value:B},this.runtime)}showVariable(A){this.changeMonitorVisibility(A.VARIABLE.id,!0)}hideVariable(A){this.changeMonitorVisibility(A.VARIABLE.id,!1)}showList(A){this.changeMonitorVisibility(A.LIST.id,!0)}hideList(A){this.changeMonitorVisibility(A.LIST.id,!1)}getListContents(A,B){const t=B.target.lookupOrCreateList(A.LIST.id,A.LIST.name);if(B.thread.updateMonitor)return t._monitorUpToDate?t.value:(t._monitorUpToDate=!0,t.value.slice());let e=!0;for(let A=0;A=0)return!0;for(let A=0;A{const B=A.renderer;for(const t of A.targets){const A=t._getRenderedDirectionAndScale();if(B&&t.interpolationData){const e=t.drawableID;B.updateDrawablePosition(e,[t.x,t.y]),B.updateDrawableDirectionScale(e,A.direction,A.scale),B.updateDrawableEffect(e,"ghost",t.effects.ghost)}t.visible&&!t.isStage?t.interpolationData={x:t.x,y:t.y,direction:A.direction,scale:A.scale,costume:t.currentCostume,ghost:t.effects.ghost}:t.interpolationData=null}},interpolate:(A,B)=>{const t=A.renderer;if(t)for(const e of A.targets){const A=e.interpolationData;if(!A)continue;if(!e.visible)continue;const g=e.drawableID,i=e.x-A.x,Q=e.y-A.y,s=Math.abs(i),n=Math.abs(Q);if(s>.1||n>.1){const e=t._allDrawables[g].getAABB(),r=Math.min(240,Math.max(50,1.5*(e.width+e.height)));if(Math.sqrt(s**2+n**2)0&&E<25){const A=e.effects.ghost+r*B;t.updateDrawableEffect(g,"ghost",A)}if(A.costume===e.currentCostume){let{direction:i,scale:Q}=e._getRenderedDirectionAndScale(),s=!1;if(i!==A.direction&&(i%90!=0||A.direction%90!=0)){const t=i*Math.PI/180,e=A.direction*Math.PI/180;i=180*Math.atan2(Math.sin(t)*B+Math.sin(e)*(1-B),Math.cos(t)*B+Math.cos(e)*(1-B))/Math.PI,s=!0}const n=A.scale;if((Q[0]!==n[0]||Q[1]!==n[1])&&Math.sign(Q[0])===Math.sign(n[0])&&Math.sign(Q[1])===Math.sign(n[1])){const A=Q[0]-n[0],t=Q[1]-n[1],e=Math.abs(A),g=Math.abs(t);e<100&&g<100&&(Q[0]=n[0]+A*B,Q[1]=n[1]+t*B,s=!0)}s&&t.updateDrawableDirectionScale(g,i,Q)}}}}},function(A,B){const t="function"==typeof requestAnimationFrame?requestAnimationFrame:A=>setTimeout(A,1e3/60),e="function"==typeof requestAnimationFrame?cancelAnimationFrame:clearTimeout,g=A=>{let B;const g=()=>{B=t(g),A()};return B=t(g),{cancel:()=>e(B)}};A.exports=class{constructor(A){this.runtime=A,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}setFramerate(A){this.framerate=A,this._restart()}setInterpolation(A){this.interpolation=A,this._restart()}stepCallback(){this.runtime._step()}interpolationCallback(){this.runtime._renderInterpolatedPositions()}_restart(){this.running&&(this.stop(),this.start())}start(){this.running=!0,0===this.framerate?(this._stepAnimation=g(this.stepCallback),this.runtime.currentStepTime=1e3/60):(this.interpolation&&(this._interpolationAnimation=g(this.interpolationCallback)),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._stepAnimation&&this._stepAnimation.cancel(),this._interpolationAnimation=null,this._stepAnimation=null}}},function(A,B){A.exports=A=>{A.effects&&A.effects.forEach(A=>{const B=A.prototype._set;A.prototype._set=function(A){this.__value!==A&&(this.__value=A,B.call(this,A))}})}},function(A,B,t){const{motionVector:e,scratchAtan2:g}=t(230);A.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(A){this.frameNumber++,this.prev=this.curr,this.curr=new Uint32Array(A.buffer.slice(0));const B=this._prev;this._prev=this._curr,this._curr=B;for(let A=0;A10&&(this.motionDirection=g(i,t))}getLocalMotion(A,B){if(this.curr&&this.prev){if(B.motionFrameNumber!==this.frameNumber){const{_prev:t,_curr:i}=this;A.updateCPURenderAttributes();const Q=A.getFastBounds(),s=Math.max(Math.floor(Q.left+240),1),n=Math.min(Math.floor(Q.right+240),479),r=Math.max(Math.floor(180-Q.top),1),E=Math.min(Math.floor(180-Q.bottom),359);let c=0,o=0,w=0,C=0,a=0,I=0;const Y=[0,0,0];for(let B=r;B100&&(B.motionAmount=100),B.motionAmount>10/3&&(B.motionDirection=g(M,h)),B.motionFrameNumber=this.frameNumber}}else B.motionAmount=B.motionDirection=-1}}},function(A,B){const t=180/Math.PI,e={u:0,v:0},g=function(A){return(A+270)%360-180};A.exports={motionVector:function(A,B,t,g,i){let Q=arguments.length>5&&void 0!==arguments[5]?arguments[5]:e;const s=B*B-A*t;if(s){const e=-(i*B-g*t),n=-(B*g-A*i),r=8/s;Q.u=e*r,Q.v=n*r}else{const e=(B+A)*(B+A)+(t+B)*(t+B);if(e){const s=-(i+g)*(8/e);Q.u=(B+A)*s,Q.v=(t+B)*s}else Q.u=0,Q.v=0}return Q},scratchDegrees:g,scratchAtan2:function(A,B){return g(Math.atan2(A,B)*t)}}},function(A,B,t){const e=t(5),g=t(2),i=t(1),Q=t(4),s=t(6),n=t(232),r=t(23),E=t(3),c=t(41),o=t(0),w=129,C=130,a=131,I=225,Y=32,h=96,M=0,F=128,D=2,u=175,l=163,d=179,U=148,N=1,m=0,G=152,f=157,H=0,R=0,p=1,J=50,y=0,k=32,T={29:"color",30:"ultrasonic",32:"gyro",16:"touch",8:"mediumMotor",7:"largeMotor",126:"none",125:"none"},j={touch:0,color:1,ultrasonic:1,none:0},x={touch:"button",color:"brightness",ultrasonic:"distance"};class S{constructor(A,B,t){this._parent=A,this._index=B,this._type=t,this._direction=1,this._power=50,this._position=0,this._commandID=null,this._coastDelay=1e3}get type(){return this._type}set type(A){this._type=A}get direction(){return this._direction}set direction(A){this._direction=A<0?-1:1}get power(){return this._power}set power(A){this._power=A}get position(){return this._position}set position(A){let B=A[0]+256*A[1]+256*A[2]*256+256*A[3]*256*256;B>2147483647&&(B-=4294967296),this._position=B}turnOnFor(A){if(0===this._power)return;const B=this._portMask(this._index);let t=A,e=this._power*this._direction;const g=J;let i=[];i[0]=u,e<0&&(e*=-1,t*=-1);const Q=t<0?256-e:e;t=Math.abs(t);let s=g,n=g,r=t-2*g;r<0&&(s=Math.floor(t/2),r=0,n=t-s);const E=this._runValues(r);i=i.concat([H,B,w,255&Q,w,s]).concat(E.concat([w,n,p]));const c=this._parent.generateCommand(F,i);this._parent.send(c),this.coastAfter(A)}coastAfter(A){if(0===this._power)return;const B=s();this._commandID=B,setTimeout(()=>{this._commandID===B&&(this.coast(),this._commandID=null)},A+this._coastDelay)}coast(){if(0===this._power)return;const A=this._parent.generateCommand(F,[l,H,this._portMask(this._index),R]);this._parent.send(A,!1)}_runValues(A){return A<32767?[C,255&A,A>>8&255]:[a,255&A,A>>8&255,A>>16&255,A>>24&255]}_portMask(A){return Math.pow(2,A)}}class b{constructor(A,B){this._runtime=A,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=B,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(B,this),this._rateLimiter=new c(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 A=this._sensors.distance>100?100:this._sensors.distance;return A=A<0?0:A,A=Math.round(100*A)/100,A}get brightness(){return this._sensors.brightness}motor(A){return this._motors[A]}isButtonPressed(A){return 1===this._sensors.buttons[A]}beep(A,B){const t=this.generateCommand(F,[U,N,w,2,C,A,A>>8,C,B,B>>8]);this.send(t)}stopAll(){this.stopAllMotors(),this.stopSound()}stopSound(){const A=this.generateCommand(F,[U,m]);this.send(A,!1)}stopAllMotors(){this._motors.forEach(A=>{A&&A.coast()})}scan(){this._bt&&this._bt.disconnect(),this._bt=new n(this._runtime,this._extensionId,{majorDeviceClass:8,minorDeviceClass:1},this._onConnect,this.reset,this._onMessage)}connect(A){this._bt&&this._bt.connectPeripheral(A,"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 A=!1;return this._bt&&(A=this._bt.isConnected()),A}send(A){let B=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.isConnected()?B&&!this._rateLimiter.okayToSend()?Promise.resolve():this._bt.sendMessage({message:r.uint8ArrayToBase64(A),encoding:"base64"}):Promise.resolve()}generateCommand(A,B){let t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,e=[];e[2]=0,e[3]=0,e[4]=A,e[5]=255&t,e[6]=t>>8&&255,e=e.concat(B);const g=e.length-2;return e[0]=255&g,e[1]=g>>8&&255,e}_onConnect(){this._pollingIntervalID=window.setInterval(this._pollValues,this._pollingInterval)}_pollValues(){if(!this.isConnected())return void window.clearInterval(this._pollingIntervalID);const A=[];let B=0,t=0;if(this._pollingCounter%20==0)A[0]=G,A[1]=w,A[2]=k,A[3]=h,A[4]=I,A[5]=Y,B=33,this._updateDevices=!0;else{let e=0;for(let B=0;B<4;B++)"none"!==this._sensorPorts[B]&&(A[e+0]=f,A[e+1]=H,A[e+2]=B,A[e+3]=y,A[e+4]=j[this._sensorPorts[B]],A[e+5]=I,A[e+6]=4*t,e+=7),t++;for(let B=0;B<4;B++)A[e+0]=d,A[e+1]=H,A[e+2]=B,A[e+3]=I,A[e+4]=4*t,e+=5,t++;B=4*t}const e=this.generateCommand(M,A,B);this.send(e),this._pollingCounter++}_onMessage(A){const B=A.message,t=r.base64ToUint8Array(B);if(t[4]===D)if(this._updateDevices){for(let A=0;A<4;A++){const B=T[t[A+5]];this._sensorPorts[A]=B||"none"}for(let A=0;A<4;A++){const B=T[t[A+21]];this._motorPorts[A]=B||"none"}for(let A=0;A<4;A++){const B=this._motorPorts[A];"none"===B||this._motors[A]||(this._motors[A]=new S(this,A,B)),"none"===B&&this._motors[A]&&(this._motors[A]=null)}this._updateDevices=!1}else if(!this._sensorPorts.includes(void 0)&&!this._motorPorts.includes(void 0)){let A=5;for(let B=0;B<4;B++){const e=new Uint8Array([t[A],t[A+1],t[A+2],t[A+3]]).buffer,g=new DataView(e).getFloat32(0,!0);"button"===x[this._sensorPorts[B]]?this._sensors.buttons[B]=g||0:x[this._sensorPorts[B]]&&(this._sensors[x[this._sensorPorts[B]]]=g||0),A+=4}for(let B=0;B<4;B++){const e=[t[A],t[A+1],t[A+2],t[A+3]];this._motors[B]&&(this._motors[B].position=e),A+=4}}}}const z=["A","B","C","D"],L=["1","2","3","4"];class P{static get EXTENSION_ID(){return"ev3"}constructor(A){this.runtime=A,this._peripheral=new b(this.runtime,P.EXTENSION_ID),this._playNoteForPicker=this._playNoteForPicker.bind(this),this.runtime.on("PLAY_NOTE",this._playNoteForPicker)}getInfo(){return{id:P.EXTENSION_ID,name:"LEGO EV3",blockIconURI:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iNDBweCIgaGVpZ2h0PSI0MHB4IiB2aWV3Qm94PSIwIDAgNDAgNDAiIHZlcnNpb249IjEuMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+CiAgICA8IS0tIEdlbmVyYXRvcjogU2tldGNoIDUwLjIgKDU1MDQ3KSAtIGh0dHA6Ly93d3cuYm9oZW1pYW5jb2RpbmcuY29tL3NrZXRjaCAtLT4KICAgIDx0aXRsZT5ldjMtYmxvY2staWNvbjwvdGl0bGU+CiAgICA8ZGVzYz5DcmVhdGVkIHdpdGggU2tldGNoLjwvZGVzYz4KICAgIDxkZWZzPjwvZGVmcz4KICAgIDxnIGlkPSJldjMtYmxvY2staWNvbiIgc3Ryb2tlPSJub25lIiBzdHJva2Utd2lkdGg9IjEiIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCI+CiAgICAgICAgPGcgaWQ9ImV2MyIgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoNS41MDAwMDAsIDMuNTAwMDAwKSIgZmlsbC1ydWxlPSJub256ZXJvIj4KICAgICAgICAgICAgPHJlY3QgaWQ9IlJlY3RhbmdsZS1wYXRoIiBzdHJva2U9IiM3Qzg3QTUiIGZpbGw9IiNGRkZGRkYiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgeD0iMC41IiB5PSIzLjU5IiB3aWR0aD0iMjgiIGhlaWdodD0iMjUuODEiIHJ4PSIxIj48L3JlY3Q+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtcGF0aCIgc3Ryb2tlPSIjN0M4N0E1IiBmaWxsPSIjRTZFN0U4IiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHg9IjIuNSIgeT0iMC41IiB3aWR0aD0iMjQiIGhlaWdodD0iMzIiIHJ4PSIxIj48L3JlY3Q+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtcGF0aCIgc3Ryb2tlPSIjN0M4N0E1IiBmaWxsPSIjRkZGRkZGIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHg9IjIuNSIgeT0iMTQuNSIgd2lkdGg9IjI0IiBoZWlnaHQ9IjEzIj48L3JlY3Q+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik0xNC41LDEwLjUgTDE0LjUsMTQuNSIgaWQ9IlNoYXBlIiBzdHJva2U9IiM3Qzg3QTUiIGZpbGw9IiNFNkU3RTgiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCI+PC9wYXRoPgogICAgICAgICAgICA8cmVjdCBpZD0iUmVjdGFuZ2xlLXBhdGgiIGZpbGw9IiM0MTQ3NTciIHg9IjQuNSIgeT0iMi41IiB3aWR0aD0iMjAiIGhlaWdodD0iMTAiIHJ4PSIxIj48L3JlY3Q+CiAgICAgICAgICAgIDxyZWN0IGlkPSJSZWN0YW5nbGUtcGF0aCIgZmlsbD0iIzdDODdBNSIgb3BhY2l0eT0iMC41IiB4PSIxMy41IiB5PSIyMC4xMyIgd2lkdGg9IjIiIGhlaWdodD0iMiIgcng9IjAuNSI+PC9yZWN0PgogICAgICAgICAgICA8cGF0aCBkPSJNOS4wNiwyMC4xMyBMMTAuNTYsMjAuMTMgQzEwLjgzNjE0MjQsMjAuMTMgMTEuMDYsMjAuMzUzODU3NiAxMS4wNiwyMC42MyBMMTEuMDYsMjEuNjMgQzExLjA2LDIxLjkwNjE0MjQgMTAuODM2MTQyNCwyMi4xMyAxMC41NiwyMi4xMyBMOS4wNiwyMi4xMyBDOC41MDc3MTUyNSwyMi4xMyA4LjA2LDIxLjY4MjI4NDcgOC4wNiwyMS4xMyBDOC4wNiwyMC41Nzc3MTUzIDguNTA3NzE1MjUsMjAuMTMgOS4wNiwyMC4xMyBaIiBpZD0iU2hhcGUiIGZpbGw9IiM3Qzg3QTUiIG9wYWNpdHk9IjAuNSI+PC9wYXRoPgogICAgICAgICAgICA8cGF0aCBkPSJNMTguOTEsMjAuMTMgTDIwLjQyLDIwLjEzIEMyMC42OTYxNDI0LDIwLjEzIDIwLjkyLDIwLjM1Mzg1NzYgMjAuOTIsMjAuNjMgTDIwLjkyLDIxLjYzIEMyMC45MiwyMS45MDYxNDI0IDIwLjY5NjE0MjQsMjIuMTMgMjAuNDIsMjIuMTMgTDE4LjkyLDIyLjEzIEMxOC4zNjc3MTUzLDIyLjEzIDE3LjkyLDIxLjY4MjI4NDcgMTcuOTIsMjEuMTMgQzE3LjkxOTk3MjYsMjAuNTgxNTk3IDE4LjM2MTYyNDUsMjAuMTM1NDg0IDE4LjkxLDIwLjEzIFoiIGlkPSJTaGFwZSIgZmlsbD0iIzdDODdBNSIgb3BhY2l0eT0iMC41IiB0cmFuc2Zvcm09InRyYW5zbGF0ZSgxOS40MjAwMDAsIDIxLjEzMDAwMCkgcm90YXRlKC0xODAuMDAwMDAwKSB0cmFuc2xhdGUoLTE5LjQyMDAwMCwgLTIxLjEzMDAwMCkgIj48L3BhdGg+CiAgICAgICAgICAgIDxwYXRoIGQ9Ik04LjIzLDE3LjUgTDUsMTcuNSBDNC43MjM4NTc2MywxNy41IDQuNSwxNy4yNzYxNDI0IDQuNSwxNyBMNC41LDE0LjUgTDEwLjUsMTQuNSBMOC42NSwxNy4yOCBDOC41NTQ2Njk2MSwxNy40MTc5MDgyIDguMzk3NjUwMDYsMTcuNTAwMTU2NiA4LjIzLDE3LjUgWiIgaWQ9IlNoYXBlIiBmaWxsPSIjN0M4N0E1IiBvcGFjaXR5PSIwLjUiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTE4LjE1LDE4Ljg1IEwxNy42NSwxOS4zNSBDMTcuNTUyMzQxNiwxOS40NDQwNzU2IDE3LjQ5ODAzMzksMTkuNTc0NDE0MiAxNy41LDE5LjcxIEwxNy41LDIwIEMxNy41LDIwLjI3NjE0MjQgMTcuMjc2MTQyNCwyMC41IDE3LDIwLjUgTDE2LjUsMjAuNSBDMTYuMjIzODU3NiwyMC41IDE2LDIwLjI3NjE0MjQgMTYsMjAgQzE2LDE5LjcyMzg1NzYgMTUuNzc2MTQyNCwxOS41IDE1LjUsMTkuNSBMMTMuNSwxOS41IEMxMy4yMjM4NTc2LDE5LjUgMTMsMTkuNzIzODU3NiAxMywyMCBDMTMsMjAuMjc2MTQyNCAxMi43NzYxNDI0LDIwLjUgMTIuNSwyMC41IEwxMiwyMC41IEMxMS43MjM4NTc2LDIwLjUgMTEuNSwyMC4yNzYxNDI0IDExLjUsMjAgTDExLjUsMTkuNzEgQzExLjUwMTk2NjEsMTkuNTc0NDE0MiAxMS40NDc2NTg0LDE5LjQ0NDA3NTYgMTEuMzUsMTkuMzUgTDEwLjg1LDE4Ljg1IEMxMC42NTgyMTY3LDE4LjY1MjE4NjMgMTAuNjU4MjE2NywxOC4zMzc4MTM3IDEwLjg1LDE4LjE0IEwxMi4zNiwxNi42NSBDMTIuNDUwMjgwMywxNi41NTI4NjE3IDEyLjU3NzM5NjEsMTYuNDk4MzgzNSAxMi43MSwxNi41IEwxNi4yOSwxNi41IEMxNi40MjI2MDM5LDE2LjQ5ODM4MzUgMTYuNTQ5NzE5NywxNi41NTI4NjE3IDE2LjY0LDE2LjY1IEwxOC4xNSwxOC4xNCBDMTguMzQxNzgzMywxOC4zMzc4MTM3IDE4LjM0MTc4MzMsMTguNjUyMTg2MyAxOC4xNSwxOC44NSBaIiBpZD0iU2hhcGUiIGZpbGw9IiM3Qzg3QTUiIG9wYWNpdHk9IjAuNSI+PC9wYXRoPgogICAgICAgICAgICA8cGF0aCBkPSJNMTAuODUsMjMuNDUgTDExLjM1LDIyLjk1IEMxMS40NDc2NTg0LDIyLjg1NTkyNDQgMTEuNTAxOTY2MSwyMi43MjU1ODU4IDExLjUsMjIuNTkgTDExLjUsMjIuMyBDMTEuNSwyMi4wMjM4NTc2IDExLjcyMzg1NzYsMjEuOCAxMiwyMS44IEwxMi41LDIxLjggQzEyLjc3NjE0MjQsMjEuOCAxMywyMi4wMjM4NTc2IDEzLDIyLjMgQzEzLDIyLjU3NjE0MjQgMTMuMjIzODU3NiwyMi44IDEzLjUsMjIuOCBMMTUuNSwyMi44IEMxNS43NzYxNDI0LDIyLjggMTYsMjIuNTc2MTQyNCAxNiwyMi4zIEMxNiwyMi4wMjM4NTc2IDE2LjIyMzg1NzYsMjEuOCAxNi41LDIxLjggTDE3LDIxLjggQzE3LjI3NjE0MjQsMjEuOCAxNy41LDIyLjAyMzg1NzYgMTcuNSwyMi4zIEwxNy41LDIyLjU5IEMxNy40OTgwMzM5LDIyLjcyNTU4NTggMTcuNTUyMzQxNiwyMi44NTU5MjQ0IDE3LjY1LDIyLjk1IEwxOC4xNSwyMy40NSBDMTguMzQwNTcxNCwyMy42NDQ0MjE4IDE4LjM0MDU3MTQsMjMuOTU1NTc4MiAxOC4xNSwyNC4xNSBMMTYuNjQsMjUuNjUgQzE2LjU0OTcxOTcsMjUuNzQ3MTM4MyAxNi40MjI2MDM5LDI1LjgwMTYxNjUgMTYuMjksMjUuOCBMMTIuNzEsMjUuOCBDMTIuNTc3Mzk2MSwyNS44MDE2MTY1IDEyLjQ1MDI4MDMsMjUuNzQ3MTM4MyAxMi4zNiwyNS42NSBMMTAuODUsMjQuMTUgQzEwLjY1OTQyODYsMjMuOTU1NTc4MiAxMC42NTk0Mjg2LDIzLjY0NDQyMTggMTAuODUsMjMuNDUgWiIgaWQ9IlNoYXBlIiBmaWxsPSIjN0M4N0E1IiBvcGFjaXR5PSIwLjUiPjwvcGF0aD4KICAgICAgICAgICAgPHBhdGggZD0iTTIxLjUsMjcuNSBMMjYuNSwyNy41IEwyNi41LDMxLjUgQzI2LjUsMzIuMDUyMjg0NyAyNi4wNTIyODQ3LDMyLjUgMjUuNSwzMi41IEwyMS41LDMyLjUgTDIxLjUsMjcuNSBaIiBpZD0iU2hhcGUiIHN0cm9rZT0iI0NDNEMyMyIgZmlsbD0iI0YxNUEyOSIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIj48L3BhdGg+CiAgICAgICAgPC9nPgogICAgPC9nPgo8L3N2Zz4=",showStatusButton:!0,blocks:[{opcode:"motorTurnClockwise",text:Q({id:"ev3.motorTurnClockwise",default:"motor [PORT] turn this way for [TIME] seconds",description:"turn a motor clockwise for some time"}),blockType:g.COMMAND,arguments:{PORT:{type:e.STRING,menu:"motorPorts",defaultValue:0},TIME:{type:e.NUMBER,defaultValue:1}}},{opcode:"motorTurnCounterClockwise",text:Q({id:"ev3.motorTurnCounterClockwise",default:"motor [PORT] turn that way for [TIME] seconds",description:"turn a motor counter-clockwise for some time"}),blockType:g.COMMAND,arguments:{PORT:{type:e.STRING,menu:"motorPorts",defaultValue:0},TIME:{type:e.NUMBER,defaultValue:1}}},{opcode:"motorSetPower",text:Q({id:"ev3.motorSetPower",default:"motor [PORT] set power [POWER] %",description:"set a motor's power to some value"}),blockType:g.COMMAND,arguments:{PORT:{type:e.STRING,menu:"motorPorts",defaultValue:0},POWER:{type:e.NUMBER,defaultValue:100}}},{opcode:"getMotorPosition",text:Q({id:"ev3.getMotorPosition",default:"motor [PORT] position",description:"get the measured degrees a motor has turned"}),blockType:g.REPORTER,arguments:{PORT:{type:e.STRING,menu:"motorPorts",defaultValue:0}}},{opcode:"whenButtonPressed",text:Q({id:"ev3.whenButtonPressed",default:"when button [PORT] pressed",description:"when a button connected to a port is pressed"}),blockType:g.HAT,arguments:{PORT:{type:e.STRING,menu:"sensorPorts",defaultValue:0}}},{opcode:"whenDistanceLessThan",text:Q({id:"ev3.whenDistanceLessThan",default:"when distance < [DISTANCE]",description:"when the value measured by the distance sensor is less than some value"}),blockType:g.HAT,arguments:{DISTANCE:{type:e.NUMBER,defaultValue:5}}},{opcode:"whenBrightnessLessThan",text:Q({id:"ev3.whenBrightnessLessThan",default:"when brightness < [DISTANCE]",description:"when value measured by brightness sensor is less than some value"}),blockType:g.HAT,arguments:{DISTANCE:{type:e.NUMBER,defaultValue:50}}},{opcode:"buttonPressed",text:Q({id:"ev3.buttonPressed",default:"button [PORT] pressed?",description:"is a button on some port pressed?"}),blockType:g.BOOLEAN,arguments:{PORT:{type:e.STRING,menu:"sensorPorts",defaultValue:0}}},{opcode:"getDistance",text:Q({id:"ev3.getDistance",default:"distance",description:"gets measured distance"}),blockType:g.REPORTER},{opcode:"getBrightness",text:Q({id:"ev3.getBrightness",default:"brightness",description:"gets measured brightness"}),blockType:g.REPORTER},{opcode:"beep",text:Q({id:"ev3.beepNote",default:"beep note [NOTE] for [TIME] secs",description:"play some note on EV3 for some time"}),blockType:g.COMMAND,arguments:{NOTE:{type:e.NOTE,defaultValue:60},TIME:{type:e.NUMBER,defaultValue:.5}}}],menus:{motorPorts:{acceptReporters:!0,items:this._formatMenu(z)},sensorPorts:{acceptReporters:!0,items:this._formatMenu(L)}}}}motorTurnClockwise(A){const B=i.toNumber(A.PORT);let t=1e3*i.toNumber(A.TIME);return t=E.clamp(t,0,15e3),new Promise(A=>{this._forEachMotor(B,A=>{const B=this._peripheral.motor(A);B&&(B.direction=1,B.turnOnFor(t))}),setTimeout(A,t)})}motorTurnCounterClockwise(A){const B=i.toNumber(A.PORT);let t=1e3*i.toNumber(A.TIME);return t=E.clamp(t,0,15e3),new Promise(A=>{this._forEachMotor(B,A=>{const B=this._peripheral.motor(A);B&&(B.direction=-1,B.turnOnFor(t))}),setTimeout(A,t)})}motorSetPower(A){const B=i.toNumber(A.PORT),t=E.clamp(i.toNumber(A.POWER),0,100);this._forEachMotor(B,A=>{const B=this._peripheral.motor(A);B&&(B.power=t)})}getMotorPosition(A){const B=i.toNumber(A.PORT);if(![0,1,2,3].includes(B))return;const t=this._peripheral.motor(B);let e=0;return t&&(e=E.wrapClamp(t.position,0,360)),e}whenButtonPressed(A){const B=i.toNumber(A.PORT);if([0,1,2,3].includes(B))return this._peripheral.isButtonPressed(B)}whenDistanceLessThan(A){const B=E.clamp(i.toNumber(A.DISTANCE),0,100);return this._peripheral.distance{const e=440*Math.pow(2,(B-69+12)/12);this._peripheral.beep(e,t),setTimeout(A,t)})}_forEachMotor(A,B){let t;switch(A){case 0:t=[0];break;case 1:t=[1];break;case 2:t=[2];break;case 3:t=[3];break;default:o.warn("Invalid motor ID: ".concat(A)),t=[]}for(const A of t)B(A)}_formatMenu(A){const B=[];for(let t=0;t4&&void 0!==arguments[4]?arguments[4]:null,i=arguments.length>5?arguments[5]:void 0;super(),this._socket=A.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=e,this._connected=!1,this._characteristicDidChangeCallback=null,this._resetCallback=g,this._discoverTimeoutID=null,this._extensionId=B,this._peripheralOptions=t,this._messageCallback=i,this._runtime=A,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(A=>this._handleRequestError(A))}connectPeripheral(A){let B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;const t={peripheralId:A};B&&(t.pin=B),this.sendRemoteRequest("connect",t).then(()=>{this._connected=!0,this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED),this._connectCallback()}).catch(A=>{this._handleRequestError(A)})}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(A){return this.sendRemoteRequest("send",A).catch(A=>{this.handleDisconnectError(A)})}didReceiveCall(A,B){switch(A){case"didDiscoverPeripheral":this._availablePeripherals[B.peripheralId]=B,this._runtime.emit(this._runtime.constructor.PERIPHERAL_LIST_UPDATE,this._availablePeripherals),this._discoverTimeoutID&&window.clearTimeout(this._discoverTimeoutID);break;case"userDidPickPeripheral":this._availablePeripherals[B.peripheralId]=B,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(B);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(A,B,t){const e=t(4),g=t(5),i=t(2),Q=t(1),s={SPACE:"space",LEFT:"left arrow",UP:"up arrow",RIGHT:"right arrow",DOWN:"down arrow"};A.exports=class{constructor(A){this.runtime=A,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{SPACE:e({id:"makeymakey.spaceKey",default:"space",description:"The space key on a computer keyboard."}),LEFT:e({id:"makeymakey.leftArrowShort",default:"left",description:"Short name for the left arrow key on a computer keyboard."}),UP:e({id:"makeymakey.upArrowShort",default:"up",description:"Short name for the up arrow key on a computer keyboard."}),RIGHT:e({id:"makeymakey.rightArrowShort",default:"right",description:"Short name for the right arrow key on a computer keyboard."}),DOWN:e({id:"makeymakey.downArrowShort",default:"down",description:"Short name for the down arrow key on a computer keyboard."})}}get DEFAULT_SEQUENCES(){return["".concat("LEFT"," ").concat("UP"," ").concat("RIGHT"),"".concat("RIGHT"," ").concat("UP"," ").concat("LEFT"),"".concat("LEFT"," ").concat("RIGHT"),"".concat("RIGHT"," ").concat("LEFT"),"".concat("UP"," ").concat("DOWN"),"".concat("DOWN"," ").concat("UP"),"".concat("UP"," ").concat("RIGHT"," ").concat("DOWN"," ").concat("LEFT"),"".concat("UP"," ").concat("LEFT"," ").concat("DOWN"," ").concat("RIGHT"),"".concat("UP"," ").concat("UP"," ").concat("DOWN"," ").concat("DOWN"," ")+"".concat("LEFT"," ").concat("RIGHT"," ").concat("LEFT"," ").concat("RIGHT")]}getInfo(){return{id:"makeymakey",name:"Makey Makey",blockIconURI:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA0MCA0MCI+PHN0eWxlPi5zdDJ7ZmlsbDpyZWR9LnN0M3tmaWxsOiNlMGUwZTB9LnN0NHtmaWxsOm5vbmU7c3Ryb2tlOiM2NjY7c3Ryb2tlLXdpZHRoOi41O3N0cm9rZS1taXRlcmxpbWl0OjEwfTwvc3R5bGU+PHBhdGggZD0iTTM1IDI4SDVhMSAxIDAgMCAxLTEtMVYxMmMwLS42LjQtMSAxLTFoMzBjLjUgMCAxIC40IDEgMXYxNWMwIC41LS41IDEtMSAxeiIgZmlsbD0iI2ZmZiIgaWQ9IkxheWVyXzYiLz48ZyBpZD0iTGF5ZXJfNCI+PHBhdGggY2xhc3M9InN0MiIgZD0iTTQgMjVoMzJ2Mi43SDR6TTEzIDI0aC0yLjJhMSAxIDAgMCAxLTEtMXYtOS43YzAtLjYuNC0xIDEtMUgxM2MuNiAwIDEgLjQgMSAxVjIzYzAgLjYtLjUgMS0xIDF6Ii8+PHBhdGggY2xhc3M9InN0MiIgZD0iTTYuMSAxOS4zdi0yLjJjMC0uNS40LTEgMS0xaDkuN2MuNSAwIDEgLjUgMSAxdjIuMmMwIC41LS41IDEtMSAxSDcuMWExIDEgMCAwIDEtMS0xeiIvPjxjaXJjbGUgY2xhc3M9InN0MiIgY3g9IjIyLjgiIGN5PSIxOC4yIiByPSIzLjQiLz48Y2lyY2xlIGNsYXNzPSJzdDIiIGN4PSIzMC42IiBjeT0iMTguMiIgcj0iMy40Ii8+PHBhdGggY2xhc3M9InN0MiIgZD0iTTQuMiAyN2gzMS45di43SDQuMnoiLz48L2c+PGcgaWQ9IkxheWVyXzUiPjxjaXJjbGUgY2xhc3M9InN0MyIgY3g9IjIyLjgiIGN5PSIxOC4yIiByPSIyLjMiLz48Y2lyY2xlIGNsYXNzPSJzdDMiIGN4PSIzMC42IiBjeT0iMTguMiIgcj0iMi4zIi8+PHBhdGggY2xhc3M9InN0MyIgZD0iTTEyLjUgMjIuOWgtMS4yYy0uMyAwLS41LS4yLS41LS41VjE0YzAtLjMuMi0uNS41LS41aDEuMmMuMyAwIC41LjIuNS41djguNGMwIC4zLS4yLjUtLjUuNXoiLz48cGF0aCBjbGFzcz0ic3QzIiBkPSJNNy4yIDE4Ljd2LTEuMmMwLS4zLjItLjUuNS0uNWg4LjRjLjMgMCAuNS4yLjUuNXYxLjJjMCAuMy0uMi41LS41LjVINy43Yy0uMyAwLS41LS4yLS41LS41ek00IDI2aDMydjJINHoiLz48L2c+PGcgaWQ9IkxheWVyXzMiPjxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik0zNS4yIDI3LjlINC44YTEgMSAwIDAgMS0xLTFWMTIuMWMwLS42LjUtMSAxLTFoMzAuNWMuNSAwIDEgLjQgMSAxVjI3YTEgMSAwIDAgMS0xLjEuOXoiLz48cGF0aCBjbGFzcz0ic3Q0IiBkPSJNMzUuMiAyNy45SDQuOGExIDEgMCAwIDEtMS0xVjEyLjFjMC0uNi41LTEgMS0xaDMwLjVjLjUgMCAxIC40IDEgMVYyN2ExIDEgMCAwIDEtMS4xLjl6Ii8+PC9nPjwvc3ZnPg==",blocks:[{opcode:"whenMakeyKeyPressed",text:e({id:"makeymakey.whenKeyPressed",default:"when [KEY] key pressed",description:"when a keyboard key is pressed"}),blockType:i.HAT,arguments:{KEY:{type:g.STRING,menu:"KEY",defaultValue:"SPACE"}}},{opcode:"whenCodePressed",text:e({id:"makeymakey.whenKeysPressedInOrder",default:"when [SEQUENCE] pressed in order",description:"when a sequence of keyboard keys is pressed in a specific order"}),blockType:i.HAT,arguments:{SEQUENCE:{type:g.STRING,menu:"SEQUENCE",defaultValue:this.DEFAULT_SEQUENCES[0]}}}],menus:{KEY:{acceptReporters:!0,items:[{text:e({id:"makeymakey.spaceKey",default:"space",description:"The space key on a computer keyboard."}),value:"SPACE"},{text:e({id:"makeymakey.upArrow",default:"up arrow",description:"The up arrow key on a computer keyboard."}),value:"UP"},{text:e({id:"makeymakey.downArrow",default:"down arrow",description:"The down arrow key on a computer keyboard."}),value:"DOWN"},{text:e({id:"makeymakey.rightArrow",default:"right arrow",description:"The right arrow key on a computer keyboard."}),value:"RIGHT"},{text:e({id:"makeymakey.leftArrow",default:"left arrow",description:"The left arrow key on a computer keyboard."}),value:"LEFT"},{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(A){return A.map(A=>this.getMenuItemForSequenceString(A))}getMenuItemForSequenceString(A){let B=A.split(" ");return B=B.map(A=>this.KEY_TEXT_SHORT[A]),{text:B.join(" "),value:A}}whenMakeyKeyPressed(A,B){let t=A.KEY;s[A.KEY]&&(t=s[A.KEY]);return B.ioQuery("keyboard","getKeyIsDown",[t])&&this.frameToggle}keyPressed(A){A=(A=A.split(" ")[0]).toUpperCase(),this.keyPressBuffer.push(A),this.keyPressBuffer.length>100&&this.keyPressBuffer.shift();for(const A in this.sequences){const B=this.sequences[A].array;if(this.keyPressBuffer.length{this.sequences[A].completed=!1},100))}}_clearkeyPressBuffer(){this.keyPressBuffer=[]}addSequence(A,B){this.sequences.hasOwnProperty(A)||(this.sequences[A]={array:B,completed:!1})}whenCodePressed(A){const B=Q.toString(A.SEQUENCE).toUpperCase(),t=B.split(" ");if(!(t.length<2))return this.addSequence(B,t),this.sequences[B].completed}}},function(A,B,t){const e=t(5),g=t(2),i=t(1),Q=t(4),s=t(21),n=t(28),r=t(23),E=t(3),c=t(41),o=t(0),w="00001623-1212-efde-1623-785feabcd123",C="00001624-1212-efde-1623-785feabcd123",a=100,I=20,Y=20,h=21,M=23,F=37,D=38,u=39,l=40,d=1,U=2,N=4,m={A:55,B:56,C:1,D:2},G={A:0,B:1,C:2,D:3};let f=G;const H="any",R="none",p="red",J="blue",y="green",k="yellow",T="white",j="black",x={[R]:255,[p]:9,[J]:3,[y]:5,[k]:7,[T]:10,[j]:0},S={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},b=3,z=5,L=1,P=7,v=11,W=81,V=16,K=1,O=0,X=127,Z=0,_=1,q=0,$=0,AA=1,BA=0,tA=2,eA=0,gA=0,iA=1,QA=2,sA=3,nA=function(A){const B=new ArrayBuffer(4),t=new DataView(B);return t.setInt32(0,A),[t.getInt8(3),t.getInt8(2),t.getInt8(1),t.getInt8(0)]},rA=function(A){const B=Uint8Array.from(A);return new DataView(B.buffer).getInt32(0,!0)};class EA{constructor(A,B){this._parent=A,this._index=B,this._direction=1,this._power=50,this._position=0,this._status=gA,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(A){this._direction=A<0?-1:1}get power(){return this._power}set power(A){this._power=0===A?0:E.scale(A,1,100,10,100)}get position(){return this._position}set position(A){this._position=A}get status(){return this._status}set status(A){this._clearRotationState(),this._clearDurationTimeout(),this._status=A}get pendingDurationTimeoutStartTime(){return this._pendingDurationTimeoutStartTime}get pendingDurationTimeoutDelay(){return this._pendingDurationTimeoutDelay}get pendingRotationDestination(){return this._pendingRotationDestination}get pendingRotationPromise(){return this._pendingRotationPromise}set pendingRotationPromise(A){this._pendingRotationPromise=A}_turnOn(){const A=this._parent.generateOutputCommand(this._index,V,P,[this.power*this.direction,E.clamp(this.power+10,0,100),Z]);this._parent.send(C,A)}turnOnForever(){this.status=iA,this._turnOn()}turnOnFor(A){A=Math.max(0,A),this.status=QA,this._turnOn(),this._setNewDurationTimeout(this.turnOff,A)}turnOnForDegrees(A,B){A=Math.max(0,A);const t=this._parent.generateOutputCommand(this._index,V^K,v,[...nA(A),this.power*this.direction*B,E.clamp(this.power+10,0,100),X,Z]);this.status=sA,this._pendingRotationDestination=this.position+A*this.direction*B,this._parent.send(C,t)}turnOff(){let A=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const B=this._parent.generateOutputCommand(this._index,V,L,[O]);this.status=gA,this._parent.send(C,B,A)}_clearDurationTimeout(){null!==this._pendingDurationTimeoutId&&(clearTimeout(this._pendingDurationTimeoutId),this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null)}_setNewDurationTimeout(A,B){this._clearDurationTimeout();const t=setTimeout(()=>{this._pendingDurationTimeoutId===t&&(this._pendingDurationTimeoutId=null,this._pendingDurationTimeoutStartTime=null,this._pendingDurationTimeoutDelay=null),A()},B);this._pendingDurationTimeoutId=t,this._pendingDurationTimeoutStartTime=Date.now(),this._pendingDurationTimeoutDelay=B}_clearRotationState(){null!==this._pendingRotationPromise&&(this._pendingRotationPromise(),this._pendingRotationPromise=null),this._pendingRotationDestination=null}}class cA{constructor(A,B){this._runtime=A,this._runtime.on("PROJECT_STOP_ALL",this.stopAll.bind(this)),this._extensionId=B,this._ports=[],this._motors=[],this._sensors={tiltX:0,tiltY:0,color:R,previousColor:R},this._colorSamples=[],this._ble=null,this._runtime.registerPeripheralExtension(B,this),this._rateLimiter=new c(I),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(A){return Object.keys(x).find(B=>x[B]===A)||R}motor(A){return this._motors[A]}stopAllMotors(){this._motors.forEach(A=>{A&&A.turnOff(!1)})}setLED(A){const B=[A>>16&255,A>>8&255,255&A],t=this.generateOutputCommand(this._ports.indexOf(M),V^K,W,[AA,...B]);return this.send(C,t)}setLEDMode(){const A=this.generateInputCommand(this._ports.indexOf(M),AA,0,!1);return this.send(C,A)}stopAll(){this.isConnected()&&this.stopAllMotors()}scan(){this._ble&&this._ble.disconnect(),this._ble=new n(this._runtime,this._extensionId,{filters:[{services:[w],manufacturerData:{919:{dataPrefix:[0,64],mask:[0,255]}}}],optionalServices:[]},this._onConnect,this.reset)}connect(A){this._ble&&this._ble.connectPeripheral(A)}disconnect(){this._ble&&this._ble.disconnect(),this.reset()}reset(){this._ports=[],this._motors=[],this._sensors={tiltX:0,tiltY:0,color:R,previousColor:R},this._pingDeviceId&&(window.clearInterval(this._pingDeviceId),this._pingDeviceId=null)}isConnected(){let A=!1;return this._ble&&(A=this._ble.isConnected()),A}send(A,B){let t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return this.isConnected()?t&&!this._rateLimiter.okayToSend()?Promise.resolve():this._ble.write(w,A,r.uint8ArrayToBase64(B),"base64"):Promise.resolve()}generateOutputCommand(A,B,t,e){const g=[0,S.OUTPUT,A,B,t,...e];return g.unshift(g.length+1),g}generateInputCommand(A,B,t,e){const g=[0,S.PORT_INPUT_FORMAT_SETUP_SINGLE,A,B].concat(nA(t)).concat([e]);return g.unshift(g.length+1),g}_onConnect(){this._ble.startNotifications(w,C,this._onMessage),this._pingDeviceId=window.setInterval(this._pingDevice,5e3),setTimeout(()=>{const A=[0,S.HUB_PROPERTIES,b,z];A.unshift(A.length+1),this.send(C,A,!1)},500)}_onMessage(A){const B=r.base64ToUint8Array(A),t=B[2],e=B[3];switch(t){case S.HUB_PROPERTIES:switch(B[3]){case b:{const A=rA([36,2,0,16]);rA(B.slice(5,B.length))5?(this._colorSamples.pop(),this._colorSamples.every((A,B,t)=>A===t[0])?(this._sensors.previousColor=this._sensors.color,this._sensors.color=this.boostColorForIndex(this._colorSamples[0])):this._sensors.color=R):this._sensors.color=R;break;case D:case u:this.motor(e).position=rA(B.slice(4,8));break;case h:case Y:case M:break;default:o.warn("Unknown sensor value! Type: ".concat(A))}break}case S.PORT_FEEDBACK:{const A=B[4],t=this.motor(e);if(t){const B=A&(U^N);!(A&d)&&B&&t.status===sA&&(t.status=gA)}break}case S.ERROR:o.warn("Error reported by hub: ".concat(B))}}_pingDevice(){this._ble.read(w,C,!1)}_registerSensorOrMotor(A,B){this._ports[A]=B,B!==u&&B!==D||(this._motors[A]=new EA(this,A));let t=null,e=1;switch(B){case u:case D:t=tA;break;case F:t=BA,e=0;break;case M:t=AA,this.setLEDMode(),this.setLED(255);break;case l:t=$;break;default:t=eA}const g=this.generateInputCommand(A,t,e,!0);this.send(C,g)}_clearPort(A){const B=this._ports[A];B===l&&(this._sensors.tiltX=this._sensors.tiltY=0),B===F&&(this._sensors.color=R),this._ports[A]="none",this._motors[A]=null}}const oA="A",wA="B",CA="C",aA="D",IA="AB",YA="ABCD",hA="this way",MA="that way",FA="reverse",DA="up",uA="down",lA="left",dA="right",UA="any";class NA{static get EXTENSION_ID(){return"boost"}static get TILT_THRESHOLD(){return 15}constructor(A){this.runtime=A,this._peripheral=new cA(this.runtime,NA.EXTENSION_ID)}getInfo(){return{id:NA.EXTENSION_ID,name:"BOOST",blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAMAAAC5zwKfAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACpQTFRF////fIel5ufolZ62/2YavsPS+YZOkJmy9/j53+Hk6+zs6N/b6dfO////tDhMHAAAAA50Uk5T/////////////////wBFwNzIAAAA6ElEQVR42uzX2w6DIBAEUGDVtlr//3dLaLwgiwUd2z7MJPJg5EQWiGhGcAxBggQJEiT436CIfqXJPTn3MKNYYMSDFpoAmp24OaYgvwKnFgL2zvVTCwHrMoMi+nUQLFthaNCCa0iwclLkDgYVsQp0mzxuqXgK1MRzoCLWgkPXNN2wI/q6Kvt7u/cX0HtejN8x2sXpnpb8J8D3b0Keuhh3X975M+i0xNVbg3s1TIasgK21bQyGO+s2PykaGMYbge8KrNrssvkOWDXkErB8UuBHETjoYLkKBA8ZfuDkbwVBggQJEiR4MC8BBgDTtMZLx2nFCQAAAABJRU5ErkJggg==",showStatusButton:!0,blocks:[{opcode:"motorOnFor",text:Q({id:"boost.motorOnFor",default:"turn motor [MOTOR_ID] for [DURATION] seconds",description:"turn a motor on for some time"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:oA},DURATION:{type:e.NUMBER,defaultValue:1}}},{opcode:"motorOnForRotation",text:Q({id:"boost.motorOnForRotation",default:"turn motor [MOTOR_ID] for [ROTATION] rotations",description:"turn a motor on for rotation"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:oA},ROTATION:{type:e.NUMBER,defaultValue:1}}},{opcode:"motorOn",text:Q({id:"boost.motorOn",default:"turn motor [MOTOR_ID] on",description:"turn a motor on indefinitely"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:oA}}},{opcode:"motorOff",text:Q({id:"boost.motorOff",default:"turn motor [MOTOR_ID] off",description:"turn a motor off"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:oA}}},{opcode:"setMotorPower",text:Q({id:"boost.setMotorPower",default:"set motor [MOTOR_ID] speed to [POWER] %",description:"set the motor's speed without turning it on"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:YA},POWER:{type:e.NUMBER,defaultValue:100}}},{opcode:"setMotorDirection",text:Q({id:"boost.setMotorDirection",default:"set motor [MOTOR_ID] direction [MOTOR_DIRECTION]",description:"set the motor's turn direction without turning it on"}),blockType:g.COMMAND,arguments:{MOTOR_ID:{type:e.STRING,menu:"MOTOR_ID",defaultValue:oA},MOTOR_DIRECTION:{type:e.STRING,menu:"MOTOR_DIRECTION",defaultValue:hA}}},{opcode:"getMotorPosition",text:Q({id:"boost.getMotorPosition",default:"motor [MOTOR_REPORTER_ID] position",description:"the position returned by the motor"}),blockType:g.REPORTER,arguments:{MOTOR_REPORTER_ID:{type:e.STRING,menu:"MOTOR_REPORTER_ID",defaultValue:oA}}},{opcode:"whenColor",text:Q({id:"boost.whenColor",default:"when [COLOR] brick seen",description:"check for when color"}),blockType:g.HAT,arguments:{COLOR:{type:e.STRING,menu:"COLOR",defaultValue:H}}},{opcode:"seeingColor",text:Q({id:"boost.seeingColor",default:"seeing [COLOR] brick?",description:"is the color sensor seeing a certain color?"}),blockType:g.BOOLEAN,arguments:{COLOR:{type:e.STRING,menu:"COLOR",defaultValue:H}}},{opcode:"whenTilted",text:Q({id:"boost.whenTilted",default:"when tilted [TILT_DIRECTION_ANY]",description:"check when tilted in a certain direction"}),func:"isTilted",blockType:g.HAT,arguments:{TILT_DIRECTION_ANY:{type:e.STRING,menu:"TILT_DIRECTION_ANY",defaultValue:UA}}},{opcode:"getTiltAngle",text:Q({id:"boost.getTiltAngle",default:"tilt angle [TILT_DIRECTION]",description:"the angle returned by the tilt sensor"}),blockType:g.REPORTER,arguments:{TILT_DIRECTION:{type:e.STRING,menu:"TILT_DIRECTION",defaultValue:DA}}},{opcode:"setLightHue",text:Q({id:"boost.setLightHue",default:"set light color to [HUE]",description:"set the LED color"}),blockType:g.COMMAND,arguments:{HUE:{type:e.NUMBER,defaultValue:50}}}],menus:{MOTOR_ID:{acceptReporters:!0,items:[{text:"A",value:oA},{text:"B",value:wA},{text:"C",value:CA},{text:"D",value:aA},{text:"AB",value:IA},{text:"ABCD",value:YA}]},MOTOR_REPORTER_ID:{acceptReporters:!0,items:[{text:"A",value:oA},{text:"B",value:wA},{text:"C",value:CA},{text:"D",value:aA}]},MOTOR_DIRECTION:{acceptReporters:!0,items:[{text:Q({id:"boost.motorDirection.forward",default:"this way",description:"label for forward element in motor direction menu for LEGO Boost extension"}),value:hA},{text:Q({id:"boost.motorDirection.backward",default:"that way",description:"label for backward element in motor direction menu for LEGO Boost extension"}),value:MA},{text:Q({id:"boost.motorDirection.reverse",default:"reverse",description:"label for reverse element in motor direction menu for LEGO Boost extension"}),value:FA}]},TILT_DIRECTION:{acceptReporters:!0,items:[{text:Q({id:"boost.tiltDirection.up",default:"up",description:"label for up element in tilt direction menu for LEGO Boost extension"}),value:DA},{text:Q({id:"boost.tiltDirection.down",default:"down",description:"label for down element in tilt direction menu for LEGO Boost extension"}),value:uA},{text:Q({id:"boost.tiltDirection.left",default:"left",description:"label for left element in tilt direction menu for LEGO Boost extension"}),value:lA},{text:Q({id:"boost.tiltDirection.right",default:"right",description:"label for right element in tilt direction menu for LEGO Boost extension"}),value:dA}]},TILT_DIRECTION_ANY:{acceptReporters:!0,items:[{text:Q({id:"boost.tiltDirection.up",default:"up"}),value:DA},{text:Q({id:"boost.tiltDirection.down",default:"down"}),value:uA},{text:Q({id:"boost.tiltDirection.left",default:"left"}),value:lA},{text:Q({id:"boost.tiltDirection.right",default:"right"}),value:dA},{text:Q({id:"boost.tiltDirection.any",default:"any",description:"label for any element in tilt direction menu for LEGO Boost extension"}),value:UA}]},COLOR:{acceptReporters:!0,items:[{text:Q({id:"boost.color.red",default:"red",description:"the color red"}),value:p},{text:Q({id:"boost.color.blue",default:"blue",description:"the color blue"}),value:J},{text:Q({id:"boost.color.green",default:"green",description:"the color green"}),value:y},{text:Q({id:"boost.color.yellow",default:"yellow",description:"the color yellow"}),value:k},{text:Q({id:"boost.color.white",default:"white",desription:"the color white"}),value:T},{text:Q({id:"boost.color.black",default:"black",description:"the color black"}),value:j},{text:Q({id:"boost.color.any",default:"any color",description:"any color"}),value:H}]}}}}motorOnFor(A){let B=1e3*i.toNumber(A.DURATION);return B=E.clamp(B,0,15e3),new Promise(t=>{this._forEachMotor(A.MOTOR_ID,A=>{const t=this._peripheral.motor(A);t&&t.turnOnFor(B)}),setTimeout(t,B)})}motorOnForRotation(A){let B=360*i.toNumber(A.ROTATION);const t=Math.sign(B);B=Math.abs(E.clamp(B,-36e4,36e4));const e=[];this._forEachMotor(A.MOTOR_ID,A=>{e.push(A)});const g=e.map(A=>{const e=this._peripheral.motor(A);return e?0===e.power?Promise.resolve():new Promise(A=>{e.turnOnForDegrees(B,t),e.pendingRotationPromise=A}):null});return Promise.all(g).then(()=>{})}motorOn(A){return this._forEachMotor(A.MOTOR_ID,A=>{const B=this._peripheral.motor(A);B&&B.turnOnForever()}),new Promise(A=>{window.setTimeout(()=>{A()},a)})}motorOff(A){return this._forEachMotor(A.MOTOR_ID,A=>{const B=this._peripheral.motor(A);B&&B.turnOff()}),new Promise(A=>{window.setTimeout(()=>{A()},a)})}setMotorPower(A){return this._forEachMotor(A.MOTOR_ID,B=>{const t=this._peripheral.motor(B);if(t)switch(t.power=E.clamp(i.toNumber(A.POWER),0,100),t.status){case iA:t.turnOnForever();break;case QA:t.turnOnFor(t.pendingDurationTimeoutStartTime+t.pendingDurationTimeoutDelay-Date.now())}}),new Promise(A=>{window.setTimeout(()=>{A()},a)})}setMotorDirection(A){return this._forEachMotor(A.MOTOR_ID,B=>{const t=this._peripheral.motor(B);if(t){switch(A.MOTOR_DIRECTION){case hA:t.direction=1;break;case MA:t.direction=-1;break;case FA:t.direction=-t.direction;break;default:o.warn("Unknown motor direction in setMotorDirection: ".concat(A.DIRECTION))}if(t)switch(t.status){case iA:t.turnOnForever();break;case QA:t.turnOnFor(t.pendingDurationTimeoutStartTime+t.pendingDurationTimeoutDelay-Date.now())}}}),new Promise(A=>{window.setTimeout(()=>{A()},a)})}getMotorPosition(A){let B=null;switch(A.MOTOR_REPORTER_ID){case oA:B=f.A;break;case wA:B=f.B;break;case CA:B=f.C;break;case aA:B=f.D;break;default:return o.warn("Asked for a motor position that doesnt exist!"),!1}if(null!==B&&this._peripheral.motor(B)){let A=this._peripheral.motor(B).position;return B===f.A&&(A*=-1),E.wrapClamp(A,0,360)}return 0}_forEachMotor(A,B){let t;switch(A){case oA:t=[f.A];break;case wA:t=[f.B];break;case CA:t=[f.C];break;case aA:t=[f.D];break;case IA:t=[f.A,f.B];break;case YA:t=[f.A,f.B,f.C,f.D];break;default:o.warn("Invalid motor ID: ".concat(A)),t=[]}for(const A of t)B(A)}whenTilted(A){return this._isTilted(A.TILT_DIRECTION_ANY)}isTilted(A){return this._isTilted(A.TILT_DIRECTION_ANY)}getTiltAngle(A){return this._getTiltAngle(A.TILT_DIRECTION)}_isTilted(A){switch(A){case UA:return Math.abs(this._peripheral.tiltX)>=NA.TILT_THRESHOLD||Math.abs(this._peripheral.tiltY)>=NA.TILT_THRESHOLD;default:return this._getTiltAngle(A)>=NA.TILT_THRESHOLD}}_getTiltAngle(A){switch(A){case DA:return this._peripheral.tiltY>90?256-this._peripheral.tiltY:-this._peripheral.tiltY;case uA:return this._peripheral.tiltY>90?this._peripheral.tiltY-256:this._peripheral.tiltY;case lA:return this._peripheral.tiltX>90?this._peripheral.tiltX-256:this._peripheral.tiltX;case dA:return this._peripheral.tiltX>90?256-this._peripheral.tiltX:-this._peripheral.tiltX;default:o.warn("Unknown tilt direction in _getTiltAngle: ".concat(A))}}whenColor(A){return A.COLOR===H?this._peripheral.color!==R&&this._peripheral.color!==this._peripheral.previousColor:A.COLOR===this._peripheral.color}seeingColor(A){return A.COLOR===H?this._peripheral.color!==R:A.COLOR===this._peripheral.color}setLightHue(A){let B=i.toNumber(A.HUE);B=E.wrapClamp(B,0,100);const t=360*B/100,e=s.hsvToRgb({h:t,s:1,v:1}),g=s.rgbToDecimal(e);return this._peripheral._led=B,this._peripheral.setLED(g),new Promise(A=>{window.setTimeout(()=>{A()},a)})}}A.exports=NA},function(A,B,t){const e=t(5),g=t(2),i=t(0),Q=t(4),s=t(3),n=t(28),r=t(236),E=t(237),c={service:"d91714ef-28b9-4f91-ba16-f0d9a604f112",commandChar:"f4bf14a6-c7d5-4b6d-8aa8-df1a7c83adcb",responseChar:"b41e6675-a329-40e0-aa01-44d2f444babe"},o=1,w=2,C=3,a=4,I=5,Y=6,h=7;class M{constructor(A,B){this._runtime=A,this._ble=null,this._device=null,this._runtime.registerPeripheralExtension(B,this),this._extensionId=B,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 n(this._runtime,this._extensionId,{filters:[{namePrefix:"GDX-FOR"}],optionalServices:[c.service]},this._onConnect,this.reset)}connect(A){this._ble&&this._ble.connectPeripheral(A)}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 A=!1;return this._ble&&(A=this._ble.isConnected()),A}_onConnect(){const A=new E(this._ble,c);r.createDevice(A,{open:!0,startMeasurements:!1}).then(A=>{this._device=A,this._device.keepValues=!1,this._device.sensors.forEach(A=>{A.setEnabled(!0)}),this._device.on("measurements-started",()=>{this._device.sensors.filter(A=>A.enabled).forEach(A=>{A.on("value-changed",A=>{this._onSensorValueChanged(A)})}),this._timeoutID=window.setInterval(()=>this._ble.handleDisconnectError("Force and Acceleration extension stopped receiving data"),4500)}),this._device.start(80)})}_onSensorValueChanged(A){switch(A.number){case o:this._sensors.force=s.clamp(2*A.value,-100,100);break;case w:this._sensors.accelerationX=A.value;break;case C:this._sensors.accelerationY=A.value;break;case a:this._sensors.accelerationZ=A.value;break;case I:this._sensors.spinSpeedX=this._spinSpeedFromGyro(A.value);break;case Y:this._sensors.spinSpeedY=this._spinSpeedFromGyro(A.value);break;case h:this._sensors.spinSpeedZ=this._spinSpeedFromGyro(A.value)}window.clearInterval(this._timeoutID),this._timeoutID=window.setInterval(()=>this._ble.handleDisconnectError("Force and Acceleration extension stopped receiving data"),4500)}_spinSpeedFromGyro(A){const B=1e3/this._runtime.currentStepTime;return A=s.radToDeg(A),A/=B,A*=-1}getForce(){return this._sensors.force}getTiltFrontBack(){let A=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const B=this.getAccelerationX(),t=this.getAccelerationY(),e=this.getAccelerationZ();let g=t*t+e*e;return g=Math.sqrt(g),g<.35?g=B<0?90:-90:(g=B/g,g=Math.atan(g),g=-1*s.radToDeg(g)),A&&(g*=-1),g}getTiltLeftRight(){let A=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const B=this.getAccelerationX(),t=this.getAccelerationY(),e=this.getAccelerationZ();let g=B*B+e*e;return g=Math.sqrt(g),g<.35?g=t<0?90:-90:(g=t/g,g=Math.atan(g),g=-1*s.radToDeg(g)),A&&(g*=-1),g}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 F="pushed",D="pulled",u="shaken",l="started falling",d="turned face up",U="turned face down",N="front",m="back",G="left",f="right",H="any",R="x",p="y",J="z";class y{static get EXTENSION_NAME(){return"Force and Acceleration"}static get EXTENSION_ID(){return"gdxfor"}get AXIS_MENU(){return[{text:"x",value:R},{text:"y",value:p},{text:"z",value:J}]}get TILT_MENU(){return[{text:Q({id:"gdxfor.tiltDirectionMenu.front",default:"front",description:"label for front element in tilt direction picker for gdxfor extension"}),value:N},{text:Q({id:"gdxfor.tiltDirectionMenu.back",default:"back",description:"label for back element in tilt direction picker for gdxfor extension"}),value:m},{text:Q({id:"gdxfor.tiltDirectionMenu.left",default:"left",description:"label for left element in tilt direction picker for gdxfor extension"}),value:G},{text:Q({id:"gdxfor.tiltDirectionMenu.right",default:"right",description:"label for right element in tilt direction picker for gdxfor extension"}),value:f}]}get TILT_MENU_ANY(){return[...this.TILT_MENU,{text:Q({id:"gdxfor.tiltDirectionMenu.any",default:"any",description:"label for any direction element in tilt direction picker for gdxfor extension"}),value:H}]}get PUSH_PULL_MENU(){return[{text:Q({id:"gdxfor.pushed",default:"pushed",description:"the force sensor was pushed inward"}),value:F},{text:Q({id:"gdxfor.pulled",default:"pulled",description:"the force sensor was pulled outward"}),value:D}]}get GESTURE_MENU(){return[{text:Q({id:"gdxfor.shaken",default:"shaken",description:"the sensor was shaken"}),value:u},{text:Q({id:"gdxfor.startedFalling",default:"started falling",description:"the sensor started free falling"}),value:l},{text:Q({id:"gdxfor.turnedFaceUp",default:"turned face up",description:"the sensor was turned to face up"}),value:d},{text:Q({id:"gdxfor.turnedFaceDown",default:"turned face down",description:"the sensor was turned to face down"}),value:U}]}constructor(A){this.runtime=A,this._peripheral=new M(this.runtime,y.EXTENSION_ID)}getInfo(){return{id:y.EXTENSION_ID,name:y.EXTENSION_NAME,blockIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAABGdBTUEAALGPC/xhBQAACCNJREFUeAHtnGtsFFUUgM+dfXbbbbcWaKHSFgrlkWgkJCb6A4kmJfiHIBYBpcFfRg1GEkmEVAvhFYw/TExMxGoICAECiZEIIUQCiiT4gh+KILRQCi2ENIV2t/ue6zl3u2Upu4XuzO4csCe587iPmXO/OWfunTszV4ABWfflQU+0p+9bTcLzEmS5gUPlvagAcVMXcMpnK1u+evW8QLYKaNkWpHKxnt6dQsqFjxo80p10Jt1vx7t30n62Ys+2IJUTUpDlqUNomgYutwsjhZFD5r6slBAOhUHX9YTe6D1GTmrIAhFeBZ2c4JFCpBiggmwlBR7pTGLUewxZYBIUWV7yqgb7g8lotuukt5ihqyELHCSEbusk931ExMxbjSkWSNxEyr3vysxZLFHWnDuT0CtFV6OKmmOBRrV4hMubZoGmMZA6lHTfgsLeHnBEIiCxUY86XRDw+sBfOgZ0m820U5lxIFYAncF+GNvVDo5QaLBu1ClyYTyF4tvd8lZltQgXFA6mW73BxoVt0ShUXG2VCp4QQdDEFqez4Bm7p7gaO0of422r3x4Ji/KrbdIexu4SE2FjgWO6OkCLx6gt6gxOiNV92tiY+ni1Ye1nu7dpQfk35ikru9EBN6unsEDIwgLJPQv8dwCfT3WPt+iFIfAUqM3vL7vpjmuz0KX1gkAfOMN33dxKkjwA9vsTDIS8uubdBZcyAWlqWtohQbRSuru/L1O2vMazAGiLxRKVFqDgDEdAaHCN0kU8Ply2vKWxABhzJZ5ipC6qHlRzfJxVz99S49GdYQEw7PYkuAmokZJ6fumlQUqiNpVSQ56i9JnyHMsCYMRdADGHk0ZyHM1b976XicH0rXtWYR57FPNSGQ7CAiCBCJQ8oXhI0FdmBiPfVnl9ZZmz5DmFDcA+HwIUOEYMcjL2+e57PbBp04HxONI4ifIEKC8TYQMwhs+7IU+hwBFOYQvB5qF8grbwJnRfQXnIhbkIG4AExF+ScE00w0X3AZLwisrDyH1JH1YAA8UlIG029FRZsu6TPfVJiIltWYIjMTLgLUlGs1izeRYmGtS383t9wnu7G2J6fH/Tln2LNUdExGLxvZSOQ1qCS/+P9CFhBZAUuj12PHgCvRJHZ7w4EnhYjya6hXGHQ2Jaxj4ilbVC2AFEUNBVXSdKb3WC29+rmISKiqFn7ARBadyEHUACFHM64VZlDTdWafVh1Yik1ZB5JEsLJGaVtosw37ld4TscWQHX4+oRWO1zWrAEWCR6oMnTCEXijmI1234MVvsPgV+WcmKndGHpwlNtZwbhkZYEkuI4CkuAXfpk0HGAPym0TXEchaUL39Br4JvQeljk+lwxOxBeCRQ3UrFHI+AMBsEV6gcnhlwIS4BU0RORV1V42EqnwnLgSyo3AsM3eA9bPOt8bAEOV6NUWGRZ9FYvHSx6R0pfYgkMmk2DCH1+Z7KwB5gKazjLGgpLgUOAuRZWALnDSncxLAOYCmskbqjhe02h5d6y0sFKF5cXgI8LrLwB9PTeGew6POwNnptlpYOVLi4nFjjuWts957rnBk8tomoZ+bjhPcqOcCcnAG34EaTqOjxmsNKxzQnAkX5wronsOry6zIn66ThljLNcg+W1a2Gi55+MCg6XcKl3NuxrbxouS87TLAcY1V0QV5+8jLyuEekeeSGTS1gOcM/lZpOrlN/DsRzOyi8CY2fLuwUum/wR1BT+ZUzrDKUv9D4LB9rXZEjNTfRjZYFS5r86ebfA3W0bcmMKFh01/5fMoorm6rSjAA2SNc2F8dvmQVWCgdy8fxg8gcEN0pWez80QUyyQFAqn/N9mhmK5PAYN7adecCPnMsUCCZ7U8ari4IGb87wJeKFDA/MlmHXBDVkgTR1CV4/gaThKzBoeKYpuSzqSrqSzEiFuJDayWxqyQJp3RUhYSKfWUSEz5iDIrhrZl8I5b37JvrTBT3wdpd43cOqT/WiJhq6ikQpkW5a8BxuS/X219uXZHoPKmdMUGdEgpWzTll3Kr95Z8VJK7N3NL7b/qHY2rnmdjd6G7oF3q/b/3RoFaPDajwIcBWiQgMHioxZoEKChfqDBc2csnmxtM2ZglMDKArFvduhBbLDv9sOD8oymA0xBCHVtl6+c7ey6Ibdt+3ox7WOoxMCmD4i68PrZkBQaEDUe1tnVqSyyfl79+vr6evz1C2jKogkYWEEc0JnViiZRqKuoqJiZtEJcn0GIsykewzhW2jJVZjzBamxsfK79ase/5MoXL106TnEDwfq36qgIF6HGjKyqFsNkDGMwUNxEDEmIHQTxyNGjH1AchvumBcC4vAuXVpiA+TDYMFDXiiZFoN+SrmMI7tixo/v3337diNtQUzNpPq1RChIra5ccAFKDUEwYLra2fnXu3PmtA0gojqbaVUNl23ft+pPiPW73U7RGYdGH5QCQYCg93C73075S34I5c+ZQa0s/B1Njou51tVVVatJAXcrED3Q4EI5plgsHgAQiSiRCoRD9ECeam9fPo32UJzFQYwJLlix9mdZ9fb1naY2iyiQ2rVtyAEi199Pi5M8/tdB62vRpzceOH3+toaHBh61w2clTp96sqq5ehUnxw0eO7KA8KKpMYtO6JZcOKTUeNRhsp0+ffmtilYI1VLf4+Qvn1784d+5ezEfW144hMR05blglpDgHSbqxt6Wl5Y8ZM6afKq8oL7LZHd54PH7H7w+cOPj9dx8uXbLk+ICynbhm4cJDr7LVMKmhoP5dphaWoFGrHMTAQrgBJCjkFdQHpPntqCUmiWCge14PBsvdFnUYlP8AMAKfKIKmYukAAAAASUVORK5CYII=",menuIconURI:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABGdBTUEAALGPC/xhBQAAA9dJREFUWAnNmE2IFEcUgF/9dE/v7LoaM9kkK4JBRA0EFBIPRm85hBAvEXHXwyo5eFE87GFcReMkObgJiQnkkJzEg9n8HIJixKNe1IMKihgiCbviwV11V3d0d3pmuqsqr5ppcEnb3TNVggVFVVe9eu+r97qqq4tASqp8/fsboQgmU0TMugi571K29bPy9ovPU8Sf16HbpQj3EkYFBcJcr5Am2nZfs94AIWVfqMQeHNwhICUBZ4ypUIA/X2sbIm2AW8AJK0lkEP6TJpfqwXgg4QxmF/fB7Gtvxk1G5ZKHU1CqTgPJoSUXYJYeohSUJu+qrqdVUGh2/pVX4VFffx77WaqBZkrkEFj271+qWH0sXcU3FBzyQe/Mg7B//LbKMTRTxNiDbsMHHjTJlyM7HEJIBHXs2KXFj+oTNSdoQOCYLS5jD9IwBMm5H8NplwwPb/QV4yEIcycaAza9IuA76B38fuz1OF5RXUkmHCdu6rg0BpSMgV/sAe7DdzGFrvvdi0D3mSZjQA0wt7REQsY+iWF0XbfFzyal8SLRxuteD+Du4h4Z/flbqaBHibAQtZmQtcZaAZSMwtTylaR/4vaw1ju5YhWG10pwwAqghmp2FeHO2+t11WqyM80W0m7vAOhsM1kD7CGz8L57Jsq6bitZC/GcWgLf1H6KuHT92cTDAFy/BgXMXm0OCpgV50Bo9kK3BqiBboabQMMU/WoL5im4jToeq/AIgXsiRx5KKCjcwPEsiAv/BQMu9EwyDHXd/3kqCOSzDk6t5/YglQKKeJwq+PNRmJI8kwSTaj1HZy5AhSHqnXkIvU9mMUwEw4Q5wTM57LUtkg8QPw/cdcBJ+PhvKJ0Gj80nGq6JXrg6/XFiX97GXIBpyqTieKpKViOl+WEhWXMaUavvvdIZ8Giy5+Lh3bwKm/t+Be3JazMfxc1tldY26rastiHcsQevTG9pw0znovkAcRWHzSDKnZtaOJLSfMFLB5RqtRBS4LbCurqLCy0YPkU3C0IIPEimMqR2ei7ZX2+KQdRi/WahNT/GmfOD4Vyzhx/66pcjp85dUvcmp6J8+txldXh07PPskdkS+V6EbD0vTOKlB0x9B/O6BS8ULly9PgE6x4kDPR/XX5pyYKj8xcCucsUmkNUQE0JvKKm2VioVK5HRE7UKOHbi6B94RzP+93jtpC0vWgXUF0hr3ipuw8uadwd3jXxoA9IK4Pah8t6BneV9GgjD28Svw1mlxFobgFbeFTz13cKbth93fDryp2CEq0a4hTA+aAPQ/ESJFDdvXLzzzrqNjlTqOP6uDeFf0uhvJ0ZP2QD8D6ZzU6u8YIbBAAAAAElFTkSuQmCC",showStatusButton:!0,blocks:[{opcode:"whenGesture",text:Q({id:"gdxfor.whenGesture",default:"when [GESTURE]",description:"when the sensor detects a gesture"}),blockType:g.HAT,arguments:{GESTURE:{type:e.STRING,menu:"gestureOptions",defaultValue:u}}},{opcode:"whenForcePushedOrPulled",text:Q({id:"gdxfor.whenForcePushedOrPulled",default:"when force sensor [PUSH_PULL]",description:"when the force sensor is pushed or pulled"}),blockType:g.HAT,arguments:{PUSH_PULL:{type:e.STRING,menu:"pushPullOptions",defaultValue:F}}},{opcode:"getForce",text:Q({id:"gdxfor.getForce",default:"force",description:"gets force"}),blockType:g.REPORTER},"---",{opcode:"whenTilted",text:Q({id:"gdxfor.whenTilted",default:"when tilted [TILT]",description:"when the sensor detects tilt"}),blockType:g.HAT,arguments:{TILT:{type:e.STRING,menu:"tiltAnyOptions",defaultValue:H}}},{opcode:"isTilted",text:Q({id:"gdxfor.isTilted",default:"tilted [TILT]?",description:"is the device tilted?"}),blockType:g.BOOLEAN,arguments:{TILT:{type:e.STRING,menu:"tiltAnyOptions",defaultValue:H}}},{opcode:"getTilt",text:Q({id:"gdxfor.getTilt",default:"tilt angle [TILT]",description:"gets tilt"}),blockType:g.REPORTER,arguments:{TILT:{type:e.STRING,menu:"tiltOptions",defaultValue:N}}},"---",{opcode:"isFreeFalling",text:Q({id:"gdxfor.isFreeFalling",default:"falling?",description:"is the device in free fall?"}),blockType:g.BOOLEAN},{opcode:"getSpinSpeed",text:Q({id:"gdxfor.getSpin",default:"spin speed [DIRECTION]",description:"gets spin speed"}),blockType:g.REPORTER,arguments:{DIRECTION:{type:e.STRING,menu:"axisOptions",defaultValue:J}}},{opcode:"getAcceleration",text:Q({id:"gdxfor.getAcceleration",default:"acceleration [DIRECTION]",description:"gets acceleration"}),blockType:g.REPORTER,arguments:{DIRECTION:{type:e.STRING,menu:"axisOptions",defaultValue:R}}}],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(A){switch(A.PUSH_PULL){case F:return this._peripheral.getForce()<-5;case D:return this._peripheral.getForce()>5;default:return i.warn("unknown push/pull value in whenForcePushedOrPulled: ".concat(A.PUSH_PULL)),!1}}getForce(){return Math.round(this._peripheral.getForce())}whenGesture(A){switch(A.GESTURE){case u:return this.gestureMagnitude()>30;case l:return this.isFreeFalling();case d:return this._isFacing(d);case U:return this._isFacing(U);default:return i.warn("unknown gesture value in whenGesture: ".concat(A.GESTURE)),!1}}_isFacing(A){void 0===this._facingUp&&(this._facingUp=!1),void 0===this._facingDown&&(this._facingDown=!1);let B=9;switch((this._facingUp||this._facingDown)&&(B-=5),this._facingUp=this._peripheral.getAccelerationZ()>B,this._facingDown=this._peripheral.getAccelerationZ()<-1*B,A){case d:return this._facingUp;case U:return this._facingDown;default:return!1}}whenTilted(A){return this._isTilted(A.TILT)}isTilted(A){return this._isTilted(A.TILT)}getTilt(A){return this._getTiltAngle(A.TILT)}_isTilted(A){switch(A){case H:return this._getTiltAngle(N)>15||this._getTiltAngle(m)>15||this._getTiltAngle(G)>15||this._getTiltAngle(f)>15;default:return this._getTiltAngle(A)>15}}_getTiltAngle(A){if(!this._peripheral.isConnected())return 0;switch(A){case N:return Math.round(this._peripheral.getTiltFrontBack(!0));case m:return Math.round(this._peripheral.getTiltFrontBack(!1));case G:return Math.round(this._peripheral.getTiltLeftRight(!0));case f:return Math.round(this._peripheral.getTiltLeftRight(!1));default:i.warn("Unknown direction in getTilt: ".concat(A))}}getSpinSpeed(A){switch(A.DIRECTION){case R:return Math.round(this._peripheral.getSpinSpeedX());case p:return Math.round(this._peripheral.getSpinSpeedY());case J:return Math.round(this._peripheral.getSpinSpeedZ());default:i.warn("Unknown direction in getSpinSpeed: ".concat(A.DIRECTION))}}getAcceleration(A){switch(A.DIRECTION){case R:return Math.round(this._peripheral.getAccelerationX());case p:return Math.round(this._peripheral.getAccelerationY());case J:return Math.round(this._peripheral.getAccelerationZ());default:i.warn("Unknown direction in getAcceleration: ".concat(A.DIRECTION))}}magnitude(A,B,t){return Math.sqrt(A*A+B*B+t*t)}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()}}A.exports=y},function(A,B,t){A.exports=function(){"use strict";function B(A,B,t,e,g,i,Q){try{var s=A[i](Q),n=s.value}catch(A){return void t(A)}s.done?B(n):Promise.resolve(n).then(e,g)}function e(A){return function(){var t=this,e=arguments;return new Promise((function(g,i){var Q=A.apply(t,e);function s(A){B(Q,g,i,s,n,"next",A)}function n(A){B(Q,g,i,s,n,"throw",A)}s(void 0)}))}}function g(A,B){if(!(A instanceof B))throw new TypeError("Cannot call a class as a function")}function i(A,B){for(var t=0;t=0;--i){var Q=this.tryEntries[i],s=Q.completion;if("root"===Q.tryLoc)return e("end");if(Q.tryLoc<=this.prev){var n=g.call(Q,"catchLoc"),r=g.call(Q,"finallyLoc");if(n&&r){if(this.prev=0;--t){var e=this.tryEntries[t];if(e.tryLoc<=this.prev&&g.call(e,"finallyLoc")&&this.prev=0;--B){var t=this.tryEntries[B];if(t.finallyLoc===A)return this.complete(t.completion,t.afterLoc),f(t),a}},catch:function(A){for(var B=this.tryEntries.length-1;B>=0;--B){var t=this.tryEntries[B];if(t.tryLoc===A){var e=t.completion;if("throw"===e.type){var g=e.arg;f(t)}return g}}throw new Error("illegal catch attempt")},delegateYield:function(A,B,e){return this.delegate={iterator:R(A),resultName:B,nextLoc:e},"next"===this.method&&(this.arg=t),a}}}function F(A,B,t,e){var g=B&&B.prototype instanceof u?B:u,i=Object.create(g.prototype),Q=new H(e||[]);return i._invoke=function(A,B,t){var e=c;return function(g,i){if(e===w)throw new Error("Generator is already running");if(e===C){if("throw"===g)throw i;return p()}for(t.method=g,t.arg=i;;){var Q=t.delegate;if(Q){var s=m(Q,t);if(s){if(s===a)continue;return s}}if("next"===t.method)t.sent=t._sent=t.arg;else if("throw"===t.method){if(e===c)throw e=C,t.arg;t.dispatchException(t.arg)}else"return"===t.method&&t.abrupt("return",t.arg);e=w;var n=D(A,B,t);if("normal"===n.type){if(e=t.done?C:o,n.arg===a)continue;return{value:n.arg,done:t.done}}"throw"===n.type&&(e=C,t.method="throw",t.arg=n.arg)}}}(A,t,Q),i}function D(A,B,t){try{return{type:"normal",arg:A.call(B,t)}}catch(A){return{type:"throw",arg:A}}}function u(){}function l(){}function d(){}function U(A){["next","throw","return"].forEach((function(B){A[B]=function(A){return this._invoke(B,A)}}))}function N(A){var B;this._invoke=function(t,e){function i(){return new Promise((function(B,i){!function B(t,e,i,Q){var s=D(A[t],A,e);if("throw"!==s.type){var n=s.arg,r=n.value;return r&&"object"==typeof r&&g.call(r,"__await")?Promise.resolve(r.__await).then((function(A){B("next",A,i,Q)}),(function(A){B("throw",A,i,Q)})):Promise.resolve(r).then((function(A){n.value=A,i(n)}),(function(A){return B("throw",A,i,Q)}))}Q(s.arg)}(t,e,B,i)}))}return B=B?B.then(i,i):i()}}function m(A,B){var e=A.iterator[B.method];if(e===t){if(B.delegate=null,"throw"===B.method){if(A.iterator.return&&(B.method="return",B.arg=t,m(A,B),"throw"===B.method))return a;B.method="throw",B.arg=new TypeError("The iterator does not provide a 'throw' method")}return a}var g=D(e,A.iterator,B.arg);if("throw"===g.type)return B.method="throw",B.arg=g.arg,B.delegate=null,a;var i=g.arg;return i?i.done?(B[A.resultName]=i.value,B.next=A.nextLoc,"return"!==B.method&&(B.method="next",B.arg=t),B.delegate=null,a):i:(B.method="throw",B.arg=new TypeError("iterator result is not an object"),B.delegate=null,a)}function G(A){var B={tryLoc:A[0]};1 in A&&(B.catchLoc=A[1]),2 in A&&(B.finallyLoc=A[2],B.afterLoc=A[3]),this.tryEntries.push(B)}function f(A){var B=A.completion||{};B.type="normal",delete B.arg,A.completion=B}function H(A){this.tryEntries=[{tryLoc:"root"}],A.forEach(G,this),this.reset(!0)}function R(A){if(A){var B=A[Q];if(B)return B.call(A);if("function"==typeof A.next)return A;if(!isNaN(A.length)){var e=-1,i=function B(){for(;++e-1)return t.splice(e,1),this._listenerMap.set(A,t),!0}return!1}},{key:"unbind",value:function(){this._listenerMap.clear()}},{key:"emit",value:function(A){for(var B=arguments.length,t=new Array(B>1?B-1:0),e=1;e0&&void 0!==arguments[0]?arguments[0]:{};g(this,A),this.type=B.type,this.mode=B.mode,this.minValue=B.minValue,this.maxValue=B.maxValue,this.uncertainty=B.uncertainty,this.minPeriod=B.minPeriod,this.maxPeriod=B.maxPeriod,this.typicalPeriod=B.typicalPeriod,this.granularity=B.granularity},D=function A(){var B=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};g(this,A),this.number=B.number,this.name=B.name,this.unit=B.unit,this.id=B.id,this.mutalExclusionMask=B.mutalExclusionMask,this.measurementInfo=B.measurementInfo},u=function(A){function B(A){var t;return g(this,B),(t=r(this,n(B).call(this))).number=A.number,t.name=A.name,t.unit=A.unit,t.specs=A,t.enabled=!1,t.values=[],t.value=null,t}return s(B,Y),Q(B,[{key:"clear",value:function(){this.value=null,this.values=[]}},{key:"setValue",value:function(A,B){this.value=A,B&&this.values.push(this.value),this.emit("value-changed",this)}},{key:"setEnabled",value:function(A){this.enabled!==A&&(this.enabled=A,this.emit("state-changed",this))}}]),B}(),l=function(A){function B(A){var e;if(g(this,B),e=r(this,n(B).call(this)),"undefined"==typeof TextDecoder){var i=t(36);M=i.TextDecoder}else M=TextDecoder;return e.device=A,e.sensors=[],e.opened=!1,e.rollingCounter=0,e.collecting=!1,e.measurementPeriod=10,e.response=null,e.remainingResponseLength=0,e.defaultSensorsMask=0,e.keepValues=!0,e.minMeasurementPeriod=10,e.serialNumber="",e.orderCode="",e.name="",e}return s(B,Y),Q(B,[{key:"getBatteryLevel",value:function(){var A=e(regeneratorRuntime.mark((function A(){var B;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,this._getStatus();case 2:return B=A.sent,A.abrupt("return",B.battery);case 4:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"getChargingState",value:function(){var A=e(regeneratorRuntime.mark((function A(){var B;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,this._getStatus();case 2:return B=A.sent,A.abrupt("return",B.chargingStatus);case 4:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"open",value:function(){var A=e(regeneratorRuntime.mark((function A(){var B,t=arguments;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return B=t.length>0&&void 0!==t[0]&&t[0],A.prev=1,A.next=4,this._connect();case 4:return A.next=6,this._init();case 6:return A.next=8,this._getStatus();case 8:return A.next=10,this._getDeviceInfo();case 10:return A.next=12,this._getDefaultSensorsMask();case 12:return A.next=14,this._getAvailableSensors();case 14:this._onOpened(),B&&this.start(),A.next=21;break;case 18:A.prev=18,A.t0=A.catch(1),console.error(A.t0);case 21:case"end":return A.stop()}}),A,this,[[1,18]])})));return function(){return A.apply(this,arguments)}}()},{key:"close",value:function(){var A=e(regeneratorRuntime.mark((function A(){return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,this._stopMeasurements();case 2:return A.next=4,this._sendCommand(a.DISCONNECT);case 4:return A.abrupt("return",this._disconnect());case 5:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"enableDefaultSensors",value:function(){for(var A=1,B=0;B<32;++B){if((this.defaultSensorsMask&A)===A){var t=this.getSensor(B);t&&t.setEnabled(!0)}A<<=1}}},{key:"start",value:function(){var A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,B=this.sensors.filter((function(A){return A.enabled}));0===B.length&&(this.enableDefaultSensors(),B=this.sensors.filter((function(A){return A.enabled}))),B.forEach((function(A){return A.clear()})),A&&(this.measurementPeriod=A),this._startMeasurements()}},{key:"stop",value:function(){this._stopMeasurements()}},{key:"getSensor",value:function(A){return this.sensors.find((function(B){return B.number===A}))}},{key:"_connect",value:function(){var A=e(regeneratorRuntime.mark((function A(){var B=this;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",this.device.setup({onClosed:function(){return B._onClosed()},onResponse:function(A){return B._handleResponse(A)}}));case 1:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"_disconnect",value:function(){var A=e(regeneratorRuntime.mark((function A(){return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",this.device.close());case 1:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"_init",value:function(){return this.collecting=!1,this.rollingCounter=255,this.writeQueue=[],this._sendCommand(a.INIT)}},{key:"_handleResponse",value:function(A){if("command notified: ".concat(h(A.buffer)),this.remainingResponseLegnth>0){if(this.remainingResponseLegnth-=A.buffer.byteLength,this.response=new DataView((B=this.response.buffer,t=A.buffer.slice(0),(e=new Uint8Array(B.byteLength+t.byteLength)).set(new Uint8Array(B),0),e.set(new Uint8Array(t),B.byteLength),e.buffer)),this.remainingResponseLegnth>0)return}else this.response=A;var B,t,e,g=this.response.getUint8(1);if(g>this.response.buffer.byteLength)this.remainingResponseLegnth=g-this.response.buffer.byteLength;else switch("handle command: ".concat(h(this.response.buffer)),this.response.getUint8(0)){case 32:this._processMeasurements(this.response);break;default:var i=this.response.getUint8(4),Q=this.response.getUint8(5),s=new DataView(this.response.buffer,6);this._resolveWriteCommand(i,Q,s),this.remainingResponseLegnth=0,this.response=null}}},{key:"_getSensorsWithMask",value:function(A){for(var B=[],t=1,e=0;e<32;++e){if((A&t)===t){var g=this.getSensor(e);g&&(B.push(g),"available: [".concat(A,"] ").concat(B[B.length-1].number))}t<<=1}return B}},{key:"_processMeasurements",value:function(A){var B=[],t=!0,e=0,g=0,i=A.getUint8(4);switch(i){case 6:B=this._getSensorsWithMask(A.getUint16(5,!0)),e=A.getUint8(7,!0),g=9;break;case 7:B=this._getSensorsWithMask(A.getUint32(5,!0)),e=A.getUint8(9,!0),g=11;break;case 10:case 8:B[0]=this.getSensor(A.getUint8(6)),e=A.getUint8(7,!0),g=8;break;case 11:case 9:B[0]=this.getSensor(A.getUint8(6)),e=A.getUint8(7,!0),g=8,t=!1;break;case 12:case 13:case 14:"Purposely Ignoring packet type: ".concat(i);break;default:"Unknown packet type: ".concat(i)}for(var Q=0;Q255?0:t}},{key:"_sendCommand",value:function(A){var B=new Uint8Array(a.HEADER.byteLength+A.byteLength);return B.set(new Uint8Array(a.HEADER),0),B.set(new Uint8Array(A),a.HEADER.byteLength),B[1]=B.length,B[2]=this._decRollingCounter(),B[3]=this._calculateChecksum(B),this._queueWriteCommand(B,0,B.length)}},{key:"_writeCommand",value:function(){var A=e(regeneratorRuntime.mark((function A(B,t,e){var g;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(!(e>0)){A.next=12;break}return A.prev=1,e>20?(g=B.subarray(t,t+20),e-=20,t+=20):(g=B.subarray(t,t+e),e=0),A.next=5,this.device.writeCommand(g);case 5:A.next=10;break;case 7:A.prev=7,A.t0=A.catch(1),"Write Failure: ".concat(A.t0);case 10:A.next=0;break;case 12:case"end":return A.stop()}}),A,this,[[1,7]])})));return function(B,t,e){return A.apply(this,arguments)}}()},{key:"_queueWriteCommand",value:function(A,B,t){var e=this;"command queued: ".concat(h(A));var g=new Promise((function(B,t){e.writeQueue.push({command:A[4],rollingCounter:A[2],resolve:B,reject:t}),setTimeout((function(){e.writeQueue=e.writeQueue.filter((function(B){return B.command===A[4]&&B.rollingCounter!==A[2]})),t(new Error("write command timed out after 5s. Command: ".concat(A[4].toString(16)," Rolling Counter: ").concat(A[2].toString(16))))}),1e4)}));return this._writeCommand(A,B,t),g}},{key:"_getStatus",value:function(){var A=e(regeneratorRuntime.mark((function A(){var B,t;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,this._sendCommand(a.GET_STATUS);case 2:return B=A.sent,t={masterFirmwareVersion:"".concat(B.getUint8(2),".").concat(B.getUint8(3)),bleFirmwareVersion:"".concat(B.getUint8(6),".").concat(B.getUint8(9)),battery:B.getUint8(10),chargingStatus:"".concat(B.getUint8(11))},A.abrupt("return",t);case 5:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"_getAvailableSensors",value:function(){var A=e(regeneratorRuntime.mark((function A(){var B,t,e=this;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.next=2,this._sendCommand(a.GET_SENSOR_IDS).then((function(A){e.availableSensors=A.getUint32(0,!0),"Get Available Sensors Returned ".concat(e.availableSensors)}));case 2:B=1,t=0;case 4:if(!(t<31)){A.next=12;break}if((this.availableSensors&B)!==B){A.next=8;break}return A.next=8,this._getSensorInfo(t);case 8:B<<=1;case 9:++t,A.next=4;break;case 12:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"_getDefaultSensorsMask",value:function(){var A=this;return this._sendCommand(a.GET_DEFAULT_SENSORS_MASK).then((function(B){A.defaultSensorsMask=B.getUint32(0,!0)}))}},{key:"_getDeviceInfo",value:function(){var A=this;return this._sendCommand(a.GET_INFO).then((function(B){var t=new M("utf-8");A.orderCode=t.decode(new Uint8Array(B.buffer,6,16).filter(I)),A.serialNumber=t.decode(new Uint8Array(B.buffer,22,16).filter(I)),A.name=t.decode(new Uint8Array(B.buffer,38,32).filter(I))}))}},{key:"_getSensorInfo",value:function(){var A=e(regeneratorRuntime.mark((function A(B){var t,e=this;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return(t=new Uint8Array(a.GET_SENSOR_INFO))[1]=B,A.abrupt("return",this._sendCommand(t).then((function(A){var B=A.getUint32(2,!0);if(B>0){var t=new M("utf-8"),g=new F({type:A.getUint8(6),mode:A.getUint8(7),minValue:A.getFloat64(108,!0),maxValue:A.getFloat64(116,!0),uncertainty:A.getFloat64(100,!0),minPeriod:A.getUint32(124,!0)/1e3,maxPeriod:((A.getUint32(132,!0)<<32)+A.getUint32(128,!0))/1e3,typicalPeriod:A.getUint32(136,!0)/1e3,granularity:A.getUint32(140,!0)/1e3}),i=new D({number:A.getUint8(0),name:t.decode(new Uint8Array(A.buffer,14,60).filter(I)),unit:t.decode(new Uint8Array(A.buffer,74,32).filter(I)),mutalExclusiveMask:A.getUint32(144,!0),measurementInfo:g,sensorId:B}),Q=new u(i);e.sensors.push(Q),Q.on("state-changed",(function(){"Sensor Restart: ".concat(Q.number),Q.enabled&&(e.measurementPeriod=Q.specs.measurementInfo.typicalPeriod,e.sensors.forEach((function(A){if(Q.number!==A.number&&A.enabled){var B=1<e.measurementPeriod&&(e.measurementPeriod=A.specs.measurementInfo.typicalPeriod)}}))),e._restartMeasurements()}))}})));case 3:case"end":return A.stop()}}),A,this)})));return function(B){return A.apply(this,arguments)}}()},{key:"_restartMeasurements",value:function(){var A=e(regeneratorRuntime.mark((function A(){var B;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(B=this.collecting,!this.collecting){A.next=10;break}return A.prev=2,A.next=5,this._stopMeasurements();case 5:A.next=10;break;case 7:A.prev=7,A.t0=A.catch(2),console.error(A.t0);case 10:if(this.collecting||!B){A.next=19;break}return A.prev=11,A.next=14,this._startMeasurements();case 14:A.next=19;break;case 16:A.prev=16,A.t1=A.catch(11),console.error(A.t1);case 19:case"end":return A.stop()}}),A,this,[[2,7],[11,16]])})));return function(){return A.apply(this,arguments)}}()},{key:"_setMeasurementPeriod",value:function(A){var B=new Uint8Array(a.SET_MEASUREMENT_PERIOD),t=1e3*this.minMeasurementPeriod;return A>0&255,B[4]=A>>8&255,B[5]=A>>16&255,B[6]=A>>24&255,this._sendCommand(B)}},{key:"_getEnabledChannelMask",value:function(){var A=0;return this.sensors.filter((function(A){return A.enabled})).forEach((function(B){A+=1<>0&255,t[4]=B>>8&255,t[5]=B>>16&255,t[6]=B>>24&255,A._sendCommand(t).then((function(B){0===B.getUint8(0)&&(A.collecting=!0,A.emit("measurements-started"))}))}))}},{key:"_stopMeasurements",value:function(){var A=this;return this._sendCommand(a.STOP_MEASUREMENTS).then((function(B){0===B.getUint8(0)&&(A.collecting=!1,A.emit("measurements-stopped"))}))}}]),B}(),d=function(){function A(B){g(this,A),this.webBluetoothNativeDevice=B,this.deviceCommand=null,this.deviceResponse=null}return Q(A,[{key:"writeCommand",value:function(){var A=e(regeneratorRuntime.mark((function A(B){return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",this.deviceCommand.writeValue(B));case 1:case"end":return A.stop()}}),A,this)})));return function(B){return A.apply(this,arguments)}}()},{key:"setup",value:function(){var A=e(regeneratorRuntime.mark((function A(B){var t,e,g,i,Q=this;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return t=B.onClosed,e=B.onResponse,this.webBluetoothNativeDevice.addEventListener("gattserverdisconnected",t),A.prev=2,A.next=5,this.webBluetoothNativeDevice.gatt.connect();case 5:return g=A.sent,A.next=8,g.getPrimaryService("d91714ef-28b9-4f91-ba16-f0d9a604f112");case 8:return i=A.sent,A.next=11,i.getCharacteristics();case 11:A.sent.forEach((function(A){switch(A.uuid){case"f4bf14a6-c7d5-4b6d-8aa8-df1a7c83adcb":Q.deviceCommand=A;break;case"b41e6675-a329-40e0-aa01-44d2f444babe":Q.deviceResponse=A,Q.deviceResponse.addEventListener("characteristicvaluechanged",(function(A){var B=A.target.value;e(B)})),Q.deviceResponse.startNotifications();break;default:"No case found for ".concat(A.uuid)}})),A.next=18;break;case 15:A.prev=15,A.t0=A.catch(2),console.error(A.t0);case 18:if(this.deviceCommand&&this.deviceResponse){A.next=20;break}throw new Error("Expected command and response characteristics not found.");case 20:case"end":return A.stop()}}),A,this,[[2,15]])})));return function(B){return A.apply(this,arguments)}}()},{key:"close",value:function(){var A=e(regeneratorRuntime.mark((function A(){return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:return A.abrupt("return",this.webBluetoothNativeDevice.gatt.disconnect());case 1:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()},{key:"godirectAdapter",get:function(){return!0}}]),A}(),U={createDevice:function(){var A=e(regeneratorRuntime.mark((function A(B){var t,e,g,i,Q,s,n,r=arguments;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(t=r.length>1&&void 0!==r[1]?r[1]:{},e=t.open,g=void 0===e||e,i=t.startMeasurements,Q=void 0===i||i,(s=B).godirectAdapter||(s=new d(B)),n=new l(s),!g){A.next=14;break}return A.prev=5,A.next=8,n.open(Q);case 8:A.next=14;break;case 10:throw A.prev=10,A.t0=A.catch(5),console.error(A.t0),A.t0;case 14:return A.abrupt("return",n);case 15:case"end":return A.stop()}}),A,this,[[5,10]])})));return function(B){return A.apply(this,arguments)}}(),selectDevice:function(){var A=e(regeneratorRuntime.mark((function A(){var B;return regeneratorRuntime.wrap((function(A){for(;;)switch(A.prev=A.next){case 0:if(navigator.bluetooth){A.next=2;break}return A.abrupt("return",Promise.reject(new Error("No Web Bluetooth support.")));case 2:return A.next=4,navigator.bluetooth.requestDevice({filters:[{namePrefix:"GDX"}],optionalServices:["d91714ef-28b9-4f91-ba16-f0d9a604f112"]});case 4:return B=A.sent,A.abrupt("return",U.createDevice(B));case 6:case"end":return A.stop()}}),A,this)})));return function(){return A.apply(this,arguments)}}()};return U}()},function(A,B,t){const e=t(23);A.exports=class{constructor(A,B){let{service:t,commandChar:e,responseChar:g}=B;this.socket=A,this._service=t,this._commandChar=e,this._responseChar=g,this._onResponse=this._onResponse.bind(this),this._deviceOnResponse=null}get godirectAdapter(){return!0}writeCommand(A){const B=e.uint8ArrayToBase64(A);return this.socket.write(this._service,this._commandChar,B,"base64")}setup(A){let{onResponse:B}=A;return this._deviceOnResponse=B,this.socket.startNotifications(this._service,this._responseChar,this._onResponse)}_onResponse(A){const B=e.base64ToUint8Array(A),t=new DataView(B.buffer);return this._deviceOnResponse(t)}}},function(A,B,t){const e=t(4),g=t(2),i=t(5),Q=t(1);A.exports=class{constructor(A){this.runtime=A}getInfo(){return{id:"tw",name:"TurboWarp",color1:"#ff4c4c",color2:"#e64444",docsURI:"https://docs.turbowarp.org/blocks",blocks:[{opcode:"getLastKeyPressed",text:e({id:"tw.blocks.lastKeyPressed",default:"last key pressed",description:"Block that returns the last key that was pressed"}),disableMonitor:!0,blockType:g.REPORTER},{opcode:"getButtonIsDown",text:e({id:"tw.blocks.buttonIsDown",default:"[MOUSE_BUTTON] mouse button down?",description:"Block that returns whether a specific mouse button is down"}),blockType:g.BOOLEAN,arguments:{MOUSE_BUTTON:{type:i.NUMBER,menu:"mouseButton",defaultValue:"0"}}}],menus:{mouseButton:{items:[{text:e({id:"tw.blocks.mouseButton.primary",default:"(0) primary",description:"Dropdown item to select primary (usually left) mouse button"}),value:"0"},{text:e({id:"tw.blocks.mouseButton.middle",default:"(1) middle",description:"Dropdown item to select middle mouse button"}),value:"1"},{text:e({id:"tw.blocks.mouseButton.secondary",default:"(2) secondary",description:"Dropdown item to select secondary (usually right) mouse button"}),value:"2"}],acceptReporters:!0}}}}getLastKeyPressed(A,B){return B.ioQuery("keyboard","getLastKeyPressed")}getButtonIsDown(A,B){const t=Q.toNumber(A.MOUSE_BUTTON);return B.ioQuery("mouse","getButtonIsDown",[t])}}},function(A,B,t){A.exports=function(){return t(76)('!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}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=4)}([function(e,t,n){function r(){}n(12).mixin(r),r.prototype.write=function(e,t,n){this.emit("item",e,t,n)},r.prototype.end=function(){this.emit("end"),this.removeAllListeners()},r.prototype.pipe=function(e){var t=this;function n(){e.write.apply(e,Array.prototype.slice.call(arguments))}function r(){!e._isStdio&&e.end()}return t.emit("unpipe",e),e.emit("pipe",t),t.on("item",n),t.on("end",r),t.when("unpipe",(function(i){var o=i===e||void 0===i;return o&&(t.removeListener("item",n),t.removeListener("end",r),e.emit("unpipe")),o})),e},r.prototype.unpipe=function(e){return this.emit("unpipe",e),this},r.prototype.format=function(e){throw new Error(["Warning: .format() is deprecated in Minilog v2! Use .pipe() instead. For example:","var Minilog = require(\'minilog\');","Minilog"," .pipe(Minilog.backends.console.formatClean)"," .pipe(Minilog.backends.console);"].join("\\n"))},r.mixin=function(e){var t,n=r.prototype;for(t in n)n.hasOwnProperty(t)&&(e.prototype[t]=n[t])},e.exports=r},function(e,t,n){const r=n(10);r.enable(),e.exports=r("vm")},function(e,t){var n={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};e.exports=function(e,t){return t?"color: #fff; background: "+n[e]+";":"color: "+n[e]+";"}},function(e,t){e.exports={isWorker:!0,centralDispatchService:self}},function(e,t,n){(function(e){const t=n(6),r=n(7),i=n(8),o=n(1),s=n(20),{isWorker:c}=n(3);e.Scratch=e.Scratch||{},e.Scratch.ArgumentType=t,e.Scratch.BlockType=r,e.Scratch.TargetType=s;const a=new class{constructor(){this.nextExtensionId=0,this.initialRegistrations=[],this.firstRegistrationPromise=new Promise(e=>{this.firstRegistrationCallback=e}),i.waitForConnection.then(()=>{i.call("extensions","allocateWorker").then(async e=>{const[t,n]=e;this.workerId=t;try{await(e=>{if(!c)return new Promise((t,n)=>{const r=document.createElement("script");r.onload=()=>t(),r.onerror=()=>n(new Error("Error when loading custom extension script: ".concat(e))),r.src=e,document.body.appendChild(r)});importScripts(e)})(n),await this.firstRegistrationPromise;const e=this.initialRegistrations;this.initialRegistrations=null,Promise.all(e).then(()=>i.call("extensions","onWorkerInit",t))}catch(e){o.error(e),i.call("extensions","onWorkerInit",t,"".concat(e))}})}),this.extensions=[]}register(e){const t=this.nextExtensionId++;this.extensions.push(e);const n="extension.".concat(this.workerId,".").concat(t),r=i.setService(n,e).then(()=>i.call("extensions","registerExtensionService",n));return this.initialRegistrations&&(this.firstRegistrationCallback(),this.initialRegistrations.push(r)),r}};e.Scratch.extensions={register:a.register.bind(a)}}).call(this,n(5))},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){e.exports={ANGLE:"angle",BOOLEAN:"Boolean",COLOR:"color",NUMBER:"number",STRING:"string",MATRIX:"matrix",NOTE:"note",IMAGE:"image"}},function(e,t){e.exports={BOOLEAN:"Boolean",BUTTON:"button",COMMAND:"command",CONDITIONAL:"conditional",EVENT:"event",HAT:"hat",LOOP:"loop",REPORTER:"reporter"}},function(e,t,n){const r=n(9),i=n(1),{centralDispatchService:o}=n(3);e.exports=new class extends r{constructor(){super(),this._connectionPromise=new Promise(e=>{this._onConnect=e}),this.services={},this._onMessage=this._onMessage.bind(this,o),"undefined"!=typeof self&&(self.onmessage=this._onMessage)}get waitForConnection(){return this._connectionPromise}setService(e,t){return this.services.hasOwnProperty(e)&&i.warn("Worker dispatch replacing existing service provider for ".concat(e)),this.services[e]=t,this.waitForConnection.then(()=>this._remoteCall(o,"dispatch","setService",e))}_getServiceProvider(e){const t=this.services[e];return{provider:t||o,isRemote:!t}}_onDispatchMessage(e,t){let n;switch(t.method){case"handshake":n=this._onConnect();break;case"terminate":setTimeout(()=>self.close(),0),n=Promise.resolve();break;default:i.error("Worker dispatch received message for unknown method: ".concat(t.method))}return n}}},function(e,t,n){const r=n(1);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;i3?r-3:0),o=3;o3?r-3:0),o=3;o4?i-4:0),s=4;s{const c=this._storeCallbacks(i,s);o.length>0&&"function"==typeof o[o.length-1].func&&(o.pop(),o.pop()),r?e.postMessage({service:t,method:n,responseId:c,args:o},r):e.postMessage({service:t,method:n,responseId:c,args:o})})}_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){var r=n(11),i=r.enable,o=r.disable,s="undefined"!=typeof navigator&&/chrome/i.test(navigator.userAgent),c=n(14);if(r.defaultBackend=s?c.minilog:c,"undefined"!=typeof window){try{r.enable(JSON.parse(window.localStorage.minilogSettings))}catch(e){}if(window.location&&window.location.search){var a=RegExp("[?&]minilog=([^&]*)").exec(window.location.search);a&&r.enable(decodeURIComponent(a[1]))}}r.enable=function(){i.call(r,!0);try{window.localStorage.minilogSettings=JSON.stringify(!0)}catch(e){}return this},r.disable=function(){o.call(r);try{delete window.localStorage.minilogSettings}catch(e){}return this},(e.exports=r).backends={array:n(17),browser:r.defaultBackend,localStorage:n(18),jQuery:n(19)}},function(e,t,n){var r=n(0),i=n(13),o=new r,s=Array.prototype.slice;(t=e.exports=function(e){var n=function(){return o.write(e,void 0,s.call(arguments)),n};return n.debug=function(){return o.write(e,"debug",s.call(arguments)),n},n.info=function(){return o.write(e,"info",s.call(arguments)),n},n.warn=function(){return o.write(e,"warn",s.call(arguments)),n},n.error=function(){return o.write(e,"error",s.call(arguments)),n},n.log=n.debug,n.suggest=t.suggest,n.format=o.format,n}).defaultBackend=t.defaultFormatter=null,t.pipe=function(e){return o.pipe(e)},t.end=t.unpipe=t.disable=function(e){return o.unpipe(e)},t.Transform=r,t.Filter=i,t.suggest=new i,t.enable=function(){return t.defaultFormatter?o.pipe(t.suggest).pipe(t.defaultFormatter).pipe(t.defaultBackend):o.pipe(t.suggest).pipe(t.defaultBackend)}},function(e,t){function n(){this._events={}}n.prototype={on:function(e,t){this._events||(this._events={});var n=this._events;return(n[e]||(n[e]=[])).push(t),this},removeListener:function(e,t){var n,r=this._events[e]||[];for(n=r.length-1;n>=0&&r[n];n--)r[n]!==t&&r[n].cb!==t||r.splice(n,1)},removeAllListeners:function(e){e?this._events[e]&&(this._events[e]=[]):this._events={}},listeners:function(e){return this._events&&this._events[e]||[]},emit:function(e){this._events||(this._events={});var t,n=Array.prototype.slice.call(arguments,1),r=this._events[e]||[];for(t=r.length-1;t>=0&&r[t];t--)r[t].apply(this,n);return this},when:function(e,t){return this.once(e,t,!0)},once:function(e,t,n){if(!t)return this;function r(){n||this.removeListener(e,r),t.apply(this,arguments)&&n&&this.removeListener(e,r)}return r.cb=t,this.on(e,r),this}},n.mixin=function(e){var t,r=n.prototype;for(t in r)r.hasOwnProperty(t)&&(e.prototype[t]=r[t])},e.exports=n},function(e,t,n){var r=n(0),i={debug:1,info:2,warn:3,error:4};function o(){this.enabled=!0,this.defaultResult=!0,this.clear()}function s(e,t){return e.n.test?e.n.test(t):e.n==t}r.mixin(o),o.prototype.allow=function(e,t){return this._white.push({n:e,l:i[t]}),this},o.prototype.deny=function(e,t){return this._black.push({n:e,l:i[t]}),this},o.prototype.clear=function(){return this._white=[],this._black=[],this},o.prototype.test=function(e,t){var n,r=Math.max(this._white.length,this._black.length);for(n=0;n=this._white[n].l)return!0;if(this._black[n]&&s(this._black[n],e)&&i[t]<=this._black[n].l)return!1}return this.defaultResult},o.prototype.write=function(e,t,n){if(!this.enabled||this.test(e,t))return this.emit("item",e,t,n)},e.exports=o},function(e,t,n){var r=n(0),i=/\\n+$/,o=new r;o.write=function(e,t,n){var r=n.length-1;if("undefined"!=typeof console&&console.log){if(console.log.apply)return console.log.apply(console,[e,t].concat(n));if(JSON&&JSON.stringify){n[r]&&"string"==typeof n[r]&&(n[r]=n[r].replace(i,""));try{for(r=0;r{this.loaded=!0,A&&A()};const t=this.toString(!0);B.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(t)),this.loaded=!1}toString(A){return g(this._svgTag,A)}draw(A){if(!this.loaded)throw new Error("SVG image has not finished loading");this._drawFromImage(A)}_drawFromImage(A){if(null===this._cachedImage)return;const B=Number.isFinite(A)?A:1,t=this._measurements;this._canvas.width=t.width*B,this._canvas.height=t.height*B,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(B,0,0,B,0,0),this._context.drawImage(this._cachedImage,0,0))}}},function(A,B){A.exports=function(A){const B=A.match(/]*>/);B&&-1===B[0].indexOf("xmlns=")&&(A=A.replace("]+?xlink:href=["'])data:img\/png/g,(A,B)=>"".concat(B,"data:image/png")));const t=/(<[^>]+?xmlns:(?!xml=)[^ ]+=)"http:\/\/www.w3.org\/XML\/1998\/namespace"/g;return null!==A.match(t)&&(A=A.replace(t,(A,B)=>"".concat(B,'"http://dummy.namespace"'))),A=(A=(A=A.replace(/<(\/?)\s*svg:/g,"<$1")).replace(/[\s\S]*<\/metadata>/,"")).replace(/[\s\S]*<\/script>/,"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(A,B){A.exports={rgbToHsv:(A,B)=>{let[t,e,g]=A,i=0;t/=255,e/=255,g/=255;let Q=0;e{let[t,e,g]=A;if(0===e)return B[0]=B[1]=B[2]=255*g+.5,B;t%=1;const i=6*t|0,Q=6*t-i,s=g*(1-e),n=g*(1-e*Q),r=g*(1-e*(1-Q));let E=0,c=0,o=0;switch(i){case 0:E=g,c=r,o=s;break;case 1:E=n,c=g,o=s;break;case 2:E=s,c=g,o=r;break;case 3:E=s,c=n,o=g;break;case 4:E=r,c=s,o=g;break;case 5:E=g,c=s,o=n}return B[0]=255*E+.5,B[1]=255*c+.5,B[2]=255*o+.5,B}}},function(A,B,t){const e=t(9),g=t(34),i=t(33),Q=t(24),s={color4f:[0,0,1,1],diameter:1},n=[0,0,0,0];A.exports=class extends i{constructor(A,B){super(A,B),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()},this.renderQuality=1,this._nativeSize=B.getNativeSize(),this._resetAttributeIndexes(),this.a_lineColor=new Float32Array(65520),this.a_lineThicknessAndLength=new Float32Array(32760),this.a_penPoints=new Float32Array(65520),this.a_position=new Float32Array(32760);for(let A=0;Athis._enterDrawTexture(),exit:()=>this._exitDrawTexture()},this.onNativeSizeChanged=this.onNativeSizeChanged.bind(this),this._renderer.on(g.Events.NativeSizeChanged,this.onNativeSizeChanged),this._setCanvasSize(B.getNativeSize())}dispose(){this._renderer.removeListener(g.Events.NativeSizeChanged,this.onNativeSizeChanged),this._renderer.gl.deleteTexture(this._texture),this._texture=null,super.dispose()}get size(){return this._nativeSize}useNearest(A){return Math.max(A[0],A[1])>=100}getTexture(A){return this._texture}clear(){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const A=this._renderer.gl;A.clearColor(0,0,0,0),A.clear(A.COLOR_BUFFER_BIT),this._silhouetteDirty=!0}drawPoint(A,B,t){this.drawLine(A,B,t,B,t)}drawLine(A,B,t,e,g){const i=A.diameter||s.diameter,Q=1===i||3===i?.5:0;this._drawLineOnBuffer(A,B+Q,t+Q,e+Q,g+Q),this._silhouetteDirty=!0}_enterDrawLineOnBuffer(){this._resetAttributeIndexes();const A=this._renderer.gl;e.bindFramebufferInfo(A,this._framebuffer),A.viewport(0,0,this._size[0],this._size[1]);const B=this._lineShader;A.useProgram(B.program),e.setBuffersAndAttributes(A,B,this._lineBufferInfo);const t={u_skin:this._texture,u_stageSize:this._size};e.setUniforms(B,t)}_exitDrawLineOnBuffer(){this.a_lineColorIndex&&this._flushLines();const A=this._renderer.gl;e.bindFramebufferInfo(A,null)}_enterUsePenBuffer(){e.bindFramebufferInfo(this._renderer.gl,this._framebuffer)}_exitUsePenBuffer(){e.bindFramebufferInfo(this._renderer.gl,null)}_enterDrawTexture(){this._enterUsePenBuffer();const A=this._renderer.gl;A.viewport(0,0,this._size[0],this._size[1]),A.useProgram(this._drawTextureShader.program),e.setBuffersAndAttributes(A,this._drawTextureShader,this._renderer._bufferInfo)}_exitDrawTexture(){this._exitUsePenBuffer()}_drawPenTexture(A){this._renderer.enterDrawRegion(this._drawTextureRegionId);const B=this._renderer.gl,t=this._size[0],g=this._size[1],i={u_skin:A,u_projectionMatrix:e.m4.ortho(t/2,t/-2,g/-2,g/2,-1,1,e.m4.identity()),u_modelMatrix:e.m4.scaling(e.v3.create(t,g,0),e.m4.identity())};e.setTextureParameters(B,A,{minMag:B.NEAREST}),e.setUniforms(this._drawTextureShader,i),e.drawBufferInfo(B,this._renderer._bufferInfo,B.TRIANGLES)}_drawLineOnBuffer(A,B,t,e,g){this._renderer.enterDrawRegion(this._lineOnBufferDrawRegionId),this.a_lineColorIndex+24>65520&&this._flushLines();const i=A.color4f||s.color4f;n[0]=i[0]*i[3],n[1]=i[1]*i[3],n[2]=i[2]*i[3],n[3]=i[3],B*=this.renderQuality,t*=this.renderQuality;const Q=(e*=this.renderQuality)-B,r=(g*=this.renderQuality)-t,E=Math.sqrt(Q*Q+r*r),c=(A.diameter||s.diameter)*this.renderQuality;for(let A=0;A<6;A++)this.a_lineColor[this.a_lineColorIndex]=n[0],this.a_lineColorIndex++,this.a_lineColor[this.a_lineColorIndex]=n[1],this.a_lineColorIndex++,this.a_lineColor[this.a_lineColorIndex]=n[2],this.a_lineColorIndex++,this.a_lineColor[this.a_lineColorIndex]=n[3],this.a_lineColorIndex++,this.a_lineThicknessAndLength[this.a_lineThicknessAndLengthIndex]=c,this.a_lineThicknessAndLengthIndex++,this.a_lineThicknessAndLength[this.a_lineThicknessAndLengthIndex]=E,this.a_lineThicknessAndLengthIndex++,this.a_penPoints[this.a_penPointsIndex]=B,this.a_penPointsIndex++,this.a_penPoints[this.a_penPointsIndex]=-t,this.a_penPointsIndex++,this.a_penPoints[this.a_penPointsIndex]=Q,this.a_penPointsIndex++,this.a_penPoints[this.a_penPointsIndex]=-r,this.a_penPointsIndex++}_resetAttributeIndexes(){this.a_lineColorIndex=0,this.a_lineThicknessAndLengthIndex=0,this.a_penPointsIndex=0}_flushLines(){const A=this._renderer.gl,B=this._lineShader;this.a_lineColorIndex<1e3?(e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineColor,new Float32Array(this.a_lineColor.buffer,0,this.a_lineColorIndex),0),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_penPoints,new Float32Array(this.a_penPoints.buffer,0,this.a_penPointsIndex),0),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineThicknessAndLength,new Float32Array(this.a_lineThicknessAndLength.buffer,0,this.a_lineThicknessAndLengthIndex),0)):(e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineColor,this.a_lineColor),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_penPoints,this.a_penPoints),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineThicknessAndLength,this.a_lineThicknessAndLength)),e.setBuffersAndAttributes(A,B,this._lineBufferInfo),e.drawBufferInfo(A,this._lineBufferInfo,A.TRIANGLES,this.a_lineThicknessAndLengthIndex/2),this._resetAttributeIndexes(),this._silhouetteDirty=!0}onNativeSizeChanged(A){this._nativeSize=A.newSize,this._setCanvasSize(A.newSize),this.emitWasAltered()}_setCanvasSize(A){const[B,t]=A;if(this._size&&this._size[0]===B&&this._size[1]===t)return;this._size=A,this._rotationCenter[0]=this._nativeSize[0]/2,this._rotationCenter[1]=this._nativeSize[1]/2;const g=this._renderer.gl,i=this._texture;this._texture=e.createTexture(g,{mag:g.NEAREST,min:g.NEAREST,wrap:g.CLAMP_TO_EDGE,width:B,height:t});const Q=[{format:g.RGBA,attachment:this._texture}];this._framebuffer,this._framebuffer=e.createFramebufferInfo(g,Q,B,t),g.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT),i&&this._drawPenTexture(i),this._silhouettePixels=new Uint8Array(Math.floor(B*t*4)),this._silhouetteImageData=new ImageData(B,t),this._silhouetteDirty=!0}setRenderQuality(A){this.renderQuality!==A&&(this.renderQuality=A,this._setCanvasSize([Math.round(this._nativeSize[0]*A),Math.round(this._nativeSize[1]*A)]))}updateSilhouette(){if(this._silhouetteDirty){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const A=this._renderer.gl;A.readPixels(0,0,this._size[0],this._size[1],A.RGBA,A.UNSIGNED_BYTE,this._silhouettePixels),this._silhouetteImageData.data.set(this._silhouettePixels),this._silhouette.update(this._silhouetteImageData,!0),this._silhouetteDirty=!1}}}},function(A,B,t){const e=t(9),g=t(33),{loadSvgString:i,serializeSvgToString:Q}=t(277),s=t(24);A.exports=class extends g{constructor(A,B){super(A,B),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(A,B){return 0==(B.enabledEffects&(s.EFFECT_INFO.fisheye.mask|s.EFFECT_INFO.whirl.mask|s.EFFECT_INFO.pixelate.mask|s.EFFECT_INFO.mosaic.mask))&&(B._direction%90==0&&(Math.abs(A[0])>99&&Math.abs(A[0])<101&&Math.abs(A[1])>99&&Math.abs(A[1])<101))}createMIP(A){const B=this._largestMIPScale0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(A),this._silhouette.unlazy()}getTexture(A){const B=A?Math.max(Math.abs(A[0]),Math.abs(A[1])):100,t=Math.min(B/100,this._maxTextureScale),e=Math.max(Math.ceil(Math.log2(t))+8,0),g=Math.pow(2,e-8);return this._svgImageLoaded&&!this._scaledMIPs[e]&&(this._scaledMIPs[e]=this.createMIP(g)),this._scaledMIPs[e]||super.getTexture()}resetMIPs(){this._scaledMIPs.forEach(A=>this._renderer.gl.deleteTexture(A)),this._scaledMIPs.length=0,this._largestMIPScale=0}setSVG(A,B){const t=i(A),e=Q(t,!0);this._svgImageLoaded=!1;const{x:g,y:s,width:n,height:r}=t.viewBox.baseVal;this._size[0]=n,this._size[1]=r,this._svgImage.onload=()=>{if(0===n||0===r)return void super.setEmptyImageData();const A=Math.ceil(Math.max(n,r));let t=2;for(;A*t<=4096;t*=2)this._maxTextureScale=t;this.resetMIPs(),void 0===B&&(B=this.calculateRotationCenter()),this._rotationCenter[0]=B[0]-g,this._rotationCenter[1]=B[1]-s,this._svgImageLoaded=!0,this.emitWasAltered()},this._svgImage.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(e))}}},function(A,B,t){const e=t(278),g=t(282),i=t(95),Q=t(92),s=t(94),n=t(43),r=t(93);A.exports={BitmapAdapter:g,convertFonts:r,inlineSvgFonts:i,loadSvgString:Q,serializeSvgToString:s,SvgElement:n,SVGRenderer:e}},function(A,B,t){const e=t(92),g=t(94);A.exports=class{constructor(A){this._canvas=A||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(A,B){this._cachedImage=null;const t=e(A,B);this._svgTag=t,this._measurements={width:t.viewBox.baseVal.width,height:t.viewBox.baseVal.height,x:t.viewBox.baseVal.x,y:t.viewBox.baseVal.y}}loadSVG(A,B,t){this.loadString(A,B),this._createSVGImage(t)}_createSVGImage(A){null===this._cachedImage&&(this._cachedImage=new Image);const B=this._cachedImage;B.onload=()=>{this.loaded=!0,A&&A()};const t=this.toString(!0);B.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(t)),this.loaded=!1}toString(A){return g(this._svgTag,A)}draw(A){if(!this.loaded)throw new Error("SVG image has not finished loading");this._drawFromImage(A)}_drawFromImage(A){if(null===this._cachedImage)return;const B=Number.isFinite(A)?A:1,t=this._measurements;this._canvas.width=t.width*B,this._canvas.height=t.height*B,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(B,0,0,B,0,0),this._context.drawImage(this._cachedImage,0,0))}}},function(A,B){A.exports=function(A){const B=A.match(/]*>/);B&&-1===B[0].indexOf("xmlns=")&&(A=A.replace("]+?xlink:href=["'])data:img\/png/g,(A,B)=>"".concat(B,"data:image/png")));const t=/(<[^>]+?xmlns:(?!xml=)[^ ]+=)"http:\/\/www.w3.org\/XML\/1998\/namespace"/g;return null!==A.match(t)&&(A=A.replace(t,(A,B)=>"".concat(B,'"http://dummy.namespace"'))),A=(A=(A=A.replace(/<(\/?)\s*svg:/g,"<$1")).replace(/[\s\S]*<\/metadata>/,"")).replace(/[\s\S]*<\/script>/,"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(A,B){A.exports={rgbToHsv:(A,B)=>{let[t,e,g]=A,i=0;t/=255,e/=255,g/=255;let Q=0;e{let[t,e,g]=A;if(0===e)return B[0]=B[1]=B[2]=255*g+.5,B;t%=1;const i=6*t|0,Q=6*t-i,s=g*(1-e),n=g*(1-e*Q),r=g*(1-e*(1-Q));let c=0,E=0,o=0;switch(i){case 0:c=g,E=r,o=s;break;case 1:c=n,E=g,o=s;break;case 2:c=s,E=g,o=r;break;case 3:c=s,E=n,o=g;break;case 4:c=r,E=s,o=g;break;case 5:c=g,E=s,o=n}return B[0]=255*c+.5,B[1]=255*E+.5,B[2]=255*o+.5,B}}},function(A,B,t){const e=t(9),g=t(35),i=t(34),Q=t(25),s={color4f:[0,0,1,1],diameter:1},n=[0,0,0,0];A.exports=class extends i{constructor(A,B){super(A,B),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()},this.renderQuality=1,this._nativeSize=B.getNativeSize(),this._resetAttributeIndexes(),this.a_lineColor=new Float32Array(65520),this.a_lineThicknessAndLength=new Float32Array(32760),this.a_penPoints=new Float32Array(65520),this.a_position=new Float32Array(32760);for(let A=0;Athis._enterDrawTexture(),exit:()=>this._exitDrawTexture()},this.onNativeSizeChanged=this.onNativeSizeChanged.bind(this),this._renderer.on(g.Events.NativeSizeChanged,this.onNativeSizeChanged),this._setCanvasSize(B.getNativeSize())}dispose(){this._renderer.removeListener(g.Events.NativeSizeChanged,this.onNativeSizeChanged),this._renderer.gl.deleteTexture(this._texture),this._texture=null,super.dispose()}get size(){return this._nativeSize}useNearest(A){return Math.max(A[0],A[1])>=100}getTexture(A){return this._texture}clear(){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const A=this._renderer.gl;A.clearColor(0,0,0,0),A.clear(A.COLOR_BUFFER_BIT),this._silhouetteDirty=!0}drawPoint(A,B,t){this.drawLine(A,B,t,B,t)}drawLine(A,B,t,e,g){const i=A.diameter||s.diameter,Q=1===i||3===i?.5:0;this._drawLineOnBuffer(A,B+Q,t+Q,e+Q,g+Q),this._silhouetteDirty=!0}_enterDrawLineOnBuffer(){this._resetAttributeIndexes();const A=this._renderer.gl;e.bindFramebufferInfo(A,this._framebuffer),A.viewport(0,0,this._size[0],this._size[1]);const B=this._lineShader;A.useProgram(B.program),e.setBuffersAndAttributes(A,B,this._lineBufferInfo);const t={u_skin:this._texture,u_stageSize:this._size};e.setUniforms(B,t)}_exitDrawLineOnBuffer(){this.a_lineColorIndex&&this._flushLines();const A=this._renderer.gl;e.bindFramebufferInfo(A,null)}_enterUsePenBuffer(){e.bindFramebufferInfo(this._renderer.gl,this._framebuffer)}_exitUsePenBuffer(){e.bindFramebufferInfo(this._renderer.gl,null)}_enterDrawTexture(){this._enterUsePenBuffer();const A=this._renderer.gl;A.viewport(0,0,this._size[0],this._size[1]),A.useProgram(this._drawTextureShader.program),e.setBuffersAndAttributes(A,this._drawTextureShader,this._renderer._bufferInfo)}_exitDrawTexture(){this._exitUsePenBuffer()}_drawPenTexture(A){this._renderer.enterDrawRegion(this._drawTextureRegionId);const B=this._renderer.gl,t=this._size[0],g=this._size[1],i={u_skin:A,u_projectionMatrix:e.m4.ortho(t/2,t/-2,g/-2,g/2,-1,1,e.m4.identity()),u_modelMatrix:e.m4.scaling(e.v3.create(t,g,0),e.m4.identity())};e.setTextureParameters(B,A,{minMag:B.NEAREST}),e.setUniforms(this._drawTextureShader,i),e.drawBufferInfo(B,this._renderer._bufferInfo,B.TRIANGLES)}_drawLineOnBuffer(A,B,t,e,g){this._renderer.enterDrawRegion(this._lineOnBufferDrawRegionId),this.a_lineColorIndex+24>65520&&this._flushLines();const i=A.color4f||s.color4f;n[0]=i[0]*i[3],n[1]=i[1]*i[3],n[2]=i[2]*i[3],n[3]=i[3],B*=this.renderQuality,t*=this.renderQuality;const Q=(e*=this.renderQuality)-B,r=(g*=this.renderQuality)-t,c=Math.sqrt(Q*Q+r*r),E=(A.diameter||s.diameter)*this.renderQuality;for(let A=0;A<6;A++)this.a_lineColor[this.a_lineColorIndex]=n[0],this.a_lineColorIndex++,this.a_lineColor[this.a_lineColorIndex]=n[1],this.a_lineColorIndex++,this.a_lineColor[this.a_lineColorIndex]=n[2],this.a_lineColorIndex++,this.a_lineColor[this.a_lineColorIndex]=n[3],this.a_lineColorIndex++,this.a_lineThicknessAndLength[this.a_lineThicknessAndLengthIndex]=E,this.a_lineThicknessAndLengthIndex++,this.a_lineThicknessAndLength[this.a_lineThicknessAndLengthIndex]=c,this.a_lineThicknessAndLengthIndex++,this.a_penPoints[this.a_penPointsIndex]=B,this.a_penPointsIndex++,this.a_penPoints[this.a_penPointsIndex]=-t,this.a_penPointsIndex++,this.a_penPoints[this.a_penPointsIndex]=Q,this.a_penPointsIndex++,this.a_penPoints[this.a_penPointsIndex]=-r,this.a_penPointsIndex++}_resetAttributeIndexes(){this.a_lineColorIndex=0,this.a_lineThicknessAndLengthIndex=0,this.a_penPointsIndex=0}_flushLines(){const A=this._renderer.gl,B=this._lineShader;this.a_lineColorIndex<1e3?(e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineColor,new Float32Array(this.a_lineColor.buffer,0,this.a_lineColorIndex),0),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_penPoints,new Float32Array(this.a_penPoints.buffer,0,this.a_penPointsIndex),0),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineThicknessAndLength,new Float32Array(this.a_lineThicknessAndLength.buffer,0,this.a_lineThicknessAndLengthIndex),0)):(e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineColor,this.a_lineColor),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_penPoints,this.a_penPoints),e.setAttribInfoBufferFromArray(A,this._lineBufferInfo.attribs.a_lineThicknessAndLength,this.a_lineThicknessAndLength)),e.setBuffersAndAttributes(A,B,this._lineBufferInfo),e.drawBufferInfo(A,this._lineBufferInfo,A.TRIANGLES,this.a_lineThicknessAndLengthIndex/2),this._resetAttributeIndexes(),this._silhouetteDirty=!0}onNativeSizeChanged(A){this._nativeSize=A.newSize,this._setCanvasSize([A.newSize[0]*this.renderQuality,A.newSize[1]*this.renderQuality]),this.emitWasAltered()}_setCanvasSize(A){const[B,t]=A;if(this._size&&this._size[0]===B&&this._size[1]===t)return;this._size=A,this._rotationCenter[0]=this._nativeSize[0]/2,this._rotationCenter[1]=this._nativeSize[1]/2;const g=this._renderer.gl,i=this._texture;this._texture=e.createTexture(g,{mag:g.NEAREST,min:g.NEAREST,wrap:g.CLAMP_TO_EDGE,width:B,height:t});const Q=[{format:g.RGBA,attachment:this._texture}];this._framebuffer,this._framebuffer=e.createFramebufferInfo(g,Q,B,t),g.clearColor(0,0,0,0),g.clear(g.COLOR_BUFFER_BIT),i&&this._drawPenTexture(i),this._silhouettePixels=new Uint8Array(Math.floor(B*t*4)),this._silhouetteImageData=new ImageData(B,t),this._silhouetteDirty=!0}setRenderQuality(A){this.renderQuality!==A&&(this.renderQuality=A,this._setCanvasSize([Math.round(this._nativeSize[0]*A),Math.round(this._nativeSize[1]*A)]))}updateSilhouette(){if(this._silhouetteDirty){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);const A=this._renderer.gl;A.readPixels(0,0,this._size[0],this._size[1],A.RGBA,A.UNSIGNED_BYTE,this._silhouettePixels),this._silhouetteImageData.data.set(this._silhouettePixels),this._silhouette.update(this._silhouetteImageData,!0),this._silhouetteDirty=!1}}}},function(A,B,t){const e=t(9),g=t(34),{loadSvgString:i,serializeSvgToString:Q}=t(280),s=t(25);A.exports=class extends g{constructor(A,B){super(A,B),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(A,B){return 0==(B.enabledEffects&(s.EFFECT_INFO.fisheye.mask|s.EFFECT_INFO.whirl.mask|s.EFFECT_INFO.pixelate.mask|s.EFFECT_INFO.mosaic.mask))&&(B._direction%90==0&&(Math.abs(A[0])>99&&Math.abs(A[0])<101&&Math.abs(A[1])>99&&Math.abs(A[1])<101))}createMIP(A){const B=this._largestMIPScale0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(A),this._silhouette.unlazy()}getTexture(A){const B=A?Math.max(Math.abs(A[0]),Math.abs(A[1])):100,t=Math.min(B/100,this._maxTextureScale),e=Math.max(Math.ceil(Math.log2(t))+8,0),g=Math.pow(2,e-8);return this._svgImageLoaded&&!this._scaledMIPs[e]&&(this._scaledMIPs[e]=this.createMIP(g)),this._scaledMIPs[e]||super.getTexture()}resetMIPs(){this._scaledMIPs.forEach(A=>this._renderer.gl.deleteTexture(A)),this._scaledMIPs.length=0,this._largestMIPScale=0}setSVG(A,B){const t=i(A),e=Q(t,!0);this._svgImageLoaded=!1;const{x:g,y:s,width:n,height:r}=t.viewBox.baseVal;this._size[0]=n,this._size[1]=r,this._svgImage.onload=()=>{if(0===n||0===r)return void super.setEmptyImageData();const A=Math.ceil(Math.max(n,r));let t=2;for(;A*t<=2048;t*=2)this._maxTextureScale=t;this.resetMIPs(),void 0===B&&(B=this.calculateRotationCenter()),this._rotationCenter[0]=B[0]-g,this._rotationCenter[1]=B[1]-s,this._svgImageLoaded=!0,this.emitWasAltered()},this._svgImage.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(e))}}},function(A,B,t){const e=t(281),g=t(285),i=t(96),Q=t(93),s=t(95),n=t(43),r=t(94);A.exports={BitmapAdapter:g,convertFonts:r,inlineSvgFonts:i,loadSvgString:Q,serializeSvgToString:s,SvgElement:n,SVGRenderer:e}},function(A,B,t){const e=t(93),g=t(95);A.exports=class{constructor(A){this._canvas=A||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(A,B){this._cachedImage=null;const t=e(A,B);this._svgTag=t,this._measurements={width:t.viewBox.baseVal.width,height:t.viewBox.baseVal.height,x:t.viewBox.baseVal.x,y:t.viewBox.baseVal.y}}loadSVG(A,B,t){this.loadString(A,B),this._createSVGImage(t)}_createSVGImage(A){null===this._cachedImage&&(this._cachedImage=new Image);const B=this._cachedImage;B.onload=()=>{this.loaded=!0,A&&A()};const t=this.toString(!0);B.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(t)),this.loaded=!1}toString(A){return g(this._svgTag,A)}draw(A){if(!this.loaded)throw new Error("SVG image has not finished loading");this._drawFromImage(A)}_drawFromImage(A){if(null===this._cachedImage)return;const B=Number.isFinite(A)?A:1,t=this._measurements;this._canvas.width=t.width*B,this._canvas.height=t.height*B,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(B,0,0,B,0,0),this._context.drawImage(this._cachedImage,0,0))}}},function(A,B){A.exports=function(A){const B=A.match(/]*>/);B&&-1===B[0].indexOf("xmlns=")&&(A=A.replace("]+?xlink:href=["'])data:img\/png/g,(A,B)=>"".concat(B,"data:image/png")));const t=/(<[^>]+?xmlns:(?!xml=)[^ ]+=)"http:\/\/www.w3.org\/XML\/1998\/namespace"/g;return null!==A.match(t)&&(A=A.replace(t,(A,B)=>"".concat(B,'"http://dummy.namespace"'))),A=(A=(A=A.replace(/<(\/?)\s*svg:/g,"<$1")).replace(/[\s\S]*<\/metadata>/,"")).replace(/[\s\S]*<\/script>/," + */g=[],void 0===(i="function"==typeof(e=function(){var A=function(A,B){this._dragged=!1,this._element=A,this._bindedMove=this._moved.bind(this),this._bindedEnd=this._ended.bind(this,B),A.addEventListener("touchstart",this._bindedEnd),A.addEventListener("touchmove",this._bindedMove),A.addEventListener("touchend",this._bindedEnd),A.addEventListener("mouseup",this._bindedEnd)};function B(A){return"running"===A.state}return A.prototype._moved=function(A){this._dragged=!0},A.prototype._ended=function(A){this._dragged||function(A){var B=A.createBuffer(1,1,A.sampleRate),t=A.createBufferSource();t.buffer=B,t.connect(A.destination),t.start(0),A.resume&&A.resume()}(A),this._dragged=!1},A.prototype.dispose=function(){this._element.removeEventListener("touchstart",this._bindedEnd),this._element.removeEventListener("touchmove",this._bindedMove),this._element.removeEventListener("touchend",this._bindedEnd),this._element.removeEventListener("mouseup",this._bindedEnd),this._bindedMove=null,this._bindedEnd=null,this._element=null},function(t,e,g){var i=new Promise((function(A){!function(A,t){B(A)?t():function e(){B(A)?t():(requestAnimationFrame(e),A.resume&&A.resume())}()}(t,A)})),Q=[];return e||(e=document.body),function B(t,e,g){if(Array.isArray(t)||NodeList&&t instanceof NodeList)for(var i=0;i{const i=new e(A);"RIFF"!==i.readUint8String(4)&&(g.warn("incorrect adpcm wav header"),t());const Q=i.readInt32();Q+8!==A.byteLength&&g.warn("adpcm wav length in header: ".concat(Q," is incorrect"));"WAVE"!==i.readUint8String(4)&&(g.warn("incorrect adpcm wav header"),t());const s=this.extractChunk("fmt ",i);this.encoding=s.readUint16(),this.channels=s.readUint16(),this.samplesPerSecond=s.readUint32(),this.bytesPerSecond=s.readUint32(),this.blockAlignment=s.readUint16(),this.bitsPerSample=s.readUint16(),s.position+=2,this.samplesPerBlock=s.readUint16(),this.adpcmBlockSize=(this.samplesPerBlock-1)/2+4;const n=this.extractChunk("data",i),r=this.numberOfSamples(n,this.adpcmBlockSize),c=this.audioContext.createBuffer(1,r,this.samplesPerSecond);this.imaDecompress(n,this.adpcmBlockSize,c.getChannelData(0)),B(c)})}extractChunk(A,B){for(B.position=12;B.position>1),1&A&&(g+=B>>2),g+=B>>3,s[t++]=8&A?-g:g}}return s}();let C=0;for(;C88&&(r=88),t[C++]=e/32768;const B=Math.min(o,E-C),i=C;for(;C-i88?r=88:r<0&&(r=0),e+=n,e>32767?e=32767:e<-32768&&(e=-32768),t[C++]=e/32768,g=c>>4&15,n=w[16*r+g],r+=Q[g],r>88?r=88:r<0&&(r=0),e+=n,e>32767?e=32767:e<-32768&&(e=-32768),t[C++]=e/32768}}}},function(A,B){class t{constructor(A){let B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.byteLength,{_uint8View:e=new Uint8Array(A)}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.arrayBuffer=A,this.start=B,this.end=t,this._uint8View=e,this._position=B}extract(A){return new t(this.arrayBuffer,this._position,this._position+A,this)}getLength(){return this.end-this.start}getBytesAvailable(){return this.end-this._position}get position(){return this._position-this.start}set position(A){return this._position=A+this.start,A}readUint8(){const A=this._uint8View[this._position];return this._position+=1,A}readUint8String(A){const B=this._uint8View;let t="";const e=this._position+A;for(let A=this._position;A{this.audioStream=A,this.mic=this.audioContext.createMediaStreamSource(A),this.analyser=this.audioContext.createAnalyser(),this.mic.connect(this.analyser),this.micDataArray=new Float32Array(this.analyser.fftSize)}).catch(A=>{e.warn(A)})),this.mic&&this.audioStream.active){this.analyser.getFloatTimeDomainData(this.micDataArray);let A=0;for(let B=0;Bthis.audioEngine.currentTime}handleEvent(A){"ended"===A.type&&this.onEnded()}onEnded(){this.emit("stop"),this.isPlaying=!1}_createSource(){null!==this.outputNode&&(this.outputNode.removeEventListener("ended",this.handleEvent),this.outputNode.disconnect()),this.outputNode=this.audioEngine.audioContext.createBufferSource(),this.outputNode.playbackRate.value=this.playbackRate,this.outputNode.buffer=this.buffer,this.outputNode.addEventListener("ended",this.handleEvent),null!==this.target&&this.connect(this.target)}initialize(){this.initialized=!0,this._createSource()}connect(A){return A===this.volumeEffect?(this.outputNode.disconnect(),void this.outputNode.connect(this.volumeEffect.getInputNode())):(this.target=A,this.initialized?(null===this.volumeEffect?(this.outputNode.disconnect(),this.outputNode.connect(A.getInputNode())):this.volumeEffect.connect(A),this):void 0)}dispose(){this.initialized&&(this.stopImmediately(),null!==this.volumeEffect&&(this.volumeEffect.dispose(),this.volumeEffect=null),this.outputNode.disconnect(),this.outputNode=null,this.target=null,this.initialized=!1)}take(){this.outputNode&&this.outputNode.removeEventListener("ended",this.handleEvent);const A=new i(this.audioEngine,this);return A.playbackRate=this.playbackRate,this.isPlaying&&(A.startingUntil=this.startingUntil,A.isPlaying=this.isPlaying,A.initialized=this.initialized,A.outputNode=this.outputNode,A.outputNode.addEventListener("ended",A.handleEvent),A.volumeEffect=this.volumeEffect,A.volumeEffect&&(A.volumeEffect.audioPlayer=A),null!==this.target&&A.connect(this.target),this.emit("stop"),A.emit("play")),this.outputNode=null,this.volumeEffect=null,this.initialized=!1,this.startingUntil=0,this.isPlaying=!1,A}play(){if(this.isStarting)return this.emit("stop"),void this.emit("play");this.isPlaying&&this.stop(),this.initialized?this._createSource():this.initialize(),this.outputNode.start(),this.isPlaying=!0;const{currentTime:A,DECAY_DURATION:B}=this.audioEngine;this.startingUntil=A+B,this.emit("play")}stop(){if(!this.isPlaying)return;const A=this.take();A.volumeEffect=new g(A.audioEngine,A,null),A.volumeEffect.connect(A.target),A.finished().then(()=>A.dispose()),A.volumeEffect.set(0);const{currentTime:B,DECAY_DURATION:t}=this.audioEngine;A.outputNode.stop(B+t)}stopImmediately(){this.isPlaying&&(this.outputNode.stop(),this.isPlaying=!1,this.startingUntil=0,this.emit("stop"))}finished(){return new Promise(A=>{this.once("stop",A)})}setPlaybackRate(A){this.playbackRate=A,this.initialized&&(this.outputNode.playbackRate.value=A)}}A.exports=i},function(A,B){class t{constructor(A,B){this.audioEngine=A,this.inputNode=this.audioEngine.audioContext.createGain(),this.effects=B;let t=null;this._effects=B.reverse().map(B=>{const e=new B(A,this,t);return this[e.name]=e,t=e,e}).reverse(),this.firstEffect=this._effects[0],this.lastEffect=this._effects[this._effects.length-1],this._soundPlayers=new Set}clone(){const A=new t(this.audioEngine,this.effects);return this.target&&A.connect(this.target),A}addSoundPlayer(A){this._soundPlayers.has(A)||(this._soundPlayers.add(A),this.update())}removeSoundPlayer(A){this._soundPlayers.remove(A)}getInputNode(){return this.inputNode}connect(A){const{firstEffect:B,lastEffect:t}=this;if(A===t)return this.inputNode.disconnect(),void this.inputNode.connect(t.getInputNode());A!==B&&(this.target=A,B.connect(A))}getSoundPlayers(){return[...this._soundPlayers]}setEffectsFromTarget(A){this._effects.forEach(B=>{"soundEffects"in A&&B.name in A.soundEffects?B.set(A.soundEffects[B.name]):B.name in A&&B.set(A[B.name])})}set(A,B){A in this&&this[A].set(B)}update(){this._effects.forEach(A=>A.update())}clear(){this._effects.forEach(A=>A.clear())}dispose(){this._soundPlayers=null,this._effects.forEach(A=>A.dispose()),this._effects=null}}A.exports=t},function(A,B,t){const e=t(47);A.exports=class extends e{constructor(A,B,t){super(A,B,t),this.leftGain=null,this.rightGain=null,this.channelMerger=null}get name(){return"pan"}initialize(){const A=this.audioEngine.audioContext;this.inputNode=A.createGain(),this.leftGain=A.createGain(),this.rightGain=A.createGain(),this.channelMerger=A.createChannelMerger(2),this.outputNode=this.channelMerger,this.inputNode.connect(this.leftGain),this.inputNode.connect(this.rightGain),this.leftGain.connect(this.channelMerger,0,0),this.rightGain.connect(this.channelMerger,0,1),this.initialized=!0}_set(A){this.value=A;const B=(A+100)/200,t=Math.cos(B*Math.PI/2),e=Math.sin(B*Math.PI/2),{currentTime:g,DECAY_WAIT:i,DECAY_DURATION:Q}=this.audioEngine;this.leftGain.gain.setTargetAtTime(t,g+i,Q),this.rightGain.gain.setTargetAtTime(e,g+i,Q)}dispose(){this.initialized&&(this.inputNode.disconnect(),this.leftGain.disconnect(),this.rightGain.disconnect(),this.channelMerger.disconnect(),this.inputNode=null,this.leftGain=null,this.rightGain=null,this.channelMerger=null,this.outputNode=null,this.target=null,this.initialized=!1)}}},function(A,B,t){const e=t(47);A.exports=class extends e{constructor(A,B,t){super(A,B,t),this.ratio=1}get name(){return"pitch"}get _isPatch(){return!1}getInputNode(){return this.target.getInputNode()}initialize(){this.initialized=!0}_set(A){this.value=A,this.ratio=this.getRatio(this.value),this.updatePlayers(this.audioPlayer.getSoundPlayers())}update(){this.updatePlayers(this.audioPlayer.getSoundPlayers())}getRatio(A){const B=A/10;return Math.pow(2,B/12)}updatePlayer(A){A.setPlaybackRate(this.ratio)}updatePlayers(A){if(A)for(const B in A)A.hasOwnProperty(B)&&this.updatePlayer(A[B])}}},function(A,B,t){const e=t(36);A.exports=class{constructor(A,B){this.audioEngine=A,this.soundPlayers={},this.playerTargets=new Map,this.soundEffects=new Map,this.effectChainPrime=B}addSoundPlayer(A){this.soundPlayers[A.id]=A}getSoundPlayer(A){return this.soundPlayers[A]||e.error("SoundBank.getSoundPlayer(".concat(A,"): called missing sound in bank")),this.soundPlayers[A]}getSoundEffects(A){return this.soundEffects.has(A)||this.soundEffects.set(A,this.effectChainPrime.clone()),this.soundEffects.get(A)}playSound(A,B){const t=this.getSoundEffects(B),e=this.getSoundPlayer(B);return this.playerTargets.get(B)!==A&&e.stop(),this.playerTargets.set(B,A),t.addSoundPlayer(e),t.setEffectsFromTarget(A),e.connect(t),e.play(),e.finished()}setEffects(A){this.playerTargets.forEach((B,t)=>{B===A&&this.getSoundEffects(t).setEffectsFromTarget(A)})}stop(A,B){this.playerTargets.get(B)===A&&this.soundPlayers[B].stop()}stopAllSounds(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"*";this.playerTargets.forEach((B,t)=>{"*"!==A&&B!==A||this.getSoundPlayer(t).stop()})}dispose(){this.playerTargets.clear(),this.soundEffects.forEach(A=>A.dispose()),this.soundEffects.clear();for(const A in this.soundPlayers)this.soundPlayers.hasOwnProperty(A)&&this.soundPlayers[A].dispose();this.soundPlayers={}}}},function(A,B,t){"use strict";t.r(B),t.d(B,"SB1File",(function(){return eB})),t.d(B,"AssertionError",(function(){return e})),t.d(B,"ValidationError",(function(){return g}));class e extends Error{}class g extends e{}const i=function(A,B){if(!A)throw new e(B)};i.validate=function(A,B){if(!A)throw new g(B)};class Q{constructor(A){let B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.buffer=A,this.position=B,this.uint8a=new Uint8Array(this.buffer)}read(A){const B=A.read(this.uint8a,this.position);return 0===A.size?this.position+=A.sizeOf(this.uint8a,this.position):this.position+=A.size,B}readStruct(A){const B=new A(this.uint8a,this.position);return this.position+=A.size,B}resize(A){if(this.buffer.byteLength1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length;i(A instanceof Uint8Array,"writeBytes must be passed an Uint8Array"),this.resize(this.position+(t-B));for(let e=B;e1&&void 0!==arguments[1]?arguments[1]:1/0;this.iter=A,this.maxPosition=B}[Symbol.iterator](){return this}next(){return this.iter.stream.position>=this.maxPosition?{value:null,done:!0}:this.iter.next()}}const n=()=>{throw new Error("Not implemented")},r=(()=>{const A=new Uint16Array(1),B=new Uint8Array(A.buffer);return A[0]=43707,187===B[0]})();class c{constructor(A){let{size:B=0,sizeOf:t=(()=>B),writeSizeOf:e=n,toBytes:g=new Uint8Array(1),read:i,write:Q=n}=A;this.size=B,this.sizeOf=t,this.writeSizeOf=e,this.toBytes=g,this.bytes=new Uint8Array(g.buffer),this.read=i,this.write=Q}asPropertyObject(A){const B=this;return{get(){return B.read(this.uint8a,A+this.offset)},set(t){return B.write(this.uint8a,A+this.offset,t)},enumerable:!0}}read(){return null}}const E=new c({size:1,read:(A,B)=>A[B],write:(A,B,t)=>(A[B]=t,t)}),o={size:2,read(A,B){return this.bytes[1]=A[B+0],this.bytes[0]=A[B+1],this.toBytes[0]},write(A,B,t){return this.toBytes[0]=t,A[B+0]=this.bytes[1],A[B+1]=this.bytes[0],t}},w={size:2,read(A,B){return this.bytes[0]=A[B+0],this.bytes[1]=A[B+1],this.toBytes[0]},write(A,B,t){return this.toBytes[0]=t,A[B+0]=this.bytes[0],A[B+1]=this.bytes[1],t}};let C;C=r?o:w;new c(Object.assign({},C,{toBytes:new Uint16Array(1)}));const a=new c(Object.assign({},C,{toBytes:new Int16Array(1)})),I={size:4,read(A,B){return this.bytes[3]=A[B+0],this.bytes[2]=A[B+1],this.bytes[1]=A[B+2],this.bytes[0]=A[B+3],this.toBytes[0]},write(A,B,t){return this.toBytes[0]=t,A[B+0]=this.bytes[3],A[B+1]=this.bytes[2],A[B+2]=this.bytes[1],A[B+3]=this.bytes[0],t}},Y={size:4,read(A,B){return this.bytes[0]=A[B+0],this.bytes[1]=A[B+1],this.bytes[2]=A[B+2],this.bytes[3]=A[B+3],this.toBytes[0]},write(A,B,t){return this.toBytes[0]=t,A[B+0]=this.bytes[0],A[B+1]=this.bytes[1],A[B+2]=this.bytes[2],A[B+3]=this.bytes[3],t}};let h;h=r?I:Y;const M=new c(Object.assign({},h,{toBytes:new Int32Array(1)})),F=new c(Object.assign({},h,{toBytes:new Uint32Array(1)}));let D;D=r?w:o;const u=new c(Object.assign({},D,{toBytes:new Uint16Array(1)}));let l;l=r?Y:I;const d=new c(Object.assign({},l,{toBytes:new Uint32Array(1)}));let U;U=r?{size:8,read(A,B){return this.bytes[7]=A[B+0],this.bytes[6]=A[B+1],this.bytes[5]=A[B+2],this.bytes[4]=A[B+3],this.bytes[3]=A[B+4],this.bytes[2]=A[B+5],this.bytes[1]=A[B+6],this.bytes[0]=A[B+7],this.toBytes[0]}}:{size:8,read(A,B){return this.bytes[7]=A[B+0],this.bytes[6]=A[B+1],this.bytes[5]=A[B+2],this.bytes[4]=A[B+3],this.bytes[3]=A[B+4],this.bytes[2]=A[B+5],this.bytes[1]=A[B+6],this.bytes[0]=A[B+7],this.toBytes[0]}};const N=new c(Object.assign({},U,{toBytes:new Float64Array(1)}));class m extends c{constructor(A){super({size:A,read(B,t){let e="";for(let g=0;gA[B+0]<<16|A[B+1]<<8|A[B+2]}:{size:3,read:(A,B)=>A[B+2]<<16|A[B+1]<<8|A[B+0]});const H=new c({sizeOf(A,B){const t=a.read(A,B);return a.size+t},read(A,B){let t=0,e=0;const g=a.read(A,B);for(let i=0;iF.size+F.read(A,B),read(A,B){const t=F.read(A,B);return i(t<10485760,"bytes too big"),B+=F.size,i(t<10485760,"uint8a array too big"),new Uint8Array(A.buffer,B,t)}}),J=new c({sizeOf:(A,B)=>F.size+2*F.read(A,B),read(A,B){const t=F.read(A,B);i(t<10485760,"sound too big"),B+=F.size;const e=2*t;return i(e<10485760,"uint8a array too big"),new Uint8Array(A.buffer,B,e)}}),y=new c({sizeOf:(A,B)=>F.size+F.read(A,B)*F.size,read(A,B){const t=F.read(A,B);i(t<10485760,"bitmap too big"),B+=F.size,i(t<10485760,"uint8a array too big");const e=new Uint32Array(t);for(let g=0;gF.size+F.read(A,B),read(A,B){const t=F.read(A,B);return i(t<10485760,"utf8 too big"),B+=F.size,i(t<10485760,"uint8a array too big"),k.decode(new Uint8Array(A.buffer,B,t))}}),j=new c({size:4,read(A,B){const t=F.read(A,B);return(255<<24|(t>>22&255)<<16|(t>>12&255)<<8|t>>2&255)>>>0}}),x=new c({size:5,read(A,B){const t=F.read(A,B);return(E.read(A,B)<<24|(t>>22&255)<<16|(t>>12&255)<<8|t>>2&255)>>>0}}),S={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},b=Object.entries(S).reduce((A,B)=>{let[t,e]=B;return A[e]=t,A},{});class z{constructor(A,B){this.classId=A,this.position=B}}const L=A=>"object"==typeof A&&A?A.valueOf():A;class P extends z{constructor(A,B,t){super(A,B),this.value=t}valueOf(){return this.value}toJSON(){return this.classId===S.TRANSLUCENT_COLOR||this.classId===S.COLOR?16777215&this.value:this.value}toString(){return this.value}}class v extends z{constructor(A,B,t){super(A,B),this.size=t}}class W extends z{constructor(A,B,t){super(A,B),this.index=t}valueOf(){return"Ref(".concat(this.index,")")}}class V extends v{constructor(A,B,t,e){super(A,B,e),this.version=t}}class K{constructor(A){let{type:B=P,read:t,value:e=(t?A=>A.read(t):null)}=A;this.type=B,this.value=e}next(A,B,t){return{value:new this.type(B,t,this.value(A)),done:!1}}}const O={[S.NULL]:{value:()=>null},[S.TRUE]:{value:()=>!0},[S.FALSE]:{value:()=>!1},[S.SMALL_INT]:{read:M},[S.SMALL_INT_16]:{read:a},[S.LARGE_INT_POSITIVE]:{read:H},[S.LARGE_INT_NEGATIVE]:{read:H},[S.FLOATING]:{read:N},[S.STRING]:{read:R},[S.SYMBOL]:{read:R},[S.BYTES]:{read:p},[S.SOUND]:{read:J},[S.BITMAP]:{read:y},[S.UTF8]:{read:T},[S.ARRAY]:{type:v,read:M},[S.ORDERED_COLLECTION]:{type:v,read:M},[S.SET]:{type:v,read:M},[S.IDENTITY_SET]:{type:v,read:M},[S.DICTIONARY]:{type:v,value:A=>2*A.read(M)},[S.IDENTITY_DICTIONARY]:{type:v,value:A=>2*A.read(M)},[S.COLOR]:{read:j},[S.TRANSLUCENT_COLOR]:{read:x},[S.POINT]:{type:v,value:()=>2},[S.RECTANGLE]:{type:v,value:()=>4},[S.FORM]:{type:v,value:()=>5},[S.SQUEAK]:{type:v,value:()=>6},[S.OBJECT_REF]:{type:W,read:f}},X=Array.from({length:256},(A,B)=>O[B]?new K(O[B]):null),Z=new K({type:class extends v{constructor(A,B){super(A,B,0)}},value:()=>null});class _{constructor(A,B){this.buffer=A,this.stream=new Q(A,B)}[Symbol.iterator](){return this}next(){if(this.stream.position>=this.stream.uint8a.length)return{value:null,done:!0};const A=this.stream.position,B=this.stream.read(E),t=X[B];if(null!==t)return t.next(this.stream,B,A);if(B1&&void 0!==arguments[1]?arguments[1]:q;class t extends B{get FIELDS(){return A}static get FIELDS(){return A}}return Object.keys(A).forEach(B=>{const e=A[B];Object.defineProperty(t.prototype,B.toLowerCase().replace(/_(\w)/g,A=>{let[,B]=A;return B.toUpperCase()}),{get(){return this.fields[e]}})}),t}}class ${constructor(){let A;this.bit=new Uint32Array(1),this.crc=0,this.c=0,this.table=[];for(let B=0;B<256;B++){A=B;for(let B=0;B<8;B++)A=1&A?3988292384^A>>>1:A>>>1;this.table[B]=A>>>0}}update(A){let B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length,e=~this.crc>>>0;for(let g=0;g>>8^this.table[255&(e^A[B+g])];return this.crc=~e>>>0,this}get digest(){return this.crc}}const AA=[0,4278190080,4294967295,4286611584,4294901760,4278255360,4278190335,4278255615,4294967040,4294902015,4280295456,4282400832,4284506208,4288651167,4290756543,4292861919,4278716424,4279242768,4279769112,4280821800,4281348144,4281874488,4282927176,4283453520,4283979864,4285032552,4285558896,4286085240,4287072135,4287598479,4288124823,4289177511,4289703855,4290230199,4291282887,4291809231,4292335575,4293388263,4293914607,4294440951,4278190080,4278203136,4278216192,4278229248,4278242304,4278255360,4278190131,4278203187,4278216243,4278229299,4278242355,4278255411,4278190182,4278203238,4278216294,4278229350,4278242406,4278255462,4278190233,4278203289,4278216345,4278229401,4278242457,4278255513,4278190284,4278203340,4278216396,4278229452,4278242508,4278255564,4278190335,4278203391,4278216447,4278229503,4278242559,4278255615,4281532416,4281545472,4281558528,4281571584,4281584640,4281597696,4281532467,4281545523,4281558579,4281571635,4281584691,4281597747,4281532518,4281545574,4281558630,4281571686,4281584742,4281597798,4281532569,4281545625,4281558681,4281571737,4281584793,4281597849,4281532620,4281545676,4281558732,4281571788,4281584844,4281597900,4281532671,4281545727,4281558783,4281571839,4281584895,4281597951,4284874752,4284887808,4284900864,4284913920,4284926976,4284940032,4284874803,4284887859,4284900915,4284913971,4284927027,4284940083,4284874854,4284887910,4284900966,4284914022,4284927078,4284940134,4284874905,4284887961,4284901017,4284914073,4284927129,4284940185,4284874956,4284888012,4284901068,4284914124,4284927180,4284940236,4284875007,4284888063,4284901119,4284914175,4284927231,4284940287,4288217088,4288230144,4288243200,4288256256,4288269312,4288282368,4288217139,4288230195,4288243251,4288256307,4288269363,4288282419,4288217190,4288230246,4288243302,4288256358,4288269414,4288282470,4288217241,4288230297,4288243353,4288256409,4288269465,4288282521,4288217292,4288230348,4288243404,4288256460,4288269516,4288282572,4288217343,4288230399,4288243455,4288256511,4288269567,4288282623,4291559424,4291572480,4291585536,4291598592,4291611648,4291624704,4291559475,4291572531,4291585587,4291598643,4291611699,4291624755,4291559526,4291572582,4291585638,4291598694,4291611750,4291624806,4291559577,4291572633,4291585689,4291598745,4291611801,4291624857,4291559628,4291572684,4291585740,4291598796,4291611852,4291624908,4291559679,4291572735,4291585791,4291598847,4291611903,4291624959,4294901760,4294914816,4294927872,4294940928,4294953984,4294967040,4294901811,4294914867,4294927923,4294940979,4294954035,4294967091,4294901862,4294914918,4294927974,4294941030,4294954086,4294967142,4294901913,4294914969,4294928025,4294941081,4294954137,4294967193,4294901964,4294915020,4294928076,4294941132,4294954188,4294967244,4294902015,4294915071,4294928127,4294941183,4294954239,4294967295],BA=[4294967295,4278190080],tA=new c({sizeOf(A,B){const t=A[B];return t<=223?1:t<=254?2:5},read(A,B){const t=A[B];return t<=223?t:t<=254?256*(t-224)+A[B+1]:F.read(A,B+1)}});class eA{decode(A,B,t,e,g){const i=this.decodePixels(e,32===t);if(t<=8)return g||(g=1===t?BA:AA),this.unpackPixels(i,A,B,t,g);if(16===t)return this.raster16To32(i,A,B);if(32===t)return i;throw new Error("Unhandled Squeak Image depth.")}decodePixels(A,B){let t;if(Array.isArray(A)||A instanceof Uint32Array){if(t=new Uint32Array(A),B)for(let A=0;A>2;let Q;switch(3&A){case 0:i+=g;break;case 1:Q=e.read(E),Q|=Q<<24|Q<<16|Q<<8,B&&0!==Q&&(Q|=4278190080);for(let A=0;A>c&Q],c-=e}return i}raster16To32(A,B,t){const e=new Uint32Array(2*A.length);let g,i,Q,s=0,n=0;for(let r=0;r>g&65535,0!==Q){Q=4278190080|(Q>>7&248)<<16|(Q>>2&248)<<8|Q<<3&248}e[n++]=Q,g-=16}}return e}buildCustomColormap(A,B,t){const e=new Uint32Array(1<>1,this.bitPosition=0,this.currentByte=0,this.stream=null,this.end=0}decode(A){this.bitPosition=0,this.currentByte=0,this.stream=new Q(A.buffer,A.byteOffset),this.end=A.byteOffset+A.length;const B=Math.floor(8*A.length/this.bitsPerSample),t=new Int16Array(B);let e=0,g=0;for(let A=0;A=0,"Ran out of bits in Squeak Sound");let Q=gA[g],s=0;for(let A=this.valueHighBit;A>0;A>>=1)0!=(B&A)&&(s+=Q),Q>>=1;s+=Q,e+=0==(B&this.signMask)?s:-s,g+=this.indexTable[B],g<0&&(g=0),g>88&&(g=88),e>32767&&(e=32767),e<-32768&&(e=-32768),t[A]=e}return t}nextCode(){let A=this.bitsPerSample,B=A-this.bitPosition,t=B<0?this.currentByte>>-B:this.currentByte<0;){if(A-=this.bitPosition,!(this.end-this.stream.position>0))return this.currentByte=0,this.bitPosition=0,-1;this.currentByte=this.stream.read(E),this.bitPosition=8,B=A-this.bitPosition,t+=B<0?this.currentByte>>-B:this.currentByte<>8-this.bitPosition,t}static samples(A,B){return 8*B.length/A}}class sA{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Uint8Array(this.size),B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;this.uint8a=A,this.offset=B}equals(A){for(const B in A)if(this[B]!==A[B])return!1;return!0}view(){const A=this.constructor.name,B={toString:()=>A};for(const A in this.shape)B[A]=this[A];return B}static initConstructor(A){return A.size=A.prototype.size,A}static extend(A){const B=class extends sA{get shape(){return A}};let t=0;return Object.keys(A).forEach(e=>{if(Object.defineProperty(B.prototype,e,A[e].asPropertyObject(t)),0===A[e].size)throw new Error("Packet cannot be defined with variable sized members.");t+=A[e].size}),B.prototype.size=t,B.size=t,B}}class nA extends(sA.extend({riff:new m(4),length:d,wave:new m(4)})){}sA.initConstructor(nA);class rA extends(sA.extend({chunkType:new m(4),length:d})){}sA.initConstructor(rA);class cA extends(sA.extend({format:u,channels:u,sampleRate:d,bytesPerSec:d,blockAlignment:u,bitsPerSample:u})){}sA.initConstructor(cA);class EA{encode(A){let{channels:B=1,sampleRate:t=22050}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const e=new Uint8Array(A.buffer,A.byteOffset,A.byteLength),g=nA.size+rA.size+cA.size+rA.size+e.length,i=new Q(new ArrayBuffer(g));return i.writeStruct(nA,{riff:"RIFF",length:g-8,wave:"WAVE"}),i.writeStruct(rA,{chunkType:"fmt ",length:cA.size}),i.writeStruct(cA,{format:1,channels:B,sampleRate:t,bytesPerSec:2*t*B,blockAlignment:2*B,bitsPerSample:16}),i.writeStruct(rA,{chunkType:"data",length:g-i.position-rA.size}),i.writeBytes(e),i.uint8a}static encode(A,B){return(new EA).encode(A,B)}static samples(A){const B=new rA(A,nA.size).length;return new rA(A,nA.size+rA.size+B).length/2}}var oA=t(19),wA=t.n(oA);class CA extends(q.define({X:0,Y:1})){}class aA extends(q.define({X:0,Y:1,X2:2,Y2:3})){get width(){return this.x2-this.x}get height(){return this.y2-this.y}}class IA extends(q.define({WIDTH:0,HEIGHT:1,DEPTH:2,BYTES:4,COLORMAP:5})){get decoded(){return this._decoded||(this._decoded=(A=>{for(let B=0;BA.valueOf())).buffer))),this._decoded}get extension(){return"uncompressed"}}class YA extends(q.define({STAGE_CONTENTS:2,OBJ_NAME:6,VARS:7,BLOCKS_BIN:8,IS_CLONE:9,MEDIA:10,CURRENT_COSTUME:11,ZOOM:12,H_PAN:13,V_PAN:14,OBSOLETE_SAVED_STATE:15,SPRITE_ORDER_IN_LIBRARY:16,VOLUME:17,TEMPO_BPM:18,SCENE_STATES:19,LISTS:20})){get spriteOrderInLibrary(){return this.fields[this.FIELDS.SPRITE_ORDER_IN_LIBRARY]||null}get tempoBPM(){return this.fields[this.FIELDS.TEMPO_BPM]||0}get lists(){return this.fields[this.FIELDS.LISTS]||[]}}class hA extends(q.define({BOX:0,PARENT:1,COLOR:3,VISIBLE:4,OBJ_NAME:6,VARS:7,BLOCKS_BIN:8,IS_CLONE:9,MEDIA:10,CURRENT_COSTUME:11,VISIBILITY:12,SCALE_POINT:13,ROTATION_DEGREES:14,ROTATION_STYLE:15,VOLUME:16,TEMPO_BPM:17,DRAGGABLE:18,SCENE_STATES:19,LISTS:20})){get scratchX(){return this.box.x+this.currentCostume.rotationCenter.x-240}get scratchY(){return 180-(this.box.y+this.currentCostume.rotationCenter.y)}get visible(){return 0==(1&this.fields[this.FIELDS.VISIBLE])}get tempoBPM(){return this.fields[this.FIELDS.TEMPO_BPM]||0}get lists(){return this.fields[this.FIELDS.LISTS]||[]}}q.define({RECTANGLE:0,FONT:8,COLOR:9,LINES:11});class MA extends(q.define({COSTUME_NAME:0,BITMAP:1,ROTATION_CENTER:2,TEXT_DETAILS:3,BASE_LAYER_DATA:4,OLD_COMPOSITE:5})){get image(){return this.oldComposite instanceof IA?this.oldComposite:this.baseLayerData.value?null:this.bitmap}get width(){return null===this.image?-1:this.image.width}get height(){return null===this.image?-1:this.image.height}get rawBytes(){return null===this.image?this.baseLayerData.value.slice():this.image.bytes.value}get decoded(){return null===this.image?this.baseLayerData.value.slice():this.image.decoded}get crc(){if(!this._crc){const A=(new $).update(new Uint8Array(new Uint32Array([this.bitmap.width]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.height]).buffer)).update(new Uint8Array(new Uint32Array([this.bitmap.depth]).buffer)).update(this.rawBytes);this._crc=A.digest}return this._crc}get extension(){return this.oldComposite instanceof IA?"uncompressed":this.baseLayerData.value?"jpg":"uncompressed"}toString(){return'ImageMediaData "'.concat(this.costumeName,'"')}}class FA extends(q.define({DATA:3,RATE:4})){}class DA extends(q.define({NAME:0,UNCOMPRESSED:1,RATE:4,BITS_PER_SAMPLE:5,DATA:6})){get rate(){return 0!==this.uncompressed.data.value.length?this.uncompressed.rate:this.fields[this.FIELDS.RATE]}get rawBytes(){return this.data&&this.data.value?this.data.value:this.uncompressed.data.value}get decoded(){return this._decoded||(this.data&&this.data.value?this._decoded=new QA(this.bitsPerSample.value).decode(this.data.value):this._decoded=new Int16Array((A=>{const B=new Uint8Array(A);for(let t=0;tpA[B]||null);class yA{constructor(A){this.valueIterator=A}[Symbol.iterator](){return this}next(){const A=this.valueIterator.next();if(A.done)return A;const B=A.value,{classId:t}=B;let e=B;if(B instanceof v){e=[];for(let A=0;A>>16;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length;return this.stream.writeBytes(A,B,t)}}class VA extends WA{constructor(A){super(A),this.stream.writeStruct(LA,{cmf:8,flag:29}),this.adler=new zA,this.chunk=this.stream.writeStruct(PA,{lastPacket:0,length:0,lengthCheck:65535})}get _deflateIndex(){return this.chunk.length}set _deflateIndex(A){return this.chunk.length=A,this.chunk.lengthCheck=65535^A,this.chunk.length}writeStruct(A,B){this.writeBytes(Object.assign(new A,B).uint8a)}writeBytes(A){let B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:A.length,e=B;for(;t-e>0;){65535===this._deflateIndex&&(this.chunk=this.stream.writeStruct(PA,{lastPacket:0,length:0,lengthCheck:65535}));const B=Math.min(t-e,65535-this._deflateIndex);this.stream.writeBytes(A,e,e+B),this._deflateIndex+=B,e+=B}this.adler.update(A,B,t-B)}finish(){this.chunk.lastPacket=1,this.stream.writeStruct(vA,{checksum:this.adler.digest})}static estimateSize(A){const B=Math.ceil(A/65535);return LA.size+B*PA.size+vA.size+A}}class KA extends WA{constructor(A){let B=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"IHDR";super(A),this.start=this.stream.writeStruct(jA,{length:0,chunkType:B}),this.crc=new $}finish(){const A=this.start.offset+this.start.size,B=this.position-A;this.start.length=B,this.crc.update(this.stream.uint8a,A-F.size,B+F.size),this.stream.writeStruct(xA,{checksum:this.crc.digest})}static size(A){return jA.size+A+xA.size}}class OA{encode(A,B,t){const e=4*A+bA.size,g=e*B,i=TA.size+KA.size(SA.size)+KA.size(VA.estimateSize(g))+KA.size(0),s=new Q(new ArrayBuffer(i));s.writeStruct(TA,{support8Bit:137,png:"PNG",dosLineEnding:"\r\n",dosEndOfFile:"",unixLineEnding:"\n"});const n=new KA(s,"IHDR");n.writeStruct(SA,{width:A,height:B,bitDepth:8,colorType:6,compressionMethod:0,filterMethod:0,interlaceMethod:0}),n.finish();const r=new KA(s,"IDAT"),c=new VA(r);let E=0;for(;E"uncompressed"===A.extension?new Uint8Array(OA.encode(A.width,A.height,A.decoded)):A.decoded,qA=A=>{const B=String(A[A.length-1]),t=A.length-1;return"mouse"===B?A[t]="_mouse_":"edge"===B?A[t]="_edge_":A[A.length-1]instanceof YA&&(A[t]="_stage_"),A},$A={getParam:A=>{let[B,t,e,g]=A;return[B,t,e,g||"r"]},changeVariable:A=>[A[2],A[1],A[3]],EventHatMorph:A=>"Scratch-StartClicked"===String(A[1])?["whenGreenFlag"]:["whenIReceive",A[1]],MouseClickEventHatMorph:()=>["whenClicked"],KeyEventHatMorph:A=>["whenKeyPressed",A[1]],stopScripts:A=>"other scripts"===String(A[1])?[A[0],"other scripts in sprite"]:A,abs:A=>["computeFunction:of:","abs",A[1]],sqrt:A=>["computeFunction:of:","sqrt",A[1]],"\\\\":A=>["%",...A.slice(1)],doReturn:()=>["stopScripts","this script"],stopAll:()=>["stopScripts","all"],"showBackground:":A=>["startScene",A[1]],nextBackground:()=>["nextScene"],doForeverIf:A=>["doForever",[["doIf",A[1],A[2]]]],"getAttribute:of:":qA,"gotoSpriteOrMouse:":qA,"distanceTo:":qA,"pointTowards:":qA,"touching:":qA},AB=A=>{const{info:B,stageData:t,images:e,sounds:g}=A,i=A=>{const B=[];for(let t=0;t{let[B,t]=A;return{name:B,value:t,isPersistent:!1}},s=A=>{let[,{listName:B,contents:t,x:e,y:g,width:i,height:Q,hiddenWhenNull:s}]=A;return{listName:B,contents:t,isPersistent:!1,x:e,y:g,width:i,height:Q,visible:null!==(n=s,"object"==typeof n&&n?n.valueOf():n)};var n},n=A=>{const B=g.findIndex(B=>B.crc===A.crc);return{soundName:A.name,soundID:B,md5:"".concat(A.md5,".wav"),sampleCount:A.sampleCount,rate:A.rate,format:""}},r=A=>{const B=e.findIndex(B=>B.crc===A.crc);return{costumeName:A.costumeName,baseLayerID:B,baseLayerMD5:"".concat(wA()(A.rawBytes),".").concat((t=A,"uncompressed"===t.extension?"png":"jpg")),bitmapResolution:1,rotationCenterX:A.rotationCenter.x,rotationCenterY:A.rotationCenter.y};var t},c=A=>{let B=A.map(o);const t=$A[B[0]];return t&&(B=t(B)),B},E=A=>A.map(c),o=A=>A instanceof hA?A.objName:Array.isArray(A)?0===A.length||Array.isArray(A[0])?E(A):c(A):A,w=A=>[A[0].x,A[0].y,E(A[1])],C=A=>A instanceof hA?(A=>{const B=A.media.filter(A=>A instanceof MA),e=A.media.filter(A=>A instanceof DA);return{objName:A.objName,variables:i(A.vars).map(Q),lists:i(A.lists).map(s),scripts:A.blocksBin.map(w),costumes:B.map(r),currentCostumeIndex:B.findIndex(B=>B.crc===A.currentCostume.crc),sounds:e.map(n),scratchX:A.scratchX,scratchY:A.scratchY,scale:A.scalePoint.x,direction:Math.round(1e6*A.rotationDegrees)/1e6-270,rotationStyle:A.rotationStyle,isDraggable:A.draggable,indexInLibrary:t.spriteOrderInLibrary.indexOf(A),visible:A.visible,spriteInfo:{}}})(A):null;return JSON.parse(JSON.stringify(Object.assign((A=>{const B=A.media.filter(A=>A instanceof MA),t=A.media.filter(A=>A instanceof DA);return{objName:A.objName,variables:i(A.vars).map(Q),lists:i(A.lists).map(s),scripts:A.blocksBin.map(w),costumes:B.map(r),currentCostumeIndex:B.findIndex(B=>B.crc===A.currentCostume.crc),sounds:t.map(n),penLayerMD5:"5c81a336fab8be57adc039a8a2b33ca9.png",penLayerID:0,tempoBPM:A.tempoBPM,videoAlpha:.5,children:A.stageContents.map(C).filter(Boolean).reverse()}})(t),{info:(A=>{const B={};for(let t=0;t{let{images:B,sounds:t}=A;const e={};let g=0;for(const A of B)e["".concat(g++,".").concat((i=A,"uncompressed"===i.extension?"png":"jpg"))]={bytes:_A(A)};var i,Q;g=0;for(const A of t)e["".concat(g++,".wav")]={bytes:(Q=A,Q.wavEncodedData)};return new ZA(e)})({images:this.images(),sounds:this.sounds()})}view(){return{signature:this.signature,infoHeader:this.infoHeader,dataHeader:this.dataHeader,toString:()=>"SB1File"}}infoRaw(){return new s(new _(this.buffer,this.infoHeader.offset+tB.size),this.signature.infoByteLength+BB.size)}infoTable(){return new yA(this.infoRaw())}info(){return this._info||(this._info=new kA(this.infoTable()).table[0]),this._info}dataRaw(){return new s(new _(this.buffer,this.dataHeader.offset+tB.size),this.stream.uint8a.length)}dataTable(){return new yA(this.dataRaw())}dataFixed(){return this._data||(this._data=new kA(this.dataTable()).table),this._data}data(){return this.dataFixed()[0]}images(){const A=new Set;return this.dataFixed().filter(B=>B instanceof MA&&(!A.has(B.crc)&&(A.add(B.crc),!0)))}sounds(){const A=new Set;return this.dataFixed().filter(B=>B instanceof DA&&(!A.has(B.crc)&&(A.add(B.crc),!0)))}}},function(A,B,t){"use strict";t.r(B);var e={};t.r(e),t.d(e,"Scaffolding",(function(){return b})),t.d(e,"Cloud",(function(){return D})),t.d(e,"VM",(function(){return i.a})),t.d(e,"Renderer",(function(){return s.a})),t.d(e,"Storage",(function(){return E})),t.d(e,"AudioEngine",(function(){return w.a})),t.d(e,"JSZip",(function(){return I.a}));var g=t(48),i=t.n(g),Q=t(50),s=t.n(Q),n=t(26),r=t.n(n);class c extends r.a{constructor(){super(),this._totalAssets=0,this._loadedAssets=0}_updateProgress(){this.onprogress&&this.onprogress(this._totalAssets,this._loadedAssets)}load(A,B,t){return A===r.a.AssetType.ImageBitmap||A===r.a.AssetType.ImageVector||A===r.a.AssetType.Sound?(this._totalAssets++,this._updateProgress(),super.load(A,B,t).then(A=>(this._loadedAssets++,this._updateProgress(),A))):super.load(A,B,t)}}var E=c,o=t(51),w=t.n(o),C=t(49),a=t(21),I=t.n(a);const Y=[],h=A=>{let B;var t;return 0===Y.length?(t={audio:!1,video:A},B=navigator.mediaDevices?navigator.mediaDevices.getUserMedia(t):Promise.reject(new Error("video is not supported in this context (insecure domain?)")),Y.push(B)):Y.length>0&&(B=Y[0],Y.push(!0)),B};class M{constructor(){this.mirror=!0,this._frameCacheTimeout=16,this._video=null,this._track=null,this._workspace=[]}static get FORMAT_IMAGE_DATA(){return"image-data"}static get FORMAT_CANVAS(){return"canvas"}static get DIMENSIONS(){return[480,360]}static get ORDER(){return 1}get video(){return this._video}enableVideo(){return this.enabled=!0,this._setupVideo()}disableVideo(){this.enabled=!1,this._singleSetup&&this._singleSetup.then(this._teardown.bind(this)).catch(A=>this.onError(A))}_teardown(){if(!1===this.enabled){const A=(Y.pop(),!(Y.length>0));this._singleSetup=null,this._video=null,this._track&&A&&this._track.stop(),this._track=null}}getFrame(A){let{dimensions:B=M.DIMENSIONS,mirror:t=this.mirror,format:e=M.FORMAT_IMAGE_DATA,cacheTimeout:g=this._frameCacheTimeout}=A;if(!this.videoReady)return null;const[i,Q]=B,s=this._getWorkspace({dimensions:B,mirror:Boolean(t)}),{videoWidth:n,videoHeight:r}=this._video,{canvas:c,context:E,lastUpdate:o,cacheData:w}=s,C=Date.now();o+g{this._video=document.createElement("video");try{this._video.srcObject=A}catch(B){this._video.src=window.URL.createObjectURL(A)}return this._video.play(),this._track=A.getTracks()[0],this}).catch(A=>{this._singleSetup=null,this.onError(A)})),this._singleSetup}get videoReady(){if(!this.enabled)return!1;if(!this._video)return!1;if(!this._track)return!1;const{videoWidth:A,videoHeight:B}=this._video;return"number"==typeof A&&"number"==typeof B&&(0!==A&&0!==B)}_getWorkspace(A){let{dimensions:B,mirror:t}=A,e=this._workspace.find(A=>A.dimensions.join("-")===B.join("-")&&A.mirror===t);return e||(e={dimensions:B,mirror:t,canvas:document.createElement("canvas"),lastUpdate:0,cacheData:{}},e.canvas.width=B[0],e.canvas.height=B[1],e.context=e.canvas.getContext("2d"),this._workspace.push(e)),e}}var F=M;var D={CloudManager:class{constructor(A){this.parent=A,this.providers=[],this.overrides=new Map}hasCloudData(){return this.parent.vm.runtime.hasCloudData()}projectReady(){if(this.hasCloudData())for(const A of this.providers)A.enable()}setVariable(A,B,t){this.overrides.has(B)&&this.overrides.get(B)!==A||this.parent.vm.postIOData("cloud",{varUpdate:{name:B,value:t}})}getUsername(){return this.parent._username}addProvider(A){A.manager=this,this.hasCloudData()&&A.enable(),this.providers.push(A)}requestCloseConnection(){}createVariable(A,B){}renameVariable(A,B){}deleteVariable(A){}addProviderOverride(A,B){if(B&&!this.providers.includes(B))throw new Error("Manager is not aware of this provider");this.overrides.set(A,B)}updateVariable(A,B){if(this.overrides.has(A)){const t=this.overrides.get(A);t&&t.handleUpdateVariable(A,B)}else for(const t of this.providers)t.handleUpdateVariable(A,B)}},WebSocketProvider:class{constructor(A,B){this.cloudHosts=Array.isArray(A)?A:[A],this.projectId=B,this.attemptedConnections=0,this.bufferedMessages=[],this.scheduledBufferedSend=null,this.reconnectTimeout=null,this.openConnection=this.openConnection.bind(this),this._scheduledSendBufferedMessages=this._scheduledSendBufferedMessages.bind(this)}enable(){this.openConnection()}setProjectId(A){this.projectId=A,this.closeAndReconnect()}openConnection(){this.currentCloudHost=this.cloudHosts[this.attemptedConnections%this.cloudHosts.length],this.attemptedConnections++,console.log("Connecting to ".concat(this.currentCloudHost," with ID ").concat(this.projectId,", username ").concat(this.manager.getUsername()));try{this.ws=new WebSocket(this.currentCloudHost)}catch(A){throw console.error(A),new Error("Cloud host ".concat(this.currentCloudHost," is invalid: ").concat(A))}this.ws.onerror=this.onerror.bind(this),this.ws.onmessage=this.onmessage.bind(this),this.ws.onopen=this.onopen.bind(this),this.ws.onclose=this.onclose.bind(this)}onerror(A){console.error("WebSocket error",A)}onmessage(A){for(const B of A.data.split("\n"))if(B){const A=JSON.parse(B);"set"===A.method&&this.manager.setVariable(this,A.name,A.value)}}onopen(){this.attemptedConnections=0,this.writeToServer({method:"handshake"}),this.sendBufferedMessages(),console.log("WebSocket connected")}onclose(A){if(A&&4002===A.code)return void console.log("Username is invalid; not reconnecting.");if(A&&4004===A.code)return void console.log("Project is blocked; not reconnecting.");const B=Math.random()*(Math.pow(2,Math.min(this.attemptedConnections+1,5))-1)*1e3;console.log("Connection lost; reconnecting in ".concat(Math.round(B),"ms")),this.reconnectTimeout=setTimeout(this.openConnection,B)}closeAndReconnect(){console.log("Closing connection and reconnecting."),this.ws&&(this.ws.onclose=null,this.ws.onerror=null,this.ws.close()),clearTimeout(this.reconnectTimeout);this.reconnectTimeout=setTimeout(this.openConnection,1e3/30)}canWriteToServer(){return this.ws&&this.ws.readyState===WebSocket.OPEN}scheduleBufferedSend(){this.scheduledBufferedSend||(this.scheduledBufferedSend=!0,Promise.resolve().then(this._scheduledSendBufferedMessages))}_scheduledSendBufferedMessages(){this.scheduledBufferedSend=!1,this.canWriteToServer()&&this.sendBufferedMessages()}sendBufferedMessages(){for(const A of this.bufferedMessages)this.writeToServer(A);this.bufferedMessages.length=0}bufferedWriteToServer(A){this.bufferedMessages.push(A),this.scheduleBufferedSend()}writeToServer(A){A.project_id=this.projectId,A.user=this.manager.getUsername(),this.ws.send(JSON.stringify(A))}handleUpdateVariable(A,B){for(const t of this.bufferedMessages)if(t.name===A)return void(t.value=B);this.bufferedWriteToServer({method:"set",name:A,value:B})}},LocalStorageProvider:class{constructor(){let A=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"p4:cloudvariables";this.key=A,this.variables={},this.handleStorageEvent=this.handleStorageEvent.bind(this)}readFromLocalStorage(){let A;try{if(A=JSON.parse(localStorage.getItem(this.key)),!A||"object"!=typeof A)return}catch(A){return}this.variables=A;for(const A of Object.keys(this.variables))this.manager.setVariable(this,A,this.variables[A])}storeToLocalStorage(){try{localStorage.setItem(this.key,JSON.stringify(this.variables))}catch(A){}}handleStorageEvent(A){A.key===this.key&&A.storageArea===localStorage&&this.readFromLocalStorage()}enable(){this.readFromLocalStorage(),window.addEventListener("storage",this.handleStorageEvent)}handleUpdateVariable(A,B){this.variables[A]=B,this.storeToLocalStorage()}}},u=t(101),l=t.n(u),d=t(52),U={insert:A=>{var B=document.head||document.body||document.documentElement;B.insertBefore(A,B.firstChild)},singleton:!1},N=(l()(d.a,U),d.a.locals||{});const m=A=>new Promise((B,t)=>{const e=new FileReader;e.onload=()=>B(e.result),e.onerror=()=>t(new Error("Cannot read as text: ".concat(e.error))),e.readAsText(A)});var G=class{constructor(A,B){this.el=A,this.callback=B,this.el.addEventListener("dragover",this.ondragover.bind(this)),this.el.addEventListener("dragleave",this.ondragleave.bind(this)),this.el.addEventListener("drop",this.ondrop.bind(this))}ondragover(A){A.dataTransfer.types.includes("Files")&&(A.preventDefault(),A.dataTransfer.dropEffect="copy",this.el.classList.add(N.dropping))}ondragleave(A){A.preventDefault(),this.el.classList.remove(N.dropping)}ondrop(A){A.preventDefault(),this.el.classList.remove(N.dropping),A.dataTransfer.types.includes("Files")&&A.dataTransfer.files.length>0&&Promise.all(Array.from(A.dataTransfer.files).map(m)).then(A=>{this.callback(A)})}};var f=class{constructor(A,B){this.parent=A,this.text=B,this.root=document.createElement("div"),this.root.className=N.questionRoot,this.inner=document.createElement("div"),this.inner.className=N.questionInner,B&&(this.textElement=document.createElement("div"),this.textElement.textContent=B,this.textElement.className=N.questionText),this.inputContainer=document.createElement("div"),this.inputContainer.className=N.questionInputOuter,this.input=document.createElement("input"),this.input.className=N.questionInput,this.input.addEventListener("keypress",this.onkeypress.bind(this)),this.dropper=new G(this.input,this.dropperCallback.bind(this)),this.submitButton=document.createElement("button"),this.submitButton.className=N.questionSubmitButton,this.submitButton.addEventListener("click",this.onsubmitpressclick.bind(this)),this.inputContainer.appendChild(this.input),this.inputContainer.appendChild(this.submitButton),this.textElement&&this.inner.appendChild(this.textElement),this.inner.appendChild(this.inputContainer),this.root.appendChild(this.inner),this.parent._addLayer(this.root),this.input.focus(),this.answerCallback=new Promise(A=>{this.callback=A})}answer(){return this.answerCallback}submit(){this.callback(this.input.value),this.destroy()}onkeypress(A){"Enter"===A.key&&this.submit()}dropperCallback(A){const B=A.join("").replace(/\r?\n/g," ");this.input.value=B}onsubmitpressclick(){this.submit()}destroy(){this.root.remove(),this.parent.question=null}};var H=class{constructor(A){this.parent=A,this.root=document.createElement("div"),this.root.className=N.contextMenu,this._onmousedown=this._onmousedown.bind(this),this._onresize=this._onresize.bind(this),this._onblur=this._onblur.bind(this)}_onmousedown(A){this.root.contains(A.target)||this.destroy()}_onresize(){this.destroy()}_onblur(){this.destroy()}add(A){const B=document.createElement("button");B.className=N.contextMenuItem,B.textContent=A.text,B.addEventListener("click",()=>{this.destroy(),A.callback()}),B.addEventListener("contextmenu",A=>{A.preventDefault()}),this.root.appendChild(B)}show(A){document.addEventListener("mousedown",this._onmousedown),window.addEventListener("resize",this._onresize),window.addEventListener("blur",this._onblur),this.parent._addLayer(this.root);const B=this.parent.layersRect,t=this.root.getBoundingClientRect();let e=A.clientX-B.left,g=A.clientY-B.top;e+t.width>B.width&&(e-=t.width),g+t.height>B.height&&(g-=t.height),this.root.style.transform="translate(".concat(e,"px, ").concat(g,"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 R=(A,B)=>{if("undefined"!=typeof ExternalDownloadHelper)return void ExternalDownloadHelper.download(A,B);const t=document.createElement("a");if(document.body.appendChild(t),navigator.msSaveOrOpenBlob)navigator.msSaveOrOpenBlob(B,A);else if("download"in HTMLAnchorElement.prototype){const e=window.URL.createObjectURL(B);t.href=e,t.download=A,t.type=B.type,t.click(),window.setTimeout(()=>{document.body.removeChild(t),window.URL.revokeObjectURL(e)},1e3)}else{let A=window.open("","_blank");const t=new FileReader;t.onloadend=function(){A.location.href=t.result,A=null},t.readAsDataURL(B)}};class p{constructor(A,B){this.parent=A,this.id=B.get("id"),this.spriteName=B.get("spriteName"),this.targetId=B.get("targetId"),this.opcode=B.get("opcode"),this.params=B.get("params"),this.root=document.createElement("div"),this.root.className=N.monitorRoot,this.root.setAttribute("opcode",this.opcode),this.parent._monitorOverlay.appendChild(this.root)}getLabel(){let A;if("data_variable"===this.opcode)A=this.params.VARIABLE;else if("data_listcontents"===this.opcode)A=this.params.LIST;else if("motion_xposition"===this.opcode)A=this.parent.getMessage("var-x");else if("motion_yposition"===this.opcode)A=this.parent.getMessage("var-y");else if("motion_direction"===this.opcode)A=this.parent.getMessage("var-direction");else if("sensing_username"===this.opcode)A=this.parent.getMessage("var-username");else if("looks_costumenumbername"===this.opcode)A="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-costume-number"):this.parent.getMessage("var-costume-name");else if("looks_backdropnumbername"===this.opcode)A="number"===this.params.NUMBER_NAME?this.parent.getMessage("var-backdrop-number"):this.parent.getMessage("var-backdrop-name");else if("looks_size"===this.opcode)A=this.parent.getMessage("var-size");else if("sensing_answer"===this.opcode)A=this.parent.getMessage("var-answer");else if("sensing_loudness"===this.opcode)A=this.parent.getMessage("var-loudness");else if("sensing_timer"===this.opcode)A=this.parent.getMessage("var-timer");else if("sound_volume"===this.opcode)A=this.parent.getMessage("var-volume");else if("sensing_current"===this.opcode){const B=this.params.CURRENTMENU.toLowerCase();"year"===B?A=this.parent.getMessage("var-year"):"month"===B?A=this.parent.getMessage("var-month"):"date"===B?A=this.parent.getMessage("var-date"):"dayofweek"===B?A=this.parent.getMessage("var-day-of-week"):"hour"===B?A=this.parent.getMessage("var-hour"):"minute"===B?A=this.parent.getMessage("var-minute"):"second"===B&&(A=this.parent.getMessage("var-second"))}else A=this.parent.vm.runtime.getLabelForOpcode(this.opcode).label;return this.spriteName?"".concat(this.spriteName,": ").concat(A):A}getTarget(){return this.targetId?this.parent.vm.runtime.getTargetById(this.targetId):this.parent.vm.runtime.getTargetForStage()}getVmVariable(){return this.getTarget().variables[this.id]}update(A){this.x=A.get("x"),this.y=A.get("y"),this.visible=A.get("visible"),this.root.style.transform="translate(".concat(Math.round(this.x),"px, ").concat(Math.round(this.y),"px)"),this.root.style.display=this.visible?"":"none"}}class J extends p{constructor(A,B){super(A,B),this.mode=B.get("mode"),"large"===this.mode?(this.valueElement=document.createElement("div"),this.valueElement.className=N.monitorLargeValue+" "+N.monitorValueColor,this.root.appendChild(this.valueElement)):(this.inner=document.createElement("div"),this.inner.className=N.monitorInner,this.valueRow=document.createElement("div"),this.valueRow.className=N.monitorRow,this.label=document.createElement("div"),this.label.className=N.monitorLabel,this.label.textContent=this.getLabel(),this.valueElement=document.createElement("div"),this.valueElement.className=N.monitorValue+" "+N.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=N.monitorRow,this.slider=document.createElement("input"),this.slider.className=N.monitorSlider,this.slider.type="range",this.slider.min=B.get("sliderMin"),this.slider.max=B.get("sliderMax"),this.slider.step=B.get("isDiscrete")?1:.01,this.slider.addEventListener("input",this.onsliderchange.bind(this)),this.sliderRow.appendChild(this.slider),this.inner.appendChild(this.sliderRow)),this.root.appendChild(this.inner)),this.parent._monitorOverlay.appendChild(this.root),this._value=""}setVariableValue(A){this.getVmVariable().value=A,this._value=A,this.valueElement.textContent=A}onsliderchange(A){this.setVariableValue(+A.target.value)}update(A){if(super.update(A),!this.visible)return;let B=A.get("value");"number"==typeof B&&(B=Number(B.toFixed(6))),this._value!==B&&(this._value=B,this.valueElement.textContent=B,this.slider&&(this.slider.value=B))}}class y{constructor(A){this.monitor=A,this.index=-1,this.value="",this.locked=!1,this.root=document.createElement("label"),this.root.className=N.monitorRowRoot,this.indexEl=document.createElement("div"),this.indexEl.className=N.monitorRowIndex,this.valueOuter=document.createElement("div"),this.valueOuter.className=N.monitorRowValueOuter,this.editable=this.monitor.editable,this.editable?(this.valueInner=document.createElement("input"),this.valueInner.tabIndex=-1,this.valueInner.className=N.monitorRowValueInner,this.valueInner.readOnly=!0,this.valueInner.addEventListener("click",this._onclickinput.bind(this)),this.valueInner.addEventListener("blur",this._onblurinput.bind(this)),this.valueInner.addEventListener("keypress",this._onkeypressinput.bind(this)),this.valueInner.addEventListener("keydown",this._onkeypressdown.bind(this)),this.valueInner.addEventListener("contextmenu",this._oncontextmenu.bind(this)),this.valueInner.addEventListener("input",this._oninput.bind(this)),this.valueOuter.appendChild(this.valueInner),this.deleteButton=document.createElement("button"),this.deleteButton.className=N.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=N.monitorRowValueInner,this.valueOuter.appendChild(this.valueInner),this.valueInner.addEventListener("contextmenu",this._oncontextmenuuneditable.bind(this))),this.root.appendChild(this.indexEl),this.root.appendChild(this.valueOuter)}_onclickinput(){this.valueInner.focus(),this.locked||(this.valueInner.select(),this.valueInner.readOnly=!1,this.locked=!0,this.root.classList.add(N.monitorRowValueEditing),this.addNewValue=!1,this.deleteValue=!1,this.valueWasChanged=!1)}_onblurinput(){if(this.locked)if(this.unfocus(),this.deleteValue){const A=[...this.monitor.value];A.splice(this.index,1),this.monitor.setValue(A),this.monitor.tryToFocusRow(Math.min(A.length-1,this.index))}else if(this.valueWasChanged||this.addNewValue){const A=[...this.monitor.value];A[this.index]=this.valueInner.value,this.addNewValue&&A.splice(this.index+1,0,""),this.monitor.setValue(A),this.addNewValue&&this.monitor.tryToFocusRow(this.index+1)}}_oninput(){this.valueWasChanged=!0}_onkeypressinput(A){"Enter"===A.key&&(this.addNewValue=!0,this.valueInner.blur())}_onkeypressdown(A){if("Escape"===A.key)this.valueInner.blur();else if("ArrowUp"===A.key||"ArrowDown"===A.key||"Tab"===A.key){A.preventDefault();let B=this.index;"ArrowUp"===A.key||"Tab"===A.key&&A.shiftKey?(B--,B<0&&(B=this.monitor.value.length-1)):(B++,B>=this.monitor.value.length&&(B=0)),this.monitor.tryToFocusRow(B)}}_onclickdelete(A){A.preventDefault(),this.deleteValue=!0,this.valueInner.blur()}_oncontextmenu(A){this.locked?A.stopPropagation():A.preventDefault()}_oncontextmenuuneditable(A){const B=getSelection();this.valueInner.contains(B.anchorNode)&&!B.isCollapsed&&A.stopPropagation()}setIndex(A){this.index!==A&&(this.index=A,this.root.dataset.index=A,this.root.style.transform="translateY(".concat(24*A,"px)"),this.indexEl.textContent=A+1)}setValue(A){this.value===A||this.locked||(this.value=A,this.editable?this.valueInner.value=A:this.valueInner.textContent=A)}focus(){this.valueInner.click(),document.activeElement!==this.valueInner&&setTimeout(()=>this.valueInner.click())}unfocus(){this.locked&&(this.locked=!1,this.valueInner.readOnly=!0,this.root.classList.remove(N.monitorRowValueEditing))}}class k extends p{constructor(A,B){super(A,B),this.editable=A.editableLists,this.rows=new Map,this.cachedRows=[],this.scrollTop=0,this.oldLength=-1,this.label=document.createElement("div"),this.label.className=N.monitorListLabel,this.label.textContent=this.getLabel(),this.footer=document.createElement("div"),this.footer.className=N.monitorListFooter,this.footerText=document.createElement("div"),this.footerText.className=N.monitorListFooterText,this.rowsOuter=document.createElement("div"),this.rowsOuter.className=N.monitorRowsOuter,this.rowsInner=document.createElement("div"),this.rowsInner.className=N.monitorRowsInner,this.rowsInner.addEventListener("scroll",this._onscroll.bind(this),{passive:!0}),this.endPoint=document.createElement("div"),this.endPoint.className=N.monitorRowsEndpoint,this.emptyLabel=document.createElement("div"),this.emptyLabel.textContent=A.getMessage("list-empty"),this.emptyLabel.className=N.monitorEmpty,this.editable&&(this.addButton=document.createElement("button"),this.addButton.className=N.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 G(this.rowsOuter,this.dropperCallback.bind(this)),this.handleImport=this.handleImport.bind(this),this.handleExport=this.handleExport.bind(this),this.root.addEventListener("contextmenu",this._oncontextmenu.bind(this))}_onclickaddbutton(A){this.setValue([...this.value,""]),this.tryToFocusRow(this.value.length-1)}unfocusAllRows(){for(const A of this.rows.values())A.unfocus()}tryToFocusRow(A){if(A>=0&&A{const B=A.target.files;if(0===B.length)return;const t=B[0];m(t).then(A=>this.import(A))}),A.click()}import(A){const B=A.split(/\r?\n/);this.setValue(B)}handleExport(){const A=this.getValue().join("\n"),B=new Blob([A],{type:"text/plain"});R("".concat(this.getLabel(),".txt"),B)}dropperCallback(A){this.import(A.join("\n"))}getValue(){return this.getVmVariable().value}setValue(A){this.getVmVariable().value=A,this.updateValue(A)}update(A){super.update(A),this.visible&&(this.width=A.get("width")||100,this.height=A.get("height")||200,this.root.style.width="".concat(this.width,"px"),this.root.style.height="".concat(this.height,"px"),this.updateValue(A.get("value")))}createRow(A){const B=this.cachedRows.pop()||new y(this);B.setIndex(A),B.setValue(this.value[A]),this.rows.set(A,B);let t=!1;for(const e of this.rowsInner.children){const g=e.dataset.index;if(!g)continue;if(+g>A){this.rowsInner.insertBefore(B.root,e),t=!0;break}}return t||this.rowsInner.appendChild(B.root),B}updateValue(A){this.value=A,A.length!==this.oldLength&&(this.oldLength=A.length,this.footerText.textContent=this.parent.getMessage("list-length").replace("{n}",A.length),this.endPoint.style.transform="translateY(".concat(24*A.length,"px)"),this.emptyLabel.style.display=A.length?"none":"");let B=Math.floor(this.scrollTop/24)-5;B<0&&(B=0);let t=Math.ceil((this.scrollTop+this.height)/24)+3;t>A.length-1&&(t=A.length-1);for(const e of this.rows.keys())if(et){const B=this.rows.get(e);(!B.locked||e>=A.length)&&(B.unfocus(),B.root.remove(),this.rows.delete(e),this.cachedRows.length<10&&this.cachedRows.push(B))}for(let e=B;e<=t;e++){const B=this.rows.get(e);B?B.setValue(A[e]):this.createRow(e)}}}var T=class{constructor(){this.hasItem=!1,this.root=document.createElement("div"),this.root.className=N.controlsBar,this.start=document.createElement("div"),this.end=document.createElement("div"),this.root.appendChild(this.start),this.root.appendChild(this.end)}addToStart(A){this.hasItem=!0,this.start.appendChild(A)}addToEnd(A){this.hasItem=!0,this.end.appendChild(A)}computeHeight(){return this.hasItem?this.root.getBoundingClientRect().height:0}};const j=A=>"number"==typeof A||"string"==typeof A||"boolean"==typeof A;var x=t(105);const S=A=>A.touches&&A.touches[0]?{x:A.touches[0].clientX,y:A.touches[0].clientY}:A.changedTouches&&A.changedTouches[0]?{x:A.changedTouches[0].clientX,y:A.changedTouches[0].clientY}:{x:A.clientX,y:A.clientY};class b extends class{constructor(){this._events={}}addEventListener(A,B){this._events[A]||(this._events[A]=[]),this._events[A].push(B)}removeEventListener(A,B){const t=this._events[A];t&&(this._events[A]=t.filter(A=>A!==B))}dispatchEvent(A){const B=this._events[A.type];if(B)for(const t of B)t(A)}}{constructor(){super(),this.width=480,this.height=360,this.resizeMode="preserve-ratio",this.editableLists=!1,this.shouldConnectPeripherals=!0,this.usePackagedRuntime=!1,this.messages=x,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=N.root,this._layers=document.createElement("div"),this._layers.className=N.layers,this._root.appendChild(this._layers),this._canvas=document.createElement("canvas"),this._canvas.className=N.canvas,this._addLayer(this._canvas),this._overlays=document.createElement("div"),this._overlays.className=N.scaledOverlaysInner,this._overlaysOuter=document.createElement("div"),this._overlaysOuter.className=N.scaledOverlaysOuter,this._overlaysOuter.appendChild(this._overlays),this._addLayer(this._overlaysOuter),this._monitorOverlay=document.createElement("div"),this._monitorOverlay.className=N.monitorOverlay,this._overlays.appendChild(this._monitorOverlay),this._topControls=new T,this._layers.appendChild(this._topControls.root),document.addEventListener("mousemove",this._onmousemove.bind(this)),this._canvas.addEventListener("mousedown",this._onmousedown.bind(this)),document.addEventListener("mouseup",this._onmouseup.bind(this)),this._canvas.addEventListener("touchstart",this._ontouchstart.bind(this)),document.addEventListener("touchmove",this._ontouchmove.bind(this)),document.addEventListener("touchend",this._ontouchend.bind(this)),this._canvas.addEventListener("contextmenu",this._oncontextmenu.bind(this)),this._canvas.addEventListener("wheel",this._onwheel.bind(this)),document.addEventListener("keydown",this._onkeydown.bind(this)),document.addEventListener("keyup",this._onkeyup.bind(this)),window.addEventListener("resize",this._onresize.bind(this))}_addLayer(A){this._layers.appendChild(A)}_scratchCoordinates(A,B){return{x:this.width/this.layersRect.width*(A-this.layersRect.width/2),y:-this.height/this.layersRect.height*(B-this.layersRect.height/2)}}_onmousemove(A){const{x:B,y:t}=S(A),e={x:B-this.layersRect.left,y:t-this.layersRect.top,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height};if(this._mousedownPosition&&!this._draggingId){Math.sqrt(Math.pow(e.x-this._mousedownPosition.x,2)+Math.pow(e.y-this._mousedownPosition.y,2))>3&&(this._startDragging(e.x,e.y),this._cancelDragTimeout())}else if(this._draggingId){const A=this._scratchCoordinates(e.x,e.y);this.vm.postSpriteInfo({x:A.x-this._draggingStartMousePosition.x+this._draggingStartSpritePosition.x,y:A.y-this._draggingStartMousePosition.y+this._draggingStartSpritePosition.y,force:!0})}this.vm.postIOData("mouse",e)}_startDragging(A,B){if(this._draggingId)return;const t=this.renderer.pick(A,B);if(null===t)return;const e=this.vm.getTargetIdForDrawableId(t);if(null===e)return;const g=this.vm.runtime.getTargetById(e);g.draggable&&(g.goToFront(),this._draggingId=e,this._draggingStartMousePosition=this._scratchCoordinates(A,B),this._draggingStartSpritePosition={x:g.x,y:g.y},this.vm.startDrag(e))}_cancelDragTimeout(){clearTimeout(this._dragTimeout),this._dragTimeout=null}_onmousedown(A){const{x:B,y:t}=S(A),e={x:B-this.layersRect.left,y:t-this.layersRect.top,button:A.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!0},g="undefined"!=typeof TouchEvent&&A instanceof TouchEvent;(0===A.button||g)&&(this._dragTimeout=setTimeout(this._startDragging.bind(this,e.x,e.y),400)),g&&(A.preventDefault(),document.activeElement&&document.activeElement.blur&&document.activeElement.blur()),this._mousedownPosition={x:e.x,y:e.y},this.vm.postIOData("mouse",e)}_onmouseup(A){this._cancelDragTimeout();const{x:B,y:t}=S(A),e={x:B-this.layersRect.left,y:t-this.layersRect.top,button:A.button,canvasWidth:this.layersRect.width,canvasHeight:this.layersRect.height,isDown:!1,wasDragged:null!==this._draggingId};this._mousedownPosition=null,this.vm.postIOData("mouse",e),this._draggingId&&(this.vm.stopDrag(this._draggingId),this._draggingStartMousePosition=null,this._draggingStartSpritePosition=null,this._draggingId=null)}_ontouchstart(A){this._onmousedown(A)}_ontouchmove(A){this._onmousemove(A)}_ontouchend(A){this._onmouseup(A)}_oncontextmenu(A){A.preventDefault()}_onwheel(A){const B={deltaX:A.deltaX,deltaY:A.deltaY};this.vm.postIOData("mouseWheel",B)}_onkeydown(A){if(A.target!==document&&A.target!==document.body)return;const B={key:A.key,keyCode:A.keyCode,isDown:!0};this.vm.postIOData("keyboard",B),(32===A.keyCode||A.keyCode>=37&&A.keyCode<=40||8===A.keyCode||222===A.keyCode||191===A.keyCode)&&A.preventDefault()}_onkeyup(A){const B={key:A.key,keyCode:A.keyCode,isDown:!1};this.vm.postIOData("keyboard",B),A.target!==document&&A.target!==document.body&&A.preventDefault()}_onresize(){this.relayout()}relayout(){const A=Math.max(1,this._root.offsetWidth),B=Math.max(1,this._root.offsetHeight),t=this._offsetFromTop+this._topControls.computeHeight(),e=this._offsetFromBottom,g=this._offsetFromLeft,i=this._offsetFromRight,Q=Math.max(1,A-g-i),s=Math.max(1,B-t-e);"dynamic-resize"===this.resizeMode&&(this.vm.setStageSize?(this.width=Q,this.height=s,this.vm.setStageSize(this.width,this.height)):console.warn("dynamic-resize not supported: vm does not implement setStageSize"));let n=Q,r=s;"stretch"!==this.resizeMode&&(n=r/this.height*this.width,n>Q&&(r=Q/this.width*this.height,n=Q));const c=B-r,E=A-n,o=(E-g-i)/2+g-E/2,w=(c-t-e)/2+t-c/2;this._layers.style.transform="translate(".concat(o,"px, ").concat(w,"px)"),this._layers.style.width="".concat(n,"px"),this._layers.style.height="".concat(r,"px"),this._overlays.style.transform="scale(".concat(n/this.width,", ").concat(r/this.height,")"),this.renderer.resize(n,r),this.layersRect=this._layers.getBoundingClientRect()}appendTo(A){A.appendChild(this._root),this.relayout()}setup(){this.vm=new i.a,this.vm.setCompatibilityMode(!0),this.vm.setLocale(navigator.language),this.vm.on("MONITORS_UPDATE",this._onmonitorsupdate.bind(this)),this.vm.runtime.on("QUESTION",this._onquestion.bind(this)),this.vm.on("PROJECT_RUN_START",()=>this.dispatchEvent(new Event("PROJECT_RUN_START"))),this.vm.on("PROJECT_RUN_STOP",()=>this.dispatchEvent(new Event("PROJECT_RUN_STOP"))),this.usePackagedRuntime&&this.vm.convertToPackagedRuntime&&this.vm.convertToPackagedRuntime(),this.vm.setStageSize&&this.vm.setStageSize(this.width,this.height),this.vm.runtime.cloudOptions&&(this.vm.runtime.cloudOptions.limit=1/0),this.vm.on("STAGE_SIZE_CHANGED",(A,B)=>{this.width===A&&this.height===B||(this.width=A,this.height=B,this.relayout())}),this.cloudManager=new D.CloudManager(this),this.renderer=new s.a(this._canvas,-this.width/2,this.width/2,-this.height/2,this.height/2),this.vm.attachRenderer(this.renderer),this.storage=new E,this.vm.attachStorage(this.storage),"undefined"!=typeof AudioContext||"undefined"!=typeof webkitAudioContext?(this.audioEngine=new w.a,this.vm.attachAudioEngine(this.audioEngine)):console.warn("AudioContext not supported. Sound will not work."),this.bitmapAdapter=new C.BitmapAdapter,this.vm.attachV2BitmapAdapter(this.bitmapAdapter),this.videoProvider=new F,this.vm.setVideoProvider(this.videoProvider)}async _connectPeripherals(){const A=A=>new Promise(B=>{const t=B=>{const t=Object.keys(B).map(A=>B[A]);if(t.length>0){const B=t[0];console.log("Connecting to peripheral",B),this.vm.connectPeripheral(A,B.peripheralId)}else console.error("No peripherals found for",A);g()},e=()=>{console.error("Peripheral scan timed out for",A),g()},g=()=>{this.vm.removeListener("PERIPHERAL_LIST_UPDATE",t),this.vm.removeListener("PERIPHERAL_SCAN_TIMEOUT",e),B()};this.vm.on("PERIPHERAL_LIST_UPDATE",t),this.vm.on("PERIPHERAL_SCAN_TIMEOUT",e),this.vm.scanForPeripheral(A)});for(const B of Object.keys(this.vm.runtime.peripheralExtensions))await A(B)}_onmonitorsupdate(A){for(const B of A.valueSeq()){const A=B.get("id");if(!this._monitors.has(A)){if(!B.get("visible"))continue;"list"===B.get("mode")?this._monitors.set(A,new k(this,B)):this._monitors.set(A,new J(this,B))}this._monitors.get(A).update(B)}}ask(A){return this._question=new f(this,A),this._question.answer()}_onquestion(A){this._question&&this._question.destroy(),null!==A&&this.ask(A).then(A=>{this.vm.runtime.emit("ANSWER",A)})}loadProject(A){return this.vm.loadProject(A).then(()=>{this.vm.setCloudProvider(this.cloudManager),this.cloudManager.projectReady(),this.renderer.draw(),setTimeout(()=>{this.renderer.draw()}),this.shouldConnectPeripherals&&this._connectPeripherals()})}setUsername(A){this._username=A,this.vm.postIOData("userData",{username:A})}addCloudProvider(A){this.cloudManager.addProvider(A)}addCloudProviderOverride(A,B){this.cloudManager.addProviderOverride(A,B)}addControlButton(A){let{element:B,where:t}=A;if("top-left"===t)this._topControls.addToStart(B);else{if("top-right"!==t)throw new Error("Unknown 'where': ".concat(t));this._topControls.addToEnd(B)}this.relayout()}getMessage(A){return this.messages[A]||A}setAccentColor(A){this._root.style.setProperty("--sc-accent-color",A),this._root.style.setProperty("--sc-accent-color-transparent","".concat(A,"59"))}start(){this.vm.start(),this.vm.greenFlag()}greenFlag(){this.start()}stopAll(){this.vm.stopAll()}_lookupVariable(A,B){const t=this.vm.runtime.getTargetForStage().lookupVariableByNameAndType(A,B);if(!t)throw new Error("Global ".concat(B||"variable"," does not exist: ").concat(A));return t}getVariable(A){return this._lookupVariable(A,"").value}setVariable(A,B){if(!j(B))throw new Error("Invalid variable value");this._lookupVariable(A,"").value=B}getList(A){return this._lookupVariable(A,"list").value}setList(A,B){if(!(A=>{if(!Array.isArray(A))return!1;for(let B=0;B input {\n margin-right: 4px;\n}\n.sa-gamepad-has-controller .sa-gamepad-store-settings {\n display: block;\n}\n'},108: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)}},328:function(e,t,n){"use strict";n.r(t);var s=n(6);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({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")}),l=e=>"".concat(e.id," (").concat(e.index,")");class h{constructor(e,t){this.gamepad=e,this.gamepadLib=t,this.resetMappings()}resetMappings(){this.buttonMappings=this.getDefaultButtonMappings().map(d),this.axesMappings=this.getDefaultAxisMappings().map(d)}getDefaultButtonMappings(){let e;if(this.gamepadLib.hints.importedSettings)e=this.gamepadLib.hints.importedSettings.buttons;else{const t=this.gamepadLib.hints.usedKeys,n=new Set,{usesArrows:s,usesWASD:i}=c(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),l=()=>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:l()},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.gamepadLib.hints.importedSettings)e=this.gamepadLib.hints.importedSettings.axes;else if(4===this.gamepad.axes.length){const t=this.gamepadLib.hints.usedKeys,{usesArrows:n,usesWASD:s}=c(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)}}const p=()=>({usedKeys:new Set,importedSettings:null,generated:!1});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.hints=p(),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)})}ensureHintsGenerated(){this.hints.generated||(this.getHintsLazily&&Object.assign(this.hints,this.getHintsLazily()),this.hints.generated=!0)}resetControls(){this.hints=p(),this.ensureHintsGenerated();for(const e of this.gamepads.values())e.resetMappings()}handleConnect(e){this.ensureHintsGenerated();for(const e of this.connectCallbacks)e();this.connectCallbacks=[];const t=e.gamepad,n=l(t);i.log("connected",t);const r=new h(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=l(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=l(e),n=this.gamepads.get(t);for(let t=0;tthis.virtualCursor.maxX&&(this.virtualCursor.x=this.virtualCursor.maxX),this.virtualCursor.xthis.virtualCursor.maxY&&(this.virtualCursor.y=this.virtualCursor.maxY),this.virtualCursor.y!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{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};g.setConsole(console);const o=new g,a=(()=>{const e=(()=>{const e=n.runtime.getTargetForStage().comments;for(const t of Object.values(e))if(t.text.includes(" // _gamepad_"))return t;return null})();if(!e)return null;const t=e.text.split("\n").find(e=>e.endsWith(" // _gamepad_"));if(!t)return console.warn("Gamepad comment does not contain valid line"),null;const s=t.substr(0,t.length-" // _gamepad_".length);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})();o.getHintsLazily=()=>a?{importedSettings:a}:{usedKeys:r()};const d=n.runtime.renderer,u=d._xRight-d._xLeft,c=d._yTop-d._yBottom,l=d.canvas,h=document.createElement("img");let p;h.hidden=!0,h.className="sa-gamepad-cursor",h.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 m=e=>{h.hidden=!e,clearTimeout(p),e&&(document.body.classList.add("sa-gamepad-hide-cursor"),p=setTimeout(v,8e3))},v=()=>{m(!1)},y=e=>{m(!0),h.classList.toggle("sa-gamepad-cursor-down",e)};let w;if(document.addEventListener("mousemove",()=>{m(!1),document.body.classList.remove("sa-gamepad-hide-cursor")}),window.ResizeObserver){let e=u,t=c;new ResizeObserver(n=>{for(const s of n)e=s.contentRect.width,t=s.contentRect.height}).observe(l),w=()=>[e,t]}else w=()=>{const e=l.getBoundingClientRect();return[e.width,e.height]};let A=0,b=0;const C=e=>{if(!s())return;const[t,i]=w();n.postIOData("mouse",f(f({},e),{},{canvasWidth:t,canvasHeight:i,x:(A+u/2)*(t/u),y:i/c*(c/2-b)}))},x=(e,t)=>{s()&&n.postIOData("keyboard",{key:e,isDown:t})};t||(o.virtualCursor.maxX=d._xRight,o.virtualCursor.minX=d._xLeft,o.virtualCursor.maxY=d._yTop,o.virtualCursor.minY=d._yBottom),o.addEventListener("keydown",e=>x(e.detail,!0)),o.addEventListener("keyup",e=>x(e.detail,!1)),o.addEventListener("mousedown",e=>{y(!0),C({isDown:!0,button:e.detail})}),o.addEventListener("mouseup",e=>{y(!1),C({isDown:!1,button:e.detail})}),o.addEventListener("mousemove",s=>{const{x:i,y:r}=s.detail;if(t){const t=i-A,s=-(r-b);A=i,b=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 A=i,b=r,((e,t)=>{m(!0);const n=u/2+e-3,s=c/2-t-3;h.style.transform="translate(".concat(n,"px, ").concat(s,"px)")})(A,b),C({})}),t||e._overlays.appendChild(h)},A=n(107),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{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 O{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){const e=this.initialProjectId+(t?"-".concat(t):"");this.webSocketProvider.setProjectId(e)}}}var S=n(108);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 O;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(S.a)(n),t.pause&&function(e){let{scaffolding:t}=e;const n=t.vm;let s=!1,i=new WeakMap;const r=e=>{if(s=e,s){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")}else{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.timer){const s=e-n.pauseTime;t.timer.startTime+=s}t.status=n.status}}i=new WeakMap}n.emit("P4_PAUSE",s)},o=e=>{if(4===e.status)return;const t=i.get(e);t&&1!==e.status&&(t.status=e.status,e.status=1)},a=n.runtime.sequencer.stepThreads;n.runtime.sequencer.stepThreads=function(){if(s)for(const e of this.runtime.threads)o(e);return a.call(this)};const d=n.runtime.greenFlag;n.runtime.greenFlag=function(){return r(!1),d.call(this)};const u=n.runtime.startHats;n.runtime.startHats=function(){if(s)return[];for(var e=arguments.length,t=new Array(e),n=0;ne!==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:{}}}}}); +// 1ccf950aaaac5c9ca929985c0dcebe87fea16ee69aa09629f814af76772d187d =^..^= - +