uxml-preview 0.4.0 → 0.5.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.
package/dist/index.js CHANGED
@@ -1,5 +1,584 @@
1
- import { loadYoga as Re, PositionType as J, Direction as ce, Edge as P, BoxSizing as Me, FlexDirection as V, Wrap as q, Justify as W, Align as L, Display as Ue, Overflow as De } from "yoga-layout/load";
2
- const ve = {
1
+ import { loadYoga as tt, PositionType as ne, Direction as be, Edge as q, BoxSizing as nt, FlexDirection as G, Wrap as Y, Justify as P, Align as W, Display as st, Overflow as rt } from "yoga-layout/load";
2
+ function J(e) {
3
+ const n = (t, s) => !Number.isInteger(t) || t < 0 || t > 1114111 || t >= 55296 && t <= 57343 ? s : String.fromCodePoint(t);
4
+ return e.replace(/&#x([0-9a-f]+);/gi, (t, s) => n(parseInt(s, 16), t)).replace(/&#(\d+);/g, (t, s) => n(Number(s), t)).replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
5
+ }
6
+ function ye(e) {
7
+ return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
8
+ }
9
+ function xe(e) {
10
+ return e !== void 0 && /[A-Za-z_]/.test(e);
11
+ }
12
+ function it(e) {
13
+ return e === " " || e === " " || e === `
14
+ ` || e === "\r";
15
+ }
16
+ function Re(e) {
17
+ const n = [];
18
+ let t = 0, s = 0;
19
+ const i = () => s++;
20
+ function r(a, f, l) {
21
+ n.push({
22
+ kind: "malformed",
23
+ message: a,
24
+ at: { in: "uxml", span: { start: f, end: l } }
25
+ });
26
+ }
27
+ function u() {
28
+ for (; it(e[t]); ) t++;
29
+ }
30
+ function c() {
31
+ for (; ; ) {
32
+ const a = e.indexOf("<", t);
33
+ if (a < 0) {
34
+ t = e.length;
35
+ return;
36
+ }
37
+ const f = e[a + 1];
38
+ if (f === "!") {
39
+ if (e.startsWith("<!--", a)) {
40
+ const l = e.indexOf("-->", a + 4);
41
+ t = l < 0 ? e.length : l + 3;
42
+ } else if (e.startsWith("<![CDATA[", a)) {
43
+ const l = e.indexOf("]]>", a + 9);
44
+ t = l < 0 ? e.length : l + 3;
45
+ } else {
46
+ const l = e.indexOf(">", a);
47
+ t = l < 0 ? e.length : l + 1;
48
+ }
49
+ continue;
50
+ }
51
+ if (f === "?") {
52
+ const l = e.indexOf("?>", a + 2);
53
+ t = l < 0 ? e.length : l + 2;
54
+ continue;
55
+ }
56
+ t = a;
57
+ return;
58
+ }
59
+ }
60
+ function v() {
61
+ const a = t;
62
+ for (; ye(e[t]); ) t++;
63
+ const f = e.slice(a, t), l = f.indexOf(":");
64
+ return l < 0 ? { prefix: null, local: f } : { prefix: f.slice(0, l), local: f.slice(l + 1) };
65
+ }
66
+ function d() {
67
+ const a = t;
68
+ for (; ye(e[t]); ) t++;
69
+ if (t === a) return null;
70
+ const f = e.slice(a, t), l = t;
71
+ if (u(), e[t] !== "=")
72
+ return t = l, r(`attribute "${f}" has no value`, a, l), { name: f, value: "", span: { start: a, end: l } };
73
+ t++, u();
74
+ const h = e[t];
75
+ if (h !== '"' && h !== "'")
76
+ return r(`attribute "${f}" has an unquoted value`, a, t), { name: f, value: "", span: { start: a, end: t } };
77
+ t++;
78
+ const g = t, p = e.indexOf(h, t);
79
+ return p < 0 ? (r(`attribute "${f}" has an unterminated value`, a, e.length), t = e.length, { name: f, value: e.slice(g), span: { start: a, end: t } }) : (t = p + 1, { name: f, value: e.slice(g, p), span: { start: a, end: t } });
80
+ }
81
+ function o() {
82
+ const a = t;
83
+ t++;
84
+ const f = v(), l = [];
85
+ let h = !1;
86
+ for (; ; ) {
87
+ u();
88
+ const k = e[t];
89
+ if (k === void 0) {
90
+ r("unterminated open tag", a, e.length);
91
+ break;
92
+ }
93
+ if (k === ">") {
94
+ t++;
95
+ break;
96
+ }
97
+ if (k === "/" && e[t + 1] === ">") {
98
+ t += 2, h = !0;
99
+ break;
100
+ }
101
+ const x = d();
102
+ if (x === null) {
103
+ t++;
104
+ continue;
105
+ }
106
+ l.push(x);
107
+ }
108
+ const g = { start: a, end: t };
109
+ if (h)
110
+ return {
111
+ id: i(),
112
+ name: f,
113
+ attributes: l,
114
+ children: [],
115
+ spans: { openTag: g, inner: { start: t, end: t }, closeTag: null },
116
+ tagDirty: !1,
117
+ childrenDirty: !1
118
+ };
119
+ const p = t, b = [];
120
+ for (; ; ) {
121
+ if (c(), t >= e.length) {
122
+ r(`unterminated element <${Ce(f)}>`, a, e.length);
123
+ break;
124
+ }
125
+ const k = e[t + 1];
126
+ if (k === "/") break;
127
+ if (!xe(k)) {
128
+ t++;
129
+ continue;
130
+ }
131
+ b.push(o());
132
+ }
133
+ const m = t;
134
+ let y = null;
135
+ if (e.startsWith("</", t)) {
136
+ const k = e.indexOf(">", t), x = k < 0 ? e.length : k + 1;
137
+ k < 0 && r("unterminated end tag", t, x), y = { start: t, end: x }, t = x;
138
+ }
139
+ return {
140
+ id: i(),
141
+ name: f,
142
+ attributes: l,
143
+ children: b,
144
+ spans: { openTag: g, inner: { start: p, end: m }, closeTag: y },
145
+ tagDirty: !1,
146
+ childrenDirty: !1
147
+ };
148
+ }
149
+ return c(), t < e.length && xe(e[t + 1]) ? { root: o(), warnings: n } : (r("no root element", 0, 0), {
150
+ root: {
151
+ id: i(),
152
+ name: { prefix: null, local: "" },
153
+ attributes: [],
154
+ children: [],
155
+ spans: { openTag: { start: 0, end: 0 }, inner: { start: 0, end: 0 }, closeTag: null },
156
+ tagDirty: !1,
157
+ childrenDirty: !1
158
+ },
159
+ warnings: n
160
+ });
161
+ }
162
+ function Ce(e) {
163
+ return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
164
+ }
165
+ let Me;
166
+ function ot(e) {
167
+ Me = e;
168
+ }
169
+ const Ue = /* @__PURE__ */ new WeakMap();
170
+ function lt(e, n) {
171
+ Ue.set(e, n);
172
+ }
173
+ function bn(e) {
174
+ return Re(e).root.children.filter((t) => t.name.local === "Template").flatMap((t) => {
175
+ const s = Le(t, "src");
176
+ return s === void 0 || s.length === 0 ? [] : [J(s)];
177
+ });
178
+ }
179
+ const ke = 32;
180
+ function Le(e, n) {
181
+ var t;
182
+ return (t = e.attributes.find((s) => s.name === n)) == null ? void 0 : t.value;
183
+ }
184
+ function U(e, n) {
185
+ const t = Le(e, n);
186
+ return t === void 0 ? void 0 : J(t);
187
+ }
188
+ function We(e) {
189
+ const n = /* @__PURE__ */ new Map();
190
+ for (const t of e.root.children) {
191
+ if (t.name.local !== "Template") continue;
192
+ const s = U(t, "name"), i = U(t, "src");
193
+ s === void 0 || s.length === 0 || i === void 0 || i.length === 0 || n.set(s, { name: s, src: i, node: t });
194
+ }
195
+ return n;
196
+ }
197
+ function ze(e, n) {
198
+ return JSON.stringify([e, n]);
199
+ }
200
+ function at(e) {
201
+ return /(?:^|\/)Packages\//i.test(e) || /PackageCache/i.test(e);
202
+ }
203
+ function j(e, n, t, s, i) {
204
+ e.push({
205
+ kind: n,
206
+ message: t,
207
+ ...s === void 0 ? {} : { node: s.id },
208
+ ...i === void 0 ? {} : { sourceDocument: i }
209
+ });
210
+ }
211
+ function ee(e, n = 0, t = void 0) {
212
+ return {
213
+ ...e,
214
+ span: {
215
+ start: e.span.start + n,
216
+ end: e.span.end + n
217
+ },
218
+ ...t === void 0 ? {} : { sourceDocument: t }
219
+ };
220
+ }
221
+ function _e(e) {
222
+ return { prefix: e.prefix, local: e.local };
223
+ }
224
+ function Se() {
225
+ return { start: 0, end: 0 };
226
+ }
227
+ function se(e, n) {
228
+ return { start: e.start + n, end: e.end + n };
229
+ }
230
+ function ct(e, n, t, s, i) {
231
+ return {
232
+ id: e,
233
+ name: n,
234
+ attributes: t,
235
+ children: s,
236
+ spans: { openTag: Se(), inner: Se(), closeTag: null },
237
+ tagDirty: !1,
238
+ childrenDirty: !1,
239
+ ...i === void 0 ? {} : { derived: { kind: "template-container", instance: i } }
240
+ };
241
+ }
242
+ function ut(e, n, t) {
243
+ const s = e.items.map((i) => i.kind !== "import" || i.resolvedSheet === void 0 ? i.kind === "rule" ? {
244
+ ...i,
245
+ rule: {
246
+ ...i.rule,
247
+ selectors: i.rule.selectors.map((r) => ({
248
+ ...r,
249
+ parts: r.parts.map((u) => ({ ...u, simple: [...u.simple] }))
250
+ })),
251
+ declarations: i.rule.declarations.map((r) => ({ ...r }))
252
+ }
253
+ } : { ...i } : { ...i, resolvedSheet: i.resolvedSheet + n });
254
+ return { ...e, items: s, sourceDocumentFrom: t };
255
+ }
256
+ function dt(e, n) {
257
+ const t = n.sheetOffsets.get(e.document);
258
+ if (t !== void 0) return t;
259
+ const s = n.sheets.length, i = e.document.sheets.map((u, c) => s + c), r = e.document.sheets.map(() => e.url);
260
+ return e.document.sheets.forEach((u, c) => {
261
+ for (const v of u.items)
262
+ v.kind === "import" && v.resolvedSheet !== void 0 && (r[v.resolvedSheet] = u.origin ?? e.url);
263
+ }), n.sheetOffsets.set(e.document, i), e.document.sheets.forEach(
264
+ (u, c) => n.sheets.push(ut(u, s, r[c]))
265
+ ), i;
266
+ }
267
+ function je(e, n) {
268
+ const t = n.sourceOffsets.get(e);
269
+ if (t !== void 0) return t;
270
+ const s = n.sourceLength + 1;
271
+ return n.sourceOffsets.set(e, s), n.sources.push(`
272
+ ${e.source}`), n.sourceLength += e.source.length + 1, s;
273
+ }
274
+ function ft(e, n, t, s, i) {
275
+ for (const r of e.document.styleRoots ?? []) {
276
+ const u = n[r.sheet];
277
+ if (u === void 0) continue;
278
+ const c = t.nodes.get(r.scope) ?? s.id;
279
+ i.styleRoots.push({ sheet: u, scope: c });
280
+ }
281
+ }
282
+ function pt(e) {
283
+ return e.map((n) => {
284
+ const t = U(n, "name"), s = U(n, "slot");
285
+ return `<${n.name.local}${t === void 0 ? "" : ` name="${t}"`}${s === void 0 ? "" : ` slot="${s}"`}>`;
286
+ });
287
+ }
288
+ function Fe(e, n) {
289
+ const t = U(e, "slot-name");
290
+ t !== void 0 && t.length > 0 && n.add(t);
291
+ for (const s of e.children) Fe(s, n);
292
+ }
293
+ function V(e, n, t, s, i) {
294
+ const r = /* @__PURE__ */ new Set();
295
+ t !== null && Fe(t.document.root, r), !(r.size === 0 && n.length === 0) && j(
296
+ i.warnings,
297
+ "template-slot-unsupported",
298
+ `Template slots are unsupported; defined slot names: ${t === null ? "(unavailable)" : r.size === 0 ? "(none)" : [...r].join(", ")}; children not placed: ${n.length === 0 ? "(none)" : pt(n).join(", ")}`,
299
+ e,
300
+ s
301
+ );
302
+ }
303
+ function pe(e, n) {
304
+ if (e.name.local !== "Style" && e.name.local !== "Template" && e.name.local !== "AttributeOverrides") {
305
+ const t = U(e, "name");
306
+ t !== void 0 && t.length > 0 && n.set(t, (n.get(t) ?? 0) + 1);
307
+ }
308
+ for (const t of e.children) pe(t, n);
309
+ }
310
+ function Pe(e, n, t) {
311
+ U(e, "name") === n && t.push(e);
312
+ for (const s of e.children) Pe(s, n, t);
313
+ }
314
+ function ht(e, n, t, s, i) {
315
+ if (n.length === 0) return;
316
+ const r = /* @__PURE__ */ new Map();
317
+ pe(e, r);
318
+ for (const u of n) {
319
+ const c = U(u, "element-name"), v = U(u, "style");
320
+ if (v !== void 0 && j(
321
+ i.warnings,
322
+ "override-style-ignored",
323
+ `AttributeOverrides style for element-name "${c ?? "(missing)"}" was ignored with value "${v}"; Unity ignores style AttributeOverrides, so this matches Unity and is not a preview limitation.`,
324
+ u,
325
+ s ?? void 0
326
+ ), c === void 0 || c.length === 0) continue;
327
+ const d = [];
328
+ if (Pe(e, c, d), d.length === 0) {
329
+ const o = [...r.keys()];
330
+ j(
331
+ i.warnings,
332
+ "override-target-missing",
333
+ `AttributeOverrides target "${c}" matched no element; available names: ${o.length === 0 ? "(none)" : o.join(", ")}`,
334
+ u,
335
+ s ?? void 0
336
+ );
337
+ continue;
338
+ }
339
+ for (const o of d)
340
+ for (const a of u.attributes) {
341
+ if (a.name === "element-name" || a.name === "style") continue;
342
+ const f = o.attributes.find((l) => l.name === a.name);
343
+ f === void 0 ? o.attributes.push(ee(a, t, s)) : (f.value = a.value, f.sourceDocument = s);
344
+ }
345
+ }
346
+ }
347
+ function Be(e) {
348
+ return e.name.local === "Template" || e.name.local === "Instance" ? !0 : e.children.some(Be);
349
+ }
350
+ function mt(e, n) {
351
+ let t = 0;
352
+ const s = (i) => {
353
+ t = Math.max(t, Number(i.id) + 1);
354
+ for (const r of i.children) s(r);
355
+ };
356
+ return s(e.root), {
357
+ resolver: n,
358
+ warnings: [],
359
+ cache: /* @__PURE__ */ new Map(),
360
+ sheetOffsets: /* @__PURE__ */ new WeakMap(),
361
+ reportedWarnings: /* @__PURE__ */ new WeakSet(),
362
+ sourceOffsets: new WeakMap([[e, 0]]),
363
+ sources: [e.source],
364
+ sourceLength: e.source.length,
365
+ sheets: [...e.sheets],
366
+ styleRoots: [...e.styleRoots ?? []],
367
+ nextId: () => t++,
368
+ stack: []
369
+ };
370
+ }
371
+ function gt(e, n, t) {
372
+ var v;
373
+ const s = ze(e.src, n);
374
+ if (t.cache.has(s)) return t.cache.get(s) ?? null;
375
+ const i = ((v = t.resolver) == null ? void 0 : v.call(t, e.src, n)) ?? null;
376
+ if (i === null)
377
+ return t.cache.set(s, null), j(
378
+ t.warnings,
379
+ "template-src-unresolved",
380
+ `Template "${e.name}" src "${e.src}" could not be resolved from ${n === null ? "the entry UXML" : `"${n}"`}; attempted resolveImport("${e.src}", ${n === null ? "null" : `"${n}"`}); internal filesystem search paths: none`,
381
+ e.node,
382
+ n ?? void 0
383
+ ), at(e.src) && j(
384
+ t.warnings,
385
+ "package-path-not-searched",
386
+ `Template src "${e.src}" was unresolved; the resolver returned no source and the core does not independently search Unity Packages/Library/PackageCache paths`,
387
+ e.node,
388
+ n ?? void 0
389
+ ), null;
390
+ const r = Me;
391
+ if (r === void 0)
392
+ throw new Error("template parser is not registered; import parse from src/index before expansion");
393
+ const u = r(
394
+ i,
395
+ t.resolver === void 0 ? void 0 : (d, o) => t.resolver(d, o ?? e.src)
396
+ ), c = {
397
+ url: e.src,
398
+ from: n,
399
+ document: u,
400
+ declarations: We(u)
401
+ };
402
+ return t.cache.set(s, c), c;
403
+ }
404
+ function wt(e, n, t) {
405
+ var s, i;
406
+ if (!t.reportedWarnings.has(e.document)) {
407
+ t.reportedWarnings.add(e.document);
408
+ for (const r of e.document.warnings)
409
+ ((s = r.at) == null ? void 0 : s.in) === "uss" ? t.warnings.push({
410
+ ...r,
411
+ at: { ...r.at, sheet: n[r.at.sheet] ?? r.at.sheet },
412
+ sourceDocument: ((i = e.document.sheets[r.at.sheet]) == null ? void 0 : i.origin) ?? e.url
413
+ }) : t.warnings.push({ ...r, sourceDocument: e.url });
414
+ }
415
+ }
416
+ function te(e, n, t, s, i, r) {
417
+ const u = i ? e.id : n.nextId(), c = s === null ? 0 : n.sourceOffsets.get(s.document) ?? 0, v = c === 0 || s === null ? void 0 : s.url, d = {
418
+ id: u,
419
+ name: _e(e.name),
420
+ attributes: e.attributes.map((o) => ee(o, c, v)),
421
+ children: [],
422
+ spans: {
423
+ openTag: se(e.spans.openTag, c),
424
+ inner: se(e.spans.inner, c),
425
+ closeTag: e.spans.closeTag === null ? null : se(e.spans.closeTag, c)
426
+ },
427
+ tagDirty: e.tagDirty,
428
+ childrenDirty: e.childrenDirty,
429
+ ...c === 0 || s === null ? {} : {
430
+ sourceDocument: s.url,
431
+ sourceDocumentFrom: s.from,
432
+ sourceNode: e.id
433
+ }
434
+ };
435
+ t.nodes.set(e.id, d.id);
436
+ for (const o of e.children)
437
+ if (!(o.name.local === "Template" || o.name.local === "Style")) {
438
+ if (o.name.local === "Instance") {
439
+ d.children.push(he(o, n, s, t, r + 1));
440
+ continue;
441
+ }
442
+ o.name.local !== "AttributeOverrides" && U(o, "slot") === void 0 && d.children.push(te(o, n, t, s, i, r));
443
+ }
444
+ return d;
445
+ }
446
+ function vt(e, n, t, s) {
447
+ je(e.document, t);
448
+ const i = { nodes: /* @__PURE__ */ new Map([[e.document.root.id, n.id]]) };
449
+ for (const r of e.document.root.children)
450
+ if (!(r.name.local === "Template" || r.name.local === "Style")) {
451
+ if (r.name.local === "Instance") {
452
+ n.children.push(he(r, t, e, i, s + 1));
453
+ continue;
454
+ }
455
+ r.name.local !== "AttributeOverrides" && U(r, "slot") === void 0 && n.children.push(te(r, t, i, e, !1, s));
456
+ }
457
+ return i;
458
+ }
459
+ function he(e, n, t, s, i) {
460
+ const r = ct(
461
+ n.nextId(),
462
+ { prefix: e.name.prefix, local: "TemplateContainer" },
463
+ e.attributes.filter((b) => b.name !== "template").map(
464
+ (b) => ee(
465
+ b,
466
+ t === null ? 0 : n.sourceOffsets.get(t.document) ?? 0,
467
+ t === null || t.url.length === 0 ? null : t.url
468
+ )
469
+ ),
470
+ [],
471
+ e.id
472
+ );
473
+ t !== null && (r.sourceDocument = t.url.length > 0 ? t.url : null, r.sourceDocumentFrom = t.from), s.nodes.set(e.id, r.id);
474
+ const u = U(e, "template"), c = e.children.filter((b) => U(b, "slot") !== void 0), v = t === null || t.url.length === 0 ? void 0 : t.url, d = t == null ? void 0 : t.declarations.get(u ?? "");
475
+ if (d === void 0)
476
+ return V(e, c, null, v, n), j(
477
+ n.warnings,
478
+ "template-not-declared",
479
+ `Instance${u === void 0 ? "" : ` template "${u}"`} has no matching Template declaration`,
480
+ e,
481
+ v
482
+ ), r;
483
+ const o = t === null || t.url.length === 0 ? null : t.url, a = {
484
+ key: JSON.stringify([d.name, d.src, o]),
485
+ label: `${d.name}@${d.src}`
486
+ }, f = n.stack.findIndex((b) => b.key === a.key);
487
+ if (f >= 0) {
488
+ const b = n.cache.get(ze(d.src, o)) ?? null;
489
+ V(e, c, b, v, n);
490
+ const m = [...n.stack.slice(f), a].map((y) => y.label).join(" -> ");
491
+ return j(
492
+ n.warnings,
493
+ "template-cycle",
494
+ `Template cycle detected: ${m}`,
495
+ e,
496
+ v
497
+ ), r;
498
+ }
499
+ if (i >= ke)
500
+ return V(e, c, null, v, n), j(
501
+ n.warnings,
502
+ "template-depth-exceeded",
503
+ `Template expansion exceeded the depth limit ${ke}: ${[
504
+ ...n.stack,
505
+ a
506
+ ].map((b) => b.label).join(" -> ")}`,
507
+ e,
508
+ v
509
+ ), r;
510
+ const l = gt(d, o, n);
511
+ if (l === null)
512
+ return V(e, c, null, v, n), r;
513
+ je(l.document, n), n.stack.push(a);
514
+ const h = vt(l, r, n, i);
515
+ n.stack.pop();
516
+ const g = dt(l, n);
517
+ wt(l, g, n), ft(l, g, h, r, n);
518
+ const p = e.children.filter((b) => b.name.local === "AttributeOverrides");
519
+ V(e, c, l, v, n), ht(
520
+ r,
521
+ p,
522
+ t === null ? 0 : n.sourceOffsets.get(t.document) ?? 0,
523
+ t === null || t.url.length === 0 ? null : t.url,
524
+ n
525
+ );
526
+ for (const b of e.children)
527
+ b.name.local === "AttributeOverrides" || b.name.local === "Style" || U(b, "slot") !== void 0 || r.children.push(te(b, n, s, t, !1, i));
528
+ return r;
529
+ }
530
+ function bt(e) {
531
+ if (!Be(e.root)) return { document: e, warnings: [] };
532
+ const n = mt(e, Ue.get(e)), t = n.styleRoots.length, s = {
533
+ url: "",
534
+ from: null,
535
+ document: e,
536
+ declarations: We(e)
537
+ }, i = { nodes: /* @__PURE__ */ new Map([[e.root.id, e.root.id]]) }, r = {
538
+ id: e.root.id,
539
+ name: _e(e.root.name),
540
+ attributes: e.root.attributes.map((c) => ee(c)),
541
+ children: [],
542
+ spans: {
543
+ openTag: { ...e.root.spans.openTag },
544
+ inner: { ...e.root.spans.inner },
545
+ closeTag: e.root.spans.closeTag === null ? null : { ...e.root.spans.closeTag }
546
+ },
547
+ tagDirty: e.root.tagDirty,
548
+ childrenDirty: e.root.childrenDirty
549
+ };
550
+ for (const c of e.root.children)
551
+ if (!(c.name.local === "Template" || c.name.local === "Style")) {
552
+ if (c.name.local === "Instance") {
553
+ r.children.push(he(c, n, s, i, 0));
554
+ continue;
555
+ }
556
+ c.name.local !== "AttributeOverrides" && U(c, "slot") === void 0 && r.children.push(te(c, n, i, s, !0, 0));
557
+ }
558
+ for (let c = 0; c < t; c++) {
559
+ const v = n.styleRoots[c], d = i.nodes.get(v.scope);
560
+ d !== void 0 && (n.styleRoots[c] = { ...v, scope: d });
561
+ }
562
+ const u = /* @__PURE__ */ new Map();
563
+ pe(r, u);
564
+ for (const [c, v] of u)
565
+ v > 1 && j(
566
+ n.warnings,
567
+ "duplicate-name-in-tree",
568
+ `name "${c}" occurs ${v} times after template expansion`
569
+ );
570
+ return {
571
+ document: {
572
+ ...e,
573
+ root: r,
574
+ source: n.sources.join(""),
575
+ sheets: n.sheets,
576
+ styleRoots: n.styleRoots
577
+ },
578
+ warnings: n.warnings
579
+ };
580
+ }
581
+ const He = {
3
582
  // VisualElement is the base class and carries no class of its own.
4
583
  VisualElement: { hasText: !1, classes: [], parts: [] },
5
584
  Label: { hasText: !0, classes: ["unity-label"], parts: [] },
@@ -37,24 +616,26 @@ const ve = {
37
616
  { name: "unity-content-container", style: { "flex-shrink": "0" } }
38
617
  ]
39
618
  }
40
- }, ue = { hasText: !1, classes: [], parts: [] }, Le = "UXML", ze = /* @__PURE__ */ new Set(["Style"]);
41
- function _e(e) {
42
- return ze.has(e.name.local);
619
+ }, re = { hasText: !1, classes: [], parts: [] }, yt = "UXML", xt = /* @__PURE__ */ new Set(["Style"]);
620
+ function kt(e) {
621
+ return xt.has(e.name.local);
43
622
  }
44
- function F(e) {
45
- const n = ve[e.name.local];
46
- return n !== void 0 ? { spec: n, fallback: !1 } : je(e) ? { spec: ue, fallback: !1 } : { spec: ue, fallback: !0 };
623
+ function H(e) {
624
+ var t;
625
+ if (((t = e.derived) == null ? void 0 : t.kind) === "template-container") return { spec: re, fallback: !1 };
626
+ const n = He[e.name.local];
627
+ return n !== void 0 ? { spec: n, fallback: !1 } : St(e) ? { spec: re, fallback: !1 } : { spec: re, fallback: !0 };
47
628
  }
48
- function je(e) {
49
- return e.name.local === Le;
629
+ function St(e) {
630
+ return e.name.local === yt;
50
631
  }
51
- function We(e) {
52
- return F(e).spec.classes;
632
+ function $t(e) {
633
+ return H(e).spec.classes;
53
634
  }
54
- function Be() {
55
- return Object.keys(ve);
635
+ function Tt() {
636
+ return Object.keys(He);
56
637
  }
57
- const Y = "6000.0.40f1", ye = `:disabled {
638
+ const Z = "6000.0.40f1", Ve = `:disabled {
58
639
  opacity: 0.5;
59
640
  }
60
641
 
@@ -62,11 +643,11 @@ const Y = "6000.0.40f1", ye = `:disabled {
62
643
  margin: 1px 3px;
63
644
  -unity-text-align: middle-center;
64
645
  }
65
- `, Fe = 13;
66
- function Pe(e) {
67
- return e ? Fe : 0;
646
+ `, Ot = 13;
647
+ function Et(e) {
648
+ return e ? Ot : 0;
68
649
  }
69
- const Ve = /* @__PURE__ */ new Set([
650
+ const Nt = /* @__PURE__ */ new Set([
70
651
  "color",
71
652
  "font-size",
72
653
  "letter-spacing",
@@ -81,23 +662,23 @@ const Ve = /* @__PURE__ */ new Set([
81
662
  "-unity-text-outline-color",
82
663
  "-unity-text-outline-width"
83
664
  ]);
84
- function He(e) {
85
- return e.startsWith("--") || Ve.has(e);
665
+ function Dt(e) {
666
+ return e.startsWith("--") || Nt.has(e);
86
667
  }
87
- function de(e) {
668
+ function $e(e) {
88
669
  const n = [];
89
- let t = 0, i = -1;
90
- for (let l = 0; l < e.length; l++) {
91
- const o = e[l];
92
- o === "(" ? t++ : o === ")" && (t = Math.max(0, t - 1)), t === 0 && /\s/.test(o) ? i >= 0 && (n.push(e.slice(i, l)), i = -1) : i < 0 && (i = l);
670
+ let t = 0, s = -1;
671
+ for (let i = 0; i < e.length; i++) {
672
+ const r = e[i];
673
+ r === "(" ? t++ : r === ")" && (t = Math.max(0, t - 1)), t === 0 && /\s/.test(r) ? s >= 0 && (n.push(e.slice(s, i)), s = -1) : s < 0 && (s = i);
93
674
  }
94
- return i >= 0 && n.push(e.slice(i)), n;
675
+ return s >= 0 && n.push(e.slice(s)), n;
95
676
  }
96
- function qe(e) {
97
- const [n, t, i, l] = e;
98
- return n === void 0 ? null : t === void 0 ? [n, n, n, n] : i === void 0 ? [n, t, n, t] : l === void 0 ? [n, t, i, t] : [n, t, i, l];
677
+ function At(e) {
678
+ const [n, t, s, i] = e;
679
+ return n === void 0 ? null : t === void 0 ? [n, n, n, n] : s === void 0 ? [n, t, n, t] : i === void 0 ? [n, t, s, t] : [n, t, s, i];
99
680
  }
100
- const Ge = {
681
+ const It = {
101
682
  margin: ["margin-top", "margin-right", "margin-bottom", "margin-left"],
102
683
  padding: ["padding-top", "padding-right", "padding-bottom", "padding-left"],
103
684
  "border-width": [
@@ -120,21 +701,21 @@ const Ge = {
120
701
  "border-bottom-left-radius"
121
702
  ]
122
703
  };
123
- function fe(e) {
704
+ function Te(e) {
124
705
  return /^-?(\d+\.?\d*|\.\d+)$/.test(e);
125
706
  }
126
- function Ye(e) {
127
- const [n, t, i] = e;
128
- return n === void 0 ? [] : n === "none" ? [["flex-grow", "0"], ["flex-shrink", "0"], ["flex-basis", "auto"]] : n === "auto" ? [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", "auto"]] : t === void 0 ? fe(n) ? [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", "0"]] : [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", n]] : i === void 0 ? fe(t) ? [["flex-grow", n], ["flex-shrink", t], ["flex-basis", "0"]] : [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", t]] : [["flex-grow", n], ["flex-shrink", t], ["flex-basis", i]];
707
+ function Rt(e) {
708
+ const [n, t, s] = e;
709
+ return n === void 0 ? [] : n === "none" ? [["flex-grow", "0"], ["flex-shrink", "0"], ["flex-basis", "auto"]] : n === "auto" ? [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", "auto"]] : t === void 0 ? Te(n) ? [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", "0"]] : [["flex-grow", "1"], ["flex-shrink", "1"], ["flex-basis", n]] : s === void 0 ? Te(t) ? [["flex-grow", n], ["flex-shrink", t], ["flex-basis", "0"]] : [["flex-grow", n], ["flex-shrink", "1"], ["flex-basis", t]] : [["flex-grow", n], ["flex-shrink", t], ["flex-basis", s]];
129
710
  }
130
- function Z(e, n) {
131
- if (e === "flex") return Ye(de(n));
132
- const t = Ge[e];
711
+ function ie(e, n) {
712
+ if (e === "flex") return Rt($e(n));
713
+ const t = It[e];
133
714
  if (t === void 0) return [[e, n]];
134
- const i = qe(de(n));
135
- return i === null ? [[e, n]] : t.map((l, o) => [l, i[o]]);
715
+ const s = At($e(n));
716
+ return s === null ? [[e, n]] : t.map((i, r) => [i, s[r]]);
136
717
  }
137
- const ee = {
718
+ const ae = {
138
719
  "align-content": "flex-start",
139
720
  "align-items": "stretch",
140
721
  "align-self": "auto",
@@ -170,8 +751,8 @@ const ee = {
170
751
  "padding-right": "0",
171
752
  "padding-top": "0",
172
753
  "font-size": "12px"
173
- }, Xe = ["em", "rem", "vh", "vw", "vmin", "vmax", "pt", "cm", "in"];
174
- function X(e) {
754
+ }, Ct = ["em", "rem", "vh", "vw", "vmin", "vmax", "pt", "cm", "in"];
755
+ function Q(e) {
175
756
  const n = e.trim();
176
757
  if (n === "") return { length: null, problem: "empty value" };
177
758
  if (n === "auto") return { length: { kind: "auto" } };
@@ -181,245 +762,241 @@ function X(e) {
181
762
  return { length: null, problem: "calc() is not supported in USS" };
182
763
  const t = /^(-?(?:\d+\.?\d*|\.\d+))([a-z%]*)$/i.exec(n);
183
764
  if (t === null) return { length: null, problem: `cannot read "${n}" as a length` };
184
- const i = Number(t[1]), l = t[2].toLowerCase();
185
- return l === "" || l === "px" ? { length: { kind: "px", value: i } } : l === "%" ? { length: { kind: "percent", value: i } } : Xe.includes(l) ? { length: null, problem: `"${l}" is not a USS unit` } : { length: null, problem: `unknown unit "${l}"` };
765
+ const s = Number(t[1]), i = t[2].toLowerCase();
766
+ return i === "" || i === "px" ? { length: { kind: "px", value: s } } : i === "%" ? { length: { kind: "percent", value: s } } : Ct.includes(i) ? { length: null, problem: `"${i}" is not a USS unit` } : { length: null, problem: `unknown unit "${i}"` };
186
767
  }
187
- function pe(e) {
768
+ function Oe(e) {
188
769
  const n = e.trim();
189
770
  return /^-?(\d+\.?\d*|\.\d+)$/.test(n) ? Number(n) : null;
190
771
  }
191
- let se = null;
192
- async function Lt() {
193
- se ?? (se = await Re());
194
- }
195
- function zt() {
196
- return se !== null;
197
- }
198
- let G = 0;
199
- function _t() {
200
- return G;
201
- }
202
- const K = {
203
- auto: L.Auto,
204
- "flex-start": L.FlexStart,
205
- center: L.Center,
206
- "flex-end": L.FlexEnd,
207
- stretch: L.Stretch,
208
- baseline: L.Baseline,
209
- "space-between": L.SpaceBetween,
210
- "space-around": L.SpaceAround,
211
- "space-evenly": L.SpaceEvenly
212
- }, Je = {
772
+ let me = null;
773
+ async function yn() {
774
+ me ?? (me = await tt());
775
+ }
776
+ function xn() {
777
+ return me !== null;
778
+ }
779
+ let K = 0;
780
+ function kn() {
781
+ return K;
782
+ }
783
+ const oe = {
784
+ auto: W.Auto,
213
785
  "flex-start": W.FlexStart,
214
786
  center: W.Center,
215
787
  "flex-end": W.FlexEnd,
788
+ stretch: W.Stretch,
789
+ baseline: W.Baseline,
216
790
  "space-between": W.SpaceBetween,
217
791
  "space-around": W.SpaceAround,
218
792
  "space-evenly": W.SpaceEvenly
219
- }, Ze = {
220
- column: V.Column,
221
- "column-reverse": V.ColumnReverse,
222
- row: V.Row,
223
- "row-reverse": V.RowReverse
224
- }, Ke = {
225
- nowrap: q.NoWrap,
226
- wrap: q.Wrap,
227
- "wrap-reverse": q.WrapReverse
228
- }, Qe = [
229
- ["left", P.Left],
230
- ["top", P.Top],
231
- ["right", P.Right],
232
- ["bottom", P.Bottom]
793
+ }, Mt = {
794
+ "flex-start": P.FlexStart,
795
+ center: P.Center,
796
+ "flex-end": P.FlexEnd,
797
+ "space-between": P.SpaceBetween,
798
+ "space-around": P.SpaceAround,
799
+ "space-evenly": P.SpaceEvenly
800
+ }, Ut = {
801
+ column: G.Column,
802
+ "column-reverse": G.ColumnReverse,
803
+ row: G.Row,
804
+ "row-reverse": G.RowReverse
805
+ }, Lt = {
806
+ nowrap: Y.NoWrap,
807
+ wrap: Y.Wrap,
808
+ "wrap-reverse": Y.WrapReverse
809
+ }, Wt = [
810
+ ["left", q.Left],
811
+ ["top", q.Top],
812
+ ["right", q.Right],
813
+ ["bottom", q.Bottom]
233
814
  ];
234
- function et(e, n, t, i) {
235
- const l = se;
236
- if (l === null)
815
+ function zt(e, n, t, s) {
816
+ const i = me;
817
+ if (i === null)
237
818
  throw new Error("loadLayoutEngine() must be awaited before rendering");
238
- const o = [], p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Map(), v = [], d = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
239
- let a = 0, u = !1, r = !1;
240
- const f = (m, k) => {
819
+ const r = [], u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), v = [], d = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
820
+ let a = 0, f = !1, l = !1;
821
+ const h = (w, S) => {
241
822
  var T;
242
- return ((T = m.get(k)) == null ? void 0 : T.value) ?? ee[k] ?? "";
823
+ return ((T = w.get(S)) == null ? void 0 : T.value) ?? ae[S] ?? "";
243
824
  };
244
- function b(m, k) {
245
- o.push({ kind: "unsupported-property", message: m, node: k.id });
825
+ function g(w, S) {
826
+ r.push({ kind: "unsupported-property", message: w, node: S.id });
246
827
  }
247
- function c(m, k, T) {
248
- const N = f(m, k);
828
+ function p(w, S, T) {
829
+ const N = h(w, S);
249
830
  if (N === "") return null;
250
- const { length: I, problem: C } = X(N);
251
- return C !== void 0 && b(`${k}: ${C}`, T), I;
831
+ const { length: D, problem: A } = Q(N);
832
+ return A !== void 0 && g(`${S}: ${A}`, T), D;
252
833
  }
253
- function S(m) {
254
- if (m !== null)
255
- switch (m.kind) {
834
+ function b(w) {
835
+ if (w !== null)
836
+ switch (w.kind) {
256
837
  case "px":
257
- return m.value;
838
+ return w.value;
258
839
  case "percent":
259
- return `${m.value}%`;
840
+ return `${w.value}%`;
260
841
  case "auto":
261
842
  return "auto";
262
843
  case "none":
263
844
  return;
264
845
  }
265
846
  }
266
- function h(m) {
267
- if (m !== null) {
268
- if (m.kind === "px") return m.value;
269
- if (m.kind === "percent") return `${m.value}%`;
847
+ function m(w) {
848
+ if (w !== null) {
849
+ if (w.kind === "px") return w.value;
850
+ if (w.kind === "percent") return `${w.value}%`;
270
851
  }
271
852
  }
272
- function w(m, k, T) {
273
- m.setBoxSizing(Me.BorderBox), m.setFlexDirection(Ze[f(k, "flex-direction")] ?? V.Column), m.setFlexWrap(Ke[f(k, "flex-wrap")] ?? q.NoWrap), m.setJustifyContent(Je[f(k, "justify-content")] ?? W.FlexStart), m.setAlignItems(K[f(k, "align-items")] ?? L.Stretch), m.setAlignSelf(K[f(k, "align-self")] ?? L.Auto), m.setAlignContent(K[f(k, "align-content")] ?? L.FlexStart), m.setFlexGrow(pe(f(k, "flex-grow")) ?? 0), m.setFlexShrink(pe(f(k, "flex-shrink")) ?? 1), m.setFlexBasis(S(c(k, "flex-basis", T)));
274
- const N = f(k, "position");
275
- (N === "fixed" || N === "sticky") && b(`position: ${N} is not supported in USS; treated as relative`, T), m.setPositionType(
276
- N === "absolute" ? J.Absolute : J.Relative
277
- ), f(k, "display") === "none" && m.setDisplay(Ue.None);
278
- const I = f(k, "overflow");
279
- I === "hidden" ? m.setOverflow(De.Hidden) : (I === "auto" || I === "scroll") && b(`overflow: ${I} needs a ScrollView element in USS`, T), m.setWidth(S(c(k, "width", T))), m.setHeight(S(c(k, "height", T))), m.setMinWidth(h(c(k, "min-width", T))), m.setMinHeight(h(c(k, "min-height", T))), m.setMaxWidth(h(c(k, "max-width", T))), m.setMaxHeight(h(c(k, "max-height", T)));
280
- for (const [C, A] of Qe) {
281
- m.setMargin(A, h(c(k, `margin-${C}`, T))), m.setPadding(A, h(c(k, `padding-${C}`, T)));
282
- const _ = h(c(k, `border-${C}-width`, T));
283
- m.setBorder(A, typeof _ == "number" ? _ : void 0), m.setPosition(A, h(c(k, C, T)));
853
+ function y(w, S, T) {
854
+ w.setBoxSizing(nt.BorderBox), w.setFlexDirection(Ut[h(S, "flex-direction")] ?? G.Column), w.setFlexWrap(Lt[h(S, "flex-wrap")] ?? Y.NoWrap), w.setJustifyContent(Mt[h(S, "justify-content")] ?? P.FlexStart), w.setAlignItems(oe[h(S, "align-items")] ?? W.Stretch), w.setAlignSelf(oe[h(S, "align-self")] ?? W.Auto), w.setAlignContent(oe[h(S, "align-content")] ?? W.FlexStart), w.setFlexGrow(Oe(h(S, "flex-grow")) ?? 0), w.setFlexShrink(Oe(h(S, "flex-shrink")) ?? 1), w.setFlexBasis(b(p(S, "flex-basis", T)));
855
+ const N = h(S, "position");
856
+ (N === "fixed" || N === "sticky") && g(`position: ${N} is not supported in USS; treated as relative`, T), w.setPositionType(
857
+ N === "absolute" ? ne.Absolute : ne.Relative
858
+ ), h(S, "display") === "none" && w.setDisplay(st.None);
859
+ const D = h(S, "overflow");
860
+ D === "hidden" ? w.setOverflow(rt.Hidden) : (D === "auto" || D === "scroll") && g(`overflow: ${D} needs a ScrollView element in USS`, T), w.setWidth(b(p(S, "width", T))), w.setHeight(b(p(S, "height", T))), w.setMinWidth(m(p(S, "min-width", T))), w.setMinHeight(m(p(S, "min-height", T))), w.setMaxWidth(m(p(S, "max-width", T))), w.setMaxHeight(m(p(S, "max-height", T)));
861
+ for (const [A, I] of Wt) {
862
+ w.setMargin(I, m(p(S, `margin-${A}`, T))), w.setPadding(I, m(p(S, `padding-${A}`, T)));
863
+ const _ = m(p(S, `border-${A}-width`, T));
864
+ w.setBorder(I, typeof _ == "number" ? _ : void 0), w.setPosition(I, m(p(S, A, T)));
284
865
  }
285
866
  }
286
- function y(m) {
287
- var k;
288
- return (k = m.attributes.find((T) => T.name === "text")) == null ? void 0 : k.value;
867
+ function k(w) {
868
+ var S;
869
+ return (S = w.attributes.find((T) => T.name === "text")) == null ? void 0 : S.value;
289
870
  }
290
871
  const x = ["text", "label"];
291
- function $(m) {
872
+ function $(w) {
292
873
  return x.filter(
293
- (k) => m.attributes.some((T) => T.name === k && T.value.length > 0)
874
+ (S) => w.attributes.some((T) => T.name === S && T.value.length > 0)
294
875
  );
295
876
  }
296
- function O(m, k) {
297
- if (_e(m)) return;
298
- const T = n.get(m.id) ?? /* @__PURE__ */ new Map(), N = l.Node.create();
299
- a++, G++, d.set(m, N), v.push(m), w(N, T, m), k !== null && k.insertChild(N, k.getChildCount());
300
- const { spec: I, fallback: C } = F(m), A = y(m), _ = I.hasText && A !== void 0 && A.length > 0;
301
- if (C) {
302
- const R = $(m);
303
- o.push({
877
+ function O(w, S) {
878
+ if (kt(w)) return;
879
+ const T = n.get(w.id) ?? /* @__PURE__ */ new Map(), N = i.Node.create();
880
+ a++, K++, d.set(w, N), v.push(w), y(N, T, w), S !== null && S.insertChild(N, S.getChildCount());
881
+ const { spec: D, fallback: A } = H(w), I = k(w), _ = D.hasText && I !== void 0 && I.length > 0;
882
+ if (A) {
883
+ const R = $(w);
884
+ r.push({
304
885
  kind: "unsupported-control",
305
- message: `<${m.name.local}> has no renderer in this version and is drawn as a plain VisualElement` + (R.length === 0 ? "" : `; its ${R.join(" and ")} attribute${R.length > 1 ? "s are" : " is"} not drawn, because Unity draws that through a child element`),
306
- node: m.id
886
+ message: `<${w.name.local}> has no renderer in this version and is drawn as a plain VisualElement` + (R.length === 0 ? "" : `; its ${R.join(" and ")} attribute${R.length > 1 ? "s are" : " is"} not drawn, because Unity draws that through a child element`),
887
+ node: w.id
307
888
  });
308
889
  }
309
890
  if (_) {
310
- m.children.length > 0 && b(
311
- `<${m.name.local}> has both a text attribute and children; children are not drawn`,
312
- m
891
+ w.children.length > 0 && g(
892
+ `<${w.name.local}> has both a text attribute and children; children are not drawn`,
893
+ w
313
894
  );
314
- const R = c(T, "font-size", m), z = {
895
+ const R = p(T, "font-size", w), z = {
315
896
  fontSize: R !== null && R.kind === "px" ? R.value : 12,
316
- fontStyle: f(T, "-unity-font-style") || "normal",
317
- whiteSpace: f(T, "white-space") || "normal"
897
+ fontStyle: h(T, "-unity-font-style") || "normal",
898
+ whiteSpace: h(T, "white-space") || "normal"
318
899
  };
319
900
  N.setMeasureFunc(
320
- (U) => i.measureText(
321
- A,
901
+ (M) => s.measureText(
902
+ I,
322
903
  z,
323
- Number.isFinite(U) ? U : 0
904
+ Number.isFinite(M) ? M : 0
324
905
  )
325
906
  );
326
907
  return;
327
908
  }
328
- let j = N;
329
- if (I.parts.length > 0) {
330
- r || (r = !0, o.push({
909
+ let F = N;
910
+ if (D.parts.length > 0) {
911
+ l || (l = !0, r.push({
331
912
  kind: "version-dependent",
332
- message: `<${m.name.local}> is drawn with the implicit child elements Unity builds for it, and their geometry was measured on Unity ${Y}. Other versions may differ; see src/controls/theme.ts.`,
333
- node: m.id
913
+ message: `<${w.name.local}> is drawn with the implicit child elements Unity builds for it, and their geometry was measured on Unity ${Z}. Other versions may differ; see src/controls/theme.ts.`,
914
+ node: w.id
334
915
  }));
335
- const R = [], z = [], U = t.get(m.id);
336
- for (const ae of I.parts) {
337
- const le = (U == null ? void 0 : U.get(ae.name)) ?? /* @__PURE__ */ new Map(), H = l.Node.create();
338
- a++, G++, w(H, le, m), j.insertChild(H, j.getChildCount()), j = H, z.push(H), R.push({
339
- name: ae.name,
340
- owner: m.id,
916
+ const R = [], z = [], M = t.get(w.id);
917
+ for (const we of D.parts) {
918
+ const ve = (M == null ? void 0 : M.get(we.name)) ?? /* @__PURE__ */ new Map(), X = i.Node.create();
919
+ a++, K++, y(X, ve, w), F.insertChild(X, F.getChildCount()), F = X, z.push(X), R.push({
920
+ name: we.name,
921
+ owner: w.id,
341
922
  box: { left: 0, top: 0, width: 0, height: 0 },
342
- style: le
923
+ style: ve
343
924
  });
344
925
  }
345
- g.set(m.id, R), s.set(m.id, z);
926
+ c.set(w.id, R), o.set(w.id, z);
346
927
  }
347
- for (const R of m.children) O(R, j);
928
+ for (const R of w.children) O(R, F);
348
929
  }
349
930
  O(e, null);
350
931
  const E = d.get(e);
351
- E.setWidth(i.size.width), E.setHeight(i.size.height), E.setPositionType(J.Relative), E.calculateLayout(i.size.width, i.size.height, ce.LTR);
352
- const M = /* @__PURE__ */ new Map();
353
- for (let m = 0; m < 3; m++) {
354
- let k = !1;
355
- for (const [T, N] of g) {
356
- const I = s.get(T);
357
- if (I === void 0) continue;
358
- const C = N.findIndex((U) => U.name === "unity-content-viewport"), A = N.findIndex((U) => U.name === "unity-content-container");
359
- if (C === -1 || A === -1) continue;
360
- const _ = I[C].getComputedLayout(), R = I[A].getComputedLayout().height > _.height + 0.01, z = Pe(R);
361
- (M.get(T) ?? 0) !== z && (M.set(T, z), I[C].setMargin(P.Right, z), k = !0);
932
+ E.setWidth(s.size.width), E.setHeight(s.size.height), E.setPositionType(ne.Relative), E.calculateLayout(s.size.width, s.size.height, be.LTR);
933
+ const C = /* @__PURE__ */ new Map();
934
+ for (let w = 0; w < 3; w++) {
935
+ let S = !1;
936
+ for (const [T, N] of c) {
937
+ const D = o.get(T);
938
+ if (D === void 0) continue;
939
+ const A = N.findIndex((M) => M.name === "unity-content-viewport"), I = N.findIndex((M) => M.name === "unity-content-container");
940
+ if (A === -1 || I === -1) continue;
941
+ const _ = D[A].getComputedLayout(), R = D[I].getComputedLayout().height > _.height + 0.01, z = Et(R);
942
+ (C.get(T) ?? 0) !== z && (C.set(T, z), D[A].setMargin(q.Right, z), S = !0);
362
943
  }
363
- if (!k) break;
364
- E.calculateLayout(i.size.width, i.size.height, ce.LTR);
944
+ if (!S) break;
945
+ E.calculateLayout(s.size.width, s.size.height, be.LTR);
365
946
  }
366
- function D(m, k, T) {
367
- const N = d.get(m);
947
+ function L(w, S, T) {
948
+ const N = d.get(w);
368
949
  if (N === void 0) return;
369
- const I = N.getComputedLayout();
370
- let C = k + I.left, A = T + I.top;
371
- p.set(m.id, { left: C, top: A, width: I.width, height: I.height });
372
- const _ = g.get(m.id), j = s.get(m.id);
373
- _ !== void 0 && j !== void 0 && _.forEach((R, z) => {
374
- const U = j[z].getComputedLayout();
375
- C += U.left, A += U.top, R.box = { left: C, top: A, width: U.width, height: U.height };
950
+ const D = N.getComputedLayout();
951
+ let A = S + D.left, I = T + D.top;
952
+ u.set(w.id, { left: A, top: I, width: D.width, height: D.height });
953
+ const _ = c.get(w.id), F = o.get(w.id);
954
+ _ !== void 0 && F !== void 0 && _.forEach((R, z) => {
955
+ const M = F[z].getComputedLayout();
956
+ A += M.left, I += M.top, R.box = { left: A, top: I, width: M.width, height: M.height };
376
957
  });
377
- for (const R of m.children) D(R, C, A);
958
+ for (const R of w.children) L(R, A, I);
378
959
  }
379
- return D(e, 0, 0), {
380
- boxes: p,
381
- parts: g,
960
+ return L(e, 0, 0), {
961
+ boxes: u,
962
+ parts: c,
382
963
  painted: v,
383
- warnings: o,
964
+ warnings: r,
384
965
  dispose() {
385
- u || (u = !0, E.freeRecursive(), G -= a, d.clear(), s.clear());
966
+ f || (f = !0, E.freeRecursive(), K -= a, d.clear(), o.clear());
386
967
  }
387
968
  };
388
969
  }
389
- const tt = 1.2;
390
- function nt(e) {
970
+ const _t = 1.2;
971
+ function jt(e) {
391
972
  var t;
392
973
  let n = null;
393
974
  if (e !== void 0) {
394
- const i = e.createElement("canvas");
395
- n = ((t = i.getContext) == null ? void 0 : t.call(i, "2d")) ?? null;
975
+ const s = e.createElement("canvas");
976
+ n = ((t = s.getContext) == null ? void 0 : t.call(s, "2d")) ?? null;
396
977
  }
397
- return (i, l, o) => {
398
- const p = l.fontSize * tt, g = (r) => {
978
+ return (s, i, r) => {
979
+ const u = i.fontSize * _t, c = (l) => {
399
980
  if (n === null)
400
- return r.length * l.fontSize * 0.5;
401
- const f = l.fontStyle.includes("bold") ? "bold" : "normal", b = l.fontStyle.includes("italic") ? "italic" : "normal";
402
- return n.font = `${b} ${f} ${l.fontSize}px sans-serif`, n.measureText(r).width;
981
+ return l.length * i.fontSize * 0.5;
982
+ const h = i.fontStyle.includes("bold") ? "bold" : "normal", g = i.fontStyle.includes("italic") ? "italic" : "normal";
983
+ return n.font = `${g} ${h} ${i.fontSize}px sans-serif`, n.measureText(l).width;
403
984
  };
404
- if (!(l.whiteSpace !== "nowrap" && l.whiteSpace !== "pre") || o <= 0) {
405
- const r = i.split(`
985
+ if (!(i.whiteSpace !== "nowrap" && i.whiteSpace !== "pre") || r <= 0) {
986
+ const l = s.split(`
406
987
  `);
407
- return { width: r.reduce((b, c) => Math.max(b, g(c)), 0), height: r.length * p };
988
+ return { width: l.reduce((g, p) => Math.max(g, c(p)), 0), height: l.length * u };
408
989
  }
409
- const d = i.split(/\s+/).filter((r) => r.length > 0);
410
- let s = 1, a = 0, u = 0;
411
- for (const r of d) {
412
- const f = g(r), b = a === 0 ? 0 : g(" ");
413
- a > 0 && a + b + f > o ? (u = Math.max(u, a), s++, a = f) : a += b + f;
990
+ const d = s.split(/\s+/).filter((l) => l.length > 0);
991
+ let o = 1, a = 0, f = 0;
992
+ for (const l of d) {
993
+ const h = c(l), g = a === 0 ? 0 : c(" ");
994
+ a > 0 && a + g + h > r ? (f = Math.max(f, a), o++, a = h) : a += g + h;
414
995
  }
415
- return u = Math.max(u, a), { width: u, height: s * p };
996
+ return f = Math.max(f, a), { width: f, height: o * u };
416
997
  };
417
998
  }
418
- function re(e) {
419
- const n = (t, i) => !Number.isInteger(t) || t < 0 || t > 1114111 || t >= 55296 && t <= 57343 ? i : String.fromCodePoint(t);
420
- return e.replace(/&#x([0-9a-f]+);/gi, (t, i) => n(parseInt(i, 16), t)).replace(/&#(\d+);/g, (t, i) => n(Number(i), t)).replace(/&lt;/g, "<").replace(/&gt;/g, ">").replace(/&quot;/g, '"').replace(/&apos;/g, "'").replace(/&amp;/g, "&");
421
- }
422
- const it = /* @__PURE__ */ new Set([
999
+ const Ft = /* @__PURE__ */ new Set([
423
1000
  "box-shadow",
424
1001
  "filter",
425
1002
  "backdrop-filter",
@@ -435,7 +1012,7 @@ const it = /* @__PURE__ */ new Set([
435
1012
  "float",
436
1013
  "clear",
437
1014
  "border-style"
438
- ]), st = /* @__PURE__ */ new Set([
1015
+ ]), Pt = /* @__PURE__ */ new Set([
439
1016
  "gap",
440
1017
  "row-gap",
441
1018
  "column-gap",
@@ -445,43 +1022,43 @@ const it = /* @__PURE__ */ new Set([
445
1022
  "background-repeat",
446
1023
  "overflow-wrap",
447
1024
  "word-break"
448
- ]), he = ["top", "right", "bottom", "left"], rt = {
1025
+ ]), Ee = ["top", "right", "bottom", "left"], Bt = {
449
1026
  normal: { weight: "normal", style: "normal" },
450
1027
  bold: { weight: "bold", style: "normal" },
451
1028
  italic: { weight: "normal", style: "italic" },
452
1029
  "bold-and-italic": { weight: "bold", style: "italic" }
453
- }, ot = {
1030
+ }, Ht = {
454
1031
  upper: "flex-start",
455
1032
  middle: "center",
456
1033
  lower: "flex-end"
457
- }, at = {
1034
+ }, Vt = {
458
1035
  left: "flex-start",
459
1036
  center: "center",
460
1037
  right: "flex-end"
461
- }, Q = {
1038
+ }, le = {
462
1039
  "stretch-to-fill": "100% 100%",
463
1040
  "scale-and-crop": "cover",
464
1041
  "scale-to-fit": "contain"
465
- }, me = "stretch-to-fill";
466
- function lt(e) {
467
- const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(re(e).trim());
1042
+ }, Ne = "stretch-to-fill";
1043
+ function qt(e) {
1044
+ const n = /^(url|resource)\(\s*(["']?)(.*?)\2\s*\)$/.exec(J(e).trim());
468
1045
  return n === null ? null : { form: n[1], path: n[3] };
469
1046
  }
470
- function ge(e, n, t = {}) {
471
- var b;
472
- const i = {}, l = [], o = (c) => {
473
- var S;
474
- return (S = e.get(c)) == null ? void 0 : S.value;
475
- }, p = (c, S) => {
476
- l.push({ kind: c, message: S, node: n });
1047
+ function De(e, n, t = {}) {
1048
+ var g;
1049
+ const s = {}, i = [], r = (p) => {
1050
+ var b;
1051
+ return (b = e.get(p)) == null ? void 0 : b.value;
1052
+ }, u = (p, b) => {
1053
+ i.push({ kind: p, message: b, node: n });
477
1054
  };
478
- i["box-sizing"] = "border-box";
479
- for (const [c] of e)
480
- it.has(c) ? p("unsupported-property", `${c} does not exist in USS and is ignored`) : st.has(c) && p(
1055
+ s["box-sizing"] = "border-box";
1056
+ for (const [p] of e)
1057
+ Ft.has(p) ? u("unsupported-property", `${p} does not exist in USS and is ignored`) : Pt.has(p) && u(
481
1058
  "version-dependent",
482
- `${c} depends on the Unity version; verify it in your project`
1059
+ `${p} depends on the Unity version; verify it in your project`
483
1060
  );
484
- const g = [
1061
+ const c = [
485
1062
  "background-color",
486
1063
  "color",
487
1064
  "opacity",
@@ -494,269 +1071,269 @@ function ge(e, n, t = {}) {
494
1071
  "font-size",
495
1072
  "transform-origin"
496
1073
  ];
497
- for (const c of g) {
498
- const S = o(c);
499
- S !== void 0 && (i[c] = S);
500
- }
501
- o("display") === "none" && (i.display = "none"), o("overflow") === "hidden" && (i.overflow = "hidden");
502
- for (const c of he) {
503
- const S = o(`border-${c}-width`);
504
- if (S !== void 0 && S !== "0") {
505
- const { length: y, problem: x } = X(S);
506
- y === null || y.kind !== "px" ? p(
1074
+ for (const p of c) {
1075
+ const b = r(p);
1076
+ b !== void 0 && (s[p] = b);
1077
+ }
1078
+ r("display") === "none" && (s.display = "none"), r("overflow") === "hidden" && (s.overflow = "hidden");
1079
+ for (const p of Ee) {
1080
+ const b = r(`border-${p}-width`);
1081
+ if (b !== void 0 && b !== "0") {
1082
+ const { length: k, problem: x } = Q(b);
1083
+ k === null || k.kind !== "px" ? u(
507
1084
  "unsupported-property",
508
- `border-${c}-width: ${x ?? `"${S}" is not a pixel length`}; ignored`
509
- ) : (i[`border-${c}-width`] = `${y.value}px`, i[`border-${c}-style`] = "solid");
1085
+ `border-${p}-width: ${x ?? `"${b}" is not a pixel length`}; ignored`
1086
+ ) : (s[`border-${p}-width`] = `${k.value}px`, s[`border-${p}-style`] = "solid");
510
1087
  }
511
- const h = o(`border-${c}-color`);
512
- h !== void 0 && (i[`border-${c}-color`] = h);
513
- const w = o(`padding-${c}`);
514
- w !== void 0 && w !== "0" && (i[`padding-${c}`] = w);
1088
+ const m = r(`border-${p}-color`);
1089
+ m !== void 0 && (s[`border-${p}-color`] = m);
1090
+ const y = r(`padding-${p}`);
1091
+ y !== void 0 && y !== "0" && (s[`padding-${p}`] = y);
515
1092
  }
516
- for (const c of [
1093
+ for (const p of [
517
1094
  "top-left",
518
1095
  "top-right",
519
1096
  "bottom-right",
520
1097
  "bottom-left"
521
1098
  ]) {
522
- const S = o(`border-${c}-radius`);
523
- S !== void 0 && (i[`border-${c}-radius`] = S);
1099
+ const b = r(`border-${p}-radius`);
1100
+ b !== void 0 && (s[`border-${p}-radius`] = b);
524
1101
  }
525
- const v = o("-unity-font-style");
1102
+ const v = r("-unity-font-style");
526
1103
  if (v !== void 0) {
527
- const c = rt[v];
528
- c === void 0 ? p("unsupported-property", `-unity-font-style: ${v} is not a USS value`) : (i["font-weight"] = c.weight, i["font-style"] = c.style);
1104
+ const p = Bt[v];
1105
+ p === void 0 ? u("unsupported-property", `-unity-font-style: ${v} is not a USS value`) : (s["font-weight"] = p.weight, s["font-style"] = p.style);
529
1106
  }
530
- const d = o("-unity-text-align");
1107
+ const d = r("-unity-text-align");
531
1108
  if (d !== void 0) {
532
- const [c, S] = d.split("-"), h = ot[c ?? ""], w = at[S ?? ""];
533
- h === void 0 || w === void 0 ? p("unsupported-property", `-unity-text-align: ${d} is not a USS value`) : (i["align-items"] = h, i["justify-content"] = w);
534
- }
535
- const s = [], a = o("translate");
536
- a !== void 0 && s.push(`translate(${a.replace(/\s+/, ", ")})`);
537
- const u = o("rotate");
538
- u !== void 0 && s.push(`rotate(${u})`);
539
- const r = o("scale");
540
- r !== void 0 && s.push(`scale(${r.replace(/\s+/, ", ")})`), s.length > 0 && (i.transform = s.join(" "));
541
- const f = o("background-image");
542
- if (f !== void 0 && f !== "none") {
543
- const c = lt(f);
544
- if (c === null)
545
- p("asset-unresolved", `background-image: cannot read "${f}" as an asset path`);
1109
+ const [p, b] = d.split("-"), m = Ht[p ?? ""], y = Vt[b ?? ""];
1110
+ m === void 0 || y === void 0 ? u("unsupported-property", `-unity-text-align: ${d} is not a USS value`) : (s["align-items"] = m, s["justify-content"] = y);
1111
+ }
1112
+ const o = [], a = r("translate");
1113
+ a !== void 0 && o.push(`translate(${a.replace(/\s+/, ", ")})`);
1114
+ const f = r("rotate");
1115
+ f !== void 0 && o.push(`rotate(${f})`);
1116
+ const l = r("scale");
1117
+ l !== void 0 && o.push(`scale(${l.replace(/\s+/, ", ")})`), o.length > 0 && (s.transform = o.join(" "));
1118
+ const h = r("background-image");
1119
+ if (h !== void 0 && h !== "none") {
1120
+ const p = qt(h);
1121
+ if (p === null)
1122
+ u("asset-unresolved", `background-image: cannot read "${h}" as an asset path`);
546
1123
  else {
547
- const { form: S, path: h } = c, w = ((b = t.resolveAsset) == null ? void 0 : b.call(t, h, S)) ?? null;
548
- if (w === null)
549
- i["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)", p("asset-unresolved", `background-image: "${h}" was not resolved`);
1124
+ const { form: b, path: m } = p, y = ((g = t.resolveAsset) == null ? void 0 : g.call(t, m, b)) ?? null;
1125
+ if (y === null)
1126
+ s["background-image"] = "repeating-linear-gradient(45deg, rgba(255,0,255,0.35) 0 6px, rgba(0,0,0,0) 6px 12px)", u("asset-unresolved", `background-image: "${m}" was not resolved`);
550
1127
  else {
551
- i["background-image"] = `url("${w}")`, i["background-repeat"] = o("background-repeat") ?? "no-repeat", i["background-position"] = o("background-position") ?? "center";
552
- const y = o("background-size"), x = o("-unity-background-scale-mode") ?? me, $ = Q[x];
553
- $ === void 0 && p(
1128
+ s["background-image"] = `url("${y}")`, s["background-repeat"] = r("background-repeat") ?? "no-repeat", s["background-position"] = r("background-position") ?? "center";
1129
+ const k = r("background-size"), x = r("-unity-background-scale-mode") ?? Ne, $ = le[x];
1130
+ $ === void 0 && u(
554
1131
  "unsupported-property",
555
- `-unity-background-scale-mode: ${x} is not a USS value; expected one of ${Object.keys(Q).join(", ")}`
556
- ), i["background-size"] = y ?? $ ?? Q[me];
1132
+ `-unity-background-scale-mode: ${x} is not a USS value; expected one of ${Object.keys(le).join(", ")}`
1133
+ ), s["background-size"] = k ?? $ ?? le[Ne];
557
1134
  }
558
1135
  }
559
1136
  }
560
- return o("-unity-background-image-tint-color") !== void 0 && p(
1137
+ return r("-unity-background-image-tint-color") !== void 0 && u(
561
1138
  "unsupported-property",
562
1139
  "-unity-background-image-tint-color has no CSS equivalent and is not drawn"
563
- ), he.some((c) => o(`-unity-slice-${c}`) !== void 0) && p("unsupported-property", "-unity-slice-* (9-slice) is not drawn in this preview"), o("-unity-font-definition") !== void 0 && p(
1140
+ ), Ee.some((p) => r(`-unity-slice-${p}`) !== void 0) && u("unsupported-property", "-unity-slice-* (9-slice) is not drawn in this preview"), r("-unity-font-definition") !== void 0 && u(
564
1141
  "unsupported-property",
565
1142
  "-unity-font-definition names a Unity font asset; the browser default is used"
566
- ), { declarations: i, warnings: l };
567
- }
568
- const ct = "data-uxml-node", ut = "data-uxml-part", dt = "data-uxml-part-owner";
569
- function ft(e, n, t, i, l, o) {
570
- const p = [], g = /* @__PURE__ */ new Map();
571
- function v(u) {
572
- const r = i.get(u.id), f = (b) => {
573
- var h;
574
- const c = ((h = r == null ? void 0 : r.get(b)) == null ? void 0 : h.value) ?? ee[b] ?? "0", { length: S } = X(c);
575
- return S !== null && S.kind === "px" ? S.value : 0;
1143
+ ), { declarations: s, warnings: i };
1144
+ }
1145
+ const Gt = "data-uxml-node", Jt = "data-uxml-part", Xt = "data-uxml-part-owner";
1146
+ function Yt(e, n, t, s, i, r) {
1147
+ const u = [], c = /* @__PURE__ */ new Map();
1148
+ function v(f) {
1149
+ const l = s.get(f.id), h = (g) => {
1150
+ var m;
1151
+ const p = ((m = l == null ? void 0 : l.get(g)) == null ? void 0 : m.value) ?? ae[g] ?? "0", { length: b } = Q(p);
1152
+ return b !== null && b.kind === "px" ? b.value : 0;
576
1153
  };
577
- return { left: f("border-left-width"), top: f("border-top-width") };
1154
+ return { left: h("border-left-width"), top: h("border-top-width") };
578
1155
  }
579
- function d(u) {
580
- const r = (f) => {
581
- var S;
582
- const b = ((S = u.style.get(f)) == null ? void 0 : S.value) ?? ee[f] ?? "0", { length: c } = X(b);
583
- return c !== null && c.kind === "px" ? c.value : 0;
1156
+ function d(f) {
1157
+ const l = (h) => {
1158
+ var b;
1159
+ const g = ((b = f.style.get(h)) == null ? void 0 : b.value) ?? ae[h] ?? "0", { length: p } = Q(g);
1160
+ return p !== null && p.kind === "px" ? p.value : 0;
584
1161
  };
585
- return { left: r("border-left-width"), top: r("border-top-width") };
1162
+ return { left: l("border-left-width"), top: l("border-top-width") };
586
1163
  }
587
- function s(u, r, f) {
1164
+ function o(f, l, h) {
588
1165
  var E;
589
- const b = n.get(u.id);
590
- if (b === void 0) return null;
591
- const c = o.document.createElement("div");
592
- c.setAttribute(ct, String(u.id));
593
- const S = i.get(u.id) ?? /* @__PURE__ */ new Map(), h = ge(S, u.id, o);
594
- p.push(...h.warnings);
595
- const w = r === null ? 0 : b.left - r.left - f.left, y = r === null ? 0 : b.top - r.top - f.top, x = {
1166
+ const g = n.get(f.id);
1167
+ if (g === void 0) return null;
1168
+ const p = r.document.createElement("div");
1169
+ p.setAttribute(Gt, String(f.id));
1170
+ const b = s.get(f.id) ?? /* @__PURE__ */ new Map(), m = De(b, f.id, r);
1171
+ u.push(...m.warnings);
1172
+ const y = l === null ? 0 : g.left - l.left - h.left, k = l === null ? 0 : g.top - l.top - h.top, x = {
596
1173
  position: "absolute",
597
- left: `${w}px`,
598
- top: `${y}px`,
599
- width: `${b.width}px`,
600
- height: `${b.height}px`,
1174
+ left: `${y}px`,
1175
+ top: `${k}px`,
1176
+ width: `${g.width}px`,
1177
+ height: `${g.height}px`,
601
1178
  margin: "0",
602
- ...h.declarations
1179
+ ...m.declarations
603
1180
  };
604
- for (const [M, D] of Object.entries(x))
605
- c.style.setProperty(M, D);
606
- const { spec: $ } = F(u), O = (E = u.attributes.find((M) => M.name === "text")) == null ? void 0 : E.value;
1181
+ for (const [C, L] of Object.entries(x))
1182
+ p.style.setProperty(C, L);
1183
+ const { spec: $ } = H(f), O = (E = f.attributes.find((C) => C.name === "text")) == null ? void 0 : E.value;
607
1184
  if ($.hasText && O !== void 0 && O.length > 0)
608
- c.style.setProperty("display", h.declarations.display ?? "flex"), h.declarations["align-items"] === void 0 && c.style.setProperty("align-items", "flex-start"), h.declarations["justify-content"] === void 0 && c.style.setProperty("justify-content", "flex-start"), c.textContent = re(O);
1185
+ p.style.setProperty("display", m.declarations.display ?? "flex"), m.declarations["align-items"] === void 0 && p.style.setProperty("align-items", "flex-start"), m.declarations["justify-content"] === void 0 && p.style.setProperty("justify-content", "flex-start"), p.textContent = J(O);
609
1186
  else {
610
- let M = c, D = b, m = v(u);
611
- for (const k of t.get(u.id) ?? []) {
612
- const T = o.document.createElement("div");
613
- T.setAttribute(ut, k.name), T.setAttribute(dt, String(u.id));
614
- const N = ge(k.style, u.id, o);
615
- p.push(...N.warnings);
616
- const I = {
1187
+ let C = p, L = g, w = v(f);
1188
+ for (const S of t.get(f.id) ?? []) {
1189
+ const T = r.document.createElement("div");
1190
+ T.setAttribute(Jt, S.name), T.setAttribute(Xt, String(f.id));
1191
+ const N = De(S.style, f.id, r);
1192
+ u.push(...N.warnings);
1193
+ const D = {
617
1194
  position: "absolute",
618
- left: `${k.box.left - D.left - m.left}px`,
619
- top: `${k.box.top - D.top - m.top}px`,
620
- width: `${k.box.width}px`,
621
- height: `${k.box.height}px`,
1195
+ left: `${S.box.left - L.left - w.left}px`,
1196
+ top: `${S.box.top - L.top - w.top}px`,
1197
+ width: `${S.box.width}px`,
1198
+ height: `${S.box.height}px`,
622
1199
  margin: "0",
623
1200
  ...N.declarations
624
1201
  };
625
- for (const [C, A] of Object.entries(I))
626
- T.style.setProperty(C, A);
627
- M.appendChild(T), M = T, D = k.box, m = d(k);
1202
+ for (const [A, I] of Object.entries(D))
1203
+ T.style.setProperty(A, I);
1204
+ C.appendChild(T), C = T, L = S.box, w = d(S);
628
1205
  }
629
- for (const k of u.children) {
630
- const T = s(k, D, m);
631
- T !== null && M.appendChild(T);
1206
+ for (const S of f.children) {
1207
+ const T = o(S, L, w);
1208
+ T !== null && C.appendChild(T);
632
1209
  }
633
1210
  }
634
- return g.set(u.id, c), c;
1211
+ return c.set(f.id, p), p;
635
1212
  }
636
- l.replaceChildren();
637
- const a = s(e, null, { left: 0, top: 0 });
638
- return a !== null && (a.style.setProperty("position", "relative"), l.appendChild(a)), { warnings: p, elements: g };
1213
+ i.replaceChildren();
1214
+ const a = o(e, null, { left: 0, top: 0 });
1215
+ return a !== null && (a.style.setProperty("position", "relative"), i.appendChild(a)), { warnings: u, elements: c };
639
1216
  }
640
- const we = /[A-Za-z0-9_-]/;
1217
+ const Ae = /[A-Za-z0-9_-]/;
641
1218
  function B(e) {
642
1219
  return e === " " || e === " " || e === `
643
1220
  ` || e === "\r" || e === "\f";
644
1221
  }
645
- function te(e, n, t) {
646
- let i = n, l = 0;
647
- for (; i < e.length; ) {
648
- const o = e[i];
649
- if (o === '"' || o === "'") {
650
- const p = e.indexOf(o, i + 1);
651
- i = p < 0 ? e.length : p + 1;
1222
+ function ce(e, n, t) {
1223
+ let s = n, i = 0;
1224
+ for (; s < e.length; ) {
1225
+ const r = e[s];
1226
+ if (r === '"' || r === "'") {
1227
+ const u = e.indexOf(r, s + 1);
1228
+ s = u < 0 ? e.length : u + 1;
652
1229
  continue;
653
1230
  }
654
- if (o === "/" && e[i + 1] === "*") {
655
- const p = e.indexOf("*/", i + 2);
656
- i = p < 0 ? e.length : p + 2;
1231
+ if (r === "/" && e[s + 1] === "*") {
1232
+ const u = e.indexOf("*/", s + 2);
1233
+ s = u < 0 ? e.length : u + 2;
657
1234
  continue;
658
1235
  }
659
- if (o === "(" || o === "[")
660
- l++;
661
- else if (o === ")" || o === "]")
662
- l > 0 && l--;
663
- else if (l === 0 && t.includes(o))
664
- return i;
665
- i++;
1236
+ if (r === "(" || r === "[")
1237
+ i++;
1238
+ else if (r === ")" || r === "]")
1239
+ i > 0 && i--;
1240
+ else if (i === 0 && t.includes(r))
1241
+ return s;
1242
+ s++;
666
1243
  }
667
1244
  return e.length;
668
1245
  }
669
- function ke(e, n, t) {
670
- let i = n, l = t;
671
- for (; i < l && B(e[i]); ) i++;
672
- for (; l > i && B(e[l - 1]); ) l--;
673
- return { start: i, end: l };
674
- }
675
- function Se(e, n, t, i) {
676
- const l = [];
677
- let o = n;
678
- for (; o < t; ) {
679
- for (; o < t && (B(e[o]) || e.startsWith("/*", o)); )
680
- if (e.startsWith("/*", o)) {
681
- const s = e.indexOf("*/", o + 2);
682
- o = s < 0 ? t : s + 2;
1246
+ function qe(e, n, t) {
1247
+ let s = n, i = t;
1248
+ for (; s < i && B(e[s]); ) s++;
1249
+ for (; i > s && B(e[i - 1]); ) i--;
1250
+ return { start: s, end: i };
1251
+ }
1252
+ function Ge(e, n, t, s) {
1253
+ const i = [];
1254
+ let r = n;
1255
+ for (; r < t; ) {
1256
+ for (; r < t && (B(e[r]) || e.startsWith("/*", r)); )
1257
+ if (e.startsWith("/*", r)) {
1258
+ const o = e.indexOf("*/", r + 2);
1259
+ r = o < 0 ? t : o + 2;
683
1260
  } else
684
- o++;
685
- if (o >= t) break;
686
- if (e[o] === ";") {
687
- o++;
1261
+ r++;
1262
+ if (r >= t) break;
1263
+ if (e[r] === ";") {
1264
+ r++;
688
1265
  continue;
689
1266
  }
690
- const p = o, g = te(e, p, ":;}");
691
- if (g >= t || e[g] !== ":") {
692
- const s = Math.min(g, t);
693
- i == null || i("declaration without a value", p, s), o = s + 1;
1267
+ const u = r, c = ce(e, u, ":;}");
1268
+ if (c >= t || e[c] !== ":") {
1269
+ const o = Math.min(c, t);
1270
+ s == null || s("declaration without a value", u, o), r = o + 1;
694
1271
  continue;
695
1272
  }
696
- const v = Math.min(te(e, g + 1, ";}"), t), d = ke(e, g + 1, v);
697
- l.push({
698
- property: e.slice(p, g).trim(),
1273
+ const v = Math.min(ce(e, c + 1, ";}"), t), d = qe(e, c + 1, v);
1274
+ i.push({
1275
+ property: e.slice(u, c).trim(),
699
1276
  value: e.slice(d.start, d.end),
700
- span: { start: p, end: d.end },
1277
+ span: { start: u, end: d.end },
701
1278
  dirty: !1
702
- }), o = v + 1;
1279
+ }), r = v + 1;
703
1280
  }
704
- return l;
1281
+ return i;
705
1282
  }
706
- function pt(e) {
1283
+ function Kt(e) {
707
1284
  const n = e.span.end - 1 - e.value.length;
708
1285
  return n < e.span.start ? null : n;
709
1286
  }
710
- function oe(e, n = null, t = 0) {
711
- const i = [], l = [];
712
- let o = 0;
713
- function p(h, w, y) {
714
- i.push({
1287
+ function ge(e, n = null, t = 0) {
1288
+ const s = [], i = [];
1289
+ let r = 0;
1290
+ function u(m, y, k) {
1291
+ s.push({
715
1292
  kind: "malformed",
716
- message: h,
717
- at: { in: "uss", sheet: t, span: { start: w, end: y } }
1293
+ message: m,
1294
+ at: { in: "uss", sheet: t, span: { start: y, end: k } }
718
1295
  });
719
1296
  }
720
- function g() {
1297
+ function c() {
721
1298
  for (; ; ) {
722
- for (; B(e[o]); ) o++;
723
- if (e.startsWith("/*", o)) {
724
- const h = e.indexOf("*/", o + 2);
725
- o = h < 0 ? e.length : h + 2;
1299
+ for (; B(e[r]); ) r++;
1300
+ if (e.startsWith("/*", r)) {
1301
+ const m = e.indexOf("*/", r + 2);
1302
+ r = m < 0 ? e.length : m + 2;
726
1303
  continue;
727
1304
  }
728
1305
  return;
729
1306
  }
730
1307
  }
731
- const v = (h, w) => te(e, h, w), d = (h, w) => ke(e, h, w);
732
- function s(h) {
733
- let w = h + 1, y = 1;
734
- for (; w < e.length; ) {
735
- const x = e[w];
1308
+ const v = (m, y) => ce(e, m, y), d = (m, y) => qe(e, m, y);
1309
+ function o(m) {
1310
+ let y = m + 1, k = 1;
1311
+ for (; y < e.length; ) {
1312
+ const x = e[y];
736
1313
  if (x === '"' || x === "'") {
737
- const $ = e.indexOf(x, w + 1);
738
- w = $ < 0 ? e.length : $ + 1;
1314
+ const $ = e.indexOf(x, y + 1);
1315
+ y = $ < 0 ? e.length : $ + 1;
739
1316
  continue;
740
1317
  }
741
- if (x === "/" && e[w + 1] === "*") {
742
- const $ = e.indexOf("*/", w + 2);
743
- w = $ < 0 ? e.length : $ + 2;
1318
+ if (x === "/" && e[y + 1] === "*") {
1319
+ const $ = e.indexOf("*/", y + 2);
1320
+ y = $ < 0 ? e.length : $ + 2;
744
1321
  continue;
745
1322
  }
746
- if (x === "{") y++;
747
- else if (x === "}" && --y === 0) return w + 1;
748
- w++;
1323
+ if (x === "{") k++;
1324
+ else if (x === "}" && --k === 0) return y + 1;
1325
+ y++;
749
1326
  }
750
1327
  return e.length;
751
1328
  }
752
- function a(h) {
753
- let w = h;
754
- for (; w < e.length && we.test(e[w]); ) w++;
755
- return w;
1329
+ function a(m) {
1330
+ let y = m;
1331
+ for (; y < e.length && Ae.test(e[y]); ) y++;
1332
+ return y;
756
1333
  }
757
- function u(h) {
758
- const w = e[h], y = w === "(" ? ")" : "]";
759
- let x = h + 1, $ = 1;
1334
+ function f(m) {
1335
+ const y = e[m], k = y === "(" ? ")" : "]";
1336
+ let x = m + 1, $ = 1;
760
1337
  for (; x < e.length; ) {
761
1338
  const O = e[x];
762
1339
  if (O === '"' || O === "'") {
@@ -764,118 +1341,118 @@ function oe(e, n = null, t = 0) {
764
1341
  x = E < 0 ? e.length : E + 1;
765
1342
  continue;
766
1343
  }
767
- if (O === w) $++;
768
- else if (O === y && --$ === 0) return x + 1;
1344
+ if (O === y) $++;
1345
+ else if (O === k && --$ === 0) return x + 1;
769
1346
  x++;
770
1347
  }
771
1348
  return e.length;
772
1349
  }
773
- function r(h, w) {
774
- const y = [];
775
- let x = h;
776
- for (; x < w; ) {
1350
+ function l(m, y) {
1351
+ const k = [];
1352
+ let x = m;
1353
+ for (; x < y; ) {
777
1354
  const $ = e[x];
778
1355
  if (B($) || $ === ">" || $ === "+" || $ === "~" || $ === ",") break;
779
1356
  if ($ === "*")
780
- y.push({ kind: "universal" }), x++;
1357
+ k.push({ kind: "universal" }), x++;
781
1358
  else if ($ === "." || $ === "#") {
782
1359
  const O = a(x + 1);
783
- y.push(
1360
+ k.push(
784
1361
  $ === "." ? { kind: "class", name: e.slice(x + 1, O) } : { kind: "name", name: e.slice(x + 1, O) }
785
1362
  ), x = O;
786
1363
  } else if ($ === "[") {
787
- const O = Math.min(u(x), w);
788
- y.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
1364
+ const O = Math.min(f(x), y);
1365
+ k.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
789
1366
  } else if ($ === ":")
790
1367
  if (e[x + 1] === ":") {
791
1368
  const O = a(x + 2);
792
- y.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
1369
+ k.push({ kind: "unknown", text: e.slice(x, O) }), x = O;
793
1370
  } else {
794
1371
  const O = a(x + 1);
795
1372
  if (e[O] === "(") {
796
- const E = Math.min(u(O), w);
797
- y.push({ kind: "unknown", text: e.slice(x, E) }), x = E;
1373
+ const E = Math.min(f(O), y);
1374
+ k.push({ kind: "unknown", text: e.slice(x, E) }), x = E;
798
1375
  } else
799
- y.push({ kind: "pseudo", name: e.slice(x + 1, O) }), x = O;
1376
+ k.push({ kind: "pseudo", name: e.slice(x + 1, O) }), x = O;
800
1377
  }
801
- else if (we.test($)) {
1378
+ else if (Ae.test($)) {
802
1379
  const O = a(x);
803
- y.push({ kind: "type", name: e.slice(x, O) }), x = O;
1380
+ k.push({ kind: "type", name: e.slice(x, O) }), x = O;
804
1381
  } else
805
- y.push({ kind: "unknown", text: $ }), x++;
1382
+ k.push({ kind: "unknown", text: $ }), x++;
806
1383
  }
807
- return { simple: y, next: x };
808
- }
809
- function f(h, w) {
810
- const y = d(h, w), x = [];
811
- let $ = "descendant", O = null, E = y.start;
812
- for (; E < y.end; ) {
813
- const M = e[E];
814
- if (B(M)) {
1384
+ return { simple: k, next: x };
1385
+ }
1386
+ function h(m, y) {
1387
+ const k = d(m, y), x = [];
1388
+ let $ = "descendant", O = null, E = k.start;
1389
+ for (; E < k.end; ) {
1390
+ const C = e[E];
1391
+ if (B(C)) {
815
1392
  E++;
816
1393
  continue;
817
1394
  }
818
- if (M === ">") {
1395
+ if (C === ">") {
819
1396
  $ = "child", E++;
820
1397
  continue;
821
1398
  }
822
- if (M === "+" || M === "~") {
823
- O = M, E++;
1399
+ if (C === "+" || C === "~") {
1400
+ O = C, E++;
824
1401
  continue;
825
1402
  }
826
- const { simple: D, next: m } = r(E, y.end);
827
- if (m === E) {
1403
+ const { simple: L, next: w } = l(E, k.end);
1404
+ if (w === E) {
828
1405
  E++;
829
1406
  continue;
830
1407
  }
831
- O !== null && (D.unshift({ kind: "unknown", text: O }), O = null), x.push({ combinator: $, simple: D }), $ = "descendant", E = m;
1408
+ O !== null && (L.unshift({ kind: "unknown", text: O }), O = null), x.push({ combinator: $, simple: L }), $ = "descendant", E = w;
832
1409
  }
833
- return { parts: x, span: y };
1410
+ return { parts: x, span: k };
834
1411
  }
835
- function b(h, w) {
836
- const y = [];
837
- let x = h;
1412
+ function g(m, y) {
1413
+ const k = [];
1414
+ let x = m;
838
1415
  for (; ; ) {
839
- const $ = Math.min(v(x, ","), w);
840
- if (y.push(f(x, $)), $ >= w) break;
1416
+ const $ = Math.min(v(x, ","), y);
1417
+ if (k.push(h(x, $)), $ >= y) break;
841
1418
  x = $ + 1;
842
1419
  }
843
- return y;
1420
+ return k;
844
1421
  }
845
- function c() {
846
- const h = o, w = a(o + 1), y = e.slice(o + 1, w), x = v(w, "{;");
1422
+ function p() {
1423
+ const m = r, y = a(r + 1), k = e.slice(r + 1, y), x = v(y, "{;");
847
1424
  if (x < e.length && e[x] === "{") {
848
- const O = s(x);
849
- return o = O, { kind: "unknown", span: { start: h, end: O } };
1425
+ const O = o(x);
1426
+ return r = O, { kind: "unknown", span: { start: m, end: O } };
850
1427
  }
851
1428
  const $ = x < e.length ? x + 1 : e.length;
852
- if (o = $, y === "import") {
853
- const O = e.slice(w, $), E = /["']([^"']*)["']/.exec(O);
854
- return E === null ? (p("@import without a quoted path", h, $), { kind: "unknown", span: { start: h, end: $ } }) : { kind: "import", url: E[1], span: { start: h, end: $ } };
1429
+ if (r = $, k === "import") {
1430
+ const O = e.slice(y, $), E = /["']([^"']*)["']/.exec(O);
1431
+ return E === null ? (u("@import without a quoted path", m, $), { kind: "unknown", span: { start: m, end: $ } }) : { kind: "import", url: E[1], span: { start: m, end: $ } };
855
1432
  }
856
- return { kind: "unknown", span: { start: h, end: $ } };
857
- }
858
- function S() {
859
- const h = o, w = v(h, "{");
860
- if (w >= e.length)
861
- return p("rule without a block", h, e.length), o = e.length, { kind: "unknown", span: { start: h, end: e.length } };
862
- const y = d(h, w), x = s(w);
863
- (x > e.length || e[x - 1] !== "}") && p("unterminated rule block", h, x);
1433
+ return { kind: "unknown", span: { start: m, end: $ } };
1434
+ }
1435
+ function b() {
1436
+ const m = r, y = v(m, "{");
1437
+ if (y >= e.length)
1438
+ return u("rule without a block", m, e.length), r = e.length, { kind: "unknown", span: { start: m, end: e.length } };
1439
+ const k = d(m, y), x = o(y);
1440
+ (x > e.length || e[x - 1] !== "}") && u("unterminated rule block", m, x);
864
1441
  const $ = {
865
- selectors: b(y.start, y.end),
866
- declarations: Se(e, w + 1, x - 1, p),
867
- span: { start: y.start, end: x },
868
- selectorSpan: y,
1442
+ selectors: g(k.start, k.end),
1443
+ declarations: Ge(e, y + 1, x - 1, u),
1444
+ span: { start: k.start, end: x },
1445
+ selectorSpan: k,
869
1446
  selectorDirty: !1,
870
1447
  declarationsDirty: !1
871
1448
  };
872
- return o = x, { kind: "rule", rule: $ };
1449
+ return r = x, { kind: "rule", rule: $ };
873
1450
  }
874
- for (; g(), !(o >= e.length); )
875
- l.push(e[o] === "@" ? c() : S());
876
- return { sheet: { source: e, origin: n, items: l }, warnings: i };
1451
+ for (; c(), !(r >= e.length); )
1452
+ i.push(e[r] === "@" ? p() : b());
1453
+ return { sheet: { source: e, origin: n, items: i }, warnings: s };
877
1454
  }
878
- function ht(e, n, t) {
1455
+ function Zt(e, n, t) {
879
1456
  switch (e.kind) {
880
1457
  case "universal":
881
1458
  return !0;
@@ -891,61 +1468,61 @@ function ht(e, n, t) {
891
1468
  return !1;
892
1469
  }
893
1470
  }
894
- function mt(e, n, t) {
895
- return e.simple.every((i) => ht(i, n, t));
1471
+ function Qt(e, n, t) {
1472
+ return e.simple.every((s) => Zt(s, n, t));
896
1473
  }
897
- function ne(e, n, t, i) {
898
- if (!mt(e[n], t, i)) return !1;
1474
+ function ue(e, n, t, s) {
1475
+ if (!Qt(e[n], t, s)) return !1;
899
1476
  if (n === 0) return !0;
900
- const l = i.parentOf(t);
1477
+ const i = s.parentOf(t);
901
1478
  if (e[n].combinator === "child")
902
- return l !== null && ne(e, n - 1, l, i);
903
- for (let o = l; o !== null; o = i.parentOf(o))
904
- if (ne(e, n - 1, o, i)) return !0;
1479
+ return i !== null && ue(e, n - 1, i, s);
1480
+ for (let r = i; r !== null; r = s.parentOf(r))
1481
+ if (ue(e, n - 1, r, s)) return !0;
905
1482
  return !1;
906
1483
  }
907
- function $e(e, n, t) {
908
- return e.parts.length === 0 ? !1 : ne(e.parts, e.parts.length - 1, n, t);
1484
+ function Je(e, n, t) {
1485
+ return e.parts.length === 0 ? !1 : ue(e.parts, e.parts.length - 1, n, t);
909
1486
  }
910
- function gt(e) {
1487
+ function en(e) {
911
1488
  const n = [];
912
1489
  for (const t of e.parts)
913
- for (const i of t.simple)
914
- i.kind === "pseudo" && i.name !== "root" && !n.includes(i.name) && n.push(i.name);
1490
+ for (const s of t.simple)
1491
+ s.kind === "pseudo" && s.name !== "root" && !n.includes(s.name) && n.push(s.name);
915
1492
  return n;
916
1493
  }
917
- function wt(e) {
1494
+ function tn(e) {
918
1495
  const n = [];
919
1496
  for (const t of e)
920
- for (const i of t.parts)
921
- for (const l of i.simple) {
922
- if (l.kind !== "name" && l.kind !== "class" || !l.name.startsWith("unity-")) continue;
923
- const o = l.kind === "name" ? `#${l.name}` : `.${l.name}`;
924
- n.includes(o) || n.push(o);
1497
+ for (const s of t.parts)
1498
+ for (const i of s.simple) {
1499
+ if (i.kind !== "name" && i.kind !== "class" || !i.name.startsWith("unity-")) continue;
1500
+ const r = i.kind === "name" ? `#${i.name}` : `.${i.name}`;
1501
+ n.includes(r) || n.push(r);
925
1502
  }
926
1503
  return n;
927
1504
  }
928
- function Te(e) {
1505
+ function Xe(e) {
929
1506
  for (const n of e)
930
1507
  for (const t of n.parts)
931
- for (const i of t.simple)
932
- if (i.kind === "unknown") return i.text;
1508
+ for (const s of t.simple)
1509
+ if (s.kind === "unknown") return s.text;
933
1510
  return null;
934
1511
  }
935
- function bt(e) {
1512
+ function nn(e) {
936
1513
  const n = /* @__PURE__ */ new Map([[e, null]]), t = [e];
937
1514
  for (; t.length > 0; ) {
938
- const i = t.pop();
939
- for (const l of i.children)
940
- n.set(l, i), t.push(l);
1515
+ const s = t.pop();
1516
+ for (const i of s.children)
1517
+ n.set(i, s), t.push(i);
941
1518
  }
942
1519
  return n;
943
1520
  }
944
- function xt(e) {
945
- let n = 0, t = 0, i = 0;
946
- for (const l of e.parts)
947
- for (const o of l.simple)
948
- switch (o.kind) {
1521
+ function sn(e) {
1522
+ let n = 0, t = 0, s = 0;
1523
+ for (const i of e.parts)
1524
+ for (const r of i.simple)
1525
+ switch (r.kind) {
949
1526
  case "name":
950
1527
  n++;
951
1528
  break;
@@ -954,88 +1531,93 @@ function xt(e) {
954
1531
  t++;
955
1532
  break;
956
1533
  case "type":
957
- i++;
1534
+ s++;
958
1535
  break;
959
1536
  }
960
- return [n, t, i];
1537
+ return [n, t, s];
961
1538
  }
962
- function Oe(e, n) {
1539
+ function Ye(e, n) {
963
1540
  return e[0] - n[0] || e[1] - n[1] || e[2] - n[2];
964
1541
  }
965
- const vt = [Number.MAX_SAFE_INTEGER, 0, 0], yt = oe(ye, null, -1).sheet.items.flatMap(
1542
+ const rn = [Number.MAX_SAFE_INTEGER, 0, 0], on = ge(Ve, null, -1).sheet.items.flatMap(
966
1543
  (e, n) => e.kind === "rule" ? [{ rule: e.rule, sheet: -1, item: n, builtin: !0 }] : []
967
1544
  );
968
- function kt(e) {
969
- return ye.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
970
- }
971
- function St(e, n, t, i) {
972
- const l = (t == null ? void 0 : t.activeStates) ?? /* @__PURE__ */ new Set(), o = Object.entries((t == null ? void 0 : t.states) ?? {}), p = [];
973
- for (const [s, a] of o) {
974
- const u = oe(`${s} {}`, null, -1).sheet.items.find((f) => f.kind === "rule"), r = u === void 0 ? s : Te(u.rule.selectors);
975
- if (u === void 0 || r !== null) {
976
- i.push({
1545
+ function ln(e) {
1546
+ return Ve.slice(e.selectorSpan.start, e.selectorSpan.end).trim();
1547
+ }
1548
+ function an(e, n, t, s) {
1549
+ const i = (t == null ? void 0 : t.activeStates) ?? /* @__PURE__ */ new Set(), r = Object.entries((t == null ? void 0 : t.states) ?? {}), u = [];
1550
+ for (const [o, a] of r) {
1551
+ const f = ge(`${o} {}`, null, -1).sheet.items.find((h) => h.kind === "rule"), l = f === void 0 ? o : Xe(f.rule.selectors);
1552
+ if (f === void 0 || l !== null) {
1553
+ s.push({
977
1554
  kind: "unsupported-selector",
978
- message: `states key "${s}" is not a usable USS selector; it is ignored`
1555
+ message: `states key "${o}" is not a usable USS selector; it is ignored`
979
1556
  });
980
1557
  continue;
981
1558
  }
982
- p.push({ selectors: u.rule.selectors, states: a });
983
- }
984
- const g = /* @__PURE__ */ new Map(), v = (s) => s.attributes.some((a) => a.name === "enabled" && a.value === "false"), d = (s, a) => {
985
- const u = a || v(s), r = new Set(l);
986
- u && r.add("disabled");
987
- for (const f of p)
988
- if (f.selectors.some((b) => $e(b, { kind: "element", node: s }, n)))
989
- for (const b of f.states) r.add(b);
990
- g.set(s, r);
991
- for (const f of s.children) d(f, u);
1559
+ u.push({ selectors: f.rule.selectors, states: a });
1560
+ }
1561
+ const c = /* @__PURE__ */ new Map(), v = (o) => o.attributes.some((a) => a.name === "enabled" && a.value === "false"), d = (o, a) => {
1562
+ const f = a || v(o), l = new Set(i);
1563
+ f && l.add("disabled");
1564
+ for (const h of u)
1565
+ if (h.selectors.some((g) => Je(g, { kind: "element", node: o }, n)))
1566
+ for (const g of h.states) l.add(g);
1567
+ c.set(o, l);
1568
+ for (const h of o.children) d(h, f);
992
1569
  };
993
- return d(e.root, !1), g;
1570
+ return d(e.root, !1), c;
994
1571
  }
995
- function $t(e) {
1572
+ function cn(e) {
996
1573
  const n = [], t = /* @__PURE__ */ new Map();
997
- e.sheets.forEach((p, g) => {
998
- p.origin !== null && !t.has(p.origin) && t.set(p.origin, g);
999
- }), n.push(...yt);
1000
- const i = /* @__PURE__ */ new Map(), l = (p, g) => {
1001
- const v = i.get(g) ?? /* @__PURE__ */ new Set();
1002
- if (v.has(p)) return;
1003
- v.add(p), i.set(g, v);
1004
- const d = e.sheets[p];
1005
- d !== void 0 && d.items.forEach((s, a) => {
1006
- if (s.kind === "rule")
1007
- n.push({ rule: s.rule, sheet: p, item: a, scope: g });
1008
- else if (s.kind === "import") {
1009
- const u = s.resolvedSheet ?? t.get(s.url);
1010
- u !== void 0 && l(u, g);
1574
+ e.sheets.forEach((u, c) => {
1575
+ u.origin !== null && !t.has(u.origin) && t.set(u.origin, c);
1576
+ }), n.push(...on);
1577
+ const s = /* @__PURE__ */ new Map(), i = (u, c) => {
1578
+ const v = s.get(c) ?? /* @__PURE__ */ new Set();
1579
+ if (v.has(u)) return;
1580
+ v.add(u), s.set(c, v);
1581
+ const d = e.sheets[u];
1582
+ d !== void 0 && d.items.forEach((o, a) => {
1583
+ if (o.kind === "rule")
1584
+ n.push({ rule: o.rule, sheet: u, item: a, scope: c });
1585
+ else if (o.kind === "import") {
1586
+ const f = o.resolvedSheet ?? t.get(o.url);
1587
+ f !== void 0 && i(f, c);
1011
1588
  }
1012
1589
  });
1013
- }, o = e.styleRoots ?? (e.sheets.length === 0 ? [] : [{ sheet: 0, scope: e.root.id }]);
1014
- for (const p of o) l(p.sheet, p.scope);
1590
+ }, r = e.styleRoots ?? (e.sheets.length === 0 ? [] : [{ sheet: 0, scope: e.root.id }]);
1591
+ for (const u of r) i(u.sheet, u.scope);
1015
1592
  return n;
1016
1593
  }
1017
- function Tt(e, n, t) {
1018
- let i = e;
1019
- for (; i !== null; ) {
1020
- if (i.kind === "element" && i.node.id === n) return !0;
1021
- i = t.parentOf(i);
1594
+ function un(e, n, t) {
1595
+ let s = e;
1596
+ for (; s !== null; ) {
1597
+ if (s.kind === "element" && s.node.id === n) return !0;
1598
+ s = t.parentOf(s);
1022
1599
  }
1023
1600
  return !1;
1024
1601
  }
1025
- function Ot(e) {
1602
+ function dn(e) {
1026
1603
  return e.selectors.some(
1027
- (n) => n.parts.some((t) => t.simple.some((i) => i.kind === "pseudo" && i.name === "root"))
1604
+ (n) => n.parts.some((t) => t.simple.some((s) => s.kind === "pseudo" && s.name === "root"))
1028
1605
  );
1029
1606
  }
1030
- function Ee(e, n) {
1031
- const t = bt(e.root), i = [], l = /* @__PURE__ */ new Set(), o = (r) => {
1032
- var b;
1033
- const f = (b = r.attributes.find((c) => c.name === "class")) == null ? void 0 : b.value;
1034
- return f === void 0 ? [] : f.split(/\s+/).filter((c) => c.length > 0);
1035
- }, p = (r, f) => {
1036
- var b;
1037
- return (b = r.attributes.find((c) => c.name === f)) == null ? void 0 : b.value;
1038
- }, g = {
1607
+ function de(e, n) {
1608
+ var s;
1609
+ const t = (s = e.sheets[n]) == null ? void 0 : s.origin;
1610
+ return typeof t == "string" ? { sourceDocument: t } : {};
1611
+ }
1612
+ function Ke(e, n) {
1613
+ const t = nn(e.root), s = [], i = /* @__PURE__ */ new Set(), r = (l) => {
1614
+ var g;
1615
+ const h = (g = l.attributes.find((p) => p.name === "class")) == null ? void 0 : g.value;
1616
+ return h === void 0 ? [] : h.split(/\s+/).filter((p) => p.length > 0);
1617
+ }, u = (l, h) => {
1618
+ var g;
1619
+ return (g = l.attributes.find((p) => p.name === h)) == null ? void 0 : g.value;
1620
+ }, c = {
1039
1621
  /**
1040
1622
  * The rule the measurement forced.
1041
1623
  *
@@ -1046,225 +1628,251 @@ function Ee(e, n) {
1046
1628
  * owner. That is the hierarchy the dumps show, so descendant selectors like
1047
1629
  * `.panel #unity-content-viewport` behave as they do in Unity.
1048
1630
  */
1049
- parentOf: (r) => {
1050
- if (r.kind === "element") {
1051
- const c = t.get(r.node) ?? null;
1052
- return c === null ? null : { kind: "element", node: c };
1631
+ parentOf: (l) => {
1632
+ if (l.kind === "element") {
1633
+ const p = t.get(l.node) ?? null;
1634
+ return p === null ? null : { kind: "element", node: p };
1053
1635
  }
1054
- if (r.depth === 0) return { kind: "element", node: r.owner };
1055
- const b = F(r.owner).spec.parts[r.depth - 1];
1056
- return { kind: "part", owner: r.owner, name: b.name, depth: r.depth - 1 };
1636
+ if (l.depth === 0) return { kind: "element", node: l.owner };
1637
+ const g = H(l.owner).spec.parts[l.depth - 1];
1638
+ return { kind: "part", owner: l.owner, name: g.name, depth: l.depth - 1 };
1057
1639
  },
1058
- isRoot: (r) => r.kind === "element" && r.node === e.root,
1640
+ isRoot: (l) => l.kind === "element" && l.node === e.root,
1059
1641
  // Unity's parts are VisualElements, so a `VisualElement` rule reaches them.
1060
1642
  // Not measured — `part-type-selector` is the case that will settle it.
1061
- typeNameOf: (r) => r.kind === "element" ? r.node.name.local : "VisualElement",
1062
- idOf: (r) => r.kind === "element" ? p(r.node, "name") : r.name,
1643
+ typeNameOf: (l) => l.kind === "element" ? l.node.name.local : "VisualElement",
1644
+ idOf: (l) => l.kind === "element" ? u(l.node, "name") : l.name,
1063
1645
  // Implicit classes are as real as written ones for matching: in Unity the
1064
1646
  // element genuinely carries them, which is why `.unity-button` in author USS
1065
1647
  // hits a plain `<ui:Button />`. Parts carry classes too in Unity, but which
1066
1648
  // ones is unmeasured, so none are claimed here.
1067
- classesOf: (r) => r.kind === "element" ? [...o(r.node), ...We(r.node)] : []
1068
- }, v = { ...g, statesOf: () => l }, d = St(e, v, n, i), s = {
1069
- ...g,
1649
+ classesOf: (l) => l.kind === "element" ? [...r(l.node), ...$t(l.node)] : []
1650
+ }, v = { ...c, statesOf: () => i }, d = an(e, v, n, s), o = {
1651
+ ...c,
1070
1652
  // A part inherits its owner's states: `SetEnabled(false)` disables the whole
1071
1653
  // subtree, and a part is inside it.
1072
- statesOf: (r) => d.get(r.kind === "element" ? r.node : r.owner) ?? l
1654
+ statesOf: (l) => d.get(l.kind === "element" ? l.node : l.owner) ?? i
1073
1655
  }, a = [];
1074
- let u = !1;
1075
- for (const r of $t(e)) {
1076
- if (r.builtin === !0) {
1077
- a.push(r);
1656
+ let f = !1;
1657
+ for (const l of cn(e)) {
1658
+ if (l.builtin === !0) {
1659
+ a.push(l);
1078
1660
  continue;
1079
1661
  }
1080
- const f = Te(r.rule.selectors);
1081
- if (f !== null) {
1082
- i.push({
1662
+ const h = Xe(l.rule.selectors);
1663
+ if (h !== null) {
1664
+ s.push({
1083
1665
  kind: "unsupported-selector",
1084
- message: `"${f}" is not supported in USS; the whole rule is ignored`,
1085
- at: { in: "uss", sheet: r.sheet, span: r.rule.selectorSpan }
1666
+ message: `"${h}" is not supported in USS; the whole rule is ignored`,
1667
+ at: { in: "uss", sheet: l.sheet, span: l.rule.selectorSpan },
1668
+ ...de(e, l.sheet)
1086
1669
  });
1087
1670
  continue;
1088
1671
  }
1089
- !u && Ot(r.rule) && (u = !0, i.push({
1672
+ !f && dn(l.rule) && (f = !0, s.push({
1090
1673
  kind: "version-dependent",
1091
- message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS. This preview matches it against the <ui:UXML> element; verify against your Unity version.",
1092
- at: { in: "uss", sheet: r.sheet, span: r.rule.selectorSpan }
1093
- })), a.push(r);
1674
+ message: ":root in USS names the element the stylesheet was applied to, not the document root as in CSS. Template stylesheets therefore match their generated TemplateContainer.",
1675
+ at: { in: "uss", sheet: l.sheet, span: l.rule.selectorSpan },
1676
+ ...de(e, l.sheet)
1677
+ })), a.push(l);
1094
1678
  }
1095
- return { ctx: s, usable: a, warnings: i };
1679
+ return { ctx: o, usable: a, warnings: s };
1096
1680
  }
1097
- function Et(e, n) {
1098
- const t = n.attributes.find((l) => l.name === "style");
1681
+ function fn(e, n) {
1682
+ const t = n.attributes.find((i) => i.name === "style");
1099
1683
  if (t === void 0) return [];
1100
- const i = pt(t);
1101
- return i === null ? [] : Se(e.source, i, i + t.value.length);
1102
- }
1103
- function Ne(e, n, t, i) {
1104
- const l = [];
1105
- let o = 0;
1106
- const p = (g, v, d, s, a) => {
1107
- l.push({ property: g, value: v, origin: d, rank: s, specificity: a, order: o++, winner: !1 });
1684
+ const s = Kt(t);
1685
+ return s === null ? [] : Ge(e.source, s, s + t.value.length);
1686
+ }
1687
+ function Ze(e, n, t, s) {
1688
+ const i = [];
1689
+ let r = 0;
1690
+ const u = (c, v, d, o, a) => {
1691
+ i.push({ property: c, value: v, origin: d, rank: o, specificity: a, order: r++, winner: !1 });
1108
1692
  };
1109
1693
  if (n.kind === "part") {
1110
- const g = F(n.owner).spec.parts[n.depth];
1111
- for (const [v, d] of Object.entries((g == null ? void 0 : g.style) ?? {}))
1112
- for (const [s, a] of Z(v, d))
1113
- p(
1114
- s,
1694
+ const c = H(n.owner).spec.parts[n.depth];
1695
+ for (const [v, d] of Object.entries((c == null ? void 0 : c.style) ?? {}))
1696
+ for (const [o, a] of ie(v, d))
1697
+ u(
1698
+ o,
1115
1699
  a,
1116
1700
  {
1117
1701
  kind: "builtin-theme",
1118
1702
  selector: `#${n.name}`,
1119
- property: s,
1120
- unityVersion: Y
1703
+ property: o,
1704
+ unityVersion: Z
1121
1705
  },
1122
1706
  0,
1123
1707
  [0, 0, 0]
1124
1708
  );
1125
1709
  }
1126
- for (const g of t.usable) {
1127
- if (g.scope !== void 0 && !Tt(n, g.scope, t.ctx)) continue;
1128
- let v = null, d = [];
1129
- for (const s of g.rule.selectors) {
1130
- if (!$e(s, n, t.ctx)) continue;
1131
- const a = xt(s);
1132
- (v === null || Oe(a, v) > 0) && (v = a, d = gt(s));
1710
+ for (const c of t.usable) {
1711
+ if (c.scope !== void 0 && !un(n, c.scope, t.ctx)) continue;
1712
+ const v = c.scope === void 0 ? t.ctx : {
1713
+ ...t.ctx,
1714
+ // Unity USS :root names the element this particular stylesheet is
1715
+ // attached to. Template sheets are attached to each generated
1716
+ // TemplateContainer, not to the entry document root.
1717
+ isRoot: (a) => a.kind === "element" && a.node.id === c.scope
1718
+ };
1719
+ let d = null, o = [];
1720
+ for (const a of c.rule.selectors) {
1721
+ if (!Je(a, n, v)) continue;
1722
+ const f = sn(a);
1723
+ (d === null || Ye(f, d) > 0) && (d = f, o = en(a));
1133
1724
  }
1134
- v !== null && (i == null || i.add(g), g.rule.declarations.forEach((s, a) => {
1135
- for (const [u, r] of Z(s.property, s.value)) {
1136
- const f = g.builtin === !0 ? {
1725
+ d !== null && (s == null || s.add(c), c.rule.declarations.forEach((a, f) => {
1726
+ var l, h, g;
1727
+ for (const [p, b] of ie(a.property, a.value)) {
1728
+ const m = c.builtin === !0 ? {
1137
1729
  kind: "builtin-theme",
1138
- selector: kt(g.rule),
1139
- property: u,
1140
- unityVersion: Y
1730
+ selector: ln(c.rule),
1731
+ property: p,
1732
+ unityVersion: Z
1141
1733
  } : {
1142
1734
  kind: "rule",
1143
- sheet: g.sheet,
1144
- item: g.item,
1145
- declIndex: a,
1735
+ sheet: c.sheet,
1736
+ item: c.item,
1737
+ declIndex: f,
1738
+ ...((l = e.sheets[c.sheet]) == null ? void 0 : l.origin) === null || ((h = e.sheets[c.sheet]) == null ? void 0 : h.origin) === void 0 ? {} : { sourceDocument: e.sheets[c.sheet].origin },
1739
+ ...((g = e.sheets[c.sheet]) == null ? void 0 : g.sourceDocumentFrom) === void 0 ? {} : { sourceDocumentFrom: e.sheets[c.sheet].sourceDocumentFrom },
1146
1740
  // Omitted rather than set to [] when unconditional, so the
1147
1741
  // common case stays the shape it has always been.
1148
- ...d.length > 0 ? { states: d } : {}
1742
+ ...o.length > 0 ? { states: o } : {}
1149
1743
  };
1150
- p(u, r, f, g.builtin === !0 ? 0 : 1, v);
1744
+ u(p, b, m, c.builtin === !0 ? 0 : 1, d);
1151
1745
  }
1152
1746
  }));
1153
1747
  }
1154
1748
  if (n.kind === "element") {
1155
- const g = n.node;
1156
- Et(e, g).forEach((v, d) => {
1157
- for (const [s, a] of Z(v.property, v.value))
1158
- p(s, a, { kind: "inline", node: g.id, declIndex: d }, 1, vt);
1749
+ const c = n.node;
1750
+ fn(e, c).forEach((v, d) => {
1751
+ var o;
1752
+ for (const [a, f] of ie(v.property, v.value))
1753
+ u(
1754
+ a,
1755
+ f,
1756
+ {
1757
+ kind: "inline",
1758
+ node: ((o = c.derived) == null ? void 0 : o.instance) ?? c.sourceNode ?? c.id,
1759
+ declIndex: d,
1760
+ ...typeof c.sourceDocument == "string" ? { sourceDocument: c.sourceDocument } : {},
1761
+ ...c.sourceDocumentFrom === void 0 ? {} : { sourceDocumentFrom: c.sourceDocumentFrom }
1762
+ },
1763
+ 1,
1764
+ rn
1765
+ );
1159
1766
  });
1160
1767
  }
1161
- return l;
1768
+ return i;
1162
1769
  }
1163
- function Ie(e) {
1770
+ function Qe(e) {
1164
1771
  const n = /* @__PURE__ */ new Map();
1165
1772
  for (const t of e) {
1166
- const i = n.get(t.property);
1167
- if (i === void 0) {
1773
+ const s = n.get(t.property);
1774
+ if (s === void 0) {
1168
1775
  n.set(t.property, t);
1169
1776
  continue;
1170
1777
  }
1171
- if (t.rank !== i.rank) {
1172
- t.rank > i.rank && n.set(t.property, t);
1778
+ if (t.rank !== s.rank) {
1779
+ t.rank > s.rank && n.set(t.property, t);
1173
1780
  continue;
1174
1781
  }
1175
- const l = Oe(t.specificity, i.specificity);
1176
- (l > 0 || l === 0 && t.order > i.order) && n.set(t.property, t);
1782
+ const i = Ye(t.specificity, s.specificity);
1783
+ (i > 0 || i === 0 && t.order > s.order) && n.set(t.property, t);
1177
1784
  }
1178
1785
  for (const t of n.values()) t.winner = !0;
1179
1786
  return n;
1180
1787
  }
1181
- const Nt = /var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)/;
1182
- function ie(e, n, t = /* @__PURE__ */ new Set()) {
1183
- var l;
1184
- let i = e;
1185
- for (let o = 0; o < 32; o++) {
1186
- const p = Nt.exec(i);
1187
- if (p === null) return i;
1188
- const g = p[1], v = (l = p[2]) == null ? void 0 : l.trim();
1189
- if (t.has(g)) return null;
1190
- const d = /* @__PURE__ */ new Set([...t, g]), s = n.get(g), a = s !== void 0 ? ie(s, n, d) : v !== void 0 && v.length > 0 ? ie(v, n, d) : null;
1788
+ const pn = /var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)/;
1789
+ function fe(e, n, t = /* @__PURE__ */ new Set()) {
1790
+ var i;
1791
+ let s = e;
1792
+ for (let r = 0; r < 32; r++) {
1793
+ const u = pn.exec(s);
1794
+ if (u === null) return s;
1795
+ const c = u[1], v = (i = u[2]) == null ? void 0 : i.trim();
1796
+ if (t.has(c)) return null;
1797
+ const d = /* @__PURE__ */ new Set([...t, c]), o = n.get(c), a = o !== void 0 ? fe(o, n, d) : v !== void 0 && v.length > 0 ? fe(v, n, d) : null;
1191
1798
  if (a === null) return null;
1192
- i = i.slice(0, p.index) + a + i.slice(p.index + p[0].length);
1799
+ s = s.slice(0, u.index) + a + s.slice(u.index + u[0].length);
1193
1800
  }
1194
1801
  return null;
1195
1802
  }
1196
- function It(e, n) {
1197
- const t = Ee(e, n), i = [...t.warnings], l = /* @__PURE__ */ new Map();
1198
- let o = !1;
1199
- const p = /* @__PURE__ */ new Map(), g = /* @__PURE__ */ new Set(), v = (s, a, u) => {
1200
- const r = Ne(e, s, t, g);
1201
- !o && r.some((h) => h.origin.kind === "builtin-theme") && (o = !0);
1202
- const f = Ie(r), b = /* @__PURE__ */ new Map();
1203
- for (const [h, w] of a)
1204
- h.startsWith("--") && b.set(h, w.value);
1205
- for (const [h, w] of f)
1206
- h.startsWith("--") && b.set(h, w.value);
1207
- const c = /* @__PURE__ */ new Map();
1208
- for (const [h, w] of a) c.set(h, w);
1209
- for (const [h, w] of f) {
1210
- const y = ie(w.value, b);
1211
- if (y === null) {
1212
- i.push({
1803
+ function hn(e, n) {
1804
+ const t = Ke(e, n), s = [...t.warnings], i = /* @__PURE__ */ new Map();
1805
+ let r = !1;
1806
+ const u = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set(), v = (o, a, f) => {
1807
+ const l = Ze(e, o, t, c);
1808
+ !r && l.some((m) => m.origin.kind === "builtin-theme") && (r = !0);
1809
+ const h = Qe(l), g = /* @__PURE__ */ new Map();
1810
+ for (const [m, y] of a)
1811
+ m.startsWith("--") && g.set(m, y.value);
1812
+ for (const [m, y] of h)
1813
+ m.startsWith("--") && g.set(m, y.value);
1814
+ const p = /* @__PURE__ */ new Map();
1815
+ for (const [m, y] of a) p.set(m, y);
1816
+ for (const [m, y] of h) {
1817
+ const k = fe(y.value, g);
1818
+ if (k === null) {
1819
+ s.push({
1213
1820
  kind: "unsupported-property",
1214
- message: `${h}: var() reference could not be resolved; declaration dropped`,
1215
- node: u
1821
+ message: `${m}: var() reference could not be resolved; declaration dropped`,
1822
+ node: f
1216
1823
  });
1217
1824
  continue;
1218
1825
  }
1219
- c.set(h, { value: y, origin: w.origin });
1826
+ p.set(m, { value: k, origin: y.origin });
1220
1827
  }
1221
- const S = /* @__PURE__ */ new Map();
1222
- for (const [h, w] of c)
1223
- He(h) && S.set(h, {
1224
- value: w.value,
1225
- origin: { kind: "inherited", from: u, origin: w.origin }
1828
+ const b = /* @__PURE__ */ new Map();
1829
+ for (const [m, y] of p)
1830
+ Dt(m) && b.set(m, {
1831
+ value: y.value,
1832
+ origin: { kind: "inherited", from: f, origin: y.origin }
1226
1833
  });
1227
- return { computed: c, forChildren: S };
1228
- }, d = (s, a) => {
1229
- const u = v({ kind: "element", node: s }, a, s.id);
1230
- l.set(s.id, u.computed);
1231
- let r = u.forChildren;
1232
- const f = F(s).spec.parts;
1233
- if (f.length > 0) {
1234
- const b = /* @__PURE__ */ new Map();
1235
- f.forEach((c, S) => {
1236
- const h = v(
1237
- { kind: "part", owner: s, name: c.name, depth: S },
1238
- r,
1239
- s.id
1834
+ return { computed: p, forChildren: b };
1835
+ }, d = (o, a) => {
1836
+ const f = v({ kind: "element", node: o }, a, o.id);
1837
+ i.set(o.id, f.computed);
1838
+ let l = f.forChildren;
1839
+ const h = H(o).spec.parts;
1840
+ if (h.length > 0) {
1841
+ const g = /* @__PURE__ */ new Map();
1842
+ h.forEach((p, b) => {
1843
+ const m = v(
1844
+ { kind: "part", owner: o, name: p.name, depth: b },
1845
+ l,
1846
+ o.id
1240
1847
  );
1241
- b.set(c.name, h.computed), r = h.forChildren;
1242
- }), p.set(s.id, b);
1848
+ g.set(p.name, m.computed), l = m.forChildren;
1849
+ }), u.set(o.id, g);
1243
1850
  }
1244
- for (const b of s.children) d(b, r);
1851
+ for (const g of o.children) d(g, l);
1245
1852
  };
1246
- d(e.root, /* @__PURE__ */ new Map()), o && i.push({
1853
+ d(e.root, /* @__PURE__ */ new Map()), r && s.push({
1247
1854
  kind: "version-dependent",
1248
- message: `Unity's control defaults were applied, as measured on ${Y} (Unity ships these as a theme stylesheet). Other versions may use different values; see src/controls/theme.ts.`
1855
+ message: `Unity's control defaults were applied, as measured on ${Z} (Unity ships these as a theme stylesheet). Other versions may use different values; see src/controls/theme.ts.`
1249
1856
  });
1250
- for (const s of t.usable) {
1251
- if (s.builtin === !0 || g.has(s)) continue;
1252
- const a = wt(s.rule.selectors);
1253
- a.length !== 0 && i.push({
1857
+ for (const o of t.usable) {
1858
+ if (o.builtin === !0 || c.has(o)) continue;
1859
+ const a = tn(o.rule.selectors);
1860
+ a.length !== 0 && s.push({
1254
1861
  kind: "unsupported-selector",
1255
- message: `${a.join(", ")} matched nothing. Those names belong to the elements a control builds for itself, and only controls with a renderer of their own have them — ${Be().join(", ")}. Anything else is drawn as a plain box and has no parts to style.`,
1256
- at: { in: "uss", sheet: s.sheet, span: s.rule.selectorSpan }
1862
+ message: `${a.join(", ")} matched nothing. Those names belong to the elements a control builds for itself, and only controls with a renderer of their own have them — ${Tt().join(", ")}. Anything else is drawn as a plain box and has no parts to style.`,
1863
+ at: { in: "uss", sheet: o.sheet, span: o.rule.selectorSpan },
1864
+ ...de(e, o.sheet)
1257
1865
  });
1258
1866
  }
1259
- return { styles: l, partStyles: p, warnings: i };
1867
+ return { styles: i, partStyles: u, warnings: s };
1260
1868
  }
1261
- function jt(e, n, t, i) {
1262
- const l = Ee(e, i), o = Ne(e, { kind: "element", node: n }, l).filter(
1263
- (p) => p.property === t
1869
+ function Sn(e, n, t, s) {
1870
+ const i = Ke(e, s), r = Ze(e, { kind: "element", node: n }, i).filter(
1871
+ (u) => u.property === t
1264
1872
  );
1265
- return Ie(o), o;
1873
+ return Qe(r), r;
1266
1874
  }
1267
- const Wt = [
1875
+ const $n = [
1268
1876
  {
1269
1877
  id: "text-metrics",
1270
1878
  kind: "unreproducible",
@@ -1284,376 +1892,226 @@ const Wt = [
1284
1892
  detail: "The yoga-layout version this package depends on resolves a main-axis percentage against an indefinite parent differently from the Yoga vendored inside Unity 6000.0.40f1. Not configurable: no available setting reproduces Unity's answer without breaking cases that currently match. Fully deterministic and pinned to a case in docs/accuracy.md — this always reproduces the same way, it just cannot be fixed from inside this repository."
1285
1893
  }
1286
1894
  ];
1287
- function be(e) {
1288
- return e !== void 0 && /[A-Za-z0-9_.:-]/.test(e);
1289
- }
1290
- function xe(e) {
1291
- return e !== void 0 && /[A-Za-z_]/.test(e);
1292
- }
1293
- function Ct(e) {
1294
- return e === " " || e === " " || e === `
1295
- ` || e === "\r";
1296
- }
1297
- function At(e) {
1298
- const n = [];
1299
- let t = 0, i = 0;
1300
- const l = () => i++;
1301
- function o(a, u, r) {
1302
- n.push({
1303
- kind: "malformed",
1304
- message: a,
1305
- at: { in: "uxml", span: { start: u, end: r } }
1306
- });
1307
- }
1308
- function p() {
1309
- for (; Ct(e[t]); ) t++;
1310
- }
1311
- function g() {
1312
- for (; ; ) {
1313
- const a = e.indexOf("<", t);
1314
- if (a < 0) {
1315
- t = e.length;
1316
- return;
1317
- }
1318
- const u = e[a + 1];
1319
- if (u === "!") {
1320
- if (e.startsWith("<!--", a)) {
1321
- const r = e.indexOf("-->", a + 4);
1322
- t = r < 0 ? e.length : r + 3;
1323
- } else if (e.startsWith("<![CDATA[", a)) {
1324
- const r = e.indexOf("]]>", a + 9);
1325
- t = r < 0 ? e.length : r + 3;
1326
- } else {
1327
- const r = e.indexOf(">", a);
1328
- t = r < 0 ? e.length : r + 1;
1329
- }
1330
- continue;
1331
- }
1332
- if (u === "?") {
1333
- const r = e.indexOf("?>", a + 2);
1334
- t = r < 0 ? e.length : r + 2;
1335
- continue;
1336
- }
1337
- t = a;
1338
- return;
1339
- }
1340
- }
1341
- function v() {
1342
- const a = t;
1343
- for (; be(e[t]); ) t++;
1344
- const u = e.slice(a, t), r = u.indexOf(":");
1345
- return r < 0 ? { prefix: null, local: u } : { prefix: u.slice(0, r), local: u.slice(r + 1) };
1346
- }
1347
- function d() {
1348
- const a = t;
1349
- for (; be(e[t]); ) t++;
1350
- if (t === a) return null;
1351
- const u = e.slice(a, t), r = t;
1352
- if (p(), e[t] !== "=")
1353
- return t = r, o(`attribute "${u}" has no value`, a, r), { name: u, value: "", span: { start: a, end: r } };
1354
- t++, p();
1355
- const f = e[t];
1356
- if (f !== '"' && f !== "'")
1357
- return o(`attribute "${u}" has an unquoted value`, a, t), { name: u, value: "", span: { start: a, end: t } };
1358
- t++;
1359
- const b = t, c = e.indexOf(f, t);
1360
- return c < 0 ? (o(`attribute "${u}" has an unterminated value`, a, e.length), t = e.length, { name: u, value: e.slice(b), span: { start: a, end: t } }) : (t = c + 1, { name: u, value: e.slice(b, c), span: { start: a, end: t } });
1361
- }
1362
- function s() {
1363
- const a = t;
1364
- t++;
1365
- const u = v(), r = [];
1366
- let f = !1;
1367
- for (; ; ) {
1368
- p();
1369
- const y = e[t];
1370
- if (y === void 0) {
1371
- o("unterminated open tag", a, e.length);
1372
- break;
1373
- }
1374
- if (y === ">") {
1375
- t++;
1376
- break;
1377
- }
1378
- if (y === "/" && e[t + 1] === ">") {
1379
- t += 2, f = !0;
1380
- break;
1381
- }
1382
- const x = d();
1383
- if (x === null) {
1384
- t++;
1385
- continue;
1386
- }
1387
- r.push(x);
1388
- }
1389
- const b = { start: a, end: t };
1390
- if (f)
1391
- return {
1392
- id: l(),
1393
- name: u,
1394
- attributes: r,
1395
- children: [],
1396
- spans: { openTag: b, inner: { start: t, end: t }, closeTag: null },
1397
- tagDirty: !1,
1398
- childrenDirty: !1
1399
- };
1400
- const c = t, S = [];
1401
- for (; ; ) {
1402
- if (g(), t >= e.length) {
1403
- o(`unterminated element <${Ce(u)}>`, a, e.length);
1404
- break;
1405
- }
1406
- const y = e[t + 1];
1407
- if (y === "/") break;
1408
- if (!xe(y)) {
1409
- t++;
1410
- continue;
1411
- }
1412
- S.push(s());
1413
- }
1414
- const h = t;
1415
- let w = null;
1416
- if (e.startsWith("</", t)) {
1417
- const y = e.indexOf(">", t), x = y < 0 ? e.length : y + 1;
1418
- y < 0 && o("unterminated end tag", t, x), w = { start: t, end: x }, t = x;
1419
- }
1420
- return {
1421
- id: l(),
1422
- name: u,
1423
- attributes: r,
1424
- children: S,
1425
- spans: { openTag: b, inner: { start: c, end: h }, closeTag: w },
1426
- tagDirty: !1,
1427
- childrenDirty: !1
1428
- };
1429
- }
1430
- return g(), t < e.length && xe(e[t + 1]) ? { root: s(), warnings: n } : (o("no root element", 0, 0), {
1431
- root: {
1432
- id: l(),
1433
- name: { prefix: null, local: "" },
1434
- attributes: [],
1435
- children: [],
1436
- spans: { openTag: { start: 0, end: 0 }, inner: { start: 0, end: 0 }, closeTag: null },
1437
- tagDirty: !1,
1438
- childrenDirty: !1
1439
- },
1440
- warnings: n
1441
- });
1442
- }
1443
- function Ce(e) {
1444
- return e.prefix === null ? e.local : `${e.prefix}:${e.local}`;
1445
- }
1446
- function Rt(e, n) {
1895
+ function mn(e, n) {
1447
1896
  const t = (d) => e.slice(d.start, d.end);
1448
- function i(d) {
1897
+ function s(d) {
1449
1898
  return d.spans.closeTag !== null ? d.spans.closeTag.end : Math.max(d.spans.openTag.end, d.spans.inner.end);
1450
1899
  }
1451
- function l(d) {
1900
+ function i(d) {
1452
1901
  return d.includes('"') ? d.includes("'") ? `"${d.replace(/"/g, "&quot;")}"` : `'${d}'` : `"${d}"`;
1453
1902
  }
1454
- function o(d) {
1455
- const s = d.attributes.map((u) => ` ${u.name}=${l(u.value)}`).join(""), a = Ce(d.name);
1456
- return d.spans.closeTag === null ? `<${a}${s} />` : `<${a}${s}>`;
1903
+ function r(d) {
1904
+ const o = d.attributes.map((f) => ` ${f.name}=${i(f.value)}`).join(""), a = Ce(d.name);
1905
+ return d.spans.closeTag === null ? `<${a}${o} />` : `<${a}${o}>`;
1457
1906
  }
1458
- function p(d) {
1459
- var r, f;
1460
- const s = t(d.spans.inner), a = ((r = /^[ \t]*\r?\n[ \t]*/.exec(s)) == null ? void 0 : r[0]) ?? "", u = ((f = /\r?\n[ \t]*$/.exec(s)) == null ? void 0 : f[0]) ?? "";
1461
- return { between: a, before: a, after: u };
1907
+ function u(d) {
1908
+ var l, h;
1909
+ const o = t(d.spans.inner), a = ((l = /^[ \t]*\r?\n[ \t]*/.exec(o)) == null ? void 0 : l[0]) ?? "", f = ((h = /\r?\n[ \t]*$/.exec(o)) == null ? void 0 : h[0]) ?? "";
1910
+ return { between: a, before: a, after: f };
1462
1911
  }
1463
- function g(d) {
1464
- const { inner: s } = d.spans;
1465
- if (d.children.length === 0) return t(s);
1912
+ function c(d) {
1913
+ const { inner: o } = d.spans;
1914
+ if (d.children.length === 0) return t(o);
1466
1915
  if (d.childrenDirty) {
1467
- const { between: r, before: f, after: b } = p(d);
1468
- return f + d.children.map(v).join(r) + b;
1916
+ const { between: l, before: h, after: g } = u(d);
1917
+ return h + d.children.map(v).join(l) + g;
1469
1918
  }
1470
- let a = "", u = s.start;
1471
- for (const r of d.children)
1472
- a += e.slice(u, r.spans.openTag.start), a += v(r), u = i(r);
1473
- return a + e.slice(u, s.end);
1919
+ let a = "", f = o.start;
1920
+ for (const l of d.children)
1921
+ a += e.slice(f, l.spans.openTag.start), a += v(l), f = s(l);
1922
+ return a + e.slice(f, o.end);
1474
1923
  }
1475
1924
  function v(d) {
1476
- const s = d.tagDirty ? o(d) : t(d.spans.openTag), a = d.spans.closeTag === null ? "" : t(d.spans.closeTag);
1477
- return s + g(d) + a;
1925
+ const o = d.tagDirty ? r(d) : t(d.spans.openTag), a = d.spans.closeTag === null ? "" : t(d.spans.closeTag);
1926
+ return o + c(d) + a;
1478
1927
  }
1479
- return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(i(n));
1928
+ return e.slice(0, n.spans.openTag.start) + v(n) + e.slice(s(n));
1480
1929
  }
1481
- function Mt(e) {
1482
- const n = e.source, t = (s) => n.slice(s.start, s.end);
1483
- function i(s) {
1484
- return s.parts.map((a, u) => {
1485
- const r = u === 0 ? "" : a.combinator === "child" ? " > " : " ", f = a.simple.map((b) => {
1486
- switch (b.kind) {
1930
+ function gn(e) {
1931
+ const n = e.source, t = (o) => n.slice(o.start, o.end);
1932
+ function s(o) {
1933
+ return o.parts.map((a, f) => {
1934
+ const l = f === 0 ? "" : a.combinator === "child" ? " > " : " ", h = a.simple.map((g) => {
1935
+ switch (g.kind) {
1487
1936
  case "universal":
1488
1937
  return "*";
1489
1938
  case "type":
1490
- return b.name;
1939
+ return g.name;
1491
1940
  case "class":
1492
- return `.${b.name}`;
1941
+ return `.${g.name}`;
1493
1942
  case "name":
1494
- return `#${b.name}`;
1943
+ return `#${g.name}`;
1495
1944
  case "pseudo":
1496
- return `:${b.name}`;
1945
+ return `:${g.name}`;
1497
1946
  case "unknown":
1498
- return b.text;
1947
+ return g.text;
1499
1948
  }
1500
1949
  }).join("");
1501
- return r + f;
1950
+ return l + h;
1502
1951
  }).join("");
1503
1952
  }
1504
- function l(s) {
1505
- var c, S;
1506
- const a = s.declarations[0];
1953
+ function i(o) {
1954
+ var p, b;
1955
+ const a = o.declarations[0];
1507
1956
  if (a === void 0) return { between: "", before: "", after: "" };
1508
- const u = n.lastIndexOf(`
1509
- `, a.span.start), r = u < 0 ? "" : n.slice(u, a.span.start), f = n.slice(s.selectorSpan.end, s.span.end), b = ((S = (c = /\r?\n[ \t]*\}$/.exec(f)) == null ? void 0 : c[0]) == null ? void 0 : S.replace(/\}$/, "")) ?? "";
1510
- return { between: `;${r}`, before: r, after: `;${b}` };
1511
- }
1512
- function o(s) {
1513
- const a = s.selectorDirty ? s.selectors.map(i).join(", ") : t(s.selectorSpan);
1514
- if (s.declarations.length === 0)
1515
- return a + n.slice(s.selectorSpan.end, s.span.end);
1516
- const u = n.slice(s.selectorSpan.end, s.declarations[0].span.start);
1517
- if (s.declarationsDirty) {
1518
- const { between: b, before: c, after: S } = l(s), h = u.slice(0, u.indexOf("{") + 1), w = s.declarations.map(p).join(b);
1519
- return `${a}${h}${c}${w}${S}}`;
1957
+ const f = n.lastIndexOf(`
1958
+ `, a.span.start), l = f < 0 ? "" : n.slice(f, a.span.start), h = n.slice(o.selectorSpan.end, o.span.end), g = ((b = (p = /\r?\n[ \t]*\}$/.exec(h)) == null ? void 0 : p[0]) == null ? void 0 : b.replace(/\}$/, "")) ?? "";
1959
+ return { between: `;${l}`, before: l, after: `;${g}` };
1960
+ }
1961
+ function r(o) {
1962
+ const a = o.selectorDirty ? o.selectors.map(s).join(", ") : t(o.selectorSpan);
1963
+ if (o.declarations.length === 0)
1964
+ return a + n.slice(o.selectorSpan.end, o.span.end);
1965
+ const f = n.slice(o.selectorSpan.end, o.declarations[0].span.start);
1966
+ if (o.declarationsDirty) {
1967
+ const { between: g, before: p, after: b } = i(o), m = f.slice(0, f.indexOf("{") + 1), y = o.declarations.map(u).join(g);
1968
+ return `${a}${m}${p}${y}${b}}`;
1520
1969
  }
1521
- let r = a, f = s.selectorSpan.end;
1522
- for (const b of s.declarations)
1523
- r += n.slice(f, b.span.start), r += p(b), f = b.span.end;
1524
- return r + n.slice(f, s.span.end);
1970
+ let l = a, h = o.selectorSpan.end;
1971
+ for (const g of o.declarations)
1972
+ l += n.slice(h, g.span.start), l += u(g), h = g.span.end;
1973
+ return l + n.slice(h, o.span.end);
1525
1974
  }
1526
- function p(s) {
1527
- return s.dirty ? `${s.property}: ${s.value}` : t(s.span);
1975
+ function u(o) {
1976
+ return o.dirty ? `${o.property}: ${o.value}` : t(o.span);
1528
1977
  }
1529
- function g(s) {
1530
- return s.kind === "rule" ? o(s.rule) : t(s.span);
1978
+ function c(o) {
1979
+ return o.kind === "rule" ? r(o.rule) : t(o.span);
1531
1980
  }
1532
1981
  let v = "", d = 0;
1533
- for (const s of e.items) {
1534
- const a = s.kind === "rule" ? s.rule.span : s.span;
1535
- v += n.slice(d, a.start), v += g(s), d = a.end;
1982
+ for (const o of e.items) {
1983
+ const a = o.kind === "rule" ? o.rule.span : o.span;
1984
+ v += n.slice(d, a.start), v += c(o), d = a.end;
1536
1985
  }
1537
1986
  return v + n.slice(d);
1538
1987
  }
1539
- function Ae(e, n = []) {
1988
+ ot(
1989
+ (e, n) => n === void 0 ? Ie(e) : Ie(e, void 0, { resolveImport: n })
1990
+ );
1991
+ function et(e, n = []) {
1540
1992
  var t;
1541
- for (const i of e.children) {
1542
- if (i.name.local === "Style") {
1543
- const l = (t = i.attributes.find((o) => o.name === "src")) == null ? void 0 : t.value;
1544
- l !== void 0 && l.length > 0 && n.push({ url: re(l), scope: e.id });
1993
+ for (const s of e.children) {
1994
+ if (s.name.local === "Style") {
1995
+ const i = (t = s.attributes.find((r) => r.name === "src")) == null ? void 0 : t.value;
1996
+ i !== void 0 && i.length > 0 && n.push({ url: J(i), scope: e.id });
1545
1997
  }
1546
- Ae(i, n);
1998
+ et(s, n);
1547
1999
  }
1548
2000
  return n;
1549
2001
  }
1550
- function Ut(e) {
2002
+ function wn(e) {
1551
2003
  return e.startsWith("project://") || e.startsWith("/");
1552
2004
  }
1553
- function Bt(e, n, t) {
1554
- var v, d;
1555
- const i = At(e), l = [...i.warnings], o = [], p = [], g = [];
1556
- for (const { url: s, scope: a } of Ae(i.root)) {
1557
- const u = ((v = t == null ? void 0 : t.resolveImport) == null ? void 0 : v.call(t, s, null)) ?? null;
1558
- if (u === null) {
1559
- l.push({
2005
+ function Ie(e, n, t) {
2006
+ var d, o;
2007
+ const s = Re(e), i = [...s.warnings], r = [], u = [], c = [];
2008
+ for (const { url: a, scope: f } of et(s.root)) {
2009
+ const l = ((d = t == null ? void 0 : t.resolveImport) == null ? void 0 : d.call(t, a, null)) ?? null;
2010
+ if (l === null) {
2011
+ i.push({
1560
2012
  kind: "import-unresolved",
1561
- message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${s}"> was not loaded: pass resolveImport to read it, or pass the stylesheet text directly. Until then this document renders unstyled.` : `<Style src="${s}"> could not be resolved`,
1562
- node: i.root.id
2013
+ message: (t == null ? void 0 : t.resolveImport) === void 0 ? `<Style src="${a}"> was not loaded: pass resolveImport to read it, or pass the stylesheet text directly. Until then this document renders unstyled.` : `<Style src="${a}"> could not be resolved`,
2014
+ node: s.root.id
1563
2015
  });
1564
2016
  continue;
1565
2017
  }
1566
- g.push({ text: u, origin: s, scope: a });
1567
- }
1568
- if (n !== void 0 || g.length > 0) {
1569
- const s = /* @__PURE__ */ new Map(), a = [];
1570
- let u = 0;
1571
- for (const r of g) {
1572
- const f = u++;
1573
- a.push({ text: r.text, origin: r.origin, sheet: f }), p.push({ sheet: f, scope: r.scope });
2018
+ c.push({ text: l, origin: a, scope: f });
2019
+ }
2020
+ if (n !== void 0 || c.length > 0) {
2021
+ const a = /* @__PURE__ */ new Map(), f = [];
2022
+ let l = 0;
2023
+ for (const h of c) {
2024
+ const g = l++;
2025
+ f.push({ text: h.text, origin: h.origin, sheet: g }), u.push({ sheet: g, scope: h.scope });
1574
2026
  }
1575
2027
  if (n !== void 0) {
1576
- const r = u++;
1577
- a.push({ text: n, origin: null, sheet: r }), p.push({ sheet: r, scope: i.root.id });
2028
+ const h = l++;
2029
+ f.push({ text: n, origin: null, sheet: h }), u.push({ sheet: h, scope: s.root.id });
1578
2030
  }
1579
- for (; a.length > 0; ) {
1580
- const r = a.shift(), f = r.sheet, b = oe(r.text, r.origin, f);
1581
- o.push(b.sheet), l.push(...b.warnings);
1582
- for (const c of b.sheet.items) {
1583
- if (c.kind !== "import") continue;
1584
- const S = Ut(c.url) ? c.url : JSON.stringify([c.url, r.origin]);
1585
- if (s.has(S)) {
1586
- const y = s.get(S);
1587
- y != null && (c.resolvedSheet = y);
2031
+ for (; f.length > 0; ) {
2032
+ const h = f.shift(), g = h.sheet, p = ge(h.text, h.origin, g);
2033
+ r.push(p.sheet), i.push(...p.warnings);
2034
+ for (const b of p.sheet.items) {
2035
+ if (b.kind !== "import") continue;
2036
+ const m = wn(b.url) ? b.url : JSON.stringify([b.url, h.origin]);
2037
+ if (a.has(m)) {
2038
+ const x = a.get(m);
2039
+ x != null && (b.resolvedSheet = x);
1588
2040
  continue;
1589
2041
  }
1590
- s.set(S, null);
1591
- const h = ((d = t == null ? void 0 : t.resolveImport) == null ? void 0 : d.call(t, c.url, r.origin)) ?? null;
1592
- if (h === null) {
1593
- l.push({
2042
+ a.set(m, null);
2043
+ const y = ((o = t == null ? void 0 : t.resolveImport) == null ? void 0 : o.call(t, b.url, h.origin)) ?? null;
2044
+ if (y === null) {
2045
+ i.push({
1594
2046
  kind: "import-unresolved",
1595
- message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${c.url}" was not loaded: pass resolveImport to read it` : `@import "${c.url}" could not be resolved`,
1596
- at: { in: "uss", sheet: f, span: c.span }
2047
+ message: (t == null ? void 0 : t.resolveImport) === void 0 ? `@import "${b.url}" was not loaded: pass resolveImport to read it` : `@import "${b.url}" could not be resolved`,
2048
+ at: { in: "uss", sheet: g, span: b.span }
1597
2049
  });
1598
2050
  continue;
1599
2051
  }
1600
- const w = u++;
1601
- s.set(S, w), c.resolvedSheet = w, a.push({ text: h, origin: c.url, sheet: w });
2052
+ const k = l++;
2053
+ a.set(m, k), b.resolvedSheet = k, f.push({ text: y, origin: b.url, sheet: k });
1602
2054
  }
1603
2055
  }
1604
2056
  }
1605
- return { source: e, root: i.root, sheets: o, styleRoots: p, warnings: l };
2057
+ const v = { source: e, root: s.root, sheets: r, styleRoots: u, warnings: i };
2058
+ return lt(v, t == null ? void 0 : t.resolveImport), v;
1606
2059
  }
1607
- function Ft(e) {
2060
+ function Tn(e) {
1608
2061
  const n = e.sheets[0];
1609
2062
  return {
1610
- uxml: Rt(e.source, e.root),
2063
+ uxml: mn(e.source, e.root),
1611
2064
  // Only the sheet passed to `parse` round-trips. `@import`ed sheets (Phase 3)
1612
2065
  // are separate files and are not this function's to write.
1613
- uss: n === void 0 ? "" : Mt(n)
2066
+ uss: n === void 0 ? "" : gn(n)
1614
2067
  };
1615
2068
  }
1616
- function Pt(e, n, t) {
1617
- const i = n.ownerDocument, l = (t == null ? void 0 : t.size) ?? {
2069
+ function On(e, n, t) {
2070
+ const s = n.ownerDocument, i = (t == null ? void 0 : t.size) ?? {
1618
2071
  width: n.clientWidth,
1619
2072
  height: n.clientHeight
1620
- }, o = It(e, {
2073
+ }, r = bt(e), u = r.document, c = hn(u, {
1621
2074
  ...(t == null ? void 0 : t.activeStates) === void 0 ? {} : { activeStates: t.activeStates },
1622
2075
  ...(t == null ? void 0 : t.states) === void 0 ? {} : { states: t.states }
1623
- }), p = (t == null ? void 0 : t.measureText) ?? nt(i), g = et(e.root, o.styles, o.partStyles, { size: l, measureText: p });
1624
- let v;
2076
+ }), v = (t == null ? void 0 : t.measureText) ?? jt(s), d = zt(u.root, c.styles, c.partStyles, {
2077
+ size: i,
2078
+ measureText: v
2079
+ });
2080
+ let o;
1625
2081
  try {
1626
- v = ft(e.root, g.boxes, g.parts, o.styles, n, {
1627
- document: i,
2082
+ o = Yt(u.root, d.boxes, d.parts, c.styles, n, {
2083
+ document: s,
1628
2084
  resolveAsset: t == null ? void 0 : t.resolveAsset
1629
2085
  });
1630
- } catch (s) {
1631
- throw g.dispose(), s;
2086
+ } catch (f) {
2087
+ throw d.dispose(), f;
1632
2088
  }
1633
- let d = !1;
2089
+ let a = !1;
1634
2090
  return {
1635
- warnings: [...o.warnings, ...g.warnings, ...v.warnings],
1636
- elements: v.elements,
1637
- boxes: g.boxes,
2091
+ warnings: [...r.warnings, ...c.warnings, ...d.warnings, ...o.warnings],
2092
+ elements: o.elements,
2093
+ boxes: d.boxes,
1638
2094
  dispose() {
1639
- d || (d = !0, g.dispose(), n.replaceChildren());
2095
+ a || (a = !0, d.dispose(), n.replaceChildren());
1640
2096
  }
1641
2097
  };
1642
2098
  }
1643
2099
  export {
1644
- Wt as KNOWN_DIVERGENCES,
1645
- ct as NODE_ATTRIBUTE,
1646
- ut as PART_ATTRIBUTE,
1647
- dt as PART_OWNER_ATTRIBUTE,
1648
- nt as createDefaultMeasureText,
1649
- jt as explainProperty,
1650
- He as isInherited,
1651
- zt as isLayoutEngineReady,
1652
- _t as liveNodeCount,
1653
- Lt as loadLayoutEngine,
1654
- Bt as parse,
1655
- Pt as render,
1656
- It as resolveStyles,
1657
- Ft as serialize,
1658
- Be as supportedControlNames
2100
+ $n as KNOWN_DIVERGENCES,
2101
+ Gt as NODE_ATTRIBUTE,
2102
+ Jt as PART_ATTRIBUTE,
2103
+ Xt as PART_OWNER_ATTRIBUTE,
2104
+ bn as collectDependencies,
2105
+ jt as createDefaultMeasureText,
2106
+ bt as expandTemplates,
2107
+ Sn as explainProperty,
2108
+ Dt as isInherited,
2109
+ xn as isLayoutEngineReady,
2110
+ kn as liveNodeCount,
2111
+ yn as loadLayoutEngine,
2112
+ Ie as parse,
2113
+ On as render,
2114
+ hn as resolveStyles,
2115
+ Tn as serialize,
2116
+ Tt as supportedControlNames
1659
2117
  };