@chaibuilder/sdk 4.0.0-beta.32 → 4.0.0-beta.34

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 (157) hide show
  1. package/dist/{2SSKDMRQ-DfXKDvXk.cjs → 2SSKDMRQ-BM-tJzJS.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-pPung-JB.js → 2SSKDMRQ-hkjhJNfh.js} +5 -5
  3. package/dist/{AP7HFJJL-PvPBwV6T.cjs → AP7HFJJL-MEqeM2Ns.cjs} +1 -1
  4. package/dist/{AP7HFJJL-CEJuc_Ox.js → AP7HFJJL-XRxLnRog.js} +1 -1
  5. package/dist/{IconPicker-BJHUCDn4.cjs → IconPicker-Bl4iY4Cu.cjs} +1 -1
  6. package/dist/{IconPicker-D_GRfhwS.js → IconPicker-D5wIkgWK.js} +1 -1
  7. package/dist/{WDYDFRGG-B3FrCE_j.js → WDYDFRGG-8UgG1Mx8.js} +4 -4
  8. package/dist/{WDYDFRGG-BPHlcLi5.cjs → WDYDFRGG-BitFxd1K.cjs} +1 -1
  9. package/dist/{actions-registery-Cy1lqUVI.cjs → actions-registery-Byid-s6S.cjs} +28 -28
  10. package/dist/{actions-registery-Bj-j1k5i.js → actions-registery-CKEzH855.js} +2245 -2067
  11. package/dist/actions.cjs +1 -1
  12. package/dist/actions.js +2 -2
  13. package/dist/{active-in-another-tab-C_Ma7oFU.js → active-in-another-tab-BBrqPDfn.js} +2 -2
  14. package/dist/{active-in-another-tab-WVYf-z5w.cjs → active-in-another-tab-BsdNjSxr.cjs} +1 -1
  15. package/dist/{add-new-language-page-CxW2Vuyr.cjs → add-new-language-page-BJUHnI7Z.cjs} +1 -1
  16. package/dist/{add-new-language-page-DtsBO739.js → add-new-language-page-DvSZenkC.js} +3 -3
  17. package/dist/{add-new-page-BfKt72NF.cjs → add-new-page-BI7qCsmh.cjs} +1 -1
  18. package/dist/add-new-page-Dd16d2mC.js +31 -0
  19. package/dist/{ai-panel-content-dktE9CIO.js → ai-panel-content-CLNgM3Td.js} +5 -5
  20. package/dist/{ai-panel-content-Dfo4jOVB.cjs → ai-panel-content-CcqF0I9F.cjs} +1 -1
  21. package/dist/{ai-panel-default-lang-BbUTXMbm.js → ai-panel-default-lang-BooHb2pz.js} +7 -7
  22. package/dist/{ai-panel-default-lang-GQCtwlPs.cjs → ai-panel-default-lang-XPtfrifL.cjs} +2 -2
  23. package/dist/{ai-panel-other-lang-nCUxwpLX.cjs → ai-panel-other-lang-BwnRUTSF.cjs} +1 -1
  24. package/dist/{ai-panel-other-lang-DIDS-mTi.js → ai-panel-other-lang-CcgIMR3N.js} +13 -13
  25. package/dist/{ai-prompt-input-B2q30bhR.js → ai-prompt-input-AUdUYGNa.js} +13 -13
  26. package/dist/{ai-prompt-input-Dws5BHhQ.cjs → ai-prompt-input-CQ5SJPkx.cjs} +1 -1
  27. package/dist/{ai-translation-prompt-CJVcuWrs.cjs → ai-translation-prompt-BTNGNtbf.cjs} +1 -1
  28. package/dist/{ai-translation-prompt-D87qk3C1.js → ai-translation-prompt-BYUh4Mnb.js} +1 -1
  29. package/dist/apply-binding-Bu5W9YFY.js +940 -0
  30. package/dist/apply-binding-C0xIYKCN.cjs +41 -0
  31. package/dist/{change-password-modal-CVUa60pC.cjs → change-password-modal-CYkUXUa5.cjs} +1 -1
  32. package/dist/{change-password-modal-PahNYs8x.js → change-password-modal-DCd1gdCm.js} +5 -5
  33. package/dist/{code-editor-Cim6jQVF.cjs → code-editor-BC6Z10dU.cjs} +1 -1
  34. package/dist/{code-editor-CWOmKcUc.js → code-editor-DWrVXxeA.js} +1 -1
  35. package/dist/{continue-editing-in-this-client-BYFOU3hH.js → continue-editing-in-this-client-Bdd5Ls6t.js} +2 -2
  36. package/dist/{continue-editing-in-this-client-CW0f2LRk.cjs → continue-editing-in-this-client-D6Wc8hEK.cjs} +1 -1
  37. package/dist/{core-BWQrViOY.cjs → core-czmLeR0h.cjs} +1 -1
  38. package/dist/{core-QlWEXm1d.js → core-nSRy3D7z.js} +16 -15
  39. package/dist/core.cjs +1 -1
  40. package/dist/core.d.ts +14 -2
  41. package/dist/core.js +19 -19
  42. package/dist/{css-import-modal-6bMTRlCg.js → css-import-modal-Cpwll5L-.js} +1 -1
  43. package/dist/{css-import-modal-CXulmaB4.cjs → css-import-modal-FHeYoxo2.cjs} +1 -1
  44. package/dist/default-theme-options-DN-3gIjM.cjs +22 -0
  45. package/dist/{plugin-BSjgGgwo.js → default-theme-options-saBIkWGT.js} +114 -114
  46. package/dist/{delete-page-BDViv7Xm.js → delete-page-DyP68v_N.js} +15 -15
  47. package/dist/delete-page-PQGa6Am5.cjs +1 -0
  48. package/dist/{design-token-usage-D-hrcKz1.cjs → design-token-usage-CoaLw6EJ.cjs} +1 -1
  49. package/dist/{design-token-usage-lf7N_uOk.js → design-token-usage-dR3UlfIC.js} +14 -14
  50. package/dist/{digital-asset-manager-PcYficIX.js → digital-asset-manager-BNj96Pnh.js} +3 -3
  51. package/dist/{digital-asset-manager-CxxhsToc.cjs → digital-asset-manager-Bxkm-jdI.cjs} +1 -1
  52. package/dist/{duplicate-page-DfEA148D.js → duplicate-page-Cg6WnFeY.js} +6 -6
  53. package/dist/{duplicate-page-D2f3HvWX.cjs → duplicate-page-DV_lZ8jF.cjs} +1 -1
  54. package/dist/{dynamic-page-selector-Dz7D1Wdr.cjs → dynamic-page-selector-C8ax7W_D.cjs} +1 -1
  55. package/dist/{dynamic-page-selector-DB__KD2y.js → dynamic-page-selector-DcQiWgiL.js} +12 -12
  56. package/dist/get-chai-builder-theme-C_qofMh_.cjs +1 -0
  57. package/dist/{get-chai-builder-theme-BpuwSLeS.js → get-chai-builder-theme-CyOkIlte.js} +1 -1
  58. package/dist/{image-editor-BdW476J8.cjs → image-editor-C5rYU8Ic.cjs} +1 -1
  59. package/dist/{image-editor-CilPMtAC.js → image-editor-DGp2-ImI.js} +1 -1
  60. package/dist/{index-DsQXiNA_.js → index-94oA-Cgl.js} +3994 -3943
  61. package/dist/index-Bg3Prrc_.cjs +5 -0
  62. package/dist/index-BsloTOgy.cjs +160 -0
  63. package/dist/{index-IQefjAA0.js → index-CDUCqK5V.js} +1912 -1931
  64. package/dist/{json-diff-viewer-BPqY25PU.cjs → json-diff-viewer-CdU-gKRr.cjs} +1 -1
  65. package/dist/{json-diff-viewer-Ci2IbgDn.js → json-diff-viewer-CniMcSHL.js} +34 -34
  66. package/dist/lang-panel-Dg7eZqIm.cjs +1 -0
  67. package/dist/{lang-panel-DlAQr-y9.js → lang-panel-YLNZisL2.js} +13 -13
  68. package/dist/manage-design-tokens-Bct88PT-.js +446 -0
  69. package/dist/manage-design-tokens-CMf-Vk72.cjs +1 -0
  70. package/dist/{manage-design-tokens-modal-9qpcb-EC.js → manage-design-tokens-modal-CeSW9VV_.js} +9 -9
  71. package/dist/manage-design-tokens-modal-YPEBybz3.cjs +1 -0
  72. package/dist/{mark-as-template-DS-tMllK.cjs → mark-as-template-C5rPp_PV.cjs} +1 -1
  73. package/dist/{mark-as-template-DOZL3umP.js → mark-as-template-WJ4kUyZK.js} +7 -7
  74. package/dist/{nested-path-selector-content-CWmPgU-L.cjs → nested-path-selector-content-COErdW8f.cjs} +1 -1
  75. package/dist/{nested-path-selector-content-Be-pbnVl.js → nested-path-selector-content-D0hfMLC6.js} +1 -1
  76. package/dist/{no-language-page-content-C8W0M_Fj.js → no-language-page-content-BLnpbzwT.js} +2 -2
  77. package/dist/{no-language-page-content-DWtEo657.cjs → no-language-page-content-CK_K6fh9.cjs} +1 -1
  78. package/dist/{no-language-page-dialog-FVXkSnfT.cjs → no-language-page-dialog-BI55QXS_.cjs} +1 -1
  79. package/dist/{no-language-page-dialog-cpCZ9vES.js → no-language-page-dialog-gZGw3Uzp.js} +2 -2
  80. package/dist/page-creator-C2ZwuF6M.cjs +1 -0
  81. package/dist/{page-creator-CFtxeW_t.js → page-creator-hHpEaVpS.js} +183 -183
  82. package/dist/{page-lock-BS_ErOIW.cjs → page-lock-BN8BI4J8.cjs} +1 -1
  83. package/dist/{page-lock-Cthbk6Pg.js → page-lock-DMzAREda.js} +2 -2
  84. package/dist/{page-locked-dialog-BWXifuQ8.cjs → page-locked-dialog-B_2Hy4PJ.cjs} +1 -1
  85. package/dist/{page-locked-dialog-D5hmaWqw.js → page-locked-dialog-CZiVFSGf.js} +13 -13
  86. package/dist/page-manager-new-74gQK_vK.js +408 -0
  87. package/dist/page-manager-new-DLVIuTY7.cjs +1 -0
  88. package/dist/{page-manager-search-and-filter-jDoLrCB7.cjs → page-manager-search-and-filter-C6XNDRT7.cjs} +1 -1
  89. package/dist/{page-manager-search-and-filter-iFsFJhn4.js → page-manager-search-and-filter-DYXCod2G.js} +9 -9
  90. package/dist/page-revisions-content-44SecMak.cjs +1 -0
  91. package/dist/{page-revisions-content-C1IGUurW.js → page-revisions-content-BWLkqXrw.js} +40 -40
  92. package/dist/pages.cjs +1 -1
  93. package/dist/pages.d.ts +35 -4
  94. package/dist/pages.js +15 -14
  95. package/dist/{publish-pages-content-BpEoA1T6.js → publish-pages-content-COHFXR-v.js} +68 -75
  96. package/dist/publish-pages-content-msfUAXJy.cjs +1 -0
  97. package/dist/render.cjs +1 -1
  98. package/dist/render.js +5 -5
  99. package/dist/{rte-widget-modal-CC1KcrAT.cjs → rte-widget-modal-ck2hWBPv.cjs} +1 -1
  100. package/dist/{rte-widget-modal-c3T09VeO.js → rte-widget-modal-muaFxwH1.js} +1 -1
  101. package/dist/runtime.cjs +6 -6
  102. package/dist/runtime.d.ts +2 -0
  103. package/dist/runtime.js +36 -35
  104. package/dist/{save-to-lib-BERYhyxq.js → save-to-lib-JBs4ml12.js} +25 -25
  105. package/dist/{save-to-lib-Bk59qO1r.cjs → save-to-lib-NHLFZR6b.cjs} +1 -1
  106. package/dist/sdk.css +1 -1
  107. package/dist/{selected-block-display-C6NxfC0N.js → selected-block-display-0rlYn5jN.js} +20 -20
  108. package/dist/{selected-block-display-vFSCOnw8.cjs → selected-block-display-BhnCoV28.cjs} +1 -1
  109. package/dist/seo-panel-BLTekCWH.cjs +2 -0
  110. package/dist/{seo-panel-COrEJZLA.js → seo-panel-D8QdAKVh.js} +25 -25
  111. package/dist/shared-json-ld-CDYobqPW.cjs +1 -0
  112. package/dist/{shared-json-ld-DnTuCBc3.js → shared-json-ld-DclZXKU6.js} +33 -33
  113. package/dist/{slug-input-CAqkFZBq.js → slug-input-BOaNz0te.js} +1 -1
  114. package/dist/{slug-input-Curnt2n3.cjs → slug-input-D3pjtp5_.cjs} +1 -1
  115. package/dist/supabase-actions.cjs +1 -1
  116. package/dist/supabase-actions.d.ts +6 -0
  117. package/dist/supabase-actions.js +223 -155
  118. package/dist/{take-over-request-6fliSr8w.cjs → take-over-request-CF3ubryV.cjs} +1 -1
  119. package/dist/{take-over-request-DvmM5qTu.js → take-over-request-CbQfdDOW.js} +13 -13
  120. package/dist/{translation-warning-modal-kRcfrPgo.js → translation-warning-modal-Bs5qTh3p.js} +9 -9
  121. package/dist/{translation-warning-modal-B876S5yp.cjs → translation-warning-modal-Bseflnj4.cjs} +1 -1
  122. package/dist/types.d.ts +14 -2
  123. package/dist/{unmark-as-template-q1GblG-u.cjs → unmark-as-template-CtiOyF4c.cjs} +1 -1
  124. package/dist/{unmark-as-template-Dn3klZKq.js → unmark-as-template-rGzNVgFR.js} +13 -13
  125. package/dist/{unpublish-page-DMbcHmUV.cjs → unpublish-page-CNR43LxM.cjs} +1 -1
  126. package/dist/unpublish-page-DhtGUDXp.js +28 -0
  127. package/dist/{unpublished-partials-modal-CEFXp1D1.cjs → unpublished-partials-modal-BmKRB4Tl.cjs} +1 -1
  128. package/dist/{unpublished-partials-modal-Ts5ZhAK9.js → unpublished-partials-modal-j0zuOxDo.js} +3 -3
  129. package/dist/utils.cjs +1 -1
  130. package/dist/utils.js +1 -1
  131. package/dist/web-blocks.cjs +1 -1
  132. package/dist/web-blocks.js +1 -1
  133. package/dist/{web-preview-B2YGL26D.js → web-preview-BCWqRDBW.js} +1 -1
  134. package/dist/{web-preview-C6SLwtqv.cjs → web-preview-DYyGglxW.cjs} +1 -1
  135. package/package.json +2 -1
  136. package/dist/add-new-page-DG38rI6S.js +0 -31
  137. package/dist/apply-binding-9XSrYzAE.cjs +0 -1
  138. package/dist/apply-binding-chfbBKi2.js +0 -846
  139. package/dist/delete-page-CdByrw3j.cjs +0 -1
  140. package/dist/get-chai-builder-theme-B5RkBTsB.cjs +0 -1
  141. package/dist/index-Bzyv7mAh.cjs +0 -5
  142. package/dist/index-mPCp0j2h.cjs +0 -160
  143. package/dist/lang-panel-jebYHYGD.cjs +0 -1
  144. package/dist/manage-design-tokens-BknGNAKE.cjs +0 -1
  145. package/dist/manage-design-tokens-Co5677WS.js +0 -428
  146. package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +0 -1
  147. package/dist/page-creator-o6yRzsVf.cjs +0 -1
  148. package/dist/page-manager-new-Dl5YwsMm.js +0 -418
  149. package/dist/page-manager-new-DpSqBzeh.cjs +0 -1
  150. package/dist/page-revisions-content-CeBepZEw.cjs +0 -1
  151. package/dist/plugin-DHpuZZXz.cjs +0 -22
  152. package/dist/publish-pages-content-PNsiaGI-.cjs +0 -1
  153. package/dist/seo-panel-0vlr_dBq.cjs +0 -2
  154. package/dist/shared-json-ld-C46hURIr.cjs +0 -1
  155. package/dist/theme-panel-footer-3ixmq107.cjs +0 -1
  156. package/dist/theme-panel-footer-BlsXRcEY.js +0 -26
  157. package/dist/unpublish-page-BbFZw0so.js +0 -28
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
2
  import { B as h } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { d as u, G as w, H as p, I as f, J as P, K as C } from "./index-DsQXiNA_.js";
4
- import { c as S, d as L, L as x, B as N } from "./index-IQefjAA0.js";
3
+ import { d as u, F as w, G as p, H as f, I as P, J as C } from "./index-94oA-Cgl.js";
4
+ import { c as S, d as L, L as x, B as N } from "./index-CDUCqK5V.js";
5
5
  import { get as v } from "lodash-es";
6
6
  import { LockIcon as B } from "lucide-react";
7
7
  import { useTranslation as E } from "react-i18next";
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-mPCp0j2h.cjs"),n=require("./index-Bzyv7mAh.cjs"),w=require("lodash-es"),x=require("lucide-react"),p=require("react-i18next"),P=()=>{const{t:a}=p.useTranslation(),[i,l]=n.useSearchParams(),c=i.get("lang"),g=n.useIsLanguagePageCreated(c),{setSelectedLang:u}=t.useLanguages(),d=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),h=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",h),l(r),u(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(g)return null;const s=w.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(x.LockIcon,{className:"h-6 w-6 text-yellow-500"}),a("Page missing for"),' "',s,'" ',a("language"),"."]})}),e.jsx(t.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[a("Page is not available in the"),' "',s,'" ',a("language. Either create the page in the"),' "',s,'"',a("language or switch to the base language.")]})}),e.jsx(t.CardFooter,{children:e.jsx(m.Button,{onClick:d,className:"w-full",variant:"destructive",children:a("Switch to default language")})})]})})};exports.default=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-BsloTOgy.cjs"),n=require("./index-Bg3Prrc_.cjs"),w=require("lodash-es"),x=require("lucide-react"),p=require("react-i18next"),P=()=>{const{t:a}=p.useTranslation(),[i,l]=n.useSearchParams(),c=i.get("lang"),g=n.useIsLanguagePageCreated(c),{setSelectedLang:u}=t.useLanguages(),d=()=>{const r=new URLSearchParams(window.location.search);r.delete("lang");const o=r.toString(),h=`${window.location.pathname}${o?`?${o}`:""}`;window.history.pushState({},"",h),l(r),u(""),window.dispatchEvent(new PopStateEvent("popstate"))};if(g)return null;const s=w.get(n.LANGUAGES,c);return e.jsx(n.BlurContainer,{children:e.jsxs(t.Card,{className:"mx-auto w-full max-w-md",children:[e.jsx(t.CardHeader,{className:"space-y-1",children:e.jsxs(t.CardTitle,{className:"flex items-center gap-2 text-2xl",children:[e.jsx(x.LockIcon,{className:"h-6 w-6 text-yellow-500"}),a("Page missing for"),' "',s,'" ',a("language"),"."]})}),e.jsx(t.CardContent,{className:"grid gap-4",children:e.jsxs("div",{children:[a("Page is not available in the"),' "',s,'" ',a("language. Either create the page in the"),' "',s,'"',a("language or switch to the base language.")]})}),e.jsx(t.CardFooter,{children:e.jsx(m.Button,{onClick:d,className:"w-full",variant:"destructive",children:a("Switch to default language")})})]})})};exports.default=P;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-Bzyv7mAh.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-DWtEo657.cjs"))),g=()=>{const[r]=a.useSearchParams(),s=r.get("lang");return a.useIsLanguagePageCreated(s)?null:e.jsx(n.Suspense,{children:e.jsx(t,{})})};exports.default=g;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-Bg3Prrc_.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-CK_K6fh9.cjs"))),g=()=>{const[r]=a.useSearchParams(),s=r.get("lang");return a.useIsLanguagePageCreated(s)?null:e.jsx(n.Suspense,{children:e.jsx(t,{})})};exports.default=g;
@@ -1,7 +1,7 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { c as g, d as n } from "./index-IQefjAA0.js";
2
+ import { c as g, d as n } from "./index-CDUCqK5V.js";
3
3
  import { Suspense as s, lazy as t } from "react";
4
- const o = t(() => import("./no-language-page-content-C8W0M_Fj.js")), l = () => {
4
+ const o = t(() => import("./no-language-page-content-BLnpbzwT.js")), l = () => {
5
5
  const [e] = g(), r = e.get("lang");
6
6
  return n(r) ? null : /* @__PURE__ */ a(s, { children: /* @__PURE__ */ a(o, {}) });
7
7
  };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),v=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-BsloTOgy.cjs"),o=require("react"),_=require("./slug-input-D3pjtp5_.cjs"),w=require("lodash-es"),N=require("lucide-react"),k=require("./index-Bg3Prrc_.cjs"),je=require("@tanstack/react-query"),J=require("sonner"),fe=require("./get-seo-defaults-Cw7vFt-B.cjs");function Ue({value:t,onChange:c,placeholder:j="Enter custom slug part",dynamicPattern:p,onValidationChange:i}){const[f,m]=o.useState(null),h=o.useRef(null),[g,T]=o.useState(p+t);o.useEffect(()=>{T(p+t)},[t,p]);const O=S=>{const C=S.target.value;if(!C.startsWith(p)){const W=C.replace(p,""),G=p+W;T(G),c(W);return}const l=C.substring(p.length).replace(/\//g,"").replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-_.]/g,"-").replace(/-+/g,"-").replace(/^-+/,"").toLowerCase(),n=(l.match(/\./g)||[]).length,x=n<=1;n>1?m("Invalid slug. Only one dot (.) is allowed in the slug"):m(null),i&&i(x);const y=p+l;T(y),c(l)},b=()=>{if(h.current){const S=h.current;setTimeout(()=>{const C=p.length;S.setSelectionRange(C,C)},0)}},R=S=>{const C=S.currentTarget;(C.selectionStart||0)<=p.length&&setTimeout(()=>{const l=p.length;C.setSelectionRange(l,l)},0)};return e.jsx("div",{children:e.jsxs("div",{className:"relative",children:[e.jsxs("p",{className:"mb-2 text-xs text-gray-500",children:[`${p}`," is a dynamic segment of slug"]}),e.jsx(v.Input,{ref:h,value:g,onChange:O,onFocus:b,onClick:R,placeholder:j,className:f?"border-red-500":""}),f&&e.jsx("div",{className:"mt-1 text-xs text-red-500",children:f})]})})}const X=({children:t,onWheel:c,...j})=>{const p=i=>{try{i.preventDefault();const f=i.currentTarget;f.scrollTop+=i.deltaY}catch{i.preventDefault()}c&&c(i)};return e.jsx(a.CommandList,{...j,onWheel:p,children:t})},te=(...t)=>t.filter(Boolean).join(" ");function ze({pages:t,selectedParentId:c,onChange:j,className:p,id:i="parentPage",currentPage:f}){const[m,h]=o.useState(!1),[g,T]=o.useState(""),O=v.useChaiFeatureFlag("enable-add-page-dropdown");O||(p="w-full rounded-md border border-gray-300 px-3 py-2");const b=o.useMemo(()=>!t||t.length===0?[]:t.filter(x=>!w.isEmpty(x.slug)).filter(x=>x.slug!=="/").sort((x,y)=>x.slug.localeCompare(y.slug)),[t]),R=o.useMemo(()=>{if(!g.trim())return b;const n=g.toLowerCase();return b.filter(x=>x.name.toLowerCase().includes(n)||x.slug.toLowerCase().includes(n))},[b,g]),S=n=>Math.max(0,(n.match(/\//g)||[]).length-1),C=n=>"    ".repeat(n),d=n=>{if(n==="/")return"/";const x=n.split("/").filter(Boolean);if(x.length<=1){const y=x[0]||"";return`/${_.removeSlugExtension(y)}`}return`/${_.removeSlugExtension(x[x.length-1])}`},l=()=>{if(!c||c==="none")return"None";const n=b.find(x=>x.id===c);return n?`${n.name} (${d(n.slug)})`:"None"};return e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:i,className:"text-sm",children:"Parent"}),O?e.jsxs(a.Popover,{open:m,onOpenChange:h,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{id:i,variant:"outline",role:"combobox",className:te("w-full justify-between",p),"data-testid":"parent-page-selector",children:[l(),e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"relative border-none py-2",children:e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search pages...",className:"h-8 pl-8 text-xs",value:g,onChange:n=>T(n.target.value)})]})})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No pages found."}),e.jsxs(a.CommandGroup,{children:[e.jsxs(a.CommandItem,{value:"none",onSelect:()=>{j(""),h(!1),T("")},className:"flex cursor-pointer items-center justify-between",children:[e.jsx("span",{children:"None"}),e.jsx(N.Check,{className:te("mr-2 h-4 w-4",c?"opacity-0":"opacity-100")})]}),R.map(n=>{const x=C(S(n.slug)),y=d(n.slug),W=e.jsxs("span",{className:"flex items-center text-sm",children:[x,n.name,e.jsxs("span",{className:"text-xs text-gray-500",children:[" (",y,")"]})]});return e.jsxs(a.CommandItem,{value:n.id,onSelect:()=>{j(n.id),h(!1),T("")},className:"flex cursor-pointer items-center justify-between whitespace-pre-wrap",children:[e.jsx("span",{children:W}),e.jsx(N.Check,{className:te("mr-2 h-4 w-4 shrink-0",c===n.id?"opacity-100":"opacity-0")})]},n.id)})]})]})]})})]}):e.jsxs("select",{id:i,value:c||"none",onChange:n=>j(n.target.value),className:p,"data-testid":"parent-page-selector",children:[e.jsx("option",{value:"none",children:"None"}),b.map(n=>{const x=S(n.slug),y=x>0?C(x):"",W=d(n.slug);return(f==null?void 0:f.id)===n.id||n.slug.startsWith(f==null?void 0:f.slug)?null:e.jsxs("option",{value:n.id,children:[y,n.name," (",W,")"]},n.id)})]})]})}const _e=(...t)=>t.filter(Boolean).join(" "),Ve=({templates:t,selectedTemplateId:c,onSelectTemplate:j,isLoading:p=!1})=>{const[i,f]=o.useState(""),[m,h]=o.useState(!1),[g,T]=o.useState(""),O=v.useChaiFeatureFlag("enable-add-page-dropdown");if(o.useEffect(()=>{if(c){const d=t.find(l=>l.id===c);o.startTransition(()=>f((d==null?void 0:d.preview)||""))}else o.startTransition(()=>f(""))},[c,t]),p)return e.jsx("div",{className:"flex h-fit items-center justify-center text-sm text-gray-500",children:"Loading templates..."});if(t.length===0)return null;const b={};t.forEach(d=>{const l=d.libraryName;b[l]||(b[l]=[]),b[l].push(d)});const R=Object.entries(b).reduce((d,[l,n])=>{const x=n.filter(y=>y.name.toLowerCase().includes(g.toLowerCase())||l.toLowerCase().includes(g.toLowerCase()));return x.length>0&&(d[l]=x),d},{}),S=t.find(d=>d.id===c),C=S?w.startCase(S.name):"No Template";return e.jsxs("div",{className:"space-y-4",children:[O?e.jsxs(a.Popover,{open:m,onOpenChange:h,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{variant:"outline",role:"combobox",className:"w-full justify-between",children:[C,e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search templates...",className:"h-8 pl-8 text-xs",value:g,onChange:d=>T(d.target.value)})]})}),e.jsxs(X,{className:"max-h-[300px] overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No templates found."}),Object.entries(R).map(([d,l])=>e.jsx(a.CommandGroup,{heading:d,children:l.map(n=>e.jsxs(a.CommandItem,{value:n.id,onSelect:()=>{j(n.id),h(!1),T("")},className:"flex cursor-pointer items-center justify-between",children:[w.startCase(n.name),e.jsx(N.Check,{className:_e("mr-2 h-4 w-4",c===n.id?"opacity-100":"opacity-0")})]},n.id))},d))]})]})})]}):e.jsxs("select",{className:"w-full rounded-md border border-gray-300 px-3 py-2",value:c,onChange:d=>j(d.target.value),children:[e.jsx("option",{value:"",children:"No Template"}),Object.entries(b).map(([d,l])=>e.jsx("optgroup",{label:d,children:l.map(n=>e.jsx("option",{value:n.id,children:w.startCase(n.name)},n.id))},d))]}),i&&e.jsxs("div",{className:"mt-3 overflow-hidden rounded border",children:[e.jsx("div",{className:"max-h-[200px] overflow-auto",children:e.jsx("img",{src:i,alt:"Template Preview",className:"w-full object-contain"})}),e.jsx("div",{className:"border-t bg-gray-50 p-2 text-xs text-gray-500",children:"Template preview"})]})]})},$e=()=>{const t=k.useApiUrl(),c=k.useFetch();return je.useQuery({queryKey:[k.ACTIONS.GET_LIBRARIES],staleTime:"static",queryFn:async()=>await c(t,{action:k.ACTIONS.GET_LIBRARIES})||[]})},Qe=t=>{const c=k.useApiUrl(),j=k.useFetch();return je.useQuery({queryKey:[k.ACTIONS.GET_TEMPLATES_BY_TYPE,t],staleTime:"static",enabled:!!t,queryFn:async()=>{const p=await j(c,{action:k.ACTIONS.GET_TEMPLATES_BY_TYPE,data:{pageType:t}});return(t?w.filter(p,{pageType:t}):p)||[]}})},Ye=t=>{const{data:c=[],isLoading:j}=Qe(t),{data:p=[],isLoading:i}=$e(),f=o.useMemo(()=>j||i?[]:c.map(h=>{const g=w.find(p,{id:h.library});return{...h,libraryName:(g==null?void 0:g.type)!=="shared"?"Site Library":(g==null?void 0:g.name)+" Library",libraryType:g==null?void 0:g.type}}),[c,p,j,i]),m=o.useMemo(()=>w.groupBy(f,"libraryName"),[f]);return{data:f,groupedData:m,isLoading:j||i}},z=(...t)=>t.filter(Boolean).join(" ");function He({addEditPage:t,close:c,closePanel:j}){var xe,ge;const{data:p}=k.usePageTypes(),i=o.useMemo(()=>p??[],[p]),f=k.useChangePage(),m=!!(t!=null&&t.id),{data:h}=k.useWebsitePrimaryPages(),{mutate:g,isPending:T}=k.useCreatePage(),{mutate:O,isPending:b}=k.useUpdatePage(),[R,S]=o.useState(null),[C,d]=o.useState(!0),[l,n]=o.useState((t==null?void 0:t.pageType)??"page"),{hasPermission:x}=a.usePermissions(),y=x(k.PAGES_PERMISSIONS.CHANGE_PAGE_TYPE),[W,G]=o.useState(!1),[ye,ve]=o.useState(""),{selectedLang:Se,fallbackLang:Ce}=a.useLanguages(),ne=Se||Ce,[V,H]=o.useState(""),[ae,Q]=o.useState(!1),le=o.useMemo(()=>{const s=i.find(u=>u.key===l);return(s==null?void 0:s.hasSlug)===!1},[l,i]),[D,Ne]=o.useState((t==null?void 0:t.parent)??""),[M,re]=o.useState((t==null?void 0:t.name)??""),[F,oe]=o.useState((t==null?void 0:t.dynamic)??!1),[B,Y]=o.useState(F?"":((t==null?void 0:t.slug)??"").split("/").pop()||""),[ie,ce]=o.useState((t==null?void 0:t.dynamicSlugCustom)??""),[ue,be]=o.useState(!0),[we,P]=o.useState(!1),[E,ke]=o.useState(""),{data:me,isLoading:Le}=Ye(l),$=T||b,he=v.useChaiFeatureFlag("enable-add-page-dropdown"),ee=o.useMemo(()=>!m||!(t!=null&&t.id)||!h?null:h.find(s=>s.id===t.id),[m,t==null?void 0:t.id,h]),Te=(ee==null?void 0:ee.online)||!1,De=o.useMemo(()=>!m||!(t!=null&&t.id)||!h?!1:h.some(s=>s.parent===t.id),[m,t==null?void 0:t.id,h]),r=i.find(s=>s.key===l),U=s=>{if(m&&l!==s){ve(s),G(!0),H(""),Q(!1);return}n(s),H(""),Q(!1)},pe=()=>{n(ye),G(!1),oe(!1)},Ie=s=>{oe(s),s?Y(""):ce("")},Fe=s=>{if(Ne(s),s&&s!=="none"){const u=h==null?void 0:h.find(L=>L.id===s),q=(u==null?void 0:u.slug)||"";if(B.startsWith(q)){const L=B.slice(q.length).replace(/^\/+/,"");Y(L)}else Y(B.replace(/^\/+/,""))}else Y(B?`${B}`:"")},Be=s=>{ke(s)},qe=()=>M.trim()?F&&!w.isEmpty(B)?(S("Slug must be empty when using dynamic slug"),!1):F&&!ue?(S("Dynamic slug is invalid"),!1):!0:(J.toast.error("Name is required"),!1),Ae=()=>{const s={pageType:r==null?void 0:r.key,name:M,slug:"",hasSlug:!1};m?O({id:t==null?void 0:t.id,name:M},{onSuccess:()=>{J.toast.success((r==null?void 0:r.name)+" updated successfully"),c()}}):g(s,{onSuccess:u=>{c(),f(u.page.id,j)}})},Oe=(s,u)=>{if(!s.trim()&&!F)return S("Child page slug is required"),!1;const q=_.removeSlugExtension(u),L=_.combineParentChildSlugs(q,s);return Object.keys(k.LANGUAGES).some(Z=>L===`/${Z}`||(L==null?void 0:L.startsWith(`/${Z}/`)))?(S("Slugs cannot start with a language code for primary page"),!1):!0},We=(s,u)=>{const q=_.removeSlugExtension(u),L=_.combineParentChildSlugs(q,s),I={pageType:l,name:M,slug:L.replace(/\/$/,""),parent:D,dynamic:F,hasSlug:!0,template:E||void 0,tracking:{},seo:{},jsonLD:{}};if(F&&(I.dynamicSlugCustom=ie),m){const A=w.pick(I,["pageType","parent","name","slug","dynamic","dynamicSlugCustom"]);O({id:t==null?void 0:t.id,...A},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}})}else{const A=w.find(i,{key:l});A!=null&&A.trackingDefault&&(I.tracking=A.trackingDefault);const{seo:Z,jsonLD:Ge}=fe.getSeoDefaults(A,ne);w.set(I,"seo",Z),w.set(I,"jsonLD",Ge),g(I,{onSuccess:Me=>{c(),f(Me.page.id,j)}})}},Re=()=>{const s={pageType:l,name:M,slug:B===""?"/":`/${B.replace(/\/$/,"")}`,template:E||void 0,parent:null,tracking:{}};if(m)O({id:t==null?void 0:t.id,...s},{onSuccess:()=>{J.toast.success("Page updated successfully"),c()}});else{const u=w.find(i,{key:l});u!=null&&u.trackingDefault&&(s.tracking=u.trackingDefault);const{seo:q,jsonLD:L}=fe.getSeoDefaults(u,ne);w.set(s,"seo",q),w.set(s,"jsonLD",L),g(s,{onSuccess:I=>{var A;(A=I==null?void 0:I.page)!=null&&A.id&&f(I.page.id,j),c()}})}},de=s=>{if(s.preventDefault(),S(null),!!qe()){if(!(r!=null&&r.hasSlug)){Ae();return}if(D&&D!=="none"){const u=h==null?void 0:h.find(L=>L.id===D),q=(u==null?void 0:u.slug)||"";if(!Oe(B,q))return;We(B,q)}else Re()}},{pagesType:se,partialsType:K}=o.useMemo(()=>{const s=u=>V?u.name.toLowerCase().includes(V.toLowerCase())||u.key.toLowerCase().includes(V.toLowerCase()):!0;return{pagesType:i.filter(u=>u.hasSlug!==!1&&s(u)),partialsType:i.filter(u=>u.hasSlug===!1&&s(u))}},[i,V]);return r!=null&&r.hasSlug?e.jsxs("form",{onSubmit:de,className:"mx-auto w-full max-w-md space-y-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(a.Popover,{open:ae,onOpenChange:Q,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:z("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:V,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No page type found."}),m?le?e.jsx(a.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}):e.jsx(a.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}):e.jsxs(e.Fragment,{children:[se.length>0&&e.jsx(a.CommandGroup,{heading:"Pages",children:se.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))}),K.length>0&&e.jsx(a.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>U(s.key),className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))})]})]})]})})]}):e.jsx("select",{id:"pageType",value:l,disabled:m&&!y,onChange:s=>U(s.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${m&&!y?"cursor-not-allowed text-gray-500":""}`,children:m?le?e.jsx("optgroup",{label:"Partials",children:i.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}):e.jsx("optgroup",{label:"Pages",children:i.filter(s=>s.hasSlug!==!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}):e.jsxs(e.Fragment,{children:[e.jsx("optgroup",{label:"Pages",children:i.filter(s=>s.hasSlug!==!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))}),e.jsx("optgroup",{label:"Partials",children:i.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})]})}),W&&e.jsxs("div",{className:"mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3",children:[e.jsx("p",{className:"text-sm text-yellow-800",children:"Changing the page type may impact the page data. Are you sure you want to proceed?"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(v.Button,{variant:"outline",size:"sm",onClick:()=>G(!1),children:"Cancel"}),e.jsx(v.Button,{variant:"default",size:"sm",onClick:pe,children:"Confirm"})]})]})]}),!m&&(r==null?void 0:r.hasSlug)&&me.length>0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"mb-1 block text-sm",children:"Template"}),e.jsx(Ve,{templates:me,selectedTemplateId:E,onSelectTemplate:Be,isLoading:Le})]}),e.jsx(ze,{pages:h,selectedParentId:D,onChange:Fe,currentPage:t}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(v.Input,{id:"name",value:M,onChange:s=>re(s.target.value),required:!0,"aria-required":"true",placeholder:"Enter page name"})]}),(r==null?void 0:r.dynamicSegments)&&D&&D!=="none"&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",id:"useDynamicSlug",checked:F,onChange:s=>Ie(s.target.checked),className:"rounded border-gray-300"}),e.jsx(a.Label,{htmlFor:"useDynamicSlug",className:"text-sm",children:"Use Dynamic Slug"})]}),F&&e.jsx("div",{className:"space-y-2",children:e.jsx("div",{className:"space-y-0.5",children:e.jsx(Ue,{value:ie,onChange:ce,dynamicPattern:(r==null?void 0:r.dynamicSlug)||"{{id}}",placeholder:"Enter custom slug part (optional)",onValidationChange:be})})})]}),(!(r!=null&&r.dynamicSegments)||!F)&&e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"slug",className:"text-sm",children:"Slug"}),e.jsx(_.SlugInput,{value:B,onChange:s=>{var u;Y(s),m&&s!==(((u=t==null?void 0:t.slug)==null?void 0:u.split("/").pop())||"")?P(!!(Te||De)):P(!1)},placeholder:D&&D!=="none"?"Enter page slug":l==="page"?"Leave empty for home page":"Required - e.g. your-slug",parentSlug:D&&D!=="none"?(ge=h==null?void 0:h.find(s=>s.id===D))==null?void 0:ge.slug:void 0,onValidationChange:d}),R&&e.jsx("p",{className:"text-xs text-red-500",children:R}),we&&e.jsx("div",{className:"mt-4 rounded-md border border-amber-200 bg-amber-50 p-3",children:e.jsxs("div",{className:"flex items-start space-x-2",children:[e.jsx("div",{className:"flex-shrink-0",children:e.jsx("svg",{className:"h-5 w-5 text-amber-400",viewBox:"0 0 20 20",fill:"currentColor",children:e.jsx("path",{fillRule:"evenodd",d:"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-sm font-medium text-amber-800",children:"Slug Change Warning"}),e.jsx("div",{className:"mt-1 text-sm text-amber-700",children:e.jsx("p",{children:"The previous URL and any child pages will become inaccessible. You may want to set up a redirect to avoid broken links."})})]})]})})]}),e.jsx(v.Button,{disabled:$||!C&&(!(r!=null&&r.dynamicSegments)||!F)||F&&!ue,type:"submit",className:"w-full",children:m?$?"Updating...":"Update page":$?"Creating...":"Create Page"})]}):e.jsxs("form",{onSubmit:de,className:"mx-auto w-full max-w-md space-y-4",children:[e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"pageType",className:"text-sm",children:"Type"}),he?e.jsxs(a.Popover,{open:ae,onOpenChange:Q,children:[e.jsx(a.PopoverTrigger,{asChild:!0,children:e.jsxs(v.Button,{variant:"outline",role:"combobox",disabled:m&&!y,className:z("w-full justify-between",m&&!y?"cursor-not-allowed text-gray-500":""),children:[(r==null?void 0:r.name)||"Select page type",e.jsx(N.ChevronDown,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),e.jsx(a.PopoverContent,{className:"w-[var(--radix-popover-trigger-width)] p-0",align:"start",children:e.jsxs(a.Command,{shouldFilter:!1,children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white px-3 py-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(N.Search,{strokeWidth:2,className:"absolute left-2 top-2 h-4 w-4 text-gray-400"}),e.jsx(v.Input,{placeholder:"Search page types...",className:"h-8 pl-8 text-xs",value:V,onChange:s=>H(s.target.value)})]})}),e.jsxs(X,{className:"max-h-[200px] overflow-y-auto",children:[e.jsx(a.CommandEmpty,{children:"No page type found."}),e.jsx(a.CommandGroup,{heading:"Partials",children:K.map(s=>e.jsxs(a.CommandItem,{value:s.key,onSelect:()=>{U(s.key),Q(!1)},className:"flex cursor-pointer items-center justify-between",children:[s.name,e.jsx(N.Check,{className:z("mr-2 h-4 w-4",l===s.key?"opacity-100":"opacity-0")})]},s.key))})]})]})})]}):e.jsx("select",{id:"pageType",value:l,disabled:m&&!y,onChange:s=>U(s.target.value),className:`w-full rounded-md border border-gray-300 px-3 py-2 ${m&&!y?"cursor-not-allowed text-gray-500":""}`,children:e.jsx("optgroup",{label:"Partials",children:i.filter(s=>s.hasSlug===!1).map(s=>e.jsx("option",{value:s.key,children:s.name},s.key))})}),W&&e.jsxs("div",{className:"mt-2 rounded-md border border-yellow-200 bg-yellow-50 p-3",children:[e.jsx("p",{className:"text-sm text-yellow-800",children:"Changing the page type may impact the page data. Are you sure you want to proceed?"}),e.jsxs("div",{className:"mt-2 flex gap-2",children:[e.jsx(v.Button,{variant:"outline",size:"sm",onClick:()=>G(!1),children:"Cancel"}),e.jsx(v.Button,{variant:"default",size:"sm",onClick:pe,children:"Confirm"})]})]}),e.jsx("p",{className:"text-xs text-gray-500",children:(xe=i.find(s=>s.key===l))==null?void 0:xe.helpText})]}),e.jsxs("div",{className:"space-y-0.5",children:[e.jsx(a.Label,{htmlFor:"name",className:"text-sm",children:"Name"}),e.jsx(v.Input,{id:"name",value:M,onChange:s=>re(s.target.value),required:!0,"aria-required":"true"})]}),e.jsx(v.Button,{disabled:$,type:"submit",className:"w-full",children:m?$?"Updating...":"Update "+(r==null?void 0:r.name):$?"Creating...":"Create "+(r==null?void 0:r.name)})]})}exports.default=He;