@chaibuilder/sdk 2.0.0-beta.52 → 2.0.0-beta.54

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.
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./jsx-runtime-DGh1k5sI.cjs"),k=require("@radix-ui/react-icons"),C=require("@react-hookz/web"),c=require("react"),v=require("react-i18next"),E=require("./context-menu-dsqhw1Ub.cjs"),r=require("./core.cjs"),d=o=>{const s=document.createElement("div");return s.innerHTML=o,s.innerHTML};function R(){const{t:o}=v.useTranslation(),[s,x]=c.useState(!1),[i,m]=c.useState(""),[t,a]=r.useCodeEditor(),[u]=r.useSelectedBlockIds(),p=r.useUpdateBlocksProps(),j=r.useUpdateBlocksPropsRealtime(),b=C.useThrottledCallback(n=>{const l=d(n);j([t.blockId],{[t.blockProp]:l})},[],300),f=c.useCallback(()=>{if(s){const n=d(i);p([t.blockId],{[t.blockProp]:n})}},[s,i]);c.useEffect(()=>{u.includes(t==null?void 0:t.blockId)||(f(),a(null))},[u]);const h=()=>{a(null)};return e.jsxRuntimeExports.jsxs("div",{className:"h-full text-white bg-black border-t-4 border-black rounded-t-lg",children:[e.jsxRuntimeExports.jsx("button",{onClick:h,className:"fixed inset-0 z-[100000] cursor-default bg-gray-400/20"}),e.jsxRuntimeExports.jsxs("div",{className:"relative z-[100001] h-full w-full flex-col gap-y-1",children:[e.jsxRuntimeExports.jsxs("div",{className:"flex items-center justify-between px-2 py-2 -mt-1",children:[e.jsxRuntimeExports.jsxs("h3",{className:"space-x-3 text-sm font-semibold",children:[e.jsxRuntimeExports.jsx("span",{children:o("HTML Code Editor |")}),e.jsxRuntimeExports.jsx("span",{className:"text-xs text-gray-400",children:o("Scripts will be only executed in preview and live mode.")})]}),e.jsxRuntimeExports.jsx("div",{className:"flex gap-x-2",children:e.jsxRuntimeExports.jsx(E.Button,{onClick:()=>a(null),size:"sm",variant:"destructive",className:"h-6 w-fit",children:e.jsxRuntimeExports.jsx(k.Cross2Icon,{})})})]}),e.jsxRuntimeExports.jsx("textarea",{className:"w-full h-full p-2 font-mono text-xs bg-black text-white/90",value:i||t.initialCode,onChange:n=>{const l=n.target.value;x(!0),m(l),b(l)}})]})]})}exports.default=R;
@@ -0,0 +1,67 @@
1
+ import { j as e } from "./jsx-runtime-Dx-03ztt.js";
2
+ import { Cross2Icon as k } from "@radix-ui/react-icons";
3
+ import { useThrottledCallback as C } from "@react-hookz/web";
4
+ import { useState as r, useCallback as v, useEffect as j } from "react";
5
+ import { useTranslation as g } from "react-i18next";
6
+ import { B as N } from "./context-menu-BsI3Hqio.js";
7
+ import { useCodeEditor as w, useSelectedBlockIds as y, useUpdateBlocksProps as T, useUpdateBlocksPropsRealtime as B } from "./core.js";
8
+ const d = (l) => {
9
+ const s = document.createElement("div");
10
+ return s.innerHTML = l, s.innerHTML;
11
+ };
12
+ function R() {
13
+ const { t: l } = g(), [s, u] = r(!1), [a, m] = r(""), [t, c] = w(), [i] = y(), x = T(), f = B(), p = C(
14
+ (o) => {
15
+ const n = d(o);
16
+ f([t.blockId], { [t.blockProp]: n });
17
+ },
18
+ [],
19
+ 300
20
+ ), h = v(() => {
21
+ if (s) {
22
+ const o = d(a);
23
+ x([t.blockId], { [t.blockProp]: o });
24
+ }
25
+ }, [s, a]);
26
+ j(() => {
27
+ i.includes(t == null ? void 0 : t.blockId) || (h(), c(null));
28
+ }, [i]);
29
+ const b = () => {
30
+ c(null);
31
+ };
32
+ return /* @__PURE__ */ e.jsxs("div", { className: "h-full text-white bg-black border-t-4 border-black rounded-t-lg", children: [
33
+ /* @__PURE__ */ e.jsx("button", { onClick: b, className: "fixed inset-0 z-[100000] cursor-default bg-gray-400/20" }),
34
+ /* @__PURE__ */ e.jsxs("div", { className: "relative z-[100001] h-full w-full flex-col gap-y-1", children: [
35
+ /* @__PURE__ */ e.jsxs("div", { className: "flex items-center justify-between px-2 py-2 -mt-1", children: [
36
+ /* @__PURE__ */ e.jsxs("h3", { className: "space-x-3 text-sm font-semibold", children: [
37
+ /* @__PURE__ */ e.jsx("span", { children: l("HTML Code Editor |") }),
38
+ /* @__PURE__ */ e.jsx("span", { className: "text-xs text-gray-400", children: l("Scripts will be only executed in preview and live mode.") })
39
+ ] }),
40
+ /* @__PURE__ */ e.jsx("div", { className: "flex gap-x-2", children: /* @__PURE__ */ e.jsx(
41
+ N,
42
+ {
43
+ onClick: () => c(null),
44
+ size: "sm",
45
+ variant: "destructive",
46
+ className: "h-6 w-fit",
47
+ children: /* @__PURE__ */ e.jsx(k, {})
48
+ }
49
+ ) })
50
+ ] }),
51
+ /* @__PURE__ */ e.jsx(
52
+ "textarea",
53
+ {
54
+ className: "w-full h-full p-2 font-mono text-xs bg-black text-white/90",
55
+ value: a || t.initialCode,
56
+ onChange: (o) => {
57
+ const n = o.target.value;
58
+ u(!0), m(n), p(n);
59
+ }
60
+ }
61
+ )
62
+ ] })
63
+ ] });
64
+ }
65
+ export {
66
+ R as default
67
+ };
package/dist/core.cjs CHANGED
@@ -58,7 +58,7 @@
58
58
  outline: 1px solid ${x.length===1?"#42a1fc !important":"orange !important"}; outline-offset: -1px;
59
59
  }`)},[x,O]),React.useEffect(()=>{z.textContent=R?`[data-block-id="${R._id}"], [data-block-id="${R._id}"] > * { pointer-events: none !important; opacity: 0.6 !important}`:""},[R,z]),React.useEffect(()=>{T&&(T.textContent='[data-highlighted="true"]{ outline: 1px solid #42a1fc !important; outline-offset: -1px;}')},[T]),React.useEffect(()=>{N&&(N.textContent=`${lodashEs.map(v,({id:Y})=>`[data-style-id="${Y}"]`).join(",")}{
60
60
  outline: 1px solid orange !important; outline-offset: -1px;
61
- }`)},[v,N]),React.useEffect(()=>{j.querySelector("#drop-target-block").innerHTML=A?`[data-block-id="${A}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}`:""},[A,j]);const Z=React.useMemo(()=>ChaiThemeFn.getChaiThemeCssVariables(r),[r]),q=React.useMemo(()=>ChaiThemeFn.getThemeFontsLinkMarkup(lodashEs.pick(r,["fontFamily"])),[r]);return jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("style",{id:"chai-theme",children:Z}),jsxRuntime.jsxRuntimeExports.jsx("span",{id:"chai-fonts",dangerouslySetInnerHTML:{__html:q}})]})},ResizableCanvasWrapper=({children:r,onMount:h,onResize:x})=>{const[,g]=useSelectedBlockIds(),[,v]=useSelectedStylingBlocks(),R=React.useRef(null),A=web.useDebouncedCallback(()=>{const{clientWidth:C}=R.current;x(C)},[R.current],100);web.useResizeObserver(R.current,A,R.current!==null),React.useEffect(()=>{const{clientWidth:C}=R.current;h(C)},[]);const j=()=>{g([]),v([])};return jsxRuntime.jsxRuntimeExports.jsx("div",{id:"main-content",onClick:j,className:"h-full w-full p-8 pb-0",ref:R,children:r})};function AsyncPropsBlock(r){const{dataProvider:h,block:x}=r,g=React.useMemo(()=>h?h(x,r.lang):{},[x,h,r.lang]);return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(r.component,{...r.props,...g})})}function RuntimePropsBlock(r){const h=useSelectedBlockHierarchy(),x=Object.entries(r.runtimeProps).reduce((g,[v,R])=>{const A=lodashEs.find(h,{_type:R.block});return A&&(g[v]=lodashEs.get(A,R.prop)),g},{});return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(r.component,{...r.props,...x})})}const useChaiExternalData=()=>jotai.useAtom(chaiExternalDataAtom),generateClassNames=lodashEs.memoize(r=>{const h=r.replace(STRINGS.STYLES_KEY,"").split(",");return tailwindMerge.twMerge(h[0],h[1])});function getElementAttrs(r,h){return lodashEs.get(r,`${h}_attrs`,{})}function getStyleAttrs(r){const h={};return Object.keys(r).forEach(x=>{if(lodashEs.isString(r[x])&&r[x].startsWith(STRINGS.STYLES_KEY)){const g=generateClassNames(r[x]),v=getElementAttrs(r,x);h[x]={className:g,"data-style-prop":x,"data-block-parent":r._id,"data-style-id":`${x}-${r._id}`,...v}}}),h}function applyBindings(r,h){const x=lodashEs.get(r,"_bindings",{});return lodashEs.isEmpty(x)?{...r}:(lodashEs.each(x,(g,v)=>{lodashEs.isString(g)&&lodashEs.get(h,g,null)&&(r[v]=lodashEs.get(h,g,null))}),r)}const getRuntimeProps=lodashEs.memoize(r=>{const h=runtime.getRegisteredChaiBlock(r),x=lodashEs.get(h,"schema.properties",{});return Object.fromEntries(Object.entries(x).filter(([,g])=>lodashEs.get(g,"runtime",!1)))});function isDescendant(r,h,x){if(!lodashEs.find(x,{_id:r}))return!1;const v=lodashEs.filter(x,{_parent:r});return v.some(R=>R._id===h)?!0:v.some(R=>isDescendant(R._id,h,x))}const RenderGlobalBlock=({blocks:r,allBlocks:h})=>jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{allBlocks:h,blocks:r});function applyLanguage(r,h,x){if(lodashEs.isEmpty(h))return r;const g=lodashEs.cloneDeep(r);return lodashEs.forEach(lodashEs.keys(g),v=>{lodashEs.includes(lodashEs.get(x,"i18nProps",[]),v)&&!lodashEs.isEmpty(h)&&(g[v]=lodashEs.get(g,`${v}-${h}`,g[v]))}),g}function BlocksRendererStatic({blocks:r,allBlocks:h}){const{selectedLang:x}=useLanguages(),[g]=useCutBlockIds(),[v]=jotai.useAtom(draggedBlockAtom),[R]=jotai.useAtom(dropTargetBlockIdAtom),[A]=useHiddenBlockIds(),{getGlobalBlocks:j}=useGlobalBlocksStore(),C=React.useCallback(N=>getStyleAttrs(N),[]),[T]=useChaiExternalData(),[O]=jotai.useAtom(inlineEditingActiveAtom);return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:React.Children.toArray(r.map((N,z)=>{if(O===N._id||A.includes(N._id))return null;const Z={},q=lodashEs.filter(h,{_parent:N._id});if(Z.children=q.length>0?jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{allBlocks:h,blocks:q}):null,N._type==="GlobalBlock"){const pe=j(N);Z.children=jsxRuntime.jsxRuntimeExports.jsx(RenderGlobalBlock,{blocks:lodashEs.filter(pe,ve=>!ve._parent),allBlocks:pe})}const Y=runtime.getRegisteredChaiBlock(N._type),P=lodashEs.get(Y,"component",null);if(lodashEs.isNull(P))return jsxRuntime.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${N==null?void 0:N._type} not registered -->`});const he=C(N),te=v&&isDescendant(v._id,N._id,h),X={blockProps:{"data-block-id":N._id,"data-block-type":N._type,...v?{"data-dnd":canAcceptChildBlock(N._type,v==null?void 0:v._type)?"yes":"no","data-dnd-dragged":v._id===N._id||te?"yes":"no"}:{},...R===N._id&&!te?{"data-drop":"yes"}:{},...lodashEs.includes(g,N._id)?{"data-cut-block":"yes"}:{}},index:z,...applyBindings(applyLanguage(N,x,Y),T),...he,...Z,inBuilder:!0,lang:x};if(lodashEs.has(Y,"dataProvider"))return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:jsxRuntime.jsxRuntimeExports.jsx(AsyncPropsBlock,{lang:x,dataProvider:Y.dataProvider,block:N,component:P,props:X})});const oe=getRuntimeProps(N._type);return oe?jsxRuntime.jsxRuntimeExports.jsx(RuntimePropsBlock,{runtimeProps:oe,block:N,component:P,props:X},N._id):jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(P,X)})}))})}const StaticBlocksRenderer=()=>{const[r]=useBlocksStore(),h=lodashEs.isEmpty(r)?null:jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{allBlocks:r,blocks:lodashEs.filter(r,x=>lodashEs.isEmpty(x._parent))});return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:h})},useCanvasScale=r=>{const[h]=useCanvasWidth(),[,x]=useCanvasZoom(),g=useBuilderProp("htmlDir","ltr"),[v,R]=React.useState({}),A=React.useCallback(()=>{const{width:j,height:C}=r;if(j<h){const T=parseFloat((j/h).toFixed(2).toString());let O={};const N=C*T,z=j*T;C&&(O={height:100+(C-N)/N*100+"%",width:100+(j-z)/z*100+"%"}),R({position:"relative",top:0,transform:`scale(${T})`,transformOrigin:g==="rtl"?"top right":"top left",...O,maxWidth:"none"}),x(T*100)}else R({}),x(100)},[h,r,g,x]);return React.useEffect(()=>{A()},[h,r,x,A]),v},getElementByStyleId=(r,h)=>r.querySelector(`[data-style-id="${h}"]`),StaticCanvas=()=>{const[r]=jotai.useAtom(networkModeAtom),[h]=useCanvasWidth(),[,x]=useSelectedBlockIds(),g=useSelectedBlock(),[,v]=useHighlightBlockId(),R=React.useRef(null),A=React.useRef(null),[j,C]=React.useState({width:0,height:0}),T=useCanvasScale(j),[O,N]=React.useState([]),[,z]=React.useState([]),[,Z]=jotai.useAtom(canvasIframeAtom),[q,Y]=useSelectedStylingBlocks(),P=useBuilderProp("loading",!1),he=useBuilderProp("htmlDir","ltr"),te=oe=>{C(pe=>({...pe,width:oe}))};React.useEffect(()=>{if(!A.current)return;const{clientWidth:oe,clientHeight:pe}=A.current;C({width:oe,height:pe})},[A,h]);const ue=(oe,pe=0)=>{const{top:ve}=oe.getBoundingClientRect();return ve+pe>=0&&ve-pe<=window.innerHeight};React.useEffect(()=>{var oe,pe;if(g&&g.type!=="Multiple"&&R.current){const ve=getElementByDataBlockId(R.current.contentDocument,g._id);ve&&(ue(ve)||(pe=(oe=R.current)==null?void 0:oe.contentWindow)==null||pe.scrollTo({top:ve.offsetTop,behavior:"smooth"}),N([ve]))}},[g]),React.useEffect(()=>{if(!lodashEs.isEmpty(q)&&R.current){const oe=getElementByStyleId(R.current.contentDocument,lodashEs.first(q).id);z(oe?[oe]:[null])}else z([null])},[q]);const X=React.useMemo(()=>{let oe=IframeInitialContent;return oe=oe.replace("__HTML_DIR__",he),r==="offline"&&(oe=oe.replace("https://chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js")),oe},[r,he]);return jsxRuntime.jsxRuntimeExports.jsx(ResizableCanvasWrapper,{onMount:te,onResize:te,children:jsxRuntime.jsxRuntimeExports.jsx("div",{onClick:()=>{x([]),Y([])},onMouseLeave:()=>setTimeout(()=>v(""),300),className:"relative mx-auto h-full w-full overflow-hidden",ref:A,children:jsxRuntime.jsxRuntimeExports.jsxs(ChaiFrame,{contentDidMount:()=>Z(R.current),ref:R,id:"canvas-iframe",style:{...T,...lodashEs.isEmpty(T)?{width:`${h}px`}:{}},className:"relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:X,children:[jsxRuntime.jsxRuntimeExports.jsx(KeyboardHandler,{}),jsxRuntime.jsxRuntimeExports.jsx(BlockFloatingSelector,{block:g,selectedBlockElement:lodashEs.first(O)}),jsxRuntime.jsxRuntimeExports.jsx(HeadTags,{}),jsxRuntime.jsxRuntimeExports.jsx(reactWrapBalancer.Provider,{children:jsxRuntime.jsxRuntimeExports.jsxs(Canvas,{children:[P?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"})}):jsxRuntime.jsxRuntimeExports.jsx(StaticBlocksRenderer,{}),jsxRuntime.jsxRuntimeExports.jsx(AddBlockAtBottom,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})}),jsxRuntime.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})})},FallbackError=()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),jsxRuntime.jsxRuntimeExports.jsx("p",{children:"Please try again."})]})}),TypeIcon=r=>{switch(r.type){case"GlobalBlock":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.GlobeIcon,{className:"h-3 w-3 stroke-[2]"});case"Image":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ImageIcon,{className:"h-3 w-3 stroke-[2]"});case"Heading":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.HeadingIcon,{className:"h-3 w-3 stroke-[2]"});case"Text":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{className:"h-3 w-3 stroke-[2]"});case"Link":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Link1Icon,{className:"h-3 w-3 stroke-[2]"});case"Video":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.VideoIcon,{className:"h-3 w-3 stroke-[2]"});case"RichText":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CursorTextIcon,{className:"h-3 w-3 stroke-[2]"});case"Button":case"DropdownButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{className:"h-3 w-3 stroke-[2]"});case"CustomHTML":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CodeIcon,{className:"h-3 w-3 stroke-[2]"});case"Divider":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DividerHorizontalIcon,{className:"h-3 w-3 stroke-[2]"});case"Icon":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SketchLogoIcon,{className:"h-3 w-3 stroke-[2]"});case"List":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{className:"h-3 w-3 stroke-[2]"});case"Paragraph":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{className:"h-3 w-3 stroke-[2]"});case"Row":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Rows,{className:"h-3 w-3 stroke-[2]"});case"Column":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Columns,{className:"h-3 w-3 stroke-[2]"});case"ListItem":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ColumnsIcon,{className:"h-3 w-3 stroke-[2]"});case"LineBreak":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SpaceBetweenVerticallyIcon,{className:"h-3 w-3 stroke-[2]"});case"Form":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.GroupIcon,{className:"h-3 w-3 stroke-[2]"});case"Checkbox":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckboxIcon,{className:"h-3 w-3 stroke-[2]"});case"FormButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{className:"h-3 w-3 stroke-[2]"});case"Input":case"TextArea":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InputIcon,{className:"h-3 w-3 stroke-[2]"});case"Radio":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RadiobuttonIcon,{className:"h-3 w-3 stroke-[2]"});case"Select":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{className:"h-3 w-3 stroke-[2]"});case"Table":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TableIcon,{className:"h-3 w-3 stroke-[2]"});case"TableHead":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderTopIcon,{className:"h-3 w-3 stroke-[2]"});case"TableBody":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderAllIcon,{className:"h-3 w-3 stroke-[2]"});case"TableRow":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ViewHorizontalIcon,{className:"h-3 w-3 stroke-[2]"});case"TableCell":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DragHandleHorizontalIcon,{className:"h-3 w-3 stroke-[2]"});case"DataProvider":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.DatabaseIcon,{className:"h-3 w-3 stroke-[2]"});case"Box":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxIcon,{className:"h-3 w-3 stroke-[2]"});case"Dropdown":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{className:"h-3 w-3 stroke-[2]"});case"DropdownContent":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ReaderIcon,{className:"h-3 w-3 stroke-[2]"});default:return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxModelIcon,{className:"h-3 w-3 stroke-[2]"})}},Breadcrumb=()=>{const r=useSelectedBlockHierarchy(),[,h]=useSelectedBlockIds(),{highlightBlock:x}=useBlockHighlight();return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground",children:jsxRuntime.jsxRuntimeExports.jsxs("ol",{className:"flex items-center whitespace-nowrap",children:[jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>h([]),variant:"ghost",className:"h-fit p-1 text-xs font-normal",children:"Body"}),jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{className:"rtl:rotate-180",size:16})]}),lodashEs.reverse(r).map((g,v)=>jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{onMouseEnter:()=>{x(g==null?void 0:g._id)},onClick:()=>h([g==null?void 0:g._id]),variant:"ghost",className:"h-fit gap-x-1 p-1 text-xs font-normal",children:[jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:g==null?void 0:g._type}),g._name||g._type]}),v!==r.length-1&&jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{className:"rtl:rotate-180",size:16})]},v))]})})},CodeEditor$1=React.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-C5hkhszC.cjs"))),CanvasArea=()=>{const[r]=useCodeEditor(),h=useBuilderProp("onError",lodashEs.noop);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-full flex-1 flex-col",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:h,children:jsxRuntime.jsxRuntimeExports.jsx(StaticCanvas,{})})}),r?jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reResizable.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:jsxRuntime.jsxRuntimeExports.jsx(CodeEditor$1,{})})}):null,jsxRuntime.jsxRuntimeExports.jsx(Breadcrumb,{})]})})},FONTS=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],FontSelector=({label:r,value:h,onChange:x})=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-0.5",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:lodashEs.startCase(r)}),jsxRuntime.jsxRuntimeExports.jsx("select",{className:"mt-1 w-full cursor-pointer rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",value:h,onChange:g=>x(g.target.value),children:FONTS.map(g=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:g.value,children:g.title},g.value))})]}),ColorPickerInput=({value:r,onChange:h})=>{const x=lodashEs.debounce(g=>h(g),200);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative flex h-6 w-6 cursor-pointer rounded-lg border border-border",style:{backgroundColor:r},children:jsxRuntime.jsxRuntimeExports.jsx("input",{type:"color",value:r.startsWith("#")?r:"#000000",onChange:g=>{const v=g.target.value;/^#[0-9A-F]{6}$/i.test(v)&&x(v)},className:"absolute inset-0 h-full w-full cursor-pointer rounded-lg border-0 opacity-0"})})},BorderRadiusInput=({value:r,onChange:h,disabled:x})=>{const g=lodashEs.debounce(v=>h(v),200);return jsxRuntime.jsxRuntimeExports.jsx("input",{type:"range",min:"0",step:"1",max:"30",disabled:x,defaultValue:r.replace("px",""),onChange:v=>g(v.target.value),className:"flex-1 cursor-pointer"})},ThemeConfigPanel=React__namespace.memo(({className:r=""})=>{const[h]=useDarkMode(),[x,g]=React__namespace.useState(""),v=useBuilderProp("themePresets",[]),[R,A]=useTheme(),j=useThemeOptions(),{t:C}=reactI18next.useTranslation(),T=Y=>{g(Y)},O=()=>{const Y=v.find(P=>Object.keys(P)[0]===x);if(Y){const P=Object.values(Y)[0];P&&typeof P=="object"&&"fontFamily"in P&&"borderRadius"in P&&"colors"in P?A(P):console.error("Invalid preset structure:",P)}else console.error("Preset not found:",x)},N=web.useDebouncedCallback((Y,P)=>{A(()=>({...R,fontFamily:{...R.fontFamily,[Y.replace(/font-/g,"")]:P}}))},[R],200),z=web.useDebouncedCallback(Y=>{A(()=>({...R,borderRadius:`${Y}px`}))},[R],200),Z=web.useDebouncedCallback((Y,P)=>{A(()=>{const he=lodashEs.get(R,`colors.${Y}`);return h?lodashEs.set(he,1,P):lodashEs.set(he,0,P),{...R,colors:{...R.colors,[Y]:he}}})},[R],200),q=Y=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-1",children:Object.entries(Y.items).map(([P])=>{const he=lodashEs.get(R,`colors.${P}.${h?1:0}`);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(ColorPickerInput,{value:he,onChange:te=>Z(P,te)}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-xs font-normal leading-tight text-slate-600",children:P.split(/(?=[A-Z])/).join(" ").replace(/-/g," ").split(" ").map(te=>te.charAt(0).toUpperCase()+te.slice(1)).join(" ")+(!P.toLowerCase().includes("foreground")&&!P.toLowerCase().includes("border")&&!P.toLowerCase().includes("input")&&!P.toLowerCase().includes("ring")&&!P.toLowerCase().includes("background")?" Background":"")})]},P)})});return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("no-scrollbar h-full w-full overflow-y-auto",r),children:[v.length>0&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 py-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:C("Presets")}),jsxRuntime.jsxRuntimeExports.jsxs("select",{value:x,onChange:Y=>T(Y.target.value),className:"w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",children:"Select preset"}),Array.isArray(v)&&v.map(Y=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:Object.keys(Y)[0],children:lodashEs.capitalize(Object.keys(Y)[0])},Object.keys(Y)[0]))]})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-[30%] items-end",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"w-full text-sm",disabled:x==="",variant:"default",onClick:O,children:C("Apply")})})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("space-y-2",r),children:[(j==null?void 0:j.fontFamily)&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grid gap-4",children:Object.entries(j.fontFamily).map(([Y,P])=>jsxRuntime.jsxRuntimeExports.jsx(FontSelector,{label:Y,value:R.fontFamily[Y.replace(/font-/g,"")]||P[Object.keys(P)[0]],onChange:he=>N(Y,he)},Y))}),(j==null?void 0:j.borderRadius)&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-0.5 py-3",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:C("Border Radius")}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 py-2",children:[jsxRuntime.jsxRuntimeExports.jsx(BorderRadiusInput,{value:R.borderRadius,onChange:z}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"w-12 text-sm",children:R.borderRadius})]})]}),(j==null?void 0:j.colors)&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-4 space-y-0.5",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:C("Colors")}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-full space-y-4 pt-2",children:j.colors.map(Y=>q(Y))},h?"dark":"light")]})]}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})}),GlobalBlockSettings=()=>{const r=useSelectedBlock(),{data:h,refetch:x,isLoading:g}=useGlobalBlocksList(),v=useUpdateBlocksProps();return jsxRuntime.jsxRuntimeExports.jsxs("div",{children:[jsxRuntime.jsxRuntimeExports.jsx("label",{className:"text-sm",children:"Choose a global block"}),jsxRuntime.jsxRuntimeExports.jsxs("select",{className:"h-8 w-full rounded-md border border-border bg-gray-50 p-0 px-2 text-xs dark:bg-gray-800",value:(r==null?void 0:r.globalBlock)||"",onChange:R=>{var A;v([r._id],{globalBlock:R.target.value,_name:`Global: ${lodashEs.startCase((A=lodashEs.get(h,R.target.value,""))==null?void 0:A.name)}`})},children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",children:"Select a global block"}),Object.keys(h).map(R=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:R,children:h[R].name||R},R))]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-2 text-xs",children:jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:x,className:"rounded-md bg-gray-100 p-1 px-2 text-xs hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700",children:g?"Loading...":"Refresh List"})})]})};var client={exports:{}},reactDomClient_production={},scheduler={exports:{}},scheduler_production={};/**
61
+ }`)},[v,N]),React.useEffect(()=>{j.querySelector("#drop-target-block").innerHTML=A?`[data-block-id="${A}"]{ outline: 1px dashed orange !important; outline-offset: -1px;}`:""},[A,j]);const Z=React.useMemo(()=>ChaiThemeFn.getChaiThemeCssVariables(r),[r]),q=React.useMemo(()=>ChaiThemeFn.getThemeFontsLinkMarkup(lodashEs.pick(r,["fontFamily"])),[r]);return jsxRuntime.jsxRuntimeExports.jsxs(jsxRuntime.jsxRuntimeExports.Fragment,{children:[jsxRuntime.jsxRuntimeExports.jsx("style",{id:"chai-theme",children:Z}),jsxRuntime.jsxRuntimeExports.jsx("span",{id:"chai-fonts",dangerouslySetInnerHTML:{__html:q}})]})},ResizableCanvasWrapper=({children:r,onMount:h,onResize:x})=>{const[,g]=useSelectedBlockIds(),[,v]=useSelectedStylingBlocks(),R=React.useRef(null),A=web.useDebouncedCallback(()=>{const{clientWidth:C}=R.current;x(C)},[R.current],100);web.useResizeObserver(R.current,A,R.current!==null),React.useEffect(()=>{const{clientWidth:C}=R.current;h(C)},[]);const j=()=>{g([]),v([])};return jsxRuntime.jsxRuntimeExports.jsx("div",{id:"main-content",onClick:j,className:"h-full w-full p-8 pb-0",ref:R,children:r})};function AsyncPropsBlock(r){const{dataProvider:h,block:x}=r,g=React.useMemo(()=>h?h(x,r.lang):{},[x,h,r.lang]);return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(r.component,{...r.props,...g})})}function RuntimePropsBlock(r){const h=useSelectedBlockHierarchy(),x=Object.entries(r.runtimeProps).reduce((g,[v,R])=>{const A=lodashEs.find(h,{_type:R.block});return A&&(g[v]=lodashEs.get(A,R.prop)),g},{});return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(r.component,{...r.props,...x})})}const useChaiExternalData=()=>jotai.useAtom(chaiExternalDataAtom),generateClassNames=lodashEs.memoize(r=>{const h=r.replace(STRINGS.STYLES_KEY,"").split(",");return tailwindMerge.twMerge(h[0],h[1])});function getElementAttrs(r,h){return lodashEs.get(r,`${h}_attrs`,{})}function getStyleAttrs(r){const h={};return Object.keys(r).forEach(x=>{if(lodashEs.isString(r[x])&&r[x].startsWith(STRINGS.STYLES_KEY)){const g=generateClassNames(r[x]),v=getElementAttrs(r,x);h[x]={className:g,"data-style-prop":x,"data-block-parent":r._id,"data-style-id":`${x}-${r._id}`,...v}}}),h}function applyBindings(r,h){const x=lodashEs.get(r,"_bindings",{});return lodashEs.isEmpty(x)?{...r}:(lodashEs.each(x,(g,v)=>{lodashEs.isString(g)&&lodashEs.get(h,g,null)&&(r[v]=lodashEs.get(h,g,null))}),r)}const getRuntimeProps=lodashEs.memoize(r=>{const h=runtime.getRegisteredChaiBlock(r),x=lodashEs.get(h,"schema.properties",{});return Object.fromEntries(Object.entries(x).filter(([,g])=>lodashEs.get(g,"runtime",!1)))});function isDescendant(r,h,x){if(!lodashEs.find(x,{_id:r}))return!1;const v=lodashEs.filter(x,{_parent:r});return v.some(R=>R._id===h)?!0:v.some(R=>isDescendant(R._id,h,x))}const RenderGlobalBlock=({blocks:r,allBlocks:h})=>jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{allBlocks:h,blocks:r});function applyLanguage(r,h,x){if(lodashEs.isEmpty(h))return r;const g=lodashEs.cloneDeep(r);return lodashEs.forEach(lodashEs.keys(g),v=>{lodashEs.includes(lodashEs.get(x,"i18nProps",[]),v)&&!lodashEs.isEmpty(h)&&(g[v]=lodashEs.get(g,`${v}-${h}`,g[v]))}),g}function BlocksRendererStatic({blocks:r,allBlocks:h}){const{selectedLang:x}=useLanguages(),[g]=useCutBlockIds(),[v]=jotai.useAtom(draggedBlockAtom),[R]=jotai.useAtom(dropTargetBlockIdAtom),[A]=useHiddenBlockIds(),{getGlobalBlocks:j}=useGlobalBlocksStore(),C=React.useCallback(N=>getStyleAttrs(N),[]),[T]=useChaiExternalData(),[O]=jotai.useAtom(inlineEditingActiveAtom);return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:React.Children.toArray(r.map((N,z)=>{if(O===N._id||A.includes(N._id))return null;const Z={},q=lodashEs.filter(h,{_parent:N._id});if(Z.children=q.length>0?jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{allBlocks:h,blocks:q}):null,N._type==="GlobalBlock"){const pe=j(N);Z.children=jsxRuntime.jsxRuntimeExports.jsx(RenderGlobalBlock,{blocks:lodashEs.filter(pe,ve=>!ve._parent),allBlocks:pe})}const Y=runtime.getRegisteredChaiBlock(N._type),P=lodashEs.get(Y,"component",null);if(lodashEs.isNull(P))return jsxRuntime.jsxRuntimeExports.jsx("noscript",{children:`<!-- ${N==null?void 0:N._type} not registered -->`});const he=C(N),te=v&&isDescendant(v._id,N._id,h),X={blockProps:{"data-block-id":N._id,"data-block-type":N._type,...v?{"data-dnd":canAcceptChildBlock(N._type,v==null?void 0:v._type)?"yes":"no","data-dnd-dragged":v._id===N._id||te?"yes":"no"}:{},...R===N._id&&!te?{"data-drop":"yes"}:{},...lodashEs.includes(g,N._id)?{"data-cut-block":"yes"}:{}},index:z,...applyBindings(applyLanguage(N,x,Y),T),...he,...Z,inBuilder:!0,lang:x};if(lodashEs.has(Y,"dataProvider"))return jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:jsxRuntime.jsxRuntimeExports.jsx(AsyncPropsBlock,{lang:x,dataProvider:Y.dataProvider,block:N,component:P,props:X})});const oe=getRuntimeProps(N._type);return oe?jsxRuntime.jsxRuntimeExports.jsx(RuntimePropsBlock,{runtimeProps:oe,block:N,component:P,props:X},N._id):jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{children:React.createElement(P,X)})}))})}const StaticBlocksRenderer=()=>{const[r]=useBlocksStore(),h=lodashEs.isEmpty(r)?null:jsxRuntime.jsxRuntimeExports.jsx(BlocksRendererStatic,{allBlocks:r,blocks:lodashEs.filter(r,x=>lodashEs.isEmpty(x._parent))});return jsxRuntime.jsxRuntimeExports.jsx(jsxRuntime.jsxRuntimeExports.Fragment,{children:h})},useCanvasScale=r=>{const[h]=useCanvasWidth(),[,x]=useCanvasZoom(),g=useBuilderProp("htmlDir","ltr"),[v,R]=React.useState({}),A=React.useCallback(()=>{const{width:j,height:C}=r;if(j<h){const T=parseFloat((j/h).toFixed(2).toString());let O={};const N=C*T,z=j*T;C&&(O={height:100+(C-N)/N*100+"%",width:100+(j-z)/z*100+"%"}),R({position:"relative",top:0,transform:`scale(${T})`,transformOrigin:g==="rtl"?"top right":"top left",...O,maxWidth:"none"}),x(T*100)}else R({}),x(100)},[h,r,g,x]);return React.useEffect(()=>{A()},[h,r,x,A]),v},getElementByStyleId=(r,h)=>r.querySelector(`[data-style-id="${h}"]`),StaticCanvas=()=>{const[r]=jotai.useAtom(networkModeAtom),[h]=useCanvasWidth(),[,x]=useSelectedBlockIds(),g=useSelectedBlock(),[,v]=useHighlightBlockId(),R=React.useRef(null),A=React.useRef(null),[j,C]=React.useState({width:0,height:0}),T=useCanvasScale(j),[O,N]=React.useState([]),[,z]=React.useState([]),[,Z]=jotai.useAtom(canvasIframeAtom),[q,Y]=useSelectedStylingBlocks(),P=useBuilderProp("loading",!1),he=useBuilderProp("htmlDir","ltr"),te=oe=>{C(pe=>({...pe,width:oe}))};React.useEffect(()=>{if(!A.current)return;const{clientWidth:oe,clientHeight:pe}=A.current;C({width:oe,height:pe})},[A,h]);const ue=(oe,pe=0)=>{const{top:ve}=oe.getBoundingClientRect();return ve+pe>=0&&ve-pe<=window.innerHeight};React.useEffect(()=>{var oe,pe;if(g&&g.type!=="Multiple"&&R.current){const ve=getElementByDataBlockId(R.current.contentDocument,g._id);ve&&(ue(ve)||(pe=(oe=R.current)==null?void 0:oe.contentWindow)==null||pe.scrollTo({top:ve.offsetTop,behavior:"smooth"}),N([ve]))}},[g]),React.useEffect(()=>{if(!lodashEs.isEmpty(q)&&R.current){const oe=getElementByStyleId(R.current.contentDocument,lodashEs.first(q).id);z(oe?[oe]:[null])}else z([null])},[q]);const X=React.useMemo(()=>{let oe=IframeInitialContent;return oe=oe.replace("__HTML_DIR__",he),r==="offline"&&(oe=oe.replace("https://chaibuilder.com/offline/tailwind.cdn.js","/offline/tailwind.cdn.js")),oe},[r,he]);return jsxRuntime.jsxRuntimeExports.jsx(ResizableCanvasWrapper,{onMount:te,onResize:te,children:jsxRuntime.jsxRuntimeExports.jsx("div",{onClick:()=>{x([]),Y([])},onMouseLeave:()=>setTimeout(()=>v(""),300),className:"relative mx-auto h-full w-full overflow-hidden",ref:A,children:jsxRuntime.jsxRuntimeExports.jsxs(ChaiFrame,{contentDidMount:()=>Z(R.current),ref:R,id:"canvas-iframe",style:{...T,...lodashEs.isEmpty(T)?{width:`${h}px`}:{}},className:"relative mx-auto box-content h-full w-full max-w-full shadow-lg transition-all duration-300 ease-linear",initialContent:X,children:[jsxRuntime.jsxRuntimeExports.jsx(KeyboardHandler,{}),jsxRuntime.jsxRuntimeExports.jsx(BlockFloatingSelector,{block:g,selectedBlockElement:lodashEs.first(O)}),jsxRuntime.jsxRuntimeExports.jsx(HeadTags,{}),jsxRuntime.jsxRuntimeExports.jsx(reactWrapBalancer.Provider,{children:jsxRuntime.jsxRuntimeExports.jsxs(Canvas,{children:[P?jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full p-4",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"})}):jsxRuntime.jsxRuntimeExports.jsx(StaticBlocksRenderer,{}),jsxRuntime.jsxRuntimeExports.jsx(AddBlockAtBottom,{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})}),jsxRuntime.jsxRuntimeExports.jsx("div",{id:"placeholder",className:"pointer-events-none absolute z-[99999] max-w-full bg-green-500 transition-transform"})]})})})},FallbackError=()=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded-md bg-red-200 p-4 text-red-500",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex h-full w-full flex-col items-center justify-center",children:[jsxRuntime.jsxRuntimeExports.jsx("p",{className:"font-semibold",children:"Oops! Something went wrong."}),jsxRuntime.jsxRuntimeExports.jsx("p",{children:"Please try again."})]})}),TypeIcon=r=>{switch(r.type){case"GlobalBlock":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.GlobeIcon,{className:"h-3 w-3 stroke-[2]"});case"Image":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ImageIcon,{className:"h-3 w-3 stroke-[2]"});case"Heading":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.HeadingIcon,{className:"h-3 w-3 stroke-[2]"});case"Text":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{className:"h-3 w-3 stroke-[2]"});case"Link":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.Link1Icon,{className:"h-3 w-3 stroke-[2]"});case"Video":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.VideoIcon,{className:"h-3 w-3 stroke-[2]"});case"RichText":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CursorTextIcon,{className:"h-3 w-3 stroke-[2]"});case"Button":case"DropdownButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{className:"h-3 w-3 stroke-[2]"});case"CustomHTML":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CodeIcon,{className:"h-3 w-3 stroke-[2]"});case"Divider":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DividerHorizontalIcon,{className:"h-3 w-3 stroke-[2]"});case"Icon":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SketchLogoIcon,{className:"h-3 w-3 stroke-[2]"});case"List":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RowsIcon,{className:"h-3 w-3 stroke-[2]"});case"Paragraph":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TextIcon,{className:"h-3 w-3 stroke-[2]"});case"Row":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Rows,{className:"h-3 w-3 stroke-[2]"});case"Column":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.Columns,{className:"h-3 w-3 stroke-[2]"});case"ListItem":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ColumnsIcon,{className:"h-3 w-3 stroke-[2]"});case"LineBreak":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.SpaceBetweenVerticallyIcon,{className:"h-3 w-3 stroke-[2]"});case"Form":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.GroupIcon,{className:"h-3 w-3 stroke-[2]"});case"Checkbox":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.CheckboxIcon,{className:"h-3 w-3 stroke-[2]"});case"FormButton":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ButtonIcon,{className:"h-3 w-3 stroke-[2]"});case"Input":case"TextArea":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.InputIcon,{className:"h-3 w-3 stroke-[2]"});case"Radio":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.RadiobuttonIcon,{className:"h-3 w-3 stroke-[2]"});case"Select":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{className:"h-3 w-3 stroke-[2]"});case"Table":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.TableIcon,{className:"h-3 w-3 stroke-[2]"});case"TableHead":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderTopIcon,{className:"h-3 w-3 stroke-[2]"});case"TableBody":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BorderAllIcon,{className:"h-3 w-3 stroke-[2]"});case"TableRow":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ViewHorizontalIcon,{className:"h-3 w-3 stroke-[2]"});case"TableCell":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DragHandleHorizontalIcon,{className:"h-3 w-3 stroke-[2]"});case"DataProvider":return jsxRuntime.jsxRuntimeExports.jsx(lucideReact.DatabaseIcon,{className:"h-3 w-3 stroke-[2]"});case"Box":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxIcon,{className:"h-3 w-3 stroke-[2]"});case"Dropdown":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.DropdownMenuIcon,{className:"h-3 w-3 stroke-[2]"});case"DropdownContent":return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.ReaderIcon,{className:"h-3 w-3 stroke-[2]"});default:return jsxRuntime.jsxRuntimeExports.jsx(reactIcons.BoxModelIcon,{className:"h-3 w-3 stroke-[2]"})}},Breadcrumb=()=>{const r=useSelectedBlockHierarchy(),[,h]=useSelectedBlockIds(),{highlightBlock:x}=useBlockHighlight();return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"-mx-2 border-t border-border bg-background px-2 py-1 text-xs text-muted-foreground",children:jsxRuntime.jsxRuntimeExports.jsxs("ol",{className:"flex items-center whitespace-nowrap",children:[jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{onClick:()=>h([]),variant:"ghost",className:"h-fit p-1 text-xs font-normal",children:"Body"}),jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{className:"rtl:rotate-180",size:16})]}),lodashEs.reverse(r).map((g,v)=>jsxRuntime.jsxRuntimeExports.jsxs("li",{className:"inline-flex items-center",children:[jsxRuntime.jsxRuntimeExports.jsxs(contextMenu.Button,{onMouseEnter:()=>{x(g==null?void 0:g._id)},onClick:()=>h([g==null?void 0:g._id]),variant:"ghost",className:"h-fit gap-x-1 p-1 text-xs font-normal",children:[jsxRuntime.jsxRuntimeExports.jsx(TypeIcon,{type:g==null?void 0:g._type}),g._name||g._type]}),v!==r.length-1&&jsxRuntime.jsxRuntimeExports.jsx(lucideReact.ChevronRight,{className:"rtl:rotate-180",size:16})]},v))]})})},CodeEditor$1=React.lazy(()=>Promise.resolve().then(()=>require("./CodeEditor-CzoZfMYd.cjs"))),CanvasArea=()=>{const[r]=useCodeEditor(),h=useBuilderProp("onError",lodashEs.noop);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex h-full max-h-full w-full flex-1 flex-col",children:jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2",children:[jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reactErrorBoundary.ErrorBoundary,{fallback:jsxRuntime.jsxRuntimeExports.jsx(FallbackError,{}),onError:h,children:jsxRuntime.jsxRuntimeExports.jsx(StaticCanvas,{})})}),r?jsxRuntime.jsxRuntimeExports.jsx(React.Suspense,{fallback:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Skeleton,{className:"h-full"}),children:jsxRuntime.jsxRuntimeExports.jsx(reResizable.Resizable,{enable:{top:!0,bottom:!1},className:"max-h-[400px] min-h-[200px]",children:jsxRuntime.jsxRuntimeExports.jsx(CodeEditor$1,{})})}):null,jsxRuntime.jsxRuntimeExports.jsx(Breadcrumb,{})]})})},FONTS=[{title:"Roboto",value:"Roboto"},{title:"Open Sans",value:"Open Sans"},{title:"Montserrat",value:"Montserrat"},{title:"Lato",value:"Lato"},{title:"Poppins",value:"Poppins"},{title:"Oswald",value:"Oswald"},{title:"Raleway",value:"Raleway"},{title:"Ubuntu",value:"Ubuntu"},{title:"Nunito",value:"Nunito"},{title:"Merriweather",value:"Merriweather"},{title:"Nunito Sans",value:"Nunito Sans"},{title:"Playfair Display",value:"Playfair Display"},{title:"Rubik",value:"Rubik"},{title:"Inter",value:"Inter"},{title:"Lora",value:"Lora"},{title:"Kanit",value:"Kanit"},{title:"Fira Sans",value:"Fira Sans"},{title:"Hind",value:"Hind"},{title:"Quicksand",value:"Quicksand"},{title:"Mulish",value:"Mulish"},{title:"Barlow",value:"Barlow"},{title:"Inconsolata",value:"Inconsolata"},{title:"Titillium Web",value:"Titillium Web"},{title:"Heebo",value:"Heebo"},{title:"IBM Plex Sans",value:"IBM Plex Sans"},{title:"DM Sans",value:"DM Sans"},{title:"Nanum Gothic",value:"Nanum Gothic"},{title:"Karla",value:"Karla"},{title:"Arimo",value:"Arimo"},{title:"Cabin",value:"Cabin"},{title:"Oxygen",value:"Oxygen"},{title:"Overpass",value:"Overpass"},{title:"Assistant",value:"Assistant"},{title:"Tajawal",value:"Tajawal"},{title:"Play",value:"Play"},{title:"Exo",value:"Exo"},{title:"Cinzel",value:"Cinzel"},{title:"Faustina",value:"Faustina"},{title:"Philosopher",value:"Philosopher"},{title:"Gelasio",value:"Gelasio"},{title:"Sofia Sans Condensed",value:"Sofia Sans Condensed"},{title:"Noto Sans Devanagari",value:"Noto Sans Devanagari"},{title:"Actor",value:"Actor"},{title:"Epilogue",value:"Epilogue"},{title:"Glegoo",value:"Glegoo"},{title:"Overlock",value:"Overlock"},{title:"Lustria",value:"Lustria"},{title:"Ovo",value:"Ovo"},{title:"Suranna",value:"Suranna"},{title:"Bebas Neue",value:"Bebas Neue"},{title:"Manrope",value:"Manrope"}],FontSelector=({label:r,value:h,onChange:x})=>jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-0.5",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:lodashEs.startCase(r)}),jsxRuntime.jsxRuntimeExports.jsx("select",{className:"mt-1 w-full cursor-pointer rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",value:h,onChange:g=>x(g.target.value),children:FONTS.map(g=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:g.value,children:g.title},g.value))})]}),ColorPickerInput=({value:r,onChange:h})=>{const x=lodashEs.debounce(g=>h(g),200);return jsxRuntime.jsxRuntimeExports.jsx("div",{className:"relative flex h-6 w-6 cursor-pointer rounded-lg border border-border",style:{backgroundColor:r},children:jsxRuntime.jsxRuntimeExports.jsx("input",{type:"color",value:r.startsWith("#")?r:"#000000",onChange:g=>{const v=g.target.value;/^#[0-9A-F]{6}$/i.test(v)&&x(v)},className:"absolute inset-0 h-full w-full cursor-pointer rounded-lg border-0 opacity-0"})})},BorderRadiusInput=({value:r,onChange:h,disabled:x})=>{const g=lodashEs.debounce(v=>h(v),200);return jsxRuntime.jsxRuntimeExports.jsx("input",{type:"range",min:"0",step:"1",max:"30",disabled:x,defaultValue:r.replace("px",""),onChange:v=>g(v.target.value),className:"flex-1 cursor-pointer"})},ThemeConfigPanel=React__namespace.memo(({className:r=""})=>{const[h]=useDarkMode(),[x,g]=React__namespace.useState(""),v=useBuilderProp("themePresets",[]),[R,A]=useTheme(),j=useThemeOptions(),{t:C}=reactI18next.useTranslation(),T=Y=>{g(Y)},O=()=>{const Y=v.find(P=>Object.keys(P)[0]===x);if(Y){const P=Object.values(Y)[0];P&&typeof P=="object"&&"fontFamily"in P&&"borderRadius"in P&&"colors"in P?A(P):console.error("Invalid preset structure:",P)}else console.error("Preset not found:",x)},N=web.useDebouncedCallback((Y,P)=>{A(()=>({...R,fontFamily:{...R.fontFamily,[Y.replace(/font-/g,"")]:P}}))},[R],200),z=web.useDebouncedCallback(Y=>{A(()=>({...R,borderRadius:`${Y}px`}))},[R],200),Z=web.useDebouncedCallback((Y,P)=>{A(()=>{const he=lodashEs.get(R,`colors.${Y}`);return h?lodashEs.set(he,1,P):lodashEs.set(he,0,P),{...R,colors:{...R.colors,[Y]:he}}})},[R],200),q=Y=>jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grid grid-cols-1",children:Object.entries(Y.items).map(([P])=>{const he=lodashEs.get(R,`colors.${P}.${h?1:0}`);return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-1 flex items-center gap-x-2",children:[jsxRuntime.jsxRuntimeExports.jsx(ColorPickerInput,{value:he,onChange:te=>Z(P,te)}),jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-xs font-normal leading-tight text-slate-600",children:P.split(/(?=[A-Z])/).join(" ").replace(/-/g," ").split(" ").map(te=>te.charAt(0).toUpperCase()+te.slice(1)).join(" ")+(!P.toLowerCase().includes("foreground")&&!P.toLowerCase().includes("border")&&!P.toLowerCase().includes("input")&&!P.toLowerCase().includes("ring")&&!P.toLowerCase().includes("background")?" Background":"")})]},P)})});return jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("no-scrollbar h-full w-full overflow-y-auto",r),children:[v.length>0&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex gap-2 py-2",children:[jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"w-full",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:C("Presets")}),jsxRuntime.jsxRuntimeExports.jsxs("select",{value:x,onChange:Y=>T(Y.target.value),className:"w-full space-y-0.5 rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",children:"Select preset"}),Array.isArray(v)&&v.map(Y=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:Object.keys(Y)[0],children:lodashEs.capitalize(Object.keys(Y)[0])},Object.keys(Y)[0]))]})]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"flex w-[30%] items-end",children:jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Button,{className:"w-full text-sm",disabled:x==="",variant:"default",onClick:O,children:C("Apply")})})]}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:iconBase.cn("space-y-2",r),children:[(j==null?void 0:j.fontFamily)&&jsxRuntime.jsxRuntimeExports.jsx("div",{className:"grid gap-4",children:Object.entries(j.fontFamily).map(([Y,P])=>jsxRuntime.jsxRuntimeExports.jsx(FontSelector,{label:Y,value:R.fontFamily[Y.replace(/font-/g,"")]||P[Object.keys(P)[0]],onChange:he=>N(Y,he)},Y))}),(j==null?void 0:j.borderRadius)&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"space-y-0.5 py-3",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:C("Border Radius")}),jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"flex items-center gap-4 py-2",children:[jsxRuntime.jsxRuntimeExports.jsx(BorderRadiusInput,{value:R.borderRadius,onChange:z}),jsxRuntime.jsxRuntimeExports.jsx("span",{className:"w-12 text-sm",children:R.borderRadius})]})]}),(j==null?void 0:j.colors)&&jsxRuntime.jsxRuntimeExports.jsxs("div",{className:"mt-4 space-y-0.5",children:[jsxRuntime.jsxRuntimeExports.jsx(contextMenu.Label,{className:"text-sm text-slate-800",children:C("Colors")}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"w-full space-y-4 pt-2",children:j.colors.map(Y=>q(Y))},h?"dark":"light")]})]}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{}),jsxRuntime.jsxRuntimeExports.jsx("br",{})]})}),GlobalBlockSettings=()=>{const r=useSelectedBlock(),{data:h,refetch:x,isLoading:g}=useGlobalBlocksList(),v=useUpdateBlocksProps();return jsxRuntime.jsxRuntimeExports.jsxs("div",{children:[jsxRuntime.jsxRuntimeExports.jsx("label",{className:"text-sm",children:"Choose a global block"}),jsxRuntime.jsxRuntimeExports.jsxs("select",{className:"h-8 w-full rounded-md border border-border bg-gray-50 p-0 px-2 text-xs dark:bg-gray-800",value:(r==null?void 0:r.globalBlock)||"",onChange:R=>{var A;v([r._id],{globalBlock:R.target.value,_name:`Global: ${lodashEs.startCase((A=lodashEs.get(h,R.target.value,""))==null?void 0:A.name)}`})},children:[jsxRuntime.jsxRuntimeExports.jsx("option",{value:"",children:"Select a global block"}),Object.keys(h).map(R=>jsxRuntime.jsxRuntimeExports.jsx("option",{value:R,children:h[R].name||R},R))]}),jsxRuntime.jsxRuntimeExports.jsx("div",{className:"mt-2 text-xs",children:jsxRuntime.jsxRuntimeExports.jsx("button",{onClick:x,className:"rounded-md bg-gray-100 p-1 px-2 text-xs hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700",children:g?"Loading...":"Refresh List"})})]})};var client={exports:{}},reactDomClient_production={},scheduler={exports:{}},scheduler_production={};/**
62
62
  * @license React
63
63
  * scheduler.production.js
64
64
  *
package/dist/core.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { ChaiBlock as ChaiBlock_2 } from '@chaibuilder/runtime';
1
2
  import { ClassValue } from 'clsx';
2
3
  import { default as default_2 } from 'react';
3
4
  import { default as i18n } from 'i18next';
@@ -603,7 +604,7 @@ export declare const useUpdateBlocksProps: () => (blockIds: Array<string>, props
603
604
 
604
605
  export declare const useUpdateBlocksPropsRealtime: () => (blockIds: Array<string>, props: Record<string, any>) => void;
605
606
 
606
- export declare const useWrapperBlock: () => any;
607
+ export declare const useWrapperBlock: () => ChaiBlock_2;
607
608
 
608
609
  declare type VariableKey = string;
609
610
 
package/dist/core.js CHANGED
@@ -3989,7 +3989,7 @@ const StaticBlocksRenderer = () => {
3989
3989
  v !== r.length - 1 && /* @__PURE__ */ jsxRuntimeExports.jsx(ChevronRight, { className: "rtl:rotate-180", size: 16 })
3990
3990
  ] }, v))
3991
3991
  ] }) });
3992
- }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-DmPiW1eD.js")), CanvasArea = () => {
3992
+ }, CodeEditor$1 = React__default.lazy(() => import("./CodeEditor-DvFaAnJ4.js")), CanvasArea = () => {
3993
3993
  const [r] = useCodeEditor(), h = useBuilderProp("onError", noop);
3994
3994
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40 px-2", children: [
3995
3995
  /* @__PURE__ */ jsxRuntimeExports.jsx(Suspense, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "h-full" }), children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { fallback: /* @__PURE__ */ jsxRuntimeExports.jsx(FallbackError, {}), onError: h, children: /* @__PURE__ */ jsxRuntimeExports.jsx(StaticCanvas, {}) }) }),
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@chaibuilder/runtime"),n=require("./jsx-runtime-DGh1k5sI.cjs"),E=require("react"),x=require("./iconBase-Cn2BsTrq.cjs"),y=require("@radix-ui/react-icons"),m=require("lodash-es"),w=require("lucide-react");function I(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(s,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return s.default=e,Object.freeze(s)}const g=I(E),k=({className:e="",inBuilder:s})=>s?n.jsxRuntimeExports.jsx("div",{className:x.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:n.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,_=e=>{const{blockProps:s,inBuilder:o,backgroundImage:r,children:l,tag:i="div",styles:a}=e;let c=l;l||(c=n.jsxRuntimeExports.jsx(k,{inBuilder:o}));let p={};return r&&(p={backgroundImage:`url(${r})`}),g.createElement(i,{...s,...a,style:p},c)},L={type:"Box",label:"Box",category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},R=e=>{const{blockProps:s,iconSize:o,icon:r,content:l,styles:i,children:a,iconPos:c,link:p,inBuilder:d}=e,h=r,f=a||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:l}),h&&n.jsxRuntimeExports.jsx("div",{style:{width:o+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:h}})]}),u=g.createElement("button",{...s,...i,type:"button"},f);return m.isEmpty(m.get(p,"href"))?u:d?n.jsxRuntimeExports.jsx("span",{children:u}):n.jsxRuntimeExports.jsx("a",{href:m.get(p,"href")||"/",target:m.get(p,"target","_self"),children:u})},M={type:"Button",label:"Button",category:"core",icon:y.ButtonIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.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:24},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),i18nProps:["content"],aiProps:["content"]},D=e=>{const{blockProps:s,styles:o,htmlCode:r,inBuilder:l}=e;return l?n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[l?n.jsxRuntimeExports.jsx("div",{...s,...o,className:"absolute z-20 h-full w-full"}):null,g.createElement("div",{...o,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):g.createElement("div",{...s,...o,dangerouslySetInnerHTML:{__html:r}})},N={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:y.CodeIcon,group:"advanced",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},T=e=>{const{blockProps:s,styles:o,backgroundImage:r}=e;let l={};return r&&(l={backgroundImage:`url(${r})`}),g.createElement("div",{...s,...o,style:l})},$={type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},A=e=>{const{blockProps:s,styles:o,content:r,tag:l="h1",children:i=null}=e;return i?g.createElement(l,{...o,...s},i):g.createElement(l,{...o,...s,dangerouslySetInnerHTML:{__html:r}})},z={type:"Heading",label:"web_blocks.heading",category:"core",icon:y.HeadingIcon,group:"typography",...t.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:t.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},H=e=>{const{blockProps:s,styles:o,content:r}=e;return m.isNull(e.children)?g.createElement("p",{...o,...s,dangerouslySetInnerHTML:{__html:r}}):g.createElement("p",{...o,...s},e.children)},q={type:"Paragraph",label:"Paragraph",category:"core",icon:y.TextIcon,group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@chaibuilder/runtime"),n=require("./jsx-runtime-DGh1k5sI.cjs"),k=require("react"),x=require("./iconBase-Cn2BsTrq.cjs"),m=require("@radix-ui/react-icons"),g=require("lodash-es"),B=require("lucide-react");function I(e){const s=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(s,o,r.get?r:{enumerable:!0,get:()=>e[o]})}}return s.default=e,Object.freeze(s)}const h=I(k),w=({className:e="",inBuilder:s})=>s?n.jsxRuntimeExports.jsx("div",{className:x.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:n.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,_=e=>{const{blockProps:s,inBuilder:o,backgroundImage:r,children:l,tag:i="div",styles:a}=e;let c=l;l||(c=n.jsxRuntimeExports.jsx(w,{inBuilder:o}));let p={};return r&&(p={backgroundImage:`url(${r})`}),h.createElement(i,{...s,...a,style:p},c)},L={type:"Box",label:"Box",category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},R=e=>{const{blockProps:s,iconSize:o,icon:r,content:l,styles:i,children:a,iconPos:c,link:p,inBuilder:d}=e,y=r,f=a||n.jsxRuntimeExports.jsxs(n.jsxRuntimeExports.Fragment,{children:[n.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:l}),y&&n.jsxRuntimeExports.jsx("div",{style:{width:o+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:y}})]}),u=k.createElement("button",{...s,...i,type:"button"},f);return g.isEmpty(g.get(p,"href"))?u:d?n.jsxRuntimeExports.jsx("span",{children:u}):n.jsxRuntimeExports.jsx("a",{href:g.get(p,"href")||"/",target:g.get(p,"target","_self"),children:u})},M={type:"Button",label:"Button",category:"core",icon:m.ButtonIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.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:24},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),i18nProps:["content"],aiProps:["content"]},D=e=>{const{blockProps:s,styles:o,htmlCode:r,inBuilder:l}=e;return l?n.jsxRuntimeExports.jsxs("div",{className:"relative",children:[l?n.jsxRuntimeExports.jsx("div",{...s,...o,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...o,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):h.createElement("div",{...s,...o,dangerouslySetInnerHTML:{__html:r}})},N={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:m.CodeIcon,group:"advanced",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},T=e=>{const{blockProps:s,styles:o,backgroundImage:r}=e;let l={};return r&&(l={backgroundImage:`url(${r})`}),h.createElement("div",{...s,...o,style:l})},$={type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},A=e=>{const{blockProps:s,styles:o,content:r,tag:l="h1",children:i=null}=e;return i?h.createElement(l,{...o,...s},i):h.createElement(l,{...o,...s,dangerouslySetInnerHTML:{__html:r}})},z={type:"Heading",label:"web_blocks.heading",category:"core",icon:m.HeadingIcon,group:"typography",...t.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:t.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},H=e=>{const{blockProps:s,styles:o,content:r}=e;return g.isNull(e.children)?h.createElement("p",{...o,...s,dangerouslySetInnerHTML:{__html:r}}):h.createElement("p",{...o,...s},e.children)},q={type:"Paragraph",label:"Paragraph",category:"core",icon:m.TextIcon,group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
2
2
  Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
3
- nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},U=e=>{const{blockProps:s,styles:o,content:r,children:l=null,tag:i}=e;return l?g.createElement("span",{...o,...s},l):g.createElement(i||"span",{...o,...s,dangerouslySetInnerHTML:{__html:r||""}})},O={type:"Span",label:"Span",category:"core",group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},F=e=>{const{blockProps:s,content:o,styles:r}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{...s,...r,dangerouslySetInnerHTML:{__html:o}})})},G={type:"RichText",label:"Rich Text",category:"core",icon:y.CursorTextIcon,group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.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"]},V=e=>{const{blockProps:s,link:o,children:r,styles:l,inBuilder:i,content:a}=e;let c={};return!r&&m.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),i?r?n.jsxRuntimeExports.jsx("span",{...s,style:c,...l,children:r}):g.createElement("span",{...s,...l,style:c},a):r?n.jsxRuntimeExports.jsx("a",{href:(o==null?void 0:o.href)||"#/",target:o==null?void 0:o.target,...s,...l,children:r}):g.createElement("a",{...s,...l,href:(o==null?void 0:o.href)||"#",target:(o==null?void 0:o.target)||"_self"},a)},W={type:"Link",label:"Link",category:"core",icon:y.Link1Icon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},v=(e,...s)=>({...e,className:x.cn(e.className,...s)}),X=e=>{const{blockProps:s,children:o,styles:r,inBuilder:l,content:i,href:a}=e,{hrefType:c,autoplay:p,maxWidth:d,backdropColor:h,galleryName:f}=e,u=v(r,"cb-lightbox");if(!o&&m.isEmpty(r==null?void 0:r.className)&&m.isEmpty(i))return n.jsxRuntimeExports.jsx(k,{inBuilder:l});if(l)return o?n.jsxRuntimeExports.jsx("span",{...s,...u,children:o}):g.createElement("span",{...s,...u,dangerouslySetInnerHTML:{__html:i}});const b={};return c!=="image"&&(b["data-vbtype"]=c),p&&(b["data-autoplay"]="true"),d&&(b["data-maxwidth"]=d+"px"),h&&(b["data-overlay"]=h),f&&(b["data-gall"]=f),o?n.jsxRuntimeExports.jsx("a",{...b,href:a||"#/",...s,...u,children:o}):g.createElement("a",{...s,...u,...b,href:a||"#",dangerouslySetInnerHTML:{__html:i}})},Y={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:y.ImageIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:"Link text or drop blocks inside"},hrefType:{type:"string",title:"Type",default:"image",enum:["image","video","iframe","inline","ajax"],enumNames:["Image","Video","Iframe","Inline","Ajax"]},href:{type:"string",title:"Href",default:""},autoplay:{type:"boolean",title:"Autoplay (Video only)",default:!1},maxWidth:{type:"number",title:"Max Width",default:""},backdropColor:{type:"string",title:"Backdrop Color",default:""},galleryName:{type:"string",title:"Gallery Name",default:""}},dependencies:{autoplay:["hrefType","video"]}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},Z=e=>{const{blockProps:s,children:o,listType:r,styles:l,tag:i,inBuilder:a}=e,c=x.cn(m.get(l,"className",""),r);return!o&&m.isEmpty(l==null?void 0:l.className)?n.jsxRuntimeExports.jsx(k,{inBuilder:a}):g.createElement(i||(r==="list-decimal"?"ol":"ul"),{...s,...l,className:c},o)},J={type:"List",label:"web_blocks.list",icon:y.RowsIcon,category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},K=e=>{const{blockProps:s,content:o,styles:r,children:l,tag:i}=e;return l?g.createElement(i||"li",{...r,...s},l):g.createElement(i||"li",{...r,...s,dangerouslySetInnerHTML:{__html:o}})},Q={type:"ListItem",label:"List Item",icon:y.ColumnsIcon,category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.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"},ee=e=>{const{blockProps:s,icon:o,styles:r,width:l,inBuilder:i,height:a}=e,c=v(r,"");if(m.isEmpty(o))return n.jsxRuntimeExports.jsx(k,{inBuilder:i,className:"h-8 w-14"});const p=o.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return g.createElement("span",{...s,...c,style:{width:l?`${l}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},te={type:"Icon",label:"web_blocks.icon",category:"core",icon:y.SketchLogoIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),icon:{type:"string",title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},oe=e=>{const{blockProps:s,image:o,mobileImage:r,styles:l,alt:i,height:a,width:c,lazyLoading:p}=e;return m.isEmpty(o)?n.jsxRuntimeExports.jsx(k,{className:"h-36"}):n.jsxRuntimeExports.jsxs("picture",{children:[r&&n.jsxRuntimeExports.jsx("source",{srcSet:r,media:"(max-width: 480px)"}),n.jsxRuntimeExports.jsx("img",{...s,...l,src:o,alt:i,loading:p?"lazy":"eager",width:c,height:a})]})},se={type:"Image",label:"Image",category:"core",icon:y.ImageIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}}}}),aiProps:["alt"],i18nProps:["alt"]},j=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,S=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,P=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,re=e=>{if(j.test(e)){const s=e.match(j);return s?`https://www.youtube.com/embed/${s[4]}`:e}if(S.test(e)){const s=e.match(S);return s?`https://player.vimeo.com/video/${s[3]}`:e}if(P.test(e)){const s=e.match(P);return s?`https://www.dailymotion.com/embed/video/${s[4]}`:e}return null},le=g.memo(e=>{const{blockProps:s,inBuilder:o,styles:r,url:l,controls:i}=e,a=m.get(i,"autoPlay",!1),c=m.get(i,"controls",!1),p=a||m.get(i,"muted",!0),d=m.get(i,"loop",!1);if(m.isEmpty(l))return n.jsxRuntimeExports.jsx(k,{inBuilder:o,className:"h-36"});let h=re(l),f=null;if(h){if(!m.isEmpty(h)){const u=[];u.push(`autoplay=${a?1:0}`),u.push(`controls=${i?1:0}`),u.push(`mute=${p?1:0}&muted=${p?1:0}`),u.push(`loop=${d?1:0}`),h=`${h}?${u.join("&")}`}f=g.createElement("iframe",{...s,className:"absolute inset-0 w-full h-full",src:h,allow:o?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else f=g.createElement("video",{...s,className:"absolute inset-0 w-full h-full",src:l,controls:c,muted:p,autoPlay:o?!1:a,loop:d});return n.jsxRuntimeExports.jsx("div",{...m.pick(r,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[o?n.jsxRuntimeExports.jsx("div",{...s,...m.omit(r,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,f]})})}),ne={type:"Video",label:"Video",category:"core",icon:y.VideoIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),url:{type:"string",title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"},controls:{type:"object",title:"Controls",default:{autoplay:!1,controls:!0,loop:!1,muted:!1},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}}}}}),i18nProps:["url"]},ie=e=>{const{blockProps:s,styles:o}=e;return g.createElement("hr",{...o,...s})},ae={type:"Divider",label:"web_blocks.divider",category:"core",icon:y.DividerHorizontalIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})};function ce(e){return x.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(e)}const pe=e=>{const{scripts:s,inBuilder:o,blockProps:r}=e;return o?n.jsxRuntimeExports.jsx("div",{...r,children:n.jsxRuntimeExports.jsx("div",{className:x.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:n.jsxRuntimeExports.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"})})})}):n.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:s}})},ue={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:ce,group:"advanced",...t.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},de=e=>n.jsxRuntimeExports.jsxs("div",{...e.blockProps,...e.styles,children:[e.mode,e.children]}),ge=e=>e.mode==="dark"?null:n.jsxRuntimeExports.jsx("button",{...e.blockProps,...e.styles,children:e.children});t.registerChaiBlock(ge,{type:"DarkModeButton",label:"Dark Mode Button",category:"core",icon:y.MoonIcon,group:"advanced",hidden:!0,...t.registerChaiBlockSchema({properties:{mode:t.closestBlockProp("DarkModeSwitcher","mode"),styles:t.stylesProp("")}})});const me=e=>e.mode==="light"?null:n.jsxRuntimeExports.jsx("button",{...e.blockProps,...e.styles,children:e.children});t.registerChaiBlock(me,{type:"LightModeButton",label:"Light Mode Button",category:"core",icon:y.SunIcon,group:"advanced",hidden:!0,...t.registerChaiBlockSchema({properties:{mode:t.closestBlockProp("DarkModeSwitcher","mode"),styles:t.stylesProp("")}})});const ye={type:"DarkModeSwitcher",label:"web_blocks.dark_mode",category:"core",icon:y.MoonIcon,group:"advanced",wrapper:!0,...t.registerChaiBlockSchema({properties:{mode:{title:"Mode",type:"string",enum:["dark","light"],default:"light"},styles:t.stylesProp("")}}),blocks:()=>[{_id:"ultqCh",_type:"DarkModeSwitcher",mode:"light",styles:"#styles:,",_name:"Dark Mode Theme"},{_id:"vroabi",_parent:"ultqCh",_type:"LightModeButton",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"nltBrv",_parent:"vroabi",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"DarkModeButton",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white hidden dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"AdDwBC",_parent:"gesydi",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]},he=e=>{const{blockProps:s,inBuilder:o,children:r,globalBlock:l}=e;return o&&!l?n.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-4 bg-gray-100 rounded-lg gap-y-1 dark:bg-gray-800",...s,children:[n.jsxRuntimeExports.jsxs("h1",{children:["Global Block - ",l]}),n.jsxRuntimeExports.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):g.createElement("span",{...s},r)},fe={type:"GlobalBlock",label:"Global Block",icon:w.GlobeIcon,category:"core",group:"advanced",...t.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},xe=e=>e.inBuilder||e.forceWrapper?n.jsxRuntimeExports.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,be={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:y.SpaceBetweenVerticallyIcon,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("text-black"),content:{type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},ke=e=>{const{blockProps:s,backgroundImage:o,children:r,styles:l,tag:i}=e;let a={};return o&&(a={backgroundImage:`url(${o})`}),g.createElement(i||"div",{...s,...l,style:a},r)},we={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("font-body antialiased"),backgroundImage:{type:"string",title:"Image",default:"",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Be=e=>{const{blockProps:s,styles:o}=e;return g.createElement("br",{...s,...o})},Ce={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},je=e=>{const{children:s,blockProps:o,errorMessage:r,successMessage:l,action:i,styles:a,inBuilder:c}=e;let p=s;s||(p=n.jsxRuntimeExports.jsx(k,{inBuilder:c}));const d={"x-data":"{}","x-on:submit.prevent":"post"},h={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...d,"data-error":r,"data-success":l,method:"post",action:i,...o,...a,children:[n.jsxRuntimeExports.jsx("div",{...h}),p]})},Se={type:"Form",label:"Form",category:"core",icon:w.GroupIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form/submit"},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},Pe=e=>{const{blockProps:s,inBuilder:o,label:r,styles:l,inputStyles:i,icon:a,iconSize:c,iconPos:p}=e,d=x.generateUUID(),h={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:d,...h,...i,...l,...s||{},type:o?"button":"submit",children:[r,a&&n.jsxRuntimeExports.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},ve={type:"FormButton",label:"Submit Button",category:"core",icon:y.ButtonIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:t.StylesProp(""),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},Ee=e=>{const{blockProps:s,fieldName:o,label:r,placeholder:l,styles:i,inputStyles:a,showLabel:c,required:p,inputType:d}=e,h=x.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...i,...s,children:[c&&n.jsxRuntimeExports.jsx("label",{htmlFor:h,children:r}),n.jsxRuntimeExports.jsx("input",{name:o,...a,id:h,type:d,placeholder:l,required:p})]}):n.jsxRuntimeExports.jsx("input",{id:h,name:o,...s,...a,...i,type:d,placeholder:l,required:p})},Ie={type:"Input",label:"web_blocks.input",category:"core",icon:y.InputIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.StylesProp("w-full p-1"),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},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","file","hidden","range","submit","color","date","time"]}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},_e=e=>{const{blockProps:s,fieldName:o,label:r,styles:l,inputStyles:i,required:a,checked:c,showLabel:p=!0}=e,d=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...l,...s,children:[n.jsxRuntimeExports.jsx("input",{...i,name:o,id:d,type:"radio",required:a,defaultChecked:c}),r&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:r})]}):n.jsxRuntimeExports.jsx("input",{id:d,...s,...i,...l,type:"radio",required:a,checked:c,name:o})},Le={type:"Radio",label:"web_blocks.radio",category:"core",icon:y.RadiobuttonIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("flex items-center gap-x-2"),inputStyles:t.StylesProp(""),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"]},Re=e=>{const{blockProps:s,fieldName:o,label:r,placeholder:l,styles:i,inputStyles:a,required:c,showLabel:p,_multiple:d,options:h}=e,f=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...i,...s,children:[p&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r}),n.jsxRuntimeExports.jsxs("select",{...a,id:f,required:c,multiple:d,name:o,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),m.map(h,u=>n.jsxRuntimeExports.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:f,...i,...s,required:c,multiple:d,name:o,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),m.map(h,u=>n.jsxRuntimeExports.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})},Me={type:"Select",label:"web_blocks.select",category:"core",icon:y.DropdownMenuIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},De=e=>{const{blockProps:s,fieldName:o,label:r,placeholder:l,styles:i,inputStyles:a,_rows:c,showLabel:p}=e,d=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...i,...s,children:[p&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:r}),n.jsxRuntimeExports.jsx("textarea",{name:o,...a,id:d,placeholder:l,rows:c})]}):n.jsxRuntimeExports.jsx("textarea",{id:d,name:o,...s,...a,...i,placeholder:l,rows:c})},Ne={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:y.InputIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.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}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Te=e=>{const{blockProps:s,fieldName:o,label:r,styles:l,inputStyles:i,required:a,checked:c,showLabel:p=!0}=e,d=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...l,...s,children:[n.jsxRuntimeExports.jsx("input",{...i,name:o,id:d,type:"checkbox",required:a,defaultChecked:c}),r&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:r})]}):n.jsxRuntimeExports.jsx("input",{id:d,...s,...i,...l,type:"checkbox",required:a,name:o})},$e={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:y.CheckboxIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("flex items-center gap-x-2"),inputStyles:t.StylesProp(""),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"]},Ae=e=>{const{blockProps:s,content:o,styles:r,children:l}=e,i={...r,...s};return l?g.createElement("label",i,l):g.createElement("label",{...i,dangerouslySetInnerHTML:{__html:o}})},ze={type:"Label",label:"Label",category:"core",icon:y.LetterCaseToggleIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(),content:{type:"string",title:"Content",default:""}}})},C={wrapper:{"x-data":"{ open: false }"},button:{"x-on:click":"open = !open"},menu:{"x-show":"open","x-on:click.away":"open = false","x-cloak":"","x-transition":""}},He=e=>{const{blockProps:s,content:o,icon:r,iconWidth:l,iconHeight:i,styles:a,show:c}=e;return n.jsxRuntimeExports.jsxs("button",{...s,...a,...C.button,children:[o,n.jsxRuntimeExports.jsx("span",{className:c?"rotate-180":"",dangerouslySetInnerHTML:{__html:r},style:{width:l,height:i}})]})};t.registerChaiBlock(He,{type:"DropdownButton",label:"Dropdown Button",group:"advanced",category:"core",hidden:!0,canMove:()=>!1,canDelete:()=>!1,...t.registerChaiBlockSchema({properties:{show:t.closestBlockProp("Dropdown","showDropdown"),content:{type:"string",title:"Title",default:"Menu Item"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconWidth:{type:"string",title:"Icon Width",default:"16px"},iconHeight:{type:"string",title:"Icon Height",default:"16px"},styles:t.StylesProp("flex items-center gap-2 px-4 py-1")}})});const qe=e=>{const{blockProps:s,children:o,styles:r,show:l,inBuilder:i}=e;return i&&!l?null:n.jsxRuntimeExports.jsx("div",{...s,...C.menu,...r,children:o})};t.registerChaiBlock(qe,{type:"DropdownContent",label:"Dropdown Content",hidden:!0,canMove:()=>!1,canDelete:()=>!1,canAcceptBlock:()=>!0,...t.registerChaiBlockSchema({properties:{show:t.closestBlockProp("Dropdown","showDropdown"),styles:t.StylesProp("absolute left-0 p-2 w-80 mt-2 bg-white rounded-lg shadow-lg z-50")}})});const Ue=e=>{const{blockProps:s,children:o,styles:r}=e;return n.jsxRuntimeExports.jsx("div",{...s,...r,...C.wrapper,children:o})},Oe={type:"Dropdown",label:"Dropdown",group:"basic",icon:y.DropdownMenuIcon,blocks:()=>[{_type:"Dropdown",_id:"dropdown"},{_type:"DropdownButton",_id:"button",_parent:"dropdown",title:"Menu Item",icon:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24"> <path d="M16.293 9.293 12 13.586 7.707 9.293l-1.414 1.414L12 16.414l5.707-5.707z"/> </svg>',styles:"#styles:,flex items-center gap-2 px-4 py-1"},{_type:"DropdownContent",_id:"content",_parent:"dropdown",styles:"#styles:,absolute left-0 w-80 mt-0.5 bg-white rounded-lg shadow-lg z-50"},{_type:"Link",_id:"link",_parent:"content",content:"Link",styles:"#styles:,flex items-center gap-2 px-4 py-1",link:{href:"https://www.google.com",type:"url",target:"_self"}}],category:"core",wrapper:!0,...t.registerChaiBlockSchema({properties:{showDropdown:t.runtimeProp({type:"boolean",title:"Show Dropdown",default:!1}),styles:t.StylesProp("relative w-max")}})},B={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"}},Fe=e=>{const{blockProps:s,children:o,styles:r,colSpan:l,tabletColSpan:i,desktopColSpan:a}=e,p={className:[m.get(r,"className",""),m.get(B,["SMALL",isNaN(l)||!l?6:l],""),i?m.get(B,["MEDIUM",i||l],""):"",a?m.get(B,["LARGE",i||l],""):""].join(" ")};return n.jsxRuntimeExports.jsx("div",{...s,...r,...p,children:o||n.jsxRuntimeExports.jsx("div",{className:"min-h-12 h-full w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},Ge={type:"Column",label:"Column",group:"basic",category:"core",icon:w.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...t.registerChaiBlockSchema({properties:{styles:t.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]}}})},Ve=e=>{const{blockProps:s,children:o,styles:r,gutter:l}=e,a={className:[m.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${l}px`:a.style={gap:`${l}px`},n.jsxRuntimeExports.jsx("div",{...s,...r,...a,children:o})},We={type:"Row",label:"Row",group:"basic",icon:w.Rows,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},Xe=()=>{t.registerChaiBlock(_,L),t.registerChaiBlock(T,$),t.registerChaiBlock(R,M),t.registerChaiBlock(A,z),t.registerChaiBlock(H,q),t.registerChaiBlock(U,O),t.registerChaiBlock(F,G),t.registerChaiBlock(V,W),t.registerChaiBlock(X,Y),t.registerChaiBlock(Z,J),t.registerChaiBlock(K,Q),t.registerChaiBlock(ee,te),t.registerChaiBlock(oe,se),t.registerChaiBlock(le,ne),t.registerChaiBlock(D,N),t.registerChaiBlock(pe,ue),t.registerChaiBlock(xe,be),t.registerChaiBlock(je,Se),t.registerChaiBlock(Pe,ve),t.registerChaiBlock(Ee,Ie),t.registerChaiBlock(Te,$e),t.registerChaiBlock(_e,Le),t.registerChaiBlock(Re,Me),t.registerChaiBlock(De,Ne),t.registerChaiBlock(Ae,ze),t.registerChaiBlock(Be,Ce),t.registerChaiBlock(ke,we),t.registerChaiBlock(ie,ae),t.registerChaiBlock(de,ye),t.registerChaiBlock(he,fe),t.registerChaiBlock(Ue,Oe),t.registerChaiBlock(Ve,We),t.registerChaiBlock(Fe,Ge)};exports.loadWebBlocks=Xe;
3
+ nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},U=e=>{const{blockProps:s,content:o,styles:r}=e;return n.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:n.jsxRuntimeExports.jsx("div",{...s,...r,dangerouslySetInnerHTML:{__html:o}})})},O={type:"RichText",label:"Rich Text",category:"core",icon:m.CursorTextIcon,group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.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"]},F=e=>{const{blockProps:s,styles:o,content:r,children:l=null,tag:i}=e;return l?h.createElement("span",{...o,...s},l):h.createElement(i||"span",{...o,...s,dangerouslySetInnerHTML:{__html:r||""}})},G={type:"Span",label:"Span",category:"core",group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0};function V(e){return x.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(e)}const W=e=>{const{scripts:s,inBuilder:o,blockProps:r}=e;return o?n.jsxRuntimeExports.jsx("div",{...r,children:n.jsxRuntimeExports.jsx("div",{className:x.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:n.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:n.jsxRuntimeExports.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"})})})}):n.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:s}})},X={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:V,group:"advanced",...t.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},Y=e=>n.jsxRuntimeExports.jsxs("div",{...e.blockProps,...e.styles,children:[e.mode,e.children]}),Z=e=>e.mode==="dark"?null:n.jsxRuntimeExports.jsx("button",{...e.blockProps,...e.styles,children:e.children});t.registerChaiBlock(Z,{type:"DarkModeButton",label:"Dark Mode Button",category:"core",icon:m.MoonIcon,group:"advanced",hidden:!0,...t.registerChaiBlockSchema({properties:{mode:t.closestBlockProp("DarkModeSwitcher","mode"),styles:t.stylesProp("")}})});const J=e=>e.mode==="light"?null:n.jsxRuntimeExports.jsx("button",{...e.blockProps,...e.styles,children:e.children});t.registerChaiBlock(J,{type:"LightModeButton",label:"Light Mode Button",category:"core",icon:m.SunIcon,group:"advanced",hidden:!0,...t.registerChaiBlockSchema({properties:{mode:t.closestBlockProp("DarkModeSwitcher","mode"),styles:t.stylesProp(""),fake:{type:"string",default:""}}})});const K={type:"DarkModeSwitcher",label:"web_blocks.dark_mode",category:"core",icon:m.MoonIcon,group:"advanced",wrapper:!0,...t.registerChaiBlockSchema({properties:{mode:{title:"Mode",type:"string",enum:["dark","light"],default:"light"},styles:t.stylesProp("")}}),blocks:()=>[{_id:"ultqCh",_type:"DarkModeSwitcher",mode:"light",styles:"#styles:,",_name:"Dark Mode Theme"},{_id:"vroabi",_parent:"ultqCh",_type:"LightModeButton",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"nltBrv",_parent:"vroabi",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"DarkModeButton",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white hidden dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"AdDwBC",_parent:"gesydi",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]},Q=e=>{const{blockProps:s,styles:o}=e;return k.createElement("hr",{...o,...s})},ee={type:"Divider",label:"web_blocks.divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},te=e=>{const{blockProps:s,inBuilder:o,children:r,globalBlock:l}=e;return o&&!l?n.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center py-4 bg-gray-100 rounded-lg gap-y-1 dark:bg-gray-800",...s,children:[n.jsxRuntimeExports.jsxs("h1",{children:["Global Block - ",l]}),n.jsxRuntimeExports.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):h.createElement("span",{...s},r)},oe={type:"GlobalBlock",label:"Global Block",icon:B.GlobeIcon,category:"core",group:"advanced",...t.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},E=(e,...s)=>({...e,className:x.cn(e.className,...s)}),se=e=>{const{blockProps:s,icon:o,styles:r,width:l,inBuilder:i,height:a}=e,c=E(r,"");if(g.isEmpty(o))return n.jsxRuntimeExports.jsx(w,{inBuilder:i,className:"h-8 w-14"});const p=o.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...s,...c,style:{width:l?`${l}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},re={type:"Icon",label:"web_blocks.icon",category:"core",icon:m.SketchLogoIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),icon:{type:"string",title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},le=e=>{const{blockProps:s,image:o,mobileImage:r,styles:l,alt:i,height:a,width:c,lazyLoading:p}=e;return g.isEmpty(o)?n.jsxRuntimeExports.jsx(w,{className:"h-36"}):n.jsxRuntimeExports.jsxs("picture",{children:[r&&n.jsxRuntimeExports.jsx("source",{srcSet:r,media:"(max-width: 480px)"}),n.jsxRuntimeExports.jsx("img",{...s,...l,src:o,alt:i,loading:p?"lazy":"eager",width:c,height:a})]})},ne={type:"Image",label:"Image",category:"core",icon:m.ImageIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}}}}),aiProps:["alt"],i18nProps:["alt"]},ie=e=>{const{blockProps:s,children:o,styles:r,inBuilder:l,content:i,href:a}=e,{hrefType:c,autoplay:p,maxWidth:d,backdropColor:y,galleryName:f}=e,u=E(r,"cb-lightbox");if(!o&&g.isEmpty(r==null?void 0:r.className)&&g.isEmpty(i))return n.jsxRuntimeExports.jsx(w,{inBuilder:l});if(l)return o?n.jsxRuntimeExports.jsx("span",{...s,...u,children:o}):h.createElement("span",{...s,...u,dangerouslySetInnerHTML:{__html:i}});const b={};return c!=="image"&&(b["data-vbtype"]=c),p&&(b["data-autoplay"]="true"),d&&(b["data-maxwidth"]=d+"px"),y&&(b["data-overlay"]=y),f&&(b["data-gall"]=f),o?n.jsxRuntimeExports.jsx("a",{...b,href:a||"#/",...s,...u,children:o}):h.createElement("a",{...s,...u,...b,href:a||"#",dangerouslySetInnerHTML:{__html:i}})},ae={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:m.ImageIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:"Link text or drop blocks inside"},hrefType:{type:"string",title:"Type",default:"image",enum:["image","video","iframe","inline","ajax"],enumNames:["Image","Video","Iframe","Inline","Ajax"]},href:{type:"string",title:"Href",default:""},autoplay:{type:"boolean",title:"Autoplay (Video only)",default:!1},maxWidth:{type:"number",title:"Max Width",default:""},backdropColor:{type:"string",title:"Backdrop Color",default:""},galleryName:{type:"string",title:"Gallery Name",default:""}},dependencies:{autoplay:["hrefType","video"]}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},ce=e=>{const{blockProps:s,link:o,children:r,styles:l,inBuilder:i,content:a}=e;let c={};return!r&&g.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),i?r?n.jsxRuntimeExports.jsx("span",{...s,style:c,...l,children:r}):k.createElement("span",{...s,...l,style:c},a):r?n.jsxRuntimeExports.jsx("a",{href:(o==null?void 0:o.href)||"#/",target:o==null?void 0:o.target,...s,...l,children:r}):k.createElement("a",{...s,...l,href:(o==null?void 0:o.href)||"#",target:(o==null?void 0:o.target)||"_self"},a)},pe={type:"Link",label:"Link",category:"core",icon:m.Link1Icon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},ue=e=>{const{blockProps:s,children:o,listType:r,styles:l,tag:i,inBuilder:a}=e,c=x.cn(g.get(l,"className",""),r);return!o&&g.isEmpty(l==null?void 0:l.className)?n.jsxRuntimeExports.jsx(w,{inBuilder:a}):h.createElement(i||(r==="list-decimal"?"ol":"ul"),{...s,...l,className:c},o)},de={type:"List",label:"web_blocks.list",icon:m.RowsIcon,category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},ge=e=>{const{blockProps:s,content:o,styles:r,children:l,tag:i}=e;return l?h.createElement(i||"li",{...r,...s},l):h.createElement(i||"li",{...r,...s,dangerouslySetInnerHTML:{__html:o}})},me={type:"ListItem",label:"List Item",icon:m.ColumnsIcon,category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.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"},ye=e=>e.inBuilder||e.forceWrapper?n.jsxRuntimeExports.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,he={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:m.SpaceBetweenVerticallyIcon,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("text-black"),content:{type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},S=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,P=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,v=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,fe=e=>{if(S.test(e)){const s=e.match(S);return s?`https://www.youtube.com/embed/${s[4]}`:e}if(P.test(e)){const s=e.match(P);return s?`https://player.vimeo.com/video/${s[3]}`:e}if(v.test(e)){const s=e.match(v);return s?`https://www.dailymotion.com/embed/video/${s[4]}`:e}return null},xe=h.memo(e=>{const{blockProps:s,inBuilder:o,styles:r,url:l,controls:i}=e,a=g.get(i,"autoPlay",!1),c=g.get(i,"controls",!1),p=a||g.get(i,"muted",!0),d=g.get(i,"loop",!1);if(g.isEmpty(l))return n.jsxRuntimeExports.jsx(w,{inBuilder:o,className:"h-36"});let y=fe(l),f=null;if(y){if(!g.isEmpty(y)){const u=[];u.push(`autoplay=${a?1:0}`),u.push(`controls=${i?1:0}`),u.push(`mute=${p?1:0}&muted=${p?1:0}`),u.push(`loop=${d?1:0}`),y=`${y}?${u.join("&")}`}f=h.createElement("iframe",{...s,className:"absolute inset-0 w-full h-full",src:y,allow:o?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else f=h.createElement("video",{...s,className:"absolute inset-0 w-full h-full",src:l,controls:c,muted:p,autoPlay:o?!1:a,loop:d});return n.jsxRuntimeExports.jsx("div",{...g.pick(r,["className"]),children:n.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[o?n.jsxRuntimeExports.jsx("div",{...s,...g.omit(r,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,f]})})}),be={type:"Video",label:"Video",category:"core",icon:m.VideoIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),url:{type:"string",title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"},controls:{type:"object",title:"Controls",default:{autoplay:!1,controls:!0,loop:!1,muted:!1},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}}}}}),i18nProps:["url"]},j={wrapper:{"x-data":"{ open: false }"},button:{"x-on:click":"open = !open"},menu:{"x-show":"open","x-on:click.away":"open = false","x-cloak":"","x-transition":""}},ke=e=>{const{blockProps:s,content:o,icon:r,iconWidth:l,iconHeight:i,styles:a,show:c}=e;return n.jsxRuntimeExports.jsxs("button",{...s,...a,...j.button,children:[o,n.jsxRuntimeExports.jsx("span",{className:c?"rotate-180":"",dangerouslySetInnerHTML:{__html:r},style:{width:l,height:i}})]})};t.registerChaiBlock(ke,{type:"DropdownButton",label:"Dropdown Button",group:"advanced",category:"core",hidden:!0,canMove:()=>!1,canDelete:()=>!1,...t.registerChaiBlockSchema({properties:{show:t.closestBlockProp("Dropdown","showDropdown"),content:{type:"string",title:"Title",default:"Menu Item"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconWidth:{type:"string",title:"Icon Width",default:"16px"},iconHeight:{type:"string",title:"Icon Height",default:"16px"},styles:t.StylesProp("flex items-center gap-2 px-4 py-1")}})});const we=e=>{const{blockProps:s,children:o,styles:r,show:l,inBuilder:i}=e;return i&&!l?null:n.jsxRuntimeExports.jsx("div",{...s,...j.menu,...r,children:o})};t.registerChaiBlock(we,{type:"DropdownContent",label:"Dropdown Content",group:"basic",hidden:!0,canMove:()=>!1,canDelete:()=>!1,canAcceptBlock:()=>!0,...t.registerChaiBlockSchema({properties:{show:t.closestBlockProp("Dropdown","showDropdown"),styles:t.StylesProp("absolute left-0 p-2 w-80 mt-2 bg-white rounded-lg shadow-lg z-50")}})});const Be=e=>{const{blockProps:s,children:o,styles:r}=e;return n.jsxRuntimeExports.jsx("div",{...s,...r,...j.wrapper,children:o})},Ce={type:"Dropdown",label:"Dropdown",group:"basic",icon:m.DropdownMenuIcon,blocks:()=>[{_type:"Dropdown",_id:"dropdown"},{_type:"DropdownButton",_id:"button",_parent:"dropdown",title:"Menu Item",icon:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24"> <path d="M16.293 9.293 12 13.586 7.707 9.293l-1.414 1.414L12 16.414l5.707-5.707z"/> </svg>',styles:"#styles:,flex items-center gap-2 px-4 py-1"},{_type:"DropdownContent",_id:"content",_parent:"dropdown",styles:"#styles:,absolute left-0 w-80 mt-0.5 bg-white rounded-lg shadow-lg z-50"},{_type:"Link",_id:"link",_parent:"content",content:"Link",styles:"#styles:,flex items-center gap-2 px-4 py-1",link:{href:"https://www.google.com",type:"url",target:"_self"}}],category:"core",wrapper:!0,...t.registerChaiBlockSchema({properties:{showDropdown:t.runtimeProp({type:"boolean",title:"Show Dropdown",default:!1}),styles:t.StylesProp("relative w-max")}})},je=e=>{const{blockProps:s,fieldName:o,label:r,styles:l,inputStyles:i,required:a,checked:c,showLabel:p=!0}=e,d=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...l,...s,children:[n.jsxRuntimeExports.jsx("input",{...i,name:o,id:d,type:"checkbox",required:a,defaultChecked:c}),r&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:r})]}):n.jsxRuntimeExports.jsx("input",{id:d,...s,...i,...l,type:"checkbox",required:a,name:o})},Se={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("flex items-center gap-x-2"),inputStyles:t.StylesProp(""),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"]},Pe=e=>{const{children:s,blockProps:o,errorMessage:r,successMessage:l,action:i,styles:a,inBuilder:c}=e;let p=s;s||(p=n.jsxRuntimeExports.jsx(w,{inBuilder:c}));const d={"x-data":"{}","x-on:submit.prevent":"post"},y={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return n.jsxRuntimeExports.jsxs("form",{...d,"data-error":r,"data-success":l,method:"post",action:i,...o,...a,children:[n.jsxRuntimeExports.jsx("div",{...y}),p]})},ve={type:"Form",label:"Form",category:"core",icon:B.GroupIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form/submit"},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},Ee=e=>{const{blockProps:s,inBuilder:o,label:r,styles:l,inputStyles:i,icon:a,iconSize:c,iconPos:p}=e,d=x.generateUUID(),y={"x-bind:disabled":"formLoading"};return n.jsxRuntimeExports.jsxs("button",{id:d,...y,...i,...l,...s||{},type:o?"button":"submit",children:[r,a&&n.jsxRuntimeExports.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},Ie={type:"FormButton",label:"Submit Button",category:"core",icon:m.ButtonIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:t.StylesProp(""),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},_e=e=>{const{blockProps:s,fieldName:o,label:r,placeholder:l,styles:i,inputStyles:a,showLabel:c,required:p,inputType:d}=e,y=x.generateUUID();return c?n.jsxRuntimeExports.jsxs("div",{...i,...s,children:[c&&n.jsxRuntimeExports.jsx("label",{htmlFor:y,children:r}),n.jsxRuntimeExports.jsx("input",{name:o,...a,id:y,type:d,placeholder:l,required:p})]}):n.jsxRuntimeExports.jsx("input",{id:y,name:o,...s,...a,...i,type:d,placeholder:l,required:p})},Le={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.StylesProp("w-full p-1"),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},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","file","hidden","range","submit","color","date","time"]}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Re=e=>{const{blockProps:s,content:o,styles:r,children:l}=e,i={...r,...s};return l?h.createElement("label",i,l):h.createElement("label",{...i,dangerouslySetInnerHTML:{__html:o}})},Me={type:"Label",label:"Label",category:"core",icon:m.LetterCaseToggleIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(),content:{type:"string",title:"Content",default:""}}})},De=e=>{const{blockProps:s,fieldName:o,label:r,styles:l,inputStyles:i,required:a,checked:c,showLabel:p=!0}=e,d=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...l,...s,children:[n.jsxRuntimeExports.jsx("input",{...i,name:o,id:d,type:"radio",required:a,defaultChecked:c}),r&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:r})]}):n.jsxRuntimeExports.jsx("input",{id:d,...s,...i,...l,type:"radio",required:a,checked:c,name:o})},Ne={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("flex items-center gap-x-2"),inputStyles:t.StylesProp(""),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"]},Te=e=>{const{blockProps:s,fieldName:o,label:r,placeholder:l,styles:i,inputStyles:a,required:c,showLabel:p,_multiple:d,options:y}=e,f=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...i,...s,children:[p&&n.jsxRuntimeExports.jsx("label",{htmlFor:f,children:r}),n.jsxRuntimeExports.jsxs("select",{...a,id:f,required:c,multiple:d,name:o,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),g.map(y,u=>n.jsxRuntimeExports.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})]}):n.jsxRuntimeExports.jsxs("select",{id:f,...i,...s,required:c,multiple:d,name:o,children:[n.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),g.map(y,u=>n.jsxRuntimeExports.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})},$e={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Ae=e=>{const{blockProps:s,fieldName:o,label:r,placeholder:l,styles:i,inputStyles:a,_rows:c,showLabel:p}=e,d=x.generateUUID();return p?n.jsxRuntimeExports.jsxs("div",{...i,...s,children:[p&&n.jsxRuntimeExports.jsx("label",{htmlFor:d,children:r}),n.jsxRuntimeExports.jsx("textarea",{name:o,...a,id:d,placeholder:l,rows:c})]}):n.jsxRuntimeExports.jsx("textarea",{id:d,name:o,...s,...a,...i,placeholder:l,rows:c})},ze={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.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}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},He=e=>{const{blockProps:s,backgroundImage:o,children:r,styles:l,tag:i}=e;let a={};return o&&(a={backgroundImage:`url(${o})`}),k.createElement(i||"div",{...s,...l,style:a},r)},qe={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("font-body antialiased"),backgroundImage:{type:"string",title:"Image",default:"",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Ue=e=>{const{blockProps:s,styles:o}=e;return k.createElement("br",{...s,...o})},Oe={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},C={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"}},Fe=e=>{const{blockProps:s,children:o,styles:r,colSpan:l,tabletColSpan:i,desktopColSpan:a}=e,p={className:[g.get(r,"className",""),g.get(C,["SMALL",isNaN(l)||!l?6:l],""),i?g.get(C,["MEDIUM",i||l],""):"",a?g.get(C,["LARGE",i||l],""):""].join(" ")};return n.jsxRuntimeExports.jsx("div",{...s,...r,...p,children:o||n.jsxRuntimeExports.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},Ge={type:"Column",label:"Column",group:"basic",category:"core",icon:B.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...t.registerChaiBlockSchema({properties:{styles:t.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]}}})},Ve=e=>{const{blockProps:s,children:o,styles:r,gutter:l}=e,a={className:[g.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${l}px`:a.style={gap:`${l}px`},n.jsxRuntimeExports.jsx("div",{...s,...r,...a,children:o})},We={type:"Row",label:"Row",group:"basic",icon:B.Rows,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},Xe=()=>{t.registerChaiBlock(_,L),t.registerChaiBlock(T,$),t.registerChaiBlock(R,M),t.registerChaiBlock(A,z),t.registerChaiBlock(H,q),t.registerChaiBlock(F,G),t.registerChaiBlock(U,O),t.registerChaiBlock(ce,pe),t.registerChaiBlock(ie,ae),t.registerChaiBlock(ue,de),t.registerChaiBlock(ge,me),t.registerChaiBlock(se,re),t.registerChaiBlock(le,ne),t.registerChaiBlock(xe,be),t.registerChaiBlock(D,N),t.registerChaiBlock(W,X),t.registerChaiBlock(ye,he),t.registerChaiBlock(Pe,ve),t.registerChaiBlock(Ee,Ie),t.registerChaiBlock(_e,Le),t.registerChaiBlock(je,Se),t.registerChaiBlock(De,Ne),t.registerChaiBlock(Te,$e),t.registerChaiBlock(Ae,ze),t.registerChaiBlock(Re,Me),t.registerChaiBlock(Ue,Oe),t.registerChaiBlock(He,qe),t.registerChaiBlock(Q,ee),t.registerChaiBlock(Y,K),t.registerChaiBlock(te,oe),t.registerChaiBlock(Be,Ce),t.registerChaiBlock(Ve,We),t.registerChaiBlock(Fe,Ge)};exports.loadWebBlocks=Xe;