@chaibuilder/sdk 2.2.8 → 2.2.9

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.
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),f=require("./common-functions-BZmyleS1.cjs"),k=require("react"),g=require("@radix-ui/react-icons"),u=require("lodash-es"),x=require("lucide-react");function v(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const h=v(k),C=({className:e="",inBuilder:l})=>l?i.jsx("div",{className:f.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,L=e=>{const{blockProps:l,inBuilder:t,backgroundImage:r,children:s,tag:n="div",styles:a}=e;let c=s;s||(c=i.jsx(C,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),h.createElement(n,{...l,...a,style:p},c)},j={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},_=e=>{const{blockProps:l,iconSize:t,icon:r,content:s,styles:n,children:a,iconPos:c,link:p,inBuilder:d}=e,b=r,m=a||i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),b&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:b}})]}),y=k.createElement("button",{...l,...n,type:"button","aria-label":s},m);return u.isEmpty(u.get(p,"href"))?y:d?i.jsx("span",{children:y}):i.jsx("a",{"aria-label":s,href:u.get(p,"href")||"/",target:u.get(p,"target","_self"),children:y})},T={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:g.ButtonIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),i18nProps:["content"],aiProps:["content"]},E=e=>{const{blockProps:l,iconSize:t,icon:r,content:s,styles:n}=e,a=r,c=i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),a&&i.jsx("div",{style:{width:t+"px"},dangerouslySetInnerHTML:{__html:a}})]});return k.createElement("button",{...l,...n,type:"button","aria-label":s},c)},N={type:"CopyButton",description:"A copy button component",label:"Copy Button",category:"core",icon:g.CopyIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("p-2 rounded-md flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-copy'><path d='M8 17L19 8M8 17V7a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v10'/></svg>",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:20}}}),i18nProps:["content"],aiProps:["content"]},R=e=>{const{blockProps:l,styles:t,htmlCode:r,inBuilder:s}=e;return s?i.jsxs("div",{className:"relative",children:[s?i.jsx("div",{...l,...t,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):h.createElement("div",{...l,...t,dangerouslySetInnerHTML:{__html:r}})},M={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:g.CodeIcon,group:"advanced",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},$=e=>{const{scripts:l,inBuilder:t,blockProps:r}=e;return t?i.jsx("div",{...r,children:i.jsx("div",{className:f.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:l}})},A={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:x.FileCode,group:"advanced",...o.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},H=e=>{const{blockProps:l,styles:t}=e;return k.createElement("hr",{...t,...l})},U={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:g.DividerHorizontalIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},D=e=>{const{blockProps:l,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),h.createElement("div",{...l,...t,style:s})},q={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},z=e=>{const{blockProps:l,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=f.generateUUID();return p?i.jsxs("div",{...s,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"checkbox",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:d,children:r})]}):i.jsx("input",{id:d,...l,...n,...s,type:"checkbox",required:a,name:t})},V={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:g.CheckboxIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},F=e=>{const{children:l,blockProps:t,errorMessage:r,successMessage:s,action:n,styles:a,inBuilder:c}=e;let p=l;l||(p=i.jsx(C,{inBuilder:c}));const d={"x-data":"{}","x-on:submit.prevent":"post"},b={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...d,"data-error":r,"data-success":s,method:"post",action:n,...t,...a,children:[i.jsx("div",{...b}),p]})},O={type:"Form",label:"Form",category:"core",icon:x.GroupIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},G=e=>{const{blockProps:l,inBuilder:t,label:r,styles:s,inputStyles:n,icon:a,iconSize:c,iconPos:p}=e,d=f.generateUUID(),b={"x-bind:disabled":"formLoading"};return i.jsxs("button",{id:d,...b,...n,...s,...l||{},type:t?"button":"submit","aria-label":r,children:[r,a&&i.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},Y={type:"FormButton",label:"Submit Button",category:"core",icon:g.ButtonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:o.StylesProp(""),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},W=e=>{const{blockProps:l,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,showLabel:c,required:p,inputType:d,autocomplete:b}=e,m=f.generateUUID();return c?i.jsxs("div",{...n,...l,children:[c&&i.jsx("label",{htmlFor:m,children:r}),i.jsx("input",{name:t,...a,id:m,type:d,placeholder:s,required:p,autoComplete:b?"on":"off"})]}):i.jsx("input",{id:m,name:t,...l,...a,...n,type:d,placeholder:s,required:p,autoComplete:b?"on":"off"})},X={type:"Input",label:"web_blocks.input",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","hidden","range","color","date","time"]},required:{type:"boolean",title:"Required",default:!1},autocomplete:{type:"boolean",title:"Autocomplete",default:!0}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},J=e=>{const{blockProps:l,content:t,styles:r,children:s}=e,n={...r,...l};return s?h.createElement("label",n,s):h.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},Q={type:"Label",label:"Label",category:"core",icon:g.LetterCaseToggleIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},Z=e=>{const{blockProps:l,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=f.generateUUID();return p?i.jsxs("div",{...s,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"radio",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:d,children:r})]}):i.jsx("input",{id:d,...l,...n,...s,type:"radio",required:a,checked:c,name:t})},K={type:"Radio",label:"web_blocks.radio",category:"core",icon:g.RadiobuttonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},ee=e=>{const{blockProps:l,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:d,options:b}=e,m=f.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:m,children:r}),i.jsxs("select",{...a,id:m,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:s}),u.map(b,y=>i.jsx("option",{value:y==null?void 0:y.value,children:y==null?void 0:y.label},y==null?void 0:y.value))]})]}):i.jsxs("select",{id:m,...n,...l,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:s}),u.map(b,y=>i.jsx("option",{value:y==null?void 0:y.value,children:y==null?void 0:y.label},y==null?void 0:y.value))]})},te={type:"Select",label:"web_blocks.select",category:"core",icon:g.DropdownMenuIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},oe=e=>{const{blockProps:l,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,rows:c,showLabel:p,required:d}=e,b=f.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:b,children:r}),i.jsx("textarea",{name:t,...a,id:b,placeholder:s,rows:c,required:d})]}):i.jsx("textarea",{id:b,name:t,...l,...a,...n,placeholder:s,rows:c,required:d})},le={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},re=e=>{const{blockProps:l,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...l,children:[i.jsxs("h1",{children:["Global Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):h.createElement("span",{...l},r)},se={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:x.GlobeIcon,category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},ie=e=>{const{blockProps:l,styles:t,content:r,tag:s="h1",children:n=null}=e;return n?h.createElement(s,{...t,...l},n):h.createElement(s,{...t,...l,dangerouslySetInnerHTML:{__html:r}})},ne={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:g.HeadingIcon,group:"typography",...o.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:o.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},ae=e=>{const{blockProps:l,styles:t}=e;return k.createElement("br",{...l,...t})},ce={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},pe=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("table",{...l,...r},t):i.jsx(C,{})},ue=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("thead",{...l,...r},t):i.jsx(C,{})},de=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("tbody",{...l,...r},t):i.jsx(C,{})},ge=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("tr",{...l,...r},t):i.jsx(C,{})},ye=e=>{const{blockProps:l,children:t,content:r,styles:s}=e;return!t&&u.isEmpty(r)?i.jsx(C,{}):t?k.createElement("td",{...l,...s},t):k.createElement("td",{...l,...s,dangerouslySetInnerHTML:{__html:r}})};o.registerChaiBlock(pe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:g.TableIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("Table")});o.registerChaiBlock(ue,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:g.BorderTopIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("TableHead")});o.registerChaiBlock(de,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:g.BorderAllIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("TableBody")});o.registerChaiBlock(ge,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:g.ViewHorizontalIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("TableRow")});o.registerChaiBlock(ye,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:g.DragHandleHorizontalIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:B("TableCell"),i18nProps:["content"],aiProps:["content"]});function B(e){const l=(n,a)=>({_id:f.generateUUID(),_parent:n,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+a}`}),t=n=>{const a=f.generateUUID(),c={_type:"TableRow",_id:a,styles:"#styles:,border-b"};return n&&(c._parent=n),[c,l(a,"1"),l(a,"2"),l(a,"3")]},r=n=>{const a=f.generateUUID(),c={_id:a,_type:"TableHead",styles:"#styles:,font-medium"};return n&&(c._parent=n),[c,...t(a)]},s=n=>{const a=f.generateUUID(),c={_id:a,_type:"TableBody",styles:"#styles:,"};return n&&(c._parent=n),[c,...t(a),...t(a)]};if(e==="Table"){const n=f.generateUUID();return[{_id:n,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(n),...s(n)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const I=(e,...l)=>({...e,className:f.cn(e.className,...l)}),me=e=>{const{blockProps:l,icon:t,styles:r,width:s,inBuilder:n,height:a}=e,c=I(r,"");if(u.isEmpty(t))return i.jsx(C,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...l,...c,style:{width:s?`${s}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},he={type:"Icon",label:"web_blocks.icon",category:"core",icon:g.SketchLogoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),icon:{type:"string",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>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},be=e=>{const{blockProps:l,image:t,mobileImage:r,styles:s,alt:n,height:a,width:c,lazyLoading:p}=e;return u.isEmpty(t)?i.jsx(C,{className:"h-36"}):i.jsxs("picture",{children:[r&&i.jsx("source",{srcSet:r,media:"(max-width: 480px)"}),i.jsx("img",{...l,...s,src:t,alt:n,loading:p?"lazy":"eager",width:c,height:a})]})},fe={type:"Image",description:"A image component",label:"Image",category:"core",icon:g.ImageIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}}}}),aiProps:["alt"],i18nProps:["alt"]},ke=e=>{const{blockProps:l,link:t,children:r,styles:s,inBuilder:n,content:a}=e;let c={};return!r&&u.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?r?i.jsx("span",{...l,style:c,...s,children:r}):k.createElement("span",{...l,...s,style:c},a):r?i.jsx("a",{"aria-label":a,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...l,...s,children:r}):k.createElement("a",{...l,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":a},a)},Ce={type:"Link",description:"A link component",label:"Link",category:"core",icon:g.Link1Icon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},xe=e=>{const{blockProps:l,children:t,listType:r,styles:s,tag:n,inBuilder:a}=e,c=f.cn(u.get(s,"className",""),r);return!t&&u.isEmpty(s==null?void 0:s.className)?i.jsx(C,{inBuilder:a}):h.createElement(n||(r==="list-decimal"?"ol":"ul"),{...l,...s,className:c},t)},Be={type:"List",description:"A list component",label:"List",icon:g.RowsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),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"}]},Se=e=>{const{blockProps:l,content:t,styles:r,children:s,tag:n}=e;return s?h.createElement(n||"li",{...r,...l},s):h.createElement(n||"li",{...r,...l,dangerouslySetInnerHTML:{__html:t}})},Pe={type:"ListItem",description:"A list item component",label:"List Item",icon:g.ColumnsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},we=e=>{const{blockProps:l,styles:t,content:r}=e;return u.isNull(e.children)?h.createElement("p",{...t,...l,dangerouslySetInnerHTML:{__html:r}}):h.createElement("p",{...t,...l},e.children)},Ie={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:g.TextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),f=require("./common-functions-BZmyleS1.cjs"),k=require("react"),g=require("@radix-ui/react-icons"),u=require("lodash-es"),x=require("lucide-react");function v(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const h=v(k),C=({className:e="",inBuilder:l})=>l?i.jsx("div",{className:f.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,L=e=>{const{blockProps:l,inBuilder:t,backgroundImage:r,children:s,tag:n="div",styles:a}=e;let c=s;s||(c=i.jsx(C,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),h.createElement(n,{...l,...a,style:p},c)},j={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},_=e=>{const{blockProps:l,iconSize:t,icon:r,content:s,styles:n,children:a,iconPos:c,link:p,inBuilder:d}=e,b=r,m=a||i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),b&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:b}})]}),y=k.createElement("button",{...l,...n,type:"button","aria-label":s},m);return u.isEmpty(u.get(p,"href"))?y:d?i.jsx("span",{children:y}):i.jsx("a",{"aria-label":s,href:u.get(p,"href")||"/",target:u.get(p,"target","_self"),children:y})},T={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:g.ButtonIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),i18nProps:["content"],aiProps:["content"]},E=e=>{const{blockProps:l,iconSize:t,icon:r,content:s,styles:n}=e,a=r,c=i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),a&&i.jsx("div",{style:{width:t+"px"},dangerouslySetInnerHTML:{__html:a}})]});return k.createElement("button",{...l,...n,type:"button","aria-label":s},c)},N={type:"CopyButton",description:"A copy button component",label:"Copy Button",category:"core",icon:g.CopyIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("p-2 rounded-md flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-copy'><path d='M8 17L19 8M8 17V7a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v10'/></svg>",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:20}}}),i18nProps:["content"],aiProps:["content"]},R=e=>{const{blockProps:l,styles:t,htmlCode:r,inBuilder:s}=e;return s?i.jsxs("div",{className:"relative",children:[s?i.jsx("div",{...l,...t,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):h.createElement("div",{...l,...t,dangerouslySetInnerHTML:{__html:r}})},M={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:g.CodeIcon,group:"advanced",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},$=e=>{const{scripts:l,inBuilder:t,blockProps:r}=e;return t?i.jsx("div",{...r,children:i.jsx("div",{className:f.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:l}})},A={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:x.FileCode,group:"advanced",...o.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},H=e=>{const{blockProps:l,styles:t}=e;return k.createElement("hr",{...t,...l})},U={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:g.DividerHorizontalIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},D=e=>{const{blockProps:l,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),h.createElement("div",{...l,...t,style:s})},q={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},z=e=>{const{blockProps:l,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=f.generateUUID();return p?i.jsxs("div",{...s,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"checkbox",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:d,children:r})]}):i.jsx("input",{id:d,...l,...n,...s,type:"checkbox",required:a,name:t})},V={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:g.CheckboxIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},F=e=>{const{children:l,blockProps:t,errorMessage:r,successMessage:s,action:n,styles:a,inBuilder:c}=e;let p=l;l||(p=i.jsx(C,{inBuilder:c}));const d={"x-data":"{}","x-on:submit.prevent":"post"},b={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...d,"data-error":r,"data-success":s,method:"post",action:n,...t,...a,children:[i.jsx("div",{...b}),p]})},O={type:"Form",label:"Form",category:"core",icon:x.GroupIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},G=e=>{const{blockProps:l,inBuilder:t,label:r,styles:s,inputStyles:n,icon:a,iconSize:c,iconPos:p}=e,d=f.generateUUID(),b={"x-bind:disabled":"formLoading"};return i.jsxs("button",{id:d,...b,...n,...s,...l||{},type:t?"button":"submit","aria-label":r,children:[r,a&&i.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},Y={type:"FormButton",label:"Submit Button",category:"core",icon:g.ButtonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:o.StylesProp(""),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},W=e=>{const{blockProps:l,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,showLabel:c,required:p,inputType:d,autocomplete:b}=e,m=f.generateUUID();return c?i.jsxs("div",{...n,...l,children:[c&&i.jsx("label",{htmlFor:m,children:r}),i.jsx("input",{name:t,...a,id:m,type:d,placeholder:s,required:p,autoComplete:b?"on":"off"})]}):i.jsx("input",{id:m,name:t,...l,...a,...n,type:d,placeholder:s,required:p,autoComplete:b?"on":"off"})},X={type:"Input",label:"web_blocks.input",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","hidden","range","color","date","time"]},required:{type:"boolean",title:"Required",default:!1},autocomplete:{type:"boolean",title:"Autocomplete",default:!0}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},J=e=>{const{blockProps:l,content:t,styles:r,children:s}=e,n={...r,...l};return s?h.createElement("label",n,s):h.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},Q={type:"Label",label:"Label",category:"core",icon:g.LetterCaseToggleIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},Z=e=>{const{blockProps:l,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=f.generateUUID();return p?i.jsxs("div",{...s,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"radio",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:d,children:r})]}):i.jsx("input",{id:d,...l,...n,...s,type:"radio",required:a,checked:c,name:t})},K={type:"Radio",label:"web_blocks.radio",category:"core",icon:g.RadiobuttonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},ee=e=>{const{blockProps:l,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:d,options:b}=e,m=f.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:m,children:r}),i.jsxs("select",{...a,id:m,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:s}),u.map(b,y=>i.jsx("option",{value:y==null?void 0:y.value,children:y==null?void 0:y.label},y==null?void 0:y.value))]})]}):i.jsxs("select",{id:m,...n,...l,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:s}),u.map(b,y=>i.jsx("option",{value:y==null?void 0:y.value,children:y==null?void 0:y.label},y==null?void 0:y.value))]})},te={type:"Select",label:"web_blocks.select",category:"core",icon:g.DropdownMenuIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},oe=e=>{const{blockProps:l,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,rows:c,showLabel:p,required:d}=e,b=f.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:b,children:r}),i.jsx("textarea",{name:t,...a,id:b,placeholder:s,rows:c,required:d})]}):i.jsx("textarea",{id:b,name:t,...l,...a,...n,placeholder:s,rows:c,required:d})},le={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},re=e=>{const{blockProps:l,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...l,children:[i.jsxs("h1",{children:["Global Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):h.createElement("span",{...l},r)},se={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:x.GlobeIcon,category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},ie=e=>{const{blockProps:l,styles:t,content:r,tag:s="h1",children:n=null}=e;return n?h.createElement(s,{...t,...l},n):h.createElement(s,{...t,...l,dangerouslySetInnerHTML:{__html:r}})},ne={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:g.HeadingIcon,group:"typography",...o.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:o.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},ae=e=>{const{blockProps:l,styles:t}=e;return k.createElement("br",{...l,...t})},ce={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},pe=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("table",{...l,...r},t):i.jsx(C,{})},ue=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("thead",{...l,...r},t):i.jsx(C,{})},de=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("tbody",{...l,...r},t):i.jsx(C,{})},ge=e=>{const{blockProps:l,children:t,styles:r}=e;return t?k.createElement("tr",{...l,...r},t):i.jsx(C,{})},ye=e=>{const{blockProps:l,children:t,content:r,styles:s}=e;return!t&&u.isEmpty(r)?i.jsx(C,{}):t?k.createElement("td",{...l,...s},t):k.createElement("td",{...l,...s,dangerouslySetInnerHTML:{__html:r}})};o.registerChaiBlock(pe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:g.TableIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("Table")});o.registerChaiBlock(ue,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:g.BorderTopIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("TableHead")});o.registerChaiBlock(de,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:g.BorderAllIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("TableBody")});o.registerChaiBlock(ge,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:g.ViewHorizontalIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),blocks:B("TableRow")});o.registerChaiBlock(ye,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:g.DragHandleHorizontalIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:B("TableCell"),i18nProps:["content"],aiProps:["content"]});function B(e){const l=(n,a)=>({_id:f.generateUUID(),_parent:n,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+a}`}),t=n=>{const a=f.generateUUID(),c={_type:"TableRow",_id:a,styles:"#styles:,border-b"};return n&&(c._parent=n),[c,l(a,"1"),l(a,"2"),l(a,"3")]},r=n=>{const a=f.generateUUID(),c={_id:a,_type:"TableHead",styles:"#styles:,font-medium"};return n&&(c._parent=n),[c,...t(a)]},s=n=>{const a=f.generateUUID(),c={_id:a,_type:"TableBody",styles:"#styles:,"};return n&&(c._parent=n),[c,...t(a),...t(a)]};if(e==="Table"){const n=f.generateUUID();return[{_id:n,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(n),...s(n)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const I=(e,...l)=>({...e,className:f.cn(e.className,...l)}),me=e=>{const{blockProps:l,icon:t,styles:r,width:s,inBuilder:n,height:a}=e,c=I(r,"");if(u.isEmpty(t))return i.jsx(C,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...l,...c,style:{width:s?`${s}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},he={type:"Icon",label:"web_blocks.icon",category:"core",icon:g.SketchLogoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),icon:{type:"string",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>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},be=e=>{const{blockProps:l,image:t,mobileImage:r,styles:s,alt:n,height:a,width:c,lazyLoading:p}=e;return u.isEmpty(t)?i.jsx(C,{className:"h-36"}):i.jsxs("picture",{children:[r&&i.jsx("source",{srcSet:r,media:"(max-width: 480px)"}),i.jsx("img",{...l,...s,src:t,alt:n,loading:p?"lazy":"eager",width:c,height:a})]})},fe={type:"Image",description:"A image component",label:"Image",category:"core",icon:g.ImageIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},assetId:{type:"string",title:"Asset ID",default:"",ui:{"ui:widget":"hidden"}}}}),aiProps:["alt"],i18nProps:["alt"]},ke=e=>{const{blockProps:l,link:t,children:r,styles:s,inBuilder:n,content:a}=e;let c={};return!r&&u.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?r?i.jsx("span",{...l,style:c,...s,children:r}):k.createElement("span",{...l,...s,style:c},a):r?i.jsx("a",{"aria-label":a,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...l,...s,children:r}):k.createElement("a",{...l,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":a},a)},Ce={type:"Link",description:"A link component",label:"Link",category:"core",icon:g.Link1Icon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},xe=e=>{const{blockProps:l,children:t,listType:r,styles:s,tag:n,inBuilder:a}=e,c=f.cn(u.get(s,"className",""),r);return!t&&u.isEmpty(s==null?void 0:s.className)?i.jsx(C,{inBuilder:a}):h.createElement(n||(r==="list-decimal"?"ol":"ul"),{...l,...s,className:c},t)},Be={type:"List",description:"A list component",label:"List",icon:g.RowsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),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"}]},Se=e=>{const{blockProps:l,content:t,styles:r,children:s,tag:n}=e;return s?h.createElement(n||"li",{...r,...l},s):h.createElement(n||"li",{...r,...l,dangerouslySetInnerHTML:{__html:t}})},Pe={type:"ListItem",description:"A list item component",label:"List Item",icon:g.ColumnsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},we=e=>{const{blockProps:l,styles:t,content:r}=e;return u.isNull(e.children)?h.createElement("p",{...t,...l,dangerouslySetInnerHTML:{__html:r}}):h.createElement("p",{...t,...l},e.children)},Ie={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:g.TextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
2
2
  Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
3
3
  nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},ve=e=>{const{blockProps:l,inBuilder:t,children:r,partialBlockId:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...l,children:[i.jsxs("h1",{children:["Partial Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):h.createElement("span",{...l},r)},Le={type:"PartialBlock",description:"A partial block component",label:"Partial Block",icon:x.GlobeIcon,category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},S={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},je=e=>{const{blockProps:l,children:t,styles:r,colSpan:s,tabletColSpan:n,desktopColSpan:a}=e,p={className:[u.get(r,"className",""),u.get(S,["SMALL",isNaN(s)||!s?6:s],""),n?u.get(S,["MEDIUM",n||s],""):"",a?u.get(S,["LARGE",n||s],""):""].join(" ")};return i.jsx("div",{...l,...r,...p,children:t||i.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},_e={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:x.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),colSpan:{type:"number",title:"Column Span",default:6,enum:[1,2,3,4,5,6,7,8,9,10,11,12]},tabletColSpan:{type:"number",title:"Column Span (Tablet)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]},desktopColSpan:{type:"number",title:"Column Span (Desktop)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]}}})},Te=e=>{const{blockProps:l,children:t,styles:r,gutter:s}=e,a={className:[u.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:a.style={gap:`${s}px`},i.jsx("div",{...l,...r,...a,children:t})},Ee={type:"Row",description:"A row component",label:"Row",group:"basic",icon:x.Rows,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},Ne=e=>{const{blockProps:l,content:t,styles:r}=e,s=I(r,"prose dark:prose-invert prose-p:m-0 prose-p:min-h-[1rem] prose-blockquote:m-2 prose-blockquote:ml-4 prose-ul:m-0 prose-ol:m-0 prose-li:m-0");return i.jsx("div",{...l,...s,dangerouslySetInnerHTML:{__html:t}})},Re={type:"RichText",description:"A rich text block",label:"Rich Text",category:"core",icon:g.CursorTextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},Me=e=>{const{blockProps:l,styles:t,content:r,children:s=null,tag:n}=e;return s?h.createElement("span",{...t,...l},s):h.createElement(n||"span",{...t,...l,dangerouslySetInnerHTML:{__html:r||""}})},$e={type:"Span",description:"A span component",label:"Span",category:"core",group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},Ae=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,He={type:"Text",description:"A text component with no styling",label:"Text",hidden:!0,category:"core",group:"typography",icon:g.SpaceBetweenVerticallyIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},Ue={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},P=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,w=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,De=(e,l)=>{const t=u.get(l,"autoplay",!1),r=u.get(l,"controls",!1),s=u.get(l,"loop",!1),n=t||u.get(l,"muted",!0);if(P.test(e)){const a=e.match(P);if(a){const c=a[4];let p=`https://www.youtube.com/embed/${c}`,d=t?"autoplay=1":"";return d+=s?`&loop=1&playlist=${c}`:"",d+=n?"&mute=1&muted=1":"",d+=r?"&controls=1":"&controls=0",`${p}?${d}`}}if(w.test(e)){const a=e.match(w);if(a){const c=a[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=n?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},qe=e=>{const{url:l,blockProps:t,styles:r,controls:s,videoSource:n,inBuilder:a}=e,c=De(l,s);return i.jsxs("div",{...u.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&a?i.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:u.isEmpty(l)?`Provided ${n} video link in settings Video URL.`:`Provided ${n} video link is invalid.`}):i.jsx("iframe",{width:"100%",src:c,...u.pick(r,"className")}),a&&i.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},ze=e=>{const{url:l,styles:t,controls:r,sources:s,poster:n,blockProps:a}=e;let c=n;const p=[...u.get(s,"srcsets",[])||[]];l&&typeof l=="string"&&p.push({url:l,width:"9999"});const d=p.sort((m,y)=>parseInt(m.width)-parseInt(y.width)).filter(m=>!u.isEmpty(m.url)&&!u.isEmpty(m.width));d.length===0&&!c&&(c="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const b=u.get(r,"autoplay",!1)||u.get(r,"muted",!0);return(c||!u.isEmpty(d))&&i.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:k.createElement("video",{...t,...a,key:JSON.stringify(d),controls:u.get(r,"controls",!1),autoPlay:u.get(r,"autoplay",!1),loop:u.get(r,"loop",!1),poster:c,...b?{muted:!0}:{}},d.map(m=>{if(!m.url||m.url.length<4||isNaN(m.width))return null;const y=`(max-width: ${m.width}px)`;return i.jsx("source",{src:m.url,media:y,type:m.type},m.url)}),"Your browser does not support the video tag.")})},Ve=e=>{const{videoSource:l}=e;return l==="Custom"?i.jsx(ze,{...e}):l==="Youtube"||l==="Vimeo"?i.jsx(qe,{...e}):i.jsxs("div",{children:["Invalid video source : ",l]})},Fe={type:"Video",label:"Video",category:"core",icon:g.VideoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"}},allOf:[{if:{properties:{videoSource:{const:"Custom"}}},then:{properties:{url:{type:"string",title:"Video URL",default:""},poster:{type:"string",title:"Poster URL",default:""},sources:{type:"object",default:{srcsets:[]}},controls:{...Ue}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},Oe=({children:e,tag:l,blockProps:t,styles:r})=>h.createElement(l,{...t,...r},e),Ge={type:"Repeater",label:"Repeater",icon:g.LoopIcon,group:"basic",blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],...o.registerChaiBlockSchema({properties:{repeaterItems:{title:"Items",type:"string",binding:"array",default:""},tag:{title:"Tag",type:"string",default:"ul",enum:["div","ul","ol"]},styles:o.stylesProp(""),limit:{title:"Limit",type:"number",default:""}}})},Ye=({children:e,blockProps:l,styles:t,parentTag:r})=>{let s="li";switch(r){case"ul":s="li";break;case"ol":s="li";break;default:s="div"}return h.createElement(s,{...l,...t},e)},We={type:"RepeaterItem",label:"Repeater Item",icon:g.LoopIcon,hidden:!0,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.stylesProp(""),parentTag:o.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Xe=()=>{o.registerChaiBlock(L,j),o.registerChaiBlock(D,q),o.registerChaiBlock(_,T),o.registerChaiBlock(ie,ne),o.registerChaiBlock(we,Ie),o.registerChaiBlock(Me,$e),o.registerChaiBlock(Ne,Re),o.registerChaiBlock(ke,Ce),o.registerChaiBlock(xe,Be),o.registerChaiBlock(Se,Pe),o.registerChaiBlock(me,he),o.registerChaiBlock(be,fe),o.registerChaiBlock(Ve,Fe),o.registerChaiBlock(R,M),o.registerChaiBlock($,A),o.registerChaiBlock(Ae,He),o.registerChaiBlock(F,O),o.registerChaiBlock(G,Y),o.registerChaiBlock(W,X),o.registerChaiBlock(z,V),o.registerChaiBlock(Z,K),o.registerChaiBlock(ee,te),o.registerChaiBlock(oe,le),o.registerChaiBlock(J,Q),o.registerChaiBlock(ae,ce),o.registerChaiBlock(H,U),o.registerChaiBlock(re,se),o.registerChaiBlock(ve,Le),o.registerChaiBlock(Te,Ee),o.registerChaiBlock(je,_e),o.registerChaiBlock(E,N),o.registerChaiBlock(Oe,Ge),o.registerChaiBlock(Ye,We)};exports.loadWebBlocks=Xe;
@@ -1,11 +1,11 @@
1
- import { registerChaiBlockSchema as d, StylesProp as p, registerChaiBlock as u, stylesProp as T, closestBlockProp as H } from "@chaibuilder/runtime";
1
+ import { registerChaiBlockSchema as u, StylesProp as p, registerChaiBlock as d, stylesProp as T, closestBlockProp as H } from "@chaibuilder/runtime";
2
2
  import { jsx as s, jsxs as h, Fragment as N } from "react/jsx-runtime";
3
3
  import { c as x, g as C } from "./common-functions-BGzDsf1z.js";
4
4
  import * as b from "react";
5
5
  import { createElement as w } from "react";
6
- import { ButtonIcon as R, CopyIcon as z, CodeIcon as V, DividerHorizontalIcon as j, CheckboxIcon as q, InputIcon as M, LetterCaseToggleIcon as D, RadiobuttonIcon as F, DropdownMenuIcon as U, HeadingIcon as G, TableIcon as O, BorderTopIcon as Y, BorderAllIcon as W, ViewHorizontalIcon as X, DragHandleHorizontalIcon as J, SketchLogoIcon as Q, ImageIcon as Z, Link1Icon as K, RowsIcon as ee, ColumnsIcon as te, TextIcon as oe, CursorTextIcon as le, SpaceBetweenVerticallyIcon as re, VideoIcon as ne, LoopIcon as $ } from "@radix-ui/react-icons";
6
+ import { ButtonIcon as R, CopyIcon as z, CodeIcon as V, DividerHorizontalIcon as D, CheckboxIcon as j, InputIcon as M, LetterCaseToggleIcon as q, RadiobuttonIcon as F, DropdownMenuIcon as U, HeadingIcon as G, TableIcon as O, BorderTopIcon as Y, BorderAllIcon as W, ViewHorizontalIcon as X, DragHandleHorizontalIcon as J, SketchLogoIcon as Q, ImageIcon as Z, Link1Icon as K, RowsIcon as ee, ColumnsIcon as te, TextIcon as oe, CursorTextIcon as le, SpaceBetweenVerticallyIcon as re, VideoIcon as ne, LoopIcon as $ } from "@radix-ui/react-icons";
7
7
  import { isEmpty as v, get as f, map as P, isNull as ie, omit as se, pick as ae } from "lodash-es";
8
- import { FileCode as ce, GroupIcon as pe, GlobeIcon as E, Columns as ue, Rows as de } from "lucide-react";
8
+ import { FileCode as ce, GroupIcon as pe, GlobeIcon as E, Columns as de, Rows as ue } from "lucide-react";
9
9
  const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div", { className: x("pointer-events-none flex h-20 flex-col items-center justify-center p-2", e), children: /* @__PURE__ */ s("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ s("div", { className: "flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700" }) }) }) : null, ye = (e) => {
10
10
  const { blockProps: o, inBuilder: t, backgroundImage: l, children: r, tag: n = "div", styles: i } = e;
11
11
  let a = r;
@@ -18,7 +18,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
18
18
  label: "Box",
19
19
  category: "core",
20
20
  group: "basic",
21
- ...d({
21
+ ...u({
22
22
  properties: {
23
23
  styles: p(""),
24
24
  backgroundImage: {
@@ -83,7 +83,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
83
83
  category: "core",
84
84
  icon: R,
85
85
  group: "basic",
86
- ...d({
86
+ ...u({
87
87
  properties: {
88
88
  styles: p("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),
89
89
  content: {
@@ -150,7 +150,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
150
150
  category: "core",
151
151
  icon: z,
152
152
  group: "basic",
153
- ...d({
153
+ ...u({
154
154
  properties: {
155
155
  styles: p("p-2 rounded-md flex items-center"),
156
156
  content: {
@@ -193,7 +193,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
193
193
  category: "core",
194
194
  icon: V,
195
195
  group: "advanced",
196
- ...d({
196
+ ...u({
197
197
  properties: {
198
198
  styles: p(""),
199
199
  htmlCode: {
@@ -213,7 +213,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
213
213
  category: "core",
214
214
  icon: ce,
215
215
  group: "advanced",
216
- ...d({
216
+ ...u({
217
217
  properties: {
218
218
  scripts: {
219
219
  type: "string",
@@ -232,9 +232,9 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
232
232
  description: "A horizontal line component",
233
233
  label: "Divider",
234
234
  category: "core",
235
- icon: j,
235
+ icon: D,
236
236
  group: "basic",
237
- ...d({
237
+ ...u({
238
238
  properties: {
239
239
  styles: p("bg-gray-900 h-0.5 py-2 my-1")
240
240
  }
@@ -249,7 +249,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
249
249
  label: "Empty Box",
250
250
  category: "core",
251
251
  group: "basic",
252
- ...d({
252
+ ...u({
253
253
  properties: {
254
254
  styles: p(""),
255
255
  backgroundImage: {
@@ -291,9 +291,9 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
291
291
  type: "Checkbox",
292
292
  label: "web_blocks.checkbox",
293
293
  category: "core",
294
- icon: q,
294
+ icon: j,
295
295
  group: "form",
296
- ...d({
296
+ ...u({
297
297
  properties: {
298
298
  styles: p("flex items-center gap-x-2"),
299
299
  inputStyles: p(""),
@@ -367,7 +367,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
367
367
  styles: "#styles:bg-black text-white rounded px-3 py-1,"
368
368
  }
369
369
  ],
370
- ...d({
370
+ ...u({
371
371
  properties: {
372
372
  styles: p(""),
373
373
  action: {
@@ -425,7 +425,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
425
425
  category: "core",
426
426
  icon: R,
427
427
  group: "form",
428
- ...d({
428
+ ...u({
429
429
  properties: {
430
430
  styles: p(
431
431
  "text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"
@@ -506,7 +506,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
506
506
  category: "core",
507
507
  icon: M,
508
508
  group: "form",
509
- ...d({
509
+ ...u({
510
510
  properties: {
511
511
  styles: p(""),
512
512
  inputStyles: p("w-full p-1"),
@@ -562,9 +562,9 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
562
562
  type: "Label",
563
563
  label: "Label",
564
564
  category: "core",
565
- icon: D,
565
+ icon: q,
566
566
  group: "form",
567
- ...d({
567
+ ...u({
568
568
  properties: {
569
569
  styles: p(),
570
570
  content: {
@@ -600,7 +600,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
600
600
  category: "core",
601
601
  icon: F,
602
602
  group: "form",
603
- ...d({
603
+ ...u({
604
604
  properties: {
605
605
  styles: p("flex items-center gap-x-2"),
606
606
  inputStyles: p(""),
@@ -645,13 +645,13 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
645
645
  /* @__PURE__ */ s("option", { value: "", disabled: !0, selected: !0, hidden: !0, children: r }),
646
646
  P(k, (m) => /* @__PURE__ */ s("option", { value: m == null ? void 0 : m.value, children: m == null ? void 0 : m.label }, m == null ? void 0 : m.value))
647
647
  ] });
648
- }, je = {
648
+ }, De = {
649
649
  type: "Select",
650
650
  label: "web_blocks.select",
651
651
  category: "core",
652
652
  icon: U,
653
653
  group: "form",
654
- ...d({
654
+ ...u({
655
655
  properties: {
656
656
  styles: p(""),
657
657
  inputStyles: p("w-full p-1"),
@@ -709,7 +709,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
709
709
  }),
710
710
  aiProps: ["label", "placeholder"],
711
711
  i18nProps: ["label", "placeholder"]
712
- }, qe = (e) => {
712
+ }, je = (e) => {
713
713
  const { blockProps: o, fieldName: t, label: l, placeholder: r, styles: n, inputStyles: i, rows: a, showLabel: c, required: y } = e, k = C();
714
714
  return c ? /* @__PURE__ */ h("div", { ...n, ...o, children: [
715
715
  c && /* @__PURE__ */ s("label", { htmlFor: k, children: l }),
@@ -737,13 +737,13 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
737
737
  required: y
738
738
  }
739
739
  );
740
- }, De = {
740
+ }, qe = {
741
741
  type: "TextArea",
742
742
  label: "web_blocks.textarea",
743
743
  category: "core",
744
744
  icon: M,
745
745
  group: "form",
746
- ...d({
746
+ ...u({
747
747
  properties: {
748
748
  fieldName: {
749
749
  type: "string",
@@ -806,7 +806,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
806
806
  category: "core",
807
807
  group: "basic",
808
808
  hidden: !0,
809
- ...d({
809
+ ...u({
810
810
  properties: {
811
811
  globalBlock: {
812
812
  type: "string",
@@ -830,7 +830,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
830
830
  category: "core",
831
831
  icon: G,
832
832
  group: "typography",
833
- ...d({
833
+ ...u({
834
834
  properties: {
835
835
  tag: {
836
836
  type: "string",
@@ -859,7 +859,7 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
859
859
  category: "core",
860
860
  group: "basic",
861
861
  hidden: !0,
862
- ...d({
862
+ ...u({
863
863
  properties: {
864
864
  styles: p("")
865
865
  }
@@ -888,70 +888,70 @@ const I = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ s("div",
888
888
  dangerouslySetInnerHTML: { __html: l }
889
889
  });
890
890
  };
891
- u(Xe, {
891
+ d(Xe, {
892
892
  type: "Table",
893
893
  label: "Table",
894
894
  category: "core",
895
895
  group: "table",
896
896
  hidden: !0,
897
897
  icon: O,
898
- ...d({
898
+ ...u({
899
899
  properties: {
900
900
  styles: p("")
901
901
  }
902
902
  }),
903
903
  blocks: B("Table")
904
904
  });
905
- u(Je, {
905
+ d(Je, {
906
906
  type: "TableHead",
907
907
  label: "Table Head",
908
908
  category: "core",
909
909
  group: "table",
910
910
  hidden: !0,
911
911
  icon: Y,
912
- ...d({
912
+ ...u({
913
913
  properties: {
914
914
  styles: p("")
915
915
  }
916
916
  }),
917
917
  blocks: B("TableHead")
918
918
  });
919
- u(Qe, {
919
+ d(Qe, {
920
920
  type: "TableBody",
921
921
  label: "Table Body",
922
922
  category: "core",
923
923
  group: "table",
924
924
  hidden: !0,
925
925
  icon: W,
926
- ...d({
926
+ ...u({
927
927
  properties: {
928
928
  styles: p("")
929
929
  }
930
930
  }),
931
931
  blocks: B("TableBody")
932
932
  });
933
- u(Ze, {
933
+ d(Ze, {
934
934
  type: "TableRow",
935
935
  label: "Table Row",
936
936
  category: "core",
937
937
  group: "table",
938
938
  hidden: !0,
939
939
  icon: X,
940
- ...d({
940
+ ...u({
941
941
  properties: {
942
942
  styles: p("")
943
943
  }
944
944
  }),
945
945
  blocks: B("TableRow")
946
946
  });
947
- u(Ke, {
947
+ d(Ke, {
948
948
  type: "TableCell",
949
949
  label: "Table Cell",
950
950
  category: "core",
951
951
  group: "table",
952
952
  hidden: !0,
953
953
  icon: J,
954
- ...d({
954
+ ...u({
955
955
  properties: {
956
956
  styles: p(""),
957
957
  content: {
@@ -1032,7 +1032,7 @@ const A = (e, ...o) => ({
1032
1032
  category: "core",
1033
1033
  icon: Q,
1034
1034
  group: "media",
1035
- ...d({
1035
+ ...u({
1036
1036
  properties: {
1037
1037
  styles: p(""),
1038
1038
  icon: {
@@ -1077,7 +1077,7 @@ const A = (e, ...o) => ({
1077
1077
  category: "core",
1078
1078
  icon: Z,
1079
1079
  group: "media",
1080
- ...d({
1080
+ ...u({
1081
1081
  properties: {
1082
1082
  styles: p(""),
1083
1083
  image: {
@@ -1114,6 +1114,12 @@ const A = (e, ...o) => ({
1114
1114
  title: "Mobile Image",
1115
1115
  default: "",
1116
1116
  ui: { "ui:widget": "image" }
1117
+ },
1118
+ assetId: {
1119
+ type: "string",
1120
+ title: "Asset ID",
1121
+ default: "",
1122
+ ui: { "ui:widget": "hidden" }
1117
1123
  }
1118
1124
  }
1119
1125
  }),
@@ -1148,7 +1154,7 @@ const A = (e, ...o) => ({
1148
1154
  category: "core",
1149
1155
  icon: K,
1150
1156
  group: "basic",
1151
- ...d({
1157
+ ...u({
1152
1158
  properties: {
1153
1159
  styles: p(""),
1154
1160
  content: {
@@ -1191,7 +1197,7 @@ const A = (e, ...o) => ({
1191
1197
  icon: ee,
1192
1198
  category: "core",
1193
1199
  group: "basic",
1194
- ...d({
1200
+ ...u({
1195
1201
  properties: {
1196
1202
  styles: p(""),
1197
1203
  listType: {
@@ -1245,7 +1251,7 @@ const A = (e, ...o) => ({
1245
1251
  icon: te,
1246
1252
  category: "core",
1247
1253
  group: "basic",
1248
- ...d({
1254
+ ...u({
1249
1255
  properties: {
1250
1256
  styles: p(""),
1251
1257
  content: {
@@ -1269,14 +1275,14 @@ const A = (e, ...o) => ({
1269
1275
  ...o,
1270
1276
  dangerouslySetInnerHTML: { __html: l }
1271
1277
  }) : b.createElement("p", { ...t, ...o }, e.children);
1272
- }, ut = {
1278
+ }, dt = {
1273
1279
  type: "Paragraph",
1274
1280
  description: "A paragraph component",
1275
1281
  label: "Paragraph",
1276
1282
  category: "core",
1277
1283
  icon: oe,
1278
1284
  group: "typography",
1279
- ...d({
1285
+ ...u({
1280
1286
  properties: {
1281
1287
  styles: p(""),
1282
1288
  content: {
@@ -1292,7 +1298,7 @@ const A = (e, ...o) => ({
1292
1298
  i18nProps: ["content"],
1293
1299
  aiProps: ["content"],
1294
1300
  canAcceptBlock: (e) => e === "Span" || e === "Link" || e === "Text"
1295
- }, dt = (e) => {
1301
+ }, ut = (e) => {
1296
1302
  const { blockProps: o, inBuilder: t, children: l, partialBlockId: r } = e;
1297
1303
  return t && !r ? /* @__PURE__ */ h(
1298
1304
  "div",
@@ -1316,7 +1322,7 @@ const A = (e, ...o) => ({
1316
1322
  category: "core",
1317
1323
  group: "basic",
1318
1324
  hidden: !0,
1319
- ...d({
1325
+ ...u({
1320
1326
  properties: {
1321
1327
  partialBlockId: {
1322
1328
  type: "string",
@@ -1383,12 +1389,12 @@ const A = (e, ...o) => ({
1383
1389
  label: "Column",
1384
1390
  group: "basic",
1385
1391
  category: "core",
1386
- icon: ue,
1392
+ icon: de,
1387
1393
  wrapper: !0,
1388
1394
  canDelete: () => !0,
1389
1395
  canAcceptBlock: () => !0,
1390
1396
  canBeNested: (e) => e === "Row",
1391
- ...d({
1397
+ ...u({
1392
1398
  properties: {
1393
1399
  styles: p(""),
1394
1400
  colSpan: {
@@ -1421,7 +1427,7 @@ const A = (e, ...o) => ({
1421
1427
  description: "A row component",
1422
1428
  label: "Row",
1423
1429
  group: "basic",
1424
- icon: de,
1430
+ icon: ue,
1425
1431
  blocks: () => [
1426
1432
  { _type: "Row", _id: "row", styles: "#styles:,p-1" },
1427
1433
  { _type: "Column", id: "column", _parent: "row", styles: "#styles:," },
@@ -1430,7 +1436,7 @@ const A = (e, ...o) => ({
1430
1436
  category: "core",
1431
1437
  wrapper: !0,
1432
1438
  canAcceptBlock: (e) => e === "Column",
1433
- ...d({
1439
+ ...u({
1434
1440
  properties: {
1435
1441
  styles: p(""),
1436
1442
  colCount: {
@@ -1460,7 +1466,7 @@ const A = (e, ...o) => ({
1460
1466
  category: "core",
1461
1467
  icon: le,
1462
1468
  group: "typography",
1463
- ...d({
1469
+ ...u({
1464
1470
  properties: {
1465
1471
  styles: p(""),
1466
1472
  content: {
@@ -1486,7 +1492,7 @@ const A = (e, ...o) => ({
1486
1492
  label: "Span",
1487
1493
  category: "core",
1488
1494
  group: "typography",
1489
- ...d({
1495
+ ...u({
1490
1496
  properties: {
1491
1497
  styles: p(""),
1492
1498
  content: {
@@ -1508,7 +1514,7 @@ const A = (e, ...o) => ({
1508
1514
  category: "core",
1509
1515
  group: "typography",
1510
1516
  icon: re,
1511
- ...d({
1517
+ ...u({
1512
1518
  properties: {
1513
1519
  styles: p("text-black"),
1514
1520
  content: {
@@ -1615,7 +1621,7 @@ const A = (e, ...o) => ({
1615
1621
  category: "core",
1616
1622
  icon: ne,
1617
1623
  group: "media",
1618
- ...d({
1624
+ ...u({
1619
1625
  properties: {
1620
1626
  styles: p("absolute h-full w-full object-cover"),
1621
1627
  videoSource: {
@@ -1701,7 +1707,7 @@ const A = (e, ...o) => ({
1701
1707
  { _id: "A", _type: "Repeater", tag: "ul" },
1702
1708
  { _id: "B", _type: "RepeaterItem", parentTag: "ul", _parent: "A" }
1703
1709
  ],
1704
- ...d({
1710
+ ...u({
1705
1711
  properties: {
1706
1712
  repeaterItems: {
1707
1713
  title: "Items",
@@ -1747,7 +1753,7 @@ const A = (e, ...o) => ({
1747
1753
  icon: $,
1748
1754
  hidden: !0,
1749
1755
  group: "basic",
1750
- ...d({
1756
+ ...u({
1751
1757
  properties: {
1752
1758
  styles: T(""),
1753
1759
  parentTag: H("Repeater", "tag")
@@ -1757,9 +1763,9 @@ const A = (e, ...o) => ({
1757
1763
  canDelete: () => !1,
1758
1764
  canMove: () => !1,
1759
1765
  canDuplicate: () => !1
1760
- }, qt = () => {
1761
- u(ye, me), u(xe, Le), u(ge, be), u(Ge, Oe), u(pt, ut), u(wt, Ct), u(ht, kt), u(rt, nt), u(it, st), u(at, ct), u(et, tt), u(ot, lt), u(_t, St), u(ke, we), u(Ce, ve), u(vt, It), u(Se, Te), u(Ne, Re), u(Me, $e), u(Pe, _e), u(He, ze), u(Ve, je), u(qe, De), u(Ee, Ae), u(Ye, We), u(Ie, Be), u(Fe, Ue), u(dt, yt), u(bt, ft), u(mt, gt), u(fe, he), u(Tt, Nt), u(Rt, Mt);
1766
+ }, jt = () => {
1767
+ d(ye, me), d(xe, Le), d(ge, be), d(Ge, Oe), d(pt, dt), d(wt, Ct), d(ht, kt), d(rt, nt), d(it, st), d(at, ct), d(et, tt), d(ot, lt), d(_t, St), d(ke, we), d(Ce, ve), d(vt, It), d(Se, Te), d(Ne, Re), d(Me, $e), d(Pe, _e), d(He, ze), d(Ve, De), d(je, qe), d(Ee, Ae), d(Ye, We), d(Ie, Be), d(Fe, Ue), d(ut, yt), d(bt, ft), d(mt, gt), d(fe, he), d(Tt, Nt), d(Rt, Mt);
1762
1768
  };
1763
1769
  export {
1764
- qt as loadWebBlocks
1770
+ jt as loadWebBlocks
1765
1771
  };