webim-adapter 0.1.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.
@@ -0,0 +1,1766 @@
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";
4
+ new Map([
5
+ {
6
+ family: "Bebas Neue",
7
+ fallback: "sans-serif"
8
+ },
9
+ {
10
+ family: "Crimson Text",
11
+ fallback: "serif"
12
+ },
13
+ {
14
+ family: "DM Sans",
15
+ fallback: "sans-serif"
16
+ },
17
+ {
18
+ family: "Fira Sans",
19
+ fallback: "sans-serif"
20
+ },
21
+ {
22
+ family: "Inter",
23
+ fallback: "sans-serif"
24
+ },
25
+ {
26
+ family: "JetBrains Mono",
27
+ fallback: "monospace"
28
+ },
29
+ {
30
+ family: "Josefin Sans",
31
+ fallback: "sans-serif"
32
+ },
33
+ {
34
+ family: "Karla",
35
+ fallback: "sans-serif"
36
+ },
37
+ {
38
+ family: "Lato",
39
+ fallback: "sans-serif"
40
+ },
41
+ {
42
+ family: "Lora",
43
+ fallback: "serif"
44
+ },
45
+ {
46
+ family: "Manrope",
47
+ fallback: "sans-serif"
48
+ },
49
+ {
50
+ family: "Merriweather",
51
+ fallback: "serif"
52
+ },
53
+ {
54
+ family: "Montserrat",
55
+ fallback: "sans-serif"
56
+ },
57
+ {
58
+ family: "Nunito",
59
+ fallback: "sans-serif"
60
+ },
61
+ {
62
+ family: "Open Sans",
63
+ fallback: "sans-serif"
64
+ },
65
+ {
66
+ family: "Oswald",
67
+ fallback: "sans-serif"
68
+ },
69
+ {
70
+ family: "Outfit",
71
+ fallback: "sans-serif"
72
+ },
73
+ {
74
+ family: "Playfair Display",
75
+ fallback: "serif"
76
+ },
77
+ {
78
+ family: "Poppins",
79
+ fallback: "sans-serif"
80
+ },
81
+ {
82
+ family: "Quicksand",
83
+ fallback: "sans-serif"
84
+ },
85
+ {
86
+ family: "Raleway",
87
+ fallback: "sans-serif"
88
+ },
89
+ {
90
+ family: "Roboto",
91
+ fallback: "sans-serif"
92
+ },
93
+ {
94
+ family: "Rubik",
95
+ fallback: "sans-serif"
96
+ },
97
+ {
98
+ family: "Source Sans 3",
99
+ fallback: "sans-serif"
100
+ },
101
+ {
102
+ family: "Space Grotesk",
103
+ fallback: "sans-serif"
104
+ },
105
+ {
106
+ family: "Work Sans",
107
+ fallback: "sans-serif"
108
+ }
109
+ ].map((e) => [e.family, e]));
110
+ function l(e) {
111
+ return e.length ? `https://fonts.googleapis.com/css2?${e.map((e) => `family=${e.replace(/ /g, "+")}:wght@100..900`).join("&")}&display=swap` : null;
112
+ }
113
+ var u = (e) => l([e]), d = (e) => {
114
+ let t = typeof e == "string" && e.match(/^"([^"]+)"/);
115
+ return t ? t[1] : null;
116
+ };
117
+ function f(e, t) {
118
+ let n = /* @__PURE__ */ new Set(), r = (e) => {
119
+ for (let t of Object.values(e || {})) for (let e of [
120
+ "style",
121
+ "hover",
122
+ "pressed",
123
+ "focused"
124
+ ]) {
125
+ let r = d(t.props?.[e]?.fontFamily);
126
+ r && n.add(r);
127
+ }
128
+ };
129
+ r(e);
130
+ for (let e of Object.values(t || {})) r(e.template?.nodes);
131
+ return [...n].sort();
132
+ }
133
+ //#endregion
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 = [
136
+ "borderWidth",
137
+ "borderStyle",
138
+ "borderColor",
139
+ "borderRadius",
140
+ "gap"
141
+ ];
142
+ function g(e) {
143
+ let t = {};
144
+ for (let n of h) {
145
+ let r = e?.[n];
146
+ r != null && r !== "" && (t[n] = p.has(n) ? m(r) : r);
147
+ }
148
+ for (let [n, r] of Object.entries(e || {})) r == null || r === "" || h.includes(n) || (t[n] = p.has(n) ? m(r) : r);
149
+ let { gradientType: n, gradientAngle: r, gradientFrom: i, gradientTo: a } = t;
150
+ delete t.gradientType, delete t.gradientAngle, delete t.gradientFrom, delete t.gradientTo;
151
+ let { textShadows: o, textShadowX: s, textShadowY: c, textShadowBlur: l, textShadowColor: u } = t;
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)"}`);
154
+ [
155
+ s,
156
+ c,
157
+ l,
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: ee } = t;
161
+ delete t.transforms, delete t.translateX, delete t.translateY, delete t.scale, delete t.rotate, delete t.skewX, delete t.skewY;
162
+ let C = (Array.isArray(_) ? _ : []).filter((e) => e && e.on !== !1).map(g).filter(Boolean);
163
+ (v !== void 0 || y !== void 0) && C.push(`translate(${m(v ?? 0)}, ${m(y ?? 0)})`), b !== void 0 && C.push(`scale(${b})`), x !== void 0 && C.push(`rotate(${f(x)})`), (S !== void 0 || ee !== void 0) && C.push(`skew(${f(S ?? 0)}, ${f(ee ?? 0)})`), C.length && (t.transform = C.join(" "));
164
+ let w = (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: T, boxShadowX: E, boxShadowY: D, boxShadowBlur: O, boxShadowSpread: k, boxShadowColor: A, boxShadowInset: j } = t;
165
+ delete t.shadows, delete t.boxShadowX, delete t.boxShadowY, delete t.boxShadowBlur, delete t.boxShadowSpread, delete t.boxShadowColor, delete t.boxShadowInset;
166
+ let M = (Array.isArray(T) ? T : []).filter((e) => e && e.on !== !1).map(w);
167
+ [
168
+ E,
169
+ D,
170
+ O,
171
+ k,
172
+ A,
173
+ j
174
+ ].some((e) => e !== void 0) && M.push(w({
175
+ x: E,
176
+ y: D,
177
+ blur: O,
178
+ spread: k,
179
+ color: A,
180
+ inset: j
181
+ })), M.length && (t.boxShadow = M.join(", "));
182
+ let te = (e) => e.type === "blur" ? `blur(${m(e.v ?? 0)})` : e.type === "hue-rotate" ? `hue-rotate(${f(e.v ?? 0)})` : `${e.type}(${e.v ?? 100}%)`, ne = (e) => (Array.isArray(e) ? e : []).filter((e) => e && e.on !== !1 && e.type).map(te), { filters: N, backdropFilters: P, filterBlur: F, filterGrayscale: I, filterBrightness: L, filterContrast: R, filterSaturate: z } = t;
183
+ delete t.filters, delete t.backdropFilters, delete t.filterBlur, delete t.filterGrayscale, delete t.filterBrightness, delete t.filterContrast, delete t.filterSaturate;
184
+ let B = ne(N);
185
+ F !== void 0 && B.push(`blur(${m(F)})`), I !== void 0 && B.push(`grayscale(${I}%)`), L !== void 0 && B.push(`brightness(${L}%)`), R !== void 0 && B.push(`contrast(${R}%)`), z !== void 0 && B.push(`saturate(${z}%)`), B.length && (t.filter = B.join(" "));
186
+ let V = ne(P);
187
+ V.length && (t.backdropFilter = V.join(" "), t.WebkitBackdropFilter = t.backdropFilter);
188
+ let { textStrokeWidth: H, textStrokeColor: U } = t;
189
+ delete t.textStrokeWidth, delete t.textStrokeColor, (H !== void 0 || U !== void 0) && (t.WebkitTextStroke = `${m(H ?? 1)} ${U || "currentColor"}`);
190
+ let { clipText: re } = t;
191
+ delete t.clipText, re && (t.WebkitBackgroundClip = "text", t.backgroundClip = "text", t.WebkitTextFillColor = "transparent");
192
+ let { transitions: W, transitionDuration: G, transitionEasing: K, transitionProperty: ie } = t, q = (e) => typeof e == "number" || !Number.isNaN(Number(e)) ? `${Number(e)}ms` : e;
193
+ delete t.transitions, delete t.transitionDuration, delete t.transitionEasing, delete t.transitionProperty;
194
+ let J = (Array.isArray(W) ? W : []).filter((e) => e && e.on !== !1).map((e) => `${e.property || "all"} ${q(e.duration ?? 200)} ${e.easing || "ease"}`);
195
+ if (G !== void 0 && J.push(`${ie || "all"} ${q(G)} ${K || "ease"}`), J.length && (t.transition = J.join(", ")), t.backgroundImage && !String(t.backgroundImage).includes("(") && (t.backgroundImage = `url("${t.backgroundImage}")`), n) {
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
+ t.backgroundImage = t.backgroundImage ? `${o}, ${t.backgroundImage}` : o;
198
+ }
199
+ delete t.backgroundVideo;
200
+ let { overlayColor: ae, overlayOpacity: oe } = t;
201
+ if (delete t.overlayColor, delete t.overlayOpacity, ae) {
202
+ let e = `color-mix(in srgb, ${ae} ${oe ?? 50}%, transparent)`, n = `linear-gradient(${e}, ${e})`;
203
+ t.backgroundImage = t.backgroundImage ? `${n}, ${t.backgroundImage}` : n;
204
+ }
205
+ t.backgroundImage && (t.backgroundSize ??= "cover", t.backgroundPosition ??= "center", t.backgroundRepeat ??= "no-repeat");
206
+ let { backgroundLayers: Y } = t;
207
+ delete t.backgroundLayers;
208
+ let se = (Array.isArray(Y) ? Y : []).filter((e) => e && e.on !== !1);
209
+ if (se.length) {
210
+ let e = [], n = [], r = [], i = [], a = [];
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
+ 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
+ else {
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");
216
+ }
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
+ }
219
+ return t;
220
+ }
221
+ var _ = {
222
+ hover: ":hover",
223
+ pressed: ":active",
224
+ focused: ":focus"
225
+ }, v = /* @__PURE__ */ new Set([
226
+ "style",
227
+ "class",
228
+ "id",
229
+ "data-wb",
230
+ "data-wb-class",
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 = []) {
234
+ t.htmlId ? e.id = t.htmlId : e.removeAttribute("id");
235
+ for (let t of n) e.removeAttribute(t);
236
+ let r = [];
237
+ for (let n of t.attributes ?? []) {
238
+ let t = String(n?.name ?? "").trim();
239
+ y(t) && (e.setAttribute(t, n.value ?? ""), r.push(t));
240
+ }
241
+ return r;
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(" ");
246
+ return i ? `[data-wb="${e}"]${r ? "" : n} { ${i} }` : "";
247
+ }
248
+ function ee(e, t, n) {
249
+ return Object.entries(_).map(([r, i]) => S(e, t?.[r], i, n === r)).filter(Boolean).join("\n");
250
+ }
251
+ function C(e, t) {
252
+ let n = [], r = (e) => {
253
+ for (let [t, r] of Object.entries(e || {})) {
254
+ let e = ee(t, r.props);
255
+ e && n.push(e);
256
+ }
257
+ };
258
+ r(e);
259
+ for (let e of Object.values(t || {})) r(e.template?.nodes);
260
+ return n.join("\n");
261
+ }
262
+ var w = "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif", T = {
263
+ light: {
264
+ background: "#ffffff",
265
+ text: "#111827",
266
+ accent: "#111827",
267
+ accentText: "#ffffff",
268
+ primary: {
269
+ light: "#4b5563",
270
+ main: "#111827",
271
+ dark: "#030712",
272
+ contrastText: "#ffffff"
273
+ },
274
+ secondary: {
275
+ light: "#a5b4fc",
276
+ main: "#6366f1",
277
+ dark: "#4338ca",
278
+ contrastText: "#ffffff"
279
+ }
280
+ },
281
+ dark: {
282
+ background: "#0f172a",
283
+ text: "#e2e8f0",
284
+ accent: "#6366f1",
285
+ accentText: "#ffffff",
286
+ primary: {
287
+ light: "#a5b4fc",
288
+ main: "#6366f1",
289
+ dark: "#4338ca",
290
+ contrastText: "#ffffff"
291
+ },
292
+ secondary: {
293
+ light: "#5eead4",
294
+ main: "#14b8a6",
295
+ dark: "#0f766e",
296
+ contrastText: "#052e2b"
297
+ }
298
+ }
299
+ }, E = {
300
+ font: "system",
301
+ headingFont: "inherit",
302
+ light: T.light,
303
+ dark: T.dark
304
+ }, D = {
305
+ system: {
306
+ label: "System",
307
+ value: w
308
+ },
309
+ inter: {
310
+ label: "Inter",
311
+ value: `"Inter", ${w}`
312
+ },
313
+ outfit: {
314
+ label: "Outfit",
315
+ value: `"Outfit", ${w}`
316
+ },
317
+ serif: {
318
+ label: "Serif",
319
+ value: "Georgia, \"Times New Roman\", serif"
320
+ },
321
+ mono: {
322
+ label: "Mono",
323
+ value: "ui-monospace, SFMono-Regular, Menlo, Consolas, monospace"
324
+ }
325
+ }, O = (e, t) => D[e]?.value ?? t, k = (e, ...t) => {
326
+ let n = Object.assign({}, e, ...t);
327
+ return n.primary = {
328
+ ...e.primary,
329
+ ...t.reduce((e, t) => ({
330
+ ...e,
331
+ ...t?.primary
332
+ }), {})
333
+ }, n.secondary = {
334
+ ...e.secondary,
335
+ ...t.reduce((e, t) => ({
336
+ ...e,
337
+ ...t?.secondary
338
+ }), {})
339
+ }, n;
340
+ };
341
+ function A(e) {
342
+ let { light: t, dark: n, font: r, headingFont: i, ...a } = e ?? {};
343
+ return {
344
+ font: r ?? E.font,
345
+ headingFont: i ?? E.headingFont,
346
+ light: k(T.light, a, t),
347
+ dark: k(T.dark, n)
348
+ };
349
+ }
350
+ function j(e) {
351
+ return {
352
+ "--page-bg": e.background,
353
+ "--page-text": e.text,
354
+ "--page-accent": e.accent,
355
+ "--page-accent-text": e.accentText,
356
+ "--page-primary-light": e.primary.light,
357
+ "--page-primary": e.primary.main,
358
+ "--page-primary-dark": e.primary.dark,
359
+ "--page-primary-contrast": e.primary.contrastText,
360
+ "--page-secondary-light": e.secondary.light,
361
+ "--page-secondary": e.secondary.main,
362
+ "--page-secondary-dark": e.secondary.dark,
363
+ "--page-secondary-contrast": e.secondary.contrastText
364
+ };
365
+ }
366
+ function M(e) {
367
+ let t = A(e);
368
+ return {
369
+ backgroundColor: "var(--page-bg)",
370
+ color: "var(--page-text)",
371
+ fontFamily: O(t.font, w),
372
+ "--page-heading-font": t.headingFont === "inherit" ? "inherit" : O(t.headingFont, "inherit")
373
+ };
374
+ }
375
+ function te(e, t = "light") {
376
+ let n = A(e);
377
+ return {
378
+ ...M(e),
379
+ ...j(n[t] ?? n.light)
380
+ };
381
+ }
382
+ function ne(e, t) {
383
+ return e?.themeRef && t?.[e.themeRef] || e?.theme;
384
+ }
385
+ //#endregion
386
+ //#region ../ui/src/components/builder/views.jsx
387
+ var N = n({
388
+ tenant: "",
389
+ apiUrl: "/api"
390
+ }), P = {
391
+ margin: 0,
392
+ fontWeight: 700,
393
+ lineHeight: 1.2,
394
+ fontFamily: "var(--page-heading-font, inherit)"
395
+ }, F = { margin: 0 }, I = {
396
+ display: "inline-block",
397
+ textDecoration: "none",
398
+ cursor: "pointer",
399
+ backgroundColor: "var(--page-accent, #111827)",
400
+ color: "var(--page-accent-text, #ffffff)"
401
+ }, L = {
402
+ flexGrow: 1,
403
+ display: "flex",
404
+ flexDirection: "column",
405
+ position: "relative"
406
+ }, R = {
407
+ display: "flex",
408
+ flexDirection: "column"
409
+ };
410
+ function z({ style: e }) {
411
+ let t = e?.backgroundVideo;
412
+ if (!t) return null;
413
+ let n = {
414
+ position: "absolute",
415
+ inset: 0,
416
+ width: "100%",
417
+ height: "100%",
418
+ zIndex: -1,
419
+ pointerEvents: "none"
420
+ }, r = e?.overlayColor ? `color-mix(in srgb, ${e.overlayColor} ${e.overlayOpacity ?? 50}%, transparent)` : null;
421
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("video", {
422
+ src: t,
423
+ autoPlay: !0,
424
+ muted: !0,
425
+ loop: !0,
426
+ playsInline: !0,
427
+ style: {
428
+ ...n,
429
+ objectFit: "cover"
430
+ }
431
+ }), r && /* @__PURE__ */ s("div", { style: {
432
+ ...n,
433
+ background: r
434
+ } })] });
435
+ }
436
+ var B = (e, t) => e?.backgroundVideo ? {
437
+ position: "relative",
438
+ ...t,
439
+ ...g(e)
440
+ } : {
441
+ ...t,
442
+ ...g(e)
443
+ };
444
+ function V({ style: e, nodeRef: t, children: n }) {
445
+ return /* @__PURE__ */ c("div", {
446
+ ref: t,
447
+ style: {
448
+ ...L,
449
+ ...g(e)
450
+ },
451
+ children: [/* @__PURE__ */ s(z, { style: e }), n]
452
+ });
453
+ }
454
+ function H({ style: e, nodeRef: t, children: n }) {
455
+ return /* @__PURE__ */ c("section", {
456
+ ref: t,
457
+ style: B(e, R),
458
+ children: [/* @__PURE__ */ s(z, { style: e }), n]
459
+ });
460
+ }
461
+ function U({ style: e, nodeRef: t, children: n }) {
462
+ return /* @__PURE__ */ c("div", {
463
+ ref: t,
464
+ style: B(e),
465
+ children: [/* @__PURE__ */ s(z, { style: e }), n]
466
+ });
467
+ }
468
+ function re({ text: e, parts: t, tag: n = "h2", style: r, linked: i, nodeRef: a }) {
469
+ return /* @__PURE__ */ s(n, {
470
+ ref: a,
471
+ style: {
472
+ ...P,
473
+ ...g(r)
474
+ },
475
+ children: K(t, e, i)
476
+ });
477
+ }
478
+ var W = {
479
+ fontFamily: D.mono.value,
480
+ background: "rgba(148, 163, 184, 0.18)",
481
+ padding: "1px 5px",
482
+ borderRadius: 4,
483
+ fontSize: "0.9em"
484
+ };
485
+ function G(e, t = [], n) {
486
+ let r = e;
487
+ 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", {
488
+ style: W,
489
+ children: r
490
+ })), 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", {
491
+ href: n,
492
+ style: { color: "inherit" },
493
+ children: r
494
+ })), r;
495
+ }
496
+ function K(e, n, r) {
497
+ return e?.length ? e.map((e, n) => {
498
+ if (e.slot) return /* @__PURE__ */ s(t, { children: r?.[e.slot] ?? null }, n);
499
+ if (e.parts) return /* @__PURE__ */ s(t, { children: K(e.parts, "", r) }, n);
500
+ let i = e.text;
501
+ return e.sup ? i = /* @__PURE__ */ s("sup", { children: i }) : e.sub && (i = /* @__PURE__ */ s("sub", { children: i })), e.code && (i = /* @__PURE__ */ s("code", {
502
+ style: W,
503
+ children: i
504
+ })), 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", {
505
+ href: e.href,
506
+ style: { color: "inherit" },
507
+ children: i
508
+ })), /* @__PURE__ */ s(t, { children: i }, n);
509
+ }) : n;
510
+ }
511
+ function ie({ parts: e, text: t, marks: n, href: r, style: i }) {
512
+ return /* @__PURE__ */ s("span", {
513
+ style: g(i),
514
+ children: e?.length ? K(e, t) : G(t, n, r)
515
+ });
516
+ }
517
+ var q = {
518
+ h1: 40,
519
+ h2: 32,
520
+ h3: 26,
521
+ h4: 22,
522
+ h5: 19,
523
+ h6: 16
524
+ };
525
+ function J({ align: e = "center", width: t } = {}) {
526
+ let n = t ? `${t}%` : void 0;
527
+ return e === "full" ? { width: "100%" } : e === "left" ? {
528
+ float: "left",
529
+ width: n ?? "50%",
530
+ marginTop: 4,
531
+ marginRight: 20,
532
+ marginBottom: 12,
533
+ marginLeft: 0
534
+ } : e === "right" ? {
535
+ float: "right",
536
+ width: n ?? "50%",
537
+ marginTop: 4,
538
+ marginLeft: 20,
539
+ marginBottom: 12,
540
+ marginRight: 0
541
+ } : {
542
+ width: n ?? "fit-content",
543
+ maxWidth: "100%",
544
+ marginLeft: "auto",
545
+ marginRight: "auto"
546
+ };
547
+ }
548
+ function ae(e = [], t, n) {
549
+ let r = n ?? ((e, n) => K(e, n, t));
550
+ return e.map((t, n) => {
551
+ let i = {
552
+ marginTop: 0,
553
+ marginBottom: n === e.length - 1 ? 0 : 14
554
+ };
555
+ if (t.type === "image") {
556
+ if (!t.src) return null;
557
+ let e = /* @__PURE__ */ s("img", {
558
+ src: t.src,
559
+ alt: t.alt || "",
560
+ style: {
561
+ width: "100%",
562
+ display: "block",
563
+ borderRadius: 6
564
+ }
565
+ });
566
+ return /* @__PURE__ */ c("figure", {
567
+ style: {
568
+ marginLeft: 0,
569
+ marginRight: 0,
570
+ ...i,
571
+ ...J(t)
572
+ },
573
+ children: [t.href ? /* @__PURE__ */ s("a", {
574
+ href: t.href,
575
+ style: { display: "block" },
576
+ children: e
577
+ }) : e, t.caption && /* @__PURE__ */ s("figcaption", {
578
+ style: {
579
+ fontSize: 13,
580
+ opacity: .65,
581
+ marginTop: 6,
582
+ textAlign: "center"
583
+ },
584
+ children: t.caption
585
+ })]
586
+ }, n);
587
+ }
588
+ if (t.type === "video") return he(t.url) ? /* @__PURE__ */ s("div", {
589
+ style: {
590
+ ...i,
591
+ ...J({
592
+ align: t.align,
593
+ width: t.width ?? 100
594
+ })
595
+ },
596
+ children: /* @__PURE__ */ s(ge, {
597
+ url: t.url,
598
+ autoplay: t.autoplay,
599
+ muted: t.muted,
600
+ loop: t.loop,
601
+ controls: t.controls ?? !0,
602
+ start: t.start
603
+ })
604
+ }, n) : null;
605
+ if (t.type === "divider") return /* @__PURE__ */ s("hr", { style: {
606
+ ...i,
607
+ border: 0,
608
+ borderTop: "1px solid rgba(148, 163, 184, 0.4)"
609
+ } }, n);
610
+ if (t.type === "ul" || t.type === "ol") {
611
+ let e = t.type;
612
+ return /* @__PURE__ */ s(e, {
613
+ style: {
614
+ ...i,
615
+ paddingLeft: 24
616
+ },
617
+ children: (t.items ?? []).map((e, t) => /* @__PURE__ */ s("li", {
618
+ style: { marginBottom: 4 },
619
+ children: r(e.parts, e.text)
620
+ }, t))
621
+ }, n);
622
+ }
623
+ if (t.type === "quote") return /* @__PURE__ */ s("blockquote", {
624
+ style: {
625
+ ...Y,
626
+ ...i
627
+ },
628
+ children: r(t.parts, t.text)
629
+ }, n);
630
+ if (q[t.type]) {
631
+ let e = t.type;
632
+ return /* @__PURE__ */ s(e, {
633
+ style: {
634
+ ...P,
635
+ fontSize: q[t.type],
636
+ ...i
637
+ },
638
+ children: r(t.parts, t.text)
639
+ }, n);
640
+ }
641
+ return /* @__PURE__ */ s("p", {
642
+ style: {
643
+ ...F,
644
+ ...i
645
+ },
646
+ children: r(t.parts, t.text)
647
+ }, n);
648
+ });
649
+ }
650
+ function oe({ content: e, style: t, linked: n, nodeRef: r }) {
651
+ return /* @__PURE__ */ s("div", {
652
+ ref: r,
653
+ style: {
654
+ display: "flow-root",
655
+ ...g(t)
656
+ },
657
+ children: ae(e, n)
658
+ });
659
+ }
660
+ var Y = {
661
+ margin: 0,
662
+ padding: "8px 0 8px 20px",
663
+ borderLeft: "4px solid var(--page-accent, rgba(148, 163, 184, 0.6))"
664
+ };
665
+ function se({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
666
+ return /* @__PURE__ */ s("blockquote", {
667
+ ref: i,
668
+ style: {
669
+ ...Y,
670
+ ...g(n)
671
+ },
672
+ children: K(t, e, r)
673
+ });
674
+ }
675
+ function ce({ ordered: e, items: t = [], style: n, nodeRef: r }) {
676
+ return /* @__PURE__ */ s(e ? "ol" : "ul", {
677
+ ref: r,
678
+ style: {
679
+ margin: 0,
680
+ paddingLeft: 24,
681
+ ...g(n)
682
+ },
683
+ children: t.map((e, t) => /* @__PURE__ */ s("li", {
684
+ style: { marginBottom: 4 },
685
+ children: K(e.parts, e.text)
686
+ }, t))
687
+ });
688
+ }
689
+ function le({ text: e, parts: t, style: n, linked: r, nodeRef: i }) {
690
+ return /* @__PURE__ */ s("p", {
691
+ ref: i,
692
+ style: {
693
+ ...F,
694
+ ...g(n)
695
+ },
696
+ children: K(t, e, r)
697
+ });
698
+ }
699
+ var ue = {
700
+ color: "var(--page-accent, inherit)",
701
+ textDecoration: "underline",
702
+ textUnderlineOffset: 3,
703
+ cursor: "pointer"
704
+ };
705
+ function de({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
706
+ return /* @__PURE__ */ s("a", {
707
+ ref: o,
708
+ href: n || "#",
709
+ target: r || void 0,
710
+ rel: r === "_blank" ? "noopener noreferrer" : void 0,
711
+ style: {
712
+ ...ue,
713
+ ...g(i)
714
+ },
715
+ children: K(t, e, a)
716
+ });
717
+ }
718
+ function fe({ text: e, parts: t, href: n, target: r, style: i, linked: a, nodeRef: o }) {
719
+ return /* @__PURE__ */ s("a", {
720
+ ref: o,
721
+ href: n || "#",
722
+ target: r || void 0,
723
+ rel: r === "_blank" ? "noopener noreferrer" : void 0,
724
+ style: {
725
+ ...I,
726
+ ...g(i)
727
+ },
728
+ children: K(t, e, a)
729
+ });
730
+ }
731
+ function pe({ src: e, alt: t, style: n, nodeRef: r }) {
732
+ return e ? /* @__PURE__ */ s("img", {
733
+ ref: r,
734
+ src: e,
735
+ alt: t || "",
736
+ style: {
737
+ display: "block",
738
+ maxWidth: "100%",
739
+ ...g(n)
740
+ }
741
+ }) : null;
742
+ }
743
+ function me({ src: e, poster: t, controls: n = !0, autoplay: r = !1, loop: i = !1, muted: a = !1, style: o, nodeRef: c }) {
744
+ return e ? /* @__PURE__ */ s("video", {
745
+ ref: c,
746
+ src: e,
747
+ poster: t || void 0,
748
+ controls: n,
749
+ autoPlay: r,
750
+ muted: a || r,
751
+ loop: i,
752
+ playsInline: !0,
753
+ style: {
754
+ display: "block",
755
+ width: "100%",
756
+ maxWidth: "100%",
757
+ ...g(o)
758
+ }
759
+ }) : null;
760
+ }
761
+ var he = (e = "") => (e.match(/(?:youtu\.be\/|v=|embed\/|shorts\/|live\/)([\w-]{11})/) || e.match(/^([\w-]{11})$/))?.[1];
762
+ function ge({ url: e, autoplay: t = !1, muted: n = !1, loop: r = !1, controls: i = !0, start: a, style: o, nodeRef: c }) {
763
+ let l = he(e);
764
+ if (!l) return null;
765
+ let u = new URLSearchParams({ rel: "0" });
766
+ 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", {
767
+ ref: c,
768
+ style: {
769
+ position: "relative",
770
+ width: "100%",
771
+ paddingTop: "56.25%",
772
+ ...g(o)
773
+ },
774
+ children: /* @__PURE__ */ s("iframe", {
775
+ src: `https://www.youtube-nocookie.com/embed/${l}?${u}`,
776
+ title: "YouTube video",
777
+ allow: "accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",
778
+ allowFullScreen: !0,
779
+ style: {
780
+ position: "absolute",
781
+ inset: 0,
782
+ width: "100%",
783
+ height: "100%",
784
+ border: 0
785
+ }
786
+ })
787
+ });
788
+ }
789
+ function _e({ src: e, title: t, allowFullscreen: n = !0, style: r, nodeRef: i }) {
790
+ return e ? /* @__PURE__ */ s("iframe", {
791
+ ref: i,
792
+ src: e,
793
+ title: t || "Embedded frame",
794
+ loading: "lazy",
795
+ allowFullScreen: n,
796
+ style: {
797
+ display: "block",
798
+ width: "100%",
799
+ height: 300,
800
+ border: 0,
801
+ ...g(r)
802
+ }
803
+ }) : null;
804
+ }
805
+ function ve({ code: e, runScripts: t = !0, style: n, nodeRef: r }) {
806
+ let [o, c] = a(null);
807
+ return i(() => {
808
+ o && (o.innerHTML = e || "", t && o.querySelectorAll("script").forEach((e) => {
809
+ let t = document.createElement("script");
810
+ for (let { name: n, value: r } of e.attributes) t.setAttribute(n, r);
811
+ t.text = e.textContent, e.replaceWith(t);
812
+ }));
813
+ }, [
814
+ o,
815
+ e,
816
+ t
817
+ ]), /* @__PURE__ */ s("div", {
818
+ ref: (e) => {
819
+ c(e), r && r(e);
820
+ },
821
+ style: g(n)
822
+ });
823
+ }
824
+ function ye({ height: e, nodeRef: t }) {
825
+ return /* @__PURE__ */ s("div", {
826
+ ref: t,
827
+ style: {
828
+ height: e || 32,
829
+ flexShrink: 0,
830
+ alignSelf: "stretch"
831
+ }
832
+ });
833
+ }
834
+ function be({ style: e, nodeRef: t }) {
835
+ return /* @__PURE__ */ s("div", {
836
+ ref: t,
837
+ style: {
838
+ height: 1,
839
+ alignSelf: "stretch",
840
+ flexShrink: 0,
841
+ ...g(e)
842
+ }
843
+ });
844
+ }
845
+ var xe = {
846
+ position: "absolute",
847
+ top: "50%",
848
+ transform: "translateY(-50%)",
849
+ width: 36,
850
+ height: 36,
851
+ borderRadius: "50%",
852
+ border: 0,
853
+ cursor: "pointer",
854
+ background: "rgba(17, 24, 39, 0.45)",
855
+ color: "#fff",
856
+ fontSize: 20,
857
+ lineHeight: 1,
858
+ display: "flex",
859
+ alignItems: "center",
860
+ justifyContent: "center",
861
+ padding: 0
862
+ }, Se = {
863
+ bottom: {
864
+ inset: "auto 0 0 0",
865
+ padding: "40px 24px 20px",
866
+ background: "linear-gradient(transparent, rgba(0, 0, 0, 0.55))"
867
+ },
868
+ top: {
869
+ inset: "0 0 auto 0",
870
+ padding: "20px 24px 40px",
871
+ background: "linear-gradient(rgba(0, 0, 0, 0.55), transparent)"
872
+ },
873
+ middle: {
874
+ inset: 0,
875
+ display: "flex",
876
+ flexDirection: "column",
877
+ justifyContent: "center",
878
+ padding: 24,
879
+ textShadow: "0 2px 12px rgba(0, 0, 0, 0.6)"
880
+ }
881
+ }, Ce = 48;
882
+ function we({ count: e, renderSlide: t, autoplay: n = !0, interval: r = 5, height: l = 320, swipe: u = !0, style: d, nodeRef: f }) {
883
+ let [p, m] = a(0), [h, _] = a(!1), [v, y] = a(null), b = e ? Math.min(p, e - 1) : 0;
884
+ if (i(() => {
885
+ if (!n || h || v || e < 2) return;
886
+ let t = setInterval(() => m((t) => (t + 1) % e), Math.max(2, Number(r) || 5) * 1e3);
887
+ return () => clearInterval(t);
888
+ }, [
889
+ n,
890
+ h,
891
+ v,
892
+ r,
893
+ e
894
+ ]), !e) return null;
895
+ let x = (t) => m((t + e) % e), S = () => {
896
+ if (!v) return;
897
+ let { dx: e } = v;
898
+ y(null), e < -48 ? x(b + 1) : e > Ce && x(b - 1);
899
+ };
900
+ return /* @__PURE__ */ c("div", {
901
+ ref: f,
902
+ onMouseEnter: () => _(!0),
903
+ onMouseLeave: () => _(!1),
904
+ onPointerDown: u && e > 1 ? (e) => {
905
+ e.pointerType === "mouse" && e.button !== 0 || e.target.closest("button") || (e.currentTarget.setPointerCapture(e.pointerId), y({
906
+ startX: e.clientX,
907
+ dx: 0
908
+ }));
909
+ } : void 0,
910
+ onPointerMove: v ? (e) => y((t) => t && {
911
+ ...t,
912
+ dx: e.clientX - t.startX
913
+ }) : void 0,
914
+ onPointerUp: S,
915
+ onPointerCancel: S,
916
+ style: {
917
+ position: "relative",
918
+ overflow: "hidden",
919
+ width: "100%",
920
+ touchAction: "pan-y",
921
+ userSelect: v ? "none" : void 0,
922
+ cursor: v ? "grabbing" : void 0,
923
+ ...g(d)
924
+ },
925
+ children: [/* @__PURE__ */ s("div", {
926
+ style: {
927
+ display: "flex",
928
+ height: l,
929
+ transform: `translateX(calc(${-b * 100}% + ${v?.dx ?? 0}px))`,
930
+ transition: v ? "none" : "transform 450ms ease"
931
+ },
932
+ children: Array.from({ length: e }, (e, n) => /* @__PURE__ */ s("div", {
933
+ style: {
934
+ position: "relative",
935
+ width: "100%",
936
+ flexShrink: 0,
937
+ overflow: "hidden"
938
+ },
939
+ children: t(n)
940
+ }, n))
941
+ }), e > 1 && /* @__PURE__ */ c(o, { children: [
942
+ /* @__PURE__ */ s("button", {
943
+ type: "button",
944
+ "aria-label": "Previous slide",
945
+ style: {
946
+ ...xe,
947
+ left: 12
948
+ },
949
+ onClick: () => x(b - 1),
950
+ children: "‹"
951
+ }),
952
+ /* @__PURE__ */ s("button", {
953
+ type: "button",
954
+ "aria-label": "Next slide",
955
+ style: {
956
+ ...xe,
957
+ right: 12
958
+ },
959
+ onClick: () => x(b + 1),
960
+ children: "›"
961
+ }),
962
+ /* @__PURE__ */ s("div", {
963
+ style: {
964
+ position: "absolute",
965
+ bottom: 10,
966
+ left: 0,
967
+ right: 0,
968
+ display: "flex",
969
+ justifyContent: "center",
970
+ gap: 6
971
+ },
972
+ children: Array.from({ length: e }, (e, t) => /* @__PURE__ */ s("button", {
973
+ type: "button",
974
+ "aria-label": `Go to slide ${t + 1}`,
975
+ onClick: () => x(t),
976
+ style: {
977
+ width: 8,
978
+ height: 8,
979
+ borderRadius: "50%",
980
+ border: 0,
981
+ padding: 0,
982
+ cursor: "pointer",
983
+ background: t === b ? "#ffffff" : "rgba(255, 255, 255, 0.45)"
984
+ }
985
+ }, t))
986
+ })
987
+ ] })]
988
+ });
989
+ }
990
+ var Te = (e, t) => ({
991
+ position: "absolute",
992
+ inset: 0,
993
+ backgroundImage: e ? `url(${e})` : "none",
994
+ backgroundColor: t || (e ? void 0 : "rgba(148, 163, 184, 0.25)"),
995
+ backgroundSize: "cover",
996
+ backgroundPosition: "center"
997
+ });
998
+ function Ee({ slides: e = [], captionPosition: t = "bottom", captionAlign: n = "left", ...r }) {
999
+ return e.length ? /* @__PURE__ */ s(we, {
1000
+ ...r,
1001
+ count: e.length,
1002
+ renderSlide: (r) => {
1003
+ let i = e[r];
1004
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", { style: Te(i.image) }), (i.title || i.text) && /* @__PURE__ */ c("div", {
1005
+ style: {
1006
+ position: "absolute",
1007
+ color: "#fff",
1008
+ textAlign: n,
1009
+ ...Se[t] ?? Se.bottom
1010
+ },
1011
+ children: [i.title && /* @__PURE__ */ s("div", {
1012
+ style: {
1013
+ fontSize: 22,
1014
+ fontWeight: 700
1015
+ },
1016
+ children: i.title
1017
+ }), i.text && /* @__PURE__ */ s("div", {
1018
+ style: {
1019
+ fontSize: 14,
1020
+ opacity: .9,
1021
+ marginTop: 4
1022
+ },
1023
+ children: i.text
1024
+ })]
1025
+ })] });
1026
+ }
1027
+ }) : null;
1028
+ }
1029
+ function De({ slides: e = [], linked: t, ...n }) {
1030
+ return e.length ? /* @__PURE__ */ s(we, {
1031
+ ...n,
1032
+ count: e.length,
1033
+ renderSlide: (n) => {
1034
+ let r = e[n];
1035
+ return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s("div", { style: Te(r.image, r.color) }), /* @__PURE__ */ s("div", {
1036
+ style: {
1037
+ position: "absolute",
1038
+ inset: 0,
1039
+ display: "flex",
1040
+ flexDirection: "column"
1041
+ },
1042
+ children: t?.[r.key] ?? null
1043
+ })] });
1044
+ }
1045
+ }) : null;
1046
+ }
1047
+ var X = {
1048
+ color: "inherit",
1049
+ textDecoration: "none",
1050
+ fontSize: 14,
1051
+ opacity: .85
1052
+ }, Oe = {
1053
+ background: "var(--page-bg, #ffffff)",
1054
+ color: "var(--page-text, #111827)",
1055
+ border: "1px solid rgba(148, 163, 184, 0.25)",
1056
+ boxShadow: "0 16px 40px rgba(15, 23, 42, 0.16)",
1057
+ zIndex: 60
1058
+ };
1059
+ function ke({ brand: e, logo: n, links: r = [], style: o, nodeRef: l, menu: u = "auto", breakpoint: d = 768 }) {
1060
+ let [f, p] = a(null), [m, h] = a(!1), [_, v] = a(!1), [y, b] = a(null);
1061
+ i(() => {
1062
+ if (!f) return;
1063
+ let e = new ResizeObserver(() => h(f.offsetWidth < d));
1064
+ return e.observe(f), () => e.disconnect();
1065
+ }, [f, d]);
1066
+ let x = u === "hamburger" || u === "auto" && m, S = (e, t) => /* @__PURE__ */ c("a", {
1067
+ href: e.href || "#",
1068
+ style: {
1069
+ ...X,
1070
+ display: "block",
1071
+ ...t
1072
+ },
1073
+ children: [e.label, e.desc && /* @__PURE__ */ s("span", {
1074
+ style: {
1075
+ display: "block",
1076
+ fontSize: 12,
1077
+ opacity: .6,
1078
+ marginTop: 2
1079
+ },
1080
+ children: e.desc
1081
+ })]
1082
+ }, e.key);
1083
+ return /* @__PURE__ */ c("nav", {
1084
+ ref: (e) => {
1085
+ p(e), l && l(e);
1086
+ },
1087
+ style: {
1088
+ display: "flex",
1089
+ alignItems: "center",
1090
+ gap: 24,
1091
+ flexWrap: "wrap",
1092
+ padding: "14px 24px",
1093
+ width: "100%",
1094
+ position: "relative",
1095
+ ...g(o)
1096
+ },
1097
+ children: [
1098
+ n && /* @__PURE__ */ s("img", {
1099
+ src: n,
1100
+ alt: e || "Logo",
1101
+ style: {
1102
+ height: 28,
1103
+ display: "block"
1104
+ }
1105
+ }),
1106
+ e && /* @__PURE__ */ s("div", {
1107
+ style: {
1108
+ fontWeight: 700,
1109
+ fontSize: 18,
1110
+ fontFamily: "var(--page-heading-font, inherit)"
1111
+ },
1112
+ children: e
1113
+ }),
1114
+ /* @__PURE__ */ s("div", { style: { flexGrow: 1 } }),
1115
+ x ? /* @__PURE__ */ s("button", {
1116
+ type: "button",
1117
+ "aria-label": _ ? "Close menu" : "Open menu",
1118
+ onClick: () => v(!_),
1119
+ style: {
1120
+ background: "transparent",
1121
+ border: 0,
1122
+ color: "inherit",
1123
+ cursor: "pointer",
1124
+ fontSize: 20,
1125
+ lineHeight: 1,
1126
+ padding: 4
1127
+ },
1128
+ children: _ ? "✕" : "☰"
1129
+ }) : /* @__PURE__ */ s("div", {
1130
+ style: {
1131
+ display: "flex",
1132
+ gap: 20,
1133
+ alignItems: "center",
1134
+ flexWrap: "wrap"
1135
+ },
1136
+ children: r.map((e) => {
1137
+ let t = e.children ?? [];
1138
+ if (!t.length) return /* @__PURE__ */ s("a", {
1139
+ href: e.href || "#",
1140
+ style: X,
1141
+ children: e.label
1142
+ }, e.key);
1143
+ let n = e.type === "mega";
1144
+ return /* @__PURE__ */ c("span", {
1145
+ style: {
1146
+ position: n ? "static" : "relative",
1147
+ display: "inline-flex"
1148
+ },
1149
+ onMouseEnter: () => b(e.key),
1150
+ onMouseLeave: () => b(null),
1151
+ children: [/* @__PURE__ */ c("a", {
1152
+ href: e.href || "#",
1153
+ style: {
1154
+ ...X,
1155
+ cursor: "pointer"
1156
+ },
1157
+ children: [
1158
+ e.label,
1159
+ " ",
1160
+ /* @__PURE__ */ s("span", {
1161
+ style: {
1162
+ fontSize: 9,
1163
+ opacity: .6
1164
+ },
1165
+ children: "▼"
1166
+ })
1167
+ ]
1168
+ }), y === e.key && (n ? /* @__PURE__ */ s("div", {
1169
+ style: {
1170
+ ...Oe,
1171
+ position: "absolute",
1172
+ left: 0,
1173
+ right: 0,
1174
+ top: "100%",
1175
+ padding: 24,
1176
+ display: "grid",
1177
+ gridTemplateColumns: "repeat(auto-fit, minmax(170px, 1fr))",
1178
+ gap: 16
1179
+ },
1180
+ children: t.map((e) => S(e, {
1181
+ padding: "6px 8px",
1182
+ borderRadius: 6
1183
+ }))
1184
+ }) : /* @__PURE__ */ s("div", {
1185
+ style: {
1186
+ ...Oe,
1187
+ position: "absolute",
1188
+ top: "100%",
1189
+ left: 0,
1190
+ minWidth: 190,
1191
+ borderRadius: 8,
1192
+ padding: 8,
1193
+ display: "flex",
1194
+ flexDirection: "column"
1195
+ },
1196
+ children: t.map((e) => S(e, {
1197
+ padding: "8px 12px",
1198
+ borderRadius: 6
1199
+ }))
1200
+ }))]
1201
+ }, e.key);
1202
+ })
1203
+ }),
1204
+ x && _ && /* @__PURE__ */ s("div", {
1205
+ style: {
1206
+ flexBasis: "100%",
1207
+ width: "100%",
1208
+ display: "flex",
1209
+ flexDirection: "column",
1210
+ paddingTop: 10
1211
+ },
1212
+ children: r.map((e) => /* @__PURE__ */ c(t, { children: [/* @__PURE__ */ s("a", {
1213
+ href: e.href || "#",
1214
+ style: {
1215
+ ...X,
1216
+ padding: "10px 4px",
1217
+ fontWeight: (e.children ?? []).length ? 600 : 400,
1218
+ opacity: 1
1219
+ },
1220
+ children: e.label
1221
+ }), (e.children ?? []).map((e) => S(e, { padding: "8px 4px 8px 22px" }))] }, e.key))
1222
+ })
1223
+ ]
1224
+ });
1225
+ }
1226
+ function Ae({ tabs: e = [], linked: t, style: n, nodeRef: r }) {
1227
+ let [i, o] = a(0), l = e.length ? Math.min(i, e.length - 1) : 0;
1228
+ return e.length ? /* @__PURE__ */ c("div", {
1229
+ ref: r,
1230
+ style: {
1231
+ width: "100%",
1232
+ ...g(n)
1233
+ },
1234
+ children: [/* @__PURE__ */ s("div", {
1235
+ style: {
1236
+ display: "flex",
1237
+ gap: 4,
1238
+ borderBottom: "1px solid rgba(148, 163, 184, 0.35)"
1239
+ },
1240
+ children: e.map((e, t) => /* @__PURE__ */ s("button", {
1241
+ type: "button",
1242
+ onClick: () => o(t),
1243
+ style: {
1244
+ background: "transparent",
1245
+ border: 0,
1246
+ padding: "10px 16px",
1247
+ fontSize: 14,
1248
+ fontFamily: "inherit",
1249
+ color: "inherit",
1250
+ cursor: "pointer",
1251
+ opacity: t === l ? 1 : .6,
1252
+ fontWeight: t === l ? 600 : 500,
1253
+ boxShadow: t === l ? "inset 0 -2px 0 var(--page-accent, #111827)" : "none"
1254
+ },
1255
+ children: e.label || `Tab ${t + 1}`
1256
+ }, e.key))
1257
+ }), e.map((e, n) => /* @__PURE__ */ s("div", {
1258
+ style: {
1259
+ display: n === l ? "flex" : "none",
1260
+ flexDirection: "column"
1261
+ },
1262
+ children: t?.[e.key] ?? null
1263
+ }, e.key))]
1264
+ }) : null;
1265
+ }
1266
+ function je({ items: e = [], linked: t, multiple: n = !1, style: r, nodeRef: i }) {
1267
+ let [o, l] = a(() => new Set(e.length ? [e[0].key] : []));
1268
+ if (!e.length) return null;
1269
+ let u = (e) => l((t) => {
1270
+ let r = new Set(n ? t : []);
1271
+ return t.has(e) ? r.delete(e) : r.add(e), r;
1272
+ });
1273
+ return /* @__PURE__ */ s("div", {
1274
+ ref: i,
1275
+ style: {
1276
+ width: "100%",
1277
+ ...g(r)
1278
+ },
1279
+ children: e.map((n, r) => {
1280
+ let i = o.has(n.key);
1281
+ return /* @__PURE__ */ c("div", {
1282
+ style: { borderBottom: r < e.length - 1 ? "1px solid rgba(148, 163, 184, 0.35)" : "none" },
1283
+ children: [/* @__PURE__ */ c("button", {
1284
+ type: "button",
1285
+ onClick: () => u(n.key),
1286
+ style: {
1287
+ width: "100%",
1288
+ display: "flex",
1289
+ alignItems: "center",
1290
+ justifyContent: "space-between",
1291
+ gap: 12,
1292
+ background: "transparent",
1293
+ border: 0,
1294
+ padding: "14px 4px",
1295
+ fontSize: 15,
1296
+ fontWeight: 600,
1297
+ fontFamily: "inherit",
1298
+ color: "inherit",
1299
+ textAlign: "left",
1300
+ cursor: "pointer"
1301
+ },
1302
+ children: [n.title || `Item ${r + 1}`, /* @__PURE__ */ s("span", {
1303
+ "aria-hidden": !0,
1304
+ style: {
1305
+ fontSize: 12,
1306
+ opacity: .6,
1307
+ transform: i ? "rotate(180deg)" : "none",
1308
+ transition: "transform 180ms"
1309
+ },
1310
+ children: "▼"
1311
+ })]
1312
+ }), /* @__PURE__ */ s("div", {
1313
+ style: {
1314
+ display: i ? "flex" : "none",
1315
+ flexDirection: "column"
1316
+ },
1317
+ children: t?.[n.key] ?? null
1318
+ })]
1319
+ }, n.key);
1320
+ })
1321
+ });
1322
+ }
1323
+ var Me = {
1324
+ display: "flex",
1325
+ flexDirection: "column",
1326
+ gap: "12px"
1327
+ }, Ne = {
1328
+ fontSize: "14px",
1329
+ fontWeight: 500,
1330
+ color: "var(--page-text, #111827)"
1331
+ }, Z = {
1332
+ padding: "10px 12px",
1333
+ border: "1px solid #d1d5db",
1334
+ borderRadius: "6px",
1335
+ fontSize: "14px",
1336
+ fontFamily: "inherit",
1337
+ width: "100%",
1338
+ boxSizing: "border-box",
1339
+ backgroundColor: "#ffffff",
1340
+ color: "#111827"
1341
+ }, Pe = {
1342
+ display: "flex",
1343
+ alignItems: "center",
1344
+ gap: "8px",
1345
+ fontSize: "14px",
1346
+ color: "var(--page-text, #111827)"
1347
+ }, Fe = (e) => e ? {
1348
+ readOnly: !0,
1349
+ tabIndex: -1,
1350
+ onMouseDown: (e) => e.preventDefault()
1351
+ } : {};
1352
+ function Ie({ style: e, action: t, method: n, name: i, enctype: o, formSlug: l, nodeRef: u, inert: d, children: f, linked: p, show: m }) {
1353
+ let { tenant: h, apiUrl: _ } = r(N), [v, y] = a("form"), b = d ? m || "form" : v;
1354
+ return /* @__PURE__ */ c("div", {
1355
+ ref: u,
1356
+ style: g(e),
1357
+ children: [
1358
+ /* @__PURE__ */ s("form", {
1359
+ action: t || void 0,
1360
+ method: n || "post",
1361
+ name: i || void 0,
1362
+ encType: o || void 0,
1363
+ onSubmit: async (e) => {
1364
+ if (e.preventDefault(), !d) {
1365
+ if (l) {
1366
+ let t = {};
1367
+ for (let [n, r] of new FormData(e.currentTarget).entries()) typeof r == "string" && (t[n] = r === "on" || r);
1368
+ try {
1369
+ let e = await fetch(`${_ || "/api"}/forms/${l}/submit`, {
1370
+ method: "post",
1371
+ headers: {
1372
+ "content-type": "application/json",
1373
+ ...h ? { "x-tenant": h } : {}
1374
+ },
1375
+ body: JSON.stringify(t)
1376
+ }), n = await e.json().catch(() => null);
1377
+ y(e.ok && n?.success !== !1 ? "success" : "error");
1378
+ } catch {
1379
+ y("error");
1380
+ }
1381
+ return;
1382
+ }
1383
+ if (!t) {
1384
+ y("success");
1385
+ return;
1386
+ }
1387
+ try {
1388
+ let r = await fetch(t, {
1389
+ method: n || "post",
1390
+ body: new FormData(e.currentTarget)
1391
+ });
1392
+ y(r.ok ? "success" : "error");
1393
+ } catch {
1394
+ y("error");
1395
+ }
1396
+ }
1397
+ },
1398
+ style: {
1399
+ ...Me,
1400
+ display: b === "success" ? "none" : "flex"
1401
+ },
1402
+ children: f
1403
+ }),
1404
+ /* @__PURE__ */ s("div", {
1405
+ style: { display: b === "success" ? "block" : "none" },
1406
+ children: p?.success ?? null
1407
+ }),
1408
+ /* @__PURE__ */ s("div", {
1409
+ style: {
1410
+ display: b === "error" ? "block" : "none",
1411
+ marginTop: 12
1412
+ },
1413
+ children: p?.error ?? null
1414
+ })
1415
+ ]
1416
+ });
1417
+ }
1418
+ function Le({ text: e, parts: t, style: n, nodeRef: r, linked: i }) {
1419
+ return /* @__PURE__ */ s("label", {
1420
+ ref: r,
1421
+ style: {
1422
+ ...Ne,
1423
+ ...g(n)
1424
+ },
1425
+ children: K(t, e, i)
1426
+ });
1427
+ }
1428
+ function Re({ type: e = "text", name: t, placeholder: n, required: r, style: i, nodeRef: a, inert: o }) {
1429
+ return /* @__PURE__ */ s("input", {
1430
+ ref: a,
1431
+ type: e,
1432
+ name: t || void 0,
1433
+ placeholder: n,
1434
+ required: !o && !!r,
1435
+ style: {
1436
+ ...Z,
1437
+ ...g(i)
1438
+ },
1439
+ ...Fe(o)
1440
+ });
1441
+ }
1442
+ function ze({ name: e, placeholder: t, rows: n = 4, required: r, style: i, nodeRef: a, inert: o }) {
1443
+ return /* @__PURE__ */ s("textarea", {
1444
+ ref: a,
1445
+ name: e || void 0,
1446
+ placeholder: t,
1447
+ rows: n,
1448
+ required: !o && !!r,
1449
+ style: {
1450
+ ...Z,
1451
+ resize: "vertical",
1452
+ ...g(i)
1453
+ },
1454
+ ...Fe(o)
1455
+ });
1456
+ }
1457
+ function Be({ kind: e = "checkbox", label: t, name: n, value: r, required: i, style: a, nodeRef: o, inert: l }) {
1458
+ return /* @__PURE__ */ c("label", {
1459
+ ref: o,
1460
+ style: {
1461
+ ...Pe,
1462
+ ...g(a)
1463
+ },
1464
+ children: [/* @__PURE__ */ s("input", {
1465
+ type: e,
1466
+ name: n || void 0,
1467
+ value: r || void 0,
1468
+ required: !l && !!i,
1469
+ onClick: l ? (e) => e.preventDefault() : void 0,
1470
+ tabIndex: l ? -1 : void 0,
1471
+ style: {
1472
+ margin: 0,
1473
+ accentColor: "var(--page-accent, #111827)"
1474
+ }
1475
+ }), t]
1476
+ });
1477
+ }
1478
+ function Ve({ name: e, placeholder: t, options: n = [], required: r, style: i, nodeRef: a, inert: o }) {
1479
+ return /* @__PURE__ */ c("select", {
1480
+ ref: a,
1481
+ name: e || void 0,
1482
+ required: !o && !!r,
1483
+ defaultValue: "",
1484
+ onMouseDown: o ? (e) => e.preventDefault() : void 0,
1485
+ tabIndex: o ? -1 : void 0,
1486
+ style: {
1487
+ ...Z,
1488
+ appearance: "auto",
1489
+ ...g(i)
1490
+ },
1491
+ children: [t !== "" && /* @__PURE__ */ s("option", {
1492
+ value: "",
1493
+ disabled: !0,
1494
+ children: t ?? "Select…"
1495
+ }), n.map((e, t) => /* @__PURE__ */ s("option", {
1496
+ value: e,
1497
+ children: e
1498
+ }, t))]
1499
+ });
1500
+ }
1501
+ function He({ name: e, accept: t, required: n, text: r = "Choose a file…", style: i, nodeRef: o, inert: l }) {
1502
+ let [u, d] = a(null);
1503
+ return /* @__PURE__ */ c("label", {
1504
+ ref: o,
1505
+ style: {
1506
+ ...Z,
1507
+ display: "flex",
1508
+ alignItems: "center",
1509
+ gap: "8px",
1510
+ cursor: l ? "default" : "pointer",
1511
+ borderStyle: "dashed",
1512
+ color: u ? "#111827" : "#6b7280",
1513
+ ...g(i)
1514
+ },
1515
+ children: [
1516
+ /* @__PURE__ */ s("input", {
1517
+ type: "file",
1518
+ name: e || void 0,
1519
+ accept: t || void 0,
1520
+ required: !l && !!n,
1521
+ disabled: !!l,
1522
+ onChange: (e) => d(e.target.files?.[0]?.name ?? null),
1523
+ style: { display: "none" }
1524
+ }),
1525
+ /* @__PURE__ */ s("span", {
1526
+ "aria-hidden": !0,
1527
+ children: "📎"
1528
+ }),
1529
+ u ?? r
1530
+ ]
1531
+ });
1532
+ }
1533
+ function Ue({ text: e = "Submit", style: t, nodeRef: n, inert: r }) {
1534
+ return /* @__PURE__ */ s("button", {
1535
+ ref: n,
1536
+ type: r ? "button" : "submit",
1537
+ style: {
1538
+ ...I,
1539
+ border: 0,
1540
+ cursor: "pointer",
1541
+ alignSelf: "flex-start",
1542
+ ...g(t)
1543
+ },
1544
+ children: e
1545
+ });
1546
+ }
1547
+ var We = {
1548
+ PageRoot: V,
1549
+ Section: H,
1550
+ Container: U,
1551
+ Heading: re,
1552
+ TextBlock: le,
1553
+ ButtonBlock: fe,
1554
+ ImageBlock: pe,
1555
+ Spacer: ye,
1556
+ Divider: be,
1557
+ SliderBlock: Ee,
1558
+ CanvasSlider: De,
1559
+ TabsBlock: Ae,
1560
+ AccordionBlock: je,
1561
+ NavbarBlock: ke,
1562
+ ListBlock: ce,
1563
+ TextSpan: ie,
1564
+ QuoteBlock: se,
1565
+ TextLink: de,
1566
+ RichTextBlock: oe,
1567
+ RichContentBlock: oe,
1568
+ VideoBlock: me,
1569
+ YouTubeBlock: ge,
1570
+ IframeBlock: _e,
1571
+ EmbedBlock: ve,
1572
+ FormBlock: Ie,
1573
+ FormLabel: Le,
1574
+ FormInput: Re,
1575
+ FormTextarea: ze,
1576
+ FormCheckbox: (e) => /* @__PURE__ */ s(Be, {
1577
+ kind: "checkbox",
1578
+ ...e
1579
+ }),
1580
+ FormRadio: (e) => /* @__PURE__ */ s(Be, {
1581
+ kind: "radio",
1582
+ ...e
1583
+ }),
1584
+ FormSelect: Ve,
1585
+ FormFile: He,
1586
+ FormSubmit: Ue
1587
+ };
1588
+ //#endregion
1589
+ //#region ../ui/src/components/builder/render.jsx
1590
+ function Q(e, n, r, i = /* @__PURE__ */ new Set()) {
1591
+ let a = n[e];
1592
+ if (!a || a.hidden) return null;
1593
+ let o = a.type?.resolvedName;
1594
+ if (o === "ComponentInstance") {
1595
+ let n = a.props?.componentId, o = r?.[n];
1596
+ if (!o?.template || i.has(n)) return null;
1597
+ let c = new Set(i).add(n);
1598
+ return /* @__PURE__ */ s(t, { children: Q(o.template.rootId, o.template.nodes, r, c) }, e);
1599
+ }
1600
+ let c = We[o];
1601
+ if (!c) return null;
1602
+ 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;
1603
+ return /* @__PURE__ */ s(c, {
1604
+ ...a.props,
1605
+ linked: d,
1606
+ nodeRef: (t) => {
1607
+ t && (t.setAttribute("data-wb", e), b(t, a.props ?? {}));
1608
+ },
1609
+ children: l.length ? l : void 0
1610
+ }, e);
1611
+ }
1612
+ //#endregion
1613
+ //#region ../ui/src/components/builder/PageRenderer.jsx
1614
+ var Ge = (e) => Object.entries(e).map(([e, t]) => `${e}: ${t};`).join(" ");
1615
+ function Ke({ blocks: e, theme: t, components: n, mode: r = "auto", style: a, custom: o, tenant: l, apiUrl: d }) {
1616
+ let p = o?.js?.trim();
1617
+ if (i(() => {
1618
+ if (!p) return;
1619
+ let e = document.createElement("script");
1620
+ return e.text = p, document.body.appendChild(e), () => e.remove();
1621
+ }, [p]), !e?.ROOT) return null;
1622
+ let m = {
1623
+ minHeight: "100%",
1624
+ display: "flex",
1625
+ flexDirection: "column"
1626
+ }, h = Q("ROOT", e, n), g = C(e, n), _ = o?.css?.trim(), v = f(e, n).map((e) => /* @__PURE__ */ s("link", {
1627
+ rel: "stylesheet",
1628
+ precedence: "default",
1629
+ href: u(e)
1630
+ }, e));
1631
+ if (r !== "auto") return /* @__PURE__ */ s(N.Provider, {
1632
+ value: {
1633
+ tenant: l || "",
1634
+ apiUrl: d || "/api"
1635
+ },
1636
+ children: /* @__PURE__ */ c("div", {
1637
+ style: {
1638
+ ...m,
1639
+ ...te(t, r),
1640
+ ...a
1641
+ },
1642
+ children: [
1643
+ v,
1644
+ g && /* @__PURE__ */ s("style", { children: g }),
1645
+ _ && /* @__PURE__ */ s("style", { children: _ }),
1646
+ h
1647
+ ]
1648
+ })
1649
+ });
1650
+ let y = A(t);
1651
+ return /* @__PURE__ */ s(N.Provider, {
1652
+ value: {
1653
+ tenant: l || "",
1654
+ apiUrl: d || "/api"
1655
+ },
1656
+ children: /* @__PURE__ */ c("div", {
1657
+ className: "webim-page",
1658
+ style: {
1659
+ ...m,
1660
+ ...M(t),
1661
+ ...a
1662
+ },
1663
+ children: [
1664
+ /* @__PURE__ */ s("style", { children: `.webim-page { ${Ge(j(y.light))} }
1665
+ @media (prefers-color-scheme: dark) { .webim-page { ${Ge(j(y.dark))} } }` }),
1666
+ v,
1667
+ g && /* @__PURE__ */ s("style", { children: g }),
1668
+ _ && /* @__PURE__ */ s("style", { children: _ }),
1669
+ h
1670
+ ]
1671
+ })
1672
+ });
1673
+ }
1674
+ //#endregion
1675
+ //#region src/WebimContent.jsx
1676
+ function qe({ bundle: e, mode: t = "auto", style: n }) {
1677
+ return e?.blocks?.ROOT ? /* @__PURE__ */ s(Ke, {
1678
+ blocks: e.blocks,
1679
+ theme: e.theme,
1680
+ components: e.components,
1681
+ custom: e.custom,
1682
+ tenant: e.tenant,
1683
+ apiUrl: e.apiUrl,
1684
+ mode: t,
1685
+ style: n
1686
+ }) : null;
1687
+ }
1688
+ //#endregion
1689
+ //#region src/bundle.js
1690
+ function Je({ page: e, settings: t, tenant: n, apiUrl: r, locale: i }) {
1691
+ let a = {
1692
+ ...t?.global ?? {},
1693
+ ...t?.tenant ?? {}
1694
+ }, o = e.meta ?? {};
1695
+ return {
1696
+ schema: 1,
1697
+ title: e.title,
1698
+ slug: e.slug,
1699
+ blocks: i && o.i18n?.[i]?.blocks || e.blocks,
1700
+ theme: ne(o, a.builder_themes?.themes),
1701
+ components: a.builder_components?.components ?? {},
1702
+ custom: o.custom,
1703
+ seo: o.seo,
1704
+ locales: a.locales,
1705
+ tenant: n ?? "",
1706
+ apiUrl: r ?? ""
1707
+ };
1708
+ }
1709
+ //#endregion
1710
+ //#region src/fetchPage.js
1711
+ var Ye = async (e) => {
1712
+ let t = await e.json().catch(() => null);
1713
+ if (!e.ok || t?.success === !1) throw Error(t?.error?.message || `Request failed (${e.status})`);
1714
+ return t?.payload ?? t;
1715
+ };
1716
+ async function Xe({ apiUrl: e, tenant: t, slug: n, locale: r, preview: i, fetch: a }) {
1717
+ if (!e) throw Error("fetchPage: apiUrl is required");
1718
+ if (!n) throw Error("fetchPage: slug is required");
1719
+ 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(Ye), o(`${s}/settings/public`, { headers: c }).then(Ye)]);
1720
+ return Je({
1721
+ page: l,
1722
+ settings: u,
1723
+ tenant: t,
1724
+ apiUrl: s,
1725
+ locale: r
1726
+ });
1727
+ }
1728
+ //#endregion
1729
+ //#region src/ssr.jsx
1730
+ var $ = (e) => String(e ?? "").replace(/[&<>"]/g, (e) => ({
1731
+ "&": "&amp;",
1732
+ "<": "&lt;",
1733
+ ">": "&gt;",
1734
+ "\"": "&quot;"
1735
+ })[e]);
1736
+ function Ze(t, { mode: n = "auto", style: r } = {}) {
1737
+ return e(/* @__PURE__ */ s(qe, {
1738
+ bundle: t,
1739
+ mode: n,
1740
+ style: r
1741
+ }));
1742
+ }
1743
+ function Qe(e, { mode: t = "auto", lang: n = "en" } = {}) {
1744
+ let r = e.seo ?? {}, i = r.title || e.title || e.slug || "Page", a = e.custom?.js?.trim(), o = [
1745
+ "<meta charset=\"utf-8\"/>",
1746
+ "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\"/>",
1747
+ `<title>${$(i)}</title>`,
1748
+ r.description && `<meta name="description" content="${$(r.description)}"/>`,
1749
+ `<meta property="og:title" content="${$(i)}"/>`,
1750
+ r.image && `<meta property="og:image" content="${$(r.image)}"/>`,
1751
+ r.noindex && "<meta name=\"robots\" content=\"noindex\"/>",
1752
+ "<style>html,body{margin:0;height:100%}</style>"
1753
+ ].filter(Boolean).join("\n");
1754
+ return `<!doctype html>
1755
+ <html lang="${$(n)}">
1756
+ <head>
1757
+ ${o}
1758
+ </head>
1759
+ <body>
1760
+ ${Ze(e, { mode: t })}
1761
+ ${a ? `<script>${a.replaceAll("<\/script", "<\\/script")}<\/script>` : ""}
1762
+ </body>
1763
+ </html>`;
1764
+ }
1765
+ //#endregion
1766
+ export { Je as assembleBundle, Xe as fetchPage, Ze as renderBundleHtml, Qe as renderPageDocument };