@grapesjs/studio-sdk-plugins 1.0.33-rc.1 → 1.0.33

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 (130) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +161 -156
  3. package/dist/accordionComponent/index.umd.js +9 -9
  4. package/dist/aiChat/chatManager.d.ts +15 -0
  5. package/dist/aiChat/clientTools.d.ts +3 -3
  6. package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
  7. package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
  8. package/dist/aiChat/components/AiChatError.d.ts +2 -1
  9. package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
  10. package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
  11. package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
  12. package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
  13. package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
  14. package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
  15. package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
  16. package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
  17. package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
  18. package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
  19. package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
  20. package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
  21. package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
  22. package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
  23. package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
  24. package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
  25. package/dist/aiChat/components/index.d.ts +24 -25
  26. package/dist/aiChat/components/utils.d.ts +12 -4
  27. package/dist/aiChat/index.cjs.d.ts +5 -0
  28. package/dist/aiChat/index.cjs.js +453 -0
  29. package/dist/aiChat/index.d.ts +4 -3
  30. package/dist/aiChat/index.es.d.ts +5 -0
  31. package/dist/aiChat/index.es.js +30930 -0
  32. package/dist/aiChat/index.js +453 -0
  33. package/dist/aiChat/index.umd.js +453 -0
  34. package/dist/aiChat/locales/en.d.ts +64 -0
  35. package/dist/aiChat/server/index.cjs.d.ts +4 -0
  36. package/dist/aiChat/server/index.cjs.js +309 -0
  37. package/dist/aiChat/server/index.d.ts +0 -50
  38. package/dist/aiChat/server/index.es.d.ts +4 -0
  39. package/dist/aiChat/server/index.es.js +876 -0
  40. package/dist/aiChat/server/index.js +309 -0
  41. package/dist/aiChat/server/index.umd.js +309 -0
  42. package/dist/aiChat/server/stream.d.ts +0 -6
  43. package/dist/aiChat/server/tools.d.ts +157 -51
  44. package/dist/aiChat/server/types.d.ts +108 -64
  45. package/dist/aiChat/types.d.ts +148 -108
  46. package/dist/aiChat/typesSchema.d.ts +238 -25
  47. package/dist/animationComponent/index.cjs.js +3 -3
  48. package/dist/animationComponent/index.es.js +174 -169
  49. package/dist/animationComponent/index.umd.js +3 -3
  50. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  51. package/dist/canvasAbsoluteMode/index.es.js +161 -156
  52. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  53. package/dist/canvasEmptyState/index.cjs.js +1 -1
  54. package/dist/canvasEmptyState/index.es.js +113 -108
  55. package/dist/canvasEmptyState/index.umd.js +1 -1
  56. package/dist/canvasFullSize/index.cjs.js +9 -9
  57. package/dist/canvasFullSize/index.es.js +137 -132
  58. package/dist/canvasFullSize/index.umd.js +9 -9
  59. package/dist/canvasGridMode/index.cjs.js +4 -4
  60. package/dist/canvasGridMode/index.es.js +168 -163
  61. package/dist/canvasGridMode/index.umd.js +8 -8
  62. package/dist/canvasScreenshot/index.cjs.js +1 -1
  63. package/dist/canvasScreenshot/index.es.js +132 -127
  64. package/dist/canvasScreenshot/index.umd.js +1 -1
  65. package/dist/dataSourceEjs/index.cjs.js +5 -5
  66. package/dist/dataSourceEjs/index.es.js +151 -146
  67. package/dist/dataSourceEjs/index.umd.js +5 -5
  68. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  69. package/dist/dataSourceHandlebars/index.es.js +91 -86
  70. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  71. package/dist/dialogComponent/index.cjs.js +16 -16
  72. package/dist/dialogComponent/index.es.js +117 -112
  73. package/dist/dialogComponent/index.umd.js +16 -16
  74. package/dist/flexComponent/index.cjs.js +11 -11
  75. package/dist/flexComponent/index.es.js +416 -411
  76. package/dist/flexComponent/index.umd.js +11 -11
  77. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  78. package/dist/fsLightboxComponent/index.es.js +152 -147
  79. package/dist/fsLightboxComponent/index.umd.js +3 -3
  80. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  81. package/dist/googleFontsAssetProvider/index.es.js +127 -122
  82. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  83. package/dist/iconifyComponent/index.cjs.js +2 -2
  84. package/dist/iconifyComponent/index.es.js +170 -165
  85. package/dist/iconifyComponent/index.umd.js +2 -2
  86. package/dist/index.cjs.js +1 -1
  87. package/dist/index.es.js +27 -22
  88. package/dist/index.umd.js +1 -1
  89. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  90. package/dist/layoutSidebarButtons/index.es.js +156 -151
  91. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  92. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  93. package/dist/lightGalleryComponent/index.es.js +197 -192
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/linkImageComponent/index.cjs.js +2 -2
  96. package/dist/linkImageComponent/index.es.js +86 -81
  97. package/dist/linkImageComponent/index.umd.js +2 -2
  98. package/dist/listPagesComponent/index.cjs.js +5 -5
  99. package/dist/listPagesComponent/index.es.js +121 -116
  100. package/dist/listPagesComponent/index.umd.js +5 -5
  101. package/dist/presetPrintable/index.cjs.js +4 -4
  102. package/dist/presetPrintable/index.es.js +180 -175
  103. package/dist/presetPrintable/index.umd.js +4 -4
  104. package/dist/prosemirror/index.cjs.js +6 -6
  105. package/dist/prosemirror/index.es.js +128 -123
  106. package/dist/prosemirror/index.umd.js +8 -8
  107. package/dist/rendererReact/index.cjs.js +1 -1
  108. package/dist/rendererReact/index.es.js +127 -122
  109. package/dist/rendererReact/index.js +1 -1
  110. package/dist/rendererReact/index.umd.js +1 -1
  111. package/dist/rteTinyMce/index.cjs.js +2 -2
  112. package/dist/rteTinyMce/index.es.js +160 -155
  113. package/dist/rteTinyMce/index.umd.js +2 -2
  114. package/dist/shapeDividerComponent/index.cjs.js +25 -25
  115. package/dist/shapeDividerComponent/index.es.js +127 -122
  116. package/dist/shapeDividerComponent/index.umd.js +25 -25
  117. package/dist/swiperComponent/index.cjs.js +9 -9
  118. package/dist/swiperComponent/index.es.js +197 -192
  119. package/dist/swiperComponent/index.umd.js +9 -9
  120. package/dist/tableComponent/index.cjs.js +1 -1
  121. package/dist/tableComponent/index.es.js +227 -222
  122. package/dist/tableComponent/index.umd.js +1 -1
  123. package/dist/types.d.ts +1 -1
  124. package/dist/utils.d.ts +12 -1
  125. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  126. package/dist/youtubeAssetProvider/index.es.js +124 -119
  127. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  128. package/package.json +5 -2
  129. package/dist/aiChat/components/AiChatInput.d.ts +0 -17
  130. package/dist/aiChat/server/stream-utils.d.ts +0 -16
@@ -1 +1 @@
1
- (function(P,R){typeof exports=="object"&&typeof module<"u"?module.exports=R():typeof define=="function"&&define.amd?define(R):(P=typeof globalThis<"u"?globalThis:P||self,P.StudioSdkPlugins_canvasAbsoluteMode=R())})(this,function(){"use strict";const P="app.grapesjs.com",R="app-stage.grapesjs.com",W=[P,"app2.grapesjs.com",R,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],H="license:check:start",X="license:check:end",F=()=>typeof window<"u",q=({isDev:e,isStage:a})=>`${e?"":`https://${a?R:P}`}/api`,J=()=>{const e=F()&&window.location.hostname;return!!e&&(W.includes(e)||W.some(a=>e.endsWith(a)))};function z(e){return typeof e=="function"}async function Q({path:e,baseApiUrl:a,method:h="GET",headers:l={},params:f,body:o}){const n=`${a||q({isDev:!1,isStage:!1})}${e}`,m={method:h,headers:{"Content-Type":"application/json",...l}};o&&(m.body=JSON.stringify(o));const d=f?new URLSearchParams(f).toString():"",t=d?`?${d}`:"",i=await fetch(`${n}${t}`,m);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.json()}var L=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(L||{});const Y={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function Z(e){const a=e;return a.init=h=>l=>e(l,h),a}const ee=e=>Z(e);async function te({editor:e,plan:a,pluginName:h,licenseKey:l,cleanup:f}){let o="",s=!1;const n=J(),m=t=>{console.warn("Cleanup plugin:",h,"Reason:",t),f()},d=(t={})=>{var E;const{error:i,sdkLicense:p}=t,c=(E=t.plan)==null?void 0:E.category;if(!(p||t.license)||i)m(i||"Invalid license");else if(c){const b=Y[a],v=Y[c];b>v&&m({pluginRequiredPlan:a,licensePlan:c})}};e.on(H,t=>{o=t==null?void 0:t.baseApiUrl,s=!0}),e.on(X,t=>{d(t)}),setTimeout(async()=>{if(!s){if(n)return;if(l){const t=await ne({licenseKey:l,pluginName:h,baseApiUrl:o});t&&d(t)}else m("The `licenseKey` option not provided")}},2e3)}async function ne(e){const{licenseKey:a,pluginName:h,baseApiUrl:l}=e;try{return(await Q({baseApiUrl:l,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:h}})).result||{}}catch(f){return console.error("Error during SDK license check:",f),!1}}const oe="canvasAbsoluteMode",se=L.startup,ie=(e,a,h)=>{var d,t;const l=h.enableAbsolute??(i=>i.hasAbsolute),o=(Array.isArray(a)?a:a?[a]:[...e.getSelectedAll()])[0],s=((t=(d=o==null?void 0:o.delegate)==null?void 0:d.move)==null?void 0:t.call(d,o))||o;if(!s)return;const n=s.getEl();return{result:z(l)?l({component:s,hasAbsolute:!!n&&getComputedStyle(n).position==="absolute"}):!1,component:s,dmode:s.get("dmode")}};function G({guideMatched:e,canvasView:a}){var N;const h=e.guide.x===void 0?"y":"x";let l=0,f=0,o=0,s=0;const{guide:n,matched:m}=e,d=a.getElBoxRect(n.componentView.el),t=a.getElBoxRect(((N=m.componentView)==null?void 0:N.el)||m.componentEl),i=d.y,p=d.y+d.height,c=d.x,S=d.x+d.width,E=t.y,b=t.y+t.height,v=t.x,_=t.x+t.width,x=Math.max(0,i-b),u=Math.max(0,E-p),C=Math.max(0,c-_),M=Math.max(0,v-S),r=x>u,g=C>M,y=n.type;return h==="x"&&(y==="l"?(l=c,r?(f=b,o=x):(f=p,o=u)):y==="r"?(l=S,r?(f=b,o=x):(f=p,o=u)):y==="x"&&(l=c-(c-S)/2,r?(f=b,o=x):(f=p,o=u))),h==="y"&&(y==="t"?(f=i,g?(l=_,s=C):(l=S,s=M)):y==="b"?(f=p,g?(l=_,s=C):(l=S,s=M)):y==="y"&&(f=i-(i-p)/2,g?(l=_,s=C):(l=S,s=M))),{axis:h,x:l,y:f,width:s,height:o}}function ce({guideMatched:e,component:a,canvasView:h}){const l=e.guide.x===void 0?"x":"y",{guide:f,matched:o}=e,s=f.type,n=o.type,m=h.getElementPos(f.componentView.el).rect,d=h.getElementPos(o.componentView.el).rect;if(l==="x"){const t=m.height,i=d.top,p=d.top+d.height;let c=0;s==="t"?n==="t"?c=i-t:n==="b"?c=p-t:n==="y"&&(c=i-t-(i-p)/2):s==="b"?n==="t"?c=i-t*2:n==="b"?c=p-t*2:n==="y"&&(c=i-t*2-(i-p)/2):s==="y"&&(n==="t"?c=i-t*1.5:n==="b"?c=p-t*1.5:n==="y"&&(c=i-t*1.5-(i-p)/2)),a.addStyle({top:`${c-5}px`},{partial:!0})}if(l==="y"){const t=m.width,i=d.left,p=d.left+d.width;let c=0;s==="l"?n==="l"?c=i:n==="r"?c=p:n==="x"&&(c=i-(i-p)/2):s==="r"?n==="l"?c=i-t:n==="r"?c=p-t:n==="x"&&(c=i-t-(i-p)/2):s==="x"&&(n==="l"?c=i-t/2:n==="r"&&(c=p-t/2)),a.addStyle({left:`${c}px`},{partial:!0})}}function k({snapping:e,editor:a,props:h}){var B,w;const{command:l,guidesMatched:f}=h,o=h.component,s=o.getEl(),n=a.Canvas.getCanvasView(),{x:m,y:d}=e??{x:10,y:10},t=l.opts.event,i=t.clientX,p=t.clientY;if(!o.__lastSnappedPosition){const A=n.getElBoxRect(s),D=i-A.x,T=p-A.y;o.__lastSnappedPosition={left:A.x,top:A.y},o.__dragOffset={x:D,y:T}}const c=((B=o.__dragOffset)==null?void 0:B.x)||0,S=((w=o.__dragOffset)==null?void 0:w.y)||0,E=o.__lastSnappedPosition,b=i-E.left-c,v=p-E.top-S;let _=E.left,x=E.top;const u=f==null?void 0:f[0],C=(u==null?void 0:u.guide.type)==="l",M=(u==null?void 0:u.guide.type)==="x",r=(u==null?void 0:u.guide.type)==="r",g=(u==null?void 0:u.guide.type)==="t",y=(u==null?void 0:u.guide.type)==="b",N=(u==null?void 0:u.guide.type)==="y";if(u){const{x:A,y:D}=G({guideMatched:u,canvasView:n}),T=s.offsetWidth,I=s.offsetHeight;C?_=A:r?_=A-T:M?_=A-T/2:g?x=D:y?x=D-I:N&&(x=D-I/2),o.__lastSnappedGuideMatched=u}else Math.abs(b)>=m&&(_=Math.round((E.left+b)/m)*m,o.__lastSnappedGuideMatched=null),Math.abs(v)>=d&&(x=Math.round((E.top+v)/d)*d,o.__lastSnappedGuideMatched=null);return o.addStyle({left:`${_}px`,top:`${x}px`},{partial:!0}),o.__lastSnappedPosition={left:_,top:x},{x:_,y:x,guideMatched:o.__lastSnappedGuideMatched}}function ae({snapping:e,props:a,editor:h}){const{x:l,y:f}=k({snapping:e,props:a,editor:h}),o=a.component;o.addStyle({left:`${l}px`,top:`${f}px`}),delete o.__lastSnappedPosition,delete o.__lastSnappedGuideMatched}const le="core:component-drag",de="studio:setDragAbsolute",fe="dmode:start",K="dmode:move",V="dmode:end",U="dragAbsolute",re="select",pe="hover",ue="spacing";return ee(function(e,a={}){const{Commands:h}=e,l=h.events,f=h.getConfig().defaultOptions??{},o=`${l.runBeforeCommand}tlb-move`;f[le]={run:r=>({...r,skipGuidesRender:!0})};const{snapping:s,locking:n,globalAbsolute:m=!0}=a;m&&e.setDragMode("absolute");const d=!!(s!=null&&s.x||s!=null&&s.y),t=!!(n!=null&&n.x||n!=null&&n.y),{Canvas:i}=e;let p=null;const c=r=>{const{component:g,guidesMatched:y,command:N}=r,B=g.view,w=e.Canvas.getCanvasView(),A=g.getEl();let D=y.map(O=>O.matched.componentEl),T=y.map(O=>G({guideMatched:O,canvasView:w}));if(d){const{guideMatched:O}=k({snapping:s,props:r,editor:e});O?(D=[O.matched.componentEl],T=[G({guideMatched:O,canvasView:w})]):(D=[],T=[])}if(t)if(N.opts.event.shiftKey)if(!p)p=y[0];else{const $=p,j=$.guide.x===void 0?"x":"y";(j==="x"&&(n==null?void 0:n.x)||j==="y"&&(n==null?void 0:n.y))&&(ce({guideMatched:$,component:g,canvasView:w}),D=[$.matched.componentEl],T=[G({guideMatched:$,canvasView:w})])}else p=null;const I={id:U,type:U,component:g,componentView:B,originComponent:A,matchedComponents:D,originMatchedDistances:T};i.addSpot(I)},S=({enabled:r})=>{e.runCommand(de,{enabled:r})},E=({type:r})=>{i.removeSpots({type:r})},b=()=>{E({type:re}),E({type:pe}),E({type:ue})},v=r=>{S({enabled:!0}),c(r),b()},_=r=>{c(r),b()},x=r=>{E({type:U}),d&&ae({snapping:s,props:r,editor:e}),S({enabled:!1})},M=[[fe,r=>{v(r),e.on(K,_);const g=()=>{x(r),e.off(K,_),e.off(V,g)};e.on(V,g)}],[o,r=>{if(m)return;const g=r.options.target,y=ie(e,g,a);y!=null&&y.result&&!y.dmode&&(r.options.mode="absolute")}]];M.forEach(([r,g])=>e.on(r,g)),te({editor:e,licenseKey:a.licenseKey,plan:se,pluginName:oe,cleanup:()=>{S({enabled:!1}),M.forEach(([r,g])=>e.off(r,g))}})})});
1
+ (function(C,N){typeof exports=="object"&&typeof module<"u"?module.exports=N():typeof define=="function"&&define.amd?define(N):(C=typeof globalThis<"u"?globalThis:C||self,C.StudioSdkPlugins_canvasAbsoluteMode=N())})(this,function(){"use strict";const C="app.grapesjs.com",N="app-stage.grapesjs.com",W=[C,"app2.grapesjs.com",N,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],X="license:check:start",F="license:check:end",q=()=>typeof window<"u",J=({isDev:t,isStage:a,isPlatform:u})=>`${t?"":`https://${a?N:C}`}/${u?"platform-api":"api"}`,k=()=>{const t=q()&&window.location.hostname;return!!t&&(W.includes(t)||W.some(a=>t.endsWith(a)))};function z(t){return typeof t=="function"}async function Q({path:t,baseApiUrl:a,method:u="GET",headers:l={},params:i,body:o}){const n=`${a||J({isDev:!1,isStage:!1})}${t}`,g={method:u,headers:{"Content-Type":"application/json",...l}};o&&(g.body=JSON.stringify(o));const d=i?new URLSearchParams(i).toString():"",c=d?`?${d}`:"",e=await fetch(`${n}${c}`,g);if(!e.ok)throw new Error(`HTTP error! status: ${e.status}`);return e.json()}var G=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(G||{});const Y={[G.free]:0,[G.startup]:10,[G.business]:20,[G.enterprise]:30};function Z(t){const a=t;return a.init=u=>l=>t(l,u),a}const tt=t=>Z(t);async function et({editor:t,plan:a,pluginName:u,licenseKey:l,onLicenseCheckResponse:i,cleanup:o}){let s="",n=!1;const g=k(),d=e=>{console.warn("Cleanup plugin:",u,"Reason:",e),o()},c=(e={})=>{var b;const{error:r,sdkLicense:f}=e,y=(b=e.plan)==null?void 0:b.category;if(!(f||e.license)||r)d(r||"Invalid license");else if(y){const v=Y[a],E=Y[y];v>E&&d({pluginRequiredPlan:a,licensePlan:y})}};t.on(X,e=>{s=e==null?void 0:e.baseApiUrl,n=!0}),t.on(F,e=>{i==null||i(e),c(e)}),setTimeout(async()=>{if(!n){if(g)return;if(l){const e=await nt({licenseKey:l,pluginName:u,baseApiUrl:s});i==null||i(e),e&&c(e)}else d("The `licenseKey` option not provided")}},2e3)}async function nt(t){const{licenseKey:a,pluginName:u,baseApiUrl:l}=t;try{return(await Q({baseApiUrl:l,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:u}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const ot="canvasAbsoluteMode",st=G.startup,it=(t,a,u)=>{var d,c;const l=u.enableAbsolute??(e=>e.hasAbsolute),o=(Array.isArray(a)?a:a?[a]:[...t.getSelectedAll()])[0],s=((c=(d=o==null?void 0:o.delegate)==null?void 0:d.move)==null?void 0:c.call(d,o))||o;if(!s)return;const n=s.getEl();return{result:z(l)?l({component:s,hasAbsolute:!!n&&getComputedStyle(n).position==="absolute"}):!1,component:s,dmode:s.get("dmode")}};function L({guideMatched:t,canvasView:a}){var R;const u=t.guide.x===void 0?"y":"x";let l=0,i=0,o=0,s=0;const{guide:n,matched:g}=t,d=a.getElBoxRect(n.componentView.el),c=a.getElBoxRect(((R=g.componentView)==null?void 0:R.el)||g.componentEl),e=d.y,r=d.y+d.height,f=d.x,y=d.x+d.width,S=c.y,b=c.y+c.height,v=c.x,E=c.x+c.width,x=Math.max(0,e-b),m=Math.max(0,S-r),w=Math.max(0,f-E),M=Math.max(0,v-y),p=x>m,h=w>M,_=n.type;return u==="x"&&(_==="l"?(l=f,p?(i=b,o=x):(i=r,o=m)):_==="r"?(l=y,p?(i=b,o=x):(i=r,o=m)):_==="x"&&(l=f-(f-y)/2,p?(i=b,o=x):(i=r,o=m))),u==="y"&&(_==="t"?(i=e,h?(l=E,s=w):(l=y,s=M)):_==="b"?(i=r,h?(l=E,s=w):(l=y,s=M)):_==="y"&&(i=e-(e-r)/2,h?(l=E,s=w):(l=y,s=M))),{axis:u,x:l,y:i,width:s,height:o}}function ct({guideMatched:t,component:a,canvasView:u}){const l=t.guide.x===void 0?"x":"y",{guide:i,matched:o}=t,s=i.type,n=o.type,g=u.getElementPos(i.componentView.el).rect,d=u.getElementPos(o.componentView.el).rect;if(l==="x"){const c=g.height,e=d.top,r=d.top+d.height;let f=0;s==="t"?n==="t"?f=e-c:n==="b"?f=r-c:n==="y"&&(f=e-c-(e-r)/2):s==="b"?n==="t"?f=e-c*2:n==="b"?f=r-c*2:n==="y"&&(f=e-c*2-(e-r)/2):s==="y"&&(n==="t"?f=e-c*1.5:n==="b"?f=r-c*1.5:n==="y"&&(f=e-c*1.5-(e-r)/2)),a.addStyle({top:`${f-5}px`},{partial:!0})}if(l==="y"){const c=g.width,e=d.left,r=d.left+d.width;let f=0;s==="l"?n==="l"?f=e:n==="r"?f=r:n==="x"&&(f=e-(e-r)/2):s==="r"?n==="l"?f=e-c:n==="r"?f=r-c:n==="x"&&(f=e-c-(e-r)/2):s==="x"&&(n==="l"?f=e-c/2:n==="r"&&(f=r-c/2)),a.addStyle({left:`${f}px`},{partial:!0})}}function K({snapping:t,editor:a,props:u}){var B,P;const{command:l,guidesMatched:i}=u,o=u.component,s=o.getEl(),n=a.Canvas.getCanvasView(),{x:g,y:d}=t??{x:10,y:10},c=l.opts.event,e=c.clientX,r=c.clientY;if(!o.__lastSnappedPosition){const A=n.getElBoxRect(s),D=e-A.x,T=r-A.y;o.__lastSnappedPosition={left:A.x,top:A.y},o.__dragOffset={x:D,y:T}}const f=((B=o.__dragOffset)==null?void 0:B.x)||0,y=((P=o.__dragOffset)==null?void 0:P.y)||0,S=o.__lastSnappedPosition,b=e-S.left-f,v=r-S.top-y;let E=S.left,x=S.top;const m=i==null?void 0:i[0],w=(m==null?void 0:m.guide.type)==="l",M=(m==null?void 0:m.guide.type)==="x",p=(m==null?void 0:m.guide.type)==="r",h=(m==null?void 0:m.guide.type)==="t",_=(m==null?void 0:m.guide.type)==="b",R=(m==null?void 0:m.guide.type)==="y";if(m){const{x:A,y:D}=L({guideMatched:m,canvasView:n}),T=s.offsetWidth,I=s.offsetHeight;w?E=A:p?E=A-T:M?E=A-T/2:h?x=D:_?x=D-I:R&&(x=D-I/2),o.__lastSnappedGuideMatched=m}else Math.abs(b)>=g&&(E=Math.round((S.left+b)/g)*g,o.__lastSnappedGuideMatched=null),Math.abs(v)>=d&&(x=Math.round((S.top+v)/d)*d,o.__lastSnappedGuideMatched=null);return o.addStyle({left:`${E}px`,top:`${x}px`},{partial:!0}),o.__lastSnappedPosition={left:E,top:x},{x:E,y:x,guideMatched:o.__lastSnappedGuideMatched}}function at({snapping:t,props:a,editor:u}){const{x:l,y:i}=K({snapping:t,props:a,editor:u}),o=a.component;o.addStyle({left:`${l}px`,top:`${i}px`}),delete o.__lastSnappedPosition,delete o.__lastSnappedGuideMatched}const lt="core:component-drag",dt="studio:setDragAbsolute",ft="dmode:start",V="dmode:move",j="dmode:end",U="dragAbsolute",rt="select",pt="hover",ut="spacing";return tt(function(t,a={}){const{Commands:u}=t,l=u.events,i=u.getConfig().defaultOptions??{},o=`${l.runBeforeCommand}tlb-move`;i[lt]={run:p=>({...p,skipGuidesRender:!0})};const{snapping:s,locking:n,globalAbsolute:g=!0}=a;g&&t.setDragMode("absolute");const d=!!(s!=null&&s.x||s!=null&&s.y),c=!!(n!=null&&n.x||n!=null&&n.y),{Canvas:e}=t;let r=null;const f=p=>{const{component:h,guidesMatched:_,command:R}=p,B=h.view,P=t.Canvas.getCanvasView(),A=h.getEl();let D=_.map(O=>O.matched.componentEl),T=_.map(O=>L({guideMatched:O,canvasView:P}));if(d){const{guideMatched:O}=K({snapping:s,props:p,editor:t});O?(D=[O.matched.componentEl],T=[L({guideMatched:O,canvasView:P})]):(D=[],T=[])}if(c)if(R.opts.event.shiftKey)if(!r)r=_[0];else{const $=r,H=$.guide.x===void 0?"x":"y";(H==="x"&&(n==null?void 0:n.x)||H==="y"&&(n==null?void 0:n.y))&&(ct({guideMatched:$,component:h,canvasView:P}),D=[$.matched.componentEl],T=[L({guideMatched:$,canvasView:P})])}else r=null;const I={id:U,type:U,component:h,componentView:B,originComponent:A,matchedComponents:D,originMatchedDistances:T};e.addSpot(I)},y=({enabled:p})=>{t.runCommand(dt,{enabled:p})},S=({type:p})=>{e.removeSpots({type:p})},b=()=>{S({type:rt}),S({type:pt}),S({type:ut})},v=p=>{y({enabled:!0}),f(p),b()},E=p=>{f(p),b()},x=p=>{S({type:U}),d&&at({snapping:s,props:p,editor:t}),y({enabled:!1})},M=[[ft,p=>{v(p),t.on(V,E);const h=()=>{x(p),t.off(V,E),t.off(j,h)};t.on(j,h)}],[o,p=>{if(g)return;const h=p.options.target,_=it(t,h,a);_!=null&&_.result&&!_.dmode&&(p.options.mode="absolute")}]];M.forEach(([p,h])=>t.on(p,h)),et({editor:t,licenseKey:a.licenseKey,plan:st,pluginName:ot,cleanup:()=>{y({enabled:!1}),M.forEach(([p,h])=>t.off(p,h))}})})});
@@ -1 +1 @@
1
- "use strict";const U="app.grapesjs.com",M="app-stage.grapesjs.com",W="app2.grapesjs.com",D="app-stage2.grapesjs.com",I=[U,W,M,D,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],P="license:check:start",_="license:check:end",$=()=>typeof window<"u",O=({isDev:e,isStage:t})=>`${e?"":`https://${t?M:U}`}/api`,R=()=>{const e=$()&&window.location.hostname;return!!e&&(I.includes(e)||I.some(t=>e.endsWith(t)))};function j(e){return typeof e=="function"}async function K({path:e,baseApiUrl:t,method:a="GET",headers:o={},params:c,body:u}){const g=`${t||O({isDev:!1,isStage:!1})}${e}`,f={method:a,headers:{"Content-Type":"application/json",...o}};u&&(f.body=JSON.stringify(u));const d=c?new URLSearchParams(c).toString():"",n=d?`?${d}`:"",i=await fetch(`${g}${n}`,f);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return i.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{});const N={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function G(e){const t=e;return t.init=a=>o=>e(o,a),t}const x=e=>G(e);async function F({editor:e,plan:t,pluginName:a,licenseKey:o,cleanup:c}){let u="",h=!1;const g=R(),f=n=>{console.warn("Cleanup plugin:",a,"Reason:",n),c()},d=(n={})=>{var C;const{error:i,sdkLicense:E}=n,y=(C=n.plan)==null?void 0:C.category;if(!(E||n.license)||i)f(i||"Invalid license");else if(y){const L=N[t],T=N[y];L>T&&f({pluginRequiredPlan:t,licensePlan:y})}};e.on(P,n=>{u=n==null?void 0:n.baseApiUrl,h=!0}),e.on(_,n=>{d(n)}),setTimeout(async()=>{if(!h){if(g)return;if(o){const n=await H({licenseKey:o,pluginName:a,baseApiUrl:u});n&&d(n)}else f("The `licenseKey` option not provided")}},2e3)}async function H(e){const{licenseKey:t,pluginName:a,baseApiUrl:o}=e;try{return(await K({baseApiUrl:o,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(c){return console.error("Error during SDK license check:",c),!1}}const q="canvasEmptyState",B=w.startup,J=function(e,t={}){const a=new WeakMap,o=new WeakMap,c=new WeakMap,u=new Set,h=new WeakMap,g={emptyStates:[],...t},f=(s,r)=>{let m=!1;const{isValid:p}=r;return Array.isArray(p)?m=p.some(l=>s.is(l)):j(p)?m=p({component:s,editor:e}):m=s.is(p),m},d=s=>{const r=a.get(s);a.delete(s),r==null||r()},n=s=>{s.views.forEach(r=>d(r)),c.delete(s)},i=s=>{if(!(!s||u.has(s)))try{u.add(s);const r=s.components().length>0,m=c.get(s);if(r&&m)n(s);else if(!r&&!m){const p=h.has(s)?h.get(s):g.emptyStates.find(l=>f(s,l));if(h.set(s,p),!p)return;s.views.forEach(l=>{const b=p.render({editor:e,component:s,componentView:l,mount:v=>{o.set(l,v),c.set(s,!0);const A=l.getChildrenContainer();A==null||A.appendChild(v)},unmount:()=>d(l)});a.set(l,()=>{b==null||b();const v=o.get(l);v==null||v.remove()})})}}finally{u.delete(s)}},E=s=>{c.has(s)&&n(s)},y=({model:s})=>{i(s.getComponent())},S=e.Components.events,C=`${S.update}:components`,L="component:mount",T=e.Canvas.events.frameLoadBody,k=S.removed;e.on(C,i),e.on(L,i),e.on(k,E),e.on(T,y),F({editor:e,licenseKey:g.licenseKey,plan:B,pluginName:q,cleanup:()=>{e.off(C,i),e.off(L,i),e.off(k,E),e.off(T,y)}})},z=x(J);module.exports=z;
1
+ "use strict";const W="app.grapesjs.com",D="app-stage.grapesjs.com",P="app2.grapesjs.com",$="app-stage2.grapesjs.com",U=[W,P,D,$,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],_="license:check:start",L="license:check:end",O=()=>typeof window<"u",j=({isDev:t,isStage:a,isPlatform:o})=>`${t?"":`https://${a?D:W}`}/${o?"platform-api":"api"}`,K=()=>{const t=O()&&window.location.hostname;return!!t&&(U.includes(t)||U.some(a=>t.endsWith(a)))};function G(t){return typeof t=="function"}async function k({path:t,baseApiUrl:a,method:o="GET",headers:i={},params:s,body:f}){const d=`${a||j({isDev:!1,isStage:!1})}${t}`,g={method:o,headers:{"Content-Type":"application/json",...i}};f&&(g.body=JSON.stringify(f));const l=s?new URLSearchParams(s).toString():"",h=l?`?${l}`:"",n=await fetch(`${d}${h}`,g);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var w=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(w||{});const M={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function x(t){const a=t;return a.init=o=>i=>t(i,o),a}const F=t=>x(t);async function H({editor:t,plan:a,pluginName:o,licenseKey:i,onLicenseCheckResponse:s,cleanup:f}){let p="",d=!1;const g=K(),l=n=>{console.warn("Cleanup plugin:",o,"Reason:",n),f()},h=(n={})=>{var T;const{error:E,sdkLicense:S}=n,y=(T=n.plan)==null?void 0:T.category;if(!(S||n.license)||E)l(E||"Invalid license");else if(y){const b=M[a],A=M[y];b>A&&l({pluginRequiredPlan:a,licensePlan:y})}};t.on(_,n=>{p=n==null?void 0:n.baseApiUrl,d=!0}),t.on(L,n=>{s==null||s(n),h(n)}),setTimeout(async()=>{if(!d){if(g)return;if(i){const n=await q({licenseKey:i,pluginName:o,baseApiUrl:p});s==null||s(n),n&&h(n)}else l("The `licenseKey` option not provided")}},2e3)}async function q(t){const{licenseKey:a,pluginName:o,baseApiUrl:i}=t;try{return(await k({baseApiUrl:i,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const B="canvasEmptyState",J=w.startup,z=function(t,a={}){const o=new WeakMap,i=new WeakMap,s=new WeakMap,f=new Set,p=new WeakMap,d={emptyStates:[],...a},g=(e,c)=>{let m=!1;const{isValid:u}=c;return Array.isArray(u)?m=u.some(r=>e.is(r)):G(u)?m=u({component:e,editor:t}):m=e.is(u),m},l=e=>{const c=o.get(e);o.delete(e),c==null||c()},h=e=>{e.views.forEach(c=>l(c)),s.delete(e)},n=e=>{if(!(!e||f.has(e)))try{f.add(e);const c=e.components().length>0,m=s.get(e);if(c&&m)h(e);else if(!c&&!m){const u=p.has(e)?p.get(e):d.emptyStates.find(r=>g(e,r));if(p.set(e,u),!u)return;e.views.forEach(r=>{const I=u.render({editor:t,component:e,componentView:r,mount:v=>{i.set(r,v),s.set(e,!0);const N=r.getChildrenContainer();N==null||N.appendChild(v)},unmount:()=>l(r)});o.set(r,()=>{I==null||I();const v=i.get(r);v==null||v.remove()})})}}finally{f.delete(e)}},E=e=>{s.has(e)&&h(e)},S=({model:e})=>{n(e.getComponent())},y=t.Components.events,C=`${y.update}:components`,T="component:mount",b=t.Canvas.events.frameLoadBody,A=y.removed;t.on(C,n),t.on(T,n),t.on(A,E),t.on(b,S),H({editor:t,licenseKey:d.licenseKey,plan:J,pluginName:B,cleanup:()=>{t.off(C,n),t.off(T,n),t.off(A,E),t.off(b,S)}})},Q=F(z);module.exports=Q;
@@ -1,8 +1,8 @@
1
- const U = "app.grapesjs.com", M = "app-stage.grapesjs.com", W = "app2.grapesjs.com", D = "app-stage2.grapesjs.com", I = [
2
- U,
1
+ const W = "app.grapesjs.com", D = "app-stage.grapesjs.com", P = "app2.grapesjs.com", $ = "app-stage2.grapesjs.com", U = [
3
2
  W,
4
- M,
3
+ P,
5
4
  D,
5
+ $,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -11,157 +11,162 @@ const U = "app.grapesjs.com", M = "app-stage.grapesjs.com", W = "app2.grapesjs.c
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], P = "license:check:start", _ = "license:check:end", $ = () => typeof window < "u", O = ({ isDev: e, isStage: t }) => `${e ? "" : `https://${t ? M : U}`}/api`, R = () => {
15
- const e = $() && window.location.hostname;
16
- return !!e && (I.includes(e) || I.some((t) => e.endsWith(t)));
14
+ ], _ = "license:check:start", L = "license:check:end", O = () => typeof window < "u", j = ({
15
+ isDev: t,
16
+ isStage: a,
17
+ isPlatform: o
18
+ }) => `${t ? "" : `https://${a ? D : W}`}/${o ? "platform-api" : "api"}`, K = () => {
19
+ const t = O() && window.location.hostname;
20
+ return !!t && (U.includes(t) || U.some((a) => t.endsWith(a)));
17
21
  };
18
- function j(e) {
19
- return typeof e == "function";
22
+ function G(t) {
23
+ return typeof t == "function";
20
24
  }
21
- async function K({
22
- path: e,
23
- baseApiUrl: t,
24
- method: a = "GET",
25
- headers: o = {},
26
- params: c,
27
- body: u
25
+ async function k({
26
+ path: t,
27
+ baseApiUrl: a,
28
+ method: o = "GET",
29
+ headers: i = {},
30
+ params: s,
31
+ body: f
28
32
  }) {
29
- const g = `${t || O({ isDev: !1, isStage: !1 })}${e}`, f = {
30
- method: a,
33
+ const d = `${a || j({ isDev: !1, isStage: !1 })}${t}`, g = {
34
+ method: o,
31
35
  headers: {
32
36
  "Content-Type": "application/json",
33
- ...o
37
+ ...i
34
38
  }
35
39
  };
36
- u && (f.body = JSON.stringify(u));
37
- const d = c ? new URLSearchParams(c).toString() : "", s = d ? `?${d}` : "", i = await fetch(`${g}${s}`, f);
38
- if (!i.ok)
39
- throw new Error(`HTTP error! status: ${i.status}`);
40
- return i.json();
40
+ f && (g.body = JSON.stringify(f));
41
+ const l = s ? new URLSearchParams(s).toString() : "", h = l ? `?${l}` : "", n = await fetch(`${d}${h}`, g);
42
+ if (!n.ok)
43
+ throw new Error(`HTTP error! status: ${n.status}`);
44
+ return n.json();
41
45
  }
42
- var w = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(w || {});
43
- const N = {
46
+ var w = /* @__PURE__ */ ((t) => (t.free = "free", t.startup = "startup", t.business = "business", t.enterprise = "enterprise", t))(w || {});
47
+ const M = {
44
48
  [w.free]: 0,
45
49
  [w.startup]: 10,
46
50
  [w.business]: 20,
47
51
  [w.enterprise]: 30
48
52
  };
49
- function G(e) {
50
- const t = e;
51
- return t.init = (a) => (o) => e(o, a), t;
53
+ function x(t) {
54
+ const a = t;
55
+ return a.init = (o) => (i) => t(i, o), a;
52
56
  }
53
- const x = (e) => /* @__PURE__ */ G(e);
54
- async function F({
55
- editor: e,
56
- plan: t,
57
- pluginName: a,
58
- licenseKey: o,
59
- cleanup: c
57
+ const F = (t) => /* @__PURE__ */ x(t);
58
+ async function H({
59
+ editor: t,
60
+ plan: a,
61
+ pluginName: o,
62
+ licenseKey: i,
63
+ onLicenseCheckResponse: s,
64
+ cleanup: f
60
65
  }) {
61
- let u = "", h = !1;
62
- const g = R(), f = (s) => {
63
- console.warn("Cleanup plugin:", a, "Reason:", s), c();
64
- }, d = (s = {}) => {
65
- var C;
66
- const { error: i, sdkLicense: E } = s, y = (C = s.plan) == null ? void 0 : C.category;
67
- if (!(E || s.license) || i)
68
- f(i || "Invalid license");
66
+ let p = "", d = !1;
67
+ const g = K(), l = (n) => {
68
+ console.warn("Cleanup plugin:", o, "Reason:", n), f();
69
+ }, h = (n = {}) => {
70
+ var T;
71
+ const { error: E, sdkLicense: S } = n, y = (T = n.plan) == null ? void 0 : T.category;
72
+ if (!(S || n.license) || E)
73
+ l(E || "Invalid license");
69
74
  else if (y) {
70
- const L = N[t], T = N[y];
71
- L > T && f({ pluginRequiredPlan: t, licensePlan: y });
75
+ const b = M[a], A = M[y];
76
+ b > A && l({ pluginRequiredPlan: a, licensePlan: y });
72
77
  }
73
78
  };
74
- e.on(P, (s) => {
75
- u = s == null ? void 0 : s.baseApiUrl, h = !0;
76
- }), e.on(_, (s) => {
77
- d(s);
79
+ t.on(_, (n) => {
80
+ p = n == null ? void 0 : n.baseApiUrl, d = !0;
81
+ }), t.on(L, (n) => {
82
+ s == null || s(n), h(n);
78
83
  }), setTimeout(async () => {
79
- if (!h) {
84
+ if (!d) {
80
85
  if (g) return;
81
- if (o) {
82
- const s = await H({ licenseKey: o, pluginName: a, baseApiUrl: u });
83
- s && d(s);
86
+ if (i) {
87
+ const n = await q({ licenseKey: i, pluginName: o, baseApiUrl: p });
88
+ s == null || s(n), n && h(n);
84
89
  } else
85
- f("The `licenseKey` option not provided");
90
+ l("The `licenseKey` option not provided");
86
91
  }
87
92
  }, 2e3);
88
93
  }
89
- async function H(e) {
90
- const { licenseKey: t, pluginName: a, baseApiUrl: o } = e;
94
+ async function q(t) {
95
+ const { licenseKey: a, pluginName: o, baseApiUrl: i } = t;
91
96
  try {
92
- return (await K({
93
- baseApiUrl: o,
94
- path: `/sdk/${t || "na"}`,
97
+ return (await k({
98
+ baseApiUrl: i,
99
+ path: `/sdk/${a || "na"}`,
95
100
  method: "POST",
96
101
  params: {
97
102
  d: window.location.hostname,
98
- pn: a
103
+ pn: o
99
104
  }
100
105
  })).result || {};
101
- } catch (c) {
102
- return console.error("Error during SDK license check:", c), !1;
106
+ } catch (s) {
107
+ return console.error("Error during SDK license check:", s), !1;
103
108
  }
104
109
  }
105
- const q = "canvasEmptyState", B = w.startup, J = function(e, t = {}) {
106
- const a = /* @__PURE__ */ new WeakMap(), o = /* @__PURE__ */ new WeakMap(), c = /* @__PURE__ */ new WeakMap(), u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new WeakMap(), g = {
110
+ const B = "canvasEmptyState", J = w.startup, z = function(t, a = {}) {
111
+ const o = /* @__PURE__ */ new WeakMap(), i = /* @__PURE__ */ new WeakMap(), s = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new WeakMap(), d = {
107
112
  emptyStates: [],
108
- ...t
109
- }, f = (n, r) => {
113
+ ...a
114
+ }, g = (e, c) => {
110
115
  let m = !1;
111
- const { isValid: p } = r;
112
- return Array.isArray(p) ? m = p.some((l) => n.is(l)) : j(p) ? m = p({ component: n, editor: e }) : m = n.is(p), m;
113
- }, d = (n) => {
114
- const r = a.get(n);
115
- a.delete(n), r == null || r();
116
- }, s = (n) => {
117
- n.views.forEach((r) => d(r)), c.delete(n);
118
- }, i = (n) => {
119
- if (!(!n || u.has(n)))
116
+ const { isValid: u } = c;
117
+ return Array.isArray(u) ? m = u.some((r) => e.is(r)) : G(u) ? m = u({ component: e, editor: t }) : m = e.is(u), m;
118
+ }, l = (e) => {
119
+ const c = o.get(e);
120
+ o.delete(e), c == null || c();
121
+ }, h = (e) => {
122
+ e.views.forEach((c) => l(c)), s.delete(e);
123
+ }, n = (e) => {
124
+ if (!(!e || f.has(e)))
120
125
  try {
121
- u.add(n);
122
- const r = n.components().length > 0, m = c.get(n);
123
- if (r && m)
124
- s(n);
125
- else if (!r && !m) {
126
- const p = h.has(n) ? h.get(n) : g.emptyStates.find((l) => f(n, l));
127
- if (h.set(n, p), !p) return;
128
- n.views.forEach((l) => {
129
- const b = p.render({
130
- editor: e,
131
- component: n,
132
- componentView: l,
126
+ f.add(e);
127
+ const c = e.components().length > 0, m = s.get(e);
128
+ if (c && m)
129
+ h(e);
130
+ else if (!c && !m) {
131
+ const u = p.has(e) ? p.get(e) : d.emptyStates.find((r) => g(e, r));
132
+ if (p.set(e, u), !u) return;
133
+ e.views.forEach((r) => {
134
+ const I = u.render({
135
+ editor: t,
136
+ component: e,
137
+ componentView: r,
133
138
  mount: (v) => {
134
- o.set(l, v), c.set(n, !0);
135
- const A = l.getChildrenContainer();
136
- A == null || A.appendChild(v);
139
+ i.set(r, v), s.set(e, !0);
140
+ const N = r.getChildrenContainer();
141
+ N == null || N.appendChild(v);
137
142
  },
138
- unmount: () => d(l)
143
+ unmount: () => l(r)
139
144
  });
140
- a.set(l, () => {
141
- b == null || b();
142
- const v = o.get(l);
145
+ o.set(r, () => {
146
+ I == null || I();
147
+ const v = i.get(r);
143
148
  v == null || v.remove();
144
149
  });
145
150
  });
146
151
  }
147
152
  } finally {
148
- u.delete(n);
153
+ f.delete(e);
149
154
  }
150
- }, E = (n) => {
151
- c.has(n) && s(n);
152
- }, y = ({ model: n }) => {
153
- i(n.getComponent());
154
- }, S = e.Components.events, C = `${S.update}:components`, L = "component:mount", T = e.Canvas.events.frameLoadBody, k = S.removed;
155
- e.on(C, i), e.on(L, i), e.on(k, E), e.on(T, y), F({
156
- editor: e,
157
- licenseKey: g.licenseKey,
158
- plan: B,
159
- pluginName: q,
155
+ }, E = (e) => {
156
+ s.has(e) && h(e);
157
+ }, S = ({ model: e }) => {
158
+ n(e.getComponent());
159
+ }, y = t.Components.events, C = `${y.update}:components`, T = "component:mount", b = t.Canvas.events.frameLoadBody, A = y.removed;
160
+ t.on(C, n), t.on(T, n), t.on(A, E), t.on(b, S), H({
161
+ editor: t,
162
+ licenseKey: d.licenseKey,
163
+ plan: J,
164
+ pluginName: B,
160
165
  cleanup: () => {
161
- e.off(C, i), e.off(L, i), e.off(k, E), e.off(T, y);
166
+ t.off(C, n), t.off(T, n), t.off(A, E), t.off(b, S);
162
167
  }
163
168
  });
164
- }, z = x(J);
169
+ }, Q = F(z);
165
170
  export {
166
- z as default
171
+ Q as default
167
172
  };
@@ -1 +1 @@
1
- (function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_canvasEmptyState=g())})(this,function(){"use strict";const y="app.grapesjs.com",g="app-stage.grapesjs.com",k=[y,"app2.grapesjs.com",g,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],P="license:check:start",U="license:check:end",_=()=>typeof window<"u",W=({isDev:e,isStage:t})=>`${e?"":`https://${t?g:y}`}/api`,O=()=>{const e=_()&&window.location.hostname;return!!e&&(k.includes(e)||k.some(t=>e.endsWith(t)))};function $(e){return typeof e=="function"}async function R({path:e,baseApiUrl:t,method:o="GET",headers:a={},params:i,body:u}){const w=`${t||W({isDev:!1,isStage:!1})}${e}`,f={method:o,headers:{"Content-Type":"application/json",...a}};u&&(f.body=JSON.stringify(u));const d=i?new URLSearchParams(i).toString():"",s=d?`?${d}`:"",c=await fetch(`${w}${s}`,f);if(!c.ok)throw new Error(`HTTP error! status: ${c.status}`);return c.json()}var v=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(v||{});const D={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function j(e){const t=e;return t.init=o=>a=>e(a,o),t}const G=e=>j(e);async function K({editor:e,plan:t,pluginName:o,licenseKey:a,cleanup:i}){let u="",h=!1;const w=O(),f=s=>{console.warn("Cleanup plugin:",o,"Reason:",s),i()},d=(s={})=>{var S;const{error:c,sdkLicense:T}=s,C=(S=s.plan)==null?void 0:S.category;if(!(T||s.license)||c)f(c||"Invalid license");else if(C){const A=D[t],L=D[C];A>L&&f({pluginRequiredPlan:t,licensePlan:C})}};e.on(P,s=>{u=s==null?void 0:s.baseApiUrl,h=!0}),e.on(U,s=>{d(s)}),setTimeout(async()=>{if(!h){if(w)return;if(a){const s=await x({licenseKey:a,pluginName:o,baseApiUrl:u});s&&d(s)}else f("The `licenseKey` option not provided")}},2e3)}async function x(e){const{licenseKey:t,pluginName:o,baseApiUrl:a}=e;try{return(await R({baseApiUrl:a,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const F="canvasEmptyState",H=v.startup;return G(function(e,t={}){const o=new WeakMap,a=new WeakMap,i=new WeakMap,u=new Set,h=new WeakMap,w={emptyStates:[],...t},f=(n,r)=>{let m=!1;const{isValid:p}=r;return Array.isArray(p)?m=p.some(l=>n.is(l)):$(p)?m=p({component:n,editor:e}):m=n.is(p),m},d=n=>{const r=o.get(n);o.delete(n),r==null||r()},s=n=>{n.views.forEach(r=>d(r)),i.delete(n)},c=n=>{if(!(!n||u.has(n)))try{u.add(n);const r=n.components().length>0,m=i.get(n);if(r&&m)s(n);else if(!r&&!m){const p=h.has(n)?h.get(n):w.emptyStates.find(l=>f(n,l));if(h.set(n,p),!p)return;n.views.forEach(l=>{const I=p.render({editor:e,component:n,componentView:l,mount:E=>{a.set(l,E),i.set(n,!0);const N=l.getChildrenContainer();N==null||N.appendChild(E)},unmount:()=>d(l)});o.set(l,()=>{I==null||I();const E=a.get(l);E==null||E.remove()})})}}finally{u.delete(n)}},T=n=>{i.has(n)&&s(n)},C=({model:n})=>{c(n.getComponent())},b=e.Components.events,S=`${b.update}:components`,A="component:mount",L=e.Canvas.events.frameLoadBody,M=b.removed;e.on(S,c),e.on(A,c),e.on(M,T),e.on(L,C),K({editor:e,licenseKey:w.licenseKey,plan:H,pluginName:F,cleanup:()=>{e.off(S,c),e.off(A,c),e.off(M,T),e.off(L,C)}})})});
1
+ (function(y,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(y=typeof globalThis<"u"?globalThis:y||self,y.StudioSdkPlugins_canvasEmptyState=g())})(this,function(){"use strict";const y="app.grapesjs.com",g="app-stage.grapesjs.com",P=[y,"app2.grapesjs.com",g,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],_="license:check:start",W="license:check:end",O=()=>typeof window<"u",$=({isDev:t,isStage:a,isPlatform:o})=>`${t?"":`https://${a?g:y}`}/${o?"platform-api":"api"}`,L=()=>{const t=O()&&window.location.hostname;return!!t&&(P.includes(t)||P.some(a=>t.endsWith(a)))};function j(t){return typeof t=="function"}async function G({path:t,baseApiUrl:a,method:o="GET",headers:i={},params:s,body:f}){const p=`${a||$({isDev:!1,isStage:!1})}${t}`,w={method:o,headers:{"Content-Type":"application/json",...i}};f&&(w.body=JSON.stringify(f));const l=s?new URLSearchParams(s).toString():"",h=l?`?${l}`:"",n=await fetch(`${p}${h}`,w);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{});const U={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function K(t){const a=t;return a.init=o=>i=>t(i,o),a}const k=t=>K(t);async function x({editor:t,plan:a,pluginName:o,licenseKey:i,onLicenseCheckResponse:s,cleanup:f}){let d="",p=!1;const w=L(),l=n=>{console.warn("Cleanup plugin:",o,"Reason:",n),f()},h=(n={})=>{var A;const{error:T,sdkLicense:b}=n,E=(A=n.plan)==null?void 0:A.category;if(!(b||n.license)||T)l(T||"Invalid license");else if(E){const I=U[a],N=U[E];I>N&&l({pluginRequiredPlan:a,licensePlan:E})}};t.on(_,n=>{d=n==null?void 0:n.baseApiUrl,p=!0}),t.on(W,n=>{s==null||s(n),h(n)}),setTimeout(async()=>{if(!p){if(w)return;if(i){const n=await F({licenseKey:i,pluginName:o,baseApiUrl:d});s==null||s(n),n&&h(n)}else l("The `licenseKey` option not provided")}},2e3)}async function F(t){const{licenseKey:a,pluginName:o,baseApiUrl:i}=t;try{return(await G({baseApiUrl:i,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:o}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const H="canvasEmptyState",q=v.startup;return k(function(t,a={}){const o=new WeakMap,i=new WeakMap,s=new WeakMap,f=new Set,d=new WeakMap,p={emptyStates:[],...a},w=(e,c)=>{let m=!1;const{isValid:u}=c;return Array.isArray(u)?m=u.some(r=>e.is(r)):j(u)?m=u({component:e,editor:t}):m=e.is(u),m},l=e=>{const c=o.get(e);o.delete(e),c==null||c()},h=e=>{e.views.forEach(c=>l(c)),s.delete(e)},n=e=>{if(!(!e||f.has(e)))try{f.add(e);const c=e.components().length>0,m=s.get(e);if(c&&m)h(e);else if(!c&&!m){const u=d.has(e)?d.get(e):p.emptyStates.find(r=>w(e,r));if(d.set(e,u),!u)return;e.views.forEach(r=>{const M=u.render({editor:t,component:e,componentView:r,mount:S=>{i.set(r,S),s.set(e,!0);const C=r.getChildrenContainer();C==null||C.appendChild(S)},unmount:()=>l(r)});o.set(r,()=>{M==null||M();const S=i.get(r);S==null||S.remove()})})}}finally{f.delete(e)}},T=e=>{s.has(e)&&h(e)},b=({model:e})=>{n(e.getComponent())},E=t.Components.events,D=`${E.update}:components`,A="component:mount",I=t.Canvas.events.frameLoadBody,N=E.removed;t.on(D,n),t.on(A,n),t.on(N,T),t.on(I,b),x({editor:t,licenseKey:p.licenseKey,plan:q,pluginName:H,cleanup:()=>{t.off(D,n),t.off(A,n),t.off(N,T),t.off(I,b)}})})});
@@ -1,10 +1,10 @@
1
- "use strict";function X(e,i,t){let s,o,c,h,m;const r=i;function d(){const l=Date.now()-h;l<r&&l>=0?s=setTimeout(d,r-l):(s=null,m=e.apply(c,o),c=o=null)}const a=function(){return c=this,o=arguments,h=Date.now(),s||(s=setTimeout(d,r)),m};return a.clear=function(){s&&(clearTimeout(s),s=null)},a.flush=function(){s&&(m=e.apply(c,o),c=o=null,clearTimeout(s),s=null)},a}const U="app.grapesjs.com",k="app-stage.grapesjs.com",Y="app2.grapesjs.com",J="app-stage2.grapesjs.com",j=[U,Y,k,J,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Q="license:check:start",ee="license:check:end",te=()=>typeof window<"u",ne=({isDev:e,isStage:i})=>`${e?"":`https://${i?k:U}`}/api`,se=()=>{const e=te()&&window.location.hostname;return!!e&&(j.includes(e)||j.some(i=>e.endsWith(i)))};async function oe({path:e,baseApiUrl:i,method:t="GET",headers:s={},params:o,body:c}){const m=`${i||ne({isDev:!1,isStage:!1})}${e}`,r={method:t,headers:{"Content-Type":"application/json",...s}};c&&(r.body=JSON.stringify(c));const d=o?new URLSearchParams(o).toString():"",a=d?`?${d}`:"",l=await fetch(`${m}${a}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}var y=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(y||{});const I={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function ae(e){const i=e;return i.init=t=>s=>e(s,t),i}const ie=e=>ae(e);async function ce({editor:e,plan:i,pluginName:t,licenseKey:s,cleanup:o}){let c="",h=!1;const m=se(),r=a=>{console.warn("Cleanup plugin:",t,"Reason:",a),o()},d=(a={})=>{var v;const{error:l,sdkLicense:g}=a,w=(v=a.plan)==null?void 0:v.category;if(!(g||a.license)||l)r(l||"Invalid license");else if(w){const S=I[i],E=I[w];S>E&&r({pluginRequiredPlan:i,licensePlan:w})}};e.on(Q,a=>{c=a==null?void 0:a.baseApiUrl,h=!0}),e.on(ee,a=>{d(a)}),setTimeout(async()=>{if(!h){if(m)return;if(s){const a=await re({licenseKey:s,pluginName:t,baseApiUrl:c});a&&d(a)}else r("The `licenseKey` option not provided")}},2e3)}async function re(e){const{licenseKey:i,pluginName:t,baseApiUrl:s}=e;try{return(await oe({baseApiUrl:s,path:`/sdk/${i||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const N="data-gs-plg-",O="canvasFullSize",le=y.startup,ue=(e,i)=>{const{rule:t,ruleView:s}=i,{style:o}=t.attributes;if(o&&o[e]){const c=o[e],h=/([0-9.]+)(vh|dvh|lvh|svh)/g,m=h.test(c),r=s.frameView.model;if(m&&r.hasAutoHeight()){const d=c.replace(h,(l,g)=>`${window.innerHeight*(parseFloat(g)/100)}px`),a=t.toCSS({style:{...o,[e]:d}});i.css=a}}},pe=e=>{["height","min-height","max-height"].forEach(i=>ue(i,e))},me=function(e,i={}){const{Canvas:t,Commands:s,Devices:o,Css:c}=e,h={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...i},{canvasOffsetY:m,canvasOffsetX:r,canvasTransition:d,deviceMaxWidth:a,deviceMinHeigth:l,deviceFixedHeight:g,frameBorderRadius:w,frameTransition:M}=h,v=`${l}px`,S=t.events,E="core:preview",W=`${s.events.stopCommand}${E}`,D=t.getConfig(),P=`${O}:disable`,z=o.getAll().map(n=>({...n.attributes})),F=d*1e3,x={x:r,y:m};let b={},H,C;D.scrollableCanvas=!g,o.getAll().map(n=>{!n.get("width")&&n.set("width",`${a}px`),!n.get("height")&&n.set("height",g?"100vh":"auto"),!n.get("minHeight")&&n.set("minHeight",v)});const L=n=>{const u=`${N}canvas-full-size`,p=document.querySelector(`style[${u}]`);if(n&&p)return p.remove();const f=p||document.createElement("style"),T=t.getZoomMultiplier();f.setAttribute(u,"true"),f.innerHTML=`
2
- .gjs-frame-wrapper { transition: width ${M}s !important; }
3
- .gjs-frame-wrapper__bottom { height: ${m*T}px }
4
- .gjs-frame { border-radius: ${w}px }
5
- `,!p&&document.body.appendChild(f)};e.on(S.frameLoadHead,n=>{if(!D.scrollableCanvas)return;const{window:u}=n,p=u.document,f=p.head,T=`${N}canvas-full-size-wrappers`,A=f.querySelector(`style[${T}]`)||p.createElement("style");A.setAttribute(T,"true"),A.innerHTML=`
1
+ "use strict";function Y(t,i,e){let a,s,r,m,c;const d=i;function l(){const o=Date.now()-m;o<d&&o>=0?a=setTimeout(l,d-o):(a=null,c=t.apply(r,s),r=s=null)}const h=function(){return r=this,s=arguments,m=Date.now(),a||(a=setTimeout(l,d)),c};return h.clear=function(){a&&(clearTimeout(a),a=null)},h.flush=function(){a&&(c=t.apply(r,s),r=s=null,clearTimeout(a),a=null)},h}const L="app.grapesjs.com",F="app-stage.grapesjs.com",k="app2.grapesjs.com",J="app-stage2.grapesjs.com",O=[L,k,F,J,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Q="license:check:start",tt="license:check:end",et=()=>typeof window<"u",nt=({isDev:t,isStage:i,isPlatform:e})=>`${t?"":`https://${i?F:L}`}/${e?"platform-api":"api"}`,st=()=>{const t=et()&&window.location.hostname;return!!t&&(O.includes(t)||O.some(i=>t.endsWith(i)))};async function ot({path:t,baseApiUrl:i,method:e="GET",headers:a={},params:s,body:r}){const c=`${i||nt({isDev:!1,isStage:!1})}${t}`,d={method:e,headers:{"Content-Type":"application/json",...a}};r&&(d.body=JSON.stringify(r));const l=s?new URLSearchParams(s).toString():"",h=l?`?${l}`:"",o=await fetch(`${c}${h}`,d);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}var v=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(v||{});const U={[v.free]:0,[v.startup]:10,[v.business]:20,[v.enterprise]:30};function at(t){const i=t;return i.init=e=>a=>t(a,e),i}const it=t=>at(t);async function rt({editor:t,plan:i,pluginName:e,licenseKey:a,onLicenseCheckResponse:s,cleanup:r}){let m="",c=!1;const d=st(),l=o=>{console.warn("Cleanup plugin:",e,"Reason:",o),r()},h=(o={})=>{var b;const{error:g,sdkLicense:E}=o,w=(b=o.plan)==null?void 0:b.category;if(!(E||o.license)||g)l(g||"Invalid license");else if(w){const T=U[i],x=U[w];T>x&&l({pluginRequiredPlan:i,licensePlan:w})}};t.on(Q,o=>{m=o==null?void 0:o.baseApiUrl,c=!0}),t.on(tt,o=>{s==null||s(o),h(o)}),setTimeout(async()=>{if(!c){if(d)return;if(a){const o=await ct({licenseKey:a,pluginName:e,baseApiUrl:m});s==null||s(o),o&&h(o)}else l("The `licenseKey` option not provided")}},2e3)}async function ct(t){const{licenseKey:i,pluginName:e,baseApiUrl:a}=t;try{return(await ot({baseApiUrl:a,path:`/sdk/${i||"na"}`,method:"POST",params:{d:window.location.hostname,pn:e}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const W="data-gs-plg-",z="canvasFullSize",lt=v.startup,ut=(t,i)=>{const{rule:e,ruleView:a}=i,{style:s}=e.attributes;if(s&&s[t]){const r=s[t],m=/([0-9.]+)(vh|dvh|lvh|svh)/g,c=m.test(r),d=a.frameView.model;if(c&&d.hasAutoHeight()){const l=r.replace(m,(o,g)=>`${window.innerHeight*(parseFloat(g)/100)}px`),h=e.toCSS({style:{...s,[t]:l}});i.css=h}}},pt=t=>{["height","min-height","max-height"].forEach(i=>ut(i,t))},mt=function(t,i={}){const{Canvas:e,Commands:a,Devices:s,Css:r}=t,m={deviceMaxWidth:1200,deviceMinHeigth:500,canvasOffsetY:30,canvasOffsetX:50,canvasTransition:.3,frameBorderRadius:5,frameTransition:.3,...i},{canvasOffsetY:c,canvasOffsetX:d,canvasTransition:l,deviceMaxWidth:h,deviceMinHeigth:o,deviceFixedHeight:g,frameBorderRadius:E,frameTransition:w}=m,y=`${o}px`,b=e.events,T="core:preview",x=`${a.events.stopCommand}${T}`,H=e.getConfig(),_=`${z}:disable`,K=s.getAll().map(n=>({...n.attributes})),G=l*1e3,M={x:d,y:c};let S={},P,$;H.scrollableCanvas=!g,s.getAll().map(n=>{!n.get("width")&&n.set("width",`${h}px`),!n.get("height")&&n.set("height",g?"100vh":"auto"),!n.get("minHeight")&&n.set("minHeight",y)});const V=n=>{const u=`${W}canvas-full-size`,p=document.querySelector(`style[${u}]`);if(n&&p)return p.remove();const f=p||document.createElement("style"),D=e.getZoomMultiplier();f.setAttribute(u,"true"),f.innerHTML=`
2
+ .gjs-frame-wrapper { transition: width ${w}s !important; }
3
+ .gjs-frame-wrapper__bottom { height: ${c*D}px }
4
+ .gjs-frame { border-radius: ${E}px }
5
+ `,!p&&document.body.appendChild(f)};t.on(b.frameLoadHead,n=>{if(!H.scrollableCanvas)return;const{window:u}=n,p=u.document,f=p.head,D=`${W}canvas-full-size-wrappers`,C=f.querySelector(`style[${D}]`)||p.createElement("style");C.setAttribute(D,"true"),C.innerHTML=`
6
6
  body { height: auto !important; }
7
- [data-gjs-type="wrapper"] { min-height: ${v} !important; }
8
- [data-gjs-type="mjml"] { min-height: ${v} !important; }
9
- [data-gjs-type="mj-body"] { min-height: ${v} !important; }
10
- `,!f.contains(A)&&f.appendChild(A)});const R=()=>H.style.display="none",K=()=>H.style.display="",G=()=>{var f;if(!g)return;const n=t.getZoomMultiplier(),p=t.getRect().height*n-m*2;(f=o.getSelected())==null||f.set("height",`${Math.max(p,l)}px`),t.fitViewport({zoom:t.getZoom(),gap:x})},$=X(()=>{t.fitViewport({zoom:n=>n>100?100:n,ignoreHeight:!0,gap:x}),G(),L(),setTimeout(()=>{var u,p;const{em:n}=e;n.destroyed||((p=(u=e.getSelected())==null?void 0:u.getEl())==null||p.scrollIntoView({block:"nearest"}),e.refresh({tools:!0}),K(),s.isActive(E)?n.stopDefault():n.runDefault())},F)},100),Z=(n={})=>{n.options&&n.options.from!=="fitViewport"&&t.fitViewport({zoom:t.getZoom(),ignoreHeight:!0,gap:x})},q=()=>{R(),$()},B=()=>{b.overflowX="hidden",b.overflowY="auto"},V=()=>{C==null||C.disconnect(),$.clear()},_=[[o.events.select,q],[S.zoom,Z],[W,B],[e.events.destroy,V],[c.events.mountBefore,pe]];s.add(P,()=>{o.devices.reset(z),D.scrollableCanvas=!1,t.getModel().updateDevice(),t.setZoom(100),t.setCoords(0,0),b.overflowY="hidden",L(!0),_.forEach(([n,u])=>e.off(n,u)),V(),s.run("studio:canvasReload")}),_.forEach(([n,u])=>e.on(n,u)),e.onReady(()=>{const n=t.getElement(),u=t.getFramesEl(),p=t.getCanvasView();H=t.getSpotsEl(),b=n.style,b.overflowX="hidden",u.style.transition=`transform ${d}s`,document.removeEventListener("keypress",p.onKeyPress),L(),C=new ResizeObserver(()=>{R(),$()}),C.observe(n.parentElement),$()}),ce({editor:e,licenseKey:h.licenseKey,plan:le,pluginName:O,cleanup:()=>{e.runCommand(P)}})},de=ie(me);module.exports=de;
7
+ [data-gjs-type="wrapper"] { min-height: ${y} !important; }
8
+ [data-gjs-type="mjml"] { min-height: ${y} !important; }
9
+ [data-gjs-type="mj-body"] { min-height: ${y} !important; }
10
+ `,!f.contains(C)&&f.appendChild(C)});const j=()=>P.style.display="none",R=()=>P.style.display="",Z=()=>{var f;if(!g)return;const n=e.getZoomMultiplier(),p=e.getRect().height*n-c*2;(f=s.getSelected())==null||f.set("height",`${Math.max(p,o)}px`),e.fitViewport({zoom:e.getZoom(),gap:M})},A=Y(()=>{e.fitViewport({zoom:n=>n>100?100:n,ignoreHeight:!0,gap:M}),Z(),V(),setTimeout(()=>{var u,p;const{em:n}=t;n.destroyed||((p=(u=t.getSelected())==null?void 0:u.getEl())==null||p.scrollIntoView({block:"nearest"}),t.refresh({tools:!0}),R(),a.isActive(T)?n.stopDefault():n.runDefault())},G)},100),q=(n={})=>{n.options&&n.options.from!=="fitViewport"&&e.fitViewport({zoom:e.getZoom(),ignoreHeight:!0,gap:M})},B=()=>{j(),A()},X=()=>{S.overflowX="hidden",S.overflowY="auto"},I=()=>{$==null||$.disconnect(),A.clear()},N=[[s.events.select,B],[b.zoom,q],[x,X],[t.events.destroy,I],[r.events.mountBefore,pt]];a.add(_,()=>{s.devices.reset(K),H.scrollableCanvas=!1,e.getModel().updateDevice(),e.setZoom(100),e.setCoords(0,0),S.overflowY="hidden",V(!0),N.forEach(([n,u])=>t.off(n,u)),I(),a.run("studio:canvasReload")}),N.forEach(([n,u])=>t.on(n,u)),t.onReady(()=>{const n=e.getElement(),u=e.getFramesEl(),p=e.getCanvasView();P=e.getSpotsEl(),S=n.style,S.overflowX="hidden",u.style.transition=`transform ${l}s`,document.removeEventListener("keypress",p.onKeyPress),V(),$=new ResizeObserver(()=>{j(),A()}),$.observe(n.parentElement),A()}),rt({editor:t,licenseKey:m.licenseKey,plan:lt,pluginName:z,cleanup:()=>{t.runCommand(_)}})},dt=it(mt);module.exports=dt;