@sketch-hq/sketch-web-renderer 3.1.2 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @sketch-hq/sketch-web-renderer
2
2
 
3
+ ## 3.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - de01e61: Both touch and mouse events listeners are attached, so mouse inputs can continue to work on devices having both a touchscreen and mouse
8
+
3
9
  ## 3.1.2
4
10
 
5
11
  ### Patch Changes
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"),require("styled-components"));else if("function"==typeof define&&define.amd)define(["react","react-dom","styled-components"],t);else{var n="object"==typeof exports?t(require("react"),require("react-dom"),require("styled-components")):t(e.react,e["react-dom"],e["styled-components"]);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(function(e,t,n){return(()=>{var o,r,i,a,s={519:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});const o={delayedDraw:!0,useNewTiledRenderer:!0,offscreenCanvas:!1,safariWebGL2:!1,pageBoundariesLimit:!1}},946:(e,t,n)=>{"use strict";n.d(t,{d:()=>B});var o,r=n(354),i=function(){function e(){this.removeListenerCallbacks=[]}return e.prototype.add=function(e,t,n,o){e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o)};return this.removeListenerCallbacks.push(r),r},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e}(),a=n(388),s=function(){function e(e,t){var n=this;this.cameraMoveState={status:"inactive"},this.endInteractionDebounced=(0,a.Ds)((function(){"inactive"!==n.cameraMoveState.status&&("moving"===n.cameraMoveState.status&&n.onCameraMoveEnd(),n.setCameraMoveStatus("inactive"))}),100),this.onCameraMoveStart=e,this.onCameraMoveEnd=t}return e.prototype.dispose=function(){this.endInteractionDebounced.cancel(),this.cameraMoveState={status:"inactive"}},e.prototype.handleCameraMoveEvent=function(){var e;this.endInteractionDebounced(),"inactive"===this.cameraMoveState.status&&this.setCameraMoveStatus("uncertain"),"uncertain"===this.cameraMoveState.status&&(e=this.cameraMoveState,Date.now()-e.interactionStartTimestamp>=20)&&(this.onCameraMoveStart(),this.setCameraMoveStatus("moving"))},e.prototype.setCameraMoveStatus=function(e){this.cameraMoveState="uncertain"===e?{status:"uncertain",interactionStartTimestamp:Date.now()}:{status:e}},e}(),u=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),c=function(){return(c=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},l=function(e){function t(t,n){var o=e.call(this)||this;return o.listenersCollector=new i,o.state={panning:!1,zooming:!1,pinchToZoomLastDistance:0,lastPan:{x:0,y:0},zoomCenter:{x:0,y:0},lastGestureScale:1,mouse:{x:0,y:0},isCameraLocked:!1,isWaitingForSecondClick:!1,lastMouseClickPosition:{x:0,y:0}},o.handleGestureStart=function(e){e.preventDefault(),o.state.isCameraLocked||(o.state.lastGestureScale=e.scale,o.emitZoomStartEvent())},o.handleGestureChange=function(e){if(e.preventDefault(),!o.state.isCameraLocked){o.state.zoomCenter=o.getCorrectPointerPosition(e);var t=e.scale/o.state.lastGestureScale;o.state.lastGestureScale=e.scale,o.emitZoomEvent(t,o.state.zoomCenter,!1),o.cameraMoveTracker.handleCameraMoveEvent()}},o.handleGestureEnd=function(e){e.preventDefault(),o.emitZoomEndEvent()},o.handlePointerDown=function(e){(e instanceof MouseEvent&&0===e.button||(0,a.z6)(e))&&(e.preventDefault(),o.updateMousePosition(e),o.handlePanStart(),o.handleTouchPinchToZoomStart(e),o.emit("mousedown"))},o.handlePanStart=function(){o.state.panning=!0,o.state.lastPan.x=o.state.mouse.x,o.state.lastPan.y=o.state.mouse.y},o.handleTouchPinchToZoomStart=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){o.emitZoomStartEvent();var n=e.touches[0],r=e.touches[1];o.state.pinchToZoomLastDistance=Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY)}},o.handlePointerMove=function(e){(0,a.z6)(e)&&o.handleTouchPinchToZoomChange(e),o.state.panning||o.updateMousePosition(e)},o.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var n=e.touches[0],r=e.touches[1],i=Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY),a={x:(n.clientX+r.clientX)/2,y:(n.clientY+r.clientY)/2},s=i/Math.max(o.state.pinchToZoomLastDistance,1);o.state.pinchToZoomLastDistance=i,o.emitZoomEvent(s,a,!1)}},o.handlePanMove=function(e){if(o.state.panning&&!o.state.isCameraLocked){var t=o.getCorrectPointerPosition(e),n=o.state.lastPan.x-t.x,r=o.state.lastPan.y-t.y;o.state.lastPan.x=t.x,o.state.lastPan.y=t.y,o.emit("panChange",-n,-r),o.cameraMoveTracker.handleCameraMoveEvent()}},o.handleDoubleClick=function(e){if(!("undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&e.touches.length>0)){var t=o.getCorrectPointerPosition(e),n=Math.hypot(o.state.lastMouseClickPosition.x-t.x,o.state.lastMouseClickPosition.y-t.y)>("undefined"!=typeof TouchEvent&&e instanceof TouchEvent?15:0);if(!o.state.isWaitingForSecondClick||n)return o.state.isWaitingForSecondClick=!0,o.state.lastMouseClickPosition=o.getCorrectPointerPosition(e),void o.resetDoubleClick();o.state.isWaitingForSecondClick=!1,o.emit("doubleClick")}},o.resetDoubleClick=(0,a.Ds)((function(){o.state.isWaitingForSecondClick=!1}),500),o.handlePanEnd=function(){o.state.panning=!1},o.handlePointerUp=function(e){var t;o.handleTouchPinchToZoomEnd(e),(null===(t=e.touches)||void 0===t?void 0:t.length)>1||o.emit("mouseup")},o.handleTouchPinchToZoomEnd=function(e){var t;(null===(t=e.touches)||void 0===t?void 0:t.length)>2||o.emitZoomEndEvent()},o.handleMouseWheel=function(e){if(e.preventDefault(),!o.state.isCameraLocked){var t=e.metaKey||e.ctrlKey;if(o.updateMousePosition(e),t){var n=e.ctrlKey?-1:1;o.state.zoomCenter=o.getCorrectPointerPosition(e);var r=1+.01*e.deltaY*n;o.emitZoomEvent(r,o.state.zoomCenter)}else o.emit("panChange",-e.deltaX,-e.deltaY);o.cameraMoveTracker.handleCameraMoveEvent()}},o.emitZoomEndEvent=(0,a.Ds)((function(){o.state.zooming&&(o.state.zooming=!1,o.emit("zoomEnd"))}),90),o.handleCameraMoveStart=function(){o.emit("cameraMoveStart")},o.handleCameraMoveEnd=function(){o.emit("cameraMoveEnd")},o.target=t,o.settings=n,o.targetBounds=t.getBoundingClientRect(),o.addListeners(),o.cameraMoveTracker=new s(o.handleCameraMoveStart,o.handleCameraMoveEnd),o}return u(t,e),t.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},t.prototype.addListeners=function(){(0,a.b1)()?this.addTouchEventListeners():this.addMouseEventListeners(),this.addSafariGesturesEventListeners()},t.prototype.addMouseEventListeners=function(){this.listenersCollector.add(this.target,"mousedown",this.handlePointerDown),this.listenersCollector.add(this.target,"mousemove",this.handlePointerMove),this.listenersCollector.add(document,"mousemove",this.handlePanMove),this.listenersCollector.add(this.target,"mouseup",this.handlePointerUp),this.listenersCollector.add(document,"mouseup",this.handlePanEnd),this.listenersCollector.add(this.target,"wheel",this.handleMouseWheel),this.listenersCollector.add(this.target,"mouseup",this.handleDoubleClick)},t.prototype.addTouchEventListeners=function(){this.listenersCollector.add(this.target,"touchstart",this.handlePointerDown),this.listenersCollector.add(document,"touchmove",this.handlePanMove,{passive:!0}),this.listenersCollector.add(this.target,"touchmove",this.handlePointerMove,{passive:!0}),this.listenersCollector.add(this.target,"touchend",this.handlePointerUp),this.listenersCollector.add(this.target,"touchcancel",this.handlePointerUp),this.listenersCollector.add(document,"touchend",this.handlePanEnd),this.listenersCollector.add(this.target,"touchend",this.handleDoubleClick)},t.prototype.addSafariGesturesEventListeners=function(){(0,a.b1)()||(this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart,{capture:!0}),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange,{capture:!0}),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd,{capture:!0}))},t.prototype.getCorrectPointerPosition=function(e){var t,n=(0,a.MP)(e);if((null===(t=e.touches)||void 0===t?void 0:t.length)>1){var o=e,r=o.touches[0],i=o.touches[1],s={x:(r.clientX+i.clientX)/2,y:(r.clientY+i.clientY)/2};n.x=s.x,n.y=s.y}var u={x:0,y:0};return u.x=(0,a.uZ)(n.x-this.targetBounds.x,0,this.target.clientWidth),u.y=(0,a.uZ)(n.y-this.targetBounds.y,0,this.target.clientHeight),u},t.prototype.updateMousePosition=function(e){this.state.mouse=this.getCorrectPointerPosition(e),this.emit("mousemove",this.state.mouse.x,this.state.mouse.y)},t.prototype.emitZoomEvent=function(e,t,n){void 0===n&&(n=!0),n&&this.emitZoomStartEvent(),this.emit("zoomChange",e,t),n&&this.emitZoomEndEvent()},t.prototype.emitZoomStartEvent=function(){this.state.zooming||(this.state.zooming=!0,this.emit("zoomStart"))},t.prototype.getMouse=function(){return c({},this.state.mouse)},t.prototype.setMouse=function(e,t){this.state.mouse.x=e,this.state.mouse.y=t,this.emit("mousemove",this.state.mouse.x,this.state.mouse.y)},t.prototype.setIsCameraLocked=function(e){this.state.isCameraLocked=e},t.prototype.getMinZoomLevel=function(){return this.settings.minimumZoomLevel},t.prototype.getMaxZoomLevel=function(){return this.settings.maximumZoomLevel},t.prototype.dispose=function(){this.listenersCollector.dispose(),this.cameraMoveTracker.dispose()},t}(r.v),h=n(475),d=n(419);const f=Symbol("Comlink.proxy"),v=Symbol("Comlink.endpoint"),p=Symbol("Comlink.releaseProxy"),m=Symbol("Comlink.thrown"),g=e=>"object"==typeof e&&null!==e||"function"==typeof e,b=new Map([["proxy",{canHandle:e=>g(e)&&e[f],serialize(e){const{port1:t,port2:n}=new MessageChannel;return y(e,t),[n,[n]]},deserialize:e=>(e.start(),C(e))}],["throw",{canHandle:e=>g(e)&&m in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function y(e,t=self){t.addEventListener("message",(function n(o){if(!o||!o.data)return;const{id:r,type:i,path:a}=Object.assign({path:[]},o.data),s=(o.data.argumentList||[]).map(L);let u;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),n=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":u=n;break;case"SET":t[a.slice(-1)[0]]=L(o.data.value),u=!0;break;case"APPLY":u=n.apply(t,s);break;case"CONSTRUCT":u=M(new n(...s));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;y(e,n),u=W(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[m]:0}}Promise.resolve(u).catch((e=>({value:e,[m]:0}))).then((e=>{const[o,a]=S(e);t.postMessage(Object.assign(Object.assign({},o),{id:r}),a),"RELEASE"===i&&(t.removeEventListener("message",n),w(t))}))})),t.start&&t.start()}function w(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function C(e,t){return P(e,[],t)}function k(e){if(e)throw new Error("Proxy has been released and is not useable")}function P(e,t=[],n=function(){}){let o=!1;const r=new Proxy(n,{get(n,i){if(k(o),i===p)return()=>O(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{w(e),o=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=O(e,{type:"GET",path:t.map((e=>e.toString()))}).then(L);return n.then.bind(n)}return P(e,[...t,i])},set(n,r,i){k(o);const[a,s]=S(i);return O(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},s).then(L)},apply(n,r,i){k(o);const a=t[t.length-1];if(a===v)return O(e,{type:"ENDPOINT"}).then(L);if("bind"===a)return P(e,t.slice(0,-1));const[s,u]=E(i);return O(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},u).then(L)},construct(n,r){k(o);const[i,a]=E(r);return O(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(L)}});return r}function E(e){const t=e.map(S);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const x=new WeakMap;function W(e,t){return x.set(e,t),e}function M(e){return Object.assign(e,{[f]:!0})}function S(e){for(const[t,n]of b)if(n.canHandle(e)){const[o,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:o},r]}return[{type:"RAW",value:e},x.get(e)||[]]}function L(e){switch(e.type){case"HANDLER":return b.get(e.name).deserialize(e.value);case"RAW":return e.value}}function O(e,t,n){return new Promise((o=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===r&&(e.removeEventListener("message",t),o(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}var D,Z=n(849),R=n(519),z=n(332),T=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),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 T(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(r.v),_=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),I=function(){return(I=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},F=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},A=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},G=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};!function(e){e[e.browser=0]="browser",e[e.worker=1]="worker"}(D||(D={}));var B=function(e){function t(t){var n,o=e.call(this)||this;o.listenersCollector=new i,o.handleZoomStart=function(){o.emit("zoomStart")},o.handleZoomEnd=function(){o.emit("zoomEnd")},o.handleCameraMoveStart=function(){var e;null===(e=o.sketchWeb)||void 0===e||e.setIsCameraMoving(!0)},o.handleCameraMoveEnd=function(){var e;null===(e=o.sketchWeb)||void 0===e||e.setIsCameraMoving(!1)},o.handleMouseChange=function(e,t){var n;null===(n=o.sketchWeb)||void 0===n||n.setMouse(e,t)},o.handlePanChange=function(e,t){return F(o,void 0,void 0,(function(){var n;return A(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.addPan(e,t),this.emitPanEvent(),[2]}))}))},o.handleZoomChange=function(e,t){return F(o,void 0,void 0,(function(){var n;return A(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.addZoom(e,t),this.emitZoomEvent(),this.emitPanEvent(),[2]}))}))},o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){var e;o.setCanvasSize(t,n),o.gestureManager.updateTargetBounds(),null===(e=o.sketchWeb)||void 0===e||e.setSize(t,n,o.getDevicePixelRatio())}))};var r=null!==(n=t.featureFlags)&&void 0!==n?n:{};return o.featureFlags=I(I({},R.Z),r),o.settings=t,o.canvas=t.canvas,o.gestureManager=new l(o.settings.container,{minimumZoomLevel:t.minimumZoomLevel,maximumZoomLevel:t.maximumZoomLevel}),o.keyboardManager=new j(document.body),Z.Z.active=t.mode===z.p.debug,o.init(),o}return _(t,e),t.prototype.init=function(){var e;return F(this,void 0,void 0,(function(){var t,n,o;return A(this,(function(r){switch(r.label){case 0:return this.setCanvasSize(this.settings.container.clientWidth,this.settings.container.clientHeight),[4,this.initSketchWeb()];case 1:return r.sent(),[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()];case 2:return"FILE_READY"!==(null==(t=r.sent())?void 0:t.type)?[2]:(n=void 0!==this.settings.initialZoom,o=void 0!==this.settings.initialPan,n||o?n?[4,this.setZoom(this.settings.initialZoom)]:[3,4]:[3,7]);case 3:r.sent(),r.label=4;case 4:return o?[4,this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)]:[3,6];case 5:r.sent(),r.label=6;case 6:return[3,9];case 7:return[4,this.zoomToFit()];case 8:r.sent(),r.label=9;case 9:return this.sketchWeb.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initSketchWeb=function(){return F(this,void 0,void 0,(function(){var e,t,o,r,i;return A(this,(function(a){switch(a.label){case 0:return e=this.featureFlags.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=I(I({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio(),featureFlags:this.featureFlags}),e?(this.environment=D.worker,Z.Z.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(n.p+n.u(285),n.b),{type:void 0}),o=C(this.worker),r=this,[4,new o(W(I(I({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return r.sketchWeb=a.sent(),[3,3];case 2:this.environment=D.browser,Z.Z.debug("Using normal canvas"),this.sketchWeb=new h.U(t),a.label=3;case 3:return(i=this.sketchWeb).on("status",this.forwardEvent("status")),i.on("fileReady",this.forwardEvent("fileReady")),i.on("metric",this.forwardEvent("metric")),i.on("warnings",this.forwardEvent("warnings")),i.on("allImagesReady",this.forwardEvent("allImagesReady")),[4,this.sketchWeb.init()];case 4:return a.sent(),[2]}}))}))},t.prototype.forwardEvent=function(e){var t=this,n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t.emit.apply(t,G([e],n))};return this.environment===D.worker?M(n):n},t.prototype.isRunningInsideWorker=function(){return this.environment===D.worker},t.prototype.looseWebGLContext=function(){var e;null===(e=this.sketchWeb)||void 0===e||e.looseWebGLContext()},t.prototype.addListeners=function(){this.canvasResizeObserver=new ResizeObserver(this.handleCanvasResizeObserver),this.canvasResizeObserver.observe(this.settings.container),this.listenersCollector.add(window,"orientationchange",this.handleDeviceOrientationChange),this.gestureManager.on("panChange",this.handlePanChange),this.gestureManager.on("mousemove",this.handleMouseChange),this.gestureManager.on("zoomChange",this.handleZoomChange),this.gestureManager.on("zoomStart",this.handleZoomStart),this.gestureManager.on("zoomEnd",this.handleZoomEnd),this.gestureManager.on("cameraMoveStart",this.handleCameraMoveStart),this.gestureManager.on("cameraMoveEnd",this.handleCameraMoveEnd)},t.prototype.emitPanEvent=function(){var e;return F(this,void 0,void 0,(function(){var t;return A(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()];case 1:return(t=n.sent())?(this.emit("pan",t.x,t.y),[2]):[2]}}))}))},t.prototype.emitZoomEvent=function(){var e;return F(this,void 0,void 0,(function(){var t;return A(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()];case 1:return void 0===(t=n.sent())||this.emit("zoom",t),[2]}}))}))},t.prototype.getDevicePixelRatio=function(){return(0,d.uZ)(window.devicePixelRatio,1,2)},t.prototype.setCanvasSize=function(e,t){this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.getDevicePixelRatio(),this.canvas.height=t*this.getDevicePixelRatio()},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.settings.container.clientWidth,height:this.settings.container.clientHeight})},t.prototype.zoomToFit=function(){return F(this,void 0,void 0,(function(){return A(this,(function(e){switch(e.label){case 0:return[4,this.sketchWeb.scaleDocumentToFit()];case 1:return e.sent(),this.emitZoomEvent(),this.emitPanEvent(),[2]}}))}))},t.prototype.getStatus=function(){var e;return F(this,void 0,void 0,(function(){return A(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()]}))}))},t.prototype.generateDocumentPNG=function(){var e;return F(this,void 0,void 0,(function(){return A(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.getDocument=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getDocument()},t.prototype.getArtboardAtPosition=function(e,t){var n;return F(this,void 0,void 0,(function(){return A(this,(function(o){switch(o.label){case 0:return[4,null===(n=this.sketchWeb)||void 0===n?void 0:n.getArtboardAtPosition(e,t)];case 1:return[2,o.sent()||null]}}))}))},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWeb)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.setPan=function(e,t,n){var o;return F(this,void 0,void 0,(function(){return A(this,(function(r){switch(r.label){case 0:return[4,null===(o=this.sketchWeb)||void 0===o?void 0:o.setPan(e,t,Boolean(n))];case 1:return r.sent(),this.emitPanEvent(),[2]}}))}))},t.prototype.setZoom=function(e,t){var n;return F(this,void 0,void 0,(function(){var o;return A(this,(function(r){return o=null!=t?t:this.getCanvasCenterPoint(),null===(n=this.sketchWeb)||void 0===n||n.setZoom(e,o),this.emitZoomEvent(),this.emitPanEvent(),[2]}))}))},t.prototype.getCanvasCenterPoint=function(){var e=this.canvas.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()},t.prototype.getPan=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()},t.prototype.dispose=function(){var e,t,n,o;return F(this,void 0,void 0,(function(){return A(this,(function(r){switch(r.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.dispose(),this.listenersCollector.dispose(),null===(e=this.canvasResizeObserver)||void 0===e||e.disconnect(),this.isRunningInsideWorker()?[4,null===(t=this.sketchWeb)||void 0===t?void 0:t.dispose()]:[3,2];case 1:return r.sent(),null===(n=this.worker)||void 0===n||n.terminate(),[3,3];case 2:null===(o=this.sketchWeb)||void 0===o||o.dispose(),r.label=3;case 3:return[2]}}))}))},t}(r.v)},475:(e,t,n)=>{"use strict";n.d(t,{U:()=>p});var o,r=n(419),i=n(519),a=n(354),s=n(108),u=n(849),c=n(758),l=n(332),h=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),d=function(){return(d=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},f=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},v=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},p=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,o=t.locateFile,a=t.filePath,c=t.imagesURLFormat,h=t.imagesURLMap,f=t.backgroundColor,v=void 0===f?{r:1,g:1,b:1,a:1}:f,p=t.highlightColor,m=void 0===p?{r:0,g:0,b:0,a:1}:p,g=t.size,b=t.pixelRatio,y=t.mode,w=t.showTilesBorders,C=void 0!==w&&w,k=t.minimumZoomLevel,P=t.maximumZoomLevel,E=t.preserveDrawingBuffer,x=void 0!==E&&E,W=t.panBoundariesPadding,M=void 0===W?40:W,S=t.featureFlags,L=void 0===S?{}:S,O=e.call(this)||this;return O.status={type:"INIT"},O.handleWebGLContextLost=function(){O.setStatus({type:"WEBGL_CONTEXT_LOST"})},O.debouncedFullDraw=(0,r.Ds)((function(){return O.draw(!0)}),60),O.canvas=n,O.locateFile=o,O.filePath=a,O.imagesURLFormat=c,O.imagesURLMap=h,O.backgroundColor=v,O.highlightColor=m,O.size=g,O.pixelRatio=b,O.mode=y,O.showTilesBorders=C,O.currentWebGLVersion=(0,r.wX)(),O.zoomLevels={min:k,max:P},O.preserveDrawingBuffer=x,O.panBoundariesPadding=M,O.featureFlags=d(d({},i.Z),L),u.Z.active=y===l.p.debug,O.traceFirstPaint=new s.S("FirstPaint"),O}return h(t,e),t.prototype.init=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[4,this.preloadImages()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof c.k?e:new c.k("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new s.S("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.draw(!0,!1),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){u.Z.debug("[C++] "+e)},logWarning:function(e){u.Z.warning("[C++] "+e)},logError:function(e){u.Z.error("[C++] "+e)},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(u.Z.warning("Not able to resolve the url for the image with UUID: "+t),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new s.S("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),u.Z.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return f(this,void 0,void 0,(function(){var e,t,o,r,i,a,h,d=this;return v(this,(function(f){switch(f.label){case 0:return e=new s.S("WasmModuleDownload"),this.mode!==l.p.debug?[3,2]:[4,n.e(425).then(n.t.bind(n,425,23))];case 1:return t=f.sent(),[3,4];case 2:return[4,n.e(816).then(n.t.bind(n,816,23))];case 3:t=f.sent(),f.label=4;case 4:o=t.default,f.label=5;case 5:return f.trys.push([5,7,,8]),r=this,[4,o({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return d.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=f.sent(),[3,8];case 7:throw i=f.sent(),new c.k("WASM_ERROR","An error occurred while trying to create the wasm module.",i);case 8:if(e.printMeasurement(),this.emit("metric",e.measure()),a={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},u.Z.debug("Using WebGL "+a.majorVersion),!(h=this.wasmModule.GL.createContext(this.canvas,a)))throw new c.k("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=h;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio)}catch(e){throw new c.k("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setHighlightColor(this.highlightColor.r,this.highlightColor.g,this.highlightColor.b,this.highlightColor.a),this.sketchWebWasm.setRendererConfiguration({showTilesBorders:this.showTilesBorders}),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.generateDocumentPNG=function(){return f(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.sketchWebWasm.generateDocumentPNG()]}}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit(),this.delayedDraw()},t.prototype.setFile=function(e){return f(this,void 0,void 0,(function(){var t=this;return v(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.sketchWebWasm.setFile(e,(function(e){if(void 0===e&&(e=[]),e.length){u.Z.debug("Parser warnings: "+e);var o=e.map((function(e){return{key:e}}));t.emit("warnings",o)}t.setStatus({type:"FILE_READY"}),t.emit("fileReady",t.getDocument()),n()}),(function(){return o(new c.k("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.delayedDraw=function(){if(!this.featureFlags.delayedDraw)return this.draw(!0);this.draw(),this.debouncedFullDraw()},t.prototype.draw=function(e,t){var n;void 0===e&&(e=!1),void 0===t&&(t=!1),null===(n=this.sketchWebWasm)||void 0===n||n.setNeedsUpdate(e,t)},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:e.toString()+(e.cause?"\nWrapped Error: "+e.cause.toString():"")}),u.Z.error(e),e.cause&&u.Z.error(e.cause)},t.prototype.setPixelRatio=function(e){this.pixelRatio=e,this.setSize(this.size.width*this.pixelRatio,this.size.height*this.pixelRatio,this.pixelRatio),this.delayedDraw()},t.prototype.setSize=function(e,t,n){var o;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(o=this.sketchWebWasm)||void 0===o||o.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(u.Z.debug("Status transition "+this.status.type+" => "+e.type+"}"),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:d(d({},e),{artboards:(0,r.gi)(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getArtboardAtPosition(e,t)},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,o;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(o=this.sketchWebWasm)||void 0===o||o.setZoom(e),this.delayedDraw()},t.prototype.addZoom=function(e,t){var n,o;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(o=this.sketchWebWasm)||void 0===o||o.addZoom(e),this.delayedDraw()},t.prototype.setPan=function(e,t,n){var o;void 0===n&&(n=!1),null===(o=this.sketchWebWasm)||void 0===o||o.setPan(e,t,n),this.delayedDraw()},t.prototype.addPan=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.addPan(e,t),this.delayedDraw()},t.prototype.getPan=function(){if(this.sketchWebWasm)return this.sketchWebWasm.getPan()},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.setMouse=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.setMouse(e,t)},t.prototype.setIsCameraMoving=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraMoving(e)},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new c.k("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(a.v))},550:(e,t,n)=>{"use strict";n.d(t,{j4:()=>ze,aV:()=>ke,z0:()=>me,oW:()=>oe,jr:()=>O,tm:()=>_,ky:()=>M,zX:()=>Y,ex:()=>G,Jw:()=>B,m_:()=>U,Yy:()=>j,d6:()=>Z,aP:()=>D,EY:()=>N,pt:()=>A,od:()=>L,ph:()=>I,lt:()=>T,$z:()=>W,BO:()=>S,us:()=>F});var o=n(297),r=n.n(o),i=n(332),a=n(849),s=(0,o.createContext)(void 0),u=function(){var e=(0,o.useContext)(s);if(void 0===e)throw Error("useSketchWebInternalContext must be used within a SketchWebProvider");return e},c=n(419),l=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o},h=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a.Z.debug.apply(a.Z,l(["SketchWebReact"],e))};function d(e){return(0,c.b1)()?{onTouchEnd:e}:{onClick:e}}var f,v,p,m,g,b,y=(0,o.createContext)(void 0),w=(0,o.createContext)(void 0),C=(0,o.createContext)(void 0),k=(0,o.createContext)(void 0),P=(0,o.createContext)(void 0),E=(0,o.createContext)(void 0),x=(0,o.createContext)(void 0),W=function(){var e=(0,o.useContext)(y);if(void 0===e)throw Error("useStatus must be used within a SketchWebProvider");return e},M=function(){var e=(0,o.useContext)(w);if(void 0===e)throw Error("useDocument must be used within a SketchWebProvider");return e},S=function(){var e=(0,o.useContext)(C);if(void 0===e)throw Error("useZoom must be used within a SketchWebProvider");return e},L=function(){var e=(0,o.useContext)(E);if(void 0===e)throw Error("usePan must be used within a SketchWebProvider");return e},O=function(){var e=(0,o.useContext)(x);if(void 0===e)throw Error("useCursor must be used within a SketchWebProvider");return e},D=function(){var e=(0,o.useContext)(k);if(void 0===status)throw Error("useIsCameraZooming must be used within a SketchWebProvider");return e},Z=function(){var e=(0,o.useContext)(P);if(void 0===status)throw Error("useIsCameraMoving must be used within a SketchWebProvider");return e},R=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},z=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},T=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){h("setZoom",t),console.log(e),null==e||e.setZoom(t)}),[e])},j=function(){var e=T(),t=S();return(0,o.useCallback)((function(){var n;h("incrementZoom"),"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},_=function(){var e=T(),t=S();return(0,o.useCallback)((function(){h("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},I=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;h("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},F=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){h("zoomToFit"),null==e||e.zoomToFit()}),[e])},A=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){h("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},G=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){return R(void 0,void 0,void 0,(function(){return z(this,(function(t){switch(t.label){case 0:return h("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},B=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return R(void 0,void 0,void 0,(function(){return z(this,(function(o){switch(o.label){case 0:return h("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},U=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return R(void 0,void 0,void 0,(function(){return z(this,(function(o){switch(o.label){case 0:return h("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},N=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){h("setIsCameraLocked",t),null==e||e.gestureManager.setIsCameraLocked(t)}),[e])},Y=function(e,t){var n=(0,u().getManager)();(0,o.useEffect)((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},X=n(268),H=n.n(X),V=n(914),q=n.n(V),J=(0,V.createGlobalStyle)(f||(p=["\n *:where(:not(iframe, canvas, img, svg, video):not(svg *, symbol *)) {\n all: unset;\n display: revert;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n"],m=["\n *:where(:not(iframe, canvas, img, svg, video):not(svg *, symbol *)) {\n all: unset;\n display: revert;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n"],Object.defineProperty?Object.defineProperty(p,"raw",{value:m}):p.raw=m,f=p)),K=function(){return(K=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},$=(0,V.createGlobalStyle)(v||(v=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}(["\n ","\n"],["\n ","\n"])),(function(e){return e.injectedStyles})),Q=function(e){var t=e.children,n=e.injectedStyles,i=(0,o.useRef)(null),a=(0,o.useState)(null),s=a[0],u=a[1];return r().createElement("div",{ref:function(e){e&&(i.current=e,e.shadowRoot||u(e.attachShadow({mode:"open",delegatesFocus:!0})))},style:{position:"relative",width:"100%",height:"100%"}},s&&H().createPortal(r().createElement(V.StyleSheetManager,{target:s},r().createElement(r().Fragment,null,r().createElement(J,null),n&&r().createElement($,{injectedStyles:n}),t)),s))},ee=function(){return(ee=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},te={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},ne={position:"absolute",top:0,left:0},oe=(g=function(e){a.Z.active=e.mode===i.p.debug;var t=e.filePath,n=e.locateFile,s=e.imagesURLFormat,c=e.imagesURLMap,l=e.backgroundColor,h=e.highlightColor,d=e.mode,f=e.showTilesBorders,v=e.minimumZoomLevel,p=e.maximumZoomLevel,m=e.preserveDrawingBuffer,g=e.panBoundariesPadding,b=e.initialPan,y=e.initialZoom,w=e.children,C=e.containerProps,k=void 0===C?{}:C,P=e.canvasProps,E=void 0===P?{}:P,x=e.featureFlags,M=void 0===x?{}:x,S=(0,o.useRef)(null),L=(0,o.useRef)(null),D=(0,o.useState)(!1),Z=D[0],R=D[1],z=(0,o.useCallback)((function(){return R(!0)}),[]),T=u(),j=T.dispose,_=T.init,I=T.setSettings,F=O(),A=W();Y("allImagesReady",z),(0,o.useEffect)((function(){I({locateFile:n,imagesURLFormat:s,imagesURLMap:c,backgroundColor:l,highlightColor:h,mode:d,showTilesBorders:f,minimumZoomLevel:v,maximumZoomLevel:p,preserveDrawingBuffer:m,panBoundariesPadding:g,initialPan:b,initialZoom:y,featureFlags:M})}),[I,n,s,c,l,h,d,f,v,p,m,g,b,y,M]),(0,o.useEffect)((function(){if(t)return _(t,S.current,L.current),function(){j()}}),[j,_,t]);var G=(0,o.useMemo)((function(){var t;return null!==(t=e.cursor)&&void 0!==t?t:F}),[e.cursor,F]),B=(0,o.useMemo)((function(){return ee(ee({},te),{cursor:G})}),[G]);return r().createElement("div",ee({},k,{ref:L,style:B}),t&&r().createElement("canvas",ee({},E,{key:t,ref:S,"data-sketchweb-all-images-ready":Z,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-"+((null==A?void 0:A.type.toLowerCase())||"null"),style:ne})),"READY"===(null==A?void 0:A.type)&&w)},function(e){var t=e.injectedStyles,n=e.useShadowRoot,o=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["injectedStyles","useShadowRoot"]);return n?r().createElement(Q,{injectedStyles:t},r().createElement(g,K({},o))):r().createElement(g,K({},o))}),re=n(946);!function(e){e.Draggable="grab",e.Dragging="grabbing",e.Hover="pointer",e.Default="auto"}(b||(b={}));var ie,ae,se,ue,ce,le,he,de,fe=function(){return(fe=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},ve=function(e,t){switch(h('dispatched: "'+t.type+'"',t),t.type){case"on-status":return fe(fe({},e),{status:t.status});case"on-file-ready":return fe(fe({},e),{document:t.document});case"on-zoom":return fe(fe({},e),{zoom:t.zoom});case"on-pan":return fe(fe({},e),{pan:t.pan});case"dispose":return fe(fe({},e),{status:null,zoom:null,pan:null,cursor:b.Default});case"post-init":return fe(fe({},e),{status:t.status,zoom:t.zoom});case"on-camera-zoom-start":return fe(fe({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return fe(fe({},e),{isCameraZooming:!1});case"on-camera-move-start":return fe(fe({},e),{cursor:e.isMouseDown?b.Dragging:b.Draggable,isCameraMoving:!0});case"on-camera-move-end":return fe(fe({},e),{isCameraMoving:!1});case"on-mouse-down":return fe(fe({},e),{cursor:b.Dragging,isMouseDown:!0});case"on-mouse-up":return fe(fe({},e),{cursor:b.Draggable,isMouseDown:!1});default:return e}},pe=function(){return(pe=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},me=function(e){var t=e.children,n=(0,o.useRef)(null),i=(0,o.useRef)(null),a=(0,o.useReducer)(ve,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:b.Default,isMouseDown:!1}),u=a[0],c=u.status,l=u.document,d=u.zoom,f=u.pan,v=u.isCameraZooming,p=u.isCameraMoving,m=u.cursor,g=a[1],W=(0,o.useCallback)((function(e){return g({type:"on-zoom",zoom:e})}),[]),M=(0,o.useCallback)((function(e,t){return g({type:"on-pan",pan:{x:e,y:t}})}),[]),S=(0,o.useCallback)((function(e){g({type:"on-status",status:e})}),[]),L=(0,o.useCallback)((function(e){g({type:"on-file-ready",document:e})}),[]),O=(0,o.useCallback)((function(){return g({type:"on-mouse-down"})}),[]),D=(0,o.useCallback)((function(){return g({type:"on-mouse-up"})}),[]),Z=(0,o.useCallback)((function(){return g({type:"on-camera-zoom-start"})}),[]),R=(0,o.useCallback)((function(){return g({type:"on-camera-zoom-end"})}),[]),z=(0,o.useCallback)((function(){return g({type:"on-camera-move-start"})}),[]),T=(0,o.useCallback)((function(){return g({type:"on-camera-move-end"})}),[]),j=(0,o.useCallback)((function(){var e=n.current;e&&(h("dispose"),e.off("status",S),e.off("fileReady",L),e.off("zoom",W),e.off("pan",M),e.gestureManager.off("mousedown",O),e.gestureManager.off("mouseup",D),e.gestureManager.off("zoomStart",Z),e.gestureManager.off("zoomEnd",R),e.gestureManager.off("cameraMoveStart",z),e.gestureManager.off("cameraMoveEnd",T),e.dispose(),n.current=null,g({type:"dispose"}))}),[S,L,M,W,D,O,Z,R,z,T]),_=(0,o.useCallback)((function(e,t,o){if(""!==e&&t&&o&&i.current){h("init");var r=new re.d(pe(pe({},i.current),{filePath:e,container:o,canvas:t}));r.on("status",S),r.on("fileReady",L),r.on("zoom",W),r.on("pan",M),r.gestureManager.on("mousedown",O),r.gestureManager.on("mouseup",D),r.gestureManager.on("zoomStart",Z),r.gestureManager.on("zoomEnd",R),r.gestureManager.on("cameraMoveStart",z),r.gestureManager.on("cameraMoveEnd",T),a=void 0,s=void 0,c=function(){var e,t;return function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(n){switch(n.label){case 0:return e=g,t={type:"post-init"},[4,r.getZoom()];case 1:return t.zoom=n.sent()||null,[4,r.getStatus()];case 2:return t.status=n.sent()||null,[4,r.getPan()];case 3:return e.apply(void 0,[(t.pan=n.sent()||null,t)]),[2]}}))},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{r(c.next(e))}catch(e){t(e)}}function o(e){try{r(c.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof u?r:new u((function(e){e(r)}))).then(n,o)}r((c=c.apply(a,s||[])).next())})),n.current=r}var a,s,u,c}),[S,L,W,M,O,D,Z,R,z,T]),I=(0,o.useCallback)((function(e){h("setSettings",e),i.current=e}),[]),F=(0,o.useCallback)((function(){return n.current}),[]),A=(0,o.useMemo)((function(){return{dispose:j,init:_,setSettings:I,getManager:F,dispatch:g}}),[j,_,I,F]);return r().createElement(s.Provider,{value:A},r().createElement(y.Provider,{value:c},r().createElement(w.Provider,{value:l},r().createElement(C.Provider,{value:d},r().createElement(E.Provider,{value:f},r().createElement(k.Provider,{value:v},r().createElement(P.Provider,{value:p},r().createElement(x.Provider,{value:m},t))))))))},ge=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},be=q().div(ie||(ie=ge(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n"]))),ye=q().div(ae||(ae=ge(["\n position: absolute;\n top: 0;\n left: 0;\n transform-origin: top left;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n transform-origin: top left;\n"]))),we=function(e){var t=e.document,n=e.children,o=L()||{x:0,y:0},i=S()||1,a=Z(),s=D();return r().createElement(ye,{style:{willChange:a?"transform, width, height":"",pointerEvents:a?"none":"auto",width:t.bounds.width*i+"px",height:t.bounds.height*i+"px",transform:"translate3d("+o.x*i+"px, "+o.y*i+"px, 0)",display:s?"none":"block"}},n)},Ce=function(){return(Ce=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},ke=function(e){var t=e.children,n=e.onClick,o=M();return o?r().createElement(be,Ce({},d(n)),r().createElement(we,{document:o},t)):null},Pe=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Ee=q().div(se||(se=Pe(["\n position: absolute;\n box-sizing: border-box;\n cursor: pointer;\n\n // Just some default font styles\n font-size: 12px;\n font-style: normal;\n font-family: sans-serif;\n\n font: ",";\n\n ","\n"],["\n position: absolute;\n box-sizing: border-box;\n cursor: pointer;\n\n // Just some default font styles\n font-size: 12px;\n font-style: normal;\n font-family: sans-serif;\n\n font: ",";\n\n ","\n"])),(function(e){return e.font}),(function(e){return e.selected?"box-shadow: 0 0 0 4px "+e.outlineColor+";":"\n &:hover {\n box-shadow: 0 0 0 2px "+e.outlineColor+";\n }\n "})),xe=q().div(ue||(ue=Pe(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: auto;\n padding: 0 0 6px 0;\n transform: translateY(-100%);\n display: flex;\n pointer-events: none;\n visibility: ",";\n align-items: center;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: auto;\n padding: 0 0 6px 0;\n transform: translateY(-100%);\n display: flex;\n pointer-events: none;\n visibility: ",";\n align-items: center;\n"])),(function(e){return e.visible?"visible":"hidden"})),We=q().span(ce||(ce=Pe(["\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n pointer-events: auto;\n color: ",";\n"],["\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n pointer-events: auto;\n color: ",";\n"])),(function(e){return e.textColor})),Me=q().button(le||(le=Pe(["\n position: relative;\n white-space: nowrap;\n margin-right: 0;\n margin-left: auto;\n align-items: center;\n pointer-events: auto;\n display: ",";\n font: inherit;\n"],["\n position: relative;\n white-space: nowrap;\n margin-right: 0;\n margin-left: auto;\n align-items: center;\n pointer-events: auto;\n display: ",";\n font: inherit;\n"])),(function(e){return e.visible?"flex":"none"})),Se=q().span(he||(he=Pe(["\n color: ",";\n display: ",";\n font: inherit;\n"],["\n color: ",";\n display: ",";\n font: inherit;\n"])),(function(e){return e.textColor}),(function(e){return e.visible?"initial":"none"})),Le=q().span(de||(de=Pe(["\n position: relative;\n width: 14px;\n height: 14px;\n margin-left: 4px;\n"],["\n position: relative;\n width: 14px;\n height: 14px;\n margin-left: 4px;\n"])));function Oe(){return r().createElement(Le,null,r().createElement("svg",{viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},r().createElement("g",{fill:"none",fillRule:"evenodd"},r().createElement("path",{d:"M6.755 0h.49c1.55 0 2.708.278 3.686.801a5.452 5.452 0 0 1 2.268 2.268c.523.978.801 2.136.801 3.686v.49c0 1.55-.278 2.708-.801 3.686a5.452 5.452 0 0 1-2.268 2.268c-.978.523-2.136.801-3.686.801h-.49c-1.55 0-2.708-.278-3.686-.801A5.452 5.452 0 0 1 .801 10.93C.278 9.953 0 8.795 0 7.245v-.49c0-1.55.278-2.708.801-3.686A5.452 5.452 0 0 1 3.07.801C4.047.278 5.205 0 6.755 0Z",fillOpacity:".083",fill:"#000",fillRule:"nonzero"}),r().createElement("path",{strokeOpacity:".55",stroke:"#000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 9.5 10 7 7.5 4.5M8.5 7H4"}))))}var De=function(){return(De=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},Ze=r().forwardRef((function(e,t){var n,i=e.document,a=e.artboard,s=e.selected,u=e.onClick,c=e.onDoubleClick,l=e.onCTAClick,h=e.font,f=e.outlineColor,v=e.nameTextColor,p=e.ctaTextColor,m=e.ctaText,g=null!==(n=S())&&void 0!==n?n:1,b=a.bounds.width*g,y=b>100,w=b>160,C=(0,o.useMemo)((function(){var e=a.bounds,t=i.bounds;return{x:(e.x-t.x)/t.width*100,y:(e.y-t.y)/t.height*100,width:e.width/t.width*100,height:e.height/t.height*100}}),[a.bounds,i.bounds]),k=C.x,P=C.y,E=C.width,x=C.height;return r().createElement(Ee,De({ref:t,selected:s,font:h,outlineColor:f},d((function(e){null==u||u(a,e)})),{onDoubleClick:function(e){null==c||c(a,e)},style:{left:k+"%",top:P+"%",width:E+"%",height:x+"%"}}),r().createElement(xe,{visible:y},r().createElement(We,{textColor:v},a.name),r().createElement(Me,De({visible:s},d((function(e){null==l||l(a,e)}))),r().createElement(Se,{textColor:p,visible:w},m),r().createElement(Oe,null))))}));Ze.displayName="Artboard";var Re=function(){return(Re=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},ze=function(e){var t=e.artboardStyle,n=e.onGoToArtboard,i=M(),a=(0,o.useState)(null),s=a[0],u=a[1],c=(0,o.useRef)({});function l(e,t){u(e.objectId)}function h(e){null==n||n(e.objectId,"doubleClick")}function d(e){null==n||n(e.objectId,"CTA")}return(0,o.useEffect)((function(){function e(e){"Enter"===e.key&&s&&(null==n||n(s,"keyPressEnter"))}return window.document.body.addEventListener("keypress",e),function(){window.document.body.removeEventListener("keypress",e)}}),[n,s]),i?r().createElement(ke,{onClick:function(e){var t;for(var n in c.current)if(null===(t=c.current[n])||void 0===t?void 0:t.contains(e.target))return;u(null)}},i.artboards.map((function(e){return r().createElement(Ze,Re({ref:function(t){return c.current[e.objectId]=t},key:e.objectId,selected:s===e.objectId,onClick:l,onDoubleClick:h,onCTAClick:d,artboard:e,document:i},t))}))):null}},758:(e,t,n)=>{"use strict";n.d(t,{k:()=>i});var o,r=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"("+n+") "+o)||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return r(t,e),t}(Error)},18:()=>{},689:()=>{},332:(e,t,n)=>{"use strict";var o;n.d(t,{p:()=>o}),function(e){e.debug="debug",e.release="release"}(o||(o={}))},119:()=>{},650:()=>{},312:()=>{},552:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var o=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,o;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(o=this.listeners[e])||void 0===o||o.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this.listeners[e];(null==o?void 0:o.size)&&o.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e}()},354:(e,t,n)=>{"use strict";n.d(t,{v:()=>o.v});var o=n(552)},849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};const r=new(function(){function e(){this.active=!0}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.debug.apply(console,o(["[SketchWeb] [Debug]"],e))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,o(["[SketchWeb] [Warn]"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,o(["[SketchWeb] [Error]"],e))},e}())},108:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});var o=n(849),r=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),o.Z.debug("[Performance] Start: "+this.label)}return e.prototype.measure=function(){var e=performance.now()-this.startTime;return{duration:e,end:this.startTimestamp+e,start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}()},419:(e,t,n)=>{"use strict";n.d(t,{uZ:()=>o.uZ,gi:()=>o.gi,Ds:()=>o.Ds,wX:()=>o.wX,b1:()=>o.b1});var o=n(388)},388:(e,t,n)=>{"use strict";n.d(t,{Ds:()=>i,MP:()=>a,uZ:()=>s,wX:()=>u,gi:()=>c,b1:()=>l,z6:()=>h});var o=n(519),r=n(66);function i(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 a(e){var t,n,o,r,i,a,s,u;return{x:null!==(r=null!==(t=e.pageX)&&void 0!==t?t:null===(o=null===(n=e.touches)||void 0===n?void 0:n[0])||void 0===o?void 0:o.pageX)&&void 0!==r?r:e.clientX,y:null!==(u=null!==(i=e.pageY)&&void 0!==i?i:null===(s=null===(a=e.touches)||void 0===a?void 0:a[0])||void 0===s?void 0:s.pageY)&&void 0!==u?u:e.clientY}}function s(e,t,n){return Math.max(t,Math.min(n,e))}function u(){return(0,r.t)()&&!o.Z.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function c(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}function l(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function h(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent||void 0!==e.touches||void 0!==e.targetTouches||void 0!==e.changedTouches}},66:(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,r=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(o);if(!t)return null;var n=t[1];return"Macintosh"!==n&&"iPad"!==n&&"iPhone"!==n?null:{hardware:n,version:{major:parseInt(t[4])||0,minor:parseInt(t[5])||0,patch:parseInt(t[6])||0}}}},297:t=>{"use strict";t.exports=e},268:e=>{"use strict";e.exports=t},914:e=>{"use strict";e.exports=n}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return s[e](n,n.exports,c),n.exports}c.m=s,c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var n=Object.create(null);c.r(n);var i={};o=o||[null,r({}),r([]),r(r)];for(var a=2&t&&e;"object"==typeof a&&!~o.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,c.d(n,i),n},c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce(((t,n)=>(c.f[n](e,t),t)),[])),c.u=e=>"static/js/web-renderer-"+{285:"e994a7769632a6f8c640",425:"148f39e38ee433dd320b",816:"076a12afe5f111b57e6c"}[e]+".chunk.js",c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i={},a="@sketch-hq/sketch-web-renderer:",c.l=(e,t,n,o)=>{if(i[e])i[e].push(t);else{var r,s;if(void 0!==n)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];if(h.getAttribute("src")==e||h.getAttribute("data-webpack")==a+n){r=h;break}}r||(s=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,c.nc&&r.setAttribute("nonce",c.nc),r.setAttribute("data-webpack",a+n),r.src=e),i[e]=[t];var d=(t,n)=>{r.onerror=r.onload=null,clearTimeout(f);var o=i[e];if(delete i[e],r.parentNode&&r.parentNode.removeChild(r),o&&o.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=d.bind(null,r.onerror),r.onload=d.bind(null,r.onload),s&&document.head.appendChild(r)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.p="/",(()=>{c.b=document.baseURI||self.location.href;var e={826:0};c.f.j=(t,n)=>{var o=c.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=c.p+c.u(t),a=new Error;c.l(i,(n=>{if(c.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[i,a,s]=n,u=0;if(i.some((t=>0!==e[t]))){for(o in a)c.o(a,o)&&(c.m[o]=a[o]);s&&s(c)}for(t&&t(n);u<i.length;u++)r=i[u],c.o(e,r)&&e[r]&&e[r][0](),e[i[u]]=0},n=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var l={};return(()=>{"use strict";c.r(l),c.d(l,{default:()=>v,DefaultFeatureFlags:()=>p,SketchWeb:()=>n.U,SketchWebMode:()=>a.p,SketchWebError:()=>u.k,ArtboardsInfoOverlay:()=>f.j4,Overlay:()=>f.aV,SketchWebProvider:()=>f.z0,SketchWebReact:()=>f.oW,useCursor:()=>f.jr,useDecrementZoom:()=>f.tm,useDocument:()=>f.ky,useEvent:()=>f.zX,useGenerateDocumentPNG:()=>f.ex,useGetArtboardAtPosititon:()=>f.Jw,useGetPanAtPosition:()=>f.m_,useIncrementZoom:()=>f.Yy,useIsCameraMoving:()=>f.d6,useIsCameraZooming:()=>f.aP,useLockCamera:()=>f.EY,useLooseWebGLContext:()=>f.pt,usePan:()=>f.od,useSetPan:()=>f.ph,useSetZoom:()=>f.lt,useStatus:()=>f.$z,useZoom:()=>f.BO,useZoomToFit:()=>f.us});var e=c(946),t=c(519),n=c(475),o=c(18),r={};for(const e in o)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>o[e]);c.d(l,r);var i=c(119);r={};for(const e in i)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>i[e]);c.d(l,r);var a=c(332),s=c(312);r={};for(const e in s)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode"].indexOf(e)<0&&(r[e]=()=>s[e]);c.d(l,r);var u=c(758),h=c(689);r={};for(const e in h)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>h[e]);c.d(l,r);var d=c(650);r={};for(const e in d)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>d[e]);c.d(l,r);var f=c(550);const v=e.d;var p=t.Z})(),l})()}));
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("react-dom"),require("styled-components"));else if("function"==typeof define&&define.amd)define(["react","react-dom","styled-components"],t);else{var n="object"==typeof exports?t(require("react"),require("react-dom"),require("styled-components")):t(e.react,e["react-dom"],e["styled-components"]);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(self,(function(e,t,n){return(()=>{var o,r,i,a,s={519:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});const o={delayedDraw:!0,useNewTiledRenderer:!0,offscreenCanvas:!1,safariWebGL2:!1,pageBoundariesLimit:!1}},946:(e,t,n)=>{"use strict";n.d(t,{d:()=>B});var o,r=n(354),i=function(){function e(){this.removeListenerCallbacks=[]}return e.prototype.add=function(e,t,n,o){e.addEventListener(t,n,o);var r=function(){e.removeEventListener(t,n,o)};return this.removeListenerCallbacks.push(r),r},e.prototype.dispose=function(){this.removeListenerCallbacks.forEach((function(e){return e()}))},e}(),a=n(388),s=function(){function e(e,t){var n=this;this.cameraMoveState={status:"inactive"},this.endInteractionDebounced=(0,a.Ds)((function(){"inactive"!==n.cameraMoveState.status&&("moving"===n.cameraMoveState.status&&n.onCameraMoveEnd(),n.setCameraMoveStatus("inactive"))}),100),this.onCameraMoveStart=e,this.onCameraMoveEnd=t}return e.prototype.dispose=function(){this.endInteractionDebounced.cancel(),this.cameraMoveState={status:"inactive"}},e.prototype.handleCameraMoveEvent=function(){var e;this.endInteractionDebounced(),"inactive"===this.cameraMoveState.status&&this.setCameraMoveStatus("uncertain"),"uncertain"===this.cameraMoveState.status&&(e=this.cameraMoveState,Date.now()-e.interactionStartTimestamp>=20)&&(this.onCameraMoveStart(),this.setCameraMoveStatus("moving"))},e.prototype.setCameraMoveStatus=function(e){this.cameraMoveState="uncertain"===e?{status:"uncertain",interactionStartTimestamp:Date.now()}:{status:e}},e}(),u=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),c=function(){return(c=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},l=function(e){function t(t,n){var o=e.call(this)||this;return o.listenersCollector=new i,o.state={panning:!1,zooming:!1,pinchToZoomLastDistance:0,lastPan:{x:0,y:0},zoomCenter:{x:0,y:0},lastGestureScale:1,mouse:{x:0,y:0},isCameraLocked:!1,isWaitingForSecondClick:!1,lastMouseClickPosition:{x:0,y:0}},o.handleGestureStart=function(e){e.preventDefault(),o.state.isCameraLocked||(o.state.lastGestureScale=e.scale,o.emitZoomStartEvent())},o.handleGestureChange=function(e){if(e.preventDefault(),!o.state.isCameraLocked){o.state.zoomCenter=o.getCorrectPointerPosition(e);var t=e.scale/o.state.lastGestureScale;o.state.lastGestureScale=e.scale,o.emitZoomEvent(t,o.state.zoomCenter,!1),o.cameraMoveTracker.handleCameraMoveEvent()}},o.handleGestureEnd=function(e){e.preventDefault(),o.emitZoomEndEvent()},o.handlePointerDown=function(e){(e instanceof MouseEvent&&0===e.button||(0,a.z6)(e))&&(e.preventDefault(),o.updateMousePosition(e),o.handlePanStart(),o.handleTouchPinchToZoomStart(e),o.emit("mousedown"))},o.handlePanStart=function(){o.state.panning=!0,o.state.lastPan.x=o.state.mouse.x,o.state.lastPan.y=o.state.mouse.y},o.handleTouchPinchToZoomStart=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){o.emitZoomStartEvent();var n=e.touches[0],r=e.touches[1];o.state.pinchToZoomLastDistance=Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY)}},o.handlePointerMove=function(e){(0,a.z6)(e)&&o.handleTouchPinchToZoomChange(e),o.state.panning||o.updateMousePosition(e)},o.handleTouchPinchToZoomChange=function(e){var t;if(e.touches&&!((null===(t=e.touches)||void 0===t?void 0:t.length)<2)){var n=e.touches[0],r=e.touches[1],i=Math.hypot(n.clientX-r.clientX,n.clientY-r.clientY),a=o.clampPointerToTargetBounds({x:(n.clientX+r.clientX)/2,y:(n.clientY+r.clientY)/2}),s=i/Math.max(o.state.pinchToZoomLastDistance,1);o.state.pinchToZoomLastDistance=i,o.emitZoomEvent(s,a,!1)}},o.handlePanMove=function(e){if(o.state.panning&&!o.state.isCameraLocked){var t=o.getCorrectPointerPosition(e),n=o.state.lastPan.x-t.x,r=o.state.lastPan.y-t.y;o.state.lastPan.x=t.x,o.state.lastPan.y=t.y,o.emit("panChange",-n,-r),o.cameraMoveTracker.handleCameraMoveEvent()}},o.handleDoubleClick=function(e){if(!("undefined"!=typeof TouchEvent&&e instanceof TouchEvent&&e.touches.length>0)){var t=o.getCorrectPointerPosition(e),n=Math.hypot(o.state.lastMouseClickPosition.x-t.x,o.state.lastMouseClickPosition.y-t.y)>("undefined"!=typeof TouchEvent&&e instanceof TouchEvent?15:0);if(!o.state.isWaitingForSecondClick||n)return o.state.isWaitingForSecondClick=!0,o.state.lastMouseClickPosition=o.getCorrectPointerPosition(e),void o.resetDoubleClick();o.state.isWaitingForSecondClick=!1,o.emit("doubleClick")}},o.resetDoubleClick=(0,a.Ds)((function(){o.state.isWaitingForSecondClick=!1}),500),o.handlePanEnd=function(){o.state.panning=!1},o.handlePointerUp=function(e){var t;o.handleTouchPinchToZoomEnd(e),(null===(t=e.touches)||void 0===t?void 0:t.length)>1||o.emit("mouseup")},o.handleTouchPinchToZoomEnd=function(e){var t;(null===(t=e.touches)||void 0===t?void 0:t.length)>2||o.emitZoomEndEvent()},o.handleMouseWheel=function(e){if(e.preventDefault(),!o.state.isCameraLocked){var t=e.metaKey||e.ctrlKey;if(o.updateMousePosition(e),t){var n=e.ctrlKey?-1:1;o.state.zoomCenter=o.getCorrectPointerPosition(e);var r=1+.01*e.deltaY*n;o.emitZoomEvent(r,o.state.zoomCenter)}else o.emit("panChange",-e.deltaX,-e.deltaY);o.cameraMoveTracker.handleCameraMoveEvent()}},o.emitZoomEndEvent=(0,a.Ds)((function(){o.state.zooming&&(o.state.zooming=!1,o.emit("zoomEnd"))}),90),o.handleCameraMoveStart=function(){o.emit("cameraMoveStart")},o.handleCameraMoveEnd=function(){o.emit("cameraMoveEnd")},o.target=t,o.settings=n,o.targetBounds=t.getBoundingClientRect(),o.addListeners(),o.cameraMoveTracker=new s(o.handleCameraMoveStart,o.handleCameraMoveEnd),o}return u(t,e),t.prototype.updateTargetBounds=function(){this.targetBounds=this.target.getBoundingClientRect()},t.prototype.addListeners=function(){this.addTouchEventListeners(),this.addMouseEventListeners(),this.addSafariGesturesEventListeners()},t.prototype.addMouseEventListeners=function(){this.listenersCollector.add(this.target,"mousedown",this.handlePointerDown),this.listenersCollector.add(this.target,"mousemove",this.handlePointerMove),this.listenersCollector.add(document,"mousemove",this.handlePanMove),this.listenersCollector.add(this.target,"mouseup",this.handlePointerUp),this.listenersCollector.add(document,"mouseup",this.handlePanEnd),this.listenersCollector.add(this.target,"wheel",this.handleMouseWheel),this.listenersCollector.add(this.target,"mouseup",this.handleDoubleClick)},t.prototype.addTouchEventListeners=function(){this.listenersCollector.add(this.target,"touchstart",this.handlePointerDown),this.listenersCollector.add(document,"touchmove",this.handlePanMove,{passive:!0}),this.listenersCollector.add(this.target,"touchmove",this.handlePointerMove,{passive:!0}),this.listenersCollector.add(this.target,"touchend",this.handlePointerUp),this.listenersCollector.add(this.target,"touchcancel",this.handlePointerUp),this.listenersCollector.add(document,"touchend",this.handlePanEnd),this.listenersCollector.add(this.target,"touchend",this.handleDoubleClick)},t.prototype.addSafariGesturesEventListeners=function(){(0,a.b1)()||(this.listenersCollector.add(this.target,"gesturestart",this.handleGestureStart,{capture:!0}),this.listenersCollector.add(this.target,"gesturechange",this.handleGestureChange,{capture:!0}),this.listenersCollector.add(this.target,"gestureend",this.handleGestureEnd,{capture:!0}))},t.prototype.clampPointerToTargetBounds=function(e){return{x:(0,a.uZ)(e.x-this.targetBounds.x,0,this.target.clientWidth),y:(0,a.uZ)(e.y-this.targetBounds.y,0,this.target.clientHeight)}},t.prototype.getCorrectPointerPosition=function(e){var t,n={x:0,y:0};if((null===(t=e.touches)||void 0===t?void 0:t.length)>1){var o=e,r=o.touches[0],i=o.touches[1];n={x:(r.clientX+i.clientX)/2,y:(r.clientY+i.clientY)/2}}else n=(0,a.MP)(e);return this.clampPointerToTargetBounds(n)},t.prototype.updateMousePosition=function(e){this.state.mouse=this.getCorrectPointerPosition(e),this.emit("mousemove",this.state.mouse.x,this.state.mouse.y)},t.prototype.emitZoomEvent=function(e,t,n){void 0===n&&(n=!0),n&&this.emitZoomStartEvent(),this.emit("zoomChange",e,t),n&&this.emitZoomEndEvent()},t.prototype.emitZoomStartEvent=function(){this.state.zooming||(this.state.zooming=!0,this.emit("zoomStart"))},t.prototype.getMouse=function(){return c({},this.state.mouse)},t.prototype.setMouse=function(e,t){this.state.mouse.x=e,this.state.mouse.y=t,this.emit("mousemove",this.state.mouse.x,this.state.mouse.y)},t.prototype.setIsCameraLocked=function(e){this.state.isCameraLocked=e},t.prototype.getMinZoomLevel=function(){return this.settings.minimumZoomLevel},t.prototype.getMaxZoomLevel=function(){return this.settings.maximumZoomLevel},t.prototype.dispose=function(){this.listenersCollector.dispose(),this.cameraMoveTracker.dispose()},t}(r.v),h=n(475),d=n(419);const f=Symbol("Comlink.proxy"),v=Symbol("Comlink.endpoint"),p=Symbol("Comlink.releaseProxy"),m=Symbol("Comlink.thrown"),g=e=>"object"==typeof e&&null!==e||"function"==typeof e,b=new Map([["proxy",{canHandle:e=>g(e)&&e[f],serialize(e){const{port1:t,port2:n}=new MessageChannel;return y(e,t),[n,[n]]},deserialize:e=>(e.start(),C(e))}],["throw",{canHandle:e=>g(e)&&m in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function y(e,t=self){t.addEventListener("message",(function n(o){if(!o||!o.data)return;const{id:r,type:i,path:a}=Object.assign({path:[]},o.data),s=(o.data.argumentList||[]).map(L);let u;try{const t=a.slice(0,-1).reduce(((e,t)=>e[t]),e),n=a.reduce(((e,t)=>e[t]),e);switch(i){case"GET":u=n;break;case"SET":t[a.slice(-1)[0]]=L(o.data.value),u=!0;break;case"APPLY":u=n.apply(t,s);break;case"CONSTRUCT":u=S(new n(...s));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;y(e,n),u=M(t,[t])}break;case"RELEASE":u=void 0;break;default:return}}catch(e){u={value:e,[m]:0}}Promise.resolve(u).catch((e=>({value:e,[m]:0}))).then((e=>{const[o,a]=W(e);t.postMessage(Object.assign(Object.assign({},o),{id:r}),a),"RELEASE"===i&&(t.removeEventListener("message",n),w(t))}))})),t.start&&t.start()}function w(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function C(e,t){return P(e,[],t)}function k(e){if(e)throw new Error("Proxy has been released and is not useable")}function P(e,t=[],n=function(){}){let o=!1;const r=new Proxy(n,{get(n,i){if(k(o),i===p)return()=>O(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{w(e),o=!0}));if("then"===i){if(0===t.length)return{then:()=>r};const n=O(e,{type:"GET",path:t.map((e=>e.toString()))}).then(L);return n.then.bind(n)}return P(e,[...t,i])},set(n,r,i){k(o);const[a,s]=W(i);return O(e,{type:"SET",path:[...t,r].map((e=>e.toString())),value:a},s).then(L)},apply(n,r,i){k(o);const a=t[t.length-1];if(a===v)return O(e,{type:"ENDPOINT"}).then(L);if("bind"===a)return P(e,t.slice(0,-1));const[s,u]=E(i);return O(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:s},u).then(L)},construct(n,r){k(o);const[i,a]=E(r);return O(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},a).then(L)}});return r}function E(e){const t=e.map(W);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const x=new WeakMap;function M(e,t){return x.set(e,t),e}function S(e){return Object.assign(e,{[f]:!0})}function W(e){for(const[t,n]of b)if(n.canHandle(e)){const[o,r]=n.serialize(e);return[{type:"HANDLER",name:t,value:o},r]}return[{type:"RAW",value:e},x.get(e)||[]]}function L(e){switch(e.type){case"HANDLER":return b.get(e.name).deserialize(e.value);case"RAW":return e.value}}function O(e,t,n){return new Promise((o=>{const r=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===r&&(e.removeEventListener("message",t),o(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:r},t),n)}))}var D,Z=n(849),R=n(519),T=n(332),z=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),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 z(t,e),t.prototype.addListeners=function(){this.listenersCollector.add(this.target,"keyup",this.handleKeyUp)},t.prototype.dispose=function(){this.listenersCollector.dispose()},t}(r.v),_=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function o(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),I=function(){return(I=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},F=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},A=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},G=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};!function(e){e[e.browser=0]="browser",e[e.worker=1]="worker"}(D||(D={}));var B=function(e){function t(t){var n,o=e.call(this)||this;o.listenersCollector=new i,o.handleZoomStart=function(){o.emit("zoomStart")},o.handleZoomEnd=function(){o.emit("zoomEnd")},o.handleCameraMoveStart=function(){var e;null===(e=o.sketchWeb)||void 0===e||e.setIsCameraMoving(!0)},o.handleCameraMoveEnd=function(){var e;null===(e=o.sketchWeb)||void 0===e||e.setIsCameraMoving(!1)},o.handleMouseChange=function(e,t){var n;null===(n=o.sketchWeb)||void 0===n||n.setMouse(e,t)},o.handlePanChange=function(e,t){return F(o,void 0,void 0,(function(){var n;return A(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.addPan(e,t),this.emitPanEvent(),[2]}))}))},o.handleZoomChange=function(e,t){return F(o,void 0,void 0,(function(){var n;return A(this,(function(o){return null===(n=this.sketchWeb)||void 0===n||n.addZoom(e,t),this.emitZoomEvent(),this.emitPanEvent(),[2]}))}))},o.handleCanvasResizeObserver=function(e){o.resizeCanvas(e[0].contentRect)},o.resizeCanvas=function(e){var t=e.width,n=e.height;window.requestAnimationFrame((function(){var e;o.setCanvasSize(t,n),o.gestureManager.updateTargetBounds(),null===(e=o.sketchWeb)||void 0===e||e.setSize(t,n,o.getDevicePixelRatio())}))};var r=null!==(n=t.featureFlags)&&void 0!==n?n:{};return o.featureFlags=I(I({},R.Z),r),o.settings=t,o.canvas=t.canvas,o.gestureManager=new l(o.settings.container,{minimumZoomLevel:t.minimumZoomLevel,maximumZoomLevel:t.maximumZoomLevel}),o.keyboardManager=new j(document.body),Z.Z.active=t.mode===T.p.debug,o.init(),o}return _(t,e),t.prototype.init=function(){var e;return F(this,void 0,void 0,(function(){var t,n,o;return A(this,(function(r){switch(r.label){case 0:return this.setCanvasSize(this.settings.container.clientWidth,this.settings.container.clientHeight),[4,this.initSketchWeb()];case 1:return r.sent(),[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()];case 2:return"FILE_READY"!==(null==(t=r.sent())?void 0:t.type)?[2]:(n=void 0!==this.settings.initialZoom,o=void 0!==this.settings.initialPan,n||o?n?[4,this.setZoom(this.settings.initialZoom)]:[3,4]:[3,7]);case 3:r.sent(),r.label=4;case 4:return o?[4,this.setPan(this.settings.initialPan.x,this.settings.initialPan.y,this.settings.initialPan.centerPointInViewport)]:[3,6];case 5:r.sent(),r.label=6;case 6:return[3,9];case 7:return[4,this.zoomToFit()];case 8:r.sent(),r.label=9;case 9:return this.sketchWeb.startRendering(),this.addListeners(),[2]}}))}))},t.prototype.initSketchWeb=function(){return F(this,void 0,void 0,(function(){var e,t,o,r,i;return A(this,(function(a){switch(a.label){case 0:return e=this.featureFlags.offscreenCanvas&&"function"==typeof this.canvas.transferControlToOffscreen,t=I(I({},this.settings),{size:{width:this.canvas.width,height:this.canvas.height},pixelRatio:this.getDevicePixelRatio(),featureFlags:this.featureFlags}),e?(this.environment=D.worker,Z.Z.debug("Using offscreen canvas"),this.offscreenCanvas=this.canvas.transferControlToOffscreen(),this.worker=new Worker(new URL(n.p+n.u(285),n.b),{type:void 0}),o=C(this.worker),r=this,[4,new o(M(I(I({},t),{canvas:this.offscreenCanvas}),[this.offscreenCanvas]))]):[3,2];case 1:return r.sketchWeb=a.sent(),[3,3];case 2:this.environment=D.browser,Z.Z.debug("Using normal canvas"),this.sketchWeb=new h.U(t),a.label=3;case 3:return(i=this.sketchWeb).on("status",this.forwardEvent("status")),i.on("fileReady",this.forwardEvent("fileReady")),i.on("metric",this.forwardEvent("metric")),i.on("warnings",this.forwardEvent("warnings")),i.on("allImagesReady",this.forwardEvent("allImagesReady")),[4,this.sketchWeb.init()];case 4:return a.sent(),[2]}}))}))},t.prototype.forwardEvent=function(e){var t=this,n=function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];t.emit.apply(t,G([e],n))};return this.environment===D.worker?S(n):n},t.prototype.isRunningInsideWorker=function(){return this.environment===D.worker},t.prototype.looseWebGLContext=function(){var e;null===(e=this.sketchWeb)||void 0===e||e.looseWebGLContext()},t.prototype.addListeners=function(){this.canvasResizeObserver=new ResizeObserver(this.handleCanvasResizeObserver),this.canvasResizeObserver.observe(this.settings.container),this.listenersCollector.add(window,"orientationchange",this.handleDeviceOrientationChange),this.gestureManager.on("panChange",this.handlePanChange),this.gestureManager.on("mousemove",this.handleMouseChange),this.gestureManager.on("zoomChange",this.handleZoomChange),this.gestureManager.on("zoomStart",this.handleZoomStart),this.gestureManager.on("zoomEnd",this.handleZoomEnd),this.gestureManager.on("cameraMoveStart",this.handleCameraMoveStart),this.gestureManager.on("cameraMoveEnd",this.handleCameraMoveEnd)},t.prototype.emitPanEvent=function(){var e;return F(this,void 0,void 0,(function(){var t;return A(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()];case 1:return(t=n.sent())?(this.emit("pan",t.x,t.y),[2]):[2]}}))}))},t.prototype.emitZoomEvent=function(){var e;return F(this,void 0,void 0,(function(){var t;return A(this,(function(n){switch(n.label){case 0:return[4,null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()];case 1:return void 0===(t=n.sent())||this.emit("zoom",t),[2]}}))}))},t.prototype.getDevicePixelRatio=function(){return(0,d.uZ)(window.devicePixelRatio,1,2)},t.prototype.setCanvasSize=function(e,t){this.canvas.style.width=e+"px",this.canvas.style.height=t+"px",this.canvas.width=e*this.getDevicePixelRatio(),this.canvas.height=t*this.getDevicePixelRatio()},t.prototype.handleDeviceOrientationChange=function(){this.resizeCanvas({width:this.settings.container.clientWidth,height:this.settings.container.clientHeight})},t.prototype.zoomToFit=function(){return F(this,void 0,void 0,(function(){return A(this,(function(e){switch(e.label){case 0:return[4,this.sketchWeb.scaleDocumentToFit()];case 1:return e.sent(),this.emitZoomEvent(),this.emitPanEvent(),[2]}}))}))},t.prototype.getStatus=function(){var e;return F(this,void 0,void 0,(function(){return A(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.getStatus()]}))}))},t.prototype.generateDocumentPNG=function(){var e;return F(this,void 0,void 0,(function(){return A(this,(function(t){return[2,null===(e=this.sketchWeb)||void 0===e?void 0:e.generateDocumentPNG()]}))}))},t.prototype.getDocument=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getDocument()},t.prototype.getArtboardAtPosition=function(e,t){var n;return F(this,void 0,void 0,(function(){return A(this,(function(o){switch(o.label){case 0:return[4,null===(n=this.sketchWeb)||void 0===n?void 0:n.getArtboardAtPosition(e,t)];case 1:return[2,o.sent()||null]}}))}))},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWeb)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.setPan=function(e,t,n){var o;return F(this,void 0,void 0,(function(){return A(this,(function(r){switch(r.label){case 0:return[4,null===(o=this.sketchWeb)||void 0===o?void 0:o.setPan(e,t,Boolean(n))];case 1:return r.sent(),this.emitPanEvent(),[2]}}))}))},t.prototype.setZoom=function(e,t){var n;return F(this,void 0,void 0,(function(){var o;return A(this,(function(r){return o=null!=t?t:this.getCanvasCenterPoint(),null===(n=this.sketchWeb)||void 0===n||n.setZoom(e,o),this.emitZoomEvent(),this.emitPanEvent(),[2]}))}))},t.prototype.getCanvasCenterPoint=function(){var e=this.canvas.getBoundingClientRect();return{x:e.width/2+e.x,y:e.height/2+e.y}},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getZoom()},t.prototype.getPan=function(){var e;return null===(e=this.sketchWeb)||void 0===e?void 0:e.getPan()},t.prototype.dispose=function(){var e,t,n,o;return F(this,void 0,void 0,(function(){return A(this,(function(r){switch(r.label){case 0:return this.gestureManager.dispose(),this.keyboardManager.dispose(),this.listenersCollector.dispose(),null===(e=this.canvasResizeObserver)||void 0===e||e.disconnect(),this.isRunningInsideWorker()?[4,null===(t=this.sketchWeb)||void 0===t?void 0:t.dispose()]:[3,2];case 1:return r.sent(),null===(n=this.worker)||void 0===n||n.terminate(),[3,3];case 2:null===(o=this.sketchWeb)||void 0===o||o.dispose(),r.label=3;case 3:return[2]}}))}))},t}(r.v)},475:(e,t,n)=>{"use strict";n.d(t,{U:()=>p});var o,r=n(419),i=n(519),a=n(354),s=n(108),u=n(849),c=n(758),l=n(332),h=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),d=function(){return(d=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},f=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},v=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},p=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,o=t.locateFile,a=t.filePath,c=t.imagesURLFormat,h=t.imagesURLMap,f=t.backgroundColor,v=void 0===f?{r:1,g:1,b:1,a:1}:f,p=t.size,m=t.pixelRatio,g=t.mode,b=t.showTilesBorders,y=void 0!==b&&b,w=t.minimumZoomLevel,C=t.maximumZoomLevel,k=t.preserveDrawingBuffer,P=void 0!==k&&k,E=t.panBoundariesPadding,x=void 0===E?40:E,M=t.featureFlags,S=void 0===M?{}:M,W=e.call(this)||this;return W.status={type:"INIT"},W.handleWebGLContextLost=function(){W.setStatus({type:"WEBGL_CONTEXT_LOST"})},W.debouncedFullDraw=(0,r.Ds)((function(){return W.draw(!0)}),60),W.canvas=n,W.locateFile=o,W.filePath=a,W.imagesURLFormat=c,W.imagesURLMap=h,W.backgroundColor=v,W.size=p,W.pixelRatio=m,W.mode=g,W.showTilesBorders=y,W.currentWebGLVersion=(0,r.wX)(),W.zoomLevels={min:w,max:C},W.preserveDrawingBuffer=P,W.panBoundariesPadding=x,W.featureFlags=d(d({},i.Z),S),u.Z.active=g===l.p.debug,W.traceFirstPaint=new s.S("FirstPaint"),W}return h(t,e),t.prototype.init=function(){return f(this,void 0,void 0,(function(){var e;return v(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[4,this.preloadImages()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof c.k?e:new c.k("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new s.S("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.draw(!0,!1),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){u.Z.debug("[C++] "+e)},logWarning:function(e){u.Z.warning("[C++] "+e)},logError:function(e){u.Z.error("[C++] "+e)},emitMetric:function(t,n,o,r){e.emit("metric",{id:t,start:n,end:o,duration:r})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(u.Z.warning("Not able to resolve the url for the image with UUID: "+t),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,o=new s.S("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){o.printMeasurement(),e.emit("metric",o.measure()),u.Z.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return f(this,void 0,void 0,(function(){var e,t,o,r,i,a,h,d=this;return v(this,(function(f){switch(f.label){case 0:return e=new s.S("WasmModuleDownload"),this.mode!==l.p.debug?[3,2]:[4,n.e(425).then(n.t.bind(n,425,23))];case 1:return t=f.sent(),[3,4];case 2:return[4,n.e(816).then(n.t.bind(n,816,23))];case 3:t=f.sent(),f.label=4;case 4:o=t.default,f.label=5;case 5:return f.trys.push([5,7,,8]),r=this,[4,o({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return d.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=f.sent(),[3,8];case 7:throw i=f.sent(),new c.k("WASM_ERROR","An error occurred while trying to create the wasm module.",i);case 8:if(e.printMeasurement(),this.emit("metric",e.measure()),a={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},u.Z.debug("Using WebGL "+a.majorVersion),!(h=this.wasmModule.GL.createContext(this.canvas,a)))throw new c.k("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=h;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio,{showTilesBorders:this.showTilesBorders})}catch(e){throw new c.k("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.generateDocumentPNG=function(){return f(this,void 0,void 0,(function(){return v(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.sketchWebWasm.generateDocumentPNG()]}}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit(),this.delayedDraw()},t.prototype.setFile=function(e){return f(this,void 0,void 0,(function(){var t=this;return v(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,o){t.sketchWebWasm.setFile(e,(function(e){if(void 0===e&&(e=[]),e.length){u.Z.debug("Parser warnings: "+e);var o=e.map((function(e){return{key:e}}));t.emit("warnings",o)}t.setStatus({type:"FILE_READY"}),t.emit("fileReady",t.getDocument()),n()}),(function(){return o(new c.k("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.delayedDraw=function(){if(!this.featureFlags.delayedDraw)return this.draw(!0);this.draw(),this.debouncedFullDraw()},t.prototype.draw=function(e,t){var n;void 0===e&&(e=!1),void 0===t&&(t=!1),null===(n=this.sketchWebWasm)||void 0===n||n.setNeedsUpdate(e,t)},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:e.toString()+(e.cause?"\nWrapped Error: "+e.cause.toString():"")}),u.Z.error(e),e.cause&&u.Z.error(e.cause)},t.prototype.setPixelRatio=function(e){this.pixelRatio=e,this.setSize(this.size.width*this.pixelRatio,this.size.height*this.pixelRatio,this.pixelRatio),this.delayedDraw()},t.prototype.setSize=function(e,t,n){var o;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(o=this.sketchWebWasm)||void 0===o||o.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(u.Z.debug("Status transition "+this.status.type+" => "+e.type+"}"),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:d(d({},e),{artboards:(0,r.gi)(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getArtboardAtPosition(e,t)},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,o;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(o=this.sketchWebWasm)||void 0===o||o.setZoom(e),this.delayedDraw()},t.prototype.addZoom=function(e,t){var n,o;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(o=this.sketchWebWasm)||void 0===o||o.addZoom(e),this.delayedDraw()},t.prototype.setPan=function(e,t,n){var o;void 0===n&&(n=!1),null===(o=this.sketchWebWasm)||void 0===o||o.setPan(e,t,n),this.delayedDraw()},t.prototype.addPan=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.addPan(e,t),this.delayedDraw()},t.prototype.getPan=function(){if(this.sketchWebWasm)return this.sketchWebWasm.getPan()},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.setMouse=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.setMouse(e,t)},t.prototype.setIsCameraMoving=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraMoving(e)},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new c.k("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(a.v))},550:(e,t,n)=>{"use strict";n.d(t,{j4:()=>Te,aV:()=>ke,z0:()=>me,oW:()=>oe,jr:()=>O,tm:()=>_,ky:()=>S,zX:()=>Y,ex:()=>G,Jw:()=>B,m_:()=>U,Yy:()=>j,d6:()=>Z,aP:()=>D,EY:()=>N,pt:()=>A,od:()=>L,ph:()=>I,lt:()=>z,$z:()=>M,BO:()=>W,us:()=>F});var o=n(297),r=n.n(o),i=n(332),a=n(849),s=(0,o.createContext)(void 0),u=function(){var e=(0,o.useContext)(s);if(void 0===e)throw Error("useSketchWebInternalContext must be used within a SketchWebProvider");return e},c=n(419),l=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o},h=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return a.Z.debug.apply(a.Z,l(["SketchWebReact"],e))};function d(e){return(0,c.b1)()?{onTouchEnd:e}:{onClick:e}}var f,v,p,m,g,b,y=(0,o.createContext)(void 0),w=(0,o.createContext)(void 0),C=(0,o.createContext)(void 0),k=(0,o.createContext)(void 0),P=(0,o.createContext)(void 0),E=(0,o.createContext)(void 0),x=(0,o.createContext)(void 0),M=function(){var e=(0,o.useContext)(y);if(void 0===e)throw Error("useStatus must be used within a SketchWebProvider");return e},S=function(){var e=(0,o.useContext)(w);if(void 0===e)throw Error("useDocument must be used within a SketchWebProvider");return e},W=function(){var e=(0,o.useContext)(C);if(void 0===e)throw Error("useZoom must be used within a SketchWebProvider");return e},L=function(){var e=(0,o.useContext)(E);if(void 0===e)throw Error("usePan must be used within a SketchWebProvider");return e},O=function(){var e=(0,o.useContext)(x);if(void 0===e)throw Error("useCursor must be used within a SketchWebProvider");return e},D=function(){var e=(0,o.useContext)(k);if(void 0===status)throw Error("useIsCameraZooming must be used within a SketchWebProvider");return e},Z=function(){var e=(0,o.useContext)(P);if(void 0===status)throw Error("useIsCameraMoving must be used within a SketchWebProvider");return e},R=function(e,t,n,o){return new(n||(n=Promise))((function(r,i){function a(e){try{u(o.next(e))}catch(e){i(e)}}function s(e){try{u(o.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((o=o.apply(e,t||[])).next())}))},T=function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}},z=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){h("setZoom",t),console.log(e),null==e||e.setZoom(t)}),[e])},j=function(){var e=z(),t=W();return(0,o.useCallback)((function(){var n;h("incrementZoom"),"number"==typeof t&&(n=t>=1?Math.round(2*t):t>.5?1:2*t,e(n))}),[e,t])},_=function(){var e=z(),t=W();return(0,o.useCallback)((function(){h("decrementZoom"),"number"==typeof t&&e(t/2)}),[e,t])},I=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){var n=t.x,o=t.y,r=t.centerPointInViewport;h("setPan",n,o,"centerPointInViewport",r),null==e||e.setPan(n,o,r)}),[e])},F=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){h("zoomToFit"),null==e||e.zoomToFit()}),[e])},A=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){h("looseWebGLContext"),null==e||e.looseWebGLContext()}),[e])},G=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(){return R(void 0,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return h("generateDocumentPNG"),[4,null==e?void 0:e.generateDocumentPNG()];case 1:return[2,t.sent()]}}))}))}),[e])},B=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return R(void 0,void 0,void 0,(function(){return T(this,(function(o){switch(o.label){case 0:return h("getArtboardAtPosition",t,n),[4,null==e?void 0:e.getArtboardAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},U=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t,n){return R(void 0,void 0,void 0,(function(){return T(this,(function(o){switch(o.label){case 0:return h("getPanAtPosition",t,n),[4,null==e?void 0:e.getPanAtPosition(t,n)];case 1:return[2,o.sent()||null]}}))}))}),[e])},N=function(){var e=(0,u().getManager)();return(0,o.useCallback)((function(t){h("setIsCameraLocked",t),null==e||e.gestureManager.setIsCameraLocked(t)}),[e])},Y=function(e,t){var n=(0,u().getManager)();(0,o.useEffect)((function(){return null==n||n.on(e,t),function(){null==n||n.off(e,t)}}),[e,n,t])},X=n(268),H=n.n(X),V=n(914),q=n.n(V),J=(0,V.createGlobalStyle)(f||(p=["\n *:where(:not(iframe, canvas, img, svg, video):not(svg *, symbol *)) {\n all: unset;\n display: revert;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n"],m=["\n *:where(:not(iframe, canvas, img, svg, video):not(svg *, symbol *)) {\n all: unset;\n display: revert;\n}\n\n*,\n*::before,\n*::after {\n box-sizing: border-box;\n}\n"],Object.defineProperty?Object.defineProperty(p,"raw",{value:m}):p.raw=m,f=p)),K=function(){return(K=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},$=(0,V.createGlobalStyle)(v||(v=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}(["\n ","\n"],["\n ","\n"])),(function(e){return e.injectedStyles})),Q=function(e){var t=e.children,n=e.injectedStyles,i=(0,o.useRef)(null),a=(0,o.useState)(null),s=a[0],u=a[1];return r().createElement("div",{ref:function(e){e&&(i.current=e,e.shadowRoot||u(e.attachShadow({mode:"open",delegatesFocus:!0})))},style:{position:"relative",width:"100%",height:"100%"}},s&&H().createPortal(r().createElement(V.StyleSheetManager,{target:s},r().createElement(r().Fragment,null,r().createElement(J,null),n&&r().createElement($,{injectedStyles:n}),t)),s))},ee=function(){return(ee=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},te={position:"relative",width:"100%",height:"100%",touchAction:"manipulation"},ne={position:"absolute",top:0,left:0},oe=(g=function(e){a.Z.active=e.mode===i.p.debug;var t=e.filePath,n=e.locateFile,s=e.imagesURLFormat,c=e.imagesURLMap,l=e.backgroundColor,h=e.mode,d=e.showTilesBorders,f=e.minimumZoomLevel,v=e.maximumZoomLevel,p=e.preserveDrawingBuffer,m=e.panBoundariesPadding,g=e.initialPan,b=e.initialZoom,y=e.children,w=e.containerProps,C=void 0===w?{}:w,k=e.canvasProps,P=void 0===k?{}:k,E=e.featureFlags,x=void 0===E?{}:E,S=(0,o.useRef)(null),W=(0,o.useRef)(null),L=(0,o.useState)(!1),D=L[0],Z=L[1],R=(0,o.useCallback)((function(){return Z(!0)}),[]),T=u(),z=T.dispose,j=T.init,_=T.setSettings,I=O(),F=M();Y("allImagesReady",R),(0,o.useEffect)((function(){_({locateFile:n,imagesURLFormat:s,imagesURLMap:c,backgroundColor:l,mode:h,showTilesBorders:d,minimumZoomLevel:f,maximumZoomLevel:v,preserveDrawingBuffer:p,panBoundariesPadding:m,initialPan:g,initialZoom:b,featureFlags:x})}),[_,n,s,c,l,h,d,f,v,p,m,g,b,x]),(0,o.useEffect)((function(){if(t)return j(t,S.current,W.current),function(){z()}}),[z,j,t]);var A=(0,o.useMemo)((function(){var t;return null!==(t=e.cursor)&&void 0!==t?t:I}),[e.cursor,I]),G=(0,o.useMemo)((function(){return ee(ee({},te),{cursor:A})}),[A]);return r().createElement("div",ee({},C,{ref:W,style:G}),t&&r().createElement("canvas",ee({},P,{key:t,ref:S,"data-sketchweb-all-images-ready":D,"data-testid":"sketchweb-canvas","data-sketchweb-status":"sketchweb-status-"+((null==F?void 0:F.type.toLowerCase())||"null"),style:ne})),"READY"===(null==F?void 0:F.type)&&y)},function(e){var t=e.injectedStyles,n=e.useShadowRoot,o=function(e,t){var n={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(n[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(o=Object.getOwnPropertySymbols(e);r<o.length;r++)t.indexOf(o[r])<0&&Object.prototype.propertyIsEnumerable.call(e,o[r])&&(n[o[r]]=e[o[r]])}return n}(e,["injectedStyles","useShadowRoot"]);return n?r().createElement(Q,{injectedStyles:t},r().createElement(g,K({},o))):r().createElement(g,K({},o))}),re=n(946);!function(e){e.Draggable="grab",e.Dragging="grabbing",e.Hover="pointer",e.Default="auto"}(b||(b={}));var ie,ae,se,ue,ce,le,he,de,fe=function(){return(fe=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},ve=function(e,t){switch(h('dispatched: "'+t.type+'"',t),t.type){case"on-status":return fe(fe({},e),{status:t.status});case"on-file-ready":return fe(fe({},e),{document:t.document});case"on-zoom":return fe(fe({},e),{zoom:t.zoom});case"on-pan":return fe(fe({},e),{pan:t.pan});case"dispose":return fe(fe({},e),{status:null,zoom:null,pan:null,cursor:b.Default});case"post-init":return fe(fe({},e),{status:t.status,zoom:t.zoom});case"on-camera-zoom-start":return fe(fe({},e),{isCameraZooming:!0});case"on-camera-zoom-end":return fe(fe({},e),{isCameraZooming:!1});case"on-camera-move-start":return fe(fe({},e),{cursor:e.isMouseDown?b.Dragging:b.Draggable,isCameraMoving:!0});case"on-camera-move-end":return fe(fe({},e),{isCameraMoving:!1});case"on-mouse-down":return fe(fe({},e),{cursor:b.Dragging,isMouseDown:!0});case"on-mouse-up":return fe(fe({},e),{cursor:b.Draggable,isMouseDown:!1});default:return e}},pe=function(){return(pe=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},me=function(e){var t=e.children,n=(0,o.useRef)(null),i=(0,o.useRef)(null),a=(0,o.useReducer)(ve,{pan:null,zoom:null,status:null,document:null,isCameraZooming:!1,isCameraMoving:!1,cursor:b.Default,isMouseDown:!1}),u=a[0],c=u.status,l=u.document,d=u.zoom,f=u.pan,v=u.isCameraZooming,p=u.isCameraMoving,m=u.cursor,g=a[1],M=(0,o.useCallback)((function(e){return g({type:"on-zoom",zoom:e})}),[]),S=(0,o.useCallback)((function(e,t){return g({type:"on-pan",pan:{x:e,y:t}})}),[]),W=(0,o.useCallback)((function(e){g({type:"on-status",status:e})}),[]),L=(0,o.useCallback)((function(e){g({type:"on-file-ready",document:e})}),[]),O=(0,o.useCallback)((function(){return g({type:"on-mouse-down"})}),[]),D=(0,o.useCallback)((function(){return g({type:"on-mouse-up"})}),[]),Z=(0,o.useCallback)((function(){return g({type:"on-camera-zoom-start"})}),[]),R=(0,o.useCallback)((function(){return g({type:"on-camera-zoom-end"})}),[]),T=(0,o.useCallback)((function(){return g({type:"on-camera-move-start"})}),[]),z=(0,o.useCallback)((function(){return g({type:"on-camera-move-end"})}),[]),j=(0,o.useCallback)((function(){var e=n.current;e&&(h("dispose"),e.off("status",W),e.off("fileReady",L),e.off("zoom",M),e.off("pan",S),e.gestureManager.off("mousedown",O),e.gestureManager.off("mouseup",D),e.gestureManager.off("zoomStart",Z),e.gestureManager.off("zoomEnd",R),e.gestureManager.off("cameraMoveStart",T),e.gestureManager.off("cameraMoveEnd",z),e.dispose(),n.current=null,g({type:"dispose"}))}),[W,L,S,M,D,O,Z,R,T,z]),_=(0,o.useCallback)((function(e,t,o){if(""!==e&&t&&o&&i.current){h("init");var r=new re.d(pe(pe({},i.current),{filePath:e,container:o,canvas:t}));r.on("status",W),r.on("fileReady",L),r.on("zoom",M),r.on("pan",S),r.gestureManager.on("mousedown",O),r.gestureManager.on("mouseup",D),r.gestureManager.on("zoomStart",Z),r.gestureManager.on("zoomEnd",R),r.gestureManager.on("cameraMoveStart",T),r.gestureManager.on("cameraMoveEnd",z),a=void 0,s=void 0,c=function(){var e,t;return function(e,t){var n,o,r,i,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return i={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function s(i){return function(s){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,o&&(r=2&i[0]?o.return:i[0]?o.throw||((r=o.return)&&r.call(o),0):o.next)&&!(r=r.call(o,i[1])).done)return r;switch(o=0,r&&(i=[2&i[0],r.value]),i[0]){case 0:case 1:r=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,o=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(!((r=(r=a.trys).length>0&&r[r.length-1])||6!==i[0]&&2!==i[0])){a=0;continue}if(3===i[0]&&(!r||i[1]>r[0]&&i[1]<r[3])){a.label=i[1];break}if(6===i[0]&&a.label<r[1]){a.label=r[1],r=i;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(i);break}r[2]&&a.ops.pop(),a.trys.pop();continue}i=t.call(e,a)}catch(e){i=[6,e],o=0}finally{n=r=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,s])}}}(this,(function(n){switch(n.label){case 0:return e=g,t={type:"post-init"},[4,r.getZoom()];case 1:return t.zoom=n.sent()||null,[4,r.getStatus()];case 2:return t.status=n.sent()||null,[4,r.getPan()];case 3:return e.apply(void 0,[(t.pan=n.sent()||null,t)]),[2]}}))},new((u=void 0)||(u=Promise))((function(e,t){function n(e){try{r(c.next(e))}catch(e){t(e)}}function o(e){try{r(c.throw(e))}catch(e){t(e)}}function r(t){var r;t.done?e(t.value):(r=t.value,r instanceof u?r:new u((function(e){e(r)}))).then(n,o)}r((c=c.apply(a,s||[])).next())})),n.current=r}var a,s,u,c}),[W,L,M,S,O,D,Z,R,T,z]),I=(0,o.useCallback)((function(e){h("setSettings",e),i.current=e}),[]),F=(0,o.useCallback)((function(){return n.current}),[]),A=(0,o.useMemo)((function(){return{dispose:j,init:_,setSettings:I,getManager:F,dispatch:g}}),[j,_,I,F]);return r().createElement(s.Provider,{value:A},r().createElement(y.Provider,{value:c},r().createElement(w.Provider,{value:l},r().createElement(C.Provider,{value:d},r().createElement(E.Provider,{value:f},r().createElement(k.Provider,{value:v},r().createElement(P.Provider,{value:p},r().createElement(x.Provider,{value:m},t))))))))},ge=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},be=q().div(ie||(ie=ge(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n"]))),ye=q().div(ae||(ae=ge(["\n position: absolute;\n top: 0;\n left: 0;\n transform-origin: top left;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n transform-origin: top left;\n"]))),we=function(e){var t=e.document,n=e.children,o=L()||{x:0,y:0},i=W()||1,a=Z(),s=D();return r().createElement(ye,{style:{willChange:a?"transform, width, height":"",pointerEvents:a?"none":"auto",width:t.bounds.width*i+"px",height:t.bounds.height*i+"px",transform:"translate3d("+o.x*i+"px, "+o.y*i+"px, 0)",display:s?"none":"block"}},n)},Ce=function(){return(Ce=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},ke=function(e){var t=e.children,n=e.onClick,o=S();return o?r().createElement(be,Ce({},d(n)),r().createElement(we,{document:o},t)):null},Pe=function(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e},Ee=q().div(se||(se=Pe(["\n position: absolute;\n box-sizing: border-box;\n cursor: pointer;\n\n // Just some default font styles\n font-size: 12px;\n font-style: normal;\n font-family: sans-serif;\n\n font: ",";\n\n ","\n"],["\n position: absolute;\n box-sizing: border-box;\n cursor: pointer;\n\n // Just some default font styles\n font-size: 12px;\n font-style: normal;\n font-family: sans-serif;\n\n font: ",";\n\n ","\n"])),(function(e){return e.font}),(function(e){return e.selected?"box-shadow: 0 0 0 4px "+e.outlineColor+";":"\n &:hover {\n box-shadow: 0 0 0 2px "+e.outlineColor+";\n }\n "})),xe=q().div(ue||(ue=Pe(["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: auto;\n padding: 0 0 6px 0;\n transform: translateY(-100%);\n display: flex;\n pointer-events: none;\n visibility: ",";\n align-items: center;\n"],["\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: auto;\n padding: 0 0 6px 0;\n transform: translateY(-100%);\n display: flex;\n pointer-events: none;\n visibility: ",";\n align-items: center;\n"])),(function(e){return e.visible?"visible":"hidden"})),Me=q().span(ce||(ce=Pe(["\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n pointer-events: auto;\n color: ",";\n"],["\n position: relative;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n user-select: none;\n pointer-events: auto;\n color: ",";\n"])),(function(e){return e.textColor})),Se=q().button(le||(le=Pe(["\n position: relative;\n white-space: nowrap;\n margin-right: 0;\n margin-left: auto;\n align-items: center;\n pointer-events: auto;\n display: ",";\n font: inherit;\n"],["\n position: relative;\n white-space: nowrap;\n margin-right: 0;\n margin-left: auto;\n align-items: center;\n pointer-events: auto;\n display: ",";\n font: inherit;\n"])),(function(e){return e.visible?"flex":"none"})),We=q().span(he||(he=Pe(["\n color: ",";\n display: ",";\n font: inherit;\n"],["\n color: ",";\n display: ",";\n font: inherit;\n"])),(function(e){return e.textColor}),(function(e){return e.visible?"initial":"none"})),Le=q().span(de||(de=Pe(["\n position: relative;\n width: 14px;\n height: 14px;\n margin-left: 4px;\n"],["\n position: relative;\n width: 14px;\n height: 14px;\n margin-left: 4px;\n"])));function Oe(){return r().createElement(Le,null,r().createElement("svg",{viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},r().createElement("g",{fill:"none",fillRule:"evenodd"},r().createElement("path",{d:"M6.755 0h.49c1.55 0 2.708.278 3.686.801a5.452 5.452 0 0 1 2.268 2.268c.523.978.801 2.136.801 3.686v.49c0 1.55-.278 2.708-.801 3.686a5.452 5.452 0 0 1-2.268 2.268c-.978.523-2.136.801-3.686.801h-.49c-1.55 0-2.708-.278-3.686-.801A5.452 5.452 0 0 1 .801 10.93C.278 9.953 0 8.795 0 7.245v-.49c0-1.55.278-2.708.801-3.686A5.452 5.452 0 0 1 3.07.801C4.047.278 5.205 0 6.755 0Z",fillOpacity:".083",fill:"#000",fillRule:"nonzero"}),r().createElement("path",{strokeOpacity:".55",stroke:"#000",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 9.5 10 7 7.5 4.5M8.5 7H4"}))))}var De=function(){return(De=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},Ze=r().forwardRef((function(e,t){var n,i=e.document,a=e.artboard,s=e.selected,u=e.onClick,c=e.onDoubleClick,l=e.onCTAClick,h=e.font,f=e.outlineColor,v=e.nameTextColor,p=e.ctaTextColor,m=e.ctaText,g=null!==(n=W())&&void 0!==n?n:1,b=a.bounds.width*g,y=b>100,w=b>160,C=(0,o.useMemo)((function(){var e=a.bounds,t=i.bounds;return{x:(e.x-t.x)/t.width*100,y:(e.y-t.y)/t.height*100,width:e.width/t.width*100,height:e.height/t.height*100}}),[a.bounds,i.bounds]),k=C.x,P=C.y,E=C.width,x=C.height;return r().createElement(Ee,De({ref:t,selected:s,font:h,outlineColor:f},d((function(e){null==u||u(a,e)})),{onDoubleClick:function(e){null==c||c(a,e)},style:{left:k+"%",top:P+"%",width:E+"%",height:x+"%"}}),r().createElement(xe,{visible:y},r().createElement(Me,{textColor:v},a.name),r().createElement(Se,De({visible:s},d((function(e){null==l||l(a,e)}))),r().createElement(We,{textColor:p,visible:w},m),r().createElement(Oe,null))))}));Ze.displayName="Artboard";var Re=function(){return(Re=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},Te=function(e){var t=e.artboardStyle,n=e.onGoToArtboard,i=S(),a=(0,o.useState)(null),s=a[0],u=a[1],c=(0,o.useRef)({});function l(e,t){u(e.objectId)}function h(e){null==n||n(e.objectId,"doubleClick")}function d(e){null==n||n(e.objectId,"CTA")}return(0,o.useEffect)((function(){function e(e){"Enter"===e.key&&s&&(null==n||n(s,"keyPressEnter"))}return window.document.body.addEventListener("keypress",e),function(){window.document.body.removeEventListener("keypress",e)}}),[n,s]),i?r().createElement(ke,{onClick:function(e){var t;for(var n in c.current)if(null===(t=c.current[n])||void 0===t?void 0:t.contains(e.target))return;u(null)}},i.artboards.map((function(e){return r().createElement(Ze,Re({ref:function(t){return c.current[e.objectId]=t},key:e.objectId,selected:s===e.objectId,onClick:l,onDoubleClick:h,onCTAClick:d,artboard:e,document:i},t))}))):null}},758:(e,t,n)=>{"use strict";n.d(t,{k:()=>i});var o,r=(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=function(e){function t(n,o,r){var i=this.constructor,a=e.call(this,"("+n+") "+o)||this;return a.code=n,a.cause=r,a.name=t.name,Object.setPrototypeOf(a,i.prototype),a}return r(t,e),t}(Error)},18:()=>{},689:()=>{},332:(e,t,n)=>{"use strict";var o;n.d(t,{p:()=>o}),function(e){e.debug="debug",e.release="release"}(o||(o={}))},119:()=>{},650:()=>{},312:()=>{},552:(e,t,n)=>{"use strict";n.d(t,{v:()=>o});var o=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,o;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(o=this.listeners[e])||void 0===o||o.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var o=this.listeners[e];(null==o?void 0:o.size)&&o.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e}()},354:(e,t,n)=>{"use strict";n.d(t,{v:()=>o.v});var o=n(552)},849:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});var o=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),r=0;for(t=0;t<n;t++)for(var i=arguments[t],a=0,s=i.length;a<s;a++,r++)o[r]=i[a];return o};const r=new(function(){function e(){this.active=!0}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.debug.apply(console,o(["[SketchWeb] [Debug]"],e))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,o(["[SketchWeb] [Warn]"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,o(["[SketchWeb] [Error]"],e))},e}())},108:(e,t,n)=>{"use strict";n.d(t,{S:()=>r});var o=n(849),r=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),o.Z.debug("[Performance] Start: "+this.label)}return e.prototype.measure=function(){var e=performance.now()-this.startTime;return{duration:e,end:this.startTimestamp+e,start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);o.Z.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}()},419:(e,t,n)=>{"use strict";n.d(t,{uZ:()=>o.uZ,gi:()=>o.gi,Ds:()=>o.Ds,wX:()=>o.wX,b1:()=>o.b1});var o=n(388)},388:(e,t,n)=>{"use strict";n.d(t,{Ds:()=>i,MP:()=>a,uZ:()=>s,wX:()=>u,gi:()=>c,b1:()=>l,z6:()=>h});var o=n(519),r=n(66);function i(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 a(e){var t,n,o,r,i,a,s,u;return{x:null!==(r=null!==(t=e.pageX)&&void 0!==t?t:null===(o=null===(n=e.touches)||void 0===n?void 0:n[0])||void 0===o?void 0:o.pageX)&&void 0!==r?r:e.clientX,y:null!==(u=null!==(i=e.pageY)&&void 0!==i?i:null===(s=null===(a=e.touches)||void 0===a?void 0:a[0])||void 0===s?void 0:s.pageY)&&void 0!==u?u:e.clientY}}function s(e,t,n){return Math.max(t,Math.min(n,e))}function u(){return(0,r.t)()&&!o.Z.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1}function c(e){for(var t=e.size(),n=[],o=0;o<t;++o){var r=e.get(o);n.push(r)}return n}function l(){return"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function h(e){return"undefined"!=typeof TouchEvent&&e instanceof TouchEvent||void 0!==e.touches||void 0!==e.targetTouches||void 0!==e.changedTouches}},66:(e,t,n)=>{"use strict";n.d(t,{t:()=>r});var o=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/,r=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(o);if(!t)return null;var n=t[1];return"Macintosh"!==n&&"iPad"!==n&&"iPhone"!==n?null:{hardware:n,version:{major:parseInt(t[4])||0,minor:parseInt(t[5])||0,patch:parseInt(t[6])||0}}}},297:t=>{"use strict";t.exports=e},268:e=>{"use strict";e.exports=t},914:e=>{"use strict";e.exports=n}},u={};function c(e){var t=u[e];if(void 0!==t)return t.exports;var n=u[e]={exports:{}};return s[e](n,n.exports,c),n.exports}c.m=s,c.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return c.d(t,{a:t}),t},r=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,c.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var n=Object.create(null);c.r(n);var i={};o=o||[null,r({}),r([]),r(r)];for(var a=2&t&&e;"object"==typeof a&&!~o.indexOf(a);a=r(a))Object.getOwnPropertyNames(a).forEach((t=>i[t]=()=>e[t]));return i.default=()=>e,c.d(n,i),n},c.d=(e,t)=>{for(var n in t)c.o(t,n)&&!c.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},c.f={},c.e=e=>Promise.all(Object.keys(c.f).reduce(((t,n)=>(c.f[n](e,t),t)),[])),c.u=e=>"static/js/web-renderer-"+{285:"c958f2d136a8510882fe",425:"148f39e38ee433dd320b",816:"076a12afe5f111b57e6c"}[e]+".chunk.js",c.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i={},a="@sketch-hq/sketch-web-renderer:",c.l=(e,t,n,o)=>{if(i[e])i[e].push(t);else{var r,s;if(void 0!==n)for(var u=document.getElementsByTagName("script"),l=0;l<u.length;l++){var h=u[l];if(h.getAttribute("src")==e||h.getAttribute("data-webpack")==a+n){r=h;break}}r||(s=!0,(r=document.createElement("script")).charset="utf-8",r.timeout=120,c.nc&&r.setAttribute("nonce",c.nc),r.setAttribute("data-webpack",a+n),r.src=e),i[e]=[t];var d=(t,n)=>{r.onerror=r.onload=null,clearTimeout(f);var o=i[e];if(delete i[e],r.parentNode&&r.parentNode.removeChild(r),o&&o.forEach((e=>e(n))),t)return t(n)},f=setTimeout(d.bind(null,void 0,{type:"timeout",target:r}),12e4);r.onerror=d.bind(null,r.onerror),r.onload=d.bind(null,r.onload),s&&document.head.appendChild(r)}},c.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},c.p="/",(()=>{c.b=document.baseURI||self.location.href;var e={826:0};c.f.j=(t,n)=>{var o=c.o(e,t)?e[t]:void 0;if(0!==o)if(o)n.push(o[2]);else{var r=new Promise(((n,r)=>o=e[t]=[n,r]));n.push(o[2]=r);var i=c.p+c.u(t),a=new Error;c.l(i,(n=>{if(c.o(e,t)&&(0!==(o=e[t])&&(e[t]=void 0),o)){var r=n&&("load"===n.type?"missing":n.type),i=n&&n.target&&n.target.src;a.message="Loading chunk "+t+" failed.\n("+r+": "+i+")",a.name="ChunkLoadError",a.type=r,a.request=i,o[1](a)}}),"chunk-"+t,t)}};var t=(t,n)=>{var o,r,[i,a,s]=n,u=0;if(i.some((t=>0!==e[t]))){for(o in a)c.o(a,o)&&(c.m[o]=a[o]);s&&s(c)}for(t&&t(n);u<i.length;u++)r=i[u],c.o(e,r)&&e[r]&&e[r][0](),e[i[u]]=0},n=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var l={};return(()=>{"use strict";c.r(l),c.d(l,{default:()=>v,DefaultFeatureFlags:()=>p,SketchWeb:()=>n.U,SketchWebMode:()=>a.p,SketchWebError:()=>u.k,ArtboardsInfoOverlay:()=>f.j4,Overlay:()=>f.aV,SketchWebProvider:()=>f.z0,SketchWebReact:()=>f.oW,useCursor:()=>f.jr,useDecrementZoom:()=>f.tm,useDocument:()=>f.ky,useEvent:()=>f.zX,useGenerateDocumentPNG:()=>f.ex,useGetArtboardAtPosititon:()=>f.Jw,useGetPanAtPosition:()=>f.m_,useIncrementZoom:()=>f.Yy,useIsCameraMoving:()=>f.d6,useIsCameraZooming:()=>f.aP,useLockCamera:()=>f.EY,useLooseWebGLContext:()=>f.pt,usePan:()=>f.od,useSetPan:()=>f.ph,useSetZoom:()=>f.lt,useStatus:()=>f.$z,useZoom:()=>f.BO,useZoomToFit:()=>f.us});var e=c(946),t=c(519),n=c(475),o=c(18),r={};for(const e in o)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>o[e]);c.d(l,r);var i=c(119);r={};for(const e in i)["default","DefaultFeatureFlags","SketchWeb"].indexOf(e)<0&&(r[e]=()=>i[e]);c.d(l,r);var a=c(332),s=c(312);r={};for(const e in s)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode"].indexOf(e)<0&&(r[e]=()=>s[e]);c.d(l,r);var u=c(758),h=c(689);r={};for(const e in h)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>h[e]);c.d(l,r);var d=c(650);r={};for(const e in d)["default","DefaultFeatureFlags","SketchWeb","SketchWebMode","SketchWebError"].indexOf(e)<0&&(r[e]=()=>d[e]);c.d(l,r);var f=c(550);const v=e.d;var p=t.Z})(),l})()}));
Binary file
Binary file
@@ -0,0 +1 @@
1
+ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(){return(()=>{"use strict";var e,t,n={},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,o),i.exports}o.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&r&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>n[e]));return s.default=()=>n,o.d(i,s),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>"static/js/web-renderer-"+{425:"148f39e38ee433dd320b",816:"076a12afe5f111b57e6c"}[e]+".chunk.js",o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.p="/",(()=>{var e={285:1};o.f.i=(t,n)=>{e[t]||importScripts(o.p+o.u(t))};var t=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[],n=t.push.bind(t);t.push=t=>{var[r,i,s]=t;for(var a in i)o.o(i,a)&&(o.m[a]=i[a]);for(s&&s(o);r.length;)e[r.pop()]=1;n(t)}})();const i={delayedDraw:!0,useNewTiledRenderer:!0,offscreenCanvas:!1,safariWebGL2:!1,pageBoundariesLimit:!1};var s=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/;function a(e){for(var t=e.size(),n=[],r=0;r<t;++r){var o=e.get(r);n.push(o)}return n}var c=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,r;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(r=this.listeners[e])||void 0===r||r.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this.listeners[e];(null==r?void 0:r.size)&&r.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e}(),u=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};const l=new(function(){function e(){this.active=!0}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.debug.apply(console,u(["[SketchWeb] [Debug]"],e))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,u(["[SketchWeb] [Warn]"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,u(["[SketchWeb] [Error]"],e))},e}());var h,d,p=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),l.debug("[Performance] Start: "+this.label)}return e.prototype.measure=function(){var e=performance.now()-this.startTime;return{duration:e,end:this.startTimestamp+e,start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);l.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);l.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}(),f=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),m=function(e){function t(n,r,o){var i=this.constructor,s=e.call(this,"("+n+") "+r)||this;return s.code=n,s.cause=o,s.name=t.name,Object.setPrototypeOf(s,i.prototype),s}return f(t,e),t}(Error);!function(e){e.debug="debug",e.release="release"}(d||(d={}));var b=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),v=function(){return(v=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},g=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},y=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},w=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,r=t.locateFile,o=t.filePath,a=t.imagesURLFormat,c=t.imagesURLMap,u=t.backgroundColor,h=void 0===u?{r:1,g:1,b:1,a:1}:u,f=t.size,m=t.pixelRatio,b=t.mode,g=t.showTilesBorders,y=void 0!==g&&g,w=t.minimumZoomLevel,W=t.maximumZoomLevel,k=t.preserveDrawingBuffer,P=void 0!==k&&k,L=t.panBoundariesPadding,R=void 0===L?40:L,E=t.featureFlags,x=void 0===E?{}:E,S=e.call(this)||this;return S.status={type:"INIT"},S.handleWebGLContextLost=function(){S.setStatus({type:"WEBGL_CONTEXT_LOST"})},S.debouncedFullDraw=function(e,t){var n;function r(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,t)}),60)}return r.cancel=function(){n&&clearTimeout(n)},r}((function(){return S.draw(!0)})),S.canvas=n,S.locateFile=r,S.filePath=o,S.imagesURLFormat=a,S.imagesURLMap=c,S.backgroundColor=h,S.size=f,S.pixelRatio=m,S.mode=b,S.showTilesBorders=y,S.currentWebGLVersion=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(s);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}}}()&&!i.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1,S.zoomLevels={min:w,max:W},S.preserveDrawingBuffer=P,S.panBoundariesPadding=R,S.featureFlags=v(v({},i),x),l.active=b===d.debug,S.traceFirstPaint=new p("FirstPaint"),S}return b(t,e),t.prototype.init=function(){return g(this,void 0,void 0,(function(){var e;return y(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[4,this.preloadImages()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof m?e:new m("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new p("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.draw(!0,!1),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){l.debug("[C++] "+e)},logWarning:function(e){l.warning("[C++] "+e)},logError:function(e){l.error("[C++] "+e)},emitMetric:function(t,n,r,o){e.emit("metric",{id:t,start:n,end:r,duration:o})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(l.warning("Not able to resolve the url for the image with UUID: "+t),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,r=new p("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){r.printMeasurement(),e.emit("metric",r.measure()),l.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return g(this,void 0,void 0,(function(){var e,t,n,r,i,s,a,c=this;return y(this,(function(u){switch(u.label){case 0:return e=new p("WasmModuleDownload"),this.mode!==d.debug?[3,2]:[4,o.e(425).then(o.t.bind(o,425,23))];case 1:return t=u.sent(),[3,4];case 2:return[4,o.e(816).then(o.t.bind(o,816,23))];case 3:t=u.sent(),u.label=4;case 4:n=t.default,u.label=5;case 5:return u.trys.push([5,7,,8]),r=this,[4,n({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return c.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=u.sent(),[3,8];case 7:throw i=u.sent(),new m("WASM_ERROR","An error occurred while trying to create the wasm module.",i);case 8:if(e.printMeasurement(),this.emit("metric",e.measure()),s={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},l.debug("Using WebGL "+s.majorVersion),!(a=this.wasmModule.GL.createContext(this.canvas,s)))throw new m("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=a;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio,{showTilesBorders:this.showTilesBorders})}catch(e){throw new m("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.generateDocumentPNG=function(){return g(this,void 0,void 0,(function(){return y(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.sketchWebWasm.generateDocumentPNG()]}}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit(),this.delayedDraw()},t.prototype.setFile=function(e){return g(this,void 0,void 0,(function(){var t=this;return y(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,r){t.sketchWebWasm.setFile(e,(function(e){if(void 0===e&&(e=[]),e.length){l.debug("Parser warnings: "+e);var r=e.map((function(e){return{key:e}}));t.emit("warnings",r)}t.setStatus({type:"FILE_READY"}),t.emit("fileReady",t.getDocument()),n()}),(function(){return r(new m("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.delayedDraw=function(){if(!this.featureFlags.delayedDraw)return this.draw(!0);this.draw(),this.debouncedFullDraw()},t.prototype.draw=function(e,t){var n;void 0===e&&(e=!1),void 0===t&&(t=!1),null===(n=this.sketchWebWasm)||void 0===n||n.setNeedsUpdate(e,t)},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:e.toString()+(e.cause?"\nWrapped Error: "+e.cause.toString():"")}),l.error(e),e.cause&&l.error(e.cause)},t.prototype.setPixelRatio=function(e){this.pixelRatio=e,this.setSize(this.size.width*this.pixelRatio,this.size.height*this.pixelRatio,this.pixelRatio),this.delayedDraw()},t.prototype.setSize=function(e,t,n){var r;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(r=this.sketchWebWasm)||void 0===r||r.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(l.debug("Status transition "+this.status.type+" => "+e.type+"}"),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:v(v({},e),{artboards:a(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getArtboardAtPosition(e,t)},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,r;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(r=this.sketchWebWasm)||void 0===r||r.setZoom(e),this.delayedDraw()},t.prototype.addZoom=function(e,t){var n,r;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(r=this.sketchWebWasm)||void 0===r||r.addZoom(e),this.delayedDraw()},t.prototype.setPan=function(e,t,n){var r;void 0===n&&(n=!1),null===(r=this.sketchWebWasm)||void 0===r||r.setPan(e,t,n),this.delayedDraw()},t.prototype.addPan=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.addPan(e,t),this.delayedDraw()},t.prototype.getPan=function(){if(this.sketchWebWasm)return this.sketchWebWasm.getPan()},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.setMouse=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.setMouse(e,t)},t.prototype.setIsCameraMoving=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraMoving(e)},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new m("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(c));const W=Symbol("Comlink.proxy"),k=Symbol("Comlink.endpoint"),P=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),R=e=>"object"==typeof e&&null!==e||"function"==typeof e,E=new Map([["proxy",{canHandle:e=>R(e)&&e[W],serialize(e){const{port1:t,port2:n}=new MessageChannel;return x(e,t),[n,[n]]},deserialize:e=>(e.start(),O(e,[],undefined))}],["throw",{canHandle:e=>R(e)&&L in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function x(e,t=self){t.addEventListener("message",(function n(r){if(!r||!r.data)return;const{id:o,type:i,path:s}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(M);let c;try{const t=s.slice(0,-1).reduce(((e,t)=>e[t]),e),n=s.reduce(((e,t)=>e[t]),e);switch(i){case"GET":c=n;break;case"SET":t[s.slice(-1)[0]]=M(r.data.value),c=!0;break;case"APPLY":c=n.apply(t,a);break;case"CONSTRUCT":c=function(e){return Object.assign(e,{[W]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;x(e,n),c=function(e,t){return D.set(e,t),e}(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[L]:0}}Promise.resolve(c).catch((e=>({value:e,[L]:0}))).then((e=>{const[r,s]=I(e);t.postMessage(Object.assign(Object.assign({},r),{id:o}),s),"RELEASE"===i&&(t.removeEventListener("message",n),S(t))}))})),t.start&&t.start()}function S(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function _(e){if(e)throw new Error("Proxy has been released and is not useable")}function O(e,t=[],n=function(){}){let r=!1;const o=new Proxy(n,{get(n,i){if(_(r),i===P)return()=>F(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{S(e),r=!0}));if("then"===i){if(0===t.length)return{then:()=>o};const n=F(e,{type:"GET",path:t.map((e=>e.toString()))}).then(M);return n.then.bind(n)}return O(e,[...t,i])},set(n,o,i){_(r);const[s,a]=I(i);return F(e,{type:"SET",path:[...t,o].map((e=>e.toString())),value:s},a).then(M)},apply(n,o,i){_(r);const s=t[t.length-1];if(s===k)return F(e,{type:"ENDPOINT"}).then(M);if("bind"===s)return O(e,t.slice(0,-1));const[a,c]=C(i);return F(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(M)},construct(n,o){_(r);const[i,s]=C(o);return F(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},s).then(M)}});return o}function C(e){const t=e.map(I);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const D=new WeakMap;function I(e){for(const[t,n]of E)if(n.canHandle(e)){const[r,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},o]}return[{type:"RAW",value:e},D.get(e)||[]]}function M(e){switch(e.type){case"HANDLER":return E.get(e.name).deserialize(e.value);case"RAW":return e.value}}function F(e,t,n){return new Promise((r=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===o&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)}))}return x(w),{}})()}));
@@ -17,7 +17,6 @@ export interface SketchWebSettings {
17
17
  imagesURLFormat?: string;
18
18
  imagesURLMap?: Record<string, string>;
19
19
  backgroundColor?: ColorRGBA;
20
- highlightColor?: ColorRGBA;
21
20
  size: {
22
21
  width: number;
23
22
  height: number;
@@ -38,7 +37,6 @@ export declare class SketchWeb extends EventEmitter<SketchWebEvents> {
38
37
  private imagesURLFormat?;
39
38
  private imagesURLMap?;
40
39
  private backgroundColor;
41
- private highlightColor;
42
40
  private size;
43
41
  private pixelRatio;
44
42
  private mode;
@@ -69,7 +67,7 @@ export declare class SketchWeb extends EventEmitter<SketchWebEvents> {
69
67
  * @param imagesURLFormat URL format used to resolve images, example: https://somewhere.com/:imageId
70
68
  * @param backgroundColor Color in RGBA format, normalized form 0 to 1
71
69
  */
72
- constructor({ canvas, locateFile, filePath, imagesURLFormat, imagesURLMap, backgroundColor, highlightColor, size, pixelRatio, mode, showTilesBorders, minimumZoomLevel, maximumZoomLevel, preserveDrawingBuffer, panBoundariesPadding, featureFlags, }: SketchWebSettings);
70
+ constructor({ canvas, locateFile, filePath, imagesURLFormat, imagesURLMap, backgroundColor, size, pixelRatio, mode, showTilesBorders, minimumZoomLevel, maximumZoomLevel, preserveDrawingBuffer, panBoundariesPadding, featureFlags, }: SketchWebSettings);
73
71
  init(): Promise<void>;
74
72
  preloadImages(): Promise<unknown>;
75
73
  startRendering(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"SketchWeb.d.ts","sourceRoot":"","sources":["../../src/ts/SketchWeb.ts"],"names":[],"mappings":"AAKA,OAAO,YAAY,MAAM,iBAAiB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAInD,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAEL,iBAAiB,EAIlB,MAAM,cAAc,CAAA;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E/D,OAAO,CAAC,IAAI;IAIZ,OAAO,CAAC,IAAI;IAYL,aAAa,CAAC,KAAK,EAAE,MAAM;IAY3B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;IAQhE,OAAO,CAAC,SAAS;IAUjB;;;OAGG;IACI,WAAW;IAuBlB;;;;OAIG;IACI,qBAAqB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAIjD;;;;OAIG;IACI,gBAAgB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAIrC,SAAS,IAAI,eAAe;IAI5B,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAMvD,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE;IAMvD,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,qBAAqB,GAAE,OAAe;IAKnE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAKrC,MAAM;IAMN,OAAO;IAIP,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAI7B,iBAAiB,CAAC,cAAc,EAAE,OAAO;IAIzC,OAAO;CAiBf"}
@@ -5,7 +5,7 @@ export declare type SketchWebProps = Omit<ManagerSettings, 'filePath' | 'contain
5
5
  containerProps?: React.HTMLAttributes<HTMLDivElement>;
6
6
  canvasProps?: React.HTMLAttributes<HTMLCanvasElement>;
7
7
  };
8
- export declare const SketchWebReact: React.FC<Pick<ManagerSettings, "featureFlags" | "locateFile" | "imagesURLFormat" | "imagesURLMap" | "backgroundColor" | "highlightColor" | "mode" | "showTilesBorders" | "minimumZoomLevel" | "maximumZoomLevel" | "preserveDrawingBuffer" | "panBoundariesPadding" | "initialZoom" | "initialPan"> & Partial<Pick<ManagerSettings, "filePath">> & {
8
+ export declare const SketchWebReact: React.FC<Pick<ManagerSettings, "featureFlags" | "locateFile" | "imagesURLFormat" | "imagesURLMap" | "backgroundColor" | "mode" | "showTilesBorders" | "minimumZoomLevel" | "maximumZoomLevel" | "preserveDrawingBuffer" | "panBoundariesPadding" | "initialZoom" | "initialPan"> & Partial<Pick<ManagerSettings, "filePath">> & {
9
9
  cursor?: string | undefined;
10
10
  containerProps?: React.HTMLAttributes<HTMLDivElement> | undefined;
11
11
  canvasProps?: React.HTMLAttributes<HTMLCanvasElement> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"SketchWebReact.d.ts","sourceRoot":"","sources":["../../../src/ts/react/SketchWebReact.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAO5C,oBAAY,cAAc,GAAG,IAAI,CAC/B,eAAe,EACf,UAAU,GAAG,WAAW,GAAG,QAAQ,CACpC,GACC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC,GAAG;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;IACrD,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;CACtD,CAAA;AA2JH,eAAO,MAAM,cAAc;;;;wFAAsC,CAAA"}
1
+ {"version":3,"file":"SketchWebReact.d.ts","sourceRoot":"","sources":["../../../src/ts/react/SketchWebReact.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAA;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA;AAO5C,oBAAY,cAAc,GAAG,IAAI,CAC/B,eAAe,EACf,UAAU,GAAG,WAAW,GAAG,QAAQ,CACpC,GACC,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,CAAC,CAAC,GAAG;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,CAAA;IACrD,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,CAAA;CACtD,CAAA;AAwJH,eAAO,MAAM,cAAc;;;;wFAAsC,CAAA"}
@@ -25,7 +25,7 @@ export declare type SketchWebWasmWrapper = {
25
25
  SketchWeb: SketchWebWasm;
26
26
  GL: EmscriptenGL;
27
27
  };
28
- export interface RendererConfiguration {
28
+ export interface RendererSettings {
29
29
  showTilesBorders?: boolean;
30
30
  }
31
31
  interface Rect {
@@ -76,7 +76,6 @@ export interface SketchWebWasmInstance {
76
76
  getPanAtPosition: (x: number, y: number) => Vec2D;
77
77
  getArtboardAtPosition: (x: number, y: number) => SketchWebArtboardUUID;
78
78
  setMouse: (x: number, y: number) => void;
79
- setRendererConfiguration: (configuration: RendererConfiguration) => void;
80
79
  mouseDown: () => void;
81
80
  mouseUp: () => void;
82
81
  mouseDoubleClick: () => void;
@@ -92,7 +91,7 @@ export interface SketchWebWasmInstance {
92
91
  delete: () => void;
93
92
  }
94
93
  export interface SketchWebWasm {
95
- MakeGL: (emscriptenCtxHandle: EmscriptenCtxContextHandle, width: number, height: number, pixelRatio: number) => SketchWebWasmInstance;
94
+ MakeGL: (emscriptenCtxHandle: EmscriptenCtxContextHandle, width: number, height: number, pixelRatio: number, rendererSettings: RendererSettings) => SketchWebWasmInstance;
96
95
  }
97
96
  export declare type Vec2D = {
98
97
  x: number;
@@ -1 +1 @@
1
- {"version":3,"file":"WASM.d.ts","sourceRoot":"","sources":["../../../src/ts/types/WASM.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,YAAY,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE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,EAAE,MAAM,MAAM,CAAA;IACrB,aAAa,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7C,aAAa,EAAE,CAAC,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3E,iBAAiB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAA;IAC9C,uBAAuB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAClD,kBAAkB,EAAE,MAAM,IAAI,CAAA;IAG9B,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB;AAED,MAAM,WAAW,aAAa;IAE5B,MAAM,EAAE,CACN,mBAAmB,EAAE,0BAA0B,EAC/C,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,gBAAgB,EAAE,gBAAgB,KAC/B,qBAAqB,CAAA;CAC3B;AAED,oBAAY,KAAK,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAA;AAG5C,oBAAY,qBAAqB,GAAG,MAAM,CAAA;AAE1C,oBAAY,0BAA0B,GAAG,MAAM,CAAA;AAE/C,oBAAY,gCAAgC,GAAG;IAC7C,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,sBAAsB,CAAA"}
@@ -34,6 +34,7 @@ export declare class GestureManager extends EventEmitter<GestureManagerEvents> {
34
34
  private handleGestureStart;
35
35
  private handleGestureChange;
36
36
  private handleGestureEnd;
37
+ private clampPointerToTargetBounds;
37
38
  /**
38
39
  * Extract the pointer position from the event
39
40
  * and makes sure that the pointer position is correct even if the target has margins
@@ -1 +1 @@
1
- {"version":3,"file":"GestureManager.d.ts","sourceRoot":"","sources":["../../../../src/ts/utils/GestureManager/GestureManager.ts"],"names":[],"mappings":"AAAA,OAA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BAAmB,CAAC,CAAC,EAAE,UAAU,GAAG,UAAU;IAM9C,OAAO,CAAC,iBAAiB,CAexB;IAED,OAAO,CAAC,cAAc,CAIrB;IAED,OAAO,CAAC,2BAA2B,CAYlC;IAED,OAAO,CAAC,iBAAiB,CASxB;IAED;;;OAGG;IACH,OAAO,CAAC,4BAA4B,CAsBnC;IAED,OAAO,CAAC,aAAa,CAyBpB;IAED;;;OAGG;IACH,OAAO,CAAC,iBAAiB,CAsCxB;IAED,OAAO,CAAC,gBAAgB,CAEC;IAEzB,OAAO,CAAC,YAAY,CAEnB;IAED,OAAO,CAAC,eAAe,CAQtB;IAED,OAAO,CAAC,yBAAyB,CAKhC;IAED,OAAO,CAAC,gBAAgB,CA2BvB;IAED,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,kBAAkB;IAO1B;;;OAGG;IACH,OAAO,CAAC,gBAAgB,CAMM;IAE9B,OAAO,CAAC,qBAAqB,CAE5B;IAED,OAAO,CAAC,mBAAmB,CAE1B;IAEM,QAAQ;;;;IAIR,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM;IAM7B,iBAAiB,CAAC,UAAU,EAAE,OAAO;IAIrC,eAAe,IAAI,MAAM;IAIzB,eAAe,IAAI,MAAM;IAIzB,OAAO;CAIf"}
@@ -18,6 +18,11 @@ export declare function extractPointer(e: any): {
18
18
  export declare function clamp(value: number, min: number, max: number): number;
19
19
  export declare function getSupportedWebGLVersion(): number;
20
20
  export declare function convertEmbindVectorToArray<T>(vector: EmbindVector<T>): T[];
21
+ /**
22
+ * Keep in mind that this check is not entirely accurate on Windows machines.
23
+ * On Safari for MacOS, it's fairly accurate. That's where we use it.
24
+ * @see: https://stackoverflow.com/questions/4817029/whats-the-best-way-to-detect-a-touch-screen-device-using-javascript
25
+ */
21
26
  export declare function isTouchDevice(): boolean;
22
27
  export declare function isTouchEvent(e: any): boolean;
23
28
  //# sourceMappingURL=misc.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/ts/utils/misc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,MAAM;cAKqB,UAAU,CAAC,CAAC,CAAC;IAQjD;;;OAGG;;EAQJ;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG;;;EAOpC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAE5D;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CASjD;AAED,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAW1E;AAED,wBAAgB,aAAa,YAM5B;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,WAOlC"}
1
+ {"version":3,"file":"misc.d.ts","sourceRoot":"","sources":["../../../src/ts/utils/misc.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAE5C,wBAAgB,QAAQ,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACxD,QAAQ,EAAE,CAAC,EACX,OAAO,EAAE,MAAM;cAKqB,UAAU,CAAC,CAAC,CAAC;IAQjD;;;OAGG;;EAQJ;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,GAAG;;;EAOpC;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAE5D;AAED,wBAAgB,wBAAwB,IAAI,MAAM,CASjD;AAED,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAW1E;AAED;;;;GAIG;AACH,wBAAgB,aAAa,YAM5B;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,WAOlC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sketch-hq/sketch-web-renderer",
3
- "version": "3.1.2",
3
+ "version": "3.1.3",
4
4
  "license": "UNLICENSED",
5
5
  "description": "Sketch Web Renderer",
6
6
  "repository": "git@github.com:sketch-hq/web-renderer",
@@ -17,6 +17,7 @@
17
17
  "build:ts": "yarn webpack",
18
18
  "build:cpp": "./tools/scripts/build_renderer_ninja.sh",
19
19
  "build:fonts": "./tools/scripts/build_fonts.sh",
20
+ "build:lib": "./tools/scripts/build_renderer_lib.sh",
20
21
  "watch:ts": "yarn webpack --watch",
21
22
  "release": "NODE_ENV=production yarn build",
22
23
  "vendors:cpp": "./tools/scripts/vendors.sh",
@@ -1 +0,0 @@
1
- !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var r in n)("object"==typeof exports?exports:e)[r]=n[r]}}(self,(function(){return(()=>{"use strict";var e,t,n={},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var i=r[e]={exports:{}};return n[e](i,i.exports,o),i.exports}o.m=n,t=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(n,r){if(1&r&&(n=this(n)),8&r)return n;if("object"==typeof n&&n){if(4&r&&n.__esModule)return n;if(16&r&&"function"==typeof n.then)return n}var i=Object.create(null);o.r(i);var s={};e=e||[null,t({}),t([]),t(t)];for(var a=2&r&&n;"object"==typeof a&&!~e.indexOf(a);a=t(a))Object.getOwnPropertyNames(a).forEach((e=>s[e]=()=>n[e]));return s.default=()=>n,o.d(i,s),i},o.d=(e,t)=>{for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((t,n)=>(o.f[n](e,t),t)),[])),o.u=e=>"static/js/web-renderer-"+{425:"148f39e38ee433dd320b",816:"076a12afe5f111b57e6c"}[e]+".chunk.js",o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.p="/",(()=>{var e={285:1};o.f.i=(t,n)=>{e[t]||importScripts(o.p+o.u(t))};var t=self.webpackChunk_sketch_hq_sketch_web_renderer=self.webpackChunk_sketch_hq_sketch_web_renderer||[],n=t.push.bind(t);t.push=t=>{var[r,i,s]=t;for(var a in i)o.o(i,a)&&(o.m[a]=i[a]);for(s&&s(o);r.length;)e[r.pop()]=1;n(t)}})();const i={delayedDraw:!0,useNewTiledRenderer:!0,offscreenCanvas:!1,safariWebGL2:!1,pageBoundariesLimit:!1};var s=/(iPhone|Macintosh|iPad)(.*)(Version)\/(0|[1-9]\d*)\.(0|[1-9]\d*)\.?(0|[1-9]\d*)?/;function a(e){for(var t=e.size(),n=[],r=0;r<t;++r){var o=e.get(r);n.push(o)}return n}var c=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){var n,r;this.listeners[e]=null!==(n=this.listeners[e])&&void 0!==n?n:new Set,null===(r=this.listeners[e])||void 0===r||r.add(t)},e.prototype.off=function(e,t){var n;null===(n=this.listeners[e])||void 0===n||n.delete(t)},e.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];var r=this.listeners[e];(null==r?void 0:r.size)&&r.forEach((function(e){Promise.resolve().then((function(){e.apply(void 0,t)}))}))},e}(),u=function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),o=0;for(t=0;t<n;t++)for(var i=arguments[t],s=0,a=i.length;s<a;s++,o++)r[o]=i[s];return r};const l=new(function(){function e(){this.active=!0}return e.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.debug.apply(console,u(["[SketchWeb] [Debug]"],e))},e.prototype.warning=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.active&&console.warn.apply(console,u(["[SketchWeb] [Warn]"],e))},e.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];console.error.apply(console,u(["[SketchWeb] [Error]"],e))},e}());var h,d,p=function(){function e(e){this.label=e,this.startTime=performance.now(),this.startTimestamp=Date.now(),l.debug("[Performance] Start: "+this.label)}return e.prototype.measure=function(){var e=performance.now()-this.startTime;return{duration:e,end:this.startTimestamp+e,start:this.startTimestamp,id:this.label}},e.prototype.printMeasurement=function(){var e=this.measure().duration;if(e<1e3){var t=e.toFixed(2);l.debug("[Performance] End: "+this.label+" -> "+t+" ms")}else{var n=(e/1e3).toFixed(2);l.debug("[Performance] End: "+this.label+" -> "+n+" s")}},e}(),f=(h=function(e,t){return(h=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}h(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),m=function(e){function t(n,r,o){var i=this.constructor,s=e.call(this,"("+n+") "+r)||this;return s.code=n,s.cause=o,s.name=t.name,Object.setPrototypeOf(s,i.prototype),s}return f(t,e),t}(Error);!function(e){e.debug="debug",e.release="release"}(d||(d={}));var g=function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),b=function(){return(b=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)},v=function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},y=function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!((o=(o=s.trys).length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},w=(globalThis.indexedDB,function(e){function t(t){var n=t.canvas,r=t.locateFile,o=t.filePath,a=t.imagesURLFormat,c=t.imagesURLMap,u=t.backgroundColor,h=void 0===u?{r:1,g:1,b:1,a:1}:u,f=t.highlightColor,m=void 0===f?{r:0,g:0,b:0,a:1}:f,g=t.size,v=t.pixelRatio,y=t.mode,w=t.showTilesBorders,W=void 0!==w&&w,k=t.minimumZoomLevel,P=t.maximumZoomLevel,L=t.preserveDrawingBuffer,R=void 0!==L&&L,E=t.panBoundariesPadding,x=void 0===E?40:E,S=t.featureFlags,C=void 0===S?{}:S,_=e.call(this)||this;return _.status={type:"INIT"},_.handleWebGLContextLost=function(){_.setStatus({type:"WEBGL_CONTEXT_LOST"})},_.debouncedFullDraw=function(e,t){var n;function r(){for(var t=[],r=0;r<arguments.length;r++)t[r]=arguments[r];clearTimeout(n),n=setTimeout((function(){e.apply(void 0,t)}),60)}return r.cancel=function(){n&&clearTimeout(n)},r}((function(){return _.draw(!0)})),_.canvas=n,_.locateFile=r,_.filePath=o,_.imagesURLFormat=a,_.imagesURLMap=c,_.backgroundColor=h,_.highlightColor=m,_.size=g,_.pixelRatio=v,_.mode=y,_.showTilesBorders=W,_.currentWebGLVersion=function(e){if(void 0===e&&(e=window.navigator.userAgent),e.includes("Chrome/")||e.includes("Chromium/")||e.includes("Opera/")||e.includes("Firefox/"))return null;var t=e.match(s);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}}}()&&!i.safariWebGL2?1:"undefined"!=typeof WebGL2RenderingContext?2:1,_.zoomLevels={min:k,max:P},_.preserveDrawingBuffer=R,_.panBoundariesPadding=x,_.featureFlags=b(b({},i),C),l.active=y===d.debug,_.traceFirstPaint=new p("FirstPaint"),_}return g(t,e),t.prototype.init=function(){return v(this,void 0,void 0,(function(){var e;return y(this,(function(t){switch(t.label){case 0:this.setStatus({type:"INIT"}),t.label=1;case 1:return t.trys.push([1,5,,6]),[4,this.initSketchWebWasm()];case 2:return t.sent(),[4,this.setFile(this.filePath)];case 3:return t.sent(),[4,this.preloadImages()];case 4:return t.sent(),[3,6];case 5:return e=t.sent(),[2,this.fail(e instanceof m?e:new m("ERROR","Unexpected exception initializing the web renderer",e))];case 6:return[2]}}))}))},t.prototype.preloadImages=function(){var e=this;return new Promise((function(t){var n;null===(n=e.sketchWebWasm)||void 0===n||n.preloadImages((function(){t()}))}))},t.prototype.startRendering=function(){this.traceInitialRender=new p("InitialRender"),this.setStatus({type:"DRAWING_FILE"}),this.draw(!0,!1),this.sketchWebWasm.startRenderLoop()},t.prototype.createJSBridge=function(){var e=this;return{logDebug:function(e){l.debug("[C++] "+e)},logWarning:function(e){l.warning("[C++] "+e)},logError:function(e){l.error("[C++] "+e)},emitMetric:function(t,n,r,o){e.emit("metric",{id:t,start:n,end:r,duration:o})},resolveImageUrl:function(t){return e.imagesURLFormat?e.imagesURLFormat.replace(":imageId",t):e.imagesURLMap&&e.imagesURLMap[t]?e.imagesURLMap[t]:(l.warning("Not able to resolve the url for the image with UUID: "+t),"")},onDrawComplete:this.handleDrawComplete.bind(this),onAllImagesReady:function(){e.emit("allImagesReady")}}},t.prototype.downloadImages=function(){var e=this;return new Promise((function(t){var n,r=new p("ImagesDownload");null===(n=e.sketchWebWasm)||void 0===n||n.downloadImages((function(){r.printMeasurement(),e.emit("metric",r.measure()),l.debug("Images downloaded"),t()}))}))},t.prototype.initSketchWebWasm=function(){return v(this,void 0,void 0,(function(){var e,t,n,r,i,s,a,c=this;return y(this,(function(u){switch(u.label){case 0:return e=new p("WasmModuleDownload"),this.mode!==d.debug?[3,2]:[4,o.e(425).then(o.t.bind(o,425,23))];case 1:return t=u.sent(),[3,4];case 2:return[4,o.e(816).then(o.t.bind(o,816,23))];case 3:t=u.sent(),u.label=4;case 4:n=t.default,u.label=5;case 5:return u.trys.push([5,7,,8]),r=this,[4,n({FeatureFlags:this.featureFlags,currentWebGLVersion:this.currentWebGLVersion,locateFile:function(e){return c.locateFile.replace("{file}",e)},bridge:this.createJSBridge()})];case 6:return r.wasmModule=u.sent(),[3,8];case 7:throw i=u.sent(),new m("WASM_ERROR","An error occurred while trying to create the wasm module.",i);case 8:if(e.printMeasurement(),this.emit("metric",e.measure()),s={majorVersion:this.currentWebGLVersion,antialias:!1,alpha:!1,stencil:!1,depth:!1,powerPreference:"high-performance",preserveDrawingBuffer:this.preserveDrawingBuffer},l.debug("Using WebGL "+s.majorVersion),!(a=this.wasmModule.GL.createContext(this.canvas,s)))throw new m("WEBGL_ERROR","Unable to create WebGL context. WebGL might be unsupported, disabled, or this device is not able to run WebGL correctly.");this.webglCtxHandle=a;try{this.sketchWebWasm=this.wasmModule.SketchWeb.MakeGL(this.webglCtxHandle,this.canvas.width,this.size.height,this.pixelRatio)}catch(e){throw new m("WASM_ERROR","An error occurred while trying to create the SketchWebWasm object.",e)}return this.sketchWebWasm.setBackgroundColor(this.backgroundColor.r,this.backgroundColor.g,this.backgroundColor.b,this.backgroundColor.a),this.sketchWebWasm.setHighlightColor(this.highlightColor.r,this.highlightColor.g,this.highlightColor.b,this.highlightColor.a),this.sketchWebWasm.setRendererConfiguration({showTilesBorders:this.showTilesBorders}),this.sketchWebWasm.setZoomLevels(this.zoomLevels.min,this.zoomLevels.max),this.sketchWebWasm.setPanBoundariesPadding(this.panBoundariesPadding),this.canvas.addEventListener("webglcontextlost",this.handleWebGLContextLost),[2]}}))}))},t.prototype.generateDocumentPNG=function(){return v(this,void 0,void 0,(function(){return y(this,(function(e){switch(e.label){case 0:return[4,this.downloadImages()];case 1:return e.sent(),[2,this.sketchWebWasm.generateDocumentPNG()]}}))}))},t.prototype.handleDrawComplete=function(){"DRAWING_FILE"===this.status.type&&(this.traceInitialRender.printMeasurement(),this.emit("metric",this.traceInitialRender.measure()),this.traceFirstPaint.printMeasurement(),this.emit("metric",this.traceFirstPaint.measure()),this.setStatus({type:"READY"}),this.downloadImages())},t.prototype.looseWebGLContext=function(){var e=this.wasmModule.GL.getContext(this.webglCtxHandle);if(e){var t=e.GLctx.getExtension("WEBGL_lose_context");t?t.loseContext():console.warn("Unable to retrieve WEBGL_lose_context extension")}else console.warn("Unable to loose context. WebGL rendering context not found")},t.prototype.scaleDocumentToFit=function(){var e;null===(e=this.sketchWebWasm)||void 0===e||e.scaleDocumentToFit(),this.delayedDraw()},t.prototype.setFile=function(e){return v(this,void 0,void 0,(function(){var t=this;return y(this,(function(n){return this.setStatus({type:"LOADING_FILE"}),[2,new Promise((function(n,r){t.sketchWebWasm.setFile(e,(function(e){if(void 0===e&&(e=[]),e.length){l.debug("Parser warnings: "+e);var r=e.map((function(e){return{key:e}}));t.emit("warnings",r)}t.setStatus({type:"FILE_READY"}),t.emit("fileReady",t.getDocument()),n()}),(function(){return r(new m("FILE_ERROR","Error encountered while fetching and parsing the file"))}))}))]}))}))},t.prototype.delayedDraw=function(){if(!this.featureFlags.delayedDraw)return this.draw(!0);this.draw(),this.debouncedFullDraw()},t.prototype.draw=function(e,t){var n;void 0===e&&(e=!1),void 0===t&&(t=!1),null===(n=this.sketchWebWasm)||void 0===n||n.setNeedsUpdate(e,t)},t.prototype.fail=function(e){this.setStatus({type:"FAILURE",code:e.code,message:e.toString()+(e.cause?"\nWrapped Error: "+e.cause.toString():"")}),l.error(e),e.cause&&l.error(e.cause)},t.prototype.setPixelRatio=function(e){this.pixelRatio=e,this.setSize(this.size.width*this.pixelRatio,this.size.height*this.pixelRatio,this.pixelRatio),this.delayedDraw()},t.prototype.setSize=function(e,t,n){var r;this.size.width=e*n,this.size.height=t*n,this.canvas.width=e*n,this.canvas.height=t*n,null===(r=this.sketchWebWasm)||void 0===r||r.resize(e,t,n)},t.prototype.setStatus=function(e){"FAILURE"!==this.status.type&&(l.debug("Status transition "+this.status.type+" => "+e.type+"}"),this.status=e,this.emit("status",e))},t.prototype.getDocument=function(){if(!this.sketchWebWasm)return null;if(!this.cachedDocumentInfo||this.cachedDocumentInfo.filePath!==this.filePath){var e=this.sketchWebWasm.getPRFile();this.cachedDocumentInfo={filePath:this.filePath,document:b(b({},e),{artboards:a(e.artboards)})}}return this.cachedDocumentInfo.document},t.prototype.getArtboardAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getArtboardAtPosition(e,t)},t.prototype.getPanAtPosition=function(e,t){var n;return null===(n=this.sketchWebWasm)||void 0===n?void 0:n.getPanAtPosition(e,t)},t.prototype.getStatus=function(){return this.status},t.prototype.setZoom=function(e,t){var n,r;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(r=this.sketchWebWasm)||void 0===r||r.setZoom(e),this.delayedDraw()},t.prototype.addZoom=function(e,t){var n,r;null===(n=this.sketchWebWasm)||void 0===n||n.setZoomCenter(t.x,t.y),null===(r=this.sketchWebWasm)||void 0===r||r.addZoom(e),this.delayedDraw()},t.prototype.setPan=function(e,t,n){var r;void 0===n&&(n=!1),null===(r=this.sketchWebWasm)||void 0===r||r.setPan(e,t,n),this.delayedDraw()},t.prototype.addPan=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.addPan(e,t),this.delayedDraw()},t.prototype.getPan=function(){if(this.sketchWebWasm)return this.sketchWebWasm.getPan()},t.prototype.getZoom=function(){var e;return null===(e=this.sketchWebWasm)||void 0===e?void 0:e.getZoom()},t.prototype.setMouse=function(e,t){var n;null===(n=this.sketchWebWasm)||void 0===n||n.setMouse(e,t)},t.prototype.setIsCameraMoving=function(e){var t;null===(t=this.sketchWebWasm)||void 0===t||t.setIsCameraMoving(e)},t.prototype.dispose=function(){var e,t;try{null===(e=this.sketchWebWasm)||void 0===e||e.stopRenderLoop(),null===(t=this.sketchWebWasm)||void 0===t||t.delete(),this.looseWebGLContext(),this.sketchWebWasm=null,this.wasmModule=null}catch(e){this.fail(new m("ERROR","Unexpected exception while disposing the SketchWebWasm object",e))}},t}(c));const W=Symbol("Comlink.proxy"),k=Symbol("Comlink.endpoint"),P=Symbol("Comlink.releaseProxy"),L=Symbol("Comlink.thrown"),R=e=>"object"==typeof e&&null!==e||"function"==typeof e,E=new Map([["proxy",{canHandle:e=>R(e)&&e[W],serialize(e){const{port1:t,port2:n}=new MessageChannel;return x(e,t),[n,[n]]},deserialize:e=>(e.start(),_(e,[],undefined))}],["throw",{canHandle:e=>R(e)&&L in e,serialize({value:e}){let t;return t=e instanceof Error?{isError:!0,value:{message:e.message,name:e.name,stack:e.stack}}:{isError:!1,value:e},[t,[]]},deserialize(e){if(e.isError)throw Object.assign(new Error(e.value.message),e.value);throw e.value}}]]);function x(e,t=self){t.addEventListener("message",(function n(r){if(!r||!r.data)return;const{id:o,type:i,path:s}=Object.assign({path:[]},r.data),a=(r.data.argumentList||[]).map(M);let c;try{const t=s.slice(0,-1).reduce(((e,t)=>e[t]),e),n=s.reduce(((e,t)=>e[t]),e);switch(i){case"GET":c=n;break;case"SET":t[s.slice(-1)[0]]=M(r.data.value),c=!0;break;case"APPLY":c=n.apply(t,a);break;case"CONSTRUCT":c=function(e){return Object.assign(e,{[W]:!0})}(new n(...a));break;case"ENDPOINT":{const{port1:t,port2:n}=new MessageChannel;x(e,n),c=function(e,t){return D.set(e,t),e}(t,[t])}break;case"RELEASE":c=void 0;break;default:return}}catch(e){c={value:e,[L]:0}}Promise.resolve(c).catch((e=>({value:e,[L]:0}))).then((e=>{const[r,s]=I(e);t.postMessage(Object.assign(Object.assign({},r),{id:o}),s),"RELEASE"===i&&(t.removeEventListener("message",n),S(t))}))})),t.start&&t.start()}function S(e){(function(e){return"MessagePort"===e.constructor.name})(e)&&e.close()}function C(e){if(e)throw new Error("Proxy has been released and is not useable")}function _(e,t=[],n=function(){}){let r=!1;const o=new Proxy(n,{get(n,i){if(C(r),i===P)return()=>F(e,{type:"RELEASE",path:t.map((e=>e.toString()))}).then((()=>{S(e),r=!0}));if("then"===i){if(0===t.length)return{then:()=>o};const n=F(e,{type:"GET",path:t.map((e=>e.toString()))}).then(M);return n.then.bind(n)}return _(e,[...t,i])},set(n,o,i){C(r);const[s,a]=I(i);return F(e,{type:"SET",path:[...t,o].map((e=>e.toString())),value:s},a).then(M)},apply(n,o,i){C(r);const s=t[t.length-1];if(s===k)return F(e,{type:"ENDPOINT"}).then(M);if("bind"===s)return _(e,t.slice(0,-1));const[a,c]=O(i);return F(e,{type:"APPLY",path:t.map((e=>e.toString())),argumentList:a},c).then(M)},construct(n,o){C(r);const[i,s]=O(o);return F(e,{type:"CONSTRUCT",path:t.map((e=>e.toString())),argumentList:i},s).then(M)}});return o}function O(e){const t=e.map(I);return[t.map((e=>e[0])),(n=t.map((e=>e[1])),Array.prototype.concat.apply([],n))];var n}const D=new WeakMap;function I(e){for(const[t,n]of E)if(n.canHandle(e)){const[r,o]=n.serialize(e);return[{type:"HANDLER",name:t,value:r},o]}return[{type:"RAW",value:e},D.get(e)||[]]}function M(e){switch(e.type){case"HANDLER":return E.get(e.name).deserialize(e.value);case"RAW":return e.value}}function F(e,t,n){return new Promise((r=>{const o=new Array(4).fill(0).map((()=>Math.floor(Math.random()*Number.MAX_SAFE_INTEGER).toString(16))).join("-");e.addEventListener("message",(function t(n){n.data&&n.data.id&&n.data.id===o&&(e.removeEventListener("message",t),r(n.data))})),e.start&&e.start(),e.postMessage(Object.assign({id:o},t),n)}))}return x(w),{}})()}));