@sketch-hq/sketch-web-renderer 3.2.2 → 3.2.3

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.
Files changed (33) hide show
  1. package/dist/cpp/out/Debug/module-debug.d.ts +6 -0
  2. package/dist/cpp/out/Debug/module-debug.d.ts.map +1 -0
  3. package/dist/cpp/out/Release/module-release.d.ts +6 -0
  4. package/dist/cpp/out/Release/module-release.d.ts.map +1 -0
  5. package/dist/index.js +1 -1
  6. package/dist/module-debug.wasm +0 -0
  7. package/dist/module-release.wasm +0 -0
  8. package/dist/static/js/web-renderer-49953fc2d5b916489af2.chunk.js +1 -0
  9. package/dist/static/js/web-renderer-8cf7e3dad04db65cf1e1.chunk.js +1 -0
  10. package/dist/static/js/web-renderer-aabfc7a6fc6164757d08.chunk.js +1 -0
  11. package/dist/ts/Manager.d.ts.map +1 -1
  12. package/dist/ts/SketchWeb.d.ts +1 -1
  13. package/dist/ts/react/SketchWebProvider.d.ts +6 -2
  14. package/dist/ts/react/SketchWebProvider.d.ts.map +1 -1
  15. package/dist/ts/react/SketchWebReact.d.ts +3 -2
  16. package/dist/ts/react/SketchWebReact.d.ts.map +1 -1
  17. package/dist/ts/react/contexts.d.ts +2 -22
  18. package/dist/ts/react/contexts.d.ts.map +1 -1
  19. package/dist/ts/react/hooks/state.d.ts +1 -19
  20. package/dist/ts/react/hooks/state.d.ts.map +1 -1
  21. package/dist/ts/react/hooks/useEvent.d.ts +1 -1
  22. package/dist/ts/react/hooks/useEvent.d.ts.map +1 -1
  23. package/dist/ts/react/internal.d.ts.map +1 -1
  24. package/dist/ts/types/Error.d.ts +2 -2
  25. package/dist/ts/types/Error.d.ts.map +1 -1
  26. package/dist/ts/types/WASM.d.ts +0 -4
  27. package/dist/ts/types/WASM.d.ts.map +1 -1
  28. package/dist/ts/utils/misc.d.ts.map +1 -1
  29. package/package.json +27 -26
  30. package/CHANGELOG.md +0 -562
  31. package/dist/static/js/web-renderer-8addc65e32c7f00a9bf5.chunk.js +0 -1
  32. package/dist/static/js/web-renderer-8cbabe889ae0a40da834.chunk.js +0 -1
  33. package/dist/static/js/web-renderer-dcd9a388dd98f28adced.chunk.js +0 -1
@@ -0,0 +1,6 @@
1
+ export = SketchWebWasmFactory;
2
+ declare function SketchWebWasmFactory(SketchWebWasmFactory: any, ...args: any[]): any;
3
+ declare namespace SketchWebWasmFactory {
4
+ export { SketchWebWasmFactory };
5
+ }
6
+ //# sourceMappingURL=module-debug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-debug.d.ts","sourceRoot":"","sources":["../../../../src/cpp/out/Debug/module-debug.js"],"names":[],"mappings":";AAKA,sFA4tOC"}
@@ -0,0 +1,6 @@
1
+ export = SketchWebWasmFactory;
2
+ declare function SketchWebWasmFactory(SketchWebWasmFactory: any): any;
3
+ declare namespace SketchWebWasmFactory {
4
+ export { SketchWebWasmFactory };
5
+ }
6
+ //# sourceMappingURL=module-release.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"module-release.d.ts","sourceRoot":"","sources":["../../../../src/cpp/out/Release/module-release.js"],"names":[],"mappings":";AAKA,sEAOC"}
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var n="object"==typeof exports?t(require("react")):t(e.react);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(function(e){return(()=>{var t,n,o,r,i={975:(e,t,n)=>{"use strict";function o(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}n.d(t,{M:()=>f});const r=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function i(e){return e.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"")}const a="undefined"==typeof window,s=(()=>{if(a)return;const{userAgent:e,platform:t,maxTouchPoints:n}=window.navigator,o=/(iphone|ipod|ipad)/i.test(e),r="iPad"===t||"MacIntel"===t&&n>0&&!window.MSStream;return{isIpad:r,isMobile:/android/i.test(e)||o||r,isSafari12:/Version\/12.+Safari/.test(e)}})(),u=[],c=[];function l(e,t){if(e===t)return 0;const n=e;e.length>t.length&&(e=t,t=n);let o=e.length,r=t.length;for(;o>0&&e.charCodeAt(~-o)===t.charCodeAt(~-r);)o--,r--;let i,a=0;for(;a<o&&e.charCodeAt(a)===t.charCodeAt(a);)a++;if(o-=a,r-=a,0===o)return r;let s,l,h=0,d=0,f=0;for(;d<o;)c[d]=e.charCodeAt(a+d),u[d]=++d;for(;f<r;)for(i=t.charCodeAt(a+f),s=f++,h=f,d=0;d<o;d++)l=i===c[d]?s:s+1,s=u[d],h=u[d]=s>h?l>h?h+1:l:l>s?s+1:l;return h}function h(e){return null!=e}class d extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const f=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:n={},glContext:u,failIfMajorPerformanceCaveat:c=!1,benchmarksURL:f="https://unpkg.com/detect-gpu@4.0.37/dist/benchmarks"}={})=>o(void 0,void 0,void 0,(function*(){const v={};if(a)return{tier:0,type:"SSR"};const{isIpad:p=!!(null==s?void 0:s.isIpad),isMobile:m=!!(null==s?void 0:s.isMobile),screenSize:g=window.screen,loadBenchmarks:b=(e=>o(void 0,void 0,void 0,(function*(){const t=yield fetch(`${f}/${e}`).then((e=>e.json()));if(parseInt(t.shift().split(".")[0],10)<4)throw new d("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:y}=n;const w=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:m,tier:e,type:t});let P,C="";if(y)y=i(y),P=[y];else{const e=u||function(e,t=!1){const n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete n.powerPreference;const o=window.document.createElement("canvas"),r=o.getContext("webgl",n)||o.getContext("experimental-webgl",n);return null!=r?r:void 0}(null==s?void 0:s.isSafari12,c);if(!e)return w(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(y=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!y)return w(1,"FALLBACK");C=y,y=i(y),P=function(e,t,n){return"apple gpu"===t?function(e,t,n){if(!n)return[t];const o=function(e){const t=e.createShader(35633),n=e.createShader(35632),o=e.createProgram();if(!(n&&t&&o))return;e.shaderSource(t,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n "),e.shaderSource(n,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),e.compileShader(t),e.compileShader(n),e.attachShader(o,t),e.attachShader(o,n),e.linkProgram(o),e.detachShader(o,t),e.detachShader(o,n),e.deleteShader(t),e.deleteShader(n),e.useProgram(o);const r=e.createBuffer();e.bindBuffer(34962,r),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const i=e.getAttribLocation(o,"aPosition");e.vertexAttribPointer(i,3,5126,!1,0,0),e.enableVertexAttribArray(i),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const a=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,a),e.deleteProgram(o),e.deleteBuffer(r),a.join("")}(e),r="801621810",i="8016218135",a="80162181161",u=(null==s?void 0:s.isIpad)?[["a7",a,12],["a8",i,15],["a8x",i,15],["a9",i,15],["a9x",i,15],["a10",i,15],["a10x",i,15],["a12",r,15],["a12x",r,15],["a12z",r,15],["a14",r,15],["m1",r,15]]:[["a7",a,12],["a8",i,12],["a9",i,15],["a10",i,15],["a11",r,15],["a12",r,15],["a13",r,15],["a14",r,15]];let c;return"80162181255"===o?c=u.filter((([,,e])=>e>=14)):(c=u.filter((([,e])=>e===o)),c.length||(c=u)),c.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,y,m)}const k=(yield Promise.all(P.map((function(e){var t;return o(this,void 0,void 0,(function*(){const n=(e=>{const t=m?["adreno","apple","mali-t","mali","nvidia","powervr"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of t)if(e.includes(n))return n})(e);if(!n)return;const o=`${m?"m":"d"}-${n}${p?"-ipad":""}.json`,r=v[o]=null!==(t=v[o])&&void 0!==t?t:b(o);let i;try{i=yield r}catch(n){if(n instanceof d)throw n;return}const a=function(e){var t;const n=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(t=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==t?t:""}(e);let s=i.filter((([,e])=>e===a));s.length||(s=i.filter((([t])=>t.includes(e))));const u=s.length;if(0===u)return;let c,[h,,,f]=u>1?s.map((t=>[t,l(e,t[0])])).sort((([,e],[,t])=>e-t))[0][0]:s[0],y=Number.MAX_VALUE;const{devicePixelRatio:w}=window,P=g.width*w*g.height*w;for(const e of f){const[t,n]=e,o=t*n,r=Math.abs(P-o);r<y&&(y=r,c=e)}if(!c)return;const[,,C,k]=c;return[y,C,h,k]}))})))).filter(h).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!k.length){const e=r.find((e=>y.includes(e)));return e?w(0,"BLOCKLISTED",e):w(1,"FALLBACK",`${y} (${C})`)}const[,W,E,x]=k[0];if(-1===W)return w(0,"BLOCKLISTED",E,W,x);const S=m?e:t;let M=0;for(let e=0;e<S.length;e++)W>=S[e]&&(M=e);return w(M,"BENCHMARK",E,W,x)}))},519:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});const o={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1}},41:(e,t,n)=>{"use strict";n.d(t,{d:()=>z});var o,r=n(354),i=function(){function e(){this.removeListenerCallbacks=[]}return e.prototype.add=function(e,t,n,o){e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o)};return this.removeListenerCallbacks.push(r),r},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e}(),a=n(388),s=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),u=function(e){function t(t,n){var o=e.call(this)||this;return o.listenersCollector=new i,o.state={pinchToZoomLastDistance:0,lastGestureScale:1,isCtrlPressed:!1},o.handleGestureStart=function(e){e.preventDefault(),o.state.lastGestureScale=e.scale},o.handleGestureChange=function(e){e.preventDefault();var t=e.scale/o.state.lastGestureScale;o.state.lastGestureScale=e.scale;var n=o.getCorrectPointerPosition(e);o.emitZoomEvent(t,n)},o.handleGestureEnd=function(e){e.preventDefault()},o.handleTouchStart=function(e){e.preventDefault(),o.handleTouchPinchToZoomStart(e),o.emit("pointerdown",{type:"touch",position:o.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},o.handleMouseDown=function(e){e.ctrlKey||(e.preventDefault(),o.emit("pointerdown",{type:"mouse",position:o.getCorrectPointerPosition(e),button:e.button,touchesCount:0}))},o.handleTouchMove=function(e){o.handleTouchPinchToZoomChange(e),o.emit("pointermove",{type:"touch",position:o.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},o.handleMouseMove=function(e){o.updateMousePosition(e)},o.handleGlobalTouchMove=function(e){o.emit("globalpointermove",{type:"touch",position:o.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},o.handleGlobalMouseMove=function(e){o.updateGlobalMousePosition(e)},o.handleTouchPinchToZoomStart=function(e){var t;!e.touches||(null===(t=e.touches)||void 0===t?void 0:t.length)<2||(o.state.pinchToZoomLastDistance=o.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]))},o.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var n=o.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]),r=o.getCorrectPointerPosition(e),i=1+.004*(n-o.state.pinchToZoomLastDistance);o.state.pinchToZoomLastDistance=n,o.emitZoomEvent(i,r)}},o.handleTouchEnd=function(e){var t=e.touches.length<1?{x:0,y:0}:o.getCorrectPointerPosition(e);o.emit("pointerup",{position:t,type:"touch",button:0,touchesCount:e.touches.length})},o.handleMouseUp=function(e){o.emit("pointerup",{type:"mouse",position:o.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},o.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!o.state.isCtrlPressed,n=e.metaKey||t||o.state.isCtrlPressed;if(o.updateMousePosition(e),o.updateGlobalMousePosition(e),n){var r=t?-1:1,i=o.getCorrectPointerPosition(e),a=1+.005*e.deltaY*r;o.emitZoomEvent(a,i)}else o.emit("wheel",{x:-e.deltaX,y:-e.deltaY},{type:"mouse",position:o.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},o.target=t,o.settings=n,o.targetBounds=t.getBoundingClientRect(),o.addListeners(),o}return s(t,e),t.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},t.prototype.addListeners=function(){this.addTouchEventListeners(),this.addMouseEventListeners(),this.addKeyboardEventListeners(),this.addSafariGesturesEventListeners()},t.prototype.addKeyboardEventListeners=function(){var e=this;this.listenersCollector.add(document,"keydown",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!0)})),this.listenersCollector.add(document,"keyup",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!1)})),this.listenersCollector.add(document,"contextmenu",(function(t){t.ctrlKey&&(e.state.isCtrlPressed=!1)}))},t.prototype.addMouseEventListeners=function(){this.listenersCollector.add(this.target,"mousedown",this.handleMouseDown),this.listenersCollector.add(this.target,"mousemove",this.handleMouseMove),this.listenersCollector.add(document,"mousemove",this.handleGlobalMouseMove),this.listenersCollector.add(document,"mouseup",this.handleMouseUp),this.listenersCollector.add(this.target,"wheel",this.handleMouseWheel)},t.prototype.addTouchEventListeners=function(){this.listenersCollector.add(this.target,"touchstart",this.handleTouchStart),this.listenersCollector.add(document,"touchmove",this.handleGlobalTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(this.target,"touchmove",this.handleTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(document,"touchcancel",this.handleTouchEnd),this.listenersCollector.add(document,"touchend",this.handleTouchEnd)},t.prototype.addSafariGesturesEventListeners=function(){(0,a.b1)()||(this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart,{capture:!0}),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange,{capture:!0}),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd,{capture:!0}))},t.prototype.clampPointerToTargetBounds=function(e){return{x:(0,a.uZ)(e.x-this.targetBounds.x,0,this.target.clientWidth),y:(0,a.uZ)(e.y-this.targetBounds.y,0,this.target.clientHeight)}},t.prototype.getCorrectPointerPosition=function(e){var t,n={x:0,y:0};if((null===(t=e.touches)||void 0===t?void 0:t.length)>1){var o=e,r=o.touches[0],i=o.touches[1];n={x:(r.clientX+i.clientX)/2,y:(r.clientY+i.clientY)/2}}else n=(0,a.MP)(e);return this.clampPointerToTargetBounds(n)},t.prototype.updateMousePosition=function(e){this.emit("pointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},t.prototype.updateGlobalMousePosition=function(e){this.emit("globalpointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},t.prototype.calculateDistanceBetweenTouches=function(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)},t.prototype.emitZoomEvent=function(e,t){this.emit("pinchToZoom",e,t)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(r.v),c=n(475),l=n(419);const h=Symbol("Comlink.proxy"),d=Symbol("Comlink.endpoint"),f=Symbol("Comlink.releaseProxy"),v=Symbol("Comlink.thrown"),p=e=>"object"==typeof e&&null!==e||"function"==typeof e,m=new Map([["proxy",{canHandle:e=>p(e)&&e[h],serialize(e){const{port1:t,port2:n}=new MessageChannel;return g(e,t),[n,[n]]},deserialize:e=>(e.start(),y(e))}],["throw",{canHandle:e=>p(e)&&v in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function g(e,t=self){t.addEventListener("message",(function n(o){if(!o||!o.data)return;const{id:r,type:i,path:a}=Object.assign({path:[]},o.data),s=(o.data.argumentList||[]).map(S);let u;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),n=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":u=n;break;case"SET":t[a.slice(-1)[0]]=S(o.data.value),u=!0;break;case"APPLY":u=n.apply(t,s);break;case"CONSTRUCT":u=E(new n(...s));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;g(e,n),u=W(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[v]:0}}Promise.resolve(u).catch((e=>({value:e,[v]:0}))).then((e=>{const[o,a]=x(e);t.postMessage(Object.assign(Object.assign({},o),{id:r}),a),"RELEASE"===i&&(t.removeEventListener("message",n),b(t))}))})),t.start&&t.start()}function b(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function y(e,t){return P(e,[],t)}function w(e){if(e)throw new Error("Proxy has been released and is not useable")}function P(e,t=[],n=function(){}){let o=!1;const r=new Proxy(n,{get(n,i){if(w(o),i===f)return()=>M(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{b(e),o=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=M(e,{type:"GET",path:t.map((e=>e.toString()))}).then(S);return n.then.bind(n)}return P(e,[...t,i])},set(n,r,i){w(o);const[a,s]=x(i);return M(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},s).then(S)},apply(n,r,i){w(o);const a=t[t.length-1];if(a===d)return M(e,{type:"ENDPOINT"}).then(S);if("bind"===a)return P(e,t.slice(0,-1));const[s,u]=C(i);return M(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},u).then(S)},construct(n,r){w(o);const[i,a]=C(r);return M(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(S)}});return r}function C(e){const t=e.map(x);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const k=new WeakMap;function W(e,t){return k.set(e,t),e}function E(e){return Object.assign(e,{[h]:!0})}function x(e){for(const[t,n]of m)if(n.canHandle(e)){const[o,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:o},r]}return[{type:"RAW",value:e},k.get(e)||[]]}function S(e){switch(e.type){case"HANDLER":return m.get(e.name).deserialize(e.value);case"RAW":return e.value}}function M(e,t,n){return new Promise((o=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===r&&(e.removeEventListener("message",t),o(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}var L,R=n(849),T=n(519),Z=n(332),A=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),D=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new i,n.handleKeyUp=function(e){n.emit("keyUp",e.code)},n.target=t,n.addListeners(),n}return A(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(r.v),O=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),I=function(){return(I=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},_=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},G=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},F=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};!function(e){e[e.browser=0]="browser",e[e.worker=1]="worker"}(L||(L={}));var z=function(e){function t(t){var n,o=e.call(this)||this;o.listenersCollector=new i,o.handlePointerDownEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.handlePointerDownEvent(e)},o.handlePointerMoveEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.handlePointerMoveEvent(e)},o.handleGlobalPointerMoveEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.setGlobalPointerPosition(e)},o.handlePointerUpEvent=function(e){var t;null===(t=o.sketchWeb)||void 0===t||t.handlePointerUpEvent(e)},o.handleWheelEvent=function(e,t){return _(o,void 0,void 0,(function(){var n;return G(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.handleWheelEvent(e,t),[2]}))}))},o.handlePinchToZoomEvent=function(e,t){return _(o,void 0,void 0,(function(){var n;return G(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.handlePinchToZoomEvent(e,t),[2]}))}))},o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){var e;o.setCanvasSize(t,n),o.gestureManager.updateTargetBounds(),null===(e=o.sketchWeb)||void 0===e||e.setSize(t,n,o.getDevicePixelRatio())}))};var r=null!==(n=t.featureFlags)&&void 0!==n?n:{};return o.featureFlags=I(I({},T.Z),r),o.settings=t,o.canvas=t.canvas,o.gestureManager=new u(o.settings.container,{minimumZoomLevel:t.minimumZoomLevel,maximumZoomLevel:t.maximumZoomLevel}),o.keyboardManager=new D(document.body),R.Z.active=t.mode===Z.p.debug,o.init(),o}return O(t,e),t.prototype.init=function(){var e;return _(this,void 0,void 0,(function(){var t,n,o;return G(this,(function(r){switch(r.label){case 0:return this.setCanvasSize(this.settings.container.clientWidth,this.settings.container.clientHeight),[4,this.initSketchWeb()];case 1:return r.sent(),[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()];case 2:return"FILE_READY"!==(null==(t=r.sent())?void 0:t.type)?[2]:(n=void 0!==this.settings.initialZoom,o=void 0!==this.settings.initialPan,n||o?n?[4,this.setZoom(this.settings.initialZoom)]:[3,4]:[3,7]);case 3:r.sent(),r.label=4;case 4:return o?[4,this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)]:[3,6];case 5:r.sent(),r.label=6;case 6:return[3,9];case 7:return[4,this.zoomToFit()];case 8:r.sent(),r.label=9;case 9:return this.sketchWeb.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initSketchWeb=function(){return _(this,void 0,void 0,(function(){var e,t,o,r,i;return G(this,(function(a){switch(a.label){case 0:return e=this.featureFlags.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=I(I({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio(),featureFlags:this.featureFlags}),e?(this.environment=L.worker,R.Z.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(n.p+n.u(667),n.b),{type:void 0}),o=y(this.worker),r=this,[4,new o(W(I(I({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return r.sketchWeb=a.sent(),[3,3];case 2:this.environment=L.browser,R.Z.debug("Using normal canvas"),this.sketchWeb=new c.U(t),a.label=3;case 3:return(i=this.sketchWeb).on("status",this.forwardEvent("status")),i.on("fileReady",this.forwardEvent("fileReady")),i.on("metric",this.forwardEvent("metric")),i.on("warnings",this.forwardEvent("warnings")),i.on("allImagesReady",this.forwardEvent("allImagesReady")),i.on("deviceInfo",this.forwardEvent("deviceInfo")),i.on("cameraMoveStart",this.forwardEvent("cameraMoveStart")),i.on("cameraMoveEnd",this.forwardEvent("cameraMoveEnd")),i.on("cameraZoomStart",this.forwardEvent("cameraZoomStart")),i.on("cameraZoomEnd",this.forwardEvent("cameraZoomEnd")),i.on("cameraZoomChange",this.forwardEvent("cameraZoomChange")),i.on("cameraPanChange",this.forwardEvent("cameraPanChange")),i.on("cursorChange",this.forwardEvent("cursorChange")),[4,this.sketchWeb.init()];case 4:return a.sent(),[2]}}))}))},t.prototype.forwardEvent=function(e){var t=this,n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t.emit.apply(t,F([e],n))};return this.environment===L.worker?E(n):n},t.prototype.isRunningInsideWorker=function(){return this.environment===L.worker},t.prototype.looseWebGLContext=function(){var e;null===(e=this.sketchWeb)||void 0===e||e.looseWebGLContext()},t.prototype.addListeners=function(){this.canvasResizeObserver=new ResizeObserver(this.handleCanvasResizeObserver),this.canvasResizeObserver.observe(this.settings.container),this.listenersCollector.add(window,"orientationchange",this.handleDeviceOrientationChange),this.gestureManager.on("wheel",this.handleWheelEvent),this.gestureManager.on("pointerup",this.handlePointerUpEvent),this.gestureManager.on("pointermove",this.handlePointerMoveEvent),this.gestureManager.on("globalpointermove",this.handleGlobalPointerMoveEvent),this.gestureManager.on("pointerdown",this.handlePointerDownEvent),this.gestureManager.on("pinchToZoom",this.handlePinchToZoomEvent)},t.prototype.getDevicePixelRatio=function(){return(0,l.uZ)(window.devicePixelRatio,1,2)},t.prototype.setCanvasSize=function(e,t){this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.getDevicePixelRatio(),this.canvas.height=t*this.getDevicePixelRatio()},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.settings.container.clientWidth,height:this.settings.container.clientHeight})},t.prototype.setBackgroundColor=function(e){var t;null===(t=this.sketchWeb)||void 0===t||t.setBackgroundColor(e)},t.prototype.zoomToFit=function(){return _(this,void 0,void 0,(function(){return G(this,(function(e){switch(e.label){case 0:return[4,this.sketchWeb.scaleDocumentToFit()];case 1:return e.sent(),[2]}}))}))},t.prototype.getStatus=function(){var e;return _(this,void 0,void 0,(function(){return G(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()]}))}))},t.prototype.generateDocumentPNG=function(){var e;return _(this,void 0,void 0,(function(){return G(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.getDocument=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getDocument()},t.prototype.getArtboardAtPosition=function(e,t){var n;return _(this,void 0,void 0,(function(){return G(this,(function(o){switch(o.label){case 0:return[4,null===(n=this.sketchWeb)||void 0===n?void 0:n.getArtboardAtPosition(e,t)];case 1:return[2,o.sent()||null]}}))}))},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWeb)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.setPan=function(e,t,n){var o;return _(this,void 0,void 0,(function(){return G(this,(function(r){switch(r.label){case 0:return[4,null===(o=this.sketchWeb)||void 0===o?void 0:o.setPan(e,t,Boolean(n))];case 1:return r.sent(),[2]}}))}))},t.prototype.setZoom=function(e,t){var n;return _(this,void 0,void 0,(function(){var o;return G(this,(function(r){return o=null!=t?t:this.getCanvasCenterPoint(),null===(n=this.sketchWeb)||void 0===n||n.setZoom(e,o),[2]}))}))},t.prototype.getCanvasCenterPoint=function(){var e=this.canvas.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()},t.prototype.getPan=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.sketchWeb)||void 0===t||t.setIsCameraLocked(e)},t.prototype.dispose=function(){var e,t,n,o;return _(this,void 0,void 0,(function(){return G(this,(function(r){switch(r.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.dispose(),this.listenersCollector.dispose(),null===(e=this.canvasResizeObserver)||void 0===e||e.disconnect(),this.isRunningInsideWorker()?[4,null===(t=this.sketchWeb)||void 0===t?void 0:t.dispose()]:[3,2];case 1:return r.sent(),null===(n=this.worker)||void 0===n||n.terminate(),[3,3];case 2:null===(o=this.sketchWeb)||void 0===o||o.dispose(),r.label=3;case 3:return[2]}}))}))},t}(r.v)},475:(e,t,n)=>{"use strict";n.d(t,{U:()=>m});var o,r=n(419),i=n(519),a=n(354),s=n(108),u=n(849),c=n(758),l=n(332),h=n(975),d=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),f=function(){return(f=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},v=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},p=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},m=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,o=t.locateFile,a=t.filePath,c=t.imagesURLFormat,h=t.imagesURLMap,d=t.backgroundColor,v=void 0===d?{r:1,g:1,b:1,a:1}:d,p=t.size,m=t.pixelRatio,g=t.mode,b=t.showTilesBorders,y=void 0!==b&&b,w=t.minimumZoomLevel,P=t.maximumZoomLevel,C=t.preserveDrawingBuffer,k=void 0!==C&&C,W=t.panBoundariesPadding,E=void 0===W?40:W,x=t.featureFlags,S=void 0===x?{}:x,M=e.call(this)||this;return M.status={type:"INIT"},M.handleWebGLContextLost=function(){M.setStatus({type:"WEBGL_CONTEXT_LOST"})},M.canvas=n,M.locateFile=o,M.filePath=a,M.imagesURLFormat=c,M.imagesURLMap=h,M.backgroundColor=v,M.size=p,M.pixelRatio=m,M.mode=g,M.showTilesBorders=y,M.currentWebGLVersion=(0,r.wX)(),M.zoomLevels={min:w,max:P},M.preserveDrawingBuffer=k,M.panBoundariesPadding=E,M.featureFlags=f(f({},i.Z),S),u.Z.active=g===l.p.debug,M.traceFirstPaint=new s.S("FirstPaint"),M}return d(t,e),t.prototype.collectAndEmitDeviceInfo=function(){return v(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,(0,h.M)()];case 1:return e=t.sent(),this.deviceInfo=f(f({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return v(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[4,this.preloadImages()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof c.k?e:new c.k("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return this.mode===l.p.debug&&(window.sketchWeb=this.sketchWebWasm,globalThis.PRFindCriteria=this.wasmModule.PRFindCriteria,globalThis.PRTimingFunction=this.wasmModule.PRTimingFunction),[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new s.S("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){u.Z.debug("[C++] "+e)},logWarning:function(e){u.Z.warning("[C++] "+e)},logError:function(e){u.Z.error("[C++] "+e)},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(u.Z.warning("Not able to resolve the url for the image with UUID: "+t),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")},onCameraMoveStart:function(){e.emit("cameraMoveStart")},onCameraMoveEnd:function(){e.emit("cameraMoveEnd")},onCameraZoomStart:function(){e.emit("cameraZoomStart")},onCameraZoomEnd:function(){e.emit("cameraZoomEnd")},onCameraZoomChange:function(t){e.emit("cameraZoomChange",t)},onCameraPanChange:function(){var t=e.getPan();e.emit("cameraPanChange",t.x,t.y)},onCursorChange:function(t){var n=e.prCursorTypeToCSSCursorMap[t.value];n?e.emit("cursorChange",n):u.Z.warning("Unknown cursor type "+t.value)}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new s.S("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),u.Z.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return v(this,void 0,void 0,(function(){var e,t,o,r,i,a,h,d,f=this;return p(this,(function(v){switch(v.label){case 0:return e=new s.S("WasmModuleDownload"),this.mode!==l.p.debug?[3,2]:[4,n.e(706).then(n.t.bind(n,706,23))];case 1:return t=v.sent(),[3,4];case 2:return[4,n.e(610).then(n.t.bind(n,610,23))];case 3:t=v.sent(),v.label=4;case 4:o=t.default,v.label=5;case 5:return v.trys.push([5,7,,8]),r=this,[4,o({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return f.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=v.sent(),[3,8];case 7:throw i=v.sent(),new c.k("WASM_ERROR","An error occurred while trying to create the wasm module.",i);case 8:if(this.pointerTypeToWASMMap={unset:this.wasmModule.PRUserPointerType.Unset,mouse:this.wasmModule.PRUserPointerType.Mouse,touch:this.wasmModule.PRUserPointerType.Touch},this.prCursorTypeToCSSCursorMap=((d={})[this.wasmModule.PRCursorType.Auto.value]="auto",d[this.wasmModule.PRCursorType.Default.value]="default",d[this.wasmModule.PRCursorType.Pointer.value]="pointer",d[this.wasmModule.PRCursorType.Grab.value]="grab",d[this.wasmModule.PRCursorType.Grabbing.value]="grabbing",d),e.printMeasurement(),this.emit("metric",e.measure()),a={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},u.Z.debug("Using WebGL "+a.majorVersion),!(h=this.wasmModule.GL.createContext(this.canvas,a)))throw new c.k("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=h;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio,{showTilesBorders:this.showTilesBorders})}catch(e){throw new c.k("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.userEventsCollectorWasm=this.sketchWebWasm.getUserEventsCollector(),this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.backgroundColor.r&&e.g===this.backgroundColor.g&&e.b===this.backgroundColor.b&&e.a===this.backgroundColor.a||(null===(t=this.sketchWebWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.backgroundColor=e)},t.prototype.generateDocumentPNG=function(){return v(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.sketchWebWasm.generateDocumentPNG()]}}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.setFile=function(e){return v(this,void 0,void 0,(function(){var t=this;return p(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.sketchWebWasm.setFile(e,(function(e,o,r,i){if(void 0===i&&(i=[]),i.length){u.Z.debug("Parser warnings: "+i);var a=i.map((function(e){return{key:e}}));t.emit("warnings",a)}t.setStatus({type:"FILE_READY"}),t.emit("fileReady",t.getDocument(),e,o,r),n()}),(function(){return o(new c.k("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:e.toString()+(e.cause?"\nWrapped Error: "+e.cause.toString():"")}),u.Z.error(e),e.cause&&u.Z.error(e.cause)},t.prototype.setSize=function(e,t,n){var o;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(o=this.sketchWebWasm)||void 0===o||o.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(u.Z.debug("Status transition "+this.status.type+" => "+e.type+"}"),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:f(f({},e),{artboards:(0,r.gi)(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){if(this.sketchWebWasm){var n=this.getDocument();if(n){for(var o=this.sketchWebWasm.getPan(),r=this.sketchWebWasm.getZoom(),i=(e-o.x)/r,a=(t-o.y)/r,s=0,u=n.artboards;s<u.length;s++){var c=u[s],l=c.bounds.x+c.bounds.width,h=c.bounds.y+c.bounds.height;if(i>=c.bounds.x&&a>=c.bounds.y&&i<=l&&a<=h)return c.objectId}return null}}},t.prototype.getPanAtPosition=function(e,t){if(this.sketchWebWasm){var n=this.getPan(),o=Math.max(this.getZoom(),Number.EPSILON),r=e/o,i=t/o;return{x:n.x-r,y:n.y-i}}},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.setZoom(e,t.x,t.y)},t.prototype.getPan=function(){if(this.sketchWebWasm){var e=this.getDocument();if(e){var t=e.bounds,n=this.sketchWebWasm.getPan(),o=this.sketchWebWasm.getZoom();return{x:n.x/o+t.x,y:n.y/o+t.y}}}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.handlePinchToZoomEvent=function(e,t){var n;null===(n=this.userEventsCollectorWasm)||void 0===n||n.dispatchPinchToZoomEvent(e,t.x,t.y)},t.prototype.pointerInfoToWASM=function(e){var t,n;return this.pointerTypeToWASMMap||u.Z.warning("An user event was triggered, but the WASM module is not available."),f(f({},e),{type:null!==(n=null===(t=this.pointerTypeToWASMMap)||void 0===t?void 0:t[e.type])&&void 0!==n?n:this.wasmModule.PRUserPointerType.Unset})},t.prototype.setPan=function(e,t,n){if(void 0===n&&(n=!1),this.sketchWebWasm){var o=e,r=t,i=this.getDocument().bounds,a=this.sketchWebWasm.getZoom();if(n){var s=Math.max(2*a*this.pixelRatio,Number.EPSILON);o+=this.size.width/s,r+=this.size.height/s}var u=(o-i.x)*a,c=(r-i.y)*a;this.sketchWebWasm.setPan(u,c)}},t.prototype.handleWheelEvent=function(e,t){var n;null===(n=this.userEventsCollectorWasm)||void 0===n||n.dispatchWheelEvent(e.x,e.y,this.pointerInfoToWASM(t))},t.prototype.handlePointerDownEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(this.pointerInfoToWASM(e))},t.prototype.handlePointerMoveEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(this.pointerInfoToWASM(e))},t.prototype.setGlobalPointerPosition=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(this.pointerInfoToWASM(e))},t.prototype.handlePointerUpEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(this.pointerInfoToWASM(e))},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.userEventsCollectorWasm=null,this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new c.k("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(a.v))},35:(e,t,n)=>{"use strict";n.d(t,{z0:()=>Y,oW:()=>j,jr:()=>C,tm:()=>L,ky:()=>y,zX:()=>_,ex:()=>A,Jw:()=>D,m_:()=>O,Yy:()=>M,d6:()=>W,aP:()=>k,EY:()=>I,pt:()=>Z,od:()=>P,ph:()=>R,lt:()=>S,$z:()=>b,BO:()=>w,us:()=>T});var o=n(297),r=n.n(o),i=n(332),a=n(849),s=(0,o.createContext)(void 0),u=function(){var e=(0,o.useContext)(s);if(void 0===e)throw Error("useSketchWebInternalContext must be used within a SketchWebProvider");return e},c=(n(419),function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o}),l=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a.Z.debug.apply(a.Z,c(["SketchWebReact"],e))},h=(0,o.createContext)(void 0),d=(0,o.createContext)(void 0),f=(0,o.createContext)(void 0),v=(0,o.createContext)(void 0),p=(0,o.createContext)(void 0),m=(0,o.createContext)(void 0),g=(0,o.createContext)("auto"),b=function(){var e=(0,o.useContext)(h);if(void 0===e)throw Error("useStatus must be used within a SketchWebProvider");return e},y=function(){var e=(0,o.useContext)(d);if(void 0===e)throw Error("useDocument must be used within a SketchWebProvider");return e},w=function(){var e=(0,o.useContext)(f);if(void 0===e)throw Error("useZoom must be used within a SketchWebProvider");return e},P=function(){var e=(0,o.useContext)(m);if(void 0===e)throw Error("usePan must be used within a SketchWebProvider");return e},C=function(){var e=(0,o.useContext)(g);if(void 0===e)throw Error("useCursor must be used within a SketchWebProvider");return e},k=function(){var e=(0,o.useContext)(v);if(void 0===status)throw Error("useIsCameraZooming must be used within a SketchWebProvider");return e},W=function(){var e=(0,o.useContext)(p);if(void 0===status)throw Error("useIsCameraMoving must be used within a SketchWebProvider");return e},E=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},x=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},S=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){l("setZoom",t),null==e||e.setZoom(t)}),[e])},M=function(){var e=S(),t=w();return(0,o.useCallback)((function(){var n;l("incrementZoom"),"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},L=function(){var e=S(),t=w();return(0,o.useCallback)((function(){l("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},R=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;l("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},T=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){l("zoomToFit"),null==e||e.zoomToFit()}),[e])},Z=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){l("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},A=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){return E(void 0,void 0,void 0,(function(){return x(this,(function(t){switch(t.label){case 0:return l("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},D=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return E(void 0,void 0,void 0,(function(){return x(this,(function(o){switch(o.label){case 0:return l("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},O=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return E(void 0,void 0,void 0,(function(){return x(this,(function(o){switch(o.label){case 0:return l("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},I=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){l("setIsCameraLocked",t),null==e||e.setIsCameraLocked(t)}),[e])},_=function(e,t){var n=(0,u().getManager)();(0,o.useEffect)((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},G=function(){return(G=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},F={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},z={position:"absolute",top:0,left:0},j=function(e){a.Z.active=e.mode===i.p.debug;var t=e.filePath,n=e.locateFile,s=e.imagesURLFormat,c=e.imagesURLMap,l=e.backgroundColor,h=e.mode,d=e.showTilesBorders,f=e.minimumZoomLevel,v=e.maximumZoomLevel,p=e.preserveDrawingBuffer,m=e.panBoundariesPadding,g=e.initialPan,y=e.initialZoom,w=e.children,P=e.containerProps,k=void 0===P?{}:P,W=e.canvasProps,E=void 0===W?{}:W,x=e.featureFlags,S=void 0===x?{}:x,M=(0,o.useRef)(null),L=(0,o.useRef)(null),R=(0,o.useState)(!1),T=R[0],Z=R[1],A=(0,o.useCallback)((function(){return Z(!0)}),[]),D=u(),O=D.dispose,I=D.init,j=D.setSettings,B=C(),U=b();_("allImagesReady",A),(0,o.useEffect)((function(){j({locateFile:n,imagesURLFormat:s,imagesURLMap:c,backgroundColor:l,mode:h,showTilesBorders:d,minimumZoomLevel:f,maximumZoomLevel:v,preserveDrawingBuffer:p,panBoundariesPadding:m,initialPan:g,initialZoom:y,featureFlags:S})}),[j,n,s,c,l,h,d,f,v,p,m,g,y,S]),(0,o.useEffect)((function(){if(t)return I(t,M.current,L.current),function(){O()}}),[O,I,t]);var N=(0,o.useMemo)((function(){var t;return null!==(t=e.cursor)&&void 0!==t?t:B}),[e.cursor,B]),X=(0,o.useMemo)((function(){return G(G({},F),{cursor:N})}),[N]);return r().createElement("div",G({},k,{ref:L,style:X}),t&&r().createElement("canvas",G({},E,{key:t,ref:M,"data-sketchweb-all-images-ready":T,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-"+((null==U?void 0:U.type.toLowerCase())||"null"),style:z})),"READY"===(null==U?void 0:U.type)&&w)},B=n(41),U=function(){return(U=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},N=function(e,t){switch(t.type){case"on-status":return U(U({},e),{status:t.status});case"on-file-ready":return U(U({},e),{document:t.document});case"on-zoom":return U(U({},e),{zoom:t.zoom});case"on-pan":return U(U({},e),{pan:t.pan});case"dispose":return U(U({},e),{status:null,zoom:null,pan:null,cursor:"auto"});case"post-init":return U(U({},e),{status:t.status,zoom:t.zoom});case"on-camera-zoom-start":return U(U({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return U(U({},e),{isCameraZooming:!1});case"on-camera-move-start":return U(U({},e),{isCameraMoving:!0});case"on-camera-move-end":return U(U({},e),{isCameraMoving:!1});case"on-cursor-change":return U(U({},e),{cursor:t.cursor});default:return e}},X=function(){return(X=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},Y=function(e){var t=e.children,n=(0,o.useRef)(null),i=(0,o.useRef)(null),a=(0,o.useReducer)(N,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),u=a[0],c=u.status,b=u.document,y=u.zoom,w=u.pan,P=u.isCameraZooming,C=u.isCameraMoving,k=u.cursor,W=a[1],E=(0,o.useCallback)((function(e){return W({type:"on-zoom",zoom:e})}),[]),x=(0,o.useCallback)((function(e,t){return W({type:"on-pan",pan:{x:e,y:t}})}),[]),S=(0,o.useCallback)((function(e){W({type:"on-status",status:e})}),[]),M=(0,o.useCallback)((function(e){W({type:"on-file-ready",document:e})}),[]),L=(0,o.useCallback)((function(){return W({type:"on-camera-zoom-start"})}),[]),R=(0,o.useCallback)((function(){return W({type:"on-camera-zoom-end"})}),[]),T=(0,o.useCallback)((function(){return W({type:"on-camera-move-start"})}),[]),Z=(0,o.useCallback)((function(){return W({type:"on-camera-move-end"})}),[]),A=(0,o.useCallback)((function(e){return W({type:"on-cursor-change",cursor:e})}),[]),D=(0,o.useCallback)((function(){var e=n.current;e&&(l("dispose"),e.off("status",S),e.off("fileReady",M),e.off("cameraZoomChange",E),e.off("cameraPanChange",x),e.off("cameraZoomStart",L),e.off("cameraZoomEnd",R),e.off("cameraMoveStart",T),e.off("cameraMoveEnd",Z),e.off("cursorChange",A),e.dispose(),n.current=null,W({type:"dispose"}))}),[S,M,x,E,L,R,T,Z,A]),O=(0,o.useCallback)((function(e,t,o){if(""!==e&&t&&o&&i.current){l("init");var r=new B.d(X(X({},i.current),{filePath:e,container:o,canvas:t}));r.on("status",S),r.on("fileReady",M),r.on("cameraZoomChange",E),r.on("cameraPanChange",x),r.on("cameraZoomStart",L),r.on("cameraZoomEnd",R),r.on("cameraMoveStart",T),r.on("cameraMoveEnd",Z),r.on("cursorChange",A),a=void 0,s=void 0,c=function(){var e,t;return function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(n){switch(n.label){case 0:return e=W,t={type:"post-init"},[4,r.getZoom()];case 1:return t.zoom=n.sent()||null,[4,r.getStatus()];case 2:return t.status=n.sent()||null,[4,r.getPan()];case 3:return e.apply(void 0,[(t.pan=n.sent()||null,t)]),[2]}}))},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{r(c.next(e))}catch(e){t(e)}}function o(e){try{r(c.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof u?r:new u((function(e){e(r)}))).then(n,o)}r((c=c.apply(a,s||[])).next())})),n.current=r}var a,s,u,c}),[S,M,E,x,L,R,T,Z,A]),I=(0,o.useCallback)((function(e){var t;l("setSettings",e),e.backgroundColor&&(null===(t=n.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),i.current=e}),[]),_=(0,o.useCallback)((function(){return n.current}),[]),G=(0,o.useMemo)((function(){return{dispose:D,init:O,setSettings:I,getManager:_,dispatch:W}}),[D,O,I,_]);return r().createElement(s.Provider,{value:G},r().createElement(h.Provider,{value:c},r().createElement(d.Provider,{value:b},r().createElement(f.Provider,{value:y},r().createElement(m.Provider,{value:w},r().createElement(v.Provider,{value:P},r().createElement(p.Provider,{value:C},r().createElement(g.Provider,{value:k},t))))))))}},758:(e,t,n)=>{"use strict";n.d(t,{k:()=>i});var o,r=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"("+n+") "+o)||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return r(t,e),t}(Error)},18:()=>{},689:()=>{},332:(e,t,n)=>{"use strict";var o;n.d(t,{p:()=>o}),function(e){e.debug="debug",e.release="release"}(o||(o={}))},119:()=>{},650:()=>{},312:()=>{},552:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var o=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,o;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(o=this.listeners[e])||void 0===o||o.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this.listeners[e];(null==o?void 0:o.size)&&o.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e}()},354:(e,t,n)=>{"use strict";n.d(t,{v:()=>o.v});var o=n(552)},849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};const r=new(function(){function e(){this.active=!0}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.debug.apply(console,o(["[SketchWeb] [Debug]"],e))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,o(["[SketchWeb] [Warn]"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,o(["[SketchWeb] [Error]"],e))},e}())},108:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});var o=n(849),r=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),o.Z.debug("[Performance] Start: "+this.label)}return e.prototype.measure=function(){return{duration:performance.now()-this.startTime,end:Date.now(),start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}()},419:(e,t,n)=>{"use strict";n.d(t,{uZ:()=>o.uZ,gi:()=>o.gi,wX:()=>o.wX});var o=n(388)},388:(e,t,n)=>{"use strict";n.d(t,{MP:()=>i,uZ:()=>a,wX:()=>s,gi:()=>u,b1:()=>c});var o=n(519),r=n(66);function i(e){var t,n,o,r,i,a;return{x:null!==(o=null===(n=null===(t=e.touches)||void 0===t?void 0:t[0])||void 0===n?void 0:n.clientX)&&void 0!==o?o:e.clientX,y:null!==(a=null===(i=null===(r=e.touches)||void 0===r?void 0:r[0])||void 0===i?void 0:i.clientY)&&void 0!==a?a:e.clientY}}function a(e,t,n){return Math.max(t,Math.min(n,e))}function s(){return(0,r.t)()&&!o.Z.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function u(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}function c(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}},66:(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,r=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(o);if(!t)return null;var n=t[1];return"Macintosh"!==n&&"iPad"!==n&&"iPhone"!==n?null:{hardware:n,version:{major:parseInt(t[4])||0,minor:parseInt(t[5])||0,patch:parseInt(t[6])||0}}}},297:t=>{"use strict";t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return i[e](n,n.exports,s),n.exports}s.m=i,s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&o&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>"static/js/web-renderer-"+{610:"dcd9a388dd98f28adced",667:"8cbabe889ae0a40da834",706:"8addc65e32c7f00a9bf5"}[e]+".chunk.js",s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},r="@sketch-hq/sketch-web-renderer:",s.l=(e,t,n,i)=>{if(o[e])o[e].push(t);else{var a,u;if(void 0!==n)for(var c=document.getElementsByTagName("script"),l=0;l<c.length;l++){var h=c[l];if(h.getAttribute("src")==e||h.getAttribute("data-webpack")==r+n){a=h;break}}a||(u=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",r+n),a.src=e),o[e]=[t];var d=(t,n)=>{a.onerror=a.onload=null,clearTimeout(f);var r=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),u&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.p="/",(()=>{s.b=document.baseURI||self.location.href;var e={826:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[i,a,u]=n,c=0;if(i.some((t=>0!==e[t]))){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);u&&u(s)}for(t&&t(n);c<i.length;c++)r=i[c],s.o(e,r)&&e[r]&&e[r][0](),e[i[c]]=0},n=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var u={};return(()=>{"use strict";s.r(u),s.d(u,{default:()=>v,DefaultFeatureFlags:()=>p,SketchWeb:()=>n.U,SketchWebMode:()=>a.p,SketchWebError:()=>l.k,SketchWebProvider:()=>f.z0,SketchWebReact:()=>f.oW,useCursor:()=>f.jr,useDecrementZoom:()=>f.tm,useDocument:()=>f.ky,useEvent:()=>f.zX,useGenerateDocumentPNG:()=>f.ex,useGetArtboardAtPosititon:()=>f.Jw,useGetPanAtPosition:()=>f.m_,useIncrementZoom:()=>f.Yy,useIsCameraMoving:()=>f.d6,useIsCameraZooming:()=>f.aP,useLockCamera:()=>f.EY,useLooseWebGLContext:()=>f.pt,usePan:()=>f.od,useSetPan:()=>f.ph,useSetZoom:()=>f.lt,useStatus:()=>f.$z,useZoom:()=>f.BO,useZoomToFit:()=>f.us});var e=s(41),t=s(519),n=s(475),o=s(18),r={};for(const e in o)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>o[e]);s.d(u,r);var i=s(119);r={};for(const e in i)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>i[e]);s.d(u,r);var a=s(332),c=s(312);r={};for(const e in c)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode"].indexOf(e)<0&&(r[e]=()=>c[e]);s.d(u,r);var l=s(758),h=s(689);r={};for(const e in h)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>h[e]);s.d(u,r);var d=s(650);r={};for(const e in d)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>d[e]);s.d(u,r);var f=s(35);const v=e.d;var p=t.Z})(),u})()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"));else if("function"==typeof define&&define.amd)define(["react"],t);else{var n="object"==typeof exports?t(require("react")):t(e.react);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(e=>(()=>{"use strict";var t,n,o,r,i={156:t=>{t.exports=e}},a={};function s(e){var t=a[e];if(void 0!==t)return t.exports;var n=a[e]={exports:{}};return i[e](n,n.exports,s),n.exports}s.m=i,s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},n=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,s.t=function(e,o){if(1&o&&(e=this(e)),8&o)return e;if("object"==typeof e&&e){if(4&o&&e.__esModule)return e;if(16&o&&"function"==typeof e.then)return e}var r=Object.create(null);s.r(r);var i={};t=t||[null,n({}),n([]),n(n)];for(var a=2&o&&e;"object"==typeof a&&!~t.indexOf(a);a=n(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,s.d(r,i),r},s.d=(e,t)=>{for(var n in t)s.o(t,n)&&!s.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce(((t,n)=>(s.f[n](e,t),t)),[])),s.u=e=>"static/js/web-renderer-"+{610:"8cf7e3dad04db65cf1e1",667:"aabfc7a6fc6164757d08",706:"49953fc2d5b916489af2"}[e]+".chunk.js",s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o={},r="@sketch-hq/sketch-web-renderer:",s.l=(e,t,n,i)=>{if(o[e])o[e].push(t);else{var a,c;if(void 0!==n)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];if(h.getAttribute("src")==e||h.getAttribute("data-webpack")==r+n){a=h;break}}a||(c=!0,(a=document.createElement("script")).charset="utf-8",a.timeout=120,s.nc&&a.setAttribute("nonce",s.nc),a.setAttribute("data-webpack",r+n),a.src=e),o[e]=[t];var d=(t,n)=>{a.onerror=a.onload=null,clearTimeout(f);var r=o[e];if(delete o[e],a.parentNode&&a.parentNode.removeChild(a),r&&r.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:a}),12e4);a.onerror=d.bind(null,a.onerror),a.onload=d.bind(null,a.onload),c&&document.head.appendChild(a)}},s.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.p="/",(()=>{s.b=document.baseURI||self.location.href;var e={826:0};s.f.j=(t,n)=>{var o=s.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=s.p+s.u(t),a=new Error;s.l(i,(n=>{if(s.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[i,a,c]=n,u=0;if(i.some((t=>0!==e[t]))){for(o in a)s.o(a,o)&&(s.m[o]=a[o]);c&&c(s)}for(t&&t(n);u<i.length;u++)r=i[u],s.o(e,r)&&e[r]&&e[r][0](),e[r]=0},n=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var c={};return(()=>{s.r(c),s.d(c,{DefaultFeatureFlags:()=>$e,SketchWeb:()=>A,SketchWebError:()=>m,SketchWebMode:()=>f,SketchWebProvider:()=>Ke,SketchWebReact:()=>ze,default:()=>Ye,useCursor:()=>ke,useDecrementZoom:()=>Te,useDocument:()=>we,useEvent:()=>Ge,useGenerateDocumentPNG:()=>De,useGetArtboardAtPosititon:()=>Ie,useGetPanAtPosition:()=>_e,useIncrementZoom:()=>Le,useIsCameraMoving:()=>We,useIsCameraZooming:()=>Ee,useLockCamera:()=>Ze,useLooseWebGLContext:()=>Oe,usePan:()=>Pe,useSetPan:()=>Re,useSetZoom:()=>Se,useStatus:()=>ye,useZoom:()=>Ce,useZoomToFit:()=>Ae});var e=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,o;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(o=this.listeners[e])||void 0===o||o.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this.listeners[e];(null==o?void 0:o.size)&&o.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e}(),t=function(){function e(){this.removeListenerCallbacks=[]}return e.prototype.add=function(e,t,n,o){e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o)};return this.removeListenerCallbacks.push(r),r},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e}();const n={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1};var o=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/;function r(e,t,n){return Math.max(t,Math.min(n,e))}function i(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}var a,u=(a=function(e,t){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},a(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}a(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),l=function(e){function n(n,o){var r=e.call(this)||this;return r.listenersCollector=new t,r.state={pinchToZoomLastDistance:0,lastGestureScale:1,isCtrlPressed:!1},r.handleGestureStart=function(e){e.preventDefault(),r.state.lastGestureScale=e.scale},r.handleGestureChange=function(e){e.preventDefault();var t=e.scale/r.state.lastGestureScale;r.state.lastGestureScale=e.scale;var n=r.getCorrectPointerPosition(e);r.emitZoomEvent(t,n)},r.handleGestureEnd=function(e){e.preventDefault()},r.handleTouchStart=function(e){e.preventDefault(),r.handleTouchPinchToZoomStart(e),r.emit("pointerdown",{type:"touch",position:r.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},r.handleMouseDown=function(e){e.ctrlKey||(e.preventDefault(),r.emit("pointerdown",{type:"mouse",position:r.getCorrectPointerPosition(e),button:e.button,touchesCount:0}))},r.handleTouchMove=function(e){r.handleTouchPinchToZoomChange(e),r.emit("pointermove",{type:"touch",position:r.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},r.handleMouseMove=function(e){r.updateMousePosition(e)},r.handleGlobalTouchMove=function(e){r.emit("globalpointermove",{type:"touch",position:r.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},r.handleGlobalMouseMove=function(e){r.updateGlobalMousePosition(e)},r.handleTouchPinchToZoomStart=function(e){var t;!e.touches||(null===(t=e.touches)||void 0===t?void 0:t.length)<2||(r.state.pinchToZoomLastDistance=r.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]))},r.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var n=r.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]),o=r.getCorrectPointerPosition(e),i=1+.004*(n-r.state.pinchToZoomLastDistance);r.state.pinchToZoomLastDistance=n,r.emitZoomEvent(i,o)}},r.handleTouchEnd=function(e){var t=e.touches.length<1?{x:0,y:0}:r.getCorrectPointerPosition(e);r.emit("pointerup",{position:t,type:"touch",button:0,touchesCount:e.touches.length})},r.handleMouseUp=function(e){r.emit("pointerup",{type:"mouse",position:r.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},r.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!r.state.isCtrlPressed,n=e.metaKey||t||r.state.isCtrlPressed;if(r.updateMousePosition(e),r.updateGlobalMousePosition(e),n){var o=t?-1:1,i=r.getCorrectPointerPosition(e),a=1+.005*e.deltaY*o;r.emitZoomEvent(a,i)}else r.emit("wheel",{x:-e.deltaX,y:-e.deltaY},{type:"mouse",position:r.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},r.target=n,r.settings=o,r.targetBounds=n.getBoundingClientRect(),r.addListeners(),r}return u(n,e),n.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},n.prototype.addListeners=function(){this.addTouchEventListeners(),this.addMouseEventListeners(),this.addKeyboardEventListeners(),this.addSafariGesturesEventListeners()},n.prototype.addKeyboardEventListeners=function(){var e=this;this.listenersCollector.add(document,"keydown",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!0)})),this.listenersCollector.add(document,"keyup",(function(t){"Control"===t.key&&(e.state.isCtrlPressed=!1)})),this.listenersCollector.add(document,"contextmenu",(function(t){t.ctrlKey&&(e.state.isCtrlPressed=!1)}))},n.prototype.addMouseEventListeners=function(){this.listenersCollector.add(this.target,"mousedown",this.handleMouseDown),this.listenersCollector.add(this.target,"mousemove",this.handleMouseMove),this.listenersCollector.add(document,"mousemove",this.handleGlobalMouseMove),this.listenersCollector.add(document,"mouseup",this.handleMouseUp),this.listenersCollector.add(this.target,"wheel",this.handleMouseWheel)},n.prototype.addTouchEventListeners=function(){this.listenersCollector.add(this.target,"touchstart",this.handleTouchStart),this.listenersCollector.add(document,"touchmove",this.handleGlobalTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(this.target,"touchmove",this.handleTouchMove,{passive:!0,capture:!0}),this.listenersCollector.add(document,"touchcancel",this.handleTouchEnd),this.listenersCollector.add(document,"touchend",this.handleTouchEnd)},n.prototype.addSafariGesturesEventListeners=function(){"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0||(this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart,{capture:!0}),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange,{capture:!0}),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd,{capture:!0}))},n.prototype.clampPointerToTargetBounds=function(e){return{x:r(e.x-this.targetBounds.x,0,this.target.clientWidth),y:r(e.y-this.targetBounds.y,0,this.target.clientHeight)}},n.prototype.getCorrectPointerPosition=function(e){var t,n={x:0,y:0};if((null===(t=e.touches)||void 0===t?void 0:t.length)>1){var o=e,r=o.touches[0],i=o.touches[1];n={x:(r.clientX+i.clientX)/2,y:(r.clientY+i.clientY)/2}}else n=function(e){var t,n,o,r,i,a;return{x:null!==(o=null===(n=null===(t=e.touches)||void 0===t?void 0:t[0])||void 0===n?void 0:n.clientX)&&void 0!==o?o:e.clientX,y:null!==(a=null===(i=null===(r=e.touches)||void 0===r?void 0:r[0])||void 0===i?void 0:i.clientY)&&void 0!==a?a:e.clientY}}(e);return this.clampPointerToTargetBounds(n)},n.prototype.updateMousePosition=function(e){this.emit("pointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.prototype.updateGlobalMousePosition=function(e){this.emit("globalpointermove",{type:"mouse",position:this.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.prototype.calculateDistanceBetweenTouches=function(e,t){return Math.hypot(e.clientX-t.clientX,e.clientY-t.clientY)},n.prototype.emitZoomEvent=function(e,t){this.emit("pinchToZoom",e,t)},n.prototype.dispose=function(){this.listenersCollector.dispose()},n}(e),h=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};const d=new(function(){function e(){this.active=!0}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.debug.apply(console,h(["[SketchWeb] [Debug]"],e,!1))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,h(["[SketchWeb] [Warn]"],e,!1))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,h(["[SketchWeb] [Error]"],e,!1))},e}());var f,p=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),d.debug("[Performance] Start: ".concat(this.label))}return e.prototype.measure=function(){return{duration:performance.now()-this.startTime,end:Date.now(),start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);d.debug("[Performance] End: ".concat(this.label," -> ").concat(t," ms"))}else{var n=(e/1e3).toFixed(2);d.debug("[Performance] End: ".concat(this.label," -> ").concat(n," s"))}},e}(),v=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),m=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"(".concat(n,") ").concat(o))||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return v(t,e),t}(Error);function g(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))}!function(e){e.debug="debug",e.release="release"}(f||(f={}));const b=["geforce 320m","geforce 8600","geforce 8600m gt","geforce 8800 gs","geforce 8800 gt","geforce 9400","geforce 9400m g","geforce 9400m","geforce 9600m gt","geforce 9600m","geforce fx go5200","geforce gt 120","geforce gt 130","geforce gt 330m","geforce gtx 285","google swiftshader","intel g41","intel g45","intel gma 4500mhd","intel gma x3100","intel hd 3000","intel q45","legacy","mali-2","mali-3","mali-4","quadro fx 1500","quadro fx 4","quadro fx 5","radeon hd 2400","radeon hd 2600","radeon hd 4670","radeon hd 4850","radeon hd 4870","radeon hd 5670","radeon hd 5750","radeon hd 6290","radeon hd 6300","radeon hd 6310","radeon hd 6320","radeon hd 6490m","radeon hd 6630m","radeon hd 6750m","radeon hd 6770m","radeon hd 6970m","sgx 543","sgx543"];function y(e){return e.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const w="undefined"==typeof window,C=(()=>{if(w)return;const{userAgent:e,platform:t,maxTouchPoints:n}=window.navigator,o=/(iphone|ipod|ipad)/i.test(e),r="iPad"===t||"MacIntel"===t&&n>0&&!window.MSStream;return{isIpad:r,isMobile:/android/i.test(e)||o||r,isSafari12:/Version\/12.+Safari/.test(e)}})(),P=[],k=[];function E(e,t){if(e===t)return 0;const n=e;e.length>t.length&&(e=t,t=n);let o=e.length,r=t.length;for(;o>0&&e.charCodeAt(~-o)===t.charCodeAt(~-r);)o--,r--;let i,a=0;for(;a<o&&e.charCodeAt(a)===t.charCodeAt(a);)a++;if(o-=a,r-=a,0===o)return r;let s,c,u=0,l=0,h=0;for(;l<o;)k[l]=e.charCodeAt(a+l),P[l]=++l;for(;h<r;)for(i=t.charCodeAt(a+h),s=h++,u=h,l=0;l<o;l++)c=i===k[l]?s:s+1,s=P[l],u=P[l]=s>u?c>u?u+1:c:c>s?s+1:c;return u}function W(e){return null!=e}class x extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const M=({mobileTiers:e=[0,15,30,60],desktopTiers:t=[0,15,30,60],override:n={},glContext:o,failIfMajorPerformanceCaveat:r=!1,benchmarksURL:i="https://unpkg.com/detect-gpu@4.0.47/dist/benchmarks"}={})=>g(void 0,void 0,void 0,(function*(){const a={};if(w)return{tier:0,type:"SSR"};const{isIpad:s=!!(null==C?void 0:C.isIpad),isMobile:c=!!(null==C?void 0:C.isMobile),screenSize:u=window.screen,loadBenchmarks:l=(e=>g(void 0,void 0,void 0,(function*(){const t=yield fetch(`${i}/${e}`).then((e=>e.json()));if(parseInt(t.shift().split(".")[0],10)<4)throw new x("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:h}=n;const d=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:c,tier:e,type:t});let f,p="";if(h)h=y(h),f=[h];else{const e=o||function(e,t=!1){const n={alpha:!1,antialias:!1,depth:!1,failIfMajorPerformanceCaveat:t,powerPreference:"high-performance",stencil:!1};e&&delete n.powerPreference;const o=window.document.createElement("canvas"),r=o.getContext("webgl",n)||o.getContext("experimental-webgl",n);return null!=r?r:void 0}(null==C?void 0:C.isSafari12,r);if(!e)return d(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(h=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!h)return d(1,"FALLBACK");p=h,h=y(h),f=function(e,t,n){return"apple gpu"===t?function(e,t,n){if(!n)return[t];const o=function(e){const t=e.createShader(35633),n=e.createShader(35632),o=e.createProgram();if(!(n&&t&&o))return;e.shaderSource(t,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n "),e.shaderSource(n,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),e.compileShader(t),e.compileShader(n),e.attachShader(o,t),e.attachShader(o,n),e.linkProgram(o),e.detachShader(o,t),e.detachShader(o,n),e.deleteShader(t),e.deleteShader(n),e.useProgram(o);const r=e.createBuffer();e.bindBuffer(34962,r),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const i=e.getAttribLocation(o,"aPosition");e.vertexAttribPointer(i,3,5126,!1,0,0),e.enableVertexAttribArray(i),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const a=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,a),e.deleteProgram(o),e.deleteBuffer(r),a.join("")}(e),r="801621810",i="8016218135",a="80162181161",s=(null==C?void 0:C.isIpad)?[["a7",a,12],["a8",i,15],["a8x",i,15],["a9",i,15],["a9x",i,15],["a10",i,15],["a10x",i,15],["a12",r,15],["a12x",r,15],["a12z",r,15],["a14",r,15],["m1",r,15]]:[["a7",a,12],["a8",i,12],["a9",i,15],["a10",i,15],["a11",r,15],["a12",r,15],["a13",r,15],["a14",r,15]];let c;return"80162181255"===o?c=s.filter((([,,e])=>e>=14)):(c=s.filter((([,e])=>e===o)),c.length||(c=s)),c.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,h,c)}const v=(yield Promise.all(f.map((function(e){var t;return g(this,void 0,void 0,(function*(){const n=(e=>{const t=c?["adreno","apple","mali-t","mali","nvidia","powervr"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of t)if(e.includes(n))return n})(e);if(!n)return;const o=`${c?"m":"d"}-${n}${s?"-ipad":""}.json`,r=a[o]=null!==(t=a[o])&&void 0!==t?t:l(o);let i;try{i=yield r}catch(n){if(n instanceof x)throw n;return}const h=function(e){var t;const n=(e=e.replace(/\([^)]+\)/,"")).match(/\d+/)||e.match(/(\W|^)([A-Za-z]{1,3})(\W|$)/g);return null!==(t=null==n?void 0:n.join("").replace(/\W|amd/g,""))&&void 0!==t?t:""}(e);let d=i.filter((([,e])=>e===h));d.length||(d=i.filter((([t])=>t.includes(e))));const f=d.length;if(0===f)return;let p,[v,,,m]=f>1?d.map((t=>[t,E(e,t[0])])).sort((([,e],[,t])=>e-t))[0][0]:d[0],g=Number.MAX_VALUE;const{devicePixelRatio:b}=window,y=u.width*b*u.height*b;for(const e of m){const[t,n]=e,o=t*n,r=Math.abs(y-o);r<g&&(g=r,p=e)}if(!p)return;const[,,w,C]=p;return[g,w,v,C]}))})))).filter(W).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!v.length){const e=b.find((e=>h.includes(e)));return e?d(0,"BLOCKLISTED",e):d(1,"FALLBACK",`${h} (${p})`)}const[,m,P,k]=v[0];if(-1===m)return d(0,"BLOCKLISTED",P,m,k);const M=c?e:t;let S=0;for(let e=0;e<M.length;e++)m>=M[e]&&(S=e);return d(S,"BENCHMARK",P,m,k)}));var S=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),L=function(){return L=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},L.apply(this,arguments)},T=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},R=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},A=(globalThis.indexedDB,function(e){function t(t){var r=t.canvas,i=t.locateFile,a=t.filePath,s=t.imagesURLFormat,c=t.imagesURLMap,u=t.backgroundColor,l=void 0===u?{r:1,g:1,b:1,a:1}:u,h=t.size,v=t.pixelRatio,m=t.mode,g=t.showTilesBorders,b=void 0!==g&&g,y=t.minimumZoomLevel,w=t.maximumZoomLevel,C=t.preserveDrawingBuffer,P=void 0!==C&&C,k=t.panBoundariesPadding,E=void 0===k?40:k,W=t.featureFlags,x=void 0===W?{}:W,M=e.call(this)||this;return M.status={type:"INIT"},M.handleWebGLContextLost=function(){M.setStatus({type:"WEBGL_CONTEXT_LOST"})},M.canvas=r,M.locateFile=i,M.filePath=a,M.imagesURLFormat=s,M.imagesURLMap=c,M.backgroundColor=l,M.size=h,M.pixelRatio=v,M.mode=m,M.showTilesBorders=b,M.currentWebGLVersion=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(o);if(!t)return null;var n=t[1];return"Macintosh"!==n&&"iPad"!==n&&"iPhone"!==n?null:{hardware:n,version:{major:parseInt(t[4])||0,minor:parseInt(t[5])||0,patch:parseInt(t[6])||0}}}()&&!n.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1,M.zoomLevels={min:y,max:w},M.preserveDrawingBuffer=P,M.panBoundariesPadding=E,M.featureFlags=L(L({},n),x),d.active=m===f.debug,M.traceFirstPaint=new p("FirstPaint"),M}return S(t,e),t.prototype.collectAndEmitDeviceInfo=function(){return T(this,void 0,void 0,(function(){var e;return R(this,(function(t){switch(t.label){case 0:return[4,M()];case 1:return e=t.sent(),this.deviceInfo=L(L({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){var e,t;return T(this,void 0,void 0,(function(){var n,o;return R(this,(function(r){switch(r.label){case 0:this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),r.label=1;case 1:return r.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return r.sent(),[4,this.setFile(this.filePath)];case 3:return r.sent(),[4,this.preloadImages()];case 4:return r.sent(),[3,6];case 5:return n=r.sent(),[2,this.fail(n instanceof m?n:new m("ERROR","Unexpected exception initializing the web renderer",n))];case 6:return this.mode===f.debug&&((o=window).sketchWeb=this.sketchWebWasm,o.PRFindCriteria=null===(e=this.wasmModule)||void 0===e?void 0:e.PRFindCriteria,o.PRTimingFunction=null===(t=this.wasmModule)||void 0===t?void 0:t.PRTimingFunction),[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new p("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){d.debug("[C++] ".concat(e))},logWarning:function(e){d.warning("[C++] ".concat(e))},logError:function(e){d.error("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(d.warning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")},onCameraMoveStart:function(){e.emit("cameraMoveStart")},onCameraMoveEnd:function(){e.emit("cameraMoveEnd")},onCameraZoomStart:function(){e.emit("cameraZoomStart")},onCameraZoomEnd:function(){e.emit("cameraZoomEnd")},onCameraZoomChange:function(t){e.emit("cameraZoomChange",t)},onCameraPanChange:function(){var t=e.getPan();e.emit("cameraPanChange",t.x,t.y)},onCursorChange:function(t){var n=e.prCursorTypeToCSSCursorMap[t.value];n?e.emit("cursorChange",n):d.warning("Unknown cursor type ".concat(t.value))}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new p("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),d.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return T(this,void 0,void 0,(function(){var e,t,n,o,r,i,a,c,u=this;return R(this,(function(l){switch(l.label){case 0:return e=new p("WasmModuleDownload"),this.mode!==f.debug?[3,2]:[4,s.e(706).then(s.t.bind(s,706,23))];case 1:return t=l.sent(),[3,4];case 2:return[4,s.e(610).then(s.t.bind(s,610,23))];case 3:t=l.sent(),l.label=4;case 4:n=t.default,l.label=5;case 5:return l.trys.push([5,7,,8]),o=this,[4,n({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return u.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return o.wasmModule=l.sent(),[3,8];case 7:throw r=l.sent(),new m("WASM_ERROR","An error occurred while trying to create the wasm module.",r);case 8:if(this.pointerTypeToWASMMap={unset:this.wasmModule.PRUserPointerType.Unset,mouse:this.wasmModule.PRUserPointerType.Mouse,touch:this.wasmModule.PRUserPointerType.Touch},this.prCursorTypeToCSSCursorMap=((c={})[this.wasmModule.PRCursorType.Auto.value]="auto",c[this.wasmModule.PRCursorType.Default.value]="default",c[this.wasmModule.PRCursorType.Pointer.value]="pointer",c[this.wasmModule.PRCursorType.Grab.value]="grab",c[this.wasmModule.PRCursorType.Grabbing.value]="grabbing",c),e.printMeasurement(),this.emit("metric",e.measure()),i={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},d.debug("Using WebGL ".concat(i.majorVersion)),!(a=this.wasmModule.GL.createContext(this.canvas,i)))throw new m("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=a;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio,{showTilesBorders:this.showTilesBorders})}catch(e){throw new m("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.userEventsCollectorWasm=this.sketchWebWasm.getUserEventsCollector(),this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.backgroundColor.r&&e.g===this.backgroundColor.g&&e.b===this.backgroundColor.b&&e.a===this.backgroundColor.a||(null===(t=this.sketchWebWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.backgroundColor=e)},t.prototype.generateDocumentPNG=function(){return T(this,void 0,void 0,(function(){return R(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.sketchWebWasm.generateDocumentPNG()]}}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.setFile=function(e){return T(this,void 0,void 0,(function(){var t=this;return R(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.sketchWebWasm.setFile(e,(function(e,o,r,i){if(void 0===i&&(i=[]),i.length){d.debug("Parser warnings: ".concat(i));var a=i.map((function(e){return{key:e}}));t.emit("warnings",a)}t.setStatus({type:"FILE_READY"}),t.emit("fileReady",t.getDocument(),e,o,r),n()}),(function(){return o(new m("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:"".concat(e.toString()).concat(e.cause?"\nWrapped Error: ".concat(e.cause.toString()):"")}),d.error(e),e.cause&&d.error(e.cause)},t.prototype.setSize=function(e,t,n){var o;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(o=this.sketchWebWasm)||void 0===o||o.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(d.debug("Status transition ".concat(this.status.type," => ").concat(e.type,"}")),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:L(L({},e),{artboards:i(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){if(this.sketchWebWasm){var n=this.getDocument();if(n){for(var o=this.sketchWebWasm.getPan(),r=this.sketchWebWasm.getZoom(),i=(e-o.x)/r,a=(t-o.y)/r,s=0,c=n.artboards;s<c.length;s++){var u=c[s],l=u.bounds.x+u.bounds.width,h=u.bounds.y+u.bounds.height;if(i>=u.bounds.x&&a>=u.bounds.y&&i<=l&&a<=h)return u.objectId}return null}}},t.prototype.getPanAtPosition=function(e,t){if(this.sketchWebWasm){var n=this.getPan(),o=Math.max(this.getZoom(),Number.EPSILON),r=e/o,i=t/o;return{x:n.x-r,y:n.y-i}}},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.setZoom(e,t.x,t.y)},t.prototype.getPan=function(){if(this.sketchWebWasm){var e=this.getDocument();if(e){var t=e.bounds,n=this.sketchWebWasm.getPan(),o=this.sketchWebWasm.getZoom();return{x:n.x/o+t.x,y:n.y/o+t.y}}}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.handlePinchToZoomEvent=function(e,t){var n;null===(n=this.userEventsCollectorWasm)||void 0===n||n.dispatchPinchToZoomEvent(e,t.x,t.y)},t.prototype.pointerInfoToWASM=function(e){var t,n;return this.pointerTypeToWASMMap||d.warning("An user event was triggered, but the WASM module is not available."),L(L({},e),{type:null!==(n=null===(t=this.pointerTypeToWASMMap)||void 0===t?void 0:t[e.type])&&void 0!==n?n:this.wasmModule.PRUserPointerType.Unset})},t.prototype.setPan=function(e,t,n){if(void 0===n&&(n=!1),this.sketchWebWasm){var o=e,r=t,i=this.getDocument().bounds,a=this.sketchWebWasm.getZoom();if(n){var s=Math.max(2*a*this.pixelRatio,Number.EPSILON);o+=this.size.width/s,r+=this.size.height/s}var c=(o-i.x)*a,u=(r-i.y)*a;this.sketchWebWasm.setPan(c,u)}},t.prototype.handleWheelEvent=function(e,t){var n;null===(n=this.userEventsCollectorWasm)||void 0===n||n.dispatchWheelEvent(e.x,e.y,this.pointerInfoToWASM(t))},t.prototype.handlePointerDownEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(this.pointerInfoToWASM(e))},t.prototype.handlePointerMoveEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(this.pointerInfoToWASM(e))},t.prototype.setGlobalPointerPosition=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(this.pointerInfoToWASM(e))},t.prototype.handlePointerUpEvent=function(e){var t;null===(t=this.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(this.pointerInfoToWASM(e))},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.userEventsCollectorWasm=null,this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new m("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(e));const O=Symbol("Comlink.proxy"),D=Symbol("Comlink.endpoint"),I=Symbol("Comlink.releaseProxy"),_=Symbol("Comlink.thrown"),Z=e=>"object"==typeof e&&null!==e||"function"==typeof e,G=new Map([["proxy",{canHandle:e=>Z(e)&&e[O],serialize(e){const{port1:t,port2:n}=new MessageChannel;return j(e,t),[n,[n]]},deserialize:e=>(e.start(),B(e))}],["throw",{canHandle:e=>Z(e)&&_ in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function j(e,t=self){t.addEventListener("message",(function n(o){if(!o||!o.data)return;const{id:r,type:i,path:a}=Object.assign({path:[]},o.data),s=(o.data.argumentList||[]).map(H);let c;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),n=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":c=n;break;case"SET":t[a.slice(-1)[0]]=H(o.data.value),c=!0;break;case"APPLY":c=n.apply(t,s);break;case"CONSTRUCT":c=Y(new n(...s));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;j(e,n),c=K(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[_]:0}}Promise.resolve(c).catch((e=>({value:e,[_]:0}))).then((e=>{const[o,a]=$(e);t.postMessage(Object.assign(Object.assign({},o),{id:r}),a),"RELEASE"===i&&(t.removeEventListener("message",n),F(t))}))})),t.start&&t.start()}function F(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function B(e,t){return U(e,[],t)}function z(e){if(e)throw new Error("Proxy has been released and is not useable")}function U(e,t=[],n=function(){}){let o=!1;const r=new Proxy(n,{get(n,i){if(z(o),i===I)return()=>X(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{F(e),o=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=X(e,{type:"GET",path:t.map((e=>e.toString()))}).then(H);return n.then.bind(n)}return U(e,[...t,i])},set(n,r,i){z(o);const[a,s]=$(i);return X(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},s).then(H)},apply(n,r,i){z(o);const a=t[t.length-1];if(a===D)return X(e,{type:"ENDPOINT"}).then(H);if("bind"===a)return U(e,t.slice(0,-1));const[s,c]=N(i);return X(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},c).then(H)},construct(n,r){z(o);const[i,a]=N(r);return X(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(H)}});return r}function N(e){const t=e.map($);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const V=new WeakMap;function K(e,t){return V.set(e,t),e}function Y(e){return Object.assign(e,{[O]:!0})}function $(e){for(const[t,n]of G)if(n.canHandle(e)){const[o,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:o},r]}return[{type:"RAW",value:e},V.get(e)||[]]}function H(e){switch(e.type){case"HANDLER":return G.get(e.name).deserialize(e.value);case"RAW":return e.value}}function X(e,t,n){return new Promise((o=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===r&&(e.removeEventListener("message",t),o(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}var q,J=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Q=function(e){function n(n){var o=e.call(this)||this;return o.listenersCollector=new t,o.handleKeyUp=function(e){o.emit("keyUp",e.code)},o.target=n,o.addListeners(),o}return J(n,e),n.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},n.prototype.dispose=function(){this.listenersCollector.dispose()},n}(e),ee=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),te=function(){return te=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},te.apply(this,arguments)},ne=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},oe=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},re=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};!function(e){e[e.browser=0]="browser",e[e.worker=1]="worker"}(q||(q={}));var ie=function(e){function o(o){var r,i=this;(i=e.call(this)||this).listenersCollector=new t,i.handlePointerDownEvent=function(e){var t;null===(t=i.sketchWeb)||void 0===t||t.handlePointerDownEvent(e)},i.handlePointerMoveEvent=function(e){var t;null===(t=i.sketchWeb)||void 0===t||t.handlePointerMoveEvent(e)},i.handleGlobalPointerMoveEvent=function(e){var t;null===(t=i.sketchWeb)||void 0===t||t.setGlobalPointerPosition(e)},i.handlePointerUpEvent=function(e){var t;null===(t=i.sketchWeb)||void 0===t||t.handlePointerUpEvent(e)},i.handleWheelEvent=function(e,t){return ne(i,void 0,void 0,(function(){var n;return oe(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.handleWheelEvent(e,t),[2]}))}))},i.handlePinchToZoomEvent=function(e,t){return ne(i,void 0,void 0,(function(){var n;return oe(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.handlePinchToZoomEvent(e,t),[2]}))}))},i.handleCanvasResizeObserver=function(e){i.resizeCanvas(e[0].contentRect)},i.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){var e;i.setCanvasSize(t,n),i.gestureManager.updateTargetBounds(),null===(e=i.sketchWeb)||void 0===e||e.setSize(t,n,i.getDevicePixelRatio())}))};var a=null!==(r=o.featureFlags)&&void 0!==r?r:{};return i.featureFlags=te(te({},n),a),i.settings=o,i.canvas=o.canvas,i.gestureManager=new l(i.settings.container,{minimumZoomLevel:o.minimumZoomLevel,maximumZoomLevel:o.maximumZoomLevel}),i.keyboardManager=new Q(document.body),d.active=o.mode===f.debug,i.init(),i}return ee(o,e),o.prototype.init=function(){var e;return ne(this,void 0,void 0,(function(){var t,n,o;return oe(this,(function(r){switch(r.label){case 0:return this.setCanvasSize(this.settings.container.clientWidth,this.settings.container.clientHeight),[4,this.initSketchWeb()];case 1:return r.sent(),[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()];case 2:return"FILE_READY"!==(null==(t=r.sent())?void 0:t.type)?[2]:(n=void 0!==this.settings.initialZoom,o=void 0!==this.settings.initialPan,n||o?n?[4,this.setZoom(this.settings.initialZoom)]:[3,4]:[3,7]);case 3:r.sent(),r.label=4;case 4:return o?[4,this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)]:[3,6];case 5:r.sent(),r.label=6;case 6:return[3,9];case 7:return[4,this.zoomToFit()];case 8:r.sent(),r.label=9;case 9:return this.sketchWeb.startRendering(),this.addListeners(),[2]}}))}))},o.prototype.initSketchWeb=function(){return ne(this,void 0,void 0,(function(){var e,t,n,o,r;return oe(this,(function(i){switch(i.label){case 0:return e=this.featureFlags.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=te(te({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio(),featureFlags:this.featureFlags}),e?(this.environment=q.worker,d.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(s.p+s.u(667),s.b),{type:void 0}),n=B(this.worker),o=this,[4,new n(K(te(te({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return o.sketchWeb=i.sent(),[3,3];case 2:this.environment=q.browser,d.debug("Using normal canvas"),this.sketchWeb=new A(t),i.label=3;case 3:return(r=this.sketchWeb).on("status",this.forwardEvent("status")),r.on("fileReady",this.forwardEvent("fileReady")),r.on("metric",this.forwardEvent("metric")),r.on("warnings",this.forwardEvent("warnings")),r.on("allImagesReady",this.forwardEvent("allImagesReady")),r.on("deviceInfo",this.forwardEvent("deviceInfo")),r.on("cameraMoveStart",this.forwardEvent("cameraMoveStart")),r.on("cameraMoveEnd",this.forwardEvent("cameraMoveEnd")),r.on("cameraZoomStart",this.forwardEvent("cameraZoomStart")),r.on("cameraZoomEnd",this.forwardEvent("cameraZoomEnd")),r.on("cameraZoomChange",this.forwardEvent("cameraZoomChange")),r.on("cameraPanChange",this.forwardEvent("cameraPanChange")),r.on("cursorChange",this.forwardEvent("cursorChange")),[4,this.sketchWeb.init()];case 4:return i.sent(),[2]}}))}))},o.prototype.forwardEvent=function(e){var t=this,n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t.emit.apply(t,re([e],n,!1))};return this.environment===q.worker?Y(n):n},o.prototype.isRunningInsideWorker=function(){return this.environment===q.worker},o.prototype.looseWebGLContext=function(){var e;null===(e=this.sketchWeb)||void 0===e||e.looseWebGLContext()},o.prototype.addListeners=function(){this.canvasResizeObserver=new ResizeObserver(this.handleCanvasResizeObserver),this.canvasResizeObserver.observe(this.settings.container),this.listenersCollector.add(window,"orientationchange",this.handleDeviceOrientationChange),this.gestureManager.on("wheel",this.handleWheelEvent),this.gestureManager.on("pointerup",this.handlePointerUpEvent),this.gestureManager.on("pointermove",this.handlePointerMoveEvent),this.gestureManager.on("globalpointermove",this.handleGlobalPointerMoveEvent),this.gestureManager.on("pointerdown",this.handlePointerDownEvent),this.gestureManager.on("pinchToZoom",this.handlePinchToZoomEvent)},o.prototype.getDevicePixelRatio=function(){return r(window.devicePixelRatio,1,2)},o.prototype.setCanvasSize=function(e,t){this.canvas.style.width="".concat(e,"px"),this.canvas.style.height="".concat(t,"px"),this.canvas.width=e*this.getDevicePixelRatio(),this.canvas.height=t*this.getDevicePixelRatio()},o.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.settings.container.clientWidth,height:this.settings.container.clientHeight})},o.prototype.setBackgroundColor=function(e){var t;null===(t=this.sketchWeb)||void 0===t||t.setBackgroundColor(e)},o.prototype.zoomToFit=function(){return ne(this,void 0,void 0,(function(){return oe(this,(function(e){switch(e.label){case 0:return[4,this.sketchWeb.scaleDocumentToFit()];case 1:return e.sent(),[2]}}))}))},o.prototype.getStatus=function(){var e;return ne(this,void 0,void 0,(function(){return oe(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()]}))}))},o.prototype.generateDocumentPNG=function(){var e;return ne(this,void 0,void 0,(function(){return oe(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},o.prototype.getDocument=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getDocument()},o.prototype.getArtboardAtPosition=function(e,t){var n;return ne(this,void 0,void 0,(function(){return oe(this,(function(o){switch(o.label){case 0:return[4,null===(n=this.sketchWeb)||void 0===n?void 0:n.getArtboardAtPosition(e,t)];case 1:return[2,o.sent()||null]}}))}))},o.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWeb)||void 0===n?void 0:n.getPanAtPosition(e,t)},o.prototype.setPan=function(e,t,n){var o;return ne(this,void 0,void 0,(function(){return oe(this,(function(r){switch(r.label){case 0:return[4,null===(o=this.sketchWeb)||void 0===o?void 0:o.setPan(e,t,Boolean(n))];case 1:return r.sent(),[2]}}))}))},o.prototype.setZoom=function(e,t){var n;return ne(this,void 0,void 0,(function(){var o;return oe(this,(function(r){return o=null!=t?t:this.getCanvasCenterPoint(),null===(n=this.sketchWeb)||void 0===n||n.setZoom(e,o),[2]}))}))},o.prototype.getCanvasCenterPoint=function(){var e=this.canvas.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},o.prototype.getZoom=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()},o.prototype.getPan=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()},o.prototype.setIsCameraLocked=function(e){var t;null===(t=this.sketchWeb)||void 0===t||t.setIsCameraLocked(e)},o.prototype.dispose=function(){var e,t,n,o;return ne(this,void 0,void 0,(function(){return oe(this,(function(r){switch(r.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.dispose(),this.listenersCollector.dispose(),null===(e=this.canvasResizeObserver)||void 0===e||e.disconnect(),this.isRunningInsideWorker()?[4,null===(t=this.sketchWeb)||void 0===t?void 0:t.dispose()]:[3,2];case 1:return r.sent(),null===(n=this.worker)||void 0===n||n.terminate(),[3,3];case 2:null===(o=this.sketchWeb)||void 0===o||o.dispose(),r.label=3;case 3:return[2]}}))}))},o}(e),ae=s(156),se=s.n(ae),ce=(0,ae.createContext)(void 0),ue=function(){var e=(0,ae.useContext)(ce);if(void 0===e)throw Error("useSketchWebInternalContext must be used within a SketchWebProvider");return e},le=function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))},he=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return d.debug.apply(d,le(["SketchWebReact"],e,!1))},de=(0,ae.createContext)(void 0),fe=(0,ae.createContext)(void 0),pe=(0,ae.createContext)(void 0),ve=(0,ae.createContext)(void 0),me=(0,ae.createContext)(void 0),ge=(0,ae.createContext)(void 0),be=(0,ae.createContext)("auto"),ye=function(){var e=(0,ae.useContext)(de);if(void 0===e)throw Error("useStatus must be used within a SketchWebProvider");return e},we=function(){var e=(0,ae.useContext)(fe);if(void 0===e)throw Error("useDocument must be used within a SketchWebProvider");return e},Ce=function(){var e=(0,ae.useContext)(pe);if(void 0===e)throw Error("useZoom must be used within a SketchWebProvider");return e},Pe=function(){var e=(0,ae.useContext)(ge);if(void 0===e)throw Error("usePan must be used within a SketchWebProvider");return e},ke=function(){var e=(0,ae.useContext)(be);if(void 0===e)throw Error("useCursor must be used within a SketchWebProvider");return e},Ee=function(){var e=(0,ae.useContext)(ve);if(void 0===status)throw Error("useIsCameraZooming must be used within a SketchWebProvider");return e},We=function(){var e=(0,ae.useContext)(me);if(void 0===status)throw Error("useIsCameraMoving must be used within a SketchWebProvider");return e},xe=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{c(o.next(e))}catch(e){i(e)}}function s(e){try{c(o.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}c((o=o.apply(e,t||[])).next())}))},Me=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},Se=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(t){he("setZoom",t),null==e||e.setZoom(t)}),[e])},Le=function(){var e=Se(),t=Ce();return(0,ae.useCallback)((function(){var n;he("incrementZoom"),"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},Te=function(){var e=Se(),t=Ce();return(0,ae.useCallback)((function(){he("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},Re=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;he("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},Ae=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(){he("zoomToFit"),null==e||e.zoomToFit()}),[e])},Oe=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(){he("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},De=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(){return xe(void 0,void 0,void 0,(function(){return Me(this,(function(t){switch(t.label){case 0:return he("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},Ie=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(t,n){return xe(void 0,void 0,void 0,(function(){return Me(this,(function(o){switch(o.label){case 0:return he("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},_e=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(t,n){return xe(void 0,void 0,void 0,(function(){return Me(this,(function(o){switch(o.label){case 0:return he("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},Ze=function(){var e=(0,ue().getManager)();return(0,ae.useCallback)((function(t){he("setIsCameraLocked",t),null==e||e.setIsCameraLocked(t)}),[e])},Ge=function(e,t){var n=(0,ue().getManager)();(0,ae.useEffect)((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},je=function(){return je=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},je.apply(this,arguments)},Fe={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Be={position:"absolute",top:0,left:0},ze=function(e){d.active=e.mode===f.debug;var t=e.filePath,n=e.locateFile,o=e.imagesURLFormat,r=e.imagesURLMap,i=e.backgroundColor,a=e.mode,s=e.showTilesBorders,c=e.minimumZoomLevel,u=e.maximumZoomLevel,l=e.preserveDrawingBuffer,h=e.panBoundariesPadding,p=e.initialPan,v=e.initialZoom,m=e.children,g=e.containerProps,b=void 0===g?{}:g,y=e.canvasProps,w=void 0===y?{}:y,C=e.featureFlags,P=void 0===C?{}:C,k=(0,ae.useRef)(null),E=(0,ae.useRef)(null),W=(0,ae.useState)(!1),x=W[0],M=W[1],S=(0,ae.useCallback)((function(){return M(!0)}),[]),L=ue(),T=L.dispose,R=L.init,A=L.setSettings,O=ke(),D=ye();Ge("allImagesReady",S),(0,ae.useEffect)((function(){A({locateFile:n,imagesURLFormat:o,imagesURLMap:r,backgroundColor:i,mode:a,showTilesBorders:s,minimumZoomLevel:c,maximumZoomLevel:u,preserveDrawingBuffer:l,panBoundariesPadding:h,initialPan:p,initialZoom:v,featureFlags:P})}),[A,n,o,r,i,a,s,c,u,l,h,p,v,P]),(0,ae.useEffect)((function(){if(t)return R(t,k.current,E.current),function(){T()}}),[T,R,t]);var I=(0,ae.useMemo)((function(){var t;return null!==(t=e.cursor)&&void 0!==t?t:O}),[e.cursor,O]),_=(0,ae.useMemo)((function(){return je(je({},Fe),{cursor:I})}),[I]);return se().createElement("div",je({},b,{ref:E,style:_}),t&&se().createElement("canvas",je({},w,{key:t,ref:k,"data-sketchweb-all-images-ready":x,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==D?void 0:D.type.toLowerCase())||"null"),style:Be})),"READY"===(null==D?void 0:D.type)&&m)},Ue=function(){return Ue=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ue.apply(this,arguments)},Ne=function(e,t){switch(t.type){case"on-status":return Ue(Ue({},e),{status:t.status});case"on-file-ready":return Ue(Ue({},e),{document:t.document});case"on-zoom":return Ue(Ue({},e),{zoom:t.zoom});case"on-pan":return Ue(Ue({},e),{pan:t.pan});case"dispose":return Ue(Ue({},e),{status:null,zoom:null,pan:null,cursor:"auto"});case"post-init":return Ue(Ue({},e),{status:t.status,zoom:t.zoom});case"on-camera-zoom-start":return Ue(Ue({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return Ue(Ue({},e),{isCameraZooming:!1});case"on-camera-move-start":return Ue(Ue({},e),{isCameraMoving:!0});case"on-camera-move-end":return Ue(Ue({},e),{isCameraMoving:!1});case"on-cursor-change":return Ue(Ue({},e),{cursor:t.cursor});default:return e}},Ve=function(){return Ve=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},Ve.apply(this,arguments)},Ke=function(e){var t=(0,ae.useRef)(null),n=(0,ae.useRef)(null),o=(0,ae.useReducer)(Ne,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),r=o[0],i=r.status,a=r.document,s=r.zoom,c=r.pan,u=r.isCameraZooming,l=r.isCameraMoving,h=r.cursor,d=o[1],f=(0,ae.useCallback)((function(e){return d({type:"on-zoom",zoom:e})}),[]),p=(0,ae.useCallback)((function(e,t){return d({type:"on-pan",pan:{x:e,y:t}})}),[]),v=(0,ae.useCallback)((function(e){d({type:"on-status",status:e})}),[]),m=(0,ae.useCallback)((function(e){d({type:"on-file-ready",document:e})}),[]),g=(0,ae.useCallback)((function(){return d({type:"on-camera-zoom-start"})}),[]),b=(0,ae.useCallback)((function(){return d({type:"on-camera-zoom-end"})}),[]),y=(0,ae.useCallback)((function(){return d({type:"on-camera-move-start"})}),[]),w=(0,ae.useCallback)((function(){return d({type:"on-camera-move-end"})}),[]),C=(0,ae.useCallback)((function(e){return d({type:"on-cursor-change",cursor:e})}),[]),P=(0,ae.useCallback)((function(){var e=t.current;e&&(he("dispose"),e.off("status",v),e.off("fileReady",m),e.off("cameraZoomChange",f),e.off("cameraPanChange",p),e.off("cameraZoomStart",g),e.off("cameraZoomEnd",b),e.off("cameraMoveStart",y),e.off("cameraMoveEnd",w),e.off("cursorChange",C),e.dispose(),t.current=null,d({type:"dispose"}))}),[v,m,p,f,g,b,y,w,C]),k=(0,ae.useCallback)((function(e,o,r){if(""!==e&&o&&r&&n.current){he("init");var i=new ie(Ve(Ve({},n.current),{filePath:e,container:r,canvas:o}));i.on("status",v),i.on("fileReady",m),i.on("cameraZoomChange",f),i.on("cameraPanChange",p),i.on("cameraZoomStart",g),i.on("cameraZoomEnd",b),i.on("cameraMoveStart",y),i.on("cameraMoveEnd",w),i.on("cursorChange",C),a=void 0,s=void 0,u=function(){var e,t;return function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(n){switch(n.label){case 0:return e=d,t={type:"post-init"},[4,i.getZoom()];case 1:return t.zoom=n.sent()||null,[4,i.getStatus()];case 2:return t.status=n.sent()||null,[4,i.getPan()];case 3:return e.apply(void 0,[(t.pan=n.sent()||null,t)]),[2]}}))},new((c=void 0)||(c=Promise))((function(e,t){function n(e){try{r(u.next(e))}catch(e){t(e)}}function o(e){try{r(u.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof c?r:new c((function(e){e(r)}))).then(n,o)}r((u=u.apply(a,s||[])).next())})),t.current=i}var a,s,c,u}),[v,m,f,p,g,b,y,w,C]),E=(0,ae.useCallback)((function(e){var o;he("setSettings",e),e.backgroundColor&&(null===(o=t.current)||void 0===o||o.setBackgroundColor(e.backgroundColor)),n.current=e}),[]),W=(0,ae.useCallback)((function(){return t.current}),[]),x=(0,ae.useMemo)((function(){return{dispose:P,init:k,setSettings:E,getManager:W,dispatch:d}}),[P,k,E,W]);return se().createElement(ce.Provider,{value:x},se().createElement(de.Provider,{value:i},se().createElement(fe.Provider,{value:a},se().createElement(pe.Provider,{value:s},se().createElement(ge.Provider,{value:c},se().createElement(ve.Provider,{value:u},se().createElement(me.Provider,{value:l},se().createElement(be.Provider,{value:h},e.children))))))))};const Ye=ie;var $e=n})(),c})()));
Binary file
Binary file
@@ -0,0 +1 @@
1
+ (self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[]).push([[706],{706:e=>{var t,r=(t="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(e){var r,n,i=void 0!==(e=e||{})?e:{};i.ready=new Promise((function(e,t){r=e,n=t})),Object.getOwnPropertyDescriptor(i.ready,"_malloc")||(Object.defineProperty(i.ready,"_malloc",{configurable:!0,get:function(){Ce("You are getting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_malloc",{configurable:!0,set:function(){Ce("You are setting _malloc on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"_free")||(Object.defineProperty(i.ready,"_free",{configurable:!0,get:function(){Ce("You are getting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"_free",{configurable:!0,set:function(){Ce("You are setting _free on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___getTypeName")||(Object.defineProperty(i.ready,"___getTypeName",{configurable:!0,get:function(){Ce("You are getting ___getTypeName on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___getTypeName",{configurable:!0,set:function(){Ce("You are setting ___getTypeName on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___embind_register_native_and_builtin_types")||(Object.defineProperty(i.ready,"___embind_register_native_and_builtin_types",{configurable:!0,get:function(){Ce("You are getting ___embind_register_native_and_builtin_types on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___embind_register_native_and_builtin_types",{configurable:!0,set:function(){Ce("You are setting ___embind_register_native_and_builtin_types on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"___stdio_exit")||(Object.defineProperty(i.ready,"___stdio_exit",{configurable:!0,get:function(){Ce("You are getting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"___stdio_exit",{configurable:!0,set:function(){Ce("You are setting ___stdio_exit on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}})),Object.getOwnPropertyDescriptor(i.ready,"onRuntimeInitialized")||(Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,get:function(){Ce("You are getting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}),Object.defineProperty(i.ready,"onRuntimeInitialized",{configurable:!0,set:function(){Ce("You are setting onRuntimeInitialized on the Promise object, instead of the instance. Use .then() to get called back with the instance, see the MODULARIZE docs in src/settings.js")}}));var a=Object.assign({},i),o=[],s="./this.program",c=(e,t)=>{throw t},u=!0,l=!1,f=!1,d=!1;if(i.ENVIRONMENT)throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");var m,p="";function g(e){return i.locateFile?i.locateFile(e,p):p+e}function v(e){if(e instanceof Cs)return;let t=e;e&&"object"==typeof e&&e.stack&&(t=[e,e.stack]),_("exiting due to exception: "+t)}if(d){if("object"==typeof process||"object"==typeof window||"function"==typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");m=function(e){let t;return"function"==typeof readbuffer?new Uint8Array(readbuffer(e)):(t=read(e,"binary"),O("object"==typeof t),t)},"undefined"!=typeof scriptArgs?o=scriptArgs:void 0!==arguments&&(o=arguments),"function"==typeof quit&&(c=(e,t)=>{v(t),quit(e)}),"undefined"!=typeof print&&("undefined"==typeof console&&(console={}),console.log=print,console.warn=console.error="undefined"!=typeof printErr?printErr:print)}else{if(!u&&!l)throw new Error("environment detection error");if(l?p=self.location.href:"undefined"!=typeof document&&document.currentScript&&(p=document.currentScript.src),t&&(p=t),p=0!==p.indexOf("blob:")?p.substr(0,p.replace(/[?#].*/,"").lastIndexOf("/")+1):"","object"!=typeof window&&"function"!=typeof importScripts)throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");l&&(m=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)})}var h=i.print||console.log.bind(console),_=i.printErr||console.warn.bind(console);function y(e){y.shown||(y.shown={}),y.shown[e]||(y.shown[e]=1,_(e))}function b(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){Ce("Module."+e+" has been replaced with plain "+t+" (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)")}})}function w(e){Object.getOwnPropertyDescriptor(i,e)&&Ce("`Module."+e+"` was supplied but `"+e+"` not included in INCOMING_MODULE_JS_API")}function T(e,t){var r="'"+e+"' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the FAQ)";return t&&(r+=". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you"),r}function E(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){Ce(T(e,t))}})}function x(e,t){Object.getOwnPropertyDescriptor(i,e)||(i[e]=()=>Ce(T(e,t)))}Object.assign(i,a),a=null,is(),i.arguments&&(o=i.arguments),b("arguments","arguments_"),i.thisProgram&&(s=i.thisProgram),b("thisProgram","thisProgram"),i.quit&&(c=i.quit),b("quit","quit_"),O(void 0===i.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),O(void 0===i.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),O(void 0===i.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),O(void 0===i.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),O(void 0===i.read,"Module.read option was removed (modify read_ in JS)"),O(void 0===i.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),O(void 0===i.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),O(void 0===i.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),O(void 0===i.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),b("read","read_"),b("readAsync","readAsync"),b("readBinary","readBinary"),b("setWindowTitle","setWindowTitle"),O(!l,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),O(!f,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),O(!d,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var S,P,C=0,A=e=>{C=e},I=()=>C;i.wasmBinary&&(S=i.wasmBinary),b("wasmBinary","wasmBinary"),i.noExitRuntime,b("noExitRuntime","noExitRuntime"),"object"!=typeof WebAssembly&&Ce("no native wasm support detected");var F,k=!1;function O(e,t){e||Ce("Assertion failed"+(t?": "+t:""))}var D="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function L(e,t,r){for(var n=t+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.buffer&&D)return D.decode(e.subarray(t,i));for(var a="";t<i;){var o=e[t++];if(128&o){var s=63&e[t++];if(192!=(224&o)){var c=63&e[t++];if(224==(240&o)?o=(15&o)<<12|s<<6|c:(240!=(248&o)&&y("Invalid UTF-8 leading byte 0x"+o.toString(16)+" encountered when deserializing a UTF-8 string in wasm memory to a JS string!"),o=(7&o)<<18|s<<12|c<<6|63&e[t++]),o<65536)a+=String.fromCharCode(o);else{var u=o-65536;a+=String.fromCharCode(55296|u>>10,56320|1023&u)}}else a+=String.fromCharCode((31&o)<<6|s)}else a+=String.fromCharCode(o)}return a}function M(e,t){return e?L($,e,t):""}function R(e,t,r,n){if(!(n>0))return 0;for(var i=r,a=r+n-1,o=0;o<e.length;++o){var s=e.charCodeAt(o);if(s>=55296&&s<=57343&&(s=65536+((1023&s)<<10)|1023&e.charCodeAt(++o)),s<=127){if(r>=a)break;t[r++]=s}else if(s<=2047){if(r+1>=a)break;t[r++]=192|s>>6,t[r++]=128|63&s}else if(s<=65535){if(r+2>=a)break;t[r++]=224|s>>12,t[r++]=128|s>>6&63,t[r++]=128|63&s}else{if(r+3>=a)break;s>1114111&&y("Invalid Unicode code point 0x"+s.toString(16)+" encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF)."),t[r++]=240|s>>18,t[r++]=128|s>>12&63,t[r++]=128|s>>6&63,t[r++]=128|63&s}}return t[r]=0,r-i}function U(e,t,r){return O("number"==typeof r,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),R(e,$,t,r)}function B(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&(n=65536+((1023&n)<<10)|1023&e.charCodeAt(++r)),n<=127?++t:t+=n<=2047?2:n<=65535?3:4}return t}var W,N,$,j,G,V,H,Y,z,q,J,Z="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function K(e,t){O(e%2==0,"Pointer passed to UTF16ToString must be aligned to two bytes!");for(var r=e,n=r>>1,i=n+t/2;!(n>=i)&&G[n];)++n;if((r=n<<1)-e>32&&Z)return Z.decode($.subarray(e,r));for(var a="",o=0;!(o>=t/2);++o){var s=j[e+2*o>>1];if(0==s)break;a+=String.fromCharCode(s)}return a}function X(e,t,r){if(O(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),O("number"==typeof r,"stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===r&&(r=2147483647),r<2)return 0;for(var n=t,i=(r-=2)<2*e.length?r/2:e.length,a=0;a<i;++a){var o=e.charCodeAt(a);j[t>>1]=o,t+=2}return j[t>>1]=0,t-n}function Q(e){return 2*e.length}function ee(e,t){O(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var r=0,n="";!(r>=t/4);){var i=V[e+4*r>>2];if(0==i)break;if(++r,i>=65536){var a=i-65536;n+=String.fromCharCode(55296|a>>10,56320|1023&a)}else n+=String.fromCharCode(i)}return n}function te(e,t,r){if(O(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),O("number"==typeof r,"stringToUTF32(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),void 0===r&&(r=2147483647),r<4)return 0;for(var n=t,i=n+r-4,a=0;a<e.length;++a){var o=e.charCodeAt(a);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++a)),V[t>>2]=o,(t+=4)+4>i)break}return V[t>>2]=0,t-n}function re(e){for(var t=0,r=0;r<e.length;++r){var n=e.charCodeAt(r);n>=55296&&n<=57343&&++r,t+=4}return t}function ne(e,t){O(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),N.set(e,t)}function ie(e,t,r){for(var n=0;n<e.length;++n)O(e.charCodeAt(n)===(255&e.charCodeAt(n))),N[t++>>0]=e.charCodeAt(n);r||(N[t>>0]=0)}function ae(e){W=e,i.HEAP8=N=new Int8Array(e),i.HEAP16=j=new Int16Array(e),i.HEAP32=V=new Int32Array(e),i.HEAPU8=$=new Uint8Array(e),i.HEAPU16=G=new Uint16Array(e),i.HEAPU32=H=new Uint32Array(e),i.HEAPF32=Y=new Float32Array(e),i.HEAPF64=J=new Float64Array(e),i.HEAP64=z=new BigInt64Array(e),i.HEAPU64=q=new BigUint64Array(e)}var oe=5242880;i.TOTAL_STACK&&O(oe===i.TOTAL_STACK,"the stack size can no longer be determined at runtime");var se,ce=i.INITIAL_MEMORY||134217728;function ue(){var e=ds();O(0==(3&e)),V[e>>2]=34821223,V[e+4>>2]=2310721022,H[0]=1668509029}function le(){if(!k){var e=ds(),t=H[e>>2],r=H[e+4>>2];34821223==t&&2310721022==r||Ce("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+r.toString(16)+" 0x"+t.toString(16)),1668509029!==H[0]&&Ce("Runtime error: The application has corrupted its heap memory area (address zero)!")}}b("INITIAL_MEMORY","INITIAL_MEMORY"),O(ce>=oe,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+ce+"! (TOTAL_STACK="+oe+")"),O("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),O(!i.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),O(134217728==ce,"Detected runtime INITIAL_MEMORY setting. Use -sIMPORTED_MEMORY to define wasmMemory dynamically"),function(){var e=new Int16Array(1),t=new Int8Array(e.buffer);if(e[0]=25459,115!==t[0]||99!==t[1])throw"Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)"}();var fe=[],de=[],me=[],pe=!1;function ge(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)_e(i.preRun.shift());Ue(fe)}function ve(){le(),O(!pe),pe=!0,Ue(de)}function he(){if(le(),i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)be(i.postRun.shift());Ue(me)}function _e(e){fe.unshift(e)}function ye(e){de.unshift(e)}function be(e){me.unshift(e)}O(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),O(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),O(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),O(Math.trunc,"This browser does not support Math.trunc(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill");var we=0,Te=null,Ee=null,xe={};function Se(e){we++,i.monitorRunDependencies&&i.monitorRunDependencies(we),e?(O(!xe[e]),xe[e]=1,null===Te&&"undefined"!=typeof setInterval&&(Te=setInterval((function(){if(k)return clearInterval(Te),void(Te=null);var e=!1;for(var t in xe)e||(e=!0,_("still waiting on run dependencies:")),_("dependency: "+t);e&&_("(end of list)")}),1e4))):_("warning: run dependency added without ID")}function Pe(e){if(we--,i.monitorRunDependencies&&i.monitorRunDependencies(we),e?(O(xe[e]),delete xe[e]):_("warning: run dependency removed without ID"),0==we&&(null!==Te&&(clearInterval(Te),Te=null),Ee)){var t=Ee;Ee=null,t()}}function Ce(e){i.onAbort&&i.onAbort(e),_(e="Aborted("+e+")"),k=!0,F=1;var t=new WebAssembly.RuntimeError(e);throw n(t),t}var Ae={error:function(){Ce("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM")},init:function(){Ae.error()},createDataFile:function(){Ae.error()},createPreloadedFile:function(){Ae.error()},createLazyFile:function(){Ae.error()},open:function(){Ae.error()},mkdev:function(){Ae.error()},registerDevice:function(){Ae.error()},analyzePath:function(){Ae.error()},loadFilesFromDB:function(){Ae.error()},ErrnoError:function(){Ae.error()}};i.FS_createDataFile=Ae.createDataFile,i.FS_createPreloadedFile=Ae.createPreloadedFile;var Ie,Fe="data:application/octet-stream;base64,";function ke(e){return e.startsWith(Fe)}function Oe(e){return e.startsWith("file://")}function De(e,t){return function(){var r=e,n=t;return t||(n=i.asm),O(pe,"native function `"+r+"` called before runtime initialization"),n[e]||O(n[e],"exported native function `"+r+"` not found"),n[e].apply(null,arguments)}}function Le(e){try{if(e==Ie&&S)return new Uint8Array(S);if(m)return m(e);throw"both async and sync fetching of the wasm failed"}catch(e){Ce(e)}}function Me(){return S||!u&&!l||"function"!=typeof fetch?Promise.resolve().then((function(){return Le(Ie)})):fetch(Ie,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+Ie+"'";return e.arrayBuffer()})).catch((function(){return Le(Ie)}))}function Re(){var e={env:os,wasi_snapshot_preview1:os};function t(e,t){var r=e.exports;i.asm=r,O(P=i.asm.memory,"memory not found in wasm exports"),ae(P.buffer),O(se=i.asm.__indirect_function_table,"table not found in wasm exports"),ye(i.asm.__wasm_call_ctors),Pe("wasm-instantiate")}Se("wasm-instantiate");var r=i;function a(e){O(i===r,"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?"),r=null,t(e.instance)}function o(t){return Me().then((function(t){return WebAssembly.instantiate(t,e)})).then((function(e){return e})).then(t,(function(e){_("failed to asynchronously prepare wasm: "+e),Oe(Ie)&&_("warning: Loading from a file URI ("+Ie+") is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing"),Ce(e)}))}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(e){return _("Module.instantiateWasm callback failed with error: "+e),!1}return(S||"function"!=typeof WebAssembly.instantiateStreaming||ke(Ie)||"function"!=typeof fetch?o(a):fetch(Ie,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(a,(function(e){return _("wasm streaming compile failed: "+e),_("falling back to ArrayBuffer instantiation"),o(a)}))}))).catch(n),{}}function Ue(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?We(r)():We(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(i)}}ke(Ie="module-debug.wasm")||(Ie=g(Ie));var Be=[];function We(e){var t=Be[e];return t||(e>=Be.length&&(Be.length=e+1),Be[e]=t=se.get(e)),O(se.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t}function Ne(e){if(e instanceof Cs||"unwind"==e)return F;c(1,e)}function $e(e,t,r,n){Ce("Assertion failed: "+M(e)+", at: "+[t?M(t):"unknown filename",r,n?M(n):"unknown function"])}var je={};function Ge(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function Ve(e){return this.fromWireType(H[e>>2])}var He={},Ye={},ze={},qe=48,Je=57;function Ze(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=qe&&t<=Je?"_"+e:e}function Ke(e,t){return e=Ze(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function Xe(e,t){var r=Ke(t,(function(e){this.name=t,this.message=e;var r=new Error(e).stack;void 0!==r&&(this.stack=this.toString()+"\n"+r.replace(/^Error(:[^\n]*)?\n/,""))}));return r.prototype=Object.create(e.prototype),r.prototype.constructor=r,r.prototype.toString=function(){return void 0===this.message?this.name:this.name+": "+this.message},r}var Qe=void 0;function et(e){throw new Qe(e)}function tt(e,t,r){function n(t){var n=r(t);n.length!==e.length&&et("Mismatched type converter count");for(var i=0;i<e.length;++i)ut(e[i],n[i])}e.forEach((function(e){ze[e]=t}));var i=new Array(t.length),a=[],o=0;t.forEach(((e,t)=>{Ye.hasOwnProperty(e)?i[t]=Ye[e]:(a.push(e),He.hasOwnProperty(e)||(He[e]=[]),He[e].push((()=>{i[t]=Ye[e],++o===a.length&&n(i)})))})),0===a.length&&n(i)}function rt(e){var t=je[e];delete je[e];var r=t.rawConstructor,n=t.rawDestructor,i=t.fields;tt([e],i.map((e=>e.getterReturnType)).concat(i.map((e=>e.setterArgumentType))),(e=>{var a={};return i.forEach(((t,r)=>{var n=t.fieldName,o=e[r],s=t.getter,c=t.getterContext,u=e[r+i.length],l=t.setter,f=t.setterContext;a[n]={read:e=>o.fromWireType(s(c,e)),write:(e,t)=>{var r=[];l(f,e,u.toWireType(r,t)),Ge(r)}}})),[{name:t.name,fromWireType:function(e){var t={};for(var r in a)t[r]=a[r].read(e);return n(e),t},toWireType:function(e,t){for(var i in a)if(!(i in t))throw new TypeError('Missing field: "'+i+'"');var o=r();for(i in a)a[i].write(o,t[i]);return null!==e&&e.push(n,o),o},argPackAdvance:8,readValueFromPointer:Ve,destructorFunction:n}]}))}function nt(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}function it(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);at=e}var at=void 0;function ot(e){for(var t="",r=e;$[r];)t+=at[$[r++]];return t}var st=void 0;function ct(e){throw new st(e)}function ut(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(e||ct('type "'+n+'" must have a positive integer typeid pointer'),Ye.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;ct("Cannot register type '"+n+"' twice")}if(Ye[e]=t,delete ze[e],He.hasOwnProperty(e)){var i=He[e];delete He[e],i.forEach((e=>e()))}}function lt(e,t,r){switch(t){case 0:return r?function(e){return N[e]}:function(e){return $[e]};case 1:return r?function(e){return j[e>>1]}:function(e){return G[e>>1]};case 2:return r?function(e){return V[e>>2]}:function(e){return H[e>>2]};case 3:return r?function(e){return z[e>>3]}:function(e){return q[e>>3]};default:throw new TypeError("Unknown integer type: "+e)}}function ft(e,t,r,n,i){t=ot(t);var a=dt(r),o=-1!=t.indexOf("u");o&&(i=(BigInt(1)<<BigInt(64))-BigInt(1)),ut(e,{name:t,fromWireType:function(e){return e},toWireType:function(e,r){if("bigint"!=typeof r)throw new TypeError('Cannot convert "'+nt(r)+'" to '+this.name);if(r<n||r>i)throw new TypeError('Passing a number "'+nt(r)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+i+"]!");return r},argPackAdvance:8,readValueFromPointer:lt(t,a,!o),destructorFunction:null})}function dt(e){switch(e){case 1:return 0;case 2:return 1;case 4:return 2;case 8:return 3;default:throw new TypeError("Unknown type size: "+e)}}function mt(e,t,r,n,i){var a=dt(r);ut(e,{name:t=ot(t),fromWireType:function(e){return!!e},toWireType:function(e,t){return t?n:i},argPackAdvance:8,readValueFromPointer:function(e){var n;if(1===r)n=N;else if(2===r)n=j;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);n=V}return this.fromWireType(n[e>>a])},destructorFunction:null})}function pt(e){if(!(this instanceof $t))return!1;if(!(e instanceof $t))return!1;for(var t=this.$$.ptrType.registeredClass,r=this.$$.ptr,n=e.$$.ptrType.registeredClass,i=e.$$.ptr;t.baseClass;)r=t.upcast(r),t=t.baseClass;for(;n.baseClass;)i=n.upcast(i),n=n.baseClass;return t===n&&r===i}function gt(e){return{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType}}function vt(e){ct(e.$$.ptrType.registeredClass.name+" instance already deleted")}var ht=!1;function _t(e){}function yt(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}function bt(e){e.count.value-=1,0===e.count.value&&yt(e)}function wt(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var n=wt(e,t,r.baseClass);return null===n?null:r.downcast(n)}var Tt={};function Et(){return Object.keys(Ft).length}function xt(){var e=[];for(var t in Ft)Ft.hasOwnProperty(t)&&e.push(Ft[t]);return e}var St=[];function Pt(){for(;St.length;){var e=St.pop();e.$$.deleteScheduled=!1,e.delete()}}var Ct=void 0;function At(e){Ct=e,St.length&&Ct&&Ct(Pt)}function It(){i.getInheritedInstanceCount=Et,i.getLiveInheritedInstances=xt,i.flushPendingDeletes=Pt,i.setDelayFunction=At}var Ft={};function kt(e,t){for(void 0===t&&ct("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}function Ot(e,t){return t=kt(e,t),Ft[t]}function Dt(e,t){return t.ptrType&&t.ptr||et("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&et("Both smartPtrType and smartPtr must be specified"),t.count={value:1},Mt(Object.create(e,{$$:{value:t}}))}function Lt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Ot(this.registeredClass,t);if(void 0!==r){if(0===r.$$.count.value)return r.$$.ptr=t,r.$$.smartPtr=e,r.clone();var n=r.clone();return this.destructor(e),n}function i(){return this.isSmartPointer?Dt(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):Dt(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a,o=this.registeredClass.getActualType(t),s=Tt[o];if(!s)return i.call(this);a=this.isConst?s.constPointerType:s.pointerType;var c=wt(t,this.registeredClass,a.registeredClass);return null===c?i.call(this):this.isSmartPointer?Dt(a.registeredClass.instancePrototype,{ptrType:a,ptr:c,smartPtrType:this,smartPtr:e}):Dt(a.registeredClass.instancePrototype,{ptrType:a,ptr:c})}function Mt(e){return"undefined"==typeof FinalizationRegistry?(Mt=e=>e,e):(ht=new FinalizationRegistry((e=>{console.warn(e.leakWarning.stack.replace(/^Error: /,"")),bt(e.$$)})),Mt=e=>{var t=e.$$;if(t.smartPtr){var r={$$:t},n=t.ptrType.registeredClass;r.leakWarning=new Error("Embind found a leaked C++ instance "+n.name+" <0x"+t.ptr.toString(16)+">.\nWe'll free it automatically in this case, but this functionality is not reliable across various environments.\nMake sure to invoke .delete() manually once you're done with the instance instead.\nOriginally allocated"),"captureStackTrace"in Error&&Error.captureStackTrace(r.leakWarning,Lt),ht.register(e,r,e)}return e},_t=e=>ht.unregister(e),Mt(e))}function Rt(){if(this.$$.ptr||vt(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e=Mt(Object.create(Object.getPrototypeOf(this),{$$:{value:gt(this.$$)}}));return e.$$.count.value+=1,e.$$.deleteScheduled=!1,e}function Ut(){this.$$.ptr||vt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ct("Object already scheduled for deletion"),_t(this),bt(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function Bt(){return!this.$$.ptr}function Wt(){return this.$$.ptr||vt(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&ct("Object already scheduled for deletion"),St.push(this),1===St.length&&Ct&&Ct(Pt),this.$$.deleteScheduled=!0,this}function Nt(){$t.prototype.isAliasOf=pt,$t.prototype.clone=Rt,$t.prototype.delete=Ut,$t.prototype.isDeleted=Bt,$t.prototype.deleteLater=Wt}function $t(){}function jt(e,t,r){if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||ct("Function '"+r+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+e[t].overloadTable+")!"),e[t].overloadTable[arguments.length].apply(this,arguments)},e[t].overloadTable=[],e[t].overloadTable[n.argCount]=n}}function Gt(e,t,r){i.hasOwnProperty(e)?((void 0===r||void 0!==i[e].overloadTable&&void 0!==i[e].overloadTable[r])&&ct("Cannot register public name '"+e+"' twice"),jt(i,e,e),i.hasOwnProperty(r)&&ct("Cannot register multiple overloads of a function with the same number of arguments ("+r+")!"),i[e].overloadTable[r]=t):(i[e]=t,void 0!==r&&(i[e].numArguments=r))}function Vt(e,t,r,n,i,a,o,s){this.name=e,this.constructor=t,this.instancePrototype=r,this.rawDestructor=n,this.baseClass=i,this.getActualType=a,this.upcast=o,this.downcast=s,this.pureVirtualFunctions=[]}function Ht(e,t,r){for(;t!==r;)t.upcast||ct("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function Yt(e,t){if(null===t)return this.isReference&&ct("null is not a valid "+this.name),0;t.$$||ct('Cannot pass "'+nt(t)+'" as a '+this.name),t.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return Ht(t.$$.ptr,r,this.registeredClass)}function zt(e,t){var r;if(null===t)return this.isReference&&ct("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||ct('Cannot pass "'+nt(t)+'" as a '+this.name),t.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&ct("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);var n=t.$$.ptrType.registeredClass;if(r=Ht(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&ct("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:ct("Cannot convert argument of type "+(t.$$.smartPtrType?t.$$.smartPtrType.name:t.$$.ptrType.name)+" to parameter type "+this.name);break;case 1:r=t.$$.smartPtr;break;case 2:if(t.$$.smartPtrType===this)r=t.$$.smartPtr;else{var i=t.clone();r=this.rawShare(r,_r.toHandle((function(){i.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:ct("Unsupporting sharing policy")}return r}function qt(e,t){if(null===t)return this.isReference&&ct("null is not a valid "+this.name),0;t.$$||ct('Cannot pass "'+nt(t)+'" as a '+this.name),t.$$.ptr||ct("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&ct("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return Ht(t.$$.ptr,r,this.registeredClass)}function Jt(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function Zt(e){this.rawDestructor&&this.rawDestructor(e)}function Kt(e){null!==e&&e.delete()}function Xt(){Qt.prototype.getPointee=Jt,Qt.prototype.destructor=Zt,Qt.prototype.argPackAdvance=8,Qt.prototype.readValueFromPointer=Ve,Qt.prototype.deleteObject=Kt,Qt.prototype.fromWireType=Lt}function Qt(e,t,r,n,i,a,o,s,c,u,l){this.name=e,this.registeredClass=t,this.isReference=r,this.isConst=n,this.isSmartPointer=i,this.pointeeType=a,this.sharingPolicy=o,this.rawGetPointee=s,this.rawConstructor=c,this.rawShare=u,this.rawDestructor=l,i||void 0!==t.baseClass?this.toWireType=zt:n?(this.toWireType=Yt,this.destructorFunction=null):(this.toWireType=qt,this.destructorFunction=null)}function er(e,t,r){i.hasOwnProperty(e)||et("Replacing nonexistant public symbol"),void 0!==i[e].overloadTable&&void 0!==r?i[e].overloadTable[r]=t:(i[e]=t,i[e].argCount=r)}function tr(e,t){e=ot(e);var r=We(t);return"function"!=typeof r&&ct("unknown function pointer with signature "+e+": "+t),r}var rr=void 0;function nr(e){var t=us(e),r=ot(t);return cs(t),r}function ir(e,t){var r=[],n={};throw t.forEach((function e(t){n[t]||Ye[t]||(ze[t]?ze[t].forEach(e):(r.push(t),n[t]=!0))})),new rr(e+": "+r.map(nr).join([", "]))}function ar(e,t,r,n,i,a,o,s,c,u,l,f,d){l=ot(l),a=tr(i,a),s&&(s=tr(o,s)),u&&(u=tr(c,u)),d=tr(f,d);var m=Ze(l);Gt(m,(function(){ir("Cannot construct "+l+" due to unbound types",[n])})),tt([e,t,r],n?[n]:[],(function(t){var r,i;t=t[0],i=n?(r=t.registeredClass).instancePrototype:$t.prototype;var o=Ke(m,(function(){if(Object.getPrototypeOf(this)!==c)throw new st("Use 'new' to construct "+l);if(void 0===f.constructor_body)throw new st(l+" has no accessible constructor");var e=f.constructor_body[arguments.length];if(void 0===e)throw new st("Tried to invoke ctor of "+l+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(f.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),c=Object.create(i,{constructor:{value:o}});o.prototype=c;var f=new Vt(l,o,c,d,r,a,s,u),p=new Qt(l,f,!0,!1,!1),g=new Qt(l+"*",f,!1,!1,!1),v=new Qt(l+" const*",f,!1,!0,!1);return Tt[e]={pointerType:g,constPointerType:v},er(m,o),[p,g,v]}))}function or(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=Ke(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,i=e.apply(n,t);return i instanceof Object?i:n}function sr(e,t,r,n,i){var a=t.length;a<2&&ct("argTypes array size mismatch! Must at least get return value and 'this' types!");for(var o=null!==t[1]&&null!==r,s=!1,c=1;c<t.length;++c)if(null!==t[c]&&void 0===t[c].destructorFunction){s=!0;break}var u="void"!==t[0].name,l="",f="";for(c=0;c<a-2;++c)l+=(0!==c?", ":"")+"arg"+c,f+=(0!==c?", ":"")+"arg"+c+"Wired";var d="return function "+Ze(e)+"("+l+") {\nif (arguments.length !== "+(a-2)+") {\nthrowBindingError('function "+e+" called with ' + arguments.length + ' arguments, expected "+(a-2)+" args!');\n}\n";s&&(d+="var destructors = [];\n");var m=s?"destructors":"null",p=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],g=[ct,n,i,Ge,t[0],t[1]];for(o&&(d+="var thisWired = classParam.toWireType("+m+", this);\n"),c=0;c<a-2;++c)d+="var arg"+c+"Wired = argType"+c+".toWireType("+m+", arg"+c+"); // "+t[c+2].name+"\n",p.push("argType"+c),g.push(t[c+2]);if(o&&(f="thisWired"+(f.length>0?", ":"")+f),d+=(u?"var rv = ":"")+"invoker(fn"+(f.length>0?", ":"")+f+");\n",s)d+="runDestructors(destructors);\n";else for(c=o?1:2;c<t.length;++c){var v=1===c?"thisWired":"arg"+(c-2)+"Wired";null!==t[c].destructorFunction&&(d+=v+"_dtor("+v+"); // "+t[c].name+"\n",p.push(v+"_dtor"),g.push(t[c].destructorFunction))}return u&&(d+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),d+="}\n",p.push(d),or(Function,p).apply(null,g)}function cr(e,t){for(var r=[],n=0;n<e;n++)r.push(V[(t>>2)+n]);return r}function ur(e,t,r,n,i,a,o){var s=cr(r,n);t=ot(t),a=tr(i,a),tt([],[e],(function(e){var n=(e=e[0]).name+"."+t;function i(){ir("Cannot call "+n+" due to unbound types",s)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]);var c=e.registeredClass.constructor;return void 0===c[t]?(i.argCount=r-1,c[t]=i):(jt(c,t,n),c[t].overloadTable[r-1]=i),tt([],s,(function(e){var i=[e[0],null].concat(e.slice(1)),s=sr(n,i,null,a,o);return void 0===c[t].overloadTable?(s.argCount=r-1,c[t]=s):c[t].overloadTable[r-1]=s,[]})),[]}))}function lr(e,t,r,n,i,a){O(t>0);var o=cr(t,r);i=tr(n,i),tt([],[e],(function(e){var r="constructor "+(e=e[0]).name;if(void 0===e.registeredClass.constructor_body&&(e.registeredClass.constructor_body=[]),void 0!==e.registeredClass.constructor_body[t-1])throw new st("Cannot register multiple constructors with identical number of parameters ("+(t-1)+") for class '"+e.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");return e.registeredClass.constructor_body[t-1]=()=>{ir("Cannot construct "+e.name+" due to unbound types",o)},tt([],o,(function(n){return n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=sr(r,n,null,i,a),[]})),[]}))}function fr(e,t,r,n,i,a,o,s){var c=cr(r,n);t=ot(t),a=tr(i,a),tt([],[e],(function(e){var n=(e=e[0]).name+"."+t;function i(){ir("Cannot call "+n+" due to unbound types",c)}t.startsWith("@@")&&(t=Symbol[t.substring(2)]),s&&e.registeredClass.pureVirtualFunctions.push(t);var u=e.registeredClass.instancePrototype,l=u[t];return void 0===l||void 0===l.overloadTable&&l.className!==e.name&&l.argCount===r-2?(i.argCount=r-2,i.className=e.name,u[t]=i):(jt(u,t,n),u[t].overloadTable[r-2]=i),tt([],c,(function(i){var s=sr(n,i,e,a,o);return void 0===u[t].overloadTable?(s.argCount=r-2,u[t]=s):u[t].overloadTable[r-2]=s,[]})),[]}))}var dr=[],mr=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function pr(e){e>4&&0==--mr[e].refcount&&(mr[e]=void 0,dr.push(e))}function gr(){for(var e=0,t=5;t<mr.length;++t)void 0!==mr[t]&&++e;return e}function vr(){for(var e=5;e<mr.length;++e)if(void 0!==mr[e])return mr[e];return null}function hr(){i.count_emval_handles=gr,i.get_first_emval=vr}var _r={toValue:e=>(e||ct("Cannot use deleted val. handle = "+e),mr[e].value),toHandle:e=>{switch(e){case void 0:return 1;case null:return 2;case!0:return 3;case!1:return 4;default:var t=dr.length?dr.pop():mr.length;return mr[t]={refcount:1,value:e},t}}};function yr(e,t){ut(e,{name:t=ot(t),fromWireType:function(e){var t=_r.toValue(e);return pr(e),t},toWireType:function(e,t){return _r.toHandle(t)},argPackAdvance:8,readValueFromPointer:Ve,destructorFunction:null})}function br(e,t,r){switch(t){case 0:return function(e){var t=r?N:$;return this.fromWireType(t[e])};case 1:return function(e){var t=r?j:G;return this.fromWireType(t[e>>1])};case 2:return function(e){var t=r?V:H;return this.fromWireType(t[e>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function wr(e,t,r,n){var i=dt(r);function a(){}t=ot(t),a.values={},ut(e,{name:t,constructor:a,fromWireType:function(e){return this.constructor.values[e]},toWireType:function(e,t){return t.value},argPackAdvance:8,readValueFromPointer:br(t,i,n),destructorFunction:null}),Gt(t,a)}function Tr(e,t){var r=Ye[e];return void 0===r&&ct(t+" has unknown type "+nr(e)),r}function Er(e,t,r){var n=Tr(e,"enum");t=ot(t);var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:Ke(n.name+"_"+t,(function(){}))}});i.values[r]=a,i[t]=a}function xr(e,t){switch(t){case 2:return function(e){return this.fromWireType(Y[e>>2])};case 3:return function(e){return this.fromWireType(J[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Sr(e,t,r){var n=dt(r);ut(e,{name:t=ot(t),fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+nt(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:xr(t,n),destructorFunction:null})}function Pr(e,t,r,n,i){t=ot(t),-1===i&&(i=4294967295);var a=dt(r),o=e=>e;if(0===n){var s=32-8*r;o=e=>e<<s>>>s}var c=t.includes("unsigned"),u=(e,r)=>{if("number"!=typeof e&&"boolean"!=typeof e)throw new TypeError('Cannot convert "'+nt(e)+'" to '+r);if(e<n||e>i)throw new TypeError('Passing a number "'+nt(e)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+i+"]!")};ut(e,{name:t,fromWireType:o,toWireType:c?function(e,t){return u(t,this.name),t>>>0}:function(e,t){return u(t,this.name),t},argPackAdvance:8,readValueFromPointer:lt(t,a,0!==n),destructorFunction:null})}function Cr(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function i(e){var t=H,r=t[e>>=2],i=t[e+1];return new n(W,i,r)}ut(e,{name:r=ot(r),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})}function Ar(e,t,r,n,i,a,o,s,c,u,l,f){r=ot(r),a=tr(i,a),s=tr(o,s),u=tr(c,u),f=tr(l,f),tt([e],[t],(function(e){return e=e[0],[new Qt(r,e.registeredClass,!1,!1,!0,e,n,a,s,u,f)]}))}function Ir(e,t){var r="std::string"===(t=ot(t));ut(e,{name:t,fromWireType:function(e){var t,n=H[e>>2];if(r)for(var i=e+4,a=0;a<=n;++a){var o=e+4+a;if(a==n||0==$[o]){var s=M(i,o-i);void 0===t?t=s:(t+=String.fromCharCode(0),t+=s),i=o+1}}else{var c=new Array(n);for(a=0;a<n;++a)c[a]=String.fromCharCode($[e+4+a]);t=c.join("")}return cs(e),t},toWireType:function(e,t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var n="string"==typeof t;n||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int8Array||ct("Cannot pass non-string to std::string");var i=(r&&n?()=>B(t):()=>t.length)(),a=ss(4+i+1);if(H[a>>2]=i,r&&n)U(t,a+4,i+1);else if(n)for(var o=0;o<i;++o){var s=t.charCodeAt(o);s>255&&(cs(a),ct("String has UTF-16 code units that do not fit in 8 bits")),$[a+4+o]=s}else for(o=0;o<i;++o)$[a+4+o]=t[o];return null!==e&&e.push(cs,a),a},argPackAdvance:8,readValueFromPointer:Ve,destructorFunction:function(e){cs(e)}})}function Fr(e,t,r){var n,i,a,o,s;r=ot(r),2===t?(n=K,i=X,o=Q,a=()=>G,s=1):4===t&&(n=ee,i=te,o=re,a=()=>H,s=2),ut(e,{name:r,fromWireType:function(e){for(var r,i=H[e>>2],o=a(),c=e+4,u=0;u<=i;++u){var l=e+4+u*t;if(u==i||0==o[l>>s]){var f=n(c,l-c);void 0===r?r=f:(r+=String.fromCharCode(0),r+=f),c=l+t}}return cs(e),r},toWireType:function(e,n){"string"!=typeof n&&ct("Cannot pass non-string to C++ string type "+r);var a=o(n),c=ss(4+a+t);return H[c>>2]=a>>s,i(n,c+4,a+t),null!==e&&e.push(cs,c),c},argPackAdvance:8,readValueFromPointer:Ve,destructorFunction:function(e){cs(e)}})}function kr(e,t,r,n,i,a){je[e]={name:ot(t),rawConstructor:tr(r,n),rawDestructor:tr(i,a),fields:[]}}function Or(e,t,r,n,i,a,o,s,c,u){je[e].fields.push({fieldName:ot(t),getterReturnType:r,getter:tr(n,i),getterContext:a,setterArgumentType:o,setter:tr(s,c),setterContext:u})}function Dr(e,t){ut(e,{isVoid:!0,name:t=ot(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})}function Lr(){return Date.now()}function Mr(e){delete wo.xhrs[e-1]}var Rr=!0;function Ur(){return Rr}function Br(){throw 1/0}function Wr(e,t,r){e=_r.toValue(e),t=Tr(t,"emval::as");var n=[],i=_r.toHandle(n);return V[r>>2]=i,t.toWireType(n,e)}function Nr(e,t){for(var r=new Array(e),n=0;n<e;++n)r[n]=Tr(V[(t>>2)+n],"parameter "+n);return r}function $r(e,t,r,n){e=_r.toValue(e);for(var i=Nr(t,r),a=new Array(t),o=0;o<t;++o){var s=i[o];a[o]=s.readValueFromPointer(n),n+=s.argPackAdvance}var c=e.apply(void 0,a);return _r.toHandle(c)}function jr(e){var t=[];return V[e>>2]=_r.toHandle(t),t}var Gr={};function Vr(e){var t=Gr[e];return void 0===t?ot(e):t}var Hr=[];function Yr(e,t,r,n,i){return(e=Hr[e])(t=_r.toValue(t),r=Vr(r),jr(n),i)}function zr(e,t,r,n){(e=Hr[e])(t=_r.toValue(t),r=Vr(r),null,n)}function qr(){return"object"==typeof globalThis?globalThis:Function("return this")()}function Jr(e){return 0===e?_r.toHandle(qr()):(e=Vr(e),_r.toHandle(qr()[e]))}function Zr(e){var t=Hr.length;return Hr.push(e),t}var Kr,Xr=[];function Qr(e,t){var r=Nr(e,t),n=r[0],i=n.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",a=Xr[i];if(void 0!==a)return a;for(var o=["retType"],s=[n],c="",u=0;u<e-1;++u)c+=(0!==u?", ":"")+"arg"+u,o.push("argType"+u),s.push(r[1+u]);var l="return function "+Ze("methodCaller_"+i)+"(handle, name, destructors, args) {\n",f=0;for(u=0;u<e-1;++u)l+=" var arg"+u+" = argType"+u+".readValueFromPointer(args"+(f?"+"+f:"")+");\n",f+=r[u+1].argPackAdvance;for(l+=" var rv = handle[name]("+c+");\n",u=0;u<e-1;++u)r[u+1].deleteObject&&(l+=" argType"+u+".deleteObject(arg"+u+");\n");return n.isVoid||(l+=" return retType.toWireType(destructors, rv);\n"),l+="};\n",o.push(l),a=Zr(or(Function,o).apply(null,s)),Xr[i]=a,a}function en(e){return e=Vr(e),_r.toHandle(i[e])}function tn(e,t){return e=_r.toValue(e),t=_r.toValue(t),_r.toHandle(e[t])}function rn(e){e>4&&(mr[e].refcount+=1)}function nn(){return _r.toHandle([])}function an(e){return _r.toHandle(Vr(e))}function on(e){Ge(_r.toValue(e)),pr(e)}function sn(e,t){var r=(e=Tr(e,"_emval_take_value")).readValueFromPointer(t);return _r.toHandle(r)}function cn(){Ce("native code called abort()")}function un(e){cancelAnimationFrame(e)}function ln(e){var t=e.getExtension("ANGLE_instanced_arrays");if(t)return e.vertexAttribDivisor=function(e,r){t.vertexAttribDivisorANGLE(e,r)},e.drawArraysInstanced=function(e,r,n,i){t.drawArraysInstancedANGLE(e,r,n,i)},e.drawElementsInstanced=function(e,r,n,i,a){t.drawElementsInstancedANGLE(e,r,n,i,a)},1}function fn(e){var t=e.getExtension("OES_vertex_array_object");if(t)return e.createVertexArray=function(){return t.createVertexArrayOES()},e.deleteVertexArray=function(e){t.deleteVertexArrayOES(e)},e.bindVertexArray=function(e){t.bindVertexArrayOES(e)},e.isVertexArray=function(e){return t.isVertexArrayOES(e)},1}function dn(e){var t=e.getExtension("WEBGL_draw_buffers");if(t)return e.drawBuffers=function(e,r){t.drawBuffersWEBGL(e,r)},1}function mn(e){return!!(e.dibvbi=e.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"))}function pn(e){return!!(e.mdibvbi=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance"))}function gn(e){return!!(e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw"))}Kr=()=>performance.now();var vn={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function(e){vn.lastError||(vn.lastError=e)},getNewId:function(e){for(var t=vn.counter++,r=e.length;r<t;r++)e[r]=null;return t},getSource:function(e,t,r,n){for(var i="",a=0;a<t;++a){var o=n?V[n+4*a>>2]:-1;i+=M(V[r+4*a>>2],o<0?void 0:o)}return i},createContext:function(e,t){e.getContextSafariWebGL2Fixed||(e.getContextSafariWebGL2Fixed=e.getContext,e.getContext=function(t,r){var n=e.getContextSafariWebGL2Fixed(t,r);return"webgl"==t==n instanceof WebGLRenderingContext?n:null});var r=t.majorVersion>1?e.getContext("webgl2",t):e.getContext("webgl",t);return r?vn.registerContext(r,t):0},registerContext:function(e,t){var r=vn.getNewId(vn.contexts),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=n),vn.contexts[r]=n,(void 0===t.enableExtensionsByDefault||t.enableExtensionsByDefault)&&vn.initExtensions(n),r},makeContextCurrent:function(e){return vn.currentContext=vn.contexts[e],i.ctx=qo=vn.currentContext&&vn.currentContext.GLctx,!(e&&!qo)},getContext:function(e){return vn.contexts[e]},deleteContext:function(e){vn.currentContext===vn.contexts[e]&&(vn.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(vn.contexts[e].GLctx.canvas),vn.contexts[e]&&vn.contexts[e].GLctx.canvas&&(vn.contexts[e].GLctx.canvas.GLctxObject=void 0),vn.contexts[e]=null},initExtensions:function(e){if(e||(e=vn.currentContext),!e.initExtensionsDone){e.initExtensionsDone=!0;var t=e.GLctx;ln(t),fn(t),dn(t),mn(t),pn(t),e.version>=2&&(t.disjointTimerQueryExt=t.getExtension("EXT_disjoint_timer_query_webgl2")),(e.version<2||!t.disjointTimerQueryExt)&&(t.disjointTimerQueryExt=t.getExtension("EXT_disjoint_timer_query")),gn(t),(t.getSupportedExtensions()||[]).forEach((function(e){e.includes("lose_context")||e.includes("debug")||t.getExtension(e)}))}}};function hn(e){qo.activeTexture(e)}function _n(e,t){qo.attachShader(vn.programs[e],vn.shaders[t])}function yn(e,t,r){qo.bindAttribLocation(vn.programs[e],t,M(r))}function bn(e,t){35051==e?qo.currentPixelPackBufferBinding=t:35052==e&&(qo.currentPixelUnpackBufferBinding=t),qo.bindBuffer(e,vn.buffers[t])}function wn(e,t){qo.bindFramebuffer(e,vn.framebuffers[t])}function Tn(e,t){qo.bindRenderbuffer(e,vn.renderbuffers[t])}function En(e,t){qo.bindSampler(e,vn.samplers[t])}function xn(e,t){qo.bindTexture(e,vn.textures[t])}function Sn(e){qo.bindVertexArray(vn.vaos[e])}function Pn(e){qo.bindVertexArray(vn.vaos[e])}function Cn(e,t,r,n){qo.blendColor(e,t,r,n)}function An(e){qo.blendEquation(e)}function In(e,t){qo.blendFunc(e,t)}function Fn(e,t,r,n,i,a,o,s,c,u){qo.blitFramebuffer(e,t,r,n,i,a,o,s,c,u)}function kn(e,t,r,n){vn.currentContext.version>=2?r&&t?qo.bufferData(e,$,n,r,t):qo.bufferData(e,t,n):qo.bufferData(e,r?$.subarray(r,r+t):t,n)}function On(e,t,r,n){vn.currentContext.version>=2?r&&qo.bufferSubData(e,t,$,n,r):qo.bufferSubData(e,t,$.subarray(n,n+r))}function Dn(e){return qo.checkFramebufferStatus(e)}function Ln(e){qo.clear(e)}function Mn(e,t,r,n){qo.clearColor(e,t,r,n)}function Rn(e){qo.clearStencil(e)}function Un(e,t){return O(t===(0|t)),(e>>>0)+4294967296*t}function Bn(e,t,r,n){return qo.clientWaitSync(vn.syncs[e],t,Un(r,n))}function Wn(e,t,r,n){qo.colorMask(!!e,!!t,!!r,!!n)}function Nn(e){qo.compileShader(vn.shaders[e])}function $n(e,t,r,n,i,a,o,s){vn.currentContext.version>=2?qo.currentPixelUnpackBufferBinding||!o?qo.compressedTexImage2D(e,t,r,n,i,a,o,s):qo.compressedTexImage2D(e,t,r,n,i,a,$,s,o):qo.compressedTexImage2D(e,t,r,n,i,a,s?$.subarray(s,s+o):null)}function jn(e,t,r,n,i,a,o,s,c){vn.currentContext.version>=2?qo.currentPixelUnpackBufferBinding||!s?qo.compressedTexSubImage2D(e,t,r,n,i,a,o,s,c):qo.compressedTexSubImage2D(e,t,r,n,i,a,o,$,c,s):qo.compressedTexSubImage2D(e,t,r,n,i,a,o,c?$.subarray(c,c+s):null)}function Gn(e,t,r,n,i,a,o,s){qo.copyTexSubImage2D(e,t,r,n,i,a,o,s)}function Vn(){var e=vn.getNewId(vn.programs),t=qo.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,vn.programs[e]=t,e}function Hn(e){var t=vn.getNewId(vn.shaders);return vn.shaders[t]=qo.createShader(e),t}function Yn(e){qo.cullFace(e)}function zn(e,t){for(var r=0;r<e;r++){var n=V[t+4*r>>2],i=vn.buffers[n];i&&(qo.deleteBuffer(i),i.name=0,vn.buffers[n]=null,n==qo.currentPixelPackBufferBinding&&(qo.currentPixelPackBufferBinding=0),n==qo.currentPixelUnpackBufferBinding&&(qo.currentPixelUnpackBufferBinding=0))}}function qn(e,t){for(var r=0;r<e;++r){var n=V[t+4*r>>2],i=vn.framebuffers[n];i&&(qo.deleteFramebuffer(i),i.name=0,vn.framebuffers[n]=null)}}function Jn(e){if(e){var t=vn.programs[e];t?(qo.deleteProgram(t),t.name=0,vn.programs[e]=null):vn.recordError(1281)}}function Zn(e,t){for(var r=0;r<e;r++){var n=V[t+4*r>>2],i=vn.renderbuffers[n];i&&(qo.deleteRenderbuffer(i),i.name=0,vn.renderbuffers[n]=null)}}function Kn(e,t){for(var r=0;r<e;r++){var n=V[t+4*r>>2],i=vn.samplers[n];i&&(qo.deleteSampler(i),i.name=0,vn.samplers[n]=null)}}function Xn(e){if(e){var t=vn.shaders[e];t?(qo.deleteShader(t),vn.shaders[e]=null):vn.recordError(1281)}}function Qn(e){if(e){var t=vn.syncs[e];t?(qo.deleteSync(t),t.name=0,vn.syncs[e]=null):vn.recordError(1281)}}function ei(e,t){for(var r=0;r<e;r++){var n=V[t+4*r>>2],i=vn.textures[n];i&&(qo.deleteTexture(i),i.name=0,vn.textures[n]=null)}}function ti(e,t){for(var r=0;r<e;r++){var n=V[t+4*r>>2];qo.deleteVertexArray(vn.vaos[n]),vn.vaos[n]=null}}function ri(e,t){for(var r=0;r<e;r++){var n=V[t+4*r>>2];qo.deleteVertexArray(vn.vaos[n]),vn.vaos[n]=null}}function ni(e){qo.depthMask(!!e)}function ii(e){qo.disable(e)}function ai(e){qo.disableVertexAttribArray(e)}function oi(e,t,r){qo.drawArrays(e,t,r)}function si(e,t,r,n){qo.drawArraysInstanced(e,t,r,n)}function ci(e,t,r,n,i){qo.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,n,i)}var ui=[];function li(e,t){for(var r=ui[e],n=0;n<e;n++)r[n]=V[t+4*n>>2];qo.drawBuffers(r)}function fi(e,t,r,n){qo.drawElements(e,t,r,n)}function di(e,t,r,n,i){qo.drawElementsInstanced(e,t,r,n,i)}function mi(e,t,r,n,i,a,o){qo.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,n,i,a,o)}function pi(e,t,r,n){qo.drawElements(e,t,r,n)}function gi(e,t,r,n,i,a){pi(e,n,i,a)}function vi(e){qo.enable(e)}function hi(e){qo.enableVertexAttribArray(e)}function _i(e,t){var r=qo.fenceSync(e,t);if(r){var n=vn.getNewId(vn.syncs);return r.name=n,vn.syncs[n]=r,n}return 0}function yi(){qo.finish()}function bi(){qo.flush()}function wi(e,t,r,n){qo.framebufferRenderbuffer(e,t,r,vn.renderbuffers[n])}function Ti(e,t,r,n,i){qo.framebufferTexture2D(e,t,r,vn.textures[n],i)}function Ei(e){qo.frontFace(e)}function xi(e,t,r,n){for(var i=0;i<e;i++){var a=qo[r](),o=a&&vn.getNewId(n);a?(a.name=o,n[o]=a):vn.recordError(1282),V[t+4*i>>2]=o}}function Si(e,t){xi(e,t,"createBuffer",vn.buffers)}function Pi(e,t){xi(e,t,"createFramebuffer",vn.framebuffers)}function Ci(e,t){xi(e,t,"createRenderbuffer",vn.renderbuffers)}function Ai(e,t){xi(e,t,"createSampler",vn.samplers)}function Ii(e,t){xi(e,t,"createTexture",vn.textures)}function Fi(e,t){xi(e,t,"createVertexArray",vn.vaos)}function ki(e,t){xi(e,t,"createVertexArray",vn.vaos)}function Oi(e){qo.generateMipmap(e)}function Di(e,t,r){r?V[r>>2]=qo.getBufferParameter(e,t):vn.recordError(1281)}function Li(){var e=qo.getError()||vn.lastError;return vn.lastError=0,e}function Mi(e){return H[e>>2]+4294967296*V[e+4>>2]}function Ri(e){return H[e>>2]+4294967296*H[e+4>>2]}function Ui(e,t){H[e>>2]=t,H[e+4>>2]=(t-H[e>>2])/4294967296;var r=t>=0?Ri(e):Mi(e);r!=t&&y("writeI53ToI64() out of range: serialized JS Number "+t+" to Wasm heap as bytes lo=0x"+H[e>>2].toString(16)+", hi=0x"+H[e+4>>2].toString(16)+", which deserializes back to "+r+" instead!")}function Bi(e,t,r){if(t){var n=void 0;switch(e){case 36346:n=1;break;case 36344:return void(0!=r&&1!=r&&vn.recordError(1280));case 34814:case 36345:n=0;break;case 34466:var i=qo.getParameter(34467);n=i?i.length:0;break;case 33309:if(vn.currentContext.version<2)return void vn.recordError(1282);n=2*(qo.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(vn.currentContext.version<2)return void vn.recordError(1280);n=33307==e?3:0}if(void 0===n){var a=qo.getParameter(e);switch(typeof a){case"number":n=a;break;case"boolean":n=a?1:0;break;case"string":return void vn.recordError(1280);case"object":if(null===a)switch(e){case 34964:case 35725:case 34965:case 36006:case 36007:case 32873:case 34229:case 36662:case 36663:case 35053:case 35055:case 36010:case 35097:case 35869:case 32874:case 36389:case 35983:case 35368:case 34068:n=0;break;default:return void vn.recordError(1280)}else{if(a instanceof Float32Array||a instanceof Uint32Array||a instanceof Int32Array||a instanceof Array){for(var o=0;o<a.length;++o)switch(r){case 0:V[t+4*o>>2]=a[o];break;case 2:Y[t+4*o>>2]=a[o];break;case 4:N[t+o>>0]=a[o]?1:0}return}try{n=0|a.name}catch(t){return vn.recordError(1280),void _("GL_INVALID_ENUM in glGet"+r+"v: Unknown object returned from WebGL getParameter("+e+")! (error: "+t+")")}}break;default:return vn.recordError(1280),void _("GL_INVALID_ENUM in glGet"+r+"v: Native code calling glGet"+r+"v("+e+") and it returns "+a+" of type "+typeof a+"!")}}switch(r){case 1:Ui(t,n);break;case 0:V[t>>2]=n;break;case 2:Y[t>>2]=n;break;case 4:N[t>>0]=n?1:0}}else vn.recordError(1281)}function Wi(e,t){Bi(e,t,2)}function Ni(e,t,r,n){var i=qo.getFramebufferAttachmentParameter(e,t,r);(i instanceof WebGLRenderbuffer||i instanceof WebGLTexture)&&(i=0|i.name),V[n>>2]=i}function $i(e,t){Bi(e,t,0)}function ji(e,t,r,n){var i=qo.getProgramInfoLog(vn.programs[e]);null===i&&(i="(unknown error)");var a=t>0&&n?U(i,n,t):0;r&&(V[r>>2]=a)}function Gi(e,t,r){if(r)if(e>=vn.counter)vn.recordError(1281);else if(e=vn.programs[e],35716==t){var n=qo.getProgramInfoLog(e);null===n&&(n="(unknown error)"),V[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var i=0;i<qo.getProgramParameter(e,35718);++i)e.maxUniformLength=Math.max(e.maxUniformLength,qo.getActiveUniform(e,i).name.length+1);V[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength)for(i=0;i<qo.getProgramParameter(e,35721);++i)e.maxAttributeLength=Math.max(e.maxAttributeLength,qo.getActiveAttrib(e,i).name.length+1);V[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength)for(i=0;i<qo.getProgramParameter(e,35382);++i)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,qo.getActiveUniformBlockName(e,i).length+1);V[r>>2]=e.maxUniformBlockNameLength}else V[r>>2]=qo.getProgramParameter(e,t);else vn.recordError(1281)}function Vi(e,t,r){r?V[r>>2]=qo.getRenderbufferParameter(e,t):vn.recordError(1281)}function Hi(e,t,r,n){var i=qo.getShaderInfoLog(vn.shaders[e]);null===i&&(i="(unknown error)");var a=t>0&&n?U(i,n,t):0;r&&(V[r>>2]=a)}function Yi(e,t,r,n){var i=qo.getShaderPrecisionFormat(e,t);V[r>>2]=i.rangeMin,V[r+4>>2]=i.rangeMax,V[n>>2]=i.precision}function zi(e,t,r){if(r)if(35716==t){var n=qo.getShaderInfoLog(vn.shaders[e]);null===n&&(n="(unknown error)");var i=n?n.length+1:0;V[r>>2]=i}else if(35720==t){var a=qo.getShaderSource(vn.shaders[e]),o=a?a.length+1:0;V[r>>2]=o}else V[r>>2]=qo.getShaderParameter(vn.shaders[e],t);else vn.recordError(1281)}function qi(e){var t=B(e)+1,r=ss(t);return U(e,r,t),r}function Ji(e){var t=vn.stringCache[e];if(!t){switch(e){case 7939:var r=qo.getSupportedExtensions()||[];t=qi((r=r.concat(r.map((function(e){return"GL_"+e})))).join(" "));break;case 7936:case 7937:case 37445:case 37446:var n=qo.getParameter(e);n||vn.recordError(1280),t=n&&qi(n);break;case 7938:var i=qo.getParameter(7938);t=qi(i=vn.currentContext.version>=2?"OpenGL ES 3.0 ("+i+")":"OpenGL ES 2.0 ("+i+")");break;case 35724:var a=qo.getParameter(35724),o=a.match(/^WebGL GLSL ES ([0-9]\.[0-9][0-9]?)(?:$| .*)/);null!==o&&(3==o[1].length&&(o[1]=o[1]+"0"),a="OpenGL ES GLSL ES "+o[1]+" ("+a+")"),t=qi(a);break;default:vn.recordError(1280)}vn.stringCache[e]=t}return t}function Zi(e,t){if(vn.currentContext.version<2)return vn.recordError(1282),0;var r=vn.stringiCache[e];if(r)return t<0||t>=r.length?(vn.recordError(1281),0):r[t];if(7939===e){var n=qo.getSupportedExtensions()||[];return n=(n=n.concat(n.map((function(e){return"GL_"+e})))).map((function(e){return qi(e)})),r=vn.stringiCache[e]=n,t<0||t>=r.length?(vn.recordError(1281),0):r[t]}return vn.recordError(1280),0}function Ki(e){return parseInt(e)}function Xi(e){return"]"==e.slice(-1)&&e.lastIndexOf("[")}function Qi(e){var t,r,n=e.uniformLocsById,i=e.uniformSizeAndIdsByName;if(!n)for(e.uniformLocsById=n={},e.uniformArrayNamesById={},t=0;t<qo.getProgramParameter(e,35718);++t){var a=qo.getActiveUniform(e,t),o=a.name,s=a.size,c=Xi(o),u=c>0?o.slice(0,c):o,l=e.uniformIdCounter;for(e.uniformIdCounter+=s,i[u]=[s,l],r=0;r<s;++r)n[l]=r,e.uniformArrayNamesById[l++]=u}}function ea(e,t){if(t=M(t),e=vn.programs[e]){Qi(e);var r=e.uniformLocsById,n=0,i=t,a=Xi(t);a>0&&(n=Ki(t.slice(a+1))>>>0,i=t.slice(0,a));var o=e.uniformSizeAndIdsByName[i];if(o&&n<o[0]&&(r[n+=o[1]]=r[n]||qo.getUniformLocation(e,t)))return n}else vn.recordError(1281);return-1}function ta(e,t,r){for(var n=ui[t],i=0;i<t;i++)n[i]=V[r+4*i>>2];qo.invalidateFramebuffer(e,n)}function ra(e,t,r,n,i,a,o){for(var s=ui[t],c=0;c<t;c++)s[c]=V[r+4*c>>2];qo.invalidateSubFramebuffer(e,s,n,i,a,o)}function na(e){return qo.isSync(vn.syncs[e])}function ia(e){var t=vn.textures[e];return t?qo.isTexture(t):0}function aa(e){qo.lineWidth(e)}function oa(e){e=vn.programs[e],qo.linkProgram(e),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}}function sa(e,t,r,n,i,a){qo.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,V,t>>2,V,r>>2,V,n>>2,H,i>>2,a)}function ca(e,t,r,n,i,a,o,s){qo.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,V,t>>2,r,V,n>>2,V,i>>2,V,a>>2,H,o>>2,s)}function ua(e,t){3317==e&&(vn.unpackAlignment=t),qo.pixelStorei(e,t)}function la(e){qo.readBuffer(e)}function fa(e,t,r,n){var i;return t*(e*r+(i=n)-1&-i)}function da(e){return{5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1}function ma(e){return 0==(e-=5120)?N:1==e?$:2==e?j:4==e?V:6==e?Y:5==e||28922==e||28520==e||30779==e||30782==e?H:G}function pa(e){return 31-Math.clz32(e.BYTES_PER_ELEMENT)}function ga(e,t,r,n,i,a){var o=ma(e),s=pa(o),c=1<<s,u=fa(r,n,da(t)*c,vn.unpackAlignment);return o.subarray(i>>s,i+u>>s)}function va(e,t,r,n,i,a,o){if(vn.currentContext.version>=2)if(qo.currentPixelPackBufferBinding)qo.readPixels(e,t,r,n,i,a,o);else{var s=ma(a);qo.readPixels(e,t,r,n,i,a,s,o>>pa(s))}else{var c=ga(a,i,r,n,o);c?qo.readPixels(e,t,r,n,i,a,c):vn.recordError(1280)}}function ha(e,t,r,n){qo.renderbufferStorage(e,t,r,n)}function _a(e,t,r,n,i){qo.renderbufferStorageMultisample(e,t,r,n,i)}function ya(e,t,r){qo.samplerParameterf(vn.samplers[e],t,r)}function ba(e,t,r){qo.samplerParameteri(vn.samplers[e],t,r)}function wa(e,t,r){var n=V[r>>2];qo.samplerParameteri(vn.samplers[e],t,n)}function Ta(e,t,r,n){qo.scissor(e,t,r,n)}function Ea(e,t,r,n){var i=vn.getSource(e,t,r,n);qo.shaderSource(vn.shaders[e],i)}function xa(e,t,r){qo.stencilFunc(e,t,r)}function Sa(e,t,r,n){qo.stencilFuncSeparate(e,t,r,n)}function Pa(e){qo.stencilMask(e)}function Ca(e,t){qo.stencilMaskSeparate(e,t)}function Aa(e,t,r){qo.stencilOp(e,t,r)}function Ia(e,t,r,n){qo.stencilOpSeparate(e,t,r,n)}function Fa(e,t,r,n,i,a,o,s,c){if(vn.currentContext.version>=2)if(qo.currentPixelUnpackBufferBinding)qo.texImage2D(e,t,r,n,i,a,o,s,c);else if(c){var u=ma(s);qo.texImage2D(e,t,r,n,i,a,o,s,u,c>>pa(u))}else qo.texImage2D(e,t,r,n,i,a,o,s,null);else qo.texImage2D(e,t,r,n,i,a,o,s,c?ga(s,o,n,i,c):null)}function ka(e,t,r){qo.texParameterf(e,t,r)}function Oa(e,t,r){var n=Y[r>>2];qo.texParameterf(e,t,n)}function Da(e,t,r){qo.texParameteri(e,t,r)}function La(e,t,r){var n=V[r>>2];qo.texParameteri(e,t,n)}function Ma(e,t,r,n,i){qo.texStorage2D(e,t,r,n,i)}function Ra(e,t,r,n,i,a,o,s,c){if(vn.currentContext.version>=2)if(qo.currentPixelUnpackBufferBinding)qo.texSubImage2D(e,t,r,n,i,a,o,s,c);else if(c){var u=ma(s);qo.texSubImage2D(e,t,r,n,i,a,o,s,u,c>>pa(u))}else qo.texSubImage2D(e,t,r,n,i,a,o,s,null);else{var l=null;c&&(l=ga(s,o,i,a,c)),qo.texSubImage2D(e,t,r,n,i,a,o,s,l)}}function Ua(e){var t=qo.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=qo.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?"["+r+"]":""))),r}vn.recordError(1282)}function Ba(e,t){qo.uniform1f(Ua(e),t)}var Wa=[];function Na(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform1fv(Ua(e),Y,r>>2,t);else{if(t<=288)for(var n=Wa[t-1],i=0;i<t;++i)n[i]=Y[r+4*i>>2];else n=Y.subarray(r>>2,r+4*t>>2);qo.uniform1fv(Ua(e),n)}}function $a(e,t){qo.uniform1i(Ua(e),t)}var ja=[];function Ga(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform1iv(Ua(e),V,r>>2,t);else{if(t<=288)for(var n=ja[t-1],i=0;i<t;++i)n[i]=V[r+4*i>>2];else n=V.subarray(r>>2,r+4*t>>2);qo.uniform1iv(Ua(e),n)}}function Va(e,t,r){qo.uniform2f(Ua(e),t,r)}function Ha(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform2fv(Ua(e),Y,r>>2,2*t);else{if(t<=144)for(var n=Wa[2*t-1],i=0;i<2*t;i+=2)n[i]=Y[r+4*i>>2],n[i+1]=Y[r+(4*i+4)>>2];else n=Y.subarray(r>>2,r+8*t>>2);qo.uniform2fv(Ua(e),n)}}function Ya(e,t,r){qo.uniform2i(Ua(e),t,r)}function za(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform2iv(Ua(e),V,r>>2,2*t);else{if(t<=144)for(var n=ja[2*t-1],i=0;i<2*t;i+=2)n[i]=V[r+4*i>>2],n[i+1]=V[r+(4*i+4)>>2];else n=V.subarray(r>>2,r+8*t>>2);qo.uniform2iv(Ua(e),n)}}function qa(e,t,r,n){qo.uniform3f(Ua(e),t,r,n)}function Ja(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform3fv(Ua(e),Y,r>>2,3*t);else{if(t<=96)for(var n=Wa[3*t-1],i=0;i<3*t;i+=3)n[i]=Y[r+4*i>>2],n[i+1]=Y[r+(4*i+4)>>2],n[i+2]=Y[r+(4*i+8)>>2];else n=Y.subarray(r>>2,r+12*t>>2);qo.uniform3fv(Ua(e),n)}}function Za(e,t,r,n){qo.uniform3i(Ua(e),t,r,n)}function Ka(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform3iv(Ua(e),V,r>>2,3*t);else{if(t<=96)for(var n=ja[3*t-1],i=0;i<3*t;i+=3)n[i]=V[r+4*i>>2],n[i+1]=V[r+(4*i+4)>>2],n[i+2]=V[r+(4*i+8)>>2];else n=V.subarray(r>>2,r+12*t>>2);qo.uniform3iv(Ua(e),n)}}function Xa(e,t,r,n,i){qo.uniform4f(Ua(e),t,r,n,i)}function Qa(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform4fv(Ua(e),Y,r>>2,4*t);else{if(t<=72){var n=Wa[4*t-1],i=Y;r>>=2;for(var a=0;a<4*t;a+=4){var o=r+a;n[a]=i[o],n[a+1]=i[o+1],n[a+2]=i[o+2],n[a+3]=i[o+3]}}else n=Y.subarray(r>>2,r+16*t>>2);qo.uniform4fv(Ua(e),n)}}function eo(e,t,r,n,i){qo.uniform4i(Ua(e),t,r,n,i)}function to(e,t,r){if(vn.currentContext.version>=2)t&&qo.uniform4iv(Ua(e),V,r>>2,4*t);else{if(t<=72)for(var n=ja[4*t-1],i=0;i<4*t;i+=4)n[i]=V[r+4*i>>2],n[i+1]=V[r+(4*i+4)>>2],n[i+2]=V[r+(4*i+8)>>2],n[i+3]=V[r+(4*i+12)>>2];else n=V.subarray(r>>2,r+16*t>>2);qo.uniform4iv(Ua(e),n)}}function ro(e,t,r,n){if(vn.currentContext.version>=2)t&&qo.uniformMatrix2fv(Ua(e),!!r,Y,n>>2,4*t);else{if(t<=72)for(var i=Wa[4*t-1],a=0;a<4*t;a+=4)i[a]=Y[n+4*a>>2],i[a+1]=Y[n+(4*a+4)>>2],i[a+2]=Y[n+(4*a+8)>>2],i[a+3]=Y[n+(4*a+12)>>2];else i=Y.subarray(n>>2,n+16*t>>2);qo.uniformMatrix2fv(Ua(e),!!r,i)}}function no(e,t,r,n){if(vn.currentContext.version>=2)t&&qo.uniformMatrix3fv(Ua(e),!!r,Y,n>>2,9*t);else{if(t<=32)for(var i=Wa[9*t-1],a=0;a<9*t;a+=9)i[a]=Y[n+4*a>>2],i[a+1]=Y[n+(4*a+4)>>2],i[a+2]=Y[n+(4*a+8)>>2],i[a+3]=Y[n+(4*a+12)>>2],i[a+4]=Y[n+(4*a+16)>>2],i[a+5]=Y[n+(4*a+20)>>2],i[a+6]=Y[n+(4*a+24)>>2],i[a+7]=Y[n+(4*a+28)>>2],i[a+8]=Y[n+(4*a+32)>>2];else i=Y.subarray(n>>2,n+36*t>>2);qo.uniformMatrix3fv(Ua(e),!!r,i)}}function io(e,t,r,n){if(vn.currentContext.version>=2)t&&qo.uniformMatrix4fv(Ua(e),!!r,Y,n>>2,16*t);else{if(t<=18){var i=Wa[16*t-1],a=Y;n>>=2;for(var o=0;o<16*t;o+=16){var s=n+o;i[o]=a[s],i[o+1]=a[s+1],i[o+2]=a[s+2],i[o+3]=a[s+3],i[o+4]=a[s+4],i[o+5]=a[s+5],i[o+6]=a[s+6],i[o+7]=a[s+7],i[o+8]=a[s+8],i[o+9]=a[s+9],i[o+10]=a[s+10],i[o+11]=a[s+11],i[o+12]=a[s+12],i[o+13]=a[s+13],i[o+14]=a[s+14],i[o+15]=a[s+15]}}else i=Y.subarray(n>>2,n+64*t>>2);qo.uniformMatrix4fv(Ua(e),!!r,i)}}function ao(e){e=vn.programs[e],qo.useProgram(e),qo.currentProgram=e}function oo(e,t){qo.vertexAttrib1f(e,t)}function so(e,t){qo.vertexAttrib2f(e,Y[t>>2],Y[t+4>>2])}function co(e,t){qo.vertexAttrib3f(e,Y[t>>2],Y[t+4>>2],Y[t+8>>2])}function uo(e,t){qo.vertexAttrib4f(e,Y[t>>2],Y[t+4>>2],Y[t+8>>2],Y[t+12>>2])}function lo(e,t){qo.vertexAttribDivisor(e,t)}function fo(e,t,r,n,i){qo.vertexAttribIPointer(e,t,r,n,i)}function mo(e,t,r,n,i,a){qo.vertexAttribPointer(e,t,r,!!n,i,a)}function po(e,t,r,n){qo.viewport(e,t,r,n)}function go(e,t,r,n){qo.waitSync(vn.syncs[e],t,Un(r,n))}function vo(){return!l}function ho(e,t,r){$.copyWithin(e,t,t+r)}function _o(e,t){return requestAnimationFrame((function(r){We(e)(r,t)}))}function yo(e){try{return P.grow(e-W.byteLength+65535>>>16),ae(P.buffer),1}catch(t){_("emscripten_realloc_buffer: Attempted to grow heap from "+W.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}function bo(e){var t=$.length;O((e>>>=0)>t);var r,n=2147483648;if(e>n)return _("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is 2147483648 bytes!"),!1;for(var i=1;i<=4;i*=2){var a=t*(1+.2/i);a=Math.min(a,e+100663296);var o=Math.min(n,(r=Math.max(e,a))+(65536-r%65536)%65536);if(yo(o))return!0}return _("Failed to grow the heap from "+t+" bytes to "+o+" bytes, not enough memory!"),!1}var wo={xhrs:[],setu64:function(e,t){H[e>>2]=t,H[e+4>>2]=t/4294967296|0},openDatabase:function(e,t,r,n){try{var i=indexedDB.open(e,t)}catch(e){return n(e)}i.onupgradeneeded=e=>{var t=e.target.result;t.objectStoreNames.contains("FILES")&&t.deleteObjectStore("FILES"),t.createObjectStore("FILES")},i.onsuccess=e=>r(e.target.result),i.onerror=e=>n(e)},staticInit:function(){wo.openDatabase("emscripten_filesystem",1,(e=>{wo.dbInstance=e,Pe("library_fetch_init")}),(()=>{wo.dbInstance=!1,Pe("library_fetch_init")})),"undefined"!=typeof ENVIRONMENT_IS_FETCH_WORKER&&ENVIRONMENT_IS_FETCH_WORKER||Se("library_fetch_init")}};function To(e,t,r,n,i){var a=H[e+8>>2];if(a){var o=M(a),s=e+112,c=M(s);c||(c="GET"),H[e+4>>2];var u=H[s+52>>2],l=H[s+56>>2],f=!!H[s+60>>2],d=(H[s+64>>2],H[s+68>>2]),m=H[s+72>>2],p=H[s+76>>2],g=H[s+80>>2],v=H[s+84>>2],h=H[s+88>>2],_=!!(1&u),y=!!(2&u),b=!!(64&u),w=d?M(d):void 0,T=m?M(m):void 0,E=new XMLHttpRequest;if(E.withCredentials=f,E.open(c,o,!b,w,T),b||(E.timeout=l),E.url_=o,O(!y,"streaming uses moz-chunked-arraybuffer which is no longer supported; TODO: rewrite using fetch()"),E.responseType="arraybuffer",g){var x=M(g);E.overrideMimeType(x)}if(p)for(;;){var S=H[p>>2];if(!S)break;var P=H[p+4>>2];if(!P)break;p+=8;var C=M(S),A=M(P);E.setRequestHeader(C,A)}wo.xhrs.push(E);var I=wo.xhrs.length;H[e+0>>2]=I;var F=v&&h?$.slice(v,v+h):null;E.onload=n=>{k(_&&!y);var i=E.response?E.response.byteLength:0;wo.setu64(e+24,0),i&&wo.setu64(e+32,i),G[e+40>>1]=E.readyState,G[e+42>>1]=E.status,E.statusText&&U(E.statusText,e+44,64),E.status>=200&&E.status<300?t&&t(e,E,n):r&&r(e,E,n)},E.onerror=t=>{k(_);var n=E.status;wo.setu64(e+24,0),wo.setu64(e+32,E.response?E.response.byteLength:0),G[e+40>>1]=E.readyState,G[e+42>>1]=n,r&&r(e,E,t)},E.ontimeout=t=>{r&&r(e,E,t)},E.onprogress=t=>{var r=_&&y&&E.response?E.response.byteLength:0,i=0;_&&y&&(O(n,"When doing a streaming fetch, you should have an onprogress handler registered to receive the chunks!"),i=ss(r),$.set(new Uint8Array(E.response),i)),H[e+12>>2]=i,wo.setu64(e+16,r),wo.setu64(e+24,t.loaded-r),wo.setu64(e+32,t.total),G[e+40>>1]=E.readyState,E.readyState>=3&&0===E.status&&t.loaded>0&&(E.status=200),G[e+42>>1]=E.status,E.statusText&&U(E.statusText,e+44,64),n&&n(e,E,t),i&&cs(i)},E.onreadystatechange=t=>{G[e+40>>1]=E.readyState,E.readyState>=2&&(G[e+42>>1]=E.status),i&&i(e,E,t)};try{E.send(F)}catch(t){r&&r(e,E,t)}}else r(e,0,"no url specified!");function k(t){var r=0,n=0;t&&(n=E.response?E.response.byteLength:0,r=ss(n),$.set(new Uint8Array(E.response),r)),H[e+12>>2]=r,wo.setu64(e+16,n)}}function Eo(e,t){if(k)_("user callback triggered after runtime exited or application aborted. Ignoring.");else if(t)e();else try{e()}catch(e){Ne(e)}}function xo(e,t,r,n,i){if(e){var a=H[t+112+64>>2];a||(a=H[t+8>>2]);var o=M(a);try{var s=e.transaction(["FILES"],"readwrite").objectStore("FILES").put(r,o);s.onsuccess=e=>{G[t+40>>1]=4,G[t+42>>1]=200,U("OK",t+44,64),n(t,0,o)},s.onerror=e=>{G[t+40>>1]=4,G[t+42>>1]=413,U("Payload Too Large",t+44,64),i(t,0,e)}}catch(e){i(t,0,e)}}else i(t,0,"IndexedDB not available!")}function So(e,t,r,n){if(e){var i=H[t+112+64>>2];i||(i=H[t+8>>2]);var a=M(i);try{var o=e.transaction(["FILES"],"readonly").objectStore("FILES").get(a);o.onsuccess=e=>{if(e.target.result){var i=e.target.result,a=i.byteLength||i.length,o=ss(a);$.set(new Uint8Array(i),o),H[t+12>>2]=o,wo.setu64(t+16,a),wo.setu64(t+24,0),wo.setu64(t+32,a),G[t+40>>1]=4,G[t+42>>1]=200,U("OK",t+44,64),r(t,0,i)}else G[t+40>>1]=4,G[t+42>>1]=404,U("Not Found",t+44,64),n(t,0,"no data")},o.onerror=e=>{G[t+40>>1]=4,G[t+42>>1]=404,U("Not Found",t+44,64),n(t,0,e)}}catch(e){n(t,0,e)}}else n(t,0,"IndexedDB not available!")}function Po(e,t,r,n){if(e){var i=H[t+112+64>>2];i||(i=H[t+8>>2]);var a=M(i);try{var o=e.transaction(["FILES"],"readwrite").objectStore("FILES").delete(a);o.onsuccess=e=>{var n=e.target.result;H[t+12>>2]=0,wo.setu64(t+16,0),wo.setu64(t+24,0),wo.setu64(t+32,0),G[t+40>>1]=4,G[t+42>>1]=200,U("OK",t+44,64),r(t,0,n)},o.onerror=e=>{G[t+40>>1]=4,G[t+42>>1]=404,U("Not Found",t+44,64),n(t,0,e)}}catch(e){n(t,0,e)}}else n(t,0,"IndexedDB not available!")}function Co(e,t,r,n,i){var a=e+112,o=M(a),s=H[a+36>>2],c=H[a+40>>2],u=H[a+44>>2],l=H[a+48>>2],f=H[a+52>>2],d=!!(4&f),m=!!(32&f),p=!!(16&f),g=!!(64&f),v=(e,r,n)=>{Eo((()=>{s?We(s)(e):t&&t(e)}),g)},h=(e,t,r)=>{Eo((()=>{u?We(u)(e):n&&n(e)}),g)},_=(e,t,n)=>{Eo((()=>{c?We(c)(e):r&&r(e)}),g)},y=(e,t,r)=>{Eo((()=>{l?We(l)(e):i&&i(e)}),g)},b=(e,r,n)=>{xo(wo.dbInstance,e,r.response,((e,r,n)=>{Eo((()=>{s?We(s)(e):t&&t(e)}),g)}),((e,r,n)=>{Eo((()=>{s?We(s)(e):t&&t(e)}),g)}))};if("EM_IDB_STORE"===o){var w=H[a+84>>2];xo(wo.dbInstance,e,$.slice(w,w+H[a+88>>2]),v,_)}else if("EM_IDB_DELETE"===o)Po(wo.dbInstance,e,v,_);else if(p){if(m)return 0;To(e,d?b:v,_,h,y)}else So(wo.dbInstance,e,v,m?_:d?(e,t,r)=>{To(e,b,_,h,y)}:(e,t,r)=>{To(e,v,_,h,y)});return e}function Ao(e){return vn.makeContextCurrent(e)?0:-5}var Io={};function Fo(){return s||"./this.program"}function ko(){if(!ko.strings){var e={USER:"web_user",LOGNAME:"web_user",PATH:"/",PWD:"/",HOME:"/home/web_user",LANG:("object"==typeof navigator&&navigator.languages&&navigator.languages[0]||"C").replace("-","_")+".UTF-8",_:Fo()};for(var t in Io)void 0===Io[t]?delete e[t]:e[t]=Io[t];var r=[];for(var t in e)r.push(t+"="+e[t]);ko.strings=r}return ko.strings}function Oo(e,t){var r=0;return ko().forEach((function(n,i){var a=t+r;V[e+4*i>>2]=a,ie(n,a),r+=n.length+1})),0}function Do(e,t){var r=ko();V[e>>2]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),V[t>>2]=n,0}function Lo(e){Ce("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")}function Mo(e,t,r,n){return 70}var Ro=[null,[],[]];function Uo(e,t){var r=Ro[e];O(r),0===t||10===t?((1===e?h:_)(L(r,0)),r.length=0):r.push(t)}function Bo(e,t,r,n){for(var i=0,a=0;a<r;a++){var o=H[t>>2],s=H[t+4>>2];t+=8;for(var c=0;c<s;c++)Uo(e,$[o+c]);i+=s}return V[n>>2]=i,0}function Wo(){return I()}function No(e,t){qo.bindFramebuffer(e,vn.framebuffers[t])}function $o(e){qo.clear(e)}function jo(e,t,r,n){qo.clearColor(e,t,r,n)}function Go(e){qo.clearStencil(e)}function Vo(e,t){Bi(e,t,0)}function Ho(e){A(e)}function Yo(e){return e%4==0&&(e%100!=0||e%400==0)}function zo(e,t){for(var r=0,n=0;n<=t;r+=e[n++]);return r}var qo,Jo=[31,29,31,30,31,30,31,31,30,31,30,31],Zo=[31,28,31,30,31,30,31,31,30,31,30,31];function Ko(e,t){for(var r=new Date(e.getTime());t>0;){var n=Yo(r.getFullYear()),i=r.getMonth(),a=(n?Jo:Zo)[i];if(!(t>a-r.getDate()))return r.setDate(r.getDate()+t),r;t-=a-r.getDate()+1,r.setDate(1),i<11?r.setMonth(i+1):(r.setMonth(0),r.setFullYear(r.getFullYear()+1))}return r}function Xo(e,t,r,n){var i=V[n+40>>2],a={tm_sec:V[n>>2],tm_min:V[n+4>>2],tm_hour:V[n+8>>2],tm_mday:V[n+12>>2],tm_mon:V[n+16>>2],tm_year:V[n+20>>2],tm_wday:V[n+24>>2],tm_yday:V[n+28>>2],tm_isdst:V[n+32>>2],tm_gmtoff:V[n+36>>2],tm_zone:i?M(i):""},o=M(r),s={"%c":"%a %b %d %H:%M:%S %Y","%D":"%m/%d/%y","%F":"%Y-%m-%d","%h":"%b","%r":"%I:%M:%S %p","%R":"%H:%M","%T":"%H:%M:%S","%x":"%m/%d/%y","%X":"%H:%M:%S","%Ec":"%c","%EC":"%C","%Ex":"%m/%d/%y","%EX":"%H:%M:%S","%Ey":"%y","%EY":"%Y","%Od":"%d","%Oe":"%e","%OH":"%H","%OI":"%I","%Om":"%m","%OM":"%M","%OS":"%S","%Ou":"%u","%OU":"%U","%OV":"%V","%Ow":"%w","%OW":"%W","%Oy":"%y"};for(var c in s)o=o.replace(new RegExp(c,"g"),s[c]);var u=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l=["January","February","March","April","May","June","July","August","September","October","November","December"];function f(e,t,r){for(var n="number"==typeof e?e.toString():e||"";n.length<t;)n=r[0]+n;return n}function d(e,t){return f(e,t,"0")}function m(e,t){function r(e){return e<0?-1:e>0?1:0}var n;return 0===(n=r(e.getFullYear()-t.getFullYear()))&&0===(n=r(e.getMonth()-t.getMonth()))&&(n=r(e.getDate()-t.getDate())),n}function p(e){switch(e.getDay()){case 0:return new Date(e.getFullYear()-1,11,29);case 1:return e;case 2:return new Date(e.getFullYear(),0,3);case 3:return new Date(e.getFullYear(),0,2);case 4:return new Date(e.getFullYear(),0,1);case 5:return new Date(e.getFullYear()-1,11,31);case 6:return new Date(e.getFullYear()-1,11,30)}}function g(e){var t=Ko(new Date(e.tm_year+1900,0,1),e.tm_yday),r=new Date(t.getFullYear(),0,4),n=new Date(t.getFullYear()+1,0,4),i=p(r),a=p(n);return m(i,t)<=0?m(a,t)<=0?t.getFullYear()+1:t.getFullYear():t.getFullYear()-1}var v={"%a":function(e){return u[e.tm_wday].substring(0,3)},"%A":function(e){return u[e.tm_wday]},"%b":function(e){return l[e.tm_mon].substring(0,3)},"%B":function(e){return l[e.tm_mon]},"%C":function(e){return d((e.tm_year+1900)/100|0,2)},"%d":function(e){return d(e.tm_mday,2)},"%e":function(e){return f(e.tm_mday,2," ")},"%g":function(e){return g(e).toString().substring(2)},"%G":function(e){return g(e)},"%H":function(e){return d(e.tm_hour,2)},"%I":function(e){var t=e.tm_hour;return 0==t?t=12:t>12&&(t-=12),d(t,2)},"%j":function(e){return d(e.tm_mday+zo(Yo(e.tm_year+1900)?Jo:Zo,e.tm_mon-1),3)},"%m":function(e){return d(e.tm_mon+1,2)},"%M":function(e){return d(e.tm_min,2)},"%n":function(){return"\n"},"%p":function(e){return e.tm_hour>=0&&e.tm_hour<12?"AM":"PM"},"%S":function(e){return d(e.tm_sec,2)},"%t":function(){return"\t"},"%u":function(e){return e.tm_wday||7},"%U":function(e){var t=e.tm_yday+7-e.tm_wday;return d(Math.floor(t/7),2)},"%V":function(e){var t=Math.floor((e.tm_yday+7-(e.tm_wday+6)%7)/7);if((e.tm_wday+371-e.tm_yday-2)%7<=2&&t++,t){if(53==t){var r=(e.tm_wday+371-e.tm_yday)%7;4==r||3==r&&Yo(e.tm_year)||(t=1)}}else{t=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&Yo(e.tm_year%400-1))&&t++}return d(t,2)},"%w":function(e){return e.tm_wday},"%W":function(e){var t=e.tm_yday+7-(e.tm_wday+6)%7;return d(Math.floor(t/7),2)},"%y":function(e){return(e.tm_year+1900).toString().substring(2)},"%Y":function(e){return e.tm_year+1900},"%z":function(e){var t=e.tm_gmtoff,r=t>=0;return t=(t=Math.abs(t)/60)/60*100+t%60,(r?"+":"-")+String("0000"+t).slice(-4)},"%Z":function(e){return e.tm_zone},"%%":function(){return"%"}};for(var c in o=o.replace(/%%/g,"\0\0"),v)o.includes(c)&&(o=o.replace(new RegExp(c,"g"),v[c](a)));var h=ns(o=o.replace(/\0\0/g,"%"),!1);return h.length>t?0:(ne(h,e),h.length-1)}function Qo(e,t,r,n){return Xo(e,t,r,n)}Qe=i.InternalError=Xe(Error,"InternalError"),it(),st=i.BindingError=Xe(Error,"BindingError"),Nt(),It(),Xt(),rr=i.UnboundTypeError=Xe(Error,"UnboundTypeError"),hr();for(var es=0;es<32;++es)ui.push(new Array(es));var ts=new Float32Array(288);for(es=0;es<288;++es)Wa[es]=ts.subarray(0,es+1);var rs=new Int32Array(288);for(es=0;es<288;++es)ja[es]=rs.subarray(0,es+1);function ns(e,t,r){var n=r>0?r:B(e)+1,i=new Array(n),a=R(e,i,0,i.length);return t&&(i.length=a),i}function is(){w("fetchSettings")}wo.staticInit();var as,os={__assert_fail:$e,_embind_finalize_value_object:rt,_embind_register_bigint:ft,_embind_register_bool:mt,_embind_register_class:ar,_embind_register_class_class_function:ur,_embind_register_class_constructor:lr,_embind_register_class_function:fr,_embind_register_emval:yr,_embind_register_enum:wr,_embind_register_enum_value:Er,_embind_register_float:Sr,_embind_register_integer:Pr,_embind_register_memory_view:Cr,_embind_register_smart_ptr:Ar,_embind_register_std_string:Ir,_embind_register_std_wstring:Fr,_embind_register_value_object:kr,_embind_register_value_object_field:Or,_embind_register_void:Dr,_emscripten_date_now:Lr,_emscripten_fetch_free:Mr,_emscripten_get_now_is_monotonic:Ur,_emscripten_throw_longjmp:Br,_emval_as:Wr,_emval_call:$r,_emval_call_method:Yr,_emval_call_void_method:zr,_emval_decref:pr,_emval_get_global:Jr,_emval_get_method_caller:Qr,_emval_get_module_property:en,_emval_get_property:tn,_emval_incref:rn,_emval_new_array:nn,_emval_new_cstring:an,_emval_run_destructors:on,_emval_take_value:sn,abort:cn,emscripten_cancel_animation_frame:un,emscripten_get_now:Kr,emscripten_glActiveTexture:hn,emscripten_glAttachShader:_n,emscripten_glBindAttribLocation:yn,emscripten_glBindBuffer:bn,emscripten_glBindFramebuffer:wn,emscripten_glBindRenderbuffer:Tn,emscripten_glBindSampler:En,emscripten_glBindTexture:xn,emscripten_glBindVertexArray:Sn,emscripten_glBindVertexArrayOES:Pn,emscripten_glBlendColor:Cn,emscripten_glBlendEquation:An,emscripten_glBlendFunc:In,emscripten_glBlitFramebuffer:Fn,emscripten_glBufferData:kn,emscripten_glBufferSubData:On,emscripten_glCheckFramebufferStatus:Dn,emscripten_glClear:Ln,emscripten_glClearColor:Mn,emscripten_glClearStencil:Rn,emscripten_glClientWaitSync:Bn,emscripten_glColorMask:Wn,emscripten_glCompileShader:Nn,emscripten_glCompressedTexImage2D:$n,emscripten_glCompressedTexSubImage2D:jn,emscripten_glCopyTexSubImage2D:Gn,emscripten_glCreateProgram:Vn,emscripten_glCreateShader:Hn,emscripten_glCullFace:Yn,emscripten_glDeleteBuffers:zn,emscripten_glDeleteFramebuffers:qn,emscripten_glDeleteProgram:Jn,emscripten_glDeleteRenderbuffers:Zn,emscripten_glDeleteSamplers:Kn,emscripten_glDeleteShader:Xn,emscripten_glDeleteSync:Qn,emscripten_glDeleteTextures:ei,emscripten_glDeleteVertexArrays:ti,emscripten_glDeleteVertexArraysOES:ri,emscripten_glDepthMask:ni,emscripten_glDisable:ii,emscripten_glDisableVertexAttribArray:ai,emscripten_glDrawArrays:oi,emscripten_glDrawArraysInstanced:si,emscripten_glDrawArraysInstancedBaseInstanceWEBGL:ci,emscripten_glDrawBuffers:li,emscripten_glDrawElements:fi,emscripten_glDrawElementsInstanced:di,emscripten_glDrawElementsInstancedBaseVertexBaseInstanceWEBGL:mi,emscripten_glDrawRangeElements:gi,emscripten_glEnable:vi,emscripten_glEnableVertexAttribArray:hi,emscripten_glFenceSync:_i,emscripten_glFinish:yi,emscripten_glFlush:bi,emscripten_glFramebufferRenderbuffer:wi,emscripten_glFramebufferTexture2D:Ti,emscripten_glFrontFace:Ei,emscripten_glGenBuffers:Si,emscripten_glGenFramebuffers:Pi,emscripten_glGenRenderbuffers:Ci,emscripten_glGenSamplers:Ai,emscripten_glGenTextures:Ii,emscripten_glGenVertexArrays:Fi,emscripten_glGenVertexArraysOES:ki,emscripten_glGenerateMipmap:Oi,emscripten_glGetBufferParameteriv:Di,emscripten_glGetError:Li,emscripten_glGetFloatv:Wi,emscripten_glGetFramebufferAttachmentParameteriv:Ni,emscripten_glGetIntegerv:$i,emscripten_glGetProgramInfoLog:ji,emscripten_glGetProgramiv:Gi,emscripten_glGetRenderbufferParameteriv:Vi,emscripten_glGetShaderInfoLog:Hi,emscripten_glGetShaderPrecisionFormat:Yi,emscripten_glGetShaderiv:zi,emscripten_glGetString:Ji,emscripten_glGetStringi:Zi,emscripten_glGetUniformLocation:ea,emscripten_glInvalidateFramebuffer:ta,emscripten_glInvalidateSubFramebuffer:ra,emscripten_glIsSync:na,emscripten_glIsTexture:ia,emscripten_glLineWidth:aa,emscripten_glLinkProgram:oa,emscripten_glMultiDrawArraysInstancedBaseInstanceWEBGL:sa,emscripten_glMultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL:ca,emscripten_glPixelStorei:ua,emscripten_glReadBuffer:la,emscripten_glReadPixels:va,emscripten_glRenderbufferStorage:ha,emscripten_glRenderbufferStorageMultisample:_a,emscripten_glSamplerParameterf:ya,emscripten_glSamplerParameteri:ba,emscripten_glSamplerParameteriv:wa,emscripten_glScissor:Ta,emscripten_glShaderSource:Ea,emscripten_glStencilFunc:xa,emscripten_glStencilFuncSeparate:Sa,emscripten_glStencilMask:Pa,emscripten_glStencilMaskSeparate:Ca,emscripten_glStencilOp:Aa,emscripten_glStencilOpSeparate:Ia,emscripten_glTexImage2D:Fa,emscripten_glTexParameterf:ka,emscripten_glTexParameterfv:Oa,emscripten_glTexParameteri:Da,emscripten_glTexParameteriv:La,emscripten_glTexStorage2D:Ma,emscripten_glTexSubImage2D:Ra,emscripten_glUniform1f:Ba,emscripten_glUniform1fv:Na,emscripten_glUniform1i:$a,emscripten_glUniform1iv:Ga,emscripten_glUniform2f:Va,emscripten_glUniform2fv:Ha,emscripten_glUniform2i:Ya,emscripten_glUniform2iv:za,emscripten_glUniform3f:qa,emscripten_glUniform3fv:Ja,emscripten_glUniform3i:Za,emscripten_glUniform3iv:Ka,emscripten_glUniform4f:Xa,emscripten_glUniform4fv:Qa,emscripten_glUniform4i:eo,emscripten_glUniform4iv:to,emscripten_glUniformMatrix2fv:ro,emscripten_glUniformMatrix3fv:no,emscripten_glUniformMatrix4fv:io,emscripten_glUseProgram:ao,emscripten_glVertexAttrib1f:oo,emscripten_glVertexAttrib2fv:so,emscripten_glVertexAttrib3fv:co,emscripten_glVertexAttrib4fv:uo,emscripten_glVertexAttribDivisor:lo,emscripten_glVertexAttribIPointer:fo,emscripten_glVertexAttribPointer:mo,emscripten_glViewport:po,emscripten_glWaitSync:go,emscripten_is_main_browser_thread:vo,emscripten_memcpy_big:ho,emscripten_request_animation_frame:_o,emscripten_resize_heap:bo,emscripten_start_fetch:Co,emscripten_webgl_make_context_current:Ao,environ_get:Oo,environ_sizes_get:Do,fd_close:Lo,fd_seek:Mo,fd_write:Bo,getTempRet0:Wo,glBindFramebuffer:No,glClear:$o,glClearColor:jo,glClearStencil:Go,glGetIntegerv:Vo,invoke_ii:Ts,invoke_iii:bs,invoke_iiii:gs,invoke_iiiii:ws,invoke_v:Ss,invoke_vi:ys,invoke_vii:_s,invoke_viii:Es,invoke_viiii:hs,invoke_viiiii:vs,invoke_viiiiii:Ps,invoke_viiiiiiiii:xs,setTempRet0:Ho,strftime_l:Qo},ss=(Re(),i.___wasm_call_ctors=De("__wasm_call_ctors"),i._malloc=De("malloc")),cs=i._free=De("free"),us=(i.___errno_location=De("__errno_location"),i._saveSetjmp=De("saveSetjmp"),i.___getTypeName=De("__getTypeName")),ls=(i.___embind_register_native_and_builtin_types=De("__embind_register_native_and_builtin_types"),i.___stdio_exit=De("__stdio_exit"),i.___dl_seterr=De("__dl_seterr"),i._setThrew=De("setThrew")),fs=i._emscripten_stack_init=function(){return(fs=i._emscripten_stack_init=i.asm.emscripten_stack_init).apply(null,arguments)},ds=(i._emscripten_stack_get_free=function(){return(i._emscripten_stack_get_free=i.asm.emscripten_stack_get_free).apply(null,arguments)},i._emscripten_stack_get_base=function(){return(i._emscripten_stack_get_base=i.asm.emscripten_stack_get_base).apply(null,arguments)},i._emscripten_stack_get_end=function(){return(ds=i._emscripten_stack_get_end=i.asm.emscripten_stack_get_end).apply(null,arguments)}),ms=i.stackSave=De("stackSave"),ps=i.stackRestore=De("stackRestore");function gs(e,t,r,n){var i=ms();try{return We(e)(t,r,n)}catch(e){if(ps(i),e!==e+0)throw e;ls(1,0)}}function vs(e,t,r,n,i,a){var o=ms();try{We(e)(t,r,n,i,a)}catch(e){if(ps(o),e!==e+0)throw e;ls(1,0)}}function hs(e,t,r,n,i){var a=ms();try{We(e)(t,r,n,i)}catch(e){if(ps(a),e!==e+0)throw e;ls(1,0)}}function _s(e,t,r){var n=ms();try{We(e)(t,r)}catch(e){if(ps(n),e!==e+0)throw e;ls(1,0)}}function ys(e,t){var r=ms();try{We(e)(t)}catch(e){if(ps(r),e!==e+0)throw e;ls(1,0)}}function bs(e,t,r){var n=ms();try{return We(e)(t,r)}catch(e){if(ps(n),e!==e+0)throw e;ls(1,0)}}function ws(e,t,r,n,i){var a=ms();try{return We(e)(t,r,n,i)}catch(e){if(ps(a),e!==e+0)throw e;ls(1,0)}}function Ts(e,t){var r=ms();try{return We(e)(t)}catch(e){if(ps(r),e!==e+0)throw e;ls(1,0)}}function Es(e,t,r,n){var i=ms();try{We(e)(t,r,n)}catch(e){if(ps(i),e!==e+0)throw e;ls(1,0)}}function xs(e,t,r,n,i,a,o,s,c,u){var l=ms();try{We(e)(t,r,n,i,a,o,s,c,u)}catch(e){if(ps(l),e!==e+0)throw e;ls(1,0)}}function Ss(e){var t=ms();try{We(e)()}catch(e){if(ps(t),e!==e+0)throw e;ls(1,0)}}function Ps(e,t,r,n,i,a,o){var s=ms();try{We(e)(t,r,n,i,a,o)}catch(e){if(ps(s),e!==e+0)throw e;ls(1,0)}}function Cs(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function As(){fs(),ue()}function Is(e){function t(){as||(as=!0,i.calledRun=!0,k||(ve(),r(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),O(!i._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),he()))}e=e||o,we>0||(As(),ge(),we>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t(),le()))}if(i.stackAlloc=De("stackAlloc"),x("ccall",!1),x("cwrap",!1),x("setValue",!1),x("getValue",!1),x("allocate",!1),x("UTF8ArrayToString",!1),x("UTF8ToString",!1),x("stringToUTF8Array",!1),x("stringToUTF8",!1),x("lengthBytesUTF8",!1),x("addOnPreRun",!1),x("addOnInit",!1),x("addOnPreMain",!1),x("addOnExit",!1),x("addOnPostRun",!1),x("addRunDependency",!0),x("removeRunDependency",!0),x("FS_createFolder",!1),x("FS_createPath",!0),x("FS_createDataFile",!0),x("FS_createPreloadedFile",!0),x("FS_createLazyFile",!0),x("FS_createLink",!1),x("FS_createDevice",!0),x("FS_unlink",!0),x("getLEB",!1),x("getFunctionTables",!1),x("alignFunctionTables",!1),x("registerFunctions",!1),x("addFunction",!1),x("removeFunction",!1),x("prettyPrint",!1),x("getCompilerSetting",!1),x("print",!1),x("printErr",!1),x("getTempRet0",!1),x("setTempRet0",!1),x("callMain",!1),x("abort",!1),x("keepRuntimeAlive",!1),x("wasmMemory",!1),x("warnOnce",!1),x("stackSave",!1),x("stackRestore",!1),x("stackAlloc",!1),x("AsciiToString",!1),x("stringToAscii",!1),x("UTF16ToString",!1),x("stringToUTF16",!1),x("lengthBytesUTF16",!1),x("UTF32ToString",!1),x("stringToUTF32",!1),x("lengthBytesUTF32",!1),x("allocateUTF8",!1),x("allocateUTF8OnStack",!1),x("ExitStatus",!1),x("intArrayFromString",!1),x("intArrayToString",!1),x("writeStringToMemory",!1),x("writeArrayToMemory",!1),x("writeAsciiToMemory",!1),i.writeStackCookie=ue,i.checkStackCookie=le,x("ptrToString",!1),x("zeroMemory",!1),x("stringToNewUTF8",!1),x("emscripten_realloc_buffer",!1),x("ENV",!1),x("ERRNO_CODES",!1),x("ERRNO_MESSAGES",!1),x("setErrNo",!1),x("inetPton4",!1),x("inetNtop4",!1),x("inetPton6",!1),x("inetNtop6",!1),x("readSockaddr",!1),x("writeSockaddr",!1),x("DNS",!1),x("getHostByName",!1),x("Protocols",!1),x("Sockets",!1),x("getRandomDevice",!1),x("traverseStack",!1),x("UNWIND_CACHE",!1),x("convertPCtoSourceLocation",!1),x("readAsmConstArgsArray",!1),x("readAsmConstArgs",!1),x("mainThreadEM_ASM",!1),x("jstoi_q",!1),x("jstoi_s",!1),x("getExecutableName",!1),x("listenOnce",!1),x("autoResumeAudioContext",!1),x("dynCall",!1),x("handleException",!1),x("runtimeKeepalivePush",!1),x("runtimeKeepalivePop",!1),x("callUserCallback",!1),x("maybeExit",!1),x("safeSetTimeout",!1),x("asmjsMangle",!1),x("asyncLoad",!1),x("alignMemory",!1),x("mmapAlloc",!1),x("reallyNegative",!1),x("unSign",!1),x("reSign",!1),x("formatString",!1),x("PATH",!1),x("PATH_FS",!1),x("SYSCALLS",!1),x("getSocketFromFD",!1),x("getSocketAddress",!1),x("JSEvents",!1),x("registerKeyEventCallback",!1),x("specialHTMLTargets",!1),x("maybeCStringToJsString",!1),x("findEventTarget",!1),x("findCanvasEventTarget",!1),x("getBoundingClientRect",!1),x("fillMouseEventData",!1),x("registerMouseEventCallback",!1),x("registerWheelEventCallback",!1),x("registerUiEventCallback",!1),x("registerFocusEventCallback",!1),x("fillDeviceOrientationEventData",!1),x("registerDeviceOrientationEventCallback",!1),x("fillDeviceMotionEventData",!1),x("registerDeviceMotionEventCallback",!1),x("screenOrientation",!1),x("fillOrientationChangeEventData",!1),x("registerOrientationChangeEventCallback",!1),x("fillFullscreenChangeEventData",!1),x("registerFullscreenChangeEventCallback",!1),x("registerRestoreOldStyle",!1),x("hideEverythingExceptGivenElement",!1),x("restoreHiddenElements",!1),x("setLetterbox",!1),x("currentFullscreenStrategy",!1),x("restoreOldWindowedStyle",!1),x("softFullscreenResizeWebGLRenderTarget",!1),x("doRequestFullscreen",!1),x("fillPointerlockChangeEventData",!1),x("registerPointerlockChangeEventCallback",!1),x("registerPointerlockErrorEventCallback",!1),x("requestPointerLock",!1),x("fillVisibilityChangeEventData",!1),x("registerVisibilityChangeEventCallback",!1),x("registerTouchEventCallback",!1),x("fillGamepadEventData",!1),x("registerGamepadEventCallback",!1),x("registerBeforeUnloadEventCallback",!1),x("fillBatteryEventData",!1),x("battery",!1),x("registerBatteryEventCallback",!1),x("setCanvasElementSize",!1),x("getCanvasElementSize",!1),x("demangle",!1),x("demangleAll",!1),x("jsStackTrace",!1),x("stackTrace",!1),x("getEnvStrings",!1),x("checkWasiClock",!1),x("flush_NO_FILESYSTEM",!1),x("writeI53ToI64",!1),x("writeI53ToI64Clamped",!1),x("writeI53ToI64Signaling",!1),x("writeI53ToU64Clamped",!1),x("writeI53ToU64Signaling",!1),x("readI53FromI64",!1),x("readI53FromU64",!1),x("convertI32PairToI53",!1),x("convertU32PairToI53",!1),x("setImmediateWrapped",!1),x("clearImmediateWrapped",!1),x("polyfillSetImmediate",!1),x("Browser",!1),x("setMainLoop",!1),x("wget",!1),x("tempFixedLengthArray",!1),x("miniTempWebGLFloatBuffers",!1),x("heapObjectForWebGLType",!1),x("heapAccessShiftForWebGLHeap",!1),i.GL=vn,x("emscriptenWebGLGet",!1),x("computeUnpackAlignedImageSize",!1),x("emscriptenWebGLGetTexPixelData",!1),x("emscriptenWebGLGetUniform",!1),x("webglGetUniformLocation",!1),x("webglPrepareUniformLocationsBeforeFirstUse",!1),x("webglGetLeftBracePos",!1),x("emscriptenWebGLGetVertexAttrib",!1),x("emscriptenWebGLGetIndexed",!1),x("Fetch",!1),x("fetchDeleteCachedData",!1),x("fetchLoadCachedData",!1),x("fetchCacheData",!1),x("fetchXHR",!1),x("InternalError",!1),x("BindingError",!1),x("UnboundTypeError",!1),x("PureVirtualError",!1),x("init_embind",!1),x("throwInternalError",!1),x("throwBindingError",!1),x("throwUnboundTypeError",!1),x("ensureOverloadTable",!1),x("exposePublicSymbol",!1),x("replacePublicSymbol",!1),x("extendError",!1),x("createNamedFunction",!1),x("registeredInstances",!1),x("getBasestPointer",!1),x("registerInheritedInstance",!1),x("unregisterInheritedInstance",!1),x("getInheritedInstance",!1),x("getInheritedInstanceCount",!1),x("getLiveInheritedInstances",!1),x("registeredTypes",!1),x("awaitingDependencies",!1),x("typeDependencies",!1),x("registeredPointers",!1),x("registerType",!1),x("whenDependentTypesAreResolved",!1),x("embind_charCodes",!1),x("embind_init_charCodes",!1),x("readLatin1String",!1),x("getTypeName",!1),x("heap32VectorToArray",!1),x("requireRegisteredType",!1),x("getShiftFromSize",!1),x("integerReadValueFromPointer",!1),x("enumReadValueFromPointer",!1),x("floatReadValueFromPointer",!1),x("simpleReadValueFromPointer",!1),x("runDestructors",!1),x("new_",!1),x("craftInvokerFunction",!1),x("embind__requireFunction",!1),x("tupleRegistrations",!1),x("structRegistrations",!1),x("genericPointerToWireType",!1),x("constNoSmartPtrRawPointerToWireType",!1),x("nonConstNoSmartPtrRawPointerToWireType",!1),x("init_RegisteredPointer",!1),x("RegisteredPointer",!1),x("RegisteredPointer_getPointee",!1),x("RegisteredPointer_destructor",!1),x("RegisteredPointer_deleteObject",!1),x("RegisteredPointer_fromWireType",!1),x("runDestructor",!1),x("releaseClassHandle",!1),x("finalizationRegistry",!1),x("detachFinalizer_deps",!1),x("detachFinalizer",!1),x("attachFinalizer",!1),x("makeClassHandle",!1),x("init_ClassHandle",!1),x("ClassHandle",!1),x("ClassHandle_isAliasOf",!1),x("throwInstanceAlreadyDeleted",!1),x("ClassHandle_clone",!1),x("ClassHandle_delete",!1),x("deletionQueue",!1),x("ClassHandle_isDeleted",!1),x("ClassHandle_deleteLater",!1),x("flushPendingDeletes",!1),x("delayFunction",!1),x("setDelayFunction",!1),x("RegisteredClass",!1),x("shallowCopyInternalPointer",!1),x("downcastPointer",!1),x("upcastPointer",!1),x("validateThis",!1),x("char_0",!1),x("char_9",!1),x("makeLegalFunctionName",!1),x("emval_handle_array",!1),x("emval_free_list",!1),x("emval_symbols",!1),x("init_emval",!1),x("count_emval_handles",!1),x("get_first_emval",!1),x("getStringOrSymbol",!1),x("Emval",!1),x("emval_newers",!1),x("craftEmvalAllocator",!1),x("emval_get_global",!1),x("emval_methodCallers",!1),x("emval_registeredMethods",!1),x("writeGLArray",!1),E("ALLOC_NORMAL",!1),E("ALLOC_STACK",!1),Ee=function e(){as||Is(),as||(Ee=e)},i.run=Is,i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Is(),e.ready});e.exports=r}}]);