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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/dist/{2SSKDMRQ-C4VFVd-q.cjs → 2SSKDMRQ-BnsZi3K3.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-DSnzF_1o.js → 2SSKDMRQ-CnSDkQcy.js} +2 -2
  3. package/dist/{AP7HFJJL-B7YYCY9q.cjs → AP7HFJJL-B31839PG.cjs} +1 -1
  4. package/dist/{AP7HFJJL-Cxwj01Aq.js → AP7HFJJL-CymCmW14.js} +1 -1
  5. package/dist/{IconPicker-RqVvq6G2.js → IconPicker-B1rWC-Ex.js} +1 -1
  6. package/dist/{IconPicker-C9-ieDWm.cjs → IconPicker-DREyo007.cjs} +1 -1
  7. package/dist/{WDYDFRGG-C7aSUcjs.js → WDYDFRGG-BUVnbAci.js} +2 -2
  8. package/dist/{WDYDFRGG-b3T2SQbz.cjs → WDYDFRGG-BxhOCHc3.cjs} +1 -1
  9. package/dist/{active-in-another-tab-Clng6zpY.cjs → active-in-another-tab-B47YjQGN.cjs} +1 -1
  10. package/dist/{active-in-another-tab-wb8qolB8.js → active-in-another-tab-CyjngVA6.js} +2 -2
  11. package/dist/{add-new-language-page-C4BuMTaN.cjs → add-new-language-page-88xzrUy8.cjs} +1 -1
  12. package/dist/{add-new-language-page-D7NDABl1.js → add-new-language-page-WmlCnytQ.js} +3 -3
  13. package/dist/{add-new-page-B4hc0B-g.js → add-new-page-VW2wAYZp.js} +2 -2
  14. package/dist/{add-new-page-BNfwKjRd.cjs → add-new-page-soZ8GAkN.cjs} +1 -1
  15. package/dist/{ai-panel-content-DPy2jgKw.cjs → ai-panel-content-7zCil042.cjs} +1 -1
  16. package/dist/{ai-panel-content-BnbURb7j.js → ai-panel-content-D_o7Q_A-.js} +3 -3
  17. package/dist/{ai-panel-default-lang-3tCHzab5.cjs → ai-panel-default-lang-COYaxNwn.cjs} +2 -2
  18. package/dist/{ai-panel-default-lang-oVk4TDeb.js → ai-panel-default-lang-DnElspF0.js} +3 -3
  19. package/dist/{ai-panel-other-lang-BBHCCSen.cjs → ai-panel-other-lang-CkynNlAU.cjs} +1 -1
  20. package/dist/{ai-panel-other-lang-DmQ3QMDD.js → ai-panel-other-lang-Dp0E9_Hx.js} +3 -3
  21. package/dist/{ai-prompt-input-DaTyfib-.js → ai-prompt-input-Bhc0ds7X.js} +1 -1
  22. package/dist/{ai-prompt-input-b5ty81RB.cjs → ai-prompt-input-CThbVp0_.cjs} +1 -1
  23. package/dist/{ai-translation-prompt-c0Q3zkT2.cjs → ai-translation-prompt-C2kJQFDX.cjs} +1 -1
  24. package/dist/{ai-translation-prompt-DJPe2O-n.js → ai-translation-prompt-CZ55HQmo.js} +2 -2
  25. package/dist/{code-display-Q3_sK_Ta.cjs → code-display-BnqzqzoP.cjs} +1 -1
  26. package/dist/{code-display-BzBq5xSn.js → code-display-DhD_RBcg.js} +1 -1
  27. package/dist/{code-editor-DWWnphW9.js → code-editor-DRIAnNbb.js} +1 -1
  28. package/dist/{code-editor-BQZi6-FB.cjs → code-editor-o3___nu2.cjs} +1 -1
  29. package/dist/{continue-editing-in-this-client-BllU94XG.js → continue-editing-in-this-client-CS2aQ7yY.js} +2 -2
  30. package/dist/{continue-editing-in-this-client-D9HyD4GP.cjs → continue-editing-in-this-client-CtMYsk-A.cjs} +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.js +1 -1
  33. package/dist/{css-import-modal-D72a-16X.js → css-import-modal-Byg6wV0O.js} +3 -4
  34. package/dist/css-import-modal-CyqkXWCO.cjs +13 -0
  35. package/dist/{delete-design-token-Cd1ZDtqT.js → delete-design-token-BRZZiWtQ.js} +1 -1
  36. package/dist/{delete-design-token-D_TLlO3I.cjs → delete-design-token-DkVs1oBf.cjs} +1 -1
  37. package/dist/{delete-page-DC8pzvWW.js → delete-page-BzyX9TN-.js} +2 -2
  38. package/dist/{delete-page-ByQwBupJ.cjs → delete-page-DxX7PFIE.cjs} +1 -1
  39. package/dist/{design-token-usage-BqZeR1sT.cjs → design-token-usage-CAHzEGgJ.cjs} +1 -1
  40. package/dist/{design-token-usage-DE4XCDdn.js → design-token-usage-xQs6SlaJ.js} +1 -1
  41. package/dist/{digital-asset-manager-BYLKFEYi.cjs → digital-asset-manager--uO8Agia.cjs} +1 -1
  42. package/dist/{digital-asset-manager-C_gL_0YY.js → digital-asset-manager-DbtwzxRz.js} +3 -3
  43. package/dist/{duplicate-page-BoVhko2q.js → duplicate-page-BR7Dlo9d.js} +3 -3
  44. package/dist/{duplicate-page-vdvwLQLo.cjs → duplicate-page-CaNAbXwV.cjs} +1 -1
  45. package/dist/{dynamic-page-selector-CSndg2-y.js → dynamic-page-selector-Cb5r_W8s.js} +2 -2
  46. package/dist/{dynamic-page-selector-DdnbCuQZ.cjs → dynamic-page-selector-Cxk_gjni.cjs} +1 -1
  47. package/dist/{image-editor-oypq8asR.js → image-editor-DV8kUKhl.js} +1 -1
  48. package/dist/{image-editor-DTspjj_c.cjs → image-editor-G-K28aTS.cjs} +1 -1
  49. package/dist/{index-S8ibZk9Q.js → index-Ct7ElCGK.js} +6 -6
  50. package/dist/{index-CnSjWE1P.cjs → index-DF5DEvqb.cjs} +2 -2
  51. package/dist/{index-CbwxUFy_.cjs → index-WQwzsC7A.cjs} +3 -3
  52. package/dist/{index-BDnwJqMw.js → index-ZuacEL1j.js} +122 -122
  53. package/dist/{json-diff-viewer-XX1pgabt.cjs → json-diff-viewer-D7z4zNvv.cjs} +1 -1
  54. package/dist/{json-diff-viewer-B5dr-Y_L.js → json-diff-viewer-krslPepD.js} +2 -2
  55. package/dist/{lang-panel-Cn83SRzd.js → lang-panel-BwIewMyw.js} +3 -3
  56. package/dist/{lang-panel-BPxex-M2.cjs → lang-panel-DT96k1xg.cjs} +1 -1
  57. package/dist/{manage-design-tokens-lP4HLS0P.js → manage-design-tokens-Caz_20VK.js} +2 -2
  58. package/dist/{manage-design-tokens-ConiyuPr.cjs → manage-design-tokens-CrmLe7UT.cjs} +1 -1
  59. package/dist/{mark-as-template-jncsjfHm.js → mark-as-template-D295ZQtU.js} +2 -2
  60. package/dist/{mark-as-template-DYRxre1f.cjs → mark-as-template-W3LmpiqN.cjs} +1 -1
  61. package/dist/{nested-path-selector-content-B-8LqhXI.js → nested-path-selector-content-CKYYK-C5.js} +1 -1
  62. package/dist/{nested-path-selector-content-BYtLi7mC.cjs → nested-path-selector-content-CoS_d3dc.cjs} +1 -1
  63. package/dist/{no-language-page-content-D_zd9Rb0.js → no-language-page-content-BvqRBP6y.js} +2 -2
  64. package/dist/{no-language-page-content-DAbLq0gX.cjs → no-language-page-content-DkfeMl90.cjs} +1 -1
  65. package/dist/{no-language-page-dialog-fXmbQO7L.cjs → no-language-page-dialog-BcEoqyQB.cjs} +1 -1
  66. package/dist/{no-language-page-dialog-C5Ps6YYL.js → no-language-page-dialog-PjNqTUpl.js} +2 -2
  67. package/dist/{page-creator-VWIB2VAs.cjs → page-creator-C4gc5NSC.cjs} +1 -1
  68. package/dist/{page-creator-wCMtlE6Z.js → page-creator-DiOITEMw.js} +3 -3
  69. package/dist/{page-lock-DweiYy1w.cjs → page-lock-BdYmCks0.cjs} +1 -1
  70. package/dist/{page-lock-BPCxfv9J.js → page-lock-Bfbs6RgL.js} +2 -2
  71. package/dist/{page-locked-dialog-BlbgvaG2.cjs → page-locked-dialog-B1FAtK92.cjs} +1 -1
  72. package/dist/{page-locked-dialog-ByGl18_m.js → page-locked-dialog-B6MKTRfY.js} +2 -2
  73. package/dist/{page-manager-new-D0lGfNnS.cjs → page-manager-new-CHDueBDk.cjs} +1 -1
  74. package/dist/{page-manager-new-BWFE-S-O.js → page-manager-new-CzX22g2n.js} +3 -3
  75. package/dist/{page-manager-search-and-filter-kNJFWJ86.js → page-manager-search-and-filter-CM0UMb6U.js} +2 -2
  76. package/dist/{page-manager-search-and-filter-DpGMoOII.cjs → page-manager-search-and-filter-DkkRIH86.cjs} +1 -1
  77. package/dist/{page-revisions-content-DYxXZqmh.cjs → page-revisions-content-ChY-4f2V.cjs} +1 -1
  78. package/dist/{page-revisions-content-Ulr8slUN.js → page-revisions-content-NH9JK4Ey.js} +3 -3
  79. package/dist/pages.cjs +1 -1
  80. package/dist/pages.d.ts +18 -19
  81. package/dist/pages.js +12 -12
  82. package/dist/{publish-pages-content-BTPzt_m4.js → publish-pages-content-D9aixMN5.js} +3 -3
  83. package/dist/{publish-pages-content-D6g8GAsd.cjs → publish-pages-content-x-JuSFJ9.cjs} +1 -1
  84. package/dist/{rte-widget-modal-DrMzWWjw.cjs → rte-widget-modal-BaHIuEjF.cjs} +1 -1
  85. package/dist/{rte-widget-modal-Rk_NW3KU.js → rte-widget-modal-DOJEXLIf.js} +1 -1
  86. package/dist/{save-to-lib-DHHUO12i.cjs → save-to-lib-Cgpxw8-g.cjs} +1 -1
  87. package/dist/{save-to-lib-BK3uTFss.js → save-to-lib-eiOc_SSN.js} +2 -2
  88. package/dist/{selected-block-display-DSFhddPj.cjs → selected-block-display-BgRY82CT.cjs} +1 -1
  89. package/dist/{selected-block-display-CU3TwIMA.js → selected-block-display-CBFePS19.js} +2 -2
  90. package/dist/{seo-panel-jbzxFioc.js → seo-panel-C1-iMOR1.js} +2 -2
  91. package/dist/{seo-panel-Dl0IDV09.cjs → seo-panel-DfAb8U7W.cjs} +1 -1
  92. package/dist/{shared-json-ld-BL_dv3_q.js → shared-json-ld-B4PxAM_0.js} +2 -2
  93. package/dist/{shared-json-ld-DPNkqDC1.cjs → shared-json-ld-DzG398hr.cjs} +1 -1
  94. package/dist/{slug-input-1qwKkXhA.js → slug-input-AwNJs9im.js} +1 -1
  95. package/dist/{slug-input-YVLjtTI3.cjs → slug-input-C_ijLQ_X.cjs} +1 -1
  96. package/dist/{take-over-request-DvMIg_cZ.cjs → take-over-request-BNxcjY2j.cjs} +1 -1
  97. package/dist/{take-over-request-DKvKi3mM.js → take-over-request-C4FeDtN_.js} +2 -2
  98. package/dist/{theme-panel-footer-BMOaPLWc.cjs → theme-panel-footer-Cq9pljro.cjs} +1 -1
  99. package/dist/{theme-panel-footer-DbMDLYGI.js → theme-panel-footer-uBQqSJXm.js} +2 -2
  100. package/dist/{translation-warning-modal-9wTwIy_9.js → translation-warning-modal-B64YqlbI.js} +1 -1
  101. package/dist/{translation-warning-modal-DjTwz75c.cjs → translation-warning-modal-BZAcwM2_.cjs} +1 -1
  102. package/dist/{unmark-as-template-Dulvf7Zw.js → unmark-as-template-CZ9sQp_P.js} +2 -2
  103. package/dist/{unmark-as-template-CdqIJJER.cjs → unmark-as-template-EVvk0vmp.cjs} +1 -1
  104. package/dist/{unpublish-page-Degu5Cy9.js → unpublish-page-D4VwOlxc.js} +2 -2
  105. package/dist/{unpublish-page-BwSVBf0_.cjs → unpublish-page-bdSmwAVQ.cjs} +1 -1
  106. package/dist/web-blocks.cjs +1 -1
  107. package/dist/web-blocks.js +42 -42
  108. package/dist/{web-preview-YzKxyXft.cjs → web-preview-Cio70gk5.cjs} +1 -1
  109. package/dist/{web-preview-DXE4Jnf5.js → web-preview-Djy6WIyj.js} +2 -2
  110. package/package.json +1 -1
  111. package/dist/css-import-modal-BSMGKA2T.cjs +0 -13
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-CnSjWE1P.cjs"),c=require("./index-CbwxUFy_.cjs"),I=require("@tanstack/react-query"),G=require("lodash-es"),f=require("lucide-react"),x=require("react"),E=require("sonner"),q=()=>{const t=c.useApiUrl(),d=c.useFetch();return I.useQuery({queryKey:[c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS],queryFn:async()=>d(t,{action:c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS})})},M=({show:t,onClose:d,initialData:n})=>e.jsx(s.Dialog,{open:t,onOpenChange:()=>d(),children:t&&e.jsx(U,{show:t,onClose:d,initialData:n})}),U=({show:t,onClose:d,initialData:n})=>{const[r,p]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[N,S]=x.useState(!1),{data:g}=c.useChaiCurrentPage(),{mutateAsync:A,isPending:j}=c.useAddGlobalSchema(),{mutateAsync:u}=c.useTogglePageGlobalSchema(),v=I.useQueryClient();x.useEffect(()=>{p(n?{name:n.name,description:n.description,content:JSON.stringify(n.jsonld,null,2),enabledByDefaultForNewPages:!1}:{name:"",description:"",content:"",enabledByDefaultForNewPages:!1}),S(!1)},[t,n]);const i=async()=>{if(!r.name||!r.content){E.toast.error("Please enter a name and content");return}const l=c.parseJSONWithPlaceholders(r.content);if(!l.isValid){E.toast.error("Invalid JSON-LD content");return}const b={name:r.name,jsonld:l.parsed,addToExistingPages:N,addToNewPages:r.enabledByDefaultForNewPages,description:r.description};n!=null&&n.primaryPageId&&(b.primaryPage=n.primaryPageId);const w=await A(b);g!=null&&g.id&&(w!=null&&w.id)&&!(n!=null&&n.primaryPageId)&&(await u({schemaId:w.id,pageId:g.id,enabled:!0}),v.invalidateQueries({queryKey:[c.ACTIONS.GET_LANGUAGE_PAGES,g.id]})),d()};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Add New Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[(n==null?void 0:n.languageCode)&&e.jsxs(s.Alert,{className:"border-blue-200 bg-blue-50",children:[e.jsx(f.Info,{className:"h-4 w-4 text-blue-600"}),e.jsxs(s.AlertDescription,{className:"text-sm text-blue-800",children:["You are creating a ",e.jsx("span",{className:"font-semibold",children:n.languageCode})," language version of this schema. This will be linked to the default language schema."]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-name",children:"Schema Name"}),e.jsx(s.Input,{id:"new-name",value:r.name,onChange:l=>p({...r,name:l.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-description",children:"Description"}),e.jsx(s.Input,{id:"new-description",value:r.description||"",onChange:l=>p({...r,description:l.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"new-content",value:r.content||"{}",onChange:l=>p({...r,content:l}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!(n!=null&&n.primaryPageId)&&e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"add-to-all-existing",checked:N,onChange:l=>S(l.target.checked),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"add-to-all-existing",children:[e.jsx("div",{children:"Add to all existing pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"This schema will be added to all existing pages on your site"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"new-enabled",checked:r.enabledByDefaultForNewPages,onChange:l=>p({...r,enabledByDefaultForNewPages:l.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"new-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:j,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:j,type:"button",size:"sm",onClick:i,children:j?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Adding"]}):e.jsxs(e.Fragment,{children:["Add Schema",(n==null?void 0:n.languageCode)&&` (${n.languageCode})`]})})]})})]})]})},_=({id:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:()=>d(),children:t&&e.jsx(H,{id:t,onClose:d})}),H=({id:t,onClose:d})=>{const[n,r]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[p,N]=x.useState(!1),[S,g]=x.useState(!1),[A,j]=x.useState(!1),{data:u}=q(),{mutateAsync:v,isPending:i}=c.useUpdateGlobalSchema(),{mutateAsync:l}=c.useApplySchemaToAllPages(),{mutateAsync:b}=c.useRemoveSchemaFromAllPages();x.useEffect(()=>{var m,T;if(t&&u){const y=u.find(P=>P.id===t);y&&(r({name:y.name,description:((m=y.metadata)==null?void 0:m.description)||"",content:JSON.stringify(y.jsonld,null,2),enabledByDefaultForNewPages:((T=y.metadata)==null?void 0:T.addToNewPages)||!1}),j(!!y.primaryPage))}},[t,u]);const w=async()=>{if(!n.name||!n.content){E.toast.error("Please enter a name and content");return}const m=c.parseJSONWithPlaceholders(n.content);if(!m.isValid){E.toast.error("Invalid JSON-LD content");return}const T={id:t,name:n.name,jsonld:m.parsed,addToNewPages:n.enabledByDefaultForNewPages,description:n.description};await v(T),d()},F=async()=>{try{await l(t)}finally{N(!1)}},C=async()=>{try{await b(t)}finally{g(!1)}};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Edit Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[!A&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-blue-900",children:"Manage Existing Pages"}),e.jsx("div",{className:"text-xs text-blue-700",children:"Add or remove this schema from all existing pages on your site"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{size:"sm",className:"text-xs",variant:"outline",onClick:()=>N(!0),children:"Add to all existing"}),e.jsx(s.Button,{size:"sm",variant:"ghost",className:"text-xs",onClick:()=>g(!0),children:"Remove from all"})]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-name",children:"Schema Name"}),e.jsx(s.Input,{id:"edit-name",value:n.name,onChange:m=>r({...n,name:m.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-description",children:"Description"}),e.jsx(s.Input,{id:"edit-description",value:n.description||"",onChange:m=>r({...n,description:m.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"edit-content",value:n.content||"{}",onChange:m=>r({...n,content:m}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!A&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"edit-enabled",checked:n.enabledByDefaultForNewPages,onChange:m=>r({...n,enabledByDefaultForNewPages:m.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"edit-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:i,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:i,type:"button",size:"sm",onClick:w,children:i?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Updating"]}):"Update Schema"})]})})]}),e.jsx(s.AlertDialog,{open:p,onOpenChange:N,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Add to All Existing Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will add the schema ",e.jsx("span",{className:"font-medium",children:n.name})," to all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:F,children:"Add to All"})]})]})}),e.jsx(s.AlertDialog,{open:S,onOpenChange:g,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Remove from All Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will remove the schema ",e.jsx("span",{className:"font-medium",children:n.name})," from all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:C,className:"bg-red-500 hover:bg-red-600",children:"Remove from All"})]})]})})]})};function Q(){const[t,d]=x.useState(!1),[n,r]=x.useState(void 0),[p,N]=x.useState(null),[S,g]=x.useState(null),[A,j]=x.useState(null),{data:u,isLoading:v}=q(),{selectedLang:i}=s.useLanguages(),{data:l}=c.useChaiCurrentPage(),{data:b}=c.useLanguagePages(),{mutateAsync:w}=c.useDeleteGlobalSchema(),{mutateAsync:F}=c.useTogglePageGlobalSchema(),C=x.useMemo(()=>b==null?void 0:b.find(a=>!a.primaryPage&&a.lang===""),[b]),m=x.useMemo(()=>(C==null?void 0:C.globalJsonLds)||[],[C]),T=x.useMemo(()=>u?G.filter(u,o=>o.primaryPage===null&&o.lang==="").map(o=>{const h=i?G.find(u,D=>D.primaryPage===o.id&&D.lang===i):null;return{defaultSchema:o,languageVersion:h,displayItem:h||o,hasLanguageVersion:!!h}}):[],[u,i]),[y,P]=x.useState([]),L=y.length>0?y:(l==null?void 0:l.globalJsonLds)||[];x.useEffect(()=>{l!=null&&l.globalJsonLds&&P(l.globalJsonLds)},[l==null?void 0:l.globalJsonLds]);const z=async a=>{if(!(l!=null&&l.id))return;j(a);const o=L.includes(a),h=o?L.filter(D=>D!==a):[...L,a];P(h);try{await F({schemaId:a,pageId:l.id,enabled:!o})}catch{P(l.globalJsonLds)}finally{j(null)}},R=async a=>{j(a);try{await w(a)}finally{j(null)}};return e.jsxs("div",{className:"rounded border bg-muted p-2",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:"Shared JSON-LD Templates"}),e.jsx("div",{className:"w-full text-xs text-gray-500",children:"Manage reusable JSON-LD schemas that can be applied across multiple pages"})]}),!i&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{type:"button",disabled:v,className:"rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",onClick:a=>{a.stopPropagation(),d(!0)},children:v?e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"}):e.jsx(f.Plus,{className:"h-4 w-4"})}),e.jsx(s.TooltipContent,{children:"Add new schema"})]})]}),e.jsxs(s.ScrollArea,{className:"max-h-96 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-2",children:[(!u||(u==null?void 0:u.length)===0)&&!v&&e.jsx("div",{className:"flex items-center justify-center px-2 py-4 text-xs",children:"No shared JSON-LD found"}),T.map(({defaultSchema:a,displayItem:o,hasLanguageVersion:h})=>{var k,B;const D=L.includes(o.id),O=m.includes(a.id),J=h&&i?O:D;return e.jsxs(s.Card,{className:`relative border-gray-300 p-0 shadow-none transition-all ${A===o.id?"pointer-events-none":""}`,children:[A===o.id&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center rounded-xl bg-white/80",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin text-primary"})}),e.jsx(s.CardHeader,{className:"p-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[(h||!i)&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx("input",{type:"checkbox",checked:J,onChange:()=>z(a.id),disabled:!!(h&&i),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"})}),h&&i&&e.jsx(s.TooltipContent,{children:"Using the default language state"})]}),e.jsxs("div",{children:[e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-sm leading-none",children:[o.name,h&&i&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",i,")"]}),J&&e.jsx("span",{className:"sr-only text-xs font-normal text-muted-foreground",children:"Enabled"})]}),((k=o==null?void 0:o.metadata)==null?void 0:k.description)&&e.jsx("p",{className:"mt-1 text-xs leading-none text-muted-foreground",children:(B=o==null?void 0:o.metadata)==null?void 0:B.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"mx-2 h-6 w-px bg-border"}),e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>g(o.id),children:e.jsx(f.Eye,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"View schema"})]}),(h||!i)&&e.jsxs(e.Fragment,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>N(o.id),children:e.jsx(f.Edit,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Edit schema"})]}),e.jsxs(s.AlertDialog,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.AlertDialogTrigger,{className:"flex h-5 w-5 items-center justify-center rounded-md text-red-500 hover:bg-red-100 hover:text-red-800",children:e.jsx(f.Trash,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Delete schema"})]}),e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Schema"}),e.jsxs(s.AlertDialogDescription,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium",children:o.name}),"? This action cannot be undone."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{type:"button",children:"Cancel"}),e.jsx(s.AlertDialogAction,{type:"button",onClick:()=>R(o.id),className:"bg-red-500 text-white hover:bg-red-600",children:"Delete"})]})]})]})]})]})]})}),!h&&i&&e.jsx(s.CardContent,{className:"px-2 pb-2",children:e.jsxs("div",{className:"flex w-full flex-col items-center justify-center rounded-lg border bg-gray-100 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"max-w-xl text-center text-xs text-gray-500",children:["Not available in '",i,"' language. Default language JSONLD will be used."]}),O&&e.jsx("span",{className:"rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700",children:"Enabled in default"})]}),e.jsx(s.Button,{type:"button",size:"sm",variant:"outline",className:"mt-2",onClick:()=>{r({name:a.name,description:a.description||"",jsonld:a.jsonld,languageCode:i,primaryPageId:a.id}),d(!0)},children:"Copy & Edit from default language"})]})})]},a.id)})]}),v&&e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin"})})]}),e.jsx(M,{show:t,onClose:()=>{d(!1),r(void 0)},initialData:n}),e.jsx(_,{id:p,onClose:()=>N(null)}),e.jsx(V,{schema:u==null?void 0:u.find(a=>a.id===S),onClose:()=>g(null)})]})}const V=({schema:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:d,children:e.jsxs(s.DialogContent,{className:"max-w-2xl",children:[e.jsx(s.DialogHeader,{children:e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[t==null?void 0:t.name,(t==null?void 0:t.lang)&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",t.lang,")"]})]})}),e.jsxs("div",{className:"space-y-3",children:[(t==null?void 0:t.description)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),e.jsx("div",{className:"text-sm",children:t.description})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"JSON-LD Schema"}),e.jsx(s.Textarea,{value:JSON.stringify(t==null?void 0:t.jsonld,null,2),readOnly:!0,className:"font-mono text-xs",rows:15})]})]})]})});exports.default=Q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("./index-DF5DEvqb.cjs"),c=require("./index-WQwzsC7A.cjs"),I=require("@tanstack/react-query"),G=require("lodash-es"),f=require("lucide-react"),x=require("react"),E=require("sonner"),q=()=>{const t=c.useApiUrl(),d=c.useFetch();return I.useQuery({queryKey:[c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS],queryFn:async()=>d(t,{action:c.ACTIONS.GET_GLOBAL_JSONLD_ITEMS})})},M=({show:t,onClose:d,initialData:n})=>e.jsx(s.Dialog,{open:t,onOpenChange:()=>d(),children:t&&e.jsx(U,{show:t,onClose:d,initialData:n})}),U=({show:t,onClose:d,initialData:n})=>{const[r,p]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[N,S]=x.useState(!1),{data:g}=c.useChaiCurrentPage(),{mutateAsync:A,isPending:j}=c.useAddGlobalSchema(),{mutateAsync:u}=c.useTogglePageGlobalSchema(),v=I.useQueryClient();x.useEffect(()=>{p(n?{name:n.name,description:n.description,content:JSON.stringify(n.jsonld,null,2),enabledByDefaultForNewPages:!1}:{name:"",description:"",content:"",enabledByDefaultForNewPages:!1}),S(!1)},[t,n]);const i=async()=>{if(!r.name||!r.content){E.toast.error("Please enter a name and content");return}const l=c.parseJSONWithPlaceholders(r.content);if(!l.isValid){E.toast.error("Invalid JSON-LD content");return}const b={name:r.name,jsonld:l.parsed,addToExistingPages:N,addToNewPages:r.enabledByDefaultForNewPages,description:r.description};n!=null&&n.primaryPageId&&(b.primaryPage=n.primaryPageId);const w=await A(b);g!=null&&g.id&&(w!=null&&w.id)&&!(n!=null&&n.primaryPageId)&&(await u({schemaId:w.id,pageId:g.id,enabled:!0}),v.invalidateQueries({queryKey:[c.ACTIONS.GET_LANGUAGE_PAGES,g.id]})),d()};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Add New Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[(n==null?void 0:n.languageCode)&&e.jsxs(s.Alert,{className:"border-blue-200 bg-blue-50",children:[e.jsx(f.Info,{className:"h-4 w-4 text-blue-600"}),e.jsxs(s.AlertDescription,{className:"text-sm text-blue-800",children:["You are creating a ",e.jsx("span",{className:"font-semibold",children:n.languageCode})," language version of this schema. This will be linked to the default language schema."]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-name",children:"Schema Name"}),e.jsx(s.Input,{id:"new-name",value:r.name,onChange:l=>p({...r,name:l.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-description",children:"Description"}),e.jsx(s.Input,{id:"new-description",value:r.description||"",onChange:l=>p({...r,description:l.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"new-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"new-content",value:r.content||"{}",onChange:l=>p({...r,content:l}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!(n!=null&&n.primaryPageId)&&e.jsxs("div",{className:"flex flex-col gap-3 pt-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"add-to-all-existing",checked:N,onChange:l=>S(l.target.checked),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"add-to-all-existing",children:[e.jsx("div",{children:"Add to all existing pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"This schema will be added to all existing pages on your site"})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"new-enabled",checked:r.enabledByDefaultForNewPages,onChange:l=>p({...r,enabledByDefaultForNewPages:l.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"new-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:j,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:j,type:"button",size:"sm",onClick:i,children:j?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Adding"]}):e.jsxs(e.Fragment,{children:["Add Schema",(n==null?void 0:n.languageCode)&&` (${n.languageCode})`]})})]})})]})]})},_=({id:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:()=>d(),children:t&&e.jsx(H,{id:t,onClose:d})}),H=({id:t,onClose:d})=>{const[n,r]=x.useState({name:"",content:"",description:"",enabledByDefaultForNewPages:!1}),[p,N]=x.useState(!1),[S,g]=x.useState(!1),[A,j]=x.useState(!1),{data:u}=q(),{mutateAsync:v,isPending:i}=c.useUpdateGlobalSchema(),{mutateAsync:l}=c.useApplySchemaToAllPages(),{mutateAsync:b}=c.useRemoveSchemaFromAllPages();x.useEffect(()=>{var m,T;if(t&&u){const y=u.find(P=>P.id===t);y&&(r({name:y.name,description:((m=y.metadata)==null?void 0:m.description)||"",content:JSON.stringify(y.jsonld,null,2),enabledByDefaultForNewPages:((T=y.metadata)==null?void 0:T.addToNewPages)||!1}),j(!!y.primaryPage))}},[t,u]);const w=async()=>{if(!n.name||!n.content){E.toast.error("Please enter a name and content");return}const m=c.parseJSONWithPlaceholders(n.content);if(!m.isValid){E.toast.error("Invalid JSON-LD content");return}const T={id:t,name:n.name,jsonld:m.parsed,addToNewPages:n.enabledByDefaultForNewPages,description:n.description};await v(T),d()},F=async()=>{try{await l(t)}finally{N(!1)}},C=async()=>{try{await b(t)}finally{g(!1)}};return e.jsxs(s.DialogContent,{className:"flex max-w-xl flex-col overflow-y-auto",children:[e.jsx(s.DialogHeader,{children:e.jsx(s.DialogTitle,{children:"Edit Shared JSON-LD Schema"})}),e.jsxs("div",{className:"flex max-h-[75vh] flex-col space-y-2 overflow-y-auto",children:[!A&&e.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-blue-300 bg-blue-500/10 p-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-sm font-medium text-blue-900",children:"Manage Existing Pages"}),e.jsx("div",{className:"text-xs text-blue-700",children:"Add or remove this schema from all existing pages on your site"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(s.Button,{size:"sm",className:"text-xs",variant:"outline",onClick:()=>N(!0),children:"Add to all existing"}),e.jsx(s.Button,{size:"sm",variant:"ghost",className:"text-xs",onClick:()=>g(!0),children:"Remove from all"})]})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-name",children:"Schema Name"}),e.jsx(s.Input,{id:"edit-name",value:n.name,onChange:m=>r({...n,name:m.target.value}),placeholder:"e.g., Product Schema",className:"text-xs"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-description",children:"Description"}),e.jsx(s.Input,{id:"edit-description",value:n.description||"",onChange:m=>r({...n,description:m.target.value}),placeholder:"Brief description of this schema"})]}),e.jsxs("div",{children:[e.jsx(s.Label,{htmlFor:"edit-content",children:"JSON-LD Content"}),e.jsx(c.SmartJsonInput,{id:"edit-content",value:n.content||"{}",onChange:m=>r({...n,content:m}),placeholder:"Enter JSON-LD markup...",rows:10})]}),!A&&e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"edit-enabled",checked:n.enabledByDefaultForNewPages,onChange:m=>r({...n,enabledByDefaultForNewPages:m.target.checked}),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"}),e.jsxs(s.Label,{htmlFor:"edit-enabled",children:[e.jsx("div",{children:"Enabled by default for new pages"}),e.jsx("div",{className:"text-xs font-light text-muted-foreground",children:"New pages will automatically include this schema"})]})]}),e.jsx("div",{className:"border-t pt-3",children:e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[e.jsx(s.Button,{disabled:i,variant:"outline",type:"button",size:"sm",onClick:()=>d(),children:"Cancel"}),e.jsx(s.Button,{disabled:i,type:"button",size:"sm",onClick:w,children:i?e.jsxs(e.Fragment,{children:[e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"})," Updating"]}):"Update Schema"})]})})]}),e.jsx(s.AlertDialog,{open:p,onOpenChange:N,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Add to All Existing Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will add the schema ",e.jsx("span",{className:"font-medium",children:n.name})," to all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:F,children:"Add to All"})]})]})}),e.jsx(s.AlertDialog,{open:S,onOpenChange:g,children:e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Remove from All Pages?"}),e.jsxs(s.AlertDialogDescription,{children:["This will remove the schema ",e.jsx("span",{className:"font-medium",children:n.name})," from all existing pages on your site. This action cannot be undone automatically."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{children:"Cancel"}),e.jsx(s.AlertDialogAction,{onClick:C,className:"bg-red-500 hover:bg-red-600",children:"Remove from All"})]})]})})]})};function Q(){const[t,d]=x.useState(!1),[n,r]=x.useState(void 0),[p,N]=x.useState(null),[S,g]=x.useState(null),[A,j]=x.useState(null),{data:u,isLoading:v}=q(),{selectedLang:i}=s.useLanguages(),{data:l}=c.useChaiCurrentPage(),{data:b}=c.useLanguagePages(),{mutateAsync:w}=c.useDeleteGlobalSchema(),{mutateAsync:F}=c.useTogglePageGlobalSchema(),C=x.useMemo(()=>b==null?void 0:b.find(a=>!a.primaryPage&&a.lang===""),[b]),m=x.useMemo(()=>(C==null?void 0:C.globalJsonLds)||[],[C]),T=x.useMemo(()=>u?G.filter(u,o=>o.primaryPage===null&&o.lang==="").map(o=>{const h=i?G.find(u,D=>D.primaryPage===o.id&&D.lang===i):null;return{defaultSchema:o,languageVersion:h,displayItem:h||o,hasLanguageVersion:!!h}}):[],[u,i]),[y,P]=x.useState([]),L=y.length>0?y:(l==null?void 0:l.globalJsonLds)||[];x.useEffect(()=>{l!=null&&l.globalJsonLds&&P(l.globalJsonLds)},[l==null?void 0:l.globalJsonLds]);const z=async a=>{if(!(l!=null&&l.id))return;j(a);const o=L.includes(a),h=o?L.filter(D=>D!==a):[...L,a];P(h);try{await F({schemaId:a,pageId:l.id,enabled:!o})}catch{P(l.globalJsonLds)}finally{j(null)}},R=async a=>{j(a);try{await w(a)}finally{j(null)}};return e.jsxs("div",{className:"rounded border bg-muted p-2",children:[e.jsxs("div",{className:"flex items-center justify-between pb-2",children:[e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium",children:"Shared JSON-LD Templates"}),e.jsx("div",{className:"w-full text-xs text-gray-500",children:"Manage reusable JSON-LD schemas that can be applied across multiple pages"})]}),!i&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{type:"button",disabled:v,className:"rounded-full bg-primary p-1 text-primary-foreground hover:bg-primary/80",onClick:a=>{a.stopPropagation(),d(!0)},children:v?e.jsx(f.Loader,{className:"h-4 w-4 animate-spin"}):e.jsx(f.Plus,{className:"h-4 w-4"})}),e.jsx(s.TooltipContent,{children:"Add new schema"})]})]}),e.jsxs(s.ScrollArea,{className:"max-h-96 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-2",children:[(!u||(u==null?void 0:u.length)===0)&&!v&&e.jsx("div",{className:"flex items-center justify-center px-2 py-4 text-xs",children:"No shared JSON-LD found"}),T.map(({defaultSchema:a,displayItem:o,hasLanguageVersion:h})=>{var k,B;const D=L.includes(o.id),O=m.includes(a.id),J=h&&i?O:D;return e.jsxs(s.Card,{className:`relative border-gray-300 p-0 shadow-none transition-all ${A===o.id?"pointer-events-none":""}`,children:[A===o.id&&e.jsx("div",{className:"absolute bottom-0 left-0 right-0 top-0 z-50 flex items-center justify-center rounded-xl bg-white/80",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin text-primary"})}),e.jsx(s.CardHeader,{className:"p-2",children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[(h||!i)&&e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx("input",{type:"checkbox",checked:J,onChange:()=>z(a.id),disabled:!!(h&&i),className:"h-5 w-5 cursor-pointer rounded focus:outline-none focus:ring-2 focus:ring-primary focus:ring-offset-1"})}),h&&i&&e.jsx(s.TooltipContent,{children:"Using the default language state"})]}),e.jsxs("div",{children:[e.jsxs(s.CardTitle,{className:"flex items-center gap-2 text-sm leading-none",children:[o.name,h&&i&&e.jsxs("span",{className:"text-xs font-normal text-muted-foreground",children:["(",i,")"]}),J&&e.jsx("span",{className:"sr-only text-xs font-normal text-muted-foreground",children:"Enabled"})]}),((k=o==null?void 0:o.metadata)==null?void 0:k.description)&&e.jsx("p",{className:"mt-1 text-xs leading-none text-muted-foreground",children:(B=o==null?void 0:o.metadata)==null?void 0:B.description})]})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"mx-2 h-6 w-px bg-border"}),e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>g(o.id),children:e.jsx(f.Eye,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"View schema"})]}),(h||!i)&&e.jsxs(e.Fragment,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.Button,{type:"button",variant:"ghost",size:"icon",className:"h-5 w-5 p-0",onClick:()=>N(o.id),children:e.jsx(f.Edit,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Edit schema"})]}),e.jsxs(s.AlertDialog,{children:[e.jsxs(s.Tooltip,{delayDuration:0,children:[e.jsx(s.TooltipTrigger,{asChild:!0,children:e.jsx(s.AlertDialogTrigger,{className:"flex h-5 w-5 items-center justify-center rounded-md text-red-500 hover:bg-red-100 hover:text-red-800",children:e.jsx(f.Trash,{className:"h-4 w-4"})})}),e.jsx(s.TooltipContent,{children:"Delete schema"})]}),e.jsxs(s.AlertDialogContent,{children:[e.jsxs(s.AlertDialogHeader,{children:[e.jsx(s.AlertDialogTitle,{children:"Delete Schema"}),e.jsxs(s.AlertDialogDescription,{children:["Are you sure you want to delete"," ",e.jsx("span",{className:"font-medium",children:o.name}),"? This action cannot be undone."]})]}),e.jsxs(s.AlertDialogFooter,{children:[e.jsx(s.AlertDialogCancel,{type:"button",children:"Cancel"}),e.jsx(s.AlertDialogAction,{type:"button",onClick:()=>R(o.id),className:"bg-red-500 text-white hover:bg-red-600",children:"Delete"})]})]})]})]})]})]})}),!h&&i&&e.jsx(s.CardContent,{className:"px-2 pb-2",children:e.jsxs("div",{className:"flex w-full flex-col items-center justify-center rounded-lg border bg-gray-100 py-3",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("div",{className:"max-w-xl text-center text-xs text-gray-500",children:["Not available in '",i,"' language. Default language JSONLD will be used."]}),O&&e.jsx("span",{className:"rounded-full bg-green-100 px-2 py-0.5 text-xs font-medium text-green-700",children:"Enabled in default"})]}),e.jsx(s.Button,{type:"button",size:"sm",variant:"outline",className:"mt-2",onClick:()=>{r({name:a.name,description:a.description||"",jsonld:a.jsonld,languageCode:i,primaryPageId:a.id}),d(!0)},children:"Copy & Edit from default language"})]})})]},a.id)})]}),v&&e.jsx("div",{className:"flex items-center justify-center p-4",children:e.jsx(f.Loader,{className:"h-5 w-5 animate-spin"})})]}),e.jsx(M,{show:t,onClose:()=>{d(!1),r(void 0)},initialData:n}),e.jsx(_,{id:p,onClose:()=>N(null)}),e.jsx(V,{schema:u==null?void 0:u.find(a=>a.id===S),onClose:()=>g(null)})]})}const V=({schema:t,onClose:d})=>e.jsx(s.Dialog,{open:!!t,onOpenChange:d,children:e.jsxs(s.DialogContent,{className:"max-w-2xl",children:[e.jsx(s.DialogHeader,{children:e.jsxs(s.DialogTitle,{className:"flex items-center gap-2",children:[t==null?void 0:t.name,(t==null?void 0:t.lang)&&e.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",t.lang,")"]})]})}),e.jsxs("div",{className:"space-y-3",children:[(t==null?void 0:t.description)&&e.jsxs("div",{children:[e.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),e.jsx("div",{className:"text-sm",children:t.description})]}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-xs font-medium text-muted-foreground",children:"JSON-LD Schema"}),e.jsx(s.Textarea,{value:JSON.stringify(t==null?void 0:t.jsonld,null,2),readOnly:!0,className:"font-mono text-xs",rows:15})]})]})]})});exports.default=Q;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as i, jsx as o } from "react/jsx-runtime";
2
- import { ab as d, I as v } from "./index-S8ibZk9Q.js";
2
+ import { ab as d, I as v } from "./index-Ct7ElCGK.js";
3
3
  import { useState as x, useEffect as C } from "react";
4
4
  const y = (e) => {
5
5
  if (!e) return { base: e, extension: null };
@@ -1 +1 @@
1
- "use strict";const s=require("react/jsx-runtime"),i=require("./index-CnSjWE1P.cjs"),d=require("react"),b=e=>{if(!e)return{base:e,extension:null};const n=e.lastIndexOf(".");if(n<=0)return{base:e,extension:null};const t=e.substring(n);return{base:e.substring(0,n),extension:t}},x=e=>{if(!e)return e;const{base:n}=b(e);return n};function j(e,n){const t=(e||"").split("/").filter(Boolean);let r="",a=!0;if(n.slug==="/"){const l=t.pop()||"";if(i.LANGUAGES[l])a=!0;else{r=l;const o=t.pop()||"";a=!!i.LANGUAGES[o]}}else if(n.parent)t.length&&(r=t.pop()||"");else if(t.length){r=t.pop()||"";const l=t.pop()||"";a=!!i.LANGUAGES[l]}return{initSlug:r,prefix:a}}const E=e=>e&&x(e),v=(e,n)=>{const t=x(e||"");return!t||t==="/"?`/${n}`:`${t}/${n}`};function C({value:e,onChange:n,placeholder:t,parentSlug:r,onValidationChange:a,disabled:l=!1,fullSlug:o}){const[g,p]=d.useState(e),[c,f]=d.useState(null);d.useEffect(()=>{p(e)},[e]);const h=S=>{const u=S.target.value.replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),m=(u.match(/\./g)||[]).length,N=m<=1;m>1?f("Invalid slug. Only one dot (.) is allowed in the slug"):f(null),a&&a(N),p(u),n(u)};return s.jsxs("div",{children:[r&&s.jsx("div",{className:"mb-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Parent: ",s.jsx("span",{className:"font-mono text-gray-900",children:E(r)})]})}),s.jsxs("div",{className:"relative",children:[s.jsx(i.Input,{disabled:l,value:g,onChange:h,placeholder:t,className:c?"border-red-500":""}),c&&s.jsx("div",{className:"mt-1 text-xs text-red-500",children:c})]}),o&&o!=="undefined"&&s.jsx("div",{className:"mt-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Complete Slug: ",s.jsx("span",{className:"font-mono text-gray-900",children:o})]})})]})}exports.SlugInput=C;exports.combineParentChildSlugs=v;exports.parseSlugForEdit=j;exports.removeSlugExtension=x;
1
+ "use strict";const s=require("react/jsx-runtime"),i=require("./index-DF5DEvqb.cjs"),d=require("react"),b=e=>{if(!e)return{base:e,extension:null};const n=e.lastIndexOf(".");if(n<=0)return{base:e,extension:null};const t=e.substring(n);return{base:e.substring(0,n),extension:t}},x=e=>{if(!e)return e;const{base:n}=b(e);return n};function j(e,n){const t=(e||"").split("/").filter(Boolean);let r="",a=!0;if(n.slug==="/"){const l=t.pop()||"";if(i.LANGUAGES[l])a=!0;else{r=l;const o=t.pop()||"";a=!!i.LANGUAGES[o]}}else if(n.parent)t.length&&(r=t.pop()||"");else if(t.length){r=t.pop()||"";const l=t.pop()||"";a=!!i.LANGUAGES[l]}return{initSlug:r,prefix:a}}const E=e=>e&&x(e),v=(e,n)=>{const t=x(e||"");return!t||t==="/"?`/${n}`:`${t}/${n}`};function C({value:e,onChange:n,placeholder:t,parentSlug:r,onValidationChange:a,disabled:l=!1,fullSlug:o}){const[g,p]=d.useState(e),[c,f]=d.useState(null);d.useEffect(()=>{p(e)},[e]);const h=S=>{const u=S.target.value.replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),m=(u.match(/\./g)||[]).length,N=m<=1;m>1?f("Invalid slug. Only one dot (.) is allowed in the slug"):f(null),a&&a(N),p(u),n(u)};return s.jsxs("div",{children:[r&&s.jsx("div",{className:"mb-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Parent: ",s.jsx("span",{className:"font-mono text-gray-900",children:E(r)})]})}),s.jsxs("div",{className:"relative",children:[s.jsx(i.Input,{disabled:l,value:g,onChange:h,placeholder:t,className:c?"border-red-500":""}),c&&s.jsx("div",{className:"mt-1 text-xs text-red-500",children:c})]}),o&&o!=="undefined"&&s.jsx("div",{className:"mt-1 flex items-center",children:s.jsxs("span",{className:"text-xs text-gray-500",children:["Complete Slug: ",s.jsx("span",{className:"font-mono text-gray-900",children:o})]})})]})}exports.SlugInput=C;exports.combineParentChildSlugs=v;exports.parseSlugForEdit=j;exports.removeSlugExtension=x;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-CnSjWE1P.cjs"),t=require("./index-CbwxUFy_.cjs"),l=require("lucide-react"),f=require("react"),j=require("react-i18next"),p=()=>{const i=t.useSendRealtimeEvent(),{pageLockMeta:r}=t.usePageLockMeta(),{setPageStatus:d}=t.usePageLockStatus(),{savePageAsync:m}=a.useSavePage(),x=r==null?void 0:r.requestingUserId,{data:s,isFetching:h}=t.useChaiUserInfo(x||""),o=h?"Fetching user...":(s==null?void 0:s.name)||"Current editor",[u,c]=f.useState(!1),g=async()=>{c(!0),await m(),i(t.EVENT.CONTINUE_EDITING_IN_THIS_CLIENT,r),d(t.PAGE_STATUS.CHECKING),setTimeout(()=>c(!1),2e3)},N=()=>{c(!0),i(t.EVENT.TAKE_OVER_REJECTED,r),d(t.PAGE_STATUS.EDITING),setTimeout(()=>c(!1),2e3)},{t:n}=j.useTranslation();return e.jsx(t.BlurContainer,{children:e.jsxs(a.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(a.CardHeader,{className:"space-y-1",children:e.jsxs(a.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"}),n("Take Over Requested")]})}),e.jsxs(a.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})," ",n("has requested to")," ",e.jsx("span",{className:"font-medium text-gray-500",children:"take over"})," ",n("editing this page."),"."," ",n("Do you want to allow them to continue?")]})]}),e.jsxs(a.CardFooter,{className:"flex gap-2",children:[e.jsxs(a.Button,{disabled:u,variant:"default",onClick:g,className:"flex-1 gap-2",children:[e.jsx(l.Check,{className:"h-4 w-4"}),n("Accept")]}),e.jsxs(a.Button,{disabled:u,variant:"outline",onClick:N,className:"flex-1 gap-2",children:[e.jsx(l.X,{className:"h-4 w-4"}),n("Reject")]})]})]})})};exports.default=p;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-DF5DEvqb.cjs"),t=require("./index-WQwzsC7A.cjs"),l=require("lucide-react"),f=require("react"),j=require("react-i18next"),p=()=>{const i=t.useSendRealtimeEvent(),{pageLockMeta:r}=t.usePageLockMeta(),{setPageStatus:d}=t.usePageLockStatus(),{savePageAsync:m}=a.useSavePage(),x=r==null?void 0:r.requestingUserId,{data:s,isFetching:h}=t.useChaiUserInfo(x||""),o=h?"Fetching user...":(s==null?void 0:s.name)||"Current editor",[u,c]=f.useState(!1),g=async()=>{c(!0),await m(),i(t.EVENT.CONTINUE_EDITING_IN_THIS_CLIENT,r),d(t.PAGE_STATUS.CHECKING),setTimeout(()=>c(!1),2e3)},N=()=>{c(!0),i(t.EVENT.TAKE_OVER_REJECTED,r),d(t.PAGE_STATUS.EDITING),setTimeout(()=>c(!1),2e3)},{t:n}=j.useTranslation();return e.jsx(t.BlurContainer,{children:e.jsxs(a.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(a.CardHeader,{className:"space-y-1",children:e.jsxs(a.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"}),n("Take Over Requested")]})}),e.jsxs(a.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})," ",n("has requested to")," ",e.jsx("span",{className:"font-medium text-gray-500",children:"take over"})," ",n("editing this page."),"."," ",n("Do you want to allow them to continue?")]})]}),e.jsxs(a.CardFooter,{className:"flex gap-2",children:[e.jsxs(a.Button,{disabled:u,variant:"default",onClick:g,className:"flex-1 gap-2",children:[e.jsx(l.Check,{className:"h-4 w-4"}),n("Accept")]}),e.jsxs(a.Button,{disabled:u,variant:"outline",onClick:N,className:"flex-1 gap-2",children:[e.jsx(l.X,{className:"h-4 w-4"}),n("Reject")]})]})]})})};exports.default=p;
@@ -1,6 +1,6 @@
1
1
  import { jsx as a, jsxs as t } from "react/jsx-runtime";
2
- import { V as N, W as C, X as b, Y as v, Z as E, _ as T, B as d } from "./index-S8ibZk9Q.js";
3
- import { ao as w, b as I, a as k, ap as y, B as R, E as m, P as u } from "./index-BDnwJqMw.js";
2
+ import { V as N, W as C, X as b, Y as v, Z as E, _ as T, B as d } from "./index-Ct7ElCGK.js";
3
+ import { ao as w, b as I, a as k, ap as y, B as R, E as m, P as u } from "./index-ZuacEL1j.js";
4
4
  import { AlertCircle as S, UserIcon as _, Check as A, X as P } from "lucide-react";
5
5
  import { useState as q } from "react";
6
6
  import { useTranslation as U } from "react-i18next";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CnSjWE1P.cjs"),s=require("./index-CbwxUFy_.cjs"),d=require("react-i18next"),h=()=>{const[n]=t.useTheme(),{mutate:c,isPending:i}=s.usePublishPages(),{mutateAsync:a,isPending:o}=s.useUpdateWebsiteSettings(),{t:r}=d.useTranslation(),u=()=>{a({settings:{theme:n}})},l=async()=>{await a({settings:{theme:n}}),c({ids:["THEME"]},{onSuccess:()=>{s.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(t.Button,{size:"sm",variant:"outline",disabled:i||o,onClick:u,children:r("Save draft")}),e.jsx(t.Button,{size:"sm",disabled:i||o,onClick:l,children:r("Publish")})]})};exports.default=h;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DF5DEvqb.cjs"),s=require("./index-WQwzsC7A.cjs"),d=require("react-i18next"),h=()=>{const[n]=t.useTheme(),{mutate:c,isPending:i}=s.usePublishPages(),{mutateAsync:a,isPending:o}=s.useUpdateWebsiteSettings(),{t:r}=d.useTranslation(),u=()=>{a({settings:{theme:n}})},l=async()=>{await a({settings:{theme:n}}),c({ids:["THEME"]},{onSuccess:()=>{s.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(t.Button,{size:"sm",variant:"outline",disabled:i||o,onClick:u,children:r("Save draft")}),e.jsx(t.Button,{size:"sm",disabled:i||o,onClick:l,children:r("Publish")})]})};exports.default=h;
@@ -1,6 +1,6 @@
1
1
  import { jsxs as c, jsx as a } from "react/jsx-runtime";
2
- import { h, B as o } from "./index-S8ibZk9Q.js";
3
- import { e as d, f as u, t as b } from "./index-BDnwJqMw.js";
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
4
  import { useTranslation as f } from "react-i18next";
5
5
  const x = () => {
6
6
  const [e] = h(), { mutate: r, isPending: s } = d(), { mutateAsync: t, isPending: i } = u(), { t: n } = f(), l = () => {
@@ -1,5 +1,5 @@
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-S8ibZk9Q.js";
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
3
  const b = ({
4
4
  isOpen: l,
5
5
  onClose: o,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("./index-CnSjWE1P.cjs"),d=({isOpen:l,onClose:o,onContinue:i,isPending:a=!1,title:t="Translation Warning",description:s="Some blocks need translations before publishing. Do you want to continue anyway?"})=>{const r=()=>{o()},c=()=>{i()};return n.jsx(e.Dialog,{open:l,onOpenChange:o,children:l&&n.jsxs(e.DialogContent,{className:"sm:max-w-[425px]",children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:t}),n.jsx(e.DialogDescription,{children:s})]}),n.jsxs(e.DialogFooter,{className:"flex gap-2",children:[n.jsx(e.Button,{variant:"outline",onClick:r,disabled:a,children:"Cancel"}),n.jsx(e.Button,{onClick:c,disabled:a,children:a?"Publishing...":"Continue Anyway"})]})]})})};exports.default=d;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("./index-DF5DEvqb.cjs"),d=({isOpen:l,onClose:o,onContinue:i,isPending:a=!1,title:t="Translation Warning",description:s="Some blocks need translations before publishing. Do you want to continue anyway?"})=>{const r=()=>{o()},c=()=>{i()};return n.jsx(e.Dialog,{open:l,onOpenChange:o,children:l&&n.jsxs(e.DialogContent,{className:"sm:max-w-[425px]",children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:t}),n.jsx(e.DialogDescription,{children:s})]}),n.jsxs(e.DialogFooter,{className:"flex gap-2",children:[n.jsx(e.Button,{variant:"outline",onClick:r,disabled:a,children:"Cancel"}),n.jsx(e.Button,{onClick:c,disabled:a,children:a?"Publishing...":"Continue Anyway"})]})]})})};exports.default=d;
@@ -1,6 +1,6 @@
1
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-S8ibZk9Q.js";
3
- import { r as k } from "./index-BDnwJqMw.js";
2
+ import { D as p, d as u, e as d, f, p as g, q as h, B as r } from "./index-Ct7ElCGK.js";
3
+ import { r as k } from "./index-ZuacEL1j.js";
4
4
  import { useState as D } from "react";
5
5
  import { useTranslation as x } from "react-i18next";
6
6
  const C = ({ page: i, onClose: t }) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-CnSjWE1P.cjs"),u=require("./index-CbwxUFy_.cjs"),d=require("react"),p=require("react-i18next"),m=({page:o,onClose:n})=>{const{t:a}=p.useTranslation(),[r,s]=d.useState(!1),i=u.useUnmarkAsTemplate(),l=()=>{s(!0),i.mutate(o,{onSuccess:()=>{s(!1),n()},onError:()=>{s(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:n,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:a("Unmark as template")}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:a("Are you sure you want to unmark this page as a template?")})]}),e.jsxs(t.DialogFooter,{className:r?"pointer-events-none opacity-75":"",children:[e.jsx(t.Button,{variant:"outline",onClick:c=>{c.stopPropagation(),n()},children:a("Cancel")}),e.jsx(t.Button,{variant:"default",disabled:r,onClick:l,children:a("Unmark as template")})]})]})})};exports.default=m;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DF5DEvqb.cjs"),u=require("./index-WQwzsC7A.cjs"),d=require("react"),p=require("react-i18next"),m=({page:o,onClose:n})=>{const{t:a}=p.useTranslation(),[r,s]=d.useState(!1),i=u.useUnmarkAsTemplate(),l=()=>{s(!0),i.mutate(o,{onSuccess:()=>{s(!1),n()},onError:()=>{s(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:n,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:a("Unmark as template")}),e.jsx(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:a("Are you sure you want to unmark this page as a template?")})]}),e.jsxs(t.DialogFooter,{className:r?"pointer-events-none opacity-75":"",children:[e.jsx(t.Button,{variant:"outline",onClick:c=>{c.stopPropagation(),n()},children:a("Cancel")}),e.jsx(t.Button,{variant:"default",disabled:r,onClick:l,children:a("Unmark as template")})]})]})})};exports.default=m;
@@ -1,6 +1,6 @@
1
1
  import { jsx as s, jsxs as o } from "react/jsx-runtime";
2
- import { D as c, d as u, e as d, f as h, p as m, q as b, B as r } from "./index-S8ibZk9Q.js";
3
- import { s as D } from "./index-BDnwJqMw.js";
2
+ import { D as c, d as u, e as d, f as h, p as m, q as b, B as r } from "./index-Ct7ElCGK.js";
3
+ import { s as D } from "./index-ZuacEL1j.js";
4
4
  import { useTranslation as f } from "react-i18next";
5
5
  const g = ({ page: n, onClose: t }) => {
6
6
  const { t: i } = f(), { mutate: e, isPending: l } = D(), a = async () => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("./index-CnSjWE1P.cjs"),u=require("./index-CbwxUFy_.cjs"),c=require("react-i18next"),a=({page:i,onClose:t})=>{const{t:s}=c.useTranslation(),{mutate:l,isPending:r}=u.useUnpublishPage(),o=async()=>{l(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:s("Confirm action")}),n.jsxs(e.DialogDescription,{children:[s("Are you sure you want to unpublish")," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(e.Button,{variant:"outline",onClick:t,children:s("Cancel")}),n.jsx(e.Button,{variant:"destructive",disabled:r,onClick:o,children:s(r?"Updating...":"Unpublish")})]})]})})};exports.default=a;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),e=require("./index-DF5DEvqb.cjs"),u=require("./index-WQwzsC7A.cjs"),c=require("react-i18next"),a=({page:i,onClose:t})=>{const{t:s}=c.useTranslation(),{mutate:l,isPending:r}=u.useUnpublishPage(),o=async()=>{l(i,{onSuccess:t})};return n.jsx(e.Dialog,{open:!!i,onOpenChange:t,children:n.jsxs(e.DialogContent,{children:[n.jsxs(e.DialogHeader,{children:[n.jsx(e.DialogTitle,{children:s("Confirm action")}),n.jsxs(e.DialogDescription,{children:[s("Are you sure you want to unpublish")," ",n.jsx("b",{children:(i==null?void 0:i.name)??(i==null?void 0:i.slug)}),"?"]})]}),n.jsxs(e.DialogFooter,{children:[n.jsx(e.Button,{variant:"outline",onClick:t,children:s("Cancel")}),n.jsx(e.Button,{variant:"destructive",disabled:r,onClick:o,children:s(r?"Updating...":"Unpublish")})]})]})})};exports.default=a;
@@ -1 +1 @@
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-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 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;