@chaibuilder/sdk 4.0.0-beta.47 → 4.0.0-beta.49

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 (122) hide show
  1. package/dist/{2SSKDMRQ-CVHl6i14.cjs → 2SSKDMRQ-CjvuNdPo.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-D9rlRpnI.js → 2SSKDMRQ-Dvf9zadl.js} +2 -2
  3. package/dist/{AP7HFJJL-D18sv0Wh.cjs → AP7HFJJL-DYFttFoI.cjs} +1 -1
  4. package/dist/{AP7HFJJL-CBrphwP9.js → AP7HFJJL-q4dJdyFs.js} +1 -1
  5. package/dist/{IconPicker-CSewv0kY.js → IconPicker-Bf163F7t.js} +1 -1
  6. package/dist/{IconPicker-CxEGCcVZ.cjs → IconPicker-JWhYq2Gp.cjs} +1 -1
  7. package/dist/{WDYDFRGG-C0G8c0hR.cjs → WDYDFRGG-BEksfGMC.cjs} +1 -1
  8. package/dist/{WDYDFRGG-BCmjXFs0.js → WDYDFRGG-O9GIrtX0.js} +2 -2
  9. package/dist/{actions-registery-BQ31lpix.cjs → actions-registery-BHbZHkE3.cjs} +11 -3
  10. package/dist/{actions-registery-B1VeX52Y.js → actions-registery-gJb_wq2F.js} +25 -13
  11. package/dist/actions.cjs +1 -1
  12. package/dist/actions.d.ts +10 -3
  13. package/dist/actions.js +6 -4
  14. package/dist/{active-in-another-tab-BhbPijx9.js → active-in-another-tab-B4Ur0JP7.js} +2 -2
  15. package/dist/{active-in-another-tab-CMmhCRma.cjs → active-in-another-tab-BPdx4lWh.cjs} +1 -1
  16. package/dist/{add-new-language-page-ChQgjFwb.cjs → add-new-language-page-BfUp5Ua2.cjs} +1 -1
  17. package/dist/{add-new-language-page-C0sayTSF.js → add-new-language-page-CRR93tLq.js} +3 -3
  18. package/dist/{add-new-page-DLf5Tfb7.cjs → add-new-page-B8NGK6WS.cjs} +1 -1
  19. package/dist/{add-new-page-DLKzuaNM.js → add-new-page-Ppy5-y5j.js} +2 -2
  20. package/dist/ai-panel-default-lang-BXYQye3N.js +333 -0
  21. package/dist/ai-panel-default-lang-VhgmHFoQ.cjs +3 -0
  22. package/dist/ai-panel-other-lang-DaCf-cq4.js +148 -0
  23. package/dist/ai-panel-other-lang-Ds0EXeUC.cjs +1 -0
  24. package/dist/{ai-prompt-input-DNb1FKXQ.js → ai-prompt-input-7iWk72w5.js} +253 -258
  25. package/dist/ai-prompt-input-nZ5_Dm7X.cjs +1 -0
  26. package/dist/{ai-translation-prompt-B2MfzTjb.js → ai-translation-prompt-1OUs1P7n.js} +1 -1
  27. package/dist/{ai-translation-prompt-CL3yk8K1.cjs → ai-translation-prompt-B16cK-1Q.cjs} +1 -1
  28. package/dist/{change-password-modal-CbMifP62.js → change-password-modal-CdvJR1Ln.js} +10 -10
  29. package/dist/{change-password-modal-D_NFPZxI.cjs → change-password-modal-D5eXjiYq.cjs} +1 -1
  30. package/dist/{code-editor-53rOkfhX.js → code-editor-CyLjDiEp.js} +1 -1
  31. package/dist/{code-editor-CCsljULB.cjs → code-editor-SWbfFj1E.cjs} +1 -1
  32. package/dist/{continue-editing-in-this-client-hB4O3CHJ.js → continue-editing-in-this-client-BrSvK-Ay.js} +2 -2
  33. package/dist/{continue-editing-in-this-client-3QLL7tQH.cjs → continue-editing-in-this-client-Cmi-GkYZ.cjs} +1 -1
  34. package/dist/core.cjs +1 -1
  35. package/dist/core.js +1 -1
  36. package/dist/{css-import-modal-Bmi3LrEJ.cjs → css-import-modal-Bdwgd05S.cjs} +1 -1
  37. package/dist/{css-import-modal-DCivkVh2.js → css-import-modal-Be47CBJn.js} +1 -1
  38. package/dist/{delete-page-BW2NxLZu.js → delete-page-C99K2qzS.js} +15 -15
  39. package/dist/{delete-page-CxVfKrBz.cjs → delete-page-DLohaU-U.cjs} +1 -1
  40. package/dist/{design-token-usage-WTVjf9c-.js → design-token-usage-D1lWCJ3L.js} +1 -1
  41. package/dist/{design-token-usage-5jsa9ojN.cjs → design-token-usage-eY2wQ0l3.cjs} +1 -1
  42. package/dist/{digital-asset-manager-dNK-BYdI.js → digital-asset-manager-BZMb6sC7.js} +3 -3
  43. package/dist/{digital-asset-manager-DlFCWUP4.cjs → digital-asset-manager-Z5aJxkq0.cjs} +1 -1
  44. package/dist/{duplicate-page-BbB2anQO.js → duplicate-page-CDc2X0eW.js} +12 -12
  45. package/dist/{duplicate-page-0o6G-oY_.cjs → duplicate-page-D5Gtvqdv.cjs} +1 -1
  46. package/dist/{dynamic-page-selector-Ds3MqxTF.cjs → dynamic-page-selector-DZHhX008.cjs} +1 -1
  47. package/dist/{dynamic-page-selector-rFO8457w.js → dynamic-page-selector-DvNBXo6o.js} +2 -2
  48. package/dist/{image-editor-BnVkes6Q.js → image-editor-BBvvi9Vm.js} +1 -1
  49. package/dist/{image-editor-DqItmbk1.cjs → image-editor-DwhTYkVR.cjs} +1 -1
  50. package/dist/index-BVwFJWDq.cjs +5 -0
  51. package/dist/{index-DTNHTRZu.cjs → index-DCJDQs1a.cjs} +8 -8
  52. package/dist/{index-BYjniKhj.js → index-LBTm1Jmk.js} +838 -806
  53. package/dist/{index-B7HAfx-2.js → index-OuHV9Ann.js} +16 -9
  54. package/dist/{json-diff-viewer-B4rnFiN_.cjs → json-diff-viewer-Cb1CmRqP.cjs} +1 -1
  55. package/dist/{json-diff-viewer-CKlyO9eW.js → json-diff-viewer-DG6qMOBS.js} +6 -6
  56. package/dist/{lang-panel-YT96E5Xj.js → lang-panel-B3USOxGq.js} +9 -9
  57. package/dist/{lang-panel-DiVz4Cay.cjs → lang-panel-DxoJ0v4y.cjs} +1 -1
  58. package/dist/{manage-design-tokens-LwImeKaK.js → manage-design-tokens-6YGIctip.js} +2 -2
  59. package/dist/{manage-design-tokens-modal-BEElCTcN.cjs → manage-design-tokens-modal-BSSCXH8Y.cjs} +1 -1
  60. package/dist/{manage-design-tokens-modal-DFVcoyra.js → manage-design-tokens-modal-CzsnN49F.js} +2 -2
  61. package/dist/{manage-design-tokens-BwrIc6dS.cjs → manage-design-tokens-udLBvkHA.cjs} +1 -1
  62. package/dist/{mark-as-template-DtDkh6jB.cjs → mark-as-template-B9yLcasI.cjs} +1 -1
  63. package/dist/{mark-as-template-D2Hpz0IE.js → mark-as-template-CP_F9ZQ4.js} +2 -2
  64. package/dist/{models-D0RH2u4C.cjs → models-CQaC3EBW.cjs} +1 -1
  65. package/dist/{models-BCu-p_QK.js → models-DZ9C6CvE.js} +4 -5
  66. package/dist/{nested-path-selector-content-TqjBbNys.js → nested-path-selector-content-DmtCI3q9.js} +1 -1
  67. package/dist/{nested-path-selector-content-CJfN8Hhw.cjs → nested-path-selector-content-aTdu-o0e.cjs} +1 -1
  68. package/dist/{no-language-page-content-CcD-fgMa.cjs → no-language-page-content-C-MCdPXt.cjs} +1 -1
  69. package/dist/{no-language-page-content-Ce3wniZT.js → no-language-page-content-D8t5dfgh.js} +2 -2
  70. package/dist/{no-language-page-dialog-CU1zXsYv.js → no-language-page-dialog-C_fHI2zI.js} +2 -2
  71. package/dist/{no-language-page-dialog-B7fhPdob.cjs → no-language-page-dialog-D4QIAHnE.cjs} +1 -1
  72. package/dist/{page-creator-C7XEqUx_.cjs → page-creator-Cz_ah-qE.cjs} +1 -1
  73. package/dist/{page-creator-wg3uymVG.js → page-creator-DKEkuGCO.js} +33 -33
  74. package/dist/{page-lock-BuVma3e5.js → page-lock-CwZKJ4IE.js} +2 -2
  75. package/dist/{page-lock-CINb2air.cjs → page-lock-DdCvtA-I.cjs} +1 -1
  76. package/dist/{page-locked-dialog-s-3ROcy0.cjs → page-locked-dialog-CrTDBoC4.cjs} +1 -1
  77. package/dist/{page-locked-dialog-C7_1gjO5.js → page-locked-dialog-DqLlooUz.js} +11 -11
  78. package/dist/{page-manager-new-CKWSLVrb.cjs → page-manager-new-ah6QYar2.cjs} +1 -1
  79. package/dist/{page-manager-new-zlobCGqL.js → page-manager-new-ttsrxdW9.js} +42 -42
  80. package/dist/{page-manager-search-and-filter-BaOsl_5u.cjs → page-manager-search-and-filter-D7AupT6_.cjs} +1 -1
  81. package/dist/{page-manager-search-and-filter-BU_iNmHy.js → page-manager-search-and-filter-bsqZ6wnI.js} +2 -2
  82. package/dist/{page-revisions-content-BmaNPNoS.cjs → page-revisions-content-B6hsIla7.cjs} +1 -1
  83. package/dist/{page-revisions-content-D6l_d2jW.js → page-revisions-content-C5O8_Fms.js} +16 -16
  84. package/dist/pages.cjs +1 -1
  85. package/dist/pages.d.ts +66 -1
  86. package/dist/pages.js +19 -19
  87. package/dist/{publish-pages-content-2LG6JOrm.cjs → publish-pages-content-BrajJUcP.cjs} +1 -1
  88. package/dist/{publish-pages-content-CQteRtBA.js → publish-pages-content-KZVMHT6V.js} +32 -32
  89. package/dist/{rte-widget-modal-KzT2hLFt.cjs → rte-widget-modal-CiTwsXTr.cjs} +1 -1
  90. package/dist/{rte-widget-modal-CFk0Izg5.js → rte-widget-modal-IU8JzPuZ.js} +1 -1
  91. package/dist/{save-to-lib-D1V3bNZX.js → save-to-lib-DMnv7ENo.js} +50 -50
  92. package/dist/{save-to-lib-D82Vrekv.cjs → save-to-lib-Dc700Aop.cjs} +1 -1
  93. package/dist/{selected-block-display-BHx9N14K.cjs → selected-block-display-CAFEOrLV.cjs} +1 -1
  94. package/dist/{selected-block-display-BbUH5RaW.js → selected-block-display-CidmQ-wz.js} +2 -2
  95. package/dist/{seo-panel-CyBmGg6k.js → seo-panel-Br8gxDxu.js} +148 -158
  96. package/dist/{seo-panel-CPsjZLtL.cjs → seo-panel-CMY-adM-.cjs} +2 -2
  97. package/dist/{shared-json-ld-DyU9wqrE.cjs → shared-json-ld-CMH-eRUq.cjs} +1 -1
  98. package/dist/{shared-json-ld-SGykyppC.js → shared-json-ld-uvMmwCYp.js} +26 -26
  99. package/dist/{slug-input-BzpnOdXG.cjs → slug-input-CiHC5l3r.cjs} +1 -1
  100. package/dist/{slug-input-DpMI4nEB.js → slug-input-DLWTMTsO.js} +1 -1
  101. package/dist/supabase-actions.cjs +1 -1
  102. package/dist/supabase-actions.js +1 -1
  103. package/dist/{take-over-request-wTVLAotu.cjs → take-over-request-IRLgF1dG.cjs} +1 -1
  104. package/dist/{take-over-request-D97Fg-xB.js → take-over-request-KdR1_h_K.js} +5 -5
  105. package/dist/{translation-warning-modal-Xk6oYGFS.cjs → translation-warning-modal-CLZ9tC1F.cjs} +1 -1
  106. package/dist/{translation-warning-modal-Du-CnfyH.js → translation-warning-modal-CzNt6LDO.js} +1 -1
  107. package/dist/types.d.ts +6 -0
  108. package/dist/{unmark-as-template-BHk2F0ck.js → unmark-as-template-C5ovsEBP.js} +2 -2
  109. package/dist/{unmark-as-template-BRnMhh7n.cjs → unmark-as-template-F7TdgWjI.cjs} +1 -1
  110. package/dist/{unpublish-page-BOEjCHLB.js → unpublish-page-0fR1o0b7.js} +8 -8
  111. package/dist/{unpublish-page-Bu75lH33.cjs → unpublish-page-CUr8Xub6.cjs} +1 -1
  112. package/dist/{unpublished-partials-modal-C0_0qNvV.js → unpublished-partials-modal-BhNAub_z.js} +1 -1
  113. package/dist/{unpublished-partials-modal-BS_GddEG.cjs → unpublished-partials-modal-Cv5R9-hi.cjs} +1 -1
  114. package/dist/{web-preview-DcOhTGup.cjs → web-preview-CuMYekVJ.cjs} +1 -1
  115. package/dist/{web-preview-C3bbIF6T.js → web-preview-D9pXonAv.js} +1 -1
  116. package/package.json +1 -1
  117. package/dist/ai-panel-default-lang-DsGjoITc.cjs +0 -3
  118. package/dist/ai-panel-default-lang-Dy_4L5pH.js +0 -317
  119. package/dist/ai-panel-other-lang-1RYtb71B.js +0 -132
  120. package/dist/ai-panel-other-lang-CL3coL7Z.cjs +0 -1
  121. package/dist/ai-prompt-input-BhTL_-mT.cjs +0 -1
  122. package/dist/index-BeGLwvqs.cjs +0 -5
@@ -10069,7 +10069,7 @@ const qy = () => {
10069
10069
  /* @__PURE__ */ l("p", { className: "font-semibold", children: t("Oops! Something went wrong.") }),
10070
10070
  /* @__PURE__ */ l("p", { children: t("Please try again.") })
10071
10071
  ] }) });
10072
- }, Qy = P(null), Ad = () => D(Qy), ex = ee.lazy(() => import("./code-editor-53rOkfhX.js")), tx = () => {
10072
+ }, Qy = P(null), Ad = () => D(Qy), ex = ee.lazy(() => import("./code-editor-CyLjDiEp.js")), tx = () => {
10073
10073
  const [t] = Ad(), e = G("onError", kt);
10074
10074
  return /* @__PURE__ */ l("div", { className: "flex h-full max-h-full w-full flex-1 flex-col", children: /* @__PURE__ */ g("div", { className: "relative flex h-full max-h-full flex-col overflow-hidden bg-gray-100/40", children: [
10075
10075
  /* @__PURE__ */ l(Ve, { fallback: /* @__PURE__ */ l(zn, { className: "h-full" }), children: /* @__PURE__ */ l(an, { fallback: /* @__PURE__ */ l(pr, {}), onError: e, children: /* @__PURE__ */ l(Zy, {}) }) }),
@@ -10292,7 +10292,7 @@ const qy = () => {
10292
10292
  /* @__PURE__ */ l("option", { value: "", children: "Select" }),
10293
10293
  d.map((u) => /* @__PURE__ */ l("option", { value: u.id, children: u.name }, u.id))
10294
10294
  ] }) });
10295
- }, ox = _o(() => import("./IconPicker-CSewv0kY.js").then((t) => ({ default: t.IconPicker }))), sx = (t) => {
10295
+ }, ox = _o(() => import("./IconPicker-Bf163F7t.js").then((t) => ({ default: t.IconPicker }))), sx = (t) => {
10296
10296
  try {
10297
10297
  let e = t.replace(/<svg([^>]*)\sheight="[^"]*"([^>]*)>/gi, "<svg$1$2>").replace(/<svg([^>]*)\swidth="[^"]*"([^>]*)>/gi, "<svg$1$2>");
10298
10298
  return e = e.replace(/>\s+</g, "><"), e = e.replace(/\n/g, "").replace(/\s{2,}/g, " "), e = e.replace(/\s+=/g, "=").replace(/=\s+/g, "="), e = e.replace(/<!--[\s\S]*?-->/g, ""), e.trim();
@@ -11103,7 +11103,7 @@ const Hi = () => Ue(Md), vx = () => {
11103
11103
  ]
11104
11104
  }
11105
11105
  ) });
11106
- }, kx = ee.lazy(() => import("./rte-widget-modal-CFk0Izg5.js")), Cx = ({ blockId: t, id: e, placeholder: n, value: r, onChange: o, onBlur: s }) => {
11106
+ }, kx = ee.lazy(() => import("./rte-widget-modal-IU8JzPuZ.js")), Cx = ({ blockId: t, id: e, placeholder: n, value: r, onChange: o, onBlur: s }) => {
11107
11107
  const i = re(null), [a, c] = $(!1), d = Nd({
11108
11108
  blockId: t,
11109
11109
  value: r,
@@ -14209,7 +14209,7 @@ const N0 = Xs(
14209
14209
  }
14210
14210
  ));
14211
14211
  Gt.displayName = Il.Root.displayName;
14212
- const $s = ({ className: t = "" }) => /* @__PURE__ */ l(Sp, { className: t }), S0 = _o(() => import("./manage-design-tokens-modal-DFVcoyra.js"));
14212
+ const $s = ({ className: t = "" }) => /* @__PURE__ */ l(Sp, { className: t }), S0 = _o(() => import("./manage-design-tokens-modal-CzsnN49F.js"));
14213
14213
  function Jd({
14214
14214
  from: t = "default",
14215
14215
  classFromProps: e,
@@ -16565,7 +16565,7 @@ const vw = ({ value: t, onChange: e, disabled: n }) => {
16565
16565
  "popover-foreground": ["#3d3436", "#f2e9e4"]
16566
16566
  }
16567
16567
  }, Bw = _o(
16568
- () => import("./css-import-modal-DCivkVh2.js").then((t) => ({ default: t.CssImportModal }))
16568
+ () => import("./css-import-modal-Be47CBJn.js").then((t) => ({ default: t.CssImportModal }))
16569
16569
  ), bu = "chai-builder-previous-theme", Iw = [
16570
16570
  { shadcn_default: Sw },
16571
16571
  { twitter_theme: Ew },
@@ -16903,6 +16903,7 @@ const vw = ({ value: t, onChange: e, disabled: n }) => {
16903
16903
  "Randomize all text elements.": "Randomize all text elements.",
16904
16904
  "Edit Block": "Edit Block",
16905
16905
  "AI Assistant": "AI Assistant",
16906
+ "Generate with AI": "Generate with AI",
16906
16907
  "Theme Config": { "Heading Font": "Heading Font", "Body Font": "Body Font", "Rounded Corner": "Rounded Corners", Primary: "Primary", Secondary: "Secondary", Background: "Background", "Text Color": "Text Color", "Background Dark Mode": "Background (Dark Mode)", "Text Color Dark Mode": "Text Color (Dark Mode)", "Reset styles": "Reset styles" },
16907
16908
  "Copy classes to clipboard": "Copy classes to clipboard",
16908
16909
  "Classes copied to clipboard": "Classes copied to clipboard",
@@ -17782,7 +17783,7 @@ const xk = ({ partialBlockId: t }) => {
17782
17783
  /* @__PURE__ */ l(so, { className: "mx-auto text-3xl" }),
17783
17784
  /* @__PURE__ */ l("h1", { children: e("Please select a block to edit settings or styles") })
17784
17785
  ] }) });
17785
- }, vk = ee.lazy(() => import("./manage-design-tokens-LwImeKaK.js")), jt = 280, kk = ({ isActive: t, show: e }) => /* @__PURE__ */ l(ne, { variant: t ? "default" : "ghost", size: "icon", onClick: e, children: /* @__PURE__ */ l(Of, { className: "h-5 w-5" }) }), Ck = ({ isActive: t, show: e }) => yt() && /* @__PURE__ */ l(ne, { variant: t ? "default" : "ghost", size: "icon", onClick: e, children: /* @__PURE__ */ l(Pf, { className: "h-5 w-5" }) }), Nk = ({ isActive: t, show: e }) => G("flags.ai", !1) ? /* @__PURE__ */ l(ne, { variant: t ? "default" : "ghost", size: "icon", onClick: e, children: /* @__PURE__ */ l(Qs, {}) }) : null;
17786
+ }, vk = ee.lazy(() => import("./manage-design-tokens-6YGIctip.js")), jt = 280, kk = ({ isActive: t, show: e }) => /* @__PURE__ */ l(ne, { variant: t ? "default" : "ghost", size: "icon", onClick: e, children: /* @__PURE__ */ l(Of, { className: "h-5 w-5" }) }), Ck = ({ isActive: t, show: e }) => yt() && /* @__PURE__ */ l(ne, { variant: t ? "default" : "ghost", size: "icon", onClick: e, children: /* @__PURE__ */ l(Pf, { className: "h-5 w-5" }) }), Nk = ({ isActive: t, show: e }) => G("flags.ai", !1) ? /* @__PURE__ */ l(ne, { variant: t ? "default" : "ghost", size: "icon", onClick: e, children: /* @__PURE__ */ l(Qs, {}) }) : null;
17786
17787
  Fs("add-block", {
17787
17788
  button: Ck,
17788
17789
  label: "Add Blocks",
@@ -17881,14 +17882,20 @@ const Sk = () => {
17881
17882
  animate: { width: w },
17882
17883
  transition: { duration: 0.3, ease: "easeInOut" },
17883
17884
  children: e !== null && _(v, "view", "standard") === "standard" && /* @__PURE__ */ g("div", { className: "no-scrollbar flex h-full flex-col overflow-hidden px-3 py-2", children: [
17884
- /* @__PURE__ */ l(
17885
+ _(v, "label", "") !== "" ? /* @__PURE__ */ l(
17885
17886
  "div",
17886
17887
  {
17887
17888
  className: `absolute top-2 flex h-10 items-center space-x-1 py-2 text-base font-bold ${_(v, "isInternal", !1) ? "" : "w-64"}`,
17888
17889
  children: /* @__PURE__ */ l("span", { children: b(_(v, "label", "")) })
17889
17890
  }
17890
- ),
17891
- /* @__PURE__ */ l("div", { className: "no-scrollbar h-full max-h-full overflow-y-auto pt-10", children: /* @__PURE__ */ l(Ve, { fallback: /* @__PURE__ */ l("div", { children: "Loading..." }), children: ee.createElement(_(v, "panel", In), {}) }) })
17891
+ ) : null,
17892
+ /* @__PURE__ */ l(
17893
+ "div",
17894
+ {
17895
+ className: "no-scrollbar h-full max-h-full overflow-y-auto " + (_(v, "label", "") !== "" ? "pt-10" : ""),
17896
+ children: /* @__PURE__ */ l(Ve, { fallback: /* @__PURE__ */ l("div", { children: "Loading..." }), children: ee.createElement(_(v, "panel", In), {}) })
17897
+ }
17898
+ )
17892
17899
  ] })
17893
17900
  }
17894
17901
  ),
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-DTNHTRZu.cjs"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),z=require("date-fns"),p=require("lodash-es"),N=require("lucide-react"),b=require("react"),M=require("react-diff-view"),O=require("./index-BeGLwvqs.cjs"),H=require("@tanstack/react-query");function K(t,r){const o=O.useApiUrl(),n=O.useFetch(),d=p.startsWith(t.uid,"draft:")||p.startsWith(r.uid,"live:");return H.useQuery({queryKey:["revision-comparison",t.uid,r.uid],queryFn:async()=>{if(!t.uid||!r.uid)throw new Error("Both revision IDs are required for comparison");const l=h=>h==="draft"||h==="live"?h:"revision",s=h=>p.replace(h.uid,`${h.label}:`,"");return await n(o,{action:O.ACTIONS.GET_COMPARE_DATA,data:{versions:{version1:{type:l(t.label),id:s(t)},version2:{type:l(r.label),id:s(r)}}}})},enabled:!!t.uid&&!!r.uid,staleTime:d?0:1/0,refetchOnMount:d?"always":!1,gcTime:d?0:void 0})}const V=({version:t})=>{const r=t==null?void 0:t.item,{data:o}=O.useChaiUserInfo(r==null?void 0:r.currentEditor),n=t.label==="live",d=t.label==="draft";return e.jsxs("span",{className:`flex min-h-8 items-center gap-x-2 rounded border bg-white px-2 text-xs shadow-lg ${n?"border-green-500/30":d?"border-amber-500/30":"border-purple-500/30"}`,children:[e.jsx("div",{className:"h-full items-center rounded px-1.5 py-0.5 font-medium capitalize"+(n?" bg-green-500 text-green-50":d?" bg-amber-500 text-amber-50":" bg-purple-500 text-purple-50"),children:t.label}),e.jsxs("div",{className:"py-1 text-xs font-light leading-none text-gray-800",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-light opacity-90",children:d?"Currently editing":"Published by"}),!d&&e.jsx("span",{className:"pl-1 font-medium",children:(o==null?void 0:o.name)||"Unknown"})]}),(r==null?void 0:r.createdAt)&&e.jsx("div",{className:"pt-0.5 text-[10px] leading-tight",children:z.formatDate(r.createdAt,"dd MMM yyyy, h:mm a")})]})]})},F=({version:t})=>e.jsx(V,{version:t});function U(t,r,o="data.json"){const n=JSON.stringify(t,null,2),d=JSON.stringify(r,null,2),l=n.split(`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-DCJDQs1a.cjs"),L=require("./register-chai-top-bar-DyW9GPzV.cjs"),z=require("date-fns"),p=require("lodash-es"),N=require("lucide-react"),b=require("react"),M=require("react-diff-view"),O=require("./index-BVwFJWDq.cjs"),H=require("@tanstack/react-query");function K(t,r){const o=O.useApiUrl(),n=O.useFetch(),d=p.startsWith(t.uid,"draft:")||p.startsWith(r.uid,"live:");return H.useQuery({queryKey:["revision-comparison",t.uid,r.uid],queryFn:async()=>{if(!t.uid||!r.uid)throw new Error("Both revision IDs are required for comparison");const l=h=>h==="draft"||h==="live"?h:"revision",s=h=>p.replace(h.uid,`${h.label}:`,"");return await n(o,{action:O.ACTIONS.GET_COMPARE_DATA,data:{versions:{version1:{type:l(t.label),id:s(t)},version2:{type:l(r.label),id:s(r)}}}})},enabled:!!t.uid&&!!r.uid,staleTime:d?0:1/0,refetchOnMount:d?"always":!1,gcTime:d?0:void 0})}const V=({version:t})=>{const r=t==null?void 0:t.item,{data:o}=O.useChaiUserInfo(r==null?void 0:r.currentEditor),n=t.label==="live",d=t.label==="draft";return e.jsxs("span",{className:`flex min-h-8 items-center gap-x-2 rounded border bg-white px-2 text-xs shadow-lg ${n?"border-green-500/30":d?"border-amber-500/30":"border-purple-500/30"}`,children:[e.jsx("div",{className:"h-full items-center rounded px-1.5 py-0.5 font-medium capitalize"+(n?" bg-green-500 text-green-50":d?" bg-amber-500 text-amber-50":" bg-purple-500 text-purple-50"),children:t.label}),e.jsxs("div",{className:"py-1 text-xs font-light leading-none text-gray-800",children:[e.jsxs("div",{children:[e.jsx("span",{className:"font-light opacity-90",children:d?"Currently editing":"Published by"}),!d&&e.jsx("span",{className:"pl-1 font-medium",children:(o==null?void 0:o.name)||"Unknown"})]}),(r==null?void 0:r.createdAt)&&e.jsx("div",{className:"pt-0.5 text-[10px] leading-tight",children:z.formatDate(r.createdAt,"dd MMM yyyy, h:mm a")})]})]})},F=({version:t})=>e.jsx(V,{version:t});function U(t,r,o="data.json"){const n=JSON.stringify(t,null,2),d=JSON.stringify(r,null,2),l=n.split(`
2
2
  `),s=d.split(`
3
3
  `);let u=`--- a/${o}
4
4
  `;u+=`+++ b/${o}
@@ -1,12 +1,12 @@
1
1
  import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
- import { D as V, e as _, f as q, g as G, af as $, a7 as A, B as P } from "./index-B7HAfx-2.js";
2
+ import { D as U, e as V, f as _, g as G, af as $, a7 as A, B as P } from "./index-OuHV9Ann.js";
3
3
  import { B as R } from "./register-chai-top-bar-D6GjnauV.js";
4
4
  import { formatDate as Q } from "date-fns";
5
5
  import { startsWith as T, replace as W, isString as X, trim as Y, isArray as Z, map as ee, isPlainObject as te, mapValues as re } from "lodash-es";
6
6
  import { FileJson as z, Loader as ne, Check as F, Copy as H } from "lucide-react";
7
7
  import { useState as D, useMemo as I } from "react";
8
8
  import { parseDiff as se, Diff as le, Hunk as ae } from "react-diff-view";
9
- import { ao as ie, ap as oe, A as ce, am as de } from "./index-BYjniKhj.js";
9
+ import { aq as ie, ar as oe, A as ce, ao as de } from "./index-LBTm1Jmk.js";
10
10
  import { useQuery as fe } from "@tanstack/react-query";
11
11
  function me(t, n) {
12
12
  const o = ie(), s = oe(), d = T(t.uid, "draft:") || T(n.uid, "live:");
@@ -160,7 +160,7 @@ const pe = (t) => {
160
160
  }), d;
161
161
  };
162
162
  function Oe({ open: t, compare: n, onOpenChange: o }) {
163
- const s = n[0], d = n[1], [l, r] = D(null), [f, m] = D("split"), [c, p] = D(!1), [y, O] = D(!0), [g, N] = D("blocks"), { data: h, isLoading: x } = me(s, d), { leftData: a, rightData: w, options: U } = I(() => {
163
+ const s = n[0], d = n[1], [l, r] = D(null), [f, m] = D("split"), [c, p] = D(!1), [y, O] = D(!0), [g, N] = D("blocks"), { data: h, isLoading: x } = me(s, d), { leftData: a, rightData: w, options: q } = I(() => {
164
164
  var b, B;
165
165
  const i = (b = h == null ? void 0 : h.version1) == null ? void 0 : b[g], v = (B = h == null ? void 0 : h.version2) == null ? void 0 : B[g], k = S(i), C = S(v), J = ge(h == null ? void 0 : h.version1, h == null ? void 0 : h.version2);
166
166
  return { leftData: k, rightData: C, options: J };
@@ -178,13 +178,13 @@ function Oe({ open: t, compare: n, onOpenChange: o }) {
178
178
  console.error("Failed to copy:", k);
179
179
  }
180
180
  }, L = (i) => JSON.stringify(i, null, 2);
181
- return /* @__PURE__ */ e(V, { open: t, onOpenChange: o, children: /* @__PURE__ */ u(_, { className: "flex h-[90vh] w-[95vw] max-w-[1900px] flex-col p-6", children: [
182
- /* @__PURE__ */ e(q, { className: "pb-4 pt-0", children: /* @__PURE__ */ u(G, { className: "flex items-center justify-between gap-2 leading-none", children: [
181
+ return /* @__PURE__ */ e(U, { open: t, onOpenChange: o, children: /* @__PURE__ */ u(V, { className: "flex h-[90vh] w-[95vw] max-w-[1900px] flex-col p-6", children: [
182
+ /* @__PURE__ */ e(_, { className: "pb-4 pt-0", children: /* @__PURE__ */ u(G, { className: "flex items-center justify-between gap-2 leading-none", children: [
183
183
  /* @__PURE__ */ u("div", { className: "flex items-center gap-2", children: [
184
184
  /* @__PURE__ */ e(z, { className: "h-5 w-5" }),
185
185
  "Compare",
186
186
  "",
187
- U.map((i) => /* @__PURE__ */ e(
187
+ q.map((i) => /* @__PURE__ */ e(
188
188
  "div",
189
189
  {
190
190
  className: `cursor-pointer rounded-full border px-2.5 py-1 text-xs leading-none ${g === i.key ? "border-blue-500 bg-blue-500 text-white" : "border-gray-600 text-gray-600 hover:bg-gray-200"}`,
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as s, Fragment as M } from "react/jsx-runtime";
2
2
  import { D as j, z as F, B as A } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { D as B, e as H, f as O, g as W, o as q, p as R, q as J, d as K, v as Q, w as V, x as X, y as w } from "./index-B7HAfx-2.js";
4
- import { ar as Y, k as T, L as I, as as Z, j as ee, at as se, h as ae, au as f, av as o } from "./index-BYjniKhj.js";
3
+ import { D as B, e as H, f as O, g as W, o as q, p as R, q as J, d as K, v as Q, w as V, x as X, y as C } from "./index-OuHV9Ann.js";
4
+ import { at as Y, k as T, L as I, au as Z, j as ee, av as se, h as ae, aw as f, ax as o } from "./index-LBTm1Jmk.js";
5
5
  import { find as G, startsWith as E, isEqual as ne, filter as te, get as D, map as le, isEmpty as ie } from "lodash-es";
6
6
  import { AlertCircle as re, StarIcon as ce, MoreHorizontal as oe, PencilIcon as de, Power as me, TrashIcon as ue } from "lucide-react";
7
7
  import { useState as S, useMemo as he, Suspense as L, lazy as z } from "react";
@@ -81,7 +81,7 @@ const fe = ({ page: a, onClose: g }) => {
81
81
  /* @__PURE__ */ e(J, { children: /* @__PURE__ */ e(A, { type: "submit", disabled: y || !E(i, `/${d}`) || ne(a == null ? void 0 : a.slug, i), children: l(y ? "Changing..." : "Change Slug") }) })
82
82
  ] })
83
83
  ] }) });
84
- }, Ne = z(() => import("./delete-page-BW2NxLZu.js")), ye = z(() => import("./unpublish-page-BOEjCHLB.js")), ke = () => {
84
+ }, Ne = z(() => import("./delete-page-C99K2qzS.js")), ye = z(() => import("./unpublish-page-0fR1o0b7.js")), ke = () => {
85
85
  const { t: a } = U(), g = pe(Z), { selectedLang: l, fallbackLang: i, setSelectedLang: v } = K(), { data: N, isFetching: y } = ee(), { data: t } = se(), { data: r } = T(), x = he(() => {
86
86
  const n = r == null ? void 0 : r.find((h) => h.key === (t == null ? void 0 : t.pageType));
87
87
  return t != null && t.dynamic ? n == null ? void 0 : n.dynamicSlug : "";
@@ -95,7 +95,7 @@ const fe = ({ page: a, onClose: g }) => {
95
95
  /* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
96
96
  /* @__PURE__ */ e("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" })
97
97
  ] }) : le(N, (n) => {
98
- const h = n.lang, C = n.slug, k = !n.primaryPage;
98
+ const h = n.lang, w = n.slug, k = !n.primaryPage;
99
99
  return /* @__PURE__ */ s(M, { children: [
100
100
  /* @__PURE__ */ s(
101
101
  "li",
@@ -109,9 +109,9 @@ const fe = ({ page: a, onClose: g }) => {
109
109
  D(I, k ? i : h, h)
110
110
  ] }),
111
111
  /* @__PURE__ */ s("div", { children: [
112
- C && /* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
112
+ w && /* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
113
113
  "Slug: ",
114
- /* @__PURE__ */ e("b", { className: "font-mono font-medium", children: x ? `${C}/${x}` : C })
114
+ /* @__PURE__ */ e("b", { className: "font-mono font-medium", children: x ? `${w}/${x}` : w })
115
115
  ] }),
116
116
  /* @__PURE__ */ s("div", { className: "text-[11px] font-light text-slate-600", children: [
117
117
  "Name:",
@@ -138,7 +138,7 @@ const fe = ({ page: a, onClose: g }) => {
138
138
  /* @__PURE__ */ e(V, { asChild: !0, onClick: (c) => c.stopPropagation(), children: /* @__PURE__ */ e(A, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", children: /* @__PURE__ */ e(oe, { className: "h-4 w-4" }) }) }),
139
139
  /* @__PURE__ */ s(X, { align: "end", className: "z-[9999] text-sm", children: [
140
140
  /* @__PURE__ */ e(f, { permissions: [o.EDIT_PAGE], children: /* @__PURE__ */ s(
141
- w,
141
+ C,
142
142
  {
143
143
  className: "flex cursor-pointer items-center gap-2",
144
144
  onClick: (c) => {
@@ -155,7 +155,7 @@ const fe = ({ page: a, onClose: g }) => {
155
155
  }
156
156
  ) }),
157
157
  /* @__PURE__ */ e(f, { permissions: [o.UNPUBLISH_PAGE], children: (n == null ? void 0 : n.online) && /* @__PURE__ */ s(
158
- w,
158
+ C,
159
159
  {
160
160
  className: "flex cursor-pointer items-center gap-2",
161
161
  onClick: (c) => {
@@ -168,7 +168,7 @@ const fe = ({ page: a, onClose: g }) => {
168
168
  }
169
169
  ) }),
170
170
  /* @__PURE__ */ e(f, { permissions: [o.DELETE_PAGE], children: /* @__PURE__ */ s(
171
- w,
171
+ C,
172
172
  {
173
173
  className: "flex cursor-pointer items-center gap-2",
174
174
  onClick: (c) => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-DTNHTRZu.cjs"),n=require("./index-BeGLwvqs.cjs"),r=require("lodash-es"),j=require("lucide-react"),c=require("react"),I=require("react-i18next"),L=require("sonner"),k=require("jotai"),M=({page:s,onClose:p})=>{const{t:l}=I.useTranslation(),[o,P]=c.useState(s.slug||""),{mutate:y,isPending:f}=n.useChangeSlug(),{data:i}=n.usePageTypes(),d=r.find(i,{key:s==null?void 0:s.pageType}),E=h=>{if(h.preventDefault(),!(s!=null&&s.primaryPage)&&Object.keys(n.LANGUAGES).some(S=>o===`/${S}`||r.startsWith(o,`/${S}/`))){L.toast.error(l("Error"),{description:l("Slugs cannot start with a language code for primary page")});return}y({...s,slug:o},{onSuccess:p})},m=(s==null?void 0:s.lang)||"";return e.jsx(a.Dialog,{open:!!s,onOpenChange:p,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:l("Change Slug")}),e.jsx(a.DialogDescription,{className:"text-xs",children:e.jsxs(N.Alert,{variant:"destructive",className:"mt-2",children:[e.jsx(j.AlertCircle,{className:"h-4 w-4"}),l("Changing the slug may have impact on your SEO. Please proceed with caution.")]})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-4 py-4 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{children:[e.jsxs("span",{children:[l("Type"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(d==null?void 0:d.name)||(s==null?void 0:s.pageType)]})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[l("Name"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",s.name]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(a.Label,{htmlFor:"slug",className:"text-right",children:[l("Slug")," ",e.jsxs("small",{className:"font-light text-gray-500",children:[l("Slug should start with")," /",m]})]}),e.jsx(N.Input,{id:"slug",value:o,onChange:h=>{const x=h.target.value;r.startsWith(x,`/${m}`)&&P(x)},className:"col-span-3",required:!0,pattern:"^/.*",title:l("Slug must start with /"),placeholder:l("Enter page slug")})]})]}),e.jsx(a.DialogFooter,{children:e.jsx(N.Button,{type:"submit",disabled:f||!r.startsWith(o,`/${m}`)||r.isEqual(s==null?void 0:s.slug,o),children:l(f?"Changing...":"Change Slug")})})]})]})})},T=c.lazy(()=>Promise.resolve().then(()=>require("./delete-page-CxVfKrBz.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-Bu75lH33.cjs"))),_=()=>{const{t:s}=I.useTranslation(),p=k.useSetAtom(n.addNewLangAtom),{selectedLang:l,fallbackLang:o,setSelectedLang:P}=a.useLanguages(),{data:y,isFetching:f}=n.useLanguagePages(),{data:i}=n.usePrimaryPage(),{data:d}=n.usePageTypes(),E=c.useMemo(()=>{const t=d==null?void 0:d.find(g=>g.key===(i==null?void 0:i.pageType));return i!=null&&i.dynamic?t==null?void 0:t.dynamicSlug:""},[d,i==null?void 0:i.pageType,i==null?void 0:i.dynamic]),[m,h]=c.useState(null),[x,v]=c.useState(null),[S,A]=c.useState(null),{data:b}=n.useWebsiteSetting(),D=r.filter(r.get(b,"languages")||["en"],t=>!r.find(y,{lang:t})&&t!==r.get(b,"fallbackLang"));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("ul",{className:"space-y-2",children:f?e.jsxs("div",{className:"w-full space-y-3 py-4",children:[e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"})]}):r.map(y,t=>{const g=t.lang,C=t.slug,w=!t.primaryPage,G=g===l;return e.jsxs(e.Fragment,{children:[e.jsxs("li",{className:`flex w-full cursor-pointer items-center justify-between rounded p-2 text-slate-500 ${G?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>P(g),children:[e.jsxs("div",{className:"flex-1 gap-x-3",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-[13px] text-slate-800",children:[e.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.get(n.LANGUAGES,w?o:g,g)]}),e.jsxs("div",{children:[C&&e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Slug: ",e.jsx("b",{className:"font-mono font-medium",children:E?`${C}/${E}`:C})]}),e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Name:",e.jsxs("b",{className:"font-medium",children:[" ",t.name," "]})]})]})]}),w?e.jsxs("div",{className:"flex items-center gap-x-1 text-[11px] text-orange-500",children:[e.jsx(j.StarIcon,{fill:"orange",className:"h-3 w-3"}),e.jsx("b",{children:" Primary"})]}):e.jsx("div",{className:"flex items-center gap-x-3",children:e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE,n.PAGES_PERMISSIONS.DELETE_PAGE,n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,onClick:u=>u.stopPropagation(),children:e.jsx(N.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(j.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"z-[9999] text-sm",children:[e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),p({edit:!0,id:t.id,primaryPage:t.primaryPage})},children:[e.jsx(j.PencilIcon,{className:"size-3"}),s("Edit")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:(t==null?void 0:t.online)&&e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),v(t)},children:[e.jsx(j.Power,{className:"size-3"}),s("Unpublish")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.DELETE_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),h(t)},children:[e.jsx(j.TrashIcon,{className:"size-3"}),s("Delete")]})})]})]})})})]},t.id),e.jsx("div",{className:"h-1 w-full border-b"})]})})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.ADD_PAGE],children:e.jsx("div",{className:"flex w-full justify-center",children:e.jsx(N.Button,{variant:"default",size:"sm",disabled:r.isEmpty(D),onClick:()=>{p({primaryPage:i==null?void 0:i.id,edit:!1})},children:s("Add new language page")})})}),m&&e.jsx(c.Suspense,{children:e.jsx(T,{page:m,onClose:()=>h(null)})}),x&&e.jsx(c.Suspense,{children:e.jsx(q,{page:x,onClose:()=>v(null)})}),S&&e.jsx(c.Suspense,{children:e.jsx(M,{page:S,onClose:()=>A(null)})})]})};exports.default=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),N=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-DCJDQs1a.cjs"),n=require("./index-BVwFJWDq.cjs"),r=require("lodash-es"),j=require("lucide-react"),c=require("react"),I=require("react-i18next"),L=require("sonner"),k=require("jotai"),M=({page:s,onClose:p})=>{const{t:l}=I.useTranslation(),[o,P]=c.useState(s.slug||""),{mutate:y,isPending:f}=n.useChangeSlug(),{data:i}=n.usePageTypes(),d=r.find(i,{key:s==null?void 0:s.pageType}),E=h=>{if(h.preventDefault(),!(s!=null&&s.primaryPage)&&Object.keys(n.LANGUAGES).some(S=>o===`/${S}`||r.startsWith(o,`/${S}/`))){L.toast.error(l("Error"),{description:l("Slugs cannot start with a language code for primary page")});return}y({...s,slug:o},{onSuccess:p})},m=(s==null?void 0:s.lang)||"";return e.jsx(a.Dialog,{open:!!s,onOpenChange:p,children:e.jsxs(a.DialogContent,{children:[e.jsxs(a.DialogHeader,{children:[e.jsx(a.DialogTitle,{children:l("Change Slug")}),e.jsx(a.DialogDescription,{className:"text-xs",children:e.jsxs(N.Alert,{variant:"destructive",className:"mt-2",children:[e.jsx(j.AlertCircle,{className:"h-4 w-4"}),l("Changing the slug may have impact on your SEO. Please proceed with caution.")]})})]}),e.jsxs("form",{onSubmit:E,children:[e.jsxs("div",{className:"space-y-4 py-4 text-sm",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{children:[e.jsxs("span",{children:[l("Type"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",(d==null?void 0:d.name)||(s==null?void 0:s.pageType)]})]}),e.jsxs("div",{children:[e.jsxs("span",{children:[l("Name"),":"]}),e.jsxs("span",{className:"font-medium text-gray-600",children:[" ",s.name]})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsxs(a.Label,{htmlFor:"slug",className:"text-right",children:[l("Slug")," ",e.jsxs("small",{className:"font-light text-gray-500",children:[l("Slug should start with")," /",m]})]}),e.jsx(N.Input,{id:"slug",value:o,onChange:h=>{const x=h.target.value;r.startsWith(x,`/${m}`)&&P(x)},className:"col-span-3",required:!0,pattern:"^/.*",title:l("Slug must start with /"),placeholder:l("Enter page slug")})]})]}),e.jsx(a.DialogFooter,{children:e.jsx(N.Button,{type:"submit",disabled:f||!r.startsWith(o,`/${m}`)||r.isEqual(s==null?void 0:s.slug,o),children:l(f?"Changing...":"Change Slug")})})]})]})})},T=c.lazy(()=>Promise.resolve().then(()=>require("./delete-page-DLohaU-U.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-CUr8Xub6.cjs"))),_=()=>{const{t:s}=I.useTranslation(),p=k.useSetAtom(n.addNewLangAtom),{selectedLang:l,fallbackLang:o,setSelectedLang:P}=a.useLanguages(),{data:y,isFetching:f}=n.useLanguagePages(),{data:i}=n.usePrimaryPage(),{data:d}=n.usePageTypes(),E=c.useMemo(()=>{const t=d==null?void 0:d.find(g=>g.key===(i==null?void 0:i.pageType));return i!=null&&i.dynamic?t==null?void 0:t.dynamicSlug:""},[d,i==null?void 0:i.pageType,i==null?void 0:i.dynamic]),[m,h]=c.useState(null),[x,v]=c.useState(null),[S,A]=c.useState(null),{data:b}=n.useWebsiteSetting(),D=r.filter(r.get(b,"languages")||["en"],t=>!r.find(y,{lang:t})&&t!==r.get(b,"fallbackLang"));return e.jsxs("div",{className:"space-y-4",children:[e.jsx("ul",{className:"space-y-2",children:f?e.jsxs("div",{className:"w-full space-y-3 py-4",children:[e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"}),e.jsx("div",{className:"h-8 w-full animate-pulse rounded bg-gray-300"})]}):r.map(y,t=>{const g=t.lang,C=t.slug,w=!t.primaryPage,G=g===l;return e.jsxs(e.Fragment,{children:[e.jsxs("li",{className:`flex w-full cursor-pointer items-center justify-between rounded p-2 text-slate-500 ${G?"bg-gray-200":"hover:bg-gray-100"}`,onClick:()=>P(g),children:[e.jsxs("div",{className:"flex-1 gap-x-3",children:[e.jsxs("div",{className:"flex items-center gap-x-2 text-[13px] text-slate-800",children:[e.jsx("div",{className:`h-2.5 w-2.5 rounded-full ${t.online?"bg-green-300":"bg-gray-300"}`}),r.get(n.LANGUAGES,w?o:g,g)]}),e.jsxs("div",{children:[C&&e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Slug: ",e.jsx("b",{className:"font-mono font-medium",children:E?`${C}/${E}`:C})]}),e.jsxs("div",{className:"text-[11px] font-light text-slate-600",children:["Name:",e.jsxs("b",{className:"font-medium",children:[" ",t.name," "]})]})]})]}),w?e.jsxs("div",{className:"flex items-center gap-x-1 text-[11px] text-orange-500",children:[e.jsx(j.StarIcon,{fill:"orange",className:"h-3 w-3"}),e.jsx("b",{children:" Primary"})]}):e.jsx("div",{className:"flex items-center gap-x-3",children:e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE,n.PAGES_PERMISSIONS.DELETE_PAGE,n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:e.jsxs(a.DropdownMenu,{children:[e.jsx(a.DropdownMenuTrigger,{asChild:!0,onClick:u=>u.stopPropagation(),children:e.jsx(N.Button,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",children:e.jsx(j.MoreHorizontal,{className:"h-4 w-4"})})}),e.jsxs(a.DropdownMenuContent,{align:"end",className:"z-[9999] text-sm",children:[e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.EDIT_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),p({edit:!0,id:t.id,primaryPage:t.primaryPage})},children:[e.jsx(j.PencilIcon,{className:"size-3"}),s("Edit")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.UNPUBLISH_PAGE],children:(t==null?void 0:t.online)&&e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),v(t)},children:[e.jsx(j.Power,{className:"size-3"}),s("Unpublish")]})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.DELETE_PAGE],children:e.jsxs(a.DropdownMenuItem,{className:"flex cursor-pointer items-center gap-2",onClick:u=>{u.stopPropagation(),h(t)},children:[e.jsx(j.TrashIcon,{className:"size-3"}),s("Delete")]})})]})]})})})]},t.id),e.jsx("div",{className:"h-1 w-full border-b"})]})})}),e.jsx(n.PermissionChecker,{permissions:[n.PAGES_PERMISSIONS.ADD_PAGE],children:e.jsx("div",{className:"flex w-full justify-center",children:e.jsx(N.Button,{variant:"default",size:"sm",disabled:r.isEmpty(D),onClick:()=>{p({primaryPage:i==null?void 0:i.id,edit:!1})},children:s("Add new language page")})})}),m&&e.jsx(c.Suspense,{children:e.jsx(T,{page:m,onClose:()=>h(null)})}),x&&e.jsx(c.Suspense,{children:e.jsx(q,{page:x,onClose:()=>v(null)})}),S&&e.jsx(c.Suspense,{children:e.jsx(M,{page:S,onClose:()=>A(null)})})]})};exports.default=_;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as a, Fragment as A, jsx as e } from "react/jsx-runtime";
2
- import { Z as he, _ as fe, $ as pe, a0 as K, a1 as ge, a2 as xe, a3 as ve, a4 as ke, a5 as Ne, a6 as be, a7 as Te, p as ye, a8 as Ce, a9 as we, aa as Ae } from "./index-B7HAfx-2.js";
2
+ import { Z as he, _ as fe, $ as pe, a0 as K, a1 as ge, a2 as xe, a3 as ve, a4 as ke, a5 as Ne, a6 as be, a7 as Te, p as ye, a8 as Ce, a9 as we, aa as Ae } from "./index-OuHV9Ann.js";
3
3
  import { z as X, B as v } from "./register-chai-top-bar-D6GjnauV.js";
4
4
  import { D as De } from "./STRINGS-BExFecZW.js";
5
5
  import { MagnifyingGlassIcon as q, PlusIcon as J, TokensIcon as je, ArrowLeftIcon as Oe, EyeOpenIcon as Y, Pencil1Icon as Se } from "@radix-ui/react-icons";
@@ -17,7 +17,7 @@ const W = (o) => {
17
17
  return h.length === 0 ? "" : h.length > 25 ? n("Token name must be 25 characters or less") : /^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(h) ? Object.entries(m).find(
18
18
  ([k, C]) => C.name === h && (!i || k !== u)
19
19
  ) ? n("Token name already exists") : "" : n("Only alphanumeric characters and hyphens allowed");
20
- }, Be = (o) => o.replace(/\s+/g, "-"), Fe = Re(() => import("./design-token-usage-WTVjf9c-.js")), te = ({
20
+ }, Be = (o) => o.replace(/\s+/g, "-"), Fe = Re(() => import("./design-token-usage-D1lWCJ3L.js")), te = ({
21
21
  tokenId: o,
22
22
  token: m,
23
23
  isDisabled: n,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DTNHTRZu.cjs"),y=require("@radix-ui/react-icons"),c=require("react"),j=require("react-i18next"),g=require("./plugin-DHpuZZXz.cjs"),o=require("lodash-es"),b=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),w=require("@tailwindcss/forms"),C=require("@tailwindcss/typography"),D=require("./fonts-D5fTqvSS.cjs"),F=require("./manage-design-tokens-BwrIc6dS.cjs"),N=()=>{const[s]=t.useTheme(),r=t.useThemeOptions(),[l]=t.useDarkMode(),{document:n,window:d}=t.useFrame(),i=D.useRegisteredFonts();c.useEffect(()=>{l?n==null||n.documentElement.classList.add("dark"):n==null||n.documentElement.classList.remove("dark")},[l,n]),c.useEffect(()=>{!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...g.getChaiThemeOptions(r)}},plugins:[C,w,b,v,g.plugin(function({addBase:a,theme:m}){a({"h1,h2,h3,h4,h5,h6":{fontFamily:m("fontFamily.heading")},body:{fontFamily:m("fontFamily.body"),color:m("colors.foreground"),backgroundColor:m("colors.background")}})})]})},[s,r,d]);const u=c.useMemo(()=>{const a=o.get(s,"fontFamily.heading"),m=o.get(s,"fontFamily.body");return i.filter(f=>f.family===a||f.family===m)},[s,i]),p=c.useMemo(()=>g.getThemeFontsUrls(o.filter(u,a=>o.has(a,"url"))),[u]),h=c.useMemo(()=>g.getThemeCustomFontFace(o.filter(u,a=>o.has(a,"src"))),[u]);return e.jsxs(e.Fragment,{children:[e.jsx(t.CssThemeVariables,{theme:s}),p.map((a,m)=>e.jsx("link",{rel:"stylesheet",href:a},`preview-font-${m}`)),e.jsx("style",{id:"chai-custom-fonts",dangerouslySetInnerHTML:{__html:h}})]})},T=({content:s,classes:r="",className:l="w-full rounded border-0",style:n={minHeight:80},title:d="Preview"})=>{const i=c.useMemo(()=>t.IframeInitialContent.replace('dir="__HTML_DIR__"','dir="ltr"'),[]);return e.jsxs(t.ChaiFrame,{className:l,style:n,title:d,initialContent:i,children:[e.jsx(N,{}),e.jsx("div",{className:"h-full p-4",children:e.jsx("div",{className:r||void 0,dangerouslySetInnerHTML:{__html:s}})})]})},x=["xs","sm","md","lg","xl","2xl"],k=s=>{if(s=s.trim().replace(/ +(?= )/g,""),o.isEmpty(s))return"";const r=o.map(s.split(" "),t.constructClassObject),l=[];for(const n of r){const d=n.mq;if(!l.includes(n.fullCls))for(let i=x.indexOf(d)+1;i<x.length;i++){const u=o.find(r,{property:n.property,mq:x[i]});if(u&&u.cls!==n.cls)break;o.find(r,{cls:n.cls,mq:x[i]})&&l.push(`${x[i]}:${n.cls}`)}}return o.filter(o.map(r,n=>l.includes(n.fullCls)?null:n.fullCls),n=>n!==null).join(" ")},q=({activeToken:s})=>{const{t:r}=j.useTranslation(),l=s!=null&&s.value?k(s.value):"",n=s&&s.name&&s.value;return e.jsx(t.ScrollArea,{className:"h-full",children:e.jsx("div",{className:"space-y-4 pr-4",children:e.jsxs("div",{className:"space-y-2 rounded-lg border bg-card p-4",children:[n&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-semibold",children:s.name}),s.id&&e.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[9px] text-muted-foreground",children:s.id})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[10px] font-medium text-muted-foreground",children:r("Preview:")}),e.jsx(T,{content:r("Sample text with token styles applied"),classes:l,style:{minHeight:80},title:r("Token Preview")})]})]})})})},A=({open:s,onOpenChange:r})=>{const{t:l}=j.useTranslation(),[n,d]=c.useState(null),[i,u]=c.useState(!1),[p,h]=c.useState(!1),a=c.useCallback(f=>{if(!f&&i){h(!0);return}r(f)},[i,r]),m=c.useCallback(()=>{h(!1),u(!1),r(!1)},[r]);return e.jsxs(e.Fragment,{children:[e.jsx(t.Dialog,{open:s,onOpenChange:a,children:e.jsxs(t.DialogContent,{className:"flex h-[540px] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(t.DialogHeader,{className:"border-b border-border px-6 py-4",children:e.jsxs(t.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(y.TokensIcon,{className:"h-5 w-5 text-primary"}),l("Design Token Management")]})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex w-1/2 flex-col border-r border-border p-4",children:e.jsx(F.default,{onActiveTokenChange:d,onDirtyStateChange:u})}),e.jsxs("div",{className:"flex w-1/2 flex-col p-4",children:[e.jsx("div",{className:"mb-3 flex items-center justify-between",children:e.jsx("h3",{className:"text-sm font-semibold",children:l("Live Preview")})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{activeToken:n})})]})]})]})}),e.jsx(t.AlertDialog,{open:p,onOpenChange:h,children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:l("Unsaved Changes")}),e.jsx(t.AlertDialogDescription,{children:l("You have unsaved changes. Are you sure you want to close? Your changes will be lost.")})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{children:l("Continue Editing")}),e.jsx(t.AlertDialogAction,{onClick:m,children:l("Discard Changes")})]})]})})]})};exports.default=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),t=require("./index-DCJDQs1a.cjs"),y=require("@radix-ui/react-icons"),c=require("react"),j=require("react-i18next"),g=require("./plugin-DHpuZZXz.cjs"),o=require("lodash-es"),b=require("@tailwindcss/aspect-ratio"),v=require("@tailwindcss/container-queries"),w=require("@tailwindcss/forms"),C=require("@tailwindcss/typography"),D=require("./fonts-D5fTqvSS.cjs"),F=require("./manage-design-tokens-udLBvkHA.cjs"),N=()=>{const[s]=t.useTheme(),r=t.useThemeOptions(),[l]=t.useDarkMode(),{document:n,window:d}=t.useFrame(),i=D.useRegisteredFonts();c.useEffect(()=>{l?n==null||n.documentElement.classList.add("dark"):n==null||n.documentElement.classList.remove("dark")},[l,n]),c.useEffect(()=>{!d||!d.tailwind||(d.tailwind.config={darkMode:"class",theme:{extend:{container:{center:!0,padding:"1rem",screens:{"2xl":"1400px"}},...g.getChaiThemeOptions(r)}},plugins:[C,w,b,v,g.plugin(function({addBase:a,theme:m}){a({"h1,h2,h3,h4,h5,h6":{fontFamily:m("fontFamily.heading")},body:{fontFamily:m("fontFamily.body"),color:m("colors.foreground"),backgroundColor:m("colors.background")}})})]})},[s,r,d]);const u=c.useMemo(()=>{const a=o.get(s,"fontFamily.heading"),m=o.get(s,"fontFamily.body");return i.filter(f=>f.family===a||f.family===m)},[s,i]),p=c.useMemo(()=>g.getThemeFontsUrls(o.filter(u,a=>o.has(a,"url"))),[u]),h=c.useMemo(()=>g.getThemeCustomFontFace(o.filter(u,a=>o.has(a,"src"))),[u]);return e.jsxs(e.Fragment,{children:[e.jsx(t.CssThemeVariables,{theme:s}),p.map((a,m)=>e.jsx("link",{rel:"stylesheet",href:a},`preview-font-${m}`)),e.jsx("style",{id:"chai-custom-fonts",dangerouslySetInnerHTML:{__html:h}})]})},T=({content:s,classes:r="",className:l="w-full rounded border-0",style:n={minHeight:80},title:d="Preview"})=>{const i=c.useMemo(()=>t.IframeInitialContent.replace('dir="__HTML_DIR__"','dir="ltr"'),[]);return e.jsxs(t.ChaiFrame,{className:l,style:n,title:d,initialContent:i,children:[e.jsx(N,{}),e.jsx("div",{className:"h-full p-4",children:e.jsx("div",{className:r||void 0,dangerouslySetInnerHTML:{__html:s}})})]})},x=["xs","sm","md","lg","xl","2xl"],k=s=>{if(s=s.trim().replace(/ +(?= )/g,""),o.isEmpty(s))return"";const r=o.map(s.split(" "),t.constructClassObject),l=[];for(const n of r){const d=n.mq;if(!l.includes(n.fullCls))for(let i=x.indexOf(d)+1;i<x.length;i++){const u=o.find(r,{property:n.property,mq:x[i]});if(u&&u.cls!==n.cls)break;o.find(r,{cls:n.cls,mq:x[i]})&&l.push(`${x[i]}:${n.cls}`)}}return o.filter(o.map(r,n=>l.includes(n.fullCls)?null:n.fullCls),n=>n!==null).join(" ")},q=({activeToken:s})=>{const{t:r}=j.useTranslation(),l=s!=null&&s.value?k(s.value):"",n=s&&s.name&&s.value;return e.jsx(t.ScrollArea,{className:"h-full",children:e.jsx("div",{className:"space-y-4 pr-4",children:e.jsxs("div",{className:"space-y-2 rounded-lg border bg-card p-4",children:[n&&e.jsx(e.Fragment,{children:e.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[e.jsx("span",{className:"text-sm font-semibold",children:s.name}),s.id&&e.jsx("span",{className:"rounded bg-muted px-2 py-0.5 font-mono text-[9px] text-muted-foreground",children:s.id})]})}),e.jsxs("div",{children:[e.jsx("div",{className:"mb-2 text-[10px] font-medium text-muted-foreground",children:r("Preview:")}),e.jsx(T,{content:r("Sample text with token styles applied"),classes:l,style:{minHeight:80},title:r("Token Preview")})]})]})})})},A=({open:s,onOpenChange:r})=>{const{t:l}=j.useTranslation(),[n,d]=c.useState(null),[i,u]=c.useState(!1),[p,h]=c.useState(!1),a=c.useCallback(f=>{if(!f&&i){h(!0);return}r(f)},[i,r]),m=c.useCallback(()=>{h(!1),u(!1),r(!1)},[r]);return e.jsxs(e.Fragment,{children:[e.jsx(t.Dialog,{open:s,onOpenChange:a,children:e.jsxs(t.DialogContent,{className:"flex h-[540px] max-w-6xl flex-col gap-0 p-0",children:[e.jsx(t.DialogHeader,{className:"border-b border-border px-6 py-4",children:e.jsxs(t.DialogTitle,{className:"flex items-center gap-2",children:[e.jsx(y.TokensIcon,{className:"h-5 w-5 text-primary"}),l("Design Token Management")]})}),e.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[e.jsx("div",{className:"flex w-1/2 flex-col border-r border-border p-4",children:e.jsx(F.default,{onActiveTokenChange:d,onDirtyStateChange:u})}),e.jsxs("div",{className:"flex w-1/2 flex-col p-4",children:[e.jsx("div",{className:"mb-3 flex items-center justify-between",children:e.jsx("h3",{className:"text-sm font-semibold",children:l("Live Preview")})}),e.jsx("div",{className:"flex-1 overflow-y-auto",children:e.jsx(q,{activeToken:n})})]})]})]})}),e.jsx(t.AlertDialog,{open:p,onOpenChange:h,children:e.jsxs(t.AlertDialogContent,{children:[e.jsxs(t.AlertDialogHeader,{children:[e.jsx(t.AlertDialogTitle,{children:l("Unsaved Changes")}),e.jsx(t.AlertDialogDescription,{children:l("You have unsaved changes. Are you sure you want to close? Your changes will be lost.")})]}),e.jsxs(t.AlertDialogFooter,{children:[e.jsx(t.AlertDialogCancel,{children:l("Continue Editing")}),e.jsx(t.AlertDialogAction,{onClick:m,children:l("Discard Changes")})]})]})})]})};exports.default=A;
@@ -1,5 +1,5 @@
1
1
  import { jsxs as l, jsx as e, Fragment as y } from "react/jsx-runtime";
2
- import { al as k, am as A, an as T, ao as M, ap as H, aq as _, ar as j, as as I, a7 as P, D as S, e as L, f as E, g as O, a1 as U, a2 as q, at as R, a3 as $, a4 as V, au as Y, a5 as z, a6 as B } from "./index-B7HAfx-2.js";
2
+ import { al as k, am as A, an as T, ao as M, ap as H, aq as _, ar as j, as as I, a7 as P, D as S, e as L, f as E, g as O, a1 as U, a2 as q, at as R, a3 as $, a4 as V, au as Y, a5 as z, a6 as B } from "./index-OuHV9Ann.js";
3
3
  import { TokensIcon as Q } from "@radix-ui/react-icons";
4
4
  import { useMemo as u, useEffect as b, useState as g, useCallback as w } from "react";
5
5
  import { useTranslation as F } from "react-i18next";
@@ -10,7 +10,7 @@ import ee from "@tailwindcss/container-queries";
10
10
  import se from "@tailwindcss/forms";
11
11
  import ne from "@tailwindcss/typography";
12
12
  import { u as ae } from "./fonts-B3UYxuJI.js";
13
- import re from "./manage-design-tokens-LwImeKaK.js";
13
+ import re from "./manage-design-tokens-6YGIctip.js";
14
14
  const te = () => {
15
15
  const [s] = T(), a = M(), [r] = H(), { document: n, window: i } = _(), t = ae();
16
16
  b(() => {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-DTNHTRZu.cjs"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),oe=require("./STRINGS-FNnfjF5H.cjs"),j=require("@radix-ui/react-icons"),le=require("jotai"),ce=require("nanoid"),i=require("react"),de=require("react-i18next"),p=require("sonner"),ue=require("tailwind-merge"),L=o=>{const m=o.trim();return m.length===0||m.length>25?!1:/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m)},me=(o,m,t,a=!1,x)=>{const h=o.trim();return h.length===0?"":h.length>25?t("Token name must be 25 characters or less"):/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(h)?Object.entries(m).find(([k,C])=>C.name===h&&(!a||k!==x))?t("Token name already exists"):"":t("Only alphanumeric characters and hyphens allowed")},xe=o=>o.replace(/\s+/g,"-"),he=i.lazy(()=>Promise.resolve().then(()=>require("./design-token-usage-5jsa9ojN.cjs"))),_=({tokenId:o,token:m,isDisabled:t,isSelected:a,isArchived:x=!1,onSelect:h,onEdit:y,onUnarchive:N})=>e.jsxs("div",{onClick:()=>h(o),className:`group relative flex cursor-pointer items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 ${x?"border-muted bg-muted/30 opacity-60":a?"border-primary bg-primary/10":"hover:bg-muted/90"}`,children:[e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:`text-xs font-semibold ${x?"text-muted-foreground":""}`,children:m.name}),e.jsx("div",{className:`w-full max-w-52 truncate text-[10px] font-light ${x?"text-muted-foreground":""}`,children:m.value})]}),e.jsxs("div",{className:"absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:[!x&&e.jsxs(e.Fragment,{children:[e.jsx(i.Suspense,{fallback:null,children:e.jsx(he,{tokenId:o,tokenName:m.name,children:e.jsx(g.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.EyeOpenIcon,{className:"h-3 w-3"})})})}),e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:k=>{k.stopPropagation(),y(o)},disabled:t,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.Pencil1Icon,{className:"h-3 w-3"})})]}),x&&e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:k=>{k.stopPropagation(),N==null||N(o)},disabled:t,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.EyeOpenIcon,{className:"h-3 w-3"})})]})]}),fe=({onActiveTokenChange:o,onDirtyStateChange:m})=>{const{t}=de.useTranslation(),[a,x]=le.useAtom(c.chaiDesignTokensAtom),h=c.useIncrementActionsCount(),{saveDesignTokens:y,debouncedSaveDesignTokens:N}=c.useSaveWebsiteData(),k=c.useBuilderProp("pageId",""),C=c.useBuilderProp("siteWideUsage",{}),[f,B]=i.useState("view"),[v,R]=i.useState(null),[b,W]=i.useState(null),[l,A]=i.useState(""),[d,S]=i.useState(""),[D,I]=i.useState(""),[O,H]=i.useState(""),[K,q]=i.useState(!1),z=i.useRef(null),[E,M]=i.useState({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P=i.useRef(null),X=i.useCallback(s=>{if(!C)return{pageCount:0,partialCount:0};let n=0,r=0;return Object.entries(C).forEach(([u,T])=>{if(u===k||!(T!=null&&T.designTokens))return;Object.keys(T.designTokens).some(ie=>ie===s)&&(T.isPartial?r++:n++)}),{pageCount:n,partialCount:r}},[C,k]),F=i.useMemo(()=>Object.entries(a).filter(([,s])=>s.name.toLowerCase().includes(O.toLowerCase())||s.value.toLowerCase().includes(O.toLowerCase())),[a,O]);i.useEffect(()=>{if(!m)return;const s=f==="add"&&(l&&l.trim().length>0||d&&d.trim().length>0);m(s)},[f,l,d,m]),i.useEffect(()=>{if(o)if(f==="edit"||f==="add")o(l&&d?{name:l,value:d,id:v||void 0}:null);else if(f==="view"&&b&&a[b]){const s=a[b];o({name:s.name,value:s.value,id:b})}else o(null)},[f,l,d,v,b,a,o]);const J=()=>{if(!l.trim()||!d.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!L(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.entries(a).find(([n,r])=>r.name===l.trim()&&n!==v)){p.toast.error(t("Token already exists"));return}v&&Y(l,d)},w=i.useCallback(()=>{R(null),A(""),S(""),I(""),q(!1),B("view")},[]),Y=i.useCallback((s,n)=>{!v||f!=="edit"||!s.trim()||!n.trim()||!L(s)||Object.entries(a).find(([u,T])=>T.name===s.trim()&&u!==v)||(q(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{const u={...a,[v]:{name:s.trim(),value:n.trim()}};x(u),h(),N(),q(!1),p.toast.success(t("Token updated successfully")),w()},10))},[v,f,a,x,h,N,t,w]),U=()=>{if(!l.trim()||!d.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!L(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.values(a).find(u=>u.name===l.trim())){p.toast.error(t("Token already exists"));return}const n=`${oe.DESIGN_TOKEN_PREFIX}${ce.nanoid(12)}`,r={...a,[n]:{name:l.trim(),value:d.trim()}};x(r),h(),y(),p.toast.success(t("Token added successfully")),w()},$=s=>{const n=a[s];if(!n)return;const{pageCount:r,partialCount:u}=X(s);M({isOpen:!0,tokenId:s,tokenName:n.name,pageCount:r,partialCount:u}),P.current=s},ee=()=>{const s=P.current;if(!s)return;const n={...a,[s]:{...a[s],archived:!0}};x(n),h(),y(),p.toast.success(t("Token archived successfully")),M({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P.current=null},G=s=>{const n={...a,[s]:{name:a[s].name,value:a[s].value}};x(n),h(),p.toast.success(t("Token unarchived successfully"))},Z=s=>{const n=a[s];n&&(R(s),A(n.name),S(n.value),I(""),B("edit"))},V=()=>{R(null),A(""),S(""),I(""),B("add")},se=s=>{const n=xe(s);A(n);const r=me(n,a,t,f==="edit",v||void 0);I(r)},Q=s=>{S(s)},te=s=>{const n=c.orderClassesByBreakpoint(c.removeDuplicateClasses(ue.twMerge(d,s)));Q(n)},ne=s=>{const n=d.split(" ").filter(r=>r!==s).join(" ");Q(n)},re=()=>{const s=f==="edit",n=t(s?"Edit Design Token":"Add Design Token"),r=t(s?"Update design token":"Create a reusable design token");return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5",children:[e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:w,className:"h-6 w-6 rounded-full p-0 hover:bg-muted",children:e.jsx(j.ArrowLeftIcon,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xs font-semibold text-foreground",children:n}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:r})]}),s&&K&&e.jsx("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary"})})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(c.Label,{htmlFor:"token-name",className:"text-xs font-medium",children:t("Token Name")}),e.jsx(g.Input,{id:"token-name",placeholder:"Button-Primary",value:l,onChange:u=>se(u.target.value),className:"h-7 text-xs"}),D?e.jsx("span",{className:"text-[10px] text-destructive",children:D}):e.jsx("span",{className:"text-[10px] font-light text-muted-foreground",children:t("Button-Primary, Card-Header, Text-Large etc.")})]}),e.jsx(c.ManualClasses,{from:"designToken",classFromProps:d,onAddNew:te,onRemove:ne,showDesignTokenSuggestions:!1}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 pt-3",children:[e.jsx(g.Button,{variant:"outline",onClick:w,className:"h-7 text-xs",children:t("Cancel")}),s?e.jsx(g.Button,{onClick:J,disabled:!l.trim()||!d.trim()||!!D,className:"h-7 text-xs",children:t("Save Token")}):e.jsx(g.Button,{onClick:U,disabled:!l.trim()||!d.trim()||!!D,className:"h-7 text-xs",children:t("Add Token")})]})]})]})},ae=()=>{const s=F.filter(([,r])=>!r.archived),n=F.filter(([,r])=>r.archived);return e.jsxs(e.Fragment,{children:[Object.entries(a).length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(j.MagnifyingGlassIcon,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx(g.Input,{placeholder:t("Search tokens"),value:O,onChange:r=>H(r.target.value),className:"h-6 pl-7 text-xs"})]}),e.jsxs(g.Button,{variant:"outline",onClick:V,size:"sm",className:"h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",children:[e.jsx(j.PlusIcon,{className:"h-3 w-3"}),t("Add")]})]}),e.jsx("div",{className:"no-scrollbar flex flex-1 flex-col overflow-hidden pt-2",children:e.jsx(c.ScrollArea,{className:"flex h-full flex-1 items-center justify-center",children:e.jsxs("div",{className:"space-y-1",children:[Object.entries(a).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2 text-3xl",children:e.jsx(j.TokensIcon,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No design tokens yet")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("Create reusable design tokens to streamline your styling")}),e.jsxs(g.Button,{variant:"default",onClick:V,size:"sm",className:"mt-4 h-7 text-xs leading-tight",children:[e.jsx(j.PlusIcon,{className:"mr-1 h-3 w-3"}),t("Add first design token")]})]}):F.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx(j.MagnifyingGlassIcon,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No tokens found")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("No design tokens match your search")})]}):e.jsxs(e.Fragment,{children:[s.length>0&&e.jsx("div",{className:"space-y-1",children:s.map(([r,u])=>e.jsx(_,{token:u,tokenId:r,isSelected:b===r,isArchived:!1,onSelect:W,onEdit:Z,onArchive:$,onUnarchive:G,isDisabled:!1},r))}),n.length>0&&e.jsxs("div",{className:"mt-4 space-y-1",children:[e.jsx("div",{className:"px-2 py-1 text-[10px] font-semibold text-muted-foreground",children:t("Archived")}),n.map(([r,u])=>e.jsx(_,{token:u,tokenId:r,isSelected:b===r,isArchived:!0,onSelect:W,onEdit:Z,onArchive:$,onUnarchive:G,isDisabled:!1},r))]})]}),e.jsx("div",{className:"h-44"})]})})})]})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full w-full flex-col",children:f==="view"?ae():re()}),e.jsx(c.AlertDialog,{open:E.isOpen,onOpenChange:s=>{s||(M({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P.current=null)},children:e.jsxs(c.AlertDialogContent,{children:[e.jsx(c.AlertDialogTitle,{children:t("Archive Design Token")}),e.jsxs(c.AlertDialogDescription,{className:"space-y-3",children:[e.jsxs("p",{children:[t("This token is used on")," ",e.jsx("span",{className:"font-semibold",children:E.pageCount})," ",t("pages"),E.partialCount>0&&e.jsxs(e.Fragment,{children:[" ",t("and")," ",e.jsx("span",{className:"font-semibold",children:E.partialCount})," ",t("partials")]}),"."]}),e.jsx("p",{className:"text-sm text-destructive",children:t("Archiving this token will remove the styling for those blocks.")}),e.jsx("p",{children:t("Do you wish to continue?")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(c.AlertDialogCancel,{children:t("Cancel")}),e.jsx(c.AlertDialogAction,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:t("Archive")})]})]})})]})};exports.default=fe;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("./index-DCJDQs1a.cjs"),g=require("./register-chai-top-bar-DyW9GPzV.cjs"),oe=require("./STRINGS-FNnfjF5H.cjs"),j=require("@radix-ui/react-icons"),le=require("jotai"),ce=require("nanoid"),i=require("react"),de=require("react-i18next"),p=require("sonner"),ue=require("tailwind-merge"),L=o=>{const m=o.trim();return m.length===0||m.length>25?!1:/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(m)},me=(o,m,t,a=!1,x)=>{const h=o.trim();return h.length===0?"":h.length>25?t("Token name must be 25 characters or less"):/^[a-zA-Z0-9]+(-[a-zA-Z0-9]+)*$/.test(h)?Object.entries(m).find(([k,C])=>C.name===h&&(!a||k!==x))?t("Token name already exists"):"":t("Only alphanumeric characters and hyphens allowed")},xe=o=>o.replace(/\s+/g,"-"),he=i.lazy(()=>Promise.resolve().then(()=>require("./design-token-usage-eY2wQ0l3.cjs"))),_=({tokenId:o,token:m,isDisabled:t,isSelected:a,isArchived:x=!1,onSelect:h,onEdit:y,onUnarchive:N})=>e.jsxs("div",{onClick:()=>h(o),className:`group relative flex cursor-pointer items-center justify-between overflow-hidden rounded border p-2 transition-all duration-150 ${x?"border-muted bg-muted/30 opacity-60":a?"border-primary bg-primary/10":"hover:bg-muted/90"}`,children:[e.jsxs("div",{className:"min-w-0 flex-1 overflow-hidden",children:[e.jsx("div",{className:`text-xs font-semibold ${x?"text-muted-foreground":""}`,children:m.name}),e.jsx("div",{className:`w-full max-w-52 truncate text-[10px] font-light ${x?"text-muted-foreground":""}`,children:m.value})]}),e.jsxs("div",{className:"absolute right-1 top-1 flex flex-shrink-0 items-center opacity-0 transition-opacity duration-150 group-hover:opacity-100",children:[!x&&e.jsxs(e.Fragment,{children:[e.jsx(i.Suspense,{fallback:null,children:e.jsx(he,{tokenId:o,tokenName:m.name,children:e.jsx(g.Button,{variant:"ghost",size:"sm",className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.EyeOpenIcon,{className:"h-3 w-3"})})})}),e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:k=>{k.stopPropagation(),y(o)},disabled:t,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.Pencil1Icon,{className:"h-3 w-3"})})]}),x&&e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:k=>{k.stopPropagation(),N==null||N(o)},disabled:t,className:"h-6 w-6 rounded-full p-0 hover:bg-primary/10 hover:text-primary",children:e.jsx(j.EyeOpenIcon,{className:"h-3 w-3"})})]})]}),fe=({onActiveTokenChange:o,onDirtyStateChange:m})=>{const{t}=de.useTranslation(),[a,x]=le.useAtom(c.chaiDesignTokensAtom),h=c.useIncrementActionsCount(),{saveDesignTokens:y,debouncedSaveDesignTokens:N}=c.useSaveWebsiteData(),k=c.useBuilderProp("pageId",""),C=c.useBuilderProp("siteWideUsage",{}),[f,B]=i.useState("view"),[v,R]=i.useState(null),[b,W]=i.useState(null),[l,A]=i.useState(""),[d,S]=i.useState(""),[D,I]=i.useState(""),[O,H]=i.useState(""),[K,q]=i.useState(!1),z=i.useRef(null),[E,M]=i.useState({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P=i.useRef(null),X=i.useCallback(s=>{if(!C)return{pageCount:0,partialCount:0};let n=0,r=0;return Object.entries(C).forEach(([u,T])=>{if(u===k||!(T!=null&&T.designTokens))return;Object.keys(T.designTokens).some(ie=>ie===s)&&(T.isPartial?r++:n++)}),{pageCount:n,partialCount:r}},[C,k]),F=i.useMemo(()=>Object.entries(a).filter(([,s])=>s.name.toLowerCase().includes(O.toLowerCase())||s.value.toLowerCase().includes(O.toLowerCase())),[a,O]);i.useEffect(()=>{if(!m)return;const s=f==="add"&&(l&&l.trim().length>0||d&&d.trim().length>0);m(s)},[f,l,d,m]),i.useEffect(()=>{if(o)if(f==="edit"||f==="add")o(l&&d?{name:l,value:d,id:v||void 0}:null);else if(f==="view"&&b&&a[b]){const s=a[b];o({name:s.name,value:s.value,id:b})}else o(null)},[f,l,d,v,b,a,o]);const J=()=>{if(!l.trim()||!d.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!L(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.entries(a).find(([n,r])=>r.name===l.trim()&&n!==v)){p.toast.error(t("Token already exists"));return}v&&Y(l,d)},w=i.useCallback(()=>{R(null),A(""),S(""),I(""),q(!1),B("view")},[]),Y=i.useCallback((s,n)=>{!v||f!=="edit"||!s.trim()||!n.trim()||!L(s)||Object.entries(a).find(([u,T])=>T.name===s.trim()&&u!==v)||(q(!0),z.current&&clearTimeout(z.current),z.current=setTimeout(()=>{const u={...a,[v]:{name:s.trim(),value:n.trim()}};x(u),h(),N(),q(!1),p.toast.success(t("Token updated successfully")),w()},10))},[v,f,a,x,h,N,t,w]),U=()=>{if(!l.trim()||!d.trim()){p.toast.error(t("Please fill in both token name and classes"));return}if(!L(l)){p.toast.error(t("Invalid design token name format"));return}if(Object.values(a).find(u=>u.name===l.trim())){p.toast.error(t("Token already exists"));return}const n=`${oe.DESIGN_TOKEN_PREFIX}${ce.nanoid(12)}`,r={...a,[n]:{name:l.trim(),value:d.trim()}};x(r),h(),y(),p.toast.success(t("Token added successfully")),w()},$=s=>{const n=a[s];if(!n)return;const{pageCount:r,partialCount:u}=X(s);M({isOpen:!0,tokenId:s,tokenName:n.name,pageCount:r,partialCount:u}),P.current=s},ee=()=>{const s=P.current;if(!s)return;const n={...a,[s]:{...a[s],archived:!0}};x(n),h(),y(),p.toast.success(t("Token archived successfully")),M({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P.current=null},G=s=>{const n={...a,[s]:{name:a[s].name,value:a[s].value}};x(n),h(),p.toast.success(t("Token unarchived successfully"))},Z=s=>{const n=a[s];n&&(R(s),A(n.name),S(n.value),I(""),B("edit"))},V=()=>{R(null),A(""),S(""),I(""),B("add")},se=s=>{const n=xe(s);A(n);const r=me(n,a,t,f==="edit",v||void 0);I(r)},Q=s=>{S(s)},te=s=>{const n=c.orderClassesByBreakpoint(c.removeDuplicateClasses(ue.twMerge(d,s)));Q(n)},ne=s=>{const n=d.split(" ").filter(r=>r!==s).join(" ");Q(n)},re=()=>{const s=f==="edit",n=t(s?"Edit Design Token":"Add Design Token"),r=t(s?"Update design token":"Create a reusable design token");return e.jsxs("div",{className:"flex h-full flex-col",children:[e.jsxs("div",{className:"mb-3 flex items-center gap-2 rounded-md border border-border/50 bg-muted p-1.5",children:[e.jsx(g.Button,{variant:"ghost",size:"sm",onClick:w,className:"h-6 w-6 rounded-full p-0 hover:bg-muted",children:e.jsx(j.ArrowLeftIcon,{className:"h-3 w-3"})}),e.jsxs("div",{className:"flex-1",children:[e.jsx("h3",{className:"text-xs font-semibold text-foreground",children:n}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:r})]}),s&&K&&e.jsx("div",{className:"flex items-center gap-1 text-[10px] text-muted-foreground",children:e.jsx("div",{className:"h-1.5 w-1.5 animate-pulse rounded-full bg-primary"})})]}),e.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(c.Label,{htmlFor:"token-name",className:"text-xs font-medium",children:t("Token Name")}),e.jsx(g.Input,{id:"token-name",placeholder:"Button-Primary",value:l,onChange:u=>se(u.target.value),className:"h-7 text-xs"}),D?e.jsx("span",{className:"text-[10px] text-destructive",children:D}):e.jsx("span",{className:"text-[10px] font-light text-muted-foreground",children:t("Button-Primary, Card-Header, Text-Large etc.")})]}),e.jsx(c.ManualClasses,{from:"designToken",classFromProps:d,onAddNew:te,onRemove:ne,showDesignTokenSuggestions:!1}),e.jsxs("div",{className:"mt-3 flex items-center justify-end gap-2 pt-3",children:[e.jsx(g.Button,{variant:"outline",onClick:w,className:"h-7 text-xs",children:t("Cancel")}),s?e.jsx(g.Button,{onClick:J,disabled:!l.trim()||!d.trim()||!!D,className:"h-7 text-xs",children:t("Save Token")}):e.jsx(g.Button,{onClick:U,disabled:!l.trim()||!d.trim()||!!D,className:"h-7 text-xs",children:t("Add Token")})]})]})]})},ae=()=>{const s=F.filter(([,r])=>!r.archived),n=F.filter(([,r])=>r.archived);return e.jsxs(e.Fragment,{children:[Object.entries(a).length>0&&e.jsxs("div",{className:"flex items-center justify-between gap-x-2",children:[e.jsxs("div",{className:"relative flex-1",children:[e.jsx(j.MagnifyingGlassIcon,{className:"absolute left-2 top-1/2 h-3 w-3 -translate-y-1/2 text-muted-foreground"}),e.jsx(g.Input,{placeholder:t("Search tokens"),value:O,onChange:r=>H(r.target.value),className:"h-6 pl-7 text-xs"})]}),e.jsxs(g.Button,{variant:"outline",onClick:V,size:"sm",className:"h-6 border-primary text-xs text-primary hover:bg-primary/10 hover:text-primary",children:[e.jsx(j.PlusIcon,{className:"h-3 w-3"}),t("Add")]})]}),e.jsx("div",{className:"no-scrollbar flex flex-1 flex-col overflow-hidden pt-2",children:e.jsx(c.ScrollArea,{className:"flex h-full flex-1 items-center justify-center",children:e.jsxs("div",{className:"space-y-1",children:[Object.entries(a).length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2 text-3xl",children:e.jsx(j.TokensIcon,{className:"h-12 w-12 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No design tokens yet")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("Create reusable design tokens to streamline your styling")}),e.jsxs(g.Button,{variant:"default",onClick:V,size:"sm",className:"mt-4 h-7 text-xs leading-tight",children:[e.jsx(j.PlusIcon,{className:"mr-1 h-3 w-3"}),t("Add first design token")]})]}):F.length===0?e.jsxs("div",{className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-muted bg-muted/20 py-8",children:[e.jsx("div",{className:"mb-2",children:e.jsx(j.MagnifyingGlassIcon,{className:"h-10 w-10 text-muted-foreground"})}),e.jsx("p",{className:"mb-1 text-sm font-medium text-foreground",children:t("No tokens found")}),e.jsx("p",{className:"text-center text-xs text-muted-foreground",children:t("No design tokens match your search")})]}):e.jsxs(e.Fragment,{children:[s.length>0&&e.jsx("div",{className:"space-y-1",children:s.map(([r,u])=>e.jsx(_,{token:u,tokenId:r,isSelected:b===r,isArchived:!1,onSelect:W,onEdit:Z,onArchive:$,onUnarchive:G,isDisabled:!1},r))}),n.length>0&&e.jsxs("div",{className:"mt-4 space-y-1",children:[e.jsx("div",{className:"px-2 py-1 text-[10px] font-semibold text-muted-foreground",children:t("Archived")}),n.map(([r,u])=>e.jsx(_,{token:u,tokenId:r,isSelected:b===r,isArchived:!0,onSelect:W,onEdit:Z,onArchive:$,onUnarchive:G,isDisabled:!1},r))]})]}),e.jsx("div",{className:"h-44"})]})})})]})};return e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex h-full w-full flex-col",children:f==="view"?ae():re()}),e.jsx(c.AlertDialog,{open:E.isOpen,onOpenChange:s=>{s||(M({isOpen:!1,tokenId:null,tokenName:"",pageCount:0,partialCount:0}),P.current=null)},children:e.jsxs(c.AlertDialogContent,{children:[e.jsx(c.AlertDialogTitle,{children:t("Archive Design Token")}),e.jsxs(c.AlertDialogDescription,{className:"space-y-3",children:[e.jsxs("p",{children:[t("This token is used on")," ",e.jsx("span",{className:"font-semibold",children:E.pageCount})," ",t("pages"),E.partialCount>0&&e.jsxs(e.Fragment,{children:[" ",t("and")," ",e.jsx("span",{className:"font-semibold",children:E.partialCount})," ",t("partials")]}),"."]}),e.jsx("p",{className:"text-sm text-destructive",children:t("Archiving this token will remove the styling for those blocks.")}),e.jsx("p",{children:t("Do you wish to continue?")})]}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(c.AlertDialogCancel,{children:t("Cancel")}),e.jsx(c.AlertDialogAction,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:t("Archive")})]})]})})]})};exports.default=fe;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-DTNHTRZu.cjs"),y=require("./index-BeGLwvqs.cjs"),w=require("lodash-es"),m=require("lucide-react"),l=require("react"),M=require("react-i18next"),k=require("sonner"),B=1*1024*1024,A=({page:r,onClose:u})=>{const{t:s}=M.useTranslation(),[f,p]=l.useState(!1),[j,T]=l.useState(""),[c,N]=l.useState(""),[v,x]=l.useState(!1),i=l.useRef(null),C=y.useMarkAsTemplate(),{data:h}=y.usePageTypes(),g=h==null?void 0:h.find(a=>a.key===r.pageType),I=(g==null?void 0:g.name)||w.startCase(r.pageType),D=l.useCallback(a=>{var b;const d=(b=a.target.files)==null?void 0:b[0];if(d){if(d.size>B){k.toast.error(s("File too large"),{description:`${s("Maximum file size is 1MB. Selected file is")} ${(d.size/1024).toFixed(2)}KB.`}),i.current&&(i.current.value="");return}try{x(!0);const n=new FileReader;n.onloadend=()=>{N(n.result),x(!1)},n.readAsDataURL(d)}catch(n){console.error("Error reading file:",n),x(!1),k.toast.error(s("Failed to process image"),{description:n instanceof Error?n.message:s("Unknown error")})}}},[s]),F=()=>{N(""),i.current&&(i.current.value="")},S=()=>{var a;(a=i.current)==null||a.click()},q=()=>{p(!0),C.mutate({page:r,name:r.name,description:j.trim()||void 0,pageType:r.pageType,...c?{previewImage:c}:{}},{onSuccess:()=>{p(!1),u()},onError:()=>{p(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:u,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:s("Mark as template")}),e.jsxs(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:[s("Are you sure you want to mark this page as a template?"),e.jsx("br",{}),s("Templates can be used to create new pages with the same content.")]})]}),e.jsxs("div",{className:"mb-4 space-y-4 text-xs",children:[e.jsxs("div",{className:"space-y-3 rounded border bg-slate-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.Tag,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Page Name"),":"]}),e.jsx("span",{className:"font-semibold",children:w.startCase(r.name)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.File,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Type"),":"]}),e.jsx("span",{className:"font-semibold",children:I})]})]}),e.jsxs("div",{children:[e.jsx(t.Label,{htmlFor:"description",className:"text-xs font-medium",children:s("Description (Optional)")}),e.jsx(t.Textarea,{id:"description",placeholder:s("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:j,onChange:a=>T(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"previewImage",className:"text-xs font-medium",children:s("Preview Image (Optional)")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o.Input,{type:"file",id:"previewImage",ref:i,onChange:D,accept:"image/*",className:"hidden"}),e.jsx(o.Button,{type:"button",variant:"outline",onClick:S,disabled:v,className:"w-full",children:v?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),s("Uploading...")]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(m.ImageIcon,{className:"h-4 w-4"}),s("Select image")]})}),c&&e.jsx(o.Button,{type:"button",variant:"outline",size:"icon",onClick:F,children:e.jsx(m.X,{className:"h-4 w-4"})})]}),c&&e.jsx("div",{className:"aspect-video overflow-hidden rounded-md border",children:e.jsx("img",{src:c,alt:s("Preview"),className:"h-full max-h-[200px] w-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("max 1mb")})]})]})]}),e.jsxs(t.DialogFooter,{className:f?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:a=>{a.stopPropagation(),u()},children:s("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:f,onClick:q,children:s("Mark as template")})]})]})})};exports.default=A;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),o=require("./register-chai-top-bar-DyW9GPzV.cjs"),t=require("./index-DCJDQs1a.cjs"),y=require("./index-BVwFJWDq.cjs"),w=require("lodash-es"),m=require("lucide-react"),l=require("react"),M=require("react-i18next"),k=require("sonner"),B=1*1024*1024,A=({page:r,onClose:u})=>{const{t:s}=M.useTranslation(),[f,p]=l.useState(!1),[j,T]=l.useState(""),[c,N]=l.useState(""),[v,x]=l.useState(!1),i=l.useRef(null),C=y.useMarkAsTemplate(),{data:h}=y.usePageTypes(),g=h==null?void 0:h.find(a=>a.key===r.pageType),I=(g==null?void 0:g.name)||w.startCase(r.pageType),D=l.useCallback(a=>{var b;const d=(b=a.target.files)==null?void 0:b[0];if(d){if(d.size>B){k.toast.error(s("File too large"),{description:`${s("Maximum file size is 1MB. Selected file is")} ${(d.size/1024).toFixed(2)}KB.`}),i.current&&(i.current.value="");return}try{x(!0);const n=new FileReader;n.onloadend=()=>{N(n.result),x(!1)},n.readAsDataURL(d)}catch(n){console.error("Error reading file:",n),x(!1),k.toast.error(s("Failed to process image"),{description:n instanceof Error?n.message:s("Unknown error")})}}},[s]),F=()=>{N(""),i.current&&(i.current.value="")},S=()=>{var a;(a=i.current)==null||a.click()},q=()=>{p(!0),C.mutate({page:r,name:r.name,description:j.trim()||void 0,pageType:r.pageType,...c?{previewImage:c}:{}},{onSuccess:()=>{p(!1),u()},onError:()=>{p(!1)}})};return e.jsx(t.Dialog,{open:!0,onOpenChange:u,children:e.jsxs(t.DialogContent,{children:[e.jsxs(t.DialogHeader,{children:[e.jsx(t.DialogTitle,{children:s("Mark as template")}),e.jsxs(t.DialogDescription,{className:"space-y-1 py-4 text-xs text-slate-500",children:[s("Are you sure you want to mark this page as a template?"),e.jsx("br",{}),s("Templates can be used to create new pages with the same content.")]})]}),e.jsxs("div",{className:"mb-4 space-y-4 text-xs",children:[e.jsxs("div",{className:"space-y-3 rounded border bg-slate-50 p-4",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.Tag,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Page Name"),":"]}),e.jsx("span",{className:"font-semibold",children:w.startCase(r.name)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(m.File,{className:"h-4 w-4 text-slate-500"}),e.jsxs("span",{className:"font-medium text-slate-500",children:[s("Type"),":"]}),e.jsx("span",{className:"font-semibold",children:I})]})]}),e.jsxs("div",{children:[e.jsx(t.Label,{htmlFor:"description",className:"text-xs font-medium",children:s("Description (Optional)")}),e.jsx(t.Textarea,{id:"description",placeholder:s("Describe this template's purpose"),className:"mt-1 h-24 resize-none text-xs",value:j,onChange:a=>T(a.target.value)})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(t.Label,{htmlFor:"previewImage",className:"text-xs font-medium",children:s("Preview Image (Optional)")}),e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(o.Input,{type:"file",id:"previewImage",ref:i,onChange:D,accept:"image/*",className:"hidden"}),e.jsx(o.Button,{type:"button",variant:"outline",onClick:S,disabled:v,className:"w-full",children:v?e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),s("Uploading...")]}):e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(m.ImageIcon,{className:"h-4 w-4"}),s("Select image")]})}),c&&e.jsx(o.Button,{type:"button",variant:"outline",size:"icon",onClick:F,children:e.jsx(m.X,{className:"h-4 w-4"})})]}),c&&e.jsx("div",{className:"aspect-video overflow-hidden rounded-md border",children:e.jsx("img",{src:c,alt:s("Preview"),className:"h-full max-h-[200px] w-full object-contain"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s("max 1mb")})]})]})]}),e.jsxs(t.DialogFooter,{className:f?"pointer-events-none opacity-75":"",children:[e.jsx(o.Button,{variant:"outline",onClick:a=>{a.stopPropagation(),u()},children:s("Cancel")}),e.jsx(o.Button,{variant:"default",disabled:f,onClick:q,children:s("Mark as template")})]})]})})};exports.default=A;
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
2
  import { z, B as c } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { D as P, e as B, f as E, g as L, o as S, p as w, T as U, q as R } from "./index-B7HAfx-2.js";
4
- import { o as j, k as O } from "./index-BYjniKhj.js";
3
+ import { D as P, e as B, f as E, g as L, o as S, p as w, T as U, q as R } from "./index-OuHV9Ann.js";
4
+ import { r as j, k as O } from "./index-LBTm1Jmk.js";
5
5
  import { startCase as y } from "lodash-es";
6
6
  import { Tag as X, File as _, ImageIcon as $, X as q } from "lucide-react";
7
7
  import { useState as m, useRef as H, useCallback as K } from "react";
@@ -1 +1 @@
1
- "use strict";const i=[{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google",description:"0.5x Credits",multiplier:.5},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",provider:"google",description:"1.25x Credits",multiplier:1.25},{id:"google/gemini-3-flash",name:"Gemini 3 Flash",provider:"google",description:"1x Credits",multiplier:1},{id:"google/gemini-3-pro",name:"Gemini 3 Pro",provider:"google",description:"2.5x Credits",multiplier:2.5},{id:"openai/gpt-5",name:"GPT-5",provider:"openai",description:"2x Credits",multiplier:2},{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",provider:"anthropic",description:"1x Credits",multiplier:1},{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"openai/gpt-4.1",name:"GPT-4.1",provider:"openai",description:"2x Credits",multiplier:2}],r=e=>i.find(o=>o.id===e),d=()=>i.find(e=>e.id==="google/gemini-3-flash")||i[0];exports.AI_MODELS=i;exports.getDefaultModel=d;exports.getModelById=r;
1
+ "use strict";const i=[{id:"google/gemini-2.5-flash",name:"Gemini 2.5 Flash",provider:"google",description:"0.5x Credits",multiplier:.5},{id:"google/gemini-2.5-pro",name:"Gemini 2.5 Pro",provider:"google",description:"1.25x Credits",multiplier:1.25},{id:"google/gemini-3-flash",name:"Gemini 3 Flash",provider:"google",description:"1x Credits",multiplier:1},{id:"google/gemini-3-pro",name:"Gemini 3 Pro",provider:"google",description:"2.5x Credits",multiplier:2.5},{id:"openai/gpt-5",name:"GPT-5",provider:"openai",description:"2x Credits",multiplier:2},{id:"anthropic/claude-haiku-4.5",name:"Claude Haiku 4.5",provider:"anthropic",description:"1x Credits",multiplier:1},{id:"anthropic/claude-sonnet-4",name:"Claude Sonnet 4",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"anthropic/claude-sonnet-4.5",name:"Claude Sonnet 4.5",provider:"anthropic",description:"3x Credits",multiplier:3},{id:"openai/gpt-4.1",name:"GPT-4.1",provider:"openai",description:"2x Credits",multiplier:2}],o=()=>i.find(e=>e.id==="google/gemini-3-flash")||i[0];exports.AI_MODELS=i;exports.getDefaultModel=o;
@@ -1,4 +1,4 @@
1
- const e = [
1
+ const i = [
2
2
  {
3
3
  id: "google/gemini-2.5-flash",
4
4
  name: "Gemini 2.5 Flash",
@@ -62,9 +62,8 @@ const e = [
62
62
  description: "2x Credits",
63
63
  multiplier: 2
64
64
  }
65
- ], r = (i) => e.find((o) => o.id === i), n = () => e.find((i) => i.id === "google/gemini-3-flash") || e[0];
65
+ ], o = () => i.find((e) => e.id === "google/gemini-3-flash") || i[0];
66
66
  export {
67
- e as A,
68
- r as a,
69
- n as g
67
+ i as A,
68
+ o as g
70
69
  };
@@ -2,7 +2,7 @@ import { jsx as c, jsxs as n } from "react/jsx-runtime";
2
2
  import { ChevronLeft as v, ChevronRight as g } from "lucide-react";
3
3
  import * as l from "react";
4
4
  import { B as k } from "./register-chai-top-bar-D6GjnauV.js";
5
- import { P as N, C as x, i as P, j as S, k as w, l as B, m as d } from "./index-B7HAfx-2.js";
5
+ import { P as N, C as x, i as P, j as S, k as w, l as B, m as d } from "./index-OuHV9Ann.js";
6
6
  function I({
7
7
  data: o,
8
8
  onSelect: m,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("lucide-react"),p=require("react"),v=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-DTNHTRZu.cjs");function C(c){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(l,r,i.get?i:{enumerable:!0,get:()=>c[r]})}}return l.default=c,Object.freeze(l)}const o=C(p);function N({data:c,onSelect:l,dataType:r="value",open:i,setOpen:m}){const[u,f]=o.useState([]),[h,j]=o.useState(c);o.useEffect(()=>{i||f([]),j(c)},[c,i]);const b=e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":"value",y=o.useCallback(e=>{const n=s=>r==="value"?s==="value"||s==="object":r==="array"?s==="array":s===r;e.type==="object"?(f(s=>[...s,e.key]),j(e.value)):n(e.type)&&(l([...u,e.key].join(".")),m(!1))},[r,l,u,m]),x=o.useCallback(()=>{if(u.length>0){const e=u.slice(0,-1);f(e),j(e.reduce((n,s)=>n[s],c))}},[u,c]),g=o.useMemo(()=>Object.entries(h).map(([e,n])=>({key:e,value:n,type:b(n)})).filter(e=>r==="value"?e.type==="value"||e.type==="object":r==="array"?e.type==="array"||e.type==="object":r==="object"?e.type==="object":!0),[h,r]);return t.jsx(a.PopoverContent,{className:"z-[9999] w-[200px] p-0",children:t.jsxs(a.Command,{children:[t.jsx(a.CommandInput,{className:"border-none",placeholder:"Search..."}),t.jsxs(a.CommandList,{onWheel:e=>{try{e.preventDefault();const n=e.currentTarget;n.scrollTop+=e.deltaY}catch{e.preventDefault()}},children:[t.jsx(a.CommandEmpty,{children:"No option found."}),t.jsxs(a.CommandGroup,{children:[u.length>0&&t.jsxs(a.CommandItem,{onSelect:x,className:"flex items-center text-sm",children:[t.jsx(d.ChevronLeft,{className:"mr-2 h-4 w-4"}),"Back"]}),g.map(e=>t.jsxs(a.CommandItem,{onSelect:()=>y(e),className:"flex items-center justify-between",children:[t.jsx("span",{children:e.key}),t.jsxs("div",{className:"flex items-center gap-2",children:[r==="object"&&e.type==="object"&&t.jsx(v.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:n=>{n.stopPropagation(),l([...u,e.key].join(".")),m(!1)},children:"Select"}),(e.type==="object"||e.type==="array")&&t.jsx("div",{className:"cursor-pointer rounded p-1 hover:bg-muted",children:t.jsx(d.ChevronRight,{className:"h-4 w-4 opacity-50"})})]})]},e.key))]})]})]})})}exports.default=N;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),d=require("lucide-react"),p=require("react"),v=require("./register-chai-top-bar-DyW9GPzV.cjs"),a=require("./index-DCJDQs1a.cjs");function C(c){const l=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(c){for(const r in c)if(r!=="default"){const i=Object.getOwnPropertyDescriptor(c,r);Object.defineProperty(l,r,i.get?i:{enumerable:!0,get:()=>c[r]})}}return l.default=c,Object.freeze(l)}const o=C(p);function N({data:c,onSelect:l,dataType:r="value",open:i,setOpen:m}){const[u,f]=o.useState([]),[h,j]=o.useState(c);o.useEffect(()=>{i||f([]),j(c)},[c,i]);const b=e=>Array.isArray(e)?"array":typeof e=="object"&&e!==null?"object":"value",y=o.useCallback(e=>{const n=s=>r==="value"?s==="value"||s==="object":r==="array"?s==="array":s===r;e.type==="object"?(f(s=>[...s,e.key]),j(e.value)):n(e.type)&&(l([...u,e.key].join(".")),m(!1))},[r,l,u,m]),x=o.useCallback(()=>{if(u.length>0){const e=u.slice(0,-1);f(e),j(e.reduce((n,s)=>n[s],c))}},[u,c]),g=o.useMemo(()=>Object.entries(h).map(([e,n])=>({key:e,value:n,type:b(n)})).filter(e=>r==="value"?e.type==="value"||e.type==="object":r==="array"?e.type==="array"||e.type==="object":r==="object"?e.type==="object":!0),[h,r]);return t.jsx(a.PopoverContent,{className:"z-[9999] w-[200px] p-0",children:t.jsxs(a.Command,{children:[t.jsx(a.CommandInput,{className:"border-none",placeholder:"Search..."}),t.jsxs(a.CommandList,{onWheel:e=>{try{e.preventDefault();const n=e.currentTarget;n.scrollTop+=e.deltaY}catch{e.preventDefault()}},children:[t.jsx(a.CommandEmpty,{children:"No option found."}),t.jsxs(a.CommandGroup,{children:[u.length>0&&t.jsxs(a.CommandItem,{onSelect:x,className:"flex items-center text-sm",children:[t.jsx(d.ChevronLeft,{className:"mr-2 h-4 w-4"}),"Back"]}),g.map(e=>t.jsxs(a.CommandItem,{onSelect:()=>y(e),className:"flex items-center justify-between",children:[t.jsx("span",{children:e.key}),t.jsxs("div",{className:"flex items-center gap-2",children:[r==="object"&&e.type==="object"&&t.jsx(v.Button,{size:"sm",variant:"ghost",className:"h-6 px-2 hover:bg-primary hover:text-primary-foreground",onClick:n=>{n.stopPropagation(),l([...u,e.key].join(".")),m(!1)},children:"Select"}),(e.type==="object"||e.type==="array")&&t.jsx("div",{className:"cursor-pointer rounded p-1 hover:bg-muted",children:t.jsx(d.ChevronRight,{className:"h-4 w-4 opacity-50"})})]})]},e.key))]})]})]})})}exports.default=N;
@@ -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-DTNHTRZu.cjs"),n=require("./index-BeGLwvqs.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-DCJDQs1a.cjs"),n=require("./index-BVwFJWDq.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,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, J as w, K as p, M as f, O as P, Q as C } from "./index-B7HAfx-2.js";
4
- import { c as S, d as L, L as x, B as N } from "./index-BYjniKhj.js";
3
+ import { d as u, J as w, K as p, M as f, O as P, Q as C } from "./index-OuHV9Ann.js";
4
+ import { c as S, d as L, L as x, B as N } from "./index-LBTm1Jmk.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,7 +1,7 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { c as g, d as n } from "./index-BYjniKhj.js";
2
+ import { c as g, d as n } from "./index-LBTm1Jmk.js";
3
3
  import { Suspense as s, lazy as t } from "react";
4
- const o = t(() => import("./no-language-page-content-Ce3wniZT.js")), l = () => {
4
+ const o = t(() => import("./no-language-page-content-D8t5dfgh.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
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./index-BeGLwvqs.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-CcD-fgMa.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-BVwFJWDq.cjs"),n=require("react"),t=n.lazy(()=>Promise.resolve().then(()=>require("./no-language-page-content-C-MCdPXt.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;