@chaibuilder/pages 0.14.4 → 0.15.0

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 (68) hide show
  1. package/dist/{2AITGKQY-DWDDkd18.cjs → 2AITGKQY-CpxlNmec.cjs} +1 -1
  2. package/dist/{2AITGKQY-DtQPkxBe.js → 2AITGKQY-gEvxLMa5.js} +2 -2
  3. package/dist/{NCMVHL6D-CksZXXOw.js → NCMVHL6D-DpycZ17L.js} +4 -4
  4. package/dist/{NCMVHL6D-6CkVnw0a.cjs → NCMVHL6D-sV6MElOb.cjs} +1 -1
  5. package/dist/{ZDWCUMSJ-DoM-AA0C.cjs → ZDWCUMSJ-BPT9OZay.cjs} +1 -1
  6. package/dist/{ZDWCUMSJ-BXQ01VPt.js → ZDWCUMSJ-BbzwbqTE.js} +1 -1
  7. package/dist/{add-new-language-page-BA73lQnm.cjs → add-new-language-page-B4_z4O8a.cjs} +1 -1
  8. package/dist/{add-new-language-page-D8iXtyLA.js → add-new-language-page-C8LIaHl6.js} +2 -2
  9. package/dist/{add-new-page-EOMgMSeq.cjs → add-new-page-CQRr6Z8g.cjs} +1 -1
  10. package/dist/{add-new-page-DESlqvED.js → add-new-page-JY6dRnC4.js} +1 -1
  11. package/dist/{delete-page-BP1Df8QL.js → delete-page-Dfa2vyQB.js} +1 -1
  12. package/dist/{delete-page-ZvnuEow6.cjs → delete-page-z88W-Ikh.cjs} +1 -1
  13. package/dist/{digital-asset-manager-BxWb1j_y.cjs → digital-asset-manager-Zh-mlMF5.cjs} +1 -1
  14. package/dist/{digital-asset-manager-Bb81T3mS.js → digital-asset-manager-hqMwBWhb.js} +146 -146
  15. package/dist/{duplicate-page-B1j0H7gP.js → duplicate-page-B0urG1pP.js} +8 -8
  16. package/dist/{duplicate-page-W5xbmPSC.cjs → duplicate-page-Welcro7Y.cjs} +1 -1
  17. package/dist/{dynamic-page-selector-Crjyco6l.js → dynamic-page-selector-CyhZ0SRO.js} +1 -1
  18. package/dist/{dynamic-page-selector-BZKJmSx5.cjs → dynamic-page-selector-Dn_j_r-h.cjs} +1 -1
  19. package/dist/index-BSEA_u0X.js +4854 -0
  20. package/dist/index-MlpQJHWW.cjs +5 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.ts +10 -14
  23. package/dist/index.js +17 -18
  24. package/dist/{json-diff-viewer-DRkE-x_z.cjs → json-diff-viewer-BIJ4iNWb.cjs} +1 -1
  25. package/dist/{json-diff-viewer-BGGSLqtx.js → json-diff-viewer-DVlb4YWD.js} +6 -6
  26. package/dist/{lang-panel-B3tr2uhr.js → lang-panel-D0IN38gF.js} +29 -29
  27. package/dist/{lang-panel-9T8dIx2p.cjs → lang-panel-l6Teik-4.cjs} +1 -1
  28. package/dist/{mark-as-template-L9cHzL84.js → mark-as-template-B22EANHN.js} +1 -1
  29. package/dist/{mark-as-template-DPVPRgbi.cjs → mark-as-template-DBPJ1gIK.cjs} +1 -1
  30. package/dist/{no-language-page-content-Cy_D-3jE.cjs → no-language-page-content-BUHXqSKG.cjs} +1 -1
  31. package/dist/{no-language-page-content-DP7gmy0s.js → no-language-page-content-DNNu8wd0.js} +1 -1
  32. package/dist/{page-creator-Ctn5ixJE.js → page-creator-BPgx7zdJ.js} +2 -2
  33. package/dist/{page-creator-DDaI1HYj.cjs → page-creator-DbN3Nvq6.cjs} +1 -1
  34. package/dist/{page-lock-request-BKrxnEtQ.cjs → page-lock-request-BFkpw5VN.cjs} +1 -1
  35. package/dist/{page-lock-request-CjJFJKL2.js → page-lock-request-Br9S1AsA.js} +1 -1
  36. package/dist/{page-locked-by-dialog-b25_rn2m.cjs → page-locked-by-dialog-2h8cv1tO.cjs} +1 -1
  37. package/dist/{page-locked-by-dialog-DmsSmAY2.js → page-locked-by-dialog-DyLcMu33.js} +1 -1
  38. package/dist/{page-manager-new-EsIg6iQn.js → page-manager-new-B2oBm4pU.js} +28 -28
  39. package/dist/{page-manager-new-DiZVY7Me.cjs → page-manager-new-CAj6WV-C.cjs} +1 -1
  40. package/dist/{page-manager-search-and-filter-CgY2qiXU.cjs → page-manager-search-and-filter-CWMXLTqE.cjs} +1 -1
  41. package/dist/{page-manager-search-and-filter-Bt4T_dnB.js → page-manager-search-and-filter-WQYVXUAt.js} +2 -2
  42. package/dist/{page-revisions-content-DtI8CmtR.cjs → page-revisions-content-AMH8AxBU.cjs} +1 -1
  43. package/dist/{page-revisions-content-CsT6aF2I.js → page-revisions-content-DM-ngq3R.js} +7 -7
  44. package/dist/{publish-pages-content-KAuhOPv0.js → publish-pages-content-Dast4sG6.js} +12 -12
  45. package/dist/{publish-pages-content-DpC7RcTw.cjs → publish-pages-content-Dkv0Lok8.cjs} +1 -1
  46. package/dist/{save-to-lib-CeWaSQdB.js → save-to-lib-B5k0MVbW.js} +23 -23
  47. package/dist/{save-to-lib-BGpWGHJo.cjs → save-to-lib-DWtmtrUj.cjs} +1 -1
  48. package/dist/{seo-panel-Dhhpe_7z.js → seo-panel-D75jQH_j.js} +1 -1
  49. package/dist/{seo-panel-JDQ_7bOx.cjs → seo-panel-dBvEEfi9.cjs} +1 -1
  50. package/dist/{shared-json-ld-BYbdMttx.cjs → shared-json-ld-BvWyXBz_.cjs} +1 -1
  51. package/dist/{shared-json-ld-BliIbNv9.js → shared-json-ld-ZtwsYt9H.js} +1 -1
  52. package/dist/{slug-input-hJdU8DaF.js → slug-input-BEegJ8bv.js} +1 -1
  53. package/dist/{slug-input-QxBMijHP.cjs → slug-input-BITq28nI.cjs} +1 -1
  54. package/dist/{theme-panel-footer-BZnPvTkM.cjs → theme-panel-footer-DcASH9l1.cjs} +1 -1
  55. package/dist/{theme-panel-footer-D2B7iYW2.js → theme-panel-footer-zLXS6SHh.js} +1 -1
  56. package/dist/{unmark-as-template-Byn2RRAp.cjs → unmark-as-template-ChmjL4-w.cjs} +1 -1
  57. package/dist/{unmark-as-template-Dcpkj7EZ.js → unmark-as-template-DXFRY_pc.js} +1 -1
  58. package/dist/{unpublish-page-5Fi1wKXb.cjs → unpublish-page-BxN0deJK.cjs} +1 -1
  59. package/dist/{unpublish-page-CPLlsfm4.js → unpublish-page-DMteaCpR.js} +1 -1
  60. package/dist/use-page-expand-manager-2KjeYfVS.cjs +1 -0
  61. package/dist/use-page-expand-manager-D6T75I11.js +184 -0
  62. package/dist/{web-preview-YuuoRaZn.js → web-preview-BDTdFQ2h.js} +1 -1
  63. package/dist/{web-preview-CVvxe5Ll.cjs → web-preview-DM11qhOe.cjs} +1 -1
  64. package/package.json +1 -1
  65. package/dist/index-DFvsMFVH.js +0 -5160
  66. package/dist/index-Qnh8Lkr0.cjs +0 -5
  67. package/dist/use-page-expand-manager-DkyBiNpx.js +0 -85
  68. package/dist/use-page-expand-manager-To-SsGy3.cjs +0 -1
@@ -0,0 +1,4854 @@
1
+ var yr = Object.defineProperty;
2
+ var Rn = (e) => {
3
+ throw TypeError(e);
4
+ };
5
+ var Ar = (e, t, n) => t in e ? yr(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
6
+ var Pe = (e, t, n) => Ar(e, typeof t != "symbol" ? t + "" : t, n), Un = (e, t, n) => t.has(e) || Rn("Cannot " + n);
7
+ var _ = (e, t, n) => (Un(e, t, "read from private field"), n ? n.call(e) : t.get(e)), L = (e, t, n) => t.has(e) ? Rn("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), N = (e, t, n, s) => (Un(e, t, "write to private field"), s ? s.call(e, n) : t.set(e, n), n);
8
+ import { jsx as c, jsxs as g, Fragment as me } from "react/jsx-runtime";
9
+ import { get as K, reverse as Tr, sortBy as Sr, each as _r, find as se, isEmpty as ge, groupBy as Pr, minBy as wr, noop as cs, keyBy as vr, map as Bt, compact as us, upperCase as Bn, filter as ds, includes as br, has as jt, pick as _n, keys as Ir, pickBy as Nr, endsWith as Cr, isArray as Lr, startCase as kr, isFunction as Dr, cloneDeep as Gr, isEqual as Or } from "lodash-es";
10
+ import * as j from "react";
11
+ import xr, { useMemo as Q, useCallback as H, useState as F, useEffect as ne, useRef as at, lazy as q, Suspense as V } from "react";
12
+ import { atom as pe, useAtom as te } from "jotai";
13
+ import { useQuery as ie, useQueryClient as Z, useMutation as ae, onlineManager as fs, QueryClient as Rr, QueryClientProvider as Ur } from "@tanstack/react-query";
14
+ import { useLanguages as Oe, useSavePage as Ge, mergeClasses as Mt, usePermissions as hs, PERMISSIONS as Br, useRightPanel as Mr, useChaiFeatureFlag as Fr, useIsPageLoaded as qr, registerChaiLibrary as Kr, getBlocksFromHTML as Vr, registerChaiSidebarPanel as en, registerChaiFeatureFlag as Mn, registerChaiTopBar as Hr, registerChaiMediaManager as $r, registerChaiSaveToLibrary as Qr, ChaiBuilderEditor as jr } from "@chaibuilder/sdk";
15
+ import { toast as W } from "sonner";
16
+ import { Tooltip as Wt, TooltipTrigger as zt, Button as U, TooltipContent as Yt, Sheet as gs, SheetContent as ms, SheetHeader as Wr, SheetTitle as zr, SheetDescription as Yr, DropdownMenu as Pn, DropdownMenuTrigger as wn, DropdownMenuContent as vn, DropdownMenuItem as fe, Separator as Jr, TooltipProvider as Es, SheetTrigger as Xr, Skeleton as Ct, Dialog as ps, HoverCard as Zr, HoverCardTrigger as ei, HoverCardContent as ti, AlertDialog as ni, AlertDialogTrigger as si, AlertDialogContent as ri, AlertDialogHeader as ii, AlertDialogTitle as ai, AlertDialogDescription as oi, AlertDialogFooter as li, AlertDialogCancel as ci, AlertDialogAction as ui, Popover as di, PopoverTrigger as fi, DialogContent as hi, DialogHeader as gi, DialogTitle as mi, Tabs as Ei, TabsList as pi, TabsTrigger as tn, TabsContent as nn, Textarea as Fn, Alert as yi, AlertDescription as Ai } from "@chaibuilder/sdk/ui";
17
+ import { LogsIcon as Ti, Folder as Si, Languages as qn, ChevronDown as dn, Star as _i, Plus as ys, History as Pi, Play as wi, Palette as vi, CheckCircle as bi, Loader as Ft, Save as Ii, Send as Kn, Rocket as Vn, CopyPlusIcon as Ni, Pencil as Ci, Power as Li, Trash as ki, SquareLibrary as Hn, Globe as Di, File as Gi, MoreHorizontal as $n, ExternalLink as Oi, LanguagesIcon as xi, User as Ri, X as Qn, Trash2 as Ui, ImageIcon as jn, Code as Bi, Eye as Mi, Share2 as Fi, FileCode2 as qi, AlertTriangle as Ki } from "lucide-react";
18
+ import { useRegisteredChaiBlocks as Vi, getDefaultBlockProps as Hi } from "@chaibuilder/runtime";
19
+ import { loadWebBlocks as $i } from "@chaibuilder/sdk/web-blocks";
20
+ const E = {
21
+ GENERATE_SEO_FIELD: "GENERATE_SEO_FIELD",
22
+ UPDATE_PAGE_METADATA: "UPDATE_PAGE_METADATA",
23
+ GET_BLOCK_ASYNC_PROPS: "GET_BLOCK_ASYNC_PROPS",
24
+ ASK_AI: "ASK_AI",
25
+ GET_DRAFT_PAGE: "GET_DRAFT_PAGE",
26
+ CREATE_PAGE: "CREATE_PAGE",
27
+ UPDATE_PAGE: "UPDATE_PAGE",
28
+ DELETE_PAGE: "DELETE_PAGE",
29
+ DUPLICATE_PAGE: "DUPLICATE_PAGE",
30
+ CHANGE_SLUG: "CHANGE_SLUG",
31
+ TAKE_OFFLINE: "TAKE_OFFLINE",
32
+ PUBLISH_PAGE: "PUBLISH_PAGE",
33
+ PUBLISH_CHANGES: "PUBLISH_CHANGES",
34
+ ADD_NEW_LANGUAGE: "ADD_NEW_LANGUAGE",
35
+ EDIT_LANGUAGE: "EDIT_LANGUAGE",
36
+ DELETE_LANGUAGE: "DELETE_LANGUAGE",
37
+ GET_CHANGES: "GET_CHANGES",
38
+ GET_SERVER_BLOCK: "GET_SERVER_BLOCK",
39
+ GET_LANGUAGE_PAGES: "GET_LANGUAGE_PAGES",
40
+ GET_PROJECT_PAGES: "GET_PROJECT_PAGES",
41
+ GET_WEBSITE_PAGES: "GET_WEBSITE_PAGES",
42
+ UPDATE_WEBSITE_SETTINGS: "UPDATE_WEBSITE_SETTINGS",
43
+ GET_COLLECTIONS: "GET_COLLECTIONS",
44
+ GET_PAGE_TYPES: "GET_PAGE_TYPES",
45
+ SEARCH_PAGES: "SEARCH_PAGES",
46
+ GET_WEBSITE_DRAFT_SETTINGS: "GET_WEBSITE_DRAFT_SETTINGS",
47
+ AI_CONTEXT: "AI_CONTEXT",
48
+ GET_WEBSITE_DATA: "GET_WEBSITE_DATA",
49
+ UPDATE_WEBSITE_DATA: "UPDATE_WEBSITE_DATA",
50
+ GET_CHAI_USER: "GET_CHAI_USER",
51
+ GET_SEO_FIELDS: "GET_SEO_FIELDS",
52
+ GET_BUILDER_PAGE_DATA: "GET_BUILDER_PAGE_DATA",
53
+ GET_PAGE_REVISIONS: "GET_PAGE_REVISIONS",
54
+ DELETE_PAGE_REVISION: "DELETE_PAGE_REVISION",
55
+ RESTORE_PAGE_REVISION: "RESTORE_PAGE_REVISION",
56
+ GET_REVISION_DATA: "GET_REVISION_DATA",
57
+ GET_PAGE_DATA: "GET_PAGE_DATA",
58
+ GET_COMPARE_DATA: "GET_COMPARE_DATA",
59
+ GET_ROLE_AND_PERMISSIONS: "GET_ROLE_AND_PERMISSIONS",
60
+ UPSERT_LIBRARY_ITEM: "UPSERT_LIBRARY_ITEM",
61
+ GET_LIBRARIES: "GET_LIBRARIES",
62
+ GET_LIBRARY_ITEM: "GET_LIBRARY_ITEM",
63
+ GET_LIBRARY_ITEMS: "GET_LIBRARY_ITEMS",
64
+ DELETE_LIBRARY_ITEM: "DELETE_LIBRARY_ITEM",
65
+ MARK_AS_TEMPLATE: "MARK_AS_TEMPLATE",
66
+ UNMARK_AS_TEMPLATE: "UNMARK_AS_TEMPLATE",
67
+ GET_TEMPLATES_BY_TYPE: "GET_TEMPLATES_BY_TYPE",
68
+ GET_DYNAMIC_PAGES: "GET_DYNAMIC_PAGES",
69
+ GET_APP_SHARED_JSONLD: "GET_APP_SHARED_JSONLD",
70
+ UPDATE_APP_SHARED_JSONLD: "UPDATE_APP_SHARED_JSONLD",
71
+ // DAM Actions
72
+ UPLOAD_ASSET: "UPLOAD_ASSET",
73
+ DELETE_ASSET: "DELETE_ASSET",
74
+ UPDATE_ASSET: "UPDATE_ASSET",
75
+ GET_ASSETS: "GET_ASSETS",
76
+ GET_ASSET: "GET_ASSET"
77
+ }, Qi = pe({}), bn = () => te(Qi), re = (e, t) => {
78
+ const [n] = bn();
79
+ return Q(() => K(n, e, t), [n, e, t]);
80
+ }, x = () => re("apiUrl", "/chai/api"), As = () => re("usersApiUrl", "/chai/users"), Ac = () => re("assetsApiUrl", "/chai/assets"), ji = () => re("websocket", null), Ts = async (e, t, n = {}) => await fetch(e, {
81
+ method: "POST",
82
+ headers: {
83
+ "Content-Type": "application/json",
84
+ ...n
85
+ },
86
+ body: JSON.stringify(t)
87
+ });
88
+ if (import.meta.vitest) {
89
+ const { it: e, expect: t } = import.meta.vitest;
90
+ e("should fetch API", async () => {
91
+ const n = await Ts("/v1/api/chai", {
92
+ action: "test"
93
+ });
94
+ t(n).toBeDefined();
95
+ });
96
+ }
97
+ const O = () => {
98
+ const e = re("onLogout"), t = re("getAccessToken");
99
+ return H(
100
+ async (n, s, r = {}) => {
101
+ const i = await t();
102
+ if (!i)
103
+ return console.error("No auth token found"), null;
104
+ try {
105
+ const a = K(s, "action", "").toLowerCase(), o = await Ts(n + (a ? `?action=${a}` : ""), s, {
106
+ ...r,
107
+ Authorization: `Bearer ${i}`
108
+ });
109
+ if (o.status === 401)
110
+ return console.log("401 Response", o), e(), window.location.reload(), null;
111
+ if (!o.ok) {
112
+ const l = await o.json();
113
+ throw console.error(`API Error (${o.status}):`, l), {
114
+ status: o.status,
115
+ statusText: o.statusText,
116
+ ...l,
117
+ message: l.error || l.message || `Server error: ${o.status}`
118
+ };
119
+ }
120
+ return await o.json();
121
+ } catch (a) {
122
+ throw console.error("API request failed:", s, a), a;
123
+ }
124
+ },
125
+ [e, t]
126
+ );
127
+ };
128
+ function le() {
129
+ const [e, t] = F(
130
+ new URLSearchParams(window.location.search)
131
+ );
132
+ return ne(() => {
133
+ const n = () => {
134
+ t(new URLSearchParams(window.location.search));
135
+ };
136
+ return window.addEventListener("popstate", n), () => {
137
+ window.removeEventListener("popstate", n);
138
+ };
139
+ }, []), [e, t];
140
+ }
141
+ const xe = (e) => {
142
+ const t = x(), [n] = le(), s = e ?? n.get("page"), r = O();
143
+ return ie({
144
+ queryKey: [E.GET_LANGUAGE_PAGES, s],
145
+ staleTime: 1 / 0,
146
+ gcTime: 0,
147
+ placeholderData: [],
148
+ queryFn: async () => {
149
+ if (!s) return null;
150
+ const i = await r(t, {
151
+ action: E.GET_LANGUAGE_PAGES,
152
+ data: { id: s }
153
+ });
154
+ return Tr(Sr(i, "primaryPage"));
155
+ },
156
+ enabled: !!s
157
+ });
158
+ }, Re = () => {
159
+ const e = x(), t = O();
160
+ return ie({
161
+ queryKey: [E.GET_WEBSITE_DRAFT_SETTINGS],
162
+ staleTime: 5 * 60 * 1e3,
163
+ placeholderData: {
164
+ languages: [],
165
+ theme: { fontFamily: "", borderRadius: "", colors: {} },
166
+ appKey: "",
167
+ fallbackLang: ""
168
+ },
169
+ queryFn: async () => t(e, {
170
+ action: E.GET_WEBSITE_DRAFT_SETTINGS,
171
+ data: { draft: !0 }
172
+ })
173
+ });
174
+ }, Ss = (e) => {
175
+ const { fallbackLang: t } = Oe(), { data: n } = Re(), { data: s, isFetching: r } = xe(), i = Q(() => {
176
+ const a = { [t]: !0 };
177
+ return _r(K(n, "languages"), (o) => {
178
+ const l = se(s, { lang: o });
179
+ a[o] = !!l;
180
+ }), a;
181
+ }, [t, s, n]);
182
+ return r || ge(e) || e && i[e];
183
+ };
184
+ class Wi {
185
+ constructor(t, n, s, r) {
186
+ Pe(this, "channelId");
187
+ Pe(this, "websocket");
188
+ Pe(this, "channel", null);
189
+ Pe(this, "userId", null);
190
+ Pe(this, "clientId", null);
191
+ Pe(this, "pageId", null);
192
+ Pe(this, "callback");
193
+ var i, a, o, l, d, f;
194
+ this.userId = s, this.websocket = t, this.clientId = this.getClientId(), this.channelId = `WEBSITE:${n}`, this.callback = r, this.channel = this.websocket.channel(this.channelId, { config: { presence: { key: this.clientId } } }), (f = (d = (l = (o = (a = (i = this.channel) == null ? void 0 : i.on("presence", { event: "sync" }, (u) => {
195
+ this.callback("UPDATE_ONLINE_USERS", { pageToUser: this.getPageUserMapping() }), this.onReceiveEvent("SYNC", u);
196
+ })) == null ? void 0 : a.on("presence", { event: "leave" }, (u) => {
197
+ this.callback("UPDATE_ONLINE_USERS", { pageToUser: this.getPageUserMapping() }), this.onReceiveEvent("SYNC", u);
198
+ })) == null ? void 0 : o.on("presence", { event: "join" }, (u) => {
199
+ this.callback("UPDATE_ONLINE_USERS", { pageToUser: this.getPageUserMapping() }), this.onReceiveEvent("SYNC", u);
200
+ })) == null ? void 0 : l.on(
201
+ "broadcast",
202
+ { event: "TAKE_OVER_REQUESTED" },
203
+ ({ payload: u }) => this.onReceiveEvent("TAKE_OVER_REQUESTED", u)
204
+ )) == null ? void 0 : d.on(
205
+ "broadcast",
206
+ { event: "TAKE_OVER_REQUEST_ACCEPTED" },
207
+ ({ payload: u }) => this.onReceiveEvent("TAKE_OVER_REQUEST_ACCEPTED", u)
208
+ )) == null || f.on(
209
+ "broadcast",
210
+ { event: "TAKE_OVER_REQUEST_REJECTED" },
211
+ ({ payload: u }) => this.onReceiveEvent("TAKE_OVER_REQUEST_REJECTED", u)
212
+ ).subscribe();
213
+ }
214
+ getClientId() {
215
+ return crypto.randomUUID();
216
+ }
217
+ getOnlineUsers({ pageId: t, userId: n }) {
218
+ var i;
219
+ const s = (i = this.channel) == null ? void 0 : i.presenceState();
220
+ let r = Object.values(s || {}).map((a) => a[0]).filter(Boolean);
221
+ return t ? r = r.filter((a) => a.pageId === t) : n && (r = r.filter((a) => a.userId === n)), r.sort((a, o) => a.onlineAt - o.onlineAt);
222
+ }
223
+ getPageOwner() {
224
+ const t = this.getOnlineUsers({ pageId: this.pageId });
225
+ return t.length > 0 ? t[0] : null;
226
+ }
227
+ getPageUserMapping() {
228
+ const t = this.getOnlineUsers({}), n = Pr(t, "pageId"), s = {};
229
+ return Object.keys(n).forEach((r) => {
230
+ var a;
231
+ const i = (a = wr(n[r], "onlineAt")) == null ? void 0 : a.userId;
232
+ i !== this.userId && (s[r] = i);
233
+ }), s;
234
+ }
235
+ onReceiveEvent(t, n) {
236
+ if (!this.pageId) return;
237
+ const s = this.getPageOwner();
238
+ if (!s || s.clientId === this.clientId ? this.callback("USER_JOINED", {
239
+ isActiveInOtherTab: !1
240
+ }) : this.callback("PAGE_LOCKED", {
241
+ isActiveInOtherTab: (s == null ? void 0 : s.userId) === this.userId && (s == null ? void 0 : s.clientId) !== this.clientId
242
+ }), n.targetClientId === this.clientId)
243
+ switch (t) {
244
+ case "TAKE_OVER_REQUESTED":
245
+ this.callback("TAKE_OVER_REQUESTED", {
246
+ requestedBy: n == null ? void 0 : n.userId,
247
+ requestingClientId: n == null ? void 0 : n.senderClientId,
248
+ isRequestedFromAnotherTab: (n == null ? void 0 : n.senderClientId) !== this.clientId && (n == null ? void 0 : n.userId) === this.userId
249
+ });
250
+ break;
251
+ case "TAKE_OVER_REQUEST_ACCEPTED":
252
+ this.channel.track({
253
+ pageId: this.pageId,
254
+ userId: this.userId,
255
+ clientId: this.clientId,
256
+ onlineAt: s ? s.onlineAt - 10 : +/* @__PURE__ */ new Date()
257
+ }), this.callback("TAKE_OVER_REQUEST_ACCEPTED", {
258
+ isTakingOverFromAnotherTab: (n == null ? void 0 : n.senderClientId) !== this.clientId && (n == null ? void 0 : n.userId) === this.userId
259
+ });
260
+ break;
261
+ case "TAKE_OVER_REQUEST_REJECTED":
262
+ this.callback("TAKE_OVER_REQUEST_REJECTED");
263
+ break;
264
+ }
265
+ }
266
+ async joinPage(t) {
267
+ var n;
268
+ this.pageId = t, (n = this.channel) == null || n.track({
269
+ pageId: this.pageId,
270
+ userId: this.userId,
271
+ clientId: this.clientId,
272
+ onlineAt: +/* @__PURE__ */ new Date()
273
+ });
274
+ }
275
+ async leavePage() {
276
+ var t;
277
+ this.channel && ((t = this.channel) == null || t.untrack());
278
+ }
279
+ async sendEvent(t, n) {
280
+ var s, r;
281
+ if (this.channel) {
282
+ const i = {
283
+ pageId: this.pageId,
284
+ userId: this.userId,
285
+ senderClientId: this.clientId
286
+ };
287
+ t === "TAKE_OVER_REQUESTED" ? i.targetClientId = (s = this.getPageOwner()) == null ? void 0 : s.clientId : (t === "TAKE_OVER_REQUEST_ACCEPTED" || t === "TAKE_OVER_REQUEST_REJECTED") && (i.targetClientId = n == null ? void 0 : n.requestingClientId), await ((r = this.channel) == null ? void 0 : r.send({ event: t, payload: i, type: "broadcast" }));
288
+ }
289
+ }
290
+ }
291
+ const zi = pe(
292
+ null
293
+ ), _s = () => te(zi), In = () => {
294
+ const [e] = _s();
295
+ return (e == null ? void 0 : e.slug) || "";
296
+ };
297
+ function Yi(e, t) {
298
+ const [n, s] = F(e);
299
+ return ne(() => {
300
+ const r = setTimeout(() => s(e), t);
301
+ return () => clearTimeout(r);
302
+ }, [e, t]), n;
303
+ }
304
+ const Ji = ({ query: e, uuid: t }) => {
305
+ const { selectedLang: n, fallbackLang: s } = Oe(), { data: r } = oe(), i = r == null ? void 0 : r.pageType, a = x(), o = O(), { data: l, isFetching: d } = ie({
306
+ queryKey: [E.GET_DYNAMIC_PAGES, e, i, t],
307
+ staleTime: 60 * 60 * 1e3,
308
+ placeholderData: [],
309
+ queryFn: async () => await o(a, {
310
+ action: E.GET_DYNAMIC_PAGES,
311
+ data: { query: e, pageType: i, uuid: t }
312
+ }) || [],
313
+ enabled: !!i
314
+ }), f = Q(() => n === "" ? l.filter((u) => u.lang === "" || u.lang === s) : l.filter((u) => u.lang === n), [n, s, l]);
315
+ return { allLangPages: l, data: f, isFetching: d };
316
+ }, Xi = () => {
317
+ const { selectedLang: e, fallbackLang: t } = Oe(), [n, s] = _s(), [r, i] = F(""), a = Yi(r, 500), { allLangPages: o, data: l, isFetching: d } = Ji({ query: a }), f = H((m) => s(m), [s]), u = H((m) => i(m), [i]), h = H(() => {
318
+ if (!n) return;
319
+ const m = !(n != null && n.primaryPage), y = e.length === 0, A = m ? n == null ? void 0 : n.id : n == null ? void 0 : n.primaryPage, p = o.filter(
320
+ (S) => (S == null ? void 0 : S.primaryPage) === A || S.id === A
321
+ ).find((S) => y ? S.lang === e || S.lang === t : S.lang === e);
322
+ s(p || n);
323
+ }, [n, e, o, s, t]);
324
+ return {
325
+ isFetching: d,
326
+ dynamicPage: n,
327
+ searchQuery: r,
328
+ selectedLang: e,
329
+ dynamicPages: l,
330
+ allLangPages: o,
331
+ updateDynamicPage: f,
332
+ updateSearchQuery: u,
333
+ onChangeLanguage: h
334
+ };
335
+ }, Zi = pe({ lastSaved: void 0 }), Nn = () => te(Zi), oe = () => {
336
+ const [e] = le(), t = e.get("page"), { data: n, isFetching: s } = xe();
337
+ return { data: Q(() => ({ ...se(n, { id: t }) || {} }), [n, t]), isFetching: s };
338
+ }, ve = () => {
339
+ const [e] = le(), t = e.get("lang") ?? "", { data: n, isFetching: s } = xe();
340
+ return { data: Q(() => se(n, { lang: t }) || {}, [n, t]), isFetching: s };
341
+ }, ea = pe({}), ta = () => te(ea), na = () => {
342
+ const { data: e } = ve(), t = In(), n = re("getLiveUrl", cs), s = e == null ? void 0 : e.slug, r = n(s || "/");
343
+ return t ? r + t : r;
344
+ }, It = () => {
345
+ const e = re("currentUser"), t = re("onLogout");
346
+ return {
347
+ isLoggedIn: !!e,
348
+ user: e,
349
+ logout: t
350
+ };
351
+ }, sa = (e) => {
352
+ const t = As(), n = O();
353
+ return ie({
354
+ queryKey: [E.GET_CHAI_USER, e],
355
+ queryFn: async () => {
356
+ const r = await n(t, {
357
+ action: E.GET_CHAI_USER,
358
+ data: { userId: e }
359
+ });
360
+ return { ...r, name: r.name || r.email };
361
+ },
362
+ enabled: !ge(e),
363
+ staleTime: "static"
364
+ });
365
+ }, ra = pe({
366
+ status: "checking",
367
+ requestedBy: "",
368
+ isTakeOverRequested: !1,
369
+ requestingClientId: "",
370
+ isActiveInOtherTab: !1
371
+ }), ia = pe(""), aa = pe(null), Cn = pe({}), Tc = () => te(Cn), be = () => {
372
+ const [e] = le(), t = e.get("page"), [n, s] = te(ra), [r, i] = te(aa), [a, o] = te(ia), [l] = te(Cn);
373
+ return {
374
+ pageLock: n,
375
+ pageToUser: l,
376
+ lockingStatus: a,
377
+ realtimeInstance: r,
378
+ setPageLock: s,
379
+ setLockingStatus: o,
380
+ setRealtimeInstance: i,
381
+ realtimePageLockEnabled: !!r,
382
+ currentEditor: l[t || ""],
383
+ isLocked: t && n.status === "locked"
384
+ };
385
+ }, oa = () => {
386
+ const e = ji(), { data: t } = oe(), { user: n } = It(), s = t == null ? void 0 : t.id, { data: r } = Re(), { pageLock: i, setPageLock: a, setLockingStatus: o, realtimeInstance: l, setRealtimeInstance: d } = be(), [, f] = te(Cn), u = at(!1), h = at(i), m = at(!1);
387
+ return ne(() => {
388
+ if (n != null && n.id && e && !l && (r != null && r.appKey) && !m.current) {
389
+ m.current = !0;
390
+ const y = async (T, p) => {
391
+ var S, I;
392
+ switch (T) {
393
+ /**
394
+ * When user joins
395
+ * @payload : { pageToUser: { [pageId: string]: [userId: string] } }
396
+ * - Update page user mapping
397
+ */
398
+ case "UPDATE_ONLINE_USERS":
399
+ f((p == null ? void 0 : p.pageToUser) || {});
400
+ break;
401
+ /**
402
+ * When page is locked
403
+ * @payload : { isActiveInOtherTab: boolean }
404
+ * - Lock this page for this user
405
+ */
406
+ case "PAGE_LOCKED":
407
+ a({
408
+ ...h == null ? void 0 : h.current,
409
+ requestedBy: "",
410
+ status: "locked",
411
+ isActiveInOtherTab: p == null ? void 0 : p.isActiveInOtherTab
412
+ });
413
+ break;
414
+ /**
415
+ * When user joins
416
+ * @payload : { isActiveInOtherTab: boolean }
417
+ * - User will be owner of this page
418
+ */
419
+ case "USER_JOINED":
420
+ if (((S = h == null ? void 0 : h.current) == null ? void 0 : S.status) === "editing") return;
421
+ ((I = h == null ? void 0 : h.current) == null ? void 0 : I.status) === "locked" && o("can_edit_now"), a({
422
+ ...h == null ? void 0 : h.current,
423
+ requestedBy: "",
424
+ status: "editing",
425
+ isActiveInOtherTab: p == null ? void 0 : p.isActiveInOtherTab
426
+ });
427
+ break;
428
+ /**
429
+ * When take over request is requested
430
+ * @payload : { requestedBy: string, requestingClientId: string, isRequestedFromAnotherTab: boolean }
431
+ * - if isRequestedFromAnotherTab === true
432
+ * - automatically accept the request and allow to edit in another tab
433
+ * - else
434
+ * - if some other user requested, ask for approval
435
+ */
436
+ case "TAKE_OVER_REQUESTED":
437
+ a({
438
+ ...h == null ? void 0 : h.current,
439
+ requestingClientId: p == null ? void 0 : p.requestingClientId,
440
+ requestedBy: p != null && p.isRequestedFromAnotherTab ? "ANOTHER_TAB" : p == null ? void 0 : p.requestedBy
441
+ });
442
+ break;
443
+ /**
444
+ * When take over request is accepted
445
+ * @payload : { isTakingOverFromAnotherTab: boolean }
446
+ * - if not isTakingOverFromAnotherTab show request accepted toast
447
+ * - update state for editing page
448
+ */
449
+ case "TAKE_OVER_REQUEST_ACCEPTED":
450
+ p != null && p.isTakingOverFromAnotherTab || (o("take_over_request_accepted"), W.success("Your Page Take Over Request Accepted", { position: "top-center" })), a({
451
+ ...h == null ? void 0 : h.current,
452
+ status: "editing",
453
+ requestedBy: "",
454
+ requestingClientId: "",
455
+ isTakeOverRequested: !1
456
+ });
457
+ break;
458
+ /**
459
+ * When take over request is rejected
460
+ */
461
+ case "TAKE_OVER_REQUEST_REJECTED":
462
+ o("take_over_request_rejected"), a({
463
+ ...h == null ? void 0 : h.current,
464
+ requestedBy: "",
465
+ requestingClientId: "",
466
+ isTakeOverRequested: !1
467
+ });
468
+ break;
469
+ }
470
+ }, A = new Wi(
471
+ e,
472
+ r == null ? void 0 : r.appKey,
473
+ n == null ? void 0 : n.id,
474
+ y
475
+ );
476
+ d(A);
477
+ }
478
+ }, [d, e, r == null ? void 0 : r.appKey]), ne(() => {
479
+ h.current = i;
480
+ }, [i]), ne(() => {
481
+ if (!(!l || !s || !(n != null && n.id) || u.current))
482
+ return u.current = !0, l == null || l.joinPage(s), () => {
483
+ l && u.current && (u.current = !1, h.current = {
484
+ requestedBy: "",
485
+ status: "checking",
486
+ requestingClientId: "",
487
+ isActiveInOtherTab: !1,
488
+ isTakeOverRequested: !1
489
+ }, o(""), a(h.current), l == null || l.leavePage());
490
+ };
491
+ }, [s, l]), i == null ? void 0 : i.status;
492
+ }, la = () => {
493
+ const { data: e } = oe(), { user: t } = It(), n = e == null ? void 0 : e.id, { pageLock: s, setPageLock: r, realtimeInstance: i } = be(), { savePageAsync: a } = Ge(), o = H(() => {
494
+ !i || !n || !(t != null && t.id) || (r({ ...s, isTakeOverRequested: !0 }), i == null || i.sendEvent("TAKE_OVER_REQUESTED"));
495
+ }, [i, n, t == null ? void 0 : t.id, r, s]), l = H(async () => {
496
+ !i || !n || !(t != null && t.id) || (await a(), i == null || i.sendEvent("TAKE_OVER_REQUEST_ACCEPTED", {
497
+ requestingClientId: s == null ? void 0 : s.requestingClientId
498
+ }), r({
499
+ requestedBy: "",
500
+ status: "locked",
501
+ requestingClientId: "",
502
+ isActiveInOtherTab: !1,
503
+ isTakeOverRequested: !1
504
+ }));
505
+ }, [n, i, t == null ? void 0 : t.id, r, a, s]), d = H(() => {
506
+ !i || !n || !(t != null && t.id) || (i == null || i.sendEvent("TAKE_OVER_REQUEST_REJECTED", {
507
+ requestingClientId: s == null ? void 0 : s.requestingClientId
508
+ }), r({
509
+ ...s,
510
+ requestedBy: "",
511
+ status: "editing",
512
+ requestingClientId: "",
513
+ isActiveInOtherTab: !1,
514
+ isTakeOverRequested: !1
515
+ }));
516
+ }, [n, i, t == null ? void 0 : t.id, r, s]);
517
+ return {
518
+ pageLock: s,
519
+ acceptTakeOver: l,
520
+ rejectTakeOver: d,
521
+ requestTakeOver: o
522
+ };
523
+ }, ca = q(() => import("./no-language-page-content-DNNu8wd0.js")), ua = q(() => import("./page-locked-by-dialog-DyLcMu33.js")), sn = q(() => import("./page-lock-request-Br9S1AsA.js")), da = ({ isFetchingPage: e }) => {
524
+ const { pageLock: t, requestTakeOver: n } = la(), { currentEditor: s, lockingStatus: r, setLockingStatus: i, realtimePageLockEnabled: a } = be(), { data: o, isFetching: l } = sa(s), [d] = le(), f = d.get("page"), [u] = Nn(), h = Z(), m = H(() => {
525
+ n();
526
+ }, [n]);
527
+ return !f || e || !a || (t == null ? void 0 : t.status) === "checking" ? null : t != null && t.requestedBy ? /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
528
+ sn,
529
+ {
530
+ lockingStatus: "",
531
+ onContinue: () => {
532
+ n();
533
+ }
534
+ }
535
+ ) }) : (t == null ? void 0 : t.status) !== "locked" ? r === "take_over_request_accepted" || r === "can_edit_now" ? /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
536
+ sn,
537
+ {
538
+ lockingStatus: r,
539
+ onContinue: () => {
540
+ h.invalidateQueries({
541
+ queryKey: [E.GET_DRAFT_PAGE]
542
+ }), i("");
543
+ }
544
+ }
545
+ ) }) : null : t != null && t.isActiveInOtherTab ? /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(sn, { lockingStatus: "page_is_active_in_other_tab", onContinue: n }) }) : /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
546
+ ua,
547
+ {
548
+ ...o,
549
+ isFetchingUserInfo: l,
550
+ name: (o == null ? void 0 : o.name) || "Unknown User",
551
+ email: (o == null ? void 0 : o.email) || "",
552
+ lastSaved: (u == null ? void 0 : u.lastSaved) || "",
553
+ onTakeOver: m,
554
+ realtimePageLockEnabled: a,
555
+ isRequestRejected: r === "take_over_request_rejected"
556
+ }
557
+ ) });
558
+ }, fa = () => {
559
+ const [e] = le(), t = e.get("lang");
560
+ return Ss(t) ? null : /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(ca, {}) });
561
+ }, Lt = {
562
+ ab: "Abkhazian",
563
+ aa: "Afar",
564
+ af: "Afrikaans",
565
+ ak: "Akan",
566
+ sq: "Albanian",
567
+ am: "Amharic",
568
+ ar: "Arabic",
569
+ an: "Aragonese",
570
+ hy: "Armenian",
571
+ as: "Assamese",
572
+ av: "Avaric",
573
+ ae: "Avestan",
574
+ ay: "Aymara",
575
+ az: "Azerbaijani",
576
+ bm: "Bambara",
577
+ ba: "Bashkir",
578
+ eu: "Basque",
579
+ be: "Belarusian",
580
+ bn: "Bengali",
581
+ bh: "Bihari",
582
+ bi: "Bislama",
583
+ bs: "Bosnian",
584
+ br: "Breton",
585
+ bg: "Bulgarian",
586
+ my: "Burmese",
587
+ ca: "Catalan",
588
+ ch: "Chamorro",
589
+ ce: "Chechen",
590
+ ny: "Chichewa",
591
+ zh: "Chinese",
592
+ "zh-Hans": "Chinese (Simplified)",
593
+ "zh-Hant": "Chinese (Traditional)",
594
+ cv: "Chuvash",
595
+ kw: "Cornish",
596
+ co: "Corsican",
597
+ cr: "Cree",
598
+ hr: "Croatian",
599
+ cs: "Czech",
600
+ da: "Danish",
601
+ dv: "Maldivian",
602
+ nl: "Dutch",
603
+ dz: "Dzongkha",
604
+ en: "English",
605
+ eo: "Esperanto",
606
+ et: "Estonian",
607
+ ee: "Ewe",
608
+ fo: "Faroese",
609
+ fj: "Fijian",
610
+ fi: "Finnish",
611
+ fr: "French",
612
+ ff: "Fula, Pular",
613
+ gl: "Galician",
614
+ gd: "Gaelic (Scottish)",
615
+ gv: "Manx",
616
+ ka: "Georgian",
617
+ de: "German",
618
+ el: "Greek",
619
+ kl: "Kalaallisut",
620
+ gn: "Guarani",
621
+ gu: "Gujarati",
622
+ ht: "Haitian Creole",
623
+ ha: "Hausa",
624
+ he: "Hebrew",
625
+ hz: "Herero",
626
+ hi: "Hindi",
627
+ ho: "Hiri Motu",
628
+ hu: "Hungarian",
629
+ is: "Icelandic",
630
+ io: "Ido",
631
+ ig: "Igbo",
632
+ id: "Indonesian",
633
+ ia: "Interlingua",
634
+ ie: "Interlingue",
635
+ iu: "Inuktitut",
636
+ ik: "Inupiak",
637
+ ga: "Irish",
638
+ it: "Italian",
639
+ ja: "Japanese",
640
+ jv: "Javanese",
641
+ kn: "Kannada",
642
+ kr: "Kanuri",
643
+ ks: "Kashmiri",
644
+ kk: "Kazakh",
645
+ km: "Khmer",
646
+ ki: "Kikuyu",
647
+ rw: "Kinyarwanda",
648
+ rn: "Kirundi",
649
+ ky: "Kyrgyz",
650
+ kv: "Komi",
651
+ kg: "Kongo",
652
+ ko: "Korean",
653
+ ku: "Kurdish",
654
+ kj: "Kwanyama",
655
+ lo: "Lao",
656
+ la: "Latin",
657
+ lv: "Latvian",
658
+ li: "Limburgish",
659
+ ln: "Lingala",
660
+ lt: "Lithuanian",
661
+ lu: "Luga-Katanga",
662
+ lg: "Luganda, Ganda",
663
+ lb: "Luxembourgish",
664
+ mk: "Macedonian",
665
+ mg: "Malagasy",
666
+ ms: "Malay",
667
+ ml: "Malayalam",
668
+ mt: "Maltese",
669
+ mi: "Maori",
670
+ mr: "Marathi",
671
+ mh: "Marshallese",
672
+ mo: "Moldavian",
673
+ mn: "Mongolian",
674
+ na: "Nauru",
675
+ nv: "Navajo",
676
+ ng: "Ndonga",
677
+ nd: "Northern Ndebele",
678
+ ne: "Nepali",
679
+ no: "Norwegian",
680
+ nb: "Norwegian bokmål",
681
+ nn: "Norwegian nynorsk",
682
+ ii: "Sichuan Yi",
683
+ oc: "Occitan",
684
+ oj: "Ojibwe",
685
+ cu: "Old Church Slavonic",
686
+ or: "Oriya",
687
+ om: "Oromo",
688
+ os: "Ossetian",
689
+ pi: "Pāli",
690
+ ps: "Pashto, Pushto",
691
+ fa: "Persian (Farsi)",
692
+ pl: "Polish",
693
+ pt: "Portuguese",
694
+ pa: "Punjabi (Eastern)",
695
+ qu: "Quechua",
696
+ rm: "Romansh",
697
+ ro: "Romanian",
698
+ ru: "Russian",
699
+ se: "Sami",
700
+ sm: "Samoan",
701
+ sg: "Sango",
702
+ sa: "Sanskrit",
703
+ sr: "Serbian",
704
+ sh: "Serbo-Croatian",
705
+ st: "Sesotho",
706
+ tn: "Setswana",
707
+ sn: "Shona",
708
+ sd: "Sindhi",
709
+ si: "Sinhalese",
710
+ ss: "Swati",
711
+ sk: "Slovak",
712
+ sl: "Slovenian",
713
+ so: "Somali",
714
+ nr: "Southern Ndebele",
715
+ es: "Spanish",
716
+ su: "Sundanese",
717
+ sw: "Swahili (Kiswahili)",
718
+ sv: "Swedish",
719
+ tl: "Tagalog",
720
+ ty: "Tahitian",
721
+ tg: "Tajik",
722
+ ta: "Tamil",
723
+ tt: "Tatar",
724
+ te: "Telugu",
725
+ th: "Thai",
726
+ bo: "Tibetan",
727
+ ti: "Tigrinya",
728
+ to: "Tonga",
729
+ ts: "Tsonga",
730
+ tr: "Turkish",
731
+ tk: "Turkmen",
732
+ tw: "Twi",
733
+ ug: "Uyghur",
734
+ uk: "Ukrainian",
735
+ ur: "Urdu",
736
+ uz: "Uzbek",
737
+ ve: "Venda",
738
+ vi: "Vietnamese",
739
+ vo: "Volapük",
740
+ wa: "Wallon",
741
+ cy: "Welsh",
742
+ wo: "Wolof",
743
+ fy: "Western Frisian",
744
+ xh: "Xhosa",
745
+ yi: "Yiddish",
746
+ yo: "Yoruba",
747
+ za: "Zhuang, Chuang",
748
+ zu: "Zulu"
749
+ };
750
+ function Ps(e, t, n = !1) {
751
+ const s = e.toString() ? `?${e.toString()}` : "/";
752
+ n ? window.history.replaceState(null, "", s) : window.history.pushState({}, "", s), t(e), window.dispatchEvent(new PopStateEvent("popstate"));
753
+ }
754
+ const Ln = pe(null), kn = () => {
755
+ const { data: e } = Re();
756
+ return Q(
757
+ () => (e == null ? void 0 : e.fallbackLang) || "en",
758
+ [e]
759
+ );
760
+ }, ws = () => {
761
+ const e = O(), t = x();
762
+ return ie({
763
+ queryKey: [E.GET_WEBSITE_PAGES],
764
+ staleTime: 1e3 * 60 * 5,
765
+ queryFn: async () => e(t, { action: E.GET_WEBSITE_PAGES }) || [],
766
+ placeholderData: (n) => n || []
767
+ });
768
+ }, Sc = (e) => {
769
+ const t = O(), n = x(), s = kn();
770
+ return ie({
771
+ queryKey: [E.GET_WEBSITE_PAGES, e, s],
772
+ staleTime: 1e3 * 60 * 5,
773
+ enabled: !!e,
774
+ queryFn: async () => {
775
+ if (s === e) return {};
776
+ const r = await t(n, { action: E.GET_WEBSITE_PAGES, data: { lang: e } }) || [];
777
+ return vr(
778
+ Bt(r, (i) => ({ ...i, lang: e })),
779
+ "primaryPage"
780
+ );
781
+ },
782
+ placeholderData: (r) => r || {}
783
+ });
784
+ }, ha = q(() => import("./page-manager-new-B2oBm4pU.js")), vs = ({ children: e }) => {
785
+ const [t, n] = le(), s = t.get("page"), { data: r, isFetching: i } = oe(), { data: a, isFetching: o } = ws(), [l, d] = F(!1), [f, u] = F(!0), { savePage: h } = Ge(), m = !!s && !ge(r), y = Q(() => {
786
+ if (!a || o) return !1;
787
+ const S = a.find((I) => I.slug === "/");
788
+ return S == null ? void 0 : S.id;
789
+ }, [a, o]);
790
+ ne(() => {
791
+ if (o || !y || a.some((R) => R.id === s)) return;
792
+ const I = new URLSearchParams({ page: y });
793
+ Ps(I, n), !o && a && u(!1);
794
+ }, [s, o, a, y, n]);
795
+ const A = !f && !s, T = !f && !i && ge(r), p = l || A || T;
796
+ return /* @__PURE__ */ g(me, { children: [
797
+ /* @__PURE__ */ c("div", { className: "flex items-center gap-x-1", children: /* @__PURE__ */ c("div", { className: "relative", children: /* @__PURE__ */ g(Wt, { children: [
798
+ /* @__PURE__ */ c(
799
+ zt,
800
+ {
801
+ asChild: !0,
802
+ onClick: () => {
803
+ h(), d(!0);
804
+ },
805
+ children: e || /* @__PURE__ */ c(U, { variant: "outline", className: "flex w-full items-center space-x-2 py-1", children: /* @__PURE__ */ c(Ti, { className: "h-4 w-4" }) }, "template-viewer")
806
+ }
807
+ ),
808
+ /* @__PURE__ */ c(Yt, { side: "right", children: /* @__PURE__ */ c("p", { children: "Open pages manager" }) })
809
+ ] }) }) }),
810
+ /* @__PURE__ */ c(gs, { open: p, onOpenChange: (S) => !S && m && d(!1), children: /* @__PURE__ */ g(
811
+ ms,
812
+ {
813
+ side: "left",
814
+ "aria-describedby": "pages-manager-description",
815
+ className: `z-50 !min-w-[50vh] !max-w-[800px] border-border p-0 ${m ? "" : "sheet-hide-close-btn"}`,
816
+ children: [
817
+ /* @__PURE__ */ g(Wr, { className: "mb-3 px-4 pt-4", children: [
818
+ /* @__PURE__ */ g(zr, { className: "flex items-center gap-2 text-sm font-semibold", children: [
819
+ /* @__PURE__ */ c("div", { className: "flex h-9 w-9 items-center justify-center rounded-lg bg-primary text-primary-foreground", children: /* @__PURE__ */ c(Si, { className: "h-4 w-4" }) }),
820
+ /* @__PURE__ */ g("div", { className: "flex flex-col", children: [
821
+ /* @__PURE__ */ c("span", { className: "text-sm font-semibold", children: "Pages" }),
822
+ /* @__PURE__ */ c("span", { id: "pages-manager-description", className: "text-xs font-normal text-muted-foreground", children: "Manage your site structure" })
823
+ ] })
824
+ ] }),
825
+ /* @__PURE__ */ c(Yr, { className: "sr-only", children: "Manage your site structure" })
826
+ ] }),
827
+ /* @__PURE__ */ c("div", { className: "h-[calc(100vh-80px)] overflow-y-auto", children: p && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(ha, { close: () => d(!1) }) }) })
828
+ ]
829
+ }
830
+ ) })
831
+ ] });
832
+ }, ga = q(() => import("./add-new-language-page-C8LIaHl6.js")), ma = () => {
833
+ const e = re("topLeftCorner", null);
834
+ return e ? /* @__PURE__ */ c("div", { className: "max-h-9 w-full overflow-hidden pr-2", children: xr.createElement(e, {}) }) : null;
835
+ }, Ea = ({
836
+ showAdd: e = !0,
837
+ variant: t = "ghost"
838
+ }) => {
839
+ const { fallbackLang: n, languages: s, selectedLang: r, setSelectedLang: i } = Oe(), a = ge(r) ? n : r, [, o] = le(), { isLocked: l } = be();
840
+ ne(() => {
841
+ const T = new URLSearchParams(window.location.search), p = T.get("lang");
842
+ p && (s.includes(p) ? i(p) : (T.delete("lang"), o(T), i("")));
843
+ }, [s, o, i]);
844
+ const [, d] = te(Ln), { data: f } = oe(), { data: u } = Re(), { data: h } = xe(), m = Q(() => {
845
+ const T = us(
846
+ Bt(K(u, "languages"), (p) => {
847
+ const S = se(h, { lang: p });
848
+ return {
849
+ key: p,
850
+ value: K(Lt, p, p),
851
+ isLangPageAdded: !!S
852
+ };
853
+ })
854
+ ).filter(Boolean);
855
+ return [
856
+ {
857
+ key: n,
858
+ value: K(Lt, n),
859
+ isLangPageAdded: !0
860
+ },
861
+ ...T
862
+ ];
863
+ }, [n, h, u]), y = (T) => {
864
+ if (document.querySelector('[data-panel-id="seo"]')) {
865
+ const S = new CustomEvent("seo-language-switch-check", {
866
+ detail: {
867
+ fromLang: a,
868
+ toLang: T,
869
+ switchHandler: () => A(T)
870
+ }
871
+ });
872
+ window.dispatchEvent(S);
873
+ return;
874
+ }
875
+ A(T);
876
+ }, A = (T) => {
877
+ i(T);
878
+ const p = new URLSearchParams(window.location.search);
879
+ T === n ? p.delete("lang") : p.set("lang", T), Ps(p, o);
880
+ };
881
+ return ge(s) ? null : l ? /* @__PURE__ */ g(U, { variant: "ghost", size: "sm", className: "ml-px h-max cursor-not-allowed gap-2 py-1.5 opacity-50", children: [
882
+ /* @__PURE__ */ c(qn, { className: "h-4 w-4" }),
883
+ K(Lt, a, a),
884
+ /* @__PURE__ */ c(dn, { className: "h-4 w-4" })
885
+ ] }) : /* @__PURE__ */ c(me, { children: /* @__PURE__ */ g(Pn, { children: [
886
+ /* @__PURE__ */ c(wn, { asChild: !0, className: "focus:outline-none", children: /* @__PURE__ */ g(
887
+ U,
888
+ {
889
+ disabled: !!l,
890
+ variant: t,
891
+ size: "sm",
892
+ className: "ml-px h-max gap-2 py-1.5",
893
+ children: [
894
+ /* @__PURE__ */ c(qn, { className: "h-4 w-4" }),
895
+ K(Lt, a, a),
896
+ /* @__PURE__ */ c(dn, { className: "h-4 w-4" })
897
+ ]
898
+ }
899
+ ) }),
900
+ /* @__PURE__ */ g(vn, { className: "space-y-1 border-border", children: [
901
+ Bt(
902
+ m.filter((T) => T.isLangPageAdded),
903
+ (T) => /* @__PURE__ */ g(
904
+ fe,
905
+ {
906
+ className: Mt(
907
+ "flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",
908
+ T.key === a && "!bg-gray-200 text-gray-700"
909
+ ),
910
+ onClick: () => y(T.key),
911
+ children: [
912
+ /* @__PURE__ */ c("div", { className: "text-slate-600", children: T.value }),
913
+ T.key === n && /* @__PURE__ */ g("small", { className: "flex items-center gap-x-1 text-[9px] leading-none text-orange-500", children: [
914
+ /* @__PURE__ */ c(_i, { fill: "orange", className: "h-2 w-2" }),
915
+ "Primary"
916
+ ] })
917
+ ]
918
+ },
919
+ T.value
920
+ )
921
+ ),
922
+ e && !ge(m.filter((T) => !T.isLangPageAdded)) && /* @__PURE__ */ g(me, { children: [
923
+ /* @__PURE__ */ c(Jr, {}),
924
+ /* @__PURE__ */ g(
925
+ U,
926
+ {
927
+ size: "sm",
928
+ variant: "ghost",
929
+ onClick: () => {
930
+ f && d({
931
+ edit: !1,
932
+ primaryPage: f.id
933
+ });
934
+ },
935
+ className: "text-xs font-normal duration-200 hover:bg-slate-300 hover:text-slate-800",
936
+ children: [
937
+ /* @__PURE__ */ c(ys, { className: "mr-1 h-3 w-3" }),
938
+ " Add Langauge"
939
+ ]
940
+ }
941
+ )
942
+ ] })
943
+ ] })
944
+ ] }) });
945
+ };
946
+ function pa() {
947
+ const [e, t] = te(Ln);
948
+ return /* @__PURE__ */ g("div", { className: "relative z-10 flex items-center justify-end gap-1", children: [
949
+ /* @__PURE__ */ c(ma, {}),
950
+ /* @__PURE__ */ c(vs, {}),
951
+ e && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
952
+ ga,
953
+ {
954
+ isOpen: !0,
955
+ id: e == null ? void 0 : e.id,
956
+ edit: !!(e != null && e.id),
957
+ primaryPage: e == null ? void 0 : e.primaryPage,
958
+ preselectedLang: e == null ? void 0 : e.preselectedLang,
959
+ onClose: () => t(null)
960
+ }
961
+ ) })
962
+ ] });
963
+ }
964
+ function ya() {
965
+ return /* @__PURE__ */ c("div", { className: "mt-2 space-y-2", children: Array.from({ length: 5 }).map((e, t) => /* @__PURE__ */ g("div", { className: "flex items-start gap-3 rounded-md border p-2", children: [
966
+ /* @__PURE__ */ g("div", { className: "flex-1 space-y-1", children: [
967
+ /* @__PURE__ */ c(Ct, { className: "h-4 w-3/4" }),
968
+ /* @__PURE__ */ c(Ct, { className: "h-3 w-1/2" }),
969
+ /* @__PURE__ */ c(Ct, { className: "mt-1 h-5 w-20" })
970
+ ] }),
971
+ /* @__PURE__ */ c(Ct, { className: "h-8 w-8 rounded-full" })
972
+ ] }, t)) });
973
+ }
974
+ const Aa = j.lazy(() => import("./page-revisions-content-DM-ngq3R.js"));
975
+ function Ta() {
976
+ const [e, t] = j.useState(!1);
977
+ return /* @__PURE__ */ c(Es, { children: /* @__PURE__ */ g(Wt, { delayDuration: 0, children: [
978
+ /* @__PURE__ */ g(gs, { open: e, onOpenChange: t, children: [
979
+ /* @__PURE__ */ c(Xr, { asChild: !0, children: /* @__PURE__ */ c(zt, { asChild: !0, children: /* @__PURE__ */ g("span", { className: "flex items-center gap-2", children: [
980
+ /* @__PURE__ */ g(U, { variant: "ghost", size: "icon", className: "h-8 w-8", children: [
981
+ /* @__PURE__ */ c(Pi, { className: "h-4 w-4" }),
982
+ /* @__PURE__ */ c("span", { className: "sr-only", children: "View revision history" })
983
+ ] }),
984
+ /* @__PURE__ */ c("div", { className: "h-4 w-px bg-gray-200 dark:bg-gray-700" })
985
+ ] }) }) }),
986
+ /* @__PURE__ */ c(ms, { className: "flex h-[100vh] flex-col", children: e && /* @__PURE__ */ c(V, { fallback: /* @__PURE__ */ c(ya, {}), children: /* @__PURE__ */ c(Aa, { isOpen: e }) }) })
987
+ ] }),
988
+ /* @__PURE__ */ c(Yt, { side: "bottom", children: /* @__PURE__ */ c("p", { children: "Revision history" }) })
989
+ ] }) });
990
+ }
991
+ const rn = ({
992
+ permission: e,
993
+ permissions: t,
994
+ children: n,
995
+ fallback: s = null
996
+ }) => {
997
+ const { hasPermission: r } = hs();
998
+ return e && !r(e) || t && !t.some((i) => r(i)) ? s : n;
999
+ }, J = {
1000
+ TOGGLE_PREVIEW: "Toggle Preview",
1001
+ OPEN_PREVIEW_IN_NEW_TAB: "Open preview in new tab",
1002
+ THEME: "Theme",
1003
+ SAVEDRAFT: "Save draft",
1004
+ SAVING: "Saving",
1005
+ SAVED: "Saved",
1006
+ PUBLISHED: "Published",
1007
+ PUBLISH: "Publish",
1008
+ UNPUBLISH: "Unpublish",
1009
+ WEBSITEDATA: "Website data",
1010
+ OPEN: "Open",
1011
+ EDIT_LANGUAGE: "Edit language",
1012
+ ADD_NEW_LANGUAGE: "Add new language page",
1013
+ ENTER_LANGUAGE_DETAILS: "Enter the details for the language",
1014
+ LANGUAGE: "Language",
1015
+ PAGE_NAME: "Page Name",
1016
+ SLUG: "Slug",
1017
+ UPDATE: "Update",
1018
+ UPDATING: "Updating...",
1019
+ ADDING: "Adding...",
1020
+ CHOOSE_LANGUAGE: "Choose language",
1021
+ ALL_AVAILABLE_LANGUAGE_PAGE: "All available language page is created.",
1022
+ TO_UPDATE_SLUG: "To update slug use 'Change slug' action",
1023
+ SLUG_SHOULD_START_WITH: " (Slug should start with /{lang})",
1024
+ CHOOSE_LANGUAGE_TO_ADD_SLUG: "Choose language to add slug",
1025
+ ENTER_PAGE_SLUG: "Enter page slug",
1026
+ ENTER_PAGE_NAME: "Enter page name",
1027
+ DELETE: "Delete",
1028
+ CHANGE_SLUG: "Change slug",
1029
+ PRIMARY: "Primary",
1030
+ SLUG_MUST_START_WITH: "Slug must start with /",
1031
+ EDIT: "Edit",
1032
+ UNPUBLISH_MSG: "Are you sure you want to unpublish",
1033
+ MARK_AS_TEMPLATE: "Mark as template",
1034
+ UNMARK_AS_TEMPLATE: "Unmark as template",
1035
+ // * TOAST SUCCESS
1036
+ PAGE_ADD_SUCCESS: "New page added successfully.",
1037
+ GLOBAL_BLOCK_ADD_SUCCESS: "New global block added successfully.",
1038
+ SEO_SETTINGS_UPDATE_SUCCESS: "SEO Settings updated successfully.",
1039
+ PAGE_UPDATE_SUCCESS: "Page updated successfully.",
1040
+ GLOBAL_BLOCK_UPDATE_SUCCESS: "Global block updated successfully.",
1041
+ PAGE_DELETE_SUCCESS: "Page deleted successfully.",
1042
+ GLOBAL_BLOCK_DELETE_SUCCESS: "Global block deleted successfully.",
1043
+ PAGE_UNPUBLISH_SUCCESS: "Page unpublished successfully.",
1044
+ GLOBAL_BLOCK_UNPUBLISH_SUCCESS: "Global block unpublished successfully.",
1045
+ PAGE_PUBLISH_SUCCESS: "Page published successfully.",
1046
+ GLOBAL_BLOCK_PUBLISH_SUCCESS: "Global block published successfully.",
1047
+ PAGES_PUBLISH_SUCCESS: "Your changes have been published successfully.",
1048
+ SLUG_CHANGE_SUCCESS: "Slug changed successfully."
1049
+ }, Sa = {
1050
+ SLUG_ALREADY_USED: "This slug is already in use. Please choose a different one."
1051
+ }, Ie = () => {
1052
+ const e = x(), t = O();
1053
+ return ie({
1054
+ queryKey: [E.GET_PAGE_TYPES],
1055
+ staleTime: 1 / 0,
1056
+ placeholderData: [],
1057
+ queryFn: async () => t(e, { action: E.GET_PAGE_TYPES })
1058
+ });
1059
+ }, _a = (e) => {
1060
+ const { data: t } = Ie();
1061
+ return Q(() => t == null ? void 0 : t.find((n) => n.key === e), [t, e]);
1062
+ }, Pa = () => {
1063
+ const e = x(), t = O();
1064
+ return ae({
1065
+ mutationFn: async ({ pageType: n, query: s }) => {
1066
+ try {
1067
+ return t(e, {
1068
+ action: E.SEARCH_PAGES,
1069
+ data: {
1070
+ pageType: n,
1071
+ query: Array.isArray(s) && s.length > 0 ? s[0] : s
1072
+ }
1073
+ }) || [];
1074
+ } catch (r) {
1075
+ return console.error(r), [];
1076
+ }
1077
+ }
1078
+ });
1079
+ }, _c = () => {
1080
+ const e = x(), t = Z(), n = O(), { data: s } = Ie();
1081
+ return ae({
1082
+ mutationFn: async (r) => await n(e, {
1083
+ action: E.CREATE_PAGE,
1084
+ data: r
1085
+ }),
1086
+ onSuccess: (r, i) => {
1087
+ var o;
1088
+ i && (i != null && i.primaryPage) ? (t.invalidateQueries({
1089
+ queryKey: [E.GET_LANGUAGE_PAGES, i == null ? void 0 : i.primaryPage]
1090
+ }), t.invalidateQueries({
1091
+ queryKey: [E.GET_WEBSITE_PAGES, i == null ? void 0 : i.lang]
1092
+ })) : t.invalidateQueries({
1093
+ queryKey: [E.GET_WEBSITE_PAGES]
1094
+ });
1095
+ const a = i.template ? `Page created from "${i.template.name}" template` : i.hasSlug === !1 ? "New " + ((o = se(s, { key: i.pageType })) == null ? void 0 : o.name) + " added successfully" : "New page added successfully";
1096
+ W.success(a);
1097
+ },
1098
+ onError: (r, i) => {
1099
+ const a = se(s, { key: i.pageType });
1100
+ W.error(`Failed to add new ${a != null && a.hasSlug ? "page" : a.name}.`, {
1101
+ description: K(Sa, r.message, r.message)
1102
+ });
1103
+ }
1104
+ });
1105
+ }, Pc = () => {
1106
+ const e = x(), t = Z(), n = O(), { data: s } = ve(), { data: r } = Ie();
1107
+ return ae({
1108
+ mutationFn: async (i) => await n(e, {
1109
+ action: E.UPDATE_PAGE,
1110
+ data: i
1111
+ }),
1112
+ onSuccess: (i, a) => {
1113
+ (s == null ? void 0 : s.id) === (a == null ? void 0 : a.id) && t.invalidateQueries({
1114
+ queryKey: [E.GET_LANGUAGE_PAGES]
1115
+ }), a && (a != null && a.primaryPage || a != null && a.seo) ? (t.invalidateQueries({
1116
+ queryKey: [E.GET_LANGUAGE_PAGES, a == null ? void 0 : a.primaryPage]
1117
+ }), t.invalidateQueries({
1118
+ queryKey: [E.GET_WEBSITE_PAGES]
1119
+ })) : t.invalidateQueries({
1120
+ queryKey: [E.GET_WEBSITE_PAGES]
1121
+ });
1122
+ },
1123
+ onError: (i, a) => {
1124
+ const o = se(r, { key: a.pageType });
1125
+ W.error(`Failed to update ${o != null && o.hasSlug ? "page" : o.name}.`, {
1126
+ description: i.message
1127
+ });
1128
+ }
1129
+ });
1130
+ }, wc = () => {
1131
+ const e = x(), t = Z(), n = O(), { data: s } = Ie();
1132
+ return ae({
1133
+ mutationFn: async (r) => n(e, {
1134
+ action: E.DELETE_PAGE,
1135
+ data: { id: r == null ? void 0 : r.id }
1136
+ }),
1137
+ onSuccess: (r, i) => {
1138
+ if (r.code === "PAGE_LOCKED") {
1139
+ W.error("Delete not allowed", {
1140
+ description: "Page is currently being edited by another user."
1141
+ });
1142
+ return;
1143
+ }
1144
+ i && (i != null && i.primaryPage) ? (t.invalidateQueries({
1145
+ queryKey: [E.GET_LANGUAGE_PAGES, i == null ? void 0 : i.primaryPage]
1146
+ }), t.invalidateQueries({
1147
+ queryKey: [E.GET_WEBSITE_PAGES]
1148
+ })) : t.invalidateQueries({
1149
+ queryKey: [E.GET_WEBSITE_PAGES]
1150
+ });
1151
+ },
1152
+ onError: (r, i) => {
1153
+ const a = se(s, { key: i.pageType });
1154
+ W.error(`Failed to delete ${a != null && a.hasSlug ? "page" : a.name}.`, {
1155
+ description: r.message
1156
+ });
1157
+ }
1158
+ });
1159
+ }, vc = () => {
1160
+ const e = x(), t = Z(), n = O(), { data: s } = Ie();
1161
+ return ae({
1162
+ mutationFn: async (r) => n(e, {
1163
+ action: E.TAKE_OFFLINE,
1164
+ data: { id: r == null ? void 0 : r.id }
1165
+ }),
1166
+ onSuccess: (r, i) => {
1167
+ i && (i != null && i.primaryPage) ? t.invalidateQueries({
1168
+ queryKey: [E.GET_LANGUAGE_PAGES, i == null ? void 0 : i.primaryPage]
1169
+ }) : t.invalidateQueries({
1170
+ queryKey: [E.GET_WEBSITE_PAGES]
1171
+ });
1172
+ const a = se(s, { key: i.pageType });
1173
+ W.success(
1174
+ a != null && a.hasSlug ? J.PAGE_UNPUBLISH_SUCCESS : "New " + a.name + " added successfully."
1175
+ );
1176
+ },
1177
+ onError: (r, i) => {
1178
+ const a = se(s, { key: i.pageType });
1179
+ W.error(`Failed to take offline ${a != null && a.hasSlug ? "page" : a.name}.`, {
1180
+ description: r.message
1181
+ });
1182
+ }
1183
+ });
1184
+ }, bs = () => {
1185
+ const e = x(), t = O(), n = Z(), { data: s } = oe(), { savePageAsync: r } = Ge();
1186
+ return ae({
1187
+ mutationFn: async ({ ids: i }) => (await r(), t(e, {
1188
+ action: E.PUBLISH_CHANGES,
1189
+ data: { ids: i }
1190
+ })),
1191
+ onSuccess: () => {
1192
+ n.invalidateQueries({
1193
+ queryKey: [E.GET_CHANGES]
1194
+ }), n.invalidateQueries({
1195
+ queryKey: [E.GET_WEBSITE_PAGES]
1196
+ }), n.invalidateQueries({
1197
+ queryKey: [E.GET_LANGUAGE_PAGES, s == null ? void 0 : s.id]
1198
+ });
1199
+ },
1200
+ onError: (i) => {
1201
+ console.log("##", i), W.error("Failed to publish pages.");
1202
+ }
1203
+ });
1204
+ }, bc = () => {
1205
+ const e = x(), t = O(), n = Z();
1206
+ return ae({
1207
+ mutationFn: async (s) => {
1208
+ var r;
1209
+ return t(e, {
1210
+ action: E.MARK_AS_TEMPLATE,
1211
+ data: {
1212
+ id: (r = s.page) == null ? void 0 : r.id,
1213
+ name: s.name,
1214
+ description: s.description,
1215
+ pageType: s.pageType,
1216
+ previewImage: s.previewImage
1217
+ }
1218
+ });
1219
+ },
1220
+ onSuccess: () => {
1221
+ n.invalidateQueries({
1222
+ queryKey: [E.GET_WEBSITE_PAGES]
1223
+ }), W.success("Page marked as template successfully.");
1224
+ },
1225
+ onError: () => {
1226
+ W.error("Failed to mark page as template.");
1227
+ }
1228
+ });
1229
+ }, Ic = () => {
1230
+ const e = x(), t = O(), n = Z();
1231
+ return ae({
1232
+ mutationFn: async (s) => t(e, {
1233
+ action: E.UNMARK_AS_TEMPLATE,
1234
+ data: { id: s == null ? void 0 : s.id }
1235
+ }),
1236
+ onSuccess: () => {
1237
+ n.invalidateQueries({
1238
+ queryKey: [E.GET_WEBSITE_PAGES]
1239
+ }), W.success("Page unmarked as template successfully.");
1240
+ },
1241
+ onError: () => {
1242
+ W.error("Failed to unmark page as template.");
1243
+ }
1244
+ });
1245
+ }, Nc = () => {
1246
+ const e = x(), t = O(), n = Z();
1247
+ return ae({
1248
+ mutationFn: async ({ id: s, slug: r }) => t(e, {
1249
+ action: E.CHANGE_SLUG,
1250
+ data: { id: s, slug: r }
1251
+ }),
1252
+ onSuccess: (s, { primaryPage: r }) => {
1253
+ W.success(J.SLUG_CHANGE_SUCCESS), r ? n.invalidateQueries({
1254
+ queryKey: [E.GET_LANGUAGE_PAGES, r]
1255
+ }) : n.invalidateQueries({
1256
+ queryKey: [E.GET_WEBSITE_PAGES]
1257
+ });
1258
+ },
1259
+ onError: () => {
1260
+ W.error("Failed to change slug");
1261
+ }
1262
+ });
1263
+ }, wa = q(() => import("./publish-pages-content-Dast4sG6.js"));
1264
+ function va({
1265
+ showModal: e = !1,
1266
+ onClose: t = () => console.log("Cancelled")
1267
+ }) {
1268
+ const { mutate: n, isPending: s } = bs();
1269
+ return /* @__PURE__ */ c(ps, { open: e, onOpenChange: s ? () => {
1270
+ } : t, children: e && /* @__PURE__ */ c(V, { fallback: /* @__PURE__ */ c("div", { className: "h-96 w-96 animate-pulse bg-gray-100" }), children: /* @__PURE__ */ c(wa, { onClose: t, isPending: s, publishPage: n }) }) });
1271
+ }
1272
+ const de = {
1273
+ ...Br,
1274
+ //pages
1275
+ ADD_PAGE: "add_page",
1276
+ EDIT_PAGE: "edit_page",
1277
+ EDIT_SLUG: "edit_slug",
1278
+ DELETE_PAGE: "delete_page",
1279
+ CHANGE_PAGE_TYPE: "change_page_type",
1280
+ PUBLISH_PAGE: "publish_page",
1281
+ UNPUBLISH_PAGE: "unpublish_page",
1282
+ MARK_AS_TEMPLATE: "mark_as_template",
1283
+ UNMARK_AS_TEMPLATE: "unmark_as_template",
1284
+ //PARTIALS
1285
+ ADD_PARTIAL: "add_partial",
1286
+ EDIT_PARTIAL: "edit_partial",
1287
+ DELETE_PARTIAL: "delete_partial",
1288
+ PUBLISH_PARTIAL: "publish_partial",
1289
+ UNPUBLISH_PARTIAL: "unpublish_partial",
1290
+ //SEO
1291
+ EDIT_SEO: "edit_seo",
1292
+ // revisions
1293
+ RESTORE_REVISION: "restore_revision",
1294
+ DELETE_REVISION: "delete_revision",
1295
+ //theme
1296
+ PUBLISH_THEME: "publish_theme",
1297
+ EDIT_SETTINGS: "edit_settings",
1298
+ // library and templates
1299
+ ADD_LIBRARY_BLOCK: "create_library_block",
1300
+ ADD_LIBRARY_TEMPLATE: "add_library_template",
1301
+ EDIT_LIBRARY_BLOCK: "edit_library_block",
1302
+ EDIT_LIBRARY_TEMPLATE: "edit_library_template",
1303
+ DELETE_LIBRARY_BLOCK: "delete_library_block",
1304
+ DELETE_LIBRARY_TEMPLATE: "delete_library_template",
1305
+ //media
1306
+ ADD_MEDIA: "add_media",
1307
+ EDIT_MEDIA: "edit_media",
1308
+ DELETE_MEDIA: "delete_media"
1309
+ }, ba = {
1310
+ particleCount: 350,
1311
+ spread: 120,
1312
+ origin: { y: 0.6 },
1313
+ angle: 90
1314
+ }, Ia = {
1315
+ TOP_RIGHT: {
1316
+ angle: 225,
1317
+ origin: { x: 0.9, y: 0 }
1318
+ },
1319
+ BOTTOM_RIGHT: {
1320
+ angle: 100,
1321
+ origin: { x: 0.9, y: 0.9 }
1322
+ }
1323
+ }, Na = async () => {
1324
+ const { default: e } = await import("./confetti.module-DCmCkDyV.js");
1325
+ return e;
1326
+ }, an = (e) => {
1327
+ let t = Ia[e];
1328
+ t || (t = {});
1329
+ const n = { ...ba, ...t };
1330
+ Na().then((s) => s(n));
1331
+ };
1332
+ function Dn({
1333
+ children: e,
1334
+ content: t,
1335
+ side: n = "bottom",
1336
+ delayDuration: s = 700,
1337
+ showTooltip: r = !0
1338
+ }) {
1339
+ return r ? /* @__PURE__ */ c(Es, { children: /* @__PURE__ */ g(Wt, { delayDuration: s, children: [
1340
+ /* @__PURE__ */ c(zt, { asChild: !0, children: e }),
1341
+ /* @__PURE__ */ c(Yt, { side: n, sideOffset: 10, children: /* @__PURE__ */ c("p", { children: t }) })
1342
+ ] }) }) : e;
1343
+ }
1344
+ const Ca = q(() => import("./unpublish-page-DMteaCpR.js")), La = q(() => import("./translation-warning-modal-DalBhNQy.js")), ka = () => {
1345
+ const { selectedLang: e, fallbackLang: t } = Oe(), n = re("getPreviewUrl", async (u) => u), [s, r] = F(""), { data: i } = oe(), { data: a } = xe(), { data: o } = Ie(), l = Q(
1346
+ () => {
1347
+ var u;
1348
+ return (u = a == null ? void 0 : a.find((h) => (h == null ? void 0 : h.lang) === e)) == null ? void 0 : u.slug;
1349
+ },
1350
+ [e, a]
1351
+ ), d = H((u) => {
1352
+ var h;
1353
+ return (h = se(o, { key: u })) == null ? void 0 : h.hasSlug;
1354
+ }, [o]), f = e === t ? "" : e;
1355
+ return ne(() => {
1356
+ (async () => {
1357
+ if (typeof n == "function") {
1358
+ const u = !d(i == null ? void 0 : i.pageType), h = await n(
1359
+ u ? `${f !== "" ? f + "/" : ""}${i == null ? void 0 : i.id}` : l || ""
1360
+ );
1361
+ r(h);
1362
+ } else
1363
+ r("");
1364
+ })();
1365
+ }, [n, l, i == null ? void 0 : i.pageType, d, i == null ? void 0 : i.id, f]), /* @__PURE__ */ c(me, { children: /* @__PURE__ */ c(Dn, { content: J.OPEN_PREVIEW_IN_NEW_TAB, delayDuration: 0, children: /* @__PURE__ */ c("a", { href: s, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ c(U, { variant: "ghost", size: "sm", className: "gap-2", children: /* @__PURE__ */ c(wi, { className: "h-4 w-4" }) }) }) }) });
1366
+ }, Da = () => {
1367
+ const [e, t] = Mr();
1368
+ return /* @__PURE__ */ g(me, { children: [
1369
+ /* @__PURE__ */ c(Dn, { content: J.THEME, delayDuration: 0, children: /* @__PURE__ */ c(
1370
+ U,
1371
+ {
1372
+ variant: e === "theme" ? "outline" : "ghost",
1373
+ size: "icon",
1374
+ className: "gap-2",
1375
+ onClick: () => t(e === "theme" ? "block" : "theme"),
1376
+ children: /* @__PURE__ */ c(vi, { className: "h-4 w-4" })
1377
+ }
1378
+ ) }),
1379
+ /* @__PURE__ */ c("div", { className: "h-4 w-px bg-gray-200 dark:bg-gray-700" })
1380
+ ] });
1381
+ }, Ga = () => {
1382
+ const [e, t] = F(!1), { isLocked: n } = be(), { savePageAsync: s, saveState: r } = Ge();
1383
+ ne(() => {
1384
+ const d = (f) => {
1385
+ r === "UNSAVED" && (f.preventDefault(), f.returnValue = !1);
1386
+ };
1387
+ return r === "UNSAVED" && window.addEventListener("beforeunload", d), () => {
1388
+ window.removeEventListener("beforeunload", d);
1389
+ };
1390
+ }, [r]);
1391
+ const i = H(async () => {
1392
+ e || (t(!0), await s(), t(!1));
1393
+ }, [s, e]), { buttonIcon: a, buttonClass: o, tooltipContent: l } = Q(() => {
1394
+ switch (r) {
1395
+ case "UNSAVED":
1396
+ return {
1397
+ tooltipContent: J.SAVEDRAFT,
1398
+ buttonIcon: /* @__PURE__ */ c(Ii, { className: "h-4 w-4" }),
1399
+ buttonClass: "gap-x-1"
1400
+ };
1401
+ case "SAVING":
1402
+ return {
1403
+ tooltipContent: J.SAVING,
1404
+ buttonIcon: /* @__PURE__ */ c(Ft, { className: "h-4 w-4 animate-spin text-sky-700" }),
1405
+ buttonClass: "gap-x-1"
1406
+ };
1407
+ case "SAVED":
1408
+ return {
1409
+ tooltipContent: J.SAVED,
1410
+ buttonIcon: /* @__PURE__ */ c(bi, { className: "h-4 w-4" }),
1411
+ buttonClass: "text-green-500 gap-x-1"
1412
+ };
1413
+ }
1414
+ }, [r]);
1415
+ return n ? null : /* @__PURE__ */ g(U, { size: "sm", variant: "ghost", onClick: i, className: `${o} w-24 max-w-24`, children: [
1416
+ a,
1417
+ " ",
1418
+ l
1419
+ ] });
1420
+ }, Oa = () => {
1421
+ const { selectedLang: e } = Oe(), { data: t } = ve(), { data: n } = xe(), [s, r] = F(!1), [i, a] = F(!1), [o, l] = F(null), { savePageAsync: d } = Ge(), [f, u] = F(!1), { data: h } = oe(), { mutate: m, isPending: y } = bs(), { needTranslations: A } = Ge(), T = A(), { buttonText: p, buttonClassName: S, isPublished: I } = Q(() => {
1422
+ const k = h && (h == null ? void 0 : h.online);
1423
+ return {
1424
+ buttonClassName: k ? "hover:bg-green-600 bg-green-500" : "",
1425
+ isPublished: k,
1426
+ buttonText: k ? J.PUBLISHED : J.PUBLISH
1427
+ };
1428
+ }, [h]), R = async () => {
1429
+ if (T) {
1430
+ u(!0);
1431
+ return;
1432
+ }
1433
+ B();
1434
+ }, B = () => {
1435
+ const k = [t == null ? void 0 : t.id, t == null ? void 0 : t.primaryPage];
1436
+ m({ ids: us(k) }, { onSuccess: () => an("TOP_RIGHT") });
1437
+ }, C = () => {
1438
+ u(!1), B();
1439
+ }, ye = async () => {
1440
+ u(!1), await d();
1441
+ }, Ae = Q(() => Bt(n ?? [], "id"), [n]);
1442
+ return /* @__PURE__ */ g(me, { children: [
1443
+ /* @__PURE__ */ g("div", { className: "flex", children: [
1444
+ /* @__PURE__ */ g(
1445
+ U,
1446
+ {
1447
+ size: "sm",
1448
+ onClick: R,
1449
+ disabled: y || !(h != null && h.id),
1450
+ className: `relative flex items-center gap-1 overflow-hidden rounded-r-none text-white transition-all duration-300 ease-in-out ${S}`,
1451
+ onMouseEnter: () => a(!0),
1452
+ onMouseLeave: () => a(!1),
1453
+ children: [
1454
+ /* @__PURE__ */ c(
1455
+ "span",
1456
+ {
1457
+ className: `flex items-center transition-transform duration-300 ease-in-out ${i ? "-translate-y-10" : ""}`,
1458
+ children: I ? /* @__PURE__ */ c(Kn, { className: "h-4 w-4" }) : /* @__PURE__ */ c(Vn, { className: "h-4 w-4" })
1459
+ }
1460
+ ),
1461
+ /* @__PURE__ */ c(
1462
+ "span",
1463
+ {
1464
+ className: `absolute inset-0 left-3 flex items-center transition-transform duration-300 ease-in-out ${i ? "" : "translate-y-10"}`,
1465
+ children: I ? /* @__PURE__ */ c(Vn, { className: "h-4 w-4" }) : /* @__PURE__ */ c(Kn, { className: "h-4 w-4" })
1466
+ }
1467
+ ),
1468
+ /* @__PURE__ */ c("span", { children: p }),
1469
+ e ? `(${Bn(e)})` : ""
1470
+ ]
1471
+ }
1472
+ ),
1473
+ /* @__PURE__ */ g(Pn, { children: [
1474
+ /* @__PURE__ */ c(wn, { asChild: !0, children: /* @__PURE__ */ c(
1475
+ U,
1476
+ {
1477
+ size: "sm",
1478
+ disabled: y || !(h != null && h.id),
1479
+ className: `rounded-l-none border-l border-white/50 px-2 text-white ${S}`,
1480
+ children: /* @__PURE__ */ c(dn, { className: "h-4 w-4" })
1481
+ }
1482
+ ) }),
1483
+ /* @__PURE__ */ g(vn, { align: "end", className: "w-52", children: [
1484
+ /* @__PURE__ */ g(
1485
+ fe,
1486
+ {
1487
+ disabled: y,
1488
+ className: "cursor-pointer text-xs",
1489
+ onClick: () => m({ ids: Ae }, { onSuccess: () => an("TOP_RIGHT") }),
1490
+ children: [
1491
+ J.PUBLISH,
1492
+ " with translation pages"
1493
+ ]
1494
+ }
1495
+ ),
1496
+ !I && /* @__PURE__ */ g(
1497
+ fe,
1498
+ {
1499
+ disabled: y,
1500
+ className: "cursor-pointer text-xs",
1501
+ onClick: () => m({ ids: [h == null ? void 0 : h.id] }, { onSuccess: () => an("TOP_RIGHT") }),
1502
+ children: [
1503
+ J.PUBLISH,
1504
+ " page"
1505
+ ]
1506
+ }
1507
+ ),
1508
+ /* @__PURE__ */ g(fe, { onClick: () => r(!0), className: "cursor-pointer text-xs", children: [
1509
+ J.OPEN,
1510
+ " publish menu"
1511
+ ] }),
1512
+ I && /* @__PURE__ */ g(fe, { onClick: () => l(t), className: "cursor-pointer text-xs", children: [
1513
+ J.UNPUBLISH,
1514
+ " page ",
1515
+ e ? `(${Bn(e)})` : ""
1516
+ ] })
1517
+ ] })
1518
+ ] })
1519
+ ] }),
1520
+ /* @__PURE__ */ c(va, { showModal: s, onClose: () => r(!1) }),
1521
+ o && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(Ca, { page: o, onClose: () => l(null) }) }),
1522
+ f && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
1523
+ La,
1524
+ {
1525
+ isOpen: f,
1526
+ onClose: ye,
1527
+ onContinue: C,
1528
+ isPending: y
1529
+ }
1530
+ ) })
1531
+ ] });
1532
+ };
1533
+ function xa() {
1534
+ const { isLocked: e } = be(), [t] = le(), n = t.get("lang"), s = Ss(n);
1535
+ return e || !s ? /* @__PURE__ */ c("div", {}) : /* @__PURE__ */ g("div", { className: "flex items-center justify-end gap-1", children: [
1536
+ /* @__PURE__ */ c(Ta, {}),
1537
+ /* @__PURE__ */ c(rn, { permission: de.EDIT_THEME, children: /* @__PURE__ */ c(Da, {}) }),
1538
+ /* @__PURE__ */ c(ka, {}),
1539
+ /* @__PURE__ */ c(rn, { permission: de.SAVE_PAGE, children: /* @__PURE__ */ c(Ga, {}) }),
1540
+ /* @__PURE__ */ c(rn, { permission: de.PUBLISH_PAGE, children: /* @__PURE__ */ c(Oa, {}) })
1541
+ ] });
1542
+ }
1543
+ const Ra = ({
1544
+ page: e,
1545
+ setDuplicatePage: t,
1546
+ setAddEditPage: n,
1547
+ setUnpublishPage: s,
1548
+ setDeletePage: r,
1549
+ setMarkAsTemplate: i,
1550
+ setUnmarkAsTemplate: a,
1551
+ children: o,
1552
+ isLanguagePage: l
1553
+ }) => {
1554
+ const { hasPermission: d } = hs(), { data: f } = Ie(), u = Q(() => se(f, { key: e.pageType }), [f, e.pageType]), h = Q(() => !!e.isTemplate, [e.isTemplate]), m = Q(() => !!(u != null && u.hasSlug), [u == null ? void 0 : u.hasSlug]);
1555
+ return !d(de.EDIT_PAGE) && !d(de.DELETE_PAGE) && !d(de.UNPUBLISH_PAGE) || !e ? null : /* @__PURE__ */ g(Pn, { children: [
1556
+ /* @__PURE__ */ c(wn, { asChild: !0, onClick: (A) => A.stopPropagation(), children: o }),
1557
+ /* @__PURE__ */ g(vn, { align: "center", className: "text-sm", children: [
1558
+ d(de.ADD_PAGE) && !l && /* @__PURE__ */ g(
1559
+ fe,
1560
+ {
1561
+ className: "flex cursor-pointer items-center gap-2",
1562
+ onClick: (A) => {
1563
+ A.stopPropagation(), t(e);
1564
+ },
1565
+ children: [
1566
+ /* @__PURE__ */ c(Ni, { className: "size-3" }),
1567
+ "Duplicate page"
1568
+ ]
1569
+ }
1570
+ ),
1571
+ d(de.EDIT_PAGE) && /* @__PURE__ */ g(
1572
+ fe,
1573
+ {
1574
+ className: "flex cursor-pointer items-center gap-2",
1575
+ onClick: (A) => {
1576
+ A.stopPropagation(), n({
1577
+ ...e,
1578
+ global: !(u != null && u.hasSlug)
1579
+ });
1580
+ },
1581
+ children: [
1582
+ /* @__PURE__ */ c(Ci, { className: "size-3" }),
1583
+ "Edit"
1584
+ ]
1585
+ }
1586
+ ),
1587
+ (e == null ? void 0 : e.online) && d(de.UNPUBLISH_PAGE) && /* @__PURE__ */ g(
1588
+ fe,
1589
+ {
1590
+ className: "flex cursor-pointer items-center gap-2",
1591
+ onClick: (A) => {
1592
+ A.stopPropagation(), s(e);
1593
+ },
1594
+ children: [
1595
+ /* @__PURE__ */ c(Li, { className: "size-3" }),
1596
+ J.UNPUBLISH
1597
+ ]
1598
+ }
1599
+ ),
1600
+ d(de.DELETE_PAGE) && /* @__PURE__ */ g(
1601
+ fe,
1602
+ {
1603
+ className: "flex cursor-pointer items-center gap-2",
1604
+ onClick: (A) => {
1605
+ A.stopPropagation(), r(e);
1606
+ },
1607
+ children: [
1608
+ /* @__PURE__ */ c(ki, { className: "size-3" }),
1609
+ J.DELETE
1610
+ ]
1611
+ }
1612
+ ),
1613
+ d(de.MARK_AS_TEMPLATE) && m && !l && /* @__PURE__ */ c(me, { children: h ? /* @__PURE__ */ g(
1614
+ fe,
1615
+ {
1616
+ className: "flex cursor-pointer items-center gap-2",
1617
+ onClick: (A) => {
1618
+ A.stopPropagation(), a(e);
1619
+ },
1620
+ children: [
1621
+ /* @__PURE__ */ c(Hn, { className: "size-3" }),
1622
+ J.UNMARK_AS_TEMPLATE
1623
+ ]
1624
+ }
1625
+ ) : /* @__PURE__ */ g(
1626
+ fe,
1627
+ {
1628
+ className: "flex cursor-pointer items-center gap-2",
1629
+ onClick: (A) => {
1630
+ A.stopPropagation(), i(e);
1631
+ },
1632
+ children: [
1633
+ /* @__PURE__ */ c(Hn, { className: "size-3" }),
1634
+ J.MARK_AS_TEMPLATE
1635
+ ]
1636
+ }
1637
+ ) })
1638
+ ] })
1639
+ ] });
1640
+ }, Ua = q(() => import("./add-new-page-JY6dRnC4.js")), Ba = q(() => import("./delete-page-Dfa2vyQB.js")), Ma = q(() => import("./duplicate-page-B0urG1pP.js")), Fa = q(() => import("./mark-as-template-B22EANHN.js")), qa = q(() => import("./unmark-as-template-DXFRY_pc.js")), Ka = q(() => import("./unpublish-page-DMteaCpR.js")), Va = () => {
1641
+ const [e, t] = F(null), [n, s] = F(null), [r, i] = F(null), [a, o] = F(null), [l, d] = F(null), [f, u] = F(null), { data: h, isFetching: m } = ve(), { selectedLang: y, fallbackLang: A } = Oe(), { data: T } = xe(), p = T == null ? void 0 : T.find((C) => C.lang === y), { isLocked: S } = be(), I = !(h != null && h.slug), [, R] = te(Ln);
1642
+ if (!h) return null;
1643
+ const B = (C) => {
1644
+ y.length > 0 && y !== A ? R({
1645
+ edit: !0,
1646
+ id: C == null ? void 0 : C.id,
1647
+ primaryPage: C == null ? void 0 : C.primaryPage
1648
+ }) : u(C);
1649
+ };
1650
+ return /* @__PURE__ */ g(me, { children: [
1651
+ /* @__PURE__ */ g("div", { className: "flex items-center justify-between rounded px-[2px] transition-colors duration-200", children: [
1652
+ /* @__PURE__ */ c(vs, { children: /* @__PURE__ */ c(
1653
+ U,
1654
+ {
1655
+ className: "flex h-7 max-w-[200px] cursor-pointer items-center truncate rounded px-1 text-xs font-medium",
1656
+ variant: "ghost",
1657
+ children: m ? /* @__PURE__ */ c(Ft, { className: "h-4 w-4 animate-spin text-slate-400" }) : /* @__PURE__ */ g("span", { className: "flex w-full cursor-pointer items-end overflow-hidden text-ellipsis whitespace-nowrap rounded-sm text-xs font-medium", children: [
1658
+ I ? /* @__PURE__ */ c(Di, { className: "mr-1 h-4 w-4" }) : /* @__PURE__ */ c(Gi, { className: "mr-1 h-4 w-4" }),
1659
+ K(p || h, "name") ?? ""
1660
+ ] })
1661
+ }
1662
+ ) }),
1663
+ S ? /* @__PURE__ */ c(
1664
+ U,
1665
+ {
1666
+ variant: "ghost",
1667
+ size: "icon",
1668
+ className: "h-7 w-7 cursor-not-allowed rounded opacity-50 hover:bg-transparent",
1669
+ children: /* @__PURE__ */ c($n, { className: "h-4 w-4" })
1670
+ }
1671
+ ) : /* @__PURE__ */ c(
1672
+ Ra,
1673
+ {
1674
+ page: h,
1675
+ setDuplicatePage: (C) => d(C),
1676
+ setAddEditPage: (C) => B(C),
1677
+ setUnpublishPage: (C) => s(C),
1678
+ setDeletePage: (C) => t(C),
1679
+ setMarkAsTemplate: (C) => i(C),
1680
+ setUnmarkAsTemplate: (C) => o(C),
1681
+ isLanguagePage: y.length > 0 && y !== A,
1682
+ children: /* @__PURE__ */ c(U, { variant: "ghost", size: "icon", className: "h-7 w-7 rounded", children: /* @__PURE__ */ c($n, { className: "h-4 w-4" }) })
1683
+ }
1684
+ )
1685
+ ] }),
1686
+ f && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
1687
+ Ua,
1688
+ {
1689
+ closePanel: () => u(null),
1690
+ editPage: () => {
1691
+ },
1692
+ addEditPage: f,
1693
+ setAddEditPage: u
1694
+ }
1695
+ ) }),
1696
+ e && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(Ba, { page: e, onClose: () => t(null) }) }),
1697
+ n && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(Ka, { page: n, onClose: () => s(null) }) }),
1698
+ r && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(Fa, { page: r, onClose: () => i(null) }) }),
1699
+ a && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(qa, { page: a, onClose: () => o(null) }) }),
1700
+ l && /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
1701
+ Ma,
1702
+ {
1703
+ page: l,
1704
+ onClose: () => d(null),
1705
+ closePanel: () => u(null)
1706
+ }
1707
+ ) })
1708
+ ] });
1709
+ }, Is = ({ children: e, className: t = "" }) => /* @__PURE__ */ c(
1710
+ "div",
1711
+ {
1712
+ className: Mt(
1713
+ "fixed bottom-0 left-0 right-0 top-[50px] z-[20] flex w-screen flex-col items-center justify-center bg-black/40 transition-all",
1714
+ t
1715
+ ),
1716
+ children: e
1717
+ }
1718
+ ), Ha = ({ hasDynamicPage: e }) => /* @__PURE__ */ c(Is, { children: /* @__PURE__ */ g("div", { className: "flex min-w-[300px] max-w-[400px] flex-col items-center justify-center rounded-lg border bg-white p-4 shadow-lg", children: [
1719
+ /* @__PURE__ */ c("h1", { className: "text-lg font-medium", children: e ? "Select a page" : "No pages found" }),
1720
+ /* @__PURE__ */ c("p", { className: "pt-2 text-center text-sm font-light text-gray-600", children: e ? "Please select a page from the list in the top header. This will enable you to edit the page." : "Please add a new page" })
1721
+ ] }) }), $a = q(() => import("./dynamic-page-selector-CyhZ0SRO.js")), Qa = () => {
1722
+ const { dynamicPage: e, allLangPages: t, isFetching: n } = Xi(), s = t.length > 0;
1723
+ return n ? null : /* @__PURE__ */ g("div", { className: "relative", children: [
1724
+ !e && /* @__PURE__ */ c(Ha, { hasDynamicPage: s }),
1725
+ /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c($a, {}) })
1726
+ ] });
1727
+ }, ja = () => {
1728
+ const { data: e, isFetching: t } = ve(), { data: n, isFetching: s } = oe(), r = K(n, "dynamic", !1), i = In(), a = Fr("dynamic-page-selector"), o = e == null ? void 0 : e.slug, l = !o, d = na(), f = t || s, h = (l ? `Partial: ${e == null ? void 0 : e.name} ` : `${o}${i}`).replace(window.location.host, "");
1729
+ return /* @__PURE__ */ g("div", { className: "relative flex items-center gap-x-1", children: [
1730
+ /* @__PURE__ */ c(
1731
+ "div",
1732
+ {
1733
+ className: Mt(
1734
+ "flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800",
1735
+ f && "max-w-0 overflow-hidden opacity-0"
1736
+ ),
1737
+ children: /* @__PURE__ */ c(Va, {})
1738
+ }
1739
+ ),
1740
+ /* @__PURE__ */ g(
1741
+ "div",
1742
+ {
1743
+ className: Mt(
1744
+ "flex h-8 w-auto max-w-[600px] items-center rounded-md border border-gray-200 bg-white shadow-sm dark:border-gray-700 dark:bg-gray-800" + (l ? " pr-2" : ""),
1745
+ f && "max-w-0 overflow-hidden opacity-0"
1746
+ ),
1747
+ children: [
1748
+ /* @__PURE__ */ c(Ea, {}),
1749
+ /* @__PURE__ */ g("div", { className: "flex w-full items-center overflow-hidden", children: [
1750
+ /* @__PURE__ */ c(
1751
+ "div",
1752
+ {
1753
+ className: `w-full max-w-[200px] overflow-hidden overflow-ellipsis whitespace-nowrap pl-1 text-xs ${l ? "italic text-gray-400" : "font-mono text-gray-500"}`,
1754
+ children: h === "/" ? /* @__PURE__ */ g("span", { className: "text-gray-900", children: [
1755
+ "/",
1756
+ /* @__PURE__ */ c("span", { className: "text-[11px] font-light italic text-gray-400", children: "(Homepage)" })
1757
+ ] }) : h
1758
+ }
1759
+ ),
1760
+ !l && /* @__PURE__ */ c("a", { href: d, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ c("div", { className: "ml-2 mr-px flex-shrink-0 rounded-sm p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300", children: /* @__PURE__ */ c(Oi, { className: "h-4 w-4", strokeWidth: 1 }) }) })
1761
+ ] })
1762
+ ]
1763
+ }
1764
+ ),
1765
+ r && a && /* @__PURE__ */ c(Qa, {})
1766
+ ] });
1767
+ }, Wa = () => /* @__PURE__ */ g("div", { className: "flex h-full w-full items-center justify-between px-2", children: [
1768
+ /* @__PURE__ */ c(pa, {}),
1769
+ /* @__PURE__ */ c(ja, {}),
1770
+ /* @__PURE__ */ c(xa, {})
1771
+ ] }), Ns = () => {
1772
+ const e = Z(), { data: t } = ie({
1773
+ queryKey: [E.AI_CONTEXT],
1774
+ initialData: "",
1775
+ queryFn: () => "",
1776
+ staleTime: 0
1777
+ });
1778
+ return { setAiContext: H(
1779
+ (s) => {
1780
+ e.setQueryData([E.AI_CONTEXT], s);
1781
+ },
1782
+ [e]
1783
+ ), aiContext: t };
1784
+ }, za = () => {
1785
+ const e = x(), { aiContext: t } = Ns(), n = O();
1786
+ return H(
1787
+ async (s, r, i, a) => n(e, {
1788
+ action: E.ASK_AI,
1789
+ data: { type: s, prompt: r, blocks: i, context: t, lang: a }
1790
+ }),
1791
+ [e, t, n]
1792
+ );
1793
+ }, Ya = (e, t) => t.map((n) => {
1794
+ if (jt(e, n._type)) {
1795
+ const s = Hi(n._type);
1796
+ return {
1797
+ ...s,
1798
+ ..._n(n, [
1799
+ ...Ir(s),
1800
+ "_type",
1801
+ "_id",
1802
+ "_name",
1803
+ "_parent",
1804
+ "_bindings"
1805
+ ]),
1806
+ ...Nr(n, (r, i) => Cr(i, "_attrs")),
1807
+ ...n
1808
+ };
1809
+ }
1810
+ return n;
1811
+ }), Ja = (e) => {
1812
+ const t = Vi();
1813
+ return Q(() => {
1814
+ if (!e || ge(e)) return { blocks: [] };
1815
+ const n = ds(
1816
+ e,
1817
+ (s) => !br(s == null ? void 0 : s._type, "@chai/")
1818
+ );
1819
+ return { blocks: Ya(t, n) };
1820
+ }, [e, t]);
1821
+ }, Xa = () => {
1822
+ const [e] = le(), t = e.get("page"), n = x(), { setAiContext: s } = Ns(), [, r] = Nn(), [, i] = ta(), [, a] = qr(), o = O();
1823
+ return ie({
1824
+ queryKey: [E.GET_DRAFT_PAGE, t],
1825
+ staleTime: 1 / 0,
1826
+ gcTime: 0,
1827
+ queryFn: async () => {
1828
+ a(!1);
1829
+ const l = await o(n, {
1830
+ action: E.GET_DRAFT_PAGE,
1831
+ data: { id: t, draft: !0 }
1832
+ }), d = l.blocks ?? [], f = se(d, { _type: "@chai/ai-context" });
1833
+ return s(K(f, "_value", "") || ""), r((u) => ({ ...u, lastSaved: l.lastSaved })), i(K(l, "metadata", {})), setTimeout(() => a(!0), 500), d;
1834
+ },
1835
+ enabled: !!t
1836
+ });
1837
+ }, Za = () => {
1838
+ const { data: e } = oe(), { data: t } = ve(), n = x(), s = O(), r = kn(), i = In();
1839
+ return ie({
1840
+ queryKey: [E.GET_BUILDER_PAGE_DATA, t == null ? void 0 : t.id, i],
1841
+ staleTime: 1 / 0,
1842
+ gcTime: 0,
1843
+ queryFn: async () => s(n, {
1844
+ action: E.GET_BUILDER_PAGE_DATA,
1845
+ data: {
1846
+ pageType: e == null ? void 0 : e.pageType,
1847
+ lang: (t == null ? void 0 : t.lang) || r,
1848
+ dynamic: e == null ? void 0 : e.dynamic,
1849
+ pageProps: {
1850
+ slug: (t == null ? void 0 : t.slug) + i,
1851
+ searchParams: {},
1852
+ pageType: t == null ? void 0 : t.pageType,
1853
+ fallbackLang: r,
1854
+ lastSaved: t.lastSaved,
1855
+ pageId: e.id,
1856
+ primaryPageId: t.primaryPage || e.id,
1857
+ pageBaseSlug: t == null ? void 0 : t.slug,
1858
+ dynamic: e == null ? void 0 : e.dynamic,
1859
+ //
1860
+ languagePageId: t.id,
1861
+ metadata: e.metadata || {}
1862
+ }
1863
+ }
1864
+ }),
1865
+ enabled: !!(e != null && e.pageType) && !!t.id
1866
+ });
1867
+ }, eo = () => {
1868
+ const e = x(), t = Z(), n = O();
1869
+ return ae({
1870
+ mutationFn: async (s) => n(e, {
1871
+ action: E.UPDATE_WEBSITE_SETTINGS,
1872
+ data: s
1873
+ }),
1874
+ onSuccess: (s, r) => {
1875
+ var i;
1876
+ t.invalidateQueries({
1877
+ queryKey: [E.GET_WEBSITE_DRAFT_SETTINGS]
1878
+ }), (i = r == null ? void 0 : r.settings) != null && i.theme || W.success("Website settings updated successfully.");
1879
+ },
1880
+ onError: (s) => {
1881
+ W.error("Failed to update website settings", {
1882
+ description: s.message
1883
+ });
1884
+ }
1885
+ });
1886
+ }, Cc = () => {
1887
+ const e = x(), t = Z(), n = O();
1888
+ return ae({
1889
+ mutationFn: async (s) => n(e, { action: E.UPDATE_APP_SHARED_JSONLD, data: JSON.stringify(s) }),
1890
+ onSuccess: () => {
1891
+ t.invalidateQueries({
1892
+ queryKey: [E.GET_APP_SHARED_JSONLD]
1893
+ }), W.success("Shared JSON-LD updated successfully.");
1894
+ },
1895
+ onError: (s) => {
1896
+ W.error("Failed to update shared JSON-LD", {
1897
+ description: s.message
1898
+ });
1899
+ }
1900
+ });
1901
+ }, Wn = {
1902
+ async getUILibraryBlock(e, t, n) {
1903
+ const s = await t(n, {
1904
+ action: "GET_LIBRARY_ITEM",
1905
+ data: { id: e.id }
1906
+ }), r = K(s, "html", ""), i = K(s, "blocks", []);
1907
+ return Lr(i) ? i : Vr(r);
1908
+ },
1909
+ async getUILibraryBlocks(e, t, n) {
1910
+ try {
1911
+ return (await t(n, {
1912
+ action: "GET_LIBRARY_ITEMS",
1913
+ data: { id: e.id }
1914
+ })).map((r) => ({
1915
+ ...r
1916
+ }));
1917
+ } catch (s) {
1918
+ return console.error(s), [];
1919
+ }
1920
+ }
1921
+ }, to = () => {
1922
+ const e = x(), t = O();
1923
+ return ie({
1924
+ queryKey: ["uiLibraries"],
1925
+ staleTime: "static",
1926
+ queryFn: async () => {
1927
+ const s = (await t(e, { action: "GET_LIBRARIES" })).map((r) => ({
1928
+ ...r
1929
+ }));
1930
+ return s.forEach((r) => {
1931
+ Kr(r.id, {
1932
+ name: r.isSiteLibrary ? r.name + " (Current Site) " : r.name,
1933
+ description: r.description,
1934
+ getBlocksList: (i) => Wn.getUILibraryBlocks(i, t, e),
1935
+ getBlock: ({ block: i }) => Wn.getUILibraryBlock(i, t, e)
1936
+ });
1937
+ }), s;
1938
+ }
1939
+ });
1940
+ }, no = () => {
1941
+ const e = As(), t = O(), { user: n } = It(), s = n == null ? void 0 : n.id;
1942
+ return ie({
1943
+ queryKey: [E.GET_ROLE_AND_PERMISSIONS, s],
1944
+ queryFn: () => t(e, {
1945
+ action: E.GET_ROLE_AND_PERMISSIONS,
1946
+ data: { userId: s }
1947
+ }),
1948
+ enabled: !!s,
1949
+ staleTime: 1 / 0
1950
+ });
1951
+ }, so = () => {
1952
+ const e = x(), t = O(), [, n] = Nn();
1953
+ return { onSave: async ({
1954
+ page: r,
1955
+ blocks: i,
1956
+ needTranslations: a
1957
+ }) => {
1958
+ try {
1959
+ const o = await t(e, {
1960
+ action: "UPDATE_PAGE",
1961
+ data: { id: r, blocks: i, needTranslations: a }
1962
+ });
1963
+ return o.code === "PAGE_LOCKED" ? !0 : (n((l) => ({
1964
+ ...l,
1965
+ lastSaved: (/* @__PURE__ */ new Date()).toISOString()
1966
+ })), o);
1967
+ } catch (o) {
1968
+ return console.error(o), new Error("Failed to save blocks");
1969
+ }
1970
+ } };
1971
+ }, ro = () => {
1972
+ const { data: e } = ws(), t = x(), n = O();
1973
+ return {
1974
+ getPartialBlocks: H(async () => {
1975
+ const s = {};
1976
+ for (const r of e ?? [])
1977
+ ge(r == null ? void 0 : r.slug) && (s[r.id] = {
1978
+ type: r.pageType,
1979
+ name: kr(r.name ?? r.slug),
1980
+ description: ""
1981
+ });
1982
+ return s;
1983
+ }, [e]),
1984
+ getPartialBlockBlocks: H(
1985
+ async (s) => {
1986
+ if (!s) return [];
1987
+ try {
1988
+ const r = await n(t, {
1989
+ action: "GET_DRAFT_PAGE",
1990
+ data: { id: s, draft: !0, editor: !1 }
1991
+ });
1992
+ return ds(r.blocks, (i) => jt(i, "_id"));
1993
+ } catch (r) {
1994
+ return console.error(r), [];
1995
+ }
1996
+ },
1997
+ [n, t]
1998
+ )
1999
+ };
2000
+ }, io = q(() => import("./lang-panel-D0IN38gF.js")), ao = ({ isActive: e, show: t }) => {
2001
+ const { data: n } = Re();
2002
+ return !jt(n, "languages") || !K(n, "languages", []).length ? null : /* @__PURE__ */ c(U, { size: "sm", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ c(xi, { className: "h-4 w-4" }) });
2003
+ }, Cs = "lang", oo = {
2004
+ id: Cs,
2005
+ label: "Languages",
2006
+ position: "top",
2007
+ panel: io,
2008
+ button: ao,
2009
+ view: "modal",
2010
+ width: 400
2011
+ }, lo = q(() => import("./seo-panel-D75jQH_j.js")), Ls = "seo", co = ({ isActive: e, show: t }) => {
2012
+ const { data: n } = oe(), s = _a(n == null ? void 0 : n.pageType);
2013
+ return !jt(s, "hasSlug") || !s.hasSlug ? null : /* @__PURE__ */ c(U, { size: "icon", className: "my-1 p-0", onClick: t, variant: e ? "default" : "ghost", children: /* @__PURE__ */ g(
2014
+ "svg",
2015
+ {
2016
+ stroke: "currentColor",
2017
+ fill: "none",
2018
+ style: { height: "20px", width: "20px" },
2019
+ strokeWidth: "2",
2020
+ viewBox: "0 0 24 24",
2021
+ strokeLinecap: "round",
2022
+ strokeLinejoin: "round",
2023
+ children: [
2024
+ /* @__PURE__ */ c("path", { d: "M7 8h-3a1 1 0 0 0 -1 1v2a1 1 0 0 0 1 1h2a1 1 0 0 1 1 1v2a1 1 0 0 1 -1 1h-3" }),
2025
+ /* @__PURE__ */ c("path", { d: "M14 16h-4v-8h4" }),
2026
+ /* @__PURE__ */ c("path", { d: "M11 12h2" }),
2027
+ /* @__PURE__ */ c("path", { d: "M17 8m0 1a1 1 0 0 1 1 -1h2a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-2a1 1 0 0 1 -1 -1z" })
2028
+ ]
2029
+ }
2030
+ ) });
2031
+ }, uo = {
2032
+ id: Ls,
2033
+ label: "SEO",
2034
+ panel: lo,
2035
+ button: co,
2036
+ position: "top",
2037
+ width: 600,
2038
+ view: "modal"
2039
+ }, ks = "user-info", fo = () => {
2040
+ const { user: e, logout: t } = It(), n = re("onLogout", cs);
2041
+ return e ? /* @__PURE__ */ g(Zr, { children: [
2042
+ /* @__PURE__ */ c(ei, { asChild: !0, children: /* @__PURE__ */ c(U, { variant: "ghost", className: "text-sm font-medium", children: /* @__PURE__ */ c(Ri, { className: "h-4 w-4" }) }) }),
2043
+ /* @__PURE__ */ g(ti, { className: "w-auto space-y-2 p-4", children: [
2044
+ /* @__PURE__ */ c("div", { className: "text-sm font-medium", children: e.name ?? e.email }),
2045
+ /* @__PURE__ */ c("div", { className: "text-xs text-muted-foreground", children: e.email }),
2046
+ /* @__PURE__ */ g(ni, { children: [
2047
+ /* @__PURE__ */ c(si, { asChild: !0, children: /* @__PURE__ */ c(U, { variant: "outline", size: "sm", className: "w-full", children: "Logout" }) }),
2048
+ /* @__PURE__ */ g(ri, { children: [
2049
+ /* @__PURE__ */ g(ii, { children: [
2050
+ /* @__PURE__ */ c(ai, { children: "Are you sure you want to logout?" }),
2051
+ /* @__PURE__ */ c(oi, { children: "You will be redirected to the login page." })
2052
+ ] }),
2053
+ /* @__PURE__ */ g(li, { children: [
2054
+ /* @__PURE__ */ c(ci, { children: "Cancel" }),
2055
+ /* @__PURE__ */ c(
2056
+ ui,
2057
+ {
2058
+ onClick: () => {
2059
+ t(), Dr(n) && n();
2060
+ },
2061
+ children: "Logout"
2062
+ }
2063
+ )
2064
+ ] })
2065
+ ] })
2066
+ ] })
2067
+ ] })
2068
+ ] }) : null;
2069
+ }, ho = {
2070
+ id: ks,
2071
+ label: "User Info",
2072
+ button: fo,
2073
+ position: "bottom"
2074
+ }, go = () => {
2075
+ en(Ls, uo), en(Cs, oo), en(ks, ho);
2076
+ };
2077
+ var P = {
2078
+ context: void 0,
2079
+ registry: void 0,
2080
+ effects: void 0,
2081
+ done: !1,
2082
+ getContextId() {
2083
+ return zn(this.context.count);
2084
+ },
2085
+ getNextContextId() {
2086
+ return zn(this.context.count++);
2087
+ }
2088
+ };
2089
+ function zn(e) {
2090
+ const t = String(e), n = t.length - 1;
2091
+ return P.context.id + (n ? String.fromCharCode(96 + n) : "") + t;
2092
+ }
2093
+ function it(e) {
2094
+ P.context = e;
2095
+ }
2096
+ var Ds = !1, mo = (e, t) => e === t, qt = Symbol("solid-proxy"), Gs = typeof Proxy == "function", Os = Symbol("solid-track"), Kt = {
2097
+ equals: mo
2098
+ }, xs = Ks, Se = 1, Vt = 2, Rs = {
2099
+ owned: null,
2100
+ cleanups: null,
2101
+ context: null,
2102
+ owner: null
2103
+ }, on = {}, b = null, ln = null, Eo = null, D = null, ee = null, Te = null, Jt = 0;
2104
+ function ke(e, t) {
2105
+ const n = D, s = b, r = e.length === 0, i = t === void 0 ? s : t, a = r ? Rs : {
2106
+ owned: null,
2107
+ cleanups: null,
2108
+ context: i ? i.context : null,
2109
+ owner: i
2110
+ }, o = r ? e : () => e(() => X(() => ut(a)));
2111
+ b = a, D = null;
2112
+ try {
2113
+ return Ee(o, !0);
2114
+ } finally {
2115
+ D = n, b = s;
2116
+ }
2117
+ }
2118
+ function M(e, t) {
2119
+ t = t ? Object.assign({}, Kt, t) : Kt;
2120
+ const n = {
2121
+ value: e,
2122
+ observers: null,
2123
+ observerSlots: null,
2124
+ comparator: t.equals || void 0
2125
+ }, s = (r) => (typeof r == "function" && (r = r(n.value)), qs(n, r));
2126
+ return [Fs.bind(n), s];
2127
+ }
2128
+ function po(e, t, n) {
2129
+ const s = Xt(e, t, !0, Se);
2130
+ nt(s);
2131
+ }
2132
+ function De(e, t, n) {
2133
+ const s = Xt(e, t, !1, Se);
2134
+ nt(s);
2135
+ }
2136
+ function Us(e, t, n) {
2137
+ xs = bo;
2138
+ const s = Xt(e, t, !1, Se);
2139
+ (!n || !n.render) && (s.user = !0), Te ? Te.push(s) : nt(s);
2140
+ }
2141
+ function Y(e, t, n) {
2142
+ n = n ? Object.assign({}, Kt, n) : Kt;
2143
+ const s = Xt(e, t, !0, 0);
2144
+ return s.observers = null, s.observerSlots = null, s.comparator = n.equals || void 0, nt(s), Fs.bind(s);
2145
+ }
2146
+ function yo(e) {
2147
+ return e && typeof e == "object" && "then" in e;
2148
+ }
2149
+ function Ao(e, t, n) {
2150
+ let s, r, i;
2151
+ s = !0, r = e, i = {};
2152
+ let a = null, o = on, l = null, d = !1, f = "initialValue" in i, u = typeof s == "function" && Y(s);
2153
+ const h = /* @__PURE__ */ new Set(), [m, y] = (i.storage || M)(i.initialValue), [A, T] = M(void 0), [p, S] = M(void 0, {
2154
+ equals: !1
2155
+ }), [I, R] = M(f ? "ready" : "unresolved");
2156
+ P.context && (l = P.getNextContextId(), i.ssrLoadFrom === "initial" ? o = i.initialValue : P.load && P.has(l) && (o = P.load(l)));
2157
+ function B(w, v, z, $) {
2158
+ return a === w && (a = null, $ !== void 0 && (f = !0), (w === o || v === o) && i.onHydrated && queueMicrotask(() => i.onHydrated($, {
2159
+ value: v
2160
+ })), o = on, C(v, z)), v;
2161
+ }
2162
+ function C(w, v) {
2163
+ Ee(() => {
2164
+ v === void 0 && y(() => w), R(v !== void 0 ? "errored" : f ? "ready" : "unresolved"), T(v);
2165
+ for (const z of h.keys()) z.decrement();
2166
+ h.clear();
2167
+ }, !1);
2168
+ }
2169
+ function ye() {
2170
+ const w = Po, v = m(), z = A();
2171
+ if (z !== void 0 && !a) throw z;
2172
+ return D && D.user, v;
2173
+ }
2174
+ function Ae(w = !0) {
2175
+ if (w !== !1 && d) return;
2176
+ d = !1;
2177
+ const v = u ? u() : s;
2178
+ if (v == null || v === !1) {
2179
+ B(a, X(m));
2180
+ return;
2181
+ }
2182
+ let z;
2183
+ const $ = o !== on ? o : X(() => {
2184
+ try {
2185
+ return r(v, {
2186
+ value: m(),
2187
+ refetching: w
2188
+ });
2189
+ } catch (ce) {
2190
+ z = ce;
2191
+ }
2192
+ });
2193
+ if (z !== void 0) {
2194
+ B(a, void 0, Rt(z), v);
2195
+ return;
2196
+ } else if (!yo($))
2197
+ return B(a, $, void 0, v), $;
2198
+ return a = $, "v" in $ ? ($.s === 1 ? B(a, $.v, void 0, v) : B(a, void 0, Rt($.v), v), $) : (d = !0, queueMicrotask(() => d = !1), Ee(() => {
2199
+ R(f ? "refreshing" : "pending"), S();
2200
+ }, !1), $.then((ce) => B($, ce, void 0, v), (ce) => B($, void 0, Rt(ce), v)));
2201
+ }
2202
+ Object.defineProperties(ye, {
2203
+ state: {
2204
+ get: () => I()
2205
+ },
2206
+ error: {
2207
+ get: () => A()
2208
+ },
2209
+ loading: {
2210
+ get() {
2211
+ const w = I();
2212
+ return w === "pending" || w === "refreshing";
2213
+ }
2214
+ },
2215
+ latest: {
2216
+ get() {
2217
+ if (!f) return ye();
2218
+ const w = A();
2219
+ if (w && !a) throw w;
2220
+ return m();
2221
+ }
2222
+ }
2223
+ });
2224
+ let k = b;
2225
+ return u ? po(() => (k = b, Ae(!1))) : Ae(!1), [ye, {
2226
+ refetch: (w) => Bs(k, () => Ae(w)),
2227
+ mutate: y
2228
+ }];
2229
+ }
2230
+ function Lc(e) {
2231
+ return Ee(e, !1);
2232
+ }
2233
+ function X(e) {
2234
+ if (D === null) return e();
2235
+ const t = D;
2236
+ D = null;
2237
+ try {
2238
+ return e();
2239
+ } finally {
2240
+ D = t;
2241
+ }
2242
+ }
2243
+ function kc(e, t, n) {
2244
+ const s = Array.isArray(e);
2245
+ let r, i = n && n.defer;
2246
+ return (a) => {
2247
+ let o;
2248
+ if (s) {
2249
+ o = Array(e.length);
2250
+ for (let d = 0; d < e.length; d++) o[d] = e[d]();
2251
+ } else o = e();
2252
+ if (i)
2253
+ return i = !1, a;
2254
+ const l = X(() => t(o, r, a));
2255
+ return r = o, l;
2256
+ };
2257
+ }
2258
+ function To(e) {
2259
+ Us(() => X(e));
2260
+ }
2261
+ function ct(e) {
2262
+ return b === null || (b.cleanups === null ? b.cleanups = [e] : b.cleanups.push(e)), e;
2263
+ }
2264
+ function Yn() {
2265
+ return b;
2266
+ }
2267
+ function Bs(e, t) {
2268
+ const n = b, s = D;
2269
+ b = e, D = null;
2270
+ try {
2271
+ return Ee(t, !0);
2272
+ } catch (r) {
2273
+ Gn(r);
2274
+ } finally {
2275
+ b = n, D = s;
2276
+ }
2277
+ }
2278
+ function So(e) {
2279
+ const t = D, n = b;
2280
+ return Promise.resolve().then(() => {
2281
+ D = t, b = n;
2282
+ let s;
2283
+ return Ee(e, !1), D = b = null, s ? s.done : void 0;
2284
+ });
2285
+ }
2286
+ var [_o, Dc] = /* @__PURE__ */ M(!1);
2287
+ function Gc() {
2288
+ return [_o, So];
2289
+ }
2290
+ function Oc(e, t) {
2291
+ const n = Symbol("context");
2292
+ return {
2293
+ id: n,
2294
+ Provider: Io(n),
2295
+ defaultValue: e
2296
+ };
2297
+ }
2298
+ function xc(e) {
2299
+ let t;
2300
+ return b && b.context && (t = b.context[e.id]) !== void 0 ? t : e.defaultValue;
2301
+ }
2302
+ function Ms(e) {
2303
+ const t = Y(e), n = Y(() => fn(t()));
2304
+ return n.toArray = () => {
2305
+ const s = n();
2306
+ return Array.isArray(s) ? s : s != null ? [s] : [];
2307
+ }, n;
2308
+ }
2309
+ var Po;
2310
+ function Fs() {
2311
+ if (this.sources && this.state)
2312
+ if (this.state === Se) nt(this);
2313
+ else {
2314
+ const e = ee;
2315
+ ee = null, Ee(() => $t(this), !1), ee = e;
2316
+ }
2317
+ if (D) {
2318
+ const e = this.observers ? this.observers.length : 0;
2319
+ D.sources ? (D.sources.push(this), D.sourceSlots.push(e)) : (D.sources = [this], D.sourceSlots = [e]), this.observers ? (this.observers.push(D), this.observerSlots.push(D.sources.length - 1)) : (this.observers = [D], this.observerSlots = [D.sources.length - 1]);
2320
+ }
2321
+ return this.value;
2322
+ }
2323
+ function qs(e, t, n) {
2324
+ let s = e.value;
2325
+ return (!e.comparator || !e.comparator(s, t)) && (e.value = t, e.observers && e.observers.length && Ee(() => {
2326
+ for (let r = 0; r < e.observers.length; r += 1) {
2327
+ const i = e.observers[r], a = ln && ln.running;
2328
+ a && ln.disposed.has(i), (a ? !i.tState : !i.state) && (i.pure ? ee.push(i) : Te.push(i), i.observers && Vs(i)), a || (i.state = Se);
2329
+ }
2330
+ if (ee.length > 1e6)
2331
+ throw ee = [], new Error();
2332
+ }, !1)), t;
2333
+ }
2334
+ function nt(e) {
2335
+ if (!e.fn) return;
2336
+ ut(e);
2337
+ const t = Jt;
2338
+ wo(e, e.value, t);
2339
+ }
2340
+ function wo(e, t, n) {
2341
+ let s;
2342
+ const r = b, i = D;
2343
+ D = b = e;
2344
+ try {
2345
+ s = e.fn(t);
2346
+ } catch (a) {
2347
+ return e.pure && (e.state = Se, e.owned && e.owned.forEach(ut), e.owned = null), e.updatedAt = n + 1, Gn(a);
2348
+ } finally {
2349
+ D = i, b = r;
2350
+ }
2351
+ (!e.updatedAt || e.updatedAt <= n) && (e.updatedAt != null && "observers" in e ? qs(e, s) : e.value = s, e.updatedAt = n);
2352
+ }
2353
+ function Xt(e, t, n, s = Se, r) {
2354
+ const i = {
2355
+ fn: e,
2356
+ state: s,
2357
+ updatedAt: null,
2358
+ owned: null,
2359
+ sources: null,
2360
+ sourceSlots: null,
2361
+ cleanups: null,
2362
+ value: t,
2363
+ owner: b,
2364
+ context: b ? b.context : null,
2365
+ pure: n
2366
+ };
2367
+ return b === null || b !== Rs && (b.owned ? b.owned.push(i) : b.owned = [i]), i;
2368
+ }
2369
+ function Ht(e) {
2370
+ if (e.state === 0) return;
2371
+ if (e.state === Vt) return $t(e);
2372
+ if (e.suspense && X(e.suspense.inFallback)) return e.suspense.effects.push(e);
2373
+ const t = [e];
2374
+ for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < Jt); )
2375
+ e.state && t.push(e);
2376
+ for (let n = t.length - 1; n >= 0; n--)
2377
+ if (e = t[n], e.state === Se)
2378
+ nt(e);
2379
+ else if (e.state === Vt) {
2380
+ const s = ee;
2381
+ ee = null, Ee(() => $t(e, t[0]), !1), ee = s;
2382
+ }
2383
+ }
2384
+ function Ee(e, t) {
2385
+ if (ee) return e();
2386
+ let n = !1;
2387
+ t || (ee = []), Te ? n = !0 : Te = [], Jt++;
2388
+ try {
2389
+ const s = e();
2390
+ return vo(n), s;
2391
+ } catch (s) {
2392
+ n || (Te = null), ee = null, Gn(s);
2393
+ }
2394
+ }
2395
+ function vo(e) {
2396
+ if (ee && (Ks(ee), ee = null), e) return;
2397
+ const t = Te;
2398
+ Te = null, t.length && Ee(() => xs(t), !1);
2399
+ }
2400
+ function Ks(e) {
2401
+ for (let t = 0; t < e.length; t++) Ht(e[t]);
2402
+ }
2403
+ function bo(e) {
2404
+ let t, n = 0;
2405
+ for (t = 0; t < e.length; t++) {
2406
+ const s = e[t];
2407
+ s.user ? e[n++] = s : Ht(s);
2408
+ }
2409
+ if (P.context) {
2410
+ if (P.count) {
2411
+ P.effects || (P.effects = []), P.effects.push(...e.slice(0, n));
2412
+ return;
2413
+ }
2414
+ it();
2415
+ }
2416
+ for (P.effects && (P.done || !P.count) && (e = [...P.effects, ...e], n += P.effects.length, delete P.effects), t = 0; t < n; t++) Ht(e[t]);
2417
+ }
2418
+ function $t(e, t) {
2419
+ e.state = 0;
2420
+ for (let n = 0; n < e.sources.length; n += 1) {
2421
+ const s = e.sources[n];
2422
+ if (s.sources) {
2423
+ const r = s.state;
2424
+ r === Se ? s !== t && (!s.updatedAt || s.updatedAt < Jt) && Ht(s) : r === Vt && $t(s, t);
2425
+ }
2426
+ }
2427
+ }
2428
+ function Vs(e) {
2429
+ for (let t = 0; t < e.observers.length; t += 1) {
2430
+ const n = e.observers[t];
2431
+ n.state || (n.state = Vt, n.pure ? ee.push(n) : Te.push(n), n.observers && Vs(n));
2432
+ }
2433
+ }
2434
+ function ut(e) {
2435
+ let t;
2436
+ if (e.sources)
2437
+ for (; e.sources.length; ) {
2438
+ const n = e.sources.pop(), s = e.sourceSlots.pop(), r = n.observers;
2439
+ if (r && r.length) {
2440
+ const i = r.pop(), a = n.observerSlots.pop();
2441
+ s < r.length && (i.sourceSlots[a] = s, r[s] = i, n.observerSlots[s] = a);
2442
+ }
2443
+ }
2444
+ if (e.tOwned) {
2445
+ for (t = e.tOwned.length - 1; t >= 0; t--) ut(e.tOwned[t]);
2446
+ delete e.tOwned;
2447
+ }
2448
+ if (e.owned) {
2449
+ for (t = e.owned.length - 1; t >= 0; t--) ut(e.owned[t]);
2450
+ e.owned = null;
2451
+ }
2452
+ if (e.cleanups) {
2453
+ for (t = e.cleanups.length - 1; t >= 0; t--) e.cleanups[t]();
2454
+ e.cleanups = null;
2455
+ }
2456
+ e.state = 0;
2457
+ }
2458
+ function Rt(e) {
2459
+ return e instanceof Error ? e : new Error(typeof e == "string" ? e : "Unknown error", {
2460
+ cause: e
2461
+ });
2462
+ }
2463
+ function Gn(e, t = b) {
2464
+ throw Rt(e);
2465
+ }
2466
+ function fn(e) {
2467
+ if (typeof e == "function" && !e.length) return fn(e());
2468
+ if (Array.isArray(e)) {
2469
+ const t = [];
2470
+ for (let n = 0; n < e.length; n++) {
2471
+ const s = fn(e[n]);
2472
+ Array.isArray(s) ? t.push.apply(t, s) : t.push(s);
2473
+ }
2474
+ return t;
2475
+ }
2476
+ return e;
2477
+ }
2478
+ function Io(e, t) {
2479
+ return function(s) {
2480
+ let r;
2481
+ return De(() => r = X(() => (b.context = {
2482
+ ...b.context,
2483
+ [e]: s.value
2484
+ }, Ms(() => s.children))), void 0), r;
2485
+ };
2486
+ }
2487
+ var hn = Symbol("fallback");
2488
+ function Qt(e) {
2489
+ for (let t = 0; t < e.length; t++) e[t]();
2490
+ }
2491
+ function No(e, t, n = {}) {
2492
+ let s = [], r = [], i = [], a = 0, o = t.length > 1 ? [] : null;
2493
+ return ct(() => Qt(i)), () => {
2494
+ let l = e() || [], d = l.length, f, u;
2495
+ return l[Os], X(() => {
2496
+ let m, y, A, T, p, S, I, R, B;
2497
+ if (d === 0)
2498
+ a !== 0 && (Qt(i), i = [], s = [], r = [], a = 0, o && (o = [])), n.fallback && (s = [hn], r[0] = ke((C) => (i[0] = C, n.fallback())), a = 1);
2499
+ else if (a === 0) {
2500
+ for (r = new Array(d), u = 0; u < d; u++)
2501
+ s[u] = l[u], r[u] = ke(h);
2502
+ a = d;
2503
+ } else {
2504
+ for (A = new Array(d), T = new Array(d), o && (p = new Array(d)), S = 0, I = Math.min(a, d); S < I && s[S] === l[S]; S++) ;
2505
+ for (I = a - 1, R = d - 1; I >= S && R >= S && s[I] === l[R]; I--, R--)
2506
+ A[R] = r[I], T[R] = i[I], o && (p[R] = o[I]);
2507
+ for (m = /* @__PURE__ */ new Map(), y = new Array(R + 1), u = R; u >= S; u--)
2508
+ B = l[u], f = m.get(B), y[u] = f === void 0 ? -1 : f, m.set(B, u);
2509
+ for (f = S; f <= I; f++)
2510
+ B = s[f], u = m.get(B), u !== void 0 && u !== -1 ? (A[u] = r[f], T[u] = i[f], o && (p[u] = o[f]), u = y[u], m.set(B, u)) : i[f]();
2511
+ for (u = S; u < d; u++)
2512
+ u in A ? (r[u] = A[u], i[u] = T[u], o && (o[u] = p[u], o[u](u))) : r[u] = ke(h);
2513
+ r = r.slice(0, a = d), s = l.slice(0);
2514
+ }
2515
+ return r;
2516
+ });
2517
+ function h(m) {
2518
+ if (i[u] = m, o) {
2519
+ const [y, A] = M(u);
2520
+ return o[u] = A, t(l[u], y);
2521
+ }
2522
+ return t(l[u]);
2523
+ }
2524
+ };
2525
+ }
2526
+ function Co(e, t, n = {}) {
2527
+ let s = [], r = [], i = [], a = [], o = 0, l;
2528
+ return ct(() => Qt(i)), () => {
2529
+ const d = e() || [], f = d.length;
2530
+ return d[Os], X(() => {
2531
+ if (f === 0)
2532
+ return o !== 0 && (Qt(i), i = [], s = [], r = [], o = 0, a = []), n.fallback && (s = [hn], r[0] = ke((h) => (i[0] = h, n.fallback())), o = 1), r;
2533
+ for (s[0] === hn && (i[0](), i = [], s = [], r = [], o = 0), l = 0; l < f; l++)
2534
+ l < s.length && s[l] !== d[l] ? a[l](() => d[l]) : l >= s.length && (r[l] = ke(u));
2535
+ for (; l < s.length; l++)
2536
+ i[l]();
2537
+ return o = a.length = i.length = f, s = d.slice(0), r = r.slice(0, o);
2538
+ });
2539
+ function u(h) {
2540
+ i[l] = h;
2541
+ const [m, y] = M(d[l]);
2542
+ return a[l] = y, t(m, l);
2543
+ }
2544
+ };
2545
+ }
2546
+ function Hs(e, t) {
2547
+ return X(() => e(t || {}));
2548
+ }
2549
+ function kt() {
2550
+ return !0;
2551
+ }
2552
+ var gn = {
2553
+ get(e, t, n) {
2554
+ return t === qt ? n : e.get(t);
2555
+ },
2556
+ has(e, t) {
2557
+ return t === qt ? !0 : e.has(t);
2558
+ },
2559
+ set: kt,
2560
+ deleteProperty: kt,
2561
+ getOwnPropertyDescriptor(e, t) {
2562
+ return {
2563
+ configurable: !0,
2564
+ enumerable: !0,
2565
+ get() {
2566
+ return e.get(t);
2567
+ },
2568
+ set: kt,
2569
+ deleteProperty: kt
2570
+ };
2571
+ },
2572
+ ownKeys(e) {
2573
+ return e.keys();
2574
+ }
2575
+ };
2576
+ function cn(e) {
2577
+ return (e = typeof e == "function" ? e() : e) ? e : {};
2578
+ }
2579
+ function Lo() {
2580
+ for (let e = 0, t = this.length; e < t; ++e) {
2581
+ const n = this[e]();
2582
+ if (n !== void 0) return n;
2583
+ }
2584
+ }
2585
+ function $s(...e) {
2586
+ let t = !1;
2587
+ for (let a = 0; a < e.length; a++) {
2588
+ const o = e[a];
2589
+ t = t || !!o && qt in o, e[a] = typeof o == "function" ? (t = !0, Y(o)) : o;
2590
+ }
2591
+ if (Gs && t)
2592
+ return new Proxy({
2593
+ get(a) {
2594
+ for (let o = e.length - 1; o >= 0; o--) {
2595
+ const l = cn(e[o])[a];
2596
+ if (l !== void 0) return l;
2597
+ }
2598
+ },
2599
+ has(a) {
2600
+ for (let o = e.length - 1; o >= 0; o--)
2601
+ if (a in cn(e[o])) return !0;
2602
+ return !1;
2603
+ },
2604
+ keys() {
2605
+ const a = [];
2606
+ for (let o = 0; o < e.length; o++) a.push(...Object.keys(cn(e[o])));
2607
+ return [...new Set(a)];
2608
+ }
2609
+ }, gn);
2610
+ const n = {}, s = /* @__PURE__ */ Object.create(null);
2611
+ for (let a = e.length - 1; a >= 0; a--) {
2612
+ const o = e[a];
2613
+ if (!o) continue;
2614
+ const l = Object.getOwnPropertyNames(o);
2615
+ for (let d = l.length - 1; d >= 0; d--) {
2616
+ const f = l[d];
2617
+ if (f === "__proto__" || f === "constructor") continue;
2618
+ const u = Object.getOwnPropertyDescriptor(o, f);
2619
+ if (!s[f])
2620
+ s[f] = u.get ? {
2621
+ enumerable: !0,
2622
+ configurable: !0,
2623
+ get: Lo.bind(n[f] = [u.get.bind(o)])
2624
+ } : u.value !== void 0 ? u : void 0;
2625
+ else {
2626
+ const h = n[f];
2627
+ h && (u.get ? h.push(u.get.bind(o)) : u.value !== void 0 && h.push(() => u.value));
2628
+ }
2629
+ }
2630
+ }
2631
+ const r = {}, i = Object.keys(s);
2632
+ for (let a = i.length - 1; a >= 0; a--) {
2633
+ const o = i[a], l = s[o];
2634
+ l && l.get ? Object.defineProperty(r, o, l) : r[o] = l ? l.value : void 0;
2635
+ }
2636
+ return r;
2637
+ }
2638
+ function ko(e, ...t) {
2639
+ if (Gs && qt in e) {
2640
+ const r = new Set(t.length > 1 ? t.flat() : t[0]), i = t.map((a) => new Proxy({
2641
+ get(o) {
2642
+ return a.includes(o) ? e[o] : void 0;
2643
+ },
2644
+ has(o) {
2645
+ return a.includes(o) && o in e;
2646
+ },
2647
+ keys() {
2648
+ return a.filter((o) => o in e);
2649
+ }
2650
+ }, gn));
2651
+ return i.push(new Proxy({
2652
+ get(a) {
2653
+ return r.has(a) ? void 0 : e[a];
2654
+ },
2655
+ has(a) {
2656
+ return r.has(a) ? !1 : a in e;
2657
+ },
2658
+ keys() {
2659
+ return Object.keys(e).filter((a) => !r.has(a));
2660
+ }
2661
+ }, gn)), i;
2662
+ }
2663
+ const n = {}, s = t.map(() => ({}));
2664
+ for (const r of Object.getOwnPropertyNames(e)) {
2665
+ const i = Object.getOwnPropertyDescriptor(e, r), a = !i.get && !i.set && i.enumerable && i.writable && i.configurable;
2666
+ let o = !1, l = 0;
2667
+ for (const d of t)
2668
+ d.includes(r) && (o = !0, a ? s[l][r] = i.value : Object.defineProperty(s[l], r, i)), ++l;
2669
+ o || (a ? n[r] = i.value : Object.defineProperty(n, r, i));
2670
+ }
2671
+ return [...s, n];
2672
+ }
2673
+ function Qs(e) {
2674
+ let t, n;
2675
+ const s = (r) => {
2676
+ const i = P.context;
2677
+ if (i) {
2678
+ const [o, l] = M();
2679
+ P.count || (P.count = 0), P.count++, (n || (n = e())).then((d) => {
2680
+ !P.done && it(i), P.count--, l(() => d.default), it();
2681
+ }), t = o;
2682
+ } else if (!t) {
2683
+ const [o] = Ao(() => (n || (n = e())).then((l) => l.default));
2684
+ t = o;
2685
+ }
2686
+ let a;
2687
+ return Y(() => (a = t()) ? X(() => {
2688
+ if (!i || P.done) return a(r);
2689
+ const o = P.context;
2690
+ it(i);
2691
+ const l = a(r);
2692
+ return it(o), l;
2693
+ }) : "");
2694
+ };
2695
+ return s.preload = () => n || ((n = e()).then((r) => t = () => r.default), n), s;
2696
+ }
2697
+ var Do = 0;
2698
+ function Rc() {
2699
+ return P.context ? P.getNextContextId() : `cl-${Do++}`;
2700
+ }
2701
+ var js = (e) => `Stale read from <${e}>.`;
2702
+ function Uc(e) {
2703
+ const t = "fallback" in e && {
2704
+ fallback: () => e.fallback
2705
+ };
2706
+ return Y(No(() => e.each, e.children, t || void 0));
2707
+ }
2708
+ function Bc(e) {
2709
+ const t = "fallback" in e && {
2710
+ fallback: () => e.fallback
2711
+ };
2712
+ return Y(Co(() => e.each, e.children, t || void 0));
2713
+ }
2714
+ function Mc(e) {
2715
+ const t = e.keyed, n = Y(() => e.when, void 0, void 0), s = t ? n : Y(n, void 0, {
2716
+ equals: (r, i) => !r == !i
2717
+ });
2718
+ return Y(() => {
2719
+ const r = s();
2720
+ if (r) {
2721
+ const i = e.children;
2722
+ return typeof i == "function" && i.length > 0 ? X(() => i(t ? r : () => {
2723
+ if (!X(s)) throw js("Show");
2724
+ return n();
2725
+ })) : i;
2726
+ }
2727
+ return e.fallback;
2728
+ }, void 0, void 0);
2729
+ }
2730
+ function Fc(e) {
2731
+ const t = Ms(() => e.children), n = Y(() => {
2732
+ const s = t(), r = Array.isArray(s) ? s : [s];
2733
+ let i = () => {
2734
+ };
2735
+ for (let a = 0; a < r.length; a++) {
2736
+ const o = a, l = r[a], d = i, f = Y(() => d() ? void 0 : l.when, void 0, void 0), u = l.keyed ? f : Y(f, void 0, {
2737
+ equals: (h, m) => !h == !m
2738
+ });
2739
+ i = () => d() || (u() ? [o, f, l] : void 0);
2740
+ }
2741
+ return i;
2742
+ });
2743
+ return Y(() => {
2744
+ const s = n()();
2745
+ if (!s) return e.fallback;
2746
+ const [r, i, a] = s, o = a.children;
2747
+ return typeof o == "function" && o.length > 0 ? X(() => o(a.keyed ? i() : () => {
2748
+ var d;
2749
+ if (((d = X(n)()) == null ? void 0 : d[0]) !== r) throw js("Match");
2750
+ return i();
2751
+ })) : o;
2752
+ }, void 0, void 0);
2753
+ }
2754
+ function qc(e) {
2755
+ return e;
2756
+ }
2757
+ var Go = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "inert", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"], Oo = /* @__PURE__ */ new Set(["className", "value", "readOnly", "noValidate", "formNoValidate", "isMap", "noModule", "playsInline", ...Go]), xo = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]), Ro = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
2758
+ className: "class",
2759
+ htmlFor: "for"
2760
+ }), Uo = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
2761
+ class: "className",
2762
+ novalidate: {
2763
+ $: "noValidate",
2764
+ FORM: 1
2765
+ },
2766
+ formnovalidate: {
2767
+ $: "formNoValidate",
2768
+ BUTTON: 1,
2769
+ INPUT: 1
2770
+ },
2771
+ ismap: {
2772
+ $: "isMap",
2773
+ IMG: 1
2774
+ },
2775
+ nomodule: {
2776
+ $: "noModule",
2777
+ SCRIPT: 1
2778
+ },
2779
+ playsinline: {
2780
+ $: "playsInline",
2781
+ VIDEO: 1
2782
+ },
2783
+ readonly: {
2784
+ $: "readOnly",
2785
+ INPUT: 1,
2786
+ TEXTAREA: 1
2787
+ }
2788
+ });
2789
+ function Bo(e, t) {
2790
+ const n = Uo[e];
2791
+ return typeof n == "object" ? n[t] ? n.$ : void 0 : n;
2792
+ }
2793
+ var Mo = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]), Fo = /* @__PURE__ */ new Set([
2794
+ "altGlyph",
2795
+ "altGlyphDef",
2796
+ "altGlyphItem",
2797
+ "animate",
2798
+ "animateColor",
2799
+ "animateMotion",
2800
+ "animateTransform",
2801
+ "circle",
2802
+ "clipPath",
2803
+ "color-profile",
2804
+ "cursor",
2805
+ "defs",
2806
+ "desc",
2807
+ "ellipse",
2808
+ "feBlend",
2809
+ "feColorMatrix",
2810
+ "feComponentTransfer",
2811
+ "feComposite",
2812
+ "feConvolveMatrix",
2813
+ "feDiffuseLighting",
2814
+ "feDisplacementMap",
2815
+ "feDistantLight",
2816
+ "feDropShadow",
2817
+ "feFlood",
2818
+ "feFuncA",
2819
+ "feFuncB",
2820
+ "feFuncG",
2821
+ "feFuncR",
2822
+ "feGaussianBlur",
2823
+ "feImage",
2824
+ "feMerge",
2825
+ "feMergeNode",
2826
+ "feMorphology",
2827
+ "feOffset",
2828
+ "fePointLight",
2829
+ "feSpecularLighting",
2830
+ "feSpotLight",
2831
+ "feTile",
2832
+ "feTurbulence",
2833
+ "filter",
2834
+ "font",
2835
+ "font-face",
2836
+ "font-face-format",
2837
+ "font-face-name",
2838
+ "font-face-src",
2839
+ "font-face-uri",
2840
+ "foreignObject",
2841
+ "g",
2842
+ "glyph",
2843
+ "glyphRef",
2844
+ "hkern",
2845
+ "image",
2846
+ "line",
2847
+ "linearGradient",
2848
+ "marker",
2849
+ "mask",
2850
+ "metadata",
2851
+ "missing-glyph",
2852
+ "mpath",
2853
+ "path",
2854
+ "pattern",
2855
+ "polygon",
2856
+ "polyline",
2857
+ "radialGradient",
2858
+ "rect",
2859
+ "set",
2860
+ "stop",
2861
+ "svg",
2862
+ "switch",
2863
+ "symbol",
2864
+ "text",
2865
+ "textPath",
2866
+ "tref",
2867
+ "tspan",
2868
+ "use",
2869
+ "view",
2870
+ "vkern"
2871
+ ]), qo = {
2872
+ xlink: "http://www.w3.org/1999/xlink",
2873
+ xml: "http://www.w3.org/XML/1998/namespace"
2874
+ }, Kc = (e) => Y(() => e());
2875
+ function Ko(e, t, n) {
2876
+ let s = n.length, r = t.length, i = s, a = 0, o = 0, l = t[r - 1].nextSibling, d = null;
2877
+ for (; a < r || o < i; ) {
2878
+ if (t[a] === n[o]) {
2879
+ a++, o++;
2880
+ continue;
2881
+ }
2882
+ for (; t[r - 1] === n[i - 1]; )
2883
+ r--, i--;
2884
+ if (r === a) {
2885
+ const f = i < s ? o ? n[o - 1].nextSibling : n[i - o] : l;
2886
+ for (; o < i; ) e.insertBefore(n[o++], f);
2887
+ } else if (i === o)
2888
+ for (; a < r; )
2889
+ (!d || !d.has(t[a])) && t[a].remove(), a++;
2890
+ else if (t[a] === n[i - 1] && n[o] === t[r - 1]) {
2891
+ const f = t[--r].nextSibling;
2892
+ e.insertBefore(n[o++], t[a++].nextSibling), e.insertBefore(n[--i], f), t[r] = n[i];
2893
+ } else {
2894
+ if (!d) {
2895
+ d = /* @__PURE__ */ new Map();
2896
+ let u = o;
2897
+ for (; u < i; ) d.set(n[u], u++);
2898
+ }
2899
+ const f = d.get(t[a]);
2900
+ if (f != null)
2901
+ if (o < f && f < i) {
2902
+ let u = a, h = 1, m;
2903
+ for (; ++u < r && u < i && !((m = d.get(t[u])) == null || m !== f + h); )
2904
+ h++;
2905
+ if (h > f - o) {
2906
+ const y = t[a];
2907
+ for (; o < f; ) e.insertBefore(n[o++], y);
2908
+ } else e.replaceChild(n[o++], t[a++]);
2909
+ } else a++;
2910
+ else t[a++].remove();
2911
+ }
2912
+ }
2913
+ }
2914
+ var ot = "_$DX_DELEGATE";
2915
+ function Ws(e, t, n, s = {}) {
2916
+ let r;
2917
+ return ke((i) => {
2918
+ r = i, t === document ? e() : En(t, e(), t.firstChild ? null : void 0, n);
2919
+ }, s.owner), () => {
2920
+ r(), t.textContent = "";
2921
+ };
2922
+ }
2923
+ function Vc(e, t, n, s) {
2924
+ let r;
2925
+ const i = () => {
2926
+ const o = document.createElement("template");
2927
+ return o.innerHTML = e, o.content.firstChild;
2928
+ }, a = () => (r || (r = i())).cloneNode(!0);
2929
+ return a.cloneNode = a, a;
2930
+ }
2931
+ function Vo(e, t = window.document) {
2932
+ const n = t[ot] || (t[ot] = /* @__PURE__ */ new Set());
2933
+ for (let s = 0, r = e.length; s < r; s++) {
2934
+ const i = e[s];
2935
+ n.has(i) || (n.add(i), t.addEventListener(i, zs));
2936
+ }
2937
+ }
2938
+ function Hc(e = window.document) {
2939
+ if (e[ot]) {
2940
+ for (let t of e[ot].keys()) e.removeEventListener(t, zs);
2941
+ delete e[ot];
2942
+ }
2943
+ }
2944
+ function mn(e, t, n) {
2945
+ Ue(e) || (n == null ? e.removeAttribute(t) : e.setAttribute(t, n));
2946
+ }
2947
+ function Ho(e, t, n, s) {
2948
+ Ue(e) || (s == null ? e.removeAttributeNS(t, n) : e.setAttributeNS(t, n, s));
2949
+ }
2950
+ function $o(e, t, n) {
2951
+ Ue(e) || (n ? e.setAttribute(t, "") : e.removeAttribute(t));
2952
+ }
2953
+ function Qo(e, t) {
2954
+ Ue(e) || (t == null ? e.removeAttribute("class") : e.className = t);
2955
+ }
2956
+ function jo(e, t, n, s) {
2957
+ if (s)
2958
+ Array.isArray(n) ? (e[`$$${t}`] = n[0], e[`$$${t}Data`] = n[1]) : e[`$$${t}`] = n;
2959
+ else if (Array.isArray(n)) {
2960
+ const r = n[0];
2961
+ e.addEventListener(t, n[0] = (i) => r.call(e, n[1], i));
2962
+ } else e.addEventListener(t, n, typeof n != "function" && n);
2963
+ }
2964
+ function Wo(e, t, n = {}) {
2965
+ const s = Object.keys(t || {}), r = Object.keys(n);
2966
+ let i, a;
2967
+ for (i = 0, a = r.length; i < a; i++) {
2968
+ const o = r[i];
2969
+ !o || o === "undefined" || t[o] || (Jn(e, o, !1), delete n[o]);
2970
+ }
2971
+ for (i = 0, a = s.length; i < a; i++) {
2972
+ const o = s[i], l = !!t[o];
2973
+ !o || o === "undefined" || n[o] === l || !l || (Jn(e, o, !0), n[o] = l);
2974
+ }
2975
+ return n;
2976
+ }
2977
+ function zo(e, t, n) {
2978
+ if (!t) return n ? mn(e, "style") : t;
2979
+ const s = e.style;
2980
+ if (typeof t == "string") return s.cssText = t;
2981
+ typeof n == "string" && (s.cssText = n = void 0), n || (n = {}), t || (t = {});
2982
+ let r, i;
2983
+ for (i in n)
2984
+ t[i] == null && s.removeProperty(i), delete n[i];
2985
+ for (i in t)
2986
+ r = t[i], r !== n[i] && (s.setProperty(i, r), n[i] = r);
2987
+ return n;
2988
+ }
2989
+ function Yo(e, t = {}, n, s) {
2990
+ const r = {};
2991
+ return s || De(() => r.children = dt(e, t.children, r.children)), De(() => typeof t.ref == "function" && Jo(t.ref, e)), De(() => Xo(e, t, n, !0, r, !0)), r;
2992
+ }
2993
+ function Jo(e, t, n) {
2994
+ return X(() => e(t, n));
2995
+ }
2996
+ function En(e, t, n, s) {
2997
+ if (n !== void 0 && !s && (s = []), typeof t != "function") return dt(e, t, s, n);
2998
+ De((r) => dt(e, t(), r, n), s);
2999
+ }
3000
+ function Xo(e, t, n, s, r = {}, i = !1) {
3001
+ t || (t = {});
3002
+ for (const a in r)
3003
+ if (!(a in t)) {
3004
+ if (a === "children") continue;
3005
+ r[a] = Xn(e, a, null, r[a], n, i, t);
3006
+ }
3007
+ for (const a in t) {
3008
+ if (a === "children")
3009
+ continue;
3010
+ const o = t[a];
3011
+ r[a] = Xn(e, a, o, r[a], n, i, t);
3012
+ }
3013
+ }
3014
+ function Zo(e) {
3015
+ let t, n;
3016
+ return !Ue() || !(t = P.registry.get(n = tl())) ? e() : (P.completed && P.completed.add(t), P.registry.delete(n), t);
3017
+ }
3018
+ function Ue(e) {
3019
+ return !!P.context && !P.done && (!e || e.isConnected);
3020
+ }
3021
+ function el(e) {
3022
+ return e.toLowerCase().replace(/-([a-z])/g, (t, n) => n.toUpperCase());
3023
+ }
3024
+ function Jn(e, t, n) {
3025
+ const s = t.trim().split(/\s+/);
3026
+ for (let r = 0, i = s.length; r < i; r++) e.classList.toggle(s[r], n);
3027
+ }
3028
+ function Xn(e, t, n, s, r, i, a) {
3029
+ let o, l, d, f, u;
3030
+ if (t === "style") return zo(e, n, s);
3031
+ if (t === "classList") return Wo(e, n, s);
3032
+ if (n === s) return s;
3033
+ if (t === "ref")
3034
+ i || n(e);
3035
+ else if (t.slice(0, 3) === "on:") {
3036
+ const h = t.slice(3);
3037
+ s && e.removeEventListener(h, s, typeof s != "function" && s), n && e.addEventListener(h, n, typeof n != "function" && n);
3038
+ } else if (t.slice(0, 10) === "oncapture:") {
3039
+ const h = t.slice(10);
3040
+ s && e.removeEventListener(h, s, !0), n && e.addEventListener(h, n, !0);
3041
+ } else if (t.slice(0, 2) === "on") {
3042
+ const h = t.slice(2).toLowerCase(), m = Mo.has(h);
3043
+ if (!m && s) {
3044
+ const y = Array.isArray(s) ? s[0] : s;
3045
+ e.removeEventListener(h, y);
3046
+ }
3047
+ (m || n) && (jo(e, h, n, m), m && Vo([h]));
3048
+ } else if (t.slice(0, 5) === "attr:")
3049
+ mn(e, t.slice(5), n);
3050
+ else if (t.slice(0, 5) === "bool:")
3051
+ $o(e, t.slice(5), n);
3052
+ else if ((u = t.slice(0, 5) === "prop:") || (d = xo.has(t)) || !r && ((f = Bo(t, e.tagName)) || (l = Oo.has(t))) || (o = e.nodeName.includes("-") || "is" in a)) {
3053
+ if (u)
3054
+ t = t.slice(5), l = !0;
3055
+ else if (Ue(e)) return n;
3056
+ t === "class" || t === "className" ? Qo(e, n) : o && !l && !d ? e[el(t)] = n : e[f || t] = n;
3057
+ } else {
3058
+ const h = r && t.indexOf(":") > -1 && qo[t.split(":")[0]];
3059
+ h ? Ho(e, h, t, n) : mn(e, Ro[t] || t, n);
3060
+ }
3061
+ return n;
3062
+ }
3063
+ function zs(e) {
3064
+ if (P.registry && P.events && P.events.find(([l, d]) => d === e))
3065
+ return;
3066
+ let t = e.target;
3067
+ const n = `$$${e.type}`, s = e.target, r = e.currentTarget, i = (l) => Object.defineProperty(e, "target", {
3068
+ configurable: !0,
3069
+ value: l
3070
+ }), a = () => {
3071
+ const l = t[n];
3072
+ if (l && !t.disabled) {
3073
+ const d = t[`${n}Data`];
3074
+ if (d !== void 0 ? l.call(t, d, e) : l.call(t, e), e.cancelBubble) return;
3075
+ }
3076
+ return t.host && typeof t.host != "string" && !t.host._$host && t.contains(e.target) && i(t.host), !0;
3077
+ }, o = () => {
3078
+ for (; a() && (t = t._$host || t.parentNode || t.host); ) ;
3079
+ };
3080
+ if (Object.defineProperty(e, "currentTarget", {
3081
+ configurable: !0,
3082
+ get() {
3083
+ return t || document;
3084
+ }
3085
+ }), P.registry && !P.done && (P.done = _$HY.done = !0), e.composedPath) {
3086
+ const l = e.composedPath();
3087
+ i(l[0]);
3088
+ for (let d = 0; d < l.length - 2 && (t = l[d], !!a()); d++) {
3089
+ if (t._$host) {
3090
+ t = t._$host, o();
3091
+ break;
3092
+ }
3093
+ if (t.parentNode === r)
3094
+ break;
3095
+ }
3096
+ } else o();
3097
+ i(s);
3098
+ }
3099
+ function dt(e, t, n, s, r) {
3100
+ const i = Ue(e);
3101
+ if (i) {
3102
+ !n && (n = [...e.childNodes]);
3103
+ let l = [];
3104
+ for (let d = 0; d < n.length; d++) {
3105
+ const f = n[d];
3106
+ f.nodeType === 8 && f.data.slice(0, 2) === "!$" ? f.remove() : l.push(f);
3107
+ }
3108
+ n = l;
3109
+ }
3110
+ for (; typeof n == "function"; ) n = n();
3111
+ if (t === n) return n;
3112
+ const a = typeof t, o = s !== void 0;
3113
+ if (e = o && n[0] && n[0].parentNode || e, a === "string" || a === "number") {
3114
+ if (i || a === "number" && (t = t.toString(), t === n))
3115
+ return n;
3116
+ if (o) {
3117
+ let l = n[0];
3118
+ l && l.nodeType === 3 ? l.data !== t && (l.data = t) : l = document.createTextNode(t), n = Be(e, n, s, l);
3119
+ } else
3120
+ n !== "" && typeof n == "string" ? n = e.firstChild.data = t : n = e.textContent = t;
3121
+ } else if (t == null || a === "boolean") {
3122
+ if (i) return n;
3123
+ n = Be(e, n, s);
3124
+ } else {
3125
+ if (a === "function")
3126
+ return De(() => {
3127
+ let l = t();
3128
+ for (; typeof l == "function"; ) l = l();
3129
+ n = dt(e, l, n, s);
3130
+ }), () => n;
3131
+ if (Array.isArray(t)) {
3132
+ const l = [], d = n && Array.isArray(n);
3133
+ if (pn(l, t, n, r))
3134
+ return De(() => n = dt(e, l, n, s, !0)), () => n;
3135
+ if (i) {
3136
+ if (!l.length) return n;
3137
+ if (s === void 0) return n = [...e.childNodes];
3138
+ let f = l[0];
3139
+ if (f.parentNode !== e) return n;
3140
+ const u = [f];
3141
+ for (; (f = f.nextSibling) !== s; ) u.push(f);
3142
+ return n = u;
3143
+ }
3144
+ if (l.length === 0) {
3145
+ if (n = Be(e, n, s), o) return n;
3146
+ } else d ? n.length === 0 ? Zn(e, l, s) : Ko(e, n, l) : (n && Be(e), Zn(e, l));
3147
+ n = l;
3148
+ } else if (t.nodeType) {
3149
+ if (i && t.parentNode) return n = o ? [t] : t;
3150
+ if (Array.isArray(n)) {
3151
+ if (o) return n = Be(e, n, s, t);
3152
+ Be(e, n, null, t);
3153
+ } else n == null || n === "" || !e.firstChild ? e.appendChild(t) : e.replaceChild(t, e.firstChild);
3154
+ n = t;
3155
+ }
3156
+ }
3157
+ return n;
3158
+ }
3159
+ function pn(e, t, n, s) {
3160
+ let r = !1;
3161
+ for (let i = 0, a = t.length; i < a; i++) {
3162
+ let o = t[i], l = n && n[e.length], d;
3163
+ if (!(o == null || o === !0 || o === !1)) if ((d = typeof o) == "object" && o.nodeType)
3164
+ e.push(o);
3165
+ else if (Array.isArray(o))
3166
+ r = pn(e, o, l) || r;
3167
+ else if (d === "function")
3168
+ if (s) {
3169
+ for (; typeof o == "function"; ) o = o();
3170
+ r = pn(e, Array.isArray(o) ? o : [o], Array.isArray(l) ? l : [l]) || r;
3171
+ } else
3172
+ e.push(o), r = !0;
3173
+ else {
3174
+ const f = String(o);
3175
+ l && l.nodeType === 3 && l.data === f ? e.push(l) : e.push(document.createTextNode(f));
3176
+ }
3177
+ }
3178
+ return r;
3179
+ }
3180
+ function Zn(e, t, n = null) {
3181
+ for (let s = 0, r = t.length; s < r; s++) e.insertBefore(t[s], n);
3182
+ }
3183
+ function Be(e, t, n, s) {
3184
+ if (n === void 0) return e.textContent = "";
3185
+ const r = s || document.createTextNode("");
3186
+ if (t.length) {
3187
+ let i = !1;
3188
+ for (let a = t.length - 1; a >= 0; a--) {
3189
+ const o = t[a];
3190
+ if (r !== o) {
3191
+ const l = o.parentNode === e;
3192
+ !i && !a ? l ? e.replaceChild(r, o) : e.insertBefore(r, n) : l && o.remove();
3193
+ } else i = !0;
3194
+ }
3195
+ } else e.insertBefore(r, n);
3196
+ return [r];
3197
+ }
3198
+ function tl() {
3199
+ return P.getNextContextId();
3200
+ }
3201
+ var nl = "http://www.w3.org/2000/svg";
3202
+ function Ys(e, t = !1) {
3203
+ return t ? document.createElementNS(nl, e) : document.createElement(e);
3204
+ }
3205
+ function $c(e) {
3206
+ const {
3207
+ useShadow: t
3208
+ } = e, n = document.createTextNode(""), s = () => e.mount || document.body, r = Yn();
3209
+ let i, a = !!P.context;
3210
+ return Us(() => {
3211
+ a && (Yn().user = a = !1), i || (i = Bs(r, () => Y(() => e.children)));
3212
+ const o = s();
3213
+ if (o instanceof HTMLHeadElement) {
3214
+ const [l, d] = M(!1), f = () => d(!0);
3215
+ ke((u) => En(o, () => l() ? u() : i(), null)), ct(f);
3216
+ } else {
3217
+ const l = Ys(e.isSVG ? "g" : "div", e.isSVG), d = t && l.attachShadow ? l.attachShadow({
3218
+ mode: "open"
3219
+ }) : l;
3220
+ Object.defineProperty(l, "_$host", {
3221
+ get() {
3222
+ return n.parentNode;
3223
+ },
3224
+ configurable: !0
3225
+ }), En(d, i), o.appendChild(l), e.ref && e.ref(l), ct(() => o.removeChild(l));
3226
+ }
3227
+ }, void 0, {
3228
+ render: !a
3229
+ }), n;
3230
+ }
3231
+ function sl(e, t) {
3232
+ const n = Y(e);
3233
+ return Y(() => {
3234
+ const s = n();
3235
+ switch (typeof s) {
3236
+ case "function":
3237
+ return X(() => s(t));
3238
+ case "string":
3239
+ const r = Fo.has(s), i = P.context ? Zo() : Ys(s, r);
3240
+ return Yo(i, t, r), i;
3241
+ }
3242
+ });
3243
+ }
3244
+ function Qc(e) {
3245
+ const [, t] = ko(e, ["component"]);
3246
+ return sl(() => e.component, t);
3247
+ }
3248
+ var rl = class {
3249
+ constructor() {
3250
+ this.keyToValue = /* @__PURE__ */ new Map(), this.valueToKey = /* @__PURE__ */ new Map();
3251
+ }
3252
+ set(e, t) {
3253
+ this.keyToValue.set(e, t), this.valueToKey.set(t, e);
3254
+ }
3255
+ getByKey(e) {
3256
+ return this.keyToValue.get(e);
3257
+ }
3258
+ getByValue(e) {
3259
+ return this.valueToKey.get(e);
3260
+ }
3261
+ clear() {
3262
+ this.keyToValue.clear(), this.valueToKey.clear();
3263
+ }
3264
+ }, Js = class {
3265
+ constructor(e) {
3266
+ this.generateIdentifier = e, this.kv = new rl();
3267
+ }
3268
+ register(e, t) {
3269
+ this.kv.getByValue(e) || (t || (t = this.generateIdentifier(e)), this.kv.set(t, e));
3270
+ }
3271
+ clear() {
3272
+ this.kv.clear();
3273
+ }
3274
+ getIdentifier(e) {
3275
+ return this.kv.getByValue(e);
3276
+ }
3277
+ getValue(e) {
3278
+ return this.kv.getByKey(e);
3279
+ }
3280
+ }, il = class extends Js {
3281
+ constructor() {
3282
+ super((e) => e.name), this.classToAllowedProps = /* @__PURE__ */ new Map();
3283
+ }
3284
+ register(e, t) {
3285
+ typeof t == "object" ? (t.allowProps && this.classToAllowedProps.set(e, t.allowProps), super.register(e, t.identifier)) : super.register(e, t);
3286
+ }
3287
+ getAllowedProps(e) {
3288
+ return this.classToAllowedProps.get(e);
3289
+ }
3290
+ };
3291
+ function al(e) {
3292
+ if ("values" in Object)
3293
+ return Object.values(e);
3294
+ const t = [];
3295
+ for (const n in e)
3296
+ e.hasOwnProperty(n) && t.push(e[n]);
3297
+ return t;
3298
+ }
3299
+ function ol(e, t) {
3300
+ const n = al(e);
3301
+ if ("find" in n)
3302
+ return n.find(t);
3303
+ const s = n;
3304
+ for (let r = 0; r < s.length; r++) {
3305
+ const i = s[r];
3306
+ if (t(i))
3307
+ return i;
3308
+ }
3309
+ }
3310
+ function tt(e, t) {
3311
+ Object.entries(e).forEach(([n, s]) => t(s, n));
3312
+ }
3313
+ function Ut(e, t) {
3314
+ return e.indexOf(t) !== -1;
3315
+ }
3316
+ function es(e, t) {
3317
+ for (let n = 0; n < e.length; n++) {
3318
+ const s = e[n];
3319
+ if (t(s))
3320
+ return s;
3321
+ }
3322
+ }
3323
+ var ll = class {
3324
+ constructor() {
3325
+ this.transfomers = {};
3326
+ }
3327
+ register(e) {
3328
+ this.transfomers[e.name] = e;
3329
+ }
3330
+ findApplicable(e) {
3331
+ return ol(this.transfomers, (t) => t.isApplicable(e));
3332
+ }
3333
+ findByName(e) {
3334
+ return this.transfomers[e];
3335
+ }
3336
+ }, cl = (e) => Object.prototype.toString.call(e).slice(8, -1), Xs = (e) => typeof e > "u", ul = (e) => e === null, ft = (e) => typeof e != "object" || e === null || e === Object.prototype ? !1 : Object.getPrototypeOf(e) === null ? !0 : Object.getPrototypeOf(e) === Object.prototype, yn = (e) => ft(e) && Object.keys(e).length === 0, we = (e) => Array.isArray(e), dl = (e) => typeof e == "string", fl = (e) => typeof e == "number" && !isNaN(e), hl = (e) => typeof e == "boolean", gl = (e) => e instanceof RegExp, ht = (e) => e instanceof Map, gt = (e) => e instanceof Set, Zs = (e) => cl(e) === "Symbol", ml = (e) => e instanceof Date && !isNaN(e.valueOf()), El = (e) => e instanceof Error, ts = (e) => typeof e == "number" && isNaN(e), pl = (e) => hl(e) || ul(e) || Xs(e) || fl(e) || dl(e) || Zs(e), yl = (e) => typeof e == "bigint", Al = (e) => e === 1 / 0 || e === -1 / 0, Tl = (e) => ArrayBuffer.isView(e) && !(e instanceof DataView), Sl = (e) => e instanceof URL, er = (e) => e.replace(/\./g, "\\."), un = (e) => e.map(String).map(er).join("."), lt = (e) => {
3337
+ const t = [];
3338
+ let n = "";
3339
+ for (let r = 0; r < e.length; r++) {
3340
+ let i = e.charAt(r);
3341
+ if (i === "\\" && e.charAt(r + 1) === ".") {
3342
+ n += ".", r++;
3343
+ continue;
3344
+ }
3345
+ if (i === ".") {
3346
+ t.push(n), n = "";
3347
+ continue;
3348
+ }
3349
+ n += i;
3350
+ }
3351
+ const s = n;
3352
+ return t.push(s), t;
3353
+ };
3354
+ function he(e, t, n, s) {
3355
+ return {
3356
+ isApplicable: e,
3357
+ annotation: t,
3358
+ transform: n,
3359
+ untransform: s
3360
+ };
3361
+ }
3362
+ var tr = [
3363
+ he(Xs, "undefined", () => null, () => {
3364
+ }),
3365
+ he(yl, "bigint", (e) => e.toString(), (e) => typeof BigInt < "u" ? BigInt(e) : e),
3366
+ he(ml, "Date", (e) => e.toISOString(), (e) => new Date(e)),
3367
+ he(El, "Error", (e, t) => {
3368
+ const n = {
3369
+ name: e.name,
3370
+ message: e.message
3371
+ };
3372
+ return t.allowedErrorProps.forEach((s) => {
3373
+ n[s] = e[s];
3374
+ }), n;
3375
+ }, (e, t) => {
3376
+ const n = new Error(e.message);
3377
+ return n.name = e.name, n.stack = e.stack, t.allowedErrorProps.forEach((s) => {
3378
+ n[s] = e[s];
3379
+ }), n;
3380
+ }),
3381
+ he(gl, "regexp", (e) => "" + e, (e) => {
3382
+ const t = e.slice(1, e.lastIndexOf("/")), n = e.slice(e.lastIndexOf("/") + 1);
3383
+ return new RegExp(t, n);
3384
+ }),
3385
+ he(
3386
+ gt,
3387
+ "set",
3388
+ // (sets only exist in es6+)
3389
+ // eslint-disable-next-line es5/no-es6-methods
3390
+ (e) => [...e.values()],
3391
+ (e) => new Set(e)
3392
+ ),
3393
+ he(ht, "map", (e) => [...e.entries()], (e) => new Map(e)),
3394
+ he((e) => ts(e) || Al(e), "number", (e) => ts(e) ? "NaN" : e > 0 ? "Infinity" : "-Infinity", Number),
3395
+ he((e) => e === 0 && 1 / e === -1 / 0, "number", () => "-0", Number),
3396
+ he(Sl, "URL", (e) => e.toString(), (e) => new URL(e))
3397
+ ];
3398
+ function Zt(e, t, n, s) {
3399
+ return {
3400
+ isApplicable: e,
3401
+ annotation: t,
3402
+ transform: n,
3403
+ untransform: s
3404
+ };
3405
+ }
3406
+ var nr = Zt((e, t) => Zs(e) ? !!t.symbolRegistry.getIdentifier(e) : !1, (e, t) => ["symbol", t.symbolRegistry.getIdentifier(e)], (e) => e.description, (e, t, n) => {
3407
+ const s = n.symbolRegistry.getValue(t[1]);
3408
+ if (!s)
3409
+ throw new Error("Trying to deserialize unknown symbol");
3410
+ return s;
3411
+ }), _l = [
3412
+ Int8Array,
3413
+ Uint8Array,
3414
+ Int16Array,
3415
+ Uint16Array,
3416
+ Int32Array,
3417
+ Uint32Array,
3418
+ Float32Array,
3419
+ Float64Array,
3420
+ Uint8ClampedArray
3421
+ ].reduce((e, t) => (e[t.name] = t, e), {}), sr = Zt(Tl, (e) => ["typed-array", e.constructor.name], (e) => [...e], (e, t) => {
3422
+ const n = _l[t[1]];
3423
+ if (!n)
3424
+ throw new Error("Trying to deserialize unknown typed array");
3425
+ return new n(e);
3426
+ });
3427
+ function rr(e, t) {
3428
+ return e != null && e.constructor ? !!t.classRegistry.getIdentifier(e.constructor) : !1;
3429
+ }
3430
+ var ir = Zt(rr, (e, t) => ["class", t.classRegistry.getIdentifier(e.constructor)], (e, t) => {
3431
+ const n = t.classRegistry.getAllowedProps(e.constructor);
3432
+ if (!n)
3433
+ return { ...e };
3434
+ const s = {};
3435
+ return n.forEach((r) => {
3436
+ s[r] = e[r];
3437
+ }), s;
3438
+ }, (e, t, n) => {
3439
+ const s = n.classRegistry.getValue(t[1]);
3440
+ if (!s)
3441
+ throw new Error(`Trying to deserialize unknown class '${t[1]}' - check https://github.com/blitz-js/superjson/issues/116#issuecomment-773996564`);
3442
+ return Object.assign(Object.create(s.prototype), e);
3443
+ }), ar = Zt((e, t) => !!t.customTransformerRegistry.findApplicable(e), (e, t) => ["custom", t.customTransformerRegistry.findApplicable(e).name], (e, t) => t.customTransformerRegistry.findApplicable(e).serialize(e), (e, t, n) => {
3444
+ const s = n.customTransformerRegistry.findByName(t[1]);
3445
+ if (!s)
3446
+ throw new Error("Trying to deserialize unknown custom value");
3447
+ return s.deserialize(e);
3448
+ }), Pl = [ir, nr, ar, sr], ns = (e, t) => {
3449
+ const n = es(Pl, (r) => r.isApplicable(e, t));
3450
+ if (n)
3451
+ return {
3452
+ value: n.transform(e, t),
3453
+ type: n.annotation(e, t)
3454
+ };
3455
+ const s = es(tr, (r) => r.isApplicable(e, t));
3456
+ if (s)
3457
+ return {
3458
+ value: s.transform(e, t),
3459
+ type: s.annotation
3460
+ };
3461
+ }, or = {};
3462
+ tr.forEach((e) => {
3463
+ or[e.annotation] = e;
3464
+ });
3465
+ var wl = (e, t, n) => {
3466
+ if (we(t))
3467
+ switch (t[0]) {
3468
+ case "symbol":
3469
+ return nr.untransform(e, t, n);
3470
+ case "class":
3471
+ return ir.untransform(e, t, n);
3472
+ case "custom":
3473
+ return ar.untransform(e, t, n);
3474
+ case "typed-array":
3475
+ return sr.untransform(e, t, n);
3476
+ default:
3477
+ throw new Error("Unknown transformation: " + t);
3478
+ }
3479
+ else {
3480
+ const s = or[t];
3481
+ if (!s)
3482
+ throw new Error("Unknown transformation: " + t);
3483
+ return s.untransform(e, n);
3484
+ }
3485
+ }, Me = (e, t) => {
3486
+ if (t > e.size)
3487
+ throw new Error("index out of bounds");
3488
+ const n = e.keys();
3489
+ for (; t > 0; )
3490
+ n.next(), t--;
3491
+ return n.next().value;
3492
+ };
3493
+ function lr(e) {
3494
+ if (Ut(e, "__proto__"))
3495
+ throw new Error("__proto__ is not allowed as a property");
3496
+ if (Ut(e, "prototype"))
3497
+ throw new Error("prototype is not allowed as a property");
3498
+ if (Ut(e, "constructor"))
3499
+ throw new Error("constructor is not allowed as a property");
3500
+ }
3501
+ var vl = (e, t) => {
3502
+ lr(t);
3503
+ for (let n = 0; n < t.length; n++) {
3504
+ const s = t[n];
3505
+ if (gt(e))
3506
+ e = Me(e, +s);
3507
+ else if (ht(e)) {
3508
+ const r = +s, i = +t[++n] == 0 ? "key" : "value", a = Me(e, r);
3509
+ switch (i) {
3510
+ case "key":
3511
+ e = a;
3512
+ break;
3513
+ case "value":
3514
+ e = e.get(a);
3515
+ break;
3516
+ }
3517
+ } else
3518
+ e = e[s];
3519
+ }
3520
+ return e;
3521
+ }, An = (e, t, n) => {
3522
+ if (lr(t), t.length === 0)
3523
+ return n(e);
3524
+ let s = e;
3525
+ for (let i = 0; i < t.length - 1; i++) {
3526
+ const a = t[i];
3527
+ if (we(s)) {
3528
+ const o = +a;
3529
+ s = s[o];
3530
+ } else if (ft(s))
3531
+ s = s[a];
3532
+ else if (gt(s)) {
3533
+ const o = +a;
3534
+ s = Me(s, o);
3535
+ } else if (ht(s)) {
3536
+ if (i === t.length - 2)
3537
+ break;
3538
+ const l = +a, d = +t[++i] == 0 ? "key" : "value", f = Me(s, l);
3539
+ switch (d) {
3540
+ case "key":
3541
+ s = f;
3542
+ break;
3543
+ case "value":
3544
+ s = s.get(f);
3545
+ break;
3546
+ }
3547
+ }
3548
+ }
3549
+ const r = t[t.length - 1];
3550
+ if (we(s) ? s[+r] = n(s[+r]) : ft(s) && (s[r] = n(s[r])), gt(s)) {
3551
+ const i = Me(s, +r), a = n(i);
3552
+ i !== a && (s.delete(i), s.add(a));
3553
+ }
3554
+ if (ht(s)) {
3555
+ const i = +t[t.length - 2], a = Me(s, i);
3556
+ switch (+r == 0 ? "key" : "value") {
3557
+ case "key": {
3558
+ const l = n(a);
3559
+ s.set(l, s.get(a)), l !== a && s.delete(a);
3560
+ break;
3561
+ }
3562
+ case "value": {
3563
+ s.set(a, n(s.get(a)));
3564
+ break;
3565
+ }
3566
+ }
3567
+ }
3568
+ return e;
3569
+ };
3570
+ function Tn(e, t, n = []) {
3571
+ if (!e)
3572
+ return;
3573
+ if (!we(e)) {
3574
+ tt(e, (i, a) => Tn(i, t, [...n, ...lt(a)]));
3575
+ return;
3576
+ }
3577
+ const [s, r] = e;
3578
+ r && tt(r, (i, a) => {
3579
+ Tn(i, t, [...n, ...lt(a)]);
3580
+ }), t(s, n);
3581
+ }
3582
+ function bl(e, t, n) {
3583
+ return Tn(t, (s, r) => {
3584
+ e = An(e, r, (i) => wl(i, s, n));
3585
+ }), e;
3586
+ }
3587
+ function Il(e, t) {
3588
+ function n(s, r) {
3589
+ const i = vl(e, lt(r));
3590
+ s.map(lt).forEach((a) => {
3591
+ e = An(e, a, () => i);
3592
+ });
3593
+ }
3594
+ if (we(t)) {
3595
+ const [s, r] = t;
3596
+ s.forEach((i) => {
3597
+ e = An(e, lt(i), () => e);
3598
+ }), r && tt(r, n);
3599
+ } else
3600
+ tt(t, n);
3601
+ return e;
3602
+ }
3603
+ var Nl = (e, t) => ft(e) || we(e) || ht(e) || gt(e) || rr(e, t);
3604
+ function Cl(e, t, n) {
3605
+ const s = n.get(e);
3606
+ s ? s.push(t) : n.set(e, [t]);
3607
+ }
3608
+ function Ll(e, t) {
3609
+ const n = {};
3610
+ let s;
3611
+ return e.forEach((r) => {
3612
+ if (r.length <= 1)
3613
+ return;
3614
+ t || (r = r.map((o) => o.map(String)).sort((o, l) => o.length - l.length));
3615
+ const [i, ...a] = r;
3616
+ i.length === 0 ? s = a.map(un) : n[un(i)] = a.map(un);
3617
+ }), s ? yn(n) ? [s] : [s, n] : yn(n) ? void 0 : n;
3618
+ }
3619
+ var cr = (e, t, n, s, r = [], i = [], a = /* @__PURE__ */ new Map()) => {
3620
+ const o = pl(e);
3621
+ if (!o) {
3622
+ Cl(e, r, t);
3623
+ const m = a.get(e);
3624
+ if (m)
3625
+ return s ? {
3626
+ transformedValue: null
3627
+ } : m;
3628
+ }
3629
+ if (!Nl(e, n)) {
3630
+ const m = ns(e, n), y = m ? {
3631
+ transformedValue: m.value,
3632
+ annotations: [m.type]
3633
+ } : {
3634
+ transformedValue: e
3635
+ };
3636
+ return o || a.set(e, y), y;
3637
+ }
3638
+ if (Ut(i, e))
3639
+ return {
3640
+ transformedValue: null
3641
+ };
3642
+ const l = ns(e, n), d = (l == null ? void 0 : l.value) ?? e, f = we(d) ? [] : {}, u = {};
3643
+ tt(d, (m, y) => {
3644
+ if (y === "__proto__" || y === "constructor" || y === "prototype")
3645
+ throw new Error(`Detected property ${y}. This is a prototype pollution risk, please remove it from your object.`);
3646
+ const A = cr(m, t, n, s, [...r, y], [...i, e], a);
3647
+ f[y] = A.transformedValue, we(A.annotations) ? u[y] = A.annotations : ft(A.annotations) && tt(A.annotations, (T, p) => {
3648
+ u[er(y) + "." + p] = T;
3649
+ });
3650
+ });
3651
+ const h = yn(u) ? {
3652
+ transformedValue: f,
3653
+ annotations: l ? [l.type] : void 0
3654
+ } : {
3655
+ transformedValue: f,
3656
+ annotations: l ? [l.type, u] : u
3657
+ };
3658
+ return o || a.set(e, h), h;
3659
+ };
3660
+ function ur(e) {
3661
+ return Object.prototype.toString.call(e).slice(8, -1);
3662
+ }
3663
+ function ss(e) {
3664
+ return ur(e) === "Array";
3665
+ }
3666
+ function kl(e) {
3667
+ if (ur(e) !== "Object")
3668
+ return !1;
3669
+ const t = Object.getPrototypeOf(e);
3670
+ return !!t && t.constructor === Object && t === Object.prototype;
3671
+ }
3672
+ function Dl(e, t, n, s, r) {
3673
+ const i = {}.propertyIsEnumerable.call(s, t) ? "enumerable" : "nonenumerable";
3674
+ i === "enumerable" && (e[t] = n), r && i === "nonenumerable" && Object.defineProperty(e, t, {
3675
+ value: n,
3676
+ enumerable: !1,
3677
+ writable: !0,
3678
+ configurable: !0
3679
+ });
3680
+ }
3681
+ function Sn(e, t = {}) {
3682
+ if (ss(e))
3683
+ return e.map((r) => Sn(r, t));
3684
+ if (!kl(e))
3685
+ return e;
3686
+ const n = Object.getOwnPropertyNames(e), s = Object.getOwnPropertySymbols(e);
3687
+ return [...n, ...s].reduce((r, i) => {
3688
+ if (ss(t.props) && !t.props.includes(i))
3689
+ return r;
3690
+ const a = e[i], o = Sn(a, t);
3691
+ return Dl(r, i, o, e, t.nonenumerable), r;
3692
+ }, {});
3693
+ }
3694
+ var G = class {
3695
+ /**
3696
+ * @param dedupeReferentialEqualities If true, SuperJSON will make sure only one instance of referentially equal objects are serialized and the rest are replaced with `null`.
3697
+ */
3698
+ constructor({ dedupe: e = !1 } = {}) {
3699
+ this.classRegistry = new il(), this.symbolRegistry = new Js((t) => t.description ?? ""), this.customTransformerRegistry = new ll(), this.allowedErrorProps = [], this.dedupe = e;
3700
+ }
3701
+ serialize(e) {
3702
+ const t = /* @__PURE__ */ new Map(), n = cr(e, t, this, this.dedupe), s = {
3703
+ json: n.transformedValue
3704
+ };
3705
+ n.annotations && (s.meta = {
3706
+ ...s.meta,
3707
+ values: n.annotations
3708
+ });
3709
+ const r = Ll(t, this.dedupe);
3710
+ return r && (s.meta = {
3711
+ ...s.meta,
3712
+ referentialEqualities: r
3713
+ }), s;
3714
+ }
3715
+ deserialize(e) {
3716
+ const { json: t, meta: n } = e;
3717
+ let s = Sn(t);
3718
+ return n != null && n.values && (s = bl(s, n.values, this)), n != null && n.referentialEqualities && (s = Il(s, n.referentialEqualities)), s;
3719
+ }
3720
+ stringify(e) {
3721
+ return JSON.stringify(this.serialize(e));
3722
+ }
3723
+ parse(e) {
3724
+ return this.deserialize(JSON.parse(e));
3725
+ }
3726
+ registerClass(e, t) {
3727
+ this.classRegistry.register(e, t);
3728
+ }
3729
+ registerSymbol(e, t) {
3730
+ this.symbolRegistry.register(e, t);
3731
+ }
3732
+ registerCustom(e, t) {
3733
+ this.customTransformerRegistry.register({
3734
+ name: t,
3735
+ ...e
3736
+ });
3737
+ }
3738
+ allowErrorProps(...e) {
3739
+ this.allowedErrorProps.push(...e);
3740
+ }
3741
+ };
3742
+ G.defaultInstance = new G();
3743
+ G.serialize = G.defaultInstance.serialize.bind(G.defaultInstance);
3744
+ G.deserialize = G.defaultInstance.deserialize.bind(G.defaultInstance);
3745
+ G.stringify = G.defaultInstance.stringify.bind(G.defaultInstance);
3746
+ G.parse = G.defaultInstance.parse.bind(G.defaultInstance);
3747
+ G.registerClass = G.defaultInstance.registerClass.bind(G.defaultInstance);
3748
+ G.registerSymbol = G.defaultInstance.registerSymbol.bind(G.defaultInstance);
3749
+ G.registerCustom = G.defaultInstance.registerCustom.bind(G.defaultInstance);
3750
+ G.allowErrorProps = G.defaultInstance.allowErrorProps.bind(G.defaultInstance);
3751
+ var Gl = G.serialize, jc = G.stringify;
3752
+ function Wc(e) {
3753
+ return e.state.fetchStatus === "fetching" ? "fetching" : e.getObserversCount() ? e.state.fetchStatus === "paused" ? "paused" : e.isStale() ? "stale" : "fresh" : "inactive";
3754
+ }
3755
+ function zc(e, t) {
3756
+ return `${e}${t.charAt(0).toUpperCase() + t.slice(1)}`;
3757
+ }
3758
+ function Yc({
3759
+ queryState: e,
3760
+ observerCount: t,
3761
+ isStale: n
3762
+ }) {
3763
+ return e.fetchStatus === "fetching" ? "blue" : t ? e.fetchStatus === "paused" ? "purple" : n ? "yellow" : "green" : "gray";
3764
+ }
3765
+ function Jc({
3766
+ status: e,
3767
+ isPaused: t
3768
+ }) {
3769
+ return t ? "purple" : e === "error" ? "red" : e === "pending" ? "yellow" : e === "success" ? "green" : "gray";
3770
+ }
3771
+ function Xc(e) {
3772
+ return e === "fresh" ? "green" : e === "stale" ? "yellow" : e === "paused" ? "purple" : e === "inactive" ? "gray" : "blue";
3773
+ }
3774
+ var Zc = (e, t = !1) => {
3775
+ const {
3776
+ json: n
3777
+ } = Gl(e);
3778
+ return JSON.stringify(n, null, t ? 2 : void 0);
3779
+ }, Dt = (e) => e.state.fetchStatus !== "idle" ? 0 : e.getObserversCount() ? e.isStale() ? 2 : 1 : 3, Ol = (e, t) => e.queryHash.localeCompare(t.queryHash), dr = (e, t) => e.state.dataUpdatedAt < t.state.dataUpdatedAt ? 1 : -1, xl = (e, t) => Dt(e) === Dt(t) ? dr(e, t) : Dt(e) > Dt(t) ? 1 : -1, eu = {
3780
+ status: xl,
3781
+ "query hash": Ol,
3782
+ "last updated": dr
3783
+ }, Gt = (e) => e.state.isPaused ? 0 : e.state.status === "error" ? 2 : e.state.status === "pending" ? 1 : 3, fr = (e, t) => e.state.submittedAt < t.state.submittedAt ? 1 : -1, Rl = (e, t) => Gt(e) === Gt(t) ? fr(e, t) : Gt(e) > Gt(t) ? 1 : -1, tu = {
3784
+ status: Rl,
3785
+ "last updated": fr
3786
+ }, nu = (e) => e * parseFloat(getComputedStyle(document.documentElement).fontSize), su = () => {
3787
+ const [e, t] = M("dark");
3788
+ return To(() => {
3789
+ const n = window.matchMedia("(prefers-color-scheme: dark)");
3790
+ t(n.matches ? "dark" : "light");
3791
+ const s = (r) => {
3792
+ t(r.matches ? "dark" : "light");
3793
+ };
3794
+ n.addEventListener("change", s), ct(() => n.removeEventListener("change", s));
3795
+ }), e;
3796
+ }, Ot = (e, t, n) => {
3797
+ if (t.length === 0)
3798
+ return n;
3799
+ if (e instanceof Map) {
3800
+ const s = new Map(e);
3801
+ if (t.length === 1)
3802
+ return s.set(t[0], n), s;
3803
+ const [r, ...i] = t;
3804
+ return s.set(r, Ot(s.get(r), i, n)), s;
3805
+ }
3806
+ if (e instanceof Set) {
3807
+ const s = Ot(Array.from(e), t, n);
3808
+ return new Set(s);
3809
+ }
3810
+ if (Array.isArray(e)) {
3811
+ const s = [...e];
3812
+ if (t.length === 1)
3813
+ return s[t[0]] = n, s;
3814
+ const [r, ...i] = t;
3815
+ return s[r] = Ot(s[r], i, n), s;
3816
+ }
3817
+ if (e instanceof Object) {
3818
+ const s = {
3819
+ ...e
3820
+ };
3821
+ if (t.length === 1)
3822
+ return s[t[0]] = n, s;
3823
+ const [r, ...i] = t;
3824
+ return s[r] = Ot(s[r], i, n), s;
3825
+ }
3826
+ return e;
3827
+ }, xt = (e, t) => {
3828
+ if (e instanceof Map) {
3829
+ const n = new Map(e);
3830
+ if (t.length === 1)
3831
+ return n.delete(t[0]), n;
3832
+ const [s, ...r] = t;
3833
+ return n.set(s, xt(n.get(s), r)), n;
3834
+ }
3835
+ if (e instanceof Set) {
3836
+ const n = xt(Array.from(e), t);
3837
+ return new Set(n);
3838
+ }
3839
+ if (Array.isArray(e)) {
3840
+ const n = [...e];
3841
+ if (t.length === 1)
3842
+ return n.filter((i, a) => a.toString() !== t[0]);
3843
+ const [s, ...r] = t;
3844
+ return n[s] = xt(n[s], r), n;
3845
+ }
3846
+ if (e instanceof Object) {
3847
+ const n = {
3848
+ ...e
3849
+ };
3850
+ if (t.length === 1)
3851
+ return delete n[t[0]], n;
3852
+ const [s, ...r] = t;
3853
+ return n[s] = xt(n[s], r), n;
3854
+ }
3855
+ return e;
3856
+ }, hr = (e, t) => {
3857
+ if (!e || document.querySelector("#_goober") || (t == null ? void 0 : t.querySelector("#_goober"))) return;
3858
+ const s = document.createElement("style"), r = document.createTextNode("");
3859
+ s.appendChild(r), s.id = "_goober", s.setAttribute("nonce", e), t ? t.appendChild(s) : document.head.appendChild(s);
3860
+ }, Fe, mt, Et, pt, Ce, yt, qe, Ke, Ve, He, $e, At, Qe, Tt, os, Ul = (os = class {
3861
+ constructor(e) {
3862
+ L(this, Fe);
3863
+ L(this, mt);
3864
+ L(this, Et);
3865
+ L(this, pt);
3866
+ L(this, Ce, !1);
3867
+ L(this, yt);
3868
+ L(this, qe);
3869
+ L(this, Ke);
3870
+ L(this, Ve);
3871
+ L(this, He);
3872
+ L(this, $e);
3873
+ L(this, At);
3874
+ L(this, Qe);
3875
+ L(this, Tt);
3876
+ const {
3877
+ client: t,
3878
+ queryFlavor: n,
3879
+ version: s,
3880
+ onlineManager: r,
3881
+ buttonPosition: i,
3882
+ position: a,
3883
+ initialIsOpen: o,
3884
+ errorTypes: l,
3885
+ styleNonce: d,
3886
+ shadowDOMTarget: f,
3887
+ hideDisabledQueries: u
3888
+ } = e;
3889
+ N(this, Fe, M(t)), N(this, Et, n), N(this, pt, s), N(this, mt, r), N(this, yt, d), N(this, qe, f), N(this, Ke, M(i)), N(this, Ve, M(a)), N(this, He, M(o)), N(this, $e, M(l)), N(this, At, M(u));
3890
+ }
3891
+ setButtonPosition(e) {
3892
+ _(this, Ke)[1](e);
3893
+ }
3894
+ setPosition(e) {
3895
+ _(this, Ve)[1](e);
3896
+ }
3897
+ setInitialIsOpen(e) {
3898
+ _(this, He)[1](e);
3899
+ }
3900
+ setErrorTypes(e) {
3901
+ _(this, $e)[1](e);
3902
+ }
3903
+ setClient(e) {
3904
+ _(this, Fe)[1](e);
3905
+ }
3906
+ mount(e) {
3907
+ if (_(this, Ce))
3908
+ throw new Error("Devtools is already mounted");
3909
+ const t = Ws(() => {
3910
+ const n = this, [s] = _(this, Ke), [r] = _(this, Ve), [i] = _(this, He), [a] = _(this, $e), [o] = _(this, At), [l] = _(this, Fe);
3911
+ let d;
3912
+ return _(this, Qe) ? d = _(this, Qe) : (d = Qs(() => import("./NCMVHL6D-DpycZ17L.js")), N(this, Qe, d)), hr(_(this, yt), _(this, qe)), Hs(d, $s({
3913
+ get queryFlavor() {
3914
+ return _(n, Et);
3915
+ },
3916
+ get version() {
3917
+ return _(n, pt);
3918
+ },
3919
+ get onlineManager() {
3920
+ return _(n, mt);
3921
+ },
3922
+ get shadowDOMTarget() {
3923
+ return _(n, qe);
3924
+ }
3925
+ }, {
3926
+ get client() {
3927
+ return l();
3928
+ },
3929
+ get buttonPosition() {
3930
+ return s();
3931
+ },
3932
+ get position() {
3933
+ return r();
3934
+ },
3935
+ get initialIsOpen() {
3936
+ return i();
3937
+ },
3938
+ get errorTypes() {
3939
+ return a();
3940
+ },
3941
+ get hideDisabledQueries() {
3942
+ return o();
3943
+ }
3944
+ }));
3945
+ }, e);
3946
+ N(this, Ce, !0), N(this, Tt, t);
3947
+ }
3948
+ unmount() {
3949
+ var e;
3950
+ if (!_(this, Ce))
3951
+ throw new Error("Devtools is not mounted");
3952
+ (e = _(this, Tt)) == null || e.call(this), N(this, Ce, !1);
3953
+ }
3954
+ }, Fe = new WeakMap(), mt = new WeakMap(), Et = new WeakMap(), pt = new WeakMap(), Ce = new WeakMap(), yt = new WeakMap(), qe = new WeakMap(), Ke = new WeakMap(), Ve = new WeakMap(), He = new WeakMap(), $e = new WeakMap(), At = new WeakMap(), Qe = new WeakMap(), Tt = new WeakMap(), os), je, St, _t, Pt, Le, wt, We, ze, Ye, Je, Xe, vt, Ze, et, bt, ls, Bl = (ls = class {
3955
+ constructor(e) {
3956
+ L(this, je);
3957
+ L(this, St);
3958
+ L(this, _t);
3959
+ L(this, Pt);
3960
+ L(this, Le, !1);
3961
+ L(this, wt);
3962
+ L(this, We);
3963
+ L(this, ze);
3964
+ L(this, Ye);
3965
+ L(this, Je);
3966
+ L(this, Xe);
3967
+ L(this, vt);
3968
+ L(this, Ze);
3969
+ L(this, et);
3970
+ L(this, bt);
3971
+ const {
3972
+ client: t,
3973
+ queryFlavor: n,
3974
+ version: s,
3975
+ onlineManager: r,
3976
+ buttonPosition: i,
3977
+ position: a,
3978
+ initialIsOpen: o,
3979
+ errorTypes: l,
3980
+ styleNonce: d,
3981
+ shadowDOMTarget: f,
3982
+ onClose: u,
3983
+ hideDisabledQueries: h
3984
+ } = e;
3985
+ N(this, je, M(t)), N(this, _t, n), N(this, Pt, s), N(this, St, r), N(this, wt, d), N(this, We, f), N(this, ze, M(i)), N(this, Ye, M(a)), N(this, Je, M(o)), N(this, Xe, M(l)), N(this, vt, M(h)), N(this, Ze, M(u));
3986
+ }
3987
+ setButtonPosition(e) {
3988
+ _(this, ze)[1](e);
3989
+ }
3990
+ setPosition(e) {
3991
+ _(this, Ye)[1](e);
3992
+ }
3993
+ setInitialIsOpen(e) {
3994
+ _(this, Je)[1](e);
3995
+ }
3996
+ setErrorTypes(e) {
3997
+ _(this, Xe)[1](e);
3998
+ }
3999
+ setClient(e) {
4000
+ _(this, je)[1](e);
4001
+ }
4002
+ setOnClose(e) {
4003
+ _(this, Ze)[1](() => e);
4004
+ }
4005
+ mount(e) {
4006
+ if (_(this, Le))
4007
+ throw new Error("Devtools is already mounted");
4008
+ const t = Ws(() => {
4009
+ const n = this, [s] = _(this, ze), [r] = _(this, Ye), [i] = _(this, Je), [a] = _(this, Xe), [o] = _(this, vt), [l] = _(this, je), [d] = _(this, Ze);
4010
+ let f;
4011
+ return _(this, et) ? f = _(this, et) : (f = Qs(() => import("./2AITGKQY-gEvxLMa5.js")), N(this, et, f)), hr(_(this, wt), _(this, We)), Hs(f, $s({
4012
+ get queryFlavor() {
4013
+ return _(n, _t);
4014
+ },
4015
+ get version() {
4016
+ return _(n, Pt);
4017
+ },
4018
+ get onlineManager() {
4019
+ return _(n, St);
4020
+ },
4021
+ get shadowDOMTarget() {
4022
+ return _(n, We);
4023
+ }
4024
+ }, {
4025
+ get client() {
4026
+ return l();
4027
+ },
4028
+ get buttonPosition() {
4029
+ return s();
4030
+ },
4031
+ get position() {
4032
+ return r();
4033
+ },
4034
+ get initialIsOpen() {
4035
+ return i();
4036
+ },
4037
+ get errorTypes() {
4038
+ return a();
4039
+ },
4040
+ get hideDisabledQueries() {
4041
+ return o();
4042
+ },
4043
+ get onClose() {
4044
+ return d();
4045
+ }
4046
+ }));
4047
+ }, e);
4048
+ N(this, Le, !0), N(this, bt, t);
4049
+ }
4050
+ unmount() {
4051
+ var e;
4052
+ if (!_(this, Le))
4053
+ throw new Error("Devtools is not mounted");
4054
+ (e = _(this, bt)) == null || e.call(this), N(this, Le, !1);
4055
+ }
4056
+ }, je = new WeakMap(), St = new WeakMap(), _t = new WeakMap(), Pt = new WeakMap(), Le = new WeakMap(), wt = new WeakMap(), We = new WeakMap(), ze = new WeakMap(), Ye = new WeakMap(), Je = new WeakMap(), Xe = new WeakMap(), vt = new WeakMap(), Ze = new WeakMap(), et = new WeakMap(), bt = new WeakMap(), ls);
4057
+ function Ml(e) {
4058
+ const t = Z(e.client), n = j.useRef(null), {
4059
+ buttonPosition: s,
4060
+ position: r,
4061
+ initialIsOpen: i,
4062
+ errorTypes: a,
4063
+ styleNonce: o,
4064
+ shadowDOMTarget: l,
4065
+ hideDisabledQueries: d
4066
+ } = e, [f] = j.useState(
4067
+ new Ul({
4068
+ client: t,
4069
+ queryFlavor: "React Query",
4070
+ version: "5",
4071
+ onlineManager: fs,
4072
+ buttonPosition: s,
4073
+ position: r,
4074
+ initialIsOpen: i,
4075
+ errorTypes: a,
4076
+ styleNonce: o,
4077
+ shadowDOMTarget: l,
4078
+ hideDisabledQueries: d
4079
+ })
4080
+ );
4081
+ return j.useEffect(() => {
4082
+ f.setClient(t);
4083
+ }, [t, f]), j.useEffect(() => {
4084
+ s && f.setButtonPosition(s);
4085
+ }, [s, f]), j.useEffect(() => {
4086
+ r && f.setPosition(r);
4087
+ }, [r, f]), j.useEffect(() => {
4088
+ f.setInitialIsOpen(i || !1);
4089
+ }, [i, f]), j.useEffect(() => {
4090
+ f.setErrorTypes(a || []);
4091
+ }, [a, f]), j.useEffect(() => (n.current && f.mount(n.current), () => {
4092
+ f.unmount();
4093
+ }), [f]), /* @__PURE__ */ c("div", { dir: "ltr", className: "tsqd-parent-container", ref: n });
4094
+ }
4095
+ function Fl(e) {
4096
+ const t = Z(e.client), n = j.useRef(null), { errorTypes: s, styleNonce: r, shadowDOMTarget: i, hideDisabledQueries: a } = e, [o] = j.useState(
4097
+ new Bl({
4098
+ client: t,
4099
+ queryFlavor: "React Query",
4100
+ version: "5",
4101
+ onlineManager: fs,
4102
+ buttonPosition: "bottom-left",
4103
+ position: "bottom",
4104
+ initialIsOpen: !0,
4105
+ errorTypes: s,
4106
+ styleNonce: r,
4107
+ shadowDOMTarget: i,
4108
+ onClose: e.onClose,
4109
+ hideDisabledQueries: a
4110
+ })
4111
+ );
4112
+ return j.useEffect(() => {
4113
+ o.setClient(t);
4114
+ }, [t, o]), j.useEffect(() => {
4115
+ o.setOnClose(e.onClose ?? (() => {
4116
+ }));
4117
+ }, [e.onClose, o]), j.useEffect(() => {
4118
+ o.setErrorTypes(s || []);
4119
+ }, [s, o]), j.useEffect(() => (n.current && o.mount(n.current), () => {
4120
+ o.unmount();
4121
+ }), [o]), /* @__PURE__ */ c(
4122
+ "div",
4123
+ {
4124
+ style: { height: "500px", ...e.style },
4125
+ className: "tsqd-parent-container",
4126
+ ref: n
4127
+ }
4128
+ );
4129
+ }
4130
+ var rs = process.env.NODE_ENV !== "development" ? function() {
4131
+ return null;
4132
+ } : Ml;
4133
+ process.env.NODE_ENV;
4134
+ const ql = pe(""), Kl = () => {
4135
+ Mn("dynamic-page-selector", {
4136
+ description: "Dynamic page selector"
4137
+ }), Mn("enable-add-page-dropdown", {
4138
+ description: "Enable add page dropdown"
4139
+ });
4140
+ }, Vl = () => {
4141
+ const e = x(), t = O();
4142
+ return ie({
4143
+ queryKey: [E.GET_COLLECTIONS],
4144
+ staleTime: 1 / 0,
4145
+ queryFn: async () => t(e, { action: E.GET_COLLECTIONS })
4146
+ });
4147
+ }, Hl = () => {
4148
+ const { data: e } = oe(), { data: t } = ve(), { data: n } = Re(), s = x(), r = O(), i = Q(() => (n == null ? void 0 : n.fallbackLang) || "en", [n == null ? void 0 : n.fallbackLang]);
4149
+ return ae({
4150
+ mutationFn: async ({ block: a }) => r(s, {
4151
+ action: E.GET_BLOCK_ASYNC_PROPS,
4152
+ data: {
4153
+ block: a,
4154
+ lang: (t == null ? void 0 : t.lang) || i,
4155
+ pageProps: {
4156
+ slug: t == null ? void 0 : t.slug,
4157
+ searchParams: {},
4158
+ pageType: t == null ? void 0 : t.pageType,
4159
+ fallbackLang: i,
4160
+ lastSaved: t.lastSaved,
4161
+ pageId: e.id,
4162
+ primaryPageId: t.primaryPage || e.id,
4163
+ pageBaseSlug: t == null ? void 0 : t.slug,
4164
+ dynamic: e == null ? void 0 : e.dynamic,
4165
+ //
4166
+ languagePageId: t.id
4167
+ }
4168
+ }
4169
+ })
4170
+ });
4171
+ }, $l = () => {
4172
+ const [, e] = le();
4173
+ return H(
4174
+ (t, n) => {
4175
+ const r = new URLSearchParams(window.location.search).get("lang"), i = new URLSearchParams({ page: t });
4176
+ r && i.set("lang", r), window.history.pushState({}, "", `?${i.toString()}`), e(i), window.dispatchEvent(new PopStateEvent("popstate")), n == null || n();
4177
+ },
4178
+ [e]
4179
+ );
4180
+ }, Ql = () => {
4181
+ const e = $l();
4182
+ return H(
4183
+ ({ pageId: t }) => {
4184
+ e(t);
4185
+ },
4186
+ [e]
4187
+ );
4188
+ }, jl = q(() => import("./digital-asset-manager-hqMwBWhb.js")), Wl = q(() => import("./save-to-lib-B5k0MVbW.js")), zl = q(() => import("./theme-panel-footer-zLXS6SHh.js")), Yl = q(() => import("./web-preview-BDTdFQ2h.js"));
4189
+ Kl();
4190
+ $i();
4191
+ Hr(Wa);
4192
+ go();
4193
+ $r(jl);
4194
+ Qr(Wl);
4195
+ const Jl = {
4196
+ role: "",
4197
+ permissions: null
4198
+ }, is = (e) => {
4199
+ to(), oa();
4200
+ const t = kn(), { data: n = Jl, isFetching: s } = no(), { data: r, isFetching: i } = Ie(), { data: a, isFetching: o } = Vl(), { data: l, isFetching: d } = Re(), f = s || i || o || d, [u] = le(), h = u.get("page"), { data: m } = oe(), { data: y, isFetching: A } = Xa(), { blocks: T } = Ja(y), { lockingStatus: p, pageLock: S } = be(), { data: I, isFetching: R } = Za(), B = za(), { onSave: C } = so(), { mutateAsync: ye } = Hl(), { getPartialBlocks: Ae, getPartialBlockBlocks: k } = ro(), { mutateAsync: w } = Pa(), { mutateAsync: v } = eo(), z = Ql(), [$, ce] = F(!1), st = at([]), _e = Q(() => K(l, "theme", {}) || {}, [l]), rt = ge(p) && (S == null ? void 0 : S.status) === "editing", Ne = (S == null ? void 0 : S.status) === "checking", On = A || Ne || R;
4201
+ st.current = T;
4202
+ const [gr] = te(ql);
4203
+ ne(() => {
4204
+ const ue = () => {
4205
+ document.hidden ? ce(!0) : ce(!1);
4206
+ };
4207
+ return window.addEventListener("visibilitychange", ue), () => window.removeEventListener("visibilitychange", ue);
4208
+ }, []);
4209
+ const mr = Q(() => {
4210
+ const ue = {};
4211
+ return n && (ue.permissions = K(n, "permissions", null), ue.role = K(n, "role", "user")), ue;
4212
+ }, [n]), Er = H(
4213
+ async (ue, Nt) => await w({ pageType: ue, query: Nt }),
4214
+ [w]
4215
+ );
4216
+ return /* @__PURE__ */ g(me, { children: [
4217
+ On && /* @__PURE__ */ c(Is, { className: f ? "fixed inset-0 bg-white" : "bg-white/75", children: /* @__PURE__ */ c(Ft, { className: `animate-spin text-primary ${f ? "h-6 w-6" : "h-5 w-5"}` }) }),
4218
+ gr && /* @__PURE__ */ c(
4219
+ V,
4220
+ {
4221
+ fallback: /* @__PURE__ */ c("div", { className: "absolute inset-0 z-[999999] flex min-h-screen w-screen items-center justify-center bg-gray-100", children: /* @__PURE__ */ c(Ft, { className: "h-6 w-6 animate-spin text-primary" }) }),
4222
+ children: /* @__PURE__ */ c(Yl, {})
4223
+ }
4224
+ ),
4225
+ /* @__PURE__ */ c(
4226
+ jr,
4227
+ {
4228
+ gotoPage: z,
4229
+ collections: a ?? [],
4230
+ getBlockAsyncProps: ye,
4231
+ pageExternalData: I,
4232
+ themePresets: e.themePresets ?? [],
4233
+ pageId: m == null ? void 0 : m.id,
4234
+ loading: A,
4235
+ fallbackLang: t,
4236
+ languages: (l == null ? void 0 : l.languages) || [],
4237
+ brandingOptions: (l == null ? void 0 : l.theme) || {},
4238
+ translations: e.translations || {},
4239
+ locale: e.locale || "en",
4240
+ htmlDir: e.htmlDir || "ltr",
4241
+ autoSave: !$ && rt && (e.autoSave ?? !0),
4242
+ autoSaveInterval: e.autoSaveInterval ?? 15,
4243
+ onError: e.onError || console.error,
4244
+ getPartialBlockBlocks: k,
4245
+ getPartialBlocks: Ae,
4246
+ blocks: A ? [] : T,
4247
+ theme: Gr(_e),
4248
+ pageTypes: r,
4249
+ searchPageTypeItems: Er,
4250
+ askAiCallBack: B,
4251
+ onSave: async ({ blocks: ue, theme: Nt, needTranslations: pr }) => {
4252
+ if (!h) return !0;
4253
+ st.current = ue;
4254
+ const xn = [...ue];
4255
+ return await C({ page: h, blocks: xn, needTranslations: pr }), st.current = xn, Or(Nt, _e) || await v({ settings: { theme: Nt } }), !0;
4256
+ },
4257
+ themePanelComponent: zl,
4258
+ ...mr
4259
+ }
4260
+ ),
4261
+ /* @__PURE__ */ g("div", { children: [
4262
+ /* @__PURE__ */ c(da, { isFetchingPage: On }),
4263
+ /* @__PURE__ */ c(fa, {})
4264
+ ] })
4265
+ ] });
4266
+ }, Xl = new Rr({
4267
+ defaultOptions: {
4268
+ queries: {
4269
+ refetchOnWindowFocus: !1,
4270
+ refetchOnReconnect: !1,
4271
+ refetchOnMount: !1
4272
+ }
4273
+ }
4274
+ }), ru = (e) => {
4275
+ const [, t] = bn(), [n, s] = F(!1);
4276
+ return ne(() => (t(
4277
+ _n(e, [
4278
+ "apiUrl",
4279
+ "usersApiUrl",
4280
+ "assetsApiUrl",
4281
+ "getPreviewUrl",
4282
+ "getLiveUrl",
4283
+ "topLeftCorner",
4284
+ "onLogout",
4285
+ "getAccessToken",
4286
+ "websocket",
4287
+ "getLoggedInUser",
4288
+ "features",
4289
+ "currentUser"
4290
+ ])
4291
+ ), setTimeout(() => {
4292
+ s(!0);
4293
+ }, 200), () => {
4294
+ s(!1), t({});
4295
+ }), [e, t]), n ? K(e, "hasReactQueryProvider", !1) === !0 ? /* @__PURE__ */ g(me, { children: [
4296
+ /* @__PURE__ */ c(is, { ...e }),
4297
+ /* @__PURE__ */ c(rs, {})
4298
+ ] }) : /* @__PURE__ */ g(Ur, { client: Xl, children: [
4299
+ /* @__PURE__ */ c(is, { ...e }),
4300
+ /* @__PURE__ */ c(rs, {})
4301
+ ] }) : /* @__PURE__ */ c("div", {});
4302
+ }, Zl = j.lazy(() => import("./nested-path-selector-content-DvIL_EoN.js"));
4303
+ function ec({ data: e, onSelect: t, dataType: n = "value", disabled: s = !1 }) {
4304
+ const [r, i] = j.useState(!1);
4305
+ return /* @__PURE__ */ g(di, { open: r, onOpenChange: i, children: [
4306
+ /* @__PURE__ */ g(Wt, { children: [
4307
+ /* @__PURE__ */ c(zt, { asChild: !0, children: /* @__PURE__ */ c(fi, { asChild: !0, children: /* @__PURE__ */ c(
4308
+ U,
4309
+ {
4310
+ size: "sm",
4311
+ variant: "outline",
4312
+ className: "h-6 w-6 px-1 py-0 text-[9px] text-muted-foreground",
4313
+ role: "combobox",
4314
+ "aria-expanded": r,
4315
+ disabled: s,
4316
+ children: /* @__PURE__ */ c("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24px", height: "24px", viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ c(
4317
+ "path",
4318
+ {
4319
+ d: "M9.5 5H9C7.89543 5 7 5.89543 7 7V9C7 10 6.4 12 4 12C5 12 7 12.6 7 15V17.0002C7 18.1048 7.89543 19 9 19H9.5M14.5 5H15C16.1046 5 17 5.89543 17 7V9C17 10 17.6 12 20 12C19 12 17 12.6 17 15V17.0002C17 18.1048 16.1046 19 15 19H14.5",
4320
+ stroke: "#000000",
4321
+ strokeLinecap: "round",
4322
+ strokeLinejoin: "round",
4323
+ strokeWidth: "2"
4324
+ }
4325
+ ) })
4326
+ }
4327
+ ) }) }),
4328
+ /* @__PURE__ */ c(Yt, { children: "Add field" })
4329
+ ] }),
4330
+ r && /* @__PURE__ */ c(j.Suspense, { children: /* @__PURE__ */ c(
4331
+ Zl,
4332
+ {
4333
+ data: e,
4334
+ onSelect: t,
4335
+ dataType: n,
4336
+ open: r,
4337
+ setOpen: i
4338
+ }
4339
+ ) })
4340
+ ] });
4341
+ }
4342
+ const iu = () => {
4343
+ const { savePageAsync: e } = Ge(), t = Z();
4344
+ return H(async () => {
4345
+ await e(), t.invalidateQueries({ queryKey: [E.GET_DRAFT_PAGE] }), t.invalidateQueries({ queryKey: [E.GET_BUILDER_PAGE_DATA] });
4346
+ }, [e, t]);
4347
+ }, au = () => {
4348
+ const e = Z();
4349
+ return H(() => {
4350
+ e.clear();
4351
+ }, [e]);
4352
+ }, ou = () => {
4353
+ const e = x(), t = O(), { data: n } = ve(), s = Z();
4354
+ return ae({
4355
+ mutationFn: async (r) => {
4356
+ if (!(n != null && n.id))
4357
+ throw new Error("No active page found");
4358
+ return await t(`${e}`, {
4359
+ action: E.UPDATE_PAGE_METADATA,
4360
+ data: {
4361
+ id: n.id,
4362
+ metadata: r
4363
+ }
4364
+ });
4365
+ },
4366
+ onSuccess: () => {
4367
+ s.invalidateQueries({
4368
+ queryKey: [E.GET_BUILDER_PAGE_DATA]
4369
+ }), s.invalidateQueries({
4370
+ queryKey: [E.GET_LANGUAGE_PAGES]
4371
+ });
4372
+ },
4373
+ onError: () => {
4374
+ console.error("Failed to update metadata");
4375
+ }
4376
+ });
4377
+ }, tc = q(() => import("./digital-asset-manager-hqMwBWhb.js")), lu = ({
4378
+ assetId: e,
4379
+ assetUrl: t,
4380
+ onChange: n,
4381
+ className: s = "",
4382
+ placeholder: r = "Select an image",
4383
+ disabled: i = !1
4384
+ }) => {
4385
+ const [a, o] = F(!1), l = () => {
4386
+ i || o(!0);
4387
+ }, d = () => {
4388
+ o(!1);
4389
+ }, f = (m) => {
4390
+ const y = Array.isArray(m) ? m[0] : m;
4391
+ y != null && y.url && n(_n(y, ["url", "id"])), o(!1);
4392
+ }, u = () => {
4393
+ n({ url: "", id: "" });
4394
+ }, h = (t == null ? void 0 : t.startsWith("{{")) && (t == null ? void 0 : t.endsWith("}}"));
4395
+ return /* @__PURE__ */ g("div", { className: `w-full ${s}`, children: [
4396
+ t ? /* @__PURE__ */ g("div", { className: "relative overflow-hidden rounded-md border", children: [
4397
+ h ? /* @__PURE__ */ c("div", { className: "flex h-12 items-center bg-gray-100 px-4", children: /* @__PURE__ */ c("p", { className: "text-xs text-gray-500", children: t }) }) : /* @__PURE__ */ c(
4398
+ "img",
4399
+ {
4400
+ onClick: l,
4401
+ src: t,
4402
+ alt: "Selected image",
4403
+ className: "h-auto max-h-[100px] w-full bg-gray-100 object-contain"
4404
+ }
4405
+ ),
4406
+ /* @__PURE__ */ g("div", { className: "absolute right-2 top-2 flex gap-2", children: [
4407
+ /* @__PURE__ */ c(
4408
+ U,
4409
+ {
4410
+ type: "button",
4411
+ variant: "outline",
4412
+ size: "icon",
4413
+ className: "h-8 w-8 rounded-full bg-white text-red-500",
4414
+ onClick: u,
4415
+ disabled: i,
4416
+ children: h ? /* @__PURE__ */ c(Qn, { className: "h-4 w-4" }) : /* @__PURE__ */ c(Ui, { className: "h-4 w-4" })
4417
+ }
4418
+ ),
4419
+ !h && /* @__PURE__ */ c(
4420
+ U,
4421
+ {
4422
+ type: "button",
4423
+ variant: "outline",
4424
+ size: "icon",
4425
+ className: "h-8 w-8 rounded-full bg-white/80 hover:bg-white/90",
4426
+ onClick: l,
4427
+ disabled: i,
4428
+ children: /* @__PURE__ */ c(jn, { className: "h-4 w-4" })
4429
+ }
4430
+ )
4431
+ ] })
4432
+ ] }) : /* @__PURE__ */ c(
4433
+ "div",
4434
+ {
4435
+ className: `flex cursor-pointer items-center justify-center rounded-md border border-dashed p-6 ${i ? "cursor-not-allowed opacity-50" : "hover:border-gray-400"}`,
4436
+ onClick: l,
4437
+ children: /* @__PURE__ */ g("div", { className: "flex flex-col items-center gap-2", children: [
4438
+ /* @__PURE__ */ c(jn, { className: "h-10 w-10 text-gray-400" }),
4439
+ /* @__PURE__ */ c("p", { className: "text-sm text-gray-500", children: r })
4440
+ ] })
4441
+ }
4442
+ ),
4443
+ /* @__PURE__ */ c(ps, { open: a, onOpenChange: o, children: /* @__PURE__ */ g(hi, { className: "h-fit w-full max-w-7xl overflow-hidden p-0", children: [
4444
+ /* @__PURE__ */ g(gi, { className: "hidden border-b px-4 py-2", children: [
4445
+ /* @__PURE__ */ c(mi, { children: "Select Image" }),
4446
+ /* @__PURE__ */ c(
4447
+ U,
4448
+ {
4449
+ type: "button",
4450
+ variant: "ghost",
4451
+ size: "icon",
4452
+ className: "absolute right-4 top-2",
4453
+ onClick: d,
4454
+ children: /* @__PURE__ */ c(Qn, { className: "h-4 w-4" })
4455
+ }
4456
+ )
4457
+ ] }),
4458
+ /* @__PURE__ */ c("div", { className: "h-full flex-1 p-4", children: /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(
4459
+ tc,
4460
+ {
4461
+ close: d,
4462
+ onSelect: f,
4463
+ mode: "image",
4464
+ assetId: e
4465
+ }
4466
+ ) }) })
4467
+ ] }) })
4468
+ ] });
4469
+ }, nc = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), as = (e) => {
4470
+ if (!e.trim())
4471
+ return { isValid: !1, parsed: null, placeholders: [], error: { message: "JSON is empty" } };
4472
+ try {
4473
+ return { isValid: !0, parsed: JSON.parse(e), error: null, placeholders: [] };
4474
+ } catch {
4475
+ }
4476
+ const t = /{{([^{}]+)}}/g, n = [];
4477
+ let s = e, r;
4478
+ for (; (r = t.exec(e)) !== null; ) {
4479
+ const i = r[0], a = r.index, o = `"__placeholder_${n.length}__"`;
4480
+ n.push({ original: i, replaced: o, position: a }), s = s.replace(i, o);
4481
+ }
4482
+ try {
4483
+ return { isValid: !0, parsed: JSON.parse(s), error: null, placeholders: n };
4484
+ } catch (i) {
4485
+ const a = i, o = a.message.match(/position (\d+)/), l = o ? parseInt(o[1]) : void 0;
4486
+ let d, f;
4487
+ if (l !== void 0) {
4488
+ const u = s.substring(0, l).split(`
4489
+ `);
4490
+ d = u.length, f = u[u.length - 1].length + 1;
4491
+ }
4492
+ return {
4493
+ isValid: !1,
4494
+ parsed: null,
4495
+ placeholders: n,
4496
+ error: {
4497
+ message: a.message,
4498
+ line: d,
4499
+ column: f,
4500
+ position: l
4501
+ }
4502
+ };
4503
+ }
4504
+ }, sc = (e, t) => {
4505
+ let s = JSON.stringify(e, null, 2);
4506
+ return t.forEach(({ original: r }, i) => {
4507
+ const a = `"__placeholder_${i}__"`, o = new RegExp(nc(a), "g");
4508
+ s = s.replace(o, r);
4509
+ }), s;
4510
+ }, rc = (e, t) => {
4511
+ if (!e) return "";
4512
+ let n = JSON.stringify(e, null, 2);
4513
+ const s = /{{([^{}]+)}}/g;
4514
+ let r;
4515
+ for (; (r = s.exec(n)) !== null; ) {
4516
+ const i = r[1], a = K(t, i, null);
4517
+ n = n.replace(r[0], a);
4518
+ }
4519
+ return n;
4520
+ }, ic = q(() => import("./shared-json-ld-ZtwsYt9H.js")), cu = ({
4521
+ value: e,
4522
+ onChange: t,
4523
+ disabled: n = !1,
4524
+ readOnly: s = !1,
4525
+ placeholder: r = "Enter JSON",
4526
+ rows: i = 6,
4527
+ id: a = "json-input",
4528
+ pageData: o = {},
4529
+ handleFieldInsert: l,
4530
+ hasJsonLdForSelectedLang: d,
4531
+ copyJsonLDFromDefaultPage: f
4532
+ }) => {
4533
+ const [u, h] = F("edit"), [m, y] = F(null), [A, T] = F(""), p = at(null), [S] = bn(), I = a === "jsonLD" && K(S, "features.sharedJsonLD", !1), R = a === "jsonLD" && !d && !!f;
4534
+ ne(() => {
4535
+ e.trim() === "" && t("{}");
4536
+ }, [e, t]);
4537
+ const B = (k) => {
4538
+ if (s) return;
4539
+ const w = k.target.value;
4540
+ t(w);
4541
+ }, C = (k) => {
4542
+ if (k.key === "Tab") {
4543
+ k.preventDefault();
4544
+ const w = k.currentTarget, v = w.selectionStart, z = w.selectionEnd;
4545
+ if (v !== z) {
4546
+ const ce = e.substring(v, z).split(`
4547
+ `);
4548
+ if (k.shiftKey) {
4549
+ const _e = ce.map((Ne) => Ne.startsWith(" ") ? Ne.substring(2) : Ne).join(`
4550
+ `), rt = e.substring(0, v) + _e + e.substring(z);
4551
+ t(rt), setTimeout(() => {
4552
+ w.selectionStart = v, w.selectionEnd = v + _e.length;
4553
+ }, 0);
4554
+ } else {
4555
+ const _e = ce.map((Ne) => ` ${Ne}`).join(`
4556
+ `), rt = e.substring(0, v) + _e + e.substring(z);
4557
+ t(rt), setTimeout(() => {
4558
+ w.selectionStart = v, w.selectionEnd = v + _e.length;
4559
+ }, 0);
4560
+ }
4561
+ } else {
4562
+ const $ = e.substring(0, v) + " " + e.substring(z);
4563
+ t($), setTimeout(() => {
4564
+ w.selectionStart = w.selectionEnd = v + 2;
4565
+ }, 0);
4566
+ }
4567
+ }
4568
+ };
4569
+ ne(() => {
4570
+ const k = as(e);
4571
+ if (k.isValid)
4572
+ if (y(null), k.parsed) {
4573
+ const w = rc(k.parsed, o);
4574
+ T(w);
4575
+ } else
4576
+ T("");
4577
+ else
4578
+ y(k.error), T("");
4579
+ }, [e, o]);
4580
+ const ye = () => {
4581
+ const k = as(e);
4582
+ if (k.isValid && k.parsed) {
4583
+ const w = sc(k.parsed, k.placeholders);
4584
+ t(w);
4585
+ }
4586
+ }, Ae = () => {
4587
+ m != null && m.position && p.current && (p.current.focus(), p.current.setSelectionRange(m.position, m.position + 1));
4588
+ };
4589
+ return /* @__PURE__ */ c("div", { className: "space-y-2", children: /* @__PURE__ */ g(Ei, { value: u, onValueChange: h, className: "w-full", children: [
4590
+ /* @__PURE__ */ g("div", { className: "mb-2 flex items-center justify-between", children: [
4591
+ /* @__PURE__ */ g(pi, { className: "w-max", children: [
4592
+ /* @__PURE__ */ g(tn, { value: "edit", className: "flex items-center gap-1", children: [
4593
+ /* @__PURE__ */ c(Bi, { className: "h-4 w-4" }),
4594
+ /* @__PURE__ */ c("span", { children: "Edit" })
4595
+ ] }),
4596
+ /* @__PURE__ */ g(
4597
+ tn,
4598
+ {
4599
+ value: "preview",
4600
+ className: "flex items-center gap-1",
4601
+ disabled: !e.trim() || m !== null || R,
4602
+ children: [
4603
+ /* @__PURE__ */ c(Mi, { className: "h-4 w-4" }),
4604
+ /* @__PURE__ */ c("span", { children: "Preview" })
4605
+ ]
4606
+ }
4607
+ ),
4608
+ I && /* @__PURE__ */ g(
4609
+ tn,
4610
+ {
4611
+ value: "shared",
4612
+ className: "flex items-center gap-1",
4613
+ disabled: !e.trim() || m !== null,
4614
+ children: [
4615
+ /* @__PURE__ */ c(Fi, { className: "h-4 w-4" }),
4616
+ /* @__PURE__ */ c("span", { children: "Shared" })
4617
+ ]
4618
+ }
4619
+ )
4620
+ ] }),
4621
+ R ? null : u === "edit" && !s && /* @__PURE__ */ c("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ c(
4622
+ ec,
4623
+ {
4624
+ dataType: "value",
4625
+ data: o ?? {},
4626
+ onSelect: (k) => l && l(k, a)
4627
+ }
4628
+ ) })
4629
+ ] }),
4630
+ /* @__PURE__ */ g(nn, { value: "edit", className: "relative mt-0", children: [
4631
+ !R && u === "edit" && /* @__PURE__ */ c(Dn, { content: "Format JSON", side: "right", showTooltip: !n && !m, children: /* @__PURE__ */ c(
4632
+ U,
4633
+ {
4634
+ type: "button",
4635
+ variant: "outline",
4636
+ size: "icon",
4637
+ onClick: ye,
4638
+ className: "absolute right-1 top-1 h-6 w-6 p-1",
4639
+ disabled: !e.trim() || n || m !== null,
4640
+ children: /* @__PURE__ */ c(qi, {})
4641
+ }
4642
+ ) }),
4643
+ R ? /* @__PURE__ */ c("div", { className: "flex h-40 items-center justify-center rounded-md bg-black/20", children: /* @__PURE__ */ g("div", { className: "flex max-w-[400px] flex-col items-center gap-2 rounded-md bg-white p-4 shadow-lg", children: [
4644
+ /* @__PURE__ */ c("div", { className: "max-w-xl text-center text-xs text-gray-500", children: "JSON-LD for is not added for selected language. JSON LD will be used from default language." }),
4645
+ /* @__PURE__ */ g(U, { type: "button", variant: "default", size: "sm", onClick: f, children: [
4646
+ /* @__PURE__ */ c(ys, {}),
4647
+ "Copy & Edit from default language"
4648
+ ] })
4649
+ ] }) }) : /* @__PURE__ */ c(
4650
+ Fn,
4651
+ {
4652
+ ref: p,
4653
+ id: a,
4654
+ name: a,
4655
+ className: `rounded-md border border-input text-xs ${m ? "border-red-500" : ""}`,
4656
+ onChange: B,
4657
+ onKeyDown: C,
4658
+ value: e,
4659
+ placeholder: r,
4660
+ rows: i,
4661
+ disabled: n,
4662
+ readOnly: s
4663
+ }
4664
+ ),
4665
+ m && /* @__PURE__ */ g(yi, { variant: "destructive", className: "mt-2", children: [
4666
+ /* @__PURE__ */ c(Ki, { className: "h-4 w-4" }),
4667
+ /* @__PURE__ */ g(Ai, { className: "flex flex-col", children: [
4668
+ /* @__PURE__ */ c("span", { className: "font-medium", children: "Invalid JSON" }),
4669
+ /* @__PURE__ */ c("span", { className: "text-sm", children: m.message }),
4670
+ m.line && m.column && /* @__PURE__ */ g("span", { className: "text-sm", children: [
4671
+ "Error at line ",
4672
+ m.line,
4673
+ ", column ",
4674
+ m.column
4675
+ ] }),
4676
+ /* @__PURE__ */ c(
4677
+ U,
4678
+ {
4679
+ type: "button",
4680
+ variant: "link",
4681
+ size: "sm",
4682
+ className: "mt-1 h-auto self-start p-0 text-sm",
4683
+ onClick: Ae,
4684
+ children: "Show position"
4685
+ }
4686
+ )
4687
+ ] })
4688
+ ] })
4689
+ ] }),
4690
+ /* @__PURE__ */ g(nn, { value: "preview", className: "mt-0", children: [
4691
+ /* @__PURE__ */ c(Fn, { rows: i, value: A, readOnly: !0, className: "cursor-default bg-muted font-mono text-sm" }),
4692
+ /* @__PURE__ */ c("p", { className: "mt-1 text-xs text-muted-foreground", children: "This is how the JSON will look after placeholder substitution." })
4693
+ ] }),
4694
+ I && /* @__PURE__ */ c(nn, { value: "shared", className: "mt-0", children: /* @__PURE__ */ c(V, { children: /* @__PURE__ */ c(ic, {}) }) })
4695
+ ] }) });
4696
+ }, ac = () => {
4697
+ const e = re("getAccessToken");
4698
+ return {
4699
+ getAccessToken: H(async () => {
4700
+ try {
4701
+ return await e();
4702
+ } catch {
4703
+ return "";
4704
+ }
4705
+ }, [e])
4706
+ };
4707
+ }, uu = () => {
4708
+ const { logout: e } = It(), { getAccessToken: t } = ac();
4709
+ return H(
4710
+ async ({
4711
+ url: n,
4712
+ method: s = "GET",
4713
+ body: r = {},
4714
+ headers: i = {}
4715
+ }) => {
4716
+ const a = await t();
4717
+ if (!a)
4718
+ throw new Error("No auth token");
4719
+ if (!n)
4720
+ throw new Error("URL is required");
4721
+ try {
4722
+ const o = await fetch(n, {
4723
+ method: s,
4724
+ headers: {
4725
+ "Content-Type": "application/json",
4726
+ Authorization: `Bearer ${a}`,
4727
+ ...i
4728
+ },
4729
+ body: JSON.stringify(r)
4730
+ });
4731
+ if (o.status === 401)
4732
+ return console.log("Session expired", o), await e(), window.location.reload(), null;
4733
+ if (o.status === 400)
4734
+ throw new Error((await o.json()).error);
4735
+ return await o.json();
4736
+ } catch (o) {
4737
+ throw console.log("Something went wrong", o), o;
4738
+ }
4739
+ },
4740
+ [e, t]
4741
+ );
4742
+ };
4743
+ if (typeof window > "u")
4744
+ throw new Error("@chaibuilder/pages is not available on the server");
4745
+ export {
4746
+ Zc as $,
4747
+ E as A,
4748
+ Is as B,
4749
+ J as C,
4750
+ $s as D,
4751
+ ko as E,
4752
+ Oc as F,
4753
+ xc as G,
4754
+ De as H,
4755
+ mn as I,
4756
+ Rc as J,
4757
+ kc as K,
4758
+ Lt as L,
4759
+ Kc as M,
4760
+ ct as N,
4761
+ Qc as O,
4762
+ $c as P,
4763
+ Vc as Q,
4764
+ To as R,
4765
+ Mc as S,
4766
+ Dn as T,
4767
+ Jo as U,
4768
+ En as V,
4769
+ Qo as W,
4770
+ Yc as X,
4771
+ Jc as Y,
4772
+ Yo as Z,
4773
+ Xc as _,
4774
+ eo as a,
4775
+ Uc as a0,
4776
+ Lc as a1,
4777
+ Hc as a2,
4778
+ X as a3,
4779
+ po as a4,
4780
+ Gl as a5,
4781
+ Bc as a6,
4782
+ Ot as a7,
4783
+ nu as a8,
4784
+ zc as a9,
4785
+ Ps as aA,
4786
+ Za as aB,
4787
+ _a as aC,
4788
+ bn as aD,
4789
+ Ea as aE,
4790
+ ec as aF,
4791
+ lu as aG,
4792
+ cu as aH,
4793
+ Ac as aI,
4794
+ ru as aJ,
4795
+ ve as aK,
4796
+ au as aL,
4797
+ Ql as aM,
4798
+ iu as aN,
4799
+ It as aO,
4800
+ no as aP,
4801
+ uu as aQ,
4802
+ Wi as aR,
4803
+ Wc as aa,
4804
+ Os as ab,
4805
+ ke as ac,
4806
+ jo as ad,
4807
+ jc as ae,
4808
+ qc as af,
4809
+ Fc as ag,
4810
+ xt as ah,
4811
+ Gc as ai,
4812
+ x as aj,
4813
+ O as ak,
4814
+ oe as al,
4815
+ ou as am,
4816
+ Cc as an,
4817
+ as as ao,
4818
+ sa as ap,
4819
+ la as aq,
4820
+ $l as ar,
4821
+ Nc as as,
4822
+ Ln as at,
4823
+ rn as au,
4824
+ de as av,
4825
+ Nn as aw,
4826
+ Tc as ax,
4827
+ Ra as ay,
4828
+ Sc as az,
4829
+ ws as b,
4830
+ _c as c,
4831
+ Pc as d,
4832
+ Re as e,
4833
+ kn as f,
4834
+ xe as g,
4835
+ Ie as h,
4836
+ le as i,
4837
+ Ss as j,
4838
+ Xi as k,
4839
+ vc as l,
4840
+ wc as m,
4841
+ bc as n,
4842
+ Ic as o,
4843
+ ql as p,
4844
+ su as q,
4845
+ Y as r,
4846
+ Hs as s,
4847
+ an as t,
4848
+ bs as u,
4849
+ eu as v,
4850
+ tu as w,
4851
+ M as x,
4852
+ Vo as y,
4853
+ Us as z
4854
+ };