@chaibuilder/sdk 4.0.0-beta.29 → 4.0.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{2SSKDMRQ-KSwVJqI-.js → 2SSKDMRQ-B5Tzwoh4.js} +2 -2
- package/dist/{2SSKDMRQ-Cdt-mHqV.cjs → 2SSKDMRQ-Dub3pRV1.cjs} +1 -1
- package/dist/{AP7HFJJL-7jzYJmcy.js → AP7HFJJL-CfmdXP9M.js} +1 -1
- package/dist/{AP7HFJJL-DLGcUScX.cjs → AP7HFJJL-Dt6MglIr.cjs} +1 -1
- package/dist/{IconPicker-rw-TNxlL.js → IconPicker-Cn8Z42-Z.js} +1 -1
- package/dist/{IconPicker-CnojLBlG.cjs → IconPicker-DLqOB-ri.cjs} +1 -1
- package/dist/{WDYDFRGG-CdC9BtV1.js → WDYDFRGG-BOpmZGHS.js} +2 -2
- package/dist/{WDYDFRGG-BR5xQ3nl.cjs → WDYDFRGG-Dfj1ikzw.cjs} +1 -1
- package/dist/{actions-registery-NNrIYJwx.js → actions-registery-Bj-j1k5i.js} +58 -54
- package/dist/{actions-registery-Dl5Udl5U.cjs → actions-registery-Cy1lqUVI.cjs} +7 -7
- package/dist/actions.cjs +1 -1
- package/dist/actions.js +2 -2
- package/dist/{active-in-another-tab-Bz2VTL_J.js → active-in-another-tab-CEWvA8SG.js} +2 -2
- package/dist/{active-in-another-tab-DuJ5LGx2.cjs → active-in-another-tab-DV83cJ_v.cjs} +1 -1
- package/dist/{add-new-language-page-DsW9jOZg.js → add-new-language-page-B3wK94-S.js} +3 -3
- package/dist/{add-new-language-page-cwVvf4go.cjs → add-new-language-page-C3Uu92KN.cjs} +1 -1
- package/dist/{add-new-page-BmVMrSpB.cjs → add-new-page-BOE-xwBc.cjs} +1 -1
- package/dist/{add-new-page-D_FoJSTj.js → add-new-page-DsvGVrR8.js} +2 -2
- package/dist/{ai-panel-content-DPbgkg3w.js → ai-panel-content-BBSzHZG6.js} +3 -3
- package/dist/{ai-panel-content-DkZIm58g.cjs → ai-panel-content-DBlnfRRi.cjs} +1 -1
- package/dist/{ai-panel-default-lang-N2dwgUWq.js → ai-panel-default-lang-BVBuwnyU.js} +4 -4
- package/dist/{ai-panel-default-lang-CbgD5Jf0.cjs → ai-panel-default-lang-DJJWAtN0.cjs} +2 -2
- package/dist/{ai-panel-other-lang-nEMuKeDm.js → ai-panel-other-lang-fIEZkmRy.js} +3 -3
- package/dist/{ai-panel-other-lang-CcEoahu_.cjs → ai-panel-other-lang-v8Yd5ggR.cjs} +1 -1
- package/dist/{ai-prompt-input-DeTqloue.cjs → ai-prompt-input-C7ha_0Cn.cjs} +1 -1
- package/dist/{ai-prompt-input-eqaVCOh6.js → ai-prompt-input-CmSfGxTN.js} +1 -1
- package/dist/{ai-translation-prompt-C6sEuyAD.cjs → ai-translation-prompt-BzTGAS3W.cjs} +1 -1
- package/dist/{ai-translation-prompt-Dhig6nJr.js → ai-translation-prompt-CtBmvsRy.js} +1 -1
- package/dist/{apply-binding-BLuPA9Ic.cjs → apply-binding-9XSrYzAE.cjs} +1 -1
- package/dist/{apply-binding-FppRmplj.js → apply-binding-chfbBKi2.js} +1 -1
- package/dist/{change-password-modal-975CYjTH.cjs → change-password-modal-CdOwtCWN.cjs} +1 -1
- package/dist/{change-password-modal-BfYrlENQ.js → change-password-modal-DxkhBI5d.js} +2 -2
- package/dist/{code-editor-uyPykDYt.js → code-editor-Bpn8z2fo.js} +1 -1
- package/dist/{code-editor-BgzRvHeO.cjs → code-editor-fL3s6Hk7.cjs} +1 -1
- package/dist/{continue-editing-in-this-client-BkIfhxR5.js → continue-editing-in-this-client-DDB816CQ.js} +2 -2
- package/dist/{continue-editing-in-this-client-D5L2BsCZ.cjs → continue-editing-in-this-client-DjxpjsA8.cjs} +1 -1
- package/dist/core.cjs +1 -1
- package/dist/core.d.ts +3 -0
- package/dist/core.js +2 -2
- package/dist/{css-import-modal-B2LRqSiI.js → css-import-modal-CL8SIC3K.js} +1 -1
- package/dist/{css-import-modal-BEM9VcQM.cjs → css-import-modal-CRC7bK1c.cjs} +1 -1
- package/dist/{delete-design-token-CHjmkGql.js → delete-design-token-B0md8qUi.js} +1 -1
- package/dist/{delete-design-token-B7hfYdve.cjs → delete-design-token-C94IgWdi.cjs} +1 -1
- package/dist/{delete-page-VXXUi4o_.js → delete-page-41tvYcEw.js} +2 -2
- package/dist/{delete-page-EP1oFayO.cjs → delete-page-BHPlx8ec.cjs} +1 -1
- package/dist/{design-token-usage-BHgHUVIm.js → design-token-usage-CyOY4Pni.js} +1 -1
- package/dist/{design-token-usage-CKYxesym.cjs → design-token-usage-DtdjTCn3.cjs} +1 -1
- package/dist/{digital-asset-manager-DPB63e09.js → digital-asset-manager-C_ru4Zes.js} +3 -3
- package/dist/{digital-asset-manager-mauSGcX8.cjs → digital-asset-manager-DSLQz8qk.cjs} +1 -1
- package/dist/{duplicate-page-xqVPqSdI.cjs → duplicate-page-BvggF83O.cjs} +1 -1
- package/dist/{duplicate-page-CPJ8jZWu.js → duplicate-page-DMmDdmfS.js} +3 -3
- package/dist/{dynamic-page-selector-BAt6tb-P.cjs → dynamic-page-selector-C5agz2Ze.cjs} +1 -1
- package/dist/{dynamic-page-selector-C-1FD1tF.js → dynamic-page-selector-D2z51nLi.js} +2 -2
- package/dist/{image-editor-DcPOgd6x.cjs → image-editor-DFmlG348.cjs} +1 -1
- package/dist/{image-editor-BwibmVH2.js → image-editor-sKvOFo-S.js} +1 -1
- package/dist/{index-uaxWNK6D.js → index-BFnMzGe6.js} +6 -6
- package/dist/index-Bzn_gpaK.cjs +5 -0
- package/dist/{index-DD4a1mxX.js → index-CA1OwKJX.js} +696 -692
- package/dist/{index-D97RTITR.cjs → index-D30xvFa5.cjs} +2 -2
- package/dist/{json-diff-viewer-CRYlX0Bw.js → json-diff-viewer-B5wAR5GY.js} +2 -2
- package/dist/{json-diff-viewer-DLdKPJ46.cjs → json-diff-viewer-DRQSNhaS.cjs} +1 -1
- package/dist/{lang-panel-DSRp7OPA.cjs → lang-panel-BZsICcBR.cjs} +1 -1
- package/dist/{lang-panel-YA6NOcG7.js → lang-panel-q04hEq5o.js} +3 -3
- package/dist/{manage-design-tokens-RpwzB7fs.js → manage-design-tokens-Cene3KEu.js} +2 -2
- package/dist/{manage-design-tokens-BxpYkJm0.cjs → manage-design-tokens-Di5C6nTj.cjs} +1 -1
- package/dist/{mark-as-template-D-K1Z_I0.cjs → mark-as-template-CT-hLGIW.cjs} +1 -1
- package/dist/{mark-as-template-BvfAHmgj.js → mark-as-template-raTtKmQ9.js} +2 -2
- package/dist/{nested-path-selector-content-Dz5brrWk.cjs → nested-path-selector-content-CSUHTj9G.cjs} +1 -1
- package/dist/{nested-path-selector-content-D0WcjzaQ.js → nested-path-selector-content-CzQ2Lorl.js} +1 -1
- package/dist/{no-language-page-content-EI0eJeeV.js → no-language-page-content-Bg6VjMVY.js} +2 -2
- package/dist/{no-language-page-content-D57KCchk.cjs → no-language-page-content-Bkj8JpEY.cjs} +1 -1
- package/dist/{no-language-page-dialog-Cd0tJat5.js → no-language-page-dialog-CRPMr9YT.js} +2 -2
- package/dist/{no-language-page-dialog-Be0JREBD.cjs → no-language-page-dialog-TffLjvJn.cjs} +1 -1
- package/dist/{page-creator-TPHFsqgH.js → page-creator-CQhE1tgn.js} +3 -3
- package/dist/{page-creator-BY0-bSqC.cjs → page-creator-RrUhy8uH.cjs} +1 -1
- package/dist/{page-lock-kI8Kh0VS.cjs → page-lock-D9h5pgxn.cjs} +1 -1
- package/dist/{page-lock-CBmHxQZh.js → page-lock-Dye1JZBB.js} +2 -2
- package/dist/{page-locked-dialog-Cza6zchm.js → page-locked-dialog-BMjPVyHF.js} +2 -2
- package/dist/{page-locked-dialog-CXiWSFIU.cjs → page-locked-dialog-b2_f-A7a.cjs} +1 -1
- package/dist/{page-manager-new-2VhsnuvL.cjs → page-manager-new-2mDjnSqc.cjs} +1 -1
- package/dist/{page-manager-new-BWjXTyj0.js → page-manager-new-DP1b_dXt.js} +3 -3
- package/dist/{page-manager-search-and-filter-BqTklpl7.cjs → page-manager-search-and-filter-D0ZXojiu.cjs} +1 -1
- package/dist/{page-manager-search-and-filter-CzPiU7eE.js → page-manager-search-and-filter-DCcYyoPO.js} +2 -2
- package/dist/{page-revisions-content-BxLkaSIJ.cjs → page-revisions-content-BX8ZWebc.cjs} +1 -1
- package/dist/{page-revisions-content-CuzcWYwa.js → page-revisions-content-mDwvH6J-.js} +3 -3
- package/dist/pages.cjs +1 -1
- package/dist/pages.d.ts +3 -4
- package/dist/pages.js +1 -1
- package/dist/{publish-pages-content-BAgzGIpO.cjs → publish-pages-content-CR4e9inX.cjs} +1 -1
- package/dist/{publish-pages-content-CyUbbAWn.js → publish-pages-content-M_Kb8b-F.js} +3 -3
- package/dist/render.cjs +1 -1
- package/dist/render.js +2 -2
- package/dist/{rte-widget-modal-D0wcEQUo.cjs → rte-widget-modal-BRSm1Lnp.cjs} +1 -1
- package/dist/{rte-widget-modal-bMEqSEmS.js → rte-widget-modal-CVZDktXI.js} +1 -1
- package/dist/{save-to-lib-DEcXV01t.js → save-to-lib-B1ccNhR2.js} +2 -2
- package/dist/{save-to-lib-DqUsuiLn.cjs → save-to-lib-CYEAWxL9.cjs} +1 -1
- package/dist/{selected-block-display-BZhMhmSe.cjs → selected-block-display-MyU0rS4q.cjs} +1 -1
- package/dist/{selected-block-display-XKVTJyBL.js → selected-block-display-aGR7p5JC.js} +2 -2
- package/dist/seo-panel-B5mDwpaT.cjs +2 -0
- package/dist/{seo-panel-BSqrXr0E.js → seo-panel-P9uixkoZ.js} +139 -139
- package/dist/{shared-json-ld-CNFCdi3P.js → shared-json-ld-Ba9GcvLr.js} +2 -2
- package/dist/{shared-json-ld-CrechTP-.cjs → shared-json-ld-DhQJh_mT.cjs} +1 -1
- package/dist/{slug-input-CBm5u9B7.cjs → slug-input-BdMnlYKT.cjs} +1 -1
- package/dist/{slug-input-BTKl_Yx7.js → slug-input-CAfGHqMW.js} +1 -1
- package/dist/supabase-actions.cjs +1 -1
- package/dist/supabase-actions.js +1 -1
- package/dist/{take-over-request-SZlFQ56u.cjs → take-over-request-BeHTL28z.cjs} +1 -1
- package/dist/{take-over-request-C204CKr0.js → take-over-request-CXjaDliJ.js} +2 -2
- package/dist/{theme-panel-footer-DWIvSz85.js → theme-panel-footer-BkwhuXM7.js} +2 -2
- package/dist/{theme-panel-footer-CTXiHz43.cjs → theme-panel-footer-D_gxD0j4.cjs} +1 -1
- package/dist/{translation-warning-modal-BfGLW4Hm.js → translation-warning-modal-CTfArsb1.js} +1 -1
- package/dist/{translation-warning-modal-BuQYLXFU.cjs → translation-warning-modal-D_vt37fW.cjs} +1 -1
- package/dist/types.d.ts +3 -4
- package/dist/{unmark-as-template-D6UyYNHB.cjs → unmark-as-template-D2bvjGKt.cjs} +1 -1
- package/dist/{unmark-as-template-CVE-_1Td.js → unmark-as-template-vFgMIdxN.js} +2 -2
- package/dist/{unpublish-page-DAbaiV3e.cjs → unpublish-page-CPjHmtSM.cjs} +1 -1
- package/dist/{unpublish-page-Dh1nqqKj.js → unpublish-page-CxkjTzBB.js} +2 -2
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +29 -21
- package/dist/{web-preview-DK8oUz_b.js → web-preview--by73Vvr.js} +1 -1
- package/dist/{web-preview-BPVH6Vy5.cjs → web-preview-C3AMe_BB.cjs} +1 -1
- package/package.json +1 -1
- package/dist/index-DoCX_e4r.cjs +0 -5
- package/dist/seo-panel-DqOGEQ2A.cjs +0 -2
package/dist/web-blocks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),r=require("react/jsx-runtime"),n=require("./runtime.cjs"),P=require("./common-functions-B3a4xKt_.cjs"),x=require("react"),m=require("@radix-ui/react-icons"),d=require("./core-BWQrViOY.cjs");function S(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,l.get?l:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const b=S(x),k=({className:e="",inBuilder:o})=>o?r.jsx("div",{className:P.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:r.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:r.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,_=e=>{const{blockProps:o,inBuilder:t,backgroundImage:l,children:s,tag:i="div",styles:a}=e;let c=s;s||(c=r.jsx(k,{inBuilder:t}));let p={};return l&&(p={backgroundImage:`url(${l})`}),b.createElement(i,{...o,...a,style:p},c)},N={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),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"}]},backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image","ui:allowEmpty":!0}}}}),canAcceptBlock:()=>!0},T=e=>{const{blockProps:o,iconSize:t,icon:l,content:s,styles:i,children:a,iconPos:c,link:p,inBuilder:h}=e,y=l,C=a||r.jsxs(r.Fragment,{children:[s&&r.jsx("span",{children:s}),y&&r.jsx("div",{style:{width:t+"px"},className:c+" "+(s?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:y}})]}),f=x.createElement("button",{...o,...i,type:"button","aria-label":s},C);return u.isEmpty(u.get(p,"href"))?f:h?r.jsx("span",{children:f}):r.jsx("a",{"aria-label":s,href:u.get(p,"href")||"/",target:u.get(p,"target","_self"),children:f})},E={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:m.ButtonIcon,group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.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"],enumNames:["Left","Right"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!0,title:"Prefetch Link"}}}),i18nProps:["content","link"],aiProps:["content"]},R=e=>{const{blockProps:o,styles:t,htmlCode:l,inBuilder:s}=e;return s?r.jsxs("div",{className:"relative",...o,children:[s?r.jsx("div",{...t,className:"absolute z-20 h-full w-full"}):null,b.createElement("div",{...t,dangerouslySetInnerHTML:{__html:l.replace(/<script.*?>.*?<\/script>/g,"")}})]}):b.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:l}})},A={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:m.CodeIcon,group:"advanced",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},M=e=>{const{scripts:o,inBuilder:t,blockProps:l}=e;return t?r.jsx("div",{...l,children:r.jsx("div",{className:P.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:r.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:r.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"})})})}):r.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},H={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:m.CodeIcon,hidden:!0,group:"advanced",props:n.registerChaiBlockProps({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},$=e=>{const{blockProps:o,inBuilder:t,children:l,globalBlock:s}=e;return t&&!s?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[r.jsxs("h1",{children:["Global Block - ",s]}),r.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):b.createElement("span",{...o},l)},D={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:m.FrameIcon,category:"core",group:"basic",hidden:!0,props:n.registerChaiBlockProps({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},I=(e,...o)=>({...e,className:P.cn(e.className,...o)}),V=e=>{const{blockProps:o,icon:t,styles:l,width:s,inBuilder:i,height:a}=e,c=I(l,"");if(u.isEmpty(t))return r.jsx(k,{inBuilder:i,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return b.createElement("span",{...o,...c,style:{width:s?`${s}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},z={type:"Icon",label:"web_blocks.icon",category:"core",description:"Icon block is used to display an icon/svg.",icon:m.SketchLogoIcon,group:"media",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),icon:{type:"string",title:"Icon",default:'<svg xmlns="http://www.w3.org/2000/svg" class="chai-default-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-diamond-icon lucide-diamond"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},U=e=>{const{blockProps:o,inBuilder:t,children:l,partialBlockId:s}=e;return t&&!s?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[r.jsxs("h1",{children:["Partial Block - ",s]}),r.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):b.createElement("span",{...o},l)},F={type:"PartialBlock",description:"A partial block component. Partial blocks are global blocks that can be used in multiple pages.",label:"Partial Block",icon:m.FrameIcon,category:"core",group:"basic",hidden:!0,props:n.registerChaiBlockProps({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},w={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"}},q=e=>{const{blockProps:o,children:t,styles:l,colSpan:s,tabletColSpan:i,desktopColSpan:a}=e,p={className:[u.get(l,"className",""),u.get(w,["SMALL",isNaN(s)||!s?6:s],""),i?u.get(w,["MEDIUM",i||s],""):"",a?u.get(w,["LARGE",i||s],""):""].join(" ")};return r.jsx("div",{...o,...l,...p,children:t||r.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},O={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:m.LayoutIcon,wrapper:!0,hidden:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",props:n.registerChaiBlockProps({properties:{styles:n.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]}}})},Z=e=>{const{blockProps:o,children:t,styles:l,gutter:s}=e,a={className:[u.get(l,"className","")," grid grid-cols-12"].join()};return typeof(l==null?void 0:l.style)=="object"&&l.style!==null?a.style={...l.style,gap:`${s}px`}:a.style={gap:`${s}px`},r.jsx("div",{...o,...l,...a,children:t})},G={type:"Row",description:"A row component",label:"Row",group:"basic",icon:m.RowsIcon,hidden:!0,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",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},W=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},Y={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Q=e=>{const{blockProps:o,styles:t,backgroundImage:l}=e;let s={};return l&&(s={backgroundImage:`url(${l})`}),b.createElement("div",{...o,...t,style:s})},J={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image","ui:allowEmpty":!0}}}})},X=e=>{const{blockProps:o,fieldName:t,label:l,styles:s,inputStyles:i,required:a,checked:c,showLabel:p=!0}=e;return p?r.jsxs("div",{...s,...o,children:[r.jsx("input",{...i,name:t,type:"checkbox",required:a,defaultChecked:c}),l&&r.jsx("label",{htmlFor:t,children:l})]}):r.jsx("input",{name:t,...o,...i,...s,type:"checkbox",required:a,defaultChecked:c})},K={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("flex items-center gap-x-2"),inputStyles:n.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{children:o,blockProps:t,errorMessage:l,successMessage:s,action:i,styles:a,inBuilder:c}=e;let p=o;o||(p=r.jsx(k,{inBuilder:c}));const h={"x-data":"{}","x-on:submit.prevent":"post"},y={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return r.jsxs("form",{...h,"data-error":l,"data-success":s,method:"post",action:i,...t,...a,children:[r.jsx("div",{...y}),p]})},te={type:"Form",label:"Form",category:"core",icon:m.FileTextIcon,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,"}],props:n.registerChaiBlockProps({properties:{styles:n.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},oe=e=>{const{blockProps:o,inBuilder:t,label:l,styles:s,icon:i,iconSize:a,iconPos:c}=e;return r.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":l,children:[l,i&&r.jsx("div",{style:{width:a+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:i}})]})},le={type:"FormButton",label:"Submit Button",category:"core",icon:m.ButtonIcon,group:"form",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),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"]},re=e=>{const o={type:"text",autoComplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autoComplete:"on"}:e==="email"?{type:"email",autoComplete:"email"}:e==="tel"?{type:"tel",autoComplete:"tel"}:e==="url"?{type:"url",autoComplete:"url"}:{off:{type:"text",autoComplete:"off"},on:{type:"text",autoComplete:"on"},name:{type:"text",autoComplete:"name"},"honorific-prefix":{type:"text",autoComplete:"honorific-prefix"},"given-name":{type:"text",autoComplete:"given-name"},"additional-name":{type:"text",autoComplete:"additional-name"},"family-name":{type:"text",autoComplete:"family-name"},"honorific-suffix":{type:"text",autoComplete:"honorific-suffix"},nickname:{type:"text",autoComplete:"nickname"},firstName:{type:"text",autoComplete:"given-name"},lastName:{type:"text",autoComplete:"family-name"},email:{type:"email",autoComplete:"email"},tel:{type:"tel",autoComplete:"tel"},"tel-country-code":{type:"tel",autoComplete:"tel-country-code"},"tel-national":{type:"tel",autoComplete:"tel-national"},"tel-area-code":{type:"tel",autoComplete:"tel-area-code"},"tel-local":{type:"tel",autoComplete:"tel-local"},"tel-extension":{type:"tel",autoComplete:"tel-extension"},"street-address":{type:"text",autoComplete:"street-address"},"address-line1":{type:"text",autoComplete:"address-line1"},"address-line2":{type:"text",autoComplete:"address-line2"},"address-line3":{type:"text",autoComplete:"address-line3"},"address-level1":{type:"text",autoComplete:"address-level1"},"address-level2":{type:"text",autoComplete:"address-level2"},"address-level3":{type:"text",autoComplete:"address-level3"},"address-level4":{type:"text",autoComplete:"address-level4"},country:{type:"text",autoComplete:"country"},"country-name":{type:"text",autoComplete:"country-name"},"postal-code":{type:"text",autoComplete:"postal-code"},"cc-name":{type:"text",autoComplete:"cc-name"},"cc-given-name":{type:"text",autoComplete:"cc-given-name"},"cc-additional-name":{type:"text",autoComplete:"cc-additional-name"},"cc-family-name":{type:"text",autoComplete:"cc-family-name"},"cc-number":{type:"text",autoComplete:"cc-number"},"cc-exp":{type:"text",autoComplete:"cc-exp"},"cc-exp-month":{type:"number",autoComplete:"cc-exp-month"},"cc-exp-year":{type:"number",autoComplete:"cc-exp-year"},"cc-csc":{type:"text",autoComplete:"cc-csc"},"cc-type":{type:"text",autoComplete:"cc-type"},bday:{type:"date",autoComplete:"bday"},"bday-day":{type:"number",autoComplete:"bday-day"},"bday-month":{type:"number",autoComplete:"bday-month"},"bday-year":{type:"number",autoComplete:"bday-year"},username:{type:"text",autoComplete:"username"},"new-password":{type:"password",autoComplete:"new-password"},"current-password":{type:"password",autoComplete:"current-password"},"one-time-code":{type:"text",autoComplete:"one-time-code"},"transaction-currency":{type:"text",autoComplete:"transaction-currency"},"transaction-amount":{type:"number",autoComplete:"transaction-amount"},url:{type:"url",autoComplete:"url"},photo:{type:"url",autoComplete:"photo"},sex:{type:"text",autoComplete:"sex"},"organization-title":{type:"text",autoComplete:"organization-title"},organization:{type:"text",autoComplete:"organization"},language:{type:"text",autoComplete:"language"}}[e]||o:o},se=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:s,styles:i,inputStyles:a,showLabel:c,required:p,inputType:h,defaultValue:y}=e,{type:C,autoComplete:f}=re(h);return c?r.jsxs("div",{...i,...o,children:[c&&r.jsx("label",{htmlFor:t,children:l}),r.jsx("input",{name:t,defaultValue:y,...a,type:C,placeholder:s,required:p,autoComplete:f,...C==="hidden"&&y?{value:y}:{}})]}):r.jsx("input",{name:t,...o,...a,...i,type:C,placeholder:s,required:p,autoComplete:f,defaultValue:y,...C==="hidden"&&y?{value:y}:{}})},ie={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),inputStyles:n.stylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},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"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ne=e=>{const{blockProps:o,content:t,styles:l,children:s}=e,i={...l,...o};return s?b.createElement("label",i,s):b.createElement("label",{...i,dangerouslySetInnerHTML:{__html:t}})},ae={type:"Label",label:"Label",category:"core",icon:m.LetterCaseToggleIcon,group:"form",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},ce=e=>{const{blockProps:o,fieldName:t,label:l,styles:s,inputStyles:i,required:a,checked:c,showLabel:p=!0}=e;return p?r.jsxs("div",{...s,...o,children:[r.jsx("input",{...i,name:t,type:"radio",required:a,defaultChecked:c}),l&&r.jsx("label",{htmlFor:t,children:l})]}):r.jsx("input",{name:t,...o,...i,...s,type:"radio",required:a,checked:c})},pe={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("flex items-center gap-x-2"),inputStyles:n.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"]},de=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:s,styles:i,inputStyles:a,required:c,showLabel:p,_multiple:h,options:y,defaultValue:C}=e,f=h&&C?C.split(",").map(g=>g.trim()):C||"";return p?r.jsxs("div",{...i,...o,children:[p&&r.jsx("label",{htmlFor:t,children:l}),r.jsxs("select",{...a,required:c,multiple:h,name:t,defaultValue:f,children:[r.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),u.map(y,g=>r.jsx("option",{value:g==null?void 0:g.value,children:g==null?void 0:g.label},g==null?void 0:g.value))]})]}):r.jsxs("select",{...i,...o,required:c,multiple:h,name:t,defaultValue:f,children:[r.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),u.map(y,g=>r.jsx("option",{value:g==null?void 0:g.value,children:g==null?void 0:g.label},g==null?void 0:g.value))]})},ue={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),inputStyles:n.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},defaultValue:{type:"string",title:"Default Value",default:""},_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"]},me=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:s,styles:i,inputStyles:a,rows:c,showLabel:p,required:h,defaultValue:y}=e;return p?r.jsxs("div",{...i,...o,children:[p&&r.jsx("label",{htmlFor:t,children:l}),r.jsx("textarea",{name:t,...a,placeholder:s,rows:c,required:h,defaultValue:y})]}):r.jsx("textarea",{name:t,...o,...a,...i,placeholder:s,rows:c,required:h,defaultValue:y})},ye={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",props:n.registerChaiBlockProps({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:n.stylesProp(""),inputStyles:n.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},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ge=e=>{const{blockProps:o,styles:t,content:l,tag:s="h1",children:i=null}=e;return i?b.createElement(s,{...t,...o},i):b.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:l}})},he={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:m.HeadingIcon,group:"typography",props:n.registerChaiBlockProps({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:n.stylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea","ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},be=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},fe={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},xe=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("table",{...o,...l},t):r.jsx(k,{})},Ce=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("thead",{...o,...l},t):r.jsx(k,{})},ke=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("tbody",{...o,...l},t):r.jsx(k,{})},Pe=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("tr",{...o,...l},t):r.jsx(k,{})},Be=e=>{const{blockProps:o,children:t,content:l,styles:s}=e;return!t&&u.isEmpty(l)?r.jsx(k,{}):t?x.createElement("td",{...o,...s},t):x.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(xe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:m.TableIcon,props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("")}}),blocks:B("Table")});d.registerChaiBlock(Ce,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:m.BorderTopIcon,props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("")}}),blocks:B("TableHead")});d.registerChaiBlock(ke,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:m.BorderAllIcon,props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("")}}),blocks:B("TableBody")});d.registerChaiBlock(Pe,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:m.ViewHorizontalIcon,props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("")}}),blocks:B("TableRow")});d.registerChaiBlock(Be,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:m.DragHandleHorizontalIcon,props:n.registerChaiBlockProps({properties:{styles:n.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 o=(i,a)=>({_id:P.generateUUID(),_parent:i,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+a}`}),t=i=>{const a=P.generateUUID(),c={_type:"TableRow",_id:a,styles:"#styles:,border-b"};return i&&(c._parent=i),[c,o(a,"1"),o(a,"2"),o(a,"3")]},l=i=>{const a=P.generateUUID(),c={_id:a,_type:"TableHead",styles:"#styles:,font-medium"};return i&&(c._parent=i),[c,...t(a)]},s=i=>{const a=P.generateUUID(),c={_id:a,_type:"TableBody",styles:"#styles:,"};return i&&(c._parent=i),[c,...t(a),...t(a)]};if(e==="Table"){const i=P.generateUUID();return[{_id:i,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...l(i),...s(i)]}return e==="TableRow"?t():e==="TableHead"?l():e==="TableBody"?s():[]}const we="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",ve=e=>{const{blockProps:o,image:t,mobileImage:l,styles:s,alt:i,height:a,width:c,lazyLoading:p,mobileWidth:h,mobileHeight:y}=e;return u.isEmpty(t)?r.jsx(k,{className:"h-36"}):r.jsxs("picture",{children:[l&&r.jsx("source",{srcSet:l,media:"(max-width: 480px)",width:h,height:y}),r.jsx("img",{...o,...s,src:t,alt:i,loading:p?"lazy":"eager",width:c,height:a})]})},Ie={type:"Image",description:"A image component",label:"Image",category:"core",icon:m.ImageIcon,group:"media",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("w-full h-full object-cover"),image:{type:"string",title:"Image",default:we,ui:{"ui:widget":"image"}},width:{type:"string",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"string",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"string",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"string",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},je=e=>{const{blockProps:o,link:t,children:l,styles:s,inBuilder:i,content:a}=e;let c={};return!l&&u.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),i?l?r.jsx("span",{role:"link",...o,style:c,...s,children:l}):x.createElement("span",{...o,...s,style:c,role:"link"},a):l?r.jsx("a",{"aria-label":a,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:l}):x.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":a},a)},Le={type:"Link",description:"A link component",label:"Link",category:"core",icon:m.Link1Icon,group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("block"),content:{type:"string",default:"Link text 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"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content","link"],canAcceptBlock:e=>e!=="Link"},Se=e=>{const{blockProps:o,children:t,styles:l,tag:s,inBuilder:i}=e;return!t&&u.isEmpty(l==null?void 0:l.className)?r.jsx(k,{inBuilder:i}):b.createElement(s||"ul",{...o,...l},t)},_e={type:"List",description:"A list component",label:"List",icon:m.RowsIcon,category:"core",group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",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"}]},Ne=e=>{const{blockProps:o,content:t,styles:l,children:s,tag:i}=e;return s?b.createElement(i||"li",{...l,...o},s):b.createElement(i||"li",{...l,...o,dangerouslySetInnerHTML:{__html:t}})},Te={type:"ListItem",description:"A list item component",label:"List Item",icon:m.ColumnsIcon,category:"core",group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.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"},Ee=e=>{const{blockProps:o,styles:t,content:l}=e;if(!u.isNull(e.children))return b.createElement("p",{...t,...o},e.children);const s=I(t,"rte");return b.createElement("div",{...s,...o,dangerouslySetInnerHTML:{__html:l}})},Re={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:m.TextIcon,group:"typography",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),content:{type:"string",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.",ui:{"ui:widget":"richtext","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},Ae=e=>{const{blockProps:o,content:t,styles:l}=e,s=I(l,"rte");return r.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},Me={type:"RichText",description:"A rich text block",label:"Rich Text",hidden:!0,category:"core",icon:m.CursorTextIcon,group:"typography",props:n.registerChaiBlockProps({properties:{styles:n.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"]},He=e=>{const{blockProps:o,styles:t,content:l,children:s=null,tag:i}=e;return s?b.createElement("span",{...t,...o},s):b.createElement(i||"span",{...t,...o,dangerouslySetInnerHTML:{__html:l||""}})},$e={type:"Span",description:"A span component",label:"Span",category:"core",group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},De=e=>e.inBuilder||e.forceWrapper?r.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,Ve={type:"Text",description:"A text component with no styling",label:"Text",category:"core",group:"typography",blocks:()=>[{_id:"a",_type:"Text",_name:"Text",content:""}],icon:m.SpaceBetweenVerticallyIcon,props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},v={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}}},j=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,L=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=u.get(o,"autoplay",!1),l=u.get(o,"controls",!1),s=u.get(o,"loop",!1),i=t||u.get(o,"muted",!0);if(j.test(e)){const a=e.match(j);if(a){const c=a[4];let p=`https://www.youtube.com/embed/${c}`,h=t?"autoplay=1":"";return h+=s?`&loop=1&playlist=${c}`:"",h+=i?"&mute=1&muted=1":"",h+=l?"&controls=1":"&controls=0",`${p}?${h}`}}if(L.test(e)){const a=e.match(L);if(a){const c=a[1];let p="";return p+=t?"autoplay=1":"",p+=l?"&controls=1":"&controls=0",p+=i?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Ue=e=>{const{url:o,blockProps:t,styles:l,controls:s,videoSource:i,inBuilder:a,title:c}=e,p=ze(o,s);return r.jsxs("div",{...u.omit(l,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!p&&a?r.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:u.isEmpty(o)?`Provided ${i} video link in settings Video URL.`:`Provided ${i} video link is invalid.`}):r.jsx("iframe",{width:"100%",src:p??"",title:c||"Video player",...u.pick(l,"className")}),a&&r.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Fe=e=>{const{url:o,styles:t,controls:l,sources:s,poster:i,blockProps:a,title:c}=e;let p=i;const h=[...u.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&h.push({url:o,width:9999});const y=h.sort((f,g)=>f.width-g.width).filter(f=>!u.isEmpty(f.url)&&!u.isEmpty(f.width));y.length===0&&!p&&(p="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const C=u.get(l,"autoplay",!1)||u.get(l,"muted",!0);return(p||!u.isEmpty(y))&&r.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...a,title:c||"Video player",key:JSON.stringify(y),controls:u.get(l,"controls",!1),autoPlay:u.get(l,"autoplay",!1),loop:u.get(l,"loop",!1),poster:p,...C?{muted:!0}:{}},y.map(f=>{if(!f.url||f.url.length<4||isNaN(f.width))return null;const g=`(max-width: ${f.width}px)`;return r.jsx("source",{src:f.url,media:g,type:f.type},f.url)}),"Your browser does not support the video tag.")})},qe=e=>{const{videoSource:o}=e;return o==="Custom"?r.jsx(Fe,{...e}):o==="Youtube"||o==="Vimeo"?r.jsx(Ue,{...e}):r.jsxs("div",{children:["Invalid video source : ",o]})},Oe={type:"Video",label:"Video",category:"core",icon:m.VideoIcon,group:"media",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"},title:{type:"string",title:"Video Title",default:"Video player"}},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:{...v}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...v}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...v}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url","title"]},Ze=e=>{const{paginationStyles:o}=e,t=d.getRegisteredChaiBlock("Pagination");return r.jsx("div",{...o,children:t?b.createElement(t.component,{...u.omit(e,["paginationStyles"]),blockProps:{}}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",disabled:!0,children:r.jsx(m.ChevronLeftIcon,{className:"h-4 w-4"})}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-blue-500 bg-blue-500 font-medium text-white",children:"1"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"2"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"3"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"4"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"5"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50",children:r.jsx(m.ChevronRightIcon,{className:"h-4 w-4"})})]})})},Ge=e=>{const{children:o,tag:t,styles:l,blockProps:s,$loading:i}=e,{pagination:a,inBuilder:c}=e;let p=o;return u.isEmpty(p)&&c&&(p=r.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?i&&c?Array.from({length:2}).map((h,y)=>r.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[r.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),r.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},y)):p:r.jsxs(r.Fragment,{children:[b.createElement(t,{...s,...l},i&&c?Array.from({length:2}).map((h,y)=>r.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[r.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),r.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},y)):p),a&&r.jsx(Ze,{...u.pick(e,["limit","totalItems","paginationStrategy","inBuilder","draft","lang","paginationStyles"])})]})},We={type:"Repeater",label:"Repeater",icon:m.LoopIcon,group:"basic",description:"Repeater block is used to display a list of items based on data binding in repeaterItems",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),paginationStyles:n.stylesProp("flex items-center justify-center gap-2 p-4"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},pagination:{title:"Pagination",type:"boolean",default:!1}},allOf:[{if:{properties:{pagination:{const:!0}}},then:{properties:{paginationStrategy:{type:"string",title:"Pagination Strategy",default:"segment",enum:["query","segment"]},limit:{type:"number",title:"Items Per Page",default:10,minimum:1}}}},{if:{properties:{pagination:{const:!1}}},then:{properties:{limit:{type:"number",title:"Max items",default:10,minimum:1}}}}]}),canAcceptBlock:e=>e==="Pagination"},Ye=({children:e,blockProps:o,styles:t,parentTag:l,inBuilder:s})=>{let i="li";switch(l){case"ul":i="li";break;case"ol":i="li";break;default:i="div"}return!e&&s?b.createElement(i,{...o,...t},r.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):b.createElement(i,{...o,...t},e)},Qe={type:"RepeaterItem",label:"Repeater Item",icon:m.LoopIcon,hidden:!0,group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp(""),parentTag:d.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Je=({children:e,blockProps:o,styles:t})=>b.createElement("div",{...o,...t},e),Xe={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",props:n.registerChaiBlockProps({properties:{styles:n.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Ke=()=>{d.registerChaiBlock(_,N),d.registerChaiBlock(Q,J),d.registerChaiBlock(T,E),d.registerChaiBlock(ge,he),d.registerChaiBlock(Ee,Re),d.registerChaiBlock(He,$e),d.registerChaiBlock(Ae,Me),d.registerChaiBlock(je,Le),d.registerChaiBlock(Se,_e),d.registerChaiBlock(Ne,Te),d.registerChaiBlock(V,z),d.registerChaiBlock(ve,Ie),d.registerChaiBlock(qe,Oe),d.registerChaiBlock(R,A),d.registerChaiBlock(M,H),d.registerChaiBlock(De,Ve),d.registerChaiBlock(ee,te),d.registerChaiBlock(oe,le),d.registerChaiBlock(se,ie),d.registerChaiBlock(X,K),d.registerChaiBlock(ce,pe),d.registerChaiBlock(de,ue),d.registerChaiBlock(me,ye),d.registerChaiBlock(ne,ae),d.registerChaiBlock(be,fe),d.registerChaiBlock(W,Y),d.registerChaiBlock($,D),d.registerChaiBlock(U,F),d.registerChaiBlock(Z,G),d.registerChaiBlock(q,O),d.registerChaiBlock(Ge,We),d.registerChaiBlock(Ye,Qe),d.registerChaiBlock(Je,Xe)};exports.loadWebBlocks=Ke;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),r=require("react/jsx-runtime"),a=require("./runtime.cjs"),P=require("./common-functions-B3a4xKt_.cjs"),x=require("react"),m=require("@radix-ui/react-icons"),d=require("./core-BWQrViOY.cjs");function S(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,l.get?l:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const b=S(x),k=({className:e="",inBuilder:o})=>o?r.jsx("div",{className:P.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:r.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:r.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,_=e=>{const{blockProps:o,inBuilder:t,backgroundImage:l,children:s,tag:i="div",styles:n}=e;let c=s;s||(c=r.jsx(k,{inBuilder:t}));let p={};return l&&(p={backgroundImage:`url(${l})`}),b.createElement(i,{...o,...n,style:p},c)},N={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),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"}]},backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image","ui:allowEmpty":!0}}}}),canAcceptBlock:()=>!0},T=e=>{const{blockProps:o,iconSize:t,icon:l,content:s,styles:i,children:n,iconPos:c,link:p,inBuilder:g}=e,y=l,C=n||r.jsxs(r.Fragment,{children:[s&&r.jsx("span",{children:s}),y&&r.jsx("div",{style:{width:t+"px"},className:c+" "+(s?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:y}})]}),f=x.createElement("button",{...o,...i,type:"button","aria-label":s},C);return u.isEmpty(u.get(p,"href"))?f:g?r.jsx("span",{children:f}):r.jsx("a",{"aria-label":s,href:u.get(p,"href")||"/",target:u.get(p,"target","_self"),children:f})},E={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:m.ButtonIcon,group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.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"],enumNames:["Left","Right"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!0,title:"Prefetch Link"}}}),i18nProps:["content","link"],aiProps:["content"]},R=e=>{const{blockProps:o,styles:t,htmlCode:l,inBuilder:s}=e;return s?r.jsxs("div",{className:"relative",...o,children:[s?r.jsx("div",{...t,className:"absolute z-20 h-full w-full"}):null,b.createElement("div",{...t,dangerouslySetInnerHTML:{__html:l.replace(/<script.*?>.*?<\/script>/g,"")}})]}):b.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:l}})},A={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:m.CodeIcon,group:"advanced",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},M=e=>{const{scripts:o,inBuilder:t,blockProps:l}=e;return t?r.jsx("div",{...l,children:r.jsx("div",{className:P.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:r.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:r.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"})})})}):r.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},H={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:m.CodeIcon,hidden:!0,group:"advanced",props:a.registerChaiBlockProps({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},$=e=>{const{blockProps:o,inBuilder:t,children:l,globalBlock:s}=e;return t&&!s?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[r.jsxs("h1",{children:["Global Block - ",s]}),r.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):b.createElement("span",{...o},l)},D={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:m.FrameIcon,category:"core",group:"basic",hidden:!0,props:a.registerChaiBlockProps({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},I=(e,...o)=>({...e,className:P.cn(e.className,...o)}),V=e=>{const{blockProps:o,icon:t,styles:l,width:s,inBuilder:i,height:n}=e,c=I(l,"");if(u.isEmpty(t))return r.jsx(k,{inBuilder:i,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return b.createElement("span",{...o,...c,style:{width:s?`${s}px`:"auto",height:n?`${n}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},z={type:"Icon",label:"web_blocks.icon",category:"core",description:"Icon block is used to display an icon/svg.",icon:m.SketchLogoIcon,group:"media",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),icon:{type:"string",title:"Icon",default:'<svg xmlns="http://www.w3.org/2000/svg" class="chai-default-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-diamond-icon lucide-diamond"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},F=e=>{const{blockProps:o,inBuilder:t,children:l,partialBlockId:s}=e;return t&&!s?r.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[r.jsxs("h1",{children:["Partial Block - ",s]}),r.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):b.createElement("span",{...o},l)},U={type:"PartialBlock",description:"A partial block component. Partial blocks are global blocks that can be used in multiple pages.",label:"Partial Block",icon:m.FrameIcon,category:"core",group:"basic",hidden:!0,props:a.registerChaiBlockProps({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},w={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"}},q=e=>{const{blockProps:o,children:t,styles:l,colSpan:s,tabletColSpan:i,desktopColSpan:n}=e,p={className:[u.get(l,"className",""),u.get(w,["SMALL",isNaN(s)||!s?6:s],""),i?u.get(w,["MEDIUM",i||s],""):"",n?u.get(w,["LARGE",i||s],""):""].join(" ")};return r.jsx("div",{...o,...l,...p,children:t||r.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},O={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:m.LayoutIcon,wrapper:!0,hidden:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",props:a.registerChaiBlockProps({properties:{styles:a.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]}}})},Z=e=>{const{blockProps:o,children:t,styles:l,gutter:s}=e,n={className:[u.get(l,"className","")," grid grid-cols-12"].join()};return typeof(l==null?void 0:l.style)=="object"&&l.style!==null?n.style={...l.style,gap:`${s}px`}:n.style={gap:`${s}px`},r.jsx("div",{...o,...l,...n,children:t})},G={type:"Row",description:"A row component",label:"Row",group:"basic",icon:m.RowsIcon,hidden:!0,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",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},W=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},Y={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Q=e=>{const{blockProps:o,styles:t,backgroundImage:l}=e;let s={};return l&&(s={backgroundImage:`url(${l})`}),b.createElement("div",{...o,...t,style:s})},J={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image","ui:allowEmpty":!0}}}})},X=e=>{const{blockProps:o,fieldName:t,label:l,styles:s,inputStyles:i,required:n,checked:c,showLabel:p=!0}=e;return p?r.jsxs("div",{...s,...o,children:[r.jsx("input",{...i,name:t,type:"checkbox",required:n,defaultChecked:c}),l&&r.jsx("label",{htmlFor:t,children:l})]}):r.jsx("input",{name:t,...o,...i,...s,type:"checkbox",required:n,defaultChecked:c})},K={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("flex items-center gap-x-2"),inputStyles:a.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{children:o,blockProps:t,errorMessage:l,successMessage:s,action:i,styles:n,inBuilder:c}=e;let p=o;o||(p=r.jsx(k,{inBuilder:c}));const g={"x-data":"{}","x-on:submit.prevent":"post"},y={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return r.jsxs("form",{...g,"data-error":l,"data-success":s,method:"post",action:i,...t,...n,children:[r.jsx("div",{...y}),p]})},te={type:"Form",label:"Form",category:"core",icon:m.FileTextIcon,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,"}],props:a.registerChaiBlockProps({properties:{styles:a.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},oe=e=>{const{blockProps:o,inBuilder:t,label:l,styles:s,icon:i,iconSize:n,iconPos:c}=e;return r.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":l,children:[l,i&&r.jsx("div",{style:{width:n+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:i}})]})},le={type:"FormButton",label:"Submit Button",category:"core",icon:m.ButtonIcon,group:"form",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),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"]},re=e=>{const o={type:"text",autoComplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autoComplete:"on"}:e==="email"?{type:"email",autoComplete:"email"}:e==="tel"?{type:"tel",autoComplete:"tel"}:e==="url"?{type:"url",autoComplete:"url"}:{off:{type:"text",autoComplete:"off"},on:{type:"text",autoComplete:"on"},name:{type:"text",autoComplete:"name"},"honorific-prefix":{type:"text",autoComplete:"honorific-prefix"},"given-name":{type:"text",autoComplete:"given-name"},"additional-name":{type:"text",autoComplete:"additional-name"},"family-name":{type:"text",autoComplete:"family-name"},"honorific-suffix":{type:"text",autoComplete:"honorific-suffix"},nickname:{type:"text",autoComplete:"nickname"},firstName:{type:"text",autoComplete:"given-name"},lastName:{type:"text",autoComplete:"family-name"},email:{type:"email",autoComplete:"email"},tel:{type:"tel",autoComplete:"tel"},"tel-country-code":{type:"tel",autoComplete:"tel-country-code"},"tel-national":{type:"tel",autoComplete:"tel-national"},"tel-area-code":{type:"tel",autoComplete:"tel-area-code"},"tel-local":{type:"tel",autoComplete:"tel-local"},"tel-extension":{type:"tel",autoComplete:"tel-extension"},"street-address":{type:"text",autoComplete:"street-address"},"address-line1":{type:"text",autoComplete:"address-line1"},"address-line2":{type:"text",autoComplete:"address-line2"},"address-line3":{type:"text",autoComplete:"address-line3"},"address-level1":{type:"text",autoComplete:"address-level1"},"address-level2":{type:"text",autoComplete:"address-level2"},"address-level3":{type:"text",autoComplete:"address-level3"},"address-level4":{type:"text",autoComplete:"address-level4"},country:{type:"text",autoComplete:"country"},"country-name":{type:"text",autoComplete:"country-name"},"postal-code":{type:"text",autoComplete:"postal-code"},"cc-name":{type:"text",autoComplete:"cc-name"},"cc-given-name":{type:"text",autoComplete:"cc-given-name"},"cc-additional-name":{type:"text",autoComplete:"cc-additional-name"},"cc-family-name":{type:"text",autoComplete:"cc-family-name"},"cc-number":{type:"text",autoComplete:"cc-number"},"cc-exp":{type:"text",autoComplete:"cc-exp"},"cc-exp-month":{type:"number",autoComplete:"cc-exp-month"},"cc-exp-year":{type:"number",autoComplete:"cc-exp-year"},"cc-csc":{type:"text",autoComplete:"cc-csc"},"cc-type":{type:"text",autoComplete:"cc-type"},bday:{type:"date",autoComplete:"bday"},"bday-day":{type:"number",autoComplete:"bday-day"},"bday-month":{type:"number",autoComplete:"bday-month"},"bday-year":{type:"number",autoComplete:"bday-year"},username:{type:"text",autoComplete:"username"},"new-password":{type:"password",autoComplete:"new-password"},"current-password":{type:"password",autoComplete:"current-password"},"one-time-code":{type:"text",autoComplete:"one-time-code"},"transaction-currency":{type:"text",autoComplete:"transaction-currency"},"transaction-amount":{type:"number",autoComplete:"transaction-amount"},url:{type:"url",autoComplete:"url"},photo:{type:"url",autoComplete:"photo"},sex:{type:"text",autoComplete:"sex"},"organization-title":{type:"text",autoComplete:"organization-title"},organization:{type:"text",autoComplete:"organization"},language:{type:"text",autoComplete:"language"}}[e]||o:o},se=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:s,styles:i,inputStyles:n,showLabel:c,required:p,inputType:g,defaultValue:y}=e,{type:C,autoComplete:f}=re(g);return c?r.jsxs("div",{...i,...o,children:[c&&r.jsx("label",{htmlFor:t,children:l}),r.jsx("input",{name:t,defaultValue:y,...n,type:C,placeholder:s,required:p,autoComplete:f,...C==="hidden"&&y?{value:y}:{}})]}):r.jsx("input",{name:t,...o,...n,...i,type:C,placeholder:s,required:p,autoComplete:f,defaultValue:y,...C==="hidden"&&y?{value:y}:{}})},ie={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),inputStyles:a.stylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},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"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ae=e=>{const{blockProps:o,content:t,styles:l,children:s}=e,i={...l,...o};return s?b.createElement("label",i,s):b.createElement("label",{...i,dangerouslySetInnerHTML:{__html:t}})},ne={type:"Label",label:"Label",category:"core",icon:m.LetterCaseToggleIcon,group:"form",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},ce=e=>{const{blockProps:o,fieldName:t,label:l,styles:s,inputStyles:i,required:n,checked:c,showLabel:p=!0}=e;return p?r.jsxs("div",{...s,...o,children:[r.jsx("input",{...i,name:t,type:"radio",required:n,defaultChecked:c}),l&&r.jsx("label",{htmlFor:t,children:l})]}):r.jsx("input",{name:t,...o,...i,...s,type:"radio",required:n,checked:c})},pe={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("flex items-center gap-x-2"),inputStyles:a.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"]},de=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:s,styles:i,inputStyles:n,required:c,showLabel:p,_multiple:g,options:y,defaultValue:C}=e,f=g&&C?C.split(",").map(h=>h.trim()):C||"";return p?r.jsxs("div",{...i,...o,children:[p&&r.jsx("label",{htmlFor:t,children:l}),r.jsxs("select",{...n,required:c,multiple:g,name:t,defaultValue:f,children:[r.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),u.map(y,h=>r.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})]}):r.jsxs("select",{...i,...o,required:c,multiple:g,name:t,defaultValue:f,children:[r.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),u.map(y,h=>r.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})},ue={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),inputStyles:a.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},defaultValue:{type:"string",title:"Default Value",default:""},_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"]},me=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:s,styles:i,inputStyles:n,rows:c,showLabel:p,required:g,defaultValue:y}=e;return p?r.jsxs("div",{...i,...o,children:[p&&r.jsx("label",{htmlFor:t,children:l}),r.jsx("textarea",{name:t,...n,placeholder:s,rows:c,required:g,defaultValue:y})]}):r.jsx("textarea",{name:t,...o,...n,...i,placeholder:s,rows:c,required:g,defaultValue:y})},ye={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",props:a.registerChaiBlockProps({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:a.stylesProp(""),inputStyles:a.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},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ge=e=>{const{blockProps:o,styles:t,content:l,tag:s="h1",children:i=null}=e;return i?b.createElement(s,{...t,...o},i):b.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:l}})},he={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:m.HeadingIcon,group:"typography",props:a.registerChaiBlockProps({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:a.stylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea","ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},be=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},fe={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},xe=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("table",{...o,...l},t):r.jsx(k,{})},Ce=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("thead",{...o,...l},t):r.jsx(k,{})},ke=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("tbody",{...o,...l},t):r.jsx(k,{})},Pe=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("tr",{...o,...l},t):r.jsx(k,{})},Be=e=>{const{blockProps:o,children:t,content:l,styles:s}=e;return!t&&u.isEmpty(l)?r.jsx(k,{}):t?x.createElement("td",{...o,...s},t):x.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(xe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:m.TableIcon,props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("")}}),blocks:B("Table")});d.registerChaiBlock(Ce,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:m.BorderTopIcon,props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("")}}),blocks:B("TableHead")});d.registerChaiBlock(ke,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:m.BorderAllIcon,props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("")}}),blocks:B("TableBody")});d.registerChaiBlock(Pe,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:m.ViewHorizontalIcon,props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("")}}),blocks:B("TableRow")});d.registerChaiBlock(Be,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:m.DragHandleHorizontalIcon,props:a.registerChaiBlockProps({properties:{styles:a.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 o=(i,n)=>({_id:P.generateUUID(),_parent:i,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+n}`}),t=i=>{const n=P.generateUUID(),c={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return i&&(c._parent=i),[c,o(n,"1"),o(n,"2"),o(n,"3")]},l=i=>{const n=P.generateUUID(),c={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return i&&(c._parent=i),[c,...t(n)]},s=i=>{const n=P.generateUUID(),c={_id:n,_type:"TableBody",styles:"#styles:,"};return i&&(c._parent=i),[c,...t(n),...t(n)]};if(e==="Table"){const i=P.generateUUID();return[{_id:i,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...l(i),...s(i)]}return e==="TableRow"?t():e==="TableHead"?l():e==="TableBody"?s():[]}const we="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",ve=e=>{const{blockProps:o,image:t,mobileImage:l,styles:s,alt:i,height:n,width:c,lazyLoading:p,mobileWidth:g,mobileHeight:y}=e;return u.isEmpty(t)?r.jsx(k,{className:"h-36"}):r.jsxs("picture",{children:[l&&r.jsx("source",{srcSet:l,media:"(max-width: 480px)",width:g,height:y}),r.jsx("img",{...o,...s,src:t,alt:i,loading:p?"lazy":"eager",width:c,height:n})]})},Ie={type:"Image",description:"A image component",label:"Image",category:"core",icon:m.ImageIcon,group:"media",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("w-full h-full object-cover"),image:{type:"string",title:"Image",default:we,ui:{"ui:widget":"image"}},width:{type:"string",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"string",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"string",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"string",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},je=e=>{const{blockProps:o,link:t,children:l,styles:s,inBuilder:i,content:n}=e;let c={};return!l&&u.isEmpty(n)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),i?l?r.jsx("span",{role:"link",...o,style:c,...s,children:l}):x.createElement("span",{...o,...s,style:c,role:"link"},n):l?r.jsx("a",{"aria-label":n,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:l}):x.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":n},n)},Le={type:"Link",description:"A link component",label:"Link",category:"core",icon:m.Link1Icon,group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("block"),content:{type:"string",default:"Link text 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"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content","link"],canAcceptBlock:e=>e!=="Link"},Se=e=>{const{blockProps:o,children:t,styles:l,tag:s,inBuilder:i}=e;return!t&&u.isEmpty(l==null?void 0:l.className)?r.jsx(k,{inBuilder:i}):b.createElement(s||"ul",{...o,...l},t)},_e={type:"List",description:"A list component",label:"List",icon:m.RowsIcon,category:"core",group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",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"}]},Ne=e=>{const{blockProps:o,content:t,styles:l,children:s,tag:i}=e;return s?b.createElement(i||"li",{...l,...o},s):b.createElement(i||"li",{...l,...o,dangerouslySetInnerHTML:{__html:t}})},Te={type:"ListItem",description:"A list item component",label:"List Item",icon:m.ColumnsIcon,category:"core",group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.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"},Ee=e=>{const{blockProps:o,styles:t,content:l}=e;if(!u.isNull(e.children))return b.createElement("p",{...t,...o},e.children);const s=I(t,"rte");return b.createElement("div",{...s,...o,dangerouslySetInnerHTML:{__html:l}})},Re={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:m.TextIcon,group:"typography",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),content:{type:"string",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.",ui:{"ui:widget":"richtext","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},Ae=e=>{const{blockProps:o,content:t,styles:l}=e,s=I(l,"rte");return r.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},Me={type:"RichText",description:"A rich text block",label:"Rich Text",hidden:!0,category:"core",icon:m.CursorTextIcon,group:"typography",props:a.registerChaiBlockProps({properties:{styles:a.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"]},He=e=>{const{blockProps:o,styles:t,content:l,children:s=null,tag:i}=e;return s?b.createElement("span",{...t,...o},s):b.createElement(i||"span",{...t,...o,dangerouslySetInnerHTML:{__html:l||""}})},$e={type:"Span",description:"A span component",label:"Span",category:"core",group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},De=e=>e.inBuilder||e.forceWrapper?r.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,Ve={type:"Text",description:"A text component with no styling",label:"Text",category:"core",group:"typography",blocks:()=>[{_id:"a",_type:"Text",_name:"Text",content:""}],icon:m.SpaceBetweenVerticallyIcon,props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},v={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}}},j=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,L=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=u.get(o,"autoplay",!1),l=u.get(o,"controls",!1),s=u.get(o,"loop",!1),i=t||u.get(o,"muted",!0);if(j.test(e)){const n=e.match(j);if(n){const c=n[4],p=`https://www.youtube.com/embed/${c}`,g=[];return t&&g.push("autoplay=1"),s&&g.push("loop=1",`playlist=${c}`),i&&g.push("mute=1","muted=1"),g.push(l?"controls=1":"controls=0"),`${p}?${g.join("&")}`}}if(L.test(e)){const n=e.match(L);if(n){const c=n[1],p=[];return t&&p.push("autoplay=1"),p.push(l?"controls=1":"controls=0"),i&&p.push("muted=1"),s&&p.push("loop=1"),`https://player.vimeo.com/video/${c}?${p.join("&")}`}}return null},Fe=e=>{const{url:o,blockProps:t,styles:l,controls:s,videoSource:i,inBuilder:n,title:c}=e,p=ze(o,s);return r.jsxs("div",{...u.omit(l,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!p&&n?r.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:u.isEmpty(o)?`Provided ${i} video link in settings Video URL.`:`Provided ${i} video link is invalid.`}):r.jsx("iframe",{className:`absolute left-0 top-0 h-full w-full ${u.pick(l,"className").className||""}`,src:p??"",title:c||"Video player",loading:"lazy",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0}),n&&r.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Ue=e=>{const{url:o,styles:t,controls:l,sources:s,poster:i,blockProps:n,title:c}=e;let p=i;const g=[...u.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&g.push({url:o,width:9999});const y=g.sort((f,h)=>f.width-h.width).filter(f=>!u.isEmpty(f.url)&&!u.isEmpty(f.width));y.length===0&&!p&&(p="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const C=u.get(l,"autoplay",!1)||u.get(l,"muted",!0);return(p||!u.isEmpty(y))&&r.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...n,title:c||"Video player",key:JSON.stringify(y),controls:u.get(l,"controls",!1),autoPlay:u.get(l,"autoplay",!1),loop:u.get(l,"loop",!1),poster:p,...C?{muted:!0}:{}},y.map(f=>{if(!f.url||f.url.length<4||isNaN(f.width))return null;const h=`(max-width: ${f.width}px)`;return r.jsx("source",{src:f.url,media:h,type:f.type},f.url)}),"Your browser does not support the video tag.")})},qe=e=>{const{videoSource:o}=e;return o==="Custom"?r.jsx(Ue,{...e}):o==="Youtube"||o==="Vimeo"?r.jsx(Fe,{...e}):r.jsxs("div",{children:["Invalid video source : ",o]})},Oe={type:"Video",label:"Video",category:"core",icon:m.VideoIcon,group:"media",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"},title:{type:"string",title:"Video Title",default:"Video player"}},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:{...v}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...v}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...v}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url","title"]},Ze=e=>{const{paginationStyles:o}=e,t=d.getRegisteredChaiBlock("Pagination");return r.jsx("div",{...o,children:t?b.createElement(t.component,{...u.omit(e,["paginationStyles"]),blockProps:{}}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",disabled:!0,children:r.jsx(m.ChevronLeftIcon,{className:"h-4 w-4"})}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-blue-500 bg-blue-500 font-medium text-white",children:"1"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"2"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"3"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"4"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"5"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50",children:r.jsx(m.ChevronRightIcon,{className:"h-4 w-4"})})]})})},Ge=e=>{const{children:o,tag:t,styles:l,blockProps:s,$loading:i}=e,{pagination:n,inBuilder:c}=e;let p=o;return u.isEmpty(p)&&c&&(p=r.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?i&&c?Array.from({length:2}).map((g,y)=>r.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[r.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),r.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},y)):p:r.jsxs(r.Fragment,{children:[b.createElement(t,{...s,...l},i&&c?Array.from({length:2}).map((g,y)=>r.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[r.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),r.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},y)):p),n&&r.jsx(Ze,{...u.pick(e,["limit","totalItems","paginationStrategy","inBuilder","draft","lang","paginationStyles"])})]})},We={type:"Repeater",label:"Repeater",icon:m.LoopIcon,group:"basic",description:"Repeater block is used to display a list of items based on data binding in repeaterItems",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),paginationStyles:a.stylesProp("flex items-center justify-center gap-2 p-4"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},pagination:{title:"Pagination",type:"boolean",default:!1}},allOf:[{if:{properties:{pagination:{const:!0}}},then:{properties:{paginationStrategy:{type:"string",title:"Pagination Strategy",default:"segment",enum:["query","segment"]},limit:{type:"number",title:"Items Per Page",default:10,minimum:1}}}},{if:{properties:{pagination:{const:!1}}},then:{properties:{limit:{type:"number",title:"Max items",default:10,minimum:1}}}}]}),canAcceptBlock:e=>e==="Pagination"},Ye=({children:e,blockProps:o,styles:t,parentTag:l,inBuilder:s})=>{let i="li";switch(l){case"ul":i="li";break;case"ol":i="li";break;default:i="div"}return!e&&s?b.createElement(i,{...o,...t},r.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):b.createElement(i,{...o,...t},e)},Qe={type:"RepeaterItem",label:"Repeater Item",icon:m.LoopIcon,hidden:!0,group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp(""),parentTag:d.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Je=({children:e,blockProps:o,styles:t})=>b.createElement("div",{...o,...t},e),Xe={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",props:a.registerChaiBlockProps({properties:{styles:a.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Ke=()=>{d.registerChaiBlock(_,N),d.registerChaiBlock(Q,J),d.registerChaiBlock(T,E),d.registerChaiBlock(ge,he),d.registerChaiBlock(Ee,Re),d.registerChaiBlock(He,$e),d.registerChaiBlock(Ae,Me),d.registerChaiBlock(je,Le),d.registerChaiBlock(Se,_e),d.registerChaiBlock(Ne,Te),d.registerChaiBlock(V,z),d.registerChaiBlock(ve,Ie),d.registerChaiBlock(qe,Oe),d.registerChaiBlock(R,A),d.registerChaiBlock(M,H),d.registerChaiBlock(De,Ve),d.registerChaiBlock(ee,te),d.registerChaiBlock(oe,le),d.registerChaiBlock(se,ie),d.registerChaiBlock(X,K),d.registerChaiBlock(ce,pe),d.registerChaiBlock(de,ue),d.registerChaiBlock(me,ye),d.registerChaiBlock(ae,ne),d.registerChaiBlock(be,fe),d.registerChaiBlock(W,Y),d.registerChaiBlock($,D),d.registerChaiBlock(F,U),d.registerChaiBlock(Z,G),d.registerChaiBlock(q,O),d.registerChaiBlock(Ge,We),d.registerChaiBlock(Ye,Qe),d.registerChaiBlock(Je,Xe)};exports.loadWebBlocks=Ke;
|
package/dist/web-blocks.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isEmpty as w, get as C, map as T, isNull as F, omit as E, pick as M } from "lodash-es";
|
|
2
2
|
import { jsx as i, jsxs as h, Fragment as S } from "react/jsx-runtime";
|
|
3
3
|
import { registerChaiBlockProps as u, stylesProp as p } from "./runtime.js";
|
|
4
|
-
import { c as
|
|
4
|
+
import { c as N, g as I } from "./common-functions-D2lMFR6K.js";
|
|
5
5
|
import * as b from "react";
|
|
6
6
|
import { createElement as x } from "react";
|
|
7
7
|
import { ButtonIcon as H, CodeIcon as $, FrameIcon as j, SketchLogoIcon as U, RowsIcon as D, LayoutIcon as Z, DividerHorizontalIcon as q, CheckboxIcon as G, FileTextIcon as W, InputIcon as V, LetterCaseToggleIcon as O, RadiobuttonIcon as Y, DropdownMenuIcon as Q, HeadingIcon as J, TableIcon as X, BorderTopIcon as K, BorderAllIcon as ee, ViewHorizontalIcon as te, DragHandleHorizontalIcon as oe, ImageIcon as le, Link1Icon as re, ColumnsIcon as ne, TextIcon as ie, CursorTextIcon as ae, SpaceBetweenVerticallyIcon as se, VideoIcon as ce, ChevronLeftIcon as pe, ChevronRightIcon as de, LoopIcon as z } from "@radix-ui/react-icons";
|
|
8
8
|
import { r as d, e as ue, c as me } from "./core-QlWEXm1d.js";
|
|
9
|
-
const v = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ i("div", { className:
|
|
9
|
+
const v = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ i("div", { className: N("pointer-events-none flex h-20 flex-col items-center justify-center p-2", e), children: /* @__PURE__ */ i("div", { className: "h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800", children: /* @__PURE__ */ i("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: a } = e;
|
|
11
11
|
let s = r;
|
|
12
12
|
r || (s = /* @__PURE__ */ i(v, { inBuilder: t }));
|
|
@@ -165,7 +165,7 @@ const v = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ i("div",
|
|
|
165
165
|
i18nProps: ["htmlCode"]
|
|
166
166
|
}, ke = (e) => {
|
|
167
167
|
const { scripts: o, inBuilder: t, blockProps: l } = e;
|
|
168
|
-
return t ? /* @__PURE__ */ i("div", { ...l, children: /* @__PURE__ */ i("div", { className:
|
|
168
|
+
return t ? /* @__PURE__ */ i("div", { ...l, children: /* @__PURE__ */ i("div", { className: N("pointer-events-none flex flex-col items-center justify-center p-2", ""), children: /* @__PURE__ */ i("div", { className: "h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800", children: /* @__PURE__ */ i("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" }) }) }) }) : /* @__PURE__ */ i("div", { dangerouslySetInnerHTML: { __html: o } });
|
|
169
169
|
}, xe = {
|
|
170
170
|
type: "CustomScript",
|
|
171
171
|
description: "similar to a script element in HTML",
|
|
@@ -219,11 +219,11 @@ const v = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ i("div",
|
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
})
|
|
222
|
-
},
|
|
222
|
+
}, _ = (e, ...o) => ({
|
|
223
223
|
...e,
|
|
224
|
-
className:
|
|
224
|
+
className: N(e.className, ...o)
|
|
225
225
|
}), Ie = (e) => {
|
|
226
|
-
const { blockProps: o, icon: t, styles: l, width: r, inBuilder: n, height: a } = e, s =
|
|
226
|
+
const { blockProps: o, icon: t, styles: l, width: r, inBuilder: n, height: a } = e, s = _(l, "");
|
|
227
227
|
if (w(t))
|
|
228
228
|
return /* @__PURE__ */ i(v, { inBuilder: n, className: "h-8 w-14" });
|
|
229
229
|
const c = t.replace(/<svg /g, '<svg class="w-[inherit] h-[inherit]" ');
|
|
@@ -349,7 +349,7 @@ const v = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ i("div",
|
|
|
349
349
|
a ? C(L, ["LARGE", n || r], "") : ""
|
|
350
350
|
].join(" ") };
|
|
351
351
|
return /* @__PURE__ */ i("div", { ...o, ...l, ...c, children: t || /* @__PURE__ */ i("div", { className: "h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900" }) });
|
|
352
|
-
},
|
|
352
|
+
}, Ne = {
|
|
353
353
|
type: "Column",
|
|
354
354
|
description: "A column component",
|
|
355
355
|
label: "Column",
|
|
@@ -386,7 +386,7 @@ const v = ({ className: e = "", inBuilder: o }) => o ? /* @__PURE__ */ i("div",
|
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
})
|
|
389
|
-
},
|
|
389
|
+
}, _e = (e) => {
|
|
390
390
|
const { blockProps: o, children: t, styles: l, gutter: r } = e, a = { className: [C(l, "className", ""), " grid grid-cols-12"].join() };
|
|
391
391
|
return typeof (l == null ? void 0 : l.style) == "object" && l.style !== null ? a.style = { ...l.style, gap: `${r}px` } : a.style = { gap: `${r}px` }, /* @__PURE__ */ i("div", { ...o, ...l, ...a, children: t });
|
|
392
392
|
}, Te = {
|
|
@@ -1539,7 +1539,7 @@ const st = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1539
1539
|
}, ft = (e) => {
|
|
1540
1540
|
const { blockProps: o, styles: t, content: l } = e;
|
|
1541
1541
|
if (!F(e.children)) return b.createElement("p", { ...t, ...o }, e.children);
|
|
1542
|
-
const r =
|
|
1542
|
+
const r = _(t, "rte");
|
|
1543
1543
|
return b.createElement("div", {
|
|
1544
1544
|
...r,
|
|
1545
1545
|
...o,
|
|
@@ -1567,7 +1567,7 @@ const st = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1567
1567
|
aiProps: ["content"],
|
|
1568
1568
|
canAcceptBlock: (e) => e === "Span" || e === "Link" || e === "Text"
|
|
1569
1569
|
}, Ct = (e) => {
|
|
1570
|
-
const { blockProps: o, content: t, styles: l } = e, r =
|
|
1570
|
+
const { blockProps: o, content: t, styles: l } = e, r = _(l, "rte");
|
|
1571
1571
|
return /* @__PURE__ */ i("div", { ...o, ...r, dangerouslySetInnerHTML: { __html: t } });
|
|
1572
1572
|
}, kt = {
|
|
1573
1573
|
type: "RichText",
|
|
@@ -1673,24 +1673,32 @@ const st = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1673
1673
|
if (R.test(e)) {
|
|
1674
1674
|
const a = e.match(R);
|
|
1675
1675
|
if (a) {
|
|
1676
|
-
const s = a[4];
|
|
1677
|
-
|
|
1678
|
-
return g += r ? `&loop=1&playlist=${s}` : "", g += n ? "&mute=1&muted=1" : "", g += l ? "&controls=1" : "&controls=0", `${c}?${g}`;
|
|
1676
|
+
const s = a[4], c = `https://www.youtube.com/embed/${s}`, g = [];
|
|
1677
|
+
return t && g.push("autoplay=1"), r && g.push("loop=1", `playlist=${s}`), n && g.push("mute=1", "muted=1"), g.push(l ? "controls=1" : "controls=0"), `${c}?${g.join("&")}`;
|
|
1679
1678
|
}
|
|
1680
1679
|
}
|
|
1681
1680
|
if (A.test(e)) {
|
|
1682
1681
|
const a = e.match(A);
|
|
1683
1682
|
if (a) {
|
|
1684
|
-
const s = a[1];
|
|
1685
|
-
|
|
1686
|
-
return c += t ? "autoplay=1" : "", c += l ? "&controls=1" : "&controls=0", c += n ? "&muted=1" : "", c += r ? "&loop=1" : "", `https://player.vimeo.com/video/${s}?${c}`;
|
|
1683
|
+
const s = a[1], c = [];
|
|
1684
|
+
return t && c.push("autoplay=1"), c.push(l ? "controls=1" : "controls=0"), n && c.push("muted=1"), r && c.push("loop=1"), `https://player.vimeo.com/video/${s}?${c.join("&")}`;
|
|
1687
1685
|
}
|
|
1688
1686
|
}
|
|
1689
1687
|
return null;
|
|
1690
1688
|
}, Lt = (e) => {
|
|
1691
1689
|
const { url: o, blockProps: t, styles: l, controls: r, videoSource: n, inBuilder: a, title: s } = e, c = Pt(o, r);
|
|
1692
1690
|
return /* @__PURE__ */ h("div", { ...E(l, "className"), className: "relative w-full overflow-hidden", style: { paddingBottom: "56.25%" }, children: [
|
|
1693
|
-
!c && a ? /* @__PURE__ */ i("div", { className: "absolute flex h-full w-full items-center justify-center bg-gray-300 text-center", children: w(o) ? `Provided ${n} video link in settings Video URL.` : `Provided ${n} video link is invalid.` }) : /* @__PURE__ */ i(
|
|
1691
|
+
!c && a ? /* @__PURE__ */ i("div", { className: "absolute flex h-full w-full items-center justify-center bg-gray-300 text-center", children: w(o) ? `Provided ${n} video link in settings Video URL.` : `Provided ${n} video link is invalid.` }) : /* @__PURE__ */ i(
|
|
1692
|
+
"iframe",
|
|
1693
|
+
{
|
|
1694
|
+
className: `absolute left-0 top-0 h-full w-full ${M(l, "className").className || ""}`,
|
|
1695
|
+
src: c ?? "",
|
|
1696
|
+
title: s || "Video player",
|
|
1697
|
+
loading: "lazy",
|
|
1698
|
+
allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",
|
|
1699
|
+
allowFullScreen: !0
|
|
1700
|
+
}
|
|
1701
|
+
),
|
|
1694
1702
|
a && /* @__PURE__ */ i("div", { ...t, className: "absolute top-0 h-full w-full" })
|
|
1695
1703
|
] });
|
|
1696
1704
|
}, Bt = (e) => {
|
|
@@ -1727,7 +1735,7 @@ const st = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1727
1735
|
"Invalid video source : ",
|
|
1728
1736
|
o
|
|
1729
1737
|
] });
|
|
1730
|
-
},
|
|
1738
|
+
}, Nt = {
|
|
1731
1739
|
type: "Video",
|
|
1732
1740
|
label: "Video",
|
|
1733
1741
|
category: "core",
|
|
@@ -1817,7 +1825,7 @@ const st = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1817
1825
|
}
|
|
1818
1826
|
}),
|
|
1819
1827
|
i18nProps: ["url", "title"]
|
|
1820
|
-
},
|
|
1828
|
+
}, _t = (e) => {
|
|
1821
1829
|
const { paginationStyles: o } = e, t = ue("Pagination");
|
|
1822
1830
|
return /* @__PURE__ */ i("div", { ...o, children: t ? b.createElement(t.component, { ...E(e, ["paginationStyles"]), blockProps: {} }) : /* @__PURE__ */ h(S, { children: [
|
|
1823
1831
|
/* @__PURE__ */ i(
|
|
@@ -1851,7 +1859,7 @@ const st = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
1851
1859
|
] }, m)) : c
|
|
1852
1860
|
),
|
|
1853
1861
|
a && /* @__PURE__ */ i(
|
|
1854
|
-
|
|
1862
|
+
_t,
|
|
1855
1863
|
{
|
|
1856
1864
|
...M(e, [
|
|
1857
1865
|
"limit",
|
|
@@ -2015,7 +2023,7 @@ const st = "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG
|
|
|
2015
2023
|
canMove: () => !1,
|
|
2016
2024
|
canDuplicate: () => !1
|
|
2017
2025
|
}, Zt = () => {
|
|
2018
|
-
d(ye, ge), d(Ee, Me), d(be, fe), d(Ke, et), d(ft, ht), d(xt, wt), d(Ct, kt), d(dt, ut), d(mt, yt), d(gt, bt), d(Ie, Pe), d(ct, pt), d(St,
|
|
2026
|
+
d(ye, ge), d(Ee, Me), d(be, fe), d(Ke, et), d(ft, ht), d(xt, wt), d(Ct, kt), d(dt, ut), d(mt, yt), d(gt, bt), d(Ie, Pe), d(ct, pt), d(St, Nt), d(he, Ce), d(ke, xe), d(vt, It), d(je, De), d(Ve, ze), d(Ue, Ze), d(He, $e), d(We, Oe), d(Ye, Qe), d(Je, Xe), d(qe, Ge), d(tt, ot), d(Re, Ae), d(we, ve), d(Le, Be), d(_e, Te), d(Se, Ne), d(Tt, Rt), d(At, Et), d(Mt, Ht);
|
|
2019
2027
|
};
|
|
2020
2028
|
export {
|
|
2021
2029
|
Zt as loadWebBlocks
|
|
@@ -4,7 +4,7 @@ import { B as s } from "./register-chai-top-bar-D6GjnauV.js";
|
|
|
4
4
|
import { useAtom as h } from "jotai";
|
|
5
5
|
import { map as p } from "lodash-es";
|
|
6
6
|
import { Smartphone as w, Tablet as f, Laptop as u, LaptopMinimal as x } from "lucide-react";
|
|
7
|
-
import { p as v, T as _ } from "./index-
|
|
7
|
+
import { p as v, T as _ } from "./index-CA1OwKJX.js";
|
|
8
8
|
const b = [
|
|
9
9
|
{
|
|
10
10
|
title: "mobile_xs_title",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-DyW9GPzV.cjs"),u=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("react"),a=require("./register-chai-top-bar-DyW9GPzV.cjs"),u=require("jotai"),x=require("lodash-es"),n=require("lucide-react"),c=require("./index-Bzn_gpaK.cjs"),m=[{title:"mobile_xs_title",content:"mobile_xs_content",icon:e.jsx(n.Smartphone,{className:"h-4 w-4"}),width:400},{title:"tablet_md_title",content:"tablet_md_content",icon:e.jsx(n.Tablet,{className:"h-4 w-4"}),width:800},{title:"desktop_xl_title",content:"desktop_xl_content",icon:e.jsx(n.Laptop,{className:"h-4 w-4"}),width:1200},{title:"large_desktop_2xl_title",content:"large_desktop_2xl_content",icon:e.jsx(n.LaptopMinimal,{className:"h-4 w-4"}),width:1600}],w=({currentWidth:t,width:s,icon:o,setIframeWidth:r})=>e.jsx(a.Button,{className:"px-3 py-3",onClick:()=>r(s),variant:s===t?"default":"ghost",children:o}),p=()=>{const[t,s]=l.useState(1200),o=i=>s(i),[r,d]=u.useAtom(c.previewUrlAtom);if(!r)return null;const h=()=>{d("")};return e.jsxs("div",{className:"absolute inset-0 z-[999999] flex h-screen w-screen flex-col overflow-hidden bg-gray-100",children:[e.jsxs("div",{className:"flex h-[50px] items-center justify-center border-b border-gray-200 px-4 shadow-sm",children:[e.jsx("div",{className:"flex items-center justify-center rounded-md border border-gray-300",children:x.map(m,i=>l.createElement(w,{...i,setIframeWidth:o,key:i.title,currentWidth:t}))})," ",e.jsx(c.Tooltip,{content:"Exit Preview",delayDuration:0,children:e.jsx(a.Button,{variant:"destructive",size:"sm",onClick:h,children:e.jsx("svg",{width:"15",height:"15",viewBox:"0 0 15 15",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:e.jsx("path",{d:"M2 3C2 2.44772 2.44772 2 3 2H12C12.5523 2 13 2.44772 13 3V12C13 12.5523 12.5523 13 12 13H3C2.44772 13 2 12.5523 2 12V3ZM12 3H3V12H12V3Z",fill:"currentColor",fillRule:"evenodd","clip-rule":"evenodd"})})})})]}),e.jsx("iframe",{style:{width:`${t}px`,transition:"width 0.3s ease-in-out"},className:"no-scrollbar mx-auto h-full overflow-y-auto border bg-white",src:r})]})};exports.default=p;
|