@chili-publish/studio-sdk 1.26.0 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/_bundles/main.es.js +789 -777
  2. package/_bundles/main.es.js.map +1 -1
  3. package/_bundles/main.js +3 -4
  4. package/_bundles/main.js.map +1 -1
  5. package/lib/editor-engine.json +1 -1
  6. package/lib/package.json +1 -1
  7. package/lib/src/controllers/BrandKitController.d.ts +48 -2
  8. package/lib/src/controllers/BrandKitController.js +148 -66
  9. package/lib/src/controllers/BrandKitController.js.map +1 -1
  10. package/lib/src/controllers/PageController.d.ts +4 -4
  11. package/lib/src/controllers/PageController.js +2 -2
  12. package/lib/src/controllers/PageController.js.map +1 -1
  13. package/lib/src/controllers/SubscriberController.d.ts +8 -2
  14. package/lib/src/controllers/SubscriberController.js +11 -3
  15. package/lib/src/controllers/SubscriberController.js.map +1 -1
  16. package/lib/src/controllers/UndoManagerController.d.ts +7 -1
  17. package/lib/src/controllers/UndoManagerController.js +11 -3
  18. package/lib/src/controllers/UndoManagerController.js.map +1 -1
  19. package/lib/src/index.d.ts +1 -1
  20. package/lib/src/index.js.map +1 -1
  21. package/lib/src/interactions/Connector.d.ts +5 -1
  22. package/lib/src/interactions/Connector.js +2 -2
  23. package/lib/src/interactions/Connector.js.map +1 -1
  24. package/lib/src/next/controllers/SubscriberController.d.ts +5 -0
  25. package/lib/src/next/controllers/SubscriberController.js +7 -0
  26. package/lib/src/next/controllers/SubscriberController.js.map +1 -1
  27. package/lib/src/next/tests/controllers/SubscriberContoller.test.js +1 -0
  28. package/lib/src/next/tests/controllers/SubscriberContoller.test.js.map +1 -1
  29. package/lib/src/sdk.js +1 -0
  30. package/lib/src/sdk.js.map +1 -1
  31. package/lib/src/tests/__mocks__/Brandkit.js +15 -0
  32. package/lib/src/tests/__mocks__/Brandkit.js.map +1 -1
  33. package/lib/src/tests/controllers/BrandKitController.test.js +64 -1
  34. package/lib/src/tests/controllers/BrandKitController.test.js.map +1 -1
  35. package/lib/src/tests/controllers/SubscriberContoller.test.js +9 -3
  36. package/lib/src/tests/controllers/SubscriberContoller.test.js.map +1 -1
  37. package/lib/src/tests/controllers/UndoManagerController.test.js +2 -2
  38. package/lib/src/tests/controllers/UndoManagerController.test.js.map +1 -1
  39. package/lib/src/types/BrandKitTypes.d.ts +10 -3
  40. package/lib/src/types/CommonTypes.d.ts +8 -2
  41. package/lib/src/types/CommonTypes.js.map +1 -1
  42. package/lib/src/types/FrameTypes.d.ts +8 -3
  43. package/lib/src/types/FrameTypes.js +1 -0
  44. package/lib/src/types/FrameTypes.js.map +1 -1
  45. package/lib/src/utils/ConfigHelper.js +1 -0
  46. package/lib/src/utils/ConfigHelper.js.map +1 -1
  47. package/package.json +1 -1
package/_bundles/main.js CHANGED
@@ -1,4 +1,4 @@
1
- (function(h,v){typeof exports=="object"&&typeof module<"u"?v(exports):typeof define=="function"&&define.amd?define(["exports"],v):(h=typeof globalThis<"u"?globalThis:h||self,v(h.StudioSDK=h.StudioSDK||{}))})(this,function(h){"use strict";var Pr=h=>{throw TypeError(h)};var Fr=(h,v,O)=>v.has(h)||Pr("Cannot "+O);var a=(h,v,O)=>(Fr(h,v,"read from private field"),O?O.call(h):v.get(h)),g=(h,v,O)=>v.has(h)?Pr("Cannot add the same private member more than once"):v instanceof WeakSet?v.add(h):v.set(h,O),y=(h,v,O,se)=>(Fr(h,v,"write to private field"),se?se.call(h,O):v.set(h,O),O);var N,L,_,dt,st,M,rt,Gt,T,V,Pt,ut,or,gt,yt,nt,xt,at,_t,it,pt,B,ot,Ft,P,Et,u,f,Ht,q,$t,E,Kt,cr,U,Ct,Dt,Y,Lt,zt,mt,Ot,Wt,jt,S,Nt,Rt,hr,Z,wt,ft,Mt,ee,ct,Tt;const O={current:"2.9.latest"},Ce={version:"1.26.0"};var $;(function(s){s.Call="call",s.Reply="reply",s.Syn="syn",s.SynAck="synAck",s.Ack="ack"})($||($={}));var ht;(function(s){s.Fulfilled="fulfilled",s.Rejected="rejected"})(ht||(ht={}));var Ut;(function(s){s.ConnectionDestroyed="ConnectionDestroyed",s.ConnectionTimeout="ConnectionTimeout",s.NoIframeSrc="NoIframeSrc"})(Ut||(Ut={}));var re;(function(s){s.DataCloneError="DataCloneError"})(re||(re={}));var tt;(function(s){s.Message="message"})(tt||(tt={}));const Er=(s,i)=>{const t=[];let e=!1;return{destroy(r){e||(e=!0,i(`${s}: Destroying connection`),t.forEach(n=>{n(r)}))},onDestroy(r){e?r():t.push(r)}}},Dr=s=>(...i)=>{s&&console.log("[Penpal]",...i)},Lr={"http:":"80","https:":"443"},Or=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,Nr=["file:","data:"],Rr=s=>{if(s&&Nr.find(d=>s.startsWith(d)))return"null";const i=document.location,t=Or.exec(s);let e,r,n;t?(e=t[1]?t[1]:i.protocol,r=t[2],n=t[4]):(e=i.protocol,r=i.hostname,n=i.port);const c=n&&n!==Lr[e]?`:${n}`:"";return`${e}//${r}${c}`},me=({name:s,message:i,stack:t})=>({name:s,message:i,stack:t}),Mr=s=>{const i=new Error;return Object.keys(s).forEach(t=>i[t]=s[t]),i},Tr=(s,i,t)=>{const{localName:e,local:r,remote:n,originForSending:c,originForReceiving:d}=s;let l=!1;const p=C=>{if(C.source!==n||C.data.penpal!==$.Call)return;if(C.origin!==d){t(`${e} received message from origin ${C.origin} which did not match expected origin ${d}`);return}const w=C.data,{methodName:b,args:I,id:F}=w;t(`${e}: Received ${b}() call`);const H=D=>j=>{if(t(`${e}: Sending ${b}() reply`),l){t(`${e}: Unable to send ${b}() reply due to destroyed connection`);return}const J={penpal:$.Reply,id:F,resolution:D,returnValue:j};D===ht.Rejected&&j instanceof Error&&(J.returnValue=me(j),J.returnValueIsError=!0);try{n.postMessage(J,c)}catch(A){if(A.name===re.DataCloneError){const Q={penpal:$.Reply,id:F,resolution:ht.Rejected,returnValue:me(A),returnValueIsError:!0};n.postMessage(Q,c)}throw A}};new Promise(D=>D(i[b].apply(i,I))).then(H(ht.Fulfilled),H(ht.Rejected))};return r.addEventListener(tt.Message,p),()=>{l=!0,r.removeEventListener(tt.Message,p)}};let Vr=0;const Br=()=>++Vr,we=".",fe=s=>s?s.split(we):[],Ur=s=>s.join(we),Jr=(s,i)=>{const t=fe(i||"");return t.push(s),Ur(t)},kr=(s,i,t)=>{const e=fe(i);return e.reduce((r,n,c)=>(typeof r[n]>"u"&&(r[n]={}),c===e.length-1&&(r[n]=t),r[n]),s),s},Se=(s,i)=>{const t={};return Object.keys(s).forEach(e=>{const r=s[e],n=Jr(e,i);typeof r=="object"&&Object.assign(t,Se(r,n)),typeof r=="function"&&(t[n]=r)}),t},Gr=s=>{const i={};for(const t in s)kr(i,t,s[t]);return i},xr=(s,i,t,e,r)=>{const{localName:n,local:c,remote:d,originForSending:l,originForReceiving:p}=i;let C=!1;r(`${n}: Connecting call sender`);const w=I=>(...F)=>{r(`${n}: Sending ${I}() call`);let H;try{d.closed&&(H=!0)}catch{H=!0}if(H&&e(),C){const D=new Error(`Unable to send ${I}() call due to destroyed connection`);throw D.code=Ut.ConnectionDestroyed,D}return new Promise((D,j)=>{const J=Br(),A=X=>{if(X.source!==d||X.data.penpal!==$.Reply||X.data.id!==J)return;if(X.origin!==p){r(`${n} received message from origin ${X.origin} which did not match expected origin ${p}`);return}const Vt=X.data;r(`${n}: Received ${I}() reply`),c.removeEventListener(tt.Message,A);let Bt=Vt.returnValue;Vt.returnValueIsError&&(Bt=Mr(Bt)),(Vt.resolution===ht.Fulfilled?D:j)(Bt)};c.addEventListener(tt.Message,A);const Q={penpal:$.Call,id:J,methodName:I,args:F};d.postMessage(Q,l)})},b=t.reduce((I,F)=>(I[F]=w(F),I),{});return Object.assign(s,Gr(b)),()=>{C=!0}},_r=(s,i,t,e,r)=>{const{destroy:n,onDestroy:c}=e;let d,l;const p={};return C=>{if(C.origin!==i){r(`Parent: Handshake - Received ACK message from origin ${C.origin} which did not match expected origin ${i}`);return}r("Parent: Handshake - Received ACK");const w={localName:"Parent",local:window,remote:C.source,originForSending:t,originForReceiving:i};d&&d(),d=Tr(w,s,r),c(d),l&&l.forEach(I=>{delete p[I]}),l=C.data.methodNames;const b=xr(p,w,l,n,r);return c(b),p}},Hr=(s,i,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:$.SynAck,methodNames:Object.keys(i)};r.source.postMessage(n,e)},$r=6e4,Kr=(s,i)=>{const{destroy:t,onDestroy:e}=i,r=setInterval(()=>{s.isConnected||(clearInterval(r),t())},$r);e(()=>{clearInterval(r)})},zr=(s,i)=>{let t;return s!==void 0&&(t=window.setTimeout(()=>{const e=new Error(`Connection timed out after ${s}ms`);e.code=Ut.ConnectionTimeout,i(e)},s)),()=>{clearTimeout(t)}},Wr=s=>{if(!s.src&&!s.srcdoc){const i=new Error("Iframe must have src or srcdoc property defined.");throw i.code=Ut.NoIframeSrc,i}},jr=s=>{let{iframe:i,methods:t={},childOrigin:e,timeout:r,debug:n=!1}=s;const c=Dr(n),d=Er("Parent",c),{onDestroy:l,destroy:p}=d;e||(Wr(i),e=Rr(i.src));const C=e==="null"?"*":e,w=Se(t),b=Hr(c,w,e,C),I=_r(w,e,C,d,c);return{promise:new Promise((H,D)=>{const j=zr(r,p),J=A=>{if(!(A.source!==i.contentWindow||!A.data)){if(A.data.penpal===$.Syn){b(A);return}if(A.data.penpal===$.Ack){const Q=I(A);Q&&(j(),H(Q));return}}};window.addEventListener(tt.Message,J),c("Parent: Awaiting handshake"),Kr(i,d),l(A=>{window.removeEventListener(tt.Message,J),A&&D(A)})}),destroy(){p()}}},qr=s=>{const i=new RegExp(/^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w.-]+)+[\w]+\/$/);let t="";return i.test(s)?t=s:s.indexOf("/index.html")>-1?t=s.replace("/index.html","/"):s.charAt(-1)!=="/"&&(t=`${s}/`),t},Yr=(s,i,t)=>{const e=qr(i),n=`<html>
1
+ (function(h,F){typeof exports=="object"&&typeof module<"u"?F(exports):typeof define=="function"&&define.amd?define(["exports"],F):(h=typeof globalThis<"u"?globalThis:h||self,F(h.StudioSDK=h.StudioSDK||{}))})(this,function(h){"use strict";var Pr=h=>{throw TypeError(h)};var Fr=(h,F,M)=>F.has(h)||Pr("Cannot "+M);var a=(h,F,M)=>(Fr(h,F,"read from private field"),M?M.call(h):F.get(h)),g=(h,F,M)=>F.has(h)?Pr("Cannot add the same private member more than once"):F instanceof WeakSet?F.add(h):F.set(h,M),y=(h,F,M,se)=>(Fr(h,F,"write to private field"),se?se.call(h,M):F.set(h,M),M);var N,L,K,O,rt,V,nt,Gt,B,J,Ft,gt,or,yt,pt,at,xt,it,_t,ot,Ct,U,ct,Et,E,Dt,u,w,Ht,Y,$t,D,Kt,cr,k,mt,Lt,Z,wt,zt,ht,Ot,Wt,jt,f,Mt,Nt,hr,Q,ft,St,Rt,ee,lt,Tt;const M={current:"2.10.latest"},Ce={version:"1.27.0"};var z;(function(s){s.Call="call",s.Reply="reply",s.Syn="syn",s.SynAck="synAck",s.Ack="ack"})(z||(z={}));var dt;(function(s){s.Fulfilled="fulfilled",s.Rejected="rejected"})(dt||(dt={}));var Jt;(function(s){s.ConnectionDestroyed="ConnectionDestroyed",s.ConnectionTimeout="ConnectionTimeout",s.NoIframeSrc="NoIframeSrc"})(Jt||(Jt={}));var re;(function(s){s.DataCloneError="DataCloneError"})(re||(re={}));var et;(function(s){s.Message="message"})(et||(et={}));const Er=(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)}}},Dr=s=>(...o)=>{s&&console.log("[Penpal]",...o)},Lr={"http:":"80","https:":"443"},Or=/^(https?:)?\/\/([^/:]+)?(:(\d+))?/,Mr=["file:","data:"],Nr=s=>{if(s&&Mr.find(l=>s.startsWith(l)))return"null";const o=document.location,t=Or.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!==Lr[e]?`:${n}`:"";return`${e}//${r}${c}`},me=({name:s,message:o,stack:t})=>({name:s,message:o,stack:t}),Rr=s=>{const o=new Error;return Object.keys(s).forEach(t=>o[t]=s[t]),o},Tr=(s,o,t)=>{const{localName:e,local:r,remote:n,originForSending:c,originForReceiving:l}=s;let d=!1;const p=C=>{if(C.source!==n||C.data.penpal!==z.Call)return;if(C.origin!==l){t(`${e} received message from origin ${C.origin} which did not match expected origin ${l}`);return}const S=C.data,{methodName:A,args:b,id:I}=S;t(`${e}: Received ${A}() call`);const R=P=>G=>{if(t(`${e}: Sending ${A}() reply`),d){t(`${e}: Unable to send ${A}() reply due to destroyed connection`);return}const x={penpal:z.Reply,id:I,resolution:P,returnValue:G};P===dt.Rejected&&G instanceof Error&&(x.returnValue=me(G),x.returnValueIsError=!0);try{n.postMessage(x,c)}catch(v){if(v.name===re.DataCloneError){const X={penpal:z.Reply,id:I,resolution:dt.Rejected,returnValue:me(v),returnValueIsError:!0};n.postMessage(X,c)}throw v}};new Promise(P=>P(o[A].apply(o,b))).then(R(dt.Fulfilled),R(dt.Rejected))};return r.addEventListener(et.Message,p),()=>{d=!0,r.removeEventListener(et.Message,p)}};let Vr=0;const Br=()=>++Vr,we=".",fe=s=>s?s.split(we):[],Jr=s=>s.join(we),Ur=(s,o)=>{const t=fe(o||"");return t.push(s),Jr(t)},kr=(s,o,t)=>{const e=fe(o);return e.reduce((r,n,c)=>(typeof r[n]>"u"&&(r[n]={}),c===e.length-1&&(r[n]=t),r[n]),s),s},Se=(s,o)=>{const t={};return Object.keys(s).forEach(e=>{const r=s[e],n=Ur(e,o);typeof r=="object"&&Object.assign(t,Se(r,n)),typeof r=="function"&&(t[n]=r)}),t},Gr=s=>{const o={};for(const t in s)kr(o,t,s[t]);return o},xr=(s,o,t,e,r)=>{const{localName:n,local:c,remote:l,originForSending:d,originForReceiving:p}=o;let C=!1;r(`${n}: Connecting call sender`);const S=b=>(...I)=>{r(`${n}: Sending ${b}() call`);let R;try{l.closed&&(R=!0)}catch{R=!0}if(R&&e(),C){const P=new Error(`Unable to send ${b}() call due to destroyed connection`);throw P.code=Jt.ConnectionDestroyed,P}return new Promise((P,G)=>{const x=Br(),v=tt=>{if(tt.source!==l||tt.data.penpal!==z.Reply||tt.data.id!==x)return;if(tt.origin!==p){r(`${n} received message from origin ${tt.origin} which did not match expected origin ${p}`);return}const Vt=tt.data;r(`${n}: Received ${b}() reply`),c.removeEventListener(et.Message,v);let Bt=Vt.returnValue;Vt.returnValueIsError&&(Bt=Rr(Bt)),(Vt.resolution===dt.Fulfilled?P:G)(Bt)};c.addEventListener(et.Message,v);const X={penpal:z.Call,id:x,methodName:b,args:I};l.postMessage(X,d)})},A=t.reduce((b,I)=>(b[I]=S(I),b),{});return Object.assign(s,Gr(A)),()=>{C=!0}},_r=(s,o,t,e,r)=>{const{destroy:n,onDestroy:c}=e;let l,d;const p={};return C=>{if(C.origin!==o){r(`Parent: Handshake - Received ACK message from origin ${C.origin} which did not match expected origin ${o}`);return}r("Parent: Handshake - Received ACK");const S={localName:"Parent",local:window,remote:C.source,originForSending:t,originForReceiving:o};l&&l(),l=Tr(S,s,r),c(l),d&&d.forEach(b=>{delete p[b]}),d=C.data.methodNames;const A=xr(p,S,d,n,r);return c(A),p}},Hr=(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:z.SynAck,methodNames:Object.keys(o)};r.source.postMessage(n,e)},$r=6e4,Kr=(s,o)=>{const{destroy:t,onDestroy:e}=o,r=setInterval(()=>{s.isConnected||(clearInterval(r),t())},$r);e(()=>{clearInterval(r)})},zr=(s,o)=>{let t;return s!==void 0&&(t=window.setTimeout(()=>{const e=new Error(`Connection timed out after ${s}ms`);e.code=Jt.ConnectionTimeout,o(e)},s)),()=>{clearTimeout(t)}},Wr=s=>{if(!s.src&&!s.srcdoc){const o=new Error("Iframe must have src or srcdoc property defined.");throw o.code=Jt.NoIframeSrc,o}},jr=s=>{let{iframe:o,methods:t={},childOrigin:e,timeout:r,debug:n=!1}=s;const c=Dr(n),l=Er("Parent",c),{onDestroy:d,destroy:p}=l;e||(Wr(o),e=Nr(o.src));const C=e==="null"?"*":e,S=Se(t),A=Hr(c,S,e,C),b=_r(S,e,C,l,c);return{promise:new Promise((R,P)=>{const G=zr(r,p),x=v=>{if(!(v.source!==o.contentWindow||!v.data)){if(v.data.penpal===z.Syn){A(v);return}if(v.data.penpal===z.Ack){const X=b(v);X&&(G(),R(X));return}}};window.addEventListener(et.Message,x),c("Parent: Awaiting handshake"),Kr(o,l),d(v=>{window.removeEventListener(et.Message,x),v&&P(v)})}),destroy(){p()}}},qr=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},Yr=(s,o,t)=>{const e=qr(o),n=`<html>
2
2
  <head>
3
3
  <base href="/" />
4
4
  <meta charset="UTF-8"/>
@@ -9,14 +9,13 @@
9
9
  <script>
10
10
  <\/script>
11
11
  <script src="${e}init.js" async><\/script>
12
- <script src="${e}init_engine.js"><\/script>
12
+ <script src="${e}flutter_bootstrap.js"><\/script>
13
13
  <script>
14
14
  initializeStudioEngine({
15
15
  assetBase: '${e}',
16
- entryPointUrl: '${e}main.dart.js',
17
16
  });
18
17
  <\/script>
19
18
  </body>
20
19
  </html>
21
- `;s.srcdoc=n},Zr=(s,i,t,e="chili-editor",r)=>{const n=`#${e}`,c=document.createElement("iframe");c.setAttribute("srcdoc"," "),c.setAttribute("title","Chili-Editor"),c.setAttribute("style","width: 100%; height: 100%;"),c.setAttribute("frameBorder","0"),c.setAttribute("referrerpolicy","origin");const d=()=>{const l=document.querySelector(n);l&&(l==null||l.appendChild(c),Yr(c,s,r))};document.readyState==="complete"||document.readyState==="interactive"?d():document.addEventListener("DOMContentLoaded",()=>{d()}),t(jr({iframe:c,methods:{actionsChanged:i.onActionsChanged,stateChanged:i.onStateChanged,documentLoaded:i.onDocumentLoaded,authExpired:i.onAuthExpired,viewportRequested:i.onViewportRequested,selectedFramesContent:i.onSelectedFramesContentChanged,selectedFramesLayout:i.onSelectedFramesLayoutChanged,allFramesLayout:i.onFramesLayoutChanged,selectedLayoutProperties:i.onSelectedLayoutPropertiesChanged,openLayoutPropertiesPanel:i.onPageSelectionChanged,selectedLayoutUnit:i.onSelectedLayoutUnitChanged,scrubberPositionChanged:i.onScrubberPositionChanged,frameAnimationsChanged:i.onFrameAnimationsChanged,selectedToolChanged:i.onSelectedToolChanged,variableListChanged:i.onVariableListChanged,undoStackStateChanged:i.onUndoStateChanged,selectedLayoutFramesChanged:i.onSelectedLayoutFramesChanged,selectedTextStyleChanged:i.onSelectedTextStyleChanged,colorsChanged:i.onColorsChanged,paragraphStylesChanged:i.onParagraphStylesChanged,characterStylesChanged:i.onCharacterStylesChanged,fontFamiliesChanged:i.onFontFamiliesChanged,selectedLayoutId:i.onSelectedLayoutIdChanged,layoutListChanged:i.onLayoutsChanged,connectorEvent:i.onConnectorEvent,connectorsChanged:i.onConnectorsChanged,zoomChanged:i.onZoomChanged,pageSnapshotInvalidated:i.onPageSnapshotInvalidated,pagesChanged:i.onPagesChanged,pageSizeChanged:i.onPageSizeChanged,shapeCornerRadiusChanged:i.onShapeCornerRadiusChanged,cropActiveFrameIdChanged:i.onCropActiveFrameIdChanged,asyncError:i.onAsyncError,viewModeChanged:i.onViewModeChanged,barcodeValidationChanged:i.onBarcodeValidationChanged,selectedPageIdChanged:i.onSelectedPageIdChanged,dataSourceIdChanged:i.onDataSourceIdChanged,documentIssueListChanged:i.onDocumentIssueListChanged,customUndoDataChanged:i.onCustomUndoDataChanged,engineEditingModeChanged:i.onEngineEditModeChanged}}))};var K=(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))(K||{});const Qr={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}}};var be=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(be||{}),ne=(s=>(s.project="project",s.template="template",s))(ne||{});const Xr=404075;function o(s,i=!0){try{if(!s.success){const e=s.error??"Yikes, something went wrong",r={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===Xr){const c=JSON.parse(s.data).statusCode;throw new Ie(c,e,r)}else throw new Error(e,r)}const t=s.data&&i;return{...s,parsedData:t?JSON.parse(s.data):s.data}}catch(t){throw console.error(t),t}}class Ie extends Error{constructor(i,t,e){super(t,e),this.statusCode=i}}class Ae{constructor(i){g(this,N);this.getAll=async()=>(await a(this,N)).getActions().then(e=>o(e)),this.getById=async t=>(await a(this,N)).getActionById(t).then(r=>o(r)),this.create=async()=>(await a(this,N)).createAction().then(e=>o(e)),this.duplicate=async t=>(await a(this,N)).duplicateAction(t).then(r=>o(r)),this.remove=async t=>(await a(this,N)).removeAction(t).then(r=>o(r)),this.update=async(t,e)=>(await a(this,N)).updateAction(t,JSON.stringify(e)).then(n=>o(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,N)).moveActions(t,e).then(n=>o(n)),this.setTypeError=async(t,e)=>this.update(t,{hasTypeError:e}),this.disable=async()=>(await a(this,N)).disableActions().then(e=>o(e)),this.enable=async()=>(await a(this,N)).enableActions().then(e=>o(e)),y(this,N,i)}}N=new WeakMap;class ve{constructor(i){g(this,L);this.getAllOnSelectedLayout=async()=>(await a(this,L)).getAnimationsOnSelectedLayout().then(e=>o(e)),this.getByFrameId=async(t,e)=>(await a(this,L)).getAnimationByFrameId(t,e).then(n=>o(n)),this.getByLayoutId=async t=>(await a(this,L)).getAnimationsByLayoutId(t).then(r=>o(r)),this.setFrameAnimation=async t=>(await a(this,L)).setFrameAnimation(JSON.stringify(t)).then(r=>o({...r,data:JSON.stringify(t)})),this.play=async()=>(await a(this,L)).playAnimation().then(e=>o(e)),this.pause=async()=>(await a(this,L)).pauseAnimation().then(e=>o(e)),this.setScrubberPosition=async t=>(await a(this,L)).setScrubberPosition(t).then(r=>o(r)),this.setDuration=async t=>(await a(this,L)).setAnimationDuration(t).then(r=>o(r)),this.resetFrameAnimation=async t=>(await a(this,L)).resetFrameAnimation(t).then(r=>o(r)),this.reset=async()=>(await a(this,L)).resetAnimation().then(e=>o(e)),y(this,L,i)}}L=new WeakMap;var k=(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))(k||{}),St=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(St||{}),lt=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(lt||{}),Pe=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(Pe||{}),z=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(z||{}),Fe=(s=>(s.top="top",s.child="child",s))(Fe||{}),Ee=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(Ee||{}),De=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(De||{});class Le{constructor(i){g(this,_);this.setBarcodeProperties=async(t,e)=>(await a(this,_)).setBarcodeProperties(t,JSON.stringify(e)).then(n=>o(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,_)).setBarcodeSource(t,JSON.stringify(e)).then(n=>o(n)),this.removeBarcodeSource=async t=>(await a(this,_)).setBarcodeSource(t,null).then(r=>o(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,_)).setBarcodeProperties(t,JSON.stringify({quietZone:n})).then(d=>o(d))},this.setAreQuietZoneValuesCombined=async(t,e)=>{const r={areQuietZoneValuesCombined:e};return(await a(this,_)).setBarcodeProperties(t,JSON.stringify({quietZone:r})).then(c=>o(c))},this.setErrorCorrectionLevel=async(t,e)=>(await a(this,_)).setBarcodeProperties(t,JSON.stringify({errorCorrectionLevel:e})).then(n=>o(n)),this.setCharacterSet=async(t,e)=>(await a(this,_)).setBarcodeProperties(t,JSON.stringify({characterSet:e})).then(n=>o(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,d,l=!1,p=!1,C=!1;switch(t){case k.qr:c=[lt.iso8859_1,lt.utf8],d=[St.low,St.medium,St.quartile,St.high];case k.dataMatrix:e=!1,r=!1,n=!1,l=!0;break;case k.ean13:e=!1,p=!0;break;case k.ean8:p=!0;case k.upca:case k.upce:e=!1;break;case k.code128:case k.gs1128:c=[lt.code128a,lt.code128b,lt.code128c];break;case k.code39:C=!0;break}return{allowEnableMagnification:n,allowBarHeight:r,allowQuietZone:!0,allowedCharacterSets:c,allowedErrorCorrectionLevels:d,allowToggleText:e,quietZoneAlwaysCombined:l,allowToggleLightMarginIndicator:p,allowToggleDrawStartAndEndChar:C}},y(this,_,i)}}_=new WeakMap;var G=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(G||{}),W=(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))(W||{}),ae=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(ae||{});const Oe=s=>s.type===G.hex,ie=s=>s.type===G.spotHex,tn=s=>s.type===G.spotRgb,en=s=>s.type===G.spotCmyk,sn=s=>tn(s)||en(s)||ie(s),rn=s=>{const i=nn(s.type);return sn(s)?{...ie(s)&&{value:s.displayValue},...!ie(s)&&{...s.displayValue},spotName:s.value,type:i}:{...Oe(s)&&{value:s.value},...!Oe(s)&&{...s.value},type:i}},Ne=(s,i,t)=>{const{brandKitColorGuid:e,brandKitFontFamilyGuid:r,fontStyleId:n,...c}=s;return{...Object.keys(c).reduce((l,p)=>({...l,[p]:{value:s[p]}}),{}),...i&&{color:{value:{id:i.id,color:i.color,type:ae.brandKit,isApplied:c.fillColorApplied}}},fontKey:{value:t??null}}},nn=s=>{switch(s){case G.rgb:return W.rgb;case G.cmyk:return W.cmyk;case G.hex:return W.hex;case G.spotRgb:return W.spotRGB;case G.spotCmyk:return W.spotCMYK;case G.spotHex:return W.spotHEX}},Re=(s,i)=>{if(!(s===null||i===void 0))return(s||[]).find(t=>t.id===i)},Me=(s,i,t)=>{var e,r;if(!(s===null||i===void 0||t===void 0))return(r=(e=(s||[]).find(n=>n.id===i))==null?void 0:e.fontStyles.find(n=>n.fontStyleId===t))==null?void 0:r.id};class Te{constructor(i,t){g(this,dt);this.getId=async()=>(await a(this,dt)).getBrandKitId().then(r=>o(r)),this.getVersion=async()=>(await a(this,dt)).getBrandKitVersion().then(r=>o(r)),this.updateIdAndVersion=async(e,r)=>(await a(this,dt)).updateBrandKitIdAndVersion(e,r).then(c=>o(c)),this.get=async()=>{const e=await this.getId(),r=await this.getVersion(),n=this.colorStyleController.getAll(),c=this.fontController.getFontFamilies(),d=this.characterStyleController.getAll(),l=this.paragraphStyleController.getAll(),[p,C,w,b]=await Promise.all([n,c,l,d]),I={id:e.parsedData,brandKit:{id:e.parsedData,lastModifiedDate:r.parsedData,colors:p.parsedData,fonts:C.parsedData,paragraphStyles:w.parsedData,characterStyles:b.parsedData}},F={success:!0,data:JSON.stringify(I),parsedData:I,status:200};return o(F)},this.remove=async()=>{const r=(await this.colorStyleController.getAll()).parsedData||[],c=(await this.paragraphStyleController.getAll()).parsedData||[],l=(await this.characterStyleController.getAll()).parsedData||[],C=(await this.fontController.getFontFamilies()).parsedData||[];try{await this.undoManagerController.record("brandKit.remove",async w=>{for(const b of r)await w.colorStyle.remove(b.id);for(const b of c)await w.paragraphStyle.remove(b.id);for(const b of l)await w.characterStyle.remove(b.id);for(const b of C)await w.font.removeFontFamily(b.id)})}catch(w){throw this.undoManagerController.undo(),w}},this.set=async e=>{try{let r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,colors:[],fonts:[],paragraphStyles:[],characterStyles:[]}};return await this.undoManagerController.record("brandKit.set",async n=>{const c=await this.setColors(e,n),d=await this.setFonts(e,n),{parsedData:l=[]}=await n.colorStyle.getAll(),{parsedData:p}=await n.font.getFontFamilies();await this.setParagraphStyles(e,n,{localColors:l,localFonts:p,localColorGuidMap:c,localFontGuidMap:d}),await this.setCharacterStyles(e,n,{localColors:l,localFonts:p,localColorGuidMap:c,localFontGuidMap:d});const{parsedData:C}=await n.paragraphStyle.getAll(),{parsedData:w}=await n.characterStyle.getAll();await n.brandKit.updateIdAndVersion(e.id,e.brandKit.lastModifiedDate),r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,colors:l||[],fonts:p||[],paragraphStyles:C||[],characterStyles:w||[]}}}),r}catch(r){throw this.undoManagerController.undo(),r}},y(this,dt,i),this.colorStyleController=t.colorStyle,this.fontController=t.font,this.mediaController=t.mediaConnector,this.paragraphStyleController=t.paragraphStyle,this.characterStyleController=t.characterStyle,this.undoManagerController=t.undoManager}async setColors(i,t){const e=new Map;for(const r of i.brandKit.colors||[]){const{parsedData:n}=await t.colorStyle.create();if(!n)continue;e.set(r.guid,n);const c=rn(r);await t.colorStyle.rename(n,r.name),await t.colorStyle.update(n,c)}return e}async setFonts(i,t){const e=i.fontConnectorId,r=new Map;for(const n of i.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:d}=await t.font.addFontFamily(e,{name:c[0].familyName,fontFamilyId:n.fontFamilyId});d&&r.set(n.fontFamilyBrandKitGuid,d)}return r}async setParagraphStyles(i,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:d}=e;for(const l of i.brandKit.paragraphStyles||[]){const p=c.get(l.brandKitColorGuid),C=d.get(l.brandKitFontFamilyGuid),w=Me(n,C,l.fontStyleId);if(!C||!w)throw new Error(`Paragraph style could not be created with an empty font family: ${l.name}`);const b=Re(r,p);if(!b)throw new Error(`Paragraph style could not be created with an empty color: ${l.name}`);const{parsedData:I}=await t.paragraphStyle.create(),F=Ne(l,b,`${w}`);await t.paragraphStyle.rename(I,l.name),await t.paragraphStyle.update(I,F)}}async setCharacterStyles(i,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:d}=e;for(const l of i.brandKit.characterStyles||[]){const p=l.brandKitColorGuid?c.get(l.brandKitColorGuid):void 0,C=l.brandKitFontFamilyGuid?d.get(l.brandKitFontFamilyGuid):void 0,w=Re(r,p),b=Me(n,C,l.fontStyleId),{parsedData:I}=await t.characterStyle.create(),F=Ne(l,w,b);await t.characterStyle.rename(I,l.name),await t.characterStyle.update(I,F)}}}dt=new WeakMap;class oe{constructor(i){g(this,st);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,st)).zoomToPage(e,r,n,c).then(l=>o(l))),this.getZoomPercentage=async()=>(await a(this,st)).getZoomPercentage().then(e=>o(e)),this.setZoomPercentage=async t=>(await a(this,st)).setZoomPercentage(t).then(r=>o(r)),this.setViewMode=async t=>(await a(this,st)).setViewMode(t).then(r=>o(r)),y(this,st,i)}}st=new WeakMap;class Ve{constructor(i){g(this,M);this.getAll=async()=>(await a(this,M)).getCharacterStyles().then(e=>o(e)),this.getById=async t=>(await a(this,M)).getCharacterStyleById(t).then(r=>o(r)),this.create=async()=>(await a(this,M)).createCharacterStyle().then(e=>o(e)),this.update=async(t,e)=>(await a(this,M)).updateCharacterStyle(t,JSON.stringify(e)).then(n=>o(n)),this.remove=async t=>(await a(this,M)).removeCharacterStyle(t).then(r=>o(r)),this.duplicate=async t=>(await a(this,M)).duplicateCharacterStyle(t).then(r=>o(r)),this.rename=async(t,e)=>(await a(this,M)).renameCharacterStyle(t,e).then(n=>o(n)),this.move=async(t,e)=>(await a(this,M)).moveCharacterStyles(t,e).then(n=>o(n)),y(this,M,i)}}M=new WeakMap;class Be{constructor(i){g(this,rt);this.copyFrames=async t=>{const r=await(await a(this,rt)).copyFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),o(r)},this.cutFrames=async t=>{const r=await(await a(this,rt)).cutFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),o(r)},this.pasteFrames=async()=>{const t=await a(this,rt),e=await navigator.clipboard.readText(),r=await t.pasteFrames(e);return o(r)},this.getContentType=async()=>{const t=await a(this,rt),e=await navigator.clipboard.readText(),r=await t.getClipboardContentType(e);return o(r)},y(this,rt,i)}}rt=new WeakMap;class Ue{constructor(i){g(this,Gt);this.convertToRgb=async t=>(await a(this,Gt)).colorToRgb(JSON.stringify(t)).then(r=>o(r)),y(this,Gt,i)}}Gt=new WeakMap;class Je{constructor(i){g(this,T);this.getAll=async()=>(await a(this,T)).getColors().then(e=>o(e)),this.getById=async t=>(await a(this,T)).getColorById(t).then(r=>o(r)),this.create=async()=>(await a(this,T)).createColor().then(e=>o(e)),this.duplicate=async t=>(await a(this,T)).duplicateColor(t).then(r=>o(r)),this.move=async(t,e)=>(await a(this,T)).moveColors(t,e).then(n=>o(n)),this.rename=async(t,e)=>(await a(this,T)).renameColor(t,e).then(n=>o(n)),this.update=async(t,e)=>{const r=await a(this,T),n=e;return n.type===W.spot&&(n.type=W.spotCMYK),r.updateColor(t,JSON.stringify(n)).then(c=>o(c))},this.remove=async t=>(await a(this,T)).removeColor(t).then(r=>o(r)),y(this,T,i)}}T=new WeakMap;var bt=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(bt||{}),Yt=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(Yt||{}),It=(s=>(s.file="file",s.collection="collection",s))(It||{}),ke=(s=>(s.media="media",s.fonts="fonts",s.data="data",s))(ke||{}),Ge=(s=>(s.name="name",s.path="relativePath",s.id="id",s))(Ge||{}),xe=(s=>(s.ascending="asc",s.descending="desc",s))(xe||{}),_e=(s=>(s.text="text",s.boolean="boolean",s))(_e||{}),He=(s=>(s.query="query",s.upload="upload",s))(He||{}),At=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(At||{});class an{constructor(i,t,e,r="engineToConnector"){this.direction="engineToConnector",this.name=i,this.direction=r,t==="var"?this.value=`${t}.${e}`:this.value=e}}var $e=(s=>(s.variable="var",s.value="value",s))($e||{}),Ke=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(Ke||{}),Zt=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(Zt||{}),ze=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(ze||{});const on={url:"grafx-media.json",source:"local"};class cn{constructor(i){this.type="grafxToken",this.token=i}}class hn{constructor(){this.type="refreshed"}}var We=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(We||{}),je=(s=>(s.grafxToken="grafxToken",s.any="any",s))(je||{}),ce=(s=>(s.minDimension="minDimension",s))(ce||{});class qe extends Error{constructor(i,t){super(i),this.type=t}}class he{constructor(){this.makeConnectorSourceForwardsCompatible=i=>{if(i.source!=At.grafx||this.isSourceMigrated(i))return i;let t=i.url;for(;t.endsWith("/");)t=t.substring(0,t.length-1);const e=t.split("/");return{id:e[e.length-1],source:At.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(i,t)=>i.map(e=>this.makeSingleConnectorBackwardsCompatible(e,t)),this.makeSingleConnectorBackwardsCompatible=(i,t)=>i.source.source!=At.grafx?i:{id:i.id,name:i.name,iconUrl:i.iconUrl,source:this.makeConnectorSourceBackwardsCompatible(i.source,t)},this.makeConnectorSourceBackwardsCompatible=(i,t)=>{let e=t;for(;e!=null&&e.endsWith("/");)e=e.substring(0,e.length-1);return{url:`${e}/connectors/${i.id}`,source:At.grafx}},this.isSourceMigrated=i=>"id"in i}}let Ye=(or=class{constructor(i,t){g(this,V);g(this,Pt);g(this,ut);this.getById=async e=>(await a(this,V)).getConnectorById(e).then(n=>o(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,ut).makeSingleConnectorBackwardsCompatible(n.parsedData,a(this,Pt).get(K.GraFxStudioEnvironmentApiUrl))),c}),this.getAllByType=async e=>(await a(this,V)).getConnectors(e).then(n=>o(n)).then(n=>{const c={...n,parsedData:null};return n.parsedData&&(c.parsedData=a(this,ut).makeMultipleConnectorsBackwardsCompatible(n.parsedData,a(this,Pt).get(K.GraFxStudioEnvironmentApiUrl))),c}),this.register=async e=>{const r=await a(this,V),n=a(this,ut).makeConnectorSourceForwardsCompatible(e);return r.registerConnector(JSON.stringify(n)).then(c=>o(c))},this.unregister=async e=>(await a(this,V)).unregisterConnector(e).then(n=>o(n)),this.configure=async(e,r)=>{const n=await a(this,V);return await this.waitToBeReady(e),await r(new ln(e,n)),n.updateConnectorConfiguration(e).then(c=>o(c))},this.getState=async e=>(await a(this,V)).getConnectorState(e).then(n=>o(n)),this.getOptions=async e=>(await a(this,V)).getConnectorOptions(e).then(n=>o(n)),this.waitToBeReady=async(e,r=2e3)=>{let n=Math.max(r,500);n=Math.min(n,5e3);const c=100;let d=0;try{for(;d*c<n;){const l=await this.getState(e);if(l.success&&l.parsedData&&(l.parsedData.type===Zt.running||l.parsedData.type===Zt.ready))return o({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(p=>setTimeout(p,c)),d++}}catch(l){return o({data:null,success:!1,error:`Error while getting connector state ${l}`,status:5e4,parsedData:void 0},!1)}return o({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),d=(c==null?void 0:c.filter(C=>!r.some(w=>w.name===C.name&&w.direction===C.direction)))??[],l=r.filter(C=>C.name!==""&&C.value!==""),p=[...d,...l];await n.setMappings(p)}),y(this,V,i),y(this,Pt,t),y(this,ut,new he)}async getMappings(i,t){return(await a(this,V)).getConnectorMappings(i).then(r=>o(r)).then(r=>{var n;return t?{...r,parsedData:(n=r.parsedData)==null?void 0:n.filter(c=>c.direction===t)}:r})}},V=new WeakMap,Pt=new WeakMap,ut=new WeakMap,or);class ln{constructor(i,t){g(this,gt);g(this,yt);this.setOptions=async e=>a(this,yt).setConnectorOptions(a(this,gt),JSON.stringify(e)).then(r=>o(r)),this.setMappings=async e=>{const r=await a(this,yt).setConnectorMappings(a(this,gt),e.map(function(n){return JSON.stringify(n)}));return o(r)},this.setHttpHeader=async(e,r)=>a(this,yt).connectorAuthenticationSetHttpHeader(a(this,gt),e,r).then(n=>o(n)),y(this,gt,i),y(this,yt,t)}}gt=new WeakMap,yt=new WeakMap;class Ze{constructor(i,t){g(this,nt);g(this,xt);this.getPage=async(e,r,n={})=>(await a(this,nt)).dataConnectorGetPage(e,JSON.stringify(r),JSON.stringify(n)).then(d=>o(d)).then(d=>{const l={...d,parsedData:null};return d.parsedData&&(l.parsedData={data:d.parsedData.data.map(p=>a(this,xt).mapEngineToDataItem(p)),continuationToken:d.parsedData.continuationToken}),l}),this.getModel=async(e,r={})=>(await a(this,nt)).dataConnectorGetModel(e,JSON.stringify(r)).then(c=>o(c)),this.getConfigurationOptions=async e=>(await a(this,nt)).dataConnectorGetConfigurationOptions(e).then(n=>o(n)),this.getCapabilities=async e=>(await a(this,nt)).dataConnectorGetCapabilities(e).then(n=>o(n)),y(this,nt,i),y(this,xt,t)}}nt=new WeakMap,xt=new WeakMap;class Qe{constructor(i,t){g(this,at);g(this,_t);this.setDataSource=async e=>(await a(this,at)).setDataSource(e).then(n=>o(n)),this.getDataSource=async()=>(await a(this,at)).getDataSource().then(r=>o(r)),this.removeDataSource=async()=>(await a(this,at)).removeDataSource().then(r=>o(r)),this.setDataRow=async e=>{const r=await a(this,at),n=a(this,_t).mapDataItemToEngine(e);return r.setDataRow(JSON.stringify(n)).then(c=>o(c))},y(this,at,i),y(this,_t,t)}}at=new WeakMap,_t=new WeakMap;class Xe{constructor(i){g(this,it);this.getAllLogs=async()=>(await a(this,it)).getLogs().then(e=>o(e)),this.toggleDebugPanel=async()=>(await a(this,it)).toggleDebugPanel().then(e=>o(e)),this.enableDebug=async()=>(await a(this,it)).enableDebug().then(e=>o(e)),this.disableDebug=async()=>(await a(this,it)).disableDebug().then(e=>o(e)),y(this,it,i)}}it=new WeakMap;class ts{constructor(i){g(this,pt);this.getCurrentState=async()=>(await a(this,pt)).getCurrentDocumentState().then(e=>o(e)),this.load=async(t,e={keepConnectors:!1})=>{const r=await a(this,pt),n=typeof t!="string"?JSON.stringify(t):t;return r.loadDocument(n,JSON.stringify(e)).then(c=>o(c))},this.createAndLoad=async t=>{const e=await a(this,pt),r=JSON.stringify(t);return e.createAndLoadDocument(r).then(n=>o(n))},y(this,pt,i)}}pt=new WeakMap;var es=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(es||{}),Jt=(s=>(s.url="url",s.variable="variable",s.connector="connector",s))(Jt||{}),ss=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s))(ss||{}),rs=(s=>(s.variable="variable",s.text="text",s))(rs||{}),ns=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(ns||{}),as=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(as||{}),is=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(is||{}),os=(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))(os||{}),cs=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(cs||{}),hs=(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))(hs||{}),ls=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(ls||{}),ds=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(ds||{}),us=(s=>(s.page="page",s.frame="frame",s))(us||{}),gs=(s=>(s.start="start",s.end="end",s.center="center",s))(gs||{});class dn{constructor(){this.type="page"}}class un{constructor(i,t){this.type="frame",this.frameId=i,this.edge=t}}var le=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(le||{});class ys{constructor(i){g(this,B);this.insertImageVariableToFrame=async(t,e)=>{const r=await a(this,B),n={id:e,type:Jt.variable};return r.setImageSource(t,JSON.stringify(n)).then(c=>o(c))},this.insertTextVariable=async t=>(await a(this,B)).insertTextVariable(t).then(r=>o(r)),this.enterTextEditMode=async t=>(await a(this,B)).enterTextEditMode(t).then(r=>o(r)),this.exitTextEditMode=async()=>(await a(this,B)).exitTextEditMode().then(e=>o(e)),this.getText=async(t,e)=>(await a(this,B)).getTextByFrameId(t,e).then(n=>o(n)),this.setText=async(t,e)=>(await a(this,B)).setTextByFrameId(t,e).then(n=>o(n)),this.selectText=async(t,e,r)=>(await a(this,B)).selectTextById(t,e,r).then(c=>o(c)),this.addCustomUndoData=async(t,e,r)=>(await a(this,B)).setCustomUndoData(t,e,r??!1).then(c=>o(c)),y(this,B,i)}}B=new WeakMap;class ps{constructor(i){g(this,ot);g(this,Ft);this.query=async(t,e,r={})=>(await a(this,ot)).fontConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>o(c)),this.detail=async(t,e,r={})=>(await a(this,ot)).fontConnectorDetail(t,e,JSON.stringify(r)).then(c=>o(c)),this.download=async(t,e,r={})=>(await a(this,Ft)).fontConnectorDownload(t,e,JSON.stringify(r)).then(c=>c??c),this.preview=async(t,e,r,n={})=>(await a(this,Ft)).fontConnectorPreview(t,e,r,JSON.stringify(n)).then(d=>d??d),this.getConfigurationOptions=async t=>(await a(this,ot)).fontConnectorGetConfigurationOptions(t).then(r=>o(r)),this.getCapabilities=async t=>(await a(this,ot)).fontConnectorGetCapabilities(t).then(r=>o(r)),this.parseDeprecatedFontType=t=>{if(t===bt.file)return It.file;if(t===bt.collection)return It.collection},y(this,ot,i),y(this,Ft,i)}}ot=new WeakMap,Ft=new WeakMap;class Cs{constructor(i){g(this,P);this.addFontFamily=async(t,e)=>(await a(this,P)).addFontFamily(t,JSON.stringify(e)).then(n=>o(n)),this.removeFontFamily=async t=>(await a(this,P)).removeFontFamily(t).then(r=>o(r)),this.addFontStyle=async(t,e)=>(await a(this,P)).addFontStyle(t,JSON.stringify(e)).then(n=>o(n)),this.removeFontStyle=async t=>(await a(this,P)).removeFontStyle(t).then(r=>o(r)),this.getFontFamilies=async()=>(await a(this,P)).getFontFamilies().then(e=>o(e)),this.getFontStyles=async t=>(await a(this,P)).getFontStyles(t).then(r=>o(r)),this.getFontFamilyById=async t=>(await a(this,P)).getFontFamilyById(t).then(r=>o(r)),this.getFontStyleById=async t=>(await a(this,P)).getFontStyleById(t).then(r=>o(r)),this.getDefaultFontStyle=async()=>(await a(this,P)).getDefaultFontStyle().then(e=>o(e)),this.getDefaultFontFamily=async()=>(await a(this,P)).getDefaultFontFamily().then(e=>o(e)),this.isFontFamilyUsed=async t=>(await a(this,P)).isFontFamilyUsed(t).then(r=>o(r)),this.isFontStyleUsed=async t=>(await a(this,P)).isFontStyleUsed(t).then(r=>o(r)),this.moveFontFamilies=async(t,e)=>(await a(this,P)).moveFontFamilies(t,e).then(n=>o(n)),y(this,P,i)}}P=new WeakMap;class de{constructor(i){g(this,Et);this.setShapeProperties=async(t,e)=>(await a(this,Et)).setShapeProperties(t,JSON.stringify(e)).then(n=>o(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,Et)).setShapeCorners(t,JSON.stringify(e)).then(n=>o(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,Et,i)}}Et=new WeakMap;class ms{constructor(i){g(this,u);this.getAll=async()=>(await a(this,u)).getFrames().then(e=>o(e)),this.getSelected=async()=>(await a(this,u)).getSelectedFrames().then(e=>o(e)),this.getAllByPageId=async t=>(await a(this,u)).getFramesByPageId(t).then(r=>o(r)),this.getByName=async t=>(await a(this,u)).getFrameByName(t).then(r=>o(r)),this.getById=async t=>(await a(this,u)).getFrameById(t).then(r=>o(r)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,u)).getFramePropertiesOnSelectedLayout().then(e=>o(e)),this.getLayoutProperties=async(t,e)=>(await a(this,u)).getFramePropertiesByFrameId(t,e).then(n=>o(n)),this.getAllLayoutProperties=async t=>(await a(this,u)).getFramesProperties(t).then(r=>o(r)),this.resetTransformation=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>o(r)),this.resetSize=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>o(r)),this.select=async t=>(await a(this,u)).selectFrames([t]).then(r=>o(r)),this.selectMultiple=async t=>(await a(this,u)).selectFrames(t).then(r=>o(r)),this.deselectAll=async()=>(await a(this,u)).deselectFrames().then(e=>o(e)),this.reorderFrames=async(t,e)=>(await a(this,u)).reorderFrames(t,e).then(n=>o(n)),this.setZIndex=async(t,e)=>(await a(this,u)).setFrameZIndex(t,e).then(n=>o(n)),this.setHeight=async(t,e)=>(await a(this,u)).setFrameHeight(t,e).then(n=>o(n)),this.setRotation=async(t,e)=>(await a(this,u)).setFrameRotation(t,e).then(n=>o(n)),this.setWidth=async(t,e)=>(await a(this,u)).setFrameWidth(t,e).then(n=>o(n)),this.setX=async(t,e)=>(await a(this,u)).setFrameX(t,e).then(n=>o(n)),this.setY=async(t,e)=>(await a(this,u)).setFrameY(t,e).then(n=>o(n)),this.rename=async(t,e)=>(await a(this,u)).renameFrame(t,e).then(n=>o(n)),this.reset=async t=>(await a(this,u)).resetFrame(t).then(r=>o(r)),this.resetX=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>o(r)),this.resetY=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>o(r)),this.resetRotation=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>o(r)),this.resetWidth=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>o(r)),this.resetHeight=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>o(r)),this.resetImageFrameFitMode=async t=>(await a(this,u)).resetImageFrameFitMode(t).then(r=>o(r)),this.setVisibility=async(t,e)=>(await a(this,u)).setFrameIsVisible(t,e).then(n=>o(n)),this.setIsVisible=async(t,e)=>(await a(this,u)).setFrameIsVisible(t,e).then(n=>o(n)),this.remove=async t=>(await a(this,u)).removeFrames([t]).then(r=>o(r)),this.removeFrames=async t=>(await a(this,u)).removeFrames(t).then(r=>o(r)),this.create=async(t,e,r,n,c)=>(await a(this,u)).addFrame(t,e,r,n,c).then(l=>o(l)),this.createShapeFrame=async(t,e,r,n,c)=>(await a(this,u)).addFrame(t,e,r,n,c).then(l=>o(l)),this.createBarcodeFrame=async(t,e)=>(await a(this,u)).addBarcodeFrame(t,e==null?void 0:e.x,e==null?void 0:e.y).then(n=>o(n)),this.duplicateFrames=async t=>(await a(this,u)).duplicateFrames(t).then(r=>o(r)),this.updateImageSource=async(t,e)=>{const r=await a(this,u),n=e!==null?JSON.stringify(e):null;return r.setImageSource(t,n).then(c=>o(c))},this.removeImageSource=async t=>this.updateImageSource(t,null),this.setImageFromConnector=async(t,e,r)=>{const n={id:e,assetId:r,type:Jt.connector};return this.updateImageSource(t,n)},this.setImageFromUrl=async(t,e)=>{const r={url:e,type:Jt.url};return this.updateImageSource(t,r)},this.setImageFrameFitMode=async(t,e)=>(await a(this,u)).setImageFrameFitMode(t,e).then(n=>o(n)),this.setImageFrameFitModePosition=async(t,e)=>(await a(this,u)).setImageFrameFitModePosition(t,e).then(n=>o(n)),this.setFrameConstrainProportions=async(t,e)=>(console.error("setFrameConstrainProportions is not supported anymore"),o({success:!1,status:0,error:"setFrameConstrainProportions is not supported anymore",parsedData:null})),this.setVerticalAlign=async(t,e)=>(await a(this,u)).setVerticalAlignment(t,e).then(n=>o(n)),this.setMinCopyfitting=async(t,e)=>(await a(this,u)).setMinCopyfitting(t,e).then(n=>o(n)),this.setMaxCopyfitting=async(t,e)=>(await a(this,u)).setMaxCopyfitting(t,e).then(n=>o(n)),this.setEnableCopyfitting=async(t,e)=>(await a(this,u)).setEnableCopyfitting(t,e).then(n=>o(n)),this.resetMinCopyfitting=async t=>(await a(this,u)).resetMinCopyfitting(t).then(r=>o(r)),this.resetMaxCopyfitting=async t=>(await a(this,u)).resetMaxCopyfitting(t).then(r=>o(r)),this.resetEnableCopyfitting=async t=>(await a(this,u)).resetEnableCopyfitting(t).then(r=>o(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,u)).setFrameBlendMode(t,e).then(n=>o(n)),this.enterCropMode=async(t,e=le.frameCrop)=>(await a(this,u)).enterCropMode(t,e).then(n=>o(n)),this.applyCropMode=async()=>(await a(this,u)).applyCropMode().then(e=>o(e)),this.exitCropMode=async()=>(await a(this,u)).cancelCropMode().then(e=>o(e)),this.enterSubjectMode=async t=>(await a(this,u)).enterSubjectMode(t).then(r=>o(r)),this.applySubjectMode=async()=>(await a(this,u)).applySubjectMode().then(e=>o(e)),this.exitSubjectMode=async()=>(await a(this,u)).cancelSubjectMode().then(e=>o(e)),this.resetCropMode=async t=>(console.error("resetCropMode is not supported anymore"),o({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,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>o(c))},this.setAutoGrowMinWidth=async(t,e)=>{const r={minWidth:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>o(c))},this.setAutoGrowMaxWidth=async(t,e)=>{const r={maxWidth:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>o(c))},this.setAutoGrowMinHeight=async(t,e)=>{const r={minHeight:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>o(c))},this.setAutoGrowMaxHeight=async(t,e)=>{const r={maxHeight:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>o(c))},this.setAutoGrowDirections=async(t,e)=>{const r={directions:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>o(c))},this.resetAutoGrowSettingsEnabled=async t=>(console.error("resetAutoGrowSettingsEnabled is not supported anymore"),o({success:!1,status:0,error:"resetAutoGrowSettingsEnabled is not supported anymore",parsedData:null})),this.resetAutoGrowMinWidth=async t=>(console.error("resetAutoGrowMinWidth is not supported anymore"),o({success:!1,status:0,error:"resetAutoGrowMinWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMaxWidth=async t=>(console.error("resetAutoGrowMaxWidth is not supported anymore"),o({success:!1,status:0,error:"resetAutoGrowMaxWidth is not supported anymore",parsedData:null})),this.resetAutoGrowMinHeight=async t=>(console.error("resetAutoGrowMinHeight is not supported anymore"),o({success:!1,status:0,error:"resetAutoGrowMinHeight is not supported anymore",parsedData:null})),this.resetAutoGrowMaxHeight=async t=>(console.error("resetAutoGrowMaxHeight is not supported anymore"),o({success:!1,status:0,error:"resetAutoGrowMaxHeight is not supported anymore",parsedData:null})),this.resetAutoGrowDirections=async t=>(console.error("resetAutoGrowDirections is not supported anymore"),o({success:!1,status:0,error:"resetAutoGrowDirections is not supported anymore",parsedData:null})),this.resetAutoGrow=async t=>(console.error("resetAutoGrow is not supported anymore"),o({success:!1,status:0,error:"resetAutoGrow is not supported anymore",parsedData:null})),this.setAnchor=async(t,e,r,n,c)=>{const d={horizontal:e,type:r,target:n,endTarget:c};return(await a(this,u)).setAnchorProperties(t,JSON.stringify(d)).then(p=>o(p))},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,u)).resetFrameTransformation(t).then(r=>o(r)),this.resetVisibility=async t=>(await a(this,u)).setFrameIsVisible(t,null).then(r=>o(r)),this.getConfiguration=async t=>(await a(this,u)).getFrameConfiguration(t).then(r=>o(r)),this.resetAssetCropOverride=async t=>(await a(this,u)).resetAssetCropOverride(t).then(r=>o(r)),this.resetAllAssetCropOverrides=async t=>(await a(this,u)).resetAllAssetCropOverrides(t).then(r=>o(r)),y(this,u,i),this.shapeController=new de(a(this,u))}}u=new WeakMap;class ws{constructor(){this.currentEngineVersion=O.current,this.currentSDKVersion=Ce.version}}class fs{constructor(i){g(this,f);g(this,Ht);this.getAll=async()=>(await a(this,f)).getLayouts().then(e=>o(e)),this.getById=async t=>(await a(this,f)).getLayoutById(t).then(r=>o(r)),this.getByName=async t=>(await a(this,f)).getLayoutByName(t).then(r=>o(r)),this.getSelected=async()=>(await a(this,f)).getSelectedLayout().then(e=>o(e)),this.remove=async t=>(await a(this,f)).removeLayout(t).then(r=>o(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=>o(n)):r.addLayout(t).then(n=>o(n))},this.rename=async(t,e)=>(await a(this,f)).renameLayout(t,e).then(n=>o(n)),this.select=async t=>(await a(this,f)).selectLayout(t).then(r=>o(r)),this.duplicate=async t=>(await a(this,f)).duplicateLayout(t).then(r=>o(r)),this.reset=async t=>(await a(this,f)).resetLayout(t).then(r=>o(r)),this.setHeight=async(t,e)=>(await a(this,f)).setLayoutHeight(t,e).then(n=>o(n)),this.setWidth=async(t,e)=>(await a(this,f)).setLayoutWidth(t,e).then(n=>o(n)),this.setUnit=async(t,e)=>(await a(this,f)).setLayoutUnit(t,e).then(n=>o(n)),this.resetHeight=async t=>(await a(this,f)).resetLayoutHeight(t).then(r=>o(r)),this.resetWidth=async t=>(await a(this,f)).resetLayoutWidth(t).then(r=>o(r)),this.resetUnit=async t=>(await a(this,f)).resetLayoutUnit(t).then(r=>o(r)),this.getSelectedSnapshot=async()=>(await a(this,Ht)).getPageSnapshot().then(e=>e??e),this.setIntent=async(t,e)=>(await a(this,f)).setLayoutIntent(t,e).then(n=>o(n)),this.resetIntent=async t=>(await a(this,f)).resetLayoutIntent(t).then(r=>o(r)),this.setFillColor=async(t,e)=>(await a(this,f)).setLayoutFillColor(t,JSON.stringify(e)).then(n=>o(n)),this.setFillColorEnabled=async(t,e)=>(await a(this,f)).setLayoutFillColorEnabled(t,e).then(n=>o(n)),this.resetFillColor=async t=>(await a(this,f)).resetLayoutFillColor(t).then(r=>o(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(d=>o(d))},this.setAreBleedValuesCombined=async(t,e)=>{const r={areBleedValuesCombined:e};return(await a(this,f)).updateLayoutBleed(t,JSON.stringify(r)).then(c=>o(c))},this.resetBleedValues=async t=>(await a(this,f)).updateLayoutBleed(t,null).then(r=>o(r)),this.setPrivateData=async(t,e)=>(await a(this,f)).setLayoutPrivateData(t,JSON.stringify(e)).then(n=>o(n)),this.getPrivateData=async t=>(await a(this,f)).getLayoutPrivateData(t).then(r=>o(r)),this.setDisplayName=async(t,e)=>(await a(this,f)).setLayoutDisplayName(t,e).then(n=>o(n)),this.getDisplayName=async t=>(await a(this,f)).getLayoutDisplayName(t).then(r=>o(r)),this.resetDisplayName=async t=>(await a(this,f)).setLayoutDisplayName(t,null).then(r=>o(r)),this.setAvailableForUser=async(t,e)=>(await a(this,f)).setLayoutAvailableForUser(t,e).then(n=>o(n)),this.setSelectedByUser=async(t,e)=>(await a(this,f)).setLayoutSelectedByUser(t,e).then(n=>o(n)),this.setResizableByUser=async(t,e)=>(await a(this,f)).setLayoutResizableByUser(t,JSON.stringify(e)).then(n=>o(n)),y(this,f,i),y(this,Ht,i)}}f=new WeakMap,Ht=new WeakMap;var Qt=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(Qt||{}),ue=(s=>(s.web="web",s.print="print",s.animation="animation",s))(ue||{});class Ss{constructor(i){g(this,q);g(this,$t);this.query=async(t,e,r={})=>(await a(this,q)).mediaConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>o(c)),this.detail=async(t,e,r={})=>(await a(this,q)).mediaConnectorDetail(t,e,JSON.stringify(r)).then(c=>o(c)),this.download=async(t,e,r,n={})=>{const c=this.parseDeprecatedMediaDownloadType(r);return(await a(this,$t)).mediaConnectorDownload(t,e,c,ue.web,JSON.stringify(n)).then(l=>l??l)},this.getConfigurationOptions=async t=>(await a(this,q)).mediaConnectorGetConfigurationOptions(t).then(r=>o(r)),this.getCapabilities=async t=>(await a(this,q)).mediaConnectorGetCapabilities(t).then(r=>o(r)),this.parseDeprecatedMediaType=t=>{if(t===bt.file)return It.file;if(t===bt.collection)return It.collection},this.upload=async(t,e,r={})=>(await a(this,q)).mediaConnectorUpload(t,JSON.stringify(e),JSON.stringify(r)).then(c=>o(c)),y(this,q,i),y(this,$t,i)}parseDeprecatedMediaDownloadType(i){switch(i){case Yt.HighResolutionWeb:return Qt.highres;case Yt.LowResolutionWeb:return Qt.thumbnail;default:return i}}}q=new WeakMap,$t=new WeakMap;let bs=(cr=class{constructor(i){g(this,E);g(this,Kt);this.add=async()=>(await a(this,E)).addPage().then(e=>o(e)),this.remove=async t=>(await a(this,E)).removePage(t).then(r=>o(r)),this.select=async t=>(await a(this,E)).selectPage(t).then(r=>o(r)),this.setVisibility=async(t,e)=>(await a(this,E)).setPageIsVisible(t,e).then(n=>o(n)),this.duplicate=async t=>(await a(this,E)).duplicatePage(t).then(r=>o(r)),this.getAll=async()=>(await a(this,E)).getPages().then(e=>o(e)),this.getById=async t=>(await a(this,E)).getPageById(t).then(r=>o(r)),this.getSnapshot=async(t,e)=>(await a(this,Kt)).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,E)).setPageWidth(e).then(n=>o(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,E)).setPageHeight(e).then(n=>o(n))),this.setSize=async(t,e)=>(await a(this,E)).setPageSize(t,e).then(n=>o(n)),this.move=async(t,e)=>(await a(this,E)).reorderPages(t,e).then(n=>o(n)),y(this,E,i),y(this,Kt,i)}},E=new WeakMap,Kt=new WeakMap,cr);class Is{constructor(i){g(this,U);this.getAll=async()=>(await a(this,U)).getParagraphStyles().then(e=>o(e)),this.getById=async t=>(await a(this,U)).getParagraphStyleById(t).then(r=>o(r)),this.create=async()=>(await a(this,U)).createParagraphStyle().then(e=>o(e)),this.duplicate=async t=>(await a(this,U)).duplicateParagraphStyle(t).then(r=>o(r)),this.update=async(t,e)=>(await a(this,U)).updateParagraphStyle(t,JSON.stringify(e)).then(n=>o(n)),this.rename=async(t,e)=>(await a(this,U)).renameParagraphStyle(t,e).then(n=>o(n)),this.remove=async t=>(await a(this,U)).removeParagraphStyle(t).then(r=>o(r)),this.move=async(t,e)=>(await a(this,U)).moveParagraphStyles(t,e).then(n=>o(n)),y(this,U,i)}}U=new WeakMap;var R=(s=>(s.info="info",s.warn="warn",s.error="error",s))(R||{}),As=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s))(As||{}),kt=(s=>(s.throw="throw",s.log="log",s))(kt||{});class vs{constructor(i,t,e,r){this.type="action",this.message=i,this.id=t,this.event=e,this.eventChain=r}}class Ps{constructor(i,t,e){this.type="dataRow",this.count=i,this.message=t,this.exceptions=e}}var Xt=(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))(Xt||{}),Fs=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))(Fs||{}),Es=(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))(Es||{}),vt=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(vt||{}),Ds=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))(Ds||{}),Ls=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(Ls||{});let gn=class{constructor(i,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 d;return c.type===Xt.list?{...c,items:c.items.map(l=>l.value),selected:(d=c.selected)==null?void 0:d.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 he().makeMultipleConnectorsBackwardsCompatible(JSON.parse(e),this.localConfig.get(K.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(JSON.parse(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 Ps(r.count,r.message,r.exceptions);this.config.events.onAsyncError.trigger(n)}else if((r==null?void 0:r.type)==="action"){const n=new vs(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.config=i,this.localConfig=t}};class Os{constructor(i){g(this,Ct);this.set=async t=>(await a(this,Ct)).selectedTextStyleDeltaUpdate(JSON.stringify(t)).then(r=>o(r)),this.removeSelected=async()=>(await a(this,Ct)).selectedTextStyleClean().then(e=>o(e)),this.getSelected=async()=>(await a(this,Ct)).getSelectedTextStyle().then(e=>o(e)),y(this,Ct,i)}}Ct=new WeakMap;var Ns=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Ns||{}),Rs=(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))(Rs||{}),x=(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))(x||{}),Ms=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s))(Ms||{}),te=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(te||{});class Ts{constructor(i){g(this,Dt);this.setTool=async t=>(await a(this,Dt)).setTool(t).then(r=>o(r)),this.getSelected=async()=>(await a(this,Dt)).getSelectedTool().then(e=>o(e)),this.setPointer=async()=>this.setTool(x.SELECT),this.setSelect=async()=>this.setTool(x.SELECT),this.setHand=async()=>this.setTool(x.HAND),this.setZoom=async()=>this.setTool(x.ZOOM),this.setTextFrame=async()=>this.setTool(x.TEXT_FRAME),this.setImageFrame=async()=>this.setTool(x.IMAGE_FRAME),this.setShapeRect=async()=>this.setTool(x.SHAPE_RECT),this.setShapeEllipse=async()=>this.setTool(x.SHAPE_ELLIPSE),this.setShapePolygon=async()=>this.setTool(x.SHAPE_POLYGON),y(this,Dt,i)}}Dt=new WeakMap;class Vs{constructor(i,t){g(this,Y);g(this,Lt);g(this,zt);this.undo=async()=>(await a(this,Y)).undo().then(r=>o(r)),this.redo=async()=>(await a(this,Y)).redo().then(r=>o(r)),this.addCustomData=async(e,r)=>(await a(this,Y)).setCustomUndoData(e,r,!1).then(c=>o(c)),this.record=async(e,r)=>{try{await a(this,Lt).beginIfNoneActive(e),await r(a(this,zt))}catch(n){throw n}finally{await a(this,Lt).end()}},this.pause=async()=>(await a(this,Y)).pause().then(r=>o(r)),this.resume=async()=>(await a(this,Y)).resume().then(r=>o(r)),y(this,Y,i),y(this,zt,t),y(this,Lt,new yn(i))}}Y=new WeakMap,Lt=new WeakMap,zt=new WeakMap;class yn{constructor(i){g(this,mt);this.begin=async t=>(await a(this,mt)).begin(t).then(r=>o(r)),this.beginIfNoneActive=async t=>(await a(this,mt)).beginIfNoneActive(t).then(r=>o(r)),this.end=async()=>(await a(this,mt)).end().then(e=>o(e)),y(this,mt,i)}}mt=new WeakMap;const pn=(s,i=2)=>{const t=Math.pow(10,i);return Math.round(s*t)/t};class Bs{constructor(i){g(this,Ot);this.round=(t,e)=>o({data:String(pn(t,e)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=t=>{const{type:e=te.SANDBOX,environment:r="ft-nostress",version:n="1"}=t,c=e==te.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${r}.${c}.online/grafx/api/v${n}/environment/${r}`},this.stageFiles=async(t,e,r)=>{const n=a(this,Ot).get(K.GraFxStudioEnvironmentApiUrl);if(!n)throw new Error("GraFx Studio Environment API URL is not set");const c=`${n}connectors/${e}/stage`,d=a(this,Ot).get(K.GraFxStudioAuthToken);if(!d)throw new Error("GraFx Studio Auth Token is not set");const l=new FormData;t.forEach((w,b)=>{const I=w instanceof File?w.name:`blob-${b}`;l.append("files",w,I)}),r&&l.append("validationJson",JSON.stringify({allowedMimeTypes:r.mimeTypes,minDimensions:{width:r.minWidthPixels,height:r.minHeightPixels}}));const p=await fetch(c,{method:"POST",body:l,headers:{Authorization:`Bearer ${d}`}});if(p.status===422){const w=await p.json();throw new qe(w.message,ce.minDimension)}if(!p.ok)throw new Error("Failed to stage files");return await p.json()},y(this,Ot,i)}}Ot=new WeakMap;class Cn{constructor(i){g(this,Wt);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,Wt,i)}async applyPropertiesUpdate(i,t){const r=await(await a(this,Wt)).updateNumberVariableProperties(i,JSON.stringify(t));return o(r)}}Wt=new WeakMap;class mn{constructor(i){g(this,jt);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,jt,i)}async applyPropertiesUpdate(i,t){const r=await(await a(this,jt)).updateDateVariableProperties(i,JSON.stringify(t));return o(r)}}jt=new WeakMap;let Us=(hr=class{constructor(i){g(this,S);g(this,Nt);g(this,Rt);this.getAll=async()=>(await a(this,S)).getVariables().then(e=>o(e)).then(e=>{const r=e;return r.parsedData&&(r.parsedData=this.makeVariablesBackwardsCompatible(r.parsedData)),r}),this.getById=async t=>(await a(this,S)).getVariableById(t).then(r=>o(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.getByName=async t=>(await a(this,S)).getVariableByName(t).then(r=>o(r)).then(r=>{const n=r;return n.parsedData&&(n.parsedData=this.makeVariableBackwardsCompatible(n.parsedData)),n}),this.create=async(t,e)=>(await a(this,S)).addVariable(t,e).then(n=>o(n)),this.remove=async t=>(await a(this,S)).removeVariables(t).then(r=>o(r)),this.rename=async(t,e)=>(await a(this,S)).setVariableName(t,e).then(n=>o(n)),this.setLabel=async(t,e)=>(await a(this,S)).setVariableLabel(t,e).then(n=>o(n)),y(this,Nt,async(t,e)=>(await a(this,S)).setVariablePlaceholder(t,e).then(n=>o(n))),this.setPlaceholder=async(t,e)=>a(this,Nt).call(this,t,e),this.resetPlaceholder=async t=>a(this,Nt).call(this,t,null),y(this,Rt,async(t,e)=>(await a(this,S)).setVariableHelpText(t,e).then(n=>o(n))),this.setHelpText=async(t,e)=>a(this,Rt).call(this,t,e),this.resetHelpText=async t=>a(this,Rt).call(this,t,null),this.setType=async(t,e)=>(await a(this,S)).setVariableType(t,e).then(n=>o(n)),this.setListVariable=async(t,e)=>(await a(this,S)).setListVariableItems(t,e.map(n=>JSON.stringify({value:n}))).then(n=>o(n)),this.setValue=async(t,e)=>(await a(this,S)).setVariableValue(t,e).then(n=>o(n)),this.duplicate=async t=>(await a(this,S)).duplicateVariable(t).then(r=>o(r)),this.groupVariables=async(t,e)=>(await a(this,S)).groupVariables(t,e).then(n=>o(n)),this.ungroupVariables=async t=>(await a(this,S)).ungroupVariable(t).then(r=>o(r)),this.move=async(t,e,r)=>(await a(this,S)).moveVariable(e,r,t).then(c=>o(c)),this.moveVariables=async(t,e,r)=>(await a(this,S)).moveVariables(e,r,t).then(c=>o(c)),this.setIsVisible=async(t,e)=>{const r=e?{type:vt.visible}:{type:vt.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,e)=>{const r=e?{type:vt.invisible}:{type:vt.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,e)=>(await a(this,S)).setVariableVisibility(t,JSON.stringify(e)).then(n=>o(n)),this.setLayoutsForVariableVisibility=async t=>(await a(this,S)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>o(r)),this.setIsRequired=async(t,e)=>(await a(this,S)).setVariableIsRequired(t,e).then(n=>o(n)),this.setIsReadonly=async(t,e)=>(await a(this,S)).setVariableIsReadonly(t,e).then(n=>o(n)),this.getImageVariableConnectorId=async t=>(await a(this,S)).getImageVariableConnectorId(t).then(r=>o(r)),this.setImageVariableConnector=async(t,e)=>{const r=await a(this,S),c=new he().makeConnectorSourceForwardsCompatible(e);return r.setImageVariableConnector(t,JSON.stringify(c)).then(d=>o(d))},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,S)).setVariablePrivateData(t,JSON.stringify(e)).then(n=>o(n)),this.getPrivateData=async t=>(await a(this,S)).getVariablePrivateData(t).then(r=>o(r)),this.setAllowImageQuery=async(t,e)=>(await a(this,S)).setImageVariableAllowQuery(t,e).then(n=>o(n)),this.setAllowImageUpload=async(t,e)=>(await a(this,S)).setImageVariableAllowUpload(t,e).then(n=>o(n)),this.setMinImageUploadSize=async(t,e,r)=>(await a(this,S)).setImageVariableUploadMinSize(t,e,r).then(c=>o(c)),y(this,S,i),this.number=new Cn(a(this,S)),this.date=new mn(a(this,S))}makeVariablesBackwardsCompatible(i){return i.map(t=>this.makeVariableBackwardsCompatible(t))}makeVariableBackwardsCompatible(i){return i.type!==Xt.list?i:this.makeListVariableBackwardsCompatible(i)}makeListVariableBackwardsCompatible(i){const t=i,e=i.items,r=i.selected,n=e.map(c=>c.value);return t.items=n,t.selected=r==null?void 0:r.value,t}async applyPrefixSuffixDeltaUpdate(i,t){const r=await(await a(this,S)).updateVariablePrefixSuffixProperties(i,JSON.stringify(t));return o(r)}},S=new WeakMap,Nt=new WeakMap,Rt=new WeakMap,hr);class wn{constructor(i){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.config=i}}class fn{constructor(i){g(this,Z);this.getAll=async()=>(await a(this,Z)).getVariables().then(e=>o(e)),this.getById=async t=>(await a(this,Z)).getVariableById(t).then(r=>o(r)),this.getByName=async t=>(await a(this,Z)).getVariableByName(t).then(r=>o(r)),this.setListVariable=async(t,e)=>(await a(this,Z)).setListVariableItems(t,e.map(n=>JSON.stringify(n))).then(n=>o(n)),this.setImageVariableConnector=async(t,e)=>(await a(this,Z)).setImageVariableConnector(t,JSON.stringify(e)).then(n=>o(n)),y(this,Z,i),this.image=new Sn(i)}}Z=new WeakMap;class Sn{constructor(i){g(this,wt);this.setAllowQuery=async(t,e)=>(await a(this,wt)).setImageVariableAllowQuery(t,e).then(n=>o(n)),this.setAllowUpload=async(t,e)=>(await a(this,wt)).setImageVariableAllowUpload(t,e).then(n=>o(n)),this.setMinUploadSize=async(t,e,r)=>(await a(this,wt)).setImageVariableUploadMinSize(t,e,r).then(c=>o(c)),y(this,wt,i)}}wt=new WeakMap;class bn{constructor(i){g(this,ft);this.register=async t=>(await a(this,ft)).registerConnector(JSON.stringify(t)).then(r=>o(r)),this.getById=async t=>(await a(this,ft)).getConnectorById(t).then(r=>o(r)),this.getAllByType=async t=>(await a(this,ft)).getConnectors(t).then(r=>o(r)),y(this,ft,i)}}ft=new WeakMap;class In{constructor(i){g(this,Mt);g(this,ee);this.setWidth=async t=>(await a(this,Mt)).setPageWidth(t).then(r=>o(r)),this.setHeight=async t=>(await a(this,Mt)).setPageHeight(t).then(r=>o(r)),y(this,Mt,i),y(this,ee,i)}}Mt=new WeakMap,ee=new WeakMap;class Js{constructor(i,t,e){this.config=i,this.connection=t,this.editorAPI=e,this.subscriber=new wn(i),this.variable=new fn(this.editorAPI),this.connector=new bn(this.editorAPI),this.page=new In(this.editorAPI),this.canvas=new oe(this.editorAPI)}}class ks{constructor(i){this.logger=i}createEventHandlerFn(i,t){return(...r)=>{try{const n=i(...r);return n instanceof Promise?n.catch(c=>this.handleError(c,t,i.name)):n}catch(n){this.handleError(n,t,i.name)}}}handleError(i,t,e){var r;if(t===kt.log)(r=this.logger)==null||r.call(this,R.error,As.event,`Error in callback ${e}: ${i}`);else throw i}}class Gs extends ks{constructor(i,t){super(t),this.handler=i}trigger(...i){const t=this.handler();if(t)return this.createEventHandlerFn(t,kt.throw)(...i)}}class m extends ks{constructor(i,t){super(t),this.legacyHandler=i,this.subscriptions=new Set}trigger(...i){const t=this.legacyHandler();t&&this.createEventHandlerFn(t,kt.log)(...i);for(const e of this.subscriptions)e(...i)}registerCallback(i,t=kt.log){const e=this.createEventHandlerFn(i,t);return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}}class ge{static createRuntimeConfig(i){var e,r,n,c,d,l,p,C,w,b,I,F,H,D,j,J,A,Q,X,Vt,Bt,lr,dr,ur,gr,yr,pr,Cr,mr,wr,fr,Sr,br,Ir,Ar;const t={...i};return t.logging={logLevel:((e=i.logging)==null?void 0:e.logLevel)||R.error,logger:((r=i.logging)==null?void 0:r.logger)||((qt,ye,pe)=>{var vr;if(ge.isLoggingEnabled(qt,((vr=t.logging)==null?void 0:vr.logLevel)??R.error))switch(qt){case R.error:console.error(`[${ye}] [${qt}] ${pe}`);break;case R.warn:console.warn(`[${ye}] [${qt}] ${pe}`);break;default:console.log(`[${ye}] [${qt}] ${pe}`)}})},t.handlers={onAuthExpired:new Gs(()=>t.onAuthExpired,(n=t.logging)==null?void 0:n.logger),onViewportRequested:new Gs(()=>t.onViewportRequested,(c=t.logging)==null?void 0:c.logger)},t.events={onActionsChanged:new m(()=>t.onActionsChanged,(d=t.logging)==null?void 0:d.logger),onStateChanged:new m(()=>t.onStateChanged,(l=t.logging)==null?void 0:l.logger),onDocumentLoaded:new m(()=>t.onDocumentLoaded,(p=t.logging)==null?void 0:p.logger),onSelectedFramesLayoutChanged:new m(()=>t.onSelectedFramesLayoutChanged,(C=t.logging)==null?void 0:C.logger),onFramesLayoutChanged:new m(()=>t.onFramesLayoutChanged,(w=t.logging)==null?void 0:w.logger),onSelectedFramesContentChanged:new m(()=>t.onSelectedFramesContentChanged,(b=t.logging)==null?void 0:b.logger),onPageSelectionChanged:new m(()=>t.onPageSelectionChanged,(I=t.logging)==null?void 0:I.logger),onSelectedLayoutPropertiesChanged:new m(()=>t.onSelectedLayoutPropertiesChanged,(F=t.logging)==null?void 0:F.logger),onSelectedLayoutUnitChanged:new m(()=>t.onSelectedLayoutUnitChanged,(H=t.logging)==null?void 0:H.logger),onScrubberPositionChanged:new m(()=>t.onScrubberPositionChanged,(D=t.logging)==null?void 0:D.logger),onFrameAnimationsChanged:new m(()=>t.onFrameAnimationsChanged,(j=t.logging)==null?void 0:j.logger),onVariableListChanged:new m(()=>t.onVariableListChanged,(J=t.logging)==null?void 0:J.logger),onSelectedToolChanged:new m(()=>t.onSelectedToolChanged,(A=t.logging)==null?void 0:A.logger),onUndoStackStateChanged:new m(()=>t.onUndoStackStateChanged,(Q=t.logging)==null?void 0:Q.logger),onSelectedLayoutFramesChanged:new m(()=>t.onSelectedLayoutFramesChanged,(X=t.logging)==null?void 0:X.logger),onSelectedTextStyleChanged:new m(()=>t.onSelectedTextStyleChanged,(Vt=t.logging)==null?void 0:Vt.logger),onColorsChanged:new m(()=>t.onColorsChanged,(Bt=t.logging)==null?void 0:Bt.logger),onParagraphStylesChanged:new m(()=>t.onParagraphStylesChanged,(lr=t.logging)==null?void 0:lr.logger),onCharacterStylesChanged:new m(()=>t.onCharacterStylesChanged,(dr=t.logging)==null?void 0:dr.logger),onFontFamiliesChanged:new m(()=>t.onFontFamiliesChanged,(ur=t.logging)==null?void 0:ur.logger),onSelectedLayoutIdChanged:new m(()=>t.onSelectedLayoutIdChanged,(gr=t.logging)==null?void 0:gr.logger),onLayoutsChanged:new m(()=>t.onLayoutsChanged,(yr=t.logging)==null?void 0:yr.logger),onConnectorEvent:new m(()=>t.onConnectorEvent,(pr=t.logging)==null?void 0:pr.logger),onConnectorsChanged:new m(()=>t.onConnectorsChanged,(Cr=t.logging)==null?void 0:Cr.logger),onZoomChanged:new m(()=>t.onZoomChanged,(mr=t.logging)==null?void 0:mr.logger),onSelectedPageIdChanged:new m(()=>t.onSelectedPageIdChanged,t.logging.logger),onPagesChanged:new m(()=>t.onPagesChanged,t.logging.logger),onPageSnapshotInvalidated:new m(()=>t.onPageSnapshotInvalidated,t.logging.logger),onPageSizeChanged:new m(()=>t.onPageSizeChanged,(wr=t.logging)==null?void 0:wr.logger),onShapeCornerRadiusChanged:new m(()=>t.onShapeCornerRadiusChanged,(fr=t.logging)==null?void 0:fr.logger),onCropActiveFrameIdChanged:new m(()=>t.onCropActiveFrameIdChanged,(Sr=t.logging)==null?void 0:Sr.logger),onAsyncError:new m(()=>t.onAsyncError,(br=t.logging)==null?void 0:br.logger),onViewModeChanged:new m(()=>t.onViewModeChanged,(Ir=t.logging)==null?void 0:Ir.logger),onBarcodeValidationChanged:new m(()=>t.onBarcodeValidationChanged,(Ar=t.logging)==null?void 0:Ar.logger),onDataSourceIdChanged:new m(()=>t.onDataSourceIdChanged,t.logging.logger),onDocumentIssueListChanged:new m(()=>t.onDocumentIssueListChanged,t.logging.logger),onCustomUndoDataChanged:new m(()=>t.onCustomUndoDataChanged,t.logging.logger),onEngineEditModeChanged:new m(()=>t.onEngineEditModeChanged,t.logging.logger)},t}static isLoggingEnabled(i,t){return t==R.info||t==R.warn&&(i==R.warn||i==R.error)?!0:t==R.error&&i==R.error}}class An{isDatePropertyWrapper(i){return typeof i=="object"&&(i==null?void 0:i.type)==="date"}isDateObject(i){return i instanceof Date}mapEngineToDataItem(i){const t={};return Object.entries(i).forEach(([e,r])=>{t[e]=this.isDatePropertyWrapper(r)?new Date(r.value):r}),t}mapDataItemToEngine(i){const t={};return Object.entries(i).forEach(([e,r])=>{t[e]=this.isDateObject(r)?{value:r.getTime(),type:"date"}:r}),t}}class vn{constructor(i){g(this,ct);y(this,ct,i)}async getValue(i){return(await a(this,ct)).getConfigValue(i).then(e=>o(e))}async setValue(i,t){return(await a(this,ct)).setConfigValue(i,t).then(r=>o(r))}async updateStudioOptions(i){return(await a(this,ct)).updateStudioOptions(JSON.stringify(i)).then(e=>o(e))}async getEngineSessionId(){return(await a(this,ct)).getEngineSessionId().then(t=>o(t))}}ct=new WeakMap;class xs extends vn{constructor(t,e){super(t);g(this,Tt);y(this,Tt,e)}async getValue(t){const e=a(this,Tt).get(t);return e!=null?o({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,Tt).set(t,e),r}}Tt=new WeakMap;const Pn=`https://studio-cdn.chiligrafx.com/editor/${O.current}/web`;let et;class Fn{constructor(i){this.localConfig=new Map,this.dataItemMappingTools=new An,this.loadEditor=()=>{var t;Zr(this.config.editorLink||Pn,{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},this.setConnection,this.config.editorId,this.config.studioStyling),this.editorAPI=et==null?void 0:et.promise.then(e=>e),this.action=new Ae(this.editorAPI),this.layout=new fs(this.editorAPI),this.frame=new ms(this.editorAPI),this.barcode=new Le(this.editorAPI),this.animation=new ve(this.editorAPI),this.document=new ts(this.editorAPI),this.configuration=new xs(this.editorAPI,this.localConfig),this.utils=new Bs(this.localConfig),this.tool=new Ts(this.editorAPI),this.page=new bs(this.editorAPI),this.debug=new Xe(this.editorAPI),this.undoManager=new Vs(this.editorAPI,this),this.textSelection=new Os(this.editorAPI),this.colorStyle=new Je(this.editorAPI),this.paragraphStyle=new Is(this.editorAPI),this.characterStyle=new Ve(this.editorAPI),this.mediaConnector=new Ss(this.editorAPI),this.fontConnector=new ps(this.editorAPI),this.dataConnector=new Ze(this.editorAPI,this.dataItemMappingTools),this.dataSource=new Qe(this.editorAPI,this.dataItemMappingTools),this.connector=new Ye(this.editorAPI,this.localConfig),this.variable=new Us(this.editorAPI),this.font=new Cs(this.editorAPI),this.experiment=new ys(this.editorAPI),this.canvas=new oe(this.editorAPI),this.shape=new de(this.editorAPI),this.colorConversion=new Ue(this.editorAPI),this.info=new ws,this.clipboard=new Be(this.editorAPI),this.brandKit=new Te(this.editorAPI,this),this.next=new Js(this.config,this.connection,this.editorAPI),this.configuration.setValue(K.GraFxStudioSdkVersion,Ce.version),this.configuration.setValue(K.GraFxStudioDocumentType,this.config.documentType||ne.template),this.configuration.updateStudioOptions(this.config.studioOptions||Qr),this.configuration.setValue(K.QueryCallCacheEnabled,((t=this.config.enableQueryCallCache)==null?void 0:t.toString())||"false")},this.setConnection=t=>{et=t},this.config=ge.createRuntimeConfig(i),this.connection=et,this.editorAPI=et==null?void 0:et.promise.then(t=>t),this.action=new Ae(this.editorAPI),this.layout=new fs(this.editorAPI),this.frame=new ms(this.editorAPI),this.shape=new de(this.editorAPI),this.barcode=new Le(this.editorAPI),this.undoManager=new Vs(this.editorAPI,this),this.connector=new Ye(this.editorAPI,this.localConfig),this.mediaConnector=new Ss(this.editorAPI),this.fontConnector=new ps(this.editorAPI),this.dataConnector=new Ze(this.editorAPI,this.dataItemMappingTools),this.dataSource=new Qe(this.editorAPI,this.dataItemMappingTools),this.animation=new ve(this.editorAPI),this.document=new ts(this.editorAPI),this.configuration=new xs(this.editorAPI,this.localConfig),this.variable=new Us(this.editorAPI),this.utils=new Bs(this.localConfig),this.subscriber=new gn(this.config,this.localConfig),this.tool=new Ts(this.editorAPI),this.page=new bs(this.editorAPI),this.debug=new Xe(this.editorAPI),this.textSelection=new Os(this.editorAPI),this.colorStyle=new Je(this.editorAPI),this.paragraphStyle=new Is(this.editorAPI),this.characterStyle=new Ve(this.editorAPI),this.font=new Cs(this.editorAPI),this.experiment=new ys(this.editorAPI),this.canvas=new oe(this.editorAPI),this.colorConversion=new Ue(this.editorAPI),this.info=new ws,this.clipboard=new Be(this.editorAPI),this.next=new Js(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=new Te(this.editorAPI,this)}}var _s=(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))(_s||{}),Hs=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(Hs||{}),$s=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))($s||{}),Ks=(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))(Ks||{}),zs=(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))(zs||{}),Ws=(s=>(s.preview="preview",s.normal="normal",s))(Ws||{}),js=(s=>(s.Square="square",s.Line="line",s))(js||{}),qs=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(qs||{}),Ys=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(Ys||{}),Zs=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(Zs||{}),Qs=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(Qs||{}),Xs=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(Xs||{}),tr=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(tr||{}),er=(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))(er||{}),sr=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(sr||{}),rr=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s))(rr||{}),nr=(s=>(s.all="all",s.only="only",s.none="none",s))(nr||{}),ar=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s))(ar||{}),ir=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(ir||{});const En=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:ir},Symbol.toStringTag,{value:"Module"}));h.ActionAsyncError=vs,h.ActionEditorEvent=sr,h.Alignment=Ys,h.AnchorTargetEdgeType=gs,h.AnchorTargetType=us,h.AuthCredentialsTypeEnum=We,h.AuthRefreshTypeEnum=je,h.AutoGrowDirection=es,h.BarcodeCharacterSet=lt,h.BarcodeErrorCorrectionLevel=St,h.BarcodeSourceTypeEnum=rs,h.BarcodeType=k,h.BarcodeValidationResult=Pe,h.BasicAnimationsEmphasisStyles=zs,h.BlendMode=os,h.Case=Qs,h.ColorType=W,h.ColorUsageType=ae,h.ConnectorConfigContextType=He,h.ConnectorConfigValueType=_e,h.ConnectorEventType=ze,h.ConnectorHttpError=Ie,h.ConnectorMapping=an,h.ConnectorMappingDirection=Ke,h.ConnectorMappingSource=$e,h.ConnectorRegistrationSource=At,h.ConnectorStateType=Zt,h.ConnectorType=ke,h.CornerRadiusType=nr,h.CropType=le,h.DataRowAsyncError=Ps,h.Day=Fs,h.DeprecatedMediaConnectorDownloadType=Yt,h.DeprecatedMediaType=bt,h.DocumentIssueTypeEnum=be,h.DocumentType=ne,h.DownloadFormats=Ms,h.EaseTypes=$s,h.EngineEditModeType=ar,h.EnvironmentType=te,h.FitMode=cs,h.FitModePosition=hs,h.FlowDirection=as,h.FontPreviewFormat=js,h.FontWeights=qs,h.FrameAnchorTarget=un,h.FrameAnchorType=ds,h.FramePropertyNames=Ns,h.FrameTypeEnum=ss,h.GrafxTokenAuthCredentials=cn,h.ImageSourceTypeEnum=Jt,h.LayoutIntent=De,h.LayoutPropertyNames=Rs,h.LayoutType=Fe,h.Locale=Es,h.MeasurementUnit=Ee,h.MediaDownloadIntent=ue,h.MediaDownloadType=Qt,h.MediaType=It,h.Next=En,h.PageAnchorTarget=dn,h.PositionEnum=z,h.RefreshedAuthCredendentials=hn,h.Scripting=Xs,h.SelectedTextStyleSections=tr,h.SelectedTextStyles=er,h.ShakeDirections=Hs,h.ShapeType=rr,h.SlideDirections=_s,h.SortBy=Ge,h.SortOrder=xe,h.TextDirection=ns,h.TextPosition=Zs,h.ToolType=x,h.TweenTypes=Ks,h.UpdateZIndexMethod=ls,h.UploadAssetValidationError=qe,h.UploadAssetValidationErrorType=ce,h.VariableType=Xt,h.VariableVisibilityOperator=Ls,h.VariableVisibilityTargetType=Ds,h.VariableVisibilityType=vt,h.VerticalAlign=is,h.ViewMode=Ws,h.WellKnownConfigurationKeys=K,h.default=Fn,h.grafxMediaConnectorRegistration=on,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
20
+ `;s.srcdoc=n},Zr=(s,o,t,e="chili-editor",r)=>{const n=`#${e}`,c=document.createElement("iframe");c.setAttribute("srcdoc"," "),c.setAttribute("title","Chili-Editor"),c.setAttribute("style","width: 100%; height: 100%;"),c.setAttribute("frameBorder","0"),c.setAttribute("referrerpolicy","origin");const l=()=>{const d=document.querySelector(n);d&&(d==null||d.appendChild(c),Yr(c,s,r))};document.readyState==="complete"||document.readyState==="interactive"?l():document.addEventListener("DOMContentLoaded",()=>{l()}),t(jr({iframe:c,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 W=(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))(W||{});const Qr={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}}};var be=(s=>(s.overflow="overflow",s.fontLoading="fontLoading",s.actionRegister="actionRegister",s.actionExecution="actionExecution",s.actionCircular="actionCircular",s))(be||{}),ne=(s=>(s.project="project",s.template="template",s))(ne||{});const Xr=404075;function i(s,o=!0){try{if(!s.success){const e=s.error??"Yikes, something went wrong",r={cause:{name:String(s.status),message:s.error??"Yikes, something went wrong"}};if(s.status===Xr){const c=JSON.parse(s.data).statusCode;throw new Ie(c,e,r)}else throw new Error(e,r)}const t=s.data&&o;return{...s,parsedData:t?JSON.parse(s.data):s.data}}catch(t){throw console.error(t),t}}class Ie extends Error{constructor(o,t,e){super(t,e),this.statusCode=o}}class Ae{constructor(o){g(this,N);this.getAll=async()=>(await a(this,N)).getActions().then(e=>i(e)),this.getById=async t=>(await a(this,N)).getActionById(t).then(r=>i(r)),this.create=async()=>(await a(this,N)).createAction().then(e=>i(e)),this.duplicate=async t=>(await a(this,N)).duplicateAction(t).then(r=>i(r)),this.remove=async t=>(await a(this,N)).removeAction(t).then(r=>i(r)),this.update=async(t,e)=>(await a(this,N)).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,N)).moveActions(t,e).then(n=>i(n)),this.setTypeError=async(t,e)=>this.update(t,{hasTypeError:e}),this.disable=async()=>(await a(this,N)).disableActions().then(e=>i(e)),this.enable=async()=>(await a(this,N)).enableActions().then(e=>i(e)),y(this,N,o)}}N=new WeakMap;class ve{constructor(o){g(this,L);this.getAllOnSelectedLayout=async()=>(await a(this,L)).getAnimationsOnSelectedLayout().then(e=>i(e)),this.getByFrameId=async(t,e)=>(await a(this,L)).getAnimationByFrameId(t,e).then(n=>i(n)),this.getByLayoutId=async t=>(await a(this,L)).getAnimationsByLayoutId(t).then(r=>i(r)),this.setFrameAnimation=async t=>(await a(this,L)).setFrameAnimation(JSON.stringify(t)).then(r=>i({...r,data:JSON.stringify(t)})),this.play=async()=>(await a(this,L)).playAnimation().then(e=>i(e)),this.pause=async()=>(await a(this,L)).pauseAnimation().then(e=>i(e)),this.setScrubberPosition=async t=>(await a(this,L)).setScrubberPosition(t).then(r=>i(r)),this.setDuration=async t=>(await a(this,L)).setAnimationDuration(t).then(r=>i(r)),this.resetFrameAnimation=async t=>(await a(this,L)).resetFrameAnimation(t).then(r=>i(r)),this.reset=async()=>(await a(this,L)).resetAnimation().then(e=>i(e)),y(this,L,o)}}L=new WeakMap;var _=(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))(_||{}),bt=(s=>(s.low="low",s.medium="medium",s.quartile="quartile",s.high="high",s))(bt||{}),ut=(s=>(s.utf8="utf8",s.iso8859_1="iso8859_1",s.code128a="code128a",s.code128b="code128b",s.code128c="code128c",s))(ut||{}),Pe=(s=>(s.success="success",s.empty="empty",s.invalidLength="invalidLength",s.invalidCharacters="invalidCharacters",s.invalidChecksum="invalidChecksum",s.invalidUPCE="invalidUPCE",s.otherError="otherError",s))(Pe||{}),j=(s=>(s.top="top",s.right="right",s.bottom="bottom",s.left="left",s))(j||{}),Fe=(s=>(s.top="top",s.child="child",s))(Fe||{}),Ee=(s=>(s.px="px",s.mm="mm",s.cm="cm",s.inch="inch",s.pt="pt",s))(Ee||{}),De=(s=>(s.print="print",s.digitalStatic="digitalStatic",s.digitalAnimated="digitalAnimated",s))(De||{});class Le{constructor(o){g(this,K);this.setBarcodeProperties=async(t,e)=>(await a(this,K)).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,K)).setBarcodeSource(t,JSON.stringify(e)).then(n=>i(n)),this.removeBarcodeSource=async t=>(await a(this,K)).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===j.left?e:void 0,top:r===j.top?e:void 0,right:r===j.right?e:void 0,bottom:r===j.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,K)).setBarcodeProperties(t,JSON.stringify({quietZone:n})).then(l=>i(l))},this.setAreQuietZoneValuesCombined=async(t,e)=>{const r={areQuietZoneValuesCombined:e};return(await a(this,K)).setBarcodeProperties(t,JSON.stringify({quietZone:r})).then(c=>i(c))},this.setErrorCorrectionLevel=async(t,e)=>(await a(this,K)).setBarcodeProperties(t,JSON.stringify({errorCorrectionLevel:e})).then(n=>i(n)),this.setCharacterSet=async(t,e)=>(await a(this,K)).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,d=!1,p=!1,C=!1;switch(t){case _.qr:c=[ut.iso8859_1,ut.utf8],l=[bt.low,bt.medium,bt.quartile,bt.high];case _.dataMatrix:e=!1,r=!1,n=!1,d=!0;break;case _.ean13:e=!1,p=!0;break;case _.ean8:p=!0;case _.upca:case _.upce:e=!1;break;case _.code128:case _.gs1128:c=[ut.code128a,ut.code128b,ut.code128c];break;case _.code39:C=!0;break}return{allowEnableMagnification:n,allowBarHeight:r,allowQuietZone:!0,allowedCharacterSets:c,allowedErrorCorrectionLevels:l,allowToggleText:e,quietZoneAlwaysCombined:d,allowToggleLightMarginIndicator:p,allowToggleDrawStartAndEndChar:C}},y(this,K,o)}}K=new WeakMap;var H=(s=>(s.rgb="rgb",s.hex="hex",s.cmyk="cmyk",s.spotCmyk="spotCmyk",s.spotRgb="spotRgb",s.spotHex="spotHex",s))(H||{}),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||{}),ae=(s=>(s.local="local",s.brandKit="brandKit",s.stylekit="brandKit",s))(ae||{});const Oe=s=>s.type===H.hex,ie=s=>s.type===H.spotHex,tn=s=>s.type===H.spotRgb,en=s=>s.type===H.spotCmyk,sn=s=>tn(s)||en(s)||ie(s),rn=s=>{const o=nn(s.type);return sn(s)?{...ie(s)&&{value:s.displayValue},...!ie(s)&&{...s.displayValue},spotName:s.value,type:o}:{...Oe(s)&&{value:s.value},...!Oe(s)&&{...s.value},type:o}},Me=(s,o,t)=>{const{brandKitColorGuid:e,brandKitFontFamilyGuid:r,fontStyleId:n,...c}=s;return{...Object.keys(c).reduce((d,p)=>({...d,[p]:{value:s[p]}}),{}),...o&&{color:{value:{id:o.id,color:o.color,type:ae.brandKit,isApplied:c.fillColorApplied}}},fontKey:{value:t??null}}},nn=s=>{switch(s){case H.rgb:return q.rgb;case H.cmyk:return q.cmyk;case H.hex:return q.hex;case H.spotRgb:return q.spotRGB;case H.spotCmyk:return q.spotCMYK;case H.spotHex:return q.spotHEX}},Ne=(s,o)=>{if(!(s===null||o===void 0))return(s||[]).find(t=>t.id===o)},Re=(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 Te{constructor(o,t){g(this,O);this.getId=async()=>(await a(this,O)).getBrandKitId().then(r=>i(r)),this.getVersion=async()=>(await a(this,O)).getBrandKitVersion().then(r=>i(r)),this.getName=async()=>(await a(this,O)).getBrandKitName().then(r=>i(r)),this.rename=async e=>(await a(this,O)).renameBrandKit(e).then(n=>i(n)),this.updateIdAndVersion=async(e,r)=>(await a(this,O)).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.fontController.getFontFamilies(),d=this.characterStyleController.getAll(),p=this.paragraphStyleController.getAll(),C=this.getAllMedia(),[S,A,b,I,R]=await Promise.all([c,l,p,d,C]),P={id:e.parsedData,brandKit:{id:e.parsedData,name:n.parsedData,lastModifiedDate:r.parsedData,colors:S.parsedData,fonts:A.parsedData,paragraphStyles:b.parsedData,characterStyles:I.parsedData,media:R.parsedData}},G={success:!0,data:JSON.stringify(P),parsedData:P,status:200};return i(G)},this.getAllMedia=async()=>(await a(this,O)).getAllBrandKitMedia().then(r=>i(r)),this.addMedia=async(e,r,n)=>(await a(this,O)).addBrandKitMedia(e,r,n).then(l=>i(l)),this.updateMedia=async(e,r,n)=>(await a(this,O)).updateBrandKitMedia(e,r,n).then(l=>i(l)),this.renameMedia=async(e,r)=>(await a(this,O)).renameBrandKitMedia(e,r).then(c=>i(c)),this.removeMedia=async e=>(await a(this,O)).removeBrandKitMedia(e).then(n=>i(n)),this.remove=async()=>{const r=(await this.colorStyleController.getAll()).parsedData||[],c=(await this.paragraphStyleController.getAll()).parsedData||[],d=(await this.characterStyleController.getAll()).parsedData||[],C=(await this.fontController.getFontFamilies()).parsedData||[],A=(await this.getAllMedia()).parsedData||[];await this.undoManagerController.record("brandKit.remove",async b=>{for(const I of r)await b.colorStyle.remove(I.id);for(const I of c)await b.paragraphStyle.remove(I.id);for(const I of d)await b.characterStyle.remove(I.id);for(const I of C)await b.font.removeFontFamily(I.id);for(const I of A)await this.removeMedia(I.name)})},this.set=async e=>{let r={success:!0,status:200,parsedData:{id:e.id,version:e.brandKit.lastModifiedDate,name:e.brandKit.name,colors:[],fonts:[],paragraphStyles:[],characterStyles:[],media:[]}};return await this.undoManagerController.record("brandKit.set",async n=>{const c=await this.setColors(e,n),l=await this.setFonts(e,n),{parsedData:d=[]}=await n.colorStyle.getAll(),{parsedData:p}=await n.font.getFontFamilies();await this.setParagraphStyles(e,n,{localColors:d,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setCharacterStyles(e,n,{localColors:d,localFonts:p,localColorGuidMap:c,localFontGuidMap:l}),await this.setMedia(e);const{parsedData:C}=await n.paragraphStyle.getAll(),{parsedData:S}=await n.characterStyle.getAll(),{parsedData:A}=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:d||[],fonts:p||[],paragraphStyles:C||[],characterStyles:S||[],media:A||[]}}}),r},y(this,O,o),this.colorStyleController=t.colorStyle,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=rn(r);await t.colorStyle.rename(n,r.name),await t.colorStyle.update(n,c)}return e}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 d of o.brandKit.paragraphStyles||[]){const p=c.get(d.brandKitColorGuid),C=l.get(d.brandKitFontFamilyGuid),S=Re(n,C,d.fontStyleId);if(!C||!S)throw new Error(`Paragraph style could not be created with an empty font family: ${d.name}`);const A=Ne(r,p);if(!A)throw new Error(`Paragraph style could not be created with an empty color: ${d.name}`);const{parsedData:b}=await t.paragraphStyle.create(),I=Me(d,A,`${S}`);await t.paragraphStyle.rename(b,d.name),await t.paragraphStyle.update(b,I)}}async setCharacterStyles(o,t,e){const{localColors:r,localFonts:n,localColorGuidMap:c,localFontGuidMap:l}=e;for(const d of o.brandKit.characterStyles||[]){const p=d.brandKitColorGuid?c.get(d.brandKitColorGuid):void 0,C=d.brandKitFontFamilyGuid?l.get(d.brandKitFontFamilyGuid):void 0,S=Ne(r,p),A=Re(n,C,d.fontStyleId),{parsedData:b}=await t.characterStyle.create(),I=Me(d,S,A);await t.characterStyle.rename(b,d.name),await t.characterStyle.update(b,I)}}async setMedia(o){for(const t of o.brandKit.media||[])await this.addMedia(t.name,t.mediaConnectorId,t.mediaId)}}O=new WeakMap;class oe{constructor(o){g(this,rt);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,rt)).zoomToPage(e,r,n,c).then(d=>i(d))),this.getZoomPercentage=async()=>(await a(this,rt)).getZoomPercentage().then(e=>i(e)),this.setZoomPercentage=async t=>(await a(this,rt)).setZoomPercentage(t).then(r=>i(r)),this.setViewMode=async t=>(await a(this,rt)).setViewMode(t).then(r=>i(r)),y(this,rt,o)}}rt=new WeakMap;class Ve{constructor(o){g(this,V);this.getAll=async()=>(await a(this,V)).getCharacterStyles().then(e=>i(e)),this.getById=async t=>(await a(this,V)).getCharacterStyleById(t).then(r=>i(r)),this.create=async()=>(await a(this,V)).createCharacterStyle().then(e=>i(e)),this.update=async(t,e)=>(await a(this,V)).updateCharacterStyle(t,JSON.stringify(e)).then(n=>i(n)),this.remove=async t=>(await a(this,V)).removeCharacterStyle(t).then(r=>i(r)),this.duplicate=async t=>(await a(this,V)).duplicateCharacterStyle(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,V)).renameCharacterStyle(t,e).then(n=>i(n)),this.move=async(t,e)=>(await a(this,V)).moveCharacterStyles(t,e).then(n=>i(n)),y(this,V,o)}}V=new WeakMap;class Be{constructor(o){g(this,nt);this.copyFrames=async t=>{const r=await(await a(this,nt)).copyFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.cutFrames=async t=>{const r=await(await a(this,nt)).cutFrames(t);return r.data&&await navigator.clipboard.writeText(r.data),i(r)},this.pasteFrames=async()=>{const t=await a(this,nt),e=await navigator.clipboard.readText(),r=await t.pasteFrames(e);return i(r)},this.getContentType=async()=>{const t=await a(this,nt),e=await navigator.clipboard.readText(),r=await t.getClipboardContentType(e);return i(r)},y(this,nt,o)}}nt=new WeakMap;class Je{constructor(o){g(this,Gt);this.convertToRgb=async t=>(await a(this,Gt)).colorToRgb(JSON.stringify(t)).then(r=>i(r)),y(this,Gt,o)}}Gt=new WeakMap;class Ue{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 It=(s=>(s[s.file=0]="file",s[s.collection=1]="collection",s))(It||{}),Yt=(s=>(s.LowResolutionWeb="lowresWeb",s.HighResolutionWeb="highresWeb",s))(Yt||{}),At=(s=>(s.file="file",s.collection="collection",s))(At||{}),ke=(s=>(s.media="media",s.fonts="fonts",s.data="data",s))(ke||{}),Ge=(s=>(s.name="name",s.path="relativePath",s.id="id",s))(Ge||{}),xe=(s=>(s.ascending="asc",s.descending="desc",s))(xe||{}),_e=(s=>(s.text="text",s.boolean="boolean",s))(_e||{}),He=(s=>(s.query="query",s.upload="upload",s))(He||{}),vt=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(vt||{});class an{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 $e=(s=>(s.variable="var",s.value="value",s))($e||{}),Ke=(s=>(s.engineToConnector="engineToConnector",s.connectorToEngine="connectorToEngine",s))(Ke||{}),Zt=(s=>(s.loading="loading",s.loaded="loaded",s.running="running",s.ready="ready",s.error="error",s))(Zt||{}),ze=(s=>(s.stateChanged="stateChanged",s.authChanged="authChanged",s.reloadRequired="reloadRequired",s.unloaded="unloaded",s))(ze||{});const on={url:"grafx-media.json",source:"local"};class cn{constructor(o){this.type="grafxToken",this.token=o}}class hn{constructor(){this.type="refreshed"}}var We=(s=>(s.grafxToken="grafxToken",s.refreshed="refreshed",s))(We||{}),je=(s=>(s.grafxToken="grafxToken",s.any="any",s))(je||{}),ce=(s=>(s.minDimension="minDimension",s))(ce||{});class qe extends Error{constructor(o,t){super(o),this.type=t}}class he{constructor(){this.makeConnectorSourceForwardsCompatible=o=>{if(o.source!=vt.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:vt.grafx}},this.makeMultipleConnectorsBackwardsCompatible=(o,t)=>o.map(e=>this.makeSingleConnectorBackwardsCompatible(e,t)),this.makeSingleConnectorBackwardsCompatible=(o,t)=>o.source.source!=vt.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:vt.grafx}},this.isSourceMigrated=o=>"id"in o}}let Ye=(or=class{constructor(o,t){g(this,J);g(this,Ft);g(this,gt);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,gt).makeSingleConnectorBackwardsCompatible(n.parsedData,a(this,Ft).get(W.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,gt).makeMultipleConnectorsBackwardsCompatible(n.parsedData,a(this,Ft).get(W.GraFxStudioEnvironmentApiUrl))),c}),this.register=async e=>{const r=await a(this,J),n=a(this,gt).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 d=await this.getState(e);if(d.success&&d.parsedData&&(d.parsedData.type===Zt.running||d.parsedData.type===Zt.ready))return i({data:null,success:!0,error:void 0,status:0,parsedData:void 0},!1);await new Promise(p=>setTimeout(p,c)),l++}}catch(d){return i({data:null,success:!1,error:`Error while getting connector state ${d}`,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(C=>!r.some(S=>S.name===C.name&&S.direction===C.direction)))??[],d=r.filter(C=>C.name!==""&&C.value!==""),p=[...l,...d];await n.setMappings(p)}),y(this,J,o),y(this,Ft,t),y(this,gt,new he)}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,Ft=new WeakMap,gt=new WeakMap,or);class ln{constructor(o,t){g(this,yt);g(this,pt);this.setOptions=async e=>a(this,pt).setConnectorOptions(a(this,yt),JSON.stringify(e)).then(r=>i(r)),this.setMappings=async e=>{const r=await a(this,pt).setConnectorMappings(a(this,yt),e.map(function(n){return JSON.stringify(n)}));return i(r)},this.setHttpHeader=async(e,r)=>a(this,pt).connectorAuthenticationSetHttpHeader(a(this,yt),e,r).then(n=>i(n)),y(this,yt,o),y(this,pt,t)}}yt=new WeakMap,pt=new WeakMap;class Ze{constructor(o,t){g(this,at);g(this,xt);this.getPage=async(e,r,n={})=>(await a(this,at)).dataConnectorGetPage(e,JSON.stringify(r),JSON.stringify(n)).then(l=>i(l)).then(l=>{const d={...l,parsedData:null};return l.parsedData&&(d.parsedData={data:l.parsedData.data.map(p=>a(this,xt).mapEngineToDataItem(p)),continuationToken:l.parsedData.continuationToken}),d}),this.getModel=async(e,r={})=>(await a(this,at)).dataConnectorGetModel(e,JSON.stringify(r)).then(c=>i(c)),this.getConfigurationOptions=async e=>(await a(this,at)).dataConnectorGetConfigurationOptions(e).then(n=>i(n)),this.getCapabilities=async e=>(await a(this,at)).dataConnectorGetCapabilities(e).then(n=>i(n)),y(this,at,o),y(this,xt,t)}}at=new WeakMap,xt=new WeakMap;class Qe{constructor(o,t){g(this,it);g(this,_t);this.setDataSource=async e=>(await a(this,it)).setDataSource(e).then(n=>i(n)),this.getDataSource=async()=>(await a(this,it)).getDataSource().then(r=>i(r)),this.removeDataSource=async()=>(await a(this,it)).removeDataSource().then(r=>i(r)),this.setDataRow=async e=>{const r=await a(this,it),n=a(this,_t).mapDataItemToEngine(e);return r.setDataRow(JSON.stringify(n)).then(c=>i(c))},y(this,it,o),y(this,_t,t)}}it=new WeakMap,_t=new WeakMap;class Xe{constructor(o){g(this,ot);this.getAllLogs=async()=>(await a(this,ot)).getLogs().then(e=>i(e)),this.toggleDebugPanel=async()=>(await a(this,ot)).toggleDebugPanel().then(e=>i(e)),this.enableDebug=async()=>(await a(this,ot)).enableDebug().then(e=>i(e)),this.disableDebug=async()=>(await a(this,ot)).disableDebug().then(e=>i(e)),y(this,ot,o)}}ot=new WeakMap;class ts{constructor(o){g(this,Ct);this.getCurrentState=async()=>(await a(this,Ct)).getCurrentDocumentState().then(e=>i(e)),this.load=async(t,e={keepConnectors:!1})=>{const r=await a(this,Ct),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,Ct),r=JSON.stringify(t);return e.createAndLoadDocument(r).then(n=>i(n))},y(this,Ct,o)}}Ct=new WeakMap;var es=(s=>(s.top="top",s.bottom="bottom",s.left="left",s.right="right",s))(es||{}),Ut=(s=>(s.url="url",s.variable="variable",s.connector="connector",s.brandKitMedia="brandKitMedia",s))(Ut||{}),ss=(s=>(s.text="text",s.image="image",s.shape="shape",s.barcode="barcode",s))(ss||{}),rs=(s=>(s.variable="variable",s.text="text",s))(rs||{}),ns=(s=>(s.leftToRight="leftToRight",s.rightToLeft="rightToLeft",s.weak="weak",s))(ns||{}),as=(s=>(s.horizontal="horizontal",s.vertical="vertical",s.onPath="onPath",s))(as||{}),is=(s=>(s.top="top",s.bottom="bottom",s.middle="middle",s.justify="justify",s))(is||{}),os=(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))(os||{}),cs=(s=>(s.fill="fill",s.fit="fit",s.smartCrop="smartCrop",s.manualCrop="manualCrop",s))(cs||{}),hs=(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))(hs||{}),ls=(s=>(s.bringToFront="bringToFront",s.sendToBack="sendToBack",s.bringForward="bringForward",s.sendBackward="sendBackward",s))(ls||{}),ds=(s=>(s.relative="relative",s.start="start",s.end="end",s.startAndEnd="startAndEnd",s.center="center",s))(ds||{}),us=(s=>(s.page="page",s.frame="frame",s))(us||{}),gs=(s=>(s.start="start",s.end="end",s.center="center",s))(gs||{});class dn{constructor(){this.type="page"}}class un{constructor(o,t){this.type="frame",this.frameId=o,this.edge=t}}var le=(s=>(s.frameCrop="frameCrop",s.assetCrop="assetCrop",s))(le||{});class ys{constructor(o){g(this,U);this.insertImageVariableToFrame=async(t,e)=>{const r=await a(this,U),n={id:e,type:Ut.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 ps{constructor(o){g(this,ct);g(this,Et);this.query=async(t,e,r={})=>(await a(this,ct)).fontConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,ct)).fontConnectorDetail(t,e,JSON.stringify(r)).then(c=>i(c)),this.download=async(t,e,r={})=>(await a(this,Et)).fontConnectorDownload(t,e,JSON.stringify(r)).then(c=>c??c),this.preview=async(t,e,r,n={})=>(await a(this,Et)).fontConnectorPreview(t,e,r,JSON.stringify(n)).then(l=>l??l),this.getConfigurationOptions=async t=>(await a(this,ct)).fontConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,ct)).fontConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedFontType=t=>{if(t===It.file)return At.file;if(t===It.collection)return At.collection},y(this,ct,o),y(this,Et,o)}}ct=new WeakMap,Et=new WeakMap;class Cs{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)),y(this,E,o)}}E=new WeakMap;class de{constructor(o){g(this,Dt);this.setShapeProperties=async(t,e)=>(await a(this,Dt)).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,Dt)).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,Dt,o)}}Dt=new WeakMap;class ms{constructor(o){g(this,u);this.getAll=async()=>(await a(this,u)).getFrames().then(e=>i(e)),this.getSelected=async()=>(await a(this,u)).getSelectedFrames().then(e=>i(e)),this.getAllByPageId=async t=>(await a(this,u)).getFramesByPageId(t).then(r=>i(r)),this.getByName=async t=>(await a(this,u)).getFrameByName(t).then(r=>i(r)),this.getById=async t=>(await a(this,u)).getFrameById(t).then(r=>i(r)),this.getPropertiesOnSelectedLayout=async()=>(await a(this,u)).getFramePropertiesOnSelectedLayout().then(e=>i(e)),this.getLayoutProperties=async(t,e)=>(await a(this,u)).getFramePropertiesByFrameId(t,e).then(n=>i(n)),this.getAllLayoutProperties=async t=>(await a(this,u)).getFramesProperties(t).then(r=>i(r)),this.resetTransformation=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetSize=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.select=async t=>(await a(this,u)).selectFrames([t]).then(r=>i(r)),this.selectMultiple=async t=>(await a(this,u)).selectFrames(t).then(r=>i(r)),this.deselectAll=async()=>(await a(this,u)).deselectFrames().then(e=>i(e)),this.reorderFrames=async(t,e)=>(await a(this,u)).reorderFrames(t,e).then(n=>i(n)),this.setZIndex=async(t,e)=>(await a(this,u)).setFrameZIndex(t,e).then(n=>i(n)),this.setHeight=async(t,e)=>(await a(this,u)).setFrameHeight(t,e).then(n=>i(n)),this.setRotation=async(t,e)=>(await a(this,u)).setFrameRotation(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,u)).setFrameWidth(t,e).then(n=>i(n)),this.setX=async(t,e)=>(await a(this,u)).setFrameX(t,e).then(n=>i(n)),this.setY=async(t,e)=>(await a(this,u)).setFrameY(t,e).then(n=>i(n)),this.rename=async(t,e)=>(await a(this,u)).renameFrame(t,e).then(n=>i(n)),this.reset=async t=>(await a(this,u)).resetFrame(t).then(r=>i(r)),this.resetX=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetY=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetRotation=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetHeight=async t=>(await a(this,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetImageFrameFitMode=async t=>(await a(this,u)).resetImageFrameFitMode(t).then(r=>i(r)),this.setVisibility=async(t,e)=>(await a(this,u)).setFrameIsVisible(t,e).then(n=>i(n)),this.setIsVisible=async(t,e)=>(await a(this,u)).setFrameIsVisible(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,u)).removeFrames([t]).then(r=>i(r)),this.removeFrames=async t=>(await a(this,u)).removeFrames(t).then(r=>i(r)),this.create=async(t,e,r,n,c)=>(await a(this,u)).addFrame(t,e,r,n,c).then(d=>i(d)),this.createShapeFrame=async(t,e,r,n,c)=>(await a(this,u)).addFrame(t,e,r,n,c).then(d=>i(d)),this.createBarcodeFrame=async(t,e)=>(await a(this,u)).addBarcodeFrame(t,e==null?void 0:e.x,e==null?void 0:e.y).then(n=>i(n)),this.duplicateFrames=async t=>(await a(this,u)).duplicateFrames(t).then(r=>i(r)),this.updateImageSource=async(t,e)=>{const r=await a(this,u),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:Ut.connector};return this.updateImageSource(t,n)},this.setImageFromUrl=async(t,e)=>{const r={url:e,type:Ut.url};return this.updateImageSource(t,r)},this.setImageFrameFitMode=async(t,e)=>(await a(this,u)).setImageFrameFitMode(t,e).then(n=>i(n)),this.setImageFrameFitModePosition=async(t,e)=>(await a(this,u)).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,u)).setVerticalAlignment(t,e).then(n=>i(n)),this.setMinCopyfitting=async(t,e)=>(await a(this,u)).setMinCopyfitting(t,e).then(n=>i(n)),this.setMaxCopyfitting=async(t,e)=>(await a(this,u)).setMaxCopyfitting(t,e).then(n=>i(n)),this.setEnableCopyfitting=async(t,e)=>(await a(this,u)).setEnableCopyfitting(t,e).then(n=>i(n)),this.resetMinCopyfitting=async t=>(await a(this,u)).resetMinCopyfitting(t).then(r=>i(r)),this.resetMaxCopyfitting=async t=>(await a(this,u)).resetMaxCopyfitting(t).then(r=>i(r)),this.resetEnableCopyfitting=async t=>(await a(this,u)).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,u)).setFrameBlendMode(t,e).then(n=>i(n)),this.enterCropMode=async(t,e=le.frameCrop)=>(await a(this,u)).enterCropMode(t,e).then(n=>i(n)),this.applyCropMode=async()=>(await a(this,u)).applyCropMode().then(e=>i(e)),this.exitCropMode=async()=>(await a(this,u)).cancelCropMode().then(e=>i(e)),this.enterSubjectMode=async t=>(await a(this,u)).enterSubjectMode(t).then(r=>i(r)),this.applySubjectMode=async()=>(await a(this,u)).applySubjectMode().then(e=>i(e)),this.exitSubjectMode=async()=>(await a(this,u)).cancelSubjectMode().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,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinWidth=async(t,e)=>{const r={minWidth:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxWidth=async(t,e)=>{const r={maxWidth:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMinHeight=async(t,e)=>{const r={minHeight:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowMaxHeight=async(t,e)=>{const r={maxHeight:{value:e}};return(await a(this,u)).updateAutoGrowSettings(t,JSON.stringify(r)).then(c=>i(c))},this.setAutoGrowDirections=async(t,e)=>{const r={directions:{value:e}};return(await a(this,u)).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.setAnchor=async(t,e,r,n,c)=>{const l={horizontal:e,type:r,target:n,endTarget:c};return(await a(this,u)).setAnchorProperties(t,JSON.stringify(l)).then(p=>i(p))},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,u)).resetFrameTransformation(t).then(r=>i(r)),this.resetVisibility=async t=>(await a(this,u)).setFrameIsVisible(t,null).then(r=>i(r)),this.getConfiguration=async t=>(await a(this,u)).getFrameConfiguration(t).then(r=>i(r)),this.resetAssetCropOverride=async t=>(await a(this,u)).resetAssetCropOverride(t).then(r=>i(r)),this.resetAllAssetCropOverrides=async t=>(await a(this,u)).resetAllAssetCropOverrides(t).then(r=>i(r)),y(this,u,o),this.shapeController=new de(a(this,u))}}u=new WeakMap;class ws{constructor(){this.currentEngineVersion=M.current,this.currentSDKVersion=Ce.version}}class fs{constructor(o){g(this,w);g(this,Ht);this.getAll=async()=>(await a(this,w)).getLayouts().then(e=>i(e)),this.getById=async t=>(await a(this,w)).getLayoutById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,w)).getLayoutByName(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,w)).getSelectedLayout().then(e=>i(e)),this.remove=async t=>(await a(this,w)).removeLayout(t).then(r=>i(r)),this.create=async(t,e)=>{const r=await a(this,w);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,w)).renameLayout(t,e).then(n=>i(n)),this.select=async t=>(await a(this,w)).selectLayout(t).then(r=>i(r)),this.duplicate=async t=>(await a(this,w)).duplicateLayout(t).then(r=>i(r)),this.reset=async t=>(await a(this,w)).resetLayout(t).then(r=>i(r)),this.setHeight=async(t,e)=>(await a(this,w)).setLayoutHeight(t,e).then(n=>i(n)),this.setWidth=async(t,e)=>(await a(this,w)).setLayoutWidth(t,e).then(n=>i(n)),this.setUnit=async(t,e)=>(await a(this,w)).setLayoutUnit(t,e).then(n=>i(n)),this.resetHeight=async t=>(await a(this,w)).resetLayoutHeight(t).then(r=>i(r)),this.resetWidth=async t=>(await a(this,w)).resetLayoutWidth(t).then(r=>i(r)),this.resetUnit=async t=>(await a(this,w)).resetLayoutUnit(t).then(r=>i(r)),this.getSelectedSnapshot=async()=>(await a(this,Ht)).getPageSnapshot().then(e=>e??e),this.setIntent=async(t,e)=>(await a(this,w)).setLayoutIntent(t,e).then(n=>i(n)),this.resetIntent=async t=>(await a(this,w)).resetLayoutIntent(t).then(r=>i(r)),this.setFillColor=async(t,e)=>(await a(this,w)).setLayoutFillColor(t,JSON.stringify(e)).then(n=>i(n)),this.setFillColorEnabled=async(t,e)=>(await a(this,w)).setLayoutFillColorEnabled(t,e).then(n=>i(n)),this.resetFillColor=async t=>(await a(this,w)).resetLayoutFillColor(t).then(r=>i(r)),this.setBleedValue=async(t,e,r)=>{const n=r?{left:r===j.left?e:void 0,top:r===j.top?e:void 0,right:r===j.right?e:void 0,bottom:r===j.bottom?e:void 0}:{left:e,top:e,right:e,bottom:e};return(await a(this,w)).updateLayoutBleed(t,JSON.stringify(n)).then(l=>i(l))},this.setAreBleedValuesCombined=async(t,e)=>{const r={areBleedValuesCombined:e};return(await a(this,w)).updateLayoutBleed(t,JSON.stringify(r)).then(c=>i(c))},this.resetBleedValues=async t=>(await a(this,w)).updateLayoutBleed(t,null).then(r=>i(r)),this.setPrivateData=async(t,e)=>(await a(this,w)).setLayoutPrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,w)).getLayoutPrivateData(t).then(r=>i(r)),this.setDisplayName=async(t,e)=>(await a(this,w)).setLayoutDisplayName(t,e).then(n=>i(n)),this.getDisplayName=async t=>(await a(this,w)).getLayoutDisplayName(t).then(r=>i(r)),this.resetDisplayName=async t=>(await a(this,w)).setLayoutDisplayName(t,null).then(r=>i(r)),this.setAvailableForUser=async(t,e)=>(await a(this,w)).setLayoutAvailableForUser(t,e).then(n=>i(n)),this.setSelectedByUser=async(t,e)=>(await a(this,w)).setLayoutSelectedByUser(t,e).then(n=>i(n)),this.setResizableByUser=async(t,e)=>(await a(this,w)).setLayoutResizableByUser(t,JSON.stringify(e)).then(n=>i(n)),y(this,w,o),y(this,Ht,o)}}w=new WeakMap,Ht=new WeakMap;var Qt=(s=>(s.thumbnail="thumbnail",s.mediumres="mediumres",s.highres="highres",s.original="original",s))(Qt||{}),ue=(s=>(s.web="web",s.print="print",s.animation="animation",s))(ue||{});class Ss{constructor(o){g(this,Y);g(this,$t);this.query=async(t,e,r={})=>(await a(this,Y)).mediaConnectorQuery(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),this.detail=async(t,e,r={})=>(await a(this,Y)).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,$t)).mediaConnectorDownload(t,e,c,ue.web,JSON.stringify(n)).then(d=>d??d)},this.getConfigurationOptions=async t=>(await a(this,Y)).mediaConnectorGetConfigurationOptions(t).then(r=>i(r)),this.getCapabilities=async t=>(await a(this,Y)).mediaConnectorGetCapabilities(t).then(r=>i(r)),this.parseDeprecatedMediaType=t=>{if(t===It.file)return At.file;if(t===It.collection)return At.collection},this.upload=async(t,e,r={})=>(await a(this,Y)).mediaConnectorUpload(t,JSON.stringify(e),JSON.stringify(r)).then(c=>i(c)),y(this,Y,o),y(this,$t,o)}parseDeprecatedMediaDownloadType(o){switch(o){case Yt.HighResolutionWeb:return Qt.highres;case Yt.LowResolutionWeb:return Qt.thumbnail;default:return o}}}Y=new WeakMap,$t=new WeakMap;let bs=(cr=class{constructor(o){g(this,D);g(this,Kt);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,Kt)).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,Kt,o)}},D=new WeakMap,Kt=new WeakMap,cr);class Is{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||{}),As=(s=>(s.general="general",s.connector="connector",s.event="event",s.engine="engine",s))(As||{}),kt=(s=>(s.throw="throw",s.log="log",s))(kt||{});class vs{constructor(o,t,e,r){this.type="action",this.message=o,this.id=t,this.event=e,this.eventChain=r}}class Ps{constructor(o,t,e){this.type="dataRow",this.count=o,this.message=t,this.exceptions=e}}var Xt=(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))(Xt||{}),Fs=(s=>(s.Monday="monday",s.Tuesday="tuesday",s.Wednesday="wednesday",s.Thursday="thursday",s.Friday="friday",s.Saturday="saturday",s.Sunday="sunday",s))(Fs||{}),Es=(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))(Es||{}),Pt=(s=>(s.visible="visible",s.invisible="invisible",s.conditional="conditional",s))(Pt||{}),Ds=(s=>(s.boolean="boolean",s.text="text",s.number="number",s))(Ds||{}),Ls=(s=>(s.equals="=",s.notEquals="!=",s.greaterThan=">",s.greaterThanOrEquals=">=",s.lessThan="<",s.lessThanOrEquals="<=",s))(Ls||{});let gn=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===Xt.list?{...c,items:c.items.map(d=>d.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 he().makeMultipleConnectorsBackwardsCompatible(JSON.parse(e),this.localConfig.get(W.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 Ps(r.count,r.message,r.exceptions);this.config.events.onAsyncError.trigger(n)}else if((r==null?void 0:r.type)==="action"){const n=new vs(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 Os{constructor(o){g(this,mt);this.set=async t=>(await a(this,mt)).selectedTextStyleDeltaUpdate(JSON.stringify(t)).then(r=>i(r)),this.removeSelected=async()=>(await a(this,mt)).selectedTextStyleClean().then(e=>i(e)),this.getSelected=async()=>(await a(this,mt)).getSelectedTextStyle().then(e=>i(e)),y(this,mt,o)}}mt=new WeakMap;var Ms=(s=>(s.FRAME_X="frameX",s.FRAME_Y="frameY",s.WIDTH="width",s.HEIGHT="height",s.FRAME_ROTATION="frameRotation",s))(Ms||{}),Ns=(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))(Ns||{}),$=(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))($||{}),Rs=(s=>(s.MP4="mp4",s.GIF="gif",s.PNG="png",s.JPG="jpg",s.PDF="pdf",s))(Rs||{}),te=(s=>(s.SANDBOX="sandbox",s.PRODUCTION="online",s))(te||{});class Ts{constructor(o){g(this,Lt);this.setTool=async t=>(await a(this,Lt)).setTool(t).then(r=>i(r)),this.getSelected=async()=>(await a(this,Lt)).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,Lt,o)}}Lt=new WeakMap;class Vs{constructor(o,t){g(this,Z);g(this,wt);g(this,zt);this.undo=async()=>(await a(this,Z)).undo().then(r=>i(r)),this.redo=async()=>(await a(this,Z)).redo().then(r=>i(r)),this.addCustomData=async(e,r)=>(await a(this,Z)).setCustomUndoData(e,r,!1).then(c=>i(c)),this.record=async(e,r)=>{try{await a(this,wt).beginIfNoneActive(e),await r(a(this,zt)),await a(this,wt).end()}catch(n){throw await a(this,wt).abort(),n}},this.pause=async()=>(await a(this,Z)).pause().then(r=>i(r)),this.resume=async()=>(await a(this,Z)).resume().then(r=>i(r)),y(this,Z,o),y(this,zt,t),y(this,wt,new yn(o))}}Z=new WeakMap,wt=new WeakMap,zt=new WeakMap;class yn{constructor(o){g(this,ht);this.begin=async t=>(await a(this,ht)).begin(t).then(r=>i(r)),this.beginIfNoneActive=async t=>(await a(this,ht)).beginIfNoneActive(t).then(r=>i(r)),this.end=async()=>(await a(this,ht)).end().then(e=>i(e)),this.abort=async()=>(await a(this,ht)).abort().then(e=>i(e)),y(this,ht,o)}}ht=new WeakMap;const pn=(s,o=2)=>{const t=Math.pow(10,o);return Math.round(s*t)/t};class Bs{constructor(o){g(this,Ot);this.round=(t,e)=>i({data:String(pn(t,e)),success:!0,status:200,parsedData:null}),this.createEnvironmentBaseURL=t=>{const{type:e=te.SANDBOX,environment:r="ft-nostress",version:n="1"}=t,c=e==te.SANDBOX?"chili-publish-sandbox":"chili-publish";return`https://${r}.${c}.online/grafx/api/v${n}/environment/${r}`},this.stageFiles=async(t,e,r)=>{const n=a(this,Ot).get(W.GraFxStudioEnvironmentApiUrl);if(!n)throw new Error("GraFx Studio Environment API URL is not set");const c=`${n}connectors/${e}/stage`,l=a(this,Ot).get(W.GraFxStudioAuthToken);if(!l)throw new Error("GraFx Studio Auth Token is not set");const d=new FormData;t.forEach((S,A)=>{const b=S instanceof File?S.name:`blob-${A}`;d.append("files",S,b)}),r&&d.append("validationJson",JSON.stringify({allowedMimeTypes:r.mimeTypes,minDimensions:{width:r.minWidthPixels,height:r.minHeightPixels}}));const p=await fetch(c,{method:"POST",body:d,headers:{Authorization:`Bearer ${l}`}});if(p.status===422){const S=await p.json();throw new qe(S.message,ce.minDimension)}if(!p.ok)throw new Error("Failed to stage files");return await p.json()},y(this,Ot,o)}}Ot=new WeakMap;class Cn{constructor(o){g(this,Wt);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,Wt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,Wt)).updateNumberVariableProperties(o,JSON.stringify(t));return i(r)}}Wt=new WeakMap;class mn{constructor(o){g(this,jt);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,jt,o)}async applyPropertiesUpdate(o,t){const r=await(await a(this,jt)).updateDateVariableProperties(o,JSON.stringify(t));return i(r)}}jt=new WeakMap;let Js=(hr=class{constructor(o){g(this,f);g(this,Mt);g(this,Nt);this.getAll=async()=>(await a(this,f)).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,f)).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,f)).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,f)).addVariable(t,e).then(n=>i(n)),this.remove=async t=>(await a(this,f)).removeVariables(t).then(r=>i(r)),this.rename=async(t,e)=>(await a(this,f)).setVariableName(t,e).then(n=>i(n)),this.setLabel=async(t,e)=>(await a(this,f)).setVariableLabel(t,e).then(n=>i(n)),y(this,Mt,async(t,e)=>(await a(this,f)).setVariablePlaceholder(t,e).then(n=>i(n))),this.setPlaceholder=async(t,e)=>a(this,Mt).call(this,t,e),this.resetPlaceholder=async t=>a(this,Mt).call(this,t,null),y(this,Nt,async(t,e)=>(await a(this,f)).setVariableHelpText(t,e).then(n=>i(n))),this.setHelpText=async(t,e)=>a(this,Nt).call(this,t,e),this.resetHelpText=async t=>a(this,Nt).call(this,t,null),this.setType=async(t,e)=>(await a(this,f)).setVariableType(t,e).then(n=>i(n)),this.setListVariable=async(t,e)=>(await a(this,f)).setListVariableItems(t,e.map(n=>JSON.stringify({value:n}))).then(n=>i(n)),this.setValue=async(t,e)=>(await a(this,f)).setVariableValue(t,e).then(n=>i(n)),this.duplicate=async t=>(await a(this,f)).duplicateVariable(t).then(r=>i(r)),this.groupVariables=async(t,e)=>(await a(this,f)).groupVariables(t,e).then(n=>i(n)),this.ungroupVariables=async t=>(await a(this,f)).ungroupVariable(t).then(r=>i(r)),this.move=async(t,e,r)=>(await a(this,f)).moveVariable(e,r,t).then(c=>i(c)),this.moveVariables=async(t,e,r)=>(await a(this,f)).moveVariables(e,r,t).then(c=>i(c)),this.setIsVisible=async(t,e)=>{const r=e?{type:Pt.visible}:{type:Pt.invisible};return this.setVariableVisibility(t,r)},this.setIsHidden=async(t,e)=>{const r=e?{type:Pt.invisible}:{type:Pt.visible};return this.setVariableVisibility(t,r)},this.setVariableVisibility=async(t,e)=>(await a(this,f)).setVariableVisibility(t,JSON.stringify(e)).then(n=>i(n)),this.setLayoutsForVariableVisibility=async t=>(await a(this,f)).setLayoutsForVariableVisibility(t?JSON.stringify(t):null).then(r=>i(r)),this.setIsRequired=async(t,e)=>(await a(this,f)).setVariableIsRequired(t,e).then(n=>i(n)),this.setIsReadonly=async(t,e)=>(await a(this,f)).setVariableIsReadonly(t,e).then(n=>i(n)),this.getImageVariableConnectorId=async t=>(await a(this,f)).getImageVariableConnectorId(t).then(r=>i(r)),this.setImageVariableConnector=async(t,e)=>{const r=await a(this,f),c=new he().makeConnectorSourceForwardsCompatible(e);return r.setImageVariableConnector(t,JSON.stringify(c)).then(l=>i(l))},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,f)).setVariablePrivateData(t,JSON.stringify(e)).then(n=>i(n)),this.getPrivateData=async t=>(await a(this,f)).getVariablePrivateData(t).then(r=>i(r)),this.setAllowImageQuery=async(t,e)=>(await a(this,f)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowImageUpload=async(t,e)=>(await a(this,f)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinImageUploadSize=async(t,e,r)=>(await a(this,f)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),y(this,f,o),this.number=new Cn(a(this,f)),this.date=new mn(a(this,f))}makeVariablesBackwardsCompatible(o){return o.map(t=>this.makeVariableBackwardsCompatible(t))}makeVariableBackwardsCompatible(o){return o.type!==Xt.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,f)).updateVariablePrefixSuffixProperties(o,JSON.stringify(t));return i(r)}},f=new WeakMap,Mt=new WeakMap,Nt=new WeakMap,hr);class wn{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 fn{constructor(o){g(this,Q);this.getAll=async()=>(await a(this,Q)).getVariables().then(e=>i(e)),this.getById=async t=>(await a(this,Q)).getVariableById(t).then(r=>i(r)),this.getByName=async t=>(await a(this,Q)).getVariableByName(t).then(r=>i(r)),this.setListVariable=async(t,e)=>(await a(this,Q)).setListVariableItems(t,e.map(n=>JSON.stringify(n))).then(n=>i(n)),this.setImageVariableConnector=async(t,e)=>(await a(this,Q)).setImageVariableConnector(t,JSON.stringify(e)).then(n=>i(n)),y(this,Q,o),this.image=new Sn(o)}}Q=new WeakMap;class Sn{constructor(o){g(this,ft);this.setAllowQuery=async(t,e)=>(await a(this,ft)).setImageVariableAllowQuery(t,e).then(n=>i(n)),this.setAllowUpload=async(t,e)=>(await a(this,ft)).setImageVariableAllowUpload(t,e).then(n=>i(n)),this.setMinUploadSize=async(t,e,r)=>(await a(this,ft)).setImageVariableUploadMinSize(t,e,r).then(c=>i(c)),y(this,ft,o)}}ft=new WeakMap;class bn{constructor(o){g(this,St);this.register=async t=>(await a(this,St)).registerConnector(JSON.stringify(t)).then(r=>i(r)),this.getById=async t=>(await a(this,St)).getConnectorById(t).then(r=>i(r)),this.getAllByType=async t=>(await a(this,St)).getConnectors(t).then(r=>i(r)),y(this,St,o)}}St=new WeakMap;class In{constructor(o){g(this,Rt);g(this,ee);this.setWidth=async t=>(await a(this,Rt)).setPageWidth(t).then(r=>i(r)),this.setHeight=async t=>(await a(this,Rt)).setPageHeight(t).then(r=>i(r)),y(this,Rt,o),y(this,ee,o)}}Rt=new WeakMap,ee=new WeakMap;class Us{constructor(o,t,e){this.config=o,this.connection=t,this.editorAPI=e,this.subscriber=new wn(o),this.variable=new fn(this.editorAPI),this.connector=new bn(this.editorAPI),this.page=new In(this.editorAPI),this.canvas=new oe(this.editorAPI)}}class ks{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===kt.log)(r=this.logger)==null||r.call(this,T.error,As.event,`Error in callback ${e}: ${o}`);else throw o}}class Gs extends ks{constructor(o,t){super(t),this.handler=o}trigger(...o){const t=this.handler();if(t)return this.createEventHandlerFn(t,kt.throw)(...o)}}class m extends ks{constructor(o,t){super(t),this.legacyHandler=o,this.subscriptions=new Set}trigger(...o){const t=this.legacyHandler();t&&this.createEventHandlerFn(t,kt.log)(...o);for(const e of this.subscriptions)e(...o)}registerCallback(o,t=kt.log){const e=this.createEventHandlerFn(o,t);return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}}class ge{static createRuntimeConfig(o){var e,r,n,c,l,d,p,C,S,A,b,I,R,P,G,x,v,X,tt,Vt,Bt,lr,dr,ur,gr,yr,pr,Cr,mr,wr,fr,Sr,br,Ir,Ar;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)||((qt,ye,pe)=>{var vr;if(ge.isLoggingEnabled(qt,((vr=t.logging)==null?void 0:vr.logLevel)??T.error))switch(qt){case T.error:console.error(`[${ye}] [${qt}] ${pe}`);break;case T.warn:console.warn(`[${ye}] [${qt}] ${pe}`);break;default:console.log(`[${ye}] [${qt}] ${pe}`)}})},t.handlers={onAuthExpired:new Gs(()=>t.onAuthExpired,(n=t.logging)==null?void 0:n.logger),onViewportRequested:new Gs(()=>t.onViewportRequested,(c=t.logging)==null?void 0:c.logger)},t.events={onActionsChanged:new m(()=>t.onActionsChanged,(l=t.logging)==null?void 0:l.logger),onStateChanged:new m(()=>t.onStateChanged,(d=t.logging)==null?void 0:d.logger),onDocumentLoaded:new m(()=>t.onDocumentLoaded,(p=t.logging)==null?void 0:p.logger),onSelectedFramesLayoutChanged:new m(()=>t.onSelectedFramesLayoutChanged,(C=t.logging)==null?void 0:C.logger),onFramesLayoutChanged:new m(()=>t.onFramesLayoutChanged,(S=t.logging)==null?void 0:S.logger),onSelectedFramesContentChanged:new m(()=>t.onSelectedFramesContentChanged,(A=t.logging)==null?void 0:A.logger),onPageSelectionChanged:new m(()=>t.onPageSelectionChanged,(b=t.logging)==null?void 0:b.logger),onSelectedLayoutPropertiesChanged:new m(()=>t.onSelectedLayoutPropertiesChanged,(I=t.logging)==null?void 0:I.logger),onSelectedLayoutUnitChanged:new m(()=>t.onSelectedLayoutUnitChanged,(R=t.logging)==null?void 0:R.logger),onScrubberPositionChanged:new m(()=>t.onScrubberPositionChanged,(P=t.logging)==null?void 0:P.logger),onFrameAnimationsChanged:new m(()=>t.onFrameAnimationsChanged,(G=t.logging)==null?void 0:G.logger),onVariableListChanged:new m(()=>t.onVariableListChanged,(x=t.logging)==null?void 0:x.logger),onSelectedToolChanged:new m(()=>t.onSelectedToolChanged,(v=t.logging)==null?void 0:v.logger),onUndoStackStateChanged:new m(()=>t.onUndoStackStateChanged,(X=t.logging)==null?void 0:X.logger),onSelectedLayoutFramesChanged:new m(()=>t.onSelectedLayoutFramesChanged,(tt=t.logging)==null?void 0:tt.logger),onSelectedTextStyleChanged:new m(()=>t.onSelectedTextStyleChanged,(Vt=t.logging)==null?void 0:Vt.logger),onColorsChanged:new m(()=>t.onColorsChanged,(Bt=t.logging)==null?void 0:Bt.logger),onParagraphStylesChanged:new m(()=>t.onParagraphStylesChanged,(lr=t.logging)==null?void 0:lr.logger),onCharacterStylesChanged:new m(()=>t.onCharacterStylesChanged,(dr=t.logging)==null?void 0:dr.logger),onFontFamiliesChanged:new m(()=>t.onFontFamiliesChanged,(ur=t.logging)==null?void 0:ur.logger),onSelectedLayoutIdChanged:new m(()=>t.onSelectedLayoutIdChanged,(gr=t.logging)==null?void 0:gr.logger),onLayoutsChanged:new m(()=>t.onLayoutsChanged,(yr=t.logging)==null?void 0:yr.logger),onConnectorEvent:new m(()=>t.onConnectorEvent,(pr=t.logging)==null?void 0:pr.logger),onConnectorsChanged:new m(()=>t.onConnectorsChanged,(Cr=t.logging)==null?void 0:Cr.logger),onZoomChanged:new m(()=>t.onZoomChanged,(mr=t.logging)==null?void 0:mr.logger),onSelectedPageIdChanged:new m(()=>t.onSelectedPageIdChanged,t.logging.logger),onPagesChanged:new m(()=>t.onPagesChanged,t.logging.logger),onPageSnapshotInvalidated:new m(()=>t.onPageSnapshotInvalidated,t.logging.logger),onPageSizeChanged:new m(()=>t.onPageSizeChanged,(wr=t.logging)==null?void 0:wr.logger),onShapeCornerRadiusChanged:new m(()=>t.onShapeCornerRadiusChanged,(fr=t.logging)==null?void 0:fr.logger),onCropActiveFrameIdChanged:new m(()=>t.onCropActiveFrameIdChanged,(Sr=t.logging)==null?void 0:Sr.logger),onAsyncError:new m(()=>t.onAsyncError,(br=t.logging)==null?void 0:br.logger),onViewModeChanged:new m(()=>t.onViewModeChanged,(Ir=t.logging)==null?void 0:Ir.logger),onBarcodeValidationChanged:new m(()=>t.onBarcodeValidationChanged,(Ar=t.logging)==null?void 0:Ar.logger),onDataSourceIdChanged:new m(()=>t.onDataSourceIdChanged,t.logging.logger),onDocumentIssueListChanged:new m(()=>t.onDocumentIssueListChanged,t.logging.logger),onCustomUndoDataChanged:new m(()=>t.onCustomUndoDataChanged,t.logging.logger),onEngineEditModeChanged:new m(()=>t.onEngineEditModeChanged,t.logging.logger),onBrandKitMediaChanged:new m(()=>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 An{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 vn{constructor(o){g(this,lt);y(this,lt,o)}async getValue(o){return(await a(this,lt)).getConfigValue(o).then(e=>i(e))}async setValue(o,t){return(await a(this,lt)).setConfigValue(o,t).then(r=>i(r))}async updateStudioOptions(o){return(await a(this,lt)).updateStudioOptions(JSON.stringify(o)).then(e=>i(e))}async getEngineSessionId(){return(await a(this,lt)).getEngineSessionId().then(t=>i(t))}}lt=new WeakMap;class xs extends vn{constructor(t,e){super(t);g(this,Tt);y(this,Tt,e)}async getValue(t){const e=a(this,Tt).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,Tt).set(t,e),r}}Tt=new WeakMap;const Pn=`https://studio-cdn.chiligrafx.com/editor/${M.current}/web`;let st;class Fn{constructor(o){this.localConfig=new Map,this.dataItemMappingTools=new An,this.loadEditor=()=>{var t;Zr(this.config.editorLink||Pn,{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),this.editorAPI=st==null?void 0:st.promise.then(e=>e),this.action=new Ae(this.editorAPI),this.layout=new fs(this.editorAPI),this.frame=new ms(this.editorAPI),this.barcode=new Le(this.editorAPI),this.animation=new ve(this.editorAPI),this.document=new ts(this.editorAPI),this.configuration=new xs(this.editorAPI,this.localConfig),this.utils=new Bs(this.localConfig),this.tool=new Ts(this.editorAPI),this.page=new bs(this.editorAPI),this.debug=new Xe(this.editorAPI),this.undoManager=new Vs(this.editorAPI,this),this.textSelection=new Os(this.editorAPI),this.colorStyle=new Ue(this.editorAPI),this.paragraphStyle=new Is(this.editorAPI),this.characterStyle=new Ve(this.editorAPI),this.mediaConnector=new Ss(this.editorAPI),this.fontConnector=new ps(this.editorAPI),this.dataConnector=new Ze(this.editorAPI,this.dataItemMappingTools),this.dataSource=new Qe(this.editorAPI,this.dataItemMappingTools),this.connector=new Ye(this.editorAPI,this.localConfig),this.variable=new Js(this.editorAPI),this.font=new Cs(this.editorAPI),this.experiment=new ys(this.editorAPI),this.canvas=new oe(this.editorAPI),this.shape=new de(this.editorAPI),this.colorConversion=new Je(this.editorAPI),this.info=new ws,this.clipboard=new Be(this.editorAPI),this.brandKit=new Te(this.editorAPI,this),this.next=new Us(this.config,this.connection,this.editorAPI),this.configuration.setValue(W.GraFxStudioSdkVersion,Ce.version),this.configuration.setValue(W.GraFxStudioDocumentType,this.config.documentType||ne.template),this.configuration.updateStudioOptions(this.config.studioOptions||Qr),this.configuration.setValue(W.QueryCallCacheEnabled,((t=this.config.enableQueryCallCache)==null?void 0:t.toString())||"false")},this.setConnection=t=>{st=t},this.config=ge.createRuntimeConfig(o),this.connection=st,this.editorAPI=st==null?void 0:st.promise.then(t=>t),this.action=new Ae(this.editorAPI),this.layout=new fs(this.editorAPI),this.frame=new ms(this.editorAPI),this.shape=new de(this.editorAPI),this.barcode=new Le(this.editorAPI),this.undoManager=new Vs(this.editorAPI,this),this.connector=new Ye(this.editorAPI,this.localConfig),this.mediaConnector=new Ss(this.editorAPI),this.fontConnector=new ps(this.editorAPI),this.dataConnector=new Ze(this.editorAPI,this.dataItemMappingTools),this.dataSource=new Qe(this.editorAPI,this.dataItemMappingTools),this.animation=new ve(this.editorAPI),this.document=new ts(this.editorAPI),this.configuration=new xs(this.editorAPI,this.localConfig),this.variable=new Js(this.editorAPI),this.utils=new Bs(this.localConfig),this.subscriber=new gn(this.config,this.localConfig),this.tool=new Ts(this.editorAPI),this.page=new bs(this.editorAPI),this.debug=new Xe(this.editorAPI),this.textSelection=new Os(this.editorAPI),this.colorStyle=new Ue(this.editorAPI),this.paragraphStyle=new Is(this.editorAPI),this.characterStyle=new Ve(this.editorAPI),this.font=new Cs(this.editorAPI),this.experiment=new ys(this.editorAPI),this.canvas=new oe(this.editorAPI),this.colorConversion=new Je(this.editorAPI),this.info=new ws,this.clipboard=new Be(this.editorAPI),this.next=new Us(this.config,this.connection,this.editorAPI),this.enabledNextSubscribers=this.config.enableNextSubscribers,this.brandKit=new Te(this.editorAPI,this)}}var _s=(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))(_s||{}),Hs=(s=>(s.horizontal="horizontal",s.vertical="vertical",s))(Hs||{}),$s=(s=>(s.easeIn="easeIn",s.easeOut="easeOut",s.easeInOut="easeInOut",s))($s||{}),Ks=(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))(Ks||{}),zs=(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))(zs||{}),Ws=(s=>(s.preview="preview",s.normal="normal",s))(Ws||{}),js=(s=>(s.Square="square",s.Line="line",s))(js||{}),qs=(s=>(s.BOLD="Bold",s.ITALIC="Italic",s.REGULAR="Regular",s))(qs||{}),Ys=(s=>(s.LEFT="left",s.CENTER="center",s.RIGHT="right",s.JUSTIFY="justify",s))(Ys||{}),Zs=(s=>(s.TOP="top",s.CENTER="center",s.BOTTOM="bottom",s))(Zs||{}),Qs=(s=>(s.TO_LOWER_CASE="lowercase",s.TO_UPPER_CASE="uppercase",s.NORMAL="normal",s))(Qs||{}),Xs=(s=>(s.SUPERSCRIPT="superscript",s.SUBSCRIPT="subscript",s.NORMAL="normal",s))(Xs||{}),tr=(s=>(s.STYLE="textStyle",s.PROPERTIES="textProperties",s.APPEARANCE="appearance",s))(tr||{}),er=(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))(er||{}),sr=(s=>(s.selectedLayoutChanged="selectedLayoutChanged",s.frameMoved="frameMoved",s.pageSizeChanged="pageSizeChanged",s.documentLoaded="documentLoaded",s.variableValueChanged="variableValueChanged",s))(sr||{}),rr=(s=>(s.ellipse="ellipse",s.rectangle="rectangle",s.polygon="polygon",s))(rr||{}),nr=(s=>(s.all="all",s.only="only",s.none="none",s))(nr||{}),ar=(s=>(s.normal="normal",s.textEdit="textEdit",s.customCrop="customCrop",s.frameSubjectArea="frameSubjectArea",s.perAssetCrop="perAssetCrop",s))(ar||{}),ir=(s=>(s.url="url",s.grafx="grafx",s.local="local",s))(ir||{});const En=Object.freeze(Object.defineProperty({__proto__:null,ConnectorRegistrationSource:ir},Symbol.toStringTag,{value:"Module"}));h.ActionAsyncError=vs,h.ActionEditorEvent=sr,h.Alignment=Ys,h.AnchorTargetEdgeType=gs,h.AnchorTargetType=us,h.AuthCredentialsTypeEnum=We,h.AuthRefreshTypeEnum=je,h.AutoGrowDirection=es,h.BarcodeCharacterSet=ut,h.BarcodeErrorCorrectionLevel=bt,h.BarcodeSourceTypeEnum=rs,h.BarcodeType=_,h.BarcodeValidationResult=Pe,h.BasicAnimationsEmphasisStyles=zs,h.BlendMode=os,h.Case=Qs,h.ColorType=q,h.ColorUsageType=ae,h.ConnectorConfigContextType=He,h.ConnectorConfigValueType=_e,h.ConnectorEventType=ze,h.ConnectorHttpError=Ie,h.ConnectorMapping=an,h.ConnectorMappingDirection=Ke,h.ConnectorMappingSource=$e,h.ConnectorRegistrationSource=vt,h.ConnectorStateType=Zt,h.ConnectorType=ke,h.CornerRadiusType=nr,h.CropType=le,h.DataRowAsyncError=Ps,h.Day=Fs,h.DeprecatedMediaConnectorDownloadType=Yt,h.DeprecatedMediaType=It,h.DocumentIssueTypeEnum=be,h.DocumentType=ne,h.DownloadFormats=Rs,h.EaseTypes=$s,h.EngineEditModeType=ar,h.EnvironmentType=te,h.FitMode=cs,h.FitModePosition=hs,h.FlowDirection=as,h.FontPreviewFormat=js,h.FontWeights=qs,h.FrameAnchorTarget=un,h.FrameAnchorType=ds,h.FramePropertyNames=Ms,h.FrameTypeEnum=ss,h.GrafxTokenAuthCredentials=cn,h.ImageSourceTypeEnum=Ut,h.LayoutIntent=De,h.LayoutPropertyNames=Ns,h.LayoutType=Fe,h.Locale=Es,h.MeasurementUnit=Ee,h.MediaDownloadIntent=ue,h.MediaDownloadType=Qt,h.MediaType=At,h.Next=En,h.PageAnchorTarget=dn,h.PositionEnum=j,h.RefreshedAuthCredendentials=hn,h.Scripting=Xs,h.SelectedTextStyleSections=tr,h.SelectedTextStyles=er,h.ShakeDirections=Hs,h.ShapeType=rr,h.SlideDirections=_s,h.SortBy=Ge,h.SortOrder=xe,h.TextDirection=ns,h.TextPosition=Zs,h.ToolType=$,h.TweenTypes=Ks,h.UpdateZIndexMethod=ls,h.UploadAssetValidationError=qe,h.UploadAssetValidationErrorType=ce,h.VariableType=Xt,h.VariableVisibilityOperator=Ls,h.VariableVisibilityTargetType=Ds,h.VariableVisibilityType=Pt,h.VerticalAlign=is,h.ViewMode=Ws,h.WellKnownConfigurationKeys=W,h.default=Fn,h.grafxMediaConnectorRegistration=on,Object.defineProperties(h,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
22
21
  //# sourceMappingURL=main.js.map