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