@chaibuilder/pages 0.7.7-beta.1 → 0.7.8

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.
@@ -6,21 +6,21 @@ var dl = (e, t, n) => t in e ? cl(e, t, { enumerable: !0, configurable: !0, writ
6
6
  var Hs = (e, t, n) => dl(e, typeof t != "symbol" ? t + "" : t, n), Ma = (e, t, n) => t.has(e) || Ba("Cannot " + n);
7
7
  var Z = (e, t, n) => (Ma(e, t, "read from private field"), n ? n.call(e) : t.get(e)), we = (e, t, n) => t.has(e) ? Ba("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, n), ye = (e, t, n, a) => (Ma(e, t, "write to private field"), a ? a.call(e, n) : t.set(e, n), n);
8
8
  import { jsx as s, jsxs as o, Fragment as ve } from "react/jsx-runtime";
9
- import { get as V, isEmpty as Q, reverse as ul, sortBy as hl, each as ml, find as be, set as St, has as _e, startCase as Gt, filter as Le, groupBy as fl, isObject as Fa, initial as gl, includes as Et, uniq as fr, union as pl, flatMap as ta, compact as xs, uniqBy as yl, keyBy as gr, mapValues as vl, toLower as _t, map as tt, endsWith as pr, startsWith as ds, isEqual as ba, orderBy as ns, first as yr, concat as bl, debounce as wl, upperCase as ja, pick as Ss, keys as Nl, pickBy as xl, isArray as Sl, values as El, noop as Al, isFunction as Tl, merge as Cl, cloneDeep as Pl, isString as $a } from "lodash-es";
9
+ import { get as V, isEmpty as Q, reverse as ul, sortBy as hl, each as ml, find as be, set as St, has as _e, startCase as Gt, filter as Le, groupBy as fl, isObject as Fa, initial as gl, includes as Et, uniq as fr, union as pl, flatMap as ta, compact as xs, uniqBy as yl, keyBy as gr, mapValues as vl, toLower as _t, map as et, endsWith as pr, startsWith as ds, isEqual as ba, orderBy as ns, first as yr, concat as bl, debounce as wl, upperCase as ja, pick as Ss, keys as Nl, pickBy as xl, isArray as Sl, values as El, noop as Al, isFunction as Tl, merge as Cl, cloneDeep as Pl, isString as $a } from "lodash-es";
10
10
  import * as Pe from "react";
11
- import Es, { useCallback as ie, useMemo as Y, useRef as Be, useState as E, useEffect as de, Suspense as wa, lazy as kl } from "react";
11
+ import Es, { useCallback as ie, useMemo as Y, useState as E, useEffect as de, useRef as tt, Suspense as wa, lazy as kl } from "react";
12
12
  import { useAtom as nt, atom as jt } from "jotai";
13
13
  import { useQueryClient as ke, useMutation as Ie, useQuery as Ge, onlineManager as vr, QueryClient as _l, QueryClientProvider as Il } from "@tanstack/react-query";
14
14
  import { toast as K, Toaster as Ll } from "sonner";
15
- import { useLanguages as ze, useChaiFeatureFlag as mt, useSavePage as Wn, useUpdateBlocksPropsRealtime as br, PERMISSIONS as Dl, usePartailBlocksStore as Ol, usePermissions as mn, useLibraryBlocks as Gl, useTheme as Rl, useSidebarActivePanel as As, mergeClasses as Na, useRightPanel as Ul, registerChaiLibrary as Bl, getBlocksFromHTML as Ml, useBuilderProp as Fl, useTranslation as jl, registerChaiSidebarPanel as ss, registerChaiFeatureFlag as Nn, registerChaiTopBar as $l, registerChaiMediaManager as ql, registerChaiSaveToLibrary as zl, ChaiBuilderEditor as Vl } from "@chaibuilder/sdk";
16
- import { Tooltip as ct, TooltipTrigger as dt, TooltipContent as ut, Card as Ts, CardHeader as Cs, CardTitle as Ps, CardContent as ks, CardFooter as _s, Button as A, AlertDialog as wr, AlertDialogTrigger as Nr, AlertDialogContent as xr, AlertDialogHeader as Sr, AlertDialogTitle as Er, AlertDialogDescription as Ar, AlertDialogFooter as Tr, AlertDialogCancel as Cr, AlertDialogAction as Pr, Popover as on, PopoverTrigger as cn, PopoverContent as dn, Input as xe, Label as oe, CommandList as kr, Command as Cn, CommandEmpty as Pn, CommandGroup as xt, CommandItem as ot, Dialog as Je, DialogContent as Xe, DialogHeader as Ze, DialogTitle as et, DialogDescription as rt, DialogFooter as ft, Alert as Qn, Textarea as un, DropdownMenu as fn, DropdownMenuTrigger as gn, DropdownMenuContent as pn, DropdownMenuItem as Me, Select as Kl, SelectTrigger as Hl, SelectValue as Wl, SelectContent as Ql, SelectItem as Ws, Badge as Qs, Separator as Yl, Sheet as _r, SheetContent as Ir, SheetHeader as Lr, SheetTitle as Dr, SheetDescription as Jl, TooltipProvider as It, SheetTrigger as Xl, ScrollArea as Zl, Skeleton as as, DropdownMenuSeparator as eo, CardDescription as to, CommandInput as no, Tabs as Or, TabsList as Gr, TabsTrigger as ms, TabsContent as fs, AlertDescription as Rr, HoverCard as so, HoverCardTrigger as ao, HoverCardContent as ro, Switch as io } from "@chaibuilder/sdk/ui";
15
+ import { useLanguages as qe, useChaiFeatureFlag as mt, useSavePage as Wn, useUpdateBlocksPropsRealtime as br, PERMISSIONS as Dl, usePartailBlocksStore as Ol, usePermissions as mn, useLibraryBlocks as Gl, useTheme as Rl, useSidebarActivePanel as As, mergeClasses as Na, useRightPanel as Ul, registerChaiLibrary as Bl, getBlocksFromHTML as Ml, useBuilderProp as Fl, useTranslation as jl, registerChaiSidebarPanel as ss, registerChaiFeatureFlag as Nn, registerChaiTopBar as $l, registerChaiMediaManager as ql, registerChaiSaveToLibrary as zl, ChaiBuilderEditor as Vl } from "@chaibuilder/sdk";
16
+ import { Tooltip as ct, TooltipTrigger as dt, TooltipContent as ut, Card as Ts, CardHeader as Cs, CardTitle as Ps, CardContent as ks, CardFooter as _s, Button as A, AlertDialog as wr, AlertDialogTrigger as Nr, AlertDialogContent as xr, AlertDialogHeader as Sr, AlertDialogTitle as Er, AlertDialogDescription as Ar, AlertDialogFooter as Tr, AlertDialogCancel as Cr, AlertDialogAction as Pr, Popover as on, PopoverTrigger as cn, PopoverContent as dn, Input as xe, Label as oe, CommandList as kr, Command as Cn, CommandEmpty as Pn, CommandGroup as xt, CommandItem as ot, Dialog as Ye, DialogContent as Je, DialogHeader as Xe, DialogTitle as Ze, DialogDescription as rt, DialogFooter as ft, Alert as Qn, Textarea as un, DropdownMenu as fn, DropdownMenuTrigger as gn, DropdownMenuContent as pn, DropdownMenuItem as Be, Select as Kl, SelectTrigger as Hl, SelectValue as Wl, SelectContent as Ql, SelectItem as Ws, Badge as Qs, Separator as Yl, Sheet as _r, SheetContent as Ir, SheetHeader as Lr, SheetTitle as Dr, SheetDescription as Jl, TooltipProvider as It, SheetTrigger as Xl, ScrollArea as Zl, Skeleton as as, DropdownMenuSeparator as eo, CardDescription as to, CommandInput as no, Tabs as Or, TabsList as Gr, TabsTrigger as ms, TabsContent as fs, AlertDescription as Rr, HoverCard as so, HoverCardTrigger as ao, HoverCardContent as ro, Switch as io } from "@chaibuilder/sdk/ui";
17
17
  import { formatDistanceToNow as Ur, format as Is } from "date-fns";
18
18
  import { LockIcon as xa, UserIcon as lo, AlertTriangleIcon as oo, AccessibilityIcon as co, Trash2 as Ls, Plus as Sa, ImageIcon as kn, X as _n, AlertCircle as Ds, ChevronDown as Bt, Search as Mt, Check as pt, Tag as uo, File as Yn, CopyPlusIcon as ho, Pencil as Br, Power as Mr, Trash as Ea, SquareLibrary as qa, ChevronsUpDown as mo, ChevronsDownUp as fo, ChevronRight as Fr, StarsIcon as go, Globe as po, MoreHorizontal as Os, StarIcon as yo, PencilIcon as vo, TrashIcon as bo, Languages as wo, Star as No, LogsIcon as xo, History as So, Eye as Gs, ExternalLink as na, Undo2 as jr, CloudOff as Eo, Rocket as sa, Save as $r, GlobeIcon as Ao, Palette as To, CheckCircle as Co, Loader as Ft, Send as za, Settings as qr, EyeOff as Po, Loader2 as Aa, LanguagesIcon as ko, DatabaseIcon as _o, ChevronLeft as zr, Sparkle as Io, Code as Lo, AlertTriangle as Vr, User as Do, Copy as Kr, Link as Oo, Archive as Go, Film as Ro, Edit as Uo, Upload as Bo } from "lucide-react";
19
19
  import { useRegisteredChaiBlocks as Mo, getDefaultBlockProps as Fo } from "@chaibuilder/runtime";
20
20
  import { z as us } from "zod";
21
21
  import { useDropzone as jo } from "react-dropzone";
22
22
  import { loadWebBlocks as $o } from "@chaibuilder/sdk/web-blocks";
23
- const We = {
23
+ const He = {
24
24
  ab: "Abkhazian",
25
25
  aa: "Afar",
26
26
  af: "Afrikaans",
@@ -305,8 +305,8 @@ function Wo(e = () => {
305
305
  a = g;
306
306
  }
307
307
  return r;
308
- }, p = (m = (h = e()) == null ? void 0 : h.getItem(d)) != null ? m : null;
309
- return Ho(p) ? p.then(w) : w(p);
308
+ }, y = (m = (h = e()) == null ? void 0 : h.getItem(d)) != null ? m : null;
309
+ return Ho(y) ? y.then(w) : w(y);
310
310
  },
311
311
  setItem: (d, u) => {
312
312
  var h;
@@ -320,13 +320,13 @@ function Wo(e = () => {
320
320
  return (u = e()) == null ? void 0 : u.removeItem(d);
321
321
  }
322
322
  }, l = (d) => (u, h, m) => d(u, (w) => {
323
- let p;
323
+ let y;
324
324
  try {
325
- p = JSON.parse(w || "");
325
+ y = JSON.parse(w || "");
326
326
  } catch {
327
- p = m;
327
+ y = m;
328
328
  }
329
- h(p);
329
+ h(y);
330
330
  });
331
331
  let c;
332
332
  try {
@@ -398,35 +398,33 @@ if (import.meta.vitest) {
398
398
  });
399
399
  }
400
400
  const J = () => {
401
- const { user: e, logout: t } = it(), n = ke(), a = Be(e), r = Be(t), i = Be(n);
402
- return a.current = e, r.current = t, i.current = n, ie(
403
- async (l, c, d = {}) => {
404
- var h;
405
- const u = (h = a.current) == null ? void 0 : h.accessToken;
406
- if (!u)
401
+ const { user: e, logout: t } = it(), n = ke(), a = e == null ? void 0 : e.accessToken;
402
+ return ie(
403
+ async (r, i, l = {}) => {
404
+ if (!a)
407
405
  return null;
408
406
  try {
409
- const m = V(c, "action", "").toLowerCase(), w = await Rs(l + (m ? `?action=${m}` : ""), c, {
410
- ...d,
411
- Authorization: `Bearer ${u}`
407
+ const c = V(i, "action", "").toLowerCase(), d = await Rs(r + (c ? `?action=${c}` : ""), i, {
408
+ ...l,
409
+ Authorization: `Bearer ${a}`
412
410
  });
413
- if (w.status === 401)
414
- return console.log("401 Response", w), i.current.invalidateQueries({ queryKey: [H] }), r.current(), window.location.reload(), null;
415
- if (!w.ok) {
416
- const p = await w.json();
417
- throw console.error(`API Error (${w.status}):`, p), {
418
- status: w.status,
419
- statusText: w.statusText,
420
- ...p,
421
- message: p.error || p.message || `Server error: ${w.status}`
411
+ if (d.status === 401)
412
+ return console.log("401 Response", d), n.invalidateQueries({ queryKey: [H] }), t(), window.location.reload(), null;
413
+ if (!d.ok) {
414
+ const u = await d.json();
415
+ throw console.error(`API Error (${d.status}):`, u), {
416
+ status: d.status,
417
+ statusText: d.statusText,
418
+ ...u,
419
+ message: u.error || u.message || `Server error: ${d.status}`
422
420
  };
423
421
  }
424
- return await w.json();
425
- } catch (m) {
426
- throw console.error("API request failed:", c, m), m;
422
+ return await d.json();
423
+ } catch (c) {
424
+ throw console.error("API request failed:", i, c), c;
427
425
  }
428
426
  },
429
- []
427
+ [a, t, n]
430
428
  );
431
429
  }, Qr = () => {
432
430
  const e = le(), t = ke(), n = J();
@@ -473,7 +471,7 @@ const J = () => {
473
471
  }
474
472
  });
475
473
  };
476
- function Ve() {
474
+ function ze() {
477
475
  const [e, t] = E(
478
476
  new URLSearchParams(window.location.search)
479
477
  );
@@ -487,7 +485,7 @@ function Ve() {
487
485
  }, []), [e, t];
488
486
  }
489
487
  const Xo = jt({}), Jr = () => nt(Xo), Zo = () => {
490
- const [e] = Ve(), t = e.get("page"), n = Be(""), { mutate: a } = Qr();
488
+ const [e] = ze(), t = e.get("page"), n = tt(""), { mutate: a } = Qr();
491
489
  de(() => {
492
490
  !Q(n.current) && t !== n.current && a({ id: n.current }), n.current = t;
493
491
  }, [t, a, n]);
@@ -495,7 +493,7 @@ const Xo = jt({}), Jr = () => nt(Xo), Zo = () => {
495
493
  const [n] = Jr();
496
494
  return Y(() => V(n, e, t), [n, e, t]);
497
495
  }, le = () => bt("apiUrl", "/chai/api"), Us = () => bt("usersApiUrl", "/chai/users"), Jn = () => bt("assetsApiUrl", "/chai/assets"), Xr = () => bt("realtimeInstance", null), wt = (e) => {
498
- const t = le(), [n] = Ve(), a = e ?? n.get("page"), r = J();
496
+ const t = le(), [n] = ze(), a = e ?? n.get("page"), r = J();
499
497
  return Ge({
500
498
  queryKey: [H, L.GET_LANGUAGE_PAGES, a],
501
499
  initialData: [],
@@ -524,7 +522,7 @@ const Xo = jt({}), Jr = () => nt(Xo), Zo = () => {
524
522
  })
525
523
  });
526
524
  }, Zr = (e) => {
527
- const { fallbackLang: t } = ze(), { data: n } = Tt(), { data: a, isFetching: r } = wt(), i = Y(() => {
525
+ const { fallbackLang: t } = qe(), { data: n } = Tt(), { data: a, isFetching: r } = wt(), i = Y(() => {
528
526
  const l = { [t]: !0 };
529
527
  return ml(V(n, "languages"), (c) => {
530
528
  const d = be(a, { lang: c });
@@ -559,7 +557,7 @@ function tc(e, t) {
559
557
  }, [e, t]), n;
560
558
  }
561
559
  const nc = ({ query: e, uuid: t }) => {
562
- const { selectedLang: n, fallbackLang: a } = ze(), { data: r } = Ue(), i = r == null ? void 0 : r.pageType, l = le(), c = J(), { data: d, isFetching: u } = Ge({
560
+ const { selectedLang: n, fallbackLang: a } = qe(), { data: r } = Ue(), i = r == null ? void 0 : r.pageType, l = le(), c = J(), { data: d, isFetching: u } = Ge({
563
561
  queryKey: [L.GET_DYNAMIC_PAGES, e, i, t],
564
562
  initialData: [],
565
563
  queryFn: async () => await c(l, {
@@ -570,9 +568,9 @@ const nc = ({ query: e, uuid: t }) => {
570
568
  }), h = Y(() => n === "" ? d.filter((m) => m.lang === "" || m.lang === a) : d.filter((m) => m.lang === n), [n, a, d]);
571
569
  return { allLangPages: d, data: h, isFetching: u };
572
570
  }, ti = () => {
573
- const { selectedLang: e, fallbackLang: t } = ze(), [n, a] = ei(), [r, i] = E(""), l = tc(r, 500), { allLangPages: c, data: d, isFetching: u } = nc({ query: l }), h = ie((p) => a(p), [a]), m = ie((p) => i(p), [i]), w = ie(() => {
571
+ const { selectedLang: e, fallbackLang: t } = qe(), [n, a] = ei(), [r, i] = E(""), l = tc(r, 500), { allLangPages: c, data: d, isFetching: u } = nc({ query: l }), h = ie((y) => a(y), [a]), m = ie((y) => i(y), [i]), w = ie(() => {
574
572
  if (!n) return;
575
- const p = !(n != null && n.primaryPage), g = e.length === 0, b = p ? n == null ? void 0 : n.id : n == null ? void 0 : n.primaryPage, N = c.filter(
573
+ const y = !(n != null && n.primaryPage), g = e.length === 0, b = y ? n == null ? void 0 : n.id : n == null ? void 0 : n.primaryPage, N = c.filter(
576
574
  (T) => (T == null ? void 0 : T.primaryPage) === b || T.id === b
577
575
  ).find((T) => g ? T.lang === e || T.lang === t : T.lang === e);
578
576
  a(N || n);
@@ -597,10 +595,10 @@ const nc = ({ query: e, uuid: t }) => {
597
595
  placeholderData: (n) => n
598
596
  });
599
597
  }, sc = jt({ lastSaved: void 0 }), Ms = () => nt(sc), Ue = () => {
600
- const [e] = Ve(), t = e.get("page"), [n] = ni(), { data: a, isFetching: r } = Bs();
598
+ const [e] = ze(), t = e.get("page"), [n] = ni(), { data: a, isFetching: r } = Bs();
601
599
  return { data: Y(() => ({ ...be(a, { id: t }) || {}, metadata: n }), [a, t, n]), isFetching: r };
602
600
  }, yn = () => {
603
- const [e] = Ve(), t = e.get("lang") ?? "", { data: n, isFetching: a } = wt();
601
+ const [e] = ze(), t = e.get("lang") ?? "", { data: n, isFetching: a } = wt();
604
602
  return { data: Y(() => be(n, { lang: t }) || {}, [n, t]), isFetching: a };
605
603
  }, ac = jt({}), ni = () => nt(ac), si = () => {
606
604
  const { data: e } = yn(), t = Ca(), n = e == null ? void 0 : e.slug, a = n ? window.location.origin + (n.endsWith("/") ? n.slice(0, -1) : n) : window.location.origin;
@@ -620,14 +618,14 @@ const nc = ({ query: e, uuid: t }) => {
620
618
  requestedBy: "",
621
619
  isTakeOverRequested: !1
622
620
  }), Xn = () => {
623
- const [e] = Ve(), t = e.get("page"), { user: n } = it(), [a, r] = nt(rc), [i] = nt(Pa), l = mt("realtime-page-lock");
621
+ const [e] = ze(), t = e.get("page"), { user: n } = it(), [a, r] = nt(rc), [i] = nt(Pa), l = mt("realtime-page-lock");
624
622
  return Y(() => ({
625
623
  isLocked: l ? t && i.status === "locked" : t && (n == null ? void 0 : n.id) !== a,
626
624
  currentEditor: a,
627
625
  setCurrentEditor: (c) => r(c)
628
626
  }), [l, t, i.status, n == null ? void 0 : n.id, a, r]);
629
627
  }, ic = () => {
630
- const e = Xr(), { data: t } = Ue(), { user: n } = it(), a = t == null ? void 0 : t.id, [r, i] = nt(Pa), l = Be(!1), c = mt("realtime-page-lock");
628
+ const e = Xr(), { data: t } = Ue(), { user: n } = it(), a = t == null ? void 0 : t.id, [r, i] = nt(Pa), l = tt(!1), c = mt("realtime-page-lock");
631
629
  return de(() => {
632
630
  r.status === "locked" || !a || !(n != null && n.id) || !e || !c || l.current || setTimeout(() => {
633
631
  l.current || (l.current = !0, e == null || e.listenEvent("TAKE_OVER_REQUESTED", (d) => {
@@ -675,7 +673,7 @@ const nc = ({ query: e, uuid: t }) => {
675
673
  [e]
676
674
  );
677
675
  }, ii = () => {
678
- const [e] = Ve(), t = e.get("page"), n = le(), { setAiContext: a } = Ta(), { setCurrentEditor: r } = Xn(), [, i] = Ms(), [, l] = ni(), c = J();
676
+ const [e] = ze(), t = e.get("page"), n = le(), { setAiContext: a } = Ta(), { setCurrentEditor: r } = Xn(), [, i] = Ms(), [, l] = ni(), c = J();
679
677
  return Ge({
680
678
  queryKey: [H, L.GET_DRAFT_PAGE, t],
681
679
  staleTime: 1 / 0,
@@ -823,7 +821,7 @@ const cc = () => {
823
821
  ] })
824
822
  ] }) });
825
823
  }, dc = () => {
826
- const { isLocked: e, currentEditor: t } = Xn(), { data: n } = $t(t), [a] = Ve(), r = a.get("page"), { mutate: i } = Qr(), { isFetching: l } = ii(), [c] = Ms(), { pageLock: d, requestTakeOver: u } = ai(), h = mt("realtime-page-lock"), m = ie(() => {
824
+ const { isLocked: e, currentEditor: t } = Xn(), { data: n } = $t(t), [a] = ze(), r = a.get("page"), { mutate: i } = Qr(), { isFetching: l } = ii(), [c] = Ms(), { pageLock: d, requestTakeOver: u } = ai(), h = mt("realtime-page-lock"), m = ie(() => {
827
825
  h ? u() : i({ id: r });
828
826
  }, [r, i, u, h]);
829
827
  return h && (d != null && d.requestedBy) ? /* @__PURE__ */ s(cc, {}) : (h ? d.status !== "locked" : !e || l) ? /* @__PURE__ */ s("div", { className: "" }) : /* @__PURE__ */ s(
@@ -839,14 +837,14 @@ const cc = () => {
839
837
  }
840
838
  );
841
839
  }, uc = () => {
842
- const [e, t] = Ve(), n = e.get("lang"), a = Zr(n), { setSelectedLang: r } = ze(), i = () => {
840
+ const [e, t] = ze(), n = e.get("lang"), a = Zr(n), { setSelectedLang: r } = qe(), i = () => {
843
841
  const c = new URLSearchParams(window.location.search);
844
842
  c.delete("lang");
845
843
  const d = c.toString(), u = `${window.location.pathname}${d ? `?${d}` : ""}`;
846
844
  window.history.pushState({}, "", u), t(c), r(""), window.dispatchEvent(new PopStateEvent("popstate"));
847
845
  };
848
846
  if (a) return null;
849
- const l = V(We, n);
847
+ const l = V(He, n);
850
848
  return /* @__PURE__ */ s("div", { className: "fixed bottom-0 left-0 right-0 top-12 z-[20] flex w-screen items-center justify-center bg-black/30 backdrop-blur-sm", children: /* @__PURE__ */ o(Ts, { className: "mx-auto w-full max-w-md", children: [
851
849
  /* @__PURE__ */ s(Cs, { className: "space-y-1", children: /* @__PURE__ */ o(Ps, { className: "flex items-center gap-2 text-2xl", children: [
852
850
  /* @__PURE__ */ s(xa, { className: "h-6 w-6 text-yellow-500" }),
@@ -1070,7 +1068,7 @@ const cc = () => {
1070
1068
  isCreating: c
1071
1069
  };
1072
1070
  }, vc = ({ value: e, onChange: t }) => {
1073
- const [n, a] = E(!1), [r, i] = E(""), l = Be(null), { groups: c } = yc(), [d, u] = E([
1071
+ const [n, a] = E(!1), [r, i] = E(""), l = tt(null), { groups: c } = yc(), [d, u] = E([
1074
1072
  { id: "hero", name: "Hero" },
1075
1073
  { id: "feature", name: "Feature" },
1076
1074
  { id: "footer", name: "Footer" },
@@ -1102,24 +1100,24 @@ const cc = () => {
1102
1100
  () => [
1103
1101
  ...c,
1104
1102
  ...d.filter(
1105
- (p) => !c.some((g) => g.id === p.id)
1103
+ (y) => !c.some((g) => g.id === y.id)
1106
1104
  )
1107
1105
  ],
1108
1106
  [c, d]
1109
1107
  ), m = () => {
1110
- const p = r.trim();
1111
- if (!p) return;
1112
- const g = { id: p, name: p };
1108
+ const y = r.trim();
1109
+ if (!y) return;
1110
+ const g = { id: y, name: y };
1113
1111
  u((b) => [...b, g]), t(g.id), i(""), a(!1);
1114
1112
  };
1115
1113
  de(() => {
1116
1114
  n && l.current && l.current.focus();
1117
1115
  }, [n]);
1118
- const w = (p) => {
1119
- p.key === "Enter" && (p.preventDefault(), m());
1116
+ const w = (y) => {
1117
+ y.key === "Enter" && (y.preventDefault(), m());
1120
1118
  };
1121
1119
  return de(() => {
1122
- e && !h.some((p) => p.id === e) && t("");
1120
+ e && !h.some((y) => y.id === e) && t("");
1123
1121
  }, [e, h, t]), n ? /* @__PURE__ */ o("div", { className: "space-y-2", children: [
1124
1122
  /* @__PURE__ */ s(
1125
1123
  xe,
@@ -1127,7 +1125,7 @@ const cc = () => {
1127
1125
  ref: l,
1128
1126
  placeholder: "Enter new group name",
1129
1127
  value: r,
1130
- onChange: (p) => i(p.target.value),
1128
+ onChange: (y) => i(y.target.value),
1131
1129
  onKeyDown: w
1132
1130
  }
1133
1131
  ),
@@ -1149,15 +1147,15 @@ const cc = () => {
1149
1147
  {
1150
1148
  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",
1151
1149
  value: e,
1152
- onChange: (p) => t(p.target.value),
1150
+ onChange: (y) => t(y.target.value),
1153
1151
  children: [
1154
1152
  /* @__PURE__ */ s("option", { value: "", children: "Select a group" }),
1155
- c.length > 0 && /* @__PURE__ */ s("optgroup", { label: "Library Groups", children: c.map((p) => /* @__PURE__ */ s("option", { value: p.id, children: p.name }, `lib-${p.id}`)) }),
1153
+ c.length > 0 && /* @__PURE__ */ s("optgroup", { label: "Library Groups", children: c.map((y) => /* @__PURE__ */ s("option", { value: y.id, children: y.name }, `lib-${y.id}`)) }),
1156
1154
  d.length > 0 && /* @__PURE__ */ s("optgroup", { label: "Predefined Groups", children: d.filter(
1157
- (p) => !c.some(
1158
- (g) => g.id === p.id
1155
+ (y) => !c.some(
1156
+ (g) => g.id === y.id
1159
1157
  )
1160
- ).map((p) => /* @__PURE__ */ s("option", { value: p.id, children: p.name }, `local-${p.id}`)) })
1158
+ ).map((y) => /* @__PURE__ */ s("option", { value: y.id, children: y.name }, `local-${y.id}`)) })
1161
1159
  ]
1162
1160
  }
1163
1161
  ),
@@ -1173,7 +1171,7 @@ const cc = () => {
1173
1171
  )
1174
1172
  ] });
1175
1173
  }, bc = 10 * 1024 * 1024, wc = ({ value: e, onChange: t }) => {
1176
- const [n, a] = E(!1), r = Be(null), i = ie(
1174
+ const [n, a] = E(!1), r = tt(null), i = ie(
1177
1175
  (d) => {
1178
1176
  var h;
1179
1177
  const u = (h = d.target.files) == null ? void 0 : h[0];
@@ -1302,7 +1300,7 @@ const cc = () => {
1302
1300
  } else
1303
1301
  C.push(I);
1304
1302
  return C;
1305
- }, [t, r]), [h, m] = E(""), [w, p] = E(""), [g, b] = E(""), [y, N] = E(""), [T, O] = E({}), [x, _] = E(!1), [G, W] = E(c), [F, te] = E(!1), { hasPermission: j } = mn(), q = j(Te.DELETE_LIBRARY_BLOCK), ee = br(), z = () => {
1303
+ }, [t, r]), [h, m] = E(""), [w, y] = E(""), [g, b] = E(""), [p, N] = E(""), [T, O] = E({}), [x, _] = E(!1), [G, W] = E(c), [F, te] = E(!1), { hasPermission: j } = mn(), q = j(Te.DELETE_LIBRARY_BLOCK), ee = br(), z = () => {
1306
1304
  ee([a], { _libBlockId: void 0 }), K.success("Block delinked from library"), n();
1307
1305
  }, {
1308
1306
  data: X,
@@ -1312,7 +1310,7 @@ const cc = () => {
1312
1310
  de(() => {
1313
1311
  B && c && (te(!0), W(!1));
1314
1312
  }, [B, c]), de(() => {
1315
- X && !P && (m(X.name || ""), p(X.group || ""), b(X.description || ""), N(X.preview || ""), W(!1));
1313
+ X && !P && (m(X.name || ""), y(X.group || ""), b(X.description || ""), N(X.preview || ""), W(!1));
1316
1314
  }, [X, P]), de(() => {
1317
1315
  const C = h.trim().length >= 2, I = w.trim() !== "";
1318
1316
  _(C && I);
@@ -1333,7 +1331,7 @@ const cc = () => {
1333
1331
  blocks: I,
1334
1332
  description: g.trim(),
1335
1333
  // Only include previewImage if it exists and is a base64 image
1336
- ...y && y.startsWith("data:") ? { previewImage: y } : {},
1334
+ ...p && p.startsWith("data:") ? { previewImage: p } : {},
1337
1335
  // Include id if in edit mode
1338
1336
  ...c ? { id: l } : {}
1339
1337
  });
@@ -1384,7 +1382,7 @@ const cc = () => {
1384
1382
  children: "Group"
1385
1383
  }
1386
1384
  ),
1387
- /* @__PURE__ */ s(vc, { value: w, onChange: p }),
1385
+ /* @__PURE__ */ s(vc, { value: w, onChange: y }),
1388
1386
  T.group && /* @__PURE__ */ s("p", { className: "text-xs text-destructive", children: T.group })
1389
1387
  ] }),
1390
1388
  /* @__PURE__ */ o("div", { className: "space-y-2", children: [
@@ -1402,7 +1400,7 @@ const cc = () => {
1402
1400
  ] }),
1403
1401
  /* @__PURE__ */ o("div", { className: "space-y-2", children: [
1404
1402
  /* @__PURE__ */ s(oe, { htmlFor: "previewImage", children: "Preview Image (optional)" }),
1405
- /* @__PURE__ */ s(wc, { value: y, onChange: N })
1403
+ /* @__PURE__ */ s(wc, { value: p, onChange: N })
1406
1404
  ] }),
1407
1405
  /* @__PURE__ */ o("div", { className: "flex justify-end gap-2 pt-2", children: [
1408
1406
  c && q && /* @__PURE__ */ s(
@@ -1480,7 +1478,7 @@ const cc = () => {
1480
1478
  SLUG_CHANGE_SUCCESS: "Slug changed successfully."
1481
1479
  }, xc = {
1482
1480
  SLUG_ALREADY_USED: "This slug is already in use. Please choose a different one."
1483
- }, je = () => {
1481
+ }, Fe = () => {
1484
1482
  const e = le(), t = J();
1485
1483
  return Ge({
1486
1484
  queryKey: [H, L.GET_PAGE_TYPES],
@@ -1488,7 +1486,7 @@ const cc = () => {
1488
1486
  queryFn: async () => t(e, { action: L.GET_PAGE_TYPES })
1489
1487
  });
1490
1488
  }, oi = (e) => {
1491
- const { data: t } = je();
1489
+ const { data: t } = Fe();
1492
1490
  return Y(
1493
1491
  () => t == null ? void 0 : t.find((n) => n.key === e),
1494
1492
  [t, e]
@@ -1511,7 +1509,7 @@ const cc = () => {
1511
1509
  }
1512
1510
  });
1513
1511
  }, ci = () => {
1514
- const e = le(), t = ke(), n = J(), { data: a } = je();
1512
+ const e = le(), t = ke(), n = J(), { data: a } = Fe();
1515
1513
  return Ie({
1516
1514
  mutationFn: async (r) => await n(e, {
1517
1515
  action: L.CREATE_PAGE,
@@ -1535,7 +1533,7 @@ const cc = () => {
1535
1533
  }
1536
1534
  });
1537
1535
  }, ka = () => {
1538
- const e = le(), t = ke(), n = J(), { data: a } = je();
1536
+ const e = le(), t = ke(), n = J(), { data: a } = Fe();
1539
1537
  return Ie({
1540
1538
  mutationFn: async (r) => await n(e, {
1541
1539
  action: L.UPDATE_PAGE,
@@ -1556,7 +1554,7 @@ const cc = () => {
1556
1554
  }
1557
1555
  });
1558
1556
  }, Ec = () => {
1559
- const e = le(), t = ke(), n = J(), { data: a } = je();
1557
+ const e = le(), t = ke(), n = J(), { data: a } = Fe();
1560
1558
  return Ie({
1561
1559
  mutationFn: async (r) => n(e, {
1562
1560
  action: L.DELETE_PAGE,
@@ -1583,7 +1581,7 @@ const cc = () => {
1583
1581
  }
1584
1582
  });
1585
1583
  }, Ac = () => {
1586
- const e = le(), t = ke(), n = J(), { data: a } = je();
1584
+ const e = le(), t = ke(), n = J(), { data: a } = Fe();
1587
1585
  return Ie({
1588
1586
  mutationFn: async (r) => n(e, {
1589
1587
  action: L.TAKE_OFFLINE,
@@ -1800,7 +1798,7 @@ var Ia = {};
1800
1798
  }
1801
1799
  return v;
1802
1800
  };
1803
- }(), p = {
1801
+ }(), y = {
1804
1802
  particleCount: 50,
1805
1803
  angle: 90,
1806
1804
  spread: 45,
@@ -1832,9 +1830,9 @@ var Ia = {};
1832
1830
  function b(v) {
1833
1831
  return v != null;
1834
1832
  }
1835
- function y(v, f, C) {
1833
+ function p(v, f, C) {
1836
1834
  return g(
1837
- v && b(v[f]) ? v[f] : p[f],
1835
+ v && b(v[f]) ? v[f] : y[f],
1838
1836
  C
1839
1837
  );
1840
1838
  }
@@ -1859,8 +1857,8 @@ var Ia = {};
1859
1857
  };
1860
1858
  }
1861
1859
  function G(v) {
1862
- var f = y(v, "origin", Object);
1863
- return f.x = y(f, "x", Number), f.y = y(f, "y", Number), f;
1860
+ var f = p(v, "origin", Object);
1861
+ return f.x = p(f, "x", Number), f.y = p(f, "y", Number), f;
1864
1862
  }
1865
1863
  function W(v) {
1866
1864
  v.width = document.documentElement.clientWidth, v.height = document.documentElement.clientHeight;
@@ -1936,8 +1934,8 @@ var Ia = {};
1936
1934
  } else if (f.shape === "circle")
1937
1935
  v.ellipse ? v.ellipse(f.x, f.y, Math.abs($ - I) * f.ovalScalar, Math.abs(k - R) * f.ovalScalar, Math.PI / 10 * f.wobble, 0, 2 * Math.PI) : j(v, f.x, f.y, Math.abs($ - I) * f.ovalScalar, Math.abs(k - R) * f.ovalScalar, Math.PI / 10 * f.wobble, 0, 2 * Math.PI);
1938
1936
  else if (f.shape === "star")
1939
- for (var se = Math.PI / 2 * 3, Re = 4 * f.scalar, Ke = 8 * f.scalar, D = f.x, ce = f.y, De = 5, st = Math.PI / De; De--; )
1940
- D = f.x + Math.cos(se) * Ke, ce = f.y + Math.sin(se) * Ke, v.lineTo(D, ce), se += st, D = f.x + Math.cos(se) * Re, ce = f.y + Math.sin(se) * Re, v.lineTo(D, ce), se += st;
1937
+ for (var se = Math.PI / 2 * 3, Re = 4 * f.scalar, Ve = 8 * f.scalar, D = f.x, ce = f.y, De = 5, st = Math.PI / De; De--; )
1938
+ D = f.x + Math.cos(se) * Ve, ce = f.y + Math.sin(se) * Ve, v.lineTo(D, ce), se += st, D = f.x + Math.cos(se) * Re, ce = f.y + Math.sin(se) * Re, v.lineTo(D, ce), se += st;
1941
1939
  else
1942
1940
  v.moveTo(Math.floor(f.x), Math.floor(f.y)), v.lineTo(Math.floor(f.wobbleX), Math.floor(R)), v.lineTo(Math.floor($), Math.floor(k)), v.lineTo(Math.floor(I), Math.floor(f.wobbleY));
1943
1941
  return v.closePath(), v.fill(), f.tick < f.totalTicks;
@@ -1966,13 +1964,13 @@ var Ia = {};
1966
1964
  };
1967
1965
  }
1968
1966
  function X(v, f) {
1969
- var C = !v, I = !!y(f || {}, "resize"), R = !1, $ = y(f, "disableForReducedMotion", Boolean), k = i && !!y(f || {}, "useWorker"), U = k ? w() : null, ne = C ? W : F, ue = v && U ? !!v.__confetti_initialized : !1, Ce = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion)").matches, he;
1970
- function Ae(se, Re, Ke) {
1971
- for (var D = y(se, "particleCount", N), ce = y(se, "angle", Number), De = y(se, "spread", Number), st = y(se, "startVelocity", Number), zs = y(se, "decay", Number), Vs = y(se, "gravity", Number), Ks = y(se, "drift", Number), bn = y(se, "colors", x), wn = y(se, "ticks", Number), Ct = y(se, "shapes"), Zn = y(se, "scalar"), es = !!y(se, "flat"), S = G(se), fe = D, He = [], $e = v.width * S.x, Qe = v.height * S.y; fe--; )
1972
- He.push(
1967
+ var C = !v, I = !!p(f || {}, "resize"), R = !1, $ = p(f, "disableForReducedMotion", Boolean), k = i && !!p(f || {}, "useWorker"), U = k ? w() : null, ne = C ? W : F, ue = v && U ? !!v.__confetti_initialized : !1, Ce = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion)").matches, he;
1968
+ function Ae(se, Re, Ve) {
1969
+ for (var D = p(se, "particleCount", N), ce = p(se, "angle", Number), De = p(se, "spread", Number), st = p(se, "startVelocity", Number), zs = p(se, "decay", Number), Vs = p(se, "gravity", Number), Ks = p(se, "drift", Number), bn = p(se, "colors", x), wn = p(se, "ticks", Number), Ct = p(se, "shapes"), Zn = p(se, "scalar"), es = !!p(se, "flat"), S = G(se), fe = D, Ke = [], je = v.width * S.x, We = v.height * S.y; fe--; )
1970
+ Ke.push(
1973
1971
  q({
1974
- x: $e,
1975
- y: Qe,
1972
+ x: je,
1973
+ y: We,
1976
1974
  angle: ce,
1977
1975
  spread: De,
1978
1976
  startVelocity: st,
@@ -1986,15 +1984,15 @@ var Ia = {};
1986
1984
  flat: es
1987
1985
  })
1988
1986
  );
1989
- return he ? he.addFettis(He) : (he = z(v, He, ne, Re, Ke), he.promise);
1987
+ return he ? he.addFettis(Ke) : (he = z(v, Ke, ne, Re, Ve), he.promise);
1990
1988
  }
1991
1989
  function M(se) {
1992
- var Re = $ || y(se, "disableForReducedMotion", Boolean), Ke = y(se, "zIndex", Number);
1990
+ var Re = $ || p(se, "disableForReducedMotion", Boolean), Ve = p(se, "zIndex", Number);
1993
1991
  if (Re && Ce)
1994
1992
  return u(function(st) {
1995
1993
  st();
1996
1994
  });
1997
- C && he ? v = he.canvas : C && !v && (v = te(Ke), document.body.appendChild(v)), I && !ue && ne(v);
1995
+ C && he ? v = he.canvas : C && !v && (v = te(Ve), document.body.appendChild(v)), I && !ue && ne(v);
1998
1996
  var D = {
1999
1997
  width: v.width,
2000
1998
  height: v.height
@@ -2055,14 +2053,14 @@ var Ia = {};
2055
2053
  for (var se = 0; se < k; se += 2)
2056
2054
  $.isPointInPath(I, M, se, "nonzero") && (U = Math.min(U, M), ne = Math.min(ne, se), ue = Math.max(ue, M), Ce = Math.max(Ce, se));
2057
2055
  he = ue - U, Ae = Ce - ne;
2058
- var Re = 10, Ke = Math.min(Re / he, Re / Ae);
2056
+ var Re = 10, Ve = Math.min(Re / he, Re / Ae);
2059
2057
  C = [
2060
- Ke,
2058
+ Ve,
2061
2059
  0,
2062
2060
  0,
2063
- Ke,
2064
- -Math.round(he / 2 + U) * Ke,
2065
- -Math.round(Ae / 2 + ne) * Ke
2061
+ Ve,
2062
+ -Math.round(he / 2 + U) * Ve,
2063
+ -Math.round(Ae / 2 + ne) * Ve
2066
2064
  ];
2067
2065
  }
2068
2066
  return {
@@ -2140,34 +2138,34 @@ function Oc({
2140
2138
  dynamicPattern: a,
2141
2139
  onValidationChange: r
2142
2140
  }) {
2143
- const [i, l] = E(null), c = Be(null), [d, u] = E(a + e);
2141
+ const [i, l] = E(null), c = tt(null), [d, u] = E(a + e);
2144
2142
  de(() => {
2145
2143
  u(a + e);
2146
2144
  }, [e, a]);
2147
- const h = (p) => {
2148
- const g = p.target.value;
2145
+ const h = (y) => {
2146
+ const g = y.target.value;
2149
2147
  if (!g.startsWith(a)) {
2150
2148
  const x = g.replace(a, ""), _ = a + x;
2151
2149
  u(_), t(x);
2152
2150
  return;
2153
2151
  }
2154
- const y = g.substring(a.length).replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(), N = (y.match(/\./g) || []).length, T = N <= 1;
2152
+ const p = g.substring(a.length).replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(), N = (p.match(/\./g) || []).length, T = N <= 1;
2155
2153
  N > 1 ? l("Invalid slug. Only one dot (.) is allowed in the slug") : l(null), r && r(T);
2156
- const O = a + y;
2157
- u(O), t(y);
2154
+ const O = a + p;
2155
+ u(O), t(p);
2158
2156
  }, m = () => {
2159
2157
  if (c.current) {
2160
- const p = c.current;
2158
+ const y = c.current;
2161
2159
  setTimeout(() => {
2162
2160
  const g = a.length;
2163
- p.setSelectionRange(g, g);
2161
+ y.setSelectionRange(g, g);
2164
2162
  }, 0);
2165
2163
  }
2166
- }, w = (p) => {
2167
- const g = p.currentTarget;
2164
+ }, w = (y) => {
2165
+ const g = y.currentTarget;
2168
2166
  (g.selectionStart || 0) <= a.length && setTimeout(() => {
2169
- const y = a.length;
2170
- g.setSelectionRange(y, y);
2167
+ const p = a.length;
2168
+ g.setSelectionRange(p, p);
2171
2169
  }, 0);
2172
2170
  };
2173
2171
  return /* @__PURE__ */ s("div", { children: /* @__PURE__ */ o("div", { className: "relative", children: [
@@ -2224,13 +2222,13 @@ function Uc({
2224
2222
  u || (a = "w-full rounded-md border border-gray-300 px-3 py-2");
2225
2223
  const h = Y(() => !e || e.length === 0 ? [] : e.filter((N) => !Q(N.slug)).filter((N) => N.slug !== "/").sort((N, T) => N.slug.localeCompare(T.slug)), [e]), m = Y(() => {
2226
2224
  if (!c.trim()) return h;
2227
- const y = c.toLowerCase();
2225
+ const p = c.toLowerCase();
2228
2226
  return h.filter(
2229
- (N) => N.name.toLowerCase().includes(y) || N.slug.toLowerCase().includes(y)
2227
+ (N) => N.name.toLowerCase().includes(p) || N.slug.toLowerCase().includes(p)
2230
2228
  );
2231
- }, [h, c]), w = (y) => Math.max(0, (y.match(/\//g) || []).length - 1), p = (y) => "    ".repeat(y), g = (y) => {
2232
- if (y === "/") return "/";
2233
- const N = y.split("/").filter(Boolean);
2229
+ }, [h, c]), w = (p) => Math.max(0, (p.match(/\//g) || []).length - 1), y = (p) => "    ".repeat(p), g = (p) => {
2230
+ if (p === "/") return "/";
2231
+ const N = p.split("/").filter(Boolean);
2234
2232
  if (N.length <= 1) {
2235
2233
  const T = N[0] || "";
2236
2234
  return `/${vt(T)}`;
@@ -2238,8 +2236,8 @@ function Uc({
2238
2236
  return `/${vt(N[N.length - 1])}`;
2239
2237
  }, b = () => {
2240
2238
  if (!t || t === "none") return "None";
2241
- const y = h.find((N) => N.id === t);
2242
- return y ? `${y.name} (${g(y.slug)})` : "None";
2239
+ const p = h.find((N) => N.id === t);
2240
+ return p ? `${p.name} (${g(p.slug)})` : "None";
2243
2241
  };
2244
2242
  return /* @__PURE__ */ o("div", { className: "space-y-0.5", children: [
2245
2243
  /* @__PURE__ */ s(oe, { htmlFor: r, className: "text-sm", children: "Parent" }),
@@ -2267,7 +2265,7 @@ function Uc({
2267
2265
  placeholder: "Search pages...",
2268
2266
  className: "h-8 pl-8 text-xs",
2269
2267
  value: c,
2270
- onChange: (y) => d(y.target.value)
2268
+ onChange: (p) => d(p.target.value)
2271
2269
  }
2272
2270
  )
2273
2271
  ] }) }) }),
@@ -2288,10 +2286,10 @@ function Uc({
2288
2286
  ]
2289
2287
  }
2290
2288
  ),
2291
- m.map((y) => {
2292
- const N = p(w(y.slug)), T = g(y.slug), O = /* @__PURE__ */ o("span", { className: "flex items-center text-sm", children: [
2289
+ m.map((p) => {
2290
+ const N = y(w(p.slug)), T = g(p.slug), O = /* @__PURE__ */ o("span", { className: "flex items-center text-sm", children: [
2293
2291
  N,
2294
- y.name,
2292
+ p.name,
2295
2293
  /* @__PURE__ */ o("span", { className: "text-xs text-gray-500", children: [
2296
2294
  " (",
2297
2295
  T,
@@ -2301,9 +2299,9 @@ function Uc({
2301
2299
  return /* @__PURE__ */ o(
2302
2300
  ot,
2303
2301
  {
2304
- value: y.id,
2302
+ value: p.id,
2305
2303
  onSelect: () => {
2306
- n(y.id), l(!1), d("");
2304
+ n(p.id), l(!1), d("");
2307
2305
  },
2308
2306
  className: "flex cursor-pointer items-center justify-between whitespace-pre-wrap",
2309
2307
  children: [
@@ -2313,13 +2311,13 @@ function Uc({
2313
2311
  {
2314
2312
  className: Ys(
2315
2313
  "mr-2 h-4 w-4 shrink-0",
2316
- t === y.id ? "opacity-100" : "opacity-0"
2314
+ t === p.id ? "opacity-100" : "opacity-0"
2317
2315
  )
2318
2316
  }
2319
2317
  )
2320
2318
  ]
2321
2319
  },
2322
- y.id
2320
+ p.id
2323
2321
  );
2324
2322
  })
2325
2323
  ] })
@@ -2330,20 +2328,20 @@ function Uc({
2330
2328
  {
2331
2329
  id: r,
2332
2330
  value: t || "none",
2333
- onChange: (y) => n(y.target.value),
2331
+ onChange: (p) => n(p.target.value),
2334
2332
  className: a,
2335
2333
  "data-testid": "parent-page-selector",
2336
2334
  children: [
2337
2335
  /* @__PURE__ */ s("option", { value: "none", children: "None" }),
2338
- h.map((y) => {
2339
- const N = w(y.slug), T = N > 0 ? p(N) : "", O = g(y.slug);
2340
- return /* @__PURE__ */ o("option", { value: y.id, children: [
2336
+ h.map((p) => {
2337
+ const N = w(p.slug), T = N > 0 ? y(N) : "", O = g(p.slug);
2338
+ return /* @__PURE__ */ o("option", { value: p.id, children: [
2341
2339
  T,
2342
- y.name,
2340
+ p.name,
2343
2341
  " (",
2344
2342
  O,
2345
2343
  ")"
2346
- ] }, y.id);
2344
+ ] }, p.id);
2347
2345
  })
2348
2346
  ]
2349
2347
  }
@@ -2364,8 +2362,8 @@ function La({
2364
2362
  d(e);
2365
2363
  }, [e]);
2366
2364
  const m = (w) => {
2367
- const g = w.target.value.replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(), b = (g.match(/\./g) || []).length, y = b <= 1;
2368
- b > 1 ? h("Invalid slug. Only one dot (.) is allowed in the slug") : h(null), r && r(y), d(g), t(g);
2365
+ const g = w.target.value.replace(/\//g, "").replace(/\s+/g, "-").replace(/[^a-zA-Z0-9-_.]/g, "-").replace(/-+/g, "-").replace(/^-+/, "").toLowerCase(), b = (g.match(/\./g) || []).length, p = b <= 1;
2366
+ b > 1 ? h("Invalid slug. Only one dot (.) is allowed in the slug") : h(null), r && r(p), d(g), t(g);
2369
2367
  };
2370
2368
  return /* @__PURE__ */ o("div", { children: [
2371
2369
  a && /* @__PURE__ */ s("div", { className: "flex items-center mb-1", children: /* @__PURE__ */ o("span", { className: "text-xs text-gray-500", children: [
@@ -2402,7 +2400,7 @@ const Bc = (...e) => e.filter(Boolean).join(" "), Mc = ({
2402
2400
  const [r, i] = E(""), [l, c] = E(!1), [d, u] = E(""), h = mt("enable-add-page-dropdown");
2403
2401
  if (de(() => {
2404
2402
  if (t) {
2405
- const b = e.find((y) => y.id === t);
2403
+ const b = e.find((p) => p.id === t);
2406
2404
  i((b == null ? void 0 : b.preview) || "");
2407
2405
  } else
2408
2406
  i("");
@@ -2412,18 +2410,18 @@ const Bc = (...e) => e.filter(Boolean).join(" "), Mc = ({
2412
2410
  return null;
2413
2411
  const m = {};
2414
2412
  e.forEach((b) => {
2415
- const y = b.libraryName;
2416
- m[y] || (m[y] = []), m[y].push(b);
2413
+ const p = b.libraryName;
2414
+ m[p] || (m[p] = []), m[p].push(b);
2417
2415
  });
2418
2416
  const w = Object.entries(m).reduce(
2419
- (b, [y, N]) => {
2417
+ (b, [p, N]) => {
2420
2418
  const T = N.filter(
2421
- (O) => O.name.toLowerCase().includes(d.toLowerCase()) || y.toLowerCase().includes(d.toLowerCase())
2419
+ (O) => O.name.toLowerCase().includes(d.toLowerCase()) || p.toLowerCase().includes(d.toLowerCase())
2422
2420
  );
2423
- return T.length > 0 && (b[y] = T), b;
2421
+ return T.length > 0 && (b[p] = T), b;
2424
2422
  },
2425
2423
  {}
2426
- ), p = e.find((b) => b.id === t), g = p ? Gt(p.name) : "No Template";
2424
+ ), y = e.find((b) => b.id === t), g = y ? Gt(y.name) : "No Template";
2427
2425
  return /* @__PURE__ */ o("div", { className: "space-y-4", children: [
2428
2426
  h ? /* @__PURE__ */ o(on, { open: l, onOpenChange: c, children: [
2429
2427
  /* @__PURE__ */ s(cn, { asChild: !0, children: /* @__PURE__ */ o(A, { variant: "outline", role: "combobox", className: "w-full justify-between", children: [
@@ -2445,7 +2443,7 @@ const Bc = (...e) => e.filter(Boolean).join(" "), Mc = ({
2445
2443
  ] }) }),
2446
2444
  /* @__PURE__ */ o(gs, { className: "max-h-[300px] overflow-y-auto", children: [
2447
2445
  /* @__PURE__ */ s(Pn, { children: "No templates found." }),
2448
- Object.entries(w).map(([b, y]) => /* @__PURE__ */ s(xt, { heading: b, children: y.map((N) => /* @__PURE__ */ o(
2446
+ Object.entries(w).map(([b, p]) => /* @__PURE__ */ s(xt, { heading: b, children: p.map((N) => /* @__PURE__ */ o(
2449
2447
  ot,
2450
2448
  {
2451
2449
  value: N.id,
@@ -2478,7 +2476,7 @@ const Bc = (...e) => e.filter(Boolean).join(" "), Mc = ({
2478
2476
  onChange: (b) => n(b.target.value),
2479
2477
  children: [
2480
2478
  /* @__PURE__ */ s("option", { value: "", children: "No Template" }),
2481
- Object.entries(m).map(([b, y]) => /* @__PURE__ */ s("optgroup", { label: b, children: y.map((N) => /* @__PURE__ */ s("option", { value: N.id, children: Gt(N.name) }, N.id)) }, b))
2479
+ Object.entries(m).map(([b, p]) => /* @__PURE__ */ s("optgroup", { label: b, children: p.map((N) => /* @__PURE__ */ s("option", { value: N.id, children: Gt(N.name) }, N.id)) }, b))
2482
2480
  ]
2483
2481
  }
2484
2482
  ),
@@ -2521,7 +2519,7 @@ const Bc = (...e) => e.filter(Boolean).join(" "), Mc = ({
2521
2519
  isLoading: n || r
2522
2520
  };
2523
2521
  }, Da = () => {
2524
- const [, e] = Ve();
2522
+ const [, e] = ze();
2525
2523
  return ie(
2526
2524
  (t, n) => {
2527
2525
  const r = new URLSearchParams(window.location.search).get("lang"), i = new URLSearchParams({ page: t });
@@ -2587,7 +2585,7 @@ if (import.meta.vitest) {
2587
2585
  const Pt = (...e) => e.filter(Boolean).join(" ");
2588
2586
  function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel: a }) {
2589
2587
  var Zn, es;
2590
- const r = Da(), i = !!(e != null && e.id), { data: l } = Bs(), { mutate: c, isPending: d } = ci(), { mutate: u, isPending: h } = ka(), [m, w] = E(null), [p, g] = E(!0), [b, y] = E((e == null ? void 0 : e.pageType) ?? "page"), { hasPermission: N } = mn(), T = N(Te.CHANGE_PAGE_TYPE), [O, x] = E(!1), [_, G] = E(""), { selectedLang: W, fallbackLang: F } = ze(), te = W || F, [j, q] = E(""), [ee, z] = E(!1), X = Y(() => {
2588
+ const r = Da(), i = !!(e != null && e.id), { data: l } = Bs(), { mutate: c, isPending: d } = ci(), { mutate: u, isPending: h } = ka(), [m, w] = E(null), [y, g] = E(!0), [b, p] = E((e == null ? void 0 : e.pageType) ?? "page"), { hasPermission: N } = mn(), T = N(Te.CHANGE_PAGE_TYPE), [O, x] = E(!1), [_, G] = E(""), { selectedLang: W, fallbackLang: F } = qe(), te = W || F, [j, q] = E(""), [ee, z] = E(!1), X = Y(() => {
2591
2589
  const S = t.find((fe) => fe.key === b);
2592
2590
  return (S == null ? void 0 : S.hasSlug) === !1;
2593
2591
  }, [b, t]), [P, B] = E((e == null ? void 0 : e.parent) ?? ""), [pe, Ee] = E((e == null ? void 0 : e.name) ?? ""), [me, v] = E((e == null ? void 0 : e.dynamic) ?? !1), [f, C] = E(me ? "" : ((e == null ? void 0 : e.slug) ?? "").split("/").pop() || ""), [I, R] = E((e == null ? void 0 : e.dynamicSlugCustom) ?? ""), [$, k] = E(!0), [U, ne] = E(""), { data: ue, isLoading: Ce } = $c(b), he = d || h, Ae = mt("enable-add-page-dropdown"), M = t.find((S) => S.key === b), se = (S) => {
@@ -2595,17 +2593,17 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2595
2593
  G(S), x(!0), q(""), z(!1);
2596
2594
  return;
2597
2595
  }
2598
- y(S), q(""), z(!1);
2596
+ p(S), q(""), z(!1);
2599
2597
  }, Re = () => {
2600
- y(_), x(!1), v(!1);
2601
- }, Ke = (S) => {
2598
+ p(_), x(!1), v(!1);
2599
+ }, Ve = (S) => {
2602
2600
  v(S), S ? C("") : R("");
2603
2601
  }, D = (S) => {
2604
2602
  if (B(S), S && S !== "none") {
2605
- const fe = l == null ? void 0 : l.find(($e) => $e.id === S), He = (fe == null ? void 0 : fe.slug) || "";
2606
- if (f.startsWith(He)) {
2607
- const $e = f.slice(He.length).replace(/^\/+/, "");
2608
- C($e);
2603
+ const fe = l == null ? void 0 : l.find((je) => je.id === S), Ke = (fe == null ? void 0 : fe.slug) || "";
2604
+ if (f.startsWith(Ke)) {
2605
+ const je = f.slice(Ke.length).replace(/^\/+/, "");
2606
+ C(je);
2609
2607
  } else
2610
2608
  C(f.replace(/^\/+/, ""));
2611
2609
  } else
@@ -2634,13 +2632,13 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2634
2632
  }, zs = (S, fe) => {
2635
2633
  if (!S.trim() && !me)
2636
2634
  return w("Child page slug is required"), !1;
2637
- const He = vt(fe), $e = Ha(He, S);
2638
- return Object.keys(We).some((ts) => $e === `/${ts}` || ($e == null ? void 0 : $e.startsWith(`/${ts}/`))) ? (w("Slugs cannot start with a language code for primary page"), !1) : !0;
2635
+ const Ke = vt(fe), je = Ha(Ke, S);
2636
+ return Object.keys(He).some((ts) => je === `/${ts}` || (je == null ? void 0 : je.startsWith(`/${ts}/`))) ? (w("Slugs cannot start with a language code for primary page"), !1) : !0;
2639
2637
  }, Vs = (S, fe) => {
2640
- const He = vt(fe), $e = Ha(He, S), Qe = {
2638
+ const Ke = vt(fe), je = Ha(Ke, S), We = {
2641
2639
  pageType: b,
2642
2640
  name: pe,
2643
- slug: $e.replace(/\/$/, ""),
2641
+ slug: je.replace(/\/$/, ""),
2644
2642
  // remove trailing slashes
2645
2643
  parent: P,
2646
2644
  dynamic: me,
@@ -2650,9 +2648,9 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2650
2648
  seo: {},
2651
2649
  jsonLD: {}
2652
2650
  };
2653
- if (me && (Qe.dynamicSlugCustom = I), i)
2651
+ if (me && (We.dynamicSlugCustom = I), i)
2654
2652
  u(
2655
- { id: e == null ? void 0 : e.id, ...Qe },
2653
+ { id: e == null ? void 0 : e.id, ...We },
2656
2654
  {
2657
2655
  onSuccess: () => {
2658
2656
  K.success("Page updated successfully"), n();
@@ -2661,9 +2659,9 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2661
2659
  );
2662
2660
  else {
2663
2661
  const gt = be(t, { key: b });
2664
- gt != null && gt.trackingDefault && (Qe.tracking = gt.trackingDefault);
2662
+ gt != null && gt.trackingDefault && (We.tracking = gt.trackingDefault);
2665
2663
  const { seo: ts, jsonLD: ll } = In(gt, te);
2666
- St(Qe, "seo", ts), St(Qe, "jsonLD", ll), c(Qe, {
2664
+ St(We, "seo", ts), St(We, "jsonLD", ll), c(We, {
2667
2665
  onSuccess: (ol) => {
2668
2666
  n(), r(ol.page.id, a);
2669
2667
  }
@@ -2690,11 +2688,11 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2690
2688
  else {
2691
2689
  const fe = be(t, { key: b });
2692
2690
  fe != null && fe.trackingDefault && (S.tracking = fe.trackingDefault);
2693
- const { seo: He, jsonLD: $e } = In(fe, te);
2694
- St(S, "seo", He), St(S, "jsonLD", $e), c(S, {
2695
- onSuccess: (Qe) => {
2691
+ const { seo: Ke, jsonLD: je } = In(fe, te);
2692
+ St(S, "seo", Ke), St(S, "jsonLD", je), c(S, {
2693
+ onSuccess: (We) => {
2696
2694
  var gt;
2697
- (gt = Qe == null ? void 0 : Qe.page) != null && gt.id && r(Qe.page.id, a), n();
2695
+ (gt = We == null ? void 0 : We.page) != null && gt.id && r(We.page.id, a), n();
2698
2696
  }
2699
2697
  });
2700
2698
  }
@@ -2705,10 +2703,10 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2705
2703
  return;
2706
2704
  }
2707
2705
  if (P && P !== "none") {
2708
- const fe = l == null ? void 0 : l.find(($e) => $e.id === P), He = (fe == null ? void 0 : fe.slug) || "";
2709
- if (!zs(f, He))
2706
+ const fe = l == null ? void 0 : l.find((je) => je.id === P), Ke = (fe == null ? void 0 : fe.slug) || "";
2707
+ if (!zs(f, Ke))
2710
2708
  return;
2711
- Vs(f, He);
2709
+ Vs(f, Ke);
2712
2710
  } else
2713
2711
  Ks();
2714
2712
  }
@@ -2885,7 +2883,7 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2885
2883
  type: "checkbox",
2886
2884
  id: "useDynamicSlug",
2887
2885
  checked: me,
2888
- onChange: (S) => Ke(S.target.checked),
2886
+ onChange: (S) => Ve(S.target.checked),
2889
2887
  className: "rounded border-gray-300"
2890
2888
  }
2891
2889
  ),
@@ -2920,7 +2918,7 @@ function qc({ addEditPage: e, additionalPageTypes: t = [], close: n, closePanel:
2920
2918
  A,
2921
2919
  {
2922
2920
  disabled: he || // Disable if regular slug is invalid and we're not using dynamic slug
2923
- !p && (!(M != null && M.dynamicSegments) || !me) || // Disable if dynamic slug is invalid and we are using dynamic slug
2921
+ !y && (!(M != null && M.dynamicSegments) || !me) || // Disable if dynamic slug is invalid and we are using dynamic slug
2924
2922
  me && !$,
2925
2923
  type: "submit",
2926
2924
  className: "w-full",
@@ -3011,10 +3009,10 @@ const di = ({
3011
3009
  setAddEditPage: t,
3012
3010
  closePanel: n
3013
3011
  }) => {
3014
- const { data: a } = je(), r = !!(e != null && e.id);
3015
- return /* @__PURE__ */ s(Je, { open: !!e, onOpenChange: () => t(void 0), children: /* @__PURE__ */ o(Xe, { className: "sm:max-w-[425px]", children: [
3016
- /* @__PURE__ */ o(Ze, { children: [
3017
- /* @__PURE__ */ o(et, { children: [
3012
+ const { data: a } = Fe(), r = !!(e != null && e.id);
3013
+ return /* @__PURE__ */ s(Ye, { open: !!e, onOpenChange: () => t(void 0), children: /* @__PURE__ */ o(Je, { className: "sm:max-w-[425px]", children: [
3014
+ /* @__PURE__ */ o(Xe, { children: [
3015
+ /* @__PURE__ */ o(Ze, { children: [
3018
3016
  r ? "Edit" : "Add New",
3019
3017
  " "
3020
3018
  ] }),
@@ -3035,7 +3033,7 @@ function Oa({
3035
3033
  page: e,
3036
3034
  onClose: t
3037
3035
  }) {
3038
- const [, n] = Ve(), { mutate: a, isPending: r } = Ec(), { data: i } = je(), { setSelectedLang: l, fallbackLang: c } = ze(), [, d] = As(), u = () => {
3036
+ const [, n] = ze(), { mutate: a, isPending: r } = Ec(), { data: i } = Fe(), { setSelectedLang: l, fallbackLang: c } = qe(), [, d] = As(), u = () => {
3039
3037
  r || a(e, {
3040
3038
  onSuccess: () => {
3041
3039
  e != null && e.primaryPage ? (window.history.replaceState({}, "", `/?page=${e.primaryPage}`), n(new URLSearchParams({ page: e.primaryPage }))) : (window.history.replaceState({}, "", "/"), n(new URLSearchParams())), window.dispatchEvent(new PopStateEvent("popstate")), l(c), d("outline"), t();
@@ -3044,9 +3042,9 @@ function Oa({
3044
3042
  }, h = i == null ? void 0 : i.find(
3045
3043
  (m) => m.key === (e == null ? void 0 : e.pageType)
3046
3044
  );
3047
- return /* @__PURE__ */ s(Je, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Xe, { children: [
3048
- /* @__PURE__ */ o(Ze, { children: [
3049
- /* @__PURE__ */ s(et, { children: "Confirm Deletion" }),
3045
+ return /* @__PURE__ */ s(Ye, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Je, { children: [
3046
+ /* @__PURE__ */ o(Xe, { children: [
3047
+ /* @__PURE__ */ s(Ze, { children: "Confirm Deletion" }),
3050
3048
  /* @__PURE__ */ o(rt, { className: "py-4 text-slate-500", children: [
3051
3049
  /* @__PURE__ */ o("div", { children: [
3052
3050
  "Are you sure you want to remove ",
@@ -3057,7 +3055,7 @@ function Oa({
3057
3055
  e.lang && /* @__PURE__ */ o("div", { className: "py-2 text-sm", children: [
3058
3056
  "Language:",
3059
3057
  " ",
3060
- /* @__PURE__ */ s("span", { className: "font-medium text-gray-500", children: V(We, e.lang, e.lang) })
3058
+ /* @__PURE__ */ s("span", { className: "font-medium text-gray-500", children: V(He, e.lang, e.lang) })
3061
3059
  ] })
3062
3060
  ] })
3063
3061
  ] }),
@@ -3109,7 +3107,7 @@ const zc = () => {
3109
3107
  }) => {
3110
3108
  const { mutate: n, isPending: a } = zc(), [r, i] = E(null), [l, c] = E(`${e.name} (Copy)`), d = Q(e.slug), [u, h] = E(
3111
3109
  d ? "" : `${e.slug.split("/").pop()}-copy`
3112
- ), m = d ? "" : gl(e.slug.split("/")).join("/"), [w, p] = E(!1), g = (b) => {
3110
+ ), m = d ? "" : gl(e.slug.split("/")).join("/"), [w, y] = E(!1), g = (b) => {
3113
3111
  if (b.preventDefault(), !l.trim()) {
3114
3112
  i("Name is required");
3115
3113
  return;
@@ -3118,19 +3116,19 @@ const zc = () => {
3118
3116
  i("Slug is required");
3119
3117
  return;
3120
3118
  }
3121
- i(null), p(!0);
3122
- const y = {
3119
+ i(null), y(!0);
3120
+ const p = {
3123
3121
  pageId: e.id,
3124
3122
  name: l
3125
3123
  };
3126
- d || (y.slug = `${m}/${u}`), n(
3127
- y,
3124
+ d || (p.slug = `${m}/${u}`), n(
3125
+ p,
3128
3126
  {
3129
3127
  onSuccess: () => {
3130
- p(!1), t();
3128
+ y(!1), t();
3131
3129
  },
3132
3130
  onError: (N) => {
3133
- p(!1), N.code === "SLUG_EXISTS" ? i(
3131
+ y(!1), N.code === "SLUG_EXISTS" ? i(
3134
3132
  "A page with this slug already exists. Please choose a different slug."
3135
3133
  ) : N.code === "INVALID_SLUG" ? i(
3136
3134
  "The slug format is invalid. Please use only lowercase letters, numbers, and hyphens."
@@ -3141,9 +3139,9 @@ const zc = () => {
3141
3139
  }
3142
3140
  );
3143
3141
  };
3144
- return /* @__PURE__ */ s(Je, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Xe, { className: "sm:max-w-[425px]", children: [
3145
- /* @__PURE__ */ o(Ze, { children: [
3146
- /* @__PURE__ */ s(et, { children: "Duplicate Page" }),
3142
+ return /* @__PURE__ */ s(Ye, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Je, { className: "sm:max-w-[425px]", children: [
3143
+ /* @__PURE__ */ o(Xe, { children: [
3144
+ /* @__PURE__ */ s(Ze, { children: "Duplicate Page" }),
3147
3145
  /* @__PURE__ */ s(rt, { children: "Create a copy of the page with a new name and slug" })
3148
3146
  ] }),
3149
3147
  /* @__PURE__ */ o("div", { className: "bg-gray-50 p-3 rounded-md mb-4", children: [
@@ -3223,9 +3221,9 @@ const zc = () => {
3223
3221
  page: e,
3224
3222
  onClose: t
3225
3223
  }) => {
3226
- const [n, a] = E(!1), [r, i] = E(""), [l, c] = E(""), [d, u] = E(!1), h = Be(null), m = Cc(), { data: w } = je(), p = w == null ? void 0 : w.find(
3224
+ const [n, a] = E(!1), [r, i] = E(""), [l, c] = E(""), [d, u] = E(!1), h = tt(null), m = Cc(), { data: w } = Fe(), y = w == null ? void 0 : w.find(
3227
3225
  (O) => O.key === e.pageType
3228
- ), g = (p == null ? void 0 : p.name) || Gt(e.pageType), b = ie(
3226
+ ), g = (y == null ? void 0 : y.name) || Gt(e.pageType), b = ie(
3229
3227
  (O) => {
3230
3228
  var _;
3231
3229
  const x = (_ = O.target.files) == null ? void 0 : _[0];
@@ -3250,7 +3248,7 @@ const zc = () => {
3250
3248
  }
3251
3249
  },
3252
3250
  []
3253
- ), y = () => {
3251
+ ), p = () => {
3254
3252
  c(""), h.current && (h.current.value = "");
3255
3253
  }, N = () => {
3256
3254
  var O;
@@ -3274,9 +3272,9 @@ const zc = () => {
3274
3272
  }
3275
3273
  );
3276
3274
  };
3277
- return /* @__PURE__ */ s(Je, { open: !0, onOpenChange: t, children: /* @__PURE__ */ o(Xe, { children: [
3278
- /* @__PURE__ */ o(Ze, { children: [
3279
- /* @__PURE__ */ s(et, { children: "Mark as template" }),
3275
+ return /* @__PURE__ */ s(Ye, { open: !0, onOpenChange: t, children: /* @__PURE__ */ o(Je, { children: [
3276
+ /* @__PURE__ */ o(Xe, { children: [
3277
+ /* @__PURE__ */ s(Ze, { children: "Mark as template" }),
3280
3278
  /* @__PURE__ */ o(rt, { className: "py-4 text-slate-500 space-y-1 text-xs", children: [
3281
3279
  "Are you sure you want to mark this page as a template?",
3282
3280
  /* @__PURE__ */ s("br", {}),
@@ -3347,7 +3345,7 @@ const zc = () => {
3347
3345
  type: "button",
3348
3346
  variant: "outline",
3349
3347
  size: "icon",
3350
- onClick: y,
3348
+ onClick: p,
3351
3349
  children: /* @__PURE__ */ s(_n, { className: "h-4 w-4" })
3352
3350
  }
3353
3351
  )
@@ -3394,7 +3392,7 @@ const zc = () => {
3394
3392
  setUnmarkAsTemplate: l,
3395
3393
  children: c
3396
3394
  }) => {
3397
- const { hasPermission: d } = mn(), { data: u } = je(), h = Y(
3395
+ const { hasPermission: d } = mn(), { data: u } = Fe(), h = Y(
3398
3396
  () => be(u, { key: e.pageType }),
3399
3397
  [u, e.pageType]
3400
3398
  ), m = Y(() => !!e.isTemplate, [e.isTemplate]), w = Y(
@@ -3405,7 +3403,7 @@ const zc = () => {
3405
3403
  /* @__PURE__ */ s(gn, { asChild: !0, onClick: (g) => g.stopPropagation(), children: c }),
3406
3404
  /* @__PURE__ */ o(pn, { align: "center", className: "text-sm", children: [
3407
3405
  d(Te.ADD_PAGE) && /* @__PURE__ */ o(
3408
- Me,
3406
+ Be,
3409
3407
  {
3410
3408
  className: "flex items-center gap-2 cursor-pointer",
3411
3409
  onClick: (g) => {
@@ -3418,7 +3416,7 @@ const zc = () => {
3418
3416
  }
3419
3417
  ),
3420
3418
  d(Te.EDIT_PAGE) && /* @__PURE__ */ o(
3421
- Me,
3419
+ Be,
3422
3420
  {
3423
3421
  className: "flex items-center gap-2 cursor-pointer",
3424
3422
  onClick: (g) => {
@@ -3434,7 +3432,7 @@ const zc = () => {
3434
3432
  }
3435
3433
  ),
3436
3434
  (e == null ? void 0 : e.online) && d(Te.UNPUBLISH_PAGE) && /* @__PURE__ */ o(
3437
- Me,
3435
+ Be,
3438
3436
  {
3439
3437
  className: "flex items-center gap-2 cursor-pointer",
3440
3438
  onClick: (g) => {
@@ -3447,7 +3445,7 @@ const zc = () => {
3447
3445
  }
3448
3446
  ),
3449
3447
  d(Te.DELETE_PAGE) && /* @__PURE__ */ o(
3450
- Me,
3448
+ Be,
3451
3449
  {
3452
3450
  className: "flex items-center gap-2 cursor-pointer",
3453
3451
  onClick: (g) => {
@@ -3460,7 +3458,7 @@ const zc = () => {
3460
3458
  }
3461
3459
  ),
3462
3460
  d(Te.MARK_AS_TEMPLATE) && w && /* @__PURE__ */ s(ve, { children: m ? /* @__PURE__ */ o(
3463
- Me,
3461
+ Be,
3464
3462
  {
3465
3463
  className: "flex items-center gap-2 cursor-pointer",
3466
3464
  onClick: (g) => {
@@ -3472,7 +3470,7 @@ const zc = () => {
3472
3470
  ]
3473
3471
  }
3474
3472
  ) : /* @__PURE__ */ o(
3475
- Me,
3473
+ Be,
3476
3474
  {
3477
3475
  className: "flex items-center gap-2 cursor-pointer",
3478
3476
  onClick: (g) => {
@@ -3491,9 +3489,9 @@ const zc = () => {
3491
3489
  onClose: t
3492
3490
  }) => {
3493
3491
  const [n, a] = E(!1), r = Pc();
3494
- return /* @__PURE__ */ s(Je, { open: !0, onOpenChange: t, children: /* @__PURE__ */ o(Xe, { children: [
3495
- /* @__PURE__ */ o(Ze, { children: [
3496
- /* @__PURE__ */ s(et, { children: "Unmark as template" }),
3492
+ return /* @__PURE__ */ s(Ye, { open: !0, onOpenChange: t, children: /* @__PURE__ */ o(Je, { children: [
3493
+ /* @__PURE__ */ o(Xe, { children: [
3494
+ /* @__PURE__ */ s(Ze, { children: "Unmark as template" }),
3497
3495
  /* @__PURE__ */ s(rt, { className: "py-4 text-slate-500 space-y-1 text-xs", children: "Are you sure you want to unmark this page as a template?" })
3498
3496
  ] }),
3499
3497
  /* @__PURE__ */ o(
@@ -3532,9 +3530,9 @@ const zc = () => {
3532
3530
  const { mutate: n, isPending: a } = Ac(), r = async () => {
3533
3531
  n(e, { onSuccess: t });
3534
3532
  };
3535
- return /* @__PURE__ */ s(Je, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Xe, { children: [
3536
- /* @__PURE__ */ o(Ze, { children: [
3537
- /* @__PURE__ */ s(et, { children: "Confirm action" }),
3533
+ return /* @__PURE__ */ s(Ye, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Je, { children: [
3534
+ /* @__PURE__ */ o(Xe, { children: [
3535
+ /* @__PURE__ */ s(Ze, { children: "Confirm action" }),
3538
3536
  /* @__PURE__ */ o(rt, { children: [
3539
3537
  re.UNPUBLISH_MSG,
3540
3538
  " ",
@@ -3601,8 +3599,8 @@ const zc = () => {
3601
3599
  if (!h || Q(u)) return;
3602
3600
  const m = Ga(u), w = gi(m, h);
3603
3601
  if (!Array.isArray(w) || Q(w)) return;
3604
- const p = w.slice(0, -1);
3605
- Q(p) || n((g) => fr([...g, ...p]));
3602
+ const y = w.slice(0, -1);
3603
+ Q(y) || n((g) => fr([...g, ...y]));
3606
3604
  },
3607
3605
  [n]
3608
3606
  ), l = ie(
@@ -3615,7 +3613,7 @@ const zc = () => {
3615
3613
  ), c = ie((u) => {
3616
3614
  if (Q(u)) return;
3617
3615
  const h = ta(u, (m) => {
3618
- const w = (p) => [p.id, ...p.children ? ta(p.children, w) : []];
3616
+ const w = (y) => [y.id, ...y.children ? ta(y.children, w) : []];
3619
3617
  return w(m);
3620
3618
  });
3621
3619
  n(h);
@@ -3710,12 +3708,12 @@ const zc = () => {
3710
3708
  isExpanded: m,
3711
3709
  onToggleExpand: w
3712
3710
  }) => {
3713
- const p = Da(), { data: g } = je(), [, b] = As(), y = Y(() => be(g, { key: t.pageType }), [g, t.pageType]), N = Y(() => {
3711
+ const y = Da(), { data: g } = Fe(), [, b] = As(), p = Y(() => be(g, { key: t.pageType }), [g, t.pageType]), N = Y(() => {
3714
3712
  const _ = V(t, "slug", ""), G = e ? vt(e) : "", W = G ? _.replace(G, "") : _;
3715
3713
  return W || "/";
3716
3714
  }, [t, e]), T = Y(() => !!t.isTemplate, [t.isTemplate]), O = ie(() => {
3717
- b("outline"), p(V(t, "id"), a);
3718
- }, [p, a, t, b]), x = ie(
3715
+ b("outline"), y(V(t, "id"), a);
3716
+ }, [y, a, t, b]), x = ie(
3719
3717
  (_) => {
3720
3718
  _.stopPropagation(), w();
3721
3719
  },
@@ -3743,10 +3741,10 @@ const zc = () => {
3743
3741
  )
3744
3742
  }
3745
3743
  ),
3746
- t.dynamic ? /* @__PURE__ */ s("div", { className: "w-4 h-4 text-slate-500 stroke-[1]", children: /* @__PURE__ */ s(go, { className: "w-4 h-4 text-yellow-400" }) }) : y != null && y.icon ? /* @__PURE__ */ s("div", { className: "w-4 h-4 text-slate-500 stroke-[1]", dangerouslySetInnerHTML: { __html: y.icon } }) : y != null && y.hasSlug ? /* @__PURE__ */ s(Yn, { className: "w-4 h-4 text-slate-500 stroke-[1]" }) : /* @__PURE__ */ s(po, { className: "w-4 h-4 text-slate-500 stroke-[1]" }),
3744
+ t.dynamic ? /* @__PURE__ */ s("div", { className: "w-4 h-4 text-slate-500 stroke-[1]", children: /* @__PURE__ */ s(go, { className: "w-4 h-4 text-yellow-400" }) }) : p != null && p.icon ? /* @__PURE__ */ s("div", { className: "w-4 h-4 text-slate-500 stroke-[1]", dangerouslySetInnerHTML: { __html: p.icon } }) : p != null && p.hasSlug ? /* @__PURE__ */ s(Yn, { className: "w-4 h-4 text-slate-500 stroke-[1]" }) : /* @__PURE__ */ s(po, { className: "w-4 h-4 text-slate-500 stroke-[1]" }),
3747
3745
  !t.isPartialGroup && /* @__PURE__ */ s("div", { className: `w-2.5 h-2.5 rounded-full ${t.online ? "bg-green-300" : "bg-gray-300"}` }),
3748
3746
  /* @__PURE__ */ s("span", { className: "font-light leading-none truncate text-slate-800", children: t.name }),
3749
- y != null && y.hasSlug ? /* @__PURE__ */ o(
3747
+ p != null && p.hasSlug ? /* @__PURE__ */ o(
3750
3748
  Qs,
3751
3749
  {
3752
3750
  variant: "outline",
@@ -3754,7 +3752,7 @@ const zc = () => {
3754
3752
  children: [
3755
3753
  N,
3756
3754
  t.dynamic && /* @__PURE__ */ o("span", { className: "text-xs font-light leading-none text-slate-500", children: [
3757
- pr(N, "/") ? `${y == null ? void 0 : y.dynamicSlug}` : `/${y == null ? void 0 : y.dynamicSlug}`,
3755
+ pr(N, "/") ? `${p == null ? void 0 : p.dynamicSlug}` : `/${p == null ? void 0 : p.dynamicSlug}`,
3758
3756
  t.dynamicSlugCustom
3759
3757
  ] })
3760
3758
  ]
@@ -3764,7 +3762,7 @@ const zc = () => {
3764
3762
  {
3765
3763
  variant: "outline",
3766
3764
  className: `ml-2 text-xs max-w-full leading-tight py-px font-normal rounded-full text-gray-400 border ${n ? "border-gray-300" : "border-gray-200"}`,
3767
- children: y == null ? void 0 : y.name
3765
+ children: p == null ? void 0 : p.name
3768
3766
  }
3769
3767
  ),
3770
3768
  T && /* @__PURE__ */ s(
@@ -3796,7 +3794,7 @@ const zc = () => {
3796
3794
  }
3797
3795
  );
3798
3796
  }, Zc = ({ close: e, isOpen: t }) => {
3799
- const [, n] = E([]), [a, r] = E(null), [i, l] = E(""), [c, d] = E(""), [u, h] = E(null), m = (k) => c ? String(V(k, "name", "")).toLowerCase().includes(c.toLowerCase()) || String(V(k, "key", "")).toLowerCase().includes(c.toLowerCase()) : !0, [w, p] = E(null), [g, b] = E(null), [y, N] = E(null), [T, O] = E(null), { data: x, isFetching: _, refetch: G } = Bs(), [W, F] = E(""), { hasPermission: te } = mn(), { updateForSelectedPage: j, expandPagesOnSearch: q, expandAll: ee, collapseAll: z } = pi(null), [X, P] = Ve(), B = X.get("page"), pe = Be(null), { data: Ee } = je(), me = mt("enable-add-page-dropdown"), v = ie((k) => {
3797
+ const [, n] = E([]), [a, r] = E(null), [i, l] = E(""), [c, d] = E(""), [u, h] = E(null), m = (k) => c ? String(V(k, "name", "")).toLowerCase().includes(c.toLowerCase()) || String(V(k, "key", "")).toLowerCase().includes(c.toLowerCase()) : !0, [w, y] = E(null), [g, b] = E(null), [p, N] = E(null), [T, O] = E(null), { data: x, isFetching: _, refetch: G } = Bs(), [W, F] = E(""), { hasPermission: te } = mn(), { updateForSelectedPage: j, expandPagesOnSearch: q, expandAll: ee, collapseAll: z } = pi(null), [X, P] = ze(), B = X.get("page"), pe = tt(null), { data: Ee } = Fe(), me = mt("enable-add-page-dropdown"), v = ie((k) => {
3800
3798
  var U;
3801
3799
  return (U = be(Ee, { key: k })) == null ? void 0 : U.hasSlug;
3802
3800
  }, [Ee]);
@@ -3875,7 +3873,7 @@ const zc = () => {
3875
3873
  /* @__PURE__ */ s(Ws, { value: "all", children: "All" }, "all"),
3876
3874
  !Q(Le(Ee, (k) => k.hasSlug && m(k))) && /* @__PURE__ */ o(ve, { children: [
3877
3875
  /* @__PURE__ */ s("div", { className: "px-2 py-1.5 text-xs font-semibold text-gray-500 mt-2 border-t pt-2", children: "Pages" }),
3878
- tt(
3876
+ et(
3879
3877
  [...Le(Ee, (k) => k.hasSlug && m(k))].sort(
3880
3878
  (k, U) => V(k, "name", "").localeCompare(V(U, "name", ""))
3881
3879
  ),
@@ -3884,7 +3882,7 @@ const zc = () => {
3884
3882
  ] }),
3885
3883
  !Q(Le(Ee, (k) => !k.hasSlug && m(k))) && /* @__PURE__ */ o(ve, { children: [
3886
3884
  /* @__PURE__ */ s("div", { className: "px-2 py-1.5 text-xs font-semibold text-gray-500 mt-2 border-t pt-2", children: "Partials" }),
3887
- tt(
3885
+ et(
3888
3886
  [...Le(Ee, (k) => !k.hasSlug && m(k))].sort(
3889
3887
  (k, U) => V(k, "name", "").localeCompare(V(U, "name", ""))
3890
3888
  ),
@@ -3900,11 +3898,11 @@ const zc = () => {
3900
3898
  /* @__PURE__ */ s(A, { variant: "outline", size: "icon", onClick: $, className: "p-1 text-gray-500", children: /* @__PURE__ */ s(fo, {}) })
3901
3899
  ] })
3902
3900
  ] }),
3903
- _ ? /* @__PURE__ */ s("div", { className: "space-y-2", children: tt([...Array(5).keys()], (k) => /* @__PURE__ */ s("div", { className: "w-full bg-gray-200 rounded h-9 animate-pulse" }, k)) }) : Q(I) ? /* @__PURE__ */ o("div", { className: "h-[70vh] flex flex-col gap-y-1 items-center justify-center text-slate-500 text-sm font-medium", children: [
3901
+ _ ? /* @__PURE__ */ s("div", { className: "space-y-2", children: et([...Array(5).keys()], (k) => /* @__PURE__ */ s("div", { className: "w-full bg-gray-200 rounded h-9 animate-pulse" }, k)) }) : Q(I) ? /* @__PURE__ */ o("div", { className: "h-[70vh] flex flex-col gap-y-1 items-center justify-center text-slate-500 text-sm font-medium", children: [
3904
3902
  /* @__PURE__ */ s(Yn, { className: "h-6 w-6 stroke-[1]" }),
3905
3903
  "Empty List!",
3906
3904
  /* @__PURE__ */ s("span", { className: "font-light", children: "Add new page to start" })
3907
- ] }) : /* @__PURE__ */ s("div", { className: "text-sm text-slate-700 space-y-2 h-[70vh] overflow-y-auto", children: tt(I, (k) => {
3905
+ ] }) : /* @__PURE__ */ s("div", { className: "text-sm text-slate-700 space-y-2 h-[70vh] overflow-y-auto", children: et(I, (k) => {
3908
3906
  const U = k.id === B;
3909
3907
  return /* @__PURE__ */ s("div", { ref: U ? pe : null, children: /* @__PURE__ */ s(
3910
3908
  vi,
@@ -3912,7 +3910,7 @@ const zc = () => {
3912
3910
  item: k,
3913
3911
  currentPage: B,
3914
3912
  close: e,
3915
- setUnpublishPage: p,
3913
+ setUnpublishPage: y,
3916
3914
  setDeletePage: h,
3917
3915
  setAddEditPage: b,
3918
3916
  setMarkAsTemplate: N,
@@ -3950,8 +3948,8 @@ const zc = () => {
3950
3948
  }
3951
3949
  ),
3952
3950
  u && /* @__PURE__ */ s(Oa, { page: u, onClose: () => h(null) }),
3953
- w && /* @__PURE__ */ s(Fs, { page: w, onClose: () => p(null) }),
3954
- y && /* @__PURE__ */ s(hi, { page: y, onClose: () => N(null) }),
3951
+ w && /* @__PURE__ */ s(Fs, { page: w, onClose: () => y(null) }),
3952
+ p && /* @__PURE__ */ s(hi, { page: p, onClose: () => N(null) }),
3955
3953
  T && /* @__PURE__ */ s(fi, { page: T, onClose: () => O(null) }),
3956
3954
  a && /* @__PURE__ */ s(ui, { page: a, onClose: () => r(null) })
3957
3955
  ] });
@@ -3968,7 +3966,7 @@ const zc = () => {
3968
3966
  parentSlug: u,
3969
3967
  level: h = 0
3970
3968
  }) => {
3971
- const m = !Q(e == null ? void 0 : e.children), { isExpanded: w, toggleExpanded: p } = pi(e == null ? void 0 : e.id);
3969
+ const m = !Q(e == null ? void 0 : e.children), { isExpanded: w, toggleExpanded: y } = pi(e == null ? void 0 : e.id);
3972
3970
  return /* @__PURE__ */ o("div", { className: "border-0", children: [
3973
3971
  /* @__PURE__ */ s(
3974
3972
  Xc,
@@ -3985,10 +3983,10 @@ const zc = () => {
3985
3983
  parentSlug: u,
3986
3984
  hasChildren: m,
3987
3985
  isExpanded: w,
3988
- onToggleExpand: p
3986
+ onToggleExpand: y
3989
3987
  }
3990
3988
  ),
3991
- m && w && /* @__PURE__ */ s("div", { className: "pt-2 pl-6 bg-white", children: tt(V(e, "children", []), (g) => /* @__PURE__ */ s(
3989
+ m && w && /* @__PURE__ */ s("div", { className: "pt-2 pl-6 bg-white", children: et(V(e, "children", []), (g) => /* @__PURE__ */ s(
3992
3990
  vi,
3993
3991
  {
3994
3992
  item: g,
@@ -4010,8 +4008,8 @@ const zc = () => {
4010
4008
  page: e,
4011
4009
  onClose: t
4012
4010
  }) => {
4013
- const [n, a] = E(e.slug || ""), { mutate: r, isPending: i } = kc(), { data: l } = je(), c = be(l, { key: e == null ? void 0 : e.pageType }), d = (h) => {
4014
- if (h.preventDefault(), !(e != null && e.primaryPage) && Object.keys(We).some((p) => n === `/${p}` || ds(n, `/${p}/`))) {
4011
+ const [n, a] = E(e.slug || ""), { mutate: r, isPending: i } = kc(), { data: l } = Fe(), c = be(l, { key: e == null ? void 0 : e.pageType }), d = (h) => {
4012
+ if (h.preventDefault(), !(e != null && e.primaryPage) && Object.keys(He).some((y) => n === `/${y}` || ds(n, `/${y}/`))) {
4015
4013
  K.error("Error", {
4016
4014
  description: "Slugs cannot start with a language code for primary page"
4017
4015
  });
@@ -4019,9 +4017,9 @@ const zc = () => {
4019
4017
  }
4020
4018
  r({ ...e, slug: n }, { onSuccess: t });
4021
4019
  }, u = (e == null ? void 0 : e.lang) || "";
4022
- return /* @__PURE__ */ s(Je, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Xe, { children: [
4023
- /* @__PURE__ */ o(Ze, { children: [
4024
- /* @__PURE__ */ s(et, { children: "Change Slug" }),
4020
+ return /* @__PURE__ */ s(Ye, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Je, { children: [
4021
+ /* @__PURE__ */ o(Xe, { children: [
4022
+ /* @__PURE__ */ s(Ze, { children: "Change Slug" }),
4025
4023
  /* @__PURE__ */ s(rt, { className: "text-xs", children: /* @__PURE__ */ o(Qn, { variant: "destructive", className: "mt-2", children: [
4026
4024
  /* @__PURE__ */ s(Ds, { className: "h-4 w-4" }),
4027
4025
  "Changing the slug may have impact on your SEO. Please proceed with caution."
@@ -4095,7 +4093,7 @@ const zc = () => {
4095
4093
  onClose: t,
4096
4094
  languages: n
4097
4095
  }) => {
4098
- const { data: a } = Ue(), r = a == null ? void 0 : a.dynamic, { data: i } = je(), [l, c] = E(e.name || ""), [d, u] = E(e.edit ? e.lang : ""), [h, m] = E(e.edit ? e.slug : ""), [w, p] = E(!0), [g, b] = E(!0), { mutate: y, isPending: N } = ci(), { mutate: T, isPending: O } = ka(), { data: x } = wt(a == null ? void 0 : a.parent), { setSelectedLang: _, fallbackLang: G } = ze(), [, W] = Ve(), [, F] = As(), te = Y(
4096
+ const { data: a } = Ue(), r = a == null ? void 0 : a.dynamic, { data: i } = Fe(), [l, c] = E(e.name || ""), [d, u] = E(e.edit ? e.lang : ""), [h, m] = E(e.edit ? e.slug : ""), [w, y] = E(!0), [g, b] = E(!0), { mutate: p, isPending: N } = ci(), { mutate: T, isPending: O } = ka(), { data: x } = wt(a == null ? void 0 : a.parent), { setSelectedLang: _, fallbackLang: G } = qe(), [, W] = ze(), [, F] = As(), te = Y(
4099
4097
  () => i == null ? void 0 : i.find((v) => v.key === e.pageType),
4100
4098
  [i, e.pageType]
4101
4099
  ), j = r || !(te != null && te.hasSlug), q = (a == null ? void 0 : a.slug) === "/", ee = N || O, { parentSlug: z, isRootPage: X } = Y(() => {
@@ -4116,18 +4114,18 @@ const zc = () => {
4116
4114
  const I = (R) => b(R);
4117
4115
  if (q) {
4118
4116
  const R = f.pop() || "";
4119
- if (We[R])
4117
+ if (He[R])
4120
4118
  I(!0);
4121
4119
  else {
4122
4120
  C = R;
4123
4121
  const $ = f.pop() || "";
4124
- I(!!We[$]);
4122
+ I(!!He[$]);
4125
4123
  }
4126
4124
  } else if (X) {
4127
4125
  if (f.length) {
4128
4126
  C = f.pop() || "";
4129
4127
  const R = f.pop() || "";
4130
- I(!!We[R]);
4128
+ I(!!He[R]);
4131
4129
  }
4132
4130
  } else
4133
4131
  f.length && (C = f.pop() || "");
@@ -4151,15 +4149,15 @@ const zc = () => {
4151
4149
  pageType: a == null ? void 0 : a.pageType,
4152
4150
  tracking: {}
4153
4151
  };
4154
- f.pageType = e.pageType, e.edit && (f.id = e == null ? void 0 : e.id), e.edit ? T(f, { onSuccess: t }) : y(f, {
4152
+ f.pageType = e.pageType, e.edit && (f.id = e == null ? void 0 : e.id), e.edit ? T(f, { onSuccess: t }) : p(f, {
4155
4153
  onSuccess: () => {
4156
4154
  d && (_(d), pe(d, G)), F("outline"), t();
4157
4155
  }
4158
4156
  });
4159
4157
  }, me = ee || Q(l) || Q(d) || (j || q && g ? !1 : !w || Q(h));
4160
- return /* @__PURE__ */ s(Je, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Xe, { className: "text-slate-600 sm:max-w-[425px]", children: [
4161
- /* @__PURE__ */ o(Ze, { children: [
4162
- /* @__PURE__ */ s(et, { children: e.edit ? re.EDIT_LANGUAGE : re.ADD_NEW_LANGUAGE }),
4158
+ return /* @__PURE__ */ s(Ye, { open: !!e, onOpenChange: t, children: /* @__PURE__ */ o(Je, { className: "text-slate-600 sm:max-w-[425px]", children: [
4159
+ /* @__PURE__ */ o(Xe, { children: [
4160
+ /* @__PURE__ */ s(Ze, { children: e.edit ? re.EDIT_LANGUAGE : re.ADD_NEW_LANGUAGE }),
4163
4161
  /* @__PURE__ */ s(rt, { className: "font-light", children: re.ENTER_LANGUAGE_DETAILS })
4164
4162
  ] }),
4165
4163
  /* @__PURE__ */ o("form", { onSubmit: Ee, children: [
@@ -4173,12 +4171,12 @@ const zc = () => {
4173
4171
  disabled: e.edit || Q(n),
4174
4172
  onChange: (v) => {
4175
4173
  const f = v.target.value;
4176
- u(f), !e.edit && ds(l, e.name) && c(`${e.name} - ${We[f]}`);
4174
+ u(f), !e.edit && ds(l, e.name) && c(`${e.name} - ${He[f]}`);
4177
4175
  },
4178
4176
  className: "col-span-3 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",
4179
4177
  children: [
4180
- /* @__PURE__ */ s("option", { value: "", disabled: !0, selected: !0, children: e.edit ? V(We, e.lang, e.lang) : Q(n) ? re.ALL_AVAILABLE_LANGUAGE_PAGE : re.CHOOSE_LANGUAGE }),
4181
- tt(n, (v) => /* @__PURE__ */ s("option", { value: v, children: V(We, v, v) }, v))
4178
+ /* @__PURE__ */ s("option", { value: "", disabled: !0, selected: !0, children: e.edit ? V(He, e.lang, e.lang) : Q(n) ? re.ALL_AVAILABLE_LANGUAGE_PAGE : re.CHOOSE_LANGUAGE }),
4179
+ et(n, (v) => /* @__PURE__ */ s("option", { value: v, children: V(He, v, v) }, v))
4182
4180
  ]
4183
4181
  }
4184
4182
  )
@@ -4231,7 +4229,7 @@ const zc = () => {
4231
4229
  onChange: m,
4232
4230
  placeholder: Q(d) ? re.CHOOSE_LANGUAGE_TO_ADD_SLUG : q && g ? "Leave empty for home page" : re.ENTER_PAGE_SLUG,
4233
4231
  parentSlug: z,
4234
- onValidationChange: p,
4232
+ onValidationChange: y,
4235
4233
  fullSlug: me ? "" : B()
4236
4234
  }
4237
4235
  )
@@ -4244,16 +4242,16 @@ const zc = () => {
4244
4242
  ] }),
4245
4243
  /* @__PURE__ */ s(ft, { children: P ? /* @__PURE__ */ s(A, { type: "submit", disabled: me, children: ee ? e.edit ? re.UPDATING : re.ADDING : e.edit ? re.UPDATE : re.ADD_NEW_LANGUAGE }) : d && /* @__PURE__ */ s(Qn, { variant: "destructive", children: /* @__PURE__ */ o("p", { className: "mx-auto w-5/6 text-center", children: [
4246
4244
  "You need to create the ",
4247
- /* @__PURE__ */ s("span", { className: "font-medium", children: We[d] }),
4245
+ /* @__PURE__ */ s("span", { className: "font-medium", children: He[d] }),
4248
4246
  " page in the parent to add here."
4249
4247
  ] }) }) })
4250
4248
  ] })
4251
4249
  ] }) });
4252
4250
  }, nd = () => {
4253
- const [, e] = nt(Ra), { selectedLang: t, fallbackLang: n, setSelectedLang: a } = ze(), { data: r, isFetching: i } = wt(), { data: l } = Ue(), { data: c } = je(), d = Y(() => {
4251
+ const [, e] = nt(Ra), { selectedLang: t, fallbackLang: n, setSelectedLang: a } = qe(), { data: r, isFetching: i } = wt(), { data: l } = Ue(), { data: c } = Fe(), d = Y(() => {
4254
4252
  const N = c == null ? void 0 : c.find((T) => T.key === (l == null ? void 0 : l.pageType));
4255
4253
  return N == null ? void 0 : N.dynamicSlug;
4256
- }, [c, l == null ? void 0 : l.pageType]), [u, h] = E(null), [m, w] = E(null), [p, g] = E(null), { data: b } = Tt(), y = Le(
4254
+ }, [c, l == null ? void 0 : l.pageType]), [u, h] = E(null), [m, w] = E(null), [y, g] = E(null), { data: b } = Tt(), p = Le(
4257
4255
  V(b, "languages") || ["en"],
4258
4256
  (N) => !be(r, { lang: N }) && N !== V(b, "fallbackLang")
4259
4257
  );
@@ -4262,7 +4260,7 @@ const zc = () => {
4262
4260
  /* @__PURE__ */ s("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
4263
4261
  /* @__PURE__ */ s("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" }),
4264
4262
  /* @__PURE__ */ s("div", { className: "h-8 w-full animate-pulse rounded bg-gray-300" })
4265
- ] }) : tt(r, (N) => {
4263
+ ] }) : et(r, (N) => {
4266
4264
  const T = N.lang, O = N.slug, x = !N.primaryPage;
4267
4265
  return /* @__PURE__ */ o(ve, { children: [
4268
4266
  /* @__PURE__ */ o(
@@ -4274,7 +4272,7 @@ const zc = () => {
4274
4272
  /* @__PURE__ */ o("div", { className: "flex-1 gap-x-3", children: [
4275
4273
  /* @__PURE__ */ o("div", { className: "flex items-center gap-x-2 text-[13px] text-slate-800", children: [
4276
4274
  /* @__PURE__ */ s("div", { className: `h-2.5 w-2.5 rounded-full ${N.online ? "bg-green-300" : "bg-gray-300"}` }),
4277
- V(We, x ? n : T, T)
4275
+ V(He, x ? n : T, T)
4278
4276
  ] }),
4279
4277
  /* @__PURE__ */ o("div", { children: [
4280
4278
  O && /* @__PURE__ */ o("div", { className: "text-[11px] font-light text-slate-600", children: [
@@ -4306,7 +4304,7 @@ const zc = () => {
4306
4304
  /* @__PURE__ */ s(gn, { asChild: !0, onClick: (G) => G.stopPropagation(), children: /* @__PURE__ */ s(A, { variant: "ghost", size: "sm", className: "h-8 w-8 p-0", children: /* @__PURE__ */ s(Os, { className: "h-4 w-4" }) }) }),
4307
4305
  /* @__PURE__ */ o(pn, { align: "end", className: "z-[9999] text-sm", children: [
4308
4306
  /* @__PURE__ */ s(at, { permissions: [Te.EDIT_PAGE], children: /* @__PURE__ */ o(
4309
- Me,
4307
+ Be,
4310
4308
  {
4311
4309
  className: "flex cursor-pointer items-center gap-2",
4312
4310
  onClick: (G) => {
@@ -4319,7 +4317,7 @@ const zc = () => {
4319
4317
  }
4320
4318
  ) }),
4321
4319
  /* @__PURE__ */ s(at, { permissions: [Te.UNPUBLISH_PAGE], children: (N == null ? void 0 : N.online) && /* @__PURE__ */ o(
4322
- Me,
4320
+ Be,
4323
4321
  {
4324
4322
  className: "flex cursor-pointer items-center gap-2",
4325
4323
  onClick: (G) => {
@@ -4332,7 +4330,7 @@ const zc = () => {
4332
4330
  }
4333
4331
  ) }),
4334
4332
  /* @__PURE__ */ s(at, { permissions: [Te.DELETE_PAGE], children: /* @__PURE__ */ o(
4335
- Me,
4333
+ Be,
4336
4334
  {
4337
4335
  className: "flex cursor-pointer items-center gap-2",
4338
4336
  onClick: (G) => {
@@ -4360,7 +4358,7 @@ const zc = () => {
4360
4358
  {
4361
4359
  variant: "default",
4362
4360
  size: "sm",
4363
- disabled: Q(y),
4361
+ disabled: Q(p),
4364
4362
  onClick: () => {
4365
4363
  e({
4366
4364
  name: l == null ? void 0 : l.name,
@@ -4375,13 +4373,13 @@ const zc = () => {
4375
4373
  ) }) }),
4376
4374
  u && /* @__PURE__ */ s(Oa, { page: u, onClose: () => h(null) }),
4377
4375
  m && /* @__PURE__ */ s(Fs, { page: m, onClose: () => w(null) }),
4378
- p && /* @__PURE__ */ s(ed, { page: p, onClose: () => g(null) })
4376
+ y && /* @__PURE__ */ s(ed, { page: y, onClose: () => g(null) })
4379
4377
  ] });
4380
4378
  }, sd = () => {
4381
4379
  const e = bt("logo", null);
4382
4380
  return e ? /* @__PURE__ */ s("div", { className: "max-h-9 w-full overflow-hidden pr-2", children: Es.createElement(e, {}) }) : null;
4383
4381
  }, ad = () => {
4384
- const [e] = Ve(), t = e.get("page"), { data: n, isFetching: a } = Ue(), [r, i] = E(!1), { savePage: l } = Wn(), c = !!t && !Q(n), d = !t || !a && Q(n) || r;
4382
+ const [e] = ze(), t = e.get("page"), { data: n, isFetching: a } = Ue(), [r, i] = E(!1), { savePage: l } = Wn(), c = !!t && !Q(n), d = !t || !a && Q(n) || r;
4385
4383
  return /* @__PURE__ */ o(ve, { children: [
4386
4384
  /* @__PURE__ */ s("div", { className: "flex items-center gap-x-1", children: /* @__PURE__ */ s("div", { className: "relative", children: /* @__PURE__ */ o(ct, { children: [
4387
4385
  /* @__PURE__ */ s(dt, { asChild: !0, children: /* @__PURE__ */ s(
@@ -4424,18 +4422,18 @@ const zc = () => {
4424
4422
  showAdd: e = !0,
4425
4423
  variant: t = "ghost"
4426
4424
  }) => {
4427
- const { fallbackLang: n, languages: a, selectedLang: r, setSelectedLang: i } = ze(), l = Q(r) ? n : r, [, c] = Ve();
4425
+ const { fallbackLang: n, languages: a, selectedLang: r, setSelectedLang: i } = qe(), l = Q(r) ? n : r, [, c] = ze();
4428
4426
  de(() => {
4429
- const b = new URLSearchParams(window.location.search), y = b.get("lang");
4430
- y && (a.includes(y) ? i(y) : (b.delete("lang"), c(b), i("")));
4427
+ const b = new URLSearchParams(window.location.search), p = b.get("lang");
4428
+ p && (a.includes(p) ? i(p) : (b.delete("lang"), c(b), i("")));
4431
4429
  }, [a, c, i]);
4432
- const [, d] = nt(Ra), { data: u } = Ue(), { data: h } = Tt(), { data: m, isFetching: w } = wt(), p = Y(() => {
4430
+ const [, d] = nt(Ra), { data: u } = Ue(), { data: h } = Tt(), { data: m, isFetching: w } = wt(), y = Y(() => {
4433
4431
  const b = xs(
4434
- tt(V(h, "languages"), (y) => {
4435
- const N = be(m, { lang: y });
4432
+ et(V(h, "languages"), (p) => {
4433
+ const N = be(m, { lang: p });
4436
4434
  return {
4437
- key: y,
4438
- value: V(We, y, y),
4435
+ key: p,
4436
+ value: V(He, p, p),
4439
4437
  isLangPageAdded: !!N
4440
4438
  };
4441
4439
  })
@@ -4443,29 +4441,29 @@ const zc = () => {
4443
4441
  return [
4444
4442
  {
4445
4443
  key: n,
4446
- value: V(We, n),
4444
+ value: V(He, n),
4447
4445
  isLangPageAdded: !0
4448
4446
  },
4449
4447
  ...b
4450
4448
  ];
4451
4449
  }, [n, m, h]), g = (b) => {
4452
4450
  i(b);
4453
- const y = new URLSearchParams(window.location.search);
4454
- b === n ? y.delete("lang") : y.set("lang", b);
4455
- const N = y.toString(), T = `${window.location.pathname}${N ? `?${N}` : ""}`;
4456
- window.history.pushState({}, "", T), c(y), window.dispatchEvent(new PopStateEvent("popstate"));
4451
+ const p = new URLSearchParams(window.location.search);
4452
+ b === n ? p.delete("lang") : p.set("lang", b);
4453
+ const N = p.toString(), T = `${window.location.pathname}${N ? `?${N}` : ""}`;
4454
+ window.history.pushState({}, "", T), c(p), window.dispatchEvent(new PopStateEvent("popstate"));
4457
4455
  };
4458
4456
  return Q(a) || w ? null : /* @__PURE__ */ s(ve, { children: /* @__PURE__ */ o(fn, { children: [
4459
4457
  /* @__PURE__ */ s(gn, { asChild: !0, className: "focus:outline-none", children: /* @__PURE__ */ o(A, { variant: t, size: "sm", className: "ml-px h-max gap-2 py-1.5", children: [
4460
4458
  /* @__PURE__ */ s(wo, { className: "h-4 w-4" }),
4461
- V(We, l, l),
4459
+ V(He, l, l),
4462
4460
  /* @__PURE__ */ s(Bt, { className: "h-4 w-4" })
4463
4461
  ] }) }),
4464
4462
  /* @__PURE__ */ o(pn, { className: "space-y-1 border-border", children: [
4465
- tt(
4466
- p.filter((b) => b.isLangPageAdded),
4463
+ et(
4464
+ y.filter((b) => b.isLangPageAdded),
4467
4465
  (b) => /* @__PURE__ */ o(
4468
- Me,
4466
+ Be,
4469
4467
  {
4470
4468
  className: Na(
4471
4469
  "flex cursor-pointer items-center justify-between text-xs font-medium text-gray-800",
@@ -4483,7 +4481,7 @@ const zc = () => {
4483
4481
  b.value
4484
4482
  )
4485
4483
  ),
4486
- e && !Q(p.filter((b) => !b.isLangPageAdded)) && /* @__PURE__ */ o(ve, { children: [
4484
+ e && !Q(y.filter((b) => !b.isLangPageAdded)) && /* @__PURE__ */ o(ve, { children: [
4487
4485
  /* @__PURE__ */ s(Yl, {}),
4488
4486
  /* @__PURE__ */ o(
4489
4487
  A,
@@ -4618,7 +4616,7 @@ function cd({ compare: e, setCompare: t, isComparisonEnabled: n }) {
4618
4616
  }
4619
4617
  function dd() {
4620
4618
  var z, X;
4621
- const [e, t] = Pe.useState([]), [n, a] = Pe.useState(!1), [r, i] = Pe.useState(null), [l, c] = Pe.useState(!1), [d, u] = Pe.useState(!1), { data: h } = Ue(), { data: m, isFetching: w, error: p, refetch: g } = id(h == null ? void 0 : h.id), { mutate: b, isPending: y } = ld(), { mutate: N, isPending: T } = od(), O = ke(), x = si(), _ = mt("enable-page-revisions-compare"), { selectedLang: G, fallbackLang: W } = ze(), F = G || W;
4619
+ const [e, t] = Pe.useState([]), [n, a] = Pe.useState(!1), [r, i] = Pe.useState(null), [l, c] = Pe.useState(!1), [d, u] = Pe.useState(!1), { data: h } = Ue(), { data: m, isFetching: w, error: y, refetch: g } = id(h == null ? void 0 : h.id), { mutate: b, isPending: p } = ld(), { mutate: N, isPending: T } = od(), O = ke(), x = si(), _ = mt("enable-page-revisions-compare"), { selectedLang: G, fallbackLang: W } = qe(), F = G || W;
4622
4620
  de(() => t([]), [h == null ? void 0 : h.id]);
4623
4621
  const te = (P) => {
4624
4622
  r && N(
@@ -4666,7 +4664,7 @@ function dd() {
4666
4664
  Is(new Date(h.createdAt), "MMM d, yyyy 'at' h:mm a")
4667
4665
  ] })
4668
4666
  ] }),
4669
- w ? /* @__PURE__ */ s(ud, {}) : p ? /* @__PURE__ */ s("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "Failed to load revisions. Please try again." }) : /* @__PURE__ */ o("div", { className: "mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2", children: [
4667
+ w ? /* @__PURE__ */ s(ud, {}) : y ? /* @__PURE__ */ s("div", { className: "p-4 text-center text-sm text-muted-foreground", children: "Failed to load revisions. Please try again." }) : /* @__PURE__ */ o("div", { className: "mt-2 flex h-full min-h-0 flex-1 flex-col space-y-2", children: [
4670
4668
  _ && /* @__PURE__ */ s(md, { lang: F, compare: e, setCompare: t }),
4671
4669
  /* @__PURE__ */ s(
4672
4670
  cd,
@@ -4732,7 +4730,7 @@ function dd() {
4732
4730
  onOpenChange: u,
4733
4731
  revision: r,
4734
4732
  onDelete: ee,
4735
- isDeleting: y
4733
+ isDeleting: p
4736
4734
  }
4737
4735
  )
4738
4736
  ] });
@@ -4760,10 +4758,10 @@ function Qa({
4760
4758
  isComparisonEnabled: u,
4761
4759
  lang: h
4762
4760
  }) {
4763
- const { data: m } = $t(e.currentEditor), w = (m == null ? void 0 : m.name) || "Unknown", p = !!i.find((b) => {
4764
- var y;
4765
- return t ? (y = b == null ? void 0 : b.uid) == null ? void 0 : y.startsWith("live") : (b == null ? void 0 : b.uid) === e.uid;
4766
- }), g = i.length >= 2 && !p;
4761
+ const { data: m } = $t(e.currentEditor), w = (m == null ? void 0 : m.name) || "Unknown", y = !!i.find((b) => {
4762
+ var p;
4763
+ return t ? (p = b == null ? void 0 : b.uid) == null ? void 0 : p.startsWith("live") : (b == null ? void 0 : b.uid) === e.uid;
4764
+ }), g = i.length >= 2 && !y;
4767
4765
  return /* @__PURE__ */ o("div", { className: "relative flex items-start gap-3 rounded-md border p-2 hover:bg-accent/50", children: [
4768
4766
  /* @__PURE__ */ o("div", { className: "flex-1 space-y-3", children: [
4769
4767
  /* @__PURE__ */ s("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ o("p", { className: "flex items-center gap-1 text-xs leading-none", children: [
@@ -4795,11 +4793,11 @@ function Qa({
4795
4793
  u && /* @__PURE__ */ s(
4796
4794
  wi,
4797
4795
  {
4798
- checked: p,
4796
+ checked: y,
4799
4797
  disabled: g,
4800
4798
  onChange: () => {
4801
4799
  l(
4802
- p ? i.filter((b) => t ? b.uid !== `live:${c}` : b.uid !== e.uid) : [
4800
+ y ? i.filter((b) => t ? b.uid !== `live:${c}` : b.uid !== e.uid) : [
4803
4801
  ...i,
4804
4802
  { uid: t ? `live:${c}` : e.uid, label: t ? "live" : `#${r}` }
4805
4803
  ]
@@ -4884,13 +4882,13 @@ function fd({ revision: e, onRestore: t, onDelete: n }) {
4884
4882
  /* @__PURE__ */ s("span", { className: "sr-only", children: "More options" })
4885
4883
  ] }) }),
4886
4884
  /* @__PURE__ */ o(pn, { align: "end", className: "text-xs", children: [
4887
- /* @__PURE__ */ s(at, { permission: Te.RESTORE_REVISION, children: /* @__PURE__ */ o(Me, { onClick: t, className: "cursor-pointer text-sm", children: [
4885
+ /* @__PURE__ */ s(at, { permission: Te.RESTORE_REVISION, children: /* @__PURE__ */ o(Be, { onClick: t, className: "cursor-pointer text-sm", children: [
4888
4886
  /* @__PURE__ */ s(jr, { className: "mr-2 h-4 w-4" }),
4889
4887
  /* @__PURE__ */ s("span", { children: "Restore this version" })
4890
4888
  ] }) }),
4891
4889
  /* @__PURE__ */ s(at, { permission: Te.DELETE_REVISION, children: e.uid !== "current" && /* @__PURE__ */ o(ve, { children: [
4892
4890
  /* @__PURE__ */ s(eo, {}),
4893
- /* @__PURE__ */ o(Me, { onClick: n, className: "cursor-pointer text-destructive", children: [
4891
+ /* @__PURE__ */ o(Be, { onClick: n, className: "cursor-pointer text-destructive", children: [
4894
4892
  /* @__PURE__ */ s(Ea, { className: "mr-2 h-4 w-4" }),
4895
4893
  /* @__PURE__ */ s("span", { children: "Delete this version" })
4896
4894
  ] })
@@ -4907,15 +4905,15 @@ function gd({
4907
4905
  }) {
4908
4906
  const { data: i } = $t((n == null ? void 0 : n.currentEditor) || ""), l = (i == null ? void 0 : i.name) || "Unknown";
4909
4907
  return n ? /* @__PURE__ */ s(
4910
- Je,
4908
+ Ye,
4911
4909
  {
4912
4910
  open: e,
4913
4911
  onOpenChange: (c) => {
4914
4912
  r || t(c);
4915
4913
  },
4916
- children: /* @__PURE__ */ o(Xe, { className: "sm:max-w-md", children: [
4917
- /* @__PURE__ */ o(Ze, { children: [
4918
- /* @__PURE__ */ s(et, { children: "Restore Revision" }),
4914
+ children: /* @__PURE__ */ o(Je, { className: "sm:max-w-md", children: [
4915
+ /* @__PURE__ */ o(Xe, { children: [
4916
+ /* @__PURE__ */ s(Ze, { children: "Restore Revision" }),
4919
4917
  /* @__PURE__ */ o(rt, { children: [
4920
4918
  "You are about to restore to revision ",
4921
4919
  n.uid.substring(0, 8),
@@ -4956,15 +4954,15 @@ function pd({
4956
4954
  }) {
4957
4955
  const { data: i } = $t((n == null ? void 0 : n.currentEditor) || ""), l = (i == null ? void 0 : i.name) || "Unknown";
4958
4956
  return n ? /* @__PURE__ */ s(
4959
- Je,
4957
+ Ye,
4960
4958
  {
4961
4959
  open: e,
4962
4960
  onOpenChange: (c) => {
4963
4961
  r || t(c);
4964
4962
  },
4965
- children: /* @__PURE__ */ o(Xe, { className: "sm:max-w-md", children: [
4966
- /* @__PURE__ */ o(Ze, { children: [
4967
- /* @__PURE__ */ s(et, { children: "Delete Revision" }),
4963
+ children: /* @__PURE__ */ o(Je, { className: "sm:max-w-md", children: [
4964
+ /* @__PURE__ */ o(Xe, { children: [
4965
+ /* @__PURE__ */ s(Ze, { children: "Delete Revision" }),
4968
4966
  /* @__PURE__ */ o(rt, { children: [
4969
4967
  "You are about to delete revision ",
4970
4968
  n.uid.substring(0, 8),
@@ -5004,7 +5002,7 @@ function bd({
5004
5002
  showModal: e = !1,
5005
5003
  onClose: t = () => console.log("Cancelled")
5006
5004
  }) {
5007
- const [n, a] = E([]), { data: r, isFetching: i } = yd(), { data: l } = je(), c = ie(
5005
+ const [n, a] = E([]), { data: r, isFetching: i } = yd(), { data: l } = Fe(), c = ie(
5008
5006
  (x) => {
5009
5007
  var _;
5010
5008
  return (_ = be(l, { key: x })) == null ? void 0 : _.hasSlug;
@@ -5024,17 +5022,17 @@ function bd({
5024
5022
  ), m = Y(
5025
5023
  () => be(r, { pageType: "theme", id: "THEME" }),
5026
5024
  [r]
5027
- ), { mutate: w, isPending: p } = _a();
5025
+ ), { mutate: w, isPending: y } = _a();
5028
5026
  de(() => {
5029
- const x = tt(Le(r, { online: !0 }), "id");
5027
+ const x = et(Le(r, { online: !0 }), "id");
5030
5028
  m && x.push(m == null ? void 0 : m.id), a(x);
5031
5029
  }, [r, m]);
5032
5030
  const g = n.length === (r == null ? void 0 : r.length), b = (x) => {
5033
5031
  a(
5034
5032
  (_) => Et(_, x) ? Le(_, (G) => G !== x) : bl(_, x)
5035
5033
  );
5036
- }, y = () => {
5037
- a(g ? [] : tt(r, "id"));
5034
+ }, p = () => {
5035
+ a(g ? [] : et(r, "id"));
5038
5036
  }, N = () => {
5039
5037
  w(
5040
5038
  { ids: fr(n) },
@@ -5060,10 +5058,10 @@ function bd({
5060
5058
  ], G = m ? [{ label: "Theme", top: "pt-6" }, m] : [];
5061
5059
  return [...x, ...G, ..._];
5062
5060
  }, [u, h, m]);
5063
- return /* @__PURE__ */ s(Je, { open: e, onOpenChange: p ? () => {
5064
- } : t, children: /* @__PURE__ */ o(Xe, { className: "max-w-4xl max-h-[80%] flex flex-col", children: [
5065
- /* @__PURE__ */ o(Ze, { children: [
5066
- /* @__PURE__ */ s(et, { children: "Publish changes" }),
5061
+ return /* @__PURE__ */ s(Ye, { open: e, onOpenChange: y ? () => {
5062
+ } : t, children: /* @__PURE__ */ o(Je, { className: "max-w-4xl max-h-[80%] flex flex-col", children: [
5063
+ /* @__PURE__ */ o(Xe, { children: [
5064
+ /* @__PURE__ */ s(Ze, { children: "Publish changes" }),
5067
5065
  /* @__PURE__ */ s(rt, { className: "text-xs", children: "Select the pages you want to publish. Click publish when you're done." })
5068
5066
  ] }),
5069
5067
  /* @__PURE__ */ s("div", { className: "relative h-full max-h-full -mx-4 overflow-y-auto no-scrollbar", children: i ? /* @__PURE__ */ o("div", { className: "px-1 space-y-2", children: [
@@ -5084,7 +5082,7 @@ function bd({
5084
5082
  {
5085
5083
  checked: g,
5086
5084
  onClick: (x) => {
5087
- x.stopPropagation(), y();
5085
+ x.stopPropagation(), p();
5088
5086
  },
5089
5087
  type: "checkbox",
5090
5088
  className: "mt-1 rounded cursor-pointer focus:outline-none focus:ring-0"
@@ -5098,7 +5096,7 @@ function bd({
5098
5096
  /* @__PURE__ */ s("th", { scope: "col", className: "px-2 py-3 w-[100px]", children: "Type" }),
5099
5097
  /* @__PURE__ */ s("th", { scope: "col", className: "px-4 py-3 w-[150px] text-right", children: "Status" })
5100
5098
  ] }) }),
5101
- /* @__PURE__ */ s("tbody", { children: tt(
5099
+ /* @__PURE__ */ s("tbody", { children: et(
5102
5100
  O,
5103
5101
  (x) => x.label ? /* @__PURE__ */ s("tr", { children: /* @__PURE__ */ o(
5104
5102
  "td",
@@ -5166,13 +5164,13 @@ function bd({
5166
5164
  ) })
5167
5165
  ] }) }),
5168
5166
  /* @__PURE__ */ o(ft, { className: "mt-10", children: [
5169
- /* @__PURE__ */ s(A, { disabled: p, variant: "outline", onClick: t, children: "Cancel" }),
5167
+ /* @__PURE__ */ s(A, { disabled: y, variant: "outline", onClick: t, children: "Cancel" }),
5170
5168
  /* @__PURE__ */ s(
5171
5169
  A,
5172
5170
  {
5173
- disabled: p || i || Q(r),
5171
+ disabled: y || i || Q(r),
5174
5172
  onClick: N,
5175
- children: p ? "Publishing..." : "Publish"
5173
+ children: y ? "Publishing..." : "Publish"
5176
5174
  }
5177
5175
  )
5178
5176
  ] })
@@ -5191,8 +5189,8 @@ const wd = () => {
5191
5189
  };
5192
5190
  function Nd({ onClose: e }) {
5193
5191
  const { data: t, isFetching: n } = wd(), { mutateAsync: a, isPending: r } = Jo(), i = bt("settingComponent", null), l = wl(async (c) => (await a({ data: c }), !0), 300);
5194
- return i ? /* @__PURE__ */ s(Je, { open: !0, onOpenChange: e, children: /* @__PURE__ */ o(Xe, { className: "w-full", children: [
5195
- /* @__PURE__ */ s(Ze, { children: /* @__PURE__ */ s(et, { children: "Website Settings" }) }),
5192
+ return i ? /* @__PURE__ */ s(Ye, { open: !0, onOpenChange: e, children: /* @__PURE__ */ o(Je, { className: "w-full", children: [
5193
+ /* @__PURE__ */ s(Xe, { children: /* @__PURE__ */ s(Ze, { children: "Website Settings" }) }),
5196
5194
  n ? /* @__PURE__ */ o("div", { className: "w-full space-y-3 py-4", children: [
5197
5195
  /* @__PURE__ */ s("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
5198
5196
  /* @__PURE__ */ s("div", { className: "w-full h-8 rounded bg-gray-300 animate-pulse" }),
@@ -5219,7 +5217,7 @@ function Ni({
5219
5217
  ] }) });
5220
5218
  }
5221
5219
  const xd = () => {
5222
- const { selectedLang: e, fallbackLang: t } = ze(), n = bt("getPreviewUrl", async (m) => m), [a, r] = E(""), { data: i } = Ue(), { data: l } = wt(), { data: c } = je(), d = Y(
5220
+ const { selectedLang: e, fallbackLang: t } = qe(), n = bt("getPreviewUrl", async (m) => m), [a, r] = E(""), { data: i } = Ue(), { data: l } = wt(), { data: c } = Fe(), d = Y(
5223
5221
  () => {
5224
5222
  var m;
5225
5223
  return (m = l == null ? void 0 : l.find((w) => (w == null ? void 0 : w.lang) === e)) == null ? void 0 : m.slug;
@@ -5306,7 +5304,7 @@ const xd = () => {
5306
5304
  u
5307
5305
  ] });
5308
5306
  }, Ad = () => {
5309
- const { selectedLang: e } = ze(), { data: t } = yn(), { data: n } = wt(), [a, r] = E(!1), [i, l] = E(!1), [c, d] = E(null), { data: u } = Ue(), { mutate: h, isPending: m } = _a(), { buttonText: w, buttonClassName: p, isPublished: g } = Y(() => {
5307
+ const { selectedLang: e } = qe(), { data: t } = yn(), { data: n } = wt(), [a, r] = E(!1), [i, l] = E(!1), [c, d] = E(null), { data: u } = Ue(), { mutate: h, isPending: m } = _a(), { buttonText: w, buttonClassName: y, isPublished: g } = Y(() => {
5310
5308
  const N = u && (u == null ? void 0 : u.online);
5311
5309
  return {
5312
5310
  buttonClassName: N ? "hover:bg-green-600 bg-green-500" : "",
@@ -5316,7 +5314,7 @@ const xd = () => {
5316
5314
  }, [u]), b = async () => {
5317
5315
  const N = [t == null ? void 0 : t.id, t == null ? void 0 : t.primaryPage];
5318
5316
  h({ ids: xs(N) }, { onSuccess: () => En("TOP_RIGHT") });
5319
- }, y = Y(() => tt(n ?? [], "id"), [n]);
5317
+ }, p = Y(() => et(n ?? [], "id"), [n]);
5320
5318
  return /* @__PURE__ */ o(ve, { children: [
5321
5319
  /* @__PURE__ */ o("div", { className: "flex", children: [
5322
5320
  /* @__PURE__ */ o(
@@ -5325,7 +5323,7 @@ const xd = () => {
5325
5323
  size: "sm",
5326
5324
  onClick: b,
5327
5325
  disabled: m || !(u != null && u.id),
5328
- className: `relative flex items-center gap-1 overflow-hidden rounded-r-none text-white transition-all duration-300 ease-in-out ${p}`,
5326
+ className: `relative flex items-center gap-1 overflow-hidden rounded-r-none text-white transition-all duration-300 ease-in-out ${y}`,
5329
5327
  onMouseEnter: () => l(!0),
5330
5328
  onMouseLeave: () => l(!1),
5331
5329
  children: [
@@ -5354,17 +5352,17 @@ const xd = () => {
5354
5352
  {
5355
5353
  size: "sm",
5356
5354
  disabled: m || !(u != null && u.id),
5357
- className: `rounded-l-none border-l border-white/50 px-2 text-white ${p}`,
5355
+ className: `rounded-l-none border-l border-white/50 px-2 text-white ${y}`,
5358
5356
  children: /* @__PURE__ */ s(Bt, { className: "h-4 w-4" })
5359
5357
  }
5360
5358
  ) }),
5361
5359
  /* @__PURE__ */ o(pn, { align: "end", className: "w-52", children: [
5362
5360
  /* @__PURE__ */ o(
5363
- Me,
5361
+ Be,
5364
5362
  {
5365
5363
  disabled: m,
5366
5364
  className: "cursor-pointer text-xs",
5367
- onClick: () => h({ ids: y }, { onSuccess: () => En("TOP_RIGHT") }),
5365
+ onClick: () => h({ ids: p }, { onSuccess: () => En("TOP_RIGHT") }),
5368
5366
  children: [
5369
5367
  re.PUBLISH,
5370
5368
  " with translation pages"
@@ -5372,7 +5370,7 @@ const xd = () => {
5372
5370
  }
5373
5371
  ),
5374
5372
  !g && /* @__PURE__ */ o(
5375
- Me,
5373
+ Be,
5376
5374
  {
5377
5375
  disabled: m,
5378
5376
  className: "cursor-pointer text-xs",
@@ -5383,11 +5381,11 @@ const xd = () => {
5383
5381
  ]
5384
5382
  }
5385
5383
  ),
5386
- /* @__PURE__ */ o(Me, { onClick: () => r(!0), className: "cursor-pointer text-xs", children: [
5384
+ /* @__PURE__ */ o(Be, { onClick: () => r(!0), className: "cursor-pointer text-xs", children: [
5387
5385
  re.OPEN,
5388
5386
  " publish menu"
5389
5387
  ] }),
5390
- g && /* @__PURE__ */ o(Me, { onClick: () => d(t), className: "cursor-pointer text-xs", children: [
5388
+ g && /* @__PURE__ */ o(Be, { onClick: () => d(t), className: "cursor-pointer text-xs", children: [
5391
5389
  re.UNPUBLISH,
5392
5390
  " page ",
5393
5391
  e ? `(${ja(e)})` : ""
@@ -5407,7 +5405,7 @@ const xd = () => {
5407
5405
  ] }) : null;
5408
5406
  };
5409
5407
  function Cd() {
5410
- const { isLocked: e } = Xn(), [t] = Ve(), n = t.get("lang"), a = Zr(n);
5408
+ const { isLocked: e } = Xn(), [t] = ze(), n = t.get("lang"), a = Zr(n);
5411
5409
  return e || !a ? null : /* @__PURE__ */ o("div", { className: "flex items-center justify-end gap-1", children: [
5412
5410
  /* @__PURE__ */ s(dd, {}),
5413
5411
  /* @__PURE__ */ s(at, { permission: Te.EDIT_THEME, children: /* @__PURE__ */ s(Sd, {}) }),
@@ -5439,7 +5437,7 @@ const Pd = ({
5439
5437
  setSearchQuery: a,
5440
5438
  dynamicPages: r
5441
5439
  }) => {
5442
- const { selectedLang: i, fallbackLang: l } = ze(), c = (i == null ? void 0 : i.length) === 0;
5440
+ const { selectedLang: i, fallbackLang: l } = qe(), c = (i == null ? void 0 : i.length) === 0;
5443
5441
  return /* @__PURE__ */ o(fn, { children: [
5444
5442
  /* @__PURE__ */ s(gn, { asChild: !0, children: /* @__PURE__ */ o(
5445
5443
  A,
@@ -5455,7 +5453,7 @@ const Pd = ({
5455
5453
  /* @__PURE__ */ o(pn, { className: "w-96 divide-y shadow-xl p-0 max-h-[75vh]", children: [
5456
5454
  /* @__PURE__ */ s("div", { className: "p-1.5 bg-gray-50/30", children: /* @__PURE__ */ s(Pd, { isDefaultLang: c, searchQuery: n, setSearchQuery: a }) }),
5457
5455
  (r == null ? void 0 : r.length) === 0 ? /* @__PURE__ */ s("div", { className: "h-24 text-xs flex items-center justify-center", children: "No pages found" }) : r == null ? void 0 : r.map((d) => /* @__PURE__ */ s(
5458
- Me,
5456
+ Be,
5459
5457
  {
5460
5458
  onClick: () => t(d),
5461
5459
  disabled: c ? l !== d.lang : i !== d.lang,
@@ -5479,7 +5477,7 @@ const Pd = ({
5479
5477
  updateDynamicPage: i,
5480
5478
  updateSearchQuery: l,
5481
5479
  onChangeLanguage: c
5482
- } = ti(), d = Be(void 0);
5480
+ } = ti(), d = tt(void 0);
5483
5481
  return de(() => {
5484
5482
  d.current !== a && e && (c(), d.current = a);
5485
5483
  }, [a, t]), /* @__PURE__ */ s("div", { className: "relative", children: /* @__PURE__ */ s(
@@ -5493,10 +5491,10 @@ const Pd = ({
5493
5491
  }
5494
5492
  ) });
5495
5493
  }, Id = () => {
5496
- const [e, t] = E(null), [n, a] = E(null), [r, i] = E(null), [l, c] = E(null), [d, u] = E(null), [h, m] = E(null), { data: w, isFetching: p } = Ue();
5494
+ const [e, t] = E(null), [n, a] = E(null), [r, i] = E(null), [l, c] = E(null), [d, u] = E(null), [h, m] = E(null), { data: w, isFetching: y } = Ue();
5497
5495
  return w ? /* @__PURE__ */ o(ve, { children: [
5498
5496
  /* @__PURE__ */ o("div", { className: "flex items-center justify-center space-x-2 rounded pl-2 py-1 duration-100", children: [
5499
- /* @__PURE__ */ s("span", { className: "flex max-w-[200px] items-center truncate text-xs font-medium leading-tight", children: p ? /* @__PURE__ */ s(Ft, { className: " h-4 w-4 animate-spin text-slate-400" }) : V(w, "name") ?? "" }),
5497
+ /* @__PURE__ */ s("span", { className: "flex max-w-[200px] items-center truncate text-xs font-medium leading-tight", children: y ? /* @__PURE__ */ s(Ft, { className: " h-4 w-4 animate-spin text-slate-400" }) : V(w, "name") ?? "" }),
5500
5498
  /* @__PURE__ */ s(
5501
5499
  mi,
5502
5500
  {
@@ -5531,7 +5529,7 @@ const Pd = ({
5531
5529
  /* @__PURE__ */ s("h1", { className: "text-lg font-medium", children: e ? "Select a page" : "No pages found" }),
5532
5530
  /* @__PURE__ */ s("p", { className: "pt-4 text-center text-sm text-gray-600", children: e ? "Please select a page from the list in the top header. This will enable you to edit the page." : "Please add a new page" })
5533
5531
  ] }) }), Dd = () => {
5534
- const { data: e } = yn(), t = Ca(), { data: n, isFetching: a } = Ue(), r = V(n, "dynamic", !1), i = mt("dynamic-page-selector"), { dynamicPage: l, allLangPages: c } = ti(), d = c.length > 0, u = e == null ? void 0 : e.slug, h = !u, m = si(), p = (h ? `Partial: ${e == null ? void 0 : e.name} ` : `${u}${t}`).replace(window.location.host, "");
5532
+ const { data: e } = yn(), t = Ca(), { data: n, isFetching: a } = Ue(), r = V(n, "dynamic", !1), i = mt("dynamic-page-selector"), { dynamicPage: l, allLangPages: c } = ti(), d = c.length > 0, u = e == null ? void 0 : e.slug, h = !u, m = si(), y = (h ? `Partial: ${e == null ? void 0 : e.name} ` : `${u}${t}`).replace(window.location.host, "");
5535
5533
  return /* @__PURE__ */ o("div", { className: "relative z-10 flex items-center gap-x-1", children: [
5536
5534
  !a && /* @__PURE__ */ s(
5537
5535
  "div",
@@ -5551,10 +5549,10 @@ const Pd = ({
5551
5549
  "div",
5552
5550
  {
5553
5551
  className: `w-full max-w-[200px] overflow-hidden overflow-ellipsis whitespace-nowrap pl-1 text-xs ${h ? "italic text-gray-400" : "font-mono text-gray-500"}`,
5554
- children: p === "/" ? /* @__PURE__ */ o("span", { className: "text-gray-900", children: [
5552
+ children: y === "/" ? /* @__PURE__ */ o("span", { className: "text-gray-900", children: [
5555
5553
  "/",
5556
5554
  /* @__PURE__ */ s("span", { className: "text-[11px] font-light italic text-gray-400", children: "(Homepage)" })
5557
- ] }) : p
5555
+ ] }) : y
5558
5556
  }
5559
5557
  ),
5560
5558
  !h && /* @__PURE__ */ s("a", { href: m, target: "_blank", rel: "noopener noreferrer", children: /* @__PURE__ */ s("div", { className: "ml-2 mr-px flex-shrink-0 rounded-sm p-1.5 text-gray-500 hover:bg-gray-100 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-300", children: /* @__PURE__ */ s(na, { className: "h-4 w-4", strokeWidth: 1 }) }) })
@@ -5717,12 +5715,12 @@ const Pd = ({
5717
5715
  email: us.string().email({ message: "Please enter a valid email address" }),
5718
5716
  password: us.string().min(6, { message: "Password must be at least 6 characters" })
5719
5717
  }), $d = () => {
5720
- const { setUser: e, logout: t } = it(), n = Us(), [a, r] = E(""), [i, l] = E(""), [c, d] = E({}), [u, h] = E(!1), [m, w] = E(""), p = Ie({
5721
- mutationFn: async (y) => {
5718
+ const { setUser: e, logout: t } = it(), n = Us(), [a, r] = E(""), [i, l] = E(""), [c, d] = E({}), [u, h] = E(!1), [m, w] = E(""), y = Ie({
5719
+ mutationFn: async (p) => {
5722
5720
  w("");
5723
5721
  const N = await Rs(n, {
5724
5722
  action: "LOGIN",
5725
- data: y
5723
+ data: p
5726
5724
  });
5727
5725
  if (!N.ok) {
5728
5726
  const O = await N.json();
@@ -5738,18 +5736,18 @@ const Pd = ({
5738
5736
  onSuccess: () => {
5739
5737
  d({}), w("");
5740
5738
  },
5741
- onError: (y) => {
5739
+ onError: (p) => {
5742
5740
  d({
5743
5741
  email: " ",
5744
5742
  password: " "
5745
- }), w(y.message || "Something went wrong");
5743
+ }), w(p.message || "Something went wrong");
5746
5744
  }
5747
- }), g = async (y) => {
5748
- y.preventDefault(), d({});
5745
+ }), g = async (p) => {
5746
+ p.preventDefault(), d({});
5749
5747
  const N = { email: a, password: i };
5750
5748
  try {
5751
5749
  const T = Ja.parse(N);
5752
- p.mutate(T);
5750
+ y.mutate(T);
5753
5751
  } catch (T) {
5754
5752
  if (T instanceof us.ZodError) {
5755
5753
  const O = T.errors.reduce((x, _) => {
@@ -5775,7 +5773,7 @@ const Pd = ({
5775
5773
  placeholder: "you@example.com",
5776
5774
  type: "email",
5777
5775
  value: a,
5778
- onChange: (y) => r(y.target.value),
5776
+ onChange: (p) => r(p.target.value),
5779
5777
  className: c.email ? "border-destructive" : ""
5780
5778
  }
5781
5779
  ),
@@ -5791,7 +5789,7 @@ const Pd = ({
5791
5789
  placeholder: "Enter your password",
5792
5790
  type: u ? "text" : "password",
5793
5791
  value: i,
5794
- onChange: (y) => l(y.target.value),
5792
+ onChange: (p) => l(p.target.value),
5795
5793
  className: c.password ? "border-destructive" : ""
5796
5794
  }
5797
5795
  ),
@@ -5813,8 +5811,8 @@ const Pd = ({
5813
5811
  {
5814
5812
  type: "submit",
5815
5813
  className: "w-full",
5816
- disabled: !b || p.isPending,
5817
- children: p.isPending ? /* @__PURE__ */ o(ve, { children: [
5814
+ disabled: !b || y.isPending,
5815
+ children: y.isPending ? /* @__PURE__ */ o(ve, { children: [
5818
5816
  /* @__PURE__ */ s(Aa, { className: "mr-2 h-4 w-4 animate-spin" }),
5819
5817
  "Logging in..."
5820
5818
  ] }) : "Login"
@@ -5896,16 +5894,16 @@ function kt({
5896
5894
  }, [e, r]);
5897
5895
  const h = (g) => Array.isArray(g) ? "array" : typeof g == "object" && g !== null ? "object" : "value", m = Pe.useCallback(
5898
5896
  (g) => {
5899
- const b = (y) => n === "value" ? y === "value" || y === "object" : n === "array" ? y === "array" : y === n;
5900
- g.type === "object" ? (c((y) => [...y, g.key]), u(g.value)) : b(g.type) && (t([...l, g.key].join(".")), i(!1));
5897
+ const b = (p) => n === "value" ? p === "value" || p === "object" : n === "array" ? p === "array" : p === n;
5898
+ g.type === "object" ? (c((p) => [...p, g.key]), u(g.value)) : b(g.type) && (t([...l, g.key].join(".")), i(!1));
5901
5899
  },
5902
5900
  [l, t, n]
5903
5901
  ), w = Pe.useCallback(() => {
5904
5902
  if (l.length > 0) {
5905
5903
  const g = l.slice(0, -1);
5906
- c(g), u(g.reduce((b, y) => b[y], e));
5904
+ c(g), u(g.reduce((b, p) => b[p], e));
5907
5905
  }
5908
- }, [l, e]), p = Pe.useMemo(() => Object.entries(d).map(([g, b]) => ({
5906
+ }, [l, e]), y = Pe.useMemo(() => Object.entries(d).map(([g, b]) => ({
5909
5907
  key: g,
5910
5908
  value: b,
5911
5909
  type: h(b)
@@ -5954,7 +5952,7 @@ function kt({
5954
5952
  ]
5955
5953
  }
5956
5954
  ),
5957
- p.map((g) => /* @__PURE__ */ o(
5955
+ y.map((g) => /* @__PURE__ */ o(
5958
5956
  ot,
5959
5957
  {
5960
5958
  onSelect: () => m(g),
@@ -5988,7 +5986,7 @@ function kt({
5988
5986
  ] });
5989
5987
  }
5990
5988
  const Hd = () => {
5991
- const { selectedLang: e } = ze(), { data: t, isFetching: n } = wt();
5989
+ const { selectedLang: e } = qe(), { data: t, isFetching: n } = wt();
5992
5990
  return { data: Y(() => be(t, { lang: e || "" }) || {}, [t, e]), isFetching: n };
5993
5991
  }, Wd = () => {
5994
5992
  var l;
@@ -6014,7 +6012,7 @@ const Hd = () => {
6014
6012
  onComplete: t,
6015
6013
  field: n
6016
6014
  }) => {
6017
- const a = J(), r = le(), { selectedLang: i, fallbackLang: l } = ze(), c = Fl("aiContext", ""), { mutate: d, isPending: u } = Ie({
6015
+ const a = J(), r = le(), { selectedLang: i, fallbackLang: l } = qe(), c = Fl("aiContext", ""), { mutate: d, isPending: u } = Ie({
6018
6016
  mutationFn: async () => {
6019
6017
  const h = Wd();
6020
6018
  return await a(r, {
@@ -6110,7 +6108,7 @@ const Hd = () => {
6110
6108
  pageData: c = {},
6111
6109
  handleFieldInsert: d
6112
6110
  }) => {
6113
- const [u, h] = E("edit"), [m, w] = E(null), [p, g] = E(""), b = Be(null), y = (x) => {
6111
+ const [u, h] = E("edit"), [m, w] = E(null), [y, g] = E(""), b = tt(null), p = (x) => {
6114
6112
  if (a) return;
6115
6113
  const _ = x.target.value;
6116
6114
  t(_);
@@ -6212,7 +6210,7 @@ const Hd = () => {
6212
6210
  id: l,
6213
6211
  name: l,
6214
6212
  className: `rounded-md border border-input text-xs ${m ? "border-red-500" : ""}`,
6215
- onChange: y,
6213
+ onChange: p,
6216
6214
  onKeyDown: N,
6217
6215
  value: e,
6218
6216
  placeholder: r,
@@ -6247,7 +6245,7 @@ const Hd = () => {
6247
6245
  ] })
6248
6246
  ] }),
6249
6247
  /* @__PURE__ */ o(fs, { value: "preview", className: "mt-0", children: [
6250
- /* @__PURE__ */ s(un, { rows: i, value: p, readOnly: !0, className: "cursor-default bg-muted font-mono text-sm" }),
6248
+ /* @__PURE__ */ s(un, { rows: i, value: y, readOnly: !0, className: "cursor-default bg-muted font-mono text-sm" }),
6251
6249
  /* @__PURE__ */ s("p", { className: "mt-1 text-xs text-muted-foreground", children: "This is how the JSON will look after placeholder substitution." })
6252
6250
  ] })
6253
6251
  ] }) });
@@ -6266,7 +6264,7 @@ const Hd = () => {
6266
6264
  newCursorPos: u
6267
6265
  };
6268
6266
  }, Si = () => {
6269
- const { t: e } = jl(), [, t] = As(), { data: n } = Ue(), { data: a } = li(), { data: r, isFetching: i } = Hd(), l = r == null ? void 0 : r.seo, c = Be(null), d = n == null ? void 0 : n.pageType, u = oi(d), { selectedLang: h, fallbackLang: m } = ze(), w = h || m, [p, g] = E(!1), [b, y] = E(!1), [N, T] = E({
6267
+ const { t: e } = jl(), [, t] = As(), { data: n } = Ue(), { data: a } = li(), { data: r, isFetching: i } = Hd(), l = r == null ? void 0 : r.seo, c = tt(null), d = n == null ? void 0 : n.pageType, u = oi(d), { selectedLang: h, fallbackLang: m } = qe(), w = h || m, [y, g] = E(!1), [b, p] = E(!1), [N, T] = E({
6270
6268
  keyword: "",
6271
6269
  title: "",
6272
6270
  description: "",
@@ -6281,7 +6279,7 @@ const Hd = () => {
6281
6279
  searchDescription: "",
6282
6280
  jsonLD: "{}",
6283
6281
  ...l
6284
- }), O = Be({ initial: N, updated: N }), { mutate: x, isPending: _ } = ka(), G = _ || p || b, { hasPermission: W } = mn(), F = W(Te.EDIT_SEO);
6282
+ }), O = tt({ initial: N, updated: N }), { mutate: x, isPending: _ } = ka(), G = _ || y || b, { hasPermission: W } = mn(), F = W(Te.EDIT_SEO);
6285
6283
  de(() => {
6286
6284
  !i && l && T({
6287
6285
  title: "",
@@ -6323,7 +6321,7 @@ const Hd = () => {
6323
6321
  }, j = async () => {
6324
6322
  if (!(!u || !w))
6325
6323
  try {
6326
- y(!0);
6324
+ p(!0);
6327
6325
  const P = In(u, w), B = {
6328
6326
  ...N,
6329
6327
  jsonLD: V(P, "seo.jsonLD", "")
@@ -6332,7 +6330,7 @@ const Hd = () => {
6332
6330
  } catch (P) {
6333
6331
  K.error(e("Failed to reset JSON-LD")), console.error("Reset JSON-LD error:", P);
6334
6332
  } finally {
6335
- y(!1);
6333
+ p(!1);
6336
6334
  }
6337
6335
  }, q = async () => {
6338
6336
  x(
@@ -6414,7 +6412,7 @@ const Hd = () => {
6414
6412
  size: "sm",
6415
6413
  onClick: te,
6416
6414
  disabled: G || !F || !u,
6417
- children: e(p ? "Resetting..." : "Reset to Default")
6415
+ children: e(y ? "Resetting..." : "Reset to Default")
6418
6416
  }
6419
6417
  ) }),
6420
6418
  /* @__PURE__ */ o("div", { className: "space-y-1", children: [
@@ -6834,14 +6832,14 @@ var uu = (e, t) => e === t, ps = Symbol("solid-proxy"), Ai = typeof Proxy == "fu
6834
6832
  cleanups: null,
6835
6833
  context: null,
6836
6834
  owner: null
6837
- }, Js = {}, ge = null, Xs = null, hu = null, Ne = null, qe = null, yt = null, js = 0;
6835
+ }, Js = {}, ge = null, Xs = null, hu = null, Ne = null, $e = null, yt = null, js = 0;
6838
6836
  function Rt(e, t) {
6839
6837
  const n = Ne, a = ge, r = e.length === 0, i = t === void 0 ? a : t, l = r ? Pi : {
6840
6838
  owned: null,
6841
6839
  cleanups: null,
6842
6840
  context: i ? i.context : null,
6843
6841
  owner: i
6844
- }, c = r ? e : () => e(() => Fe(() => Dn(l)));
6842
+ }, c = r ? e : () => e(() => Me(() => Dn(l)));
6845
6843
  ge = l, Ne = null;
6846
6844
  try {
6847
6845
  return ht(c, !0);
@@ -6872,7 +6870,7 @@ function ki(e, t, n) {
6872
6870
  const a = $s(e, t, !1, Nt);
6873
6871
  (!n || !n.render) && (a.user = !0), yt ? yt.push(a) : vn(a);
6874
6872
  }
6875
- function Ye(e, t, n) {
6873
+ function Qe(e, t, n) {
6876
6874
  n = n ? Object.assign({}, ys, n) : ys;
6877
6875
  const a = $s(e, t, !0, 0);
6878
6876
  return a.observers = null, a.observerSlots = null, a.comparator = n.equals || void 0, vn(a), Ii.bind(a);
@@ -6883,8 +6881,8 @@ function fu(e) {
6883
6881
  function gu(e, t, n) {
6884
6882
  let a, r, i;
6885
6883
  arguments.length === 1 ? (a = !0, r = e, i = {}) : (a = e, r = t, i = {});
6886
- let l = null, c = Js, d = null, u = !1, h = "initialValue" in i, m = typeof a == "function" && Ye(a);
6887
- const w = /* @__PURE__ */ new Set(), [p, g] = (i.storage || Oe)(i.initialValue), [b, y] = Oe(void 0), [N, T] = Oe(void 0, {
6884
+ let l = null, c = Js, d = null, u = !1, h = "initialValue" in i, m = typeof a == "function" && Qe(a);
6885
+ const w = /* @__PURE__ */ new Set(), [y, g] = (i.storage || Oe)(i.initialValue), [b, p] = Oe(void 0), [N, T] = Oe(void 0, {
6888
6886
  equals: !1
6889
6887
  }), [O, x] = Oe(h ? "ready" : "unresolved");
6890
6888
  ae.context && (d = ae.getNextContextId(), i.ssrLoadFrom === "initial" ? c = i.initialValue : ae.load && ae.has(d) && (c = ae.load(d)));
@@ -6897,14 +6895,14 @@ function gu(e, t, n) {
6897
6895
  }
6898
6896
  function G(te, j) {
6899
6897
  ht(() => {
6900
- j === void 0 && g(() => te), x(j !== void 0 ? "errored" : h ? "ready" : "unresolved"), y(j);
6898
+ j === void 0 && g(() => te), x(j !== void 0 ? "errored" : h ? "ready" : "unresolved"), p(j);
6901
6899
  for (const q of w.keys())
6902
6900
  q.decrement();
6903
6901
  w.clear();
6904
6902
  }, !1);
6905
6903
  }
6906
6904
  function W() {
6907
- const te = wu, j = p(), q = b();
6905
+ const te = wu, j = y(), q = b();
6908
6906
  if (q !== void 0 && !l)
6909
6907
  throw q;
6910
6908
  return Ne && Ne.user, j;
@@ -6915,12 +6913,12 @@ function gu(e, t, n) {
6915
6913
  u = !1;
6916
6914
  const j = m ? m() : a;
6917
6915
  if (j == null || j === !1) {
6918
- _(l, Fe(p));
6916
+ _(l, Me(y));
6919
6917
  return;
6920
6918
  }
6921
- const q = c !== Js ? c : Fe(
6919
+ const q = c !== Js ? c : Me(
6922
6920
  () => r(j, {
6923
- value: p(),
6921
+ value: y(),
6924
6922
  refetching: te
6925
6923
  })
6926
6924
  );
@@ -6951,7 +6949,7 @@ function gu(e, t, n) {
6951
6949
  const te = b();
6952
6950
  if (te && !l)
6953
6951
  throw te;
6954
- return p();
6952
+ return y();
6955
6953
  }
6956
6954
  }
6957
6955
  }), m ? mu(() => F(!1)) : F(!1), [
@@ -6965,7 +6963,7 @@ function gu(e, t, n) {
6965
6963
  function Am(e) {
6966
6964
  return ht(e, !1);
6967
6965
  }
6968
- function Fe(e) {
6966
+ function Me(e) {
6969
6967
  if (Ne === null)
6970
6968
  return e();
6971
6969
  const t = Ne;
@@ -6989,12 +6987,12 @@ function Tm(e, t, n) {
6989
6987
  c = e();
6990
6988
  if (i)
6991
6989
  return i = !1, l;
6992
- const d = Fe(() => t(c, r, l));
6990
+ const d = Me(() => t(c, r, l));
6993
6991
  return r = c, d;
6994
6992
  };
6995
6993
  }
6996
6994
  function pu(e) {
6997
- ki(() => Fe(e));
6995
+ ki(() => Me(e));
6998
6996
  }
6999
6997
  function Ln(e) {
7000
6998
  return ge === null || (ge.cleanups === null ? ge.cleanups = [e] : ge.cleanups.push(e)), e;
@@ -7038,7 +7036,7 @@ function _m(e) {
7038
7036
  return ge && ge.context && (t = ge.context[e.id]) !== void 0 ? t : e.defaultValue;
7039
7037
  }
7040
7038
  function _i(e) {
7041
- const t = Ye(e), n = Ye(() => oa(t()));
7039
+ const t = Qe(e), n = Qe(() => oa(t()));
7042
7040
  return n.toArray = () => {
7043
7041
  const a = n();
7044
7042
  return Array.isArray(a) ? a : a != null ? [a] : [];
@@ -7050,8 +7048,8 @@ function Ii() {
7050
7048
  if (this.state === Nt)
7051
7049
  vn(this);
7052
7050
  else {
7053
- const e = qe;
7054
- qe = null, ht(() => ws(this), !1), qe = e;
7051
+ const e = $e;
7052
+ $e = null, ht(() => ws(this), !1), $e = e;
7055
7053
  }
7056
7054
  if (Ne) {
7057
7055
  const e = this.observers ? this.observers.length : 0;
@@ -7064,10 +7062,10 @@ function Li(e, t, n) {
7064
7062
  return (!e.comparator || !e.comparator(a, t)) && (e.value = t, e.observers && e.observers.length && ht(() => {
7065
7063
  for (let r = 0; r < e.observers.length; r += 1) {
7066
7064
  const i = e.observers[r], l = Xs && Xs.running;
7067
- l && Xs.disposed.has(i), (l ? !i.tState : !i.state) && (i.pure ? qe.push(i) : yt.push(i), i.observers && Oi(i)), l || (i.state = Nt);
7065
+ l && Xs.disposed.has(i), (l ? !i.tState : !i.state) && (i.pure ? $e.push(i) : yt.push(i), i.observers && Oi(i)), l || (i.state = Nt);
7068
7066
  }
7069
- if (qe.length > 1e6)
7070
- throw qe = [], new Error();
7067
+ if ($e.length > 1e6)
7068
+ throw $e = [], new Error();
7071
7069
  }, !1)), t;
7072
7070
  }
7073
7071
  function vn(e) {
@@ -7115,7 +7113,7 @@ function bs(e) {
7115
7113
  return;
7116
7114
  if (e.state === vs)
7117
7115
  return ws(e);
7118
- if (e.suspense && Fe(e.suspense.inFallback))
7116
+ if (e.suspense && Me(e.suspense.inFallback))
7119
7117
  return e.suspense.effects.push(e);
7120
7118
  const t = [e];
7121
7119
  for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < js); )
@@ -7124,24 +7122,24 @@ function bs(e) {
7124
7122
  if (e = t[n], e.state === Nt)
7125
7123
  vn(e);
7126
7124
  else if (e.state === vs) {
7127
- const a = qe;
7128
- qe = null, ht(() => ws(e, t[0]), !1), qe = a;
7125
+ const a = $e;
7126
+ $e = null, ht(() => ws(e, t[0]), !1), $e = a;
7129
7127
  }
7130
7128
  }
7131
7129
  function ht(e, t) {
7132
- if (qe)
7130
+ if ($e)
7133
7131
  return e();
7134
7132
  let n = !1;
7135
- t || (qe = []), yt ? n = !0 : yt = [], js++;
7133
+ t || ($e = []), yt ? n = !0 : yt = [], js++;
7136
7134
  try {
7137
7135
  const a = e();
7138
7136
  return xu(n), a;
7139
7137
  } catch (a) {
7140
- n || (yt = null), qe = null, Ua(a);
7138
+ n || (yt = null), $e = null, Ua(a);
7141
7139
  }
7142
7140
  }
7143
7141
  function xu(e) {
7144
- if (qe && (Di(qe), qe = null), e)
7142
+ if ($e && (Di($e), $e = null), e)
7145
7143
  return;
7146
7144
  const t = yt;
7147
7145
  yt = null, t.length && ht(() => Ci(t), !1);
@@ -7179,7 +7177,7 @@ function ws(e, t) {
7179
7177
  function Oi(e) {
7180
7178
  for (let t = 0; t < e.observers.length; t += 1) {
7181
7179
  const n = e.observers[t];
7182
- n.state || (n.state = vs, n.pure ? qe.push(n) : yt.push(n), n.observers && Oi(n));
7180
+ n.state || (n.state = vs, n.pure ? $e.push(n) : yt.push(n), n.observers && Oi(n));
7183
7181
  }
7184
7182
  }
7185
7183
  function Dn(e) {
@@ -7234,7 +7232,7 @@ function Eu(e, t) {
7234
7232
  return function(a) {
7235
7233
  let r;
7236
7234
  return Ut(
7237
- () => r = Fe(() => (ge.context = {
7235
+ () => r = Me(() => (ge.context = {
7238
7236
  ...ge.context,
7239
7237
  [e]: a.value
7240
7238
  }, _i(() => a.children))),
@@ -7251,8 +7249,8 @@ function Au(e, t, n = {}) {
7251
7249
  let a = [], r = [], i = [], l = 0, c = t.length > 1 ? [] : null;
7252
7250
  return Ln(() => Ns(i)), () => {
7253
7251
  let d = e() || [], u = d.length, h, m;
7254
- return d[Ti], Fe(() => {
7255
- let p, g, b, y, N, T, O, x, _;
7252
+ return d[Ti], Me(() => {
7253
+ let y, g, b, p, N, T, O, x, _;
7256
7254
  if (u === 0)
7257
7255
  l !== 0 && (Ns(i), i = [], a = [], r = [], l = 0, c && (c = [])), n.fallback && (a = [ca], r[0] = Rt((G) => (i[0] = G, n.fallback())), l = 1);
7258
7256
  else if (l === 0) {
@@ -7260,22 +7258,22 @@ function Au(e, t, n = {}) {
7260
7258
  a[m] = d[m], r[m] = Rt(w);
7261
7259
  l = u;
7262
7260
  } else {
7263
- for (b = new Array(u), y = new Array(u), c && (N = new Array(u)), T = 0, O = Math.min(l, u); T < O && a[T] === d[T]; T++)
7261
+ for (b = new Array(u), p = new Array(u), c && (N = new Array(u)), T = 0, O = Math.min(l, u); T < O && a[T] === d[T]; T++)
7264
7262
  ;
7265
7263
  for (O = l - 1, x = u - 1; O >= T && x >= T && a[O] === d[x]; O--, x--)
7266
- b[x] = r[O], y[x] = i[O], c && (N[x] = c[O]);
7267
- for (p = /* @__PURE__ */ new Map(), g = new Array(x + 1), m = x; m >= T; m--)
7268
- _ = d[m], h = p.get(_), g[m] = h === void 0 ? -1 : h, p.set(_, m);
7264
+ b[x] = r[O], p[x] = i[O], c && (N[x] = c[O]);
7265
+ for (y = /* @__PURE__ */ new Map(), g = new Array(x + 1), m = x; m >= T; m--)
7266
+ _ = d[m], h = y.get(_), g[m] = h === void 0 ? -1 : h, y.set(_, m);
7269
7267
  for (h = T; h <= O; h++)
7270
- _ = a[h], m = p.get(_), m !== void 0 && m !== -1 ? (b[m] = r[h], y[m] = i[h], c && (N[m] = c[h]), m = g[m], p.set(_, m)) : i[h]();
7268
+ _ = a[h], m = y.get(_), m !== void 0 && m !== -1 ? (b[m] = r[h], p[m] = i[h], c && (N[m] = c[h]), m = g[m], y.set(_, m)) : i[h]();
7271
7269
  for (m = T; m < u; m++)
7272
- m in b ? (r[m] = b[m], i[m] = y[m], c && (c[m] = N[m], c[m](m))) : r[m] = Rt(w);
7270
+ m in b ? (r[m] = b[m], i[m] = p[m], c && (c[m] = N[m], c[m](m))) : r[m] = Rt(w);
7273
7271
  r = r.slice(0, l = u), a = d.slice(0);
7274
7272
  }
7275
7273
  return r;
7276
7274
  });
7277
- function w(p) {
7278
- if (i[m] = p, c) {
7275
+ function w(y) {
7276
+ if (i[m] = y, c) {
7279
7277
  const [g, b] = Oe(m);
7280
7278
  return c[m] = b, t(d[m], g);
7281
7279
  }
@@ -7287,7 +7285,7 @@ function Tu(e, t, n = {}) {
7287
7285
  let a = [], r = [], i = [], l = [], c = 0, d;
7288
7286
  return Ln(() => Ns(i)), () => {
7289
7287
  const u = e() || [], h = u.length;
7290
- return u[Ti], Fe(() => {
7288
+ return u[Ti], Me(() => {
7291
7289
  if (h === 0)
7292
7290
  return c !== 0 && (Ns(i), i = [], a = [], r = [], c = 0, l = []), n.fallback && (a = [ca], r[0] = Rt((w) => (i[0] = w, n.fallback())), c = 1), r;
7293
7291
  for (a[0] === ca && (i[0](), i = [], a = [], r = [], c = 0), d = 0; d < h; d++)
@@ -7298,13 +7296,13 @@ function Tu(e, t, n = {}) {
7298
7296
  });
7299
7297
  function m(w) {
7300
7298
  i[d] = w;
7301
- const [p, g] = Oe(u[d]);
7302
- return l[d] = g, t(p, d);
7299
+ const [y, g] = Oe(u[d]);
7300
+ return l[d] = g, t(y, d);
7303
7301
  }
7304
7302
  };
7305
7303
  }
7306
7304
  function Gi(e, t) {
7307
- return Fe(() => e(t || {}));
7305
+ return Me(() => e(t || {}));
7308
7306
  }
7309
7307
  function rs() {
7310
7308
  return !0;
@@ -7347,7 +7345,7 @@ function Ri(...e) {
7347
7345
  let t = !1;
7348
7346
  for (let l = 0; l < e.length; l++) {
7349
7347
  const c = e[l];
7350
- t = t || !!c && ps in c, e[l] = typeof c == "function" ? (t = !0, Ye(c)) : c;
7348
+ t = t || !!c && ps in c, e[l] = typeof c == "function" ? (t = !0, Qe(c)) : c;
7351
7349
  }
7352
7350
  if (Ai && t)
7353
7351
  return new Proxy(
@@ -7461,8 +7459,8 @@ function Ui(e) {
7461
7459
  t = c;
7462
7460
  }
7463
7461
  let l;
7464
- return Ye(
7465
- () => (l = t()) ? Fe(() => {
7462
+ return Qe(
7463
+ () => (l = t()) ? Me(() => {
7466
7464
  if (!i || ae.done)
7467
7465
  return l(r);
7468
7466
  const c = ae.context;
@@ -7483,27 +7481,27 @@ function Lm(e) {
7483
7481
  const t = "fallback" in e && {
7484
7482
  fallback: () => e.fallback
7485
7483
  };
7486
- return Ye(Au(() => e.each, e.children, t || void 0));
7484
+ return Qe(Au(() => e.each, e.children, t || void 0));
7487
7485
  }
7488
7486
  function Dm(e) {
7489
7487
  const t = "fallback" in e && {
7490
7488
  fallback: () => e.fallback
7491
7489
  };
7492
- return Ye(Tu(() => e.each, e.children, t || void 0));
7490
+ return Qe(Tu(() => e.each, e.children, t || void 0));
7493
7491
  }
7494
7492
  function Om(e) {
7495
- const t = e.keyed, n = Ye(() => e.when, void 0, {
7493
+ const t = e.keyed, n = Qe(() => e.when, void 0, {
7496
7494
  equals: (a, r) => t ? a === r : !a == !r
7497
7495
  });
7498
- return Ye(
7496
+ return Qe(
7499
7497
  () => {
7500
7498
  const a = n();
7501
7499
  if (a) {
7502
7500
  const r = e.children;
7503
- return typeof r == "function" && r.length > 0 ? Fe(
7501
+ return typeof r == "function" && r.length > 0 ? Me(
7504
7502
  () => r(
7505
7503
  t ? a : () => {
7506
- if (!Fe(n))
7504
+ if (!Me(n))
7507
7505
  throw Bi("Show");
7508
7506
  return e.when;
7509
7507
  }
@@ -7518,7 +7516,7 @@ function Om(e) {
7518
7516
  }
7519
7517
  function Gm(e) {
7520
7518
  let t = !1;
7521
- const n = (i, l) => (t ? i[1] === l[1] : !i[1] == !l[1]) && i[2] === l[2], a = _i(() => e.children), r = Ye(
7519
+ const n = (i, l) => (t ? i[1] === l[1] : !i[1] == !l[1]) && i[2] === l[2], a = _i(() => e.children), r = Qe(
7522
7520
  () => {
7523
7521
  let i = a();
7524
7522
  Array.isArray(i) || (i = [i]);
@@ -7534,16 +7532,16 @@ function Gm(e) {
7534
7532
  equals: n
7535
7533
  }
7536
7534
  );
7537
- return Ye(
7535
+ return Qe(
7538
7536
  () => {
7539
7537
  const [i, l, c] = r();
7540
7538
  if (i < 0)
7541
7539
  return e.fallback;
7542
7540
  const d = c.children;
7543
- return typeof d == "function" && d.length > 0 ? Fe(
7541
+ return typeof d == "function" && d.length > 0 ? Me(
7544
7542
  () => d(
7545
7543
  t ? l : () => {
7546
- if (Fe(r)[0] !== i)
7544
+ if (Me(r)[0] !== i)
7547
7545
  throw Bi("Match");
7548
7546
  return c.when;
7549
7547
  }
@@ -7763,8 +7761,8 @@ function Mu(e, t, n) {
7763
7761
  const h = u.get(t[l]);
7764
7762
  if (h != null)
7765
7763
  if (c < h && h < i) {
7766
- let m = l, w = 1, p;
7767
- for (; ++m < r && m < i && !((p = u.get(t[m])) == null || p !== h + w); )
7764
+ let m = l, w = 1, y;
7765
+ for (; ++m < r && m < i && !((y = u.get(t[m])) == null || y !== h + w); )
7768
7766
  w++;
7769
7767
  if (w > h - c) {
7770
7768
  const g = t[l];
@@ -7865,7 +7863,7 @@ function Hu(e, t = {}, n, a) {
7865
7863
  ), Ut(() => typeof t.ref == "function" && Wu(t.ref, e)), Ut(() => Qu(e, t, n, !0, r, !0)), r;
7866
7864
  }
7867
7865
  function Wu(e, t, n) {
7868
- return Fe(() => e(t, n));
7866
+ return Me(() => e(t, n));
7869
7867
  }
7870
7868
  function ha(e, t, n, a) {
7871
7869
  if (n !== void 0 && !a && (a = []), typeof t != "function")
@@ -7919,12 +7917,12 @@ function ar(e, t, n, a, r, i, l) {
7919
7917
  const w = t.slice(10);
7920
7918
  a && e.removeEventListener(w, a, !0), n && e.addEventListener(w, n, !0);
7921
7919
  } else if (t.slice(0, 2) === "on") {
7922
- const w = t.slice(2).toLowerCase(), p = Ru.has(w);
7923
- if (!p && a) {
7920
+ const w = t.slice(2).toLowerCase(), y = Ru.has(w);
7921
+ if (!y && a) {
7924
7922
  const g = Array.isArray(a) ? a[0] : a;
7925
7923
  e.removeEventListener(w, g);
7926
7924
  }
7927
- (p || n) && (zu(e, w, n, p), p && Fu([w]));
7925
+ (y || n) && (zu(e, w, n, y), y && Fu([w]));
7928
7926
  } else if (t.slice(0, 5) === "attr:")
7929
7927
  ua(e, t.slice(5), n);
7930
7928
  else if (t.slice(0, 5) === "bool:")
@@ -8112,7 +8110,7 @@ function Mm(e) {
8112
8110
  let i, l = !!ae.context;
8113
8111
  return ki(
8114
8112
  () => {
8115
- l && (nr().user = l = !1), i || (i = yu(r, () => Ye(() => e.children)));
8113
+ l && (nr().user = l = !1), i || (i = yu(r, () => Qe(() => e.children)));
8116
8114
  const c = a();
8117
8115
  if (c instanceof HTMLHeadElement) {
8118
8116
  const [d, u] = Oe(!1), h = () => u(!0);
@@ -8136,12 +8134,12 @@ function Mm(e) {
8136
8134
  ), n;
8137
8135
  }
8138
8136
  function Fm(e) {
8139
- const [t, n] = Pu(e, ["component"]), a = Ye(() => t.component);
8140
- return Ye(() => {
8137
+ const [t, n] = Pu(e, ["component"]), a = Qe(() => t.component);
8138
+ return Qe(() => {
8141
8139
  const r = a();
8142
8140
  switch (typeof r) {
8143
8141
  case "function":
8144
- return Fe(() => r(n));
8142
+ return Me(() => r(n));
8145
8143
  case "string":
8146
8144
  const i = Uu.has(r), l = ae.context ? Yu() : ji(r, i);
8147
8145
  return Hu(l, n, i), l;
@@ -8521,16 +8519,16 @@ var el = (e, t, n, a, r = [], i = [], l = /* @__PURE__ */ new Map()) => {
8521
8519
  const c = mh(e);
8522
8520
  if (!c) {
8523
8521
  Ah(e, r, t);
8524
- const p = l.get(e);
8525
- if (p)
8522
+ const y = l.get(e);
8523
+ if (y)
8526
8524
  return a ? {
8527
8525
  transformedValue: null
8528
- } : p;
8526
+ } : y;
8529
8527
  }
8530
8528
  if (!Eh(e, n)) {
8531
- const p = or(e, n), g = p ? {
8532
- transformedValue: p.value,
8533
- annotations: [p.type]
8529
+ const y = or(e, n), g = y ? {
8530
+ transformedValue: y.value,
8531
+ annotations: [y.type]
8534
8532
  } : {
8535
8533
  transformedValue: e
8536
8534
  };
@@ -8541,12 +8539,12 @@ var el = (e, t, n, a, r = [], i = [], l = /* @__PURE__ */ new Map()) => {
8541
8539
  transformedValue: null
8542
8540
  };
8543
8541
  const d = or(e, n), u = (d == null ? void 0 : d.value) ?? e, h = At(u) ? [] : {}, m = {};
8544
- hn(u, (p, g) => {
8542
+ hn(u, (y, g) => {
8545
8543
  if (g === "__proto__" || g === "constructor" || g === "prototype")
8546
8544
  throw new Error(`Detected property ${g}. This is a prototype pollution risk, please remove it from your object.`);
8547
- const b = el(p, t, n, a, [...r, g], [...i, e], l);
8548
- h[g] = b.transformedValue, At(b.annotations) ? m[g] = b.annotations : Gn(b.annotations) && hn(b.annotations, (y, N) => {
8549
- m[Vi(g) + "." + N] = y;
8545
+ const b = el(y, t, n, a, [...r, g], [...i, e], l);
8546
+ h[g] = b.transformedValue, At(b.annotations) ? m[g] = b.annotations : Gn(b.annotations) && hn(b.annotations, (p, N) => {
8547
+ m[Vi(g) + "." + N] = p;
8550
8548
  });
8551
8549
  });
8552
8550
  const w = fa(m) ? {
@@ -8809,7 +8807,7 @@ var Hm = (e, t = !1) => {
8809
8807
  const t = Mi(() => {
8810
8808
  const n = this, [a] = Z(this, Wt), [r] = Z(this, Qt), [i] = Z(this, Yt), [l] = Z(this, Jt), [c] = Z(this, Kt);
8811
8809
  let d;
8812
- return Z(this, Xt) ? d = Z(this, Xt) : (d = Ui(() => import("./HO4MOOFI-BDTb6NG8.js")), ye(this, Xt, d)), al(Z(this, jn), Z(this, Ht)), Gi(d, Ri({
8810
+ return Z(this, Xt) ? d = Z(this, Xt) : (d = Ui(() => import("./HO4MOOFI-BuYNN3wg.js")), ye(this, Xt, d)), al(Z(this, jn), Z(this, Ht)), Gi(d, Ri({
8813
8811
  get queryFlavor() {
8814
8812
  return Z(n, Mn);
8815
8813
  },
@@ -8903,7 +8901,7 @@ var Hm = (e, t = !1) => {
8903
8901
  const t = Mi(() => {
8904
8902
  const n = this, [a] = Z(this, tn), [r] = Z(this, nn), [i] = Z(this, sn), [l] = Z(this, an), [c] = Z(this, Zt), [d] = Z(this, rn);
8905
8903
  let u;
8906
- return Z(this, ln) ? u = Z(this, ln) : (u = Ui(() => import("./HUY7CZI3-BlmrWmjj.js")), ye(this, ln, u)), al(Z(this, Kn), Z(this, en)), Gi(u, Ri({
8904
+ return Z(this, ln) ? u = Z(this, ln) : (u = Ui(() => import("./HUY7CZI3-D5Zd9WMP.js")), ye(this, ln, u)), al(Z(this, Kn), Z(this, en)), Gi(u, Ri({
8907
8905
  get queryFlavor() {
8908
8906
  return Z(n, zn);
8909
8907
  },
@@ -9076,7 +9074,7 @@ const rl = () => /* @__PURE__ */ s("div", { className: "absolute inset-0 z-50 fl
9076
9074
  );
9077
9075
  }, $h = 60 * 5;
9078
9076
  function qh() {
9079
- const { user: e, setUser: t, logout: n, isLoggedIn: a, isSessionExpired: r } = it(), i = Us(), l = Be(null), c = ie(async () => {
9077
+ const { user: e, setUser: t, logout: n, isLoggedIn: a, isSessionExpired: r } = it(), i = Us(), l = tt(null), c = ie(async () => {
9080
9078
  if (!(!_e(e, "expiresAt") || !_e(e, "accessToken") || !_e(e, "refreshToken")))
9081
9079
  try {
9082
9080
  const d = await Rs(i, {
@@ -9368,13 +9366,13 @@ const Xh = ({
9368
9366
  onSave: a,
9369
9367
  isSaving: r
9370
9368
  }) => {
9371
- var m, w, p;
9369
+ var m, w, y;
9372
9370
  const { data: i, isLoading: l, isError: c } = Yh(e || ""), [d, u] = E(""), h = async (g, b) => {
9373
9371
  try {
9374
9372
  await navigator.clipboard.writeText(g), K.success(`${b} copied to clipboard`);
9375
- } catch (y) {
9373
+ } catch (p) {
9376
9374
  K.error(`Failed to copy ${b}`, {
9377
- description: y == null ? void 0 : y.message
9375
+ description: p == null ? void 0 : p.message
9378
9376
  });
9379
9377
  }
9380
9378
  };
@@ -9473,7 +9471,7 @@ const Xh = ({
9473
9471
  {
9474
9472
  label: "Updated",
9475
9473
  value: dr(
9476
- ((p = i.metadata) == null ? void 0 : p.updatedAt) || i.createdAt
9474
+ ((y = i.metadata) == null ? void 0 : y.updatedAt) || i.createdAt
9477
9475
  )
9478
9476
  },
9479
9477
  {
@@ -9561,21 +9559,21 @@ const tm = ({
9561
9559
  onUploaded: i
9562
9560
  }) => {
9563
9561
  const [l, c] = E(() => {
9564
- const p = localStorage.getItem("chai_optimize_images");
9565
- return p !== null ? p === "true" : !0;
9562
+ const y = localStorage.getItem("chai_optimize_images");
9563
+ return y !== null ? y === "true" : !0;
9566
9564
  });
9567
9565
  de(() => {
9568
9566
  localStorage.setItem("chai_optimize_images", l.toString());
9569
9567
  }, [l]);
9570
9568
  const d = e || r, u = ie(
9571
- async (p) => new Promise((g, b) => {
9572
- const y = p[0], N = new FileReader();
9573
- N.readAsDataURL(y), N.onload = async () => {
9569
+ async (y) => new Promise((g, b) => {
9570
+ const p = y[0], N = new FileReader();
9571
+ N.readAsDataURL(p), N.onload = async () => {
9574
9572
  a(
9575
9573
  {
9576
9574
  file: N.result,
9577
9575
  folderId: void 0,
9578
- name: y.name,
9576
+ name: p.name,
9579
9577
  optimize: l
9580
9578
  },
9581
9579
  {
@@ -9692,11 +9690,11 @@ const tm = ({
9692
9690
  io,
9693
9691
  {
9694
9692
  checked: l,
9695
- onCheckedChange: (p) => {
9696
- c(p);
9693
+ onCheckedChange: (y) => {
9694
+ c(y);
9697
9695
  },
9698
- onClick: (p) => {
9699
- p.stopPropagation();
9696
+ onClick: (y) => {
9697
+ y.stopPropagation();
9700
9698
  },
9701
9699
  className: "data-[state=checked]:bg-indigo-500"
9702
9700
  }
@@ -9730,7 +9728,7 @@ function il({
9730
9728
  mode: n = "image",
9731
9729
  assetId: a
9732
9730
  }) {
9733
- const l = Y(() => [n], [n]), [c, d] = E(null), [u, h] = E(null), [m, w] = E(null), [p, g] = E({ show: !1, file: "" }), [b, y] = E(!1), [N, T] = E(
9731
+ const l = Y(() => [n], [n]), [c, d] = E(null), [u, h] = E(null), [m, w] = E(null), [y, g] = E({ show: !1, file: "" }), [b, p] = E(!1), [N, T] = E(
9734
9732
  a ? "details" : "grid"
9735
9733
  ), [O, x] = E(""), [_, G] = E(""), [W, F] = E(1), [te] = E(30), [j, q] = E([]);
9736
9734
  de(() => {
@@ -9792,16 +9790,16 @@ function il({
9792
9790
  ce ? (await f({
9793
9791
  file: D,
9794
9792
  folderId: void 0,
9795
- name: p.name || "",
9793
+ name: y.name || "",
9796
9794
  optimize: De
9797
9795
  }), g({ show: !1, file: "" })) : (await I({
9798
- id: p.id || "",
9796
+ id: y.id || "",
9799
9797
  file: D
9800
9798
  }), g({ show: !1, file: "" }));
9801
9799
  } catch (De) {
9802
9800
  console.error("Error saving edited image:", De);
9803
9801
  }
9804
- }, Ke = ie((D) => {
9802
+ }, Ve = ie((D) => {
9805
9803
  q([D]);
9806
9804
  }, []);
9807
9805
  return /* @__PURE__ */ o(ve, { children: [
@@ -9816,7 +9814,7 @@ function il({
9816
9814
  uploadAsset: f,
9817
9815
  isUpdatingAsset: R,
9818
9816
  isUploadingAsset: C,
9819
- onUploaded: Ke
9817
+ onUploaded: Ve
9820
9818
  }
9821
9819
  ),
9822
9820
  /* @__PURE__ */ o("div", { className: "border p-2 rounded-lg flex-1 flex flex-col gap-y-3 overflow-hidden relative", children: [
@@ -10068,12 +10066,12 @@ function il({
10068
10066
  },
10069
10067
  onSave: async (D) => {
10070
10068
  if (c) {
10071
- y(!0);
10069
+ p(!0);
10072
10070
  try {
10073
10071
  const ce = X.find((De) => De.id === c);
10074
10072
  ce && await I(Cl(ce, { description: D }));
10075
10073
  } finally {
10076
- y(!1);
10074
+ p(!1);
10077
10075
  }
10078
10076
  }
10079
10077
  },
@@ -10081,30 +10079,30 @@ function il({
10081
10079
  }
10082
10080
  )
10083
10081
  ] }),
10084
- p.show && /* @__PURE__ */ s(
10082
+ y.show && /* @__PURE__ */ s(
10085
10083
  wa,
10086
10084
  {
10087
10085
  fallback: /* @__PURE__ */ s("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ s(Ft, { className: "h-8 w-8 animate-spin" }) }),
10088
10086
  children: /* @__PURE__ */ s(
10089
10087
  Zh,
10090
10088
  {
10091
- imageUrl: p.file,
10089
+ imageUrl: y.file,
10092
10090
  onSave: Re,
10093
10091
  onClose: () => g({ show: !1, file: "" }),
10094
- defaultSavedImageName: p.name,
10095
- isEditing: !!p.id
10092
+ defaultSavedImageName: y.name,
10093
+ isEditing: !!y.id
10096
10094
  }
10097
10095
  )
10098
10096
  }
10099
10097
  ),
10100
10098
  u && /* @__PURE__ */ s(
10101
- Je,
10099
+ Ye,
10102
10100
  {
10103
10101
  open: !!u,
10104
10102
  onOpenChange: () => h(null),
10105
- children: /* @__PURE__ */ o(Xe, { children: [
10106
- /* @__PURE__ */ o(Ze, { children: [
10107
- /* @__PURE__ */ s(et, { children: "Delete Asset" }),
10103
+ children: /* @__PURE__ */ o(Je, { children: [
10104
+ /* @__PURE__ */ o(Xe, { children: [
10105
+ /* @__PURE__ */ s(Ze, { children: "Delete Asset" }),
10108
10106
  /* @__PURE__ */ o(rt, { children: [
10109
10107
  'Are you sure you want to delete "',
10110
10108
  u.name,
@@ -10136,9 +10134,9 @@ const nm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10136
10134
  }, u = () => {
10137
10135
  c(!1);
10138
10136
  }, h = (w) => {
10139
- const p = Array.isArray(w) ? w[0] : w;
10140
- p != null && p.url && n(
10141
- Ss(p, ["url", "id"])
10137
+ const y = Array.isArray(w) ? w[0] : w;
10138
+ y != null && y.url && n(
10139
+ Ss(y, ["url", "id"])
10142
10140
  ), c(!1);
10143
10141
  }, m = () => {
10144
10142
  n({ url: "", id: "" });
@@ -10191,9 +10189,9 @@ const nm = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
10191
10189
  ] })
10192
10190
  }
10193
10191
  ),
10194
- /* @__PURE__ */ s(Je, { open: l, onOpenChange: c, children: /* @__PURE__ */ o(Xe, { className: "w-full max-w-7xl h-fit p-0 overflow-hidden", children: [
10195
- /* @__PURE__ */ o(Ze, { className: "px-4 py-2 border-b hidden", children: [
10196
- /* @__PURE__ */ s(et, { children: "Select Image" }),
10192
+ /* @__PURE__ */ s(Ye, { open: l, onOpenChange: c, children: /* @__PURE__ */ o(Je, { className: "w-full max-w-7xl h-fit p-0 overflow-hidden", children: [
10193
+ /* @__PURE__ */ o(Xe, { className: "px-4 py-2 border-b hidden", children: [
10194
+ /* @__PURE__ */ s(Ze, { children: "Select Image" }),
10197
10195
  /* @__PURE__ */ s(
10198
10196
  A,
10199
10197
  {
@@ -10309,14 +10307,14 @@ rm();
10309
10307
  ql(im);
10310
10308
  zl(Nc);
10311
10309
  const lm = (e) => {
10312
- const t = Be([]), [n] = Ve(), a = n.get("page"), { data: r } = Ue(), {
10310
+ const t = tt([]), [n] = ze(), a = n.get("page"), { data: r } = Ue(), {
10313
10311
  data: i = {
10314
10312
  role: "",
10315
10313
  permissions: null
10316
10314
  }
10317
10315
  } = Md();
10318
10316
  Bd(), ic();
10319
- const { data: l, isFetching: c } = ii(), { blocks: d } = Ud(l), { data: u } = je(), { mutateAsync: h } = Yr(), m = Gd(), { onSave: w } = Fd(), { getPartialBlocks: p, getPartialBlockBlocks: g } = jd(), { aiContext: b, setAiContext: y } = Ta(), { mutateAsync: N } = Sc(), [T, O] = E(!1), { data: x } = Tt(), _ = ri(), { data: G } = li(), { data: W } = Mh(), { mutateAsync: F } = Fh(), te = jh();
10317
+ const { data: l, isFetching: c } = ii(), { blocks: d } = Ud(l), { data: u } = Fe(), { mutateAsync: h } = Yr(), m = Gd(), { onSave: w } = Fd(), { getPartialBlocks: y, getPartialBlockBlocks: g } = jd(), { aiContext: b, setAiContext: p } = Ta(), { mutateAsync: N } = Sc(), [T, O] = E(!1), { data: x } = Tt(), _ = ri(), { data: G } = li(), { data: W } = Mh(), { mutateAsync: F } = Fh(), te = jh();
10320
10318
  Zo(), de(() => {
10321
10319
  const z = () => {
10322
10320
  document.hidden ? O(!0) : O(!1);
@@ -10352,7 +10350,7 @@ const lm = (e) => {
10352
10350
  autoSaveInterval: e.autoSaveInterval ?? 15,
10353
10351
  onError: e.onError || console.error,
10354
10352
  getPartialBlockBlocks: g,
10355
- getPartialBlocks: p,
10353
+ getPartialBlocks: y,
10356
10354
  blocks: c ? [] : d,
10357
10355
  theme: Pl(ee),
10358
10356
  pageTypes: u,
@@ -10363,7 +10361,7 @@ const lm = (e) => {
10363
10361
  _type: "@chai/ai-context",
10364
10362
  _value: $a(z) ? z : ""
10365
10363
  }, B = [...X, P];
10366
- return await w({ page: a, blocks: B }), y(z), !0;
10364
+ return await w({ page: a, blocks: B }), p(z), !0;
10367
10365
  },
10368
10366
  aiContext: b,
10369
10367
  askAiCallBack: m,
@@ -10441,40 +10439,38 @@ const lm = (e) => {
10441
10439
  }
10442
10440
  });
10443
10441
  }, ef = () => {
10444
- const { user: e, logout: t } = it(), n = Be(e), a = Be(t);
10445
- return n.current = e, a.current = t, ie(
10442
+ const { user: e, logout: t } = it(), n = e == null ? void 0 : e.accessToken;
10443
+ return ie(
10446
10444
  async ({
10447
- url: r,
10448
- method: i = "GET",
10449
- body: l = {},
10450
- headers: c = {}
10445
+ url: a,
10446
+ method: r = "GET",
10447
+ body: i = {},
10448
+ headers: l = {}
10451
10449
  }) => {
10452
- var u;
10453
- const d = (u = n.current) == null ? void 0 : u.accessToken;
10454
- if (!d)
10450
+ if (!n)
10455
10451
  throw new Error("No auth token");
10456
- if (!r)
10452
+ if (!a)
10457
10453
  throw new Error("URL is required");
10458
10454
  try {
10459
- const h = await fetch(r, {
10460
- method: i,
10455
+ const c = await fetch(a, {
10456
+ method: r,
10461
10457
  headers: {
10462
10458
  "Content-Type": "application/json",
10463
- Authorization: `Bearer ${d}`,
10464
- ...c
10459
+ Authorization: `Bearer ${n}`,
10460
+ ...l
10465
10461
  },
10466
- body: JSON.stringify(l)
10462
+ body: JSON.stringify(i)
10467
10463
  });
10468
- if (h.status === 401)
10469
- return console.log("Session expired", h), await a.current(), window.location.reload(), null;
10470
- if (h.status === 400)
10471
- throw new Error((await h.json()).error);
10472
- return await h.json();
10473
- } catch (h) {
10474
- throw console.log("Something went wrong", h), h;
10464
+ if (c.status === 401)
10465
+ return console.log("Session expired", c), await t(), window.location.reload(), null;
10466
+ if (c.status === 400)
10467
+ throw new Error((await c.json()).error);
10468
+ return await c.json();
10469
+ } catch (c) {
10470
+ throw console.log("Something went wrong", c), c;
10475
10471
  }
10476
10472
  },
10477
- []
10473
+ [n, t]
10478
10474
  );
10479
10475
  };
10480
10476
  class tf {
@@ -10554,7 +10550,7 @@ export {
10554
10550
  Am as B,
10555
10551
  Bm as C,
10556
10552
  Fm as D,
10557
- Fe as E,
10553
+ Me as E,
10558
10554
  Lm as F,
10559
10555
  mu as G,
10560
10556
  kh as H,
@@ -10579,7 +10575,7 @@ export {
10579
10575
  ri as _,
10580
10576
  Gi as a,
10581
10577
  jh as a0,
10582
- je as a1,
10578
+ Fe as a1,
10583
10579
  Zm as a2,
10584
10580
  at as a3,
10585
10581
  bi as a4,
@@ -10598,7 +10594,7 @@ export {
10598
10594
  $t as ah,
10599
10595
  tf as ai,
10600
10596
  Oe as b,
10601
- Ye as c,
10597
+ Qe as c,
10602
10598
  Fu as d,
10603
10599
  ki as e,
10604
10600
  Ri as f,