webim-adapter 0.2.0 → 0.4.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.
@@ -1,123 +1,123 @@
1
- import { Fragment as e, createContext as t, useContext as n, useEffect as r, useRef as i, useState as a } from "react";
2
- import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
1
+ import { Fragment as e, createContext as t, useContext as n, useEffect as r, useMemo as i, useRef as a, useState as o } from "react";
2
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
3
3
  //#region ../ui/src/components/builder/styles.js
4
- var l = /* @__PURE__ */ new Set(/* @__PURE__ */ "marginTop.marginRight.marginBottom.marginLeft.paddingTop.paddingRight.paddingBottom.paddingLeft.gap.rowGap.columnGap.flexBasis.fontSize.borderRadius.borderTopLeftRadius.borderTopRightRadius.borderBottomRightRadius.borderBottomLeftRadius.borderWidth.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.letterSpacing.top.right.bottom.left".split(".")), u = (e) => typeof e == "number" || typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? `${Number(e)}px` : e, d = [
4
+ var u = /* @__PURE__ */ new Set(/* @__PURE__ */ "marginTop.marginRight.marginBottom.marginLeft.paddingTop.paddingRight.paddingBottom.paddingLeft.gap.rowGap.columnGap.flexBasis.fontSize.borderRadius.borderTopLeftRadius.borderTopRightRadius.borderBottomRightRadius.borderBottomLeftRadius.borderWidth.borderTopWidth.borderRightWidth.borderBottomWidth.borderLeftWidth.letterSpacing.top.right.bottom.left".split(".")), d = (e) => typeof e == "number" || typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? `${Number(e)}px` : e, f = [
5
5
  "borderWidth",
6
6
  "borderStyle",
7
7
  "borderColor",
8
8
  "borderRadius",
9
9
  "gap"
10
10
  ];
11
- function f(e) {
11
+ function p(e) {
12
12
  let t = {};
13
- for (let n of d) {
13
+ for (let n of f) {
14
14
  let r = e?.[n];
15
- r != null && r !== "" && (t[n] = l.has(n) ? u(r) : r);
15
+ r != null && r !== "" && (t[n] = u.has(n) ? d(r) : r);
16
16
  }
17
- for (let [n, r] of Object.entries(e || {})) r == null || r === "" || d.includes(n) || (t[n] = l.has(n) ? u(r) : r);
17
+ for (let [n, r] of Object.entries(e || {})) r == null || r === "" || f.includes(n) || (t[n] = u.has(n) ? d(r) : r);
18
18
  let { gradientType: n, gradientAngle: r, gradientFrom: i, gradientTo: a } = t;
19
19
  delete t.gradientType, delete t.gradientAngle, delete t.gradientFrom, delete t.gradientTo;
20
- let { textShadows: o, textShadowX: s, textShadowY: c, textShadowBlur: f, textShadowColor: p } = t;
20
+ let { textShadows: o, textShadowX: s, textShadowY: c, textShadowBlur: l, textShadowColor: p } = t;
21
21
  delete t.textShadows, delete t.textShadowX, delete t.textShadowY, delete t.textShadowBlur, delete t.textShadowColor;
22
- let m = (Array.isArray(o) ? o : []).filter((e) => e && e.on !== !1).map((e) => `${u(e.x ?? 0)} ${u(e.y ?? 0)} ${u(e.blur ?? 0)} ${e.color || "rgba(0, 0, 0, 0.35)"}`);
22
+ let m = (Array.isArray(o) ? o : []).filter((e) => e && e.on !== !1).map((e) => `${d(e.x ?? 0)} ${d(e.y ?? 0)} ${d(e.blur ?? 0)} ${e.color || "rgba(0, 0, 0, 0.35)"}`);
23
23
  [
24
24
  s,
25
25
  c,
26
- f,
26
+ l,
27
27
  p
28
- ].some((e) => e !== void 0) && m.push(`${u(s ?? 0)} ${u(c ?? 0)} ${u(f ?? 0)} ${p || "rgba(0, 0, 0, 0.35)"}`), m.length && (t.textShadow = m.join(", "));
29
- let h = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}deg` : e, g = (e) => e.type === "move" ? `translate(${u(e.x ?? 0)}, ${u(e.y ?? 0)})` : e.type === "scale" ? `scale(${e.v ?? 1})` : e.type === "rotate" ? `rotate(${h(e.a ?? 0)})` : e.type === "skew" ? `skew(${h(e.x ?? 0)}, ${h(e.y ?? 0)})` : null, { transforms: _, translateX: v, translateY: y, scale: b, rotate: x, skewX: S, skewY: ee } = t;
28
+ ].some((e) => e !== void 0) && m.push(`${d(s ?? 0)} ${d(c ?? 0)} ${d(l ?? 0)} ${p || "rgba(0, 0, 0, 0.35)"}`), m.length && (t.textShadow = m.join(", "));
29
+ let h = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}deg` : e, g = (e) => e.type === "move" ? `translate(${d(e.x ?? 0)}, ${d(e.y ?? 0)})` : e.type === "scale" ? `scale(${e.v ?? 1})` : e.type === "rotate" ? `rotate(${h(e.a ?? 0)})` : e.type === "skew" ? `skew(${h(e.x ?? 0)}, ${h(e.y ?? 0)})` : null, { transforms: _, translateX: v, translateY: y, scale: b, rotate: x, skewX: S, skewY: C } = t;
30
30
  delete t.transforms, delete t.translateX, delete t.translateY, delete t.scale, delete t.rotate, delete t.skewX, delete t.skewY;
31
- let C = (Array.isArray(_) ? _ : []).filter((e) => e && e.on !== !1).map(g).filter(Boolean);
32
- (v !== void 0 || y !== void 0) && C.push(`translate(${u(v ?? 0)}, ${u(y ?? 0)})`), b !== void 0 && C.push(`scale(${b})`), x !== void 0 && C.push(`rotate(${h(x)})`), (S !== void 0 || ee !== void 0) && C.push(`skew(${h(S ?? 0)}, ${h(ee ?? 0)})`), C.length && (t.transform = C.join(" "));
33
- let w = (e) => `${e.inset ? "inset " : ""}${u(e.x ?? 0)} ${u(e.y ?? 0)} ${u(e.blur ?? 0)} ${u(e.spread ?? 0)} ${e.color || "rgba(15, 23, 42, 0.2)"}`, { shadows: T, boxShadowX: E, boxShadowY: D, boxShadowBlur: O, boxShadowSpread: k, boxShadowColor: A, boxShadowInset: j } = t;
31
+ let w = (Array.isArray(_) ? _ : []).filter((e) => e && e.on !== !1).map(g).filter(Boolean);
32
+ (v !== void 0 || y !== void 0) && w.push(`translate(${d(v ?? 0)}, ${d(y ?? 0)})`), b !== void 0 && w.push(`scale(${b})`), x !== void 0 && w.push(`rotate(${h(x)})`), (S !== void 0 || C !== void 0) && w.push(`skew(${h(S ?? 0)}, ${h(C ?? 0)})`), w.length && (t.transform = w.join(" "));
33
+ let T = (e) => `${e.inset ? "inset " : ""}${d(e.x ?? 0)} ${d(e.y ?? 0)} ${d(e.blur ?? 0)} ${d(e.spread ?? 0)} ${e.color || "rgba(15, 23, 42, 0.2)"}`, { shadows: E, boxShadowX: D, boxShadowY: O, boxShadowBlur: k, boxShadowSpread: A, boxShadowColor: j, boxShadowInset: M } = t;
34
34
  delete t.shadows, delete t.boxShadowX, delete t.boxShadowY, delete t.boxShadowBlur, delete t.boxShadowSpread, delete t.boxShadowColor, delete t.boxShadowInset;
35
- let M = (Array.isArray(T) ? T : []).filter((e) => e && e.on !== !1).map(w);
35
+ let N = (Array.isArray(E) ? E : []).filter((e) => e && e.on !== !1).map(T);
36
36
  [
37
- E,
38
37
  D,
39
38
  O,
40
39
  k,
41
40
  A,
42
- j
43
- ].some((e) => e !== void 0) && M.push(w({
44
- x: E,
45
- y: D,
46
- blur: O,
47
- spread: k,
48
- color: A,
49
- inset: j
50
- })), M.length && (t.boxShadow = M.join(", "));
51
- let te = (e) => e.type === "blur" ? `blur(${u(e.v ?? 0)})` : e.type === "hue-rotate" ? `hue-rotate(${h(e.v ?? 0)})` : `${e.type}(${e.v ?? 100}%)`, N = (e) => (Array.isArray(e) ? e : []).filter((e) => e && e.on !== !1 && e.type).map(te), { filters: ne, backdropFilters: re, filterBlur: P, filterGrayscale: F, filterBrightness: I, filterContrast: L, filterSaturate: R } = t;
41
+ j,
42
+ M
43
+ ].some((e) => e !== void 0) && N.push(T({
44
+ x: D,
45
+ y: O,
46
+ blur: k,
47
+ spread: A,
48
+ color: j,
49
+ inset: M
50
+ })), N.length && (t.boxShadow = N.join(", "));
51
+ let P = (e) => e.type === "blur" ? `blur(${d(e.v ?? 0)})` : e.type === "hue-rotate" ? `hue-rotate(${h(e.v ?? 0)})` : `${e.type}(${e.v ?? 100}%)`, F = (e) => (Array.isArray(e) ? e : []).filter((e) => e && e.on !== !1 && e.type).map(P), { filters: I, backdropFilters: L, filterBlur: R, filterGrayscale: z, filterBrightness: ee, filterContrast: te, filterSaturate: ne } = t;
52
52
  delete t.filters, delete t.backdropFilters, delete t.filterBlur, delete t.filterGrayscale, delete t.filterBrightness, delete t.filterContrast, delete t.filterSaturate;
53
- let z = N(ne);
54
- P !== void 0 && z.push(`blur(${u(P)})`), F !== void 0 && z.push(`grayscale(${F}%)`), I !== void 0 && z.push(`brightness(${I}%)`), L !== void 0 && z.push(`contrast(${L}%)`), R !== void 0 && z.push(`saturate(${R}%)`), z.length && (t.filter = z.join(" "));
55
- let B = N(re);
56
- B.length && (t.backdropFilter = B.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
57
- let { textStrokeWidth: V, textStrokeColor: H } = t;
58
- delete t.textStrokeWidth, delete t.textStrokeColor, (V !== void 0 || H !== void 0) && (t.WebkitTextStroke = `${u(V ?? 1)} ${H || "currentColor"}`);
59
- let { clipText: ie } = t;
60
- delete t.clipText, ie && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
61
- let { transitions: U, transitionDuration: W, transitionEasing: G, transitionProperty: ae } = t, K = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
53
+ let B = F(I);
54
+ R !== void 0 && B.push(`blur(${d(R)})`), z !== void 0 && B.push(`grayscale(${z}%)`), ee !== void 0 && B.push(`brightness(${ee}%)`), te !== void 0 && B.push(`contrast(${te}%)`), ne !== void 0 && B.push(`saturate(${ne}%)`), B.length && (t.filter = B.join(" "));
55
+ let V = F(L);
56
+ V.length && (t.backdropFilter = V.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
57
+ let { textStrokeWidth: H, textStrokeColor: U } = t;
58
+ delete t.textStrokeWidth, delete t.textStrokeColor, (H !== void 0 || U !== void 0) && (t.WebkitTextStroke = `${d(H ?? 1)} ${U || "currentColor"}`);
59
+ let { clipText: re } = t;
60
+ delete t.clipText, re && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
61
+ let { transitions: W, transitionDuration: ie, transitionEasing: G, transitionProperty: ae } = t, K = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
62
62
  delete t.transitions, delete t.transitionDuration, delete t.transitionEasing, delete t.transitionProperty;
63
- let q = (Array.isArray(U) ? U : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${K(e.duration ?? 200)} ${e.easing || "ease"}`);
64
- if (W !== void 0 && q.push(`${ae || "all"} ${K(W)} ${G || "ease"}`), q.length && (t.transition = q.join(", ")), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
63
+ let q = (Array.isArray(W) ? W : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${K(e.duration ?? 200)} ${e.easing || "ease"}`);
64
+ if (ie !== void 0 && q.push(`${ae || "all"} ${K(ie)} ${G || "ease"}`), q.length && (t.transition = q.join(", ")), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
65
65
  let e = `${i || "rgba(0,0,0,0.5)"}, ${a || "transparent"}`, o = n === "radial" ? `radial-gradient(circle, ${e})` : `linear-gradient(${r ?? 180}deg, ${e})`;
66
66
  t.backgroundImage = t.backgroundImage ? `${o}, ${t.backgroundImage}` : o;
67
67
  }
68
68
  delete t.backgroundVideo;
69
- let { overlayColor: J, overlayOpacity: Y } = t;
69
+ let { overlayColor: J, overlayOpacity: oe } = t;
70
70
  if (delete t.overlayColor, delete t.overlayOpacity, J) {
71
- let e = `color-mix(in srgb, ${J} ${Y ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
71
+ let e = `color-mix(in srgb, ${J} ${oe ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
72
72
  t.backgroundImage = t.backgroundImage ? `${n}, ${t.backgroundImage}` : n;
73
73
  }
74
74
  t.backgroundImage && (t.backgroundSize ??= "cover", t.backgroundPosition ??= "center", t.backgroundRepeat ??= "no-repeat");
75
- let { backgroundLayers: oe } = t;
75
+ let { backgroundLayers: se } = t;
76
76
  delete t.backgroundLayers;
77
- let X = (Array.isArray(oe) ? oe : []).filter((e) => e && e.on !== !1);
78
- if (X.length) {
77
+ let Y = (Array.isArray(se) ? se : []).filter((e) => e && e.on !== !1);
78
+ if (Y.length) {
79
79
  let e = [], n = [], r = [], i = [], a = [];
80
- for (let t of X) 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");
80
+ for (let t of Y) 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");
81
81
  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");
82
82
  else {
83
83
  if (!t.src) continue;
84
- e.push(`url("${t.src}")`), n.push(t.size === "custom" ? `${u(t.w ?? "auto")} ${u(t.h ?? "auto")}` : t.size || "cover"), r.push(`${u(t.posX ?? 0)} ${u(t.posY ?? 0)}`), i.push(t.repeat || "no-repeat"), a.push(t.fixed ? "fixed" : "scroll");
84
+ e.push(`url("${t.src}")`), n.push(t.size === "custom" ? `${d(t.w ?? "auto")} ${d(t.h ?? "auto")}` : t.size || "cover"), r.push(`${d(t.posX ?? 0)} ${d(t.posY ?? 0)}`), i.push(t.repeat || "no-repeat"), a.push(t.fixed ? "fixed" : "scroll");
85
85
  }
86
86
  e.length && (t.backgroundImage && (e.push(t.backgroundImage), n.push(t.backgroundSize || "cover"), r.push(t.backgroundPosition || "center"), i.push(t.backgroundRepeat || "no-repeat"), a.push("scroll")), t.backgroundImage = e.join(", "), t.backgroundSize = n.join(", "), t.backgroundPosition = r.join(", "), t.backgroundRepeat = i.join(", "), t.backgroundAttachment = a.join(", "));
87
87
  }
88
88
  return t;
89
89
  }
90
- var p = {
90
+ var m = {
91
91
  hover: ":hover",
92
92
  pressed: ":active",
93
93
  focused: ":focus"
94
- }, m = /* @__PURE__ */ new Set([
94
+ }, h = /* @__PURE__ */ new Set([
95
95
  "style",
96
96
  "class",
97
97
  "id",
98
98
  "data-wb",
99
99
  "data-wb-class",
100
100
  "data-slot"
101
- ]), h = (e) => /^[a-zA-Z_][\w-]*$/.test(e) && !/^on/i.test(e) && !m.has(e.toLowerCase());
102
- function g(e, t, n = []) {
101
+ ]), g = (e) => /^[a-zA-Z_][\w-]*$/.test(e) && !/^on/i.test(e) && !h.has(e.toLowerCase());
102
+ function _(e, t, n = []) {
103
103
  t.htmlId ? e.id = t.htmlId : e.removeAttribute("id");
104
104
  for (let t of n) e.removeAttribute(t);
105
105
  let r = [];
106
106
  for (let n of t.attributes ?? []) {
107
107
  let t = String(n?.name ?? "").trim();
108
- h(t) && (e.setAttribute(t, n.value ?? ""), r.push(t));
108
+ g(t) && (e.setAttribute(t, n.value ?? ""), r.push(t));
109
109
  }
110
110
  return r;
111
111
  }
112
- var _ = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
113
- function v(e, t, n, r = !1) {
114
- let i = Object.entries(f(t)).map(([e, t]) => `${_(e)}: ${t} !important;`).join(" ");
112
+ var v = (e) => e.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
113
+ function y(e, t, n, r = !1) {
114
+ let i = Object.entries(p(t)).map(([e, t]) => `${v(e)}: ${t} !important;`).join(" ");
115
115
  return i ? `[data-wb="${e}"]${r ? "" : n} { ${i} }` : "";
116
116
  }
117
- function y(e, t, n) {
118
- return Object.entries(p).map(([r, i]) => v(e, t?.[r], i, n === r)).filter(Boolean).join("\n");
117
+ function b(e, t, n) {
118
+ return Object.entries(m).map(([r, i]) => y(e, t?.[r], i, n === r)).filter(Boolean).join("\n");
119
119
  }
120
- var b = [
120
+ var x = [
121
121
  {
122
122
  key: "tablet",
123
123
  max: 991
@@ -130,17 +130,17 @@ var b = [
130
130
  key: "mobile",
131
131
  max: 478
132
132
  }
133
- ], x = (e) => Object.entries(f(e)).map(([e, t]) => `${_(e)}: ${t} !important;`).join(" ");
134
- function S(e, t) {
135
- return b.map(({ key: n, max: r }) => {
136
- let i = t?.[n] ? x(t[n]) : "";
133
+ ], S = (e) => Object.entries(p(e)).map(([e, t]) => `${v(e)}: ${t} !important;`).join(" ");
134
+ function C(e, t) {
135
+ return x.map(({ key: n, max: r }) => {
136
+ let i = t?.[n] ? S(t[n]) : "";
137
137
  return i ? `@media (max-width: ${r}px) { [data-wb="${e}"] { ${i} } }` : "";
138
138
  }).filter(Boolean).join("\n");
139
139
  }
140
- function ee(e, t) {
140
+ function w(e, t) {
141
141
  let n = [], r = (e) => {
142
142
  for (let [t, r] of Object.entries(e || {})) {
143
- let e = S(t, r.props);
143
+ let e = C(t, r.props);
144
144
  e && n.push(e);
145
145
  }
146
146
  };
@@ -148,10 +148,10 @@ function ee(e, t) {
148
148
  for (let e of Object.values(t || {})) r(e.template?.nodes);
149
149
  return n.join("\n");
150
150
  }
151
- function C(e, t) {
151
+ function T(e, t) {
152
152
  let n = [], r = (e) => {
153
153
  for (let [t, r] of Object.entries(e || {})) {
154
- let e = y(t, r.props);
154
+ let e = b(t, r.props);
155
155
  e && n.push(e);
156
156
  }
157
157
  };
@@ -159,7 +159,7 @@ function C(e, t) {
159
159
  for (let e of Object.values(t || {})) r(e.template?.nodes);
160
160
  return n.join("\n");
161
161
  }
162
- var w = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", T = {
162
+ var E = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", D = {
163
163
  light: {
164
164
  background: "#ffffff",
165
165
  text: "#111827",
@@ -196,23 +196,23 @@ var w = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Ari
196
196
  contrastText: "#052e2b"
197
197
  }
198
198
  }
199
- }, E = {
199
+ }, O = {
200
200
  font: "system",
201
201
  headingFont: "inherit",
202
- light: T.light,
203
- dark: T.dark
204
- }, D = {
202
+ light: D.light,
203
+ dark: D.dark
204
+ }, k = {
205
205
  system: {
206
206
  label: "System",
207
- value: w
207
+ value: E
208
208
  },
209
209
  inter: {
210
210
  label: "Inter",
211
- value: `"Inter", ${w}`
211
+ value: `"Inter", ${E}`
212
212
  },
213
213
  outfit: {
214
214
  label: "Outfit",
215
- value: `"Outfit", ${w}`
215
+ value: `"Outfit", ${E}`
216
216
  },
217
217
  serif: {
218
218
  label: "Serif",
@@ -222,7 +222,7 @@ var w = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Ari
222
222
  label: "Mono",
223
223
  value: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
224
224
  }
225
- }, O = (e, t) => D[e]?.value ?? t, k = (e, ...t) => {
225
+ }, A = (e, t) => k[e]?.value ?? t, j = (e, ...t) => {
226
226
  let n = Object.assign({}, e, ...t);
227
227
  return n.primary = {
228
228
  ...e.primary,
@@ -238,16 +238,16 @@ var w = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Ari
238
238
  }), {})
239
239
  }, n;
240
240
  };
241
- function A(e) {
241
+ function M(e) {
242
242
  let { light: t, dark: n, font: r, headingFont: i, ...a } = e ?? {};
243
243
  return {
244
- font: r ?? E.font,
245
- headingFont: i ?? E.headingFont,
246
- light: k(T.light, a, t),
247
- dark: k(T.dark, n)
244
+ font: r ?? O.font,
245
+ headingFont: i ?? O.headingFont,
246
+ light: j(D.light, a, t),
247
+ dark: j(D.dark, n)
248
248
  };
249
249
  }
250
- function j(e) {
250
+ function N(e) {
251
251
  return {
252
252
  "--page-bg": e.background,
253
253
  "--page-text": e.text,
@@ -263,28 +263,28 @@ function j(e) {
263
263
  "--page-secondary-contrast": e.secondary.contrastText
264
264
  };
265
265
  }
266
- function M(e) {
267
- let t = A(e);
266
+ function P(e) {
267
+ let t = M(e);
268
268
  return {
269
269
  backgroundColor: "var(--page-bg)",
270
270
  color: "var(--page-text)",
271
- fontFamily: O(t.font, w),
272
- "--page-heading-font": t.headingFont === "inherit" ? "inherit" : O(t.headingFont, "inherit")
271
+ fontFamily: A(t.font, E),
272
+ "--page-heading-font": t.headingFont === "inherit" ? "inherit" : A(t.headingFont, "inherit")
273
273
  };
274
274
  }
275
- function te(e, t = "light") {
276
- let n = A(e);
275
+ function F(e, t = "light") {
276
+ let n = M(e);
277
277
  return {
278
- ...M(e),
279
- ...j(n[t] ?? n.light)
278
+ ...P(e),
279
+ ...N(n[t] ?? n.light)
280
280
  };
281
281
  }
282
- function N(e, t) {
282
+ function I(e, t) {
283
283
  return e?.themeRef && t?.[e.themeRef] || e?.theme;
284
284
  }
285
285
  //#endregion
286
286
  //#region src/bundle.js
287
- function ne({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
287
+ function L({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
288
288
  let a = {
289
289
  ...t?.global ?? {},
290
290
  ...t?.tenant ?? {}
@@ -294,7 +294,7 @@ function ne({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
294
294
  title: e.title,
295
295
  slug: e.slug,
296
296
  blocks: i && o.i18n?.[i]?.blocks || e.blocks,
297
- theme: N(o, a.builder_themes?.themes),
297
+ theme: I(o, a.builder_themes?.themes),
298
298
  components: a.builder_components?.components ?? {},
299
299
  custom: o.custom,
300
300
  seo: o.seo,
@@ -305,22 +305,26 @@ function ne({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
305
305
  }
306
306
  //#endregion
307
307
  //#region src/fetchPage.js
308
- var re = async (e) => {
308
+ var R = async (e) => {
309
309
  let t = await e.json().catch(() => null);
310
310
  if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
311
311
  return t?.payload ?? t;
312
312
  };
313
- async function P({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, fetch: a }) {
313
+ async function z({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, fetch: a }) {
314
314
  if (!e) throw Error("fetchPage: apiUrl is required");
315
315
  if (!n) throw Error("fetchPage: slug is required");
316
- let o = a ?? fetch, s = e.replace(/\/$/, ""), c = t ? { "x-tenant": t } : {}, [l, u] = await Promise.all([o(`${s}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: c }).then(re), o(`${s}/settings/public`, { headers: c }).then(re)]);
317
- return ne({
316
+ let o = a ?? fetch, s = e.replace(/\/$/, ""), c = t ? { "x-tenant": t } : {}, [l, u] = await Promise.all([o(`${s}/render/${encodeURIComponent(n)}${i ? `?preview=${encodeURIComponent(i)}` : ""}`, { headers: c }).then(R), o(`${s}/settings/public`, { headers: c }).then(R)]), d = L({
318
317
  page: l,
319
318
  settings: u,
320
319
  tenant: t,
321
320
  apiUrl: s,
322
321
  locale: r
323
- });
322
+ }), f = [...new Set(Object.values(d.blocks ?? {}).map((e) => e?.type?.resolvedName === "CollectionList" ? e.props?.collection : e?.type?.resolvedName === "TableBlock" ? e.props?.source : null).filter(Boolean))];
323
+ if (f.length) {
324
+ let e = (e) => e.startsWith("api:") ? `${s}/data/${encodeURIComponent(e.slice(4))}` : `${s}/dynamic/${encodeURIComponent(e)}${r ? `?locale=${encodeURIComponent(r)}` : ""}`, t = await Promise.all(f.map((t) => o(e(t), { headers: c }).then(R).then((e) => [t, Array.isArray(e) ? e : []]).catch(() => [t, []])));
325
+ d.datasets = Object.fromEntries(t);
326
+ }
327
+ return d;
324
328
  }
325
329
  new Map([
326
330
  {
@@ -428,14 +432,14 @@ new Map([
428
432
  fallback: "sans-serif"
429
433
  }
430
434
  ].map((e) => [e.family, e]));
431
- function F(e) {
435
+ function ee(e) {
432
436
  return e.length ? `https://fonts.googleapis.com/css2?${e.map((e) => `family=${e.replace(/ /g, "+")}:wght@100..900`).join("&")}&display=swap` : null;
433
437
  }
434
- var I = (e) => F([e]), L = (e) => {
438
+ var te = (e) => ee([e]), ne = (e) => {
435
439
  let t = typeof e == "string" && e.match(/^"([^"]+)"/);
436
440
  return t ? t[1] : null;
437
441
  };
438
- function R(e, t) {
442
+ function B(e, t) {
439
443
  let n = /* @__PURE__ */ new Set(), r = (e) => {
440
444
  for (let t of Object.values(e || {})) for (let e of [
441
445
  "style",
@@ -443,7 +447,7 @@ function R(e, t) {
443
447
  "pressed",
444
448
  "focused"
445
449
  ]) {
446
- let r = L(t.props?.[e]?.fontFamily);
450
+ let r = ne(t.props?.[e]?.fontFamily);
447
451
  r && n.add(r);
448
452
  }
449
453
  };
@@ -453,30 +457,53 @@ function R(e, t) {
453
457
  }
454
458
  //#endregion
455
459
  //#region ../ui/src/components/builder/views.jsx
456
- var z = t({
460
+ var V = t({
457
461
  tenant: "",
458
462
  apiUrl: "/api"
459
- }), B = {
463
+ }), H = t(null), U = t(null), re = (e) => e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
464
+ function W(e, t) {
465
+ if (t) return t.includes(".") ? t.split(".").reduce((e, t) => e && typeof e == "object" ? e[t] : void 0, e) : e?.[t];
466
+ }
467
+ var ie = (e) => {
468
+ let t = [];
469
+ for (let [n, r] of Object.entries(e ?? {})) {
470
+ if (!/^[\w-]+$/.test(n)) continue;
471
+ t.push(n);
472
+ let e = Array.isArray(r) ? r[0] : r, i = Array.isArray(r) ? `${n}.0` : n;
473
+ if (e && typeof e == "object" && !Array.isArray(e)) for (let n of Object.keys(e)) /^[\w-]+$/.test(n) && t.push(`${i}.${n}`);
474
+ }
475
+ return t;
476
+ };
477
+ function G(e) {
478
+ return e == null ? "" : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? String(e) : 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(" ") : "").filter(Boolean).join(" ") : "";
479
+ }
480
+ function ae(e, t) {
481
+ let n = t?.data ?? {}, r = ie(n);
482
+ if (!r.length) return e;
483
+ let i = RegExp(`:(${r.map(re).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;
484
+ return a(e);
485
+ }
486
+ var K = {
460
487
  margin: 0,
461
488
  fontWeight: 700,
462
489
  lineHeight: 1.2,
463
490
  fontFamily: "var(--page-heading-font, inherit)"
464
- }, V = { margin: 0 }, H = {
491
+ }, q = { margin: 0 }, J = {
465
492
  display: "inline-block",
466
493
  textDecoration: "none",
467
494
  cursor: "pointer",
468
495
  backgroundColor: "var(--page-accent, #111827)",
469
496
  color: "var(--page-accent-text, #ffffff)"
470
- }, ie = {
497
+ }, oe = {
471
498
  flexGrow: 1,
472
499
  display: "flex",
473
500
  flexDirection: "column",
474
501
  position: "relative"
475
- }, U = {
502
+ }, se = {
476
503
  display: "flex",
477
504
  flexDirection: "column"
478
505
  };
479
- function W({ style: e }) {
506
+ function Y({ style: e }) {
480
507
  let t = e?.backgroundVideo;
481
508
  if (!t) return null;
482
509
  let n = {
@@ -487,7 +514,7 @@ function W({ style: e }) {
487
514
  zIndex: -1,
488
515
  pointerEvents: "none"
489
516
  }, r = e?.overlayColor ? `color-mix(in srgb, ${e.overlayColor} ${e.overlayOpacity ?? 50}%, transparent)` : null;
490
- return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("video", {
517
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("video", {
491
518
  src: t,
492
519
  autoPlay: !0,
493
520
  muted: !0,
@@ -497,73 +524,73 @@ function W({ style: e }) {
497
524
  ...n,
498
525
  objectFit: "cover"
499
526
  }
500
- }), r && /* @__PURE__ */ s("div", { style: {
527
+ }), r && /* @__PURE__ */ c("div", { style: {
501
528
  ...n,
502
529
  background: r
503
530
  } })] });
504
531
  }
505
- var G = (e, t) => e?.backgroundVideo ? {
532
+ var ce = (e, t) => e?.backgroundVideo ? {
506
533
  position: "relative",
507
534
  ...t,
508
- ...f(e)
535
+ ...p(e)
509
536
  } : {
510
537
  ...t,
511
- ...f(e)
538
+ ...p(e)
512
539
  };
513
- function ae({ style: e, nodeRef: t, children: n }) {
514
- return /* @__PURE__ */ c("div", {
540
+ function le({ style: e, nodeRef: t, children: n }) {
541
+ return /* @__PURE__ */ l("div", {
515
542
  ref: t,
516
543
  style: {
517
- ...ie,
518
- ...f(e)
544
+ ...oe,
545
+ ...p(e)
519
546
  },
520
- children: [/* @__PURE__ */ s(W, { style: e }), n]
547
+ children: [/* @__PURE__ */ c(Y, { style: e }), n]
521
548
  });
522
549
  }
523
- function K({ style: e, nodeRef: t, children: n }) {
524
- return /* @__PURE__ */ c("section", {
550
+ function ue({ style: e, nodeRef: t, children: n }) {
551
+ return /* @__PURE__ */ l("section", {
525
552
  ref: t,
526
- style: G(e, U),
527
- children: [/* @__PURE__ */ s(W, { style: e }), n]
553
+ style: ce(e, se),
554
+ children: [/* @__PURE__ */ c(Y, { style: e }), n]
528
555
  });
529
556
  }
530
- function q({ style: e, freeLayout: t, nodeRef: n, children: r }) {
557
+ function de({ style: e, freeLayout: t, nodeRef: n, children: r }) {
531
558
  let i = t ? {
532
559
  position: "relative",
533
560
  minHeight: 240
534
561
  } : null;
535
- return /* @__PURE__ */ c("div", {
562
+ return /* @__PURE__ */ l("div", {
536
563
  ref: n,
537
564
  style: i ? {
538
565
  ...i,
539
- ...G(e)
540
- } : G(e),
541
- children: [/* @__PURE__ */ s(W, { style: e }), r]
566
+ ...ce(e)
567
+ } : ce(e),
568
+ children: [/* @__PURE__ */ c(Y, { style: e }), r]
542
569
  });
543
570
  }
544
- function J({ text: e, parts: t, tag: n = "h2", style: r, linked: i, nodeRef: a }) {
545
- return /* @__PURE__ */ s(n, {
571
+ function fe({ text: e, parts: t, tag: n = "h2", style: r, linked: i, nodeRef: a }) {
572
+ return /* @__PURE__ */ c(n, {
546
573
  ref: a,
547
574
  style: {
548
- ...B,
549
- ...f(r)
575
+ ...K,
576
+ ...p(r)
550
577
  },
551
578
  children: X(t, e, i)
552
579
  });
553
580
  }
554
- var Y = {
555
- fontFamily: D.mono.value,
581
+ var pe = {
582
+ fontFamily: k.mono.value,
556
583
  background: "rgba(148, 163, 184, 0.18)",
557
584
  padding: "1px 5px",
558
585
  borderRadius: 4,
559
586
  fontSize: "0.9em"
560
587
  };
561
- function oe(e, t = [], n) {
588
+ function me(e, t = [], n) {
562
589
  let r = e;
563
- return t.includes("sup") ? r = /* @__PURE__ */ s("sup", { children: r }) : t.includes("sub") && (r = /* @__PURE__ */ s("sub", { children: r })), t.includes("code") && (r = /* @__PURE__ */ s("code", {
564
- style: Y,
590
+ return t.includes("sup") ? r = /* @__PURE__ */ c("sup", { children: r }) : t.includes("sub") && (r = /* @__PURE__ */ c("sub", { children: r })), t.includes("code") && (r = /* @__PURE__ */ c("code", {
591
+ style: pe,
565
592
  children: r
566
- })), t.includes("strike") && (r = /* @__PURE__ */ s("s", { children: r })), t.includes("underline") && (r = /* @__PURE__ */ s("u", { children: r })), t.includes("italic") && (r = /* @__PURE__ */ s("em", { children: r })), t.includes("bold") && (r = /* @__PURE__ */ s("strong", { children: r })), n && (r = /* @__PURE__ */ s("a", {
593
+ })), t.includes("strike") && (r = /* @__PURE__ */ c("s", { children: r })), t.includes("underline") && (r = /* @__PURE__ */ c("u", { children: r })), t.includes("italic") && (r = /* @__PURE__ */ c("em", { children: r })), t.includes("bold") && (r = /* @__PURE__ */ c("strong", { children: r })), n && (r = /* @__PURE__ */ c("a", {
567
594
  href: n,
568
595
  style: { color: "inherit" },
569
596
  children: r
@@ -571,26 +598,26 @@ function oe(e, t = [], n) {
571
598
  }
572
599
  function X(t, n, r) {
573
600
  return t?.length ? t.map((t, n) => {
574
- if (t.slot) return /* @__PURE__ */ s(e, { children: r?.[t.slot] ?? null }, n);
575
- if (t.parts) return /* @__PURE__ */ s(e, { children: X(t.parts, "", r) }, n);
601
+ if (t.slot) return /* @__PURE__ */ c(e, { children: r?.[t.slot] ?? null }, n);
602
+ if (t.parts) return /* @__PURE__ */ c(e, { children: X(t.parts, "", r) }, n);
576
603
  let i = t.text;
577
- return t.sup ? i = /* @__PURE__ */ s("sup", { children: i }) : t.sub && (i = /* @__PURE__ */ s("sub", { children: i })), t.code && (i = /* @__PURE__ */ s("code", {
578
- style: Y,
604
+ return t.sup ? i = /* @__PURE__ */ c("sup", { children: i }) : t.sub && (i = /* @__PURE__ */ c("sub", { children: i })), t.code && (i = /* @__PURE__ */ c("code", {
605
+ style: pe,
579
606
  children: i
580
- })), t.strike && (i = /* @__PURE__ */ s("s", { children: i })), t.underline && (i = /* @__PURE__ */ s("u", { children: i })), t.italic && (i = /* @__PURE__ */ s("em", { children: i })), t.bold && (i = /* @__PURE__ */ s("strong", { children: i })), t.href && (i = /* @__PURE__ */ s("a", {
607
+ })), t.strike && (i = /* @__PURE__ */ c("s", { children: i })), t.underline && (i = /* @__PURE__ */ c("u", { children: i })), t.italic && (i = /* @__PURE__ */ c("em", { children: i })), t.bold && (i = /* @__PURE__ */ c("strong", { children: i })), t.href && (i = /* @__PURE__ */ c("a", {
581
608
  href: t.href,
582
609
  style: { color: "inherit" },
583
610
  children: i
584
- })), /* @__PURE__ */ s(e, { children: i }, n);
611
+ })), /* @__PURE__ */ c(e, { children: i }, n);
585
612
  }) : n;
586
613
  }
587
- function se({ parts: e, text: t, marks: n, href: r, style: i }) {
588
- return /* @__PURE__ */ s("span", {
589
- style: f(i),
590
- children: e?.length ? X(e, t) : oe(t, n, r)
614
+ function he({ parts: e, text: t, marks: n, href: r, style: i }) {
615
+ return /* @__PURE__ */ c("span", {
616
+ style: p(i),
617
+ children: e?.length ? X(e, t) : me(t, n, r)
591
618
  });
592
619
  }
593
- var ce = {
620
+ var ge = {
594
621
  h1: 40,
595
622
  h2: 32,
596
623
  h3: 26,
@@ -598,7 +625,7 @@ var ce = {
598
625
  h5: 19,
599
626
  h6: 16
600
627
  };
601
- function le({ align: e = "center", width: t } = {}) {
628
+ function _e({ align: e = "center", width: t } = {}) {
602
629
  let n = t ? `${t}%` : void 0;
603
630
  return e === "full" ? { width: "100%" } : e === "left" ? {
604
631
  float: "left",
@@ -621,7 +648,7 @@ function le({ align: e = "center", width: t } = {}) {
621
648
  marginRight: "auto"
622
649
  };
623
650
  }
624
- function ue(e = [], t, n) {
651
+ function ve(e = [], t, n) {
625
652
  let r = n ?? ((e, n) => X(e, n, t));
626
653
  return e.map((t, n) => {
627
654
  let i = {
@@ -630,7 +657,7 @@ function ue(e = [], t, n) {
630
657
  };
631
658
  if (t.type === "image") {
632
659
  if (!t.src) return null;
633
- let e = /* @__PURE__ */ s("img", {
660
+ let e = /* @__PURE__ */ c("img", {
634
661
  src: t.src,
635
662
  alt: t.alt || "",
636
663
  style: {
@@ -639,18 +666,18 @@ function ue(e = [], t, n) {
639
666
  borderRadius: 6
640
667
  }
641
668
  });
642
- return /* @__PURE__ */ c("figure", {
669
+ return /* @__PURE__ */ l("figure", {
643
670
  style: {
644
671
  marginLeft: 0,
645
672
  marginRight: 0,
646
673
  ...i,
647
- ...le(t)
674
+ ..._e(t)
648
675
  },
649
- children: [t.href ? /* @__PURE__ */ s("a", {
676
+ children: [t.href ? /* @__PURE__ */ c("a", {
650
677
  href: t.href,
651
678
  style: { display: "block" },
652
679
  children: e
653
- }) : e, t.caption && /* @__PURE__ */ s("figcaption", {
680
+ }) : e, t.caption && /* @__PURE__ */ c("figcaption", {
654
681
  style: {
655
682
  fontSize: 13,
656
683
  opacity: .65,
@@ -661,15 +688,15 @@ function ue(e = [], t, n) {
661
688
  })]
662
689
  }, n);
663
690
  }
664
- if (t.type === "video") return xe(t.url) ? /* @__PURE__ */ s("div", {
691
+ if (t.type === "video") return ke(t.url) ? /* @__PURE__ */ c("div", {
665
692
  style: {
666
693
  ...i,
667
- ...le({
694
+ ..._e({
668
695
  align: t.align,
669
696
  width: t.width ?? 100
670
697
  })
671
698
  },
672
- children: /* @__PURE__ */ s(Se, {
699
+ children: /* @__PURE__ */ c(Ae, {
673
700
  url: t.url,
674
701
  autoplay: t.autoplay,
675
702
  muted: t.muted,
@@ -678,147 +705,147 @@ function ue(e = [], t, n) {
678
705
  start: t.start
679
706
  })
680
707
  }, n) : null;
681
- if (t.type === "divider") return /* @__PURE__ */ s("hr", { style: {
708
+ if (t.type === "divider") return /* @__PURE__ */ c("hr", { style: {
682
709
  ...i,
683
710
  border: 0,
684
711
  borderTop: "1px solid rgba(148, 163, 184, 0.4)"
685
712
  } }, n);
686
713
  if (t.type === "ul" || t.type === "ol") {
687
714
  let e = t.type;
688
- return /* @__PURE__ */ s(e, {
715
+ return /* @__PURE__ */ c(e, {
689
716
  style: {
690
717
  ...i,
691
718
  paddingLeft: 24
692
719
  },
693
- children: (t.items ?? []).map((e, t) => /* @__PURE__ */ s("li", {
720
+ children: (t.items ?? []).map((e, t) => /* @__PURE__ */ c("li", {
694
721
  style: { marginBottom: 4 },
695
722
  children: r(e.parts, e.text)
696
723
  }, t))
697
724
  }, n);
698
725
  }
699
- if (t.type === "quote") return /* @__PURE__ */ s("blockquote", {
726
+ if (t.type === "quote") return /* @__PURE__ */ c("blockquote", {
700
727
  style: {
701
- ...fe,
728
+ ...be,
702
729
  ...i
703
730
  },
704
731
  children: r(t.parts, t.text)
705
732
  }, n);
706
- if (ce[t.type]) {
733
+ if (ge[t.type]) {
707
734
  let e = t.type;
708
- return /* @__PURE__ */ s(e, {
735
+ return /* @__PURE__ */ c(e, {
709
736
  style: {
710
- ...B,
711
- fontSize: ce[t.type],
737
+ ...K,
738
+ fontSize: ge[t.type],
712
739
  ...i
713
740
  },
714
741
  children: r(t.parts, t.text)
715
742
  }, n);
716
743
  }
717
- return /* @__PURE__ */ s("p", {
744
+ return /* @__PURE__ */ c("p", {
718
745
  style: {
719
- ...V,
746
+ ...q,
720
747
  ...i
721
748
  },
722
749
  children: r(t.parts, t.text)
723
750
  }, n);
724
751
  });
725
752
  }
726
- function de({ content: e, style: t, linked: n, nodeRef: r }) {
727
- return /* @__PURE__ */ s("div", {
753
+ function ye({ content: e, style: t, linked: n, nodeRef: r }) {
754
+ return /* @__PURE__ */ c("div", {
728
755
  ref: r,
729
756
  style: {
730
757
  display: "flow-root",
731
- ...f(t)
758
+ ...p(t)
732
759
  },
733
- children: ue(e, n)
760
+ children: ve(e, n)
734
761
  });
735
762
  }
736
- var fe = {
763
+ var be = {
737
764
  margin: 0,
738
765
  padding: "8px 0 8px 20px",
739
766
  borderLeft: "4px solid var(--page-accent, rgba(148, 163, 184, 0.6))"
740
767
  };
741
- function pe({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
742
- return /* @__PURE__ */ s("blockquote", {
768
+ function xe({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
769
+ return /* @__PURE__ */ c("blockquote", {
743
770
  ref: i,
744
771
  style: {
745
- ...fe,
746
- ...f(n)
772
+ ...be,
773
+ ...p(n)
747
774
  },
748
775
  children: X(t, e, r)
749
776
  });
750
777
  }
751
- function me({ ordered: e, items: t = [], style: n, nodeRef: r }) {
752
- return /* @__PURE__ */ s(e ? "ol" : "ul", {
778
+ function Se({ ordered: e, items: t = [], style: n, nodeRef: r }) {
779
+ return /* @__PURE__ */ c(e ? "ol" : "ul", {
753
780
  ref: r,
754
781
  style: {
755
782
  margin: 0,
756
783
  paddingLeft: 24,
757
- ...f(n)
784
+ ...p(n)
758
785
  },
759
- children: t.map((e, t) => /* @__PURE__ */ s("li", {
786
+ children: t.map((e, t) => /* @__PURE__ */ c("li", {
760
787
  style: { marginBottom: 4 },
761
788
  children: X(e.parts, e.text)
762
789
  }, t))
763
790
  });
764
791
  }
765
- function he({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
766
- return /* @__PURE__ */ s("p", {
792
+ function Ce({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
793
+ return /* @__PURE__ */ c("p", {
767
794
  ref: i,
768
795
  style: {
769
- ...V,
770
- ...f(n)
796
+ ...q,
797
+ ...p(n)
771
798
  },
772
799
  children: X(t, e, r)
773
800
  });
774
801
  }
775
- var ge = {
802
+ var we = {
776
803
  color: "var(--page-accent, inherit)",
777
804
  textDecoration: "underline",
778
805
  textUnderlineOffset: 3,
779
806
  cursor: "pointer"
780
807
  };
781
- function _e({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
782
- return /* @__PURE__ */ s("a", {
808
+ function Te({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
809
+ return /* @__PURE__ */ c("a", {
783
810
  ref: o,
784
811
  href: n || "#",
785
812
  target: r || void 0,
786
813
  rel: r === "_blank" ? "noopener noreferrer" : void 0,
787
814
  style: {
788
- ...ge,
789
- ...f(i)
815
+ ...we,
816
+ ...p(i)
790
817
  },
791
818
  children: X(t, e, a)
792
819
  });
793
820
  }
794
- function ve({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
795
- return /* @__PURE__ */ s("a", {
821
+ function Ee({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
822
+ return /* @__PURE__ */ c("a", {
796
823
  ref: o,
797
824
  href: n || "#",
798
825
  target: r || void 0,
799
826
  rel: r === "_blank" ? "noopener noreferrer" : void 0,
800
827
  style: {
801
- ...H,
802
- ...f(i)
828
+ ...J,
829
+ ...p(i)
803
830
  },
804
831
  children: X(t, e, a)
805
832
  });
806
833
  }
807
- function ye({ src: e, alt: t, style: n, nodeRef: r }) {
808
- return e ? /* @__PURE__ */ s("img", {
834
+ function De({ src: e, alt: t, style: n, nodeRef: r }) {
835
+ return e ? /* @__PURE__ */ c("img", {
809
836
  ref: r,
810
837
  src: e,
811
838
  alt: t || "",
812
839
  style: {
813
840
  display: "block",
814
841
  maxWidth: "100%",
815
- ...f(n)
842
+ ...p(n)
816
843
  }
817
844
  }) : null;
818
845
  }
819
- function be({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !1, muted: a = !1, style: o, nodeRef: c }) {
820
- return e ? /* @__PURE__ */ s("video", {
821
- ref: c,
846
+ function Oe({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !1, muted: a = !1, style: o, nodeRef: s }) {
847
+ return e ? /* @__PURE__ */ c("video", {
848
+ ref: s,
822
849
  src: e,
823
850
  poster: t || void 0,
824
851
  controls: n,
@@ -830,24 +857,24 @@ function be({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !
830
857
  display: "block",
831
858
  width: "100%",
832
859
  maxWidth: "100%",
833
- ...f(o)
860
+ ...p(o)
834
861
  }
835
862
  }) : null;
836
863
  }
837
- var xe = (e = "") => (e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/) || e.match(/^([\w-]{11})$/))?.[1];
838
- function Se({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i = !0, start: a, style: o, nodeRef: c }) {
839
- let l = xe(e);
864
+ var ke = (e = "") => (e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/) || e.match(/^([\w-]{11})$/))?.[1];
865
+ function Ae({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i = !0, start: a, style: o, nodeRef: s }) {
866
+ let l = ke(e);
840
867
  if (!l) return null;
841
868
  let u = new URLSearchParams({ rel: "0" });
842
- return t && u.set("autoplay", "1"), (n || t) && u.set("mute", "1"), i || u.set("controls", "0"), r && (u.set("loop", "1"), u.set("playlist", l)), Number(a) > 0 && u.set("start", String(Math.floor(Number(a)))), /* @__PURE__ */ s("div", {
843
- ref: c,
869
+ return t && u.set("autoplay", "1"), (n || t) && u.set("mute", "1"), i || u.set("controls", "0"), r && (u.set("loop", "1"), u.set("playlist", l)), Number(a) > 0 && u.set("start", String(Math.floor(Number(a)))), /* @__PURE__ */ c("div", {
870
+ ref: s,
844
871
  style: {
845
872
  position: "relative",
846
873
  width: "100%",
847
874
  paddingTop: "56.25%",
848
- ...f(o)
875
+ ...p(o)
849
876
  },
850
- children: /* @__PURE__ */ s("iframe", {
877
+ children: /* @__PURE__ */ c("iframe", {
851
878
  src: `https://www.youtube-nocookie.com/embed/${l}?${u}`,
852
879
  title: "YouTube video",
853
880
  allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
@@ -862,8 +889,8 @@ function Se({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i
862
889
  })
863
890
  });
864
891
  }
865
- function Ce({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i }) {
866
- return e ? /* @__PURE__ */ s("iframe", {
892
+ function je({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i }) {
893
+ return e ? /* @__PURE__ */ c("iframe", {
867
894
  ref: i,
868
895
  src: e,
869
896
  title: t || "Embedded frame",
@@ -874,31 +901,31 @@ function Ce({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i })
874
901
  width: "100%",
875
902
  height: 300,
876
903
  border: 0,
877
- ...f(r)
904
+ ...p(r)
878
905
  }
879
906
  }) : null;
880
907
  }
881
- function we({ code: e, runScripts: t = !0, style: n, nodeRef: i }) {
882
- let [o, c] = a(null);
908
+ function Me({ code: e, runScripts: t = !0, style: n, nodeRef: i }) {
909
+ let [a, s] = o(null);
883
910
  return r(() => {
884
- o && (o.innerHTML = e || "", t && o.querySelectorAll("script").forEach((e) => {
911
+ a && (a.innerHTML = e || "", t && a.querySelectorAll("script").forEach((e) => {
885
912
  let t = document.createElement("script");
886
913
  for (let { name: n, value: r } of e.attributes) t.setAttribute(n, r);
887
914
  t.text = e.textContent, e.replaceWith(t);
888
915
  }));
889
916
  }, [
890
- o,
917
+ a,
891
918
  e,
892
919
  t
893
- ]), /* @__PURE__ */ s("div", {
920
+ ]), /* @__PURE__ */ c("div", {
894
921
  ref: (e) => {
895
- c(e), i && i(e);
922
+ s(e), i && i(e);
896
923
  },
897
- style: f(n)
924
+ style: p(n)
898
925
  });
899
926
  }
900
- function Te({ height: e, nodeRef: t }) {
901
- return /* @__PURE__ */ s("div", {
927
+ function Ne({ height: e, nodeRef: t }) {
928
+ return /* @__PURE__ */ c("div", {
902
929
  ref: t,
903
930
  style: {
904
931
  height: e || 32,
@@ -907,18 +934,18 @@ function Te({ height: e, nodeRef: t }) {
907
934
  }
908
935
  });
909
936
  }
910
- function Ee({ style: e, nodeRef: t }) {
911
- return /* @__PURE__ */ s("div", {
937
+ function Pe({ style: e, nodeRef: t }) {
938
+ return /* @__PURE__ */ c("div", {
912
939
  ref: t,
913
940
  style: {
914
941
  height: 1,
915
942
  alignSelf: "stretch",
916
943
  flexShrink: 0,
917
- ...f(e)
944
+ ...p(e)
918
945
  }
919
946
  });
920
947
  }
921
- var De = {
948
+ var Fe = {
922
949
  position: "absolute",
923
950
  top: "50%",
924
951
  transform: "translateY(-50%)",
@@ -935,7 +962,7 @@ var De = {
935
962
  alignItems: "center",
936
963
  justifyContent: "center",
937
964
  padding: 0
938
- }, Oe = {
965
+ }, Ie = {
939
966
  bottom: {
940
967
  inset: "auto 0 0 0",
941
968
  padding: "40px 24px 20px",
@@ -954,9 +981,9 @@ var De = {
954
981
  padding: 24,
955
982
  textShadow: "0 2px 12px rgba(0, 0, 0, 0.6)"
956
983
  }
957
- }, ke = 48;
958
- function Ae({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, height: l = 320, swipe: u = !0, style: d, nodeRef: p }) {
959
- let [m, h] = a(0), [g, _] = a(!1), [v, y] = a(null), b = e ? Math.min(m, e - 1) : 0;
984
+ }, Le = 48;
985
+ function Re({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, height: a = 320, swipe: u = !0, style: d, nodeRef: f }) {
986
+ let [m, h] = o(0), [g, _] = o(!1), [v, y] = o(null), b = e ? Math.min(m, e - 1) : 0;
960
987
  if (r(() => {
961
988
  if (!n || g || v || e < 2) return;
962
989
  let t = setInterval(() => h((t) => (t + 1) % e), Math.max(2, Number(i) || 5) * 1e3);
@@ -971,10 +998,10 @@ function Ae({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
971
998
  let x = (t) => h((t + e) % e), S = () => {
972
999
  if (!v) return;
973
1000
  let { dx: e } = v;
974
- y(null), e < -48 ? x(b + 1) : e > ke && x(b - 1);
1001
+ y(null), e < -48 ? x(b + 1) : e > Le && x(b - 1);
975
1002
  };
976
- return /* @__PURE__ */ c("div", {
977
- ref: p,
1003
+ return /* @__PURE__ */ l("div", {
1004
+ ref: f,
978
1005
  onMouseEnter: () => _(!0),
979
1006
  onMouseLeave: () => _(!1),
980
1007
  onPointerDown: u && e > 1 ? (e) => {
@@ -996,16 +1023,16 @@ function Ae({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
996
1023
  touchAction: "pan-y",
997
1024
  userSelect: v ? "none" : void 0,
998
1025
  cursor: v ? "grabbing" : void 0,
999
- ...f(d)
1026
+ ...p(d)
1000
1027
  },
1001
- children: [/* @__PURE__ */ s("div", {
1028
+ children: [/* @__PURE__ */ c("div", {
1002
1029
  style: {
1003
1030
  display: "flex",
1004
- height: l,
1031
+ height: a,
1005
1032
  transform: `translateX(calc(${-b * 100}% + ${v?.dx ?? 0}px))`,
1006
1033
  transition: v ? "none" : "transform 450ms ease"
1007
1034
  },
1008
- children: Array.from({ length: e }, (e, n) => /* @__PURE__ */ s("div", {
1035
+ children: Array.from({ length: e }, (e, n) => /* @__PURE__ */ c("div", {
1009
1036
  style: {
1010
1037
  position: "relative",
1011
1038
  width: "100%",
@@ -1014,28 +1041,28 @@ function Ae({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
1014
1041
  },
1015
1042
  children: t(n)
1016
1043
  }, n))
1017
- }), e > 1 && /* @__PURE__ */ c(o, { children: [
1018
- /* @__PURE__ */ s("button", {
1044
+ }), e > 1 && /* @__PURE__ */ l(s, { children: [
1045
+ /* @__PURE__ */ c("button", {
1019
1046
  type: "button",
1020
1047
  "aria-label": "Previous slide",
1021
1048
  style: {
1022
- ...De,
1049
+ ...Fe,
1023
1050
  left: 12
1024
1051
  },
1025
1052
  onClick: () => x(b - 1),
1026
1053
  children: "‹"
1027
1054
  }),
1028
- /* @__PURE__ */ s("button", {
1055
+ /* @__PURE__ */ c("button", {
1029
1056
  type: "button",
1030
1057
  "aria-label": "Next slide",
1031
1058
  style: {
1032
- ...De,
1059
+ ...Fe,
1033
1060
  right: 12
1034
1061
  },
1035
1062
  onClick: () => x(b + 1),
1036
1063
  children: "›"
1037
1064
  }),
1038
- /* @__PURE__ */ s("div", {
1065
+ /* @__PURE__ */ c("div", {
1039
1066
  style: {
1040
1067
  position: "absolute",
1041
1068
  bottom: 10,
@@ -1045,7 +1072,7 @@ function Ae({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
1045
1072
  justifyContent: "center",
1046
1073
  gap: 6
1047
1074
  },
1048
- children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ s("button", {
1075
+ children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ c("button", {
1049
1076
  type: "button",
1050
1077
  "aria-label": `Go to slide ${t + 1}`,
1051
1078
  onClick: () => x(t),
@@ -1063,7 +1090,7 @@ function Ae({ count: e, renderSlide: t, autoplay: n = !0, interval: i = 5, heigh
1063
1090
  ] })]
1064
1091
  });
1065
1092
  }
1066
- var je = (e, t) => ({
1093
+ var ze = (e, t) => ({
1067
1094
  position: "absolute",
1068
1095
  inset: 0,
1069
1096
  backgroundImage: e ? `url(${e})` : "none",
@@ -1071,26 +1098,26 @@ var je = (e, t) => ({
1071
1098
  backgroundSize: "cover",
1072
1099
  backgroundPosition: "center"
1073
1100
  });
1074
- function Me({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "left", ...r }) {
1075
- return e.length ? /* @__PURE__ */ s(Ae, {
1101
+ function Be({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "left", ...r }) {
1102
+ return e.length ? /* @__PURE__ */ c(Re, {
1076
1103
  ...r,
1077
1104
  count: e.length,
1078
1105
  renderSlide: (r) => {
1079
1106
  let i = e[r];
1080
- return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", { style: je(i.image) }), (i.title || i.text) && /* @__PURE__ */ c("div", {
1107
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", { style: ze(i.image) }), (i.title || i.text) && /* @__PURE__ */ l("div", {
1081
1108
  style: {
1082
1109
  position: "absolute",
1083
1110
  color: "#fff",
1084
1111
  textAlign: n,
1085
- ...Oe[t] ?? Oe.bottom
1112
+ ...Ie[t] ?? Ie.bottom
1086
1113
  },
1087
- children: [i.title && /* @__PURE__ */ s("div", {
1114
+ children: [i.title && /* @__PURE__ */ c("div", {
1088
1115
  style: {
1089
1116
  fontSize: 22,
1090
1117
  fontWeight: 700
1091
1118
  },
1092
1119
  children: i.title
1093
- }), i.text && /* @__PURE__ */ s("div", {
1120
+ }), i.text && /* @__PURE__ */ c("div", {
1094
1121
  style: {
1095
1122
  fontSize: 14,
1096
1123
  opacity: .9,
@@ -1102,13 +1129,13 @@ function Me({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "
1102
1129
  }
1103
1130
  }) : null;
1104
1131
  }
1105
- function Ne({ slides: e = [], linked: t, ...n }) {
1106
- return e.length ? /* @__PURE__ */ s(Ae, {
1132
+ function Ve({ slides: e = [], linked: t, ...n }) {
1133
+ return e.length ? /* @__PURE__ */ c(Re, {
1107
1134
  ...n,
1108
1135
  count: e.length,
1109
1136
  renderSlide: (n) => {
1110
1137
  let r = e[n];
1111
- return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", { style: je(r.image, r.color) }), /* @__PURE__ */ s("div", {
1138
+ return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c("div", { style: ze(r.image, r.color) }), /* @__PURE__ */ c("div", {
1112
1139
  style: {
1113
1140
  position: "absolute",
1114
1141
  inset: 0,
@@ -1125,28 +1152,28 @@ var Z = {
1125
1152
  textDecoration: "none",
1126
1153
  fontSize: 14,
1127
1154
  opacity: .85
1128
- }, Pe = {
1155
+ }, He = {
1129
1156
  background: "var(--page-bg, #ffffff)",
1130
1157
  color: "var(--page-text, #111827)",
1131
1158
  border: "1px solid rgba(148, 163, 184, 0.25)",
1132
1159
  boxShadow: "0 16px 40px rgba(15, 23, 42, 0.16)",
1133
1160
  zIndex: 60
1134
1161
  };
1135
- function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u = "auto", breakpoint: d = 768 }) {
1136
- let [p, m] = a(null), [h, g] = a(!1), [_, v] = a(!1), [y, b] = a(null);
1162
+ function Ue({ brand: t, logo: n, links: i = [], style: a, nodeRef: s, menu: u = "auto", breakpoint: d = 768 }) {
1163
+ let [f, m] = o(null), [h, g] = o(!1), [_, v] = o(!1), [y, b] = o(null);
1137
1164
  r(() => {
1138
- if (!p) return;
1139
- let e = new ResizeObserver(() => g(p.offsetWidth < d));
1140
- return e.observe(p), () => e.disconnect();
1141
- }, [p, d]);
1142
- let x = u === "hamburger" || u === "auto" && h, S = (e, t) => /* @__PURE__ */ c("a", {
1165
+ if (!f) return;
1166
+ let e = new ResizeObserver(() => g(f.offsetWidth < d));
1167
+ return e.observe(f), () => e.disconnect();
1168
+ }, [f, d]);
1169
+ let x = u === "hamburger" || u === "auto" && h, S = (e, t) => /* @__PURE__ */ l("a", {
1143
1170
  href: e.href || "#",
1144
1171
  style: {
1145
1172
  ...Z,
1146
1173
  display: "block",
1147
1174
  ...t
1148
1175
  },
1149
- children: [e.label, e.desc && /* @__PURE__ */ s("span", {
1176
+ children: [e.label, e.desc && /* @__PURE__ */ c("span", {
1150
1177
  style: {
1151
1178
  display: "block",
1152
1179
  fontSize: 12,
@@ -1156,9 +1183,9 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1156
1183
  children: e.desc
1157
1184
  })]
1158
1185
  }, e.key);
1159
- return /* @__PURE__ */ c("nav", {
1186
+ return /* @__PURE__ */ l("nav", {
1160
1187
  ref: (e) => {
1161
- m(e), l && l(e);
1188
+ m(e), s && s(e);
1162
1189
  },
1163
1190
  style: {
1164
1191
  display: "flex",
@@ -1168,10 +1195,10 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1168
1195
  padding: "14px 24px",
1169
1196
  width: "100%",
1170
1197
  position: "relative",
1171
- ...f(o)
1198
+ ...p(a)
1172
1199
  },
1173
1200
  children: [
1174
- n && /* @__PURE__ */ s("img", {
1201
+ n && /* @__PURE__ */ c("img", {
1175
1202
  src: n,
1176
1203
  alt: t || "Logo",
1177
1204
  style: {
@@ -1179,7 +1206,7 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1179
1206
  display: "block"
1180
1207
  }
1181
1208
  }),
1182
- t && /* @__PURE__ */ s("div", {
1209
+ t && /* @__PURE__ */ c("div", {
1183
1210
  style: {
1184
1211
  fontWeight: 700,
1185
1212
  fontSize: 18,
@@ -1187,8 +1214,8 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1187
1214
  },
1188
1215
  children: t
1189
1216
  }),
1190
- /* @__PURE__ */ s("div", { style: { flexGrow: 1 } }),
1191
- x ? /* @__PURE__ */ s("button", {
1217
+ /* @__PURE__ */ c("div", { style: { flexGrow: 1 } }),
1218
+ x ? /* @__PURE__ */ c("button", {
1192
1219
  type: "button",
1193
1220
  "aria-label": _ ? "Close menu" : "Open menu",
1194
1221
  onClick: () => v(!_),
@@ -1202,7 +1229,7 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1202
1229
  padding: 4
1203
1230
  },
1204
1231
  children: _ ? "✕" : "☰"
1205
- }) : /* @__PURE__ */ s("div", {
1232
+ }) : /* @__PURE__ */ c("div", {
1206
1233
  style: {
1207
1234
  display: "flex",
1208
1235
  gap: 20,
@@ -1211,20 +1238,20 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1211
1238
  },
1212
1239
  children: i.map((e) => {
1213
1240
  let t = e.children ?? [];
1214
- if (!t.length) return /* @__PURE__ */ s("a", {
1241
+ if (!t.length) return /* @__PURE__ */ c("a", {
1215
1242
  href: e.href || "#",
1216
1243
  style: Z,
1217
1244
  children: e.label
1218
1245
  }, e.key);
1219
1246
  let n = e.type === "mega";
1220
- return /* @__PURE__ */ c("span", {
1247
+ return /* @__PURE__ */ l("span", {
1221
1248
  style: {
1222
1249
  position: n ? "static" : "relative",
1223
1250
  display: "inline-flex"
1224
1251
  },
1225
1252
  onMouseEnter: () => b(e.key),
1226
1253
  onMouseLeave: () => b(null),
1227
- children: [/* @__PURE__ */ c("a", {
1254
+ children: [/* @__PURE__ */ l("a", {
1228
1255
  href: e.href || "#",
1229
1256
  style: {
1230
1257
  ...Z,
@@ -1233,7 +1260,7 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1233
1260
  children: [
1234
1261
  e.label,
1235
1262
  " ",
1236
- /* @__PURE__ */ s("span", {
1263
+ /* @__PURE__ */ c("span", {
1237
1264
  style: {
1238
1265
  fontSize: 9,
1239
1266
  opacity: .6
@@ -1241,9 +1268,9 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1241
1268
  children: "▼"
1242
1269
  })
1243
1270
  ]
1244
- }), y === e.key && (n ? /* @__PURE__ */ s("div", {
1271
+ }), y === e.key && (n ? /* @__PURE__ */ c("div", {
1245
1272
  style: {
1246
- ...Pe,
1273
+ ...He,
1247
1274
  position: "absolute",
1248
1275
  left: 0,
1249
1276
  right: 0,
@@ -1257,9 +1284,9 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1257
1284
  padding: "6px 8px",
1258
1285
  borderRadius: 6
1259
1286
  }))
1260
- }) : /* @__PURE__ */ s("div", {
1287
+ }) : /* @__PURE__ */ c("div", {
1261
1288
  style: {
1262
- ...Pe,
1289
+ ...He,
1263
1290
  position: "absolute",
1264
1291
  top: "100%",
1265
1292
  left: 0,
@@ -1277,7 +1304,7 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1277
1304
  }, e.key);
1278
1305
  })
1279
1306
  }),
1280
- x && _ && /* @__PURE__ */ s("div", {
1307
+ x && _ && /* @__PURE__ */ c("div", {
1281
1308
  style: {
1282
1309
  flexBasis: "100%",
1283
1310
  width: "100%",
@@ -1285,7 +1312,7 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1285
1312
  flexDirection: "column",
1286
1313
  paddingTop: 10
1287
1314
  },
1288
- children: i.map((t) => /* @__PURE__ */ c(e, { children: [/* @__PURE__ */ s("a", {
1315
+ children: i.map((t) => /* @__PURE__ */ l(e, { children: [/* @__PURE__ */ c("a", {
1289
1316
  href: t.href || "#",
1290
1317
  style: {
1291
1318
  ...Z,
@@ -1299,23 +1326,23 @@ function Fe({ brand: t, logo: n, links: i = [], style: o, nodeRef: l, menu: u =
1299
1326
  ]
1300
1327
  });
1301
1328
  }
1302
- function Ie({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1303
- let [i, o] = a(0), l = e.length ? Math.min(i, e.length - 1) : 0;
1304
- return e.length ? /* @__PURE__ */ c("div", {
1329
+ function We({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1330
+ let [i, a] = o(0), s = e.length ? Math.min(i, e.length - 1) : 0;
1331
+ return e.length ? /* @__PURE__ */ l("div", {
1305
1332
  ref: r,
1306
1333
  style: {
1307
1334
  width: "100%",
1308
- ...f(n)
1335
+ ...p(n)
1309
1336
  },
1310
- children: [/* @__PURE__ */ s("div", {
1337
+ children: [/* @__PURE__ */ c("div", {
1311
1338
  style: {
1312
1339
  display: "flex",
1313
1340
  gap: 4,
1314
1341
  borderBottom: "1px solid rgba(148, 163, 184, 0.35)"
1315
1342
  },
1316
- children: e.map((e, t) => /* @__PURE__ */ s("button", {
1343
+ children: e.map((e, t) => /* @__PURE__ */ c("button", {
1317
1344
  type: "button",
1318
- onClick: () => o(t),
1345
+ onClick: () => a(t),
1319
1346
  style: {
1320
1347
  background: "transparent",
1321
1348
  border: 0,
@@ -1324,39 +1351,39 @@ function Ie({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1324
1351
  fontFamily: "inherit",
1325
1352
  color: "inherit",
1326
1353
  cursor: "pointer",
1327
- opacity: t === l ? 1 : .6,
1328
- fontWeight: t === l ? 600 : 500,
1329
- boxShadow: t === l ? "inset 0 -2px 0 var(--page-accent, #111827)" : "none"
1354
+ opacity: t === s ? 1 : .6,
1355
+ fontWeight: t === s ? 600 : 500,
1356
+ boxShadow: t === s ? "inset 0 -2px 0 var(--page-accent, #111827)" : "none"
1330
1357
  },
1331
1358
  children: e.label || `Tab ${t + 1}`
1332
1359
  }, e.key))
1333
- }), e.map((e, n) => /* @__PURE__ */ s("div", {
1360
+ }), e.map((e, n) => /* @__PURE__ */ c("div", {
1334
1361
  style: {
1335
- display: n === l ? "flex" : "none",
1362
+ display: n === s ? "flex" : "none",
1336
1363
  flexDirection: "column"
1337
1364
  },
1338
1365
  children: t?.[e.key] ?? null
1339
1366
  }, e.key))]
1340
1367
  }) : null;
1341
1368
  }
1342
- function Le({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }) {
1343
- let [o, l] = a(() => new Set(e.length ? [e[0].key] : []));
1369
+ function Ge({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }) {
1370
+ let [a, s] = o(() => new Set(e.length ? [e[0].key] : []));
1344
1371
  if (!e.length) return null;
1345
- let u = (e) => l((t) => {
1372
+ let u = (e) => s((t) => {
1346
1373
  let r = new Set(n ? t : []);
1347
1374
  return t.has(e) ? r.delete(e) : r.add(e), r;
1348
1375
  });
1349
- return /* @__PURE__ */ s("div", {
1376
+ return /* @__PURE__ */ c("div", {
1350
1377
  ref: i,
1351
1378
  style: {
1352
1379
  width: "100%",
1353
- ...f(r)
1380
+ ...p(r)
1354
1381
  },
1355
1382
  children: e.map((n, r) => {
1356
- let i = o.has(n.key);
1357
- return /* @__PURE__ */ c("div", {
1383
+ let i = a.has(n.key);
1384
+ return /* @__PURE__ */ l("div", {
1358
1385
  style: { borderBottom: r < e.length - 1 ? "1px solid rgba(148, 163, 184, 0.35)" : "none" },
1359
- children: [/* @__PURE__ */ c("button", {
1386
+ children: [/* @__PURE__ */ l("button", {
1360
1387
  type: "button",
1361
1388
  onClick: () => u(n.key),
1362
1389
  style: {
@@ -1375,7 +1402,7 @@ function Le({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }
1375
1402
  textAlign: "left",
1376
1403
  cursor: "pointer"
1377
1404
  },
1378
- children: [n.title || `Item ${r + 1}`, /* @__PURE__ */ s("span", {
1405
+ children: [n.title || `Item ${r + 1}`, /* @__PURE__ */ c("span", {
1379
1406
  "aria-hidden": !0,
1380
1407
  style: {
1381
1408
  fontSize: 12,
@@ -1385,7 +1412,7 @@ function Le({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }
1385
1412
  },
1386
1413
  children: "▼"
1387
1414
  })]
1388
- }), /* @__PURE__ */ s("div", {
1415
+ }), /* @__PURE__ */ c("div", {
1389
1416
  style: {
1390
1417
  display: i ? "flex" : "none",
1391
1418
  flexDirection: "column"
@@ -1396,11 +1423,11 @@ function Le({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }
1396
1423
  })
1397
1424
  });
1398
1425
  }
1399
- var Re = {
1426
+ var Ke = {
1400
1427
  display: "flex",
1401
1428
  flexDirection: "column",
1402
1429
  gap: "12px"
1403
- }, ze = {
1430
+ }, qe = {
1404
1431
  fontSize: "14px",
1405
1432
  fontWeight: 500,
1406
1433
  color: "var(--page-text, #111827)"
@@ -1414,95 +1441,340 @@ var Re = {
1414
1441
  boxSizing: "border-box",
1415
1442
  backgroundColor: "#ffffff",
1416
1443
  color: "#111827"
1417
- }, Be = {
1444
+ }, Je = {
1418
1445
  display: "flex",
1419
1446
  alignItems: "center",
1420
1447
  gap: "8px",
1421
1448
  fontSize: "14px",
1422
1449
  color: "var(--page-text, #111827)"
1423
- }, Ve = (e) => e ? {
1450
+ }, Ye = (e) => e ? {
1424
1451
  readOnly: !0,
1425
1452
  tabIndex: -1,
1426
1453
  onMouseDown: (e) => e.preventDefault()
1427
1454
  } : {};
1428
- function He({ style: e, action: t, method: r, name: i, enctype: o, formSlug: l, nodeRef: u, inert: d, children: p, linked: m, show: h }) {
1429
- let { tenant: g, apiUrl: _ } = n(z), [v, y] = a("form"), b = d ? h || "form" : v;
1430
- return /* @__PURE__ */ c("div", {
1431
- ref: u,
1432
- style: f(e),
1455
+ function Xe(e, t) {
1456
+ if (!e) return !0;
1457
+ let n = t[e.field], r = n == null || n === "" ? "" : String(n), i = e.value ?? "";
1458
+ switch (e.op) {
1459
+ case "eq": return r === i;
1460
+ case "neq": return r !== i;
1461
+ case "contains": return r.toLowerCase().includes(i.toLowerCase());
1462
+ case "gt": return Number(r) > Number(i);
1463
+ case "lt": return Number(r) < Number(i);
1464
+ case "empty": return r === "";
1465
+ case "notEmpty": return r !== "";
1466
+ default: return !1;
1467
+ }
1468
+ }
1469
+ var Ze = {
1470
+ display: "flex",
1471
+ flexDirection: "column",
1472
+ gap: 6
1473
+ }, Qe = {
1474
+ font: "inherit",
1475
+ fontSize: 15,
1476
+ padding: "10px 12px",
1477
+ borderRadius: 8,
1478
+ border: "1px solid rgba(148, 163, 184, 0.55)",
1479
+ background: "transparent",
1480
+ color: "inherit",
1481
+ width: "100%",
1482
+ boxSizing: "border-box"
1483
+ };
1484
+ function $e({ field: e, value: t, onChange: n, inert: r }) {
1485
+ let i = /* @__PURE__ */ l("span", {
1486
+ style: {
1487
+ ...qe,
1488
+ fontSize: 14
1489
+ },
1490
+ children: [e.label, e.required ? " *" : ""]
1491
+ }), a = {
1492
+ name: e.name,
1493
+ required: e.required || void 0,
1494
+ placeholder: e.placeholder || void 0,
1495
+ disabled: r || void 0,
1496
+ style: Qe,
1497
+ value: t ?? "",
1498
+ onChange: (t) => n(e.name, t.target.value)
1499
+ };
1500
+ return e.type === "display" ? /* @__PURE__ */ c(e.variant && e.variant !== "p" ? e.variant : "p", {
1501
+ style: {
1502
+ margin: 0,
1503
+ color: e.color || "inherit",
1504
+ fontSize: {
1505
+ h1: 32,
1506
+ h2: 26,
1507
+ h3: 21,
1508
+ h4: 18,
1509
+ h5: 16,
1510
+ h6: 14,
1511
+ p: 15
1512
+ }[e.variant] ?? 16,
1513
+ fontWeight: e.variant === "p" ? 400 : 700,
1514
+ lineHeight: 1.35
1515
+ },
1516
+ children: e.label
1517
+ }) : e.type === "image" ? e.src ? /* @__PURE__ */ c("img", {
1518
+ src: e.src,
1519
+ alt: e.label ?? "",
1520
+ style: {
1521
+ width: "100%",
1522
+ borderRadius: 8,
1523
+ display: "block"
1524
+ }
1525
+ }) : null : e.type === "video" ? e.src ? /youtube\.com|youtu\.be|vimeo\.com/i.test(e.src) ? /* @__PURE__ */ c(Ae, {
1526
+ url: e.src,
1527
+ style: { width: "100%" }
1528
+ }) : /* @__PURE__ */ c("video", {
1529
+ src: e.src,
1530
+ controls: !0,
1531
+ style: {
1532
+ width: "100%",
1533
+ borderRadius: 8,
1534
+ display: "block"
1535
+ }
1536
+ }) : null : /* @__PURE__ */ l("label", {
1537
+ style: Ze,
1433
1538
  children: [
1434
- /* @__PURE__ */ s("form", {
1539
+ i,
1540
+ e.type === "textarea" || e.multiline ? /* @__PURE__ */ c("textarea", {
1541
+ ...a,
1542
+ rows: 4,
1543
+ style: {
1544
+ ...Qe,
1545
+ resize: "vertical"
1546
+ }
1547
+ }) : e.type === "select" ? /* @__PURE__ */ l("select", {
1548
+ ...a,
1549
+ children: [/* @__PURE__ */ c("option", {
1550
+ value: "",
1551
+ children: e.placeholder || "—"
1552
+ }), (e.options ?? []).map((e, t) => /* @__PURE__ */ c("option", {
1553
+ value: typeof e == "string" ? e : e.value,
1554
+ children: typeof e == "string" ? e : e.label ?? e.value
1555
+ }, t))]
1556
+ }) : e.type === "checkbox" ? /* @__PURE__ */ c("input", {
1557
+ type: "checkbox",
1558
+ name: e.name,
1559
+ required: e.required || void 0,
1560
+ disabled: r || void 0,
1561
+ checked: !!t,
1562
+ onChange: (t) => n(e.name, t.target.checked),
1563
+ style: {
1564
+ width: 18,
1565
+ height: 18
1566
+ }
1567
+ }) : e.type === "upload" ? /* @__PURE__ */ c("input", {
1568
+ type: "file",
1569
+ name: e.name,
1570
+ accept: e.accept || void 0,
1571
+ required: e.required || void 0,
1572
+ disabled: r || void 0,
1573
+ onChange: (t) => n(e.name, t.target.files?.[0]?.name ?? ""),
1574
+ style: {
1575
+ font: "inherit",
1576
+ fontSize: 14
1577
+ }
1578
+ }) : /* @__PURE__ */ c("input", {
1579
+ ...a,
1580
+ type: {
1581
+ email: "email",
1582
+ number: "number",
1583
+ date: "date",
1584
+ datetime: "datetime-local",
1585
+ phone: "tel",
1586
+ link: "url"
1587
+ }[e.type] ?? "text"
1588
+ }),
1589
+ e.help && /* @__PURE__ */ c("span", {
1590
+ style: {
1591
+ fontSize: 12,
1592
+ opacity: .65
1593
+ },
1594
+ children: e.help
1595
+ })
1596
+ ]
1597
+ });
1598
+ }
1599
+ function et({ style: e, action: t, method: i, name: a, enctype: u, formSlug: d, auto: f, submitLabel: m, nodeRef: h, inert: g, children: _, linked: v, show: y }) {
1600
+ let { tenant: b, apiUrl: x } = n(V), [S, C] = o("form"), [w, T] = o(null), [E, D] = o({}), [O, k] = o(0), A = g ? y || "form" : S;
1601
+ r(() => {
1602
+ if (!f || !d) return;
1603
+ let e = !0;
1604
+ return fetch(`${x || "/api"}/forms/${encodeURIComponent(d)}`, { headers: b ? { "x-tenant": b } : {} }).then((e) => e.json()).then((t) => e && T(t?.payload ?? null)).catch(() => e && T(null)), () => {
1605
+ e = !1;
1606
+ };
1607
+ }, [
1608
+ f,
1609
+ d,
1610
+ b,
1611
+ x
1612
+ ]);
1613
+ let j = [{
1614
+ section: null,
1615
+ fields: []
1616
+ }];
1617
+ for (let e of w?.fields ?? []) e.type === "section" ? j.push({
1618
+ section: e,
1619
+ fields: []
1620
+ }) : j[j.length - 1].fields.push(e);
1621
+ let M = j.filter((e) => e.section || e.fields.length), N = M.filter((e) => !e.section || Xe(e.section.condition, E)).map((e) => ({
1622
+ ...e,
1623
+ fields: e.fields.filter((e) => Xe(e.condition, E))
1624
+ })), P = M.length > 1, F = Math.min(O, Math.max(0, N.length - 1)), I = P ? N[F]?.fields ?? [] : N.flatMap((e) => e.fields), L = I.filter((e) => {
1625
+ let t = E[e.name];
1626
+ return e.required && (t == null || t === "" || t === !1);
1627
+ }), R = F >= N.length - 1, z = (e, t) => D((n) => ({
1628
+ ...n,
1629
+ [e]: t
1630
+ }));
1631
+ return /* @__PURE__ */ l("div", {
1632
+ ref: h,
1633
+ style: p(e),
1634
+ children: [
1635
+ /* @__PURE__ */ c("form", {
1435
1636
  action: t || void 0,
1436
- method: r || "post",
1437
- name: i || void 0,
1438
- encType: o || void 0,
1637
+ method: i || "post",
1638
+ name: a || void 0,
1639
+ encType: u || void 0,
1439
1640
  onSubmit: async (e) => {
1440
- if (e.preventDefault(), !d) {
1441
- if (l) {
1641
+ if (e.preventDefault(), !g) {
1642
+ if (d) {
1442
1643
  let t = {};
1443
- for (let [n, r] of new FormData(e.currentTarget).entries()) typeof r == "string" && (t[n] = r === "on" || r);
1644
+ if (f) for (let [e, n] of Object.entries(E)) n != null && n !== "" && (t[e] = n);
1645
+ else for (let [n, r] of new FormData(e.currentTarget).entries()) typeof r == "string" && (t[n] = r === "on" || r);
1444
1646
  try {
1445
- let e = await fetch(`${_ || "/api"}/forms/${l}/submit`, {
1647
+ let e = await fetch(`${x || "/api"}/forms/${d}/submit`, {
1446
1648
  method: "post",
1447
1649
  headers: {
1448
1650
  "content-type": "application/json",
1449
- ...g ? { "x-tenant": g } : {}
1651
+ ...b ? { "x-tenant": b } : {}
1450
1652
  },
1451
1653
  body: JSON.stringify(t)
1452
1654
  }), n = await e.json().catch(() => null);
1453
- y(e.ok && n?.success !== !1 ? "success" : "error");
1655
+ C(e.ok && n?.success !== !1 ? "success" : "error");
1454
1656
  } catch {
1455
- y("error");
1657
+ C("error");
1456
1658
  }
1457
1659
  return;
1458
1660
  }
1459
1661
  if (!t) {
1460
- y("success");
1662
+ C("success");
1461
1663
  return;
1462
1664
  }
1463
1665
  try {
1464
1666
  let n = await fetch(t, {
1465
- method: r || "post",
1667
+ method: i || "post",
1466
1668
  body: new FormData(e.currentTarget)
1467
1669
  });
1468
- y(n.ok ? "success" : "error");
1670
+ C(n.ok ? "success" : "error");
1469
1671
  } catch {
1470
- y("error");
1672
+ C("error");
1471
1673
  }
1472
1674
  }
1473
1675
  },
1474
1676
  style: {
1475
- ...Re,
1476
- display: b === "success" ? "none" : "flex"
1677
+ ...Ke,
1678
+ display: A === "success" ? "none" : "flex"
1477
1679
  },
1478
- children: p
1680
+ children: f && d ? /* @__PURE__ */ l(s, { children: [
1681
+ P && /* @__PURE__ */ c(ft, {
1682
+ steps: N.map((e) => ({ label: e.section?.label ?? "Start" })),
1683
+ active: F + 1,
1684
+ style: { marginBottom: 8 }
1685
+ }),
1686
+ P && N[F]?.section?.help && /* @__PURE__ */ c("p", {
1687
+ style: {
1688
+ margin: 0,
1689
+ fontSize: 14,
1690
+ opacity: .7
1691
+ },
1692
+ children: N[F].section.help
1693
+ }),
1694
+ I.map((e) => /* @__PURE__ */ c($e, {
1695
+ field: e,
1696
+ value: E[e.name],
1697
+ onChange: z,
1698
+ inert: g
1699
+ }, e.name)),
1700
+ /* @__PURE__ */ l("div", {
1701
+ style: {
1702
+ display: "flex",
1703
+ gap: 10,
1704
+ alignItems: "center",
1705
+ marginTop: 4
1706
+ },
1707
+ children: [P && F > 0 && /* @__PURE__ */ c("button", {
1708
+ type: "button",
1709
+ disabled: g || void 0,
1710
+ onClick: () => k(F - 1),
1711
+ style: {
1712
+ ...J,
1713
+ background: "transparent",
1714
+ color: "inherit",
1715
+ border: 0,
1716
+ padding: "10px 16px",
1717
+ cursor: "pointer"
1718
+ },
1719
+ children: "Back"
1720
+ }), P && !R ? /* @__PURE__ */ c("button", {
1721
+ type: "button",
1722
+ disabled: g || L.length > 0,
1723
+ onClick: () => k(F + 1),
1724
+ style: {
1725
+ ...J,
1726
+ border: 0,
1727
+ padding: "10px 22px",
1728
+ borderRadius: 8,
1729
+ fontSize: 15,
1730
+ fontWeight: 600,
1731
+ cursor: "pointer",
1732
+ opacity: L.length ? .5 : 1
1733
+ },
1734
+ children: "Next"
1735
+ }) : /* @__PURE__ */ c("button", {
1736
+ type: "submit",
1737
+ disabled: g || void 0,
1738
+ style: {
1739
+ ...J,
1740
+ border: 0,
1741
+ padding: "10px 22px",
1742
+ borderRadius: 8,
1743
+ fontSize: 15,
1744
+ fontWeight: 600,
1745
+ cursor: "pointer"
1746
+ },
1747
+ children: m || "Submit"
1748
+ })]
1749
+ })
1750
+ ] }) : _
1479
1751
  }),
1480
- /* @__PURE__ */ s("div", {
1481
- style: { display: b === "success" ? "block" : "none" },
1482
- children: m?.success ?? null
1752
+ /* @__PURE__ */ c("div", {
1753
+ style: { display: A === "success" ? "block" : "none" },
1754
+ children: v?.success ?? null
1483
1755
  }),
1484
- /* @__PURE__ */ s("div", {
1756
+ /* @__PURE__ */ c("div", {
1485
1757
  style: {
1486
- display: b === "error" ? "block" : "none",
1758
+ display: A === "error" ? "block" : "none",
1487
1759
  marginTop: 12
1488
1760
  },
1489
- children: m?.error ?? null
1761
+ children: v?.error ?? null
1490
1762
  })
1491
1763
  ]
1492
1764
  });
1493
1765
  }
1494
- function Ue({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1495
- return /* @__PURE__ */ s("label", {
1766
+ function tt({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1767
+ return /* @__PURE__ */ c("label", {
1496
1768
  ref: r,
1497
1769
  style: {
1498
- ...ze,
1499
- ...f(n)
1770
+ ...qe,
1771
+ ...p(n)
1500
1772
  },
1501
1773
  children: X(t, e, i)
1502
1774
  });
1503
1775
  }
1504
- function We({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1505
- return /* @__PURE__ */ s("input", {
1776
+ function nt({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1777
+ return /* @__PURE__ */ c("input", {
1506
1778
  ref: a,
1507
1779
  type: e,
1508
1780
  name: t || void 0,
@@ -1510,13 +1782,13 @@ function We({ type: e = "text", name: t, placeholder: n, required: r, style: i,
1510
1782
  required: !o && !!r,
1511
1783
  style: {
1512
1784
  ...Q,
1513
- ...f(i)
1785
+ ...p(i)
1514
1786
  },
1515
- ...Ve(o)
1787
+ ...Ye(o)
1516
1788
  });
1517
1789
  }
1518
- function Ge({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1519
- return /* @__PURE__ */ s("textarea", {
1790
+ function rt({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1791
+ return /* @__PURE__ */ c("textarea", {
1520
1792
  ref: a,
1521
1793
  name: e || void 0,
1522
1794
  placeholder: t,
@@ -1525,25 +1797,25 @@ function Ge({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeR
1525
1797
  style: {
1526
1798
  ...Q,
1527
1799
  resize: "vertical",
1528
- ...f(i)
1800
+ ...p(i)
1529
1801
  },
1530
- ...Ve(o)
1802
+ ...Ye(o)
1531
1803
  });
1532
1804
  }
1533
- function Ke({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: l }) {
1534
- return /* @__PURE__ */ c("label", {
1805
+ function it({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: s }) {
1806
+ return /* @__PURE__ */ l("label", {
1535
1807
  ref: o,
1536
1808
  style: {
1537
- ...Be,
1538
- ...f(a)
1809
+ ...Je,
1810
+ ...p(a)
1539
1811
  },
1540
- children: [/* @__PURE__ */ s("input", {
1812
+ children: [/* @__PURE__ */ c("input", {
1541
1813
  type: e,
1542
1814
  name: n || void 0,
1543
1815
  value: r || void 0,
1544
- required: !l && !!i,
1545
- onClick: l ? (e) => e.preventDefault() : void 0,
1546
- tabIndex: l ? -1 : void 0,
1816
+ required: !s && !!i,
1817
+ onClick: s ? (e) => e.preventDefault() : void 0,
1818
+ tabIndex: s ? -1 : void 0,
1547
1819
  style: {
1548
1820
  margin: 0,
1549
1821
  accentColor: "var(--page-accent, #111827)"
@@ -1551,8 +1823,8 @@ function Ke({ kind: e = "checkbox", label: t, name: n, value: r, required: i, st
1551
1823
  }), t]
1552
1824
  });
1553
1825
  }
1554
- function qe({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1555
- return /* @__PURE__ */ c("select", {
1826
+ function at({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1827
+ return /* @__PURE__ */ l("select", {
1556
1828
  ref: a,
1557
1829
  name: e || void 0,
1558
1830
  required: !o && !!r,
@@ -1562,43 +1834,43 @@ function qe({ name: e, placeholder: t, options: n = [], required: r, style: i, n
1562
1834
  style: {
1563
1835
  ...Q,
1564
1836
  appearance: "auto",
1565
- ...f(i)
1837
+ ...p(i)
1566
1838
  },
1567
- children: [t !== "" && /* @__PURE__ */ s("option", {
1839
+ children: [t !== "" && /* @__PURE__ */ c("option", {
1568
1840
  value: "",
1569
1841
  disabled: !0,
1570
1842
  children: t ?? "Select…"
1571
- }), n.map((e, t) => /* @__PURE__ */ s("option", {
1843
+ }), n.map((e, t) => /* @__PURE__ */ c("option", {
1572
1844
  value: e,
1573
1845
  children: e
1574
1846
  }, t))]
1575
1847
  });
1576
1848
  }
1577
- function Je({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: o, inert: l }) {
1578
- let [u, d] = a(null);
1579
- return /* @__PURE__ */ c("label", {
1580
- ref: o,
1849
+ function ot({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: a, inert: s }) {
1850
+ let [u, d] = o(null);
1851
+ return /* @__PURE__ */ l("label", {
1852
+ ref: a,
1581
1853
  style: {
1582
1854
  ...Q,
1583
1855
  display: "flex",
1584
1856
  alignItems: "center",
1585
1857
  gap: "8px",
1586
- cursor: l ? "default" : "pointer",
1858
+ cursor: s ? "default" : "pointer",
1587
1859
  borderStyle: "dashed",
1588
1860
  color: u ? "#111827" : "#6b7280",
1589
- ...f(i)
1861
+ ...p(i)
1590
1862
  },
1591
1863
  children: [
1592
- /* @__PURE__ */ s("input", {
1864
+ /* @__PURE__ */ c("input", {
1593
1865
  type: "file",
1594
1866
  name: e || void 0,
1595
1867
  accept: t || void 0,
1596
- required: !l && !!n,
1597
- disabled: !!l,
1868
+ required: !s && !!n,
1869
+ disabled: !!s,
1598
1870
  onChange: (e) => d(e.target.files?.[0]?.name ?? null),
1599
1871
  style: { display: "none" }
1600
1872
  }),
1601
- /* @__PURE__ */ s("span", {
1873
+ /* @__PURE__ */ c("span", {
1602
1874
  "aria-hidden": !0,
1603
1875
  children: "📎"
1604
1876
  }),
@@ -1606,185 +1878,539 @@ function Je({ name: e, accept: t, required: n, text: r = "Choose a file…", sty
1606
1878
  ]
1607
1879
  });
1608
1880
  }
1609
- function Ye({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1610
- return /* @__PURE__ */ s("button", {
1881
+ function st({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1882
+ return /* @__PURE__ */ c("button", {
1611
1883
  ref: n,
1612
1884
  type: r ? "button" : "submit",
1613
1885
  style: {
1614
- ...H,
1886
+ ...J,
1615
1887
  border: 0,
1616
1888
  cursor: "pointer",
1617
1889
  alignSelf: "flex-start",
1618
- ...f(t)
1890
+ padding: "10px 22px",
1891
+ borderRadius: 8,
1892
+ fontSize: 15,
1893
+ fontWeight: 600,
1894
+ lineHeight: 1.4,
1895
+ fontFamily: "inherit",
1896
+ ...p(t)
1619
1897
  },
1620
1898
  children: e
1621
1899
  });
1622
1900
  }
1623
- function Xe({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1901
+ function ct({ cols: e = 2, rows: t = 1, style: n, nodeRef: r, linked: i }) {
1624
1902
  let a = Math.max(1, (Number(e) || 1) * (Number(t) || 1));
1625
- return /* @__PURE__ */ s("div", {
1903
+ return /* @__PURE__ */ c("div", {
1626
1904
  ref: r,
1627
1905
  style: {
1628
1906
  display: "grid",
1629
1907
  gridTemplateColumns: `repeat(${Math.max(1, Number(e) || 1)}, minmax(0, 1fr))`,
1630
1908
  gap: 16,
1631
1909
  width: "100%",
1632
- ...f(n)
1910
+ ...p(n)
1633
1911
  },
1634
- children: Array.from({ length: a }, (e, t) => /* @__PURE__ */ s("div", {
1912
+ children: Array.from({ length: a }, (e, t) => /* @__PURE__ */ c("div", {
1635
1913
  style: { minWidth: 0 },
1636
1914
  children: i?.[`cell-${t}`] ?? null
1637
1915
  }, t))
1638
1916
  });
1639
1917
  }
1640
- var Ze = {
1641
- PageRoot: ae,
1642
- Section: K,
1643
- Container: q,
1644
- Heading: J,
1645
- TextBlock: he,
1646
- ButtonBlock: ve,
1647
- ImageBlock: ye,
1648
- Spacer: Te,
1649
- Divider: Ee,
1650
- SliderBlock: Me,
1651
- CanvasSlider: Ne,
1652
- TabsBlock: Ie,
1653
- QuickStack: Xe,
1654
- AccordionBlock: Le,
1655
- NavbarBlock: Fe,
1656
- ListBlock: me,
1657
- TextSpan: se,
1658
- QuoteBlock: pe,
1659
- TextLink: _e,
1660
- RichTextBlock: de,
1661
- RichContentBlock: de,
1662
- VideoBlock: be,
1663
- YouTubeBlock: Se,
1664
- IframeBlock: Ce,
1665
- EmbedBlock: we,
1666
- FormBlock: He,
1667
- FormLabel: Ue,
1668
- FormInput: We,
1669
- FormTextarea: Ge,
1670
- FormCheckbox: (e) => /* @__PURE__ */ s(Ke, {
1918
+ function lt({ collection: e, limit: t = 6, layout: i = "grid", columns: a = 3, imageField: s, titleField: u = "name", textField: d, custom: f, templateId: m, style: h, nodeRef: g }) {
1919
+ let { tenant: _, apiUrl: v } = n(V), y = n(U), b = n(H)?.[e], [x, S] = o(null);
1920
+ if (r(() => {
1921
+ if (!e || b) return;
1922
+ let t = !0, n = e.startsWith("api:") ? `${v}/data/${encodeURIComponent(e.slice(4))}` : `${v}/dynamic/${encodeURIComponent(e)}`;
1923
+ return fetch(n, { headers: _ ? { "x-tenant": _ } : {} }).then((e) => e.json()).then((e) => t && S(Array.isArray(e?.payload) ? e.payload : [])).catch(() => t && S([])), () => {
1924
+ t = !1;
1925
+ };
1926
+ }, [
1927
+ e,
1928
+ _,
1929
+ v,
1930
+ b
1931
+ ]), !e) return null;
1932
+ let C = (b ?? x ?? []).slice(0, Math.max(1, Number(t) || 6)), w = Math.min(Math.max(Number(a) || 3, 1), 6), T = i === "list" ? {
1933
+ display: "flex",
1934
+ flexDirection: "column",
1935
+ gap: 20
1936
+ } : {
1937
+ display: "grid",
1938
+ gridTemplateColumns: `repeat(${w}, minmax(0, 1fr))`,
1939
+ gap: 24
1940
+ };
1941
+ return f && m && y?.render ? /* @__PURE__ */ c("div", {
1942
+ ref: g,
1943
+ style: {
1944
+ width: "100%",
1945
+ ...T,
1946
+ ...p(h)
1947
+ },
1948
+ children: C.map((e) => /* @__PURE__ */ c("div", {
1949
+ style: { minWidth: 0 },
1950
+ children: y.render(m, (t) => ae(t, e))
1951
+ }, e.id ?? e?.data?.slug))
1952
+ }) : /* @__PURE__ */ c("div", {
1953
+ ref: g,
1954
+ style: {
1955
+ width: "100%",
1956
+ ...T,
1957
+ ...p(h)
1958
+ },
1959
+ children: C.map((e) => {
1960
+ let t = s ? W(e?.data, s) : null, n = u ? G(W(e?.data, u)) : null, r = d ? W(e?.data, d) : null, a = Array.isArray(r) ? r : null, o = a || r == null ? null : G(r), f = i === "list";
1961
+ return /* @__PURE__ */ l("div", {
1962
+ style: {
1963
+ display: "flex",
1964
+ flexDirection: f ? "row" : "column",
1965
+ gap: f ? 20 : 12,
1966
+ alignItems: f ? "center" : "stretch",
1967
+ minWidth: 0
1968
+ },
1969
+ children: [t && /* @__PURE__ */ c("img", {
1970
+ src: t,
1971
+ alt: n ?? "",
1972
+ style: {
1973
+ width: f ? 160 : "100%",
1974
+ aspectRatio: "3 / 2",
1975
+ objectFit: "cover",
1976
+ borderRadius: 10,
1977
+ flexShrink: 0,
1978
+ display: "block"
1979
+ }
1980
+ }), /* @__PURE__ */ l("div", {
1981
+ style: { minWidth: 0 },
1982
+ children: [
1983
+ n && /* @__PURE__ */ c("h3", {
1984
+ style: {
1985
+ margin: 0,
1986
+ fontSize: 18,
1987
+ fontWeight: 700
1988
+ },
1989
+ children: n
1990
+ }),
1991
+ o && /* @__PURE__ */ c("p", {
1992
+ style: {
1993
+ margin: "6px 0 0",
1994
+ fontSize: 14,
1995
+ lineHeight: 1.55,
1996
+ opacity: .75
1997
+ },
1998
+ children: o
1999
+ }),
2000
+ a && /* @__PURE__ */ c("div", {
2001
+ style: {
2002
+ marginTop: 6,
2003
+ fontSize: 14,
2004
+ lineHeight: 1.55,
2005
+ opacity: .85
2006
+ },
2007
+ children: ve(a)
2008
+ })
2009
+ ]
2010
+ })]
2011
+ }, e.id ?? e?.data?.slug);
2012
+ })
2013
+ });
2014
+ }
2015
+ function ut({ items: e = [], separator: t = "/", style: n, nodeRef: r }) {
2016
+ return e.length ? /* @__PURE__ */ c("nav", {
2017
+ ref: r,
2018
+ "aria-label": "Breadcrumb",
2019
+ style: { ...p(n) },
2020
+ children: /* @__PURE__ */ c("ol", {
2021
+ style: {
2022
+ display: "flex",
2023
+ flexWrap: "wrap",
2024
+ alignItems: "center",
2025
+ gap: 8,
2026
+ listStyle: "none",
2027
+ margin: 0,
2028
+ padding: 0,
2029
+ fontSize: 14
2030
+ },
2031
+ children: e.map((n, r) => {
2032
+ let i = r === e.length - 1;
2033
+ return /* @__PURE__ */ l("li", {
2034
+ style: {
2035
+ display: "flex",
2036
+ alignItems: "center",
2037
+ gap: 8,
2038
+ minWidth: 0
2039
+ },
2040
+ children: [r > 0 && /* @__PURE__ */ c("span", {
2041
+ style: { opacity: .4 },
2042
+ "aria-hidden": !0,
2043
+ children: t
2044
+ }), i || !n.href ? /* @__PURE__ */ c("span", {
2045
+ style: {
2046
+ fontWeight: i ? 600 : 400,
2047
+ opacity: i ? 1 : .7
2048
+ },
2049
+ "aria-current": i ? "page" : void 0,
2050
+ children: n.label
2051
+ }) : /* @__PURE__ */ c("a", {
2052
+ href: n.href,
2053
+ style: {
2054
+ color: "inherit",
2055
+ opacity: .7,
2056
+ textDecoration: "none"
2057
+ },
2058
+ children: n.label
2059
+ })]
2060
+ }, r);
2061
+ })
2062
+ })
2063
+ }) : null;
2064
+ }
2065
+ function dt({ pages: e = 5, current: t = 1, prevNext: n = !0, href: r = "#", style: i, nodeRef: a }) {
2066
+ let o = Math.min(Math.max(Number(e) || 1, 1), 50), s = Math.min(Math.max(Number(t) || 1, 1), o), u = (e) => r && r !== "#" ? r.replace("{page}", String(e)) : "#", d = (e) => ({
2067
+ display: "inline-flex",
2068
+ alignItems: "center",
2069
+ justifyContent: "center",
2070
+ minWidth: 36,
2071
+ height: 36,
2072
+ padding: "0 8px",
2073
+ borderRadius: 8,
2074
+ fontSize: 14,
2075
+ textDecoration: "none",
2076
+ color: e ? "var(--page-accent-text, #ffffff)" : "inherit",
2077
+ background: e ? "var(--page-accent, #111827)" : "transparent",
2078
+ border: e ? "1px solid transparent" : "1px solid rgba(148, 163, 184, 0.4)"
2079
+ });
2080
+ return /* @__PURE__ */ l("nav", {
2081
+ ref: a,
2082
+ "aria-label": "Pagination",
2083
+ style: {
2084
+ display: "flex",
2085
+ flexWrap: "wrap",
2086
+ gap: 8,
2087
+ alignItems: "center",
2088
+ ...p(i)
2089
+ },
2090
+ children: [
2091
+ n && /* @__PURE__ */ c("a", {
2092
+ href: s > 1 ? u(s - 1) : "#",
2093
+ "aria-label": "Previous",
2094
+ style: {
2095
+ ...d(!1),
2096
+ opacity: s > 1 ? 1 : .4
2097
+ },
2098
+ children: "‹"
2099
+ }),
2100
+ Array.from({ length: o }, (e, t) => t + 1).map((e) => /* @__PURE__ */ c("a", {
2101
+ href: u(e),
2102
+ "aria-current": e === s ? "page" : void 0,
2103
+ style: d(e === s),
2104
+ children: e
2105
+ }, e)),
2106
+ n && /* @__PURE__ */ c("a", {
2107
+ href: s < o ? u(s + 1) : "#",
2108
+ "aria-label": "Next",
2109
+ style: {
2110
+ ...d(!1),
2111
+ opacity: s < o ? 1 : .4
2112
+ },
2113
+ children: "›"
2114
+ })
2115
+ ]
2116
+ });
2117
+ }
2118
+ function ft({ steps: t = [], active: n = 1, vertical: r = !1, style: i, nodeRef: a }) {
2119
+ if (!t.length) return null;
2120
+ let o = Math.min(Math.max(Number(n) || 1, 1), t.length), s = (e) => ({
2121
+ width: 32,
2122
+ height: 32,
2123
+ borderRadius: "50%",
2124
+ display: "flex",
2125
+ alignItems: "center",
2126
+ justifyContent: "center",
2127
+ fontSize: 14,
2128
+ fontWeight: 600,
2129
+ flexShrink: 0,
2130
+ color: e === "todo" ? "inherit" : "var(--page-accent-text, #ffffff)",
2131
+ background: e === "todo" ? "transparent" : "var(--page-accent, #111827)",
2132
+ border: e === "todo" ? "1px solid rgba(148, 163, 184, 0.5)" : "1px solid transparent",
2133
+ opacity: e === "todo" ? .6 : 1,
2134
+ boxShadow: e === "active" ? "0 0 0 4px rgba(99, 102, 241, 0.2)" : "none"
2135
+ }), u = (e) => ({
2136
+ flexGrow: 1,
2137
+ alignSelf: "center",
2138
+ background: e ? "var(--page-accent, #111827)" : "rgba(148, 163, 184, 0.4)",
2139
+ ...r ? {
2140
+ width: 2,
2141
+ minHeight: 24,
2142
+ marginLeft: 15,
2143
+ alignSelf: "auto"
2144
+ } : {
2145
+ height: 2,
2146
+ minWidth: 24
2147
+ }
2148
+ });
2149
+ return /* @__PURE__ */ c("div", {
2150
+ ref: a,
2151
+ style: {
2152
+ display: "flex",
2153
+ flexDirection: r ? "column" : "row",
2154
+ alignItems: r ? "stretch" : "flex-start",
2155
+ gap: r ? 4 : 8,
2156
+ ...p(i)
2157
+ },
2158
+ children: t.map((t, n) => {
2159
+ let i = n + 1, a = i < o ? "done" : i === o ? "active" : "todo";
2160
+ return /* @__PURE__ */ l(e, { children: [n > 0 && /* @__PURE__ */ c("div", {
2161
+ style: u(i <= o),
2162
+ "aria-hidden": !0
2163
+ }), /* @__PURE__ */ l("div", {
2164
+ style: {
2165
+ display: "flex",
2166
+ flexDirection: r ? "row" : "column",
2167
+ alignItems: "center",
2168
+ gap: 8,
2169
+ minWidth: 0,
2170
+ textAlign: r ? "left" : "center"
2171
+ },
2172
+ children: [/* @__PURE__ */ c("div", {
2173
+ style: s(a),
2174
+ children: a === "done" ? "✓" : i
2175
+ }), /* @__PURE__ */ l("div", {
2176
+ style: { minWidth: 0 },
2177
+ children: [/* @__PURE__ */ c("div", {
2178
+ style: {
2179
+ fontSize: 13,
2180
+ fontWeight: a === "active" ? 700 : 500,
2181
+ opacity: a === "todo" ? .6 : 1
2182
+ },
2183
+ children: t.label
2184
+ }), t.description && /* @__PURE__ */ c("div", {
2185
+ style: {
2186
+ fontSize: 12,
2187
+ opacity: .6
2188
+ },
2189
+ children: t.description
2190
+ })]
2191
+ })]
2192
+ })] }, n);
2193
+ })
2194
+ });
2195
+ }
2196
+ function pt({ columns: e = [], rows: t = [], source: i, limit: a = 10, striped: s = !0, bordered: u = !1, compact: d = !1, style: f, nodeRef: m }) {
2197
+ let { tenant: h, apiUrl: g } = n(V), _ = n(H)?.[i], [v, y] = o(null);
2198
+ if (r(() => {
2199
+ if (!i || _) return;
2200
+ let e = !0, t = i.startsWith("api:") ? `${g}/data/${encodeURIComponent(i.slice(4))}` : `${g}/dynamic/${encodeURIComponent(i)}`;
2201
+ return fetch(t, { headers: h ? { "x-tenant": h } : {} }).then((e) => e.json()).then((t) => e && y(Array.isArray(t?.payload) ? t.payload : [])).catch(() => e && y([])), () => {
2202
+ e = !1;
2203
+ };
2204
+ }, [
2205
+ i,
2206
+ h,
2207
+ g,
2208
+ _
2209
+ ]), !e.length) return null;
2210
+ let b = i ? (_ ?? v ?? []).slice(0, Math.max(1, Number(a) || 10)) : null, x = b ? b.map((t) => e.map((e) => G(W(t?.data, e.field)))) : t, S = d ? "6px 10px" : "10px 14px", C = "1px solid rgba(148, 163, 184, 0.35)", w = u ? { border: C } : { borderBottom: C };
2211
+ return /* @__PURE__ */ c("div", {
2212
+ ref: m,
2213
+ style: {
2214
+ width: "100%",
2215
+ overflowX: "auto",
2216
+ ...p(f)
2217
+ },
2218
+ children: /* @__PURE__ */ l("table", {
2219
+ style: {
2220
+ width: "100%",
2221
+ borderCollapse: "collapse",
2222
+ fontSize: 14,
2223
+ ...u ? { border: C } : {}
2224
+ },
2225
+ children: [/* @__PURE__ */ c("thead", { children: /* @__PURE__ */ c("tr", { children: e.map((e, t) => /* @__PURE__ */ c("th", {
2226
+ style: {
2227
+ textAlign: "left",
2228
+ fontWeight: 600,
2229
+ padding: S,
2230
+ background: "rgba(148, 163, 184, 0.12)",
2231
+ ...w
2232
+ },
2233
+ children: e.label ?? e
2234
+ }, t)) }) }), /* @__PURE__ */ c("tbody", { children: x.map((t, n) => /* @__PURE__ */ c("tr", {
2235
+ style: s && n % 2 == 1 ? { background: "rgba(148, 163, 184, 0.07)" } : void 0,
2236
+ children: e.map((e, n) => /* @__PURE__ */ c("td", {
2237
+ style: {
2238
+ padding: S,
2239
+ ...w
2240
+ },
2241
+ children: t?.[n] ?? ""
2242
+ }, n))
2243
+ }, n)) })]
2244
+ })
2245
+ });
2246
+ }
2247
+ var mt = {
2248
+ PageRoot: le,
2249
+ Section: ue,
2250
+ Container: de,
2251
+ Heading: fe,
2252
+ TextBlock: Ce,
2253
+ ButtonBlock: Ee,
2254
+ ImageBlock: De,
2255
+ Spacer: Ne,
2256
+ Divider: Pe,
2257
+ SliderBlock: Be,
2258
+ CanvasSlider: Ve,
2259
+ TabsBlock: We,
2260
+ QuickStack: ct,
2261
+ CollectionList: lt,
2262
+ BreadcrumbsBlock: ut,
2263
+ PaginationBlock: dt,
2264
+ StepperBlock: ft,
2265
+ TableBlock: pt,
2266
+ AccordionBlock: Ge,
2267
+ NavbarBlock: Ue,
2268
+ ListBlock: Se,
2269
+ TextSpan: he,
2270
+ QuoteBlock: xe,
2271
+ TextLink: Te,
2272
+ RichTextBlock: ye,
2273
+ RichContentBlock: ye,
2274
+ VideoBlock: Oe,
2275
+ YouTubeBlock: Ae,
2276
+ IframeBlock: je,
2277
+ EmbedBlock: Me,
2278
+ FormBlock: et,
2279
+ FormLabel: tt,
2280
+ FormInput: nt,
2281
+ FormTextarea: rt,
2282
+ FormCheckbox: (e) => /* @__PURE__ */ c(it, {
1671
2283
  kind: "checkbox",
1672
2284
  ...e
1673
2285
  }),
1674
- FormRadio: (e) => /* @__PURE__ */ s(Ke, {
2286
+ FormRadio: (e) => /* @__PURE__ */ c(it, {
1675
2287
  kind: "radio",
1676
2288
  ...e
1677
2289
  }),
1678
- FormSelect: qe,
1679
- FormFile: Je,
1680
- FormSubmit: Ye
2290
+ FormSelect: at,
2291
+ FormFile: ot,
2292
+ FormSubmit: st
1681
2293
  };
1682
2294
  //#endregion
1683
2295
  //#region ../ui/src/components/builder/render.jsx
1684
- function $(t, n, r, i = /* @__PURE__ */ new Set()) {
1685
- let a = n[t];
1686
- if (!a || a.hidden) return null;
1687
- let o = a.type?.resolvedName;
1688
- if (o === "ComponentInstance") {
1689
- let n = a.props?.componentId, o = r?.[n];
1690
- if (!o?.template || i.has(n)) return null;
1691
- let c = new Set(i).add(n);
1692
- return /* @__PURE__ */ s(e, { children: $(o.template.rootId, o.template.nodes, r, c) }, t);
2296
+ function $(t, n, r, i = /* @__PURE__ */ new Set(), a = void 0) {
2297
+ let o = n[t];
2298
+ if (!o || o.hidden) return null;
2299
+ let s = o.type?.resolvedName, l = a?.mapProps ? a.mapProps(o.props ?? {}, s) : o.props ?? {};
2300
+ if (s === "ComponentInstance") {
2301
+ let n = o.props?.componentId, s = r?.[n];
2302
+ if (!s?.template || i.has(n)) return null;
2303
+ let l = new Set(i).add(n);
2304
+ return /* @__PURE__ */ c(e, { children: $(s.template.rootId, s.template.nodes, r, l, a) }, t);
1693
2305
  }
1694
- let c = Ze[o];
1695
- if (!c) return null;
1696
- let l = (a.nodes ?? []).map((e) => $(e, n, r, i)).filter(Boolean), u = Object.entries(a.linkedNodes ?? {}), d = u.length ? Object.fromEntries(u.map(([e, t]) => [e, $(t, n, r, i)])) : void 0;
1697
- return /* @__PURE__ */ s(c, {
1698
- ...a.props,
1699
- linked: d,
2306
+ let u = mt[s];
2307
+ if (!u) return null;
2308
+ 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;
2309
+ return /* @__PURE__ */ c(u, {
2310
+ ...l,
2311
+ ...s === "CollectionList" ? { templateId: o.linkedNodes?.card } : null,
2312
+ linked: p,
1700
2313
  nodeRef: (e) => {
1701
- e && (e.setAttribute("data-wb", t), g(e, a.props ?? {}));
2314
+ e && (e.setAttribute("data-wb", t), _(e, l));
1702
2315
  },
1703
- children: l.length ? l : void 0
2316
+ children: d.length ? d : void 0
1704
2317
  }, t);
1705
2318
  }
1706
2319
  //#endregion
1707
2320
  //#region ../ui/src/components/builder/PageRenderer.jsx
1708
- var Qe = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
1709
- function $e({ blocks: e, theme: t, components: n, mode: i = "auto", style: a, custom: o, tenant: l, apiUrl: u }) {
1710
- let d = o?.js?.trim();
2321
+ var ht = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
2322
+ function gt({ blocks: e, theme: t, components: n, mode: a = "auto", style: o, custom: s, tenant: u, apiUrl: d, datasets: f }) {
2323
+ let p = s?.js?.trim();
1711
2324
  if (r(() => {
1712
- if (!d) return;
2325
+ if (!p) return;
1713
2326
  let e = document.createElement("script");
1714
- return e.text = d, document.body.appendChild(e), () => e.remove();
1715
- }, [d]), !e?.ROOT) return null;
1716
- let f = {
2327
+ return e.text = p, document.body.appendChild(e), () => e.remove();
2328
+ }, [p]), !e?.ROOT) return null;
2329
+ let m = {
1717
2330
  minHeight: "100%",
1718
2331
  display: "flex",
1719
2332
  flexDirection: "column"
1720
- }, p = $("ROOT", e, n), m = C(e, n), h = ee(e, n), g = o?.css?.trim(), _ = R(e, n).map((e) => /* @__PURE__ */ s("link", {
2333
+ }, h = $("ROOT", e, n), g = i(() => ({ render: (t, r) => $(t, e, n, void 0, { mapProps: r }) }), [e, n]), _ = T(e, n), v = w(e, n), y = s?.css?.trim(), b = B(e, n).map((e) => /* @__PURE__ */ c("link", {
1721
2334
  rel: "stylesheet",
1722
2335
  precedence: "default",
1723
- href: I(e)
2336
+ href: te(e)
1724
2337
  }, e));
1725
- if (i !== "auto") return /* @__PURE__ */ s(z.Provider, {
2338
+ if (a !== "auto") return /* @__PURE__ */ c(V.Provider, {
1726
2339
  value: {
1727
- tenant: l || "",
1728
- apiUrl: u || "/api"
2340
+ tenant: u || "",
2341
+ apiUrl: d || "/api"
1729
2342
  },
1730
- children: /* @__PURE__ */ c("div", {
1731
- style: {
1732
- ...f,
1733
- ...te(t, i),
1734
- ...a
1735
- },
1736
- children: [
1737
- _,
1738
- m && /* @__PURE__ */ s("style", { children: m }),
1739
- h && /* @__PURE__ */ s("style", { children: h }),
1740
- g && /* @__PURE__ */ s("style", { children: g }),
1741
- p
1742
- ]
2343
+ children: /* @__PURE__ */ c(H.Provider, {
2344
+ value: f ?? null,
2345
+ children: /* @__PURE__ */ c(U.Provider, {
2346
+ value: g,
2347
+ children: /* @__PURE__ */ l("div", {
2348
+ style: {
2349
+ ...m,
2350
+ ...F(t, a),
2351
+ ...o
2352
+ },
2353
+ children: [
2354
+ b,
2355
+ _ && /* @__PURE__ */ c("style", { children: _ }),
2356
+ v && /* @__PURE__ */ c("style", { children: v }),
2357
+ y && /* @__PURE__ */ c("style", { children: y }),
2358
+ h
2359
+ ]
2360
+ })
2361
+ })
1743
2362
  })
1744
2363
  });
1745
- let v = A(t);
1746
- return /* @__PURE__ */ s(z.Provider, {
2364
+ let x = M(t);
2365
+ return /* @__PURE__ */ c(V.Provider, {
1747
2366
  value: {
1748
- tenant: l || "",
1749
- apiUrl: u || "/api"
2367
+ tenant: u || "",
2368
+ apiUrl: d || "/api"
1750
2369
  },
1751
- children: /* @__PURE__ */ c("div", {
1752
- className: "webim-page",
1753
- style: {
1754
- ...f,
1755
- ...M(t),
1756
- ...a
1757
- },
1758
- children: [
1759
- /* @__PURE__ */ s("style", { children: `.webim-page { ${Qe(j(v.light))} }
1760
- @media (prefers-color-scheme: dark) { .webim-page { ${Qe(j(v.dark))} } }` }),
1761
- _,
1762
- m && /* @__PURE__ */ s("style", { children: m }),
1763
- h && /* @__PURE__ */ s("style", { children: h }),
1764
- g && /* @__PURE__ */ s("style", { children: g }),
1765
- p
1766
- ]
2370
+ children: /* @__PURE__ */ c(H.Provider, {
2371
+ value: f ?? null,
2372
+ children: /* @__PURE__ */ c(U.Provider, {
2373
+ value: g,
2374
+ children: /* @__PURE__ */ l("div", {
2375
+ className: "webim-page",
2376
+ style: {
2377
+ ...m,
2378
+ ...P(t),
2379
+ ...o
2380
+ },
2381
+ children: [
2382
+ /* @__PURE__ */ c("style", { children: `.webim-page { ${ht(N(x.light))} }
2383
+ @media (prefers-color-scheme: dark) { .webim-page { ${ht(N(x.dark))} } }` }),
2384
+ b,
2385
+ _ && /* @__PURE__ */ c("style", { children: _ }),
2386
+ v && /* @__PURE__ */ c("style", { children: v }),
2387
+ y && /* @__PURE__ */ c("style", { children: y }),
2388
+ h
2389
+ ]
2390
+ })
2391
+ })
1767
2392
  })
1768
2393
  });
1769
2394
  }
1770
2395
  //#endregion
1771
2396
  //#region src/WebimContent.jsx
1772
- function et({ bundle: e, mode: t = "auto", style: n }) {
1773
- return e?.blocks?.ROOT ? /* @__PURE__ */ s($e, {
2397
+ function _t({ bundle: e, mode: t = "auto", style: n }) {
2398
+ return e?.blocks?.ROOT ? /* @__PURE__ */ c(gt, {
1774
2399
  blocks: e.blocks,
1775
2400
  theme: e.theme,
1776
2401
  components: e.components,
1777
2402
  custom: e.custom,
1778
2403
  tenant: e.tenant,
1779
2404
  apiUrl: e.apiUrl,
2405
+ datasets: e.datasets,
1780
2406
  mode: t,
1781
2407
  style: n
1782
2408
  }) : null;
1783
2409
  }
1784
2410
  //#endregion
1785
2411
  //#region src/WebimPage.jsx
1786
- function tt({ apiUrl: e, tenant: t, slug: n, locale: o, preview: c, mode: l = "auto", style: u, fallback: d = null, errorFallback: f = null, onLoad: p, onError: m }) {
1787
- let [h, g] = a({ status: "loading" }), _ = i({
2412
+ function vt({ apiUrl: e, tenant: t, slug: n, locale: i, preview: s, mode: l = "auto", style: u, fallback: d = null, errorFallback: f = null, onLoad: p, onError: m }) {
2413
+ let [h, g] = o({ status: "loading" }), _ = a({
1788
2414
  onLoad: p,
1789
2415
  onError: m
1790
2416
  });
@@ -1793,12 +2419,12 @@ function tt({ apiUrl: e, tenant: t, slug: n, locale: o, preview: c, mode: l = "a
1793
2419
  onError: m
1794
2420
  }, r(() => {
1795
2421
  let r = !0;
1796
- return g({ status: "loading" }), P({
2422
+ return g({ status: "loading" }), z({
1797
2423
  apiUrl: e,
1798
2424
  tenant: t,
1799
2425
  slug: n,
1800
- locale: o,
1801
- preview: c
2426
+ locale: i,
2427
+ preview: s
1802
2428
  }).then((e) => {
1803
2429
  r && (g({
1804
2430
  status: "ready",
@@ -1816,13 +2442,13 @@ function tt({ apiUrl: e, tenant: t, slug: n, locale: o, preview: c, mode: l = "a
1816
2442
  e,
1817
2443
  t,
1818
2444
  n,
1819
- o,
1820
- c
1821
- ]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ s(et, {
2445
+ i,
2446
+ s
2447
+ ]), h.status === "loading" ? d : h.status === "error" ? typeof f == "function" ? f(h.error) : f : /* @__PURE__ */ c(_t, {
1822
2448
  bundle: h.bundle,
1823
2449
  mode: l,
1824
2450
  style: u
1825
2451
  });
1826
2452
  }
1827
2453
  //#endregion
1828
- export { $e as PageRenderer, et as WebimContent, tt as WebimPage, P as fetchPage, ue as renderRichContent, N as resolveTheme };
2454
+ export { gt as PageRenderer, _t as WebimContent, vt as WebimPage, z as fetchPage, ve as renderRichContent, I as resolveTheme };