@chaibuilder/pages 0.1.0-beta.4 → 0.1.0-beta.43

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