@chaibuilder/sdk 2.0.0-beta.74 → 2.0.0-beta.75

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/render.cjs CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./ChaiThemeFn-DQu-2Eh9.cjs"),r=require("lodash-es"),m=require("./getSplitClasses-DodqA_KW.cjs"),q=require("@mhsdesign/jit-browser-tailwindcss"),F=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),O=require("@tailwindcss/forms"),$=require("@tailwindcss/typography"),T=require("./plugin-2xcljWGM.cjs"),a=require("react/jsx-runtime"),R=require("@chaibuilder/runtime"),g=require("react"),N=require("tailwind-merge"),Y=(e,s="")=>{const{classes:n}=m.getSplitChaiClasses(e),t=n.split(" ").map(i=>i.split(" ").map(l=>{if(l==="")return"";if(l.includes(":")){const u=l.split(":");return u[u.length-1]=s+r.last(u),u.join(":")}return`${s}${l}`}).join(" "));return r.flattenDeep(t).join(" ")},k=e=>{if(!e)return[];try{return JSON.parse(A(e)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(e){const s=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(s,n=>{const t=decodeURIComponent(n),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function I(e,s,n=[],t="",i){return await q.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:T.getChaiBuilderTheme(e)},plugins:[O,$,F,v,T.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("./ChaiThemeFn-DQu-2Eh9.cjs"),n=require("lodash-es"),m=require("./getSplitClasses-DodqA_KW.cjs"),O=require("@mhsdesign/jit-browser-tailwindcss"),k=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),R=require("@tailwindcss/forms"),$=require("@tailwindcss/typography"),T=require("./plugin-2xcljWGM.cjs"),u=require("react/jsx-runtime"),_=require("@chaibuilder/runtime"),g=require("react"),b=require("tailwind-merge"),N=(e,s="")=>{const{classes:r}=m.getSplitChaiClasses(e),t=r.split(" ").map(i=>i.split(" ").map(a=>{if(a==="")return"";if(a.includes(":")){const l=a.split(":");return l[l.length-1]=s+n.last(l),l.join(":")}return`${s}${a}`}).join(" "));return n.flattenDeep(t).join(" ")},Y=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 s=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return e.replace(s,r=>{const t=decodeURIComponent(r),i=t.indexOf("public");return i!==-1?t.substring(i+6):t})}async function I(e,s,r=[],t="",i){return await O.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:r,theme:{extend:T.getChaiBuilderTheme(e)},plugins:[R,$,k,v,T.chaiBuilderPlugin],corePlugins:{preflight:i},...t?{prefix:`${t}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,s)}const M=(e,s,n)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return I(s,[t],[],"",n)},J=async(e,s=f.defaultThemeOptions,n=!1)=>await M(e,s,n);async function K(e){const s=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return a.jsx(g.Suspense,{children:g.createElement(e.component,{...e.props,...s})})}const L=r.memoize((e,s)=>{const{baseClasses:n,classes:t}=m.getSplitChaiClasses(e),i=N.twMerge(n,t);return s===""?i.replace(m.STYLES_KEY,"").trim():Y(i,s).replace(m.STYLES_KEY,"").trim()});function b(e,s){const n=r.get(e,`${s}_attrs`,{}),t=r.keys(n).join(" ");return r.includes(t,"x-show")&&!r.includes(t,"x-transition")&&(n["x-transition"]=""),n}function U(e,s){const n={};return Object.keys(e).forEach(t=>{if(r.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=L(e[t],s);n[t]={className:i,...b(e,t)}}}),n}function V(e,s){const n=r.get(e,"_bindings",{});return r.isEmpty(n)?{...e}:(r.each(n,(t,i)=>{r.isString(t)&&r.get(s,t,null)&&(e[i]=r.get(s,t,null))}),e)}function W(e,s,n){if(r.isEmpty(s))return e;const t=r.cloneDeep(e),i=r.get(n,"i18nProps",[]);return r.forEach(r.keys(t),o=>{i.includes(o)&&!r.isEmpty(s)&&(t[o]=r.get(t,`${o}-${s}`,t[o]))}),t}const z=()=>a.jsx("span",{children:"Loading..."});function w({blocks:e,parent:s,classPrefix:n="",externalData:t={},blockModifierCallback:i=null,lang:o="",fallbackLang:p="",metadata:l={}}){const u=e,E=c=>U(c,n),j=s?r.filter(e,{_parent:s}):r.filter(e,c=>r.isEmpty(c._parent));return a.jsx(a.Fragment,{children:g.Children.toArray(j.map((c,B)=>{const S={},_=r.filter(u,{_parent:c._id});S.children=_.length>0?a.jsx(w,{externalData:t,classPrefix:n,parent:c._id,blocks:u,lang:o||p,metadata:l}):null;const d=R.getRegisteredChaiBlock(c._type);if(d!==null){let h=c;const y=d.component;h={...d.defaults,...c},i&&(h=i(h));const x=o===p?"":o,C=r.omit({blockProps:{},inBuilder:!1,...h,index:B,...V(W(c,x,d),t),...E(h),...S,metadata:l,lang:o||p},["_parent"]);if(r.has(d,"dataProvider")){const P=r.get(d,"suspenseFallback",z);return a.jsx(g.Suspense,{fallback:g.createElement(P),children:a.jsx(K,{lang:o||p,metadata:l,dataProvider:d.dataProvider,block:c,component:y,props:C})})}return a.jsx(g.Suspense,{children:g.createElement(y,C)})}return a.jsxs("noscript",{children:[c._type," not found"]})}))})}exports.getChaiThemeCssVariables=f.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=f.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=f.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=w;exports.convertToBlocks=k;exports.getStylesForBlocks=J;
3
+ @tailwind utilities;`,s)}const M=(e,s,r)=>{const t=JSON.stringify(e).replace(/#styles:([^"]*)/g,(i,o)=>`#styles:${o.replace(/,/g," ")}`.replace(/#styles:/g,""));return I(s,[t],[],"",r)},J=async(e,s=f.defaultThemeOptions,r=!1)=>await M(e,s,r);async function K(e){const s=await(e==null?void 0:e.dataProvider(e.block,e.lang,e.metadata));return u.jsx(g.Suspense,{children:g.createElement(e.component,{...e.props,...s})})}const L=n.memoize((e,s)=>{const{baseClasses:r,classes:t}=m.getSplitChaiClasses(e),i=b.twMerge(r,t);return s===""?i.replace(m.STYLES_KEY,"").trim():N(i,s).replace(m.STYLES_KEY,"").trim()});function D(e,s){const r=n.get(e,`${s}_attrs`,{}),t=n.keys(r).join(" ");return n.includes(t,"x-show")&&!n.includes(t,"x-transition")&&(r["x-transition"]=""),r}function U(e,s){const r={};return Object.keys(e).forEach(t=>{if(n.isString(e[t])&&e[t].startsWith(m.STYLES_KEY)){const i=L(e[t],s);r[t]={className:i,...D(e,t)}}}),r}function V(e,s,r){if(n.isEmpty(s))return e;const t=n.cloneDeep(e),i=n.get(r,"i18nProps",[]);return n.forEach(n.keys(t),o=>{i.includes(o)&&!n.isEmpty(s)&&(t[o]=n.get(t,`${o}-${s}`,t[o]))}),t}const z=n.memoize(e=>{const s=_.getRegisteredChaiBlock(e),r=n.get(s,"schema.properties",{});return Object.fromEntries(Object.entries(r).filter(([,t])=>n.get(t,"runtime",!1)))}),W=(e,s,r)=>n.isEmpty(r)?{}:Object.entries(r).reduce((t,[i,o])=>{const d=[];let a=n.find(e,{_id:s});for(;a;)d.push(a),a=n.find(e,{_id:a._parent});const l=n.find(d,{_type:o.block});return l&&(t[i]=n.get(l,n.get(o,"prop"),null)),t},{}),Q=()=>u.jsx("span",{children:"Loading..."});function w({blocks:e,parent:s,classPrefix:r="",externalData:t={},blockModifierCallback:i=null,lang:o="",fallbackLang:d="",metadata:a={}}){const l=e,j=c=>U(c,r),E=s?n.filter(e,{_parent:s}):n.filter(e,c=>n.isEmpty(c._parent));return u.jsx(u.Fragment,{children:g.Children.toArray(E.map((c,B)=>{const S={},P=n.filter(l,{_parent:c._id});S.children=P.length>0?u.jsx(w,{externalData:t,classPrefix:r,parent:c._id,blocks:l,lang:o||d,metadata:a}):null;const p=_.getRegisteredChaiBlock(c._type);if(p!==null){let h=c;const y=p.component;h={...p.defaults,...c},i&&(h=i(h));const x=o===d?"":o,q=W(l,c._id,z(c._type)),C=n.omit({blockProps:{},inBuilder:!1,...h,index:B,...V(c,x,p),...j(h),...S,...q,metadata:a,lang:o||d},["_parent"]);if(n.has(p,"dataProvider")){const F=n.get(p,"suspenseFallback",Q);return u.jsx(g.Suspense,{fallback:g.createElement(F),children:u.jsx(K,{lang:o||d,metadata:a,dataProvider:p.dataProvider,block:c,component:y,props:C})})}return u.jsx(g.Suspense,{children:g.createElement(y,C)})}return u.jsxs("noscript",{children:[c._type," not found"]})}))})}exports.getChaiThemeCssVariables=f.getChaiThemeCssVariables;exports.getThemeFontsCSSImport=f.getThemeFontsCSSImport;exports.getThemeFontsLinkMarkup=f.getThemeFontsLinkMarkup;exports.RenderChaiBlocks=w;exports.convertToBlocks=Y;exports.getStylesForBlocks=J;
package/dist/render.js CHANGED
@@ -1,49 +1,49 @@
1
- import { d as v } from "./ChaiThemeFn-Cort9tch.js";
2
- import { a as jt, b as Ft, c as Ot } from "./ChaiThemeFn-Cort9tch.js";
3
- import { last as N, flattenDeep as A, memoize as R, filter as g, isEmpty as f, omit as I, has as J, get as d, each as U, isString as T, cloneDeep as K, forEach as M, keys as B, includes as P } from "lodash-es";
4
- import { g as x, S as h } from "./getSplitClasses-DphwgQiE.js";
5
- import { createTailwindcss as W } from "@mhsdesign/jit-browser-tailwindcss";
6
- import Y from "@tailwindcss/aspect-ratio";
7
- import b from "@tailwindcss/container-queries";
1
+ import { d as A } from "./ChaiThemeFn-Cort9tch.js";
2
+ import { a as $t, b as Ft, c as Rt } from "./ChaiThemeFn-Cort9tch.js";
3
+ import { last as I, flattenDeep as J, memoize as T, get as u, filter as h, isEmpty as f, omit as k, has as D, cloneDeep as U, forEach as K, keys as j, find as g, isString as M, includes as B } from "lodash-es";
4
+ import { g as x, S as y } from "./getSplitClasses-DphwgQiE.js";
5
+ import { createTailwindcss as V } from "@mhsdesign/jit-browser-tailwindcss";
6
+ import W from "@tailwindcss/aspect-ratio";
7
+ import Y from "@tailwindcss/container-queries";
8
8
  import z from "@tailwindcss/forms";
9
- import D from "@tailwindcss/typography";
10
- import { g as L, c as Q } from "./plugin-kUMxtQR5.js";
11
- import { jsx as u, Fragment as V, jsxs as q } from "react/jsx-runtime";
12
- import { getRegisteredChaiBlock as G } from "@chaibuilder/runtime";
13
- import S, { Suspense as y, createElement as H } from "react";
14
- import { twMerge as X } from "tailwind-merge";
15
- const Z = (t, s = "") => {
9
+ import L from "@tailwindcss/typography";
10
+ import { g as Q, c as q } from "./plugin-kUMxtQR5.js";
11
+ import { jsx as d, Fragment as G, jsxs as H } from "react/jsx-runtime";
12
+ import { getRegisteredChaiBlock as E } from "@chaibuilder/runtime";
13
+ import S, { Suspense as _, createElement as X } from "react";
14
+ import { twMerge as Z } from "tailwind-merge";
15
+ const tt = (t, s = "") => {
16
16
  const { classes: n } = x(t), e = n.split(" ").map((r) => r.split(" ").map((a) => {
17
17
  if (a === "") return "";
18
18
  if (a.includes(":")) {
19
19
  const c = a.split(":");
20
- return c[c.length - 1] = s + N(c), c.join(":");
20
+ return c[c.length - 1] = s + I(c), c.join(":");
21
21
  }
22
22
  return `${s}${a}`;
23
23
  }).join(" "));
24
- return A(e).join(" ");
25
- }, Bt = (t) => {
24
+ return J(e).join(" ");
25
+ }, xt = (t) => {
26
26
  if (!t) return [];
27
27
  try {
28
- return JSON.parse(k(t)).filter((n) => !n._type.startsWith("@chai"));
28
+ return JSON.parse(et(t)).filter((n) => !n._type.startsWith("@chai"));
29
29
  } catch {
30
30
  return [{ _type: "Paragraph", _id: "error", content: "Invalid JSON. Please check the JSON string." }];
31
31
  }
32
32
  };
33
- function k(t) {
33
+ function et(t) {
34
34
  const s = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
35
35
  return t.replace(s, (n) => {
36
36
  const e = decodeURIComponent(n), r = e.indexOf("public");
37
37
  return r !== -1 ? e.substring(r + 6) : e;
38
38
  });
39
39
  }
40
- async function tt(t, s, n = [], e = "", r) {
41
- return await W({
40
+ async function st(t, s, n = [], e = "", r) {
41
+ return await V({
42
42
  tailwindConfig: {
43
43
  darkMode: "class",
44
44
  safelist: n,
45
- theme: { extend: L(t) },
46
- plugins: [z, D, Y, b, Q],
45
+ theme: { extend: Q(t) },
46
+ plugins: [z, L, W, Y, q],
47
47
  corePlugins: { preflight: r },
48
48
  ...e ? { prefix: `${e}` } : {}
49
49
  }
@@ -54,113 +54,118 @@ async function tt(t, s, n = [], e = "", r) {
54
54
  s
55
55
  );
56
56
  }
57
- const et = (t, s, n) => {
57
+ const nt = (t, s, n) => {
58
58
  const e = JSON.stringify(t).replace(/#styles:([^"]*)/g, (r, i) => `#styles:${i.replace(/,/g, " ")}`.replace(/#styles:/g, ""));
59
- return tt(s, [e], [], "", n);
60
- }, xt = async (t, s = v, n = !1) => await et(t, s, n);
61
- async function st(t) {
59
+ return st(s, [e], [], "", n);
60
+ }, Et = async (t, s = A, n = !1) => await nt(t, s, n);
61
+ async function rt(t) {
62
62
  const s = await (t == null ? void 0 : t.dataProvider(t.block, t.lang, t.metadata));
63
- return /* @__PURE__ */ u(y, { children: S.createElement(t.component, { ...t.props, ...s }) });
63
+ return /* @__PURE__ */ d(_, { children: S.createElement(t.component, { ...t.props, ...s }) });
64
64
  }
65
- const nt = R((t, s) => {
66
- const { baseClasses: n, classes: e } = x(t), r = X(n, e);
67
- return s === "" ? r.replace(h, "").trim() : Z(r, s).replace(h, "").trim();
65
+ const it = T((t, s) => {
66
+ const { baseClasses: n, classes: e } = x(t), r = Z(n, e);
67
+ return s === "" ? r.replace(y, "").trim() : tt(r, s).replace(y, "").trim();
68
68
  });
69
- function rt(t, s) {
70
- const n = d(t, `${s}_attrs`, {}), e = B(n).join(" ");
71
- return P(e, "x-show") && !P(e, "x-transition") && (n["x-transition"] = ""), n;
69
+ function ot(t, s) {
70
+ const n = u(t, `${s}_attrs`, {}), e = j(n).join(" ");
71
+ return B(e, "x-show") && !B(e, "x-transition") && (n["x-transition"] = ""), n;
72
72
  }
73
- function it(t, s) {
73
+ function at(t, s) {
74
74
  const n = {};
75
75
  return Object.keys(t).forEach((e) => {
76
- if (T(t[e]) && t[e].startsWith(h)) {
77
- const r = nt(t[e], s);
76
+ if (M(t[e]) && t[e].startsWith(y)) {
77
+ const r = it(t[e], s);
78
78
  n[e] = {
79
79
  className: r,
80
- ...rt(t, e)
80
+ ...ot(t, e)
81
81
  };
82
82
  }
83
83
  }), n;
84
84
  }
85
- function ot(t, s) {
86
- const n = d(t, "_bindings", {});
87
- return f(n) ? { ...t } : (U(n, (e, r) => {
88
- T(e) && d(s, e, null) && (t[r] = d(s, e, null));
89
- }), t);
90
- }
91
- function at(t, s, n) {
85
+ function ct(t, s, n) {
92
86
  if (f(s)) return t;
93
- const e = K(t), r = d(n, "i18nProps", []);
94
- return M(B(e), (i) => {
95
- r.includes(i) && !f(s) && (e[i] = d(e, `${i}-${s}`, e[i]));
87
+ const e = U(t), r = u(n, "i18nProps", []);
88
+ return K(j(e), (i) => {
89
+ r.includes(i) && !f(s) && (e[i] = u(e, `${i}-${s}`, e[i]));
96
90
  }), e;
97
91
  }
98
- const ct = () => /* @__PURE__ */ u("span", { children: "Loading..." });
99
- function lt({
92
+ const lt = T((t) => {
93
+ const s = E(t), n = u(s, "schema.properties", {});
94
+ return Object.fromEntries(Object.entries(n).filter(([, e]) => u(e, "runtime", !1)));
95
+ }), ut = (t, s, n) => f(n) ? {} : Object.entries(n).reduce((e, [r, i]) => {
96
+ const l = [];
97
+ let a = g(t, { _id: s });
98
+ for (; a; )
99
+ l.push(a), a = g(t, { _id: a._parent });
100
+ const c = g(l, { _type: i.block });
101
+ return c && (e[r] = u(c, u(i, "prop"), null)), e;
102
+ }, {}), pt = () => /* @__PURE__ */ d("span", { children: "Loading..." });
103
+ function dt({
100
104
  blocks: t,
101
105
  parent: s,
102
106
  classPrefix: n = "",
103
107
  externalData: e = {},
104
108
  blockModifierCallback: r = null,
105
109
  lang: i = "",
106
- fallbackLang: p = "",
110
+ fallbackLang: l = "",
107
111
  metadata: a = {}
108
112
  }) {
109
- const c = t, E = (o) => it(o, n), $ = s ? g(t, { _parent: s }) : g(t, (o) => f(o._parent));
110
- return /* @__PURE__ */ u(V, { children: S.Children.toArray(
111
- $.map((o, j) => {
112
- const C = {}, F = g(c, { _parent: o._id });
113
- C.children = F.length > 0 ? /* @__PURE__ */ u(
114
- lt,
113
+ const c = t, O = (o) => at(o, n), v = s ? h(t, { _parent: s }) : h(t, (o) => f(o._parent));
114
+ return /* @__PURE__ */ d(G, { children: S.Children.toArray(
115
+ v.map((o, $) => {
116
+ const C = {}, F = h(c, { _parent: o._id });
117
+ C.children = F.length > 0 ? /* @__PURE__ */ d(
118
+ dt,
115
119
  {
116
120
  externalData: e,
117
121
  classPrefix: n,
118
122
  parent: o._id,
119
123
  blocks: c,
120
- lang: i || p,
124
+ lang: i || l,
121
125
  metadata: a
122
126
  }
123
127
  ) : null;
124
- const l = G(o._type);
125
- if (l !== null) {
128
+ const p = E(o._type);
129
+ if (p !== null) {
126
130
  let m = o;
127
- const w = l.component;
128
- m = { ...l.defaults, ...o }, r && (m = r(m));
129
- const _ = I(
131
+ const w = p.component;
132
+ m = { ...p.defaults, ...o }, r && (m = r(m));
133
+ const R = i === l ? "" : i, N = ut(c, o._id, lt(o._type)), P = k(
130
134
  {
131
135
  blockProps: {},
132
136
  inBuilder: !1,
133
137
  ...m,
134
- index: j,
135
- ...ot(at(o, i === p ? "" : i, l), e),
136
- ...E(m),
138
+ index: $,
139
+ ...ct(o, R, p),
140
+ ...O(m),
137
141
  ...C,
142
+ ...N,
138
143
  metadata: a,
139
- lang: i || p
144
+ lang: i || l
140
145
  },
141
146
  ["_parent"]
142
147
  );
143
- if (J(l, "dataProvider")) {
144
- const O = d(
145
- l,
148
+ if (D(p, "dataProvider")) {
149
+ const b = u(
150
+ p,
146
151
  "suspenseFallback",
147
- ct
152
+ pt
148
153
  );
149
- return /* @__PURE__ */ u(y, { fallback: H(O), children: /* @__PURE__ */ u(
150
- st,
154
+ return /* @__PURE__ */ d(_, { fallback: X(b), children: /* @__PURE__ */ d(
155
+ rt,
151
156
  {
152
- lang: i || p,
157
+ lang: i || l,
153
158
  metadata: a,
154
- dataProvider: l.dataProvider,
159
+ dataProvider: p.dataProvider,
155
160
  block: o,
156
161
  component: w,
157
- props: _
162
+ props: P
158
163
  }
159
164
  ) });
160
165
  }
161
- return /* @__PURE__ */ u(y, { children: S.createElement(w, _) });
166
+ return /* @__PURE__ */ d(_, { children: S.createElement(w, P) });
162
167
  }
163
- return /* @__PURE__ */ q("noscript", { children: [
168
+ return /* @__PURE__ */ H("noscript", { children: [
164
169
  o._type,
165
170
  " not found"
166
171
  ] });
@@ -168,10 +173,10 @@ function lt({
168
173
  ) });
169
174
  }
170
175
  export {
171
- lt as RenderChaiBlocks,
172
- Bt as convertToBlocks,
173
- jt as getChaiThemeCssVariables,
174
- xt as getStylesForBlocks,
176
+ dt as RenderChaiBlocks,
177
+ xt as convertToBlocks,
178
+ $t as getChaiThemeCssVariables,
179
+ Et as getStylesForBlocks,
175
180
  Ft as getThemeFontsCSSImport,
176
- Ot as getThemeFontsLinkMarkup
181
+ Rt as getThemeFontsLinkMarkup
177
182
  };
@@ -1,30 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),w=require("react"),x=require("./iconBase-Cn2BsTrq.cjs"),m=require("@radix-ui/react-icons"),y=require("lodash-es"),S=require("lucide-react");function $(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const s=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(l,r,s.get?s:{enumerable:!0,get:()=>e[r]})}}return l.default=e,Object.freeze(l)}const k=$(w),C=({className:e="",inBuilder:l})=>l?i.jsx("div",{className:x.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,E=e=>{const{blockProps:l,inBuilder:r,backgroundImage:s,children:o,tag:n="div",styles:a}=e;let d=o;o||(d=i.jsx(C,{inBuilder:r}));let c={};return s&&(c={backgroundImage:`url(${s})`}),k.createElement(n,{...l,...a,style:c},d)},T={type:"Box",label:"Box",category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},A=e=>{const{blockProps:l,iconSize:r,icon:s,content:o,styles:n,children:a,iconPos:d,link:c,inBuilder:p}=e,g=s,h=a||i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:o}),g&&i.jsx("div",{style:{width:r+"px"},className:d+" "+(d==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:g}})]}),u=w.createElement("button",{...l,...n,type:"button","aria-label":o},h);return y.isEmpty(y.get(c,"href"))?u:p?i.jsx("span",{children:u}):i.jsx("a",{"aria-label":o,href:y.get(c,"href")||"/",target:y.get(c,"target","_self"),children:u})},R={type:"Button",label:"Button",category:"core",icon:m.ButtonIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),i18nProps:["content"],aiProps:["content"]},z=e=>{const{blockProps:l,styles:r,htmlCode:s,inBuilder:o}=e;return o?i.jsxs("div",{className:"relative",children:[o?i.jsx("div",{...l,...r,className:"absolute z-20 h-full w-full"}):null,k.createElement("div",{...r,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):k.createElement("div",{...l,...r,dangerouslySetInnerHTML:{__html:s}})},H={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:m.CodeIcon,group:"advanced",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},q=e=>{const{blockProps:l,styles:r,backgroundImage:s}=e;let o={};return s&&(o={backgroundImage:`url(${s})`}),k.createElement("div",{...l,...r,style:o})},U={type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},F=e=>{const{blockProps:l,styles:r,content:s,tag:o="h1",children:n=null}=e;return n?k.createElement(o,{...r,...l},n):k.createElement(o,{...r,...l,dangerouslySetInnerHTML:{__html:s}})},O={type:"Heading",label:"web_blocks.heading",category:"core",icon:m.HeadingIcon,group:"typography",...t.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:t.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},G=e=>{const{blockProps:l,styles:r,content:s}=e;return y.isNull(e.children)?k.createElement("p",{...r,...l,dangerouslySetInnerHTML:{__html:s}}):k.createElement("p",{...r,...l},e.children)},V={type:"Paragraph",label:"Paragraph",category:"core",icon:m.TextIcon,group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),k=require("react"),b=require("./iconBase-Cn2BsTrq.cjs"),y=require("@radix-ui/react-icons"),g=require("lodash-es"),B=require("lucide-react");function v(e){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const s=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(l,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return l.default=e,Object.freeze(l)}const h=v(k),C=({className:e="",inBuilder:l})=>l?i.jsx("div",{className:b.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,_=e=>{const{blockProps:l,inBuilder:t,backgroundImage:s,children:r,tag:n="div",styles:a}=e;let c=r;r||(c=i.jsx(C,{inBuilder:t}));let p={};return s&&(p={backgroundImage:`url(${s})`}),h.createElement(n,{...l,...a,style:p},c)},j={type:"Box",label:"Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0},N=e=>{const{blockProps:l,iconSize:t,icon:s,content:r,styles:n,children:a,iconPos:c,link:p,inBuilder:d}=e,m=s,f=a||i.jsxs(i.Fragment,{children:[i.jsx("span",{"data-ai-key":"content",children:r}),m&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:m}})]}),u=k.createElement("button",{...l,...n,type:"button","aria-label":r},f);return g.isEmpty(g.get(p,"href"))?u:d?i.jsx("span",{children:u}):i.jsx("a",{"aria-label":r,href:g.get(p,"href")||"/",target:g.get(p,"target","_self"),children:u})},E={type:"Button",label:"Button",category:"core",icon:y.ButtonIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),i18nProps:["content"],aiProps:["content"]},M=e=>{const{blockProps:l,styles:t,htmlCode:s,inBuilder:r}=e;return r?i.jsxs("div",{className:"relative",children:[r?i.jsx("div",{...l,...t,className:"absolute z-20 h-full w-full"}):null,h.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):h.createElement("div",{...l,...t,dangerouslySetInnerHTML:{__html:s}})},T={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:y.CodeIcon,group:"advanced",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}})},$=e=>{const{blockProps:l,styles:t,backgroundImage:s}=e;let r={};return s&&(r={backgroundImage:`url(${s})`}),h.createElement("div",{...l,...t,style:r})},R={type:"EmptyBox",label:"Empty Box",category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},A=e=>{const{blockProps:l,styles:t,content:s,tag:r="h1",children:n=null}=e;return n?h.createElement(r,{...t,...l},n):h.createElement(r,{...t,...l,dangerouslySetInnerHTML:{__html:s}})},z={type:"Heading",label:"web_blocks.heading",category:"core",icon:y.HeadingIcon,group:"typography",...o.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:o.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Text"},H=e=>{const{blockProps:l,styles:t,content:s}=e;return g.isNull(e.children)?h.createElement("p",{...t,...l,dangerouslySetInnerHTML:{__html:s}}):h.createElement("p",{...t,...l},e.children)},D={type:"Paragraph",label:"Paragraph",category:"core",icon:y.TextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:`Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique.
2
2
  Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus
3
- 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"},I=(e,...l)=>({...e,className:x.cn(e.className,...l)}),W=e=>{const{blockProps:l,content:r,styles:s}=e,o=I(s,"prose","max-w-full");return i.jsx("div",{...l,...o,dangerouslySetInnerHTML:{__html:r}})},X={type:"RichText",label:"Rich Text",category:"core",icon:m.CursorTextIcon,group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},Y=e=>{const{blockProps:l,styles:r,content:s,children:o=null,tag:n}=e;return o?k.createElement("span",{...r,...l},o):k.createElement(n||"span",{...r,...l,dangerouslySetInnerHTML:{__html:s||""}})},Z={type:"Span",label:"Span",category:"core",group:"typography",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0};function J(e){return x.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(e)}const K=e=>{const{scripts:l,inBuilder:r,blockProps:s}=e;return r?i.jsx("div",{...s,children:i.jsx("div",{className:x.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:l}})},Q={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:J,group:"advanced",...t.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},ee=e=>i.jsxs("div",{...e.blockProps,...e.styles,children:[e.mode,e.children]}),te=e=>e.mode==="dark"?null:i.jsx("button",{"aria-label":"dark mode button",...e.blockProps,...e.styles,children:e.children});t.registerChaiBlock(te,{type:"DarkModeButton",label:"Dark Mode Button",category:"core",icon:m.MoonIcon,group:"advanced",hidden:!0,...t.registerChaiBlockSchema({properties:{mode:t.closestBlockProp("DarkModeSwitcher","mode"),styles:t.stylesProp("")}})});const le=e=>e.mode==="light"?null:i.jsx("button",{"aria-label":"light mode button",...e.blockProps,...e.styles,children:e.children});t.registerChaiBlock(le,{type:"LightModeButton",label:"Light Mode Button",category:"core",icon:m.SunIcon,group:"advanced",hidden:!0,...t.registerChaiBlockSchema({properties:{mode:t.closestBlockProp("DarkModeSwitcher","mode"),styles:t.stylesProp(""),fake:{type:"string",default:""}}})});const re={type:"DarkModeSwitcher",label:"web_blocks.dark_mode",category:"core",icon:m.MoonIcon,group:"advanced",wrapper:!0,...t.registerChaiBlockSchema({properties:{mode:{title:"Mode",type:"string",enum:["dark","light"],default:"light"},styles:t.stylesProp("")}}),blocks:()=>[{_id:"ultqCh",_type:"DarkModeSwitcher",mode:"light",styles:"#styles:,",_name:"Dark Mode Theme"},{_id:"vroabi",_parent:"ultqCh",_type:"LightModeButton",styles_attrs:{type:"button","x-on:click":"darkMode = 'dark'","x-show":"darkMode === 'light'"},styles:"#styles:,bg-white dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Dark Mode Btn"},{_id:"nltBrv",_parent:"vroabi",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z'></path></svg>"},{_id:"gesydi",_parent:"ultqCh",_type:"DarkModeButton",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},styles:"#styles:,bg-white hidden dark:bg-black font-medium text-gray-800 rounded-full hover:bg-gray-200 focus:outline-none focus:bg-gray-200 dark:text-neutral-200 dark:hover:bg-neutral-800 dark:focus:bg-neutral-800",_name:"Light Mode Btn"},{_id:"AdDwBC",_parent:"gesydi",_type:"Icon",styles:"#styles:, shrink-0 size-4",icon:"<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='12' cy='12' r='4'></circle><path d='M12 2v2'></path><path d='M12 20v2'></path><path d='m4.93 4.93 1.41 1.41'></path><path d='m17.66 17.66 1.41 1.41'></path><path d='M2 12h2'></path><path d='M20 12h2'></path><path d='m6.34 17.66-1.41 1.41'></path><path d='m19.07 4.93-1.41 1.41'></path></svg>"}]},oe=e=>{const{blockProps:l,styles:r}=e;return w.createElement("hr",{...r,...l})},se={type:"Divider",label:"web_blocks.divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},ie=e=>{const{blockProps:l,inBuilder:r,children:s,globalBlock:o}=e;return r&&!o?i.jsxs("div",{className:"flex flex-col items-center justify-center py-4 bg-gray-100 rounded-lg gap-y-1 dark:bg-gray-800",...l,children:[i.jsxs("h1",{children:["Global Block - ",o]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):k.createElement("span",{...l},s)},ne={type:"GlobalBlock",label:"Global Block",icon:S.GlobeIcon,category:"core",group:"advanced",...t.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},ae=e=>{const{blockProps:l,icon:r,styles:s,width:o,inBuilder:n,height:a}=e,d=I(s,"");if(y.isEmpty(r))return i.jsx(C,{inBuilder:n,className:"h-8 w-14"});const c=r.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return k.createElement("span",{...l,...d,style:{width:o?`${o}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:c}})},ce={type:"Icon",label:"web_blocks.icon",category:"core",icon:m.SketchLogoIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),icon:{type:"string",title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},de=e=>{const{blockProps:l,image:r,mobileImage:s,styles:o,alt:n,height:a,width:d,lazyLoading:c}=e;return y.isEmpty(r)?i.jsx(C,{className:"h-36"}):i.jsxs("picture",{children:[s&&i.jsx("source",{srcSet:s,media:"(max-width: 480px)"}),i.jsx("img",{...l,...o,src:r,alt:n,loading:c?"lazy":"eager",width:d,height:a})]})},ue={type:"Image",label:"Image",category:"core",icon:m.ImageIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}}}}),aiProps:["alt"],i18nProps:["alt"]},pe=e=>{const{blockProps:l,children:r,styles:s,inBuilder:o,content:n,href:a}=e,{hrefType:d,autoplay:c,maxWidth:p,backdropColor:g,galleryName:h}=e,u=I(s,"cb-lightbox");if(!r&&y.isEmpty(s==null?void 0:s.className)&&y.isEmpty(n))return i.jsx(C,{inBuilder:o});if(o)return r?i.jsx("span",{...l,...u,children:r}):k.createElement("span",{...l,...u,dangerouslySetInnerHTML:{__html:n}});const f={};return d!=="image"&&(f["data-vbtype"]=d),c&&(f["data-autoplay"]="true"),p&&(f["data-maxwidth"]=p+"px"),g&&(f["data-overlay"]=g),h&&(f["data-gall"]=h),r?i.jsx("a",{"aria-label":n,...f,href:a||"#/",...l,...u,children:r}):k.createElement("a",{...l,...u,...f,href:a||"#",dangerouslySetInnerHTML:{__html:n},"aria-label":n})},ge={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:m.ImageIcon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",title:"Content",default:"Link text or drop blocks inside"},hrefType:{type:"string",title:"Type",default:"image",enum:["image","video","iframe","inline","ajax"],enumNames:["Image","Video","Iframe","Inline","Ajax"]},href:{type:"string",title:"Href",default:""},autoplay:{type:"boolean",title:"Autoplay (Video only)",default:!1},maxWidth:{type:"number",title:"Max Width",default:""},backdropColor:{type:"string",title:"Backdrop Color",default:""},galleryName:{type:"string",title:"Gallery Name",default:""}},dependencies:{autoplay:["hrefType","video"]}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},ye=e=>{const{blockProps:l,link:r,children:s,styles:o,inBuilder:n,content:a}=e;let d={};return!s&&y.isEmpty(a)&&(d={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?s?i.jsx("span",{...l,style:d,...o,children:s}):w.createElement("span",{...l,...o,style:d},a):s?i.jsx("a",{"aria-label":a,href:(r==null?void 0:r.href)||"#/",target:r==null?void 0:r.target,...l,...o,children:s}):w.createElement("a",{...l,...o,href:(r==null?void 0:r.href)||"#",target:(r==null?void 0:r.target)||"_self","aria-label":a},a)},he={type:"Link",label:"Link",category:"core",icon:m.Link1Icon,group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},me=e=>{const{blockProps:l,children:r,listType:s,styles:o,tag:n,inBuilder:a}=e,d=x.cn(y.get(o,"className",""),s);return!r&&y.isEmpty(o==null?void 0:o.className)?i.jsx(C,{inBuilder:a}):k.createElement(n||(s==="list-decimal"?"ol":"ul"),{...l,...o,className:d},r)},fe={type:"List",label:"web_blocks.list",icon:m.RowsIcon,category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},be=e=>{const{blockProps:l,content:r,styles:s,children:o,tag:n}=e;return o?k.createElement(n||"li",{...s,...l},o):k.createElement(n||"li",{...s,...l,dangerouslySetInnerHTML:{__html:r}})},ke={type:"ListItem",label:"List Item",icon:m.ColumnsIcon,category:"core",group:"basic",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"},xe=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,Se={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:m.SpaceBetweenVerticallyIcon,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("text-black"),content:{type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},N=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,M=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,D=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,Be=e=>{if(N.test(e)){const l=e.match(N);return l?`https://www.youtube.com/embed/${l[4]}`:e}if(M.test(e)){const l=e.match(M);return l?`https://player.vimeo.com/video/${l[3]}`:e}if(D.test(e)){const l=e.match(D);return l?`https://www.dailymotion.com/embed/video/${l[4]}`:e}return null},we=k.memo(e=>{const{blockProps:l,inBuilder:r,styles:s,url:o,controls:n}=e,a=y.get(n,"autoPlay",!1),d=y.get(n,"controls",!1),c=a||y.get(n,"muted",!0),p=y.get(n,"loop",!1);if(y.isEmpty(o))return i.jsx(C,{inBuilder:r,className:"h-36"});let g=Be(o),h=null;if(g){if(!y.isEmpty(g)){const u=[];u.push(`autoplay=${a?1:0}`),u.push(`controls=${n?1:0}`),u.push(`mute=${c?1:0}&muted=${c?1:0}`),u.push(`loop=${p?1:0}`),g=`${g}?${u.join("&")}`}h=k.createElement("iframe",{...l,className:"absolute inset-0 w-full h-full",src:g,allow:r?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else h=k.createElement("video",{...l,className:"absolute inset-0 w-full h-full",src:o,controls:d,muted:c,autoPlay:r?!1:a,loop:p});return i.jsx("div",{...y.pick(s,["className"]),children:i.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[r?i.jsx("div",{...l,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,h]})})}),Ce={type:"Video",label:"Video",category:"core",icon:m.VideoIcon,group:"media",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),url:{type:"string",title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"},controls:{type:"object",title:"Controls",default:{autoplay:!1,controls:!0,loop:!1,muted:!1},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}}}}),i18nProps:["url"]},j={wrapper:{"x-data":"{ open: false }"},button:{"x-on:click":"open = !open"},menu:{"x-show":"open","x-on:click":"open = false","x-on:click.away":"open = false","x-cloak":"","x-transition":""}},ve=e=>{const{blockProps:l,content:r,icon:s,iconWidth:o,iconHeight:n,styles:a,show:d}=e;return i.jsxs("button",{"aria-label":r,...l,...a,...j.button,children:[r,i.jsx("span",{className:d?"rotate-180":"",dangerouslySetInnerHTML:{__html:s},style:{width:o,height:n}})]})};t.registerChaiBlock(ve,{type:"DropdownButton",label:"Dropdown Button",group:"advanced",category:"core",hidden:!0,canMove:()=>!1,canDelete:()=>!1,...t.registerChaiBlockSchema({properties:{show:t.closestBlockProp("Dropdown","showDropdown"),content:{type:"string",title:"Title",default:"Menu Item"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconWidth:{type:"string",title:"Icon Width",default:"16px"},iconHeight:{type:"string",title:"Icon Height",default:"16px"},styles:t.StylesProp("flex items-center gap-2 px-4 py-1")}}),i18nProps:["content"],aiProps:["content"]});const Pe=e=>{const{blockProps:l,children:r,styles:s,show:o,inBuilder:n}=e;return n&&!o?null:i.jsx("div",{...l,...j.menu,...s,children:r})};t.registerChaiBlock(Pe,{type:"DropdownContent",label:"Dropdown Content",group:"basic",hidden:!0,canMove:()=>!1,canDelete:()=>!1,canAcceptBlock:()=>!0,...t.registerChaiBlockSchema({properties:{show:t.closestBlockProp("Dropdown","showDropdown"),styles:t.StylesProp("absolute left-0 p-2 w-80 mt-2 bg-white rounded-lg shadow-lg z-50")}})});const _e=e=>{const{blockProps:l,children:r,styles:s}=e;return i.jsx("div",{...l,...s,...j.wrapper,children:r})},Ie={type:"Dropdown",label:"Dropdown",group:"basic",icon:m.DropdownMenuIcon,blocks:()=>[{_type:"Dropdown",_id:"dropdown"},{_type:"DropdownButton",_id:"button",_parent:"dropdown",title:"Menu Item",icon:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 24 24"> <path d="M16.293 9.293 12 13.586 7.707 9.293l-1.414 1.414L12 16.414l5.707-5.707z"/> </svg>',styles:"#styles:,flex items-center gap-2 px-4 py-1"},{_type:"DropdownContent",_id:"content",_parent:"dropdown",styles:"#styles:,absolute left-0 w-80 mt-0.5 bg-white rounded-lg shadow-lg z-50"},{_type:"Link",_id:"link",_parent:"content",content:"Link",styles:"#styles:,flex items-center gap-2 px-4 py-1",link:{href:"https://www.google.com",type:"url",target:"_self"}}],category:"core",wrapper:!0,...t.registerChaiBlockSchema({properties:{showDropdown:t.runtimeProp({type:"boolean",title:"Show Dropdown",default:!1}),styles:t.StylesProp("relative w-max")}})},je=e=>{const{blockProps:l,fieldName:r,label:s,styles:o,inputStyles:n,required:a,checked:d,showLabel:c=!0}=e,p=x.generateUUID();return c?i.jsxs("div",{...o,...l,children:[i.jsx("input",{...n,name:r,id:p,type:"checkbox",required:a,defaultChecked:d}),s&&i.jsx("label",{htmlFor:p,children:s})]}):i.jsx("input",{id:p,...l,...n,...o,type:"checkbox",required:a,name:r})},Le={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("flex items-center gap-x-2"),inputStyles:t.StylesProp(""),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"]},Ne=e=>{const{children:l,blockProps:r,errorMessage:s,successMessage:o,action:n,styles:a,inBuilder:d}=e;let c=l;l||(c=i.jsx(C,{inBuilder:d}));const p={"x-data":"{}","x-on:submit.prevent":"post"},g={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...p,"data-error":s,"data-success":o,method:"post",action:n,...r,...a,children:[i.jsx("div",{...g}),c]})},Me={type:"Form",label:"Form",category:"core",icon:S.GroupIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form/submit"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},De=e=>{const{blockProps:l,inBuilder:r,label:s,styles:o,inputStyles:n,icon:a,iconSize:d,iconPos:c}=e,p=x.generateUUID(),g={"x-bind:disabled":"formLoading"};return i.jsxs("button",{id:p,...g,...n,...o,...l||{},type:r?"button":"submit","aria-label":s,children:[s,a&&i.jsx("div",{style:{width:d+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},$e={type:"FormButton",label:"Submit Button",category:"core",icon:m.ButtonIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:t.StylesProp(""),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},Ee=e=>{const{blockProps:l,fieldName:r,label:s,placeholder:o,styles:n,inputStyles:a,showLabel:d,required:c,inputType:p}=e,g=x.generateUUID();return d?i.jsxs("div",{...n,...l,children:[d&&i.jsx("label",{htmlFor:g,children:s}),i.jsx("input",{name:r,...a,id:g,type:p,placeholder:o,required:c})]}):i.jsx("input",{id:g,name:r,...l,...a,...n,type:p,placeholder:o,required:c})},Te={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","file","hidden","range","submit","color","date","time"]}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Ae=e=>{const{blockProps:l,content:r,styles:s,children:o}=e,n={...s,...l};return o?k.createElement("label",n,o):k.createElement("label",{...n,dangerouslySetInnerHTML:{__html:r}})},Re={type:"Label",label:"Label",category:"core",icon:m.LetterCaseToggleIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},ze=e=>{const{blockProps:l,fieldName:r,label:s,styles:o,inputStyles:n,required:a,checked:d,showLabel:c=!0}=e,p=x.generateUUID();return c?i.jsxs("div",{...o,...l,children:[i.jsx("input",{...n,name:r,id:p,type:"radio",required:a,defaultChecked:d}),s&&i.jsx("label",{htmlFor:p,children:s})]}):i.jsx("input",{id:p,...l,...n,...o,type:"radio",required:a,checked:d,name:r})},He={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("flex items-center gap-x-2"),inputStyles:t.StylesProp(""),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"]},qe=e=>{const{blockProps:l,fieldName:r,label:s,placeholder:o,styles:n,inputStyles:a,required:d,showLabel:c,_multiple:p,options:g}=e,h=x.generateUUID();return c?i.jsxs("div",{...n,...l,children:[c&&i.jsx("label",{htmlFor:h,children:s}),i.jsxs("select",{...a,id:h,required:d,multiple:p,name:r,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:o}),y.map(g,u=>i.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})]}):i.jsxs("select",{id:h,...n,...l,required:d,multiple:p,name:r,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:o}),y.map(g,u=>i.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})},Ue={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),inputStyles:t.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Fe=e=>{const{blockProps:l,fieldName:r,label:s,placeholder:o,styles:n,inputStyles:a,_rows:d,showLabel:c}=e,p=x.generateUUID();return c?i.jsxs("div",{...n,...l,children:[c&&i.jsx("label",{htmlFor:p,children:s}),i.jsx("textarea",{name:r,...a,id:p,placeholder:o,rows:d})]}):i.jsx("textarea",{id:p,name:r,...l,...a,...n,placeholder:o,rows:d})},Oe={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",...t.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:t.StylesProp(""),inputStyles:t.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},_rows:{type:"number",title:"Rows",default:3}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Ge=e=>{const{blockProps:l,backgroundImage:r,children:s,styles:o,tag:n}=e;let a={};return r&&(a={backgroundImage:`url(${r})`}),w.createElement(n||"div",{...l,...o,style:a},s)},Ve={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("font-body antialiased"),backgroundImage:{type:"string",title:"Image",default:"",ui:{"ui:widget":"image"}},tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]}}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},We=e=>{const{blockProps:l,styles:r}=e;return w.createElement("br",{...l,...r})},Xe={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},_={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"}},Ye=e=>{const{blockProps:l,children:r,styles:s,colSpan:o,tabletColSpan:n,desktopColSpan:a}=e,c={className:[y.get(s,"className",""),y.get(_,["SMALL",isNaN(o)||!o?6:o],""),n?y.get(_,["MEDIUM",n||o],""):"",a?y.get(_,["LARGE",n||o],""):""].join(" ")};return i.jsx("div",{...l,...s,...c,children:r||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"})})},Ze={type:"Column",label:"Column",group:"basic",category:"core",icon:S.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),colSpan:{type:"number",title:"Column Span",default:6,enum:[1,2,3,4,5,6,7,8,9,10,11,12]},tabletColSpan:{type:"number",title:"Column Span (Tablet)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]},desktopColSpan:{type:"number",title:"Column Span (Desktop)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]}}})},Je=e=>{const{blockProps:l,children:r,styles:s,gutter:o}=e,a={className:[y.get(s,"className","")," grid grid-cols-12"].join()};return typeof(s==null?void 0:s.style)=="object"?s.style.gap=`${o}px`:a.style={gap:`${o}px`},i.jsx("div",{...l,...s,...a,children:r})},Ke={type:"Row",label:"Row",group:"basic",icon:S.Rows,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},v=(e,l)=>({slider:{"x-data":`{
4
- currentSlide: 0,
5
- totalSlides: ${(l==null?void 0:l.totalSlides)||0},
6
- autoplay: ${!!(l!=null&&l.autoplay)},
7
- autoplayInterval: null,
8
- init() {
9
- if (this.autoplay) {
10
- this.startAutoplay();
11
- }
12
- },
13
- startAutoplay() {
14
- this.autoplayInterval = setInterval(() => {
15
- this.nextSlide();
16
- }, ${isNaN(l==null?void 0:l.autoplayInterval)?3e3:(l==null?void 0:l.autoplayInterval)*1e3});
17
- },
18
- stopAutoplay() {
19
- clearInterval(this.autoplayInterval);
20
- },
21
- nextSlide() {
22
- this.currentSlide = (this.currentSlide + 1) % this.totalSlides;
23
- },
24
- prevSlide() {
25
- this.currentSlide = (this.currentSlide - 1 + this.totalSlides) %this.totalSlides;
26
- },
27
- updateCurrentSlide(slide) {
28
- this.currentSlide = slide;
29
- },
30
- }`},slides:{":style":"'transform: translateX(-' + currentSlide * 100 + '%)'"},prevButton:{"x-on:click":"stopAutoplay(); prevSlide();"},nextButton:{"x-on:click":"stopAutoplay(); nextSlide();"},sliderNav:{":class":`currentSlide === ${l==null?void 0:l.slide} ? '${l==null?void 0:l.activeDotClassName}' : '${l==null?void 0:l.className}'`,"x-on:click":`stopAutoplay(); updateCurrentSlide(${l==null?void 0:l.slide});`}})[e]||{},Qe=e=>{const{blockProps:l,styles:r,children:s,slider:o}=e;return!(o!=null&&o.showSlideButton)&&typeof(o==null?void 0:o.showSlideButton)=="boolean"?null:i.jsx("div",{...l,...r,...v("prevButton"),children:s})};t.registerChaiBlock(Qe,{type:"SlidePreviousButton",label:"Slide Previous",group:"basic",category:"core",icon:S.PanelRightOpen,canDelete:()=>!1,canAcceptBlock:()=>!0,canBeNested:e=>e==="Slider",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("h-max w-max absolute left-0 top-1/2 -translate-y-1/2 flex items-center justify-center p-2 cursor-pointer"),slider:t.closestBlockProp("Slider","slider")}})});const et=e=>{const{blockProps:l,styles:r,children:s,slider:o}=e;return!(o!=null&&o.showSlideButton)&&typeof(o==null?void 0:o.showSlideButton)=="boolean"?null:i.jsx("div",{...l,...r,...v("nextButton"),children:s})};t.registerChaiBlock(et,{type:"SlideNextButton",label:"Slide Next",group:"basic",category:"core",icon:S.PanelRightClose,canDelete:()=>!1,canAcceptBlock:()=>!0,canBeNested:e=>e==="Slider",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("h-max w-max absolute right-0 top-1/2 -translate-y-1/2 flex items-center justify-center p-2 cursor-pointer"),slider:t.closestBlockProp("Slider","slider")}})});const tt=e=>{var a,d,c,p,g;const{blockProps:l,styles:r,children:s=null,inBuilder:o,slider:n}=e;if(o){const h=((d=(a=e==null?void 0:e.children)==null?void 0:a.props)==null?void 0:d.allBlocks)||((p=(c=e==null?void 0:e.children)==null?void 0:c.props)==null?void 0:p.blocks)||[],u=n==null?void 0:n.currentSlide,f=(g=h==null?void 0:h.filter(B=>(B==null?void 0:B._parent)===(e==null?void 0:e._id)))==null?void 0:g.findIndex(B=>(B==null?void 0:B._id)===u);return i.jsx("div",{...l,...r,style:{transform:`translateX(-${Math.max(0,f)*100}%)`},children:s||i.jsx("div",{className:"h-full p-2",children:i.jsx("div",{className:"h-full border-2 border-dashed"})})})}return i.jsx("div",{...l,...r,...v("slides"),children:s||i.jsx("div",{className:"h-full p-2",children:i.jsx("div",{className:"h-full border-2 border-dashed"})})})};t.registerChaiBlock(tt,{type:"Slides",label:"Slides",group:"basic",category:"core",icon:S.AlignHorizontalJustifyStart,canDelete:()=>!1,canAcceptBlock:e=>e==="Slide",canBeNested:e=>e==="Slider",...t.registerChaiBlockSchema({properties:{slider:t.closestBlockProp("Slider","slider"),styles:t.StylesProp("h-full flex transition-transform duration-500 ease-in-out")}})});const lt=e=>{const{blockProps:l,styles:r,children:s=null}=e;return i.jsx("div",{...l,...r,children:s||i.jsxs("div",{className:"flex h-full min-w-full items-center justify-center",children:["Slide ",(e==null?void 0:e.index)+1]})})};t.registerChaiBlock(lt,{type:"Slide",label:"Slide",group:"basic",category:"core",icon:S.AppWindowIcon,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Slides",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("min-w-full h-full")}})});const rt=e=>{var u,f,B,L;const{blockProps:l,styles:r,dotStyles:s,activeDotStyles:o,slider:n,inBuilder:a,children:d}=e;if(!(n!=null&&n.showSlideNavbar)&&typeof(n==null?void 0:n.showSlideNavbar)=="boolean")return null;const c=((f=(u=e==null?void 0:e.children)==null?void 0:u.props)==null?void 0:f.allBlocks)||((L=(B=e==null?void 0:e.children)==null?void 0:B.props)==null?void 0:L.blocks)||[],p=c==null?void 0:c.find(b=>(b==null?void 0:b._id)===(e==null?void 0:e._id)),g=c==null?void 0:c.find(b=>(b==null?void 0:b._parent)===(p==null?void 0:p._parent)&&(b==null?void 0:b._type)==="Slides"),h=c==null?void 0:c.filter(b=>(b==null?void 0:b._parent)===(g==null?void 0:g._id));return a?i.jsx("div",{...l,...r,children:h==null?void 0:h.map((b,P)=>i.jsx("div",{...s,...n!=null&&n.currentSlide?(b==null?void 0:b._id)===(n==null?void 0:n.currentSlide)?o:{}:P===0?o:{},children:d}))}):i.jsx("div",{...l,...r,children:h==null?void 0:h.map((b,P)=>i.jsx("div",{...v("sliderNav",{slide:P,className:s==null?void 0:s.className,activeDotClassName:(o==null?void 0:o.className)??""})},b==null?void 0:b._id))})};t.registerChaiBlock(rt,{type:"SliderNav",label:"Slider Navigation",group:"basic",category:"core",icon:S.PanelRightOpen,canDelete:()=>!1,canAcceptBlock:()=>!1,canBeNested:e=>e==="Slider",...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("w-full absolute left-0 bottom-0 flex items-center justify-center gap-x-2 p-2"),dotStyles:t.StylesProp("w-4 h-4 border border-gray-500 rounded-full cursor-pointer"),activeDotStyles:t.StylesProp("w-4 h-4 rounded-full bg-blue-500"),slider:t.closestBlockProp("Slider","slider")}})});const ot=()=>null;t.registerChaiBlock(ot,{type:"SliderNavItem",label:"Slider Nav Item",group:"basic",category:"core",hidden:!0,icon:S.PanelRightOpen,canDelete:()=>!1,canDuplicate:()=>!1,canAcceptBlock:()=>!1,canBeNested:e=>e==="SliderNav",...t.registerChaiBlockSchema({properties:{}})});const st=e=>{var c,p,g,h,u;const{blockProps:l,styles:r,children:s=null}=e,o=((p=(c=e==null?void 0:e.children)==null?void 0:c.props)==null?void 0:p.allBlocks)||((h=(g=e==null?void 0:e.children)==null?void 0:g.props)==null?void 0:h.blocks)||[],n=o==null?void 0:o.find(f=>(f==null?void 0:f._parent)===(e==null?void 0:e._id)&&(f==null?void 0:f._type)==="Slides"),d={totalSlides:((u=o==null?void 0:o.filter(f=>(f==null?void 0:f._parent)===(n==null?void 0:n._id)))==null?void 0:u.length)||0,...typeof e.slider=="object"?e.slider:{}};return i.jsx("div",{...l,...r,...v("slider",d),children:s||i.jsx("div",{className:"h-[60vh] p-2",children:i.jsx("div",{className:"h-full border-2 border-dashed"})})})},it={type:"Slider",label:"Slider",category:"core",icon:S.UnfoldHorizontal,group:"basic",wrapper:!0,blocks:()=>[{_type:"Slider",_id:"slider"},{_type:"Slides",_id:"slider-slides",_parent:"slider"},{_type:"Slide",_id:"slider-slides-slide-1",_parent:"slider-slides"},{_type:"Slide",_id:"slider-slides-slide-2",_parent:"slider-slides"},{_type:"Slide",_id:"slider-slides-slide-3",_parent:"slider-slides"},{_type:"SlidePreviousButton",_parent:"slider",_id:"slider-left-arrow"},{_type:"Icon",_id:"slider-left-arrow-content",icon:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 320 512"><path d="M34.52 239.03L228.87 44.69c9.37-9.37 24.57-9.37 33.94 0l22.67 22.67c9.36 9.36 9.37 24.52.04 33.9L131.49 256l154.02 154.75c9.34 9.38 9.32 24.54-.04 33.9l-22.67 22.67c-9.37 9.37-24.57 9.37-33.94 0L34.52 272.97c-9.37-9.37-9.37-24.57 0-33.94z"/></svg>',_parent:"slider-left-arrow"},{_type:"SlideNextButton",_parent:"slider",_id:"slider-right-arrow"},{_type:"Icon",_id:"slider-right-arrow-content",icon:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 320 512"><path d="M285.476 272.971L91.132 467.314c-9.373 9.373-24.569 9.373-33.941 0l-22.667-22.667c-9.357-9.357-9.375-24.522-.04-33.901L188.505 256 34.484 101.255c-9.335-9.379-9.317-24.544.04-33.901l22.667-22.667c9.373-9.373 24.569-9.373 33.941 0L285.475 239.03c9.373 9.372 9.373 24.568.001 33.941z"/></svg>',_parent:"slider-right-arrow"},{_type:"SliderNav",_parent:"slider",_id:"slider-nav"},{_type:"SliderNavItem",_parent:"slider-nav",_id:"slider-nav-item"}],...t.registerChaiBlockSchema({properties:{styles:t.StylesProp("w-full h-[60vh] relative overflow-x-hidden"),slider:t.runtimeProp({type:"object",properties:{},default:{currentSlide:null,autoplay:!1,autoplayInterval:2,showSlideButton:!0,showSlideNavbar:!0},ui:{"ui:field":"slider"}})}})},nt=()=>{t.registerChaiBlock(E,T),t.registerChaiBlock(q,U),t.registerChaiBlock(A,R),t.registerChaiBlock(F,O),t.registerChaiBlock(G,V),t.registerChaiBlock(Y,Z),t.registerChaiBlock(W,X),t.registerChaiBlock(ye,he),t.registerChaiBlock(pe,ge),t.registerChaiBlock(me,fe),t.registerChaiBlock(be,ke),t.registerChaiBlock(ae,ce),t.registerChaiBlock(de,ue),t.registerChaiBlock(we,Ce),t.registerChaiBlock(z,H),t.registerChaiBlock(K,Q),t.registerChaiBlock(xe,Se),t.registerChaiBlock(Ne,Me),t.registerChaiBlock(De,$e),t.registerChaiBlock(Ee,Te),t.registerChaiBlock(je,Le),t.registerChaiBlock(ze,He),t.registerChaiBlock(qe,Ue),t.registerChaiBlock(Fe,Oe),t.registerChaiBlock(Ae,Re),t.registerChaiBlock(We,Xe),t.registerChaiBlock(Ge,Ve),t.registerChaiBlock(oe,se),t.registerChaiBlock(ee,re),t.registerChaiBlock(ie,ne),t.registerChaiBlock(_e,Ie),t.registerChaiBlock(Je,Ke),t.registerChaiBlock(Ye,Ze),t.registerChaiBlock(st,it)};exports.loadWebBlocks=nt;
3
+ nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.`,ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},w=(e,...l)=>({...e,className:b.cn(e.className,...l)}),q=e=>{const{blockProps:l,content:t,styles:s}=e,r=w(s,"prose","max-w-full");return i.jsx("div",{...l,...r,dangerouslySetInnerHTML:{__html:t}})},U={type:"RichText",label:"Rich Text",category:"core",icon:y.CursorTextIcon,group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},F=e=>{const{blockProps:l,styles:t,content:s,children:r=null,tag:n}=e;return r?h.createElement("span",{...t,...l},r):h.createElement(n||"span",{...t,...l,dangerouslySetInnerHTML:{__html:s||""}})},O={type:"Span",label:"Span",category:"core",group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0};function G(e){return b.GenIcon({tag:"svg",attr:{version:"1.1",viewBox:"0 0 32 32"},child:[{tag:"path",attr:{d:"M4.698 3.419l2.057 23.073 9.231 2.563 9.256-2.566 2.059-23.069h-22.604zM13.226 9.394l-0.409 4.441 9.671 0.001-0.069 0.76-0.665 7.45-0.042 0.478-5.804 1.609-5.796-1.609-0.396-4.443h2.84l0.202 2.257 3.154 0.85 3.156-0.852 0.328-3.67-9.671-0.001 0.069-0.76 0.665-7.45 0.209-2.086h11.287l0.131 1.598 0.403 4.453h-2.841l-0.262-2.922-2.889-0.174h-0.515v-0.004l-2.755 0.074z"},child:[]}]})(e)}const V=e=>{const{scripts:l,inBuilder:t,blockProps:s}=e;return t?i.jsx("div",{...s,children:i.jsx("div",{className:b.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:l}})},W={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:G,group:"advanced",...o.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},X=e=>{const{blockProps:l,styles:t}=e;return k.createElement("hr",{...t,...l})},Y={type:"Divider",label:"web_blocks.divider",category:"core",icon:y.DividerHorizontalIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Z=e=>{const{blockProps:l,inBuilder:t,children:s,globalBlock:r}=e;return t&&!r?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...l,children:[i.jsxs("h1",{children:["Global Block - ",r]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):h.createElement("span",{...l},s)},J={type:"GlobalBlock",label:"Global Block",icon:B.GlobeIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},K=e=>{const{blockProps:l,icon:t,styles:s,width:r,inBuilder:n,height:a}=e,c=w(s,"");if(g.isEmpty(t))return i.jsx(C,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return h.createElement("span",{...l,...c,style:{width:r?`${r}px`:"auto",height:a?`${a}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},Q={type:"Icon",label:"web_blocks.icon",category:"core",icon:y.SketchLogoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),icon:{type:"string",title:"Icon",default:'<svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M8 16c4.418 0 8-3.582 8-8s-3.582-8-8-8-8 3.582-8 8 3.582 8 8 8zM8 1.5c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5-6.5-2.91-6.5-6.5 2.91-6.5 6.5-6.5zM8 9.356c1.812 0 3.535-0.481 5-1.327-0.228 2.788-2.393 4.971-5 4.971s-4.772-2.186-5-4.973c1.465 0.845 3.188 1.329 5 1.329zM4 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5zM10 5.5c0-0.828 0.448-1.5 1-1.5s1 0.672 1 1.5c0 0.828-0.448 1.5-1 1.5s-1-0.672-1-1.5z"></path></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},ee=e=>{const{blockProps:l,image:t,mobileImage:s,styles:r,alt:n,height:a,width:c,lazyLoading:p}=e;return g.isEmpty(t)?i.jsx(C,{className:"h-36"}):i.jsxs("picture",{children:[s&&i.jsx("source",{srcSet:s,media:"(max-width: 480px)"}),i.jsx("img",{...l,...r,src:t,alt:n,loading:p?"lazy":"eager",width:c,height:a})]})},te={type:"Image",label:"Image",category:"core",icon:y.ImageIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),image:{type:"string",title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas",ui:{"ui:widget":"image"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}}}}),aiProps:["alt"],i18nProps:["alt"]},le=e=>{const{blockProps:l,children:t,styles:s,inBuilder:r,content:n,href:a}=e,{hrefType:c,autoplay:p,maxWidth:d,backdropColor:m,galleryName:f}=e,u=w(s,"cb-lightbox vbox-item");if(!t&&g.isEmpty(s==null?void 0:s.className)&&g.isEmpty(n))return i.jsx(C,{inBuilder:r});if(r)return t?i.jsx("span",{...l,...u,children:t}):k.createElement("span",{...l,...u,dangerouslySetInnerHTML:{__html:n}});const x={};return c!=="image"&&(x["data-vbtype"]=c),p&&(x["data-autoplay"]="true"),d&&(x["data-maxwidth"]=d+"px"),m&&(x["data-overlay"]=m),f&&(x["data-gall"]=f),t?i.jsx("a",{"aria-label":n,...x,href:a||"#/",...l,...u,children:t}):k.createElement("a",{...l,...u,...x,href:a||"#",dangerouslySetInnerHTML:{__html:n},"aria-label":n})},oe={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:y.ImageIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"Link text or drop blocks inside"},hrefType:{type:"string",title:"Type",default:"image",enum:["image","video","iframe","inline","ajax"],enumNames:["Image","Video","Iframe","Inline","Ajax"]},href:{type:"string",title:"Href",default:""},autoplay:{type:"boolean",title:"Autoplay (Video only)",default:!1},maxWidth:{type:"number",title:"Max Width",default:""},backdropColor:{type:"string",title:"Backdrop Color",default:""},galleryName:{type:"string",title:"Gallery Name",default:""}},dependencies:{autoplay:["hrefType","video"]}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},re=e=>{const{blockProps:l,link:t,children:s,styles:r,inBuilder:n,content:a}=e;let c={};return!s&&g.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?s?i.jsx("span",{...l,style:c,...r,children:s}):k.createElement("span",{...l,...r,style:c},a):s?i.jsx("a",{"aria-label":a,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...l,...r,children:s}):k.createElement("a",{...l,...r,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":a},a)},se={type:"Link",label:"Link",category:"core",icon:y.Link1Icon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:e=>e!=="Link"},ie=e=>{const{blockProps:l,children:t,listType:s,styles:r,tag:n,inBuilder:a}=e,c=b.cn(g.get(r,"className",""),s);return!t&&g.isEmpty(r==null?void 0:r.className)?i.jsx(C,{inBuilder:a}):h.createElement(n||(s==="list-decimal"?"ol":"ul"),{...l,...r,className:c},t)},ne={type:"List",label:"web_blocks.list",icon:y.RowsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),listType:{type:"string",title:"List Type",default:"list-none",oneOf:[{enum:["list-none"],title:"List None"},{enum:["list-disc"],title:"Disc"},{enum:["list-decimal"],title:"Decimal"}]}}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},ae=e=>{const{blockProps:l,content:t,styles:s,children:r,tag:n}=e;return r?h.createElement(n||"li",{...s,...l},r):h.createElement(n||"li",{...s,...l,dangerouslySetInnerHTML:{__html:t}})},ce={type:"ListItem",label:"List Item",icon:y.ColumnsIcon,category:"core",group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"},pe=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,ue={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:y.SpaceBetweenVerticallyIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-black"),content:{type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},P=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,L=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,de=e=>{if(P.test(e)){const l=e.match(P);return l?`https://www.youtube.com/embed/${l[4]}`:e}if(I.test(e)){const l=e.match(I);return l?`https://player.vimeo.com/video/${l[3]}`:e}if(L.test(e)){const l=e.match(L);return l?`https://www.dailymotion.com/embed/video/${l[4]}`:e}return null},ge=h.memo(e=>{const{blockProps:l,inBuilder:t,styles:s,url:r,controls:n}=e,a=g.get(n,"autoPlay",!1),c=g.get(n,"controls",!1),p=a||g.get(n,"muted",!0),d=g.get(n,"loop",!1);if(g.isEmpty(r))return i.jsx(C,{inBuilder:t,className:"h-36"});let m=de(r),f=null;if(m){if(!g.isEmpty(m)){const u=[];u.push(`autoplay=${a?1:0}`),u.push(`controls=${n?1:0}`),u.push(`mute=${p?1:0}&muted=${p?1:0}`),u.push(`loop=${d?1:0}`),m=`${m}?${u.join("&")}`}f=h.createElement("iframe",{...l,className:"absolute inset-0 w-full h-full",src:m,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else f=h.createElement("video",{...l,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:p,autoPlay:t?!1:a,loop:d});return i.jsx("div",{...g.pick(s,["className"]),children:i.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?i.jsx("div",{...l,...g.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,f]})})}),me={type:"Video",label:"Video",category:"core",icon:y.VideoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),url:{type:"string",title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann"},controls:{type:"object",title:"Controls",default:{autoplay:!1,controls:!0,loop:!1,muted:!1},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}}}}),i18nProps:["url"]},ye=e=>{const{blockProps:l,fieldName:t,label:s,styles:r,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=b.generateUUID();return p?i.jsxs("div",{...r,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"checkbox",required:a,defaultChecked:c}),s&&i.jsx("label",{htmlFor:d,children:s})]}):i.jsx("input",{id:d,...l,...n,...r,type:"checkbox",required:a,name:t})},he={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:y.CheckboxIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},fe=e=>{const{children:l,blockProps:t,errorMessage:s,successMessage:r,action:n,styles:a,inBuilder:c}=e;let p=l;l||(p=i.jsx(C,{inBuilder:c}));const d={"x-data":"{}","x-on:submit.prevent":"post"},m={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxs("form",{...d,"data-error":s,"data-success":r,method:"post",action:n,...t,...a,children:[i.jsx("div",{...m}),p]})},be={type:"Form",label:"Form",category:"core",icon:B.GroupIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form/submit"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},ke=e=>{const{blockProps:l,inBuilder:t,label:s,styles:r,inputStyles:n,icon:a,iconSize:c,iconPos:p}=e,d=b.generateUUID(),m={"x-bind:disabled":"formLoading"};return i.jsxs("button",{id:d,...m,...n,...r,...l||{},type:t?"button":"submit","aria-label":s,children:[s,a&&i.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},xe={type:"FormButton",label:"Submit Button",category:"core",icon:y.ButtonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),inputStyles:o.StylesProp(""),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},Ce=e=>{const{blockProps:l,fieldName:t,label:s,placeholder:r,styles:n,inputStyles:a,showLabel:c,required:p,inputType:d}=e,m=b.generateUUID();return c?i.jsxs("div",{...n,...l,children:[c&&i.jsx("label",{htmlFor:m,children:s}),i.jsx("input",{name:t,...a,id:m,type:d,placeholder:r,required:p})]}):i.jsx("input",{id:m,name:t,...l,...a,...n,type:d,placeholder:r,required:p})},Be={type:"Input",label:"web_blocks.input",category:"core",icon:y.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},inputType:{type:"string",title:"Input Type",default:"text",enum:["text","email","password","number","tel","file","hidden","range","submit","color","date","time"]}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Se=e=>{const{blockProps:l,content:t,styles:s,children:r}=e,n={...s,...l};return r?h.createElement("label",n,r):h.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},we={type:"Label",label:"Label",category:"core",icon:y.LetterCaseToggleIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},Pe=e=>{const{blockProps:l,fieldName:t,label:s,styles:r,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,d=b.generateUUID();return p?i.jsxs("div",{...r,...l,children:[i.jsx("input",{...n,name:t,id:d,type:"radio",required:a,defaultChecked:c}),s&&i.jsx("label",{htmlFor:d,children:s})]}):i.jsx("input",{id:d,...l,...n,...r,type:"radio",required:a,checked:c,name:t})},Ie={type:"Radio",label:"web_blocks.radio",category:"core",icon:y.RadiobuttonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},Le=e=>{const{blockProps:l,fieldName:t,label:s,placeholder:r,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:d,options:m}=e,f=b.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:f,children:s}),i.jsxs("select",{...a,id:f,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),g.map(m,u=>i.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})]}):i.jsxs("select",{id:f,...n,...l,required:c,multiple:d,name:t,children:[i.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),g.map(m,u=>i.jsx("option",{value:u==null?void 0:u.value,children:u==null?void 0:u.label},u==null?void 0:u.value))]})},ve={type:"Select",label:"web_blocks.select",category:"core",icon:y.DropdownMenuIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},_e=e=>{const{blockProps:l,fieldName:t,label:s,placeholder:r,styles:n,inputStyles:a,_rows:c,showLabel:p}=e,d=b.generateUUID();return p?i.jsxs("div",{...n,...l,children:[p&&i.jsx("label",{htmlFor:d,children:s}),i.jsx("textarea",{name:t,...a,id:d,placeholder:r,rows:c})]}):i.jsx("textarea",{id:d,name:t,...l,...a,...n,placeholder:r,rows:c})},je={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:y.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:o.StylesProp(""),inputStyles:o.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},_rows:{type:"number",title:"Rows",default:3}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},Ne=e=>{const{blockProps:l,styles:t}=e;return k.createElement("br",{...l,...t})},Ee={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},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"}},Me=e=>{const{blockProps:l,children:t,styles:s,colSpan:r,tabletColSpan:n,desktopColSpan:a}=e,p={className:[g.get(s,"className",""),g.get(S,["SMALL",isNaN(r)||!r?6:r],""),n?g.get(S,["MEDIUM",n||r],""):"",a?g.get(S,["LARGE",n||r],""):""].join(" ")};return i.jsx("div",{...l,...s,...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",label:"Column",group:"basic",category:"core",icon:B.Columns,wrapper:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),colSpan:{type:"number",title:"Column Span",default:6,enum:[1,2,3,4,5,6,7,8,9,10,11,12]},tabletColSpan:{type:"number",title:"Column Span (Tablet)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]},desktopColSpan:{type:"number",title:"Column Span (Desktop)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]}}})},$e=e=>{const{blockProps:l,children:t,styles:s,gutter:r}=e,a={className:[g.get(s,"className","")," grid grid-cols-12"].join()};return typeof(s==null?void 0:s.style)=="object"?s.style.gap=`${r}px`:a.style={gap:`${r}px`},i.jsx("div",{...l,...s,...a,children:t})},Re={type:"Row",label:"Row",group:"basic",icon:B.Rows,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},Ae=()=>{o.registerChaiBlock(_,j),o.registerChaiBlock($,R),o.registerChaiBlock(N,E),o.registerChaiBlock(A,z),o.registerChaiBlock(H,D),o.registerChaiBlock(F,O),o.registerChaiBlock(q,U),o.registerChaiBlock(re,se),o.registerChaiBlock(le,oe),o.registerChaiBlock(ie,ne),o.registerChaiBlock(ae,ce),o.registerChaiBlock(K,Q),o.registerChaiBlock(ee,te),o.registerChaiBlock(ge,me),o.registerChaiBlock(M,T),o.registerChaiBlock(V,W),o.registerChaiBlock(pe,ue),o.registerChaiBlock(fe,be),o.registerChaiBlock(ke,xe),o.registerChaiBlock(Ce,Be),o.registerChaiBlock(ye,he),o.registerChaiBlock(Pe,Ie),o.registerChaiBlock(Le,ve),o.registerChaiBlock(_e,je),o.registerChaiBlock(Se,we),o.registerChaiBlock(Ne,Ee),o.registerChaiBlock(X,Y),o.registerChaiBlock(Z,J),o.registerChaiBlock($e,Re),o.registerChaiBlock(Me,Te)};exports.loadWebBlocks=Ae;