forked from dreygur/XDPlugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.js
1 lines (1 loc) · 64.9 KB
/
main.js
1
module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=25)}([function(e,t){e.exports=require("scenegraph")},function(e,t){e.exports=require("application")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDGraphicNode=void 0;const o=n(9),i=n(0);class r extends o.XDSceneNode{constructor(e,t){super(e,t)}get fill(){return this._node.fill}get fillEnabled(){return this._node.fillEnabled}get hasActiveImageFill(){return!!this.fill&&(this.fill instanceof i.ImageFill&&this.fillEnabled)}get stroke(){return this._node.stroke}get strokeEnabled(){return this._node.strokeEnabled}get strokePosition(){return this._node.strokePosition}get strokeWidth(){return this._node.strokeWidth}get shadow(){return this._node.shadow}set shadow(e){this._node.shadow=e}get blur(){return this._node.blur}get hasActiveObjectBlur(){return!!this.blur&&(this.blur.visible&&!this.blur.isBackgroundEffect)}}t.XDGraphicNode=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ImportSource=t.ARTBOARD_SORT_OFFSET=t.MAX__EXPORT_PROGRESS_VALUE=t.MIN_EXPORT_PROGRESS_VALUE=t.SHADOW_BLUR_OFFSET_VALUE=t.BLUR_AMOUNT_OFFSET_VALUE=t.VALID_XD_VERSION=t.VALID_STUDIO_VERSION=void 0,t.VALID_STUDIO_VERSION="5.3.0",t.VALID_XD_VERSION=29,t.BLUR_AMOUNT_OFFSET_VALUE=3,t.SHADOW_BLUR_OFFSET_VALUE=1.5,t.MIN_EXPORT_PROGRESS_VALUE=5,t.MAX__EXPORT_PROGRESS_VALUE=70,t.ARTBOARD_SORT_OFFSET=100,function(e){e.SKETCH="sketch",e.XD="Adobe XD",e.FIGMA="figma",e.FIGMA_PLUGIN="figma_plugin"}(t.ImportSource||(t.ImportSource={}))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.base64ArrayBuffer=t.round2AllNumKeyInObject=t.ignore=t.DeferResolver=t.defer=void 0,t.defer=function(){return new o};class o{constructor(){this.isPending=!0,this.promise=new Promise((e,t)=>{this.resolve=t=>{this.isPending=!1,e(t)},this.reject=e=>{this.isPending=!1,t(e)}})}}t.DeferResolver=o,t.ignore=function(e){},t.round2AllNumKeyInObject=function(e){return Object.keys(e).forEach(t=>{"number"==typeof e[t]&&(e[t]=Math.round(100*(e[t]+Number.EPSILON))/100)}),e},t.base64ArrayBuffer=function(e){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(e),i=o.byteLength,r=i%3,s=i-r;let a,c,l,d,u;for(let e=0;e<s;e+=3)u=o[e]<<16|o[e+1]<<8|o[e+2],a=(16515072&u)>>18,c=(258048&u)>>12,l=(4032&u)>>6,d=63&u,t+=n[a]+n[c]+n[l]+n[d];return 1==r?(u=o[s],a=(252&u)>>2,c=(3&u)<<4,t+=n[a]+n[c]+"=="):2==r&&(u=o[s]<<8|o[s+1],a=(64512&u)>>10,c=(1008&u)>>4,l=(15&u)<<2,t+=n[a]+n[c]+n[l]+"="),t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=n(0),i=n(3),r=e=>e*(Math.PI/180),s=(e,t)=>{const{x:n,y:o,width:i,height:s}=e,a=r(t),c=Math.sin(a),l=Math.cos(a);return{x:n+(i*l-s*c)/2,y:o+(i*c+s*l)/2}};function a(e){if(null===e.stroke||!e.strokeEnabled)return[0,0,0,0];const t=e.strokePosition,n=e.strokeWidth*{[o.GraphicNode.OUTER_STROKE]:1,[o.GraphicNode.CENTER_STROKE]:.5,[o.GraphicNode.INNER_STROKE]:0}[t];return[-n,-n,n,n]}const c=e=>{if(null===e||!e.visible)return[0,0,0,0];const t=e.x-e.blur*i.SHADOW_BLUR_OFFSET_VALUE,n=e.x+e.blur*i.SHADOW_BLUR_OFFSET_VALUE,o=e.y-e.blur*i.SHADOW_BLUR_OFFSET_VALUE,r=e.y+e.blur*i.SHADOW_BLUR_OFFSET_VALUE;return u([t,o,n,r],[0,0,0,0])},l=e=>{if(null===e||!e.visible||e.isBackgroundEffect)return[0,0,0,0];return[-i.BLUR_AMOUNT_OFFSET_VALUE*e.blurAmount,-i.BLUR_AMOUNT_OFFSET_VALUE*e.blurAmount,i.BLUR_AMOUNT_OFFSET_VALUE*e.blurAmount,i.BLUR_AMOUNT_OFFSET_VALUE*e.blurAmount]},d=(e,t)=>[e[0]+t[0],e[1]+t[1],e[2]+t[2],e[3]+t[3]],u=(...e)=>e.reduce((e,t)=>[Math.min(e[0],t[0]),Math.min(e[1],t[1]),Math.max(e[2],t[2]),Math.max(e[3],t[3])]);const h=(e,t,n,o,...i)=>{const[r,s,a,c]=u(...i);return[(e*(n/100)-r)/(e+a+-r)*100,(t*(o/100)-s)/(t+c+-s)*100]};t.default={calcCenterPointByRotation:s,calcShadowOffsetByRotation:(e,t,n)=>{const o=r(n),i=Math.sin(o),s=Math.cos(o);return{offsetX:Math.round(100*(e*s+t*i))/100,offsetY:Math.round(100*(e*-i+t*s))/100}},calcBoundsOffsetsByShadow:c,calcBoundsOffsetsByStroke:a,calcBoundsOffsetsByBlur:l,calcGraphicEffectBoundsOffset:function(e,t){const n=a(e),o=c(t),i=l(e.blur);return d(u(i,o),n)},mergeBoundsOffsets:u,calcAdjustedOriginByOffsets:h,calcLocationInfo:function(e,t){const{x:n,y:o,width:i,height:r}=e;if(0===t)return{x:n,y:o,width:i,height:r,anchorX:0,anchorY:0};const a=s(e,t);return{x:a.x,y:a.y,width:i,height:r,anchorX:50,anchorY:50}},calcAdjustedAnchorValue:function(e,t,n,o,i){const[r,s]=h(e,t,n,o,i);return{anchorX:r,anchorY:s}},addBoundsOffsets:d}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0});const i=n(0),r=n(1),s=n(5),a=n(7),c=e=>{switch(e){case i.GraphicNode.CENTER_STROKE:return"CENTER";case i.GraphicNode.INNER_STROKE:return"INSIDE";case i.GraphicNode.OUTER_STROKE:return"OUTSIDE";default:return"INSIDE"}},l=e=>{if(!e)return{fixHeight:!0,fixBottom:!1,fixTop:!0};switch(e.position){case i.SceneNode.FIXED_TOP:return{fixHeight:u(e.size),fixTop:!0,fixBottom:!1};case i.SceneNode.FIXED_BOTTOM:return{fixHeight:u(e.size),fixTop:!1,fixBottom:!0};case i.SceneNode.FIXED_BOTH:return{fixHeight:!1,fixTop:!0,fixBottom:!0};case i.SceneNode.POSITION_PROPORTIONAL:return{fixHeight:u(e.size),fixTop:!1,fixBottom:!1};default:return{fixHeight:!0,fixBottom:!1,fixTop:!0}}},d=e=>{if(!e)return{fixWidth:!0,fixLeft:!0,fixRight:!1};switch(e.position){case i.SceneNode.FIXED_LEFT:return{fixWidth:u(e.size),fixLeft:!0,fixRight:!1};case i.SceneNode.FIXED_RIGHT:return{fixWidth:u(e.size),fixLeft:!1,fixRight:!0};case i.SceneNode.FIXED_BOTH:return{fixWidth:!1,fixLeft:!0,fixRight:!0};case i.SceneNode.POSITION_PROPORTIONAL:return{fixWidth:u(e.size),fixLeft:!1,fixRight:!1};default:return{fixWidth:!0,fixLeft:!0,fixRight:!1}}},u=e=>{switch(e){case i.SceneNode.SIZE_FIXED:return!0;case i.SceneNode.SIZE_RESIZES:return!1;default:return!0}},h=e=>{if(null===e.stroke)return{borderEnabled:!1};const{opacity:t,hex:n}=_(e.stroke);return{borderEnabled:e.strokeEnabled,borderPosition:c(e.strokePosition),borderWidth:e.strokeWidth,borderColor:n,borderOpacity:t}},p=e=>{if(!e)return{shadowEnabled:!1};const{opacity:t,hex:n}=_(e.color);return{shadowEnabled:e.visible,shadowOffsetX:e.x,shadowOffsetY:e.y,shadowBlur:e.blur,shadowColor:n,shadowOpacity:t}},f=e=>{if(e.fill instanceof i.Color&&e.fillEnabled){const{opacity:t,hex:n}=_(e.fill);return{fillEnabled:!0,fillOpacity:t,fillColor:n}}return{fillEnabled:!1}},_=e=>({opacity:e.a/255*100,hex:e.toHex(!0).toUpperCase()});function v(e,t,n,s){return o(this,void 0,void 0,(function*(){let o,c=null,l=!1;const d=s===r.RenditionType.PNG?e.absoluteRotation:e.rotation;return i.selection.isInEditContext(e.originalNode)&&!e.locked&&(c=a.duplicateNode(e.originalNode)),c instanceof i.GraphicNode?(c.rotateAround(-d,c.localCenterPoint),c.shadow=t,c.opacity=1,o=yield n.export(c,s),c.removeFromParent(),l=!0):o=yield n.export(e.originalNode,s),{image:o,isCorrectImage:l}}))}t.default={convertStrokePosition:c,convertVerticalConstraints:l,convertHorizontalConstraints:d,convertConstraintsSize:u,convertConstraints:function(e){const t=l(e.verticalConstraints),n=d(e.horizontalConstraints);return Object.assign(Object.assign({},t),n)},convertColorToHexAndAlpha:_,convertBorder:h,convertFill:f,convertShadow:p,convertGraphicEffects:function(e,t){return Object.assign(Object.assign(Object.assign({},p(t)),f(e)),h(e))},createAdjustedShadow:function(e,t){if(null===e)return null;if(0===t)return e;const n=s.default.calcShadowOffsetByRotation(e.x,e.y,t);return new i.Shadow(n.offsetX,n.offsetY,e.blur,e.color,e.visible)},getImageWithRotationOrOpacity:v,getImage:function(e,t,n,i){return o(this,void 0,void 0,(function*(){try{if(0!==(i===r.RenditionType.PNG?e.absoluteRotation:e.rotation)||1!==e.opacity)return yield v(e,t,n,i);return{image:yield n.export(e.originalNode,i),isCorrectImage:!0}}catch(t){throw console.log("[Converter] error occurred when get Image",e.name),t}}))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.sortByZIndex=t.haveSameParent=t.sortArtboardsByXYCoords=t.duplicateNode=t.getZIndexOfNodeInSceneNodeList=t.getNexSiblingId=t.isMaskGroup=t.calcScrollOffsets=void 0;const o=n(0),i=n(28),r=n(3);function s(e,t){if(!e)return-1;let n=-1;return e.forEach((e,o)=>{e.guid===t.guid&&(n=o)}),n}function a(e,t){return!(!e.parent||!t.parent)&&e.parent.guid===t.parent.guid}t.calcScrollOffsets=function(e){var t;const n=[0,0],i=e.scrollingType,r=null===(t=e.children.at(0))||void 0===t?void 0:t.globalBounds,s=e.globalBounds;return i===o.ScrollableGroup.HORIZONTAL?n[0]=s.x-r.x:n[1]=s.y-r.y,n},t.isMaskGroup=function(e){return e instanceof o.Group&&null!==e.mask},t.getNexSiblingId=function(e){if(!e.parent)return null;const t=s(e.parent.children,e);if(-1===t)return null;if(e.parent instanceof o.Group&&e.parent.mask){if(t===e.parent.children.length-1)return e.parent.children.at(0).guid;if(t===e.parent.children.length-2)return null}const n=e.parent.children.at(t+1);return n?n.guid:null},t.getZIndexOfNodeInSceneNodeList=s,t.duplicateNode=function(e){return o.selection.items=[e],i.duplicate(),o.selection.items[0]},t.sortArtboardsByXYCoords=function(e){return e.sort((e,t)=>{const n=e.globalBounds.y-t.globalBounds.y;return 0==n||Math.abs(n)<r.ARTBOARD_SORT_OFFSET?e.globalBounds.x-t.globalBounds.x:n})},t.haveSameParent=a,t.sortByZIndex=function(e,t){let n=0,o=!1;const i=(e,t)=>{if(!o&&e.parent&&t.parent){if(a(e,t)){const i=e.parent.children,r=s(i,e),a=s(i,t);return r<a&&(n=-1),r>a&&(n=1),void(o=!0)}i(e.parent,t),i(e,t.parent)}};return i(e,t),n}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.LayerConverter=void 0;const i=n(5),r=n(6);t.LayerConverter=class{static convert(e,t=null){return o(this,void 0,void 0,(function*(){return Object.assign(Object.assign(Object.assign({id:e.id,name:e.name,parentId:e.parentId,nextSiblingId:e.nextSiblingId},i.default.calcLocationInfo(e.adjustedBounds,e.rotation)),{rotation:e.rotation,opacity:100*e.opacity,invisible:!e.visible,lock:e.locked,hitExtendEnabled:!1,hitExtendAbove:0,hitExtendBelow:0,hitExtendLeft:0,hitExtendRight:0,fixed:e.locked}),r.default.convertConstraints(e))}))}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDSceneNode=void 0;const o=n(0),i=n(7);t.XDSceneNode=class{constructor(e,t){this._node=e,this._XDVersion=t}get version(){return this._XDVersion}get originalNode(){return this._node}get type(){return this._node.constructor.name}get id(){return this._node.guid}get name(){return this._node.name}get parent(){return this._node.parent}get parentId(){return this._node.parent?this._node.parent.guid:null}get children(){return this._node.children}get childrenIds(){return this._node.children.map(e=>e.guid)}get nextSiblingId(){return i.getNexSiblingId(this._node)}get visible(){return this._node.visible}get opacity(){return this._node.opacity}set opacity(e){this._node.opacity=e}get rotation(){const e=Math.round(this._node.rotation)%360;return e<0?360+e:e}get absoluteRotation(){let e=this._node.rotation,t=this._node;for(;t.parent;)t=t.parent,e+=t.rotation;const n=Math.round(e)%360;return n<0?360+n:n}get locked(){return this._node.locked}get horizontalConstraints(){return this._node.horizontalConstraints}get verticalConstraints(){return this._node.verticalConstraints}get adjustedBounds(){if(null===this._node.parent)return{x:this._node.localBounds.x,y:this._node.localBounds.y,width:this._node.localBounds.width,height:this._node.localBounds.height};const e=this._node.parent.localBounds,t=this._node.topLeftInParent;let n=[0,0];return this._node.parent instanceof o.ScrollableGroup&&(n=i.calcScrollOffsets(this._node.parent)),{x:t.x-e.x+n[0],y:t.y-e.y+n[1],width:this._node.localBounds.width,height:this._node.localBounds.height}}get isMaskNode(){return this._node.parent instanceof o.Group&&(null!==this._node.parent.mask&&this._node.guid===this._node.parent.mask.guid)}rotateAround(e){this._node.rotateAround(e,this._node.localCenterPoint)}}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.VectorLayerConverter=void 0;const i=n(8),r=n(6),s=n(1),a=n(5);class c extends i.LayerConverter{static convert(e,t){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){const o=yield n.convert.call(this,e,t),i=r.default.createAdjustedShadow(e.shadow,e.absoluteRotation),c=a.default.calcGraphicEffectBoundsOffset(e,i),l=r.default.convertGraphicEffects(e,i),{image:d,isCorrectImage:u}=yield r.default.getImage(e,i,t,s.RenditionType.SVG);return u?Object.assign(Object.assign(Object.assign(Object.assign({},o),a.default.calcAdjustedAnchorValue(e.adjustedBounds.width,e.adjustedBounds.height,0===e.rotation?0:50,0===e.rotation?0:50,c)),l),{svg:d}):Object.assign(Object.assign(Object.assign(Object.assign({},o),{opacity:100,rotation:0}),l),{svg:d})}))}}t.VectorLayerConverter=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDGroupNode=void 0;const o=n(0),i=n(9);class r extends i.XDSceneNode{constructor(e,t){super(e,t)}get isSymbolInstance(){return this._node instanceof o.SymbolInstance}get isMaskGroup(){return!!this._node.mask}get isRepeatGrid(){return"RepeatGrid"===this._node.constructor.name}get maskNode(){return this._node.mask}}t.XDGroupNode=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDTextNode=void 0;const o=n(2);class i extends o.XDGraphicNode{constructor(e,t){super(e,t)}get styleRanges(){return this._node.styleRanges}get text(){return this._node.text}get fontFamily(){return this._node.fontFamily}get fontStyle(){return this._node.fontStyle}get fontSize(){return this._node.fontSize}get fill(){return this._node.fill}get textType(){return this._XDVersion<34?this._node.areaBox?"FIXED_SIZE":"AUTO_WIDTH":this._node.layoutBox.type}get textAlign(){return this._node.textAlign}get charSpacing(){return this._node.charSpacing}get lineSpacing(){return this._node.lineSpacing}}t.XDTextNode=i},function(e,t,n){"use strict";var o=n(24),i=n.n(o)()(!1);i.push([e.i,".text {\n text-align: center;\n font-weight: 300;\n font-style: normal;\n\n letter-spacing: -0.2px;\n color: #636363;\n}\n\n.text--error {\n color: #DB2A2A;\n}\n\n.text--point {\n color: #FF6661;\n}\n\n.text--bold {\n font-weight: 700;\n}\n\n.text--underline {\n color: #8E8E8E;\n text-decoration-line: underline;\n}\n\n.panel--hr {\n width: 100%;\n height: 17px;\n\n border-bottom: 1px solid #EAEAEA;\n}\n\n.panel {\n font-size: 10px;\n line-height: normal;\n}\n\n.panel__header {\n /* Box-model */\n width: 100%;\n}\n\n.panel__message {\n display: flex;\n flex-wrap: wrap;\n\n align-items: center;\n justify-content: center;\n\n height: 36px;\n margin-bottom: 12px;\n}\n\n.panel__btn {\n /* Box-model */\n display: flex;\n align-items: center;\n justify-content: center;\n height: 24px;\n\n /* Typography */\n color: #FFFFFF;\n\n /* Border */\n border-radius: 2px;\n\n /* etc */\n background-color: #FF6661;\n}\n\n.panel__btn:hover {\n background-color: #FF4D47;\n}\n\n.panel__btn--disabled {\n background-color: #D1D1D1;\n}\n\n.panel__btn--disabled:hover {\n background-color: #D1D1D1;\n}\n\n.panel__btn--spinner {\n background-color: #FF9487;\n}\n\n.panel__btn--spinner:hover {\n background-color: #FF9487;\n}\n\n.panel__thumbnailContainer {\n /* Box-model */\n display: inline-flex;\n flex-wrap: wrap;\n justify-content: flex-start;\n margin: 4px 0 0 -14px;\n width: calc(100% + 14px);\n}\n\n.panel__thumbnail {\n padding: 1px;\n margin: 14px 0 0 14px;\n\n /* Border */\n border: 1px solid #E3E3E3;\n border-radius: 4px;\n\n /* ETC */\n background-size: contain;\n background-color: #F1F1F1;\n background-position: center;\n}\n\n.panel__thumbnail--spinner {\n /* ETC */\n background-size: 18px 18px;\n}\n\n.panel__thumbnail--artboard {\n /* Box-model */\n width: calc(33.33% - 14px);\n padding-top: calc(120 / 170 * (33.33% - 14px));\n}\n\n.panel__thumbnail--object {\n /* Box-model */\n width: calc(25% - 14px);\n padding-top: calc(25% - 14px);\n}\n\n@media only screen and (max-width: 372px) {\n .panel__thumbnail--artboard {\n /* Box-model */\n width: calc(50% - 14px);\n padding-top: calc(120 / 170 * (50% - 14px));\n }\n\n .panel__thumbnail--object {\n /* Box-model */\n width: calc(33.33% - 14px);\n padding-top: calc(33.33% - 14px);\n }\n}\n\n@media only screen and (max-width: 258px) {\n .panel__thumbnail--artboard {\n /* Box-model */\n width: 100%;\n padding-top: calc(120 / 170 * 100%);\n }\n\n .panel__thumbnail--object {\n /* Box-model */\n width: calc(50% - 14px);\n padding-top: calc(50% - 14px);\n }\n}\n\n.dialog {\n width: 360px;\n}\n\n.dialog__header {\n display: flex;\n}\n\n.dialog--hr {\n width: 100%;\n height: 29px;\n margin-top: 11px;\n border-top: 2px solid #EAEAEA;\n}\n\n.dialog__contents {\n display: flex;\n justify-content: space-between;\n}\n\n.dialog__btn {\n display: flex;\n justify-content: center;\n align-items: center;\n\n padding: 6px 16px;\n border-radius: 2px;\n\n font-size: 10px;\n}\n\n.dialog__btn--ok {\n background-color: #FF6661;\n}\n\n.dialog__btn--ok .text {\n color: #FFF;\n}\n\n.dialog__btn--ok:hover {\n background-color: #FF4D47;\n}\n\n.dialog__btn--cancel {\n border: 1px solid #FF6661;\n}\n\n.dialog__btn--cancel .text {\n color: #FF6661;\n}\n\n.dialog__btn--cancel:hover {\n background-color: #FF6661;\n}\n\n.dialog__btn--cancel:hover .text {\n color: #FFF;\n}\n\n.dialog__progress {\n width: 360px;\n height: 4px;\n\n display: flex;\n\n margin-top: 12px;\n\n border-radius: 2px;\n\n background-color: #FFD4C9;\n}\n\n.dialog__progressBar {\n height: 4px;\n\n border-radius: 2px;\n\n background-color: #FF6661;\n}\n\n.dialog--footer {\n margin-top: 27px;\n}\n\n.hide {\n display: none;\n}\n",""]),t.a=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInsideBooleanGroupOrMaskGroup=t.validateSelection=t.validateXDVersion=t.validateStudioVersion=t.getVersionDigitFormVersionText=void 0;const o=n(15),i=n(0),r=n(3),s=n(7);function a(e){return e.split("-")[0].slice(1).split(".").map(e=>+e)}function c(e){let t=e.parent;for(;null!==t;){if(t instanceof i.BooleanGroup||s.isMaskGroup(t))return!0;t=t.parent}return!1}t.getVersionDigitFormVersionText=a,t.validateStudioVersion=function(e){const t=a(e),n=a(r.VALID_STUDIO_VERSION);for(const[e,o]of t.entries())if(o<n[e])return!1;return!0},t.validateXDVersion=function(e){if(e<r.VALID_XD_VERSION)throw new o.XDVersionError},t.validateSelection=function(e){const t={sceneCount:0,nodeCount:0},n=[],r=[];return e.items.forEach(e=>{if(c(e))throw new o.XDSelectionError;e instanceof i.Artboard?(n.push(e),t.sceneCount++):(r.push(e),t.nodeCount++)}),[n.length>0?s.sortArtboardsByXYCoords(n):r.sort(s.sortByZIndex),t,n.length>0?"artboard":"object"]},t.isInsideBooleanGroupOrMaskGroup=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ExportCanceled=t.XDSelectionError=t.XDVersionError=void 0;const o=n(3);class i extends Error{constructor(){super(...arguments),this.message=`Adobe XD ${o.VALID_XD_VERSION} or higher is required.`}}t.XDVersionError=i;class r extends Error{constructor(){super(...arguments),this.message="Children of mask groups or combined object groups cannot be exported."}}t.XDSelectionError=r;class s extends Error{}t.ExportCanceled=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setHtml=t.removeClass=t.addClass=void 0,t.addClass=function(e,t){e.classList.contains(t)||e.classList.add(t)},t.removeClass=function(e,t){e.classList.contains(t)&&e.classList.remove(t)},t.setHtml=function(e,t){e.innerHTML=t}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ContainerLayerConverter=void 0;const i=n(8);class r extends i.LayerConverter{static convert(e,t=null){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){return Object.assign(Object.assign({},yield n.convert.call(this,e)),{type:"CONTAINER",name:e.name?e.name:"Group",childrenIDs:e.childrenIds,clipChildren:"RepeatGrid"===e.type})}))}}t.ContainerLayerConverter=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDRectangleNode=void 0;const o=n(2);class i extends o.XDGraphicNode{constructor(e,t){super(e,t)}get cornerRadii(){return this._node.cornerRadii}get hasRoundedCorners(){return this._node.hasRoundedCorners}}t.XDRectangleNode=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDScrollGroupNode=void 0;const o=n(9),i=n(0),r=n(7);class s extends o.XDSceneNode{get scrollingType(){return this._node.scrollingType}get viewport(){return this._node.viewport}get scrollOffset(){const e=r.calcScrollOffsets(this._node);return this.scrollingType===i.ScrollableGroup.HORIZONTAL?e[0]:e[1]}}t.XDScrollGroupNode=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDArtboardNode=void 0;const o=n(2);class i extends o.XDGraphicNode{constructor(e,t){super(e,t)}}t.XDArtboardNode=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.XDEllipseNode=void 0;const o=n(2);class i extends o.XDGraphicNode{constructor(e,t){super(e,t)}}t.XDEllipseNode=i},function(e,t){e.exports=require("uxp")},function(e,t,n){"use strict";var o,i=function(){return void 0===o&&(o=Boolean(window&&document&&document.all&&!window.atob)),o},r=function(){var e={};return function(t){if(void 0===e[t]){var n=document.querySelector(t);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}e[t]=n}return e[t]}}(),s=[];function a(e){for(var t=-1,n=0;n<s.length;n++)if(s[n].identifier===e){t=n;break}return t}function c(e,t){for(var n={},o=[],i=0;i<e.length;i++){var r=e[i],c=t.base?r[0]+t.base:r[0],l=n[c]||0,d="".concat(c," ").concat(l);n[c]=l+1;var u=a(d),h={css:r[1],media:r[2],sourceMap:r[3]};-1!==u?(s[u].references++,s[u].updater(h)):s.push({identifier:d,updater:v(h,t),references:1}),o.push(d)}return o}function l(e){var t=document.createElement("style"),o=e.attributes||{};if(void 0===o.nonce){var i=n.nc;i&&(o.nonce=i)}if(Object.keys(o).forEach((function(e){t.setAttribute(e,o[e])})),"function"==typeof e.insert)e.insert(t);else{var s=r(e.insert||"head");if(!s)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");s.appendChild(t)}return t}var d,u=(d=[],function(e,t){return d[e]=t,d.filter(Boolean).join("\n")});function h(e,t,n,o){var i=n?"":o.media?"@media ".concat(o.media," {").concat(o.css,"}"):o.css;if(e.styleSheet)e.styleSheet.cssText=u(t,i);else{var r=document.createTextNode(i),s=e.childNodes;s[t]&&e.removeChild(s[t]),s.length?e.insertBefore(r,s[t]):e.appendChild(r)}}function p(e,t,n){var o=n.css,i=n.media,r=n.sourceMap;if(i?e.setAttribute("media",i):e.removeAttribute("media"),r&&"undefined"!=typeof btoa&&(o+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(r))))," */")),e.styleSheet)e.styleSheet.cssText=o;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(o))}}var f=null,_=0;function v(e,t){var n,o,i;if(t.singleton){var r=_++;n=f||(f=l(t)),o=h.bind(null,n,r,!1),i=h.bind(null,n,r,!0)}else n=l(t),o=p.bind(null,n,t),i=function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(n)};return o(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap)return;o(e=t)}else i()}}e.exports=function(e,t){(t=t||{}).singleton||"boolean"==typeof t.singleton||(t.singleton=i());var n=c(e=e||[],t);return function(e){if(e=e||[],"[object Array]"===Object.prototype.toString.call(e)){for(var o=0;o<n.length;o++){var i=a(n[o]);s[i].references--}for(var r=c(e,t),l=0;l<n.length;l++){var d=a(n[l]);0===s[d].references&&(s[d].updater(),s.splice(d,1))}n=r}}}},function(e,t,n){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map((function(t){var n=function(e,t){var n=e[1]||"",o=e[3];if(!o)return n;if(t&&"function"==typeof btoa){var i=(s=o,a=btoa(unescape(encodeURIComponent(JSON.stringify(s)))),c="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(a),"/*# ".concat(c," */")),r=o.sources.map((function(e){return"/*# sourceURL=".concat(o.sourceRoot||"").concat(e," */")}));return[n].concat(r).concat([i]).join("\n")}var s,a,c;return[n].join("\n")}(t,e);return t[2]?"@media ".concat(t[2]," {").concat(n,"}"):n})).join("")},t.i=function(e,n,o){"string"==typeof e&&(e=[[null,e,""]]);var i={};if(o)for(var r=0;r<this.length;r++){var s=this[r][0];null!=s&&(i[s]=!0)}for(var a=0;a<e.length;a++){var c=[].concat(e[a]);o&&i[c[0]]||(n&&(c[2]?c[2]="".concat(n," and ").concat(c[2]):c[2]=n),t.push(c))}},t}},function(e,t,n){"use strict";this&&this.__awaiter;Object.defineProperty(t,"__esModule",{value:!0});const o=n(26),i=n(1),r=n(4);n(47),n(48);let s=null,a=!0;e.exports={panels:{ProtoPie:{show:function(e){if(!s){const e=parseInt(i.version);s=new o.ProtoPiePlugIn(e)}a=!1,r.ignore(s.onPlugInStart(e.node))},update:function(e,t){a||s&&r.ignore(s.onSelectionUpdate(e))},hide:function(e){a=!0,s&&s.hide()}}}}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ProtoPiePlugIn=void 0;const i=n(27),r=n(29),s=n(1),a=n(32),c=n(42),l=n(43),d=n(22),u=n(14),h=n(15),p=n(4),f=n(44),_=n(3),v=n(45);n(46);t.ProtoPiePlugIn=class{constructor(e){this._imgExporter=null,this._isConnected=!1,this._isExporting=!1,this._validSelection=!1,this._pieModel=0,this._event=new f.EventEmitter,this._xdVersion=e,this._panelView=new r.PanelView(this._event),this._dialogView=new c.DialogView(this._event),this._event.on("dialog_close",this._onDialogClose.bind(this)),this._event.on("single_node_convert_complete",this._onSingleNodeConvertComplete.bind(this)),this._exportSocketClient=new i.ExportSocketClient(this._event),this._event.on("socket_connect",this._onSocketConnect.bind(this)),this._event.on("socket_disconnect",this._onSocketDisconnect.bind(this)),this._event.on("export_button_click",this.onExportButtonClick.bind(this)),this._event.on("connection_button_click",this._connectProtoPie.bind(this))}onPlugInStart(e){return o(this,void 0,void 0,(function*(){try{const t=yield d.storage.localFileSystem.getTemporaryFolder();this._imgExporter=new l.ImageExporter(t,this._event),this._panelView.render(e),u.validateXDVersion(this._xdVersion),this._isConnected||this._connectProtoPie()}catch(e){if(e instanceof h.XDVersionError)return void this._panelView.showError(e.message);this._panelView.showError("Unknown error occurred, please restart PlugIn")}}))}onSelectionUpdate(e){return o(this,void 0,void 0,(function*(){if(!this._isExporting)try{if(this._validSelection=!1,this._panelView.initSelection(),0===e.items.length)return;const[t,n,o]=u.validateSelection(e);this._panelView.updateSelection(n,o),this._validSelection=!0,p.ignore(this._imgExporter.captureThumbnails(t,o))}catch(e){if(e instanceof h.XDSelectionError)return void this._panelView.showError(e.message);this._validSelection=!1,this._panelView.showError("Unknown error occurred, please restart PlugIn")}}))}hide(){this._exportSocketClient.clearInterval()}_export(e,t){return o(this,void 0,void 0,(function*(){return new Promise((n,i)=>o(this,void 0,void 0,(function*(){if(!this._imgExporter)throw new Error;const{dataCollector:o}=t,r=()=>{t.canceled=!0,this._event.removeListener("export_cancel",r)};this._event.on("export_cancel",r);const[s,c,l]=u.validateSelection(e);if(p.ignore(this._dialogView.onExportStart(c,l)),o.collectSelectionInfo(l),t.canceled)return i(new h.ExportCanceled);const d=yield this._exportSocketClient.startToExport(c);if(this._imgExporter.setImageScale(d),t.canceled)return i(new h.ExportCanceled);const f=yield a.Converter.convert(s,this._xdVersion,this._pieModel,this._imgExporter,this._event,t);if(t.canceled)return i(new h.ExportCanceled);yield this._exportSocketClient.exportLayers(f,o,s.map(e=>e.guid),d),this._event.removeListener("export_cancel",r),n()})))}))}onExportButtonClick(){this._validSelection&&!this._isExporting&&this._isConnected&&s.editDocument({editLabel:"Export to ProtoPie"},e=>o(this,void 0,void 0,(function*(){const t={selectedNodes:[...e.items],dataCollector:new v.DataCollector,canceled:!1};try{this._isExporting=!0,this._dialogView.init(),yield this._export(e,t)}catch(e){if(e instanceof h.ExportCanceled)return;if(e instanceof h.XDSelectionError)return void this._panelView.showError(e.message);console.log("export error",e),p.ignore(this._dialogView.onExportError())}finally{this._onExportEnd(e,t)}})))}_onExportEnd(e,t){e.items=t.selectedNodes,this._isExporting=!1,this._dialogView.close()}_onDialogClose(){this._isExporting&&(this._event.emit("export_cancel"),this._isExporting=!1)}_connectProtoPie(){this._isConnected||(this._panelView.onSocketDisconnect(),this._panelView.onSocketConnecting(),this._exportSocketClient.pConnect())}_onSingleNodeConvertComplete(e,t){const n=Math.round(_.MIN_EXPORT_PROGRESS_VALUE+e/t*_.MAX__EXPORT_PROGRESS_VALUE);this._event.emit("progress_update",n)}_onSocketDisconnect(){this._isConnected=!1,this._panelView.onSocketDisconnect(),this._isExporting&&(this._event.emit("export_cancel"),this._isExporting=!1)}_onSocketConnect(e){this._isConnected=!0,this._panelView.onSocketConnect(),this._pieModel=e}}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ExportSocketClient=void 0;const i=n(4),r=n(3),s=n(14);var a,c,l;!function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"}(a||(a={})),function(e){e.HELLO_PROTOPIE="HELLO_PROTOPIE",e.IMPORT_DATA="EXPORT_LAYER",e.IMPORT_REQUEST="IMPORT_REQUEST",e.IMPORT_CANCEL="IMPORT_CANCEL",e.UPDATE_PROGRESS="UPDATE_PROGRESS",e.SHOW_PROTOPIE="SHOW_PROTOPIE"}(c||(c={})),function(e){e.PROTOPIE_READY="PROTOPIE_READY",e.READY_TO_IMPORT="READY_TO_IMPORT",e.IMPORT_CANCELED="IMPORT_CANCELED",e.UPDATE_PROGRESS="UPDATE_PROGRESS",e.IMPORT_COMPLETE="IMPORT_COMPLETE"}(l||(l={}));class d extends Error{constructor(e,t){super(e),this.rootCause=t}}t.ExportSocketClient=class{constructor(e){this._connectionInterval=null,this._event=e,this._event.on("progress_update",this.updateProgress.bind(this)),this._event.on("export_cancel",this._onCancel.bind(this))}pConnect(){this.clearInterval();let e=0;this._connectionInterval=setInterval(()=>o(this,void 0,void 0,(function*(){e++;(yield this.connect())&&this.clearInterval(),e>4&&(this.clearInterval(),this._event.emit("socket_disconnect"))})),1e3)}clearInterval(){this._connectionInterval&&clearInterval(this._connectionInterval),this._connectionInterval=null}connect(){return o(this,void 0,void 0,(function*(){console.debug("try connect");try{const[e,t]=yield this.createConnection();return this._socket=e,console.debug("protopie_connected",this._socket.url),this._event.emit("socket_connect",t.importVersion),this._socket.onclose=this._onClose.bind(this),this._socket.onerror=this._onError.bind(this),this._socket.addEventListener("message",this._onMessage.bind(this)),!0}catch(e){console.error(e)}return!1}))}createConnection(){return o(this,void 0,void 0,(function*(){for(let e=0;e<10;e++)try{const[t,n]=yield this._createConnectionTry(10982+e);if(s.validateStudioVersion(n.studioVersion))return[t,n]}catch(e){}throw Error("Fail to connect Protopie")}))}_createConnectionTry(e){const t=i.defer(),n=new WebSocket("ws://localhost:"+e),o=setTimeout(()=>{t.reject(new d("Websocket timeout port = "+e))},2e3);n.onopen=e=>{const t={message:c.HELLO_PROTOPIE};n.send(JSON.stringify(t))},n.onerror=e=>{t.reject(new d("Websocket Error",e))},n.onclose=e=>{t.reject(new d("Websocket Close",e))};const r=e=>{try{const i=JSON.parse(e.data);i.message===l.PROTOPIE_READY&&(clearTimeout(o),n.removeEventListener("message",r),t.resolve([n,i]))}catch(n){console.error(n),t.reject(new d("Websocket wrong response",e))}};return n.addEventListener("message",r),t.promise}_onMessage(e){try{const t=JSON.parse(e.data);t.message===l.IMPORT_CANCELED?this._event.emit("export_cancel"):t.message===l.UPDATE_PROGRESS&&this._event.emit("progress_update",t.data)}catch(e){console.debug("Unexpected Message")}}_onClose(){console.debug("Socket Close"),this._event.emit("socket_disconnect"),this.pConnect()}_onError(){console.error("Socket Error"),this._event.emit("socket_disconnect"),this.pConnect()}_onCancel(){console.log("Import canceled");const e={message:c.IMPORT_CANCEL};this._socket.send(JSON.stringify(e))}startToExport(e){return o(this,void 0,void 0,(function*(){const t=i.defer(),n={message:c.IMPORT_REQUEST,data:Object.assign(Object.assign({},e),{platform:r.ImportSource.XD})};if(this._socket.readyState!==a.open)return!1;const o=e=>{const n=JSON.parse(e.data),i=setTimeout(()=>{t.reject(new d("Request TimeOut Error"))},6e4);n.message===l.READY_TO_IMPORT&&(clearTimeout(i),this._socket.removeEventListener("message",o),t.resolve(n.imageScale),this.showProtoPieOnTop())};return this._socket.addEventListener("message",o),this._socket.send(JSON.stringify(n)),t.promise}))}updateProgress(e){const t={message:c.UPDATE_PROGRESS,data:e};this._socket.readyState===a.open&&this._socket.send(JSON.stringify(t))}exportLayers(e,t,n,o){const i={imageScale:o,version:1,data:e,exportTool:r.ImportSource.XD,selectionIds:n,additionalInfo:t.toJson()},s={message:c.IMPORT_DATA,data:i};return this._socket.readyState===a.open?new Promise(e=>{const t=n=>{JSON.parse(n.data).message===l.IMPORT_COMPLETE&&(console.debug("Export complete",(new Date).toISOString()),this._event.emit("progress_update",100),this._socket.removeEventListener("message",t),e())};this._socket.addEventListener("message",t),this._socket.send(JSON.stringify(s))}):null}showProtoPieOnTop(){const e={message:c.SHOW_PROTOPIE};this._socket.readyState===a.open&&this._socket.send(JSON.stringify(e))}}},function(e,t){e.exports=require("commands")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PanelView=void 0;const o=n(16);n(30),n(31);const i='<span class="text">Select artboards or layers to export.</span>',r='<span class="text">Open ProtoPie and connect.<br/>(ProtoPie 5.3 or higher)</span>',s=`\n <div class="panel__header">\n <div class="panel__message panel__message--connection">\n ${r}\n </div>\n\n <div class="panel__message panel__message--selection hide">\n ${i}\n </div>\n\n <div class="panel__btn panel__btn--connection hide">\n <span>Connect to ProtoPie</span>\n </div>\n\n <div class="panel__btn panel__btn--export panel__btn--disabled">\n <span>Export</span>\n </div>\n \n <div class="panel__btn panel__btn--spinner">\n <img style="width: 16px; height: 16px;" src="images/spinner_button.gif" alt="spinner"/>\n </div>\n </div>\n <div class="panel--hr"></div>\n <div class="panel__thumbnailContainer hide">\n </div>\n`;t.PanelView=class{constructor(e){this._connectionMessage=null,this._selectionMessage=null,this._thumbnailContainer=null,this._exportButton=null,this._connectionButton=null,this._spinnerButton=null,this._event=e,this._panel=document.createElement("div"),this._panel.className="panel",this._panel.innerHTML=s,this._event.on("thumbnail_update",this._onThumbnailUpdate.bind(this))}render(e){e.appendChild(this._panel),this._exportButton=this._panel.querySelector(".panel__btn--export"),this._exportButton.onclick=()=>{this._event.emit("export_button_click")},this._connectionButton=this._panel.querySelector(".panel__btn--connection"),this._connectionButton.onclick=()=>{this._event.emit("connection_button_click")},this._spinnerButton=this._panel.querySelector(".panel__btn--spinner"),this._selectionMessage=this._panel.querySelector(".panel__message--selection"),this._connectionMessage=this._panel.querySelector(".panel__message--connection"),this._thumbnailContainer=this._panel.querySelector(".panel__thumbnailContainer")}_renderArtboardSelection(e){o.setHtml(this._selectionMessage,`<span class="text">Export as <span class="text text--point">${e} scene${e>1?"s":""}</span> to ProtoPie.</span>`)}_renderObjectSelection(e){o.setHtml(this._selectionMessage,`<span class="text">Export <span class="text text--point">${e} object${e>1?"s":""}</span> to ProtoPie.</span>`)}initSelection(){this.disableButton(),this._initThumbnail(),o.setHtml(this._selectionMessage,i)}updateSelection(e,t){"artboard"===t&&(this._renderArtboardSelection(e.sceneCount),this._prepareThumbnail(t,e.sceneCount)),"object"===t&&(this._renderObjectSelection(e.nodeCount),this._prepareThumbnail(t,e.nodeCount)),this.enableButton()}showError(e){o.setHtml(this._selectionMessage,`<span class="text text--error">${e}</span>`)}_initThumbnail(){this._thumbnailContainer.innerHTML=""}_prepareThumbnail(e,t){this._thumbnailContainer.innerHTML=Array.from(new Array(t)).map(()=>`\n <div <div style='background-image: url("images/spinner_thumbnail.gif")' class="panel__thumbnail panel__thumbnail--spinner ${"artboard"===e?"panel__thumbnail--artboard":"panel__thumbnail--object"}"></div>\n `).join("")}_onThumbnailUpdate(e,t){this._thumbnailContainer.innerHTML=e.map(e=>`\n <div style="background-image: ${"url('"+e.replace(/(\r\n|\n|\r)/gm,"")+"')"}" class="panel__thumbnail ${"artboard"===t?"panel__thumbnail--artboard":"panel__thumbnail--object"}"></div>\n `).join("")}enableButton(){o.removeClass(this._exportButton,"panel__btn--disabled")}disableButton(){o.addClass(this._exportButton,"panel__btn--disabled")}_spinningButton(){o.addClass(this._connectionButton,"hide"),o.addClass(this._exportButton,"hide"),o.removeClass(this._spinnerButton,"hide")}switchToConnection(){o.removeClass(this._connectionMessage,"hide"),o.removeClass(this._connectionButton,"hide"),o.addClass(this._spinnerButton,"hide"),o.addClass(this._exportButton,"hide"),o.addClass(this._selectionMessage,"hide"),o.addClass(this._thumbnailContainer,"hide"),o.setHtml(this._connectionMessage,r)}switchToSelection(){o.addClass(this._connectionMessage,"hide"),o.addClass(this._connectionButton,"hide"),o.addClass(this._spinnerButton,"hide"),o.removeClass(this._selectionMessage,"hide"),o.removeClass(this._exportButton,"hide"),o.removeClass(this._thumbnailContainer,"hide")}onSocketDisconnect(){this.switchToConnection(),o.removeClass(this._connectionButton,"panel__btn--disabled")}onSocketConnecting(){o.setHtml(this._connectionMessage,'<span class="text">Looking for ProtoPie...<br/>(Required 5.3 or above)</span>'),this._spinningButton()}onSocketConnect(){this.switchToSelection()}}},function(e,t,n){"use strict";n.r(t),t.default=n.p+"images/spinner_button.gif"},function(e,t,n){"use strict";n.r(t),t.default=n.p+"images/spinner_thumbnail.gif"},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Converter=void 0;const i=n(33),r=n(41);t.Converter=class{static convert(e,t,n,s,a,c){return o(this,void 0,void 0,(function*(){const n=r.XDNodeConverter.convert(e,t);return yield i.Version1Converter.convert(n,s,a,c)}))}}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.Version1Converter=void 0;const i=n(34),r=n(35),s=n(36),a=n(37),c=n(17),l=n(38),d=n(2),u=n(18),h=n(39),p=n(19),f=n(11),_=n(20),v=n(21),g=n(12),b=n(40),y=n(4);const m=(e,t)=>o(void 0,void 0,void 0,(function*(){return e instanceof _.XDArtboardNode?l.SceneConverter.convert(e):e instanceof p.XDScrollGroupNode?yield h.ScrollContainerLayerConverter.convert(e):e instanceof f.XDGroupNode?yield c.ContainerLayerConverter.convert(e):e.isMaskNode?yield a.ShapeLayerConverter.convert(e,t):function(e){return e instanceof d.XDGraphicNode&&(e.hasActiveImageFill||e.hasActiveObjectBlur)}(e)?yield r.ImageLayerConverter.convert(e,t):e instanceof g.XDTextNode?yield b.TextLayerConverter.convert(e,t):e instanceof v.XDEllipseNode?yield s.OvalLayerConverter.convert(e,t):e instanceof u.XDRectangleNode?yield i.RectLayerConverter.convert(e,t):yield a.ShapeLayerConverter.convert(e,t)}));t.Version1Converter=class{static convert(e,t,n,i){return o(this,void 0,void 0,(function*(){const o=[];for(const[r,s]of e.entries()){if(i.canceled)return[];try{i.dataCollector.collectAdditionalInfo(s);const a=y.round2AllNumKeyInObject(yield m(s,t));o.push(a),n.emit("single_node_convert_complete",r,e.length)}catch(e){console.log(e,s.name,s.type)}}return o}))}}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.RectLayerConverter=void 0;const i=n(10);class r extends i.VectorLayerConverter{static convert(e,t){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){return Object.assign(Object.assign({},yield n.convert.call(this,e,t)),{radius:this.convertCornerRadii(e.cornerRadii),type:"RECT"})}))}static convertCornerRadii(e){return e.topLeft}}t.RectLayerConverter=r},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ImageLayerConverter=void 0;const i=n(8),r=n(1),s=n(6),a=n(5);class c extends i.LayerConverter{static convert(e,t){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){const o=s.default.createAdjustedShadow(e.shadow,e.absoluteRotation),{image:i,isCorrectImage:c}=yield s.default.getImage(e,o,t,r.RenditionType.PNG),l=yield n.convert.call(this,e,t);if(!c)return Object.assign(Object.assign({},l),{rotation:0,opacity:100,img:i,type:"IMAGE"});const d=a.default.calcGraphicEffectBoundsOffset(e,o);return Object.assign(Object.assign(Object.assign({},l),a.default.calcAdjustedAnchorValue(e.adjustedBounds.width,e.adjustedBounds.height,0===e.rotation?0:50,0===e.rotation?0:50,d)),{img:i,type:"IMAGE"})}))}}t.ImageLayerConverter=c},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.OvalLayerConverter=void 0;const i=n(10);class r extends i.VectorLayerConverter{static convert(e,t){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){return Object.assign(Object.assign({},yield n.convert.call(this,e,t)),{type:"OVAL"})}))}}t.OvalLayerConverter=r},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ShapeLayerConverter=void 0;const i=n(10);class r extends i.VectorLayerConverter{static convert(e,t){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){return e.isMaskNode?Object.assign(Object.assign({},yield n.convert.call(this,e,t)),{type:"SHAPE",isMask:!0,opacity:0}):Object.assign(Object.assign({},yield n.convert.call(this,e,t)),{type:"SHAPE"})}))}}t.ShapeLayerConverter=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SceneConverter=void 0;const o=n(0),i=n(6);t.SceneConverter=class{static convert(e){return Object.assign(Object.assign({id:e.id,type:"ARTBOARD",name:e.name},this.convertFill(e)),{childrenIDs:e.childrenIds})}static convertFill(e){if(e.fill instanceof o.Color&&e.fillEnabled){const{opacity:t,hex:n}=i.default.convertColorToHexAndAlpha(e.fill);return{fillOpacity:t,fillColor:n}}return{}}}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ScrollContainerLayerConverter=void 0;const i=n(17),r=n(0);class s extends i.ContainerLayerConverter{static convert(e,t=null){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){return Object.assign(Object.assign({},yield n.convert.call(this,e,t)),{clipChildren:!0,scrollOffset:e.scrollOffset,scrollType:"SCROLL",scrollDirection:e.scrollingType===r.ScrollableGroup.HORIZONTAL?"HORIZONTAL":"VERTICAL"})}))}}t.ScrollContainerLayerConverter=s},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerConverter=void 0;const i=n(0),r=n(6),s=n(1),a=n(8),c=n(5);class l extends a.LayerConverter{static convert(e,t){const n=Object.create(null,{convert:{get:()=>super.convert}});return o(this,void 0,void 0,(function*(){const o=yield n.convert.call(this,e,t),i=r.default.createAdjustedShadow(e.shadow,e.absoluteRotation),{image:a,isCorrectImage:l}=yield r.default.getImage(e,i,t,s.RenditionType.PNG),d=r.default.convertGraphicEffects(e,i);if(!l)return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),{opacity:100,rotation:0}),d),{img:a,type:"TEXT",text:e.text}),this.convertTextColor(e.fill)),this.convertTextLineSpacing(e.lineSpacing,e.fontSize)),{letterSpacing:this.convertTextCharacterSpacing(e.charSpacing),textAlign:this.convertTextAlign(e.textAlign),verticalAlign:"TOP",fontSize:e.fontSize,fontStyle:e.fontStyle,fontFamily:e.fontFamily,sizeMode:this.convertTextType(e.textType)});const u=c.default.calcGraphicEffectBoundsOffset(e,i);return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},o),c.default.calcAdjustedAnchorValue(e.adjustedBounds.width,e.adjustedBounds.height,0===e.rotation?0:50,0===e.rotation?0:50,u)),d),{img:a,type:"TEXT",text:e.text}),this.convertTextColor(e.fill)),this.convertTextLineSpacing(e.lineSpacing,e.fontSize)),{letterSpacing:this.convertTextCharacterSpacing(e.charSpacing),textAlign:this.convertTextAlign(e.textAlign),verticalAlign:"TOP",fontSize:e.fontSize,fontStyle:e.fontStyle,fontFamily:e.fontFamily,sizeMode:this.convertTextType(e.textType)})}))}static convertTextLineSpacing(e,t){return 0===e?{lineHeight:1.2,autoLineHeight:!0}:{lineHeight:Math.round(e/t*100)/100,autoLineHeight:!1}}static convertTextCharacterSpacing(e){return e/10}static convertTextType(e){switch(e){case"AUTO_WIDTH":return"AUTO_WIDTH";case"FIXED_SIZE":return"FIXED_SIZE";case i.Text.POINT:return"AUTO_WIDTH";case i.Text.FIXED_HEIGHT:return"FIXED_SIZE";case i.Text.AUTO_HEIGHT:return"AUTO_HEIGHT";default:return"FIXED_SIZE"}}static convertTextAlign(e){switch(e){case i.Text.ALIGN_CENTER:return"CENTER";case i.Text.ALIGN_RIGHT:return"RIGHT";case i.Text.ALIGN_LEFT:default:return"LEFT"}}static convertTextColor(e){if(!e)return{};const{opacity:t,hex:n}=r.default.convertColorToHexAndAlpha(e);return{textOpacity:t,textColor:n}}}t.TextLayerConverter=l},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isRectangleNode=t.isTextNode=t.isScrollableGroupNode=t.isArtboardNode=t.isGraphicNode=t.isGroupNode=t.convertToXDNode=t.XDNodeConverter=void 0;const o=n(18),i=n(2),r=n(9),s=n(19),a=n(11),c=n(0),l=n(20),d=n(21),u=n(12);function h(e,t){return e instanceof c.Artboard?new l.XDArtboardNode(e,t):_(e)?new s.XDScrollGroupNode(e,t):p(e)?new a.XDGroupNode(e,t):v(e)?new u.XDTextNode(e,t):g(e)?new o.XDRectangleNode(e,t):e instanceof c.Ellipse?new d.XDEllipseNode(e,t):f(e)?new i.XDGraphicNode(e,t):new r.XDSceneNode(e,t)}function p(e){return e instanceof c.Group||e instanceof c.RepeatGrid||e instanceof c.SymbolInstance}function f(e){return e instanceof c.GraphicNode}function _(e){return e instanceof c.ScrollableGroup}function v(e){return e instanceof c.Text}function g(e){return e instanceof c.Rectangle}t.XDNodeConverter=class{static convert(e,t){const n=[],o=e=>{const i=h(e,t);if(n.push(i),!(e instanceof c.BooleanGroup)){if(i instanceof a.XDGroupNode&&i.isMaskGroup){const t=e.children.at(e.children.length-1);return o(t),void e.children.forEach((t,n)=>{n!==e.children.length-1&&o(t)})}e.children.length&&e.children.forEach(o)}};return e.forEach(o),n}},t.convertToXDNode=h,t.isGroupNode=p,t.isGraphicNode=f,t.isArtboardNode=function(e){return e instanceof c.Artboard},t.isScrollableGroupNode=_,t.isTextNode=v,t.isRectangleNode=g},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.DialogView=void 0;const i=n(16);t.DialogView=class{constructor(e){this._dialog=null,this._dialogMessage=null,this._dialogButton=null,this._progressValue=null,this._progressBar=null,this._isOpen=!1,this._event=e,this._event.on("progress_update",this._onProgressUpdate.bind(this)),this.init()}init(){this._dialog=document.createElement("dialog"),document.body.appendChild(this._dialog),this._dialog.innerHTML='\n <form class="dialog" method="dialog">\n <div class="dialog__header">\n <img src="images/ProtoPie@1x.png" alt="logo"/>\n <h1 class="dialog__title">\n <span>ProtoPie</span>\n </h1>\n </div>\n \n <div class="dialog--hr"></div>\n \n <div class="dialog__contents">\n <div class="dialog__message"></div>\n <span class ="dialog__progressValue text">0%</span>\n </div>\n \n <div class="dialog__error hide">\n <span class="text">An unknown error occurred. <a class="text text--point">Contact us</a> for more information.</span>\n </div>\n \n <div class="dialog__progress">\n <span class="dialog__progressBar"></span>\n </div>\n \n <footer class="dialog--footer">\n <div class="dialog__btn dialog__btn--cancel">\n <span class="text">Cancel</span> \n </div>\n </footer>\n </form>\n',this._dialogMessage=this._dialog.querySelector(".dialog__message"),this._dialogButton=this._dialog.querySelector(".dialog__btn"),this._progressBar=this._dialog.querySelector(".dialog__progressBar"),this._progressValue=this._dialog.querySelector(".dialog__progressValue"),this._initEvent()}_initEvent(){this._dialog.onclose=this._onDialogClose.bind(this),this._dialogButton.onclick=()=>{this.close()}}_open(e){return o(this,void 0,void 0,(function*(){this._dialogMessage.innerHTML=e,this._isOpen||(this._dialog.showModal(),this._isOpen=!0)}))}_openArtboardDialog(e){return o(this,void 0,void 0,(function*(){yield this._open(`<span class="text">Exporting <span class="text--point text--bold"> ${e} artboard${e>1?"s":""}</span> to ProtoPie.</span>`)}))}_openObjectDialog(e){return o(this,void 0,void 0,(function*(){yield this._open(`<span class="text">Exporting <span class="text--point text--bold"> ${e} object${e>1?"s":""}</span> to ProtoPie.</span>`)}))}onExportStart(e,t){return o(this,void 0,void 0,(function*(){this._switchToExport(),this._onProgressUpdate(0),"artboard"===t&&(yield this._openArtboardDialog(e.sceneCount)),"object"===t&&(yield this._openObjectDialog(e.nodeCount))}))}onExportError(){return o(this,void 0,void 0,(function*(){this._switchToError(),this._isOpen||(this._dialog.showModal(),this._isOpen=!0)}))}_switchToExport(){i.addClass(this._dialog.querySelector(".dialog__error"),"hide"),i.removeClass(this._dialog.querySelector(".dialog__progress"),"hide"),i.removeClass(this._dialog.querySelector(".dialog__contents"),"hide"),this._switchButtonState(!1)}_switchToError(){i.removeClass(this._dialog.querySelector(".dialog__error"),"hide"),i.addClass(this._dialog.querySelector(".dialog__progress"),"hide"),i.addClass(this._dialog.querySelector(".dialog__contents"),"hide"),this._switchButtonState(!0)}_switchButtonState(e){if(!e)return i.addClass(this._dialogButton,"dialog__btn--cancel"),i.removeClass(this._dialogButton,"dialog__btn--ok"),void(this._dialogButton.innerHTML='<span class="text">Cancel</span>');i.removeClass(this._dialogButton,"dialog__btn--cancel"),i.addClass(this._dialogButton,"dialog__btn--ok"),this._dialogButton.innerHTML='<span class="text">OK</span>'}close(){this._dialog.close()}_onProgressUpdate(e){this._progressBar.style.width=e+"%",this._progressValue.textContent=e+"%"}_onDialogClose(e){this._isOpen=!1,this._event.emit("dialog_close")}}},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))((function(i,r){function s(e){try{c(o.next(e))}catch(e){r(e)}}function a(e){try{c(o.throw(e))}catch(e){r(e)}}function c(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((o=o.apply(e,t||[])).next())}))};Object.defineProperty(t,"__esModule",{value:!0}),t.ImageExporter=void 0;const i=n(1),r=n(22),s=n(4);function a(e,t,n,r=3){return o(this,void 0,void 0,(function*(){return t===i.RenditionType.PNG?{node:e,outputFile:n,type:t,scale:r}:{node:e,outputFile:n,type:t,minify:!0,embedImages:!0}}))}function c(e){return o(this,void 0,void 0,(function*(){if(e.type===i.RenditionType.PNG){const t=yield e.outputFile.read({format:r.storage.formats.binary});return s.base64ArrayBuffer(t)}return yield e.outputFile.read()}))}t.ImageExporter=class{constructor(e,t,n=3){this._tempFolder=e,this._scale=n,this._event=t}setImageScale(e){this._scale=e}export(e,t,n=!1){return o(this,void 0,void 0,(function*(){try{const n=yield this._tempFolder.createFile(""+e.guid,{overwrite:!0}),o=yield a(e,t,n,this._scale);return yield i.createRenditions([o]),yield c(o)}catch(o){if(n)throw console.log("Error occurred when export image",e.name),o;return yield this.export(e,t,!0)}}))}captureThumbnails(e,t){return o(this,void 0,void 0,(function*(){const n=yield Promise.all(e.map(e=>o(this,void 0,void 0,(function*(){const n=yield this._tempFolder.createFile("thumb-"+e.guid,{overwrite:!0}),o=function(e,t){switch(t){case"artboard":return 3*Math.min(1,170/e.height,120/e.width);case"object":return 3*Math.min(1,79/e.height,79/e.width)}}(e.localBounds,t);return yield a(e,i.RenditionType.PNG,n,o)}))));yield i.createRenditions(n);const r=yield Promise.all(n.map(e=>o(this,void 0,void 0,(function*(){return"data:image/png;base64,"+(yield c(e))}))));this._event.emit("thumbnail_update",r,t)}))}}},function(e,t,n){"use strict";var o,i="object"==typeof Reflect?Reflect:null,r=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};o=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var s=Number.isNaN||function(e){return e!=e};function a(){a.init.call(this)}e.exports=a,e.exports.once=function(e,t){return new Promise((function(n,o){function i(){void 0!==r&&e.removeListener("error",r),n([].slice.call(arguments))}var r;"error"!==t&&(r=function(n){e.removeListener(t,i),o(n)},e.once("error",r)),e.once(t,i)}))},a.EventEmitter=a,a.prototype._events=void 0,a.prototype._eventsCount=0,a.prototype._maxListeners=void 0;var c=10;function l(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function d(e){return void 0===e._maxListeners?a.defaultMaxListeners:e._maxListeners}function u(e,t,n,o){var i,r,s,a;if(l(n),void 0===(r=e._events)?(r=e._events=Object.create(null),e._eventsCount=0):(void 0!==r.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),r=e._events),s=r[t]),void 0===s)s=r[t]=n,++e._eventsCount;else if("function"==typeof s?s=r[t]=o?[n,s]:[s,n]:o?s.unshift(n):s.push(n),(i=d(e))>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=s.length,a=c,console&&console.warn&&console.warn(a)}return e}function h(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=h.bind(o);return i.listener=n,o.wrapFn=i,i}function f(e,t,n){var o=e._events;if(void 0===o)return[];var i=o[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):v(i,i.length)}function _(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function v(e,t){for(var n=new Array(t),o=0;o<t;++o)n[o]=e[o];return n}Object.defineProperty(a,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");c=e}}),a.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},a.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||s(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},a.prototype.getMaxListeners=function(){return d(this)},a.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var o="error"===e,i=this._events;if(void 0!==i)o=o&&void 0===i.error;else if(!o)return!1;if(o){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var l=c.length,d=v(c,l);for(n=0;n<l;++n)r(d[n],this,t)}return!0},a.prototype.addListener=function(e,t){return u(this,e,t,!1)},a.prototype.on=a.prototype.addListener,a.prototype.prependListener=function(e,t){return u(this,e,t,!0)},a.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},a.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},a.prototype.removeListener=function(e,t){var n,o,i,r,s;if(l(t),void 0===(o=this._events))return this;if(void 0===(n=o[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete o[e],o.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,r=n.length-1;r>=0;r--)if(n[r]===t||n[r].listener===t){s=n[r].listener,i=r;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(o[e]=n[0]),void 0!==o.removeListener&&this.emit("removeListener",e,s||t)}return this},a.prototype.off=a.prototype.removeListener,a.prototype.removeAllListeners=function(e){var t,n,o;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,r=Object.keys(n);for(o=0;o<r.length;++o)"removeListener"!==(i=r[o])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(o=t.length-1;o>=0;o--)this.removeListener(e,t[o]);return this},a.prototype.listeners=function(e){return f(this,e,!0)},a.prototype.rawListeners=function(e){return f(this,e,!1)},a.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):_.call(e,t)},a.prototype.listenerCount=_,a.prototype.eventNames=function(){return this._eventsCount>0?o(this._events):[]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DataCollector=void 0;const o=n(11),i=n(12),r=n(2),s=n(0);t.DataCollector=class{constructor(){this.info={selectionInfo:"NONE",componentCount:0,gradientFill:0,innerShadow:0,backgroundBlur:0,layerBlur:0,multipleFills:0,multipleStroke:0,multipleShadow:0,strokeInText:0,effectInText:0,gradientText:0,mixedStyleText:0}}collectSelectionInfo(e){"artboard"===e&&(this.info.selectionInfo="SCENE"),"object"===e&&(this.info.selectionInfo="OBJECT")}collectAdditionalInfo(e){e instanceof o.XDGroupNode&&e.isSymbolInstance&&this.info.componentCount++,e instanceof i.XDTextNode?(this._textMultiStyleInfo(e),this._blurInfo(e.blur),this._shadowInfo(e.shadow)):e instanceof r.XDGraphicNode&&(this._blurInfo(e.blur),this._shadowInfo(e.shadow),this._fillInfo(e.fill))}toJson(){return this.info}_shadowInfo(e){e&&e.visible&&this.info.innerShadow++}_blurInfo(e){e&&e.visible&&(e.isBackgroundEffect?this.info.backgroundBlur++:this.info.layerBlur++)}_fillInfo(e){(e instanceof s.LinearGradient||e instanceof s.RadialGradient)&&this.info.gradientFill}_textMultiStyleInfo(e){e.styleRanges.length>1&&this.info.mixedStyleText++}}},function(e,t,n){"use strict";n.r(t);var o=n(23),i=n.n(o),r=n(13),s={insert:"head",singleton:!1};i()(r.a,s);t.default=r.a.locals||{}},function(e,t,n){"use strict";n.r(t),t.default=n.p+"images/ProtoPie@1x.png"},function(e,t,n){"use strict";n.r(t),t.default=n.p+"images/ProtoPie@2x.png"}]);