@chaibuilder/sdk 4.0.0-beta.48 → 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 (115) hide show
  1. package/dist/{2SSKDMRQ-DqwAKdGS.cjs → 2SSKDMRQ-CjvuNdPo.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-CLLNh3td.js → 2SSKDMRQ-Dvf9zadl.js} +2 -2
  3. package/dist/{AP7HFJJL-BA2SSB20.cjs → AP7HFJJL-DYFttFoI.cjs} +1 -1
  4. package/dist/{AP7HFJJL-wgsmCJDJ.js → AP7HFJJL-q4dJdyFs.js} +1 -1
  5. package/dist/{IconPicker-DsT0ONLh.js → IconPicker-Bf163F7t.js} +1 -1
  6. package/dist/{IconPicker-BQy4V5jA.cjs → IconPicker-JWhYq2Gp.cjs} +1 -1
  7. package/dist/{WDYDFRGG-DyEYv-Y5.cjs → WDYDFRGG-BEksfGMC.cjs} +1 -1
  8. package/dist/{WDYDFRGG-EEb06kwn.js → WDYDFRGG-O9GIrtX0.js} +2 -2
  9. package/dist/{actions-registery-2natwC9b.cjs → actions-registery-BHbZHkE3.cjs} +10 -2
  10. package/dist/{actions-registery-wRY05tEE.js → actions-registery-gJb_wq2F.js} +24 -12
  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-DE2fn30l.js → active-in-another-tab-B4Ur0JP7.js} +2 -2
  15. package/dist/{active-in-another-tab-p0hkvIFc.cjs → active-in-another-tab-BPdx4lWh.cjs} +1 -1
  16. package/dist/{add-new-language-page-f2wam593.cjs → add-new-language-page-BfUp5Ua2.cjs} +1 -1
  17. package/dist/{add-new-language-page-CH7GtcqC.js → add-new-language-page-CRR93tLq.js} +3 -3
  18. package/dist/{add-new-page-CV7A1XJQ.cjs → add-new-page-B8NGK6WS.cjs} +1 -1
  19. package/dist/{add-new-page-8d0Nn-zI.js → add-new-page-Ppy5-y5j.js} +2 -2
  20. package/dist/{ai-panel-default-lang-Dcm4e1o8.js → ai-panel-default-lang-BXYQye3N.js} +6 -5
  21. package/dist/{ai-panel-default-lang-BJLeTdw3.cjs → ai-panel-default-lang-VhgmHFoQ.cjs} +3 -3
  22. package/dist/{ai-panel-other-lang-B48Y5C8z.js → ai-panel-other-lang-DaCf-cq4.js} +36 -35
  23. package/dist/ai-panel-other-lang-Ds0EXeUC.cjs +1 -0
  24. package/dist/{ai-prompt-input-DhVfzVhy.js → ai-prompt-input-7iWk72w5.js} +2 -2
  25. package/dist/{ai-prompt-input-C1yoNntS.cjs → ai-prompt-input-nZ5_Dm7X.cjs} +1 -1
  26. package/dist/{ai-translation-prompt-CUYVv2jG.js → ai-translation-prompt-1OUs1P7n.js} +1 -1
  27. package/dist/{ai-translation-prompt-mj26BpgQ.cjs → ai-translation-prompt-B16cK-1Q.cjs} +1 -1
  28. package/dist/{change-password-modal-DiEQWZez.js → change-password-modal-CdvJR1Ln.js} +2 -2
  29. package/dist/{change-password-modal-DFupkIGx.cjs → change-password-modal-D5eXjiYq.cjs} +1 -1
  30. package/dist/{code-editor-CazbxsDv.js → code-editor-CyLjDiEp.js} +1 -1
  31. package/dist/{code-editor-BiLiryYr.cjs → code-editor-SWbfFj1E.cjs} +1 -1
  32. package/dist/{continue-editing-in-this-client-CpKDDW6u.js → continue-editing-in-this-client-BrSvK-Ay.js} +2 -2
  33. package/dist/{continue-editing-in-this-client-C3NoncEN.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-DFdZ471B.cjs → css-import-modal-Bdwgd05S.cjs} +1 -1
  37. package/dist/{css-import-modal-BOQr_e6S.js → css-import-modal-Be47CBJn.js} +1 -1
  38. package/dist/{delete-page-DIZhbU2t.js → delete-page-C99K2qzS.js} +2 -2
  39. package/dist/{delete-page-D8Vr-1aC.cjs → delete-page-DLohaU-U.cjs} +1 -1
  40. package/dist/{design-token-usage-Co5Lj1HN.js → design-token-usage-D1lWCJ3L.js} +1 -1
  41. package/dist/{design-token-usage-N5DLBdWf.cjs → design-token-usage-eY2wQ0l3.cjs} +1 -1
  42. package/dist/{digital-asset-manager-CObQa_0R.js → digital-asset-manager-BZMb6sC7.js} +3 -3
  43. package/dist/{digital-asset-manager-uXP27Dou.cjs → digital-asset-manager-Z5aJxkq0.cjs} +1 -1
  44. package/dist/{duplicate-page-xpV-pRVU.js → duplicate-page-CDc2X0eW.js} +3 -3
  45. package/dist/{duplicate-page-DomSAvnp.cjs → duplicate-page-D5Gtvqdv.cjs} +1 -1
  46. package/dist/{dynamic-page-selector-CYZv-SlK.cjs → dynamic-page-selector-DZHhX008.cjs} +1 -1
  47. package/dist/{dynamic-page-selector-Bl5kYPWG.js → dynamic-page-selector-DvNBXo6o.js} +2 -2
  48. package/dist/{image-editor-CDFnNWAz.js → image-editor-BBvvi9Vm.js} +1 -1
  49. package/dist/{image-editor-pOsT95KQ.cjs → image-editor-DwhTYkVR.cjs} +1 -1
  50. package/dist/{index-j-XsKW-V.cjs → index-BVwFJWDq.cjs} +3 -3
  51. package/dist/{index-DonDtb8f.cjs → index-DCJDQs1a.cjs} +8 -8
  52. package/dist/{index-Cyz_Iww4.js → index-LBTm1Jmk.js} +35 -26
  53. package/dist/{index-BbkBlCE2.js → index-OuHV9Ann.js} +7 -6
  54. package/dist/{json-diff-viewer-CoEViavL.cjs → json-diff-viewer-Cb1CmRqP.cjs} +1 -1
  55. package/dist/{json-diff-viewer-amjoEZ5K.js → json-diff-viewer-DG6qMOBS.js} +2 -2
  56. package/dist/{lang-panel-DPpIXFl4.js → lang-panel-B3USOxGq.js} +3 -3
  57. package/dist/{lang-panel-BzWstLZ-.cjs → lang-panel-DxoJ0v4y.cjs} +1 -1
  58. package/dist/{manage-design-tokens-BVfEFOrN.js → manage-design-tokens-6YGIctip.js} +2 -2
  59. package/dist/{manage-design-tokens-modal-m3D2luIa.cjs → manage-design-tokens-modal-BSSCXH8Y.cjs} +1 -1
  60. package/dist/{manage-design-tokens-modal-CBOw_Dg6.js → manage-design-tokens-modal-CzsnN49F.js} +2 -2
  61. package/dist/{manage-design-tokens-CIiwBv2v.cjs → manage-design-tokens-udLBvkHA.cjs} +1 -1
  62. package/dist/{mark-as-template-C2-S_aA2.cjs → mark-as-template-B9yLcasI.cjs} +1 -1
  63. package/dist/{mark-as-template-CQjchLk7.js → mark-as-template-CP_F9ZQ4.js} +2 -2
  64. package/dist/{nested-path-selector-content-BtsI3H0i.js → nested-path-selector-content-DmtCI3q9.js} +1 -1
  65. package/dist/{nested-path-selector-content-Dd3NzUE0.cjs → nested-path-selector-content-aTdu-o0e.cjs} +1 -1
  66. package/dist/{no-language-page-content-CggJC14_.cjs → no-language-page-content-C-MCdPXt.cjs} +1 -1
  67. package/dist/{no-language-page-content-BrDAjkdi.js → no-language-page-content-D8t5dfgh.js} +2 -2
  68. package/dist/{no-language-page-dialog-DSbcLM8f.js → no-language-page-dialog-C_fHI2zI.js} +2 -2
  69. package/dist/{no-language-page-dialog-Dkxdu99i.cjs → no-language-page-dialog-D4QIAHnE.cjs} +1 -1
  70. package/dist/{page-creator-DqKFL1sB.cjs → page-creator-Cz_ah-qE.cjs} +1 -1
  71. package/dist/{page-creator-CR-FbJ7C.js → page-creator-DKEkuGCO.js} +3 -3
  72. package/dist/{page-lock-CwzMBdD-.js → page-lock-CwZKJ4IE.js} +2 -2
  73. package/dist/{page-lock-D4Anxwpy.cjs → page-lock-DdCvtA-I.cjs} +1 -1
  74. package/dist/{page-locked-dialog-UrTgnXd6.cjs → page-locked-dialog-CrTDBoC4.cjs} +1 -1
  75. package/dist/{page-locked-dialog-Dv_unUwx.js → page-locked-dialog-DqLlooUz.js} +2 -2
  76. package/dist/{page-manager-new-DuqhyqMY.cjs → page-manager-new-ah6QYar2.cjs} +1 -1
  77. package/dist/{page-manager-new-DpCTazS0.js → page-manager-new-ttsrxdW9.js} +3 -3
  78. package/dist/{page-manager-search-and-filter-Yt0pjK_r.cjs → page-manager-search-and-filter-D7AupT6_.cjs} +1 -1
  79. package/dist/{page-manager-search-and-filter-B6F-ZvdQ.js → page-manager-search-and-filter-bsqZ6wnI.js} +2 -2
  80. package/dist/{page-revisions-content-C2VMkAt4.cjs → page-revisions-content-B6hsIla7.cjs} +1 -1
  81. package/dist/{page-revisions-content-CUPsMEVU.js → page-revisions-content-C5O8_Fms.js} +3 -3
  82. package/dist/pages.cjs +1 -1
  83. package/dist/pages.d.ts +16 -10
  84. package/dist/pages.js +1 -1
  85. package/dist/{publish-pages-content-BrjDksNY.cjs → publish-pages-content-BrajJUcP.cjs} +1 -1
  86. package/dist/{publish-pages-content-CK0ahL2t.js → publish-pages-content-KZVMHT6V.js} +3 -3
  87. package/dist/{rte-widget-modal-Dktetdg4.cjs → rte-widget-modal-CiTwsXTr.cjs} +1 -1
  88. package/dist/{rte-widget-modal-DgEF73WC.js → rte-widget-modal-IU8JzPuZ.js} +1 -1
  89. package/dist/{save-to-lib-Bs6-wr2u.js → save-to-lib-DMnv7ENo.js} +2 -2
  90. package/dist/{save-to-lib-CuVYPtm-.cjs → save-to-lib-Dc700Aop.cjs} +1 -1
  91. package/dist/{selected-block-display-BCcwnFzJ.cjs → selected-block-display-CAFEOrLV.cjs} +1 -1
  92. package/dist/{selected-block-display-D-lzXUfE.js → selected-block-display-CidmQ-wz.js} +2 -2
  93. package/dist/{seo-panel-By-TlhHK.js → seo-panel-Br8gxDxu.js} +155 -165
  94. package/dist/{seo-panel-DTqsu3I0.cjs → seo-panel-CMY-adM-.cjs} +2 -2
  95. package/dist/{shared-json-ld-C_vaAxgT.cjs → shared-json-ld-CMH-eRUq.cjs} +1 -1
  96. package/dist/{shared-json-ld-CMCwFEI0.js → shared-json-ld-uvMmwCYp.js} +2 -2
  97. package/dist/{slug-input-DCmvuN69.cjs → slug-input-CiHC5l3r.cjs} +1 -1
  98. package/dist/{slug-input-bhZSv9VS.js → slug-input-DLWTMTsO.js} +1 -1
  99. package/dist/supabase-actions.cjs +1 -1
  100. package/dist/supabase-actions.js +1 -1
  101. package/dist/{take-over-request-BGvKpN5m.cjs → take-over-request-IRLgF1dG.cjs} +1 -1
  102. package/dist/{take-over-request-f0dbfkLe.js → take-over-request-KdR1_h_K.js} +2 -2
  103. package/dist/{translation-warning-modal-_0YmCcU8.cjs → translation-warning-modal-CLZ9tC1F.cjs} +1 -1
  104. package/dist/{translation-warning-modal-D0-WNJnG.js → translation-warning-modal-CzNt6LDO.js} +1 -1
  105. package/dist/types.d.ts +6 -0
  106. package/dist/{unmark-as-template-WE3WJ-RJ.js → unmark-as-template-C5ovsEBP.js} +2 -2
  107. package/dist/{unmark-as-template-BE1BO8Z0.cjs → unmark-as-template-F7TdgWjI.cjs} +1 -1
  108. package/dist/{unpublish-page-B4A-GQEz.js → unpublish-page-0fR1o0b7.js} +2 -2
  109. package/dist/{unpublish-page-DrZnWLVM.cjs → unpublish-page-CUr8Xub6.cjs} +1 -1
  110. package/dist/{unpublished-partials-modal-CGK-4WJ3.js → unpublished-partials-modal-BhNAub_z.js} +1 -1
  111. package/dist/{unpublished-partials-modal-KFXm1fG4.cjs → unpublished-partials-modal-Cv5R9-hi.cjs} +1 -1
  112. package/dist/{web-preview-ClV1a6hl.cjs → web-preview-CuMYekVJ.cjs} +1 -1
  113. package/dist/{web-preview-BSmef-RL.js → web-preview-D9pXonAv.js} +1 -1
  114. package/package.json +1 -1
  115. package/dist/ai-panel-other-lang-Ch0RHXqZ.cjs +0 -1
@@ -7,7 +7,7 @@ var Nn = (e, t, n) => Yr(e, typeof t != "symbol" ? t + "" : t, n), cs = (e, t, n
7
7
  var S = (e, t, n) => (cs(e, t, "read from private field"), n ? n.call(e) : t.get(e)), G = (e, t, n) => t.has(e) ? ls("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), v = (e, t, n, s) => (cs(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
8
8
  import { jsxs as m, jsx as o, Fragment as me } from "react/jsx-runtime";
9
9
  import { B as x, h as Jr, v as $t, e as us, j as Zr, m as Xr, q as ea, x as ta, D as na, F as sa } from "./register-chai-top-bar-D6GjnauV.js";
10
- import { aI as ra, a0 as Rn, aJ as aa, aK as ia, aL as oa, aM as la, aN as ca, v as un, w as dn, x as fn, y as Te, af as ua, d as Se, aO as da, ax as Fs, aP as fa, Z as ha, I as Me, aQ as ga, aw as Hs, z as hn, aR as Ks, aS as ma, A as gn, aT as Vs, E as mn, ai as qt, D as zn, ak as Ea, aU as pa, aV as ds, aj as ya, ag as Aa, ah as Ta, aW as Sa, aC as _a, aB as Pa, aD as wa, e as $s, a1 as ba, av as Ia, a2 as Na, at as va, a3 as Ca, a4 as La, au as Ga, a5 as ka, a6 as Da, aX as xa, X as Oa, Y as Ra, f as Ua, g as Ba, ay as Ma, az as Fa, aA as vn, aY as Cn, T as fs } from "./index-BbkBlCE2.js";
10
+ import { aI as ra, a0 as Rn, aJ as aa, aK as ia, aL as oa, aM as la, aN as ca, v as un, w as dn, x as fn, y as Te, af as ua, d as Se, aO as da, ax as Fs, aP as fa, Z as ha, I as Me, aQ as ga, aw as Hs, z as hn, aR as Ks, aS as ma, A as gn, aT as Vs, E as mn, ai as qt, D as zn, ak as Ea, aU as pa, aV as ds, aj as ya, ag as Aa, ah as Ta, aW as Sa, aC as _a, aB as Pa, aD as wa, e as $s, a1 as ba, av as Ia, a2 as Na, at as va, a3 as Ca, a4 as La, au as Ga, a5 as ka, a6 as Da, aX as xa, X as Oa, Y as Ra, f as Ua, g as Ba, ay as Ma, az as Fa, aA as vn, aY as Cn, T as fs } from "./index-OuHV9Ann.js";
11
11
  import { ZoomInIcon as Ha, LightningBoltIcon as Ka } from "@radix-ui/react-icons";
12
12
  import { round as Va, get as Q, noop as En, keyBy as $a, map as Un, find as ce, values as Yn, reverse as qa, sortBy as Qa, minBy as qs, first as Qs, groupBy as Wa, isEmpty as Ee, compact as At, filter as Jn, uniq as ja, each as za, upperCase as hs, includes as Ya, has as Zn, startCase as Ja, isFunction as Za, isArray as Xa, pick as Ws, cloneDeep as ei } from "lodash-es";
13
13
  import { useAtom as pe, atom as Ne, useSetAtom as Xn, useAtomValue as ti } from "jotai";
@@ -757,7 +757,7 @@ const mt = 10, Ao = 1e3, To = 2, So = 16e3, nr = () => {
757
757
  }), () => {
758
758
  r && n && r.untrack();
759
759
  }), [r, n, t]);
760
- }, bo = M(() => import("./add-new-page-8d0Nn-zI.js")), Io = M(() => import("./delete-page-DIZhbU2t.js")), No = M(() => import("./duplicate-page-xpV-pRVU.js")), vo = M(() => import("./mark-as-template-CQjchLk7.js")), Co = M(() => import("./unmark-as-template-WE3WJ-RJ.js")), Lo = M(() => import("./unpublish-page-B4A-GQEz.js")), Go = () => {
760
+ }, bo = M(() => import("./add-new-page-Ppy5-y5j.js")), Io = M(() => import("./delete-page-C99K2qzS.js")), No = M(() => import("./duplicate-page-CDc2X0eW.js")), vo = M(() => import("./mark-as-template-CP_F9ZQ4.js")), Co = M(() => import("./unmark-as-template-C5ovsEBP.js")), Lo = M(() => import("./unpublish-page-0fR1o0b7.js")), Go = () => {
761
761
  const [e, t] = N(null), [n, s] = N(null), [r, a] = N(null), [i, l] = N(null), [c, d] = N(null), [f, u] = N(null), { data: g, isFetching: h } = Ge(), { selectedLang: p, fallbackLang: _ } = Se(), { data: I } = yn(), y = I == null ? void 0 : I.find((D) => D.lang === p), { isLocked: A } = Ce(), w = !(g != null && g.slug), F = Xn(nn);
762
762
  if (!g) return null;
763
763
  const V = (D) => {
@@ -1022,7 +1022,7 @@ function Do(e, t, n = !1) {
1022
1022
  const s = e.toString() ? `?${e.toString()}` : "/";
1023
1023
  n ? window.history.replaceState(null, "", s) : window.history.pushState({}, "", s), t(e), window.dispatchEvent(new PopStateEvent("popstate"));
1024
1024
  }
1025
- const xo = M(() => import("./add-new-language-page-CH7GtcqC.js")), Oo = () => {
1025
+ const xo = M(() => import("./add-new-language-page-CRR93tLq.js")), Oo = () => {
1026
1026
  const e = ye("topLeftCorner", null);
1027
1027
  return e ? /* @__PURE__ */ o("div", { className: "max-h-9 w-full overflow-hidden pr-2", children: wi.createElement(e, {}) }) : null;
1028
1028
  }, Ro = ({
@@ -1154,7 +1154,7 @@ function Bo() {
1154
1154
  /* @__PURE__ */ o(qt, { className: "h-8 w-8 rounded-full" })
1155
1155
  ] }, t)) });
1156
1156
  }
1157
- const Mo = z.lazy(() => import("./page-revisions-content-CUPsMEVU.js"));
1157
+ const Mo = z.lazy(() => import("./page-revisions-content-C5O8_Fms.js"));
1158
1158
  function Fo() {
1159
1159
  const [e, t] = z.useState(!1);
1160
1160
  return /* @__PURE__ */ o(Hs, { children: /* @__PURE__ */ m(hn, { delayDuration: 0, children: [
@@ -1370,7 +1370,7 @@ const Gn = ({
1370
1370
  O.error("Failed to change slug");
1371
1371
  }
1372
1372
  });
1373
- }, Ko = M(() => import("./publish-pages-content-CK0ahL2t.js"));
1373
+ }, Ko = M(() => import("./publish-pages-content-KZVMHT6V.js"));
1374
1374
  function Vo({
1375
1375
  showModal: e = !1,
1376
1376
  onClose: t = () => console.log("Cancelled")
@@ -1457,11 +1457,11 @@ function Ht({
1457
1457
  /* @__PURE__ */ o(mn, { side: n, sideOffset: 10, children: /* @__PURE__ */ o("p", { children: t }) })
1458
1458
  ] }) }) : e;
1459
1459
  }
1460
- const Yo = M(() => import("./unpublish-page-B4A-GQEz.js")), Jo = M(
1461
- () => import("./translation-warning-modal-D0-WNJnG.js")
1460
+ const Yo = M(() => import("./unpublish-page-0fR1o0b7.js")), Jo = M(
1461
+ () => import("./translation-warning-modal-CzNt6LDO.js")
1462
1462
  ), Zo = M(
1463
- () => import("./unpublished-partials-modal-CGK-4WJ3.js")
1464
- ), Ps = M(() => import("./json-diff-viewer-amjoEZ5K.js")), Xo = () => {
1463
+ () => import("./unpublished-partials-modal-BhNAub_z.js")
1464
+ ), Ps = M(() => import("./json-diff-viewer-DG6qMOBS.js")), Xo = () => {
1465
1465
  const { t: e } = ue(), { selectedLang: t, fallbackLang: n } = Se(), s = ye("getPreviewUrl", async (g) => g), [r, a] = N(""), { data: i } = fe(), { data: l } = yn(), { data: c } = Ve(), d = j(
1466
1466
  () => {
1467
1467
  var g;
@@ -1738,7 +1738,7 @@ function rl() {
1738
1738
  /* @__PURE__ */ o(sl, {})
1739
1739
  ] });
1740
1740
  }
1741
- const al = M(() => import("./page-manager-new-DpCTazS0.js")), il = ({ children: e }) => {
1741
+ const al = M(() => import("./page-manager-new-ttsrxdW9.js")), il = ({ children: e }) => {
1742
1742
  const { t } = ue(), [n] = ve(), s = n.get("page"), { data: r, isFetching: a } = fe(), { data: i, isFetching: l } = Ke(), [c, d] = N(!1), [f, u] = N(!0), { savePage: g } = Me(), h = !!s && !Ee(r), { isLocked: p } = Ce();
1743
1743
  J(() => {
1744
1744
  !l && i && u(!1);
@@ -1791,7 +1791,7 @@ const al = M(() => import("./page-manager-new-DpCTazS0.js")), il = ({ children:
1791
1791
  }
1792
1792
  ) })
1793
1793
  ] });
1794
- }, ol = M(() => import("./dynamic-page-selector-Bl5kYPWG.js")), ll = () => {
1794
+ }, ol = M(() => import("./dynamic-page-selector-DvNBXo6o.js")), ll = () => {
1795
1795
  const { dynamicPage: e, allLangPages: t, isFetching: n } = Vi(), s = t.length > 0;
1796
1796
  return n ? null : /* @__PURE__ */ m("div", { className: "relative", children: [
1797
1797
  !e && /* @__PURE__ */ o(ko, { hasDynamicPage: s }),
@@ -2070,7 +2070,7 @@ const al = M(() => import("./page-manager-new-DpCTazS0.js")), il = ({ children:
2070
2070
  button: Tl,
2071
2071
  panel: () => /* @__PURE__ */ o(yl, { onSuccess: console.log, onError: console.log, onComplete: console.log }),
2072
2072
  position: "top"
2073
- }, _l = M(() => import("./lang-panel-DPpIXFl4.js")), Pl = ({ isActive: e, show: t }) => {
2073
+ }, _l = M(() => import("./lang-panel-B3USOxGq.js")), Pl = ({ isActive: e, show: t }) => {
2074
2074
  const { data: n } = He();
2075
2075
  return !Zn(n, "languages") || !Q(n, "languages", []).length ? null : /* @__PURE__ */ o(x, { size: "sm", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ o(pi, { className: "h-4 w-4" }) });
2076
2076
  }, cr = "lang", wl = {
@@ -2081,7 +2081,7 @@ const al = M(() => import("./page-manager-new-DpCTazS0.js")), il = ({ children:
2081
2081
  button: Pl,
2082
2082
  view: "modal",
2083
2083
  width: 400
2084
- }, bl = M(() => import("./seo-panel-By-TlhHK.js")), ur = "seo", Il = ({ isActive: e, show: t }) => {
2084
+ }, bl = M(() => import("./seo-panel-Br8gxDxu.js")), ur = "seo", Il = ({ isActive: e, show: t }) => {
2085
2085
  const { data: n } = fe(), s = ji(n == null ? void 0 : n.pageType);
2086
2086
  return !Zn(s, "hasSlug") || !s.hasSlug ? null : /* @__PURE__ */ o(x, { size: "icon", className: "my-1 p-0", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ m(
2087
2087
  "svg",
@@ -2110,7 +2110,7 @@ const al = M(() => import("./page-manager-new-DpCTazS0.js")), il = ({ children:
2110
2110
  width: 600,
2111
2111
  view: "modal"
2112
2112
  }, vl = M(
2113
- () => import("./change-password-modal-DiEQWZez.js").then((e) => ({ default: e.ChangePasswordModal }))
2113
+ () => import("./change-password-modal-CdvJR1Ln.js").then((e) => ({ default: e.ChangePasswordModal }))
2114
2114
  ), dr = "user-info", Cl = () => {
2115
2115
  const { t: e } = ue(), { user: t, logout: n } = ss(), s = ye("onLogout", En), [r, a] = N(!1);
2116
2116
  return t ? /* @__PURE__ */ m(_a, { children: [
@@ -3997,7 +3997,7 @@ var Bd = (e, t = !1) => {
3997
3997
  const t = vr(() => {
3998
3998
  const n = this, [s] = S(this, Je), [r] = S(this, Ze), [a] = S(this, Xe), [i] = S(this, et), [l] = S(this, Gt), [c] = S(this, ze), [d] = S(this, nt);
3999
3999
  let f;
4000
- return S(this, tt) ? f = S(this, tt) : (f = Ir(() => import("./WDYDFRGG-EEb06kwn.js")), v(this, tt, f)), Wr(S(this, Lt), S(this, Ye)), wr(f, br({
4000
+ return S(this, tt) ? f = S(this, tt) : (f = Ir(() => import("./WDYDFRGG-O9GIrtX0.js")), v(this, tt, f)), Wr(S(this, Lt), S(this, Ye)), wr(f, br({
4001
4001
  get queryFlavor() {
4002
4002
  return S(n, vt);
4003
4003
  },
@@ -4104,7 +4104,7 @@ var Bd = (e, t = !1) => {
4104
4104
  const t = vr(() => {
4105
4105
  const n = this, [s] = S(this, at), [r] = S(this, it), [a] = S(this, ot), [i] = S(this, lt), [l] = S(this, Ut), [c] = S(this, st), [d] = S(this, ct), [f] = S(this, dt);
4106
4106
  let u;
4107
- return S(this, ut) ? u = S(this, ut) : (u = Ir(() => import("./2SSKDMRQ-CLLNh3td.js")), v(this, ut, u)), Wr(S(this, Rt), S(this, rt)), wr(u, br({
4107
+ return S(this, ut) ? u = S(this, ut) : (u = Ir(() => import("./2SSKDMRQ-Dvf9zadl.js")), v(this, ut, u)), Wr(S(this, Rt), S(this, rt)), wr(u, br({
4108
4108
  get queryFlavor() {
4109
4109
  return S(n, xt);
4110
4110
  },
@@ -4358,7 +4358,7 @@ const uu = () => {
4358
4358
  }), r;
4359
4359
  }
4360
4360
  });
4361
- }, fu = M(() => import("./page-lock-CwzMBdD-.js")), hu = M(() => import("./no-language-page-dialog-DSbcLM8f.js")), gu = M(() => import("./digital-asset-manager-CObQa_0R.js")), mu = M(() => import("./save-to-lib-Bs6-wr2u.js")), Eu = M(() => import("./web-preview-BSmef-RL.js"));
4361
+ }, fu = M(() => import("./page-lock-CwZKJ4IE.js")), hu = M(() => import("./no-language-page-dialog-C_fHI2zI.js")), gu = M(() => import("./digital-asset-manager-BZMb6sC7.js")), mu = M(() => import("./save-to-lib-DMnv7ENo.js")), Eu = M(() => import("./web-preview-D9pXonAv.js"));
4362
4362
  au();
4363
4363
  xi();
4364
4364
  ta(ul);
@@ -4488,7 +4488,7 @@ const pu = {
4488
4488
  /* @__PURE__ */ o(Os, { ...e }),
4489
4489
  /* @__PURE__ */ o(Ds, {})
4490
4490
  ] }) : /* @__PURE__ */ o("div", {});
4491
- }, Su = z.lazy(() => import("./nested-path-selector-content-BtsI3H0i.js"));
4491
+ }, Su = z.lazy(() => import("./nested-path-selector-content-DmtCI3q9.js"));
4492
4492
  function _u({ data: e, onSelect: t, dataType: n = "value", disabled: s = !1 }) {
4493
4493
  const [r, a] = z.useState(!1);
4494
4494
  return /* @__PURE__ */ m(Oa, { open: r, onOpenChange: a, children: [
@@ -4593,7 +4593,7 @@ const $d = () => {
4593
4593
  console.error("Failed to update metadata");
4594
4594
  }
4595
4595
  });
4596
- }, Pu = M(() => import("./digital-asset-manager-CObQa_0R.js")), jd = ({
4596
+ }, Pu = M(() => import("./digital-asset-manager-BZMb6sC7.js")), jd = ({
4597
4597
  assetId: e,
4598
4598
  assetUrl: t,
4599
4599
  onChange: n,
@@ -4736,7 +4736,7 @@ const $d = () => {
4736
4736
  n = n.replace(r[0], i);
4737
4737
  }
4738
4738
  return n;
4739
- }, Nu = M(() => import("./shared-json-ld-CMCwFEI0.js")), zd = ({
4739
+ }, Nu = M(() => import("./shared-json-ld-uvMmwCYp.js")), zd = ({
4740
4740
  value: e,
4741
4741
  onChange: t,
4742
4742
  disabled: n = !1,
@@ -4924,7 +4924,7 @@ const $d = () => {
4924
4924
  if (e === void 0)
4925
4925
  throw new Error("useAIConfig must be used within AIConfigProvider");
4926
4926
  return e;
4927
- }, Yd = () => ({ models: Cu().models }), Lu = M(() => import("./ai-panel-default-lang-Dcm4e1o8.js")), Gu = M(() => import("./ai-panel-other-lang-B48Y5C8z.js")), ku = () => {
4927
+ }, Yd = () => ({ models: Cu().models }), Lu = M(() => import("./ai-panel-default-lang-BXYQye3N.js")), Gu = M(() => import("./ai-panel-other-lang-DaCf-cq4.js")), ku = () => {
4928
4928
  const { t: e } = ue(), [t, n] = N(""), [s, r] = N([]), [a, i] = N(!1), [l, c] = N(null), [d, f] = N(null), [u, g] = N(ki().id), { selectedLang: h, fallbackLang: p } = Se(), _ = Mi(), [I] = ve(), y = I.get("page"), A = (s == null ? void 0 : s.filter((Z) => Z.role === "user").length) >= 4, w = (s == null ? void 0 : s.filter((Z) => Z.role === "user").length) >= 10;
4929
4929
  J(() => {
4930
4930
  r([]);
@@ -4961,7 +4961,7 @@ const $d = () => {
4961
4961
  a && /* @__PURE__ */ o("div", { className: "fixed inset-0 left-0 top-0 z-40 flex h-screen w-screen flex-col items-center justify-center bg-transparent" }),
4962
4962
  /* @__PURE__ */ m("div", { className: "flex h-full w-full flex-col", children: [
4963
4963
  /* @__PURE__ */ m("div", { className: "flex w-full items-center justify-between", children: [
4964
- /* @__PURE__ */ o("p", { className: "text-xs text-gray-500", children: e("Your conversation will not be saved") }),
4964
+ /* @__PURE__ */ o("p", { className: "text-xs text-gray-500", children: e("Generate with AI") }),
4965
4965
  (s == null ? void 0 : s.length) > 0 && /* @__PURE__ */ o(x, { variant: "outline", size: "icon", onClick: F, className: "h-6 w-6", disabled: a, children: /* @__PURE__ */ o(es, {}) })
4966
4966
  ] }),
4967
4967
  /* @__PURE__ */ o(
@@ -4973,16 +4973,25 @@ const $d = () => {
4973
4973
  )
4974
4974
  ] })
4975
4975
  ] });
4976
- }, Us = ({ models: e, onAIEvent: t, onSuccess: n, onError: s, onComplete: r, ...a }) => {
4977
- const i = {
4976
+ }, Us = ({
4977
+ models: e,
4978
+ onAIEvent: t,
4979
+ onSuccess: n,
4980
+ onError: s,
4981
+ onComplete: r,
4982
+ context: a,
4983
+ ...i
4984
+ }) => {
4985
+ const l = {
4978
4986
  models: e,
4979
4987
  onAIEvent: t,
4980
4988
  onSuccess: n,
4981
4989
  onError: s,
4982
4990
  onComplete: r,
4983
- ...a
4991
+ context: a,
4992
+ ...i
4984
4993
  };
4985
- return /* @__PURE__ */ o(vu, { config: i, children: /* @__PURE__ */ o(ku, {}) });
4994
+ return /* @__PURE__ */ o(vu, { config: l, children: /* @__PURE__ */ o(ku, {}) });
4986
4995
  }, Du = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
4987
4996
  __proto__: null,
4988
4997
  AiPanelContent: Us,
@@ -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-CazbxsDv.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-DsT0ONLh.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-DgEF73WC.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-CBOw_Dg6.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-BOQr_e6S.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-BVfEFOrN.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",
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),m=require("./index-DonDtb8f.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-j-XsKW-V.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 U, e as V, f as _, g as G, af as $, a7 as A, B as P } from "./index-BbkBlCE2.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 { aq as ie, ar as oe, A as ce, ao as de } from "./index-Cyz_Iww4.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:");
@@ -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 C } from "./index-BbkBlCE2.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-Cyz_Iww4.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-DIZhbU2t.js")), ye = z(() => import("./unpublish-page-B4A-GQEz.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 : "";
@@ -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-DonDtb8f.cjs"),n=require("./index-j-XsKW-V.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-D8Vr-1aC.cjs"))),q=c.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-DrZnWLVM.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-BbkBlCE2.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-Co5Lj1HN.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-DonDtb8f.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-CIiwBv2v.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-BbkBlCE2.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-BVfEFOrN.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-DonDtb8f.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-N5DLBdWf.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-DonDtb8f.cjs"),y=require("./index-j-XsKW-V.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-BbkBlCE2.js";
4
- import { r as j, k as O } from "./index-Cyz_Iww4.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";
@@ -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-BbkBlCE2.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-DonDtb8f.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-DonDtb8f.cjs"),n=require("./index-j-XsKW-V.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-BbkBlCE2.js";
4
- import { c as S, d as L, L as x, B as N } from "./index-Cyz_Iww4.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";