@sketch-hq/sketch-web-renderer 3.2.3 → 3.3.0-rollup.0

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 (91) hide show
  1. package/dist/featureFlags.d.ts +3 -2
  2. package/dist/featureFlags.d.ts.map +1 -1
  3. package/dist/index.d.ts +4 -5
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +1 -1
  6. package/dist/module-debug-efa7816a.js +1 -0
  7. package/dist/module-debug.wasm +0 -0
  8. package/dist/module-release-e0df0468.js +1 -0
  9. package/dist/module-release.wasm +0 -0
  10. package/dist/ts/CanvasManager.d.ts +37 -0
  11. package/dist/ts/CanvasManager.d.ts.map +1 -0
  12. package/dist/ts/WasmModule.d.ts +50 -0
  13. package/dist/ts/WasmModule.d.ts.map +1 -0
  14. package/dist/ts/prototypes-player/PrototypesPlayer.d.ts +82 -0
  15. package/dist/ts/prototypes-player/PrototypesPlayer.d.ts.map +1 -0
  16. package/dist/ts/{SketchWeb.d.ts → sketch-web/SketchWeb.d.ts} +42 -60
  17. package/dist/ts/sketch-web/SketchWeb.d.ts.map +1 -0
  18. package/dist/ts/{react → sketch-web/react}/SketchWebProvider.d.ts +0 -0
  19. package/dist/ts/sketch-web/react/SketchWebProvider.d.ts.map +1 -0
  20. package/dist/ts/{react → sketch-web/react}/SketchWebReact.d.ts +2 -2
  21. package/dist/ts/sketch-web/react/SketchWebReact.d.ts.map +1 -0
  22. package/dist/ts/{react → sketch-web/react}/contexts.d.ts +3 -3
  23. package/dist/ts/sketch-web/react/contexts.d.ts.map +1 -0
  24. package/dist/ts/{react → sketch-web/react}/hooks/actions.d.ts +0 -0
  25. package/dist/ts/sketch-web/react/hooks/actions.d.ts.map +1 -0
  26. package/dist/ts/{react → sketch-web/react}/hooks/index.d.ts +0 -0
  27. package/dist/ts/sketch-web/react/hooks/index.d.ts.map +1 -0
  28. package/dist/ts/{react → sketch-web/react}/hooks/state.d.ts +3 -3
  29. package/dist/ts/sketch-web/react/hooks/state.d.ts.map +1 -0
  30. package/dist/ts/{react → sketch-web/react}/hooks/useEvent.d.ts +1 -1
  31. package/dist/ts/sketch-web/react/hooks/useEvent.d.ts.map +1 -0
  32. package/dist/ts/{react → sketch-web/react}/index.d.ts +0 -0
  33. package/dist/ts/sketch-web/react/index.d.ts.map +1 -0
  34. package/dist/ts/{react → sketch-web/react}/internal.d.ts +3 -3
  35. package/dist/ts/sketch-web/react/internal.d.ts.map +1 -0
  36. package/dist/ts/{react → sketch-web/react}/reducer.d.ts +0 -0
  37. package/dist/ts/sketch-web/react/reducer.d.ts.map +1 -0
  38. package/dist/ts/{react → sketch-web/react}/types.d.ts +5 -5
  39. package/dist/ts/sketch-web/react/types.d.ts.map +1 -0
  40. package/dist/ts/{react → sketch-web/react}/utils.d.ts +0 -0
  41. package/dist/ts/sketch-web/react/utils.d.ts.map +1 -0
  42. package/dist/ts/types/Events.d.ts +1 -1
  43. package/dist/ts/types/Events.d.ts.map +1 -1
  44. package/dist/ts/types/wasm/Emscripten.d.ts +35 -0
  45. package/dist/ts/types/wasm/Emscripten.d.ts.map +1 -0
  46. package/dist/ts/types/{JSBridge.d.ts → wasm/JSBridge.d.ts} +2 -2
  47. package/dist/ts/types/wasm/JSBridge.d.ts.map +1 -0
  48. package/dist/ts/types/wasm/PRUserEventsCollector.d.ts +23 -0
  49. package/dist/ts/types/wasm/PRUserEventsCollector.d.ts.map +1 -0
  50. package/dist/ts/types/wasm/PrototypesPlayer.d.ts +36 -0
  51. package/dist/ts/types/wasm/PrototypesPlayer.d.ts.map +1 -0
  52. package/dist/ts/types/wasm/RenderTarget.d.ts +7 -0
  53. package/dist/ts/types/wasm/RenderTarget.d.ts.map +1 -0
  54. package/dist/ts/types/wasm/SketchWeb.d.ts +62 -0
  55. package/dist/ts/types/wasm/SketchWeb.d.ts.map +1 -0
  56. package/dist/ts/types/wasm/WasmModule.d.ts +33 -0
  57. package/dist/ts/types/wasm/WasmModule.d.ts.map +1 -0
  58. package/dist/ts/utils/EventEmitter/EventEmitter.d.ts +5 -0
  59. package/dist/ts/utils/EventEmitter/EventEmitter.d.ts.map +1 -1
  60. package/dist/ts/utils/GestureManager/GestureManager.d.ts +1 -4
  61. package/dist/ts/utils/GestureManager/GestureManager.d.ts.map +1 -1
  62. package/dist/ts/utils/misc.d.ts +6 -1
  63. package/dist/ts/utils/misc.d.ts.map +1 -1
  64. package/package.json +42 -37
  65. package/dist/cpp/out/Debug/module-debug.d.ts +0 -6
  66. package/dist/cpp/out/Debug/module-debug.d.ts.map +0 -1
  67. package/dist/cpp/out/Release/module-release.d.ts +0 -6
  68. package/dist/cpp/out/Release/module-release.d.ts.map +0 -1
  69. package/dist/static/js/web-renderer-49953fc2d5b916489af2.chunk.js +0 -1
  70. package/dist/static/js/web-renderer-8cf7e3dad04db65cf1e1.chunk.js +0 -1
  71. package/dist/static/js/web-renderer-aabfc7a6fc6164757d08.chunk.js +0 -1
  72. package/dist/ts/Manager.d.ts +0 -92
  73. package/dist/ts/Manager.d.ts.map +0 -1
  74. package/dist/ts/SketchWeb.d.ts.map +0 -1
  75. package/dist/ts/Worker.d.ts +0 -2
  76. package/dist/ts/Worker.d.ts.map +0 -1
  77. package/dist/ts/react/SketchWebProvider.d.ts.map +0 -1
  78. package/dist/ts/react/SketchWebReact.d.ts.map +0 -1
  79. package/dist/ts/react/contexts.d.ts.map +0 -1
  80. package/dist/ts/react/hooks/actions.d.ts.map +0 -1
  81. package/dist/ts/react/hooks/index.d.ts.map +0 -1
  82. package/dist/ts/react/hooks/state.d.ts.map +0 -1
  83. package/dist/ts/react/hooks/useEvent.d.ts.map +0 -1
  84. package/dist/ts/react/index.d.ts.map +0 -1
  85. package/dist/ts/react/internal.d.ts.map +0 -1
  86. package/dist/ts/react/reducer.d.ts.map +0 -1
  87. package/dist/ts/react/types.d.ts.map +0 -1
  88. package/dist/ts/react/utils.d.ts.map +0 -1
  89. package/dist/ts/types/JSBridge.d.ts.map +0 -1
  90. package/dist/ts/types/WASM.d.ts +0 -141
  91. package/dist/ts/types/WASM.d.ts.map +0 -1
@@ -1,12 +1,13 @@
1
1
  /**
2
2
  * Initial dummy structure for feature flags
3
3
  */
4
- declare const FeatureFlags: {
4
+ declare const DefaultFeatureFlags: {
5
5
  delayedDraw: boolean;
6
6
  offscreenCanvas: boolean;
7
7
  useDirtyRectsRendering: boolean;
8
8
  safariWebGL2: boolean;
9
9
  pageBoundariesLimit: boolean;
10
10
  };
11
- export default FeatureFlags;
11
+ export declare type FeatureFlagsObject = typeof DefaultFeatureFlags;
12
+ export default DefaultFeatureFlags;
12
13
  //# sourceMappingURL=featureFlags.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"featureFlags.d.ts","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,YAAY;;;;;;CAQjB,CAAA;AAED,eAAe,YAAY,CAAA"}
1
+ {"version":3,"file":"featureFlags.d.ts","sourceRoot":"","sources":["../src/featureFlags.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,QAAA,MAAM,mBAAmB;;;;;;CAQxB,CAAA;AAED,oBAAY,kBAAkB,GAAG,OAAO,mBAAmB,CAAA;AAE3D,eAAe,mBAAmB,CAAA"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import { Manager } from './ts/Manager';
2
- export default Manager;
3
1
  export declare const DefaultFeatureFlags: {
4
2
  delayedDraw: boolean;
5
3
  offscreenCanvas: boolean;
@@ -7,13 +5,14 @@ export declare const DefaultFeatureFlags: {
7
5
  safariWebGL2: boolean;
8
6
  pageBoundariesLimit: boolean;
9
7
  };
10
- export * from './ts/SketchWeb';
8
+ export * from './ts/sketch-web/SketchWeb';
9
+ export * from './ts/sketch-web/react';
10
+ export * from './ts/prototypes-player/PrototypesPlayer';
11
11
  export * from './ts/types/Events';
12
12
  export * from './ts/types/Status';
13
13
  export * from './ts/types/Mode';
14
14
  export * from './ts/types/Warning';
15
15
  export * from './ts/types/Error';
16
16
  export * from './ts/types/Metric';
17
- export * from './ts/types/WASM';
18
- export * from './ts/react';
17
+ export * from './ts/types/wasm/SketchWeb';
19
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAGtC,eAAe,OAAO,CAAA;AACtB,eAAO,MAAM,mBAAmB;;;;;;CAAe,CAAA;AAE/C,cAAc,gBAAgB,CAAA;AAC9B,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;;;;;;CAAe,CAAA;AAE/C,cAAc,2BAA2B,CAAA;AACzC,cAAc,uBAAuB,CAAA;AACrC,cAAc,yCAAyC,CAAA;AACvD,cAAc,mBAAmB,CAAA;AACjC,cAAc,mBAAmB,CAAA;AACjC,cAAc,iBAAiB,CAAA;AAC/B,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,mBAAmB,CAAA;AACjC,cAAc,2BAA2B,CAAA"}
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,(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})()));
1
+ import e,{createContext as t,useContext as n,useCallback as o,useEffect as r,useRef as i,useState as a,useMemo as s,useReducer as c}from"react";var u={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1},l=function(e,t){return l=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])},l(e,t)};function h(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}l(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var d=function(){return d=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},d.apply(this,arguments)};function m(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 p(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(s){return function(c){return function(s){if(n)throw new TypeError("Generator is already executing.");for(;i&&(i=0,s[0]&&(a=0)),a;)try{if(n=1,o&&(r=2&s[0]?o.return:s[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,s[1])).done)return r;switch(o=0,r&&(s=[2&s[0],r.value]),s[0]){case 0:case 1:r=s;break;case 4:return a.label++,{value:s[1],done:!1};case 5:a.label++,o=s[1],s=[0];continue;case 7:s=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==s[0]&&2!==s[0])){a=0;continue}if(3===s[0]&&(!r||s[1]>r[0]&&s[1]<r[3])){a.label=s[1];break}if(6===s[0]&&a.label<r[1]){a.label=r[1],r=s;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(s);break}r[2]&&a.ops.pop(),a.trys.pop();continue}s=t.call(e,a)}catch(e){s=[6,e],o=0}finally{n=r=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,c])}}}function f(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))}var g=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/;function v(e,t,n){return Math.max(t,Math.min(n,e))}function y(){return 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(g);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}}}()&&!u.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function b(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}function w(e){var t=e;return Object.keys(t).forEach((function(e){void 0===t[e]&&delete t[e]})),t}var C,P=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.forwardEvent=function(e,t){this.on(t,(function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];e.emit.apply(e,f([t],n,!1))}))},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.prototype.detachAllListeners=function(){this.listeners={}},e}(),W=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,f(["[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,f(["[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,f(["[SketchWeb] [Error]"],e,!1))},e}()),M=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),W.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);W.debug("[Performance] End: ".concat(this.label," -> ").concat(t," ms"))}else{var n=(e/1e3).toFixed(2);W.debug("[Performance] End: ".concat(this.label," -> ").concat(n," s"))}},e}(),E=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 h(t,e),t}(Error);function L(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"}(C||(C={}));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 x(e){return e.toLowerCase().replace(/^angle ?\((.+)\)*$/,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const S="undefined"==typeof window,I=(()=>{if(S)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)}})();const k=[],T=[];function D(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;)T[l]=e.charCodeAt(a+l),k[l]=++l;for(;h<r;)for(i=t.charCodeAt(a+h),s=h++,u=h,l=0;l<o;l++)c=i===T[l]?s:s+1,s=k[l],u=k[l]=s>u?c>u?u+1:c:c>s?s+1:c;return u}function A(e){return null!=e}class G extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const Z=({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"}={})=>L(void 0,void 0,void 0,(function*(){const a={};if(S)return{tier:0,type:"SSR"};const{isIpad:s=!!(null==I?void 0:I.isIpad),isMobile:c=!!(null==I?void 0:I.isMobile),screenSize:u=window.screen,loadBenchmarks:l=(e=>L(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 G("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 m,p="";if(h)h=x(h),m=[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==I?void 0:I.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=x(h),m=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==I?void 0:I.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 f=(yield Promise.all(m.map((function(e){var t;return L(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 G)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 m=d.length;if(0===m)return;let p,[f,,,g]=m>1?d.map((t=>[t,D(e,t[0])])).sort((([,e],[,t])=>e-t))[0][0]:d[0],v=Number.MAX_VALUE;const{devicePixelRatio:y}=window,b=u.width*y*u.height*y;for(const e of g){const[t,n]=e,o=t*n,r=Math.abs(b-o);r<v&&(v=r,p=e)}if(!p)return;const[,,w,C]=p;return[v,w,f,C]}))})))).filter(A).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!f.length){const e=R.find((e=>h.includes(e)));return e?d(0,"BLOCKLISTED",e):d(1,"FALLBACK",`${h} (${p})`)}const[,g,v,y]=f[0];if(-1===g)return d(0,"BLOCKLISTED",v,g,y);const b=c?e:t;let w=0;for(let e=0;e<b.length;e++)g>=b[e]&&(w=e);return d(w,"BENCHMARK",v,g,y)}));var F=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}(),B=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new F,n.state={pinchToZoomLastDistance:0,lastGestureScale:1,isCtrlPressed:!1},n.handleGestureStart=function(e){e.preventDefault(),n.state.lastGestureScale=e.scale},n.handleGestureChange=function(e){e.preventDefault();var t=e.scale/n.state.lastGestureScale;n.state.lastGestureScale=e.scale;var o=n.getCorrectPointerPosition(e);n.emitZoomEvent(t,o)},n.handleGestureEnd=function(e){e.preventDefault()},n.handleTouchStart=function(e){e.preventDefault(),n.handleTouchPinchToZoomStart(e),n.emit("pointerdown",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleMouseDown=function(e){e.ctrlKey||(e.preventDefault(),n.emit("pointerdown",{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0}))},n.handleTouchMove=function(e){n.handleTouchPinchToZoomChange(e),n.emit("pointermove",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleMouseMove=function(e){n.updateMousePosition(e)},n.handleGlobalTouchMove=function(e){n.emit("globalpointermove",{type:"touch",position:n.getCorrectPointerPosition(e),button:0,touchesCount:e.touches.length})},n.handleGlobalMouseMove=function(e){n.updateGlobalMousePosition(e)},n.handleTouchPinchToZoomStart=function(e){var t;!e.touches||(null===(t=e.touches)||void 0===t?void 0:t.length)<2||(n.state.pinchToZoomLastDistance=n.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]))},n.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var o=n.calculateDistanceBetweenTouches(e.touches[0],e.touches[1]),r=n.getCorrectPointerPosition(e),i=1+.004*(o-n.state.pinchToZoomLastDistance);n.state.pinchToZoomLastDistance=o,n.emitZoomEvent(i,r)}},n.handleTouchEnd=function(e){var t=e.touches.length<1?{x:0,y:0}:n.getCorrectPointerPosition(e);n.emit("pointerup",{position:t,type:"touch",button:0,touchesCount:e.touches.length})},n.handleMouseUp=function(e){n.emit("pointerup",{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!n.state.isCtrlPressed,o=e.metaKey||t||n.state.isCtrlPressed;if(n.updateMousePosition(e),n.updateGlobalMousePosition(e),o){var r=t?-1:1,i=n.getCorrectPointerPosition(e),a=1+.005*e.deltaY*r;n.emitZoomEvent(a,i)}else n.emit("wheel",{x:-e.deltaX,y:-e.deltaY},{type:"mouse",position:n.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},n.target=t,n.targetBounds=t.getBoundingClientRect(),n.addListeners(),n}return h(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(){"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}))},t.prototype.clampPointerToTargetBounds=function(e){return{x:v(e.x-this.targetBounds.x,0,this.target.clientWidth),y:v(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=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)},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}(P),z=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new F,n.size={width:0,height:0},n.pixelRatio=1,n.handleCanvasResizeObserver=function(e){n.resizeCanvas(e[0].contentRect)},n.resizeCanvas=function(e){var t=e.width,o=e.height;window.requestAnimationFrame((function(){n.setSize(t,o),n.emit("resize",t,o,n.getDevicePixelRatio())}))},n.getCanvasCenterPoint=function(){var e=n.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},n.container=t.container,n.canvas=t.canvas,n.canvasResizeObserver=new ResizeObserver(n.handleCanvasResizeObserver),n.canvasResizeObserver.observe(n.container),n.listenersCollector.add(window,"orientationchange",n.handleDeviceOrientationChange),n.setSize(n.container.clientWidth,n.container.clientHeight),n}return h(t,e),t.prototype.setSize=function(e,t){this.pixelRatio=this.getDevicePixelRatio(),this.canvas.style.width="".concat(e,"px"),this.canvas.style.height="".concat(t,"px"),this.size.width=e*this.pixelRatio,this.size.height=t*this.pixelRatio,this.canvas.width=this.size.width,this.canvas.height=this.size.height},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.container.clientWidth,height:this.container.clientHeight})},t.prototype.getDevicePixelRatio=function(){return v(window.devicePixelRatio,1,2)},t.prototype.getBoundingClientRect=function(){return this.canvas.getBoundingClientRect()},t.prototype.dispose=function(){this.detachAllListeners(),this.canvasResizeObserver.disconnect(),this.listenersCollector.dispose()},t}(P),U=function(){function e(e){this.settings=e}return e.prototype.isReleaseMode=function(){return this.settings.mode===C.release},e.prototype.init=function(){return m(this,void 0,void 0,(function(){var e,t,n,o,r,i=this;return p(this,(function(a){switch(a.label){case 0:return this.isReleaseMode()?[4,import("./module-debug-efa7816a.js")]:[3,2];case 1:return e=a.sent(),[3,4];case 2:return[4,import("./module-release-e0df0468.js")];case 3:e=a.sent(),a.label=4;case 4:t=e.default,a.label=5;case 5:return a.trys.push([5,7,,8]),n=this,[4,t({FeatureFlags:this.settings.featureFlags,currentWebGLVersion:y(),bridge:this.settings.jsBridge,locateFile:function(e){return i.settings.locateFile.replace("{file}",e)}})];case 6:return n.instance=a.sent(),[3,8];case 7:throw o=a.sent(),new E("WASM_ERROR","An error occurred while trying to create the wasm module.",o);case 8:return this.pointerTypeToWASMMap={unset:this.instance.PRUserPointerType.Unset,mouse:this.instance.PRUserPointerType.Mouse,touch:this.instance.PRUserPointerType.Touch},this.prCursorTypeToCSSCursorMap=((r={})[this.instance.PRCursorType.Auto.value]="auto",r[this.instance.PRCursorType.Default.value]="default",r[this.instance.PRCursorType.Pointer.value]="pointer",r[this.instance.PRCursorType.Grab.value]="grab",r[this.instance.PRCursorType.Grabbing.value]="grabbing",r),[2]}}))}))},e.prototype.makeWebGLContext=function(e,t){void 0===t&&(t={});var n=d({antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1},t);W.debug("Using WebGL ".concat(n.majorVersion));var o=this.instance.GL.createContext(e,n);if(!o)throw new E("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");return o},e.prototype.destroyWebGLContext=function(e){var t,n=null===(t=this.instance)||void 0===t?void 0:t.GL.getContext(e);if(n){var o=n.GLctx.getExtension("WEBGL_lose_context");o?o.loseContext():W.warning("Unable to retrieve WEBGL_lose_context extension")}else W.warning("Unable to loose context. WebGL rendering context not found")},e.prototype.mapToCSSCursor=function(e){return this.prCursorTypeToCSSCursorMap[e.value]},e.prototype.mapToPRPointerType=function(e){var t;return null!==(t=this.pointerTypeToWASMMap[e])&&void 0!==t?t:this.instance.PRUserPointerType.Unset},e.prototype.mapPointerInfo=function(e){return d(d({},e),{type:this.mapToPRPointerType(e.type)})},e.prototype.dispose=function(){this.instance=void 0},e}(),O=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"INIT"},n.handleCanvasResize=function(e,t,o){var r;null===(r=n.sketchWebWasm)||void 0===r||r.resize(e,t,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(e,t.x,t.y)},n.handleWheelEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(e))},n.settings=d(d({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1,panBoundariesPadding:0},w(t)),{featureFlags:d(d({},u),t.featureFlags)}),W.active=n.settings.mode===C.debug,n.gestureManager=new B(n.settings.container),n.canvasManager=new z({container:n.settings.container,canvas:n.settings.canvas}),n.wasmModule=new U({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.settings.manualInitialization||n.init(),n}return h(t,e),t.prototype.addListeners=function(){this.canvasManager.on("resize",this.handleCanvasResize),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),this.settings.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost)},t.prototype.collectAndEmitDeviceInfo=function(){return m(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,Z()];case 1:return e=t.sent(),this.deviceInfo=d(d({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return m(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.traceFirstPaint=new M("FirstPaint"),this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,this.initWasmModule()];case 2:return t.sent(),[4,this.initSketchWebWasm()];case 3:return t.sent(),[4,this.setFile(this.settings.filePath)];case 4:return t.sent(),[4,this.preloadImages()];case 5:return t.sent(),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof E?e:new E("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.setInitialCameraState=function(){var e=void 0!==this.settings.initialZoom,t=void 0!==this.settings.initialPan;e||t?(e&&this.setZoom(this.settings.initialZoom),t&&this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)):this.zoomToFit()},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 M("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){W.debug("[C++] ".concat(e))},logWarning:function(e){W.warning("[C++] ".concat(e))},logError:function(e){W.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.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t):e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t]:(W.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.wasmModule.mapToCSSCursor(t);e.emit("cursorChange",n)}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new M("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),W.debug("Images downloaded"),t()}))}))},t.prototype.initWasmModule=function(){return m(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=new M("WasmModuleDownload"),[4,this.wasmModule.init()];case 1:return t.sent(),e.printMeasurement(),this.emit("metric",e.measure()),[2]}}))}))},t.prototype.initSketchWebWasm=function(){return m(this,void 0,void 0,(function(){return p(this,(function(e){try{this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:y()}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.sketchWebWasm=new this.wasmModule.instance.SketchWeb(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders})}catch(e){throw new E("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.userEventsCollectorWasm=this.sketchWebWasm.getUserEventsCollector(),this.sketchWebWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.sketchWebWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),this.sketchWebWasm.setPanBoundariesPadding(this.settings.panBoundariesPadding),[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.settings.backgroundColor.r&&e.g===this.settings.backgroundColor.g&&e.b===this.settings.backgroundColor.b&&e.a===this.settings.backgroundColor.a||(null===(t=this.sketchWebWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.settings.backgroundColor=e)},t.prototype.generateDocumentPNG=function(){return m(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(){this.wasmModule.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},t.prototype.zoomToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.setFile=function(e){return m(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){W.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 E("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()):"")}),W.error(e),e.cause&&W.error(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(W.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.settings.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.settings.filePath,document:d(d({},e),{artboards:b(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,o=null!=t?t:this.canvasManager.getCanvasCenterPoint();null===(n=this.sketchWebWasm)||void 0===n||n.setZoom(e,o.x,o.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.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.canvasManager.pixelRatio,Number.EPSILON);o+=this.canvasManager.size.width/s,r+=this.canvasManager.size.height/s}var c=(o-i.x)*a,u=(r-i.y)*a;this.sketchWebWasm.setPan(c,u)}},t.prototype.dispose=function(){var e,t,n,o;try{this.detachAllListeners(),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),null===(n=this.renderTarget)||void 0===n||n.delete(),null===(o=this.wasmModule)||void 0===o||o.dispose(),this.userEventsCollectorWasm=null,this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new E("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(P),_=t(void 0),N=function(){var e=n(_);if(void 0===e)throw Error("useSketchWebInternalContext must be used within a SketchWebProvider");return e},j=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return W.debug.apply(W,f(["SketchWebReact"],e,!1))},$=t(void 0),V=t(void 0),Y=t(void 0),H=t(void 0),K=t(void 0),X=t(void 0),q=t("auto"),J=function(){var e=n($);if(void 0===e)throw Error("useStatus must be used within a SketchWebProvider");return e},Q=function(){var e=n(V);if(void 0===e)throw Error("useDocument must be used within a SketchWebProvider");return e},ee=function(){var e=n(Y);if(void 0===e)throw Error("useZoom must be used within a SketchWebProvider");return e},te=function(){var e=n(X);if(void 0===e)throw Error("usePan must be used within a SketchWebProvider");return e},ne=function(){var e=n(q);if(void 0===e)throw Error("useCursor must be used within a SketchWebProvider");return e},oe=function(){var e=n(H);if(void 0===status)throw Error("useIsCameraZooming must be used within a SketchWebProvider");return e},re=function(){var e=n(K);if(void 0===status)throw Error("useIsCameraMoving must be used within a SketchWebProvider");return e},ie=function(){var e=(0,N().getManager)();return o((function(t){j("setZoom",t),null==e||e.setZoom(t)}),[e])},ae=function(){var e=ie(),t=ee();return o((function(){var n;(j("incrementZoom"),"number"==typeof t)&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},se=function(){var e=ie(),t=ee();return o((function(){j("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},ce=function(){var e=(0,N().getManager)();return o((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;j("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},ue=function(){var e=(0,N().getManager)();return o((function(){j("zoomToFit"),null==e||e.zoomToFit()}),[e])},le=function(){var e=(0,N().getManager)();return o((function(){j("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},he=function(){var e=(0,N().getManager)();return o((function(){return m(void 0,void 0,void 0,(function(){return p(this,(function(t){switch(t.label){case 0:return j("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},de=function(){var e=(0,N().getManager)();return o((function(t,n){return m(void 0,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return j("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},me=function(){var e=(0,N().getManager)();return o((function(t,n){return m(void 0,void 0,void 0,(function(){return p(this,(function(o){switch(o.label){case 0:return j("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},pe=function(){var e=(0,N().getManager)();return o((function(t){j("setIsCameraLocked",t),null==e||e.setIsCameraLocked(t)}),[e])},fe=function(e,t){var n=(0,N().getManager)();r((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},ge={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},ve={position:"absolute",top:0,left:0},ye=function(t){W.active=t.mode===C.debug;var n=t.filePath,c=t.locateFile,u=t.imagesURLFormat,l=t.imagesURLMap,h=t.backgroundColor,m=t.mode,p=t.showTilesBorders,f=t.minimumZoomLevel,g=t.maximumZoomLevel,v=t.preserveDrawingBuffer,y=t.panBoundariesPadding,b=t.initialPan,w=t.initialZoom,P=t.children,M=t.containerProps,E=void 0===M?{}:M,L=t.canvasProps,R=void 0===L?{}:L,x=t.featureFlags,S=void 0===x?{}:x,I=i(null),k=i(null),T=a(!1),D=T[0],A=T[1],G=o((function(){return A(!0)}),[]),Z=N(),F=Z.dispose,B=Z.init,z=Z.setSettings,U=ne(),O=J();fe("allImagesReady",G),r((function(){z({locateFile:c,imagesURLFormat:u,imagesURLMap:l,backgroundColor:h,mode:m,showTilesBorders:p,minimumZoomLevel:f,maximumZoomLevel:g,preserveDrawingBuffer:v,panBoundariesPadding:y,initialPan:b,initialZoom:w,featureFlags:S})}),[z,c,u,l,h,m,p,f,g,v,y,b,w,S]),r((function(){if(n)return B(n,I.current,k.current),function(){F()}}),[F,B,n]);var _=s((function(){var e;return null!==(e=t.cursor)&&void 0!==e?e:U}),[t.cursor,U]),j=s((function(){return d(d({},ge),{cursor:_})}),[_]);return e.createElement("div",d({},E,{ref:k,style:j}),n&&e.createElement("canvas",d({},R,{key:n,ref:I,"data-sketchweb-all-images-ready":D,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==O?void 0:O.type.toLowerCase())||"null"),style:ve})),"READY"===(null==O?void 0:O.type)&&P)},be=function(e,t){switch(t.type){case"on-status":return d(d({},e),{status:t.status});case"on-file-ready":return d(d({},e),{document:t.document});case"on-zoom":return d(d({},e),{zoom:t.zoom});case"on-pan":return d(d({},e),{pan:t.pan});case"dispose":return d(d({},e),{status:null,zoom:null,pan:null,cursor:"auto"});case"post-init":return d(d({},e),{status:t.status,zoom:t.zoom});case"on-camera-zoom-start":return d(d({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return d(d({},e),{isCameraZooming:!1});case"on-camera-move-start":return d(d({},e),{isCameraMoving:!0});case"on-camera-move-end":return d(d({},e),{isCameraMoving:!1});case"on-cursor-change":return d(d({},e),{cursor:t.cursor});default:return e}},we=function(t){var n=i(null),r=i(null),a=c(be,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),u=a[0],l=u.status,h=u.document,f=u.zoom,g=u.pan,v=u.isCameraZooming,y=u.isCameraMoving,b=u.cursor,w=a[1],C=o((function(e){return w({type:"on-zoom",zoom:e})}),[]),P=o((function(e,t){return w({type:"on-pan",pan:{x:e,y:t}})}),[]),W=o((function(e){w({type:"on-status",status:e})}),[]),M=o((function(e){w({type:"on-file-ready",document:e})}),[]),E=o((function(){return w({type:"on-camera-zoom-start"})}),[]),L=o((function(){return w({type:"on-camera-zoom-end"})}),[]),R=o((function(){return w({type:"on-camera-move-start"})}),[]),x=o((function(){return w({type:"on-camera-move-end"})}),[]),S=o((function(e){return w({type:"on-cursor-change",cursor:e})}),[]),I=o((function(){var e=n.current;e&&(j("dispose"),e.off("status",W),e.off("fileReady",M),e.off("cameraZoomChange",C),e.off("cameraPanChange",P),e.off("cameraZoomStart",E),e.off("cameraZoomEnd",L),e.off("cameraMoveStart",R),e.off("cameraMoveEnd",x),e.off("cursorChange",S),e.dispose(),n.current=null,w({type:"dispose"}))}),[W,M,P,C,E,L,R,x,S]),k=o((function(e,t,o){if(""!==e&&t&&o&&r.current){j("init");var i=new O(d(d({},r.current),{filePath:e,container:o,canvas:t}));i.on("status",W),i.on("fileReady",M),i.on("cameraZoomChange",C),i.on("cameraPanChange",P),i.on("cameraZoomStart",E),i.on("cameraZoomEnd",L),i.on("cameraMoveStart",R),i.on("cameraMoveEnd",x),i.on("cursorChange",S);m(void 0,void 0,void 0,(function(){return p(this,(function(e){return w({type:"post-init",zoom:i.getZoom()||null,status:i.getStatus()||null,pan:i.getPan()||null}),[2]}))})),n.current=i}}),[W,M,C,P,E,L,R,x,S]),T=o((function(e){var t;j("setSettings",e),e.backgroundColor&&(null===(t=n.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),r.current=e}),[]),D=o((function(){return n.current}),[]),A=s((function(){return{dispose:I,init:k,setSettings:T,getManager:D,dispatch:w}}),[I,k,T,D]);return e.createElement(_.Provider,{value:A},e.createElement($.Provider,{value:l},e.createElement(V.Provider,{value:h},e.createElement(Y.Provider,{value:f},e.createElement(X.Provider,{value:g},e.createElement(H.Provider,{value:v},e.createElement(K.Provider,{value:y},e.createElement(q.Provider,{value:b},t.children))))))))},Ce=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"INIT"},n.handleCanvasResize=function(e,t,o){var r;null===(r=n.playerWasm)||void 0===r||r.resize(e,t,o)},n.handleWebGLContextLost=function(){n.setStatus({type:"WEBGL_CONTEXT_LOST"})},n.handlePinchToZoomEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchPinchToZoomEvent(e,t.x,t.y)},n.handleWheelEvent=function(e,t){var o;null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(e))},n.settings=d(d({backgroundColor:{r:1,g:1,b:1,a:1},showTilesBorders:!1,preserveDrawingBuffer:!1},w(t)),{featureFlags:d(d({},u),t.featureFlags)}),W.active=n.settings.mode===C.debug,n.gestureManager=new B(n.settings.container),n.canvasManager=new z({container:n.settings.container,canvas:n.settings.canvas}),n.wasmModule=new U({mode:n.settings.mode,locateFile:n.settings.locateFile,jsBridge:n.createJSBridge(),featureFlags:n.settings.featureFlags}),n.settings.manualInitialization||n.init(),n}return h(t,e),t.prototype.addListeners=function(){this.canvasManager.on("resize",this.handleCanvasResize),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),this.settings.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost)},t.prototype.collectAndEmitDeviceInfo=function(){return m(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return[4,Z()];case 1:return e=t.sent(),this.deviceInfo=d(d({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.init=function(){return m(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:this.traceFirstPaint=new M("FirstPaint"),this.setStatus({type:"INIT"}),this.collectAndEmitDeviceInfo(),t.label=1;case 1:return t.trys.push([1,6,,7]),[4,this.initWasmModule()];case 2:return t.sent(),[4,this.initPlayerWasm()];case 3:return t.sent(),[4,this.setFile(this.settings.filePath)];case 4:return t.sent(),[4,this.preloadImages()];case 5:return t.sent(),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof E?e:new E("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initWasmModule=function(){return m(this,void 0,void 0,(function(){var e;return p(this,(function(t){switch(t.label){case 0:return e=new M("WasmModuleDownload"),[4,this.wasmModule.init()];case 1:return t.sent(),e.printMeasurement(),this.emit("metric",e.measure()),[2]}}))}))},t.prototype.setInitialCameraState=function(){this.zoomToFit()},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.playerWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new M("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.playerWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){W.debug("[C++] ".concat(e))},logWarning:function(e){W.warning("[C++] ".concat(e))},logError:function(e){W.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.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t):e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t]:(W.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(t,n){e.emit("cameraPanChange",t,n)},onCursorChange:function(t){var n=e.wasmModule.mapToCSSCursor(t);e.emit("cursorChange",n)}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new M("ImagesDownload");null===(n=e.playerWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),W.debug("Images downloaded"),t()}))}))},t.prototype.initPlayerWasm=function(){return m(this,void 0,void 0,(function(){return p(this,(function(e){try{this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:y()}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.playerWasm=new this.wasmModule.instance.PrototypesPlayer(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders})}catch(e){throw new E("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.userEventsCollectorWasm=this.playerWasm.getUserEventsCollector(),this.playerWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.playerWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),[2]}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.playerWasm)||void 0===t||t.setIsCameraLocked(e)},t.prototype.setBackgroundColor=function(e){var t;e.r===this.settings.backgroundColor.r&&e.g===this.settings.backgroundColor.g&&e.b===this.settings.backgroundColor.b&&e.a===this.settings.backgroundColor.a||(null===(t=this.playerWasm)||void 0===t||t.setBackgroundColor(e.r,e.g,e.b,e.a),this.settings.backgroundColor=e)},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(){this.wasmModule.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},t.prototype.zoomToFit=function(){var e;null===(e=this.playerWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.setFile=function(e){return m(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.playerWasm.setFile(e,(function(e,o,r,i){if(void 0===i&&(i=[]),i.length){W.debug("Parser warnings: ".concat(i));var a=i.map((function(e){return{key:e}}));t.emit("warnings",a)}t.setStatus({type:"FILE_READY"}),n()}),(function(){return o(new E("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()):"")}),W.error(e),e.cause&&W.error(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(W.debug("Status transition ".concat(this.status.type," => ").concat(e.type,"}")),this.status=e,this.emit("status",e))},t.prototype.getStatus=function(){return this.status},t.prototype.dispose=function(){var e,t,n,o;try{this.detachAllListeners(),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(e=this.playerWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.playerWasm)||void 0===t||t.delete(),null===(n=this.renderTarget)||void 0===n||n.delete(),null===(o=this.wasmModule)||void 0===o||o.dispose(),this.userEventsCollectorWasm=null,this.playerWasm=null,this.wasmModule=null}catch(e){this.fail(new E("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(P),Pe=u;export{Pe as DefaultFeatureFlags,Ce as PrototypesPlayer,O as SketchWeb,E as SketchWebError,C as SketchWebMode,we as SketchWebProvider,ye as SketchWebReact,ne as useCursor,se as useDecrementZoom,Q as useDocument,fe as useEvent,he as useGenerateDocumentPNG,de as useGetArtboardAtPosititon,me as useGetPanAtPosition,ae as useIncrementZoom,re as useIsCameraMoving,oe as useIsCameraZooming,pe as useLockCamera,le as useLooseWebGLContext,te as usePan,ce as useSetPan,ie as useSetZoom,J as useStatus,ee as useZoom,ue as useZoomToFit};
@@ -0,0 +1 @@
1
+ var e,t=(e="undefined"!=typeof document&&document.currentScript?document.currentScript.src:void 0,function(t){var r,n,i=void 0!==(t=t||{})?t:{};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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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(){ue("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="./this.program",s=(e,t)=>{throw t};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 c="";if("undefined"!=typeof document&&document.currentScript&&(c=document.currentScript.src),e&&(c=e),c=0!==c.indexOf("blob:")?c.substr(0,c.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?)");var u,l=i.print||console.log.bind(console),f=i.printErr||console.warn.bind(console);function d(e){d.shown||(d.shown={}),d.shown[e]||(d.shown[e]=1,f(e))}function m(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){ue("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 g(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 p(e,t){Object.getOwnPropertyDescriptor(i,e)||Object.defineProperty(i,e,{configurable:!0,get:function(){ue(g(e,t))}})}function v(e,t){Object.getOwnPropertyDescriptor(i,e)||(i[e]=()=>ue(g(e,t)))}Object.assign(i,a),a=null,u="fetchSettings",Object.getOwnPropertyDescriptor(i,u)&&ue("`Module."+u+"` was supplied but `"+u+"` not included in INCOMING_MODULE_JS_API"),i.arguments&&i.arguments,m("arguments","arguments_"),i.thisProgram&&(o=i.thisProgram),m("thisProgram","thisProgram"),i.quit&&(s=i.quit),m("quit","quit_"),T(void 0===i.memoryInitializerPrefixURL,"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.pthreadMainPrefixURL,"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.cdInitializerPrefixURL,"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.filePackagePrefixURL,"Module.filePackagePrefixURL option was removed, use Module.locateFile instead"),T(void 0===i.read,"Module.read option was removed (modify read_ in JS)"),T(void 0===i.readAsync,"Module.readAsync option was removed (modify readAsync in JS)"),T(void 0===i.readBinary,"Module.readBinary option was removed (modify readBinary in JS)"),T(void 0===i.setWindowTitle,"Module.setWindowTitle option was removed (modify setWindowTitle in JS)"),T(void 0===i.TOTAL_MEMORY,"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY"),m("read","read_"),m("readAsync","readAsync"),m("readBinary","readBinary"),m("setWindowTitle","setWindowTitle"),T(!0,"worker environment detected but not enabled at build time. Add 'worker' to `-sENVIRONMENT` to enable."),T(!0,"node environment detected but not enabled at build time. Add 'node' to `-sENVIRONMENT` to enable."),T(!0,"shell environment detected but not enabled at build time. Add 'shell' to `-sENVIRONMENT` to enable.");var h,y,_=0;i.wasmBinary&&(h=i.wasmBinary),m("wasmBinary","wasmBinary"),i.noExitRuntime,m("noExitRuntime","noExitRuntime"),"object"!=typeof WebAssembly&&ue("no native wasm support detected");var b,w=!1;function T(e,t){e||ue("Assertion failed"+(t?": "+t:""))}var E="undefined"!=typeof TextDecoder?new TextDecoder("utf8"):void 0;function x(e,t,r){for(var n=t+r,i=t;e[i]&&!(i>=n);)++i;if(i-t>16&&e.buffer&&E)return E.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)&&d("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 S(e,t){return e?x(k,e,t):""}function P(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&&d("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 C(e,t,r){return T("number"==typeof r,"stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!"),P(e,k,t,r)}function A(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 I,F,k,O,D,L,M,R,U,B,W,$="undefined"!=typeof TextDecoder?new TextDecoder("utf-16le"):void 0;function N(e,t){T(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)&&D[n];)++n;if((r=n<<1)-e>32&&$)return $.decode(k.subarray(e,r));for(var a="",o=0;!(o>=t/2);++o){var s=O[e+2*o>>1];if(0==s)break;a+=String.fromCharCode(s)}return a}function j(e,t,r){if(T(t%2==0,"Pointer passed to stringToUTF16 must be aligned to two bytes!"),T("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);O[t>>1]=o,t+=2}return O[t>>1]=0,t-n}function G(e){return 2*e.length}function V(e,t){T(e%4==0,"Pointer passed to UTF32ToString must be aligned to four bytes!");for(var r=0,n="";!(r>=t/4);){var i=L[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 H(e,t,r){if(T(t%4==0,"Pointer passed to stringToUTF32 must be aligned to four bytes!"),T("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)),L[t>>2]=o,(t+=4)+4>i)break}return L[t>>2]=0,t-n}function Y(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 z(e){I=e,i.HEAP8=F=new Int8Array(e),i.HEAP16=O=new Int16Array(e),i.HEAP32=L=new Int32Array(e),i.HEAPU8=k=new Uint8Array(e),i.HEAPU16=D=new Uint16Array(e),i.HEAPU32=M=new Uint32Array(e),i.HEAPF32=R=new Float32Array(e),i.HEAPF64=W=new Float64Array(e),i.HEAP64=U=new BigInt64Array(e),i.HEAPU64=B=new BigUint64Array(e)}var J=5242880;i.TOTAL_STACK&&T(J===i.TOTAL_STACK,"the stack size can no longer be determined at runtime");var q,Z=i.INITIAL_MEMORY||134217728;function K(){var e=Pr();T(0==(3&e)),L[e>>2]=34821223,L[e+4>>2]=2310721022,M[0]=1668509029}function Q(){if(!w){var e=Pr(),t=M[e>>2],r=M[e+4>>2];34821223==t&&2310721022==r||ue("Stack overflow! Stack cookie has been overwritten, expected hex dwords 0x89BACDFE and 0x2135467, but received 0x"+r.toString(16)+" 0x"+t.toString(16)),1668509029!==M[0]&&ue("Runtime error: The application has corrupted its heap memory area (address zero)!")}}m("INITIAL_MEMORY","INITIAL_MEMORY"),T(Z>=J,"INITIAL_MEMORY should be larger than TOTAL_STACK, was "+Z+"! (TOTAL_STACK=5242880)"),T("undefined"!=typeof Int32Array&&"undefined"!=typeof Float64Array&&null!=Int32Array.prototype.subarray&&null!=Int32Array.prototype.set,"JS engine does not provide full typed array support"),T(!i.wasmMemory,"Use of `wasmMemory` detected. Use -sIMPORTED_MEMORY to define wasmMemory externally"),T(134217728==Z,"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 X=[],ee=[],te=[],re=!1;T(Math.imul,"This browser does not support Math.imul(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),T(Math.fround,"This browser does not support Math.fround(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),T(Math.clz32,"This browser does not support Math.clz32(), build with LEGACY_VM_SUPPORT or POLYFILL_OLD_MATH_FUNCTIONS to add in a polyfill"),T(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 ne=0,ie=null,ae=null,oe={};function se(e){ne++,i.monitorRunDependencies&&i.monitorRunDependencies(ne),e?(T(!oe[e]),oe[e]=1,null===ie&&"undefined"!=typeof setInterval&&(ie=setInterval((function(){if(w)return clearInterval(ie),void(ie=null);var e=!1;for(var t in oe)e||(e=!0,f("still waiting on run dependencies:")),f("dependency: "+t);e&&f("(end of list)")}),1e4))):f("warning: run dependency added without ID")}function ce(e){if(ne--,i.monitorRunDependencies&&i.monitorRunDependencies(ne),e?(T(oe[e]),delete oe[e]):f("warning: run dependency removed without ID"),0==ne&&(null!==ie&&(clearInterval(ie),ie=null),ae)){var t=ae;ae=null,t()}}function ue(e){i.onAbort&&i.onAbort(e),f(e="Aborted("+e+")"),w=!0,b=1;var t=new WebAssembly.RuntimeError(e);throw n(t),t}var le,fe,de={error:function(){ue("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(){de.error()},createDataFile:function(){de.error()},createPreloadedFile:function(){de.error()},createLazyFile:function(){de.error()},open:function(){de.error()},mkdev:function(){de.error()},registerDevice:function(){de.error()},analyzePath:function(){de.error()},loadFilesFromDB:function(){de.error()},ErrnoError:function(){de.error()}};function me(e){return e.startsWith("data:application/octet-stream;base64,")}function ge(e,t){return function(){var r=e,n=t;return t||(n=i.asm),T(re,"native function `"+r+"` called before runtime initialization"),n[e]||T(n[e],"exported native function `"+r+"` not found"),n[e].apply(null,arguments)}}function pe(e){try{if(e==le&&h)return new Uint8Array(h);throw"both async and sync fetching of the wasm failed"}catch(e){ue(e)}}function ve(e){for(;e.length>0;){var t=e.shift();if("function"!=typeof t){var r=t.func;"number"==typeof r?void 0===t.arg?ye(r)():ye(r)(t.arg):r(void 0===t.arg?null:t.arg)}else t(i)}}i.FS_createDataFile=de.createDataFile,i.FS_createPreloadedFile=de.createPreloadedFile,me(le="module-debug.wasm")||(fe=le,le=i.locateFile?i.locateFile(fe,c):c+fe);var he=[];function ye(e){var t=he[e];return t||(e>=he.length&&(he.length=e+1),he[e]=t=q.get(e)),T(q.get(e)==t,"JavaScript-side Wasm function table mirror is out of date!"),t}var _e={};function be(e){for(;e.length;){var t=e.pop();e.pop()(t)}}function we(e){return this.fromWireType(M[e>>2])}var Te={},Ee={},xe={};function Se(e){if(void 0===e)return"_unknown";var t=(e=e.replace(/[^a-zA-Z0-9_]/g,"$")).charCodeAt(0);return t>=48&&t<=57?"_"+e:e}function Pe(e,t){return e=Se(e),new Function("body","return function "+e+'() {\n "use strict"; return body.apply(this, arguments);\n};\n')(t)}function Ce(e,t){var r=Pe(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 Ae=void 0;function Ie(e){throw new Ae(e)}function Fe(e,t,r){function n(t){var n=r(t);n.length!==e.length&&Ie("Mismatched type converter count");for(var i=0;i<e.length;++i)Re(e[i],n[i])}e.forEach((function(e){xe[e]=t}));var i=new Array(t.length),a=[],o=0;t.forEach(((e,t)=>{Ee.hasOwnProperty(e)?i[t]=Ee[e]:(a.push(e),Te.hasOwnProperty(e)||(Te[e]=[]),Te[e].push((()=>{i[t]=Ee[e],++o===a.length&&n(i)})))})),0===a.length&&n(i)}function ke(e){if(null===e)return"null";var t=typeof e;return"object"===t||"array"===t||"function"===t?e.toString():""+e}var Oe=void 0;function De(e){for(var t="",r=e;k[r];)t+=Oe[k[r++]];return t}var Le=void 0;function Me(e){throw new Le(e)}function Re(e,t,r={}){if(!("argPackAdvance"in t))throw new TypeError("registerType registeredInstance requires argPackAdvance");var n=t.name;if(e||Me('type "'+n+'" must have a positive integer typeid pointer'),Ee.hasOwnProperty(e)){if(r.ignoreDuplicateRegistrations)return;Me("Cannot register type '"+n+"' twice")}if(Ee[e]=t,delete xe[e],Te.hasOwnProperty(e)){var i=Te[e];delete Te[e],i.forEach((e=>e()))}}function Ue(e,t,r){switch(t){case 0:return r?function(e){return F[e]}:function(e){return k[e]};case 1:return r?function(e){return O[e>>1]}:function(e){return D[e>>1]};case 2:return r?function(e){return L[e>>2]}:function(e){return M[e>>2]};case 3:return r?function(e){return U[e>>3]}:function(e){return B[e>>3]};default:throw new TypeError("Unknown integer type: "+e)}}function Be(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 We(e){if(!(this instanceof st))return!1;if(!(e instanceof st))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 $e(e){Me(e.$$.ptrType.registeredClass.name+" instance already deleted")}var Ne=!1;function je(e){}function Ge(e){e.count.value-=1,0===e.count.value&&function(e){e.smartPtr?e.smartPtrType.rawDestructor(e.smartPtr):e.ptrType.registeredClass.rawDestructor(e.ptr)}(e)}function Ve(e,t,r){if(t===r)return e;if(void 0===r.baseClass)return null;var n=Ve(e,t,r.baseClass);return null===n?null:r.downcast(n)}var He={};function Ye(){return Object.keys(Qe).length}function ze(){var e=[];for(var t in Qe)Qe.hasOwnProperty(t)&&e.push(Qe[t]);return e}var Je=[];function qe(){for(;Je.length;){var e=Je.pop();e.$$.deleteScheduled=!1,e.delete()}}var Ze=void 0;function Ke(e){Ze=e,Je.length&&Ze&&Ze(qe)}var Qe={};function Xe(e,t){return t=function(e,t){for(void 0===t&&Me("ptr should not be undefined");e.baseClass;)t=e.upcast(t),e=e.baseClass;return t}(e,t),Qe[t]}function et(e,t){return t.ptrType&&t.ptr||Ie("makeClassHandle requires ptr and ptrType"),!!t.smartPtrType!=!!t.smartPtr&&Ie("Both smartPtrType and smartPtr must be specified"),t.count={value:1},rt(Object.create(e,{$$:{value:t}}))}function tt(e){var t=this.getPointee(e);if(!t)return this.destructor(e),null;var r=Xe(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?et(this.registeredClass.instancePrototype,{ptrType:this.pointeeType,ptr:t,smartPtrType:this,smartPtr:e}):et(this.registeredClass.instancePrototype,{ptrType:this,ptr:e})}var a,o=this.registeredClass.getActualType(t),s=He[o];if(!s)return i.call(this);a=this.isConst?s.constPointerType:s.pointerType;var c=Ve(t,this.registeredClass,a.registeredClass);return null===c?i.call(this):this.isSmartPointer?et(a.registeredClass.instancePrototype,{ptrType:a,ptr:c,smartPtrType:this,smartPtr:e}):et(a.registeredClass.instancePrototype,{ptrType:a,ptr:c})}function rt(e){return"undefined"==typeof FinalizationRegistry?(rt=e=>e,e):(Ne=new FinalizationRegistry((e=>{console.warn(e.leakWarning.stack.replace(/^Error: /,"")),Ge(e.$$)})),rt=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,tt),Ne.register(e,r,e)}return e},je=e=>Ne.unregister(e),rt(e))}function nt(){if(this.$$.ptr||$e(this),this.$$.preservePointerOnDelete)return this.$$.count.value+=1,this;var e,t=rt(Object.create(Object.getPrototypeOf(this),{$$:{value:(e=this.$$,{count:e.count,deleteScheduled:e.deleteScheduled,preservePointerOnDelete:e.preservePointerOnDelete,ptr:e.ptr,ptrType:e.ptrType,smartPtr:e.smartPtr,smartPtrType:e.smartPtrType})}}));return t.$$.count.value+=1,t.$$.deleteScheduled=!1,t}function it(){this.$$.ptr||$e(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Me("Object already scheduled for deletion"),je(this),Ge(this.$$),this.$$.preservePointerOnDelete||(this.$$.smartPtr=void 0,this.$$.ptr=void 0)}function at(){return!this.$$.ptr}function ot(){return this.$$.ptr||$e(this),this.$$.deleteScheduled&&!this.$$.preservePointerOnDelete&&Me("Object already scheduled for deletion"),Je.push(this),1===Je.length&&Ze&&Ze(qe),this.$$.deleteScheduled=!0,this}function st(){}function ct(e,t,r){if(void 0===e[t].overloadTable){var n=e[t];e[t]=function(){return e[t].overloadTable.hasOwnProperty(arguments.length)||Me("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 ut(e,t,r){i.hasOwnProperty(e)?((void 0===r||void 0!==i[e].overloadTable&&void 0!==i[e].overloadTable[r])&&Me("Cannot register public name '"+e+"' twice"),ct(i,e,e),i.hasOwnProperty(r)&&Me("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 lt(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 ft(e,t,r){for(;t!==r;)t.upcast||Me("Expected null or instance of "+r.name+", got an instance of "+t.name),e=t.upcast(e),t=t.baseClass;return e}function dt(e,t){if(null===t)return this.isReference&&Me("null is not a valid "+this.name),0;t.$$||Me('Cannot pass "'+ke(t)+'" as a '+this.name),t.$$.ptr||Me("Cannot pass deleted object as a pointer of type "+this.name);var r=t.$$.ptrType.registeredClass;return ft(t.$$.ptr,r,this.registeredClass)}function mt(e,t){var r;if(null===t)return this.isReference&&Me("null is not a valid "+this.name),this.isSmartPointer?(r=this.rawConstructor(),null!==e&&e.push(this.rawDestructor,r),r):0;t.$$||Me('Cannot pass "'+ke(t)+'" as a '+this.name),t.$$.ptr||Me("Cannot pass deleted object as a pointer of type "+this.name),!this.isConst&&t.$$.ptrType.isConst&&Me("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=ft(t.$$.ptr,n,this.registeredClass),this.isSmartPointer)switch(void 0===t.$$.smartPtr&&Me("Passing raw pointer to smart pointer is illegal"),this.sharingPolicy){case 0:t.$$.smartPtrType===this?r=t.$$.smartPtr:Me("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,kt.toHandle((function(){i.delete()}))),null!==e&&e.push(this.rawDestructor,r)}break;default:Me("Unsupporting sharing policy")}return r}function gt(e,t){if(null===t)return this.isReference&&Me("null is not a valid "+this.name),0;t.$$||Me('Cannot pass "'+ke(t)+'" as a '+this.name),t.$$.ptr||Me("Cannot pass deleted object as a pointer of type "+this.name),t.$$.ptrType.isConst&&Me("Cannot convert argument of type "+t.$$.ptrType.name+" to parameter type "+this.name);var r=t.$$.ptrType.registeredClass;return ft(t.$$.ptr,r,this.registeredClass)}function pt(e){return this.rawGetPointee&&(e=this.rawGetPointee(e)),e}function vt(e){this.rawDestructor&&this.rawDestructor(e)}function ht(e){null!==e&&e.delete()}function yt(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=mt:n?(this.toWireType=dt,this.destructorFunction=null):(this.toWireType=gt,this.destructorFunction=null)}function _t(e,t){e=De(e);var r=ye(t);return"function"!=typeof r&&Me("unknown function pointer with signature "+e+": "+t),r}var bt=void 0;function wt(e){var t=Tr(e),r=De(t);return wr(t),r}function Tt(e,t){var r=[],n={};throw t.forEach((function e(t){n[t]||Ee[t]||(xe[t]?xe[t].forEach(e):(r.push(t),n[t]=!0))})),new bt(e+": "+r.map(wt).join([", "]))}function Et(e,t){if(!(e instanceof Function))throw new TypeError("new_ called with constructor type "+typeof e+" which is not a function");var r=Pe(e.name||"unknownFunctionName",(function(){}));r.prototype=e.prototype;var n=new r,i=e.apply(n,t);return i instanceof Object?i:n}function xt(e,t,r,n,i){var a=t.length;a<2&&Me("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 "+Se(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",g=["throwBindingError","invoker","fn","runDestructors","retType","classParam"],p=[Me,n,i,be,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",g.push("argType"+c),p.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",g.push(v+"_dtor"),p.push(t[c].destructorFunction))}return u&&(d+="var ret = retType.fromWireType(rv);\nreturn ret;\n"),d+="}\n",g.push(d),Et(Function,g).apply(null,p)}function St(e,t){for(var r=[],n=0;n<e;n++)r.push(L[(t>>2)+n]);return r}var Pt=[],Ct=[{},{value:void 0},{value:null},{value:!0},{value:!1}];function At(e){e>4&&0==--Ct[e].refcount&&(Ct[e]=void 0,Pt.push(e))}function It(){for(var e=0,t=5;t<Ct.length;++t)void 0!==Ct[t]&&++e;return e}function Ft(){for(var e=5;e<Ct.length;++e)if(void 0!==Ct[e])return Ct[e];return null}var kt={toValue:e=>(e||Me("Cannot use deleted val. handle = "+e),Ct[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=Pt.length?Pt.pop():Ct.length;return Ct[t]={refcount:1,value:e},t}}};function Ot(e,t,r){switch(t){case 0:return function(e){var t=r?F:k;return this.fromWireType(t[e])};case 1:return function(e){var t=r?O:D;return this.fromWireType(t[e>>1])};case 2:return function(e){var t=r?L:M;return this.fromWireType(t[e>>2])};default:throw new TypeError("Unknown integer type: "+e)}}function Dt(e,t){var r=Ee[e];return void 0===r&&Me(t+" has unknown type "+wt(e)),r}function Lt(e,t){switch(t){case 2:return function(e){return this.fromWireType(R[e>>2])};case 3:return function(e){return this.fromWireType(W[e>>3])};default:throw new TypeError("Unknown float type: "+e)}}function Mt(e,t){for(var r=new Array(e),n=0;n<e;++n)r[n]=Dt(L[(t>>2)+n],"parameter "+n);return r}var Rt={};function Ut(e){var t=Rt[e];return void 0===t?De(e):t}var Bt=[];function Wt(){return"object"==typeof globalThis?globalThis:Function("return this")()}var $t,Nt=[];$t=()=>performance.now();var jt={counter:1,buffers:[],programs:[],framebuffers:[],renderbuffers:[],textures:[],shaders:[],vaos:[],contexts:[],offscreenCanvases:{},queries:[],samplers:[],transformFeedbacks:[],syncs:[],stringCache:{},stringiCache:{},unpackAlignment:4,recordError:function(e){jt.lastError||(jt.lastError=e)},getNewId:function(e){for(var t=jt.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?L[n+4*a>>2]:-1;i+=S(L[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?jt.registerContext(r,t):0},registerContext:function(e,t){var r=jt.getNewId(jt.contexts),n={handle:r,attributes:t,version:t.majorVersion,GLctx:e};return e.canvas&&(e.canvas.GLctxObject=n),jt.contexts[r]=n,(void 0===t.enableExtensionsByDefault||t.enableExtensionsByDefault)&&jt.initExtensions(n),r},makeContextCurrent:function(e){return jt.currentContext=jt.contexts[e],i.ctx=dr=jt.currentContext&&jt.currentContext.GLctx,!(e&&!dr)},getContext:function(e){return jt.contexts[e]},deleteContext:function(e){jt.currentContext===jt.contexts[e]&&(jt.currentContext=null),"object"==typeof JSEvents&&JSEvents.removeAllHandlersOnTarget(jt.contexts[e].GLctx.canvas),jt.contexts[e]&&jt.contexts[e].GLctx.canvas&&(jt.contexts[e].GLctx.canvas.GLctxObject=void 0),jt.contexts[e]=null},initExtensions:function(e){if(e||(e=jt.currentContext),!e.initExtensionsDone){e.initExtensionsDone=!0;var t,r=e.GLctx;!function(e){var t=e.getExtension("ANGLE_instanced_arrays");t&&(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)})}(r),function(e){var t=e.getExtension("OES_vertex_array_object");t&&(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)})}(r),function(e){var t=e.getExtension("WEBGL_draw_buffers");t&&(e.drawBuffers=function(e,r){t.drawBuffersWEBGL(e,r)})}(r),(t=r).dibvbi=t.getExtension("WEBGL_draw_instanced_base_vertex_base_instance"),function(e){e.mdibvbi=e.getExtension("WEBGL_multi_draw_instanced_base_vertex_base_instance")}(r),e.version>=2&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query_webgl2")),(e.version<2||!r.disjointTimerQueryExt)&&(r.disjointTimerQueryExt=r.getExtension("EXT_disjoint_timer_query")),function(e){e.multiDrawWebgl=e.getExtension("WEBGL_multi_draw")}(r),(r.getSupportedExtensions()||[]).forEach((function(e){e.includes("lose_context")||e.includes("debug")||r.getExtension(e)}))}}};function Gt(e,t){return T(t===(0|t)),(e>>>0)+4294967296*t}var Vt=[];function Ht(e,t,r,n){for(var i=0;i<e;i++){var a=dr[r](),o=a&&jt.getNewId(n);a?(a.name=o,n[o]=a):jt.recordError(1282),L[t+4*i>>2]=o}}function Yt(e,t){M[e>>2]=t,M[e+4>>2]=(t-M[e>>2])/4294967296;var r=t>=0?function(e){return M[e>>2]+4294967296*M[e+4>>2]}(e):function(e){return M[e>>2]+4294967296*L[e+4>>2]}(e);r!=t&&d("writeI53ToI64() out of range: serialized JS Number "+t+" to Wasm heap as bytes lo=0x"+M[e>>2].toString(16)+", hi=0x"+M[e+4>>2].toString(16)+", which deserializes back to "+r+" instead!")}function zt(e,t,r){if(t){var n=void 0;switch(e){case 36346:n=1;break;case 36344:return void(0!=r&&1!=r&&jt.recordError(1280));case 34814:case 36345:n=0;break;case 34466:var i=dr.getParameter(34467);n=i?i.length:0;break;case 33309:if(jt.currentContext.version<2)return void jt.recordError(1282);n=2*(dr.getSupportedExtensions()||[]).length;break;case 33307:case 33308:if(jt.currentContext.version<2)return void jt.recordError(1280);n=33307==e?3:0}if(void 0===n){var a=dr.getParameter(e);switch(typeof a){case"number":n=a;break;case"boolean":n=a?1:0;break;case"string":return void jt.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 jt.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:L[t+4*o>>2]=a[o];break;case 2:R[t+4*o>>2]=a[o];break;case 4:F[t+o>>0]=a[o]?1:0}return}try{n=0|a.name}catch(t){return jt.recordError(1280),void f("GL_INVALID_ENUM in glGet"+r+"v: Unknown object returned from WebGL getParameter("+e+")! (error: "+t+")")}}break;default:return jt.recordError(1280),void f("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:Yt(t,n);break;case 0:L[t>>2]=n;break;case 2:R[t>>2]=n;break;case 4:F[t>>0]=n?1:0}}else jt.recordError(1281)}function Jt(e){var t=A(e)+1,r=br(t);return C(e,r,t),r}function qt(e){return"]"==e.slice(-1)&&e.lastIndexOf("[")}function Zt(e){return 0==(e-=5120)?F:1==e?k:2==e?O:4==e?L:6==e?R:5==e||28922==e||28520==e||30779==e||30782==e?M:D}function Kt(e){return 31-Math.clz32(e.BYTES_PER_ELEMENT)}function Qt(e,t,r,n,i,a){var o=Zt(e),s=Kt(o),c=1<<s,u=function(e){return{5:3,6:4,8:2,29502:3,29504:4,26917:2,26918:2,29846:3,29847:4}[e-6402]||1}(t)*c,l=function(e,t,r,n){var i;return t*(e*r+(i=n)-1&-i)}(r,n,u,jt.unpackAlignment);return o.subarray(i>>s,i+l>>s)}function Xt(e){var t=dr.currentProgram;if(t){var r=t.uniformLocsById[e];return"number"==typeof r&&(t.uniformLocsById[e]=r=dr.getUniformLocation(t,t.uniformArrayNamesById[e]+(r>0?"["+r+"]":""))),r}jt.recordError(1282)}var er=[],tr=[];function rr(e){try{return y.grow(e-I.byteLength+65535>>>16),z(y.buffer),1}catch(t){f("emscripten_realloc_buffer: Attempted to grow heap from "+I.byteLength+" bytes to "+e+" bytes, but got error: "+t)}}var nr={xhrs:[],setu64:function(e,t){M[e>>2]=t,M[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(){nr.openDatabase("emscripten_filesystem",1,(e=>{nr.dbInstance=e,ce("library_fetch_init")}),(()=>{nr.dbInstance=!1,ce("library_fetch_init")})),"undefined"!=typeof ENVIRONMENT_IS_FETCH_WORKER&&ENVIRONMENT_IS_FETCH_WORKER||se("library_fetch_init")}};function ir(e,t,r,n,i){var a=M[e+8>>2];if(a){var o=S(a),s=e+112,c=S(s);c||(c="GET"),M[e+4>>2];var u=M[s+52>>2],l=M[s+56>>2],f=!!M[s+60>>2];M[s+64>>2];var d=M[s+68>>2],m=M[s+72>>2],g=M[s+76>>2],p=M[s+80>>2],v=M[s+84>>2],h=M[s+88>>2],y=!!(1&u),_=!!(2&u),b=!!(64&u),w=d?S(d):void 0,E=m?S(m):void 0,x=new XMLHttpRequest;if(x.withCredentials=f,x.open(c,o,!b,w,E),b||(x.timeout=l),x.url_=o,T(!_,"streaming uses moz-chunked-arraybuffer which is no longer supported; TODO: rewrite using fetch()"),x.responseType="arraybuffer",p){var P=S(p);x.overrideMimeType(P)}if(g)for(;;){var A=M[g>>2];if(!A)break;var I=M[g+4>>2];if(!I)break;g+=8;var F=S(A),O=S(I);x.setRequestHeader(F,O)}nr.xhrs.push(x);var L=nr.xhrs.length;M[e+0>>2]=L;var R=v&&h?k.slice(v,v+h):null;x.onload=n=>{U(y&&!_);var i=x.response?x.response.byteLength:0;nr.setu64(e+24,0),i&&nr.setu64(e+32,i),D[e+40>>1]=x.readyState,D[e+42>>1]=x.status,x.statusText&&C(x.statusText,e+44,64),x.status>=200&&x.status<300?t&&t(e,x,n):r&&r(e,x,n)},x.onerror=t=>{U(y);var n=x.status;nr.setu64(e+24,0),nr.setu64(e+32,x.response?x.response.byteLength:0),D[e+40>>1]=x.readyState,D[e+42>>1]=n,r&&r(e,x,t)},x.ontimeout=t=>{r&&r(e,x,t)},x.onprogress=t=>{var r=y&&_&&x.response?x.response.byteLength:0,i=0;y&&_&&(T(n,"When doing a streaming fetch, you should have an onprogress handler registered to receive the chunks!"),i=br(r),k.set(new Uint8Array(x.response),i)),M[e+12>>2]=i,nr.setu64(e+16,r),nr.setu64(e+24,t.loaded-r),nr.setu64(e+32,t.total),D[e+40>>1]=x.readyState,x.readyState>=3&&0===x.status&&t.loaded>0&&(x.status=200),D[e+42>>1]=x.status,x.statusText&&C(x.statusText,e+44,64),n&&n(e,x,t),i&&wr(i)},x.onreadystatechange=t=>{D[e+40>>1]=x.readyState,x.readyState>=2&&(D[e+42>>1]=x.status),i&&i(e,x,t)};try{x.send(R)}catch(t){r&&r(e,x,t)}}else r(e,0,"no url specified!");function U(t){var r=0,n=0;t&&(n=x.response?x.response.byteLength:0,r=br(n),k.set(new Uint8Array(x.response),r)),M[e+12>>2]=r,nr.setu64(e+16,n)}}function ar(e,t){if(w)f("user callback triggered after runtime exited or application aborted. Ignoring.");else if(t)e();else try{e()}catch(e){!function(e){if(e instanceof Ir||"unwind"==e)return b;s(1,e)}(e)}}function or(e,t,r,n,i){if(e){var a=M[t+112+64>>2];a||(a=M[t+8>>2]);var o=S(a);try{var s=e.transaction(["FILES"],"readwrite").objectStore("FILES").put(r,o);s.onsuccess=e=>{D[t+40>>1]=4,D[t+42>>1]=200,C("OK",t+44,64),n(t,0,o)},s.onerror=e=>{D[t+40>>1]=4,D[t+42>>1]=413,C("Payload Too Large",t+44,64),i(t,0,e)}}catch(e){i(t,0,e)}}else i(t,0,"IndexedDB not available!")}var sr={};function cr(){if(!cr.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",_:o||"./this.program"};for(var t in sr)void 0===sr[t]?delete e[t]:e[t]=sr[t];var r=[];for(var t in e)r.push(t+"="+e[t]);cr.strings=r}return cr.strings}var ur=[null,[],[]];function lr(e,t){var r=ur[e];T(r),0===t||10===t?((1===e?l:f)(x(r,0)),r.length=0):r.push(t)}function fr(e){return e%4==0&&(e%100!=0||e%400==0)}var dr,mr=[31,29,31,30,31,30,31,31,30,31,30,31],gr=[31,28,31,30,31,30,31,31,30,31,30,31];function pr(e,t,r,n){var i=L[n+40>>2],a={tm_sec:L[n>>2],tm_min:L[n+4>>2],tm_hour:L[n+8>>2],tm_mday:L[n+12>>2],tm_mon:L[n+16>>2],tm_year:L[n+20>>2],tm_wday:L[n+24>>2],tm_yday:L[n+28>>2],tm_isdst:L[n+32>>2],tm_gmtoff:L[n+36>>2],tm_zone:i?S(i):""},o=S(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 g(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 p(e){var t=function(e,t){for(var r=new Date(e.getTime());t>0;){var n=fr(r.getFullYear()),i=r.getMonth(),a=(n?mr:gr)[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}(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=g(r),a=g(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 p(e).toString().substring(2)},"%G":function(e){return p(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+function(e,t){for(var r=0,n=0;n<=t;r+=e[n++]);return r}(fr(e.tm_year+1900)?mr:gr,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&&fr(e.tm_year)||(t=1)}}else{t=52;var n=(e.tm_wday+7-e.tm_yday-1)%7;(4==n||5==n&&fr(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,y,_,b,w,E,x=(h=o=o.replace(/\0\0/g,"%"),y=!1,b=_>0?_:A(h)+1,w=new Array(b),E=P(h,w,0,w.length),y&&(w.length=E),w);return x.length>t?0:(function(e,t){T(e.length>=0,"writeArrayToMemory array must have a length (should be an array or typed array)"),F.set(e,t)}(x,e),x.length-1)}Ae=i.InternalError=Ce(Error,"InternalError"),function(){for(var e=new Array(256),t=0;t<256;++t)e[t]=String.fromCharCode(t);Oe=e}(),Le=i.BindingError=Ce(Error,"BindingError"),st.prototype.isAliasOf=We,st.prototype.clone=nt,st.prototype.delete=it,st.prototype.isDeleted=at,st.prototype.deleteLater=ot,i.getInheritedInstanceCount=Ye,i.getLiveInheritedInstances=ze,i.flushPendingDeletes=qe,i.setDelayFunction=Ke,yt.prototype.getPointee=pt,yt.prototype.destructor=vt,yt.prototype.argPackAdvance=8,yt.prototype.readValueFromPointer=we,yt.prototype.deleteObject=ht,yt.prototype.fromWireType=tt,bt=i.UnboundTypeError=Ce(Error,"UnboundTypeError"),i.count_emval_handles=It,i.get_first_emval=Ft;for(var vr=0;vr<32;++vr)Vt.push(new Array(vr));var hr=new Float32Array(288);for(vr=0;vr<288;++vr)er[vr]=hr.subarray(0,vr+1);var yr=new Int32Array(288);for(vr=0;vr<288;++vr)tr[vr]=yr.subarray(0,vr+1);nr.staticInit();var _r={__assert_fail:function(e,t,r,n){ue("Assertion failed: "+S(e)+", at: "+[t?S(t):"unknown filename",r,n?S(n):"unknown function"])},_embind_finalize_value_object:function(e){var t=_e[e];delete _e[e];var r=t.rawConstructor,n=t.rawDestructor,i=t.fields;Fe([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)),be(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:we,destructorFunction:n}]}))},_embind_register_bigint:function(e,t,r,n,i){t=De(t);var a=Be(r),o=-1!=t.indexOf("u");o&&(i=(BigInt(1)<<BigInt(64))-BigInt(1)),Re(e,{name:t,fromWireType:function(e){return e},toWireType:function(e,r){if("bigint"!=typeof r)throw new TypeError('Cannot convert "'+ke(r)+'" to '+this.name);if(r<n||r>i)throw new TypeError('Passing a number "'+ke(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:Ue(t,a,!o),destructorFunction:null})},_embind_register_bool:function(e,t,r,n,i){var a=Be(r);Re(e,{name:t=De(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=F;else if(2===r)n=O;else{if(4!==r)throw new TypeError("Unknown boolean type size: "+t);n=L}return this.fromWireType(n[e>>a])},destructorFunction:null})},_embind_register_class:function(e,t,r,n,a,o,s,c,u,l,f,d,m){f=De(f),o=_t(a,o),c&&(c=_t(s,c)),l&&(l=_t(u,l)),m=_t(d,m);var g=Se(f);ut(g,(function(){Tt("Cannot construct "+f+" due to unbound types",[n])})),Fe([e,t,r],n?[n]:[],(function(t){var r,a;t=t[0],a=n?(r=t.registeredClass).instancePrototype:st.prototype;var s=Pe(g,(function(){if(Object.getPrototypeOf(this)!==u)throw new Le("Use 'new' to construct "+f);if(void 0===d.constructor_body)throw new Le(f+" has no accessible constructor");var e=d.constructor_body[arguments.length];if(void 0===e)throw new Le("Tried to invoke ctor of "+f+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(d.constructor_body).toString()+") parameters instead!");return e.apply(this,arguments)})),u=Object.create(a,{constructor:{value:s}});s.prototype=u;var d=new lt(f,s,u,m,r,o,c,l),p=new yt(f,d,!0,!1,!1),v=new yt(f+"*",d,!1,!1,!1),h=new yt(f+" const*",d,!1,!0,!1);return He[e]={pointerType:v,constPointerType:h},function(e,t,r){i.hasOwnProperty(e)||Ie("Replacing nonexistant public symbol"),void 0!==i[e].overloadTable&&void 0!==r?i[e].overloadTable[r]=t:(i[e]=t,i[e].argCount=r)}(g,s),[p,v,h]}))},_embind_register_class_class_function:function(e,t,r,n,i,a,o){var s=St(r,n);t=De(t),a=_t(i,a),Fe([],[e],(function(e){var n=(e=e[0]).name+"."+t;function i(){Tt("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):(ct(c,t,n),c[t].overloadTable[r-1]=i),Fe([],s,(function(e){var i=[e[0],null].concat(e.slice(1)),s=xt(n,i,null,a,o);return void 0===c[t].overloadTable?(s.argCount=r-1,c[t]=s):c[t].overloadTable[r-1]=s,[]})),[]}))},_embind_register_class_constructor:function(e,t,r,n,i,a){T(t>0);var o=St(t,r);i=_t(n,i),Fe([],[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 Le("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]=()=>{Tt("Cannot construct "+e.name+" due to unbound types",o)},Fe([],o,(function(n){return n.splice(1,0,null),e.registeredClass.constructor_body[t-1]=xt(r,n,null,i,a),[]})),[]}))},_embind_register_class_function:function(e,t,r,n,i,a,o,s){var c=St(r,n);t=De(t),a=_t(i,a),Fe([],[e],(function(e){var n=(e=e[0]).name+"."+t;function i(){Tt("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):(ct(u,t,n),u[t].overloadTable[r-2]=i),Fe([],c,(function(i){var s=xt(n,i,e,a,o);return void 0===u[t].overloadTable?(s.argCount=r-2,u[t]=s):u[t].overloadTable[r-2]=s,[]})),[]}))},_embind_register_emval:function(e,t){Re(e,{name:t=De(t),fromWireType:function(e){var t=kt.toValue(e);return At(e),t},toWireType:function(e,t){return kt.toHandle(t)},argPackAdvance:8,readValueFromPointer:we,destructorFunction:null})},_embind_register_enum:function(e,t,r,n){var i=Be(r);function a(){}t=De(t),a.values={},Re(e,{name:t,constructor:a,fromWireType:function(e){return this.constructor.values[e]},toWireType:function(e,t){return t.value},argPackAdvance:8,readValueFromPointer:Ot(t,i,n),destructorFunction:null}),ut(t,a)},_embind_register_enum_value:function(e,t,r){var n=Dt(e,"enum");t=De(t);var i=n.constructor,a=Object.create(n.constructor.prototype,{value:{value:r},constructor:{value:Pe(n.name+"_"+t,(function(){}))}});i.values[r]=a,i[t]=a},_embind_register_float:function(e,t,r){var n=Be(r);Re(e,{name:t=De(t),fromWireType:function(e){return e},toWireType:function(e,t){if("number"!=typeof t&&"boolean"!=typeof t)throw new TypeError('Cannot convert "'+ke(t)+'" to '+this.name);return t},argPackAdvance:8,readValueFromPointer:Lt(t,n),destructorFunction:null})},_embind_register_integer:function(e,t,r,n,i){t=De(t),-1===i&&(i=4294967295);var a=Be(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 "'+ke(e)+'" to '+r);if(e<n||e>i)throw new TypeError('Passing a number "'+ke(e)+'" from JS side to C/C++ side to an argument of type "'+t+'", which is outside the valid range ['+n+", "+i+"]!")};Re(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:Ue(t,a,0!==n),destructorFunction:null})},_embind_register_memory_view:function(e,t,r){var n=[Int8Array,Uint8Array,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array,BigInt64Array,BigUint64Array][t];function i(e){var t=M,r=t[e>>=2],i=t[e+1];return new n(I,i,r)}Re(e,{name:r=De(r),fromWireType:i,argPackAdvance:8,readValueFromPointer:i},{ignoreDuplicateRegistrations:!0})},_embind_register_std_string:function(e,t){var r="std::string"===(t=De(t));Re(e,{name:t,fromWireType:function(e){var t,n=M[e>>2];if(r)for(var i=e+4,a=0;a<=n;++a){var o=e+4+a;if(a==n||0==k[o]){var s=S(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(k[e+4+a]);t=c.join("")}return wr(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||Me("Cannot pass non-string to std::string");var i=(r&&n?()=>A(t):()=>t.length)(),a=br(4+i+1);if(M[a>>2]=i,r&&n)C(t,a+4,i+1);else if(n)for(var o=0;o<i;++o){var s=t.charCodeAt(o);s>255&&(wr(a),Me("String has UTF-16 code units that do not fit in 8 bits")),k[a+4+o]=s}else for(o=0;o<i;++o)k[a+4+o]=t[o];return null!==e&&e.push(wr,a),a},argPackAdvance:8,readValueFromPointer:we,destructorFunction:function(e){wr(e)}})},_embind_register_std_wstring:function(e,t,r){var n,i,a,o,s;r=De(r),2===t?(n=N,i=j,o=G,a=()=>D,s=1):4===t&&(n=V,i=H,o=Y,a=()=>M,s=2),Re(e,{name:r,fromWireType:function(e){for(var r,i=M[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 wr(e),r},toWireType:function(e,n){"string"!=typeof n&&Me("Cannot pass non-string to C++ string type "+r);var a=o(n),c=br(4+a+t);return M[c>>2]=a>>s,i(n,c+4,a+t),null!==e&&e.push(wr,c),c},argPackAdvance:8,readValueFromPointer:we,destructorFunction:function(e){wr(e)}})},_embind_register_value_object:function(e,t,r,n,i,a){_e[e]={name:De(t),rawConstructor:_t(r,n),rawDestructor:_t(i,a),fields:[]}},_embind_register_value_object_field:function(e,t,r,n,i,a,o,s,c,u){_e[e].fields.push({fieldName:De(t),getterReturnType:r,getter:_t(n,i),getterContext:a,setterArgumentType:o,setter:_t(s,c),setterContext:u})},_embind_register_void:function(e,t){Re(e,{isVoid:!0,name:t=De(t),argPackAdvance:0,fromWireType:function(){},toWireType:function(e,t){}})},_emscripten_date_now:function(){return Date.now()},_emscripten_fetch_free:function(e){delete nr.xhrs[e-1]},_emscripten_get_now_is_monotonic:function(){return!0},_emscripten_throw_longjmp:function(){throw 1/0},_emval_as:function(e,t,r){e=kt.toValue(e),t=Dt(t,"emval::as");var n=[],i=kt.toHandle(n);return L[r>>2]=i,t.toWireType(n,e)},_emval_call:function(e,t,r,n){e=kt.toValue(e);for(var i=Mt(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 kt.toHandle(c)},_emval_call_method:function(e,t,r,n,i){return(e=Bt[e])(t=kt.toValue(t),r=Ut(r),function(e){var t=[];return L[e>>2]=kt.toHandle(t),t}(n),i)},_emval_call_void_method:function(e,t,r,n){(e=Bt[e])(t=kt.toValue(t),r=Ut(r),null,n)},_emval_decref:At,_emval_get_global:function(e){return 0===e?kt.toHandle(Wt()):(e=Ut(e),kt.toHandle(Wt()[e]))},_emval_get_method_caller:function(e,t){var r=Mt(e,t),n=r[0],i=n.name+"_$"+r.slice(1).map((function(e){return e.name})).join("_")+"$",a=Nt[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 "+Se("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");n.isVoid||(l+=" return retType.toWireType(destructors, rv);\n"),l+="};\n",o.push(l);var d,m,g=Et(Function,o).apply(null,s);return d=g,m=Bt.length,Bt.push(d),a=m,Nt[i]=a,a},_emval_get_module_property:function(e){return e=Ut(e),kt.toHandle(i[e])},_emval_get_property:function(e,t){return e=kt.toValue(e),t=kt.toValue(t),kt.toHandle(e[t])},_emval_incref:function(e){e>4&&(Ct[e].refcount+=1)},_emval_new_array:function(){return kt.toHandle([])},_emval_new_cstring:function(e){return kt.toHandle(Ut(e))},_emval_run_destructors:function(e){be(kt.toValue(e)),At(e)},_emval_take_value:function(e,t){var r=(e=Dt(e,"_emval_take_value")).readValueFromPointer(t);return kt.toHandle(r)},abort:function(){ue("native code called abort()")},emscripten_cancel_animation_frame:function(e){cancelAnimationFrame(e)},emscripten_get_now:$t,emscripten_glActiveTexture:function(e){dr.activeTexture(e)},emscripten_glAttachShader:function(e,t){dr.attachShader(jt.programs[e],jt.shaders[t])},emscripten_glBindAttribLocation:function(e,t,r){dr.bindAttribLocation(jt.programs[e],t,S(r))},emscripten_glBindBuffer:function(e,t){35051==e?dr.currentPixelPackBufferBinding=t:35052==e&&(dr.currentPixelUnpackBufferBinding=t),dr.bindBuffer(e,jt.buffers[t])},emscripten_glBindFramebuffer:function(e,t){dr.bindFramebuffer(e,jt.framebuffers[t])},emscripten_glBindRenderbuffer:function(e,t){dr.bindRenderbuffer(e,jt.renderbuffers[t])},emscripten_glBindSampler:function(e,t){dr.bindSampler(e,jt.samplers[t])},emscripten_glBindTexture:function(e,t){dr.bindTexture(e,jt.textures[t])},emscripten_glBindVertexArray:function(e){dr.bindVertexArray(jt.vaos[e])},emscripten_glBindVertexArrayOES:function(e){dr.bindVertexArray(jt.vaos[e])},emscripten_glBlendColor:function(e,t,r,n){dr.blendColor(e,t,r,n)},emscripten_glBlendEquation:function(e){dr.blendEquation(e)},emscripten_glBlendFunc:function(e,t){dr.blendFunc(e,t)},emscripten_glBlitFramebuffer:function(e,t,r,n,i,a,o,s,c,u){dr.blitFramebuffer(e,t,r,n,i,a,o,s,c,u)},emscripten_glBufferData:function(e,t,r,n){jt.currentContext.version>=2?r&&t?dr.bufferData(e,k,n,r,t):dr.bufferData(e,t,n):dr.bufferData(e,r?k.subarray(r,r+t):t,n)},emscripten_glBufferSubData:function(e,t,r,n){jt.currentContext.version>=2?r&&dr.bufferSubData(e,t,k,n,r):dr.bufferSubData(e,t,k.subarray(n,n+r))},emscripten_glCheckFramebufferStatus:function(e){return dr.checkFramebufferStatus(e)},emscripten_glClear:function(e){dr.clear(e)},emscripten_glClearColor:function(e,t,r,n){dr.clearColor(e,t,r,n)},emscripten_glClearStencil:function(e){dr.clearStencil(e)},emscripten_glClientWaitSync:function(e,t,r,n){return dr.clientWaitSync(jt.syncs[e],t,Gt(r,n))},emscripten_glColorMask:function(e,t,r,n){dr.colorMask(!!e,!!t,!!r,!!n)},emscripten_glCompileShader:function(e){dr.compileShader(jt.shaders[e])},emscripten_glCompressedTexImage2D:function(e,t,r,n,i,a,o,s){jt.currentContext.version>=2?dr.currentPixelUnpackBufferBinding||!o?dr.compressedTexImage2D(e,t,r,n,i,a,o,s):dr.compressedTexImage2D(e,t,r,n,i,a,k,s,o):dr.compressedTexImage2D(e,t,r,n,i,a,s?k.subarray(s,s+o):null)},emscripten_glCompressedTexSubImage2D:function(e,t,r,n,i,a,o,s,c){jt.currentContext.version>=2?dr.currentPixelUnpackBufferBinding||!s?dr.compressedTexSubImage2D(e,t,r,n,i,a,o,s,c):dr.compressedTexSubImage2D(e,t,r,n,i,a,o,k,c,s):dr.compressedTexSubImage2D(e,t,r,n,i,a,o,c?k.subarray(c,c+s):null)},emscripten_glCopyTexSubImage2D:function(e,t,r,n,i,a,o,s){dr.copyTexSubImage2D(e,t,r,n,i,a,o,s)},emscripten_glCreateProgram:function(){var e=jt.getNewId(jt.programs),t=dr.createProgram();return t.name=e,t.maxUniformLength=t.maxAttributeLength=t.maxUniformBlockNameLength=0,t.uniformIdCounter=1,jt.programs[e]=t,e},emscripten_glCreateShader:function(e){var t=jt.getNewId(jt.shaders);return jt.shaders[t]=dr.createShader(e),t},emscripten_glCullFace:function(e){dr.cullFace(e)},emscripten_glDeleteBuffers:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=jt.buffers[n];i&&(dr.deleteBuffer(i),i.name=0,jt.buffers[n]=null,n==dr.currentPixelPackBufferBinding&&(dr.currentPixelPackBufferBinding=0),n==dr.currentPixelUnpackBufferBinding&&(dr.currentPixelUnpackBufferBinding=0))}},emscripten_glDeleteFramebuffers:function(e,t){for(var r=0;r<e;++r){var n=L[t+4*r>>2],i=jt.framebuffers[n];i&&(dr.deleteFramebuffer(i),i.name=0,jt.framebuffers[n]=null)}},emscripten_glDeleteProgram:function(e){if(e){var t=jt.programs[e];t?(dr.deleteProgram(t),t.name=0,jt.programs[e]=null):jt.recordError(1281)}},emscripten_glDeleteRenderbuffers:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=jt.renderbuffers[n];i&&(dr.deleteRenderbuffer(i),i.name=0,jt.renderbuffers[n]=null)}},emscripten_glDeleteSamplers:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=jt.samplers[n];i&&(dr.deleteSampler(i),i.name=0,jt.samplers[n]=null)}},emscripten_glDeleteShader:function(e){if(e){var t=jt.shaders[e];t?(dr.deleteShader(t),jt.shaders[e]=null):jt.recordError(1281)}},emscripten_glDeleteSync:function(e){if(e){var t=jt.syncs[e];t?(dr.deleteSync(t),t.name=0,jt.syncs[e]=null):jt.recordError(1281)}},emscripten_glDeleteTextures:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2],i=jt.textures[n];i&&(dr.deleteTexture(i),i.name=0,jt.textures[n]=null)}},emscripten_glDeleteVertexArrays:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2];dr.deleteVertexArray(jt.vaos[n]),jt.vaos[n]=null}},emscripten_glDeleteVertexArraysOES:function(e,t){for(var r=0;r<e;r++){var n=L[t+4*r>>2];dr.deleteVertexArray(jt.vaos[n]),jt.vaos[n]=null}},emscripten_glDepthMask:function(e){dr.depthMask(!!e)},emscripten_glDisable:function(e){dr.disable(e)},emscripten_glDisableVertexAttribArray:function(e){dr.disableVertexAttribArray(e)},emscripten_glDrawArrays:function(e,t,r){dr.drawArrays(e,t,r)},emscripten_glDrawArraysInstanced:function(e,t,r,n){dr.drawArraysInstanced(e,t,r,n)},emscripten_glDrawArraysInstancedBaseInstanceWEBGL:function(e,t,r,n,i){dr.dibvbi.drawArraysInstancedBaseInstanceWEBGL(e,t,r,n,i)},emscripten_glDrawBuffers:function(e,t){for(var r=Vt[e],n=0;n<e;n++)r[n]=L[t+4*n>>2];dr.drawBuffers(r)},emscripten_glDrawElements:function(e,t,r,n){dr.drawElements(e,t,r,n)},emscripten_glDrawElementsInstanced:function(e,t,r,n,i){dr.drawElementsInstanced(e,t,r,n,i)},emscripten_glDrawElementsInstancedBaseVertexBaseInstanceWEBGL:function(e,t,r,n,i,a,o){dr.dibvbi.drawElementsInstancedBaseVertexBaseInstanceWEBGL(e,t,r,n,i,a,o)},emscripten_glDrawRangeElements:function(e,t,r,n,i,a){!function(e,t,r,n){dr.drawElements(e,t,r,n)}(e,n,i,a)},emscripten_glEnable:function(e){dr.enable(e)},emscripten_glEnableVertexAttribArray:function(e){dr.enableVertexAttribArray(e)},emscripten_glFenceSync:function(e,t){var r=dr.fenceSync(e,t);if(r){var n=jt.getNewId(jt.syncs);return r.name=n,jt.syncs[n]=r,n}return 0},emscripten_glFinish:function(){dr.finish()},emscripten_glFlush:function(){dr.flush()},emscripten_glFramebufferRenderbuffer:function(e,t,r,n){dr.framebufferRenderbuffer(e,t,r,jt.renderbuffers[n])},emscripten_glFramebufferTexture2D:function(e,t,r,n,i){dr.framebufferTexture2D(e,t,r,jt.textures[n],i)},emscripten_glFrontFace:function(e){dr.frontFace(e)},emscripten_glGenBuffers:function(e,t){Ht(e,t,"createBuffer",jt.buffers)},emscripten_glGenFramebuffers:function(e,t){Ht(e,t,"createFramebuffer",jt.framebuffers)},emscripten_glGenRenderbuffers:function(e,t){Ht(e,t,"createRenderbuffer",jt.renderbuffers)},emscripten_glGenSamplers:function(e,t){Ht(e,t,"createSampler",jt.samplers)},emscripten_glGenTextures:function(e,t){Ht(e,t,"createTexture",jt.textures)},emscripten_glGenVertexArrays:function(e,t){Ht(e,t,"createVertexArray",jt.vaos)},emscripten_glGenVertexArraysOES:function(e,t){Ht(e,t,"createVertexArray",jt.vaos)},emscripten_glGenerateMipmap:function(e){dr.generateMipmap(e)},emscripten_glGetBufferParameteriv:function(e,t,r){r?L[r>>2]=dr.getBufferParameter(e,t):jt.recordError(1281)},emscripten_glGetError:function(){var e=dr.getError()||jt.lastError;return jt.lastError=0,e},emscripten_glGetFloatv:function(e,t){zt(e,t,2)},emscripten_glGetFramebufferAttachmentParameteriv:function(e,t,r,n){var i=dr.getFramebufferAttachmentParameter(e,t,r);(i instanceof WebGLRenderbuffer||i instanceof WebGLTexture)&&(i=0|i.name),L[n>>2]=i},emscripten_glGetIntegerv:function(e,t){zt(e,t,0)},emscripten_glGetProgramInfoLog:function(e,t,r,n){var i=dr.getProgramInfoLog(jt.programs[e]);null===i&&(i="(unknown error)");var a=t>0&&n?C(i,n,t):0;r&&(L[r>>2]=a)},emscripten_glGetProgramiv:function(e,t,r){if(r)if(e>=jt.counter)jt.recordError(1281);else if(e=jt.programs[e],35716==t){var n=dr.getProgramInfoLog(e);null===n&&(n="(unknown error)"),L[r>>2]=n.length+1}else if(35719==t){if(!e.maxUniformLength)for(var i=0;i<dr.getProgramParameter(e,35718);++i)e.maxUniformLength=Math.max(e.maxUniformLength,dr.getActiveUniform(e,i).name.length+1);L[r>>2]=e.maxUniformLength}else if(35722==t){if(!e.maxAttributeLength)for(i=0;i<dr.getProgramParameter(e,35721);++i)e.maxAttributeLength=Math.max(e.maxAttributeLength,dr.getActiveAttrib(e,i).name.length+1);L[r>>2]=e.maxAttributeLength}else if(35381==t){if(!e.maxUniformBlockNameLength)for(i=0;i<dr.getProgramParameter(e,35382);++i)e.maxUniformBlockNameLength=Math.max(e.maxUniformBlockNameLength,dr.getActiveUniformBlockName(e,i).length+1);L[r>>2]=e.maxUniformBlockNameLength}else L[r>>2]=dr.getProgramParameter(e,t);else jt.recordError(1281)},emscripten_glGetRenderbufferParameteriv:function(e,t,r){r?L[r>>2]=dr.getRenderbufferParameter(e,t):jt.recordError(1281)},emscripten_glGetShaderInfoLog:function(e,t,r,n){var i=dr.getShaderInfoLog(jt.shaders[e]);null===i&&(i="(unknown error)");var a=t>0&&n?C(i,n,t):0;r&&(L[r>>2]=a)},emscripten_glGetShaderPrecisionFormat:function(e,t,r,n){var i=dr.getShaderPrecisionFormat(e,t);L[r>>2]=i.rangeMin,L[r+4>>2]=i.rangeMax,L[n>>2]=i.precision},emscripten_glGetShaderiv:function(e,t,r){if(r)if(35716==t){var n=dr.getShaderInfoLog(jt.shaders[e]);null===n&&(n="(unknown error)");var i=n?n.length+1:0;L[r>>2]=i}else if(35720==t){var a=dr.getShaderSource(jt.shaders[e]),o=a?a.length+1:0;L[r>>2]=o}else L[r>>2]=dr.getShaderParameter(jt.shaders[e],t);else jt.recordError(1281)},emscripten_glGetString:function(e){var t=jt.stringCache[e];if(!t){switch(e){case 7939:var r=dr.getSupportedExtensions()||[];t=Jt((r=r.concat(r.map((function(e){return"GL_"+e})))).join(" "));break;case 7936:case 7937:case 37445:case 37446:var n=dr.getParameter(e);n||jt.recordError(1280),t=n&&Jt(n);break;case 7938:var i=dr.getParameter(7938);t=Jt(i=jt.currentContext.version>=2?"OpenGL ES 3.0 ("+i+")":"OpenGL ES 2.0 ("+i+")");break;case 35724:var a=dr.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=Jt(a);break;default:jt.recordError(1280)}jt.stringCache[e]=t}return t},emscripten_glGetStringi:function(e,t){if(jt.currentContext.version<2)return jt.recordError(1282),0;var r=jt.stringiCache[e];if(r)return t<0||t>=r.length?(jt.recordError(1281),0):r[t];if(7939===e){var n=dr.getSupportedExtensions()||[];return n=(n=n.concat(n.map((function(e){return"GL_"+e})))).map((function(e){return Jt(e)})),r=jt.stringiCache[e]=n,t<0||t>=r.length?(jt.recordError(1281),0):r[t]}return jt.recordError(1280),0},emscripten_glGetUniformLocation:function(e,t){if(t=S(t),e=jt.programs[e]){!function(e){var t,r,n=e.uniformLocsById,i=e.uniformSizeAndIdsByName;if(!n)for(e.uniformLocsById=n={},e.uniformArrayNamesById={},t=0;t<dr.getProgramParameter(e,35718);++t){var a=dr.getActiveUniform(e,t),o=a.name,s=a.size,c=qt(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}}(e);var r=e.uniformLocsById,n=0,i=t,a=qt(t);a>0&&(s=t.slice(a+1),n=parseInt(s)>>>0,i=t.slice(0,a));var o=e.uniformSizeAndIdsByName[i];if(o&&n<o[0]&&(r[n+=o[1]]=r[n]||dr.getUniformLocation(e,t)))return n}else jt.recordError(1281);var s;return-1},emscripten_glInvalidateFramebuffer:function(e,t,r){for(var n=Vt[t],i=0;i<t;i++)n[i]=L[r+4*i>>2];dr.invalidateFramebuffer(e,n)},emscripten_glInvalidateSubFramebuffer:function(e,t,r,n,i,a,o){for(var s=Vt[t],c=0;c<t;c++)s[c]=L[r+4*c>>2];dr.invalidateSubFramebuffer(e,s,n,i,a,o)},emscripten_glIsSync:function(e){return dr.isSync(jt.syncs[e])},emscripten_glIsTexture:function(e){var t=jt.textures[e];return t?dr.isTexture(t):0},emscripten_glLineWidth:function(e){dr.lineWidth(e)},emscripten_glLinkProgram:function(e){e=jt.programs[e],dr.linkProgram(e),e.uniformLocsById=0,e.uniformSizeAndIdsByName={}},emscripten_glMultiDrawArraysInstancedBaseInstanceWEBGL:function(e,t,r,n,i,a){dr.mdibvbi.multiDrawArraysInstancedBaseInstanceWEBGL(e,L,t>>2,L,r>>2,L,n>>2,M,i>>2,a)},emscripten_glMultiDrawElementsInstancedBaseVertexBaseInstanceWEBGL:function(e,t,r,n,i,a,o,s){dr.mdibvbi.multiDrawElementsInstancedBaseVertexBaseInstanceWEBGL(e,L,t>>2,r,L,n>>2,L,i>>2,L,a>>2,M,o>>2,s)},emscripten_glPixelStorei:function(e,t){3317==e&&(jt.unpackAlignment=t),dr.pixelStorei(e,t)},emscripten_glReadBuffer:function(e){dr.readBuffer(e)},emscripten_glReadPixels:function(e,t,r,n,i,a,o){if(jt.currentContext.version>=2)if(dr.currentPixelPackBufferBinding)dr.readPixels(e,t,r,n,i,a,o);else{var s=Zt(a);dr.readPixels(e,t,r,n,i,a,s,o>>Kt(s))}else{var c=Qt(a,i,r,n,o);c?dr.readPixels(e,t,r,n,i,a,c):jt.recordError(1280)}},emscripten_glRenderbufferStorage:function(e,t,r,n){dr.renderbufferStorage(e,t,r,n)},emscripten_glRenderbufferStorageMultisample:function(e,t,r,n,i){dr.renderbufferStorageMultisample(e,t,r,n,i)},emscripten_glSamplerParameterf:function(e,t,r){dr.samplerParameterf(jt.samplers[e],t,r)},emscripten_glSamplerParameteri:function(e,t,r){dr.samplerParameteri(jt.samplers[e],t,r)},emscripten_glSamplerParameteriv:function(e,t,r){var n=L[r>>2];dr.samplerParameteri(jt.samplers[e],t,n)},emscripten_glScissor:function(e,t,r,n){dr.scissor(e,t,r,n)},emscripten_glShaderSource:function(e,t,r,n){var i=jt.getSource(e,t,r,n);dr.shaderSource(jt.shaders[e],i)},emscripten_glStencilFunc:function(e,t,r){dr.stencilFunc(e,t,r)},emscripten_glStencilFuncSeparate:function(e,t,r,n){dr.stencilFuncSeparate(e,t,r,n)},emscripten_glStencilMask:function(e){dr.stencilMask(e)},emscripten_glStencilMaskSeparate:function(e,t){dr.stencilMaskSeparate(e,t)},emscripten_glStencilOp:function(e,t,r){dr.stencilOp(e,t,r)},emscripten_glStencilOpSeparate:function(e,t,r,n){dr.stencilOpSeparate(e,t,r,n)},emscripten_glTexImage2D:function(e,t,r,n,i,a,o,s,c){if(jt.currentContext.version>=2)if(dr.currentPixelUnpackBufferBinding)dr.texImage2D(e,t,r,n,i,a,o,s,c);else if(c){var u=Zt(s);dr.texImage2D(e,t,r,n,i,a,o,s,u,c>>Kt(u))}else dr.texImage2D(e,t,r,n,i,a,o,s,null);else dr.texImage2D(e,t,r,n,i,a,o,s,c?Qt(s,o,n,i,c):null)},emscripten_glTexParameterf:function(e,t,r){dr.texParameterf(e,t,r)},emscripten_glTexParameterfv:function(e,t,r){var n=R[r>>2];dr.texParameterf(e,t,n)},emscripten_glTexParameteri:function(e,t,r){dr.texParameteri(e,t,r)},emscripten_glTexParameteriv:function(e,t,r){var n=L[r>>2];dr.texParameteri(e,t,n)},emscripten_glTexStorage2D:function(e,t,r,n,i){dr.texStorage2D(e,t,r,n,i)},emscripten_glTexSubImage2D:function(e,t,r,n,i,a,o,s,c){if(jt.currentContext.version>=2)if(dr.currentPixelUnpackBufferBinding)dr.texSubImage2D(e,t,r,n,i,a,o,s,c);else if(c){var u=Zt(s);dr.texSubImage2D(e,t,r,n,i,a,o,s,u,c>>Kt(u))}else dr.texSubImage2D(e,t,r,n,i,a,o,s,null);else{var l=null;c&&(l=Qt(s,o,i,a,c)),dr.texSubImage2D(e,t,r,n,i,a,o,s,l)}},emscripten_glUniform1f:function(e,t){dr.uniform1f(Xt(e),t)},emscripten_glUniform1fv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform1fv(Xt(e),R,r>>2,t);else{if(t<=288)for(var n=er[t-1],i=0;i<t;++i)n[i]=R[r+4*i>>2];else n=R.subarray(r>>2,r+4*t>>2);dr.uniform1fv(Xt(e),n)}},emscripten_glUniform1i:function(e,t){dr.uniform1i(Xt(e),t)},emscripten_glUniform1iv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform1iv(Xt(e),L,r>>2,t);else{if(t<=288)for(var n=tr[t-1],i=0;i<t;++i)n[i]=L[r+4*i>>2];else n=L.subarray(r>>2,r+4*t>>2);dr.uniform1iv(Xt(e),n)}},emscripten_glUniform2f:function(e,t,r){dr.uniform2f(Xt(e),t,r)},emscripten_glUniform2fv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform2fv(Xt(e),R,r>>2,2*t);else{if(t<=144)for(var n=er[2*t-1],i=0;i<2*t;i+=2)n[i]=R[r+4*i>>2],n[i+1]=R[r+(4*i+4)>>2];else n=R.subarray(r>>2,r+8*t>>2);dr.uniform2fv(Xt(e),n)}},emscripten_glUniform2i:function(e,t,r){dr.uniform2i(Xt(e),t,r)},emscripten_glUniform2iv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform2iv(Xt(e),L,r>>2,2*t);else{if(t<=144)for(var n=tr[2*t-1],i=0;i<2*t;i+=2)n[i]=L[r+4*i>>2],n[i+1]=L[r+(4*i+4)>>2];else n=L.subarray(r>>2,r+8*t>>2);dr.uniform2iv(Xt(e),n)}},emscripten_glUniform3f:function(e,t,r,n){dr.uniform3f(Xt(e),t,r,n)},emscripten_glUniform3fv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform3fv(Xt(e),R,r>>2,3*t);else{if(t<=96)for(var n=er[3*t-1],i=0;i<3*t;i+=3)n[i]=R[r+4*i>>2],n[i+1]=R[r+(4*i+4)>>2],n[i+2]=R[r+(4*i+8)>>2];else n=R.subarray(r>>2,r+12*t>>2);dr.uniform3fv(Xt(e),n)}},emscripten_glUniform3i:function(e,t,r,n){dr.uniform3i(Xt(e),t,r,n)},emscripten_glUniform3iv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform3iv(Xt(e),L,r>>2,3*t);else{if(t<=96)for(var n=tr[3*t-1],i=0;i<3*t;i+=3)n[i]=L[r+4*i>>2],n[i+1]=L[r+(4*i+4)>>2],n[i+2]=L[r+(4*i+8)>>2];else n=L.subarray(r>>2,r+12*t>>2);dr.uniform3iv(Xt(e),n)}},emscripten_glUniform4f:function(e,t,r,n,i){dr.uniform4f(Xt(e),t,r,n,i)},emscripten_glUniform4fv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform4fv(Xt(e),R,r>>2,4*t);else{if(t<=72){var n=er[4*t-1],i=R;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=R.subarray(r>>2,r+16*t>>2);dr.uniform4fv(Xt(e),n)}},emscripten_glUniform4i:function(e,t,r,n,i){dr.uniform4i(Xt(e),t,r,n,i)},emscripten_glUniform4iv:function(e,t,r){if(jt.currentContext.version>=2)t&&dr.uniform4iv(Xt(e),L,r>>2,4*t);else{if(t<=72)for(var n=tr[4*t-1],i=0;i<4*t;i+=4)n[i]=L[r+4*i>>2],n[i+1]=L[r+(4*i+4)>>2],n[i+2]=L[r+(4*i+8)>>2],n[i+3]=L[r+(4*i+12)>>2];else n=L.subarray(r>>2,r+16*t>>2);dr.uniform4iv(Xt(e),n)}},emscripten_glUniformMatrix2fv:function(e,t,r,n){if(jt.currentContext.version>=2)t&&dr.uniformMatrix2fv(Xt(e),!!r,R,n>>2,4*t);else{if(t<=72)for(var i=er[4*t-1],a=0;a<4*t;a+=4)i[a]=R[n+4*a>>2],i[a+1]=R[n+(4*a+4)>>2],i[a+2]=R[n+(4*a+8)>>2],i[a+3]=R[n+(4*a+12)>>2];else i=R.subarray(n>>2,n+16*t>>2);dr.uniformMatrix2fv(Xt(e),!!r,i)}},emscripten_glUniformMatrix3fv:function(e,t,r,n){if(jt.currentContext.version>=2)t&&dr.uniformMatrix3fv(Xt(e),!!r,R,n>>2,9*t);else{if(t<=32)for(var i=er[9*t-1],a=0;a<9*t;a+=9)i[a]=R[n+4*a>>2],i[a+1]=R[n+(4*a+4)>>2],i[a+2]=R[n+(4*a+8)>>2],i[a+3]=R[n+(4*a+12)>>2],i[a+4]=R[n+(4*a+16)>>2],i[a+5]=R[n+(4*a+20)>>2],i[a+6]=R[n+(4*a+24)>>2],i[a+7]=R[n+(4*a+28)>>2],i[a+8]=R[n+(4*a+32)>>2];else i=R.subarray(n>>2,n+36*t>>2);dr.uniformMatrix3fv(Xt(e),!!r,i)}},emscripten_glUniformMatrix4fv:function(e,t,r,n){if(jt.currentContext.version>=2)t&&dr.uniformMatrix4fv(Xt(e),!!r,R,n>>2,16*t);else{if(t<=18){var i=er[16*t-1],a=R;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=R.subarray(n>>2,n+64*t>>2);dr.uniformMatrix4fv(Xt(e),!!r,i)}},emscripten_glUseProgram:function(e){e=jt.programs[e],dr.useProgram(e),dr.currentProgram=e},emscripten_glVertexAttrib1f:function(e,t){dr.vertexAttrib1f(e,t)},emscripten_glVertexAttrib2fv:function(e,t){dr.vertexAttrib2f(e,R[t>>2],R[t+4>>2])},emscripten_glVertexAttrib3fv:function(e,t){dr.vertexAttrib3f(e,R[t>>2],R[t+4>>2],R[t+8>>2])},emscripten_glVertexAttrib4fv:function(e,t){dr.vertexAttrib4f(e,R[t>>2],R[t+4>>2],R[t+8>>2],R[t+12>>2])},emscripten_glVertexAttribDivisor:function(e,t){dr.vertexAttribDivisor(e,t)},emscripten_glVertexAttribIPointer:function(e,t,r,n,i){dr.vertexAttribIPointer(e,t,r,n,i)},emscripten_glVertexAttribPointer:function(e,t,r,n,i,a){dr.vertexAttribPointer(e,t,r,!!n,i,a)},emscripten_glViewport:function(e,t,r,n){dr.viewport(e,t,r,n)},emscripten_glWaitSync:function(e,t,r,n){dr.waitSync(jt.syncs[e],t,Gt(r,n))},emscripten_is_main_browser_thread:function(){return!0},emscripten_memcpy_big:function(e,t,r){k.copyWithin(e,t,t+r)},emscripten_request_animation_frame:function(e,t){return requestAnimationFrame((function(r){ye(e)(r,t)}))},emscripten_resize_heap:function(e){var t=k.length;T((e>>>=0)>t);var r,n,i=2147483648;if(e>i)return f("Cannot enlarge memory, asked to go up to "+e+" bytes, but the limit is 2147483648 bytes!"),!1;for(var a=1;a<=4;a*=2){var o=t*(1+.2/a);o=Math.min(o,e+100663296);var s=Math.min(i,(r=Math.max(e,o))+((n=65536)-r%n)%n);if(rr(s))return!0}return f("Failed to grow the heap from "+t+" bytes to "+s+" bytes, not enough memory!"),!1},emscripten_start_fetch:function(e,t,r,n,i){var a=e+112,o=S(a),s=M[a+36>>2],c=M[a+40>>2],u=M[a+44>>2],l=M[a+48>>2],f=M[a+52>>2],d=!!(4&f),m=!!(32&f),g=!!(16&f),p=!!(64&f),v=(e,r,n)=>{ar((()=>{s?ye(s)(e):t&&t(e)}),p)},h=(e,t,r)=>{ar((()=>{u?ye(u)(e):n&&n(e)}),p)},y=(e,t,n)=>{ar((()=>{c?ye(c)(e):r&&r(e)}),p)},_=(e,t,r)=>{ar((()=>{l?ye(l)(e):i&&i(e)}),p)},b=(e,r,n)=>{or(nr.dbInstance,e,r.response,((e,r,n)=>{ar((()=>{s?ye(s)(e):t&&t(e)}),p)}),((e,r,n)=>{ar((()=>{s?ye(s)(e):t&&t(e)}),p)}))};if("EM_IDB_STORE"===o){var w=M[a+84>>2];or(nr.dbInstance,e,k.slice(w,w+M[a+88>>2]),v,y)}else if("EM_IDB_DELETE"===o)!function(e,t,r,n){if(e){var i=M[t+112+64>>2];i||(i=M[t+8>>2]);var a=S(i);try{var o=e.transaction(["FILES"],"readwrite").objectStore("FILES").delete(a);o.onsuccess=e=>{var n=e.target.result;M[t+12>>2]=0,nr.setu64(t+16,0),nr.setu64(t+24,0),nr.setu64(t+32,0),D[t+40>>1]=4,D[t+42>>1]=200,C("OK",t+44,64),r(t,0,n)},o.onerror=e=>{D[t+40>>1]=4,D[t+42>>1]=404,C("Not Found",t+44,64),n(t,0,e)}}catch(e){n(t,0,e)}}else n(t,0,"IndexedDB not available!")}(nr.dbInstance,e,v,y);else if(g){if(m)return 0;ir(e,d?b:v,y,h,_)}else!function(e,t,r,n){if(e){var i=M[t+112+64>>2];i||(i=M[t+8>>2]);var a=S(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=br(a);k.set(new Uint8Array(i),o),M[t+12>>2]=o,nr.setu64(t+16,a),nr.setu64(t+24,0),nr.setu64(t+32,a),D[t+40>>1]=4,D[t+42>>1]=200,C("OK",t+44,64),r(t,0,i)}else D[t+40>>1]=4,D[t+42>>1]=404,C("Not Found",t+44,64),n(t,0,"no data")},o.onerror=e=>{D[t+40>>1]=4,D[t+42>>1]=404,C("Not Found",t+44,64),n(t,0,e)}}catch(e){n(t,0,e)}}else n(t,0,"IndexedDB not available!")}(nr.dbInstance,e,v,m?y:d?(e,t,r)=>{ir(e,b,y,h,_)}:(e,t,r)=>{ir(e,v,y,h,_)});return e},emscripten_webgl_make_context_current:function(e){return jt.makeContextCurrent(e)?0:-5},environ_get:function(e,t){var r=0;return cr().forEach((function(n,i){var a=t+r;L[e+4*i>>2]=a,function(e,t,r){for(var n=0;n<e.length;++n)T(e.charCodeAt(n)===(255&e.charCodeAt(n))),F[t++>>0]=e.charCodeAt(n);r||(F[t>>0]=0)}(n,a),r+=n.length+1})),0},environ_sizes_get:function(e,t){var r=cr();L[e>>2]=r.length;var n=0;return r.forEach((function(e){n+=e.length+1})),L[t>>2]=n,0},fd_close:function(e){ue("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM")},fd_seek:function(e,t,r,n){return 70},fd_write:function(e,t,r,n){for(var i=0,a=0;a<r;a++){var o=M[t>>2],s=M[t+4>>2];t+=8;for(var c=0;c<s;c++)lr(e,k[o+c]);i+=s}return L[n>>2]=i,0},getTempRet0:function(){return _},glBindFramebuffer:function(e,t){dr.bindFramebuffer(e,jt.framebuffers[t])},glClear:function(e){dr.clear(e)},glClearColor:function(e,t,r,n){dr.clearColor(e,t,r,n)},glClearStencil:function(e){dr.clearStencil(e)},glGetIntegerv:function(e,t){zt(e,t,0)},invoke_ii:function(e,t){var r=Cr();try{return ye(e)(t)}catch(e){if(Ar(r),e!==e+0)throw e;Er(1,0)}},invoke_iii:function(e,t,r){var n=Cr();try{return ye(e)(t,r)}catch(e){if(Ar(n),e!==e+0)throw e;Er(1,0)}},invoke_iiii:function(e,t,r,n){var i=Cr();try{return ye(e)(t,r,n)}catch(e){if(Ar(i),e!==e+0)throw e;Er(1,0)}},invoke_iiiii:function(e,t,r,n,i){var a=Cr();try{return ye(e)(t,r,n,i)}catch(e){if(Ar(a),e!==e+0)throw e;Er(1,0)}},invoke_v:function(e){var t=Cr();try{ye(e)()}catch(e){if(Ar(t),e!==e+0)throw e;Er(1,0)}},invoke_vi:function(e,t){var r=Cr();try{ye(e)(t)}catch(e){if(Ar(r),e!==e+0)throw e;Er(1,0)}},invoke_vii:function(e,t,r){var n=Cr();try{ye(e)(t,r)}catch(e){if(Ar(n),e!==e+0)throw e;Er(1,0)}},invoke_viii:function(e,t,r,n){var i=Cr();try{ye(e)(t,r,n)}catch(e){if(Ar(i),e!==e+0)throw e;Er(1,0)}},invoke_viiii:function(e,t,r,n,i){var a=Cr();try{ye(e)(t,r,n,i)}catch(e){if(Ar(a),e!==e+0)throw e;Er(1,0)}},invoke_viiiii:function(e,t,r,n,i,a){var o=Cr();try{ye(e)(t,r,n,i,a)}catch(e){if(Ar(o),e!==e+0)throw e;Er(1,0)}},invoke_viiiiii:function(e,t,r,n,i,a,o){var s=Cr();try{ye(e)(t,r,n,i,a,o)}catch(e){if(Ar(s),e!==e+0)throw e;Er(1,0)}},invoke_viiiiiiiii:function(e,t,r,n,i,a,o,s,c,u){var l=Cr();try{ye(e)(t,r,n,i,a,o,s,c,u)}catch(e){if(Ar(l),e!==e+0)throw e;Er(1,0)}},setTempRet0:function(e){_=e},strftime_l:function(e,t,r,n){return pr(e,t,r,n)}};!function(){var e={env:_r,wasi_snapshot_preview1:_r};function t(e,t){var r,n=e.exports;i.asm=n,T(y=i.asm.memory,"memory not found in wasm exports"),z(y.buffer),T(q=i.asm.__indirect_function_table,"table not found in wasm exports"),r=i.asm.__wasm_call_ctors,ee.unshift(r),ce("wasm-instantiate")}se("wasm-instantiate");var r=i;function a(e){T(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(h||"function"!=typeof fetch?Promise.resolve().then((function(){return pe(le)})):fetch(le,{credentials:"same-origin"}).then((function(e){if(!e.ok)throw"failed to load wasm binary file at '"+le+"'";return e.arrayBuffer()})).catch((function(){return pe(le)}))).then((function(t){return WebAssembly.instantiate(t,e)})).then((function(e){return e})).then(t,(function(e){f("failed to asynchronously prepare wasm: "+e),le.startsWith("file://")&&f("warning: Loading from a file URI ("+le+") 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"),ue(e)}))}if(i.instantiateWasm)try{return i.instantiateWasm(e,t)}catch(e){return f("Module.instantiateWasm callback failed with error: "+e),!1}(h||"function"!=typeof WebAssembly.instantiateStreaming||me(le)||"function"!=typeof fetch?o(a):fetch(le,{credentials:"same-origin"}).then((function(t){return WebAssembly.instantiateStreaming(t,e).then(a,(function(e){return f("wasm streaming compile failed: "+e),f("falling back to ArrayBuffer instantiation"),o(a)}))}))).catch(n)}(),i.___wasm_call_ctors=ge("__wasm_call_ctors");var br=i._malloc=ge("malloc"),wr=i._free=ge("free");i.___errno_location=ge("__errno_location"),i._saveSetjmp=ge("saveSetjmp");var Tr=i.___getTypeName=ge("__getTypeName");i.___embind_register_native_and_builtin_types=ge("__embind_register_native_and_builtin_types"),i.___stdio_exit=ge("__stdio_exit"),i.___dl_seterr=ge("__dl_seterr");var Er=i._setThrew=ge("setThrew"),xr=i._emscripten_stack_init=function(){return(xr=i._emscripten_stack_init=i.asm.emscripten_stack_init).apply(null,arguments)};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)};var Sr,Pr=i._emscripten_stack_get_end=function(){return(Pr=i._emscripten_stack_get_end=i.asm.emscripten_stack_get_end).apply(null,arguments)},Cr=i.stackSave=ge("stackSave"),Ar=i.stackRestore=ge("stackRestore");function Ir(e){this.name="ExitStatus",this.message="Program terminated with exit("+e+")",this.status=e}function Fr(e){function t(){Sr||(Sr=!0,i.calledRun=!0,w||(Q(),T(!re),re=!0,ve(ee),r(i),i.onRuntimeInitialized&&i.onRuntimeInitialized(),T(!i._main,'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]'),function(){if(Q(),i.postRun)for("function"==typeof i.postRun&&(i.postRun=[i.postRun]);i.postRun.length;)e=i.postRun.shift(),te.unshift(e);var e;ve(te)}()))}ne>0||(xr(),K(),function(){if(i.preRun)for("function"==typeof i.preRun&&(i.preRun=[i.preRun]);i.preRun.length;)e=i.preRun.shift(),X.unshift(e);var e;ve(X)}(),ne>0||(i.setStatus?(i.setStatus("Running..."),setTimeout((function(){setTimeout((function(){i.setStatus("")}),1),t()}),1)):t(),Q()))}if(i.stackAlloc=ge("stackAlloc"),v("ccall",!1),v("cwrap",!1),v("setValue",!1),v("getValue",!1),v("allocate",!1),v("UTF8ArrayToString",!1),v("UTF8ToString",!1),v("stringToUTF8Array",!1),v("stringToUTF8",!1),v("lengthBytesUTF8",!1),v("addOnPreRun",!1),v("addOnInit",!1),v("addOnPreMain",!1),v("addOnExit",!1),v("addOnPostRun",!1),v("addRunDependency",!0),v("removeRunDependency",!0),v("FS_createFolder",!1),v("FS_createPath",!0),v("FS_createDataFile",!0),v("FS_createPreloadedFile",!0),v("FS_createLazyFile",!0),v("FS_createLink",!1),v("FS_createDevice",!0),v("FS_unlink",!0),v("getLEB",!1),v("getFunctionTables",!1),v("alignFunctionTables",!1),v("registerFunctions",!1),v("addFunction",!1),v("removeFunction",!1),v("prettyPrint",!1),v("getCompilerSetting",!1),v("print",!1),v("printErr",!1),v("getTempRet0",!1),v("setTempRet0",!1),v("callMain",!1),v("abort",!1),v("keepRuntimeAlive",!1),v("wasmMemory",!1),v("warnOnce",!1),v("stackSave",!1),v("stackRestore",!1),v("stackAlloc",!1),v("AsciiToString",!1),v("stringToAscii",!1),v("UTF16ToString",!1),v("stringToUTF16",!1),v("lengthBytesUTF16",!1),v("UTF32ToString",!1),v("stringToUTF32",!1),v("lengthBytesUTF32",!1),v("allocateUTF8",!1),v("allocateUTF8OnStack",!1),v("ExitStatus",!1),v("intArrayFromString",!1),v("intArrayToString",!1),v("writeStringToMemory",!1),v("writeArrayToMemory",!1),v("writeAsciiToMemory",!1),i.writeStackCookie=K,i.checkStackCookie=Q,v("ptrToString",!1),v("zeroMemory",!1),v("stringToNewUTF8",!1),v("emscripten_realloc_buffer",!1),v("ENV",!1),v("ERRNO_CODES",!1),v("ERRNO_MESSAGES",!1),v("setErrNo",!1),v("inetPton4",!1),v("inetNtop4",!1),v("inetPton6",!1),v("inetNtop6",!1),v("readSockaddr",!1),v("writeSockaddr",!1),v("DNS",!1),v("getHostByName",!1),v("Protocols",!1),v("Sockets",!1),v("getRandomDevice",!1),v("traverseStack",!1),v("UNWIND_CACHE",!1),v("convertPCtoSourceLocation",!1),v("readAsmConstArgsArray",!1),v("readAsmConstArgs",!1),v("mainThreadEM_ASM",!1),v("jstoi_q",!1),v("jstoi_s",!1),v("getExecutableName",!1),v("listenOnce",!1),v("autoResumeAudioContext",!1),v("dynCall",!1),v("handleException",!1),v("runtimeKeepalivePush",!1),v("runtimeKeepalivePop",!1),v("callUserCallback",!1),v("maybeExit",!1),v("safeSetTimeout",!1),v("asmjsMangle",!1),v("asyncLoad",!1),v("alignMemory",!1),v("mmapAlloc",!1),v("reallyNegative",!1),v("unSign",!1),v("reSign",!1),v("formatString",!1),v("PATH",!1),v("PATH_FS",!1),v("SYSCALLS",!1),v("getSocketFromFD",!1),v("getSocketAddress",!1),v("JSEvents",!1),v("registerKeyEventCallback",!1),v("specialHTMLTargets",!1),v("maybeCStringToJsString",!1),v("findEventTarget",!1),v("findCanvasEventTarget",!1),v("getBoundingClientRect",!1),v("fillMouseEventData",!1),v("registerMouseEventCallback",!1),v("registerWheelEventCallback",!1),v("registerUiEventCallback",!1),v("registerFocusEventCallback",!1),v("fillDeviceOrientationEventData",!1),v("registerDeviceOrientationEventCallback",!1),v("fillDeviceMotionEventData",!1),v("registerDeviceMotionEventCallback",!1),v("screenOrientation",!1),v("fillOrientationChangeEventData",!1),v("registerOrientationChangeEventCallback",!1),v("fillFullscreenChangeEventData",!1),v("registerFullscreenChangeEventCallback",!1),v("registerRestoreOldStyle",!1),v("hideEverythingExceptGivenElement",!1),v("restoreHiddenElements",!1),v("setLetterbox",!1),v("currentFullscreenStrategy",!1),v("restoreOldWindowedStyle",!1),v("softFullscreenResizeWebGLRenderTarget",!1),v("doRequestFullscreen",!1),v("fillPointerlockChangeEventData",!1),v("registerPointerlockChangeEventCallback",!1),v("registerPointerlockErrorEventCallback",!1),v("requestPointerLock",!1),v("fillVisibilityChangeEventData",!1),v("registerVisibilityChangeEventCallback",!1),v("registerTouchEventCallback",!1),v("fillGamepadEventData",!1),v("registerGamepadEventCallback",!1),v("registerBeforeUnloadEventCallback",!1),v("fillBatteryEventData",!1),v("battery",!1),v("registerBatteryEventCallback",!1),v("setCanvasElementSize",!1),v("getCanvasElementSize",!1),v("demangle",!1),v("demangleAll",!1),v("jsStackTrace",!1),v("stackTrace",!1),v("getEnvStrings",!1),v("checkWasiClock",!1),v("flush_NO_FILESYSTEM",!1),v("writeI53ToI64",!1),v("writeI53ToI64Clamped",!1),v("writeI53ToI64Signaling",!1),v("writeI53ToU64Clamped",!1),v("writeI53ToU64Signaling",!1),v("readI53FromI64",!1),v("readI53FromU64",!1),v("convertI32PairToI53",!1),v("convertU32PairToI53",!1),v("setImmediateWrapped",!1),v("clearImmediateWrapped",!1),v("polyfillSetImmediate",!1),v("Browser",!1),v("setMainLoop",!1),v("wget",!1),v("tempFixedLengthArray",!1),v("miniTempWebGLFloatBuffers",!1),v("heapObjectForWebGLType",!1),v("heapAccessShiftForWebGLHeap",!1),i.GL=jt,v("emscriptenWebGLGet",!1),v("computeUnpackAlignedImageSize",!1),v("emscriptenWebGLGetTexPixelData",!1),v("emscriptenWebGLGetUniform",!1),v("webglGetUniformLocation",!1),v("webglPrepareUniformLocationsBeforeFirstUse",!1),v("webglGetLeftBracePos",!1),v("emscriptenWebGLGetVertexAttrib",!1),v("emscriptenWebGLGetIndexed",!1),v("Fetch",!1),v("fetchDeleteCachedData",!1),v("fetchLoadCachedData",!1),v("fetchCacheData",!1),v("fetchXHR",!1),v("InternalError",!1),v("BindingError",!1),v("UnboundTypeError",!1),v("PureVirtualError",!1),v("init_embind",!1),v("throwInternalError",!1),v("throwBindingError",!1),v("throwUnboundTypeError",!1),v("ensureOverloadTable",!1),v("exposePublicSymbol",!1),v("replacePublicSymbol",!1),v("extendError",!1),v("createNamedFunction",!1),v("registeredInstances",!1),v("getBasestPointer",!1),v("registerInheritedInstance",!1),v("unregisterInheritedInstance",!1),v("getInheritedInstance",!1),v("getInheritedInstanceCount",!1),v("getLiveInheritedInstances",!1),v("registeredTypes",!1),v("awaitingDependencies",!1),v("typeDependencies",!1),v("registeredPointers",!1),v("registerType",!1),v("whenDependentTypesAreResolved",!1),v("embind_charCodes",!1),v("embind_init_charCodes",!1),v("readLatin1String",!1),v("getTypeName",!1),v("heap32VectorToArray",!1),v("requireRegisteredType",!1),v("getShiftFromSize",!1),v("integerReadValueFromPointer",!1),v("enumReadValueFromPointer",!1),v("floatReadValueFromPointer",!1),v("simpleReadValueFromPointer",!1),v("runDestructors",!1),v("new_",!1),v("craftInvokerFunction",!1),v("embind__requireFunction",!1),v("tupleRegistrations",!1),v("structRegistrations",!1),v("genericPointerToWireType",!1),v("constNoSmartPtrRawPointerToWireType",!1),v("nonConstNoSmartPtrRawPointerToWireType",!1),v("init_RegisteredPointer",!1),v("RegisteredPointer",!1),v("RegisteredPointer_getPointee",!1),v("RegisteredPointer_destructor",!1),v("RegisteredPointer_deleteObject",!1),v("RegisteredPointer_fromWireType",!1),v("runDestructor",!1),v("releaseClassHandle",!1),v("finalizationRegistry",!1),v("detachFinalizer_deps",!1),v("detachFinalizer",!1),v("attachFinalizer",!1),v("makeClassHandle",!1),v("init_ClassHandle",!1),v("ClassHandle",!1),v("ClassHandle_isAliasOf",!1),v("throwInstanceAlreadyDeleted",!1),v("ClassHandle_clone",!1),v("ClassHandle_delete",!1),v("deletionQueue",!1),v("ClassHandle_isDeleted",!1),v("ClassHandle_deleteLater",!1),v("flushPendingDeletes",!1),v("delayFunction",!1),v("setDelayFunction",!1),v("RegisteredClass",!1),v("shallowCopyInternalPointer",!1),v("downcastPointer",!1),v("upcastPointer",!1),v("validateThis",!1),v("char_0",!1),v("char_9",!1),v("makeLegalFunctionName",!1),v("emval_handle_array",!1),v("emval_free_list",!1),v("emval_symbols",!1),v("init_emval",!1),v("count_emval_handles",!1),v("get_first_emval",!1),v("getStringOrSymbol",!1),v("Emval",!1),v("emval_newers",!1),v("craftEmvalAllocator",!1),v("emval_get_global",!1),v("emval_methodCallers",!1),v("emval_registeredMethods",!1),v("writeGLArray",!1),p("ALLOC_NORMAL",!1),p("ALLOC_STACK",!1),ae=function e(){Sr||Fr(),Sr||(ae=e)},i.run=Fr,i.preInit)for("function"==typeof i.preInit&&(i.preInit=[i.preInit]);i.preInit.length>0;)i.preInit.pop()();return Fr(),t.ready});"object"==typeof exports&&"object"==typeof module?module.exports=t:"function"==typeof define&&define.amd?define([],(function(){return t})):"object"==typeof exports&&(exports.SketchWebWasmFactory=t);
Binary file