@lumencast/runtime 0.6.0 → 0.7.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.
Files changed (113) hide show
  1. package/dist/.tsbuildinfo +1 -1
  2. package/dist/broadcast-DUYqvcgo.js +12 -0
  3. package/dist/broadcast-DUYqvcgo.js.map +1 -0
  4. package/dist/control-CL8TWXaE.js +17 -0
  5. package/dist/control-CL8TWXaE.js.map +1 -0
  6. package/dist/{index-Crkij3C4.js → index-C6viWFcT.js} +42 -26
  7. package/dist/index-C6viWFcT.js.map +1 -0
  8. package/dist/index.html +1 -1
  9. package/dist/lumencast.js +1 -1
  10. package/dist/modes/broadcast.d.ts.map +1 -1
  11. package/dist/modes/broadcast.js +6 -1
  12. package/dist/modes/broadcast.js.map +1 -1
  13. package/dist/modes/control.d.ts.map +1 -1
  14. package/dist/modes/control.js +6 -1
  15. package/dist/modes/control.js.map +1 -1
  16. package/dist/modes/test.d.ts.map +1 -1
  17. package/dist/modes/test.js +2 -1
  18. package/dist/modes/test.js.map +1 -1
  19. package/dist/render/allowed-hosts.d.ts +41 -0
  20. package/dist/render/allowed-hosts.d.ts.map +1 -0
  21. package/dist/render/allowed-hosts.js +88 -0
  22. package/dist/render/allowed-hosts.js.map +1 -0
  23. package/dist/render/blend-mode.d.ts +7 -0
  24. package/dist/render/blend-mode.d.ts.map +1 -0
  25. package/dist/render/blend-mode.js +49 -0
  26. package/dist/render/blend-mode.js.map +1 -0
  27. package/dist/render/bundle.d.ts +9 -1
  28. package/dist/render/bundle.d.ts.map +1 -1
  29. package/dist/render/bundle.js.map +1 -1
  30. package/dist/render/fill.d.ts +36 -3
  31. package/dist/render/fill.d.ts.map +1 -1
  32. package/dist/render/fill.js +222 -23
  33. package/dist/render/fill.js.map +1 -1
  34. package/dist/render/mask.d.ts +87 -0
  35. package/dist/render/mask.d.ts.map +1 -0
  36. package/dist/render/mask.js +243 -0
  37. package/dist/render/mask.js.map +1 -0
  38. package/dist/render/primitives/frame.d.ts.map +1 -1
  39. package/dist/render/primitives/frame.js +91 -5
  40. package/dist/render/primitives/frame.js.map +1 -1
  41. package/dist/render/primitives/grid.d.ts +1 -1
  42. package/dist/render/primitives/grid.d.ts.map +1 -1
  43. package/dist/render/primitives/grid.js +4 -1
  44. package/dist/render/primitives/grid.js.map +1 -1
  45. package/dist/render/primitives/image.d.ts +8 -1
  46. package/dist/render/primitives/image.d.ts.map +1 -1
  47. package/dist/render/primitives/image.js +17 -3
  48. package/dist/render/primitives/image.js.map +1 -1
  49. package/dist/render/primitives/index.d.ts +7 -0
  50. package/dist/render/primitives/index.d.ts.map +1 -1
  51. package/dist/render/primitives/index.js.map +1 -1
  52. package/dist/render/primitives/shape.d.ts.map +1 -1
  53. package/dist/render/primitives/shape.js +29 -26
  54. package/dist/render/primitives/shape.js.map +1 -1
  55. package/dist/render/primitives/stack.d.ts +1 -1
  56. package/dist/render/primitives/stack.d.ts.map +1 -1
  57. package/dist/render/primitives/stack.js +5 -1
  58. package/dist/render/primitives/stack.js.map +1 -1
  59. package/dist/render/primitives/text.d.ts.map +1 -1
  60. package/dist/render/primitives/text.js +0 -1
  61. package/dist/render/primitives/text.js.map +1 -1
  62. package/dist/render/prop-allowlist.d.ts.map +1 -1
  63. package/dist/render/prop-allowlist.js +25 -2
  64. package/dist/render/prop-allowlist.js.map +1 -1
  65. package/dist/render/shape-geometry.d.ts +81 -0
  66. package/dist/render/shape-geometry.d.ts.map +1 -0
  67. package/dist/render/shape-geometry.js +199 -0
  68. package/dist/render/shape-geometry.js.map +1 -0
  69. package/dist/render/shape-index.d.ts +28 -0
  70. package/dist/render/shape-index.d.ts.map +1 -0
  71. package/dist/render/shape-index.js +77 -0
  72. package/dist/render/shape-index.js.map +1 -0
  73. package/dist/render/tree.d.ts.map +1 -1
  74. package/dist/render/tree.js +175 -3
  75. package/dist/render/tree.js.map +1 -1
  76. package/dist/render/universal-wrapper.d.ts +27 -1
  77. package/dist/render/universal-wrapper.d.ts.map +1 -1
  78. package/dist/render/universal-wrapper.js +98 -22
  79. package/dist/render/universal-wrapper.js.map +1 -1
  80. package/dist/{status-pill-BT5b-yET.js → status-pill-jJT54n07.js} +2 -2
  81. package/dist/{status-pill-BT5b-yET.js.map → status-pill-jJT54n07.js.map} +1 -1
  82. package/dist/{test-_hh1JvAd.js → test-84XodL1c.js} +51 -51
  83. package/dist/{test-_hh1JvAd.js.map → test-84XodL1c.js.map} +1 -1
  84. package/dist/tree-BIimahCf.js +1777 -0
  85. package/dist/tree-BIimahCf.js.map +1 -0
  86. package/package.json +4 -4
  87. package/src/modes/broadcast.tsx +12 -1
  88. package/src/modes/control.tsx +10 -1
  89. package/src/modes/test.tsx +4 -1
  90. package/src/render/allowed-hosts.tsx +100 -0
  91. package/src/render/blend-mode.ts +50 -0
  92. package/src/render/bundle.ts +6 -1
  93. package/src/render/fill.tsx +266 -24
  94. package/src/render/mask.tsx +389 -0
  95. package/src/render/primitives/frame.tsx +101 -5
  96. package/src/render/primitives/grid.tsx +4 -1
  97. package/src/render/primitives/image.tsx +17 -3
  98. package/src/render/primitives/index.ts +7 -0
  99. package/src/render/primitives/shape.tsx +39 -75
  100. package/src/render/primitives/stack.tsx +5 -1
  101. package/src/render/primitives/text.tsx +0 -1
  102. package/src/render/prop-allowlist.ts +25 -2
  103. package/src/render/shape-geometry.tsx +315 -0
  104. package/src/render/shape-index.tsx +90 -0
  105. package/src/render/tree.tsx +214 -12
  106. package/src/render/universal-wrapper.tsx +128 -21
  107. package/dist/broadcast-DO7jEkix.js +0 -11
  108. package/dist/broadcast-DO7jEkix.js.map +0 -1
  109. package/dist/control-BSfl4_cO.js +0 -16
  110. package/dist/control-BSfl4_cO.js.map +0 -1
  111. package/dist/index-Crkij3C4.js.map +0 -1
  112. package/dist/tree-DBj9SJgs.js +0 -1230
  113. package/dist/tree-DBj9SJgs.js.map +0 -1
@@ -0,0 +1,1777 @@
1
+ import { jsx as f, jsxs as G, Fragment as J } from "react/jsx-runtime";
2
+ import { useSignals as wt } from "@preact/signals-react/runtime";
3
+ import { motion as I, useMotionValue as B, useTransform as pe, animate as At } from "framer-motion";
4
+ import { createContext as rt, useContext as K, useRef as mt, useEffect as qt, useState as he, useMemo as Gt } from "react";
5
+ import { e as S, r as it, m as ot, t as Q, s as ge, w as Yt, F as me, c as Ft, a as Xt } from "./index-C6viWFcT.js";
6
+ import { checkHostAllowed as It } from "@lumencast/protocol";
7
+ import { effect as ye } from "@preact/signals-react";
8
+ function be({ resolved: t, children: e, establishesContainingBlock: n }) {
9
+ const i = t.direction ?? "vertical", r = _t(t.gap, 0), s = t.wrap === !0, o = _t(t.crossGap, 0), a = t.align ?? "stretch", l = t.justify ?? "flex-start", c = i === "horizontal", u = {
10
+ display: "flex",
11
+ flexDirection: c ? "row" : "column",
12
+ alignItems: a,
13
+ justifyContent: l,
14
+ // ADR 002 §3.1 (D1) — establish a containing block when a child is
15
+ // absolutely placed, so its `left/top` resolve against this stack.
16
+ // Untouched for pure auto-layout stacks (RC#2).
17
+ ...n ? { position: "relative" } : {}
18
+ };
19
+ return s ? (u.flexWrap = "wrap", c ? (u.columnGap = r, u.rowGap = o) : (u.rowGap = r, u.columnGap = o)) : u.gap = r, /* @__PURE__ */ f("div", { style: u, children: e });
20
+ }
21
+ function _t(t, e) {
22
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
23
+ }
24
+ function ke({ resolved: t, children: e, establishesContainingBlock: n }) {
25
+ const i = t.cols ?? "1fr", r = t.rows ?? "auto", s = t.gap ?? 0;
26
+ return /* @__PURE__ */ f(
27
+ "div",
28
+ {
29
+ style: {
30
+ display: "grid",
31
+ gridTemplateColumns: i,
32
+ gridTemplateRows: r,
33
+ gap: s,
34
+ // ADR 002 §3.1 (D1) — establish a containing block for absolutely
35
+ // placed children ; untouched for pure auto-layout grids (RC#2).
36
+ ...n ? { position: "relative" } : {}
37
+ },
38
+ children: e
39
+ }
40
+ );
41
+ }
42
+ const we = 64, xe = /^[#a-zA-Z0-9(),.% ]{1,64}$/, $e = /^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/, W = String.raw`\d{1,3}(?:\.\d{1,4})?`, Kt = String.raw`(?:0|1|0?\.\d{1,4}|${W}%)`, R = String.raw`[ ]{0,4}`, ve = new RegExp(
43
+ `^rgba?\\(${R}(${W})(%?)${R},${R}(${W})(%?)${R},${R}(${W})(%?)${R}(?:,${R}${Kt}${R})?\\)$`
44
+ ), Se = new RegExp(
45
+ `^hsla?\\(${R}(${W})(?:deg)?${R},${R}(${W})%${R},${R}(${W})%${R}(?:,${R}${Kt}${R})?\\)$`
46
+ ), Me = new Set(
47
+ "aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen transparent currentcolor".split(" ")
48
+ );
49
+ function E(t) {
50
+ if (typeof t != "string") return null;
51
+ const e = t.trim();
52
+ if (e.length === 0 || e.length > we) return null;
53
+ const n = e.toLowerCase();
54
+ if (n.includes("url(") || e.includes(";") || e.includes("}") || !xe.test(e)) return null;
55
+ if (e.startsWith("#")) return $e.test(e) ? e : null;
56
+ if (n.startsWith("rgb")) {
57
+ const i = ve.exec(n);
58
+ if (!i) return null;
59
+ const r = [i[2], i[4], i[6]];
60
+ if (!(r.every((o) => o === "%") || r.every((o) => o === ""))) return null;
61
+ const s = r[0] === "%" ? 100 : 255;
62
+ for (const o of [i[1], i[3], i[5]])
63
+ if (Number(o) > s) return null;
64
+ return n;
65
+ }
66
+ if (n.startsWith("hsl")) {
67
+ const i = Se.exec(n);
68
+ return !i || Number(i[1]) > 360 || Number(i[2]) > 100 || Number(i[3]) > 100 ? null : n;
69
+ }
70
+ return Me.has(n) ? n : null;
71
+ }
72
+ function D(t, e) {
73
+ S(
74
+ e,
75
+ t,
76
+ "rejected unsafe colour : not a strict hex/rgb()/hsl()/named colour"
77
+ );
78
+ }
79
+ const Ut = rt(void 0);
80
+ function nr({
81
+ hosts: t,
82
+ children: e
83
+ }) {
84
+ return /* @__PURE__ */ f(Ut.Provider, { value: t, children: e });
85
+ }
86
+ function st() {
87
+ return K(Ut);
88
+ }
89
+ function rr(t) {
90
+ const n = t.assets?.allowedHosts;
91
+ if (!Array.isArray(n)) return;
92
+ const i = n.filter((r) => typeof r == "string");
93
+ return i.length > 0 ? i : void 0;
94
+ }
95
+ function Vt(t, e, n, i) {
96
+ if (typeof t != "string" || t.length === 0) return;
97
+ const r = It(t, e);
98
+ if (r.allowed) return t;
99
+ S(i, n, r.reason ?? "asset host/scheme rejected");
100
+ }
101
+ const Ae = /* @__PURE__ */ new Set([
102
+ "normal",
103
+ "multiply",
104
+ "screen",
105
+ "overlay",
106
+ "darken",
107
+ "lighten",
108
+ "color-dodge",
109
+ "color-burn",
110
+ "hard-light",
111
+ "soft-light",
112
+ "difference",
113
+ "exclusion",
114
+ "hue",
115
+ "saturation",
116
+ "color",
117
+ "luminosity",
118
+ // Figma LINEAR_DODGE (add) — exact additive blend, gentler than color-dodge.
119
+ "plus-lighter"
120
+ ]);
121
+ function Y(t) {
122
+ return typeof t == "string" && Ae.has(t) ? t : void 0;
123
+ }
124
+ const Fe = /* @__PURE__ */ new Set(["cover", "contain", "fill", "none", "scale-down"]);
125
+ function _e(t) {
126
+ return typeof t == "string" && Fe.has(t) ? t : void 0;
127
+ }
128
+ let ct = 0;
129
+ function Rt() {
130
+ return ct = (ct + 1) % 1e6, `lumen-grad-${ct.toString(36)}`;
131
+ }
132
+ function Re(t) {
133
+ const e = Y(t.blendMode);
134
+ if (t.kind === "solid") {
135
+ const a = t.opacity !== void 0 ? yt(t.color, t.opacity) : t.color;
136
+ return { defs: [], ref: a, mixBlendMode: e };
137
+ }
138
+ if (t.kind === "image") {
139
+ const a = Rt(), l = je(t.objectFit);
140
+ return { defs: [
141
+ /* @__PURE__ */ f("pattern", { id: a, patternContentUnits: "objectBoundingBox", width: "1", height: "1", children: /* @__PURE__ */ f("image", { href: t.src, width: "1", height: "1", preserveAspectRatio: l }) }, a)
142
+ ], ref: `url(#${a})`, mixBlendMode: e };
143
+ }
144
+ const n = Rt();
145
+ if (t.kind === "linear-gradient") {
146
+ let a, l, c, u;
147
+ const d = t.transform;
148
+ if (Array.isArray(d) && d.length === 6 && Number.isFinite(d[0]) && Number.isFinite(d[1])) {
149
+ const h = Math.hypot(d[0], d[1]) || 1, g = d[0] / h, A = d[1] / h;
150
+ a = 0.5 - 0.5 * g, l = 0.5 - 0.5 * A, c = 0.5 + 0.5 * g, u = 0.5 + 0.5 * A;
151
+ } else {
152
+ const g = ((t.angle_deg ?? 0) - 90) * Math.PI / 180;
153
+ a = 0.5 - 0.5 * Math.cos(g), l = 0.5 - 0.5 * Math.sin(g), c = 0.5 + 0.5 * Math.cos(g), u = 0.5 + 0.5 * Math.sin(g);
154
+ }
155
+ return { defs: [
156
+ /* @__PURE__ */ f(
157
+ "linearGradient",
158
+ {
159
+ id: n,
160
+ x1: `${a * 100}%`,
161
+ y1: `${l * 100}%`,
162
+ x2: `${c * 100}%`,
163
+ y2: `${u * 100}%`,
164
+ children: t.stops.map((h, g) => /* @__PURE__ */ f(
165
+ "stop",
166
+ {
167
+ offset: h.offset,
168
+ stopColor: h.color,
169
+ ...h.opacity !== void 0 ? { stopOpacity: h.opacity } : {}
170
+ },
171
+ g
172
+ ))
173
+ },
174
+ n
175
+ )
176
+ ], ref: `url(#${n})`, mixBlendMode: e };
177
+ }
178
+ const i = t.center?.x ?? 0.5, r = t.center?.y ?? 0.5, s = t.radius ?? 0.5;
179
+ return { defs: [
180
+ /* @__PURE__ */ f("radialGradient", { id: n, cx: `${i * 100}%`, cy: `${r * 100}%`, r: `${s * 100}%`, children: t.stops.map((a, l) => /* @__PURE__ */ f(
181
+ "stop",
182
+ {
183
+ offset: a.offset,
184
+ stopColor: a.color,
185
+ ...a.opacity !== void 0 ? { stopOpacity: a.opacity } : {}
186
+ },
187
+ l
188
+ )) }, n)
189
+ ], ref: `url(#${n})`, mixBlendMode: e };
190
+ }
191
+ function Te(t) {
192
+ switch (t) {
193
+ case "contain":
194
+ case "scale-down":
195
+ return "contain";
196
+ case "none":
197
+ return "auto";
198
+ case "fill":
199
+ return "100% 100%";
200
+ case "cover":
201
+ default:
202
+ return "cover";
203
+ }
204
+ }
205
+ function je(t) {
206
+ switch (t) {
207
+ case "contain":
208
+ case "scale-down":
209
+ return "xMidYMid meet";
210
+ case "fill":
211
+ return "none";
212
+ case "none":
213
+ return "xMidYMid meet";
214
+ case "cover":
215
+ default:
216
+ return "xMidYMid slice";
217
+ }
218
+ }
219
+ function Ne(t, e) {
220
+ const n = [], i = [];
221
+ for (const a of t) {
222
+ const l = Oe(a, e);
223
+ l && (i.push(l), n.push(a));
224
+ }
225
+ if (i.length === 0) return {};
226
+ const r = { backgroundImage: i.join(", ") }, s = n.map((a) => Y(a.blendMode) ?? "normal");
227
+ s.some((a) => a !== "normal") && (r.backgroundBlendMode = s.join(", "));
228
+ const o = t.find((a) => a.kind === "image");
229
+ return o && (r.backgroundSize = Te(o.objectFit), r.backgroundPosition = "center", r.backgroundRepeat = "no-repeat"), r;
230
+ }
231
+ function Ce(t) {
232
+ return `url("${t.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}")`;
233
+ }
234
+ function Oe(t, e) {
235
+ if (t.kind === "image")
236
+ return Ce(t.src);
237
+ if (t.kind === "solid") {
238
+ const o = E(t.color);
239
+ if (o === null)
240
+ return D("fill.color", e), null;
241
+ const a = t.opacity !== void 0 ? yt(o, t.opacity) : o;
242
+ return `linear-gradient(${a}, ${a})`;
243
+ }
244
+ const n = [];
245
+ for (const o of t.stops) {
246
+ const a = E(o.color);
247
+ if (a === null)
248
+ return D("fill.stops.color", e), null;
249
+ const l = o.opacity !== void 0 ? yt(a, o.opacity) : a;
250
+ n.push(`${l} ${(o.offset * 100).toFixed(2)}%`);
251
+ }
252
+ const i = n.join(", ");
253
+ if (t.kind === "linear-gradient") {
254
+ let o = t.angle_deg ?? 0;
255
+ const a = t.transform;
256
+ return Array.isArray(a) && a.length === 6 && Number.isFinite(a[0]) && Number.isFinite(a[1]) && (o = (Math.atan2(a[0], -a[1]) * 180 / Math.PI + 360) % 360), `linear-gradient(${o}deg, ${i})`;
257
+ }
258
+ const r = (t.center?.x ?? 0.5) * 100, s = (t.center?.y ?? 0.5) * 100;
259
+ return `radial-gradient(circle at ${r}% ${s}%, ${i})`;
260
+ }
261
+ function yt(t, e) {
262
+ const n = t.match(/^#([0-9a-f]{6})$/i);
263
+ if (n) {
264
+ const i = Math.round(e * 255).toString(16).padStart(2, "0");
265
+ return `#${n[1]}${i}`;
266
+ }
267
+ return `color-mix(in srgb, ${t} ${e * 100}%, transparent)`;
268
+ }
269
+ function Pe(t, e, n) {
270
+ const i = [];
271
+ for (const r of t) {
272
+ if (r.kind === "image") {
273
+ i.push(r);
274
+ continue;
275
+ }
276
+ if (r.kind === "solid") {
277
+ const a = E(r.color);
278
+ if (a === null) {
279
+ D(`${e}.color`, n);
280
+ continue;
281
+ }
282
+ i.push({ ...r, color: a });
283
+ continue;
284
+ }
285
+ const s = [];
286
+ let o = !1;
287
+ for (const a of r.stops ?? []) {
288
+ const l = E(a.color);
289
+ if (l === null) {
290
+ D(`${e}.stops.color`, n), o = !0;
291
+ break;
292
+ }
293
+ s.push({ ...a, color: l });
294
+ }
295
+ o || i.push({ ...r, stops: s });
296
+ }
297
+ return i;
298
+ }
299
+ function Zt(t, e, n) {
300
+ if (!Array.isArray(t)) return [];
301
+ if (e !== void 0)
302
+ for (const i of t)
303
+ Tt(i) || S(
304
+ n,
305
+ `${e}.kind`,
306
+ "fill kind is not renderable by this runtime ; layer dropped (angular/diamond gradients land with LSML 1.2)"
307
+ );
308
+ return t.filter(Tt).map((i) => {
309
+ let r = i;
310
+ if (r.blendMode !== void 0 && Y(r.blendMode) === void 0) {
311
+ S(
312
+ n,
313
+ e !== void 0 ? `${e}.blendMode` : "fill.blendMode",
314
+ "is not a recognised mix-blend-mode ; falling back to normal (ADR 002 §3.2)"
315
+ );
316
+ const { blendMode: o, ...a } = r;
317
+ r = a;
318
+ }
319
+ if (r.kind !== "image" || r.objectFit === void 0) return r;
320
+ const s = _e(r.objectFit);
321
+ if (s === void 0) {
322
+ S(
323
+ n,
324
+ e !== void 0 ? `${e}.objectFit` : "fill.objectFit",
325
+ "is not a recognised object-fit ; falling back to default (ADR 002 §3.2)"
326
+ );
327
+ const { objectFit: o, ...a } = r;
328
+ return a;
329
+ }
330
+ return { ...r, objectFit: s };
331
+ });
332
+ }
333
+ function Tt(t) {
334
+ if (typeof t != "object" || t === null) return !1;
335
+ const e = t.kind;
336
+ return e === "solid" || e === "linear-gradient" || e === "radial-gradient" ? !0 : e === "image" && typeof t.src == "string";
337
+ }
338
+ function Jt(t, e, n, i) {
339
+ return t.filter((r) => r.kind !== "image" ? !0 : Vt(r.src, e, `${n}.src`, i) !== void 0);
340
+ }
341
+ function Ee({
342
+ resolved: t,
343
+ nodeId: e,
344
+ transitionFor: n,
345
+ animateInitial: i,
346
+ children: r
347
+ }) {
348
+ const s = N(t.x, 0), o = N(t.y, 0), a = jt(t.width), l = jt(t.height), c = N(t.opacity, 1), u = N(t.scale, 1), d = N(t.rotate, N(t.rotation, 0)), m = t.flipY === !0, h = N(t.radius, 0), g = t.background, A = g === void 0 ? void 0 : E(g);
349
+ g !== void 0 && A === null && D("frame.background", e);
350
+ const x = st(), F = Jt(
351
+ Zt(t.backgrounds, "frame.backgrounds", e),
352
+ x,
353
+ "frame.backgrounds",
354
+ e
355
+ ), k = De(t.clipsContent, e), y = it(
356
+ n,
357
+ ["opacity", "scale", "rotate", "x", "y"],
358
+ i
359
+ ), p = {
360
+ position: "absolute",
361
+ left: 0,
362
+ top: 0,
363
+ width: a,
364
+ height: l,
365
+ // NB: NO permanent `will-change`. `will-change: opacity` makes the frame an
366
+ // isolated group (the browser pre-promotes it as if opacity < 1), which
367
+ // CONTAINS any descendant `mix-blend-mode` to the frame's own backdrop — so
368
+ // a screen/hard-light layer (Sunshine, Ruby20) silently stops compositing
369
+ // with the scene below. The hint also belongs only on actively-animating
370
+ // nodes (bind-animate adds it there) ; a static board doesn't need it.
371
+ // LSML 1.1 §4.3 `clipsContent` (default `true`) — children outside
372
+ // the frame's `size` are clipped. Static layout property : it never
373
+ // animates, so it stays off the 0-layout-event hot path (ADR 001
374
+ // §3.2.5). `false` => omit the declaration (CSS initial = visible).
375
+ ...k ? { overflow: "hidden" } : {},
376
+ ...h > 0 ? { borderRadius: h } : {}
377
+ };
378
+ F.length > 0 ? Object.assign(p, Ne(F, e)) : A != null && (p.background = A);
379
+ const { filter: w, boxShadow: $ } = Be(t.shadow, e);
380
+ $ !== void 0 && (p.boxShadow = $), w !== void 0 && (p.filter = w);
381
+ const v = ot(
382
+ { opacity: c, x: s, y: o, scale: u, rotate: d, ...m ? { scaleY: -1 } : {} },
383
+ i,
384
+ e
385
+ );
386
+ return /* @__PURE__ */ f(
387
+ I.div,
388
+ {
389
+ style: p,
390
+ initial: v.initial,
391
+ animate: v.animate,
392
+ transition: Q(y),
393
+ children: r
394
+ }
395
+ );
396
+ }
397
+ function De(t, e) {
398
+ return t === void 0 ? !0 : typeof t == "boolean" ? t : (S(e, "frame.clipsContent", "rejected value : not a boolean"), !0);
399
+ }
400
+ function N(t, e) {
401
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
402
+ }
403
+ function Be(t, e) {
404
+ if (!Array.isArray(t) || t.length === 0) return {};
405
+ const n = [], i = [];
406
+ for (const s of t) {
407
+ if (typeof s != "object" || s === null) continue;
408
+ const o = s, a = typeof o.color == "string" ? E(o.color) : null;
409
+ if (a === null) {
410
+ D("frame.shadow.color", e);
411
+ continue;
412
+ }
413
+ const l = N(o.x, 0), c = N(o.y, 0), u = N(o.blur, 0), d = N(o.spread, 0), m = o.inset === !0;
414
+ if (!m && d === 0)
415
+ n.push(`drop-shadow(${l}px ${c}px ${u / 2}px ${a})`);
416
+ else {
417
+ const h = m ? "inset " : "";
418
+ i.push(`${h}${l}px ${c}px ${u}px ${d}px ${a}`);
419
+ }
420
+ }
421
+ const r = {};
422
+ return n.length > 0 && (r.filter = n.join(" ")), i.length > 0 && (r.boxShadow = i.join(", ")), r;
423
+ }
424
+ function jt(t) {
425
+ if (typeof t == "number" && Number.isFinite(t) || typeof t == "string" && t.length > 0) return t;
426
+ }
427
+ const Le = /* @__PURE__ */ new Set(["none", "uppercase", "lowercase", "capitalize"]), He = /* @__PURE__ */ new Set(["none", "underline", "line-through"]), ze = /* @__PURE__ */ new Set(["normal", "italic", "oblique"]), We = 1e3, qe = 100, Nt = 1e3, Ge = /^[a-zA-Z0-9 ,.'"_-]{1,256}$/;
428
+ function Ye(t) {
429
+ if (typeof t != "string") return null;
430
+ const e = t.trim();
431
+ return e.length === 0 ? null : Ge.test(e) ? e : null;
432
+ }
433
+ function Xe({ resolved: t, nodeId: e, transitionFor: n, animateInitial: i }) {
434
+ const r = t.value === void 0 ? "" : String(t.value), s = t.size ?? "1rem", o = t.weight ?? 400;
435
+ let a;
436
+ if (t.font !== void 0) {
437
+ const g = Ye(t.font);
438
+ g === null ? S(e, "text.font", "rejected fontFamily : outside the family-list grammar") : a = g;
439
+ }
440
+ let l = "currentColor";
441
+ if (t.colour !== void 0) {
442
+ const g = E(t.colour);
443
+ g === null ? D("text.colour", e) : l = g;
444
+ }
445
+ const c = t.align ?? "start", u = Ie(t.opacity, 1), d = Ke(t, e), m = it(n, ["opacity", "value"], i), h = ot({ opacity: u }, i, e);
446
+ return /* @__PURE__ */ f(
447
+ I.span,
448
+ {
449
+ style: {
450
+ display: "inline-block",
451
+ fontSize: s,
452
+ // `font` carries LSML text.style.fontFamily (spec'd in schema.json).
453
+ // Omitted => inherit the host/container font.
454
+ ...a !== void 0 ? { fontFamily: a } : {},
455
+ fontWeight: o,
456
+ color: l,
457
+ textAlign: c,
458
+ ...d
459
+ },
460
+ initial: h.initial,
461
+ animate: h.animate,
462
+ transition: Q(m),
463
+ children: r
464
+ }
465
+ );
466
+ }
467
+ function Ie(t, e) {
468
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
469
+ }
470
+ function Ke(t, e) {
471
+ const n = Ct(
472
+ t.lineHeight,
473
+ 0,
474
+ qe,
475
+ "text.lineHeight",
476
+ e
477
+ ), i = Ct(
478
+ t.letterSpacing,
479
+ -Nt,
480
+ Nt,
481
+ "text.letterSpacing",
482
+ e
483
+ ), r = ut(
484
+ t.textTransform,
485
+ Le,
486
+ "text.textTransform",
487
+ e
488
+ ), s = ut(
489
+ t.textDecoration,
490
+ He,
491
+ "text.textDecoration",
492
+ e
493
+ ), o = ut(t.fontStyle, ze, "text.fontStyle", e), a = Ue(t.maxLines, We, "text.maxLines", e);
494
+ return {
495
+ ...n !== void 0 ? { lineHeight: n } : {},
496
+ // Built from a validated finite number — no string passthrough.
497
+ ...i !== void 0 ? { letterSpacing: `${i}px` } : {},
498
+ ...r !== void 0 ? { textTransform: r } : {},
499
+ ...s !== void 0 ? { textDecoration: s } : {},
500
+ ...o !== void 0 ? { fontStyle: o } : {},
501
+ ...a !== void 0 ? {
502
+ display: "-webkit-box",
503
+ WebkitBoxOrient: "vertical",
504
+ WebkitLineClamp: a,
505
+ overflow: "hidden",
506
+ textOverflow: "ellipsis"
507
+ } : {}
508
+ };
509
+ }
510
+ function ut(t, e, n, i) {
511
+ if (t !== void 0) {
512
+ if (typeof t == "string" && e.has(t)) return t;
513
+ xt(n, i);
514
+ }
515
+ }
516
+ function Ct(t, e, n, i, r) {
517
+ if (t !== void 0) {
518
+ if (typeof t == "number" && Number.isFinite(t) && t >= e && t <= n) return t;
519
+ xt(i, r);
520
+ }
521
+ }
522
+ function Ue(t, e, n, i) {
523
+ if (t !== void 0) {
524
+ if (typeof t == "number" && Number.isInteger(t) && t >= 1 && t <= e) return t;
525
+ xt(n, i);
526
+ }
527
+ }
528
+ function xt(t, e) {
529
+ S(
530
+ e,
531
+ t,
532
+ "rejected typography value : outside the field's spec'd grammar or caps"
533
+ );
534
+ }
535
+ function Ve({ resolved: t, nodeId: e, transitionFor: n, animateInitial: i }) {
536
+ const r = st(), s = Vt(t.src, r, "image.src", e);
537
+ if (!s) return null;
538
+ const o = typeof t.alt == "string" ? t.alt : "", a = t.fit ?? "contain", l = t.position ?? "center", c = Ze(t.opacity, 1), u = Ot(t.width, "100%"), d = Ot(t.height, "100%"), m = it(n, ["opacity", "src"], i), h = ot({ opacity: c }, i, e);
539
+ return /* @__PURE__ */ f(
540
+ I.img,
541
+ {
542
+ src: s,
543
+ alt: o,
544
+ style: {
545
+ objectFit: a,
546
+ objectPosition: l,
547
+ width: u,
548
+ height: d
549
+ // NB: NO `will-change` here. Promoting the <img> to its own GPU layer
550
+ // hoists it out of the wrapper's paint buffer, so a `mix-blend-mode`
551
+ // on the wrapper (Sunshine screen, Ruby20 / caramel hard-light) blends
552
+ // an EMPTY box with the backdrop → the blend silently no-ops and the
553
+ // image's contribution (the diagonal light streaks, the warm Ruby) is
554
+ // lost. Static images don't need the compositor hint anyway.
555
+ },
556
+ initial: h.initial,
557
+ animate: h.animate,
558
+ transition: Q(m),
559
+ draggable: !1
560
+ }
561
+ );
562
+ }
563
+ function Ze(t, e) {
564
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
565
+ }
566
+ function Ot(t, e) {
567
+ return typeof t == "number" && Number.isFinite(t) ? `${t}px` : typeof t == "string" && t.length > 0 ? t : e;
568
+ }
569
+ const Je = 8192, Qe = 4e3, tn = 64, en = new Set("MmLlHhVvCcSsQqTtAaZz");
570
+ function ft(t) {
571
+ return t >= 48 && t <= 57;
572
+ }
573
+ function nn(t) {
574
+ return t === 32 || t === 9 || t === 13 || t === 10 || t === 44;
575
+ }
576
+ function Pt(t) {
577
+ if (typeof t != "string" || t.length === 0 || t.length > Je) return null;
578
+ const e = t.trim();
579
+ if (e.length === 0) return null;
580
+ const n = e.toLowerCase();
581
+ if (n.includes("url(") || n.includes("data:") || e.includes("<") || e.includes("&")) return null;
582
+ const i = e.length;
583
+ let r = 0, s = 0, o = !1;
584
+ for (; r < i; ) {
585
+ const a = e.charCodeAt(r);
586
+ if (nn(a)) {
587
+ r++;
588
+ continue;
589
+ }
590
+ const l = e[r];
591
+ if (en.has(l)) {
592
+ if (!o && l !== "M" && l !== "m" || (o = !0, s++, s > Qe)) return null;
593
+ r++;
594
+ continue;
595
+ }
596
+ if (!o) return null;
597
+ (l === "+" || l === "-") && r++;
598
+ let c = 0;
599
+ for (; r < i && ft(e.charCodeAt(r)); )
600
+ r++, c++;
601
+ if (r < i && e[r] === ".") {
602
+ r++;
603
+ let u = 0;
604
+ for (; r < i && ft(e.charCodeAt(r)); )
605
+ r++, u++;
606
+ if (u === 0 && r < i && e[r] === ".") return null;
607
+ c += u;
608
+ }
609
+ if (c === 0) return null;
610
+ if (r < i && (e[r] === "e" || e[r] === "E")) {
611
+ r++, r < i && (e[r] === "+" || e[r] === "-") && r++;
612
+ let u = 0;
613
+ for (; r < i && ft(e.charCodeAt(r)); )
614
+ r++, u++;
615
+ if (u === 0) return null;
616
+ }
617
+ }
618
+ return s === 0 ? null : e;
619
+ }
620
+ function rn(t, e) {
621
+ const n = t.paths, i = t.pathData;
622
+ if (Array.isArray(n)) {
623
+ i !== void 0 && z(e, "shape.pathData", "mutually exclusive with paths[] ; paths[] wins");
624
+ const r = [];
625
+ for (let s = 0; s < n.length; s++) {
626
+ if (r.length >= tn) {
627
+ z(e, "shape.paths", "subpath cap exceeded ; remaining entries dropped");
628
+ break;
629
+ }
630
+ const o = n[s], a = Pt(
631
+ typeof o == "object" && o !== null ? o.data : void 0
632
+ );
633
+ if (a === null) {
634
+ z(e, "shape.paths.data", "not a strict SVG path grammar (allowlist/caps)");
635
+ continue;
636
+ }
637
+ r.push({ d: a, fillRule: on(o?.windingRule, e) });
638
+ }
639
+ return r.length === 0 && n.length > 0 && z(e, "shape.paths", "no renderable subpath ; shape geometry omitted"), r;
640
+ }
641
+ if (i !== void 0) {
642
+ const r = Pt(i);
643
+ return r === null ? (z(e, "shape.pathData", "not a strict SVG path grammar (allowlist/caps)"), []) : [{ d: r, fillRule: "nonzero" }];
644
+ }
645
+ return z(e, "shape.paths", "geometry is path but neither pathData nor paths[] is present"), [];
646
+ }
647
+ function on(t, e) {
648
+ return t === void 0 || t === "NONZERO" ? "nonzero" : t === "EVENODD" ? "evenodd" : (z(e, "shape.paths.windingRule", "unknown winding rule ; defaulting to nonzero"), "nonzero");
649
+ }
650
+ function z(t, e, n) {
651
+ S(t, e, n);
652
+ }
653
+ function sn(t) {
654
+ return t.geometry ?? t.kind ?? "rect";
655
+ }
656
+ function dt(t, e) {
657
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
658
+ }
659
+ function $t(t, e, n, i = "geom") {
660
+ const r = sn(t), s = dt(t.width, 100), o = dt(t.height, 100), a = dt(t.radius, 0), l = e.stroke ?? "none", c = e.strokeWidth ?? 0, u = e.mixBlendMode !== void 0 ? { mixBlendMode: e.mixBlendMode } : void 0;
661
+ if (r === "path") {
662
+ const d = rn(t, n);
663
+ return /* @__PURE__ */ f("g", { style: u, children: d.map((m, h) => /* @__PURE__ */ f(
664
+ "path",
665
+ {
666
+ d: m.d,
667
+ fillRule: m.fillRule,
668
+ fill: e.fill,
669
+ stroke: l,
670
+ strokeWidth: c
671
+ },
672
+ h
673
+ )) }, i);
674
+ }
675
+ return r === "circle" ? /* @__PURE__ */ f(
676
+ "ellipse",
677
+ {
678
+ style: u,
679
+ cx: s / 2,
680
+ cy: o / 2,
681
+ rx: Math.max(0, s / 2 - c / 2),
682
+ ry: Math.max(0, o / 2 - c / 2),
683
+ fill: e.fill,
684
+ stroke: l,
685
+ strokeWidth: c
686
+ },
687
+ i
688
+ ) : r === "line" ? /* @__PURE__ */ f(
689
+ "line",
690
+ {
691
+ style: u,
692
+ x1: "0",
693
+ y1: o / 2,
694
+ x2: s,
695
+ y2: o / 2,
696
+ stroke: l !== "none" ? l : e.fill,
697
+ strokeWidth: c || 1
698
+ },
699
+ i
700
+ ) : /* @__PURE__ */ f(
701
+ "rect",
702
+ {
703
+ style: u,
704
+ x: c / 2,
705
+ y: c / 2,
706
+ width: Math.max(0, s - c),
707
+ height: Math.max(0, o - c),
708
+ rx: a,
709
+ ry: a,
710
+ fill: e.fill,
711
+ stroke: l,
712
+ strokeWidth: c
713
+ },
714
+ i
715
+ );
716
+ }
717
+ function an(t, e) {
718
+ if (t.kind !== "shape") return null;
719
+ const n = t.props ?? {};
720
+ return $t(n, { fill: "white" }, e, "mask-cover");
721
+ }
722
+ const ln = 64, Qt = 1;
723
+ function te(t) {
724
+ return t.props?.visible === !1;
725
+ }
726
+ function nt(t, e) {
727
+ const n = t?.[e];
728
+ return typeof n == "number" && Number.isFinite(n) ? n : 0;
729
+ }
730
+ function cn(t, e, n = Qt, i = ln) {
731
+ if (t.kind !== "frame") return null;
732
+ const r = ne(t, e, n, i, "grp");
733
+ return r.length === 0 ? null : /* @__PURE__ */ f("g", { children: r }, "mask-group-cover");
734
+ }
735
+ function ee(t, e = Qt) {
736
+ if (t.kind !== "frame") return !1;
737
+ for (const n of t.children ?? [])
738
+ if (!te(n) && (nt(n.props, "blur") > 0 || n.kind === "frame" && e > 0 && ee(n, e - 1)))
739
+ return !0;
740
+ return !1;
741
+ }
742
+ function ne(t, e, n, i, r) {
743
+ const s = t.children ?? [], o = [];
744
+ let a = 0;
745
+ for (let l = 0; l < s.length; l++) {
746
+ const c = s[l];
747
+ if (te(c)) continue;
748
+ if (a >= i) {
749
+ S(
750
+ e,
751
+ "mask.source.ref",
752
+ `group mask exceeds the ${i}-child composite cap ; remainder truncated (ADR 002 A4.4 T5)`
753
+ );
754
+ break;
755
+ }
756
+ let u = null;
757
+ if (c.kind === "shape")
758
+ u = $t(c.props ?? {}, { fill: "white" }, c.id, `${r}-${l}`);
759
+ else if (c.kind === "frame" && n > 0) {
760
+ const g = ne(c, e, n - 1, i, `${r}-${l}`);
761
+ g.length > 0 && (u = /* @__PURE__ */ f("g", { children: g }, `${r}-${l}`));
762
+ }
763
+ if (u === null) continue;
764
+ const d = nt(c.props, "blur");
765
+ if (d > 0) {
766
+ const g = `lumen-mcov-blur-${e ?? "x"}-${r}-${l}`;
767
+ u = /* @__PURE__ */ G("g", { children: [
768
+ /* @__PURE__ */ f("filter", { id: g, x: "-120%", y: "-120%", width: "340%", height: "340%", children: /* @__PURE__ */ f("feGaussianBlur", { stdDeviation: d / 2 }) }),
769
+ /* @__PURE__ */ f("g", { filter: `url(#${g})`, children: u })
770
+ ] }, `${r}-b-${l}`);
771
+ }
772
+ const m = nt(c.props, "x"), h = nt(c.props, "y");
773
+ o.push(
774
+ m !== 0 || h !== 0 ? /* @__PURE__ */ f("g", { transform: `translate(${m} ${h})`, children: u }, `${r}-t-${l}`) : u
775
+ ), a++;
776
+ }
777
+ return o;
778
+ }
779
+ function un({ resolved: t, nodeId: e, transitionFor: n, animateInitial: i }) {
780
+ const r = t.geometry ?? t.kind ?? "rect", s = pt(t.fill, "shape.fill", e) ?? "transparent", o = pt(t.stroke, "shape.stroke", e) ?? "transparent", a = tt(t.stroke_width, 0), l = tt(t.width, 100), c = tt(t.height, 100), u = tt(t.opacity, 1), d = typeof t.ariaLabel == "string" ? t.ariaLabel : void 0, m = it(n, ["opacity"], i), h = Q(m), g = ot({ opacity: u }, i, e), A = st(), x = Jt(
781
+ Pe(Zt(t.fills, "shape.fills", e), "shape.fills", e),
782
+ A,
783
+ "shape.fills",
784
+ e
785
+ ), F = fn(t.strokes), k = x.map(Re), y = k.flatMap((_) => _.defs), p = k.length > 0 ? k.map((_) => ({ ref: _.ref, mixBlendMode: _.mixBlendMode })) : [{ ref: s }], w = F.length > 0 ? F.map((_) => ({
786
+ color: pt(_.color, "shape.strokes.color", e) ?? "transparent",
787
+ width: _.width ?? 0
788
+ })) : [{ color: o, width: a }], $ = [...p].reverse(), v = [...w].reverse(), T = r === "path" ? v.filter((_) => _.width > 0 && _.color !== "transparent") : v, U = (_, b, C, O) => $t(
789
+ t,
790
+ { fill: _, stroke: b.color, strokeWidth: b.width, mixBlendMode: O },
791
+ e,
792
+ C
793
+ );
794
+ return /* @__PURE__ */ G(
795
+ I.svg,
796
+ {
797
+ width: l,
798
+ height: c,
799
+ viewBox: `0 0 ${l} ${c}`,
800
+ ...d !== void 0 ? { "aria-label": d, role: "img" } : {},
801
+ initial: g.initial,
802
+ animate: g.animate,
803
+ transition: h,
804
+ children: [
805
+ y.length > 0 && /* @__PURE__ */ f("defs", { children: y }),
806
+ $.map(
807
+ (_, b) => U(_.ref, { color: "transparent", width: 0 }, `fill-${b}`, _.mixBlendMode)
808
+ ),
809
+ T.map((_, b) => U("none", _, `stroke-${b}`))
810
+ ]
811
+ }
812
+ );
813
+ }
814
+ function pt(t, e, n) {
815
+ if (typeof t != "string") return null;
816
+ const i = E(t);
817
+ return i === null && D(e, n), i;
818
+ }
819
+ function fn(t) {
820
+ return Array.isArray(t) ? t.filter(
821
+ (e) => typeof e == "object" && e !== null && ("color" in e || "width" in e)
822
+ ) : [];
823
+ }
824
+ function tt(t, e) {
825
+ return typeof t == "number" && Number.isFinite(t) ? t : e;
826
+ }
827
+ function dn({ resolved: t }) {
828
+ const e = t.src;
829
+ if (!e) return null;
830
+ const n = t.loop ?? !0, i = t.mute ?? !0, r = t.autoplay ?? !0, s = t.fit ?? "cover";
831
+ return /* @__PURE__ */ f(
832
+ "video",
833
+ {
834
+ src: e,
835
+ autoPlay: r,
836
+ loop: n,
837
+ muted: i,
838
+ playsInline: !0,
839
+ style: {
840
+ width: "100%",
841
+ height: "100%",
842
+ objectFit: s
843
+ }
844
+ }
845
+ );
846
+ }
847
+ const Et = /* @__PURE__ */ new Set();
848
+ function pn({ resolved: t, nodeId: e }) {
849
+ const n = t.scene_id, i = t.scene_version;
850
+ if (!n || !i)
851
+ return S(e, "instance.scene_id", "missing scene_id or scene_version ; not rendered"), null;
852
+ const r = `${n}:${i}`;
853
+ Et.has(r) || (Et.add(r), S(
854
+ e,
855
+ "instance",
856
+ "scaffold render — async bundle fetch + __params.* injection are not yet wired (LSML 1.1 §4.9)"
857
+ ));
858
+ const s = t.size, o = t.position;
859
+ return /* @__PURE__ */ f(
860
+ "div",
861
+ {
862
+ "data-lumencast-instance": n,
863
+ "data-lumencast-version": i,
864
+ style: {
865
+ position: o ? "absolute" : "relative",
866
+ left: o?.x,
867
+ top: o?.y,
868
+ width: s?.w,
869
+ height: s?.h,
870
+ outline: "none",
871
+ boxSizing: "border-box"
872
+ }
873
+ }
874
+ );
875
+ }
876
+ const hn = {
877
+ stack: be,
878
+ grid: ke,
879
+ frame: Ee,
880
+ text: Xe,
881
+ image: Ve,
882
+ shape: un,
883
+ media: dn,
884
+ instance: pn
885
+ }, bt = rt("");
886
+ function gn({ prefix: t, children: e }) {
887
+ const n = K(bt), i = n ? `${n}.${t}` : t;
888
+ return /* @__PURE__ */ f(bt.Provider, { value: i, children: e });
889
+ }
890
+ function vt() {
891
+ return K(bt);
892
+ }
893
+ function q(t, e) {
894
+ return !t || e.startsWith("__") ? e : `${t}.${e}`;
895
+ }
896
+ function Dt(t) {
897
+ switch (t) {
898
+ case "fixed":
899
+ return "0 0 auto";
900
+ case "hug":
901
+ return "0 1 auto";
902
+ case "fill":
903
+ return "1 1 auto";
904
+ default:
905
+ return;
906
+ }
907
+ }
908
+ function mn(t) {
909
+ const e = Dt(t?.x), n = Dt(t?.y);
910
+ return e === n && e !== void 0 ? e : e ?? n;
911
+ }
912
+ function yn({
913
+ visible: t,
914
+ opacity: e,
915
+ rotation: n,
916
+ flipY: i,
917
+ blur: r,
918
+ sizing: s,
919
+ position: o,
920
+ size: a,
921
+ blendMode: l,
922
+ children: c
923
+ }) {
924
+ if (t === !1)
925
+ return null;
926
+ const u = Y(l), d = typeof e == "number" && e !== 1, m = typeof n == "number" && n !== 0, h = i === !0, g = typeof r == "number" && r > 0, A = s?.x !== void 0 || s?.y !== void 0, x = o !== void 0, F = u !== void 0;
927
+ if (!d && !m && !h && !g && !A && !x && !F)
928
+ return /* @__PURE__ */ f(J, { children: c });
929
+ let k;
930
+ if (m || h) {
931
+ const $ = [];
932
+ m && $.push(`rotate(${n}deg)`), h && $.push("scaleY(-1)"), k = $.join(" ");
933
+ }
934
+ const y = g ? `blur(${r / 2}px)` : void 0, p = A ? mn(s) : void 0;
935
+ if (F && (d || k !== void 0 || y !== void 0)) {
936
+ const $ = { mixBlendMode: u };
937
+ x && ($.position = "absolute", $.left = o.x, $.top = o.y), p !== void 0 && ($.flex = p);
938
+ const v = {};
939
+ return typeof a?.w == "number" && (v.width = a.w), typeof a?.h == "number" && (v.height = a.h), d && (v.opacity = e), k !== void 0 && (v.transform = k), y !== void 0 && (v.filter = y), /* @__PURE__ */ f("div", { style: $, children: /* @__PURE__ */ f("div", { style: v, children: c }) });
940
+ }
941
+ const w = {};
942
+ return d && (w.opacity = e), k !== void 0 && (w.transform = k), y !== void 0 && (w.filter = y), F && (w.mixBlendMode = u), x && (w.position = "absolute", w.left = o.x, w.top = o.y, typeof a?.w == "number" && (w.width = a.w), typeof a?.h == "number" && (w.height = a.h)), p !== void 0 && (w.flex = p), /* @__PURE__ */ f("div", { style: w, children: c });
943
+ }
944
+ const bn = {
945
+ linear: "linear",
946
+ "ease-in": "easeIn",
947
+ "ease-out": "easeOut",
948
+ "ease-in-out": "easeInOut"
949
+ };
950
+ function kn(t, e) {
951
+ const n = t.steps;
952
+ if (!Array.isArray(n) || n.length < 2) return;
953
+ const i = n[0], r = n[n.length - 1];
954
+ if (i.at !== 0 || r.at !== 1) return;
955
+ const s = n.map((a) => a.at), o = {};
956
+ return Bt(n, "opacity", o, e), Bt(n, "filter", o, e), et(n, "scale", o), et(n, "translateX", o), et(n, "translateY", o), et(n, "rotate", o), {
957
+ animate: o,
958
+ transition: {
959
+ duration: t.duration_ms / 1e3,
960
+ ease: bn[t.easing ?? "linear"],
961
+ times: s
962
+ }
963
+ };
964
+ }
965
+ function Bt(t, e, n, i) {
966
+ let r = !1;
967
+ const s = [];
968
+ let o;
969
+ for (const a of t) {
970
+ let l = a[e];
971
+ if (e === "filter" && l !== void 0) {
972
+ const c = ge(l);
973
+ c === null ? (Yt("keyframes.steps[].filter", i), l = void 0) : l = c;
974
+ }
975
+ l !== void 0 ? (r = !0, o = l, s.push(l)) : s.push(o ?? (e === "opacity" ? 1 : me));
976
+ }
977
+ r && (n[e] = s);
978
+ }
979
+ function et(t, e, n) {
980
+ let i = !1;
981
+ const r = [];
982
+ let s;
983
+ for (const o of t) {
984
+ const a = o.transform?.[e];
985
+ typeof a == "number" ? (i = !0, s = a, r.push(a)) : r.push(s ?? wn(e));
986
+ }
987
+ i && (e === "rotate" ? n.rotate = r.map((o) => `${o}deg`) : n[e] = r);
988
+ }
989
+ function wn(t) {
990
+ return t === "scale" ? 1 : 0;
991
+ }
992
+ const St = rt(0), Lt = 2e3;
993
+ function xn(t, e) {
994
+ if (e <= 0) return 0;
995
+ const n = t * e;
996
+ return n > Lt ? Lt : n;
997
+ }
998
+ function $n({
999
+ keyframes: t,
1000
+ store: e,
1001
+ nodeId: n,
1002
+ children: i
1003
+ }) {
1004
+ wt();
1005
+ const r = vt(), s = K(St), o = mt(void 0), a = mt(0);
1006
+ if (t.key !== void 0) {
1007
+ const u = e.signal(q(r, t.key)).value;
1008
+ o.current !== u && (o.current = u, a.current += 1);
1009
+ }
1010
+ const l = kn(t, n);
1011
+ if (!l)
1012
+ return /* @__PURE__ */ f(J, { children: i });
1013
+ const c = s > 0 ? { ...l.transition, delay: s / 1e3 } : l.transition;
1014
+ return /* @__PURE__ */ G(
1015
+ I.div,
1016
+ {
1017
+ style: { display: "contents" },
1018
+ initial: Sn(l.animate),
1019
+ animate: l.animate,
1020
+ transition: c,
1021
+ children: [
1022
+ /* @__PURE__ */ f(vn, {}),
1023
+ i
1024
+ ]
1025
+ },
1026
+ a.current
1027
+ );
1028
+ }
1029
+ function vn() {
1030
+ return qt(() => {
1031
+ }, []), null;
1032
+ }
1033
+ function Sn(t) {
1034
+ const e = {};
1035
+ for (const [n, i] of Object.entries(t))
1036
+ i.length > 0 && (e[n] = i[0]);
1037
+ return e;
1038
+ }
1039
+ function Mn(t, e = (i) => requestAnimationFrame(i), n = (i) => cancelAnimationFrame(i)) {
1040
+ const i = /* @__PURE__ */ new Map();
1041
+ let r = null, s = !1;
1042
+ const o = () => {
1043
+ r = null;
1044
+ const a = [...i.entries()];
1045
+ i.clear();
1046
+ for (const [l, c] of a)
1047
+ t(l, c);
1048
+ };
1049
+ return {
1050
+ push(a, l) {
1051
+ s || (i.set(a, l), r === null && (r = e(o)));
1052
+ },
1053
+ dispose() {
1054
+ s = !0, i.clear(), r !== null && (n(r), r = null);
1055
+ }
1056
+ };
1057
+ }
1058
+ const An = {
1059
+ aliceblue: 15792383,
1060
+ antiquewhite: 16444375,
1061
+ aqua: 65535,
1062
+ aquamarine: 8388564,
1063
+ azure: 15794175,
1064
+ beige: 16119260,
1065
+ bisque: 16770244,
1066
+ black: 0,
1067
+ blanchedalmond: 16772045,
1068
+ blue: 255,
1069
+ blueviolet: 9055202,
1070
+ brown: 10824234,
1071
+ burlywood: 14596231,
1072
+ cadetblue: 6266528,
1073
+ chartreuse: 8388352,
1074
+ chocolate: 13789470,
1075
+ coral: 16744272,
1076
+ cornflowerblue: 6591981,
1077
+ cornsilk: 16775388,
1078
+ crimson: 14423100,
1079
+ cyan: 65535,
1080
+ darkblue: 139,
1081
+ darkcyan: 35723,
1082
+ darkgoldenrod: 12092939,
1083
+ darkgray: 11119017,
1084
+ darkgreen: 25600,
1085
+ darkgrey: 11119017,
1086
+ darkkhaki: 12433259,
1087
+ darkmagenta: 9109643,
1088
+ darkolivegreen: 5597999,
1089
+ darkorange: 16747520,
1090
+ darkorchid: 10040012,
1091
+ darkred: 9109504,
1092
+ darksalmon: 15308410,
1093
+ darkseagreen: 9419919,
1094
+ darkslateblue: 4734347,
1095
+ darkslategray: 3100495,
1096
+ darkslategrey: 3100495,
1097
+ darkturquoise: 52945,
1098
+ darkviolet: 9699539,
1099
+ deeppink: 16716947,
1100
+ deepskyblue: 49151,
1101
+ dimgray: 6908265,
1102
+ dimgrey: 6908265,
1103
+ dodgerblue: 2003199,
1104
+ firebrick: 11674146,
1105
+ floralwhite: 16775920,
1106
+ forestgreen: 2263842,
1107
+ fuchsia: 16711935,
1108
+ gainsboro: 14474460,
1109
+ ghostwhite: 16316671,
1110
+ gold: 16766720,
1111
+ goldenrod: 14329120,
1112
+ gray: 8421504,
1113
+ green: 32768,
1114
+ greenyellow: 11403055,
1115
+ grey: 8421504,
1116
+ honeydew: 15794160,
1117
+ hotpink: 16738740,
1118
+ indianred: 13458524,
1119
+ indigo: 4915330,
1120
+ ivory: 16777200,
1121
+ khaki: 15787660,
1122
+ lavender: 15132410,
1123
+ lavenderblush: 16773365,
1124
+ lawngreen: 8190976,
1125
+ lemonchiffon: 16775885,
1126
+ lightblue: 11393254,
1127
+ lightcoral: 15761536,
1128
+ lightcyan: 14745599,
1129
+ lightgoldenrodyellow: 16448210,
1130
+ lightgray: 13882323,
1131
+ lightgreen: 9498256,
1132
+ lightgrey: 13882323,
1133
+ lightpink: 16758465,
1134
+ lightsalmon: 16752762,
1135
+ lightseagreen: 2142890,
1136
+ lightskyblue: 8900346,
1137
+ lightslategray: 7833753,
1138
+ lightslategrey: 7833753,
1139
+ lightsteelblue: 11584734,
1140
+ lightyellow: 16777184,
1141
+ lime: 65280,
1142
+ limegreen: 3329330,
1143
+ linen: 16445670,
1144
+ magenta: 16711935,
1145
+ maroon: 8388608,
1146
+ mediumaquamarine: 6737322,
1147
+ mediumblue: 205,
1148
+ mediumorchid: 12211667,
1149
+ mediumpurple: 9662683,
1150
+ mediumseagreen: 3978097,
1151
+ mediumslateblue: 8087790,
1152
+ mediumspringgreen: 64154,
1153
+ mediumturquoise: 4772300,
1154
+ mediumvioletred: 13047173,
1155
+ midnightblue: 1644912,
1156
+ mintcream: 16121850,
1157
+ mistyrose: 16770273,
1158
+ moccasin: 16770229,
1159
+ navajowhite: 16768685,
1160
+ navy: 128,
1161
+ oldlace: 16643558,
1162
+ olive: 8421376,
1163
+ olivedrab: 7048739,
1164
+ orange: 16753920,
1165
+ orangered: 16729344,
1166
+ orchid: 14315734,
1167
+ palegoldenrod: 15657130,
1168
+ palegreen: 10025880,
1169
+ paleturquoise: 11529966,
1170
+ palevioletred: 14381203,
1171
+ papayawhip: 16773077,
1172
+ peachpuff: 16767673,
1173
+ peru: 13468991,
1174
+ pink: 16761035,
1175
+ plum: 14524637,
1176
+ powderblue: 11591910,
1177
+ purple: 8388736,
1178
+ rebeccapurple: 6697881,
1179
+ red: 16711680,
1180
+ rosybrown: 12357519,
1181
+ royalblue: 4286945,
1182
+ saddlebrown: 9127187,
1183
+ salmon: 16416882,
1184
+ sandybrown: 16032864,
1185
+ seagreen: 3050327,
1186
+ seashell: 16774638,
1187
+ sienna: 10506797,
1188
+ silver: 12632256,
1189
+ skyblue: 8900331,
1190
+ slateblue: 6970061,
1191
+ slategray: 7372944,
1192
+ slategrey: 7372944,
1193
+ snow: 16775930,
1194
+ springgreen: 65407,
1195
+ steelblue: 4620980,
1196
+ tan: 13808780,
1197
+ teal: 32896,
1198
+ thistle: 14204888,
1199
+ tomato: 16737095,
1200
+ turquoise: 4251856,
1201
+ violet: 15631086,
1202
+ wheat: 16113331,
1203
+ white: 16777215,
1204
+ whitesmoke: 16119285,
1205
+ yellow: 16776960,
1206
+ yellowgreen: 10145074
1207
+ };
1208
+ function Fn(t) {
1209
+ const e = E(t);
1210
+ if (e === null) return null;
1211
+ if (e.startsWith("#")) return _n(e);
1212
+ if (e.startsWith("rgb")) {
1213
+ const r = e.slice(e.indexOf("(") + 1, -1).split(",").map((d) => d.trim());
1214
+ if (r.length < 3) return null;
1215
+ const o = r[0].endsWith("%") ? 100 : 255, a = ht(r[0], o), l = ht(r[1], o), c = ht(r[2], o), u = r.length > 3 ? Ht(r[3]) : 1;
1216
+ return a === null || l === null || c === null || u === null ? null : [a, l, c, u];
1217
+ }
1218
+ if (e.startsWith("hsl")) {
1219
+ const r = e.slice(e.indexOf("(") + 1, -1).split(",").map((m) => m.trim());
1220
+ if (r.length < 3) return null;
1221
+ const s = Number(r[0].replace("deg", "")), o = Number(r[1].replace("%", "")) / 100, a = Number(r[2].replace("%", "")) / 100, l = r.length > 3 ? Ht(r[3]) : 1;
1222
+ if (![s, o, a].every(Number.isFinite) || l === null) return null;
1223
+ const [c, u, d] = Rn(s, o, a);
1224
+ return [c, u, d, l];
1225
+ }
1226
+ if (e === "transparent") return [0, 0, 0, 0];
1227
+ if (e === "currentcolor") return null;
1228
+ const n = An[e];
1229
+ return n === void 0 ? null : [(n >> 16 & 255) / 255, (n >> 8 & 255) / 255, (n & 255) / 255, 1];
1230
+ }
1231
+ function _n(t) {
1232
+ const e = t.slice(1);
1233
+ if (e.length === 3 || e.length === 4) {
1234
+ const n = parseInt(e[0] + e[0], 16), i = parseInt(e[1] + e[1], 16), r = parseInt(e[2] + e[2], 16), s = e.length === 4 ? parseInt(e[3] + e[3], 16) : 255;
1235
+ return [n / 255, i / 255, r / 255, s / 255];
1236
+ }
1237
+ if (e.length === 6 || e.length === 8) {
1238
+ const n = parseInt(e.slice(0, 2), 16), i = parseInt(e.slice(2, 4), 16), r = parseInt(e.slice(4, 6), 16), s = e.length === 8 ? parseInt(e.slice(6, 8), 16) : 255;
1239
+ return [n / 255, i / 255, r / 255, s / 255];
1240
+ }
1241
+ return null;
1242
+ }
1243
+ function ht(t, e) {
1244
+ const n = Number(t.replace("%", ""));
1245
+ return Number.isFinite(n) ? j(n / e) : null;
1246
+ }
1247
+ function Ht(t) {
1248
+ const e = t.endsWith("%"), n = Number(t.replace("%", ""));
1249
+ return Number.isFinite(n) ? j(e ? n / 100 : n) : null;
1250
+ }
1251
+ function Rn(t, e, n) {
1252
+ const i = (t % 360 + 360) % 360, r = (1 - Math.abs(2 * n - 1)) * e, s = i / 60, o = r * (1 - Math.abs(s % 2 - 1));
1253
+ let a = 0, l = 0, c = 0;
1254
+ s < 1 ? [a, l, c] = [r, o, 0] : s < 2 ? [a, l, c] = [o, r, 0] : s < 3 ? [a, l, c] = [0, r, o] : s < 4 ? [a, l, c] = [0, o, r] : s < 5 ? [a, l, c] = [o, 0, r] : [a, l, c] = [r, 0, o];
1255
+ const u = n - r / 2;
1256
+ return [j(a + u), j(l + u), j(c + u)];
1257
+ }
1258
+ function Tn(t, e, n) {
1259
+ return [
1260
+ j(t[0] + n * (e[0] - t[0])),
1261
+ j(t[1] + n * (e[1] - t[1])),
1262
+ j(t[2] + n * (e[2] - t[2])),
1263
+ j(t[3] + n * (e[3] - t[3]))
1264
+ ];
1265
+ }
1266
+ function zt(t) {
1267
+ const e = Math.round(j(t[0]) * 255), n = Math.round(j(t[1]) * 255), i = Math.round(j(t[2]) * 255), r = Math.round(j(t[3]) * 1e4) / 1e4;
1268
+ return `rgba(${e}, ${n}, ${i}, ${r})`;
1269
+ }
1270
+ function j(t) {
1271
+ return t < 0 ? 0 : t > 1 ? 1 : t;
1272
+ }
1273
+ const re = {
1274
+ "style.color": "colour",
1275
+ fill: "fill",
1276
+ background: "background"
1277
+ };
1278
+ function jn(t, e) {
1279
+ switch (t) {
1280
+ case "opacity": {
1281
+ const n = H(e);
1282
+ return n === null ? null : { opacity: n < 0 ? 0 : n > 1 ? 1 : n };
1283
+ }
1284
+ case "transform.translate": {
1285
+ if (!Array.isArray(e) || e.length !== 2) return null;
1286
+ const n = H(e[0]), i = H(e[1]);
1287
+ return n === null || i === null ? null : { x: n, y: i };
1288
+ }
1289
+ case "transform.scale": {
1290
+ const n = H(e);
1291
+ if (n !== null) return { scaleX: n, scaleY: n };
1292
+ if (Array.isArray(e) && e.length === 2) {
1293
+ const i = H(e[0]), r = H(e[1]);
1294
+ return i === null || r === null ? null : { scaleX: i, scaleY: r };
1295
+ }
1296
+ return null;
1297
+ }
1298
+ case "transform.rotate": {
1299
+ const n = H(e);
1300
+ return n === null ? null : { rotate: n };
1301
+ }
1302
+ case "filter.blur": {
1303
+ const n = Ft("blur", e);
1304
+ return n === null ? null : { blur: n };
1305
+ }
1306
+ case "filter.brightness": {
1307
+ const n = Ft("brightness", e);
1308
+ return n === null ? null : { brightness: n };
1309
+ }
1310
+ default:
1311
+ return null;
1312
+ }
1313
+ }
1314
+ function H(t) {
1315
+ return typeof t != "number" || !Number.isFinite(t) ? null : Object.is(t, -0) ? 0 : t;
1316
+ }
1317
+ const Nn = {
1318
+ kind: "spring",
1319
+ stiffness: 170,
1320
+ damping: 26,
1321
+ mass: 1
1322
+ };
1323
+ function Cn(t) {
1324
+ switch (t) {
1325
+ case "opacity":
1326
+ return "opacity";
1327
+ case "transform.translate":
1328
+ return "x";
1329
+ case "transform.scale":
1330
+ return "scale";
1331
+ case "transform.rotate":
1332
+ return "rotate";
1333
+ case "filter.blur":
1334
+ case "filter.brightness":
1335
+ return "filter";
1336
+ default:
1337
+ return re[t] ?? t;
1338
+ }
1339
+ }
1340
+ const On = {};
1341
+ function Pn(t, e, n) {
1342
+ const i = t.animateBindings, r = K(St), s = B(1), o = B(0), a = B(0), l = B(1), c = B(1), u = B(0), d = B(0), m = B(1), h = pe(
1343
+ [d, m],
1344
+ ([k, y]) => `blur(${k}px) brightness(${y})`
1345
+ ), [g, A] = he(On), x = mt({
1346
+ opacity: s,
1347
+ x: o,
1348
+ y: a,
1349
+ scaleX: l,
1350
+ scaleY: c,
1351
+ rotate: u,
1352
+ blur: d,
1353
+ brightness: m
1354
+ });
1355
+ return qt(() => {
1356
+ if (!i || Object.keys(i).length === 0) return;
1357
+ const k = x.current, y = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Set();
1358
+ let $ = !1;
1359
+ const v = (b, C) => {
1360
+ const V = e.transitionSignal(C).peek() ?? t.transitions?.[Cn(b)], Z = Q(V ?? Nn);
1361
+ return r > 0 && !w.has(b) ? { ...Z, delay: r / 1e3 } : Z;
1362
+ }, T = (b, C, O) => {
1363
+ const V = re[b], Z = q(n, i[b]);
1364
+ if (V !== void 0) {
1365
+ const P = Fn(C);
1366
+ if (P === null) {
1367
+ D(`bindAnimate.${b}`, t.id);
1368
+ return;
1369
+ }
1370
+ const L = p.get(b);
1371
+ if (O || L === void 0) {
1372
+ p.set(b, { current: P }), A((lt) => ({ ...lt, [V]: zt(P) }));
1373
+ return;
1374
+ }
1375
+ const ue = L.current, fe = v(b, Z);
1376
+ w.add(b), y.get(`color:${b}`)?.stop(), y.set(
1377
+ `color:${b}`,
1378
+ At(0, 1, {
1379
+ ...fe,
1380
+ onUpdate: (lt) => {
1381
+ const Mt = Tn(ue, P, lt);
1382
+ L.current = Mt, A((de) => ({ ...de, [V]: zt(Mt) }));
1383
+ }
1384
+ })
1385
+ );
1386
+ return;
1387
+ }
1388
+ const at = jn(b, C);
1389
+ if (at === null) {
1390
+ b.startsWith("filter.") ? Yt(`bindAnimate.${b}`, t.id) : En(b, t.id);
1391
+ return;
1392
+ }
1393
+ if (O) {
1394
+ for (const [P, L] of Object.entries(at))
1395
+ k[P].jump(L);
1396
+ return;
1397
+ }
1398
+ const ce = v(b, Z);
1399
+ w.add(b);
1400
+ for (const [P, L] of Object.entries(at))
1401
+ y.set(P, At(k[P], L, ce));
1402
+ }, U = Mn((b, C) => T(b, C, !1)), _ = Object.entries(i).map(
1403
+ ([b, C]) => ye(() => {
1404
+ const O = e.signal(q(n, C)).value;
1405
+ O !== void 0 && ($ ? U.push(b, O) : T(b, O, !0));
1406
+ })
1407
+ );
1408
+ return $ = !0, () => {
1409
+ for (const b of _) b();
1410
+ U.dispose();
1411
+ for (const b of y.values()) b.stop();
1412
+ };
1413
+ }, [t, i, e, n, r]), { motionStyle: Gt(() => {
1414
+ if (!i) return null;
1415
+ const k = {};
1416
+ let y = !1;
1417
+ for (const p of Object.keys(i))
1418
+ switch (p) {
1419
+ case "opacity":
1420
+ k.opacity = s, y = !0;
1421
+ break;
1422
+ case "transform.translate":
1423
+ k.x = o, k.y = a, y = !0;
1424
+ break;
1425
+ case "transform.scale":
1426
+ k.scaleX = l, k.scaleY = c, y = !0;
1427
+ break;
1428
+ case "transform.rotate":
1429
+ k.rotate = u, y = !0;
1430
+ break;
1431
+ case "filter.blur":
1432
+ case "filter.brightness":
1433
+ k.filter = h, y = !0;
1434
+ break;
1435
+ }
1436
+ return y ? (k.willChange = "transform, opacity, filter", k) : null;
1437
+ }, [i, s, o, a, l, c, u, h]), colorProps: g };
1438
+ }
1439
+ function En(t, e) {
1440
+ S(
1441
+ e,
1442
+ `bindAnimate.${t}`,
1443
+ "rejected bound value : JSON shape does not match the property type (LSML §6.3)"
1444
+ );
1445
+ }
1446
+ const ie = /* @__PURE__ */ new Set(["alpha", "luminance"]), kt = 180, oe = /* @__PURE__ */ new Set(["intersect", "subtract", "union"]);
1447
+ let gt = 0;
1448
+ function Dn() {
1449
+ return gt = (gt + 1) % 1e6, `lumen-mask-${gt.toString(36)}`;
1450
+ }
1451
+ function Bn(t) {
1452
+ return /^[A-Za-z0-9_:-]+$/.test(t) ? t : null;
1453
+ }
1454
+ function M(t) {
1455
+ return typeof t == "number" && Number.isFinite(t);
1456
+ }
1457
+ function Ln(t, e) {
1458
+ if (typeof t != "object" || t === null) return null;
1459
+ const n = t;
1460
+ if (typeof n.type != "string" || !ie.has(n.type))
1461
+ return S(e, "mask.type", "is not alpha|luminance ; mask omitted (ADR 002 §3.2, T4)"), null;
1462
+ if (typeof n.op != "string" || !oe.has(n.op))
1463
+ return S(
1464
+ e,
1465
+ "mask.op",
1466
+ "is not intersect|subtract|union ; mask omitted (ADR 002 §3.2, T4)"
1467
+ ), null;
1468
+ const i = n.source;
1469
+ if (typeof i != "object" || i === null)
1470
+ return S(e, "mask.source", "is not a typed shape|image source ; mask omitted (T3)"), null;
1471
+ const r = i;
1472
+ let s;
1473
+ if (r.kind === "shape" && typeof r.ref == "string")
1474
+ s = { kind: "shape", ref: r.ref };
1475
+ else if (r.kind === "image" && typeof r.src == "string") {
1476
+ const c = r.srcRect;
1477
+ s = c && M(c.x) && M(c.y) && M(c.w) && M(c.h) ? { kind: "image", src: r.src, srcRect: { x: c.x, y: c.y, w: c.w, h: c.h } } : { kind: "image", src: r.src };
1478
+ } else if (r.kind === "group" && typeof r.ref == "string")
1479
+ s = { kind: "group", ref: r.ref };
1480
+ else
1481
+ return S(
1482
+ e,
1483
+ "mask.source",
1484
+ "is not a typed shape|image|group source ; mask omitted (T3)"
1485
+ ), null;
1486
+ const o = { source: s, type: n.type, op: n.op }, a = n.position;
1487
+ a && M(a.x) && M(a.y) && (o.position = { x: a.x, y: a.y });
1488
+ const l = n.size;
1489
+ return l && M(l.w) && M(l.h) && (o.size = { w: l.w, h: l.h }), o;
1490
+ }
1491
+ function Hn(t, e, n, i, r, s = !1) {
1492
+ if (!ie.has(t.type) || !oe.has(t.op))
1493
+ return S(n, "mask", "type/op outside the closed enum ; mask omitted (T4)"), null;
1494
+ const o = Dn(), a = t.position?.x, l = t.position?.y, c = t.size?.w, u = t.size?.h, d = {
1495
+ ...M(a) ? { x: a } : {},
1496
+ ...M(l) ? { y: l } : {},
1497
+ ...M(c) ? { width: c } : {},
1498
+ ...M(u) ? { height: u } : {}
1499
+ };
1500
+ let m;
1501
+ if (t.source.kind === "image") {
1502
+ const x = It(t.source.src, e);
1503
+ if (!x.allowed)
1504
+ return S(
1505
+ n,
1506
+ "mask.source.src",
1507
+ `image host/scheme rejected ; mask omitted (T1/T2 — ${x.reason ?? "denied"})`
1508
+ ), null;
1509
+ if (t.op === "intersect") {
1510
+ const k = t.type === "alpha" ? "alpha" : "luminance", y = `url("${t.source.src}")`, p = t.source.srcRect, w = p && M(p.x) && M(p.y) && M(p.w) && M(p.h), $ = w ? `${p.w}px ${p.h}px` : "cover", v = w ? `${p.x}px ${p.y}px` : "center";
1511
+ return {
1512
+ def: /* @__PURE__ */ f("defs", {}, o),
1513
+ style: {
1514
+ maskImage: y,
1515
+ WebkitMaskImage: y,
1516
+ maskSize: $,
1517
+ WebkitMaskSize: $,
1518
+ maskRepeat: "no-repeat",
1519
+ WebkitMaskRepeat: "no-repeat",
1520
+ maskPosition: v,
1521
+ WebkitMaskPosition: v,
1522
+ maskMode: k
1523
+ },
1524
+ id: o,
1525
+ feather: !1
1526
+ };
1527
+ }
1528
+ const F = Object.keys(d).length > 0 ? d : M(r?.w) && M(r?.h) ? { x: 0, y: 0, width: r.w, height: r.h } : { width: "100%", height: "100%" };
1529
+ m = /* @__PURE__ */ f("image", { href: t.source.src, preserveAspectRatio: "none", ...F });
1530
+ } else {
1531
+ const x = Bn(t.source.ref);
1532
+ if (x === null)
1533
+ return S(
1534
+ n,
1535
+ "mask.source.ref",
1536
+ "shape ref is not a safe id token ; mask omitted (T3)"
1537
+ ), null;
1538
+ const F = i?.(x) ?? null;
1539
+ if (F === null)
1540
+ return S(
1541
+ n,
1542
+ "mask.source.ref",
1543
+ "shape ref does not resolve to an indexed shape ; mask omitted (ADR 002 A2.1 #K)"
1544
+ ), null;
1545
+ m = Object.keys(d).length > 0 ? /* @__PURE__ */ f(
1546
+ "g",
1547
+ {
1548
+ transform: M(d.x) || M(d.y) ? `translate(${M(d.x) ? d.x : 0} ${M(d.y) ? d.y : 0})` : void 0,
1549
+ children: F
1550
+ }
1551
+ ) : F;
1552
+ }
1553
+ s && (m = /* @__PURE__ */ f("g", { transform: `translate(${kt} ${kt})`, children: m }, "feather-pad"));
1554
+ let h;
1555
+ t.op === "intersect" ? h = m : t.op === "union" ? h = /* @__PURE__ */ G(J, { children: [
1556
+ /* @__PURE__ */ f("rect", { x: 0, y: 0, width: "100%", height: "100%", fill: "white" }),
1557
+ m
1558
+ ] }) : h = /* @__PURE__ */ G(J, { children: [
1559
+ /* @__PURE__ */ f("rect", { x: 0, y: 0, width: "100%", height: "100%", fill: "white" }),
1560
+ /* @__PURE__ */ f("g", { style: { filter: "invert(1)" }, children: m })
1561
+ ] });
1562
+ const g = /* @__PURE__ */ f(
1563
+ "mask",
1564
+ {
1565
+ id: o,
1566
+ maskContentUnits: "userSpaceOnUse",
1567
+ x: "-50%",
1568
+ y: "-50%",
1569
+ width: "200%",
1570
+ height: "200%",
1571
+ ...t.type === "alpha" && t.source.kind !== "image" ? { "mask-type": "alpha" } : {},
1572
+ children: h
1573
+ },
1574
+ o
1575
+ ), A = `url(#${o})`;
1576
+ return { def: g, style: { mask: A, WebkitMask: A }, id: o, feather: s };
1577
+ }
1578
+ const se = /* @__PURE__ */ new Map(), ae = rt(se);
1579
+ function ir(t) {
1580
+ if (!t) return se;
1581
+ const e = /* @__PURE__ */ new Map(), n = [t];
1582
+ for (; n.length > 0; ) {
1583
+ const i = n.pop();
1584
+ (i.kind === "shape" || i.kind === "frame") && typeof i.id == "string" && i.id.length > 0 && (e.has(i.id) ? S(
1585
+ i.id,
1586
+ "id",
1587
+ "duplicate shape id ; first occurrence kept, later ones ignored (ADR 002 A2.1 #K)"
1588
+ ) : e.set(i.id, i));
1589
+ const s = i.children;
1590
+ if (s)
1591
+ for (let o = s.length - 1; o >= 0; o--) n.push(s[o]);
1592
+ }
1593
+ return e;
1594
+ }
1595
+ function or({
1596
+ index: t,
1597
+ children: e
1598
+ }) {
1599
+ return /* @__PURE__ */ f(ae.Provider, { value: t, children: e });
1600
+ }
1601
+ function zn() {
1602
+ return K(ae);
1603
+ }
1604
+ function le({ node: t, store: e }) {
1605
+ return t.kind === "repeat" ? /* @__PURE__ */ f(Xn, { node: t, store: e }) : /* @__PURE__ */ f(Wn, { node: t, store: e });
1606
+ }
1607
+ function Wn({ node: t, store: e }) {
1608
+ wt();
1609
+ const n = vt(), i = st(), r = zn(), s = Gt(
1610
+ () => In(t, e, n),
1611
+ // We re-build per render — signals re-render cheaply, and the
1612
+ // resolution itself is O(bindings) which is small. The memo is a
1613
+ // micro-optimisation to keep object identity stable across renders
1614
+ // when the inputs haven't changed.
1615
+ [t, e, n, ...Kn(t, e, n)]
1616
+ ), o = Pn(t, e, n);
1617
+ Xt(t);
1618
+ const a = hn[t.kind];
1619
+ if (!a)
1620
+ return S(t.id, "kind", "unknown render kind ; node not rendered"), null;
1621
+ const l = {};
1622
+ if (t.bindings)
1623
+ for (const [p, w] of Object.entries(t.bindings)) {
1624
+ const $ = e.transitionSignal(q(n, w)).value;
1625
+ $ !== void 0 && (l[p] = $);
1626
+ }
1627
+ const c = (p) => p in l ? l[p] : t.transitions?.[p], u = t.children?.map((p, w) => /* @__PURE__ */ f(le, { node: p, store: e }, p.id ?? w)), d = s.mask !== void 0 && typeof s.blendMode == "string" && Y(s.blendMode) !== void 0, m = {
1628
+ visible: typeof s.visible == "boolean" ? s.visible : void 0,
1629
+ opacity: typeof s.universal_opacity == "number" ? s.universal_opacity : void 0,
1630
+ // A frame applies its own static rotation (frame.tsx) so it pivots around
1631
+ // its centre ; the wrapper has no box for a self-positioning frame and would
1632
+ // pivot around a collapsed (0-height) box. Non-frames keep it on the wrapper
1633
+ // (they DO carry position/size there).
1634
+ rotation: t.kind === "frame" ? void 0 : typeof s.rotation == "number" ? s.rotation : void 0,
1635
+ // Mirror (Figma scaleY(-1)) — like rotation, a frame mirrors itself
1636
+ // (frame.tsx) ; non-frames carry it on the wrapper, composed with rotation.
1637
+ flipY: t.kind === "frame" ? void 0 : s.flipY === !0,
1638
+ blur: typeof s.blur == "number" ? s.blur : void 0,
1639
+ sizing: qn(s.sizing),
1640
+ position: t.kind === "frame" ? void 0 : Gn(s),
1641
+ size: t.kind === "frame" ? void 0 : Wt(s),
1642
+ // ADR 002 §3.2 (D2 / #D) — `blendMode` is a universal prop on every
1643
+ // primitive ; the wrapper re-validates it against the closed enum
1644
+ // before applying `mix-blend-mode` (T4 runtime gate). Pass the raw
1645
+ // resolved value through ; the wrapper omits anything off the enum.
1646
+ // A blend on a MASKED node is hoisted ABOVE the mask wrapper (see below) —
1647
+ // a CSS mask forms an isolating group, so a `mix-blend-mode` left on the
1648
+ // (inner) wrapper would fold over a transparent backdrop (the caramel
1649
+ // hard-light showed the raw blue wave instead of compositing over the warm
1650
+ // gradient). Drop it here when it will be hoisted.
1651
+ blendMode: typeof s.blendMode == "string" && !d ? s.blendMode : void 0
1652
+ }, h = t.children?.some(Yn) ?? !1, g = Object.keys(o.colorProps).length > 0 ? { ...s, ...o.colorProps } : s, A = /* @__PURE__ */ f(
1653
+ a,
1654
+ {
1655
+ resolved: g,
1656
+ nodeId: t.id,
1657
+ transitionFor: c,
1658
+ animateInitial: t.animate_initial,
1659
+ establishesContainingBlock: h,
1660
+ children: u
1661
+ }
1662
+ );
1663
+ let x = null;
1664
+ if (s.mask !== void 0) {
1665
+ const p = Ln(s.mask, t.id), w = (v) => {
1666
+ const T = r.get(v);
1667
+ return T ? T.kind === "frame" ? cn(T, T.id) : an(T, T.id) : null;
1668
+ };
1669
+ let $ = !1;
1670
+ if (p) {
1671
+ const v = p.source;
1672
+ if ((v.kind === "group" || v.kind === "shape") && typeof v.ref == "string") {
1673
+ const T = r.get(v.ref);
1674
+ $ = T ? ee(T) : !1;
1675
+ }
1676
+ }
1677
+ x = p ? Hn(p, i, t.id, w, Wt(s), $) : null;
1678
+ }
1679
+ const F = x !== null && x.style != null && "maskImage" in x.style;
1680
+ let k = A;
1681
+ x && F && (k = /* @__PURE__ */ f("div", { style: { width: "100%", height: "100%", ...x.style }, children: k }));
1682
+ let y = /* @__PURE__ */ f(yn, { ...m, children: k });
1683
+ if (x && !F) {
1684
+ const p = x.feather ? kt : 0;
1685
+ y = /* @__PURE__ */ G(
1686
+ "div",
1687
+ {
1688
+ style: {
1689
+ position: "absolute",
1690
+ inset: -p,
1691
+ overflow: "hidden",
1692
+ ...x.style
1693
+ },
1694
+ children: [
1695
+ /* @__PURE__ */ f("svg", { width: 0, height: 0, style: { position: "absolute" }, "aria-hidden": !0, children: /* @__PURE__ */ f("defs", { children: x.def }) }),
1696
+ /* @__PURE__ */ f("div", { style: { position: "absolute", inset: p }, children: y })
1697
+ ]
1698
+ }
1699
+ );
1700
+ }
1701
+ if (x && d) {
1702
+ const p = Y(s.blendMode);
1703
+ y = /* @__PURE__ */ f(
1704
+ "div",
1705
+ {
1706
+ style: {
1707
+ position: "absolute",
1708
+ inset: 0,
1709
+ mixBlendMode: p
1710
+ },
1711
+ children: y
1712
+ }
1713
+ );
1714
+ }
1715
+ return o.motionStyle && (y = /* @__PURE__ */ f(I.div, { "data-lumencast-bind-animate": t.id ?? "", style: o.motionStyle, children: y })), t.keyframes ? /* @__PURE__ */ f($n, { keyframes: t.keyframes, store: e, nodeId: t.id, children: y }) : y;
1716
+ }
1717
+ function qn(t) {
1718
+ if (typeof t != "object" || t === null) return;
1719
+ const e = t, n = {};
1720
+ return (e.x === "fixed" || e.x === "hug" || e.x === "fill") && (n.x = e.x), (e.y === "fixed" || e.y === "hug" || e.y === "fill") && (n.y = e.y), n.x !== void 0 || n.y !== void 0 ? n : void 0;
1721
+ }
1722
+ function X(t) {
1723
+ return typeof t == "number" && Number.isFinite(t) ? t : void 0;
1724
+ }
1725
+ function Gn(t) {
1726
+ const e = X(t.x), n = X(t.y);
1727
+ if (!(e === void 0 || n === void 0))
1728
+ return { x: e, y: n };
1729
+ }
1730
+ function Wt(t) {
1731
+ const e = X(t.width), n = X(t.height);
1732
+ if (!(e === void 0 && n === void 0))
1733
+ return { w: e, h: n };
1734
+ }
1735
+ function Yn(t) {
1736
+ if (t.kind === "frame") return !1;
1737
+ const e = t.props ?? {}, n = t.bindings ?? {}, i = X(e.x) !== void 0 || "x" in n, r = X(e.y) !== void 0 || "y" in n;
1738
+ return i && r;
1739
+ }
1740
+ function Xn({ node: t, store: e }) {
1741
+ wt();
1742
+ const n = vt();
1743
+ Xt(t);
1744
+ const i = t.bindings?.items, r = i === void 0 ? [] : e.signal(q(n, i)).value ?? [];
1745
+ if (!Array.isArray(r)) return null;
1746
+ const s = t.children?.[0];
1747
+ if (!s) return null;
1748
+ const o = typeof t.stagger_ms == "number" ? t.stagger_ms : 0;
1749
+ return /* @__PURE__ */ f(J, { children: r.map((a, l) => {
1750
+ const c = xn(l, o), u = /* @__PURE__ */ f(gn, { prefix: `${i ?? ""}.${l}`, children: /* @__PURE__ */ f(le, { node: s, store: e }) }, l);
1751
+ return c <= 0 ? u : /* @__PURE__ */ f(St.Provider, { value: c, children: u }, l);
1752
+ }) });
1753
+ }
1754
+ function In(t, e, n) {
1755
+ const i = { ...t.props ?? {} };
1756
+ if (t.bindings)
1757
+ for (const [r, s] of Object.entries(t.bindings)) {
1758
+ const o = q(n, s);
1759
+ i[r] = e.signal(o).value;
1760
+ }
1761
+ return i;
1762
+ }
1763
+ function Kn(t, e, n) {
1764
+ if (!t.bindings) return [];
1765
+ const i = [];
1766
+ for (const r of Object.values(t.bindings))
1767
+ i.push(e.signal(q(n, r)).value);
1768
+ return i;
1769
+ }
1770
+ export {
1771
+ nr as A,
1772
+ or as S,
1773
+ le as T,
1774
+ ir as b,
1775
+ rr as r
1776
+ };
1777
+ //# sourceMappingURL=tree-BIimahCf.js.map