@chaibuilder/sdk 2.0.0-beta.10 → 2.0.0-beta.12

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 r=require("lodash-es"),a=require("./STRINGS-Yl7cSWDc.cjs"),d=require("./jsx-runtime-JYMCiFoE.cjs"),y=require("react"),x=require("tailwind-merge"),T=require("@chaibuilder/runtime"),B=require("@mhsdesign/jit-browser-tailwindcss"),C=require("@tailwindcss/forms"),q=require("@tailwindcss/typography"),R=require("@tailwindcss/aspect-ratio"),j=require("./plugin-Dm5EFGnP.cjs");require("./plugin-KIpT3NWi.cjs");const Y=(t,n="")=>{const s=t.replace(a.STYLES_KEY,"").split(",").map(i=>i.split(" ").map(l=>{if(l==="")return"";if(l.includes(":")){const u=l.split(":");return u[u.length-1]=n+r.last(u),u.join(":")}return`${n}${l}`}).join(" "));return r.flattenDeep(s).join(" ")},O=t=>{if(!t)return[];try{return JSON.parse(A(t)).filter(e=>!e._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(t){const n=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return t.replace(n,e=>{const s=decodeURIComponent(e),i=s.indexOf("public");return i!==-1?s.substring(i+6):s})}const K=t=>{const n={};return Object.keys(t).forEach(e=>{r.isString(t[e])&&t[e].startsWith(a.SLOT_KEY)&&(n[e]=t[e].replace(a.SLOT_KEY,"").split(","))}),n},L=r.memoize((t,n)=>{const e=t.replace(a.STYLES_KEY,"").split(","),s=x.twMerge(e[0],e[1]);return n===""?s.replace(a.STYLES_KEY,"").trim():Y(s,n).replace(a.STYLES_KEY,"").trim()});function N(t,n){const e=r.get(t,`${n}_attrs`,{});r.has(e,"data-ai-key")&&delete e["data-ai-key"];const s=r.keys(e).join(" ");return r.includes(s,"x-show")&&!r.includes(s,"x-transition")&&(e["x-transition"]=""),e}function $(t,n){const e={};return Object.keys(t).forEach(s=>{if(r.isString(t[s])&&t[s].startsWith(a.STYLES_KEY)){const i=L(t[s],n);e[s]={className:i,...N(t,s)}}}),e}function P(t,n){const e=r.get(t,"_bindings",{});return r.isEmpty(e)?{...t}:(r.each(e,(s,i)=>{r.isString(s)&&r.get(n,s,null)&&(t[i]=r.get(n,s,null))}),t)}function v(t,n,e){if(r.isEmpty(n))return t;const s=r.cloneDeep(t);return r.forEach(r.keys(s),i=>{r.get(e,["props",i,"i18n"])&&!r.isEmpty(n)&&(s[i]=r.get(s,`${i}-${n}`,s[i]))}),s}function E({blocks:t,parent:n,classPrefix:e="",externalData:s={},blockModifierCallback:i,lang:p}){const g=t,l=o=>$(o,e),u=n?r.filter(t,{_parent:n}):r.filter(t,o=>r.isEmpty(o._parent));return d.jsxRuntimeExports.jsx(d.jsxRuntimeExports.Fragment,{children:y.Children.toArray(u.map((o,_)=>{const m=K(o),h={};r.isEmpty(m)||Object.keys(m).forEach(c=>{h[c]=y.Children.toArray(m[c].map(S=>d.jsxRuntimeExports.jsx(E,{externalData:s,classPrefix:e,blocks:g,parent:S,lang:p})))});const w=r.filter(g,{_parent:o._id});h.children=w.length>0?d.jsxRuntimeExports.jsx(E,{externalData:s,classPrefix:e,parent:o._id,blocks:g,lang:p}):null;const f=T.getBlockComponent(o._type);if(f!==null){let c=o;const S=f.component;return c={...f.defaults,...o},i&&(c=i(c)),y.createElement(S,r.omit({blockProps:{},inBuilder:!1,...c,index:_,...P(v(o,p,f),s),...l(c),...h},["_parent"]))}return d.jsxRuntimeExports.jsxs("noscript",{children:[o._type," not found"]})}))})}async function I(t,n,e=[],s="",i=!1){return await B.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:e,theme:{extend:j.getChaiBuilderTheme(t)},plugins:[C,q,R,j.chaiBuilderPlugin],corePlugins:{preflight:i},...s?{prefix:`${s}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("lodash-es"),p=require("./STRINGS-26RPxXyi.cjs"),g=require("./jsx-runtime-JYMCiFoE.cjs"),m=require("react"),j=require("tailwind-merge"),B=require("@chaibuilder/runtime"),T=require("@mhsdesign/jit-browser-tailwindcss"),C=require("@tailwindcss/forms"),q=require("@tailwindcss/typography"),R=require("@tailwindcss/aspect-ratio"),y=require("./plugin-Dm5EFGnP.cjs");require("./plugin-KIpT3NWi.cjs");const Y=(t,s="")=>{const e=t.replace(p.STYLES_KEY,"").split(",").map(i=>i.split(" ").map(l=>{if(l==="")return"";if(l.includes(":")){const a=l.split(":");return a[a.length-1]=s+r.last(a),a.join(":")}return`${s}${l}`}).join(" "));return r.flattenDeep(e).join(" ")},P=t=>{if(!t)return[];try{return JSON.parse(A(t)).filter(n=>!n._type.startsWith("@chai"))}catch{return[{_type:"Paragraph",_id:"error",content:"Invalid JSON. Please check the JSON string."}]}};function A(t){const s=/(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;return t.replace(s,n=>{const e=decodeURIComponent(n),i=e.indexOf("public");return i!==-1?e.substring(i+6):e})}const N=r.memoize((t,s)=>{const n=t.replace(p.STYLES_KEY,"").split(","),e=j.twMerge(n[0],n[1]);return s===""?e.replace(p.STYLES_KEY,"").trim():Y(e,s).replace(p.STYLES_KEY,"").trim()});function O(t,s){const n=r.get(t,`${s}_attrs`,{}),e=r.keys(n).join(" ");return r.includes(e,"x-show")&&!r.includes(e,"x-transition")&&(n["x-transition"]=""),n}function $(t,s){const n={};return Object.keys(t).forEach(e=>{if(r.isString(t[e])&&t[e].startsWith(p.STYLES_KEY)){const i=N(t[e],s);n[e]={className:i,...O(t,e)}}}),n}function K(t,s){const n=r.get(t,"_bindings",{});return r.isEmpty(n)?{...t}:(r.each(n,(e,i)=>{r.isString(e)&&r.get(s,e,null)&&(t[i]=r.get(s,e,null))}),t)}function L(t,s,n){if(r.isEmpty(s))return t;const e=r.cloneDeep(t),i=r.get(n,"i18nProps",[]);return r.forEach(r.keys(e),c=>{i.includes(c)&&!r.isEmpty(s)&&(e[c]=r.get(e,`${c}-${s}`,e[c]))}),e}function S({blocks:t,parent:s,classPrefix:n="",externalData:e={},blockModifierCallback:i,lang:c,metadata:f={}}){const l=t,a=o=>$(o,n),E=s?r.filter(t,{_parent:s}):r.filter(t,o=>r.isEmpty(o._parent));return g.jsxRuntimeExports.jsx(g.jsxRuntimeExports.Fragment,{children:m.Children.toArray(E.map((o,w)=>{const h={},x=r.filter(l,{_parent:o._id});h.children=x.length>0?g.jsxRuntimeExports.jsx(S,{externalData:e,classPrefix:n,parent:o._id,blocks:l,lang:c,metadata:f}):null;const d=B.getRegisteredChaiBlock(o._type);if(d!==null){let u=o;const _=d.component;return u={...d.defaults,...o},i&&(u=i(u)),m.createElement(_,r.omit({blockProps:{},inBuilder:!1,...u,index:w,...K(L(o,c,d),e),...a(u),...h,metadata:f},["_parent"]))}return g.jsxRuntimeExports.jsxs("noscript",{children:[o._type," not found"]})}))})}async function v(t,s,n=[],e="",i=!1){return await T.createTailwindcss({tailwindConfig:{darkMode:"class",safelist:n,theme:{extend:y.getChaiBuilderTheme(t)},plugins:[C,q,R,y.chaiBuilderPlugin],corePlugins:{preflight:i},...e?{prefix:`${e}`}:{}}}).generateStylesFromContent(` ${i?"@tailwind base;":""}
2
2
  @tailwind components;
3
- @tailwind utilities;`,n)}const J=(t,n,e=!1)=>I(n,[r.replace(JSON.stringify(t),/#styles:,?/g,"")],[],"",e),F=async(t,n={},e=!0)=>await J(t,n,e);exports.RenderChaiBlocks=E;exports.convertToBlocks=O;exports.getStylesForBlocks=F;
3
+ @tailwind utilities;`,s)}const I=(t,s,n=!1)=>v(s,[r.replace(JSON.stringify(t),/#styles:,?/g,"")],[],"",n),J=async(t,s={},n=!0)=>await I(t,s,n);exports.RenderChaiBlocks=S;exports.convertToBlocks=P;exports.getStylesForBlocks=J;
package/dist/render.d.ts CHANGED
@@ -1,12 +1,12 @@
1
1
  import { JSX as JSX_2 } from 'react/jsx-runtime';
2
2
 
3
- declare type ChaiBlock = {
3
+ declare type ChaiBlock<T = Record<string, any>> = {
4
4
  _id: string;
5
- _type: string;
6
5
  _name?: string;
7
6
  _parent?: string | null | undefined;
8
7
  _bindings?: Record<string, string>;
9
- } & Record<string, any>;
8
+ _type: string;
9
+ } & T;
10
10
 
11
11
  declare type ChaiBuilderTailwindTheme<T extends Record<string, unknown> = Record<string, unknown>> = {
12
12
  primaryColor: string;
@@ -28,13 +28,14 @@ export declare const convertToBlocks: (chaiFormatContent: string) => ChaiBlock[]
28
28
 
29
29
  export declare const getStylesForBlocks: (blocks: ChaiBlock[], theme?: ChaiBuilderTailwindTheme | Record<string, string>, includeBaseStyles?: boolean) => Promise<string>;
30
30
 
31
- export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, blockModifierCallback, lang, }: {
31
+ export declare function RenderChaiBlocks({ blocks, parent, classPrefix, externalData, blockModifierCallback, lang, metadata, }: {
32
32
  blocks: ChaiBlock[];
33
33
  parent?: string;
34
34
  classPrefix?: string;
35
35
  externalData?: Record<string, any>;
36
36
  blockModifierCallback?: (block: ChaiBlock) => ChaiBlock;
37
37
  lang?: string;
38
+ metadata?: Record<string, any>;
38
39
  }): JSX_2.Element;
39
40
 
40
41
  export { }
package/dist/render.js CHANGED
@@ -1,156 +1,137 @@
1
- import { last as T, flattenDeep as $, memoize as N, filter as _, isEmpty as d, omit as R, isString as j, get as l, each as J, cloneDeep as P, forEach as I, keys as x, has as K, includes as C, replace as L } from "lodash-es";
2
- import { S as f, a as B } from "./STRINGS-Xxstm-7I.js";
3
- import { j as u } from "./jsx-runtime-Sp0orL4X.js";
4
- import w from "react";
5
- import { twMerge as W } from "tailwind-merge";
6
- import { getBlockComponent as Y } from "@chaibuilder/runtime";
7
- import { createTailwindcss as v } from "@mhsdesign/jit-browser-tailwindcss";
8
- import F from "@tailwindcss/forms";
9
- import U from "@tailwindcss/typography";
10
- import z from "@tailwindcss/aspect-ratio";
11
- import { g as M, c as q } from "./plugin-PFjzFeON.js";
1
+ import { last as A, flattenDeep as P, memoize as T, filter as h, isEmpty as m, omit as $, get as l, each as N, isString as _, cloneDeep as O, forEach as R, keys as C, includes as w, replace as J } from "lodash-es";
2
+ import { S as u } from "./STRINGS-BnWT5XcX.js";
3
+ import { j as d } from "./jsx-runtime-Sp0orL4X.js";
4
+ import S from "react";
5
+ import { twMerge as I } from "tailwind-merge";
6
+ import { getRegisteredChaiBlock as v } from "@chaibuilder/runtime";
7
+ import { createTailwindcss as F } from "@mhsdesign/jit-browser-tailwindcss";
8
+ import K from "@tailwindcss/forms";
9
+ import L from "@tailwindcss/typography";
10
+ import U from "@tailwindcss/aspect-ratio";
11
+ import { g as W, c as Y } from "./plugin-PFjzFeON.js";
12
12
  import "./plugin-ooqqxWRQ.js";
13
- const D = (t, r = "") => {
14
- const s = t.replace(f, "").split(",").map((n) => n.split(" ").map((a) => {
13
+ const z = (t, r = "") => {
14
+ const e = t.replace(u, "").split(",").map((n) => n.split(" ").map((a) => {
15
15
  if (a === "")
16
16
  return "";
17
17
  if (a.includes(":")) {
18
18
  const c = a.split(":");
19
- return c[c.length - 1] = r + T(c), c.join(":");
19
+ return c[c.length - 1] = r + A(c), c.join(":");
20
20
  }
21
21
  return `${r}${a}`;
22
22
  }).join(" "));
23
- return $(s).join(" ");
24
- }, dt = (t) => {
23
+ return P(e).join(" ");
24
+ }, pt = (t) => {
25
25
  if (!t)
26
26
  return [];
27
27
  try {
28
- return JSON.parse(G(t)).filter((e) => !e._type.startsWith("@chai"));
28
+ return JSON.parse(D(t)).filter((s) => !s._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 G(t) {
33
+ function D(t) {
34
34
  const r = /(asset:\/\/|https:\/\/asset\.localhost\/)(?:localhost\/)?[^"']+/g;
35
- return t.replace(r, (e) => {
36
- const s = decodeURIComponent(e), n = s.indexOf("public");
37
- return n !== -1 ? s.substring(n + 6) : s;
35
+ return t.replace(r, (s) => {
36
+ const e = decodeURIComponent(s), n = e.indexOf("public");
37
+ return n !== -1 ? e.substring(n + 6) : e;
38
38
  });
39
39
  }
40
- const H = (t) => {
41
- const r = {};
42
- return Object.keys(t).forEach((e) => {
43
- j(t[e]) && t[e].startsWith(B) && (r[e] = t[e].replace(B, "").split(","));
44
- }), r;
45
- }, Q = N((t, r) => {
46
- const e = t.replace(f, "").split(","), s = W(e[0], e[1]);
47
- return r === "" ? s.replace(f, "").trim() : D(s, r).replace(f, "").trim();
40
+ const M = T((t, r) => {
41
+ const s = t.replace(u, "").split(","), e = I(s[0], s[1]);
42
+ return r === "" ? e.replace(u, "").trim() : z(e, r).replace(u, "").trim();
48
43
  });
49
- function V(t, r) {
50
- const e = l(t, `${r}_attrs`, {});
51
- K(e, "data-ai-key") && delete e["data-ai-key"];
52
- const s = x(e).join(" ");
53
- return C(s, "x-show") && !C(s, "x-transition") && (e["x-transition"] = ""), e;
44
+ function q(t, r) {
45
+ const s = l(t, `${r}_attrs`, {}), e = C(s).join(" ");
46
+ return w(e, "x-show") && !w(e, "x-transition") && (s["x-transition"] = ""), s;
54
47
  }
55
- function X(t, r) {
56
- const e = {};
57
- return Object.keys(t).forEach((s) => {
58
- if (j(t[s]) && t[s].startsWith(f)) {
59
- const n = Q(t[s], r);
60
- e[s] = {
48
+ function G(t, r) {
49
+ const s = {};
50
+ return Object.keys(t).forEach((e) => {
51
+ if (_(t[e]) && t[e].startsWith(u)) {
52
+ const n = M(t[e], r);
53
+ s[e] = {
61
54
  className: n,
62
- ...V(t, s)
55
+ ...q(t, e)
63
56
  };
64
57
  }
65
- }), e;
58
+ }), s;
66
59
  }
67
- function Z(t, r) {
68
- const e = l(t, "_bindings", {});
69
- return d(e) ? { ...t } : (J(e, (s, n) => {
70
- j(s) && l(r, s, null) && (t[n] = l(r, s, null));
60
+ function H(t, r) {
61
+ const s = l(t, "_bindings", {});
62
+ return m(s) ? { ...t } : (N(s, (e, n) => {
63
+ _(e) && l(r, e, null) && (t[n] = l(r, e, null));
71
64
  }), t);
72
65
  }
73
- function b(t, r, e) {
74
- if (d(r))
66
+ function Q(t, r, s) {
67
+ if (m(r))
75
68
  return t;
76
- const s = P(t);
77
- return I(x(s), (n) => {
78
- l(e, ["props", n, "i18n"]) && !d(r) && (s[n] = l(s, `${n}-${r}`, s[n]));
79
- }), s;
69
+ const e = O(t), n = l(s, "i18nProps", []);
70
+ return R(C(e), (o) => {
71
+ n.includes(o) && !m(r) && (e[o] = l(e, `${o}-${r}`, e[o]));
72
+ }), e;
80
73
  }
81
- function E({
74
+ function V({
82
75
  blocks: t,
83
76
  parent: r,
84
- classPrefix: e = "",
85
- externalData: s = {},
77
+ classPrefix: s = "",
78
+ externalData: e = {},
86
79
  blockModifierCallback: n,
87
- lang: p
80
+ lang: o,
81
+ metadata: g = {}
88
82
  }) {
89
- const m = t, a = (i) => X(i, e), c = r ? _(t, { _parent: r }) : _(t, (i) => d(i._parent));
90
- return /* @__PURE__ */ u.jsx(u.Fragment, { children: w.Children.toArray(
91
- c.map((i, O) => {
92
- const h = H(i), y = {};
93
- d(h) || Object.keys(h).forEach((o) => {
94
- y[o] = w.Children.toArray(
95
- h[o].map((S) => /* @__PURE__ */ u.jsx(
96
- E,
97
- {
98
- externalData: s,
99
- classPrefix: e,
100
- blocks: m,
101
- parent: S,
102
- lang: p
103
- }
104
- ))
105
- );
106
- });
107
- const A = _(m, { _parent: i._id });
108
- y.children = A.length > 0 ? /* @__PURE__ */ u.jsx(
109
- E,
83
+ const a = t, c = (i) => G(i, s), x = r ? h(t, { _parent: r }) : h(t, (i) => m(i._parent));
84
+ return /* @__PURE__ */ d.jsx(d.Fragment, { children: S.Children.toArray(
85
+ x.map((i, B) => {
86
+ const y = {}, j = h(a, { _parent: i._id });
87
+ y.children = j.length > 0 ? /* @__PURE__ */ d.jsx(
88
+ V,
110
89
  {
111
- externalData: s,
112
- classPrefix: e,
90
+ externalData: e,
91
+ classPrefix: s,
113
92
  parent: i._id,
114
- blocks: m,
115
- lang: p
93
+ blocks: a,
94
+ lang: o,
95
+ metadata: g
116
96
  }
117
97
  ) : null;
118
- const g = Y(i._type);
119
- if (g !== null) {
120
- let o = i;
121
- const S = g.component;
122
- return o = { ...g.defaults, ...i }, n && (o = n(o)), w.createElement(
123
- S,
124
- R(
98
+ const f = v(i._type);
99
+ if (f !== null) {
100
+ let p = i;
101
+ const E = f.component;
102
+ return p = { ...f.defaults, ...i }, n && (p = n(p)), S.createElement(
103
+ E,
104
+ $(
125
105
  {
126
106
  blockProps: {},
127
107
  inBuilder: !1,
128
- ...o,
129
- index: O,
130
- ...Z(b(i, p, g), s),
131
- ...a(o),
132
- ...y
108
+ ...p,
109
+ index: B,
110
+ ...H(Q(i, o, f), e),
111
+ ...c(p),
112
+ ...y,
113
+ metadata: g
133
114
  },
134
115
  ["_parent"]
135
116
  )
136
117
  );
137
118
  }
138
- return /* @__PURE__ */ u.jsxs("noscript", { children: [
119
+ return /* @__PURE__ */ d.jsxs("noscript", { children: [
139
120
  i._type,
140
121
  " not found"
141
122
  ] });
142
123
  })
143
124
  ) });
144
125
  }
145
- async function k(t, r, e = [], s = "", n = !1) {
146
- return await v({
126
+ async function X(t, r, s = [], e = "", n = !1) {
127
+ return await F({
147
128
  tailwindConfig: {
148
129
  darkMode: "class",
149
- safelist: e,
150
- theme: { extend: M(t) },
151
- plugins: [F, U, z, q],
130
+ safelist: s,
131
+ theme: { extend: W(t) },
132
+ plugins: [K, L, U, Y],
152
133
  corePlugins: { preflight: n },
153
- ...s ? { prefix: `${s}` } : {}
134
+ ...e ? { prefix: `${e}` } : {}
154
135
  }
155
136
  }).generateStylesFromContent(
156
137
  ` ${n ? "@tailwind base;" : ""}
@@ -159,9 +140,9 @@ async function k(t, r, e = [], s = "", n = !1) {
159
140
  r
160
141
  );
161
142
  }
162
- const tt = (t, r, e = !1) => k(r, [L(JSON.stringify(t), /#styles:,?/g, "")], [], "", e), mt = async (t, r = {}, e = !0) => await tt(t, r, e);
143
+ const Z = (t, r, s = !1) => X(r, [J(JSON.stringify(t), /#styles:,?/g, "")], [], "", s), ut = async (t, r = {}, s = !0) => await Z(t, r, s);
163
144
  export {
164
- E as RenderChaiBlocks,
165
- dt as convertToBlocks,
166
- mt as getStylesForBlocks
145
+ V as RenderChaiBlocks,
146
+ pt as convertToBlocks,
147
+ ut as getStylesForBlocks
167
148
  };
package/dist/runtime.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@chaibuilder/runtime"),e=require("./controls-p9IwFnPx.cjs");require("lodash-es");exports.Checkbox=e.c;exports.Code=e.l;exports.Color=e.h;exports.Icon=e.q;exports.Image=e.x;exports.InfoField=e.u;exports.Link=e.w;exports.List=e.S;exports.Model=e.b;exports.MultilineText=e.f;exports.Numeric=e.s;exports.RichText=e.m;exports.SelectOption=e.y;exports.SingleLineText=e.g;exports.Slot=e.r;exports.Styles=e.T;Object.keys(r).forEach(t=>{t!=="default"&&!Object.prototype.hasOwnProperty.call(exports,t)&&Object.defineProperty(exports,t,{enumerable:!0,get:()=>r[t]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("@chaibuilder/runtime");Object.keys(t).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>t[e]})});
package/dist/runtime.d.ts CHANGED
@@ -1,5 +1,4 @@
1
1
 
2
2
  export * from "@chaibuilder/runtime";
3
- export * from "@chaibuilder/runtime/controls";
4
3
 
5
4
  export { }
package/dist/runtime.js CHANGED
@@ -1,21 +1 @@
1
1
  export * from "@chaibuilder/runtime";
2
- import { c as t, l as i, h as l, q as r, x as n, u as x, w as c, S as m, b as S, f, s as p, m as T, y as d, g, r as h, T as u } from "./controls-lEwMTdPQ.js";
3
- import "lodash-es";
4
- export {
5
- t as Checkbox,
6
- i as Code,
7
- l as Color,
8
- r as Icon,
9
- n as Image,
10
- x as InfoField,
11
- c as Link,
12
- m as List,
13
- S as Model,
14
- f as MultilineText,
15
- p as Numeric,
16
- T as RichText,
17
- d as SelectOption,
18
- g as SingleLineText,
19
- h as Slot,
20
- u as Styles
21
- };
@@ -1,3 +1,3 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const p=require("@chaibuilder/runtime"),i=require("./jsx-runtime-JYMCiFoE.cjs"),E=require("react"),t=require("./controls-p9IwFnPx.cjs"),y=require("./iconBase-aZzpqff_.cjs"),g=require("@radix-ui/react-icons"),h=require("lodash-es"),C=require("lucide-react");require("clsx");require("tailwind-merge");function I(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const l in e)if(l!=="default"){const s=Object.getOwnPropertyDescriptor(e,l);Object.defineProperty(o,l,s.get?s:{enumerable:!0,get:()=>e[l]})}}return o.default=e,Object.freeze(o)}const m=I(E),R=({className:e="",inBuilder:o})=>o?i.jsxRuntimeExports.jsx("div",{className:y.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,w=R,L=e=>{const{blockProps:o,inBuilder:l,backgroundImage:s,children:r,tag:n="div",styles:a}=e;let c=r;r||(c=i.jsxRuntimeExports.jsx(w,{inBuilder:l}));let u={};return s&&(u={backgroundImage:`url(${s})`}),m.createElement(n,{...o,...a,style:u},c)},S={type:"Box",label:"web_blocks.box",category:"core",group:"basic",props:{styles:t.T({default:""}),tag:t.y({title:"web_blocks.tag",default:"div",options:[{value:"div",title:"web_blocks.div"},{value:"header",title:"web_blocks.header"},{value:"footer",title:"web_blocks.footer"},{value:"section",title:"web_blocks.section"},{value:"article",title:"web_blocks.article"},{value:"aside",title:"web_blocks.aside"},{value:"main",title:"web_blocks.main"},{value:"nav",title:"web_blocks.nav"},{value:"figure",title:"web_blocks.figure"},{value:"details",title:"web_blocks.details"},{value:"summary",title:"web_blocks.summary"},{value:"dialog",title:"web_blocks.dialog"},{value:"strike",title:"web_blocks.strike"},{value:"caption",title:"web_blocks.caption"},{value:"legend",title:"web_blocks.legend"},{value:"figcaption",title:"web_blocks.figcaption"},{value:"mark",title:"web_blocks.mark"}]}),backgroundImage:t.x({title:"web_blocks.background_image"})},canAcceptBlock:()=>!0},T=e=>{const{blockProps:o,iconSize:l,icon:s,content:r,iconPos:n,styles:a,children:c}=e,u=s,d=c||i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:r}),u&&i.jsxRuntimeExports.jsx("div",{style:{width:l+"px"},className:n+" "+(n==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:u}})]});return m.createElement("button",{...o,...a,type:"button"},d)},M={type:"Button",label:"web_blocks.button",category:"core",icon:g.ButtonIcon,group:"basic",props:{content:t.g({title:"web_blocks.label",default:"Button",ai:!0,i18n:!0}),styles:t.T({default:"text-white bg-primary px-4 py-2 rounded-global flex items-center"}),icon:t.q({title:"web_blocks.icon",default:""}),iconSize:t.s({title:"web_blocks.icon_size",default:24}),iconPos:t.y({title:"web_blocks.icon_position",default:"order-last",options:[{title:"web_blocks.start",value:"order-first"},{title:"web_blocks.end",value:"order-last"}]})}},P=e=>{const{blockProps:o,styles:l,htmlCode:s,inBuilder:r}=e;return r?i.jsxRuntimeExports.jsxs("div",{className:"relative",children:[r?i.jsxRuntimeExports.jsx("div",{...o,...l,className:"absolute z-20 h-full w-full"}):null,m.createElement("div",{...l,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):m.createElement("div",{...o,...l,dangerouslySetInnerHTML:{__html:s}})},N={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:g.CodeIcon,group:"advanced",props:{styles:t.T({default:""}),htmlCode:t.l({title:"web_blocks.html_code",default:"<div><p>Enter your HTML code here...</p></div>",placeholder:"web_blocks.placeholder"})}},$=m.memo(e=>{const{blockProps:o,styles:l,backgroundImage:s}=e;let r={};return s&&(r={backgroundImage:`url(${s})`}),m.createElement("div",{...o,...l,style:r})}),q={type:"EmptyBox",label:"web_blocks.empty_box",category:"core",group:"basic",props:{styles:t.T({default:""}),backgroundImage:t.x({title:"Background Image"})}},H=e=>{const{blockProps:o,styles:l,content:s,level:r="h1",children:n=null}=e;return n?m.createElement(r,{...l,...o},n):m.createElement(r,{...l,...o,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}})},z={type:"Heading",label:"web_blocks.heading",category:"core",icon:g.HeadingIcon,group:"typography",props:{level:t.y({title:"web_blocks.level",default:"h2",binding:!1,options:[{value:"h1",title:"h1"},{value:"h2",title:"h2"},{value:"h3",title:"h3"},{value:"h4",title:"h4"},{value:"h5",title:"h5"},{value:"h6",title:"h6"}]}),styles:t.T({default:"text-3xl"}),content:t.f({title:"Content",default:"Heading goes here",ai:!0,i18n:!0})},canAcceptBlock:e=>e==="Span"||e==="Text"},D=e=>{const{blockProps:o,styles:l,content:s}=e;return h.isNull(e.children)?m.createElement("p",{...l,...o,"data-ai-key":"content","data-ai-type":"html",dangerouslySetInnerHTML:{__html:s}}):m.createElement("p",{...l,...o},e.children)},A={type:"Paragraph",label:"Paragraph",category:"core",icon:g.TextIcon,group:"typography",props:{styles:t.T({default:""}),content:t.f({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("./jsx-runtime-JYMCiFoE.cjs"),v=require("react"),f=require("./iconBase-aZzpqff_.cjs"),g=require("@radix-ui/react-icons"),y=require("lodash-es"),C=require("lucide-react");require("clsx");require("tailwind-merge");function E(e){const r=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(r,t,s.get?s:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const d=E(v),P=({className:e="",inBuilder:r})=>r?i.jsxRuntimeExports.jsx("div",{className:f.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsxRuntimeExports.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,k=P,I=e=>{const{blockProps:r,inBuilder:t,backgroundImage:s,children:l,tag:n="div",styles:a}=e;let c=l;l||(c=i.jsxRuntimeExports.jsx(k,{inBuilder:t}));let p={};return s&&(p={backgroundImage:`url(${s})`}),d.createElement(n,{...r,...a,style:p},c)},L={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},_=e=>{const{blockProps:r,iconSize:t,icon:s,content:l,styles:n,children:a,iconPos:c}=e,p=s,u=a||i.jsxRuntimeExports.jsxs(i.jsxRuntimeExports.Fragment,{children:[i.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",children:l}),p&&i.jsxRuntimeExports.jsx("div",{style:{width:t+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:p}})]});return d.createElement("button",{...r,...n,type:"button"},u)},R={type:"Button",label:"Button",category:"core",icon:g.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:24},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["content"],aiProps:["content"]},M=e=>{const{blockProps:r,styles:t,htmlCode:s,inBuilder:l}=e;return l?i.jsxRuntimeExports.jsxs("div",{className:"relative",children:[l?i.jsxRuntimeExports.jsx("div",{...r,...t,className:"absolute z-20 h-full w-full"}):null,d.createElement("div",{...t,dangerouslySetInnerHTML:{__html:s.replace(/<script.*?>.*?<\/script>/g,"")}})]}):d.createElement("div",{...r,...t,dangerouslySetInnerHTML:{__html:s}})},T={type:"CustomHTML",label:"web_blocks.custom_html",category:"core",icon:g.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:r,styles:t,backgroundImage:s}=e;let l={};return s&&(l={backgroundImage:`url(${s})`}),d.createElement("div",{...r,...t,style:l})},N={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"}}}})},H=e=>{const{blockProps:r,styles:t,content:s,level:l="h1",children:n=null}=e;return n?d.createElement(l,{...t,...r},n):d.createElement(l,{...t,...r,dangerouslySetInnerHTML:{__html:s}})},z={type:"Heading",label:"web_blocks.heading",category:"core",icon:g.HeadingIcon,group:"typography",...o.registerChaiBlockSchema({properties:{level:{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"},D=e=>{const{blockProps:r,styles:t,content:s}=e;return y.isNull(e.children)?d.createElement("p",{...t,...r,dangerouslySetInnerHTML:{__html:s}}):d.createElement("p",{...t,...r},e.children)},q={type:"Paragraph",label:"Paragraph",category:"core",icon:g.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.`,ai:!0,i18n:!0})},canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},U=e=>{const{blockProps:o,styles:l,content:s,children:r=null,tag:n}=e;return r?m.createElement("span",{...l,...o},r):m.createElement(n||"span",{...l,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:s||""}})},F={type:"Span",label:"Span",category:"core",group:"typography",props:{styles:t.T({default:""}),content:t.f({title:"Content",default:"",ai:!0,i18n:!0})},canAcceptBlock:()=>!0},O=e=>{const{blockProps:o,content:l,styles:s}=e;return i.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i.jsxRuntimeExports.jsx("div",{"data-ai-key":"content","data-ai-type":"richtext",...o,...s,dangerouslySetInnerHTML:{__html:l}})})},V={type:"RichText",label:"Rich Text",category:"core",icon:g.CursorTextIcon,group:"typography",props:{styles:t.T({default:""}),content:t.m({title:"Content",ai:!0,i18n:!0,default:"<p>This is a rich text block. You can add text, and other content here.</p>"})}},G=e=>{const{blockProps:o,link:l,children:s,styles:r,inBuilder:n,content:a}=e;let c={};return!s&&h.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?s?i.jsxRuntimeExports.jsx("span",{...o,style:c,...r,children:s}):m.createElement("span",{...o,...r,style:c,"data-ai-key":"content"},a):s?i.jsxRuntimeExports.jsx("a",{href:(l==null?void 0:l.href)||"#/",target:l==null?void 0:l.target,...o,...r,children:s}):m.createElement("a",{...o,...r,"data-ai-key":"content",href:(l==null?void 0:l.href)||"#",target:(l==null?void 0:l.target)||"_self"},a)},W={type:"Link",label:"Link",category:"core",icon:g.Link1Icon,group:"basic",props:{styles:t.T({default:""}),content:t.g({title:"Content",default:"",ai:!0,i18n:!0}),link:t.w({title:"Link",default:{type:"collection",target:"_self",href:""}})},canAcceptBlock:e=>e!=="Link"},B=(e,...o)=>({...e,className:y.cn(e.className,...o)}),X=e=>{const{blockProps:o,children:l,styles:s,inBuilder:r,content:n,href:a}=e,{hrefType:c,autoplay:u,maxWidth:d,backdropColor:f,galleryName:b}=e,x=B(s,"cb-lightbox");if(!l&&h.isEmpty(s==null?void 0:s.className)&&h.isEmpty(n))return i.jsxRuntimeExports.jsx(w,{inBuilder:r});if(r)return l?i.jsxRuntimeExports.jsx("span",{...o,...x,children:l}):m.createElement("span",{...o,...x,dangerouslySetInnerHTML:{__html:n}});const k={};return k["data-vbtype"]=c,u&&(k["data-autoplay"]="true"),d&&(k["data-maxwidth"]=d+"px"),f&&(k["data-overlay"]=f),b&&(k["data-gall"]=b),l?i.jsxRuntimeExports.jsx("a",{...k,href:a||"#/",...o,...x,children:l}):m.createElement("a",{...o,...x,...k,href:a||"#",dangerouslySetInnerHTML:{__html:n}})},Y={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:g.ImageIcon,group:"basic",props:{styles:t.T({default:""}),content:t.g({title:"Content",default:"Link text or drop blocks inside",ai:!0,i18n:!0}),href:t.g({title:"Href",default:""}),hrefType:t.y({title:"Type",default:"video",options:[{value:"video",title:"Video"},{value:"iframe",title:"Iframe"},{value:"inline",title:"Inline"},{value:"ajax",title:"Ajax"}]}),autoplay:t.c({title:"Autoplay",default:!1}),maxWidth:t.s({title:"Max Width",default:""}),backdropColor:t.g({title:"Backdrop Color",default:""}),galleryName:t.g({title:"Gallery Name",default:""})},canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},Z=e=>{const{blockProps:o,children:l,listType:s,styles:r,tag:n,inBuilder:a}=e,c=y.cn(h.get(r,"className",""),s);return!l&&h.isEmpty(r==null?void 0:r.className)?i.jsxRuntimeExports.jsx(w,{inBuilder:a}):m.createElement(n||(s==="list-decimal"?"ol":"ul"),{...o,...r,className:c},l)},J={type:"List",label:"web_blocks.list",icon:g.RowsIcon,category:"core",group:"basic",props:{styles:t.T({default:""}),listType:t.y({title:"web_blocks.list_type",default:"list-none",options:[{value:"list-none",title:"web_blocks.none"},{value:"list-disc",title:"web_blocks.disc"},{value:"list-decimal",title:"web_blocks.number"}]})},canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",listType:"list-none",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},K=e=>{const{blockProps:o,content:l,styles:s,children:r,tag:n}=e;return r?m.createElement(n||"li",{...s,...o},r):m.createElement(n||"li",{...s,...o,"data-ai-key":"content",dangerouslySetInnerHTML:{__html:l}})},Q={type:"ListItem",label:"List Item",icon:g.ColumnsIcon,category:"core",group:"basic",props:{styles:t.T({default:""}),content:t.f({title:"Content",default:"List item",ai:!0,i18n:!0})},canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"},ee=e=>{const{blockProps:o,icon:l,styles:s,width:r,inBuilder:n,height:a}=e,c=B(s,y.cn(r?`w-[${r}px]`:"",a?`h-[${a}px]`:""));if(h.isEmpty(l))return i.jsxRuntimeExports.jsx(w,{inBuilder:n,className:"h-8 w-14"});const u=l.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return m.createElement("span",{...o,...c,dangerouslySetInnerHTML:{__html:u}})},te={type:"Icon",label:"web_blocks.icon",category:"core",icon:g.SketchLogoIcon,group:"media",props:{styles:t.T({default:"text-black"}),icon:t.q({title:"web_blocks.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>'}),width:t.s({title:"web_blocks.width",default:""}),height:t.s({title:"web_blocks.height",default:""})}},le=e=>{const{blockProps:o,image:l,styles:s,alt:r,height:n,width:a,lazyLoading:c}=e;return h.isEmpty(l)?i.jsxRuntimeExports.jsx(w,{className:"h-36"}):m.createElement("img",{...o,...s,src:l,alt:r,loading:c?"lazy":"eager",height:n,width:a})},oe={type:"Image",label:"Image",category:"core",icon:g.ImageIcon,group:"media",props:{styles:t.T({default:""}),image:t.x({title:"Image",default:"https://fakeimg.pl/400x200?text=Choose&font=bebas"}),alt:t.g({title:"Alt text",default:"",ai:!0,i18n:!0}),width:t.g({title:"Width",default:""}),height:t.g({title:"Height",default:""}),lazyLoading:t.c({title:"Lazy Load",default:!0})}},v=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,_=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,j=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,se=e=>{if(v.test(e)){const o=e.match(v);return o?`https://www.youtube.com/embed/${o[4]}`:e}if(_.test(e)){const o=e.match(_);return o?`https://player.vimeo.com/video/${o[3]}`:e}if(j.test(e)){const o=e.match(j);return o?`https://www.dailymotion.com/embed/video/${o[4]}`:e}return null},re=m.memo(e=>{const{blockProps:o,inBuilder:l,styles:s,url:r,controls:n}=e,a=h.get(n,"autoPlay",!1),c=h.get(n,"controls",!1),u=a||h.get(n,"muted",!0),d=h.get(n,"loop",!1);if(h.isEmpty(r))return i.jsxRuntimeExports.jsx(w,{inBuilder:l,className:"h-36"});let f=se(r),b=null;if(f){if(!h.isEmpty(f)){const x=[];x.push(`autoplay=${a?1:0}`),x.push(`controls=${n?1:0}`),x.push(`mute=${u?1:0}&muted=${u?1:0}`),x.push(`loop=${d?1:0}`),f=`${f}?${x.join("&")}`}b=m.createElement("iframe",{...o,className:"absolute inset-0 w-full h-full",src:f,allow:l?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else b=m.createElement("video",{...o,className:"absolute inset-0 w-full h-full",src:r,controls:c,muted:u,autoPlay:l?!1:a,loop:d});return i.jsxRuntimeExports.jsx("div",{...h.pick(s,["className"]),children:i.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[l?i.jsxRuntimeExports.jsx("div",{...o,...h.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,b]})})}),ie={type:"Video",label:"Video",category:"core",icon:g.VideoIcon,group:"media",props:{styles:t.T({default:""}),url:t.g({title:"Video URL",default:"https://www.youtube.com/watch?v=9xwazD5SyVg&ab_channel=MaximilianMustermann",i18n:!0}),controls:t.b({title:"Controls",properties:{autoPlay:t.c({title:"Autoplay",default:!0}),controls:t.c({title:"Controls",default:!1}),loop:t.c({title:"Loop",default:!1}),muted:t.c({title:"Muted",default:!0})}})}};function ne(e){return y.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 ae=e=>{const{scripts:o,inBuilder:l,blockProps:s}=e;return l?i.jsxRuntimeExports.jsx("div",{...s,children:i.jsxRuntimeExports.jsx("div",{className:y.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsxRuntimeExports.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},ce={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:ne,group:"advanced",props:{scripts:t.l({title:"Script",default:"",placeholder:"<script>console.log('Hello, world!');<\/script>"})}},ue=e=>{const{blockProps:o,styles:l}=e;return m.createElement("hr",{...l,...o})},de={type:"Divider",label:"web_blocks.divider",category:"core",icon:g.DividerHorizontalIcon,group:"basic",props:{styles:t.T({default:"bg-gray-900 h-0.5 py-2 my-1"})}},pe=()=>null,me={type:"Dark Mode",label:"web_blocks.dark_mode",category:"core",icon:g.MoonIcon,group:"advanced",props:{},blocks:()=>[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",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:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_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:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},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:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_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>"}]},ge=e=>{const{blockProps:o,inBuilder:l,children:s,globalBlock:r}=e;return l&&!r?i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxRuntimeExports.jsxs("h1",{children:["Global Block - ",r]}),i.jsxRuntimeExports.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):m.createElement("div",{...o},s)},be={type:"GlobalBlock",label:"Global Block",icon:C.GlobeIcon,category:"core",group:"advanced",props:{globalBlock:t.g({title:"global block",default:"",hidden:!0})}},he=e=>e.inBuilder||e.forceWrapper?i.jsxRuntimeExports.jsx("span",{"data-ai-key":"content",...e.blockProps,children:e.content}):`${e.content}`,fe={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:g.SpaceBetweenVerticallyIcon,props:{content:t.f({title:"Content",default:"",ai:!0,i18n:!0})}},ye=e=>{const{blockProps:o,backgroundImage:l,children:s,styles:r}=e;let n={};return l&&(n={backgroundImage:`url(${l})`}),m.createElement("div",{...o,...r,style:n},s)},xe={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,props:{styles:t.T({default:"font-body antialiased"}),backgroundImage:t.x({title:"Background Image"})},canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},ke=e=>{const{blockProps:o,styles:l}=e;return m.createElement("br",{...o,...l})},we={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,icon:g.SpaceBetweenVerticallyIcon,props:{styles:t.T({default:""})}},ve=e=>{const{blockProps:o,errorMessage:l,name:s,_type:r,successMessage:n,action:a,styles:c,children:u}=e;let d=u;u||(d=i.jsxRuntimeExports.jsx(w,{}));const f={"x-data":"{}","x-on:submit.prevent":"post"},b={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxRuntimeExports.jsxs("form",{...f,"data-error":l,"data-success":n,method:"post",action:a,...o,...c,children:[i.jsxRuntimeExports.jsx("div",{...b}),i.jsxRuntimeExports.jsx("input",{name:"formname",type:"hidden",value:s||r}),d]})},_e={type:"Form",label:"Form",category:"core",icon:g.GroupIcon,group:"form",props:{styles:t.T({default:""}),action:t.g({title:"Submit URL",default:"/api/form/submit"}),errorMessage:t.m({title:"Error Message",default:"Something went wrong. Please try again"}),successMessage:t.m({title:"Success Message",default:"Thank you for your submission."})},canAcceptBlock:()=>!0},je=e=>{const{blockProps:o,inBuilder:l,label:s,styles:r,inputStyles:n,icon:a,iconPos:c}=e,u=y.generateUUID(),d={"x-bind:disabled":"formLoading"};return i.jsxRuntimeExports.jsxs("button",{id:u,...d,...n,...r,...o||{},type:l?"button":"submit",children:[s,a&&i.jsxRuntimeExports.jsx("span",{className:c,dangerouslySetInnerHTML:{__html:a}})]})},Be={type:"FormButton",label:"Submit Button",category:"core",icon:g.ButtonIcon,group:"form",props:{label:t.g({title:"Label",default:"Submit",ai:!0,i18n:!0}),styles:t.T({default:"text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"}),icon:t.q({title:"Icon",default:""}),iconPos:t.y({title:"Icon Position",default:"order-last",options:[{title:"Start",value:"order-first"},{title:"End",value:"order-last"}]})}},Ee=e=>{const{blockProps:o,label:l,placeholder:s,styles:r,inputStyles:n,showLabel:a,required:c,inputType:u="text",inBuilder:d,fieldName:f}=e,b=y.generateUUID();return!a||u==="submit"?(u==="submit"&&(o.value=l),i.jsxRuntimeExports.jsx("input",{id:b,name:f,readOnly:d,...o,...n,...r,type:u,placeholder:s,required:c})):i.jsxRuntimeExports.jsxs("div",{...r,...o,children:[a&&i.jsxRuntimeExports.jsx("label",{htmlFor:b,children:l}),i.jsxRuntimeExports.jsx("input",{name:f,readOnly:d,...n,id:b,type:u,placeholder:s,required:c})]})},Ce={type:"Input",label:"Input",category:"core",icon:g.InputIcon,group:"form",props:{styles:t.T({default:""}),fieldName:t.g({title:"Field Name",default:"input"}),inputType:t.y({title:"Type",options:h.map(["text","email","password","number","tel","file","hidden","range","submit","color","date","time"],e=>({value:e,title:e})),default:"text"}),value:t.g({title:"Value",default:"",ai:!0,i18n:!0}),showLabel:t.c({title:"Show Label",default:!0}),inputStyles:t.T({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label",ai:!0,i18n:!0}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),required:t.c({title:"Required",default:!1})}},Ie=e=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:n,checked:a,required:c,showLabel:u=!0}=e,d=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...r,...o,children:[i.jsxRuntimeExports.jsx("input",{...n,name:l,id:d,type:"radio",required:c,defaultChecked:a}),s&&i.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:d,...o,...n,...r,type:"radio",required:c,checked:a,name:l})},Re={type:"Radio",label:"web_blocks.radio",category:"core",icon:g.RadiobuttonIcon,group:"form",props:{styles:t.T({default:"flex items-center w-max gap-x-2"}),fieldName:t.g({title:"web_blocks.field_name",default:"radio"}),label:t.g({title:"web_blocks.label",default:"Label"}),checked:t.c({title:"web_blocks.checked",default:!1}),required:t.c({title:"web_blocks.required",default:!1})}},Le=e=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:n,inputStyles:a,required:c,showLabel:u,_multiple:d=!1}=e,f=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...n,children:[u&&i.jsxRuntimeExports.jsx("label",{htmlFor:f,children:s}),i.jsxRuntimeExports.jsxs("select",{...a,id:f,required:c,multiple:d,name:l,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),h.map(e.options,b=>i.jsxRuntimeExports.jsx("option",{selected:h.get(b,"selected",!1),value:b.value,dangerouslySetInnerHTML:{__html:b.label}},b.value))]})]}):i.jsxRuntimeExports.jsxs("select",{id:f,...n,...o,required:c,multiple:d,name:l,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:r}),h.map(e.options,b=>i.jsxRuntimeExports.jsx("option",{selected:h.get(b,"selected",!1),value:b.value,dangerouslySetInnerHTML:{__html:b.label}},b.value))]})},Se={type:"Select",label:"web_blocks.select",category:"core",icon:g.DropdownMenuIcon,group:"form",props:{styles:t.T({default:""}),fieldName:t.g({title:"Field Name",default:"select"}),showLabel:t.c({title:"Show Label",default:!0}),inputStyles:t.T({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label",ai:!0,i18n:!0}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),required:t.c({title:"Required",default:!1}),_multiple:t.c({title:"Multiple",default:!1}),options:t.S({title:"Options",itemProperties:{label:t.g({title:"Label",default:"",ai:!0,i18n:!0}),value:t.g({title:"Value",default:""})}})}},Te=e=>{const{blockProps:o,fieldName:l,label:s,placeholder:r,styles:n,inputStyles:a,_rows:c,showLabel:u}=e,d=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...n,...o,children:[u&&i.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s}),i.jsxRuntimeExports.jsx("textarea",{name:l,...a,id:d,placeholder:r,rows:c})]}):i.jsxRuntimeExports.jsx("textarea",{id:d,name:l,...o,...a,...n,placeholder:r,rows:c})},Me={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:g.InputIcon,group:"form",props:{fieldName:t.g({title:"Field Name",default:"textarea"}),showLabel:t.c({title:"Show Label",default:!0}),styles:t.T({default:""}),inputStyles:t.T({default:"w-full p-1"}),label:t.g({title:"Label",default:"Label",ai:!0,i18n:!0}),placeholder:t.g({title:"Placeholder",default:"Placeholder"}),_rows:t.s({title:"Rows",default:3})}},Pe=e=>{const{blockProps:o,fieldName:l,label:s,styles:r,inputStyles:n,required:a,checked:c,showLabel:u=!0}=e,d=y.generateUUID();return u?i.jsxRuntimeExports.jsxs("div",{...r,...o,children:[i.jsxRuntimeExports.jsx("input",{...n,name:l,id:d,type:"checkbox",required:a,defaultChecked:c}),s&&s!=="Label"&&i.jsxRuntimeExports.jsx("label",{htmlFor:d,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:d,...o,...n,...r,type:"checkbox",required:a,name:l})},Ne={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:g.CheckboxIcon,group:"form",props:{fieldName:t.g({title:"Field Name",default:"checkbox"}),styles:t.T({default:"flex items-center gap-x-2"}),label:t.g({title:"web_blocks.label",default:"Label"}),checked:t.c({title:"web_blocks.checked",default:!1}),required:t.c({title:"web_blocks.required",default:!1})}},$e=()=>{p.registerChaiBlock(L,S),p.registerChaiBlock($,q),p.registerChaiBlock(T,M),p.registerChaiBlock(H,z),p.registerChaiBlock(D,A),p.registerChaiBlock(U,F),p.registerChaiBlock(O,V),p.registerChaiBlock(G,W),p.registerChaiBlock(X,Y),p.registerChaiBlock(Z,J),p.registerChaiBlock(K,Q),p.registerChaiBlock(ee,te),p.registerChaiBlock(le,oe),p.registerChaiBlock(re,ie),p.registerChaiBlock(P,N),p.registerChaiBlock(he,fe),p.registerChaiBlock(ve,_e),p.registerChaiBlock(je,Be),p.registerChaiBlock(Ee,Ce),p.registerChaiBlock(Pe,Ne),p.registerChaiBlock(Ie,Re),p.registerChaiBlock(Le,Se),p.registerChaiBlock(Te,Me),p.registerChaiBlock(ke,we),p.registerChaiBlock(ye,xe),p.registerChaiBlock(ae,ce),p.registerChaiBlock(ue,de),p.registerChaiBlock(pe,me),p.registerChaiBlock(ge,be)};exports.loadWebBlocks=$e;
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"},A=e=>{const{blockProps:r,styles:t,content:s,children:l=null,tag:n}=e;return l?d.createElement("span",{...t,...r},l):d.createElement(n||"span",{...t,...r,dangerouslySetInnerHTML:{__html:s||""}})},U={type:"Span",label:"Span",category:"core",group:"typography",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit.",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},O=e=>{const{blockProps:r,content:t,styles:s}=e;return i.jsxRuntimeExports.jsx("div",{className:"max-w-full",children:i.jsxRuntimeExports.jsx("div",{...r,...s,dangerouslySetInnerHTML:{__html:t}})})},F={type:"RichText",label:"Rich Text",category:"core",icon:g.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"]},G=e=>{const{blockProps:r,link:t,children:s,styles:l,inBuilder:n,content:a}=e;let c={};return!s&&y.isEmpty(a)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),n?s?i.jsxRuntimeExports.jsx("span",{...r,style:c,...l,children:s}):d.createElement("span",{...r,...l,style:c},a):s?i.jsxRuntimeExports.jsx("a",{href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...r,...l,children:s}):d.createElement("a",{...r,...l,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self"},a)},V={type:"Link",label:"Link",category:"core",icon:g.Link1Icon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",title:"Link",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"},w=(e,...r)=>({...e,className:f.cn(e.className,...r)}),W=e=>{const{blockProps:r,children:t,styles:s,inBuilder:l,content:n,href:a}=e,{hrefType:c,autoplay:p,maxWidth:u,backdropColor:h,galleryName:b}=e,m=w(s,"cb-lightbox");if(!t&&y.isEmpty(s==null?void 0:s.className)&&y.isEmpty(n))return i.jsxRuntimeExports.jsx(k,{inBuilder:l});if(l)return t?i.jsxRuntimeExports.jsx("span",{...r,...m,children:t}):d.createElement("span",{...r,...m,dangerouslySetInnerHTML:{__html:n}});const x={};return x["data-vbtype"]=c,p&&(x["data-autoplay"]="true"),u&&(x["data-maxwidth"]=u+"px"),h&&(x["data-overlay"]=h),b&&(x["data-gall"]=b),t?i.jsxRuntimeExports.jsx("a",{...x,href:a||"#/",...r,...m,children:t}):d.createElement("a",{...r,...m,...x,href:a||"#",dangerouslySetInnerHTML:{__html:n}})},X={type:"LightBoxLink",label:"Lightbox Link",category:"core",icon:g.ImageIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(""),content:{type:"string",title:"Content",default:"Link text or drop blocks inside"},href:{type:"string",title:"Href",default:""},hrefType:{type:"string",title:"Type",default:"video",oneOf:[{type:"string",title:"Video",enum:["video"]},{type:"string",title:"Iframe",enum:["iframe"]},{type:"string",title:"Inline",enum:["inline"]},{type:"string",title:"Ajax",enum:["ajax"]}]},autoplay:{type:"boolean",title:"Autoplay",default:!1,dependencies:{hrefType:["video"]}},maxWidth:{type:"number",title:"Max Width",default:""},backdropColor:{type:"string",title:"Backdrop Color",default:""},galleryName:{type:"string",title:"Gallery Name",default:""}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="Link"&&e!=="LightBoxLink"},Y=e=>{const{blockProps:r,children:t,listType:s,styles:l,tag:n,inBuilder:a}=e,c=f.cn(y.get(l,"className",""),s);return!t&&y.isEmpty(l==null?void 0:l.className)?i.jsxRuntimeExports.jsx(k,{inBuilder:a}):d.createElement(n||(s==="list-decimal"?"ol":"ul"),{...r,...l,className:c},t)},Z={type:"List",label:"web_blocks.list",icon:g.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"}]},J=e=>{const{blockProps:r,content:t,styles:s,children:l,tag:n}=e;return l?d.createElement(n||"li",{...s,...r},l):d.createElement(n||"li",{...s,...r,dangerouslySetInnerHTML:{__html:t}})},K={type:"ListItem",label:"List Item",icon:g.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"},Q=e=>{const{blockProps:r,icon:t,styles:s,width:l,inBuilder:n,height:a}=e,c=w(s,f.cn(l?`w-[${l}px]`:"",a?`h-[${a}px]`:""));if(y.isEmpty(t))return i.jsxRuntimeExports.jsx(k,{inBuilder:n,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return d.createElement("span",{...r,...c,dangerouslySetInnerHTML:{__html:p}})},ee={type:"Icon",label:"web_blocks.icon",category:"core",icon:g.SketchLogoIcon,group:"media",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-black"),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"}}})},te=e=>{const{blockProps:r,image:t,styles:s,alt:l,height:n,width:a,lazyLoading:c}=e;return y.isEmpty(t)?i.jsxRuntimeExports.jsx(k,{className:"h-36"}):d.createElement("img",{...r,...s,src:t,alt:l,loading:c?"lazy":"eager",height:n,width:a})},oe={type:"Image",label:"Image",category:"core",icon:g.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 Here"}},height:{type:"number",title:"Height",default:"",ui:{"ui:placeholder":"Enter Here"}},width:{type:"number",title:"Width",default:"",ui:{"ui:placeholder":"Enter Here"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt"]},B=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,j=/^(https?:\/\/)?(www\.)?player.vimeo\.com/,S=/^(https?:\/\/)?(www\.)?dailymotion\.com\/(video|embed\/video)\/([a-zA-Z0-9_-]+)/,re=e=>{if(B.test(e)){const r=e.match(B);return r?`https://www.youtube.com/embed/${r[4]}`:e}if(j.test(e)){const r=e.match(j);return r?`https://player.vimeo.com/video/${r[3]}`:e}if(S.test(e)){const r=e.match(S);return r?`https://www.dailymotion.com/embed/video/${r[4]}`:e}return null},se=d.memo(e=>{const{blockProps:r,inBuilder:t,styles:s,url:l,controls:n}=e,a=y.get(n,"autoPlay",!1),c=y.get(n,"controls",!1),p=a||y.get(n,"muted",!0),u=y.get(n,"loop",!1);if(y.isEmpty(l))return i.jsxRuntimeExports.jsx(k,{inBuilder:t,className:"h-36"});let h=re(l),b=null;if(h){if(!y.isEmpty(h)){const m=[];m.push(`autoplay=${a?1:0}`),m.push(`controls=${n?1:0}`),m.push(`mute=${p?1:0}&muted=${p?1:0}`),m.push(`loop=${u?1:0}`),h=`${h}?${m.join("&")}`}b=d.createElement("iframe",{...r,className:"absolute inset-0 w-full h-full",src:h,allow:t?"":"autoplay *; fullscreen *",allowFullScreen:!0,frameBorder:0})}else b=d.createElement("video",{...r,className:"absolute inset-0 w-full h-full",src:l,controls:c,muted:p,autoPlay:t?!1:a,loop:u});return i.jsxRuntimeExports.jsx("div",{...y.pick(s,["className"]),children:i.jsxRuntimeExports.jsxs("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[t?i.jsxRuntimeExports.jsx("div",{...r,...y.omit(s,["className"]),className:"absolute inset-0 z-20 h-full w-full"}):null,b]})})}),le={type:"Video",label:"Video",category:"core",icon:g.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"]},ie=e=>{const{blockProps:r,styles:t}=e;return d.createElement("hr",{...t,...r})},ne={type:"Divider",label:"web_blocks.divider",category:"core",icon:g.DividerHorizontalIcon,group:"basic",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})};function ae(e){return f.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 ce=e=>{const{scripts:r,inBuilder:t,blockProps:s}=e;return t?i.jsxRuntimeExports.jsx("div",{...s,children:i.jsxRuntimeExports.jsx("div",{className:f.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsxRuntimeExports.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsxRuntimeExports.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:r}})},pe={type:"CustomScript",label:"web_blocks.custom_script",category:"core",icon:ae,group:"advanced",...o.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},ue=e=>null,de={type:"Dark Mode",label:"web_blocks.dark_mode",category:"core",icon:g.MoonIcon,group:"advanced",...o.registerChaiBlockSchema({properties:{}}),blocks:()=>[{_id:"ultqCh",_type:"Span",tag:"span",styles:"#styles:,",_name:"Dark Mode Switcher"},{_id:"vroabi",_parent:"ultqCh",_type:"Button",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:"eweibk",_parent:"vroabi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"nltBrv",_parent:"eweibk",_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:"Button",styles_attrs:{type:"button","x-on:click":"darkMode = 'light'","x-show":"darkMode === 'dark'"},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:"Light Mode Btn"},{_id:"sgbhDo",_parent:"gesydi",_type:"Span",tag:"span",styles:"#styles:,group inline-flex shrink-0 justify-center items-center size-9"},{_id:"AdDwBC",_parent:"sgbhDo",_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>"}]},ge=e=>{const{blockProps:r,inBuilder:t,children:s,globalBlock:l}=e;return t&&!l?i.jsxRuntimeExports.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...r,children:[i.jsxRuntimeExports.jsxs("h1",{children:["Global Block - ",l]}),i.jsxRuntimeExports.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):d.createElement("div",{...r},s)},me={type:"GlobalBlock",label:"Global Block",icon:C.GlobeIcon,category:"core",group:"advanced",...o.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",hidden:!0}}})},ye=e=>e.inBuilder||e.forceWrapper?i.jsxRuntimeExports.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,he={type:"Text",label:"Text",hidden:!0,category:"core",group:"typography",icon:g.SpaceBetweenVerticallyIcon,...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("text-black"),content:{type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},fe=e=>{const{blockProps:r,backgroundImage:t,children:s,styles:l,tag:n}=e;let a={};return t&&(a={backgroundImage:`url(${t})`}),d.createElement(n||"div",{...r,...l,style:a},s)},be={type:"Body",label:"Body",category:"core",group:"basic",hidden:!0,...o.registerChaiBlockSchema({properties:{styles:o.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},xe=e=>{const{blockProps:r,styles:t}=e;return d.createElement("br",{...r,...t})},ke={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},Be=e=>{const{children:r,blockProps:t,errorMessage:s,successMessage:l,action:n,styles:a}=e;let c=r;r||(c=i.jsxRuntimeExports.jsx(k,{}));const p={"x-data":"{}","x-on:submit.prevent":"post"},u={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return i.jsxRuntimeExports.jsxs("form",{...p,"data-error":s,"data-success":l,method:"post",action:n,...t,...a,children:[i.jsxRuntimeExports.jsx("div",{...u}),c]})},je={type:"Form",label:"Form",category:"core",icon:C.GroupIcon,group:"form",...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},Se=e=>{const{blockProps:r,inBuilder:t,label:s,styles:l,inputStyles:n,icon:a,iconSize:c,iconPos:p}=e,u=f.generateUUID(),h={"x-bind:disabled":"formLoading"};return i.jsxRuntimeExports.jsxs("button",{id:u,...h,...n,...l,...r||{},type:t?"button":"submit",children:[s,a&&i.jsxRuntimeExports.jsx("div",{style:{width:c+"px"},className:p+" "+(p==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},Ce={type:"FormButton",label:"Submit Button",category:"core",icon:g.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"]},we=e=>{const{blockProps:r,fieldName:t,label:s,placeholder:l,styles:n,inputStyles:a,showLabel:c,required:p,inputType:u}=e,h=f.generateUUID();return c?i.jsxRuntimeExports.jsxs("div",{...n,...r,children:[c&&i.jsxRuntimeExports.jsx("label",{htmlFor:h,children:s}),i.jsxRuntimeExports.jsx("input",{name:t,...a,id:h,type:u,placeholder:l,required:p})]}):i.jsxRuntimeExports.jsx("input",{id:h,name:t,...r,...a,...n,type:u,placeholder:l,required:p})},ve={type:"Input",label:"web_blocks.input",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{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",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"]},Ee=e=>{const{blockProps:r,fieldName:t,label:s,styles:l,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,u=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...l,...r,children:[i.jsxRuntimeExports.jsx("input",{...n,name:t,id:u,type:"radio",required:a,defaultChecked:c}),s&&i.jsxRuntimeExports.jsx("label",{htmlFor:u,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:u,...r,...n,...l,type:"radio",required:a,checked:c,name:t})},Pe={type:"Radio",label:"web_blocks.radio",category:"core",icon:g.RadiobuttonIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},Ie=e=>{const{blockProps:r,fieldName:t,label:s,placeholder:l,styles:n,inputStyles:a,required:c,showLabel:p,_multiple:u,options:h}=e,b=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...n,...r,children:[p&&i.jsxRuntimeExports.jsx("label",{htmlFor:b,children:s}),i.jsxRuntimeExports.jsxs("select",{...a,id:b,required:c,multiple:u,name:t,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),y.map(h,m=>i.jsxRuntimeExports.jsx("option",{value:m.value,dangerouslySetInnerHTML:{__html:m.label}},m.value))]})]}):i.jsxRuntimeExports.jsxs("select",{id:b,...n,...r,required:c,multiple:u,name:t,children:[i.jsxRuntimeExports.jsx("option",{value:"",disabled:!0,selected:!0,hidden:!0,children:l}),y.map(h,m=>i.jsxRuntimeExports.jsx("option",{value:m.value,dangerouslySetInnerHTML:{__html:m.label}},m.value))]})},Le={type:"Select",label:"web_blocks.select",category:"core",icon:g.DropdownMenuIcon,group:"form",...o.registerChaiBlockSchema({properties:{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"},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:r,fieldName:t,label:s,placeholder:l,styles:n,inputStyles:a,_rows:c,showLabel:p}=e,u=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...n,...r,children:[p&&i.jsxRuntimeExports.jsx("label",{htmlFor:u,children:s}),i.jsxRuntimeExports.jsx("textarea",{name:t,...a,id:u,placeholder:l,rows:c})]}):i.jsxRuntimeExports.jsx("textarea",{id:u,name:t,...r,...a,...n,placeholder:l,rows:c})},Re={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:g.InputIcon,group:"form",...o.registerChaiBlockSchema({properties:{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"]},Me=e=>{const{blockProps:r,fieldName:t,label:s,styles:l,inputStyles:n,required:a,checked:c,showLabel:p=!0}=e,u=f.generateUUID();return p?i.jsxRuntimeExports.jsxs("div",{...l,...r,children:[i.jsxRuntimeExports.jsx("input",{...n,name:t,id:u,type:"checkbox",required:a,defaultChecked:c}),s&&i.jsxRuntimeExports.jsx("label",{htmlFor:u,children:s})]}):i.jsxRuntimeExports.jsx("input",{id:u,...r,...n,...l,type:"checkbox",required:a,name:t})},Te={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:g.CheckboxIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp("flex items-center gap-x-2"),inputStyles:o.StylesProp(""),label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},$e=e=>{const{blockProps:r,content:t,styles:s,children:l}=e,n={...s,...r};return l?d.createElement("label",n,l):d.createElement("label",{...n,dangerouslySetInnerHTML:{__html:t}})},Ne={type:"Label",label:"Label",category:"core",icon:g.LetterCaseToggleIcon,group:"form",...o.registerChaiBlockSchema({properties:{styles:o.StylesProp(),content:{type:"string",title:"Content",default:""}}})},He=()=>{o.registerChaiBlock(I,L),o.registerChaiBlock($,N),o.registerChaiBlock(_,R),o.registerChaiBlock(H,z),o.registerChaiBlock(D,q),o.registerChaiBlock(A,U),o.registerChaiBlock(O,F),o.registerChaiBlock(G,V),o.registerChaiBlock(W,X),o.registerChaiBlock(Y,Z),o.registerChaiBlock(J,K),o.registerChaiBlock(Q,ee),o.registerChaiBlock(te,oe),o.registerChaiBlock(se,le),o.registerChaiBlock(M,T),o.registerChaiBlock(ce,pe),o.registerChaiBlock(ye,he),o.registerChaiBlock(Be,je),o.registerChaiBlock(Se,Ce),o.registerChaiBlock(we,ve),o.registerChaiBlock(Me,Te),o.registerChaiBlock(Ee,Pe),o.registerChaiBlock(Ie,Le),o.registerChaiBlock(_e,Re),o.registerChaiBlock($e,Ne),o.registerChaiBlock(xe,ke),o.registerChaiBlock(fe,be),o.registerChaiBlock(ie,ne),o.registerChaiBlock(ue,de),o.registerChaiBlock(ge,me)};exports.loadWebBlocks=He;