@chaibuilder/pages 0.10.10 → 0.10.12

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.
@@ -8,10 +8,10 @@ var te = (e, t, s) => (pr(e, t, "read from private field"), s ? s.call(e) : t.ge
8
8
  import { jsx as n, jsxs as c, Fragment as de } from "react/jsx-runtime";
9
9
  import { has as Ie, get as $, isEmpty as Y, reverse as eo, sortBy as to, each as no, find as ve, keyBy as Ja, map as Be, groupBy as Kr, minBy as so, set as gt, filter as ye, startsWith as sn, startCase as zt, isObject as ba, pick as fs, initial as ao, includes as xt, uniq as Pa, union as ro, flatMap as Ia, compact as Ks, uniqBy as io, mapValues as Hr, toLower as Bt, endsWith as Wr, replace as lo, isString as _a, trim as oo, isArray as Qr, isPlainObject as co, orderBy as As, first as Jr, concat as uo, debounce as ho, upperCase as yr, keys as mo, pickBy as fo, isEqual as Us, values as go, noop as po, isFunction as yo, merge as vo, cloneDeep as bo } from "lodash-es";
10
10
  import * as Ce from "react";
11
- import Hs, { useCallback as ie, useMemo as H, useState as S, useEffect as le, useRef as tt, Suspense as Ya, createContext as xo, Component as wo, createElement as vr, lazy as No } from "react";
11
+ import Hs, { useCallback as ae, useState as S, useEffect as le, useRef as tt, useMemo as W, Suspense as Ya, createContext as xo, Component as wo, createElement as vr, lazy as No } from "react";
12
12
  import { useAtom as Ue, atom as vt } from "jotai";
13
13
  import { useMutation as ke, useQueryClient as Pe, useQuery as De, onlineManager as Yr, QueryClient as Eo, QueryClientProvider as So } from "@tanstack/react-query";
14
- import { toast as W } from "sonner";
14
+ import { toast as H } from "sonner";
15
15
  import { useLanguages as Fe, useSavePage as Wt, useUpdateBlocksPropsRealtime as Xr, PERMISSIONS as Ao, usePartailBlocksStore as To, usePermissions as Pn, useLibraryBlocks as Co, useTheme as ko, useSidebarActivePanel as Ws, useChaiFeatureFlag as Et, mergeClasses as Vn, useRightPanel as Po, registerChaiLibrary as Io, getBlocksFromHTML as _o, useBuilderProp as Lo, useTranslation as Do, registerChaiSidebarPanel as Ts, registerChaiFeatureFlag as Xt, registerChaiTopBar as Oo, registerChaiMediaManager as Ro, registerChaiSaveToLibrary as Go, ChaiBuilderEditor as Uo } from "@chaibuilder/sdk";
16
16
  import { Tooltip as Xe, TooltipTrigger as Ze, TooltipContent as et, Card as Qs, CardHeader as Js, CardTitle as Ys, CardContent as Xs, CardFooter as Zs, Button as T, Skeleton as Mt, AlertDialog as Zr, AlertDialogTrigger as ei, AlertDialogContent as ti, AlertDialogHeader as ni, AlertDialogTitle as si, AlertDialogDescription as ai, AlertDialogFooter as ri, AlertDialogCancel as ii, AlertDialogAction as li, Popover as Nn, PopoverTrigger as En, PopoverContent as Sn, Input as xe, Label as he, Dialog as je, DialogContent as ze, DialogHeader as Ve, DialogTitle as Ke, DialogDescription as nt, Alert as In, DialogFooter as ut, CommandList as oi, Command as Kn, CommandEmpty as Hn, CommandGroup as _t, CommandItem as ft, Textarea as An, DropdownMenu as _n, DropdownMenuTrigger as Ln, DropdownMenuContent as Dn, DropdownMenuItem as $e, Select as ci, SelectTrigger as di, SelectValue as Bo, SelectContent as ui, SelectItem as an, Badge as xa, TooltipProvider as Ft, Separator as Mo, Sheet as hi, SheetContent as mi, SheetHeader as fi, SheetTitle as gi, SheetDescription as Fo, Switch as La, ScrollArea as Ds, SheetTrigger as $o, DropdownMenuSeparator as qo, CardDescription as jo, CommandInput as zo, Tabs as pi, TabsList as yi, TabsTrigger as Mn, TabsContent as Fn, AlertDescription as vi, HoverCard as Vo, HoverCardTrigger as Ko, HoverCardContent as Ho } from "@chaibuilder/sdk/ui";
17
17
  import { formatDistanceToNow as bi, formatDate as Wo, format as ea } from "date-fns";
@@ -370,17 +370,11 @@ function Oi(e, t, s = jc, a) {
370
370
  localStorage.removeItem("_chai_user");
371
371
  localStorage.removeItem("__chai__user");
372
372
  const Ri = "__logged_in_user", zc = Oi(Ri, null), ot = () => {
373
- const [e, t] = Ue(zc), s = ie(() => {
373
+ const [e, t] = Ue(zc), s = ae(() => {
374
374
  t(null), localStorage.removeItem(Ri);
375
- }, [t]), a = H(() => {
376
- if (!(e != null && e.expiresAt)) return !1;
377
- if (!e || !(e != null && e.refreshToken)) return !0;
378
- const r = Math.floor(Date.now() / 1e3);
379
- return e.expiresAt - r <= 0;
380
- }, [e]);
375
+ }, [t]);
381
376
  return {
382
377
  isLoggedIn: !!e,
383
- isSessionExpired: a,
384
378
  user: e,
385
379
  setUser: t,
386
380
  logout: s
@@ -445,32 +439,37 @@ function Kc() {
445
439
  return tn;
446
440
  }
447
441
  const Gi = () => {
448
- const { user: e, isSessionExpired: t } = ot(), { mutateAsync: s } = Vc(), r = ht("getAccessToken", async () => {
442
+ const { user: e, setUser: t } = ot(), { mutateAsync: s } = Vc(), a = 60, r = ae(() => {
443
+ if (!(e != null && e.expiresAt)) return !1;
444
+ if (!e || !(e != null && e.refreshToken)) return !0;
445
+ const o = Math.floor(Date.now() / 1e3);
446
+ return e.expiresAt - o <= a;
447
+ }, [e]), l = ht("getAccessToken", async () => {
449
448
  if (!(!Ie(e, "expiresAt") || !Ie(e, "accessToken") || !Ie(e, "refreshToken"))) {
450
- if (t) {
451
- const i = Kc();
452
- if (i) {
453
- const o = await i;
454
- return (o == null ? void 0 : o.accessToken) || "";
449
+ if (r()) {
450
+ const o = Kc();
451
+ if (o) {
452
+ const h = await o;
453
+ return h && t(h), (h == null ? void 0 : h.accessToken) || "";
455
454
  }
456
- const l = await s();
457
- return (l == null ? void 0 : l.accessToken) || "";
455
+ const d = await s();
456
+ return d && t(d), (d == null ? void 0 : d.accessToken) || "";
458
457
  }
459
458
  return (e == null ? void 0 : e.accessToken) || "";
460
459
  }
461
460
  });
462
461
  return {
463
- getAccessToken: ie(async () => {
462
+ getAccessToken: ae(async () => {
464
463
  try {
465
- return await r();
464
+ return await l();
466
465
  } catch {
467
466
  return "";
468
467
  }
469
- }, [r])
468
+ }, [l])
470
469
  };
471
470
  }, Z = () => {
472
471
  const { logout: e } = ot(), { getAccessToken: t } = Gi();
473
- return ie(
472
+ return ae(
474
473
  async (s, a, r = {}) => {
475
474
  const i = await t();
476
475
  if (!i)
@@ -519,10 +518,10 @@ const Gi = () => {
519
518
  var i;
520
519
  t.invalidateQueries({
521
520
  queryKey: [U.GET_WEBSITE_DRAFT_SETTINGS]
522
- }), (i = r == null ? void 0 : r.settings) != null && i.theme || W.success("Website settings updated successfully.");
521
+ }), (i = r == null ? void 0 : r.settings) != null && i.theme || H.success("Website settings updated successfully.");
523
522
  },
524
523
  onError: (a) => {
525
- W.error("Failed to update website settings", {
524
+ H.error("Failed to update website settings", {
526
525
  description: a.message
527
526
  });
528
527
  }
@@ -534,10 +533,10 @@ const Gi = () => {
534
533
  onSuccess: () => {
535
534
  t.invalidateQueries({
536
535
  queryKey: [U.GET_WEBSITE_DATA]
537
- }), W.success("Website data updated successfully.");
536
+ }), H.success("Website data updated successfully.");
538
537
  },
539
538
  onError: (a) => {
540
- W.error("Failed to update website data", {
539
+ H.error("Failed to update website data", {
541
540
  description: a.message
542
541
  });
543
542
  }
@@ -563,7 +562,7 @@ const Wc = vt({}), Mi = () => Ue(Wc), Qc = () => {
563
562
  }, [t, a, s]);
564
563
  }, ht = (e, t) => {
565
564
  const [s] = Mi();
566
- return H(() => $(s, e, t), [s, e, t]);
565
+ return W(() => $(s, e, t), [s, e, t]);
567
566
  }, ue = () => ht("apiUrl", "/chai/api"), ia = () => ht("usersApiUrl", "/chai/users"), ps = () => ht("assetsApiUrl", "/chai/assets"), Jc = () => ht("supabaseInstance", null), pt = (e) => {
568
567
  const t = ue(), [s] = He(), a = e ?? s.get("page"), r = Z();
569
568
  return De({
@@ -594,7 +593,7 @@ const Wc = vt({}), Mi = () => Ue(Wc), Qc = () => {
594
593
  })
595
594
  });
596
595
  }, Fi = (e) => {
597
- const { fallbackLang: t } = Fe(), { data: s } = St(), { data: a, isFetching: r } = pt(), i = H(() => {
596
+ const { fallbackLang: t } = Fe(), { data: s } = St(), { data: a, isFetching: r } = pt(), i = W(() => {
598
597
  const l = { [t]: !0 };
599
598
  return no($(s, "languages"), (o) => {
600
599
  const d = ve(a, { lang: o });
@@ -609,7 +608,7 @@ const Wc = vt({}), Mi = () => Ue(Wc), Qc = () => {
609
608
  queryFn: () => "",
610
609
  staleTime: 0
611
610
  });
612
- return { setAiContext: ie(
611
+ return { setAiContext: ae(
613
612
  (a) => {
614
613
  e.setQueryData([U.AI_CONTEXT], a);
615
614
  },
@@ -637,10 +636,10 @@ const Zc = ({ query: e, uuid: t }) => {
637
636
  data: { query: e, pageType: i, uuid: t }
638
637
  }) || [],
639
638
  enabled: !!i
640
- }), u = H(() => s === "" ? d.filter((m) => m.lang === "" || m.lang === a) : d.filter((m) => m.lang === s), [s, a, d]);
639
+ }), u = W(() => s === "" ? d.filter((m) => m.lang === "" || m.lang === a) : d.filter((m) => m.lang === s), [s, a, d]);
641
640
  return { allLangPages: d, data: u, isFetching: h };
642
641
  }, qi = () => {
643
- const { selectedLang: e, fallbackLang: t } = Fe(), [s, a] = $i(), [r, i] = S(""), l = Xc(r, 500), { allLangPages: o, data: d, isFetching: h } = Zc({ query: l }), u = ie((p) => a(p), [a]), m = ie((p) => i(p), [i]), y = ie(() => {
642
+ const { selectedLang: e, fallbackLang: t } = Fe(), [s, a] = $i(), [r, i] = S(""), l = Xc(r, 500), { allLangPages: o, data: d, isFetching: h } = Zc({ query: l }), u = ae((p) => a(p), [a]), m = ae((p) => i(p), [i]), y = ae(() => {
644
643
  if (!s) return;
645
644
  const p = !(s != null && s.primaryPage), g = e.length === 0, f = p ? s == null ? void 0 : s.id : s == null ? void 0 : s.primaryPage, x = o.filter(
646
645
  (N) => (N == null ? void 0 : N.primaryPage) === f || N.id === f
@@ -660,7 +659,7 @@ const Zc = ({ query: e, uuid: t }) => {
660
659
  };
661
660
  }, Rt = () => {
662
661
  const { data: e } = St();
663
- return H(
662
+ return W(
664
663
  () => (e == null ? void 0 : e.fallbackLang) || "en",
665
664
  [e]
666
665
  );
@@ -690,10 +689,10 @@ const Zc = ({ query: e, uuid: t }) => {
690
689
  });
691
690
  }, td = vt({ lastSaved: void 0 }), la = () => Ue(td), We = () => {
692
691
  const [e] = He(), t = e.get("page"), [s] = ji(), { data: a, isFetching: r } = On();
693
- return { data: H(() => ({ ...ve(a, { id: t }) || {}, metadata: s }), [a, t, s]), isFetching: r };
692
+ return { data: W(() => ({ ...ve(a, { id: t }) || {}, metadata: s }), [a, t, s]), isFetching: r };
694
693
  }, Gt = () => {
695
694
  const [e] = He(), t = e.get("lang") ?? "", { data: s, isFetching: a } = pt();
696
- return { data: H(() => ve(s, { lang: t }) || {}, [s, t]), isFetching: a };
695
+ return { data: W(() => ve(s, { lang: t }) || {}, [s, t]), isFetching: a };
697
696
  }, nd = vt({}), ji = () => Ue(nd), zi = () => {
698
697
  const { data: e } = Gt(), t = nr(), s = e == null ? void 0 : e.slug, a = s ? window.location.origin + (s.endsWith("/") ? s.slice(0, -1) : s) : window.location.origin;
699
698
  return t ? a + t : a;
@@ -826,7 +825,7 @@ const At = (e) => {
826
825
  isActiveInOtherTab: !1
827
826
  }), id = vt(""), ld = vt(null), sr = vt({}), Vi = () => Ue(sr), Tt = () => {
828
827
  const [e] = He(), t = e.get("page"), { user: s } = ot(), [a, r] = Ue(ad), [i, l] = Ue(rd), [o, d] = Ue(ld), [h, u] = Ue(id), [m] = Ue(sr);
829
- return H(() => ({
828
+ return W(() => ({
830
829
  pageLock: i,
831
830
  pageToUser: m,
832
831
  lockingStatus: h,
@@ -916,7 +915,7 @@ const At = (e) => {
916
915
  * - update state for editing page
917
916
  */
918
917
  case "TAKE_OVER_REQUEST_ACCEPTED":
919
- x != null && x.isTakingOverFromAnotherTab || (o("take_over_request_accepted"), W.success("Your Page Take Over Request Accepted", { position: "top-center" })), l({
918
+ x != null && x.isTakingOverFromAnotherTab || (o("take_over_request_accepted"), H.success("Your Page Take Over Request Accepted", { position: "top-center" })), l({
920
919
  ...y == null ? void 0 : y.current,
921
920
  status: "checking",
922
921
  requestedBy: "",
@@ -959,9 +958,9 @@ const At = (e) => {
959
958
  };
960
959
  }, [a, d]), i == null ? void 0 : i.status;
961
960
  }, Ki = () => {
962
- const { data: e } = We(), { user: t } = ot(), s = e == null ? void 0 : e.id, { pageLock: a, setPageLock: r, realtimeInstance: i } = Tt(), { savePageAsync: l } = Wt(), o = ie(() => {
961
+ const { data: e } = We(), { user: t } = ot(), s = e == null ? void 0 : e.id, { pageLock: a, setPageLock: r, realtimeInstance: i } = Tt(), { savePageAsync: l } = Wt(), o = ae(() => {
963
962
  !i || !s || !(t != null && t.id) || (r({ ...a, isTakeOverRequested: !0 }), i == null || i.sendEvent("TAKE_OVER_REQUESTED"));
964
- }, [i, s, t == null ? void 0 : t.id, r, a]), d = ie(async () => {
963
+ }, [i, s, t == null ? void 0 : t.id, r, a]), d = ae(async () => {
965
964
  !i || !s || !(t != null && t.id) || (await l(), i == null || i.sendEvent("TAKE_OVER_REQUEST_ACCEPTED", {
966
965
  requestingClientId: a == null ? void 0 : a.requestingClientId
967
966
  }), r({
@@ -971,7 +970,7 @@ const At = (e) => {
971
970
  isActiveInOtherTab: !1,
972
971
  isTakeOverRequested: !1
973
972
  }));
974
- }, [s, i, t == null ? void 0 : t.id, r, l, a]), h = ie(() => {
973
+ }, [s, i, t == null ? void 0 : t.id, r, l, a]), h = ae(() => {
975
974
  !i || !s || !(t != null && t.id) || (i == null || i.sendEvent("TAKE_OVER_REQUEST_REJECTED", {
976
975
  requestingClientId: a == null ? void 0 : a.requestingClientId
977
976
  }), r({
@@ -1195,7 +1194,7 @@ const Cs = ({
1195
1194
  ] })
1196
1195
  ] }) });
1197
1196
  }, hd = () => {
1198
- const { pageLock: e, requestTakeOver: t } = Ki(), { isLocked: s, currentEditor: a, lockingStatus: r, setLockingStatus: i, realtimePageLockEnabled: l } = Tt(), { data: o, isFetching: d } = At(a), [h] = He(), u = h.get("page"), { mutate: m } = Ui(), { isFetching: y } = Hi(), [p] = la(), g = Pe(), f = ie(() => {
1197
+ const { pageLock: e, requestTakeOver: t } = Ki(), { isLocked: s, currentEditor: a, lockingStatus: r, setLockingStatus: i, realtimePageLockEnabled: l } = Tt(), { data: o, isFetching: d } = At(a), [h] = He(), u = h.get("page"), { mutate: m } = Ui(), { isFetching: y } = Hi(), [p] = la(), g = Pe(), f = ae(() => {
1199
1198
  l ? t() : m({ id: u });
1200
1199
  }, [u, m, t, l]);
1201
1200
  return u ? l && (e == null ? void 0 : e.status) === "checking" ? /* @__PURE__ */ n(Cs, { isChecking: !0, lockingStatus: "", onContinue: () => {
@@ -1259,7 +1258,7 @@ const Cs = ({
1259
1258
  e(a);
1260
1259
  },
1261
1260
  onError: (a) => {
1262
- console.error("Error saving block:", a), W.error("Failed to save block", {
1261
+ console.error("Error saving block:", a), H.error("Failed to save block", {
1263
1262
  description: a instanceof Error ? a.message : "Unknown error"
1264
1263
  });
1265
1264
  }
@@ -1294,7 +1293,7 @@ const Cs = ({
1294
1293
  e();
1295
1294
  },
1296
1295
  onError: (a) => {
1297
- console.error("Error deleting block:", a), W.error("Failed to delete block", {
1296
+ console.error("Error deleting block:", a), H.error("Failed to delete block", {
1298
1297
  description: a instanceof Error ? a.message : "Unknown error"
1299
1298
  });
1300
1299
  }
@@ -1308,7 +1307,7 @@ const Cs = ({
1308
1307
  trigger: i
1309
1308
  }) => {
1310
1309
  const [l, o] = S(!1), d = Xr(), h = pd(() => {
1311
- d([e], { _libBlockId: void 0 }), W.success("Block deleted successfully"), o(!1), a();
1310
+ d([e], { _libBlockId: void 0 }), H.success("Block deleted successfully"), o(!1), a();
1312
1311
  });
1313
1312
  return /* @__PURE__ */ c(Nn, { open: s, onOpenChange: (y) => !y && a(), children: [
1314
1313
  /* @__PURE__ */ n(En, { asChild: !0, children: i || /* @__PURE__ */ c(
@@ -1437,10 +1436,10 @@ const Cs = ({
1437
1436
  onSuccess: () => {
1438
1437
  s.invalidateQueries({
1439
1438
  queryKey: ["library-groups"]
1440
- }), W.success("Group created successfully");
1439
+ }), H.success("Group created successfully");
1441
1440
  },
1442
1441
  onError: (d) => {
1443
- console.error("Error creating group:", d), W.error("Failed to create group", {
1442
+ console.error("Error creating group:", d), H.error("Failed to create group", {
1444
1443
  description: d instanceof Error ? d.message : "Unknown error"
1445
1444
  });
1446
1445
  }
@@ -1481,7 +1480,7 @@ const Cs = ({
1481
1480
  { id: "stats", name: "Stats" },
1482
1481
  { id: "team", name: "Team" },
1483
1482
  { id: "timeline", name: "Timeline" }
1484
- ]), u = H(
1483
+ ]), u = W(
1485
1484
  () => [
1486
1485
  ...o,
1487
1486
  ...d.filter(
@@ -1579,7 +1578,7 @@ function Ji(e) {
1579
1578
  t(a);
1580
1579
  },
1581
1580
  error(a) {
1582
- W.error(
1581
+ H.error(
1583
1582
  `Failed to compress image. Image size is ${Ra(e.size)}, which exceeds the maximum allowed size of ${Ra(wa)}.`
1584
1583
  ), s(a);
1585
1584
  }
@@ -1587,13 +1586,13 @@ function Ji(e) {
1587
1586
  });
1588
1587
  }
1589
1588
  const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1590
- const [s, a] = S(!1), r = tt(null), i = ie(
1589
+ const [s, a] = S(!1), r = tt(null), i = ae(
1591
1590
  async (d) => {
1592
1591
  var u;
1593
1592
  const h = (u = d.target.files) == null ? void 0 : u[0];
1594
1593
  if (h) {
1595
1594
  if (h.size > wd) {
1596
- W.error("File too large", {
1595
+ H.error("File too large", {
1597
1596
  description: `Maximum file size is 10mb. Selected file is ${(h.size / 1024 / 1024).toFixed(2)}MB.`
1598
1597
  }), r.current && (r.current.value = "");
1599
1598
  return;
@@ -1607,7 +1606,7 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1607
1606
  t(y.result), a(!1);
1608
1607
  }, y.readAsDataURL(m);
1609
1608
  } catch (m) {
1610
- console.error("Error reading file:", m), a(!1), W.error("Failed to process image", {
1609
+ console.error("Error reading file:", m), a(!1), H.error("Failed to process image", {
1611
1610
  description: m instanceof Error ? m.message : "Unknown error"
1612
1611
  });
1613
1612
  }
@@ -1672,9 +1671,9 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1672
1671
  EDIT_MEDIA: "edit_media",
1673
1672
  DELETE_MEDIA: "delete_media"
1674
1673
  }, Ed = (e) => {
1675
- const { blocks: t, close: s, blockId: a } = e, { getPartailBlocks: r } = To(), i = t.find((E) => E._id === a), l = i == null ? void 0 : i._libBlockId, o = !!l, d = H(() => t.some(
1674
+ const { blocks: t, close: s, blockId: a } = e, { getPartailBlocks: r } = To(), i = t.find((E) => E._id === a), l = i == null ? void 0 : i._libBlockId, o = !!l, d = W(() => t.some(
1676
1675
  (E) => E._type === "PartialBlock" || E._type === "GlobalBlock"
1677
- ), [t]), h = H(() => {
1676
+ ), [t]), h = W(() => {
1678
1677
  let E = [];
1679
1678
  for (const R of t)
1680
1679
  if (R._type === "PartialBlock" || R._type === "GlobalBlock") {
@@ -1684,15 +1683,15 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1684
1683
  E.push(R);
1685
1684
  return E;
1686
1685
  }, [t, r]), [u, m] = S(""), [y, p] = S(""), [g, f] = S(""), [v, x] = S(""), [N, P] = S({}), [L, C] = S(!1), [I, G] = S(o), [J, ee] = S(!1), { hasPermission: D } = Pn(), F = D(Te.DELETE_LIBRARY_BLOCK), M = Xr(), q = () => {
1687
- M([a], { _libBlockId: void 0 }), W.success("Block delinked from library"), s();
1686
+ M([a], { _libBlockId: void 0 }), H.success("Block delinked from library"), s();
1688
1687
  }, {
1689
1688
  data: B,
1690
1689
  isLoading: K,
1691
- isError: ae
1690
+ isError: re
1692
1691
  } = gd(l);
1693
1692
  le(() => {
1694
- ae && o && (ee(!0), G(!1));
1695
- }, [ae, o]), le(() => {
1693
+ re && o && (ee(!0), G(!1));
1694
+ }, [re, o]), le(() => {
1696
1695
  B && !K && (m(B.name || ""), p(B.group || ""), f(B.description || ""), x(B.preview || ""), G(!1));
1697
1696
  }, [B, K]), le(() => {
1698
1697
  const E = u.trim().length >= 2, R = y.trim() !== "";
@@ -1703,7 +1702,7 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1703
1702
  return u.trim() ? u.length < 2 && (E.name = "Name must be at least 2 characters") : E.name = "Name is required", y || (E.group = "Group is required"), P(E), Object.keys(E).length === 0;
1704
1703
  }, { resetLibrary: Oe } = Co({ id: "" }), me = fd(
1705
1704
  (E) => {
1706
- o || M([a], { _libBlockId: E.id }), W.success(`Block ${o ? "updated" : "saved"} successfully`), Oe(E.library), s();
1705
+ o || M([a], { _libBlockId: E.id }), H.success(`Block ${o ? "updated" : "saved"} successfully`), Oe(E.library), s();
1707
1706
  }
1708
1707
  ), w = async (E) => {
1709
1708
  if (E.preventDefault(), !Ae()) return;
@@ -1870,7 +1869,7 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1870
1869
  });
1871
1870
  }, Yi = (e) => {
1872
1871
  const { data: t } = Ge();
1873
- return H(() => t == null ? void 0 : t.find((s) => s.key === e), [t, e]);
1872
+ return W(() => t == null ? void 0 : t.find((s) => s.key === e), [t, e]);
1874
1873
  }, Ad = () => {
1875
1874
  const e = ue(), t = Z();
1876
1875
  return ke({
@@ -1905,11 +1904,11 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1905
1904
  queryKey: [U.GET_WEBSITE_PAGES]
1906
1905
  });
1907
1906
  const l = i.template ? `Page created from "${i.template.name}" template` : i.hasSlug === !1 ? "New " + ((o = ve(a, { key: i.pageType })) == null ? void 0 : o.name) + " added successfully" : "New page added successfully";
1908
- W.success(l);
1907
+ H.success(l);
1909
1908
  },
1910
1909
  onError: (r, i) => {
1911
1910
  const l = ve(a, { key: i.pageType });
1912
- W.error(`Failed to add new ${l != null && l.hasSlug ? "page" : l.name}.`, {
1911
+ H.error(`Failed to add new ${l != null && l.hasSlug ? "page" : l.name}.`, {
1913
1912
  description: $(Sd, r.message, r.message)
1914
1913
  });
1915
1914
  }
@@ -1934,7 +1933,7 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1934
1933
  },
1935
1934
  onError: (i, l) => {
1936
1935
  const o = ve(r, { key: l.pageType });
1937
- W.error(`Failed to update ${o != null && o.hasSlug ? "page" : o.name}.`, {
1936
+ H.error(`Failed to update ${o != null && o.hasSlug ? "page" : o.name}.`, {
1938
1937
  description: i.message
1939
1938
  });
1940
1939
  }
@@ -1948,7 +1947,7 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1948
1947
  }),
1949
1948
  onSuccess: (r, i) => {
1950
1949
  if (r.code === "PAGE_LOCKED") {
1951
- W.error("Delete not allowed", {
1950
+ H.error("Delete not allowed", {
1952
1951
  description: "Page is currently being edited by another user."
1953
1952
  });
1954
1953
  return;
@@ -1963,7 +1962,7 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1963
1962
  },
1964
1963
  onError: (r, i) => {
1965
1964
  const l = ve(a, { key: i.pageType });
1966
- W.error(`Failed to delete ${l != null && l.hasSlug ? "page" : l.name}.`, {
1965
+ H.error(`Failed to delete ${l != null && l.hasSlug ? "page" : l.name}.`, {
1967
1966
  description: r.message
1968
1967
  });
1969
1968
  }
@@ -1982,13 +1981,13 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
1982
1981
  queryKey: [U.GET_WEBSITE_PAGES]
1983
1982
  });
1984
1983
  const l = ve(a, { key: i.pageType });
1985
- W.success(
1984
+ H.success(
1986
1985
  l != null && l.hasSlug ? ce.PAGE_UNPUBLISH_SUCCESS : "New " + l.name + " added successfully."
1987
1986
  );
1988
1987
  },
1989
1988
  onError: (r, i) => {
1990
1989
  const l = ve(a, { key: i.pageType });
1991
- W.error(`Failed to take offline ${l != null && l.hasSlug ? "page" : l.name}.`, {
1990
+ H.error(`Failed to take offline ${l != null && l.hasSlug ? "page" : l.name}.`, {
1992
1991
  description: r.message
1993
1992
  });
1994
1993
  }
@@ -2010,7 +2009,7 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
2010
2009
  });
2011
2010
  },
2012
2011
  onError: (i) => {
2013
- console.log("##", i), W.error("Failed to publish pages.");
2012
+ console.log("##", i), H.error("Failed to publish pages.");
2014
2013
  }
2015
2014
  });
2016
2015
  }, kd = () => {
@@ -2032,10 +2031,10 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
2032
2031
  onSuccess: () => {
2033
2032
  s.invalidateQueries({
2034
2033
  queryKey: [U.GET_WEBSITE_PAGES]
2035
- }), W.success("Page marked as template successfully.");
2034
+ }), H.success("Page marked as template successfully.");
2036
2035
  },
2037
2036
  onError: () => {
2038
- W.error("Failed to mark page as template.");
2037
+ H.error("Failed to mark page as template.");
2039
2038
  }
2040
2039
  });
2041
2040
  }, Pd = () => {
@@ -2048,10 +2047,10 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
2048
2047
  onSuccess: () => {
2049
2048
  s.invalidateQueries({
2050
2049
  queryKey: [U.GET_WEBSITE_PAGES]
2051
- }), W.success("Page unmarked as template successfully.");
2050
+ }), H.success("Page unmarked as template successfully.");
2052
2051
  },
2053
2052
  onError: () => {
2054
- W.error("Failed to unmark page as template.");
2053
+ H.error("Failed to unmark page as template.");
2055
2054
  }
2056
2055
  });
2057
2056
  }, Id = () => {
@@ -2062,14 +2061,14 @@ const wd = 10 * 1024 * 1024, Nd = ({ value: e, onChange: t }) => {
2062
2061
  data: { id: a, slug: r }
2063
2062
  }),
2064
2063
  onSuccess: (a, { primaryPage: r }) => {
2065
- W.success(ce.SLUG_CHANGE_SUCCESS), r ? s.invalidateQueries({
2064
+ H.success(ce.SLUG_CHANGE_SUCCESS), r ? s.invalidateQueries({
2066
2065
  queryKey: [U.GET_LANGUAGE_PAGES, r]
2067
2066
  }) : s.invalidateQueries({
2068
2067
  queryKey: [U.GET_WEBSITE_PAGES]
2069
2068
  });
2070
2069
  },
2071
2070
  onError: () => {
2072
- W.error("Failed to change slug");
2071
+ H.error("Failed to change slug");
2073
2072
  }
2074
2073
  });
2075
2074
  };
@@ -2131,13 +2130,13 @@ var ir = {};
2131
2130
  A.init = function(j) {
2132
2131
  var Q = j.transferControlToOffscreen();
2133
2132
  A.postMessage({ canvas: Q }, [Q]);
2134
- }, A.fire = function(j, Q, re) {
2133
+ }, A.fire = function(j, Q, ie) {
2135
2134
  if (b)
2136
2135
  return O(j, null), b;
2137
2136
  var z = Math.random().toString(36).slice(2);
2138
2137
  return b = h(function(oe) {
2139
2138
  function be(Ne) {
2140
- Ne.data.callback === z && (delete E[z], A.removeEventListener("message", be), b = null, u.clear(), re(), oe());
2139
+ Ne.data.callback === z && (delete E[z], A.removeEventListener("message", be), b = null, u.clear(), ie(), oe());
2141
2140
  }
2142
2141
  A.addEventListener("message", be), O(j, z), E[z] = be.bind(null, { data: { callback: z } });
2143
2142
  }), b;
@@ -2300,11 +2299,11 @@ var ir = {};
2300
2299
  Math.PI / 10 * b.wobble
2301
2300
  ));
2302
2301
  else if (b.shape.type === "bitmap") {
2303
- var j = Math.PI / 10 * b.wobble, Q = Math.abs(O - R) * 0.1, re = Math.abs(V - A) * 0.1, z = b.shape.bitmap.width * b.scalar, oe = b.shape.bitmap.height * b.scalar, be = new DOMMatrix([
2302
+ var j = Math.PI / 10 * b.wobble, Q = Math.abs(O - R) * 0.1, ie = Math.abs(V - A) * 0.1, z = b.shape.bitmap.width * b.scalar, oe = b.shape.bitmap.height * b.scalar, be = new DOMMatrix([
2304
2303
  Math.cos(j) * Q,
2305
2304
  Math.sin(j) * Q,
2306
- -Math.sin(j) * re,
2307
- Math.cos(j) * re,
2305
+ -Math.sin(j) * ie,
2306
+ Math.cos(j) * ie,
2308
2307
  b.x,
2309
2308
  b.y
2310
2309
  ]);
@@ -2326,7 +2325,7 @@ var ir = {};
2326
2325
  return w.closePath(), w.fill(), b.tick < b.totalTicks;
2327
2326
  }
2328
2327
  function q(w, b, E, R, A) {
2329
- var O = b.slice(), V = w.getContext("2d"), j, Q, re = h(function(z) {
2328
+ var O = b.slice(), V = w.getContext("2d"), j, Q, ie = h(function(z) {
2330
2329
  function oe() {
2331
2330
  j = Q = null, V.clearRect(0, 0, R.width, R.height), u.clear(), A(), z();
2332
2331
  }
@@ -2339,17 +2338,17 @@ var ir = {};
2339
2338
  });
2340
2339
  return {
2341
2340
  addFettis: function(z) {
2342
- return O = O.concat(z), re;
2341
+ return O = O.concat(z), ie;
2343
2342
  },
2344
2343
  canvas: w,
2345
- promise: re,
2344
+ promise: ie,
2346
2345
  reset: function() {
2347
2346
  j && m.cancel(j), Q && Q();
2348
2347
  }
2349
2348
  };
2350
2349
  }
2351
2350
  function B(w, b) {
2352
- var E = !w, R = !!v(b || {}, "resize"), A = !1, O = v(b, "disableForReducedMotion", Boolean), V = i && !!v(b || {}, "useWorker"), j = V ? y() : null, Q = E ? G : J, re = w && j ? !!w.__confetti_initialized : !1, z = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion)").matches, oe;
2351
+ var E = !w, R = !!v(b || {}, "resize"), A = !1, O = v(b, "disableForReducedMotion", Boolean), V = i && !!v(b || {}, "useWorker"), j = V ? y() : null, Q = E ? G : J, ie = w && j ? !!w.__confetti_initialized : !1, z = typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion)").matches, oe;
2353
2352
  function be(_, ne, Re) {
2354
2353
  for (var st = v(_, "particleCount", x), X = v(_, "angle", Number), Je = v(_, "spread", Number), at = v(_, "startVelocity", Number), ma = v(_, "decay", Number), fa = v(_, "gravity", Number), ga = v(_, "drift", Number), xs = v(_, "colors", L), pa = v(_, "ticks", Number), ws = v(_, "shapes"), ya = v(_, "scalar"), va = !!v(_, "flat"), Un = I(_), Yt = st, kt = [], Ns = w.width * Un.x, Es = w.height * Un.y; Yt--; )
2355
2354
  kt.push(
@@ -2377,12 +2376,12 @@ var ir = {};
2377
2376
  return h(function(at) {
2378
2377
  at();
2379
2378
  });
2380
- E && oe ? w = oe.canvas : E && !w && (w = ee(Re), document.body.appendChild(w)), R && !re && Q(w);
2379
+ E && oe ? w = oe.canvas : E && !w && (w = ee(Re), document.body.appendChild(w)), R && !ie && Q(w);
2381
2380
  var st = {
2382
2381
  width: w.width,
2383
2382
  height: w.height
2384
2383
  };
2385
- j && !re && j.init(w), re = !0, j && (w.__confetti_initialized = !0);
2384
+ j && !ie && j.init(w), ie = !0, j && (w.__confetti_initialized = !0);
2386
2385
  function X() {
2387
2386
  if (j) {
2388
2387
  var at = {
@@ -2402,7 +2401,7 @@ var ir = {};
2402
2401
  st.width = st.height = null;
2403
2402
  }
2404
2403
  function Je() {
2405
- oe = null, R && (A = !1, t.removeEventListener("resize", X)), E && w && (document.body.contains(w) && document.body.removeChild(w), w = null, re = !1);
2404
+ oe = null, R && (A = !1, t.removeEventListener("resize", X)), E && w && (document.body.contains(w) && document.body.removeChild(w), w = null, ie = !1);
2406
2405
  }
2407
2406
  return R && !A && (A = !0, t.addEventListener("resize", X, !1)), j ? j.fire(_, st, Je) : be(_, st, Je);
2408
2407
  }
@@ -2411,21 +2410,21 @@ var ir = {};
2411
2410
  }, Ne;
2412
2411
  }
2413
2412
  var K;
2414
- function ae() {
2413
+ function re() {
2415
2414
  return K || (K = B(null, { useWorker: !0, resize: !0 })), K;
2416
2415
  }
2417
2416
  function Ae(w, b, E, R, A, O, V) {
2418
2417
  var j = new Path2D(w), Q = new Path2D();
2419
2418
  Q.addPath(j, new DOMMatrix(b));
2420
- var re = new Path2D();
2421
- return re.addPath(Q, new DOMMatrix([
2419
+ var ie = new Path2D();
2420
+ return ie.addPath(Q, new DOMMatrix([
2422
2421
  Math.cos(V) * A,
2423
2422
  Math.sin(V) * A,
2424
2423
  -Math.sin(V) * O,
2425
2424
  Math.cos(V) * O,
2426
2425
  E,
2427
2426
  R
2428
- ])), re;
2427
+ ])), ie;
2429
2428
  }
2430
2429
  function Oe(w) {
2431
2430
  if (!l)
@@ -2434,10 +2433,10 @@ var ir = {};
2434
2433
  typeof w == "string" ? b = w : (b = w.path, E = w.matrix);
2435
2434
  var R = new Path2D(b), A = document.createElement("canvas"), O = A.getContext("2d");
2436
2435
  if (!E) {
2437
- for (var V = 1e3, j = V, Q = V, re = 0, z = 0, oe, be, Ne = 0; Ne < V; Ne += 2)
2436
+ for (var V = 1e3, j = V, Q = V, ie = 0, z = 0, oe, be, Ne = 0; Ne < V; Ne += 2)
2438
2437
  for (var _ = 0; _ < V; _ += 2)
2439
- O.isPointInPath(R, Ne, _, "nonzero") && (j = Math.min(j, Ne), Q = Math.min(Q, _), re = Math.max(re, Ne), z = Math.max(z, _));
2440
- oe = re - j, be = z - Q;
2438
+ O.isPointInPath(R, Ne, _, "nonzero") && (j = Math.min(j, Ne), Q = Math.min(Q, _), ie = Math.max(ie, Ne), z = Math.max(z, _));
2439
+ oe = ie - j, be = z - Q;
2441
2440
  var ne = 10, Re = Math.min(ne / oe, ne / be);
2442
2441
  E = [
2443
2442
  Re,
@@ -2459,7 +2458,7 @@ var ir = {};
2459
2458
  typeof w == "string" ? b = w : (b = w.text, E = "scalar" in w ? w.scalar : E, A = "fontFamily" in w ? w.fontFamily : A, R = "color" in w ? w.color : R);
2460
2459
  var O = 10 * E, V = "" + O + "px " + A, j = new OffscreenCanvas(O, O), Q = j.getContext("2d");
2461
2460
  Q.font = V;
2462
- var re = Q.measureText(b), z = Math.ceil(re.actualBoundingBoxRight + re.actualBoundingBoxLeft), oe = Math.ceil(re.actualBoundingBoxAscent + re.actualBoundingBoxDescent), be = 2, Ne = re.actualBoundingBoxLeft + be, _ = re.actualBoundingBoxAscent + be;
2461
+ var ie = Q.measureText(b), z = Math.ceil(ie.actualBoundingBoxRight + ie.actualBoundingBoxLeft), oe = Math.ceil(ie.actualBoundingBoxAscent + ie.actualBoundingBoxDescent), be = 2, Ne = ie.actualBoundingBoxLeft + be, _ = ie.actualBoundingBoxAscent + be;
2463
2462
  z += be + be, oe += be + be, j = new OffscreenCanvas(z, oe), Q = j.getContext("2d"), Q.font = V, Q.fillStyle = R, Q.fillText(b, Ne, _);
2464
2463
  var ne = 1 / E;
2465
2464
  return {
@@ -2470,9 +2469,9 @@ var ir = {};
2470
2469
  };
2471
2470
  }
2472
2471
  s.exports = function() {
2473
- return ae().apply(this, arguments);
2472
+ return re().apply(this, arguments);
2474
2473
  }, s.exports.reset = function() {
2475
- ae().reset();
2474
+ re().reset();
2476
2475
  }, s.exports.create = B, s.exports.shapeFromPath = Oe, s.exports.shapeFromText = me;
2477
2476
  })(/* @__PURE__ */ function() {
2478
2477
  return typeof window < "u" ? window : typeof self < "u" ? self : this || {};
@@ -2883,9 +2882,9 @@ const Zi = ({
2883
2882
  edit: r = !1,
2884
2883
  preselectedLang: i
2885
2884
  }) => {
2886
- const { data: l = [] } = On(), o = H(() => l.find((z) => z.id === a), [l, a]), [d, h] = S(""), [u, m] = S(""), [y, p] = S(""), [g, f] = S(!0), [v, x] = S(!0), { mutate: N, isPending: P } = Xi(), { mutate: L, isPending: C } = ar(), I = P || C, { data: G, isFetching: J } = St(), ee = Rt(), { data: D, isFetching: F } = pt(a), { data: M = [], isFetching: q } = pt(
2885
+ const { data: l = [] } = On(), o = W(() => l.find((z) => z.id === a), [l, a]), [d, h] = S(""), [u, m] = S(""), [y, p] = S(""), [g, f] = S(!0), [v, x] = S(!0), { mutate: N, isPending: P } = Xi(), { mutate: L, isPending: C } = ar(), I = P || C, { data: G, isFetching: J } = St(), ee = Rt(), { data: D, isFetching: F } = pt(a), { data: M = [], isFetching: q } = pt(
2887
2886
  o == null ? void 0 : o.parent
2888
- ), { data: B = [], isFetching: K } = Ge(), { setSelectedLang: ae } = Fe(), [, Ae] = He(), [, Oe] = Ws(), me = J || F || q || K, w = H(() => ye(G == null ? void 0 : G.languages, (z) => !ve(D, { lang: z })), [G, D]), b = H(
2887
+ ), { data: B = [], isFetching: K } = Ge(), { setSelectedLang: re } = Fe(), [, Ae] = He(), [, Oe] = Ws(), me = J || F || q || K, w = W(() => ye(G == null ? void 0 : G.languages, (z) => !ve(D, { lang: z })), [G, D]), b = W(
2889
2888
  () => B.find((z) => z.key === (o == null ? void 0 : o.pageType)),
2890
2889
  [B, o == null ? void 0 : o.pageType]
2891
2890
  ), E = !(b != null && b.hasSlug), R = (o == null ? void 0 : o.slug) === "/";
@@ -2905,7 +2904,7 @@ const Zi = ({
2905
2904
  m(z), (!d || d === (o == null ? void 0 : o.name)) && h(`${o == null ? void 0 : o.name} - ${Le[z]}`);
2906
2905
  }
2907
2906
  }, [i, w, r, d, o]);
2908
- const { parentSlug: A, isRootPage: O } = H(() => {
2907
+ const { parentSlug: A, isRootPage: O } = W(() => {
2909
2908
  if (R || !u)
2910
2909
  return { parentSlug: void 0, isRootPage: !(o != null && o.parent) };
2911
2910
  if (!(o != null && o.parent))
@@ -2915,13 +2914,13 @@ const Zi = ({
2915
2914
  };
2916
2915
  const z = M == null ? void 0 : M.find((oe) => oe.lang === u);
2917
2916
  return { parentSlug: z == null ? void 0 : z.slug, isRootPage: !1 };
2918
- }, [o == null ? void 0 : o.parent, M, v, u, R]), V = H(() => O ? !0 : !!(M != null && M.some((z) => (z == null ? void 0 : z.lang) === u)), [u, M, O]), j = () => {
2917
+ }, [o == null ? void 0 : o.parent, M, v, u, R]), V = W(() => O ? !0 : !!(M != null && M.some((z) => (z == null ? void 0 : z.lang) === u)), [u, M, O]), j = () => {
2919
2918
  let z = "";
2920
2919
  return O ? z = `/${v ? [u, y].filter(Boolean).join("/") : y}` : z = `${Dt(A)}/${y}`, z.replace(/\/{2,}/g, "/").replace(/\/$/, "");
2921
2920
  }, Q = (z) => {
2922
2921
  const oe = new URLSearchParams(window.location.search);
2923
2922
  ee && z === ee ? oe.delete("lang") : oe.set("lang", z), Ae(oe), window.dispatchEvent(new PopStateEvent("popstate"));
2924
- }, re = (z) => {
2923
+ }, ie = (z) => {
2925
2924
  z.preventDefault();
2926
2925
  const oe = {
2927
2926
  name: d,
@@ -2931,7 +2930,7 @@ const Zi = ({
2931
2930
  pageType: o == null ? void 0 : o.pageType,
2932
2931
  ...r && { id: e }
2933
2932
  }, be = () => {
2934
- !r && u && (ae(u), Q(u)), Oe("outline"), s();
2933
+ !r && u && (re(u), Q(u)), Oe("outline"), s();
2935
2934
  };
2936
2935
  r ? L(oe, { onSuccess: be }) : N(oe, { onSuccess: be });
2937
2936
  };
@@ -2946,7 +2945,7 @@ const Zi = ({
2946
2945
  id: e,
2947
2946
  pages: l,
2948
2947
  loading: me,
2949
- onSubmit: re,
2948
+ onSubmit: ie,
2950
2949
  edit: r,
2951
2950
  lang: u,
2952
2951
  languages: w,
@@ -3048,7 +3047,7 @@ function jd({
3048
3047
  }) {
3049
3048
  const [l, o] = S(!1), [d, h] = S(""), u = Et("enable-add-page-dropdown");
3050
3049
  u || (a = "w-full rounded-md border border-gray-300 px-3 py-2");
3051
- const m = H(() => !e || e.length === 0 ? [] : e.filter((N) => !Y(N.slug)).filter((N) => N.slug !== "/").sort((N, P) => N.slug.localeCompare(P.slug)), [e]), y = H(() => {
3050
+ const m = W(() => !e || e.length === 0 ? [] : e.filter((N) => !Y(N.slug)).filter((N) => N.slug !== "/").sort((N, P) => N.slug.localeCompare(P.slug)), [e]), y = W(() => {
3052
3051
  if (!d.trim()) return m;
3053
3052
  const x = d.toLowerCase();
3054
3053
  return m.filter(
@@ -3290,14 +3289,14 @@ const zd = (...e) => e.filter(Boolean).join(" "), Vd = ({
3290
3289
  }
3291
3290
  });
3292
3291
  }, Wd = (e) => {
3293
- const { data: t = [], isLoading: s } = Hd(e), { data: a = [], isLoading: r } = Kd(), i = H(() => s || r ? [] : t.map((o) => {
3292
+ const { data: t = [], isLoading: s } = Hd(e), { data: a = [], isLoading: r } = Kd(), i = W(() => s || r ? [] : t.map((o) => {
3294
3293
  const d = ve(a, { id: o.library });
3295
3294
  return {
3296
3295
  ...o,
3297
3296
  libraryName: (d == null ? void 0 : d.type) !== "shared" ? "Site Library" : (d == null ? void 0 : d.name) + " Library",
3298
3297
  libraryType: d == null ? void 0 : d.type
3299
3298
  };
3300
- }), [t, a, s, r]), l = H(() => Kr(i, "libraryName"), [i]);
3299
+ }), [t, a, s, r]), l = W(() => Kr(i, "libraryName"), [i]);
3301
3300
  return {
3302
3301
  data: i,
3303
3302
  groupedData: l,
@@ -3305,7 +3304,7 @@ const zd = (...e) => e.filter(Boolean).join(" "), Vd = ({
3305
3304
  };
3306
3305
  }, oa = () => {
3307
3306
  const [, e] = He();
3308
- return ie(
3307
+ return ae(
3309
3308
  (t, s) => {
3310
3309
  const r = new URLSearchParams(window.location.search).get("lang"), i = new URLSearchParams({ page: t });
3311
3310
  r && i.set("lang", r), window.history.pushState({}, "", `?${i.toString()}`), e(i), window.dispatchEvent(new PopStateEvent("popstate")), s == null || s();
@@ -3376,10 +3375,10 @@ if (import.meta.vitest) {
3376
3375
  const Ut = (...e) => e.filter(Boolean).join(" ");
3377
3376
  function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel: a }) {
3378
3377
  var Ns, Es;
3379
- const r = oa(), i = !!(e != null && e.id), { data: l } = On(), { mutate: o, isPending: d } = Xi(), { mutate: h, isPending: u } = ar(), [m, y] = S(null), [p, g] = S(!0), [f, v] = S((e == null ? void 0 : e.pageType) ?? "page"), { hasPermission: x } = Pn(), N = x(Te.CHANGE_PAGE_TYPE), [P, L] = S(!1), [C, I] = S(""), { selectedLang: G, fallbackLang: J } = Fe(), ee = G || J, [D, F] = S(""), [M, q] = S(!1), B = H(() => {
3378
+ const r = oa(), i = !!(e != null && e.id), { data: l } = On(), { mutate: o, isPending: d } = Xi(), { mutate: h, isPending: u } = ar(), [m, y] = S(null), [p, g] = S(!0), [f, v] = S((e == null ? void 0 : e.pageType) ?? "page"), { hasPermission: x } = Pn(), N = x(Te.CHANGE_PAGE_TYPE), [P, L] = S(!1), [C, I] = S(""), { selectedLang: G, fallbackLang: J } = Fe(), ee = G || J, [D, F] = S(""), [M, q] = S(!1), B = W(() => {
3380
3379
  const k = t.find((fe) => fe.key === f);
3381
3380
  return (k == null ? void 0 : k.hasSlug) === !1;
3382
- }, [f, t]), [K, ae] = S((e == null ? void 0 : e.parent) ?? ""), [Ae, Oe] = S((e == null ? void 0 : e.name) ?? ""), [me, w] = S((e == null ? void 0 : e.dynamic) ?? !1), [b, E] = S(me ? "" : ((e == null ? void 0 : e.slug) ?? "").split("/").pop() || ""), [R, A] = S((e == null ? void 0 : e.dynamicSlugCustom) ?? ""), [O, V] = S(!0), [j, Q] = S(!1), [re, z] = S(""), { data: oe, isLoading: be } = Wd(f), Ne = d || u, _ = Et("enable-add-page-dropdown"), ne = H(() => !i || !(e != null && e.id) || !l ? null : l.find((k) => k.id === e.id), [i, e == null ? void 0 : e.id, l]), Re = (ne == null ? void 0 : ne.online) || !1, st = H(() => !i || !(e != null && e.id) || !l ? !1 : l.some((k) => k.parent === e.id), [i, e == null ? void 0 : e.id, l]), X = t.find((k) => k.key === f), Je = (k) => {
3381
+ }, [f, t]), [K, re] = S((e == null ? void 0 : e.parent) ?? ""), [Ae, Oe] = S((e == null ? void 0 : e.name) ?? ""), [me, w] = S((e == null ? void 0 : e.dynamic) ?? !1), [b, E] = S(me ? "" : ((e == null ? void 0 : e.slug) ?? "").split("/").pop() || ""), [R, A] = S((e == null ? void 0 : e.dynamicSlugCustom) ?? ""), [O, V] = S(!0), [j, Q] = S(!1), [ie, z] = S(""), { data: oe, isLoading: be } = Wd(f), Ne = d || u, _ = Et("enable-add-page-dropdown"), ne = W(() => !i || !(e != null && e.id) || !l ? null : l.find((k) => k.id === e.id), [i, e == null ? void 0 : e.id, l]), Re = (ne == null ? void 0 : ne.online) || !1, st = W(() => !i || !(e != null && e.id) || !l ? !1 : l.some((k) => k.parent === e.id), [i, e == null ? void 0 : e.id, l]), X = t.find((k) => k.key === f), Je = (k) => {
3383
3382
  if (i && f !== k) {
3384
3383
  I(k), L(!0), F(""), q(!1);
3385
3384
  return;
@@ -3390,7 +3389,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3390
3389
  }, ma = (k) => {
3391
3390
  w(k), k ? E("") : A("");
3392
3391
  }, fa = (k) => {
3393
- if (ae(k), k && k !== "none") {
3392
+ if (re(k), k && k !== "none") {
3394
3393
  const fe = l == null ? void 0 : l.find((Ye) => Ye.id === k), ct = (fe == null ? void 0 : fe.slug) || "";
3395
3394
  if (b.startsWith(ct)) {
3396
3395
  const Ye = b.slice(ct.length).replace(/^\/+/, "");
@@ -3401,7 +3400,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3401
3400
  E(b ? `${b}` : "");
3402
3401
  }, ga = (k) => {
3403
3402
  z(k);
3404
- }, xs = () => Ae.trim() ? me && !Y(b) ? (y("Slug must be empty when using dynamic slug"), !1) : me && !O ? (y("Dynamic slug is invalid"), !1) : !0 : (W.error("Name is required"), !1), pa = () => {
3403
+ }, xs = () => Ae.trim() ? me && !Y(b) ? (y("Slug must be empty when using dynamic slug"), !1) : me && !O ? (y("Dynamic slug is invalid"), !1) : !0 : (H.error("Name is required"), !1), pa = () => {
3405
3404
  const k = {
3406
3405
  pageType: X == null ? void 0 : X.key,
3407
3406
  name: Ae,
@@ -3412,7 +3411,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3412
3411
  { id: e == null ? void 0 : e.id, name: Ae },
3413
3412
  {
3414
3413
  onSuccess: () => {
3415
- W.success((X == null ? void 0 : X.name) + " updated successfully"), s();
3414
+ H.success((X == null ? void 0 : X.name) + " updated successfully"), s();
3416
3415
  }
3417
3416
  }
3418
3417
  ) : o(k, {
@@ -3434,7 +3433,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3434
3433
  parent: K,
3435
3434
  dynamic: me,
3436
3435
  hasSlug: !0,
3437
- template: re || void 0,
3436
+ template: ie || void 0,
3438
3437
  tracking: {},
3439
3438
  seo: {},
3440
3439
  jsonLD: {}
@@ -3445,7 +3444,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3445
3444
  { id: e == null ? void 0 : e.id, ...dt },
3446
3445
  {
3447
3446
  onSuccess: () => {
3448
- W.success("Page updated successfully"), s();
3447
+ H.success("Page updated successfully"), s();
3449
3448
  }
3450
3449
  }
3451
3450
  );
@@ -3464,7 +3463,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3464
3463
  pageType: f,
3465
3464
  name: Ae,
3466
3465
  slug: b === "" ? "/" : `/${b.replace(/\/$/, "")}`,
3467
- template: re || void 0,
3466
+ template: ie || void 0,
3468
3467
  parent: null,
3469
3468
  tracking: {}
3470
3469
  };
@@ -3473,7 +3472,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3473
3472
  { id: e == null ? void 0 : e.id, ...k },
3474
3473
  {
3475
3474
  onSuccess: () => {
3476
- W.success("Page updated successfully"), s();
3475
+ H.success("Page updated successfully"), s();
3477
3476
  }
3478
3477
  }
3479
3478
  );
@@ -3502,7 +3501,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3502
3501
  } else
3503
3502
  va();
3504
3503
  }
3505
- }, { pagesType: Yt, partialsType: kt } = H(() => {
3504
+ }, { pagesType: Yt, partialsType: kt } = W(() => {
3506
3505
  const k = (fe) => D ? fe.name.toLowerCase().includes(D.toLowerCase()) || fe.key.toLowerCase().includes(D.toLowerCase()) : !0;
3507
3506
  return {
3508
3507
  pagesType: t.filter((fe) => fe.hasSlug !== !1 && k(fe)),
@@ -3646,7 +3645,7 @@ function Qd({ addEditPage: e, additionalPageTypes: t = [], close: s, closePanel:
3646
3645
  Vd,
3647
3646
  {
3648
3647
  templates: oe,
3649
- selectedTemplateId: re,
3648
+ selectedTemplateId: ie,
3650
3649
  onSelectTemplate: ga,
3651
3650
  isLoading: be
3652
3651
  }
@@ -3906,10 +3905,10 @@ const Jd = () => {
3906
3905
  onSuccess: () => {
3907
3906
  t.invalidateQueries({
3908
3907
  queryKey: [U.GET_WEBSITE_PAGES]
3909
- }), W.success("Page duplicated successfully");
3908
+ }), H.success("Page duplicated successfully");
3910
3909
  },
3911
3910
  onError: (a) => {
3912
- W.error("Failed to duplicate page", {
3911
+ H.error("Failed to duplicate page", {
3913
3912
  description: a.message || "An error occurred while duplicating the page"
3914
3913
  });
3915
3914
  }
@@ -4038,13 +4037,13 @@ const Jd = () => {
4038
4037
  }) => {
4039
4038
  const [s, a] = S(!1), [r, i] = S(""), [l, o] = S(""), [d, h] = S(!1), u = tt(null), m = kd(), { data: y } = Ge(), p = y == null ? void 0 : y.find(
4040
4039
  (P) => P.key === e.pageType
4041
- ), g = (p == null ? void 0 : p.name) || zt(e.pageType), f = ie(
4040
+ ), g = (p == null ? void 0 : p.name) || zt(e.pageType), f = ae(
4042
4041
  (P) => {
4043
4042
  var C;
4044
4043
  const L = (C = P.target.files) == null ? void 0 : C[0];
4045
4044
  if (L) {
4046
4045
  if (L.size > Yd) {
4047
- W.error("File too large", {
4046
+ H.error("File too large", {
4048
4047
  description: `Maximum file size is 1MB. Selected file is ${(L.size / 1024).toFixed(2)}KB.`
4049
4048
  }), u.current && (u.current.value = "");
4050
4049
  return;
@@ -4056,7 +4055,7 @@ const Jd = () => {
4056
4055
  o(I.result), h(!1);
4057
4056
  }, I.readAsDataURL(L);
4058
4057
  } catch (I) {
4059
- console.error("Error reading file:", I), h(!1), W.error("Failed to process image", {
4058
+ console.error("Error reading file:", I), h(!1), H.error("Failed to process image", {
4060
4059
  description: I instanceof Error ? I.message : "Unknown error"
4061
4060
  });
4062
4061
  }
@@ -4208,7 +4207,7 @@ const Jd = () => {
4208
4207
  children: o,
4209
4208
  isLanguagePage: d
4210
4209
  }) => {
4211
- const { hasPermission: h } = Pn(), { data: u } = Ge(), m = H(() => ve(u, { key: e.pageType }), [u, e.pageType]), y = H(() => !!e.isTemplate, [e.isTemplate]), p = H(() => !!(m != null && m.hasSlug), [m == null ? void 0 : m.hasSlug]);
4210
+ const { hasPermission: h } = Pn(), { data: u } = Ge(), m = W(() => ve(u, { key: e.pageType }), [u, e.pageType]), y = W(() => !!e.isTemplate, [e.isTemplate]), p = W(() => !!(m != null && m.hasSlug), [m == null ? void 0 : m.hasSlug]);
4212
4211
  return !h(Te.EDIT_PAGE) && !h(Te.DELETE_PAGE) && !h(Te.UNPUBLISH_PAGE) || !e ? null : /* @__PURE__ */ c(_n, { children: [
4213
4212
  /* @__PURE__ */ n(Ln, { asChild: !0, onClick: (f) => f.stopPropagation(), children: o }),
4214
4213
  /* @__PURE__ */ c(Dn, { align: "center", className: "text-sm", children: [
@@ -4400,11 +4399,11 @@ const Jd = () => {
4400
4399
  };
4401
4400
  return s(e), Array.from(t);
4402
4401
  }, Rn = (e) => {
4403
- const [t, s] = Ue(Xd), a = e ? xt(t, e) : !1, r = ie(() => {
4402
+ const [t, s] = Ue(Xd), a = e ? xt(t, e) : !1, r = ae(() => {
4404
4403
  s(
4405
4404
  (h) => a ? ye(h, (u) => u !== e) : [...h, e]
4406
4405
  );
4407
- }, [s, a, e]), i = ie(
4406
+ }, [s, a, e]), i = ae(
4408
4407
  (h, u) => {
4409
4408
  if (!u || Y(h)) return;
4410
4409
  const m = mr(h), y = nl(m, u);
@@ -4413,21 +4412,21 @@ const Jd = () => {
4413
4412
  Y(p) || s((g) => Pa([...g, ...p]));
4414
4413
  },
4415
4414
  [s]
4416
- ), l = ie(
4415
+ ), l = ae(
4417
4416
  (h) => {
4418
4417
  if (Y(h)) return;
4419
4418
  const u = eu(h);
4420
4419
  Y(u) || s((m) => ro(m, u));
4421
4420
  },
4422
4421
  [s]
4423
- ), o = ie((h) => {
4422
+ ), o = ae((h) => {
4424
4423
  if (Y(h)) return;
4425
4424
  const u = Ia(h, (m) => {
4426
4425
  const y = (p) => [p.id, ...p.children ? Ia(p.children, y) : []];
4427
4426
  return y(m);
4428
4427
  });
4429
4428
  s(u);
4430
- }, [s]), d = ie(() => {
4429
+ }, [s]), d = ae(() => {
4431
4430
  s([]);
4432
4431
  }, [s]);
4433
4432
  return {
@@ -4522,12 +4521,12 @@ const Jd = () => {
4522
4521
  isExpanded: m,
4523
4522
  onToggleExpand: y
4524
4523
  }) => {
4525
- const p = oa(), { data: g } = Ge(), [, f] = Ws(), v = H(() => ve(g, { key: t.pageType }), [g, t.pageType]), x = H(() => {
4524
+ const p = oa(), { data: g } = Ge(), [, f] = Ws(), v = W(() => ve(g, { key: t.pageType }), [g, t.pageType]), x = W(() => {
4526
4525
  const C = $(t, "slug", ""), I = e ? Dt(e) : "", G = I ? C.replace(I, "") : C;
4527
4526
  return G || "/";
4528
- }, [t, e]), N = H(() => !!t.isTemplate, [t.isTemplate]), P = ie(() => {
4527
+ }, [t, e]), N = W(() => !!t.isTemplate, [t.isTemplate]), P = ae(() => {
4529
4528
  f("outline"), p($(t, "id"), a);
4530
- }, [p, a, t, f]), L = ie(
4529
+ }, [p, a, t, f]), L = ae(
4531
4530
  (C) => {
4532
4531
  C.stopPropagation(), y();
4533
4532
  },
@@ -4608,18 +4607,18 @@ const Jd = () => {
4608
4607
  }
4609
4608
  );
4610
4609
  }, au = ({ close: e }) => {
4611
- const [, t] = S([]), [s, a] = S(null), [r, i] = S(""), [l, o] = S(""), [d, h] = S(null), u = (A) => l ? String($(A, "name", "")).toLowerCase().includes(l.toLowerCase()) || String($(A, "key", "")).toLowerCase().includes(l.toLowerCase()) : !0, [m, y] = S(null), [p, g] = S(null), [f, v] = S(null), [x, N] = S(null), { data: P, isFetching: L } = On(), [C, I] = S(""), { hasPermission: G } = Pn(), { updateForSelectedPage: J, expandPagesOnSearch: ee, expandAll: D, collapseAll: F } = Rn(null), [M, q] = He(), B = M.get("page"), K = tt(null), { data: ae } = Ge(), Ae = Et("enable-add-page-dropdown"), Oe = ie((A) => {
4610
+ const [, t] = S([]), [s, a] = S(null), [r, i] = S(""), [l, o] = S(""), [d, h] = S(null), u = (A) => l ? String($(A, "name", "")).toLowerCase().includes(l.toLowerCase()) || String($(A, "key", "")).toLowerCase().includes(l.toLowerCase()) : !0, [m, y] = S(null), [p, g] = S(null), [f, v] = S(null), [x, N] = S(null), { data: P, isFetching: L } = On(), [C, I] = S(""), { hasPermission: G } = Pn(), { updateForSelectedPage: J, expandPagesOnSearch: ee, expandAll: D, collapseAll: F } = Rn(null), [M, q] = He(), B = M.get("page"), K = tt(null), { data: re } = Ge(), Ae = Et("enable-add-page-dropdown"), Oe = ae((A) => {
4612
4611
  var O;
4613
- return (O = ve(ae, { key: A })) == null ? void 0 : O.hasSlug;
4614
- }, [ae]);
4612
+ return (O = ve(re, { key: A })) == null ? void 0 : O.hasSlug;
4613
+ }, [re]);
4615
4614
  le(() => {
4616
4615
  if (!Y(C)) return;
4617
4616
  const A = sessionStorage.getItem("pageTypeFilter") || "all";
4618
- !Y(ae) && A && (ve(ae, { key: A }) ? I(A) : I("all"));
4619
- }, [ae, C]);
4617
+ !Y(re) && A && (ve(re, { key: A }) ? I(A) : I("all"));
4618
+ }, [re, C]);
4620
4619
  const me = (A) => {
4621
4620
  I(A), sessionStorage.setItem("pageTypeFilter", A), o("");
4622
- }, w = ie(
4621
+ }, w = ae(
4623
4622
  (A) => {
4624
4623
  const V = new URLSearchParams(window.location.search).get("lang"), j = new URLSearchParams({ page: A });
4625
4624
  V && j.set("lang", V), window.history.pushState({}, "", `?${j.toString()}`), q(j), window.dispatchEvent(new PopStateEvent("popstate")), e();
@@ -4632,7 +4631,7 @@ const Jd = () => {
4632
4631
  A && (A != null && A.pageType) ? t((O) => [...O, A == null ? void 0 : A.pageType]) : (window.history.replaceState(null, "", "/"), q(new URLSearchParams({})), window.dispatchEvent(new PopStateEvent("popstate")));
4633
4632
  }
4634
4633
  }, [P, B, L, q]);
4635
- const b = H(() => P ? al(P, r, C, Oe) : [], [P, r, C, Oe]);
4634
+ const b = W(() => P ? al(P, r, C, Oe) : [], [P, r, C, Oe]);
4636
4635
  le(() => {
4637
4636
  B && !L && !Y(b) && (J(b, B), K.current && K.current.scrollIntoView({
4638
4637
  behavior: "smooth",
@@ -4641,9 +4640,9 @@ const Jd = () => {
4641
4640
  }, [B, L, b, J]), le(() => {
4642
4641
  !Y(r) && !Y(b) && ee(b);
4643
4642
  }, [r, b, ee]);
4644
- const E = ie(() => {
4643
+ const E = ae(() => {
4645
4644
  D(b);
4646
- }, [D, b]), R = ie(() => {
4645
+ }, [D, b]), R = ae(() => {
4647
4646
  F();
4648
4647
  }, [F]);
4649
4648
  return /* @__PURE__ */ c("div", { className: "flex h-full flex-col justify-between", children: [
@@ -4683,25 +4682,25 @@ const Jd = () => {
4683
4682
  )
4684
4683
  ] }) }),
4685
4684
  /* @__PURE__ */ n(an, { value: "all", children: "All" }, "all"),
4686
- !Y(ye(ae, (A) => A.hasSlug && u(A))) && /* @__PURE__ */ c(de, { children: [
4685
+ !Y(ye(re, (A) => A.hasSlug && u(A))) && /* @__PURE__ */ c(de, { children: [
4687
4686
  /* @__PURE__ */ n("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: "Pages" }),
4688
4687
  Be(
4689
- [...ye(ae, (A) => A.hasSlug && u(A))].sort(
4688
+ [...ye(re, (A) => A.hasSlug && u(A))].sort(
4690
4689
  (A, O) => $(A, "name", "").localeCompare($(O, "name", ""))
4691
4690
  ),
4692
4691
  (A) => /* @__PURE__ */ n(an, { value: $(A, "key"), children: $(A, "name") }, $(A, "key"))
4693
4692
  )
4694
4693
  ] }),
4695
- !Y(ye(ae, (A) => !A.hasSlug && u(A))) && /* @__PURE__ */ c(de, { children: [
4694
+ !Y(ye(re, (A) => !A.hasSlug && u(A))) && /* @__PURE__ */ c(de, { children: [
4696
4695
  /* @__PURE__ */ n("div", { className: "mt-2 border-t px-2 py-1.5 pt-2 text-xs font-semibold text-gray-500", children: "Partials" }),
4697
4696
  Be(
4698
- [...ye(ae, (A) => !A.hasSlug && u(A))].sort(
4697
+ [...ye(re, (A) => !A.hasSlug && u(A))].sort(
4699
4698
  (A, O) => $(A, "name", "").localeCompare($(O, "name", ""))
4700
4699
  ),
4701
4700
  (A) => /* @__PURE__ */ n(an, { value: $(A, "key"), children: $(A, "name") }, $(A, "key"))
4702
4701
  )
4703
4702
  ] }),
4704
- Y(ye(ae, u)) && /* @__PURE__ */ n("div", { className: "px-3 py-2 text-center text-sm text-gray-500", children: "No matching page types found" })
4703
+ Y(ye(re, u)) && /* @__PURE__ */ n("div", { className: "px-3 py-2 text-center text-sm text-gray-500", children: "No matching page types found" })
4705
4704
  ] })
4706
4705
  ] })
4707
4706
  ] }),
@@ -5048,7 +5047,7 @@ const cu = ({ page: e }) => {
5048
5047
  selectedLanguage: i,
5049
5048
  showUntranslatedPages: l
5050
5049
  }) => {
5051
- const [o] = Vi(), d = Rt(), h = s === e.id, u = !!e.isTemplate, m = H(() => ve(t, { key: e.pageType }), [t, e.pageType]), y = o == null ? void 0 : o[e.id], { data: p } = At(y), g = p ? p == null ? void 0 : p.name : null;
5050
+ const [o] = Vi(), d = Rt(), h = s === e.id, u = !!e.isTemplate, m = W(() => ve(t, { key: e.pageType }), [t, e.pageType]), y = o == null ? void 0 : o[e.id], { data: p } = At(y), g = p ? p == null ? void 0 : p.name : null;
5052
5051
  let f = $(r, e == null ? void 0 : e.id);
5053
5052
  f = $(f, "lang") === i ? f : null;
5054
5053
  const v = i === d || !!f, x = (f == null ? void 0 : f.name) || (e == null ? void 0 : e.name) || "No name";
@@ -5058,7 +5057,7 @@ const cu = ({ page: e }) => {
5058
5057
  const C = N.split("/").pop();
5059
5058
  N = N.endsWith(C) && e.dynamic ? "" : `/${C}`;
5060
5059
  }
5061
- const L = H(() => {
5060
+ const L = W(() => {
5062
5061
  const C = "flex h-7 min-w-0 flex-1 cursor-pointer select-none items-center gap-x-1.5 rounded px-px text-xs duration-300 border-[1px]", I = `${h ? "border-primary/30 bg-primary/5" : "border-transparent hover:border-gray-200 hover:bg-gray-100"}`;
5063
5062
  return v ? `${C} ${I} ${g ? "opacity-60" : ""}` : `${C} bg-gray-100 opacity-50 group-hover:border-gray-200 border-transparent group-hover:bg-blue-100`;
5064
5063
  }, [v, h, g]);
@@ -5163,13 +5162,13 @@ const cu = ({ page: e }) => {
5163
5162
  )
5164
5163
  ] }, h.id)) });
5165
5164
  }, mu = ({ close: e }) => {
5166
- const { languages: t, setSelectedLang: s } = Fe(), { data: a } = Ge(), { data: r, isFetching: i } = On(), [l, o] = He(), { updateForSelectedPage: d, expandPagesOnSearch: h } = Rn(null), u = Rt(), m = l.get("page"), [y, p] = S(""), [g, f] = S(null), [v, x] = S(null), [N, P] = S(null), [L, C] = S(null), [I, G] = S(""), [J, ee] = S(null), [D, F] = S(null), [M, q] = S(u), [B, K] = S(!1), [, ae] = Ue(vs), Ae = B && M !== u, { data: Oe, isFetching: me } = ed(M), w = ie(
5165
+ const { languages: t, setSelectedLang: s } = Fe(), { data: a } = Ge(), { data: r, isFetching: i } = On(), [l, o] = He(), { updateForSelectedPage: d, expandPagesOnSearch: h } = Rn(null), u = Rt(), m = l.get("page"), [y, p] = S(""), [g, f] = S(null), [v, x] = S(null), [N, P] = S(null), [L, C] = S(null), [I, G] = S(""), [J, ee] = S(null), [D, F] = S(null), [M, q] = S(u), [B, K] = S(!1), [, re] = Ue(vs), Ae = B && M !== u, { data: Oe, isFetching: me } = ed(M), w = ae(
5167
5166
  (A) => {
5168
5167
  var O;
5169
5168
  return (O = ve(a, { key: A })) == null ? void 0 : O.hasSlug;
5170
5169
  },
5171
5170
  [a]
5172
- ), b = H(() => r ? Ae ? ye(r, (A) => !(Oe != null && Oe[A.id])) : al(r, y, I, w) : [], [r, w, y, I, Oe, Ae]);
5171
+ ), b = W(() => r ? Ae ? ye(r, (A) => !(Oe != null && Oe[A.id])) : al(r, y, I, w) : [], [r, w, y, I, Oe, Ae]);
5173
5172
  le(() => {
5174
5173
  if (!Y(I)) return;
5175
5174
  const A = sessionStorage.getItem("pageTypeFilter") || "all";
@@ -5181,7 +5180,7 @@ const cu = ({ page: e }) => {
5181
5180
  }, [m, i, b, d]), le(() => {
5182
5181
  !Y(y) && !Y(b) && h(b);
5183
5182
  }, [y, b, h]);
5184
- const E = ie(
5183
+ const E = ae(
5185
5184
  (A) => {
5186
5185
  const O = new URLSearchParams({ page: A });
5187
5186
  M !== u && O.set("lang", M), s(M), window.history.pushState({}, "", `?${O.toString()}`), o(O), window.dispatchEvent(new PopStateEvent("popstate")), e();
@@ -5198,7 +5197,7 @@ const cu = ({ page: e }) => {
5198
5197
  E(O);
5199
5198
  break;
5200
5199
  case "edit":
5201
- M !== u ? ae({
5200
+ M !== u ? re({
5202
5201
  edit: !0,
5203
5202
  id: O == null ? void 0 : O.id,
5204
5203
  primaryPage: O == null ? void 0 : O.primaryPage
@@ -5220,7 +5219,7 @@ const cu = ({ page: e }) => {
5220
5219
  ee(O);
5221
5220
  break;
5222
5221
  case "addLanguagePage":
5223
- ae({
5222
+ re({
5224
5223
  edit: !1,
5225
5224
  primaryPage: ((V = O == null ? void 0 : O.page) == null ? void 0 : V.id) || "",
5226
5225
  preselectedLang: (O == null ? void 0 : O.language) || M
@@ -5337,7 +5336,7 @@ const cu = ({ page: e }) => {
5337
5336
  const v = new URLSearchParams(window.location.search), x = v.get("lang");
5338
5337
  x && (a.includes(x) ? i(x) : (v.delete("lang"), o(v), i("")));
5339
5338
  }, [a, o, i]);
5340
- const [, h] = Ue(vs), { data: u } = We(), { data: m } = St(), { data: y } = pt(), p = H(() => {
5339
+ const [, h] = Ue(vs), { data: u } = We(), { data: m } = St(), { data: y } = pt(), p = W(() => {
5341
5340
  const v = Ks(
5342
5341
  Be($(m, "languages"), (x) => {
5343
5342
  const N = ve(y, { lang: x });
@@ -5584,11 +5583,11 @@ const xu = (e) => {
5584
5583
  return s.filter((l) => a.includes(l)).map((l) => ({ key: l, label: xu(l) })).filter((l) => l.key.length > 0);
5585
5584
  };
5586
5585
  function Nu({ open: e, compare: t, onOpenChange: s }) {
5587
- const a = t[0], r = t[1], [i, l] = S(null), [o, d] = S("split"), [h, u] = S(!1), [m, y] = S("blocks"), { data: p, isLoading: g } = yu(a, r), { leftData: f, rightData: v, options: x } = H(() => {
5586
+ const a = t[0], r = t[1], [i, l] = S(null), [o, d] = S("split"), [h, u] = S(!1), [m, y] = S("blocks"), { data: p, isLoading: g } = yu(a, r), { leftData: f, rightData: v, options: x } = W(() => {
5588
5587
  var F, M;
5589
5588
  const I = (F = p == null ? void 0 : p.version1) == null ? void 0 : F[m], G = (M = p == null ? void 0 : p.version2) == null ? void 0 : M[m], J = qn(I), ee = qn(G), D = wu(p == null ? void 0 : p.version1, p == null ? void 0 : p.version2);
5590
5589
  return { leftData: J, rightData: ee, options: D };
5591
- }, [p, m]), N = H(() => !f || !v ? "" : bu(f, v), [f, v]), P = H(() => {
5590
+ }, [p, m]), N = W(() => !f || !v ? "" : bu(f, v), [f, v]), P = W(() => {
5592
5591
  if (!N) return [];
5593
5592
  try {
5594
5593
  return Ic(N);
@@ -5836,7 +5835,7 @@ function Cu() {
5836
5835
  isComparisonEnabled: C
5837
5836
  }
5838
5837
  ),
5839
- (q = m == null ? void 0 : m.filter((K) => K.uid === "current")) == null ? void 0 : q.map((K, ae) => /* @__PURE__ */ n(
5838
+ (q = m == null ? void 0 : m.filter((K) => K.uid === "current")) == null ? void 0 : q.map((K, re) => /* @__PURE__ */ n(
5840
5839
  Cr,
5841
5840
  {
5842
5841
  lang: J,
@@ -5845,7 +5844,7 @@ function Cu() {
5845
5844
  isLatest: !0,
5846
5845
  onRestore: () => D(K),
5847
5846
  onDelete: () => F(K),
5848
- revisionNumber: ae,
5847
+ revisionNumber: re,
5849
5848
  compare: e,
5850
5849
  setCompare: t,
5851
5850
  pageLiveFullSlug: L,
@@ -5853,7 +5852,7 @@ function Cu() {
5853
5852
  },
5854
5853
  K.uid
5855
5854
  )),
5856
- /* @__PURE__ */ n(Ds, { className: "min-h-0 flex-1", children: /* @__PURE__ */ n("div", { className: "space-y-2", children: (B = m == null ? void 0 : m.filter((K) => K.uid !== "current")) == null ? void 0 : B.map((K, ae) => /* @__PURE__ */ n(
5855
+ /* @__PURE__ */ n(Ds, { className: "min-h-0 flex-1", children: /* @__PURE__ */ n("div", { className: "space-y-2", children: (B = m == null ? void 0 : m.filter((K) => K.uid !== "current")) == null ? void 0 : B.map((K, re) => /* @__PURE__ */ n(
5857
5856
  Cr,
5858
5857
  {
5859
5858
  lang: J,
@@ -5862,7 +5861,7 @@ function Cu() {
5862
5861
  isLatest: K.uid === "current",
5863
5862
  onRestore: () => D(K),
5864
5863
  onDelete: () => F(K),
5865
- revisionNumber: ae + 1,
5864
+ revisionNumber: re + 1,
5866
5865
  compare: e,
5867
5866
  setCompare: t,
5868
5867
  pageLiveFullSlug: L,
@@ -6200,19 +6199,19 @@ function Ru({
6200
6199
  showModal: e = !1,
6201
6200
  onClose: t = () => console.log("Cancelled")
6202
6201
  }) {
6203
- const [s] = Vi(), [a, r] = S([]), i = Rt(), [l, o] = S(i), { data: d, isFetching: h } = Du(), { data: u } = Ge(), m = ie((D) => {
6202
+ const [s] = Vi(), [a, r] = S([]), i = Rt(), [l, o] = S(i), { data: d, isFetching: h } = Du(), { data: u } = Ge(), m = ae((D) => {
6204
6203
  var F;
6205
6204
  return (F = ve(u, { key: D })) == null ? void 0 : F.hasSlug;
6206
- }, [u]), y = H(
6205
+ }, [u]), y = W(
6207
6206
  () => ye(u, (D) => !m(D.key)).map((D) => D.key),
6208
6207
  [m, u]
6209
- ), g = Pa(Be(d, "lang")).filter(Boolean), f = H(
6208
+ ), g = Pa(Be(d, "lang")).filter(Boolean), f = W(
6210
6209
  () => ye(d, (D) => D.pageType === "theme" ? !1 : l === i ? D.lang === l || D.lang === "" : D.lang === l),
6211
6210
  [d, l, i]
6212
- ), v = H(
6211
+ ), v = W(
6213
6212
  () => ye(f, (D) => !y.includes(D.pageType)),
6214
6213
  [f, y]
6215
- ), x = H(
6214
+ ), x = W(
6216
6215
  () => ye(f, (D) => y.includes(D.pageType)),
6217
6216
  [f, y]
6218
6217
  ), { mutate: N, isPending: P } = rr();
@@ -6240,7 +6239,7 @@ function Ru({
6240
6239
  if (D === "theme") return "Theme";
6241
6240
  const F = ve(u, { key: D });
6242
6241
  return F ? F == null ? void 0 : F.name : D;
6243
- }, ee = H(() => {
6242
+ }, ee = W(() => {
6244
6243
  const D = [
6245
6244
  { label: "Updated", top: "pt-2" },
6246
6245
  ...As(ye(v, { online: !0 }), "pageType"),
@@ -6387,13 +6386,13 @@ function Bu({ onClose: e }) {
6387
6386
  ] }) }) : null;
6388
6387
  }
6389
6388
  const Mu = () => {
6390
- const { selectedLang: e, fallbackLang: t } = Fe(), s = ht("getPreviewUrl", async (m) => m), [a, r] = S(""), { data: i } = We(), { data: l } = pt(), { data: o } = Ge(), d = H(
6389
+ const { selectedLang: e, fallbackLang: t } = Fe(), s = ht("getPreviewUrl", async (m) => m), [a, r] = S(""), { data: i } = We(), { data: l } = pt(), { data: o } = Ge(), d = W(
6391
6390
  () => {
6392
6391
  var m;
6393
6392
  return (m = l == null ? void 0 : l.find((y) => (y == null ? void 0 : y.lang) === e)) == null ? void 0 : m.slug;
6394
6393
  },
6395
6394
  [e, l]
6396
- ), h = ie((m) => {
6395
+ ), h = ae((m) => {
6397
6396
  var y;
6398
6397
  return (y = ve(o, { key: m })) == null ? void 0 : y.hasSlug;
6399
6398
  }, [o]), u = e === t ? "" : e;
@@ -6437,9 +6436,9 @@ const Mu = () => {
6437
6436
  window.removeEventListener("beforeunload", h);
6438
6437
  };
6439
6438
  }, [r]);
6440
- const i = ie(async () => {
6439
+ const i = ae(async () => {
6441
6440
  e || (t(!0), await a(), t(!1));
6442
- }, [a, e]), { buttonIcon: l, buttonClass: o, tooltipContent: d } = H(() => {
6441
+ }, [a, e]), { buttonIcon: l, buttonClass: o, tooltipContent: d } = W(() => {
6443
6442
  switch (r) {
6444
6443
  case "UNSAVED":
6445
6444
  return {
@@ -6467,7 +6466,7 @@ const Mu = () => {
6467
6466
  d
6468
6467
  ] });
6469
6468
  }, qu = () => {
6470
- const { selectedLang: e } = Fe(), { data: t } = Gt(), { data: s } = pt(), [a, r] = S(!1), [i, l] = S(!1), [o, d] = S(null), { savePageAsync: h } = Wt(), [u, m] = S(!1), { data: y } = We(), { mutate: p, isPending: g } = rr(), { needTranslations: f } = Wt(), v = f(), { buttonText: x, buttonClassName: N, isPublished: P } = H(() => {
6469
+ const { selectedLang: e } = Fe(), { data: t } = Gt(), { data: s } = pt(), [a, r] = S(!1), [i, l] = S(!1), [o, d] = S(null), { savePageAsync: h } = Wt(), [u, m] = S(!1), { data: y } = We(), { mutate: p, isPending: g } = rr(), { needTranslations: f } = Wt(), v = f(), { buttonText: x, buttonClassName: N, isPublished: P } = W(() => {
6471
6470
  const ee = y && (y == null ? void 0 : y.online);
6472
6471
  return {
6473
6472
  buttonClassName: ee ? "hover:bg-green-600 bg-green-500" : "",
@@ -6487,7 +6486,7 @@ const Mu = () => {
6487
6486
  m(!1), C();
6488
6487
  }, G = async () => {
6489
6488
  m(!1), await h();
6490
- }, J = H(() => Be(s ?? [], "id"), [s]);
6489
+ }, J = W(() => Be(s ?? [], "id"), [s]);
6491
6490
  return /* @__PURE__ */ c(de, { children: [
6492
6491
  /* @__PURE__ */ c("div", { className: "flex", children: [
6493
6492
  /* @__PURE__ */ c(
@@ -6779,7 +6778,7 @@ const Vu = ({
6779
6778
  /* @__PURE__ */ n(zu, {})
6780
6779
  ] }), Xu = () => {
6781
6780
  const e = ue(), { aiContext: t } = tr(), s = Z();
6782
- return ie(
6781
+ return ae(
6783
6782
  async (a, r, i, l) => s(e, {
6784
6783
  action: U.ASK_AI,
6785
6784
  data: { type: a, prompt: r, blocks: i, context: t, lang: l }
@@ -6806,7 +6805,7 @@ const Vu = ({
6806
6805
  return s;
6807
6806
  }), eh = (e) => {
6808
6807
  const t = Dc();
6809
- return H(() => {
6808
+ return W(() => {
6810
6809
  if (!e || Y(e)) return { blocks: [] };
6811
6810
  const s = ye(
6812
6811
  e,
@@ -6845,7 +6844,7 @@ const Vu = ({
6845
6844
  }));
6846
6845
  return a.forEach((r) => {
6847
6846
  Io(r.id, {
6848
- name: r.name,
6847
+ name: r.isSiteLibrary ? r.name + " (Current Site) " : r.name,
6849
6848
  description: r.description,
6850
6849
  getBlocksList: (i) => kr.getUILibraryBlocks(i, t, e),
6851
6850
  getBlock: ({ block: i }) => kr.getUILibraryBlock(i, t, e)
@@ -6886,7 +6885,7 @@ const Vu = ({
6886
6885
  }, ah = () => {
6887
6886
  const { data: e } = On(), t = ue(), s = Z();
6888
6887
  return {
6889
- getPartialBlocks: ie(async () => {
6888
+ getPartialBlocks: ae(async () => {
6890
6889
  const a = {};
6891
6890
  for (const r of e ?? [])
6892
6891
  Y(r == null ? void 0 : r.slug) && (a[r.id] = {
@@ -6896,7 +6895,7 @@ const Vu = ({
6896
6895
  });
6897
6896
  return a;
6898
6897
  }, [e]),
6899
- getPartialBlockBlocks: ie(
6898
+ getPartialBlockBlocks: ae(
6900
6899
  async (a) => {
6901
6900
  if (!a) return [];
6902
6901
  try {
@@ -7047,7 +7046,7 @@ const Vu = ({
7047
7046
  ] }) });
7048
7047
  };
7049
7048
  let Ua = rh;
7050
- const ih = () => H(() => Ua, [Ua]), Jf = (e) => {
7049
+ const ih = () => W(() => Ua, [Ua]), Jf = (e) => {
7051
7050
  Ua = e;
7052
7051
  }, lh = () => {
7053
7052
  const e = ih();
@@ -7058,7 +7057,7 @@ const ih = () => H(() => Ua, [Ua]), Jf = (e) => {
7058
7057
  }) => {
7059
7058
  const [s, a] = S(e.slug || ""), { mutate: r, isPending: i } = Id(), { data: l } = Ge(), o = ve(l, { key: e == null ? void 0 : e.pageType }), d = (u) => {
7060
7059
  if (u.preventDefault(), !(e != null && e.primaryPage) && Object.keys(Le).some((p) => s === `/${p}` || sn(s, `/${p}/`))) {
7061
- W.error("Error", {
7060
+ H.error("Error", {
7062
7061
  description: "Slugs cannot start with a language code for primary page"
7063
7062
  });
7064
7063
  return;
@@ -7129,7 +7128,7 @@ const ih = () => H(() => Ua, [Ua]), Jf = (e) => {
7129
7128
  ] })
7130
7129
  ] }) });
7131
7130
  }, ch = () => {
7132
- const [, e] = Ue(vs), { selectedLang: t, fallbackLang: s, setSelectedLang: a } = Fe(), { data: r, isFetching: i } = pt(), { data: l } = We(), { data: o } = Ge(), d = H(() => {
7131
+ const [, e] = Ue(vs), { selectedLang: t, fallbackLang: s, setSelectedLang: a } = Fe(), { data: r, isFetching: i } = pt(), { data: l } = We(), { data: o } = Ge(), d = W(() => {
7133
7132
  const x = o == null ? void 0 : o.find((N) => N.key === (l == null ? void 0 : l.pageType));
7134
7133
  return l != null && l.dynamic ? x == null ? void 0 : x.dynamicSlug : "";
7135
7134
  }, [o, l == null ? void 0 : l.pageType, l == null ? void 0 : l.dynamic]), [h, u] = S(null), [m, y] = S(null), [p, g] = S(null), { data: f } = St(), v = ye(
@@ -7377,7 +7376,7 @@ function It({
7377
7376
  }
7378
7377
  const hh = () => {
7379
7378
  const { selectedLang: e } = Fe(), { data: t, isFetching: s } = pt();
7380
- return { data: H(() => ve(t, { lang: e || "" }) || {}, [t, e]), isFetching: s };
7379
+ return { data: W(() => ve(t, { lang: e || "" }) || {}, [t, e]), isFetching: s };
7381
7380
  }, mh = () => {
7382
7381
  var l;
7383
7382
  const t = (l = document.getElementById("canvas-iframe").contentDocument) == null ? void 0 : l.body.innerHTML;
@@ -7743,13 +7742,13 @@ const hh = () => {
7743
7742
  ogDescription: $(E, "seo.ogDescription", "")
7744
7743
  // Keep jsonLD as is
7745
7744
  };
7746
- J(R), W.success(e("SEO fields reset to defaults"));
7745
+ J(R), H.success(e("SEO fields reset to defaults"));
7747
7746
  } catch (E) {
7748
- W.error(e("Failed to reset SEO fields")), console.error("Reset SEO error:", E);
7747
+ H.error(e("Failed to reset SEO fields")), console.error("Reset SEO error:", E);
7749
7748
  } finally {
7750
7749
  v(!1);
7751
7750
  }
7752
- }, ae = async () => {
7751
+ }, re = async () => {
7753
7752
  if (!(!u || !p))
7754
7753
  try {
7755
7754
  N(!0);
@@ -7757,9 +7756,9 @@ const hh = () => {
7757
7756
  ...G,
7758
7757
  jsonLD: $(E, "seo.jsonLD", "")
7759
7758
  };
7760
- J(R), W.success(e("JSON-LD reset to default"));
7759
+ J(R), H.success(e("JSON-LD reset to default"));
7761
7760
  } catch (E) {
7762
- W.error(e("Failed to reset JSON-LD")), console.error("Reset JSON-LD error:", E);
7761
+ H.error(e("Failed to reset JSON-LD")), console.error("Reset JSON-LD error:", E);
7763
7762
  } finally {
7764
7763
  N(!1);
7765
7764
  }
@@ -7775,9 +7774,9 @@ const hh = () => {
7775
7774
  ogImageId: $(E, "seo.ogImageId", ""),
7776
7775
  metaOther: $(E, "seo.metaOther", "{}")
7777
7776
  };
7778
- J(R), W.success(e("Meta Tag fields reset to defaults"));
7777
+ J(R), H.success(e("Meta Tag fields reset to defaults"));
7779
7778
  } catch (E) {
7780
- W.error(e("Failed to reset Meta Tag fields")), console.error("Reset Meta Tag error:", E);
7779
+ H.error(e("Failed to reset Meta Tag fields")), console.error("Reset Meta Tag error:", E);
7781
7780
  } finally {
7782
7781
  v(!1);
7783
7782
  }
@@ -7786,7 +7785,7 @@ const hh = () => {
7786
7785
  { id: r == null ? void 0 : r.id, seo: G, primaryPage: d },
7787
7786
  {
7788
7787
  onSuccess: () => {
7789
- console.log("SEO & JSON-LD updated successfully", G), ee.current[p] = G, W.success("SEO & JSON-LD updated successfully");
7788
+ console.log("SEO & JSON-LD updated successfully", G), ee.current[p] = G, H.success("SEO & JSON-LD updated successfully");
7790
7789
  }
7791
7790
  }
7792
7791
  );
@@ -7797,22 +7796,22 @@ const hh = () => {
7797
7796
  o.current = {
7798
7797
  id: R,
7799
7798
  position: V
7800
- }, A.tagName.toLowerCase() === "input" ? (A.value = O, J((re) => ({
7801
- ...re,
7799
+ }, A.tagName.toLowerCase() === "input" ? (A.value = O, J((ie) => ({
7800
+ ...ie,
7802
7801
  [A.name]: O
7803
- })), A.focus(), A.setSelectionRange(V, V), [0, 10, 50, 100, 200].forEach((re) => {
7802
+ })), A.focus(), A.setSelectionRange(V, V), [0, 10, 50, 100, 200].forEach((ie) => {
7804
7803
  setTimeout(() => {
7805
7804
  const z = document.getElementById(R);
7806
7805
  z && (z.focus(), z.setSelectionRange(V, V));
7807
- }, re);
7806
+ }, ie);
7808
7807
  })) : (J((Q) => ({
7809
7808
  ...Q,
7810
7809
  [A.name]: O
7811
7810
  })), requestAnimationFrame(() => {
7812
7811
  const Q = document.getElementById(R);
7813
7812
  Q && (Q.focus(), Q.setSelectionRange(V, V), setTimeout(() => {
7814
- const re = document.getElementById(R);
7815
- re && (re.focus(), re.setSelectionRange(V, V));
7813
+ const ie = document.getElementById(R);
7814
+ ie && (ie.focus(), ie.setSelectionRange(V, V));
7816
7815
  }, 50));
7817
7816
  }));
7818
7817
  }
@@ -7828,7 +7827,7 @@ const hh = () => {
7828
7827
  name: E,
7829
7828
  value: typeof R.fieldValue == "string" ? R.fieldValue.replace(/^"(.*)"$/, "$1") : R.fieldValue
7830
7829
  }
7831
- }), R.error && W.error(
7830
+ }), R.error && H.error(
7832
7831
  /* @__PURE__ */ c("div", { children: [
7833
7832
  /* @__PURE__ */ n("h2", { children: "Failed to generate:" }),
7834
7833
  /* @__PURE__ */ n("p", { children: R.error })
@@ -8180,7 +8179,7 @@ const hh = () => {
8180
8179
  variant: "outline",
8181
8180
  size: "sm",
8182
8181
  type: "button",
8183
- onClick: ae,
8182
+ onClick: re,
8184
8183
  disabled: M || !B || !u,
8185
8184
  children: e(x ? "Resetting..." : "Reset to Default")
8186
8185
  }
@@ -10170,7 +10169,7 @@ var xg = (e, t = !1) => {
10170
10169
  const t = Pl(() => {
10171
10170
  const s = this, [a] = te(this, cn), [r] = te(this, dn), [i] = te(this, un), [l] = te(this, hn), [o] = te(this, is), [d] = te(this, ln);
10172
10171
  let h;
10173
- return te(this, mn) ? h = te(this, mn) : (h = Cl(() => import("./LNWAZHJI-DzMcb01z.js")), pe(this, mn, h)), Wl(te(this, rs), te(this, on)), Al(h, Tl({
10172
+ return te(this, mn) ? h = te(this, mn) : (h = Cl(() => import("./LNWAZHJI-DZk8mvQq.js")), pe(this, mn, h)), Wl(te(this, rs), te(this, on)), Al(h, Tl({
10174
10173
  get queryFlavor() {
10175
10174
  return te(s, ss);
10176
10175
  },
@@ -10269,7 +10268,7 @@ var xg = (e, t = !1) => {
10269
10268
  const t = Pl(() => {
10270
10269
  const s = this, [a] = te(this, pn), [r] = te(this, yn), [i] = te(this, vn), [l] = te(this, bn), [o] = te(this, hs), [d] = te(this, fn), [h] = te(this, xn);
10271
10270
  let u;
10272
- return te(this, wn) ? u = te(this, wn) : (u = Cl(() => import("./MWZ6AO7Z-B6pIGphg.js")), pe(this, wn, u)), Wl(te(this, us), te(this, gn)), Al(u, Tl({
10271
+ return te(this, wn) ? u = te(this, wn) : (u = Cl(() => import("./MWZ6AO7Z-dYlyg92K.js")), pe(this, wn, u)), Wl(te(this, us), te(this, gn)), Al(u, Tl({
10273
10272
  get queryFlavor() {
10274
10273
  return te(s, cs);
10275
10274
  },
@@ -10414,7 +10413,7 @@ const sf = () => {
10414
10413
  queryFn: async () => t(e, { action: U.GET_COLLECTIONS })
10415
10414
  });
10416
10415
  }, rf = () => {
10417
- const { data: e } = We(), { data: t } = Gt(), { data: s } = St(), a = ue(), r = Z(), i = H(() => (s == null ? void 0 : s.fallbackLang) || "en", [s == null ? void 0 : s.fallbackLang]);
10416
+ const { data: e } = We(), { data: t } = Gt(), { data: s } = St(), a = ue(), r = Z(), i = W(() => (s == null ? void 0 : s.fallbackLang) || "en", [s == null ? void 0 : s.fallbackLang]);
10418
10417
  return ke({
10419
10418
  mutationFn: async ({ block: l }) => r(a, {
10420
10419
  action: U.GET_BLOCK_ASYNC_PROPS,
@@ -10439,7 +10438,7 @@ const sf = () => {
10439
10438
  });
10440
10439
  }, lf = () => {
10441
10440
  const e = oa();
10442
- return ie(
10441
+ return ae(
10443
10442
  ({ pageId: t }) => {
10444
10443
  e(t);
10445
10444
  },
@@ -10548,11 +10547,11 @@ const uf = () => {
10548
10547
  queryKey: [U.GET_ASSETS]
10549
10548
  });
10550
10549
  const i = a == null ? void 0 : a.length;
10551
- W.success(`${i === 1 ? "Asset" : i + " Assets"} uploaded successfully`);
10550
+ H.success(`${i === 1 ? "Asset" : i + " Assets"} uploaded successfully`);
10552
10551
  }
10553
10552
  },
10554
10553
  onError: () => {
10555
- W.error("Failed to upload asset");
10554
+ H.error("Failed to upload asset");
10556
10555
  }
10557
10556
  });
10558
10557
  }, hf = () => {
@@ -10567,10 +10566,10 @@ const uf = () => {
10567
10566
  throw new Error(a == null ? void 0 : a.error);
10568
10567
  t.invalidateQueries({
10569
10568
  queryKey: [U.GET_ASSETS]
10570
- }), W.success("Asset deleted successfully");
10569
+ }), H.success("Asset deleted successfully");
10571
10570
  },
10572
10571
  onError: () => {
10573
- W.error("Failed to delete asset");
10572
+ H.error("Failed to delete asset");
10574
10573
  }
10575
10574
  });
10576
10575
  }, mf = () => {
@@ -10585,10 +10584,10 @@ const uf = () => {
10585
10584
  throw new Error(a == null ? void 0 : a.error);
10586
10585
  t.invalidateQueries({
10587
10586
  queryKey: [U.GET_ASSETS]
10588
- }), W.success("Asset updated successfully");
10587
+ }), H.success("Asset updated successfully");
10589
10588
  },
10590
10589
  onError: () => {
10591
- W.error("Failed to update asset");
10590
+ H.error("Failed to update asset");
10592
10591
  }
10593
10592
  });
10594
10593
  }, ff = (e = {}) => {
@@ -10650,9 +10649,9 @@ const yf = ({
10650
10649
  var m, y, p;
10651
10650
  const { data: i, isLoading: l, isError: o } = gf(e || ""), [d, h] = S(""), u = async (g, f) => {
10652
10651
  try {
10653
- await navigator.clipboard.writeText(g), W.success(`${f} copied to clipboard`);
10652
+ await navigator.clipboard.writeText(g), H.success(`${f} copied to clipboard`);
10654
10653
  } catch (v) {
10655
- W.error(`Failed to copy ${f}`, {
10654
+ H.error(`Failed to copy ${f}`, {
10656
10655
  description: v == null ? void 0 : v.message
10657
10656
  });
10658
10657
  }
@@ -10835,7 +10834,7 @@ function vf({
10835
10834
  showPageInput: r = !0,
10836
10835
  className: i = ""
10837
10836
  }) {
10838
- const [l, o] = S(String(e)), d = H(() => {
10837
+ const [l, o] = S(String(e)), d = W(() => {
10839
10838
  const g = Math.floor(a / 2);
10840
10839
  let f = Math.max(1, e - g), v = Math.min(t, e + g);
10841
10840
  v - f + 1 < a && (f === 1 ? v = Math.min(t, f + a - 1) : v === t && (f = Math.max(1, v - a + 1)));
@@ -10948,7 +10947,7 @@ const bf = Hs.lazy(() => import("./image-editor-CzFST20j.js")), xf = 10 * 1024 *
10948
10947
  le(() => {
10949
10948
  localStorage.setItem("chai_optimize_images", l.toString());
10950
10949
  }, [l]);
10951
- const d = e || r, h = ie(
10950
+ const d = e || r, h = ae(
10952
10951
  async (g) => {
10953
10952
  try {
10954
10953
  const v = g.map(async (P) => {
@@ -10976,7 +10975,7 @@ const bf = Hs.lazy(() => import("./image-editor-CzFST20j.js")), xf = 10 * 1024 *
10976
10975
  let v = 0;
10977
10976
  return g.forEach((x) => {
10978
10977
  x.size > xf ? v++ : f.push(x);
10979
- }), v > 0 && W.error(
10978
+ }), v > 0 && H.error(
10980
10979
  `${v === 1 && g.length === 1 ? "File" : v + (v === 1 ? " file" : " files")} exceed the maximum size limit of 10MB.`
10981
10980
  ), Y(f) ? [] : h(f);
10982
10981
  }, { getRootProps: m, getInputProps: y, isDragActive: p } = Rc({
@@ -11087,7 +11086,7 @@ const bf = Hs.lazy(() => import("./image-editor-CzFST20j.js")), xf = 10 * 1024 *
11087
11086
  );
11088
11087
  };
11089
11088
  function Ql({ close: e, onSelect: t, mode: s = "image", assetId: a }) {
11090
- const l = H(() => [s], [s]), [o, d] = S(null), [h, u] = S(null), [m, y] = S(null), [p, g] = S({ show: !1, file: "" }), [f, v] = S(!1), [x, N] = S(a ? "details" : "grid"), [P, L] = S(""), [C, I] = S(""), [G, J] = S(1), [ee] = S(30), [D, F] = S([]);
11089
+ const l = W(() => [s], [s]), [o, d] = S(null), [h, u] = S(null), [m, y] = S(null), [p, g] = S({ show: !1, file: "" }), [f, v] = S(!1), [x, N] = S(a ? "details" : "grid"), [P, L] = S(""), [C, I] = S(""), [G, J] = S(1), [ee] = S(30), [D, F] = S([]);
11091
11090
  le(() => {
11092
11091
  a && (d(a), N("details"));
11093
11092
  }, [a]), le(() => {
@@ -11100,30 +11099,30 @@ function Ql({ close: e, onSelect: t, mode: s = "image", assetId: a }) {
11100
11099
  search: P.toLowerCase().trim(),
11101
11100
  page: G,
11102
11101
  limit: ee
11103
- }), B = (M == null ? void 0 : M.assets) || [], K = (M == null ? void 0 : M.total) || 0, ae = Math.ceil(K / ee);
11102
+ }), B = (M == null ? void 0 : M.assets) || [], K = (M == null ? void 0 : M.total) || 0, re = Math.ceil(K / ee);
11104
11103
  le(() => {
11105
- q || ae <= 0 || J((_) => _ > ae ? ae : _ < 1 ? 1 : _);
11106
- }, [q, ae]);
11107
- const Ae = (B == null ? void 0 : B.length) > 0, { mutate: Oe } = hf(), { mutateAsync: me, isPending: w } = uf(), { mutate: b, isPending: E } = mf(), R = ie(
11104
+ q || re <= 0 || J((_) => _ > re ? re : _ < 1 ? 1 : _);
11105
+ }, [q, re]);
11106
+ const Ae = (B == null ? void 0 : B.length) > 0, { mutate: Oe } = hf(), { mutateAsync: me, isPending: w } = uf(), { mutate: b, isPending: E } = mf(), R = ae(
11108
11107
  (_) => {
11109
- const ne = Math.min(Math.max(1, _), Math.max(1, ae));
11108
+ const ne = Math.min(Math.max(1, _), Math.max(1, re));
11110
11109
  ne !== G && J(ne);
11111
11110
  },
11112
- [ae, G]
11111
+ [re, G]
11113
11112
  ), A = (_) => {
11114
11113
  I(_.target.value);
11115
- }, O = ie(
11114
+ }, O = ae(
11116
11115
  (_) => {
11117
11116
  F((ne) => ve(ne, { id: _.id }) ? [] : [_]);
11118
11117
  },
11119
11118
  [!1]
11120
- ), V = ie(() => {
11119
+ ), V = ae(() => {
11121
11120
  F([]);
11122
11121
  }, []), j = (_) => {
11123
11122
  (_ == null ? void 0 : _.length) !== 0 && (t(fs(Jr(_ || D), ["id", "url", "width", "height", "description"])), e());
11124
11123
  }, Q = async (_) => {
11125
11124
  u(_);
11126
- }, re = async () => {
11125
+ }, ie = async () => {
11127
11126
  h && (y(h == null ? void 0 : h.id), await Oe(h.id, {
11128
11127
  onSuccess: () => {
11129
11128
  y(null), u(null);
@@ -11151,9 +11150,9 @@ function Ql({ close: e, onSelect: t, mode: s = "image", assetId: a }) {
11151
11150
  } catch (Re) {
11152
11151
  console.error("Error saving edited image:", Re);
11153
11152
  }
11154
- }, be = ie((_) => {
11153
+ }, be = ae((_) => {
11155
11154
  F([_]);
11156
- }, []), Ne = ie(
11155
+ }, []), Ne = ae(
11157
11156
  (_) => {
11158
11157
  R(_);
11159
11158
  },
@@ -11293,7 +11292,7 @@ function Ql({ close: e, onSelect: t, mode: s = "image", assetId: a }) {
11293
11292
  size: "icon",
11294
11293
  className: "h-8 w-8 rounded-full",
11295
11294
  onClick: (ne) => {
11296
- ne.stopPropagation(), navigator.clipboard.writeText(_.url), W.success("Asset URL copied to clipboard");
11295
+ ne.stopPropagation(), navigator.clipboard.writeText(_.url), H.success("Asset URL copied to clipboard");
11297
11296
  },
11298
11297
  children: /* @__PURE__ */ n(Bs, { className: "h-4 w-4" })
11299
11298
  }
@@ -11341,11 +11340,11 @@ function Ql({ close: e, onSelect: t, mode: s = "image", assetId: a }) {
11341
11340
  },
11342
11341
  _.id
11343
11342
  )) }) }),
11344
- ae > 1 && /* @__PURE__ */ n("div", { className: "absolute bottom-0 left-0 right-0 border-t bg-white p-4", children: /* @__PURE__ */ n(cf, { fallback: /* @__PURE__ */ n("div", { className: "text-red-500", children: "Error loading pagination" }), children: /* @__PURE__ */ n(
11343
+ re > 1 && /* @__PURE__ */ n("div", { className: "absolute bottom-0 left-0 right-0 border-t bg-white p-4", children: /* @__PURE__ */ n(cf, { fallback: /* @__PURE__ */ n("div", { className: "text-red-500", children: "Error loading pagination" }), children: /* @__PURE__ */ n(
11345
11344
  vf,
11346
11345
  {
11347
11346
  currentPage: G,
11348
- totalPages: ae,
11347
+ totalPages: re,
11349
11348
  onPageChange: Ne,
11350
11349
  pageRangeDisplayed: 3,
11351
11350
  showPageInput: !0
@@ -11409,7 +11408,7 @@ function Ql({ close: e, onSelect: t, mode: s = "image", assetId: a }) {
11409
11408
  ] }),
11410
11409
  /* @__PURE__ */ c(ut, { className: "gap-2 sm:gap-0", children: [
11411
11410
  /* @__PURE__ */ n(T, { variant: "outline", onClick: () => u(null), children: "Cancel" }),
11412
- /* @__PURE__ */ n(T, { variant: "destructive", onClick: re, children: "Delete" })
11411
+ /* @__PURE__ */ n(T, { variant: "destructive", onClick: ie, children: "Delete" })
11413
11412
  ] })
11414
11413
  ] }) })
11415
11414
  ] });
@@ -11897,13 +11896,13 @@ const _f = (e) => {
11897
11896
  };
11898
11897
  return window.addEventListener("visibilitychange", q), () => window.removeEventListener("visibilitychange", q);
11899
11898
  }, []), t.current = d;
11900
- const D = H(() => {
11899
+ const D = W(() => {
11901
11900
  const q = {};
11902
11901
  return i && (q.permissions = $(i, "permissions", null), q.role = $(i, "role", "user")), q;
11903
- }, [i]), F = ie(
11902
+ }, [i]), F = ae(
11904
11903
  async (q, B) => await x({ pageType: q, query: B }),
11905
11904
  [x]
11906
- ), M = H(() => $(L, "theme", {}) || {}, [L]);
11905
+ ), M = W(() => $(L, "theme", {}) || {}, [L]);
11907
11906
  return /* @__PURE__ */ c(de, { children: [
11908
11907
  /* @__PURE__ */ n(
11909
11908
  Uo,
@@ -11935,18 +11934,18 @@ const _f = (e) => {
11935
11934
  const B = t.current, K = {
11936
11935
  _type: "@chai/ai-context",
11937
11936
  _value: _a(q) ? q : ""
11938
- }, ae = [...B, K];
11939
- return await y({ page: a, blocks: ae }), v(q), !0;
11937
+ }, re = [...B, K];
11938
+ return await y({ page: a, blocks: re }), v(q), !0;
11940
11939
  },
11941
11940
  aiContext: f,
11942
11941
  askAiCallBack: m,
11943
11942
  onSave: async ({ blocks: q, theme: B, needTranslations: K }) => {
11944
11943
  if (!a) return !0;
11945
11944
  t.current = q;
11946
- const ae = {
11945
+ const re = {
11947
11946
  _type: "@chai/ai-context",
11948
11947
  _value: _a(f) ? f : ""
11949
- }, Ae = [...q, ae];
11948
+ }, Ae = [...q, re];
11950
11949
  return await y({ page: a, blocks: Ae, needTranslations: K }), t.current = Ae, Us(B, M) || await u({ settings: { theme: B } }), !0;
11951
11950
  },
11952
11951
  themePanelComponent: Od,
@@ -12014,7 +12013,7 @@ const _f = (e) => {
12014
12013
  });
12015
12014
  }, Cg = () => {
12016
12015
  const { logout: e } = ot(), { getAccessToken: t } = Gi();
12017
- return ie(
12016
+ return ae(
12018
12017
  async ({
12019
12018
  url: s,
12020
12019
  method: a = "GET",