@chaibuilder/sdk 3.0.8 → 3.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apply-binding-C4AQBX3p.cjs +1 -0
- package/dist/apply-binding-CSYk-NOA.js +641 -0
- package/dist/core.cjs +4 -4
- package/dist/core.js +1172 -1080
- package/dist/render.cjs +2 -2
- package/dist/render.d.ts +1 -15
- package/dist/render.js +92 -66
- package/dist/web-blocks.cjs +1 -1
- package/dist/web-blocks.js +75 -63
- package/package.json +2 -3
- package/dist/apply-binding-HQ9gBNJP.cjs +0 -1
- package/dist/apply-binding-tfi-KyyV.js +0 -573
package/dist/render.cjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./plugin-CSgw-f78.cjs"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("./plugin-CSgw-f78.cjs"),g=require("./apply-binding-C4AQBX3p.cjs"),t=require("lodash-es"),q=require("@tailwindcss/aspect-ratio"),L=require("@tailwindcss/forms"),E=require("@tailwindcss/typography");require("tailwindcss-animate");const $=require("./get-chai-builder-theme-B1tr_NJB.cjs"),F=require("@mhsdesign/jit-browser-tailwindcss"),R=require("@tailwindcss/container-queries"),m=require("react/jsx-runtime"),u=require("react"),M=require("@chaibuilder/runtime");function j(e,a){const r=e.filter(({_type:i})=>i==="GlobalBlock"||i==="PartialBlock");for(let i=0;i<r.length;i++){const o=r[i],c=t.get(o,"partialBlockId",t.get(o,"globalBlock",""));if(c==="")continue;let s=t.cloneDeep(t.get(a,c,[]));o._parent&&(s==null?void 0:s.length)>0&&(s=s.map(l=>(t.isEmpty(l._parent)&&(l._parent=o._parent),l)));const n=e.indexOf(o);e.splice(n,1,...s)}return e}const D=e=>{if(!e)return[];try{return JSON.parse(A(e)).filter(r=>!r._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(e){const a=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(a,r=>{const i=decodeURIComponent(r),o=i.indexOf("public");return o!==-1?i.substring(o+6):i})}async function O(e,a=[],r=!1){return await F.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:a,theme:{extend:{...$.getChaiBuilderTheme(),keyframes:{"accordion-down":{from:{height:"0"},to:{height:"var(--radix-accordion-content-height)"}},"accordion-up":{from:{height:"var(--radix-accordion-content-height)"},to:{height:"0"}}},animation:{"accordion-down":"accordion-down 0.2s ease-out","accordion-up":"accordion-up 0.2s ease-out"}}},plugins:[L,E,q,R,k.chaiBuilderPlugin],corePlugins:{preflight:r}}}).generateStylesFromContent(` ${r?"@tailwind base;":""}
|
|
2
2
|
@tailwind components;
|
|
3
|
-
@tailwind utilities;`,
|
|
3
|
+
@tailwind utilities;`,e)}const K=(e,a)=>{const r=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return O([r],[],a)},N=async(e,a=!1)=>await K(e,a);async function J(e){const a={pageProps:e.pageProps,block:e.block,lang:e.lang,draft:e.draft,inBuilder:!1},r=await e.dataProvider(a);return t.has(r,"$metadata")&&t.isFunction(e.dataProviderMetadataCallback)&&e.dataProviderMetadataCallback(e.block,r.$metadata),e.children({...t.omit(r,"$metadata")})}const H=()=>m.jsx("div",{}),V=e=>{const{block:a,lang:r,fallbackLang:i,children:o,externalData:c,blocks:s,draft:n,pageProps:l,dataProviderMetadataCallback:y}=e,d=M.getRegisteredChaiBlock(a._type),h=t.get(d,"component",null),P=t.get(e.repeaterData,"index",-1),f=t.get(e.repeaterData,"dataKey",""),b=r===i?"":r,p=g.applyBindingToBlockProps(g.applyLanguage(a,b,d),c,{index:P,key:f}),C=g.getBlockTagAttributes(a,!1),S=U(s,a._id,g.getBlockRuntimeProps(a._type)),v=t.has(d,"dataProvider")&&t.isFunction(d.dataProvider),B={...p,...C,...S},w={blockProps:{},inBuilder:!1,lang:r||i,...B},T=t.get(B,"_show",!0);if(t.isNull(h)||!T)return null;if(v){const x=t.get(d,"suspenseFallback",H);return m.jsx(u.Suspense,{fallback:u.createElement(x),children:m.jsx(J,{lang:r,pageProps:l,block:B,dataProvider:d.dataProvider,...y?{dataProviderMetadataCallback:y}:{},draft:n,children:I=>u.createElement(h,{...w,...I,children:o({_id:a._id,_type:a._type,...t.isArray(p.repeaterItems)?{repeaterItems:g.applyLimit(p.repeaterItems,a),$repeaterItemsKey:p.$repeaterItemsKey}:{}})})})})}return m.jsx(u.Suspense,{children:u.createElement(h,{...w,children:o({_id:a._id,_type:a._type,...t.isArray(p.repeaterItems)?{repeaterItems:g.applyLimit(p.repeaterItems,a),$repeaterItemsKey:p.$repeaterItemsKey}:{}})})})},_=e=>{const{blocks:a,parent:r,repeaterData:i,type:o}=e;let c=t.uniqBy(t.filter(a,n=>t.has(n,"_id")&&(t.isEmpty(r)?!n._parent:n._parent===r)),"_id");const s=n=>t.filter(a,l=>l._parent===n).length>0;return(o==="Heading"||o==="Paragraph"||o==="Link")&&(c=g.adjustSpacingInContentBlocks(c)),t.map(c,n=>n?u.createElement(V,{...e,key:n._id,block:n},({_id:l,_type:y,repeaterItems:d,$repeaterItemsKey:h})=>y==="Repeater"?t.isArray(d)&&d.map((P,f)=>u.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}-${f}`,repeaterData:{index:f,dataKey:h}})):s(l)?u.createElement(_,{...e,parent:n._id,key:`${t.get(n,"_parent","root")}-${n._id}`,repeaterData:i,type:n._type}):null):null)},U=(e,a,r)=>t.isEmpty(r)?{}:Object.entries(r).reduce((i,[o,c])=>{const s=[];let n=t.find(e,{_id:a});for(;n;)s.push(n),n=t.find(e,{_id:n._parent});const l=t.find(s,{_type:c.block});return l&&(i[o]=t.get(l,t.get(c,"prop"),null)),i},{});function W(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(_,{...e,lang:a,fallbackLang:r})}exports.getChaiThemeCssVariables=k.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=k.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=k.getThemeFontsLinkMarkup;exports.applyChaiDataBinding=g.applyChaiDataBinding;exports.convertHTMLToChaiBlocks=g.getBlocksFromHTML;exports.RenderChaiBlocks=W;exports.convertToBlocks=D;exports.getMergedPartialBlocks=j;exports.getStylesForBlocks=N;
|
package/dist/render.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
|
4
4
|
|
|
5
5
|
export declare const applyChaiDataBinding: (block: Record<string, string>, pageExternalData: Record<string, any>) => any;
|
|
6
6
|
|
|
7
|
-
declare type BorderRadiusValue = false | string;
|
|
8
|
-
|
|
9
7
|
declare type ChaiBlock<T = Record<string, any>> = {
|
|
10
8
|
_id: string;
|
|
11
9
|
_name?: string;
|
|
@@ -15,15 +13,6 @@ declare type ChaiBlock<T = Record<string, any>> = {
|
|
|
15
13
|
_libBlock?: string;
|
|
16
14
|
} & T;
|
|
17
15
|
|
|
18
|
-
declare type ChaiBuilderThemeOptions = {
|
|
19
|
-
fontFamily: false | Record<VariableKey, string>;
|
|
20
|
-
borderRadius: BorderRadiusValue;
|
|
21
|
-
colors: false | {
|
|
22
|
-
group: string;
|
|
23
|
-
items: Record<VariableKey, [HSLColor, HSLColor]>;
|
|
24
|
-
}[];
|
|
25
|
-
};
|
|
26
|
-
|
|
27
16
|
declare type ChaiThemeValues = {
|
|
28
17
|
fontFamily: {
|
|
29
18
|
heading: string;
|
|
@@ -74,11 +63,10 @@ export declare function getMergedPartialBlocks(blocks: ChaiBlock[], partials: Re
|
|
|
74
63
|
/**
|
|
75
64
|
* Get the tailwind css for the blocks
|
|
76
65
|
* @param blocks - The blocks to get the tailwind css for
|
|
77
|
-
* @param themeOptions - The theme options to use
|
|
78
66
|
* @param includeBaseStyles - Whether to include the base styles
|
|
79
67
|
* @returns The tailwind css for the blocks
|
|
80
68
|
*/
|
|
81
|
-
export declare const getStylesForBlocks: (blocks: ChaiBlock[],
|
|
69
|
+
export declare const getStylesForBlocks: (blocks: ChaiBlock[], includeBaseStyles?: boolean) => Promise<string>;
|
|
82
70
|
|
|
83
71
|
export declare const getThemeFontsCSSImport: (fonts: ChaiFontViaUrl[]) => any;
|
|
84
72
|
|
|
@@ -101,8 +89,6 @@ declare type RenderChaiBlocksProps = {
|
|
|
101
89
|
dataProviderMetadataCallback?: (block: ChaiBlock, meta: Record<string, any>) => void;
|
|
102
90
|
};
|
|
103
91
|
|
|
104
|
-
declare type VariableKey = string;
|
|
105
|
-
|
|
106
92
|
export { }
|
|
107
93
|
|
|
108
94
|
declare global {
|
package/dist/render.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { c as K } from "./plugin-BOcGV_IY.js";
|
|
2
2
|
import { a as Se, b as xe, e as Ie } from "./plugin-BOcGV_IY.js";
|
|
3
|
-
import { a as M, b as
|
|
4
|
-
import {
|
|
5
|
-
import { get as s, cloneDeep as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
3
|
+
import { a as M, b as O, g as A, c as N, d as v, e as J } from "./apply-binding-CSYk-NOA.js";
|
|
4
|
+
import { f as Le, h as Te } from "./apply-binding-CSYk-NOA.js";
|
|
5
|
+
import { get as s, cloneDeep as j, isEmpty as g, has as b, isFunction as I, omit as E, isNull as q, isArray as B, uniqBy as H, filter as S, map as U, find as _ } from "lodash-es";
|
|
6
|
+
import V from "@tailwindcss/aspect-ratio";
|
|
7
|
+
import W from "@tailwindcss/forms";
|
|
8
|
+
import G from "@tailwindcss/typography";
|
|
9
9
|
import "tailwindcss-animate";
|
|
10
10
|
import { g as z } from "./get-chai-builder-theme-BarMkcGH.js";
|
|
11
11
|
import { createTailwindcss as Q } from "@mhsdesign/jit-browser-tailwindcss";
|
|
12
12
|
import X from "@tailwindcss/container-queries";
|
|
13
13
|
import { jsx as m } from "react/jsx-runtime";
|
|
14
|
-
import { Suspense as
|
|
14
|
+
import { Suspense as x, createElement as u } from "react";
|
|
15
15
|
import { getRegisteredChaiBlock as Y } from "@chaibuilder/runtime";
|
|
16
16
|
function Be(e, t) {
|
|
17
17
|
const a = e.filter(({ _type: n }) => n === "GlobalBlock" || n === "PartialBlock");
|
|
18
18
|
for (let n = 0; n < a.length; n++) {
|
|
19
|
-
const i = a[n],
|
|
20
|
-
if (
|
|
21
|
-
let
|
|
22
|
-
i._parent && (
|
|
23
|
-
const
|
|
24
|
-
e.splice(
|
|
19
|
+
const i = a[n], c = s(i, "partialBlockId", s(i, "globalBlock", ""));
|
|
20
|
+
if (c === "") continue;
|
|
21
|
+
let o = j(s(t, c, []));
|
|
22
|
+
i._parent && (o == null ? void 0 : o.length) > 0 && (o = o.map((l) => (g(l._parent) && (l._parent = i._parent), l)));
|
|
23
|
+
const r = e.indexOf(i);
|
|
24
|
+
e.splice(r, 1, ...o);
|
|
25
25
|
}
|
|
26
26
|
return e;
|
|
27
27
|
}
|
|
@@ -40,27 +40,52 @@ function Z(e) {
|
|
|
40
40
|
return i !== -1 ? n.substring(i + 6) : n;
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
|
-
async function ee(e, t
|
|
43
|
+
async function ee(e, t = [], a = !1) {
|
|
44
44
|
return await Q({
|
|
45
45
|
tailwindConfig: {
|
|
46
46
|
darkMode: "class",
|
|
47
|
-
safelist:
|
|
48
|
-
theme: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
safelist: t,
|
|
48
|
+
theme: {
|
|
49
|
+
extend: {
|
|
50
|
+
...z(),
|
|
51
|
+
keyframes: {
|
|
52
|
+
"accordion-down": {
|
|
53
|
+
from: {
|
|
54
|
+
height: "0"
|
|
55
|
+
},
|
|
56
|
+
to: {
|
|
57
|
+
height: "var(--radix-accordion-content-height)"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"accordion-up": {
|
|
61
|
+
from: {
|
|
62
|
+
height: "var(--radix-accordion-content-height)"
|
|
63
|
+
},
|
|
64
|
+
to: {
|
|
65
|
+
height: "0"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
animation: {
|
|
70
|
+
"accordion-down": "accordion-down 0.2s ease-out",
|
|
71
|
+
"accordion-up": "accordion-up 0.2s ease-out"
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
plugins: [W, G, V, X, K],
|
|
76
|
+
corePlugins: { preflight: a }
|
|
52
77
|
}
|
|
53
78
|
}).generateStylesFromContent(
|
|
54
|
-
` ${
|
|
79
|
+
` ${a ? "@tailwind base;" : ""}
|
|
55
80
|
@tailwind components;
|
|
56
81
|
@tailwind utilities;`,
|
|
57
|
-
|
|
82
|
+
e
|
|
58
83
|
);
|
|
59
84
|
}
|
|
60
|
-
const te = (e, t
|
|
61
|
-
const
|
|
62
|
-
return ee(
|
|
63
|
-
}, be = async (e, t =
|
|
85
|
+
const te = (e, t) => {
|
|
86
|
+
const a = JSON.stringify(e).replace(/#styles:([^"]*)/g, (n, i) => `#styles:${i.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
|
|
87
|
+
return ee([a], [], t);
|
|
88
|
+
}, be = async (e, t = !1) => await te(e, t);
|
|
64
89
|
async function ae(e) {
|
|
65
90
|
const t = {
|
|
66
91
|
pageProps: e.pageProps,
|
|
@@ -69,45 +94,45 @@ async function ae(e) {
|
|
|
69
94
|
draft: e.draft,
|
|
70
95
|
inBuilder: !1
|
|
71
96
|
}, a = await e.dataProvider(t);
|
|
72
|
-
return b(a, "$metadata") &&
|
|
73
|
-
...
|
|
97
|
+
return b(a, "$metadata") && I(e.dataProviderMetadataCallback) && e.dataProviderMetadataCallback(e.block, a.$metadata), e.children({
|
|
98
|
+
...E(a, "$metadata")
|
|
74
99
|
});
|
|
75
100
|
}
|
|
76
101
|
const re = () => /* @__PURE__ */ m("div", {}), ne = (e) => {
|
|
77
|
-
const { block: t, lang: a, fallbackLang: n, children: i, externalData:
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
{ index:
|
|
81
|
-
), $ =
|
|
102
|
+
const { block: t, lang: a, fallbackLang: n, children: i, externalData: c, blocks: o, draft: r, pageProps: l, dataProviderMetadataCallback: h } = e, d = Y(t._type), f = s(d, "component", null), w = s(e.repeaterData, "index", -1), k = s(e.repeaterData, "dataKey", ""), p = M(
|
|
103
|
+
O(t, a === n ? "" : a, d),
|
|
104
|
+
c,
|
|
105
|
+
{ index: w, key: k }
|
|
106
|
+
), $ = A(t, !1), L = ie(o, t._id, N(t._type)), T = b(d, "dataProvider") && I(d.dataProvider), y = {
|
|
82
107
|
...p,
|
|
83
108
|
...$,
|
|
84
|
-
...
|
|
85
|
-
},
|
|
109
|
+
...L
|
|
110
|
+
}, C = {
|
|
86
111
|
blockProps: {},
|
|
87
112
|
inBuilder: !1,
|
|
88
113
|
lang: a || n,
|
|
89
114
|
...y
|
|
90
115
|
}, D = s(y, "_show", !0);
|
|
91
|
-
if (q(
|
|
92
|
-
if (
|
|
116
|
+
if (q(f) || !D) return null;
|
|
117
|
+
if (T) {
|
|
93
118
|
const R = s(d, "suspenseFallback", re);
|
|
94
|
-
return /* @__PURE__ */ m(
|
|
119
|
+
return /* @__PURE__ */ m(x, { fallback: u(R), children: /* @__PURE__ */ m(
|
|
95
120
|
ae,
|
|
96
121
|
{
|
|
97
122
|
lang: a,
|
|
98
|
-
pageProps:
|
|
123
|
+
pageProps: l,
|
|
99
124
|
block: y,
|
|
100
125
|
dataProvider: d.dataProvider,
|
|
101
|
-
...
|
|
102
|
-
draft:
|
|
103
|
-
children: (F) =>
|
|
104
|
-
...
|
|
126
|
+
...h ? { dataProviderMetadataCallback: h } : {},
|
|
127
|
+
draft: r,
|
|
128
|
+
children: (F) => u(f, {
|
|
129
|
+
...C,
|
|
105
130
|
...F,
|
|
106
131
|
children: i({
|
|
107
132
|
_id: t._id,
|
|
108
133
|
_type: t._type,
|
|
109
134
|
...B(p.repeaterItems) ? {
|
|
110
|
-
repeaterItems:
|
|
135
|
+
repeaterItems: v(p.repeaterItems, t),
|
|
111
136
|
$repeaterItemsKey: p.$repeaterItemsKey
|
|
112
137
|
} : {}
|
|
113
138
|
})
|
|
@@ -115,61 +140,62 @@ const re = () => /* @__PURE__ */ m("div", {}), ne = (e) => {
|
|
|
115
140
|
}
|
|
116
141
|
) });
|
|
117
142
|
}
|
|
118
|
-
return /* @__PURE__ */ m(
|
|
119
|
-
...
|
|
143
|
+
return /* @__PURE__ */ m(x, { children: u(f, {
|
|
144
|
+
...C,
|
|
120
145
|
children: i({
|
|
121
146
|
_id: t._id,
|
|
122
147
|
_type: t._type,
|
|
123
148
|
...B(p.repeaterItems) ? {
|
|
124
|
-
repeaterItems:
|
|
149
|
+
repeaterItems: v(p.repeaterItems, t),
|
|
125
150
|
$repeaterItemsKey: p.$repeaterItemsKey
|
|
126
151
|
} : {}
|
|
127
152
|
})
|
|
128
153
|
}) });
|
|
129
154
|
}, P = (e) => {
|
|
130
|
-
const { blocks: t, parent: a, repeaterData: n } = e;
|
|
131
|
-
let
|
|
132
|
-
|
|
155
|
+
const { blocks: t, parent: a, repeaterData: n, type: i } = e;
|
|
156
|
+
let c = H(
|
|
157
|
+
S(t, (r) => b(r, "_id") && (g(a) ? !r._parent : r._parent === a)),
|
|
133
158
|
"_id"
|
|
134
159
|
);
|
|
135
|
-
const o = (r) =>
|
|
136
|
-
return
|
|
160
|
+
const o = (r) => S(t, (l) => l._parent === r).length > 0;
|
|
161
|
+
return (i === "Heading" || i === "Paragraph" || i === "Link") && (c = J(c)), U(c, (r) => r ? /* @__PURE__ */ u(ne, { ...e, key: r._id, block: r }, ({ _id: l, _type: h, repeaterItems: d, $repeaterItemsKey: f }) => h === "Repeater" ? B(d) && d.map((w, k) => /* @__PURE__ */ u(
|
|
137
162
|
P,
|
|
138
163
|
{
|
|
139
164
|
...e,
|
|
140
165
|
parent: r._id,
|
|
141
166
|
key: `${s(r, "_parent", "root")}-${r._id}-${k}`,
|
|
142
|
-
repeaterData: { index: k, dataKey:
|
|
167
|
+
repeaterData: { index: k, dataKey: f }
|
|
143
168
|
}
|
|
144
|
-
)) : o(l) ? /* @__PURE__ */
|
|
169
|
+
)) : o(l) ? /* @__PURE__ */ u(
|
|
145
170
|
P,
|
|
146
171
|
{
|
|
147
172
|
...e,
|
|
148
173
|
parent: r._id,
|
|
149
174
|
key: `${s(r, "_parent", "root")}-${r._id}`,
|
|
150
|
-
repeaterData: n
|
|
175
|
+
repeaterData: n,
|
|
176
|
+
type: r._type
|
|
151
177
|
}
|
|
152
178
|
) : null) : null);
|
|
153
|
-
}, ie = (e, t, a) =>
|
|
154
|
-
const
|
|
155
|
-
let
|
|
156
|
-
for (;
|
|
157
|
-
|
|
158
|
-
const
|
|
159
|
-
return
|
|
179
|
+
}, ie = (e, t, a) => g(a) ? {} : Object.entries(a).reduce((n, [i, c]) => {
|
|
180
|
+
const o = [];
|
|
181
|
+
let r = _(e, { _id: t });
|
|
182
|
+
for (; r; )
|
|
183
|
+
o.push(r), r = _(e, { _id: r._parent });
|
|
184
|
+
const l = _(o, { _type: c.block });
|
|
185
|
+
return l && (n[i] = s(l, s(c, "prop"), null)), n;
|
|
160
186
|
}, {});
|
|
161
187
|
function we(e) {
|
|
162
|
-
if (
|
|
188
|
+
if (g(e.lang) && !g(e.fallbackLang))
|
|
163
189
|
throw new Error("lang prop is required when fallbackLang is provided");
|
|
164
|
-
if (
|
|
190
|
+
if (g(e.blocks))
|
|
165
191
|
return null;
|
|
166
192
|
const t = e.lang ?? "en", a = e.fallbackLang ?? t;
|
|
167
193
|
return /* @__PURE__ */ m(P, { ...e, lang: t, fallbackLang: a });
|
|
168
194
|
}
|
|
169
195
|
export {
|
|
170
196
|
we as RenderChaiBlocks,
|
|
171
|
-
|
|
172
|
-
|
|
197
|
+
Le as applyChaiDataBinding,
|
|
198
|
+
Te as convertHTMLToChaiBlocks,
|
|
173
199
|
Pe as convertToBlocks,
|
|
174
200
|
Se as getChaiThemeCssVariables,
|
|
175
201
|
Be as getMergedPartialBlocks,
|
package/dist/web-blocks.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@chaibuilder/runtime"),a=require("react/jsx-runtime"),C=require("./common-functions-BZmyleS1.cjs"),x=require("react"),u=require("@radix-ui/react-icons"),d=require("lodash-es");function L(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=L(x),k=({className:e="",inBuilder:o})=>o?a.jsx("div",{className:C.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:a.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:a.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,j=e=>{const{blockProps:o,inBuilder:t,backgroundImage:r,children:s,tag:i="div",styles:n}=e;let c=s;s||(c=a.jsx(k,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),y.createElement(i,{...o,...n,style:p},c)},_={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},T=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:i,children:n,iconPos:c,link:p,inBuilder:m}=e,b=r,g=n||a.jsxs(a.Fragment,{children:[s&&a.jsx("span",{children:s}),b&&a.jsx("div",{style:{width:t+"px"},className:c+" "+(s?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:b}})]}),f=x.createElement("button",{...o,...i,type:"button","aria-label":s},g);return d.isEmpty(d.get(p,"href"))?f:m?a.jsx("span",{children:f}):a.jsx("a",{"aria-label":s,href:d.get(p,"href")||"/",target:d.get(p,"target","_self"),children:f})},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"]},E=e=>{const{blockProps:o,styles:t,htmlCode:r,inBuilder:s}=e;return s?a.jsxs("div",{className:"relative",children:[s?a.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}})},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"]},M=e=>{const{scripts:o,inBuilder:t,blockProps:r}=e;return t?a.jsx("div",{...r,children:a.jsx("div",{className:C.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:a.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:a.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"})})})}):a.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},A={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:u.CodeIcon,group:"advanced",...l.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}}),hidden:!0},H=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},$={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")}})},D=e=>{const{blockProps:o,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),y.createElement("div",{...o,...t,style:s})},z={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"}}}})},V=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:i,required:n,checked:c,showLabel:p=!0}=e;return p?a.jsxs("div",{...s,...o,children:[a.jsx("input",{...i,name:t,type:"checkbox",required:n,defaultChecked:c}),r&&a.jsx("label",{htmlFor:t,children:r})]}):a.jsx("input",{name:t,...o,...i,...s,type:"checkbox",required:n,defaultChecked:c})},U={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"]},F=e=>{const{children:o,blockProps:t,errorMessage:r,successMessage:s,action:i,styles:n,inBuilder:c}=e;let p=o;o||(p=a.jsx(k,{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 a.jsxs("form",{...m,"data-error":r,"data-success":s,method:"post",action:i,...t,...n,children:[a.jsx("div",{...b}),p]})},q={type:"Form",label:"Form",category:"core",icon:u.FileTextIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...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},O=e=>{const{blockProps:o,inBuilder:t,label:r,styles:s,icon:i,iconSize:n,iconPos:c}=e;return a.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":r,children:[r,i&&a.jsx("div",{style:{width:n+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:i}})]})},Z={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"]},G=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},firstName:{type:"text",autocomplete:"given-name"},lastName:{type:"text",autocomplete:"family-name"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},W=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:i,inputStyles:n,showLabel:c,required:p,inputType:m,defaultValue:b}=e,{type:g,autocomplete:f}=G(m);return c?a.jsxs("div",{...i,...o,children:[c&&a.jsx("label",{htmlFor:t,children:r}),a.jsx("input",{name:t,defaultValue:b,...n,type:g,placeholder:s,required:p,autoComplete:f})]}):a.jsx("input",{name:t,...o,...n,...i,type:g,placeholder:s,required:p,autoComplete:f,defaultValue:b})},Y={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:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Q=e=>{const{blockProps:o,content:t,styles:r,children:s}=e,i={...r,...o};return s?y.createElement("label",i,s):y.createElement("label",{...i,dangerouslySetInnerHTML:{__html:t}})},J={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"]},X=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:i,required:n,checked:c,showLabel:p=!0}=e;return p?a.jsxs("div",{...s,...o,children:[a.jsx("input",{...i,name:t,type:"radio",required:n,defaultChecked:c}),r&&a.jsx("label",{htmlFor:t,children:r})]}):a.jsx("input",{name:t,...o,...i,...s,type:"radio",required:n,checked:c})},K={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"]},ee=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:i,inputStyles:n,required:c,showLabel:p,_multiple:m,options:b,defaultValue:g}=e,f=m&&g?g.split(",").map(h=>h.trim()):g||"";return p?a.jsxs("div",{...i,...o,children:[p&&a.jsx("label",{htmlFor:t,children:r}),a.jsxs("select",{...n,required:c,multiple:m,name:t,defaultValue:f,children:[a.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(b,h=>a.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})]}):a.jsxs("select",{...i,...o,required:c,multiple:m,name:t,defaultValue:f,children:[a.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(b,h=>a.jsx("option",{value:h==null?void 0:h.value,children:h==null?void 0:h.label},h==null?void 0:h.value))]})},te={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"]},oe=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:i,inputStyles:n,rows:c,showLabel:p,required:m,defaultValue:b}=e;return p?a.jsxs("div",{...i,...o,children:[p&&a.jsx("label",{htmlFor:t,children:r}),a.jsx("textarea",{name:t,...n,placeholder:s,rows:c,required:m,defaultValue:b})]}):a.jsx("textarea",{name:t,...o,...n,...i,placeholder:s,rows:c,required:m,defaultValue:b})},le={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"]},re=e=>{const{blockProps:o,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?a.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:[a.jsxs("h1",{children:["Global Block - ",s]}),a.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},se={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},ae=e=>{const{blockProps:o,styles:t,content:r,tag:s="h1",children:i=null}=e;return i?y.createElement(s,{...t,...o},i):y.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:r}})},ie={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"},ne=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},ce={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},pe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("table",{...o,...r},t):a.jsx(k,{})},de=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("thead",{...o,...r},t):a.jsx(k,{})},ue=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tbody",{...o,...r},t):a.jsx(k,{})},me=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tr",{...o,...r},t):a.jsx(k,{})},ye=e=>{const{blockProps:o,children:t,content:r,styles:s}=e;return!t&&d.isEmpty(r)?a.jsx(k,{}):t?x.createElement("td",{...o,...s},t):x.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:r}})};l.registerChaiBlock(pe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:u.TableIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("Table")});l.registerChaiBlock(de,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:u.BorderTopIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableHead")});l.registerChaiBlock(ue,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:u.BorderAllIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableBody")});l.registerChaiBlock(me,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:u.ViewHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableRow")});l.registerChaiBlock(ye,{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:B("TableCell"),i18nProps:["content"],aiProps:["content"]});function B(e){const o=(i,n)=>({_id:C.generateUUID(),_parent:i,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+n}`}),t=i=>{const n=C.generateUUID(),c={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return i&&(c._parent=i),[c,o(n,"1"),o(n,"2"),o(n,"3")]},r=i=>{const n=C.generateUUID(),c={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return i&&(c._parent=i),[c,...t(n)]},s=i=>{const n=C.generateUUID(),c={_id:n,_type:"TableBody",styles:"#styles:,"};return i&&(c._parent=i),[c,...t(n),...t(n)]};if(e==="Table"){const i=C.generateUUID();return[{_id:i,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(i),...s(i)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const I=(e,...o)=>({...e,className:C.cn(e.className,...o)}),ge=e=>{const{blockProps:o,icon:t,styles:r,width:s,inBuilder:i,height:n}=e,c=I(r,"");if(d.isEmpty(t))return a.jsx(k,{inBuilder:i,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:n?`${n}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},he={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"}}})},be="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",fe=e=>{const{blockProps:o,image:t,mobileImage:r,styles:s,alt:i,height:n,width:c,lazyLoading:p}=e;return d.isEmpty(t)?a.jsx(k,{className:"h-36"}):a.jsxs("picture",{children:[r&&a.jsx("source",{srcSet:r,media:"(max-width: 480px)"}),a.jsx("img",{...o,...s,src:t,alt:i,loading:p?"lazy":"eager",width:c,height:n})]})},xe={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:be,ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},ke=e=>{const{blockProps:o,link:t,children:r,styles:s,inBuilder:i,content:n}=e;let c={};return!r&&d.isEmpty(n)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),i?r?a.jsx("span",{role:"link",...o,style:c,...s,children:r}):x.createElement("span",{...o,...s,style:c,role:"link"},n):r?a.jsx("a",{"aria-label":n,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":n},n)},Ce={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"},Be=e=>{const{blockProps:o,children:t,styles:r,tag:s,inBuilder:i}=e;return!t&&d.isEmpty(r==null?void 0:r.className)?a.jsx(k,{inBuilder:i}):y.createElement(s||"ul",{...o,...r},t)},Se={type:"List",description:"A list component",label:"List",icon:u.RowsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},we=e=>{const{blockProps:o,content:t,styles:r,children:s,tag:i}=e;return s?y.createElement(i||"li",{...r,...o},s):y.createElement(i||"li",{...r,...o,dangerouslySetInnerHTML:{__html:t}})},Pe={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"},ve=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)},Ie={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"},Le=e=>{const{blockProps:o,inBuilder:t,children:r,partialBlockId:s}=e;return t&&!s?a.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:[a.jsxs("h1",{children:["Partial Block - ",s]}),a.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},je={type:"PartialBlock",description:"A partial block component",label:"Partial Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},S={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},_e=e=>{const{blockProps:o,children:t,styles:r,colSpan:s,tabletColSpan:i,desktopColSpan:n}=e,p={className:[d.get(r,"className",""),d.get(S,["SMALL",isNaN(s)||!s?6:s],""),i?d.get(S,["MEDIUM",i||s],""):"",n?d.get(S,["LARGE",i||s],""):""].join(" ")};return a.jsx("div",{...o,...r,...p,children:t||a.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},Te={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:u.LayoutIcon,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]}}})},Ne=e=>{const{blockProps:o,children:t,styles:r,gutter:s}=e,n={className:[d.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:n.style={gap:`${s}px`},a.jsx("div",{...o,...r,...n,children:t})},Ee={type:"Row",description:"A row component",label:"Row",group:"basic",icon:u.RowsIcon,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}}})},Re=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 a.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},Me={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"]},Ae=e=>{const{blockProps:o,styles:t,content:r,children:s=null,tag:i}=e;return s?y.createElement("span",{...t,...o},s):y.createElement(i||"span",{...t,...o,dangerouslySetInnerHTML:{__html:r||""}})},He={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},$e=e=>e.inBuilder||e.forceWrapper?a.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,De={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"]},w={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},P=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,v=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=d.get(o,"autoplay",!1),r=d.get(o,"controls",!1),s=d.get(o,"loop",!1),i=t||d.get(o,"muted",!0);if(P.test(e)){const n=e.match(P);if(n){const c=n[4];let p=`https://www.youtube.com/embed/${c}`,m=t?"autoplay=1":"";return m+=s?`&loop=1&playlist=${c}`:"",m+=i?"&mute=1&muted=1":"",m+=r?"&controls=1":"&controls=0",`${p}?${m}`}}if(v.test(e)){const n=e.match(v);if(n){const c=n[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=i?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Ve=e=>{const{url:o,blockProps:t,styles:r,controls:s,videoSource:i,inBuilder:n}=e,c=ze(o,s);return a.jsxs("div",{...d.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&n?a.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:d.isEmpty(o)?`Provided ${i} video link in settings Video URL.`:`Provided ${i} video link is invalid.`}):a.jsx("iframe",{width:"100%",src:c,...d.pick(r,"className")}),n&&a.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Ue=e=>{const{url:o,styles:t,controls:r,sources:s,poster:i,blockProps:n}=e;let c=i;const p=[...d.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&p.push({url:o,width:"9999"});const m=p.sort((g,f)=>parseInt(g.width)-parseInt(f.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))&&a.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...n,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 f=`(max-width: ${g.width}px)`;return a.jsx("source",{src:g.url,media:f,type:g.type},g.url)}),"Your browser does not support the video tag.")})},Fe=e=>{const{videoSource:o}=e;return o==="Custom"?a.jsx(Ue,{...e}):o==="Youtube"||o==="Vimeo"?a.jsx(Ve,{...e}):a.jsxs("div",{children:["Invalid video source : ",o]})},qe={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:{...w}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...w}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...w}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},Oe=e=>{const{children:o,tag:t,styles:r,blockProps:s,inBuilder:i,$loading:n}=e;let c=o;return d.isEmpty(c)&&i&&(c=a.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"?n&&i?Array.from({length:2}).map((p,m)=>a.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[a.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),a.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},m)):c:y.createElement(t,{...s,...r},n&&i?Array.from({length:2}).map((p,m)=>a.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[a.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),a.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},m)):c)},Ze={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"}}}})},Ge=({children:e,blockProps:o,styles:t,parentTag:r,inBuilder:s})=>{let i="li";switch(r){case"ul":i="li";break;case"ol":i="li";break;default:i="div"}return!e&&s?y.createElement(i,{...o,...t},a.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(i,{...o,...t},e)},We={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},Ye=({children:e,blockProps:o,styles:t})=>y.createElement("div",{...o,...t},e),Qe={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},Je=()=>{l.registerChaiBlock(j,_),l.registerChaiBlock(D,z),l.registerChaiBlock(T,N),l.registerChaiBlock(ae,ie),l.registerChaiBlock(ve,Ie),l.registerChaiBlock(Ae,He),l.registerChaiBlock(Re,Me),l.registerChaiBlock(ke,Ce),l.registerChaiBlock(Be,Se),l.registerChaiBlock(we,Pe),l.registerChaiBlock(ge,he),l.registerChaiBlock(fe,xe),l.registerChaiBlock(Fe,qe),l.registerChaiBlock(E,R),l.registerChaiBlock(M,A),l.registerChaiBlock($e,De),l.registerChaiBlock(F,q),l.registerChaiBlock(O,Z),l.registerChaiBlock(W,Y),l.registerChaiBlock(V,U),l.registerChaiBlock(X,K),l.registerChaiBlock(ee,te),l.registerChaiBlock(oe,le),l.registerChaiBlock(Q,J),l.registerChaiBlock(ne,ce),l.registerChaiBlock(H,$),l.registerChaiBlock(re,se),l.registerChaiBlock(Le,je),l.registerChaiBlock(Ne,Ee),l.registerChaiBlock(_e,Te),l.registerChaiBlock(Oe,Ze),l.registerChaiBlock(Ge,We),l.registerChaiBlock(Ye,Qe)};exports.loadWebBlocks=Je;
|
|
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"),k=require("react"),u=require("@radix-ui/react-icons"),d=require("lodash-es");function L(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=L(k),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,j=e=>{const{blockProps:o,inBuilder:t,backgroundImage:r,children:s,tag:a="div",styles:n}=e;let c=s;s||(c=i.jsx(x,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),y.createElement(a,{...o,...n,style:p},c)},_={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]},backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}}}}),canAcceptBlock:()=>!0},T=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:a,children:n,iconPos:c,link:p,inBuilder:m}=e,b=r,g=n||i.jsxs(i.Fragment,{children:[s&&i.jsx("span",{children:s}),b&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(s?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:b}})]}),f=k.createElement("button",{...o,...a,type:"button","aria-label":s},g);return d.isEmpty(d.get(p,"href"))?f:m?i.jsx("span",{children:f}):i.jsx("a",{"aria-label":s,href:d.get(p,"href")||"/",target:d.get(p,"target","_self"),children:f})},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:!0,title:"Prefetch Link"}}}),i18nProps:["content","link"],aiProps:["content"]},E=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}})},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"]},M=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}})},A={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:u.CodeIcon,group:"advanced",...l.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}}),hidden:!0},H=e=>{const{blockProps:o,styles:t}=e;return k.createElement("hr",{...t,...o})},$={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")}})},D=e=>{const{blockProps:o,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),y.createElement("div",{...o,...t,style:s})},z={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"}}}})},V=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"checkbox",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"checkbox",required:n,defaultChecked:c})},U={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"]},F=e=>{const{children:o,blockProps:t,errorMessage:r,successMessage:s,action:a,styles:n,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:a,...t,...n,children:[i.jsx("div",{...b}),p]})},q={type:"Form",label:"Form",category:"core",icon:u.FileTextIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...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},O=e=>{const{blockProps:o,inBuilder:t,label:r,styles:s,icon:a,iconSize:n,iconPos:c}=e;return i.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":r,children:[r,a&&i.jsx("div",{style:{width:n+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},Z={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"]},G=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},firstName:{type:"text",autocomplete:"given-name"},lastName:{type:"text",autocomplete:"family-name"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},W=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,showLabel:c,required:p,inputType:m,defaultValue:b}=e,{type:g,autocomplete:f}=G(m);return c?i.jsxs("div",{...a,...o,children:[c&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("input",{name:t,defaultValue:b,...n,type:g,placeholder:s,required:p,autoComplete:f})]}):i.jsx("input",{name:t,...o,...n,...a,type:g,placeholder:s,required:p,autoComplete:f,defaultValue:b})},Y={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:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Q=e=>{const{blockProps:o,content:t,styles:r,children:s}=e,a={...r,...o};return s?y.createElement("label",a,s):y.createElement("label",{...a,dangerouslySetInnerHTML:{__html:t}})},J={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"]},X=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"radio",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"radio",required:n,checked:c})},K={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"]},ee=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,required:c,showLabel:p,_multiple:m,options:b,defaultValue:g}=e,f=m&&g?g.split(",").map(h=>h.trim()):g||"";return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsxs("select",{...n,required:c,multiple:m,name:t,defaultValue:f,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",{...a,...o,required:c,multiple:m,name:t,defaultValue:f,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))]})},te={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"]},oe=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,rows:c,showLabel:p,required:m,defaultValue:b}=e;return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("textarea",{name:t,...n,placeholder:s,rows:c,required:m,defaultValue:b})]}):i.jsx("textarea",{name:t,...o,...n,...a,placeholder:s,rows:c,required:m,defaultValue:b})},le={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"]},re=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)},se={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},ie=e=>{const{blockProps:o,styles:t,content:r,tag:s="h1",children:a=null}=e;return a?y.createElement(s,{...t,...o},a):y.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:r}})},ae={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"},ne=e=>{const{blockProps:o,styles:t}=e;return k.createElement("br",{...o,...t})},ce={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},pe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?k.createElement("table",{...o,...r},t):i.jsx(x,{})},de=e=>{const{blockProps:o,children:t,styles:r}=e;return t?k.createElement("thead",{...o,...r},t):i.jsx(x,{})},ue=e=>{const{blockProps:o,children:t,styles:r}=e;return t?k.createElement("tbody",{...o,...r},t):i.jsx(x,{})},me=e=>{const{blockProps:o,children:t,styles:r}=e;return t?k.createElement("tr",{...o,...r},t):i.jsx(x,{})},ye=e=>{const{blockProps:o,children:t,content:r,styles:s}=e;return!t&&d.isEmpty(r)?i.jsx(x,{}):t?k.createElement("td",{...o,...s},t):k.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:r}})};l.registerChaiBlock(pe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:u.TableIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("Table")});l.registerChaiBlock(de,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:u.BorderTopIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableHead")});l.registerChaiBlock(ue,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:u.BorderAllIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableBody")});l.registerChaiBlock(me,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:u.ViewHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableRow")});l.registerChaiBlock(ye,{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:B("TableCell"),i18nProps:["content"],aiProps:["content"]});function B(e){const o=(a,n)=>({_id:C.generateUUID(),_parent:a,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+n}`}),t=a=>{const n=C.generateUUID(),c={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return a&&(c._parent=a),[c,o(n,"1"),o(n,"2"),o(n,"3")]},r=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return a&&(c._parent=a),[c,...t(n)]},s=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableBody",styles:"#styles:,"};return a&&(c._parent=a),[c,...t(n),...t(n)]};if(e==="Table"){const a=C.generateUUID();return[{_id:a,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(a),...s(a)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const I=(e,...o)=>({...e,className:C.cn(e.className,...o)}),ge=e=>{const{blockProps:o,icon:t,styles:r,width:s,inBuilder:a,height:n}=e,c=I(r,"");if(d.isEmpty(t))return i.jsx(x,{inBuilder:a,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:n?`${n}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},he={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"}}})},be="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",fe=e=>{const{blockProps:o,image:t,mobileImage:r,styles:s,alt:a,height:n,width:c,lazyLoading:p,mobileWidth:m,mobileHeight:b}=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)",width:m,height:b}),i.jsx("img",{...o,...s,src:t,alt:a,loading:p?"lazy":"eager",width:c,height:n})]})},ke={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:be,ui:{"ui:widget":"image"}},width:{type:"string",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"string",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"string",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"string",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},xe=e=>{const{blockProps:o,link:t,children:r,styles:s,inBuilder:a,content:n}=e;let c={};return!r&&d.isEmpty(n)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),a?r?i.jsx("span",{role:"link",...o,style:c,...s,children:r}):k.createElement("span",{...o,...s,style:c,role:"link"},n):r?i.jsx("a",{"aria-label":n,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:r}):k.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":n},n)},Ce={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","link"],canAcceptBlock:e=>e!=="Link"},Be=e=>{const{blockProps:o,children:t,styles:r,tag:s,inBuilder:a}=e;return!t&&d.isEmpty(r==null?void 0:r.className)?i.jsx(x,{inBuilder:a}):y.createElement(s||"ul",{...o,...r},t)},Se={type:"List",description:"A list component",label:"List",icon:u.RowsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},we=e=>{const{blockProps:o,content:t,styles:r,children:s,tag:a}=e;return s?y.createElement(a||"li",{...r,...o},s):y.createElement(a||"li",{...r,...o,dangerouslySetInnerHTML:{__html:t}})},Pe={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"},ve=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)},Ie={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"},Le=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)},je={type:"PartialBlock",description:"A partial block component",label:"Partial Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},S={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},_e=e=>{const{blockProps:o,children:t,styles:r,colSpan:s,tabletColSpan:a,desktopColSpan:n}=e,p={className:[d.get(r,"className",""),d.get(S,["SMALL",isNaN(s)||!s?6:s],""),a?d.get(S,["MEDIUM",a||s],""):"",n?d.get(S,["LARGE",a||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"})})},Te={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:u.LayoutIcon,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]}}})},Ne=e=>{const{blockProps:o,children:t,styles:r,gutter:s}=e,n={className:[d.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:n.style={gap:`${s}px`},i.jsx("div",{...o,...r,...n,children:t})},Ee={type:"Row",description:"A row component",label:"Row",group:"basic",icon:u.RowsIcon,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}}})},Re=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}})},Me={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"]},Ae=e=>{const{blockProps:o,styles:t,content:r,children:s=null,tag:a}=e;return s?y.createElement("span",{...t,...o},s):y.createElement(a||"span",{...t,...o,dangerouslySetInnerHTML:{__html:r||""}})},He={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},$e=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,De={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"]},w={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},P=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,v=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=d.get(o,"autoplay",!1),r=d.get(o,"controls",!1),s=d.get(o,"loop",!1),a=t||d.get(o,"muted",!0);if(P.test(e)){const n=e.match(P);if(n){const c=n[4];let p=`https://www.youtube.com/embed/${c}`,m=t?"autoplay=1":"";return m+=s?`&loop=1&playlist=${c}`:"",m+=a?"&mute=1&muted=1":"",m+=r?"&controls=1":"&controls=0",`${p}?${m}`}}if(v.test(e)){const n=e.match(v);if(n){const c=n[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=a?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Ve=e=>{const{url:o,blockProps:t,styles:r,controls:s,videoSource:a,inBuilder:n}=e,c=ze(o,s);return i.jsxs("div",{...d.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&n?i.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:d.isEmpty(o)?`Provided ${a} video link in settings Video URL.`:`Provided ${a} video link is invalid.`}):i.jsx("iframe",{width:"100%",src:c,...d.pick(r,"className")}),n&&i.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Ue=e=>{const{url:o,styles:t,controls:r,sources:s,poster:a,blockProps:n}=e;let c=a;const p=[...d.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&p.push({url:o,width:"9999"});const m=p.sort((g,f)=>parseInt(g.width)-parseInt(f.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:k.createElement("video",{...t,...n,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 f=`(max-width: ${g.width}px)`;return i.jsx("source",{src:g.url,media:f,type:g.type},g.url)}),"Your browser does not support the video tag.")})},Fe=e=>{const{videoSource:o}=e;return o==="Custom"?i.jsx(Ue,{...e}):o==="Youtube"||o==="Vimeo"?i.jsx(Ve,{...e}):i.jsxs("div",{children:["Invalid video source : ",o]})},qe={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:{...w}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...w}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...w}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},Oe=e=>{const{children:o,tag:t,styles:r,blockProps:s,inBuilder:a,$loading:n}=e;let c=o;return d.isEmpty(c)&&a&&(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"?n&&a?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},n&&a?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)},Ze={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"}}}})},Ge=({children:e,blockProps:o,styles:t,parentTag:r,inBuilder:s})=>{let a="li";switch(r){case"ul":a="li";break;case"ol":a="li";break;default:a="div"}return!e&&s?y.createElement(a,{...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(a,{...o,...t},e)},We={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},Ye=({children:e,blockProps:o,styles:t})=>y.createElement("div",{...o,...t},e),Qe={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},Je=()=>{l.registerChaiBlock(j,_),l.registerChaiBlock(D,z),l.registerChaiBlock(T,N),l.registerChaiBlock(ie,ae),l.registerChaiBlock(ve,Ie),l.registerChaiBlock(Ae,He),l.registerChaiBlock(Re,Me),l.registerChaiBlock(xe,Ce),l.registerChaiBlock(Be,Se),l.registerChaiBlock(we,Pe),l.registerChaiBlock(ge,he),l.registerChaiBlock(fe,ke),l.registerChaiBlock(Fe,qe),l.registerChaiBlock(E,R),l.registerChaiBlock(M,A),l.registerChaiBlock($e,De),l.registerChaiBlock(F,q),l.registerChaiBlock(O,Z),l.registerChaiBlock(W,Y),l.registerChaiBlock(V,U),l.registerChaiBlock(X,K),l.registerChaiBlock(ee,te),l.registerChaiBlock(oe,le),l.registerChaiBlock(Q,J),l.registerChaiBlock(ne,ce),l.registerChaiBlock(H,$),l.registerChaiBlock(re,se),l.registerChaiBlock(Le,je),l.registerChaiBlock(Ne,Ee),l.registerChaiBlock(_e,Te),l.registerChaiBlock(Oe,Ze),l.registerChaiBlock(Ge,We),l.registerChaiBlock(Ye,Qe)};exports.loadWebBlocks=Je;
|