@chaibuilder/sdk 1.2.61 → 1.2.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/AddBlocks-Wja5xsTO.cjs +1 -0
- package/dist/{AddBlocks-L-3Io1jR.js → AddBlocks-ucNQHhx7.js} +18 -18
- package/dist/CanvasArea-1lUzUorh.js +975 -0
- package/dist/CanvasArea-dsxnMndK.cjs +60 -0
- package/dist/{CodeEditor-cY6z8D4N.js → CodeEditor-LeNocbY6.js} +1 -1
- package/dist/{CodeEditor-NuzOGqRn.cjs → CodeEditor-kk0bmQ3P.cjs} +1 -1
- package/dist/{CurrentPage-hoe1khi5.js → CurrentPage-huy7O-ih.js} +3 -3
- package/dist/{CurrentPage-_K-CIG12.cjs → CurrentPage-oPzQ-MY2.cjs} +1 -1
- package/dist/{ListTree-yoltG7gq.js → ListTree-5T-2KuBE.js} +1 -1
- package/dist/{ListTree-8jpTvI-s.cjs → ListTree-Fwl6Dtgc.cjs} +1 -1
- package/dist/{PagesPanel-ITbSJK04.cjs → PagesPanel-85U4O4ex.cjs} +1 -1
- package/dist/{PagesPanel-72BMvQe1.js → PagesPanel-IT7AmWMs.js} +4 -4
- package/dist/{ProjectPanel-2k7uFIr3.cjs → ProjectPanel-NiOqTkub.cjs} +1 -1
- package/dist/{ProjectPanel-Z5SIPEUd.js → ProjectPanel-hhxqbHEX.js} +4 -4
- package/dist/{Settings-ye3f6PLl.cjs → Settings-NqIs7PLQ.cjs} +1 -1
- package/dist/{Settings-vEsUk_p5.js → Settings-UO9zB4rm.js} +2 -2
- package/dist/{SidePanels-DPh7uRVD.js → SidePanels-2ZXeWnl7.js} +3 -3
- package/dist/{SidePanels-o_ItFCvJ.cjs → SidePanels-n5WUkXLw.cjs} +1 -1
- package/dist/{ThemeConfiguration-03I3INEI.cjs → ThemeConfiguration-UNRnCxnU.cjs} +1 -1
- package/dist/{ThemeConfiguration-e_4e_ZcS.js → ThemeConfiguration-VSQaQn9_.js} +4 -4
- package/dist/{Topbar-9ZZq8_wR.js → Topbar-Tkn___pR.js} +2 -2
- package/dist/{Topbar-z4-2S39X.cjs → Topbar-m48Xdj0O.cjs} +1 -1
- package/dist/UILibrariesPanel-0NMxbnSZ.js +215 -0
- package/dist/UILibrariesPanel-9V4REpxW.cjs +1 -0
- package/dist/{UnsplashImages-Y0TGxNbH.js → UnsplashImages-LU3fiooG.js} +1 -1
- package/dist/{UnsplashImages-5JbDig-S.cjs → UnsplashImages-fm761J9M.cjs} +1 -1
- package/dist/{UploadImages-f6wPPJxc.cjs → UploadImages-2_SIuRI7.cjs} +1 -1
- package/dist/{UploadImages-Dh35M55S.js → UploadImages-MjYi7gfH.js} +1 -1
- package/dist/{add-page-modal-j-TpEdWv.cjs → add-page-modal-QdlPDeMk.cjs} +1 -1
- package/dist/{add-page-modal-vQn_hxH5.js → add-page-modal-TWTjEGxY.js} +4 -4
- package/dist/{atoms-a0H_593V.cjs → atoms-KQpaDRnF.cjs} +1 -1
- package/dist/{atoms-ZOWyNoiC.js → atoms-Oomqut88.js} +2 -2
- package/dist/{confirm-alert-pGxJwZ2Q.js → confirm-alert-RNzVJyhU.js} +1 -1
- package/dist/{confirm-alert-C3wsf6lk.cjs → confirm-alert-gFBHhF1C.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.js +2 -2
- package/dist/{delete-page-modal-PJR01Hk4.cjs → delete-page-modal-B5W3a1ZW.cjs} +1 -1
- package/dist/{delete-page-modal-IcqtlUoA.js → delete-page-modal-sUlXQ02P.js} +3 -3
- package/dist/email.cjs +1 -1
- package/dist/email.js +2 -2
- package/dist/{form-pya-o19L.js → form-c4b4A8Ap.js} +1 -1
- package/dist/{form-D9cWMUJ4.cjs → form-lqNXs-pv.cjs} +1 -1
- package/dist/{index-zP6-6HxK.js → index-0M3H1dVb.js} +3 -3
- package/dist/{index-TzLilp-0.js → index-SyrshOUV.js} +399 -402
- package/dist/{index-hHmusBAU.cjs → index-TKS5_SlD.cjs} +1 -1
- package/dist/{index-1OAjmTyp.js → index-WN67ca4z.js} +2 -2
- package/dist/{index-hdfBoPkh.cjs → index-afblGXKA.cjs} +2 -2
- package/dist/index-upb0eDoG.cjs +1 -0
- package/dist/lib.cjs +2 -2
- package/dist/lib.js +97 -146
- package/dist/{page-viewer-Y7vK77bu.js → page-viewer-qb3ot43w.js} +4 -4
- package/dist/{page-viewer-9PK_DG5o.cjs → page-viewer-v4K0Wkhx.cjs} +1 -1
- package/dist/plugin-2hf9pCRy.cjs +1 -0
- package/dist/plugin-wDnsBVPp.js +54 -0
- package/dist/{project-general-setting-z943m0_C.js → project-general-setting-LfoijnjK.js} +4 -4
- package/dist/{project-general-setting-7epnyvtg.cjs → project-general-setting-Q7hgQy5G.cjs} +1 -1
- package/dist/{project-seo-setting-rjrO9KDR.cjs → project-seo-setting-rjVkahzj.cjs} +1 -1
- package/dist/{project-seo-setting-PXJe5SSV.js → project-seo-setting-ztis1_yw.js} +2 -2
- package/dist/{single-page-detail-My6c05Vt.js → single-page-detail-Neoai4eq.js} +11 -11
- package/dist/{single-page-detail-lnU7gxgk.cjs → single-page-detail-tR7Qp9T4.cjs} +1 -1
- package/dist/studio.cjs +1 -1
- package/dist/studio.js +3 -3
- package/dist/ui.cjs +1 -1
- package/dist/ui.js +44 -44
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +1 -1
- package/package.json +1 -1
- package/dist/AddBlocks-BtMNa99n.cjs +0 -1
- package/dist/CanvasArea-SgKI8O-Y.cjs +0 -59
- package/dist/CanvasArea-xq30AEQD.js +0 -978
- package/dist/UILibrariesPanel-LGbh-IZP.cjs +0 -1
- package/dist/UILibrariesPanel-PP4QDQRZ.js +0 -216
- package/dist/index-cH1CfTbV.cjs +0 -1
package/dist/web-blocks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),r=require("./jsx-runtime-Z_BpKhVy.cjs"),k=require("react"),l=require("./controls-rRZhz0vu.cjs"),d=require("@chaibuilder/runtime"),x=require("./empty-slot-Sy930lX6.cjs"),z=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),G=require("./index--mLLy7QQ.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function j(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return e.default=c,Object.freeze(e)}const h=j(k),E=h.memo(c=>{const{blockProps:e,inBuilder:t,backgroundImage:s,children:a,tag:i="div",styles:n}=c;let o=a;a||(o=r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t}));let v={};return s&&(v={backgroundImage:`url(${s})`}),h.createElement(i,{...e,...n,style:v},o)});d.registerChaiBlock(E,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:l.o({default:""}),tag:l.f({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:l.v({title:"Background Image"})},canAcceptBlock:()=>!0});const S=h.memo(c=>{const{blockProps:e,styles:t}=c;return h.createElement("div",{...e,...t})});d.registerChaiBlock(S,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:l.o({default:""})},canAcceptBlock:()=>!1});const C=c=>{const{blockProps:e,styles:t,content:s,level:a="h1",children:i=null}=c;return i?h.createElement(a,{...t,...e},i):h.createElement(a,{...t,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(C,{type:"Heading",label:"Heading",category:"core",icon:z.HeadingIcon,group:"typography",props:{level:l.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:l.o({default:"text-3xl"}),content:l.r({title:"Content",default:"Heading goes here"})},canAcceptBlock:c=>c==="Span"||c==="Text"});const R=c=>{const{blockProps:e,styles:t,content:s}=c;return u.isNull(c.children)?h.createElement("p",{...t,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):h.createElement("p",{...t,...e},c.children)};d.registerChaiBlock(R,{type:"Paragraph",label:"Paragraph",category:"core",icon:z.TextIcon,group:"typography",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:c=>c==="Span"||c==="Link"});const _=c=>{const{blockProps:e,styles:t,content:s,children:a=null,tag:i}=c;return a?h.createElement("span",{...t,...e},a):h.createElement(i||"span",{...t,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(_,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:""})},canAcceptBlock:()=>!0});const L=c=>{const{blockProps:e,content:t,styles:s}=c;return r.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...e,...s,dangerouslySetInnerHTML:{__html:t}})})};d.registerChaiBlock(L,{type:"RichText",label:"Rich Text",category:"core",icon:z.CursorTextIcon,group:"typography",props:{styles:l.o({default:""}),content:l.b({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const T=c=>{const{blockProps:e,iconSize:t,icon:s,content:a,iconPos:i,styles:n,children:o}=c,v=s,M=o||r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:a}),v&&r.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:i+" "+(i==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:v}})]});return h.createElement("button",{...e,...n,type:"button"},M)};d.registerChaiBlock(T,{type:"Button",label:"Button",category:"core",icon:z.ButtonIcon,group:"basic",props:{content:l.g({title:"Label",default:"Button"}),styles:l.o({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:l.T({title:"Icon",default:""}),iconSize:l.y({title:"Icon Size",default:24}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const P=c=>{const{blockProps:e,link:t,children:s,styles:a,inBuilder:i,content:n}=c;return!s&&u.isEmpty(a==null?void 0:a.className)&&u.isEmpty(n)?r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:i}):i?s?r.jsxRuntimeExports.jsx("span",{...e,...a,children:s}):h.createElement("span",{...e,...a,dangerouslySetInnerHTML:{__html:n}}):s?r.jsxRuntimeExports.jsx("a",{href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...e,...a,children:s}):h.createElement("a",{...e,...a,"data-ai-key":"content",href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self",dangerouslySetInnerHTML:{__html:n}})};d.registerChaiBlock(P,{type:"Link",label:"Link",category:"core",icon:z.Link1Icon,group:"basic",props:{styles:l.o({default:""}),content:l.g({title:"Content",default:""}),link:l.q({title:"Link",default:{type:"page",target:"_self",href:"#"}})},canAcceptBlock:c=>c!=="Link"});const D=(c,...e)=>({...c,className:f.cn(c.className,...e)}),N=c=>{const{blockProps:e,children:t,styles:s,inBuilder:a,content:i,href:n}=c,{hrefType:o,autoplay:v,maxWidth:M,backdropColor:p,galleryName:g}=c,m=D(s,"cb-lightbox");if(!t&&u.isEmpty(s==null?void 0:s.className)&&u.isEmpty(i))return r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a});if(a)return t?r.jsxRuntimeExports.jsx("span",{...e,...m,children:t}):h.createElement("span",{...e,...m,dangerouslySetInnerHTML:{__html:i}});const y={};return y["data-vbtype"]=o,v&&(y["data-autoplay"]="true"),M&&(y["data-maxwidth"]=M+"px"),p&&(y["data-overlay"]=p),g&&(y["data-gall"]=g),t?r.jsxRuntimeExports.jsx("a",{...y,href:n||"#/",...e,...m,children:t}):h.createElement("a",{...e,...m,...y,href:n||"#",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(N,{type:"LightBoxLink",label:"LightBox Link",category:"core",icon:z.ImageIcon,group:"basic",props:{styles:l.o({default:""}),content:l.g({title:"Content",default:"Link text or drop blocks inside"}),href:l.g({title:"Href",default:""}),hrefType:l.f({title:"Type",default:"video",options:[{value:"video",title:"video "},{value:"iframe",title:"iframe"},{value:"inline",title:"inline"},{value:"ajax",title:"ajax"}]}),autoplay:l.c({title:"Autoplay video",default:!1}),maxWidth:l.y({title:"Max Width",default:""}),backdropColor:l.g({title:"Backdrop Color",default:""}),galleryName:l.g({title:"Gallery name",default:""})},canAcceptBlock:c=>c!=="Link"&&c!=="LightBoxLink"});const H=c=>{const{blockProps:e,children:t,listType:s,styles:a,tag:i,inBuilder:n}=c,o=f.cn(u.get(a,"className",""),s);return!t&&u.isEmpty(a==null?void 0:a.className)?r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:n}):h.createElement(i||(s==="list-decimal"?"ol":"ul"),{...e,...a,className:o},t)};d.registerChaiBlock(H,{type:"List",label:"List",icon:z.RowsIcon,category:"core",group:"basic",props:{styles:l.o({default:""}),listType:l.f({title:"List type",default:"list-none",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:c=>c==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const A=c=>{const{blockProps:e,content:t,styles:s,children:a,tag:i}=c;return a?h.createElement(i||"li",{...s,...e},a):h.createElement(i||"li",{...s,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(A,{type:"ListItem",label:"List Item",icon:z.ColumnsIcon,category:"core",group:"basic",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:"List item"})},canAcceptBlock:c=>c!=="ListItem",canBeNested:c=>c==="List"});const q=c=>{const{blockProps:e,icon:t,styles:s,width:a,inBuilder:i,height:n}=c,o=D(s,f.cn(a?`w-[${a}px]`:"",n?`h-[${n}px]`:""));if(u.isEmpty(t))return r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:i,className:"h-8 w-14"});const v=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...e,...o,dangerouslySetInnerHTML:{__html:v}})};d.registerChaiBlock(q,{type:"Icon",label:"Icon",category:"core",icon:z.SketchLogoIcon,group:"media",props:{styles:l.o({default:"text-black"}),icon:l.T({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:l.y({title:"Width",default:""}),height:l.y({title:"Height",default:""})}});const U=c=>{const{blockProps:e,image:t,styles:s,alt:a,height:i,width:n}=c;return u.isEmpty(t)?r.jsxRuntimeExports.jsx(x.EmptySlot,{className:"h-36"}):h.createElement("img",{...e,...s,src:t,alt:a,loading:"lazy",height:i,width:n})};d.registerChaiBlock(U,{type:"Image",label:"Image",category:"core",icon:z.ImageIcon,group:"media",props:{styles:l.o({default:""}),image:l.v({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.g({title:"Alt",default:""}),width:l.g({title:"Width",default:""}),height:l.g({title:"Height",default:""})}});const F=c=>{var n;const{blockProps:e,inBuilder:t,styles:s,children:a}=c;let i=null;return!a&&t&&(i=r.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(n=c.emptyStyles)==null?void 0:n.className),children:r.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:r.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",c.name]})})})),h.createElement("div",{...s,...e,droppable:"yes"},a||i)};d.registerChaiBlock(F,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:l.o({default:""}),emptyStyles:l.o({default:""})},canAcceptBlock:()=>!0});const I=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,b=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,w=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,O=c=>{if(I.test(c)){const e=c.match(I);return e?`https://www.youtube.com/embed/${e[4]}`:c}if(b.test(c)){const e=c.match(b);return e?`https://player.vimeo.com/video/${e[3]}`:c}if(w.test(c)){const e=c.match(w);return e?`https://www.dailymotion.com/embed/video/${e[4]}`:c}return null},$=h.memo(c=>{const{blockProps:e,inBuilder:t,styles:s,url:a,controls:i}=c,n=u.get(i,"autoPlay",!1),o=u.get(i,"controls",!1),v=n||u.get(i,"muted",!0),M=u.get(i,"loop",!1);if(u.isEmpty(a))return r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t,className:"h-36"});let p=O(a),g=null;if(p){if(!u.isEmpty(p)){const m=[];m.push(`autoplay=${n?1:0}`),m.push(`controls=${i?1:0}`),m.push(`mute=${v?1:0}&muted=${v?1:0}`),m.push(`loop=${M?1:0}`),p=`${p}?${m.join("&")}`}g=h.createElement("iframe",{...e,className:"absolute inset-0 w-full h-full",src:p,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=h.createElement("video",{...e,className:"absolute inset-0 w-full h-full",src:a,controls:o,muted:v,autoPlay:t?!1:n,loop:M});return r.jsxRuntimeExports.jsx("div",{...u.pick(s,["className"]),children:r.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?r.jsxRuntimeExports.jsx("div",{...e,...u.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock($,{type:"Video",label:"Video",category:"core",icon:z.VideoIcon,group:"media",props:{styles:l.o({default:""}),url:l.g({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:l.h({title:"Controls",properties:{autoPlay:l.c({title:"Autoplay",default:!0}),controls:l.c({title:"Show controls",default:!1}),loop:l.c({title:"Loop",default:!1}),muted:l.c({title:"Muted",default:!0})}})}});const V=c=>{const{blockProps:e,styles:t,htmlCode:s,inBuilder:a}=c;return a?r.jsxRuntimeExports.jsxs("div",{className:"relative",children:[a?r.jsxRuntimeExports.jsx("div",{...e,...t,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):h.createElement("div",{...e,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(V,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:z.CodeIcon,group:"advanced",props:{styles:l.o({default:""}),htmlCode:l.u({title:"HTML Code",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})},canAcceptBlock:()=>!1});function W(c){return G.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(c)}const J=c=>{const{scripts:e,inBuilder:t,blockProps:s}=c;return t?r.jsxRuntimeExports.jsx("div",{...s}):r.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e}})};d.registerChaiBlock(J,{type:"CustomScript",label:"Custom Script",category:"core",icon:W,group:"advanced",props:{scripts:l.u({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})},canAcceptBlock:()=>!1});const Y=c=>{const{blockProps:e,styles:t}=c;return h.createElement("hr",{...t,...e})};d.registerChaiBlock(Y,{type:"Divider",label:"Divider",category:"core",icon:z.DividerHorizontalIcon,group:"basic",props:{styles:l.o({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const Z=c=>c.inBuilder||c.forceWrapper?r.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...c.blockProps,children:c.content}):`${c.content}`;d.registerChaiBlock(Z,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:z.SpaceBetweenVerticallyIcon,props:{content:l.r({title:"Content",defaultValue:""})}});const K=()=>null;d.registerChaiBlock(K,{type:"Dark Mode",label:"Dark Mode",category:"core",icon:z.MoonIcon,group:"advanced",blocks:[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]});const X=c=>{const{blockProps:e,backgroundImage:t,children:s,styles:a}=c;let i={};return t&&(i={backgroundImage:`url(${t})`}),h.createElement("div",{...e,...a,style:i},s)};d.registerChaiBlock(X,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:l.o({default:"font-body antialiased"}),backgroundImage:l.v({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const Q=c=>{const{blockProps:e,styles:t}=c;return h.createElement("br",{...e,...t})};d.registerChaiBlock(Q,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:z.SpaceBetweenVerticallyIcon,props:{styles:l.o({default:""})}});const B=c=>{const e=(i,n)=>({_id:f.generateUUID(),_parent:i,_type:"TableCell",styles:"#styles:,",content:`${c==="TableHead"?"Table Head":"Table Cell "+n}`}),t=i=>{const n=f.generateUUID(),o={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return i&&(o._parent=i),[o,e(n,"1"),e(n,"2"),e(n,"3")]},s=i=>{const n=f.generateUUID(),o={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return i&&(o._parent=i),[o,...t(n)]},a=i=>{const n=f.generateUUID(),o={_id:n,_type:"TableBody",styles:"#styles:,"};return i&&(o._parent=i),[o,...t(n),...t(n)]};if(c==="Table"){const i=f.generateUUID();return[{_id:i,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...s(i),...a(i)]}return c==="TableRow"?t():c==="TableHead"?s():c==="TableBody"?a():[]},c0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("table",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(c0,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:z.TableIcon,props:{styles:l.o({default:""})},blocks:B("Table")});const t0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("thead",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(t0,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:z.BorderTopIcon,props:{styles:l.o({default:""})},blocks:B("TableHead")});const l0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("tbody",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(l0,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:z.BorderAllIcon,props:{styles:l.o({default:""})},blocks:B("TableBody")});const e0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("tr",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(e0,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:z.ViewHorizontalIcon,props:{styles:l.o({default:"w-full"})},blocks:B("TableRow")});const s0=c=>{const{blockProps:e,children:t,content:s,styles:a}=c;return!t&&u.isEmpty(s)?r.jsxRuntimeExports.jsx(x.EmptySlot,{}):t?h.createElement("td",{...e,...a},t):h.createElement("td",{...e,...a,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(s0,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:z.DragHandleHorizontalIcon,props:{styles:l.o({default:""}),content:l.b({title:"Content",default:"Table cell item",ai:{html:!0}})}});const a0=c=>{const{blockProps:e,errorMessage:t,name:s,_type:a,successMessage:i,action:n,styles:o,children:v}=c;let M=v;v||(M=r.jsxRuntimeExports.jsx(x.EmptySlot,{}));const p={"x-data":"useForm","x-on:submit.prevent":"post"},g={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return r.jsxRuntimeExports.jsxs("form",{...p,"data-error":t,"data-success":i,method:"post",action:n,...e,...o,children:[r.jsxRuntimeExports.jsx("div",{...g}),r.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||a}),M]})};d.registerChaiBlock(a0,{type:"Form",label:"Form",category:"core",icon:z.GroupIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),action:l.g({title:"Submit URL",default:"/api/form/submit"}),errorMessage:l.b({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:l.b({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const i0=c=>{const{blockProps:e,content:t,styles:s,children:a}=c,i={...s,...e};return a?h.createElement("label",i,a):h.createElement("label",{...i,dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(i0,{type:"Label",label:"Label",category:"core",icon:z.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),content:l.g({title:"Content",default:"Label",ai:{html:!1}})}});const r0=c=>{const{blockProps:e,inBuilder:t,label:s,styles:a,inputStyles:i,icon:n,iconPos:o}=c,v=f.generateUUID(),M={"x-bind:disabled":"formLoading"};return r.jsxRuntimeExports.jsxs("button",{id:v,...M,...i,...a,...e||{},type:t?"button":"submit",children:[s,n&&r.jsxRuntimeExports.jsx("span",{className:o,dangerouslySetInnerHTML:{__html:n}})]})};d.registerChaiBlock(r0,{type:"FormButton",label:"Submit Button",category:"core",icon:z.ButtonIcon,group:"form",hidden:!0,props:{label:l.g({title:"Label",default:"Submit"}),styles:l.o({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:l.T({title:"Icon",default:""}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const n0=c=>{const{blockProps:e,fieldName:t,label:s,styles:a,inputStyles:i,required:n,checked:o,showLabel:v=!0}=c,M=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...a,...e,children:[r.jsxRuntimeExports.jsx("input",{...i,name:t,id:M,type:"checkbox",required:n,defaultChecked:o}),s&&s!=="Label"&&r.jsxRuntimeExports.jsx("label",{htmlFor:M,children:s})]}):r.jsxRuntimeExports.jsx("input",{id:M,...e,...i,...a,type:"checkbox",required:n,name:t})};d.registerChaiBlock(n0,{type:"Checkbox",label:"Checkbox",category:"core",icon:z.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:l.g({title:"Field Name",default:"checkbox"}),styles:l.o({default:"flex items-center gap-x-2"}),label:l.g({title:"Label",default:"Label"}),checked:l.c({title:"Checked",default:!1}),required:l.c({title:"Required",default:!1})}});const o0=c=>{const{blockProps:e,label:t,placeholder:s,styles:a,inputStyles:i,showLabel:n,required:o,inputType:v="text",inBuilder:M,fieldName:p}=c,g=f.generateUUID();return!n||v==="submit"?(v==="submit"&&(e.value=t),r.jsxRuntimeExports.jsx("input",{id:g,name:p,readOnly:M,...e,...i,...a,type:v,placeholder:s,required:o})):r.jsxRuntimeExports.jsxs("div",{...a,...e,children:[n&&r.jsxRuntimeExports.jsx("label",{htmlFor:g,children:t}),r.jsxRuntimeExports.jsx("input",{name:p,readOnly:M,...i,id:g,type:v,placeholder:s,required:o})]})};d.registerChaiBlock(o0,{type:"Input",label:"Input",category:"core",icon:z.InputIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),fieldName:l.g({title:"Field Name",default:"input"}),inputType:l.f({title:"Type",options:u.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],c=>({value:c,title:c})),default:"text"}),value:l.g({title:"Value",default:""}),showLabel:l.c({title:"Show label",default:!0}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),required:l.c({title:"Required",default:!1})}});const h0=c=>{const{blockProps:e,fieldName:t,label:s,styles:a,inputStyles:i,checked:n,required:o,showLabel:v=!0}=c,M=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...a,...e,children:[r.jsxRuntimeExports.jsx("input",{...i,name:t,id:M,type:"radio",required:o,defaultChecked:n}),s&&r.jsxRuntimeExports.jsx("label",{htmlFor:M,children:s})]}):r.jsxRuntimeExports.jsx("input",{id:M,...e,...i,...a,type:"radio",required:o,checked:n,name:t})};d.registerChaiBlock(h0,{type:"Radio",label:"Radio",category:"core",icon:z.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:l.o({default:"flex items-center w-max gap-x-2"}),fieldName:l.g({title:"Field Name",default:"radio"}),label:l.g({title:"Label",default:"Label"}),checked:l.c({title:"Checked",default:!1}),required:l.c({title:"Required",default:!1})}});const d0=c=>{const{blockProps:e,fieldName:t,label:s,placeholder:a,styles:i,inputStyles:n,required:o,showLabel:v,_multiple:M=!1}=c,p=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...i,children:[v&&r.jsxRuntimeExports.jsx("label",{htmlFor:p,children:s}),r.jsxRuntimeExports.jsxs("select",{...n,id:p,required:o,multiple:M,name:t,children:[r.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),u.map(c.options,g=>r.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})]}):r.jsxRuntimeExports.jsxs("select",{id:p,...i,...e,required:o,multiple:M,name:t,children:[r.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),u.map(c.options,g=>r.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})};d.registerChaiBlock(d0,{type:"Select",label:"Select",category:"core",icon:z.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),fieldName:l.g({title:"Field Name",default:"select"}),showLabel:l.c({title:"Show label",default:!0}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),required:l.c({title:"Required",default:!1}),_multiple:l.c({title:"Multiple Choice",default:!1}),options:l.S({title:"Options",itemProperties:{label:l.g({title:"Label",default:""}),value:l.g({title:"Value",default:""})}})}});const v0=c=>{const{blockProps:e,fieldName:t,label:s,placeholder:a,styles:i,inputStyles:n,_rows:o,showLabel:v}=c,M=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...i,...e,children:[v&&r.jsxRuntimeExports.jsx("label",{htmlFor:M,children:s}),r.jsxRuntimeExports.jsx("textarea",{name:t,...n,id:M,placeholder:a,rows:o})]}):r.jsxRuntimeExports.jsx("textarea",{id:M,name:t,...e,...n,...i,placeholder:a,rows:o})};d.registerChaiBlock(v0,{type:"TextArea",label:"TextArea",category:"core",icon:z.InputIcon,group:"form",hidden:!0,props:{fieldName:l.g({title:"Field Name",default:"textarea"}),showLabel:l.c({title:"Show label",default:!0}),styles:l.o({default:""}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),_rows:l.y({title:"Rows",default:3})}});const M0=u.noop;exports.loadWebBlocks=M0;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),r=require("./jsx-runtime-Z_BpKhVy.cjs"),k=require("react"),l=require("./controls-rRZhz0vu.cjs"),d=require("@chaibuilder/runtime"),x=require("./empty-slot-Sy930lX6.cjs"),z=require("@radix-ui/react-icons"),f=require("./Functions-N3yhPYKY.cjs"),G=require("./index--mLLy7QQ.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function j(c){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const t in c)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(c,t);Object.defineProperty(e,t,s.get?s:{enumerable:!0,get:()=>c[t]})}}return e.default=c,Object.freeze(e)}const h=j(k),E=h.memo(c=>{const{blockProps:e,inBuilder:t,backgroundImage:s,children:a,tag:i="div",styles:n}=c;let o=a;a||(o=r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t}));let v={};return s&&(v={backgroundImage:`url(${s})`}),h.createElement(i,{...e,...n,style:v},o)});d.registerChaiBlock(E,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:l.o({default:""}),tag:l.f({title:"Tag",default:"div",options:[{value:"div",title:"div"},{value:"header",title:"header"},{value:"footer",title:"footer"},{value:"section",title:"section"},{value:"article",title:"article"},{value:"aside",title:"aside"},{value:"main",title:"main"},{value:"nav",title:"nav"},{value:"figure",title:"figure"},{value:"details",title:"details"},{value:"summary",title:"summary"},{value:"dialog",title:"dialog"},{value:"strike",title:"strike"},{value:"caption",title:"caption"},{value:"legend",title:"legend"},{value:"figcaption",title:"figcaption"},{value:"mark",title:"mark"}]}),backgroundImage:l.v({title:"Background Image"})},canAcceptBlock:()=>!0});const S=h.memo(c=>{const{blockProps:e,styles:t}=c;return h.createElement("div",{...e,...t})});d.registerChaiBlock(S,{type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",props:{styles:l.o({default:""})},canAcceptBlock:()=>!1});const C=c=>{const{blockProps:e,styles:t,content:s,level:a="h1",children:i=null}=c;return i?h.createElement(a,{...t,...e},i):h.createElement(a,{...t,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(C,{type:"Heading",label:"Heading",category:"core",icon:z.HeadingIcon,group:"typography",props:{level:l.f({title:"Level",default:"h1",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:l.o({default:"text-3xl"}),content:l.r({title:"Content",default:"Heading goes here"})},canAcceptBlock:c=>c==="Span"||c==="Text"});const R=c=>{const{blockProps:e,styles:t,content:s}=c;return u.isNull(c.children)?h.createElement("p",{...t,...e,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):h.createElement("p",{...t,...e},c.children)};d.registerChaiBlock(R,{type:"Paragraph",label:"Paragraph",category:"core",icon:z.TextIcon,group:"typography",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."})},canAcceptBlock:c=>c==="Span"||c==="Link"||c==="Text"});const _=c=>{const{blockProps:e,styles:t,content:s,children:a=null,tag:i}=c;return a?h.createElement("span",{...t,...e},a):h.createElement(i||"span",{...t,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(_,{type:"Span",label:"Span",category:"core",group:"typography",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:""})},canAcceptBlock:()=>!0});const L=c=>{const{blockProps:e,content:t,styles:s}=c;return r.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:r.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...e,...s,dangerouslySetInnerHTML:{__html:t}})})};d.registerChaiBlock(L,{type:"RichText",label:"Rich Text",category:"core",icon:z.CursorTextIcon,group:"typography",props:{styles:l.o({default:""}),content:l.b({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const T=c=>{const{blockProps:e,iconSize:t,icon:s,content:a,iconPos:i,styles:n,children:o}=c,v=s,M=o||r.jsxRuntimeExports.jsxs(r.jsxRuntimeExports.Fragment,{children:[r.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:a}),v&&r.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:i+" "+(i==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:v}})]});return h.createElement("button",{...e,...n,type:"button"},M)};d.registerChaiBlock(T,{type:"Button",label:"Button",category:"core",icon:z.ButtonIcon,group:"basic",props:{content:l.g({title:"Label",default:"Button"}),styles:l.o({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:l.T({title:"Icon",default:""}),iconSize:l.y({title:"Icon Size",default:24}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const P=c=>{const{blockProps:e,link:t,children:s,styles:a,inBuilder:i,content:n}=c;return!s&&u.isEmpty(a==null?void 0:a.className)&&u.isEmpty(n)?r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:i}):i?s?r.jsxRuntimeExports.jsx("span",{...e,...a,children:s}):h.createElement("span",{...e,...a,dangerouslySetInnerHTML:{__html:n}}):s?r.jsxRuntimeExports.jsx("a",{href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...e,...a,children:s}):h.createElement("a",{...e,...a,"data-ai-key":"content",href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self",dangerouslySetInnerHTML:{__html:n}})};d.registerChaiBlock(P,{type:"Link",label:"Link",category:"core",icon:z.Link1Icon,group:"basic",props:{styles:l.o({default:""}),content:l.g({title:"Content",default:""}),link:l.q({title:"Link",default:{type:"page",target:"_self",href:"#"}})},canAcceptBlock:c=>c!=="Link"});const D=(c,...e)=>({...c,className:f.cn(c.className,...e)}),N=c=>{const{blockProps:e,children:t,styles:s,inBuilder:a,content:i,href:n}=c,{hrefType:o,autoplay:v,maxWidth:M,backdropColor:p,galleryName:g}=c,m=D(s,"cb-lightbox");if(!t&&u.isEmpty(s==null?void 0:s.className)&&u.isEmpty(i))return r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:a});if(a)return t?r.jsxRuntimeExports.jsx("span",{...e,...m,children:t}):h.createElement("span",{...e,...m,dangerouslySetInnerHTML:{__html:i}});const y={};return y["data-vbtype"]=o,v&&(y["data-autoplay"]="true"),M&&(y["data-maxwidth"]=M+"px"),p&&(y["data-overlay"]=p),g&&(y["data-gall"]=g),t?r.jsxRuntimeExports.jsx("a",{...y,href:n||"#/",...e,...m,children:t}):h.createElement("a",{...e,...m,...y,href:n||"#",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(N,{type:"LightBoxLink",label:"LightBox Link",category:"core",icon:z.ImageIcon,group:"basic",props:{styles:l.o({default:""}),content:l.g({title:"Content",default:"Link text or drop blocks inside"}),href:l.g({title:"Href",default:""}),hrefType:l.f({title:"Type",default:"video",options:[{value:"video",title:"video "},{value:"iframe",title:"iframe"},{value:"inline",title:"inline"},{value:"ajax",title:"ajax"}]}),autoplay:l.c({title:"Autoplay video",default:!1}),maxWidth:l.y({title:"Max Width",default:""}),backdropColor:l.g({title:"Backdrop Color",default:""}),galleryName:l.g({title:"Gallery name",default:""})},canAcceptBlock:c=>c!=="Link"&&c!=="LightBoxLink"});const H=c=>{const{blockProps:e,children:t,listType:s,styles:a,tag:i,inBuilder:n}=c,o=f.cn(u.get(a,"className",""),s);return!t&&u.isEmpty(a==null?void 0:a.className)?r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:n}):h.createElement(i||(s==="list-decimal"?"ol":"ul"),{...e,...a,className:o},t)};d.registerChaiBlock(H,{type:"List",label:"List",icon:z.RowsIcon,category:"core",group:"basic",props:{styles:l.o({default:""}),listType:l.f({title:"List type",default:"list-none",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:c=>c==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]});const A=c=>{const{blockProps:e,content:t,styles:s,children:a,tag:i}=c;return a?h.createElement(i||"li",{...s,...e},a):h.createElement(i||"li",{...s,...e,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(A,{type:"ListItem",label:"List Item",icon:z.ColumnsIcon,category:"core",group:"basic",props:{styles:l.o({default:""}),content:l.r({title:"Content",default:"List item"})},canAcceptBlock:c=>c!=="ListItem",canBeNested:c=>c==="List"});const q=c=>{const{blockProps:e,icon:t,styles:s,width:a,inBuilder:i,height:n}=c,o=D(s,f.cn(a?`w-[${a}px]`:"",n?`h-[${n}px]`:""));if(u.isEmpty(t))return r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:i,className:"h-8 w-14"});const v=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...e,...o,dangerouslySetInnerHTML:{__html:v}})};d.registerChaiBlock(q,{type:"Icon",label:"Icon",category:"core",icon:z.SketchLogoIcon,group:"media",props:{styles:l.o({default:"text-black"}),icon:l.T({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>'}),width:l.y({title:"Width",default:""}),height:l.y({title:"Height",default:""})}});const U=c=>{const{blockProps:e,image:t,styles:s,alt:a,height:i,width:n}=c;return u.isEmpty(t)?r.jsxRuntimeExports.jsx(x.EmptySlot,{className:"h-36"}):h.createElement("img",{...e,...s,src:t,alt:a,loading:"lazy",height:i,width:n})};d.registerChaiBlock(U,{type:"Image",label:"Image",category:"core",icon:z.ImageIcon,group:"media",props:{styles:l.o({default:""}),image:l.v({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.g({title:"Alt",default:""}),width:l.g({title:"Width",default:""}),height:l.g({title:"Height",default:""})}});const F=c=>{var n;const{blockProps:e,inBuilder:t,styles:s,children:a}=c;let i=null;return!a&&t&&(i=r.jsxRuntimeExports.jsx("div",{className:f.cn("flex flex-col items-center justify-center",(n=c.emptyStyles)==null?void 0:n.className),children:r.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:r.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",c.name]})})})),h.createElement("div",{...s,...e,droppable:"yes"},a||i)};d.registerChaiBlock(F,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:l.o({default:""}),emptyStyles:l.o({default:""})},canAcceptBlock:()=>!0});const I=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,b=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,w=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,O=c=>{if(I.test(c)){const e=c.match(I);return e?`https://www.youtube.com/embed/${e[4]}`:c}if(b.test(c)){const e=c.match(b);return e?`https://player.vimeo.com/video/${e[3]}`:c}if(w.test(c)){const e=c.match(w);return e?`https://www.dailymotion.com/embed/video/${e[4]}`:c}return null},$=h.memo(c=>{const{blockProps:e,inBuilder:t,styles:s,url:a,controls:i}=c,n=u.get(i,"autoPlay",!1),o=u.get(i,"controls",!1),v=n||u.get(i,"muted",!0),M=u.get(i,"loop",!1);if(u.isEmpty(a))return r.jsxRuntimeExports.jsx(x.EmptySlot,{inBuilder:t,className:"h-36"});let p=O(a),g=null;if(p){if(!u.isEmpty(p)){const m=[];m.push(`autoplay=${n?1:0}`),m.push(`controls=${i?1:0}`),m.push(`mute=${v?1:0}&muted=${v?1:0}`),m.push(`loop=${M?1:0}`),p=`${p}?${m.join("&")}`}g=h.createElement("iframe",{...e,className:"absolute inset-0 w-full h-full",src:p,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else g=h.createElement("video",{...e,className:"absolute inset-0 w-full h-full",src:a,controls:o,muted:v,autoPlay:t?!1:n,loop:M});return r.jsxRuntimeExports.jsx("div",{...u.pick(s,["className"]),children:r.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?r.jsxRuntimeExports.jsx("div",{...e,...u.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,g]})})});d.registerChaiBlock($,{type:"Video",label:"Video",category:"core",icon:z.VideoIcon,group:"media",props:{styles:l.o({default:""}),url:l.g({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:l.h({title:"Controls",properties:{autoPlay:l.c({title:"Autoplay",default:!0}),controls:l.c({title:"Show controls",default:!1}),loop:l.c({title:"Loop",default:!1}),muted:l.c({title:"Muted",default:!0})}})}});const V=c=>{const{blockProps:e,styles:t,htmlCode:s,inBuilder:a}=c;return a?r.jsxRuntimeExports.jsxs("div",{className:"relative",children:[a?r.jsxRuntimeExports.jsx("div",{...e,...t,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):h.createElement("div",{...e,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(V,{type:"CustomHTML",label:"Custom HTML",category:"core",icon:z.CodeIcon,group:"advanced",props:{styles:l.o({default:""}),htmlCode:l.u({title:"HTML Code",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})},canAcceptBlock:()=>!1});function W(c){return G.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(c)}const J=c=>{const{scripts:e,inBuilder:t,blockProps:s}=c;return t?r.jsxRuntimeExports.jsx("div",{...s}):r.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:e}})};d.registerChaiBlock(J,{type:"CustomScript",label:"Custom Script",category:"core",icon:W,group:"advanced",props:{scripts:l.u({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})},canAcceptBlock:()=>!1});const Y=c=>{const{blockProps:e,styles:t}=c;return h.createElement("hr",{...t,...e})};d.registerChaiBlock(Y,{type:"Divider",label:"Divider",category:"core",icon:z.DividerHorizontalIcon,group:"basic",props:{styles:l.o({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const Z=c=>c.inBuilder||c.forceWrapper?r.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...c.blockProps,children:c.content}):`${c.content}`;d.registerChaiBlock(Z,{type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:z.SpaceBetweenVerticallyIcon,props:{content:l.r({title:"Content",defaultValue:""})}});const K=()=>null;d.registerChaiBlock(K,{type:"Dark Mode",label:"Dark Mode",category:"core",icon:z.MoonIcon,group:"advanced",blocks:[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]});const X=c=>{const{blockProps:e,backgroundImage:t,children:s,styles:a}=c;let i={};return t&&(i={backgroundImage:`url(${t})`}),h.createElement("div",{...e,...a,style:i},s)};d.registerChaiBlock(X,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:l.o({default:"font-body antialiased"}),backgroundImage:l.v({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const Q=c=>{const{blockProps:e,styles:t}=c;return h.createElement("br",{...e,...t})};d.registerChaiBlock(Q,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:z.SpaceBetweenVerticallyIcon,props:{styles:l.o({default:""})}});const B=c=>{const e=(i,n)=>({_id:f.generateUUID(),_parent:i,_type:"TableCell",styles:"#styles:,",content:`${c==="TableHead"?"Table Head":"Table Cell "+n}`}),t=i=>{const n=f.generateUUID(),o={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return i&&(o._parent=i),[o,e(n,"1"),e(n,"2"),e(n,"3")]},s=i=>{const n=f.generateUUID(),o={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return i&&(o._parent=i),[o,...t(n)]},a=i=>{const n=f.generateUUID(),o={_id:n,_type:"TableBody",styles:"#styles:,"};return i&&(o._parent=i),[o,...t(n),...t(n)]};if(c==="Table"){const i=f.generateUUID();return[{_id:i,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...s(i),...a(i)]}return c==="TableRow"?t():c==="TableHead"?s():c==="TableBody"?a():[]},c0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("table",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(c0,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:z.TableIcon,props:{styles:l.o({default:""})},blocks:B("Table")});const t0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("thead",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(t0,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:z.BorderTopIcon,props:{styles:l.o({default:""})},blocks:B("TableHead")});const l0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("tbody",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(l0,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:z.BorderAllIcon,props:{styles:l.o({default:""})},blocks:B("TableBody")});const e0=c=>{const{blockProps:e,children:t,styles:s}=c;return t?h.createElement("tr",{...e,...s},t):r.jsxRuntimeExports.jsx(x.EmptySlot,{})};d.registerChaiBlock(e0,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:z.ViewHorizontalIcon,props:{styles:l.o({default:"w-full"})},blocks:B("TableRow")});const s0=c=>{const{blockProps:e,children:t,content:s,styles:a}=c;return!t&&u.isEmpty(s)?r.jsxRuntimeExports.jsx(x.EmptySlot,{}):t?h.createElement("td",{...e,...a},t):h.createElement("td",{...e,...a,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(s0,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:z.DragHandleHorizontalIcon,props:{styles:l.o({default:""}),content:l.b({title:"Content",default:"Table cell item",ai:{html:!0}})}});const a0=c=>{const{blockProps:e,errorMessage:t,name:s,_type:a,successMessage:i,action:n,styles:o,children:v}=c;let M=v;v||(M=r.jsxRuntimeExports.jsx(x.EmptySlot,{}));const p={"x-data":"useForm","x-on:submit.prevent":"post"},g={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return r.jsxRuntimeExports.jsxs("form",{...p,"data-error":t,"data-success":i,method:"post",action:n,...e,...o,children:[r.jsxRuntimeExports.jsx("div",{...g}),r.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||a}),M]})};d.registerChaiBlock(a0,{type:"Form",label:"Form",category:"core",icon:z.GroupIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),action:l.g({title:"Submit URL",default:"/api/form/submit"}),errorMessage:l.b({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:l.b({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const i0=c=>{const{blockProps:e,content:t,styles:s,children:a}=c,i={...s,...e};return a?h.createElement("label",i,a):h.createElement("label",{...i,dangerouslySetInnerHTML:{__html:t}})};d.registerChaiBlock(i0,{type:"Label",label:"Label",category:"core",icon:z.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),content:l.g({title:"Content",default:"Label",ai:{html:!1}})}});const r0=c=>{const{blockProps:e,inBuilder:t,label:s,styles:a,inputStyles:i,icon:n,iconPos:o}=c,v=f.generateUUID(),M={"x-bind:disabled":"formLoading"};return r.jsxRuntimeExports.jsxs("button",{id:v,...M,...i,...a,...e||{},type:t?"button":"submit",children:[s,n&&r.jsxRuntimeExports.jsx("span",{className:o,dangerouslySetInnerHTML:{__html:n}})]})};d.registerChaiBlock(r0,{type:"FormButton",label:"Submit Button",category:"core",icon:z.ButtonIcon,group:"form",hidden:!0,props:{label:l.g({title:"Label",default:"Submit"}),styles:l.o({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:l.T({title:"Icon",default:""}),iconPos:l.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const n0=c=>{const{blockProps:e,fieldName:t,label:s,styles:a,inputStyles:i,required:n,checked:o,showLabel:v=!0}=c,M=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...a,...e,children:[r.jsxRuntimeExports.jsx("input",{...i,name:t,id:M,type:"checkbox",required:n,defaultChecked:o}),s&&s!=="Label"&&r.jsxRuntimeExports.jsx("label",{htmlFor:M,children:s})]}):r.jsxRuntimeExports.jsx("input",{id:M,...e,...i,...a,type:"checkbox",required:n,name:t})};d.registerChaiBlock(n0,{type:"Checkbox",label:"Checkbox",category:"core",icon:z.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:l.g({title:"Field Name",default:"checkbox"}),styles:l.o({default:"flex items-center gap-x-2"}),label:l.g({title:"Label",default:"Label"}),checked:l.c({title:"Checked",default:!1}),required:l.c({title:"Required",default:!1})}});const o0=c=>{const{blockProps:e,label:t,placeholder:s,styles:a,inputStyles:i,showLabel:n,required:o,inputType:v="text",inBuilder:M,fieldName:p}=c,g=f.generateUUID();return!n||v==="submit"?(v==="submit"&&(e.value=t),r.jsxRuntimeExports.jsx("input",{id:g,name:p,readOnly:M,...e,...i,...a,type:v,placeholder:s,required:o})):r.jsxRuntimeExports.jsxs("div",{...a,...e,children:[n&&r.jsxRuntimeExports.jsx("label",{htmlFor:g,children:t}),r.jsxRuntimeExports.jsx("input",{name:p,readOnly:M,...i,id:g,type:v,placeholder:s,required:o})]})};d.registerChaiBlock(o0,{type:"Input",label:"Input",category:"core",icon:z.InputIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),fieldName:l.g({title:"Field Name",default:"input"}),inputType:l.f({title:"Type",options:u.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],c=>({value:c,title:c})),default:"text"}),value:l.g({title:"Value",default:""}),showLabel:l.c({title:"Show label",default:!0}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),required:l.c({title:"Required",default:!1})}});const h0=c=>{const{blockProps:e,fieldName:t,label:s,styles:a,inputStyles:i,checked:n,required:o,showLabel:v=!0}=c,M=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...a,...e,children:[r.jsxRuntimeExports.jsx("input",{...i,name:t,id:M,type:"radio",required:o,defaultChecked:n}),s&&r.jsxRuntimeExports.jsx("label",{htmlFor:M,children:s})]}):r.jsxRuntimeExports.jsx("input",{id:M,...e,...i,...a,type:"radio",required:o,checked:n,name:t})};d.registerChaiBlock(h0,{type:"Radio",label:"Radio",category:"core",icon:z.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:l.o({default:"flex items-center w-max gap-x-2"}),fieldName:l.g({title:"Field Name",default:"radio"}),label:l.g({title:"Label",default:"Label"}),checked:l.c({title:"Checked",default:!1}),required:l.c({title:"Required",default:!1})}});const d0=c=>{const{blockProps:e,fieldName:t,label:s,placeholder:a,styles:i,inputStyles:n,required:o,showLabel:v,_multiple:M=!1}=c,p=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...i,children:[v&&r.jsxRuntimeExports.jsx("label",{htmlFor:p,children:s}),r.jsxRuntimeExports.jsxs("select",{...n,id:p,required:o,multiple:M,name:t,children:[r.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),u.map(c.options,g=>r.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})]}):r.jsxRuntimeExports.jsxs("select",{id:p,...i,...e,required:o,multiple:M,name:t,children:[r.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),u.map(c.options,g=>r.jsxRuntimeExports.jsx("option",{selected:u.get(g,"selected",!1),value:g.value,dangerouslySetInnerHTML:{__html:g.label}},g.value))]})};d.registerChaiBlock(d0,{type:"Select",label:"Select",category:"core",icon:z.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:l.o({default:""}),fieldName:l.g({title:"Field Name",default:"select"}),showLabel:l.c({title:"Show label",default:!0}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),required:l.c({title:"Required",default:!1}),_multiple:l.c({title:"Multiple Choice",default:!1}),options:l.S({title:"Options",itemProperties:{label:l.g({title:"Label",default:""}),value:l.g({title:"Value",default:""})}})}});const v0=c=>{const{blockProps:e,fieldName:t,label:s,placeholder:a,styles:i,inputStyles:n,_rows:o,showLabel:v}=c,M=f.generateUUID();return v?r.jsxRuntimeExports.jsxs("div",{...i,...e,children:[v&&r.jsxRuntimeExports.jsx("label",{htmlFor:M,children:s}),r.jsxRuntimeExports.jsx("textarea",{name:t,...n,id:M,placeholder:a,rows:o})]}):r.jsxRuntimeExports.jsx("textarea",{id:M,name:t,...e,...n,...i,placeholder:a,rows:o})};d.registerChaiBlock(v0,{type:"TextArea",label:"TextArea",category:"core",icon:z.InputIcon,group:"form",hidden:!0,props:{fieldName:l.g({title:"Field Name",default:"textarea"}),showLabel:l.c({title:"Show label",default:!0}),styles:l.o({default:""}),inputStyles:l.o({default:"w-full p-1"}),label:l.g({title:"Label",default:"Label"}),placeholder:l.g({title:"Placeholder",default:"Placeholder"}),_rows:l.y({title:"Rows",default:3})}});const M0=u.noop;exports.loadWebBlocks=M0;
|
package/dist/web-blocks.js
CHANGED
|
@@ -127,7 +127,7 @@ d(x0, {
|
|
|
127
127
|
default: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere."
|
|
128
128
|
})
|
|
129
129
|
},
|
|
130
|
-
canAcceptBlock: (c) => c === "Span" || c === "Link"
|
|
130
|
+
canAcceptBlock: (c) => c === "Span" || c === "Link" || c === "Text"
|
|
131
131
|
});
|
|
132
132
|
const y0 = (c) => {
|
|
133
133
|
const { blockProps: l, styles: t, content: e, children: s = null, tag: a } = c;
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-Z_BpKhVy.cjs"),u=require("react"),t=require("lodash-es"),h=require("jotai"),q=require("react-i18next"),s=require("./index-cH1CfTbV.cjs"),b=require("@radix-ui/react-icons"),R=require("@chaibuilder/runtime"),T=require("flagged"),E=require("./MODIFIERS-mVmfEGgo.cjs"),N=require("./atoms-a0H_593V.cjs"),k=require("./html-to-json-ndxaXRT8.cjs");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");require("tailwind-merge");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("react-dom");require("react-quill");require("./Functions-N3yhPYKY.cjs");require("@react-hookz/web");require("tree-model");require("himalaya");require("lodash");const y=({block:r})=>{const[,i]=h.useAtom(N.draggedBlockAtom),{type:l,icon:c,label:d}=r,{addCoreBlock:p,addPredefinedBlock:j}=s.useAddBlock(),[o,g]=s.useSelectedBlockIds(),[,f]=s.useHighlightBlockId(),[,x]=h.useAtom(s.activePanelAtom),a=()=>{if(t.has(r,"blocks")){const m=t.isFunction(r.blocks)?r.blocks():r.blocks;j(R.syncBlocksWithDefaults(m),t.first(o))}else p(r,t.first(o));x(E.OUTLINE_KEY)},n=T.useFeature("dnd");return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(s.Tooltip,{children:[e.jsxRuntimeExports.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsxRuntimeExports.jsxs("button",{onClick:a,type:"button",onDragStart:m=>{m.dataTransfer.setData("text/plain",JSON.stringify(t.omit(r,["component","icon"]))),m.dataTransfer.setDragImage(new Image,0,0),i(t.omit(r,["component","icon"])),setTimeout(()=>{g([]),f(null),x(E.OUTLINE_KEY)},200)},draggable:"true",className:"space-y-2 rounded-lg border border-border p-3 text-center hover:bg-slate-300/50 "+(n?"cursor-grab":"cursor-pointer"),children:[u.createElement(c||b.BoxIcon,{className:"w-4 h-4 mx-auto"}),e.jsxRuntimeExports.jsx("p",{className:"text-xs",children:d||l})]})}),e.jsxRuntimeExports.jsx(s.TooltipContent,{children:e.jsxRuntimeExports.jsx("p",{children:d||l})})]})})},B=()=>{const{t:r}=q.useTranslation(),[i,l]=u.useState(""),{addPredefinedBlock:c}=s.useAddBlock(),[d]=s.useSelectedBlockIds(),[,p]=h.useAtom(s.activePanelAtom),j=()=>{const o=k.getBlocksFromHTML(i);c([...o],t.first(d)||null),l(""),p(E.OUTLINE_KEY)};return e.jsxRuntimeExports.jsxs(s.Card,{className:"border-border/0 p-0 shadow-none",children:[e.jsxRuntimeExports.jsx(s.CardHeader,{className:"p-3",children:e.jsxRuntimeExports.jsx(s.CardDescription,{children:r("html_snippet_description")})}),e.jsxRuntimeExports.jsx(s.CardContent,{className:"space-y-2 px-3 py-0",children:e.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[e.jsxRuntimeExports.jsx(s.Label,{htmlFor:"current",className:"text-sm",children:r("tailwind_html_snippet")}),e.jsxRuntimeExports.jsx(s.Textarea,{autoFocus:!0,tabIndex:1,ref:o=>o&&o.focus(),onChange:o=>l(o.target.value),rows:12,value:i,placeholder:r("enter_code_snippet"),className:"resize-none overflow-x-auto whitespace-pre bg-gray-100 font-mono text-xs font-normal"})]})}),e.jsxRuntimeExports.jsxs(s.CardFooter,{className:"flex flex-col justify-end p-3",children:[e.jsxRuntimeExports.jsx(s.Button,{disabled:i.trim()==="",onClick:()=>j(),size:"sm",className:"w-full",children:r("import_html")}),e.jsxRuntimeExports.jsx(s.Alert,{variant:"default",className:"mt-2 border-none p-1 text-gray-400",children:e.jsxRuntimeExports.jsx(s.AlertTitle,{className:"text-xs font-normal leading-4",children:r("note_imported_html")})})]})]})},v=()=>{const{t:r}=q.useTranslation(),[i,l]=u.useState("core"),[c,d]=u.useState("basic"),p=R.useChaiBlocks(),[,j]=h.useAtom(s.showPredefinedBlockCategoryAtom),o=s.useBuilderProp("importHTMLSupport",!0),g=s.useBuilderProp("filterChaiBlock",()=>!0),f=t.filter(p,g),x=t.groupBy(f,"category"),a=t.uniq(t.map(x.core,"group"));return u.useEffect(()=>{!t.includes(a,c)&&!t.isEmpty(a)&&!t.isEmpty(c)&&d(t.first(a))},[a,c]),e.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-72 flex-col overflow-hidden",children:[e.jsxRuntimeExports.jsxs("div",{className:"mb-2 flex flex-col justify-between rounded-md bg-background/30 p-1",children:[e.jsxRuntimeExports.jsx("h1",{className:"flex flex-col items-baseline px-1 text-xl font-semibold xl:flex-col",children:r("add_block")}),e.jsxRuntimeExports.jsx("span",{className:"p-0 text-xs font-light leading-3 opacity-80 xl:pl-1",children:r(i==="html"?"enter_paste_tailwind_html":"click_to_add_block")})]}),e.jsxRuntimeExports.jsx(s.Tabs,{onValueChange:n=>{j(""),l(n)},value:i,className:"h-max",children:e.jsxRuntimeExports.jsxs(s.TabsList,{className:"grid w-full "+(o?"grid-cols-2":"grid-cols-1"),children:[e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"core",children:r("Blocks")}),o?e.jsxRuntimeExports.jsx(s.TabsTrigger,{value:"html",children:r("import")}):null]})}),i==="core"&&e.jsxRuntimeExports.jsx(s.ScrollArea,{className:"-mx-1.5 h-[calc(100vh-156px)] overflow-y-auto",children:e.jsxRuntimeExports.jsx("div",{className:"mt-2 w-full",children:u.Children.toArray(t.map(a,n=>t.reject(t.filter(t.values(x.core),{group:n}),{hidden:!0}).length?e.jsxRuntimeExports.jsx(s.Accordion,{type:"single",value:n,collapsible:!0,className:"w-full",children:e.jsxRuntimeExports.jsxs(s.AccordionItem,{value:n,children:[e.jsxRuntimeExports.jsx(s.AccordionTrigger,{className:"rounded-md bg-gray-100 px-4 py-2 capitalize",children:n}),e.jsxRuntimeExports.jsx(s.AccordionContent,{className:"p-3",children:e.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-3 gap-2",children:u.Children.toArray(t.reject(t.filter(t.values(x.core),{group:n}),{hidden:!0}).map(m=>e.jsxRuntimeExports.jsx(y,{block:m})))})})]})}):null))})}),i==="html"&&o?e.jsxRuntimeExports.jsx(B,{}):null]})};exports.default=v;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";var ie=Object.defineProperty;var re=(e,t,n)=>t in e?ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var T=(e,t,n)=>(re(e,typeof t!="symbol"?t+"":t,n),n);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./jsx-runtime-Z_BpKhVy.cjs"),p=require("react"),l=require("lodash-es"),R=require("@radix-ui/react-icons"),o=require("./index-cH1CfTbV.cjs"),F=require("./index-hdfBoPkh.cjs"),U=require("react-i18next"),k=require("jotai"),le=require("lucide-react"),Y=require("react-dom"),C=require("prop-types"),ae=require("react-quill"),L=require("./atoms-a0H_593V.cjs"),ce=require("@floating-ui/dom"),V=require("@floating-ui/react-dom"),de=require("@react-hookz/web"),ue=require("flagged"),pe=require("@tailwindcss/typography"),xe=require("@tailwindcss/forms"),me=require("@tailwindcss/aspect-ratio"),ge=require("tailwindcss-palette-generator"),he=require("tailwind-merge"),H=require("./MODIFIERS-mVmfEGgo.cjs"),fe=require("@chaibuilder/runtime"),G=require("lodash"),je=require("react-wrap-balancer"),Ee=require("re-resizable");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("@radix-ui/react-toggle");require("class-variance-authority");require("./utils-D_vtk3zK.cjs");require("clsx");require("@radix-ui/react-switch");require("@radix-ui/react-slot");require("@radix-ui/react-accordion");require("@radix-ui/react-alert-dialog");require("@radix-ui/react-dialog");require("@radix-ui/react-label");require("@radix-ui/react-scroll-area");require("@radix-ui/react-tabs");require("@radix-ui/react-tooltip");require("@radix-ui/react-popover");require("@radix-ui/react-menubar");require("@radix-ui/react-hover-card");require("@radix-ui/react-select");require("@radix-ui/react-dropdown-menu");require("@radix-ui/react-separator");require("@radix-ui/react-toast");require("cmdk");require("@radix-ui/react-context-menu");require("react-icons-picker");require("./Functions-N3yhPYKY.cjs");require("tree-model");require("i18next");require("react-hotkeys-hook");require("./index--mLLy7QQ.cjs");const ye=()=>{const{hasUndo:e,hasRedo:t,undo:n,redo:r}=o.useUndoManager();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(o.Button,{disabled:!e(),size:"sm",onClick:n,className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(R.ResetIcon,{})}),s.jsxRuntimeExports.jsx(o.Button,{disabled:!t(),onClick:r,size:"sm",className:"rounded-full",variant:"ghost",children:s.jsxRuntimeExports.jsx(R.ResetIcon,{className:"rotate-180 scale-y-[-1] transform"})})]})};function ke(){const[e,t]=o.useDarkMode();return s.jsxRuntimeExports.jsxs("div",{className:"flex items-center",children:[s.jsxRuntimeExports.jsx(R.SunIcon,{className:"size-4 shrink-0"}),s.jsxRuntimeExports.jsx(o.Switch,{id:"dark-mode-switch",checked:e,onCheckedChange:()=>{t(!e)},className:`${e?"bg-violet-600":"bg-violet-300"} relative ml-2 inline-flex h-[20px] w-[40px] shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors duration-200 ease-in-out focus:outline-none focus-visible:ring-2 focus-visible:ring-white focus-visible:ring-opacity-75`,children:s.jsxRuntimeExports.jsx("span",{"aria-hidden":"true",className:`${e?"translate-x-5":"translate-x-0"} pointer-events-none -mt-px inline-block h-[18px] w-[20px] transform rounded-full bg-white shadow-lg ring-0 transition duration-200 ease-in-out`})}),s.jsxRuntimeExports.jsx(F.FaMoon,{className:"size-4 ml-3 shrink-0"})]})}const X=({landscape:e=!1})=>s.jsxRuntimeExports.jsxs("svg",{className:e?"rotate-90":"",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 13 13",xmlSpace:"preserve",width:13,height:13,children:[s.jsxRuntimeExports.jsx("g",{strokeWidth:0}),s.jsxRuntimeExports.jsx("g",{strokeLinecap:"round",strokeLinejoin:"round"}),s.jsxRuntimeExports.jsx("path",{d:"M10.65 0H2.349a.851.851 0 0 0-.851.852v11.299c0 .47.382.852.851.852h8.3a.851.851 0 0 0 .851-.852V.852A.851.851 0 0 0 10.65 0zM6.599 12.466a.367.367 0 1 1 0-.735.367.367 0 0 1 0 .735zm3.9-1.267H2.5V1h8.001v10.199z",style:{fill:"#000"}})]}),be=[{title:"mobile_xs_title",content:"mobile_xs_content",breakpoint:"xs",icon:s.jsxRuntimeExports.jsx(R.MobileIcon,{}),width:400},{title:"mobile_sm_title",content:"mobile_sm_content",breakpoint:"sm",icon:s.jsxRuntimeExports.jsx(R.MobileIcon,{className:"rotate-90"}),width:640},{title:"tablet_md_title",content:"tablet_md_content",breakpoint:"md",icon:s.jsxRuntimeExports.jsx(X,{}),width:800},{title:"tablet_lg_title",content:"tablet_lg_content",breakpoint:"lg",icon:s.jsxRuntimeExports.jsx(X,{landscape:!0}),width:1024},{title:"desktop_xl_title",content:"desktop_xl_content",breakpoint:"xl",icon:s.jsxRuntimeExports.jsx(R.LaptopIcon,{}),width:1420},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",breakpoint:"2xl",icon:s.jsxRuntimeExports.jsx(R.DesktopIcon,{}),width:1920}],Z=({title:e,content:t,currentBreakpoint:n,breakpoint:r,width:c,icon:d,onClick:a})=>{const{t:i}=U.useTranslation();return s.jsxRuntimeExports.jsxs(o.HoverCard,{children:[s.jsxRuntimeExports.jsx(o.HoverCardTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx(o.Button,{onClick:()=>a(c),size:"sm",variant:r===n?"secondary":"ghost",children:d})}),s.jsxRuntimeExports.jsx(o.HoverCardContent,{className:"w-52 border-border",children:s.jsxRuntimeExports.jsx("div",{className:"flex justify-between space-x-4",children:s.jsxRuntimeExports.jsxs("div",{className:"space-y-1",children:[s.jsxRuntimeExports.jsx("h4",{className:"text-sm font-semibold",children:i(e)}),s.jsxRuntimeExports.jsx("p",{className:"text-xs",children:i(t)})]})})})]})},ve=()=>{const[,e,t]=o.useCanvasWidth(),[n,r]=o.useSelectedBreakpoints(),{t:c}=U.useTranslation(),d=o.useBuilderProp("breakpoints",be),a=i=>{n.includes(i)?n.length>2&&r(n.filter(u=>u!==i)):r(u=>[...u,i])};return d.length<4?s.jsxRuntimeExports.jsx("div",{className:"flex items-center rounded-md",children:l.map(d,i=>p.createElement(Z,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e}))}):s.jsxRuntimeExports.jsxs("div",{className:"flex items-center rounded-md",children:[l.map(d.filter(i=>l.includes(n,l.toUpper(i.breakpoint))),i=>p.createElement(Z,{...i,onClick:t,key:i.breakpoint,currentBreakpoint:e})),s.jsxRuntimeExports.jsxs(o.DropdownMenu,{children:[s.jsxRuntimeExports.jsx(o.DropdownMenuTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsx("span",{className:"cursor-pointer px-2.5 hover:opacity-80",children:s.jsxRuntimeExports.jsx(R.DotsVerticalIcon,{className:"scale-90 transform"})})}),s.jsxRuntimeExports.jsxs(o.DropdownMenuContent,{className:"w-56 border-border text-xs",children:[s.jsxRuntimeExports.jsx(o.DropdownMenuLabel,{children:c("Breakpoints")}),s.jsxRuntimeExports.jsx(o.DropdownMenuSeparator,{}),l.map(d,i=>s.jsxRuntimeExports.jsx(o.DropdownMenuCheckboxItem,{disabled:i.breakpoint==="xs",onCheckedChange:()=>a(l.toUpper(i.breakpoint)),checked:l.includes(n,l.toUpper(i.breakpoint)),children:c(i.title)},i.breakpoint))]})]})]})},Re=()=>{const{t:e}=U.useTranslation(),{setNewBlocks:t}=o.useBlocksStoreUndoableActions(),[,n]=o.useSelectedBlockIds(),[,r]=o.useSelectedStylingBlocks(),c=p.useCallback(()=>{t([]),n([]),r([])},[t]);return s.jsxRuntimeExports.jsx("div",{className:"flex items-center",children:s.jsxRuntimeExports.jsxs(o.AlertDialog,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTrigger,{asChild:!0,children:s.jsxRuntimeExports.jsxs(o.Button,{size:"sm",variant:"ghost",className:"flex items-center gap-x-1",children:[s.jsxRuntimeExports.jsx(R.EraserIcon,{})," ",e("clear")]})}),s.jsxRuntimeExports.jsxs(o.AlertDialogContent,{className:"border-border",children:[s.jsxRuntimeExports.jsxs(o.AlertDialogHeader,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogTitle,{children:e("clear_canvas_title")}),s.jsxRuntimeExports.jsx(o.AlertDialogDescription,{children:e("clear_canvas_description")})]}),s.jsxRuntimeExports.jsxs(o.AlertDialogFooter,{children:[s.jsxRuntimeExports.jsx(o.AlertDialogCancel,{children:e("cancel")}),s.jsxRuntimeExports.jsx(o.AlertDialogAction,{onClick:c,children:e("yes")})]})]})]})})},Se=()=>{const[e,t]=k.useAtom(o.aiAssistantActiveAtom);return o.useBuilderProp("askAiCallBack",null)?s.jsxRuntimeExports.jsxs("div",{className:"flex items-center space-x-2",children:[s.jsxRuntimeExports.jsxs(o.Label,{htmlFor:"ai-assistant",className:"flex items-center gap-x-1 text-sm text-yellow-600",children:[s.jsxRuntimeExports.jsx(le.SparklesIcon,{className:"w-4"}),"AI Assistant"]}),s.jsxRuntimeExports.jsx(o.Switch,{className:"scale-90",checked:e,onCheckedChange:r=>{t(r)},id:"ai-assitantt"})]}):null},Ce=()=>{const e=o.useBuilderProp("darkMode",!0),[t]=o.useCanvasZoom();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-10 items-center justify-between border-b bg-background/70 px-2",children:[s.jsxRuntimeExports.jsxs("div",{className:"flex h-full space-x-2",children:[s.jsxRuntimeExports.jsx(ve,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),e?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[s.jsxRuntimeExports.jsx(ke,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"})]}):null,s.jsxRuntimeExports.jsxs("div",{className:"flex w-12 cursor-not-allowed items-center justify-center gap-x-1 space-x-0 font-medium text-gray-400",children:[s.jsxRuntimeExports.jsx(R.ZoomInIcon,{className:"h-3.5 w-3.5 flex-shrink-0"})," ",s.jsxRuntimeExports.jsxs("div",{className:"text-xs leading-3",children:[l.round(t,0),"%"]})]}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(ye,{})]}),s.jsxRuntimeExports.jsxs("div",{className:"flex h-full items-center space-x-2",children:[s.jsxRuntimeExports.jsx(Re,{}),s.jsxRuntimeExports.jsx(o.Separator,{orientation:"vertical"}),s.jsxRuntimeExports.jsx(Se,{})]})]})},we=`<!doctype html>
|
|
2
|
-
<html lang="en" dir="__HTML_DIR__" class="scroll-smooth h-full overflow-y-auto">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
|
-
<script src="https://cdn.tailwindcss.com?plugins=forms,typography,aspect-ratio"><\/script>
|
|
7
|
-
<style>
|
|
8
|
-
html { height: 100%; overflow:auto; }
|
|
9
|
-
body { height: 100%; }
|
|
10
|
-
.air-highlight{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}
|
|
11
|
-
.air-highlight-multi{ outline: 1px solid #29e503 !important; outline-offset: -1px;}
|
|
12
|
-
body{ -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none;
|
|
13
|
-
-moz-user-select: none;-ms-user-select: none; user-select: none; }
|
|
14
|
-
html{
|
|
15
|
-
-ms-overflow-style: none; /* IE and Edge */
|
|
16
|
-
scrollbar-width: none; /* Firefox */
|
|
17
|
-
}
|
|
18
|
-
/** IMPORTANT: Make fields content editable in SAFARI */
|
|
19
|
-
[contenteditable] {-webkit-user-select: text;user-select: text;}
|
|
20
|
-
|
|
21
|
-
html::-webkit-scrollbar { width: 0 !important }
|
|
22
|
-
.aspect-auto{aspect-ratio: auto;}
|
|
23
|
-
.aspect-square{aspect-ratio: 1/1;}
|
|
24
|
-
.aspect-video{aspect-ratio: 16/9;}
|
|
25
|
-
.dragging [data-dnd="leaf"] { pointer-events: none; } .dragging [data-dnd="leaf"] * { pointer-events: none; }
|
|
26
|
-
.dragging [data-dnd="ignore"], .dragging [data-dnd="ignore"] * { pointer-events: none; }
|
|
27
|
-
a{ pointer-events: none !important; }
|
|
28
|
-
[contenteditable="true"], [contenteditable="true"] * { cursor: text !important; }
|
|
29
|
-
[contenteditable="true"] {
|
|
30
|
-
outline: none;
|
|
31
|
-
box-shadow: 0 0 0px 4px rgba(36, 150, 255, 0.2);
|
|
32
|
-
-webkit-user-select: text;
|
|
33
|
-
-moz-user-select: text;
|
|
34
|
-
user-select: text;
|
|
35
|
-
}
|
|
36
|
-
.frame-root .frame-content { height: 100%; }
|
|
37
|
-
[data-drop="yes"] { outline: 2px dashed orange !important; outline-offset: -2px }
|
|
38
|
-
[data-dnd="yes"] { pointer-events: auto !important}
|
|
39
|
-
[data-dnd="no"] { pointer-events: none !important; }
|
|
40
|
-
[data-dnd-dragged="yes"] { opacity: 0.6; pointer-events: none; }
|
|
41
|
-
[data-dnd-dragged="no"] { opacity: 1; pointer-events: auto !important; }
|
|
42
|
-
[force-show] { display: block !important; }
|
|
43
|
-
</style>
|
|
44
|
-
<style id="hidden-blocks"></style>
|
|
45
|
-
<style id="selected-block"></style>
|
|
46
|
-
<style id="selected-styling-block"></style>
|
|
47
|
-
<style id="highlighted-block"></style>
|
|
48
|
-
<style id="dragged-block"></style>
|
|
49
|
-
|
|
50
|
-
</head>
|
|
51
|
-
<body class="font-body antialiased h-full">
|
|
52
|
-
<div class="frame-root h-full"></div>
|
|
53
|
-
<script src="https://cdn.jsdelivr.net/npm/quill@2.0.0/dist/quill.js"><\/script>
|
|
54
|
-
</body>
|
|
55
|
-
</html>`,Ae=e=>{const[t]=o.useCanvasWidth(),[,n]=o.useCanvasZoom(),[r,c]=p.useState({}),d=p.useCallback(()=>{const{width:a,height:i}=e;if(a<t){const u=parseFloat((a/t).toFixed(2).toString());let g={};const h=i*u;i&&(g={height:100+(i-h)/h*100+"%"}),c({position:"relative",top:0,transform:`scale(${u})`,transformOrigin:"top left",...g,maxWidth:"none"}),n(u*100)}else c({}),n(100)},[t,e,n]);return p.useEffect(()=>{d()},[t,e,n,d]),r};let ee,te;typeof document<"u"&&(ee=document);typeof window<"u"&&(te=window);const se=p.createContext({document:ee,window:te}),P=()=>p.useContext(se),{Provider:Be,Consumer:rt}=se;class ne extends p.Component{componentDidMount(){this.props.contentDidMount()}componentDidUpdate(){this.props.contentDidUpdate()}render(){return p.Children.only(this.props.children)}}T(ne,"propTypes",{children:C.element.isRequired,contentDidMount:C.func.isRequired,contentDidUpdate:C.func.isRequired});class $ extends p.Component{constructor(n,r){super(n,r);T(this,"setRef",n=>{this.nodeRef.current=n;const{forwardedRef:r}=this.props;typeof r=="function"?r(n):r&&(r.current=n)});T(this,"handleLoad",()=>{clearInterval(this.loadCheck),this.state.iframeLoaded||this.setState({iframeLoaded:!0})});T(this,"loadCheck",()=>setInterval(()=>{this.handleLoad()},500));this._isMounted=!1,this.nodeRef=p.createRef(),this.state={iframeLoaded:!1}}componentDidMount(){this._isMounted=!0,this.getDoc()&&this.nodeRef.current.contentWindow.addEventListener("DOMContentLoaded",this.handleLoad)}componentWillUnmount(){this._isMounted=!1,this.nodeRef.current.removeEventListener("DOMContentLoaded",this.handleLoad)}getDoc(){return this.nodeRef.current?this.nodeRef.current.contentDocument:null}getMountTarget(){const n=this.getDoc();return this.props.mountTarget?n.querySelector(this.props.mountTarget):n.body.children[0]}renderFrameContents(){if(!this._isMounted)return null;const n=this.getDoc();if(!n)return null;const r=this.props.contentDidMount,c=this.props.contentDidUpdate,d=n.defaultView||n.parentView,a=s.jsxRuntimeExports.jsx(ne,{contentDidMount:r,contentDidUpdate:c,children:s.jsxRuntimeExports.jsx(Be,{value:{document:n,window:d},children:s.jsxRuntimeExports.jsx("div",{className:"frame-content",children:this.props.children})})}),i=this.getMountTarget();return[Y.createPortal(this.props.head,this.getDoc().head),Y.createPortal(a,i)]}render(){const n={...this.props,srcDoc:this.props.initialContent,children:void 0};return delete n.head,delete n.initialContent,delete n.mountTarget,delete n.contentDidMount,delete n.contentDidUpdate,delete n.forwardedRef,s.jsxRuntimeExports.jsx("iframe",{...n,ref:this.setRef,onLoad:this.handleLoad,children:this.state.iframeLoaded&&this.renderFrameContents()})}}T($,"propTypes",{style:C.object,head:C.node,initialContent:C.string,mountTarget:C.string,contentDidMount:C.func,contentDidUpdate:C.func,children:C.oneOfType([C.element,C.arrayOf(C.element)])}),T($,"defaultProps",{style:{},head:null,children:void 0,mountTarget:void 0,contentDidMount:()=>{},contentDidUpdate:()=>{},initialContent:'<!DOCTYPE html><html><head></head><body><div class="frame-root"></div></body></html>'});const Ie=p.forwardRef((e,t)=>s.jsxRuntimeExports.jsx($,{...e,forwardedRef:t}));function W(e){const t=window.getComputedStyle(e),n=t.display;if(n==="flex"||n==="inline-flex"){const r=t.flexDirection;return r==="column"||r==="column-reverse"?"vertical":"horizontal"}else if(n==="grid"){const r=t.gridAutoFlow,c=t.gridTemplateRows,d=t.gridTemplateColumns;return r.includes("column")||c.split(" ").length>d.split(" ").length?"vertical":"horizontal"}else if(n==="block"||n==="inline-block")return"vertical";return"horizontal"}let E=null,A=[],q=null,O=null;const Q=(e,t,n)=>{if(!E||!e)return;const r=E==null?void 0:E.getElementById("placeholder"),c=A.map(([u])=>u),d=c.reduce((u,g)=>Math.abs(g-n)<Math.abs(u-n)?g:u,0),a=c.indexOf(d);if(!A[a])return;const i=A[a];r.style.width=t==="vertical"?i[2]+"px":"2px",r.style.height=t==="vertical"?"2px":i[2]+"px",r.style.display="block",t==="vertical"?(r.style.top=i[0]+"px",r.style.left=i[1]+"px"):(r.style.top=i[1]+"px",r.style.left=i[0]+"px")};function _e(e,t){let n=0,r=1/0;return t.forEach((c,d)=>{const a=Math.abs(c[0]-e);a<r&&(r=a,n=d)}),n}const De=e=>{const n=W(e)==="horizontal";A=[],Array.from(e.children).forEach((r,c)=>{if(r.classList.contains("pointer-events-none"))return;const d=n?r.offsetLeft:r.offsetTop,a=n?[r.offsetTop,r.clientHeight]:[r.offsetLeft,r.clientWidth];if(A.push([d,a[0],a[1]]),c===e.children.length-1){const i=n?r.offsetLeft+r.clientWidth:r.offsetTop+r.clientHeight;A.push([i,a[0],a[1]])}})},Te=l.throttle(e=>{var c;const t=e.target,n=W(t),r=(c=E==null?void 0:E.defaultView)==null?void 0:c.scrollY;n==="vertical"?Q(t,n,e.clientY+r):Q(t,n,e.clientX)},0);function J(){const e=E==null?void 0:E.getElementById("placeholder");e.style.display="none",Me("pointer-none"),qe()}function Me(e){(E==null?void 0:E.querySelectorAll(`.${e}`)).forEach(n=>{n.classList.remove(e)})}function qe(){const e=E==null?void 0:E.querySelector('[data-drop="yes"]');e&&e.removeAttribute("data-drop")}const Ne=()=>{const{document:e}=P(),[t,n]=k.useAtom(o.draggingFlagAtom),{addCoreBlock:r}=o.useAddBlock(),[,c]=o.useHighlightBlockId(),[,d]=o.useSelectedBlockIds(),{moveBlocks:a}=o.useBlocksStoreUndoableActions(),[,i]=k.useAtom(o.draggedBlockIdAtom),[u,g]=k.useAtom(L.draggedBlockAtom),[,h]=k.useAtom(L.dropTargetAtom),x=()=>{J(),n(!1),i(""),g(null),h(null),A=[]};return E=e,{isDragging:t,onDragOver:m=>{m.preventDefault(),m.stopPropagation(),Te(m)},onDrop:m=>{var B;q==null||q.classList.remove("drop-target");const f=q,b=W(f)==="vertical"?m.clientY+((B=E==null?void 0:E.defaultView)==null?void 0:B.scrollY):m.clientX;O=_e(b,A);const v=u,S=f.getAttribute("data-block-id");if(v===q){x();return}if(!l.has(v,"_id")){r(v,S==="canvas"?null:S,O),setTimeout(x,300);return}let w=f.getAttribute("data-block-id");w===null&&(w=m.target.parentElement.getAttribute("data-block-id")),a([v._id],w,O),x(),setTimeout(J,300)},onDragEnter:m=>{const f=m,y=f.target;q=y;const b=y.getAttribute("data-block-id");h(b),f.stopPropagation(),f.preventDefault(),A=[],De(y),y.classList.add("drop-target"),n(!0),c(""),d([])}}};function K(e){return e.getAttribute("data-block-id")?e:e.closest("[data-block-id]")}function Le(e){e.container.innerHTML="",e.container.parentNode.removeChild(e.container);var t=document.querySelector(".ql-toolbar");t&&t.parentNode.removeChild(t),e=null}const Fe=()=>{const e=["Heading","Paragraph","Text","Link","Span","Button"],t=o.useUpdateBlocksProps(),[,n]=o.useHighlightBlockId(),[r,c]=k.useAtom(o.inlineEditingActiveAtom);return d=>{var x;if(r)return;const a=K(d.target),i=a.getAttribute("data-block-type");if(!i||!e.includes(i))return;const u=a.cloneNode(!0);a.style.display="none",Array.from(u.attributes).forEach(m=>{m.name!=="class"&&u.removeAttribute(m.name)}),i==="Text"&&(u.style.display="inline-block"),a.parentNode.insertBefore(u,a.nextSibling);const g=new ae.Quill(u,{placeholder:"Type here..."});function h(){const m=g.getText(0,g.getLength());t([a.getAttribute("data-block-id")],{content:m}),a.removeAttribute("style"),u.removeEventListener("blur",h,!0),Le(g),c(""),n("")}u.addEventListener("blur",h,!0),u.addEventListener("keydown",m=>{(m.key==="Enter"||m.key==="Escape")&&h()}),g.focus(),(x=u.querySelector(".ql-clipboard"))==null||x.remove(),c(a.getAttribute("data-block-id"))}},He=()=>{const[,e]=o.useSelectedStylingBlocks(),[t,n]=o.useSelectedBlockIds(),[,r]=o.useHighlightBlockId(),[c]=k.useAtom(o.inlineEditingActiveAtom),[d]=k.useAtom(o.treeRefAtom);return a=>{if(c)return;a.stopPropagation();const i=K(a.target);if(i!=null&&i.getAttribute("data-block-id")&&(i==null?void 0:i.getAttribute("data-block-id"))==="container"){n([]),e([]),r("");return}if(i!=null&&i.getAttribute("data-block-parent")){const u=i.getAttribute("data-style-prop"),g=i.getAttribute("data-style-id"),h=i.getAttribute("data-block-parent");t.includes(h)||d==null||d.closeAll(),e([{id:g,prop:u,blockId:h}]),n([h])}else if(i!=null&&i.getAttribute("data-block-id")){let u=i.getAttribute("data-block-id");t.includes(u)||d==null||d.closeAll(),e([]),n([u])}r("")}},Pe=l.throttle((e,t)=>{const n=K(e.target);n!=null&&n.getAttribute("data-style-id")&&t(n.getAttribute("data-style-id"))},100),Oe=()=>{const[,e]=o.useHighlightBlockId(),[t]=k.useAtom(o.inlineEditingActiveAtom);return n=>{t||Pe(n,e)}},$e=({children:e})=>{const{document:t}=P(),[n]=o.useSelectedBlockIds(),[r,c]=o.useSelectedStylingBlocks();p.useEffect(()=>{setTimeout(()=>{if(!l.isEmpty(r))return;const g=oe(t,l.first(n));if(g){const h=g.getAttribute("data-style-prop");if(h){const x=g.getAttribute("data-style-id"),m=g.getAttribute("data-block-parent");c([{id:x,prop:h,blockId:m}])}}},100)},[t,n,c,r]);const d=Fe(),a=He(),i=Oe(),u=Ne();return s.jsxRuntimeExports.jsx("div",{"data-block-id":"canvas",id:"canvas",onClick:a,onDoubleClick:d,onMouseMove:i,...l.omit(u,"isDragging"),className:"relative mb-5 h-full max-w-full px-1 "+(u.isDragging?"dragging":""),children:e})},oe=(e,t)=>e.querySelector(`[data-block-id="${t}"]`),ze=()=>{const{document:e}=P();return F.useKeyEventWatcher(e),null},Ue=({block:e,label:t})=>{const[,n]=o.useSelectedBlockIds(),[,r]=o.useHighlightBlockId(),[,c]=k.useAtom(L.draggedBlockAtom),d=ue.useFeature("dnd");return s.jsxRuntimeExports.jsxs("div",{className:"mr-10 flex cursor-grab items-center space-x-1 px-1",draggable:d?"true":"false",onDragStart:a=>{a.dataTransfer.setData("text/plain",JSON.stringify(l.pick(e,["_id","_type","_name"]))),c(e),setTimeout(()=>{n([]),r(null)},200)},children:[s.jsxRuntimeExports.jsx(R.DragHandleDots2Icon,{}),t]})},We=({selectedBlockElement:e,block:t})=>{const n=o.useRemoveBlocks(),r=o.useDuplicateBlocks(),[,c]=o.useSelectedBlockIds(),[,d]=o.useSelectedStylingBlocks(),[a]=k.useAtom(o.inlineEditingActiveAtom),{floatingStyles:i,refs:u,update:g}=V.useFloating({placement:"top-start",middleware:[V.shift(),ce.flip()],elements:{reference:e}});de.useResizeObserver(e,()=>g(),e!==null);const h=l.get(t,"_parent",null),x=l.isEmpty(l.get(t,"_name",""))?l.get(t,"_type",""):l.get(t,"_name","");return!e||!t||a?null:s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:s.jsxRuntimeExports.jsxs("div",{role:"button",tabIndex:0,ref:u.setFloating,style:i,onClick:m=>{m.stopPropagation(),m.preventDefault()},onKeyDown:m=>m.stopPropagation(),className:"z-[99999] flex h-6 items-center bg-blue-500 py-2 text-xs text-white",children:[s.jsxRuntimeExports.jsx(Ue,{label:x,block:t}),s.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 px-1",children:[h&&s.jsxRuntimeExports.jsx(R.ArrowUpIcon,{className:"hover:scale-105",onClick:()=>{d([]),c([h])}}),o.canDuplicateBlock(l.get(t,"_type",""))?s.jsxRuntimeExports.jsx(R.CopyIcon,{className:"hover:scale-105",onClick:()=>r([t==null?void 0:t._id])}):null,o.canDeleteBlock(l.get(t,"_type",""))?s.jsxRuntimeExports.jsx(R.TrashIcon,{className:"hover:scale-105",onClick:()=>n([t==null?void 0:t._id])}):null]})]})})},Ke=({model:e})=>{const[t]=o.useBrandingOptions(),[n]=o.useSelectedBlockIds(),[r]=o.useDarkMode(),[c]=o.useHighlightBlockId(),[d]=o.useSelectedStylingBlocks(),[a]=k.useAtom(o.draggedBlockIdAtom),{document:i,window:u}=P(),[g]=p.useState(i==null?void 0:i.getElementById("highlighted-block")),[h]=p.useState(i==null?void 0:i.getElementById("selected-block")),[x]=p.useState(i==null?void 0:i.getElementById("selected-styling-block")),[m]=p.useState(i==null?void 0:i.getElementById("dragged-block"));p.useEffect(()=>{r?i==null||i.documentElement.classList.add("dark"):i==null||i.documentElement.classList.remove("dark")},[r,i]);const f=l.get(t,"headingFont","DM Sans"),y=l.get(t,"bodyFont","DM Sans");return p.useEffect(()=>{const b=l.get(t,"primaryColor","#000"),v=l.get(t,"secondaryColor","#FFF"),S=l.get(t,"bodyBgLightColor","#fff"),w=l.get(t,"bodyBgDarkColor","#000"),B=l.get(t,"bodyTextDarkColor","#000"),I=l.get(t,"bodyTextLightColor","#fff"),M=ge([{color:b,name:"primary"},{color:v,name:"secondary"}]),N={"bg-light":S,"bg-dark":w,"text-dark":B,"text-light":I},j=l.get(t,"roundedCorners","0");!u||!u.tailwind||(u.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},fontFamily:{heading:[f],body:[y]},borderRadius:{DEFAULT:`${j||"0"}px`},colors:{...N,...M}}},plugins:[pe,xe,me]})},[t,u,f,y]),p.useEffect(()=>{h&&(h.textContent=`${l.map(n,b=>`[data-block-id="${b}"]`).join(",")}{
|
|
56
|
-
outline: 1px solid ${n.length===1?"#42a1fc":"orange"} !important; outline-offset: -1px;
|
|
57
|
-
}`)},[n,h]),p.useEffect(()=>{if(!a){m.textContent="";return}m.textContent=`[data-block-id="${a}"]{ pointer-events: none !important; opacity: 0.2 !important}`},[a]),p.useEffect(()=>{g&&(g.textContent=c?`[data-style-id="${c}"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}`:"")},[c,n,g]),p.useEffect(()=>{x&&(x.textContent=`${l.map(d,({id:b})=>`[data-style-id="${b}"]`).join(",")}{
|
|
58
|
-
outline: 1px solid #42a1fc !important; outline-offset: -1px;
|
|
59
|
-
}`)},[d,x]),p.useEffect(()=>{const b=l.get(t,"bodyTextLightColor","#64748b"),v=l.get(t,"bodyTextDarkColor","#94a3b8"),S=l.get(t,"bodyBgLightColor","#FFFFFF"),w=l.get(t,"bodyBgDarkColor","#0f172a");i.body.className=`font-body antialiased text-[${b}] bg-[${S}] dark:text-[${v}] dark:bg-[${w}]`},[t,i,e]),e==="page"?s.jsxRuntimeExports.jsxs(s.jsxRuntimeExports.Fragment,{children:[f&&s.jsxRuntimeExports.jsx("link",{id:"heading-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${f.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),y&&f!==y&&s.jsxRuntimeExports.jsx("link",{id:"body-font",rel:"stylesheet",type:"text/css",href:`https://fonts.googleapis.com/css2?family=${y.replace(/ /g,"+")}:wght@300;400;500;600;700;800;900&display=swap`,media:"all"}),f&&s.jsxRuntimeExports.jsx("style",{children:`h1,h2,h3,h4,h5,h6{font-family: "${f}",ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";}`})]}):null},Ye=()=>k.useAtom(o.canvasSettingsAtom),Ve=(e,t)=>{const n=["xs","sm","md","lg","xl","2xl"],r=n.indexOf(t),c=e.split(" ");let d=new Array(n.length).fill(!1);for(const a of c){let[i,u]=a.split(":");u||(u=i,i="xs");const g=n.indexOf(i);if(g<=r){const h=["block","flex","inline","inline-block","inline-flex","grid","table"],x=["hidden"];if(h.includes(u))for(let m=g;m<n.length;m++)d[m]=!0;else if(x.includes(u))for(let m=g;m<n.length;m++)d[m]=!1}}return d[r]},Ge=e=>{const t={};return Object.keys(e).forEach(n=>{l.isString(e[n])&&e[n].startsWith(H.SLOT_KEY)&&(t[n]=e[n].replace(H.SLOT_KEY,"").split(","))}),t},Xe=l.memoize(e=>{const t=e.replace(H.STYLES_KEY,"").split(",");return he.twMerge(t[0],t[1])});function Ze(e,t){return l.get(e,`${t}_attrs`,{})}function Qe(e,t){const n={};return Object.keys(e).forEach(r=>{if(l.isString(e[r])&&e[r].startsWith(H.STYLES_KEY)){const c=Xe(e[r]),d=Ze(e,r);n[r]={className:c,"data-style-prop":r,"data-block-parent":e._id,"data-style-id":`${r}-${e._id}`,...d};const a=l.has(d,"x-show")||l.has(d,"x-if");a&&(n.__isHidden=a&&!Ve(c,t))}}),n}function Je(e,t){const n=l.get(e,"_bindings",{});return l.isEmpty(n)?{...e}:(l.each(n,(r,c)=>{l.isString(r)&&l.get(t,r,null)&&(e[c]=l.get(t,r,null))}),e)}function z({blocks:e}){const[t]=o.useBlocksStore(),[n]=k.useAtom(o.xShowBlocksAtom),[r]=k.useAtom(L.draggedBlockAtom),[c]=k.useAtom(L.dropTargetAtom),[,d]=o.useCanvasWidth(),[a]=Ye(),i=p.useCallback(x=>Qe(x,d),[d]),[u]=F.useChaiExternalData(),[g]=k.useAtom(o.inlineEditingActiveAtom),h=p.useCallback(x=>x.reduce((m,f)=>{const y=l.get(a,f,{});return{...m,...y}},{}),[a,t]);return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:p.Children.toArray(e.map((x,m)=>{if(g===x._id)return null;const f=Ge(x),y={};l.isEmpty(f)||Object.keys(f).forEach(M=>{y[M]=p.Children.toArray(f[M].map(N=>s.jsxRuntimeExports.jsx(z,{blocks:[l.find(t,{_id:N})]})))});const b=l.filter(t,{_parent:x._id});y.children=b.length?s.jsxRuntimeExports.jsx(z,{blocks:b}):null;const v=fe.getBlockComponent(x._type),S=l.get(v,"builderComponent",l.get(v,"component",null));if(l.isNull(S))return s.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${x==null?void 0:x._type} not registered -->`});const w=l.has(v,"getBlockStateFrom")?v==null?void 0:v.getBlockStateFrom(x,t):[],B=h(w),I=i(x);return l.get(I,"__isHidden",!1)&&!G.includes(n,x._id)?null:s.jsxRuntimeExports.jsx(p.Suspense,{children:p.createElement(S,{blockProps:{...G.includes(n,x._id)?{"force-show":""}:{},"data-block-id":x._id,"data-block-type":x._type,...r?{"data-dnd":o.canAcceptChildBlock(x._type,r==null?void 0:r._type)?"yes":"no","data-dnd-dragged":r._id===x._id?"yes":"no"}:{},...c===x._id?{"data-drop":"yes"}:{}},index:m,...Je(x,u),...l.omit(I,["__isHidden"]),...y,inBuilder:!0,blockState:B})})}))})}const et=()=>{const[e]=o.useBlocksStore(),t=l.isEmpty(e)?null:s.jsxRuntimeExports.jsx(F.BlocksExternalDataProvider,{children:s.jsxRuntimeExports.jsx(z,{blocks:l.filter(e,n=>l.isEmpty(n._parent))})});return s.jsxRuntimeExports.jsx(s.jsxRuntimeExports.Fragment,{children:t})},tt=(e,t)=>e.querySelector(`[data-style-id="${t}"]`),st=()=>{const[e]=k.useAtom(o.networkModeAtom),[t]=o.usePreviewMode(),[n]=o.useCanvasWidth(),[,r]=o.useSelectedBlockIds(),c=o.useSelectedBlock(),[,d]=o.useHighlightBlockId(),a=p.useRef(null),i=p.useRef(null),[u,g]=p.useState({width:0,height:0}),h=Ae(u),[x,m]=p.useState(0),[f,y]=p.useState([]),[,b]=p.useState([]),[,v]=k.useAtom(o.canvasIframeAtom),[S,w]=o.useSelectedStylingBlocks(),B=o.useBuilderProp("loading",!1),I=o.useBuilderProp("htmlDir","ltr");p.useEffect(()=>{const{clientWidth:j,clientHeight:_}=i.current;g({width:j,height:_}),x===0&&m(j)},[i,n,x]);const M=(j,_=0)=>{const{top:D}=j.getBoundingClientRect();return D+_>=0&&D-_<=window.innerHeight};p.useEffect(()=>{var j,_;if(c&&c.type!=="Multiple"&&a.current){const D=oe(a.current.contentDocument,c._id);D&&(M(D)||(_=(j=a.current)==null?void 0:j.contentWindow)==null||_.scrollTo({top:D.offsetTop,behavior:"smooth"}),y([D]))}},[c]),p.useEffect(()=>{if(!l.isEmpty(S)&&a.current){const j=tt(a.current.contentDocument,l.first(S).id);b(j?[j]:[null])}else b([null])},[S]);const N=p.useMemo(()=>{let j=we;return j=j.replace("__HTML_DIR__",I),e==="offline"&&(j=j.replace("https://old.chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js"),j=j.replace("https://unpkg.com/aos@next/dist/aos.css","/offline/aos.css"),j=j.replace("https://unpkg.com/aos@next/dist/aos.js","/offline/aos.js")),j},[e]);return s.jsxRuntimeExports.jsx("div",{onClick:()=>{r([]),w([])},onMouseLeave:()=>setTimeout(()=>d(""),300),className:"relative mx-auto h-full w-full overflow-hidden",style:x>0&&!l.isEmpty(h)?{width:t?"100%":x}:{},ref:i,children:s.jsxRuntimeExports.jsxs(Ie,{contentDidMount:()=>v(a.current),ref:a,id:"canvas-iframe",style:{width:`${n}px`,...h},className:"relative mx-auto box-content h-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:N,children:[s.jsxRuntimeExports.jsx(ze,{}),s.jsxRuntimeExports.jsx(We,{block:c,selectedBlockElement:l.first(f)}),s.jsxRuntimeExports.jsx(Ke,{model:"page"}),s.jsxRuntimeExports.jsx(je.Provider,{children:s.jsxRuntimeExports.jsx($e,{children:B?s.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"})}):s.jsxRuntimeExports.jsx(et,{})})}),s.jsxRuntimeExports.jsx("br",{}),s.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})},nt=p.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-NuzOGqRn.cjs"))),ot=()=>{const[e]=o.useCodeEditor();return s.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col",children:[s.jsxRuntimeExports.jsx(Ce,{}),s.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[s.jsxRuntimeExports.jsx(p.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(F.ErrorBoundary,{children:s.jsxRuntimeExports.jsx(st,{})})}),e?s.jsxRuntimeExports.jsx(p.Suspense,{fallback:s.jsxRuntimeExports.jsx(o.Skeleton,{className:"h-full"}),children:s.jsxRuntimeExports.jsx(Ee.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:s.jsxRuntimeExports.jsx(nt,{})})}):null]})]})};exports.default=ot;
|