@chaibuilder/sdk 2.3.8 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/render.cjs +2 -2
- package/dist/render.js +114 -103
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +335 -342
- package/package.json +1 -1
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./plugin-CSgw-f78.cjs"),p=require("./apply-binding-DpBwzIf9.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const y=require("./plugin-CSgw-f78.cjs"),p=require("./apply-binding-DpBwzIf9.cjs"),t=require("lodash-es"),q=require("@tailwindcss/aspect-ratio"),$=require("@tailwindcss/forms"),E=require("@tailwindcss/typography");require("tailwindcss-animate");const F=require("./get-chai-builder-theme-B1tr_NJB.cjs"),L=require("@mhsdesign/jit-browser-tailwindcss"),R=require("@tailwindcss/container-queries"),m=require("react/jsx-runtime"),u=require("react"),D=require("@chaibuilder/runtime");function M(e,a){const r=e.filter(({_type:n})=>n==="GlobalBlock"||n==="PartialBlock");for(let n=0;n<r.length;n++){const l=r[n],s=t.get(l,"partialBlockId",t.get(l,"globalBlock",""));if(s==="")continue;let i=t.cloneDeep(t.get(a,s,[]));l._parent&&(i==null?void 0:i.length)>0&&(i=i.map(c=>(t.isEmpty(c._parent)&&(c._parent=l._parent),c)));const o=e.indexOf(l);e.splice(o,1,...i)}return e}const O=e=>{if(!e)return[];try{return JSON.parse(j(e)).filter(r=>!r._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function j(e){const a=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(a,r=>{const n=decodeURIComponent(r),l=n.indexOf("public");return l!==-1?n.substring(l+6):n})}async function K(e,a,r=[],n="",l){return await L.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:r,theme:{extend:F.getChaiBuilderTheme(e)},plugins:[$,E,q,R,y.chaiBuilderPlugin],corePlugins:{preflight:l},...n?{prefix:`${n}`}:{}}}).generateStylesFromContent(` ${l?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
|
-
@tailwind utilities;`,
|
|
3
|
+
@tailwind utilities;`,a)}const A=(e,a,r)=>{const n=JSON.stringify(e).replace(/#styles:([^"]*)/g,(l,s)=>`#styles:${s.replace(/,/g," ")}`.replace(/#styles:/g,""));return K(a,[n],[],"",r)},N=async(e,a=y.defaultThemeOptions,r=!1)=>await A(e,a,r),_=new Map;function J(e){return JSON.stringify({blockType:t.omit(e.block,"_id","_name","_parent"),lang:e.lang})}async function V(e){const a={pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1},r=J(t.pick(a,["block","lang"]));let n=_.get(r);n||(n=Promise.resolve(e.dataProvider(a)),_.set(r,n),setTimeout(()=>{_.delete(r)},5*1e3));const l=await n;return t.has(l,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,l.$metadata),e.children({...t.omit(l,"$metadata")})}const U=()=>m.jsx("div",{}),W=e=>{const{block:a,lang:r,fallbackLang:n,children:l,externalData:s,blocks:i,draft:o,pageProps:c,dataProviderMetadataCallback:h}=e,d=D.getRegisteredChaiBlock(a._type),f=t.get(d,"component",null),k=t.get(e.repeaterData,"index",-1),C=t.get(e.repeaterData,"dataKey",""),w=r===n?"":r,g=p.applyBindingToBlockProps(p.applyLanguage(a,w,d),s,{index:k,key:C}),S=p.getBlockTagAttributes(a,!1),T=G(i,a._id,p.getBlockRuntimeProps(a._type)),v=t.has(d,"dataProvider")&&t.isFunction(d.dataProvider),P={...g,...S,...T},b={blockProps:{},inBuilder:!1,lang:r||n,...P};if(t.isNull(f))return null;if(v){const x=t.get(d,"suspenseFallback",U);return m.jsx(u.Suspense,{fallback:u.createElement(x),children:m.jsx(V,{lang:r,pageProps:c,block:P,dataProvider:d.dataProvider,...h?{dataProviderMetadataCallback:h}:{},draft:o,children:I=>u.createElement(f,{...b,...I,children:l({_id:a._id,_type:a._type,...t.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,a),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})})}return m.jsx(u.Suspense,{children:u.createElement(f,{...b,children:l({_id:a._id,_type:a._type,...t.isArray(g.repeaterItems)?{repeaterItems:p.applyLimit(g.repeaterItems,a),$repeaterItemsKey:g.$repeaterItemsKey}:{}})})})},B=e=>{const{blocks:a,parent:r,repeaterData:n}=e;let l=t.uniqBy(t.filter(a,i=>t.has(i,"_id")&&(t.isEmpty(r)?!i._parent:i._parent===r)),"_id");const s=i=>t.filter(a,o=>o._parent===i).length>0;return t.map(l,i=>i?u.createElement(W,{...e,key:i._id,block:i},({_id:o,_type:c,repeaterItems:h,$repeaterItemsKey:d})=>c==="Repeater"?t.isArray(h)&&h.map((f,k)=>u.createElement(B,{...e,parent:i._id,key:`${t.get(i,"_parent","root")}-${i._id}-${k}`,repeaterData:{index:k,dataKey:d}})):s(o)?u.createElement(B,{...e,parent:i._id,key:`${t.get(i,"_parent","root")}-${i._id}`,repeaterData:n}):null):null)},G=(e,a,r)=>t.isEmpty(r)?{}:Object.entries(r).reduce((n,[l,s])=>{const i=[];let o=t.find(e,{_id:a});for(;o;)i.push(o),o=t.find(e,{_id:o._parent});const c=t.find(i,{_type:s.block});return c&&(n[l]=t.get(c,t.get(s,"prop"),null)),n},{});function z(e){if(t.isEmpty(e.lang)&&!t.isEmpty(e.fallbackLang))throw new Error("lang prop is required when fallbackLang is provided");if(t.isEmpty(e.blocks))return null;const a=e.lang??"en",r=e.fallbackLang??a;return m.jsx(B,{...e,lang:a,fallbackLang:r})}exports.getChaiThemeCssVariables=y.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=y.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=y.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=p.applyChaiDataBinding;exports.RenderChaiBlocks=z;exports.convertToBlocks=O;exports.getMergedPartialBlocks=M;exports.getStylesForBlocks=N;
|
package/dist/render.js
CHANGED
|
@@ -1,54 +1,54 @@
|
|
|
1
|
-
import { d as F, c as
|
|
2
|
-
import { a as
|
|
3
|
-
import { a as
|
|
4
|
-
import { e as
|
|
5
|
-
import { get as s, cloneDeep as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
1
|
+
import { d as F, c as M } from "./plugin-BOcGV_IY.js";
|
|
2
|
+
import { a as Ie, b as $e, e as Te } from "./plugin-BOcGV_IY.js";
|
|
3
|
+
import { a as A, b as N, g as J, c as E, d as v } from "./apply-binding-CkrtJykq.js";
|
|
4
|
+
import { e as De } from "./apply-binding-CkrtJykq.js";
|
|
5
|
+
import { get as s, cloneDeep as j, isEmpty as g, pick as q, has as B, isFunction as I, omit as $, isNull as U, isArray as P, uniqBy as V, filter as S, map as W, find as y } from "lodash-es";
|
|
6
|
+
import G from "@tailwindcss/aspect-ratio";
|
|
7
|
+
import z from "@tailwindcss/forms";
|
|
8
|
+
import H from "@tailwindcss/typography";
|
|
9
9
|
import "tailwindcss-animate";
|
|
10
|
-
import { g as
|
|
11
|
-
import { createTailwindcss as
|
|
12
|
-
import
|
|
13
|
-
import { jsx as
|
|
14
|
-
import { Suspense as
|
|
15
|
-
import { getRegisteredChaiBlock as
|
|
16
|
-
function
|
|
17
|
-
const
|
|
18
|
-
for (let
|
|
19
|
-
const i = r
|
|
20
|
-
if (
|
|
21
|
-
let
|
|
22
|
-
i._parent && (
|
|
23
|
-
const
|
|
24
|
-
e.splice(
|
|
10
|
+
import { g as Q } from "./get-chai-builder-theme-BarMkcGH.js";
|
|
11
|
+
import { createTailwindcss as X } from "@mhsdesign/jit-browser-tailwindcss";
|
|
12
|
+
import Y from "@tailwindcss/container-queries";
|
|
13
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
14
|
+
import { Suspense as x, createElement as u } from "react";
|
|
15
|
+
import { getRegisteredChaiBlock as Z } from "@chaibuilder/runtime";
|
|
16
|
+
function Be(e, t) {
|
|
17
|
+
const a = e.filter(({ _type: r }) => r === "GlobalBlock" || r === "PartialBlock");
|
|
18
|
+
for (let r = 0; r < a.length; r++) {
|
|
19
|
+
const i = a[r], o = s(i, "partialBlockId", s(i, "globalBlock", ""));
|
|
20
|
+
if (o === "") continue;
|
|
21
|
+
let n = j(s(t, o, []));
|
|
22
|
+
i._parent && (n == null ? void 0 : n.length) > 0 && (n = n.map((c) => (g(c._parent) && (c._parent = i._parent), c)));
|
|
23
|
+
const l = e.indexOf(i);
|
|
24
|
+
e.splice(l, 1, ...n);
|
|
25
25
|
}
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const we = (e) => {
|
|
29
29
|
if (!e) return [];
|
|
30
30
|
try {
|
|
31
|
-
return JSON.parse(
|
|
31
|
+
return JSON.parse(ee(e)).filter((a) => !a._type.startsWith("@chai"));
|
|
32
32
|
} catch {
|
|
33
33
|
return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
|
-
function
|
|
36
|
+
function ee(e) {
|
|
37
37
|
const t = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
|
|
38
|
-
return e.replace(t, (
|
|
39
|
-
const
|
|
40
|
-
return i !== -1 ?
|
|
38
|
+
return e.replace(t, (a) => {
|
|
39
|
+
const r = decodeURIComponent(a), i = r.indexOf("public");
|
|
40
|
+
return i !== -1 ? r.substring(i + 6) : r;
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
async function
|
|
44
|
-
return await
|
|
43
|
+
async function te(e, t, a = [], r = "", i) {
|
|
44
|
+
return await X({
|
|
45
45
|
tailwindConfig: {
|
|
46
46
|
darkMode: "class",
|
|
47
|
-
safelist:
|
|
48
|
-
theme: { extend:
|
|
49
|
-
plugins: [
|
|
47
|
+
safelist: a,
|
|
48
|
+
theme: { extend: Q(e) },
|
|
49
|
+
plugins: [z, H, G, Y, M],
|
|
50
50
|
corePlugins: { preflight: i },
|
|
51
|
-
...
|
|
51
|
+
...r ? { prefix: `${r}` } : {}
|
|
52
52
|
}
|
|
53
53
|
}).generateStylesFromContent(
|
|
54
54
|
` ${i ? "@tailwind base;" : ""}
|
|
@@ -57,57 +57,68 @@ async function Z(e, t, r = [], n = "", i) {
|
|
|
57
57
|
t
|
|
58
58
|
);
|
|
59
59
|
}
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
return
|
|
63
|
-
},
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
const ae = (e, t, a) => {
|
|
61
|
+
const r = JSON.stringify(e).replace(/#styles:([^"]*)/g, (i, o) => `#styles:${o.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
|
|
62
|
+
return te(t, [r], [], "", a);
|
|
63
|
+
}, Ce = async (e, t = F, a = !1) => await ae(e, t, a), _ = /* @__PURE__ */ new Map();
|
|
64
|
+
function re(e) {
|
|
65
|
+
return JSON.stringify({
|
|
66
|
+
blockType: $(e.block, "_id", "_name", "_parent"),
|
|
67
|
+
lang: e.lang
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
async function ne(e) {
|
|
71
|
+
const t = {
|
|
66
72
|
pageProps: e.pageProps,
|
|
67
73
|
block: e.block,
|
|
68
74
|
lang: e.lang,
|
|
69
75
|
draft: e.draft,
|
|
70
76
|
inBuilder: !1
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
}, a = re(q(t, ["block", "lang"]));
|
|
78
|
+
let r = _.get(a);
|
|
79
|
+
r || (r = Promise.resolve(e.dataProvider(t)), _.set(a, r), setTimeout(() => {
|
|
80
|
+
_.delete(a);
|
|
81
|
+
}, 5 * 1e3));
|
|
82
|
+
const i = await r;
|
|
83
|
+
return B(i, "$metadata") && I(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, i.$metadata), e.children({
|
|
84
|
+
...$(i, "$metadata")
|
|
74
85
|
});
|
|
75
86
|
}
|
|
76
|
-
const
|
|
77
|
-
const { block: t, lang:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{ index: k, key:
|
|
81
|
-
),
|
|
87
|
+
const ie = () => /* @__PURE__ */ f("div", {}), oe = (e) => {
|
|
88
|
+
const { block: t, lang: a, fallbackLang: r, children: i, externalData: o, blocks: n, draft: l, pageProps: c, dataProviderMetadataCallback: m } = e, d = Z(t._type), h = s(d, "component", null), k = s(e.repeaterData, "index", -1), T = s(e.repeaterData, "dataKey", ""), p = A(
|
|
89
|
+
N(t, a === r ? "" : a, d),
|
|
90
|
+
o,
|
|
91
|
+
{ index: k, key: T }
|
|
92
|
+
), L = J(t, !1), D = le(n, t._id, E(t._type)), K = B(d, "dataProvider") && I(d.dataProvider), w = {
|
|
82
93
|
...p,
|
|
83
|
-
|
|
84
|
-
...
|
|
85
|
-
},
|
|
94
|
+
...L,
|
|
95
|
+
...D
|
|
96
|
+
}, C = {
|
|
86
97
|
blockProps: {},
|
|
87
98
|
inBuilder: !1,
|
|
88
|
-
lang:
|
|
89
|
-
...
|
|
99
|
+
lang: a || r,
|
|
100
|
+
...w
|
|
90
101
|
};
|
|
91
|
-
if (
|
|
92
|
-
if (
|
|
93
|
-
const
|
|
94
|
-
return /* @__PURE__ */
|
|
95
|
-
|
|
102
|
+
if (U(h)) return null;
|
|
103
|
+
if (K) {
|
|
104
|
+
const O = s(d, "suspenseFallback", ie);
|
|
105
|
+
return /* @__PURE__ */ f(x, { fallback: u(O), children: /* @__PURE__ */ f(
|
|
106
|
+
ne,
|
|
96
107
|
{
|
|
97
|
-
lang:
|
|
108
|
+
lang: a,
|
|
98
109
|
pageProps: c,
|
|
99
|
-
block:
|
|
110
|
+
block: w,
|
|
100
111
|
dataProvider: d.dataProvider,
|
|
101
|
-
...
|
|
102
|
-
draft:
|
|
103
|
-
children: (R) =>
|
|
104
|
-
...
|
|
112
|
+
...m ? { dataProviderMetadataCallback: m } : {},
|
|
113
|
+
draft: l,
|
|
114
|
+
children: (R) => u(h, {
|
|
115
|
+
...C,
|
|
105
116
|
...R,
|
|
106
117
|
children: i({
|
|
107
118
|
_id: t._id,
|
|
108
119
|
_type: t._type,
|
|
109
|
-
...
|
|
110
|
-
repeaterItems:
|
|
120
|
+
...P(p.repeaterItems) ? {
|
|
121
|
+
repeaterItems: v(p.repeaterItems, t),
|
|
111
122
|
$repeaterItemsKey: p.$repeaterItemsKey
|
|
112
123
|
} : {}
|
|
113
124
|
})
|
|
@@ -115,64 +126,64 @@ const ae = () => /* @__PURE__ */ m("div", {}), re = (e) => {
|
|
|
115
126
|
}
|
|
116
127
|
) });
|
|
117
128
|
}
|
|
118
|
-
return /* @__PURE__ */
|
|
119
|
-
...
|
|
129
|
+
return /* @__PURE__ */ f(x, { children: u(h, {
|
|
130
|
+
...C,
|
|
120
131
|
children: i({
|
|
121
132
|
_id: t._id,
|
|
122
133
|
_type: t._type,
|
|
123
|
-
...
|
|
124
|
-
repeaterItems:
|
|
134
|
+
...P(p.repeaterItems) ? {
|
|
135
|
+
repeaterItems: v(p.repeaterItems, t),
|
|
125
136
|
$repeaterItemsKey: p.$repeaterItemsKey
|
|
126
137
|
} : {}
|
|
127
138
|
})
|
|
128
139
|
}) });
|
|
129
140
|
}, b = (e) => {
|
|
130
|
-
const { blocks: t, parent:
|
|
131
|
-
let i =
|
|
132
|
-
S(t, (
|
|
141
|
+
const { blocks: t, parent: a, repeaterData: r } = e;
|
|
142
|
+
let i = V(
|
|
143
|
+
S(t, (n) => B(n, "_id") && (g(a) ? !n._parent : n._parent === a)),
|
|
133
144
|
"_id"
|
|
134
145
|
);
|
|
135
|
-
const
|
|
136
|
-
return
|
|
146
|
+
const o = (n) => S(t, (l) => l._parent === n).length > 0;
|
|
147
|
+
return W(i, (n) => n ? /* @__PURE__ */ u(oe, { ...e, key: n._id, block: n }, ({ _id: l, _type: c, repeaterItems: m, $repeaterItemsKey: d }) => c === "Repeater" ? P(m) && m.map((h, k) => /* @__PURE__ */ u(
|
|
137
148
|
b,
|
|
138
149
|
{
|
|
139
150
|
...e,
|
|
140
|
-
parent:
|
|
141
|
-
key: `${s(
|
|
151
|
+
parent: n._id,
|
|
152
|
+
key: `${s(n, "_parent", "root")}-${n._id}-${k}`,
|
|
142
153
|
repeaterData: { index: k, dataKey: d }
|
|
143
154
|
}
|
|
144
|
-
)) : l
|
|
155
|
+
)) : o(l) ? /* @__PURE__ */ u(
|
|
145
156
|
b,
|
|
146
157
|
{
|
|
147
158
|
...e,
|
|
148
|
-
parent:
|
|
149
|
-
key: `${s(
|
|
150
|
-
repeaterData:
|
|
159
|
+
parent: n._id,
|
|
160
|
+
key: `${s(n, "_parent", "root")}-${n._id}`,
|
|
161
|
+
repeaterData: r
|
|
151
162
|
}
|
|
152
163
|
) : null) : null);
|
|
153
|
-
},
|
|
154
|
-
const
|
|
155
|
-
let
|
|
156
|
-
for (;
|
|
157
|
-
|
|
158
|
-
const c = y(
|
|
159
|
-
return c && (
|
|
164
|
+
}, le = (e, t, a) => g(a) ? {} : Object.entries(a).reduce((r, [i, o]) => {
|
|
165
|
+
const n = [];
|
|
166
|
+
let l = y(e, { _id: t });
|
|
167
|
+
for (; l; )
|
|
168
|
+
n.push(l), l = y(e, { _id: l._parent });
|
|
169
|
+
const c = y(n, { _type: o.block });
|
|
170
|
+
return c && (r[i] = s(c, s(o, "prop"), null)), r;
|
|
160
171
|
}, {});
|
|
161
|
-
function
|
|
162
|
-
if (
|
|
172
|
+
function ve(e) {
|
|
173
|
+
if (g(e.lang) && !g(e.fallbackLang))
|
|
163
174
|
throw new Error("lang prop is required when fallbackLang is provided");
|
|
164
|
-
if (
|
|
175
|
+
if (g(e.blocks))
|
|
165
176
|
return null;
|
|
166
|
-
const t = e.lang ?? "en",
|
|
167
|
-
return /* @__PURE__ */
|
|
177
|
+
const t = e.lang ?? "en", a = e.fallbackLang ?? t;
|
|
178
|
+
return /* @__PURE__ */ f(b, { ...e, lang: t, fallbackLang: a });
|
|
168
179
|
}
|
|
169
180
|
export {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
181
|
+
ve as RenderChaiBlocks,
|
|
182
|
+
De as applyChaiDataBinding,
|
|
183
|
+
we as convertToBlocks,
|
|
184
|
+
Ie as getChaiThemeCssVariables,
|
|
185
|
+
Be as getMergedPartialBlocks,
|
|
186
|
+
Ce as getStylesForBlocks,
|
|
187
|
+
$e as getThemeFontsCSSImport,
|
|
188
|
+
Te as getThemeFontsLinkMarkup
|
|
178
189
|
};
|
package/dist/web-blocks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),b=require("./common-functions-BZmyleS1.cjs"),x=require("react"),m=require("@radix-ui/react-icons"),d=require("lodash-es"),B=require("lucide-react");function _(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const g=_(x),C=({className:e="",inBuilder:o})=>o?i.jsx("div",{className:b.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,T=e=>{const{blockProps:o,inBuilder:t,backgroundImage:r,children:s,tag:n="div",styles:a}=e;let c=s;s||(c=i.jsx(C,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),g.createElement(n,{...o,...a,style:p},c)},E={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.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},N=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:n,children:a,iconPos:c,link:p,inBuilder:u}=e,f=r,y=a||i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),f&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:f}})]}),k=x.createElement("button",{...o,...n,type:"button","aria-label":s},y);return d.isEmpty(d.get(p,"href"))?k:u?i.jsx("span",{children:k}):i.jsx("a",{"aria-label":s,href:d.get(p,"href")||"/",target:d.get(p,"target","_self"),children:k})},R={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:m.ButtonIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),i18nProps:["content"],aiProps:["content"]},M=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:n}=e,a=r,c=i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),a&&i.jsx("div",{style:{width:t+"px"},dangerouslySetInnerHTML:{__html:a}})]});return x.createElement("button",{...o,...n,type:"button","aria-label":s},c)},A={type:"CopyButton",description:"A copy button component",label:"Copy Button",category:"core",icon:m.CopyIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("p-2 rounded-md flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-copy'><path d='M8 17L19 8M8 17V7a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v10'/></svg>",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:20}}}),i18nProps:["content"],aiProps:["content"]},$=e=>{const{blockProps:o,styles:t,htmlCode:r,inBuilder:s}=e;return s?i.jsxs("div",{className:"relative",children:[s?i.jsx("div",{...o,...t,className:"absolute z-20 h-full w-full"}):null,g.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):g.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:r}})},H={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:m.CodeIcon,group:"advanced",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},D=e=>{const{scripts:o,inBuilder:t,blockProps:r}=e;return t?i.jsx("div",{...r,children:i.jsx("div",{className:b.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},U={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:B.FileCode,group:"advanced",...l.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},z=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},V={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},q=e=>{const{blockProps:o,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),g.createElement("div",{...o,...t,style:s})},F={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},O=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,u=b.generateUUID();return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...n,name:t,id:u,type:"checkbox",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:u,children:r})]}):i.jsx("input",{id:u,...o,...n,...s,type:"checkbox",required:a,name:t,defaultChecked:c})},G={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},Y=e=>{const{children:o,blockProps:t,errorMessage:r,successMessage:s,action:n,styles:a,inBuilder:c}=e;let p=o;o||(p=i.jsx(C,{inBuilder:c}));const u={"x-data":"{}","x-on:submit.prevent":"post"},f={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...u,"data-error":r,"data-success":s,method:"post",action:n,...t,...a,children:[i.jsx("div",{...f}),p]})},W={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,"}],...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},X=e=>{const{blockProps:o,inBuilder:t,label:r,styles:s,icon:n,iconSize:a,iconPos:c}=e,p=b.generateUUID();return i.jsxs("button",{id:p,...s,...o||{},type:t?"button":"submit","aria-label":r,children:[r,n&&i.jsx("div",{style:{width:a+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:n}})]})},J={type:"FormButton",label:"Submit Button",category:"core",icon:m.ButtonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},Q=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},Z=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,showLabel:c,required:p,inputType:u,defaultValue:f}=e,y=b.generateUUID(),{type:k,autocomplete:S}=Q(u);return c?i.jsxs("div",{...n,...o,children:[c&&i.jsx("label",{htmlFor:y,children:r}),i.jsx("input",{name:t,defaultValue:f,...a,id:y,type:k,placeholder:s,required:p,autoComplete:S})]}):i.jsx("input",{id:y,name:t,...o,...a,...n,type:k,placeholder:s,required:p,autoComplete:S,defaultValue:f})},K={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ee=e=>{const{blockProps:o,content:t,styles:r,children:s}=e,n={...r,...o};return s?g.createElement("label",n,s):g.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},te={type:"Label",label:"Label",category:"core",icon:m.LetterCaseToggleIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},oe=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,u=b.generateUUID();return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...n,name:t,id:u,type:"radio",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:u,children:r})]}):i.jsx("input",{id:u,...o,...n,...s,type:"radio",required:a,checked:c,name:t})},le={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},re=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:u,options:f,defaultValue:y}=e,k=b.generateUUID(),S=u&&y?y.split(",").map(h=>h.trim()):y||"";return p?i.jsxs("div",{...n,...o,children:[p&&i.jsx("label",{htmlFor:k,children:r}),i.jsxs("select",{...a,id:k,required:c,multiple:u,name:t,defaultValue:S,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(f,h=>i.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})]}):i.jsxs("select",{id:k,...n,...o,required:c,multiple:u,name:t,defaultValue:S,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(f,h=>i.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})},se={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ie=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,rows:c,showLabel:p,required:u,defaultValue:f}=e,y=b.generateUUID();return p?i.jsxs("div",{...n,...o,children:[p&&i.jsx("label",{htmlFor:y,children:r}),i.jsx("textarea",{name:t,...a,id:y,placeholder:s,rows:c,required:u,defaultValue:f})]}):i.jsx("textarea",{id:y,name:t,...o,...a,...n,placeholder:s,rows:c,required:u,defaultValue:f})},ne={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ae=e=>{const{blockProps:o,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Global Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):g.createElement("span",{...o},r)},ce={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:B.GlobeIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},pe=e=>{const{blockProps:o,styles:t,content:r,tag:s="h1",children:n=null}=e;return n?g.createElement(s,{...t,...o},n):g.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:r}})},de={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:m.HeadingIcon,group:"typography",...l.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:l.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"},ue=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},me={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},ye=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("table",{...o,...r},t):i.jsx(C,{})},ge=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("thead",{...o,...r},t):i.jsx(C,{})},he=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tbody",{...o,...r},t):i.jsx(C,{})},fe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tr",{...o,...r},t):i.jsx(C,{})},be=e=>{const{blockProps:o,children:t,content:r,styles:s}=e;return!t&&d.isEmpty(r)?i.jsx(C,{}):t?x.createElement("td",{...o,...s},t):x.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:r}})};l.registerChaiBlock(ye,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:m.TableIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:w("Table")});l.registerChaiBlock(ge,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:m.BorderTopIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:w("TableHead")});l.registerChaiBlock(he,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:m.BorderAllIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:w("TableBody")});l.registerChaiBlock(fe,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:m.ViewHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:w("TableRow")});l.registerChaiBlock(be,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:m.DragHandleHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:w("TableCell"),i18nProps:["content"],aiProps:["content"]});function w(e){const o=(n,a)=>({_id:b.generateUUID(),_parent:n,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+a}`}),t=n=>{const a=b.generateUUID(),c={_type:"TableRow",_id:a,styles:"#styles:,border-b"};return n&&(c._parent=n),[c,o(a,"1"),o(a,"2"),o(a,"3")]},r=n=>{const a=b.generateUUID(),c={_id:a,_type:"TableHead",styles:"#styles:,font-medium"};return n&&(c._parent=n),[c,...t(a)]},s=n=>{const a=b.generateUUID(),c={_id:a,_type:"TableBody",styles:"#styles:,"};return n&&(c._parent=n),[c,...t(a),...t(a)]};if(e==="Table"){const n=b.generateUUID();return[{_id:n,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(n),...s(n)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const j=(e,...o)=>({...e,className:b.cn(e.className,...o)}),ke=e=>{const{blockProps:o,icon:t,styles:r,width:s,inBuilder:n,height:a}=e,c=j(r,"");if(d.isEmpty(t))return i.jsx(C,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return g.createElement("span",{...o,...c,style:{width:s?`${s}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},xe={type:"Icon",label:"web_blocks.icon",category:"core",icon:m.SketchLogoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.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"}}})},Ce=e=>{const{blockProps:o,image:t,mobileImage:r,styles:s,alt:n,height:a,width:c,lazyLoading:p}=e;return d.isEmpty(t)?i.jsx(C,{className:"h-36"}):i.jsxs("picture",{children:[r&&i.jsx("source",{srcSet:r,media:"(max-width: 480px)"}),i.jsx("img",{...o,...s,src:t,alt:n,loading:p?"lazy":"eager",width:c,height:a})]})},Be={type:"Image",description:"A image component",label:"Image",category:"core",icon:m.ImageIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},assetId:{type:"string",title:"Asset ID",default:"",ui:{"ui:widget":"hidden"}}}}),aiProps:["alt"],i18nProps:["alt"]},Se=e=>{const{blockProps:o,link:t,children:r,styles:s,inBuilder:n,content:a}=e;let c={};return!r&&d.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?r?i.jsx("span",{role:"link",...o,style:c,...s,children:r}):x.createElement("span",{...o,...s,style:c,role:"link"},a):r?i.jsx("a",{"aria-label":a,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:r}):x.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":a},a)},we={type:"Link",description:"A link component",label:"Link",category:"core",icon:m.Link1Icon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.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"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},Pe=e=>{const{blockProps:o,children:t,listType:r,styles:s,tag:n,inBuilder:a}=e,c=b.cn(d.get(s,"className",""),r);return!t&&d.isEmpty(s==null?void 0:s.className)?i.jsx(C,{inBuilder:a}):g.createElement(n||(r==="list-decimal"?"ol":"ul"),{...o,...s,className:c},t)},ve={type:"List",description:"A list component",label:"List",icon:m.RowsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.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"}]},Ie=e=>{const{blockProps:o,content:t,styles:r,children:s,tag:n}=e;return s?g.createElement(n||"li",{...r,...o},s):g.createElement(n||"li",{...r,...o,dangerouslySetInnerHTML:{__html:t}})},Le={type:"ListItem",description:"A list item component",label:"List Item",icon:m.ColumnsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},je=e=>{const{blockProps:o,styles:t,content:r}=e;return d.isNull(e.children)?g.createElement("p",{...t,...o,dangerouslySetInnerHTML:{__html:r}}):g.createElement("p",{...t,...o},e.children)},_e={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:m.TextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},Te=e=>{const{blockProps:o,inBuilder:t,children:r,partialBlockId:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Partial Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):g.createElement("span",{...o},r)},Ee={type:"PartialBlock",description:"A partial block component",label:"Partial Block",icon:B.GlobeIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},P={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"}},Ne=e=>{const{blockProps:o,children:t,styles:r,colSpan:s,tabletColSpan:n,desktopColSpan:a}=e,p={className:[d.get(r,"className",""),d.get(P,["SMALL",isNaN(s)||!s?6:s],""),n?d.get(P,["MEDIUM",n||s],""):"",a?d.get(P,["LARGE",n||s],""):""].join(" ")};return i.jsx("div",{...o,...r,...p,children:t||i.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},Re={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:B.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...l.registerChaiBlockSchema({properties:{styles:l.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]}}})},Me=e=>{const{blockProps:o,children:t,styles:r,gutter:s}=e,a={className:[d.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:a.style={gap:`${s}px`},i.jsx("div",{...o,...r,...a,children:t})},Ae={type:"Row",description:"A row component",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",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},$e=e=>{const{blockProps:o,content:t,styles:r}=e,s=j(r,"prose dark:prose-invert prose-p:m-0 prose-p:min-h-[1rem] prose-blockquote:m-2 prose-blockquote:ml-4 prose-ul:m-0 prose-ol:m-0 prose-li:m-0","max-w-full");return i.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},He={type:"RichText",description:"A rich text block",label:"Rich Text",category:"core",icon:m.CursorTextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.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"]},De=e=>{const{blockProps:o,styles:t,content:r,children:s=null,tag:n}=e;return s?g.createElement("span",{...t,...o},s):g.createElement(n||"span",{...t,...o,dangerouslySetInnerHTML:{__html:r||""}})},Ue={type:"Span",description:"A span component",label:"Span",category:"core",group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},ze=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,Ve={type:"Text",description:"A text component with no styling",label:"Text",hidden:!0,category:"core",group:"typography",icon:m.SpaceBetweenVerticallyIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},v={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},I=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,L=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,qe=(e,o)=>{const t=d.get(o,"autoplay",!1),r=d.get(o,"controls",!1),s=d.get(o,"loop",!1),n=t||d.get(o,"muted",!0);if(I.test(e)){const a=e.match(I);if(a){const c=a[4];let p=`https://www.youtube.com/embed/${c}`,u=t?"autoplay=1":"";return u+=s?`&loop=1&playlist=${c}`:"",u+=n?"&mute=1&muted=1":"",u+=r?"&controls=1":"&controls=0",`${p}?${u}`}}if(L.test(e)){const a=e.match(L);if(a){const c=a[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=n?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Fe=e=>{const{url:o,blockProps:t,styles:r,controls:s,videoSource:n,inBuilder:a}=e,c=qe(o,s);return i.jsxs("div",{...d.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&a?i.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:d.isEmpty(o)?`Provided ${n} video link in settings Video URL.`:`Provided ${n} video link is invalid.`}):i.jsx("iframe",{width:"100%",src:c,...d.pick(r,"className")}),a&&i.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Oe=e=>{const{url:o,styles:t,controls:r,sources:s,poster:n,blockProps:a}=e;let c=n;const p=[...d.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&p.push({url:o,width:"9999"});const u=p.sort((y,k)=>parseInt(y.width)-parseInt(k.width)).filter(y=>!d.isEmpty(y.url)&&!d.isEmpty(y.width));u.length===0&&!c&&(c="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const f=d.get(r,"autoplay",!1)||d.get(r,"muted",!0);return(c||!d.isEmpty(u))&&i.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...a,key:JSON.stringify(u),controls:d.get(r,"controls",!1),autoPlay:d.get(r,"autoplay",!1),loop:d.get(r,"loop",!1),poster:c,...f?{muted:!0}:{}},u.map(y=>{if(!y.url||y.url.length<4||isNaN(y.width))return null;const k=`(max-width: ${y.width}px)`;return i.jsx("source",{src:y.url,media:k,type:y.type},y.url)}),"Your browser does not support the video tag.")})},Ge=e=>{const{videoSource:o}=e;return o==="Custom"?i.jsx(Oe,{...e}):o==="Youtube"||o==="Vimeo"?i.jsx(Fe,{...e}):i.jsxs("div",{children:["Invalid video source : ",o]})},Ye={type:"Video",label:"Video",category:"core",icon:m.VideoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"}},allOf:[{if:{properties:{videoSource:{const:"Custom"}}},then:{properties:{url:{type:"string",title:"Video URL",default:""},poster:{type:"string",title:"Poster URL",default:""},sources:{type:"object",default:{srcsets:[]}},controls:{...v}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...v}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...v}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},We=e=>{const{children:o,tag:t,styles:r,blockProps:s,inBuilder:n,$loading:a}=e;let c=o;return d.isEmpty(c)&&n&&(c=i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?a&&n?Array.from({length:2}).map((p,u)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},u)):c:g.createElement(t,{...s,...r},a&&n?Array.from({length:2}).map((p,u)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},u)):c)},Xe={type:"Repeater",label:"Repeater",icon:m.LoopIcon,group:"basic",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},limit:{title:"Limit",type:"number",default:3},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}}}})},Je=({children:e,blockProps:o,styles:t,parentTag:r,inBuilder:s})=>{let n="li";switch(r){case"ul":n="li";break;case"ol":n="li";break;default:n="div"}return!e&&s?g.createElement(n,{...o,...t},i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):g.createElement(n,{...o,...t},e)},Qe={type:"RepeaterItem",label:"Repeater Item",icon:m.LoopIcon,hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp(""),parentTag:l.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Ze=({children:e,blockProps:o,styles:t})=>g.createElement("div",{...o,...t},e),Ke={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},et=()=>{l.registerChaiBlock(T,E),l.registerChaiBlock(q,F),l.registerChaiBlock(N,R),l.registerChaiBlock(pe,de),l.registerChaiBlock(je,_e),l.registerChaiBlock(De,Ue),l.registerChaiBlock($e,He),l.registerChaiBlock(Se,we),l.registerChaiBlock(Pe,ve),l.registerChaiBlock(Ie,Le),l.registerChaiBlock(ke,xe),l.registerChaiBlock(Ce,Be),l.registerChaiBlock(Ge,Ye),l.registerChaiBlock($,H),l.registerChaiBlock(D,U),l.registerChaiBlock(ze,Ve),l.registerChaiBlock(Y,W),l.registerChaiBlock(X,J),l.registerChaiBlock(Z,K),l.registerChaiBlock(O,G),l.registerChaiBlock(oe,le),l.registerChaiBlock(re,se),l.registerChaiBlock(ie,ne),l.registerChaiBlock(ee,te),l.registerChaiBlock(ue,me),l.registerChaiBlock(z,V),l.registerChaiBlock(ae,ce),l.registerChaiBlock(Te,Ee),l.registerChaiBlock(Me,Ae),l.registerChaiBlock(Ne,Re),l.registerChaiBlock(M,A),l.registerChaiBlock(We,Xe),l.registerChaiBlock(Je,Qe),l.registerChaiBlock(Ze,Ke)};exports.loadWebBlocks=et;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),C=require("./common-functions-BZmyleS1.cjs"),f=require("react"),u=require("@radix-ui/react-icons"),d=require("lodash-es"),B=require("lucide-react");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const y=j(f),x=({className:e="",inBuilder:o})=>o?i.jsx("div",{className:C.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,_=e=>{const{blockProps:o,inBuilder:t,backgroundImage:r,children:s,tag:n="div",styles:a}=e;let c=s;s||(c=i.jsx(x,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),y.createElement(n,{...o,...a,style:p},c)},T={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},E=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:n,children:a,iconPos:c,link:p,inBuilder:m}=e,b=r,g=a||i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),b&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:b}})]}),k=f.createElement("button",{...o,...n,type:"button","aria-label":s},g);return d.isEmpty(d.get(p,"href"))?k:m?i.jsx("span",{children:k}):i.jsx("a",{"aria-label":s,href:d.get(p,"href")||"/",target:d.get(p,"target","_self"),children:k})},N={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:u.ButtonIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),i18nProps:["content"],aiProps:["content"]},R=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:n}=e,a=r,c=i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:s}),a&&i.jsx("div",{style:{width:t+"px"},dangerouslySetInnerHTML:{__html:a}})]});return f.createElement("button",{...o,...n,type:"button","aria-label":s},c)},M={type:"CopyButton",description:"A copy button component",label:"Copy Button",category:"core",icon:u.CopyIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("p-2 rounded-md flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' class='lucide lucide-copy'><path d='M8 17L19 8M8 17V7a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v10'/></svg>",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:20}}}),i18nProps:["content"],aiProps:["content"]},A=e=>{const{blockProps:o,styles:t,htmlCode:r,inBuilder:s}=e;return s?i.jsxs("div",{className:"relative",children:[s?i.jsx("div",{...o,...t,className:"absolute z-20 h-full w-full"}):null,y.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):y.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:r}})},$={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:u.CodeIcon,group:"advanced",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},H=e=>{const{scripts:o,inBuilder:t,blockProps:r}=e;return t?i.jsx("div",{...r,children:i.jsx("div",{className:C.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},z={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:B.FileCode,group:"advanced",...l.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},D=e=>{const{blockProps:o,styles:t}=e;return f.createElement("hr",{...t,...o})},U={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:u.DividerHorizontalIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},V=e=>{const{blockProps:o,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),y.createElement("div",{...o,...t,style:s})},q={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},F=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...n,name:t,type:"checkbox",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...n,...s,type:"checkbox",required:a,defaultChecked:c})},O={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:u.CheckboxIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},G=e=>{const{children:o,blockProps:t,errorMessage:r,successMessage:s,action:n,styles:a,inBuilder:c}=e;let p=o;o||(p=i.jsx(x,{inBuilder:c}));const m={"x-data":"{}","x-on:submit.prevent":"post"},b={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...m,"data-error":r,"data-success":s,method:"post",action:n,...t,...a,children:[i.jsx("div",{...b}),p]})},Y={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,"}],...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},W=e=>{const{blockProps:o,inBuilder:t,label:r,styles:s,icon:n,iconSize:a,iconPos:c}=e;return i.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":r,children:[r,n&&i.jsx("div",{style:{width:a+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:n}})]})},X={type:"FormButton",label:"Submit Button",category:"core",icon:u.ButtonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},J=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},Q=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,showLabel:c,required:p,inputType:m,defaultValue:b}=e,{type:g,autocomplete:k}=J(m);return c?i.jsxs("div",{...n,...o,children:[c&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("input",{name:t,defaultValue:b,...a,type:g,placeholder:s,required:p,autoComplete:k})]}):i.jsx("input",{name:t,...o,...a,...n,type:g,placeholder:s,required:p,autoComplete:k,defaultValue:b})},Z={type:"Input",label:"web_blocks.input",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},K=e=>{const{blockProps:o,content:t,styles:r,children:s}=e,n={...r,...o};return s?y.createElement("label",n,s):y.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},ee={type:"Label",label:"Label",category:"core",icon:u.LetterCaseToggleIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},te=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...n,name:t,type:"radio",required:a,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...n,...s,type:"radio",required:a,checked:c})},oe={type:"Radio",label:"web_blocks.radio",category:"core",icon:u.RadiobuttonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},le=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:m,options:b,defaultValue:g}=e,k=m&&g?g.split(",").map(h=>h.trim()):g||"";return p?i.jsxs("div",{...n,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsxs("select",{...a,required:c,multiple:m,name:t,defaultValue:k,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(b,h=>i.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})]}):i.jsxs("select",{...n,...o,required:c,multiple:m,name:t,defaultValue:k,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(b,h=>i.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})},re={type:"Select",label:"web_blocks.select",category:"core",icon:u.DropdownMenuIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},se=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:n,inputStyles:a,rows:c,showLabel:p,required:m,defaultValue:b}=e;return p?i.jsxs("div",{...n,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("textarea",{name:t,...a,placeholder:s,rows:c,required:m,defaultValue:b})]}):i.jsx("textarea",{name:t,...o,...a,...n,placeholder:s,rows:c,required:m,defaultValue:b})},ie={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ne=e=>{const{blockProps:o,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Global Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},ae={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:B.GlobeIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},ce=e=>{const{blockProps:o,styles:t,content:r,tag:s="h1",children:n=null}=e;return n?y.createElement(s,{...t,...o},n):y.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:r}})},pe={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:u.HeadingIcon,group:"typography",...l.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:l.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"},de=e=>{const{blockProps:o,styles:t}=e;return f.createElement("br",{...o,...t})},ue={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},me=e=>{const{blockProps:o,children:t,styles:r}=e;return t?f.createElement("table",{...o,...r},t):i.jsx(x,{})},ye=e=>{const{blockProps:o,children:t,styles:r}=e;return t?f.createElement("thead",{...o,...r},t):i.jsx(x,{})},ge=e=>{const{blockProps:o,children:t,styles:r}=e;return t?f.createElement("tbody",{...o,...r},t):i.jsx(x,{})},he=e=>{const{blockProps:o,children:t,styles:r}=e;return t?f.createElement("tr",{...o,...r},t):i.jsx(x,{})},be=e=>{const{blockProps:o,children:t,content:r,styles:s}=e;return!t&&d.isEmpty(r)?i.jsx(x,{}):t?f.createElement("td",{...o,...s},t):f.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:r}})};l.registerChaiBlock(me,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:u.TableIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:S("Table")});l.registerChaiBlock(ye,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:u.BorderTopIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:S("TableHead")});l.registerChaiBlock(ge,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:u.BorderAllIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:S("TableBody")});l.registerChaiBlock(he,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:u.ViewHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:S("TableRow")});l.registerChaiBlock(be,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:u.DragHandleHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:S("TableCell"),i18nProps:["content"],aiProps:["content"]});function S(e){const o=(n,a)=>({_id:C.generateUUID(),_parent:n,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+a}`}),t=n=>{const a=C.generateUUID(),c={_type:"TableRow",_id:a,styles:"#styles:,border-b"};return n&&(c._parent=n),[c,o(a,"1"),o(a,"2"),o(a,"3")]},r=n=>{const a=C.generateUUID(),c={_id:a,_type:"TableHead",styles:"#styles:,font-medium"};return n&&(c._parent=n),[c,...t(a)]},s=n=>{const a=C.generateUUID(),c={_id:a,_type:"TableBody",styles:"#styles:,"};return n&&(c._parent=n),[c,...t(a),...t(a)]};if(e==="Table"){const n=C.generateUUID();return[{_id:n,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(n),...s(n)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const I=(e,...o)=>({...e,className:C.cn(e.className,...o)}),fe=e=>{const{blockProps:o,icon:t,styles:r,width:s,inBuilder:n,height:a}=e,c=I(r,"");if(d.isEmpty(t))return i.jsx(x,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return y.createElement("span",{...o,...c,style:{width:s?`${s}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},ke={type:"Icon",label:"web_blocks.icon",category:"core",icon:u.SketchLogoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.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"}}})},xe=e=>{const{blockProps:o,image:t,mobileImage:r,styles:s,alt:n,height:a,width:c,lazyLoading:p}=e;return d.isEmpty(t)?i.jsx(x,{className:"h-36"}):i.jsxs("picture",{children:[r&&i.jsx("source",{srcSet:r,media:"(max-width: 480px)"}),i.jsx("img",{...o,...s,src:t,alt:n,loading:p?"lazy":"eager",width:c,height:a})]})},Ce={type:"Image",description:"A image component",label:"Image",category:"core",icon:u.ImageIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},assetId:{type:"string",title:"Asset ID",default:"",ui:{"ui:widget":"hidden"}}}}),aiProps:["alt"],i18nProps:["alt"]},Be=e=>{const{blockProps:o,link:t,children:r,styles:s,inBuilder:n,content:a}=e;let c={};return!r&&d.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?r?i.jsx("span",{role:"link",...o,style:c,...s,children:r}):f.createElement("span",{...o,...s,style:c,role:"link"},a):r?i.jsx("a",{"aria-label":a,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:r}):f.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":a},a)},Se={type:"Link",description:"A link component",label:"Link",category:"core",icon:u.Link1Icon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.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"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},we=e=>{const{blockProps:o,children:t,listType:r,styles:s,tag:n,inBuilder:a}=e,c=C.cn(d.get(s,"className",""),r);return!t&&d.isEmpty(s==null?void 0:s.className)?i.jsx(x,{inBuilder:a}):y.createElement(n||(r==="list-decimal"?"ol":"ul"),{...o,...s,className:c},t)},Pe={type:"List",description:"A list component",label:"List",icon:u.RowsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.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"}]},ve=e=>{const{blockProps:o,content:t,styles:r,children:s,tag:n}=e;return s?y.createElement(n||"li",{...r,...o},s):y.createElement(n||"li",{...r,...o,dangerouslySetInnerHTML:{__html:t}})},Le={type:"ListItem",description:"A list item component",label:"List Item",icon:u.ColumnsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},Ie=e=>{const{blockProps:o,styles:t,content:r}=e;return d.isNull(e.children)?y.createElement("p",{...t,...o,dangerouslySetInnerHTML:{__html:r}}):y.createElement("p",{...t,...o},e.children)},je={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:u.TextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},_e=e=>{const{blockProps:o,inBuilder:t,children:r,partialBlockId:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Partial Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},Te={type:"PartialBlock",description:"A partial block component",label:"Partial Block",icon:B.GlobeIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},w={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},Ee=e=>{const{blockProps:o,children:t,styles:r,colSpan:s,tabletColSpan:n,desktopColSpan:a}=e,p={className:[d.get(r,"className",""),d.get(w,["SMALL",isNaN(s)||!s?6:s],""),n?d.get(w,["MEDIUM",n||s],""):"",a?d.get(w,["LARGE",n||s],""):""].join(" ")};return i.jsx("div",{...o,...r,...p,children:t||i.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},Ne={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:B.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...l.registerChaiBlockSchema({properties:{styles:l.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]}}})},Re=e=>{const{blockProps:o,children:t,styles:r,gutter:s}=e,a={className:[d.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:a.style={gap:`${s}px`},i.jsx("div",{...o,...r,...a,children:t})},Me={type:"Row",description:"A row component",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",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},Ae=e=>{const{blockProps:o,content:t,styles:r}=e,s=I(r,"prose dark:prose-invert prose-p:m-0 prose-p:min-h-[1rem] prose-blockquote:m-2 prose-blockquote:ml-4 prose-ul:m-0 prose-ol:m-0 prose-li:m-0","max-w-full");return i.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},$e={type:"RichText",description:"A rich text block",label:"Rich Text",category:"core",icon:u.CursorTextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},He=e=>{const{blockProps:o,styles:t,content:r,children:s=null,tag:n}=e;return s?y.createElement("span",{...t,...o},s):y.createElement(n||"span",{...t,...o,dangerouslySetInnerHTML:{__html:r||""}})},ze={type:"Span",description:"A span component",label:"Span",category:"core",group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},De=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,Ue={type:"Text",description:"A text component with no styling",label:"Text",hidden:!0,category:"core",group:"typography",icon:u.SpaceBetweenVerticallyIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},P={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},v=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,L=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,Ve=(e,o)=>{const t=d.get(o,"autoplay",!1),r=d.get(o,"controls",!1),s=d.get(o,"loop",!1),n=t||d.get(o,"muted",!0);if(v.test(e)){const a=e.match(v);if(a){const c=a[4];let p=`https://www.youtube.com/embed/${c}`,m=t?"autoplay=1":"";return m+=s?`&loop=1&playlist=${c}`:"",m+=n?"&mute=1&muted=1":"",m+=r?"&controls=1":"&controls=0",`${p}?${m}`}}if(L.test(e)){const a=e.match(L);if(a){const c=a[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=n?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},qe=e=>{const{url:o,blockProps:t,styles:r,controls:s,videoSource:n,inBuilder:a}=e,c=Ve(o,s);return i.jsxs("div",{...d.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&a?i.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:d.isEmpty(o)?`Provided ${n} video link in settings Video URL.`:`Provided ${n} video link is invalid.`}):i.jsx("iframe",{width:"100%",src:c,...d.pick(r,"className")}),a&&i.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Fe=e=>{const{url:o,styles:t,controls:r,sources:s,poster:n,blockProps:a}=e;let c=n;const p=[...d.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&p.push({url:o,width:"9999"});const m=p.sort((g,k)=>parseInt(g.width)-parseInt(k.width)).filter(g=>!d.isEmpty(g.url)&&!d.isEmpty(g.width));m.length===0&&!c&&(c="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const b=d.get(r,"autoplay",!1)||d.get(r,"muted",!0);return(c||!d.isEmpty(m))&&i.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:f.createElement("video",{...t,...a,key:JSON.stringify(m),controls:d.get(r,"controls",!1),autoPlay:d.get(r,"autoplay",!1),loop:d.get(r,"loop",!1),poster:c,...b?{muted:!0}:{}},m.map(g=>{if(!g.url||g.url.length<4||isNaN(g.width))return null;const k=`(max-width: ${g.width}px)`;return i.jsx("source",{src:g.url,media:k,type:g.type},g.url)}),"Your browser does not support the video tag.")})},Oe=e=>{const{videoSource:o}=e;return o==="Custom"?i.jsx(Fe,{...e}):o==="Youtube"||o==="Vimeo"?i.jsx(qe,{...e}):i.jsxs("div",{children:["Invalid video source : ",o]})},Ge={type:"Video",label:"Video",category:"core",icon:u.VideoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"}},allOf:[{if:{properties:{videoSource:{const:"Custom"}}},then:{properties:{url:{type:"string",title:"Video URL",default:""},poster:{type:"string",title:"Poster URL",default:""},sources:{type:"object",default:{srcsets:[]}},controls:{...P}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...P}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...P}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},Ye=e=>{const{children:o,tag:t,styles:r,blockProps:s,inBuilder:n,$loading:a}=e;let c=o;return d.isEmpty(c)&&n&&(c=i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?a&&n?Array.from({length:2}).map((p,m)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},m)):c:y.createElement(t,{...s,...r},a&&n?Array.from({length:2}).map((p,m)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},m)):c)},We={type:"Repeater",label:"Repeater",icon:u.LoopIcon,group:"basic",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},limit:{title:"Limit",type:"number",default:3},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}}}})},Xe=({children:e,blockProps:o,styles:t,parentTag:r,inBuilder:s})=>{let n="li";switch(r){case"ul":n="li";break;case"ol":n="li";break;default:n="div"}return!e&&s?y.createElement(n,{...o,...t},i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):y.createElement(n,{...o,...t},e)},Je={type:"RepeaterItem",label:"Repeater Item",icon:u.LoopIcon,hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp(""),parentTag:l.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Qe=({children:e,blockProps:o,styles:t})=>y.createElement("div",{...o,...t},e),Ze={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Ke=()=>{l.registerChaiBlock(_,T),l.registerChaiBlock(V,q),l.registerChaiBlock(E,N),l.registerChaiBlock(ce,pe),l.registerChaiBlock(Ie,je),l.registerChaiBlock(He,ze),l.registerChaiBlock(Ae,$e),l.registerChaiBlock(Be,Se),l.registerChaiBlock(we,Pe),l.registerChaiBlock(ve,Le),l.registerChaiBlock(fe,ke),l.registerChaiBlock(xe,Ce),l.registerChaiBlock(Oe,Ge),l.registerChaiBlock(A,$),l.registerChaiBlock(H,z),l.registerChaiBlock(De,Ue),l.registerChaiBlock(G,Y),l.registerChaiBlock(W,X),l.registerChaiBlock(Q,Z),l.registerChaiBlock(F,O),l.registerChaiBlock(te,oe),l.registerChaiBlock(le,re),l.registerChaiBlock(se,ie),l.registerChaiBlock(K,ee),l.registerChaiBlock(de,ue),l.registerChaiBlock(D,U),l.registerChaiBlock(ne,ae),l.registerChaiBlock(_e,Te),l.registerChaiBlock(Re,Me),l.registerChaiBlock(Ee,Ne),l.registerChaiBlock(R,M),l.registerChaiBlock(Ye,We),l.registerChaiBlock(Xe,Je),l.registerChaiBlock(Qe,Ze)};exports.loadWebBlocks=Ke;
|