@grapesjs/studio-sdk-plugins 1.0.38 → 1.0.39-rc.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 (158) hide show
  1. package/dist/accordionComponent/index.cjs.js +5 -5
  2. package/dist/accordionComponent/index.es.js +70 -67
  3. package/dist/accordionComponent/index.js +39 -0
  4. package/dist/accordionComponent/index.umd.js +4 -4
  5. package/dist/aiChat/components/AiChatHeader.d.ts +4 -5
  6. package/dist/aiChat/components/AiChatInput/index.d.ts +4 -5
  7. package/dist/aiChat/components/AiChatMessage.d.ts +7 -8
  8. package/dist/aiChat/components/index.d.ts +1 -1
  9. package/dist/aiChat/components/utils.d.ts +1 -1
  10. package/dist/aiChat/index.cjs.js +10 -376
  11. package/dist/aiChat/index.es.js +4569 -28851
  12. package/dist/aiChat/index.js +10 -376
  13. package/dist/aiChat/index.umd.js +11 -377
  14. package/dist/aiChat/server/index.cjs.d.ts +0 -1
  15. package/dist/aiChat/server/index.cjs.js +45 -45
  16. package/dist/aiChat/server/index.d.ts +0 -1
  17. package/dist/aiChat/server/index.es.d.ts +0 -1
  18. package/dist/aiChat/server/index.es.js +371 -427
  19. package/dist/aiChat/server/index.js +45 -45
  20. package/dist/aiChat/server/index.umd.js +41 -41
  21. package/dist/aiChat/server/stream.test.d.ts +1 -0
  22. package/dist/aiChat/types.d.ts +18 -4
  23. package/dist/aiChat/typesSchema.d.ts +13 -0
  24. package/dist/animationComponent/index.cjs.js +3 -3
  25. package/dist/animationComponent/index.es.js +49 -46
  26. package/dist/animationComponent/index.js +519 -0
  27. package/dist/animationComponent/index.umd.js +3 -3
  28. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  29. package/dist/canvasAbsoluteMode/index.es.js +115 -112
  30. package/dist/canvasAbsoluteMode/index.js +1 -0
  31. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  32. package/dist/canvasEmptyState/index.cjs.js +1 -1
  33. package/dist/canvasEmptyState/index.es.js +71 -68
  34. package/dist/canvasEmptyState/index.js +1 -0
  35. package/dist/canvasEmptyState/index.umd.js +1 -1
  36. package/dist/canvasFullSize/index.cjs.js +3 -3
  37. package/dist/canvasFullSize/index.es.js +69 -66
  38. package/dist/canvasFullSize/index.js +10 -0
  39. package/dist/canvasFullSize/index.umd.js +4 -4
  40. package/dist/canvasGridMode/index.cjs.js +7 -7
  41. package/dist/canvasGridMode/index.es.js +142 -139
  42. package/dist/canvasGridMode/index.js +26 -0
  43. package/dist/canvasGridMode/index.umd.js +7 -7
  44. package/dist/canvasScreenshot/index.cjs.js +1 -1
  45. package/dist/canvasScreenshot/index.es.js +78 -75
  46. package/dist/canvasScreenshot/index.js +1 -0
  47. package/dist/canvasScreenshot/index.umd.js +1 -1
  48. package/dist/dataSourceEjs/EjsExporter.d.ts +1 -1
  49. package/dist/dataSourceEjs/index.cjs.js +3 -3
  50. package/dist/dataSourceEjs/index.es.js +40 -37
  51. package/dist/dataSourceEjs/index.js +21 -0
  52. package/dist/dataSourceEjs/index.umd.js +3 -3
  53. package/dist/dataSourceHandlebars/HandlebarsExporter.d.ts +2 -2
  54. package/dist/dataSourceHandlebars/constants.d.ts +1 -1
  55. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  56. package/dist/dataSourceHandlebars/index.es.js +58 -55
  57. package/dist/dataSourceHandlebars/index.js +10 -0
  58. package/dist/dataSourceHandlebars/index.umd.js +2 -2
  59. package/dist/dialogComponent/index.cjs.js +11 -11
  60. package/dist/dialogComponent/index.es.js +72 -69
  61. package/dist/dialogComponent/index.js +59 -0
  62. package/dist/dialogComponent/index.umd.js +11 -11
  63. package/dist/flexComponent/index.cjs.js +6 -6
  64. package/dist/flexComponent/index.es.js +151 -142
  65. package/dist/flexComponent/index.js +33 -0
  66. package/dist/flexComponent/index.umd.js +8 -8
  67. package/dist/flexComponent/typesSchema.d.ts +1 -1
  68. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  69. package/dist/fsLightboxComponent/index.es.js +93 -90
  70. package/dist/fsLightboxComponent/index.js +6 -0
  71. package/dist/fsLightboxComponent/index.umd.js +3 -3
  72. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  73. package/dist/googleFontsAssetProvider/index.es.js +112 -109
  74. package/dist/googleFontsAssetProvider/index.js +1 -0
  75. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  76. package/dist/googleFontsAssetProvider/utils.d.ts +1 -1
  77. package/dist/iconifyComponent/index.cjs.js +2 -2
  78. package/dist/iconifyComponent/index.es.js +80 -77
  79. package/dist/iconifyComponent/index.js +3 -0
  80. package/dist/iconifyComponent/index.umd.js +2 -2
  81. package/dist/index.cjs.d.ts +1 -0
  82. package/dist/index.cjs.js +970 -82
  83. package/dist/index.d.ts +1 -0
  84. package/dist/index.es.d.ts +1 -0
  85. package/dist/index.es.js +7422 -6145
  86. package/dist/index.umd.js +975 -87
  87. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  88. package/dist/layoutSidebarButtons/index.es.js +95 -92
  89. package/dist/layoutSidebarButtons/index.js +1 -0
  90. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  91. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  92. package/dist/lightGalleryComponent/index.es.js +164 -161
  93. package/dist/lightGalleryComponent/index.js +1 -0
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/lightGalleryComponent/utils.d.ts +1 -1
  96. package/dist/linkImageComponent/index.cjs.js +2 -2
  97. package/dist/linkImageComponent/index.es.js +60 -57
  98. package/dist/linkImageComponent/index.js +12 -0
  99. package/dist/linkImageComponent/index.umd.js +2 -2
  100. package/dist/listPagesComponent/index.cjs.js +4 -4
  101. package/dist/listPagesComponent/index.es.js +57 -54
  102. package/dist/listPagesComponent/index.js +11 -0
  103. package/dist/listPagesComponent/index.umd.js +4 -4
  104. package/dist/listPagesComponent/utils.d.ts +1 -1
  105. package/dist/presetBlockLibrary/blocks.d.ts +6 -0
  106. package/dist/presetBlockLibrary/blocks.test.d.ts +2 -0
  107. package/dist/presetBlockLibrary/emailBlocks.d.ts +53 -0
  108. package/dist/presetBlockLibrary/index.cjs.d.ts +3 -0
  109. package/dist/presetBlockLibrary/index.cjs.js +889 -0
  110. package/dist/presetBlockLibrary/index.d.ts +3 -0
  111. package/dist/presetBlockLibrary/index.es.d.ts +3 -0
  112. package/dist/presetBlockLibrary/index.es.js +1408 -0
  113. package/dist/presetBlockLibrary/index.js +889 -0
  114. package/dist/presetBlockLibrary/index.test.d.ts +1 -0
  115. package/dist/presetBlockLibrary/index.umd.js +889 -0
  116. package/dist/presetBlockLibrary/shared.d.ts +3 -0
  117. package/dist/presetBlockLibrary/types.d.ts +24 -0
  118. package/dist/presetBlockLibrary/typesSchema.d.ts +47 -0
  119. package/dist/presetPrintable/index.cjs.js +3 -3
  120. package/dist/presetPrintable/index.es.js +133 -130
  121. package/dist/presetPrintable/index.js +32 -0
  122. package/dist/presetPrintable/index.umd.js +4 -4
  123. package/dist/prosemirror/index.cjs.js +8 -8
  124. package/dist/prosemirror/index.es.js +552 -549
  125. package/dist/prosemirror/index.js +10 -0
  126. package/dist/prosemirror/index.umd.js +9 -9
  127. package/dist/prosemirror/toolbar.d.ts +2 -2
  128. package/dist/prosemirror/types.d.ts +5 -5
  129. package/dist/rendererReact/index.cjs.js +1 -1
  130. package/dist/rendererReact/index.es.js +137 -134
  131. package/dist/rendererReact/index.js +1 -1
  132. package/dist/rendererReact/index.umd.js +1 -1
  133. package/dist/rteTinyMce/index.cjs.js +2 -2
  134. package/dist/rteTinyMce/index.es.js +74 -71
  135. package/dist/rteTinyMce/index.js +104 -0
  136. package/dist/rteTinyMce/index.umd.js +2 -2
  137. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  138. package/dist/shapeDividerComponent/index.es.js +91 -88
  139. package/dist/shapeDividerComponent/index.js +97 -0
  140. package/dist/shapeDividerComponent/index.umd.js +4 -4
  141. package/dist/swiperComponent/index.cjs.js +7 -7
  142. package/dist/swiperComponent/index.es.js +95 -92
  143. package/dist/swiperComponent/index.js +45 -0
  144. package/dist/swiperComponent/index.umd.js +5 -5
  145. package/dist/tableComponent/index.cjs.js +1 -1
  146. package/dist/tableComponent/index.es.js +181 -178
  147. package/dist/tableComponent/index.js +1 -0
  148. package/dist/tableComponent/index.umd.js +1 -1
  149. package/dist/tableComponent/types.d.ts +3 -3
  150. package/dist/types.d.ts +14 -14
  151. package/dist/utils.d.ts +3 -2
  152. package/dist/utilsDataSources.d.ts +1 -1
  153. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  154. package/dist/youtubeAssetProvider/index.es.js +90 -87
  155. package/dist/youtubeAssetProvider/index.js +1 -0
  156. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  157. package/package.json +182 -34
  158. package/dist/aiChat/server/models.d.ts +0 -15
@@ -0,0 +1,33 @@
1
+ "use strict";const ue="app.grapesjs.com",de="app-stage.grapesjs.com",me="app2.grapesjs.com",ze="app-stage2.grapesjs.com",ae=[ue,me,de,ze,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],Se="license:check:end",xe=()=>typeof window<"u",ve=({isDev:t,isStage:e,isPlatform:s})=>`${t?"":`https://${e?de:ue}`}/${s?"platform-api":"api"}`,we=()=>{if(!xe())return"";const{hostname:t}=window.location;if(t)return t;try{return window.parent.location.hostname||""}catch{return""}},Re=()=>{const t=we();return!!t&&(ae.includes(t)||ae.some(e=>t.endsWith(e)))};function Ge(t){return typeof t=="function"}async function Ce({path:t,baseApiUrl:e,method:s="GET",headers:n={},params:a,body:i}){const c=`${e||ve({isDev:!1,isStage:!1})}${t}`,l={method:s,headers:{"Content-Type":"application/json",...n}};i&&(l.body=JSON.stringify(i));const g=a?new URLSearchParams(a).toString():"",f=g?`?${g}`:"",r=await fetch(`${c}${f}`,l);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var L=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(L||{}),W=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.dialogImportCode="studio:dialogImportCode",t.openEditCode="studio:openEditCode",t.openBlocks="studio:openBlocks",t.appendComponent="studio:appendComponent",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.settings="studio:settings",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(W||{}),ge=(t=>(t.web="web",t.email="email",t.document="document",t.react="react",t))(ge||{});const ie={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function Ie(t,e){const s=t;return s.init=n=>{const a=i=>t(i,n);return a.__gjsPluginId=e,a},s}const Te=(t,e)=>Ie(t,e);async function Ee({editor:t,plan:e,pluginName:s,licenseKey:n,onLicenseCheckResponse:a,cleanup:i}){let o="",c;const l=r=>{console.warn("Cleanup plugin:",s,"Reason:",r),i(t,s)},g=(r={})=>{var v;const{error:h,sdkLicense:I}=r,b=(v=r.plan)==null?void 0:v.category;if(!(I||r.license)||h)l(h||"Invalid license");else if(b){const G=ie[e],m=ie[b];G>m&&l({pluginRequiredPlan:e,licensePlan:b})}};t.Commands.has(W.settings)&&(c=t.runCommand(W.settings),o=(c==null?void 0:c.baseUrl)||"");const f=r=>{a==null||a(r),r&&g(r)};if(!c){t.onReady(async()=>{if(!Re())if(n){const r=await Le({licenseKey:n,pluginName:s,baseApiUrl:o});f(r)}else l("The `licenseKey` option not provided")});return}if(c.licensePlan||c.licenseError){const r=Ae(c);f(r);return}t.on(Se,r=>f(r))}const Ae=t=>({sdkLicense:t.license,license:t.license,error:t.licenseError,plan:t.licensePlan});async function Le(t){const{licenseKey:e,pluginName:s,baseApiUrl:n}=t;try{return(await Ce({baseApiUrl:n,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const he=t=>e=>{var s;return((s=e.getAttribute)==null?void 0:s.call(e,se))===t},Me=(...t)=>e=>t.some(s=>e.is(s)),$e=(...t)=>(e,s)=>t.some(n=>s.is(n)),fe="gjs-plg-",se="data-type-role",D=class D{constructor(e){this.config=e}getSize(e){var s;return(s=this.config)!=null&&s.getSize?this.config.getSize(e):ne(e.componentColumn,D.CSS_FLEX_BASIS)}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:a,partial:i}=e;n.addStyle({[D.CSS_FLEX_BASIS]:a},{partial:i})}}};D.CSS_FLEX_BASIS="flex-basis";let K=D;const j=class j{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var s;return(s=this.config)!=null&&s.getGap?this.config.getGap(e):ne(e.componentRow,j.CSS_GAP)}setGap(e){var s;if((s=this.config)!=null&&s.setGap)this.config.setGap(e);else{const{componentRow:n,gapValue:a,partial:i}=e;n.addStyle({[j.CSS_GAP]:a},{partial:i})}}};j.CSS_GAP="gap";let J=j;const U=class U{constructor(e){this.config=e}getParentSize(e){var i;if((i=this.config)!=null&&i.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,a=s.getEl();return a?n?a.clientHeight:a.clientWidth:0}isLayoutVertical(e){var n;if((n=this.config)!=null&&n.isParentVertical)return this.config.isParentVertical(e);const s=ne(e.componentRow,U.CSS_FLEX_DIRECTION,!0);return s==="column"||s==="column-reverse"}};U.CSS_FLEX_DIRECTION="flex-direction";let q=U;const B=class B{constructor(e){this.config=e}getSize(e){var n;if((n=this.config)!=null&&n.getSize)return this.config.getSize(e);const s=e.componentColumn;if(s.is(B.MJML_COLUMN_TYPE)){const i=s.getAttributes().width;if(i&&(i.includes("%")||!isNaN(parseFloat(i))))return parseFloat(i);const o=s.parent();return 100/(o?o.components().length:1)}return 0}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:a,partial:i}=e;n.is(B.MJML_COLUMN_TYPE)&&n.addAttributes({width:`${parseFloat(a)}%`},{partial:i})}}};B.MJML_COLUMN_TYPE="mj-column";let Z=B;const X=class X{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var n;if((n=this.config)!=null&&n.getGap)return this.config.getGap(e);const{componentRow:s}=e;if(s.is(X.MJML_SECTION_TYPE)){const a=s.getAttributes();if(a&&a.padding)return parseInt(a.padding,10)||0}return 0}setGap(e){var s,n;(n=(s=this.config)==null?void 0:s.setGap)==null||n.call(s,e)}};X.MJML_SECTION_TYPE="mj-section";let Q=X;class He{constructor(e){this.config=e}getParentSize(e){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,a=s.getEl();if(!a)return 0;let i=a;if(a.tagName!=="TABLE"){const c=a.querySelectorAll("table");c.length&&(i=c[0])}return n?i.clientHeight:i.clientWidth}isLayoutVertical(e){var s;return(s=this.config)!=null&&s.isParentVertical?this.config.isParentVertical(e):!1}}class M{constructor(){this.handlerCache=new Map}static getInstance(){return M.instance||(M.instance=new M),M.instance}getHandlers(e){const s=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(s)||($(e)?this.handlerCache.set(s,{sizeHandler:new Z(e),gapHandler:new Q(e),parentSizeHandler:new He(e)}):this.handlerCache.set(s,{sizeHandler:new K(e),gapHandler:new J(e),parentSizeHandler:new q(e)})),this.handlerCache.get(s)}}function T(t){return M.getInstance().getHandlers(t)}const oe=t=>{t.style.display="none"},re=t=>{t.style.display="block"},H=t=>+parseFloat(`${t}`).toFixed(2),$=t=>t.projectType===ge.email,Ve=t=>t?["top","bottom"]:["left","right"],De=t=>{const e=t.parent();return e?e.components().models.indexOf(t)===0:!1},je=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.indexOf(t)===s.length-1},Be=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.length>1&&t.index()===s.length-1},Ne=(t,e,s,n)=>{const i=t+(s?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return i>=0&&i<n?i:-1},O=t=>t==="top"||t==="bottom",_e=(t,e)=>!!(De(t)&&(e==="left"||e==="top")||je(t)&&(e==="right"||e==="bottom")),Fe=t=>{const e=t.parent();return e?e.components().models.length>1:!1},le=(t,e)=>t==="right"||t==="bottom"?e>0:e<0,ne=(t,e,s=!1)=>{const n=!s,a=n?0:"",i=t.getEl();let o;try{o=i?window.getComputedStyle(i):void 0}catch{o=void 0}if(!o)return a;const c=o[e]||"";if(n){let l;return typeof c=="string"?(l=parseFloat(c.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(c)||0,l}return c},ce=(t,e,s)=>{const n=ee({componentRow:t,isVertical:e},s),a=t.components().models;return n*(a.length-1)},N=(t,e)=>T(e).parentSizeHandler.isLayoutVertical({componentRow:t}),_=(t,e)=>T(e).sizeHandler.getSize(t),ee=(t,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:s,parentSizeHandler:n}=T(e);if(!s.isGapSupported())return 0;const a=s.getGap(t),i=n.getParentSize(t);return a/100*i},te=(t,e)=>T(e).parentSizeHandler.getParentSize(t),V=(t,e)=>{T(e).sizeHandler.setSize(t)},ye=(t,e)=>{const s=_(t,e);V({...t,sizeValue:`${s}%`,partial:!1},e)},be=(t,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:s}=T(e);s.isGapSupported()&&s.setGap(t)},Oe=(t,e)=>{const s=t.getStyle().gap;if(!s)return;const n=t.components().models,a={componentRow:t,isVertical:N(t,e)};n.map(i=>ye({...a,componentColumn:i},e)),be({...a,gapValue:String(s),partial:!1},e)};function ke(t,e){const{Blocks:s}=t,{typeColumn:n,typeRow:a,blocks:i}=e;if(i===!1||$(e))return;const o=r=>({type:a,components:r.map(h=>({type:n,style:{"flex-basis":`${h}%`}}))}),c=r=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
2
+ ${r.map(h=>`<div style="flex-basis: ${h}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
3
+ </div>`,l=(r,h)=>({id:`flex-row-${h.join("-")}`,label:r,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:c(h),content:o(h)}),g=[l("1 Column",[100]),l("2 Columns 50/50",[50,50]),l("2 Columns 25/75",[25,75]),l("2 Columns 75/25",[75,25]),l("3 Columns",[33.33,33.33,33.33]),l("3 Columns 50/25/25",[50,25,25]),l("3 Columns 25/50/25",[25,50,25]),l("3 Columns 25/25/50",[25,25,50]),l("4 Columns",[25,25,25,25]),l("5 Columns",[20,20,20,20,20])],f=Ge(i)?i({blocks:g}):g;return f.forEach(r=>s.add(r.id,r)),()=>{f.forEach(r=>s.remove(r.id))}}const Ue=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:a,extendTypeColumn:i}=e,o=`${fe}${a}`,l=!!a&&!!s.getType(a)&&!i;if(!(!a||l||$(e)))return s.addType(a,{isComponent:he(a),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:$e(n),attributes:{[se]:a},styles:`
4
+ .${o} {
5
+ flex-grow: 1;
6
+ }
7
+ `}}}),()=>{s.removeType(a)}},Xe=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:a,extendTypeRow:i}=e,o=`${fe}${n}`,l=!!n&&!!s.getType(n)&&!i;if(!(!n||l||$(e)))return s.addType(n,{isComponent:he(n),model:{defaults:{name:"Row",classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[se]:n},droppable:Me(a),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:e.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:e.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
8
+ .${o} {
9
+ display: flex;
10
+ align-items: stretch;
11
+ flex-wrap: nowrap;
12
+ }
13
+ `}}}),()=>{s.removeType(n)}},Pe="flexComponent",Ye=L.startup;class We{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(e){this.resizableChildTypes.add(e)}registerGapAdjustableParent(e){this.gapAdjustableParentTypes.add(e)}registerTypeRelationship(e,s){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(s),this.registerResizableChild(s),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,s){const n=e.get("type"),a=s.get("type");return this.typeRelationships.has(n)?this.typeRelationships.get(n).has(a):!1}}class Ke{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeState=new WeakMap}getState(e){return this.resizeState.has(e)||this.resizeState.set(e,{}),this.resizeState.get(e)}clearState(e){return this.resizeState.delete(e)}startResize(e,s,n){const{opts:a}=this,i=this.getState(e);i.direction=s,i.startX=n.clientX,i.startY=n.clientY,i.resizing=!0,i.lastSnappedPercent=void 0;const o=e.parent();if(!o||!this.registry.isValidRelationship(o,e))return;i.snapEnabled=o.get("snap")??a.snapEnabled,i.snapDivisions=o.get("snap-divisions")??a.snapDivisions??12;const c=o.components().models,l=c.findIndex(h=>h.cid===e.cid),g=N(o,a),f=Ne(l,s,g,c.length);f!==-1&&(i.adjacentIdx=f);const r={componentColumn:e,componentRow:o,isVertical:g};if(i.startPercent=_(r,a),typeof i.adjacentIdx<"u"){const h=c[i.adjacentIdx];i.neighborStartPercent=_({...r,componentColumn:h},a)}}updateResizeByDelta(e,s,n){const a=this.getState(e),i=e.parent();!a.resizing||!i||(a.snapEnabled?this.updateSnapResize(e,s,n):this.updateContinuesResize(e,s,n))}finishResize(e){const s=e.parent(),n=s==null?void 0:s.components().models,a={componentRow:s,isVertical:!!s&&N(s,this.opts)};n==null||n.forEach(i=>ye({...a,componentColumn:i},this.opts)),this.clearState(e)}updateContinuesResize(e,s,n){const a=this.getState(e),i=e.parent(),{opts:o}=this;if(!i)return;const c=o.minItemPercent??0,l=O(s),g=te({componentRow:i,isVertical:l},o),f=ce(i,l,this.opts),h=100-f/g*100,I=n/(g-f)*h,{startPercent:b=0,neighborStartPercent:x=0}=a,v={componentRow:i,isVertical:l,componentColumn:e,partial:!0},G=le(s,n)?b+Math.abs(I):b-Math.abs(I);if(typeof a.adjacentIdx<"u"){const m=i.components().models[a.adjacentIdx],w=b+x,z=w-c,p=Math.min(z,Math.max(c,G)),u=w-p;V({...v,sizeValue:`${H(p)}%`},o),V({...v,componentColumn:m,sizeValue:`${H(u)}%`},o)}else{const m=Math.max(c,Math.min(h,G));V({...v,sizeValue:`${H(m)}%`},o)}}updateSnapResize(e,s,n){const a=this.getState(e),i=e.parent(),o=O(s),c=te({componentRow:i,isVertical:o},this.opts),l=ce(i,o,this.opts),g=c-l,f=n/g*100,r=le(s,n),{startPercent:h=0,snapDivisions:I=12}=a,b=r?h+Math.abs(f):h-Math.abs(f),x=100/I,v=Math.floor(b/x)*x,G=Math.ceil(b/x)*x,m=Math.abs(G-b),w=Math.abs(b-v),z=x*.2,S=m<w?G:v;if(S>0&&S<100&&(m<z||w<z)&&a.lastSnappedPercent!==S){a.lastSnappedPercent=S;let y=Math.abs(S-h)/100*g;(r&&(s==="left"||s==="top")||!r&&(s==="right"||s==="bottom"))&&(y=-y),this.updateContinuesResize(e,s,y)}else m>=z&&w>=z&&(a.lastSnappedPercent=void 0)}}class Je{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n}updateGapByDelta(e,s,n,a){if(!this.registry.isGapAdjustableParent(e))return;const{opts:i}=this,o=Math.max(0,n+s),c=te({componentRow:e,isVertical:a},i),l=o/c*100,g=e.components().models,f=g.length-1,r={componentRow:e,isVertical:a},h=g.reduce((z,S)=>z+_({...r,componentColumn:S},i),0),b=100-l*f,x=i.minItemPercent||5;if(b<x*g.length)return;const G=100-f*l,m=h-G,w={componentRow:e,isVertical:a,partial:!0};g.map(z=>{const S=_({...r,componentColumn:z},i),p=S-S/h*m;V({...w,componentColumn:z,sizeValue:`${H(p)}%`},i)}),be({...w,gapValue:`${H(l)}%`},i)}finishGapAdjust(e){Oe(e,this.opts)}}class qe{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeHandler=new Ke(e,s,n),this.gapHandler=new Je(e,s,n)}startResize(e,s,n){this.resizeHandler.startResize(e,s,n)}updateResizeByDelta(e,s,n){this.resizeHandler.updateResizeByDelta(e,s,n)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,s,n,a){this.gapHandler.updateGapByDelta(e,s,n,a)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const s=e.parent();return s?this.registry.isValidRelationship(s,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const k="gs-flex-spots",pe=`${k}__handle-size`,Ze=`${k}__handle-gap`;function Qe(t,e){const{Canvas:s}=t,n="flex-resize-spot";let a,i,o,c,l=null,g=null;const f=new We,r=new qe(t,f,e),h=()=>{var p;a=document.createElement("div"),a.className=k,a.style.display="none",i=document.createElement("div"),i.className=`${k}__handles`,i.style.position="absolute",i.style.pointerEvents="none",i.style.zIndex="21",o={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(o).forEach(([u,y])=>{const P=u,d=O(P);y.className=`${pe} ${pe}-${P} gjs-resizer-h gjs-cv-unscale`,y.style.cssText=`
14
+ pointer-events: all;
15
+ position: absolute;
16
+ z-index: 1;
17
+ cursor: ${d?"ns-resize":"ew-resize"};
18
+ ${d?"left: 50%;":"top: 50%;"}
19
+ ${P==="left"?"left: 0px;":""}
20
+ ${P==="right"?"right: 0px;":""}
21
+ ${P==="top"?"top: 0px;":""}
22
+ ${P==="bottom"?"bottom: 0px;":""}
23
+ `,y.addEventListener("pointerdown",I(P)),i.appendChild(y)}),!e.disableGapHandler&&!$(e)&&(c=document.createElement("div"),c.className=Ze,c.style.cssText=`
24
+ position: absolute;
25
+ background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
26
+ border-width: 2px;
27
+ border-radius: 9999px;
28
+ border-color: #fff;
29
+ box-sizing: content-box;
30
+ pointer-events: all;
31
+ max-width: 3rem;
32
+ max-height: 3rem;
33
+ `,c.addEventListener("pointerdown",b()),i.appendChild(c)),a.append(i),(p=s.getSpotsEl())==null||p.appendChild(a)},I=p=>u=>{if(!l)return;u.stopPropagation(),u.preventDefault(),r.startResize(l,p,u);const y=u.clientX,P=u.clientY;u.target.setPointerCapture(u.pointerId);const d=E=>{const C=t.Canvas.getZoomMultiplier(),A=(E.clientX-y)*C,F=(E.clientY-P)*C,Y=O(p)?F:A;r.updateResizeByDelta(l,p,Y)},R=()=>{r.finishResize(l),u.target.releasePointerCapture(u.pointerId),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",R)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",R)},b=()=>p=>{if(!g)return;const u=g;p.stopPropagation(),p.preventDefault();const y=N(u,e),P=ee({componentRow:u,isVertical:y},e),d=p.clientX,R=p.clientY;p.target.setPointerCapture(p.pointerId);const E=A=>{const F=t.Canvas.getZoomMultiplier(),Y=y?(A.clientY-R)*F:(A.clientX-d)*F;r.updateGapByDelta(u,Y,P,y)},C=()=>{r.finishGapAdjust(u),p.target.releasePointerCapture(p.pointerId),document.removeEventListener("pointermove",E),document.removeEventListener("pointerup",C)};document.addEventListener("pointermove",E),document.addEventListener("pointerup",C)},x=p=>{const u=p.component;if(!u||!a||(l=u,g=u.parent(),!g))return;const y=g;re(a);const P=p.getStyle();i&&Object.assign(i.style,P);const d=N(y,e),R=Ve(d);if(Object.values(o).forEach(oe),R.forEach(C=>{if(_e(u,C))return;const A=o[C];re(A)}),T(e).gapHandler.isGapSupported()&&c&&Fe(u)){const C=ee({componentRow:y,isVertical:d},e);v(C,d,Be(u))}},v=(p,u,y=!1)=>{const P=e.gapHandleSize,d=c.style;if(u){d.height=`${P}px`;const R=c.offsetHeight;y?(d.top=`-${(p+R)/2}px`,d.bottom=""):(d.bottom=`-${(p+R)/2}px`,d.top=""),d.width="50%",d.left="50%",d.transform="translateX(-50%)",d.cursor="row-resize"}else{d.width=`${P}px`;const R=c.offsetWidth;y?(d.left=`-${(p+R)/2}px`,d.right=""):(d.right=`-${(p+R)/2}px`,d.left=""),d.height="50%",d.top="50%",d.transform="translateY(-50%)",d.cursor="col-resize"}},G=()=>{a&&(oe(a),l=null,g=null)},m=()=>{s.removeSpots({type:n});const p=t.getSelected(),u=p==null?void 0:p.parent();p&&u&&f.isValidRelationship(u,p)?s.addSpot({type:n,component:p}):G()},w=()=>{const p=s.getSpots().filter(u=>u.type===n)[0];p&&x(p)},z=(p,u)=>{f.registerTypeRelationship(p,u)};t.onReady(()=>{h(),$(e)?z("mj-section","mj-column"):z(e.typeRow,e.typeColumn)});const S="component:toggled";return t.on(s.events.spot,w),t.on(S,m),()=>{t.off(s.events.spot,w),t.off(S,m)}}const et=function(t,e={}){const s={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},n=[Xe(t,s),Ue(t,s)],a=Qe(t,s),i=ke(t,s);Ee({editor:t,licenseKey:s.licenseKey,plan:Ye,pluginName:Pe,cleanup:()=>{n.forEach(o=>o==null?void 0:o()),a(),i==null||i()}})},tt=Te(et,Pe);module.exports=tt;
@@ -1,16 +1,16 @@
1
- (function(E,A){typeof exports=="object"&&typeof module<"u"?module.exports=A():typeof define=="function"&&define.amd?define(A):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_flexComponent=A())})(this,function(){"use strict";const E="app.grapesjs.com",A="app-stage.grapesjs.com",oe=[E,"app2.grapesjs.com",A,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],Pe="license:check:end",me=()=>typeof window<"u",ze=({isDev:t,isStage:e,isPlatform:s})=>`${t?"":`https://${e?A:E}`}/${s?"platform-api":"api"}`,Se=()=>{if(!me())return"";const{hostname:t}=window.location;if(t)return t;try{return window.parent.location.hostname||""}catch{return""}},xe=()=>{const t=Se();return!!t&&(oe.includes(t)||oe.some(e=>t.endsWith(e)))};function ve(t){return typeof t=="function"}async function Re({path:t,baseApiUrl:e,method:s="GET",headers:n={},params:i,body:a}){const l=`${e||ze({isDev:!1,isStage:!1})}${t}`,p={method:s,headers:{"Content-Type":"application/json",...n}};a&&(p.body=JSON.stringify(a));const g=i?new URLSearchParams(i).toString():"",f=g?`?${g}`:"",r=await fetch(`${l}${f}`,p);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var L=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(L||{}),K=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.dialogImportCode="studio:dialogImportCode",t.openEditCode="studio:openEditCode",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.settings="studio:settings",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(K||{}),re=(t=>(t.web="web",t.email="email",t.document="document",t.react="react",t))(re||{});const le={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function we(t){const e=t;return e.init=s=>n=>t(n,s),e}const Ge=t=>we(t);async function Ce({editor:t,plan:e,pluginName:s,licenseKey:n,onLicenseCheckResponse:i,cleanup:a}){let o="",l;const p=r=>{console.warn("Cleanup plugin:",s,"Reason:",r),a()},g=(r={})=>{var v;const{error:h,sdkLicense:I}=r,b=(v=r.plan)==null?void 0:v.category;if(!(I||r.license)||h)p(h||"Invalid license");else if(b){const G=le[e],m=le[b];G>m&&p({pluginRequiredPlan:e,licensePlan:b})}};t.Commands.has(K.settings)&&(l=t.runCommand(K.settings),o=(l==null?void 0:l.baseUrl)||"");const f=r=>{i==null||i(r),r&&g(r)};if(!l){t.onReady(async()=>{if(!xe())if(n){const r=await Te({licenseKey:n,pluginName:s,baseApiUrl:o});f(r)}else p("The `licenseKey` option not provided")});return}if(l.licensePlan||l.licenseError){const r=Ie(l);f(r);return}t.on(Pe,r=>f(r))}const Ie=t=>({sdkLicense:t.license,license:t.license,error:t.licenseError,plan:t.licensePlan});async function Te(t){const{licenseKey:e,pluginName:s,baseApiUrl:n}=t;try{return(await Re({baseApiUrl:n,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const ce=t=>e=>{var s;return((s=e.getAttribute)==null?void 0:s.call(e,J))===t},Ee=(...t)=>e=>t.some(s=>e.is(s)),Ae=(...t)=>(e,s)=>t.some(n=>s.is(n)),pe="gjs-plg-",J="data-type-role",_=class _{constructor(e){this.config=e}getSize(e){var s;return(s=this.config)!=null&&s.getSize?this.config.getSize(e):se(e.componentColumn,_.CSS_FLEX_BASIS)}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:i,partial:a}=e;n.addStyle({[_.CSS_FLEX_BASIS]:i},{partial:a})}}};_.CSS_FLEX_BASIS="flex-basis";let q=_;const F=class F{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var s;return(s=this.config)!=null&&s.getGap?this.config.getGap(e):se(e.componentRow,F.CSS_GAP)}setGap(e){var s;if((s=this.config)!=null&&s.setGap)this.config.setGap(e);else{const{componentRow:n,gapValue:i,partial:a}=e;n.addStyle({[F.CSS_GAP]:i},{partial:a})}}};F.CSS_GAP="gap";let Z=F;const X=class X{constructor(e){this.config=e}getParentSize(e){var a;if((a=this.config)!=null&&a.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,i=s.getEl();return i?n?i.clientHeight:i.clientWidth:0}isLayoutVertical(e){var n;if((n=this.config)!=null&&n.isParentVertical)return this.config.isParentVertical(e);const s=se(e.componentRow,X.CSS_FLEX_DIRECTION,!0);return s==="column"||s==="column-reverse"}};X.CSS_FLEX_DIRECTION="flex-direction";let Q=X;const O=class O{constructor(e){this.config=e}getSize(e){var n;if((n=this.config)!=null&&n.getSize)return this.config.getSize(e);const s=e.componentColumn;if(s.is(O.MJML_COLUMN_TYPE)){const a=s.getAttributes().width;if(a&&(a.includes("%")||!isNaN(parseFloat(a))))return parseFloat(a);const o=s.parent();return 100/(o?o.components().length:1)}return 0}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:i,partial:a}=e;n.is(O.MJML_COLUMN_TYPE)&&n.addAttributes({width:`${parseFloat(i)}%`},{partial:a})}}};O.MJML_COLUMN_TYPE="mj-column";let ee=O;const Y=class Y{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var n;if((n=this.config)!=null&&n.getGap)return this.config.getGap(e);const{componentRow:s}=e;if(s.is(Y.MJML_SECTION_TYPE)){const i=s.getAttributes();if(i&&i.padding)return parseInt(i.padding,10)||0}return 0}setGap(e){var s,n;(n=(s=this.config)==null?void 0:s.setGap)==null||n.call(s,e)}};Y.MJML_SECTION_TYPE="mj-section";let te=Y;class Le{constructor(e){this.config=e}getParentSize(e){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,i=s.getEl();if(!i)return 0;let a=i;if(i.tagName!=="TABLE"){const l=i.querySelectorAll("table");l.length&&(a=l[0])}return n?a.clientHeight:a.clientWidth}isLayoutVertical(e){var s;return(s=this.config)!=null&&s.isParentVertical?this.config.isParentVertical(e):!1}}class M{constructor(){this.handlerCache=new Map}static getInstance(){return M.instance||(M.instance=new M),M.instance}getHandlers(e){const s=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(s)||($(e)?this.handlerCache.set(s,{sizeHandler:new ee(e),gapHandler:new te(e),parentSizeHandler:new Le(e)}):this.handlerCache.set(s,{sizeHandler:new q(e),gapHandler:new Z(e),parentSizeHandler:new Q(e)})),this.handlerCache.get(s)}}function T(t){return M.getInstance().getHandlers(t)}const ue=t=>{t.style.display="none"},de=t=>{t.style.display="block"},V=t=>+parseFloat(`${t}`).toFixed(2),$=t=>t.projectType===re.email,Me=t=>t?["top","bottom"]:["left","right"],$e=t=>{const e=t.parent();return e?e.components().models.indexOf(t)===0:!1},De=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.indexOf(t)===s.length-1},He=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.length>1&&t.index()===s.length-1},Ve=(t,e,s,n)=>{const a=t+(s?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return a>=0&&a<n?a:-1},k=t=>t==="top"||t==="bottom",Ne=(t,e)=>!!($e(t)&&(e==="left"||e==="top")||De(t)&&(e==="right"||e==="bottom")),je=t=>{const e=t.parent();return e?e.components().models.length>1:!1},ge=(t,e)=>t==="right"||t==="bottom"?e>0:e<0,se=(t,e,s=!1)=>{const n=!s,i=t.getEl();if(!i)return n?0:"";const o=window.getComputedStyle(i)[e]||"";if(n){let l;return typeof o=="string"?(l=parseFloat(o.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(o)||0,l}return o},he=(t,e,s)=>{const n=ne({componentRow:t,isVertical:e},s),i=t.components().models;return n*(i.length-1)},N=(t,e)=>T(e).parentSizeHandler.isLayoutVertical({componentRow:t}),j=(t,e)=>T(e).sizeHandler.getSize(t),ne=(t,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:s,parentSizeHandler:n}=T(e);if(!s.isGapSupported())return 0;const i=s.getGap(t),a=n.getParentSize(t);return i/100*a},ie=(t,e)=>T(e).parentSizeHandler.getParentSize(t),B=(t,e)=>{T(e).sizeHandler.setSize(t)},fe=(t,e)=>{const s=j(t,e);B({...t,sizeValue:`${s}%`,partial:!1},e)},ye=(t,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:s}=T(e);s.isGapSupported()&&s.setGap(t)},Be=(t,e)=>{const s=t.getStyle().gap;if(!s)return;const n=t.components().models,i={componentRow:t,isVertical:N(t,e)};n.map(a=>fe({...i,componentColumn:a},e)),ye({...i,gapValue:String(s),partial:!1},e)};function _e(t,e){const{Blocks:s}=t,{typeColumn:n,typeRow:i,blocks:a}=e;if(a===!1||$(e))return;const o=r=>({type:i,components:r.map(h=>({type:n,style:{"flex-basis":`${h}%`}}))}),l=r=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
1
+ (function(E,A){typeof exports=="object"&&typeof module<"u"?module.exports=A():typeof define=="function"&&define.amd?define(A):(E=typeof globalThis<"u"?globalThis:E||self,E.StudioSdkPlugins_flexComponent=A())})(this,function(){"use strict";const E="app.grapesjs.com",A="app-stage.grapesjs.com",ae=[E,"app2.grapesjs.com",A,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],me="license:check:end",ze=()=>typeof window<"u",Se=({isDev:t,isStage:e,isPlatform:s})=>`${t?"":`https://${e?A:E}`}/${s?"platform-api":"api"}`,xe=()=>{if(!ze())return"";const{hostname:t}=window.location;if(t)return t;try{return window.parent.location.hostname||""}catch{return""}},ve=()=>{const t=xe();return!!t&&(ae.includes(t)||ae.some(e=>t.endsWith(e)))};function Re(t){return typeof t=="function"}async function we({path:t,baseApiUrl:e,method:s="GET",headers:n={},params:i,body:o}){const c=`${e||Se({isDev:!1,isStage:!1})}${t}`,l={method:s,headers:{"Content-Type":"application/json",...n}};o&&(l.body=JSON.stringify(o));const g=i?new URLSearchParams(i).toString():"",f=g?`?${g}`:"",r=await fetch(`${c}${f}`,l);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var L=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(L||{}),K=(t=>(t.toastAdd="studio:toastAdd",t.toastRemove="studio:toastRemove",t.dialogOpen="studio:dialogOpen",t.dialogClose="studio:dialogClose",t.dialogExportCode="studio:dialogExportCode",t.dialogImportCode="studio:dialogImportCode",t.openEditCode="studio:openEditCode",t.openBlocks="studio:openBlocks",t.appendComponent="studio:appendComponent",t.sidebarLeftSet="studio:sidebarLeft:set",t.sidebarLeftGet="studio:sidebarLeft:get",t.sidebarLeftToggle="studio:sidebarLeft:toggle",t.sidebarRightSet="studio:sidebarRight:set",t.sidebarRightGet="studio:sidebarRight:get",t.sidebarRightToggle="studio:sidebarRight:toggle",t.sidebarTopSet="studio:sidebarTop:set",t.sidebarTopGet="studio:sidebarTop:get",t.sidebarTopToggle="studio:sidebarTop:toggle",t.sidebarBottomSet="studio:sidebarBottom:set",t.sidebarBottomGet="studio:sidebarBottom:get",t.sidebarBottomToggle="studio:sidebarBottom:toggle",t.symbolAdd="studio:symbolAdd",t.symbolDetach="studio:symbolDetach",t.symbolOverride="studio:symbolOverride",t.symbolPropagateStyles="studio:propagateStyles",t.getPagesConfig="studio:getPagesConfig",t.setPagesConfig="studio:setPagesConfig",t.getPageSettings="studio:getPageSettings",t.setPageSettings="studio:setPageSettings",t.clearPage="studio:clearPage",t.projectFiles="studio:projectFiles",t.validateCode="studio:validateCode",t.canvasReload="studio:canvasReload",t.getBlocksPanel="studio:getBlocksPanel",t.setBlocksPanel="studio:setBlocksPanel",t.getStateContextMenu="studio:getStateContextMenu",t.setStateContextMenu="studio:setStateContextMenu",t.contextMenuComponent="studio:contextMenuComponent",t.layoutAdd="studio:layoutAdd",t.layoutRemove="studio:layoutRemove",t.layoutToggle="studio:layoutToggle",t.layoutUpdate="studio:layoutUpdate",t.layoutGet="studio:layoutGet",t.layoutConfigGet="studio:layoutConfigGet",t.layoutConfigSet="studio:layoutConfigSet",t.layoutComponentAdd="studio:layoutComponentAdd",t.layoutComponentGet="studio:layoutComponentGet",t.layoutComponentRemove="studio:layoutComponentRemove",t.layoutComponentRender="studio:layoutComponentRender",t.getStateTheme="studio:getStateTheme",t.setStateTheme="studio:setStateTheme",t.settings="studio:settings",t.assetProviderGet="studio:assetProviderGet",t.assetProviderAdd="studio:assetProviderAdd",t.assetProviderRemove="studio:assetProviderRemove",t.fontGet="studio:fontGet",t.fontAdd="studio:fontAdd",t.fontRemove="studio:fontRemove",t.fontManagerOpen="studio:fontManagerOpen",t.menuFontLoad="studio:menuFontLoad",t.toggleStateDataSource="studio:toggleStateDataSource",t.getStateDataSource="studio:getStateDataSource",t.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",t.dataSourceSetImporter="studio:dataSourceSetImporter",t.dataSourceSetExporter="studio:dataSourceSetExporter",t.setDragAbsolute="studio:setDragAbsolute",t))(K||{}),re=(t=>(t.web="web",t.email="email",t.document="document",t.react="react",t))(re||{});const le={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function Ge(t,e){const s=t;return s.init=n=>{const i=o=>t(o,n);return i.__gjsPluginId=e,i},s}const Ce=(t,e)=>Ge(t,e);async function Ie({editor:t,plan:e,pluginName:s,licenseKey:n,onLicenseCheckResponse:i,cleanup:o}){let a="",c;const l=r=>{console.warn("Cleanup plugin:",s,"Reason:",r),o(t,s)},g=(r={})=>{var v;const{error:h,sdkLicense:I}=r,b=(v=r.plan)==null?void 0:v.category;if(!(I||r.license)||h)l(h||"Invalid license");else if(b){const G=le[e],m=le[b];G>m&&l({pluginRequiredPlan:e,licensePlan:b})}};t.Commands.has(K.settings)&&(c=t.runCommand(K.settings),a=(c==null?void 0:c.baseUrl)||"");const f=r=>{i==null||i(r),r&&g(r)};if(!c){t.onReady(async()=>{if(!ve())if(n){const r=await Ee({licenseKey:n,pluginName:s,baseApiUrl:a});f(r)}else l("The `licenseKey` option not provided")});return}if(c.licensePlan||c.licenseError){const r=Te(c);f(r);return}t.on(me,r=>f(r))}const Te=t=>({sdkLicense:t.license,license:t.license,error:t.licenseError,plan:t.licensePlan});async function Ee(t){const{licenseKey:e,pluginName:s,baseApiUrl:n}=t;try{return(await we({baseApiUrl:n,path:`/sdk/${e||"na"}`,method:"POST",params:{d:window.location.hostname,pn:s}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const ce=t=>e=>{var s;return((s=e.getAttribute)==null?void 0:s.call(e,J))===t},Ae=(...t)=>e=>t.some(s=>e.is(s)),Le=(...t)=>(e,s)=>t.some(n=>s.is(n)),pe="gjs-plg-",J="data-type-role",_=class _{constructor(e){this.config=e}getSize(e){var s;return(s=this.config)!=null&&s.getSize?this.config.getSize(e):se(e.componentColumn,_.CSS_FLEX_BASIS)}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:i,partial:o}=e;n.addStyle({[_.CSS_FLEX_BASIS]:i},{partial:o})}}};_.CSS_FLEX_BASIS="flex-basis";let q=_;const F=class F{constructor(e){this.config=e}isGapSupported(){return!0}getGap(e){var s;return(s=this.config)!=null&&s.getGap?this.config.getGap(e):se(e.componentRow,F.CSS_GAP)}setGap(e){var s;if((s=this.config)!=null&&s.setGap)this.config.setGap(e);else{const{componentRow:n,gapValue:i,partial:o}=e;n.addStyle({[F.CSS_GAP]:i},{partial:o})}}};F.CSS_GAP="gap";let Z=F;const X=class X{constructor(e){this.config=e}getParentSize(e){var o;if((o=this.config)!=null&&o.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,i=s.getEl();return i?n?i.clientHeight:i.clientWidth:0}isLayoutVertical(e){var n;if((n=this.config)!=null&&n.isParentVertical)return this.config.isParentVertical(e);const s=se(e.componentRow,X.CSS_FLEX_DIRECTION,!0);return s==="column"||s==="column-reverse"}};X.CSS_FLEX_DIRECTION="flex-direction";let Q=X;const O=class O{constructor(e){this.config=e}getSize(e){var n;if((n=this.config)!=null&&n.getSize)return this.config.getSize(e);const s=e.componentColumn;if(s.is(O.MJML_COLUMN_TYPE)){const o=s.getAttributes().width;if(o&&(o.includes("%")||!isNaN(parseFloat(o))))return parseFloat(o);const a=s.parent();return 100/(a?a.components().length:1)}return 0}setSize(e){var s;if((s=this.config)!=null&&s.setSize)this.config.setSize(e);else{const{componentColumn:n,sizeValue:i,partial:o}=e;n.is(O.MJML_COLUMN_TYPE)&&n.addAttributes({width:`${parseFloat(i)}%`},{partial:o})}}};O.MJML_COLUMN_TYPE="mj-column";let ee=O;const Y=class Y{constructor(e){this.config=e}isGapSupported(){return!1}getGap(e){var n;if((n=this.config)!=null&&n.getGap)return this.config.getGap(e);const{componentRow:s}=e;if(s.is(Y.MJML_SECTION_TYPE)){const i=s.getAttributes();if(i&&i.padding)return parseInt(i.padding,10)||0}return 0}setGap(e){var s,n;(n=(s=this.config)==null?void 0:s.setGap)==null||n.call(s,e)}};Y.MJML_SECTION_TYPE="mj-section";let te=Y;class Me{constructor(e){this.config=e}getParentSize(e){var a;if((a=this.config)!=null&&a.getParentSize)return this.config.getParentSize(e);const{componentRow:s,isVertical:n}=e,i=s.getEl();if(!i)return 0;let o=i;if(i.tagName!=="TABLE"){const c=i.querySelectorAll("table");c.length&&(o=c[0])}return n?o.clientHeight:o.clientWidth}isLayoutVertical(e){var s;return(s=this.config)!=null&&s.isParentVertical?this.config.isParentVertical(e):!1}}class M{constructor(){this.handlerCache=new Map}static getInstance(){return M.instance||(M.instance=new M),M.instance}getHandlers(e){const s=`${e.projectType}-${e.disableGapHandler?"nogap":"gap"}`;return this.handlerCache.has(s)||($(e)?this.handlerCache.set(s,{sizeHandler:new ee(e),gapHandler:new te(e),parentSizeHandler:new Me(e)}):this.handlerCache.set(s,{sizeHandler:new q(e),gapHandler:new Z(e),parentSizeHandler:new Q(e)})),this.handlerCache.get(s)}}function T(t){return M.getInstance().getHandlers(t)}const ue=t=>{t.style.display="none"},de=t=>{t.style.display="block"},V=t=>+parseFloat(`${t}`).toFixed(2),$=t=>t.projectType===re.email,$e=t=>t?["top","bottom"]:["left","right"],De=t=>{const e=t.parent();return e?e.components().models.indexOf(t)===0:!1},He=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.indexOf(t)===s.length-1},Ve=t=>{const e=t.parent();if(!e)return!1;const s=e.components().models;return s.length>1&&t.index()===s.length-1},je=(t,e,s,n)=>{const o=t+(s?e==="top"?-1:e==="bottom"?1:0:e==="left"?-1:e==="right"?1:0);return o>=0&&o<n?o:-1},k=t=>t==="top"||t==="bottom",Be=(t,e)=>!!(De(t)&&(e==="left"||e==="top")||He(t)&&(e==="right"||e==="bottom")),Ne=t=>{const e=t.parent();return e?e.components().models.length>1:!1},ge=(t,e)=>t==="right"||t==="bottom"?e>0:e<0,se=(t,e,s=!1)=>{const n=!s,i=n?0:"",o=t.getEl();let a;try{a=o?window.getComputedStyle(o):void 0}catch{a=void 0}if(!a)return i;const c=a[e]||"";if(n){let l;return typeof c=="string"?(l=parseFloat(c.replace(/[^-\d.]/g,"")),isNaN(l)&&(l=0)):l=Number(c)||0,l}return c},he=(t,e,s)=>{const n=ne({componentRow:t,isVertical:e},s),i=t.components().models;return n*(i.length-1)},j=(t,e)=>T(e).parentSizeHandler.isLayoutVertical({componentRow:t}),B=(t,e)=>T(e).sizeHandler.getSize(t),ne=(t,e)=>{if(e!=null&&e.disableGapHandler)return 0;const{gapHandler:s,parentSizeHandler:n}=T(e);if(!s.isGapSupported())return 0;const i=s.getGap(t),o=n.getParentSize(t);return i/100*o},ie=(t,e)=>T(e).parentSizeHandler.getParentSize(t),N=(t,e)=>{T(e).sizeHandler.setSize(t)},fe=(t,e)=>{const s=B(t,e);N({...t,sizeValue:`${s}%`,partial:!1},e)},ye=(t,e)=>{if(e!=null&&e.disableGapHandler)return;const{gapHandler:s}=T(e);s.isGapSupported()&&s.setGap(t)},_e=(t,e)=>{const s=t.getStyle().gap;if(!s)return;const n=t.components().models,i={componentRow:t,isVertical:j(t,e)};n.map(o=>fe({...i,componentColumn:o},e)),ye({...i,gapValue:String(s),partial:!1},e)};function Fe(t,e){const{Blocks:s}=t,{typeColumn:n,typeRow:i,blocks:o}=e;if(o===!1||$(e))return;const a=r=>({type:i,components:r.map(h=>({type:n,style:{"flex-basis":`${h}%`}}))}),c=r=>`<div class="gs-block-item__flex-row" style="display: flex; height: 1.75rem; width: 100%; flex-wrap: nowrap; gap: 0.5rem;">
2
2
  ${r.map(h=>`<div style="flex-basis: ${h}%; border-color: currentColor; border-width: 2px; border-radius: 0.12rem;"></div>`).join("")}
3
- </div>`,p=(r,h)=>({id:`flex-row-${h.join("-")}`,label:r,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:l(h),content:o(h)}),g=[p("1 Column",[100]),p("2 Columns 50/50",[50,50]),p("2 Columns 25/75",[25,75]),p("2 Columns 75/25",[75,25]),p("3 Columns",[33.33,33.33,33.33]),p("3 Columns 50/25/25",[50,25,25]),p("3 Columns 25/50/25",[25,50,25]),p("3 Columns 25/25/50",[25,25,50]),p("4 Columns",[25,25,25,25]),p("5 Columns",[20,20,20,20,20])],f=ve(a)?a({blocks:g}):g;return f.forEach(r=>s.add(r.id,r)),()=>{f.forEach(r=>s.remove(r.id))}}const Fe=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:i,extendTypeColumn:a}=e,o=`${pe}${i}`,p=!!i&&!!s.getType(i)&&!a;if(!(!i||p||$(e)))return s.addType(i,{isComponent:ce(i),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:Ae(n),attributes:{[J]:i},styles:`
4
- .${o} {
3
+ </div>`,l=(r,h)=>({id:`flex-row-${h.join("-")}`,label:r,category:"Layout",select:!0,full:!0,attributes:{class:"gs-block-item__flex gs-utl-w-full"},media:c(h),content:a(h)}),g=[l("1 Column",[100]),l("2 Columns 50/50",[50,50]),l("2 Columns 25/75",[25,75]),l("2 Columns 75/25",[75,25]),l("3 Columns",[33.33,33.33,33.33]),l("3 Columns 50/25/25",[50,25,25]),l("3 Columns 25/50/25",[25,50,25]),l("3 Columns 25/25/50",[25,25,50]),l("4 Columns",[25,25,25,25]),l("5 Columns",[20,20,20,20,20])],f=Re(o)?o({blocks:g}):g;return f.forEach(r=>s.add(r.id,r)),()=>{f.forEach(r=>s.remove(r.id))}}const Oe=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:i,extendTypeColumn:o}=e,a=`${pe}${i}`,l=!!i&&!!s.getType(i)&&!o;if(!(!i||l||$(e)))return s.addType(i,{isComponent:ce(i),model:{defaults:{name:"Column",resizable:!1,emptyState:!0,classes:a,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',draggable:Le(n),attributes:{[J]:i},styles:`
4
+ .${a} {
5
5
  flex-grow: 1;
6
6
  }
7
- `}}}),()=>{s.removeType(i)}},Oe=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:i,extendTypeRow:a}=e,o=`${pe}${n}`,p=!!n&&!!s.getType(n)&&!a;if(!(!n||p||$(e)))return s.addType(n,{isComponent:ce(n),model:{defaults:{name:"Row",classes:o,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[J]:n},droppable:Ee(i),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:e.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:e.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
8
- .${o} {
7
+ `}}}),()=>{s.removeType(i)}},ke=(t,e)=>{const{Components:s}=t,{typeRow:n,typeColumn:i,extendTypeRow:o}=e,a=`${pe}${n}`,l=!!n&&!!s.getType(n)&&!o;if(!(!n||l||$(e)))return s.addType(n,{isComponent:ce(n),model:{defaults:{name:"Row",classes:a,icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',emptyState:{styleIn:"width: 100%"},attributes:{[J]:n},droppable:Ae(i),traits:[{type:"checkbox",name:"snap",label:"Enable Snap",default:e.snapEnabled,changeProp:!0},{type:"number",name:"snap-divisions",label:"Snap Divisions",min:1,max:12,step:1,default:e.snapDivisions,changeProp:!0}],resizable:{tl:0,tc:0,tr:0,cl:0,bl:0,br:0},styles:`
8
+ .${a} {
9
9
  display: flex;
10
10
  align-items: stretch;
11
11
  flex-wrap: nowrap;
12
12
  }
13
- `}}}),()=>{s.removeType(n)}},ke="flexComponent",Ue=L.startup;class Xe{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(e){this.resizableChildTypes.add(e)}registerGapAdjustableParent(e){this.gapAdjustableParentTypes.add(e)}registerTypeRelationship(e,s){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(s),this.registerResizableChild(s),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,s){const n=e.get("type"),i=s.get("type");return this.typeRelationships.has(n)?this.typeRelationships.get(n).has(i):!1}}class Ye{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeState=new WeakMap}getState(e){return this.resizeState.has(e)||this.resizeState.set(e,{}),this.resizeState.get(e)}clearState(e){return this.resizeState.delete(e)}startResize(e,s,n){const{opts:i}=this,a=this.getState(e);a.direction=s,a.startX=n.clientX,a.startY=n.clientY,a.resizing=!0,a.lastSnappedPercent=void 0;const o=e.parent();if(!o||!this.registry.isValidRelationship(o,e))return;a.snapEnabled=o.get("snap")??i.snapEnabled,a.snapDivisions=o.get("snap-divisions")??i.snapDivisions??12;const l=o.components().models,p=l.findIndex(h=>h.cid===e.cid),g=N(o,i),f=Ve(p,s,g,l.length);f!==-1&&(a.adjacentIdx=f);const r={componentColumn:e,componentRow:o,isVertical:g};if(a.startPercent=j(r,i),typeof a.adjacentIdx<"u"){const h=l[a.adjacentIdx];a.neighborStartPercent=j({...r,componentColumn:h},i)}}updateResizeByDelta(e,s,n){const i=this.getState(e),a=e.parent();!i.resizing||!a||(i.snapEnabled?this.updateSnapResize(e,s,n):this.updateContinuesResize(e,s,n))}finishResize(e){const s=e.parent(),n=s==null?void 0:s.components().models,i={componentRow:s,isVertical:!!s&&N(s,this.opts)};n==null||n.forEach(a=>fe({...i,componentColumn:a},this.opts)),this.clearState(e)}updateContinuesResize(e,s,n){const i=this.getState(e),a=e.parent(),{opts:o}=this;if(!a)return;const l=o.minItemPercent??0,p=k(s),g=ie({componentRow:a,isVertical:p},o),f=he(a,p,this.opts),h=100-f/g*100,I=n/(g-f)*h,{startPercent:b=0,neighborStartPercent:x=0}=i,v={componentRow:a,isVertical:p,componentColumn:e,partial:!0},G=ge(s,n)?b+Math.abs(I):b-Math.abs(I);if(typeof i.adjacentIdx<"u"){const m=a.components().models[i.adjacentIdx],R=b+x,z=R-l,c=Math.min(z,Math.max(l,G)),u=R-c;B({...v,sizeValue:`${V(c)}%`},o),B({...v,componentColumn:m,sizeValue:`${V(u)}%`},o)}else{const m=Math.max(l,Math.min(h,G));B({...v,sizeValue:`${V(m)}%`},o)}}updateSnapResize(e,s,n){const i=this.getState(e),a=e.parent(),o=k(s),l=ie({componentRow:a,isVertical:o},this.opts),p=he(a,o,this.opts),g=l-p,f=n/g*100,r=ge(s,n),{startPercent:h=0,snapDivisions:I=12}=i,b=r?h+Math.abs(f):h-Math.abs(f),x=100/I,v=Math.floor(b/x)*x,G=Math.ceil(b/x)*x,m=Math.abs(G-b),R=Math.abs(b-v),z=x*.2,S=m<R?G:v;if(S>0&&S<100&&(m<z||R<z)&&i.lastSnappedPercent!==S){i.lastSnappedPercent=S;let y=Math.abs(S-h)/100*g;(r&&(s==="left"||s==="top")||!r&&(s==="right"||s==="bottom"))&&(y=-y),this.updateContinuesResize(e,s,y)}else m>=z&&R>=z&&(i.lastSnappedPercent=void 0)}}class We{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n}updateGapByDelta(e,s,n,i){if(!this.registry.isGapAdjustableParent(e))return;const{opts:a}=this,o=Math.max(0,n+s),l=ie({componentRow:e,isVertical:i},a),p=o/l*100,g=e.components().models,f=g.length-1,r={componentRow:e,isVertical:i},h=g.reduce((z,S)=>z+j({...r,componentColumn:S},a),0),b=100-p*f,x=a.minItemPercent||5;if(b<x*g.length)return;const G=100-f*p,m=h-G,R={componentRow:e,isVertical:i,partial:!0};g.map(z=>{const S=j({...r,componentColumn:z},a),c=S-S/h*m;B({...R,componentColumn:z,sizeValue:`${V(c)}%`},a)}),ye({...R,gapValue:`${V(p)}%`},a)}finishGapAdjust(e){Be(e,this.opts)}}class Ke{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeHandler=new Ye(e,s,n),this.gapHandler=new We(e,s,n)}startResize(e,s,n){this.resizeHandler.startResize(e,s,n)}updateResizeByDelta(e,s,n){this.resizeHandler.updateResizeByDelta(e,s,n)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,s,n,i){this.gapHandler.updateGapByDelta(e,s,n,i)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const s=e.parent();return s?this.registry.isValidRelationship(s,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const U="gs-flex-spots",be=`${U}__handle-size`,Je=`${U}__handle-gap`;function qe(t,e){const{Canvas:s}=t,n="flex-resize-spot";let i,a,o,l,p=null,g=null;const f=new Xe,r=new Ke(t,f,e),h=()=>{var c;i=document.createElement("div"),i.className=U,i.style.display="none",a=document.createElement("div"),a.className=`${U}__handles`,a.style.position="absolute",a.style.pointerEvents="none",a.style.zIndex="21",o={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(o).forEach(([u,y])=>{const P=u,d=k(P);y.className=`${be} ${be}-${P} gjs-resizer-h gjs-cv-unscale`,y.style.cssText=`
13
+ `}}}),()=>{s.removeType(n)}},be="flexComponent",Ue=L.startup;class Xe{constructor(){this.resizableChildTypes=new Set,this.gapAdjustableParentTypes=new Set,this.typeRelationships=new Map}registerResizableChild(e){this.resizableChildTypes.add(e)}registerGapAdjustableParent(e){this.gapAdjustableParentTypes.add(e)}registerTypeRelationship(e,s){this.typeRelationships.has(e)||this.typeRelationships.set(e,new Set),this.typeRelationships.get(e).add(s),this.registerResizableChild(s),this.registerGapAdjustableParent(e)}isResizableChild(e){return this.resizableChildTypes.has(e.get("type"))}isGapAdjustableParent(e){return this.gapAdjustableParentTypes.has(e.get("type"))}isValidRelationship(e,s){const n=e.get("type"),i=s.get("type");return this.typeRelationships.has(n)?this.typeRelationships.get(n).has(i):!1}}class Ye{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeState=new WeakMap}getState(e){return this.resizeState.has(e)||this.resizeState.set(e,{}),this.resizeState.get(e)}clearState(e){return this.resizeState.delete(e)}startResize(e,s,n){const{opts:i}=this,o=this.getState(e);o.direction=s,o.startX=n.clientX,o.startY=n.clientY,o.resizing=!0,o.lastSnappedPercent=void 0;const a=e.parent();if(!a||!this.registry.isValidRelationship(a,e))return;o.snapEnabled=a.get("snap")??i.snapEnabled,o.snapDivisions=a.get("snap-divisions")??i.snapDivisions??12;const c=a.components().models,l=c.findIndex(h=>h.cid===e.cid),g=j(a,i),f=je(l,s,g,c.length);f!==-1&&(o.adjacentIdx=f);const r={componentColumn:e,componentRow:a,isVertical:g};if(o.startPercent=B(r,i),typeof o.adjacentIdx<"u"){const h=c[o.adjacentIdx];o.neighborStartPercent=B({...r,componentColumn:h},i)}}updateResizeByDelta(e,s,n){const i=this.getState(e),o=e.parent();!i.resizing||!o||(i.snapEnabled?this.updateSnapResize(e,s,n):this.updateContinuesResize(e,s,n))}finishResize(e){const s=e.parent(),n=s==null?void 0:s.components().models,i={componentRow:s,isVertical:!!s&&j(s,this.opts)};n==null||n.forEach(o=>fe({...i,componentColumn:o},this.opts)),this.clearState(e)}updateContinuesResize(e,s,n){const i=this.getState(e),o=e.parent(),{opts:a}=this;if(!o)return;const c=a.minItemPercent??0,l=k(s),g=ie({componentRow:o,isVertical:l},a),f=he(o,l,this.opts),h=100-f/g*100,I=n/(g-f)*h,{startPercent:b=0,neighborStartPercent:x=0}=i,v={componentRow:o,isVertical:l,componentColumn:e,partial:!0},G=ge(s,n)?b+Math.abs(I):b-Math.abs(I);if(typeof i.adjacentIdx<"u"){const m=o.components().models[i.adjacentIdx],R=b+x,z=R-c,p=Math.min(z,Math.max(c,G)),u=R-p;N({...v,sizeValue:`${V(p)}%`},a),N({...v,componentColumn:m,sizeValue:`${V(u)}%`},a)}else{const m=Math.max(c,Math.min(h,G));N({...v,sizeValue:`${V(m)}%`},a)}}updateSnapResize(e,s,n){const i=this.getState(e),o=e.parent(),a=k(s),c=ie({componentRow:o,isVertical:a},this.opts),l=he(o,a,this.opts),g=c-l,f=n/g*100,r=ge(s,n),{startPercent:h=0,snapDivisions:I=12}=i,b=r?h+Math.abs(f):h-Math.abs(f),x=100/I,v=Math.floor(b/x)*x,G=Math.ceil(b/x)*x,m=Math.abs(G-b),R=Math.abs(b-v),z=x*.2,S=m<R?G:v;if(S>0&&S<100&&(m<z||R<z)&&i.lastSnappedPercent!==S){i.lastSnappedPercent=S;let y=Math.abs(S-h)/100*g;(r&&(s==="left"||s==="top")||!r&&(s==="right"||s==="bottom"))&&(y=-y),this.updateContinuesResize(e,s,y)}else m>=z&&R>=z&&(i.lastSnappedPercent=void 0)}}class We{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n}updateGapByDelta(e,s,n,i){if(!this.registry.isGapAdjustableParent(e))return;const{opts:o}=this,a=Math.max(0,n+s),c=ie({componentRow:e,isVertical:i},o),l=a/c*100,g=e.components().models,f=g.length-1,r={componentRow:e,isVertical:i},h=g.reduce((z,S)=>z+B({...r,componentColumn:S},o),0),b=100-l*f,x=o.minItemPercent||5;if(b<x*g.length)return;const G=100-f*l,m=h-G,R={componentRow:e,isVertical:i,partial:!0};g.map(z=>{const S=B({...r,componentColumn:z},o),p=S-S/h*m;N({...R,componentColumn:z,sizeValue:`${V(p)}%`},o)}),ye({...R,gapValue:`${V(l)}%`},o)}finishGapAdjust(e){_e(e,this.opts)}}class Ke{constructor(e,s,n){this.editor=e,this.registry=s,this.opts=n,this.resizeHandler=new Ye(e,s,n),this.gapHandler=new We(e,s,n)}startResize(e,s,n){this.resizeHandler.startResize(e,s,n)}updateResizeByDelta(e,s,n){this.resizeHandler.updateResizeByDelta(e,s,n)}finishResize(e){this.resizeHandler.finishResize(e)}updateGapByDelta(e,s,n,i){this.gapHandler.updateGapByDelta(e,s,n,i)}finishGapAdjust(e){this.gapHandler.finishGapAdjust(e)}canResize(e){const s=e.parent();return s?this.registry.isValidRelationship(s,e):!1}canAdjustGap(e){return this.registry.isGapAdjustableParent(e)}}const U="gs-flex-spots",Pe=`${U}__handle-size`,Je=`${U}__handle-gap`;function qe(t,e){const{Canvas:s}=t,n="flex-resize-spot";let i,o,a,c,l=null,g=null;const f=new Xe,r=new Ke(t,f,e),h=()=>{var p;i=document.createElement("div"),i.className=U,i.style.display="none",o=document.createElement("div"),o.className=`${U}__handles`,o.style.position="absolute",o.style.pointerEvents="none",o.style.zIndex="21",a={left:document.createElement("div"),right:document.createElement("div"),top:document.createElement("div"),bottom:document.createElement("div")},Object.entries(a).forEach(([u,y])=>{const P=u,d=k(P);y.className=`${Pe} ${Pe}-${P} gjs-resizer-h gjs-cv-unscale`,y.style.cssText=`
14
14
  pointer-events: all;
15
15
  position: absolute;
16
16
  z-index: 1;
@@ -20,7 +20,7 @@
20
20
  ${P==="right"?"right: 0px;":""}
21
21
  ${P==="top"?"top: 0px;":""}
22
22
  ${P==="bottom"?"bottom: 0px;":""}
23
- `,y.addEventListener("pointerdown",I(P)),a.appendChild(y)}),!e.disableGapHandler&&!$(e)&&(l=document.createElement("div"),l.className=Je,l.style.cssText=`
23
+ `,y.addEventListener("pointerdown",I(P)),o.appendChild(y)}),!e.disableGapHandler&&!$(e)&&(c=document.createElement("div"),c.className=Je,c.style.cssText=`
24
24
  position: absolute;
25
25
  background-color: var(--gs-theme-cl-cmp-bg1, #3b97e3);
26
26
  border-width: 2px;
@@ -30,4 +30,4 @@
30
30
  pointer-events: all;
31
31
  max-width: 3rem;
32
32
  max-height: 3rem;
33
- `,l.addEventListener("pointerdown",b()),a.appendChild(l)),i.append(a),(c=s.getSpotsEl())==null||c.appendChild(i)},I=c=>u=>{if(!p)return;u.stopPropagation(),u.preventDefault(),r.startResize(p,c,u);const y=u.clientX,P=u.clientY;u.target.setPointerCapture(u.pointerId);const d=D=>{const C=t.Canvas.getZoomMultiplier(),H=(D.clientX-y)*C,W=(D.clientY-P)*C,ae=k(c)?W:H;r.updateResizeByDelta(p,c,ae)},w=()=>{r.finishResize(p),u.target.releasePointerCapture(u.pointerId),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",w)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",w)},b=()=>c=>{if(!g)return;const u=g;c.stopPropagation(),c.preventDefault();const y=N(u,e),P=ne({componentRow:u,isVertical:y},e),d=c.clientX,w=c.clientY;c.target.setPointerCapture(c.pointerId);const D=H=>{const W=t.Canvas.getZoomMultiplier(),ae=y?(H.clientY-w)*W:(H.clientX-d)*W;r.updateGapByDelta(u,ae,P,y)},C=()=>{r.finishGapAdjust(u),c.target.releasePointerCapture(c.pointerId),document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",C)};document.addEventListener("pointermove",D),document.addEventListener("pointerup",C)},x=c=>{const u=c.component;if(!u||!i||(p=u,g=u.parent(),!g))return;const y=g;de(i);const P=c.getStyle();a&&Object.assign(a.style,P);const d=N(y,e),w=Me(d);if(Object.values(o).forEach(ue),w.forEach(C=>{if(Ne(u,C))return;const H=o[C];de(H)}),T(e).gapHandler.isGapSupported()&&l&&je(u)){const C=ne({componentRow:y,isVertical:d},e);v(C,d,He(u))}},v=(c,u,y=!1)=>{const P=e.gapHandleSize,d=l.style;if(u){d.height=`${P}px`;const w=l.offsetHeight;y?(d.top=`-${(c+w)/2}px`,d.bottom=""):(d.bottom=`-${(c+w)/2}px`,d.top=""),d.width="50%",d.left="50%",d.transform="translateX(-50%)",d.cursor="row-resize"}else{d.width=`${P}px`;const w=l.offsetWidth;y?(d.left=`-${(c+w)/2}px`,d.right=""):(d.right=`-${(c+w)/2}px`,d.left=""),d.height="50%",d.top="50%",d.transform="translateY(-50%)",d.cursor="col-resize"}},G=()=>{i&&(ue(i),p=null,g=null)},m=()=>{s.removeSpots({type:n});const c=t.getSelected(),u=c==null?void 0:c.parent();c&&u&&f.isValidRelationship(u,c)?s.addSpot({type:n,component:c}):G()},R=()=>{const c=s.getSpots().filter(u=>u.type===n)[0];c&&x(c)},z=(c,u)=>{f.registerTypeRelationship(c,u)};t.onReady(()=>{h(),$(e)?z("mj-section","mj-column"):z(e.typeRow,e.typeColumn)});const S="component:toggled";return t.on(s.events.spot,R),t.on(S,m),()=>{t.off(s.events.spot,R),t.off(S,m)}}return Ge(function(t,e={}){const s={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},n=[Oe(t,s),Fe(t,s)],i=qe(t,s),a=_e(t,s);Ce({editor:t,licenseKey:s.licenseKey,plan:Ue,pluginName:ke,cleanup:()=>{n.forEach(o=>o==null?void 0:o()),i(),a==null||a()}})})});
33
+ `,c.addEventListener("pointerdown",b()),o.appendChild(c)),i.append(o),(p=s.getSpotsEl())==null||p.appendChild(i)},I=p=>u=>{if(!l)return;u.stopPropagation(),u.preventDefault(),r.startResize(l,p,u);const y=u.clientX,P=u.clientY;u.target.setPointerCapture(u.pointerId);const d=D=>{const C=t.Canvas.getZoomMultiplier(),H=(D.clientX-y)*C,W=(D.clientY-P)*C,oe=k(p)?W:H;r.updateResizeByDelta(l,p,oe)},w=()=>{r.finishResize(l),u.target.releasePointerCapture(u.pointerId),document.removeEventListener("pointermove",d),document.removeEventListener("pointerup",w)};document.addEventListener("pointermove",d),document.addEventListener("pointerup",w)},b=()=>p=>{if(!g)return;const u=g;p.stopPropagation(),p.preventDefault();const y=j(u,e),P=ne({componentRow:u,isVertical:y},e),d=p.clientX,w=p.clientY;p.target.setPointerCapture(p.pointerId);const D=H=>{const W=t.Canvas.getZoomMultiplier(),oe=y?(H.clientY-w)*W:(H.clientX-d)*W;r.updateGapByDelta(u,oe,P,y)},C=()=>{r.finishGapAdjust(u),p.target.releasePointerCapture(p.pointerId),document.removeEventListener("pointermove",D),document.removeEventListener("pointerup",C)};document.addEventListener("pointermove",D),document.addEventListener("pointerup",C)},x=p=>{const u=p.component;if(!u||!i||(l=u,g=u.parent(),!g))return;const y=g;de(i);const P=p.getStyle();o&&Object.assign(o.style,P);const d=j(y,e),w=$e(d);if(Object.values(a).forEach(ue),w.forEach(C=>{if(Be(u,C))return;const H=a[C];de(H)}),T(e).gapHandler.isGapSupported()&&c&&Ne(u)){const C=ne({componentRow:y,isVertical:d},e);v(C,d,Ve(u))}},v=(p,u,y=!1)=>{const P=e.gapHandleSize,d=c.style;if(u){d.height=`${P}px`;const w=c.offsetHeight;y?(d.top=`-${(p+w)/2}px`,d.bottom=""):(d.bottom=`-${(p+w)/2}px`,d.top=""),d.width="50%",d.left="50%",d.transform="translateX(-50%)",d.cursor="row-resize"}else{d.width=`${P}px`;const w=c.offsetWidth;y?(d.left=`-${(p+w)/2}px`,d.right=""):(d.right=`-${(p+w)/2}px`,d.left=""),d.height="50%",d.top="50%",d.transform="translateY(-50%)",d.cursor="col-resize"}},G=()=>{i&&(ue(i),l=null,g=null)},m=()=>{s.removeSpots({type:n});const p=t.getSelected(),u=p==null?void 0:p.parent();p&&u&&f.isValidRelationship(u,p)?s.addSpot({type:n,component:p}):G()},R=()=>{const p=s.getSpots().filter(u=>u.type===n)[0];p&&x(p)},z=(p,u)=>{f.registerTypeRelationship(p,u)};t.onReady(()=>{h(),$(e)?z("mj-section","mj-column"):z(e.typeRow,e.typeColumn)});const S="component:toggled";return t.on(s.events.spot,R),t.on(S,m),()=>{t.off(s.events.spot,R),t.off(S,m)}}return Ce(function(t,e={}){const s={typeRow:"flex-row",typeColumn:"flex-column",gapHandleSize:3,snapDivisions:12,minItemPercent:5,...e},n=[ke(t,s),Oe(t,s)],i=qe(t,s),o=Fe(t,s);Ie({editor:t,licenseKey:s.licenseKey,plan:Ue,pluginName:be,cleanup:()=>{n.forEach(a=>a==null?void 0:a()),i(),o==null||o()}})},be)});
@@ -1,4 +1,4 @@
1
- import { ProjectType } from '@studio/editor/src/utils/types';
1
+ import { ProjectType } from '@grapesjs/studio-sdk/dist/utils/types';
2
2
  import { SDKPluginOptions } from '../utils';
3
3
  export interface FlexComponentOptions extends SDKPluginOptions {
4
4
  /**
@@ -1,6 +1,6 @@
1
- "use strict";const N="app.grapesjs.com",H="app-stage.grapesjs.com",S="app2.grapesjs.com",U="app-stage2.grapesjs.com",$=[N,S,H,U,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],F="license:check:end",W=()=>typeof window<"u",K=({isDev:e,isStage:a,isPlatform:c})=>`${e?"":`https://${a?H:N}`}/${c?"platform-api":"api"}`,Z=()=>{if(!W())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},q=()=>{const e=Z();return!!e&&($.includes(e)||$.some(a=>e.endsWith(a)))};async function z({path:e,baseApiUrl:a,method:c="GET",headers:l={},params:r,body:f}){const g=`${a||K({isDev:!1,isStage:!1})}${e}`,u={method:c,headers:{"Content-Type":"application/json",...l}};f&&(u.body=JSON.stringify(f));const y=r?new URLSearchParams(r).toString():"",v=y?`?${y}`:"",s=await fetch(`${g}${v}`,u);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{}),m=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(m||{});const V={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function J(e){const a=e;return a.init=c=>l=>e(l,c),a}const X=e=>J(e);async function Y({editor:e,plan:a,pluginName:c,licenseKey:l,onLicenseCheckResponse:r,cleanup:f}){let h="",g;const u=s=>{console.warn("Cleanup plugin:",c,"Reason:",s),f()},y=(s={})=>{var E;const{error:p,sdkLicense:I}=s,T=(E=s.plan)==null?void 0:E.category;if(!(I||s.license)||p)u(p||"Invalid license");else if(T){const O=V[a],t=V[T];O>t&&u({pluginRequiredPlan:a,licensePlan:T})}};e.Commands.has(m.settings)&&(g=e.runCommand(m.settings),h=(g==null?void 0:g.baseUrl)||"");const v=s=>{r==null||r(s),s&&y(s)};if(!g){e.onReady(async()=>{if(!q())if(l){const s=await C({licenseKey:l,pluginName:c,baseApiUrl:h});v(s)}else u("The `licenseKey` option not provided")});return}if(g.licensePlan||g.licenseError){const s=Q(g);v(s);return}e.on(F,s=>v(s))}const Q=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function C(e){const{licenseKey:a,pluginName:c,baseApiUrl:l}=e;try{return(await z({baseApiUrl:l,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:c}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}const ee="gjs-plg-",te="fsLightboxComponent",oe=w.startup,D="data-fslightbox",G="data-type",se="fslightbox-open",A="fslightbox",P={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},ie=function(e,a={}){const{Blocks:c,Components:l}=e,r="Lightbox",f=`${ee}${A}`,h={toolbarIconOpen:P.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...a},{block:g,toolbarIconOpen:u,defaultSrc:y}=h,v=function(t){const o=this,n="data-fslightbox",i=window,b=()=>{var B;const d=i.refreshFsLightbox;d==null||d();const k=o.getAttribute(n);if((B=i.fsLightboxInstances)==null||B[k],!i._isEditor)return;Array.from(document.querySelectorAll(`[${n}]`)).forEach(L=>{const x=L.onclick;L.onclick=function(_){_.preventDefault();const j=L;!j.__skipLb&&(x==null||x(_)),j.__skipLb=!0}})};if(i.refreshFsLightbox)b();else{const d=document.createElement("script");d.src=t.cdnScript,d.onload=b,document.head.appendChild(d)}},s=t=>({id:`${A}-open-lb`,label:u,command:()=>{const o=t.getView();o==null||o.toggleLightbox()}}),p="source-type",I={type:"radio",name:p,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:P.image},{id:"video",label:"Video",icon:P.video},{id:"el",label:"Custom Element",icon:P.external}],labelToTitle:!0},T={id:"href-image",name:"href",type:"file",label:"Source Image"},M={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},E={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},O={image:[T],video:[M],el:[E]};l.addType(A,{block:g&&{label:r,media:P.imageLightbox,category:"Extra",select:!0,...h.block},isComponent:t=>{var o;return(o=t.hasAttribute)==null?void 0:o.call(t,D)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:r,icon:P.imageLightbox,classes:f,draggable:(t,o)=>!o.is(A),attributes:{[D]:"lightbox",[G]:"image",href:y},components:{type:"image",src:y},script:v,cdnScript:h.cdnScript,"script-props":["attributes","cdnScript"],[p]:"image",traits:[I,{name:D,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(t,o){var i;const n=(i=o.target)==null?void 0:i.getView();n==null||n.toggleLightbox()}}],styles:`
2
- .${f} {
1
+ "use strict";const N="app.grapesjs.com",H="app-stage.grapesjs.com",F="app2.grapesjs.com",S="app-stage2.grapesjs.com",V=[N,F,H,S,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io",".claudemcpcontent.com",".web-sandbox.oaiusercontent.com"],W="license:check:end",K=()=>typeof window<"u",Z=({isDev:e,isStage:a,isPlatform:c})=>`${e?"":`https://${a?H:N}`}/${c?"platform-api":"api"}`,q=()=>{if(!K())return"";const{hostname:e}=window.location;if(e)return e;try{return window.parent.location.hostname||""}catch{return""}},z=()=>{const e=q();return!!e&&(V.includes(e)||V.some(a=>e.endsWith(a)))};async function J({path:e,baseApiUrl:a,method:c="GET",headers:l={},params:r,body:u}){const g=`${a||Z({isDev:!1,isStage:!1})}${e}`,d={method:c,headers:{"Content-Type":"application/json",...l}};u&&(d.body=JSON.stringify(u));const y=r?new URLSearchParams(r).toString():"",v=y?`?${y}`:"",s=await fetch(`${g}${v}`,d);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var w=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(w||{}),j=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",e.dialogImportCode="studio:dialogImportCode",e.openEditCode="studio:openEditCode",e.openBlocks="studio:openBlocks",e.appendComponent="studio:appendComponent",e.sidebarLeftSet="studio:sidebarLeft:set",e.sidebarLeftGet="studio:sidebarLeft:get",e.sidebarLeftToggle="studio:sidebarLeft:toggle",e.sidebarRightSet="studio:sidebarRight:set",e.sidebarRightGet="studio:sidebarRight:get",e.sidebarRightToggle="studio:sidebarRight:toggle",e.sidebarTopSet="studio:sidebarTop:set",e.sidebarTopGet="studio:sidebarTop:get",e.sidebarTopToggle="studio:sidebarTop:toggle",e.sidebarBottomSet="studio:sidebarBottom:set",e.sidebarBottomGet="studio:sidebarBottom:get",e.sidebarBottomToggle="studio:sidebarBottom:toggle",e.symbolAdd="studio:symbolAdd",e.symbolDetach="studio:symbolDetach",e.symbolOverride="studio:symbolOverride",e.symbolPropagateStyles="studio:propagateStyles",e.getPagesConfig="studio:getPagesConfig",e.setPagesConfig="studio:setPagesConfig",e.getPageSettings="studio:getPageSettings",e.setPageSettings="studio:setPageSettings",e.clearPage="studio:clearPage",e.projectFiles="studio:projectFiles",e.validateCode="studio:validateCode",e.canvasReload="studio:canvasReload",e.getBlocksPanel="studio:getBlocksPanel",e.setBlocksPanel="studio:setBlocksPanel",e.getStateContextMenu="studio:getStateContextMenu",e.setStateContextMenu="studio:setStateContextMenu",e.contextMenuComponent="studio:contextMenuComponent",e.layoutAdd="studio:layoutAdd",e.layoutRemove="studio:layoutRemove",e.layoutToggle="studio:layoutToggle",e.layoutUpdate="studio:layoutUpdate",e.layoutGet="studio:layoutGet",e.layoutConfigGet="studio:layoutConfigGet",e.layoutConfigSet="studio:layoutConfigSet",e.layoutComponentAdd="studio:layoutComponentAdd",e.layoutComponentGet="studio:layoutComponentGet",e.layoutComponentRemove="studio:layoutComponentRemove",e.layoutComponentRender="studio:layoutComponentRender",e.getStateTheme="studio:getStateTheme",e.setStateTheme="studio:setStateTheme",e.settings="studio:settings",e.assetProviderGet="studio:assetProviderGet",e.assetProviderAdd="studio:assetProviderAdd",e.assetProviderRemove="studio:assetProviderRemove",e.fontGet="studio:fontGet",e.fontAdd="studio:fontAdd",e.fontRemove="studio:fontRemove",e.fontManagerOpen="studio:fontManagerOpen",e.menuFontLoad="studio:menuFontLoad",e.toggleStateDataSource="studio:toggleStateDataSource",e.getStateDataSource="studio:getStateDataSource",e.dataSourceSetGlobalData="studio:dataSourceSetGlobalData",e.dataSourceSetImporter="studio:dataSourceSetImporter",e.dataSourceSetExporter="studio:dataSourceSetExporter",e.setDragAbsolute="studio:setDragAbsolute",e))(j||{});const m={[w.free]:0,[w.startup]:10,[w.business]:20,[w.enterprise]:30};function X(e,a){const c=e;return c.init=l=>{const r=u=>e(u,l);return r.__gjsPluginId=a,r},c}const Y=(e,a)=>X(e,a);async function Q({editor:e,plan:a,pluginName:c,licenseKey:l,onLicenseCheckResponse:r,cleanup:u}){let b="",g;const d=s=>{console.warn("Cleanup plugin:",c,"Reason:",s),u(e,c)},y=(s={})=>{var E;const{error:p,sdkLicense:I}=s,T=(E=s.plan)==null?void 0:E.category;if(!(I||s.license)||p)d(p||"Invalid license");else if(T){const G=m[a],t=m[T];G>t&&d({pluginRequiredPlan:a,licensePlan:T})}};e.Commands.has(j.settings)&&(g=e.runCommand(j.settings),b=(g==null?void 0:g.baseUrl)||"");const v=s=>{r==null||r(s),s&&y(s)};if(!g){e.onReady(async()=>{if(!z())if(l){const s=await ee({licenseKey:l,pluginName:c,baseApiUrl:b});v(s)}else d("The `licenseKey` option not provided")});return}if(g.licensePlan||g.licenseError){const s=C(g);v(s);return}e.on(W,s=>v(s))}const C=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function ee(e){const{licenseKey:a,pluginName:c,baseApiUrl:l}=e;try{return(await J({baseApiUrl:l,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:c}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}const te="gjs-plg-",U="fsLightboxComponent",oe=w.startup,D="data-fslightbox",k="data-type",se="fslightbox-open",A="fslightbox",P={image:'<svg viewBox="0 0 24 24"><path d="m8.5 13.5 2.5 3 3.5-4.5 4.5 6H5m16 1V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2Z"/></svg>',video:'<svg viewBox="0 0 24 24"><path d="M17 10.5V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v10a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-3.5l4 4v-11l-4 4Z"/></svg>',imageLightbox:'<svg viewBox="0 0 24 24"><path d="M4,2H20A2,2 0 0,1 22,4V16A2,2 0 0,1 20,18H16L12,22L8,18H4A2,2 0 0,1 2,16V4A2,2 0 0,1 4,2M19,15V7L15,11L13,9L7,15H19M7,5A2,2 0 0,0 5,7A2,2 0 0,0 7,9A2,2 0 0,0 9,7A2,2 0 0,0 7,5Z" /></svg>',external:'<svg viewBox="0 0 24 24"><path d="M14 3v2h3.6l-9.8 9.8 1.4 1.4L19 6.4V10h2V3m-2 16H5V5h7V3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2v-7h-2v7z"/></svg>',eye:'<svg viewBox="0 0 24 24"><path d="M12 9a3 3 0 0 0-3 3 3 3 0 0 0 3 3 3 3 0 0 0 3-3 3 3 0 0 0-3-3m0 8a5 5 0 0 1-5-5 5 5 0 0 1 5-5 5 5 0 0 1 5 5 5 5 0 0 1-5 5m0-12.5C7 4.5 2.7 7.6 1 12a11.8 11.8 0 0 0 22 0c-1.7-4.4-6-7.5-11-7.5Z"/></svg>'},ne=function(e,a={}){const{Blocks:c,Components:l}=e,r="Lightbox",u=`${te}${A}`,b={toolbarIconOpen:P.eye,block:{},defaultSrc:"https://placehold.co/300/777/white.png?text=Image",cdnScript:"https://cdn.jsdelivr.net/npm/fslightbox@3.4.2/index.js",...a},{block:g,toolbarIconOpen:d,defaultSrc:y}=b,v=function(t){const o=this,i="data-fslightbox",n=window,f=()=>{var O;const h=n.refreshFsLightbox;h==null||h();const M=o.getAttribute(i);if((O=n.fsLightboxInstances)==null||O[M],!n._isEditor)return;Array.from(document.querySelectorAll(`[${i}]`)).forEach(L=>{const x=L.onclick;L.onclick=function(_){_.preventDefault();const $=L;!$.__skipLb&&(x==null||x(_)),$.__skipLb=!0}})};if(n.refreshFsLightbox)f();else{const h=document.createElement("script");h.src=t.cdnScript,h.onload=f,document.head.appendChild(h)}},s=t=>({id:`${A}-open-lb`,label:d,command:()=>{const o=t.getView();o==null||o.toggleLightbox()}}),p="source-type",I={type:"radio",name:p,label:"Source type",changeProp:!0,options:[{id:"image",label:"Image",icon:P.image},{id:"video",label:"Video",icon:P.video},{id:"el",label:"Custom Element",icon:P.external}],labelToTitle:!0},T={id:"href-image",name:"href",type:"file",label:"Source Image"},B={id:"href-video",name:"href",label:"Source Video",placeholder:"https://www.youtube.com/watch?v=..."},E={id:"href-el",name:"href",label:"Source Element",placeholder:"#custom-element-id"},G={image:[T],video:[B],el:[E]};l.addType(A,{block:g&&{label:r,media:P.imageLightbox,category:"Extra",select:!0,...b.block},isComponent:t=>{var o;return(o=t.hasAttribute)==null?void 0:o.call(t,D)},extendFn:["initToolbar"],model:{defaults:{tagName:"a",name:r,icon:P.imageLightbox,classes:u,draggable:(t,o)=>!o.is(A),attributes:{[D]:"lightbox",[k]:"image",href:y},components:{type:"image",src:y},script:v,cdnScript:b.cdnScript,"script-props":["attributes","cdnScript"],[p]:"image",traits:[I,{name:D,label:"Group name"},{type:"button",label:"Toggle Lightbox",command(t,o){var n;const i=(n=o.target)==null?void 0:n.getView();i==null||i.toggleLightbox()}}],styles:`
2
+ .${u} {
3
3
  display: inline-block;
4
4
  padding: 10px;
5
5
  }
6
- `},init(){const t=[p].map(o=>`change:${o}`).join(" ");this.on(t,this.updateTraits),this.on(`change:${p}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(t,o,n){if(n.adjust)return;const b=this.get(p)==="video"?"video":"image";this.addAttributes({[G]:b,href:""})},adjustSourceType(){const t=this.get(p),o=this.getAttributes().href||"",n={adjust:!0};if(t==="video"){const i=o.includes("youtube.com")?"youtube":"video";this.addAttributes({[G]:i},n)}else t!=="el"&&o.startsWith("#")?this.set(p,"el",n):t==="image"&&this.addAttributes({[G]:"image"},n)},updateTraits(t={}){const{changed:o}=this,{init:n}=t;if(o[I.name]||n){this.removeTrait([T.name,M.name,E.name]);const i=this.get(p)||"image",b=this.getTraitIndex(p)+1;this.addTrait(O[i],{at:b})}},initToolbar(){if(!u)return;const{toolbar:t}=this,o=s(this);!t.find(i=>i.id===o.id)&&(t==null||t.unshift(o))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var L;const{em:t,el:o,model:n}=this,{Canvas:i}=t,b=n.getAttributes()[D],{defaultView:d,documentElement:k}=o.ownerDocument,R=(L=d.fsLightboxInstances)==null?void 0:L[b];if(k.classList.contains(se))R.close();else{o.__skipLb=!1;let x;R.props.onOpen=()=>{x=i.getSpots(),setTimeout(()=>i.removeSpots())},R.props.onClose=()=>{x.forEach(_=>i.addSpot(_.attributes))},o.click()}}}}),Y({editor:e,plan:oe,licenseKey:h.licenseKey,pluginName:te,cleanup:()=>{c.remove(A),l.removeType(A)}})},ne=X(ie);module.exports=ne;
6
+ `},init(){const t=[p].map(o=>`change:${o}`).join(" ");this.on(t,this.updateTraits),this.on(`change:${p}`,this.onSourceTypeChange),this.on("change:attributes:href",this.adjustSourceType),this.updateTraits({init:!0}),this.adjustSourceType()},onSourceTypeChange(t,o,i){if(i.adjust)return;const f=this.get(p)==="video"?"video":"image";this.addAttributes({[k]:f,href:""})},adjustSourceType(){const t=this.get(p),o=this.getAttributes().href||"",i={adjust:!0};if(t==="video"){const n=o.includes("youtube.com")?"youtube":"video";this.addAttributes({[k]:n},i)}else t!=="el"&&o.startsWith("#")?this.set(p,"el",i):t==="image"&&this.addAttributes({[k]:"image"},i)},updateTraits(t={}){const{changed:o}=this,{init:i}=t;if(o[I.name]||i){this.removeTrait([T.name,B.name,E.name]);const n=this.get(p)||"image",f=this.getTraitIndex(p)+1;this.addTrait(G[n],{at:f})}},initToolbar(){if(!d)return;const{toolbar:t}=this,o=s(this);!t.find(n=>n.id===o.id)&&(t==null||t.unshift(o))}},view:{onRender(){this.el.__skipLb=!0},toggleLightbox(){var L;const{em:t,el:o,model:i}=this,{Canvas:n}=t,f=i.getAttributes()[D],{defaultView:h,documentElement:M}=o.ownerDocument,R=(L=h.fsLightboxInstances)==null?void 0:L[f];if(M.classList.contains(se))R.close();else{o.__skipLb=!1;let x;R.props.onOpen=()=>{x=n.getSpots(),setTimeout(()=>n.removeSpots())},R.props.onClose=()=>{x.forEach(_=>n.addSpot(_.attributes))},o.click()}}}}),Q({editor:e,plan:oe,licenseKey:b.licenseKey,pluginName:U,cleanup:()=>{c.remove(A),l.removeType(A)}})},ie=Y(ne,U);module.exports=ie;