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

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 (184) hide show
  1. package/dist/{2SSKDMRQ-Dub3pRV1.cjs → 2SSKDMRQ-DfXKDvXk.cjs} +1 -1
  2. package/dist/{2SSKDMRQ-B5Tzwoh4.js → 2SSKDMRQ-pPung-JB.js} +2 -2
  3. package/dist/{AP7HFJJL-CfmdXP9M.js → AP7HFJJL-CEJuc_Ox.js} +1 -1
  4. package/dist/{AP7HFJJL-Dt6MglIr.cjs → AP7HFJJL-PvPBwV6T.cjs} +1 -1
  5. package/dist/{IconPicker-DLqOB-ri.cjs → IconPicker-BJHUCDn4.cjs} +1 -1
  6. package/dist/{IconPicker-Cn8Z42-Z.js → IconPicker-D_GRfhwS.js} +1 -1
  7. package/dist/{WDYDFRGG-BOpmZGHS.js → WDYDFRGG-B3FrCE_j.js} +2 -2
  8. package/dist/{WDYDFRGG-Dfj1ikzw.cjs → WDYDFRGG-BPHlcLi5.cjs} +1 -1
  9. package/dist/{active-in-another-tab-CEWvA8SG.js → active-in-another-tab-C_Ma7oFU.js} +2 -2
  10. package/dist/{active-in-another-tab-DV83cJ_v.cjs → active-in-another-tab-WVYf-z5w.cjs} +1 -1
  11. package/dist/{add-new-language-page-C3Uu92KN.cjs → add-new-language-page-CxW2Vuyr.cjs} +1 -1
  12. package/dist/{add-new-language-page-B3wK94-S.js → add-new-language-page-DtsBO739.js} +3 -3
  13. package/dist/{add-new-page-BOE-xwBc.cjs → add-new-page-BfKt72NF.cjs} +1 -1
  14. package/dist/{add-new-page-DsvGVrR8.js → add-new-page-DG38rI6S.js} +2 -2
  15. package/dist/{ai-panel-content-DBlnfRRi.cjs → ai-panel-content-Dfo4jOVB.cjs} +1 -1
  16. package/dist/{ai-panel-content-BBSzHZG6.js → ai-panel-content-dktE9CIO.js} +3 -3
  17. package/dist/{ai-panel-default-lang-BVBuwnyU.js → ai-panel-default-lang-BbUTXMbm.js} +9 -9
  18. package/dist/{ai-panel-default-lang-DJJWAtN0.cjs → ai-panel-default-lang-GQCtwlPs.cjs} +2 -2
  19. package/dist/{ai-panel-other-lang-fIEZkmRy.js → ai-panel-other-lang-DIDS-mTi.js} +13 -13
  20. package/dist/{ai-panel-other-lang-v8Yd5ggR.cjs → ai-panel-other-lang-nCUxwpLX.cjs} +1 -1
  21. package/dist/{ai-prompt-input-CmSfGxTN.js → ai-prompt-input-B2q30bhR.js} +16 -16
  22. package/dist/{ai-prompt-input-C7ha_0Cn.cjs → ai-prompt-input-Dws5BHhQ.cjs} +1 -1
  23. package/dist/{ai-translation-prompt-BzTGAS3W.cjs → ai-translation-prompt-CJVcuWrs.cjs} +1 -1
  24. package/dist/{ai-translation-prompt-CtBmvsRy.js → ai-translation-prompt-D87qk3C1.js} +1 -1
  25. package/dist/{change-password-modal-CdOwtCWN.cjs → change-password-modal-CVUa60pC.cjs} +1 -1
  26. package/dist/{change-password-modal-DxkhBI5d.js → change-password-modal-PahNYs8x.js} +2 -2
  27. package/dist/{code-editor-Bpn8z2fo.js → code-editor-CWOmKcUc.js} +1 -1
  28. package/dist/{code-editor-fL3s6Hk7.cjs → code-editor-Cim6jQVF.cjs} +1 -1
  29. package/dist/{continue-editing-in-this-client-DDB816CQ.js → continue-editing-in-this-client-BYFOU3hH.js} +2 -2
  30. package/dist/{continue-editing-in-this-client-DjxpjsA8.cjs → continue-editing-in-this-client-CW0f2LRk.cjs} +1 -1
  31. package/dist/core.cjs +1 -1
  32. package/dist/core.d.ts +3 -0
  33. package/dist/core.js +37 -37
  34. package/dist/{css-import-modal-CL8SIC3K.js → css-import-modal-6bMTRlCg.js} +1 -1
  35. package/dist/{css-import-modal-CRC7bK1c.cjs → css-import-modal-CXulmaB4.cjs} +1 -1
  36. package/dist/{delete-page-41tvYcEw.js → delete-page-BDViv7Xm.js} +2 -2
  37. package/dist/{delete-page-BHPlx8ec.cjs → delete-page-CdByrw3j.cjs} +1 -1
  38. package/dist/{design-token-usage-DtdjTCn3.cjs → design-token-usage-D-hrcKz1.cjs} +1 -1
  39. package/dist/{design-token-usage-CyOY4Pni.js → design-token-usage-lf7N_uOk.js} +28 -28
  40. package/dist/digital-asset-manager-CxxhsToc.cjs +1 -0
  41. package/dist/{digital-asset-manager-C_ru4Zes.js → digital-asset-manager-PcYficIX.js} +5 -5
  42. package/dist/{duplicate-page-BvggF83O.cjs → duplicate-page-D2f3HvWX.cjs} +1 -1
  43. package/dist/{duplicate-page-DMmDdmfS.js → duplicate-page-DfEA148D.js} +3 -3
  44. package/dist/{dynamic-page-selector-D2z51nLi.js → dynamic-page-selector-DB__KD2y.js} +2 -2
  45. package/dist/{dynamic-page-selector-C5agz2Ze.cjs → dynamic-page-selector-Dz7D1Wdr.cjs} +1 -1
  46. package/dist/{get-chai-builder-tailwind-config-DNp8Vhme.cjs → get-chai-builder-tailwind-config-7CxFxEYL.cjs} +1 -1
  47. package/dist/{get-chai-builder-tailwind-config-k8l5sdcw.js → get-chai-builder-tailwind-config-DC4sDOYK.js} +3 -3
  48. package/dist/{get-chai-builder-theme-BSUcPs5t.js → get-chai-builder-theme-BpuwSLeS.js} +1 -1
  49. package/dist/{image-compression-DsZ1oqpb.js → image-compression-DPFITwOL.js} +2 -2
  50. package/dist/image-compression-UaU7Bwqe.cjs +1 -0
  51. package/dist/{image-editor-DFmlG348.cjs → image-editor-BdW476J8.cjs} +1 -1
  52. package/dist/{image-editor-sKvOFo-S.js → image-editor-CilPMtAC.js} +1 -1
  53. package/dist/index-Bzyv7mAh.cjs +5 -0
  54. package/dist/{index-BFnMzGe6.js → index-DsQXiNA_.js} +4997 -4877
  55. package/dist/{index-CA1OwKJX.js → index-IQefjAA0.js} +1696 -1640
  56. package/dist/index-mPCp0j2h.cjs +160 -0
  57. package/dist/{json-diff-viewer-DRQSNhaS.cjs → json-diff-viewer-BPqY25PU.cjs} +1 -1
  58. package/dist/{json-diff-viewer-B5wAR5GY.js → json-diff-viewer-Ci2IbgDn.js} +34 -34
  59. package/dist/{lang-panel-q04hEq5o.js → lang-panel-DlAQr-y9.js} +3 -3
  60. package/dist/{lang-panel-BZsICcBR.cjs → lang-panel-jebYHYGD.cjs} +1 -1
  61. package/dist/library-blocks/bento/agency-showcase/agency-showcase.html +175 -0
  62. package/dist/library-blocks/bento/agency-showcase/agency-showcase.webp +0 -0
  63. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.html +116 -0
  64. package/dist/library-blocks/bento/creative-portfolio/creative-portfolio.webp +0 -0
  65. package/dist/library-blocks/bento/product-features/product-features.html +159 -0
  66. package/dist/library-blocks/bento/product-features/product-features.webp +0 -0
  67. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.html +182 -0
  68. package/dist/library-blocks/bento/saas-dashboard/saas-dashboard.webp +0 -0
  69. package/dist/library-blocks/bento/startup-metrics/startup-metrics.html +170 -0
  70. package/dist/library-blocks/bento/startup-metrics/startup-metrics.webp +0 -0
  71. package/dist/library-blocks/blocks-list.json +145 -12
  72. package/dist/library-blocks/feature/agency-services/agency-services.html +194 -0
  73. package/dist/library-blocks/feature/agency-services/agency-services.webp +0 -0
  74. package/dist/library-blocks/feature/consulting-firm/consulting-firm.html +219 -0
  75. package/dist/library-blocks/feature/consulting-firm/consulting-firm.webp +0 -0
  76. package/dist/library-blocks/feature/design-studio/design-studio.html +190 -0
  77. package/dist/library-blocks/feature/design-studio/design-studio.webp +0 -0
  78. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.html +195 -0
  79. package/dist/library-blocks/feature/freelancer-toolkit/freelancer-toolkit.webp +0 -0
  80. package/dist/library-blocks/feature/marketing-agency/marketing-agency.html +212 -0
  81. package/dist/library-blocks/feature/marketing-agency/marketing-agency.webp +0 -0
  82. package/dist/library-blocks/footer/creative-agency/creative-agency.html +64 -0
  83. package/dist/library-blocks/footer/creative-agency/creative-agency.webp +0 -0
  84. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.html +106 -0
  85. package/dist/library-blocks/footer/minimal-portfolio/minimal-portfolio.webp +0 -0
  86. package/dist/library-blocks/footer/saas-startup/saas-startup.html +117 -0
  87. package/dist/library-blocks/footer/saas-startup/saas-startup.webp +0 -0
  88. package/dist/library-blocks/hero/creative-agency/creative-agency.html +117 -0
  89. package/dist/library-blocks/hero/creative-agency/creative-agency.webp +0 -0
  90. package/dist/library-blocks/hero/developer-focused/developer-focused.html +124 -0
  91. package/dist/library-blocks/hero/developer-focused/developer-focused.webp +0 -0
  92. package/dist/library-blocks/hero/minimal-saas/minimal-saas.html +98 -0
  93. package/dist/library-blocks/hero/minimal-saas/minimal-saas.webp +0 -0
  94. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.html +148 -0
  95. package/dist/library-blocks/hero/portfolio-showcase/portfolio-showcase.webp +0 -0
  96. package/dist/library-blocks/hero/startup-landing/startup-landing.html +130 -0
  97. package/dist/library-blocks/hero/startup-landing/startup-landing.webp +0 -0
  98. package/dist/library-blocks/navbar/creative-agency/creative-agency.html +139 -0
  99. package/dist/library-blocks/navbar/creative-agency/creative-agency.webp +0 -0
  100. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.html +164 -0
  101. package/dist/library-blocks/navbar/minimal-portfolio/minimal-portfolio.webp +0 -0
  102. package/dist/library-blocks/navbar/saas-startup/saas-startup.html +129 -0
  103. package/dist/library-blocks/navbar/saas-startup/saas-startup.webp +0 -0
  104. package/dist/manage-design-tokens-BknGNAKE.cjs +1 -0
  105. package/dist/manage-design-tokens-Co5677WS.js +428 -0
  106. package/dist/manage-design-tokens-modal-9qpcb-EC.js +161 -0
  107. package/dist/manage-design-tokens-modal-BcgdwEXE.cjs +1 -0
  108. package/dist/{mark-as-template-raTtKmQ9.js → mark-as-template-DOZL3umP.js} +2 -2
  109. package/dist/{mark-as-template-CT-hLGIW.cjs → mark-as-template-DS-tMllK.cjs} +1 -1
  110. package/dist/{nested-path-selector-content-CzQ2Lorl.js → nested-path-selector-content-Be-pbnVl.js} +1 -1
  111. package/dist/{nested-path-selector-content-CSUHTj9G.cjs → nested-path-selector-content-CWmPgU-L.cjs} +1 -1
  112. package/dist/{no-language-page-content-Bg6VjMVY.js → no-language-page-content-C8W0M_Fj.js} +4 -4
  113. package/dist/{no-language-page-content-Bkj8JpEY.cjs → no-language-page-content-DWtEo657.cjs} +1 -1
  114. package/dist/{no-language-page-dialog-TffLjvJn.cjs → no-language-page-dialog-FVXkSnfT.cjs} +1 -1
  115. package/dist/{no-language-page-dialog-CRPMr9YT.js → no-language-page-dialog-cpCZ9vES.js} +2 -2
  116. package/dist/{page-creator-CQhE1tgn.js → page-creator-CFtxeW_t.js} +172 -172
  117. package/dist/{page-creator-RrUhy8uH.cjs → page-creator-o6yRzsVf.cjs} +1 -1
  118. package/dist/{page-lock-D9h5pgxn.cjs → page-lock-BS_ErOIW.cjs} +1 -1
  119. package/dist/{page-lock-Dye1JZBB.js → page-lock-Cthbk6Pg.js} +2 -2
  120. package/dist/{page-locked-dialog-b2_f-A7a.cjs → page-locked-dialog-BWXifuQ8.cjs} +1 -1
  121. package/dist/{page-locked-dialog-BMjPVyHF.js → page-locked-dialog-D5hmaWqw.js} +16 -16
  122. package/dist/page-manager-new-Dl5YwsMm.js +418 -0
  123. package/dist/page-manager-new-DpSqBzeh.cjs +1 -0
  124. package/dist/{page-manager-search-and-filter-DCcYyoPO.js → page-manager-search-and-filter-iFsFJhn4.js} +27 -26
  125. package/dist/{page-manager-search-and-filter-D0ZXojiu.cjs → page-manager-search-and-filter-jDoLrCB7.cjs} +1 -1
  126. package/dist/{page-revisions-content-mDwvH6J-.js → page-revisions-content-C1IGUurW.js} +13 -13
  127. package/dist/{page-revisions-content-BX8ZWebc.cjs → page-revisions-content-CeBepZEw.cjs} +1 -1
  128. package/dist/pages.cjs +1 -1
  129. package/dist/pages.d.ts +3 -0
  130. package/dist/pages.js +1 -1
  131. package/dist/{plugin-Dkmjb2_e.js → plugin-BSjgGgwo.js} +10 -10
  132. package/dist/{publish-pages-content-M_Kb8b-F.js → publish-pages-content-BpEoA1T6.js} +3 -3
  133. package/dist/{publish-pages-content-CR4e9inX.cjs → publish-pages-content-PNsiaGI-.cjs} +1 -1
  134. package/dist/render.cjs +1 -1
  135. package/dist/render.d.ts +1 -0
  136. package/dist/render.js +32 -32
  137. package/dist/{rte-widget-modal-BRSm1Lnp.cjs → rte-widget-modal-CC1KcrAT.cjs} +1 -1
  138. package/dist/{rte-widget-modal-CVZDktXI.js → rte-widget-modal-c3T09VeO.js} +1 -1
  139. package/dist/runtime.d.ts +1 -0
  140. package/dist/{save-to-lib-B1ccNhR2.js → save-to-lib-BERYhyxq.js} +27 -27
  141. package/dist/{save-to-lib-CYEAWxL9.cjs → save-to-lib-Bk59qO1r.cjs} +1 -1
  142. package/dist/sdk.css +1 -1
  143. package/dist/{selected-block-display-aGR7p5JC.js → selected-block-display-C6NxfC0N.js} +11 -11
  144. package/dist/{selected-block-display-MyU0rS4q.cjs → selected-block-display-vFSCOnw8.cjs} +1 -1
  145. package/dist/{seo-panel-B5mDwpaT.cjs → seo-panel-0vlr_dBq.cjs} +1 -1
  146. package/dist/{seo-panel-P9uixkoZ.js → seo-panel-COrEJZLA.js} +138 -138
  147. package/dist/{shared-json-ld-DhQJh_mT.cjs → shared-json-ld-C46hURIr.cjs} +1 -1
  148. package/dist/{shared-json-ld-Ba9GcvLr.js → shared-json-ld-DnTuCBc3.js} +70 -70
  149. package/dist/{slug-input-CAfGHqMW.js → slug-input-CAqkFZBq.js} +1 -1
  150. package/dist/{slug-input-BdMnlYKT.cjs → slug-input-Curnt2n3.cjs} +1 -1
  151. package/dist/supabase-actions.cjs +1 -1
  152. package/dist/supabase-actions.js +193 -195
  153. package/dist/{take-over-request-BeHTL28z.cjs → take-over-request-6fliSr8w.cjs} +1 -1
  154. package/dist/{take-over-request-CXjaDliJ.js → take-over-request-DvmM5qTu.js} +10 -10
  155. package/dist/{theme-panel-footer-D_gxD0j4.cjs → theme-panel-footer-3ixmq107.cjs} +1 -1
  156. package/dist/{theme-panel-footer-BkwhuXM7.js → theme-panel-footer-BlsXRcEY.js} +2 -2
  157. package/dist/{translation-warning-modal-D_vt37fW.cjs → translation-warning-modal-B876S5yp.cjs} +1 -1
  158. package/dist/{translation-warning-modal-CTfArsb1.js → translation-warning-modal-kRcfrPgo.js} +1 -1
  159. package/dist/types.d.ts +3 -0
  160. package/dist/{unmark-as-template-vFgMIdxN.js → unmark-as-template-Dn3klZKq.js} +2 -2
  161. package/dist/{unmark-as-template-D2bvjGKt.cjs → unmark-as-template-q1GblG-u.cjs} +1 -1
  162. package/dist/{unpublish-page-CxkjTzBB.js → unpublish-page-BbFZw0so.js} +2 -2
  163. package/dist/{unpublish-page-CPjHmtSM.cjs → unpublish-page-DMbcHmUV.cjs} +1 -1
  164. package/dist/unpublished-partials-modal-CEFXp1D1.cjs +1 -0
  165. package/dist/unpublished-partials-modal-Ts5ZhAK9.js +41 -0
  166. package/dist/utils.cjs +1 -1
  167. package/dist/utils.js +2 -2
  168. package/dist/{web-preview--by73Vvr.js → web-preview-B2YGL26D.js} +1 -1
  169. package/dist/{web-preview-C3AMe_BB.cjs → web-preview-C6SLwtqv.cjs} +1 -1
  170. package/package.json +2 -7
  171. package/dist/delete-design-token-B0md8qUi.js +0 -40
  172. package/dist/delete-design-token-C94IgWdi.cjs +0 -1
  173. package/dist/digital-asset-manager-DSLQz8qk.cjs +0 -1
  174. package/dist/image-compression-DZ9WMmyn.cjs +0 -1
  175. package/dist/index-Bzn_gpaK.cjs +0 -5
  176. package/dist/index-D30xvFa5.cjs +0 -160
  177. package/dist/library-blocks/hero-1/hero-1.html +0 -74
  178. package/dist/library-blocks/hero-1/hero-1.webp +0 -0
  179. package/dist/library-blocks/hero-2/hero-2.html +0 -95
  180. package/dist/library-blocks/hero-2/hero-2.webp +0 -0
  181. package/dist/manage-design-tokens-Cene3KEu.js +0 -241
  182. package/dist/manage-design-tokens-Di5C6nTj.cjs +0 -1
  183. package/dist/page-manager-new-2mDjnSqc.cjs +0 -1
  184. package/dist/page-manager-new-DP1b_dXt.js +0 -411
@@ -0,0 +1,418 @@
1
+ import { jsxs as w, Fragment as F, jsx as t } from "react/jsx-runtime";
2
+ import { d as ie } from "./index-DsQXiNA_.js";
3
+ import { aB as be, aC as ge, ap as ke, k as de, T as R, aR as Ne, L as ve, m as Se, g as Le, c as Te, av as Ae, aS as Ce, aT as Ee } from "./index-IQefjAA0.js";
4
+ import { u as J } from "./use-page-expand-manager-Cf4MUEJw.js";
5
+ import { compact as ue, filter as B, isEmpty as g, uniqBy as $e, keyBy as me, mapValues as Me, startCase as Ue, toLower as $, includes as q, get as W, find as H, map as Ie } from "lodash-es";
6
+ import { atom as ze, useAtom as Be, useSetAtom as Fe } from "jotai";
7
+ import { ExternalLink as Oe, Pencil as je, NotepadText as Ge, MoreHorizontal as De, Lock as Re, Edit as We, Plus as He, ChevronRight as _e, StarsIcon as qe, Hash as Ve, File as he } from "lucide-react";
8
+ import { useRef as Qe, useEffect as E, useMemo as _, useState as v, useCallback as le, startTransition as Xe, Suspense as C, lazy as M } from "react";
9
+ import { useTranslation as Ye } from "react-i18next";
10
+ import { B as Je } from "./register-chai-top-bar-D6GjnauV.js";
11
+ const ce = (e, s) => !e || !Array.isArray(e) ? [] : g(s) ? e : ue(
12
+ B(e, (a) => {
13
+ const n = $(s);
14
+ return q($((a == null ? void 0 : a.name) || ""), n) || q($((a == null ? void 0 : a.slug) || ""), n);
15
+ })
16
+ ), Ke = (e, s) => {
17
+ const a = /* @__PURE__ */ new Set(), n = me(e, "id");
18
+ return s.forEach((i) => {
19
+ let o = i;
20
+ for (; o.parent && n[o.parent]; )
21
+ a.add(o.parent), o = n[o.parent];
22
+ }), Array.from(a).map((i) => n[i]);
23
+ }, Y = (e, s, a) => g(s) ? e : e.map((n) => {
24
+ if (!a(n.pageType))
25
+ return {
26
+ ...n,
27
+ shouldExpandOnSearch: !0,
28
+ children: n.children ? Y(n.children, s, a) : []
29
+ };
30
+ const i = n.children && n.children.some(
31
+ (o) => q($(o.name || ""), $(s)) || q($(o.slug || ""), $(s))
32
+ );
33
+ return {
34
+ ...n,
35
+ shouldExpandOnSearch: i,
36
+ children: n.children ? Y(n.children, s, a) : []
37
+ };
38
+ }), Ze = (e) => {
39
+ if (!e || !e.length) return [];
40
+ const s = {};
41
+ e.forEach((n) => {
42
+ s[n.id] = { ...n, children: [] };
43
+ });
44
+ const a = [];
45
+ return Object.values(s).forEach((n) => {
46
+ n.parent && s[n.parent] ? s[n.parent].children.push(n) : a.push(n);
47
+ }), a;
48
+ }, fe = (e) => !e || !e.length ? [] : [...e].sort((a, n) => (a.name || "").localeCompare(n.name || "")).map((a) => ({
49
+ ...a,
50
+ children: a.children ? fe(a.children) : []
51
+ })), et = (e, s, a, n) => {
52
+ if (!e || !e.length) return [];
53
+ let i = e;
54
+ if (a !== "all" && (i = ue(B(e, { pageType: a }))), g(s))
55
+ i = ce(i, s);
56
+ else {
57
+ const h = ce(i, s), c = Ke(e, h);
58
+ i = $e([...h, ...c], "id");
59
+ }
60
+ const o = fe(Ze(i)), f = Y(o, s, n), P = B(f, (h) => n(h.pageType)).sort(
61
+ (h, c) => (h.name || "").localeCompare(c.name || "")
62
+ ), d = B(f, (h) => !n(h.pageType));
63
+ let p = [];
64
+ if (a === "all") {
65
+ const h = me(d, "pageType");
66
+ p = Object.values(
67
+ Me(h, (c, x) => ({
68
+ ...c,
69
+ id: x,
70
+ name: Ue(x),
71
+ isPartialGroup: !0,
72
+ children: f.filter((k) => k.pageType === x)
73
+ }))
74
+ );
75
+ } else
76
+ p = d.sort((h, c) => (h.name || "").localeCompare(c.name || ""));
77
+ return [...P, ...p];
78
+ }, tt = ze({
79
+ pageId: null,
80
+ position: { x: 0, y: 0 }
81
+ }), nt = ({ pageId: e, children: s }) => {
82
+ const [a, n] = Be(tt), i = Qe(null), o = a.pageId === e;
83
+ E(() => {
84
+ const d = () => n({ pageId: null, position: { x: 0, y: 0 } });
85
+ if (o)
86
+ return document.addEventListener("click", d), () => document.removeEventListener("click", d);
87
+ }, [o, n]);
88
+ const f = (d) => {
89
+ d.preventDefault(), d.stopPropagation(), n({ pageId: e, position: { x: d.clientX, y: d.clientY } });
90
+ }, P = () => {
91
+ const d = `${window.location.pathname}?page=${e}`;
92
+ window.open(d, "_blank"), n({ pageId: null, position: { x: 0, y: 0 } });
93
+ };
94
+ return /* @__PURE__ */ w(F, { children: [
95
+ /* @__PURE__ */ t("span", { onContextMenu: f, children: s }),
96
+ o && /* @__PURE__ */ t(
97
+ "div",
98
+ {
99
+ ref: i,
100
+ className: "fixed z-[9999] max-w-[160px] rounded-md border border-gray-200 bg-white",
101
+ style: { top: a.position.y, left: a.position.x },
102
+ children: /* @__PURE__ */ t("div", { className: "", children: /* @__PURE__ */ w(
103
+ Je,
104
+ {
105
+ variant: "ghost",
106
+ onClick: P,
107
+ className: "w-full px-2.5 py-1 text-start text-sm text-gray-700 hover:bg-gray-100",
108
+ children: [
109
+ /* @__PURE__ */ t(Oe, { className: "h-4 w-4" }),
110
+ "Open in new tab"
111
+ ]
112
+ }
113
+ ) })
114
+ }
115
+ )
116
+ ] });
117
+ }, st = ({ page: e }) => {
118
+ var n, i;
119
+ const { isExpanded: s, toggleExpanded: a } = J(e == null ? void 0 : e.id);
120
+ return /* @__PURE__ */ t(
121
+ "button",
122
+ {
123
+ onClick: (o) => {
124
+ o.stopPropagation(), a();
125
+ },
126
+ disabled: !((n = e == null ? void 0 : e.children) != null && n.length),
127
+ className: `flex h-[calc(100%-2px)] w-5 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-200 hover:px-1 hover:text-gray-500 ${(i = e == null ? void 0 : e.children) != null && i.length ? "hover:text-blue-400" : "opacity-0"}`,
128
+ children: /* @__PURE__ */ t(
129
+ _e,
130
+ {
131
+ size: 12,
132
+ className: `stroke-[4] transition-transform duration-200 ${s ? "rotate-90" : ""}`
133
+ }
134
+ )
135
+ }
136
+ );
137
+ }, at = ({ page: e, pageType: s }) => /* @__PURE__ */ t("div", { className: "flex h-full items-center justify-center gap-x-1", children: e.dynamic ? /* @__PURE__ */ t(qe, { size: 12, className: "text-yellow-400" }) : s != null && s.icon ? /* @__PURE__ */ t(
138
+ "div",
139
+ {
140
+ className: "flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",
141
+ dangerouslySetInnerHTML: { __html: s.icon }
142
+ }
143
+ ) : s != null && s.hasSlug ? /* @__PURE__ */ t(he, { size: 12, className: "stroke-[1] text-slate-500" }) : /* @__PURE__ */ t(Ve, { size: 12, className: "stroke-[1] text-slate-500" }) }), rt = ({ isOnline: e }) => /* @__PURE__ */ t("div", { className: `h-2 w-2 rounded-full ${e ? "bg-green-300" : "bg-gray-300"}` }), ot = ({
144
+ page: e,
145
+ pageTypes: s,
146
+ currentPage: a,
147
+ onClickAction: n,
148
+ languagePages: i,
149
+ selectedLanguage: o,
150
+ showUntranslatedPages: f
151
+ }) => {
152
+ const P = be(), { pageToUser: d } = ge(), p = W(d, [e == null ? void 0 : e.id, "userId"]), { data: h } = ke(p), c = h && P !== p ? h == null ? void 0 : h.name : null, x = de(), k = a === e.id, V = !!e.isTemplate, y = _(() => H(s, { key: e.pageType }), [s, e.pageType]);
153
+ let u = W(i, e == null ? void 0 : e.id);
154
+ u = W(u, "lang") === o ? u : null;
155
+ const L = o === x || !!u, A = (u == null ? void 0 : u.name) || (e == null ? void 0 : e.name) || "No name";
156
+ let N = (u == null ? void 0 : u.slug) || (e == null ? void 0 : e.slug) || "";
157
+ const O = N + (e != null && e.dynamic ? `/${y == null ? void 0 : y.dynamicSlug}` : "") + (e != null && e.dynamicSlugCustom ? `${e.dynamicSlugCustom}` : "");
158
+ if (N.startsWith("/") && !f) {
159
+ const l = N.split("/").pop();
160
+ N = N.endsWith(l) && e.dynamic ? "" : `/${l}`;
161
+ }
162
+ const j = _(() => {
163
+ const l = "flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]", U = `${k ? "border-primary/30 bg-primary/5" : "border-transparent hover:border-gray-200 hover:bg-gray-100"}`;
164
+ return L ? `${l} ${U} ${c ? "opacity-60" : ""}` : `${l} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`;
165
+ }, [L, k, c]), G = _(() => {
166
+ if (e.isPartialGroup) return !1;
167
+ if (u) {
168
+ if (!u.online || g(u.changes)) return !1;
169
+ } else if (e && (!e.online || g(e.changes)))
170
+ return !1;
171
+ return !0;
172
+ }, [u, e]);
173
+ return /* @__PURE__ */ w("div", { className: "group relative", children: [
174
+ /* @__PURE__ */ t(nt, { pageId: e.id, children: /* @__PURE__ */ w(
175
+ "div",
176
+ {
177
+ onClick: () => !e.isPartialGroup && L && n("select", e == null ? void 0 : e.id),
178
+ className: j,
179
+ children: [
180
+ /* @__PURE__ */ t(st, { page: e }),
181
+ !e.isPartialGroup && /* @__PURE__ */ t(rt, { isOnline: u ? u.online : e.online }),
182
+ !e.isPartialGroup && /* @__PURE__ */ t(at, { page: e, pageType: y }),
183
+ /* @__PURE__ */ t(R, { content: A, side: "top", showTooltip: A.length > 35, children: /* @__PURE__ */ t("span", { className: "max-w-[40%] truncate font-medium text-black", children: A }) }),
184
+ (N || e.dynamic) && /* @__PURE__ */ t(R, { content: O, side: "top", showTooltip: !0, children: /* @__PURE__ */ w("span", { className: "max-w-[40%] truncate font-mono text-xs text-muted-foreground", children: [
185
+ N,
186
+ e.dynamic && (y == null ? void 0 : y.dynamicSlug) && /* @__PURE__ */ w("span", { className: "text-xs text-gray-500", children: [
187
+ "/",
188
+ y == null ? void 0 : y.dynamicSlug,
189
+ e.dynamicSlugCustom
190
+ ] })
191
+ ] }) }),
192
+ G && /* @__PURE__ */ t(R, { content: "Has unpublished changes", side: "top", children: /* @__PURE__ */ t("span", { className: "text-amber-500", children: /* @__PURE__ */ t(je, { size: 12, className: "stroke-[2]" }) }) }),
193
+ V && /* @__PURE__ */ t(R, { content: "Template", side: "top", children: /* @__PURE__ */ t("span", { className: "text-blue-500", children: /* @__PURE__ */ t(Ge, { size: 16 }) }) }),
194
+ !e.isPartialGroup && L && !c ? /* @__PURE__ */ t("div", { className: "duration absolute right-0.5 top-[3px]", children: /* @__PURE__ */ t(
195
+ Ne,
196
+ {
197
+ isLanguagePage: !!u,
198
+ page: u || e,
199
+ setDuplicatePage: (l) => n("duplicate", l),
200
+ setAddEditPage: (l) => n("edit", u || l),
201
+ setUnpublishPage: (l) => n("unpublish", l),
202
+ setDeletePage: (l) => n("delete", u || l),
203
+ setMarkAsTemplate: (l) => n("markAsTemplate", l),
204
+ setUnmarkAsTemplate: (l) => n("unmarkAsTemplate", l),
205
+ children: /* @__PURE__ */ t("div", { className: "m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white", children: /* @__PURE__ */ t(De, { className: "h-4 w-4", onClick: (l) => l.stopPropagation() }) })
206
+ }
207
+ ) }) : c ? /* @__PURE__ */ t("span", { className: "duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500", children: /* @__PURE__ */ t(Re, { className: "h-3.5 w-3.5 fill-red-200 text-red-500" }) }) : null
208
+ ]
209
+ }
210
+ ) }),
211
+ /* @__PURE__ */ t(F, { children: c && /* @__PURE__ */ w("button", { className: "absolute right-px top-1/2 flex h-6 -translate-y-1/2 items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100", children: [
212
+ /* @__PURE__ */ t(We, { size: 12, className: "stroke-[3]" }),
213
+ " ",
214
+ /* @__PURE__ */ t("span", { className: "font-medium", children: c }),
215
+ " is editing this page"
216
+ ] }) }),
217
+ /* @__PURE__ */ t(F, { children: !L && !e.isPartialGroup && !c && /* @__PURE__ */ w(
218
+ "button",
219
+ {
220
+ onClick: (l) => {
221
+ l.stopPropagation(), n("addLanguagePage", { language: o, page: e });
222
+ },
223
+ className: "absolute left-1/2 top-1 flex -translate-x-1/2 items-center gap-x-1 rounded bg-blue-500 px-2 py-0.5 text-xs text-white opacity-0 duration-200 hover:bg-blue-700 group-hover:opacity-100",
224
+ children: [
225
+ /* @__PURE__ */ t(He, { size: 12, className: "stroke-[3]" }),
226
+ " ",
227
+ /* @__PURE__ */ w("span", { className: "text-[10px]", children: [
228
+ "Add ",
229
+ W(ve, o),
230
+ " Page"
231
+ ] })
232
+ ]
233
+ }
234
+ ) })
235
+ ] });
236
+ }, pe = ({
237
+ pages: e,
238
+ tier: s,
239
+ pageTypes: a,
240
+ currentPage: n,
241
+ onClickAction: i,
242
+ languagePages: o,
243
+ selectedLanguage: f,
244
+ showUntranslatedPages: P
245
+ }) => {
246
+ const { expandedPages: d } = J();
247
+ return /* @__PURE__ */ t("div", { className: "space-y-0.5", style: { paddingLeft: `${s * 10}px` }, children: e.map((p) => /* @__PURE__ */ w(F, { children: [
248
+ /* @__PURE__ */ t(
249
+ ot,
250
+ {
251
+ page: p,
252
+ pageTypes: a,
253
+ currentPage: n,
254
+ onClickAction: i,
255
+ languagePages: o,
256
+ selectedLanguage: f,
257
+ showUntranslatedPages: P
258
+ }
259
+ ),
260
+ p.children && p.children.length > 0 && (d == null ? void 0 : d.includes(p.id)) && /* @__PURE__ */ t(
261
+ pe,
262
+ {
263
+ pages: p.children,
264
+ tier: s + 1,
265
+ pageTypes: a,
266
+ currentPage: n,
267
+ onClickAction: i,
268
+ languagePages: o,
269
+ selectedLanguage: f,
270
+ showUntranslatedPages: P
271
+ }
272
+ )
273
+ ] }, p.id)) });
274
+ }, it = M(() => import("./page-manager-search-and-filter-iFsFJhn4.js")), lt = M(() => import("./add-new-page-DG38rI6S.js")), ct = M(() => import("./delete-page-BDViv7Xm.js")), dt = M(() => import("./duplicate-page-DfEA148D.js")), ut = M(() => import("./mark-as-template-DOZL3umP.js")), mt = M(() => import("./unmark-as-template-Dn3klZKq.js")), ht = M(() => import("./unpublish-page-BbFZw0so.js")), vt = ({ close: e }) => {
275
+ const { t: s } = Ye(), { languages: a, setSelectedLang: n } = ie(), { data: i } = Se(), { data: o, isFetching: f } = Le(), [P, d] = Te(), { updateForSelectedPage: p, expandPagesOnSearch: h } = J(null), c = de(), x = P.get("page"), [k, V] = v(""), [y, u] = v(null), [L, A] = v(null), [N, O] = v(null), [j, G] = v(null), [l, U] = v(""), [K, Z] = v(null), [ee, te] = v(null), [b, Q] = v(c), [xe, ye] = v(!1), ne = Fe(Ae), D = xe && b !== c, { data: I, isFetching: we } = Ce(b), se = le(
276
+ (m) => {
277
+ var r;
278
+ return (r = H(i, { key: m })) == null ? void 0 : r.hasSlug;
279
+ },
280
+ [i]
281
+ ), S = _(() => o ? D ? B(o, (m) => !(I != null && I[m.id])) : et(o, k, l, se) : [], [o, se, k, l, I, D]);
282
+ E(() => {
283
+ n(c);
284
+ }, [c, n]), E(() => {
285
+ const m = P.get("lang");
286
+ if (m) {
287
+ const r = a, T = a[0] ?? c, z = r.includes(m);
288
+ Xe(() => {
289
+ z && b !== m ? Q(m) : !z && b !== T && Q(T);
290
+ });
291
+ }
292
+ }, []), E(() => {
293
+ if (!g(l)) return;
294
+ const m = sessionStorage.getItem("pageTypeFilter") || "all";
295
+ !g(i) && m && (H(i, { key: m }) ? U(m) : U("all"));
296
+ }, [i, l]), E(() => {
297
+ if (x && !f && !H(o, { id: x })) {
298
+ const r = new URLSearchParams(P.toString());
299
+ if (r.delete("page"), [...r.keys()].length > 0) {
300
+ if (typeof window < "u" && window.history && window.location) {
301
+ const T = r.toString(), z = window.location.hash || "", oe = window.location.pathname, Pe = T ? `${oe}?${T}${z}` : `${oe}${z}`;
302
+ window.history.replaceState(window.history.state, "", Pe);
303
+ }
304
+ d(r);
305
+ } else
306
+ typeof window < "u" && window.history && window.location && (window.history.replaceState(
307
+ window.history.state,
308
+ "",
309
+ window.location.pathname + window.location.hash
310
+ ), window.dispatchEvent(new PopStateEvent("popstate", { state: window.history.state }))), d(r);
311
+ }
312
+ }, [o, x, f, d]), E(() => {
313
+ x && !f && !g(S) && p(S, x);
314
+ }, [x, f, S, p]), E(() => {
315
+ !g(k) && !g(S) && h(S);
316
+ }, [k, S, h]);
317
+ const { setSelectedLang: X } = ie(), ae = le(
318
+ (m) => {
319
+ const r = new URLSearchParams({ page: m });
320
+ b !== c ? (r.set("lang", b), X(b)) : X(""), Ee(r, d), e();
321
+ },
322
+ [e, d, X, b, c]
323
+ ), re = (m, r) => {
324
+ var T;
325
+ if (r)
326
+ switch (m) {
327
+ case "add":
328
+ A(r);
329
+ break;
330
+ case "select":
331
+ ae(r);
332
+ break;
333
+ case "edit":
334
+ b !== c ? ne({
335
+ edit: !0,
336
+ id: r == null ? void 0 : r.id,
337
+ primaryPage: r == null ? void 0 : r.primaryPage
338
+ }) : A(r);
339
+ break;
340
+ case "delete":
341
+ u(r);
342
+ break;
343
+ case "unpublish":
344
+ O(r);
345
+ break;
346
+ case "markAsTemplate":
347
+ G(r);
348
+ break;
349
+ case "unmarkAsTemplate":
350
+ te(r);
351
+ break;
352
+ case "duplicate":
353
+ Z(r);
354
+ break;
355
+ case "addLanguagePage":
356
+ ne({
357
+ edit: !1,
358
+ primaryPage: ((T = r == null ? void 0 : r.page) == null ? void 0 : T.id) || "",
359
+ preselectedLang: (r == null ? void 0 : r.language) || b
360
+ });
361
+ break;
362
+ }
363
+ };
364
+ return /* @__PURE__ */ w(F, { children: [
365
+ /* @__PURE__ */ w("div", { className: "flex h-full flex-col justify-between", children: [
366
+ /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(
367
+ it,
368
+ {
369
+ pages: S,
370
+ search: k,
371
+ setSearch: V,
372
+ languages: [c, ...a],
373
+ selectedLanguage: b,
374
+ setSelectedLanguage: Q,
375
+ selectedPageType: l,
376
+ setSelectedPageType: U,
377
+ onAddPage: (m) => re("add", m),
378
+ showUntranslatedPages: D,
379
+ setShowUntranslatedPages: ye
380
+ }
381
+ ) }),
382
+ /* @__PURE__ */ t("div", { className: "flex-1 overflow-y-auto px-4 pb-6 pt-2", children: f || we ? /* @__PURE__ */ t("div", { className: "space-y-2", children: Ie([...Array(15).keys()], (m) => /* @__PURE__ */ t("div", { className: "h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200" }, m)) }) : g(S) ? /* @__PURE__ */ w("div", { className: "flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500", children: [
383
+ /* @__PURE__ */ t(he, { className: "h-6 w-6 stroke-[1]" }),
384
+ s("Empty List!"),
385
+ /* @__PURE__ */ t("span", { className: "font-light", children: s("Add new page to start") })
386
+ ] }) : /* @__PURE__ */ t(
387
+ pe,
388
+ {
389
+ tier: 0,
390
+ pages: S,
391
+ pageTypes: i,
392
+ currentPage: x || "",
393
+ onClickAction: re,
394
+ languagePages: I,
395
+ selectedLanguage: b,
396
+ showUntranslatedPages: D
397
+ }
398
+ ) })
399
+ ] }),
400
+ L && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(
401
+ lt,
402
+ {
403
+ closePanel: e,
404
+ editPage: ae,
405
+ addEditPage: L,
406
+ setAddEditPage: A
407
+ }
408
+ ) }),
409
+ y && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(ct, { page: y, onClose: () => u(null) }) }),
410
+ N && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(ht, { page: N, onClose: () => O(null) }) }),
411
+ j && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(ut, { page: j, onClose: () => G(null) }) }),
412
+ ee && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(mt, { page: ee, onClose: () => te(null) }) }),
413
+ K && /* @__PURE__ */ t(C, { children: /* @__PURE__ */ t(dt, { page: K, onClose: () => Z(null), closePanel: e }) })
414
+ ] });
415
+ };
416
+ export {
417
+ vt as default
418
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),K=require("./index-mPCp0j2h.cjs"),p=require("./index-Bzyv7mAh.cjs"),G=require("./use-page-expand-manager-B6XTvk0E.cjs"),n=require("lodash-es"),R=require("jotai"),S=require("lucide-react"),o=require("react"),oe=require("react-i18next"),ie=require("./register-chai-top-bar-DyW9GPzV.cjs"),Z=(e,r)=>!e||!Array.isArray(e)?[]:n.isEmpty(r)?e:n.compact(n.filter(e,a=>{const s=n.toLower(r);return n.includes(n.toLower((a==null?void 0:a.name)||""),s)||n.includes(n.toLower((a==null?void 0:a.slug)||""),s)})),le=(e,r)=>{const a=new Set,s=n.keyBy(e,"id");return r.forEach(c=>{let l=c;for(;l.parent&&s[l.parent];)a.add(l.parent),l=s[l.parent]}),Array.from(a).map(c=>s[c])},O=(e,r,a)=>n.isEmpty(r)?e:e.map(s=>{if(!a(s.pageType))return{...s,shouldExpandOnSearch:!0,children:s.children?O(s.children,r,a):[]};const c=s.children&&s.children.some(l=>n.includes(n.toLower(l.name||""),n.toLower(r))||n.includes(n.toLower(l.slug||""),n.toLower(r)));return{...s,shouldExpandOnSearch:c,children:s.children?O(s.children,r,a):[]}}),ce=e=>{if(!e||!e.length)return[];const r={};e.forEach(s=>{r[s.id]={...s,children:[]}});const a=[];return Object.values(r).forEach(s=>{s.parent&&r[s.parent]?r[s.parent].children.push(s):a.push(s)}),a},ee=e=>!e||!e.length?[]:[...e].sort((a,s)=>(a.name||"").localeCompare(s.name||"")).map(a=>({...a,children:a.children?ee(a.children):[]})),de=(e,r,a,s)=>{if(!e||!e.length)return[];let c=e;if(a!=="all"&&(c=n.compact(n.filter(e,{pageType:a}))),n.isEmpty(r))c=Z(c,r);else{const f=Z(c,r),u=le(e,f);c=n.uniqBy([...f,...u],"id")}const l=ee(ce(c)),y=O(l,r,s),j=n.filter(y,f=>s(f.pageType)).sort((f,u)=>(f.name||"").localeCompare(u.name||"")),m=n.filter(y,f=>!s(f.pageType));let P=[];if(a==="all"){const f=n.keyBy(m,"pageType");P=Object.values(n.mapValues(f,(u,w)=>({...u,id:w,name:n.startCase(w),isPartialGroup:!0,children:y.filter(k=>k.pageType===w)})))}else P=m.sort((f,u)=>(f.name||"").localeCompare(u.name||""));return[...j,...P]},ue=R.atom({pageId:null,position:{x:0,y:0}}),me=({pageId:e,children:r})=>{const[a,s]=R.useAtom(ue),c=o.useRef(null),l=a.pageId===e;o.useEffect(()=>{const m=()=>s({pageId:null,position:{x:0,y:0}});if(l)return document.addEventListener("click",m),()=>document.removeEventListener("click",m)},[l,s]);const y=m=>{m.preventDefault(),m.stopPropagation(),s({pageId:e,position:{x:m.clientX,y:m.clientY}})},j=()=>{const m=`${window.location.pathname}?page=${e}`;window.open(m,"_blank"),s({pageId:null,position:{x:0,y:0}})};return t.jsxs(t.Fragment,{children:[t.jsx("span",{onContextMenu:y,children:r}),l&&t.jsx("div",{ref:c,className:"fixed z-[9999] max-w-[160px] rounded-md border border-gray-200 bg-white",style:{top:a.position.y,left:a.position.x},children:t.jsx("div",{className:"",children:t.jsxs(ie.Button,{variant:"ghost",onClick:j,className:"w-full px-2.5 py-1 text-start text-sm text-gray-700 hover:bg-gray-100",children:[t.jsx(S.ExternalLink,{className:"h-4 w-4"}),"Open in new tab"]})})})]})},he=({page:e})=>{var s,c;const{isExpanded:r,toggleExpanded:a}=G.usePageExpandManager(e==null?void 0:e.id);return t.jsx("button",{onClick:l=>{l.stopPropagation(),a()},disabled:!((s=e==null?void 0:e.children)!=null&&s.length),className:`flex h-[calc(100%-2px)] w-5 items-center justify-center rounded text-gray-400 transition-colors hover:bg-gray-200 hover:px-1 hover:text-gray-500 ${(c=e==null?void 0:e.children)!=null&&c.length?"hover:text-blue-400":"opacity-0"}`,children:t.jsx(S.ChevronRight,{size:12,className:`stroke-[4] transition-transform duration-200 ${r?"rotate-90":""}`})})},xe=({page:e,pageType:r})=>t.jsx("div",{className:"flex h-full items-center justify-center gap-x-1",children:e.dynamic?t.jsx(S.StarsIcon,{size:12,className:"text-yellow-400"}):r!=null&&r.icon?t.jsx("div",{className:"flex h-4 max-h-4 w-4 max-w-4 items-center justify-center stroke-[1] text-slate-500",dangerouslySetInnerHTML:{__html:r.icon}}):r!=null&&r.hasSlug?t.jsx(S.File,{size:12,className:"stroke-[1] text-slate-500"}):t.jsx(S.Hash,{size:12,className:"stroke-[1] text-slate-500"})}),fe=({isOnline:e})=>t.jsx("div",{className:`h-2 w-2 rounded-full ${e?"bg-green-300":"bg-gray-300"}`}),pe=({page:e,pageTypes:r,currentPage:a,onClickAction:s,languagePages:c,selectedLanguage:l,showUntranslatedPages:y})=>{const j=p.useUserId(),{pageToUser:m}=p.usePageToUser(),P=n.get(m,[e==null?void 0:e.id,"userId"]),{data:f}=p.useChaiUserInfo(P),u=f&&j!==P?f==null?void 0:f.name:null,w=p.useFallbackLang(),k=a===e.id,F=!!e.isTemplate,g=o.useMemo(()=>n.find(r,{key:e.pageType}),[r,e.pageType]);let h=n.get(c,e==null?void 0:e.id);h=n.get(h,"lang")===l?h:null;const E=l===w||!!h,T=(h==null?void 0:h.name)||(e==null?void 0:e.name)||"No name";let v=(h==null?void 0:h.slug)||(e==null?void 0:e.slug)||"";const $=v+(e!=null&&e.dynamic?`/${g==null?void 0:g.dynamicSlug}`:"")+(e!=null&&e.dynamicSlugCustom?`${e.dynamicSlugCustom}`:"");if(v.startsWith("/")&&!y){const d=v.split("/").pop();v=v.endsWith(d)&&e.dynamic?"":`/${d}`}const q=o.useMemo(()=>{const d="flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]",C=`${k?"border-primary/30 bg-primary/5":"border-transparent hover:border-gray-200 hover:bg-gray-100"}`;return E?`${d} ${C} ${u?"opacity-60":""}`:`${d} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`},[E,k,u]),z=o.useMemo(()=>{if(e.isPartialGroup)return!1;if(h){if(!h.online||n.isEmpty(h.changes))return!1}else if(e&&(!e.online||n.isEmpty(e.changes)))return!1;return!0},[h,e]);return t.jsxs("div",{className:"group relative",children:[t.jsx(me,{pageId:e.id,children:t.jsxs("div",{onClick:()=>!e.isPartialGroup&&E&&s("select",e==null?void 0:e.id),className:q,children:[t.jsx(he,{page:e}),!e.isPartialGroup&&t.jsx(fe,{isOnline:h?h.online:e.online}),!e.isPartialGroup&&t.jsx(xe,{page:e,pageType:g}),t.jsx(p.Tooltip,{content:T,side:"top",showTooltip:T.length>35,children:t.jsx("span",{className:"max-w-[40%] truncate font-medium text-black",children:T})}),(v||e.dynamic)&&t.jsx(p.Tooltip,{content:$,side:"top",showTooltip:!0,children:t.jsxs("span",{className:"max-w-[40%] truncate font-mono text-xs text-muted-foreground",children:[v,e.dynamic&&(g==null?void 0:g.dynamicSlug)&&t.jsxs("span",{className:"text-xs text-gray-500",children:["/",g==null?void 0:g.dynamicSlug,e.dynamicSlugCustom]})]})}),z&&t.jsx(p.Tooltip,{content:"Has unpublished changes",side:"top",children:t.jsx("span",{className:"text-amber-500",children:t.jsx(S.Pencil,{size:12,className:"stroke-[2]"})})}),F&&t.jsx(p.Tooltip,{content:"Template",side:"top",children:t.jsx("span",{className:"text-blue-500",children:t.jsx(S.NotepadText,{size:16})})}),!e.isPartialGroup&&E&&!u?t.jsx("div",{className:"duration absolute right-0.5 top-[3px]",children:t.jsx(p.PageActionsDropdown,{isLanguagePage:!!h,page:h||e,setDuplicatePage:d=>s("duplicate",d),setAddEditPage:d=>s("edit",h||d),setUnpublishPage:d=>s("unpublish",d),setDeletePage:d=>s("delete",h||d),setMarkAsTemplate:d=>s("markAsTemplate",d),setUnmarkAsTemplate:d=>s("unmarkAsTemplate",d),children:t.jsx("div",{className:"m-0 cursor-pointer rounded border border-transparent p-0.5 duration-100 hover:border-gray-400 hover:bg-white",children:t.jsx(S.MoreHorizontal,{className:"h-4 w-4",onClick:d=>d.stopPropagation()})})})}):u?t.jsx("span",{className:"duration absolute right-1.5 top-1/2 -translate-y-1/2 text-xs text-gray-500",children:t.jsx(S.Lock,{className:"h-3.5 w-3.5 fill-red-200 text-red-500"})}):null]})}),t.jsx(t.Fragment,{children:u&&t.jsxs("button",{className:"absolute right-px top-1/2 flex h-6 -translate-y-1/2 items-center gap-x-1 rounded bg-red-50 px-2 py-0.5 text-xs font-light text-red-500 opacity-0 group-hover:opacity-100",children:[t.jsx(S.Edit,{size:12,className:"stroke-[3]"})," ",t.jsx("span",{className:"font-medium",children:u})," is editing this page"]})}),t.jsx(t.Fragment,{children:!E&&!e.isPartialGroup&&!u&&t.jsxs("button",{onClick:d=>{d.stopPropagation(),s("addLanguagePage",{language:l,page:e})},className:"absolute left-1/2 top-1 flex -translate-x-1/2 items-center gap-x-1 rounded bg-blue-500 px-2 py-0.5 text-xs text-white opacity-0 duration-200 hover:bg-blue-700 group-hover:opacity-100",children:[t.jsx(S.Plus,{size:12,className:"stroke-[3]"})," ",t.jsxs("span",{className:"text-[10px]",children:["Add ",n.get(p.LANGUAGES,l)," Page"]})]})})]})},te=({pages:e,tier:r,pageTypes:a,currentPage:s,onClickAction:c,languagePages:l,selectedLanguage:y,showUntranslatedPages:j})=>{const{expandedPages:m}=G.usePageExpandManager();return t.jsx("div",{className:"space-y-0.5",style:{paddingLeft:`${r*10}px`},children:e.map(P=>t.jsxs(t.Fragment,{children:[t.jsx(pe,{page:P,pageTypes:a,currentPage:s,onClickAction:c,languagePages:l,selectedLanguage:y,showUntranslatedPages:j}),P.children&&P.children.length>0&&(m==null?void 0:m.includes(P.id))&&t.jsx(te,{pages:P.children,tier:r+1,pageTypes:a,currentPage:s,onClickAction:c,languagePages:l,selectedLanguage:y,showUntranslatedPages:j})]},P.id))})},ye=o.lazy(()=>Promise.resolve().then(()=>require("./page-manager-search-and-filter-jDoLrCB7.cjs"))),Pe=o.lazy(()=>Promise.resolve().then(()=>require("./add-new-page-BfKt72NF.cjs"))),we=o.lazy(()=>Promise.resolve().then(()=>require("./delete-page-CdByrw3j.cjs"))),ge=o.lazy(()=>Promise.resolve().then(()=>require("./duplicate-page-D2f3HvWX.cjs"))),je=o.lazy(()=>Promise.resolve().then(()=>require("./mark-as-template-DS-tMllK.cjs"))),be=o.lazy(()=>Promise.resolve().then(()=>require("./unmark-as-template-q1GblG-u.cjs"))),Se=o.lazy(()=>Promise.resolve().then(()=>require("./unpublish-page-DMbcHmUV.cjs"))),ke=({close:e})=>{const{t:r}=oe.useTranslation(),{languages:a,setSelectedLang:s}=K.useLanguages(),{data:c}=p.usePageTypes(),{data:l,isFetching:y}=p.useWebsitePages(),[j,m]=p.useSearchParams(),{updateForSelectedPage:P,expandPagesOnSearch:f}=G.usePageExpandManager(null),u=p.useFallbackLang(),w=j.get("page"),[k,F]=o.useState(""),[g,h]=o.useState(null),[E,T]=o.useState(null),[v,$]=o.useState(null),[q,z]=o.useState(null),[d,C]=o.useState(""),[D,W]=o.useState(null),[H,_]=o.useState(null),[b,I]=o.useState(u),[se,ne]=o.useState(!1),V=R.useSetAtom(p.addNewLangAtom),U=se&&b!==u,{data:A,isFetching:re}=p.useWebsiteLanguagePages(b),Q=o.useCallback(x=>{var i;return(i=n.find(c,{key:x}))==null?void 0:i.hasSlug},[c]),N=o.useMemo(()=>l?U?n.filter(l,x=>!(A!=null&&A[x.id])):de(l,k,d,Q):[],[l,Q,k,d,A,U]);o.useEffect(()=>{s(u)},[u,s]),o.useEffect(()=>{const x=j.get("lang");if(x){const i=a,L=a[0]??u,M=i.includes(x);o.startTransition(()=>{M&&b!==x?I(x):!M&&b!==L&&I(L)})}},[]),o.useEffect(()=>{if(!n.isEmpty(d))return;const x=sessionStorage.getItem("pageTypeFilter")||"all";!n.isEmpty(c)&&x&&(n.find(c,{key:x})?C(x):C("all"))},[c,d]),o.useEffect(()=>{if(w&&!y&&!n.find(l,{id:w})){const i=new URLSearchParams(j.toString());if(i.delete("page"),[...i.keys()].length>0){if(typeof window<"u"&&window.history&&window.location){const L=i.toString(),M=window.location.hash||"",J=window.location.pathname,ae=L?`${J}?${L}${M}`:`${J}${M}`;window.history.replaceState(window.history.state,"",ae)}m(i)}else typeof window<"u"&&window.history&&window.location&&(window.history.replaceState(window.history.state,"",window.location.pathname+window.location.hash),window.dispatchEvent(new PopStateEvent("popstate",{state:window.history.state}))),m(i)}},[l,w,y,m]),o.useEffect(()=>{w&&!y&&!n.isEmpty(N)&&P(N,w)},[w,y,N,P]),o.useEffect(()=>{!n.isEmpty(k)&&!n.isEmpty(N)&&f(N)},[k,N,f]);const{setSelectedLang:B}=K.useLanguages(),X=o.useCallback(x=>{const i=new URLSearchParams({page:x});b!==u?(i.set("lang",b),B(b)):B(""),p.navigateToPage(i,m),e()},[e,m,B,b,u]),Y=(x,i)=>{var L;if(i)switch(x){case"add":T(i);break;case"select":X(i);break;case"edit":b!==u?V({edit:!0,id:i==null?void 0:i.id,primaryPage:i==null?void 0:i.primaryPage}):T(i);break;case"delete":h(i);break;case"unpublish":$(i);break;case"markAsTemplate":z(i);break;case"unmarkAsTemplate":_(i);break;case"duplicate":W(i);break;case"addLanguagePage":V({edit:!1,primaryPage:((L=i==null?void 0:i.page)==null?void 0:L.id)||"",preselectedLang:(i==null?void 0:i.language)||b});break}};return t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:"flex h-full flex-col justify-between",children:[t.jsx(o.Suspense,{children:t.jsx(ye,{pages:N,search:k,setSearch:F,languages:[u,...a],selectedLanguage:b,setSelectedLanguage:I,selectedPageType:d,setSelectedPageType:C,onAddPage:x=>Y("add",x),showUntranslatedPages:U,setShowUntranslatedPages:ne})}),t.jsx("div",{className:"flex-1 overflow-y-auto px-4 pb-6 pt-2",children:y||re?t.jsx("div",{className:"space-y-2",children:n.map([...Array(15).keys()],x=>t.jsx("div",{className:"h-7 w-full animate-pulse rounded border border-gray-300 bg-gray-200"},x))}):n.isEmpty(N)?t.jsxs("div",{className:"flex h-[70vh] flex-col items-center justify-center gap-y-1 text-sm font-medium text-slate-500",children:[t.jsx(S.File,{className:"h-6 w-6 stroke-[1]"}),r("Empty List!"),t.jsx("span",{className:"font-light",children:r("Add new page to start")})]}):t.jsx(te,{tier:0,pages:N,pageTypes:c,currentPage:w||"",onClickAction:Y,languagePages:A,selectedLanguage:b,showUntranslatedPages:U})})]}),E&&t.jsx(o.Suspense,{children:t.jsx(Pe,{closePanel:e,editPage:X,addEditPage:E,setAddEditPage:T})}),g&&t.jsx(o.Suspense,{children:t.jsx(we,{page:g,onClose:()=>h(null)})}),v&&t.jsx(o.Suspense,{children:t.jsx(Se,{page:v,onClose:()=>$(null)})}),q&&t.jsx(o.Suspense,{children:t.jsx(je,{page:q,onClose:()=>z(null)})}),H&&t.jsx(o.Suspense,{children:t.jsx(be,{page:H,onClose:()=>_(null)})}),D&&t.jsx(o.Suspense,{children:t.jsx(ge,{page:D,onClose:()=>W(null),closePanel:e})})]})};exports.default=ke;
@@ -1,22 +1,22 @@
1
1
  import { jsx as e, jsxs as a, Fragment as k } from "react/jsx-runtime";
2
2
  import { B as m, z as E } from "./register-chai-top-bar-D6GjnauV.js";
3
- import { x as g, y as b, z as y, S as L, A as F, B as I, E as N } from "./index-BFnMzGe6.js";
4
- import { k as j, L as T, m as $, A as B } from "./index-CA1OwKJX.js";
3
+ import { x as g, y as b, z as y, S as F, A as L, B as I, E as N } from "./index-DsQXiNA_.js";
4
+ import { k as j, L as T, m as $, A as B } from "./index-IQefjAA0.js";
5
5
  import { u as G } from "./use-page-expand-manager-Cf4MUEJw.js";
6
6
  import { useQueryClient as D } from "@tanstack/react-query";
7
- import { isEmpty as w, filter as x, map as S, get as o } from "lodash-es";
7
+ import { isEmpty as w, filter as x, map as S, get as i } from "lodash-es";
8
8
  import { Star as M, Plus as R, FilterXIcon as W, Filter as q, ListFilter as K, Search as P, ChevronsUpDown as Q, ChevronsDownUp as _, RefreshCw as O } from "lucide-react";
9
9
  import { useState as U } from "react";
10
10
  import { useTranslation as f } from "react-i18next";
11
11
  const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
12
- const { t: l } = f(), [r, i] = U(""), { data: c } = $(), h = (t) => {
12
+ const { t: l } = f(), [r, o] = U(""), { data: c } = $(), h = (t) => {
13
13
  if (!r) return !0;
14
- const d = r.toLowerCase(), u = (v) => String(o(t, v, "")).toLowerCase().includes(d);
14
+ const d = r.toLowerCase(), u = (v) => String(i(t, v, "")).toLowerCase().includes(d);
15
15
  return u("name") || u("key");
16
16
  }, p = c.find((t) => t.key === n);
17
- return /* @__PURE__ */ a(L, { onValueChange: s, value: n, children: [
17
+ return /* @__PURE__ */ a(F, { onValueChange: s, value: n, children: [
18
18
  /* @__PURE__ */ e(
19
- F,
19
+ L,
20
20
  {
21
21
  className: `${n === "all" ? "bg-gray-100/30 hover:bg-gray-100" : "gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,
22
22
  children: /* @__PURE__ */ a("div", { className: "flex w-full items-center justify-between gap-x-1.5", children: [
@@ -39,7 +39,7 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
39
39
  placeholder: l("Search page types..."),
40
40
  className: "h-8 w-full rounded border pl-8 text-xs shadow-none",
41
41
  value: r,
42
- onChange: (t) => i(t.target.value),
42
+ onChange: (t) => o(t.target.value),
43
43
  onKeyDown: (t) => t.stopPropagation()
44
44
  }
45
45
  )
@@ -49,18 +49,18 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
49
49
  /* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: l("Pages") }),
50
50
  S(
51
51
  [...x(c, (t) => t.hasSlug && h(t))].sort(
52
- (t, d) => o(t, "name", "").localeCompare(o(d, "name", ""))
52
+ (t, d) => i(t, "name", "").localeCompare(i(d, "name", ""))
53
53
  ),
54
- (t) => /* @__PURE__ */ e(N, { value: o(t, "key"), children: o(t, "name") }, o(t, "key"))
54
+ (t) => /* @__PURE__ */ e(N, { value: i(t, "key"), children: i(t, "name") }, i(t, "key"))
55
55
  )
56
56
  ] }),
57
57
  !w(x(c, (t) => !t.hasSlug && h(t))) && /* @__PURE__ */ a(k, { children: [
58
58
  /* @__PURE__ */ e("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: l("Partials") }),
59
59
  S(
60
60
  [...x(c, (t) => !t.hasSlug && h(t))].sort(
61
- (t, d) => o(t, "name", "").localeCompare(o(d, "name", ""))
61
+ (t, d) => i(t, "name", "").localeCompare(i(d, "name", ""))
62
62
  ),
63
- (t) => /* @__PURE__ */ e(N, { value: o(t, "key"), children: o(t, "name") }, o(t, "key"))
63
+ (t) => /* @__PURE__ */ e(N, { value: i(t, "key"), children: i(t, "name") }, i(t, "key"))
64
64
  )
65
65
  ] }),
66
66
  w(x(c, h)) && /* @__PURE__ */ e("div", { className: "px-3 py-2 text-center text-sm text-gray-500", children: l("No matching page types found") })
@@ -85,12 +85,13 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
85
85
  value: n,
86
86
  onChange: (r) => s(r.target.value),
87
87
  className: "border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",
88
- autoComplete: "off"
88
+ autoComplete: "off",
89
+ autoFocus: !0
89
90
  }
90
91
  )
91
92
  ] });
92
93
  }, H = ({ pages: n }) => {
93
- const { t: s } = f(), { expandAll: l, collapseAll: r, expandedPages: i } = G(null);
94
+ const { t: s } = f(), { expandAll: l, collapseAll: r, expandedPages: o } = G(null);
94
95
  return /* @__PURE__ */ a("div", { className: "flex gap-1", children: [
95
96
  /* @__PURE__ */ a(g, { children: [
96
97
  /* @__PURE__ */ e(b, { asChild: !0, children: /* @__PURE__ */ e(m, { variant: "outline", size: "icon", onClick: () => l(n), className: "rounded p-1 text-gray-500", children: /* @__PURE__ */ e(Q, {}) }) }),
@@ -100,7 +101,7 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
100
101
  /* @__PURE__ */ e(b, { asChild: !0, children: /* @__PURE__ */ e(
101
102
  m,
102
103
  {
103
- disabled: i.length === 0,
104
+ disabled: o.length === 0,
104
105
  variant: "outline",
105
106
  size: "icon",
106
107
  onClick: () => r(),
@@ -113,19 +114,19 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
113
114
  ] });
114
115
  }, J = ({ languages: n, selectedLanguage: s, setSelectedLanguage: l }) => {
115
116
  const r = j();
116
- return /* @__PURE__ */ e("div", { className: "scrollbar-hide flex gap-1 overflow-x-auto pb-1", children: n.map((i) => /* @__PURE__ */ a(
117
+ return /* @__PURE__ */ e("div", { className: "scrollbar-hide flex gap-1 overflow-x-auto pb-1", children: n.map((o) => /* @__PURE__ */ a(
117
118
  m,
118
119
  {
119
- variant: s === i ? "default" : "outline",
120
+ variant: s === o ? "default" : "outline",
120
121
  size: "sm",
121
- className: `h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${s === i ? "bg-black text-white hover:bg-black" : "text-gray-500"}`,
122
- onClick: () => l(i.toLowerCase()),
122
+ className: `h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${s === o ? "bg-black text-white hover:bg-black" : "text-gray-500"}`,
123
+ onClick: () => l(o.toLowerCase()),
123
124
  children: [
124
- i === r && /* @__PURE__ */ e(M, { size: 4, className: `p-0.5 ${s === r ? "fill-white" : "fill-black"}` }),
125
- T[i] || ""
125
+ o === r && /* @__PURE__ */ e(M, { size: 4, className: `p-0.5 ${s === r ? "fill-white" : "fill-black"}` }),
126
+ T[o] || ""
126
127
  ]
127
128
  },
128
- i
129
+ o
129
130
  )) });
130
131
  }, A = () => {
131
132
  const { t: n } = f(), s = D();
@@ -142,12 +143,12 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
142
143
  ) }),
143
144
  /* @__PURE__ */ e(y, { side: "bottom", children: n("Refresh pages list") })
144
145
  ] });
145
- }, oe = ({
146
+ }, ie = ({
146
147
  pages: n,
147
148
  search: s,
148
149
  setSearch: l,
149
150
  languages: r,
150
- onAddPage: i,
151
+ onAddPage: o,
151
152
  selectedLanguage: c,
152
153
  setSelectedLanguage: h,
153
154
  selectedPageType: p,
@@ -161,7 +162,7 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
161
162
  /* @__PURE__ */ e(V, { selectedPageType: p, setSelectedPageType: t }),
162
163
  /* @__PURE__ */ e(X, { search: s, setSearch: l }),
163
164
  /* @__PURE__ */ e(H, { pages: n }),
164
- /* @__PURE__ */ a(m, { variant: "default", onClick: i, className: "rounded px-3 font-normal", children: [
165
+ /* @__PURE__ */ a(m, { variant: "default", onClick: o, className: "rounded px-3 font-normal", children: [
165
166
  /* @__PURE__ */ e(R, { strokeWidth: 2, className: "stroke-white stroke-[3]" }),
166
167
  /* @__PURE__ */ e("span", { className: "font-normal text-white", children: v("Add Page") })
167
168
  ] }),
@@ -198,5 +199,5 @@ const V = ({ selectedPageType: n, setSelectedPageType: s }) => {
198
199
  };
199
200
  export {
200
201
  J as LanguageSelector,
201
- oe as default
202
+ ie as default
202
203
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-D30xvFa5.cjs"),f=require("./index-Bzn_gpaK.cjs"),w=require("./use-page-expand-manager-B6XTvk0E.cjs"),C=require("@tanstack/react-query"),s=require("lodash-es"),d=require("lucide-react"),S=require("react"),g=require("react-i18next"),k=({selectedPageType:l,setSelectedPageType:i})=>{const{t:a}=g.useTranslation(),[r,o]=S.useState(""),{data:c}=f.usePageTypes(),u=t=>{if(!r)return!0;const x=r.toLowerCase(),m=j=>String(s.get(t,j,"")).toLowerCase().includes(x);return m("name")||m("key")},p=c.find(t=>t.key===l);return e.jsxs(n.Select,{onValueChange:i,value:l,children:[e.jsx(n.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(p==null?void 0:p.name)||a("All")}),e.jsx(d.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(n.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(d.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(h.Input,{placeholder:a("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:r,onChange:t=>o(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(n.SelectItem,{value:"all",children:a("All")}),!s.isEmpty(s.filter(c,t=>t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Pages")}),s.map([...s.filter(c,t=>t.hasSlug&&u(t))].sort((t,x)=>s.get(t,"name","").localeCompare(s.get(x,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),!s.isEmpty(s.filter(c,t=>!t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Partials")}),s.map([...s.filter(c,t=>!t.hasSlug&&u(t))].sort((t,x)=>s.get(t,"name","").localeCompare(s.get(x,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),s.isEmpty(s.filter(c,u))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:a("No matching page types found")})]})]})},T=({search:l,setSearch:i})=>{const{t:a}=g.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:a("Search Pages")}),e.jsx(d.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(h.Input,{id:"page-search-input",placeholder:a("Search pages"),value:l,onChange:r=>i(r.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off"})]})},E=({pages:l})=>{const{t:i}=g.useTranslation(),{expandAll:a,collapseAll:r,expandedPages:o}=w.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"outline",size:"icon",onClick:()=>a(l),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsUpDown,{})})}),e.jsx(n.TooltipContent,{children:i("Expand All")})]}),e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{disabled:o.length===0,variant:"outline",size:"icon",onClick:()=>r(),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsDownUp,{})})}),e.jsx(n.TooltipContent,{children:i("Collapse All")})]})]})},b=({languages:l,selectedLanguage:i,setSelectedLanguage:a})=>{const r=f.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(o=>e.jsxs(h.Button,{variant:i===o?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${i===o?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>a(o.toLowerCase()),children:[o===r&&e.jsx(d.Star,{size:4,className:`p-0.5 ${i===r?"fill-white":"fill-black"}`}),f.LANGUAGES[o]||""]},o))})},y=()=>{const{t:l}=g.useTranslation(),i=C.useQueryClient();return e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{size:"sm",variant:"ghost",onClick:()=>i.invalidateQueries({queryKey:[f.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(d.RefreshCw,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},q=({pages:l,search:i,setSearch:a,languages:r,onAddPage:o,selectedLanguage:c,setSelectedLanguage:u,selectedPageType:p,setSelectedPageType:t,showUntranslatedPages:x,setShowUntranslatedPages:m})=>{const{t:j}=g.useTranslation(),v=r.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(k,{selectedPageType:p,setSelectedPageType:t}),e.jsx(T,{search:i,setSearch:a}),e.jsx(E,{pages:l}),e.jsxs(h.Button,{variant:"default",onClick:o,className:"rounded px-3 font-normal",children:[e.jsx(d.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:j("Add Page")})]}),!v&&e.jsx(y,{})]}),v?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(b,{languages:r,selectedLanguage:c,setSelectedLanguage:N=>{u(N),m(x&&(r==null?void 0:r[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(r==null?void 0:r[0])!==c&&e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"ghost",onClick:()=>m(!x),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:x?e.jsx(d.FilterXIcon,{}):e.jsx(d.Filter,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:j("Toggle Untranslated Pages")})]}),e.jsx(y,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=b;exports.default=q;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),h=require("./register-chai-top-bar-DyW9GPzV.cjs"),n=require("./index-mPCp0j2h.cjs"),f=require("./index-Bzyv7mAh.cjs"),w=require("./use-page-expand-manager-B6XTvk0E.cjs"),C=require("@tanstack/react-query"),s=require("lodash-es"),d=require("lucide-react"),S=require("react"),g=require("react-i18next"),k=({selectedPageType:l,setSelectedPageType:i})=>{const{t:a}=g.useTranslation(),[r,o]=S.useState(""),{data:c}=f.usePageTypes(),u=t=>{if(!r)return!0;const x=r.toLowerCase(),m=j=>String(s.get(t,j,"")).toLowerCase().includes(x);return m("name")||m("key")},p=c.find(t=>t.key===l);return e.jsxs(n.Select,{onValueChange:i,value:l,children:[e.jsx(n.SelectTrigger,{className:`${l==="all"?"bg-gray-100/30 hover:bg-gray-100":"gap-x-1 border bg-gray-100/30 hover:bg-gray-100"} h-9 w-max min-w-[150px] overflow-hidden whitespace-nowrap rounded p-0 px-2 py-1 text-xs text-gray-600 shadow-none ring-0 focus:ring-0 [&>svg]:hidden`,children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-x-1.5",children:[e.jsx("span",{className:"max-w-[150px] overflow-hidden truncate whitespace-nowrap font-medium leading-tight",children:(p==null?void 0:p.name)||a("All")}),e.jsx(d.ListFilter,{className:`${l!=="all"?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground hover:bg-blue-300`})]})}),e.jsxs(n.SelectContent,{children:[e.jsx("div",{className:"sticky top-0 z-10 bg-white pb-2",children:e.jsxs("div",{className:"relative",children:[e.jsx(d.Search,{strokeWidth:2,className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-gray-400"}),e.jsx(h.Input,{placeholder:a("Search page types..."),className:"h-8 w-full rounded border pl-8 text-xs shadow-none",value:r,onChange:t=>o(t.target.value),onKeyDown:t=>t.stopPropagation()})]})}),e.jsx(n.SelectItem,{value:"all",children:a("All")}),!s.isEmpty(s.filter(c,t=>t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Pages")}),s.map([...s.filter(c,t=>t.hasSlug&&u(t))].sort((t,x)=>s.get(t,"name","").localeCompare(s.get(x,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),!s.isEmpty(s.filter(c,t=>!t.hasSlug&&u(t)))&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500",children:a("Partials")}),s.map([...s.filter(c,t=>!t.hasSlug&&u(t))].sort((t,x)=>s.get(t,"name","").localeCompare(s.get(x,"name",""))),t=>e.jsx(n.SelectItem,{value:s.get(t,"key"),children:s.get(t,"name")},s.get(t,"key")))]}),s.isEmpty(s.filter(c,u))&&e.jsx("div",{className:"px-3 py-2 text-center text-sm text-gray-500",children:a("No matching page types found")})]})]})},T=({search:l,setSearch:i})=>{const{t:a}=g.useTranslation();return e.jsxs("div",{className:"relative flex h-9 flex-1 items-center gap-2 rounded-md border px-2.5",children:[e.jsx("label",{htmlFor:"page-search-input",className:"sr-only",children:a("Search Pages")}),e.jsx(d.Search,{className:`${l?"fill-sky-50 text-sky-500":""} pointer-events-none h-4 w-4 text-muted-foreground`,"aria-hidden":"true"}),e.jsx(h.Input,{id:"page-search-input",placeholder:a("Search pages"),value:l,onChange:r=>i(r.target.value),className:"border-none px-1.5 shadow-none outline-none ring-0 transition-none focus:outline-none focus:ring-0 focus-visible:ring-0",autoComplete:"off",autoFocus:!0})]})},E=({pages:l})=>{const{t:i}=g.useTranslation(),{expandAll:a,collapseAll:r,expandedPages:o}=w.usePageExpandManager(null);return e.jsxs("div",{className:"flex gap-1",children:[e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"outline",size:"icon",onClick:()=>a(l),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsUpDown,{})})}),e.jsx(n.TooltipContent,{children:i("Expand All")})]}),e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{disabled:o.length===0,variant:"outline",size:"icon",onClick:()=>r(),className:"rounded p-1 text-gray-500",children:e.jsx(d.ChevronsDownUp,{})})}),e.jsx(n.TooltipContent,{children:i("Collapse All")})]})]})},b=({languages:l,selectedLanguage:i,setSelectedLanguage:a})=>{const r=f.useFallbackLang();return e.jsx("div",{className:"scrollbar-hide flex gap-1 overflow-x-auto pb-1",children:l.map(o=>e.jsxs(h.Button,{variant:i===o?"default":"outline",size:"sm",className:`h-6 flex-shrink-0 whitespace-nowrap rounded px-3 text-xs font-normal ${i===o?"bg-black text-white hover:bg-black":"text-gray-500"}`,onClick:()=>a(o.toLowerCase()),children:[o===r&&e.jsx(d.Star,{size:4,className:`p-0.5 ${i===r?"fill-white":"fill-black"}`}),f.LANGUAGES[o]||""]},o))})},y=()=>{const{t:l}=g.useTranslation(),i=C.useQueryClient();return e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{size:"sm",variant:"ghost",onClick:()=>i.invalidateQueries({queryKey:[f.ACTIONS.GET_WEBSITE_PAGES]}),className:"mt-1 h-6 w-6",children:e.jsx(d.RefreshCw,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:l("Refresh pages list")})]})},q=({pages:l,search:i,setSearch:a,languages:r,onAddPage:o,selectedLanguage:c,setSelectedLanguage:u,selectedPageType:p,setSelectedPageType:t,showUntranslatedPages:x,setShowUntranslatedPages:m})=>{const{t:j}=g.useTranslation(),v=r.length>1;return e.jsxs("div",{className:"space-y-3 border-b border-b-gray-200 px-4 pb-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx(k,{selectedPageType:p,setSelectedPageType:t}),e.jsx(T,{search:i,setSearch:a}),e.jsx(E,{pages:l}),e.jsxs(h.Button,{variant:"default",onClick:o,className:"rounded px-3 font-normal",children:[e.jsx(d.Plus,{strokeWidth:2,className:"stroke-white stroke-[3]"}),e.jsx("span",{className:"font-normal text-white",children:j("Add Page")})]}),!v&&e.jsx(y,{})]}),v?e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx(b,{languages:r,selectedLanguage:c,setSelectedLanguage:N=>{u(N),m(x&&(r==null?void 0:r[0])!==c)}}),e.jsxs("div",{className:"flex items-center gap-x-2",children:[(r==null?void 0:r[0])!==c&&e.jsxs(n.Tooltip,{children:[e.jsx(n.TooltipTrigger,{asChild:!0,children:e.jsx(h.Button,{variant:"ghost",onClick:()=>m(!x),className:"h-6 rounded px-3 py-1 text-xs font-normal",children:x?e.jsx(d.FilterXIcon,{}):e.jsx(d.Filter,{})})}),e.jsx(n.TooltipContent,{side:"bottom",children:j("Toggle Untranslated Pages")})]}),e.jsx(y,{})]})]}):e.jsx("div",{className:"flex items-center justify-between gap-2"})]})};exports.LanguageSelector=b;exports.default=q;