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

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 (186) hide show
  1. package/dist/{2SSKDMRQ-BnsZi3K3.cjs → 2SSKDMRQ-CopJgtZb.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-CnSDkQcy.js → 2SSKDMRQ-Difo_1pg.js} +2 -2
  3. package/dist/{AP7HFJJL-CymCmW14.js → AP7HFJJL-BPuPBqj4.js} +1 -1
  4. package/dist/{AP7HFJJL-B31839PG.cjs → AP7HFJJL-DYxDgaOs.cjs} +1 -1
  5. package/dist/{IconPicker-B1rWC-Ex.js → IconPicker-B2-oriq2.js} +8 -7
  6. package/dist/IconPicker-C0oycHbs.cjs +1 -0
  7. package/dist/{WDYDFRGG-BxhOCHc3.cjs → WDYDFRGG-DbejaRPK.cjs} +1 -1
  8. package/dist/{WDYDFRGG-BUVnbAci.js → WDYDFRGG-KK8pkcW1.js} +2 -2
  9. package/dist/{actions-registery-YnFmU21O.cjs → actions-registery-JdxhXhT6.cjs} +1 -1
  10. package/dist/{actions-registery-CZ1w0NKa.js → actions-registery-y_ENc8zj.js} +2 -2
  11. package/dist/actions.cjs +1 -1
  12. package/dist/actions.js +2 -2
  13. package/dist/active-in-another-tab-Cu_ASKtx.cjs +1 -0
  14. package/dist/active-in-another-tab-DkR2HWI4.js +35 -0
  15. package/dist/add-new-language-page-BXuwluuU.cjs +1 -0
  16. package/dist/{add-new-language-page-WmlCnytQ.js → add-new-language-page-CBY0RR6q.js} +54 -53
  17. package/dist/{add-new-page-soZ8GAkN.cjs → add-new-page-C_PzKby8.cjs} +1 -1
  18. package/dist/{add-new-page-VW2wAYZp.js → add-new-page-DJLJFLAd.js} +2 -2
  19. package/dist/{ai-panel-content-D_o7Q_A-.js → ai-panel-content--YM01Aly.js} +12 -11
  20. package/dist/ai-panel-content-rRmJdH7L.cjs +1 -0
  21. package/dist/{ai-panel-default-lang-DnElspF0.js → ai-panel-default-lang-BZl0tPYo.js} +40 -40
  22. package/dist/{ai-panel-default-lang-COYaxNwn.cjs → ai-panel-default-lang-D2zhXvKP.cjs} +2 -2
  23. package/dist/{ai-panel-other-lang-Dp0E9_Hx.js → ai-panel-other-lang-Bfjk2CYZ.js} +8 -8
  24. package/dist/{ai-panel-other-lang-CkynNlAU.cjs → ai-panel-other-lang-Y4bEKHoG.cjs} +1 -1
  25. package/dist/{ai-prompt-input-Bhc0ds7X.js → ai-prompt-input-DueQYNf-.js} +68 -67
  26. package/dist/ai-prompt-input-N9PcYCFa.cjs +1 -0
  27. package/dist/{ai-translation-prompt-CZ55HQmo.js → ai-translation-prompt-B36F3d7K.js} +2 -2
  28. package/dist/ai-translation-prompt-IAdWMNZb.cjs +1 -0
  29. package/dist/{apply-binding-6iwlED02.js → apply-binding-BvWfJCSZ.js} +204 -196
  30. package/dist/apply-binding-IsUf6UWJ.cjs +1 -0
  31. package/dist/{code-display-DhD_RBcg.js → code-display-Ck81Id9K.js} +1 -1
  32. package/dist/code-display-DloSPyPr.cjs +1 -0
  33. package/dist/{code-editor-DRIAnNbb.js → code-editor-Bb7JumZy.js} +11 -10
  34. package/dist/code-editor-DQB8lAOk.cjs +1 -0
  35. package/dist/{continue-editing-in-this-client-CS2aQ7yY.js → continue-editing-in-this-client-Dm9cCj7K.js} +10 -9
  36. package/dist/continue-editing-in-this-client-DmGFLHXw.cjs +1 -0
  37. package/dist/core-Dr7QYemB.js +56 -0
  38. package/dist/core-Y0lXLwkq.cjs +1 -0
  39. package/dist/core.cjs +1 -1
  40. package/dist/core.d.ts +3 -3
  41. package/dist/core.js +41 -39
  42. package/dist/{css-import-modal-Byg6wV0O.js → css-import-modal-9P_0uNa4.js} +5 -3
  43. package/dist/css-import-modal-Rh1QAVxo.cjs +13 -0
  44. package/dist/{delete-design-token-DkVs1oBf.cjs → delete-design-token-BG8yHcS5.cjs} +1 -1
  45. package/dist/{delete-design-token-BRZZiWtQ.js → delete-design-token-COvR4G1S.js} +1 -1
  46. package/dist/{delete-page-BzyX9TN-.js → delete-page-CNucxe4P.js} +11 -10
  47. package/dist/delete-page-DAvEjHwF.cjs +1 -0
  48. package/dist/design-token-usage-CXglXgcJ.cjs +1 -0
  49. package/dist/{design-token-usage-xQs6SlaJ.js → design-token-usage-MNYsFlPG.js} +14 -13
  50. package/dist/digital-asset-manager-CB5MRBcW.cjs +1 -0
  51. package/dist/{digital-asset-manager-DbtwzxRz.js → digital-asset-manager-CqCWBO0s.js} +6 -5
  52. package/dist/{duplicate-page-BR7Dlo9d.js → duplicate-page-BknLfqr0.js} +19 -18
  53. package/dist/duplicate-page-DzZByALW.cjs +1 -0
  54. package/dist/{dynamic-page-selector-Cb5r_W8s.js → dynamic-page-selector-DoW7OyUB.js} +15 -14
  55. package/dist/dynamic-page-selector-WA007Sni.cjs +1 -0
  56. package/dist/get-chai-builder-tailwind-config-BFePCEIS.cjs +1 -0
  57. package/dist/{get-chai-builder-tailwind-config-DjoVOuAf.js → get-chai-builder-tailwind-config-BXf_xLHk.js} +5 -5
  58. package/dist/{get-chai-builder-theme-Dl72X7cz.cjs → get-chai-builder-theme-BApShjRz.cjs} +1 -1
  59. package/dist/{get-chai-builder-theme-BYtp20KD.js → get-chai-builder-theme-DDVRJQ6Z.js} +1 -1
  60. package/dist/{image-editor-DV8kUKhl.js → image-editor-CQnNtak2.js} +1 -1
  61. package/dist/{image-editor-G-K28aTS.cjs → image-editor-CqwaVxO2.cjs} +1 -1
  62. package/dist/index-C0-pgg_p.cjs +5 -0
  63. package/dist/index-C99FhuF1.cjs +160 -0
  64. package/dist/{index-ZuacEL1j.js → index-Dno42B0a.js} +672 -670
  65. package/dist/{index-Ct7ElCGK.js → index-rAcNbjk_.js} +3744 -3920
  66. package/dist/{json-diff-viewer-D7z4zNvv.cjs → json-diff-viewer-CLuUHiPU.cjs} +3 -3
  67. package/dist/{json-diff-viewer-krslPepD.js → json-diff-viewer-CMvGUvJ2.js} +5 -4
  68. package/dist/{lang-panel-BwIewMyw.js → lang-panel-CnwTb05j.js} +15 -14
  69. package/dist/lang-panel-fDCYm5Jm.cjs +1 -0
  70. package/dist/{manage-design-tokens-Caz_20VK.js → manage-design-tokens-BsSZE9Vs.js} +12 -11
  71. package/dist/manage-design-tokens-BvH5KTJX.cjs +1 -0
  72. package/dist/mark-as-template-CpWEBJGd.cjs +1 -0
  73. package/dist/{mark-as-template-D295ZQtU.js → mark-as-template-DBLshWb5.js} +17 -16
  74. package/dist/{nested-path-selector-content-CKYYK-C5.js → nested-path-selector-content-6OBJ8LG8.js} +24 -23
  75. package/dist/nested-path-selector-content-C2sD9dkq.cjs +1 -0
  76. package/dist/no-language-page-content-BvPDdccK.cjs +1 -0
  77. package/dist/{no-language-page-content-BvqRBP6y.js → no-language-page-content-CzENgtnu.js} +10 -9
  78. package/dist/{no-language-page-dialog-PjNqTUpl.js → no-language-page-dialog-CbYI2cVg.js} +2 -2
  79. package/dist/{no-language-page-dialog-BcEoqyQB.cjs → no-language-page-dialog-CgW4yJBC.cjs} +1 -1
  80. package/dist/{page-creator-DiOITEMw.js → page-creator-Cc83uQqw.js} +113 -112
  81. package/dist/page-creator-g8GqgcKH.cjs +1 -0
  82. package/dist/{page-lock-Bfbs6RgL.js → page-lock-BJUkyxdh.js} +2 -2
  83. package/dist/{page-lock-BdYmCks0.cjs → page-lock-CT7SmQqp.cjs} +1 -1
  84. package/dist/page-locked-dialog-Co5b9XIZ.cjs +1 -0
  85. package/dist/{page-locked-dialog-B6MKTRfY.js → page-locked-dialog-DsEbWRed.js} +18 -15
  86. package/dist/{page-manager-new-CzX22g2n.js → page-manager-new-5rFP5DyQ.js} +30 -29
  87. package/dist/page-manager-new-BOkJImo2.cjs +1 -0
  88. package/dist/page-manager-search-and-filter-Bfm0j1gg.cjs +1 -0
  89. package/dist/{page-manager-search-and-filter-CM0UMb6U.js → page-manager-search-and-filter-zq-LfhQ1.js} +13 -12
  90. package/dist/{page-revisions-content-NH9JK4Ey.js → page-revisions-content-D38G2tJM.js} +34 -31
  91. package/dist/page-revisions-content-ag-MHBGr.cjs +1 -0
  92. package/dist/pages.cjs +1 -1
  93. package/dist/pages.d.ts +4 -4
  94. package/dist/pages.js +1 -1
  95. package/dist/{plugin-C6rgJDNQ.cjs → plugin-BGlQf0iy.cjs} +1 -1
  96. package/dist/{plugin-3ZKK6RXm.js → plugin-C-ht41UZ.js} +1 -1
  97. package/dist/publish-pages-content-BiX-GMLw.cjs +1 -0
  98. package/dist/{publish-pages-content-D9aixMN5.js → publish-pages-content-CS7f41Ac.js} +66 -65
  99. package/dist/register-chai-top-bar-BqwKw4uy.cjs +1 -0
  100. package/dist/register-chai-top-bar-ESJHs5s-.js +237 -0
  101. package/dist/render.cjs +2 -2
  102. package/dist/render.d.ts +2 -2
  103. package/dist/render.js +87 -80
  104. package/dist/rte-widget-modal-BKNx2wln.cjs +1 -0
  105. package/dist/{rte-widget-modal-DOJEXLIf.js → rte-widget-modal-D6Zik0Ta.js} +15 -14
  106. package/dist/runtime.cjs +1 -1
  107. package/dist/runtime.d.ts +168 -4
  108. package/dist/runtime.js +68 -38
  109. package/dist/{save-to-lib-eiOc_SSN.js → save-to-lib-WwOzbgiF.js} +39 -38
  110. package/dist/save-to-lib-ffjCZYJ5.cjs +1 -0
  111. package/dist/sdk.css +1 -1
  112. package/dist/{selected-block-display-CBFePS19.js → selected-block-display-B1SG_UXw.js} +37 -36
  113. package/dist/selected-block-display-BOgnQRLF.cjs +16 -0
  114. package/dist/{seo-panel-C1-iMOR1.js → seo-panel-BkOgRoWd.js} +12 -11
  115. package/dist/seo-panel-FjS1UF_y.cjs +2 -0
  116. package/dist/{shared-json-ld-B4PxAM_0.js → shared-json-ld-uka9TOgA.js} +68 -67
  117. package/dist/shared-json-ld-yJkXjENy.cjs +1 -0
  118. package/dist/slug-input-Cyd6NR6J.cjs +1 -0
  119. package/dist/{slug-input-AwNJs9im.js → slug-input-DHLmUNrH.js} +9 -8
  120. package/dist/supabase-actions.cjs +1 -1
  121. package/dist/supabase-actions.d.ts +1 -1
  122. package/dist/supabase-actions.js +1 -1
  123. package/dist/{take-over-request-C4FeDtN_.js → take-over-request-Ca0X-qyf.js} +17 -16
  124. package/dist/take-over-request-CmpJVe9T.cjs +1 -0
  125. package/dist/{theme-panel-footer-uBQqSJXm.js → theme-panel-footer-BUXIu252.js} +11 -10
  126. package/dist/theme-panel-footer-CKO9YYwZ.cjs +1 -0
  127. package/dist/{translation-warning-modal-B64YqlbI.js → translation-warning-modal-DrpFeI83.js} +9 -8
  128. package/dist/translation-warning-modal-pSZVKcNW.cjs +1 -0
  129. package/dist/{unmark-as-template-CZ9sQp_P.js → unmark-as-template-BMqgelv-.js} +11 -10
  130. package/dist/unmark-as-template-DF1Ms4VN.cjs +1 -0
  131. package/dist/unpublish-page-BJ0Bsvt2.js +28 -0
  132. package/dist/unpublish-page-Bsq2yEqQ.cjs +1 -0
  133. package/dist/utils.cjs +1 -1
  134. package/dist/utils.d.ts +4 -1
  135. package/dist/utils.js +2 -2
  136. package/dist/web-blocks.cjs +1 -1
  137. package/dist/web-blocks.js +46 -46
  138. package/dist/{web-preview-Djy6WIyj.js → web-preview-D6h1L2nV.js} +2 -2
  139. package/dist/web-preview-kres0aG7.cjs +1 -0
  140. package/package.json +4 -2
  141. package/dist/IconPicker-DREyo007.cjs +0 -1
  142. package/dist/active-in-another-tab-B47YjQGN.cjs +0 -1
  143. package/dist/active-in-another-tab-CyjngVA6.js +0 -34
  144. package/dist/add-new-language-page-88xzrUy8.cjs +0 -1
  145. package/dist/ai-panel-content-7zCil042.cjs +0 -1
  146. package/dist/ai-prompt-input-CThbVp0_.cjs +0 -1
  147. package/dist/ai-translation-prompt-C2kJQFDX.cjs +0 -1
  148. package/dist/apply-binding-KKp5PnpZ.cjs +0 -1
  149. package/dist/code-display-BnqzqzoP.cjs +0 -1
  150. package/dist/code-editor-o3___nu2.cjs +0 -1
  151. package/dist/continue-editing-in-this-client-CtMYsk-A.cjs +0 -1
  152. package/dist/core-BoRDjj4h.cjs +0 -1
  153. package/dist/core-yvI6kCyw.js +0 -56
  154. package/dist/css-import-modal-CyqkXWCO.cjs +0 -13
  155. package/dist/delete-page-DxX7PFIE.cjs +0 -1
  156. package/dist/design-token-usage-CAHzEGgJ.cjs +0 -1
  157. package/dist/digital-asset-manager--uO8Agia.cjs +0 -1
  158. package/dist/duplicate-page-CaNAbXwV.cjs +0 -1
  159. package/dist/dynamic-page-selector-Cxk_gjni.cjs +0 -1
  160. package/dist/get-chai-builder-tailwind-config-B9rCyiQo.cjs +0 -1
  161. package/dist/index-DF5DEvqb.cjs +0 -160
  162. package/dist/index-WQwzsC7A.cjs +0 -5
  163. package/dist/lang-panel-DT96k1xg.cjs +0 -1
  164. package/dist/manage-design-tokens-CrmLe7UT.cjs +0 -1
  165. package/dist/mark-as-template-W3LmpiqN.cjs +0 -1
  166. package/dist/nested-path-selector-content-CoS_d3dc.cjs +0 -1
  167. package/dist/no-language-page-content-DkfeMl90.cjs +0 -1
  168. package/dist/page-creator-C4gc5NSC.cjs +0 -1
  169. package/dist/page-locked-dialog-B1FAtK92.cjs +0 -1
  170. package/dist/page-manager-new-CHDueBDk.cjs +0 -1
  171. package/dist/page-manager-search-and-filter-DkkRIH86.cjs +0 -1
  172. package/dist/page-revisions-content-ChY-4f2V.cjs +0 -1
  173. package/dist/publish-pages-content-x-JuSFJ9.cjs +0 -1
  174. package/dist/rte-widget-modal-BaHIuEjF.cjs +0 -1
  175. package/dist/save-to-lib-Cgpxw8-g.cjs +0 -1
  176. package/dist/selected-block-display-BgRY82CT.cjs +0 -16
  177. package/dist/seo-panel-DfAb8U7W.cjs +0 -2
  178. package/dist/shared-json-ld-DzG398hr.cjs +0 -1
  179. package/dist/slug-input-C_ijLQ_X.cjs +0 -1
  180. package/dist/take-over-request-BNxcjY2j.cjs +0 -1
  181. package/dist/theme-panel-footer-Cq9pljro.cjs +0 -1
  182. package/dist/translation-warning-modal-BZAcwM2_.cjs +0 -1
  183. package/dist/unmark-as-template-EVvk0vmp.cjs +0 -1
  184. package/dist/unpublish-page-D4VwOlxc.js +0 -27
  185. package/dist/unpublish-page-bdSmwAVQ.cjs +0 -1
  186. package/dist/web-preview-Cio70gk5.cjs +0 -1
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-BqwKw4uy.cjs"),r=require("./index-C99FhuF1.cjs"),t=require("./index-C0-pgg_p.cjs"),l=require("lucide-react"),f=require("react"),j=require("react-i18next"),T=()=>{const i=t.useSendRealtimeEvent(),{pageLockMeta:n}=t.usePageLockMeta(),{setPageStatus:d}=t.usePageLockStatus(),{savePageAsync:x}=r.useSavePage(),h=n==null?void 0:n.requestingUserId,{data:s,isFetching:g}=t.useChaiUserInfo(h||""),o=g?"Fetching user...":(s==null?void 0:s.name)||"Current editor",[u,c]=f.useState(!1),N=async()=>{c(!0),await x(),i(t.EVENT.CONTINUE_EDITING_IN_THIS_CLIENT,n),d(t.PAGE_STATUS.CHECKING),setTimeout(()=>c(!1),2e3)},p=()=>{c(!0),i(t.EVENT.TAKE_OVER_REJECTED,n),d(t.PAGE_STATUS.EDITING),setTimeout(()=>c(!1),2e3)},{t:a}=j.useTranslation();return e.jsx(t.BlurContainer,{children:e.jsxs(r.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(r.CardHeader,{className:"space-y-1",children:e.jsxs(r.CardTitle,{className:"flex items-center gap-2 text-xl",children:[e.jsx(l.AlertCircle,{className:"h-8 w-8 rounded-md bg-amber-500/20 p-1.5 text-amber-500"}),a("Take Over Requested")]})}),e.jsxs(r.CardContent,{className:"space-y-4",children:[e.jsxs("div",{className:"relative rounded-md border border-green-500 px-2 pb-2 pt-4",children:[e.jsx("div",{className:"absolute -top-2.5 left-3 w-max rounded-full bg-green-500 px-3 py-1 text-xs font-medium leading-3 text-white",children:"Requested by"}),e.jsxs("div",{className:"flex items-center space-x-4 p-1",children:[s!=null&&s.avatar?e.jsx("img",{src:s.avatar,alt:s.name,className:"h-12 w-12 flex-shrink-0 rounded-full bg-black p-3 text-white"}):e.jsx(l.UserIcon,{className:"h-12 w-12 flex-shrink-0 rounded-full bg-black p-3 text-white"}),e.jsxs("div",{className:"flex-1 space-y-0",children:[e.jsx("div",{className:"truncate font-medium leading-tight text-black",children:o}),(s==null?void 0:s.email)&&e.jsx("p",{className:"truncate text-sm leading-tight text-muted-foreground",children:s.email})]})]})]}),e.jsxs("p",{className:"text-sm text-muted-foreground",children:[e.jsx("span",{className:"font-medium text-gray-700",children:o})," ",a("has requested to")," ",e.jsx("span",{className:"font-medium text-gray-500",children:"take over"})," ",a("editing this page."),"."," ",a("Do you want to allow them to continue?")]})]}),e.jsxs(r.CardFooter,{className:"flex gap-2",children:[e.jsxs(m.Button,{disabled:u,variant:"default",onClick:N,className:"flex-1 gap-2",children:[e.jsx(l.Check,{className:"h-4 w-4"}),a("Accept")]}),e.jsxs(m.Button,{disabled:u,variant:"outline",onClick:p,className:"flex-1 gap-2",children:[e.jsx(l.X,{className:"h-4 w-4"}),a("Reject")]})]})]})})};exports.default=T;
@@ -1,25 +1,26 @@
1
1
  import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
- import { h, B as o } from "./index-Ct7ElCGK.js";
3
- import { e as d, f as u, t as b } from "./index-ZuacEL1j.js";
4
- import { useTranslation as f } from "react-i18next";
5
- const x = () => {
6
- const [e] = h(), { mutate: r, isPending: s } = d(), { mutateAsync: t, isPending: i } = u(), { t: n } = f(), l = () => {
2
+ import { B as o } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { h } from "./index-rAcNbjk_.js";
4
+ import { e as d, f as u, t as f } from "./index-Dno42B0a.js";
5
+ import { useTranslation as p } from "react-i18next";
6
+ const v = () => {
7
+ const [e] = h(), { mutate: r, isPending: s } = d(), { mutateAsync: t, isPending: i } = u(), { t: n } = p(), m = () => {
7
8
  t({ settings: { theme: e } });
8
- }, m = async () => {
9
+ }, l = async () => {
9
10
  await t({ settings: { theme: e } }), r(
10
11
  { ids: ["THEME"] },
11
12
  {
12
13
  onSuccess: () => {
13
- b("BOTTOM_RIGHT");
14
+ f("BOTTOM_RIGHT");
14
15
  }
15
16
  }
16
17
  );
17
18
  };
18
19
  return /* @__PURE__ */ c("div", { className: "flex items-center justify-center gap-x-3 border-t bg-white py-3", children: [
19
- /* @__PURE__ */ a(o, { size: "sm", variant: "outline", disabled: s || i, onClick: l, children: n("Save draft") }),
20
- /* @__PURE__ */ a(o, { size: "sm", disabled: s || i, onClick: m, children: n("Publish") })
20
+ /* @__PURE__ */ a(o, { size: "sm", variant: "outline", disabled: s || i, onClick: m, children: n("Save draft") }),
21
+ /* @__PURE__ */ a(o, { size: "sm", disabled: s || i, onClick: l, children: n("Publish") })
21
22
  ] });
22
23
  };
23
24
  export {
24
- x as default
25
+ v as default
25
26
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-BqwKw4uy.cjs"),d=require("./index-C99FhuF1.cjs"),t=require("./index-C0-pgg_p.cjs"),h=require("react-i18next"),g=()=>{const[s]=d.useTheme(),{mutate:c,isPending:i}=t.usePublishPages(),{mutateAsync:n,isPending:r}=t.useUpdateWebsiteSettings(),{t:a}=h.useTranslation(),u=()=>{n({settings:{theme:s}})},l=async()=>{await n({settings:{theme:s}}),c({ids:["THEME"]},{onSuccess:()=>{t.throwConfetti("BOTTOM_RIGHT")}})};return e.jsxs("div",{className:"flex items-center justify-center gap-x-3 border-t bg-white py-3",children:[e.jsx(o.Button,{size:"sm",variant:"outline",disabled:i||r,onClick:u,children:a("Save draft")}),e.jsx(o.Button,{size:"sm",disabled:i||r,onClick:l,children:a("Publish")})]})};exports.default=g;
@@ -1,18 +1,19 @@
1
1
  import { jsx as n, jsxs as e } from "react/jsx-runtime";
2
- import { D as c, d, e as h, f as u, p as g, q as m, B as i } from "./index-Ct7ElCGK.js";
3
- const b = ({
2
+ import { B as i } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { D as c, d, e as h, f as m, p as u, q as g } from "./index-rAcNbjk_.js";
4
+ const x = ({
4
5
  isOpen: l,
5
6
  onClose: o,
6
7
  onContinue: t,
7
8
  isPending: a = !1,
8
- title: s = "Translation Warning",
9
- description: r = "Some blocks need translations before publishing. Do you want to continue anyway?"
9
+ title: r = "Translation Warning",
10
+ description: s = "Some blocks need translations before publishing. Do you want to continue anyway?"
10
11
  }) => /* @__PURE__ */ n(c, { open: l, onOpenChange: o, children: l && /* @__PURE__ */ e(d, { className: "sm:max-w-[425px]", children: [
11
12
  /* @__PURE__ */ e(h, { children: [
12
- /* @__PURE__ */ n(u, { children: s }),
13
- /* @__PURE__ */ n(g, { children: r })
13
+ /* @__PURE__ */ n(m, { children: r }),
14
+ /* @__PURE__ */ n(u, { children: s })
14
15
  ] }),
15
- /* @__PURE__ */ e(m, { className: "flex gap-2", children: [
16
+ /* @__PURE__ */ e(g, { className: "flex gap-2", children: [
16
17
  /* @__PURE__ */ n(i, { variant: "outline", onClick: () => {
17
18
  o();
18
19
  }, disabled: a, children: "Cancel" }),
@@ -22,5 +23,5 @@ const b = ({
22
23
  ] })
23
24
  ] }) });
24
25
  export {
25
- b as default
26
+ x as default
26
27
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),l=require("./register-chai-top-bar-BqwKw4uy.cjs"),n=require("./index-C99FhuF1.cjs"),u=({isOpen:o,onClose:i,onContinue:t,isPending:a=!1,title:r="Translation Warning",description:s="Some blocks need translations before publishing. Do you want to continue anyway?"})=>{const c=()=>{i()},d=()=>{t()};return e.jsx(n.Dialog,{open:o,onOpenChange:i,children:o&&e.jsxs(n.DialogContent,{className:"sm:max-w-[425px]",children:[e.jsxs(n.DialogHeader,{children:[e.jsx(n.DialogTitle,{children:r}),e.jsx(n.DialogDescription,{children:s})]}),e.jsxs(n.DialogFooter,{className:"flex gap-2",children:[e.jsx(l.Button,{variant:"outline",onClick:c,disabled:a,children:"Cancel"}),e.jsx(l.Button,{onClick:d,disabled:a,children:a?"Publishing...":"Continue Anyway"})]})]})})};exports.default=u;
@@ -1,10 +1,11 @@
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";
1
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
+ import { B as r } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { D as p, d as u, e as d, f, p as g, q as h } from "./index-rAcNbjk_.js";
4
+ import { r as k } from "./index-Dno42B0a.js";
4
5
  import { useState as D } from "react";
5
6
  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 = () => {
7
+ const j = ({ page: i, onClose: t }) => {
8
+ const { t: e } = x(), [s, n] = D(!1), l = k(), m = () => {
8
9
  n(!0), l.mutate(i, {
9
10
  onSuccess: () => {
10
11
  n(!1), t();
@@ -14,12 +15,12 @@ const C = ({ page: i, onClose: t }) => {
14
15
  }
15
16
  });
16
17
  };
17
- return /* @__PURE__ */ a(p, { open: !0, onOpenChange: t, children: /* @__PURE__ */ s(u, { children: [
18
- /* @__PURE__ */ s(d, { children: [
18
+ return /* @__PURE__ */ a(p, { open: !0, onOpenChange: t, children: /* @__PURE__ */ o(u, { children: [
19
+ /* @__PURE__ */ o(d, { children: [
19
20
  /* @__PURE__ */ a(f, { children: e("Unmark as template") }),
20
21
  /* @__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
  ] }),
22
- /* @__PURE__ */ s(h, { className: o ? "pointer-events-none opacity-75" : "", children: [
23
+ /* @__PURE__ */ o(h, { className: s ? "pointer-events-none opacity-75" : "", children: [
23
24
  /* @__PURE__ */ a(
24
25
  r,
25
26
  {
@@ -30,10 +31,10 @@ const C = ({ page: i, onClose: t }) => {
30
31
  children: e("Cancel")
31
32
  }
32
33
  ),
33
- /* @__PURE__ */ a(r, { variant: "default", disabled: o, onClick: m, children: e("Unmark as template") })
34
+ /* @__PURE__ */ a(r, { variant: "default", disabled: s, onClick: m, children: e("Unmark as template") })
34
35
  ] })
35
36
  ] }) });
36
37
  };
37
38
  export {
38
- C as default
39
+ j as default
39
40
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-BqwKw4uy.cjs"),t=require("./index-C99FhuF1.cjs"),p=require("./index-C0-pgg_p.cjs"),d=require("react"),m=require("react-i18next"),g=({page:i,onClose:n})=>{const{t:a}=m.useTranslation(),[r,s]=d.useState(!1),l=p.useUnmarkAsTemplate(),c=()=>{s(!0),l.mutate(i,{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(o.Button,{variant:"outline",onClick:u=>{u.stopPropagation(),n()},children:a("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:r,onClick:c,children:a("Unmark as template")})]})]})})};exports.default=g;
@@ -0,0 +1,28 @@
1
+ import { jsx as s, jsxs as o } from "react/jsx-runtime";
2
+ import { B as l } from "./register-chai-top-bar-ESJHs5s-.js";
3
+ import { D as c, d as u, e as d, f as h, p as m, q as b } from "./index-rAcNbjk_.js";
4
+ import { s as f } from "./index-Dno42B0a.js";
5
+ import { useTranslation as D } from "react-i18next";
6
+ const v = ({ page: n, onClose: r }) => {
7
+ const { t: i } = D(), { mutate: e, isPending: t } = f(), a = async () => {
8
+ e(n, { onSuccess: r });
9
+ };
10
+ return /* @__PURE__ */ s(c, { open: !!n, onOpenChange: r, children: /* @__PURE__ */ o(u, { children: [
11
+ /* @__PURE__ */ o(d, { children: [
12
+ /* @__PURE__ */ s(h, { children: i("Confirm action") }),
13
+ /* @__PURE__ */ o(m, { children: [
14
+ i("Are you sure you want to unpublish"),
15
+ " ",
16
+ /* @__PURE__ */ s("b", { children: (n == null ? void 0 : n.name) ?? (n == null ? void 0 : n.slug) }),
17
+ "?"
18
+ ] })
19
+ ] }),
20
+ /* @__PURE__ */ o(b, { children: [
21
+ /* @__PURE__ */ s(l, { variant: "outline", onClick: r, children: i("Cancel") }),
22
+ /* @__PURE__ */ s(l, { variant: "destructive", disabled: t, onClick: a, children: i(t ? "Updating..." : "Unpublish") })
23
+ ] })
24
+ ] }) });
25
+ };
26
+ export {
27
+ v as default
28
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),o=require("./register-chai-top-bar-BqwKw4uy.cjs"),e=require("./index-C99FhuF1.cjs"),c=require("./index-C0-pgg_p.cjs"),a=require("react-i18next"),d=({page:i,onClose:t})=>{const{t:s}=a.useTranslation(),{mutate:l,isPending:r}=c.useUnpublishPage(),u=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(o.Button,{variant:"outline",onClick:t,children:s("Cancel")}),n.jsx(o.Button,{variant:"destructive",disabled:r,onClick:u,children:s(r?"Updating...":"Unpublish")})]})]})})};exports.default=d;
package/dist/utils.cjs CHANGED
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./get-chai-builder-theme-BApShjRz.cjs"),e=require("./get-chai-builder-tailwind-config-BFePCEIS.cjs");exports.chaiBuilderPlugin=i.chaiBuilderPlugin;exports.getChaiBuilderTheme=i.getChaiBuilderTheme;exports.getChaiBuilderTailwindConfig=e.getChaiBuilderTailwindConfig;
package/dist/utils.d.ts CHANGED
@@ -26,7 +26,7 @@ declare type ChaiBuilderThemeOptions = {
26
26
 
27
27
  export declare const getChaiBuilderTailwindConfig: ({ content, theme }: {
28
28
  content: string[];
29
- theme?: Record<string, any>;
29
+ theme: Record<string, any>;
30
30
  }) => {
31
31
  darkMode: string;
32
32
  content: string[];
@@ -98,6 +98,9 @@ export declare const getChaiBuilderTailwindConfig: ({ content, theme }: {
98
98
  };
99
99
  plugins: ({
100
100
  handler: () => void;
101
+ } | {
102
+ handler: PluginCreator;
103
+ config?: Partial<Config> | undefined;
101
104
  } | typeof default_2 | typeof default_3)[];
102
105
  };
103
106
 
package/dist/utils.js CHANGED
@@ -1,5 +1,5 @@
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";
1
+ import { c as a, g as r } from "./get-chai-builder-theme-DDVRJQ6Z.js";
2
+ import { g as l } from "./get-chai-builder-tailwind-config-BXf_xLHk.js";
3
3
  export {
4
4
  a as chaiBuilderPlugin,
5
5
  l as getChaiBuilderTailwindConfig,
@@ -1 +1 @@
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
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("lodash-es"),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"),d=require("./core-Y0lXLwkq.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!==null?n.style={...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)=>f.width-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;