@sketch-hq/sketch-web-renderer 14.13.1 → 14.13.2

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.
@@ -797,6 +797,9 @@
797
797
  this.imagesURLFormat = '';
798
798
  this.fragmentsURLMap = {};
799
799
  this.fragmentsURLFormat = '';
800
+ // Counts fetches started after loadAllFragments() so we know whether to
801
+ // wait for onAllImagesReady or use the short no-assets fallback timeout.
802
+ this.pendingFetchCount = 0;
800
803
  }
801
804
  ExportWorker.prototype.init = function (data) {
802
805
  var _a;
@@ -859,51 +862,98 @@
859
862
  return [4 /*yield*/, new Promise(function (resolve) {
860
863
  var _a;
861
864
  _this.resolveAllReady = resolve;
865
+ _this.pendingFetchCount = 0;
862
866
  (_a = _this.pageCanvasWasm) === null || _a === void 0 ? void 0 : _a.loadAllFragments();
863
- // Safety timeout: documents with no fragments/images never fire onAllImagesReady
864
- setTimeout(resolve, 5000);
867
+ // Two-phase wait:
868
+ // 1. After 1s, check whether any fetches have started.
869
+ // If none did, the document has no remote assets and onAllImagesReady
870
+ // will never fire — resolve immediately.
871
+ // 2. If fetches are in-flight, wait up to 60s for onAllImagesReady.
872
+ // This handles large pages/symbol pages whose assets take > 5s to load.
873
+ setTimeout(function () {
874
+ if (_this.pendingFetchCount === 0) {
875
+ resolve();
876
+ }
877
+ else {
878
+ setTimeout(resolve, 60000);
879
+ }
880
+ }, 5000);
865
881
  })];
866
882
  case 4:
867
883
  // Trigger lazy-loaded fragment fetching so all nodes are available.
868
884
  // onAllImagesReady fires once all fragments and images have loaded.
869
885
  _b.sent();
870
886
  this.resolveAllReady = undefined;
871
- self.postMessage({ type: 'ready' });
887
+ setTimeout(function () {
888
+ self.postMessage({ type: 'ready' });
889
+ }, 10000);
872
890
  return [2 /*return*/];
873
891
  }
874
892
  });
875
893
  });
876
894
  };
877
895
  ExportWorker.prototype.exportNode = function (requestId, nodeId, format, backingScale) {
878
- if (this.cancelledRequests.delete(requestId))
879
- return;
880
- if (!this.pageCanvasWasm) {
881
- self.postMessage({
882
- type: 'error',
883
- requestId: requestId,
884
- message: 'Export worker not initialized',
885
- });
886
- return;
887
- }
888
- this.pageCanvasWasm.exportNode(BigInt(nodeId), {
889
- format: { value: format },
890
- backingScale: backingScale,
891
- }, function (data, width, height, bytesPerPixel) {
892
- if (data === null) {
893
- self.postMessage({
894
- type: 'error',
895
- requestId: requestId,
896
- message: 'Export failed',
896
+ return __awaiter(this, void 0, void 0, function () {
897
+ var prFile, exportNode, ancestor;
898
+ return __generator(this, function (_a) {
899
+ if (this.cancelledRequests.delete(requestId))
900
+ return [2 /*return*/];
901
+ if (!this.pageCanvasWasm) {
902
+ self.postMessage({
903
+ type: 'error',
904
+ requestId: requestId,
905
+ message: 'Export worker not initialized',
906
+ });
907
+ return [2 /*return*/];
908
+ }
909
+ // Guard against a C++ crash that occurs when a non-page ancestor layer is
910
+ // disabled (isEnabled=false). In that case areAllAncestorsEnabled() returns
911
+ // false, C++ creates a blank-node clone via clearChildren(), and if the
912
+ // node's bounds are 0x0 both GPU and CPU surface creation return null,
913
+ // causing surface->getCanvas() to crash.
914
+ // Skip the export and return an error rather than crashing the worker.
915
+ try {
916
+ prFile = this.pageCanvasWasm.getPRFile();
917
+ exportNode = prFile.findByIdentifier(BigInt(nodeId));
918
+ ancestor = exportNode.getParentNode();
919
+ while (ancestor) {
920
+ if (!ancestor.isPage() && !ancestor.isEnabled()) {
921
+ console.warn("[Export] exportNode: disabled ancestor \"".concat(ancestor.getName(), "\" for nodeId=").concat(nodeId, ", skipping"));
922
+ self.postMessage({
923
+ type: 'error',
924
+ requestId: requestId,
925
+ message: "Export failed: ancestor layer \"".concat(ancestor.getName(), "\" is hidden"),
926
+ });
927
+ return [2 /*return*/];
928
+ }
929
+ ancestor = ancestor.getParentNode();
930
+ }
931
+ }
932
+ catch (err) {
933
+ console.warn('[Export] exportNode: ancestor check failed', err);
934
+ }
935
+ this.pageCanvasWasm.exportNode(BigInt(nodeId), {
936
+ format: { value: format },
937
+ backingScale: backingScale,
938
+ }, function (data, width, height, bytesPerPixel) {
939
+ if (data === null) {
940
+ self.postMessage({
941
+ type: 'error',
942
+ requestId: requestId,
943
+ message: 'Export failed',
944
+ });
945
+ return;
946
+ }
947
+ // Copy only the pixel data bytes out of the WASM heap.
948
+ // data.buffer is the entire WASM memory; we must slice the exact
949
+ // range [byteOffset, byteOffset + byteLength] to get a correctly
950
+ // sized, transferable ArrayBuffer.
951
+ var buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
952
+ // Transfer the buffer — zero-copy to the main thread
953
+ self.postMessage({ type: 'result', requestId: requestId, buffer: buffer, width: width, height: height, bytesPerPixel: bytesPerPixel }, { transfer: [buffer] });
897
954
  });
898
- return;
899
- }
900
- // Copy only the pixel data bytes out of the WASM heap.
901
- // data.buffer is the entire WASM memory; we must slice the exact
902
- // range [byteOffset, byteOffset + byteLength] to get a correctly
903
- // sized, transferable ArrayBuffer.
904
- var buffer = data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
905
- // Transfer the buffer — zero-copy to the main thread
906
- self.postMessage({ type: 'result', requestId: requestId, buffer: buffer, width: width, height: height, bytesPerPixel: bytesPerPixel }, { transfer: [buffer] });
955
+ return [2 /*return*/];
956
+ });
907
957
  });
908
958
  };
909
959
  ExportWorker.prototype.cancelExport = function (requestId) {
@@ -922,11 +972,12 @@
922
972
  * Fetch helper used for all C++ downloads. For image responses it decodes
923
973
  * with createImageBitmap and uploads a WebGL texture so C++ can adopt it via
924
974
  * AdoptTextureFrom, matching the main canvas behaviour. Non-image responses
925
- * are returned as raw bytes.
975
+ * are returned as raw bytes (e.g. PDF, SVG).
926
976
  */
927
977
  ExportWorker.prototype.bridgeFetch = function (url, callback) {
928
978
  var _this = this;
929
979
  var onComplete = callback.clone();
980
+ this.pendingFetchCount++;
930
981
  globalThis
931
982
  .fetch(url)
932
983
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
@@ -952,6 +1003,7 @@
952
1003
  textureHandle = this.wasmModule.createWebGLTextureFromImage(imageBitmap, this.webglCtxHandle);
953
1004
  width = imageBitmap.width, height = imageBitmap.height;
954
1005
  imageBitmap.close();
1006
+ this.pendingFetchCount--;
955
1007
  onComplete.exec({
956
1008
  buffer: new Uint8Array(0),
957
1009
  statusCode: 200,
@@ -965,6 +1017,7 @@
965
1017
  return [3 /*break*/, 4];
966
1018
  case 3:
967
1019
  // Fallback: return raw bytes if not an image or no WebGL context yet
1020
+ this.pendingFetchCount--;
968
1021
  onComplete.exec({
969
1022
  buffer: new Uint8Array(buffer),
970
1023
  statusCode: 200,
@@ -982,6 +1035,7 @@
982
1035
  }); })
983
1036
  .catch(function (error) {
984
1037
  var _a, _b;
1038
+ _this.pendingFetchCount--;
985
1039
  onComplete.exec({
986
1040
  buffer: new Uint8Array(0),
987
1041
  statusCode: (_a = error === null || error === void 0 ? void 0 : error.statusCode) !== null && _a !== void 0 ? _a : 500,
@@ -1019,6 +1073,7 @@
1019
1073
  },
1020
1074
  onAllImagesReady: function () {
1021
1075
  var _a;
1076
+ console.log('asdas');
1022
1077
  (_a = _this.resolveAllReady) === null || _a === void 0 ? void 0 : _a.call(_this);
1023
1078
  },
1024
1079
  fetch: function (url, callback) { return _this.bridgeFetch(url, callback); },
@@ -1 +1 @@
1
- import e,{useRef as t,useLayoutEffect as n,useCallback as o,createContext as r,useContext as i,useReducer as a,useMemo as s,useEffect as u,useState as l}from"react";var c=function(e,t){return c=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])},c(e,t)};function d(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}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var h=function(){return h=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},h.apply(this,arguments)};function p(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}function g(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(u){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,u])}}}function v(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 f(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}const m=["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 ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const b="undefined"==typeof window,w=(()=>{if(b)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)}})();class C extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const P=[],E=[];function M(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,u,l=0,c=0,d=0;for(;c<o;)E[c]=e.charCodeAt(a+c),P[c]=++c;for(;d<r;)for(i=t.charCodeAt(a+d),s=d++,l=d,c=0;c<o;c++)u=i===E[c]?s:s+1,s=P[c],l=P[c]=s>l?u>l?l+1:u:u>s?s+1:u;return l}function L(e){return null!=e}const x=({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@5.0.25/dist/benchmarks"}={})=>f(void 0,void 0,void 0,(function*(){const a={};if(b)return{tier:0,type:"SSR"};const{isIpad:s=!!(null==w?void 0:w.isIpad),isMobile:u=!!(null==w?void 0:w.isMobile),screenSize:l=window.screen,loadBenchmarks:c=(e=>f(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 C("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:d}=n;const h=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:u,tier:e,type:t});let p,g="";if(d)d=y(d),p=[d];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==w?void 0:w.isSafari12,r);if(!e)return h(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(d=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!d)return h(1,"FALLBACK");g=d,d=y(d),p=function(e,t,n){return"apple gpu"===t?function(e,t,n){if(!n)return[t];const o=function(e){const t=e.createShader(35633),n=e.createShader(35632),o=e.createProgram();if(!(n&&t&&o))return;e.shaderSource(t,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n "),e.shaderSource(n,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),e.compileShader(t),e.compileShader(n),e.attachShader(o,t),e.attachShader(o,n),e.linkProgram(o),e.detachShader(o,t),e.detachShader(o,n),e.deleteShader(t),e.deleteShader(n),e.useProgram(o);const r=e.createBuffer();e.bindBuffer(34962,r),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const i=e.getAttribLocation(o,"aPosition");e.vertexAttribPointer(i,3,5126,!1,0,0),e.enableVertexAttribArray(i),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const a=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,a),e.deleteProgram(o),e.deleteBuffer(r),a.join("")}(e),r="801621810",i="8016218135",a="80162181161",s=(null==w?void 0:w.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 u;return"80162181255"===o?u=s.filter((([,,e])=>e>=14)):(u=s.filter((([,e])=>e===o)),u.length||(u=s)),u.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,d,u)}const v=(yield Promise.all(p.map((function(e){var t;return f(this,void 0,void 0,(function*(){const n=(e=>{const t=u?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of t)if(e.includes(n))return n})(e);if(!n)return;const o=`${u?"m":"d"}-${n}${s?"-ipad":""}.json`,r=a[o]=null!==(t=a[o])&&void 0!==t?t:c(o);let i;try{i=yield r}catch(n){if(n instanceof C)throw n;return}const d=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 h=i.filter((([,e])=>e===d));h.length||(h=i.filter((([t])=>t.includes(e))));const p=h.length;if(0===p)return;const g=e.split(/[.,()\[\]/\s]/g).sort().filter(((e,t,n)=>0===t||e!==n[t-1])).join(" ");let v,[f,,,,m]=p>1?h.map((e=>[e,M(g,e[2])])).sort((([,e],[,t])=>e-t))[0][0]:h[0],y=Number.MAX_VALUE;const{devicePixelRatio:b}=window,w=l.width*b*l.height*b;for(const e of m){const[t,n]=e,o=t*n,r=Math.abs(w-o);r<y&&(y=r,v=e)}if(!v)return;const[,,P,E]=v;return[y,P,f,E]}))})))).filter(L).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!v.length){const e=m.find((e=>d.includes(e)));return e?h(0,"BLOCKLISTED",e):h(1,"FALLBACK",`${d} (${g})`)}const[,P,E,x]=v[0];if(-1===P)return h(0,"BLOCKLISTED",E,P,x);const S=u?e:t;let R=0;for(let e=0;e<S.length;e++)P>=S[e]&&(R=e);return h(R,"BENCHMARK",E,P,x)}));var S,R,W=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 d(t,e),t}(Error);function F(e){return void 0!==e}!function(e){e.debug="debug",e.release="release"}(S||(S={})),function(e){e.Fit="Fit",e.FillWidth="FillWidth",e.ActualSize="ActualSize"}(R||(R={}));var T=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,v([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}(),I=function(){function e(e){void 0===e&&(e=!1),this.removeListenerCallbacks=[],this.disabled=e}return e.prototype.add=function(e,t,n,o){var r=this,i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.disabled||n.apply(void 0,e)};e.addEventListener(t,i,o);var a=function(){e.removeEventListener(t,i,o)};return this.removeListenerCallbacks.push(a),a},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e.prototype.setDisabled=function(e){this.disabled=e},e}(),A={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1,canvasLayersEvents:!1},D=function(e){return parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(e)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||!1},G=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,U=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}}};function k(e,t){var n;function o(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,o)}),t)}return o.cancel=function(){n&&clearTimeout(n)},o}function B(e){var t,n,o,r,i,a=null!==(n=null===(t=e.touches)||void 0===t?void 0:t[0])&&void 0!==n?n:null===(o=e.changedTouches)||void 0===o?void 0:o[0];return{x:null!==(r=null==a?void 0:a.clientX)&&void 0!==r?r:e.clientX,y:null!==(i=null==a?void 0:a.clientY)&&void 0!==i?i:e.clientY}}function z(e,t,n){return Math.max(t,Math.min(n,e))}function Z(e){return Boolean(window.chrome)&&e.gpu&&/amd\sradeon\s(pro|rx)\s5\d\d\d/gi.test(e.gpu)||U()&&!A.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function O(e){if(!e)return[];for(var t=[],n=0;n<e.size();n++)t.push(e.get(n));return t}function N(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function H(e){var t=h({},e);return Object.keys(t).forEach((function(e){void 0===t[e]&&delete t[e]})),t}function _(e){return N()?{onTouchEnd:e}:{onClick:e}}var j=function(e){return 0===(null==e?void 0:e.$$.count.value)?null:e},V=function(e){function t(t,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var r=e.call(this)||this;return 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.updateMousePosition=function(e){r.emit("pointermove",{type:"mouse",position:r.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},r.updateGlobalMousePosition=function(e){r.emit("globalpointermove",{type:"mouse",position:r.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},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=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.debouncedUpdateMousePosition=k(r.updateMousePosition,40),r.debouncedUpdateGlobalMousePosition=k(r.updateGlobalMousePosition,40),r.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!r.state.isCtrlPressed,n=e.metaKey||t||r.state.isCtrlPressed;if(r.debouncedUpdateMousePosition(e),r.debouncedUpdateGlobalMousePosition(e),n){var o=t||r.invertedWheelZoom?-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=t,r.invertedWheelZoom=n,r.targetBounds=t.getBoundingClientRect(),r.listenersCollector=new I(o),r.addListeners(),r.targetResizeObserver=new ResizeObserver(r.updateTargetBounds.bind(r)),r.targetResizeObserver.observe(r.target),r}return d(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(){N()||(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:e.x-this.targetBounds.x,y:e.y-this.targetBounds.y}},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=B(e);return this.clampPointerToTargetBounds(n)},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(),this.targetResizeObserver.disconnect()},t.prototype.setDisable=function(e){this.listenersCollector.setDisabled(e)},t.prototype.setInvertedWheelZoom=function(e){this.invertedWheelZoom=e},t}(T),J=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new I,n.handleKeyUp=function(e){n.emit("keyUp",e.code)},n.target=t,n.addListeners(),n}return d(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(T),K=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now()}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);return"[Performance] ".concat(this.label," -> ").concat(t," ms")}var n=(e/1e3).toFixed(2);return"[Performance] ".concat(this.label," -> ").concat(n," s")},e}();function Y(e){setTimeout((function(){e()}),0)}var $=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.logDebug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","debug"],e,!1))},t.prototype.logWarning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","warn"],e,!1))},t.prototype.logError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","error"],e,!1))},t}(T)),X=function(e,r){var i=t(e);i.current=e;var a=t((function(){}));return n((function(){var e=k((function(){i.current()}),r);return a.current=e,function(){e.cancel()}}),[r]),o((function(){return a.current()}),[])},q=function(e){function t(t){var n,o=this;return(o=e.call(this)||this).listenersCollector=new I,o.size={width:0,height:0},o.pixelRatio=1,o.maxPixelRatio=2,o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){o.setSize(t,n),o.emit("resize",t,n,o.getDevicePixelRatio())}))},o.getCanvasCenterPoint=function(){var e=o.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},o.container=t.container,o.canvas=t.canvas,o.maxPixelRatio=null!==(n=t.maxPixelRatio)&&void 0!==n?n:o.maxPixelRatio,o.canvasResizeObserver=new ResizeObserver(o.handleCanvasResizeObserver),o.canvasResizeObserver.observe(o.container),o.listenersCollector.add(window,"orientationchange",o.handleDeviceOrientationChange),o.setSize(o.container.clientWidth,o.container.clientHeight),o}return d(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 z(window.devicePixelRatio,1,this.maxPixelRatio)},t.prototype.getBoundingClientRect=function(){return this.canvas.getBoundingClientRect()},t.prototype.dispose=function(){this.detachAllListeners(),this.canvasResizeObserver.disconnect(),this.listenersCollector.dispose()},t}(T),Q=function(){function e(e){this.settings=e}return e.prototype.isReleaseMode=function(){return this.settings.mode===S.release},e.prototype.init=function(){return p(this,void 0,void 0,(function(){var e,t,n,o,r,i=this;return g(this,(function(a){switch(a.label){case 0:return[4,this.importModule()];case 1:e=a.sent(),t=e.default,a.label=2;case 2:return a.trys.push([2,4,,5]),n=this,[4,t({FeatureFlags:this.settings.featureFlags,currentWebGLVersion:this.settings.webglVersion,bridge:this.settings.jsBridge,locateFile:function(e){return i.settings.locateFile.replace("{file}",e)}})];case 3:return n.instance=a.sent(),[3,5];case 4:throw o=a.sent(),new W("WASM_ERROR","An error occurred while trying to create the wasm module.",o);case 5:return this.pointerTypeToWASMMap={unset:this.instance.PRUserPointerTypeEnum.Unset,mouse:this.instance.PRUserPointerTypeEnum.Mouse,touch:this.instance.PRUserPointerTypeEnum.Touch},this.prCursorTypeToCSSCursorMap=((r={})[this.instance.PRCursorTypeEnum.Auto.value]="auto",r[this.instance.PRCursorTypeEnum.Default.value]="default",r[this.instance.PRCursorTypeEnum.Pointer.value]="pointer",r[this.instance.PRCursorTypeEnum.Grab.value]="grab",r[this.instance.PRCursorTypeEnum.Grabbing.value]="grabbing",r),this.prototypeResizeModeToWASMMap={Fit:this.instance.PrototypeResizeModeWasmEnum.Fit,FillWidth:this.instance.PrototypeResizeModeWasmEnum.FillWidth,ActualSize:this.instance.PrototypeResizeModeWasmEnum.ActualSize},[2]}}))}))},e.prototype.makeWebGLContext=function(e,t){var n;void 0===t&&(t={});var o=h({antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1,desynchronized:!0},t),r=this.instance.GL.createContext(e,o);if(!r)throw new W("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");var i=null===(n=this.instance.GL.getContext(r))||void 0===n?void 0:n.GLctx;return i&&i.getExtension("WEBGL_debug_renderer_info"),r},e.prototype.createWebGLTextureFromImage=function(e,t){var n=this.instance.GL,o=n.getContext(t);if(!o)throw new Error("Unable to retrieve emscripten WebGL context from handle");var r=o.GLctx;if(!r)throw new Error("WebGL context is null");var i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);var a=n.getNewId(n.textures);return n.textures[a]=i,r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),r.bindTexture(r.TEXTURE_2D,null),a},e.prototype.destroyWebGLContext=function(e){var t;$.logDebug("Destroying WebGL context");var n=null===(t=this.instance)||void 0===t?void 0:t.GL.getContext(e);if(n){this.instance.GL.deleteContext(e);var o=n.GLctx.getExtension("WEBGL_lose_context");if(o)return o.loseContext(),$.logDebug("WebGL destroyed"),!0;$.logError("WEBGL_lose_context not available. Not possible to destroy WebGL context manually.")}else $.logError("WebGL context not found while trying to destroy it")},e.prototype.importModule=function(){return this.isReleaseMode()?import("./web-renderer-release-bac26995.js"):import("./web-renderer-debug-60dcc9c3.js")},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.PRUserPointerTypeEnum.Unset},e.prototype.mapPointerInfo=function(e){return h(h({},e),{type:this.mapToPRPointerType(e.type)})},e.prototype.mapResizeMode=function(e){return this.prototypeResizeModeToWASMMap[e]},e}();function ee(e){return new Promise((function(t,n){var o=new Image;o.onload=function(){t(o)},o.onerror=function(e){n(e)},o.src=e}))}var te,ne,oe,re,ie,ae,se,ue,le,ce,de,he,pe,ge,ve,fe,me,ye,be,we,Ce,Pe,Ee,Me,Le,xe=function(){function e(e,t,n){this.canvas=e,this.container=t,this.filePath=n,this.locateFile="/{file}",this.imagesURLFormat="",this.imagesURLMap={},this.fragmentsURLFormat="",this.fragmentsURLMap={},this.backgroundColor={r:1,g:1,b:1,a:1},this.mode=S.release,this.showTilesBorders=!1,this.minimumZoomLevel=.01,this.maximumZoomLevel=5,this.preserveDrawingBuffer=!1,this.featureFlags=A,this.manualInitialization=!1,this.panBoundariesPadding=0,this.selectedArtboard=null,this.onlyShowFrameIds=[],this.initialZoom=null,this.initialPan=null,this.showArtboardsDecorations=!0,this.invertedWheelZoom=!1}return e.FromSettings=function(t){return Object.assign(new e(t.canvas,t.container,t.filePath),Object.fromEntries(Object.entries(t).filter((function(e){return void 0!==e[1]}))))},e}(),Se={png:"image/png",jpg:"image/jpeg",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",raster:"binary/octet-stream"};!function(e){e[e.None=0]="None",e[e.Scale=1]="Scale",e[e.Width=2]="Width",e[e.Height=3]="Height"}(te||(te={})),function(e){e[e.None=0]="None",e[e.PNG=1]="PNG",e[e.JPG=2]="JPG",e[e.TIFF=3]="TIFF",e[e.WEBP=4]="WEBP",e[e.PDF=5]="PDF",e[e.EPS=6]="EPS",e[e.SVG=7]="SVG",e[e.HEIC=8]="HEIC"}(ne||(ne={})),function(e){e[e.Color=0]="Color",e[e.Gradient=1]="Gradient",e[e.Pattern=2]="Pattern"}(oe||(oe={})),function(e){e[e.Fit=0]="Fit",e[e.Fill=1]="Fill",e[e.Stretch=2]="Stretch",e[e.Tile=3]="Tile"}(re||(re={})),function(e){e[e.Linear=0]="Linear",e[e.Radial=1]="Radial",e[e.Angular=2]="Angular"}(ie||(ie={})),function(e){e[e.Center=0]="Center",e[e.Inside=1]="Inside",e[e.Outside=2]="Outside"}(ae||(ae={})),function(e){e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Square=2]="Square"}(se||(se={})),function(e){e[e.Miter=0]="Miter",e[e.Round=1]="Round",e[e.Bevel=2]="Bevel"}(ue||(ue={})),function(e){e[e.Motion=0]="Motion",e[e.Zoom=1]="Zoom",e[e.Background=2]="Background",e[e.Gaussian=3]="Gaussian"}(le||(le={})),function(e){e[e.Normal=0]="Normal",e[e.DestAtop=1]="DestAtop",e[e.Clear=2]="Clear",e[e.Source=3]="Source",e[e.Darken=4]="Darken",e[e.Multiply=5]="Multiply",e[e.ColorBurn=6]="ColorBurn",e[e.Lighten=7]="Lighten",e[e.Screen=8]="Screen",e[e.ColorDodge=9]="ColorDodge",e[e.Overlay=10]="Overlay",e[e.SoftLight=11]="SoftLight",e[e.HardLight=12]="HardLight",e[e.Difference=13]="Difference",e[e.Exclusion=14]="Exclusion",e[e.Hue=15]="Hue",e[e.Saturation=16]="Saturation",e[e.Color=17]="Color",e[e.Luminosity=18]="Luminosity",e[e.PlusLighter=19]="PlusLighter",e[e.PlusDarker=20]="PlusDarker"}(ce||(ce={})),function(e){e[e.Artboard=0]="Artboard",e[e.SymbolMaster=1]="SymbolMaster",e[e.SymbolInstance=2]="SymbolInstance",e[e.Hotspot=3]="Hotspot",e[e.Bitmap=4]="Bitmap",e[e.Group=5]="Group",e[e.Oval=6]="Oval",e[e.Polygon=7]="Polygon",e[e.Rectangle=8]="Rectangle",e[e.ShapeGroup=9]="ShapeGroup",e[e.ShapePath=10]="ShapePath",e[e.Star=11]="Star",e[e.Text=12]="Text",e[e.Triangle=13]="Triangle",e[e.Slice=14]="Slice"}(de||(de={})),function(e){e[e.Angled=2]="Angled",e[e.InsideArc=4]="InsideArc",e[e.InsideSquare=3]="InsideSquare",e[e.Rounded=0]="Rounded",e[e.Smooth=1]="Smooth"}(he||(he={})),function(e){e[e.Lowercase=2]="Lowercase",e[e.None=0]="None",e[e.Uppercase=1]="Uppercase"}(pe||(pe={})),function(e){e[e.Center=1]="Center",e[e.Justified=3]="Justified",e[e.Left=0]="Left",e[e.Right=2]="Right"}(ge||(ge={})),function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom"}(ve||(ve={})),function(e){e[e.LineThrough=2]="LineThrough",e[e.Underline=1]="Underline",e[e.None=0]="None"}(fe||(fe={})),function(e){e[e.Fixed=0]="Fixed",e[e.Fill=1]="Fill",e[e.Fit=2]="Fit",e[e.Relative=3]="Relative"}(me||(me={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(ye||(ye={})),function(e){e[e.Start=0]="Start",e[e.Center=1]="Center",e[e.End=2]="End",e[e.SpaceBetween=3]="SpaceBetween",e[e.SpaceAround=4]="SpaceAround",e[e.SpaceEvenly=5]="SpaceEvenly"}(be||(be={})),function(e){e[e.None=0]="None",e[e.Start=1]="Start",e[e.Center=2]="Center",e[e.End=3]="End",e[e.Stretch=4]="Stretch"}(we||(we={})),function(e){e[e.Unset=0]="Unset",e[e.Mouse=1]="Mouse",e[e.Touch=2]="Touch"}(Ce||(Ce={})),function(e){e[e.Auto=0]="Auto",e[e.Default=1]="Default",e[e.Pointer=2]="Pointer",e[e.Grab=3]="Grab",e[e.Grabbing=4]="Grabbing"}(Pe||(Pe={})),function(e){e[e.PNG=0]="PNG",e[e.JPG=1]="JPG",e[e.WEBP=2]="WEBP",e[e.PDF=4]="PDF",e[e.SVG=3]="SVG",e[e.RASTER=5]="RASTER"}(Ee||(Ee={})),function(e){e[e.Screen=0]="Screen",e[e.Overlay=1]="Overlay"}(Me||(Me={})),function(e){e[e.Fit=0]="Fit",e[e.FillWidth=1]="FillWidth",e[e.ActualSize=2]="ActualSize"}(Le||(Le={}));var Re=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,n.handleCanvasResize=function(e,t,o){var r;null===(r=n.pageCanvasWasm)||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;n.wasmModule&&(null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t)))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(e)))},n.settings=xe.FromSettings(t),$.logDebug("CanvasRenderer JS constructed with settings:",n.settings),n.gestureManager=new V(n.settings.container,n.settings.invertedWheelZoom),n.canvasManager=new q({container:n.settings.container,canvas:n.settings.canvas}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.exporterFetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return d(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 p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return[4,x()];case 1:return e=t.sent(),this.deviceInfo=h(h({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.detectWebGLVersion=function(){this.webglVersion=Z(this.deviceInfo),$.logDebug("Using WebGL ".concat(this.webglVersion))},t.prototype.init=function(){return p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),[4,this.collectAndEmitDeviceInfo()];case 1:t.sent(),this.detectWebGLVersion(),t.label=2;case 2:return t.trys.push([2,6,,7]),[4,this.initWasmModule()];case 3:return t.sent(),[4,this.initCanvasRendererWasm()];case 4:return t.sent(),[4,this.setFile(this.settings.filePath)];case 5:return t.sent(),this.settings.selectedArtboard&&this.selectArtboard(this.settings.selectedArtboard),this.settings.onlyShowFrameIds.length>0&&this.setOnlyShowFrames(this.settings.onlyShowFrameIds),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.setInitialCameraState=function(){var e,t,n,o=null!==this.settings.initialZoom,r=null!==this.settings.initialPan;o||r?(o&&this.setZoom(this.settings.initialZoom||1),r&&this.setPan((null===(e=this.settings.initialPan)||void 0===e?void 0:e.x)||0,(null===(t=this.settings.initialPan)||void 0===t?void 0:t.y)||0,null===(n=this.settings.initialPan)||void 0===n?void 0:n.centerPointInViewport)):this.zoomToFit()},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.pageCanvasWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t,n){return e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t].replace(":format",n):e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t).replace(":format",n):($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):($.logWarning("Not able to resolve the url for the fragment 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",(null==t?void 0:t.x)||0,(null==t?void 0:t.y)||0)},onCursorChange:function(t){var n,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},fetch:this.handleJSBridgeFetch.bind(this),exporterFetch:this.handleJSBridgeExporterFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onLayerClick:function(t){e.emit("layerClick",t)},onLayerMouseHoverChange:function(t){e.emit("layerMouseHoverChange",t)},onSceneChange:function(){e.emit("sceneChange")},onFragmentLoad:function(t){e.emit("fragmentLoad",t)}}},t.prototype.handleJSBridgeExporterFetch=function(e,t){var n=this,o=t.clone(),r=function(t){return p(n,void 0,void 0,(function(){var n,i,a,s,u,l;return g(this,(function(c){if(!this.wasmModule)return[2];if(this.disposed)return[2];if(t.data.url!==e)return[2];switch(t.data.type){case"success":n={statusCode:200,statusText:"OK",contentType:t.data.contentType,isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0,buffer:new Uint8Array(t.data.buffer)},o.exec(n);break;case"error":$.logError("Error while fetching ".concat(e),t.data.error),o.exec({buffer:new Uint8Array(0),statusCode:null!==(a=null===(i=t.data.error)||void 0===i?void 0:i.statusCode)&&void 0!==a?a:500,statusText:null!==(u=null===(s=t.data.error)||void 0===s?void 0:s.statusText)&&void 0!==u?u:"Unknown error",contentType:null!==(l=t.data.contentType)&&void 0!==l?l:"",isWebGLTexture:!1,emscriptenWebGLTextureHandle:0,width:0,height:0})}return this.exporterFetchWorker.removeEventListener("message",r),[2]}))}))};this.exporterFetchWorker.addEventListener("message",r),this.exporterFetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){return p(n,void 0,void 0,(function(){var n,i,a,s,u,l,c,d,h;return g(this,(function(p){switch(p.label){case 0:if(!this.wasmModule)return[2];if(this.disposed)return[2];if(t.data.url!==e)return[2];switch(t.data.type){case"success":return[3,1];case"error":return[3,5]}return[3,6];case 1:return n={statusCode:200,statusText:"OK",contentType:t.data.contentType,isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0},/image/.test(t.data.contentType)?(i=new Blob([t.data.buffer]),[4,ee(URL.createObjectURL(i))]):[3,3];case 2:return a=p.sent(),this.wasmModule?(s=this.wasmModule.createWebGLTextureFromImage(a,this.webglCtxHandle),n.buffer=new Uint8Array(0),n.isWebGLTexture=!0,n.emscriptenWebGLTextureHandle=s,n.width=a.width,n.height=a.height,[3,4]):[2];case 3:n.buffer=new Uint8Array(t.data.buffer),p.label=4;case 4:return o.exec(n),[3,7];case 5:return $.logError("Error while fetching ".concat(e),t.data.error),o.exec({buffer:new Uint8Array(0),statusCode:null!==(l=null===(u=t.data.error)||void 0===u?void 0:u.statusCode)&&void 0!==l?l:500,statusText:null!==(d=null===(c=t.data.error)||void 0===c?void 0:c.statusText)&&void 0!==d?d:"Unknown error",contentType:null!==(h=t.data.contentType)&&void 0!==h?h:"",isWebGLTexture:!1,emscriptenWebGLTextureHandle:0,width:0,height:0}),[3,7];case 6:return[3,7];case 7:return this.fetchWorker.removeEventListener("message",r),[2]}}))}))};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initWasmModule=function(){var e;return p(this,void 0,void 0,(function(){var t;return g(this,(function(n){switch(n.label){case 0:return this.disposed?[2]:(t=new K("WasmModuleDownload"),this.wasmModule=new Q({mode:this.settings.mode,locateFile:this.settings.locateFile,jsBridge:this.createJSBridge(),featureFlags:this.settings.featureFlags,webglVersion:this.webglVersion}),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()]);case 1:return n.sent(),$.logDebug(t.printMeasurement()),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.initCanvasRendererWasm=function(){return p(this,void 0,void 0,(function(){var e;return g(this,(function(t){if(this.disposed)return[2];try{if(!this.wasmModule)throw Error("WASM module not initialized");this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:this.webglVersion}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.pageCanvasWasm=new this.wasmModule.instance.CanvasRendererWasm(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders})}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the wasm object.",e)}if(!this.pageCanvasWasm)return[2];if(!(e=this.pageCanvasWasm.getUserEventsCollector()))throw new W("WASM_ERROR","An error occurred while trying to create the user events collector");return this.userEventsCollectorWasm=e,this.pageCanvasWasm.setShowArtboardsDecorations(this.settings.showArtboardsDecorations),this.pageCanvasWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.pageCanvasWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),this.pageCanvasWasm.setPanBoundariesPadding(this.settings.panBoundariesPadding),[2]}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.pageCanvasWasm)||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.pageCanvasWasm)||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&&($.logDebug(this.traceInitialRender.printMeasurement()),this.emit("metric",this.traceInitialRender.measure()),$.logDebug(this.traceFirstPaint.printMeasurement()),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}))},t.prototype.looseWebGLContext=function(){var e;(null===(e=this.wasmModule)||void 0===e?void 0:e.destroyWebGLContext(this.webglCtxHandle))||$.logWarning("Failed to loose WebGL context"),this.webglCtxHandle=-1},t.prototype.zoomToFit=function(){var e;null===(e=this.pageCanvasWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.zoomToFitNode=function(e,t,n){var o;void 0===t&&(t=.82),void 0===n&&(n=!1),null===(o=this.pageCanvasWasm)||void 0===o||o.scaleNodeToFit(e,t,n)},t.prototype.loadAllFragments=function(){var e;null===(e=this.pageCanvasWasm)||void 0===e||e.loadAllFragments()},t.prototype.setFile=function(e){return p(this,void 0,void 0,(function(){var t=this;return g(this,(function(n){return this.disposed?[2]:(this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){var r;null===(r=t.pageCanvasWasm)||void 0===r||r.setFile(e,(function(e,o,r){t.setStatus({type:"FILE_READY"});var i="".concat(e,"-v").concat("14.13.1");t.emit("fileReady",i,o,r),n()}),(function(){return o(new W("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()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("Status transition ".concat(this.status.type," => ").concat(e.type)),this.status=e,this.emit("status",e))},t.prototype.getPRFileCachedData=function(){var e;if(!this.pageCanvasWasm)return null;if((null===(e=this.prFileHandle)||void 0===e?void 0:e.filePath)!==this.settings.filePath){var t=this.pageCanvasWasm.getPRFile();this.prFileHandle={handle:t,filePath:this.settings.filePath,artboards:O(t.getFrames())}}return this.prFileHandle},t.prototype.getPRFile=function(){var e;return null===(e=this.getPRFileCachedData())||void 0===e?void 0:e.handle},t.prototype.releasePRFileHandle=function(){var e,t;null===(t=null===(e=this.prFileHandle)||void 0===e?void 0:e.handle)||void 0===t||t.delete(),this.prFileHandle=void 0},t.prototype.getRootNodeExtent=function(){var e,t,n;return null!==(n=null===(t=null===(e=this.getPRFile())||void 0===e?void 0:e.getRootNode())||void 0===t?void 0:t.getAbsoluteExtent())&&void 0!==n?n:null},t.prototype.getPRFileArtboards=function(){var e,t;return null!==(t=null===(e=this.getPRFileCachedData())||void 0===e?void 0:e.artboards)&&void 0!==t?t:[]},t.prototype.getArtboardAtPosition=function(e,t){if(!this.pageCanvasWasm)return null;for(var n=this.getPRFileArtboards(),o=this.pageCanvasWasm.getPan(),r=this.pageCanvasWasm.getZoom(),i=(e-o.x)/r,a=(t-o.y)/r,s=0,u=n;s<u.length;s++){var l=u[s],c=l.bounds.x+l.bounds.width,d=l.bounds.y+l.bounds.height;if(i>=l.bounds.x&&a>=l.bounds.y&&i<=c&&a<=d)return l.getNode()}return null},t.prototype.mapRelativePositionToCameraPosition=function(e,t){var n;return null===(n=this.pageCanvasWasm)||void 0===n?void 0:n.mapRelativePositionToCameraPosition(e,t)},t.prototype.getPanAtPosition=function(e,t){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.pageCanvasWasm)||void 0===n||n.setZoom(e,o.x,o.y)},t.prototype.getPan=function(){var e,t,n=this.getRootNodeExtent();if(!n)return{x:0,y:0};var o=null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getPan(),r=null===(t=this.pageCanvasWasm)||void 0===t?void 0:t.getZoom();return o&&r?{x:o.x/r+n.x,y:o.y/r+n.y}:{x:0,y:0}},t.prototype.getZoom=function(){var e;return(null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getZoom())||0},t.prototype.setPan=function(e,t,n){var o;void 0===n&&(n=!1);var r=this.getRootNodeExtent();if(r){var i=e,a=t,s=this.getZoom();if(n){var u=Math.max(2*s*this.canvasManager.pixelRatio,Number.EPSILON);i+=this.canvasManager.size.width/u,a+=this.canvasManager.size.height/u}var l=(i-r.x)*s,c=(a-r.y)*s;null===(o=this.pageCanvasWasm)||void 0===o||o.setPan(l,c)}},t.prototype.selectArtboard=function(e){var t;this.pageCanvasWasm&&(this.settings.selectedArtboard=e,null===(t=this.pageCanvasWasm)||void 0===t||t.selectArtboard(null!=e?e:""))},t.prototype.setOnlyShowFrames=function(e){var t;this.settings.onlyShowFrameIds=e,null===(t=this.pageCanvasWasm)||void 0===t||t.setOnlyShowFrames(e),this.emit("onlyShowFramesChange",e)},t.prototype.getOnlyShowFrameIds=function(){return this.settings.onlyShowFrameIds},t.prototype.disposeFetchWorker=function(){this.fetchWorker.postMessage({type:"abort-all"}),this.fetchWorker.terminate()},t.prototype.exportNode=function(e,t){return p(this,void 0,void 0,(function(){var n=this;return g(this,(function(o){return[2,new Promise((function(o,r){if(n.wasmModule&&n.pageCanvasWasm){var i=t.format.toUpperCase(),a=Ee[i];if(void 0!==a){var s={format:{value:a},backingScale:t.backingScale};n.pageCanvasWasm.exportNode(e,s,(function(e,n,i,a){if(null!==e){var s=Se[t.format],u=new Blob([e.buffer],{type:s});o({blob:u,width:n,height:i,bytesPerPixel:a})}else r("Export failed")}))}else r("Unsupported export format: ".concat(t.format))}else r("Wasm module is not ready or was disposed.")}))]}))}))},t.prototype.dispose=function(){var e,t,n,o;try{this.disposeFetchWorker(),this.disposed=!0,this.detachAllListeners(),this.releasePRFileHandle(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.pageCanvasWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.pageCanvasWasm)||void 0===n||n.delete(),null===(o=this.renderTarget)||void 0===o||o.delete(),this.pageCanvasWasm=void 0,this.wasmModule=void 0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the wasm object",e))}},t}(T),We=r(void 0),Fe=r(void 0),Te=r(void 0),Ie=r(void 0),Ae=r(void 0),De=r("auto"),Ge=r(void 0),Ue=function(){var e=i(Ge);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},ke=function(e,t){switch(t.type){case"on-status":return h(h({},e),{status:t.status});case"on-zoom":return h(h({},e),{zoom:t.zoom});case"on-pan":return h(h({},e),{pan:t.pan});case"dispose":return h(h({},e),{status:{type:"DISPOSED"},zoom:null,pan:null,cursor:"auto"});case"on-camera-zoom-start":return h(h({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return h(h({},e),{isCameraZooming:!1});case"on-camera-move-start":return h(h({},e),{isCameraMoving:!0});case"on-camera-move-end":return h(h({},e),{isCameraMoving:!1});case"on-cursor-change":return h(h({},e),{cursor:t.cursor});default:return e}},Be=function(n){var r=t(null),i=t(null),u=a(ke,{pan:null,zoom:null,status:{type:"IDLE"},isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),l=u[0],c=l.status,d=l.zoom,p=l.pan,g=l.isCameraZooming,v=l.isCameraMoving,f=l.cursor,m=u[1],y=o((function(e){return m({type:"on-zoom",zoom:e})}),[]),b=o((function(e,t){return m({type:"on-pan",pan:{x:e,y:t}})}),[]),w=o((function(e){m({type:"on-status",status:e})}),[]),C=o((function(){return m({type:"on-camera-zoom-start"})}),[]),P=o((function(){return m({type:"on-camera-zoom-end"})}),[]),E=o((function(){return m({type:"on-camera-move-start"})}),[]),M=o((function(){return m({type:"on-camera-move-end"})}),[]),L=o((function(e){return m({type:"on-cursor-change",cursor:e})}),[]),x=o((function(){if(r.current){var e=r.current.getPan();m({type:"on-pan",pan:e})}}),[]),S=o((function(){var e=r.current;e&&($.logDebug("Provider dispose"),e.off("status",w),e.off("cameraZoomChange",y),e.off("cameraPanChange",b),e.off("cameraZoomStart",C),e.off("cameraZoomEnd",P),e.off("cameraMoveStart",E),e.off("cameraMoveEnd",M),e.off("cursorChange",L),e.off("sceneChange",x),e.dispose(),r.current=null,m({type:"dispose"}))}),[w,b,y,C,P,E,M,L,x]),R=o((function(e,t,n){if(""!==e&&t&&n&&i.current){$.logDebug("Provider init");var o=new Re(h(h({},i.current),{filePath:e,container:n,canvas:t,manualInitialization:!0}));o.on("status",w),o.on("cameraZoomChange",y),o.on("cameraPanChange",b),o.on("cameraZoomStart",C),o.on("cameraZoomEnd",P),o.on("cameraMoveStart",E),o.on("cameraMoveEnd",M),o.on("cursorChange",L),o.on("sceneChange",x),r.current=o,o.init()}}),[w,y,b,C,P,E,M,L,x]),W=o((function(e){var t,n,o,a,s;$.logDebug("Provider setSettings"),e.backgroundColor&&(null===(t=r.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),null===(n=r.current)||void 0===n||n.gestureManager.setInvertedWheelZoom(e.invertedWheelZoom||!1),null===(o=r.current)||void 0===o||o.selectArtboard(e.selectedArtboard||null),null===(a=r.current)||void 0===a||a.setOnlyShowFrames(null!==(s=e.onlyShowFrameIds)&&void 0!==s?s:[]),i.current=e}),[]),F=o((function(){return r.current}),[]),T=s((function(){return{dispose:S,init:R,setSettings:W,getInstance:F,dispatch:m}}),[S,R,W,F]);return e.createElement(Ge.Provider,{value:T},e.createElement(We.Provider,{value:c},e.createElement(Fe.Provider,{value:d},e.createElement(Ae.Provider,{value:p},e.createElement(Te.Provider,{value:g},e.createElement(Ie.Provider,{value:v},e.createElement(De.Provider,{value:f},n.children)))))))},ze=function(e,t){var n=(0,Ue().getInstance)();u((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},Ze=function(){var e=i(We);if(void 0===e)throw Error("useStatus must be used within a provider");return e},Oe=function(){var e=i(Fe);if(void 0===e)throw Error("useZoom must be used within a provider");return e},Ne=function(){var e=i(Ae);if(void 0===e)throw Error("usePan must be used within a provider");return e},He=function(){var e=i(De);if(void 0===e)throw Error("useCursor must be used within a provider");return e},_e=function(){var e=i(Te);if(void 0===status)throw Error("useIsCameraZooming must be used within a provider");return e},je=function(){var e=i(Ie);if(void 0===status)throw Error("useIsCameraMoving must be used within a provider");return e},Ve=function(){var e=(0,Ue().getInstance)(),t=Ze();return s((function(){return e&&"READY"===t.type?e.getPRFile():null}),[e,t])},Je=function(){var e=(0,Ue().getInstance)(),t=Ze();return s((function(){return e&&"READY"===t.type?e.getPRFileArtboards():null}),[e,t])},Ke=function(){var e,t,n,o,r=Ve(),i=l(null),a=i[0],c=i[1],d=X((function(){c((function(e){var t,n,o,i=null!==(o=null===(n=null===(t=j(r))||void 0===t?void 0:t.getRootNode())||void 0===n?void 0:n.getAbsoluteExtent())&&void 0!==o?o:null;return(null==e?void 0:e.width)===(null==i?void 0:i.width)&&(null==e?void 0:e.height)===(null==i?void 0:i.height)&&(null==e?void 0:e.x)===(null==i?void 0:i.x)&&(null==e?void 0:e.y)===(null==i?void 0:i.y)?e:i}))}),16);ze("sceneChange",d),u((function(){d()}),[d]);var h=null!==(e=null==a?void 0:a.x)&&void 0!==e?e:0,p=null!==(t=null==a?void 0:a.y)&&void 0!==t?t:0,g=null!==(n=null==a?void 0:a.width)&&void 0!==n?n:0,v=null!==(o=null==a?void 0:a.height)&&void 0!==o?o:0;return s((function(){return{x:h,y:p,width:g,height:v}}),[h,p,g,v])},Ye=function(){var e=(0,Ue().getInstance)();return o((function(t){null==e||e.setZoom(t)}),[e])},$e=function(){var e=Ye(),t=Oe();return o((function(){var n;"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},Xe=function(){var e=Ye(),t=Oe();return o((function(){"number"==typeof t&&e(t/2)}),[e,t])},qe=function(){var e=(0,Ue().getInstance)();return o((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;null==e||e.setPan(n,o,r)}),[e])},Qe=function(){var e=(0,Ue().getInstance)();return o((function(){null==e||e.zoomToFit()}),[e])},et=function(){var e=(0,Ue().getInstance)();return o((function(t,n,o){null==e||e.zoomToFitNode(t,n,o)}),[e])},tt=function(){var e=(0,Ue().getInstance)();return o((function(){null==e||e.looseWebGLContext()}),[e])},nt=function(){var e=(0,Ue().getInstance)();return o((function(t,n){return p(void 0,void 0,void 0,(function(){return g(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},ot=function(){var e=(0,Ue().getInstance)();return o((function(t,n){return p(void 0,void 0,void 0,(function(){return g(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},rt=function(){var e=(0,Ue().getInstance)();return o((function(t){null==e||e.setIsCameraLocked(t)}),[e])},it=function(){var e=(0,Ue().getInstance)();return o((function(t,n){if(!e)return null;var o=e.mapRelativePositionToCameraPosition(t,n);return null!=o?o:null}),[e])},at=function(){var e,t=(0,Ue().getInstance)(),n=Je(),r=null!==(e=null==t?void 0:t.getOnlyShowFrameIds())&&void 0!==e?e:[],i=l(1===r.length?r[0]:null),a=i[0],s=i[1],u=o((function(e){s(1===e.length?e[0]:null)}),[]);ze("onlyShowFramesChange",u);var c=o((function(e){var o,r;if(null===e)return null==t||t.setOnlyShowFrames([]),void(null==t||t.zoomToFit());null==t||t.setOnlyShowFrames([e]);var i=null===(r=null===(o=null==n?void 0:n.find((function(t){return t.objectId===e})))||void 0===o?void 0:o.getNode())||void 0===r?void 0:r.getIdentifier();void 0!==i&&(null==t||t.zoomToFitNode(i))}),[t,n]);return[a,c]},st=function(){var e=(0,Ue().getInstance)(),t=Ve();return o((function(n,o){return e&&t?e.exportNode(n,o):Promise.reject("WebRenderer instance not ready")}),[e,t])};function ut(e){var n=t(e);n.current=e;var r=o((function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];n.current.apply(n,v([e],t,!1))}),[]);u((function(){return $.on("log",r),function(){$.off("log",r)}}),[r])}var lt=function(){var e=Ue().getInstance;return o((function(){var t=e();t&&t.loadAllFragments()}),[e])},ct={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},dt={position:"absolute",top:0,left:0},ht=function(n){var r=n.filePath,i=n.locateFile,a=n.imagesURLFormat,c=n.imagesURLMap,d=n.fragmentsURLFormat,p=n.fragmentsURLMap,g=n.backgroundColor,v=n.mode,f=n.showTilesBorders,m=n.minimumZoomLevel,y=n.maximumZoomLevel,b=n.preserveDrawingBuffer,w=n.panBoundariesPadding,C=n.initialPan,P=n.initialZoom,E=n.children,M=n.containerProps,L=n.canvasProps,x=n.featureFlags,S=n.selectedArtboard,R=n.showArtboardsDecorations,W=n.invertedWheelZoom,F=t(null),T=t(null),I=l(!1),A=I[0],D=I[1],G=o((function(){return D(!0)}),[]),U=Ue(),k=U.dispose,B=U.init,z=U.setSettings,Z=He(),O=Ze();ze("allImagesReady",G),u((function(){return $.logDebug("CanvasRenderer mounted"),function(){return $.logDebug("CanvasRenderer unmounted")}}),[]),u((function(){z({locateFile:i,imagesURLFormat:a,imagesURLMap:c,fragmentsURLFormat:d,fragmentsURLMap:p,backgroundColor:g,mode:v,showTilesBorders:f,minimumZoomLevel:m,maximumZoomLevel:y,preserveDrawingBuffer:b,panBoundariesPadding:w,initialPan:C,initialZoom:P,featureFlags:x,selectedArtboard:S,showArtboardsDecorations:R,invertedWheelZoom:W})}),[z,i,a,c,d,p,g,v,f,m,y,b,w,C,P,x,S,R,W]),u((function(){if(r)return B(r,F.current,T.current),function(){k()}}),[k,B,r]);var N=s((function(){var e;return null!==(e=n.cursor)&&void 0!==e?e:Z}),[n.cursor,Z]),H=s((function(){return h(h({},ct),{cursor:N})}),[N]);return e.createElement("div",h({},M,{ref:T,style:H}),r&&e.createElement("canvas",h({},L,{key:r,ref:F,"data-sketchweb-all-images-ready":A,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==O?void 0:O.type.toLowerCase())||"null"),style:dt})),"READY"===(null==O?void 0:O.type)&&E)},pt=function(){function e(e,t,n,o){this.prototypeStructure=e,this.startArtboardUUID=t,this.canvas=n,this.container=o,this.locateFile="/{file}",this.imagesURLFormat="",this.imagesURLMap={},this.fragmentsURLFormat="",this.fragmentsURLMap={},this.backgroundColor={r:0,g:0,b:0,a:1},this.mode=S.release,this.showTilesBorders=!1,this.minimumZoomLevel=5,this.maximumZoomLevel=.01,this.preserveDrawingBuffer=!1,this.featureFlags=A,this.manualInitialization=!1,this.highlightHotspots=!0,this.resizeMode=R.Fit,this.assetsManagerLimits={maxDepthForBackgroundRequests:1,maxArtboardsForBackgroundRequests:5,maxInitialLoadingDepth:2,maxInitialArtboardToLoad:10},this.disableInteraction=!1}return e.FromSettings=function(t){return Object.assign(new e(t.prototypeStructure,t.startArtboardUUID,t.canvas,t.container),Object.fromEntries(Object.entries(t).filter((function(e){return void 0!==e[1]}))))},e}(),gt=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,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;n.wasmModule&&n.userEventsCollectorWasm.dispatchWheelEvent(e.x,e.y,null===(o=n.wasmModule)||void 0===o?void 0:o.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerDownEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchGlobalPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerUpEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.restartPrototype=function(e){var t;null===(t=n.playerWasm)||void 0===t||t.restartPrototype(e)},n.navigateToFirstFlow=function(){var e;null===(e=n.playerWasm)||void 0===e||e.navigateToFirstFlow()},n.goBack=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goBack()},n.goForwards=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goForwards()},n.setResizeMode=function(e){var t;if(n.wasmModule){var o=n.wasmModule.mapResizeMode(e);null===(t=n.playerWasm)||void 0===t||t.setResizeMode(o)}},n.getScreen=function(e){var t;void 0===e&&(e=!0);var o=null===(t=n.playerWasm)||void 0===t?void 0:t.getJSScreen(e);return o?{layers:O(o.layers)}:{layers:[]}},n.settings=pt.FromSettings(t),$.logDebug("PrototypeRenderer JS constructed with settings:",n.settings),n.gestureManager=new V(n.settings.container,!1,n.settings.disableInteraction),n.canvasManager=new q({container:n.settings.container,canvas:n.settings.canvas,maxPixelRatio:3}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return d(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 p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return[4,x()];case 1:return e=t.sent(),this.deviceInfo=h(h({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.detectWebGLVersion=function(){this.webglVersion=Z(this.deviceInfo),$.logDebug("Using WebGL ".concat(this.webglVersion))},t.prototype.init=function(){return p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),[4,this.collectAndEmitDeviceInfo()];case 1:t.sent(),this.detectWebGLVersion(),t.label=2;case 2:return t.trys.push([2,6,,7]),[4,this.initWasmModule()];case 3:return t.sent(),[4,this.initPlayerWasm()];case 4:return t.sent(),[4,this.startDownload()];case 5:return t.sent(),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initWasmModule=function(){var e;return p(this,void 0,void 0,(function(){var t;return g(this,(function(n){switch(n.label){case 0:return this.disposed?[2]:(t=new K("WasmModuleDownload"),this.wasmModule=new Q({mode:this.settings.mode,locateFile:this.settings.locateFile,jsBridge:this.createJSBridge(),featureFlags:this.settings.featureFlags,webglVersion:this.webglVersion}),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()]);case 1:return n.sent(),t.printMeasurement(),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.startDownload=function(){var e=this;return this.setStatus({type:"LOADING_FILE"}),new Promise((function(t){var n;null===(n=e.playerWasm)||void 0===n||n.startDownload((function(){t()}))}))},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.playerWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t,n){return e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t].replace(":format",n):e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t).replace(":format",n):($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):($.logWarning("Not able to resolve the url for the fragment 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,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},onPrototypeStateWillChange:function(t,n,o){e.emit("prototypeStateWillChange",{currentArtboardId:t,canGoBack:n,canGoForwards:o})},onPrototypeStateChange:function(t,n,o){e.emit("prototypeStateChange",{currentArtboardId:t,canGoBack:n,canGoForwards:o})},fetch:this.handleJSBridgeFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onPrototypeUnhandledPointerUp:function(){e.emit("prototypeUnhandledPointerUp")},onSceneChange:function(){e.emit("sceneChange")}}},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){return p(n,void 0,void 0,(function(){var n,i,a,s,u,l,c,d,h;return g(this,(function(p){switch(p.label){case 0:if(this.disposed||!this.wasmModule)return[2];if(t.data.url!==e)return[2];switch(t.data.type){case"success":return[3,1];case"error":return[3,5]}return[3,6];case 1:return n={statusCode:200,statusText:"OK",contentType:t.data.contentType,isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0},/image/.test(t.data.contentType)?(i=new Blob([t.data.buffer]),[4,ee(URL.createObjectURL(i))]):[3,3];case 2:return a=p.sent(),this.wasmModule?(s=this.wasmModule.createWebGLTextureFromImage(a,this.webglCtxHandle),n.buffer=new Uint8Array(0),n.isWebGLTexture=!0,n.emscriptenWebGLTextureHandle=s,n.width=a.width,n.height=a.height,[3,4]):[2];case 3:n.buffer=new Uint8Array(t.data.buffer),p.label=4;case 4:return o.exec(n),[3,7];case 5:return $.logError("Error while fetching ".concat(e),t.data.error),o.exec({buffer:new Uint8Array(0),statusCode:null!==(l=null===(u=t.data.error)||void 0===u?void 0:u.statusCode)&&void 0!==l?l:500,statusText:null!==(d=null===(c=t.data.error)||void 0===c?void 0:c.statusText)&&void 0!==d?d:"Unknown error",contentType:null!==(h=t.data.contentType)&&void 0!==h?h:"",isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0}),[3,7];case 6:return[3,7];case 7:return this.fetchWorker.removeEventListener("message",r),[2]}}))}))};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initPlayerWasm=function(){var e,t;return p(this,void 0,void 0,(function(){var n,o,r,i,a,s,u,l,c,d,p,v,f,m,y,b,w,C,P,E,M;return g(this,(function(g){try{if(!this.wasmModule)throw Error("WASM module not initialized");for(this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:this.webglVersion}),n=this.wasmModule.instance,o=n.RenderTarget,r=n.PrototypeRendererWasm,i=n.PrototypeStructureArtboardVector,a=n.PrototypeStructureFlowVector,s=n.PrototypeStructureAssetVector,u=n.PrototypeStructureFlowTypeEnum,this.renderTarget=o.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),l={artboards:new i},c={Overlay:u.Overlay,Screen:u.Screen},d=0,p=this.settings.prototypeStructure.artboards;d<p.length;d++){for(v=p[d],f=new a,m=0,y=null!==(e=v.flows)&&void 0!==e?e:[];m<y.length;m++)b=y[m],f.push_back(h(h({},b),{type:c[b.type]}));for(w=new s,C=0,P=null!==(t=v.assets)&&void 0!==t?t:[];C<P.length;C++)E=P[C],w.push_back(E);l.artboards.push_back(h(h({},v),{flows:f,assets:w}))}this.playerWasm=new r(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders},this.settings.startArtboardUUID,l,this.settings.highlightHotspots,this.settings.assetsManagerLimits)}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the PrototypeRenderer WASM object.",e)}if(!(M=this.playerWasm.getUserEventsCollector()))throw new W("WASM_ERROR","An error occurred while trying to create the user events collector");return this.userEventsCollectorWasm=M,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),this.setResizeMode(this.settings.resizeMode),[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"}))},t.prototype.looseWebGLContext=function(){var e;null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},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()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("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.getArtboardAtPosition=function(e,t){var n=this.playerWasm;if(!n)return null;for(var o=n.getJSScreen(!1),r=n.getPan(),i=n.getZoom(),a=(e-r.x)/i,s=(t-r.y)/i,u=o.layers.size()-1;u>=0;u-=1){var l=o.layers.get(u);if(l&&"artboard"===l.type){var c=l.bounds.x+l.bounds.width,d=l.bounds.y+l.bounds.height;if(a>=l.bounds.x&&s>=l.bounds.y&&a<=c&&s<=d)return l.getNode()}}return null},t.prototype.disposeFetchWorker=function(){this.fetchWorker.postMessage({type:"abort-all"}),this.fetchWorker.terminate()},t.prototype.dispose=function(){var e,t,n;try{this.disposeFetchWorker(),this.detachAllListeners(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.playerWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.playerWasm)||void 0===n||n.delete(),this.renderTarget.delete(),this.playerWasm=void 0,this.wasmModule=void 0,this.disposed=!0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the WebRendererWasm object",e))}},t.prototype.mapRelativePositionToCameraPosition=function(e,t){var n=this.playerWasm;return n?n.mapRelativePositionToCameraPosition(e,t):null},t.prototype.updateHighlightHotspotsSetting=function(e){var t=this.playerWasm;if(!t)return null;t.updateHighlightHotspotsSetting(e)},t}(T),vt=r(void 0),ft=r("auto"),mt=r(void 0),yt=r(void 0),bt=r(void 0),wt=r(void 0),Ct=function(){var e=i(wt);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},Pt=function(e,t){switch(t.type){case"on-status":return h(h({},e),{status:t.status});case"dispose":return h(h({},e),{status:{type:"DISPOSED"},cursor:"auto"});case"on-cursor-change":return h(h({},e),{cursor:t.cursor});case"on-prototype-state-will-change":return h(h({},e),{prototypeState:h(h({},e.prototypeState),{isChanging:!0})});case"on-prototype-state-change":return h(h({},e),{prototypeState:h(h(h({},e.prototypeState),t.prototypeState),{isChanging:!1})});case"on-zoom":return h(h({},e),{zoom:t.zoom});case"on-pan":return h(h({},e),{pan:{x:t.pan.x,y:t.pan.y}});default:return e}},Et=function(n){var r=t(null),i=t(null),u=a(Pt,{status:{type:"IDLE"},cursor:"auto",prototypeState:{currentArtboardId:"",canGoBack:!1,canGoForwards:!1,isChanging:!1},zoom:1,pan:{x:0,y:0}}),l=u[0],c=l.status,d=l.cursor,p=l.prototypeState,g=l.zoom,v=l.pan,f=u[1],m=o((function(e){f({type:"on-status",status:e})}),[]),y=o((function(e){return f({type:"on-zoom",zoom:e})}),[]),b=o((function(e,t){return f({type:"on-pan",pan:{x:e,y:t}})}),[]),w=o((function(e){return f({type:"on-cursor-change",cursor:e})}),[]),C=o((function(){return f({type:"on-prototype-state-will-change"})}),[]),P=o((function(e){return f({type:"on-prototype-state-change",prototypeState:e})}),[]),E=o((function(){var e=r.current;e&&($.logDebug("Provider dispose"),e.off("status",m),e.off("cursorChange",w),e.off("prototypeStateWillChange",C),e.off("prototypeStateChange",P),e.off("cameraZoomChange",y),e.off("cameraPanChange",b),e.dispose(),r.current=null,f({type:"dispose"}))}),[m,w,C,P,b,y]),M=o((function(e,t){if(e&&t&&i.current){$.logDebug("Provider init");var n=new gt(h(h({},i.current),{container:t,canvas:e,manualInitialization:!0}));n.on("status",m),n.on("cursorChange",w),n.on("prototypeStateWillChange",C),n.on("prototypeStateChange",P),n.on("cameraZoomChange",y),n.on("cameraPanChange",b),r.current=n,n.init()}}),[m,w,C,P,b,y]),L=o((function(e){var t,n,o,a,s,u,l,c;$.logDebug("Provider setSettings"),e.backgroundColor&&e.backgroundColor!=(null===(t=i.current)||void 0===t?void 0:t.backgroundColor)&&(null===(n=r.current)||void 0===n||n.setBackgroundColor(e.backgroundColor)),(null===(o=i.current)||void 0===o?void 0:o.resizeMode)!=e.resizeMode&&(null===(a=r.current)||void 0===a||a.setResizeMode(e.resizeMode||R.Fit)),void 0!==e.highlightHotspots&&(null===(s=i.current)||void 0===s?void 0:s.highlightHotspots)!==e.highlightHotspots&&(null===(u=r.current)||void 0===u||u.updateHighlightHotspotsSetting(e.highlightHotspots)),e.disableInteraction!==(null===(l=i.current)||void 0===l?void 0:l.disableInteraction)&&(null===(c=r.current)||void 0===c||c.gestureManager.setDisable(e.disableInteraction||!1)),i.current=e}),[]),x=o((function(){return r.current}),[]),S=s((function(){return{dispose:E,init:M,setSettings:L,getInstance:x,dispatch:f}}),[E,M,L,x]);return e.createElement(wt.Provider,{value:S},e.createElement(vt.Provider,{value:c},e.createElement(ft.Provider,{value:d},e.createElement(mt.Provider,{value:p},e.createElement(yt.Provider,{value:g},e.createElement(bt.Provider,{value:v},n.children))))))},Mt=function(){var e=(0,Ct().getInstance)();return o((function(t){null==e||e.restartPrototype(t)}),[e])},Lt=function(){var e=(0,Ct().getInstance)();return o((function(){null==e||e.navigateToFirstFlow()}),[e])},xt=function(){var e=(0,Ct().getInstance)();return o((function(){null==e||e.goBack()}),[e])},St=function(){var e=(0,Ct().getInstance)();return o((function(){null==e||e.goForwards()}),[e])},Rt=function(){var e=(0,Ct().getInstance)();return o((function(t,n){return p(void 0,void 0,void 0,(function(){return g(this,(function(o){return[2,null==e?void 0:e.getArtboardAtPosition(t,n)]}))}))}),[e])},Wt=function(){var e=(0,Ct().getInstance)();return o((function(t,n){if(!e)return null;var o=e.mapRelativePositionToCameraPosition(t,n);return null!=o?o:null}),[e])},Ft=function(){var e=i(vt);if(void 0===e)throw Error("usePrototypeStatus must be used within a provider");return e},Tt=function(){var e=i(ft);if(void 0===e)throw Error("usePrototypeCursor must be used within a provider");return e},It=function(){var e=i(mt);if(void 0===e)throw Error("usePrototypeState must be used within a provider");return e},At=function(){var e=i(yt);if(void 0===e)throw Error("usePrototypeZoom must be used within a provider");return e},Dt=function(){var e=i(bt);if(void 0===e)throw Error("usePrototypePan must be used within a provider");return e},Gt=function(e,t){var n=(0,Ct().getInstance)();u((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])};function Ut(){var e=(0,Ct().getInstance)();return o((function(t){return void 0===t&&(t=!0),null==e?void 0:e.getScreen(t)}),[e])}var kt={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Bt={position:"absolute",top:0,left:0},zt=function(n){var o=n.locateFile,r=n.imagesURLFormat,i=n.imagesURLMap,a=n.backgroundColor,l=n.mode,c=n.showTilesBorders,d=n.minimumZoomLevel,p=n.maximumZoomLevel,g=n.preserveDrawingBuffer,v=n.children,f=n.containerProps,m=n.canvasProps,y=n.featureFlags,b=n.startArtboardUUID,w=n.prototypeStructure,C=n.fragmentsURLFormat,P=n.fragmentsURLMap,E=n.highlightHotspots,M=n.resizeMode,L=n.assetsManagerLimits,x=n.cursor,S=n.disableInteraction,R=t(null),W=t(null),F=Ct(),T=F.dispose,I=F.init,A=F.setSettings,D=Ft(),G=Tt(),U=("function"==typeof x?x(G):x)||G;u((function(){return $.logDebug("PrototypeRenderer mounted"),function(){return $.logDebug("PrototypeRenderer unmounted")}}),[]),u((function(){A({locateFile:o,imagesURLFormat:r,imagesURLMap:i,backgroundColor:a,mode:l,showTilesBorders:c,minimumZoomLevel:d,maximumZoomLevel:p,preserveDrawingBuffer:g,featureFlags:y,startArtboardUUID:b,prototypeStructure:w,fragmentsURLFormat:C,fragmentsURLMap:P,highlightHotspots:E,resizeMode:M,assetsManagerLimits:L,disableInteraction:S})}),[A,o,r,i,a,l,c,d,p,g,y,b,E,M,C,P,w,L,S]),u((function(){return I(R.current,W.current),function(){T()}}),[T,I]);var k=s((function(){return h(h({},kt),{cursor:U})}),[U]);return e.createElement("div",h({},f,{ref:W,style:k}),e.createElement("canvas",h({},m,{ref:R,"data-testid":"prototype-canvas","data-prototype-status":"prototype-status-".concat((null==D?void 0:D.type.toLowerCase())||"null"),style:Bt})),"READY"===(null==D?void 0:D.type)&&v)},Zt={position:"absolute",inset:0,pointerEvents:"none"};function Ot(t){var n=t.visualize,r=void 0!==n&&n,i=Ut(),a=l((function(){return i()||null})),u=a[0],c=a[1],d=o((function(){c(i()||null)}),[i]);Gt("sceneChange",d);var p=s((function(){return h(h({},Zt),{opacity:r?1:0})}),[r]);return u?e.createElement("div",{style:p},u.layers.map((function(t,n){return e.createElement(Nt,{key:"".concat(n,"/").concat(t.id),bounds:t.bounds,id:t.id,name:t.name,type:t.type})}))):null}function Nt(t){var n=t.bounds,o=t.name,r=t.id,i=t.type,a=At(),u=Dt()||{x:0,y:0},l=u.x,c=u.y,d=s((function(){return h({position:"absolute",left:l/window.devicePixelRatio+n.x*a,top:c/window.devicePixelRatio+n.y*a,width:n.width*a,height:n.height*a,backgroundColor:"rgba(0, 255, 255, 0.2)",border:"2px dotted white"},"hotspot"===i?{cursor:"pointer",pointerEvents:"auto"}:{})}),[n.x,n.y,n.width,n.height,l,c,a,i]);return e.createElement("div",{style:d,"data-testid":"".concat(i,"-").concat(Ht(o),"-").concat(r),"data-entity-name":o,"data-entity-id":r,"data-entity-bounds-x":n.x,"data-entity-bounds-y":n.x,"data-entity-bounds-width":n.width,"data-entity-bounds-height":n.height})}function Ht(e){var t,n;return null!==(n=null===(t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))||void 0===t?void 0:t.join("-").toLowerCase())&&void 0!==n?n:""}export{Ie as CameraMoveContext,Te as CameraZoomingContext,Re as CanvasRenderer,Be as CanvasRendererProvider,ht as CanvasRendererReact,De as CursorContext,A as DefaultFeatureFlags,T as EventEmitter,V as GestureManager,J as KeyboardManager,I as ListenersCollector,Pe as PRCursorType,me as PRLayerSizingBehaviour,ce as PRMarinaBlendMode,ne as PRMarinaExportFormatType,le as PRMarinaLayerBlurType,ae as PRMarinaLayerBorderPosition,he as PRMarinaLayerCornerStyle,oe as PRMarinaLayerFillType,ie as PRMarinaLayerGradientType,ge as PRMarinaLayerHorizontalTextAlignment,re as PRMarinaLayerImageFillType,se as PRMarinaLayerLineCap,ue as PRMarinaLayerLineJoin,fe as PRMarinaLayerTextDecoration,pe as PRMarinaLayerTextTransform,de as PRMarinaLayerType,ve as PRMarinaLayerVerticalTextAlignment,te as PRMarinaVisibleScaleType,Ee as PRNodeExportFormat,we as PRStackCrossAxisAlignment,ye as PRStackDirection,be as PRStackMainAxisAlignment,Ce as PRUserPointerType,Ae as PanContext,K as Performance,gt as PrototypeRenderer,Et as PrototypeRendererProvider,zt as PrototypeRendererReact,R as PrototypeResizeMode,Le as PrototypeResizeModeWasm,Me as PrototypeStructureFlowType,Ot as PrototypeTestOverlay,We as StatusContext,W as WebRendererError,S as WebRendererMode,Fe as ZoomContext,z as clamp,O as convertEmbindVectorToArray,k as debounce,B as extractPointer,Z as getSupportedWebGLVersion,D as getiOSVersion,F as isDefinedPresentationManifestFrame,N as isTouchDevice,$ as logger,Y as nextTick,U as parseSafariUserAgent,ke as reducer,H as removeUndefinedKeys,j as safePtrAccess,_ as touchableClick,He as useCursor,X as useDebounceFunction,Xe as useDecrementZoom,ze as useEvent,st as useExportNode,nt as useGetArtboardAtPosition,ot as useGetPanAtPosition,Ut as useGetScreen,xt as useGoBack,St as useGoForwards,$e as useIncrementZoom,je as useIsCameraMoving,_e as useIsCameraZooming,lt as useLoadAllFragments,rt as useLockCamera,ut as useLogEvent,tt as useLooseWebGLContext,it as useMapRelativePositionToCameraPosition,Lt as useNavigateToFirstFlow,Ve as usePRFile,Je as usePRFileArtboards,Ne as usePan,Tt as usePrototypeCursor,Gt as usePrototypeEvent,Rt as usePrototypeGetArtboardAtPosition,Wt as usePrototypeMapRelativePositionToCameraPosition,Dt as usePrototypePan,It as usePrototypeState,Ft as usePrototypeStatus,At as usePrototypeZoom,Mt as useRestartPrototype,Ke as useRootNodeAbsoluteExtent,qe as useSetPan,Ye as useSetZoom,at as useShowSingleFrame,Ze as useStatus,Oe as useZoom,Qe as useZoomToFit,et as useZoomToFitNode};
1
+ import e,{useRef as t,useLayoutEffect as n,useCallback as o,createContext as r,useContext as i,useReducer as a,useMemo as s,useEffect as u,useState as l}from"react";var c=function(e,t){return c=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])},c(e,t)};function d(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}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var h=function(){return h=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},h.apply(this,arguments)};function p(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}function g(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(u){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,u])}}}function v(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 f(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))}const m=["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 ?\((.+)\)(?: on vulkan [0-9.]+)?$/i,"$1").replace(/\s(\d{1,2}gb|direct3d.+$)|\(r\)| \([^)]+\)$/g,"").replace(/(?:vulkan|opengl) \d+\.\d+(?:\.\d+)?(?: \((.*)\))?/,"$1")}const b="undefined"==typeof window,w=(()=>{if(b)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)}})();class C extends Error{constructor(e){super(e),Object.setPrototypeOf(this,new.target.prototype)}}const P=[],E=[];function M(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,u,l=0,c=0,d=0;for(;c<o;)E[c]=e.charCodeAt(a+c),P[c]=++c;for(;d<r;)for(i=t.charCodeAt(a+d),s=d++,l=d,c=0;c<o;c++)u=i===E[c]?s:s+1,s=P[c],l=P[c]=s>l?u>l?l+1:u:u>s?s+1:u;return l}function L(e){return null!=e}const x=({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@5.0.25/dist/benchmarks"}={})=>f(void 0,void 0,void 0,(function*(){const a={};if(b)return{tier:0,type:"SSR"};const{isIpad:s=!!(null==w?void 0:w.isIpad),isMobile:u=!!(null==w?void 0:w.isMobile),screenSize:l=window.screen,loadBenchmarks:c=(e=>f(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 C("Detect GPU benchmark data is out of date. Please update to version 4x");return t})))}=n;let{renderer:d}=n;const h=(e,t,n,o,r)=>({device:r,fps:o,gpu:n,isMobile:u,tier:e,type:t});let p,g="";if(d)d=y(d),p=[d];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==w?void 0:w.isSafari12,r);if(!e)return h(0,"WEBGL_UNSUPPORTED");const t=e.getExtension("WEBGL_debug_renderer_info");if(t&&(d=e.getParameter(t.UNMASKED_RENDERER_WEBGL)),!d)return h(1,"FALLBACK");g=d,d=y(d),p=function(e,t,n){return"apple gpu"===t?function(e,t,n){if(!n)return[t];const o=function(e){const t=e.createShader(35633),n=e.createShader(35632),o=e.createProgram();if(!(n&&t&&o))return;e.shaderSource(t,"\n precision highp float;\n attribute vec3 aPosition;\n varying float vvv;\n void main() {\n vvv = 0.31622776601683794;\n gl_Position = vec4(aPosition, 1.0);\n }\n "),e.shaderSource(n,"\n precision highp float;\n varying float vvv;\n void main() {\n vec4 enc = vec4(1.0, 255.0, 65025.0, 16581375.0) * vvv;\n enc = fract(enc);\n enc -= enc.yzww * vec4(1.0 / 255.0, 1.0 / 255.0, 1.0 / 255.0, 0.0);\n gl_FragColor = enc;\n }\n "),e.compileShader(t),e.compileShader(n),e.attachShader(o,t),e.attachShader(o,n),e.linkProgram(o),e.detachShader(o,t),e.detachShader(o,n),e.deleteShader(t),e.deleteShader(n),e.useProgram(o);const r=e.createBuffer();e.bindBuffer(34962,r),e.bufferData(34962,new Float32Array([-1,-1,0,3,-1,0,-1,3,0]),35044);const i=e.getAttribLocation(o,"aPosition");e.vertexAttribPointer(i,3,5126,!1,0,0),e.enableVertexAttribArray(i),e.clearColor(1,1,1,1),e.clear(16384),e.viewport(0,0,1,1),e.drawArrays(4,0,3);const a=new Uint8Array(4);return e.readPixels(0,0,1,1,6408,5121,a),e.deleteProgram(o),e.deleteBuffer(r),a.join("")}(e),r="801621810",i="8016218135",a="80162181161",s=(null==w?void 0:w.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 u;return"80162181255"===o?u=s.filter((([,,e])=>e>=14)):(u=s.filter((([,e])=>e===o)),u.length||(u=s)),u.map((([e])=>`apple ${e} gpu`))}(e,t,n):[t]}(e,d,u)}const v=(yield Promise.all(p.map((function(e){var t;return f(this,void 0,void 0,(function*(){const n=(e=>{const t=u?["adreno","apple","mali-t","mali","nvidia","powervr","samsung"]:["intel","apple","amd","radeon","nvidia","geforce"];for(const n of t)if(e.includes(n))return n})(e);if(!n)return;const o=`${u?"m":"d"}-${n}${s?"-ipad":""}.json`,r=a[o]=null!==(t=a[o])&&void 0!==t?t:c(o);let i;try{i=yield r}catch(n){if(n instanceof C)throw n;return}const d=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 h=i.filter((([,e])=>e===d));h.length||(h=i.filter((([t])=>t.includes(e))));const p=h.length;if(0===p)return;const g=e.split(/[.,()\[\]/\s]/g).sort().filter(((e,t,n)=>0===t||e!==n[t-1])).join(" ");let v,[f,,,,m]=p>1?h.map((e=>[e,M(g,e[2])])).sort((([,e],[,t])=>e-t))[0][0]:h[0],y=Number.MAX_VALUE;const{devicePixelRatio:b}=window,w=l.width*b*l.height*b;for(const e of m){const[t,n]=e,o=t*n,r=Math.abs(w-o);r<y&&(y=r,v=e)}if(!v)return;const[,,P,E]=v;return[y,P,f,E]}))})))).filter(L).sort((([e=Number.MAX_VALUE,t],[n=Number.MAX_VALUE,o])=>e===n?t-o:e-n));if(!v.length){const e=m.find((e=>d.includes(e)));return e?h(0,"BLOCKLISTED",e):h(1,"FALLBACK",`${d} (${g})`)}const[,P,E,x]=v[0];if(-1===P)return h(0,"BLOCKLISTED",E,P,x);const S=u?e:t;let R=0;for(let e=0;e<S.length;e++)P>=S[e]&&(R=e);return h(R,"BENCHMARK",E,P,x)}));var S,R,W=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 d(t,e),t}(Error);function F(e){return void 0!==e}!function(e){e.debug="debug",e.release="release"}(S||(S={})),function(e){e.Fit="Fit",e.FillWidth="FillWidth",e.ActualSize="ActualSize"}(R||(R={}));var T=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,v([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}(),I=function(){function e(e){void 0===e&&(e=!1),this.removeListenerCallbacks=[],this.disabled=e}return e.prototype.add=function(e,t,n,o){var r=this,i=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.disabled||n.apply(void 0,e)};e.addEventListener(t,i,o);var a=function(){e.removeEventListener(t,i,o)};return this.removeListenerCallbacks.push(a),a},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e.prototype.setDisabled=function(e){this.disabled=e},e}(),A={delayedDraw:!0,offscreenCanvas:!1,useDirtyRectsRendering:!0,safariWebGL2:!1,pageBoundariesLimit:!1,canvasLayersEvents:!1},D=function(e){return parseFloat((""+(/CPU.*OS ([0-9_]{1,5})|(CPU like).*AppleWebKit.*Mobile/i.exec(e)||[0,""])[1]).replace("undefined","3_2").replace("_",".").replace("_",""))||!1},G=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,U=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}}};function k(e,t){var n;function o(){for(var o=[],r=0;r<arguments.length;r++)o[r]=arguments[r];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,o)}),t)}return o.cancel=function(){n&&clearTimeout(n)},o}function B(e){var t,n,o,r,i,a=null!==(n=null===(t=e.touches)||void 0===t?void 0:t[0])&&void 0!==n?n:null===(o=e.changedTouches)||void 0===o?void 0:o[0];return{x:null!==(r=null==a?void 0:a.clientX)&&void 0!==r?r:e.clientX,y:null!==(i=null==a?void 0:a.clientY)&&void 0!==i?i:e.clientY}}function z(e,t,n){return Math.max(t,Math.min(n,e))}function Z(e){return Boolean(window.chrome)&&e.gpu&&/amd\sradeon\s(pro|rx)\s5\d\d\d/gi.test(e.gpu)||U()&&!A.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function O(e){if(!e)return[];for(var t=[],n=0;n<e.size();n++)t.push(e.get(n));return t}function N(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function H(e){var t=h({},e);return Object.keys(t).forEach((function(e){void 0===t[e]&&delete t[e]})),t}function _(e){return N()?{onTouchEnd:e}:{onClick:e}}var j=function(e){return 0===(null==e?void 0:e.$$.count.value)?null:e},V=function(e){function t(t,n,o){void 0===n&&(n=!1),void 0===o&&(o=!1);var r=e.call(this)||this;return 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.updateMousePosition=function(e){r.emit("pointermove",{type:"mouse",position:r.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},r.updateGlobalMousePosition=function(e){r.emit("globalpointermove",{type:"mouse",position:r.getCorrectPointerPosition(e),button:e.button,touchesCount:0})},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=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.debouncedUpdateMousePosition=k(r.updateMousePosition,40),r.debouncedUpdateGlobalMousePosition=k(r.updateGlobalMousePosition,40),r.handleMouseWheel=function(e){e.preventDefault();var t=e.ctrlKey&&!r.state.isCtrlPressed,n=e.metaKey||t||r.state.isCtrlPressed;if(r.debouncedUpdateMousePosition(e),r.debouncedUpdateGlobalMousePosition(e),n){var o=t||r.invertedWheelZoom?-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=t,r.invertedWheelZoom=n,r.targetBounds=t.getBoundingClientRect(),r.listenersCollector=new I(o),r.addListeners(),r.targetResizeObserver=new ResizeObserver(r.updateTargetBounds.bind(r)),r.targetResizeObserver.observe(r.target),r}return d(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(){N()||(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:e.x-this.targetBounds.x,y:e.y-this.targetBounds.y}},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=B(e);return this.clampPointerToTargetBounds(n)},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(),this.targetResizeObserver.disconnect()},t.prototype.setDisable=function(e){this.listenersCollector.setDisabled(e)},t.prototype.setInvertedWheelZoom=function(e){this.invertedWheelZoom=e},t}(T),J=function(e){function t(t){var n=e.call(this)||this;return n.listenersCollector=new I,n.handleKeyUp=function(e){n.emit("keyUp",e.code)},n.target=t,n.addListeners(),n}return d(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(T),K=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now()}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);return"[Performance] ".concat(this.label," -> ").concat(t," ms")}var n=(e/1e3).toFixed(2);return"[Performance] ".concat(this.label," -> ").concat(n," s")},e}();function Y(e){setTimeout((function(){e()}),0)}var $=new(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return d(t,e),t.prototype.logDebug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","debug"],e,!1))},t.prototype.logWarning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","warn"],e,!1))},t.prototype.logError=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.emit.apply(this,v(["log","error"],e,!1))},t}(T)),X=function(e,r){var i=t(e);i.current=e;var a=t((function(){}));return n((function(){var e=k((function(){i.current()}),r);return a.current=e,function(){e.cancel()}}),[r]),o((function(){return a.current()}),[])},q=function(e){function t(t){var n,o=this;return(o=e.call(this)||this).listenersCollector=new I,o.size={width:0,height:0},o.pixelRatio=1,o.maxPixelRatio=2,o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){o.setSize(t,n),o.emit("resize",t,n,o.getDevicePixelRatio())}))},o.getCanvasCenterPoint=function(){var e=o.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},o.container=t.container,o.canvas=t.canvas,o.maxPixelRatio=null!==(n=t.maxPixelRatio)&&void 0!==n?n:o.maxPixelRatio,o.canvasResizeObserver=new ResizeObserver(o.handleCanvasResizeObserver),o.canvasResizeObserver.observe(o.container),o.listenersCollector.add(window,"orientationchange",o.handleDeviceOrientationChange),o.setSize(o.container.clientWidth,o.container.clientHeight),o}return d(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 z(window.devicePixelRatio,1,this.maxPixelRatio)},t.prototype.getBoundingClientRect=function(){return this.canvas.getBoundingClientRect()},t.prototype.dispose=function(){this.detachAllListeners(),this.canvasResizeObserver.disconnect(),this.listenersCollector.dispose()},t}(T),Q=function(){function e(e){this.settings=e}return e.prototype.isReleaseMode=function(){return this.settings.mode===S.release},e.prototype.init=function(){return p(this,void 0,void 0,(function(){var e,t,n,o,r,i=this;return g(this,(function(a){switch(a.label){case 0:return[4,this.importModule()];case 1:e=a.sent(),t=e.default,a.label=2;case 2:return a.trys.push([2,4,,5]),n=this,[4,t({FeatureFlags:this.settings.featureFlags,currentWebGLVersion:this.settings.webglVersion,bridge:this.settings.jsBridge,locateFile:function(e){return i.settings.locateFile.replace("{file}",e)}})];case 3:return n.instance=a.sent(),[3,5];case 4:throw o=a.sent(),new W("WASM_ERROR","An error occurred while trying to create the wasm module.",o);case 5:return this.pointerTypeToWASMMap={unset:this.instance.PRUserPointerTypeEnum.Unset,mouse:this.instance.PRUserPointerTypeEnum.Mouse,touch:this.instance.PRUserPointerTypeEnum.Touch},this.prCursorTypeToCSSCursorMap=((r={})[this.instance.PRCursorTypeEnum.Auto.value]="auto",r[this.instance.PRCursorTypeEnum.Default.value]="default",r[this.instance.PRCursorTypeEnum.Pointer.value]="pointer",r[this.instance.PRCursorTypeEnum.Grab.value]="grab",r[this.instance.PRCursorTypeEnum.Grabbing.value]="grabbing",r),this.prototypeResizeModeToWASMMap={Fit:this.instance.PrototypeResizeModeWasmEnum.Fit,FillWidth:this.instance.PrototypeResizeModeWasmEnum.FillWidth,ActualSize:this.instance.PrototypeResizeModeWasmEnum.ActualSize},[2]}}))}))},e.prototype.makeWebGLContext=function(e,t){var n;void 0===t&&(t={});var o=h({antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:!1,desynchronized:!0},t),r=this.instance.GL.createContext(e,o);if(!r)throw new W("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");var i=null===(n=this.instance.GL.getContext(r))||void 0===n?void 0:n.GLctx;return i&&i.getExtension("WEBGL_debug_renderer_info"),r},e.prototype.createWebGLTextureFromImage=function(e,t){var n=this.instance.GL,o=n.getContext(t);if(!o)throw new Error("Unable to retrieve emscripten WebGL context from handle");var r=o.GLctx;if(!r)throw new Error("WebGL context is null");var i=r.createTexture();r.bindTexture(r.TEXTURE_2D,i),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!0);var a=n.getNewId(n.textures);return n.textures[a]=i,r.texImage2D(r.TEXTURE_2D,0,r.RGBA,r.RGBA,r.UNSIGNED_BYTE,e),r.bindTexture(r.TEXTURE_2D,null),a},e.prototype.destroyWebGLContext=function(e){var t;$.logDebug("Destroying WebGL context");var n=null===(t=this.instance)||void 0===t?void 0:t.GL.getContext(e);if(n){this.instance.GL.deleteContext(e);var o=n.GLctx.getExtension("WEBGL_lose_context");if(o)return o.loseContext(),$.logDebug("WebGL destroyed"),!0;$.logError("WEBGL_lose_context not available. Not possible to destroy WebGL context manually.")}else $.logError("WebGL context not found while trying to destroy it")},e.prototype.importModule=function(){return this.isReleaseMode()?import("./web-renderer-release-bac26995.js"):import("./web-renderer-debug-60dcc9c3.js")},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.PRUserPointerTypeEnum.Unset},e.prototype.mapPointerInfo=function(e){return h(h({},e),{type:this.mapToPRPointerType(e.type)})},e.prototype.mapResizeMode=function(e){return this.prototypeResizeModeToWASMMap[e]},e}();function ee(e){return new Promise((function(t,n){var o=new Image;o.onload=function(){t(o)},o.onerror=function(e){n(e)},o.src=e}))}var te,ne,oe,re,ie,ae,se,ue,le,ce,de,he,pe,ge,ve,fe,me,ye,be,we,Ce,Pe,Ee,Me,Le,xe=function(){function e(e,t,n){this.canvas=e,this.container=t,this.filePath=n,this.locateFile="/{file}",this.imagesURLFormat="",this.imagesURLMap={},this.fragmentsURLFormat="",this.fragmentsURLMap={},this.backgroundColor={r:1,g:1,b:1,a:1},this.mode=S.release,this.showTilesBorders=!1,this.minimumZoomLevel=.01,this.maximumZoomLevel=5,this.preserveDrawingBuffer=!1,this.featureFlags=A,this.manualInitialization=!1,this.panBoundariesPadding=0,this.selectedArtboard=null,this.onlyShowFrameIds=[],this.initialZoom=null,this.initialPan=null,this.showArtboardsDecorations=!0,this.invertedWheelZoom=!1}return e.FromSettings=function(t){return Object.assign(new e(t.canvas,t.container,t.filePath),Object.fromEntries(Object.entries(t).filter((function(e){return void 0!==e[1]}))))},e}(),Se={png:"image/png",jpg:"image/jpeg",webp:"image/webp",svg:"image/svg+xml",pdf:"application/pdf",raster:"binary/octet-stream"};!function(e){e[e.None=0]="None",e[e.Scale=1]="Scale",e[e.Width=2]="Width",e[e.Height=3]="Height"}(te||(te={})),function(e){e[e.None=0]="None",e[e.PNG=1]="PNG",e[e.JPG=2]="JPG",e[e.TIFF=3]="TIFF",e[e.WEBP=4]="WEBP",e[e.PDF=5]="PDF",e[e.EPS=6]="EPS",e[e.SVG=7]="SVG",e[e.HEIC=8]="HEIC"}(ne||(ne={})),function(e){e[e.Color=0]="Color",e[e.Gradient=1]="Gradient",e[e.Pattern=2]="Pattern"}(oe||(oe={})),function(e){e[e.Fit=0]="Fit",e[e.Fill=1]="Fill",e[e.Stretch=2]="Stretch",e[e.Tile=3]="Tile"}(re||(re={})),function(e){e[e.Linear=0]="Linear",e[e.Radial=1]="Radial",e[e.Angular=2]="Angular"}(ie||(ie={})),function(e){e[e.Center=0]="Center",e[e.Inside=1]="Inside",e[e.Outside=2]="Outside"}(ae||(ae={})),function(e){e[e.Butt=0]="Butt",e[e.Round=1]="Round",e[e.Square=2]="Square"}(se||(se={})),function(e){e[e.Miter=0]="Miter",e[e.Round=1]="Round",e[e.Bevel=2]="Bevel"}(ue||(ue={})),function(e){e[e.Motion=0]="Motion",e[e.Zoom=1]="Zoom",e[e.Background=2]="Background",e[e.Gaussian=3]="Gaussian"}(le||(le={})),function(e){e[e.Normal=0]="Normal",e[e.DestAtop=1]="DestAtop",e[e.Clear=2]="Clear",e[e.Source=3]="Source",e[e.Darken=4]="Darken",e[e.Multiply=5]="Multiply",e[e.ColorBurn=6]="ColorBurn",e[e.Lighten=7]="Lighten",e[e.Screen=8]="Screen",e[e.ColorDodge=9]="ColorDodge",e[e.Overlay=10]="Overlay",e[e.SoftLight=11]="SoftLight",e[e.HardLight=12]="HardLight",e[e.Difference=13]="Difference",e[e.Exclusion=14]="Exclusion",e[e.Hue=15]="Hue",e[e.Saturation=16]="Saturation",e[e.Color=17]="Color",e[e.Luminosity=18]="Luminosity",e[e.PlusLighter=19]="PlusLighter",e[e.PlusDarker=20]="PlusDarker"}(ce||(ce={})),function(e){e[e.Artboard=0]="Artboard",e[e.SymbolMaster=1]="SymbolMaster",e[e.SymbolInstance=2]="SymbolInstance",e[e.Hotspot=3]="Hotspot",e[e.Bitmap=4]="Bitmap",e[e.Group=5]="Group",e[e.Oval=6]="Oval",e[e.Polygon=7]="Polygon",e[e.Rectangle=8]="Rectangle",e[e.ShapeGroup=9]="ShapeGroup",e[e.ShapePath=10]="ShapePath",e[e.Star=11]="Star",e[e.Text=12]="Text",e[e.Triangle=13]="Triangle",e[e.Slice=14]="Slice"}(de||(de={})),function(e){e[e.Angled=2]="Angled",e[e.InsideArc=4]="InsideArc",e[e.InsideSquare=3]="InsideSquare",e[e.Rounded=0]="Rounded",e[e.Smooth=1]="Smooth"}(he||(he={})),function(e){e[e.Lowercase=2]="Lowercase",e[e.None=0]="None",e[e.Uppercase=1]="Uppercase"}(pe||(pe={})),function(e){e[e.Center=1]="Center",e[e.Justified=3]="Justified",e[e.Left=0]="Left",e[e.Right=2]="Right"}(ge||(ge={})),function(e){e[e.Top=0]="Top",e[e.Middle=1]="Middle",e[e.Bottom=2]="Bottom"}(ve||(ve={})),function(e){e[e.LineThrough=2]="LineThrough",e[e.Underline=1]="Underline",e[e.None=0]="None"}(fe||(fe={})),function(e){e[e.Fixed=0]="Fixed",e[e.Fill=1]="Fill",e[e.Fit=2]="Fit",e[e.Relative=3]="Relative"}(me||(me={})),function(e){e[e.Horizontal=0]="Horizontal",e[e.Vertical=1]="Vertical"}(ye||(ye={})),function(e){e[e.Start=0]="Start",e[e.Center=1]="Center",e[e.End=2]="End",e[e.SpaceBetween=3]="SpaceBetween",e[e.SpaceAround=4]="SpaceAround",e[e.SpaceEvenly=5]="SpaceEvenly"}(be||(be={})),function(e){e[e.None=0]="None",e[e.Start=1]="Start",e[e.Center=2]="Center",e[e.End=3]="End",e[e.Stretch=4]="Stretch"}(we||(we={})),function(e){e[e.Unset=0]="Unset",e[e.Mouse=1]="Mouse",e[e.Touch=2]="Touch"}(Ce||(Ce={})),function(e){e[e.Auto=0]="Auto",e[e.Default=1]="Default",e[e.Pointer=2]="Pointer",e[e.Grab=3]="Grab",e[e.Grabbing=4]="Grabbing"}(Pe||(Pe={})),function(e){e[e.PNG=0]="PNG",e[e.JPG=1]="JPG",e[e.WEBP=2]="WEBP",e[e.PDF=4]="PDF",e[e.SVG=3]="SVG",e[e.RASTER=5]="RASTER"}(Ee||(Ee={})),function(e){e[e.Screen=0]="Screen",e[e.Overlay=1]="Overlay"}(Me||(Me={})),function(e){e[e.Fit=0]="Fit",e[e.FillWidth=1]="FillWidth",e[e.ActualSize=2]="ActualSize"}(Le||(Le={}));var Re=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,n.handleCanvasResize=function(e,t,o){var r;null===(r=n.pageCanvasWasm)||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;n.wasmModule&&(null===(o=n.userEventsCollectorWasm)||void 0===o||o.dispatchWheelEvent(e.x,e.y,n.wasmModule.mapPointerInfo(t)))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerDownEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchGlobalPointerMoveEvent(n.wasmModule.mapPointerInfo(e)))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&(null===(t=n.userEventsCollectorWasm)||void 0===t||t.dispatchPointerUpEvent(n.wasmModule.mapPointerInfo(e)))},n.settings=xe.FromSettings(t),$.logDebug("CanvasRenderer JS constructed with settings:",n.settings),n.gestureManager=new V(n.settings.container,n.settings.invertedWheelZoom),n.canvasManager=new q({container:n.settings.container,canvas:n.settings.canvas}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.exporterFetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return d(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 p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return[4,x()];case 1:return e=t.sent(),this.deviceInfo=h(h({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.detectWebGLVersion=function(){this.webglVersion=Z(this.deviceInfo),$.logDebug("Using WebGL ".concat(this.webglVersion))},t.prototype.init=function(){return p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),[4,this.collectAndEmitDeviceInfo()];case 1:t.sent(),this.detectWebGLVersion(),t.label=2;case 2:return t.trys.push([2,6,,7]),[4,this.initWasmModule()];case 3:return t.sent(),[4,this.initCanvasRendererWasm()];case 4:return t.sent(),[4,this.setFile(this.settings.filePath)];case 5:return t.sent(),this.settings.selectedArtboard&&this.selectArtboard(this.settings.selectedArtboard),this.settings.onlyShowFrameIds.length>0&&this.setOnlyShowFrames(this.settings.onlyShowFrameIds),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.setInitialCameraState(),this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.setInitialCameraState=function(){var e,t,n,o=null!==this.settings.initialZoom,r=null!==this.settings.initialPan;o||r?(o&&this.setZoom(this.settings.initialZoom||1),r&&this.setPan((null===(e=this.settings.initialPan)||void 0===e?void 0:e.x)||0,(null===(t=this.settings.initialPan)||void 0===t?void 0:t.y)||0,null===(n=this.settings.initialPan)||void 0===n?void 0:n.centerPointInViewport)):this.zoomToFit()},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.pageCanvasWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t,n){return e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t].replace(":format",n):e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t).replace(":format",n):($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):($.logWarning("Not able to resolve the url for the fragment 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",(null==t?void 0:t.x)||0,(null==t?void 0:t.y)||0)},onCursorChange:function(t){var n,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},fetch:this.handleJSBridgeFetch.bind(this),exporterFetch:this.handleJSBridgeExporterFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onLayerClick:function(t){e.emit("layerClick",t)},onLayerMouseHoverChange:function(t){e.emit("layerMouseHoverChange",t)},onSceneChange:function(){e.emit("sceneChange")},onFragmentLoad:function(t){e.emit("fragmentLoad",t)}}},t.prototype.handleJSBridgeExporterFetch=function(e,t){var n=this,o=t.clone(),r=function(t){return p(n,void 0,void 0,(function(){var n,i,a,s,u,l;return g(this,(function(c){if(!this.wasmModule)return[2];if(this.disposed)return[2];if(t.data.url!==e)return[2];switch(t.data.type){case"success":n={statusCode:200,statusText:"OK",contentType:t.data.contentType,isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0,buffer:new Uint8Array(t.data.buffer)},o.exec(n);break;case"error":$.logError("Error while fetching ".concat(e),t.data.error),o.exec({buffer:new Uint8Array(0),statusCode:null!==(a=null===(i=t.data.error)||void 0===i?void 0:i.statusCode)&&void 0!==a?a:500,statusText:null!==(u=null===(s=t.data.error)||void 0===s?void 0:s.statusText)&&void 0!==u?u:"Unknown error",contentType:null!==(l=t.data.contentType)&&void 0!==l?l:"",isWebGLTexture:!1,emscriptenWebGLTextureHandle:0,width:0,height:0})}return this.exporterFetchWorker.removeEventListener("message",r),[2]}))}))};this.exporterFetchWorker.addEventListener("message",r),this.exporterFetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){return p(n,void 0,void 0,(function(){var n,i,a,s,u,l,c,d,h;return g(this,(function(p){switch(p.label){case 0:if(!this.wasmModule)return[2];if(this.disposed)return[2];if(t.data.url!==e)return[2];switch(t.data.type){case"success":return[3,1];case"error":return[3,5]}return[3,6];case 1:return n={statusCode:200,statusText:"OK",contentType:t.data.contentType,isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0},/image/.test(t.data.contentType)?(i=new Blob([t.data.buffer]),[4,ee(URL.createObjectURL(i))]):[3,3];case 2:return a=p.sent(),this.wasmModule?(s=this.wasmModule.createWebGLTextureFromImage(a,this.webglCtxHandle),n.buffer=new Uint8Array(0),n.isWebGLTexture=!0,n.emscriptenWebGLTextureHandle=s,n.width=a.width,n.height=a.height,[3,4]):[2];case 3:n.buffer=new Uint8Array(t.data.buffer),p.label=4;case 4:return o.exec(n),[3,7];case 5:return $.logError("Error while fetching ".concat(e),t.data.error),o.exec({buffer:new Uint8Array(0),statusCode:null!==(l=null===(u=t.data.error)||void 0===u?void 0:u.statusCode)&&void 0!==l?l:500,statusText:null!==(d=null===(c=t.data.error)||void 0===c?void 0:c.statusText)&&void 0!==d?d:"Unknown error",contentType:null!==(h=t.data.contentType)&&void 0!==h?h:"",isWebGLTexture:!1,emscriptenWebGLTextureHandle:0,width:0,height:0}),[3,7];case 6:return[3,7];case 7:return this.fetchWorker.removeEventListener("message",r),[2]}}))}))};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initWasmModule=function(){var e;return p(this,void 0,void 0,(function(){var t;return g(this,(function(n){switch(n.label){case 0:return this.disposed?[2]:(t=new K("WasmModuleDownload"),this.wasmModule=new Q({mode:this.settings.mode,locateFile:this.settings.locateFile,jsBridge:this.createJSBridge(),featureFlags:this.settings.featureFlags,webglVersion:this.webglVersion}),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()]);case 1:return n.sent(),$.logDebug(t.printMeasurement()),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.initCanvasRendererWasm=function(){return p(this,void 0,void 0,(function(){var e;return g(this,(function(t){if(this.disposed)return[2];try{if(!this.wasmModule)throw Error("WASM module not initialized");this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:this.webglVersion}),this.renderTarget=this.wasmModule.instance.RenderTarget.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),this.pageCanvasWasm=new this.wasmModule.instance.CanvasRendererWasm(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders})}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the wasm object.",e)}if(!this.pageCanvasWasm)return[2];if(!(e=this.pageCanvasWasm.getUserEventsCollector()))throw new W("WASM_ERROR","An error occurred while trying to create the user events collector");return this.userEventsCollectorWasm=e,this.pageCanvasWasm.setShowArtboardsDecorations(this.settings.showArtboardsDecorations),this.pageCanvasWasm.setBackgroundColor(this.settings.backgroundColor.r,this.settings.backgroundColor.g,this.settings.backgroundColor.b,this.settings.backgroundColor.a),this.pageCanvasWasm.setZoomLevels(this.settings.minimumZoomLevel,this.settings.maximumZoomLevel),this.pageCanvasWasm.setPanBoundariesPadding(this.settings.panBoundariesPadding),[2]}))}))},t.prototype.setIsCameraLocked=function(e){var t;null===(t=this.pageCanvasWasm)||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.pageCanvasWasm)||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&&($.logDebug(this.traceInitialRender.printMeasurement()),this.emit("metric",this.traceInitialRender.measure()),$.logDebug(this.traceFirstPaint.printMeasurement()),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}))},t.prototype.looseWebGLContext=function(){var e;(null===(e=this.wasmModule)||void 0===e?void 0:e.destroyWebGLContext(this.webglCtxHandle))||$.logWarning("Failed to loose WebGL context"),this.webglCtxHandle=-1},t.prototype.zoomToFit=function(){var e;null===(e=this.pageCanvasWasm)||void 0===e||e.scaleDocumentToFit()},t.prototype.zoomToFitNode=function(e,t,n){var o;void 0===t&&(t=.82),void 0===n&&(n=!1),null===(o=this.pageCanvasWasm)||void 0===o||o.scaleNodeToFit(e,t,n)},t.prototype.loadAllFragments=function(){var e;null===(e=this.pageCanvasWasm)||void 0===e||e.loadAllFragments()},t.prototype.setFile=function(e){return p(this,void 0,void 0,(function(){var t=this;return g(this,(function(n){return this.disposed?[2]:(this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){var r;null===(r=t.pageCanvasWasm)||void 0===r||r.setFile(e,(function(e,o,r){t.setStatus({type:"FILE_READY"});var i="".concat(e,"-v").concat("14.13.2");t.emit("fileReady",i,o,r),n()}),(function(){return o(new W("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()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("Status transition ".concat(this.status.type," => ").concat(e.type)),this.status=e,this.emit("status",e))},t.prototype.getPRFileCachedData=function(){var e;if(!this.pageCanvasWasm)return null;if((null===(e=this.prFileHandle)||void 0===e?void 0:e.filePath)!==this.settings.filePath){var t=this.pageCanvasWasm.getPRFile();this.prFileHandle={handle:t,filePath:this.settings.filePath,artboards:O(t.getFrames())}}return this.prFileHandle},t.prototype.getPRFile=function(){var e;return null===(e=this.getPRFileCachedData())||void 0===e?void 0:e.handle},t.prototype.releasePRFileHandle=function(){var e,t;null===(t=null===(e=this.prFileHandle)||void 0===e?void 0:e.handle)||void 0===t||t.delete(),this.prFileHandle=void 0},t.prototype.getRootNodeExtent=function(){var e,t,n;return null!==(n=null===(t=null===(e=this.getPRFile())||void 0===e?void 0:e.getRootNode())||void 0===t?void 0:t.getAbsoluteExtent())&&void 0!==n?n:null},t.prototype.getPRFileArtboards=function(){var e,t;return null!==(t=null===(e=this.getPRFileCachedData())||void 0===e?void 0:e.artboards)&&void 0!==t?t:[]},t.prototype.getArtboardAtPosition=function(e,t){if(!this.pageCanvasWasm)return null;for(var n=this.getPRFileArtboards(),o=this.pageCanvasWasm.getPan(),r=this.pageCanvasWasm.getZoom(),i=(e-o.x)/r,a=(t-o.y)/r,s=0,u=n;s<u.length;s++){var l=u[s],c=l.bounds.x+l.bounds.width,d=l.bounds.y+l.bounds.height;if(i>=l.bounds.x&&a>=l.bounds.y&&i<=c&&a<=d)return l.getNode()}return null},t.prototype.mapRelativePositionToCameraPosition=function(e,t){var n;return null===(n=this.pageCanvasWasm)||void 0===n?void 0:n.mapRelativePositionToCameraPosition(e,t)},t.prototype.getPanAtPosition=function(e,t){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.pageCanvasWasm)||void 0===n||n.setZoom(e,o.x,o.y)},t.prototype.getPan=function(){var e,t,n=this.getRootNodeExtent();if(!n)return{x:0,y:0};var o=null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getPan(),r=null===(t=this.pageCanvasWasm)||void 0===t?void 0:t.getZoom();return o&&r?{x:o.x/r+n.x,y:o.y/r+n.y}:{x:0,y:0}},t.prototype.getZoom=function(){var e;return(null===(e=this.pageCanvasWasm)||void 0===e?void 0:e.getZoom())||0},t.prototype.setPan=function(e,t,n){var o;void 0===n&&(n=!1);var r=this.getRootNodeExtent();if(r){var i=e,a=t,s=this.getZoom();if(n){var u=Math.max(2*s*this.canvasManager.pixelRatio,Number.EPSILON);i+=this.canvasManager.size.width/u,a+=this.canvasManager.size.height/u}var l=(i-r.x)*s,c=(a-r.y)*s;null===(o=this.pageCanvasWasm)||void 0===o||o.setPan(l,c)}},t.prototype.selectArtboard=function(e){var t;this.pageCanvasWasm&&(this.settings.selectedArtboard=e,null===(t=this.pageCanvasWasm)||void 0===t||t.selectArtboard(null!=e?e:""))},t.prototype.setOnlyShowFrames=function(e){var t,n=this.settings.onlyShowFrameIds,o=Array.from(new Set(e));n.length===o.length&&n.every((function(e){return o.includes(e)}))||(this.settings.onlyShowFrameIds=o,null===(t=this.pageCanvasWasm)||void 0===t||t.setOnlyShowFrames(o),this.emit("onlyShowFramesChange",o))},t.prototype.getOnlyShowFrameIds=function(){return this.settings.onlyShowFrameIds},t.prototype.disposeFetchWorker=function(){this.fetchWorker.postMessage({type:"abort-all"}),this.fetchWorker.terminate()},t.prototype.exportNode=function(e,t){return p(this,void 0,void 0,(function(){var n=this;return g(this,(function(o){return[2,new Promise((function(o,r){if(n.wasmModule&&n.pageCanvasWasm){var i=t.format.toUpperCase(),a=Ee[i];if(void 0!==a){var s={format:{value:a},backingScale:t.backingScale};n.pageCanvasWasm.exportNode(e,s,(function(e,n,i,a){if(null!==e){var s=Se[t.format],u=new Blob([e.buffer],{type:s});o({blob:u,width:n,height:i,bytesPerPixel:a})}else r("Export failed")}))}else r("Unsupported export format: ".concat(t.format))}else r("Wasm module is not ready or was disposed.")}))]}))}))},t.prototype.dispose=function(){var e,t,n,o;try{this.disposeFetchWorker(),this.disposed=!0,this.detachAllListeners(),this.releasePRFileHandle(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.pageCanvasWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.pageCanvasWasm)||void 0===n||n.delete(),null===(o=this.renderTarget)||void 0===o||o.delete(),this.pageCanvasWasm=void 0,this.wasmModule=void 0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the wasm object",e))}},t}(T),We=r(void 0),Fe=r(void 0),Te=r(void 0),Ie=r(void 0),Ae=r(void 0),De=r("auto"),Ge=r(void 0),Ue=function(){var e=i(Ge);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},ke=function(e,t){switch(t.type){case"on-status":return h(h({},e),{status:t.status});case"on-zoom":return h(h({},e),{zoom:t.zoom});case"on-pan":return h(h({},e),{pan:t.pan});case"dispose":return h(h({},e),{status:{type:"DISPOSED"},zoom:null,pan:null,cursor:"auto"});case"on-camera-zoom-start":return h(h({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return h(h({},e),{isCameraZooming:!1});case"on-camera-move-start":return h(h({},e),{isCameraMoving:!0});case"on-camera-move-end":return h(h({},e),{isCameraMoving:!1});case"on-cursor-change":return h(h({},e),{cursor:t.cursor});default:return e}},Be=function(n){var r=t(null),i=t(null),u=a(ke,{pan:null,zoom:null,status:{type:"IDLE"},isCameraZooming:!1,isCameraMoving:!1,cursor:"auto"}),l=u[0],c=l.status,d=l.zoom,p=l.pan,g=l.isCameraZooming,v=l.isCameraMoving,f=l.cursor,m=u[1],y=o((function(e){return m({type:"on-zoom",zoom:e})}),[]),b=o((function(e,t){return m({type:"on-pan",pan:{x:e,y:t}})}),[]),w=o((function(e){m({type:"on-status",status:e})}),[]),C=o((function(){return m({type:"on-camera-zoom-start"})}),[]),P=o((function(){return m({type:"on-camera-zoom-end"})}),[]),E=o((function(){return m({type:"on-camera-move-start"})}),[]),M=o((function(){return m({type:"on-camera-move-end"})}),[]),L=o((function(e){return m({type:"on-cursor-change",cursor:e})}),[]),x=o((function(){if(r.current){var e=r.current.getPan();m({type:"on-pan",pan:e})}}),[]),S=o((function(){var e=r.current;e&&($.logDebug("Provider dispose"),e.off("status",w),e.off("cameraZoomChange",y),e.off("cameraPanChange",b),e.off("cameraZoomStart",C),e.off("cameraZoomEnd",P),e.off("cameraMoveStart",E),e.off("cameraMoveEnd",M),e.off("cursorChange",L),e.off("sceneChange",x),e.dispose(),r.current=null,m({type:"dispose"}))}),[w,b,y,C,P,E,M,L,x]),R=o((function(e,t,n){if(""!==e&&t&&n&&i.current){$.logDebug("Provider init");var o=new Re(h(h({},i.current),{filePath:e,container:n,canvas:t,manualInitialization:!0}));o.on("status",w),o.on("cameraZoomChange",y),o.on("cameraPanChange",b),o.on("cameraZoomStart",C),o.on("cameraZoomEnd",P),o.on("cameraMoveStart",E),o.on("cameraMoveEnd",M),o.on("cursorChange",L),o.on("sceneChange",x),r.current=o,o.init()}}),[w,y,b,C,P,E,M,L,x]),W=o((function(e){var t,n,o,a,s;$.logDebug("Provider setSettings"),e.backgroundColor&&(null===(t=r.current)||void 0===t||t.setBackgroundColor(e.backgroundColor)),null===(n=r.current)||void 0===n||n.gestureManager.setInvertedWheelZoom(e.invertedWheelZoom||!1),null===(o=r.current)||void 0===o||o.selectArtboard(e.selectedArtboard||null),null===(a=r.current)||void 0===a||a.setOnlyShowFrames(null!==(s=e.onlyShowFrameIds)&&void 0!==s?s:[]),i.current=e}),[]),F=o((function(){return r.current}),[]),T=s((function(){return{dispose:S,init:R,setSettings:W,getInstance:F,dispatch:m}}),[S,R,W,F]);return e.createElement(Ge.Provider,{value:T},e.createElement(We.Provider,{value:c},e.createElement(Fe.Provider,{value:d},e.createElement(Ae.Provider,{value:p},e.createElement(Te.Provider,{value:g},e.createElement(Ie.Provider,{value:v},e.createElement(De.Provider,{value:f},n.children)))))))},ze=function(e,t){var n=(0,Ue().getInstance)();u((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},Ze=function(){var e=i(We);if(void 0===e)throw Error("useStatus must be used within a provider");return e},Oe=function(){var e=i(Fe);if(void 0===e)throw Error("useZoom must be used within a provider");return e},Ne=function(){var e=i(Ae);if(void 0===e)throw Error("usePan must be used within a provider");return e},He=function(){var e=i(De);if(void 0===e)throw Error("useCursor must be used within a provider");return e},_e=function(){var e=i(Te);if(void 0===status)throw Error("useIsCameraZooming must be used within a provider");return e},je=function(){var e=i(Ie);if(void 0===status)throw Error("useIsCameraMoving must be used within a provider");return e},Ve=function(){var e=(0,Ue().getInstance)(),t=Ze();return s((function(){return e&&"READY"===t.type?e.getPRFile():null}),[e,t])},Je=function(){var e=(0,Ue().getInstance)(),t=Ze();return s((function(){return e&&"READY"===t.type?e.getPRFileArtboards():null}),[e,t])},Ke=function(){var e,t,n,o,r=Ve(),i=l(null),a=i[0],c=i[1],d=X((function(){c((function(e){var t,n,o,i=null!==(o=null===(n=null===(t=j(r))||void 0===t?void 0:t.getRootNode())||void 0===n?void 0:n.getAbsoluteExtent())&&void 0!==o?o:null;return(null==e?void 0:e.width)===(null==i?void 0:i.width)&&(null==e?void 0:e.height)===(null==i?void 0:i.height)&&(null==e?void 0:e.x)===(null==i?void 0:i.x)&&(null==e?void 0:e.y)===(null==i?void 0:i.y)?e:i}))}),16);ze("sceneChange",d),u((function(){d()}),[d]);var h=null!==(e=null==a?void 0:a.x)&&void 0!==e?e:0,p=null!==(t=null==a?void 0:a.y)&&void 0!==t?t:0,g=null!==(n=null==a?void 0:a.width)&&void 0!==n?n:0,v=null!==(o=null==a?void 0:a.height)&&void 0!==o?o:0;return s((function(){return{x:h,y:p,width:g,height:v}}),[h,p,g,v])},Ye=function(){var e=(0,Ue().getInstance)();return o((function(t){null==e||e.setZoom(t)}),[e])},$e=function(){var e=Ye(),t=Oe();return o((function(){var n;"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},Xe=function(){var e=Ye(),t=Oe();return o((function(){"number"==typeof t&&e(t/2)}),[e,t])},qe=function(){var e=(0,Ue().getInstance)();return o((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;null==e||e.setPan(n,o,r)}),[e])},Qe=function(){var e=(0,Ue().getInstance)();return o((function(){null==e||e.zoomToFit()}),[e])},et=function(){var e=(0,Ue().getInstance)();return o((function(t,n,o){null==e||e.zoomToFitNode(t,n,o)}),[e])},tt=function(){var e=(0,Ue().getInstance)();return o((function(){null==e||e.looseWebGLContext()}),[e])},nt=function(){var e=(0,Ue().getInstance)();return o((function(t,n){return p(void 0,void 0,void 0,(function(){return g(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},ot=function(){var e=(0,Ue().getInstance)();return o((function(t,n){return p(void 0,void 0,void 0,(function(){return g(this,(function(o){switch(o.label){case 0:return[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},rt=function(){var e=(0,Ue().getInstance)();return o((function(t){null==e||e.setIsCameraLocked(t)}),[e])},it=function(){var e=(0,Ue().getInstance)();return o((function(t,n){if(!e)return null;var o=e.mapRelativePositionToCameraPosition(t,n);return null!=o?o:null}),[e])},at=function(){var e,t=(0,Ue().getInstance)(),n=Je(),r=null!==(e=null==t?void 0:t.getOnlyShowFrameIds())&&void 0!==e?e:[],i=l(1===r.length?r[0]:null),a=i[0],s=i[1],u=o((function(e){s(1===e.length?e[0]:null)}),[]);ze("onlyShowFramesChange",u);var c=o((function(e){var o,r;if(null===e)return null==t||t.setOnlyShowFrames([]),void(null==t||t.zoomToFit());null==t||t.setOnlyShowFrames([e]);var i=null===(r=null===(o=null==n?void 0:n.find((function(t){return t.objectId===e})))||void 0===o?void 0:o.getNode())||void 0===r?void 0:r.getIdentifier();void 0!==i&&(null==t||t.zoomToFitNode(i))}),[t,n]);return[a,c]},st=function(){var e=(0,Ue().getInstance)(),t=Ve();return o((function(n,o){return e&&t?e.exportNode(n,o):Promise.reject("WebRenderer instance not ready")}),[e,t])};function ut(e){var n=t(e);n.current=e;var r=o((function(e){for(var t=[],o=1;o<arguments.length;o++)t[o-1]=arguments[o];n.current.apply(n,v([e],t,!1))}),[]);u((function(){return $.on("log",r),function(){$.off("log",r)}}),[r])}var lt=function(){var e=Ue().getInstance;return o((function(){var t=e();t&&t.loadAllFragments()}),[e])},ct={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},dt={position:"absolute",top:0,left:0},ht=function(n){var r=n.filePath,i=n.locateFile,a=n.imagesURLFormat,c=n.imagesURLMap,d=n.fragmentsURLFormat,p=n.fragmentsURLMap,g=n.backgroundColor,v=n.mode,f=n.showTilesBorders,m=n.minimumZoomLevel,y=n.maximumZoomLevel,b=n.preserveDrawingBuffer,w=n.panBoundariesPadding,C=n.initialPan,P=n.initialZoom,E=n.children,M=n.containerProps,L=n.canvasProps,x=n.featureFlags,S=n.selectedArtboard,R=n.showArtboardsDecorations,W=n.invertedWheelZoom,F=t(null),T=t(null),I=l(!1),A=I[0],D=I[1],G=o((function(){return D(!0)}),[]),U=Ue(),k=U.dispose,B=U.init,z=U.setSettings,Z=He(),O=Ze();ze("allImagesReady",G),u((function(){return $.logDebug("CanvasRenderer mounted"),function(){return $.logDebug("CanvasRenderer unmounted")}}),[]),u((function(){z({locateFile:i,imagesURLFormat:a,imagesURLMap:c,fragmentsURLFormat:d,fragmentsURLMap:p,backgroundColor:g,mode:v,showTilesBorders:f,minimumZoomLevel:m,maximumZoomLevel:y,preserveDrawingBuffer:b,panBoundariesPadding:w,initialPan:C,initialZoom:P,featureFlags:x,selectedArtboard:S,showArtboardsDecorations:R,invertedWheelZoom:W})}),[z,i,a,c,d,p,g,v,f,m,y,b,w,C,P,x,S,R,W]),u((function(){if(r)return B(r,F.current,T.current),function(){k()}}),[k,B,r]);var N=s((function(){var e;return null!==(e=n.cursor)&&void 0!==e?e:Z}),[n.cursor,Z]),H=s((function(){return h(h({},ct),{cursor:N})}),[N]);return e.createElement("div",h({},M,{ref:T,style:H}),r&&e.createElement("canvas",h({},L,{key:r,ref:F,"data-sketchweb-all-images-ready":A,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-".concat((null==O?void 0:O.type.toLowerCase())||"null"),style:dt})),"READY"===(null==O?void 0:O.type)&&E)},pt=function(){function e(e,t,n,o){this.prototypeStructure=e,this.startArtboardUUID=t,this.canvas=n,this.container=o,this.locateFile="/{file}",this.imagesURLFormat="",this.imagesURLMap={},this.fragmentsURLFormat="",this.fragmentsURLMap={},this.backgroundColor={r:0,g:0,b:0,a:1},this.mode=S.release,this.showTilesBorders=!1,this.minimumZoomLevel=5,this.maximumZoomLevel=.01,this.preserveDrawingBuffer=!1,this.featureFlags=A,this.manualInitialization=!1,this.highlightHotspots=!0,this.resizeMode=R.Fit,this.assetsManagerLimits={maxDepthForBackgroundRequests:1,maxArtboardsForBackgroundRequests:5,maxInitialLoadingDepth:2,maxInitialArtboardToLoad:10},this.disableInteraction=!1}return e.FromSettings=function(t){return Object.assign(new e(t.prototypeStructure,t.startArtboardUUID,t.canvas,t.container),Object.fromEntries(Object.entries(t).filter((function(e){return void 0!==e[1]}))))},e}(),gt=function(e){function t(t){var n=e.call(this)||this;return n.status={type:"IDLE"},n.disposed=!1,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;n.wasmModule&&n.userEventsCollectorWasm.dispatchWheelEvent(e.x,e.y,null===(o=n.wasmModule)||void 0===o?void 0:o.mapPointerInfo(t))},n.handlePointerDownEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerDownEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handleGlobalPointerMoveEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchGlobalPointerMoveEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.handlePointerUpEvent=function(e){var t;n.wasmModule&&n.userEventsCollectorWasm.dispatchPointerUpEvent(null===(t=n.wasmModule)||void 0===t?void 0:t.mapPointerInfo(e))},n.restartPrototype=function(e){var t;null===(t=n.playerWasm)||void 0===t||t.restartPrototype(e)},n.navigateToFirstFlow=function(){var e;null===(e=n.playerWasm)||void 0===e||e.navigateToFirstFlow()},n.goBack=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goBack()},n.goForwards=function(){var e;null===(e=n.playerWasm)||void 0===e||e.goForwards()},n.setResizeMode=function(e){var t;if(n.wasmModule){var o=n.wasmModule.mapResizeMode(e);null===(t=n.playerWasm)||void 0===t||t.setResizeMode(o)}},n.getScreen=function(e){var t;void 0===e&&(e=!0);var o=null===(t=n.playerWasm)||void 0===t?void 0:t.getJSScreen(e);return o?{layers:O(o.layers)}:{layers:[]}},n.settings=pt.FromSettings(t),$.logDebug("PrototypeRenderer JS constructed with settings:",n.settings),n.gestureManager=new V(n.settings.container,!1,n.settings.disableInteraction),n.canvasManager=new q({container:n.settings.container,canvas:n.settings.canvas,maxPixelRatio:3}),n.fetchWorker=new Worker(n.settings.locateFile.replace("{file}","fetch-worker.js")),n.settings.manualInitialization||n.init(),n}return d(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 p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return[4,x()];case 1:return e=t.sent(),this.deviceInfo=h(h({},e),{hardwareConcurrency:navigator.hardwareConcurrency}),this.emit("deviceInfo",this.deviceInfo),[2]}}))}))},t.prototype.detectWebGLVersion=function(){this.webglVersion=Z(this.deviceInfo),$.logDebug("Using WebGL ".concat(this.webglVersion))},t.prototype.init=function(){return p(this,void 0,void 0,(function(){var e;return g(this,(function(t){switch(t.label){case 0:return this.traceFirstPaint=new K("FirstPaint"),this.setStatus({type:"INITIALIZING"}),[4,this.collectAndEmitDeviceInfo()];case 1:t.sent(),this.detectWebGLVersion(),t.label=2;case 2:return t.trys.push([2,6,,7]),[4,this.initWasmModule()];case 3:return t.sent(),[4,this.initPlayerWasm()];case 4:return t.sent(),[4,this.startDownload()];case 5:return t.sent(),[3,7];case 6:return e=t.sent(),[2,this.fail(e instanceof W?e:new W("ERROR","Unexpected exception initializing the web renderer",e))];case 7:return this.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initWasmModule=function(){var e;return p(this,void 0,void 0,(function(){var t;return g(this,(function(n){switch(n.label){case 0:return this.disposed?[2]:(t=new K("WasmModuleDownload"),this.wasmModule=new Q({mode:this.settings.mode,locateFile:this.settings.locateFile,jsBridge:this.createJSBridge(),featureFlags:this.settings.featureFlags,webglVersion:this.webglVersion}),[4,null===(e=this.wasmModule)||void 0===e?void 0:e.init()]);case 1:return n.sent(),t.printMeasurement(),this.emit("metric",t.measure()),[2]}}))}))},t.prototype.startDownload=function(){var e=this;return this.setStatus({type:"LOADING_FILE"}),new Promise((function(t){var n;null===(n=e.playerWasm)||void 0===n||n.startDownload((function(){t()}))}))},t.prototype.startRendering=function(){var e;this.traceInitialRender=new K("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),null===(e=this.playerWasm)||void 0===e||e.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){$.logDebug("[C++] ".concat(e))},logWarning:function(e){$.logWarning("[C++] ".concat(e))},logError:function(e){$.logError("[C++] ".concat(e))},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t,n){return e.settings.imagesURLMap&&e.settings.imagesURLMap[t]?e.settings.imagesURLMap[t].replace(":format",n):e.settings.imagesURLFormat?e.settings.imagesURLFormat.replace(":imageId",t).replace(":format",n):($.logWarning("Not able to resolve the url for the image with UUID: ".concat(t)),"")},resolveFragmentUrl:function(t){return e.settings.fragmentsURLMap&&e.settings.fragmentsURLMap[t]?e.settings.fragmentsURLMap[t]:e.settings.fragmentsURLFormat?e.settings.fragmentsURLFormat.replace(":fragmentId",t):($.logWarning("Not able to resolve the url for the fragment 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,o=null===(n=e.wasmModule)||void 0===n?void 0:n.mapToCSSCursor(t);o&&e.emit("cursorChange",o)},onPrototypeStateWillChange:function(t,n,o){e.emit("prototypeStateWillChange",{currentArtboardId:t,canGoBack:n,canGoForwards:o})},onPrototypeStateChange:function(t,n,o){e.emit("prototypeStateChange",{currentArtboardId:t,canGoBack:n,canGoForwards:o})},fetch:this.handleJSBridgeFetch.bind(this),abortFetch:this.handleJSBridgeAbortFetch.bind(this),onPrototypeUnhandledPointerUp:function(){e.emit("prototypeUnhandledPointerUp")},onSceneChange:function(){e.emit("sceneChange")}}},t.prototype.handleJSBridgeFetch=function(e,t){var n=this,o=t.clone(),r=function(t){return p(n,void 0,void 0,(function(){var n,i,a,s,u,l,c,d,h;return g(this,(function(p){switch(p.label){case 0:if(this.disposed||!this.wasmModule)return[2];if(t.data.url!==e)return[2];switch(t.data.type){case"success":return[3,1];case"error":return[3,5]}return[3,6];case 1:return n={statusCode:200,statusText:"OK",contentType:t.data.contentType,isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0},/image/.test(t.data.contentType)?(i=new Blob([t.data.buffer]),[4,ee(URL.createObjectURL(i))]):[3,3];case 2:return a=p.sent(),this.wasmModule?(s=this.wasmModule.createWebGLTextureFromImage(a,this.webglCtxHandle),n.buffer=new Uint8Array(0),n.isWebGLTexture=!0,n.emscriptenWebGLTextureHandle=s,n.width=a.width,n.height=a.height,[3,4]):[2];case 3:n.buffer=new Uint8Array(t.data.buffer),p.label=4;case 4:return o.exec(n),[3,7];case 5:return $.logError("Error while fetching ".concat(e),t.data.error),o.exec({buffer:new Uint8Array(0),statusCode:null!==(l=null===(u=t.data.error)||void 0===u?void 0:u.statusCode)&&void 0!==l?l:500,statusText:null!==(d=null===(c=t.data.error)||void 0===c?void 0:c.statusText)&&void 0!==d?d:"Unknown error",contentType:null!==(h=t.data.contentType)&&void 0!==h?h:"",isWebGLTexture:!1,emscriptenWebGLTextureHandle:-1,width:0,height:0}),[3,7];case 6:return[3,7];case 7:return this.fetchWorker.removeEventListener("message",r),[2]}}))}))};this.fetchWorker.addEventListener("message",r),this.fetchWorker.postMessage({type:"fetch",url:e})},t.prototype.handleJSBridgeAbortFetch=function(e){this.fetchWorker.postMessage({type:"abort",url:e})},t.prototype.initPlayerWasm=function(){var e,t;return p(this,void 0,void 0,(function(){var n,o,r,i,a,s,u,l,c,d,p,v,f,m,y,b,w,C,P,E,M;return g(this,(function(g){try{if(!this.wasmModule)throw Error("WASM module not initialized");for(this.webglCtxHandle=this.wasmModule.makeWebGLContext(this.settings.canvas,{preserveDrawingBuffer:this.settings.preserveDrawingBuffer,majorVersion:this.webglVersion}),n=this.wasmModule.instance,o=n.RenderTarget,r=n.PrototypeRendererWasm,i=n.PrototypeStructureArtboardVector,a=n.PrototypeStructureFlowVector,s=n.PrototypeStructureAssetVector,u=n.PrototypeStructureFlowTypeEnum,this.renderTarget=o.MakeWebGL(this.webglCtxHandle,this.canvasManager.size.width,this.canvasManager.size.height,this.canvasManager.pixelRatio),l={artboards:new i},c={Overlay:u.Overlay,Screen:u.Screen},d=0,p=this.settings.prototypeStructure.artboards;d<p.length;d++){for(v=p[d],f=new a,m=0,y=null!==(e=v.flows)&&void 0!==e?e:[];m<y.length;m++)b=y[m],f.push_back(h(h({},b),{type:c[b.type]}));for(w=new s,C=0,P=null!==(t=v.assets)&&void 0!==t?t:[];C<P.length;C++)E=P[C],w.push_back(E);l.artboards.push_back(h(h({},v),{flows:f,assets:w}))}this.playerWasm=new r(this.renderTarget,{showTilesBorders:this.settings.showTilesBorders},this.settings.startArtboardUUID,l,this.settings.highlightHotspots,this.settings.assetsManagerLimits)}catch(e){throw new W("WASM_ERROR","An error occurred while trying to create the PrototypeRenderer WASM object.",e)}if(!(M=this.playerWasm.getUserEventsCollector()))throw new W("WASM_ERROR","An error occurred while trying to create the user events collector");return this.userEventsCollectorWasm=M,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),this.setResizeMode(this.settings.resizeMode),[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"}))},t.prototype.looseWebGLContext=function(){var e;null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.webglCtxHandle=-1},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()):"")}),$.logError(e),e.cause&&$.logError(e.cause)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&($.logDebug("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.getArtboardAtPosition=function(e,t){var n=this.playerWasm;if(!n)return null;for(var o=n.getJSScreen(!1),r=n.getPan(),i=n.getZoom(),a=(e-r.x)/i,s=(t-r.y)/i,u=o.layers.size()-1;u>=0;u-=1){var l=o.layers.get(u);if(l&&"artboard"===l.type){var c=l.bounds.x+l.bounds.width,d=l.bounds.y+l.bounds.height;if(a>=l.bounds.x&&s>=l.bounds.y&&a<=c&&s<=d)return l.getNode()}}return null},t.prototype.disposeFetchWorker=function(){this.fetchWorker.postMessage({type:"abort-all"}),this.fetchWorker.terminate()},t.prototype.dispose=function(){var e,t,n;try{this.disposeFetchWorker(),this.detachAllListeners(),null===(e=this.wasmModule)||void 0===e||e.destroyWebGLContext(this.webglCtxHandle),this.canvasManager.dispose(),this.gestureManager.dispose(),null===(t=this.playerWasm)||void 0===t||t.stopRenderLoop(),null===(n=this.playerWasm)||void 0===n||n.delete(),this.renderTarget.delete(),this.playerWasm=void 0,this.wasmModule=void 0,this.disposed=!0}catch(e){this.fail(new W("ERROR","Unexpected exception while disposing the WebRendererWasm object",e))}},t.prototype.mapRelativePositionToCameraPosition=function(e,t){var n=this.playerWasm;return n?n.mapRelativePositionToCameraPosition(e,t):null},t.prototype.updateHighlightHotspotsSetting=function(e){var t=this.playerWasm;if(!t)return null;t.updateHighlightHotspotsSetting(e)},t}(T),vt=r(void 0),ft=r("auto"),mt=r(void 0),yt=r(void 0),bt=r(void 0),wt=r(void 0),Ct=function(){var e=i(wt);if(void 0===e)throw Error("useInternalContext must be used within a provider");return e},Pt=function(e,t){switch(t.type){case"on-status":return h(h({},e),{status:t.status});case"dispose":return h(h({},e),{status:{type:"DISPOSED"},cursor:"auto"});case"on-cursor-change":return h(h({},e),{cursor:t.cursor});case"on-prototype-state-will-change":return h(h({},e),{prototypeState:h(h({},e.prototypeState),{isChanging:!0})});case"on-prototype-state-change":return h(h({},e),{prototypeState:h(h(h({},e.prototypeState),t.prototypeState),{isChanging:!1})});case"on-zoom":return h(h({},e),{zoom:t.zoom});case"on-pan":return h(h({},e),{pan:{x:t.pan.x,y:t.pan.y}});default:return e}},Et=function(n){var r=t(null),i=t(null),u=a(Pt,{status:{type:"IDLE"},cursor:"auto",prototypeState:{currentArtboardId:"",canGoBack:!1,canGoForwards:!1,isChanging:!1},zoom:1,pan:{x:0,y:0}}),l=u[0],c=l.status,d=l.cursor,p=l.prototypeState,g=l.zoom,v=l.pan,f=u[1],m=o((function(e){f({type:"on-status",status:e})}),[]),y=o((function(e){return f({type:"on-zoom",zoom:e})}),[]),b=o((function(e,t){return f({type:"on-pan",pan:{x:e,y:t}})}),[]),w=o((function(e){return f({type:"on-cursor-change",cursor:e})}),[]),C=o((function(){return f({type:"on-prototype-state-will-change"})}),[]),P=o((function(e){return f({type:"on-prototype-state-change",prototypeState:e})}),[]),E=o((function(){var e=r.current;e&&($.logDebug("Provider dispose"),e.off("status",m),e.off("cursorChange",w),e.off("prototypeStateWillChange",C),e.off("prototypeStateChange",P),e.off("cameraZoomChange",y),e.off("cameraPanChange",b),e.dispose(),r.current=null,f({type:"dispose"}))}),[m,w,C,P,b,y]),M=o((function(e,t){if(e&&t&&i.current){$.logDebug("Provider init");var n=new gt(h(h({},i.current),{container:t,canvas:e,manualInitialization:!0}));n.on("status",m),n.on("cursorChange",w),n.on("prototypeStateWillChange",C),n.on("prototypeStateChange",P),n.on("cameraZoomChange",y),n.on("cameraPanChange",b),r.current=n,n.init()}}),[m,w,C,P,b,y]),L=o((function(e){var t,n,o,a,s,u,l,c;$.logDebug("Provider setSettings"),e.backgroundColor&&e.backgroundColor!=(null===(t=i.current)||void 0===t?void 0:t.backgroundColor)&&(null===(n=r.current)||void 0===n||n.setBackgroundColor(e.backgroundColor)),(null===(o=i.current)||void 0===o?void 0:o.resizeMode)!=e.resizeMode&&(null===(a=r.current)||void 0===a||a.setResizeMode(e.resizeMode||R.Fit)),void 0!==e.highlightHotspots&&(null===(s=i.current)||void 0===s?void 0:s.highlightHotspots)!==e.highlightHotspots&&(null===(u=r.current)||void 0===u||u.updateHighlightHotspotsSetting(e.highlightHotspots)),e.disableInteraction!==(null===(l=i.current)||void 0===l?void 0:l.disableInteraction)&&(null===(c=r.current)||void 0===c||c.gestureManager.setDisable(e.disableInteraction||!1)),i.current=e}),[]),x=o((function(){return r.current}),[]),S=s((function(){return{dispose:E,init:M,setSettings:L,getInstance:x,dispatch:f}}),[E,M,L,x]);return e.createElement(wt.Provider,{value:S},e.createElement(vt.Provider,{value:c},e.createElement(ft.Provider,{value:d},e.createElement(mt.Provider,{value:p},e.createElement(yt.Provider,{value:g},e.createElement(bt.Provider,{value:v},n.children))))))},Mt=function(){var e=(0,Ct().getInstance)();return o((function(t){null==e||e.restartPrototype(t)}),[e])},Lt=function(){var e=(0,Ct().getInstance)();return o((function(){null==e||e.navigateToFirstFlow()}),[e])},xt=function(){var e=(0,Ct().getInstance)();return o((function(){null==e||e.goBack()}),[e])},St=function(){var e=(0,Ct().getInstance)();return o((function(){null==e||e.goForwards()}),[e])},Rt=function(){var e=(0,Ct().getInstance)();return o((function(t,n){return p(void 0,void 0,void 0,(function(){return g(this,(function(o){return[2,null==e?void 0:e.getArtboardAtPosition(t,n)]}))}))}),[e])},Wt=function(){var e=(0,Ct().getInstance)();return o((function(t,n){if(!e)return null;var o=e.mapRelativePositionToCameraPosition(t,n);return null!=o?o:null}),[e])},Ft=function(){var e=i(vt);if(void 0===e)throw Error("usePrototypeStatus must be used within a provider");return e},Tt=function(){var e=i(ft);if(void 0===e)throw Error("usePrototypeCursor must be used within a provider");return e},It=function(){var e=i(mt);if(void 0===e)throw Error("usePrototypeState must be used within a provider");return e},At=function(){var e=i(yt);if(void 0===e)throw Error("usePrototypeZoom must be used within a provider");return e},Dt=function(){var e=i(bt);if(void 0===e)throw Error("usePrototypePan must be used within a provider");return e},Gt=function(e,t){var n=(0,Ct().getInstance)();u((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])};function Ut(){var e=(0,Ct().getInstance)();return o((function(t){return void 0===t&&(t=!0),null==e?void 0:e.getScreen(t)}),[e])}var kt={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},Bt={position:"absolute",top:0,left:0},zt=function(n){var o=n.locateFile,r=n.imagesURLFormat,i=n.imagesURLMap,a=n.backgroundColor,l=n.mode,c=n.showTilesBorders,d=n.minimumZoomLevel,p=n.maximumZoomLevel,g=n.preserveDrawingBuffer,v=n.children,f=n.containerProps,m=n.canvasProps,y=n.featureFlags,b=n.startArtboardUUID,w=n.prototypeStructure,C=n.fragmentsURLFormat,P=n.fragmentsURLMap,E=n.highlightHotspots,M=n.resizeMode,L=n.assetsManagerLimits,x=n.cursor,S=n.disableInteraction,R=t(null),W=t(null),F=Ct(),T=F.dispose,I=F.init,A=F.setSettings,D=Ft(),G=Tt(),U=("function"==typeof x?x(G):x)||G;u((function(){return $.logDebug("PrototypeRenderer mounted"),function(){return $.logDebug("PrototypeRenderer unmounted")}}),[]),u((function(){A({locateFile:o,imagesURLFormat:r,imagesURLMap:i,backgroundColor:a,mode:l,showTilesBorders:c,minimumZoomLevel:d,maximumZoomLevel:p,preserveDrawingBuffer:g,featureFlags:y,startArtboardUUID:b,prototypeStructure:w,fragmentsURLFormat:C,fragmentsURLMap:P,highlightHotspots:E,resizeMode:M,assetsManagerLimits:L,disableInteraction:S})}),[A,o,r,i,a,l,c,d,p,g,y,b,E,M,C,P,w,L,S]),u((function(){return I(R.current,W.current),function(){T()}}),[T,I]);var k=s((function(){return h(h({},kt),{cursor:U})}),[U]);return e.createElement("div",h({},f,{ref:W,style:k}),e.createElement("canvas",h({},m,{ref:R,"data-testid":"prototype-canvas","data-prototype-status":"prototype-status-".concat((null==D?void 0:D.type.toLowerCase())||"null"),style:Bt})),"READY"===(null==D?void 0:D.type)&&v)},Zt={position:"absolute",inset:0,pointerEvents:"none"};function Ot(t){var n=t.visualize,r=void 0!==n&&n,i=Ut(),a=l((function(){return i()||null})),u=a[0],c=a[1],d=o((function(){c(i()||null)}),[i]);Gt("sceneChange",d);var p=s((function(){return h(h({},Zt),{opacity:r?1:0})}),[r]);return u?e.createElement("div",{style:p},u.layers.map((function(t,n){return e.createElement(Nt,{key:"".concat(n,"/").concat(t.id),bounds:t.bounds,id:t.id,name:t.name,type:t.type})}))):null}function Nt(t){var n=t.bounds,o=t.name,r=t.id,i=t.type,a=At(),u=Dt()||{x:0,y:0},l=u.x,c=u.y,d=s((function(){return h({position:"absolute",left:l/window.devicePixelRatio+n.x*a,top:c/window.devicePixelRatio+n.y*a,width:n.width*a,height:n.height*a,backgroundColor:"rgba(0, 255, 255, 0.2)",border:"2px dotted white"},"hotspot"===i?{cursor:"pointer",pointerEvents:"auto"}:{})}),[n.x,n.y,n.width,n.height,l,c,a,i]);return e.createElement("div",{style:d,"data-testid":"".concat(i,"-").concat(Ht(o),"-").concat(r),"data-entity-name":o,"data-entity-id":r,"data-entity-bounds-x":n.x,"data-entity-bounds-y":n.x,"data-entity-bounds-width":n.width,"data-entity-bounds-height":n.height})}function Ht(e){var t,n;return null!==(n=null===(t=e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))||void 0===t?void 0:t.join("-").toLowerCase())&&void 0!==n?n:""}export{Ie as CameraMoveContext,Te as CameraZoomingContext,Re as CanvasRenderer,Be as CanvasRendererProvider,ht as CanvasRendererReact,De as CursorContext,A as DefaultFeatureFlags,T as EventEmitter,V as GestureManager,J as KeyboardManager,I as ListenersCollector,Pe as PRCursorType,me as PRLayerSizingBehaviour,ce as PRMarinaBlendMode,ne as PRMarinaExportFormatType,le as PRMarinaLayerBlurType,ae as PRMarinaLayerBorderPosition,he as PRMarinaLayerCornerStyle,oe as PRMarinaLayerFillType,ie as PRMarinaLayerGradientType,ge as PRMarinaLayerHorizontalTextAlignment,re as PRMarinaLayerImageFillType,se as PRMarinaLayerLineCap,ue as PRMarinaLayerLineJoin,fe as PRMarinaLayerTextDecoration,pe as PRMarinaLayerTextTransform,de as PRMarinaLayerType,ve as PRMarinaLayerVerticalTextAlignment,te as PRMarinaVisibleScaleType,Ee as PRNodeExportFormat,we as PRStackCrossAxisAlignment,ye as PRStackDirection,be as PRStackMainAxisAlignment,Ce as PRUserPointerType,Ae as PanContext,K as Performance,gt as PrototypeRenderer,Et as PrototypeRendererProvider,zt as PrototypeRendererReact,R as PrototypeResizeMode,Le as PrototypeResizeModeWasm,Me as PrototypeStructureFlowType,Ot as PrototypeTestOverlay,We as StatusContext,W as WebRendererError,S as WebRendererMode,Fe as ZoomContext,z as clamp,O as convertEmbindVectorToArray,k as debounce,B as extractPointer,Z as getSupportedWebGLVersion,D as getiOSVersion,F as isDefinedPresentationManifestFrame,N as isTouchDevice,$ as logger,Y as nextTick,U as parseSafariUserAgent,ke as reducer,H as removeUndefinedKeys,j as safePtrAccess,_ as touchableClick,He as useCursor,X as useDebounceFunction,Xe as useDecrementZoom,ze as useEvent,st as useExportNode,nt as useGetArtboardAtPosition,ot as useGetPanAtPosition,Ut as useGetScreen,xt as useGoBack,St as useGoForwards,$e as useIncrementZoom,je as useIsCameraMoving,_e as useIsCameraZooming,lt as useLoadAllFragments,rt as useLockCamera,ut as useLogEvent,tt as useLooseWebGLContext,it as useMapRelativePositionToCameraPosition,Lt as useNavigateToFirstFlow,Ve as usePRFile,Je as usePRFileArtboards,Ne as usePan,Tt as usePrototypeCursor,Gt as usePrototypeEvent,Rt as usePrototypeGetArtboardAtPosition,Wt as usePrototypeMapRelativePositionToCameraPosition,Dt as usePrototypePan,It as usePrototypeState,Ft as usePrototypeStatus,At as usePrototypeZoom,Mt as useRestartPrototype,Ke as useRootNodeAbsoluteExtent,qe as useSetPan,Ye as useSetZoom,at as useShowSingleFrame,Ze as useStatus,Oe as useZoom,Qe as useZoomToFit,et as useZoomToFitNode};
@@ -1 +1 @@
1
- {"version":3,"file":"CanvasRenderer.d.ts","sourceRoot":"","sources":["../../../../src/ts/canvas-renderer/CanvasRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EAIjB,WAAW,EAIZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EACZ,cAAc,EAKf,MAAM,UAAU,CAAA;AAIjB,OAAO,EAAE,cAAc,EAA2B,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAGL,YAAY,EACZ,oBAAoB,EAIrB,MAAM,oBAAoB,CAAA;AAQ3B,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,qBAAa,cAAe,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAc;IACnC,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,uBAAuB,CAAwB;IACvD,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,kBAAkB,CAAc;IACxC,OAAO,CAAC,WAAW,CAAS;IAC5B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB,CAAS;IAE7B,QAAQ,UAAQ;IAChB,cAAc,EAAE,cAAc,CAAA;IACrC,OAAO,CAAC,YAAY,CAAS;IAO7B,OAAO,CAAC,YAAY,CAAC,CAMpB;gBAEW,QAAQ,EAAE,cAAc;IAoCpC,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,kBAAkB,CAMzB;IAEK,wBAAwB;IAW9B,kBAAkB;IAQL,IAAI;IAqCjB,qBAAqB;IAyBd,cAAc;IAMrB,OAAO,CAAC,cAAc;IAmHtB;;;;;OAKG;IACH,OAAO,CAAC,2BAA2B;IAoEnC,OAAO,CAAC,mBAAmB;IAgF3B,wBAAwB,CAAC,GAAG,EAAE,MAAM;YAOtB,cAAc;YAmBd,sBAAsB;IAyE7B,iBAAiB,CAAC,QAAQ,EAAE,OAAO;IAInC,kBAAkB,CAAC,KAAK,EAAE,SAAS;IAa1C,OAAO,CAAC,sBAAsB,CAE7B;IAED,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACI,iBAAiB;IAUxB;;;OAGG;IACI,SAAS;IAIhB;;OAEG;IACI,aAAa,CAClB,cAAc,EAAE,MAAM,EACtB,OAAO,SAAO,EACd,aAAa,UAAQ;IAKvB;;;OAGG;IACI,gBAAgB;IAIvB,oEAAoE;YACtD,OAAO;IAqCrB,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,mBAAmB;IAiBpB,SAAS;IAIT,mBAAmB;IAKnB,iBAAiB;IAIjB,kBAAkB;IAIzB;;;;OAIG;IACI,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IA8B1C,mCAAmC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAO/D;;;;OAIG;IACI,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;IAarC,SAAS,IAAI,iBAAiB;IAI9B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAKxD,MAAM;;;;IAiBN,OAAO,IAAI,MAAM;IAKjB,sBAAsB,eACf,MAAM,UACV;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,UAOjC;IAEM,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,qBAAqB,UAAQ;IA8B1D,gBAAgB,UACd;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,eAClB,WAAW,UAQzB;IAEM,sBAAsB,gBAAiB,WAAW,UAKxD;IAEM,sBAAsB,gBAAiB,WAAW,UAKxD;IAEM,4BAA4B,gBAAiB,WAAW,UAK9D;IAEM,oBAAoB,gBAAiB,WAAW,UAKtD;IAEM,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IASxC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE;IAMpC,mBAAmB,IAAI,MAAM,EAAE;IAI/B,kBAAkB;IAKZ,UAAU,CACrB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,YAAY,CAAC;IA4CjB,OAAO;CAwBf"}
1
+ {"version":3,"file":"CanvasRenderer.d.ts","sourceRoot":"","sources":["../../../../src/ts/canvas-renderer/CanvasRenderer.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EAIjB,WAAW,EAIZ,MAAM,UAAU,CAAA;AACjB,OAAO,EACL,YAAY,EACZ,cAAc,EAKf,MAAM,UAAU,CAAA;AAIjB,OAAO,EAAE,cAAc,EAA2B,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAElD,OAAO,EAGL,YAAY,EACZ,oBAAoB,EAIrB,MAAM,oBAAoB,CAAA;AAQ3B,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,IAAI,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,qBAAa,cAAe,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IACjE,OAAO,CAAC,QAAQ,CAAyB;IACzC,OAAO,CAAC,MAAM,CAAsC;IACpD,OAAO,CAAC,UAAU,CAAC,CAAY;IAC/B,OAAO,CAAC,YAAY,CAAC,CAAc;IACnC,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,uBAAuB,CAAwB;IACvD,OAAO,CAAC,aAAa,CAAe;IACpC,OAAO,CAAC,cAAc,CAAS;IAC/B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,eAAe,CAAc;IACrC,OAAO,CAAC,kBAAkB,CAAc;IACxC,OAAO,CAAC,WAAW,CAAS;IAC5B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB,CAAS;IAE7B,QAAQ,UAAQ;IAChB,cAAc,EAAE,cAAc,CAAA;IACrC,OAAO,CAAC,YAAY,CAAS;IAO7B,OAAO,CAAC,YAAY,CAAC,CAMpB;gBAEW,QAAQ,EAAE,cAAc;IAoCpC,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,kBAAkB,CAMzB;IAEK,wBAAwB;IAW9B,kBAAkB;IAQL,IAAI;IAqCjB,qBAAqB;IAyBd,cAAc;IAMrB,OAAO,CAAC,cAAc;IAmHtB;;;;;OAKG;IACH,OAAO,CAAC,2BAA2B;IAoEnC,OAAO,CAAC,mBAAmB;IAgF3B,wBAAwB,CAAC,GAAG,EAAE,MAAM;YAOtB,cAAc;YAmBd,sBAAsB;IAyE7B,iBAAiB,CAAC,QAAQ,EAAE,OAAO;IAInC,kBAAkB,CAAC,KAAK,EAAE,SAAS;IAa1C,OAAO,CAAC,sBAAsB,CAE7B;IAED,OAAO,CAAC,kBAAkB;IAe1B;;OAEG;IACI,iBAAiB;IAUxB;;;OAGG;IACI,SAAS;IAIhB;;OAEG;IACI,aAAa,CAClB,cAAc,EAAE,MAAM,EACtB,OAAO,SAAO,EACd,aAAa,UAAQ;IAKvB;;;OAGG;IACI,gBAAgB;IAIvB,oEAAoE;YACtD,OAAO;IAqCrB,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,SAAS;IAUjB,OAAO,CAAC,mBAAmB;IAiBpB,SAAS;IAIT,mBAAmB;IAKnB,iBAAiB;IAIjB,kBAAkB;IAIzB;;;;OAIG;IACI,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IA8B1C,mCAAmC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAO/D;;;;OAIG;IACI,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;;;;IAarC,SAAS,IAAI,iBAAiB;IAI9B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAKxD,MAAM;;;;IAiBN,OAAO,IAAI,MAAM;IAKjB,sBAAsB,eACf,MAAM,UACV;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,UAOjC;IAEM,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,qBAAqB,UAAQ;IA8B1D,gBAAgB,UACd;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,eAClB,WAAW,UAQzB;IAEM,sBAAsB,gBAAiB,WAAW,UAKxD;IAEM,sBAAsB,gBAAiB,WAAW,UAKxD;IAEM,4BAA4B,gBAAiB,WAAW,UAK9D;IAEM,oBAAoB,gBAAiB,WAAW,UAKtD;IAEM,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IASxC,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE;IAiBpC,mBAAmB,IAAI,MAAM,EAAE;IAI/B,kBAAkB;IAKZ,UAAU,CACrB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,cAAc,GAC7B,OAAO,CAAC,YAAY,CAAC;IA4CjB,OAAO;CAwBf"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sketch-hq/sketch-web-renderer",
3
- "version": "14.13.1",
3
+ "version": "14.13.2",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Sketch Web Renderer",
6
6
  "repository": "git@github.com:sketch-hq/web-renderer",
@@ -51,7 +51,7 @@
51
51
  "@rollup/plugin-replace": "5.0.2",
52
52
  "@rollup/plugin-terser": "0.4.3",
53
53
  "@rollup/plugin-typescript": "11.1.1",
54
- "@sketch-hq/sketch-file-format-marina": "14.13.1",
54
+ "@sketch-hq/sketch-file-format-marina": "14.13.2",
55
55
  "@types/node": "20.19.27",
56
56
  "@types/offscreencanvas": "2019.7.0",
57
57
  "@types/pixelmatch": "5.2.4",