@scratch/scratch-render 11.0.0-UEPR-176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +12 -0
- package/README.md +87 -0
- package/dist/node/scratch-render.js +2 -0
- package/dist/node/scratch-render.js.LICENSE.txt +3 -0
- package/dist/web/scratch-render.js +3 -0
- package/dist/web/scratch-render.js.LICENSE.txt +14 -0
- package/dist/web/scratch-render.js.map +1 -0
- package/dist/web/scratch-render.min.js +3 -0
- package/dist/web/scratch-render.min.js.LICENSE.txt +14 -0
- package/dist/web/scratch-render.min.js.map +1 -0
- package/package.json +89 -0
- package/src/.eslintrc.js +11 -0
- package/src/BitmapSkin.js +120 -0
- package/src/Drawable.js +734 -0
- package/src/EffectTransform.js +197 -0
- package/src/PenSkin.js +350 -0
- package/src/Rectangle.js +196 -0
- package/src/RenderConstants.js +34 -0
- package/src/RenderWebGL.js +2029 -0
- package/src/SVGSkin.js +239 -0
- package/src/ShaderManager.js +187 -0
- package/src/Silhouette.js +257 -0
- package/src/Skin.js +235 -0
- package/src/TextBubbleSkin.js +284 -0
- package/src/index.js +7 -0
- package/src/playground/.eslintrc.js +9 -0
- package/src/playground/getMousePosition.js +37 -0
- package/src/playground/index.html +41 -0
- package/src/playground/playground.js +202 -0
- package/src/playground/queryPlayground.html +73 -0
- package/src/playground/queryPlayground.js +196 -0
- package/src/playground/style.css +11 -0
- package/src/shaders/sprite.frag +249 -0
- package/src/shaders/sprite.vert +75 -0
- package/src/util/canvas-measurement-provider.js +41 -0
- package/src/util/color-conversions.js +97 -0
- package/src/util/log.js +4 -0
- package/src/util/text-wrapper.js +112 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2016, Massachusetts Institute of Technology
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
## scratch-render
|
|
2
|
+
#### WebGL-based rendering engine for Scratch 3.0
|
|
3
|
+
|
|
4
|
+
[](https://circleci.com/gh/LLK/scratch-render?branch=develop)
|
|
5
|
+
|
|
6
|
+
[](https://greenkeeper.io/)
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
```bash
|
|
10
|
+
npm install https://github.com/scratchfoundation/scratch-render.git
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
```html
|
|
15
|
+
<!DOCTYPE html>
|
|
16
|
+
<html lang="en">
|
|
17
|
+
<head>
|
|
18
|
+
<meta charset="UTF-8">
|
|
19
|
+
<title>Scratch WebGL rendering demo</title>
|
|
20
|
+
</head>
|
|
21
|
+
|
|
22
|
+
<body>
|
|
23
|
+
<canvas id="myStage"></canvas>
|
|
24
|
+
<canvas id="myDebug"></canvas>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```js
|
|
30
|
+
var canvas = document.getElementById('myStage');
|
|
31
|
+
var debug = document.getElementById('myDebug');
|
|
32
|
+
|
|
33
|
+
// Instantiate the renderer
|
|
34
|
+
var renderer = new require('@scratch/scratch-render')(canvas);
|
|
35
|
+
|
|
36
|
+
// Connect to debug canvas
|
|
37
|
+
renderer.setDebugCanvas(debug);
|
|
38
|
+
|
|
39
|
+
// Start drawing
|
|
40
|
+
function drawStep() {
|
|
41
|
+
renderer.draw();
|
|
42
|
+
requestAnimationFrame(drawStep);
|
|
43
|
+
}
|
|
44
|
+
drawStep();
|
|
45
|
+
|
|
46
|
+
// Connect to worker (see "playground" example)
|
|
47
|
+
var worker = new Worker('worker.js');
|
|
48
|
+
renderer.connectWorker(worker);
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Standalone Build
|
|
52
|
+
```bash
|
|
53
|
+
npm run build
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
```html
|
|
57
|
+
<script src="/path/to/render.js"></script>
|
|
58
|
+
<script>
|
|
59
|
+
var renderer = new window.RenderWebGLLocal();
|
|
60
|
+
// do things
|
|
61
|
+
</script>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Testing
|
|
65
|
+
```bash
|
|
66
|
+
npm test
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Donate
|
|
70
|
+
We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!
|
|
71
|
+
|
|
72
|
+
## Committing
|
|
73
|
+
|
|
74
|
+
This project uses [semantic release](https://github.com/semantic-release/semantic-release) to ensure version bumps
|
|
75
|
+
follow semver so that projects depending on it don't break unexpectedly.
|
|
76
|
+
|
|
77
|
+
In order to automatically determine version updates, semantic release expects commit messages to follow the
|
|
78
|
+
[conventional-changelog](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md)
|
|
79
|
+
specification.
|
|
80
|
+
|
|
81
|
+
You can use the [commitizen CLI](https://github.com/commitizen/cz-cli) to make commits formatted in this way:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install -g commitizen@latest cz-conventional-changelog@latest
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Now you're ready to make commits using `git cz`.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see scratch-render.js.LICENSE.txt */
|
|
2
|
+
(()=>{var t={303:(t,e,r)=>{var n=r(2491),i=r(6770).i;function o(){}n.mixin(o),o.prototype.write=function(t,e,r){var n;this.emit("item",(t?t+" ":"")+(e?i("- "+((4==(n=e.toUpperCase()).toString().length?" "+n:n)+" -"),{debug:"magenta",info:"cyan",warn:"yellow",error:"red"}[e])+" ":"")+r.join(" "))},t.exports=o},329:(t,e,r)=>{var n=r(2491),i=r(2216),o={debug:["cyan"],info:["purple"],warn:["yellow",!0],error:["red",!0]},a=new n;a.write=function(t,e,r){console.log;console[e]&&console[e].apply&&console[e].apply(console,["%c"+t+" %c"+e,i("gray"),i.apply(i,o[e])].concat(r))},a.pipe=function(){},t.exports=a},371:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=r(7602),s=r(4382),u=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._measurementProvider=e,this._cache={}},(e=[{key:"wrapText",value:function(t,e){e=e.normalize();var r="".concat(t,"-").concat(e);if(this._cache[r])return this._cache[r];for(var n,i=this._measurementProvider.beginMeasurementSession(),o=new a(e),u=0,l=null,c=[];n=o.nextBreak();){var f=e.slice(u,n.position).replace(/\n+$/,""),h=(l||"").concat(f),d=this._measurementProvider.measureText(h);if(d>t)if(this._measurementProvider.measureText(f)>t)for(var p=0,m=void 0;p!==(m=s.nextBreak(f,p));){var y=f.substring(p,m);h=(l||"").concat(y),d=this._measurementProvider.measureText(h),null===l||d<=t?l=h:(c.push(l),l=y),p=m}else null!==l&&c.push(l),l=f;else l=h;n.required&&(null!==l&&c.push(l),l=null),u=n.position}return((l=l||"").length>0||0===c.length)&&c.push(l),this._cache[r]=c,this._measurementProvider.endMeasurementSession(i),c}}])&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();t.exports=u},780:(t,e,r)=>{"use strict";var n=r(8734),i=r(2207),o=r(3672),a=r(1528);function s(t,e){return Math.pow(e[0]-t[0],2)+Math.pow(e[1]-t[1],2)}function u(t,e,r){var n=[e[0]-t[0],e[1]-t[1]],i=[r[0]-t[0],r[1]-t[1]],o=s(t,e),a=s(t,r);return(n[0]*i[0]+n[1]*i[1])/Math.sqrt(o*a)}function l(t,e){for(var r=0;r<e.length-1;r++){var i=[e[r],e[r+1]];if(!(t[0][0]===i[0][0]&&t[0][1]===i[0][1]||t[0][0]===i[1][0]&&t[0][1]===i[1][1])&&n(t,i))return!0}return!1}function c(t){return[Math.min(t[0][0],t[1][0]),Math.min(t[0][1],t[1][1]),Math.max(t[0][0],t[1][0]),Math.max(t[0][1],t[1][1])]}function f(t,e,r){for(var n,i,o=null,a=d,s=d,c=0;c<e.length;c++)n=u(t[0],t[1],e[c]),i=u(t[1],t[0],e[c]),n>a&&i>s&&!l([t[0],e[c]],r)&&!l([t[1],e[c]],r)&&(a=n,s=i,o=e[c]);return o}function h(t,e,r,n,i){for(var o,a,u,l,d,p,m,y=!1,b=0;b<t.length-1;b++)if(a=(o=[t[b],t[b+1]])[0].join()+","+o[1].join(),!(s(o[0],o[1])<e||!0===i[a])){u=0,d=c(o);do{p=(d=n.extendBbox(d,u))[2]-d[0],m=d[3]-d[1],l=f(o,n.rangePoints(d),t),u++}while(null===l&&(r[0]>p||r[1]>m));p>=r[0]&&m>=r[1]&&(i[a]=!0),null!==l&&(t.splice(b+1,0,l),n.removePoint(l),y=!0)}return y?h(t,e,r,n,i):t}var d=Math.cos(90/(180/Math.PI)),p=.6;t.exports=function(t,e,r){var n,s,u,l,c,f,d,m=e||20;return t.length<4?t.slice():(d=function(t){return t.filter((function(t,e,r){var n=r[e-1];return 0===e||!(n[0]===t[0]&&n[1]===t[1])}))}(function(t){return t.sort((function(t,e){return t[0]==e[0]?t[1]-e[1]:t[0]-e[0]}))}(o.toXy(t,r))),l=function(t){for(var e=1/0,r=1/0,n=-1/0,i=-1/0,o=t.length-1;o>=0;o--)t[o][0]<e&&(e=t[o][0]),t[o][1]<r&&(r=t[o][1]),t[o][0]>n&&(n=t[o][0]),t[o][1]>i&&(i=t[o][1]);return[n-e,i-r]}(d),c=[l[0]*p,l[1]*p],n=a(d),u=d.filter((function(t){return n.indexOf(t)<0})),f=Math.ceil(1/(d.length/(l[0]*l[1]))),s=h(n,Math.pow(m,2),c,i(u,f),{}),o.fromXy(s,r))}},800:(t,e,r)=>{var n,i;i=r(7694),n=function(){function t(t){var e,r,n;(e="function"==typeof t.readUInt32BE&&"function"==typeof t.slice)||t instanceof Uint8Array?(e?(this.highStart=t.readUInt32BE(0),this.errorValue=t.readUInt32BE(4),r=t.readUInt32BE(8),t=t.slice(12)):(n=new DataView(t.buffer),this.highStart=n.getUint32(0),this.errorValue=n.getUint32(4),r=n.getUint32(8),t=t.subarray(12)),t=i(t,new Uint8Array(r)),t=i(t,new Uint8Array(r)),this.data=new Uint32Array(t.buffer)):(this.data=t.data,this.highStart=t.highStart,this.errorValue=t.errorValue)}return t.prototype.get=function(t){var e;return t<0||t>1114111?this.errorValue:t<55296||t>56319&&t<=65535?(e=(this.data[t>>5]<<2)+(31&t),this.data[e]):t<=65535?(e=(this.data[2048+(t-55296>>5)]<<2)+(31&t),this.data[e]):t<this.highStart?(e=this.data[2080+(t>>11)],e=((e=this.data[e+(t>>5&63)])<<2)+(31&t),this.data[e]):this.data[this.data.length-4]},t}(),t.exports=n},1158:t=>{"use strict";t.exports=require("buffer")},1254:t=>{function e(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return r(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}t.exports={rgbToHsv:function(t,r){var n=e(t,3),i=n[0],o=n[1],a=n[2],s=0,u=0;(o/=255)<(a/=255)&&(u=o,o=a,a=u,s=-1),(i/=255)<o&&(u=i,i=o,o=u,s=-2/6-s);var l=i-Math.min(o,a),c=Math.abs(s+(o-a)/(6*l+Number.EPSILON)),f=l/(i+Number.EPSILON),h=i;return r[0]=c,r[1]=f,r[2]=h,r},hsvToRgb:function(t,r){var n=e(t,3),i=n[0],o=n[1],a=n[2];if(0===o)return r[0]=r[1]=r[2]=255*a+.5,r;var s=6*(i%=1)|0,u=6*i-s,l=a*(1-o),c=a*(1-o*u),f=a*(1-o*(1-u)),h=0,d=0,p=0;switch(s){case 0:h=a,d=f,p=l;break;case 1:h=c,d=a,p=l;break;case 2:h=l,d=a,p=f;break;case 3:h=l,d=c,p=a;break;case 4:h=f,d=l,p=a;break;case 5:h=a,d=l,p=c}return r[0]=255*h+.5,r[1]=255*d+.5,r[2]=255*p+.5,r}}},1280:(t,e,r)=>{var n=r(2491),i=r(6770).i;function o(){}function a(t){return t}n.mixin(o);var s={string:a,number:a,default:JSON.stringify.bind(JSON)};o.prototype.write=function(t,e,r){var n,a=function(){var t=Error.prepareStackTrace;Error.prepareStackTrace=function(t,e){return e};var e=new Error;Error.captureStackTrace(e,arguments.callee);var r=e.stack;return Error.prepareStackTrace=t,r}()[5],u=o.fullPath?a.getFileName():a.getFileName().replace(/^.*\/(.+)$/,"/$1");this.emit("item",(t?t+" ":"")+(e?i(4==(n=e).toString().length?" "+n:n,{debug:"magenta",info:"cyan",warn:"yellow",error:"red"}[e])+" ":"")+i(u+":"+a.getLineNumber(),"grey")+" "+function(t){return t.map((function(t){return(s[typeof t]||s.default)(t)}))}(r).join(" "))},o.fullPath=!0,t.exports=o},1379:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=r(9609),s=r(1254),u=s.rgbToHsv,l=s.hsvToRgb,c=r(6952),f=.5,h=.5,d=[0,0,0],p=function(){return t=function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)},r=[{key:"transformColor",value:function(t,e,r){if(0===e[3])return e;var n=t.enabledEffects;"number"==typeof r&&(n&=r);var i=t.getUniforms(),o=!!(n&c.EFFECT_INFO.color.mask),a=!!(n&c.EFFECT_INFO.brightness.mask);if(o||a){var s=e[3]/255;if(e[0]/=s,e[1]/=s,e[2]/=s,o){var f=u(e,d);f[2]<.055?(f[0]=0,f[1]=1,f[2]=.055):f[1]<.09&&(f[0]=0,f[1]=.09),f[0]=i.u_color+f[0]+1,l(f,e)}if(a){var h=255*i.u_brightness;e[0]+=h,e[1]+=h,e[2]+=h}e[0]*=s,e[1]*=s,e[2]*=s}return n&c.EFFECT_INFO.ghost.mask&&(e[0]*=i.u_ghost,e[1]*=i.u_ghost,e[2]*=i.u_ghost,e[3]*=i.u_ghost),e}},{key:"transformPoint",value:function(t,e,r){a.v3.copy(e,r);var n=t.enabledEffects,i=t.getUniforms();if(n&c.EFFECT_INFO.mosaic.mask&&(r[0]=i.u_mosaic*r[0]%1,r[1]=i.u_mosaic*r[1]%1),n&c.EFFECT_INFO.pixelate.mask){var o=t.skin.getUniforms(),s=o.u_skinSize[0]/i.u_pixelate,u=o.u_skinSize[1]/i.u_pixelate;r[0]=(Math.floor(r[0]*s)+f)/s,r[1]=(Math.floor(r[1]*u)+h)/u}if(n&c.EFFECT_INFO.whirl.mask){var l=r[0]-f,d=r[1]-h,p=Math.sqrt(Math.pow(l,2)+Math.pow(d,2)),m=Math.max(1-p/.5,0),y=i.u_whirl*m*m,b=Math.sin(y),v=Math.cos(y),g=v,_=-b,x=b,w=v;r[0]=g*l+x*d+f,r[1]=_*l+w*d+h}if(n&c.EFFECT_INFO.fisheye.mask){var k=(r[0]-f)/f,E=(r[1]-h)/h,S=Math.sqrt(k*k+E*E),A=Math.pow(Math.min(S,1),i.u_fisheye)*Math.max(1,S),T=k/S,C=E/S;r[0]=f+A*T*f,r[1]=h+A*C*h}return r}}],(e=null)&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();t.exports=p},1528:t=>{function e(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])}t.exports=function(t){var r,n=function(t){for(var r=[],n=0;n<t.length;n++){for(;r.length>=2&&e(r[r.length-2],r[r.length-1],t[n])<=0;)r.pop();r.push(t[n])}return r.pop(),r}(t),i=function(t){for(var r=t.reverse(),n=[],i=0;i<r.length;i++){for(;n.length>=2&&e(n[n.length-2],n[n.length-1],r[i])<=0;)n.pop();n.push(r[i])}return n.pop(),n}(t);return(r=i.concat(n)).push(t[0]),r}},1920:t=>{function e(){this._events={}}e.prototype={on:function(t,e){this._events||(this._events={});var r=this._events;return(r[t]||(r[t]=[])).push(e),this},removeListener:function(t,e){var r,n=this._events[t]||[];for(r=n.length-1;r>=0&&n[r];r--)n[r]!==e&&n[r].cb!==e||n.splice(r,1)},removeAllListeners:function(t){t?this._events[t]&&(this._events[t]=[]):this._events={}},listeners:function(t){return this._events&&this._events[t]||[]},emit:function(t){this._events||(this._events={});var e,r=Array.prototype.slice.call(arguments,1),n=this._events[t]||[];for(e=n.length-1;e>=0&&n[e];e--)n[e].apply(this,r);return this},when:function(t,e){return this.once(t,e,!0)},once:function(t,e,r){if(!e)return this;function n(){r||this.removeListener(t,n),e.apply(this,arguments)&&r&&this.removeListener(t,n)}return n.cb=e,this.on(t,n),this}},e.mixin=function(t){var r,n=e.prototype;for(r in n)n.hasOwnProperty(r)&&(t.prototype[r]=n[r])},t.exports=e},2203:t=>{"use strict";t.exports=require("stream")},2207:t=>{function e(t,e){this._cells=[],this._cellSize=e,t.forEach((function(t){var e=this.point2CellXY(t),r=e[0],n=e[1];void 0===this._cells[r]&&(this._cells[r]=[]),void 0===this._cells[r][n]&&(this._cells[r][n]=[]),this._cells[r][n].push(t)}),this)}e.prototype={cellPoints:function(t,e){return void 0!==this._cells[t]&&void 0!==this._cells[t][e]?this._cells[t][e]:[]},rangePoints:function(t){for(var e=this.point2CellXY([t[0],t[1]]),r=this.point2CellXY([t[2],t[3]]),n=[],i=e[0];i<=r[0];i++)for(var o=e[1];o<=r[1];o++)n=n.concat(this.cellPoints(i,o));return n},removePoint:function(t){for(var e,r=this.point2CellXY(t),n=this._cells[r[0]][r[1]],i=0;i<n.length;i++)if(n[i][0]===t[0]&&n[i][1]===t[1]){e=i;break}return n.splice(e,1),n},point2CellXY:function(t){return[parseInt(t[0]/this._cellSize),parseInt(t[1]/this._cellSize)]},extendBbox:function(t,e){return[t[0]-e*this._cellSize,t[1]-e*this._cellSize,t[2]+e*this._cellSize,t[3]+e*this._cellSize]}},t.exports=function(t,r){return new e(t,r)}},2216:t=>{var e={black:"#000",red:"#c23621",green:"#25bc26",yellow:"#bbbb00",blue:"#492ee1",magenta:"#d338d3",cyan:"#33bbc8",gray:"#808080",purple:"#708"};t.exports=function(t,r){return r?"color: #fff; background: "+e[t]+";":"color: "+e[t]+";"}},2391:(t,e,r)=>{var n=r(2491),i=r(6770).i,o=r(9023);function a(){}n.mixin(a),a.prototype.write=function(t,e,r){this.emit("item",(t?i(t+" ","grey"):"")+(e?i(e,{debug:"blue",info:"cyan",warn:"yellow",error:"red"}[e])+" ":"")+r.map((function(t){return"string"==typeof t?t:o.inspect(t,null,3,!0)})).join(" "))},t.exports=a},2491:(t,e,r)=>{function n(){}r(1920).mixin(n),n.prototype.write=function(t,e,r){this.emit("item",t,e,r)},n.prototype.end=function(){this.emit("end"),this.removeAllListeners()},n.prototype.pipe=function(t){var e=this;function r(){t.write.apply(t,Array.prototype.slice.call(arguments))}function n(){!t._isStdio&&t.end()}return e.emit("unpipe",t),t.emit("pipe",e),e.on("item",r),e.on("end",n),e.when("unpipe",(function(i){var o=i===t||void 0===i;return o&&(e.removeListener("item",r),e.removeListener("end",n),t.emit("unpipe")),o})),t},n.prototype.unpipe=function(t){return this.emit("unpipe",t),this},n.prototype.format=function(t){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"))},n.mixin=function(t){var e,r=n.prototype;for(e in r)r.hasOwnProperty(e)&&(t.prototype[e]=r[e])},t.exports=n},2648:t=>{"use strict";t.exports=JSON.parse('{"Other":0,"CR":1,"LF":2,"Control":3,"Extend":4,"Regional_Indicator":5,"SpacingMark":6,"L":7,"V":8,"T":9,"LV":10,"LVT":11}')},2752:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=r(9609),s=r(5837),u=r(4465),l=r(6952),c=r(9755),f=r(1379),h=r(3707),d=a.v3.create(),p=1e-6,m=function(t,e){var r=d,n=e[0],i=e[1],o=t._inverseMatrix,a=n*o[3]+i*o[7]+o[15];return r[0]=.5-(n*o[0]+i*o[4]+o[12])/a,r[1]=(n*o[1]+i*o[5]+o[13])/a+.5,Math.abs(r[0])<p&&(r[0]=0),Math.abs(r[1])<p&&(r[1]=0),0!==t.enabledEffects&&r[0]>=0&&r[0]<1&&r[1]>=0&&r[1]<1&&f.transformPoint(t,r,r),r},y=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._id=e,this._uniforms={u_modelMatrix:a.m4.identity(),u_silhouetteColor:t.color4fFromID(this._id)};for(var r=l.EFFECTS.length,n=0;n<r;++n){var i=l.EFFECTS[n],o=l.EFFECT_INFO[i],s=o.converter;this._uniforms[o.uniformName]=s(0)}this._position=a.v3.create(0,0),this._scale=a.v3.create(100,100),this._direction=90,this._transformDirty=!0,this._rotationMatrix=a.m4.identity(),this._rotationTransformDirty=!0,this._rotationAdjusted=a.v3.create(),this._rotationCenterDirty=!0,this._skinScale=a.v3.create(0,0,0),this._skinScaleDirty=!0,this._inverseMatrix=a.m4.identity(),this._inverseTransformDirty=!0,this._visible=!0,this.enabledEffects=0,this._convexHullPoints=null,this._convexHullDirty=!0,this._transformedHullPoints=null,this._transformedHullDirty=!0,this._skinWasAltered=this._skinWasAltered.bind(this),this.isTouching=this._isTouchingNever},r=[{key:"color4fFromID",value:function(t){return[(255&(t-=u.ID_NONE))/255,(t>>8&255)/255,(t>>16&255)/255,1]}},{key:"color3bToID",value:function(t,e,r){var n;return n=255&t,n|=(255&e)<<8,(n|=(255&r)<<16)+u.ID_NONE}},{key:"sampleColor4b",value:function(t,e,r,n){var i=m(e,t);if(i[0]<0||i[1]<0||i[0]>1||i[1]>1)return r[0]=0,r[1]=0,r[2]=0,r[3]=0,r;var o=e.skin._silhouette.colorAtNearest(i,r);return 0===e.enabledEffects?o:f.transformColor(e,o,n)}}],(e=[{key:"dispose",value:function(){this.skin=null}},{key:"setTransformDirty",value:function(){this._transformDirty=!0,this._inverseTransformDirty=!0,this._transformedHullDirty=!0}},{key:"id",get:function(){return this._id}},{key:"skin",get:function(){return this._skin},set:function(t){this._skin!==t&&(this._skin&&this._skin.removeListener(c.Events.WasAltered,this._skinWasAltered),this._skin=t,this._skin&&this._skin.addListener(c.Events.WasAltered,this._skinWasAltered),this._skinWasAltered())}},{key:"scale",get:function(){return[this._scale[0],this._scale[1]]}},{key:"getUniforms",value:function(){return this._transformDirty&&this._calculateTransform(),this._uniforms}},{key:"getVisible",value:function(){return this._visible}},{key:"updatePosition",value:function(t){this._position[0]===t[0]&&this._position[1]===t[1]||(this._position[0]=Math.round(t[0]),this._position[1]=Math.round(t[1]),this.setTransformDirty())}},{key:"updateDirection",value:function(t){this._direction!==t&&(this._direction=t,this._rotationTransformDirty=!0,this.setTransformDirty())}},{key:"updateScale",value:function(t){this._scale[0]===t[0]&&this._scale[1]===t[1]||(this._scale[0]=t[0],this._scale[1]=t[1],this._rotationCenterDirty=!0,this._skinScaleDirty=!0,this.setTransformDirty())}},{key:"updateVisible",value:function(t){this._visible!==t&&(this._visible=t,this.setConvexHullDirty())}},{key:"updateEffect",value:function(t,e){var r=l.EFFECT_INFO[t];e?this.enabledEffects|=r.mask:this.enabledEffects&=~r.mask;var n=r.converter;this._uniforms[r.uniformName]=n(e),r.shapeChanges&&this.setConvexHullDirty()}},{key:"updateProperties",value:function(t){"position"in t&&this.updatePosition(t.position),"direction"in t&&this.updateDirection(t.direction),"scale"in t&&this.updateScale(t.scale),"visible"in t&&this.updateVisible(t.visible);for(var e=l.EFFECTS.length,r=0;r<e;++r){var n=l.EFFECTS[r];n in t&&this.updateEffect(n,t[n])}}},{key:"_calculateTransform",value:function(){if(this._rotationTransformDirty){var t=(270-this._direction)*Math.PI/180,e=Math.cos(t),r=Math.sin(t);this._rotationMatrix[0]=e,this._rotationMatrix[1]=r,this._rotationMatrix[4]=-r,this._rotationMatrix[5]=e,this._rotationTransformDirty=!1}if(this._rotationCenterDirty&&null!==this.skin){var n=this.skin.rotationCenter,i=this.skin.size,o=n[0],a=n[1],s=i[0],u=i[1],l=this._scale[0],c=this._scale[1],f=this._rotationAdjusted;f[0]=(o-s/2)*l/100,f[1]=(a-u/2)*c/100*-1,this._rotationCenterDirty=!1}if(this._skinScaleDirty&&null!==this.skin){var h=this.skin.size,d=this._skinScale;d[0]=h[0]*this._scale[0]/100,d[1]=h[1]*this._scale[1]/100,this._skinScaleDirty=!1}var p=this._uniforms.u_modelMatrix,m=this._skinScale[0],y=this._skinScale[1],b=this._rotationMatrix[0],v=this._rotationMatrix[1],g=this._rotationMatrix[4],_=this._rotationMatrix[5],x=this._rotationAdjusted[0],w=this._rotationAdjusted[1],k=this._position[0],E=this._position[1];p[0]=m*b,p[1]=m*v,p[4]=y*g,p[5]=y*_,p[12]=b*x+g*w+k,p[13]=v*x+_*w+E,this._transformDirty=!1}},{key:"needsConvexHullPoints",value:function(){return!this._convexHullPoints||this._convexHullDirty||0===this._convexHullPoints.length}},{key:"setConvexHullDirty",value:function(){this._convexHullDirty=!0}},{key:"setConvexHullPoints",value:function(t){this._convexHullPoints=t,this._convexHullDirty=!1,this._transformedHullPoints=[];for(var e=0;e<t.length;e++)this._transformedHullPoints.push(a.v3.create());this._transformedHullDirty=!0}},{key:"_isTouchingNever",value:function(t){return!1}},{key:"_isTouchingNearest",value:function(t){return this.skin.isTouchingNearest(m(this,t))}},{key:"_isTouchingLinear",value:function(t){return this.skin.isTouchingLinear(m(this,t))}},{key:"getBounds",value:function(t){if(this.needsConvexHullPoints())throw new Error("Needs updated convex hull points before bounds calculation.");this._transformDirty&&this._calculateTransform();var e=this._getTransformedHullPoints();return(t=t||new s).initFromPointsAABB(e),t}},{key:"getBoundsForBubble",value:function(t){if(this.needsConvexHullPoints())throw new Error("Needs updated convex hull points before bubble bounds calculation.");this._transformDirty&&this._calculateTransform();var e=this._getTransformedHullPoints(),r=Math.max.apply(null,e.map((function(t){return t[1]}))),n=e.filter((function(t){return t[1]>r-8}));return(t=t||new s).initFromPointsAABB(n),t}},{key:"getAABB",value:function(t){this._transformDirty&&this._calculateTransform();var e=this._uniforms.u_modelMatrix;return(t=t||new s).initFromModelMatrix(e),t}},{key:"getFastBounds",value:function(t){return this.needsConvexHullPoints()?this.getAABB(t):this.getBounds(t)}},{key:"_getTransformedHullPoints",value:function(){if(!this._transformedHullDirty)return this._transformedHullPoints;for(var t=a.m4.ortho(-1,1,-1,1,-1,1),e=this.skin.size,r=1/e[0]/2,n=1/e[1]/2,i=a.m4.multiply(this._uniforms.u_modelMatrix,t),o=0;o<this._convexHullPoints.length;o++){var s=this._convexHullPoints[o],u=this._transformedHullPoints[o];u[0]=.5+-s[0]/e[0]-r,u[1]=s[1]/e[1]-.5+n,a.m4.transformPoint(i,u,u)}return this._transformedHullDirty=!1,this._transformedHullPoints}},{key:"updateMatrix",value:function(){if(this._transformDirty&&this._calculateTransform(),this._inverseTransformDirty){var t=this._inverseMatrix;a.m4.copy(this._uniforms.u_modelMatrix,t),t[10]=1,a.m4.inverse(t,t),this._inverseTransformDirty=!1}}},{key:"updateCPURenderAttributes",value:function(){this.updateMatrix(),this.skin?(this.skin.updateSilhouette(this._scale),this.skin.useNearest(this._scale,this)?this.isTouching=this._isTouchingNearest:this.isTouching=this._isTouchingLinear):(h.warn("Could not find skin for drawable with id: ".concat(this._id)),this.isTouching=this._isTouchingNever)}},{key:"_skinWasAltered",value:function(){this._rotationCenterDirty=!0,this._skinScaleDirty=!0,this.setConvexHullDirty(),this.setTransformDirty()}}])&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,r}();t.exports=y},2758:function(t,e){(function(){e.OP=0,e.CL=1,e.CP=2,e.QU=3,e.GL=4,e.NS=5,e.EX=6,e.SY=7,e.IS=8,e.PR=9,e.PO=10,e.NU=11,e.AL=12,e.HL=13,e.ID=14,e.IN=15,e.HY=16,e.BA=17,e.BB=18,e.B2=19,e.ZW=20,e.CM=21,e.WJ=22,e.H2=23,e.H3=24,e.JL=25,e.JV=26,e.JT=27,e.RI=28,e.AI=29,e.BK=30,e.CB=31,e.CJ=32,e.CR=33,e.LF=34,e.NL=35,e.SA=36,e.SG=37,e.SP=38,e.XX=39}).call(this)},2859:(t,e,r)=>{function n(){}r(2491).mixin(n),n.prototype.write=function(){console.log.apply(console,arguments)};var i=new n;r(6770).R;i.filterEnv=function(){return console.error("Minilog.backends.console.filterEnv is deprecated in Minilog v2."),r(4932)},i.formatters=["formatClean","formatColor","formatNpm","formatLearnboost","formatMinilog","formatWithStack","formatTime"],i.formatClean=new(r(9713)),i.formatColor=new(r(303)),i.formatNpm=new(r(6093)),i.formatLearnboost=new(r(3195)),i.formatMinilog=new(r(2391)),i.formatWithStack=new(r(1280)),i.formatTime=new(r(6139)),t.exports=i},2915:function(t,e){(function(){e.DI_BRK=0,e.IN_BRK=1,e.CI_BRK=2,e.CP_BRK=3,e.PR_BRK=4,e.pairTable=[[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,4,4,4,4],[0,4,4,1,1,4,4,4,4,1,1,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,4,4,4,4,1,1,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[4,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,1,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,1,0,1,1,0,0,4,2,4,1,1,1,1,1,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,0,1,4,4,4,0,0,1,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[0,4,4,1,0,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,4,4,2,4,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,0,0,1,1,1,0,1,1,1,0,0,4,2,4,0,0,0,0,0,0],[1,4,4,1,1,1,4,4,4,1,1,1,1,1,1,1,1,1,1,1,4,2,4,1,1,1,1,1,1],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,1,1,1,1,0,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,1,1,0],[0,4,4,1,1,1,4,4,4,0,1,0,0,0,0,1,1,1,0,0,4,2,4,0,0,0,0,1,0],[0,4,4,1,1,1,4,4,4,0,0,0,0,0,0,0,1,1,0,0,4,2,4,0,0,0,0,0,1]]}).call(this)},3195:(t,e,r)=>{var n=r(2491),i=r(6770).i;function o(){}n.mixin(o),o.prototype.write=function(t,e,r){this.emit("item",(t?i(t+" ","grey"):"")+(e?i(e,{debug:"grey",info:"cyan",warn:"yellow",error:"red"}[e])+" ":"")+r.join(" "))},t.exports=o},3672:t=>{t.exports={toXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","return [pt"+e[0]+",pt"+e[1]+"];")(t)}))},fromXy:function(t,e){return void 0===e?t.slice():t.map((function(t){return new Function("pt","var o = {}; o"+e[0]+"= pt[0]; o"+e[1]+"= pt[1]; return o;")(t)}))}}},3707:(t,e,r)=>{var n=r(7397);n.enable(),t.exports=n("scratch-render")},4100:(t,e)=>{!function(t){"use strict";var e="undefined"!=typeof Uint8Array?Uint8Array:Array,r="+".charCodeAt(0),n="/".charCodeAt(0),i="0".charCodeAt(0),o="a".charCodeAt(0),a="A".charCodeAt(0),s="-".charCodeAt(0),u="_".charCodeAt(0);function l(t){var e=t.charCodeAt(0);return e===r||e===s?62:e===n||e===u?63:e<i?-1:e<i+10?e-i+26+26:e<a+26?e-a:e<o+26?e-o+26:void 0}t.toByteArray=function(t){var r,n,i,o,a,s;if(t.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var u=t.length;a="="===t.charAt(u-2)?2:"="===t.charAt(u-1)?1:0,s=new e(3*t.length/4-a),i=a>0?t.length-4:t.length;var c=0;function f(t){s[c++]=t}for(r=0,n=0;r<i;r+=4,n+=3)f((16711680&(o=l(t.charAt(r))<<18|l(t.charAt(r+1))<<12|l(t.charAt(r+2))<<6|l(t.charAt(r+3))))>>16),f((65280&o)>>8),f(255&o);return 2===a?f(255&(o=l(t.charAt(r))<<2|l(t.charAt(r+1))>>4)):1===a&&(f((o=l(t.charAt(r))<<10|l(t.charAt(r+1))<<4|l(t.charAt(r+2))>>2)>>8&255),f(255&o)),s},t.fromByteArray=function(t){var e,r,n,i,o=t.length%3,a="";function s(t){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(t)}for(e=0,n=t.length-o;e<n;e+=3)r=(t[e]<<16)+(t[e+1]<<8)+t[e+2],a+=s((i=r)>>18&63)+s(i>>12&63)+s(i>>6&63)+s(63&i);switch(o){case 1:a+=s((r=t[t.length-1])>>2),a+=s(r<<4&63),a+="==";break;case 2:a+=s((r=(t[t.length-2]<<8)+t[t.length-1])>>10),a+=s(r>>4&63),a+=s(r<<2&63),a+="="}return a}}(e)},4129:t=>{t.exports="precision mediump float;\n\n#ifdef DRAW_MODE_line\nuniform vec2 u_stageSize;\nuniform float u_lineThickness;\nuniform float u_lineLength;\n// The X and Y components of u_penPoints hold the first pen point. The Z and W components hold the difference between\n// the second pen point and the first. This is done because calculating the difference in the shader leads to floating-\n// point error when both points have large-ish coordinates.\nuniform vec4 u_penPoints;\n\n// Add this to divisors to prevent division by 0, which results in NaNs propagating through calculations.\n// Smaller values can cause problems on some mobile devices.\nconst float epsilon = 1e-3;\n#endif\n\n#if !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\nuniform mat4 u_projectionMatrix;\nuniform mat4 u_modelMatrix;\nattribute vec2 a_texCoord;\n#endif\n\nattribute vec2 a_position;\n\nvarying vec2 v_texCoord;\n\nvoid main() {\n\t#ifdef DRAW_MODE_line\n\t// Calculate a rotated (\"tight\") bounding box around the two pen points.\n\t// Yes, we're doing this 6 times (once per vertex), but on actual GPU hardware,\n\t// it's still faster than doing it in JS combined with the cost of uniformMatrix4fv.\n\n\t// Expand line bounds by sqrt(2) / 2 each side-- this ensures that all antialiased pixels\n\t// fall within the quad, even at a 45-degree diagonal\n\tvec2 position = a_position;\n\tfloat expandedRadius = (u_lineThickness * 0.5) + 1.4142135623730951;\n\n\t// The X coordinate increases along the length of the line. It's 0 at the center of the origin point\n\t// and is in pixel-space (so at n pixels along the line, its value is n).\n\tv_texCoord.x = mix(0.0, u_lineLength + (expandedRadius * 2.0), a_position.x) - expandedRadius;\n\t// The Y coordinate is perpendicular to the line. It's also in pixel-space.\n\tv_texCoord.y = ((a_position.y - 0.5) * expandedRadius) + 0.5;\n\n\tposition.x *= u_lineLength + (2.0 * expandedRadius);\n\tposition.y *= 2.0 * expandedRadius;\n\n\t// 1. Center around first pen point\n\tposition -= expandedRadius;\n\n\t// 2. Rotate quad to line angle\n\tvec2 pointDiff = u_penPoints.zw;\n\t// Ensure line has a nonzero length so it's rendered properly\n\t// As long as either component is nonzero, the line length will be nonzero\n\t// If the line is zero-length, give it a bit of horizontal length\n\tpointDiff.x = (abs(pointDiff.x) < epsilon && abs(pointDiff.y) < epsilon) ? epsilon : pointDiff.x;\n\t// The `normalized` vector holds rotational values equivalent to sine/cosine\n\t// We're applying the standard rotation matrix formula to the position to rotate the quad to the line angle\n\t// pointDiff can hold large values so we must divide by u_lineLength instead of calling GLSL's normalize function:\n\t// https://asawicki.info/news_1596_watch_out_for_reduced_precision_normalizelength_in_opengl_es\n\tvec2 normalized = pointDiff / max(u_lineLength, epsilon);\n\tposition = mat2(normalized.x, normalized.y, -normalized.y, normalized.x) * position;\n\n\t// 3. Translate quad\n\tposition += u_penPoints.xy;\n\n\t// 4. Apply view transform\n\tposition *= 2.0 / u_stageSize;\n\tgl_Position = vec4(position, 0, 1);\n\t#elif defined(DRAW_MODE_background)\n\tgl_Position = vec4(a_position * 2.0, 0, 1);\n\t#else\n\tgl_Position = u_projectionMatrix * u_modelMatrix * vec4(a_position, 0, 1);\n\tv_texCoord = a_texCoord;\n\t#endif\n}\n"},4373:t=>{function e(t){this.client=t.client,this.key=t.key}e.prototype.write=function(t){this.client.rpush(this.key,t)},e.prototype.end=function(){},e.prototype.clear=function(t){this.client.del(this.key,t)},t.exports=e},4382:function(t,e,r){var n=r(1158).Buffer;(function(){var t,i,o,a,s,u,l,c,f,h,d,p,m,y,b,v;v=r(2648),t=v.CR,s=v.LF,i=v.Control,o=v.Extend,c=v.Regional_Indicator,f=v.SpacingMark,a=v.L,p=v.V,h=v.T,u=v.LV,l=v.LVT,d=r(800),m=new d(n("AA4QAAAAAAAAAHbgAQgG9/ntmkuIXjUUxzN+r3k4bUWQVotSHVCsoov6qIoiToWKFYvMuLHVtlaoLqQilLrwtakuxFYoLmQQYWalRYpUKYJV0am4mMUooojgSEG7EC2CdiHq/3rzMcc0yT333jyu0xz4kdwkN+ckOXncfN9QS4jzwCqwBqwHt5O0uuFGsBlsAhOM8lvATkv+LrAb7AXPgRfBAfAqeJ2UmwZvgcPgKDgGjoNZMAe+AN+C5W0hLgAXtvN3KZci7UpwFVgHbgHjYAPYJJ8nwCTYCnaQ58dI+cfBHvn8DFgL9kl9LyP8LLOflJ8CM+Q5K39IPo/28vfeyd6X8fcR/5jYP4v4nHyeR/iNjC8gPAl+BU+T8qcRFx0hBsGKzn/74LreIrdKxsGkRO0zE48wy7lmZSfnYkmWdhnCtTK+oHnnWqUPbuyY679N5t2J8B4ZnyTltyK+Dezq5P62G+Femf+sDPdp6n8JaQcterN5NWXJ5/Ij+FnGR0n6BvCbZk4kwjGjjO8rGh9woedNoudtBz6VSCQSiUQikUgkEomET97t5Hdp/ecvGfcXH+CdWfLNu6onxGowh7SvZPp3CE+A63v5feBJxMcQPyXz/0D4N2h18+cRhEcQnt+1674I+Q+inofANrAd7AAPg529lJfyUl7KS3mu8+4G94H7e/H3rPWRid3+RGIpc0nBGbAuE63F39VV1mjS6Pn4VCv++jN9bs4JMM5gbFSIdaNnpj+ppE3j+QQYWybEA8vytP0IPwF/gpXLsQ+AhWH0xYgQPwwJMTjA46YRXrnVw4vxzYjvke8dzvQx60gkEonE0uQA9oU3wB04J7yH/fDDVv4/j+x/QqfJXv0RuEueJe7t5vkTCLeQ88V2zVkjq+tRpD/Rzf+39hTC55lnkhdQbr+l7EHkTZH8GcTnSf4hkpf9/+uI57NQFT6HTSsC6hMYg3no/FrTF983sH84FJ3xNlroteOfQWNTp+8vL/CZeeX5mgb62A2w6WaDXa/9D/6DeFTafqwBfXtFT4irwacObMnm50/dPPwF4e/grwa0kUsTxiMEnQbcY9ZlsDXwL4iyOIfEB5jvcEgST1L/u/PjkP7vctzaZzkuJZSepknsMaw67jQ0xZe61F2XyvZ5k/ecJq4voXzQ1oZWQRm1Dl1ZH0LtiiVN8pUmy9nQD77bppuTLqWl1O9Ch+9vv9Dfm12COrZqOrXRJv13TX6i00XHyISLNamp3/e6eWWab9xyoYSr1+XeUoWug7ZWFTonhLDPO9M8pOX7cVHwbhn7Yu1VantC61ZtMPWhaiMtX0YXp1wsf7X5p65sW/OslnXpV3XrN803WneXlC0zvj5EZ5sP/6yyXsQQ01rRVdJV/+XWXUZ/rPmp7gf9dNuZoKjOmOOZibqv6fY43fi6bp9pfoXyL1tZ0x5Fy6u+UcVOrm1FZxdOPS7OLi7sFaKaXt+2c/X71qELqbhcD4v8wgRnb6+rr459rqgr3H5T21tmza0r3LOnj/6oWkcmnP6pa7OPvve9dvmqm+PD1HdteyP3e7xsX/mcK7Y26tJV0bXfVI/vOa9bZ3wIbS9nraehKHiH248cn/KxtpX1bV3bQoptnGx+S9ND2xujn6jo+ku3Jvic16oO3djo7CsrnHWdM1dd9UPR/OFQ9rtKl2ZaQ4vaWWe9KGOzSV8dcenPZdvhUny1QZdW1ce4fuhSdGuYb/F1h8IV3/PPlR0+pOya6dofdPuDbt8oug9uis+YvguqjiHnnVDz1KbfR30637f1Y5U+1o2VrVxZMX37qvfcof1XJzFtCKG76plJCJ7fhTq/FJ0hqI/FFtMaGWOv69vjUsrePZTZQ331h8lm07dj1fpCn2Fi3EX09atn2L6Ynsv4AFfUernj4HucbGc8dU0w+aDL+4M6YmtLX0z3I7Ha4Fpn1bufKucck2/YfIhrP3dfci0h5puv9TfUPs21g8bbmvzQZ4tQfhNSiuZ4HVzp4rShTHt9icl2l31YVTqB6Eus81pd/U2xuwyxpYrNPsik1wCoDEZmyDMjCmXFZVtV8d12DqoMizP7zCeh9anyDw==","base64")),y=function(t,e){var r,n,i;return e=e||0,55296<=(r=t.charCodeAt(e))&&r<=56319?(n=r,56320<=(i=t.charCodeAt(e+1))&&i<=57343?1024*(n-55296)+(i-56320)+65536:n):56320<=r&&r<=57343?(i=r,55296<=(n=t.charCodeAt(e-1))&&n<=56319?1024*(n-55296)+(i-56320)+65536:i):r},b=function(e,r){return(e!==t||r!==s)&&(e===i||e===t||e===s||(r===i||r===t||r===s||(e!==a||r!==a&&r!==p&&r!==u&&r!==l)&&((e!==u&&e!==p||r!==p&&r!==h)&&((e!==l&&e!==h||r!==h)&&((e!==c||r!==c)&&(r!==o&&r!==f))))))},e.nextBreak=function(t,e){var r,n,i,o,a,s,u;if(null==e&&(e=0),e<0)return 0;if(e>=t.length-1)return t.length;for(i=m.get(y(t,e)),r=o=e+1,a=t.length;o<a;r=o+=1)if(!(55296<=(s=t.charCodeAt(r-1))&&s<=56319&&56320<=(u=t.charCodeAt(r))&&u<=57343)){if(n=m.get(y(t,r)),b(i,n))return r;i=n}return t.length},e.previousBreak=function(t,e){var r,n,i,o,a,s;if(null==e&&(e=t.length),e>t.length)return t.length;if(e<=1)return 0;for(e--,n=m.get(y(t,e)),r=o=e-1;o>=0;r=o+=-1)if(!(55296<=(a=t.charCodeAt(r))&&a<=56319&&56320<=(s=t.charCodeAt(r+1))&&s<=57343)){if(i=m.get(y(t,r)),b(i,n))return r+1;n=i}return 0},e.break=function(t){var r,n,i;for(i=[],n=0;(r=e.nextBreak(t,n))<t.length;)i.push(t.slice(n,r)),n=r;return n<t.length&&i.push(t.slice(n)),i},e.countBreaks=function(t){var r,n,i;for(n=0,i=0;(r=e.nextBreak(t,i))<t.length;)i=r,n++;return i<t.length&&n++,n}}).call(this)},4396:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}function a(t,e,r){return e=c(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,s()?Reflect.construct(e,r||[],c(t).constructor):e.apply(t,r))}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(s=function(){return!!t})()}function u(t,e,r,n){var i=l(c(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}function l(){return l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=c(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},l.apply(null,arguments)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function f(t,e){return f=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},f(t,e)}var h=r(9609),d=r(9755),p=function(t){function e(t,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=a(this,e,[t]))._costumeResolution=1,n._renderer=r,n._textureSize=[0,0],n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f(t,e)}(e,t),r=e,o=[{key:"_getBitmapSize",value:function(t){return t instanceof HTMLImageElement?[t.naturalWidth||t.width,t.naturalHeight||t.height]:t instanceof HTMLVideoElement?[t.videoWidth||t.width,t.videoHeight||t.height]:[t.width,t.height]}}],(n=[{key:"dispose",value:function(){this._texture&&(this._renderer.gl.deleteTexture(this._texture),this._texture=null),u(e,"dispose",this,3)([])}},{key:"size",get:function(){return[this._textureSize[0]/this._costumeResolution,this._textureSize[1]/this._costumeResolution]}},{key:"getTexture",value:function(t){return this._texture||u(e,"getTexture",this,3)([])}},{key:"setBitmap",value:function(t,r,n){if(t.width&&t.height){var i=this._renderer.gl,o=t;if(t instanceof HTMLCanvasElement&&(o=t.getContext("2d").getImageData(0,0,t.width,t.height)),null===this._texture){var a={auto:!1,wrap:i.CLAMP_TO_EDGE};this._texture=h.createTexture(i,a)}this._setTexture(o),this._costumeResolution=r||2,this._textureSize=e._getBitmapSize(t),void 0===n&&(n=this.calculateRotationCenter()),this._rotationCenter[0]=n[0],this._rotationCenter[1]=n[1],this.emit(d.Events.WasAltered)}else u(e,"setEmptyImageData",this,3)([])}}])&&i(r.prototype,n),o&&i(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(d);t.exports=p},4434:t=>{"use strict";t.exports=require("events")},4465:t=>{t.exports={ID_NONE:-1,SKIN_SHARE_SOFT_LIMIT:301,Events:{NativeSizeChanged:"NativeSizeChanged"}}},4759:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}function u(t,e,r){return e=h(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],h(t).constructor):e.apply(t,r))}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function c(t,e,r,n){var i=f(h(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}function f(){return f="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=h(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},f.apply(null,arguments)}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var p=r(9609),m=r(9755),y=r(8620),b=y.loadSvgString,v=y.serializeSvgToString,g=r(6952),_=function(t){function e(t,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=u(this,e,[t]))._renderer=r,n._svgImage=document.createElement("img"),n._svgImageLoaded=!1,n._size=[0,0],n._canvas=document.createElement("canvas"),n._context=n._canvas.getContext("2d"),n._scaledMIPs=[],n._largestMIPScale=0,n._maxTextureScale=1,n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),r=e,n=[{key:"dispose",value:function(){this.resetMIPs(),c(e,"dispose",this,3)([])}},{key:"size",get:function(){return[this._size[0],this._size[1]]}},{key:"useNearest",value:function(t,e){return!(e.enabledEffects&(g.EFFECT_INFO.fisheye.mask|g.EFFECT_INFO.whirl.mask|g.EFFECT_INFO.pixelate.mask|g.EFFECT_INFO.mosaic.mask))&&e._direction%90==0&&Math.abs(t[0])>99&&Math.abs(t[0])<101&&Math.abs(t[1])>99&&Math.abs(t[1])<101}},{key:"createMIP",value:function(t){var r=i(this._size,2),n=r[0],o=r[1];if(this._canvas.width=n*t,this._canvas.height=o*t,this._canvas.width<=0||this._canvas.height<=0||this._svgImage.naturalWidth<=0||this._svgImage.naturalHeight<=0)return c(e,"getTexture",this,3)([]);this._context.clearRect(0,0,this._canvas.width,this._canvas.height),this._context.setTransform(t,0,0,t,0,0),this._context.drawImage(this._svgImage,0,0);var a=this._context.getImageData(0,0,this._canvas.width,this._canvas.height),s={auto:!1,wrap:this._renderer.gl.CLAMP_TO_EDGE,src:a,premultiplyAlpha:!0},u=p.createTexture(this._renderer.gl,s);return this._largestMIPScale<t&&(this._silhouette.update(a),this._largestMIPScale=t),u}},{key:"updateSilhouette",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(t)}},{key:"getTexture",value:function(t){var r=t?Math.max(Math.abs(t[0]),Math.abs(t[1])):100,n=Math.min(r/100,this._maxTextureScale),i=Math.max(Math.ceil(Math.log2(n))+8,0),o=Math.pow(2,i-8);return this._svgImageLoaded&&!this._scaledMIPs[i]&&(this._scaledMIPs[i]=this.createMIP(o)),this._scaledMIPs[i]||c(e,"getTexture",this,3)([])}},{key:"resetMIPs",value:function(){var t=this;this._scaledMIPs.forEach((function(e){return t._renderer.gl.deleteTexture(e)})),this._scaledMIPs.length=0,this._largestMIPScale=0}},{key:"setSVG",value:function(t,r){var n=this,i=b(t),o=v(i,!0);this._svgImageLoaded=!1;var a=i.viewBox.baseVal,s=a.x,u=a.y,l=a.width,f=a.height;this._size[0]=l,this._size[1]=f,this._svgImage.onload=function(){if(0!==l&&0!==f){for(var t=Math.ceil(Math.max(l,f)),i=2;t*i<=2048;i*=2)n._maxTextureScale=i;n.resetMIPs(),void 0===r&&(r=n.calculateRotationCenter()),n._rotationCenter[0]=r[0]-s,n._rotationCenter[1]=r[1]-u,n._svgImageLoaded=!0,n.emit(m.Events.WasAltered)}else c(e,"setEmptyImageData",n,3)([])},this._svgImage.src="data:image/svg+xml;utf8,".concat(encodeURIComponent(o))}}],n&&a(r.prototype,n),o&&a(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(m);t.exports=_},4932:(t,e,r)=>{var n=r(2491),i=r(8589),o=new n,a=Array.prototype.slice;(e=t.exports=function(t){var r=function(){return o.write(t,void 0,a.call(arguments)),r};return r.debug=function(){return o.write(t,"debug",a.call(arguments)),r},r.info=function(){return o.write(t,"info",a.call(arguments)),r},r.warn=function(){return o.write(t,"warn",a.call(arguments)),r},r.error=function(){return o.write(t,"error",a.call(arguments)),r},r.log=r.debug,r.suggest=e.suggest,r.format=o.format,r}).defaultBackend=e.defaultFormatter=null,e.pipe=function(t){return o.pipe(t)},e.end=e.unpipe=e.disable=function(t){return o.unpipe(t)},e.Transform=n,e.Filter=i,e.suggest=new i,e.enable=function(){return e.defaultFormatter?o.pipe(e.suggest).pipe(e.defaultFormatter).pipe(e.defaultBackend):o.pipe(e.suggest).pipe(e.defaultBackend)}},5012:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}var i,o=function(t,e){return e^(t^e)&t-e>>31},a=function(t,e){return t^(t^e)&t-e>>31},s=function(t,e,r){var n=t._width,i=t._height,o=t._colorData;return e>=n||r>=i||e<0||r<0?0:o[4*(r*n+e)+3]},u=[new Uint8ClampedArray(4),new Uint8ClampedArray(4),new Uint8ClampedArray(4),new Uint8ClampedArray(4)],l=function(t,e,r,n){var i=t._width,s=t._height,u=t._colorData;if(e=a(0,o(e,i-1)),r=a(0,o(r,s-1)),e>=i||r>=s||e<0||r<0)return n.fill(0);var l=4*(r*i+e),c=u[l+3]/255;return n[0]=u[l]*c,n[1]=u[l+1]*c,n[2]=u[l+2]*c,n[3]=u[l+3],n},c=function(t,e,r,n){var i=t._width,s=t._height,u=t._colorData;e=a(0,o(e,i-1));var l=4*((r=a(0,o(r,s-1)))*i+e);return n[0]=u[l],n[1]=u[l+1],n[2]=u[l+2],n[3]=u[l+3],n},f=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._width=0,this._height=0,this._colorData=null,this._getColor=l,this.colorAtNearest=this.colorAtLinear=function(t,e){return e.fill(0)}}return e=t,n=[{key:"update",value:function(e){var r,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(e instanceof ImageData)r=e,this._width=e.width,this._height=e.height;else{var i=t._updateCanvas(),o=this._width=i.width=e.width,a=this._height=i.height=e.height,s=i.getContext("2d");if(!o||!a)return;s.clearRect(0,0,o,a),s.drawImage(e,0,0,o,a),r=s.getImageData(0,0,o,a)}this._getColor=n?c:l,this._colorData=r.data,delete this.colorAtNearest,delete this.colorAtLinear}},{key:"colorAtNearest",value:function(t,e){return this._getColor(this,Math.floor(t[0]*(this._width-1)),Math.floor(t[1]*(this._height-1)),e)}},{key:"colorAtLinear",value:function(t,e){var r=t[0]*(this._width-1),n=t[1]*(this._height-1),i=r%1,o=n%1,a=1-i,s=1-o,l=Math.floor(r),c=Math.floor(n),f=this._getColor(this,l,c,u[0]),h=this._getColor(this,l+1,c,u[1]),d=this._getColor(this,l,c+1,u[2]),p=this._getColor(this,l+1,c+1,u[3]);return e[0]=f[0]*a*s+d[0]*a*o+h[0]*i*s+p[0]*i*o,e[1]=f[1]*a*s+d[1]*a*o+h[1]*i*s+p[1]*i*o,e[2]=f[2]*a*s+d[2]*a*o+h[2]*i*s+p[2]*i*o,e[3]=f[3]*a*s+d[3]*a*o+h[3]*i*s+p[3]*i*o,e}},{key:"isTouchingNearest",value:function(t){if(this._colorData)return s(this,Math.floor(t[0]*(this._width-1)),Math.floor(t[1]*(this._height-1)))>0}},{key:"isTouchingLinear",value:function(t){if(this._colorData){var e=Math.floor(t[0]*(this._width-1)),r=Math.floor(t[1]*(this._height-1));return s(this,e,r)>0||s(this,e+1,r)>0||s(this,e,r+1)>0||s(this,e+1,r+1)>0}}}],o=[{key:"_updateCanvas",value:function(){return void 0===i&&(i=document.createElement("canvas")),i}}],n&&r(e.prototype,n),o&&r(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}();t.exports=f},5214:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw a}}}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}function u(t,e,r){return e=f(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],f(t).constructor):e.apply(t,r))}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},c.apply(null,arguments)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}var d=r(9609),p=r(371),m=r(9332),y=r(9755),b=170,v=50,g=4,_=10,x=16,w=12,k="Helvetica",E=14,S=.9,A=16,T={BUBBLE_FILL:"white",BUBBLE_STROKE:"rgba(0, 0, 0, 0.15)",TEXT_FILL:"#575E75"},C=function(t){function e(t,r){var n;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=u(this,e,[t]))._renderer=r,n._canvas=document.createElement("canvas"),n._size=[0,0],n._renderedScale=0,n._lines=[],n._textAreaSize={width:0,height:0},n._bubbleType="",n._pointsLeft=!1,n._textDirty=!0,n._textureDirty=!0,n.measurementProvider=new m(n._canvas.getContext("2d")),n.textWrapper=new p(n.measurementProvider),n._restyleCanvas(),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(e,t),r=e,n=[{key:"dispose",value:function(){var t,r,n,i,o;this._texture&&(this._renderer.gl.deleteTexture(this._texture),this._texture=null),this._canvas=null,(t=e,r="dispose",n=this,o=c(f(1&(i=3)?t.prototype:t),r,n),2&i&&"function"==typeof o?function(t){return o.apply(n,t)}:o)([])}},{key:"size",get:function(){return this._textDirty&&this._reflowLines(),this._size}},{key:"setTextBubble",value:function(t,e,r){this._text=e,this._bubbleType=t,this._pointsLeft=r,this._textDirty=!0,this._textureDirty=!0,this.emit(y.Events.WasAltered)}},{key:"_restyleCanvas",value:function(){this._canvas.getContext("2d").font="".concat(E,"px ").concat(k,", sans-serif")}},{key:"_reflowLines",value:function(){this._lines=this.textWrapper.wrapText(b,this._text);var t,e=0,r=i(this._lines);try{for(r.s();!(t=r.n()).done;){var n=t.value;e=Math.max(e,this.measurementProvider.measureText(n))}}catch(t){r.e(t)}finally{r.f()}var o=Math.max(e,v)+2*_,a=A*this._lines.length+2*_;this._textAreaSize.width=o,this._textAreaSize.height=a,this._size[0]=o+g,this._size[1]=a+g+w,this._textDirty=!1}},{key:"_renderTextBubble",value:function(t){var e=this._canvas.getContext("2d");this._textDirty&&this._reflowLines();var r=this._textAreaSize.width,n=this._textAreaSize.height;this._canvas.width=Math.ceil(this._size[0]*t),this._canvas.height=Math.ceil(this._size[1]*t),this._restyleCanvas(),e.setTransform(1,0,0,1,0,0),e.clearRect(0,0,this._canvas.width,this._canvas.height),e.scale(t,t),e.translate(.5*g,.5*g),e.save(),this._pointsLeft&&(e.scale(-1,1),e.translate(-r,0)),e.beginPath(),e.moveTo(x,n),e.arcTo(0,n,0,n-x,x),e.arcTo(0,0,r,0,x),e.arcTo(r,0,r,n,x),e.arcTo(r,n,r-x,n,x),e.save(),e.translate(r-x,n),"say"===this._bubbleType?(e.bezierCurveTo(0,4,4,8,4,10),e.arcTo(4,12,2,12,2),e.bezierCurveTo(-1,12,-11,8,-16,0),e.closePath()):(e.arc(-16,0,4,0,Math.PI),e.closePath(),e.moveTo(-7,7.25),e.arc(-9.25,7.25,2.25,0,2*Math.PI),e.moveTo(0,9.5),e.arc(-1.5,9.5,1.5,0,2*Math.PI)),e.restore(),e.fillStyle=T.BUBBLE_FILL,e.strokeStyle=T.BUBBLE_STROKE,e.lineWidth=g,e.stroke(),e.fill(),e.restore(),e.fillStyle=T.TEXT_FILL,e.font="".concat(E,"px ").concat(k,", sans-serif");for(var i=this._lines,o=0;o<i.length;o++){var a=i[o];e.fillText(a,_,_+A*o+S*E)}this._renderedScale=t}},{key:"updateSilhouette",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[100,100];this.getTexture(t)}},{key:"getTexture",value:function(t){var e=(t?Math.max(Math.abs(t[0]),Math.abs(t[1])):100)/100;if(this._textureDirty||this._renderedScale!==e){this._renderTextBubble(e),this._textureDirty=!1;var r=this._canvas.getContext("2d").getImageData(0,0,this._canvas.width,this._canvas.height),n=this._renderer.gl;if(null===this._texture){var i={auto:!1,wrap:n.CLAMP_TO_EDGE};this._texture=d.createTexture(n,i)}this._setTexture(r)}return this._texture}}],n&&a(r.prototype,n),o&&a(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(y);t.exports=C},5837:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}var i=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.left=-1/0,this.right=1/0,this.bottom=-1/0,this.top=1/0}return e=t,i=[{key:"intersect",value:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t;return n.left=Math.max(e.left,r.left),n.right=Math.min(e.right,r.right),n.top=Math.min(e.top,r.top),n.bottom=Math.max(e.bottom,r.bottom),n}},{key:"union",value:function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new t;return n.left=Math.min(e.left,r.left),n.right=Math.max(e.right,r.right),n.top=Math.max(e.top,r.top),n.bottom=Math.min(e.bottom,r.bottom),n}}],(n=[{key:"initFromBounds",value:function(t,e,r,n){this.left=t,this.right=e,this.bottom=r,this.top=n}},{key:"initFromPointsAABB",value:function(t){this.left=1/0,this.right=-1/0,this.top=-1/0,this.bottom=1/0;for(var e=0;e<t.length;e++){var r=t[e][0],n=t[e][1];r<this.left&&(this.left=r),r>this.right&&(this.right=r),n>this.top&&(this.top=n),n<this.bottom&&(this.bottom=n)}}},{key:"initFromModelMatrix",value:function(t){var e=t[12],r=t[13],n=Math.abs(.5*t[0])+Math.abs(.5*t[4]),i=Math.abs(.5*t[1])+Math.abs(.5*t[5]);this.left=-n+e,this.right=n+e,this.top=i+r,this.bottom=-i+r}},{key:"intersects",value:function(t){return this.left<=t.right&&t.left<=this.right&&this.top>=t.bottom&&t.top>=this.bottom}},{key:"contains",value:function(t){return t.left>this.left&&t.right<this.right&&t.top<this.top&&t.bottom>this.bottom}},{key:"clamp",value:function(t,e,r,n){this.left=Math.max(this.left,t),this.right=Math.min(this.right,e),this.bottom=Math.max(this.bottom,r),this.top=Math.min(this.top,n),this.left=Math.min(this.left,e),this.right=Math.max(this.right,t),this.bottom=Math.min(this.bottom,n),this.top=Math.max(this.top,r)}},{key:"snapToInt",value:function(){this.left=Math.floor(this.left),this.right=Math.ceil(this.right),this.bottom=Math.floor(this.bottom),this.top=Math.ceil(this.top)}},{key:"width",get:function(){return Math.abs(this.left-this.right)}},{key:"height",get:function(){return Math.abs(this.top-this.bottom)}}])&&r(e.prototype,n),i&&r(e,i),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,i}();t.exports=i},6086:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,e)||function(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,s(n.key),n)}}function s(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}function u(t,e,r){return e=f(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,l()?Reflect.construct(e,r||[],f(t).constructor):e.apply(t,r))}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function c(){return c="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=f(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},c.apply(null,arguments)}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function h(t,e){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},h(t,e)}var d=r(9609),p=r(4465),m=r(9755),y=r(6952),b={color4f:[0,0,1,1],diameter:1},v=[0,0,0,0],g=function(t){function e(t,r){var n;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(n=u(this,e,[t]))._renderer=r,n._size=null,n._framebuffer=null,n._silhouetteDirty=!1,n._silhouettePixels=null,n._silhouetteImageData=null,n._lineOnBufferDrawRegionId={enter:function(){return n._enterDrawLineOnBuffer()},exit:function(){return n._exitDrawLineOnBuffer()}},n._usePenBufferDrawRegionId={enter:function(){return n._enterUsePenBuffer()},exit:function(){return n._exitUsePenBuffer()}},n._lineBufferInfo=d.createBufferInfoFromArrays(n._renderer.gl,{a_position:{numComponents:2,data:[1,0,0,0,1,1,1,1,0,0,0,1]}});return n._lineShader=n._renderer._shaderManager.getShader(y.DRAW_MODE.line,0),n.onNativeSizeChanged=n.onNativeSizeChanged.bind(n),n._renderer.on(p.Events.NativeSizeChanged,n.onNativeSizeChanged),n._setCanvasSize(r.getNativeSize()),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&h(t,e)}(e,t),r=e,n=[{key:"dispose",value:function(){var t,r,n,i,o;this._renderer.removeListener(p.Events.NativeSizeChanged,this.onNativeSizeChanged),this._renderer.gl.deleteTexture(this._texture),this._texture=null,(t=e,r="dispose",n=this,o=c(f(1&(i=3)?t.prototype:t),r,n),2&i&&"function"==typeof o?function(t){return o.apply(n,t)}:o)([])}},{key:"size",get:function(){return this._size}},{key:"useNearest",value:function(t){return Math.max(t[0],t[1])>=100}},{key:"getTexture",value:function(t){return this._texture}},{key:"clear",value:function(){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);var t=this._renderer.gl;t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),this._silhouetteDirty=!0}},{key:"drawPoint",value:function(t,e,r){this.drawLine(t,e,r,e,r)}},{key:"drawLine",value:function(t,e,r,n,i){var o=t.diameter||b.diameter,a=1===o||3===o?.5:0;this._drawLineOnBuffer(t,e+a,r+a,n+a,i+a),this._silhouetteDirty=!0}},{key:"_enterDrawLineOnBuffer",value:function(){var t=this._renderer.gl;d.bindFramebufferInfo(t,this._framebuffer),t.viewport(0,0,this._size[0],this._size[1]);var e=this._lineShader;t.useProgram(e.program),d.setBuffersAndAttributes(t,e,this._lineBufferInfo);var r={u_skin:this._texture,u_stageSize:this._size};d.setUniforms(e,r)}},{key:"_exitDrawLineOnBuffer",value:function(){var t=this._renderer.gl;d.bindFramebufferInfo(t,null)}},{key:"_enterUsePenBuffer",value:function(){d.bindFramebufferInfo(this._renderer.gl,this._framebuffer)}},{key:"_exitUsePenBuffer",value:function(){d.bindFramebufferInfo(this._renderer.gl,null)}},{key:"_drawLineOnBuffer",value:function(t,e,r,n,i){var o=this._renderer.gl,a=this._lineShader;this._renderer.enterDrawRegion(this._lineOnBufferDrawRegionId);var s=t.color4f||b.color4f;v[0]=s[0]*s[3],v[1]=s[1]*s[3],v[2]=s[2]*s[3],v[3]=s[3];var u=n-e,l=i-r,c=Math.sqrt(u*u+l*l),f={u_lineColor:v,u_lineThickness:t.diameter||b.diameter,u_lineLength:c,u_penPoints:[e,-r,u,-l]};d.setUniforms(a,f),d.drawBufferInfo(o,this._lineBufferInfo,o.TRIANGLES),this._silhouetteDirty=!0}},{key:"onNativeSizeChanged",value:function(t){this._setCanvasSize(t.newSize)}},{key:"_setCanvasSize",value:function(t){var e=i(t,2),r=e[0],n=e[1];this._size=t,this._rotationCenter[0]=r/2,this._rotationCenter[1]=n/2;var o=this._renderer.gl;this._texture=d.createTexture(o,{mag:o.NEAREST,min:o.NEAREST,wrap:o.CLAMP_TO_EDGE,width:r,height:n});var a=[{format:o.RGBA,attachment:this._texture}];this._framebuffer?d.resizeFramebufferInfo(o,this._framebuffer,a,r,n):this._framebuffer=d.createFramebufferInfo(o,a,r,n),o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT),this._silhouettePixels=new Uint8Array(Math.floor(r*n*4)),this._silhouetteImageData=new ImageData(r,n),this._silhouetteDirty=!0}},{key:"updateSilhouette",value:function(){if(this._silhouetteDirty){this._renderer.enterDrawRegion(this._usePenBufferDrawRegionId);var t=this._renderer.gl;t.readPixels(0,0,this._size[0],this._size[1],t.RGBA,t.UNSIGNED_BYTE,this._silhouettePixels),this._silhouetteImageData.data.set(this._silhouettePixels),this._silhouette.update(this._silhouetteImageData,!0),this._silhouetteDirty=!1}}}],n&&a(r.prototype,n),o&&a(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(m);t.exports=g},6093:(t,e,r)=>{function n(){}r(2491).mixin(n),n.prototype.write=function(t,e,r){var n={debug:"[34;40mdebug[39m ",info:"[32minfo[39m ",warn:"[30;41mWARN[0m ",error:"[31;40mERR![0m "};this.emit("item",(t?"[37;40m"+t+"[0m ":"")+(e&&n[e]?n[e]:"")+r.join(" "))},t.exports=n},6139:(t,e,r)=>{var n=r(2491),i=r(6770).i,o=r(9023);function a(){}n.mixin(a),a.prototype.write=function(t,e,r){var n;this.emit("item",i(("0"+(n=new Date).getDate()).slice(-2)+"-"+("0"+(n.getMonth()+1)).slice(-2)+"-"+n.getFullYear()+" "+("0"+n.getHours()).slice(-2)+":"+("0"+n.getMinutes()).slice(-2)+":"+("0"+n.getSeconds()).slice(-2)+"."+("00"+n.getMilliseconds()).slice(-3)+" ","grey")+(t?i(t+" ","grey"):"")+(e?i(e,{debug:"blue",info:"cyan",warn:"yellow",error:"red"}[e])+" ":"")+r.map((function(t){return"string"==typeof t?t:o.inspect(t,null,3,!0)})).join(" "))},t.exports=a},6276:(t,e,r)=>{var n=r(9593);t.exports=n},6770:(t,e)=>{var r={bold:["[1m","[22m"],italic:["[3m","[23m"],underline:["[4m","[24m"],inverse:["[7m","[27m"],white:["[37m","[39m"],grey:["[90m","[39m"],black:["[30m","[39m"],blue:["[34m","[39m"],cyan:["[36m","[39m"],green:["[32m","[39m"],magenta:["[35m","[39m"],red:["[31m","[39m"],yellow:["[33m","[39m"]};e.R={debug:1,info:2,warn:3,error:4},e.i=function(t,e){return r[e][0]+t+r[e][1]}},6952:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}var a=r(9609),s=function(){function t(e){for(var r in function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._gl=e,this._shaderCache={},t.DRAW_MODE)Object.prototype.hasOwnProperty.call(t.DRAW_MODE,r)&&(this._shaderCache[r]=[])}return e=t,(n=[{key:"getShader",value:function(e,r){var n=this._shaderCache[e];e===t.DRAW_MODE.silhouette&&(r&=~(t.EFFECT_INFO.color.mask|t.EFFECT_INFO.brightness.mask));var i=n[r];return i||(i=n[r]=this._buildShader(e,r)),i}},{key:"_buildShader",value:function(e,n){for(var i=t.EFFECTS.length,o=["#define DRAW_MODE_".concat(e)],s=0;s<i;++s)n&1<<s&&o.push("#define ENABLE_".concat(t.EFFECTS[s]));var u="".concat(o.join("\n"),"\n"),l=u+r(4129),c=u+r(9564);return a.createProgramInfo(this._gl,[l,c])}}])&&i(e.prototype,n),o&&i(e,o),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,n,o}();s.EFFECT_INFO={color:{uniformName:"u_color",mask:1,converter:function(t){return t/200%1},shapeChanges:!1},fisheye:{uniformName:"u_fisheye",mask:2,converter:function(t){return Math.max(0,(t+100)/100)},shapeChanges:!0},whirl:{uniformName:"u_whirl",mask:4,converter:function(t){return-t*Math.PI/180},shapeChanges:!0},pixelate:{uniformName:"u_pixelate",mask:8,converter:function(t){return Math.abs(t)/10},shapeChanges:!0},mosaic:{uniformName:"u_mosaic",mask:16,converter:function(t){return t=Math.round((Math.abs(t)+10)/10),Math.max(1,Math.min(t,512))},shapeChanges:!0},brightness:{uniformName:"u_brightness",mask:32,converter:function(t){return Math.max(-100,Math.min(t,100))/100},shapeChanges:!1},ghost:{uniformName:"u_ghost",mask:64,converter:function(t){return 1-Math.max(0,Math.min(t,100))/100},shapeChanges:!1}},s.EFFECTS=Object.keys(s.EFFECT_INFO),s.DRAW_MODE={default:"default",straightAlpha:"straightAlpha",silhouette:"silhouette",colorMask:"colorMask",line:"line",background:"background"},t.exports=s},7397:(t,e,r)=>{t.exports=r(4932);var n=r(2859);"undefined"!=typeof window&&window.process&&"renderer"===window.process.type&&(n=r(9925).minilog),t.exports.Stringifier=r(9403);var i=t.exports.pipe;t.exports.pipe=function(e){return e instanceof r(2203)?i.call(t.exports,new t.exports.Stringifier).pipe(e):i.call(t.exports,e)},t.exports.defaultBackend=n,t.exports.defaultFormatter=n.formatMinilog,t.exports.backends={redis:r(4373),nodeConsole:n,console:n}},7602:function(t,e,r){(function(){var e,n,i,o,a,s,u,l,c,f,h,d,p,m,y,b,v,g,_,x,w,k,E,S,A,T,C;_=r(800),k=r(4100),T=r(2758),T.BK,c=T.CR,T.LF,T.NL,a=T.CB,i=T.BA,T.SP,x=T.WJ,g=T.SP,o=T.BK,d=T.LF,m=T.NL,e=T.AI,n=T.AL,b=T.SA,v=T.SG,w=T.XX,u=T.CJ,T.ID,y=T.NS,T.characterClasses,C=r(2915),f=C.DI_BRK,h=C.IN_BRK,s=C.CI_BRK,l=C.CP_BRK,C.PR_BRK,A=C.pairTable,S=k.toByteArray("AA4IAAAAAAAAAhqg5VV7NJtZvz7fTC8zU5deplUlMrQoWqmqahD5So0aipYWrUhVFSVBQ10iSTtUtW6nKDVF6k7d75eQfEUbFcQ9KiFS90tQEolcP23nrLPmO+esr/+f39rr/a293t/e7/P8nmfvlz0O6RvrBJADtbBNaD88IOKTOmOrCqhu9zE770vc1pBV/xL5dxj2V7Zj4FGSomFKStCWNlV7hG1VabZfZ1LaHbFrRwzzLjzPoi1UHDnlV/lWbhgIIJvLBp/pu7AHEdRnIY+ROdXxg4fNpMdTxVnnm08OjozejAVsBqwqz8kddGRlRxsd8c55dNZoPuex6a7Dt6L0NNb03sqgTlR2/OT7eTt0Y0WnpUXxLsp5SMANc4DsmX4zJUBQvznwexm9tsMH+C9uRYMPOd96ZHB29NZjCIM2nfO7tsmQveX3l2r7ft0N4/SRJ7kO6Y8ZCaeuUQ4gMTZ67cp7TgxvlNDsPgOBdZi2YTam5Q7m3+00l+XG7PrDe6YoPmHgK+yLih7fAR16ZFCeD9WvOVt+gfNW/KT5/M6rb/9KERt+N1lad5RneVjzxXHsLofuU+TvrEsr3+26sVz5WJh6L/svoPK3qepFH9bysDljWtD1F7KrxzW1i9r+e/NLxV/acts7zuo304J9+t3Pd6Y6u8f3EAqxNRgv5DZjaI3unyvkvHPya/v3mWVYOC38qBq11+yHZ2bAyP1HbkV92vdno7r2lxz9UwCdCJVfd14NLcpO2CadHS/XPJ9doXgz5vLv/1OBVS3gX0D9n6LiNIDfpilO9RsLgZ2W/wIy8W/Rh93jfoz4qmRV2xElv6p2lRXQdO6/Cv8f5nGn3u0wLXjhnvClabL1o+7yvIpvLfT/xsKG30y/sTvq30ia9Czxp9dr9v/e7Yn/O0QJXxxBOJmceP/DBFa1q1v6oudn/e6qc/37dUoNvnYL4plQ9OoneYOh/r8fOFm7yl7FETHY9dXd5K2n/qEc53dOEe1TTJcvCfp1dpTC334l0vyaFL6mttNEbFjzO+ZV2mLk0qc3BrxJ4d9gweMmjRorxb7vic0rSq6D4wzAyFWas1TqPE0sLI8XLAryC8tPChaN3ALEZSWmtB34SyZcxXYn/E4Tg0LeMIPhgPKD9zyHGMxxhxnDDih7eI86xECTM8zodUCdgffUmRh4rQ8zyA6ow/Aei+01a8OMfziQQ+GAEkhwN/cqUFYAVzA9ex4n6jgtsiMvXf5BtXxEU4hSphvx3v8+9au8eEekEEpkrkne/zB1M+HAPuXIz3paxKlfe8aDMfGWAX6Md6PuuAdKHFVH++Ed5LEji94Z5zeiJIxbmWeN7rr1/ZcaBl5/nimdHsHgIH/ssyLUXZ4fDQ46HnBb+hQqG8yNiKRrXL/b1IPYDUsu3dFKtRMcjqlRvONd4xBvOufx2cUHuk8pmG1D7PyOQmUmluisVFS9OWS8fPIe8LiCtjwJKnEC9hrS9uKmISI3Wa5+vdXUG9dtyfr7g/oJv2wbzeZU838G6mEvntUb3SVV/fBZ6H/sL+lElzeRrHy2Xbe7UWX1q5sgOQ81rv+2baej4fP4m5Mf/GkoxfDtT3++KP7do9Jn26aa6xAhCf5L9RZVfkWKCcjI1eYbm2plvTEqkDxKC402bGzXCYaGnuALHabBT1dFLuOSB7RorOPEhZah1NjZIgR/UFGfK3p1ElYnevOMBDLURdpIjrI+qZk4sffGbRFiXuEmdFjiAODlQCJvIaB1rW61Ljg3y4eS4LAcSgDxxZQs0DYa15wA032Z+lGUfpoyOrFo3mg1sRQtN/fHHCx3TrM8eTrldMbYisDLXbUDoXMLejSq0fUNuO1muX0gEa8vgyegkqiqqbC3W0S4cC9Kmt8MuS/hFO7Xei3f8rSvIjeveMM7kxjUixOrl6gJshe4JU7PhOHpfrRYvu7yoAZKa3Buyk2J+K5W+nNTz1nhJDhRUfDJLiUXxjxXCJeeaOe/r7HlBP/uURc/5efaZEPxr55Qj39rfTLkugUGyMrwo7HAglfEjDriehF1jXtwJkPoiYkYQ5aoXSA7qbCBGKq5hwtu2VkpI9xVDop/1xrC52eiIvCoPWx4lLl40jm9upvycVPfpaH9/o2D4xKXpeNjE2HPQRS+3RFaYTc4Txw7Dvq5X6JBRwzs9mvoB49BK6b+XgsZVJYiInTlSXZ+62FT18mkFVcPKCJsoF5ahb19WheZLUYsSwdrrVM3aQ2XE6SzU2xHDS6iWkodk5AF6F8WUNmmushi8aVpMPwiIfEiQWo3CApONDRjrhDiVnkaFsaP5rjIJkmsN6V26li5LNM3JxGSyKgomknTyyrhcnwv9Qcqaq5utAh44W30SWo8Q0XHKR0glPF4fWst1FUCnk2woFq3iy9fAbzcjJ8fvSjgKVOfn14RDqyQuIgaGJZuswTywdCFSa89SakMf6fe+9KaQMYQlKxiJBczuPSho4wmBjdA+ag6QUOr2GdpcbSl51Ay6khhBt5UXdrnxc7ZGMxCvz96A4oLocxh2+px+1zkyLacCGrxnPzTRSgrLKpStFpH5ppKWm7PgMKZtwgytKLOjbGCOQLTm+KOowqa1sdut9raj1CZFkZD0jbaKNLpJUarSH5Qknx1YiOxdA5L6d5sfI/unmkSF65Ic/AvtXt98Pnrdwl5vgppQ3dYzWFwknZsy6xh2llmLxpegF8ayLwniknlXRHiF4hzzrgB8jQ4wdIqcaHCEAxyJwCeGkXPBZYSrrGa4vMwZvNN9aK0F4JBOK9mQ8g8EjEbIQVwvfS2D8GuCYsdqwqSWbQrfWdTRUJMqmpnWPax4Z7E137I6brHbvjpPlfNZpF1d7PP7HB/MPHcHVKTMhLO4f3CZcaccZEOiS2DpKiQB5KXDJ+Ospcz4qTRCRxgrKEQIgUkKLTKKwskdx2DWo3bg3PEoB5h2nA24olwfKSR+QR6TAvEDi/0czhUT59RZmO1MGeKGeEfuOSPWfL+XKmhqpZmOVR9mJVNDPKOS49Lq+Um10YsBybzDMtemlPCOJEtE8zaXhsaqEs9bngSJGhlOTTMlCXly9Qv5cRN3PVLK7zoMptutf7ihutrQ/Xj7VqeCdUwleTTKklOI8Wep9h7fCY0kVtDtIWKnubWAvbNZtsRRqOYl802vebPEkZRSZc6wXOfPtpPtN5HI63EUFfsy7U/TLr8NkIzaY3vx4A28x765XZMzRZTpMk81YIMuwJ5+/zoCuZj1wGnaHObxa5rpKZj4WhT670maRw04w0e3cZW74Z0aZe2n05hjZaxm6urenz8Ef5O6Yu1J2aqYAlqsCXs5ZB5o1JJ5l3xkTVr8rJQ09NLsBqRRDT2IIjOPmcJa6xQ1R5yGP9jAsj23xYDTezdyqG8YWZ7vJBIWK56K+iDgcHimiQOTIasNSua1fOBxsKMMEKd15jxTl+3CyvGCR+UyRwuSI2XuwRIPoNNclPihfJhaq2mKkNijwYLY6feqohktukmI3KDvOpN7ItCqHHhNuKlxMfBAEO5LjW2RKh6lE5Hd1dtAOopac/Z4FdsNsjMhXz/ug8JGmbVJTA+VOBJXdrYyJcIn5+OEeoK8kWEWF+wdG8ZtZHKSquWDtDVyhFPkRVqguKFkLkKCz46hcU1SUY9oJ2Sk+dmq0kglqk4kqKT1CV9JDELPjK1WsWGkEXF87g9P98e5ff0mIupm/w6vc3kCeq04X5bgJQlcMFRjlFWmSk+kssXCAVikfeAlMuzpUvCSdXiG+dc6KrIiLxxhbEVuKf7vW7KmDQI95bZe3H9mN3/77F6fZ2Yx/F9yClllj8gXpLWLpd5+v90iOaFa9sd7Pvx0lNa1o1+bkiZ69wCiC2x9UIb6/boBCuNMB/HYR0RC6+FD9Oe5qrgQl6JbXtkaYn0wkdNhROLqyhv6cKvyMj1Fvs2o3OOKoMYTubGENLfY5F6H9d8wX1cnINsvz+wZFQu3zhWVlwJvwBEp69Dqu/ZnkBf3nIfbx4TK7zOVJH5sGJX+IMwkn1vVBn38GbpTg9bJnMcTOb5F6Ci5gOn9Fcy6Qzcu+FL6mYJJ+f2ZZJGda1VqruZ0JRXItp8X0aTjIcJgzdaXlha7q7kV4ebrMsunfsRyRa9qYuryBHA0hc1KVsKdE+oI0ljLmSAyMze8lWmc5/lQ18slyTVC/vADTc+SNM5++gztTBLz4m0aVUKcfgOEExuKVomJ7XQDZuziMDjG6JP9tgR7JXZTeo9RGetW/Xm9/TgPJpTgHACPOGvmy2mDm9fl09WeMm9sQUAXP3Su2uApeCwJVT5iWCXDgmcuTsFgU9Nm6/PusJzSbDQIMfl6INY/OAEvZRN54BSSXUClM51im6Wn9VhVamKJmzOaFJErgJcs0etFZ40LIF3EPkjFTjGmAhsd174NnOwJW8TdJ1Dja+E6Wa6FVS22Haj1DDA474EesoMP5nbspAPJLWJ8rYcP1DwCslhnn+gTFm+sS9wY+U6SogAa9tiwpoxuaFeqm2OK+uozR6SfiLCOPz36LiDlzXr6UWd7BpY6mlrNANkTOeme5EgnnAkQRTGo9T6iYxbUKfGJcI9B+ub2PcyUOgpwXbOf3bHFWtygD7FYbRhb+vkzi87dB0JeXl/vBpBUz93VtqZi7AL7C1VowTF+tGmyurw7DBcktc+UMY0E10Jw4URojf8NdaNpN6E1q4+Oz+4YePtMLy8FPRP"),E=new _(S),p=function(){var t,r,p;function _(t){this.string=t,this.pos=0,this.lastPos=0,this.curClass=null,this.nextClass=null}return _.prototype.nextCodePoint=function(){var t,e;return t=this.string.charCodeAt(this.pos++),e=this.string.charCodeAt(this.pos),55296<=t&&t<=56319&&56320<=e&&e<=57343?(this.pos++,1024*(t-55296)+(e-56320)+65536):t},r=function(t){switch(t){case e:case b:case v:case w:return n;case u:return y;default:return t}},p=function(t){switch(t){case d:case m:return o;case a:return i;case g:return x;default:return t}},_.prototype.nextCharClass=function(t){return null==t&&(t=!1),r(E.get(this.nextCodePoint()))},t=function(t,e){this.position=t,this.required=null!=e&&e},_.prototype.nextBreak=function(){var e,n,u;for(null==this.curClass&&(this.curClass=p(this.nextCharClass()));this.pos<this.string.length;){if(this.lastPos=this.pos,n=this.nextClass,this.nextClass=this.nextCharClass(),this.curClass===o||this.curClass===c&&this.nextClass!==d)return this.curClass=p(r(this.nextClass)),new t(this.lastPos,!0);if(null==(e=function(){switch(this.nextClass){case g:return this.curClass;case o:case d:case m:return o;case c:return c;case a:return i}}.call(this))){switch(u=!1,A[this.curClass][this.nextClass]){case f:u=!0;break;case h:u=n===g;break;case s:if(!(u=n===g))continue;break;case l:if(n!==g)continue}if(this.curClass=this.nextClass,u)return new t(this.lastPos)}else if(this.curClass=e,this.nextClass===a)return new t(this.lastPos)}if(this.pos>=this.string.length)return this.lastPos<this.string.length?(this.lastPos=this.string.length,new t(this.string.length)):null},_}(),t.exports=p}).call(this)},7694:t=>{var e=0,r=-3;function n(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function i(t,e){this.source=t,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=e,this.destLen=0,this.ltree=new n,this.dtree=new n}var o=new n,a=new n,s=new Uint8Array(30),u=new Uint16Array(30),l=new Uint8Array(30),c=new Uint16Array(30),f=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),h=new n,d=new Uint8Array(320);function p(t,e,r,n){var i,o;for(i=0;i<r;++i)t[i]=0;for(i=0;i<30-r;++i)t[i+r]=i/r|0;for(o=n,i=0;i<30;++i)e[i]=o,o+=1<<t[i]}var m=new Uint16Array(16);function y(t,e,r,n){var i,o;for(i=0;i<16;++i)t.table[i]=0;for(i=0;i<n;++i)t.table[e[r+i]]++;for(t.table[0]=0,o=0,i=0;i<16;++i)m[i]=o,o+=t.table[i];for(i=0;i<n;++i)e[r+i]&&(t.trans[m[e[r+i]]++]=i)}function b(t){t.bitcount--||(t.tag=t.source[t.sourceIndex++],t.bitcount=7);var e=1&t.tag;return t.tag>>>=1,e}function v(t,e,r){if(!e)return r;for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var n=t.tag&65535>>>16-e;return t.tag>>>=e,t.bitcount-=e,n+r}function g(t,e){for(;t.bitcount<24;)t.tag|=t.source[t.sourceIndex++]<<t.bitcount,t.bitcount+=8;var r=0,n=0,i=0,o=t.tag;do{n=2*n+(1&o),o>>>=1,++i,r+=e.table[i],n-=e.table[i]}while(n>=0);return t.tag=o,t.bitcount-=i,e.trans[r+n]}function _(t,e,r){var n,i,o,a,s,u;for(n=v(t,5,257),i=v(t,5,1),o=v(t,4,4),a=0;a<19;++a)d[a]=0;for(a=0;a<o;++a){var l=v(t,3,0);d[f[a]]=l}for(y(h,d,0,19),s=0;s<n+i;){var c=g(t,h);switch(c){case 16:var p=d[s-1];for(u=v(t,2,3);u;--u)d[s++]=p;break;case 17:for(u=v(t,3,3);u;--u)d[s++]=0;break;case 18:for(u=v(t,7,11);u;--u)d[s++]=0;break;default:d[s++]=c}}y(e,d,0,n),y(r,d,n,i)}function x(t,r,n){for(;;){var i,o,a,f,h=g(t,r);if(256===h)return e;if(h<256)t.dest[t.destLen++]=h;else for(i=v(t,s[h-=257],u[h]),o=g(t,n),f=a=t.destLen-v(t,l[o],c[o]);f<a+i;++f)t.dest[t.destLen++]=t.dest[f]}}function w(t){for(var n,i;t.bitcount>8;)t.sourceIndex--,t.bitcount-=8;if((n=256*(n=t.source[t.sourceIndex+1])+t.source[t.sourceIndex])!==(65535&~(256*t.source[t.sourceIndex+3]+t.source[t.sourceIndex+2])))return r;for(t.sourceIndex+=4,i=n;i;--i)t.dest[t.destLen++]=t.source[t.sourceIndex++];return t.bitcount=0,e}!function(t,e){var r;for(r=0;r<7;++r)t.table[r]=0;for(t.table[7]=24,t.table[8]=152,t.table[9]=112,r=0;r<24;++r)t.trans[r]=256+r;for(r=0;r<144;++r)t.trans[24+r]=r;for(r=0;r<8;++r)t.trans[168+r]=280+r;for(r=0;r<112;++r)t.trans[176+r]=144+r;for(r=0;r<5;++r)e.table[r]=0;for(e.table[5]=32,r=0;r<32;++r)e.trans[r]=r}(o,a),p(s,u,4,3),p(l,c,2,1),s[28]=0,u[28]=258,t.exports=function(t,n){var s,u,l=new i(t,n);do{switch(s=b(l),v(l,2,0)){case 0:u=w(l);break;case 1:u=x(l,o,a);break;case 2:_(l,l.ltree,l.dtree),u=x(l,l.ltree,l.dtree);break;default:u=r}if(u!==e)throw new Error("Data error")}while(!s);return l.destLen<l.dest.length?"function"==typeof l.dest.slice?l.dest.slice(0,l.destLen):l.dest.subarray(0,l.destLen):l.dest}},8589:(t,e,r)=>{var n=r(2491),i={debug:1,info:2,warn:3,error:4};function o(){this.enabled=!0,this.defaultResult=!0,this.clear()}function a(t,e){return t.n.test?t.n.test(e):t.n==e}n.mixin(o),o.prototype.allow=function(t,e){return this._white.push({n:t,l:i[e]}),this},o.prototype.deny=function(t,e){return this._black.push({n:t,l:i[e]}),this},o.prototype.clear=function(){return this._white=[],this._black=[],this},o.prototype.test=function(t,e){var r,n=Math.max(this._white.length,this._black.length);for(r=0;r<n;r++){if(this._white[r]&&a(this._white[r],t)&&i[e]>=this._white[r].l)return!0;if(this._black[r]&&a(this._black[r],t)&&i[e]<=this._black[r].l)return!1}return this.defaultResult},o.prototype.write=function(t,e,r){if(!this.enabled||this.test(t,e))return this.emit("item",t,e,r)},t.exports=o},8620:t=>{"use strict";t.exports=require("@scratch/scratch-svg-renderer")},8734:t=>{function e(t,e,r,n,i,o){var a=(o-e)*(r-t)-(n-e)*(i-t);return a>0||!(a<0)}t.exports=function(t,r){var n=t[0][0],i=t[0][1],o=t[1][0],a=t[1][1],s=r[0][0],u=r[0][1],l=r[1][0],c=r[1][1];return e(n,i,s,u,l,c)!==e(o,a,s,u,l,c)&&e(n,i,o,a,s,u)!==e(n,i,o,a,l,c)}},8933:(t,e,r)=>{var n=r(2491),i=r(2216),o={debug:["gray"],info:["purple"],warn:["yellow",!0],error:["red",!0]},a=new n;a.write=function(t,e,r){var n=console.log;"debug"!=e&&console[e]&&(n=console[e]);var a=0;if("info"!=e){for(;a<r.length&&"string"==typeof r[a];a++);n.apply(console,["%c"+t+" "+r.slice(0,a).join(" "),i.apply(i,o[e])].concat(r.slice(a)))}else n.apply(console,["%c"+t,i.apply(i,o[e])].concat(r))},a.pipe=function(){},t.exports=a},9023:t=>{"use strict";t.exports=require("util")},9332:t=>{function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function r(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,r||"default");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}var i=function(){return t=function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._ctx=e,this._cache={}},(e=[{key:"beginMeasurementSession",value:function(){}},{key:"endMeasurementSession",value:function(){}},{key:"measureText",value:function(t){return this._cache[t]||(this._cache[t]=this._ctx.measureText(t).width),this._cache[t]}}])&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e,n}();t.exports=i},9403:(t,e,r)=>{function n(){}r(2491).mixin(n),n.prototype.write=function(t,e,r){var n=[];t&&n.push(t),e&&n.push(e),n=n.concat(r);for(var i=0;i<n.length;i++)if(n[i]&&"object"==typeof n[i])if(n[i].constructor&&n[i].constructor.isBuffer)n[i]=n[i].toString();else try{n[i]=JSON.stringify(n[i])}catch(t){}else n[i]=n[i];this.emit("item",n.join(" ")+"\n")},t.exports=n},9564:t=>{t.exports='precision mediump float;\n\n#ifdef DRAW_MODE_silhouette\nuniform vec4 u_silhouetteColor;\n#else // DRAW_MODE_silhouette\n# ifdef ENABLE_color\nuniform float u_color;\n# endif // ENABLE_color\n# ifdef ENABLE_brightness\nuniform float u_brightness;\n# endif // ENABLE_brightness\n#endif // DRAW_MODE_silhouette\n\n#ifdef DRAW_MODE_colorMask\nuniform vec3 u_colorMask;\nuniform float u_colorMaskTolerance;\n#endif // DRAW_MODE_colorMask\n\n#ifdef ENABLE_fisheye\nuniform float u_fisheye;\n#endif // ENABLE_fisheye\n#ifdef ENABLE_whirl\nuniform float u_whirl;\n#endif // ENABLE_whirl\n#ifdef ENABLE_pixelate\nuniform float u_pixelate;\nuniform vec2 u_skinSize;\n#endif // ENABLE_pixelate\n#ifdef ENABLE_mosaic\nuniform float u_mosaic;\n#endif // ENABLE_mosaic\n#ifdef ENABLE_ghost\nuniform float u_ghost;\n#endif // ENABLE_ghost\n\n#ifdef DRAW_MODE_line\nuniform vec4 u_lineColor;\nuniform float u_lineThickness;\nuniform float u_lineLength;\n#endif // DRAW_MODE_line\n\n#ifdef DRAW_MODE_background\nuniform vec4 u_backgroundColor;\n#endif // DRAW_MODE_background\n\nuniform sampler2D u_skin;\n\n#ifndef DRAW_MODE_background\nvarying vec2 v_texCoord;\n#endif\n\n// Add this to divisors to prevent division by 0, which results in NaNs propagating through calculations.\n// Smaller values can cause problems on some mobile devices.\nconst float epsilon = 1e-3;\n\n#if !defined(DRAW_MODE_silhouette) && (defined(ENABLE_color))\n// Branchless color conversions based on code from:\n// http://www.chilliant.com/rgb2hsv.html by Ian Taylor\n// Based in part on work by Sam Hocevar and Emil Persson\n// See also: https://en.wikipedia.org/wiki/HSL_and_HSV#Formal_derivation\n\n\n// Convert an RGB color to Hue, Saturation, and Value.\n// All components of input and output are expected to be in the [0,1] range.\nvec3 convertRGB2HSV(vec3 rgb)\n{\n\t// Hue calculation has 3 cases, depending on which RGB component is largest, and one of those cases involves a "mod"\n\t// operation. In order to avoid that "mod" we split the M==R case in two: one for G<B and one for B>G. The B>G case\n\t// will be calculated in the negative and fed through abs() in the hue calculation at the end.\n\t// See also: https://en.wikipedia.org/wiki/HSL_and_HSV#Hue_and_chroma\n\tconst vec4 hueOffsets = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n\n\t// temp1.xy = sort B & G (largest first)\n\t// temp1.z = the hue offset we\'ll use if it turns out that R is the largest component (M==R)\n\t// temp1.w = the hue offset we\'ll use if it turns out that R is not the largest component (M==G or M==B)\n\tvec4 temp1 = rgb.b > rgb.g ? vec4(rgb.bg, hueOffsets.wz) : vec4(rgb.gb, hueOffsets.xy);\n\n\t// temp2.x = the largest component of RGB ("M" / "Max")\n\t// temp2.yw = the smaller components of RGB, ordered for the hue calculation (not necessarily sorted by magnitude!)\n\t// temp2.z = the hue offset we\'ll use in the hue calculation\n\tvec4 temp2 = rgb.r > temp1.x ? vec4(rgb.r, temp1.yzx) : vec4(temp1.xyw, rgb.r);\n\n\t// m = the smallest component of RGB ("min")\n\tfloat m = min(temp2.y, temp2.w);\n\n\t// Chroma = M - m\n\tfloat C = temp2.x - m;\n\n\t// Value = M\n\tfloat V = temp2.x;\n\n\treturn vec3(\n\t\tabs(temp2.z + (temp2.w - temp2.y) / (6.0 * C + epsilon)), // Hue\n\t\tC / (temp2.x + epsilon), // Saturation\n\t\tV); // Value\n}\n\nvec3 convertHue2RGB(float hue)\n{\n\tfloat r = abs(hue * 6.0 - 3.0) - 1.0;\n\tfloat g = 2.0 - abs(hue * 6.0 - 2.0);\n\tfloat b = 2.0 - abs(hue * 6.0 - 4.0);\n\treturn clamp(vec3(r, g, b), 0.0, 1.0);\n}\n\nvec3 convertHSV2RGB(vec3 hsv)\n{\n\tvec3 rgb = convertHue2RGB(hsv.x);\n\tfloat c = hsv.z * hsv.y;\n\treturn rgb * c + hsv.z - c;\n}\n#endif // !defined(DRAW_MODE_silhouette) && (defined(ENABLE_color))\n\nconst vec2 kCenter = vec2(0.5, 0.5);\n\nvoid main()\n{\n\t#if !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\n\tvec2 texcoord0 = v_texCoord;\n\n\t#ifdef ENABLE_mosaic\n\ttexcoord0 = fract(u_mosaic * texcoord0);\n\t#endif // ENABLE_mosaic\n\n\t#ifdef ENABLE_pixelate\n\t{\n\t\t// TODO: clean up "pixel" edges\n\t\tvec2 pixelTexelSize = u_skinSize / u_pixelate;\n\t\ttexcoord0 = (floor(texcoord0 * pixelTexelSize) + kCenter) / pixelTexelSize;\n\t}\n\t#endif // ENABLE_pixelate\n\n\t#ifdef ENABLE_whirl\n\t{\n\t\tconst float kRadius = 0.5;\n\t\tvec2 offset = texcoord0 - kCenter;\n\t\tfloat offsetMagnitude = length(offset);\n\t\tfloat whirlFactor = max(1.0 - (offsetMagnitude / kRadius), 0.0);\n\t\tfloat whirlActual = u_whirl * whirlFactor * whirlFactor;\n\t\tfloat sinWhirl = sin(whirlActual);\n\t\tfloat cosWhirl = cos(whirlActual);\n\t\tmat2 rotationMatrix = mat2(\n\t\t\tcosWhirl, -sinWhirl,\n\t\t\tsinWhirl, cosWhirl\n\t\t);\n\n\t\ttexcoord0 = rotationMatrix * offset + kCenter;\n\t}\n\t#endif // ENABLE_whirl\n\n\t#ifdef ENABLE_fisheye\n\t{\n\t\tvec2 vec = (texcoord0 - kCenter) / kCenter;\n\t\tfloat vecLength = length(vec);\n\t\tfloat r = pow(min(vecLength, 1.0), u_fisheye) * max(1.0, vecLength);\n\t\tvec2 unit = vec / vecLength;\n\n\t\ttexcoord0 = kCenter + r * unit * kCenter;\n\t}\n\t#endif // ENABLE_fisheye\n\n\tgl_FragColor = texture2D(u_skin, texcoord0);\n\n\t#if defined(ENABLE_color) || defined(ENABLE_brightness)\n\t// Divide premultiplied alpha values for proper color processing\n\t// Add epsilon to avoid dividing by 0 for fully transparent pixels\n\tgl_FragColor.rgb = clamp(gl_FragColor.rgb / (gl_FragColor.a + epsilon), 0.0, 1.0);\n\n\t#ifdef ENABLE_color\n\t{\n\t\tvec3 hsv = convertRGB2HSV(gl_FragColor.xyz);\n\n\t\t// this code forces grayscale values to be slightly saturated\n\t\t// so that some slight change of hue will be visible\n\t\tconst float minLightness = 0.11 / 2.0;\n\t\tconst float minSaturation = 0.09;\n\t\tif (hsv.z < minLightness) hsv = vec3(0.0, 1.0, minLightness);\n\t\telse if (hsv.y < minSaturation) hsv = vec3(0.0, minSaturation, hsv.z);\n\n\t\thsv.x = mod(hsv.x + u_color, 1.0);\n\t\tif (hsv.x < 0.0) hsv.x += 1.0;\n\n\t\tgl_FragColor.rgb = convertHSV2RGB(hsv);\n\t}\n\t#endif // ENABLE_color\n\n\t#ifdef ENABLE_brightness\n\tgl_FragColor.rgb = clamp(gl_FragColor.rgb + vec3(u_brightness), vec3(0), vec3(1));\n\t#endif // ENABLE_brightness\n\n\t// Re-multiply color values\n\tgl_FragColor.rgb *= gl_FragColor.a + epsilon;\n\n\t#endif // defined(ENABLE_color) || defined(ENABLE_brightness)\n\n\t#ifdef ENABLE_ghost\n\tgl_FragColor *= u_ghost;\n\t#endif // ENABLE_ghost\n\n\t#ifdef DRAW_MODE_silhouette\n\t// Discard fully transparent pixels for stencil test\n\tif (gl_FragColor.a == 0.0) {\n\t\tdiscard;\n\t}\n\t// switch to u_silhouetteColor only AFTER the alpha test\n\tgl_FragColor = u_silhouetteColor;\n\t#else // DRAW_MODE_silhouette\n\n\t#ifdef DRAW_MODE_colorMask\n\tvec3 maskDistance = abs(gl_FragColor.rgb - u_colorMask);\n\tvec3 colorMaskTolerance = vec3(u_colorMaskTolerance, u_colorMaskTolerance, u_colorMaskTolerance);\n\tif (any(greaterThan(maskDistance, colorMaskTolerance)))\n\t{\n\t\tdiscard;\n\t}\n\t#endif // DRAW_MODE_colorMask\n\t#endif // DRAW_MODE_silhouette\n\n\t#ifdef DRAW_MODE_straightAlpha\n\t// Un-premultiply alpha.\n\tgl_FragColor.rgb /= gl_FragColor.a + epsilon;\n\t#endif\n\n\t#endif // !(defined(DRAW_MODE_line) || defined(DRAW_MODE_background))\n\n\t#ifdef DRAW_MODE_line\n\t// Maaaaagic antialiased-line-with-round-caps shader.\n\n\t// "along-the-lineness". This increases parallel to the line.\n\t// It goes from negative before the start point, to 0.5 through the start to the end, then ramps up again\n\t// past the end point.\n\tfloat d = ((v_texCoord.x - clamp(v_texCoord.x, 0.0, u_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 -= ((u_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 = u_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'},9593:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,o,a,s=[],u=!0,l=!1;try{if(o=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(s.push(n.value),s.length!==e);u=!0);}catch(t){l=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(l)throw i}}return s}}(t,e)||a(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t){return function(t){if(Array.isArray(t))return s(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||a(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t,e){if(t){if("string"==typeof t)return s(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(t,e):void 0}}function s(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function u(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}function c(t,e,r){return e=h(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,f()?Reflect.construct(e,r||[],h(t).constructor):e.apply(t,r))}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(f=function(){return!!t})()}function h(t){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},h(t)}function d(t,e){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},d(t,e)}var p=r(4434),m=r(780),y=r(9609),b=r(4396),v=r(2752),g=r(5837),_=r(6086),x=r(4465),w=r(6952),k=r(4759),E=r(5214),S=r(1379),A=r(3707),T=y.v3.create(),C=new g,P=new g,F=new Uint8ClampedArray(4),M=new Uint8ClampedArray(4),D=[3,3],O=function(t,e,r){return(248&t[0])==(248&e[r+0])&&(248&t[1])==(248&e[r+1])&&(240&t[2])==(240&e[r+2])},I=function(t){function e(t,r,n,i,o){var a;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);var s=(a=c(this,e))._gl=e._getContext(t);if(!s)throw new Error("Could not get WebGL context: this browser or environment may not support WebGL.");return a._useGpuMode=e.UseGpuModes.Automatic,a._allDrawables=[],a._allSkins=[],a._drawList=[],a._groupOrdering=[],a._layerGroups={},a._nextDrawableId=x.ID_NONE+1,a._nextSkinId=x.ID_NONE+1,a._projection=y.m4.identity(),a._shaderManager=new w(s),a._tempCanvas=document.createElement("canvas"),a._regionId=null,a._exitRegion=null,a._backgroundDrawRegionId={enter:function(){return a._enterDrawBackground()},exit:function(){return a._exitDrawBackground()}},a._snapshotCallbacks=[],a._backgroundColor4f=[0,0,0,1],a._backgroundColor3b=new Uint8ClampedArray(3),a._createGeometry(),a.on(x.Events.NativeSizeChanged,a.onNativeSizeChanged),a.setBackgroundColor(1,1,1),a.setStageSize(r||-240,n||240,i||-180,o||180),a.resize(a._nativeSize[0],a._nativeSize[1]),s.disable(s.DEPTH_TEST),s.enable(s.BLEND),s.blendFunc(s.ONE,s.ONE_MINUS_SRC_ALPHA),a}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d(t,e)}(e,t),r=e,n=[{key:"gl",get:function(){return this._gl}},{key:"canvas",get:function(){return this._gl&&this._gl.canvas}},{key:"resize",value:function(t,e){var r=this._gl.canvas,n=window.devicePixelRatio||1,i=t*n,o=e*n;r.width===i&&r.height===o||(r.width=i,r.height=o,this.draw())}},{key:"setBackgroundColor",value:function(t,e,r){this._backgroundColor4f[0]=t,this._backgroundColor4f[1]=e,this._backgroundColor4f[2]=r,this._backgroundColor3b[0]=255*t,this._backgroundColor3b[1]=255*e,this._backgroundColor3b[2]=255*r}},{key:"setDebugCanvas",value:function(t){this._debugCanvas=t}},{key:"setUseGpuMode",value:function(t){this._useGpuMode=t}},{key:"setStageSize",value:function(t,e,r,n){this._xLeft=t,this._xRight=e,this._yBottom=r,this._yTop=n,this._projection=y.m4.ortho(t,e,r,n,-1,1),this._setNativeSize(Math.abs(e-t),Math.abs(r-n))}},{key:"getNativeSize",value:function(){return[this._nativeSize[0],this._nativeSize[1]]}},{key:"_setNativeSize",value:function(t,e){this._nativeSize=[t,e],this.emit(x.Events.NativeSizeChanged,{newSize:this._nativeSize})}},{key:"createBitmapSkin",value:function(t,e,r){var n=this._nextSkinId++,i=new b(n,this);return i.setBitmap(t,e,r),this._allSkins[n]=i,n}},{key:"createSVGSkin",value:function(t,e){var r=this._nextSkinId++,n=new k(r,this);return n.setSVG(t,e),this._allSkins[r]=n,r}},{key:"createPenSkin",value:function(){var t=this._nextSkinId++,e=new _(t,this);return this._allSkins[t]=e,t}},{key:"createTextSkin",value:function(t,e,r){var n=this._nextSkinId++,i=new E(n,this);return i.setTextBubble(t,e,r),this._allSkins[n]=i,n}},{key:"updateSVGSkin",value:function(t,e,r){if(this._allSkins[t]instanceof k)this._allSkins[t].setSVG(e,r);else{var n=new k(t,this);n.setSVG(e,r),this._reskin(t,n)}}},{key:"updateBitmapSkin",value:function(t,e,r,n){if(this._allSkins[t]instanceof b)this._allSkins[t].setBitmap(e,r,n);else{var i=new b(t,this);i.setBitmap(e,r,n),this._reskin(t,i)}}},{key:"_reskin",value:function(t,e){var r=this._allSkins[t];this._allSkins[t]=e;var n,i=function(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=a(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){u=!0,o=t},f:function(){try{s||null==r.return||r.return()}finally{if(u)throw o}}}}(this._allDrawables);try{for(i.s();!(n=i.n()).done;){var o=n.value;o&&o.skin===r&&(o.skin=e)}}catch(t){i.e(t)}finally{i.f()}r.dispose()}},{key:"updateTextSkin",value:function(t,e,r,n){if(this._allSkins[t]instanceof E)this._allSkins[t].setTextBubble(e,r,n);else{var i=new E(t,this);i.setTextBubble(e,r,n),this._reskin(t,i)}}},{key:"destroySkin",value:function(t){this._allSkins[t].dispose(),delete this._allSkins[t]}},{key:"createDrawable",value:function(t){if(t&&Object.prototype.hasOwnProperty.call(this._layerGroups,t)){var e=this._nextDrawableId++,r=new v(e);return this._allDrawables[e]=r,this._addToDrawList(e,t),r.skin=null,e}A.warn("Cannot create a drawable without a known layer group")}},{key:"setLayerGroupOrdering",value:function(t){this._groupOrdering=t;for(var e=0;e<this._groupOrdering.length;e++)this._layerGroups[this._groupOrdering[e]]={groupIndex:e,drawListOffset:0}}},{key:"_addToDrawList",value:function(t,e){var r=this._layerGroups[e],n=r.groupIndex,i=this._endIndexForKnownLayerGroup(r);this._drawList.splice(i,0,t),this._updateOffsets("add",n)}},{key:"_updateOffsets",value:function(t,e){for(var r=e+1;r<this._groupOrdering.length;r++){var n=this._groupOrdering[r];"add"===t?this._layerGroups[n].drawListOffset++:"delete"===t&&this._layerGroups[n].drawListOffset--}}},{key:"_visibleDrawList",get:function(){var t=this;return this._drawList.filter((function(e){return t._allDrawables[e]._visible}))}},{key:"_endIndexForKnownLayerGroup",value:function(t){var e=t.groupIndex;return e===this._groupOrdering.length-1?this._drawList.length:this._layerGroups[this._groupOrdering[e+1]].drawListOffset}},{key:"destroyDrawable",value:function(t,e){if(e&&Object.prototype.hasOwnProperty.call(this._layerGroups,e)){this._allDrawables[t].dispose(),delete this._allDrawables[t];for(var r=this._layerGroups[e],n=this._endIndexForKnownLayerGroup(r),i=r.drawListOffset;i<n&&this._drawList[i]!==t;)i++;i<n?(this._drawList.splice(i,1),this._updateOffsets("delete",r.groupIndex)):A.warn("Could not destroy drawable that could not be found in layer group.")}else A.warn("Cannot destroy drawable without known layer group.")}},{key:"getDrawableOrder",value:function(t){return this._drawList.indexOf(t)}},{key:"setDrawableOrder",value:function(t,e,r,n,i){if(r&&Object.prototype.hasOwnProperty.call(this._layerGroups,r)){for(var o=this._layerGroups[r],a=o.drawListOffset,s=this._endIndexForKnownLayerGroup(o),u=a;u<s&&this._drawList[u]!==t;)u++;if(u<s){if(0===e)return u;this._drawList.splice(u,1)[0];var l=e;n&&(l+=u);var c=(i||0)+a,f=c>=a&&c<s?c:a;return l=Math.max(l,f),l=Math.min(l,s),this._drawList.splice(l,0,t),l}return null}A.warn("Cannot set the order of a drawable without a known layer group.")}},{key:"draw",value:function(){this._doExitDrawRegion();var t=this._gl;if(y.bindFramebufferInfo(t,null),t.viewport(0,0,t.canvas.width,t.canvas.height),t.clearColor.apply(t,o(this._backgroundColor4f)),t.clear(t.COLOR_BUFFER_BIT),this._drawThese(this._drawList,w.DRAW_MODE.default,this._projection,{framebufferWidth:t.canvas.width,framebufferHeight:t.canvas.height}),this._snapshotCallbacks.length>0){var e=t.canvas.toDataURL();this._snapshotCallbacks.forEach((function(t){return t(e)})),this._snapshotCallbacks=[]}}},{key:"getBounds",value:function(t){var e=this._allDrawables[t];if(e.needsConvexHullPoints()){var r=this._getConvexHullPointsForDrawable(t);e.setConvexHullPoints(r)}var n=e.getFastBounds();if(this._debugCanvas){var i=this._gl;this._debugCanvas.width=i.canvas.width,this._debugCanvas.height=i.canvas.height;var o=this._debugCanvas.getContext("2d");o.drawImage(i.canvas,0,0),o.strokeStyle="#FF0000";var a=window.devicePixelRatio;o.strokeRect(a*(n.left+this._nativeSize[0]/2),a*(-n.top+this._nativeSize[1]/2),a*(n.right-n.left),a*(-n.bottom+n.top))}return n}},{key:"getBoundsForBubble",value:function(t){var e=this._allDrawables[t];if(e.needsConvexHullPoints()){var r=this._getConvexHullPointsForDrawable(t);e.setConvexHullPoints(r)}var n=e.getBoundsForBubble();if(this._debugCanvas){var i=this._gl;this._debugCanvas.width=i.canvas.width,this._debugCanvas.height=i.canvas.height;var o=this._debugCanvas.getContext("2d");o.drawImage(i.canvas,0,0),o.strokeStyle="#FF0000";var a=window.devicePixelRatio;o.strokeRect(a*(n.left+this._nativeSize[0]/2),a*(-n.top+this._nativeSize[1]/2),a*(n.right-n.left),a*(-n.bottom+n.top))}return n}},{key:"getCurrentSkinSize",value:function(t){var e=this._allDrawables[t];return this.getSkinSize(e.skin.id)}},{key:"getSkinSize",value:function(t){return this._allSkins[t].size}},{key:"getSkinRotationCenter",value:function(t){return this._allSkins[t].calculateRotationCenter()}},{key:"isTouchingColor",value:function(t,r,n){var i,o=this._candidatesTouching(t,this._visibleDrawList);if(O(r,this._backgroundColor3b,0)){if(null===(i=this._touchingBounds(t)))return!1}else{if(0===o.length)return!1;i=this._candidatesBounds(o)}var a=this._getMaxPixelsForCPU(),s=this._debugCanvas&&this._debugCanvas.getContext("2d");s&&(this._debugCanvas.width=i.width,this._debugCanvas.height=i.height),i.width*i.height*(o.length+1)>=a&&this._isTouchingColorGpuStart(t,o.map((function(t){return t.id})).reverse(),i,r,n);var u=this._allDrawables[t],l=T,c=F,f=Boolean(n);u.updateCPURenderAttributes();for(var h,d,p=~w.EFFECT_INFO.ghost.mask,m=i.bottom;m<=i.top;m++){if(i.width*(m-i.bottom)*(o.length+1)>=a)return this._isTouchingColorGpuFin(i,r,m-i.bottom);for(var y=i.left;y<=i.right;y++)if(l[1]=m,l[0]=y,(f?(h=v.sampleColor4b(l,u,c,p),d=n,h[3]>0&&(252&h[0])==(252&d[0])&&(252&h[1])==(252&d[1])&&(252&h[2])==(252&d[2])):u.isTouching(l))&&(e.sampleColor3b(l,o,c),s&&(s.fillStyle="rgb(".concat(c[0],",").concat(c[1],",").concat(c[2],")"),s.fillRect(y-i.left,i.bottom-m,1,1)),O(c,r,0)))return!0}return!1}},{key:"_getMaxPixelsForCPU",value:function(){switch(this._useGpuMode){case e.UseGpuModes.ForceCPU:return 1/0;case e.UseGpuModes.ForceGPU:return 0;case e.UseGpuModes.Automatic:default:return 4e4}}},{key:"_enterDrawBackground",value:function(){var t=this.gl,e=this._shaderManager.getShader(w.DRAW_MODE.background,0);t.disable(t.BLEND),t.useProgram(e.program),y.setBuffersAndAttributes(t,e,this._bufferInfo)}},{key:"_exitDrawBackground",value:function(){var t=this.gl;t.enable(t.BLEND)}},{key:"_isTouchingColorGpuStart",value:function(t,e,r,n,i){this._doExitDrawRegion();var o=this._gl;y.bindFramebufferInfo(o,this._queryBufferInfo),o.viewport(0,0,r.width,r.height);var a,s=y.m4.ortho(r.left,r.right,r.top,r.bottom,-1,1);o.clearColor(0,0,0,0),o.clear(o.COLOR_BUFFER_BIT|o.STENCIL_BUFFER_BIT),i&&(a={u_colorMask:[i[0]/255,i[1]/255,i[2]/255],u_colorMaskTolerance:2/255});try{o.enable(o.STENCIL_TEST),o.stencilFunc(o.ALWAYS,1,1),o.stencilOp(o.KEEP,o.KEEP,o.REPLACE),o.colorMask(!1,!1,!1,!1),this._drawThese([t],i?w.DRAW_MODE.colorMask:w.DRAW_MODE.silhouette,s,{extraUniforms:a,ignoreVisibility:!0,effectMask:~w.EFFECT_INFO.ghost.mask}),o.stencilFunc(o.EQUAL,1,1),o.stencilOp(o.KEEP,o.KEEP,o.KEEP),o.colorMask(!0,!0,!0,!0),this.enterDrawRegion(this._backgroundDrawRegionId);var u={u_backgroundColor:this._backgroundColor4f},l=this._shaderManager.getShader(w.DRAW_MODE.background,0);y.setUniforms(l,u),y.drawBufferInfo(o,this._bufferInfo,o.TRIANGLES),this._drawThese(e,w.DRAW_MODE.default,s,{idFilterFunc:function(e){return e!==t}})}finally{o.colorMask(!0,!0,!0,!0),o.disable(o.STENCIL_TEST),this._doExitDrawRegion()}}},{key:"_isTouchingColorGpuFin",value:function(t,e,r){var n=this._gl,i=new Uint8Array(Math.floor(t.width*(t.height-r)*4));if(n.readPixels(0,0,t.width,t.height-r,n.RGBA,n.UNSIGNED_BYTE,i),this._debugCanvas){this._debugCanvas.width=t.width,this._debugCanvas.height=t.height;var o=this._debugCanvas.getContext("2d"),a=o.getImageData(0,0,t.width,t.height-r);a.data.set(i),o.putImageData(a,0,0)}for(var s=0;s<i.length;s+=4)if(0!==i[s+3]&&O(e,i,s))return!0;return!1}},{key:"isTouchingDrawables",value:function(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this._drawList,n=this._candidatesTouching(t,r.filter((function(t){return e._allDrawables[t]._visible})));if(0===n.length||!this._allDrawables[t]._visible)return!1;var i=this._candidatesBounds(n),o=this._allDrawables[t],a=T;o.updateCPURenderAttributes();for(var s=i.left;s<=i.right;s++){a[0]=s;for(var u=i.bottom;u<=i.top;u++)if(a[1]=u,o.isTouching(a))for(var l=0;l<n.length;l++)if(n[l].drawable.isTouching(a))return!0}return!1}},{key:"clientSpaceToScratchBounds",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,i=this._gl,o=this._nativeSize[0]/i.canvas.clientWidth,a=this._nativeSize[1]/i.canvas.clientHeight;r*=o,n*=a;var s=t*o-((r=Math.max(1,Math.min(Math.round(r),D[0])))-1)/2,u=e*a+((n=Math.max(1,Math.min(Math.round(n),D[1])))-1)/2,l=r%2?0:-.5,c=n%2?0:-.5,f=new g;return f.initFromBounds(Math.floor(this._xLeft+s+l),Math.floor(this._xLeft+s+l+r-1),Math.ceil(this._yTop-u+c),Math.ceil(this._yTop-u+c+n-1)),f}},{key:"drawableTouching",value:function(t,e,r,n,i){var o=this._allDrawables[t];if(!o)return!1;var a=this.clientSpaceToScratchBounds(e,r,n,i),s=y.v3.create();for(o.updateCPURenderAttributes(),s[1]=a.bottom;s[1]<=a.top;s[1]++)for(s[0]=a.left;s[0]<=a.right;s[0]++)if(o.isTouching(s))return!0;return!1}},{key:"pick",value:function(t,e,r,n,i){var o=this,a=this.clientSpaceToScratchBounds(t,e,r,n);if(a.left===-1/0||a.bottom===-1/0)return!1;if(i=(i||this._drawList).filter((function(t){var e=o._allDrawables[t];if(e.getVisible()&&0!==e.getUniforms().u_ghost){var r=e.getFastBounds();return!!a.intersects(r)&&(e.updateCPURenderAttributes(),!0)}return!1})),0===i.length)return!1;var s=[],u=y.v3.create(0,0,0);for(u[1]=a.bottom;u[1]<=a.top;u[1]++)for(u[0]=a.left;u[0]<=a.right;u[0]++)for(var l=i.length-1;l>=0;l--){var c=i[l];if(this._allDrawables[c].isTouching(u)){s[c]=(s[c]||0)+1;break}}s[x.ID_NONE]=0;var f=x.ID_NONE;for(var h in s)Object.prototype.hasOwnProperty.call(s,h)&&s[h]>s[f]&&(f=h);return Number(f)}},{key:"extractDrawableScreenSpace",value:function(t){var e=this._allDrawables[t];if(!e)throw new Error("Could not extract drawable with ID ".concat(t,"; it does not exist"));this._doExitDrawRegion();var r=.5*this._nativeSize[0],n=.5*this._nativeSize[1],i=e.getFastBounds(),o=this.canvas,a=o.width/this._nativeSize[0],s=new g;s.initFromBounds((i.left+r)*a,(i.right+r)*a,(n-i.top)*a,(n-i.bottom)*a),s.snapToInt(),i.initFromBounds(s.left/a-r,s.right/a-r,n-s.top/a,n-s.bottom/a);var u=this._gl,l=u.getParameter(u.MAX_TEXTURE_SIZE),c=Math.min(2048,s.width,l),f=Math.min(2048,s.height,l),h=y.createFramebufferInfo(u,[{format:u.RGBA}],c,f);try{y.bindFramebufferInfo(u,h),u.viewport(0,0,c,f);var d=y.m4.ortho(i.left,i.right,i.top,i.bottom,-1,1);u.clearColor(0,0,0,0),u.clear(u.COLOR_BUFFER_BIT),this._drawThese([t],w.DRAW_MODE.straightAlpha,d,{effectMask:~w.EFFECT_INFO.ghost.mask,framebufferWidth:o.width,framebufferHeight:o.height});var p=new Uint8Array(Math.floor(c*f*4));u.readPixels(0,0,c,f,u.RGBA,u.UNSIGNED_BYTE,p);var m=new ImageData(new Uint8ClampedArray(p.buffer),c,f),b=o.getBoundingClientRect().width/o.width;return{imageData:m,x:s.left*b,y:s.bottom*b,width:s.width*b,height:s.height*b}}finally{u.deleteFramebuffer(h.framebuffer)}}},{key:"extractColor",value:function(t,e,r){this._doExitDrawRegion();var n=Math.round(this._nativeSize[0]*(t/this._gl.canvas.clientWidth-.5)),i=Math.round(-this._nativeSize[1]*(e/this._gl.canvas.clientHeight-.5)),a=this._gl;y.bindFramebufferInfo(a,this._queryBufferInfo);var s=new g;s.initFromBounds(n-r,n+r,i-r,i+r);var u=n-s.left,l=s.top-i;a.viewport(0,0,s.width,s.height);var c=y.m4.ortho(s.left,s.right,s.top,s.bottom,-1,1);a.clearColor.apply(a,o(this._backgroundColor4f)),a.clear(a.COLOR_BUFFER_BIT),this._drawThese(this._drawList,w.DRAW_MODE.default,c);var f=new Uint8Array(Math.floor(s.width*s.height*4));a.readPixels(0,0,s.width,s.height,a.RGBA,a.UNSIGNED_BYTE,f);var h=Math.floor(4*(l*s.width+u)),d={r:f[h],g:f[h+1],b:f[h+2],a:f[h+3]};if(this._debugCanvas){this._debugCanvas.width=s.width,this._debugCanvas.height=s.height;var p=this._debugCanvas.getContext("2d"),m=p.createImageData(s.width,s.height);m.data.set(f),p.putImageData(m,0,0),p.strokeStyle="black",p.fillStyle="rgba(".concat(d.r,", ").concat(d.g,", ").concat(d.b,", ").concat(d.a,")"),p.rect(u-4,l-4,8,8),p.fill(),p.stroke()}return{data:f,width:s.width,height:s.height,color:d}}},{key:"_touchingBounds",value:function(t){var e=this._allDrawables[t];if(!e.skin||!e.skin.getTexture([100,100]))return null;var r=e.getFastBounds();return r.clamp(this._xLeft,this._xRight,this._yBottom,this._yTop),r.snapToInt(),0===r.width||0===r.height?null:r}},{key:"_candidatesTouching",value:function(t,e){var r=this._touchingBounds(t),n=[];if(null===r)return n;for(var i=e.length-1;i>=0;i--){var o=e[i];if(o!==t){var a=this._allDrawables[o];if(a.skin instanceof E)continue;if(a.skin&&a._visible){a.updateCPURenderAttributes();var s=a.getFastBounds();s.snapToInt(),r.intersects(s)&&n.push({id:o,drawable:a,intersection:g.intersect(r,s)})}}}return n}},{key:"_candidatesBounds",value:function(t){return t.reduce((function(t,e){var r=e.intersection;return t?g.union(t,r,C):r}),null)}},{key:"updateDrawableSkinId",value:function(t,e){var r=this._allDrawables[t];r&&(r.skin=this._allSkins[e])}},{key:"updateDrawablePosition",value:function(t,e){var r=this._allDrawables[t];r&&r.updatePosition(e)}},{key:"updateDrawableDirection",value:function(t,e){var r=this._allDrawables[t];r&&r.updateDirection(e)}},{key:"updateDrawableScale",value:function(t,e){var r=this._allDrawables[t];r&&r.updateScale(e)}},{key:"updateDrawableDirectionScale",value:function(t,e,r){var n=this._allDrawables[t];n&&(n.updateDirection(e),n.updateScale(r))}},{key:"updateDrawableVisible",value:function(t,e){var r=this._allDrawables[t];r&&r.updateVisible(e)}},{key:"updateDrawableEffect",value:function(t,e,r){var n=this._allDrawables[t];n&&n.updateEffect(e,r)}},{key:"updateDrawableProperties",value:function(t,e){var r=this._allDrawables[t];r&&("skinId"in e&&this.updateDrawableSkinId(t,e.skinId),r.updateProperties(e))}},{key:"getFencedPositionOfDrawable",value:function(t,e){var r=e[0],n=e[1],i=this._allDrawables[t];if(!i)return[r,n];var o=r-i._position[0],a=n-i._position[1],s=i._skin.getFenceBounds(i,P),u=Math.floor(Math.min(s.width,s.height)/2),l=this._xRight-Math.min(15,u);s.right+o<-l?r=Math.ceil(i._position[0]-(l+s.right)):s.left+o>l&&(r=Math.floor(i._position[0]+(l-s.left)));var c=this._yTop-Math.min(15,u);return s.top+a<-c?n=Math.ceil(i._position[1]-(c+s.top)):s.bottom+a>c&&(n=Math.floor(i._position[1]+(c-s.bottom))),[r,n]}},{key:"penClear",value:function(t){this._allSkins[t].clear()}},{key:"penPoint",value:function(t,e,r,n){this._allSkins[t].drawPoint(e,r,n)}},{key:"penLine",value:function(t,e,r,n,i,o){this._allSkins[t].drawLine(e,r,n,i,o)}},{key:"penStamp",value:function(t,e){if(this._allDrawables[e]){var r=this._touchingBounds(e);if(r){this._doExitDrawRegion();var n=this._allSkins[t],i=this._gl;y.bindFramebufferInfo(i,n._framebuffer),i.viewport(.5*this._nativeSize[0]+r.left,.5*this._nativeSize[1]-r.top,r.width,r.height);var o=y.m4.ortho(r.left,r.right,r.top,r.bottom,-1,1);this._drawThese([e],w.DRAW_MODE.default,o,{ignoreVisibility:!0}),n._silhouetteDirty=!0}}}},{key:"_createGeometry",value:function(){this._bufferInfo=y.createBufferInfoFromArrays(this._gl,{a_position:{numComponents:2,data:[-.5,-.5,.5,-.5,-.5,.5,-.5,.5,.5,-.5,.5,.5]},a_texCoord:{numComponents:2,data:[1,0,0,0,1,1,1,1,0,0,0,1]}})}},{key:"onNativeSizeChanged",value:function(t){var e=i(t.newSize,2),r=e[0],n=e[1],o=this._gl,a=[{format:o.RGBA},{format:o.DEPTH_STENCIL}];this._pickBufferInfo||(this._pickBufferInfo=y.createFramebufferInfo(o,a,D[0],D[1])),this._queryBufferInfo?y.resizeFramebufferInfo(o,this._queryBufferInfo,a,r,n):this._queryBufferInfo=y.createFramebufferInfo(o,a,r,n)}},{key:"enterDrawRegion",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.enter,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.exit;this._regionId!==t&&(this._doExitDrawRegion(),this._regionId=t,e(),this._exitRegion=r)}},{key:"_doExitDrawRegion",value:function(){null!==this._exitRegion&&this._exitRegion(),this._exitRegion=null,this._regionId=null}},{key:"_drawThese",value:function(t,e,r){for(var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=this._gl,o=null,a=("framebufferWidth"in n&&"framebufferHeight"in n&&n.framebufferWidth!==this._nativeSize[0]&&n.framebufferHeight!==this._nativeSize[1]),s=t.length,u=0;u<s;++u){var l=t[u];if(!n.filter||n.filter(l)){var c=this._allDrawables[l];if(c.getVisible()||n.ignoreVisibility){var f=a?[c.scale[0]*n.framebufferWidth/this._nativeSize[0],c.scale[1]*n.framebufferHeight/this._nativeSize[1]]:c.scale;if(c.skin&&c.skin.getTexture(f)){var h={},d=c.enabledEffects;d&=Object.prototype.hasOwnProperty.call(n,"effectMask")?n.effectMask:d;var p=this._shaderManager.getShader(e,d);this._regionId!==p&&(this._doExitDrawRegion(),this._regionId=p,o=p,i.useProgram(o.program),y.setBuffersAndAttributes(i,o,this._bufferInfo),Object.assign(h,{u_projectionMatrix:r})),Object.assign(h,c.skin.getUniforms(f),c.getUniforms()),n.extraUniforms&&Object.assign(h,n.extraUniforms),h.u_skin&&y.setTextureParameters(i,h.u_skin,{minMag:c.skin.useNearest(f,c)?i.NEAREST:i.LINEAR}),y.setUniforms(o,h),y.drawBufferInfo(i,this._bufferInfo,i.TRIANGLES)}}}}this._regionId=null}},{key:"_getConvexHullPointsForDrawable",value:function(t){var e=this._allDrawables[t],r=i(e.skin.size,2),n=r[0],o=r[1];if(!e.getVisible()||0===n||0===o)return[];e.updateCPURenderAttributes();for(var a,s=function(t,e,r){return(e[0]-t[0])*(r[1]-t[1])-(e[1]-t[1])*(r[0]-t[0])},u=[],l=[],c=-1,f=-1,h=y.v3.create(),d=y.v3.create(),p=0;p<o;p++){h[1]=p/o;for(var b=0;b<n;b++)if(h[0]=b/n,S.transformPoint(e,h,d),e.skin.isTouchingLinear(d)){a=[b,p];break}if(!(b>=n)){for(;c>0&&!(s(u[c],u[c-1],a)>0);)--c;for(u[++c]=a,b=n-1;b>=0;b--)if(h[0]=b/n,S.transformPoint(e,h,d),e.skin.isTouchingLinear(d)){a=[b,p];break}for(;f>0&&!(s(l[f],l[f-1],a)<0);)--f;l[++f]=a}}var v=u;v.length=c+1;for(var g=f;g>=0;--g)v.push(l[g]);return m(v,1/0)}},{key:"requestSnapshot",value:function(t){this._snapshotCallbacks.push(t)}}],s=[{key:"isSupported",value:function(t){try{return!!e._getContext(t||document.createElement("canvas"))}catch(t){return!1}}},{key:"_getContext",value:function(t){var e={alpha:!1,stencil:!0,antialias:!1};return y.getWebGLContext(t,e)||y.getContext(t,e)}},{key:"sampleColor3b",value:function(t,e,r){(r=r||new Uint8ClampedArray(3)).fill(0);for(var n=1,i=0;0!==n&&i<e.length;i++)v.sampleColor4b(t,e[i].drawable,M),r[0]+=M[0]*n,r[1]+=M[1]*n,r[2]+=M[2]*n,n*=1-M[3]/255;return r[0]+=255*n,r[1]+=255*n,r[2]+=255*n,r}}],n&&u(r.prototype,n),s&&u(r,s),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,s}(p);I.prototype.canHazPixels=I.prototype.extractDrawableScreenSpace,I.UseGpuModes={Automatic:"Automatic",ForceGPU:"ForceGPU",ForceCPU:"ForceCPU"},t.exports=I},9609:(t,e,r)=>{"use strict";r.r(e),r.d(e,{addExtensionsToContext:()=>Aa,attributes:()=>mt,bindFramebufferInfo:()=>pa,bindTransformFeedbackInfo:()=>Co,bindUniformBlock:()=>Bo,canFilter:()=>Rn,canGenerateMipmap:()=>Bn,createAttribsFromArrays:()=>ut,createAttributeSetters:()=>Uo,createBufferFromArray:()=>dt,createBufferFromTypedArray:()=>tt,createBufferInfoFromArrays:()=>ht,createBuffersFromArrays:()=>pt,createFramebufferInfo:()=>ha,createProgram:()=>mo,createProgramAsync:()=>yo,createProgramFromScripts:()=>_o,createProgramFromSources:()=>xo,createProgramInfo:()=>Xo,createProgramInfoAsync:()=>bo,createProgramInfoFromProgram:()=>Vo,createSampler:()=>Kn,createSamplers:()=>qn,createTexture:()=>ci,createTextures:()=>hi,createTransformFeedback:()=>Po,createTransformFeedbackInfo:()=>To,createUniformBlockInfo:()=>Io,createUniformBlockInfoFromProgram:()=>Oo,createUniformBlockSpecFromProgram:()=>Fo,createUniformSetters:()=>Ao,createVAOAndSetAttributes:()=>va,createVAOFromBufferInfo:()=>ga,createVertexArrayInfo:()=>ba,draw:()=>Qo,drawBufferInfo:()=>Yo,drawObjectList:()=>Zo,framebuffers:()=>ma,getArray_:()=>rt,getBytesPerElementForInternalFormat:()=>Dn,getContext:()=>Ca,getFormatAndTypeForInternalFormat:()=>On,getGLTypeForTypedArray:()=>P,getGLTypeForTypedArrayType:()=>F,getNumComponentsForFormat:()=>Ln,getNumComponents_:()=>at,getTypedArrayTypeForGLType:()=>M,getWebGLContext:()=>Ta,glEnumToString:()=>ye,isArrayBuffer:()=>D,isWebGL1:()=>me,isWebGL2:()=>pe,loadTextureFromUrl:()=>oi,m4:()=>_,primitives:()=>de,programs:()=>Ko,resizeCanvasToDisplaySize:()=>Pa,resizeFramebufferInfo:()=>da,resizeTexture:()=>fi,setAttribInfoBufferFromArray:()=>lt,setAttributeDefaults_:()=>Q,setAttributePrefix:()=>Z,setAttributes:()=>Wo,setBlockUniforms:()=>Lo,setBuffersAndAttributes:()=>Go,setDefaultTextureColor:()=>Nn,setDefaults:()=>wa,setEmptyTexture:()=>li,setSamplerParameters:()=>Xn,setTextureDefaults_:()=>Un,setTextureFilteringForSize:()=>Jn,setTextureFromArray:()=>ui,setTextureFromElement:()=>$n,setTextureParameters:()=>Hn,setUniformBlock:()=>Ro,setUniforms:()=>jo,setUniformsAndBindTextures:()=>No,textures:()=>di,typedarrays:()=>O,utils:()=>be,v3:()=>c,vertexArrays:()=>_a});let n=Float32Array;function i(t,e,r){const i=new n(3);return t&&(i[0]=t),e&&(i[1]=e),r&&(i[2]=r),i}function o(t,e,r){return(r=r||new n(3))[0]=t[0]+e[0],r[1]=t[1]+e[1],r[2]=t[2]+e[2],r}function a(t,e,r){return(r=r||new n(3))[0]=t[0]-e[0],r[1]=t[1]-e[1],r[2]=t[2]-e[2],r}function s(t,e,r){r=r||new n(3);const i=t[2]*e[0]-t[0]*e[2],o=t[0]*e[1]-t[1]*e[0];return r[0]=t[1]*e[2]-t[2]*e[1],r[1]=i,r[2]=o,r}function u(t,e){e=e||new n(3);const r=t[0]*t[0]+t[1]*t[1]+t[2]*t[2],i=Math.sqrt(r);return i>1e-5?(e[0]=t[0]/i,e[1]=t[1]/i,e[2]=t[2]/i):(e[0]=0,e[1]=0,e[2]=0),e}function l(t,e,r){return(r=r||new n(3))[0]=t[0]*e[0],r[1]=t[1]*e[1],r[2]=t[2]*e[2],r}var c=Object.freeze({__proto__:null,add:o,copy:function(t,e){return(e=e||new n(3))[0]=t[0],e[1]=t[1],e[2]=t[2],e},create:i,cross:s,distance:function(t,e){const r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return Math.sqrt(r*r+n*n+i*i)},distanceSq:function(t,e){const r=t[0]-e[0],n=t[1]-e[1],i=t[2]-e[2];return r*r+n*n+i*i},divide:function(t,e,r){return(r=r||new n(3))[0]=t[0]/e[0],r[1]=t[1]/e[1],r[2]=t[2]/e[2],r},divScalar:function(t,e,r){return(r=r||new n(3))[0]=t[0]/e,r[1]=t[1]/e,r[2]=t[2]/e,r},dot:function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},lerp:function(t,e,r,i){return(i=i||new n(3))[0]=t[0]+r*(e[0]-t[0]),i[1]=t[1]+r*(e[1]-t[1]),i[2]=t[2]+r*(e[2]-t[2]),i},lerpV:function(t,e,r,i){return(i=i||new n(3))[0]=t[0]+r[0]*(e[0]-t[0]),i[1]=t[1]+r[1]*(e[1]-t[1]),i[2]=t[2]+r[2]*(e[2]-t[2]),i},length:function(t){return Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2])},lengthSq:function(t){return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]},max:function(t,e,r){return(r=r||new n(3))[0]=Math.max(t[0],e[0]),r[1]=Math.max(t[1],e[1]),r[2]=Math.max(t[2],e[2]),r},min:function(t,e,r){return(r=r||new n(3))[0]=Math.min(t[0],e[0]),r[1]=Math.min(t[1],e[1]),r[2]=Math.min(t[2],e[2]),r},mulScalar:function(t,e,r){return(r=r||new n(3))[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e,r},multiply:l,negate:function(t,e){return(e=e||new n(3))[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e},normalize:u,setDefaultType:function(t){const e=n;return n=t,e},subtract:a});let f,h,d,p=Float32Array;function m(t,e){return(e=e||new p(16))[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7],e[8]=t[8],e[9]=t[9],e[10]=t[10],e[11]=t[11],e[12]=t[12],e[13]=t[13],e[14]=t[14],e[15]=t[15],e}function y(t){return(t=t||new p(16))[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function b(t,e){e=e||new p(16);const r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],c=t[8],f=t[9],h=t[10],d=t[11],m=t[12],y=t[13],b=t[14],v=t[15],g=h*v,_=b*d,x=u*v,w=b*l,k=u*d,E=h*l,S=i*v,A=b*o,T=i*d,C=h*o,P=i*l,F=u*o,M=c*y,D=m*f,O=a*y,I=m*s,B=a*f,R=c*s,L=r*y,z=m*n,j=r*f,N=c*n,U=r*s,W=a*n,G=g*s+w*f+k*y-(_*s+x*f+E*y),V=_*n+S*f+C*y-(g*n+A*f+T*y),H=x*n+A*s+P*y-(w*n+S*s+F*y),X=E*n+T*s+F*f-(k*n+C*s+P*f),K=1/(r*G+a*V+c*H+m*X);return e[0]=K*G,e[1]=K*V,e[2]=K*H,e[3]=K*X,e[4]=K*(_*a+x*c+E*m-(g*a+w*c+k*m)),e[5]=K*(g*r+A*c+T*m-(_*r+S*c+C*m)),e[6]=K*(w*r+S*a+F*m-(x*r+A*a+P*m)),e[7]=K*(k*r+C*a+P*c-(E*r+T*a+F*c)),e[8]=K*(M*l+I*d+B*v-(D*l+O*d+R*v)),e[9]=K*(D*o+L*d+N*v-(M*o+z*d+j*v)),e[10]=K*(O*o+z*l+U*v-(I*o+L*l+W*v)),e[11]=K*(R*o+j*l+W*d-(B*o+N*l+U*d)),e[12]=K*(O*h+R*b+D*u-(B*b+M*u+I*h)),e[13]=K*(j*b+M*i+z*h-(L*h+N*b+D*i)),e[14]=K*(L*u+W*b+I*i-(U*b+O*i+z*u)),e[15]=K*(U*h+B*i+N*u-(j*u+W*h+R*i)),e}function v(t,e,r){r=r||i();const n=e[0],o=e[1],a=e[2],s=n*t[3]+o*t[7]+a*t[11]+t[15];return r[0]=(n*t[0]+o*t[4]+a*t[8]+t[12])/s,r[1]=(n*t[1]+o*t[5]+a*t[9]+t[13])/s,r[2]=(n*t[2]+o*t[6]+a*t[10]+t[14])/s,r}function g(t,e,r){r=r||i();const n=e[0],o=e[1],a=e[2];return r[0]=n*t[0]+o*t[4]+a*t[8],r[1]=n*t[1]+o*t[5]+a*t[9],r[2]=n*t[2]+o*t[6]+a*t[10],r}var _=Object.freeze({__proto__:null,axisRotate:function(t,e,r,n){n=n||new p(16);let i=e[0],o=e[1],a=e[2];const s=Math.sqrt(i*i+o*o+a*a);i/=s,o/=s,a/=s;const u=i*i,l=o*o,c=a*a,f=Math.cos(r),h=Math.sin(r),d=1-f,m=u+(1-u)*f,y=i*o*d+a*h,b=i*a*d-o*h,v=i*o*d-a*h,g=l+(1-l)*f,_=o*a*d+i*h,x=i*a*d+o*h,w=o*a*d-i*h,k=c+(1-c)*f,E=t[0],S=t[1],A=t[2],T=t[3],C=t[4],P=t[5],F=t[6],M=t[7],D=t[8],O=t[9],I=t[10],B=t[11];return n[0]=m*E+y*C+b*D,n[1]=m*S+y*P+b*O,n[2]=m*A+y*F+b*I,n[3]=m*T+y*M+b*B,n[4]=v*E+g*C+_*D,n[5]=v*S+g*P+_*O,n[6]=v*A+g*F+_*I,n[7]=v*T+g*M+_*B,n[8]=x*E+w*C+k*D,n[9]=x*S+w*P+k*O,n[10]=x*A+w*F+k*I,n[11]=x*T+w*M+k*B,t!==n&&(n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n},axisRotation:function(t,e,r){r=r||new p(16);let n=t[0],i=t[1],o=t[2];const a=Math.sqrt(n*n+i*i+o*o);n/=a,i/=a,o/=a;const s=n*n,u=i*i,l=o*o,c=Math.cos(e),f=Math.sin(e),h=1-c;return r[0]=s+(1-s)*c,r[1]=n*i*h+o*f,r[2]=n*o*h-i*f,r[3]=0,r[4]=n*i*h-o*f,r[5]=u+(1-u)*c,r[6]=i*o*h+n*f,r[7]=0,r[8]=n*o*h+i*f,r[9]=i*o*h-n*f,r[10]=l+(1-l)*c,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},copy:m,create:function(){return new p(16).fill(0)},frustum:function(t,e,r,n,i,o,a){const s=e-t,u=n-r,l=i-o;return(a=a||new p(16))[0]=2*i/s,a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2*i/u,a[6]=0,a[7]=0,a[8]=(t+e)/s,a[9]=(n+r)/u,a[10]=o/l,a[11]=-1,a[12]=0,a[13]=0,a[14]=i*o/l,a[15]=0,a},getAxis:function(t,e,r){const n=4*e;return(r=r||i())[0]=t[n+0],r[1]=t[n+1],r[2]=t[n+2],r},getTranslation:function(t,e){return(e=e||i())[0]=t[12],e[1]=t[13],e[2]=t[14],e},identity:y,inverse:b,lookAt:function(t,e,r,n){return n=n||new p(16),f=f||i(),h=h||i(),d=d||i(),u(a(t,e,d),d),u(s(r,d,f),f),u(s(d,f,h),h),n[0]=f[0],n[1]=f[1],n[2]=f[2],n[3]=0,n[4]=h[0],n[5]=h[1],n[6]=h[2],n[7]=0,n[8]=d[0],n[9]=d[1],n[10]=d[2],n[11]=0,n[12]=t[0],n[13]=t[1],n[14]=t[2],n[15]=1,n},multiply:function(t,e,r){r=r||new p(16);const n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=t[8],h=t[9],d=t[10],m=t[11],y=t[12],b=t[13],v=t[14],g=t[15],_=e[0],x=e[1],w=e[2],k=e[3],E=e[4],S=e[5],A=e[6],T=e[7],C=e[8],P=e[9],F=e[10],M=e[11],D=e[12],O=e[13],I=e[14],B=e[15];return r[0]=n*_+s*x+f*w+y*k,r[1]=i*_+u*x+h*w+b*k,r[2]=o*_+l*x+d*w+v*k,r[3]=a*_+c*x+m*w+g*k,r[4]=n*E+s*S+f*A+y*T,r[5]=i*E+u*S+h*A+b*T,r[6]=o*E+l*S+d*A+v*T,r[7]=a*E+c*S+m*A+g*T,r[8]=n*C+s*P+f*F+y*M,r[9]=i*C+u*P+h*F+b*M,r[10]=o*C+l*P+d*F+v*M,r[11]=a*C+c*P+m*F+g*M,r[12]=n*D+s*O+f*I+y*B,r[13]=i*D+u*O+h*I+b*B,r[14]=o*D+l*O+d*I+v*B,r[15]=a*D+c*O+m*I+g*B,r},negate:function(t,e){return(e=e||new p(16))[0]=-t[0],e[1]=-t[1],e[2]=-t[2],e[3]=-t[3],e[4]=-t[4],e[5]=-t[5],e[6]=-t[6],e[7]=-t[7],e[8]=-t[8],e[9]=-t[9],e[10]=-t[10],e[11]=-t[11],e[12]=-t[12],e[13]=-t[13],e[14]=-t[14],e[15]=-t[15],e},ortho:function(t,e,r,n,i,o,a){return(a=a||new p(16))[0]=2/(e-t),a[1]=0,a[2]=0,a[3]=0,a[4]=0,a[5]=2/(n-r),a[6]=0,a[7]=0,a[8]=0,a[9]=0,a[10]=2/(i-o),a[11]=0,a[12]=(e+t)/(t-e),a[13]=(n+r)/(r-n),a[14]=(o+i)/(i-o),a[15]=1,a},perspective:function(t,e,r,n,i){i=i||new p(16);const o=Math.tan(.5*Math.PI-.5*t),a=1/(r-n);return i[0]=o/e,i[1]=0,i[2]=0,i[3]=0,i[4]=0,i[5]=o,i[6]=0,i[7]=0,i[8]=0,i[9]=0,i[10]=(r+n)*a,i[11]=-1,i[12]=0,i[13]=0,i[14]=r*n*a*2,i[15]=0,i},rotateX:function(t,e,r){r=r||new p(16);const n=t[4],i=t[5],o=t[6],a=t[7],s=t[8],u=t[9],l=t[10],c=t[11],f=Math.cos(e),h=Math.sin(e);return r[4]=f*n+h*s,r[5]=f*i+h*u,r[6]=f*o+h*l,r[7]=f*a+h*c,r[8]=f*s-h*n,r[9]=f*u-h*i,r[10]=f*l-h*o,r[11]=f*c-h*a,t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r},rotateY:function(t,e,r){r=r||new p(16);const n=t[0],i=t[1],o=t[2],a=t[3],s=t[8],u=t[9],l=t[10],c=t[11],f=Math.cos(e),h=Math.sin(e);return r[0]=f*n-h*s,r[1]=f*i-h*u,r[2]=f*o-h*l,r[3]=f*a-h*c,r[8]=f*s+h*n,r[9]=f*u+h*i,r[10]=f*l+h*o,r[11]=f*c+h*a,t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r},rotateZ:function(t,e,r){r=r||new p(16);const n=t[0],i=t[1],o=t[2],a=t[3],s=t[4],u=t[5],l=t[6],c=t[7],f=Math.cos(e),h=Math.sin(e);return r[0]=f*n+h*s,r[1]=f*i+h*u,r[2]=f*o+h*l,r[3]=f*a+h*c,r[4]=f*s-h*n,r[5]=f*u-h*i,r[6]=f*l-h*o,r[7]=f*c-h*a,t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r},rotationX:function(t,e){e=e||new p(16);const r=Math.cos(t),n=Math.sin(t);return e[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=r,e[6]=n,e[7]=0,e[8]=0,e[9]=-n,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},rotationY:function(t,e){e=e||new p(16);const r=Math.cos(t),n=Math.sin(t);return e[0]=r,e[1]=0,e[2]=-n,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=n,e[9]=0,e[10]=r,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},rotationZ:function(t,e){e=e||new p(16);const r=Math.cos(t),n=Math.sin(t);return e[0]=r,e[1]=n,e[2]=0,e[3]=0,e[4]=-n,e[5]=r,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},scale:function(t,e,r){r=r||new p(16);const n=e[0],i=e[1],o=e[2];return r[0]=n*t[0],r[1]=n*t[1],r[2]=n*t[2],r[3]=n*t[3],r[4]=i*t[4],r[5]=i*t[5],r[6]=i*t[6],r[7]=i*t[7],r[8]=o*t[8],r[9]=o*t[9],r[10]=o*t[10],r[11]=o*t[11],t!==r&&(r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r},scaling:function(t,e){return(e=e||new p(16))[0]=t[0],e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=t[1],e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=t[2],e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,e},setAxis:function(t,e,r,n){n!==t&&(n=m(t,n));const i=4*r;return n[i+0]=e[0],n[i+1]=e[1],n[i+2]=e[2],n},setDefaultType:function(t){const e=p;return p=t,e},setTranslation:function(t,e,r){return t!==(r=r||y())&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11]),r[12]=e[0],r[13]=e[1],r[14]=e[2],r[15]=1,r},transformDirection:g,transformNormal:function(t,e,r){r=r||i();const n=b(t),o=e[0],a=e[1],s=e[2];return r[0]=o*n[0]+a*n[1]+s*n[2],r[1]=o*n[4]+a*n[5]+s*n[6],r[2]=o*n[8]+a*n[9]+s*n[10],r},transformPoint:v,translate:function(t,e,r){r=r||new p(16);const n=e[0],i=e[1],o=e[2],a=t[0],s=t[1],u=t[2],l=t[3],c=t[4],f=t[5],h=t[6],d=t[7],m=t[8],y=t[9],b=t[10],v=t[11],g=t[12],_=t[13],x=t[14],w=t[15];return t!==r&&(r[0]=a,r[1]=s,r[2]=u,r[3]=l,r[4]=c,r[5]=f,r[6]=h,r[7]=d,r[8]=m,r[9]=y,r[10]=b,r[11]=v),r[12]=a*n+c*i+m*o+g,r[13]=s*n+f*i+y*o+_,r[14]=u*n+h*i+b*o+x,r[15]=l*n+d*i+v*o+w,r},translation:function(t,e){return(e=e||new p(16))[0]=1,e[1]=0,e[2]=0,e[3]=0,e[4]=0,e[5]=1,e[6]=0,e[7]=0,e[8]=0,e[9]=0,e[10]=1,e[11]=0,e[12]=t[0],e[13]=t[1],e[14]=t[2],e[15]=1,e},transpose:function(t,e){if((e=e||new p(16))===t){let r;return r=t[1],t[1]=t[4],t[4]=r,r=t[2],t[2]=t[8],t[8]=r,r=t[3],t[3]=t[12],t[12]=r,r=t[6],t[6]=t[9],t[9]=r,r=t[7],t[7]=t[13],t[13]=r,r=t[11],t[11]=t[14],t[14]=r,e}const r=t[0],n=t[1],i=t[2],o=t[3],a=t[4],s=t[5],u=t[6],l=t[7],c=t[8],f=t[9],h=t[10],d=t[11],m=t[12],y=t[13],b=t[14],v=t[15];return e[0]=r,e[1]=a,e[2]=c,e[3]=m,e[4]=n,e[5]=s,e[6]=f,e[7]=y,e[8]=i,e[9]=u,e[10]=h,e[11]=b,e[12]=o,e[13]=l,e[14]=d,e[15]=v,e}});const x=5120,w=5121,k=5122,E=5123,S=5124,A=5125,T=5126,C={};{const t=C;t[x]=Int8Array,t[w]=Uint8Array,t[k]=Int16Array,t[E]=Uint16Array,t[S]=Int32Array,t[A]=Uint32Array,t[T]=Float32Array,t[32819]=Uint16Array,t[32820]=Uint16Array,t[33635]=Uint16Array,t[5131]=Uint16Array,t[33640]=Uint32Array,t[35899]=Uint32Array,t[35902]=Uint32Array,t[36269]=Uint32Array,t[34042]=Uint32Array}function P(t){if(t instanceof Int8Array)return x;if(t instanceof Uint8Array)return w;if(t instanceof Uint8ClampedArray)return w;if(t instanceof Int16Array)return k;if(t instanceof Uint16Array)return E;if(t instanceof Int32Array)return S;if(t instanceof Uint32Array)return A;if(t instanceof Float32Array)return T;throw new Error("unsupported typed array type")}function F(t){if(t===Int8Array)return x;if(t===Uint8Array)return w;if(t===Uint8ClampedArray)return w;if(t===Int16Array)return k;if(t===Uint16Array)return E;if(t===Int32Array)return S;if(t===Uint32Array)return A;if(t===Float32Array)return T;throw new Error("unsupported typed array type")}function M(t){const e=C[t];if(!e)throw new Error("unknown gl type");return e}const D="undefined"!=typeof SharedArrayBuffer?function(t){return t&&t.buffer&&(t.buffer instanceof ArrayBuffer||t.buffer instanceof SharedArrayBuffer)}:function(t){return t&&t.buffer&&t.buffer instanceof ArrayBuffer};var O=Object.freeze({__proto__:null,getGLTypeForTypedArray:P,getGLTypeForTypedArrayType:F,getTypedArrayTypeForGLType:M,isArrayBuffer:D});function I(t,e){Object.keys(e).forEach((function(r){e.hasOwnProperty(r)&&t.hasOwnProperty(r)&&(e[r]=t[r])}))}function B(...t){console.error(...t)}function R(...t){console.warn(...t)}function L(t,e){return"undefined"!=typeof WebGLRenderbuffer&&e instanceof WebGLRenderbuffer}function z(t,e){return"undefined"!=typeof WebGLTexture&&e instanceof WebGLTexture}const j=35044,N=34962,U=34963,W=34660,G=5120,V=5121,H=5122,X=5123,K=5124,q=5125,J=5126,Y={attribPrefix:""};function Z(t){Y.attribPrefix=t}function Q(t){I(t,Y)}function $(t,e,r,n,i){t.bindBuffer(e,r),t.bufferData(e,n,i||j)}function tt(t,e,r,n){if(i=e,"undefined"!=typeof WebGLBuffer&&i instanceof WebGLBuffer)return e;var i;r=r||N;const o=t.createBuffer();return $(t,r,o,e,n),o}function et(t){return"indices"===t}function rt(t){return t.length?t:t.data}const nt=/coord|texture/i,it=/color|colour/i;function ot(t,e){let r;if(r=nt.test(t)?2:it.test(t)?4:3,e%r>0)throw new Error(`Can not guess numComponents for attribute '${t}'. Tried ${r} but ${e} values is not evenly divisible by ${r}. You should specify it.`);return r}function at(t,e){return t.numComponents||t.size||ot(e,rt(t).length)}function st(t,e){if(D(t))return t;if(D(t.data))return t.data;Array.isArray(t)&&(t={data:t});let r=t.type;return r||(r=et(e)?Uint16Array:Float32Array),new r(t.data)}function ut(t,e){const r={};return Object.keys(e).forEach((function(n){if(!et(n)){const o=e[n],a=o.attrib||o.name||o.attribName||Y.attribPrefix+n;if(o.value){if(!Array.isArray(o.value)&&!D(o.value))throw new Error("array.value is not array or typedarray");r[a]={value:o.value}}else{let e,s,u,l;if(o.buffer&&o.buffer instanceof WebGLBuffer)e=o.buffer,l=o.numComponents||o.size,s=o.type,u=o.normalize;else if("number"==typeof o||"number"==typeof o.data){const r=o.data||o,a=o.type||Float32Array,c=r*a.BYTES_PER_ELEMENT;s=F(a),u=void 0!==o.normalize?o.normalize:(i=a)===Int8Array||i===Uint8Array,l=o.numComponents||o.size||ot(n,r),e=t.createBuffer(),t.bindBuffer(N,e),t.bufferData(N,c,o.drawType||j)}else{const r=st(o,n);e=tt(t,r,void 0,o.drawType),s=P(r),u=void 0!==o.normalize?o.normalize:function(t){return t instanceof Int8Array||t instanceof Uint8Array}(r),l=at(o,n)}r[a]={buffer:e,numComponents:l,type:s,normalize:u,stride:o.stride||0,offset:o.offset||0,divisor:void 0===o.divisor?void 0:o.divisor,drawType:o.drawType}}}var i})),t.bindBuffer(N,null),r}function lt(t,e,r,n){r=st(r),void 0!==n?(t.bindBuffer(N,e.buffer),t.bufferSubData(N,n,r)):$(t,N,e.buffer,r,e.drawType)}const ct=["position","positions","a_position"];function ft(t,e){let r,n;for(n=0;n<ct.length&&(r=ct[n],!(r in e))&&(r=Y.attribPrefix+r,!(r in e));++n);n===ct.length&&(r=Object.keys(e)[0]);const i=e[r];if(!i.buffer)return 1;t.bindBuffer(N,i.buffer);const o=t.getBufferParameter(N,W);t.bindBuffer(N,null);var a;const s=o/((a=i.type)===G||a===V?1:a===H||a===X?2:a===K||a===q||a===J?4:0),u=i.numComponents||i.size,l=s/u;if(l%1!=0)throw new Error(`numComponents ${u} not correct for length ${length}`);return l}function ht(t,e,r){const n=ut(t,e),i=Object.assign({},r||{});i.attribs=Object.assign({},r?r.attribs:{},n);const o=e.indices;if(o){const e=st(o,"indices");i.indices=tt(t,e,U),i.numElements=e.length,i.elementType=P(e)}else i.numElements||(i.numElements=ft(t,i.attribs));return i}function dt(t,e,r){const n="indices"===r?U:N;return tt(t,st(e,r),n)}function pt(t,e){const r={};return Object.keys(e).forEach((function(n){r[n]=dt(t,e[n],n)})),e.indices?(r.numElements=e.indices.length,r.elementType=P(st(e.indices))):r.numElements=function(t){let e,r;for(r=0;r<ct.length&&(e=ct[r],!(e in t));++r);r===ct.length&&(e=Object.keys(t)[0]);const n=t[e],i=rt(n).length;if(void 0===i)return 1;const o=at(n,e),a=i/o;if(i%o>0)throw new Error(`numComponents ${o} not correct for length ${i}`);return a}(e),r}var mt=Object.freeze({__proto__:null,createAttribsFromArrays:ut,createBuffersFromArrays:pt,createBufferFromArray:dt,createBufferFromTypedArray:tt,createBufferInfoFromArrays:ht,setAttribInfoBufferFromArray:lt,setAttributePrefix:Z,setAttributeDefaults_:Q,getNumComponents_:at,getArray_:rt});const yt=rt,bt=at;function vt(t,e){let r=0;return t.push=function(){for(let e=0;e<arguments.length;++e){const n=arguments[e];if(n instanceof Array||D(n))for(let e=0;e<n.length;++e)t[r++]=n[e];else t[r++]=n}},t.reset=function(t){r=t||0},t.numComponents=e,Object.defineProperty(t,"numElements",{get:function(){return this.length/this.numComponents|0}}),t}function gt(t,e,r){return vt(new(r||Float32Array)(t*e),t)}function _t(t){return"indices"!==t}function xt(t,e,r){const n=t.length,i=new Float32Array(3);for(let o=0;o<n;o+=3)r(e,[t[o],t[o+1],t[o+2]],i),t[o]=i[0],t[o+1]=i[1],t[o+2]=i[2]}function wt(t,e,r){r=r||i();const n=e[0],o=e[1],a=e[2];return r[0]=n*t[0]+o*t[1]+a*t[2],r[1]=n*t[4]+o*t[5]+a*t[6],r[2]=n*t[8]+o*t[9]+a*t[10],r}function kt(t,e){return xt(t,e,g),t}function Et(t,e){return xt(t,b(e),wt),t}function St(t,e){return xt(t,e,v),t}function At(t,e){return Object.keys(t).forEach((function(r){const n=t[r];r.indexOf("pos")>=0?St(n,e):r.indexOf("tan")>=0||r.indexOf("binorm")>=0?kt(n,e):r.indexOf("norm")>=0&&Et(n,e)})),t}function Tt(t,e,r){return t=t||2,{position:{numComponents:2,data:[(e=e||0)+-1*(t*=.5),(r=r||0)+-1*t,e+1*t,r+-1*t,e+-1*t,r+1*t,e+1*t,r+1*t]},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 Ct(t,e,r,n,i){t=t||1,e=e||1,r=r||1,n=n||1,i=i||y();const o=(r+1)*(n+1),a=gt(3,o),s=gt(3,o),u=gt(2,o);for(let i=0;i<=n;i++)for(let o=0;o<=r;o++){const l=o/r,c=i/n;a.push(t*l-.5*t,0,e*c-.5*e),s.push(0,1,0),u.push(l,c)}const l=r+1,c=gt(3,r*n*2,Uint16Array);for(let t=0;t<n;t++)for(let e=0;e<r;e++)c.push((t+0)*l+e,(t+1)*l+e,(t+0)*l+e+1),c.push((t+1)*l+e,(t+1)*l+e+1,(t+0)*l+e+1);return At({position:a,normal:s,texcoord:u,indices:c},i)}function Pt(t,e,r,n,i,o,a){if(e<=0||r<=0)throw new Error("subdivisionAxis and subdivisionHeight must be > 0");n=n||0,o=o||0;const s=(i=i||Math.PI)-n,u=(a=a||2*Math.PI)-o,l=(e+1)*(r+1),c=gt(3,l),f=gt(3,l),h=gt(2,l);for(let i=0;i<=r;i++)for(let a=0;a<=e;a++){const l=a/e,d=i/r,p=u*l+o,m=s*d+n,y=Math.sin(p),b=Math.cos(p),v=Math.sin(m),g=b*v,_=Math.cos(m),x=y*v;c.push(t*g,t*_,t*x),f.push(g,_,x),h.push(1-l,d)}const d=e+1,p=gt(3,e*r*2,Uint16Array);for(let t=0;t<e;t++)for(let e=0;e<r;e++)p.push((e+0)*d+t,(e+0)*d+t+1,(e+1)*d+t),p.push((e+1)*d+t,(e+0)*d+t+1,(e+1)*d+t+1);return{position:c,normal:f,texcoord:h,indices:p}}const Ft=[[3,7,5,1],[6,2,0,4],[6,7,3,2],[0,1,5,4],[7,6,4,5],[2,3,1,0]];function Mt(t){const e=(t=t||1)/2,r=[[-e,-e,-e],[+e,-e,-e],[-e,+e,-e],[+e,+e,-e],[-e,-e,+e],[+e,-e,+e],[-e,+e,+e],[+e,+e,+e]],n=[[1,0,0],[-1,0,0],[0,1,0],[0,-1,0],[0,0,1],[0,0,-1]],i=[[1,0],[0,0],[0,1],[1,1]],o=gt(3,24),a=gt(3,24),s=gt(2,24),u=gt(3,12,Uint16Array);for(let t=0;t<6;++t){const e=Ft[t];for(let u=0;u<4;++u){const l=r[e[u]],c=n[t],f=i[u];o.push(l),a.push(c),s.push(f)}const l=4*t;u.push(l+0,l+1,l+2),u.push(l+0,l+2,l+3)}return{position:o,normal:a,texcoord:s,indices:u}}function Dt(t,e,r,n,i,o,a){if(n<3)throw new Error("radialSubdivisions must be 3 or greater");if(i<1)throw new Error("verticalSubdivisions must be 1 or greater");const s=void 0===o||o,u=void 0===a||a,l=(s?2:0)+(u?2:0),c=(n+1)*(i+1+l),f=gt(3,c),h=gt(3,c),d=gt(2,c),p=gt(3,n*(i+l/2)*2,Uint16Array),m=n+1,y=Math.atan2(t-e,r),b=Math.cos(y),v=Math.sin(y),g=i+(u?2:0);for(let o=s?-2:0;o<=g;++o){let a,s=o/i,u=r*s;o<0?(u=0,s=1,a=t):o>i?(u=r,s=1,a=e):a=t+o/i*(e-t),-2!==o&&o!==i+2||(a=0,s=0),u-=r/2;for(let t=0;t<m;++t){const e=Math.sin(t*Math.PI*2/n),r=Math.cos(t*Math.PI*2/n);f.push(e*a,u,r*a),o<0?h.push(0,-1,0):o>i?h.push(0,1,0):0===a?h.push(0,0,0):h.push(e*b,v,r*b),d.push(t/n,1-s)}}for(let t=0;t<i+l;++t)if(!(1===t&&s||t===i+l-2&&u))for(let e=0;e<n;++e)p.push(m*(t+0)+0+e,m*(t+0)+1+e,m*(t+1)+1+e),p.push(m*(t+0)+0+e,m*(t+1)+1+e,m*(t+1)+0+e);return{position:f,normal:h,texcoord:d,indices:p}}function Ot(t,e){e=e||[];const r=[];for(let n=0;n<t.length;n+=4){const i=t[n],o=t.slice(n+1,n+4);o.push.apply(o,e);for(let t=0;t<i;++t)r.push.apply(r,o)}return r}function It(){const t=[0,0,0,0,150,0,30,0,0,0,150,0,30,150,0,30,0,0,30,0,0,30,30,0,100,0,0,30,30,0,100,30,0,100,0,0,30,60,0,30,90,0,67,60,0,30,90,0,67,90,0,67,60,0,0,0,30,30,0,30,0,150,30,0,150,30,30,0,30,30,150,30,30,0,30,100,0,30,30,30,30,30,30,30,100,0,30,100,30,30,30,60,30,67,60,30,30,90,30,30,90,30,67,60,30,67,90,30,0,0,0,100,0,0,100,0,30,0,0,0,100,0,30,0,0,30,100,0,0,100,30,0,100,30,30,100,0,0,100,30,30,100,0,30,30,30,0,30,30,30,100,30,30,30,30,0,100,30,30,100,30,0,30,30,0,30,60,30,30,30,30,30,30,0,30,60,0,30,60,30,30,60,0,67,60,30,30,60,30,30,60,0,67,60,0,67,60,30,67,60,0,67,90,30,67,60,30,67,60,0,67,90,0,67,90,30,30,90,0,30,90,30,67,90,30,30,90,0,67,90,30,67,90,0,30,90,0,30,150,30,30,90,30,30,90,0,30,150,0,30,150,30,0,150,0,0,150,30,30,150,30,0,150,0,30,150,30,30,150,0,0,0,0,0,0,30,0,150,30,0,0,0,0,150,30,0,150,0],e=Ot([18,0,0,1,18,0,0,-1,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,1,0,6,1,0,0,6,0,-1,0,6,1,0,0,6,0,-1,0,6,-1,0,0]),r=Ot([18,200,70,120,18,80,70,200,6,70,200,210,6,200,200,70,6,210,100,70,6,210,160,70,6,70,180,210,6,100,70,210,6,76,210,100,6,140,210,80,6,90,130,110,6,160,160,220],[255]),n=t.length/3,i={position:gt(3,n),texcoord:gt(2,n),normal:gt(3,n),color:gt(4,n,Uint8Array),indices:gt(3,n/3,Uint16Array)};i.position.push(t),i.texcoord.push([.22,.19,.22,.79,.34,.19,.22,.79,.34,.79,.34,.19,.34,.19,.34,.31,.62,.19,.34,.31,.62,.31,.62,.19,.34,.43,.34,.55,.49,.43,.34,.55,.49,.55,.49,.43,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,0,1,0,1,1,0,1,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,1,1,0,1,0,0,1,0,1,1,0,0,0,1,1,1,0,0,1,1,1,0,0,0,0,1,1,1,0,0,1,1,1,0]),i.normal.push(e),i.color.push(r);for(let t=0;t<n;++t)i.indices.push(t);return i}function Bt(t,e,r,n,i,a,s){if(i<=0)throw new Error("subdivisionDown must be > 0");const u=(s=s||1)-(a=a||0),c=2*(i+1)*4,f=gt(3,c),h=gt(3,c),d=gt(2,c);function p(t,e,r){return t+(e-t)*r}function m(e,r,s,c,m,y){for(let b=0;b<=i;b++){const v=r/1,g=b/i,_=2*(v-.5),x=(a+g*u)*Math.PI,w=Math.sin(x),k=Math.cos(x),E=p(t,e,w),S=_*n,A=k*t,T=w*E;f.push(S,A,T);const C=o(l([0,w,k],s),c);h.push(C),d.push(v*m+y,g)}}for(let t=0;t<2;t++){const n=2*(t/1-.5);m(e,t,[1,1,1],[0,0,0],1,0),m(e,t,[0,0,0],[n,0,0],0,0),m(r,t,[1,1,1],[0,0,0],1,0),m(r,t,[0,0,0],[n,0,0],0,1)}const y=gt(3,2*i*4,Uint16Array);function b(t,e){for(let r=0;r<i;++r)y.push(t+r+0,t+r+1,e+r+0),y.push(t+r+1,e+r+1,e+r+0)}const v=i+1;return b(0*v,4*v),b(5*v,7*v),b(6*v,2*v),b(3*v,1*v),{position:f,normal:h,texcoord:d,indices:y}}function Rt(t,e,r,n,i,o){return Dt(t,t,e,r,n,i,o)}function Lt(t,e,r,n,i,o){if(r<3)throw new Error("radialSubdivisions must be 3 or greater");if(n<3)throw new Error("verticalSubdivisions must be 3 or greater");i=i||0;const a=(o=o||2*Math.PI)-i,s=r+1,u=n+1,l=s*u,c=gt(3,l),f=gt(3,l),h=gt(2,l),d=gt(3,r*n*2,Uint16Array);for(let o=0;o<u;++o){const u=o/n,l=u*Math.PI*2,d=Math.sin(l),p=t+d*e,m=Math.cos(l),y=m*e;for(let t=0;t<s;++t){const e=t/r,n=i+e*a,o=Math.sin(n),s=Math.cos(n),l=o*p,b=s*p,v=o*d,g=s*d;c.push(l,y,b),f.push(v,m,g),h.push(e,1-u)}}for(let t=0;t<n;++t)for(let e=0;e<r;++e){const r=1+e,n=1+t;d.push(s*t+e,s*n+e,s*t+r),d.push(s*n+e,s*n+r,s*t+r)}return{position:c,normal:f,texcoord:h,indices:d}}function zt(t,e,r,n,i){if(e<3)throw new Error("divisions must be at least 3");i=i||1,n=n||0;const o=(e+1)*((r=r||1)+1),a=gt(3,o),s=gt(3,o),u=gt(2,o),l=gt(3,r*e*2,Uint16Array);let c=0;const f=t-n,h=e+1;for(let t=0;t<=r;++t){const o=n+f*Math.pow(t/r,i);for(let n=0;n<=e;++n){const i=2*Math.PI*n/e,f=o*Math.cos(i),d=o*Math.sin(i);if(a.push(f,0,d),s.push(0,1,0),u.push(1-n/e,t/r),t>0&&n!==e){const t=c+(n+1),e=c+n,r=c+n-h,i=c+(n+1)-h;l.push(t,e,r),l.push(t,r,i)}}c+=e+1}return{position:a,normal:s,texcoord:u,indices:l}}function jt(t){return function(e){return pt(e,t.apply(this,Array.prototype.slice.call(arguments,1)))}}function Nt(t){return function(e){return ht(e,t.apply(null,Array.prototype.slice.call(arguments,1)))}}const Ut=["numComponents","size","type","normalize","stride","offset","attrib","name","attribName"];function Wt(t,e,r,n){n=n||0;const i=t.length;for(let o=0;o<i;++o)e[r+o]=t[o]+n}function Gt(t,e){const r=yt(t),n=new r.constructor(e);let i=n;var o,a;return r.numComponents&&r.numElements&&vt(n,r.numComponents),t.data&&(i={data:n},o=t,a=i,Ut.forEach((function(t){const e=o[t];void 0!==e&&(a[t]=e)}))),i}const Vt=Nt(It),Ht=jt(It),Xt=Nt(Mt),Kt=jt(Mt),qt=Nt(Ct),Jt=jt(Ct),Yt=Nt(Pt),Zt=jt(Pt),Qt=Nt(Dt),$t=jt(Dt),te=Nt(Tt),ee=jt(Tt),re=Nt(Bt),ne=jt(Bt),ie=Nt(Rt),oe=jt(Rt),ae=Nt(Lt),se=jt(Lt),ue=Nt(zt),le=jt(zt),ce=re,fe=ne,he=Bt;var de=Object.freeze({__proto__:null,create3DFBufferInfo:Vt,create3DFBuffers:Ht,create3DFVertices:It,createAugmentedTypedArray:gt,createCubeBufferInfo:Xt,createCubeBuffers:Kt,createCubeVertices:Mt,createPlaneBufferInfo:qt,createPlaneBuffers:Jt,createPlaneVertices:Ct,createSphereBufferInfo:Yt,createSphereBuffers:Zt,createSphereVertices:Pt,createTruncatedConeBufferInfo:Qt,createTruncatedConeBuffers:$t,createTruncatedConeVertices:Dt,createXYQuadBufferInfo:te,createXYQuadBuffers:ee,createXYQuadVertices:Tt,createCresentBufferInfo:ce,createCresentBuffers:fe,createCresentVertices:he,createCrescentBufferInfo:re,createCrescentBuffers:ne,createCrescentVertices:Bt,createCylinderBufferInfo:ie,createCylinderBuffers:oe,createCylinderVertices:Rt,createTorusBufferInfo:ae,createTorusBuffers:se,createTorusVertices:Lt,createDiscBufferInfo:ue,createDiscBuffers:le,createDiscVertices:zt,deindexVertices:function(t){const e=t.indices,r={},n=e.length;return Object.keys(t).filter(_t).forEach((function(i){const o=t[i],a=o.numComponents,s=gt(a,n,o.constructor);for(let t=0;t<n;++t){const r=e[t]*a;for(let t=0;t<a;++t)s.push(o[r+t])}r[i]=s})),r},flattenNormals:function(t){if(t.indices)throw new Error("can not flatten normals of indexed vertices. deindex them first");const e=t.normal,r=e.length;for(let t=0;t<r;t+=9){const r=e[t+0],n=e[t+1],i=e[t+2],o=e[t+3],a=e[t+4],s=e[t+5];let u=r+o+e[t+6],l=n+a+e[t+7],c=i+s+e[t+8];const f=Math.sqrt(u*u+l*l+c*c);u/=f,l/=f,c/=f,e[t+0]=u,e[t+1]=l,e[t+2]=c,e[t+3]=u,e[t+4]=l,e[t+5]=c,e[t+6]=u,e[t+7]=l,e[t+8]=c}return t},makeRandomVertexColors:function(t,e){e=e||{};const r=t.position.numElements,n=gt(4,r,Uint8Array),i=e.rand||function(t,e){return e<3?(r=256,Math.random()*r|0):255;var r};if(t.color=n,t.indices)for(let t=0;t<r;++t)n.push(i(t,0),i(t,1),i(t,2),i(t,3));else{const t=e.vertsPerColor||3,o=r/t;for(let e=0;e<o;++e){const r=[i(e,0),i(e,1),i(e,2),i(e,3)];for(let e=0;e<t;++e)n.push(r)}}return t},reorientDirections:kt,reorientNormals:Et,reorientPositions:St,reorientVertices:At,concatVertices:function(t){const e={};let r;for(let n=0;n<t.length;++n){const i=t[n];Object.keys(i).forEach((function(t){e[t]||(e[t]=[]),r||"indices"===t||(r=t);const n=i[t],o=bt(n,t),a=yt(n).length/o;e[t].push(a)}))}const n=e[r],i={};return Object.keys(e).forEach((function(e){const r=function(e){let r,n=0;for(let i=0;i<t.length;++i){const o=t[i][e];n+=yt(o).length,r&&!o.data||(r=o)}return{length:n,spec:r}}(e),o=Gt(r.spec,r.length);!function(e,r,n){let i=0,o=0;for(let a=0;a<t.length;++a){const s=t[a][e],u=yt(s);"indices"===e?(Wt(u,n,o,i),i+=r[a]):Wt(u,n,o),o+=u.length}}(e,n,yt(o)),i[e]=o})),i},duplicateVertices:function(t){const e={};return Object.keys(t).forEach((function(r){const n=t[r],i=yt(n),o=Gt(n,i.length);Wt(i,yt(o),0),e[r]=o})),e}});function pe(t){return!!t.texStorage2D}function me(t){return!t.texStorage2D}const ye=function(){const t={},e={};return function(r,n){return function(r){const n=r.constructor.name;if(!t[n]){for(const t in r)if("number"==typeof r[t]){const n=e[r[t]];e[r[t]]=n?`${n} | ${t}`:t}t[n]=!0}}(r),e[n]||("number"==typeof n?`0x${n.toString(16)}`:n)}}();var be=Object.freeze({__proto__:null,glEnumToString:ye,isWebGL1:me,isWebGL2:pe});const ve={textureColor:new Uint8Array([128,192,255,255]),textureOptions:{},crossOrigin:void 0},ge=D,_e=function(){let t;return function(){return t=t||("undefined"!=typeof document&&document.createElement?document.createElement("canvas").getContext("2d"):null),t}}(),xe=6406,we=6407,ke=6408,Ee=6409,Se=6410,Ae=6402,Te=34041,Ce=33071,Pe=9728,Fe=9729,Me=3553,De=34067,Oe=32879,Ie=35866,Be=34069,Re=34070,Le=34071,ze=34072,je=34073,Ne=34074,Ue=10241,We=10240,Ge=10242,Ve=10243,He=32882,Xe=33082,Ke=33083,qe=33084,Je=33085,Ye=3317,Ze=3314,Qe=32878,$e=3316,tr=3315,er=32877,rr=37443,nr=37441,ir=37440,or=33321,ar=36756,sr=33325,ur=33326,lr=33330,cr=33329,fr=33338,hr=33337,dr=33340,pr=33339,mr=33323,yr=36757,br=33327,vr=33328,gr=33336,_r=33335,xr=33332,wr=33331,kr=33334,Er=33333,Sr=32849,Ar=35905,Tr=36194,Cr=36758,Pr=35898,Fr=35901,Mr=34843,Dr=34837,Or=36221,Ir=36239,Br=36215,Rr=36233,Lr=36209,zr=36227,jr=32856,Nr=35907,Ur=36759,Wr=32855,Gr=32854,Vr=32857,Hr=34842,Xr=34836,Kr=36220,qr=36238,Jr=36975,Yr=36214,Zr=36232,Qr=36226,$r=36208,tn=33189,en=33190,rn=36012,nn=36013,on=35056,an=5120,sn=5121,un=5122,ln=5123,cn=5124,fn=5125,hn=5126,dn=32819,pn=32820,mn=33635,yn=5131,bn=36193,vn=33640,gn=35899,_n=35902,xn=36269,wn=34042,kn=33319,En=33320,Sn=6403,An=36244,Tn=36248,Cn=36249,Pn={};{const t=Pn;t[xe]={numColorComponents:1},t[Ee]={numColorComponents:1},t[Se]={numColorComponents:2},t[we]={numColorComponents:3},t[ke]={numColorComponents:4},t[Sn]={numColorComponents:1},t[An]={numColorComponents:1},t[kn]={numColorComponents:2},t[En]={numColorComponents:2},t[we]={numColorComponents:3},t[Tn]={numColorComponents:3},t[ke]={numColorComponents:4},t[Cn]={numColorComponents:4},t[Ae]={numColorComponents:1},t[Te]={numColorComponents:2}}let Fn;function Mn(t){if(!Fn){const t={};t[xe]={textureFormat:xe,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[sn,yn,bn,hn]},t[Ee]={textureFormat:Ee,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1,2,2,4],type:[sn,yn,bn,hn]},t[Se]={textureFormat:Se,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2,4,4,8],type:[sn,yn,bn,hn]},t[we]={textureFormat:we,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,6,6,12,2],type:[sn,yn,bn,hn,mn]},t[ke]={textureFormat:ke,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,8,8,16,2,2],type:[sn,yn,bn,hn,dn,pn]},t[Ae]={textureFormat:Ae,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[fn,ln]},t[or]={textureFormat:Sn,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[1],type:[sn]},t[ar]={textureFormat:Sn,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[1],type:[an]},t[sr]={textureFormat:Sn,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4,2],type:[hn,yn]},t[ur]={textureFormat:Sn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[4],type:[hn]},t[lr]={textureFormat:An,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[sn]},t[cr]={textureFormat:An,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[1],type:[an]},t[xr]={textureFormat:An,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[ln]},t[wr]={textureFormat:An,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[un]},t[kr]={textureFormat:An,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[fn]},t[Er]={textureFormat:An,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[cn]},t[mr]={textureFormat:kn,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[2],type:[sn]},t[yr]={textureFormat:kn,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[2],type:[an]},t[br]={textureFormat:kn,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[8,4],type:[hn,yn]},t[vr]={textureFormat:kn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[8],type:[hn]},t[gr]={textureFormat:En,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[sn]},t[_r]={textureFormat:En,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2],type:[an]},t[fr]={textureFormat:En,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[ln]},t[hr]={textureFormat:En,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[un]},t[dr]={textureFormat:En,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[fn]},t[pr]={textureFormat:En,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[cn]},t[Sr]={textureFormat:we,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3],type:[sn]},t[Ar]={textureFormat:we,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[sn]},t[Tr]={textureFormat:we,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[3,2],type:[sn,mn]},t[Cr]={textureFormat:we,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[3],type:[an]},t[Pr]={textureFormat:we,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[hn,yn,gn]},t[Fr]={textureFormat:we,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6,4],type:[hn,yn,_n]},t[Mr]={textureFormat:we,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[12,6],type:[hn,yn]},t[Dr]={textureFormat:we,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[hn]},t[Or]={textureFormat:Tn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[sn]},t[Ir]={textureFormat:Tn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[3],type:[an]},t[Br]={textureFormat:Tn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[ln]},t[Rr]={textureFormat:Tn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[6],type:[un]},t[Lr]={textureFormat:Tn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[fn]},t[zr]={textureFormat:Tn,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[12],type:[cn]},t[jr]={textureFormat:ke,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[sn]},t[Nr]={textureFormat:ke,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[sn]},t[Ur]={textureFormat:ke,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[4],type:[an]},t[Wr]={textureFormat:ke,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2,4],type:[sn,pn,vn]},t[Gr]={textureFormat:ke,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4,2],type:[sn,dn]},t[Vr]={textureFormat:ke,colorRenderable:!0,textureFilterable:!0,bytesPerElement:[4],type:[vn]},t[Hr]={textureFormat:ke,colorRenderable:!1,textureFilterable:!0,bytesPerElement:[16,8],type:[hn,yn]},t[Xr]={textureFormat:ke,colorRenderable:!1,textureFilterable:!1,bytesPerElement:[16],type:[hn]},t[Kr]={textureFormat:Cn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[sn]},t[qr]={textureFormat:Cn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[an]},t[Jr]={textureFormat:Cn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[vn]},t[Yr]={textureFormat:Cn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[ln]},t[Zr]={textureFormat:Cn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[8],type:[un]},t[Qr]={textureFormat:Cn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[cn]},t[$r]={textureFormat:Cn,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[16],type:[fn]},t[tn]={textureFormat:Ae,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[2,4],type:[ln,fn]},t[en]={textureFormat:Ae,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[fn]},t[rn]={textureFormat:Ae,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[hn]},t[on]={textureFormat:Te,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[wn]},t[nn]={textureFormat:Te,colorRenderable:!0,textureFilterable:!1,bytesPerElement:[4],type:[xn]},Object.keys(t).forEach((function(e){const r=t[e];r.bytesPerElementMap={},r.bytesPerElement.forEach((function(t,e){const n=r.type[e];r.bytesPerElementMap[n]=t}))})),Fn=t}return Fn[t]}function Dn(t,e){const r=Mn(t);if(!r)throw"unknown internal format";const n=r.bytesPerElementMap[e];if(void 0===n)throw"unknown internal format";return n}function On(t){const e=Mn(t);if(!e)throw"unknown internal format";return{format:e.textureFormat,type:e.type[0]}}function In(t){return!(t&t-1)}function Bn(t,e,r,n){if(!pe(t))return In(e)&&In(r);const i=Mn(n);if(!i)throw"unknown internal format";return i.colorRenderable&&i.textureFilterable}function Rn(t){const e=Mn(t);if(!e)throw"unknown internal format";return e.textureFilterable}function Ln(t){const e=Pn[t];if(!e)throw"unknown format: "+t;return e.numColorComponents}function zn(t,e,r){return ge(e)?P(e):r||sn}function jn(t,e,r,n,i){if(i%1!=0)throw"can't guess dimensions";if(r||n){if(n){if(!r&&(r=i/n)%1)throw"can't guess dimensions"}else if((n=i/r)%1)throw"can't guess dimensions"}else{const t=Math.sqrt(i/(e===De?6:1));t%1==0?(r=t,n=t):(r=i,n=1)}return{width:r,height:n}}function Nn(t){ve.textureColor=new Uint8Array([255*t[0],255*t[1],255*t[2],255*t[3]])}function Un(t){I(t,ve),t.textureColor&&Nn(t.textureColor)}function Wn(t,e){void 0!==e.colorspaceConversion&&t.pixelStorei(rr,e.colorspaceConversion),void 0!==e.premultiplyAlpha&&t.pixelStorei(nr,e.premultiplyAlpha),void 0!==e.flipY&&t.pixelStorei(ir,e.flipY)}function Gn(t){t.pixelStorei(Ye,4),pe(t)&&(t.pixelStorei(Ze,0),t.pixelStorei(Qe,0),t.pixelStorei($e,0),t.pixelStorei(tr,0),t.pixelStorei(er,0))}function Vn(t,e,r,n){var i;n.minMag&&(r.call(t,e,Ue,n.minMag),r.call(t,e,We,n.minMag)),n.min&&r.call(t,e,Ue,n.min),n.mag&&r.call(t,e,We,n.mag),n.wrap&&(r.call(t,e,Ge,n.wrap),r.call(t,e,Ve,n.wrap),(e===Oe||(i=e,"undefined"!=typeof WebGLSampler&&i instanceof WebGLSampler))&&r.call(t,e,He,n.wrap)),n.wrapR&&r.call(t,e,He,n.wrapR),n.wrapS&&r.call(t,e,Ge,n.wrapS),n.wrapT&&r.call(t,e,Ve,n.wrapT),n.minLod&&r.call(t,e,Xe,n.minLod),n.maxLod&&r.call(t,e,Ke,n.maxLod),n.baseLevel&&r.call(t,e,qe,n.baseLevel),n.maxLevel&&r.call(t,e,Je,n.maxLevel)}function Hn(t,e,r){const n=r.target||Me;t.bindTexture(n,e),Vn(t,n,t.texParameteri,r)}function Xn(t,e,r){Vn(t,e,t.samplerParameteri,r)}function Kn(t,e){const r=t.createSampler();return Xn(t,r,e),r}function qn(t,e){const r={};return Object.keys(e).forEach((function(n){r[n]=Kn(t,e[n])})),r}function Jn(t,e,r,n,i,o){r=r||ve.textureOptions,o=o||ke;const a=r.target||Me;if(n=n||r.width,i=i||r.height,t.bindTexture(a,e),Bn(t,n,i,o))t.generateMipmap(a);else{const e=Rn(o)?Fe:Pe;t.texParameteri(a,Ue,e),t.texParameteri(a,We,e),t.texParameteri(a,Ge,Ce),t.texParameteri(a,Ve,Ce)}}function Yn(t){return!0===t.auto||void 0===t.auto&&void 0===t.level}function Zn(t,e){return(e=e||{}).cubeFaceOrder||[Be,Re,Le,ze,je,Ne]}function Qn(t,e){const r=Zn(0,e).map((function(t,e){return{face:t,ndx:e}}));return r.sort((function(t,e){return t.face-e.face})),r}function $n(t,e,r,n){const i=(n=n||ve.textureOptions).target||Me,o=n.level||0;let a=r.width,s=r.height;const u=n.internalFormat||n.format||ke,l=On(u),c=n.format||l.format,f=n.type||l.type;if(Wn(t,n),t.bindTexture(i,e),i===De){const l=r.width,h=r.height;let d,p;if(l/6===h)d=h,p=[0,0,1,0,2,0,3,0,4,0,5,0];else if(h/6===l)d=l,p=[0,0,0,1,0,2,0,3,0,4,0,5];else if(l/3==h/2)d=l/3,p=[0,0,1,0,2,0,0,1,1,1,2,1];else{if(l/2!=h/3)throw"can't figure out cube map from element: "+(r.src?r.src:r.nodeName);d=l/2,p=[0,0,1,0,0,1,1,1,0,2,1,2]}const m=_e();m?(m.canvas.width=d,m.canvas.height=d,a=d,s=d,Qn(0,n).forEach((function(e){const n=p[2*e.ndx+0]*d,i=p[2*e.ndx+1]*d;m.drawImage(r,n,i,d,d,0,0,d,d),t.texImage2D(e.face,o,u,c,f,m.canvas)})),m.canvas.width=1,m.canvas.height=1):"undefined"!=typeof createImageBitmap&&(a=d,s=d,Qn(0,n).forEach((function(l){const h=p[2*l.ndx+0]*d,m=p[2*l.ndx+1]*d;t.texImage2D(l.face,o,u,d,d,0,c,f,null),createImageBitmap(r,h,m,d,d,{premultiplyAlpha:"none",colorSpaceConversion:"none"}).then((function(r){Wn(t,n),t.bindTexture(i,e),t.texImage2D(l.face,o,u,c,f,r),Yn(n)&&Jn(t,e,n,a,s,u)}))})))}else if(i===Oe||i===Ie){const e=Math.min(r.width,r.height),n=Math.max(r.width,r.height),a=n/e;if(a%1!=0)throw"can not compute 3D dimensions of element";const s=r.width===n?1:0,l=r.height===n?1:0;t.pixelStorei(Ye,1),t.pixelStorei(Ze,r.width),t.pixelStorei(Qe,0),t.pixelStorei(er,0),t.texImage3D(i,o,u,e,e,e,0,c,f,null);for(let n=0;n<a;++n){const a=n*e*s,u=n*e*l;t.pixelStorei($e,a),t.pixelStorei(tr,u),t.texSubImage3D(i,o,0,0,n,e,e,1,c,f,r)}Gn(t)}else t.texImage2D(i,o,u,c,f,r);Yn(n)&&Jn(t,e,n,a,s,u),Hn(t,e,n)}function ti(){}function ei(t,e){return void 0!==e||function(t){if("undefined"!=typeof document){const e=document.createElement("a");return e.href=t,e.hostname===location.hostname&&e.port===location.port&&e.protocol===location.protocol}{const e=new URL(location.href).origin;return new URL(t,location.href).origin===e}}(t)?e:"anonymous"}function ri(t){return"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap||"undefined"!=typeof ImageData&&t instanceof ImageData||"undefined"!=typeof HTMLElement&&t instanceof HTMLElement}function ni(t,e,r){return ri(t)?(setTimeout((function(){r(null,t)})),t):function(t,e,r){let n;if(r=r||ti,e=void 0!==e?e:ve.crossOrigin,e=ei(t,e),"undefined"!=typeof Image){n=new Image,void 0!==e&&(n.crossOrigin=e);const i=function(){n.removeEventListener("error",o),n.removeEventListener("load",a),n=null},o=function(){const e="couldn't load image: "+t;B(e),r(e,n),i()},a=function(){r(null,n),i()};return n.addEventListener("error",o),n.addEventListener("load",a),n.src=t,n}if("undefined"!=typeof ImageBitmap){let i,o;const a=function(){r(i,o)},s={};e&&(s.mode="cors"),fetch(t,s).then((function(t){if(!t.ok)throw t;return t.blob()})).then((function(t){return createImageBitmap(t,{premultiplyAlpha:"none",colorSpaceConversion:"none"})})).then((function(t){o=t,setTimeout(a)})).catch((function(t){i=t,setTimeout(a)})),n=null}return n}(t,e,r)}function ii(t,e,r){const n=(r=r||ve.textureOptions).target||Me;if(t.bindTexture(n,e),!1===r.color)return;const i=function(t){return t=t||ve.textureColor,ge(t)?t:new Uint8Array([255*t[0],255*t[1],255*t[2],255*t[3]])}(r.color);if(n===De)for(let e=0;e<6;++e)t.texImage2D(Be+e,0,ke,1,1,0,ke,sn,i);else n===Oe||n===Ie?t.texImage3D(n,0,ke,1,1,1,0,ke,sn,i):t.texImage2D(n,0,ke,1,1,0,ke,sn,i)}function oi(t,e,r,n){n=n||ti,r=r||ve.textureOptions,ii(t,e,r);return ni((r=Object.assign({},r)).src,r.crossOrigin,(function(i,o){i?n(i,e,o):($n(t,e,o,r),n(null,e,o))}))}function ai(t,e,r,n){n=n||ti;const i=r.src;if(6!==i.length)throw"there must be 6 urls for a cubemap";const o=r.level||0,a=r.internalFormat||r.format||ke,s=On(a),u=r.format||s.format,l=r.type||sn,c=r.target||Me;if(c!==De)throw"target must be TEXTURE_CUBE_MAP";ii(t,e,r),r=Object.assign({},r);let f=6;const h=[],d=Zn(0,r);let p;p=i.map((function(i,s){return ni(i,r.crossOrigin,(m=d[s],function(i,s){--f,i?h.push(i):s.width!==s.height?h.push("cubemap face img is not a square: "+s.src):(Wn(t,r),t.bindTexture(c,e),5===f?Zn().forEach((function(e){t.texImage2D(e,o,a,u,l,s)})):t.texImage2D(m,o,a,u,l,s),Yn(r)&&t.generateMipmap(c)),0===f&&n(h.length?h:void 0,e,p)}));var m}))}function si(t,e,r,n){n=n||ti;const i=r.src,o=r.internalFormat||r.format||ke,a=On(o),s=r.format||a.format,u=r.type||sn,l=r.target||Ie;if(l!==Oe&&l!==Ie)throw"target must be TEXTURE_3D or TEXTURE_2D_ARRAY";ii(t,e,r),r=Object.assign({},r);let c=i.length;const f=[];let h;const d=r.level||0;let p=r.width,m=r.height;const y=i.length;let b=!0;h=i.map((function(i,a){return ni(i,r.crossOrigin,(v=a,function(i,a){if(--c,i)f.push(i);else{if(Wn(t,r),t.bindTexture(l,e),b){b=!1,p=r.width||a.width,m=r.height||a.height,t.texImage3D(l,d,o,p,m,y,0,s,u,null);for(let e=0;e<y;++e)t.texSubImage3D(l,d,0,0,e,p,m,1,s,u,a)}else{let e,r=a;a.width===p&&a.height===m||(e=_e(),r=e.canvas,e.canvas.width=p,e.canvas.height=m,e.drawImage(a,0,0,p,m)),t.texSubImage3D(l,d,0,0,v,p,m,1,s,u,r),e&&r===e.canvas&&(e.canvas.width=0,e.canvas.height=0)}Yn(r)&&t.generateMipmap(l)}0===c&&n(f.length?f:void 0,e,h)}));var v}))}function ui(t,e,r,n){const i=(n=n||ve.textureOptions).target||Me;t.bindTexture(i,e);let o=n.width,a=n.height,s=n.depth;const u=n.level||0,l=n.internalFormat||n.format||ke,c=On(l),f=n.format||c.format,h=n.type||zn(0,r,c.type);if(ge(r))r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));else{const t=M(h);r=new t(r)}const d=Dn(l,h),p=r.byteLength/d;if(p%1)throw"length wrong size for format: "+ye(t,f);let m;if(i===Oe||i===Ie)if(o||a||s)!o||a&&s?!a||o&&s?(m=jn(0,i,o,a,p/s),o=m.width,a=m.height):(m=jn(0,i,o,s,p/a),o=m.width,s=m.height):(m=jn(0,i,a,s,p/o),a=m.width,s=m.height);else{const t=Math.cbrt(p);if(t%1!=0)throw"can't guess cube size of array of numElements: "+p;o=t,a=t,s=t}else m=jn(0,i,o,a,p),o=m.width,a=m.height;if(Gn(t),t.pixelStorei(Ye,n.unpackAlignment||1),Wn(t,n),i===De){const e=p/6*(d/r.BYTES_PER_ELEMENT);Qn(0,n).forEach((n=>{const i=e*n.ndx,s=r.subarray(i,i+e);t.texImage2D(n.face,u,l,o,a,0,f,h,s)}))}else i===Oe||i===Ie?t.texImage3D(i,u,l,o,a,s,0,f,h,r):t.texImage2D(i,u,l,o,a,0,f,h,r);return{width:o,height:a,depth:s,type:h}}function li(t,e,r){const n=r.target||Me;t.bindTexture(n,e);const i=r.level||0,o=r.internalFormat||r.format||ke,a=On(o),s=r.format||a.format,u=r.type||a.type;if(Wn(t,r),n===De)for(let e=0;e<6;++e)t.texImage2D(Be+e,i,o,r.width,r.height,0,s,u,null);else n===Oe||n===Ie?t.texImage3D(n,i,o,r.width,r.height,r.depth,0,s,u,null):t.texImage2D(n,i,o,r.width,r.height,0,s,u,null)}function ci(t,e,r){r=r||ti,e=e||ve.textureOptions;const n=t.createTexture(),i=e.target||Me;let o=e.width||1,a=e.height||1;const s=e.internalFormat||ke;t.bindTexture(i,n),i===De&&(t.texParameteri(i,Ge,Ce),t.texParameteri(i,Ve,Ce));let u=e.src;if(u)if("function"==typeof u&&(u=u(t,e)),"string"==typeof u)oi(t,n,e,r);else if(ge(u)||Array.isArray(u)&&("number"==typeof u[0]||Array.isArray(u[0])||ge(u[0]))){const r=ui(t,n,u,e);o=r.width,a=r.height}else Array.isArray(u)&&("string"==typeof u[0]||ri(u[0]))?i===De?ai(t,n,e,r):si(t,n,e,r):($n(t,n,u,e),o=u.width,a=u.height);else li(t,n,e);return Yn(e)&&Jn(t,n,e,o,a,s),Hn(t,n,e),n}function fi(t,e,r,n,i,o){n=n||r.width,i=i||r.height,o=o||r.depth;const a=r.target||Me;t.bindTexture(a,e);const s=r.level||0,u=r.internalFormat||r.format||ke,l=On(u),c=r.format||l.format;let f;const h=r.src;if(f=h&&(ge(h)||Array.isArray(h)&&"number"==typeof h[0])?r.type||zn(0,h,l.type):r.type||l.type,a===De)for(let e=0;e<6;++e)t.texImage2D(Be+e,s,u,n,i,0,c,f,null);else a===Oe||a===Ie?t.texImage3D(a,s,u,n,i,o,0,c,f,null):t.texImage2D(a,s,u,n,i,0,c,f,null)}function hi(t,e,r){r=r||ti;let n=0;const i=[],o={},a={};function s(){0===n&&setTimeout((function(){r(i.length?i:void 0,o,a)}),0)}return Object.keys(e).forEach((function(r){const u=e[r];let l;var c;("string"==typeof(c=u.src)||Array.isArray(c)&&"string"==typeof c[0])&&(l=function(t,e,o){a[r]=o,--n,t&&i.push(t),s()},++n),o[r]=ci(t,u,l)})),s(),o}var di=Object.freeze({__proto__:null,setTextureDefaults_:Un,createSampler:Kn,createSamplers:qn,setSamplerParameters:Xn,createTexture:ci,setEmptyTexture:li,setTextureFromArray:ui,loadTextureFromUrl:oi,setTextureFromElement:$n,setTextureFilteringForSize:Jn,setTextureParameters:Hn,setDefaultTextureColor:Nn,createTextures:hi,resizeTexture:fi,canGenerateMipmap:Bn,canFilter:Rn,getNumComponentsForFormat:Ln,getBytesPerElementForInternalFormat:Dn,getFormatAndTypeForInternalFormat:On});const pi=B,mi=R;function yi(t){return"undefined"!=typeof document&&document.getElementById?document.getElementById(t):null}const bi=33984,vi=35048,gi=34962,_i=34963,xi=35345,wi=35982,ki=36386,Ei=35713,Si=35714,Ai=35632,Ti=35633,Ci=35981,Pi=35718,Fi=35721,Mi=35971,Di=35382,Oi=35396,Ii=35398,Bi=35392,Ri=35395,Li=5126,zi=5124,ji=5125,Ni=3553,Ui=34067,Wi=32879,Gi=35866,Vi={};function Hi(t,e){return Vi[e].bindPoint}function Xi(t,e){return function(r){t.uniform1i(e,r)}}function Ki(t,e){return function(r){t.uniform1iv(e,r)}}function qi(t,e){return function(r){t.uniform2iv(e,r)}}function Ji(t,e){return function(r){t.uniform3iv(e,r)}}function Yi(t,e){return function(r){t.uniform4iv(e,r)}}function Zi(t,e,r,n){const i=Hi(0,e);return pe(t)?function(e){let o,a;z(0,e)?(o=e,a=null):(o=e.texture,a=e.sampler),t.uniform1i(n,r),t.activeTexture(bi+r),t.bindTexture(i,o),t.bindSampler(r,a)}:function(e){t.uniform1i(n,r),t.activeTexture(bi+r),t.bindTexture(i,e)}}function Qi(t,e,r,n,i){const o=Hi(0,e),a=new Int32Array(i);for(let t=0;t<i;++t)a[t]=r+t;return pe(t)?function(e){t.uniform1iv(n,a),e.forEach((function(e,n){let i,s;t.activeTexture(bi+a[n]),z(0,e)?(i=e,s=null):(i=e.texture,s=e.sampler),t.bindSampler(r,s),t.bindTexture(o,i)}))}:function(e){t.uniform1iv(n,a),e.forEach((function(e,r){t.activeTexture(bi+a[r]),t.bindTexture(o,e)}))}}function $i(t,e){return function(r){if(r.value)switch(t.disableVertexAttribArray(e),r.value.length){case 4:t.vertexAttrib4fv(e,r.value);break;case 3:t.vertexAttrib3fv(e,r.value);break;case 2:t.vertexAttrib2fv(e,r.value);break;case 1:t.vertexAttrib1fv(e,r.value);break;default:throw new Error("the length of a float constant value must be between 1 and 4!")}else t.bindBuffer(gi,r.buffer),t.enableVertexAttribArray(e),t.vertexAttribPointer(e,r.numComponents||r.size,r.type||Li,r.normalize||!1,r.stride||0,r.offset||0),void 0!==r.divisor&&t.vertexAttribDivisor(e,r.divisor)}}function to(t,e){return function(r){if(r.value){if(t.disableVertexAttribArray(e),4!==r.value.length)throw new Error("The length of an integer constant value must be 4!");t.vertexAttrib4iv(e,r.value)}else t.bindBuffer(gi,r.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,r.numComponents||r.size,r.type||zi,r.stride||0,r.offset||0),void 0!==r.divisor&&t.vertexAttribDivisor(e,r.divisor)}}function eo(t,e){return function(r){if(r.value){if(t.disableVertexAttribArray(e),4!==r.value.length)throw new Error("The length of an unsigned integer constant value must be 4!");t.vertexAttrib4uiv(e,r.value)}else t.bindBuffer(gi,r.buffer),t.enableVertexAttribArray(e),t.vertexAttribIPointer(e,r.numComponents||r.size,r.type||ji,r.stride||0,r.offset||0),void 0!==r.divisor&&t.vertexAttribDivisor(e,r.divisor)}}function ro(t,e,r){const n=r.size,i=r.count;return function(r){t.bindBuffer(gi,r.buffer);const o=r.size||r.numComponents||n,a=o/i,s=r.type||Li,u=Vi[s].size*o,l=r.normalize||!1,c=r.offset||0,f=u/i;for(let n=0;n<i;++n)t.enableVertexAttribArray(e+n),t.vertexAttribPointer(e+n,a,s,l,u,c+f*n),void 0!==r.divisor&&t.vertexAttribDivisor(e+n,r.divisor)}}Vi[5126]={Type:Float32Array,size:4,setter:function(t,e){return function(r){t.uniform1f(e,r)}},arraySetter:function(t,e){return function(r){t.uniform1fv(e,r)}}},Vi[35664]={Type:Float32Array,size:8,setter:function(t,e){return function(r){t.uniform2fv(e,r)}},cols:2},Vi[35665]={Type:Float32Array,size:12,setter:function(t,e){return function(r){t.uniform3fv(e,r)}},cols:3},Vi[35666]={Type:Float32Array,size:16,setter:function(t,e){return function(r){t.uniform4fv(e,r)}},cols:4},Vi[5124]={Type:Int32Array,size:4,setter:Xi,arraySetter:Ki},Vi[35667]={Type:Int32Array,size:8,setter:qi,cols:2},Vi[35668]={Type:Int32Array,size:12,setter:Ji,cols:3},Vi[35669]={Type:Int32Array,size:16,setter:Yi,cols:4},Vi[5125]={Type:Uint32Array,size:4,setter:function(t,e){return function(r){t.uniform1ui(e,r)}},arraySetter:function(t,e){return function(r){t.uniform1uiv(e,r)}}},Vi[36294]={Type:Uint32Array,size:8,setter:function(t,e){return function(r){t.uniform2uiv(e,r)}},cols:2},Vi[36295]={Type:Uint32Array,size:12,setter:function(t,e){return function(r){t.uniform3uiv(e,r)}},cols:3},Vi[36296]={Type:Uint32Array,size:16,setter:function(t,e){return function(r){t.uniform4uiv(e,r)}},cols:4},Vi[35670]={Type:Uint32Array,size:4,setter:Xi,arraySetter:Ki},Vi[35671]={Type:Uint32Array,size:8,setter:qi,cols:2},Vi[35672]={Type:Uint32Array,size:12,setter:Ji,cols:3},Vi[35673]={Type:Uint32Array,size:16,setter:Yi,cols:4},Vi[35674]={Type:Float32Array,size:32,setter:function(t,e){return function(r){t.uniformMatrix2fv(e,!1,r)}},rows:2,cols:2},Vi[35675]={Type:Float32Array,size:48,setter:function(t,e){return function(r){t.uniformMatrix3fv(e,!1,r)}},rows:3,cols:3},Vi[35676]={Type:Float32Array,size:64,setter:function(t,e){return function(r){t.uniformMatrix4fv(e,!1,r)}},rows:4,cols:4},Vi[35685]={Type:Float32Array,size:32,setter:function(t,e){return function(r){t.uniformMatrix2x3fv(e,!1,r)}},rows:2,cols:3},Vi[35686]={Type:Float32Array,size:32,setter:function(t,e){return function(r){t.uniformMatrix2x4fv(e,!1,r)}},rows:2,cols:4},Vi[35687]={Type:Float32Array,size:48,setter:function(t,e){return function(r){t.uniformMatrix3x2fv(e,!1,r)}},rows:3,cols:2},Vi[35688]={Type:Float32Array,size:48,setter:function(t,e){return function(r){t.uniformMatrix3x4fv(e,!1,r)}},rows:3,cols:4},Vi[35689]={Type:Float32Array,size:64,setter:function(t,e){return function(r){t.uniformMatrix4x2fv(e,!1,r)}},rows:4,cols:2},Vi[35690]={Type:Float32Array,size:64,setter:function(t,e){return function(r){t.uniformMatrix4x3fv(e,!1,r)}},rows:4,cols:3},Vi[35678]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ni},Vi[35680]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ui},Vi[35679]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Wi},Vi[35682]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ni},Vi[36289]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Gi},Vi[36292]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Gi},Vi[36293]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ui},Vi[36298]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ni},Vi[36299]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Wi},Vi[36300]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ui},Vi[36303]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Gi},Vi[36306]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ni},Vi[36307]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Wi},Vi[36308]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Ui},Vi[36311]={Type:null,size:0,setter:Zi,arraySetter:Qi,bindPoint:Gi};const no={};no[5126]={size:4,setter:$i},no[35664]={size:8,setter:$i},no[35665]={size:12,setter:$i},no[35666]={size:16,setter:$i},no[5124]={size:4,setter:to},no[35667]={size:8,setter:to},no[35668]={size:12,setter:to},no[35669]={size:16,setter:to},no[5125]={size:4,setter:eo},no[36294]={size:8,setter:eo},no[36295]={size:12,setter:eo},no[36296]={size:16,setter:eo},no[35670]={size:4,setter:to},no[35671]={size:8,setter:to},no[35672]={size:12,setter:to},no[35673]={size:16,setter:to},no[35674]={size:4,setter:ro,count:2},no[35675]={size:9,setter:ro,count:3},no[35676]={size:16,setter:ro,count:4};const io=/ERROR:\s*\d+:(\d+)/gi;const oo=/^[ \t]*\n/;function ao(t){let e=0;return oo.test(t)&&(e=1,t=t.replace(oo,"")),{lineOffset:e,shaderSource:t}}function so(t,e){return t.errorCallback(e),t.callback&&setTimeout((()=>{t.callback(`${e}\n${t.errors.join("\n")}`)})),null}function uo(t,e,r,n){const i=t.createShader(r);return t.shaderSource(i,ao(e).shaderSource),t.compileShader(i),n.callback||function(t,e,r,n){n=n||pi;const i=t.getShaderParameter(r,Ei);if(!i){const i=t.getShaderInfoLog(r),{lineOffset:o,shaderSource:a}=ao(t.getShaderSource(r));n(`${function(t,e="",r=0){const n=[...e.matchAll(io)],i=new Map(n.map(((t,r)=>{const i=parseInt(t[1]),o=n[r+1],a=o?o.index:e.length;return[i-1,e.substring(t.index,a)]})));return t.split("\n").map(((t,e)=>{const n=i.get(e);return`${e+1+r}: ${t}${n?`\n\n^^^ ${n}`:""}`})).join("\n")}(a,i,o)}\nError compiling ${ye(t,e)}: ${i}`)}return i}(t,r,i,n.errorCallback)?i:(t.deleteShader(i),null)}function lo(t,e,r){let n,i,o;if("function"==typeof e&&(r=e,e=void 0),"function"==typeof t)r=t,t=void 0;else if(t&&!Array.isArray(t)){if(t.errorCallback&&t.errors)return t;const e=t;r=e.errorCallback,t=e.attribLocations,n=e.transformFeedbackVaryings,i=e.transformFeedbackMode,o=e.callback}const a=r||pi,s=[],u={errorCallback(t,...e){s.push(t),a(t,...e)},transformFeedbackVaryings:n,transformFeedbackMode:i,callback:o,errors:s};if(t){let r={};Array.isArray(t)?t.forEach((function(t,n){r[t]=e?e[n]:n})):r=t,u.attribLocations=r}return u}const co=["VERTEX_SHADER","FRAGMENT_SHADER"];function fo(t,e){return e.indexOf("frag")>=0?Ai:e.indexOf("vert")>=0?Ti:void 0}function ho(t,e){e.forEach((function(e){t.deleteShader(e)}))}const po=(t=0)=>new Promise((e=>setTimeout(e,t)));function mo(t,e,r,n,i){const o=lo(r,n,i),a=[],s=[];for(let r=0;r<e.length;++r){let n=e[r];if("string"==typeof n){const e=yi(n),i=e?e.text:n;let a=t[co[r]];e&&e.type&&(a=fo(0,e.type)||a),n=uo(t,i,a,o),s.push(n)}u=n,"undefined"!=typeof WebGLShader&&u instanceof WebGLShader&&a.push(n)}var u;if(a.length!==e.length)return ho(t,s),so(o,"not enough shaders for program");const l=t.createProgram();a.forEach((function(e){t.attachShader(l,e)})),o.attribLocations&&Object.keys(o.attribLocations).forEach((function(e){t.bindAttribLocation(l,o.attribLocations[e],e)}));let c=o.transformFeedbackVaryings;return c&&(c.attribs&&(c=c.attribs),Array.isArray(c)||(c=Object.keys(c)),t.transformFeedbackVaryings(l,c,o.transformFeedbackMode||Ci)),t.linkProgram(l),o.callback?(async function(t,e,r){const n=t.getExtension("KHR_parallel_shader_compile"),i=n?(t,e)=>t.getProgramParameter(e,n.COMPLETION_STATUS_KHR):()=>!0;let o=0;do{await po(o),o=1e3/60}while(!i(t,e));const a=vo(t,e,r.errorCallback),s=a?void 0:r.errors.join("\n");if(!a){(r.errorCallback||pi)(s),t.deleteProgram(e),e=null}r.callback(s,e)}(t,l,o),null):vo(t,l,o.errorCallback)?l:(t.deleteProgram(l),ho(t,s),null)}function yo(t,e,...r){return new Promise(((n,i)=>{const o=lo(...r);o.callback=(t,e)=>{t?i(t):n(e)},mo(t,e,o)}))}function bo(t,e,...r){return new Promise(((n,i)=>{const o=lo(...r);o.callback=(t,e)=>{t?i(t):n(e)},Xo(t,e,o)}))}function vo(t,e,r){r=r||pi;const n=t.getProgramParameter(e,Si);if(!n){r(`Error in program linking: ${t.getProgramInfoLog(e)}`)}return n}function go(t,e,r,n){let i="";const o=yi(e);if(!o)return so(n,`unknown script element: ${e}`);i=o.text;const a=r||fo(0,o.type);return a?uo(t,i,a,n):so(n,"unknown shader type")}function _o(t,e,r,n,i){const o=lo(r,n,i),a=[];for(let r=0;r<e.length;++r){const n=go(t,e[r],t[co[r]],o);if(!n)return null;a.push(n)}return mo(t,a,o)}function xo(t,e,r,n,i){const o=lo(r,n,i),a=[];for(let r=0;r<e.length;++r){const n=uo(t,e[r],t[co[r]],o);if(!o.callback&&!n)return null;a.push(n)}return mo(t,a,o)}function wo(t){const e=t.name;return e.startsWith("gl_")||e.startsWith("webgl_")}const ko=/(\.|\[|]|\w+)/g,Eo=t=>t>="0"&&t<="9";function So(t,e,r,n){const i=t.split(ko).filter((t=>""!==t));let o=0,a="";for(;;){const t=i[o++];a+=t;const s=Eo(t[0]),u=s?parseInt(t):t;s&&(a+=i[o++]);if(o===i.length){r[u]=e;break}{const t=i[o++],e="["===t,s=r[u]||(e?[]:{});r[u]=s,r=s,n[a]=n[a]||function(t){return function(e){zo(t,e)}}(s),a+=t}}}function Ao(t,e){let r=0;function n(e,n,i){const o=n.name.endsWith("[0]"),a=n.type,s=Vi[a];if(!s)throw new Error(`unknown type: 0x${a.toString(16)}`);let u;if(s.bindPoint){const e=r;r+=n.size,u=o?s.arraySetter(t,a,e,i,n.size):s.setter(t,a,e,i,n.size)}else u=s.arraySetter&&o?s.arraySetter(t,i):s.setter(t,i);return u.location=i,u}const i={},o={},a=t.getProgramParameter(e,Pi);for(let r=0;r<a;++r){const a=t.getActiveUniform(e,r);if(wo(a))continue;let s=a.name;s.endsWith("[0]")&&(s=s.substr(0,s.length-3));const u=t.getUniformLocation(e,a.name);if(u){const t=n(0,a,u);i[s]=t,So(s,t,o,i)}}return i}function To(t,e){const r={},n=t.getProgramParameter(e,Mi);for(let i=0;i<n;++i){const n=t.getTransformFeedbackVarying(e,i);r[n.name]={index:i,type:n.type,size:n.size}}return r}function Co(t,e,r){e.transformFeedbackInfo&&(e=e.transformFeedbackInfo),r.attribs&&(r=r.attribs);for(const n in r){const i=e[n];if(i){const e=r[n];e.offset?t.bindBufferRange(wi,i.index,e.buffer,e.offset,e.size):t.bindBufferBase(wi,i.index,e.buffer)}}}function Po(t,e,r){const n=t.createTransformFeedback();return t.bindTransformFeedback(ki,n),t.useProgram(e.program),Co(t,e,r),t.bindTransformFeedback(ki,null),n}function Fo(t,e){const r=t.getProgramParameter(e,Pi),n=[],i=[];for(let o=0;o<r;++o){i.push(o),n.push({});const r=t.getActiveUniform(e,o);n[o].name=r.name}[["UNIFORM_TYPE","type"],["UNIFORM_SIZE","size"],["UNIFORM_BLOCK_INDEX","blockNdx"],["UNIFORM_OFFSET","offset"]].forEach((function(r){const o=r[0],a=r[1];t.getActiveUniforms(e,i,t[o]).forEach((function(t,e){n[e][a]=t}))}));const o={},a=t.getProgramParameter(e,Di);for(let r=0;r<a;++r){const n=t.getActiveUniformBlockName(e,r),i={index:t.getUniformBlockIndex(e,n),usedByVertexShader:t.getActiveUniformBlockParameter(e,r,Oi),usedByFragmentShader:t.getActiveUniformBlockParameter(e,r,Ii),size:t.getActiveUniformBlockParameter(e,r,Bi),uniformIndices:t.getActiveUniformBlockParameter(e,r,Ri)};i.used=i.usedByVertexShader||i.usedByFragmentShader,o[n]=i}return{blockSpecs:o,uniformData:n}}const Mo=/\[\d+\]\.$/,Do=(t,e)=>((t+(e-1))/e|0)*e;function Oo(t,e,r,n){const i=r.blockSpecs,o=r.uniformData,a=i[n];if(!a)return mi("no uniform block object named:",n),{name:n,uniforms:{}};const s=new ArrayBuffer(a.size),u=t.createBuffer(),l=a.index;t.bindBuffer(xi,u),t.uniformBlockBinding(e,a.index,l);let c=n+".";Mo.test(c)&&(c=c.replace(Mo,"."));const f={},h={},d={};return a.uniformIndices.forEach((function(t){const e=o[t];let r=e.name;r.startsWith(c)&&(r=r.substr(c.length));const n=r.endsWith("[0]");n&&(r=r.substr(0,r.length-3));const i=Vi[e.type],a=i.Type,u=n?Do(i.size,16)*e.size:i.size*e.size,l=new a(s,e.offset,u/a.BYTES_PER_ELEMENT);f[r]=l;const p=function(t,e,r,n){if(e||r){n=n||1;const e=t.length/4;return function(r){let i=0,o=0;for(let a=0;a<e;++a){for(let e=0;e<n;++e)t[i++]=r[o++];i+=4-n}}}return function(e){e.length?t.set(e):t[0]=e}}(l,n,i.rows,i.cols);h[r]=p,So(r,p,d,h)})),{name:n,array:s,asFloat:new Float32Array(s),buffer:u,uniforms:f,setters:h}}function Io(t,e,r){return Oo(t,e.program,e.uniformBlockSpec,r)}function Bo(t,e,r){const n=(e.uniformBlockSpec||e).blockSpecs[r.name];if(n){const e=n.index;return t.bindBufferRange(xi,e,r.buffer,r.offset||0,r.array.byteLength),!0}return!1}function Ro(t,e,r){Bo(t,e,r)&&t.bufferData(xi,r.array,vi)}function Lo(t,e){const r=t.setters;for(const t in e){const n=r[t];if(n){n(e[t])}}}function zo(t,e){for(const r in e){const n=t[r];"function"==typeof n?n(e[r]):zo(t[r],e[r])}}function jo(t,...e){const r=t.uniformSetters||t,n=e.length;for(let t=0;t<n;++t){const n=e[t];if(Array.isArray(n)){const t=n.length;for(let e=0;e<t;++e)jo(r,n[e])}else for(const t in n){const e=r[t];e&&e(n[t])}}}const No=jo;function Uo(t,e){const r={},n=t.getProgramParameter(e,Fi);for(let i=0;i<n;++i){const n=t.getActiveAttrib(e,i);if(wo(n))continue;const o=t.getAttribLocation(e,n.name),a=no[n.type],s=a.setter(t,o,a);s.location=o,r[n.name]=s}return r}function Wo(t,e){for(const r in e){const n=t[r];n&&n(e[r])}}function Go(t,e,r){r.vertexArrayObject?t.bindVertexArray(r.vertexArrayObject):(Wo(e.attribSetters||e,r.attribs),r.indices&&t.bindBuffer(_i,r.indices))}function Vo(t,e){const r={program:e,uniformSetters:Ao(t,e),attribSetters:Uo(t,e)};return pe(t)&&(r.uniformBlockSpec=Fo(t,e),r.transformFeedbackInfo=To(t,e)),r}const Ho=/\s|{|}|;/;function Xo(t,e,r,n,i){const o=lo(r,n,i),a=[];if(e=e.map((function(t){if(!Ho.test(t)){const e=yi(t);if(e)t=e.text;else{const e=`no element with id: ${t}`;o.errorCallback(e),a.push(e)}}return t})),a.length)return so(o,"");const s=o.callback;s&&(o.callback=(e,r)=>{let n;e||(n=Vo(t,r)),s(e,n)});const u=xo(t,e,o);return u?Vo(t,u):null}var Ko=Object.freeze({__proto__:null,createAttributeSetters:Uo,createProgram:mo,createProgramAsync:yo,createProgramFromScripts:_o,createProgramFromSources:xo,createProgramInfo:Xo,createProgramInfoAsync:bo,createProgramInfoFromProgram:Vo,createUniformSetters:Ao,createUniformBlockSpecFromProgram:Fo,createUniformBlockInfoFromProgram:Oo,createUniformBlockInfo:Io,createTransformFeedback:Po,createTransformFeedbackInfo:To,bindTransformFeedbackInfo:Co,setAttributes:Wo,setBuffersAndAttributes:Go,setUniforms:jo,setUniformsAndBindTextures:No,setUniformBlock:Ro,setBlockUniforms:Lo,bindUniformBlock:Bo});const qo=4,Jo=5123;function Yo(t,e,r,n,i,o){r=void 0===r?qo:r;const a=e.indices,s=e.elementType,u=void 0===n?e.numElements:n;i=void 0===i?0:i,s||a?void 0!==o?t.drawElementsInstanced(r,u,void 0===s?Jo:e.elementType,i,o):t.drawElements(r,u,void 0===s?Jo:e.elementType,i):void 0!==o?t.drawArraysInstanced(r,i,u,o):t.drawArrays(r,i,u)}function Zo(t,e){let r=null,n=null;e.forEach((function(e){if(!1===e.active)return;const i=e.programInfo,o=e.vertexArrayInfo||e.bufferInfo;let a=!1;const s=void 0===e.type?qo:e.type;i!==r&&(r=i,t.useProgram(i.program),a=!0),(a||o!==n)&&(n&&n.vertexArrayObject&&!o.vertexArrayObject&&t.bindVertexArray(null),n=o,Go(t,i,o)),jo(i,e.uniforms),Yo(t,o,s,e.count,e.offset,e.instanceCount)})),n&&n.vertexArrayObject&&t.bindVertexArray(null)}var Qo=Object.freeze({__proto__:null,drawBufferInfo:Yo,drawObjectList:Zo});const $o=36160,ta=36161,ea=3553,ra=34041,na=36064,ia=36096,oa=33306,aa=33071,sa=9729,ua=[{format:6408,type:5121,min:sa,wrap:aa},{format:ra}],la={};la[34041]=oa,la[6401]=36128,la[36168]=36128,la[6402]=ia,la[33189]=ia,la[33190]=ia,la[36012]=ia,la[35056]=oa,la[36013]=oa;const ca={};ca[32854]=!0,ca[32855]=!0,ca[36194]=!0,ca[34041]=!0,ca[33189]=!0,ca[6401]=!0,ca[36168]=!0;const fa=32;function ha(t,e,r,n){const i=$o,o=t.createFramebuffer();t.bindFramebuffer(i,o),r=r||t.drawingBufferWidth,n=n||t.drawingBufferHeight;const a=[],s={framebuffer:o,attachments:[],width:r,height:n};return(e=e||ua).forEach((function(e,o){let u=e.attachment;const l=e.samples,c=e.format;let f=e.attachmentPoint||function(t,e){return la[t]||la[e]}(c,e.internalFormat);if(f||(f=na+o),function(t){return t>=na&&t<na+fa}(f)&&a.push(f),!u)if(void 0!==l||function(t){return ca[t]}(c))u=t.createRenderbuffer(),t.bindRenderbuffer(ta,u),l>1?t.renderbufferStorageMultisample(ta,l,c,r,n):t.renderbufferStorage(ta,c,r,n);else{const i=Object.assign({},e);i.width=r,i.height=n,void 0===i.auto&&(i.auto=!1,i.min=i.min||i.minMag||sa,i.mag=i.mag||i.minMag||sa,i.wrapS=i.wrapS||i.wrap||aa,i.wrapT=i.wrapT||i.wrap||aa),u=ci(t,i)}if(L(0,u))t.framebufferRenderbuffer(i,f,ta,u);else{if(!z(0,u))throw new Error("unknown attachment type");void 0!==e.layer?t.framebufferTextureLayer(i,f,u,e.level||0,e.layer):t.framebufferTexture2D(i,f,e.target||ea,u,e.level||0)}s.attachments.push(u)})),t.drawBuffers&&t.drawBuffers(a),s}function da(t,e,r,n,i){n=n||t.drawingBufferWidth,i=i||t.drawingBufferHeight,e.width=n,e.height=i,(r=r||ua).forEach((function(r,o){const a=e.attachments[o],s=r.format,u=r.samples;if(void 0!==u||L(0,a))t.bindRenderbuffer(ta,a),u>1?t.renderbufferStorageMultisample(ta,u,s,n,i):t.renderbufferStorage(ta,s,n,i);else{if(!z(0,a))throw new Error("unknown attachment type");fi(t,a,r,n,i)}}))}function pa(t,e,r){r=r||$o,e?(t.bindFramebuffer(r,e.framebuffer),t.viewport(0,0,e.width,e.height)):(t.bindFramebuffer(r,null),t.viewport(0,0,t.drawingBufferWidth,t.drawingBufferHeight))}var ma=Object.freeze({__proto__:null,bindFramebufferInfo:pa,createFramebufferInfo:ha,resizeFramebufferInfo:da});const ya=34963;function ba(t,e,r){const n=t.createVertexArray();return t.bindVertexArray(n),e.length||(e=[e]),e.forEach((function(e){Go(t,e,r)})),t.bindVertexArray(null),{numElements:r.numElements,elementType:r.elementType,vertexArrayObject:n}}function va(t,e,r,n){const i=t.createVertexArray();return t.bindVertexArray(i),Wo(e,r),n&&t.bindBuffer(ya,n),t.bindVertexArray(null),i}function ga(t,e,r){return va(t,e.attribSetters||e,r.attribs,r.indices)}var _a=Object.freeze({__proto__:null,createVertexArrayInfo:ba,createVAOAndSetAttributes:va,createVAOFromBufferInfo:ga});const xa={addExtensionsToContext:!0};function wa(t){I(t,xa),Q(t),Un(t)}const ka=/^(.*?)_/;function Ea(t,e){ye(t,0);const r=t.getExtension(e);if(r){const n={},i=ka.exec(e)[1],o="_"+i;for(const e in r){const a=r[e],s="function"==typeof a,u=s?i:o;let l=e;e.endsWith(u)&&(l=e.substring(0,e.length-u.length)),void 0!==t[l]?s||t[l]===a||R(l,t[l],a,e):s?t[l]=function(t){return function(){return t.apply(r,arguments)}}(a):(t[l]=a,n[l]=a)}n.constructor={name:r.constructor.name},ye(n,0)}return r}const Sa=["ANGLE_instanced_arrays","EXT_blend_minmax","EXT_color_buffer_float","EXT_color_buffer_half_float","EXT_disjoint_timer_query","EXT_disjoint_timer_query_webgl2","EXT_frag_depth","EXT_sRGB","EXT_shader_texture_lod","EXT_texture_filter_anisotropic","OES_element_index_uint","OES_standard_derivatives","OES_texture_float","OES_texture_float_linear","OES_texture_half_float","OES_texture_half_float_linear","OES_vertex_array_object","WEBGL_color_buffer_float","WEBGL_compressed_texture_atc","WEBGL_compressed_texture_etc1","WEBGL_compressed_texture_pvrtc","WEBGL_compressed_texture_s3tc","WEBGL_compressed_texture_s3tc_srgb","WEBGL_depth_texture","WEBGL_draw_buffers"];function Aa(t){for(let e=0;e<Sa.length;++e)Ea(t,Sa[e])}function Ta(t,e){const r=function(t,e){const r=["webgl","experimental-webgl"];let n=null;for(let i=0;i<r.length;++i)if(n=t.getContext(r[i],e),n){xa.addExtensionsToContext&&Aa(n);break}return n}(t,e);return r}function Ca(t,e){const r=function(t,e){const r=["webgl2","webgl","experimental-webgl"];let n=null;for(let i=0;i<r.length;++i)if(n=t.getContext(r[i],e),n){xa.addExtensionsToContext&&Aa(n);break}return n}(t,e);return r}function Pa(t,e){e=e||1,e=Math.max(0,e);const r=t.clientWidth*e|0,n=t.clientHeight*e|0;return(t.width!==r||t.height!==n)&&(t.width=r,t.height=n,!0)}},9713:(t,e,r)=>{function n(){}r(2491).mixin(n),n.prototype.write=function(t,e,r){this.emit("item",(t?t+" ":"")+(e?e+" ":"")+r.join(" "))},t.exports=n},9755:(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function i(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,o(n.key),n)}}function o(t){var e=function(t,e){if("object"!=n(t)||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var i=r.call(t,e||"default");if("object"!=n(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==n(e)?e:e+""}function a(t,e,r){return e=u(e),function(t,e){if(e&&("object"==n(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,s()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function s(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(s=function(){return!!t})()}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}var c=r(4434),f=r(9609),h=r(4465),d=r(5012),p=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=a(this,e))._id=t,r._rotationCenter=f.v3.create(0,0),r._texture=null,r._uniforms={u_skinSize:[0,0],u_skin:null},r._silhouette=new d,r.setMaxListeners(h.SKIN_SHARE_SOFT_LIMIT),r}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l(t,e)}(e,t),r=e,(n=[{key:"dispose",value:function(){this._id=h.ID_NONE}},{key:"id",get:function(){return this._id}},{key:"rotationCenter",get:function(){return this._rotationCenter}},{key:"size",get:function(){return[0,0]}},{key:"useNearest",value:function(t,e){return!0}},{key:"calculateRotationCenter",value:function(){return[this.size[0]/2,this.size[1]/2]}},{key:"getTexture",value:function(t){return this._emptyImageTexture}},{key:"getFenceBounds",value:function(t,e){return t.getAABB(e)}},{key:"getUniforms",value:function(t){return this._uniforms.u_skin=this.getTexture(t),this._uniforms.u_skinSize=this.size,this._uniforms}},{key:"updateSilhouette",value:function(){}},{key:"_setTexture",value:function(t){var e=this._renderer.gl;e.bindTexture(e.TEXTURE_2D,this._texture),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),this._silhouette.update(t)}},{key:"setEmptyImageData",value:function(){if(this._texture=null,!this._emptyImageData){this._emptyImageData=new ImageData(1,1);var t=this._renderer.gl,r={auto:!0,wrap:t.CLAMP_TO_EDGE,src:this._emptyImageData};this._emptyImageTexture=f.createTexture(t,r)}this._rotationCenter[0]=0,this._rotationCenter[1]=0,this._silhouette.update(this._emptyImageData),this.emit(e.Events.WasAltered)}},{key:"isTouchingNearest",value:function(t){return this._silhouette.isTouchingNearest(t)}},{key:"isTouchingLinear",value:function(t){return this._silhouette.isTouchingLinear(t)}}])&&i(r.prototype,n),o&&i(r,o),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n,o}(c);p.Events={WasAltered:"WasAltered"},t.exports=p},9925:(t,e,r)=>{var n=r(2491),i=/\n+$/,o=new n;o.write=function(t,e,r){var n=r.length-1;if("undefined"!=typeof console&&console.log){if(console.log.apply)return console.log.apply(console,[t,e].concat(r));if(JSON&&JSON.stringify){r[n]&&"string"==typeof r[n]&&(r[n]=r[n].replace(i,""));try{for(n=0;n<r.length;n++)r[n]=JSON.stringify(r[n])}catch(t){}console.log(r.join(" "))}}},o.formatters=["color","minilog"],o.color=r(329),o.minilog=r(8933),t.exports=o}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n=r(6276);module.exports.ScratchRender=n})();
|