webim-adapter 0.24.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -222,24 +222,24 @@ function C(e) {
222
222
  delete t.clipText, ae && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
223
223
  let { transitions: oe, transitionDuration: se, transitionEasing: ce, transitionProperty: le } = t, ue = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
224
224
  delete t.transitions, delete t.transitionDuration, delete t.transitionEasing, delete t.transitionProperty;
225
- let H = (Array.isArray(oe) ? oe : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${ue(e.duration ?? 200)} ${e.easing || "ease"}`);
226
- if (se !== void 0 && H.push(`${le || "all"} ${ue(se)} ${ce || "ease"}`), H.length && (t.transition = H.join(", ")), t.textDecoration !== void 0 && (t.textDecorationLine = t.textDecoration, delete t.textDecoration), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
225
+ let de = (Array.isArray(oe) ? oe : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${ue(e.duration ?? 200)} ${e.easing || "ease"}`);
226
+ if (se !== void 0 && de.push(`${le || "all"} ${ue(se)} ${ce || "ease"}`), de.length && (t.transition = de.join(", ")), t.textDecoration !== void 0 && (t.textDecorationLine = t.textDecoration, delete t.textDecoration), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
227
227
  let e = `${i || "rgba(0,0,0,0.5)"}, ${a || "transparent"}`, o = n === "radial" ? `radial-gradient(circle, ${e})` : `linear-gradient(${r ?? 180}deg, ${e})`;
228
228
  t.backgroundImage = t.backgroundImage ? `${o}, ${t.backgroundImage}` : o;
229
229
  }
230
230
  delete t.backgroundVideo;
231
- let { overlayColor: U, overlayOpacity: de } = t;
232
- if (delete t.overlayColor, delete t.overlayOpacity, U) {
233
- let e = `color-mix(in srgb, ${U} ${de ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
231
+ let { overlayColor: H, overlayOpacity: U } = t;
232
+ if (delete t.overlayColor, delete t.overlayOpacity, H) {
233
+ let e = `color-mix(in srgb, ${H} ${U ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
234
234
  t.backgroundImage = t.backgroundImage ? `${n}, ${t.backgroundImage}` : n;
235
235
  }
236
236
  t.backgroundImage && (t.backgroundSize ??= "cover", t.backgroundPosition ??= "center", t.backgroundRepeat ??= "no-repeat");
237
- let { backgroundLayers: fe } = t;
237
+ let { backgroundLayers: W } = t;
238
238
  delete t.backgroundLayers;
239
- let pe = (Array.isArray(fe) ? fe : []).filter((e) => e && e.on !== !1);
240
- if (pe.length) {
239
+ let fe = (Array.isArray(W) ? W : []).filter((e) => e && e.on !== !1);
240
+ if (fe.length) {
241
241
  let e = [], n = [], r = [], i = [], a = [];
242
- for (let t of pe) if (t.kind === "linear") e.push(`linear-gradient(${t.angle ?? 180}deg, ${t.from || "rgba(0,0,0,0.5)"}, ${t.to || "transparent"})`), n.push("auto"), r.push("0% 0%"), i.push("repeat"), a.push("scroll");
242
+ for (let t of fe) if (t.kind === "linear") e.push(`linear-gradient(${t.angle ?? 180}deg, ${t.from || "rgba(0,0,0,0.5)"}, ${t.to || "transparent"})`), n.push("auto"), r.push("0% 0%"), i.push("repeat"), a.push("scroll");
243
243
  else if (t.kind === "radial") e.push(`radial-gradient(circle, ${t.from || "rgba(0,0,0,0.5)"}, ${t.to || "transparent"})`), n.push("auto"), r.push("0% 0%"), i.push("repeat"), a.push("scroll");
244
244
  else {
245
245
  if (!t.src) continue;
@@ -323,7 +323,9 @@ function F(e, t) {
323
323
  }
324
324
  var I = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", L = {
325
325
  light: {
326
- background: "#ffffff",
326
+ background: "#f2f2f2",
327
+ surface: "#f2f2f2",
328
+ border: "#d1d5db",
327
329
  text: "#111827",
328
330
  accent: "#111827",
329
331
  accentText: "#ffffff",
@@ -342,6 +344,8 @@ var I = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Ari
342
344
  },
343
345
  dark: {
344
346
  background: "#0f172a",
347
+ surface: "#1e293b",
348
+ border: "rgba(226, 232, 240, 0.18)",
345
349
  text: "#e2e8f0",
346
350
  accent: "#6366f1",
347
351
  accentText: "#ffffff",
@@ -412,6 +416,8 @@ function B(e) {
412
416
  function V(e) {
413
417
  return {
414
418
  "--page-bg": e.background,
419
+ "--page-surface": e.surface ?? e.background,
420
+ "--page-border": e.border ?? L.light.border,
415
421
  "--page-text": e.text,
416
422
  "--page-accent": e.accent,
417
423
  "--page-accent-text": e.accentText,
@@ -444,9 +450,12 @@ function re(e, t = "light") {
444
450
  function ie(e, t) {
445
451
  return e?.themeRef && t?.[e.themeRef] || e?.theme;
446
452
  }
453
+ function ae(e, t) {
454
+ return e === "light" || e === "dark" ? e : t === "light" || t === "dark" ? t : "auto";
455
+ }
447
456
  //#endregion
448
457
  //#region src/bundle.js
449
- function ae({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
458
+ function oe({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
450
459
  let a = {
451
460
  ...t?.global ?? {},
452
461
  ...t?.tenant ?? {}
@@ -461,6 +470,7 @@ function ae({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
461
470
  custom: o.custom,
462
471
  seo: o.seo,
463
472
  direction: o.direction,
473
+ scheme: o.scheme,
464
474
  locale: i || a.locales?.default,
465
475
  locales: a.locales,
466
476
  tenant: n ?? "",
@@ -470,18 +480,18 @@ function ae({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
470
480
  }
471
481
  //#endregion
472
482
  //#region src/fetchPage.js
473
- var oe = async (e) => {
483
+ var se = async (e) => {
474
484
  let t = await e.json().catch(() => null);
475
485
  if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
476
486
  return t?.payload ?? t;
477
487
  };
478
- async function se({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token: a, page: o, fetch: s }) {
488
+ async function ce({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token: a, page: o, fetch: s }) {
479
489
  if (!e) throw Error("fetchPage: apiUrl is required");
480
490
  if (!n) throw Error("fetchPage: slug is required");
481
491
  let c = s ?? fetch, l = e.replace(/\/$/, ""), u = {
482
492
  ...t ? { "x-tenant": t } : {},
483
493
  ...a ? { authorization: `Bearer ${a}` } : {}
484
- }, [d, f] = await Promise.all([c(`${l}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: u }).then(oe), c(`${l}/settings/public`, { headers: u }).then(oe)]), p = ae({
494
+ }, [d, f] = await Promise.all([c(`${l}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: u }).then(se), c(`${l}/settings/public`, { headers: u }).then(se)]), p = oe({
485
495
  page: d,
486
496
  settings: f,
487
497
  tenant: t,
@@ -489,7 +499,7 @@ async function se({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token:
489
499
  locale: r
490
500
  }), m = [...new Set(Object.values(p.blocks ?? {}).map((e) => e?.type?.resolvedName === "CollectionList" ? e.props?.collection : e?.type?.resolvedName === "TableBlock" || e?.type?.resolvedName === "OrgChartBlock" ? e.props?.source : null).filter(Boolean))];
491
501
  if (m.length) {
492
- let e = (e) => e.startsWith("api:") ? `${l}/data/${encodeURIComponent(e.slice(4))}` : `${l}/dynamic/${encodeURIComponent(e)}?all=1${r ? `&locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(m.map((t) => c(e(t), { headers: u }).then(oe).then((e) => {
502
+ let e = (e) => e.startsWith("api:") ? `${l}/data/${encodeURIComponent(e.slice(4))}` : `${l}/dynamic/${encodeURIComponent(e)}?all=1${r ? `&locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(m.map((t) => c(e(t), { headers: u }).then(se).then((e) => {
493
503
  let n = Array.isArray(e) ? e : Array.isArray(e?.data) ? e.data : [], r = Number(e?.total?.filtered ?? e?.total?.all ?? n.length);
494
504
  return [[t, n], [`${t}:total`, Number.isFinite(r) ? r : n.length]];
495
505
  }).catch(() => [[t, []]])));
@@ -503,7 +513,7 @@ async function se({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, token:
503
513
  }
504
514
  //#endregion
505
515
  //#region ../ui/src/components/builder/locale.js
506
- var ce = /* @__PURE__ */ new Set([
516
+ var le = /* @__PURE__ */ new Set([
507
517
  "ar",
508
518
  "he",
509
519
  "fa",
@@ -514,12 +524,12 @@ var ce = /* @__PURE__ */ new Set([
514
524
  "yi",
515
525
  "dv",
516
526
  "ckb"
517
- ]), le = (e) => ce.has(String(e || "").toLowerCase().split(/[-_]/)[0]) ? "rtl" : "ltr", ue = (e, t) => e === "ltr" || e === "rtl" ? e : t ? le(t) : void 0, H = t({
527
+ ]), ue = (e) => le.has(String(e || "").toLowerCase().split(/[-_]/)[0]) ? "rtl" : "ltr", de = (e, t) => e === "ltr" || e === "rtl" ? e : t ? ue(t) : void 0, H = t({
518
528
  tenant: "",
519
529
  apiUrl: "/api",
520
530
  locale: "",
521
531
  settings: null
522
- }), U = t(null), de = (e) => {
532
+ }), U = t(null), W = (e) => {
523
533
  let t = Number(e?.__page);
524
534
  if (Number.isFinite(t) && t >= 1) return Math.floor(t);
525
535
  if (typeof window > "u") return 1;
@@ -538,7 +548,7 @@ var ce = /* @__PURE__ */ new Set([
538
548
  };
539
549
  return Object.fromEntries(Object.entries(t).filter(([, e]) => typeof e == "string" && e.trim() !== ""));
540
550
  }, me = t(null), he = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
541
- function W(e, t) {
551
+ function G(e, t) {
542
552
  if (t) return t.includes(".") ? t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e) : e?.[t];
543
553
  }
544
554
  var ge = (e) => {
@@ -551,13 +561,13 @@ var ge = (e) => {
551
561
  }
552
562
  return t;
553
563
  };
554
- function G(e) {
564
+ function K(e) {
555
565
  return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : typeof e == "object" && !Array.isArray(e) && ("label" in e || "name" in e || "slug" in e) ? String(e.label ?? e.name ?? e.slug ?? "") : typeof e == "object" && !Array.isArray(e) && Number.isFinite(Number(e.lat)) && Number.isFinite(Number(e.lng)) ? `${e.lat}, ${e.lng}` : Array.isArray(e) ? e.map((e) => typeof e == "string" ? e : Array.isArray(e?.parts) ? e.parts.map((e) => e?.text ?? "").join("") : Array.isArray(e?.items) ? e.items.map((e) => e?.text ?? "").join(" ") : e && (e.label != null || e.name != null || e.slug != null) ? String(e.label ?? e.name ?? e.slug) : "").filter(Boolean).join(" ") : "";
556
566
  }
557
567
  function _e(e, t) {
558
568
  let n = t?.data ?? {}, r = ge(n);
559
569
  if (!r.length) return e;
560
- let i = RegExp(`:(${r.map(he).sort((e, t) => t.length - e.length).join("|")})`, "g"), a = (e) => typeof e == "string" ? e.replace(i, (e, t) => G(W(n, t))) : Array.isArray(e) ? e.map(a) : e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, a(t)])) : e;
570
+ let i = RegExp(`:(${r.map(he).sort((e, t) => t.length - e.length).join("|")})`, "g"), a = (e) => typeof e == "string" ? e.replace(i, (e, t) => K(G(n, t))) : Array.isArray(e) ? e.map(a) : e && typeof e == "object" ? Object.fromEntries(Object.entries(e).map(([e, t]) => [e, a(t)])) : e;
561
571
  return a(e);
562
572
  }
563
573
  var ve = {
@@ -565,7 +575,7 @@ var ve = {
565
575
  fontWeight: 700,
566
576
  lineHeight: 1.2,
567
577
  fontFamily: "var(--page-heading-font, inherit)"
568
- }, ye = { margin: 0 }, K = {
578
+ }, ye = { margin: 0 }, q = {
569
579
  display: "inline-block",
570
580
  textDecoration: "none",
571
581
  cursor: "pointer",
@@ -652,7 +662,7 @@ function De({ text: e, parts: t, tag: n = "h2", style: r, linked: i, nodeRef: a
652
662
  ...ve,
653
663
  ...C(r)
654
664
  },
655
- children: q(t, e, i)
665
+ children: J(t, e, i)
656
666
  });
657
667
  }
658
668
  var Oe = {
@@ -675,10 +685,10 @@ function ke(e, t = [], n, r) {
675
685
  children: i
676
686
  })), i;
677
687
  }
678
- function q(t, n, r) {
688
+ function J(t, n, r) {
679
689
  return t?.length ? t.map((t, n) => {
680
690
  if (t.slot) return /* @__PURE__ */ u(e, { children: r?.[t.slot] ?? null }, n);
681
- if (t.parts) return /* @__PURE__ */ u(e, { children: q(t.parts, "", r) }, n);
691
+ if (t.parts) return /* @__PURE__ */ u(e, { children: J(t.parts, "", r) }, n);
682
692
  let i = t.text;
683
693
  return t.sup ? i = /* @__PURE__ */ u("sup", { children: i }) : t.sub && (i = /* @__PURE__ */ u("sub", { children: i })), t.code && (i = /* @__PURE__ */ u("code", {
684
694
  style: Oe,
@@ -701,7 +711,7 @@ function q(t, n, r) {
701
711
  function Ae({ parts: e, text: t, marks: n, href: r, target: i, style: a }) {
702
712
  return /* @__PURE__ */ u("span", {
703
713
  style: C(a),
704
- children: e?.length ? q(e, t) : ke(t, n, r, i)
714
+ children: e?.length ? J(e, t) : ke(t, n, r, i)
705
715
  });
706
716
  }
707
717
  var je = {
@@ -747,7 +757,7 @@ function Me({ align: e = "center", width: t, wrap: n } = {}) {
747
757
  };
748
758
  }
749
759
  function Ne(e = [], t, n) {
750
- let r = n ?? ((e, n) => q(e, n, t));
760
+ let r = n ?? ((e, n) => J(e, n, t));
751
761
  return e.map((t, n) => {
752
762
  let i = {
753
763
  marginTop: 0,
@@ -906,7 +916,7 @@ function Ie({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
906
916
  ...Fe,
907
917
  ...C(n)
908
918
  },
909
- children: q(t, e, r)
919
+ children: J(t, e, r)
910
920
  });
911
921
  }
912
922
  function Le({ ordered: e, items: t = [], style: n, nodeRef: r }) {
@@ -919,7 +929,7 @@ function Le({ ordered: e, items: t = [], style: n, nodeRef: r }) {
919
929
  },
920
930
  children: t.map((e, t) => /* @__PURE__ */ u("li", {
921
931
  style: { marginBottom: 4 },
922
- children: q(e.parts, e.text)
932
+ children: J(e.parts, e.text)
923
933
  }, t))
924
934
  });
925
935
  }
@@ -930,7 +940,7 @@ function Re({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
930
940
  ...ye,
931
941
  ...C(n)
932
942
  },
933
- children: q(t, e, r)
943
+ children: J(t, e, r)
934
944
  });
935
945
  }
936
946
  var ze = {
@@ -949,7 +959,7 @@ function Be({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRe
949
959
  ...ze,
950
960
  ...C(i)
951
961
  },
952
- children: q(t, e, a)
962
+ children: J(t, e, a)
953
963
  });
954
964
  }
955
965
  function Ve({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
@@ -959,10 +969,10 @@ function Ve({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRe
959
969
  target: r || void 0,
960
970
  rel: r === "_blank" ? "noopener noreferrer" : void 0,
961
971
  style: {
962
- ...K,
972
+ ...q,
963
973
  ...C(i)
964
974
  },
965
- children: q(t, e, a)
975
+ children: J(t, e, a)
966
976
  });
967
977
  }
968
978
  function He({ src: e, alt: t, style: n, nodeRef: r }) {
@@ -1486,7 +1496,7 @@ var it = {
1486
1496
  fontSize: 14,
1487
1497
  opacity: .85
1488
1498
  }, at = {
1489
- background: "var(--page-bg, #ffffff)",
1499
+ background: "var(--page-surface, #f2f2f2)",
1490
1500
  color: "var(--page-text, #111827)",
1491
1501
  border: "1px solid rgba(148, 163, 184, 0.25)",
1492
1502
  boxShadow: "0 16px 40px rgba(15, 23, 42, 0.16)",
@@ -1777,27 +1787,27 @@ var lt = {
1777
1787
  display: "flex",
1778
1788
  flexDirection: "column",
1779
1789
  gap: "12px"
1780
- }, J = {
1790
+ }, Y = {
1781
1791
  fontSize: "14px",
1782
1792
  fontWeight: 500,
1783
1793
  color: "var(--page-text, #111827)"
1784
- }, Y = {
1794
+ }, X = {
1785
1795
  padding: "10px 12px",
1786
- border: "1px solid #d1d5db",
1796
+ border: "1px solid var(--page-border, #d1d5db)",
1787
1797
  borderRadius: "6px",
1788
1798
  fontSize: "14px",
1789
1799
  fontFamily: "inherit",
1790
1800
  width: "100%",
1791
1801
  boxSizing: "border-box",
1792
- backgroundColor: "#ffffff",
1793
- color: "#111827"
1802
+ backgroundColor: "var(--page-surface, #f2f2f2)",
1803
+ color: "var(--page-text, #111827)"
1794
1804
  }, ut = {
1795
1805
  display: "flex",
1796
1806
  alignItems: "center",
1797
1807
  gap: "8px",
1798
1808
  fontSize: "14px",
1799
1809
  color: "var(--page-text, #111827)"
1800
- }, X = (e) => e ? {
1810
+ }, Z = (e) => e ? {
1801
1811
  readOnly: !0,
1802
1812
  tabIndex: -1,
1803
1813
  onMouseDown: (e) => e.preventDefault()
@@ -1840,7 +1850,7 @@ function mt(e, t) {
1840
1850
  function ht({ field: e, value: t, onChange: n, inert: r, values: i }) {
1841
1851
  let a = /* @__PURE__ */ d("span", {
1842
1852
  style: {
1843
- ...J,
1853
+ ...Y,
1844
1854
  fontSize: 14
1845
1855
  },
1846
1856
  children: [e.label, e.required ? " *" : ""]
@@ -2071,7 +2081,7 @@ function gt({ style: e, action: t, method: n, name: a, enctype: o, formSlug: s,
2071
2081
  disabled: h || void 0,
2072
2082
  onClick: () => k(F - 1),
2073
2083
  style: {
2074
- ...K,
2084
+ ...q,
2075
2085
  background: "transparent",
2076
2086
  color: "inherit",
2077
2087
  border: 0,
@@ -2084,7 +2094,7 @@ function gt({ style: e, action: t, method: n, name: a, enctype: o, formSlug: s,
2084
2094
  disabled: h || L.length > 0,
2085
2095
  onClick: () => k(F + 1),
2086
2096
  style: {
2087
- ...K,
2097
+ ...q,
2088
2098
  border: 0,
2089
2099
  padding: "10px 22px",
2090
2100
  borderRadius: 8,
@@ -2098,7 +2108,7 @@ function gt({ style: e, action: t, method: n, name: a, enctype: o, formSlug: s,
2098
2108
  type: "submit",
2099
2109
  disabled: h || void 0,
2100
2110
  style: {
2101
- ...K,
2111
+ ...q,
2102
2112
  border: 0,
2103
2113
  padding: "10px 22px",
2104
2114
  borderRadius: 8,
@@ -2125,10 +2135,10 @@ function gt({ style: e, action: t, method: n, name: a, enctype: o, formSlug: s,
2125
2135
  ]
2126
2136
  });
2127
2137
  }
2128
- var Z = null, _t = null, vt = (e) => {
2138
+ var Q = null, _t = null, vt = (e) => {
2129
2139
  let t = typeof e == "string" && e.trim() ? e.trim() : "";
2130
- if (Z && _t === t) return Z;
2131
- if (Z && typeof window < "u") {
2140
+ if (Q && _t === t) return Q;
2141
+ if (Q && typeof window < "u") {
2132
2142
  for (let e of ["grecaptcha", "___grecaptcha_cfg"]) try {
2133
2143
  delete window[e];
2134
2144
  } catch {
@@ -2136,13 +2146,13 @@ var Z = null, _t = null, vt = (e) => {
2136
2146
  }
2137
2147
  document.querySelectorAll("script[src*=\"recaptcha\"]").forEach((e) => e.remove());
2138
2148
  }
2139
- return _t = t, Z = new Promise((e) => {
2149
+ return _t = t, Q = new Promise((e) => {
2140
2150
  if (typeof window > "u") return;
2141
2151
  if (window.grecaptcha?.render) return e(window.grecaptcha);
2142
2152
  window.__webimRecaptchaReady = () => e(window.grecaptcha);
2143
2153
  let n = document.createElement("script");
2144
2154
  n.src = `https://www.google.com/recaptcha/api.js?onload=__webimRecaptchaReady&render=explicit${t ? `&hl=${encodeURIComponent(t)}` : ""}`, n.async = !0, document.head.appendChild(n);
2145
- }), Z;
2155
+ }), Q;
2146
2156
  };
2147
2157
  function yt({ siteKey: e, theme: t, size: n, hl: a, style: o, nodeRef: c, inert: l, onChange: f }) {
2148
2158
  let p = r(H), m = p?.settings && typeof p.settings == "object" ? p.settings["google.recaptchaKey"] : "", h = typeof e == "string" && e.trim() || (typeof m == "string" ? m.trim() : ""), g = s(null), _ = s(f);
@@ -2237,10 +2247,10 @@ function bt({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
2237
2247
  return /* @__PURE__ */ u("label", {
2238
2248
  ref: r,
2239
2249
  style: {
2240
- ...J,
2250
+ ...Y,
2241
2251
  ...C(n)
2242
2252
  },
2243
- children: q(t, e, i)
2253
+ children: J(t, e, i)
2244
2254
  });
2245
2255
  }
2246
2256
  function xt({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
@@ -2251,10 +2261,10 @@ function xt({ type: e = "text", name: t, placeholder: n, required: r, style: i,
2251
2261
  placeholder: n,
2252
2262
  required: !o && !!r,
2253
2263
  style: {
2254
- ...Y,
2264
+ ...X,
2255
2265
  ...C(i)
2256
2266
  },
2257
- ...X(o)
2267
+ ...Z(o)
2258
2268
  });
2259
2269
  }
2260
2270
  function St({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
@@ -2265,11 +2275,11 @@ function St({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeR
2265
2275
  rows: n,
2266
2276
  required: !o && !!r,
2267
2277
  style: {
2268
- ...Y,
2278
+ ...X,
2269
2279
  resize: "vertical",
2270
2280
  ...C(i)
2271
2281
  },
2272
- ...X(o)
2282
+ ...Z(o)
2273
2283
  });
2274
2284
  }
2275
2285
  function Ct({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: s }) {
@@ -2302,7 +2312,7 @@ function wt({ name: e, placeholder: t, options: n = [], required: r, style: i, n
2302
2312
  onMouseDown: o ? (e) => e.preventDefault() : void 0,
2303
2313
  tabIndex: o ? -1 : void 0,
2304
2314
  style: {
2305
- ...Y,
2315
+ ...X,
2306
2316
  appearance: "auto",
2307
2317
  ...C(i)
2308
2318
  },
@@ -2321,7 +2331,7 @@ function Tt({ name: e, accept: t, required: n, text: r = "Choose a file…", sty
2321
2331
  return /* @__PURE__ */ d("label", {
2322
2332
  ref: a,
2323
2333
  style: {
2324
- ...Y,
2334
+ ...X,
2325
2335
  display: "flex",
2326
2336
  alignItems: "center",
2327
2337
  gap: "8px",
@@ -2353,7 +2363,7 @@ function Et({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
2353
2363
  ref: n,
2354
2364
  type: r ? "button" : "submit",
2355
2365
  style: {
2356
- ...K,
2366
+ ...q,
2357
2367
  border: 0,
2358
2368
  cursor: "pointer",
2359
2369
  alignSelf: "flex-start",
@@ -2394,7 +2404,7 @@ function Ot({ collection: e, limit: t = 6, layout: n = "grid", columns: a = 3, i
2394
2404
  window.removeEventListener("popstate", e), window.removeEventListener("webim:urlchange", e);
2395
2405
  };
2396
2406
  }, []);
2397
- let T = pe(h), E = JSON.stringify(T), D = E !== "{}" && !e?.startsWith?.("api:"), O = D ? null : S?.[e], k = m ? de(S) : 1, [A, j] = c(null);
2407
+ let T = pe(h), E = JSON.stringify(T), D = E !== "{}" && !e?.startsWith?.("api:"), O = D ? null : S?.[e], k = m ? W(S) : 1, [A, j] = c(null);
2398
2408
  if (i(() => {
2399
2409
  if (!e || O) return;
2400
2410
  let n = !0, r = new URLSearchParams();
@@ -2449,7 +2459,7 @@ function Ot({ collection: e, limit: t = 6, layout: n = "grid", columns: a = 3, i
2449
2459
  ...C(g)
2450
2460
  },
2451
2461
  children: N.map((e) => {
2452
- let t = o ? W(e?.data, o) : null, r = s ? G(W(e?.data, s)) : null, i = l ? W(e?.data, l) : null, a = Array.isArray(i) ? i : null, c = a || i == null ? null : G(i), f = n === "list";
2462
+ let t = o ? G(e?.data, o) : null, r = s ? K(G(e?.data, s)) : null, i = l ? G(e?.data, l) : null, a = Array.isArray(i) ? i : null, c = a || i == null ? null : K(i), f = n === "list";
2453
2463
  return /* @__PURE__ */ d("div", {
2454
2464
  style: {
2455
2465
  display: "flex",
@@ -2510,7 +2520,7 @@ function kt({ fields: e = [], buttonLabel: t = "Search", style: n, nodeRef: r, i
2510
2520
  padding: "0 12px",
2511
2521
  borderRadius: 8,
2512
2522
  border: "1px solid var(--page-border, rgba(100, 116, 139, 0.4))",
2513
- background: "var(--page-bg, #ffffff)",
2523
+ background: "var(--page-surface, #f2f2f2)",
2514
2524
  color: "var(--page-text, #111827)",
2515
2525
  fontSize: 13,
2516
2526
  fontFamily: "inherit",
@@ -2553,7 +2563,7 @@ function kt({ fields: e = [], buttonLabel: t = "Search", style: n, nodeRef: r, i
2553
2563
  name: `f_${e.name}`,
2554
2564
  defaultValue: o[e.name] ?? "",
2555
2565
  style: s,
2556
- ...X(i),
2566
+ ...Z(i),
2557
2567
  children: [/* @__PURE__ */ u("option", {
2558
2568
  value: "",
2559
2569
  children: e.label || e.name
@@ -2568,7 +2578,7 @@ function kt({ fields: e = [], buttonLabel: t = "Search", style: n, nodeRef: r, i
2568
2578
  name: `f_${e.name}`,
2569
2579
  defaultValue: o[e.name] ?? "",
2570
2580
  style: s,
2571
- ...X(i),
2581
+ ...Z(i),
2572
2582
  children: [
2573
2583
  /* @__PURE__ */ u("option", {
2574
2584
  value: "",
@@ -2589,7 +2599,7 @@ function kt({ fields: e = [], buttonLabel: t = "Search", style: n, nodeRef: r, i
2589
2599
  defaultValue: o[e.name] ?? "",
2590
2600
  placeholder: e.label || e.name,
2591
2601
  style: s,
2592
- ...X(i)
2602
+ ...Z(i)
2593
2603
  }, e.name)), /* @__PURE__ */ u("button", {
2594
2604
  type: "submit",
2595
2605
  style: {
@@ -2602,7 +2612,7 @@ function kt({ fields: e = [], buttonLabel: t = "Search", style: n, nodeRef: r, i
2602
2612
  fontWeight: 600,
2603
2613
  cursor: i ? "default" : "pointer"
2604
2614
  },
2605
- ...X(i),
2615
+ ...Z(i),
2606
2616
  children: t
2607
2617
  })]
2608
2618
  });
@@ -2677,7 +2687,7 @@ function jt({ pages: e = 5, current: t = 1, prevNext: n = !0, href: a = "#", sou
2677
2687
  ]);
2678
2688
  let S = Math.max(1, Number(s) || 6), w = Number.isFinite(x) ? x : y;
2679
2689
  if (o && w === null || o && f && !(w > 0)) return null;
2680
- let T = Math.min(Math.max(o ? Math.ceil(w / S) : Number(e) || 1, 1), 50), E = Math.min(Math.max(o ? de(v) : Number(t) || 1, 1), T), D = (e) => {
2690
+ let T = Math.min(Math.max(o ? Math.ceil(w / S) : Number(e) || 1, 1), 50), E = Math.min(Math.max(o ? W(v) : Number(t) || 1, 1), T), D = (e) => {
2681
2691
  if (o) {
2682
2692
  if (typeof window < "u") {
2683
2693
  let t = new URLSearchParams(window.location.search);
@@ -2782,7 +2792,7 @@ var Mt = "webim.page_mode", Nt = () => {
2782
2792
  rx: "2"
2783
2793
  }), /* @__PURE__ */ u("path", { d: "M8 21h8M12 17v4" })]
2784
2794
  });
2785
- }, Q = {
2795
+ }, $ = {
2786
2796
  light: "Light theme",
2787
2797
  dark: "Dark theme",
2788
2798
  auto: "Follow the device theme"
@@ -2831,8 +2841,8 @@ function Ft({ variant: e, showSystem: t, style: n, nodeRef: r, inert: a }) {
2831
2841
  },
2832
2842
  children: p.map((e) => /* @__PURE__ */ u("button", {
2833
2843
  type: "button",
2834
- title: Q[e],
2835
- "aria-label": Q[e],
2844
+ title: $[e],
2845
+ "aria-label": $[e],
2836
2846
  "aria-pressed": e === m,
2837
2847
  onClick: a ? void 0 : () => l(e),
2838
2848
  style: {
@@ -2850,8 +2860,8 @@ function Ft({ variant: e, showSystem: t, style: n, nodeRef: r, inert: a }) {
2850
2860
  return /* @__PURE__ */ u("button", {
2851
2861
  ref: f,
2852
2862
  type: "button",
2853
- title: Q[m],
2854
- "aria-label": `Theme: ${Q[m]} — switch to ${Q[g]}`,
2863
+ title: $[m],
2864
+ "aria-label": `Theme: ${$[m]} — switch to ${$[g]}`,
2855
2865
  onClick: a ? void 0 : () => l(g),
2856
2866
  style: {
2857
2867
  ...h,
@@ -3145,7 +3155,7 @@ var Ht = (e, t) => {
3145
3155
  return .299 * (r >> 16 & 255) + .587 * (r >> 8 & 255) + .114 * (r & 255) > 150 ? "#111827" : "#ffffff";
3146
3156
  }, Wt = (e) => !!(e?.cv?.trim?.() || e?.photo);
3147
3157
  function Gt(e, t = {}) {
3148
- let n = Array.isArray(e) ? e.filter((e) => e && typeof e == "object" && e.id) : [], r = (e) => Array.isArray(e) ? e[0] : e, i = (e) => e == null ? "" : G(e);
3158
+ let n = Array.isArray(e) ? e.filter((e) => e && typeof e == "object" && e.id) : [], r = (e) => Array.isArray(e) ? e[0] : e, i = (e) => e == null ? "" : K(e);
3149
3159
  return n.map((e) => {
3150
3160
  let n = e.data ?? {}, a = r(n[t.parentField]), o = a && typeof a == "object" ? a.id ?? null : a || null;
3151
3161
  return {
@@ -3187,7 +3197,7 @@ function qt({ node: e, onClose: t }) {
3187
3197
  children: /* @__PURE__ */ d("div", {
3188
3198
  onClick: (e) => e.stopPropagation(),
3189
3199
  style: {
3190
- background: "var(--page-bg, #ffffff)",
3200
+ background: "var(--page-surface, #f2f2f2)",
3191
3201
  color: "var(--page-text, #111827)",
3192
3202
  border: "1px solid rgba(148, 163, 184, 0.35)",
3193
3203
  borderRadius: 14,
@@ -3474,7 +3484,7 @@ function Jt({ nodes: e = [], source: t, nameField: n, titleField: o, photoField:
3474
3484
  });
3475
3485
  }
3476
3486
  function Yt({ columns: e = [], rows: t = [], source: n, limit: a = 10, striped: o = !0, bordered: s = !1, compact: l = !1, paged: f, emptyText: p, style: m, nodeRef: h }) {
3477
- let { tenant: g, apiUrl: _ } = r(H), v = r(U), y = v?.[n], b = f ? de(v) : 1, [x, S] = c(null);
3487
+ let { tenant: g, apiUrl: _ } = r(H), v = r(U), y = v?.[n], b = f ? W(v) : 1, [x, S] = c(null);
3478
3488
  if (i(() => {
3479
3489
  if (!n || y) return;
3480
3490
  let e = !0, t = Math.max(1, Number(a) || 10), r = f && !n.startsWith("api:") ? `?offset=${(b - 1) * t}&limit=${t}` : "", i = n.startsWith("api:") ? `${_}/data/${encodeURIComponent(n.slice(4))}` : `${_}/dynamic/${encodeURIComponent(n)}${r}`;
@@ -3493,7 +3503,7 @@ function Yt({ columns: e = [], rows: t = [], source: n, limit: a = 10, striped:
3493
3503
  b,
3494
3504
  a
3495
3505
  ]), !e.length) return null;
3496
- let w = Math.max(1, Number(a) || 10), T = n ? f ? y || n.startsWith("api:") ? (y ?? x ?? []).slice((b - 1) * w, b * w) : (x ?? []).slice(0, w) : (y ?? x ?? []).slice(0, w) : null, E = T ? T.map((t) => e.map((e) => G(W(t?.data, e.field)))) : t, D = !!n && !(n && !y && x === null) && E.length === 0, O = l ? "6px 10px" : "10px 14px", k = "1px solid rgba(148, 163, 184, 0.35)", A = s ? { border: k } : { borderBottom: k };
3506
+ let w = Math.max(1, Number(a) || 10), T = n ? f ? y || n.startsWith("api:") ? (y ?? x ?? []).slice((b - 1) * w, b * w) : (x ?? []).slice(0, w) : (y ?? x ?? []).slice(0, w) : null, E = T ? T.map((t) => e.map((e) => K(G(t?.data, e.field)))) : t, D = !!n && !(n && !y && x === null) && E.length === 0, O = l ? "6px 10px" : "10px 14px", k = "1px solid rgba(148, 163, 184, 0.35)", A = s ? { border: k } : { borderBottom: k };
3497
3507
  return /* @__PURE__ */ u("div", {
3498
3508
  ref: h,
3499
3509
  style: {
@@ -3703,20 +3713,20 @@ function nn({ mode: e = "login", redirect: t, emailLabel: n = "Email", passwordL
3703
3713
  children: [
3704
3714
  T ? /* @__PURE__ */ d("label", {
3705
3715
  style: {
3706
- ...J,
3716
+ ...Y,
3707
3717
  display: "grid",
3708
3718
  gap: 6
3709
3719
  },
3710
3720
  children: [a, /* @__PURE__ */ u("input", {
3711
3721
  name: "name",
3712
3722
  type: "text",
3713
- style: Y,
3714
- ...X(f)
3723
+ style: X,
3724
+ ...Z(f)
3715
3725
  })]
3716
3726
  }) : null,
3717
3727
  /* @__PURE__ */ d("label", {
3718
3728
  style: {
3719
- ...J,
3729
+ ...Y,
3720
3730
  display: "grid",
3721
3731
  gap: 6
3722
3732
  },
@@ -3724,13 +3734,13 @@ function nn({ mode: e = "login", redirect: t, emailLabel: n = "Email", passwordL
3724
3734
  name: "email",
3725
3735
  type: "email",
3726
3736
  required: !f,
3727
- style: Y,
3728
- ...X(f)
3737
+ style: X,
3738
+ ...Z(f)
3729
3739
  })]
3730
3740
  }),
3731
3741
  /* @__PURE__ */ d("label", {
3732
3742
  style: {
3733
- ...J,
3743
+ ...Y,
3734
3744
  display: "grid",
3735
3745
  gap: 6
3736
3746
  },
@@ -3738,15 +3748,15 @@ function nn({ mode: e = "login", redirect: t, emailLabel: n = "Email", passwordL
3738
3748
  name: "password",
3739
3749
  type: "password",
3740
3750
  required: !f,
3741
- style: Y,
3742
- ...X(f)
3751
+ style: X,
3752
+ ...Z(f)
3743
3753
  })]
3744
3754
  }),
3745
3755
  /* @__PURE__ */ u("button", {
3746
3756
  type: f ? "button" : "submit",
3747
3757
  disabled: S || void 0,
3748
3758
  style: {
3749
- ...K,
3759
+ ...q,
3750
3760
  border: 0,
3751
3761
  padding: "10px 22px",
3752
3762
  borderRadius: 8,
@@ -3800,7 +3810,7 @@ function rn({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !
3800
3810
  children: [
3801
3811
  /* @__PURE__ */ d("span", {
3802
3812
  style: {
3803
- ...J,
3813
+ ...Y,
3804
3814
  fontWeight: 600
3805
3815
  },
3806
3816
  children: [
@@ -3811,7 +3821,7 @@ function rn({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !
3811
3821
  }),
3812
3822
  n && m?.email ? /* @__PURE__ */ u("span", {
3813
3823
  style: {
3814
- ...J,
3824
+ ...Y,
3815
3825
  opacity: .7
3816
3826
  },
3817
3827
  children: m.email
@@ -3820,14 +3830,14 @@ function rn({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !
3820
3830
  type: "button",
3821
3831
  onClick: a ? void 0 : f,
3822
3832
  style: {
3823
- ...K,
3833
+ ...q,
3824
3834
  border: 0,
3825
3835
  padding: "8px 16px",
3826
3836
  borderRadius: 8,
3827
3837
  fontSize: 14,
3828
3838
  cursor: a ? "default" : "pointer"
3829
3839
  },
3830
- ...X(a),
3840
+ ...Z(a),
3831
3841
  children: t
3832
3842
  })
3833
3843
  ]
@@ -3843,43 +3853,156 @@ function rn({ greeting: e = "Hi", signOutLabel: t = "Sign out", showEmail: n = !
3843
3853
  });
3844
3854
  }
3845
3855
  //#endregion
3856
+ //#region ../ui/src/components/builder/apps/language/manifest.js
3857
+ var an = {
3858
+ id: "language",
3859
+ label: "Language",
3860
+ category: "Apps",
3861
+ keys: ["SiteLanguagePicker"],
3862
+ ssr: "prefetch",
3863
+ settings: ["locales"]
3864
+ };
3865
+ //#endregion
3866
+ //#region ../ui/src/components/builder/apps/language/views.jsx
3867
+ function on(e) {
3868
+ let t = e?.locales, n = [typeof t?.default == "string" && t.default.trim() ? t.default.trim() : "", ...Array.isArray(t?.enabled) ? t.enabled : []].filter((e) => typeof e == "string" && e.trim());
3869
+ return [...new Set(n.map((e) => e.trim()))];
3870
+ }
3871
+ var sn = (e) => e && e.charAt(0).toUpperCase() + e.slice(1);
3872
+ function cn(e, t) {
3873
+ let n = String(e ?? "").toUpperCase();
3874
+ if (t === "code") return n;
3875
+ let r = "";
3876
+ try {
3877
+ r = sn(new Intl.DisplayNames([e], { type: "language" }).of(e) ?? "");
3878
+ } catch {}
3879
+ return !r || r.toUpperCase() === n ? n : t === "both" ? `${n} — ${r}` : r;
3880
+ }
3881
+ function ln(e, t) {
3882
+ let n = t ? "" : `?locale=${encodeURIComponent(e)}`;
3883
+ if (typeof window > "u") return n || "?";
3884
+ try {
3885
+ let n = new URL(window.location.href);
3886
+ return t ? n.searchParams.delete("locale") : n.searchParams.set("locale", e), n.searchParams.delete("page"), `${n.pathname}${n.search}${n.hash}`;
3887
+ } catch {
3888
+ return n || "/";
3889
+ }
3890
+ }
3891
+ function un({ variant: e, display: t, separator: n, label: i, style: a, nodeRef: o, inert: s }) {
3892
+ let c = r(H), l = on(c?.settings), f = l[0] ?? "", p = l.includes(c?.locale) ? c.locale : f, m = {
3893
+ display: "inline-flex",
3894
+ alignItems: "center",
3895
+ gap: 8,
3896
+ ...C(a)
3897
+ };
3898
+ if (l.length < 2) return s ? /* @__PURE__ */ u("div", {
3899
+ ref: o,
3900
+ style: {
3901
+ ...m,
3902
+ padding: "8px 12px",
3903
+ border: "1px dashed rgba(100, 116, 139, 0.45)",
3904
+ borderRadius: 6,
3905
+ color: "rgba(100, 116, 139, 0.8)",
3906
+ fontSize: 12
3907
+ },
3908
+ children: "Add site languages in Settings → Languages"
3909
+ }) : null;
3910
+ let h = i ? /* @__PURE__ */ u("span", {
3911
+ style: { opacity: .7 },
3912
+ children: i
3913
+ }) : null;
3914
+ return e === "inline" ? /* @__PURE__ */ d("div", {
3915
+ ref: o,
3916
+ style: m,
3917
+ children: [h, l.map((e, r) => /* @__PURE__ */ d("span", {
3918
+ style: {
3919
+ display: "inline-flex",
3920
+ alignItems: "center",
3921
+ gap: 8
3922
+ },
3923
+ children: [r > 0 && /* @__PURE__ */ u("span", {
3924
+ style: { opacity: .4 },
3925
+ children: n ?? "·"
3926
+ }), /* @__PURE__ */ u("a", {
3927
+ href: ln(e, e === f),
3928
+ hrefLang: e,
3929
+ "aria-current": e === p ? "true" : void 0,
3930
+ onClick: s ? (e) => e.preventDefault() : void 0,
3931
+ style: {
3932
+ color: e === p ? "var(--page-accent, inherit)" : "inherit",
3933
+ fontWeight: e === p ? 600 : 400,
3934
+ textDecoration: "none",
3935
+ cursor: s ? "default" : "pointer"
3936
+ },
3937
+ children: cn(e, t)
3938
+ })]
3939
+ }, e))]
3940
+ }) : /* @__PURE__ */ d("div", {
3941
+ ref: o,
3942
+ style: m,
3943
+ children: [h, /* @__PURE__ */ u("select", {
3944
+ "aria-label": i || "Language",
3945
+ value: p,
3946
+ onChange: s ? void 0 : (e) => {
3947
+ let t = e.target.value;
3948
+ window.location.assign(ln(t, t === f));
3949
+ },
3950
+ onKeyDown: s ? (e) => e.preventDefault() : void 0,
3951
+ style: {
3952
+ font: "inherit",
3953
+ color: "inherit",
3954
+ background: "var(--page-surface, transparent)",
3955
+ border: "1px solid var(--page-border, rgba(148, 163, 184, 0.4))",
3956
+ borderRadius: 6,
3957
+ padding: "4px 8px",
3958
+ cursor: s ? "default" : "pointer"
3959
+ },
3960
+ children: l.map((e) => /* @__PURE__ */ u("option", {
3961
+ value: e,
3962
+ children: cn(e, t)
3963
+ }, e))
3964
+ })]
3965
+ });
3966
+ }
3967
+ //#endregion
3846
3968
  //#region ../ui/src/components/builder/apps/index.js
3847
- var an = [Zt], on = {
3969
+ var dn = [Zt, an], fn = {
3848
3970
  SiteLoginForm: nn,
3849
- SiteAccountMenu: rn
3971
+ SiteAccountMenu: rn,
3972
+ SiteLanguagePicker: un
3850
3973
  };
3851
- new Set(an.filter((e) => e.ssr === "shell").flatMap((e) => e.keys));
3974
+ new Set(dn.filter((e) => e.ssr === "shell").flatMap((e) => e.keys));
3852
3975
  //#endregion
3853
3976
  //#region ../ui/src/components/builder/plugins/runtime.js
3854
- var sn = /* @__PURE__ */ new Map();
3855
- function cn(e) {
3856
- if (sn.has(e)) return sn.get(e);
3977
+ var pn = /* @__PURE__ */ new Map();
3978
+ function mn(e) {
3979
+ if (pn.has(e)) return pn.get(e);
3857
3980
  let t = URL.createObjectURL(new Blob([e], { type: "text/javascript" })), n = import(
3858
3981
  /* @vite-ignore */
3859
3982
  /* webpackIgnore: true */
3860
3983
  t
3861
3984
  ).finally(() => URL.revokeObjectURL(t));
3862
- return sn.set(e, n), n;
3985
+ return pn.set(e, n), n;
3863
3986
  }
3864
- function ln(e) {
3987
+ function hn(e) {
3865
3988
  let t = e && typeof e == "object" ? e.builder_plugins : null, n = t && typeof t == "object" ? t.plugins : null;
3866
3989
  return n && typeof n == "object" ? n : {};
3867
3990
  }
3868
3991
  //#endregion
3869
3992
  //#region ../ui/src/components/builder/plugins/view.jsx
3870
- async function un(e, t) {
3871
- let n = await cn(e);
3993
+ async function gn(e, t) {
3994
+ let n = await mn(e);
3872
3995
  return (Array.isArray(n?.default?.blocks) ? n.default.blocks : []).find((e) => e?.id === t && typeof e.mount == "function") ?? null;
3873
3996
  }
3874
- var dn = {
3997
+ var _n = {
3875
3998
  padding: "10px 12px",
3876
3999
  border: "1px dashed rgba(148, 163, 184, 0.5)",
3877
4000
  borderRadius: 8,
3878
4001
  fontSize: 12,
3879
4002
  opacity: .6
3880
4003
  };
3881
- function fn({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
3882
- let c = r(H), l = ln(c?.settings)[e], f = s(null), p = s(null), m = {
4004
+ function vn({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
4005
+ let c = r(H), l = hn(c?.settings)[e], f = s(null), p = s(null), m = {
3883
4006
  tenant: c?.tenant ?? "",
3884
4007
  apiUrl: c?.apiUrl ?? "/api",
3885
4008
  locale: c?.locale ?? "",
@@ -3891,7 +4014,7 @@ function fn({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
3891
4014
  let e = f.current;
3892
4015
  if (!l?.code || !e) return;
3893
4016
  let n = !0;
3894
- return un(l.code, t).then((e) => {
4017
+ return gn(l.code, t).then((e) => {
3895
4018
  if (!(!n || !e || !f.current)) {
3896
4019
  p.current = e;
3897
4020
  try {
@@ -3921,7 +4044,7 @@ function fn({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
3921
4044
  }) : /* @__PURE__ */ d("div", {
3922
4045
  ref: o,
3923
4046
  style: {
3924
- ...dn,
4047
+ ..._n,
3925
4048
  ...C(a)
3926
4049
  },
3927
4050
  children: [
@@ -3933,12 +4056,12 @@ function fn({ pluginId: e, blockId: t, props: n, style: a, nodeRef: o }) {
3933
4056
  }
3934
4057
  //#endregion
3935
4058
  //#region ../ui/src/components/builder/render.jsx
3936
- var pn = {
4059
+ var yn = {
3937
4060
  ...Xt,
3938
- ...on,
3939
- PluginBlock: fn
4061
+ ...fn,
4062
+ PluginBlock: vn
3940
4063
  };
3941
- function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
4064
+ function bn(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
3942
4065
  let o = n[t];
3943
4066
  if (!o || o.hidden) return null;
3944
4067
  let s = o.type?.resolvedName, c = a?.mapProps ? a.mapProps(o.props ?? {}, s) : o.props ?? {};
@@ -3946,11 +4069,11 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
3946
4069
  let n = o.props?.componentId, s = r?.[n];
3947
4070
  if (!s?.template || i.has(n)) return null;
3948
4071
  let c = new Set(i).add(n);
3949
- return /* @__PURE__ */ u(e, { children: $(s.template.rootId, s.template.nodes, r, c, a) }, t);
4072
+ return /* @__PURE__ */ u(e, { children: bn(s.template.rootId, s.template.nodes, r, c, a) }, t);
3950
4073
  }
3951
- let l = pn[s];
4074
+ let l = yn[s];
3952
4075
  if (!l) return null;
3953
- let d = (o.nodes ?? []).map((e) => $(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, $(t, n, r, i)])) : void 0, m = /* @__PURE__ */ u(l, {
4076
+ let d = (o.nodes ?? []).map((e) => bn(e, n, r, i, a)).filter(Boolean), f = Object.entries(o.linkedNodes ?? {}), p = f.length ? Object.fromEntries(f.map(([e, t]) => [e, bn(t, n, r, i)])) : void 0, m = /* @__PURE__ */ u(l, {
3954
4077
  ...c,
3955
4078
  ...s === "CollectionList" ? { templateId: o.linkedNodes?.card } : null,
3956
4079
  linked: p,
@@ -3966,9 +4089,9 @@ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
3966
4089
  }
3967
4090
  //#endregion
3968
4091
  //#region ../ui/src/components/builder/PageRenderer.jsx
3969
- var mn = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" "), hn = (e) => `.webim-page[data-webim-mode="light"] { ${Object.entries(V(e.light)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }
4092
+ var xn = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" "), Sn = (e) => `.webim-page[data-webim-mode="light"] { ${Object.entries(V(e.light)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }
3970
4093
  .webim-page[data-webim-mode="dark"] { ${Object.entries(V(e.dark)).map(([e, t]) => `${e}: ${t} !important;`).join(" ")} }`;
3971
- function gn({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, custom: s, tenant: c, apiUrl: l, datasets: f, locale: p, direction: m, settings: h, siteUser: _ }) {
4094
+ function Cn({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, custom: s, tenant: c, apiUrl: l, datasets: f, locale: p, direction: m, settings: h, siteUser: _ }) {
3972
4095
  let v = s?.js?.trim();
3973
4096
  if (i(() => {
3974
4097
  if (!v) return;
@@ -3977,16 +4100,16 @@ function gn({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, cu
3977
4100
  }, [v]), !e?.ROOT) return null;
3978
4101
  let b = {
3979
4102
  lang: p || void 0,
3980
- dir: ue(m, p)
4103
+ dir: de(m, p)
3981
4104
  }, x = ".webim-page, .webim-page *, .webim-page *::before, .webim-page *::after { box-sizing: border-box; }", S = {
3982
4105
  minHeight: "100%",
3983
4106
  display: "flex",
3984
4107
  flexDirection: "column"
3985
- }, C = $("ROOT", e, n), w = o(() => ({ render: (t, r) => $(t, e, n, void 0, { mapProps: r }) }), [e, n]), T = F(e, n), E = P(e, n), D = s?.css?.trim(), O = B(t), k = [O.font, O.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !z[e]), A = [.../* @__PURE__ */ new Set([...y(e, n), ...k])].map((e) => /* @__PURE__ */ u("link", {
4108
+ }, C = bn("ROOT", e, n), w = o(() => ({ render: (t, r) => bn(t, e, n, void 0, { mapProps: r }) }), [e, n]), T = F(e, n), E = P(e, n), D = s?.css?.trim(), O = B(t), k = [O.font, O.headingFont].filter((e) => typeof e == "string" && e.trim() && e !== "inherit" && !z[e]), A = [.../* @__PURE__ */ new Set([...y(e, n), ...k])].map((e) => /* @__PURE__ */ u("link", {
3986
4109
  rel: "stylesheet",
3987
4110
  precedence: "default",
3988
4111
  href: g(e)
3989
- }, e)), j = hn(O);
4112
+ }, e)), j = Sn(O);
3990
4113
  return r === "auto" ? /* @__PURE__ */ u(H.Provider, {
3991
4114
  value: {
3992
4115
  tenant: c || "",
@@ -4009,8 +4132,8 @@ function gn({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, cu
4009
4132
  ...a
4010
4133
  },
4011
4134
  children: [
4012
- /* @__PURE__ */ u("style", { children: `.webim-page { ${mn(V(O.light))} }
4013
- @media (prefers-color-scheme: dark) { .webim-page { ${mn(V(O.dark))} } }` }),
4135
+ /* @__PURE__ */ u("style", { children: `.webim-page { ${xn(V(O.light))} }
4136
+ @media (prefers-color-scheme: dark) { .webim-page { ${xn(V(O.dark))} } }` }),
4014
4137
  /* @__PURE__ */ u("style", { children: j }),
4015
4138
  A,
4016
4139
  /* @__PURE__ */ u("style", { children: x }),
@@ -4061,8 +4184,8 @@ function gn({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, cu
4061
4184
  }
4062
4185
  //#endregion
4063
4186
  //#region src/WebimContent.jsx
4064
- function _n({ bundle: e, mode: t = "auto", style: n }) {
4065
- return e?.blocks?.ROOT ? /* @__PURE__ */ u(gn, {
4187
+ function wn({ bundle: e, mode: t = "auto", style: n }) {
4188
+ return e?.blocks?.ROOT ? /* @__PURE__ */ u(Cn, {
4066
4189
  blocks: e.blocks,
4067
4190
  theme: e.theme,
4068
4191
  components: e.components,
@@ -4073,13 +4196,13 @@ function _n({ bundle: e, mode: t = "auto", style: n }) {
4073
4196
  locale: e.locale,
4074
4197
  direction: e.direction,
4075
4198
  settings: e.settings,
4076
- mode: t,
4199
+ mode: ae(t, e.scheme),
4077
4200
  style: n
4078
4201
  }) : null;
4079
4202
  }
4080
4203
  //#endregion
4081
4204
  //#region src/WebimPage.jsx
4082
- function vn({ apiUrl: e, tenant: t, slug: n, locale: r, preview: a, token: o, mode: l = "auto", style: d, fallback: f = null, errorFallback: p = null, onLoad: m, onError: h }) {
4205
+ function Tn({ apiUrl: e, tenant: t, slug: n, locale: r, preview: a, token: o, mode: l = "auto", style: d, fallback: f = null, errorFallback: p = null, onLoad: m, onError: h }) {
4083
4206
  let [g, _] = c({ status: "loading" }), v = s({
4084
4207
  onLoad: m,
4085
4208
  onError: h
@@ -4089,7 +4212,7 @@ function vn({ apiUrl: e, tenant: t, slug: n, locale: r, preview: a, token: o, mo
4089
4212
  onError: h
4090
4213
  }, i(() => {
4091
4214
  let i = !0;
4092
- return _({ status: "loading" }), se({
4215
+ return _({ status: "loading" }), ce({
4093
4216
  apiUrl: e,
4094
4217
  tenant: t,
4095
4218
  slug: n,
@@ -4116,11 +4239,11 @@ function vn({ apiUrl: e, tenant: t, slug: n, locale: r, preview: a, token: o, mo
4116
4239
  r,
4117
4240
  a,
4118
4241
  o
4119
- ]), g.status === "loading" ? f : g.status === "error" ? typeof p == "function" ? p(g.error) : p : /* @__PURE__ */ u(_n, {
4242
+ ]), g.status === "loading" ? f : g.status === "error" ? typeof p == "function" ? p(g.error) : p : /* @__PURE__ */ u(wn, {
4120
4243
  bundle: g.bundle,
4121
4244
  mode: l,
4122
4245
  style: d
4123
4246
  });
4124
4247
  }
4125
4248
  //#endregion
4126
- export { gn as PageRenderer, _n as WebimContent, vn as WebimPage, se as fetchPage, Ne as renderRichContent, ie as resolveTheme };
4249
+ export { Cn as PageRenderer, wn as WebimContent, Tn as WebimPage, ce as fetchPage, Ne as renderRichContent, ie as resolveTheme };