@chaibuilder/sdk 4.0.0-beta.1 → 4.0.0-beta.3

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.
Files changed (184) hide show
  1. package/README.md +27 -20
  2. package/dist/2SSKDMRQ-BnsZi3K3.cjs +1 -0
  3. package/dist/2SSKDMRQ-CnSDkQcy.js +42 -0
  4. package/dist/AP7HFJJL-B31839PG.cjs +1228 -0
  5. package/dist/AP7HFJJL-CymCmW14.js +9214 -0
  6. package/dist/IconPicker-B1rWC-Ex.js +59 -0
  7. package/dist/IconPicker-DREyo007.cjs +1 -0
  8. package/dist/WDYDFRGG-BUVnbAci.js +33 -0
  9. package/dist/WDYDFRGG-BxhOCHc3.cjs +1 -0
  10. package/dist/_commonjsHelpers-C6fGbg64.js +6 -0
  11. package/dist/_commonjsHelpers-DwGv2jUC.cjs +1 -0
  12. package/dist/actions-registery-CZ1w0NKa.js +15545 -0
  13. package/dist/actions-registery-YnFmU21O.cjs +418 -0
  14. package/dist/actions.cjs +1 -0
  15. package/dist/actions.d.ts +3202 -0
  16. package/dist/actions.js +216 -0
  17. package/dist/active-in-another-tab-B47YjQGN.cjs +1 -0
  18. package/dist/active-in-another-tab-CyjngVA6.js +34 -0
  19. package/dist/add-new-language-page-88xzrUy8.cjs +1 -0
  20. package/dist/add-new-language-page-WmlCnytQ.js +401 -0
  21. package/dist/add-new-page-VW2wAYZp.js +31 -0
  22. package/dist/add-new-page-soZ8GAkN.cjs +1 -0
  23. package/dist/ai-panel-content-7zCil042.cjs +1 -0
  24. package/dist/ai-panel-content-D_o7Q_A-.js +61 -0
  25. package/dist/ai-panel-default-lang-COYaxNwn.cjs +3 -0
  26. package/dist/ai-panel-default-lang-DnElspF0.js +341 -0
  27. package/dist/ai-panel-other-lang-CkynNlAU.cjs +1 -0
  28. package/dist/ai-panel-other-lang-Dp0E9_Hx.js +162 -0
  29. package/dist/ai-prompt-input-Bhc0ds7X.js +655 -0
  30. package/dist/ai-prompt-input-CThbVp0_.cjs +1 -0
  31. package/dist/ai-translation-prompt-C2kJQFDX.cjs +1 -0
  32. package/dist/ai-translation-prompt-CZ55HQmo.js +28 -0
  33. package/dist/apply-binding-6iwlED02.js +833 -0
  34. package/dist/apply-binding-KKp5PnpZ.cjs +1 -0
  35. package/dist/code-display-BnqzqzoP.cjs +1 -0
  36. package/dist/{code-display-337R7Dev.js → code-display-DhD_RBcg.js} +1 -1
  37. package/dist/code-editor-DRIAnNbb.js +50 -0
  38. package/dist/code-editor-o3___nu2.cjs +1 -0
  39. package/dist/common-functions-B3a4xKt_.cjs +1 -0
  40. package/dist/common-functions-D2lMFR6K.js +13 -0
  41. package/dist/continue-editing-in-this-client-CS2aQ7yY.js +24 -0
  42. package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +1 -0
  43. package/dist/core-BoRDjj4h.cjs +1 -0
  44. package/dist/core-yvI6kCyw.js +56 -0
  45. package/dist/core.cjs +1 -1
  46. package/dist/core.d.ts +51 -383
  47. package/dist/core.js +39 -106
  48. package/dist/{css-import-modal-DA2L6kwP.js → css-import-modal-Byg6wV0O.js} +36 -36
  49. package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
  50. package/dist/delete-design-token-BRZZiWtQ.js +40 -0
  51. package/dist/delete-design-token-DkVs1oBf.cjs +1 -0
  52. package/dist/delete-page-BzyX9TN-.js +70 -0
  53. package/dist/delete-page-DxX7PFIE.cjs +1 -0
  54. package/dist/design-token-usage-CAHzEGgJ.cjs +1 -0
  55. package/dist/design-token-usage-xQs6SlaJ.js +113 -0
  56. package/dist/digital-asset-manager--uO8Agia.cjs +1 -0
  57. package/dist/digital-asset-manager-DbtwzxRz.js +876 -0
  58. package/dist/duplicate-page-BR7Dlo9d.js +133 -0
  59. package/dist/duplicate-page-CaNAbXwV.cjs +1 -0
  60. package/dist/dynamic-page-selector-Cb5r_W8s.js +85 -0
  61. package/dist/dynamic-page-selector-Cxk_gjni.cjs +1 -0
  62. package/dist/fonts-B-Xt29pe.cjs +1 -0
  63. package/dist/fonts-DRly3Wzd.js +78 -0
  64. package/dist/{get-chai-builder-tailwind-config-C6MHaUM0.cjs → get-chai-builder-tailwind-config-B9rCyiQo.cjs} +1 -1
  65. package/dist/{get-chai-builder-tailwind-config-BqaIvg8p.js → get-chai-builder-tailwind-config-DjoVOuAf.js} +13 -10
  66. package/dist/{get-chai-builder-theme-D0IsUvK4.js → get-chai-builder-theme-BYtp20KD.js} +4 -4
  67. package/dist/get-chai-builder-theme-Dl72X7cz.cjs +1 -0
  68. package/dist/get-seo-defaults-9zHebckY.js +65 -0
  69. package/dist/get-seo-defaults-Cw7vFt-B.cjs +1 -0
  70. package/dist/image-compression-DZ9WMmyn.cjs +1 -0
  71. package/dist/image-compression-DsZ1oqpb.js +37 -0
  72. package/dist/image-editor-DV8kUKhl.js +108 -0
  73. package/dist/image-editor-G-K28aTS.cjs +1 -0
  74. package/dist/index-B-rSiAp_.cjs +1 -0
  75. package/dist/index-Ct7ElCGK.js +19069 -0
  76. package/dist/index-DF5DEvqb.cjs +160 -0
  77. package/dist/index-Dxfyt4d4.js +39 -0
  78. package/dist/index-WQwzsC7A.cjs +5 -0
  79. package/dist/index-ZuacEL1j.js +4732 -0
  80. package/dist/json-diff-viewer-D7z4zNvv.cjs +8 -0
  81. package/dist/json-diff-viewer-krslPepD.js +258 -0
  82. package/dist/lang-panel-BwIewMyw.js +215 -0
  83. package/dist/lang-panel-DT96k1xg.cjs +1 -0
  84. package/dist/manage-design-tokens-Caz_20VK.js +240 -0
  85. package/dist/manage-design-tokens-CrmLe7UT.cjs +1 -0
  86. package/dist/mark-as-template-D295ZQtU.js +156 -0
  87. package/dist/mark-as-template-W3LmpiqN.cjs +1 -0
  88. package/dist/models-5gOsRC56.cjs +1 -0
  89. package/dist/models-D95ZYr_x.js +70 -0
  90. package/dist/nested-path-selector-content-CKYYK-C5.js +87 -0
  91. package/dist/nested-path-selector-content-CoS_d3dc.cjs +1 -0
  92. package/dist/no-language-page-content-BvqRBP6y.js +42 -0
  93. package/dist/no-language-page-content-DkfeMl90.cjs +1 -0
  94. package/dist/no-language-page-dialog-BcEoqyQB.cjs +1 -0
  95. package/dist/no-language-page-dialog-PjNqTUpl.js +10 -0
  96. package/dist/page-creator-C4gc5NSC.cjs +1 -0
  97. package/dist/page-creator-DiOITEMw.js +795 -0
  98. package/dist/page-lock-BdYmCks0.cjs +1 -0
  99. package/dist/page-lock-Bfbs6RgL.js +30 -0
  100. package/dist/page-locked-dialog-B1FAtK92.cjs +1 -0
  101. package/dist/page-locked-dialog-B6MKTRfY.js +133 -0
  102. package/dist/page-manager-new-CHDueBDk.cjs +1 -0
  103. package/dist/page-manager-new-CzX22g2n.js +394 -0
  104. package/dist/page-manager-search-and-filter-CM0UMb6U.js +201 -0
  105. package/dist/page-manager-search-and-filter-DkkRIH86.cjs +1 -0
  106. package/dist/page-revisions-content-ChY-4f2V.cjs +1 -0
  107. package/dist/page-revisions-content-NH9JK4Ey.js +445 -0
  108. package/dist/pages.cjs +1 -0
  109. package/dist/pages.d.ts +491 -0
  110. package/dist/pages.js +27 -0
  111. package/dist/plugin-3ZKK6RXm.js +245 -0
  112. package/dist/plugin-C6rgJDNQ.cjs +22 -0
  113. package/dist/publish-pages-content-D9aixMN5.js +178 -0
  114. package/dist/publish-pages-content-x-JuSFJ9.cjs +1 -0
  115. package/dist/register-partial-type-BjtdfKHE.js +36 -0
  116. package/dist/register-partial-type-ig9fUWIJ.cjs +1 -0
  117. package/dist/render.cjs +2 -2
  118. package/dist/render.d.ts +26 -13
  119. package/dist/render.js +130 -124
  120. package/dist/rte-widget-modal-BaHIuEjF.cjs +1 -0
  121. package/dist/rte-widget-modal-DOJEXLIf.js +38 -0
  122. package/dist/runtime.cjs +1 -1
  123. package/dist/runtime.d.ts +306 -7
  124. package/dist/runtime.js +44 -1
  125. package/dist/save-to-lib-Cgpxw8-g.cjs +1 -0
  126. package/dist/save-to-lib-eiOc_SSN.js +422 -0
  127. package/dist/sdk.css +1 -1
  128. package/dist/selected-block-display-BgRY82CT.cjs +16 -0
  129. package/dist/selected-block-display-CBFePS19.js +319 -0
  130. package/dist/seo-panel-C1-iMOR1.js +798 -0
  131. package/dist/seo-panel-DfAb8U7W.cjs +2 -0
  132. package/dist/shared-json-ld-B4PxAM_0.js +565 -0
  133. package/dist/shared-json-ld-DzG398hr.cjs +1 -0
  134. package/dist/slug-input-AwNJs9im.js +86 -0
  135. package/dist/slug-input-C_ijLQ_X.cjs +1 -0
  136. package/dist/supabase-actions.cjs +1 -0
  137. package/dist/supabase-actions.d.ts +284 -0
  138. package/dist/supabase-actions.js +524 -0
  139. package/dist/take-over-request-BNxcjY2j.cjs +1 -0
  140. package/dist/take-over-request-C4FeDtN_.js +63 -0
  141. package/dist/theme-panel-footer-Cq9pljro.cjs +1 -0
  142. package/dist/theme-panel-footer-uBQqSJXm.js +25 -0
  143. package/dist/translation-warning-modal-B64YqlbI.js +26 -0
  144. package/dist/translation-warning-modal-BZAcwM2_.cjs +1 -0
  145. package/dist/unmark-as-template-CZ9sQp_P.js +39 -0
  146. package/dist/unmark-as-template-EVvk0vmp.cjs +1 -0
  147. package/dist/unpublish-page-D4VwOlxc.js +27 -0
  148. package/dist/unpublish-page-bdSmwAVQ.cjs +1 -0
  149. package/dist/use-page-expand-manager-B6XTvk0E.cjs +1 -0
  150. package/dist/use-page-expand-manager-Cf4MUEJw.js +85 -0
  151. package/dist/{tailwind.cjs → utils.cjs} +1 -1
  152. package/dist/{tailwind.d.ts → utils.d.ts} +12 -11
  153. package/dist/utils.js +7 -0
  154. package/dist/web-blocks.cjs +1 -1
  155. package/dist/web-blocks.d.ts +0 -6
  156. package/dist/web-blocks.js +248 -241
  157. package/dist/web-preview-Cio70gk5.cjs +1 -0
  158. package/dist/web-preview-Djy6WIyj.js +73 -0
  159. package/package.json +175 -105
  160. package/dist/IconPicker-CGWn9C4u.cjs +0 -1
  161. package/dist/IconPicker-QvxJ-4Ez.js +0 -64
  162. package/dist/apply-binding-DCno1xQL.js +0 -711
  163. package/dist/apply-binding-DvHNFLQD.cjs +0 -1
  164. package/dist/code-display-BZ1x7SqI.cjs +0 -1
  165. package/dist/code-editor-B28LoECM.cjs +0 -1
  166. package/dist/code-editor-CfG2FhJ-.js +0 -58
  167. package/dist/common-functions-BGzDsf1z.js +0 -14
  168. package/dist/common-functions-BZmyleS1.cjs +0 -1
  169. package/dist/css-import-modal-CENUYvcl.cjs +0 -13
  170. package/dist/get-chai-builder-theme-Ck_Z4Q-M.cjs +0 -1
  171. package/dist/index-CaGNHF7f.js +0 -12209
  172. package/dist/index-Gn6pJt2v.cjs +0 -166
  173. package/dist/mockServiceWorker.js +0 -307
  174. package/dist/plugin-B5627hMN.js +0 -195
  175. package/dist/plugin-UxTRfDum.cjs +0 -22
  176. package/dist/rte-widget-modal-DL739qeQ.cjs +0 -1
  177. package/dist/rte-widget-modal-Dte0od04.js +0 -41
  178. package/dist/tailwind.js +0 -7
  179. package/dist/tooltip-A4qGk781.cjs +0 -1
  180. package/dist/tooltip-tLiIOgjq.js +0 -1067
  181. package/dist/ui.cjs +0 -1
  182. package/dist/ui.d.ts +0 -415
  183. package/dist/ui.js +0 -129
  184. package/dist/vite.svg +0 -1
@@ -0,0 +1,39 @@
1
+ import { jsx as a, jsxs as s } from "react/jsx-runtime";
2
+ import { D as p, d as u, e as d, f, p as g, q as h, B as r } from "./index-Ct7ElCGK.js";
3
+ import { r as k } from "./index-ZuacEL1j.js";
4
+ import { useState as D } from "react";
5
+ import { useTranslation as x } from "react-i18next";
6
+ const C = ({ page: i, onClose: t }) => {
7
+ const { t: e } = x(), [o, n] = D(!1), l = k(), m = () => {
8
+ n(!0), l.mutate(i, {
9
+ onSuccess: () => {
10
+ n(!1), t();
11
+ },
12
+ onError: () => {
13
+ n(!1);
14
+ }
15
+ });
16
+ };
17
+ return /* @__PURE__ */ a(p, { open: !0, onOpenChange: t, children: /* @__PURE__ */ s(u, { children: [
18
+ /* @__PURE__ */ s(d, { children: [
19
+ /* @__PURE__ */ a(f, { children: e("Unmark as template") }),
20
+ /* @__PURE__ */ a(g, { className: "space-y-1 py-4 text-xs text-slate-500", children: e("Are you sure you want to unmark this page as a template?") })
21
+ ] }),
22
+ /* @__PURE__ */ s(h, { className: o ? "pointer-events-none opacity-75" : "", children: [
23
+ /* @__PURE__ */ a(
24
+ r,
25
+ {
26
+ variant: "outline",
27
+ onClick: (c) => {
28
+ c.stopPropagation(), t();
29
+ },
30
+ children: e("Cancel")
31
+ }
32
+ ),
33
+ /* @__PURE__ */ a(r, { variant: "default", disabled: o, onClick: m, children: e("Unmark as template") })
34
+ ] })
35
+ ] }) });
36
+ };
37
+ export {
38
+ C as default
39
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DF5DEvqb.cjs"),u=require("./index-WQwzsC7A.cjs"),d=require("react"),p=require("react-i18next"),m=({page:o,onClose:n})=>{const{t:a}=p.useTranslation(),[r,s]=d.useState(!1),i=u.useUnmarkAsTemplate(),l=()=>{s(!0),i.mutate(o,{onSuccess:()=>{s(!1),n()},onError:()=>{s(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:n,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:a("Unmark as template")}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:a("Are you sure you want to unmark this page as a template?")})]}),e.jsxs(t.DialogFooter,{className:r?"pointer-events-none opacity-75":"",children:[e.jsx(t.Button,{variant:"outline",onClick:c=>{c.stopPropagation(),n()},children:a("Cancel")}),e.jsx(t.Button,{variant:"default",disabled:r,onClick:l,children:a("Unmark as template")})]})]})})};exports.default=m;
@@ -0,0 +1,27 @@
1
+ import { jsx as s, jsxs as o } from "react/jsx-runtime";
2
+ import { D as c, d as u, e as d, f as h, p as m, q as b, B as r } from "./index-Ct7ElCGK.js";
3
+ import { s as D } from "./index-ZuacEL1j.js";
4
+ import { useTranslation as f } from "react-i18next";
5
+ const g = ({ page: n, onClose: t }) => {
6
+ const { t: i } = f(), { mutate: e, isPending: l } = D(), a = async () => {
7
+ e(n, { onSuccess: t });
8
+ };
9
+ return /* @__PURE__ */ s(c, { open: !!n, onOpenChange: t, children: /* @__PURE__ */ o(u, { children: [
10
+ /* @__PURE__ */ o(d, { children: [
11
+ /* @__PURE__ */ s(h, { children: i("Confirm action") }),
12
+ /* @__PURE__ */ o(m, { children: [
13
+ i("Are you sure you want to unpublish"),
14
+ " ",
15
+ /* @__PURE__ */ s("b", { children: (n == null ? void 0 : n.name) ?? (n == null ? void 0 : n.slug) }),
16
+ "?"
17
+ ] })
18
+ ] }),
19
+ /* @__PURE__ */ o(b, { children: [
20
+ /* @__PURE__ */ s(r, { variant: "outline", onClick: t, children: i("Cancel") }),
21
+ /* @__PURE__ */ s(r, { variant: "destructive", disabled: l, onClick: a, children: i(l ? "Updating..." : "Unpublish") })
22
+ ] })
23
+ ] }) });
24
+ };
25
+ export {
26
+ g as default
27
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("./index-DF5DEvqb.cjs"),u=require("./index-WQwzsC7A.cjs"),c=require("react-i18next"),a=({page:i,onClose:t})=>{const{t:s}=c.useTranslation(),{mutate:l,isPending:r}=u.useUnpublishPage(),o=async()=>{l(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:s("Confirm action")}),n.jsxs(e.DialogDescription,{children:[s("Are you sure you want to unpublish")," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(e.Button,{variant:"outline",onClick:t,children:s("Cancel")}),n.jsx(e.Button,{variant:"destructive",disabled:r,onClick:o,children:s(r?"Updating...":"Unpublish")})]})]})})};exports.default=a;
@@ -0,0 +1 @@
1
+ "use strict";const m=require("jotai"),y=require("jotai/utils"),p=require("react"),n=require("lodash-es"),A=y.atomWithStorage("expandedPagesState",[]),E=s=>n.flatMap(s,e=>[e,...e.children?E(e.children):[]]),S=(s,e)=>{const t=(a,i=[])=>{for(const r of a){const o=[...i,r.id];if(r.id===e)return o;if(r.children&&r.children.length>0){const d=t(r.children,o);if(d)return d}}return null};return t(s)||[]},P=(s,e)=>{if(!e)return[];const t=E(s),a=n.find(t,i=>i.id===e);if(a){if(a.parent)return[...P(s,a.parent),e];const i=S(s,e);if(!n.isEmpty(i))return i}return[e]},C=s=>{const e=new Set,t=(a,i=[])=>{a.forEach(r=>{const o=[...i,r.id];r.shouldExpandOnSearch&&o.forEach(d=>e.add(d)),r.children&&!n.isEmpty(r.children)&&t(r.children,o)})};return t(s),Array.from(e)},b=s=>{const[e,t]=m.useAtom(A),a=s?n.includes(e,s):!1,i=p.useCallback(()=>{t(c=>a?n.filter(c,l=>l!==s):[...c,s])},[t,a,s]),r=p.useCallback((c,l)=>{if(!l||n.isEmpty(c))return;const h=E(c),u=P(h,l);if(!Array.isArray(u)||n.isEmpty(u))return;const f=u.slice(0,-1);n.isEmpty(f)||t(g=>n.uniq([...g,...f]))},[t]),o=p.useCallback(c=>{if(n.isEmpty(c))return;const l=C(c);n.isEmpty(l)||t(h=>n.union(h,l))},[t]),d=p.useCallback(c=>{if(n.isEmpty(c))return;const l=n.flatMap(c,h=>{const u=f=>[f.id,...f.children?n.flatMap(f.children,u):[]];return u(h)});t(l)},[t]),x=p.useCallback(()=>{t([])},[t]);return{isExpanded:a,toggleExpanded:i,updateForSelectedPage:r,expandedPages:e,expandPagesOnSearch:o,setExpandedPages:t,expandAll:d,collapseAll:x}};exports.usePageExpandManager=b;
@@ -0,0 +1,85 @@
1
+ import { useAtom as A } from "jotai";
2
+ import { atomWithStorage as S } from "jotai/utils";
3
+ import { useCallback as p } from "react";
4
+ import { isEmpty as i, uniq as y, union as O, flatMap as P, includes as C, filter as F, find as M } from "lodash-es";
5
+ const T = S("expandedPagesState", []), m = (e) => P(e, (n) => [
6
+ n,
7
+ ...n.children ? m(n.children) : []
8
+ ]), b = (e, n) => {
9
+ const t = (s, o = []) => {
10
+ for (const r of s) {
11
+ const d = [...o, r.id];
12
+ if (r.id === n)
13
+ return d;
14
+ if (r.children && r.children.length > 0) {
15
+ const l = t(r.children, d);
16
+ if (l) return l;
17
+ }
18
+ }
19
+ return null;
20
+ };
21
+ return t(e) || [];
22
+ }, x = (e, n) => {
23
+ if (!n) return [];
24
+ const t = m(e), s = M(t, (o) => o.id === n);
25
+ if (s) {
26
+ if (s.parent)
27
+ return [...x(e, s.parent), n];
28
+ const o = b(e, n);
29
+ if (!i(o))
30
+ return o;
31
+ }
32
+ return [n];
33
+ }, k = (e) => {
34
+ const n = /* @__PURE__ */ new Set(), t = (s, o = []) => {
35
+ s.forEach((r) => {
36
+ const d = [...o, r.id];
37
+ r.shouldExpandOnSearch && d.forEach((l) => n.add(l)), r.children && !i(r.children) && t(r.children, d);
38
+ });
39
+ };
40
+ return t(e), Array.from(n);
41
+ }, W = (e) => {
42
+ const [n, t] = A(T), s = e ? C(n, e) : !1, o = p(() => {
43
+ t(
44
+ (a) => s ? F(a, (c) => c !== e) : [...a, e]
45
+ );
46
+ }, [t, s, e]), r = p(
47
+ (a, c) => {
48
+ if (!c || i(a)) return;
49
+ const h = m(a), f = x(h, c);
50
+ if (!Array.isArray(f) || i(f)) return;
51
+ const u = f.slice(0, -1);
52
+ i(u) || t((E) => y([...E, ...u]));
53
+ },
54
+ [t]
55
+ ), d = p(
56
+ (a) => {
57
+ if (i(a)) return;
58
+ const c = k(a);
59
+ i(c) || t((h) => O(h, c));
60
+ },
61
+ [t]
62
+ ), l = p((a) => {
63
+ if (i(a)) return;
64
+ const c = P(a, (h) => {
65
+ const f = (u) => [u.id, ...u.children ? P(u.children, f) : []];
66
+ return f(h);
67
+ });
68
+ t(c);
69
+ }, [t]), g = p(() => {
70
+ t([]);
71
+ }, [t]);
72
+ return {
73
+ isExpanded: s,
74
+ toggleExpanded: o,
75
+ updateForSelectedPage: r,
76
+ expandedPages: n,
77
+ expandPagesOnSearch: d,
78
+ setExpandedPages: t,
79
+ expandAll: l,
80
+ collapseAll: g
81
+ };
82
+ };
83
+ export {
84
+ W as u
85
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./get-chai-builder-theme-Ck_Z4Q-M.cjs"),e=require("./get-chai-builder-tailwind-config-C6MHaUM0.cjs");exports.chaiBuilderPlugin=i.chaiBuilderPlugin;exports.getChaiBuilderTheme=i.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=e.getChaiBuilderTailwindConfig;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./get-chai-builder-theme-Dl72X7cz.cjs"),e=require("./get-chai-builder-tailwind-config-B9rCyiQo.cjs");exports.chaiBuilderPlugin=i.chaiBuilderPlugin;exports.getChaiBuilderTheme=i.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=e.getChaiBuilderTailwindConfig;
@@ -1,6 +1,7 @@
1
- import { b } from 'node_modules/tailwindcss/dist/types-WlZgYgM8.d.mts';
1
+ import { Config } from 'tailwindcss/types/config';
2
2
  import { default as default_2 } from '@tailwindcss/forms';
3
3
  import { default as default_3 } from '@tailwindcss/typography';
4
+ import { PluginCreator } from 'tailwindcss/types/config';
4
5
 
5
6
  declare type BorderRadiusValue = false | string;
6
7
 
@@ -9,7 +10,10 @@ declare type BorderRadiusValue = false | string;
9
10
  * @param {*} theme
10
11
  * @returns typeof plugin
11
12
  */
12
- export declare const chaiBuilderPlugin: b;
13
+ export declare const chaiBuilderPlugin: {
14
+ handler: PluginCreator;
15
+ config?: Partial<Config>;
16
+ };
13
17
 
14
18
  declare type ChaiBuilderThemeOptions = {
15
19
  fontFamily: false | Record<VariableKey, string>;
@@ -20,7 +24,10 @@ declare type ChaiBuilderThemeOptions = {
20
24
  }[];
21
25
  };
22
26
 
23
- export declare const getChaiBuilderTailwindConfig: (content: string[]) => {
27
+ export declare const getChaiBuilderTailwindConfig: ({ content, theme }: {
28
+ content: string[];
29
+ theme?: Record<string, any>;
30
+ }) => {
24
31
  darkMode: string;
25
32
  content: string[];
26
33
  theme: {
@@ -95,7 +102,7 @@ export declare const getChaiBuilderTailwindConfig: (content: string[]) => {
95
102
  };
96
103
 
97
104
  export declare const getChaiBuilderTheme: (themeOptions?: ChaiBuilderThemeOptions) => {
98
- fontFamily: any;
105
+ fontFamily: {};
99
106
  borderRadius: {
100
107
  lg: string;
101
108
  md: string;
@@ -105,7 +112,7 @@ export declare const getChaiBuilderTheme: (themeOptions?: ChaiBuilderThemeOption
105
112
  md?: undefined;
106
113
  sm?: undefined;
107
114
  };
108
- colors: any;
115
+ colors: {};
109
116
  container: {
110
117
  center: boolean;
111
118
  padding: string;
@@ -120,9 +127,3 @@ declare type HSLColor = string;
120
127
  declare type VariableKey = string;
121
128
 
122
129
  export { }
123
-
124
- declare global {
125
- interface Window {
126
- clarity: any;
127
- }
128
- }
package/dist/utils.js ADDED
@@ -0,0 +1,7 @@
1
+ import { c as a, g as r } from "./get-chai-builder-theme-BYtp20KD.js";
2
+ import { g as l } from "./get-chai-builder-tailwind-config-DjoVOuAf.js";
3
+ export {
4
+ a as chaiBuilderPlugin,
5
+ l as getChaiBuilderTailwindConfig,
6
+ r as getChaiBuilderTheme
7
+ };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("@chaibuilder/runtime"),i=require("react/jsx-runtime"),C=require("./common-functions-BZmyleS1.cjs"),x=require("react"),u=require("@radix-ui/react-icons"),d=require("lodash-es");function j(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,r.get?r:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const y=j(x),k=({className:e="",inBuilder:o})=>o?i.jsx("div",{className:C.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:i.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,L=e=>{const{blockProps:o,inBuilder:t,backgroundImage:r,children:s,tag:a="div",styles:n}=e;let c=s;s||(c=i.jsx(k,{inBuilder:t}));let p={};return r&&(p={backgroundImage:`url(${r})`}),y.createElement(a,{...o,...n,style:p},c)},_={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]},backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image"}}}}),canAcceptBlock:()=>!0},N=e=>{const{blockProps:o,iconSize:t,icon:r,content:s,styles:a,children:n,iconPos:c,link:p,inBuilder:m}=e,g=r,h=n||i.jsxs(i.Fragment,{children:[s&&i.jsx("span",{children:s}),g&&i.jsx("div",{style:{width:t+"px"},className:c+" "+(s?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:g}})]}),f=x.createElement("button",{...o,...a,type:"button","aria-label":s},h);return d.isEmpty(d.get(p,"href"))?f:m?i.jsx("span",{children:f}):i.jsx("a",{"aria-label":s,href:d.get(p,"href")||"/",target:d.get(p,"target","_self"),children:f})},T={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:u.ButtonIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-primary-foreground bg-primary px-4 py-2 rounded-lg flex items-center"),content:{type:"string",title:"Button label",default:"Button"},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:16},iconPos:{type:"string",title:"Icon position",default:"order-last",enum:["order-first","order-last"],enumNames:["Left","Right"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!0,title:"Prefetch Link"}}}),i18nProps:["content","link"],aiProps:["content"]},E=e=>{const{blockProps:o,styles:t,htmlCode:r,inBuilder:s}=e;return s?i.jsxs("div",{className:"relative",...o,children:[s?i.jsx("div",{...t,className:"absolute z-20 h-full w-full"}):null,y.createElement("div",{...t,dangerouslySetInnerHTML:{__html:r.replace(/<script.*?>.*?<\/script>/g,"")}})]}):y.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:r}})},R={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:u.CodeIcon,group:"advanced",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},A=e=>{const{scripts:o,inBuilder:t,blockProps:r}=e;return t?i.jsx("div",{...r,children:i.jsx("div",{className:C.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:i.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:i.jsx("p",{className:"text-left text-xs text-gray-400",children:"Scripts will be only executed in preview and live mode. Place your script at the bottom of the"})})})}):i.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},M={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:u.CodeIcon,hidden:!0,group:"advanced",...l.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},H=e=>{const{blockProps:o,inBuilder:t,children:r,globalBlock:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Global Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},$={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},P=(e,...o)=>({...e,className:C.cn(e.className,...o)}),D=e=>{const{blockProps:o,icon:t,styles:r,width:s,inBuilder:a,height:n}=e,c=P(r,"");if(d.isEmpty(t))return i.jsx(k,{inBuilder:a,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return y.createElement("span",{...o,...c,style:{width:s?`${s}px`:"auto",height:n?`${n}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},z={type:"Icon",label:"web_blocks.icon",category:"core",description:"Icon block is used to display an icon/svg.",icon:u.SketchLogoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),icon:{type:"string",title:"Icon",default:'<svg xmlns="http://www.w3.org/2000/svg" class="chai-default-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-diamond-icon lucide-diamond"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},V=e=>{const{blockProps:o,inBuilder:t,children:r,partialBlockId:s}=e;return t&&!s?i.jsxs("div",{className:"flex flex-col items-center justify-center gap-y-1 rounded-lg bg-gray-100 py-4 dark:bg-gray-800",...o,children:[i.jsxs("h1",{children:["Partial Block - ",s]}),i.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):y.createElement("span",{...o},r)},U={type:"PartialBlock",description:"A partial block component. Partial blocks are global blocks that can be used in multiple pages.",label:"Partial Block",icon:u.FrameIcon,category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},S={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},F=e=>{const{blockProps:o,children:t,styles:r,colSpan:s,tabletColSpan:a,desktopColSpan:n}=e,p={className:[d.get(r,"className",""),d.get(S,["SMALL",isNaN(s)||!s?6:s],""),a?d.get(S,["MEDIUM",a||s],""):"",n?d.get(S,["LARGE",a||s],""):""].join(" ")};return i.jsx("div",{...o,...r,...p,children:t||i.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},q={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:u.LayoutIcon,wrapper:!0,hidden:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colSpan:{type:"number",title:"Column Span",default:6,enum:[1,2,3,4,5,6,7,8,9,10,11,12]},tabletColSpan:{type:"number",title:"Column Span (Tablet)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]},desktopColSpan:{type:"number",title:"Column Span (Desktop)",default:null,enumNames:["Default",1,2,3,4,5,6,7,8,9,10,11,12],enum:[null,1,2,3,4,5,6,7,8,9,10,11,12]}}})},O=e=>{const{blockProps:o,children:t,styles:r,gutter:s}=e,n={className:[d.get(r,"className","")," grid grid-cols-12"].join()};return typeof(r==null?void 0:r.style)=="object"?r.style.gap=`${s}px`:n.style={gap:`${s}px`},i.jsx("div",{...o,...r,...n,children:t})},Z={type:"Row",description:"A row component",label:"Row",group:"basic",icon:u.RowsIcon,hidden:!0,blocks:()=>[{_type:"Row",_id:"row",styles:"#styles:,p-1"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"},{_type:"Column",id:"column",_parent:"row",styles:"#styles:,"}],category:"core",wrapper:!0,canAcceptBlock:e=>e==="Column",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},G=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},W={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:u.DividerHorizontalIcon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Y=e=>{const{blockProps:o,styles:t,backgroundImage:r}=e;let s={};return r&&(s={backgroundImage:`url(${r})`}),y.createElement("div",{...o,...t,style:s})},Q={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image"}}}})},J=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"checkbox",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"checkbox",required:n,defaultChecked:c})},X={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:u.CheckboxIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},K=e=>{const{children:o,blockProps:t,errorMessage:r,successMessage:s,action:a,styles:n,inBuilder:c}=e;let p=o;o||(p=i.jsx(k,{inBuilder:c}));const m={"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",{...m,"data-error":r,"data-success":s,method:"post",action:a,...t,...n,children:[i.jsx("div",{...g}),p]})},ee={type:"Form",label:"Form",category:"core",icon:u.FileTextIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},te=e=>{const{blockProps:o,inBuilder:t,label:r,styles:s,icon:a,iconSize:n,iconPos:c}=e;return i.jsxs("button",{...s,...o||{},type:t?"button":"submit","aria-label":r,children:[r,a&&i.jsx("div",{style:{width:n+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:a}})]})},oe={type:"FormButton",label:"Submit Button",category:"core",icon:u.ButtonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},le=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},firstName:{type:"text",autocomplete:"given-name"},lastName:{type:"text",autocomplete:"family-name"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},re=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,showLabel:c,required:p,inputType:m,defaultValue:g}=e,{type:h,autocomplete:f}=le(m);return c?i.jsxs("div",{...a,...o,children:[c&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("input",{name:t,defaultValue:g,...n,type:h,placeholder:s,required:p,autoComplete:f})]}):i.jsx("input",{name:t,...o,...n,...a,type:h,placeholder:s,required:p,autoComplete:f,defaultValue:g})},ie={type:"Input",label:"web_blocks.input",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},se=e=>{const{blockProps:o,content:t,styles:r,children:s}=e,a={...r,...o};return s?y.createElement("label",a,s):y.createElement("label",{...a,dangerouslySetInnerHTML:{__html:t}})},ae={type:"Label",label:"Label",category:"core",icon:u.LetterCaseToggleIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},ne=e=>{const{blockProps:o,fieldName:t,label:r,styles:s,inputStyles:a,required:n,checked:c,showLabel:p=!0}=e;return p?i.jsxs("div",{...s,...o,children:[i.jsx("input",{...a,name:t,type:"radio",required:n,defaultChecked:c}),r&&i.jsx("label",{htmlFor:t,children:r})]}):i.jsx("input",{name:t,...o,...a,...s,type:"radio",required:n,checked:c})},ce={type:"Radio",label:"web_blocks.radio",category:"core",icon:u.RadiobuttonIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("flex items-center gap-x-2"),inputStyles:l.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},pe=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,required:c,showLabel:p,_multiple:m,options:g,defaultValue:h}=e,f=m&&h?h.split(",").map(b=>b.trim()):h||"";return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsxs("select",{...n,required:c,multiple:m,name:t,defaultValue:f,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(g,b=>i.jsx("option",{value:b==null?void 0:b.value,children:b==null?void 0:b.label},b==null?void 0:b.value))]})]}):i.jsxs("select",{...a,...o,required:c,multiple:m,name:t,defaultValue:f,children:[i.jsx("option",{value:"",disabled:!0,hidden:!0,children:s}),d.map(g,b=>i.jsx("option",{value:b==null?void 0:b.value,children:b==null?void 0:b.label},b==null?void 0:b.value))]})},de={type:"Select",label:"web_blocks.select",category:"core",icon:u.DropdownMenuIcon,group:"form",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ue=e=>{const{blockProps:o,fieldName:t,label:r,placeholder:s,styles:a,inputStyles:n,rows:c,showLabel:p,required:m,defaultValue:g}=e;return p?i.jsxs("div",{...a,...o,children:[p&&i.jsx("label",{htmlFor:t,children:r}),i.jsx("textarea",{name:t,...n,placeholder:s,rows:c,required:m,defaultValue:g})]}):i.jsx("textarea",{name:t,...o,...n,...a,placeholder:s,rows:c,required:m,defaultValue:g})},me={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:u.InputIcon,group:"form",...l.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:l.StylesProp(""),inputStyles:l.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ye=e=>{const{blockProps:o,styles:t,content:r,tag:s="h1",children:a=null}=e;return a?y.createElement(s,{...t,...o},a):y.createElement(s,{...t,...o,dangerouslySetInnerHTML:{__html:r}})},ge={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:u.HeadingIcon,group:"typography",...l.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:l.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea","ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},he=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},be={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},fe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("table",{...o,...r},t):i.jsx(k,{})},xe=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("thead",{...o,...r},t):i.jsx(k,{})},ke=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tbody",{...o,...r},t):i.jsx(k,{})},Ce=e=>{const{blockProps:o,children:t,styles:r}=e;return t?x.createElement("tr",{...o,...r},t):i.jsx(k,{})},Be=e=>{const{blockProps:o,children:t,content:r,styles:s}=e;return!t&&d.isEmpty(r)?i.jsx(k,{}):t?x.createElement("td",{...o,...s},t):x.createElement("td",{...o,...s,dangerouslySetInnerHTML:{__html:r}})};l.registerChaiBlock(fe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:u.TableIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("Table")});l.registerChaiBlock(xe,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:u.BorderTopIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableHead")});l.registerChaiBlock(ke,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:u.BorderAllIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableBody")});l.registerChaiBlock(Ce,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:u.ViewHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),blocks:B("TableRow")});l.registerChaiBlock(Be,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:u.DragHandleHorizontalIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:B("TableCell"),i18nProps:["content"],aiProps:["content"]});function B(e){const o=(a,n)=>({_id:C.generateUUID(),_parent:a,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+n}`}),t=a=>{const n=C.generateUUID(),c={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return a&&(c._parent=a),[c,o(n,"1"),o(n,"2"),o(n,"3")]},r=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return a&&(c._parent=a),[c,...t(n)]},s=a=>{const n=C.generateUUID(),c={_id:n,_type:"TableBody",styles:"#styles:,"};return a&&(c._parent=a),[c,...t(n),...t(n)]};if(e==="Table"){const a=C.generateUUID();return[{_id:a,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...r(a),...s(a)]}return e==="TableRow"?t():e==="TableHead"?r():e==="TableBody"?s():[]}const Se="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",we=e=>{const{blockProps:o,image:t,mobileImage:r,styles:s,alt:a,height:n,width:c,lazyLoading:p,mobileWidth:m,mobileHeight:g}=e;return d.isEmpty(t)?i.jsx(k,{className:"h-36"}):i.jsxs("picture",{children:[r&&i.jsx("source",{srcSet:r,media:"(max-width: 480px)",width:m,height:g}),i.jsx("img",{...o,...s,src:t,alt:a,loading:p?"lazy":"eager",width:c,height:n})]})},Pe={type:"Image",description:"A image component",label:"Image",category:"core",icon:u.ImageIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),image:{type:"string",title:"Image",default:Se,ui:{"ui:widget":"image"}},width:{type:"string",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"string",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"string",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"string",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},ve=e=>{const{blockProps:o,link:t,children:r,styles:s,inBuilder:a,content:n}=e;let c={};return!r&&d.isEmpty(n)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),a?r?i.jsx("span",{role:"link",...o,style:c,...s,children:r}):x.createElement("span",{...o,...s,style:c,role:"link"},n):r?i.jsx("a",{"aria-label":n,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...s,children:r}):x.createElement("a",{...o,...s,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":n},n)},Ie={type:"Link",description:"A link component",label:"Link",category:"core",icon:u.Link1Icon,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"Link goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content","link"],canAcceptBlock:e=>e!=="Link"},je=e=>{const{blockProps:o,children:t,styles:r,tag:s,inBuilder:a}=e;return!t&&d.isEmpty(r==null?void 0:r.className)?i.jsx(k,{inBuilder:a}):y.createElement(s||"ul",{...o,...r},t)},Le={type:"List",description:"A list component",label:"List",icon:u.RowsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},_e=e=>{const{blockProps:o,content:t,styles:r,children:s,tag:a}=e;return s?y.createElement(a||"li",{...r,...o},s):y.createElement(a||"li",{...r,...o,dangerouslySetInnerHTML:{__html:t}})},Ne={type:"ListItem",description:"A list item component",label:"List Item",icon:u.ColumnsIcon,category:"core",group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},Te=e=>{const{blockProps:o,styles:t,content:r}=e;if(!d.isNull(e.children))return y.createElement("p",{...t,...o},e.children);const s=P(t,"rte");return y.createElement("div",{...s,...o,dangerouslySetInnerHTML:{__html:r}})},Ee={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:u.TextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.",ui:{"ui:widget":"richtext","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},Re=e=>{const{blockProps:o,content:t,styles:r}=e,s=P(r,"rte");return i.jsx("div",{...o,...s,dangerouslySetInnerHTML:{__html:t}})},Ae={type:"RichText",description:"A rich text block",label:"Rich Text",hidden:!0,category:"core",icon:u.CursorTextIcon,group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},Me=e=>{const{blockProps:o,styles:t,content:r,children:s=null,tag:a}=e;return s?y.createElement("span",{...t,...o},s):y.createElement(a||"span",{...t,...o,dangerouslySetInnerHTML:{__html:r||""}})},He={type:"Span",description:"A span component",label:"Span",category:"core",group:"typography",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},$e=e=>e.inBuilder||e.forceWrapper?i.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,De={type:"Text",description:"A text component with no styling",label:"Raw Text",category:"core",group:"typography",blocks:()=>[{_id:"a",_type:"Text",_name:"Raw Text",content:""}],icon:u.SpaceBetweenVerticallyIcon,...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},w={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},v=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,I=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=d.get(o,"autoplay",!1),r=d.get(o,"controls",!1),s=d.get(o,"loop",!1),a=t||d.get(o,"muted",!0);if(v.test(e)){const n=e.match(v);if(n){const c=n[4];let p=`https://www.youtube.com/embed/${c}`,m=t?"autoplay=1":"";return m+=s?`&loop=1&playlist=${c}`:"",m+=a?"&mute=1&muted=1":"",m+=r?"&controls=1":"&controls=0",`${p}?${m}`}}if(I.test(e)){const n=e.match(I);if(n){const c=n[1];let p="";return p+=t?"autoplay=1":"",p+=r?"&controls=1":"&controls=0",p+=a?"&muted=1":"",p+=s?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Ve=e=>{const{url:o,blockProps:t,styles:r,controls:s,videoSource:a,inBuilder:n}=e,c=ze(o,s);return i.jsxs("div",{...d.omit(r,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!c&&n?i.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:d.isEmpty(o)?`Provided ${a} video link in settings Video URL.`:`Provided ${a} video link is invalid.`}):i.jsx("iframe",{width:"100%",src:c,...d.pick(r,"className")}),n&&i.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Ue=e=>{const{url:o,styles:t,controls:r,sources:s,poster:a,blockProps:n}=e;let c=a;const p=[...d.get(s,"srcsets",[])||[]];o&&typeof o=="string"&&p.push({url:o,width:"9999"});const m=p.sort((h,f)=>parseInt(h.width)-parseInt(f.width)).filter(h=>!d.isEmpty(h.url)&&!d.isEmpty(h.width));m.length===0&&!c&&(c="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const g=d.get(r,"autoplay",!1)||d.get(r,"muted",!0);return(c||!d.isEmpty(m))&&i.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...n,key:JSON.stringify(m),controls:d.get(r,"controls",!1),autoPlay:d.get(r,"autoplay",!1),loop:d.get(r,"loop",!1),poster:c,...g?{muted:!0}:{}},m.map(h=>{if(!h.url||h.url.length<4||isNaN(h.width))return null;const f=`(max-width: ${h.width}px)`;return i.jsx("source",{src:h.url,media:f,type:h.type},h.url)}),"Your browser does not support the video tag.")})},Fe=e=>{const{videoSource:o}=e;return o==="Custom"?i.jsx(Ue,{...e}):o==="Youtube"||o==="Vimeo"?i.jsx(Ve,{...e}):i.jsxs("div",{children:["Invalid video source : ",o]})},qe={type:"Video",label:"Video",category:"core",icon:u.VideoIcon,group:"media",...l.registerChaiBlockSchema({properties:{styles:l.StylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"}},allOf:[{if:{properties:{videoSource:{const:"Custom"}}},then:{properties:{url:{type:"string",title:"Video URL",default:""},poster:{type:"string",title:"Poster URL",default:""},sources:{type:"object",default:{srcsets:[]}},controls:{...w}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...w}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...w}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url"]},Oe=e=>{const{paginationStyles:o}=e,t=l.getRegisteredChaiBlock("Pagination");return i.jsx("div",{...o,children:t?y.createElement(t.component,{...d.omit(e,["paginationStyles"]),blockProps:{}}):i.jsxs(i.Fragment,{children:[i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",disabled:!0,children:i.jsx(u.ChevronLeftIcon,{className:"h-4 w-4"})}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-blue-500 bg-blue-500 font-medium text-white",children:"1"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"2"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"3"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"4"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"5"}),i.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50",children:i.jsx(u.ChevronRightIcon,{className:"h-4 w-4"})})]})})},Ze=e=>{const{children:o,tag:t,styles:r,blockProps:s,$loading:a}=e,{pagination:n,inBuilder:c}=e;let p=o;return d.isEmpty(p)&&c&&(p=i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?a&&c?Array.from({length:2}).map((m,g)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},g)):p:i.jsxs(i.Fragment,{children:[y.createElement(t,{...s,...r},a&&c?Array.from({length:2}).map((m,g)=>i.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[i.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),i.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},g)):p),n&&i.jsx(Oe,{...d.pick(e,["limit","totalItems","paginationStrategy","inBuilder","draft","lang","paginationStyles"])})]})},Ge={type:"Repeater",label:"Repeater",icon:u.LoopIcon,group:"basic",description:"Repeater block is used to display a list of items based on data binding in repeaterItems",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),paginationStyles:l.stylesProp("flex items-center justify-center gap-2 p-4"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},pagination:{title:"Pagination",type:"boolean",default:!1}},allOf:[{if:{properties:{pagination:{const:!0}}},then:{properties:{paginationStrategy:{type:"string",title:"Pagination Strategy",default:"segment",enum:["query","segment"],enumNames:["Query(/items?page=1)","Segment(/items/1)"]},limit:{type:"number",title:"Items Per Page",default:10,minimum:1}}}},{if:{properties:{pagination:{const:!1}}},then:{properties:{limit:{type:"number",title:"Max items",default:10,minimum:1}}}}]}),canAcceptBlock:e=>e==="Pagination"},We=({children:e,blockProps:o,styles:t,parentTag:r,inBuilder:s})=>{let a="li";switch(r){case"ul":a="li";break;case"ol":a="li";break;default:a="div"}return!e&&s?y.createElement(a,{...o,...t},i.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):y.createElement(a,{...o,...t},e)},Ye={type:"RepeaterItem",label:"Repeater Item",icon:u.LoopIcon,hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp(""),parentTag:l.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Qe=({children:e,blockProps:o,styles:t})=>y.createElement("div",{...o,...t},e),Je={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",...l.registerChaiBlockSchema({properties:{styles:l.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Xe=()=>{l.registerChaiBlock(L,_),l.registerChaiBlock(Y,Q),l.registerChaiBlock(N,T),l.registerChaiBlock(ye,ge),l.registerChaiBlock(Te,Ee),l.registerChaiBlock(Me,He),l.registerChaiBlock(Re,Ae),l.registerChaiBlock(ve,Ie),l.registerChaiBlock(je,Le),l.registerChaiBlock(_e,Ne),l.registerChaiBlock(D,z),l.registerChaiBlock(we,Pe),l.registerChaiBlock(Fe,qe),l.registerChaiBlock(E,R),l.registerChaiBlock(A,M),l.registerChaiBlock($e,De),l.registerChaiBlock(K,ee),l.registerChaiBlock(te,oe),l.registerChaiBlock(re,ie),l.registerChaiBlock(J,X),l.registerChaiBlock(ne,ce),l.registerChaiBlock(pe,de),l.registerChaiBlock(ue,me),l.registerChaiBlock(se,ae),l.registerChaiBlock(he,be),l.registerChaiBlock(G,W),l.registerChaiBlock(H,$),l.registerChaiBlock(V,U),l.registerChaiBlock(O,Z),l.registerChaiBlock(F,q),l.registerChaiBlock(Ze,Ge),l.registerChaiBlock(We,Ye),l.registerChaiBlock(Qe,Je)};exports.loadWebBlocks=Xe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),a=require("./index-B-rSiAp_.cjs"),B=require("./common-functions-B3a4xKt_.cjs"),x=require("react"),m=require("@radix-ui/react-icons"),u=require("lodash-es"),d=require("./core-BoRDjj4h.cjs");function L(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const l=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(o,t,l.get?l:{enumerable:!0,get:()=>e[t]})}}return o.default=e,Object.freeze(o)}const b=L(x),C=({className:e="",inBuilder:o})=>o?r.jsx("div",{className:B.cn("pointer-events-none flex h-20 flex-col items-center justify-center p-2",e),children:r.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-2 dark:bg-gray-800",children:r.jsx("div",{className:"flex h-full w-full items-center justify-center outline-dashed outline-1 -outline-offset-1 outline-gray-400 duration-300 dark:outline-gray-700"})})}):null,_=e=>{const{blockProps:o,inBuilder:t,backgroundImage:l,children:i,tag:s="div",styles:n}=e;let c=i;i||(c=r.jsx(C,{inBuilder:t}));let p={};return l&&(p={backgroundImage:`url(${l})`}),b.createElement(s,{...o,...n,style:p},c)},N={type:"Box",description:"Similar to a div or section elements in HTML",label:"Box",category:"core",group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),tag:{type:"string",default:"div",title:"Tag",oneOf:[{const:"div",title:"div"},{const:"header",title:"header"},{const:"footer",title:"footer"},{const:"section",title:"section"},{const:"article",title:"article"},{const:"aside",title:"aside"},{const:"main",title:"main"},{const:"nav",title:"nav"},{const:"figure",title:"figure"},{const:"details",title:"details"},{const:"summary",title:"summary"},{const:"dialog",title:"dialog"},{const:"strike",title:"strike"},{const:"caption",title:"caption"},{const:"legend",title:"legend"},{const:"figcaption",title:"figcaption"},{const:"mark",title:"mark"}]},backgroundImage:{type:"string",default:"",title:"Background Image",ui:{"ui:widget":"image","ui:allowEmpty":!0}}}}),canAcceptBlock:()=>!0},T=e=>{const{blockProps:o,iconSize:t,icon:l,content:i,styles:s,children:n,iconPos:c,link:p,inBuilder:g}=e,h=l,k=n||r.jsxs(r.Fragment,{children:[i&&r.jsx("span",{children:i}),h&&r.jsx("div",{style:{width:t+"px"},className:c+" "+(i?c==="order-first"?"mr-2":"ml-2":"")||"",dangerouslySetInnerHTML:{__html:h}})]}),f=x.createElement("button",{...o,...s,type:"button","aria-label":i},k);return u.isEmpty(u.get(p,"href"))?f:g?r.jsx("span",{children:f}):r.jsx("a",{"aria-label":i,href:u.get(p,"href")||"/",target:u.get(p,"target","_self"),children:f})},E={type:"Button",description:"similar to a button element in HTML",label:"Button",category:"core",icon:m.ButtonIcon,group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.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"],enumNames:["Left","Right"]},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!0,title:"Prefetch Link"}}}),i18nProps:["content","link"],aiProps:["content"]},R=e=>{const{blockProps:o,styles:t,htmlCode:l,inBuilder:i}=e;return i?r.jsxs("div",{className:"relative",...o,children:[i?r.jsx("div",{...t,className:"absolute z-20 h-full w-full"}):null,b.createElement("div",{...t,dangerouslySetInnerHTML:{__html:l.replace(/<script.*?>.*?<\/script>/g,"")}})]}):b.createElement("div",{...o,...t,dangerouslySetInnerHTML:{__html:l}})},A={type:"CustomHTML",description:"similar to a div or section elements in HTML",label:"Custom HTML",category:"core",icon:m.CodeIcon,group:"advanced",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),htmlCode:{type:"string",default:"<div><p>Enter your HTML code here...</p></div>",ui:{"ui:widget":"code"}}}}),i18nProps:["htmlCode"]},M=e=>{const{scripts:o,inBuilder:t,blockProps:l}=e;return t?r.jsx("div",{...l,children:r.jsx("div",{className:B.cn("pointer-events-none flex flex-col items-center justify-center p-2",""),children:r.jsx("div",{className:"h-full w-full rounded bg-gray-200 p-1 dark:bg-gray-800",children:r.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"})})})}):r.jsx("div",{dangerouslySetInnerHTML:{__html:o}})},H={type:"CustomScript",description:"similar to a script element in HTML",label:"Custom Script",category:"core",icon:m.CodeIcon,hidden:!0,group:"advanced",...a.registerChaiBlockSchema({properties:{scripts:{type:"string",title:"Script",default:"",format:"code",placeholder:"<script>console.log('Hello, world!');<\/script>"}}})},$=e=>{const{blockProps:o,inBuilder:t,children:l,globalBlock:i}=e;return t&&!i?r.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:[r.jsxs("h1",{children:["Global Block - ",i]}),r.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):b.createElement("span",{...o},l)},D={type:"GlobalBlock",description:"A global block component",label:"Global Block",icon:m.FrameIcon,category:"core",group:"basic",hidden:!0,...a.registerChaiBlockSchema({properties:{globalBlock:{type:"string",title:"Global Block",default:"",ui:{"ui:widget":"hidden"}}}})},v=(e,...o)=>({...e,className:B.cn(e.className,...o)}),V=e=>{const{blockProps:o,icon:t,styles:l,width:i,inBuilder:s,height:n}=e,c=v(l,"");if(u.isEmpty(t))return r.jsx(C,{inBuilder:s,className:"h-8 w-14"});const p=t.replace(/<svg /g,'<svg class="w-[inherit] h-[inherit]" ');return b.createElement("span",{...o,...c,style:{width:i?`${i}px`:"auto",height:n?`${n}px`:"auto"},dangerouslySetInnerHTML:{__html:p}})},z={type:"Icon",label:"web_blocks.icon",category:"core",description:"Icon block is used to display an icon/svg.",icon:m.SketchLogoIcon,group:"media",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),icon:{type:"string",title:"Icon",default:'<svg xmlns="http://www.w3.org/2000/svg" class="chai-default-svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-diamond-icon lucide-diamond"><path d="M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z"/></svg>',ui:{"ui:widget":"icon"}},width:{type:"number",default:16,title:"Width"},height:{type:"number",default:16,title:"Height"}}})},U=e=>{const{blockProps:o,inBuilder:t,children:l,partialBlockId:i}=e;return t&&!i?r.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:[r.jsxs("h1",{children:["Partial Block - ",i]}),r.jsx("p",{children:"Choose a block from the sidebar to add it to this page."})]}):b.createElement("span",{...o},l)},F={type:"PartialBlock",description:"A partial block component. Partial blocks are global blocks that can be used in multiple pages.",label:"Partial Block",icon:m.FrameIcon,category:"core",group:"basic",hidden:!0,...a.registerChaiBlockSchema({properties:{partialBlockId:{type:"string",title:"Partial Block",default:"",ui:{"ui:widget":"hidden"}}}})},w={SMALL:{1:"col-span-1",2:"col-span-2",3:"col-span-3",4:"col-span-4",5:"col-span-5",6:"col-span-6",7:"col-span-7",8:"col-span-8",9:"col-span-9",10:"col-span-10",11:"col-span-11",12:"col-span-12"},MEDIUM:{1:"md:col-span-1",2:"md:col-span-2",3:"md:col-span-3",4:"md:col-span-4",5:"md:col-span-5",6:"md:col-span-6",7:"md:col-span-7",8:"md:col-span-8",9:"md:col-span-9",10:"md:col-span-10",11:"md:col-span-11",12:"md:col-span-12"},LARGE:{1:"lg:col-span-1",2:"lg:col-span-2",3:"lg:col-span-3",4:"lg:col-span-4",5:"lg:col-span-5",6:"lg:col-span-6",7:"lg:col-span-7",8:"lg:col-span-8",9:"lg:col-span-9",10:"lg:col-span-10",11:"lg:col-span-11",12:"lg:col-span-12"}},q=e=>{const{blockProps:o,children:t,styles:l,colSpan:i,tabletColSpan:s,desktopColSpan:n}=e,p={className:[u.get(l,"className",""),u.get(w,["SMALL",isNaN(i)||!i?6:i],""),s?u.get(w,["MEDIUM",s||i],""):"",n?u.get(w,["LARGE",s||i],""):""].join(" ")};return r.jsx("div",{...o,...l,...p,children:t||r.jsx("div",{className:"h-full min-h-12 w-full border-2 border-dashed border-gray-400 bg-gray-100 dark:bg-gray-900"})})},O={type:"Column",description:"A column component",label:"Column",group:"basic",category:"core",icon:m.LayoutIcon,wrapper:!0,hidden:!0,canDelete:()=>!0,canAcceptBlock:()=>!0,canBeNested:e=>e==="Row",...a.registerChaiBlockSchema({properties:{styles:a.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]}}})},Z=e=>{const{blockProps:o,children:t,styles:l,gutter:i}=e,n={className:[u.get(l,"className","")," grid grid-cols-12"].join()};return typeof(l==null?void 0:l.style)=="object"?l.style.gap=`${i}px`:n.style={gap:`${i}px`},r.jsx("div",{...o,...l,...n,children:t})},G={type:"Row",description:"A row component",label:"Row",group:"basic",icon:m.RowsIcon,hidden:!0,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",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),colCount:{type:"number",default:2,minimum:0,ui:{"ui:widget":"colCount"}},gutter:{type:"number",title:"Gutter (in px)",default:16,minimum:0}}})},W=e=>{const{blockProps:o,styles:t}=e;return x.createElement("hr",{...t,...o})},Y={type:"Divider",description:"A horizontal line component",label:"Divider",category:"core",icon:m.DividerHorizontalIcon,group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("bg-gray-900 h-0.5 py-2 my-1")}})},Q=e=>{const{blockProps:o,styles:t,backgroundImage:l}=e;let i={};return l&&(i={backgroundImage:`url(${l})`}),b.createElement("div",{...o,...t,style:i})},J={type:"EmptyBox",description:"A box component with no children",label:"Empty Box",category:"core",group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),backgroundImage:{type:"string",title:"Background Image",default:"",ui:{"ui:widget":"image","ui:allowEmpty":!0}}}})},X=e=>{const{blockProps:o,fieldName:t,label:l,styles:i,inputStyles:s,required:n,checked:c,showLabel:p=!0}=e;return p?r.jsxs("div",{...i,...o,children:[r.jsx("input",{...s,name:t,type:"checkbox",required:n,defaultChecked:c}),l&&r.jsx("label",{htmlFor:t,children:l})]}):r.jsx("input",{name:t,...o,...s,...i,type:"checkbox",required:n,defaultChecked:c})},K={type:"Checkbox",label:"web_blocks.checkbox",category:"core",icon:m.CheckboxIcon,group:"form",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("flex items-center gap-x-2"),inputStyles:a.StylesProp(""),fieldName:{type:"string",title:"Field Name",default:"fieldName"},label:{type:"string",title:"Label",default:"Label"},checked:{type:"boolean",title:"Checked",default:!1},required:{type:"boolean",title:"Required",default:!1},showLabel:{type:"boolean",title:"Show Label",default:!0}}}),aiProps:["label"],i18nProps:["label"]},ee=e=>{const{children:o,blockProps:t,errorMessage:l,successMessage:i,action:s,styles:n,inBuilder:c}=e;let p=o;o||(p=r.jsx(C,{inBuilder:c}));const g={"x-data":"{}","x-on:submit.prevent":"post"},h={"x-html":"",":class":"{'text-red-500': formStatus === 'ERROR', 'text-green-500': formStatus === 'SUCCESS'}"};return r.jsxs("form",{...g,"data-error":l,"data-success":i,method:"post",action:s,...t,...n,children:[r.jsx("div",{...h}),p]})},te={type:"Form",label:"Form",category:"core",icon:m.FileTextIcon,group:"form",blocks:()=>[{_type:"Form",_id:"form",styles:"#styles:p-1 space-y-2,"},{_type:"Input",_id:"form_input",_parent:"form",styles:"#styles:,"},{_type:"FormButton",_id:"form_submit_btn",_parent:"form",styles:"#styles:bg-black text-white rounded px-3 py-1,"}],...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),action:{type:"string",title:"Submit URL",default:"/api/form"},errorMessage:{type:"string",title:"Error Message",default:"Something went wrong. Please try again",ui:{"ui:widget":"richtext"}},successMessage:{type:"string",title:"Success Message",default:"Thank you for your submission.",ui:{"ui:widget":"richtext"}}}}),i18nProps:["errorMessage","successMessage"],aiProps:["errorMessage","successMessage"],canAcceptBlock:()=>!0},oe=e=>{const{blockProps:o,inBuilder:t,label:l,styles:i,icon:s,iconSize:n,iconPos:c}=e;return r.jsxs("button",{...i,...o||{},type:t?"button":"submit","aria-label":l,children:[l,s&&r.jsx("div",{style:{width:n+"px"},className:c+" "+(c==="order-first"?"mr-2":"ml-2")||"",dangerouslySetInnerHTML:{__html:s}})]})},le={type:"FormButton",label:"Submit Button",category:"core",icon:m.ButtonIcon,group:"form",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("text-white bg-primary disabled:bg-gray-400 px-4 py-2 rounded-global flex items-center gap-x-2"),label:{type:"string",title:"Label",default:"Submit",ai:!0,i18n:!0},icon:{type:"string",title:"Icon",default:"",ui:{"ui:widget":"icon"}},iconSize:{type:"number",title:"Icon size",default:24},iconPos:{type:"string",title:"Icon Position",default:"order-last",enum:["order-first","order-last"]}}}),i18nProps:["label"],aiProps:["label"]},re=e=>{const o={type:"text",autocomplete:"on"};return e?["text","password","number","hidden","range","color","date","time"].includes(e)?{type:e,autocomplete:"on"}:e==="email"?{type:"email",autocomplete:"email"}:e==="tel"?{type:"tel",autocomplete:"tel"}:e==="url"?{type:"url",autocomplete:"url"}:{off:{type:"text",autocomplete:"off"},on:{type:"text",autocomplete:"on"},name:{type:"text",autocomplete:"name"},"honorific-prefix":{type:"text",autocomplete:"honorific-prefix"},"given-name":{type:"text",autocomplete:"given-name"},"additional-name":{type:"text",autocomplete:"additional-name"},"family-name":{type:"text",autocomplete:"family-name"},"honorific-suffix":{type:"text",autocomplete:"honorific-suffix"},nickname:{type:"text",autocomplete:"nickname"},firstName:{type:"text",autocomplete:"given-name"},lastName:{type:"text",autocomplete:"family-name"},email:{type:"email",autocomplete:"email"},tel:{type:"tel",autocomplete:"tel"},"tel-country-code":{type:"tel",autocomplete:"tel-country-code"},"tel-national":{type:"tel",autocomplete:"tel-national"},"tel-area-code":{type:"tel",autocomplete:"tel-area-code"},"tel-local":{type:"tel",autocomplete:"tel-local"},"tel-extension":{type:"tel",autocomplete:"tel-extension"},"street-address":{type:"text",autocomplete:"street-address"},"address-line1":{type:"text",autocomplete:"address-line1"},"address-line2":{type:"text",autocomplete:"address-line2"},"address-line3":{type:"text",autocomplete:"address-line3"},"address-level1":{type:"text",autocomplete:"address-level1"},"address-level2":{type:"text",autocomplete:"address-level2"},"address-level3":{type:"text",autocomplete:"address-level3"},"address-level4":{type:"text",autocomplete:"address-level4"},country:{type:"text",autocomplete:"country"},"country-name":{type:"text",autocomplete:"country-name"},"postal-code":{type:"text",autocomplete:"postal-code"},"cc-name":{type:"text",autocomplete:"cc-name"},"cc-given-name":{type:"text",autocomplete:"cc-given-name"},"cc-additional-name":{type:"text",autocomplete:"cc-additional-name"},"cc-family-name":{type:"text",autocomplete:"cc-family-name"},"cc-number":{type:"text",autocomplete:"cc-number"},"cc-exp":{type:"text",autocomplete:"cc-exp"},"cc-exp-month":{type:"number",autocomplete:"cc-exp-month"},"cc-exp-year":{type:"number",autocomplete:"cc-exp-year"},"cc-csc":{type:"text",autocomplete:"cc-csc"},"cc-type":{type:"text",autocomplete:"cc-type"},bday:{type:"date",autocomplete:"bday"},"bday-day":{type:"number",autocomplete:"bday-day"},"bday-month":{type:"number",autocomplete:"bday-month"},"bday-year":{type:"number",autocomplete:"bday-year"},username:{type:"text",autocomplete:"username"},"new-password":{type:"password",autocomplete:"new-password"},"current-password":{type:"password",autocomplete:"current-password"},"one-time-code":{type:"text",autocomplete:"one-time-code"},"transaction-currency":{type:"text",autocomplete:"transaction-currency"},"transaction-amount":{type:"number",autocomplete:"transaction-amount"},url:{type:"url",autocomplete:"url"},photo:{type:"url",autocomplete:"photo"},sex:{type:"text",autocomplete:"sex"},"organization-title":{type:"text",autocomplete:"organization-title"},organization:{type:"text",autocomplete:"organization"},language:{type:"text",autocomplete:"language"}}[e]||o:o},ie=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:i,styles:s,inputStyles:n,showLabel:c,required:p,inputType:g,defaultValue:h}=e,{type:k,autocomplete:f}=re(g);return c?r.jsxs("div",{...s,...o,children:[c&&r.jsx("label",{htmlFor:t,children:l}),r.jsx("input",{name:t,defaultValue:h,...n,type:k,placeholder:i,required:p,autoComplete:f})]}):r.jsx("input",{name:t,...o,...n,...s,type:k,placeholder:i,required:p,autoComplete:f,defaultValue:h})},se={type:"Input",label:"web_blocks.input",category:"core",icon:m.InputIcon,group:"form",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),inputStyles:a.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},inputType:{type:"string",title:"Type",default:"email",oneOf:[{const:"text",title:"Text"},{const:"email",title:"Email"},{const:"password",title:"Password"},{const:"number",title:"Number"},{const:"tel",title:"Telephone"},{const:"hidden",title:"Hidden"},{const:"range",title:"Range"},{const:"color",title:"Color"},{const:"date",title:"Date"},{const:"time",title:"Time"},{const:"url",title:"URL"},{const:"name",title:"Name"},{const:"firstName",title:"First Name"},{const:"lastName",title:"Last Name"},{const:"tel-country-code",title:"Telephone Country Code"},{const:"tel-national",title:"Telephone National"},{const:"tel-area-code",title:"Telephone Area Code"},{const:"tel-local",title:"Telephone Local"},{const:"tel-extension",title:"Telephone Extension"},{const:"street-address",title:"Street Address"},{const:"address-line1",title:"Address Line 1"},{const:"address-line2",title:"Address Line 2"},{const:"address-line3",title:"Address Line 3"},{const:"address-level1",title:"Address Level 1"},{const:"address-level2",title:"Address Level 2"},{const:"address-level3",title:"Address Level 3"},{const:"address-level4",title:"Address Level 4"},{const:"country",title:"Country"},{const:"country-name",title:"Country Name"},{const:"postal-code",title:"Postal Code"},{const:"cc-name",title:"Credit Card Name"},{const:"cc-number",title:"Credit Card Number"},{const:"cc-exp",title:"Credit Card Expiry"},{const:"cc-exp-month",title:"Credit Card Expiry Month"},{const:"cc-exp-year",title:"Credit Card Expiry Year"},{const:"cc-csc",title:"Credit Card CSC"},{const:"cc-type",title:"Credit Card Type"},{const:"bday",title:"Birthday"},{const:"bday-day",title:"Birthday Day"},{const:"bday-month",title:"Birthday Month"},{const:"bday-year",title:"Birthday Year"},{const:"username",title:"Username"},{const:"new-password",title:"New Password"},{const:"current-password",title:"Current Password"},{const:"one-time-code",title:"One Time Code"},{const:"transaction-currency",title:"Transaction Currency"},{const:"transaction-amount",title:"Transaction Amount"},{const:"url",title:"URL"},{const:"photo",title:"Photo"},{const:"sex",title:"Sex"},{const:"organization-title",title:"Organization Title"},{const:"organization",title:"Organization"},{const:"language",title:"Language"}]},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ai:!0,i18n:!0},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ae=e=>{const{blockProps:o,content:t,styles:l,children:i}=e,s={...l,...o};return i?b.createElement("label",s,i):b.createElement("label",{...s,dangerouslySetInnerHTML:{__html:t}})},ne={type:"Label",label:"Label",category:"core",icon:m.LetterCaseToggleIcon,group:"form",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(),content:{type:"string",title:"Content",default:""}}}),aiProps:["content"],i18nProps:["content"]},ce=e=>{const{blockProps:o,fieldName:t,label:l,styles:i,inputStyles:s,required:n,checked:c,showLabel:p=!0}=e;return p?r.jsxs("div",{...i,...o,children:[r.jsx("input",{...s,name:t,type:"radio",required:n,defaultChecked:c}),l&&r.jsx("label",{htmlFor:t,children:l})]}):r.jsx("input",{name:t,...o,...s,...i,type:"radio",required:n,checked:c})},pe={type:"Radio",label:"web_blocks.radio",category:"core",icon:m.RadiobuttonIcon,group:"form",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("flex items-center gap-x-2"),inputStyles:a.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"]},de=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:i,styles:s,inputStyles:n,required:c,showLabel:p,_multiple:g,options:h,defaultValue:k}=e,f=g&&k?k.split(",").map(y=>y.trim()):k||"";return p?r.jsxs("div",{...s,...o,children:[p&&r.jsx("label",{htmlFor:t,children:l}),r.jsxs("select",{...n,required:c,multiple:g,name:t,defaultValue:f,children:[r.jsx("option",{value:"",disabled:!0,hidden:!0,children:i}),u.map(h,y=>r.jsx("option",{value:y==null?void 0:y.value,children:y==null?void 0:y.label},y==null?void 0:y.value))]})]}):r.jsxs("select",{...s,...o,required:c,multiple:g,name:t,defaultValue:f,children:[r.jsx("option",{value:"",disabled:!0,hidden:!0,children:i}),u.map(h,y=>r.jsx("option",{value:y==null?void 0:y.value,children:y==null?void 0:y.label},y==null?void 0:y.value))]})},ue={type:"Select",label:"web_blocks.select",category:"core",icon:m.DropdownMenuIcon,group:"form",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),inputStyles:a.StylesProp("w-full p-1"),fieldName:{type:"string",title:"Field Name",default:"fieldName"},showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label"},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:""},_multiple:{type:"boolean",title:"Multiple",default:!1},options:{title:"Options",type:"array",default:[],items:{type:"object",properties:{label:{type:"string",title:"Label",default:""},value:{type:"string",title:"Value",default:""}}}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},me=e=>{const{blockProps:o,fieldName:t,label:l,placeholder:i,styles:s,inputStyles:n,rows:c,showLabel:p,required:g,defaultValue:h}=e;return p?r.jsxs("div",{...s,...o,children:[p&&r.jsx("label",{htmlFor:t,children:l}),r.jsx("textarea",{name:t,...n,placeholder:i,rows:c,required:g,defaultValue:h})]}):r.jsx("textarea",{name:t,...o,...n,...s,placeholder:i,rows:c,required:g,defaultValue:h})},ye={type:"TextArea",label:"web_blocks.textarea",category:"core",icon:m.InputIcon,group:"form",...a.registerChaiBlockSchema({properties:{fieldName:{type:"string",title:"Field Name",default:"fieldName"},styles:a.StylesProp(""),inputStyles:a.StylesProp("w-full p-1"),showLabel:{type:"boolean",title:"Show Label",default:!0},label:{type:"string",title:"Label",default:"Label",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}},placeholder:{type:"string",title:"Placeholder",default:"Placeholder"},rows:{type:"number",title:"Rows",default:3},required:{type:"boolean",title:"Required",default:!1},defaultValue:{type:"string",title:"Default Value",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["label","placeholder"],i18nProps:["label","placeholder"]},ge=e=>{const{blockProps:o,styles:t,content:l,tag:i="h1",children:s=null}=e;return s?b.createElement(i,{...t,...o},s):b.createElement(i,{...t,...o,dangerouslySetInnerHTML:{__html:l}})},he={type:"Heading",description:"A heading component similar to h1, h2, h3, h4, h5, h6 elements in HTML",label:"Heading",category:"core",icon:m.HeadingIcon,group:"typography",...a.registerChaiBlockSchema({properties:{tag:{type:"string",default:"h2",title:"Level",enum:["h1","h2","h3","h4","h5","h6"]},styles:a.StylesProp("text-3xl"),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea","ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},be=e=>{const{blockProps:o,styles:t}=e;return x.createElement("br",{...o,...t})},fe={type:"LineBreak",label:"Line Break",category:"core",group:"basic",hidden:!0,...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},xe=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("table",{...o,...l},t):r.jsx(C,{})},ke=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("thead",{...o,...l},t):r.jsx(C,{})},Ce=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("tbody",{...o,...l},t):r.jsx(C,{})},Be=e=>{const{blockProps:o,children:t,styles:l}=e;return t?x.createElement("tr",{...o,...l},t):r.jsx(C,{})},Se=e=>{const{blockProps:o,children:t,content:l,styles:i}=e;return!t&&u.isEmpty(l)?r.jsx(C,{}):t?x.createElement("td",{...o,...i},t):x.createElement("td",{...o,...i,dangerouslySetInnerHTML:{__html:l}})};d.registerChaiBlock(xe,{type:"Table",label:"Table",category:"core",group:"table",hidden:!0,icon:m.TableIcon,...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("")}}),blocks:S("Table")});d.registerChaiBlock(ke,{type:"TableHead",label:"Table Head",category:"core",group:"table",hidden:!0,icon:m.BorderTopIcon,...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("")}}),blocks:S("TableHead")});d.registerChaiBlock(Ce,{type:"TableBody",label:"Table Body",category:"core",group:"table",hidden:!0,icon:m.BorderAllIcon,...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("")}}),blocks:S("TableBody")});d.registerChaiBlock(Be,{type:"TableRow",label:"Table Row",category:"core",group:"table",hidden:!0,icon:m.ViewHorizontalIcon,...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("")}}),blocks:S("TableRow")});d.registerChaiBlock(Se,{type:"TableCell",label:"Table Cell",category:"core",group:"table",hidden:!0,icon:m.DragHandleHorizontalIcon,...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),content:{type:"string",default:"Heading goes here",title:"Content",ui:{"ui:widget":"textarea"}}}}),blocks:S("TableCell"),i18nProps:["content"],aiProps:["content"]});function S(e){const o=(s,n)=>({_id:B.generateUUID(),_parent:s,_type:"TableCell",styles:"#styles:,",content:`${e==="TableHead"?"Table Head":"Table Cell "+n}`}),t=s=>{const n=B.generateUUID(),c={_type:"TableRow",_id:n,styles:"#styles:,border-b"};return s&&(c._parent=s),[c,o(n,"1"),o(n,"2"),o(n,"3")]},l=s=>{const n=B.generateUUID(),c={_id:n,_type:"TableHead",styles:"#styles:,font-medium"};return s&&(c._parent=s),[c,...t(n)]},i=s=>{const n=B.generateUUID(),c={_id:n,_type:"TableBody",styles:"#styles:,"};return s&&(c._parent=s),[c,...t(n),...t(n)]};if(e==="Table"){const s=B.generateUUID();return[{_id:s,_type:"Table",styles:"#styles:,w-full text-left text-gray-500 dark:text-gray-400"},...l(s),...i(s)]}return e==="TableRow"?t():e==="TableHead"?l():e==="TableBody"?i():[]}const we="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTAwIiBoZWlnaHQ9IjQwMCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWxsPSIjZjNmNGY2Ii8+PHRleHQgeD0iNTAlIiB5PSI1MCUiIGZvbnQtZmFtaWx5PSJBcmlhbCwgc2Fucy1zZXJpZiIgZm9udC1zaXplPSIxNiIgZmlsbD0iI2Q1ZDdkYSIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZHk9Ii4zZW0iPkltYWdlIFBsYWNlaG9sZGVyPC90ZXh0Pjwvc3ZnPg==",Pe=e=>{const{blockProps:o,image:t,mobileImage:l,styles:i,alt:s,height:n,width:c,lazyLoading:p,mobileWidth:g,mobileHeight:h}=e;return u.isEmpty(t)?r.jsx(C,{className:"h-36"}):r.jsxs("picture",{children:[l&&r.jsx("source",{srcSet:l,media:"(max-width: 480px)",width:g,height:h}),r.jsx("img",{...o,...i,src:t,alt:s,loading:p?"lazy":"eager",width:c,height:n})]})},ve={type:"Image",description:"A image component",label:"Image",category:"core",icon:m.ImageIcon,group:"media",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("w-full h-full object-cover"),image:{type:"string",title:"Image",default:we,ui:{"ui:widget":"image"}},width:{type:"string",title:"Width",default:"",ui:{"ui:placeholder":"Enter width"}},height:{type:"string",title:"Height",default:"",ui:{"ui:placeholder":"Enter height"}},mobileImage:{type:"string",title:"Mobile Image",default:"",ui:{"ui:widget":"image"}},mobileWidth:{type:"string",title:"Mobile Width",default:"",ui:{"ui:placeholder":"Enter width"}},mobileHeight:{type:"string",title:"Mobile Height",default:"",ui:{"ui:placeholder":"Enter height"}},alt:{type:"string",title:"Alt text",default:"",ui:{"ui:placeholder":"Enter alt text"}},lazyLoading:{type:"boolean",title:"Lazy Load",default:!0}}}),aiProps:["alt"],i18nProps:["alt","image","_imageId","mobileImage","_mobileImageId"]},Ie=e=>{const{blockProps:o,link:t,children:l,styles:i,inBuilder:s,content:n}=e;let c={};return!l&&u.isEmpty(n)&&(c={minHeight:"50px",display:"flex",alignItems:"center",justifyContent:"center"}),s?l?r.jsx("span",{role:"link",...o,style:c,...i,children:l}):x.createElement("span",{...o,...i,style:c,role:"link"},n):l?r.jsx("a",{"aria-label":n,href:(t==null?void 0:t.href)||"#/",target:t==null?void 0:t.target,...o,...i,children:l}):x.createElement("a",{...o,...i,href:(t==null?void 0:t.href)||"#",target:(t==null?void 0:t.target)||"_self","aria-label":n},n)},je={type:"Link",description:"A link component",label:"Link",category:"core",icon:m.Link1Icon,group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("block"),content:{type:"string",default:"Link text goes here",title:"Content"},link:{type:"object",properties:{type:{type:"string"},href:{type:"string"},target:{type:"string"}},default:{type:"url",href:"",target:"_self"},ui:{"ui:field":"link"}},prefetchLink:{type:"boolean",default:!1,title:"Prefetch Link"}}}),aiProps:["content"],i18nProps:["content","link"],canAcceptBlock:e=>e!=="Link"},Le=e=>{const{blockProps:o,children:t,styles:l,tag:i,inBuilder:s}=e;return!t&&u.isEmpty(l==null?void 0:l.className)?r.jsx(C,{inBuilder:s}):b.createElement(i||"ul",{...o,...l},t)},_e={type:"List",description:"A list component",label:"List",icon:m.RowsIcon,category:"core",group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("")}}),canAcceptBlock:e=>e==="ListItem",blocks:[{_type:"List",_id:"a",styles:"#styles:,"},{_type:"ListItem",_id:"b",_parent:"a",styles:"#styles:,",content:"Item 1"},{_type:"ListItem",_id:"c",_parent:"a",styles:"#styles:,",content:"Item 2"},{_type:"ListItem",_id:"d",_parent:"a",styles:"#styles:,",content:"Item 3"}]},Ne=e=>{const{blockProps:o,content:t,styles:l,children:i,tag:s}=e;return i?b.createElement(s||"li",{...l,...o},i):b.createElement(s||"li",{...l,...o,dangerouslySetInnerHTML:{__html:t}})},Te={type:"ListItem",description:"A list item component",label:"List Item",icon:m.ColumnsIcon,category:"core",group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),content:{type:"string",default:"List item",title:"Content",ui:{"ui:widget":"textarea"}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e!=="ListItem",canBeNested:e=>e==="List"||e==="Repeater"},Ee=e=>{const{blockProps:o,styles:t,content:l}=e;if(!u.isNull(e.children))return b.createElement("p",{...t,...o},e.children);const i=v(t,"rte");return b.createElement("div",{...i,...o,dangerouslySetInnerHTML:{__html:l}})},Re={type:"Paragraph",description:"A paragraph component",label:"Paragraph",category:"core",icon:m.TextIcon,group:"typography",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),content:{type:"string",title:"Content",default:"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse varius enim in eros elementum tristique. Duis cursus, mi quis viverra ornare, eros dolor interdum nulla, ut commodo diam libero vitae erat. Aenean faucibus nibh et justo cursus id rutrum lorem imperdiet. Nunc ut sem vitae risus tristique posuere.",ui:{"ui:widget":"richtext","ui:autosize":!0,"ui:rows":5}}}}),i18nProps:["content"],aiProps:["content"],canAcceptBlock:e=>e==="Span"||e==="Link"||e==="Text"},Ae=e=>{const{blockProps:o,content:t,styles:l}=e,i=v(l,"rte");return r.jsx("div",{...o,...i,dangerouslySetInnerHTML:{__html:t}})},Me={type:"RichText",description:"A rich text block",label:"Rich Text",hidden:!0,category:"core",icon:m.CursorTextIcon,group:"typography",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),content:{type:"string",title:"Content",default:"<p>This is a rich text block. You can add text, and other content here.</p>",ui:{"ui:widget":"richtext"}}}}),aiProps:["content"],i18nProps:["content"]},He=e=>{const{blockProps:o,styles:t,content:l,children:i=null,tag:s}=e;return i?b.createElement("span",{...t,...o},i):b.createElement(s||"span",{...t,...o,dangerouslySetInnerHTML:{__html:l||""}})},$e={type:"Span",description:"A span component",label:"Span",category:"core",group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp(""),content:{type:"string",title:"Content",default:"",ui:{"ui:widget":"textarea","ui:autosize":!0,"ui:rows":3}}}}),aiProps:["content"],i18nProps:["content"],canAcceptBlock:()=>!0},De=e=>e.inBuilder||e.forceWrapper?r.jsx("span",{...e.blockProps,children:e.content}):`${e.content}`,Ve={type:"Text",description:"A text component with no styling",label:"Text",category:"core",group:"typography",blocks:()=>[{_id:"a",_type:"Text",_name:"Text",content:""}],icon:m.SpaceBetweenVerticallyIcon,...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("text-black"),content:{title:"Content",type:"string",default:""}}}),aiProps:["content"],i18nProps:["content"]},P={type:"object",title:"Controls",default:{autoplay:!0,controls:!1,loop:!0,muted:!0},properties:{autoplay:{type:"boolean",title:"Autoplay",default:!1},controls:{type:"boolean",title:"Show Controls",default:!0},loop:{type:"boolean",title:"Loop Video",default:!1},muted:{type:"boolean",title:"Muted",default:!1}}},I=/^(https?:\/\/)?(www\.)?youtube\.com\/(watch\?v=|embed\/)([a-zA-Z0-9_-]{11})/,j=/(?:https?:\/\/)?(?:www\.)?(?:vimeo\.com\/(?:channels\/[\w]+\/|groups\/[^\/]+\/videos\/|album\/\d+\/video\/|video\/)?|player\.vimeo\.com\/video\/)(\d+)/,ze=(e,o)=>{const t=u.get(o,"autoplay",!1),l=u.get(o,"controls",!1),i=u.get(o,"loop",!1),s=t||u.get(o,"muted",!0);if(I.test(e)){const n=e.match(I);if(n){const c=n[4];let p=`https://www.youtube.com/embed/${c}`,g=t?"autoplay=1":"";return g+=i?`&loop=1&playlist=${c}`:"",g+=s?"&mute=1&muted=1":"",g+=l?"&controls=1":"&controls=0",`${p}?${g}`}}if(j.test(e)){const n=e.match(j);if(n){const c=n[1];let p="";return p+=t?"autoplay=1":"",p+=l?"&controls=1":"&controls=0",p+=s?"&muted=1":"",p+=i?"&loop=1":"",`https://player.vimeo.com/video/${c}?${p}`}}return null},Ue=e=>{const{url:o,blockProps:t,styles:l,controls:i,videoSource:s,inBuilder:n,title:c}=e,p=ze(o,i);return r.jsxs("div",{...u.omit(l,"className"),className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:[!p&&n?r.jsx("div",{className:"absolute flex h-full w-full items-center justify-center bg-gray-300 text-center",children:u.isEmpty(o)?`Provided ${s} video link in settings Video URL.`:`Provided ${s} video link is invalid.`}):r.jsx("iframe",{width:"100%",src:p,title:c||"Video player",...u.pick(l,"className")}),n&&r.jsx("div",{...t,className:"absolute top-0 h-full w-full"})]})},Fe=e=>{const{url:o,styles:t,controls:l,sources:i,poster:s,blockProps:n,title:c}=e;let p=s;const g=[...u.get(i,"srcsets",[])||[]];o&&typeof o=="string"&&g.push({url:o,width:"9999"});const h=g.sort((f,y)=>parseInt(f.width)-parseInt(y.width)).filter(f=>!u.isEmpty(f.url)&&!u.isEmpty(f.width));h.length===0&&!p&&(p="https://placehold.co/300x200/EEE/ccc?text=Choose%20Video");const k=u.get(l,"autoplay",!1)||u.get(l,"muted",!0);return(p||!u.isEmpty(h))&&r.jsx("div",{className:"relative w-full overflow-hidden",style:{paddingBottom:"56.25%"},children:x.createElement("video",{...t,...n,title:c||"Video player",key:JSON.stringify(h),controls:u.get(l,"controls",!1),autoPlay:u.get(l,"autoplay",!1),loop:u.get(l,"loop",!1),poster:p,...k?{muted:!0}:{}},h.map(f=>{if(!f.url||f.url.length<4||isNaN(f.width))return null;const y=`(max-width: ${f.width}px)`;return r.jsx("source",{src:f.url,media:y,type:f.type},f.url)}),"Your browser does not support the video tag.")})},qe=e=>{const{videoSource:o}=e;return o==="Custom"?r.jsx(Fe,{...e}):o==="Youtube"||o==="Vimeo"?r.jsx(Ue,{...e}):r.jsxs("div",{children:["Invalid video source : ",o]})},Oe={type:"Video",label:"Video",category:"core",icon:m.VideoIcon,group:"media",...a.registerChaiBlockSchema({properties:{styles:a.StylesProp("absolute h-full w-full object-cover"),videoSource:{type:"string",default:"Custom",enum:["Custom","Youtube","Vimeo"],title:"Video source"},title:{type:"string",title:"Video Title",default:"Video player"}},allOf:[{if:{properties:{videoSource:{const:"Custom"}}},then:{properties:{url:{type:"string",title:"Video URL",default:""},poster:{type:"string",title:"Poster URL",default:""},sources:{type:"object",default:{srcsets:[]}},controls:{...P}}}},{if:{properties:{videoSource:{const:"Youtube"}}},then:{properties:{url:{type:"string",title:"Youtube Video URL",default:""},controls:{...P}}}},{if:{properties:{videoSource:{const:"Vimeo"}}},then:{properties:{url:{type:"string",title:"Vimeo Video URL",default:""},controls:{...P}}}}],ui:{url:{"ui:placeholder":"Enter Video URL"},sources:{"ui:field":"sources"},poster:{"ui:placeholder":"Enter poster URL"}}}),i18nProps:["url","title"]},Ze=e=>{const{paginationStyles:o}=e,t=d.getRegisteredChaiBlock("Pagination");return r.jsx("div",{...o,children:t?b.createElement(t.component,{...u.omit(e,["paginationStyles"]),blockProps:{}}):r.jsxs(r.Fragment,{children:[r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50 disabled:cursor-not-allowed disabled:opacity-50",disabled:!0,children:r.jsx(m.ChevronLeftIcon,{className:"h-4 w-4"})}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-blue-500 bg-blue-500 font-medium text-white",children:"1"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"2"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"3"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"4"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white font-medium text-gray-700 hover:bg-gray-50",children:"5"}),r.jsx("button",{className:"flex h-9 w-9 items-center justify-center rounded-md border border-gray-300 bg-white hover:bg-gray-50",children:r.jsx(m.ChevronRightIcon,{className:"h-4 w-4"})})]})})},Ge=e=>{const{children:o,tag:t,styles:l,blockProps:i,$loading:s}=e,{pagination:n,inBuilder:c}=e;let p=o;return u.isEmpty(p)&&c&&(p=r.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Choose a collection to display items"})),t==="none"?s&&c?Array.from({length:2}).map((g,h)=>r.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[r.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),r.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},h)):p:r.jsxs(r.Fragment,{children:[b.createElement(t,{...i,...l},s&&c?Array.from({length:2}).map((g,h)=>r.jsxs("div",{className:"animate-pulse rounded-md bg-primary/10 p-5",children:[r.jsx("div",{className:"h-6 w-1/2 rounded-md bg-primary/10"}),r.jsx("div",{className:"mt-2 h-4 w-1/2 rounded-md bg-primary/10"})]},h)):p),n&&r.jsx(Ze,{...u.pick(e,["limit","totalItems","paginationStrategy","inBuilder","draft","lang","paginationStyles"])})]})},We={type:"Repeater",label:"Repeater",icon:m.LoopIcon,group:"basic",description:"Repeater block is used to display a list of items based on data binding in repeaterItems",dataProviderMode:"live",dataProviderDependencies:["filter","sort","limit","repeaterItems"],blocks:()=>[{_id:"A",_type:"Repeater",tag:"ul"},{_id:"B",_name:"Repeater Item",_type:"RepeaterItem",parentTag:"ul",_parent:"A"}],...a.registerChaiBlockSchema({properties:{styles:a.stylesProp("grid gap-4 md:grid-cols-2 xl:grid-cols-3"),paginationStyles:a.stylesProp("flex items-center justify-center gap-2 p-4"),repeaterItems:{title:"Collection",type:"string",binding:"array",default:"",ui:{"ui:widget":"repeaterBinding","ui:readonly":!0}},tag:{title:"Tag",type:"string",default:"ul",enum:["none","div","ul","ol"]},filter:{title:"Filter by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},sort:{title:"Sort by",type:"string",default:"",ui:{"ui:widget":"collectionSelect"}},pagination:{title:"Pagination",type:"boolean",default:!1}},allOf:[{if:{properties:{pagination:{const:!0}}},then:{properties:{paginationStrategy:{type:"string",title:"Pagination Strategy",default:"segment",enum:["query","segment"],enumNames:["Query(/items?page=1)","Segment(/items/1)"]},limit:{type:"number",title:"Items Per Page",default:10,minimum:1}}}},{if:{properties:{pagination:{const:!1}}},then:{properties:{limit:{type:"number",title:"Max items",default:10,minimum:1}}}}]}),canAcceptBlock:e=>e==="Pagination"},Ye=({children:e,blockProps:o,styles:t,parentTag:l,inBuilder:i})=>{let s="li";switch(l){case"ul":s="li";break;case"ol":s="li";break;default:s="div"}return!e&&i?b.createElement(s,{...o,...t},r.jsx("div",{className:"col-span-3 flex items-center justify-center bg-orange-50 p-5 text-sm text-muted-foreground",children:"Add children to repeater item"})):b.createElement(s,{...o,...t},e)},Qe={type:"RepeaterItem",label:"Repeater Item",icon:m.LoopIcon,hidden:!0,group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.stylesProp(""),parentTag:d.closestBlockProp("Repeater","tag")}}),canAcceptBlock:e=>e!=="RepeaterItem",canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Je=({children:e,blockProps:o,styles:t})=>b.createElement("div",{...o,...t},e),Xe={type:"RepeaterEmptyState",label:"Empty State",hidden:!0,group:"basic",...a.registerChaiBlockSchema({properties:{styles:a.stylesProp("p-5 flex items-center justify-center")}}),canAcceptBlock:()=>!0,canDelete:()=>!1,canMove:()=>!1,canDuplicate:()=>!1},Ke=()=>{d.registerChaiBlock(_,N),d.registerChaiBlock(Q,J),d.registerChaiBlock(T,E),d.registerChaiBlock(ge,he),d.registerChaiBlock(Ee,Re),d.registerChaiBlock(He,$e),d.registerChaiBlock(Ae,Me),d.registerChaiBlock(Ie,je),d.registerChaiBlock(Le,_e),d.registerChaiBlock(Ne,Te),d.registerChaiBlock(V,z),d.registerChaiBlock(Pe,ve),d.registerChaiBlock(qe,Oe),d.registerChaiBlock(R,A),d.registerChaiBlock(M,H),d.registerChaiBlock(De,Ve),d.registerChaiBlock(ee,te),d.registerChaiBlock(oe,le),d.registerChaiBlock(ie,se),d.registerChaiBlock(X,K),d.registerChaiBlock(ce,pe),d.registerChaiBlock(de,ue),d.registerChaiBlock(me,ye),d.registerChaiBlock(ae,ne),d.registerChaiBlock(be,fe),d.registerChaiBlock(W,Y),d.registerChaiBlock($,D),d.registerChaiBlock(U,F),d.registerChaiBlock(Z,G),d.registerChaiBlock(q,O),d.registerChaiBlock(Ge,We),d.registerChaiBlock(Ye,Qe),d.registerChaiBlock(Je,Xe)};exports.loadWebBlocks=Ke;
@@ -1,9 +1,3 @@
1
1
  export declare const loadWebBlocks: () => void;
2
2
 
3
3
  export { }
4
-
5
- declare global {
6
- interface Window {
7
- clarity: any;
8
- }
9
- }