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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +161 -156
  3. package/dist/accordionComponent/index.umd.js +9 -9
  4. package/dist/aiChat/chatManager.d.ts +15 -0
  5. package/dist/aiChat/clientTools.d.ts +3 -3
  6. package/dist/aiChat/clientToolsProcessors.d.ts +14 -1
  7. package/dist/aiChat/components/AiChatEmptyState.d.ts +4 -6
  8. package/dist/aiChat/components/AiChatError.d.ts +2 -1
  9. package/dist/aiChat/components/AiChatHeader.d.ts +2 -1
  10. package/dist/aiChat/components/AiChatInput/AssetsSection.d.ts +7 -0
  11. package/dist/aiChat/components/AiChatInput/AttachButton.d.ts +10 -0
  12. package/dist/aiChat/components/AiChatInput/ContextSection.d.ts +5 -0
  13. package/dist/aiChat/components/AiChatInput/DictateButton.d.ts +7 -0
  14. package/dist/aiChat/components/AiChatInput/TextAreaWithAutoResize.d.ts +6 -0
  15. package/dist/aiChat/components/AiChatInput/constants.d.ts +6 -0
  16. package/dist/aiChat/components/AiChatInput/hooks/useSpeechToText.d.ts +15 -0
  17. package/dist/aiChat/components/AiChatInput/index.d.ts +37 -0
  18. package/dist/aiChat/components/AiChatLoadingState.d.ts +2 -1
  19. package/dist/aiChat/components/AiChatMessage.d.ts +21 -9
  20. package/dist/aiChat/components/AiChatMessages.d.ts +5 -7
  21. package/dist/aiChat/components/AiChatMessagesStatus.d.ts +5 -0
  22. package/dist/aiChat/components/AiChatPanel.d.ts +2 -3
  23. package/dist/aiChat/components/AiChatProvider.d.ts +14 -0
  24. package/dist/aiChat/components/MemoizedMarkdown.d.ts +9 -0
  25. package/dist/aiChat/components/index.d.ts +24 -25
  26. package/dist/aiChat/components/utils.d.ts +12 -4
  27. package/dist/aiChat/index.cjs.d.ts +5 -0
  28. package/dist/aiChat/index.cjs.js +453 -0
  29. package/dist/aiChat/index.d.ts +4 -3
  30. package/dist/aiChat/index.es.d.ts +5 -0
  31. package/dist/aiChat/index.es.js +30930 -0
  32. package/dist/aiChat/index.js +453 -0
  33. package/dist/aiChat/index.umd.js +453 -0
  34. package/dist/aiChat/locales/en.d.ts +64 -0
  35. package/dist/aiChat/server/index.cjs.d.ts +4 -0
  36. package/dist/aiChat/server/index.cjs.js +309 -0
  37. package/dist/aiChat/server/index.d.ts +0 -50
  38. package/dist/aiChat/server/index.es.d.ts +4 -0
  39. package/dist/aiChat/server/index.es.js +876 -0
  40. package/dist/aiChat/server/index.js +309 -0
  41. package/dist/aiChat/server/index.umd.js +309 -0
  42. package/dist/aiChat/server/stream.d.ts +0 -6
  43. package/dist/aiChat/server/tools.d.ts +157 -51
  44. package/dist/aiChat/server/types.d.ts +108 -64
  45. package/dist/aiChat/types.d.ts +148 -108
  46. package/dist/aiChat/typesSchema.d.ts +238 -25
  47. package/dist/animationComponent/index.cjs.js +3 -3
  48. package/dist/animationComponent/index.es.js +174 -169
  49. package/dist/animationComponent/index.umd.js +3 -3
  50. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  51. package/dist/canvasAbsoluteMode/index.es.js +161 -156
  52. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  53. package/dist/canvasEmptyState/index.cjs.js +1 -1
  54. package/dist/canvasEmptyState/index.es.js +113 -108
  55. package/dist/canvasEmptyState/index.umd.js +1 -1
  56. package/dist/canvasFullSize/index.cjs.js +9 -9
  57. package/dist/canvasFullSize/index.es.js +137 -132
  58. package/dist/canvasFullSize/index.umd.js +9 -9
  59. package/dist/canvasGridMode/index.cjs.js +4 -4
  60. package/dist/canvasGridMode/index.es.js +168 -163
  61. package/dist/canvasGridMode/index.umd.js +8 -8
  62. package/dist/canvasScreenshot/index.cjs.js +1 -1
  63. package/dist/canvasScreenshot/index.es.js +132 -127
  64. package/dist/canvasScreenshot/index.umd.js +1 -1
  65. package/dist/dataSourceEjs/index.cjs.js +5 -5
  66. package/dist/dataSourceEjs/index.es.js +151 -146
  67. package/dist/dataSourceEjs/index.umd.js +5 -5
  68. package/dist/dataSourceHandlebars/index.cjs.js +4 -4
  69. package/dist/dataSourceHandlebars/index.es.js +91 -86
  70. package/dist/dataSourceHandlebars/index.umd.js +5 -5
  71. package/dist/dialogComponent/index.cjs.js +16 -16
  72. package/dist/dialogComponent/index.es.js +117 -112
  73. package/dist/dialogComponent/index.umd.js +16 -16
  74. package/dist/flexComponent/index.cjs.js +11 -11
  75. package/dist/flexComponent/index.es.js +416 -411
  76. package/dist/flexComponent/index.umd.js +11 -11
  77. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  78. package/dist/fsLightboxComponent/index.es.js +152 -147
  79. package/dist/fsLightboxComponent/index.umd.js +3 -3
  80. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  81. package/dist/googleFontsAssetProvider/index.es.js +127 -122
  82. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  83. package/dist/iconifyComponent/index.cjs.js +2 -2
  84. package/dist/iconifyComponent/index.es.js +170 -165
  85. package/dist/iconifyComponent/index.umd.js +2 -2
  86. package/dist/index.cjs.js +1 -1
  87. package/dist/index.es.js +27 -22
  88. package/dist/index.umd.js +1 -1
  89. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  90. package/dist/layoutSidebarButtons/index.es.js +156 -151
  91. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  92. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  93. package/dist/lightGalleryComponent/index.es.js +197 -192
  94. package/dist/lightGalleryComponent/index.umd.js +1 -1
  95. package/dist/linkImageComponent/index.cjs.js +2 -2
  96. package/dist/linkImageComponent/index.es.js +86 -81
  97. package/dist/linkImageComponent/index.umd.js +2 -2
  98. package/dist/listPagesComponent/index.cjs.js +5 -5
  99. package/dist/listPagesComponent/index.es.js +121 -116
  100. package/dist/listPagesComponent/index.umd.js +5 -5
  101. package/dist/presetPrintable/index.cjs.js +4 -4
  102. package/dist/presetPrintable/index.es.js +180 -175
  103. package/dist/presetPrintable/index.umd.js +4 -4
  104. package/dist/prosemirror/index.cjs.js +6 -6
  105. package/dist/prosemirror/index.es.js +128 -123
  106. package/dist/prosemirror/index.umd.js +8 -8
  107. package/dist/rendererReact/index.cjs.js +1 -1
  108. package/dist/rendererReact/index.es.js +127 -122
  109. package/dist/rendererReact/index.js +1 -1
  110. package/dist/rendererReact/index.umd.js +1 -1
  111. package/dist/rteTinyMce/index.cjs.js +2 -2
  112. package/dist/rteTinyMce/index.es.js +160 -155
  113. package/dist/rteTinyMce/index.umd.js +2 -2
  114. package/dist/shapeDividerComponent/index.cjs.js +25 -25
  115. package/dist/shapeDividerComponent/index.es.js +127 -122
  116. package/dist/shapeDividerComponent/index.umd.js +25 -25
  117. package/dist/swiperComponent/index.cjs.js +9 -9
  118. package/dist/swiperComponent/index.es.js +197 -192
  119. package/dist/swiperComponent/index.umd.js +9 -9
  120. package/dist/tableComponent/index.cjs.js +1 -1
  121. package/dist/tableComponent/index.es.js +227 -222
  122. package/dist/tableComponent/index.umd.js +1 -1
  123. package/dist/types.d.ts +1 -1
  124. package/dist/utils.d.ts +12 -1
  125. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  126. package/dist/youtubeAssetProvider/index.es.js +124 -119
  127. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  128. package/package.json +5 -2
  129. package/dist/aiChat/components/AiChatInput.d.ts +0 -17
  130. package/dist/aiChat/server/stream-utils.d.ts +0 -16
@@ -1 +1 @@
1
- (function(k,L){typeof exports=="object"&&typeof module<"u"?module.exports=L():typeof define=="function"&&define.amd?define(L):(k=typeof globalThis<"u"?globalThis:k||self,k.StudioSdkPlugins_lightGalleryComponent=L())})(this,function(){"use strict";const k="app.grapesjs.com",L="app-stage.grapesjs.com",Q=[k,"app2.grapesjs.com",L,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],pe="license:check:start",ue="license:check:end",he=()=>typeof window<"u",ge=({isDev:e,isStage:l})=>`${e?"":`https://${l?L:k}`}/api`,be=()=>{const e=he()&&window.location.hostname;return!!e&&(Q.includes(e)||Q.some(l=>e.endsWith(l)))};async function de({path:e,baseApiUrl:l,method:a="GET",headers:n={},params:s,body:u}){const p=`${l||ge({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...n}};u&&(h.body=JSON.stringify(u));const c=s?new URLSearchParams(s).toString():"",i=c?`?${c}`:"",b=await fetch(`${p}${i}`,h);if(!b.ok)throw new Error(`HTTP error! status: ${b.status}`);return b.json()}var P=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(P||{});const X={[P.free]:0,[P.startup]:10,[P.business]:20,[P.enterprise]:30};function me(e){const l=e;return l.init=a=>n=>e(n,a),l}const ye=e=>me(e);async function fe({editor:e,plan:l,pluginName:a,licenseKey:n,cleanup:s}){let u="",r=!1;const p=be(),h=i=>{console.warn("Cleanup plugin:",a,"Reason:",i),s()},c=(i={})=>{var C;const{error:b,sdkLicense:V}=i,S=(C=i.plan)==null?void 0:C.category;if(!(V||i.license)||b)h(b||"Invalid license");else if(S){const _=X[l],M=X[S];_>M&&h({pluginRequiredPlan:l,licensePlan:S})}};e.on(pe,i=>{u=i==null?void 0:i.baseApiUrl,r=!0}),e.on(ue,i=>{c(i)}),setTimeout(async()=>{if(!r){if(p)return;if(n){const i=await ve({licenseKey:n,pluginName:a,baseApiUrl:u});i&&c(i)}else h("The `licenseKey` option not provided")}},2e3)}async function ve(e){const{licenseKey:l,pluginName:a,baseApiUrl:n}=e;try{return(await de({baseApiUrl:n,path:`/sdk/${l||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const B=(e,l)=>{var a;return!!((a=e==null?void 0:e.hasAttribute)!=null&&a.call(e,l))},Te="lightGalleryComponent",we=P.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",Y=`${T}-item`,N="data-lightgallery",ee=`${N}-item`,$="toggle",w={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>',gallery:'<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>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></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>'},W={propKeys:[],props:{},traits:[]},O=(e,l={})=>{var s;const a={},n=[];for(const u in e){const{value:r,...p}=e[u];n.push({id:u,name:u,changeProp:!0,category:l.category,...p}),a[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(s=h[c])==null||s.forEach(i=>{const b=i.id||i.name;a[b]=i.value})}return{propKeys:Object.keys(a),props:a,traits:n}},Z=(e,l)=>{const a=e.getTrait(l),n=a.get("category"),s=a.get("subTraits")||{},r=(Object.values(s).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=s[a.getValue()],h=e.getTraitIndex(l)+1;p&&e.addTrait(p.map(c=>({category:n,...c})),{at:h})},R=(e,l)=>{l.forEach(a=>{const n=e.getTrait(a);if(!n||!n.get("subTraits"))return;const s=n.changeProp?`change:${a}`:`change:attributes:${a}`;e.on(s,()=>Z(e,a)),Z(e,a)})},Se=(e,l,a)=>{const s=e.getTrait(l).get("subTraits")||{},r=(Object.values(s).flat()||[]).map(h=>{const c=h.name||h.id;return h.changeProp?`change:${c}`:`change:attributes:${c}`}),p=Array.from(new Set(r));p.length&&e.on(p.join(" "),a)},xe={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var a,n;return(n=(a=l.target)==null?void 0:a.getView())==null?void 0:n.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},Ae={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},Ie={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},ke={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},m="sourceType",j="data-iframe",F={name:"href",type:"file",label:"Image Source"},K={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},q={name:"data-poster",label:"Video Poster",type:"file"},te={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},ae={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},Le={[$]:{type:"button",label:"Toggle Gallery",command:(e,l)=>{var s,u;const a=l.target,n=(s=a==null?void 0:a.closestType(T))==null?void 0:s.getView();if(n&&a){const r=((u=n.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(a.getEl());p>=0&&n.toggleGallery(p)}}},[m]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[F],video:[K,q],external:[te]},options:[{id:"image",label:F.label||"",icon:w.image},{id:"video",label:K.label||"",icon:w.video},{id:"external",label:te.label||"",icon:w.external}]},subHtml:ae},ne="lgThumbnail",Pe="lgVideo",le="lgAutoplay",oe="lgZoom",G="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ye(function(e,l={}){const{Blocks:a,Components:n}=e,s="LightGallery",u="LightGallery Item",r={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ne,Pe,le,oe],cdnScript:[`${G}/lightgallery.min.js`,`${G}/plugins/thumbnail/lg-thumbnail.min.js`,`${G}/plugins/video/lg-video.min.js`,`${G}/plugins/autoplay/lg-autoplay.min.js`,`${G}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${G}/css/lightgallery-bundle.min.css`,...l},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,i=function(t){const o=this,g=window,{plugins:y,cdnScript:x,cdnStyle:D,inline:ie,lgLicenseKey:Ee,...f}=t||{},A=d=>isNaN(d)?void 0:parseInt(d,10),re=()=>{var H;const d={...f,licenseKey:Ee,speed:A(f.speed),startAnimationDuration:A(f.startAnimationDuration),thumbMargin:A(f.thumbMargin),thumbWidth:A(f.thumbWidth),slideShowInterval:A(f.slideShowInterval),scale:A(f.scale),enableZoomAfter:A(f.enableZoomAfter),plugins:(y||[]).map(z=>g[z])};ie&&(d.container=o,d.closable=!1);const J=(H=g.lightGallery)==null?void 0:H.call(g,o,d);ie&&J.openGallery()};if(g.lightGallery)re();else{const{head:d}=document,J=Array.isArray(x)?[...x]:[x],H=Array.isArray(D)?[...D]:[D],z=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),z(I)}},ce=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=ce.bind(null,I),d.appendChild(v)}else re()};z(H),ce(J)}},b=t=>{const o=t.getTrait($);if(!h||!o)return;const{toolbar:g}=t,y={id:$,label:h,command:()=>setTimeout(()=>o.runCommand(),100)};!g.find(D=>D.id===y.id)&&(g==null||g.unshift(y))};let V=[];const S=r.plugins||[],U=O(xe),C=S.includes(ne)?O(Ae):W,_=S.includes(le)?O(Ie):W,M=S.includes(oe)?O(ke):W;n.addType(T,{block:p&&{label:s,media:w.gallery,category:"Extra",select:!0,...r.block},isComponent:t=>B(t,N),extendFn:["init","initToolbar"],model:{defaults:{name:s,icon:w.gallery,draggable:(t,o)=>!o.is(T),attributes:{[N]:!0},components:{type:Y},script:i,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...U.propKeys,...C.propKeys,..._.propKeys,...M.propKeys],...U.props,...C.props,..._.props,...M.props,traits:[...U.traits,...C.traits,..._.traits,...M.traits]},init(){R(this,["thumbnail"]),R(this,["autoplay"]),R(this,["zoom"])},initToolbar(){b(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,n.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const t=this.getLightGallery();t==null||t.destroy()},disableLgInCanvas(){const t=this.getLightGallery();t.lgOpened=!0},isInlineGallery(){var o;const t=this.getLightGallery();return((o=t==null?void 0:t.settings)==null?void 0:o.container)===this.el},onLgInit(t){this.el.__lg=t.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:t}=this,{Canvas:o}=t,g=this.getLightGallery();V=o.getSpots(),setTimeout(()=>o.removeSpots()),g.__lgOpened=!0},onLgClose(){const t=this.getLightGallery();V.forEach(o=>this.em.Canvas.addSpot(o.attributes)),V=[],t.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(t){const o=this.getLightGallery();if(o.__lgOpened)return o.closeGallery(!0);o.lgOpened=!1,o.openGallery(t)}}});const se=O(Le);n.addType(Y,{isComponent:t=>B(t,ee)||t.tagName==="A"&&B(t.parentElement,N),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:w.galleryItem,attributes:{[ee]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...se.props,traits:[...se.traits]},init(){const t=[m].map(o=>`change:${o}`).join(" ");this.initSourceType(),this.on(t,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Se(this,m,this.triggerGalleryUpdate)},initToolbar(){b(this)},initScriptUpdate(){const t=[ae.name].map(o=>`change:attributes:${o}`).join(" ");this.on(t,this.triggerGalleryUpdate)},triggerGalleryUpdate(...t){var o;(o=this.closestType(T))==null||o.__scriptPropsChange(...t)},updateTraits(t={}){const{changed:o}=this,{init:g}=t;if(o[m]||g){Z(this,m);const y=this.getTrait(m).getValue();if(y===E.image){this.removeAttributes([K.name,q.name,j]);const x=this.getTrait(F.name);x.setValue(x.getValue()||c)}else y===E.video?this.removeAttributes([j]):y===E.external&&this.addAttributes({[j]:!0})}},initSourceType(){const t=this.getAttributes({noClass:!0,noStyle:!0});t[j]?this.set(m,E.external):(t[K.name]||t[q.name])&&this.set(m,E.video)}}}),fe({editor:e,plan:we,licenseKey:r.licenseKey,pluginName:Te,cleanup:()=>{a.remove(T),n.removeType(T)}})})});
1
+ (function(P,k){typeof exports=="object"&&typeof module<"u"?module.exports=k():typeof define=="function"&&define.amd?define(k):(P=typeof globalThis<"u"?globalThis:P||self,P.StudioSdkPlugins_lightGalleryComponent=k())})(this,function(){"use strict";const P="app.grapesjs.com",k="app-stage.grapesjs.com",X=[P,"app2.grapesjs.com",k,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],pe="license:check:start",ue="license:check:end",he=()=>typeof window<"u",ge=({isDev:e,isStage:n,isPlatform:t})=>`${e?"":`https://${n?k:P}`}/${t?"platform-api":"api"}`,be=()=>{const e=he()&&window.location.hostname;return!!e&&(X.includes(e)||X.some(n=>e.endsWith(n)))};async function de({path:e,baseApiUrl:n,method:t="GET",headers:l={},params:o,body:u}){const p=`${n||ge({isDev:!1,isStage:!1})}${e}`,h={method:t,headers:{"Content-Type":"application/json",...l}};u&&(h.body=JSON.stringify(u));const c=o?new URLSearchParams(o).toString():"",b=c?`?${c}`:"",s=await fetch(`${p}${b}`,h);if(!s.ok)throw new Error(`HTTP error! status: ${s.status}`);return s.json()}var L=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(L||{});const Y={[L.free]:0,[L.startup]:10,[L.business]:20,[L.enterprise]:30};function me(e){const n=e;return n.init=t=>l=>e(l,t),n}const ye=e=>me(e);async function fe({editor:e,plan:n,pluginName:t,licenseKey:l,onLicenseCheckResponse:o,cleanup:u}){let r="",p=!1;const h=be(),c=s=>{console.warn("Cleanup plugin:",t,"Reason:",s),u()},b=(s={})=>{var V;const{error:O,sdkLicense:C}=s,S=(V=s.plan)==null?void 0:V.category;if(!(C||s.license)||O)c(O||"Invalid license");else if(S){const M=Y[n],H=Y[S];M>H&&c({pluginRequiredPlan:n,licensePlan:S})}};e.on(pe,s=>{r=s==null?void 0:s.baseApiUrl,p=!0}),e.on(ue,s=>{o==null||o(s),b(s)}),setTimeout(async()=>{if(!p){if(h)return;if(l){const s=await ve({licenseKey:l,pluginName:t,baseApiUrl:r});o==null||o(s),s&&b(s)}else c("The `licenseKey` option not provided")}},2e3)}async function ve(e){const{licenseKey:n,pluginName:t,baseApiUrl:l}=e;try{return(await de({baseApiUrl:l,path:`/sdk/${n||"na"}`,method:"POST",params:{d:window.location.hostname,pn:t}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const W=(e,n)=>{var t;return!!((t=e==null?void 0:e.hasAttribute)!=null&&t.call(e,n))},Te="lightGalleryComponent",we=L.startup;var E=(e=>(e.image="image",e.video="video",e.external="external",e))(E||{});const T="lightGallery",ee=`${T}-item`,$="data-lightgallery",te=`${$}-item`,N="toggle",w={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>',gallery:'<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>',galleryItem:'<svg viewBox="0 0 24 24"><path d="M20 2H4a2 2 0 0 0-2 2v18l4-4h14a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2M8 14H6v-2h2v2m0-3H6V9h2v2m0-3H6V6h2v2m7 6h-5v-2h5v2m3-3h-8V9h8v2m0-3h-8V6h8v2Z"/></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>'},Z={propKeys:[],props:{},traits:[]},_=(e,n={})=>{var o;const t={},l=[];for(const u in e){const{value:r,...p}=e[u];l.push({id:u,name:u,changeProp:!0,category:n.category,...p}),t[u]=r;const{subTraits:h={}}=p;for(const c in p.subTraits)(o=h[c])==null||o.forEach(b=>{const s=b.id||b.name;t[s]=b.value})}return{propKeys:Object.keys(t),props:t,traits:l}},F=(e,n)=>{const t=e.getTrait(n),l=t.get("category"),o=t.get("subTraits")||{},r=(Object.values(o).flat()||[]).map(c=>c.id||c.name);e.removeTrait(r);const p=o[t.getValue()],h=e.getTraitIndex(n)+1;p&&e.addTrait(p.map(c=>({category:l,...c})),{at:h})},q=(e,n)=>{n.forEach(t=>{const l=e.getTrait(t);if(!l||!l.get("subTraits"))return;const o=l.changeProp?`change:${t}`:`change:attributes:${t}`;e.on(o,()=>F(e,t)),F(e,t)})},Se=(e,n,t)=>{const o=e.getTrait(n).get("subTraits")||{},r=(Object.values(o).flat()||[]).map(h=>{const c=h.name||h.id;return h.changeProp?`change:${c}`:`change:attributes:${c}`}),p=Array.from(new Set(r));p.length&&e.on(p.join(" "),t)},xe={[N]:{type:"button",label:"Toggle Gallery",command:(e,n)=>{var t,l;return(l=(t=n.target)==null?void 0:t.getView())==null?void 0:l.toggleGallery()}},speed:{type:"number",label:"Speed",tip:"Transition duration between slides (in ms)",value:400,step:50,min:0},inline:{type:"checkbox",label:"Inline Gallery",value:!1},allowMediaOverlap:{type:"checkbox",label:"Allow media overlap",tip:"If enabled, toolbar, captions and thumbnails will overlap with the media element",value:!1},controls:{type:"checkbox",label:"Show controls",tip:"If disabled, prev/next buttons will not be displayed",value:!0},counter:{type:"checkbox",label:"Show counter",tip:"Display the total number of images and index number of the currently displayed slide",value:!0},download:{type:"checkbox",label:"Download icon",tip:"Enable download button",value:!0},enableDrag:{type:"checkbox",label:"Enable drag",tip:"Enables desktop mouse drag support",value:!0},enableSwipe:{type:"checkbox",label:"Enable swipe",tip:"Enables swipe support for mobile devices",value:!0},escKey:{type:"checkbox",label:"Enable Esc key",tip:'Whether the gallery could be closed by pressing the "Esc" key',value:!0},keyPress:{type:"checkbox",label:"Enable keyboard navigation",value:!1},loop:{type:"checkbox",label:"Loop",tip:"If false, will disable the ability to loop back to the beginning of the gallery from the last slide",value:!0},getCaptionFromTitleOrAlt:{type:"checkbox",label:"Caption from title or alt",tip:"Get captions from alt or title tags",value:!0},showMaximizeIcon:{type:"checkbox",label:"Show maximize icon",value:!1},closable:{type:"checkbox",label:"Closable",tip:"If false, it won't be possible to close the gallery",value:!0},showCloseIcon:{type:"checkbox",label:"Show close icon",tip:"If false, close button won't be displayed.",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0},closeOnTap:{type:"checkbox",label:"Close on tap",tip:"Allows clicks on black area to close gallery",visible:({component:e})=>!!e.getTrait("closable").getValue(),value:!0}},Ae={thumbnail:{category:{id:"thumbnail-options",label:"Thumbnail Options"},type:"checkbox",label:"Thumbnails",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"enableThumbDrag",label:"Thumbnail drag",tip:"Enable thumbnail drag on desktop",changeProp:!0,value:!0},{type:"checkbox",name:"enableThumbSwipe",label:"Thumbnail swipe",tip:"Enable thumbnail swipe on mobile devices",changeProp:!0,value:!0},{type:"select",name:"alignThumbnails",tip:"Position of thumbnails when the width of all thumbnails combined is less than the gallery's width",label:"Align Thumbnails",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"select",name:"currentPagerPosition",label:"Select thumbnail position",value:"middle",changeProp:!0,options:[{id:"left",label:"Left"},{id:"middle",label:"Middle"},{id:"right",label:"Right"}]},{type:"number",name:"thumbMargin",label:"Thumb margin",tip:"Spacing between each thumbnails",changeProp:!0,min:0,value:"5"},{type:"number",name:"thumbWidth",label:"Thumb width",tip:"Width of each thumbnails",changeProp:!0,min:0,value:"100"}]}}},Ie={autoplay:{category:{id:"autoplay-options",label:"Autoplay options"},type:"checkbox",label:"Autoplay",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"autoplayControls",label:"Autoplay controls",tip:"Show/hide autoplay controls",changeProp:!0,value:!0},{type:"checkbox",name:"progressBar",label:"Progress bar",tip:"Show autoplay progress bar",changeProp:!0,value:!0},{type:"checkbox",name:"forceSlideShowAutoplay",label:"Force autoplay",tip:"If false, autoplay will be stopped after first user action",changeProp:!0,value:!1},{type:"checkbox",name:"slideShowAutoplay",label:"Start autoplay",tip:"Enable autoplay on start",changeProp:!0,value:!1},{type:"number",name:"slideShowInterval",label:"Interval",tip:"The time (in ms) between each auto transition",changeProp:!0,min:0,step:50,value:5e3}]}}},Pe={zoom:{category:{id:"zoom-options",label:"Zoom options"},type:"checkbox",label:"Zoom",value:!0,subTraits:{false:[],true:[{type:"checkbox",name:"actualSize",label:"Show actual size icon",changeProp:!0,value:!0},{type:"checkbox",name:"infiniteZoom",label:"Infinte zoom",changeProp:!0,value:!0},{type:"checkbox",name:"showZoomInOutIcons",label:"Show zoom in/out icons",changeProp:!0,value:!1},{type:"number",name:"scale",label:"Scale",tip:"Value of zoom should be incremented/decremented",changeProp:!0,min:0,value:1}]}}},m="sourceType",j="data-iframe",R={name:"href",type:"file",label:"Image Source"},K={name:"data-src",label:"Video Source",placeholder:"https://www.youtube.com/watch?v=..."},J={name:"data-poster",label:"Video Poster",type:"file"},ae={name:"data-src",label:"External Source",placeholder:"https://some-external-source.com/...."},le={label:"Caption",name:"data-sub-html",placeholder:"My caption",changeProp:!1},ke={[N]:{type:"button",label:"Toggle Gallery",command:(e,n)=>{var o,u;const t=n.target,l=(o=t==null?void 0:t.closestType(T))==null?void 0:o.getView();if(l&&t){const r=((u=l.getLightGallery())==null?void 0:u.items)||[],p=Array.from(r).indexOf(t.getEl());p>=0&&l.toggleGallery(p)}}},[m]:{type:"radio",label:"Source type",labelToTitle:!0,value:"image",subTraits:{image:[R],video:[K,J],external:[ae]},options:[{id:"image",label:R.label||"",icon:w.image},{id:"video",label:K.label||"",icon:w.video},{id:"external",label:ae.label||"",icon:w.external}]},subHtml:le},ne="lgThumbnail",Le="lgVideo",oe="lgAutoplay",ie="lgZoom",G="https://cdn.jsdelivr.net/npm/lightgallery@2.8.2";return ye(function(e,n={}){const{Blocks:t,Components:l}=e,o="LightGallery",u="LightGallery Item",r={toolbarIconOpen:w.eye,block:{},lgLicenseKey:"92DE1DB8-7986-4F02-B908-514F97678D28",defaultSrc:"https://placehold.co/200/777/white.png?text=Image",plugins:[ne,Le,oe,ie],cdnScript:[`${G}/lightgallery.min.js`,`${G}/plugins/thumbnail/lg-thumbnail.min.js`,`${G}/plugins/video/lg-video.min.js`,`${G}/plugins/autoplay/lg-autoplay.min.js`,`${G}/plugins/zoom/lg-zoom.min.js`],cdnStyle:`${G}/css/lightgallery-bundle.min.css`,...n},{block:p,toolbarIconOpen:h,defaultSrc:c}=r,b=function(a){const i=this,g=window,{plugins:y,cdnScript:x,cdnStyle:D,inline:se,lgLicenseKey:Ee,...f}=a||{},A=d=>isNaN(d)?void 0:parseInt(d,10),re=()=>{var z;const d={...f,licenseKey:Ee,speed:A(f.speed),startAnimationDuration:A(f.startAnimationDuration),thumbMargin:A(f.thumbMargin),thumbWidth:A(f.thumbWidth),slideShowInterval:A(f.slideShowInterval),scale:A(f.scale),enableZoomAfter:A(f.enableZoomAfter),plugins:(y||[]).map(B=>g[B])};se&&(d.container=i,d.closable=!1);const Q=(z=g.lightGallery)==null?void 0:z.call(g,i,d);se&&Q.openGallery()};if(g.lightGallery)re();else{const{head:d}=document,Q=Array.isArray(x)?[...x]:[x],z=Array.isArray(D)?[...D]:[D],B=I=>{if(I.length){const v=document.createElement("link");v.href=I.shift(),v.rel="stylesheet",d.appendChild(v),B(I)}},ce=I=>{if(I.length){const v=document.createElement("script");v.src=I.shift(),v.onerror=v.onload=ce.bind(null,I),d.appendChild(v)}else re()};B(z),ce(Q)}},s=a=>{const i=a.getTrait(N);if(!h||!i)return;const{toolbar:g}=a,y={id:N,label:h,command:()=>setTimeout(()=>i.runCommand(),100)};!g.find(D=>D.id===y.id)&&(g==null||g.unshift(y))};let O=[];const C=r.plugins||[],S=_(xe),U=C.includes(ne)?_(Ae):Z,V=C.includes(oe)?_(Ie):Z,M=C.includes(ie)?_(Pe):Z;l.addType(T,{block:p&&{label:o,media:w.gallery,category:"Extra",select:!0,...r.block},isComponent:a=>W(a,$),extendFn:["init","initToolbar"],model:{defaults:{name:o,icon:w.gallery,draggable:(a,i)=>!i.is(T),attributes:{[$]:!0},components:{type:ee},script:b,selector:"",exThumbImage:"",cdnScript:r.cdnScript,cdnStyle:r.cdnStyle,plugins:r.plugins,lgLicenseKey:r.lgLicenseKey,"script-props":["lgLicenseKey","cdnScript","cdnStyle","plugins","selector","exThumbImage",...S.propKeys,...U.propKeys,...V.propKeys,...M.propKeys],...S.props,...U.props,...V.props,...M.props,traits:[...S.traits,...U.traits,...V.traits,...M.traits]},init(){q(this,["thumbnail"]),q(this,["autoplay"]),q(this,["zoom"])},initToolbar(){s(this)}},extendFnView:["init"],view:{events:()=>({lgInit:"onLgInit",lgBeforeOpen:"onLgOpen",lgAfterClose:"onLgClose"}),init(){this.listenTo(this.model,l.events.scriptUnmount,this.destroyLightGallery)},getLightGallery(){return this.el.__lg},destroyLightGallery(){const a=this.getLightGallery();a==null||a.destroy()},disableLgInCanvas(){const a=this.getLightGallery();a.lgOpened=!0},isInlineGallery(){var i;const a=this.getLightGallery();return((i=a==null?void 0:a.settings)==null?void 0:i.container)===this.el},onLgInit(a){this.el.__lg=a.detail.instance,!this.isInlineGallery()&&this.disableLgInCanvas()},onLgOpen(){const{em:a}=this,{Canvas:i}=a,g=this.getLightGallery();O=i.getSpots(),setTimeout(()=>i.removeSpots()),g.__lgOpened=!0},onLgClose(){const a=this.getLightGallery();O.forEach(i=>this.em.Canvas.addSpot(i.attributes)),O=[],a.__lgOpened=!1,setTimeout(()=>this.disableLgInCanvas())},toggleGallery(a){const i=this.getLightGallery();if(i.__lgOpened)return i.closeGallery(!0);i.lgOpened=!1,i.openGallery(a)}}});const H=_(ke);l.addType(ee,{isComponent:a=>W(a,te)||a.tagName==="A"&&W(a.parentElement,$),extendFn:["init","initToolbar"],model:{defaults:{tagName:"a",name:u,icon:w.galleryItem,attributes:{[te]:!0,href:c},components:{type:"image",attributes:{alt:"Image",src:c}},...H.props,traits:[...H.traits]},init(){const a=[m].map(i=>`change:${i}`).join(" ");this.initSourceType(),this.on(a,this.updateTraits),this.updateTraits({init:!0}),this.initScriptUpdate(),Se(this,m,this.triggerGalleryUpdate)},initToolbar(){s(this)},initScriptUpdate(){const a=[le.name].map(i=>`change:attributes:${i}`).join(" ");this.on(a,this.triggerGalleryUpdate)},triggerGalleryUpdate(...a){var i;(i=this.closestType(T))==null||i.__scriptPropsChange(...a)},updateTraits(a={}){const{changed:i}=this,{init:g}=a;if(i[m]||g){F(this,m);const y=this.getTrait(m).getValue();if(y===E.image){this.removeAttributes([K.name,J.name,j]);const x=this.getTrait(R.name);x.setValue(x.getValue()||c)}else y===E.video?this.removeAttributes([j]):y===E.external&&this.addAttributes({[j]:!0})}},initSourceType(){const a=this.getAttributes({noClass:!0,noStyle:!0});a[j]?this.set(m,E.external):(a[K.name]||a[J.name])&&this.set(m,E.video)}}}),fe({editor:e,plan:we,licenseKey:r.licenseKey,pluginName:Te,cleanup:()=>{t.remove(T),l.removeType(T)}})})});
@@ -1,4 +1,4 @@
1
- "use strict";const T="app.grapesjs.com",A="app-stage.grapesjs.com",v="app2.grapesjs.com",I="app-stage2.grapesjs.com",y=[T,v,A,I,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],C="license:check:start",L="license:check:end",N=()=>typeof window<"u",D=({isDev:e,isStage:s})=>`${e?"":`https://${s?A:T}`}/api`,E=()=>{const e=N()&&window.location.hostname;return!!e&&(y.includes(e)||y.some(s=>e.endsWith(s)))};async function U({path:e,baseApiUrl:s,method:i="GET",headers:o={},params:a,body:c}){const g=`${s||D({isDev:!1,isStage:!1})}${e}`,r={method:i,headers:{"Content-Type":"application/json",...o}};c&&(r.body=JSON.stringify(c));const m=a?new URLSearchParams(a).toString():"",t=m?`?${m}`:"",l=await fetch(`${g}${t}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{});const k={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function $(e){const s=e;return s.init=i=>o=>e(o,i),s}const P=e=>$(e);async function _({editor:e,plan:s,pluginName:i,licenseKey:o,cleanup:a}){let c="",p=!1;const g=E(),r=t=>{console.warn("Cleanup plugin:",i,"Reason:",t),a()},m=(t={})=>{var d;const{error:l,sdkLicense:b}=t,n=(d=t.plan)==null?void 0:d.category;if(!(b||t.license)||l)r(l||"Invalid license");else if(n){const w=k[s],f=k[n];w>f&&r({pluginRequiredPlan:s,licensePlan:n})}};e.on(C,t=>{c=t==null?void 0:t.baseApiUrl,p=!0}),e.on(L,t=>{m(t)}),setTimeout(async()=>{if(!p){if(g)return;if(o){const t=await x({licenseKey:o,pluginName:i,baseApiUrl:c});t&&m(t)}else r("The `licenseKey` option not provided")}},2e3)}async function x(e){const{licenseKey:s,pluginName:i,baseApiUrl:o}=e;try{return(await U({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const S="linkImageComponent",O=h.startup,W=function(e,s={}){const{Components:i,Blocks:o}=e,a="link-image",c="Link Image",p="link-image",{model:g,view:r}=e.Components.getType("image"),m=i.getType("link").model.getDefaults().traits,t=g.getDefaults().traits,l=m.filter(n=>n!=="title"),b=t.filter(n=>n.name!=="customAttributes").map(n=>typeof n=="string"?{name:n}:n).map(n=>({...n,getValue({component:u}){var d;return(d=u.components().at(0).getTrait(n.name))==null?void 0:d.getValue()},setValue({component:u,value:d,options:w}){var f;(f=u.components().at(0).getTrait(n.name))==null||f.setValue(d,w)}}));i.addType(a,{isComponent:n=>{var u;return n.tagName==="A"&&((u=n.children)==null?void 0:u.length)===1&&n.children[0].tagName==="IMG"},block:{label:c,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:c,classes:p,resizable:{ratioDefault:!0},traits:[...b,...l],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
1
+ "use strict";const A="app.grapesjs.com",v="app-stage.grapesjs.com",N="app2.grapesjs.com",D="app-stage2.grapesjs.com",y=[A,N,v,D,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],k="license:check:start",E="license:check:end",$=()=>typeof window<"u",U=({isDev:t,isStage:a,isPlatform:i})=>`${t?"":`https://${a?v:A}`}/${i?"platform-api":"api"}`,P=()=>{const t=$()&&window.location.hostname;return!!t&&(y.includes(t)||y.some(a=>t.endsWith(a)))};async function _({path:t,baseApiUrl:a,method:i="GET",headers:o={},params:s,body:l}){const m=`${a||U({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...o}};l&&(u.body=JSON.stringify(l));const c=s?new URLSearchParams(s).toString():"",d=c?`?${c}`:"",n=await fetch(`${m}${d}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var g=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(g||{});const T={[g.free]:0,[g.startup]:10,[g.business]:20,[g.enterprise]:30};function x(t){const a=t;return a.init=i=>o=>t(o,i),a}const S=t=>x(t);async function O({editor:t,plan:a,pluginName:i,licenseKey:o,onLicenseCheckResponse:s,cleanup:l}){let p="",m=!1;const u=P(),c=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),l()},d=(n={})=>{var b;const{error:f,sdkLicense:e}=n,r=(b=n.plan)==null?void 0:b.category;if(!(e||n.license)||f)c(f||"Invalid license");else if(r){const w=T[a],I=T[r];w>I&&c({pluginRequiredPlan:a,licensePlan:r})}};t.on(k,n=>{p=n==null?void 0:n.baseApiUrl,m=!0}),t.on(E,n=>{s==null||s(n),d(n)}),setTimeout(async()=>{if(!m){if(u)return;if(o){const n=await W({licenseKey:o,pluginName:i,baseApiUrl:p});s==null||s(n),n&&d(n)}else c("The `licenseKey` option not provided")}},2e3)}async function W(t){const{licenseKey:a,pluginName:i,baseApiUrl:o}=t;try{return(await _({baseApiUrl:o,path:`/sdk/${a||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const j="linkImageComponent",C=g.startup,L=function(t,a={}){const{Components:i,Blocks:o}=t,s="link-image",l="Link Image",p="link-image",{model:m,view:u}=t.Components.getType("image"),c=i.getType("link").model.getDefaults().traits,d=m.getDefaults().traits,n=c.filter(e=>e!=="title"),f=d.filter(e=>e.name!=="customAttributes").map(e=>typeof e=="string"?{name:e}:e).map(e=>({...e,getValue({component:r}){var h;return(h=r.components().at(0).getTrait(e.name))==null?void 0:h.getValue()},setValue({component:r,value:h,options:b}){var w;(w=r.components().at(0).getTrait(e.name))==null||w.setValue(h,b)}}));i.addType(s,{isComponent:e=>{var r;return e.tagName==="A"&&((r=e.children)==null?void 0:r.length)===1&&e.children[0].tagName==="IMG"},block:{label:l,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:l,classes:p,resizable:{ratioDefault:!0},traits:[...f,...n],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
2
2
  .${p} {
3
3
  display: inline-block;
4
4
  overflow: hidden;
@@ -9,4 +9,4 @@
9
9
  width: 100%;
10
10
  height: 100%;
11
11
  }
12
- `},init(){const n=this.components().at(0);n==null||n.set({layerable:!1,locked:!0})}},view:{onActive(n){r.prototype.onActive.call(this,n)}}}),_({editor:e,licenseKey:s.licenseKey,plan:O,pluginName:S,cleanup:()=>{i.removeType(a),o.remove(a)}})},j=P(W);module.exports=j;
12
+ `},init(){const e=this.components().at(0);e==null||e.set({layerable:!1,locked:!0})}},view:{onActive(e){u.prototype.onActive.call(this,e)}}}),O({editor:t,licenseKey:a.licenseKey,plan:C,pluginName:j,cleanup:()=>{i.removeType(s),o.remove(s)}})},M=S(L);module.exports=M;
@@ -1,8 +1,8 @@
1
- const T = "app.grapesjs.com", A = "app-stage.grapesjs.com", v = "app2.grapesjs.com", I = "app-stage2.grapesjs.com", y = [
2
- T,
3
- v,
1
+ const A = "app.grapesjs.com", v = "app-stage.grapesjs.com", N = "app2.grapesjs.com", D = "app-stage2.grapesjs.com", y = [
4
2
  A,
5
- I,
3
+ N,
4
+ v,
5
+ D,
6
6
  "localhost",
7
7
  "127.0.0.1",
8
8
  ".local-credentialless.webcontainer.io",
@@ -11,112 +11,117 @@ const T = "app.grapesjs.com", A = "app-stage.grapesjs.com", v = "app2.grapesjs.c
11
11
  // For stackblitz.com demos
12
12
  "-sandpack.codesandbox.io"
13
13
  // For Sandpack demos
14
- ], C = "license:check:start", L = "license:check:end", N = () => typeof window < "u", D = ({ isDev: e, isStage: s }) => `${e ? "" : `https://${s ? A : T}`}/api`, E = () => {
15
- const e = N() && window.location.hostname;
16
- return !!e && (y.includes(e) || y.some((s) => e.endsWith(s)));
14
+ ], k = "license:check:start", E = "license:check:end", $ = () => typeof window < "u", U = ({
15
+ isDev: e,
16
+ isStage: a,
17
+ isPlatform: i
18
+ }) => `${e ? "" : `https://${a ? v : A}`}/${i ? "platform-api" : "api"}`, P = () => {
19
+ const e = $() && window.location.hostname;
20
+ return !!e && (y.includes(e) || y.some((a) => e.endsWith(a)));
17
21
  };
18
- async function U({
22
+ async function _({
19
23
  path: e,
20
- baseApiUrl: s,
24
+ baseApiUrl: a,
21
25
  method: i = "GET",
22
26
  headers: o = {},
23
- params: a,
27
+ params: s,
24
28
  body: c
25
29
  }) {
26
- const g = `${s || D({ isDev: !1, isStage: !1 })}${e}`, r = {
30
+ const m = `${a || U({ isDev: !1, isStage: !1 })}${e}`, u = {
27
31
  method: i,
28
32
  headers: {
29
33
  "Content-Type": "application/json",
30
34
  ...o
31
35
  }
32
36
  };
33
- c && (r.body = JSON.stringify(c));
34
- const m = a ? new URLSearchParams(a).toString() : "", t = m ? `?${m}` : "", l = await fetch(`${g}${t}`, r);
35
- if (!l.ok)
36
- throw new Error(`HTTP error! status: ${l.status}`);
37
- return l.json();
37
+ c && (u.body = JSON.stringify(c));
38
+ const l = s ? new URLSearchParams(s).toString() : "", d = l ? `?${l}` : "", n = await fetch(`${m}${d}`, u);
39
+ if (!n.ok)
40
+ throw new Error(`HTTP error! status: ${n.status}`);
41
+ return n.json();
38
42
  }
39
- var h = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(h || {});
40
- const k = {
41
- [h.free]: 0,
42
- [h.startup]: 10,
43
- [h.business]: 20,
44
- [h.enterprise]: 30
43
+ var g = /* @__PURE__ */ ((e) => (e.free = "free", e.startup = "startup", e.business = "business", e.enterprise = "enterprise", e))(g || {});
44
+ const T = {
45
+ [g.free]: 0,
46
+ [g.startup]: 10,
47
+ [g.business]: 20,
48
+ [g.enterprise]: 30
45
49
  };
46
- function $(e) {
47
- const s = e;
48
- return s.init = (i) => (o) => e(o, i), s;
50
+ function x(e) {
51
+ const a = e;
52
+ return a.init = (i) => (o) => e(o, i), a;
49
53
  }
50
- const P = (e) => /* @__PURE__ */ $(e);
51
- async function _({
54
+ const S = (e) => /* @__PURE__ */ x(e);
55
+ async function O({
52
56
  editor: e,
53
- plan: s,
57
+ plan: a,
54
58
  pluginName: i,
55
59
  licenseKey: o,
56
- cleanup: a
60
+ onLicenseCheckResponse: s,
61
+ cleanup: c
57
62
  }) {
58
- let c = "", p = !1;
59
- const g = E(), r = (t) => {
60
- console.warn("Cleanup plugin:", i, "Reason:", t), a();
61
- }, m = (t = {}) => {
62
- var d;
63
- const { error: l, sdkLicense: b } = t, n = (d = t.plan) == null ? void 0 : d.category;
64
- if (!(b || t.license) || l)
65
- r(l || "Invalid license");
66
- else if (n) {
67
- const w = k[s], f = k[n];
68
- w > f && r({ pluginRequiredPlan: s, licensePlan: n });
63
+ let p = "", m = !1;
64
+ const u = P(), l = (n) => {
65
+ console.warn("Cleanup plugin:", i, "Reason:", n), c();
66
+ }, d = (n = {}) => {
67
+ var b;
68
+ const { error: f, sdkLicense: t } = n, r = (b = n.plan) == null ? void 0 : b.category;
69
+ if (!(t || n.license) || f)
70
+ l(f || "Invalid license");
71
+ else if (r) {
72
+ const w = T[a], I = T[r];
73
+ w > I && l({ pluginRequiredPlan: a, licensePlan: r });
69
74
  }
70
75
  };
71
- e.on(C, (t) => {
72
- c = t == null ? void 0 : t.baseApiUrl, p = !0;
73
- }), e.on(L, (t) => {
74
- m(t);
76
+ e.on(k, (n) => {
77
+ p = n == null ? void 0 : n.baseApiUrl, m = !0;
78
+ }), e.on(E, (n) => {
79
+ s == null || s(n), d(n);
75
80
  }), setTimeout(async () => {
76
- if (!p) {
77
- if (g) return;
81
+ if (!m) {
82
+ if (u) return;
78
83
  if (o) {
79
- const t = await x({ licenseKey: o, pluginName: i, baseApiUrl: c });
80
- t && m(t);
84
+ const n = await W({ licenseKey: o, pluginName: i, baseApiUrl: p });
85
+ s == null || s(n), n && d(n);
81
86
  } else
82
- r("The `licenseKey` option not provided");
87
+ l("The `licenseKey` option not provided");
83
88
  }
84
89
  }, 2e3);
85
90
  }
86
- async function x(e) {
87
- const { licenseKey: s, pluginName: i, baseApiUrl: o } = e;
91
+ async function W(e) {
92
+ const { licenseKey: a, pluginName: i, baseApiUrl: o } = e;
88
93
  try {
89
- return (await U({
94
+ return (await _({
90
95
  baseApiUrl: o,
91
- path: `/sdk/${s || "na"}`,
96
+ path: `/sdk/${a || "na"}`,
92
97
  method: "POST",
93
98
  params: {
94
99
  d: window.location.hostname,
95
100
  pn: i
96
101
  }
97
102
  })).result || {};
98
- } catch (a) {
99
- return console.error("Error during SDK license check:", a), !1;
103
+ } catch (s) {
104
+ return console.error("Error during SDK license check:", s), !1;
100
105
  }
101
106
  }
102
- const S = "linkImageComponent", O = h.startup, W = function(e, s = {}) {
103
- const { Components: i, Blocks: o } = e, a = "link-image", c = "Link Image", p = "link-image", { model: g, view: r } = e.Components.getType("image"), m = i.getType("link").model.getDefaults().traits, t = g.getDefaults().traits, l = m.filter((n) => n !== "title"), b = t.filter((n) => n.name !== "customAttributes").map((n) => typeof n == "string" ? { name: n } : n).map(
104
- (n) => ({
105
- ...n,
106
- getValue({ component: u }) {
107
- var d;
108
- return (d = u.components().at(0).getTrait(n.name)) == null ? void 0 : d.getValue();
107
+ const j = "linkImageComponent", C = g.startup, L = function(e, a = {}) {
108
+ const { Components: i, Blocks: o } = e, s = "link-image", c = "Link Image", p = "link-image", { model: m, view: u } = e.Components.getType("image"), l = i.getType("link").model.getDefaults().traits, d = m.getDefaults().traits, n = l.filter((t) => t !== "title"), f = d.filter((t) => t.name !== "customAttributes").map((t) => typeof t == "string" ? { name: t } : t).map(
109
+ (t) => ({
110
+ ...t,
111
+ getValue({ component: r }) {
112
+ var h;
113
+ return (h = r.components().at(0).getTrait(t.name)) == null ? void 0 : h.getValue();
109
114
  },
110
- setValue({ component: u, value: d, options: w }) {
111
- var f;
112
- (f = u.components().at(0).getTrait(n.name)) == null || f.setValue(d, w);
115
+ setValue({ component: r, value: h, options: b }) {
116
+ var w;
117
+ (w = r.components().at(0).getTrait(t.name)) == null || w.setValue(h, b);
113
118
  }
114
119
  })
115
120
  );
116
- i.addType(a, {
117
- isComponent: (n) => {
118
- var u;
119
- return n.tagName === "A" && ((u = n.children) == null ? void 0 : u.length) === 1 && n.children[0].tagName === "IMG";
121
+ i.addType(s, {
122
+ isComponent: (t) => {
123
+ var r;
124
+ return t.tagName === "A" && ((r = t.children) == null ? void 0 : r.length) === 1 && t.children[0].tagName === "IMG";
120
125
  },
121
126
  block: {
122
127
  label: c,
@@ -129,7 +134,7 @@ const S = "linkImageComponent", O = h.startup, W = function(e, s = {}) {
129
134
  name: c,
130
135
  classes: p,
131
136
  resizable: { ratioDefault: !0 },
132
- traits: [...b, ...l],
137
+ traits: [...f, ...n],
133
138
  droppable: !1,
134
139
  stylable: [
135
140
  "width",
@@ -165,25 +170,25 @@ const S = "linkImageComponent", O = h.startup, W = function(e, s = {}) {
165
170
  `
166
171
  },
167
172
  init() {
168
- const n = this.components().at(0);
169
- n == null || n.set({ layerable: !1, locked: !0 });
173
+ const t = this.components().at(0);
174
+ t == null || t.set({ layerable: !1, locked: !0 });
170
175
  }
171
176
  },
172
177
  view: {
173
- onActive(n) {
174
- r.prototype.onActive.call(this, n);
178
+ onActive(t) {
179
+ u.prototype.onActive.call(this, t);
175
180
  }
176
181
  }
177
- }), _({
182
+ }), O({
178
183
  editor: e,
179
- licenseKey: s.licenseKey,
180
- plan: O,
181
- pluginName: S,
184
+ licenseKey: a.licenseKey,
185
+ plan: C,
186
+ pluginName: j,
182
187
  cleanup: () => {
183
- i.removeType(a), o.remove(a);
188
+ i.removeType(s), o.remove(s);
184
189
  }
185
190
  });
186
- }, j = P(W);
191
+ }, M = S(L);
187
192
  export {
188
- j as default
193
+ M as default
189
194
  };
@@ -1,4 +1,4 @@
1
- (function(h,g){typeof exports=="object"&&typeof module<"u"?module.exports=g():typeof define=="function"&&define.amd?define(g):(h=typeof globalThis<"u"?globalThis:h||self,h.StudioSdkPlugins_linkImageComponent=g())})(this,function(){"use strict";const h="app.grapesjs.com",g="app-stage.grapesjs.com",k=[h,"app2.grapesjs.com",g,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],I="license:check:start",v="license:check:end",C=()=>typeof window<"u",D=({isDev:e,isStage:s})=>`${e?"":`https://${s?g:h}`}/api`,N=()=>{const e=C()&&window.location.hostname;return!!e&&(k.includes(e)||k.some(s=>e.endsWith(s)))};async function L({path:e,baseApiUrl:s,method:i="GET",headers:o={},params:a,body:c}){const b=`${s||D({isDev:!1,isStage:!1})}${e}`,r={method:i,headers:{"Content-Type":"application/json",...o}};c&&(r.body=JSON.stringify(c));const m=a?new URLSearchParams(a).toString():"",t=m?`?${m}`:"",l=await fetch(`${b}${t}`,r);if(!l.ok)throw new Error(`HTTP error! status: ${l.status}`);return l.json()}var f=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(f||{});const A={[f.free]:0,[f.startup]:10,[f.business]:20,[f.enterprise]:30};function E(e){const s=e;return s.init=i=>o=>e(o,i),s}const _=e=>E(e);async function P({editor:e,plan:s,pluginName:i,licenseKey:o,cleanup:a}){let c="",p=!1;const b=N(),r=t=>{console.warn("Cleanup plugin:",i,"Reason:",t),a()},m=(t={})=>{var u;const{error:l,sdkLicense:y}=t,n=(u=t.plan)==null?void 0:u.category;if(!(y||t.license)||l)r(l||"Invalid license");else if(n){const T=A[s],w=A[n];T>w&&r({pluginRequiredPlan:s,licensePlan:n})}};e.on(I,t=>{c=t==null?void 0:t.baseApiUrl,p=!0}),e.on(v,t=>{m(t)}),setTimeout(async()=>{if(!p){if(b)return;if(o){const t=await S({licenseKey:o,pluginName:i,baseApiUrl:c});t&&m(t)}else r("The `licenseKey` option not provided")}},2e3)}async function S(e){const{licenseKey:s,pluginName:i,baseApiUrl:o}=e;try{return(await L({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(a){return console.error("Error during SDK license check:",a),!1}}const x="linkImageComponent",O=f.startup;return _(function(e,s={}){const{Components:i,Blocks:o}=e,a="link-image",c="Link Image",p="link-image",{model:b,view:r}=e.Components.getType("image"),m=i.getType("link").model.getDefaults().traits,t=b.getDefaults().traits,l=m.filter(n=>n!=="title"),y=t.filter(n=>n.name!=="customAttributes").map(n=>typeof n=="string"?{name:n}:n).map(n=>({...n,getValue({component:d}){var u;return(u=d.components().at(0).getTrait(n.name))==null?void 0:u.getValue()},setValue({component:d,value:u,options:T}){var w;(w=d.components().at(0).getTrait(n.name))==null||w.setValue(u,T)}}));i.addType(a,{isComponent:n=>{var d;return n.tagName==="A"&&((d=n.children)==null?void 0:d.length)===1&&n.children[0].tagName==="IMG"},block:{label:c,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:c,classes:p,resizable:{ratioDefault:!0},traits:[...y,...l],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
1
+ (function(m,d){typeof exports=="object"&&typeof module<"u"?module.exports=d():typeof define=="function"&&define.amd?define(d):(m=typeof globalThis<"u"?globalThis:m||self,m.StudioSdkPlugins_linkImageComponent=d())})(this,function(){"use strict";const m="app.grapesjs.com",d="app-stage.grapesjs.com",A=[m,"app2.grapesjs.com",d,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],v="license:check:start",D="license:check:end",N=()=>typeof window<"u",k=({isDev:e,isStage:s,isPlatform:a})=>`${e?"":`https://${s?d:m}`}/${a?"platform-api":"api"}`,E=()=>{const e=N()&&window.location.hostname;return!!e&&(A.includes(e)||A.some(s=>e.endsWith(s)))};async function _({path:e,baseApiUrl:s,method:a="GET",headers:o={},params:i,body:c}){const g=`${s||k({isDev:!1,isStage:!1})}${e}`,h={method:a,headers:{"Content-Type":"application/json",...o}};c&&(h.body=JSON.stringify(c));const r=i?new URLSearchParams(i).toString():"",f=r?`?${r}`:"",n=await fetch(`${g}${f}`,h);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var u=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(u||{});const I={[u.free]:0,[u.startup]:10,[u.business]:20,[u.enterprise]:30};function P(e){const s=e;return s.init=a=>o=>e(o,a),s}const S=e=>P(e);async function $({editor:e,plan:s,pluginName:a,licenseKey:o,onLicenseCheckResponse:i,cleanup:c}){let p="",g=!1;const h=E(),r=n=>{console.warn("Cleanup plugin:",a,"Reason:",n),c()},f=(n={})=>{var y;const{error:w,sdkLicense:t}=n,l=(y=n.plan)==null?void 0:y.category;if(!(t||n.license)||w)r(w||"Invalid license");else if(l){const T=I[s],M=I[l];T>M&&r({pluginRequiredPlan:s,licensePlan:l})}};e.on(v,n=>{p=n==null?void 0:n.baseApiUrl,g=!0}),e.on(D,n=>{i==null||i(n),f(n)}),setTimeout(async()=>{if(!g){if(h)return;if(o){const n=await x({licenseKey:o,pluginName:a,baseApiUrl:p});i==null||i(n),n&&f(n)}else r("The `licenseKey` option not provided")}},2e3)}async function x(e){const{licenseKey:s,pluginName:a,baseApiUrl:o}=e;try{return(await _({baseApiUrl:o,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:a}})).result||{}}catch(i){return console.error("Error during SDK license check:",i),!1}}const O="linkImageComponent",U=u.startup;return S(function(e,s={}){const{Components:a,Blocks:o}=e,i="link-image",c="Link Image",p="link-image",{model:g,view:h}=e.Components.getType("image"),r=a.getType("link").model.getDefaults().traits,f=g.getDefaults().traits,n=r.filter(t=>t!=="title"),w=f.filter(t=>t.name!=="customAttributes").map(t=>typeof t=="string"?{name:t}:t).map(t=>({...t,getValue({component:l}){var b;return(b=l.components().at(0).getTrait(t.name))==null?void 0:b.getValue()},setValue({component:l,value:b,options:y}){var T;(T=l.components().at(0).getTrait(t.name))==null||T.setValue(b,y)}}));a.addType(i,{isComponent:t=>{var l;return t.tagName==="A"&&((l=t.children)==null?void 0:l.length)===1&&t.children[0].tagName==="IMG"},block:{label:c,media:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M2 6.3A2.3 2.3 0 0 1 4.3 4h15.4A2.3 2.3 0 0 1 22 6.3v7a4.7 4.7 0 0 0-2.8-.8h-3.4a4.8 4.8 0 0 0-4 7.5H4.3A2.3 2.3 0 0 1 2 17.7zm21 11a3.8 3.8 0 0 0-3.8-3.8.8.8 0 0 0 0 1.5h.2a2.3 2.3 0 0 1-.1 4.5H19a.8.8 0 0 0 .2 1.5h.2a3.8 3.8 0 0 0 3.5-3.8m-6.5-3a.8.8 0 0 0-.8-.7h-.1a3.8 3.8 0 0 0 .2 7.5.8.8 0 0 0 0-1.5h-.2a2.3 2.3 0 0 1 .2-4.5.8.8 0 0 0 .7-.7m3.5 3a.8.8 0 0 0-.8-.8h-3.6a.8.8 0 0 0 .2 1.5h3.6a.8.8 0 0 0 .6-.8"/></svg>'},extend:"link",extendFn:["init"],model:{defaults:{name:c,classes:p,resizable:{ratioDefault:!0},traits:[...w,...n],droppable:!1,stylable:["width","min-width","max-width","height","min-height","max-height","padding","margin","position","border-radius","border-width","border-style","border-color","opacity","box-shadow","filter","transform"],components:{type:"image"},styles:`
2
2
  .${p} {
3
3
  display: inline-block;
4
4
  overflow: hidden;
@@ -9,4 +9,4 @@
9
9
  width: 100%;
10
10
  height: 100%;
11
11
  }
12
- `},init(){const n=this.components().at(0);n==null||n.set({layerable:!1,locked:!0})}},view:{onActive(n){r.prototype.onActive.call(this,n)}}}),P({editor:e,licenseKey:s.licenseKey,plan:O,pluginName:x,cleanup:()=>{i.removeType(a),o.remove(a)}})})});
12
+ `},init(){const t=this.components().at(0);t==null||t.set({layerable:!1,locked:!0})}},view:{onActive(t){h.prototype.onActive.call(this,t)}}}),$({editor:e,licenseKey:s.licenseKey,plan:U,pluginName:O,cleanup:()=>{a.removeType(i),o.remove(i)}})})});
@@ -1,11 +1,11 @@
1
- "use strict";const _="app.grapesjs.com",N="app-stage.grapesjs.com",D="app2.grapesjs.com",R="app-stage2.grapesjs.com",C=[_,D,N,R,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],S="license:check:start",x="license:check:end",O=()=>typeof window<"u",U=({isDev:e,isStage:s})=>`${e?"":`https://${s?N:_}`}/api`,W=()=>{const e=O()&&window.location.hostname;return!!e&&(C.includes(e)||C.some(s=>e.endsWith(s)))};async function j({path:e,baseApiUrl:s,method:i="GET",headers:t={},params:o,body:a}){const c=`${s||U({isDev:!1,isStage:!1})}${e}`,l={method:i,headers:{"Content-Type":"application/json",...t}};a&&(l.body=JSON.stringify(a));const u=o?new URLSearchParams(o).toString():"",n=u?`?${u}`:"",r=await fetch(`${c}${n}`,l);if(!r.ok)throw new Error(`HTTP error! status: ${r.status}`);return r.json()}var h=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(h||{});const M={[h.free]:0,[h.startup]:10,[h.business]:20,[h.enterprise]:30};function B(e){const s=e;return s.init=i=>t=>e(t,i),s}const K=e=>B(e);async function G({editor:e,plan:s,pluginName:i,licenseKey:t,cleanup:o}){let a="",p=!1;const c=W(),l=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),o()},u=(n={})=>{var P;const{error:r,sdkLicense:I}=n,f=(P=n.plan)==null?void 0:P.category;if(!(I||n.license)||r)l(r||"Invalid license");else if(f){const A=M[s],b=M[f];A>b&&l({pluginRequiredPlan:s,licensePlan:f})}};e.on(S,n=>{a=n==null?void 0:n.baseApiUrl,p=!0}),e.on(x,n=>{u(n)}),setTimeout(async()=>{if(!p){if(c)return;if(t){const n=await F({licenseKey:t,pluginName:i,baseApiUrl:a});n&&u(n)}else l("The `licenseKey` option not provided")}},2e3)}async function F(e){const{licenseKey:s,pluginName:i,baseApiUrl:t}=e;try{return(await j({baseApiUrl:t,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const v="gjs-plg-",q="listPagesComponent",X=h.startup;function Y(e,s,i){let t,o,a,p,c;const l=s;function u(){const r=Date.now()-p;r<l&&r>=0?t=setTimeout(u,l-r):(t=null,c=e.apply(a,o),a=o=null)}const n=function(){return a=this,o=arguments,p=Date.now(),t||(t=setTimeout(u,l)),c};return n.clear=function(){t&&(clearTimeout(t),t=null)},n.flush=function(){t&&(c=e.apply(a,o),a=o=null,clearTimeout(t),t=null)},n}const k="page://",m="list-pages",d="list-pages-item",g="list-pages-link",Z=e=>e.components().reduce((s,i)=>{var p;const t=i.findFirstType(g),o=(p=t==null?void 0:t.attributes.attributes)==null?void 0:p.href,a=o!=null&&o.startsWith(k)?o.replace(k,""):"";if(a&&t){const c=s[a];c?c.push(t):s[a]=[t]}return s},{}),T="data-type-role",J="page_root",z=e=>s=>s.is(e),Q=e=>(s,i)=>i.is(e),w=e=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,T))===e},ee=function(e,s={}){const{Blocks:i,Components:t,Pages:o}=e,{licenseKey:a,block:p={}}=s,c="List Pages",l="List Pages Item",u="Link",n=`${v}${m}`,r=`${v}${g}`,I='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',f='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';t.addType(m,{block:p&&{label:c,media:I,category:"Extra",select:!0,...s.block},isComponent:w(m),model:{defaults:{tagName:"ul",name:c,[J]:"",classes:n,attributes:{[T]:m,role:"navigation"},droppable:z(d),styles:`
2
- .${n} {
1
+ "use strict";const D="app.grapesjs.com",C="app-stage.grapesjs.com",S="app2.grapesjs.com",x="app-stage2.grapesjs.com",v=[D,S,C,x,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],O="license:check:start",U="license:check:end",k=()=>typeof window<"u",W=({isDev:t,isStage:s,isPlatform:i})=>`${t?"":`https://${s?C:D}`}/${i?"platform-api":"api"}`,j=()=>{const t=k()&&window.location.hostname;return!!t&&(v.includes(t)||v.some(s=>t.endsWith(s)))};async function B({path:t,baseApiUrl:s,method:i="GET",headers:e={},params:o,body:a}){const c=`${s||W({isDev:!1,isStage:!1})}${t}`,u={method:i,headers:{"Content-Type":"application/json",...e}};a&&(u.body=JSON.stringify(a));const r=o?new URLSearchParams(o).toString():"",p=r?`?${r}`:"",n=await fetch(`${c}${p}`,u);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);return n.json()}var y=(t=>(t.free="free",t.startup="startup",t.business="business",t.enterprise="enterprise",t))(y||{});const _={[y.free]:0,[y.startup]:10,[y.business]:20,[y.enterprise]:30};function K(t){const s=t;return s.init=i=>e=>t(e,i),s}const G=t=>K(t);async function F({editor:t,plan:s,pluginName:i,licenseKey:e,onLicenseCheckResponse:o,cleanup:a}){let l="",c=!1;const u=j(),r=n=>{console.warn("Cleanup plugin:",i,"Reason:",n),a()},p=(n={})=>{var P;const{error:h,sdkLicense:A}=n,m=(P=n.plan)==null?void 0:P.category;if(!(A||n.license)||h)r(h||"Invalid license");else if(m){const b=_[s],H=_[m];b>H&&r({pluginRequiredPlan:s,licensePlan:m})}};t.on(O,n=>{l=n==null?void 0:n.baseApiUrl,c=!0}),t.on(U,n=>{o==null||o(n),p(n)}),setTimeout(async()=>{if(!c){if(u)return;if(e){const n=await R({licenseKey:e,pluginName:i,baseApiUrl:l});o==null||o(n),n&&p(n)}else r("The `licenseKey` option not provided")}},2e3)}async function R(t){const{licenseKey:s,pluginName:i,baseApiUrl:e}=t;try{return(await B({baseApiUrl:e,path:`/sdk/${s||"na"}`,method:"POST",params:{d:window.location.hostname,pn:i}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}const N="gjs-plg-",q="listPagesComponent",X=y.startup;function Y(t,s,i){let e,o,a,l,c;const u=s;function r(){const n=Date.now()-l;n<u&&n>=0?e=setTimeout(r,u-n):(e=null,c=t.apply(a,o),a=o=null)}const p=function(){return a=this,o=arguments,l=Date.now(),e||(e=setTimeout(r,u)),c};return p.clear=function(){e&&(clearTimeout(e),e=null)},p.flush=function(){e&&(c=t.apply(a,o),a=o=null,clearTimeout(e),e=null)},p}const $="page://",g="list-pages",f="list-pages-item",d="list-pages-link",Z=t=>t.components().reduce((s,i)=>{var l;const e=i.findFirstType(d),o=(l=e==null?void 0:e.attributes.attributes)==null?void 0:l.href,a=o!=null&&o.startsWith($)?o.replace($,""):"";if(a&&e){const c=s[a];c?c.push(e):s[a]=[e]}return s},{}),I="data-type-role",J="page_root",z=t=>s=>s.is(t),Q=t=>(s,i)=>i.is(t),w=t=>s=>{var i;return((i=s.getAttribute)==null?void 0:i.call(s,I))===t},tt=function(t,s={}){const{Blocks:i,Components:e,Pages:o}=t,{licenseKey:a,block:l={}}=s,c="List Pages",u="List Pages Item",r="Link",p=`${N}${g}`,n=`${N}${d}`,h='<svg viewBox="0 0 24 24"><path d="M11 15H17V17H11V15M9 7H7V9H9V7M11 13H17V11H11V13M11 9H17V7H11V9M9 11H7V13H9V11M21 5V19C21 20.1 20.1 21 19 21H5C3.9 21 3 20.1 3 19V5C3 3.9 3.9 3 5 3H19C20.1 3 21 3.9 21 5M19 5H5V19H19V5M9 15H7V17H9V15Z"/></svg>',A='<svg viewBox="0 0 24 24"><path d="M7,5H21V7H7V5M7,13V11H21V13H7M4,4.5A1.5,1.5 0 0,1 5.5,6A1.5,1.5 0 0,1 4,7.5A1.5,1.5 0 0,1 2.5,6A1.5,1.5 0 0,1 4,4.5M4,10.5A1.5,1.5 0 0,1 5.5,12A1.5,1.5 0 0,1 4,13.5A1.5,1.5 0 0,1 2.5,12A1.5,1.5 0 0,1 4,10.5M7,19V17H21V19H7M4,16.5A1.5,1.5 0 0,1 5.5,18A1.5,1.5 0 0,1 4,19.5A1.5,1.5 0 0,1 2.5,18A1.5,1.5 0 0,1 4,16.5Z" /></svg>';e.addType(g,{block:l&&{label:c,media:h,category:"Extra",select:!0,...s.block},isComponent:w(g),model:{defaults:{tagName:"ul",name:c,[J]:"",classes:p,attributes:{[I]:g,role:"navigation"},droppable:z(f),styles:`
2
+ .${p} {
3
3
  list-style: none;
4
4
  margin: 0;
5
5
  padding: 0;
6
6
  }
7
- `},init(){this.syncPageItems=Y(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(e.Components.getSymbolInfo(this).isInstance)return;const y=this.em.Pages.getAll(),P=this.components(),A=Z(this);y.forEach((b,$)=>{const E=b.id,H=b.getName(),L=A[E];L?L==null||L.forEach(V=>{V.getInnerHTML()!==H&&V.components(H)}):P.add({type:d,components:[{type:g,attributes:{href:`page://${E}`},components:{type:"textnode",content:H}}]},{at:$})})}}}),t.addType(d,{isComponent:w(d),model:{defaults:{name:l,tagName:"li",icon:f,attributes:{[T]:d},components:{type:g},draggable:Q(m)}}}),t.addType(g,{extend:"link",isComponent:w(g),model:{defaults:{removable:!1,copyable:!1,delegate:{move:y=>y.closestType(d)},name:u,classes:r,attributes:{[T]:g},components:{type:"textnode",content:"Item"},styles:`
8
- .${r} {
7
+ `},init(){this.syncPageItems=Y(this.syncPageItems.bind(this),0),this.listenTo(this.em,o.events.all,this.syncPageItems),this.syncPageItems()},syncPageItems(){if(t.Components.getSymbolInfo(this).isInstance)return;const m=this.em.Pages.getAll(),E=this.components(),P=Z(this);m.forEach((b,H)=>{const V=b.id,L=b.getName(),T=P[V];T?T==null||T.forEach(M=>{M.getInnerHTML()!==L&&M.components(L)}):E.add({type:f,components:[{type:d,attributes:{href:`page://${V}`},components:{type:"textnode",content:L}}]},{at:H})})}}}),e.addType(f,{isComponent:w(f),model:{defaults:{name:u,tagName:"li",icon:A,attributes:{[I]:f},components:{type:d},draggable:Q(g)}}}),e.addType(d,{extend:"link",isComponent:w(d),model:{defaults:{removable:!1,copyable:!1,delegate:{move:m=>m.closestType(f)},name:r,classes:n,attributes:{[I]:d},components:{type:"textnode",content:"Item"},styles:`
8
+ .${n} {
9
9
  text-decoration: none;
10
10
  }
11
- `}}}),G({editor:e,licenseKey:a,plan:X,pluginName:q,cleanup:()=>{i.remove(m),t.removeType(m)}})},te=K(ee);module.exports=te;
11
+ `}}}),F({editor:t,licenseKey:a,plan:X,pluginName:q,cleanup:()=>{i.remove(g),e.removeType(g)}})},et=G(tt);module.exports=et;