@chili-publish/studio-sdk 1.36.0 → 1.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/_bundles/main.es.js +89 -85
- package/_bundles/main.es.js.map +1 -1
- package/_bundles/main.js +2 -2
- package/_bundles/main.js.map +1 -1
- package/lib/editor-engine.json +1 -1
- package/lib/package.json +1 -1
- package/lib/src/controllers/FrameController.d.ts +2 -1
- package/lib/src/controllers/FrameController.js +3 -2
- package/lib/src/controllers/FrameController.js.map +1 -1
- package/lib/src/controllers/VariableController.d.ts +8 -0
- package/lib/src/controllers/VariableController.js +13 -0
- package/lib/src/controllers/VariableController.js.map +1 -1
- package/lib/src/tests/controllers/FrameConstraintController.test.js +18 -5
- package/lib/src/tests/controllers/FrameConstraintController.test.js.map +1 -1
- package/lib/src/tests/controllers/VariableController.test.js +7 -0
- package/lib/src/tests/controllers/VariableController.test.js.map +1 -1
- package/lib/src/types/ConfigurationTypes.d.ts +2 -0
- package/lib/src/types/ConfigurationTypes.js +1 -0
- package/lib/src/types/ConfigurationTypes.js.map +1 -1
- package/lib/src/types/FrameTypes.d.ts +4 -0
- package/lib/src/types/VariableTypes.d.ts +1 -0
- package/lib/src/types/VariableTypes.js.map +1 -1
- package/package.json +1 -1
package/_bundles/main.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(h,O){typeof exports=="object"&&typeof module<"u"?O(exports):typeof define=="function"&&define.amd?define(["exports"],O):(h=typeof globalThis<"u"?globalThis:h||self,O(h.StudioSDK=h.StudioSDK||{}))})(this,function(h){"use strict";var $r=h=>{throw TypeError(h)};var zr=(h,O,R)=>O.has(h)||$r("Cannot "+R);var a=(h,O,R)=>(zr(h,O,"read from private field"),R?R.call(h):O.get(h)),g=(h,O,R)=>O.has(h)?$r("Cannot add the same private member more than once"):O instanceof WeakSet?O.add(h):O.set(h,R),y=(h,O,R,de)=>(zr(h,O,"write to private field"),de?de.call(h,R):O.set(h,R),R);var V,M,z,N,it,G,ot,Kt,B,J,Dt,wt,Er,mt,ft,ct,$t,ht,zt,lt,St,U,dt,Lt,E,Mt,d,W,f,Wt,X,jt,D,qt,Or,k,bt,Nt,tt,j,Yt,ut,Zt,Rt,Qt,Xt,m,Vt,Tt,Dr,gt,et,vt,Gt,le,yt,Bt,_,It,te,Jt;const R={current:"2.
|
|
1
|
+
(function(h,O){typeof exports=="object"&&typeof module<"u"?O(exports):typeof define=="function"&&define.amd?define(["exports"],O):(h=typeof globalThis<"u"?globalThis:h||self,O(h.StudioSDK=h.StudioSDK||{}))})(this,function(h){"use strict";var $r=h=>{throw TypeError(h)};var zr=(h,O,R)=>O.has(h)||$r("Cannot "+R);var a=(h,O,R)=>(zr(h,O,"read from private field"),R?R.call(h):O.get(h)),g=(h,O,R)=>O.has(h)?$r("Cannot add the same private member more than once"):O instanceof WeakSet?O.add(h):O.set(h,R),y=(h,O,R,de)=>(zr(h,O,"write to private field"),de?de.call(h,R):O.set(h,R),R);var V,M,z,N,it,G,ot,Kt,B,J,Dt,wt,Er,mt,ft,ct,$t,ht,zt,lt,St,U,dt,Lt,E,Mt,d,W,f,Wt,X,jt,D,qt,Or,k,bt,Nt,tt,j,Yt,ut,Zt,Rt,Qt,Xt,m,Vt,Tt,Dr,gt,et,vt,Gt,le,yt,Bt,_,It,te,Jt;const R={current:"2.20.latest"},Pe={version:"1.37.0"};var q;(function(s){s.Call="call",s.Reply="reply",s.Syn="syn",s.SynAck="synAck",s.Ack="ack"})(q||(q={}));var pt;(function(s){s.Fulfilled="fulfilled",s.Rejected="rejected"})(pt||(pt={}));var _t;(function(s){s.ConnectionDestroyed="ConnectionDestroyed",s.ConnectionTimeout="ConnectionTimeout",s.NoIframeSrc="NoIframeSrc"})(_t||(_t={}));var ue;(function(s){s.DataCloneError="DataCloneError"})(ue||(ue={}));var nt;(function(s){s.Message="message"})(nt||(nt={}));const Wr=(s,o)=>{const t=[];let e=!1;return{destroy(r){e||(e=!0,o(`${s}: Destroying connection`),t.forEach(n=>{n(r)}))},onDestroy(r){e?r():t.push(r)}}},jr=s=>(...o)=>{s&&console.log("[Penpal]",...o)},qr={"http:":"80","https:":"443"},Yr=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,Zr=["file:","data:"],Qr=s=>{if(s&&Zr.find(l=>s.startsWith(l)))return"null";const o=document.location,t=Yr.exec(s);let e,r,n;t?(e=t[1]?t[1]:o.protocol,r=t[2],n=t[4]):(e=o.protocol,r=o.hostname,n=o.port);const c=n&&n!==qr[e]?`:${n}`:"";return`${e}//${r}${c}`},Fe=({name:s,message:o,stack:t})=>({name:s,message:o,stack:t}),Xr=s=>{const o=new Error;return Object.keys(s).forEach(t=>o[t]=s[t]),o},tn=(s,o,t)=>{const{localName:e,local:r,remote:n,originForSending:c,originForReceiving:l}=s;let u=!1;const C=p=>{if(p.source!==n||p.data.penpal!==q.Call)return;if(p.origin!==l){t(`${e} received message from origin ${p.origin} which did not match expected origin ${l}`);return}const I=p.data,{methodName:S,args:v,id:P}=I;t(`${e}: Received ${S}() call`);const A=b=>H=>{if(t(`${e}: Sending ${S}() reply`),u){t(`${e}: Unable to send ${S}() reply due to destroyed connection`);return}const L={penpal:q.Reply,id:P,resolution:b,returnValue:H};b===pt.Rejected&&H instanceof Error&&(L.returnValue=Fe(H),L.returnValueIsError=!0);try{n.postMessage(L,c)}catch(F){if(F.name===ue.DataCloneError){const st={penpal:q.Reply,id:P,resolution:pt.Rejected,returnValue:Fe(F),returnValueIsError:!0};n.postMessage(st,c)}throw F}};new Promise(b=>b(o[S].apply(o,v))).then(A(pt.Fulfilled),A(pt.Rejected))};return r.addEventListener(nt.Message,C),()=>{u=!0,r.removeEventListener(nt.Message,C)}};let en=0;const sn=()=>++en,Ee=".",Oe=s=>s?s.split(Ee):[],rn=s=>s.join(Ee),nn=(s,o)=>{const t=Oe(o||"");return t.push(s),rn(t)},an=(s,o,t)=>{const e=Oe(o);return e.reduce((r,n,c)=>(typeof r[n]>"u"&&(r[n]={}),c===e.length-1&&(r[n]=t),r[n]),s),s},De=(s,o)=>{const t={};return Object.keys(s).forEach(e=>{const r=s[e],n=nn(e,o);typeof r=="object"&&Object.assign(t,De(r,n)),typeof r=="function"&&(t[n]=r)}),t},on=s=>{const o={};for(const t in s)an(o,t,s[t]);return o},cn=(s,o,t,e,r)=>{const{localName:n,local:c,remote:l,originForSending:u,originForReceiving:C}=o;let p=!1;r(`${n}: Connecting call sender`);const I=v=>(...P)=>{r(`${n}: Sending ${v}() call`);let A;try{l.closed&&(A=!0)}catch{A=!0}if(A&&e(),p){const b=new Error(`Unable to send ${v}() call due to destroyed connection`);throw b.code=_t.ConnectionDestroyed,b}return new Promise((b,H)=>{const L=sn(),F=rt=>{if(rt.source!==l||rt.data.penpal!==q.Reply||rt.data.id!==L)return;if(rt.origin!==C){r(`${n} received message from origin ${rt.origin} which did not match expected origin ${C}`);return}const Ut=rt.data;r(`${n}: Received ${v}() reply`),c.removeEventListener(nt.Message,F);let kt=Ut.returnValue;Ut.returnValueIsError&&(kt=Xr(kt)),(Ut.resolution===pt.Fulfilled?b:H)(kt)};c.addEventListener(nt.Message,F);const st={penpal:q.Call,id:L,methodName:v,args:P};l.postMessage(st,u)})},S=t.reduce((v,P)=>(v[P]=I(P),v),{});return Object.assign(s,on(S)),()=>{p=!0}},hn=(s,o,t,e,r)=>{const{destroy:n,onDestroy:c}=e;let l,u;const C={};return p=>{if(p.origin!==o){r(`Parent: Handshake - Received ACK message from origin ${p.origin} which did not match expected origin ${o}`);return}r("Parent: Handshake - Received ACK");const I={localName:"Parent",local:window,remote:p.source,originForSending:t,originForReceiving:o};l&&l(),l=tn(I,s,r),c(l),u&&u.forEach(v=>{delete C[v]}),u=p.data.methodNames;const S=cn(C,I,u,n,r);return c(S),C}},ln=(s,o,t,e)=>r=>{if(r.origin!==t){s(`Parent: Handshake - Received SYN message from origin ${r.origin} which did not match expected origin ${t}`);return}s("Parent: Handshake - Received SYN, responding with SYN-ACK");const n={penpal:q.SynAck,methodNames:Object.keys(o)};r.source.postMessage(n,e)},dn=6e4,un=(s,o)=>{const{destroy:t,onDestroy:e}=o,r=setInterval(()=>{s.isConnected||(clearInterval(r),t())},dn);e(()=>{clearInterval(r)})},gn=(s,o)=>{let t;return s!==void 0&&(t=window.setTimeout(()=>{const e=new Error(`Connection timed out after ${s}ms`);e.code=_t.ConnectionTimeout,o(e)},s)),()=>{clearTimeout(t)}},yn=s=>{if(!s.src&&!s.srcdoc){const o=new Error("Iframe must have src or srcdoc property defined.");throw o.code=_t.NoIframeSrc,o}},pn=s=>{let{iframe:o,methods:t={},childOrigin:e,timeout:r,debug:n=!1}=s;const c=jr(n),l=Wr("Parent",c),{onDestroy:u,destroy:C}=l;e||(yn(o),e=Qr(o.src));const p=e==="null"?"*":e,I=De(t),S=ln(c,I,e,p),v=hn(I,e,p,l,c);return{promise:new Promise((A,b)=>{const H=gn(r,C),L=F=>{if(!(F.source!==o.contentWindow||!F.data)){if(F.data.penpal===q.Syn){S(F);return}if(F.data.penpal===q.Ack){const st=v(F);st&&(H(),A(st));return}}};window.addEventListener(nt.Message,L),c("Parent: Awaiting handshake"),un(o,l),u(F=>{window.removeEventListener(nt.Message,L),F&&b(F)})}),destroy(){C()}}},Cn=s=>{const o=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w]+\/$/);let t="";return o.test(s)?t=s:s.indexOf("/index.html")>-1?t=s.replace("/index.html","/"):s.charAt(-1)!=="/"&&(t=`${s}/`),t},wn=(s,o,t)=>{const e=Cn(o),n=`<html>
|
|
2
2
|
<head>
|
|
3
3
|
<base href="/" />
|
|
4
4
|
<meta charset="UTF-8"/>
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
}
|
|
66
66
|
<\/script>
|
|
67
67
|
</body>
|
|
68
|
-
</html>`;s.srcdoc=n};let se=null;const mn=(s,o,t,e="chili-editor",r,n)=>{se&&window.removeEventListener("message",se);const c=`#${e}`,l=document.createElement("iframe");l.setAttribute("srcdoc"," "),l.setAttribute("title","Chili-Editor"),l.setAttribute("style","width: 100%; height: 100%;"),l.setAttribute("frameBorder","0"),l.setAttribute("referrerpolicy","origin");const u=()=>{const C=document.querySelector(c);if(C){C==null||C.appendChild(l),l.addEventListener("error",()=>{const p=new Error("Failed to setup frame: iframe failed to load");n==null||n(p)},{capture:!0,once:!0});try{wn(l,s,r)}catch(p){p instanceof Error?n==null||n(p):n==null||n(new Error(`Failed to setup frame: ${p}`))}}};document.readyState==="complete"||document.readyState==="interactive"?u():document.addEventListener("DOMContentLoaded",()=>{u()}),se=C=>{var p;if(C.source===l.contentWindow&&((p=C.data)==null?void 0:p.type)==="iframe-error"){const I=C.data.error,S=new Error(I.message||"Failed to setup frame: error in iframe");n==null||n(S)}},window.addEventListener("message",se),t(pn({iframe:l,methods:{actionsChanged:o.onActionsChanged,stateChanged:o.onStateChanged,documentLoaded:o.onDocumentLoaded,authExpired:o.onAuthExpired,viewportRequested:o.onViewportRequested,selectedFramesContent:o.onSelectedFramesContentChanged,selectedFramesLayout:o.onSelectedFramesLayoutChanged,allFramesLayout:o.onFramesLayoutChanged,selectedLayoutProperties:o.onSelectedLayoutPropertiesChanged,openLayoutPropertiesPanel:o.onPageSelectionChanged,selectedLayoutUnit:o.onSelectedLayoutUnitChanged,scrubberPositionChanged:o.onScrubberPositionChanged,frameAnimationsChanged:o.onFrameAnimationsChanged,selectedToolChanged:o.onSelectedToolChanged,variableListChanged:o.onVariableListChanged,undoStackStateChanged:o.onUndoStateChanged,selectedLayoutFramesChanged:o.onSelectedLayoutFramesChanged,selectedTextStyleChanged:o.onSelectedTextStyleChanged,colorsChanged:o.onColorsChanged,paragraphStylesChanged:o.onParagraphStylesChanged,characterStylesChanged:o.onCharacterStylesChanged,fontFamiliesChanged:o.onFontFamiliesChanged,selectedLayoutId:o.onSelectedLayoutIdChanged,layoutListChanged:o.onLayoutsChanged,connectorEvent:o.onConnectorEvent,connectorsChanged:o.onConnectorsChanged,zoomChanged:o.onZoomChanged,pageSnapshotInvalidated:o.onPageSnapshotInvalidated,pagesChanged:o.onPagesChanged,pageSizeChanged:o.onPageSizeChanged,shapeCornerRadiusChanged:o.onShapeCornerRadiusChanged,cropActiveFrameIdChanged:o.onCropActiveFrameIdChanged,asyncError:o.onAsyncError,viewModeChanged:o.onViewModeChanged,barcodeValidationChanged:o.onBarcodeValidationChanged,selectedPageIdChanged:o.onSelectedPageIdChanged,dataSourceIdChanged:o.onDataSourceIdChanged,documentIssueListChanged:o.onDocumentIssueListChanged,customUndoDataChanged:o.onCustomUndoDataChanged,engineEditingModeChanged:o.onEngineEditModeChanged,brandKitMediaChanged:o.onBrandKitMediaChanged}}))};var Y=(s=>(s.GraFxStudioEnvironmentApiUrl="ENVIRONMENT_API",s.GraFxStudioSdkVersion="SDK_VERSION",s.GraFxStudioDocumentType="DOCUMENT_TYPE",s.GraFxStudioTemplateId="TEMPLATE_ID",s.GraFxStudioAuthToken="GRAFX_AUTH_TOKEN",s.QueryCallCacheEnabled="ENABLE_QUERY_CALL_CACHE",s))(Y||{}),Le=(s=>(s.full="full",s.followConstraints="followConstraints",s))(Le||{});const fn={shortcutOptions:{debugPanel:{enabled:!1},ellipse:{enabled:!1},hand:{enabled:!1},image:{enabled:!1},polygon:{enabled:!1},rectangle:{enabled:!1},select:{enabled:!1},text:{enabled:!1},zoom:{enabled:!1},copyPaste:{enabled:!1},viewMode:{enabled:!1}},frameEditingMode:"full"};var Me=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(Me||{}),ge=(s=>(s.project="project",s.template="template",s.component="component",s))(ge||{});const Sn=404075;function ye(s){const o=s.error??"Yikes, something went wrong",t={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===Sn){const r=JSON.parse(s.data).statusCode;throw new Ne(r,o,t)}else throw new Error(o,t)}function i(s,o=!0){try{s.success||ye(s);const t=s.data&&o;return{...s,parsedData:t?JSON.parse(s.data):s.data}}catch(t){throw console.error(t),t}}class Ne extends Error{constructor(o,t,e){super(t,e),this.statusCode=o}}class Re{constructor(o){g(this,V);this.getAll=async()=>(await a(this,V)).getActions().then(e=>i(e)),this.getById=async t=>(await a(this,V)).getActionById(t).then(r=>i(r)),this.create=async()=>(await a(this,V)).createAction().then(e=>i(e)),this.duplicate=async t=>(await a(this,V)).duplicateAction(t).then(r=>i(r)),this.remove=async t=>(await a(this,V)).removeAction(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,V)).updateAction(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>this.update(t,{name:e}),this.updateScript=async(t,e)=>this.update(t,{script:e}),this.updateTriggers=async(t,e)=>this.update(t,{triggers:e}),this.move=async(t,e)=>(await a(this,V)).moveActions(t,e).then(n=>i(n)),this.setTypeError=async(t,e)=>this.update(t,{hasTypeError:e}),this.disable=async()=>(await a(this,V)).disableActions().then(e=>i(e)),this.enable=async()=>(await a(this,V)).enableActions().then(e=>i(e)),y(this,V,o)}}V=new WeakMap;class Ve{constructor(o){g(this,M);this.getAllOnSelectedLayout=async()=>(await a(this,M)).getAnimationsOnSelectedLayout().then(e=>i(e)),this.getByFrameId=async(t,e)=>(await a(this,M)).getAnimationByFrameId(t,e).then(n=>i(n)),this.getByLayoutId=async t=>(await a(this,M)).getAnimationsByLayoutId(t).then(r=>i(r)),this.setFrameAnimation=async t=>(await a(this,M)).setFrameAnimation(JSON.stringify(t)).then(r=>i({...r,data:JSON.stringify(t)})),this.play=async()=>(await a(this,M)).playAnimation().then(e=>i(e)),this.pause=async()=>(await a(this,M)).pauseAnimation().then(e=>i(e)),this.setScrubberPosition=async t=>(await a(this,M)).setScrubberPosition(t).then(r=>i(r)),this.setDuration=async t=>(await a(this,M)).setAnimationDuration(t).then(r=>i(r)),this.resetFrameAnimation=async t=>(await a(this,M)).resetFrameAnimation(t).then(r=>i(r)),this.reset=async()=>(await a(this,M)).resetAnimation().then(e=>i(e)),y(this,M,o)}}M=new WeakMap;var x=(s=>(s.code39="code39",s.code93="code93",s.code128="code128",s.dataMatrix="dataMatrix",s.ean13="ean13",s.ean8="ean8",s.qr="qr",s.upca="upca",s.upce="upce",s.gs1128="gs1128",s))(x||{}),At=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(At||{}),Ct=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(Ct||{}),Te=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(Te||{}),Ge=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(Ge||{}),Z=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(Z||{}),Be=(s=>(s.top="top",s.child="child",s))(Be||{}),Je=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(Je||{}),Ue=(s=>(s.locked="locked",s.range="range",s.none="none",s))(Ue||{});class ke{constructor(o){g(this,z);this.setBarcodeProperties=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableBackground=async(t,e)=>{const r={enableBackground:e};return this.setBarcodeProperties(t,r)},this.setBackgroundColor=async(t,e)=>{const r={backgroundColor:e};return this.setBarcodeProperties(t,r)},this.setEnableBars=async(t,e)=>{const r={enableBars:e};return this.setBarcodeProperties(t,r)},this.setBarColor=async(t,e)=>{const r={barColor:e};return this.setBarcodeProperties(t,r)},this.setBarcodeSource=async(t,e)=>(await a(this,z)).setBarcodeSource(t,JSON.stringify(e)).then(n=>i(n)),this.removeBarcodeSource=async t=>(await a(this,z)).setBarcodeSource(t,null).then(r=>i(r)),this.setEnableText=async(t,e)=>{const r={enableText:e};return this.setBarcodeProperties(t,r)},this.setBarHeight=async(t,e)=>{const r={barHeight:e};return this.setBarcodeProperties(t,r)},this.setMagnification=async(t,e)=>{const r={magnification:e};return this.setBarcodeProperties(t,r)},this.setQuietZoneValue=async(t,e,r)=>{const n=r?{left:r===Z.left?e:void 0,top:r===Z.top?e:void 0,right:r===Z.right?e:void 0,bottom:r===Z.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:n})).then(l=>i(l))},this.setAreQuietZoneValuesCombined=async(t,e)=>{const r={areQuietZoneValuesCombined:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:r})).then(c=>i(c))},this.setErrorCorrectionLevel=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({errorCorrectionLevel:e})).then(n=>i(n)),this.setCharacterSet=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({characterSet:e})).then(n=>i(n)),this.setDrawLightMarginIndicator=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.setDrawStartStopChars=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.getBarcodeConfigationOptions=t=>{let e=!0,r=!0,n=!0,c,l,u=!1,C=!1,p=!1;switch(t){case x.qr:c=[Ct.iso8859_1,Ct.utf8],l=[At.low,At.medium,At.quartile,At.high];case x.dataMatrix:e=!1,r=!1,n=!1,u=!0;break;case x.ean13:e=!1,C=!0;break;case x.ean8:C=!0;case x.upca:case x.upce:e=!1;break;case x.code128:case x.gs1128:c=[Ct.code128a,Ct.code128b,Ct.code128c];break;case x.code39:p=!0;break}return{allowEnableMagnification:n,allowBarHeight:r,allowQuietZone:!0,allowedCharacterSets:c,allowedErrorCorrectionLevels:l,allowToggleText:e,quietZoneAlwaysCombined:u,allowToggleLightMarginIndicator:C,allowToggleDrawStartAndEndChar:p}},y(this,z,o)}}z=new WeakMap;var K=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(K||{}),Q=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.gray="gray",s.hsl="hsl",s.spot="spot",s.spotCMYK="spotCMYK",s.spotRGB="spotRGB",s.spotHEX="spotHEX",s))(Q||{}),re=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(re||{});const _e=s=>s.type===K.hex,pe=s=>s.type===K.spotHex,bn=s=>s.type===K.spotRgb,vn=s=>s.type===K.spotCmyk,In=s=>bn(s)||vn(s)||pe(s),An=s=>{const o=Pn(s.type);return In(s)?{...pe(s)&&{value:s.displayValue},...!pe(s)&&{...s.displayValue},spotName:s.value,type:o}:{..._e(s)&&{value:s.value},...!_e(s)&&{...s.value},type:o}},He=(s,o,t,e)=>{const{brandKitColorGuid:r,brandKitFontFamilyGuid:n,fontStyleId:c,textStrokeColorGuid:l,textStrokeColorApplied:u,textStrokeWidth:C,...p}=s;return{...Object.keys(p).reduce((S,v)=>({...S,[v]:{value:s[v]}}),{}),...o&&{color:{value:{id:o.id,color:o.color,type:re.brandKit,isApplied:p.fillColorApplied}}},...t&&{strokeColor:{value:{id:t.id,color:t.color,type:re.brandKit,isApplied:u||!1}},strokeColorApplied:{value:u||!1},strokeWidth:{value:C!=null?C.toString():C}},fontKey:{value:e??null}}},Pn=s=>{switch(s){case K.rgb:return Q.rgb;case K.cmyk:return Q.cmyk;case K.hex:return Q.hex;case K.spotRgb:return Q.spotRGB;case K.spotCmyk:return Q.spotCMYK;case K.spotHex:return Q.spotHEX}},ne=(s,o)=>{if(!(s===null||o===void 0))return(s||[]).find(t=>t.id===o)},xe=(s,o,t)=>{var e,r;if(!(s===null||o===void 0||t===void 0))return(r=(e=(s||[]).find(n=>n.id===o))==null?void 0:e.fontStyles.find(n=>n.fontStyleId===t))==null?void 0:r.id};class Ke{constructor(o,t){g(this,N);this.getId=async()=>(await a(this,N)).getBrandKitId().then(r=>i(r)),this.getVersion=async()=>(await a(this,N)).getBrandKitVersion().then(r=>i(r)),this.getName=async()=>(await a(this,N)).getBrandKitName().then(r=>i(r)),this.rename=async e=>(await a(this,N)).renameBrandKit(e).then(n=>i(n)),this.updateIdAndVersion=async(e,r)=>(await a(this,N)).updateBrandKitIdAndVersion(e,r).then(c=>i(c)),this.get=async()=>{const e=await this.getId(),r=await this.getVersion(),n=await this.getName(),c=this.colorStyleController.getAll(),l=this.gradientStyleController.getAll(),u=this.fontController.getFontFamilies(),C=this.characterStyleController.getAll(),p=this.paragraphStyleController.getAll(),I=this.getAllMedia(),[S,v,P,A,b,H]=await Promise.all([c,l,u,p,C,I]),L={id:e.parsedData,brandKit:{id:e.parsedData,name:n.parsedData,lastModifiedDate:r.parsedData,colors:S.parsedData,gradients:v.parsedData,fonts:P.parsedData,paragraphStyles:A.parsedData,characterStyles:b.parsedData,media:H.parsedData}},F={success:!0,data:JSON.stringify(L),parsedData:L,status:200};return i(F)},this.getAllMedia=async()=>(await a(this,N)).getAllBrandKitMedia().then(r=>i(r)),this.addMedia=async(e,r,n)=>(await a(this,N)).addBrandKitMedia(e,r,n).then(l=>i(l)),this.updateMedia=async(e,r,n)=>(await a(this,N)).updateBrandKitMedia(e,r,n).then(l=>i(l)),this.renameMedia=async(e,r)=>(await a(this,N)).renameBrandKitMedia(e,r).then(c=>i(c)),this.removeMedia=async e=>(await a(this,N)).removeBrandKitMedia(e).then(n=>i(n)),this.remove=async()=>{const r=(await this.colorStyleController.getAll()).parsedData||[],c=(await this.gradientStyleController.getAll()).parsedData||[],u=(await this.paragraphStyleController.getAll()).parsedData||[],p=(await this.characterStyleController.getAll()).parsedData||[],S=(await this.fontController.getFontFamilies()).parsedData||[],P=(await this.getAllMedia()).parsedData||[];await this.undoManagerController.record("brandKit.remove",async A=>{for(const b of r)await A.colorStyle.remove(b.id);for(const b of c)await A.gradientStyle.remove(b.id);for(const b of u)await A.paragraphStyle.remove(b.id);for(const b of p)await A.characterStyle.remove(b.id);for(const b of S)await A.font.removeFontFamily(b.id);for(const b of P)await this.removeMedia(b.name)})},this.set=async e=>{let r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:[],gradients:[],fonts:[],paragraphStyles:[],characterStyles:[],media:[]}};return await this.undoManagerController.record("brandKit.set",async n=>{const c=await this.setColors(e,n);await this.setGradients(e,n);const l=await this.setFonts(e,n),{parsedData:u=[]}=await n.colorStyle.getAll(),{parsedData:C=[]}=await n.gradientStyle.getAll(),{parsedData:p}=await n.font.getFontFamilies();await this.setParagraphStyles(e,n,{localColors:u,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setCharacterStyles(e,n,{localColors:u,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setMedia(e);const{parsedData:I}=await n.paragraphStyle.getAll(),{parsedData:S}=await n.characterStyle.getAll(),{parsedData:v}=await this.getAllMedia();await n.brandKit.updateIdAndVersion(e.id,e.brandKit.lastModifiedDate),await n.brandKit.rename(e.brandKit.name),r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:u||[],gradients:C||[],fonts:p||[],paragraphStyles:I||[],characterStyles:S||[],media:v||[]}}}),r},y(this,N,o),this.colorStyleController=t.colorStyle,this.gradientStyleController=t.gradientStyle,this.fontController=t.font,this.mediaController=t.mediaConnector,this.paragraphStyleController=t.paragraphStyle,this.characterStyleController=t.characterStyle,this.undoManagerController=t.undoManager}async setColors(o,t){const e=new Map;for(const r of o.brandKit.colors||[]){const{parsedData:n}=await t.colorStyle.create();if(!n)continue;e.set(r.guid,n);const c=An(r);await t.colorStyle.rename(n,r.name),await t.colorStyle.update(n,c)}return e}async setGradients(o,t){return new Map}async setFonts(o,t){const e=o.fontConnectorId,r=new Map;for(const n of o.brandKit.fonts||[]){const{parsedData:c=[]}=await t.fontConnector.detail(e,n.fontFamilyId);if(!(c!=null&&c[0]))throw new Error(`No font styles for family ID: ${n.fontFamilyId}`);const{parsedData:l}=await t.font.addFontFamily(e,{name:c[0].familyName,fontFamilyId:n.fontFamilyId});l&&r.set(n.fontFamilyBrandKitGuid,l)}return r}async setParagraphStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:l}=e;for(const u of o.brandKit.paragraphStyles||[]){const C=c.get(u.brandKitColorGuid),p=c.get(u.textStrokeColorGuid),I=l.get(u.brandKitFontFamilyGuid),S=xe(n,I,u.fontStyleId);if(!I||!S)throw new Error(`Paragraph style could not be created with an empty font family: ${u.name}`);const v=ne(r,C),P=ne(r,p);if(!v)throw new Error(`Paragraph style could not be created with an empty color: ${u.name}`);const{parsedData:A}=await t.paragraphStyle.create(),b=He(u,v,P,`${S}`);await t.paragraphStyle.rename(A,u.name),await t.paragraphStyle.update(A,b)}}async setCharacterStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:l}=e;for(const u of o.brandKit.characterStyles||[]){const C=u.brandKitColorGuid?c.get(u.brandKitColorGuid):void 0,p=u.textStrokeColorGuid?c.get(u.textStrokeColorGuid):void 0,I=u.brandKitFontFamilyGuid?l.get(u.brandKitFontFamilyGuid):void 0,S=ne(r,C),v=ne(r,p),P=xe(n,I,u.fontStyleId),{parsedData:A}=await t.characterStyle.create(),b=He(u,S,v,P);await t.characterStyle.rename(A,u.name),await t.characterStyle.update(A,b)}}async setMedia(o){for(const t of o.brandKit.media||[])await this.addMedia(t.name,t.mediaConnectorId,t.mediaId)}}N=new WeakMap;class Ce{constructor(o){g(this,it);this.zoomToPage=async(t,e,r,n,c)=>(t!==void 0&&console.warn("id has no effect and will be deprecated in the future"),(await a(this,it)).zoomToPage(e,r,n,c).then(u=>i(u))),this.getZoomPercentage=async()=>(await a(this,it)).getZoomPercentage().then(e=>i(e)),this.setZoomPercentage=async t=>(await a(this,it)).setZoomPercentage(t).then(r=>i(r)),this.setViewMode=async t=>(await a(this,it)).setViewMode(t).then(r=>i(r)),y(this,it,o)}}it=new WeakMap;class $e{constructor(o){g(this,G);this.getAll=async()=>(await a(this,G)).getCharacterStyles().then(e=>i(e)),this.getById=async t=>(await a(this,G)).getCharacterStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,G)).createCharacterStyle().then(e=>i(e)),this.update=async(t,e)=>(await a(this,G)).updateCharacterStyle(t,JSON.stringify(e)).then(n=>i(n)),this.remove=async t=>(await a(this,G)).removeCharacterStyle(t).then(r=>i(r)),this.duplicate=async t=>(await a(this,G)).duplicateCharacterStyle(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,G)).renameCharacterStyle(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,G)).moveCharacterStyles(t,e).then(n=>i(n)),y(this,G,o)}}G=new WeakMap;class ze{constructor(o){g(this,ot);this.copyFrames=async t=>{const r=await(await a(this,ot)).copyFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.cutFrames=async t=>{const r=await(await a(this,ot)).cutFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.pasteFrames=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.pasteFrames(e);return i(r)},this.getContentType=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.getClipboardContentType(e);return i(r)},y(this,ot,o)}}ot=new WeakMap;class We{constructor(o){g(this,Kt);this.convertToRgb=async t=>(await a(this,Kt)).colorToRgb(JSON.stringify(t)).then(r=>i(r)),y(this,Kt,o)}}Kt=new WeakMap;class je{constructor(o){g(this,B);this.getAll=async()=>(await a(this,B)).getColors().then(e=>i(e)),this.getById=async t=>(await a(this,B)).getColorById(t).then(r=>i(r)),this.create=async()=>(await a(this,B)).createColor().then(e=>i(e)),this.duplicate=async t=>(await a(this,B)).duplicateColor(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,B)).moveColors(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,B)).renameColor(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,B),n=e;return n.type===Q.spot&&(n.type=Q.spotCMYK),r.updateColor(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,B)).removeColor(t).then(r=>i(r)),y(this,B,o)}}B=new WeakMap;var Pt=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(Pt||{}),ae=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(ae||{}),Ft=(s=>(s.file="file",s.collection="collection",s))(Ft||{}),qe=(s=>(s.media="media",s.fonts="fonts",s.data="data",s.components="components",s))(qe||{}),Ye=(s=>(s.name="name",s.path="relativePath",s.id="id",s))(Ye||{}),Ze=(s=>(s.ascending="asc",s.descending="desc",s))(Ze||{}),Qe=(s=>(s.text="text",s.boolean="boolean",s))(Qe||{}),Xe=(s=>(s.query="query",s.upload="upload",s))(Xe||{}),Et=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Et||{});class Fn{constructor(o,t,e,r="engineToConnector"){this.direction="engineToConnector",this.name=o,this.direction=r,t==="var"?this.value=`${t}.${e}`:this.value=e}}var ts=(s=>(s.variable="var",s.value="value",s))(ts||{}),es=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(es||{}),ie=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(ie||{}),ss=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(ss||{});const En={url:"grafx-media.json",source:"local"};class On{constructor(o){this.type="grafxToken",this.token=o}}class Dn{constructor(){this.type="refreshed"}}var rs=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(rs||{}),ns=(s=>(s.grafxToken="grafxToken",s.any="any",s))(ns||{}),we=(s=>(s.minDimension="minDimension",s))(we||{});class as extends Error{constructor(o,t){super(o),this.type=t}}class me{constructor(){this.makeConnectorSourceForwardsCompatible=o=>{if(o.source!=Et.grafx||this.isSourceMigrated(o))return o;let t=o.url;for(;t.endsWith("/");)t=t.substring(0,t.length-1);const e=t.split("/");return{id:e[e.length-1],source:Et.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(o,t)=>o.map(e=>this.makeSingleConnectorBackwardsCompatible(e,t)),this.makeSingleConnectorBackwardsCompatible=(o,t)=>o.source.source!=Et.grafx?o:{id:o.id,name:o.name,iconUrl:o.iconUrl,source:this.makeConnectorSourceBackwardsCompatible(o.source,t)},this.makeConnectorSourceBackwardsCompatible=(o,t)=>{let e=t;for(;e!=null&&e.endsWith("/");)e=e.substring(0,e.length-1);return{url:`${e}/connectors/${o.id}`,source:Et.grafx}},this.isSourceMigrated=o=>"id"in o}}let is=(Er=class{constructor(o,t){g(this,J);g(this,Dt);g(this,wt);this.getById=async e=>(await a(this,J)).getConnectorById(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,wt).makeSingleConnectorBackwardsCompatible(n.parsedData,a(this,Dt).get(Y.GraFxStudioEnvironmentApiUrl))),c}),this.getAllByType=async e=>(await a(this,J)).getConnectors(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,wt).makeMultipleConnectorsBackwardsCompatible(n.parsedData,a(this,Dt).get(Y.GraFxStudioEnvironmentApiUrl))),c}),this.register=async e=>{const r=await a(this,J),n=a(this,wt).makeConnectorSourceForwardsCompatible(e);return r.registerConnector(JSON.stringify(n)).then(c=>i(c))},this.unregister=async e=>(await a(this,J)).unregisterConnector(e).then(n=>i(n)),this.configure=async(e,r)=>{const n=await a(this,J);return await this.waitToBeReady(e),await r(new Ln(e,n)),n.updateConnectorConfiguration(e).then(c=>i(c))},this.getState=async e=>(await a(this,J)).getConnectorState(e).then(n=>i(n)),this.getOptions=async e=>(await a(this,J)).getConnectorOptions(e).then(n=>i(n)),this.waitToBeReady=async(e,r=2e3)=>{let n=Math.max(r,500);n=Math.min(n,5e3);const c=100;let l=0;try{for(;l*c<n;){const u=await this.getState(e);if(u.success&&u.parsedData&&(u.parsedData.type===ie.running||u.parsedData.type===ie.ready))return i({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(C=>setTimeout(C,c)),l++}}catch(u){return i({data:null,success:!1,error:`Error while getting connector state ${u}`,status:5e4,parsedData:void 0},!1)}return i({data:null,success:!1,error:"Timed out waiting for connector",status:5e4,parsedData:void 0},!1)},this.updateMappings=async(e,r)=>await this.configure(e,async n=>{const{parsedData:c}=await this.getMappings(e),l=(c==null?void 0:c.filter(p=>!r.some(I=>I.name===p.name&&I.direction===p.direction)))??[],u=r.filter(p=>p.name!==""&&p.value!==""),C=[...l,...u];await n.setMappings(C)}),y(this,J,o),y(this,Dt,t),y(this,wt,new me)}async getMappings(o,t){return(await a(this,J)).getConnectorMappings(o).then(r=>i(r)).then(r=>{var n;return t?{...r,parsedData:(n=r.parsedData)==null?void 0:n.filter(c=>c.direction===t)}:r})}},J=new WeakMap,Dt=new WeakMap,wt=new WeakMap,Er);class Ln{constructor(o,t){g(this,mt);g(this,ft);this.setOptions=async e=>a(this,ft).setConnectorOptions(a(this,mt),JSON.stringify(e)).then(r=>i(r)),this.setMappings=async e=>{const r=await a(this,ft).setConnectorMappings(a(this,mt),e.map(function(n){return JSON.stringify(n)}));return i(r)},this.setHttpHeader=async(e,r)=>a(this,ft).connectorAuthenticationSetHttpHeader(a(this,mt),e,r).then(n=>i(n)),y(this,mt,o),y(this,ft,t)}}mt=new WeakMap,ft=new WeakMap;class os{constructor(o,t){g(this,ct);g(this,$t);this.getPage=async(e,r,n={})=>(await a(this,ct)).dataConnectorGetPage(e,JSON.stringify(r),JSON.stringify(n)).then(l=>i(l)).then(l=>{const u={...l,parsedData:null};return l.parsedData&&(u.parsedData={data:l.parsedData.data.map(C=>a(this,$t).mapEngineToDataItem(C)),continuationToken:l.parsedData.continuationToken}),u}),this.getModel=async(e,r={})=>(await a(this,ct)).dataConnectorGetModel(e,JSON.stringify(r)).then(c=>i(c)),this.getConfigurationOptions=async e=>(await a(this,ct)).dataConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,ct)).dataConnectorGetCapabilities(e).then(n=>i(n)),y(this,ct,o),y(this,$t,t)}}ct=new WeakMap,$t=new WeakMap;class cs{constructor(o,t){g(this,ht);g(this,zt);this.setDataSource=async e=>(await a(this,ht)).setDataSource(e).then(n=>i(n)),this.getDataSource=async()=>(await a(this,ht)).getDataSource().then(r=>i(r)),this.removeDataSource=async()=>(await a(this,ht)).removeDataSource().then(r=>i(r)),this.setDataRow=async e=>{const r=await a(this,ht),n=a(this,zt).mapDataItemToEngine(e);return r.setDataRow(JSON.stringify(n)).then(c=>i(c))},y(this,ht,o),y(this,zt,t)}}ht=new WeakMap,zt=new WeakMap;class hs{constructor(o){g(this,lt);this.getAllLogs=async()=>(await a(this,lt)).getLogs().then(e=>i(e)),this.toggleDebugPanel=async()=>(await a(this,lt)).toggleDebugPanel().then(e=>i(e)),this.enableDebug=async()=>(await a(this,lt)).enableDebug().then(e=>i(e)),this.disableDebug=async()=>(await a(this,lt)).disableDebug().then(e=>i(e)),y(this,lt,o)}}lt=new WeakMap;class ls{constructor(o){g(this,St);this.getCurrentState=async()=>(await a(this,St)).getCurrentDocumentState().then(e=>i(e)),this.load=async(t,e={keepConnectors:!1})=>{const r=await a(this,St),n=typeof t!="string"?JSON.stringify(t):t;return r.loadDocument(n,JSON.stringify(e)).then(c=>i(c))},this.createAndLoad=async t=>{const e=await a(this,St),r=JSON.stringify(t);return e.createAndLoadDocument(r).then(n=>i(n))},y(this,St,o)}}St=new WeakMap;var ds=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(ds||{}),Ht=(s=>(s.url="url",s.variable="variable",s.connector="connector",s.brandKitMedia="brandKitMedia",s))(Ht||{}),us=(s=>(s.connector="connector",s))(us||{}),gs=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s.component="component",s))(gs||{}),ys=(s=>(s.variable="variable",s.text="text",s))(ys||{}),ps=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(ps||{}),Cs=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(Cs||{}),ws=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(ws||{}),ms=(s=>(s.normal="normal",s.screen="screen",s.overlay="overlay",s.darken="darken",s.lighten="lighten",s.colorDodge="colorDodge",s.colorBurn="colorBurn",s.hardLight="hardLight",s.softLight="softLight",s.difference="difference",s.exclusion="exclusion",s.multiply="multiply",s.hue="hue",s.saturation="saturation",s.color="color",s.luminosity="luminosity",s))(ms||{}),fs=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(fs||{}),Ss=(s=>(s.topLeft="topLeft",s.topCenter="topCenter",s.topRight="topRight",s.centerLeft="centerLeft",s.center="center",s.centerRight="centerRight",s.bottomLeft="bottomLeft",s.bottomCenter="bottomCenter",s.bottomRight="bottomRight",s))(Ss||{}),bs=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(bs||{}),vs=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(vs||{}),Is=(s=>(s.page="page",s.frame="frame",s))(Is||{}),As=(s=>(s.start="start",s.end="end",s.center="center",s))(As||{});class Mn{constructor(){this.type="page"}}class Nn{constructor(o,t){this.type="frame",this.frameId=o,this.edge=t}}var fe=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(fe||{});class Ps{constructor(o){g(this,U);this.insertImageVariableToFrame=async(t,e)=>{const r=await a(this,U),n={id:e,type:Ht.variable};return r.setImageSource(t,JSON.stringify(n)).then(c=>i(c))},this.insertTextVariable=async t=>(await a(this,U)).insertTextVariable(t).then(r=>i(r)),this.enterTextEditMode=async t=>(await a(this,U)).enterTextEditMode(t).then(r=>i(r)),this.exitTextEditMode=async()=>(await a(this,U)).exitTextEditMode().then(e=>i(e)),this.getText=async(t,e)=>(await a(this,U)).getTextByFrameId(t,e).then(n=>i(n)),this.setText=async(t,e)=>(await a(this,U)).setTextByFrameId(t,e).then(n=>i(n)),this.selectText=async(t,e,r)=>(await a(this,U)).selectTextById(t,e,r).then(c=>i(c)),this.addCustomUndoData=async(t,e,r)=>(await a(this,U)).setCustomUndoData(t,e,r??!1).then(c=>i(c)),y(this,U,o)}}U=new WeakMap;class Fs{constructor(o){g(this,dt);g(this,Lt);this.query=async(t,e,r={})=>(await a(this,dt)).fontConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,dt)).fontConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r={})=>(await a(this,Lt)).fontConnectorDownload(t,e,JSON.stringify(r)).then(c=>c??c),this.preview=async(t,e,r,n={})=>(await a(this,Lt)).fontConnectorPreview(t,e,r,JSON.stringify(n)).then(l=>l??l),this.getConfigurationOptions=async t=>(await a(this,dt)).fontConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,dt)).fontConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedFontType=t=>{if(t===Pt.file)return Ft.file;if(t===Pt.collection)return Ft.collection},y(this,dt,o),y(this,Lt,o)}}dt=new WeakMap,Lt=new WeakMap;class Es{constructor(o){g(this,E);this.addFontFamily=async(t,e)=>(await a(this,E)).addFontFamily(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontFamily=async t=>(await a(this,E)).removeFontFamily(t).then(r=>i(r)),this.addFontStyle=async(t,e)=>(await a(this,E)).addFontStyle(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontStyle=async t=>(await a(this,E)).removeFontStyle(t).then(r=>i(r)),this.getFontFamilies=async()=>(await a(this,E)).getFontFamilies().then(e=>i(e)),this.getFontStyles=async t=>(await a(this,E)).getFontStyles(t).then(r=>i(r)),this.getFontFamilyById=async t=>(await a(this,E)).getFontFamilyById(t).then(r=>i(r)),this.getFontStyleById=async t=>(await a(this,E)).getFontStyleById(t).then(r=>i(r)),this.getDefaultFontStyle=async()=>(await a(this,E)).getDefaultFontStyle().then(e=>i(e)),this.getDefaultFontFamily=async()=>(await a(this,E)).getDefaultFontFamily().then(e=>i(e)),this.isFontFamilyUsed=async t=>(await a(this,E)).isFontFamilyUsed(t).then(r=>i(r)),this.isFontStyleUsed=async t=>(await a(this,E)).isFontStyleUsed(t).then(r=>i(r)),this.moveFontFamilies=async(t,e)=>(await a(this,E)).moveFontFamilies(t,e).then(n=>i(n)),this.getPreviewsOfCharacterStrings=async(t,e)=>(await a(this,E)).getPreviewsOfCharacterStrings(t,JSON.stringify(e)).then(n=>i(n)),y(this,E,o)}}E=new WeakMap;class Se{constructor(o){g(this,Mt);this.setShapeProperties=async(t,e)=>(await a(this,Mt)).setShapeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableFill=async(t,e)=>{const r={enableFill:e};return this.setShapeProperties(t,r)},this.setFillColor=async(t,e)=>{const r={fillColor:e};return this.setShapeProperties(t,r)},this.setEnableStroke=async(t,e)=>{const r={enableStroke:e};return this.setShapeProperties(t,r)},this.setStrokeColor=async(t,e)=>{const r={strokeColor:e};return this.setShapeProperties(t,r)},this.setStrokeWeight=async(t,e)=>{const r={strokeWeight:e};return this.setShapeProperties(t,r)},this.setFlagAllCornersSame=async(t,e)=>{const r={allCornersSame:e};return this.setShapeProperties(t,r)},this.setShapeCorners=async(t,e)=>(await a(this,Mt)).setShapeCorners(t,JSON.stringify(e)).then(n=>i(n)),this.setRadiusAll=async(t,e)=>{const r={radiusAll:e};return this.setShapeCorners(t,r)},this.setRadiusTopLeft=async(t,e)=>{const r={topLeft:e};return this.setShapeCorners(t,r)},this.setRadiusBottomLeft=async(t,e)=>{const r={bottomLeft:e};return this.setShapeCorners(t,r)},this.setRadiusTopRight=async(t,e)=>{const r={topRight:e};return this.setShapeCorners(t,r)},this.setRadiusBottomRight=async(t,e)=>{const r={bottomRight:e};return this.setShapeCorners(t,r)},y(this,Mt,o)}}Mt=new WeakMap;class Os{constructor(o){g(this,d);this.getAll=async()=>(await a(this,d)).getFrames().then(e=>i(e)),this.getSelected=async()=>(await a(this,d)).getSelectedFrames().then(e=>i(e)),this.getAllByPageId=async t=>(await a(this,d)).getFramesByPageId(t).then(r=>i(r)),this.getByName=async t=>(await a(this,d)).getFrameByName(t).then(r=>i(r)),this.getById=async t=>(await a(this,d)).getFrameById(t).then(r=>i(r)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,d)).getFramePropertiesOnSelectedLayout().then(e=>i(e)),this.getLayoutProperties=async(t,e)=>(await a(this,d)).getFramePropertiesByFrameId(t,e).then(n=>i(n)),this.getAllLayoutProperties=async t=>(await a(this,d)).getFramesProperties(t).then(r=>i(r)),this.resetTransformation=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetSize=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.select=async t=>(await a(this,d)).selectFrames([t]).then(r=>i(r)),this.selectMultiple=async t=>(await a(this,d)).selectFrames(t).then(r=>i(r)),this.deselectAll=async()=>(await a(this,d)).deselectFrames().then(e=>i(e)),this.reorderFrames=async(t,e)=>(await a(this,d)).reorderFrames(t,e).then(n=>i(n)),this.setZIndex=async(t,e)=>(await a(this,d)).setFrameZIndex(t,e).then(n=>i(n)),this.setHeight=async(t,e)=>(await a(this,d)).setFrameHeight(t,e).then(n=>i(n)),this.setRotation=async(t,e)=>(await a(this,d)).setFrameRotation(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,d)).setFrameWidth(t,e).then(n=>i(n)),this.setX=async(t,e)=>(await a(this,d)).setFrameX(t,e).then(n=>i(n)),this.setY=async(t,e)=>(await a(this,d)).setFrameY(t,e).then(n=>i(n)),this.setOpacity=async(t,e)=>(await a(this,d)).setFrameOpacity(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,d)).renameFrame(t,e).then(n=>i(n)),this.reset=async t=>(await a(this,d)).resetFrame(t).then(r=>i(r)),this.resetX=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetY=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetRotation=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetHeight=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetImageFrameFitMode=async t=>(await a(this,d)).resetImageFrameFitMode(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,d)).setFrameIsVisible(t,e).then(n=>i(n)),this.setIsVisible=async(t,e)=>(await a(this,d)).setFrameIsVisible(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,d)).removeFrames([t]).then(r=>i(r)),this.removeFrames=async t=>(await a(this,d)).removeFrames(t).then(r=>i(r)),this.create=async(t,e,r,n,c)=>(await a(this,d)).addFrame(t,e,r,n,c).then(u=>i(u)),this.createShapeFrame=async(t,e,r,n,c)=>(await a(this,d)).addFrame(t,e,r,n,c).then(u=>i(u)),this.createBarcodeFrame=async(t,e)=>(await a(this,d)).addBarcodeFrame(t,e==null?void 0:e.x,e==null?void 0:e.y).then(n=>i(n)),this.createComponentFrame=async(t,e,r,n,c)=>(await a(this,d)).addComponentFrame(e,r,n,c,JSON.stringify(t)).then(u=>i(u)),this.duplicateFrames=async t=>(await a(this,d)).duplicateFrames(t).then(r=>i(r)),this.updateImageSource=async(t,e)=>{const r=await a(this,d),n=e!==null?JSON.stringify(e):null;return r.setImageSource(t,n).then(c=>i(c))},this.removeImageSource=async t=>this.updateImageSource(t,null),this.setImageFromConnector=async(t,e,r)=>{const n={id:e,assetId:r,type:Ht.connector};return this.updateImageSource(t,n)},this.setImageFromUrl=async(t,e)=>{const r={url:e,type:Ht.url};return this.updateImageSource(t,r)},this.setImageFrameFitMode=async(t,e)=>(await a(this,d)).setImageFrameFitMode(t,e).then(n=>i(n)),this.setImageFrameFitModePosition=async(t,e)=>(await a(this,d)).setImageFrameFitModePosition(t,e).then(n=>i(n)),this.setFrameConstrainProportions=async(t,e)=>(console.error("setFrameConstrainProportions is not supported anymore"),i({success:!1,status:0,error:"setFrameConstrainProportions is not supported anymore",parsedData:null})),this.setVerticalAlign=async(t,e)=>(await a(this,d)).setVerticalAlignment(t,e).then(n=>i(n)),this.setNumberOfColumns=async(t,e)=>(await a(this,d)).setNumberOfColumns(t,e).then(n=>i(n)),this.setColumnGap=async(t,e)=>(await a(this,d)).setColumnGap(t,e).then(n=>i(n)),this.setMinCopyfitting=async(t,e)=>(await a(this,d)).setMinCopyfitting(t,e).then(n=>i(n)),this.setMaxCopyfitting=async(t,e)=>(await a(this,d)).setMaxCopyfitting(t,e).then(n=>i(n)),this.setEnableCopyfitting=async(t,e)=>(await a(this,d)).setEnableCopyfitting(t,e).then(n=>i(n)),this.resetMinCopyfitting=async t=>(await a(this,d)).resetMinCopyfitting(t).then(r=>i(r)),this.resetMaxCopyfitting=async t=>(await a(this,d)).resetMaxCopyfitting(t).then(r=>i(r)),this.resetEnableCopyfitting=async t=>(await a(this,d)).resetEnableCopyfitting(t).then(r=>i(r)),this.setShapeFrameEnableFill=async(t,e)=>this.shapeController.setEnableFill(t,e),this.setShapeFrameFillColor=async(t,e)=>this.shapeController.setFillColor(t,e),this.setShapeFrameEnableStroke=async(t,e)=>this.shapeController.setEnableStroke(t,e),this.setShapeFrameStrokeColor=async(t,e)=>this.shapeController.setStrokeColor(t,e),this.setShapeFrameStrokeWeight=async(t,e)=>this.shapeController.setStrokeWeight(t,e),this.setBlendMode=async(t,e)=>(await a(this,d)).setFrameBlendMode(t,e).then(n=>i(n)),this.enterCropMode=async(t,e=fe.frameCrop)=>(await a(this,d)).enterCropMode(t,e).then(n=>i(n)),this.applyCropMode=async()=>(await a(this,d)).applyCropMode().then(e=>i(e)),this.exitCropMode=async()=>(await a(this,d)).cancelCropMode().then(e=>i(e)),this.enterSubjectMode=async t=>(await a(this,d)).enterSubjectMode(t).then(r=>i(r)),this.applySubjectMode=async()=>(await a(this,d)).applySubjectMode().then(e=>i(e)),this.exitSubjectMode=async()=>(await a(this,d)).cancelSubjectMode().then(e=>i(e)),this.enterGradientMode=async t=>(await a(this,d)).enterGradientMode(t).then(r=>i(r)),this.applyGradientMode=async()=>(await a(this,d)).applyGradientMode().then(e=>i(e)),this.cancelGradientMode=async()=>(await a(this,d)).cancelGradientMode().then(e=>i(e)),this.resetCropMode=async t=>(console.error("resetCropMode is not supported anymore"),i({success:!1,status:0,error:"resetCropMode is not supported anymore",parsedData:null})),this.setEnableAutoGrow=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinWidth=async(t,e)=>{const r={minWidth:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxWidth=async(t,e)=>{const r={maxWidth:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinHeight=async(t,e)=>{const r={minHeight:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxHeight=async(t,e)=>{const r={maxHeight:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowDirections=async(t,e)=>{const r={directions:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.resetAutoGrowSettingsEnabled=async t=>(console.error("resetAutoGrowSettingsEnabled is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowSettingsEnabled is not supported anymore",parsedData:null})),this.resetAutoGrowMinWidth=async t=>(console.error("resetAutoGrowMinWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMaxWidth=async t=>(console.error("resetAutoGrowMaxWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMinHeight=async t=>(console.error("resetAutoGrowMinHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinHeight is not supported anymore",parsedData:null})),this.resetAutoGrowMaxHeight=async t=>(console.error("resetAutoGrowMaxHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxHeight is not supported anymore",parsedData:null})),this.resetAutoGrowDirections=async t=>(console.error("resetAutoGrowDirections is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowDirections is not supported anymore",parsedData:null})),this.resetAutoGrow=async t=>(console.error("resetAutoGrow is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrow is not supported anymore",parsedData:null})),this.setShadowEnabled=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowDistance=async(t,e)=>{const r={distance:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowAngleDegrees=async(t,e)=>{const r={angleDegrees:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowBlurRadius=async(t,e)=>{const r={blurRadius:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowColor=async(t,e)=>{const r={color:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAnchor=async(t,e,r,n,c)=>{const l={horizontal:e,type:r,target:n,endTarget:c};return(await a(this,d)).setAnchorProperties(t,JSON.stringify(l)).then(C=>i(C))},this.setVerticalAnchor=async(t,e,r,n)=>this.setAnchor(t,!1,e,r,n),this.setHorizontalAnchor=async(t,e,r,n)=>this.setAnchor(t,!0,e,r,n),this.resetAnchoring=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetVisibility=async t=>(await a(this,d)).setFrameIsVisible(t,null).then(r=>i(r)),this.getConfiguration=async t=>(await a(this,d)).getFrameConfiguration(t).then(r=>i(r)),this.resetAssetCropOverride=async t=>(await a(this,d)).resetAssetCropOverride(t).then(r=>i(r)),this.resetAllAssetCropOverrides=async t=>(await a(this,d)).resetAllAssetCropOverrides(t).then(r=>i(r)),this.setGradientApplied=async(t,e)=>{const r={isApplied:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setLocalGradient=async(t,e)=>{const r={gradient:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setBrandKitGradient=async(t,e)=>{const r={id:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},y(this,d,o),this.shapeController=new Se(a(this,d)),this.constraints=new Rn(a(this,d))}}d=new WeakMap;class Rn{constructor(o){g(this,W);this.get=async t=>(await a(this,W)).getFrameConstraints(t).then(r=>i(r)),this.setSelectable=async(t,e)=>{const r={selectionAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setHorizontalMovement=async(t,e)=>{const r={horizontalMovementAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setVerticalMovement=async(t,e)=>{const r={verticalMovementAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setRotation=async(t,e)=>{const r={rotationAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setResize=async(t,e)=>{const r={resizeAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setCrop=async(t,e)=>{const r={cropAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},y(this,W,o)}}W=new WeakMap;class Ds{constructor(){this.currentEngineVersion=R.current,this.currentSDKVersion=Pe.version}}class Ls{constructor(o){g(this,f);g(this,Wt);this.getAll=async()=>(await a(this,f)).getLayouts().then(e=>i(e)),this.getById=async t=>(await a(this,f)).getLayoutById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,f)).getLayoutByName(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,f)).getSelectedLayout().then(e=>i(e)),this.remove=async t=>(await a(this,f)).removeLayout(t).then(r=>i(r)),this.create=async(t,e)=>{const r=await a(this,f);return e!=null&&e.length?r.addLayouts(t,JSON.stringify(e)).then(n=>i(n)):r.addLayout(t).then(n=>i(n))},this.rename=async(t,e)=>(await a(this,f)).renameLayout(t,e).then(n=>i(n)),this.select=async t=>(await a(this,f)).selectLayoutWithOptions(t,null).then(r=>i(r)),this.selectWithPageSize=async(t,e)=>{const r=await a(this,f),n={pageSize:e};return r.selectLayoutWithOptions(t,JSON.stringify(n)).then(c=>i(c))},this.duplicate=async t=>(await a(this,f)).duplicateLayout(t).then(r=>i(r)),this.reset=async t=>(await a(this,f)).resetLayout(t).then(r=>i(r)),this.setHeight=async(t,e)=>(await a(this,f)).setLayoutHeight(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,f)).setLayoutWidth(t,e).then(n=>i(n)),this.setUnit=async(t,e)=>(await a(this,f)).setLayoutUnit(t,e).then(n=>i(n)),this.resetHeight=async t=>(await a(this,f)).resetLayoutHeight(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,f)).resetLayoutWidth(t).then(r=>i(r)),this.resetUnit=async t=>(await a(this,f)).resetLayoutUnit(t).then(r=>i(r)),this.getSelectedSnapshot=async()=>(await a(this,Wt)).getPageSnapshot().then(e=>e??e),this.setIntent=async(t,e)=>(await a(this,f)).setLayoutIntent(t,e).then(n=>i(n)),this.resetIntent=async t=>(await a(this,f)).resetLayoutIntent(t).then(r=>i(r)),this.setFillColor=async(t,e)=>(await a(this,f)).setLayoutFillColor(t,JSON.stringify(e)).then(n=>i(n)),this.setFillColorEnabled=async(t,e)=>(await a(this,f)).setLayoutFillColorEnabled(t,e).then(n=>i(n)),this.resetFillColor=async t=>(await a(this,f)).resetLayoutFillColor(t).then(r=>i(r)),this.setBleedValue=async(t,e,r)=>{const n=r?{left:r===Z.left?e:void 0,top:r===Z.top?e:void 0,right:r===Z.right?e:void 0,bottom:r===Z.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(n)).then(l=>i(l))},this.setAreBleedValuesCombined=async(t,e)=>{const r={areBleedValuesCombined:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(r)).then(c=>i(c))},this.resetBleedValues=async t=>(await a(this,f)).updateLayoutBleed(t,null).then(r=>i(r)),this.setPrivateData=async(t,e)=>(await a(this,f)).setLayoutPrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,f)).getLayoutPrivateData(t).then(r=>i(r)),this.setDisplayName=async(t,e)=>(await a(this,f)).setLayoutDisplayName(t,e).then(n=>i(n)),this.getDisplayName=async t=>(await a(this,f)).getLayoutDisplayName(t).then(r=>i(r)),this.resetDisplayName=async t=>(await a(this,f)).setLayoutDisplayName(t,null).then(r=>i(r)),this.setAvailableForUser=async(t,e)=>(await a(this,f)).setLayoutAvailableForUser(t,e).then(n=>i(n)),this.setSelectedByUser=async(t,e)=>(await a(this,f)).setLayoutSelectedByUser(t,e).then(n=>i(n)),this.setResizableByUser=async(t,e)=>(await a(this,f)).setLayoutResizableByUser(t,JSON.stringify(e)).then(n=>i(n)),y(this,f,o),y(this,Wt,o)}}f=new WeakMap,Wt=new WeakMap;var oe=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(oe||{}),be=(s=>(s.web="web",s.print="print",s.animation="animation",s))(be||{});class Ms{constructor(o){g(this,X);g(this,jt);this.query=async(t,e,r={})=>(await a(this,X)).mediaConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,X)).mediaConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r,n={})=>{const c=this.parseDeprecatedMediaDownloadType(r);return(await a(this,jt)).mediaConnectorDownload(t,e,c,be.web,JSON.stringify(n)).then(u=>{if(u instanceof Uint8Array)return u;throw typeof u=="object"&&u!==null&&"success"in u&&!u.success&&ye(u),new Error(`Unexpected response type: ${typeof u}.`)})},this.getConfigurationOptions=async t=>(await a(this,X)).mediaConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,X)).mediaConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedMediaType=t=>{if(t===Pt.file)return Ft.file;if(t===Pt.collection)return Ft.collection},this.upload=async(t,e,r={})=>(await a(this,X)).mediaConnectorUpload(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),y(this,X,o),y(this,jt,o)}parseDeprecatedMediaDownloadType(o){switch(o){case ae.HighResolutionWeb:return oe.highres;case ae.LowResolutionWeb:return oe.thumbnail;default:return o}}}X=new WeakMap,jt=new WeakMap;let Ns=(Or=class{constructor(o){g(this,D);g(this,qt);this.add=async()=>(await a(this,D)).addPage().then(e=>i(e)),this.remove=async t=>(await a(this,D)).removePage(t).then(r=>i(r)),this.select=async t=>(await a(this,D)).selectPage(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,D)).setPageIsVisible(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,D)).duplicatePage(t).then(r=>i(r)),this.getAll=async()=>(await a(this,D)).getPages().then(e=>i(e)),this.getById=async t=>(await a(this,D)).getPageById(t).then(r=>i(r)),this.getSnapshot=async(t,e)=>(await a(this,qt)).getPageSnapshotWithSettings(t,e==null?null:JSON.stringify(e)).then(n=>n??n),this.setWidth=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,D)).setPageWidth(e).then(n=>i(n))),this.setHeight=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,D)).setPageHeight(e).then(n=>i(n))),this.setSize=async(t,e)=>(await a(this,D)).setPageSize(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,D)).reorderPages(t,e).then(n=>i(n)),y(this,D,o),y(this,qt,o)}},D=new WeakMap,qt=new WeakMap,Or);class Rs{constructor(o){g(this,k);this.getAll=async()=>(await a(this,k)).getParagraphStyles().then(e=>i(e)),this.getById=async t=>(await a(this,k)).getParagraphStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,k)).createParagraphStyle().then(e=>i(e)),this.duplicate=async t=>(await a(this,k)).duplicateParagraphStyle(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,k)).updateParagraphStyle(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,k)).renameParagraphStyle(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,k)).removeParagraphStyle(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,k)).moveParagraphStyles(t,e).then(n=>i(n)),y(this,k,o)}}k=new WeakMap;var T=(s=>(s.info="info",s.warn="warn",s.error="error",s))(T||{}),Vs=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s))(Vs||{}),xt=(s=>(s.throw="throw",s.log="log",s))(xt||{});class Ts{constructor(o,t,e,r){this.type="action",this.message=o,this.id=t,this.event=e,this.eventChain=r}}class Gs{constructor(o,t,e){this.type="dataRow",this.count=o,this.message=t,this.exceptions=e}}var ce=(s=>(s.shortText="shortText",s.longText="longText",s.image="image",s.list="list",s.boolean="boolean",s.group="group",s.number="number",s.date="date",s))(ce||{}),Bs=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))(Bs||{}),Js=(s=>(s.en_US="en_US",s.cs="cs",s.da="da",s.nl="nl",s.fi="fi",s.fr="fr",s.de="de",s.it="it",s.no="no",s.pl="pl",s.pt_PT="pt_PT",s.es_ES="es_ES",s.sv="sv",s))(Js||{}),Ot=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(Ot||{}),Us=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))(Us||{}),ks=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(ks||{});let Vn=class{constructor(o,t){this.onActionsChanged=e=>{this.config.events.onActionsChanged.trigger(JSON.parse(e))},this.onAnimationChanged=e=>{this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(e))},this.onAnimationPlaybackChanged=e=>{this.config.events.onScrubberPositionChanged.trigger(JSON.parse(e))},this.onSelectedLayoutPropertiesChanged=e=>{this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutUnitChanged=e=>{this.config.events.onSelectedLayoutUnitChanged.trigger(e)},this.onFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onFramesLayoutChanged.trigger(r)},this.onSelectedFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesLayoutChanged.trigger(r);const n=this.config.onSelectedFrameLayoutChanged;n&&n(r.length>1?void 0:r[0])},this.onSelectedFramesContentChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesContentChanged.trigger(r);const n=this.config.onSelectedFrameContentChanged;n&&n(r.length>1?null:r[0])},this.onStateChanged=()=>{this.config.events.onStateChanged.trigger()},this.onAuthExpired=async e=>{const r=await this.config.handlers.onAuthExpired.trigger(JSON.parse(e));return r!=null?JSON.stringify(r):null},this.onViewportRequested=()=>{const e=this.config.handlers.onViewportRequested.trigger();return e!=null?JSON.stringify(e):null},this.onDocumentLoaded=()=>{this.config.events.onDocumentLoaded.trigger()},this.onPageSelectionChanged=e=>{this.config.events.onPageSelectionChanged.trigger(e)},this.onVariableListChanged=e=>{const n=JSON.parse(e).map(c=>{var l;return c.type===ce.list?{...c,items:c.items.map(u=>u.value),selected:(l=c.selected)==null?void 0:l.value}:c});this.config.events.onVariableListChanged.trigger(n)},this.onSelectedToolChanged=e=>{this.config.events.onSelectedToolChanged.trigger(e)},this.onUndoStateChanged=e=>{this.config.events.onUndoStackStateChanged.trigger(JSON.parse(e))},this.onCustomUndoDataChanged=e=>{this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(e))},this.onSelectedLayoutFramesChanged=e=>{this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(e))},this.onSelectedTextStyleChanged=e=>{this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(e))},this.onColorsChanged=e=>{this.config.events.onColorsChanged.trigger(JSON.parse(e))},this.onParagraphStylesChanged=e=>{this.config.events.onParagraphStylesChanged.trigger(JSON.parse(e))},this.onCharacterStylesChanged=e=>{this.config.events.onCharacterStylesChanged.trigger(JSON.parse(e))},this.onFontFamiliesChanged=e=>{this.config.events.onFontFamiliesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutIdChanged=e=>{this.config.events.onSelectedLayoutIdChanged.trigger(e)},this.onLayoutsChanged=e=>{this.config.events.onLayoutsChanged.trigger(JSON.parse(e))},this.onZoomChanged=e=>{this.config.events.onZoomChanged.trigger(JSON.parse(e))},this.onConnectorEvent=e=>{this.config.events.onConnectorEvent.trigger(JSON.parse(e))},this.onConnectorsChanged=e=>{const n=new me().makeMultipleConnectorsBackwardsCompatible(JSON.parse(e),this.localConfig.get(Y.GraFxStudioEnvironmentApiUrl));this.config.events.onConnectorsChanged.trigger(n)},this.onSelectedPageIdChanged=e=>{this.config.events.onSelectedPageIdChanged.trigger(e)},this.onPagesChanged=e=>{this.config.events.onPagesChanged.trigger(JSON.parse(e))},this.onPageSnapshotInvalidated=e=>{this.config.events.onPageSnapshotInvalidated.trigger(e)},this.onPageSizeChanged=e=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(e))},this.onShapeCornerRadiusChanged=e=>{this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(e))},this.onCropActiveFrameIdChanged=e=>{this.config.events.onCropActiveFrameIdChanged.trigger(e)},this.onAsyncError=e=>{const r=JSON.parse(e);if((r==null?void 0:r.type)==="dataRow"){const n=new Gs(r.count,r.message,r.exceptions);this.config.events.onAsyncError.trigger(n)}else if((r==null?void 0:r.type)==="action"){const n=new Ts(r.message,r.id,r.event,r.eventChain);this.config.events.onAsyncError.trigger(n)}else this.config.events.onAsyncError.trigger(r)},this.onViewModeChanged=e=>{this.config.events.onViewModeChanged.trigger(e)},this.onBarcodeValidationChanged=e=>{this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(e))},this.onDataSourceIdChanged=e=>{this.config.events.onDataSourceIdChanged.trigger(e)},this.onDocumentIssueListChanged=e=>{this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(e))},this.onEngineEditModeChanged=e=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(e))},this.onBrandKitMediaChanged=e=>{this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(e))},this.config=o,this.localConfig=t}};class _s{constructor(o){g(this,bt);this.set=async t=>(await a(this,bt)).selectedTextStyleDeltaUpdate(JSON.stringify(t)).then(r=>i(r)),this.removeSelected=async()=>(await a(this,bt)).selectedTextStyleClean().then(e=>i(e)),this.getSelected=async()=>(await a(this,bt)).getSelectedTextStyle().then(e=>i(e)),y(this,bt,o)}}bt=new WeakMap;var Hs=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Hs||{}),xs=(s=>(s.LAYOUT_HEIGHT="layoutHeight",s.LAYOUT_WIDTH="layoutWidth",s.BLEED_TOP="bleedTop",s.BLEED_BOTTOM="bleedBottom",s.BLEED_LEFT="bleedLeft",s.BLEED_RIGHT="bleedRight",s.BLEED_VALUES_COMBINED="areBleedValuesCombined",s))(xs||{}),$=(s=>(s.SELECT="select",s.ZOOM="zoom",s.HAND="hand",s.IMAGE_FRAME="imageFrame",s.TEXT_FRAME="textFrame",s.SHAPE_RECT="rect",s.SHAPE_ELLIPSE="ellipse",s.SHAPE_POLYGON="polygon",s))($||{}),Ks=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s.HTML="html",s))(Ks||{}),he=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(he||{});class $s{constructor(o){g(this,Nt);this.setTool=async t=>(await a(this,Nt)).setTool(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,Nt)).getSelectedTool().then(e=>i(e)),this.setPointer=async()=>this.setTool($.SELECT),this.setSelect=async()=>this.setTool($.SELECT),this.setHand=async()=>this.setTool($.HAND),this.setZoom=async()=>this.setTool($.ZOOM),this.setTextFrame=async()=>this.setTool($.TEXT_FRAME),this.setImageFrame=async()=>this.setTool($.IMAGE_FRAME),this.setShapeRect=async()=>this.setTool($.SHAPE_RECT),this.setShapeEllipse=async()=>this.setTool($.SHAPE_ELLIPSE),this.setShapePolygon=async()=>this.setTool($.SHAPE_POLYGON),y(this,Nt,o)}}Nt=new WeakMap;class zs{constructor(o,t){g(this,tt);g(this,j);g(this,Yt);this.undo=async()=>(await a(this,tt)).undo().then(r=>i(r)),this.redo=async()=>(await a(this,tt)).redo().then(r=>i(r)),this.addCustomData=async(e,r)=>(await a(this,tt)).setCustomUndoData(e,r,!1).then(c=>i(c)),this.record=async(e,r)=>{try{await a(this,j).beginIfNoneActive(e),await r(a(this,Yt)),await a(this,j).end()}catch(n){throw await a(this,j).abort(),n}},this.pause=async()=>(await a(this,tt)).pause().then(r=>i(r)),this.resume=async()=>(await a(this,tt)).resume().then(r=>i(r)),this.advanced={begin:async e=>a(this,j).begin(e),beginIfNoneActive:async e=>a(this,j).beginIfNoneActive(e),end:async()=>a(this,j).end(),abort:async()=>a(this,j).abort()},y(this,tt,o),y(this,Yt,t),y(this,j,new Tn(o))}}tt=new WeakMap,j=new WeakMap,Yt=new WeakMap;class Tn{constructor(o){g(this,ut);this.begin=async t=>(await a(this,ut)).begin(t).then(r=>i(r)),this.beginIfNoneActive=async t=>(await a(this,ut)).beginIfNoneActive(t).then(r=>i(r)),this.end=async()=>(await a(this,ut)).end().then(e=>i(e)),this.abort=async()=>(await a(this,ut)).abort().then(e=>i(e)),y(this,ut,o)}}ut=new WeakMap;const Gn=(s,o=2)=>{const t=Math.pow(10,o);return Math.round(s*t)/t};class Ws{constructor(o,t){g(this,Zt);g(this,Rt);this.round=(e,r)=>i({data:String(Gn(e,r)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=e=>{const{type:r=he.SANDBOX,environment:n="ft-nostress",version:c="1"}=e,l=r==he.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${n}.${l}.online/grafx/api/v${c}/environment/${n}`},this.stageFiles=async(e,r,n)=>{const c=a(this,Rt).get(Y.GraFxStudioEnvironmentApiUrl);if(!c)throw new Error("GraFx Studio Environment API URL is not set");const l=`${c}connectors/${r}/stage`,u=a(this,Rt).get(Y.GraFxStudioAuthToken);if(!u)throw new Error("GraFx Studio Auth Token is not set");const C=new FormData;e.forEach((S,v)=>{const P=S instanceof File?S.name:`blob-${v}`;C.append("files",S,P)}),n&&C.append("validationJson",JSON.stringify({allowedMimeTypes:n.mimeTypes,minDimensions:{width:n.minWidthPixels,height:n.minHeightPixels}}));const p=await fetch(l,{method:"POST",body:C,headers:{Authorization:`Bearer ${u}`}});if(p.status===422){const S=await p.json();throw new as(S.message,we.minDimension)}if(!p.ok)throw new Error("Failed to stage files");return await p.json()},this.unitEvaluate=async(e,r)=>(await a(this,Zt)).unitEvaluate(e,r).then(c=>i(c)),y(this,Zt,o),y(this,Rt,t)}}Zt=new WeakMap,Rt=new WeakMap;class Bn{constructor(o){g(this,Qt);this.setMinimum=async(t,e)=>{const r={minValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setMaximum=async(t,e)=>{const r={maxValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setShowStepper=async(t,e)=>{const r={showStepper:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStepSize=async(t,e)=>{const r={stepSize:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setThousandsSeparator=async(t,e)=>{const r={thousandsSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalSeparator=async(t,e)=>{const r={decimalSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalCharacterStyle=async(t,e)=>{const r={decimalCharacterStyleId:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setNumberOfDecimals=async(t,e)=>{const r={numberOfDecimals:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Qt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Qt)).updateNumberVariableProperties(o,JSON.stringify(t));return i(r)}}Qt=new WeakMap;class Jn{constructor(o){g(this,Xt);this.setDisplayFormat=async(t,e)=>{const r={displayFormat:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setLocale=async(t,e)=>{const r={locale:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStartDate=async(t,e)=>{const r={startDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setEndDate=async(t,e)=>{const r={endDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setExcludedDays=async(t,e)=>{const r={excludedDays:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Xt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Xt)).updateDateVariableProperties(o,JSON.stringify(t));return i(r)}}Xt=new WeakMap;let js=(Dr=class{constructor(o){g(this,m);g(this,Vt);g(this,Tt);this.getAll=async()=>(await a(this,m)).getVariables().then(e=>i(e)).then(e=>{const r=e;return r.parsedData&&(r.parsedData=this.makeVariablesBackwardsCompatible(r.parsedData)),r}),this.getById=async t=>(await a(this,m)).getVariableById(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.getByName=async t=>(await a(this,m)).getVariableByName(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.create=async(t,e)=>(await a(this,m)).addVariable(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,m)).removeVariables(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,m)).setVariableName(t,e).then(n=>i(n)),this.setLabel=async(t,e)=>(await a(this,m)).setVariableLabel(t,e).then(n=>i(n)),y(this,Vt,async(t,e)=>(await a(this,m)).setVariablePlaceholder(t,e).then(n=>i(n))),this.setPlaceholder=async(t,e)=>a(this,Vt).call(this,t,e),this.resetPlaceholder=async t=>a(this,Vt).call(this,t,null),y(this,Tt,async(t,e)=>(await a(this,m)).setVariableHelpText(t,e).then(n=>i(n))),this.setHelpText=async(t,e)=>a(this,Tt).call(this,t,e),this.resetHelpText=async t=>a(this,Tt).call(this,t,null),this.setType=async(t,e)=>(await a(this,m)).setVariableType(t,e).then(n=>i(n)),this.setListVariable=async(t,e)=>(await a(this,m)).setListVariableItems(t,e.map(n=>JSON.stringify({value:n}))).then(n=>i(n)),this.setValue=async(t,e)=>(await a(this,m)).setVariableValue(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,m)).duplicateVariable(t).then(r=>i(r)),this.groupVariables=async(t,e)=>(await a(this,m)).groupVariables(t,e).then(n=>i(n)),this.ungroupVariables=async t=>(await a(this,m)).ungroupVariable(t).then(r=>i(r)),this.move=async(t,e,r)=>(await a(this,m)).moveVariable(e,r,t).then(c=>i(c)),this.moveVariables=async(t,e,r)=>(await a(this,m)).moveVariables(e,r,t).then(c=>i(c)),this.setIsVisible=async(t,e)=>{const r=e?{type:Ot.visible}:{type:Ot.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,e)=>{const r=e?{type:Ot.invisible}:{type:Ot.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,e)=>(await a(this,m)).setVariableVisibility(t,JSON.stringify(e)).then(n=>i(n)),this.setLayoutsForVariableVisibility=async t=>(await a(this,m)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>i(r)),this.setIsRequired=async(t,e)=>(await a(this,m)).setVariableIsRequired(t,e).then(n=>i(n)),this.setRemoveParagraphIfEmpty=async(t,e)=>(await a(this,m)).setVariableRemoveParagraphIfEmpty(t,e).then(n=>i(n)),this.setIsReadonly=async(t,e)=>(await a(this,m)).setVariableIsReadonly(t,e).then(n=>i(n)),this.getImageVariableConnectorId=async t=>(await a(this,m)).getImageVariableConnectorId(t).then(r=>i(r)),this.setImageVariableConnector=async(t,e)=>{const r=await a(this,m),c=new me().makeConnectorSourceForwardsCompatible(e);return r.setImageVariableConnector(t,JSON.stringify(c)).then(l=>i(l))},this.setImageVariableValueWithContext=async(t,e,r)=>(await a(this,m)).setImageVariableValueWithContext(t,e,JSON.stringify(r)).then(c=>i(c)),this.removeSource=async t=>this.setValue(t,null),this.setPrefix=async(t,e)=>{const r={prefix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffix=async(t,e)=>{const r={suffix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrefixCharacterStyle=async(t,e)=>{const r={prefixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffixCharacterStyle=async(t,e)=>{const r={suffixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrivateData=async(t,e)=>(await a(this,m)).setVariablePrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,m)).getVariablePrivateData(t).then(r=>i(r)),this.setAllowImageQuery=async(t,e)=>(await a(this,m)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowImageUpload=async(t,e)=>(await a(this,m)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinImageUploadSize=async(t,e,r)=>(await a(this,m)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setIsDontBreak=async(t,e)=>(await a(this,m)).setVariableIsDontBreak(t,e).then(n=>i(n)),y(this,m,o),this.number=new Bn(a(this,m)),this.date=new Jn(a(this,m))}makeVariablesBackwardsCompatible(o){return o.map(t=>this.makeVariableBackwardsCompatible(t))}makeVariableBackwardsCompatible(o){return o.type!==ce.list?o:this.makeListVariableBackwardsCompatible(o)}makeListVariableBackwardsCompatible(o){const t=o,e=o.items,r=o.selected,n=e.map(c=>c.value);return t.items=n,t.selected=r==null?void 0:r.value,t}async applyPrefixSuffixDeltaUpdate(o,t){const r=await(await a(this,m)).updateVariablePrefixSuffixProperties(o,JSON.stringify(t));return i(r)}},m=new WeakMap,Vt=new WeakMap,Tt=new WeakMap,Dr);class Un{constructor(o){this.onVariableListChanged=t=>{this.config.events.onVariableListChanged.trigger(JSON.parse(t))},this.onConnectorsChanged=t=>{this.config.events.onConnectorsChanged.trigger(JSON.parse(t))},this.onPageSizeChanged=t=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(t))},this.onEngineEditModeChanged=t=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(t))},this.config=o}}class kn{constructor(o){g(this,gt);this.getAll=async()=>(await a(this,gt)).getVariables().then(e=>i(e)),this.getById=async t=>(await a(this,gt)).getVariableById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,gt)).getVariableByName(t).then(r=>i(r)),this.setListVariable=async(t,e)=>(await a(this,gt)).setListVariableItems(t,e.map(n=>JSON.stringify(n))).then(n=>i(n)),y(this,gt,o),this.image=new _n(o)}}gt=new WeakMap;class _n{constructor(o){g(this,et);this.setAllowQuery=async(t,e)=>(await a(this,et)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowUpload=async(t,e)=>(await a(this,et)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinUploadSize=async(t,e,r)=>(await a(this,et)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setConnector=async(t,e)=>(await a(this,et)).setImageVariableConnector(t,JSON.stringify(e)).then(n=>i(n)),this.setConnectorContext=async(t,e)=>(await a(this,et)).setImageVariableConnectorContext(t,JSON.stringify(e)).then(n=>i(n)),y(this,et,o)}}et=new WeakMap;class Hn{constructor(o){g(this,vt);this.register=async t=>(await a(this,vt)).registerConnector(JSON.stringify(t)).then(r=>i(r)),this.getById=async t=>(await a(this,vt)).getConnectorById(t).then(r=>i(r)),this.getAllByType=async t=>(await a(this,vt)).getConnectors(t).then(r=>i(r)),y(this,vt,o)}}vt=new WeakMap;class xn{constructor(o){g(this,Gt);g(this,le);this.setWidth=async t=>(await a(this,Gt)).setPageWidth(t).then(r=>i(r)),this.setHeight=async t=>(await a(this,Gt)).setPageHeight(t).then(r=>i(r)),y(this,Gt,o),y(this,le,o)}}Gt=new WeakMap,le=new WeakMap;class qs{constructor(o,t,e){this.config=o,this.connection=t,this.editorAPI=e,this.subscriber=new Un(o),this.variable=new kn(this.editorAPI),this.connector=new Hn(this.editorAPI),this.page=new xn(this.editorAPI),this.canvas=new Ce(this.editorAPI)}}class Ys{constructor(o){this.logger=o}createEventHandlerFn(o,t){return(...r)=>{try{const n=o(...r);return n instanceof Promise?n.catch(c=>this.handleError(c,t,o.name)):n}catch(n){this.handleError(n,t,o.name)}}}handleError(o,t,e){var r;if(t===xt.log)(r=this.logger)==null||r.call(this,T.error,Vs.event,`Error in callback ${e}: ${o}`);else throw o}}class Zs extends Ys{constructor(o,t){super(t),this.handler=o}trigger(...o){const t=this.handler();if(t)return this.createEventHandlerFn(t,xt.throw)(...o)}}class w extends Ys{constructor(o,t){super(t),this.legacyHandler=o,this.subscriptions=new Set}trigger(...o){const t=this.legacyHandler();t&&this.createEventHandlerFn(t,xt.log)(...o);for(const e of this.subscriptions)e(...o)}registerCallback(o,t=xt.log){const e=this.createEventHandlerFn(o,t);return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}}class ve{static createRuntimeConfig(o){var e,r,n,c,l,u,C,p,I,S,v,P,A,b,H,L,F,st,rt,Ut,kt,Lr,Mr,Nr,Rr,Vr,Tr,Gr,Br,Jr,Ur,kr,_r,Hr,xr;const t={...o};return t.logging={logLevel:((e=o.logging)==null?void 0:e.logLevel)||T.error,logger:((r=o.logging)==null?void 0:r.logger)||((ee,Ie,Ae)=>{var Kr;if(ve.isLoggingEnabled(ee,((Kr=t.logging)==null?void 0:Kr.logLevel)??T.error))switch(ee){case T.error:console.error(`[${Ie}] [${ee}] ${Ae}`);break;case T.warn:console.warn(`[${Ie}] [${ee}] ${Ae}`);break;default:console.log(`[${Ie}] [${ee}] ${Ae}`)}})},t.handlers={onAuthExpired:new Zs(()=>t.onAuthExpired,(n=t.logging)==null?void 0:n.logger),onViewportRequested:new Zs(()=>t.onViewportRequested,(c=t.logging)==null?void 0:c.logger)},t.events={onActionsChanged:new w(()=>t.onActionsChanged,(l=t.logging)==null?void 0:l.logger),onStateChanged:new w(()=>t.onStateChanged,(u=t.logging)==null?void 0:u.logger),onDocumentLoaded:new w(()=>t.onDocumentLoaded,(C=t.logging)==null?void 0:C.logger),onSelectedFramesLayoutChanged:new w(()=>t.onSelectedFramesLayoutChanged,(p=t.logging)==null?void 0:p.logger),onFramesLayoutChanged:new w(()=>t.onFramesLayoutChanged,(I=t.logging)==null?void 0:I.logger),onSelectedFramesContentChanged:new w(()=>t.onSelectedFramesContentChanged,(S=t.logging)==null?void 0:S.logger),onPageSelectionChanged:new w(()=>t.onPageSelectionChanged,(v=t.logging)==null?void 0:v.logger),onSelectedLayoutPropertiesChanged:new w(()=>t.onSelectedLayoutPropertiesChanged,(P=t.logging)==null?void 0:P.logger),onSelectedLayoutUnitChanged:new w(()=>t.onSelectedLayoutUnitChanged,(A=t.logging)==null?void 0:A.logger),onScrubberPositionChanged:new w(()=>t.onScrubberPositionChanged,(b=t.logging)==null?void 0:b.logger),onFrameAnimationsChanged:new w(()=>t.onFrameAnimationsChanged,(H=t.logging)==null?void 0:H.logger),onVariableListChanged:new w(()=>t.onVariableListChanged,(L=t.logging)==null?void 0:L.logger),onSelectedToolChanged:new w(()=>t.onSelectedToolChanged,(F=t.logging)==null?void 0:F.logger),onUndoStackStateChanged:new w(()=>t.onUndoStackStateChanged,(st=t.logging)==null?void 0:st.logger),onSelectedLayoutFramesChanged:new w(()=>t.onSelectedLayoutFramesChanged,(rt=t.logging)==null?void 0:rt.logger),onSelectedTextStyleChanged:new w(()=>t.onSelectedTextStyleChanged,(Ut=t.logging)==null?void 0:Ut.logger),onColorsChanged:new w(()=>t.onColorsChanged,(kt=t.logging)==null?void 0:kt.logger),onParagraphStylesChanged:new w(()=>t.onParagraphStylesChanged,(Lr=t.logging)==null?void 0:Lr.logger),onCharacterStylesChanged:new w(()=>t.onCharacterStylesChanged,(Mr=t.logging)==null?void 0:Mr.logger),onFontFamiliesChanged:new w(()=>t.onFontFamiliesChanged,(Nr=t.logging)==null?void 0:Nr.logger),onSelectedLayoutIdChanged:new w(()=>t.onSelectedLayoutIdChanged,(Rr=t.logging)==null?void 0:Rr.logger),onLayoutsChanged:new w(()=>t.onLayoutsChanged,(Vr=t.logging)==null?void 0:Vr.logger),onConnectorEvent:new w(()=>t.onConnectorEvent,(Tr=t.logging)==null?void 0:Tr.logger),onConnectorsChanged:new w(()=>t.onConnectorsChanged,(Gr=t.logging)==null?void 0:Gr.logger),onZoomChanged:new w(()=>t.onZoomChanged,(Br=t.logging)==null?void 0:Br.logger),onSelectedPageIdChanged:new w(()=>t.onSelectedPageIdChanged,t.logging.logger),onPagesChanged:new w(()=>t.onPagesChanged,t.logging.logger),onPageSnapshotInvalidated:new w(()=>t.onPageSnapshotInvalidated,t.logging.logger),onPageSizeChanged:new w(()=>t.onPageSizeChanged,(Jr=t.logging)==null?void 0:Jr.logger),onShapeCornerRadiusChanged:new w(()=>t.onShapeCornerRadiusChanged,(Ur=t.logging)==null?void 0:Ur.logger),onCropActiveFrameIdChanged:new w(()=>t.onCropActiveFrameIdChanged,(kr=t.logging)==null?void 0:kr.logger),onAsyncError:new w(()=>t.onAsyncError,(_r=t.logging)==null?void 0:_r.logger),onViewModeChanged:new w(()=>t.onViewModeChanged,(Hr=t.logging)==null?void 0:Hr.logger),onBarcodeValidationChanged:new w(()=>t.onBarcodeValidationChanged,(xr=t.logging)==null?void 0:xr.logger),onDataSourceIdChanged:new w(()=>t.onDataSourceIdChanged,t.logging.logger),onDocumentIssueListChanged:new w(()=>t.onDocumentIssueListChanged,t.logging.logger),onCustomUndoDataChanged:new w(()=>t.onCustomUndoDataChanged,t.logging.logger),onEngineEditModeChanged:new w(()=>t.onEngineEditModeChanged,t.logging.logger),onBrandKitMediaChanged:new w(()=>t.onBrandKitMediaChanged,t.logging.logger)},t}static isLoggingEnabled(o,t){return t==T.info||t==T.warn&&(o==T.warn||o==T.error)?!0:t==T.error&&o==T.error}}class Kn{isDatePropertyWrapper(o){return typeof o=="object"&&(o==null?void 0:o.type)==="date"}isDateObject(o){return o instanceof Date}mapEngineToDataItem(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDatePropertyWrapper(r)?new Date(r.value):r}),t}mapDataItemToEngine(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDateObject(r)?{value:r.getTime(),type:"date"}:r}),t}}class $n{constructor(o){g(this,yt);y(this,yt,o)}async getValue(o){return(await a(this,yt)).getConfigValue(o).then(e=>i(e))}async setValue(o,t){return(await a(this,yt)).setConfigValue(o,t).then(r=>i(r))}async updateStudioOptions(o){return(await a(this,yt)).updateStudioOptions(JSON.stringify(o)).then(e=>i(e))}async getEngineSessionId(){return(await a(this,yt)).getEngineSessionId().then(t=>i(t))}}yt=new WeakMap;class Qs extends $n{constructor(t,e){super(t);g(this,Bt);y(this,Bt,e)}async getValue(t){const e=a(this,Bt).get(t);return e!=null?i({status:200,success:!0,parsedData:e,data:e},!1):super.getValue(t)}async setValue(t,e){const r=super.setValue(t,e);return a(this,Bt).set(t,e),r}}Bt=new WeakMap;class Xs{constructor(o){g(this,_);this.getAll=async()=>(await a(this,_)).getGradients().then(e=>i(e)),this.getById=async t=>(await a(this,_)).getGradientById(t).then(r=>i(r)),this.create=async()=>(await a(this,_)).createGradient().then(e=>i(e)),this.duplicate=async t=>(await a(this,_)).duplicateGradient(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,_)).moveGradients(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,_)).renameGradient(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,_),n=e;return r.updateGradient(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,_)).removeGradient(t).then(r=>i(r)),y(this,_,o)}}_=new WeakMap;class tr{constructor(o){g(this,It);g(this,te);this.query=async(t,e,r={})=>(await a(this,It)).componentConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.preview=async(t,e,r,n={})=>(await a(this,te)).componentConnectorPreview(t,e,r,JSON.stringify(n)).then(l=>{if(l instanceof Uint8Array)return l;throw typeof l=="object"&&l!==null&&"success"in l&&!l.success&&ye(l),new Error(`Unexpected response type: ${typeof l}.`)}),this.getConfigurationOptions=async t=>(await a(this,It)).componentConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,It)).componentConnectorGetCapabilities(t).then(r=>i(r)),y(this,It,o),y(this,te,o)}}It=new WeakMap,te=new WeakMap;class er{constructor(o){g(this,Jt);this.linkVariable=async(t,e,r)=>(await a(this,Jt)).linkComponentVariable(t,e,r,null).then(c=>i(c)),this.getComponentVariables=async t=>(await a(this,Jt)).getComponentVariables(t).then(r=>i(r)),y(this,Jt,o)}}Jt=new WeakMap;const zn=`https://studio-cdn.chiligrafx.com/editor/${R.current}/web`;let at;class Wn{constructor(o){this.localConfig=new Map,this.dataItemMappingTools=new Kn,this.loadEditor=()=>{var t;mn(this.config.editorLink||zn,{onActionsChanged:this.subscriber.onActionsChanged,onStateChanged:this.subscriber.onStateChanged,onAuthExpired:this.subscriber.onAuthExpired,onViewportRequested:this.subscriber.onViewportRequested,onDocumentLoaded:this.subscriber.onDocumentLoaded,onSelectedFramesContentChanged:this.subscriber.onSelectedFramesContentChanged,onSelectedFramesLayoutChanged:this.subscriber.onSelectedFramesLayoutChanged,onFramesLayoutChanged:this.subscriber.onFramesLayoutChanged,onSelectedLayoutPropertiesChanged:this.subscriber.onSelectedLayoutPropertiesChanged,onSelectedLayoutUnitChanged:this.subscriber.onSelectedLayoutUnitChanged,onPageSelectionChanged:this.subscriber.onPageSelectionChanged,onScrubberPositionChanged:this.subscriber.onAnimationPlaybackChanged,onFrameAnimationsChanged:this.subscriber.onAnimationChanged,onVariableListChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onVariableListChanged?this.next.subscriber.onVariableListChanged(e):this.subscriber.onVariableListChanged(e)},onSelectedToolChanged:this.subscriber.onSelectedToolChanged,onUndoStateChanged:this.subscriber.onUndoStateChanged,onSelectedLayoutFramesChanged:this.subscriber.onSelectedLayoutFramesChanged,onSelectedTextStyleChanged:this.subscriber.onSelectedTextStyleChanged,onColorsChanged:this.subscriber.onColorsChanged,onParagraphStylesChanged:this.subscriber.onParagraphStylesChanged,onCharacterStylesChanged:this.subscriber.onCharacterStylesChanged,onFontFamiliesChanged:this.subscriber.onFontFamiliesChanged,onSelectedLayoutIdChanged:this.subscriber.onSelectedLayoutIdChanged,onLayoutsChanged:this.subscriber.onLayoutsChanged,onConnectorEvent:this.subscriber.onConnectorEvent,onConnectorsChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onConnectorsChanged?this.next.subscriber.onConnectorsChanged(e):this.subscriber.onConnectorsChanged(e)},onZoomChanged:this.subscriber.onZoomChanged,onSelectedPageIdChanged:this.subscriber.onSelectedPageIdChanged,onPagesChanged:this.subscriber.onPagesChanged,onPageSnapshotInvalidated:this.subscriber.onPageSnapshotInvalidated,onPageSizeChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onPageSizeChanged?this.next.subscriber.onPageSizeChanged(e):this.subscriber.onPageSizeChanged(e)},onShapeCornerRadiusChanged:this.subscriber.onShapeCornerRadiusChanged,onCropActiveFrameIdChanged:this.subscriber.onCropActiveFrameIdChanged,onAsyncError:this.subscriber.onAsyncError,onViewModeChanged:this.subscriber.onViewModeChanged,onBarcodeValidationChanged:this.subscriber.onBarcodeValidationChanged,onDataSourceIdChanged:this.subscriber.onDataSourceIdChanged,onDocumentIssueListChanged:this.subscriber.onDocumentIssueListChanged,onCustomUndoDataChanged:this.subscriber.onCustomUndoDataChanged,onEngineEditModeChanged:this.subscriber.onEngineEditModeChanged,onBrandKitMediaChanged:this.subscriber.onBrandKitMediaChanged},this.setConnection,this.config.editorId,this.config.studioStyling,e=>{var r,n;(n=(r=this.config).onConnectionError)==null||n.call(r,e)}),this.editorAPI=at==null?void 0:at.promise.then(e=>e),this.action=new Re(this.editorAPI),this.layout=new Ls(this.editorAPI),this.frame=new Os(this.editorAPI),this.barcode=new ke(this.editorAPI),this.component=new er(this.editorAPI),this.animation=new Ve(this.editorAPI),this.document=new ls(this.editorAPI),this.configuration=new Qs(this.editorAPI,this.localConfig),this.utils=new Ws(this.editorAPI,this.localConfig),this.tool=new $s(this.editorAPI),this.page=new Ns(this.editorAPI),this.debug=new hs(this.editorAPI),this.undoManager=new zs(this.editorAPI,this),this.textSelection=new _s(this.editorAPI),this.colorStyle=new je(this.editorAPI),this.gradientStyle=new Xs(this.editorAPI),this.paragraphStyle=new Rs(this.editorAPI),this.characterStyle=new $e(this.editorAPI),this.mediaConnector=new Ms(this.editorAPI),this.fontConnector=new Fs(this.editorAPI),this.componentConnector=new tr(this.editorAPI),this.dataConnector=new os(this.editorAPI,this.dataItemMappingTools),this.dataSource=new cs(this.editorAPI,this.dataItemMappingTools),this.connector=new is(this.editorAPI,this.localConfig),this.variable=new js(this.editorAPI),this.font=new Es(this.editorAPI),this.experiment=new Ps(this.editorAPI),this.canvas=new Ce(this.editorAPI),this.shape=new Se(this.editorAPI),this.colorConversion=new We(this.editorAPI),this.info=new Ds,this.clipboard=new ze(this.editorAPI),this.brandKit=new Ke(this.editorAPI,this),this.next=new qs(this.config,this.connection,this.editorAPI),this.configuration.setValue(Y.GraFxStudioSdkVersion,Pe.version),this.configuration.setValue(Y.GraFxStudioDocumentType,this.config.documentType||ge.template),this.configuration.updateStudioOptions(this.config.studioOptions||fn),this.configuration.setValue(Y.QueryCallCacheEnabled,((t=this.config.enableQueryCallCache)==null?void 0:t.toString())||"false")},this.setConnection=t=>{at=t},this.config=ve.createRuntimeConfig(o),this.connection=at,this.editorAPI=at==null?void 0:at.promise.then(t=>t),this.action=new Re(this.editorAPI),this.layout=new Ls(this.editorAPI),this.frame=new Os(this.editorAPI),this.shape=new Se(this.editorAPI),this.barcode=new ke(this.editorAPI),this.component=new er(this.editorAPI),this.undoManager=new zs(this.editorAPI,this),this.connector=new is(this.editorAPI,this.localConfig),this.mediaConnector=new Ms(this.editorAPI),this.fontConnector=new Fs(this.editorAPI),this.componentConnector=new tr(this.editorAPI),this.dataConnector=new os(this.editorAPI,this.dataItemMappingTools),this.dataSource=new cs(this.editorAPI,this.dataItemMappingTools),this.animation=new Ve(this.editorAPI),this.document=new ls(this.editorAPI),this.configuration=new Qs(this.editorAPI,this.localConfig),this.variable=new js(this.editorAPI),this.utils=new Ws(this.editorAPI,this.localConfig),this.subscriber=new Vn(this.config,this.localConfig),this.tool=new $s(this.editorAPI),this.page=new Ns(this.editorAPI),this.debug=new hs(this.editorAPI),this.textSelection=new _s(this.editorAPI),this.colorStyle=new je(this.editorAPI),this.gradientStyle=new Xs(this.editorAPI),this.paragraphStyle=new Rs(this.editorAPI),this.characterStyle=new $e(this.editorAPI),this.font=new Es(this.editorAPI),this.experiment=new Ps(this.editorAPI),this.canvas=new Ce(this.editorAPI),this.colorConversion=new We(this.editorAPI),this.info=new Ds,this.clipboard=new ze(this.editorAPI),this.next=new qs(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=new Ke(this.editorAPI,this)}}var sr=(s=>(s.top="top",s.left="left",s.right="right",s.bottom="bottom",s.topLeft="topLeft",s.topRight="topRight",s.bottomLeft="bottomLeft",s.bottomRight="bottomRight",s))(sr||{}),rr=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(rr||{}),nr=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))(nr||{}),ar=(s=>(s.quadratic="Quadratic",s.cubic="Cubic",s.quartic="Quartic",s.quintic="Quintic",s.sine="Sine",s.exponential="Exponential",s.circular="Circular",s.elastic="Elastic",s.bounce="Bounce",s.back="Back",s))(ar||{}),ir=(s=>(s.bounce="bounce",s.flash="flash",s.headshake="headShake",s.heartbeat="heartbeat",s.pulse="pulse",s.rubberBand="rubberBand",s.vertical="vertical",s.horizontal="horizontal",s.swing="swing",s.tada="tada",s))(ir||{}),or=(s=>(s.preview="preview",s.normal="normal",s))(or||{}),cr=(s=>(s.linear="linear",s))(cr||{}),hr=(s=>(s.local="linearLocal",s.linearBrandKit="linearBrandKit",s))(hr||{}),lr=(s=>(s.Square="square",s.Line="line",s))(lr||{}),dr=(s=>(s.thumbnail="thumbnail",s.highest="highest",s.medium="medium",s))(dr||{}),ur=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(ur||{}),gr=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(gr||{}),yr=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(yr||{}),pr=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(pr||{}),Cr=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(Cr||{}),wr=(s=>(s.none="none",s.bullet="bullet",s.number="number",s))(wr||{}),mr=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(mr||{}),fr=(s=>(s.PARAGRAPH="paragraphStyleId",s.CHARACTER="characterStyleId",s.FONT_FAMILY="fontKey",s.FONT_STYLE="fontStyle",s.FONT_SIZE="fontSize",s.LETTER_SPACING="letterSpacing",s.LINE_HEIGHT="lineHeight",s.TEXT_ALIGN="textAlign",s.VERTICAL_ALIGN="verticalAlign",s.TYPOGRAPHIC_CASE="typographicCase",s.SUB_SUPER_SCRIPT="subSuperScript",s.UNDERLINE="underline",s.LINE_THROUGH="lineThrough",s.FILL_COLOR="fillColor",s.COLOR="color",s.FILL_COLOR_APPLIED="fillColorApplied",s.STROKE_COLOR="strokeColor",s.STROKE_COLOR_APPLIED="strokeColorApplied",s.DROP_SHADOW_COLOR="dropShadowColor",s.BLEND_MODE="blendMode",s.OPACITY="opacity",s.TRACKING_RIGHT="trackingRight",s.BASELINE_SHIFT="baselineShiftValue",s.STROKE_WIDTH="strokeWidth",s.MARKED_LIST_TYPE="markedListType",s.MARKED_LIST_GROUP="markedListGroup",s.MARKED_LIST_LEVEL="markedListLevel",s))(fr||{}),Sr=(s=>(s.arabic="arabic",s.romanUpperCase="romanUpperCase",s.romanLowerCase="romanLowerCase",s.latinUpperCase="latinUpperCase",s.latinLowerCase="latinLowerCase",s))(Sr||{}),br=(s=>(s.none="none",s.dash="dash",s.dot="dot",s.colon="colon",s.roundBracket="roundBracket",s))(br||{}),vr=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(vr||{}),Ir=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s))(Ir||{}),Ar=(s=>(s.all="all",s.only="only",s.none="none",s))(Ar||{}),Pr=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s.gradient="gradient",s))(Pr||{}),Fr=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Fr||{});const jn=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:Fr},Symbol.toStringTag,{value:"Module"}));h.ActionAsyncError=Ts,h.ActionEditorEvent=vr,h.Alignment=gr,h.AnchorTargetEdgeType=As,h.AnchorTargetType=Is,h.AuthCredentialsTypeEnum=rs,h.AuthRefreshTypeEnum=ns,h.AutoGrowDirection=ds,h.BarcodeCharacterSet=Ct,h.BarcodeErrorCorrectionLevel=At,h.BarcodeSourceTypeEnum=ys,h.BarcodeType=x,h.BarcodeValidationResult=Te,h.BasicAnimationsEmphasisStyles=ir,h.BlendMode=ms,h.Case=pr,h.ColorType=Q,h.ColorUsageType=re,h.ComponentPreviewType=dr,h.ComponentSourceTypeEnum=us,h.ConnectorConfigContextType=Xe,h.ConnectorConfigValueType=Qe,h.ConnectorEventType=ss,h.ConnectorHttpError=Ne,h.ConnectorMapping=Fn,h.ConnectorMappingDirection=es,h.ConnectorMappingSource=ts,h.ConnectorRegistrationSource=Et,h.ConnectorStateType=ie,h.ConnectorType=qe,h.ConstraintMode=Ue,h.CornerRadiusType=Ar,h.CropType=fe,h.DataRowAsyncError=Gs,h.Day=Bs,h.DeprecatedMediaConnectorDownloadType=ae,h.DeprecatedMediaType=Pt,h.DocumentIssueTypeEnum=Me,h.DocumentType=ge,h.DownloadFormats=Ks,h.EaseTypes=nr,h.EngineEditModeType=Pr,h.EnvironmentType=he,h.FitMode=fs,h.FitModePosition=Ss,h.FlowDirection=Cs,h.FontPreviewFormat=lr,h.FontWeights=ur,h.FrameAnchorTarget=Nn,h.FrameAnchorType=vs,h.FrameEditingMode=Le,h.FramePropertyNames=Hs,h.FrameTypeEnum=gs,h.GradientType=cr,h.GradientUsageType=hr,h.GrafxTokenAuthCredentials=On,h.ImageSourceTypeEnum=Ht,h.LayoutIntent=Je,h.LayoutPropertyNames=xs,h.LayoutType=Be,h.Locale=Js,h.MarkedListType=wr,h.MeasurementUnit=Ge,h.MediaDownloadIntent=be,h.MediaDownloadType=oe,h.MediaType=Ft,h.Next=jn,h.NumberListFormat=Sr,h.NumberListSeparatorSymbol=br,h.PageAnchorTarget=Mn,h.PositionEnum=Z,h.RefreshedAuthCredendentials=Dn,h.Scripting=Cr,h.SelectedTextStyleSections=mr,h.SelectedTextStyles=fr,h.ShakeDirections=rr,h.ShapeType=Ir,h.SlideDirections=sr,h.SortBy=Ye,h.SortOrder=Ze,h.TextDirection=ps,h.TextPosition=yr,h.ToolType=$,h.TweenTypes=ar,h.UpdateZIndexMethod=bs,h.UploadAssetValidationError=as,h.UploadAssetValidationErrorType=we,h.VariableType=ce,h.VariableVisibilityOperator=ks,h.VariableVisibilityTargetType=Us,h.VariableVisibilityType=Ot,h.VerticalAlign=ws,h.ViewMode=or,h.WellKnownConfigurationKeys=Y,h.default=Wn,h.grafxMediaConnectorRegistration=En,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
68
|
+
</html>`;s.srcdoc=n};let se=null;const mn=(s,o,t,e="chili-editor",r,n)=>{se&&window.removeEventListener("message",se);const c=`#${e}`,l=document.createElement("iframe");l.setAttribute("srcdoc"," "),l.setAttribute("title","Chili-Editor"),l.setAttribute("style","width: 100%; height: 100%;"),l.setAttribute("frameBorder","0"),l.setAttribute("referrerpolicy","origin");const u=()=>{const C=document.querySelector(c);if(C){C==null||C.appendChild(l),l.addEventListener("error",()=>{const p=new Error("Failed to setup frame: iframe failed to load");n==null||n(p)},{capture:!0,once:!0});try{wn(l,s,r)}catch(p){p instanceof Error?n==null||n(p):n==null||n(new Error(`Failed to setup frame: ${p}`))}}};document.readyState==="complete"||document.readyState==="interactive"?u():document.addEventListener("DOMContentLoaded",()=>{u()}),se=C=>{var p;if(C.source===l.contentWindow&&((p=C.data)==null?void 0:p.type)==="iframe-error"){const I=C.data.error,S=new Error(I.message||"Failed to setup frame: error in iframe");n==null||n(S)}},window.addEventListener("message",se),t(pn({iframe:l,methods:{actionsChanged:o.onActionsChanged,stateChanged:o.onStateChanged,documentLoaded:o.onDocumentLoaded,authExpired:o.onAuthExpired,viewportRequested:o.onViewportRequested,selectedFramesContent:o.onSelectedFramesContentChanged,selectedFramesLayout:o.onSelectedFramesLayoutChanged,allFramesLayout:o.onFramesLayoutChanged,selectedLayoutProperties:o.onSelectedLayoutPropertiesChanged,openLayoutPropertiesPanel:o.onPageSelectionChanged,selectedLayoutUnit:o.onSelectedLayoutUnitChanged,scrubberPositionChanged:o.onScrubberPositionChanged,frameAnimationsChanged:o.onFrameAnimationsChanged,selectedToolChanged:o.onSelectedToolChanged,variableListChanged:o.onVariableListChanged,undoStackStateChanged:o.onUndoStateChanged,selectedLayoutFramesChanged:o.onSelectedLayoutFramesChanged,selectedTextStyleChanged:o.onSelectedTextStyleChanged,colorsChanged:o.onColorsChanged,paragraphStylesChanged:o.onParagraphStylesChanged,characterStylesChanged:o.onCharacterStylesChanged,fontFamiliesChanged:o.onFontFamiliesChanged,selectedLayoutId:o.onSelectedLayoutIdChanged,layoutListChanged:o.onLayoutsChanged,connectorEvent:o.onConnectorEvent,connectorsChanged:o.onConnectorsChanged,zoomChanged:o.onZoomChanged,pageSnapshotInvalidated:o.onPageSnapshotInvalidated,pagesChanged:o.onPagesChanged,pageSizeChanged:o.onPageSizeChanged,shapeCornerRadiusChanged:o.onShapeCornerRadiusChanged,cropActiveFrameIdChanged:o.onCropActiveFrameIdChanged,asyncError:o.onAsyncError,viewModeChanged:o.onViewModeChanged,barcodeValidationChanged:o.onBarcodeValidationChanged,selectedPageIdChanged:o.onSelectedPageIdChanged,dataSourceIdChanged:o.onDataSourceIdChanged,documentIssueListChanged:o.onDocumentIssueListChanged,customUndoDataChanged:o.onCustomUndoDataChanged,engineEditingModeChanged:o.onEngineEditModeChanged,brandKitMediaChanged:o.onBrandKitMediaChanged}}))};var Y=(s=>(s.GraFxStudioEnvironmentApiUrl="ENVIRONMENT_API",s.GraFxStudioSdkVersion="SDK_VERSION",s.GraFxStudioDocumentType="DOCUMENT_TYPE",s.GraFxStudioTemplateId="TEMPLATE_ID",s.GraFxStudioAuthToken="GRAFX_AUTH_TOKEN",s.QueryCallCacheEnabled="ENABLE_QUERY_CALL_CACHE",s))(Y||{}),Le=(s=>(s.full="full",s.followConstraints="followConstraints",s))(Le||{});const fn={shortcutOptions:{debugPanel:{enabled:!1},ellipse:{enabled:!1},hand:{enabled:!1},temporaryHand:{enabled:!1},image:{enabled:!1},polygon:{enabled:!1},rectangle:{enabled:!1},select:{enabled:!1},text:{enabled:!1},zoom:{enabled:!1},copyPaste:{enabled:!1},viewMode:{enabled:!1}},frameEditingMode:"full"};var Me=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(Me||{}),ge=(s=>(s.project="project",s.template="template",s.component="component",s))(ge||{});const Sn=404075;function ye(s){const o=s.error??"Yikes, something went wrong",t={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===Sn){const r=JSON.parse(s.data).statusCode;throw new Ne(r,o,t)}else throw new Error(o,t)}function i(s,o=!0){try{s.success||ye(s);const t=s.data&&o;return{...s,parsedData:t?JSON.parse(s.data):s.data}}catch(t){throw console.error(t),t}}class Ne extends Error{constructor(o,t,e){super(t,e),this.statusCode=o}}class Re{constructor(o){g(this,V);this.getAll=async()=>(await a(this,V)).getActions().then(e=>i(e)),this.getById=async t=>(await a(this,V)).getActionById(t).then(r=>i(r)),this.create=async()=>(await a(this,V)).createAction().then(e=>i(e)),this.duplicate=async t=>(await a(this,V)).duplicateAction(t).then(r=>i(r)),this.remove=async t=>(await a(this,V)).removeAction(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,V)).updateAction(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>this.update(t,{name:e}),this.updateScript=async(t,e)=>this.update(t,{script:e}),this.updateTriggers=async(t,e)=>this.update(t,{triggers:e}),this.move=async(t,e)=>(await a(this,V)).moveActions(t,e).then(n=>i(n)),this.setTypeError=async(t,e)=>this.update(t,{hasTypeError:e}),this.disable=async()=>(await a(this,V)).disableActions().then(e=>i(e)),this.enable=async()=>(await a(this,V)).enableActions().then(e=>i(e)),y(this,V,o)}}V=new WeakMap;class Ve{constructor(o){g(this,M);this.getAllOnSelectedLayout=async()=>(await a(this,M)).getAnimationsOnSelectedLayout().then(e=>i(e)),this.getByFrameId=async(t,e)=>(await a(this,M)).getAnimationByFrameId(t,e).then(n=>i(n)),this.getByLayoutId=async t=>(await a(this,M)).getAnimationsByLayoutId(t).then(r=>i(r)),this.setFrameAnimation=async t=>(await a(this,M)).setFrameAnimation(JSON.stringify(t)).then(r=>i({...r,data:JSON.stringify(t)})),this.play=async()=>(await a(this,M)).playAnimation().then(e=>i(e)),this.pause=async()=>(await a(this,M)).pauseAnimation().then(e=>i(e)),this.setScrubberPosition=async t=>(await a(this,M)).setScrubberPosition(t).then(r=>i(r)),this.setDuration=async t=>(await a(this,M)).setAnimationDuration(t).then(r=>i(r)),this.resetFrameAnimation=async t=>(await a(this,M)).resetFrameAnimation(t).then(r=>i(r)),this.reset=async()=>(await a(this,M)).resetAnimation().then(e=>i(e)),y(this,M,o)}}M=new WeakMap;var x=(s=>(s.code39="code39",s.code93="code93",s.code128="code128",s.dataMatrix="dataMatrix",s.ean13="ean13",s.ean8="ean8",s.qr="qr",s.upca="upca",s.upce="upce",s.gs1128="gs1128",s))(x||{}),At=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(At||{}),Ct=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(Ct||{}),Te=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(Te||{}),Ge=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(Ge||{}),Z=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(Z||{}),Be=(s=>(s.top="top",s.child="child",s))(Be||{}),Je=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(Je||{}),Ue=(s=>(s.locked="locked",s.range="range",s.none="none",s))(Ue||{});class ke{constructor(o){g(this,z);this.setBarcodeProperties=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableBackground=async(t,e)=>{const r={enableBackground:e};return this.setBarcodeProperties(t,r)},this.setBackgroundColor=async(t,e)=>{const r={backgroundColor:e};return this.setBarcodeProperties(t,r)},this.setEnableBars=async(t,e)=>{const r={enableBars:e};return this.setBarcodeProperties(t,r)},this.setBarColor=async(t,e)=>{const r={barColor:e};return this.setBarcodeProperties(t,r)},this.setBarcodeSource=async(t,e)=>(await a(this,z)).setBarcodeSource(t,JSON.stringify(e)).then(n=>i(n)),this.removeBarcodeSource=async t=>(await a(this,z)).setBarcodeSource(t,null).then(r=>i(r)),this.setEnableText=async(t,e)=>{const r={enableText:e};return this.setBarcodeProperties(t,r)},this.setBarHeight=async(t,e)=>{const r={barHeight:e};return this.setBarcodeProperties(t,r)},this.setMagnification=async(t,e)=>{const r={magnification:e};return this.setBarcodeProperties(t,r)},this.setQuietZoneValue=async(t,e,r)=>{const n=r?{left:r===Z.left?e:void 0,top:r===Z.top?e:void 0,right:r===Z.right?e:void 0,bottom:r===Z.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:n})).then(l=>i(l))},this.setAreQuietZoneValuesCombined=async(t,e)=>{const r={areQuietZoneValuesCombined:e};return(await a(this,z)).setBarcodeProperties(t,JSON.stringify({quietZone:r})).then(c=>i(c))},this.setErrorCorrectionLevel=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({errorCorrectionLevel:e})).then(n=>i(n)),this.setCharacterSet=async(t,e)=>(await a(this,z)).setBarcodeProperties(t,JSON.stringify({characterSet:e})).then(n=>i(n)),this.setDrawLightMarginIndicator=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.setDrawStartStopChars=async(t,e)=>{const r={drawStartStopChars:e};return this.setBarcodeProperties(t,r)},this.getBarcodeConfigationOptions=t=>{let e=!0,r=!0,n=!0,c,l,u=!1,C=!1,p=!1;switch(t){case x.qr:c=[Ct.iso8859_1,Ct.utf8],l=[At.low,At.medium,At.quartile,At.high];case x.dataMatrix:e=!1,r=!1,n=!1,u=!0;break;case x.ean13:e=!1,C=!0;break;case x.ean8:C=!0;case x.upca:case x.upce:e=!1;break;case x.code128:case x.gs1128:c=[Ct.code128a,Ct.code128b,Ct.code128c];break;case x.code39:p=!0;break}return{allowEnableMagnification:n,allowBarHeight:r,allowQuietZone:!0,allowedCharacterSets:c,allowedErrorCorrectionLevels:l,allowToggleText:e,quietZoneAlwaysCombined:u,allowToggleLightMarginIndicator:C,allowToggleDrawStartAndEndChar:p}},y(this,z,o)}}z=new WeakMap;var K=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(K||{}),Q=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.gray="gray",s.hsl="hsl",s.spot="spot",s.spotCMYK="spotCMYK",s.spotRGB="spotRGB",s.spotHEX="spotHEX",s))(Q||{}),re=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(re||{});const _e=s=>s.type===K.hex,pe=s=>s.type===K.spotHex,bn=s=>s.type===K.spotRgb,vn=s=>s.type===K.spotCmyk,In=s=>bn(s)||vn(s)||pe(s),An=s=>{const o=Pn(s.type);return In(s)?{...pe(s)&&{value:s.displayValue},...!pe(s)&&{...s.displayValue},spotName:s.value,type:o}:{..._e(s)&&{value:s.value},...!_e(s)&&{...s.value},type:o}},He=(s,o,t,e)=>{const{brandKitColorGuid:r,brandKitFontFamilyGuid:n,fontStyleId:c,textStrokeColorGuid:l,textStrokeColorApplied:u,textStrokeWidth:C,...p}=s;return{...Object.keys(p).reduce((S,v)=>({...S,[v]:{value:s[v]}}),{}),...o&&{color:{value:{id:o.id,color:o.color,type:re.brandKit,isApplied:p.fillColorApplied}}},...t&&{strokeColor:{value:{id:t.id,color:t.color,type:re.brandKit,isApplied:u||!1}},strokeColorApplied:{value:u||!1},strokeWidth:{value:C!=null?C.toString():C}},fontKey:{value:e??null}}},Pn=s=>{switch(s){case K.rgb:return Q.rgb;case K.cmyk:return Q.cmyk;case K.hex:return Q.hex;case K.spotRgb:return Q.spotRGB;case K.spotCmyk:return Q.spotCMYK;case K.spotHex:return Q.spotHEX}},ne=(s,o)=>{if(!(s===null||o===void 0))return(s||[]).find(t=>t.id===o)},xe=(s,o,t)=>{var e,r;if(!(s===null||o===void 0||t===void 0))return(r=(e=(s||[]).find(n=>n.id===o))==null?void 0:e.fontStyles.find(n=>n.fontStyleId===t))==null?void 0:r.id};class Ke{constructor(o,t){g(this,N);this.getId=async()=>(await a(this,N)).getBrandKitId().then(r=>i(r)),this.getVersion=async()=>(await a(this,N)).getBrandKitVersion().then(r=>i(r)),this.getName=async()=>(await a(this,N)).getBrandKitName().then(r=>i(r)),this.rename=async e=>(await a(this,N)).renameBrandKit(e).then(n=>i(n)),this.updateIdAndVersion=async(e,r)=>(await a(this,N)).updateBrandKitIdAndVersion(e,r).then(c=>i(c)),this.get=async()=>{const e=await this.getId(),r=await this.getVersion(),n=await this.getName(),c=this.colorStyleController.getAll(),l=this.gradientStyleController.getAll(),u=this.fontController.getFontFamilies(),C=this.characterStyleController.getAll(),p=this.paragraphStyleController.getAll(),I=this.getAllMedia(),[S,v,P,A,b,H]=await Promise.all([c,l,u,p,C,I]),L={id:e.parsedData,brandKit:{id:e.parsedData,name:n.parsedData,lastModifiedDate:r.parsedData,colors:S.parsedData,gradients:v.parsedData,fonts:P.parsedData,paragraphStyles:A.parsedData,characterStyles:b.parsedData,media:H.parsedData}},F={success:!0,data:JSON.stringify(L),parsedData:L,status:200};return i(F)},this.getAllMedia=async()=>(await a(this,N)).getAllBrandKitMedia().then(r=>i(r)),this.addMedia=async(e,r,n)=>(await a(this,N)).addBrandKitMedia(e,r,n).then(l=>i(l)),this.updateMedia=async(e,r,n)=>(await a(this,N)).updateBrandKitMedia(e,r,n).then(l=>i(l)),this.renameMedia=async(e,r)=>(await a(this,N)).renameBrandKitMedia(e,r).then(c=>i(c)),this.removeMedia=async e=>(await a(this,N)).removeBrandKitMedia(e).then(n=>i(n)),this.remove=async()=>{const r=(await this.colorStyleController.getAll()).parsedData||[],c=(await this.gradientStyleController.getAll()).parsedData||[],u=(await this.paragraphStyleController.getAll()).parsedData||[],p=(await this.characterStyleController.getAll()).parsedData||[],S=(await this.fontController.getFontFamilies()).parsedData||[],P=(await this.getAllMedia()).parsedData||[];await this.undoManagerController.record("brandKit.remove",async A=>{for(const b of r)await A.colorStyle.remove(b.id);for(const b of c)await A.gradientStyle.remove(b.id);for(const b of u)await A.paragraphStyle.remove(b.id);for(const b of p)await A.characterStyle.remove(b.id);for(const b of S)await A.font.removeFontFamily(b.id);for(const b of P)await this.removeMedia(b.name)})},this.set=async e=>{let r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:[],gradients:[],fonts:[],paragraphStyles:[],characterStyles:[],media:[]}};return await this.undoManagerController.record("brandKit.set",async n=>{const c=await this.setColors(e,n);await this.setGradients(e,n);const l=await this.setFonts(e,n),{parsedData:u=[]}=await n.colorStyle.getAll(),{parsedData:C=[]}=await n.gradientStyle.getAll(),{parsedData:p}=await n.font.getFontFamilies();await this.setParagraphStyles(e,n,{localColors:u,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setCharacterStyles(e,n,{localColors:u,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setMedia(e);const{parsedData:I}=await n.paragraphStyle.getAll(),{parsedData:S}=await n.characterStyle.getAll(),{parsedData:v}=await this.getAllMedia();await n.brandKit.updateIdAndVersion(e.id,e.brandKit.lastModifiedDate),await n.brandKit.rename(e.brandKit.name),r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:u||[],gradients:C||[],fonts:p||[],paragraphStyles:I||[],characterStyles:S||[],media:v||[]}}}),r},y(this,N,o),this.colorStyleController=t.colorStyle,this.gradientStyleController=t.gradientStyle,this.fontController=t.font,this.mediaController=t.mediaConnector,this.paragraphStyleController=t.paragraphStyle,this.characterStyleController=t.characterStyle,this.undoManagerController=t.undoManager}async setColors(o,t){const e=new Map;for(const r of o.brandKit.colors||[]){const{parsedData:n}=await t.colorStyle.create();if(!n)continue;e.set(r.guid,n);const c=An(r);await t.colorStyle.rename(n,r.name),await t.colorStyle.update(n,c)}return e}async setGradients(o,t){return new Map}async setFonts(o,t){const e=o.fontConnectorId,r=new Map;for(const n of o.brandKit.fonts||[]){const{parsedData:c=[]}=await t.fontConnector.detail(e,n.fontFamilyId);if(!(c!=null&&c[0]))throw new Error(`No font styles for family ID: ${n.fontFamilyId}`);const{parsedData:l}=await t.font.addFontFamily(e,{name:c[0].familyName,fontFamilyId:n.fontFamilyId});l&&r.set(n.fontFamilyBrandKitGuid,l)}return r}async setParagraphStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:l}=e;for(const u of o.brandKit.paragraphStyles||[]){const C=c.get(u.brandKitColorGuid),p=c.get(u.textStrokeColorGuid),I=l.get(u.brandKitFontFamilyGuid),S=xe(n,I,u.fontStyleId);if(!I||!S)throw new Error(`Paragraph style could not be created with an empty font family: ${u.name}`);const v=ne(r,C),P=ne(r,p);if(!v)throw new Error(`Paragraph style could not be created with an empty color: ${u.name}`);const{parsedData:A}=await t.paragraphStyle.create(),b=He(u,v,P,`${S}`);await t.paragraphStyle.rename(A,u.name),await t.paragraphStyle.update(A,b)}}async setCharacterStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:l}=e;for(const u of o.brandKit.characterStyles||[]){const C=u.brandKitColorGuid?c.get(u.brandKitColorGuid):void 0,p=u.textStrokeColorGuid?c.get(u.textStrokeColorGuid):void 0,I=u.brandKitFontFamilyGuid?l.get(u.brandKitFontFamilyGuid):void 0,S=ne(r,C),v=ne(r,p),P=xe(n,I,u.fontStyleId),{parsedData:A}=await t.characterStyle.create(),b=He(u,S,v,P);await t.characterStyle.rename(A,u.name),await t.characterStyle.update(A,b)}}async setMedia(o){for(const t of o.brandKit.media||[])await this.addMedia(t.name,t.mediaConnectorId,t.mediaId)}}N=new WeakMap;class Ce{constructor(o){g(this,it);this.zoomToPage=async(t,e,r,n,c)=>(t!==void 0&&console.warn("id has no effect and will be deprecated in the future"),(await a(this,it)).zoomToPage(e,r,n,c).then(u=>i(u))),this.getZoomPercentage=async()=>(await a(this,it)).getZoomPercentage().then(e=>i(e)),this.setZoomPercentage=async t=>(await a(this,it)).setZoomPercentage(t).then(r=>i(r)),this.setViewMode=async t=>(await a(this,it)).setViewMode(t).then(r=>i(r)),y(this,it,o)}}it=new WeakMap;class $e{constructor(o){g(this,G);this.getAll=async()=>(await a(this,G)).getCharacterStyles().then(e=>i(e)),this.getById=async t=>(await a(this,G)).getCharacterStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,G)).createCharacterStyle().then(e=>i(e)),this.update=async(t,e)=>(await a(this,G)).updateCharacterStyle(t,JSON.stringify(e)).then(n=>i(n)),this.remove=async t=>(await a(this,G)).removeCharacterStyle(t).then(r=>i(r)),this.duplicate=async t=>(await a(this,G)).duplicateCharacterStyle(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,G)).renameCharacterStyle(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,G)).moveCharacterStyles(t,e).then(n=>i(n)),y(this,G,o)}}G=new WeakMap;class ze{constructor(o){g(this,ot);this.copyFrames=async t=>{const r=await(await a(this,ot)).copyFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.cutFrames=async t=>{const r=await(await a(this,ot)).cutFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.pasteFrames=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.pasteFrames(e);return i(r)},this.getContentType=async()=>{const t=await a(this,ot),e=await navigator.clipboard.readText(),r=await t.getClipboardContentType(e);return i(r)},y(this,ot,o)}}ot=new WeakMap;class We{constructor(o){g(this,Kt);this.convertToRgb=async t=>(await a(this,Kt)).colorToRgb(JSON.stringify(t)).then(r=>i(r)),y(this,Kt,o)}}Kt=new WeakMap;class je{constructor(o){g(this,B);this.getAll=async()=>(await a(this,B)).getColors().then(e=>i(e)),this.getById=async t=>(await a(this,B)).getColorById(t).then(r=>i(r)),this.create=async()=>(await a(this,B)).createColor().then(e=>i(e)),this.duplicate=async t=>(await a(this,B)).duplicateColor(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,B)).moveColors(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,B)).renameColor(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,B),n=e;return n.type===Q.spot&&(n.type=Q.spotCMYK),r.updateColor(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,B)).removeColor(t).then(r=>i(r)),y(this,B,o)}}B=new WeakMap;var Pt=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(Pt||{}),ae=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(ae||{}),Ft=(s=>(s.file="file",s.collection="collection",s))(Ft||{}),qe=(s=>(s.media="media",s.fonts="fonts",s.data="data",s.components="components",s))(qe||{}),Ye=(s=>(s.name="name",s.path="relativePath",s.id="id",s))(Ye||{}),Ze=(s=>(s.ascending="asc",s.descending="desc",s))(Ze||{}),Qe=(s=>(s.text="text",s.boolean="boolean",s))(Qe||{}),Xe=(s=>(s.query="query",s.upload="upload",s))(Xe||{}),Et=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Et||{});class Fn{constructor(o,t,e,r="engineToConnector"){this.direction="engineToConnector",this.name=o,this.direction=r,t==="var"?this.value=`${t}.${e}`:this.value=e}}var ts=(s=>(s.variable="var",s.value="value",s))(ts||{}),es=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(es||{}),ie=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(ie||{}),ss=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(ss||{});const En={url:"grafx-media.json",source:"local"};class On{constructor(o){this.type="grafxToken",this.token=o}}class Dn{constructor(){this.type="refreshed"}}var rs=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(rs||{}),ns=(s=>(s.grafxToken="grafxToken",s.any="any",s))(ns||{}),we=(s=>(s.minDimension="minDimension",s))(we||{});class as extends Error{constructor(o,t){super(o),this.type=t}}class me{constructor(){this.makeConnectorSourceForwardsCompatible=o=>{if(o.source!=Et.grafx||this.isSourceMigrated(o))return o;let t=o.url;for(;t.endsWith("/");)t=t.substring(0,t.length-1);const e=t.split("/");return{id:e[e.length-1],source:Et.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(o,t)=>o.map(e=>this.makeSingleConnectorBackwardsCompatible(e,t)),this.makeSingleConnectorBackwardsCompatible=(o,t)=>o.source.source!=Et.grafx?o:{id:o.id,name:o.name,iconUrl:o.iconUrl,source:this.makeConnectorSourceBackwardsCompatible(o.source,t)},this.makeConnectorSourceBackwardsCompatible=(o,t)=>{let e=t;for(;e!=null&&e.endsWith("/");)e=e.substring(0,e.length-1);return{url:`${e}/connectors/${o.id}`,source:Et.grafx}},this.isSourceMigrated=o=>"id"in o}}let is=(Er=class{constructor(o,t){g(this,J);g(this,Dt);g(this,wt);this.getById=async e=>(await a(this,J)).getConnectorById(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,wt).makeSingleConnectorBackwardsCompatible(n.parsedData,a(this,Dt).get(Y.GraFxStudioEnvironmentApiUrl))),c}),this.getAllByType=async e=>(await a(this,J)).getConnectors(e).then(n=>i(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,wt).makeMultipleConnectorsBackwardsCompatible(n.parsedData,a(this,Dt).get(Y.GraFxStudioEnvironmentApiUrl))),c}),this.register=async e=>{const r=await a(this,J),n=a(this,wt).makeConnectorSourceForwardsCompatible(e);return r.registerConnector(JSON.stringify(n)).then(c=>i(c))},this.unregister=async e=>(await a(this,J)).unregisterConnector(e).then(n=>i(n)),this.configure=async(e,r)=>{const n=await a(this,J);return await this.waitToBeReady(e),await r(new Ln(e,n)),n.updateConnectorConfiguration(e).then(c=>i(c))},this.getState=async e=>(await a(this,J)).getConnectorState(e).then(n=>i(n)),this.getOptions=async e=>(await a(this,J)).getConnectorOptions(e).then(n=>i(n)),this.waitToBeReady=async(e,r=2e3)=>{let n=Math.max(r,500);n=Math.min(n,5e3);const c=100;let l=0;try{for(;l*c<n;){const u=await this.getState(e);if(u.success&&u.parsedData&&(u.parsedData.type===ie.running||u.parsedData.type===ie.ready))return i({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(C=>setTimeout(C,c)),l++}}catch(u){return i({data:null,success:!1,error:`Error while getting connector state ${u}`,status:5e4,parsedData:void 0},!1)}return i({data:null,success:!1,error:"Timed out waiting for connector",status:5e4,parsedData:void 0},!1)},this.updateMappings=async(e,r)=>await this.configure(e,async n=>{const{parsedData:c}=await this.getMappings(e),l=(c==null?void 0:c.filter(p=>!r.some(I=>I.name===p.name&&I.direction===p.direction)))??[],u=r.filter(p=>p.name!==""&&p.value!==""),C=[...l,...u];await n.setMappings(C)}),y(this,J,o),y(this,Dt,t),y(this,wt,new me)}async getMappings(o,t){return(await a(this,J)).getConnectorMappings(o).then(r=>i(r)).then(r=>{var n;return t?{...r,parsedData:(n=r.parsedData)==null?void 0:n.filter(c=>c.direction===t)}:r})}},J=new WeakMap,Dt=new WeakMap,wt=new WeakMap,Er);class Ln{constructor(o,t){g(this,mt);g(this,ft);this.setOptions=async e=>a(this,ft).setConnectorOptions(a(this,mt),JSON.stringify(e)).then(r=>i(r)),this.setMappings=async e=>{const r=await a(this,ft).setConnectorMappings(a(this,mt),e.map(function(n){return JSON.stringify(n)}));return i(r)},this.setHttpHeader=async(e,r)=>a(this,ft).connectorAuthenticationSetHttpHeader(a(this,mt),e,r).then(n=>i(n)),y(this,mt,o),y(this,ft,t)}}mt=new WeakMap,ft=new WeakMap;class os{constructor(o,t){g(this,ct);g(this,$t);this.getPage=async(e,r,n={})=>(await a(this,ct)).dataConnectorGetPage(e,JSON.stringify(r),JSON.stringify(n)).then(l=>i(l)).then(l=>{const u={...l,parsedData:null};return l.parsedData&&(u.parsedData={data:l.parsedData.data.map(C=>a(this,$t).mapEngineToDataItem(C)),continuationToken:l.parsedData.continuationToken}),u}),this.getModel=async(e,r={})=>(await a(this,ct)).dataConnectorGetModel(e,JSON.stringify(r)).then(c=>i(c)),this.getConfigurationOptions=async e=>(await a(this,ct)).dataConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,ct)).dataConnectorGetCapabilities(e).then(n=>i(n)),y(this,ct,o),y(this,$t,t)}}ct=new WeakMap,$t=new WeakMap;class cs{constructor(o,t){g(this,ht);g(this,zt);this.setDataSource=async e=>(await a(this,ht)).setDataSource(e).then(n=>i(n)),this.getDataSource=async()=>(await a(this,ht)).getDataSource().then(r=>i(r)),this.removeDataSource=async()=>(await a(this,ht)).removeDataSource().then(r=>i(r)),this.setDataRow=async e=>{const r=await a(this,ht),n=a(this,zt).mapDataItemToEngine(e);return r.setDataRow(JSON.stringify(n)).then(c=>i(c))},y(this,ht,o),y(this,zt,t)}}ht=new WeakMap,zt=new WeakMap;class hs{constructor(o){g(this,lt);this.getAllLogs=async()=>(await a(this,lt)).getLogs().then(e=>i(e)),this.toggleDebugPanel=async()=>(await a(this,lt)).toggleDebugPanel().then(e=>i(e)),this.enableDebug=async()=>(await a(this,lt)).enableDebug().then(e=>i(e)),this.disableDebug=async()=>(await a(this,lt)).disableDebug().then(e=>i(e)),y(this,lt,o)}}lt=new WeakMap;class ls{constructor(o){g(this,St);this.getCurrentState=async()=>(await a(this,St)).getCurrentDocumentState().then(e=>i(e)),this.load=async(t,e={keepConnectors:!1})=>{const r=await a(this,St),n=typeof t!="string"?JSON.stringify(t):t;return r.loadDocument(n,JSON.stringify(e)).then(c=>i(c))},this.createAndLoad=async t=>{const e=await a(this,St),r=JSON.stringify(t);return e.createAndLoadDocument(r).then(n=>i(n))},y(this,St,o)}}St=new WeakMap;var ds=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(ds||{}),Ht=(s=>(s.url="url",s.variable="variable",s.connector="connector",s.brandKitMedia="brandKitMedia",s))(Ht||{}),us=(s=>(s.connector="connector",s))(us||{}),gs=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s.component="component",s))(gs||{}),ys=(s=>(s.variable="variable",s.text="text",s))(ys||{}),ps=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(ps||{}),Cs=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(Cs||{}),ws=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(ws||{}),ms=(s=>(s.normal="normal",s.screen="screen",s.overlay="overlay",s.darken="darken",s.lighten="lighten",s.colorDodge="colorDodge",s.colorBurn="colorBurn",s.hardLight="hardLight",s.softLight="softLight",s.difference="difference",s.exclusion="exclusion",s.multiply="multiply",s.hue="hue",s.saturation="saturation",s.color="color",s.luminosity="luminosity",s))(ms||{}),fs=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(fs||{}),Ss=(s=>(s.topLeft="topLeft",s.topCenter="topCenter",s.topRight="topRight",s.centerLeft="centerLeft",s.center="center",s.centerRight="centerRight",s.bottomLeft="bottomLeft",s.bottomCenter="bottomCenter",s.bottomRight="bottomRight",s))(Ss||{}),bs=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(bs||{}),vs=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(vs||{}),Is=(s=>(s.page="page",s.frame="frame",s))(Is||{}),As=(s=>(s.start="start",s.end="end",s.center="center",s))(As||{});class Mn{constructor(){this.type="page"}}class Nn{constructor(o,t){this.type="frame",this.frameId=o,this.edge=t}}var fe=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(fe||{});class Ps{constructor(o){g(this,U);this.insertImageVariableToFrame=async(t,e)=>{const r=await a(this,U),n={id:e,type:Ht.variable};return r.setImageSource(t,JSON.stringify(n)).then(c=>i(c))},this.insertTextVariable=async t=>(await a(this,U)).insertTextVariable(t).then(r=>i(r)),this.enterTextEditMode=async t=>(await a(this,U)).enterTextEditMode(t).then(r=>i(r)),this.exitTextEditMode=async()=>(await a(this,U)).exitTextEditMode().then(e=>i(e)),this.getText=async(t,e)=>(await a(this,U)).getTextByFrameId(t,e).then(n=>i(n)),this.setText=async(t,e)=>(await a(this,U)).setTextByFrameId(t,e).then(n=>i(n)),this.selectText=async(t,e,r)=>(await a(this,U)).selectTextById(t,e,r).then(c=>i(c)),this.addCustomUndoData=async(t,e,r)=>(await a(this,U)).setCustomUndoData(t,e,r??!1).then(c=>i(c)),y(this,U,o)}}U=new WeakMap;class Fs{constructor(o){g(this,dt);g(this,Lt);this.query=async(t,e,r={})=>(await a(this,dt)).fontConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,dt)).fontConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r={})=>(await a(this,Lt)).fontConnectorDownload(t,e,JSON.stringify(r)).then(c=>c??c),this.preview=async(t,e,r,n={})=>(await a(this,Lt)).fontConnectorPreview(t,e,r,JSON.stringify(n)).then(l=>l??l),this.getConfigurationOptions=async t=>(await a(this,dt)).fontConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,dt)).fontConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedFontType=t=>{if(t===Pt.file)return Ft.file;if(t===Pt.collection)return Ft.collection},y(this,dt,o),y(this,Lt,o)}}dt=new WeakMap,Lt=new WeakMap;class Es{constructor(o){g(this,E);this.addFontFamily=async(t,e)=>(await a(this,E)).addFontFamily(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontFamily=async t=>(await a(this,E)).removeFontFamily(t).then(r=>i(r)),this.addFontStyle=async(t,e)=>(await a(this,E)).addFontStyle(t,JSON.stringify(e)).then(n=>i(n)),this.removeFontStyle=async t=>(await a(this,E)).removeFontStyle(t).then(r=>i(r)),this.getFontFamilies=async()=>(await a(this,E)).getFontFamilies().then(e=>i(e)),this.getFontStyles=async t=>(await a(this,E)).getFontStyles(t).then(r=>i(r)),this.getFontFamilyById=async t=>(await a(this,E)).getFontFamilyById(t).then(r=>i(r)),this.getFontStyleById=async t=>(await a(this,E)).getFontStyleById(t).then(r=>i(r)),this.getDefaultFontStyle=async()=>(await a(this,E)).getDefaultFontStyle().then(e=>i(e)),this.getDefaultFontFamily=async()=>(await a(this,E)).getDefaultFontFamily().then(e=>i(e)),this.isFontFamilyUsed=async t=>(await a(this,E)).isFontFamilyUsed(t).then(r=>i(r)),this.isFontStyleUsed=async t=>(await a(this,E)).isFontStyleUsed(t).then(r=>i(r)),this.moveFontFamilies=async(t,e)=>(await a(this,E)).moveFontFamilies(t,e).then(n=>i(n)),this.getPreviewsOfCharacterStrings=async(t,e)=>(await a(this,E)).getPreviewsOfCharacterStrings(t,JSON.stringify(e)).then(n=>i(n)),y(this,E,o)}}E=new WeakMap;class Se{constructor(o){g(this,Mt);this.setShapeProperties=async(t,e)=>(await a(this,Mt)).setShapeProperties(t,JSON.stringify(e)).then(n=>i(n)),this.setEnableFill=async(t,e)=>{const r={enableFill:e};return this.setShapeProperties(t,r)},this.setFillColor=async(t,e)=>{const r={fillColor:e};return this.setShapeProperties(t,r)},this.setEnableStroke=async(t,e)=>{const r={enableStroke:e};return this.setShapeProperties(t,r)},this.setStrokeColor=async(t,e)=>{const r={strokeColor:e};return this.setShapeProperties(t,r)},this.setStrokeWeight=async(t,e)=>{const r={strokeWeight:e};return this.setShapeProperties(t,r)},this.setFlagAllCornersSame=async(t,e)=>{const r={allCornersSame:e};return this.setShapeProperties(t,r)},this.setShapeCorners=async(t,e)=>(await a(this,Mt)).setShapeCorners(t,JSON.stringify(e)).then(n=>i(n)),this.setRadiusAll=async(t,e)=>{const r={radiusAll:e};return this.setShapeCorners(t,r)},this.setRadiusTopLeft=async(t,e)=>{const r={topLeft:e};return this.setShapeCorners(t,r)},this.setRadiusBottomLeft=async(t,e)=>{const r={bottomLeft:e};return this.setShapeCorners(t,r)},this.setRadiusTopRight=async(t,e)=>{const r={topRight:e};return this.setShapeCorners(t,r)},this.setRadiusBottomRight=async(t,e)=>{const r={bottomRight:e};return this.setShapeCorners(t,r)},y(this,Mt,o)}}Mt=new WeakMap;class Os{constructor(o){g(this,d);this.getAll=async()=>(await a(this,d)).getFrames().then(e=>i(e)),this.getSelected=async()=>(await a(this,d)).getSelectedFrames().then(e=>i(e)),this.getAllByPageId=async t=>(await a(this,d)).getFramesByPageId(t).then(r=>i(r)),this.getByName=async t=>(await a(this,d)).getFrameByName(t).then(r=>i(r)),this.getById=async t=>(await a(this,d)).getFrameById(t).then(r=>i(r)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,d)).getFramePropertiesOnSelectedLayout().then(e=>i(e)),this.getLayoutProperties=async(t,e)=>(await a(this,d)).getFramePropertiesByFrameId(t,e).then(n=>i(n)),this.getAllLayoutProperties=async t=>(await a(this,d)).getFramesProperties(t).then(r=>i(r)),this.resetTransformation=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetSize=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.select=async t=>(await a(this,d)).selectFrames([t]).then(r=>i(r)),this.selectMultiple=async t=>(await a(this,d)).selectFrames(t).then(r=>i(r)),this.deselectAll=async()=>(await a(this,d)).deselectFrames().then(e=>i(e)),this.reorderFrames=async(t,e)=>(await a(this,d)).reorderFrames(t,e).then(n=>i(n)),this.setZIndex=async(t,e)=>(await a(this,d)).setFrameZIndex(t,e).then(n=>i(n)),this.setHeight=async(t,e)=>(await a(this,d)).setFrameHeight(t,e).then(n=>i(n)),this.setRotation=async(t,e)=>(await a(this,d)).setFrameRotation(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,d)).setFrameWidth(t,e).then(n=>i(n)),this.setX=async(t,e)=>(await a(this,d)).setFrameX(t,e).then(n=>i(n)),this.setY=async(t,e)=>(await a(this,d)).setFrameY(t,e).then(n=>i(n)),this.setOpacity=async(t,e)=>(await a(this,d)).setFrameOpacity(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,d)).renameFrame(t,e).then(n=>i(n)),this.reset=async t=>(await a(this,d)).resetFrame(t).then(r=>i(r)),this.resetX=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetY=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetRotation=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetHeight=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetImageFrameFitMode=async t=>(await a(this,d)).resetImageFrameFitMode(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,d)).setFrameIsVisible(t,e).then(n=>i(n)),this.setIsVisible=async(t,e)=>(await a(this,d)).setFrameIsVisible(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,d)).removeFrames([t]).then(r=>i(r)),this.removeFrames=async t=>(await a(this,d)).removeFrames(t).then(r=>i(r)),this.create=async(t,e,r,n,c)=>(await a(this,d)).addFrame(t,e,r,n,c).then(u=>i(u)),this.createShapeFrame=async(t,e,r,n,c)=>(await a(this,d)).addFrame(t,e,r,n,c).then(u=>i(u)),this.createBarcodeFrame=async(t,e)=>(await a(this,d)).addBarcodeFrame(t,e==null?void 0:e.x,e==null?void 0:e.y).then(n=>i(n)),this.createComponentFrame=async(t,e,r,n,c)=>(await a(this,d)).addComponentFrame(e,r,n,c,JSON.stringify(t)).then(u=>i(u)),this.duplicateFrames=async t=>(await a(this,d)).duplicateFrames(t).then(r=>i(r)),this.updateImageSource=async(t,e)=>{const r=await a(this,d),n=e!==null?JSON.stringify(e):null;return r.setImageSource(t,n).then(c=>i(c))},this.removeImageSource=async t=>this.updateImageSource(t,null),this.setImageFromConnector=async(t,e,r)=>{const n={id:e,assetId:r,type:Ht.connector};return this.updateImageSource(t,n)},this.setImageFromUrl=async(t,e)=>{const r={url:e,type:Ht.url};return this.updateImageSource(t,r)},this.setImageFrameFitMode=async(t,e)=>(await a(this,d)).setImageFrameFitMode(t,e).then(n=>i(n)),this.setImageFrameFitModePosition=async(t,e)=>(await a(this,d)).setImageFrameFitModePosition(t,e).then(n=>i(n)),this.setFrameConstrainProportions=async(t,e)=>(console.error("setFrameConstrainProportions is not supported anymore"),i({success:!1,status:0,error:"setFrameConstrainProportions is not supported anymore",parsedData:null})),this.setVerticalAlign=async(t,e)=>(await a(this,d)).setVerticalAlignment(t,e).then(n=>i(n)),this.setNumberOfColumns=async(t,e)=>(await a(this,d)).setNumberOfColumns(t,e).then(n=>i(n)),this.setColumnGap=async(t,e)=>(await a(this,d)).setColumnGap(t,e).then(n=>i(n)),this.setMinCopyfitting=async(t,e)=>(await a(this,d)).setMinCopyfitting(t,e).then(n=>i(n)),this.setMaxCopyfitting=async(t,e)=>(await a(this,d)).setMaxCopyfitting(t,e).then(n=>i(n)),this.setEnableCopyfitting=async(t,e)=>(await a(this,d)).setEnableCopyfitting(t,e).then(n=>i(n)),this.resetMinCopyfitting=async t=>(await a(this,d)).resetMinCopyfitting(t).then(r=>i(r)),this.resetMaxCopyfitting=async t=>(await a(this,d)).resetMaxCopyfitting(t).then(r=>i(r)),this.resetEnableCopyfitting=async t=>(await a(this,d)).resetEnableCopyfitting(t).then(r=>i(r)),this.setShapeFrameEnableFill=async(t,e)=>this.shapeController.setEnableFill(t,e),this.setShapeFrameFillColor=async(t,e)=>this.shapeController.setFillColor(t,e),this.setShapeFrameEnableStroke=async(t,e)=>this.shapeController.setEnableStroke(t,e),this.setShapeFrameStrokeColor=async(t,e)=>this.shapeController.setStrokeColor(t,e),this.setShapeFrameStrokeWeight=async(t,e)=>this.shapeController.setStrokeWeight(t,e),this.setBlendMode=async(t,e)=>(await a(this,d)).setFrameBlendMode(t,e).then(n=>i(n)),this.enterCropMode=async(t,e=fe.frameCrop)=>(await a(this,d)).enterCropMode(t,e).then(n=>i(n)),this.applyCropMode=async()=>(await a(this,d)).applyCropMode().then(e=>i(e)),this.exitCropMode=async()=>(await a(this,d)).cancelCropMode().then(e=>i(e)),this.enterSubjectMode=async t=>(await a(this,d)).enterSubjectMode(t).then(r=>i(r)),this.applySubjectMode=async()=>(await a(this,d)).applySubjectMode().then(e=>i(e)),this.exitSubjectMode=async()=>(await a(this,d)).cancelSubjectMode().then(e=>i(e)),this.enterGradientMode=async t=>(await a(this,d)).enterGradientMode(t).then(r=>i(r)),this.applyGradientMode=async()=>(await a(this,d)).applyGradientMode().then(e=>i(e)),this.cancelGradientMode=async()=>(await a(this,d)).cancelGradientMode().then(e=>i(e)),this.resetCropMode=async t=>(console.error("resetCropMode is not supported anymore"),i({success:!1,status:0,error:"resetCropMode is not supported anymore",parsedData:null})),this.setEnableAutoGrow=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinWidth=async(t,e)=>{const r={minWidth:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxWidth=async(t,e)=>{const r={maxWidth:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinHeight=async(t,e)=>{const r={minHeight:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxHeight=async(t,e)=>{const r={maxHeight:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowDirections=async(t,e)=>{const r={directions:{value:e}};return(await a(this,d)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.resetAutoGrowSettingsEnabled=async t=>(console.error("resetAutoGrowSettingsEnabled is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowSettingsEnabled is not supported anymore",parsedData:null})),this.resetAutoGrowMinWidth=async t=>(console.error("resetAutoGrowMinWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMaxWidth=async t=>(console.error("resetAutoGrowMaxWidth is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMinHeight=async t=>(console.error("resetAutoGrowMinHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMinHeight is not supported anymore",parsedData:null})),this.resetAutoGrowMaxHeight=async t=>(console.error("resetAutoGrowMaxHeight is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowMaxHeight is not supported anymore",parsedData:null})),this.resetAutoGrowDirections=async t=>(console.error("resetAutoGrowDirections is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrowDirections is not supported anymore",parsedData:null})),this.resetAutoGrow=async t=>(console.error("resetAutoGrow is not supported anymore"),i({success:!1,status:0,error:"resetAutoGrow is not supported anymore",parsedData:null})),this.setShadowEnabled=async(t,e)=>{const r={enabled:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowDistance=async(t,e)=>{const r={distance:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowAngleDegrees=async(t,e)=>{const r={angleDegrees:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowBlurRadius=async(t,e)=>{const r={blurRadius:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setShadowColor=async(t,e)=>{const r={color:{value:e}};return(await a(this,d)).updateFrameShadowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAnchor=async(t,e,r,n,c)=>{const l={horizontal:e,type:r,target:n,endTarget:c};return(await a(this,d)).setAnchorProperties(t,JSON.stringify(l)).then(C=>i(C))},this.setVerticalAnchor=async(t,e,r,n)=>this.setAnchor(t,!1,e,r,n),this.setHorizontalAnchor=async(t,e,r,n)=>this.setAnchor(t,!0,e,r,n),this.resetAnchoring=async t=>(await a(this,d)).resetFrameTransformation(t).then(r=>i(r)),this.resetVisibility=async t=>(await a(this,d)).setFrameIsVisible(t,null).then(r=>i(r)),this.getConfiguration=async t=>(await a(this,d)).getFrameConfiguration(t).then(r=>i(r)),this.resetAssetCropOverride=async t=>(await a(this,d)).resetAssetCropOverride(t).then(r=>i(r)),this.resetAllAssetCropOverrides=async t=>(await a(this,d)).resetAllAssetCropOverrides(t).then(r=>i(r)),this.setGradientApplied=async(t,e)=>{const r={isApplied:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setLocalGradient=async(t,e)=>{const r={gradient:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setBrandKitGradient=async(t,e)=>{const r={id:e};return(await a(this,d)).updateFrameGradientSettings(t,JSON.stringify(r)).then(c=>i(c))},y(this,d,o),this.shapeController=new Se(a(this,d)),this.constraints=new Rn(a(this,d))}}d=new WeakMap;class Rn{constructor(o){g(this,W);this.get=async t=>(await a(this,W)).getFrameConstraints(t).then(r=>i(r)),this.setSelectable=async(t,e)=>{const r={selectionAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setHorizontalMovement=async(t,e)=>{const r={horizontalMovementAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setVerticalMovement=async(t,e)=>{const r={verticalMovementAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setRotation=async(t,e)=>{const r={rotationAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},this.setResize=async(t,e,r)=>{const n={resizeAllowed:{value:e},...r!==void 0&&{proportionLocked:{value:r}}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(n)).then(l=>i(l))},this.setCrop=async(t,e)=>{const r={cropAllowed:{value:e}};return(await a(this,W)).updateFrameConstraints(t,JSON.stringify(r)).then(c=>i(c))},y(this,W,o)}}W=new WeakMap;class Ds{constructor(){this.currentEngineVersion=R.current,this.currentSDKVersion=Pe.version}}class Ls{constructor(o){g(this,f);g(this,Wt);this.getAll=async()=>(await a(this,f)).getLayouts().then(e=>i(e)),this.getById=async t=>(await a(this,f)).getLayoutById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,f)).getLayoutByName(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,f)).getSelectedLayout().then(e=>i(e)),this.remove=async t=>(await a(this,f)).removeLayout(t).then(r=>i(r)),this.create=async(t,e)=>{const r=await a(this,f);return e!=null&&e.length?r.addLayouts(t,JSON.stringify(e)).then(n=>i(n)):r.addLayout(t).then(n=>i(n))},this.rename=async(t,e)=>(await a(this,f)).renameLayout(t,e).then(n=>i(n)),this.select=async t=>(await a(this,f)).selectLayoutWithOptions(t,null).then(r=>i(r)),this.selectWithPageSize=async(t,e)=>{const r=await a(this,f),n={pageSize:e};return r.selectLayoutWithOptions(t,JSON.stringify(n)).then(c=>i(c))},this.duplicate=async t=>(await a(this,f)).duplicateLayout(t).then(r=>i(r)),this.reset=async t=>(await a(this,f)).resetLayout(t).then(r=>i(r)),this.setHeight=async(t,e)=>(await a(this,f)).setLayoutHeight(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,f)).setLayoutWidth(t,e).then(n=>i(n)),this.setUnit=async(t,e)=>(await a(this,f)).setLayoutUnit(t,e).then(n=>i(n)),this.resetHeight=async t=>(await a(this,f)).resetLayoutHeight(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,f)).resetLayoutWidth(t).then(r=>i(r)),this.resetUnit=async t=>(await a(this,f)).resetLayoutUnit(t).then(r=>i(r)),this.getSelectedSnapshot=async()=>(await a(this,Wt)).getPageSnapshot().then(e=>e??e),this.setIntent=async(t,e)=>(await a(this,f)).setLayoutIntent(t,e).then(n=>i(n)),this.resetIntent=async t=>(await a(this,f)).resetLayoutIntent(t).then(r=>i(r)),this.setFillColor=async(t,e)=>(await a(this,f)).setLayoutFillColor(t,JSON.stringify(e)).then(n=>i(n)),this.setFillColorEnabled=async(t,e)=>(await a(this,f)).setLayoutFillColorEnabled(t,e).then(n=>i(n)),this.resetFillColor=async t=>(await a(this,f)).resetLayoutFillColor(t).then(r=>i(r)),this.setBleedValue=async(t,e,r)=>{const n=r?{left:r===Z.left?e:void 0,top:r===Z.top?e:void 0,right:r===Z.right?e:void 0,bottom:r===Z.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(n)).then(l=>i(l))},this.setAreBleedValuesCombined=async(t,e)=>{const r={areBleedValuesCombined:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(r)).then(c=>i(c))},this.resetBleedValues=async t=>(await a(this,f)).updateLayoutBleed(t,null).then(r=>i(r)),this.setPrivateData=async(t,e)=>(await a(this,f)).setLayoutPrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,f)).getLayoutPrivateData(t).then(r=>i(r)),this.setDisplayName=async(t,e)=>(await a(this,f)).setLayoutDisplayName(t,e).then(n=>i(n)),this.getDisplayName=async t=>(await a(this,f)).getLayoutDisplayName(t).then(r=>i(r)),this.resetDisplayName=async t=>(await a(this,f)).setLayoutDisplayName(t,null).then(r=>i(r)),this.setAvailableForUser=async(t,e)=>(await a(this,f)).setLayoutAvailableForUser(t,e).then(n=>i(n)),this.setSelectedByUser=async(t,e)=>(await a(this,f)).setLayoutSelectedByUser(t,e).then(n=>i(n)),this.setResizableByUser=async(t,e)=>(await a(this,f)).setLayoutResizableByUser(t,JSON.stringify(e)).then(n=>i(n)),y(this,f,o),y(this,Wt,o)}}f=new WeakMap,Wt=new WeakMap;var oe=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(oe||{}),be=(s=>(s.web="web",s.print="print",s.animation="animation",s))(be||{});class Ms{constructor(o){g(this,X);g(this,jt);this.query=async(t,e,r={})=>(await a(this,X)).mediaConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,X)).mediaConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r,n={})=>{const c=this.parseDeprecatedMediaDownloadType(r);return(await a(this,jt)).mediaConnectorDownload(t,e,c,be.web,JSON.stringify(n)).then(u=>{if(u instanceof Uint8Array)return u;throw typeof u=="object"&&u!==null&&"success"in u&&!u.success&&ye(u),new Error(`Unexpected response type: ${typeof u}.`)})},this.getConfigurationOptions=async t=>(await a(this,X)).mediaConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,X)).mediaConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedMediaType=t=>{if(t===Pt.file)return Ft.file;if(t===Pt.collection)return Ft.collection},this.upload=async(t,e,r={})=>(await a(this,X)).mediaConnectorUpload(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),y(this,X,o),y(this,jt,o)}parseDeprecatedMediaDownloadType(o){switch(o){case ae.HighResolutionWeb:return oe.highres;case ae.LowResolutionWeb:return oe.thumbnail;default:return o}}}X=new WeakMap,jt=new WeakMap;let Ns=(Or=class{constructor(o){g(this,D);g(this,qt);this.add=async()=>(await a(this,D)).addPage().then(e=>i(e)),this.remove=async t=>(await a(this,D)).removePage(t).then(r=>i(r)),this.select=async t=>(await a(this,D)).selectPage(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,D)).setPageIsVisible(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,D)).duplicatePage(t).then(r=>i(r)),this.getAll=async()=>(await a(this,D)).getPages().then(e=>i(e)),this.getById=async t=>(await a(this,D)).getPageById(t).then(r=>i(r)),this.getSnapshot=async(t,e)=>(await a(this,qt)).getPageSnapshotWithSettings(t,e==null?null:JSON.stringify(e)).then(n=>n??n),this.setWidth=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,D)).setPageWidth(e).then(n=>i(n))),this.setHeight=async(t,e)=>(t!==void 0&&console.warn("pageId has no effect since all pages are being updated simultaneously."),(await a(this,D)).setPageHeight(e).then(n=>i(n))),this.setSize=async(t,e)=>(await a(this,D)).setPageSize(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,D)).reorderPages(t,e).then(n=>i(n)),y(this,D,o),y(this,qt,o)}},D=new WeakMap,qt=new WeakMap,Or);class Rs{constructor(o){g(this,k);this.getAll=async()=>(await a(this,k)).getParagraphStyles().then(e=>i(e)),this.getById=async t=>(await a(this,k)).getParagraphStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,k)).createParagraphStyle().then(e=>i(e)),this.duplicate=async t=>(await a(this,k)).duplicateParagraphStyle(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,k)).updateParagraphStyle(t,JSON.stringify(e)).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,k)).renameParagraphStyle(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,k)).removeParagraphStyle(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,k)).moveParagraphStyles(t,e).then(n=>i(n)),y(this,k,o)}}k=new WeakMap;var T=(s=>(s.info="info",s.warn="warn",s.error="error",s))(T||{}),Vs=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s))(Vs||{}),xt=(s=>(s.throw="throw",s.log="log",s))(xt||{});class Ts{constructor(o,t,e,r){this.type="action",this.message=o,this.id=t,this.event=e,this.eventChain=r}}class Gs{constructor(o,t,e){this.type="dataRow",this.count=o,this.message=t,this.exceptions=e}}var ce=(s=>(s.shortText="shortText",s.longText="longText",s.image="image",s.list="list",s.boolean="boolean",s.group="group",s.number="number",s.date="date",s))(ce||{}),Bs=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))(Bs||{}),Js=(s=>(s.en_US="en_US",s.cs="cs",s.da="da",s.nl="nl",s.fi="fi",s.fr="fr",s.de="de",s.it="it",s.no="no",s.pl="pl",s.pt_PT="pt_PT",s.es_ES="es_ES",s.sv="sv",s))(Js||{}),Ot=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(Ot||{}),Us=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))(Us||{}),ks=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(ks||{});let Vn=class{constructor(o,t){this.onActionsChanged=e=>{this.config.events.onActionsChanged.trigger(JSON.parse(e))},this.onAnimationChanged=e=>{this.config.events.onFrameAnimationsChanged.trigger(JSON.parse(e))},this.onAnimationPlaybackChanged=e=>{this.config.events.onScrubberPositionChanged.trigger(JSON.parse(e))},this.onSelectedLayoutPropertiesChanged=e=>{this.config.events.onSelectedLayoutPropertiesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutUnitChanged=e=>{this.config.events.onSelectedLayoutUnitChanged.trigger(e)},this.onFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onFramesLayoutChanged.trigger(r)},this.onSelectedFramesLayoutChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesLayoutChanged.trigger(r);const n=this.config.onSelectedFrameLayoutChanged;n&&n(r.length>1?void 0:r[0])},this.onSelectedFramesContentChanged=e=>{const r=JSON.parse(e);this.config.events.onSelectedFramesContentChanged.trigger(r);const n=this.config.onSelectedFrameContentChanged;n&&n(r.length>1?null:r[0])},this.onStateChanged=()=>{this.config.events.onStateChanged.trigger()},this.onAuthExpired=async e=>{const r=await this.config.handlers.onAuthExpired.trigger(JSON.parse(e));return r!=null?JSON.stringify(r):null},this.onViewportRequested=()=>{const e=this.config.handlers.onViewportRequested.trigger();return e!=null?JSON.stringify(e):null},this.onDocumentLoaded=()=>{this.config.events.onDocumentLoaded.trigger()},this.onPageSelectionChanged=e=>{this.config.events.onPageSelectionChanged.trigger(e)},this.onVariableListChanged=e=>{const n=JSON.parse(e).map(c=>{var l;return c.type===ce.list?{...c,items:c.items.map(u=>u.value),selected:(l=c.selected)==null?void 0:l.value}:c});this.config.events.onVariableListChanged.trigger(n)},this.onSelectedToolChanged=e=>{this.config.events.onSelectedToolChanged.trigger(e)},this.onUndoStateChanged=e=>{this.config.events.onUndoStackStateChanged.trigger(JSON.parse(e))},this.onCustomUndoDataChanged=e=>{this.config.events.onCustomUndoDataChanged.trigger(JSON.parse(e))},this.onSelectedLayoutFramesChanged=e=>{this.config.events.onSelectedLayoutFramesChanged.trigger(JSON.parse(e))},this.onSelectedTextStyleChanged=e=>{this.config.events.onSelectedTextStyleChanged.trigger(JSON.parse(e))},this.onColorsChanged=e=>{this.config.events.onColorsChanged.trigger(JSON.parse(e))},this.onParagraphStylesChanged=e=>{this.config.events.onParagraphStylesChanged.trigger(JSON.parse(e))},this.onCharacterStylesChanged=e=>{this.config.events.onCharacterStylesChanged.trigger(JSON.parse(e))},this.onFontFamiliesChanged=e=>{this.config.events.onFontFamiliesChanged.trigger(JSON.parse(e))},this.onSelectedLayoutIdChanged=e=>{this.config.events.onSelectedLayoutIdChanged.trigger(e)},this.onLayoutsChanged=e=>{this.config.events.onLayoutsChanged.trigger(JSON.parse(e))},this.onZoomChanged=e=>{this.config.events.onZoomChanged.trigger(JSON.parse(e))},this.onConnectorEvent=e=>{this.config.events.onConnectorEvent.trigger(JSON.parse(e))},this.onConnectorsChanged=e=>{const n=new me().makeMultipleConnectorsBackwardsCompatible(JSON.parse(e),this.localConfig.get(Y.GraFxStudioEnvironmentApiUrl));this.config.events.onConnectorsChanged.trigger(n)},this.onSelectedPageIdChanged=e=>{this.config.events.onSelectedPageIdChanged.trigger(e)},this.onPagesChanged=e=>{this.config.events.onPagesChanged.trigger(JSON.parse(e))},this.onPageSnapshotInvalidated=e=>{this.config.events.onPageSnapshotInvalidated.trigger(e)},this.onPageSizeChanged=e=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(e))},this.onShapeCornerRadiusChanged=e=>{this.config.events.onShapeCornerRadiusChanged.trigger(JSON.parse(e))},this.onCropActiveFrameIdChanged=e=>{this.config.events.onCropActiveFrameIdChanged.trigger(e)},this.onAsyncError=e=>{const r=JSON.parse(e);if((r==null?void 0:r.type)==="dataRow"){const n=new Gs(r.count,r.message,r.exceptions);this.config.events.onAsyncError.trigger(n)}else if((r==null?void 0:r.type)==="action"){const n=new Ts(r.message,r.id,r.event,r.eventChain);this.config.events.onAsyncError.trigger(n)}else this.config.events.onAsyncError.trigger(r)},this.onViewModeChanged=e=>{this.config.events.onViewModeChanged.trigger(e)},this.onBarcodeValidationChanged=e=>{this.config.events.onBarcodeValidationChanged.trigger(JSON.parse(e))},this.onDataSourceIdChanged=e=>{this.config.events.onDataSourceIdChanged.trigger(e)},this.onDocumentIssueListChanged=e=>{this.config.events.onDocumentIssueListChanged.trigger(JSON.parse(e))},this.onEngineEditModeChanged=e=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(e))},this.onBrandKitMediaChanged=e=>{this.config.events.onBrandKitMediaChanged.trigger(JSON.parse(e))},this.config=o,this.localConfig=t}};class _s{constructor(o){g(this,bt);this.set=async t=>(await a(this,bt)).selectedTextStyleDeltaUpdate(JSON.stringify(t)).then(r=>i(r)),this.removeSelected=async()=>(await a(this,bt)).selectedTextStyleClean().then(e=>i(e)),this.getSelected=async()=>(await a(this,bt)).getSelectedTextStyle().then(e=>i(e)),y(this,bt,o)}}bt=new WeakMap;var Hs=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Hs||{}),xs=(s=>(s.LAYOUT_HEIGHT="layoutHeight",s.LAYOUT_WIDTH="layoutWidth",s.BLEED_TOP="bleedTop",s.BLEED_BOTTOM="bleedBottom",s.BLEED_LEFT="bleedLeft",s.BLEED_RIGHT="bleedRight",s.BLEED_VALUES_COMBINED="areBleedValuesCombined",s))(xs||{}),$=(s=>(s.SELECT="select",s.ZOOM="zoom",s.HAND="hand",s.IMAGE_FRAME="imageFrame",s.TEXT_FRAME="textFrame",s.SHAPE_RECT="rect",s.SHAPE_ELLIPSE="ellipse",s.SHAPE_POLYGON="polygon",s))($||{}),Ks=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s.HTML="html",s))(Ks||{}),he=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(he||{});class $s{constructor(o){g(this,Nt);this.setTool=async t=>(await a(this,Nt)).setTool(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,Nt)).getSelectedTool().then(e=>i(e)),this.setPointer=async()=>this.setTool($.SELECT),this.setSelect=async()=>this.setTool($.SELECT),this.setHand=async()=>this.setTool($.HAND),this.setZoom=async()=>this.setTool($.ZOOM),this.setTextFrame=async()=>this.setTool($.TEXT_FRAME),this.setImageFrame=async()=>this.setTool($.IMAGE_FRAME),this.setShapeRect=async()=>this.setTool($.SHAPE_RECT),this.setShapeEllipse=async()=>this.setTool($.SHAPE_ELLIPSE),this.setShapePolygon=async()=>this.setTool($.SHAPE_POLYGON),y(this,Nt,o)}}Nt=new WeakMap;class zs{constructor(o,t){g(this,tt);g(this,j);g(this,Yt);this.undo=async()=>(await a(this,tt)).undo().then(r=>i(r)),this.redo=async()=>(await a(this,tt)).redo().then(r=>i(r)),this.addCustomData=async(e,r)=>(await a(this,tt)).setCustomUndoData(e,r,!1).then(c=>i(c)),this.record=async(e,r)=>{try{await a(this,j).beginIfNoneActive(e),await r(a(this,Yt)),await a(this,j).end()}catch(n){throw await a(this,j).abort(),n}},this.pause=async()=>(await a(this,tt)).pause().then(r=>i(r)),this.resume=async()=>(await a(this,tt)).resume().then(r=>i(r)),this.advanced={begin:async e=>a(this,j).begin(e),beginIfNoneActive:async e=>a(this,j).beginIfNoneActive(e),end:async()=>a(this,j).end(),abort:async()=>a(this,j).abort()},y(this,tt,o),y(this,Yt,t),y(this,j,new Tn(o))}}tt=new WeakMap,j=new WeakMap,Yt=new WeakMap;class Tn{constructor(o){g(this,ut);this.begin=async t=>(await a(this,ut)).begin(t).then(r=>i(r)),this.beginIfNoneActive=async t=>(await a(this,ut)).beginIfNoneActive(t).then(r=>i(r)),this.end=async()=>(await a(this,ut)).end().then(e=>i(e)),this.abort=async()=>(await a(this,ut)).abort().then(e=>i(e)),y(this,ut,o)}}ut=new WeakMap;const Gn=(s,o=2)=>{const t=Math.pow(10,o);return Math.round(s*t)/t};class Ws{constructor(o,t){g(this,Zt);g(this,Rt);this.round=(e,r)=>i({data:String(Gn(e,r)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=e=>{const{type:r=he.SANDBOX,environment:n="ft-nostress",version:c="1"}=e,l=r==he.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${n}.${l}.online/grafx/api/v${c}/environment/${n}`},this.stageFiles=async(e,r,n)=>{const c=a(this,Rt).get(Y.GraFxStudioEnvironmentApiUrl);if(!c)throw new Error("GraFx Studio Environment API URL is not set");const l=`${c}connectors/${r}/stage`,u=a(this,Rt).get(Y.GraFxStudioAuthToken);if(!u)throw new Error("GraFx Studio Auth Token is not set");const C=new FormData;e.forEach((S,v)=>{const P=S instanceof File?S.name:`blob-${v}`;C.append("files",S,P)}),n&&C.append("validationJson",JSON.stringify({allowedMimeTypes:n.mimeTypes,minDimensions:{width:n.minWidthPixels,height:n.minHeightPixels}}));const p=await fetch(l,{method:"POST",body:C,headers:{Authorization:`Bearer ${u}`}});if(p.status===422){const S=await p.json();throw new as(S.message,we.minDimension)}if(!p.ok)throw new Error("Failed to stage files");return await p.json()},this.unitEvaluate=async(e,r)=>(await a(this,Zt)).unitEvaluate(e,r).then(c=>i(c)),y(this,Zt,o),y(this,Rt,t)}}Zt=new WeakMap,Rt=new WeakMap;class Bn{constructor(o){g(this,Qt);this.setMinimum=async(t,e)=>{const r={minValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setMaximum=async(t,e)=>{const r={maxValue:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setShowStepper=async(t,e)=>{const r={showStepper:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStepSize=async(t,e)=>{const r={stepSize:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setThousandsSeparator=async(t,e)=>{const r={thousandsSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalSeparator=async(t,e)=>{const r={decimalSeparator:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setDecimalCharacterStyle=async(t,e)=>{const r={decimalCharacterStyleId:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setNumberOfDecimals=async(t,e)=>{const r={numberOfDecimals:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Qt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Qt)).updateNumberVariableProperties(o,JSON.stringify(t));return i(r)}}Qt=new WeakMap;class Jn{constructor(o){g(this,Xt);this.setDisplayFormat=async(t,e)=>{const r={displayFormat:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setLocale=async(t,e)=>{const r={locale:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setStartDate=async(t,e)=>{const r={startDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setEndDate=async(t,e)=>{const r={endDate:{value:e}};return this.applyPropertiesUpdate(t,r)},this.setExcludedDays=async(t,e)=>{const r={excludedDays:{value:e}};return this.applyPropertiesUpdate(t,r)},y(this,Xt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Xt)).updateDateVariableProperties(o,JSON.stringify(t));return i(r)}}Xt=new WeakMap;let js=(Dr=class{constructor(o){g(this,m);g(this,Vt);g(this,Tt);this.getAll=async()=>(await a(this,m)).getVariables().then(e=>i(e)).then(e=>{const r=e;return r.parsedData&&(r.parsedData=this.makeVariablesBackwardsCompatible(r.parsedData)),r}),this.getById=async t=>(await a(this,m)).getVariableById(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.getByName=async t=>(await a(this,m)).getVariableByName(t).then(r=>i(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.create=async(t,e)=>(await a(this,m)).addVariable(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,m)).removeVariables(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,m)).setVariableName(t,e).then(n=>i(n)),this.setLabel=async(t,e)=>(await a(this,m)).setVariableLabel(t,e).then(n=>i(n)),y(this,Vt,async(t,e)=>(await a(this,m)).setVariablePlaceholder(t,e).then(n=>i(n))),this.setPlaceholder=async(t,e)=>a(this,Vt).call(this,t,e),this.resetPlaceholder=async t=>a(this,Vt).call(this,t,null),y(this,Tt,async(t,e)=>(await a(this,m)).setVariableHelpText(t,e).then(n=>i(n))),this.setHelpText=async(t,e)=>a(this,Tt).call(this,t,e),this.resetHelpText=async t=>a(this,Tt).call(this,t,null),this.setType=async(t,e)=>(await a(this,m)).setVariableType(t,e).then(n=>i(n)),this.setListVariable=async(t,e)=>(await a(this,m)).setListVariableItems(t,e.map(n=>JSON.stringify({value:n}))).then(n=>i(n)),this.setValue=async(t,e)=>(await a(this,m)).setVariableValue(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,m)).duplicateVariable(t).then(r=>i(r)),this.groupVariables=async(t,e)=>(await a(this,m)).groupVariables(t,e).then(n=>i(n)),this.ungroupVariables=async t=>(await a(this,m)).ungroupVariable(t).then(r=>i(r)),this.move=async(t,e,r)=>(await a(this,m)).moveVariable(e,r,t).then(c=>i(c)),this.moveVariables=async(t,e,r)=>(await a(this,m)).moveVariables(e,r,t).then(c=>i(c)),this.setIsVisible=async(t,e)=>{const r=e?{type:Ot.visible}:{type:Ot.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,e)=>{const r=e?{type:Ot.invisible}:{type:Ot.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,e)=>(await a(this,m)).setVariableVisibility(t,JSON.stringify(e)).then(n=>i(n)),this.setLayoutsForVariableVisibility=async t=>(await a(this,m)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>i(r)),this.setIsRequired=async(t,e)=>(await a(this,m)).setVariableIsRequired(t,e).then(n=>i(n)),this.setRemoveParagraphIfEmpty=async(t,e)=>(await a(this,m)).setVariableRemoveParagraphIfEmpty(t,e).then(n=>i(n)),this.setVariableCharacterLimit=async(t,e)=>(await a(this,m)).setVariableCharacterLimit(t,e).then(n=>i(n)),this.setIsReadonly=async(t,e)=>(await a(this,m)).setVariableIsReadonly(t,e).then(n=>i(n)),this.getImageVariableConnectorId=async t=>(await a(this,m)).getImageVariableConnectorId(t).then(r=>i(r)),this.setImageVariableConnector=async(t,e)=>{const r=await a(this,m),c=new me().makeConnectorSourceForwardsCompatible(e);return r.setImageVariableConnector(t,JSON.stringify(c)).then(l=>i(l))},this.setImageVariableValueWithContext=async(t,e,r)=>(await a(this,m)).setImageVariableValueWithContext(t,e,JSON.stringify(r)).then(c=>i(c)),this.removeSource=async t=>this.setValue(t,null),this.setPrefix=async(t,e)=>{const r={prefix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffix=async(t,e)=>{const r={suffix:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrefixCharacterStyle=async(t,e)=>{const r={prefixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setSuffixCharacterStyle=async(t,e)=>{const r={suffixCharacterStyleId:{value:e}};return this.applyPrefixSuffixDeltaUpdate(t,r)},this.setPrivateData=async(t,e)=>(await a(this,m)).setVariablePrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,m)).getVariablePrivateData(t).then(r=>i(r)),this.setAllowImageQuery=async(t,e)=>(await a(this,m)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowImageUpload=async(t,e)=>(await a(this,m)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinImageUploadSize=async(t,e,r)=>(await a(this,m)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setIsDontBreak=async(t,e)=>(await a(this,m)).setVariableIsDontBreak(t,e).then(n=>i(n)),y(this,m,o),this.number=new Bn(a(this,m)),this.date=new Jn(a(this,m))}makeVariablesBackwardsCompatible(o){return o.map(t=>this.makeVariableBackwardsCompatible(t))}makeVariableBackwardsCompatible(o){return o.type!==ce.list?o:this.makeListVariableBackwardsCompatible(o)}makeListVariableBackwardsCompatible(o){const t=o,e=o.items,r=o.selected,n=e.map(c=>c.value);return t.items=n,t.selected=r==null?void 0:r.value,t}async applyPrefixSuffixDeltaUpdate(o,t){const r=await(await a(this,m)).updateVariablePrefixSuffixProperties(o,JSON.stringify(t));return i(r)}},m=new WeakMap,Vt=new WeakMap,Tt=new WeakMap,Dr);class Un{constructor(o){this.onVariableListChanged=t=>{this.config.events.onVariableListChanged.trigger(JSON.parse(t))},this.onConnectorsChanged=t=>{this.config.events.onConnectorsChanged.trigger(JSON.parse(t))},this.onPageSizeChanged=t=>{this.config.events.onPageSizeChanged.trigger(JSON.parse(t))},this.onEngineEditModeChanged=t=>{this.config.events.onEngineEditModeChanged.trigger(JSON.parse(t))},this.config=o}}class kn{constructor(o){g(this,gt);this.getAll=async()=>(await a(this,gt)).getVariables().then(e=>i(e)),this.getById=async t=>(await a(this,gt)).getVariableById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,gt)).getVariableByName(t).then(r=>i(r)),this.setListVariable=async(t,e)=>(await a(this,gt)).setListVariableItems(t,e.map(n=>JSON.stringify(n))).then(n=>i(n)),y(this,gt,o),this.image=new _n(o)}}gt=new WeakMap;class _n{constructor(o){g(this,et);this.setAllowQuery=async(t,e)=>(await a(this,et)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowUpload=async(t,e)=>(await a(this,et)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinUploadSize=async(t,e,r)=>(await a(this,et)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),this.setConnector=async(t,e)=>(await a(this,et)).setImageVariableConnector(t,JSON.stringify(e)).then(n=>i(n)),this.setConnectorContext=async(t,e)=>(await a(this,et)).setImageVariableConnectorContext(t,JSON.stringify(e)).then(n=>i(n)),y(this,et,o)}}et=new WeakMap;class Hn{constructor(o){g(this,vt);this.register=async t=>(await a(this,vt)).registerConnector(JSON.stringify(t)).then(r=>i(r)),this.getById=async t=>(await a(this,vt)).getConnectorById(t).then(r=>i(r)),this.getAllByType=async t=>(await a(this,vt)).getConnectors(t).then(r=>i(r)),y(this,vt,o)}}vt=new WeakMap;class xn{constructor(o){g(this,Gt);g(this,le);this.setWidth=async t=>(await a(this,Gt)).setPageWidth(t).then(r=>i(r)),this.setHeight=async t=>(await a(this,Gt)).setPageHeight(t).then(r=>i(r)),y(this,Gt,o),y(this,le,o)}}Gt=new WeakMap,le=new WeakMap;class qs{constructor(o,t,e){this.config=o,this.connection=t,this.editorAPI=e,this.subscriber=new Un(o),this.variable=new kn(this.editorAPI),this.connector=new Hn(this.editorAPI),this.page=new xn(this.editorAPI),this.canvas=new Ce(this.editorAPI)}}class Ys{constructor(o){this.logger=o}createEventHandlerFn(o,t){return(...r)=>{try{const n=o(...r);return n instanceof Promise?n.catch(c=>this.handleError(c,t,o.name)):n}catch(n){this.handleError(n,t,o.name)}}}handleError(o,t,e){var r;if(t===xt.log)(r=this.logger)==null||r.call(this,T.error,Vs.event,`Error in callback ${e}: ${o}`);else throw o}}class Zs extends Ys{constructor(o,t){super(t),this.handler=o}trigger(...o){const t=this.handler();if(t)return this.createEventHandlerFn(t,xt.throw)(...o)}}class w extends Ys{constructor(o,t){super(t),this.legacyHandler=o,this.subscriptions=new Set}trigger(...o){const t=this.legacyHandler();t&&this.createEventHandlerFn(t,xt.log)(...o);for(const e of this.subscriptions)e(...o)}registerCallback(o,t=xt.log){const e=this.createEventHandlerFn(o,t);return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}}class ve{static createRuntimeConfig(o){var e,r,n,c,l,u,C,p,I,S,v,P,A,b,H,L,F,st,rt,Ut,kt,Lr,Mr,Nr,Rr,Vr,Tr,Gr,Br,Jr,Ur,kr,_r,Hr,xr;const t={...o};return t.logging={logLevel:((e=o.logging)==null?void 0:e.logLevel)||T.error,logger:((r=o.logging)==null?void 0:r.logger)||((ee,Ie,Ae)=>{var Kr;if(ve.isLoggingEnabled(ee,((Kr=t.logging)==null?void 0:Kr.logLevel)??T.error))switch(ee){case T.error:console.error(`[${Ie}] [${ee}] ${Ae}`);break;case T.warn:console.warn(`[${Ie}] [${ee}] ${Ae}`);break;default:console.log(`[${Ie}] [${ee}] ${Ae}`)}})},t.handlers={onAuthExpired:new Zs(()=>t.onAuthExpired,(n=t.logging)==null?void 0:n.logger),onViewportRequested:new Zs(()=>t.onViewportRequested,(c=t.logging)==null?void 0:c.logger)},t.events={onActionsChanged:new w(()=>t.onActionsChanged,(l=t.logging)==null?void 0:l.logger),onStateChanged:new w(()=>t.onStateChanged,(u=t.logging)==null?void 0:u.logger),onDocumentLoaded:new w(()=>t.onDocumentLoaded,(C=t.logging)==null?void 0:C.logger),onSelectedFramesLayoutChanged:new w(()=>t.onSelectedFramesLayoutChanged,(p=t.logging)==null?void 0:p.logger),onFramesLayoutChanged:new w(()=>t.onFramesLayoutChanged,(I=t.logging)==null?void 0:I.logger),onSelectedFramesContentChanged:new w(()=>t.onSelectedFramesContentChanged,(S=t.logging)==null?void 0:S.logger),onPageSelectionChanged:new w(()=>t.onPageSelectionChanged,(v=t.logging)==null?void 0:v.logger),onSelectedLayoutPropertiesChanged:new w(()=>t.onSelectedLayoutPropertiesChanged,(P=t.logging)==null?void 0:P.logger),onSelectedLayoutUnitChanged:new w(()=>t.onSelectedLayoutUnitChanged,(A=t.logging)==null?void 0:A.logger),onScrubberPositionChanged:new w(()=>t.onScrubberPositionChanged,(b=t.logging)==null?void 0:b.logger),onFrameAnimationsChanged:new w(()=>t.onFrameAnimationsChanged,(H=t.logging)==null?void 0:H.logger),onVariableListChanged:new w(()=>t.onVariableListChanged,(L=t.logging)==null?void 0:L.logger),onSelectedToolChanged:new w(()=>t.onSelectedToolChanged,(F=t.logging)==null?void 0:F.logger),onUndoStackStateChanged:new w(()=>t.onUndoStackStateChanged,(st=t.logging)==null?void 0:st.logger),onSelectedLayoutFramesChanged:new w(()=>t.onSelectedLayoutFramesChanged,(rt=t.logging)==null?void 0:rt.logger),onSelectedTextStyleChanged:new w(()=>t.onSelectedTextStyleChanged,(Ut=t.logging)==null?void 0:Ut.logger),onColorsChanged:new w(()=>t.onColorsChanged,(kt=t.logging)==null?void 0:kt.logger),onParagraphStylesChanged:new w(()=>t.onParagraphStylesChanged,(Lr=t.logging)==null?void 0:Lr.logger),onCharacterStylesChanged:new w(()=>t.onCharacterStylesChanged,(Mr=t.logging)==null?void 0:Mr.logger),onFontFamiliesChanged:new w(()=>t.onFontFamiliesChanged,(Nr=t.logging)==null?void 0:Nr.logger),onSelectedLayoutIdChanged:new w(()=>t.onSelectedLayoutIdChanged,(Rr=t.logging)==null?void 0:Rr.logger),onLayoutsChanged:new w(()=>t.onLayoutsChanged,(Vr=t.logging)==null?void 0:Vr.logger),onConnectorEvent:new w(()=>t.onConnectorEvent,(Tr=t.logging)==null?void 0:Tr.logger),onConnectorsChanged:new w(()=>t.onConnectorsChanged,(Gr=t.logging)==null?void 0:Gr.logger),onZoomChanged:new w(()=>t.onZoomChanged,(Br=t.logging)==null?void 0:Br.logger),onSelectedPageIdChanged:new w(()=>t.onSelectedPageIdChanged,t.logging.logger),onPagesChanged:new w(()=>t.onPagesChanged,t.logging.logger),onPageSnapshotInvalidated:new w(()=>t.onPageSnapshotInvalidated,t.logging.logger),onPageSizeChanged:new w(()=>t.onPageSizeChanged,(Jr=t.logging)==null?void 0:Jr.logger),onShapeCornerRadiusChanged:new w(()=>t.onShapeCornerRadiusChanged,(Ur=t.logging)==null?void 0:Ur.logger),onCropActiveFrameIdChanged:new w(()=>t.onCropActiveFrameIdChanged,(kr=t.logging)==null?void 0:kr.logger),onAsyncError:new w(()=>t.onAsyncError,(_r=t.logging)==null?void 0:_r.logger),onViewModeChanged:new w(()=>t.onViewModeChanged,(Hr=t.logging)==null?void 0:Hr.logger),onBarcodeValidationChanged:new w(()=>t.onBarcodeValidationChanged,(xr=t.logging)==null?void 0:xr.logger),onDataSourceIdChanged:new w(()=>t.onDataSourceIdChanged,t.logging.logger),onDocumentIssueListChanged:new w(()=>t.onDocumentIssueListChanged,t.logging.logger),onCustomUndoDataChanged:new w(()=>t.onCustomUndoDataChanged,t.logging.logger),onEngineEditModeChanged:new w(()=>t.onEngineEditModeChanged,t.logging.logger),onBrandKitMediaChanged:new w(()=>t.onBrandKitMediaChanged,t.logging.logger)},t}static isLoggingEnabled(o,t){return t==T.info||t==T.warn&&(o==T.warn||o==T.error)?!0:t==T.error&&o==T.error}}class Kn{isDatePropertyWrapper(o){return typeof o=="object"&&(o==null?void 0:o.type)==="date"}isDateObject(o){return o instanceof Date}mapEngineToDataItem(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDatePropertyWrapper(r)?new Date(r.value):r}),t}mapDataItemToEngine(o){const t={};return Object.entries(o).forEach(([e,r])=>{t[e]=this.isDateObject(r)?{value:r.getTime(),type:"date"}:r}),t}}class $n{constructor(o){g(this,yt);y(this,yt,o)}async getValue(o){return(await a(this,yt)).getConfigValue(o).then(e=>i(e))}async setValue(o,t){return(await a(this,yt)).setConfigValue(o,t).then(r=>i(r))}async updateStudioOptions(o){return(await a(this,yt)).updateStudioOptions(JSON.stringify(o)).then(e=>i(e))}async getEngineSessionId(){return(await a(this,yt)).getEngineSessionId().then(t=>i(t))}}yt=new WeakMap;class Qs extends $n{constructor(t,e){super(t);g(this,Bt);y(this,Bt,e)}async getValue(t){const e=a(this,Bt).get(t);return e!=null?i({status:200,success:!0,parsedData:e,data:e},!1):super.getValue(t)}async setValue(t,e){const r=super.setValue(t,e);return a(this,Bt).set(t,e),r}}Bt=new WeakMap;class Xs{constructor(o){g(this,_);this.getAll=async()=>(await a(this,_)).getGradients().then(e=>i(e)),this.getById=async t=>(await a(this,_)).getGradientById(t).then(r=>i(r)),this.create=async()=>(await a(this,_)).createGradient().then(e=>i(e)),this.duplicate=async t=>(await a(this,_)).duplicateGradient(t).then(r=>i(r)),this.move=async(t,e)=>(await a(this,_)).moveGradients(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,_)).renameGradient(t,e).then(n=>i(n)),this.update=async(t,e)=>{const r=await a(this,_),n=e;return r.updateGradient(t,JSON.stringify(n)).then(c=>i(c))},this.remove=async t=>(await a(this,_)).removeGradient(t).then(r=>i(r)),y(this,_,o)}}_=new WeakMap;class tr{constructor(o){g(this,It);g(this,te);this.query=async(t,e,r={})=>(await a(this,It)).componentConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.preview=async(t,e,r,n={})=>(await a(this,te)).componentConnectorPreview(t,e,r,JSON.stringify(n)).then(l=>{if(l instanceof Uint8Array)return l;throw typeof l=="object"&&l!==null&&"success"in l&&!l.success&&ye(l),new Error(`Unexpected response type: ${typeof l}.`)}),this.getConfigurationOptions=async t=>(await a(this,It)).componentConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,It)).componentConnectorGetCapabilities(t).then(r=>i(r)),y(this,It,o),y(this,te,o)}}It=new WeakMap,te=new WeakMap;class er{constructor(o){g(this,Jt);this.linkVariable=async(t,e,r)=>(await a(this,Jt)).linkComponentVariable(t,e,r,null).then(c=>i(c)),this.getComponentVariables=async t=>(await a(this,Jt)).getComponentVariables(t).then(r=>i(r)),y(this,Jt,o)}}Jt=new WeakMap;const zn=`https://studio-cdn.chiligrafx.com/editor/${R.current}/web`;let at;class Wn{constructor(o){this.localConfig=new Map,this.dataItemMappingTools=new Kn,this.loadEditor=()=>{var t;mn(this.config.editorLink||zn,{onActionsChanged:this.subscriber.onActionsChanged,onStateChanged:this.subscriber.onStateChanged,onAuthExpired:this.subscriber.onAuthExpired,onViewportRequested:this.subscriber.onViewportRequested,onDocumentLoaded:this.subscriber.onDocumentLoaded,onSelectedFramesContentChanged:this.subscriber.onSelectedFramesContentChanged,onSelectedFramesLayoutChanged:this.subscriber.onSelectedFramesLayoutChanged,onFramesLayoutChanged:this.subscriber.onFramesLayoutChanged,onSelectedLayoutPropertiesChanged:this.subscriber.onSelectedLayoutPropertiesChanged,onSelectedLayoutUnitChanged:this.subscriber.onSelectedLayoutUnitChanged,onPageSelectionChanged:this.subscriber.onPageSelectionChanged,onScrubberPositionChanged:this.subscriber.onAnimationPlaybackChanged,onFrameAnimationsChanged:this.subscriber.onAnimationChanged,onVariableListChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onVariableListChanged?this.next.subscriber.onVariableListChanged(e):this.subscriber.onVariableListChanged(e)},onSelectedToolChanged:this.subscriber.onSelectedToolChanged,onUndoStateChanged:this.subscriber.onUndoStateChanged,onSelectedLayoutFramesChanged:this.subscriber.onSelectedLayoutFramesChanged,onSelectedTextStyleChanged:this.subscriber.onSelectedTextStyleChanged,onColorsChanged:this.subscriber.onColorsChanged,onParagraphStylesChanged:this.subscriber.onParagraphStylesChanged,onCharacterStylesChanged:this.subscriber.onCharacterStylesChanged,onFontFamiliesChanged:this.subscriber.onFontFamiliesChanged,onSelectedLayoutIdChanged:this.subscriber.onSelectedLayoutIdChanged,onLayoutsChanged:this.subscriber.onLayoutsChanged,onConnectorEvent:this.subscriber.onConnectorEvent,onConnectorsChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onConnectorsChanged?this.next.subscriber.onConnectorsChanged(e):this.subscriber.onConnectorsChanged(e)},onZoomChanged:this.subscriber.onZoomChanged,onSelectedPageIdChanged:this.subscriber.onSelectedPageIdChanged,onPagesChanged:this.subscriber.onPagesChanged,onPageSnapshotInvalidated:this.subscriber.onPageSnapshotInvalidated,onPageSizeChanged:e=>{var r;(r=this.enabledNextSubscribers)!=null&&r.onPageSizeChanged?this.next.subscriber.onPageSizeChanged(e):this.subscriber.onPageSizeChanged(e)},onShapeCornerRadiusChanged:this.subscriber.onShapeCornerRadiusChanged,onCropActiveFrameIdChanged:this.subscriber.onCropActiveFrameIdChanged,onAsyncError:this.subscriber.onAsyncError,onViewModeChanged:this.subscriber.onViewModeChanged,onBarcodeValidationChanged:this.subscriber.onBarcodeValidationChanged,onDataSourceIdChanged:this.subscriber.onDataSourceIdChanged,onDocumentIssueListChanged:this.subscriber.onDocumentIssueListChanged,onCustomUndoDataChanged:this.subscriber.onCustomUndoDataChanged,onEngineEditModeChanged:this.subscriber.onEngineEditModeChanged,onBrandKitMediaChanged:this.subscriber.onBrandKitMediaChanged},this.setConnection,this.config.editorId,this.config.studioStyling,e=>{var r,n;(n=(r=this.config).onConnectionError)==null||n.call(r,e)}),this.editorAPI=at==null?void 0:at.promise.then(e=>e),this.action=new Re(this.editorAPI),this.layout=new Ls(this.editorAPI),this.frame=new Os(this.editorAPI),this.barcode=new ke(this.editorAPI),this.component=new er(this.editorAPI),this.animation=new Ve(this.editorAPI),this.document=new ls(this.editorAPI),this.configuration=new Qs(this.editorAPI,this.localConfig),this.utils=new Ws(this.editorAPI,this.localConfig),this.tool=new $s(this.editorAPI),this.page=new Ns(this.editorAPI),this.debug=new hs(this.editorAPI),this.undoManager=new zs(this.editorAPI,this),this.textSelection=new _s(this.editorAPI),this.colorStyle=new je(this.editorAPI),this.gradientStyle=new Xs(this.editorAPI),this.paragraphStyle=new Rs(this.editorAPI),this.characterStyle=new $e(this.editorAPI),this.mediaConnector=new Ms(this.editorAPI),this.fontConnector=new Fs(this.editorAPI),this.componentConnector=new tr(this.editorAPI),this.dataConnector=new os(this.editorAPI,this.dataItemMappingTools),this.dataSource=new cs(this.editorAPI,this.dataItemMappingTools),this.connector=new is(this.editorAPI,this.localConfig),this.variable=new js(this.editorAPI),this.font=new Es(this.editorAPI),this.experiment=new Ps(this.editorAPI),this.canvas=new Ce(this.editorAPI),this.shape=new Se(this.editorAPI),this.colorConversion=new We(this.editorAPI),this.info=new Ds,this.clipboard=new ze(this.editorAPI),this.brandKit=new Ke(this.editorAPI,this),this.next=new qs(this.config,this.connection,this.editorAPI),this.configuration.setValue(Y.GraFxStudioSdkVersion,Pe.version),this.configuration.setValue(Y.GraFxStudioDocumentType,this.config.documentType||ge.template),this.configuration.updateStudioOptions(this.config.studioOptions||fn),this.configuration.setValue(Y.QueryCallCacheEnabled,((t=this.config.enableQueryCallCache)==null?void 0:t.toString())||"false")},this.setConnection=t=>{at=t},this.config=ve.createRuntimeConfig(o),this.connection=at,this.editorAPI=at==null?void 0:at.promise.then(t=>t),this.action=new Re(this.editorAPI),this.layout=new Ls(this.editorAPI),this.frame=new Os(this.editorAPI),this.shape=new Se(this.editorAPI),this.barcode=new ke(this.editorAPI),this.component=new er(this.editorAPI),this.undoManager=new zs(this.editorAPI,this),this.connector=new is(this.editorAPI,this.localConfig),this.mediaConnector=new Ms(this.editorAPI),this.fontConnector=new Fs(this.editorAPI),this.componentConnector=new tr(this.editorAPI),this.dataConnector=new os(this.editorAPI,this.dataItemMappingTools),this.dataSource=new cs(this.editorAPI,this.dataItemMappingTools),this.animation=new Ve(this.editorAPI),this.document=new ls(this.editorAPI),this.configuration=new Qs(this.editorAPI,this.localConfig),this.variable=new js(this.editorAPI),this.utils=new Ws(this.editorAPI,this.localConfig),this.subscriber=new Vn(this.config,this.localConfig),this.tool=new $s(this.editorAPI),this.page=new Ns(this.editorAPI),this.debug=new hs(this.editorAPI),this.textSelection=new _s(this.editorAPI),this.colorStyle=new je(this.editorAPI),this.gradientStyle=new Xs(this.editorAPI),this.paragraphStyle=new Rs(this.editorAPI),this.characterStyle=new $e(this.editorAPI),this.font=new Es(this.editorAPI),this.experiment=new Ps(this.editorAPI),this.canvas=new Ce(this.editorAPI),this.colorConversion=new We(this.editorAPI),this.info=new Ds,this.clipboard=new ze(this.editorAPI),this.next=new qs(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=new Ke(this.editorAPI,this)}}var sr=(s=>(s.top="top",s.left="left",s.right="right",s.bottom="bottom",s.topLeft="topLeft",s.topRight="topRight",s.bottomLeft="bottomLeft",s.bottomRight="bottomRight",s))(sr||{}),rr=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(rr||{}),nr=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))(nr||{}),ar=(s=>(s.quadratic="Quadratic",s.cubic="Cubic",s.quartic="Quartic",s.quintic="Quintic",s.sine="Sine",s.exponential="Exponential",s.circular="Circular",s.elastic="Elastic",s.bounce="Bounce",s.back="Back",s))(ar||{}),ir=(s=>(s.bounce="bounce",s.flash="flash",s.headshake="headShake",s.heartbeat="heartbeat",s.pulse="pulse",s.rubberBand="rubberBand",s.vertical="vertical",s.horizontal="horizontal",s.swing="swing",s.tada="tada",s))(ir||{}),or=(s=>(s.preview="preview",s.normal="normal",s))(or||{}),cr=(s=>(s.linear="linear",s))(cr||{}),hr=(s=>(s.local="linearLocal",s.linearBrandKit="linearBrandKit",s))(hr||{}),lr=(s=>(s.Square="square",s.Line="line",s))(lr||{}),dr=(s=>(s.thumbnail="thumbnail",s.highest="highest",s.medium="medium",s))(dr||{}),ur=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(ur||{}),gr=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(gr||{}),yr=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(yr||{}),pr=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(pr||{}),Cr=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(Cr||{}),wr=(s=>(s.none="none",s.bullet="bullet",s.number="number",s))(wr||{}),mr=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(mr||{}),fr=(s=>(s.PARAGRAPH="paragraphStyleId",s.CHARACTER="characterStyleId",s.FONT_FAMILY="fontKey",s.FONT_STYLE="fontStyle",s.FONT_SIZE="fontSize",s.LETTER_SPACING="letterSpacing",s.LINE_HEIGHT="lineHeight",s.TEXT_ALIGN="textAlign",s.VERTICAL_ALIGN="verticalAlign",s.TYPOGRAPHIC_CASE="typographicCase",s.SUB_SUPER_SCRIPT="subSuperScript",s.UNDERLINE="underline",s.LINE_THROUGH="lineThrough",s.FILL_COLOR="fillColor",s.COLOR="color",s.FILL_COLOR_APPLIED="fillColorApplied",s.STROKE_COLOR="strokeColor",s.STROKE_COLOR_APPLIED="strokeColorApplied",s.DROP_SHADOW_COLOR="dropShadowColor",s.BLEND_MODE="blendMode",s.OPACITY="opacity",s.TRACKING_RIGHT="trackingRight",s.BASELINE_SHIFT="baselineShiftValue",s.STROKE_WIDTH="strokeWidth",s.MARKED_LIST_TYPE="markedListType",s.MARKED_LIST_GROUP="markedListGroup",s.MARKED_LIST_LEVEL="markedListLevel",s))(fr||{}),Sr=(s=>(s.arabic="arabic",s.romanUpperCase="romanUpperCase",s.romanLowerCase="romanLowerCase",s.latinUpperCase="latinUpperCase",s.latinLowerCase="latinLowerCase",s))(Sr||{}),br=(s=>(s.none="none",s.dash="dash",s.dot="dot",s.colon="colon",s.roundBracket="roundBracket",s))(br||{}),vr=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(vr||{}),Ir=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s))(Ir||{}),Ar=(s=>(s.all="all",s.only="only",s.none="none",s))(Ar||{}),Pr=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s.gradient="gradient",s))(Pr||{}),Fr=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(Fr||{});const jn=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:Fr},Symbol.toStringTag,{value:"Module"}));h.ActionAsyncError=Ts,h.ActionEditorEvent=vr,h.Alignment=gr,h.AnchorTargetEdgeType=As,h.AnchorTargetType=Is,h.AuthCredentialsTypeEnum=rs,h.AuthRefreshTypeEnum=ns,h.AutoGrowDirection=ds,h.BarcodeCharacterSet=Ct,h.BarcodeErrorCorrectionLevel=At,h.BarcodeSourceTypeEnum=ys,h.BarcodeType=x,h.BarcodeValidationResult=Te,h.BasicAnimationsEmphasisStyles=ir,h.BlendMode=ms,h.Case=pr,h.ColorType=Q,h.ColorUsageType=re,h.ComponentPreviewType=dr,h.ComponentSourceTypeEnum=us,h.ConnectorConfigContextType=Xe,h.ConnectorConfigValueType=Qe,h.ConnectorEventType=ss,h.ConnectorHttpError=Ne,h.ConnectorMapping=Fn,h.ConnectorMappingDirection=es,h.ConnectorMappingSource=ts,h.ConnectorRegistrationSource=Et,h.ConnectorStateType=ie,h.ConnectorType=qe,h.ConstraintMode=Ue,h.CornerRadiusType=Ar,h.CropType=fe,h.DataRowAsyncError=Gs,h.Day=Bs,h.DeprecatedMediaConnectorDownloadType=ae,h.DeprecatedMediaType=Pt,h.DocumentIssueTypeEnum=Me,h.DocumentType=ge,h.DownloadFormats=Ks,h.EaseTypes=nr,h.EngineEditModeType=Pr,h.EnvironmentType=he,h.FitMode=fs,h.FitModePosition=Ss,h.FlowDirection=Cs,h.FontPreviewFormat=lr,h.FontWeights=ur,h.FrameAnchorTarget=Nn,h.FrameAnchorType=vs,h.FrameEditingMode=Le,h.FramePropertyNames=Hs,h.FrameTypeEnum=gs,h.GradientType=cr,h.GradientUsageType=hr,h.GrafxTokenAuthCredentials=On,h.ImageSourceTypeEnum=Ht,h.LayoutIntent=Je,h.LayoutPropertyNames=xs,h.LayoutType=Be,h.Locale=Js,h.MarkedListType=wr,h.MeasurementUnit=Ge,h.MediaDownloadIntent=be,h.MediaDownloadType=oe,h.MediaType=Ft,h.Next=jn,h.NumberListFormat=Sr,h.NumberListSeparatorSymbol=br,h.PageAnchorTarget=Mn,h.PositionEnum=Z,h.RefreshedAuthCredendentials=Dn,h.Scripting=Cr,h.SelectedTextStyleSections=mr,h.SelectedTextStyles=fr,h.ShakeDirections=rr,h.ShapeType=Ir,h.SlideDirections=sr,h.SortBy=Ye,h.SortOrder=Ze,h.TextDirection=ps,h.TextPosition=yr,h.ToolType=$,h.TweenTypes=ar,h.UpdateZIndexMethod=bs,h.UploadAssetValidationError=as,h.UploadAssetValidationErrorType=we,h.VariableType=ce,h.VariableVisibilityOperator=ks,h.VariableVisibilityTargetType=Us,h.VariableVisibilityType=Ot,h.VerticalAlign=ws,h.ViewMode=or,h.WellKnownConfigurationKeys=Y,h.default=Wn,h.grafxMediaConnectorRegistration=En,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
69
69
|
//# sourceMappingURL=main.js.map
|