@chaibuilder/sdk 1.2.9 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/{AddBlocks-tMxKPoen.js → AddBlocks-GiMnBMeQ.js} +28 -29
  2. package/dist/AddBlocks-SzURo9Bj.cjs +1 -0
  3. package/dist/{BrandingOptions-QJJ1y5ez.js → BrandingOptions-10jJO8mG.js} +3 -4
  4. package/dist/BrandingOptions-yK-54R-c.cjs +1 -0
  5. package/dist/CanvasArea-6O8dMPug.cjs +60 -0
  6. package/dist/{CanvasArea-mlNKmCOh.js → CanvasArea-jgBDM5Qd.js} +459 -474
  7. package/dist/CurrentPage-1y62Ne77.cjs +1 -0
  8. package/dist/{CurrentPage-lBy25sZn.js → CurrentPage-lakeZviD.js} +4 -5
  9. package/dist/{Layers-3Xs4A5i8.js → Layers-R7TfREUd.js} +115 -148
  10. package/dist/Layers-Z4nmm9xK.cjs +1 -0
  11. package/dist/{PagesPanel--BZhafnt.js → PagesPanel-4mqxCFHq.js} +4 -5
  12. package/dist/PagesPanel-ouHdxyOH.cjs +1 -0
  13. package/dist/{ProjectPanel-YcLkM-DW.js → ProjectPanel-Wy2nw-1w.js} +11 -12
  14. package/dist/ProjectPanel-hHolYZjt.cjs +1 -0
  15. package/dist/Settings-EYOw02iE.cjs +1 -0
  16. package/dist/{Settings-TAgX4hov.js → Settings-_K28Ontt.js} +532 -554
  17. package/dist/{SidePanels-btVQQkVK.js → SidePanels-6slnxdSj.js} +45 -41
  18. package/dist/SidePanels-U-_O1QN8.cjs +1 -0
  19. package/dist/{Topbar-j4t4AgCq.js → Topbar-bwt6HjlL.js} +4 -5
  20. package/dist/Topbar-dQEoY2P8.cjs +1 -0
  21. package/dist/{UnsplashImages-41Y3q5_Q.js → UnsplashImages-V29UE-57.js} +16 -17
  22. package/dist/UnsplashImages-pGgaUPQy.cjs +1 -0
  23. package/dist/UploadImages-7oLycdSh.cjs +1 -0
  24. package/dist/{UploadImages-xBg-kbKv.js → UploadImages-E0mi_qn8.js} +3 -4
  25. package/dist/{add-page-modal-cm8damU2.js → add-page-modal-FJEAqfD3.js} +9 -10
  26. package/dist/add-page-modal-In6XI-vZ.cjs +1 -0
  27. package/dist/{confirm-alert-i4pM3mOt.js → confirm-alert-5hfE116f.js} +3 -4
  28. package/dist/{confirm-alert-U7-NcG7G.cjs → confirm-alert-Vwd3OzL9.cjs} +1 -1
  29. package/dist/core.cjs +1 -1
  30. package/dist/core.d.ts +12 -8
  31. package/dist/core.js +46 -46
  32. package/dist/delete-page-modal-tl7FLK9J.cjs +1 -0
  33. package/dist/{delete-page-modal-YrIBvfFA.js → delete-page-modal-wH0yLiQI.js} +17 -18
  34. package/dist/{form-VbouZlAW.cjs → form-1j01gADS.cjs} +1 -1
  35. package/dist/{form-OVmsLOrc.js → form-UVHCD9N3.js} +18 -18
  36. package/dist/index-7ogwGh39.cjs +1 -0
  37. package/dist/index-B4sL0YTN.js +3124 -0
  38. package/dist/{index-pZhGT8uT.js → index-c2VLKuhY.js} +4886 -4884
  39. package/dist/{index-N50dZnlC.cjs → index-xbQL0wpz.cjs} +25 -25
  40. package/dist/page-viewer-SfQUe0SI.cjs +1 -0
  41. package/dist/{page-viewer-feqJr1QI.js → page-viewer-TcK0I240.js} +6 -7
  42. package/dist/{project-general-setting-SgagORzW.js → project-general-setting-4ruKl033.js} +5 -6
  43. package/dist/project-general-setting-t7E2Y_w9.cjs +1 -0
  44. package/dist/{project-seo-setting-Snn2nZgS.cjs → project-seo-setting-4b_BJZDF.cjs} +1 -1
  45. package/dist/{project-seo-setting-wxAGEkd_.js → project-seo-setting-d1EZlacB.js} +7 -8
  46. package/dist/single-page-detail-KuXd9Mur.cjs +1 -0
  47. package/dist/{single-page-detail-dnWMyg6P.js → single-page-detail-PihQi-dP.js} +6 -7
  48. package/dist/studio.cjs +1 -1
  49. package/dist/studio.js +3 -4
  50. package/dist/ui.cjs +1 -1
  51. package/dist/ui.d.ts +1 -1
  52. package/dist/ui.js +110 -111
  53. package/dist/{useAddBlockByDrop-inkD7Lck.cjs → useAddBlockByDrop-nLzs79He.cjs} +1 -1
  54. package/dist/{useAddBlockByDrop-_nwI4W3q.js → useAddBlockByDrop-rcDR-z9_.js} +1 -1
  55. package/dist/web-blocks.cjs +1 -9
  56. package/dist/web-blocks.js +397 -399
  57. package/package.json +1 -1
  58. package/dist/AddBlocks-x2LkOHSj.cjs +0 -1
  59. package/dist/BrandingOptions-EzT9UYd6.cjs +0 -1
  60. package/dist/CanvasArea-xs4wM64L.cjs +0 -60
  61. package/dist/CurrentPage-aaU4F7wi.cjs +0 -1
  62. package/dist/Layers-eaHy5PK9.cjs +0 -1
  63. package/dist/MarkAsGlobalBlock-BjP-Rqlf.js +0 -88
  64. package/dist/MarkAsGlobalBlock-X5dNmZcb.cjs +0 -1
  65. package/dist/PagesPanel-gGKCV394.cjs +0 -1
  66. package/dist/ProjectPanel-yFJRy0_E.cjs +0 -1
  67. package/dist/Settings-7wlLcvoh.cjs +0 -1
  68. package/dist/SidePanels-5H4j0mIs.cjs +0 -1
  69. package/dist/Topbar-V8xCetWF.cjs +0 -1
  70. package/dist/UnsplashImages-DbHky6cj.cjs +0 -1
  71. package/dist/UploadImages-DnQ95_NW.cjs +0 -1
  72. package/dist/add-page-modal-MwS7iXn_.cjs +0 -1
  73. package/dist/delete-page-modal-5o4jXu-z.cjs +0 -1
  74. package/dist/index-H6vIwGfD.cjs +0 -1
  75. package/dist/index-niHREMmR.js +0 -2938
  76. package/dist/page-viewer-SLt8XgYv.cjs +0 -1
  77. package/dist/project-general-setting-ym0yCdOq.cjs +0 -1
  78. package/dist/single-page-detail-IPod1o5P.cjs +0 -1
@@ -1,9 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const x=require("lodash-es"),v=require("react"),o=require("./controls-Dy1qa8Dc.cjs"),d=require("@chaibuilder/runtime"),a=require("./jsx-runtime-Z_BpKhVy.cjs"),y=require("./Functions-N3yhPYKY.cjs"),p=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function S(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const r=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(t,l,r.get?r:{enumerable:!0,get:()=>e[l]})}}return t.default=e,Object.freeze(t)}const u=S(v),R=e=>{const{blockProps:t,backgroundImage:l,children:r,styles:n}=e;let s={};return l&&(s={backgroundImage:`url(${l})`}),u.createElement("div",{...t,...n,style:s},r)};d.registerChaiBlock(R,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:o.S({default:"font-body antialiased"}),backgroundImage:o.o({title:"Background Image"})}});const g=({blockProps:e,className:t="",styles:l={}})=>a.jsxRuntimeExports.jsx("div",{...e,className:y.cn("flex h-20 flex-col items-center justify-center",t),...x.omit(l,["className"]),children:a.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300",children:a.jsxRuntimeExports.jsx("span",{className:"opacit flex items-center gap-x-1.5 text-xs font-semibold text-gray-400"})})}),L=u.memo(e=>{const{blockProps:t,backgroundImage:l,children:r,tag:n="div",styles:s}=e;if(!r&&x.isEmpty(s==null?void 0:s.className))return a.jsxRuntimeExports.jsx(g,{blockProps:t,styles:s});let i={};return l&&(i={backgroundImage:`url(${l})`}),u.createElement(n,{...t,...s,style:i},r)});d.registerChaiBlock(L,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:o.S({default:""}),tag:o.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:o.o({title:"Background Image"})},canAcceptBlock:()=>!0});const T=e=>{const{blockProps:t,styles:l,content:r,level:n="h1",children:s=null}=e;return s?u.createElement(n,{...l,...t},s):u.createElement(n,{...l,...t,dangerouslySetInnerHTML:{__html:r}})};d.registerChaiBlock(T,{type:"Heading",label:"Heading",category:"core",icon:p.HeadingIcon,group:"basic",props:{level:o.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:o.S({default:"text-3xl"}),content:o.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const w=e=>{const{blockProps:t,styles:l,content:r}=e;return x.isNull(e.children)?u.createElement("div",{...l,...t,dangerouslySetInnerHTML:{__html:r}}):u.createElement("p",{...l,...t},e.children)};d.registerChaiBlock(w,{type:"Paragraph",label:"Paragraph",category:"core",icon:p.TextIcon,group:"basic",props:{styles:o.S({default:""}),content:o.g({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:e=>e==="Span"||e==="Link"});const _=e=>{const{blockProps:t,styles:l,content:r,children:n=null,tag:s}=e;return n?u.createElement("span",{...l,...t},n):u.createElement(s||"span",{...l,...t,dangerouslySetInnerHTML:{__html:r}})};d.registerChaiBlock(_,{type:"Span",label:"Span",category:"core",group:"basic",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"Enter your content"})}});const C=e=>{const{blockProps:t,content:l,styles:r}=e;return a.jsxRuntimeExports.jsx("div",{className:"prose max-w-full",children:a.jsxRuntimeExports.jsx("div",{...t,...r,dangerouslySetInnerHTML:{__html:l}})})};d.registerChaiBlock(C,{type:"RichText",label:"Rich Text",category:"core",icon:p.CursorTextIcon,group:"basic",props:{styles:o.S({default:""}),content:o.m({title:"Content",default:`Lorem Ipsum Rich Text Editor Demo
2
-
3
- Welcome to our rich text editor demo! With our powerful editor, you can create stunning documents with ease. Let's explore some of its features:
4
-
5
- Text Formatting: You can make text bold, italic, or underline it.
6
- Lists:
7
- Create ordered lists.
8
- Craft unordered lists.
9
- Utilize nested lists for organization.`})}});const P=e=>{const{blockProps:t,iconSize:l,icon:r,content:n,iconPos:s,styles:i,children:c}=e,m=r,f=c||a.jsxRuntimeExports.jsxs(a.jsxRuntimeExports.Fragment,{children:[n,m&&a.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:s+(s==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:m}})]});return u.createElement("button",{...t,...i,type:"button"},f)};d.registerChaiBlock(P,{type:"Button",label:"Button",category:"core",icon:p.ButtonIcon,group:"basic",props:{content:o.u({title:"Label",default:"Button",multiLingual:!0}),styles:o.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:o.T({title:"Icon",default:""}),iconSize:o.c({title:"Icon Size",default:24}),iconPos:o.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const N=e=>{const{blockProps:t,link:l,children:r,styles:n,inBuilder:s,content:i}=e;return!r&&x.isEmpty(n==null?void 0:n.className)&&x.isEmpty(i)?a.jsxRuntimeExports.jsx(g,{blockProps:t}):s?r?a.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...n,children:r}):u.createElement("span",{...t,...n,href:l.href||"#",target:l.target||"_self",dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):r?a.jsxRuntimeExports.jsx("a",{href:l.href||"#/",target:l.target,...t,...n,children:r}):u.createElement("a",{...t,...n,href:l.href||"#",target:l.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(N,{type:"Link",label:"Link",category:"core",icon:p.Link1Icon,group:"basic",props:{styles:o.S({default:""}),content:o.u({title:"Content",default:""}),link:o.q({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const M=e=>{const{blockProps:t,children:l,listType:r,styles:n,tag:s}=e,i=y.cn(x.get(n,"className",""),r);return!l&&x.isEmpty(n==null?void 0:n.className)?a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"LIST ITEM"}):u.createElement(s||(r==="list-decimal"?"ol":"ul"),{...t,...n,className:i},l)};d.registerChaiBlock(M,{type:"List",label:"List",icon:p.RowsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),listType:o.f({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="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 H=e=>{const{blockProps:t,content:l,styles:r,children:n,tag:s}=e;return n?u.createElement(s||"li",{...r,...t},n):u.createElement(s||"li",{...r,...t,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(H,{type:"ListItem",label:"List Item",icon:p.ColumnsIcon,category:"core",group:"basic",props:{styles:o.S({default:""}),content:o.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0});const U=e=>{const{blockProps:t,icon:l,styles:r}=e,n={...r,className:y.cn(r.className,"inline-block c-inline-block")};return x.isEmpty(l)?a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"",className:"h-8 w-14"}):u.createElement("span",{...t,...n,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(U,{type:"Icon",label:"Icon",category:"core",icon:p.SketchLogoIcon,group:"basic",props:{styles:o.S({default:"text-black"}),icon:o.T({title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" height="1em" width="1em" 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>'})}});const D=e=>{const{blockProps:t,image:l,styles:r,alt:n,height:s=200,width:i=200}=e;return x.isEmpty(l)?a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"IMAGE URL",className:"h-36"}):u.createElement("img",{...t,...r,src:l,alt:n,height:s,width:i})};d.registerChaiBlock(D,{type:"Image",label:"Image",category:"core",icon:p.ImageIcon,group:"basic",props:{styles:o.S({default:""}),image:o.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:o.u({title:"Alt",default:""}),width:o.u({title:"Width",default:""}),height:o.u({title:"Height",default:""})}});const q=e=>{var s;const{blockProps:t,styles:l,children:r}=e;let n=null;return r||(n=a.jsxRuntimeExports.jsx("div",{className:y.cn("flex flex-col items-center justify-center",(s=e.emptyStyles)==null?void 0:s.className),children:a.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:a.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),u.createElement("div",{...l,...t,droppable:"yes"},r||n)};d.registerChaiBlock(q,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:o.S({default:""}),emptyStyles:o.S({default:""})},canAcceptBlock:()=>!0});const j=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,B=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,A=e=>{if(j.test(e)){const t=e.match(j);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(B.test(e)){const t=e.match(B);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},F=u.memo(e=>{const{blockProps:t,inBuilder:l,styles:r,url:n,controls:s}=e,i=x.get(s,"autoPlay",!1),c=x.get(s,"controls",!1),m=i||x.get(s,"muted",!0),f=x.get(s,"loop",!1);if(x.isEmpty(n))return a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"VIDEO URL",className:"h-36"});let h=A(n),b=null;if(h){if(!x.isEmpty(h)){const k=[];k.push(`autoplay=${i?1:0}`),k.push(`controls=${s?1:0}`),k.push(`mute=${m?1:0}&muted=${m?1:0}`),k.push(`loop=${f?1:0}`),h=`${h}?${k.join("&")}`}b=u.createElement("iframe",{...t,...r,src:h,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else b=u.createElement("video",{...t,...r,src:n,controls:c,muted:m,autoPlay:l?!1:i,loop:f});return a.jsxRuntimeExports.jsxs("div",{className:"relative h-full w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?a.jsxRuntimeExports.jsx("div",{...t,...r,className:"absolute z-20 h-full w-full"}):null,b]})});d.registerChaiBlock(F,{type:"Video",label:"Video",category:"core",icon:p.VideoIcon,group:"basic",props:{styles:o.S({default:"absolute top-0 left-0 w-full h-full"}),url:o.u({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:o.b({title:"Controls",properties:{autoPlay:o.r({title:"Autoplay",default:!0}),controls:o.r({title:"Show widgets",default:!1}),loop:o.r({title:"Loop",default:!1}),muted:o.r({title:"Muted",default:!0})}})}});const z=u.memo(e=>{const{blockProps:t,styles:l,content:r,inBuilder:n}=e;return a.jsxRuntimeExports.jsxs("div",{className:"relative",children:[n?a.jsxRuntimeExports.jsx("div",{...t,...l,className:"absolute h-full w-full z-20"}):null,u.createElement("div",{...l,dangerouslySetInnerHTML:{__html:r}})]})});d.registerChaiBlock(z,{type:"CustomHTML",label:"CustomHTML",category:"core",icon:p.CodeIcon,group:"basic",props:{styles:o.S({default:""}),content:o.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const O=e=>{const{blockProps:t,styles:l}=e;return u.createElement("hr",{...l,...t})};d.registerChaiBlock(O,{type:"Divider",label:"Divider",category:"core",icon:p.DividerHorizontalIcon,group:"basic",props:{styles:o.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const $=e=>{const{blockProps:t,styles:l}=e;return u.createElement("br",{...t,...l})};d.registerChaiBlock($,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:p.SpaceBetweenVerticallyIcon,props:{styles:o.S({default:""})}});const V=e=>e.inBuilder?a.jsxRuntimeExports.jsx("span",{className:"inline",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(V,{type:"Text",label:"Text",hidden:!0,category:"core",group:"basic",icon:p.SpaceBetweenVerticallyIcon,props:{content:o.g({title:"Content",defaultValue:""})}});const E=e=>{const t=(s,i)=>({_id:y.generateUUID(),_parent:s,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+i}`}),l=s=>{const i=y.generateUUID(),c={_type:"TableRow",_id:i,styles:"#styles:,border-b"};return s&&(c._parent=s),[c,t(i,"1"),t(i,"2"),t(i,"3")]},r=s=>{const i=y.generateUUID(),c={_id:i,_type:"TableHead",styles:"#styles:,font-medium"};return s&&(c._parent=s),[c,...l(i)]},n=s=>{const i=y.generateUUID(),c={_id:i,_type:"TableBody",styles:"#styles:,"};return s&&(c._parent=s),[c,...l(i),...l(i)]};if(e==="Table"){const s=y.generateUUID();return[{_id:s,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(s),...n(s)]}return e==="TableRow"?l():e==="TableHead"?r():e==="TableBody"?n():[]},W=e=>{const{blockProps:t,children:l,styles:r}=e;return l?u.createElement("table",{...t,...r},l):a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE HEAD / BODY"})};d.registerChaiBlock(W,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:p.TableIcon,props:{styles:o.S({default:""})},blocks:E("Table")});const G=e=>{const{blockProps:t,children:l,styles:r}=e;return l?u.createElement("thead",{...t,...r},l):a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE ROW"})};d.registerChaiBlock(G,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:p.BorderTopIcon,props:{styles:o.S({default:""})},blocks:E("TableHead")});const Y=e=>{const{blockProps:t,children:l,styles:r}=e;return l?u.createElement("tbody",{...t,...r},l):a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE ROW"})};d.registerChaiBlock(Y,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:p.BorderAllIcon,props:{styles:o.S({default:""})},blocks:E("TableBody")});const X=e=>{const{blockProps:t,children:l,styles:r}=e;return l?u.createElement("tr",{...t,...r},l):a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE CELL"})};d.registerChaiBlock(X,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:p.ViewHorizontalIcon,props:{styles:o.S({default:"w-full"})},blocks:E("TableRow")});const Z=e=>{const{blockProps:t,children:l,content:r,styles:n}=e;return!l&&x.isEmpty(r)?a.jsxRuntimeExports.jsx(g,{blockProps:t}):l?u.createElement("td",{...t,...n},l):u.createElement("td",{...t,...n,dangerouslySetInnerHTML:{__html:r}})};d.registerChaiBlock(Z,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:p.DragHandleHorizontalIcon,props:{styles:o.S({default:""}),content:o.m({title:"Content",default:"Table cell item"})}});const J=e=>{const{blockProps:t,errorMessage:l,name:r,_type:n,successMessage:s,action:i,styles:c,children:m}=e;if(!m&&x.isEmpty(c==null?void 0:c.className))return a.jsxRuntimeExports.jsx(g,{blockProps:t,text:"FORM FIELDS"});const f={"x-data":"useForm","x-on:submit.prevent":"post"},h={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return a.jsxRuntimeExports.jsxs("form",{...f,"data-error":l,"data-success":s,method:"post",action:i,...t,...c,children:[a.jsxRuntimeExports.jsx("div",{...h}),a.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:r||n}),m]})};d.registerChaiBlock(J,{type:"Form",label:"Form",category:"core",icon:p.GroupIcon,group:"form",hidden:!0,props:{styles:o.S({default:""}),action:o.u({title:"Submit URL",default:"/api/form/submit"}),errorMessage:o.m({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:o.m({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const K=e=>{const{blockProps:t,content:l,styles:r,children:n}=e,s={...r,...t};return n?u.createElement("label",s,n):u.createElement("label",{...s,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(K,{type:"Label",label:"Label",category:"core",icon:p.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:o.S({default:""}),content:o.u({title:"Content",default:"Label"})}});const Q=e=>{const{blockProps:t,label:l,placeholder:r,styles:n,inputStyles:s,showLabel:i,required:c,inputType:m="text",inBuilder:f,fieldName:h}=e,b=y.generateUUID();return!i||m==="submit"?(m==="submit"&&(t.value=l),a.jsxRuntimeExports.jsx("input",{id:b,name:h,readOnly:f,...t,...s,...n,type:m,placeholder:r,required:c})):a.jsxRuntimeExports.jsxs("div",{...n,...t,children:[i&&a.jsxRuntimeExports.jsx("label",{htmlFor:b,children:l}),a.jsxRuntimeExports.jsx("input",{name:h,readOnly:f,...s,id:b,type:m,placeholder:r,required:c})]})};d.registerChaiBlock(Q,{type:"Input",label:"Input",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{styles:o.S({default:""}),fieldName:o.u({title:"Field Name",default:"input"}),inputType:o.f({title:"Type",options:x.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],e=>({value:e,title:e})),default:"text"}),value:o.u({title:"Value",default:""}),showLabel:o.r({title:"Show label",default:!0}),inputStyles:o.S({default:"w-full p-1"}),label:o.u({title:"Label",default:"Label"}),placeholder:o.u({title:"Placeholder",default:"Placeholder"}),required:o.r({title:"Required",default:!1})}});const ee=e=>{const{blockProps:t,fieldName:l,label:r,placeholder:n,styles:s,inputStyles:i,_rows:c,showLabel:m}=e,f=y.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...s,...t,children:[m&&a.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r}),a.jsxRuntimeExports.jsx("textarea",{name:l,...i,id:f,placeholder:n,rows:c})]}):a.jsxRuntimeExports.jsx("textarea",{id:f,name:l,...t,...i,...s,placeholder:n,rows:c})};d.registerChaiBlock(ee,{type:"TextArea",label:"TextArea",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{fieldName:o.u({title:"Field Name",default:"textarea"}),showLabel:o.r({title:"Show label",default:!0}),styles:o.S({default:""}),inputStyles:o.S({default:"w-full p-1"}),label:o.u({title:"Label",default:"Label"}),placeholder:o.u({title:"Placeholder",default:"Placeholder"}),_rows:o.c({title:"Rows",default:3})}});const te=e=>{const{blockProps:t,fieldName:l,label:r,placeholder:n,styles:s,inputStyles:i,required:c,showLabel:m,_multiple:f=!1}=e,h=y.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...s,children:[m&&a.jsxRuntimeExports.jsx("label",{htmlFor:h,children:r}),a.jsxRuntimeExports.jsxs("select",{...i,id:h,placeholder:n,required:c,multiple:f,name:l,children:[a.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:n}),x.map(e.options,b=>a.jsxRuntimeExports.jsx("option",{selected:x.get(b,"selected",!1),value:b.value,dangerouslySetInnerHTML:{__html:b.label}},b.value))]})]}):a.jsxRuntimeExports.jsxs("select",{id:h,...s,...t,placeholder:n,required:c,multiple:f,name:l,children:[a.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:n}),x.map(e.options,b=>a.jsxRuntimeExports.jsx("option",{selected:x.get(b,"selected",!1),value:b.value,dangerouslySetInnerHTML:{__html:b.label}},b.value))]})};d.registerChaiBlock(te,{type:"Select",label:"Select",category:"core",icon:p.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:o.S({default:""}),fieldName:o.u({title:"Field Name",default:"select"}),showLabel:o.r({title:"Show label",default:!0}),inputStyles:o.S({default:"w-full p-1"}),label:o.u({title:"Label",default:"Label"}),placeholder:o.u({title:"Placeholder",default:"Placeholder"}),required:o.r({title:"Required",default:!1}),_multiple:o.r({title:"Multiple Choice",default:!1}),options:o.h({title:"Options",itemProperties:{label:o.u({title:"Label",default:""}),value:o.u({title:"Value",default:""})}})}});const le=e=>{const{blockProps:t,fieldName:l,label:r,styles:n,inputStyles:s,required:i,checked:c,showLabel:m=!0}=e,f=y.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...n,...t,children:[a.jsxRuntimeExports.jsx("input",{...s,name:l,id:f,type:"checkbox",required:i,defaultChecked:c}),r&&r!=="Label"&&a.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r})]}):a.jsxRuntimeExports.jsx("input",{id:f,...t,...s,...n,type:"checkbox",required:i,name:l})};d.registerChaiBlock(le,{type:"Checkbox",label:"Checkbox",category:"core",icon:p.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:o.u({title:"Field Name",default:"checkbox"}),styles:o.S({default:"flex items-center gap-x-2"}),label:o.u({title:"Label",default:"Label"}),checked:o.r({title:"Checked",default:!1}),required:o.r({title:"Required",default:!1})}});const oe=e=>{const{blockProps:t,fieldName:l,label:r,styles:n,inputStyles:s,checked:i,required:c,showLabel:m=!0}=e,f=y.generateUUID();return m?a.jsxRuntimeExports.jsxs("div",{...n,...t,children:[a.jsxRuntimeExports.jsx("input",{...s,name:l,id:f,type:"radio",required:c,defaultChecked:i}),r&&a.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r})]}):a.jsxRuntimeExports.jsx("input",{id:f,...t,...s,...n,type:"radio",required:c,checked:i,name:l})};d.registerChaiBlock(oe,{type:"Radio",label:"Radio",category:"core",icon:p.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:o.S({default:"flex items-center w-max gap-x-2"}),fieldName:o.u({title:"Field Name",default:"radio"}),label:o.u({title:"Label",default:"Label"}),checked:o.r({title:"Checked",default:!1}),required:o.r({title:"Required",default:!1})}});const re=e=>{const{blockProps:t,inBuilder:l,label:r,placeholder:n,styles:s,inputStyles:i,icon:c,iconPos:m}=e,f=y.generateUUID(),h={"x-bind:disabled":"formLoading"};return a.jsxRuntimeExports.jsxs("button",{id:f,...h,...i,...s,...t||{},type:l?"button":"submit",placeholder:n,children:[r,c&&a.jsxRuntimeExports.jsx("span",{className:m,dangerouslySetInnerHTML:{__html:c}})]})};d.registerChaiBlock(re,{type:"FormButton",label:"Submit Button",category:"core",icon:p.ButtonIcon,group:"form",hidden:!0,props:{label:o.u({title:"Label",default:"Submit"}),styles:o.S({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:o.T({title:"Icon",default:""}),iconPos:o.f({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}});const se=x.noop;exports.loadWebBlocks=se;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const h=require("lodash-es"),n=require("./jsx-runtime-Z_BpKhVy.cjs"),v=require("react"),l=require("./controls-Dy1qa8Dc.cjs"),d=require("@chaibuilder/runtime"),y=require("./Functions-N3yhPYKY.cjs"),p=require("@radix-ui/react-icons");require("./_commonjsHelpers-wDK0ZLPo.cjs");require("clsx");require("tailwind-merge");function S(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const s in e)if(s!=="default"){const o=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(t,s,o.get?o:{enumerable:!0,get:()=>e[s]})}}return t.default=e,Object.freeze(t)}const u=S(v),g=({blockProps:e,className:t="",styles:s={}})=>n.jsxRuntimeExports.jsx("div",{...e,className:y.cn("flex h-20 flex-col items-center justify-center",t),...h.omit(s,["className"]),children:n.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300",children:n.jsxRuntimeExports.jsx("span",{className:"opacit flex items-center gap-x-1.5 text-xs font-semibold text-gray-400"})})}),R=u.memo(e=>{const{blockProps:t,backgroundImage:s,children:o,tag:a="div",styles:r}=e;if(!o&&h.isEmpty(r==null?void 0:r.className))return n.jsxRuntimeExports.jsx(g,{blockProps:t,styles:r});let i={};return s&&(i={backgroundImage:`url(${s})`}),u.createElement(a,{...t,...r,style:i},o)});d.registerChaiBlock(R,{type:"Box",label:"Box",category:"core",group:"basic",props:{styles:l.S({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.o({title:"Background Image"})},canAcceptBlock:()=>!0});const L=e=>{const{blockProps:t,styles:s,content:o,level:a="h1",children:r=null}=e;return r?u.createElement(a,{...s,...t},r):u.createElement(a,{...s,...t,dangerouslySetInnerHTML:{__html:o}})};d.registerChaiBlock(L,{type:"Heading",label:"Heading",category:"core",icon:p.HeadingIcon,group:"basic",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.S({default:"text-3xl"}),content:l.g({title:"Content",default:"Heading goes here"})},canAcceptBlock:e=>e==="Span"||e==="Text"});const T=e=>{const{blockProps:t,styles:s,content:o}=e;return h.isNull(e.children)?u.createElement("div",{...s,...t,dangerouslySetInnerHTML:{__html:o}}):u.createElement("p",{...s,...t},e.children)};d.registerChaiBlock(T,{type:"Paragraph",label:"Paragraph",category:"core",icon:p.TextIcon,group:"basic",props:{styles:l.S({default:""}),content:l.g({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:e=>e==="Span"||e==="Link"});const w=e=>{const{blockProps:t,styles:s,content:o,children:a=null,tag:r}=e;return a?u.createElement("span",{...s,...t},a):u.createElement(r||"span",{...s,...t,dangerouslySetInnerHTML:{__html:o}})};d.registerChaiBlock(w,{type:"Span",label:"Span",category:"core",group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"Enter your content"})}});const _=e=>{const{blockProps:t,content:s,styles:o}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{...t,...o,dangerouslySetInnerHTML:{__html:s}})})};d.registerChaiBlock(_,{type:"RichText",label:"Rich Text",category:"core",icon:p.CursorTextIcon,group:"basic",props:{styles:l.S({default:""}),content:l.m({title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}});const C=e=>{const{blockProps:t,iconSize:s,icon:o,content:a,iconPos:r,styles:i,children:c}=e,m=o,f=c||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{children:a}),m&&n.jsxRuntimeExports.jsx("div",{style:{width:s+"px"},className:r+" "+(r==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:m}})]});return u.createElement("button",{...t,...i,type:"button"},f)};d.registerChaiBlock(C,{type:"Button",label:"Button",category:"core",icon:p.ButtonIcon,group:"basic",props:{content:l.u({title:"Label",default:"Button",multiLingual:!0}),styles:l.S({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:l.T({title:"Icon",default:""}),iconSize:l.c({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=e=>{const{blockProps:t,link:s,children:o,styles:a,inBuilder:r,content:i}=e;return!o&&h.isEmpty(a==null?void 0:a.className)&&h.isEmpty(i)?n.jsxRuntimeExports.jsx(g,{blockProps:t}):r?o?n.jsxRuntimeExports.jsx("span",{"data-simulate":"a",...t,...a,children:o}):u.createElement("span",{...t,...a,href:s.href||"#",target:s.target||"_self",dangerouslySetInnerHTML:{__html:i},"data-simulate":"a"}):o?n.jsxRuntimeExports.jsx("a",{href:s.href||"#/",target:s.target,...t,...a,children:o}):u.createElement("a",{...t,...a,href:s.href||"#",target:s.target||"_self",dangerouslySetInnerHTML:{__html:i}})};d.registerChaiBlock(P,{type:"Link",label:"Link",category:"core",icon:p.Link1Icon,group:"basic",props:{styles:l.S({default:""}),content:l.u({title:"Content",default:""}),link:l.q({title:"Link",default:{type:"page",target:"_self",href:""}})},canAcceptBlock:()=>!0});const N=e=>{const{blockProps:t,children:s,listType:o,styles:a,tag:r}=e,i=y.cn(h.get(a,"className",""),o);return!s&&h.isEmpty(a==null?void 0:a.className)?n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"LIST ITEM"}):u.createElement(r||(o==="list-decimal"?"ol":"ul"),{...t,...a,className:i},s)};d.registerChaiBlock(N,{type:"List",label:"List",icon:p.RowsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),listType:l.f({title:"List type",default:"list-disc",options:[{value:"list-none",title:"None"},{value:"list-disc",title:"Disc"},{value:"list-decimal",title:"Number"}]})},canAcceptBlock:e=>e==="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 M=e=>{const{blockProps:t,content:s,styles:o,children:a,tag:r}=e;return a?u.createElement(r||"li",{...o,...t},a):u.createElement(r||"li",{...o,...t,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(M,{type:"ListItem",label:"List Item",icon:p.ColumnsIcon,category:"core",group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"Content",default:"List item"})},canAcceptBlock:()=>!0});const H=e=>{const{blockProps:t,icon:s,styles:o,width:a,height:r}=e,i={...o,className:y.cn(o.className,"inline-block c-inline-block",`w-[${a}px]`,`h-[${r}px]`)};return h.isEmpty(s)?n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"",className:"h-8 w-14"}):u.createElement("span",{...t,...i,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(H,{type:"Icon",label:"Icon",category:"core",icon:p.SketchLogoIcon,group:"basic",props:{styles:l.S({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.c({title:"Width",default:40}),height:l.c({title:"Height",default:40})}});const U=e=>{const{blockProps:t,image:s,styles:o,alt:a,height:r,width:i}=e;return h.isEmpty(s)?n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"IMAGE URL",className:"h-36"}):u.createElement("img",{...t,...o,src:s,alt:a,height:r,width:i})};d.registerChaiBlock(U,{type:"Image",label:"Image",category:"core",icon:p.ImageIcon,group:"basic",props:{styles:l.S({default:""}),image:l.o({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:l.u({title:"Alt",default:""}),width:l.u({title:"Width",default:""}),height:l.u({title:"Height",default:""})}});const D=e=>{var r;const{blockProps:t,styles:s,children:o}=e;let a=null;return o||(a=n.jsxRuntimeExports.jsx("div",{className:y.cn("flex flex-col items-center justify-center",(r=e.emptyStyles)==null?void 0:r.className),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md border-4 border-dashed",children:n.jsxRuntimeExports.jsxs("p",{className:"truncate p-1 text-left text-xs text-gray-400",children:["Slot: ",e.name]})})})),u.createElement("div",{...s,...t,droppable:"yes"},o||a)};d.registerChaiBlock(D,{type:"Slot",label:"Slot",group:"basic",category:"core",hidden:!0,props:{styles:l.S({default:""}),emptyStyles:l.S({default:""})},canAcceptBlock:()=>!0});const E=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,B=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,I=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,q=e=>{if(E.test(e)){const t=e.match(E);return t?`https://www.youtube.com/embed/${t[4]}`:e}if(B.test(e)){const t=e.match(B);return t?`https://player.vimeo.com/video/${t[3]}`:e}if(I.test(e)){const t=e.match(I);return t?`https://www.dailymotion.com/embed/video/${t[4]}`:e}return null},A=u.memo(e=>{const{blockProps:t,inBuilder:s,styles:o,url:a,controls:r}=e,i=h.get(r,"autoPlay",!1),c=h.get(r,"controls",!1),m=i||h.get(r,"muted",!0),f=h.get(r,"loop",!1);if(h.isEmpty(a))return n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"VIDEO URL",className:"h-36"});let b=q(a),x=null;if(b){if(!h.isEmpty(b)){const k=[];k.push(`autoplay=${i?1:0}`),k.push(`controls=${r?1:0}`),k.push(`mute=${m?1:0}&muted=${m?1:0}`),k.push(`loop=${f?1:0}`),b=`${b}?${k.join("&")}`}x=u.createElement("iframe",{...t,className:"absolute inset-0 w-full h-full",src:b,allow:s?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else x=u.createElement("video",{...t,className:"absolute inset-0 w-full h-full",src:a,controls:c,muted:m,autoPlay:s?!1:i,loop:f});return n.jsxRuntimeExports.jsx("div",{...h.pick(o,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[s?n.jsxRuntimeExports.jsx("div",{...t,...h.omit(o,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,x]})})});d.registerChaiBlock(A,{type:"Video",label:"Video",category:"core",icon:p.VideoIcon,group:"basic",props:{styles:l.S({default:""}),url:l.u({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"}),controls:l.b({title:"Controls",properties:{autoPlay:l.r({title:"Autoplay",default:!0}),controls:l.r({title:"Show controls",default:!1}),loop:l.r({title:"Loop",default:!1}),muted:l.r({title:"Muted",default:!0})}})}});const F=u.memo(e=>{const{blockProps:t,styles:s,content:o,inBuilder:a}=e;return n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[a?n.jsxRuntimeExports.jsx("div",{...t,...s,className:"absolute h-full w-full z-20"}):null,u.createElement("div",{...s,dangerouslySetInnerHTML:{__html:o}})]})});d.registerChaiBlock(F,{type:"CustomHTML",label:"CustomHTML",category:"core",icon:p.CodeIcon,group:"basic",props:{styles:l.S({default:""}),content:l.g({title:"HTML Content",default:"<div><p>HTML Snippet goes here...</p></div>",placeholder:"Enter custom HTML code here"})}});const O=e=>{const{blockProps:t,styles:s}=e;return u.createElement("hr",{...s,...t})};d.registerChaiBlock(O,{type:"Divider",label:"Divider",category:"core",icon:p.DividerHorizontalIcon,group:"basic",props:{styles:l.S({default:"bg-gray-900 h-0.5 py-2 my-1"})}});const z=e=>e.inBuilder?n.jsxRuntimeExports.jsx("span",{className:"inline",...e.blockProps,children:e.content}):`${e.content}`;d.registerChaiBlock(z,{type:"Text",label:"Text",hidden:!0,category:"core",group:"basic",icon:p.SpaceBetweenVerticallyIcon,props:{content:l.g({title:"Content",defaultValue:""})}});const $=e=>{const{blockProps:t,backgroundImage:s,children:o,styles:a}=e;let r={};return s&&(r={backgroundImage:`url(${s})`}),u.createElement("div",{...t,...a,style:r},o)};d.registerChaiBlock($,{type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:l.S({default:"font-body antialiased"}),backgroundImage:l.o({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1});const V=e=>{const{blockProps:t,styles:s}=e;return u.createElement("br",{...t,...s})};d.registerChaiBlock(V,{type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:p.SpaceBetweenVerticallyIcon,props:{styles:l.S({default:""})}});const j=e=>{const t=(r,i)=>({_id:y.generateUUID(),_parent:r,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+i}`}),s=r=>{const i=y.generateUUID(),c={_type:"TableRow",_id:i,styles:"#styles:,border-b"};return r&&(c._parent=r),[c,t(i,"1"),t(i,"2"),t(i,"3")]},o=r=>{const i=y.generateUUID(),c={_id:i,_type:"TableHead",styles:"#styles:,font-medium"};return r&&(c._parent=r),[c,...s(i)]},a=r=>{const i=y.generateUUID(),c={_id:i,_type:"TableBody",styles:"#styles:,"};return r&&(c._parent=r),[c,...s(i),...s(i)]};if(e==="Table"){const r=y.generateUUID();return[{_id:r,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...o(r),...a(r)]}return e==="TableRow"?s():e==="TableHead"?o():e==="TableBody"?a():[]},W=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("table",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE HEAD / BODY"})};d.registerChaiBlock(W,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:p.TableIcon,props:{styles:l.S({default:""})},blocks:j("Table")});const G=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("thead",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE ROW"})};d.registerChaiBlock(G,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:p.BorderTopIcon,props:{styles:l.S({default:""})},blocks:j("TableHead")});const Y=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("tbody",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE ROW"})};d.registerChaiBlock(Y,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:p.BorderAllIcon,props:{styles:l.S({default:""})},blocks:j("TableBody")});const X=e=>{const{blockProps:t,children:s,styles:o}=e;return s?u.createElement("tr",{...t,...o},s):n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"TABLE CELL"})};d.registerChaiBlock(X,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:p.ViewHorizontalIcon,props:{styles:l.S({default:"w-full"})},blocks:j("TableRow")});const Z=e=>{const{blockProps:t,children:s,content:o,styles:a}=e;return!s&&h.isEmpty(o)?n.jsxRuntimeExports.jsx(g,{blockProps:t}):s?u.createElement("td",{...t,...a},s):u.createElement("td",{...t,...a,dangerouslySetInnerHTML:{__html:o}})};d.registerChaiBlock(Z,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:p.DragHandleHorizontalIcon,props:{styles:l.S({default:""}),content:l.m({title:"Content",default:"Table cell item"})}});const J=e=>{const{blockProps:t,errorMessage:s,name:o,_type:a,successMessage:r,action:i,styles:c,children:m}=e;if(!m&&h.isEmpty(c==null?void 0:c.className))return n.jsxRuntimeExports.jsx(g,{blockProps:t,text:"FORM FIELDS"});const f={"x-data":"useForm","x-on:submit.prevent":"post"},b={"x-html":"formResponse",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...f,"data-error":s,"data-success":r,method:"post",action:i,...t,...c,children:[n.jsxRuntimeExports.jsx("div",{...b}),n.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:o||a}),m]})};d.registerChaiBlock(J,{type:"Form",label:"Form",category:"core",icon:p.GroupIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),action:l.u({title:"Submit URL",default:"/api/form/submit"}),errorMessage:l.m({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:l.m({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0});const K=e=>{const{blockProps:t,content:s,styles:o,children:a}=e,r={...o,...t};return a?u.createElement("label",r,a):u.createElement("label",{...r,dangerouslySetInnerHTML:{__html:s}})};d.registerChaiBlock(K,{type:"Label",label:"Label",category:"core",icon:p.LetterCaseToggleIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),content:l.u({title:"Content",default:"Label"})}});const Q=e=>{const{blockProps:t,inBuilder:s,label:o,placeholder:a,styles:r,inputStyles:i,icon:c,iconPos:m}=e,f=y.generateUUID(),b={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:f,...b,...i,...r,...t||{},type:s?"button":"submit",placeholder:a,children:[o,c&&n.jsxRuntimeExports.jsx("span",{className:m,dangerouslySetInnerHTML:{__html:c}})]})};d.registerChaiBlock(Q,{type:"FormButton",label:"Submit Button",category:"core",icon:p.ButtonIcon,group:"form",hidden:!0,props:{label:l.u({title:"Label",default:"Submit"}),styles:l.S({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 ee=e=>{const{blockProps:t,fieldName:s,label:o,styles:a,inputStyles:r,required:i,checked:c,showLabel:m=!0}=e,f=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...a,...t,children:[n.jsxRuntimeExports.jsx("input",{...r,name:s,id:f,type:"checkbox",required:i,defaultChecked:c}),o&&o!=="Label"&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:o})]}):n.jsxRuntimeExports.jsx("input",{id:f,...t,...r,...a,type:"checkbox",required:i,name:s})};d.registerChaiBlock(ee,{type:"Checkbox",label:"Checkbox",category:"core",icon:p.CheckboxIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"checkbox"}),styles:l.S({default:"flex items-center gap-x-2"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const te=e=>{const{blockProps:t,label:s,placeholder:o,styles:a,inputStyles:r,showLabel:i,required:c,inputType:m="text",inBuilder:f,fieldName:b}=e,x=y.generateUUID();return!i||m==="submit"?(m==="submit"&&(t.value=s),n.jsxRuntimeExports.jsx("input",{id:x,name:b,readOnly:f,...t,...r,...a,type:m,placeholder:o,required:c})):n.jsxRuntimeExports.jsxs("div",{...a,...t,children:[i&&n.jsxRuntimeExports.jsx("label",{htmlFor:x,children:s}),n.jsxRuntimeExports.jsx("input",{name:b,readOnly:f,...r,id:x,type:m,placeholder:o,required:c})]})};d.registerChaiBlock(te,{type:"Input",label:"Input",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"input"}),inputType:l.f({title:"Type",options:h.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],e=>({value:e,title:e})),default:"text"}),value:l.u({title:"Value",default:""}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1})}});const le=e=>{const{blockProps:t,fieldName:s,label:o,styles:a,inputStyles:r,checked:i,required:c,showLabel:m=!0}=e,f=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...a,...t,children:[n.jsxRuntimeExports.jsx("input",{...r,name:s,id:f,type:"radio",required:c,defaultChecked:i}),o&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:o})]}):n.jsxRuntimeExports.jsx("input",{id:f,...t,...r,...a,type:"radio",required:c,checked:i,name:s})};d.registerChaiBlock(le,{type:"Radio",label:"Radio",category:"core",icon:p.RadiobuttonIcon,group:"form",hidden:!0,props:{styles:l.S({default:"flex items-center w-max gap-x-2"}),fieldName:l.u({title:"Field Name",default:"radio"}),label:l.u({title:"Label",default:"Label"}),checked:l.r({title:"Checked",default:!1}),required:l.r({title:"Required",default:!1})}});const se=e=>{const{blockProps:t,fieldName:s,label:o,placeholder:a,styles:r,inputStyles:i,required:c,showLabel:m,_multiple:f=!1}=e,b=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...r,children:[m&&n.jsxRuntimeExports.jsx("label",{htmlFor:b,children:o}),n.jsxRuntimeExports.jsxs("select",{...i,id:b,placeholder:a,required:c,multiple:f,name:s,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),h.map(e.options,x=>n.jsxRuntimeExports.jsx("option",{selected:h.get(x,"selected",!1),value:x.value,dangerouslySetInnerHTML:{__html:x.label}},x.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:b,...r,...t,placeholder:a,required:c,multiple:f,name:s,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:a}),h.map(e.options,x=>n.jsxRuntimeExports.jsx("option",{selected:h.get(x,"selected",!1),value:x.value,dangerouslySetInnerHTML:{__html:x.label}},x.value))]})};d.registerChaiBlock(se,{type:"Select",label:"Select",category:"core",icon:p.DropdownMenuIcon,group:"form",hidden:!0,props:{styles:l.S({default:""}),fieldName:l.u({title:"Field Name",default:"select"}),showLabel:l.r({title:"Show label",default:!0}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),required:l.r({title:"Required",default:!1}),_multiple:l.r({title:"Multiple Choice",default:!1}),options:l.h({title:"Options",itemProperties:{label:l.u({title:"Label",default:""}),value:l.u({title:"Value",default:""})}})}});const oe=e=>{const{blockProps:t,fieldName:s,label:o,placeholder:a,styles:r,inputStyles:i,_rows:c,showLabel:m}=e,f=y.generateUUID();return m?n.jsxRuntimeExports.jsxs("div",{...r,...t,children:[m&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:o}),n.jsxRuntimeExports.jsx("textarea",{name:s,...i,id:f,placeholder:a,rows:c})]}):n.jsxRuntimeExports.jsx("textarea",{id:f,name:s,...t,...i,...r,placeholder:a,rows:c})};d.registerChaiBlock(oe,{type:"TextArea",label:"TextArea",category:"core",icon:p.InputIcon,group:"form",hidden:!0,props:{fieldName:l.u({title:"Field Name",default:"textarea"}),showLabel:l.r({title:"Show label",default:!0}),styles:l.S({default:""}),inputStyles:l.S({default:"w-full p-1"}),label:l.u({title:"Label",default:"Label"}),placeholder:l.u({title:"Placeholder",default:"Placeholder"}),_rows:l.c({title:"Rows",default:3})}});const re=h.noop;exports.loadWebBlocks=re;