@jasonshimmy/custom-elements-runtime 2.8.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/README.md +223 -73
  2. package/dist/css-utils-Cg4o1MqY.js +643 -0
  3. package/dist/css-utils-Cg4o1MqY.js.map +1 -0
  4. package/dist/css-utils-RqkyBWft.cjs +576 -0
  5. package/dist/css-utils-RqkyBWft.cjs.map +1 -0
  6. package/dist/custom-elements-runtime.cjs.js +3 -3
  7. package/dist/custom-elements-runtime.cjs.js.map +1 -1
  8. package/dist/custom-elements-runtime.dom-jit-css.cjs.js +7 -0
  9. package/dist/custom-elements-runtime.dom-jit-css.cjs.js.map +1 -0
  10. package/dist/custom-elements-runtime.dom-jit-css.es.js +136 -0
  11. package/dist/custom-elements-runtime.dom-jit-css.es.js.map +1 -0
  12. package/dist/custom-elements-runtime.es.js +105 -97
  13. package/dist/custom-elements-runtime.es.js.map +1 -1
  14. package/dist/custom-elements-runtime.event-bus.cjs.js +1 -1
  15. package/dist/custom-elements-runtime.event-bus.cjs.js.map +1 -1
  16. package/dist/custom-elements-runtime.event-bus.es.js +62 -46
  17. package/dist/custom-elements-runtime.event-bus.es.js.map +1 -1
  18. package/dist/custom-elements-runtime.jit-css.cjs.js +2 -0
  19. package/dist/custom-elements-runtime.jit-css.cjs.js.map +1 -0
  20. package/dist/custom-elements-runtime.jit-css.es.js +37 -0
  21. package/dist/custom-elements-runtime.jit-css.es.js.map +1 -0
  22. package/dist/custom-elements-runtime.router.cjs.js +20 -20
  23. package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
  24. package/dist/custom-elements-runtime.router.es.js +472 -458
  25. package/dist/custom-elements-runtime.router.es.js.map +1 -1
  26. package/dist/custom-elements-runtime.ssr-middleware.cjs.js +2 -0
  27. package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -0
  28. package/dist/custom-elements-runtime.ssr-middleware.es.js +63 -0
  29. package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -0
  30. package/dist/custom-elements-runtime.ssr.cjs.js +3 -1
  31. package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
  32. package/dist/custom-elements-runtime.ssr.es.js +137 -24
  33. package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
  34. package/dist/custom-elements-runtime.store.cjs.js +1 -1
  35. package/dist/custom-elements-runtime.store.cjs.js.map +1 -1
  36. package/dist/custom-elements-runtime.store.es.js +21 -16
  37. package/dist/custom-elements-runtime.store.es.js.map +1 -1
  38. package/dist/custom-elements-runtime.transitions.cjs.js +1 -1
  39. package/dist/custom-elements-runtime.transitions.cjs.js.map +1 -1
  40. package/dist/custom-elements-runtime.transitions.es.js +279 -7
  41. package/dist/custom-elements-runtime.transitions.es.js.map +1 -1
  42. package/dist/custom-elements-runtime.vite-plugin.cjs.js +2 -0
  43. package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -0
  44. package/dist/custom-elements-runtime.vite-plugin.es.js +105 -0
  45. package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -0
  46. package/dist/dom-jit-css.d.ts +66 -0
  47. package/dist/event-bus.d.ts +3 -1
  48. package/dist/hooks-B50HhrHh.cjs +6 -0
  49. package/dist/hooks-B50HhrHh.cjs.map +1 -0
  50. package/dist/hooks-Cze3o-F7.js +1462 -0
  51. package/dist/hooks-Cze3o-F7.js.map +1 -0
  52. package/dist/index.d.ts +6 -3
  53. package/dist/jit-css.d.ts +30 -0
  54. package/dist/namespace-helpers-D4wC2-qA.js +61 -0
  55. package/dist/namespace-helpers-D4wC2-qA.js.map +1 -0
  56. package/dist/namespace-helpers-ckeEOxpR.cjs +2 -0
  57. package/dist/namespace-helpers-ckeEOxpR.cjs.map +1 -0
  58. package/dist/router/matcher.d.ts +14 -0
  59. package/dist/router/types.d.ts +4 -2
  60. package/dist/runtime/component/factory.d.ts +16 -2
  61. package/dist/runtime/css-utils.d.ts +33 -0
  62. package/dist/runtime/discovery-state.d.ts +3 -0
  63. package/dist/runtime/hooks.d.ts +78 -0
  64. package/dist/runtime/hydration.d.ts +33 -0
  65. package/dist/runtime/jit-hooks.d.ts +28 -0
  66. package/dist/runtime/render-bridge.d.ts +37 -0
  67. package/dist/runtime/scheduler.d.ts +3 -4
  68. package/dist/runtime/secure-expression-evaluator.d.ts +0 -1
  69. package/dist/runtime/ssr-context.d.ts +45 -0
  70. package/dist/runtime/style.d.ts +84 -26
  71. package/dist/runtime/template-compiler/lru-cache.d.ts +0 -3
  72. package/dist/runtime/types.d.ts +18 -0
  73. package/dist/runtime/vdom-helpers.d.ts +0 -1
  74. package/dist/runtime/vdom-ssr-dsd.d.ts +58 -0
  75. package/dist/ssr-middleware.d.ts +125 -0
  76. package/dist/ssr.d.ts +120 -16
  77. package/dist/{transitions-DMJXs_tY.js → style-BmyOIMcU.js} +904 -1344
  78. package/dist/style-BmyOIMcU.js.map +1 -0
  79. package/dist/style-D40DsIqJ.cjs +55 -0
  80. package/dist/style-D40DsIqJ.cjs.map +1 -0
  81. package/dist/style.css +1 -1
  82. package/dist/template-compiler-Cshhqxyd.cjs +23 -0
  83. package/dist/template-compiler-Cshhqxyd.cjs.map +1 -0
  84. package/dist/template-compiler-DtpNsqE-.js +3744 -0
  85. package/dist/template-compiler-DtpNsqE-.js.map +1 -0
  86. package/dist/variables.css +1 -1
  87. package/dist/vite-plugin.d.ts +142 -0
  88. package/package.json +60 -6
  89. package/dist/namespace-helpers-Ctd_h7j2.cjs +0 -5
  90. package/dist/namespace-helpers-Ctd_h7j2.cjs.map +0 -1
  91. package/dist/namespace-helpers-DhLBqt-7.js +0 -1009
  92. package/dist/namespace-helpers-DhLBqt-7.js.map +0 -1
  93. package/dist/template-compiler-Bvx02nAT.js +0 -4020
  94. package/dist/template-compiler-Bvx02nAT.js.map +0 -1
  95. package/dist/template-compiler-bj-MFC_Y.cjs +0 -23
  96. package/dist/template-compiler-bj-MFC_Y.cjs.map +0 -1
  97. package/dist/transitions-DMJXs_tY.js.map +0 -1
  98. package/dist/transitions-f4KfN29T.cjs +0 -330
  99. package/dist/transitions-f4KfN29T.cjs.map +0 -1
@@ -0,0 +1,3744 @@
1
+ import { C as z, D as X, l as O, E as Re, F as x, G as F, H as Ge, I as ft, c as Ue, J as Ce, K as Ye, L as Et, M as St, N as Xe, O as Qe, f as Ct, P as kt } from "./hooks-Cze3o-F7.js";
2
+ import { resetWhenCounter as et } from "./custom-elements-runtime.directives.es.js";
3
+ import { d as W, a as te } from "./logger-BvkEbVM4.js";
4
+ import { s as K, r as Z, T as _t, S as At, a as we, i as Tt } from "./namespace-helpers-D4wC2-qA.js";
5
+ import { i as wt, p as Lt, g as Nt, a as $e, m as ke, b as tt, s as Mt } from "./css-utils-Cg4o1MqY.js";
6
+ import { getTransitionStyleSheet as he } from "./custom-elements-runtime.transitions.es.js";
7
+ function jt(e, s, t) {
8
+ if (t)
9
+ for (const [r, n] of Object.entries(t)) {
10
+ let c, o = {};
11
+ if (Array.isArray(n) ? (c = n[0], o = n[1] || {}) : c = n, s.set(r, {
12
+ callback: c,
13
+ options: o,
14
+ oldValue: z(e, r)
15
+ }), o.immediate)
16
+ try {
17
+ const i = z(e, r);
18
+ c(i, void 0, e);
19
+ } catch (i) {
20
+ W(`Error in immediate watcher for "${r}":`, i);
21
+ }
22
+ }
23
+ }
24
+ function $t(e, s, t, r) {
25
+ const n = (o, i) => {
26
+ if (o === i) return !0;
27
+ if (typeof o != typeof i || typeof o != "object" || o === null || i === null) return !1;
28
+ if (Array.isArray(o) && Array.isArray(i))
29
+ return o.length !== i.length ? !1 : o.every((d, C) => n(d, i[C]));
30
+ const f = o, b = i, y = Object.keys(f || {}), m = Object.keys(b || {});
31
+ return y.length !== m.length ? !1 : y.every((d) => n(f[d], b[d]));
32
+ }, c = s.get(t);
33
+ if (c && !n(r, c.oldValue))
34
+ try {
35
+ c.callback(r, c.oldValue, e), c.oldValue = r;
36
+ } catch (o) {
37
+ W(`Error in watcher for "${t}":`, o);
38
+ }
39
+ for (const [o, i] of s.entries())
40
+ if (i.options.deep && t.startsWith(o + "."))
41
+ try {
42
+ const f = z(e, o);
43
+ n(f, i.oldValue) || (i.callback(f, i.oldValue, e), i.oldValue = f);
44
+ } catch (f) {
45
+ W(`Error in deep watcher for "${o}":`, f);
46
+ }
47
+ }
48
+ function We(e, s) {
49
+ return s === Boolean ? e === "" || e === "true" : s === Number ? Number(e) : e;
50
+ }
51
+ function Pt(e, s, t) {
52
+ if (s)
53
+ for (const r in s) {
54
+ const n = s[r], c = X(r), o = e.getAttribute(c);
55
+ if (n.type === Function && typeof e[r] == "function")
56
+ t[r] = e[r];
57
+ else if (o !== null)
58
+ t[r] = We(o, n.type);
59
+ else if (typeof e[r] < "u")
60
+ try {
61
+ const i = e[r];
62
+ if (n.type === String && i && typeof i == "object")
63
+ try {
64
+ t[r] = We(String(i), n.type);
65
+ } catch {
66
+ t[r] = i;
67
+ }
68
+ else n.type === Boolean && typeof i == "boolean" || n.type === Number && typeof i == "number" || n.type === Function && typeof i == "function" ? t[r] = i : t[r] = We(String(i), n.type);
69
+ } catch {
70
+ t[r] = e[r];
71
+ }
72
+ else "default" in n && n.default !== void 0 && (t[r] = n.default);
73
+ }
74
+ }
75
+ function Ot(e, s, t) {
76
+ if (!s.props) {
77
+ try {
78
+ const r = t?._hookCallbacks?.props || {}, n = Array.from(
79
+ /* @__PURE__ */ new Set([
80
+ ...Object.keys(e || {}),
81
+ ...Object.keys(r || {})
82
+ ])
83
+ );
84
+ for (const c of n) {
85
+ if (typeof c != "string" || c.startsWith("_")) continue;
86
+ const o = Object.getOwnPropertyDescriptor(t, c);
87
+ if (!(!Object.prototype.hasOwnProperty.call(
88
+ r,
89
+ c
90
+ ) && o && (o.get || o.set || !o.configurable)))
91
+ try {
92
+ Object.defineProperty(t, c, {
93
+ enumerable: !0,
94
+ configurable: !0,
95
+ get() {
96
+ try {
97
+ const f = X(c), b = e.getAttribute(f);
98
+ if (b !== null)
99
+ return b;
100
+ const y = e[c];
101
+ let m;
102
+ return O(y) || y && typeof y == "object" && "value" in y && !(y instanceof Node) ? m = y.value : m = y, m;
103
+ } catch {
104
+ return e[c];
105
+ }
106
+ }
107
+ });
108
+ } catch {
109
+ }
110
+ }
111
+ } catch {
112
+ }
113
+ return;
114
+ }
115
+ Pt(e, s.props, t);
116
+ }
117
+ function nt(e, s, t, r) {
118
+ e.onConnected && !t && (e.onConnected(s), r(!0));
119
+ }
120
+ function xt(e, s, t, r, n, c, o, i) {
121
+ e.onDisconnected && e.onDisconnected(s), t.forEach((f) => f()), r(), n(), c(!1), o(null), i(!1);
122
+ }
123
+ function Ht(e, s, t, r, n) {
124
+ e.onAttributeChanged && e.onAttributeChanged(s, t, r, n);
125
+ }
126
+ class Y {
127
+ static cleanupFunctions = /* @__PURE__ */ new WeakMap();
128
+ /**
129
+ * Add an event listener with automatic cleanup tracking
130
+ */
131
+ static addListener(s, t, r, n) {
132
+ s.addEventListener(t, r, n);
133
+ const o = {
134
+ event: t,
135
+ handler: r,
136
+ wrapper: r,
137
+ options: n,
138
+ cleanup: () => s.removeEventListener(t, r, n),
139
+ addedAt: Date.now()
140
+ };
141
+ this.cleanupFunctions.has(s) || this.cleanupFunctions.set(s, []), this.cleanupFunctions.get(s).push(o);
142
+ }
143
+ /**
144
+ * Remove a specific event listener
145
+ */
146
+ static removeListener(s, t, r, n) {
147
+ s.removeEventListener(t, r, n);
148
+ const c = this.cleanupFunctions.get(s);
149
+ if (c)
150
+ for (let o = 0; o < c.length; o++) {
151
+ const i = c[o];
152
+ if (i.event === t && i.handler === r) {
153
+ c.splice(o, 1), c.length === 0 && this.cleanupFunctions.delete(s);
154
+ return;
155
+ }
156
+ }
157
+ }
158
+ /**
159
+ * Clean up all event listeners for an element
160
+ */
161
+ static cleanup(s) {
162
+ const t = this.cleanupFunctions.get(s);
163
+ t && (t.forEach((r) => {
164
+ try {
165
+ r.cleanup();
166
+ } catch {
167
+ }
168
+ }), this.cleanupFunctions.delete(s));
169
+ }
170
+ /**
171
+ * Clean up all tracked event listeners (useful for testing)
172
+ */
173
+ static cleanupAll() {
174
+ this.cleanupFunctions = /* @__PURE__ */ new WeakMap();
175
+ }
176
+ /**
177
+ * Check if an element has any tracked event listeners
178
+ */
179
+ static hasListeners(s) {
180
+ const t = this.cleanupFunctions.get(s);
181
+ return !!(t && t.length > 0);
182
+ }
183
+ /**
184
+ * Get the number of tracked event listeners for an element
185
+ */
186
+ static getListenerCount(s) {
187
+ const t = this.cleanupFunctions.get(s);
188
+ return t ? t.length : 0;
189
+ }
190
+ /**
191
+ * Return listener metadata stored for the element (test/debug only)
192
+ */
193
+ static getListenerInfo(s) {
194
+ const t = this.cleanupFunctions.get(s);
195
+ return t ? t.map((r) => ({
196
+ event: r.event,
197
+ handler: r.handler,
198
+ wrapper: r.wrapper,
199
+ options: r.options
200
+ })) : [];
201
+ }
202
+ }
203
+ class ut {
204
+ map = /* @__PURE__ */ new Map();
205
+ maxSize;
206
+ constructor(s) {
207
+ this.maxSize = Math.max(1, s);
208
+ }
209
+ get(s) {
210
+ const t = this.map.get(s);
211
+ if (t !== void 0)
212
+ return this.map.delete(s), this.map.set(s, t), t;
213
+ }
214
+ set(s, t) {
215
+ if (this.map.has(s) && this.map.delete(s), this.map.set(s, t), this.map.size > this.maxSize) {
216
+ const r = this.map.keys().next().value;
217
+ this.map.delete(r);
218
+ }
219
+ }
220
+ has(s) {
221
+ return this.map.has(s);
222
+ }
223
+ clear() {
224
+ this.map.clear();
225
+ }
226
+ get size() {
227
+ return this.map.size;
228
+ }
229
+ }
230
+ const It = () => {
231
+ if (typeof navigator < "u" && "deviceMemory" in navigator) {
232
+ const s = navigator.deviceMemory;
233
+ if (s)
234
+ return Math.min(1e3, Math.max(200, s * 100));
235
+ }
236
+ return (() => {
237
+ try {
238
+ return globalThis.process?.env?.NODE_ENV === "test";
239
+ } catch {
240
+ return !1;
241
+ }
242
+ })() ? 100 : 500;
243
+ }, De = new ut(
244
+ It()
245
+ ), Rt = /* @__PURE__ */ new Set([
246
+ "true",
247
+ "false",
248
+ "null",
249
+ "undefined",
250
+ "typeof",
251
+ "instanceof",
252
+ "in",
253
+ "of",
254
+ "new",
255
+ "delete",
256
+ "void",
257
+ "throw",
258
+ "return",
259
+ "this",
260
+ "class",
261
+ "extends",
262
+ "import",
263
+ "export",
264
+ "from",
265
+ "as",
266
+ "async",
267
+ "await",
268
+ "yield",
269
+ "if",
270
+ "else",
271
+ "for",
272
+ "while",
273
+ "do",
274
+ "switch",
275
+ "case",
276
+ "break",
277
+ "continue",
278
+ "try",
279
+ "catch",
280
+ "finally",
281
+ "let",
282
+ "const",
283
+ "var",
284
+ "function",
285
+ "NaN",
286
+ "Infinity"
287
+ ]);
288
+ class Bt {
289
+ // Reuse the LRUCache class (Map-insertion-order O(1) eviction) rather than
290
+ // maintaining a parallel ad-hoc implementation with Map delete+re-insert.
291
+ static cache = new ut(1e3);
292
+ // Dangerous patterns to block
293
+ static dangerousPatterns = [
294
+ /constructor/i,
295
+ /prototype/i,
296
+ /__proto__/i,
297
+ /\bfunction\b/i,
298
+ /eval/i,
299
+ /import/i,
300
+ /require/i,
301
+ /window/i,
302
+ /document/i,
303
+ /global/i,
304
+ /process/i,
305
+ /setTimeout/i,
306
+ /setInterval/i,
307
+ /fetch/i,
308
+ /XMLHttpRequest/i
309
+ ];
310
+ static evaluate(s, t) {
311
+ const r = this.cache.get(s);
312
+ if (r) {
313
+ if (!r.isSecure) {
314
+ te("Blocked cached dangerous expression:", s);
315
+ return;
316
+ }
317
+ return r.evaluator(t);
318
+ }
319
+ const n = this.createEvaluator(s);
320
+ if (this.cache.set(s, n), !n.isSecure) {
321
+ te("Blocked dangerous expression:", s);
322
+ return;
323
+ }
324
+ return n.evaluator(t);
325
+ }
326
+ static createEvaluator(s) {
327
+ if (this.hasDangerousPatterns(s))
328
+ return { evaluator: () => {
329
+ }, isSecure: !1 };
330
+ if (s.length > 1e3)
331
+ return { evaluator: () => {
332
+ }, isSecure: !1 };
333
+ try {
334
+ return { evaluator: this.createSafeEvaluator(s), isSecure: !0 };
335
+ } catch (t) {
336
+ return te("Failed to create evaluator for expression:", s, t), { evaluator: () => {
337
+ }, isSecure: !1 };
338
+ }
339
+ }
340
+ static hasDangerousPatterns(s) {
341
+ return this.dangerousPatterns.some((t) => t.test(s));
342
+ }
343
+ static createSafeEvaluator(s) {
344
+ const t = s.trim();
345
+ if (t.startsWith("{") && t.endsWith("}"))
346
+ return this.createObjectEvaluator(s);
347
+ if (/^ctx\.[a-zA-Z0-9_.]+$/.test(s.trim())) {
348
+ const r = s.trim().slice(4);
349
+ return (n) => z(n, r);
350
+ }
351
+ return s.includes("ctx") || /[+\-*/%<>=&|?:[\]]/.test(s) ? this.createSimpleEvaluator(s) : (r) => z(r, s);
352
+ }
353
+ static createObjectEvaluator(s) {
354
+ const t = s.trim().slice(1, -1), r = this.parseObjectProperties(t);
355
+ return (n) => {
356
+ const c = {};
357
+ for (const { key: o, value: i } of r)
358
+ try {
359
+ if (i.startsWith("ctx.")) {
360
+ const f = i.slice(4);
361
+ c[o] = z(n, f);
362
+ } else
363
+ c[o] = this.evaluateSimpleValue(i, n);
364
+ } catch {
365
+ c[o] = void 0;
366
+ }
367
+ return c;
368
+ };
369
+ }
370
+ static parseObjectProperties(s) {
371
+ const t = [], r = [];
372
+ let n = 0, c = null, o = 0;
373
+ for (let i = 0; i < s.length; i++) {
374
+ const f = s[i];
375
+ if (c) {
376
+ if (f === "\\") {
377
+ i++;
378
+ continue;
379
+ }
380
+ f === c && (c = null);
381
+ } else f === '"' || f === "'" ? c = f : f === "(" || f === "[" || f === "{" ? n++ : f === ")" || f === "]" || f === "}" ? n-- : f === "," && n === 0 && (r.push(s.slice(o, i)), o = i + 1);
382
+ }
383
+ r.push(s.slice(o));
384
+ for (const i of r) {
385
+ let f = -1, b = 0, y = null;
386
+ for (let j = 0; j < i.length; j++) {
387
+ const S = i[j];
388
+ if (y) {
389
+ if (S === "\\") {
390
+ j++;
391
+ continue;
392
+ }
393
+ S === y && (y = null);
394
+ } else if (S === '"' || S === "'")
395
+ y = S;
396
+ else if (S === "(" || S === "[" || S === "{")
397
+ b++;
398
+ else if (S === ")" || S === "]" || S === "}")
399
+ b--;
400
+ else if (S === ":" && b === 0) {
401
+ f = j;
402
+ break;
403
+ }
404
+ }
405
+ if (f === -1) continue;
406
+ const m = i.slice(0, f).trim(), d = i.slice(f + 1).trim(), C = m.replace(/^['"]|['"]$/g, "");
407
+ t.push({ key: C, value: d });
408
+ }
409
+ return t;
410
+ }
411
+ static createSimpleEvaluator(s) {
412
+ return (t) => {
413
+ try {
414
+ let r = s;
415
+ const n = [];
416
+ r = r.replace(
417
+ /("[^"\\]*(?:\\.[^"\\]*)*"|'[^'\\]*(?:\\.[^'\\]*)*')/g,
418
+ (m) => `<<#${n.push(m) - 1}#>>`
419
+ );
420
+ const c = r.match(/ctx\.[\w.]+/g) || [];
421
+ for (const m of c) {
422
+ const d = m.slice(4), C = z(t, d);
423
+ if (C === void 0) return;
424
+ const j = n.push(JSON.stringify(C)) - 1;
425
+ r = r.split(m).join(`<<#${j}#>>`);
426
+ }
427
+ const o = /\b[a-zA-Z_][a-zA-Z0-9_]*(?:\.[a-zA-Z_][a-zA-Z0-9_]*)+\b/g, i = r.match(o) || [];
428
+ for (const m of i) {
429
+ if (m.startsWith("ctx.")) continue;
430
+ const d = z(t, m);
431
+ if (d === void 0) return;
432
+ const C = n.push(JSON.stringify(d)) - 1;
433
+ r = r.split(m).join(`<<#${C}#>>`);
434
+ }
435
+ const f = /\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g;
436
+ let b;
437
+ const y = /* @__PURE__ */ new Set();
438
+ for (; (b = f.exec(r)) !== null; ) {
439
+ const m = b[1];
440
+ if (Rt.has(m) || /^[0-9]+$/.test(m) || m === "ctx" || y.has(m)) continue;
441
+ y.add(m);
442
+ const d = z(t, m);
443
+ if (d === void 0) return;
444
+ const C = JSON.stringify(d), j = n.push(C) - 1;
445
+ m.includes(".") ? r = r.split(m).join(`<<#${j}#>>`) : r = r.replace(
446
+ new RegExp(
447
+ "\\b" + m.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\b",
448
+ "g"
449
+ ),
450
+ `<<#${j}#>>`
451
+ ), f.lastIndex = 0;
452
+ }
453
+ r = r.replace(
454
+ /<<#(\d+)#>>/g,
455
+ (m, d) => n[Number(d)]
456
+ );
457
+ try {
458
+ return this.evaluateBasicExpression(r);
459
+ } catch {
460
+ return;
461
+ }
462
+ } catch {
463
+ return;
464
+ }
465
+ };
466
+ }
467
+ /**
468
+ * Evaluate a very small, safe expression grammar without using eval/Function.
469
+ * Supports: numbers, string literals, true/false, null, arrays, unary !,
470
+ * arithmetic (+ - * / %), comparisons, logical && and ||, parentheses, and ternary `a ? b : c`.
471
+ */
472
+ static evaluateBasicExpression(s) {
473
+ const t = this.tokenize(s);
474
+ let r = 0;
475
+ function n() {
476
+ return t[r];
477
+ }
478
+ function c(u) {
479
+ const g = t[r++];
480
+ if (u && !g)
481
+ throw new Error(`Unexpected token EOF, expected ${u}`);
482
+ if (u && g && g.type !== u && g.value !== u)
483
+ throw new Error(
484
+ `Unexpected token ${g.type}/${g.value}, expected ${u}`
485
+ );
486
+ return g;
487
+ }
488
+ function o() {
489
+ return j();
490
+ }
491
+ function i(u) {
492
+ if (typeof u == "number") return u;
493
+ if (u == null) return NaN;
494
+ if (typeof u == "boolean") return u ? 1 : 0;
495
+ const g = Number(u);
496
+ return Number.isNaN(g) ? NaN : g;
497
+ }
498
+ function f(u, g) {
499
+ return typeof u == "string" || typeof g == "string" ? String(u) + String(g) : i(u) + i(g);
500
+ }
501
+ function b(u, g) {
502
+ return i(u) - i(g);
503
+ }
504
+ function y(u, g) {
505
+ return i(u) * i(g);
506
+ }
507
+ function m(u, g) {
508
+ return i(u) / i(g);
509
+ }
510
+ function d(u, g) {
511
+ return i(u) % i(g);
512
+ }
513
+ function C(u, g, l) {
514
+ if (typeof g == "number" && typeof l == "number")
515
+ switch (u) {
516
+ case ">":
517
+ return g > l;
518
+ case "<":
519
+ return g < l;
520
+ case ">=":
521
+ return g >= l;
522
+ case "<=":
523
+ return g <= l;
524
+ default:
525
+ return !1;
526
+ }
527
+ const v = String(g), _ = String(l);
528
+ switch (u) {
529
+ case ">":
530
+ return v > _;
531
+ case "<":
532
+ return v < _;
533
+ case ">=":
534
+ return v >= _;
535
+ case "<=":
536
+ return v <= _;
537
+ default:
538
+ return !1;
539
+ }
540
+ }
541
+ function j() {
542
+ const u = S(), g = n();
543
+ if (g && g.value === "?") {
544
+ c("?");
545
+ const l = o();
546
+ c(":");
547
+ const v = o();
548
+ return u ? l : v;
549
+ }
550
+ return u;
551
+ }
552
+ function S() {
553
+ let u = L();
554
+ for (; ; ) {
555
+ const g = n();
556
+ if (!g || g.value !== "||") break;
557
+ c("OP");
558
+ const l = L();
559
+ u = u || l;
560
+ }
561
+ return u;
562
+ }
563
+ function L() {
564
+ let u = p();
565
+ for (; ; ) {
566
+ const g = n();
567
+ if (!g || g.value !== "&&") break;
568
+ c("OP");
569
+ const l = p();
570
+ u = u && l;
571
+ }
572
+ return u;
573
+ }
574
+ function p() {
575
+ let u = T();
576
+ for (; ; ) {
577
+ const g = n();
578
+ if (!g || !["==", "!=", "===", "!=="].includes(g.value)) break;
579
+ const l = c("OP").value, v = T();
580
+ switch (l) {
581
+ case "==":
582
+ u = u == v;
583
+ break;
584
+ case "!=":
585
+ u = u != v;
586
+ break;
587
+ case "===":
588
+ u = u === v;
589
+ break;
590
+ case "!==":
591
+ u = u !== v;
592
+ break;
593
+ }
594
+ }
595
+ return u;
596
+ }
597
+ function T() {
598
+ let u = a();
599
+ for (; ; ) {
600
+ const g = n();
601
+ if (!g || ![">", "<", ">=", "<="].includes(g.value)) break;
602
+ const l = c("OP").value, v = a();
603
+ switch (l) {
604
+ case ">":
605
+ u = C(">", u, v);
606
+ break;
607
+ case "<":
608
+ u = C("<", u, v);
609
+ break;
610
+ case ">=":
611
+ u = C(">=", u, v);
612
+ break;
613
+ case "<=":
614
+ u = C("<=", u, v);
615
+ break;
616
+ }
617
+ }
618
+ return u;
619
+ }
620
+ function a() {
621
+ let u = k();
622
+ for (; ; ) {
623
+ const g = n();
624
+ if (!g || g.value !== "+" && g.value !== "-") break;
625
+ const l = c("OP").value, v = k();
626
+ u = l === "+" ? f(u, v) : b(u, v);
627
+ }
628
+ return u;
629
+ }
630
+ function k() {
631
+ let u = h();
632
+ for (; ; ) {
633
+ const g = n();
634
+ if (!g || g.value !== "*" && g.value !== "/" && g.value !== "%")
635
+ break;
636
+ const l = c("OP").value, v = h();
637
+ switch (l) {
638
+ case "*":
639
+ u = y(u, v);
640
+ break;
641
+ case "/":
642
+ u = m(u, v);
643
+ break;
644
+ case "%":
645
+ u = d(u, v);
646
+ break;
647
+ }
648
+ }
649
+ return u;
650
+ }
651
+ function h() {
652
+ const u = n();
653
+ if (u && u.value === "!")
654
+ return c("OP"), !h();
655
+ if (u && u.value === "-") {
656
+ c("OP");
657
+ const g = h();
658
+ return b(0, g);
659
+ }
660
+ return w();
661
+ }
662
+ function w() {
663
+ const u = n();
664
+ if (u) {
665
+ if (u.type === "NUMBER")
666
+ return c("NUMBER"), Number(u.value);
667
+ if (u.type === "STRING")
668
+ return c("STRING"), u.value.slice(1, -1);
669
+ if (u.type === "IDENT")
670
+ return c("IDENT"), u.value === "true" ? !0 : u.value === "false" ? !1 : u.value === "null" ? null : void 0;
671
+ if (u.value === "[") {
672
+ c("PUNC");
673
+ const g = [];
674
+ for (; ; ) {
675
+ const l = n();
676
+ if (!l || l.value === "]") break;
677
+ g.push(o());
678
+ const v = n();
679
+ v && v.value === "," && c("PUNC");
680
+ }
681
+ return c("PUNC"), g;
682
+ }
683
+ if (u.value === "(") {
684
+ c("PUNC");
685
+ const g = o();
686
+ return c("PUNC"), g;
687
+ }
688
+ throw new Error("Unexpected token in expression");
689
+ }
690
+ }
691
+ return o();
692
+ }
693
+ static tokenize(s) {
694
+ const t = [], r = /\s*(=>|===|!==|==|!=|>=|<=|\|\||&&|[()?:,[\]]|\+|-|\*|\/|%|>|<|!|\d+\.?\d*|"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[a-zA-Z_][a-zA-Z0-9_]*|\S)\s*/g;
695
+ let n;
696
+ for (; (n = r.exec(s)) !== null; ) {
697
+ const c = n[1];
698
+ c && (/^\d/.test(c) ? t.push({ type: "NUMBER", value: c }) : /^"/.test(c) || /^'/.test(c) ? t.push({ type: "STRING", value: c }) : /^[a-zA-Z_]/.test(c) ? t.push({ type: "IDENT", value: c }) : /^[()?:,[\]]$/.test(c) ? t.push({ type: "PUNC", value: c }) : t.push({ type: "OP", value: c }));
699
+ }
700
+ return t;
701
+ }
702
+ static evaluateSimpleValue(s, t) {
703
+ if (s === "true") return !0;
704
+ if (s === "false") return !1;
705
+ if (!isNaN(Number(s))) return Number(s);
706
+ if (s.startsWith("ctx.")) {
707
+ const r = s.slice(4);
708
+ return z(t, r);
709
+ }
710
+ return s.startsWith('"') && s.endsWith('"') || s.startsWith("'") && s.endsWith("'") ? s.slice(1, -1) : s;
711
+ }
712
+ static clearCache() {
713
+ this.cache.clear();
714
+ }
715
+ static getCacheSize() {
716
+ return this.cache.size;
717
+ }
718
+ }
719
+ function Pe(e, s) {
720
+ return Array.isArray(e) && Array.isArray(s) ? JSON.stringify([...e].sort()) !== JSON.stringify([...s].sort()) : e !== s;
721
+ }
722
+ function st(e, s, t, r, n) {
723
+ if (e) {
724
+ const c = s.value;
725
+ if (n && typeof c == "object" && c !== null) {
726
+ const o = { ...c };
727
+ o[n] = t, s.value = o;
728
+ } else
729
+ s.value = t;
730
+ } else {
731
+ const c = r._state || r;
732
+ Re(c, s, t);
733
+ }
734
+ }
735
+ function Oe(e, s, t, r) {
736
+ if (typeof e._requestRender == "function" && e._requestRender(), typeof e._triggerWatchers == "function") {
737
+ const n = s ? "reactiveState" : t;
738
+ e._triggerWatchers(n, r);
739
+ }
740
+ }
741
+ function Wt(e, s, t) {
742
+ const r = `update:${X(s)}`, n = `update:${s}`, c = new CustomEvent(r, {
743
+ detail: t,
744
+ bubbles: !0,
745
+ cancelable: !0
746
+ }), o = new CustomEvent(n, {
747
+ detail: t,
748
+ bubbles: !0,
749
+ cancelable: !0
750
+ });
751
+ e.dispatchEvent(c), e.dispatchEvent(o);
752
+ }
753
+ function rt(e, s, t, r) {
754
+ const n = t;
755
+ if (x(() => {
756
+ if (typeof e.setAttribute == "function")
757
+ try {
758
+ e[s] = n;
759
+ } catch {
760
+ }
761
+ else
762
+ e[s] = n;
763
+ }), n == null || typeof n == "string" || typeof n == "number" || typeof n == "boolean") {
764
+ const c = F(n);
765
+ c !== null ? x(() => {
766
+ typeof e.setAttribute == "function" && K(
767
+ e,
768
+ X(s),
769
+ String(c)
770
+ );
771
+ }) : x(() => {
772
+ typeof e.removeAttribute == "function" && Z(e, X(s));
773
+ });
774
+ }
775
+ }
776
+ function Dt(e, s, t, r) {
777
+ if (e) {
778
+ const n = s.value;
779
+ return r && typeof n == "object" && n !== null ? n[r] : n;
780
+ } else {
781
+ const n = t._state || t;
782
+ return z(n, s);
783
+ }
784
+ }
785
+ function Le(e) {
786
+ return e != null && typeof e == "object" && "value" in e;
787
+ }
788
+ function ze(e) {
789
+ return e != null && typeof e == "object" && "value" in e ? e.value : e;
790
+ }
791
+ function re(e, s, t) {
792
+ if (!e) return;
793
+ e.attrs || (e.attrs = {});
794
+ const r = e.attrs;
795
+ r[s] = t;
796
+ }
797
+ function Q(e) {
798
+ return e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement;
799
+ }
800
+ function de(e) {
801
+ return e != null && typeof e == "object" && "value" in e ? de(e.value) : !(e != null && typeof e == "object" || e === !1 || e === "false" || e === null || e === void 0 || e === 0);
802
+ }
803
+ function dt(e) {
804
+ return e.substring(2, 3).toLowerCase() + e.substring(3);
805
+ }
806
+ function Fe(e) {
807
+ return typeof e == "boolean" || e === "true" || e === "false";
808
+ }
809
+ function Kt(e, s, t, r, n, c, o, i) {
810
+ if (!c) return;
811
+ const f = s.includes("lazy"), b = s.includes("trim"), y = s.includes("number"), m = () => {
812
+ if (O(e)) {
813
+ const k = e.value;
814
+ return i && o && (o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement) && typeof k == "object" && k !== null ? k[i] : k;
815
+ }
816
+ const a = c?._state || c;
817
+ return z(a, e);
818
+ }, d = m();
819
+ let C = "text";
820
+ o instanceof HTMLInputElement ? C = r?.type || o.type || "text" : o instanceof HTMLSelectElement ? C = "select" : o instanceof HTMLTextAreaElement && (C = "textarea");
821
+ const j = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement, L = j ? C === "checkbox" || C === "radio" ? "checked" : "value" : i ?? "modelValue";
822
+ if (C === "checkbox")
823
+ if (Array.isArray(d))
824
+ t[L] = d.includes(
825
+ String(o?.getAttribute("value") ?? r?.value ?? "")
826
+ );
827
+ else {
828
+ const a = o?.getAttribute("true-value") ?? !0;
829
+ t[L] = d === a;
830
+ }
831
+ else if (C === "radio")
832
+ t[L] = d === (r?.value ?? "");
833
+ else if (C === "select")
834
+ if (o && o.hasAttribute("multiple") && o instanceof HTMLSelectElement) {
835
+ const a = Array.isArray(d) ? d.map(String) : [];
836
+ queueMicrotask(() => {
837
+ Array.from(o.options).forEach((k) => {
838
+ k.selected = a.includes(k.value);
839
+ });
840
+ }), t[L] = Array.isArray(d) ? d : [];
841
+ } else
842
+ t[L] = d;
843
+ else if (!j && O(e))
844
+ t[L] = e;
845
+ else {
846
+ t[L] = d;
847
+ try {
848
+ const a = X(L);
849
+ r && (r[a] = d);
850
+ } catch {
851
+ }
852
+ }
853
+ const p = f || C === "checkbox" || C === "radio" || C === "select" ? "change" : "input", T = (a) => {
854
+ if (a.isComposing || n._isComposing)
855
+ return;
856
+ const k = globalThis.process, h = !!k && k.env?.NODE_ENV === "test" || typeof window < "u" && globalThis.__vitest__;
857
+ if (a.isTrusted === !1 && !h)
858
+ return;
859
+ const w = a.target;
860
+ if (!w || w._modelUpdating)
861
+ return;
862
+ let E = w.value;
863
+ if (C === "checkbox") {
864
+ const l = m();
865
+ if (Array.isArray(l)) {
866
+ const v = w.getAttribute("value") ?? "", _ = Array.from(l);
867
+ if (w.checked)
868
+ _.includes(v) || _.push(v);
869
+ else {
870
+ const A = _.indexOf(v);
871
+ A > -1 && _.splice(A, 1);
872
+ }
873
+ E = _;
874
+ } else {
875
+ const v = w.getAttribute("true-value") ?? !0, _ = w.getAttribute("false-value") ?? !1;
876
+ E = w.checked ? v : _;
877
+ }
878
+ } else if (C === "radio")
879
+ E = w.getAttribute("value") ?? w.value;
880
+ else if (C === "select" && w.multiple)
881
+ E = Array.from(w.selectedOptions).map(
882
+ (l) => l.value
883
+ );
884
+ else if (b && typeof E == "string" && (E = E.trim()), y) {
885
+ const l = Number(E);
886
+ isNaN(l) || (E = l);
887
+ }
888
+ const u = m();
889
+ if (Pe(E, u)) {
890
+ w._modelUpdating = !0;
891
+ try {
892
+ st(O(e), e, E, c, i), Oe(c, O(e), e, E), w && Wt(w, L, E);
893
+ } finally {
894
+ queueMicrotask(
895
+ () => w._modelUpdating = !1
896
+ );
897
+ }
898
+ }
899
+ };
900
+ if (j) {
901
+ if (n[p]) {
902
+ const a = n[p];
903
+ o && Y.removeListener(o, p, a);
904
+ }
905
+ n[p] = T;
906
+ } else {
907
+ const a = `update:${X(L)}`, k = `update:${L}`;
908
+ if (n[a]) {
909
+ const h = n[a];
910
+ o && Y.removeListener(o, a, h);
911
+ }
912
+ if (n[k]) {
913
+ const h = n[k];
914
+ o && Y.removeListener(o, k, h);
915
+ }
916
+ if (n[a] = (h) => {
917
+ const w = h.detail;
918
+ let E = w !== void 0 ? w : void 0;
919
+ if (E === void 0) {
920
+ const l = h.target;
921
+ if (l && typeof l == "object" && "value" in l)
922
+ try {
923
+ E = l.value;
924
+ } catch {
925
+ E = void 0;
926
+ }
927
+ }
928
+ const u = Dt(
929
+ O(e),
930
+ e,
931
+ c,
932
+ i
933
+ );
934
+ if (Pe(E, u)) {
935
+ st(O(e), e, E, c, i), Oe(c, O(e), e, E);
936
+ const l = h.target;
937
+ l && rt(
938
+ l,
939
+ L,
940
+ O(e) ? e : E,
941
+ O(e)
942
+ );
943
+ }
944
+ }, O(e) && typeof e.value == "object" && e.value !== null) {
945
+ let h;
946
+ try {
947
+ h = Reflect.ownKeys(e.value);
948
+ } catch {
949
+ h = Object.keys(e.value);
950
+ }
951
+ const w = h.filter(
952
+ (u) => typeof u == "string" && !String(u).startsWith("_") && u !== "constructor"
953
+ ), E = new Set(
954
+ w.map((u) => `update:${X(u)}`)
955
+ );
956
+ for (const u of Object.keys(n))
957
+ u.startsWith("update:") && u !== a && u !== k && !E.has(u) && (o && Y.removeListener(o, u, n[u]), delete n[u]);
958
+ for (const u of w) {
959
+ const g = String(u), l = `update:${X(g)}`, v = `update:${g}`;
960
+ l !== a && (n[l] && o && (Y.removeListener(o, l, n[l]), delete n[l]), n[l] = (_) => {
961
+ const A = _.detail !== void 0 ? _.detail : _.target?.value, N = O(e) ? e.value[g] : z(
962
+ c?._state || c,
963
+ e
964
+ );
965
+ if (!Pe(A, N)) return;
966
+ if (O(e)) {
967
+ const M = {
968
+ ...e.value
969
+ };
970
+ M[g] = A, e.value = M;
971
+ } else
972
+ Re(
973
+ c?._state || c,
974
+ e,
975
+ A
976
+ );
977
+ Oe(c, O(e), e, A);
978
+ const H = _.currentTarget || o || _.target;
979
+ H && rt(
980
+ H,
981
+ L,
982
+ O(e) ? e : A,
983
+ O(e)
984
+ );
985
+ }, n[v] = n[l]);
986
+ }
987
+ }
988
+ n[k] = n[a];
989
+ }
990
+ (C === "text" || C === "textarea") && (n.compositionstart = () => n._isComposing = !0, n.compositionend = (a) => {
991
+ n._isComposing = !1;
992
+ const k = a.target;
993
+ k && queueMicrotask(() => {
994
+ const h = k.value, w = c?._state || c, E = z(w, e);
995
+ let u = h;
996
+ if (b && (u = u.trim()), y) {
997
+ const l = Number(u);
998
+ isNaN(l) || (u = l);
999
+ }
1000
+ if (Pe(u, E)) {
1001
+ k._modelUpdating = !0;
1002
+ try {
1003
+ Re(w, e, u), Oe(c, O(e), e, u);
1004
+ } finally {
1005
+ queueMicrotask(
1006
+ () => k._modelUpdating = !1
1007
+ );
1008
+ }
1009
+ }
1010
+ });
1011
+ });
1012
+ }
1013
+ function Ut(e, s, t, r, n) {
1014
+ if (typeof e == "object" && e !== null)
1015
+ for (const [c, o] of Object.entries(e))
1016
+ if (c.startsWith("data-") || c.startsWith("aria-") || c === "class")
1017
+ t[c] = o;
1018
+ else if (c === "disabled" && n && Q(n)) {
1019
+ const i = o && typeof o == "object" && "value" in o;
1020
+ (() => {
1021
+ try {
1022
+ return O(o);
1023
+ } catch {
1024
+ return !1;
1025
+ }
1026
+ })() || i ? s[c] = o : t[c] = o;
1027
+ } else
1028
+ s[c] = o;
1029
+ else if (typeof e == "string") {
1030
+ if (!r) return;
1031
+ try {
1032
+ const c = je(e, r);
1033
+ if (typeof c == "object" && c !== null) {
1034
+ for (const [o, i] of Object.entries(c))
1035
+ if (o.startsWith("data-") || o.startsWith("aria-") || o === "class")
1036
+ t[o] = i;
1037
+ else if (o === "disabled" && n && Q(n)) {
1038
+ const f = i && typeof i == "object" && "value" in i;
1039
+ (() => {
1040
+ try {
1041
+ return O(i);
1042
+ } catch {
1043
+ return !1;
1044
+ }
1045
+ })() || f ? s[o] = i : t[o] = i;
1046
+ } else
1047
+ s[o] = i;
1048
+ return;
1049
+ } else {
1050
+ t[e] = c;
1051
+ return;
1052
+ }
1053
+ } catch {
1054
+ const c = z(
1055
+ r,
1056
+ e
1057
+ );
1058
+ t[e] = c;
1059
+ }
1060
+ }
1061
+ }
1062
+ function zt(e, s, t) {
1063
+ let r;
1064
+ if (typeof e == "string") {
1065
+ if (!t) return;
1066
+ r = je(e, t);
1067
+ } else
1068
+ r = e;
1069
+ const n = String(s.style || "");
1070
+ let c = n;
1071
+ if (r) {
1072
+ if (n) {
1073
+ const o = String(n).split(";").map((f) => f.trim()).filter(Boolean), i = o.findIndex(
1074
+ (f) => f.startsWith("display:")
1075
+ );
1076
+ i >= 0 && o[i] === "display: none" && (o.splice(i, 1), c = o.length > 0 ? o.join("; ") + ";" : "");
1077
+ }
1078
+ } else if (n) {
1079
+ const o = String(n).split(";").filter(Boolean), i = o.findIndex(
1080
+ (f) => f.trim().startsWith("display:")
1081
+ );
1082
+ i >= 0 ? o[i] = "display: none" : o.push("display: none"), c = o.join("; ");
1083
+ } else
1084
+ c = "display: none";
1085
+ c !== n && (c ? s.style = c : s.style = void 0);
1086
+ }
1087
+ function je(e, s) {
1088
+ return Bt.evaluate(e, s);
1089
+ }
1090
+ function Ft(e, s, t, r) {
1091
+ let n;
1092
+ if (typeof e == "string") {
1093
+ if (!t) return;
1094
+ n = je(e, t);
1095
+ } else
1096
+ n = e;
1097
+ try {
1098
+ if (n && typeof n == "object") {
1099
+ if (O(n))
1100
+ n = n.value;
1101
+ else if ("value" in n && typeof n.value < "u") {
1102
+ const b = n.value;
1103
+ b instanceof Node || (n = b);
1104
+ }
1105
+ }
1106
+ } catch {
1107
+ }
1108
+ let c = [];
1109
+ if (typeof n == "string")
1110
+ c = [n];
1111
+ else if (Array.isArray(n))
1112
+ c = n.filter(Boolean);
1113
+ else if (typeof n == "object" && n !== null)
1114
+ for (const [b, y] of Object.entries(n))
1115
+ y && c.push(b);
1116
+ const o = c.join(" "), i = r && r.class || s.class || "", f = i ? `${i} ${o}`.trim() : o.trim();
1117
+ f ? s.class = f : s.class = void 0;
1118
+ }
1119
+ function qt(e, s, t) {
1120
+ let r;
1121
+ if (typeof e == "string") {
1122
+ if (!t) return;
1123
+ r = je(e, t);
1124
+ } else
1125
+ r = e;
1126
+ let n = "";
1127
+ if (typeof r == "string")
1128
+ n = r;
1129
+ else if (r && typeof r == "object") {
1130
+ const o = [];
1131
+ for (const [i, f] of Object.entries(r))
1132
+ if (f != null && f !== "") {
1133
+ const b = i.replace(
1134
+ /[A-Z]/g,
1135
+ (d) => `-${d.toLowerCase()}`
1136
+ ), y = [
1137
+ "width",
1138
+ "height",
1139
+ "top",
1140
+ "right",
1141
+ "bottom",
1142
+ "left",
1143
+ "margin",
1144
+ "margin-top",
1145
+ "margin-right",
1146
+ "margin-bottom",
1147
+ "margin-left",
1148
+ "padding",
1149
+ "padding-top",
1150
+ "padding-right",
1151
+ "padding-bottom",
1152
+ "padding-left",
1153
+ "font-size",
1154
+ "line-height",
1155
+ "border-width",
1156
+ "border-radius",
1157
+ "min-width",
1158
+ "max-width",
1159
+ "min-height",
1160
+ "max-height"
1161
+ ];
1162
+ let m = String(f);
1163
+ typeof f == "number" && y.includes(b) && (m = `${f}px`), o.push(`${b}: ${m}`);
1164
+ }
1165
+ n = o.join("; ") + (o.length > 0 ? ";" : "");
1166
+ }
1167
+ const c = String(s.style || "");
1168
+ s.style = c + (c && !c.endsWith(";") ? "; " : "") + n;
1169
+ }
1170
+ function Vt(e, s, t) {
1171
+ let r = e;
1172
+ typeof e == "string" && t && (r = je(e, t)), O(r) ? s.reactiveRef = r : s.ref = r;
1173
+ }
1174
+ function pt(e, s, t, r) {
1175
+ const n = {}, c = { ...r || {} }, o = {};
1176
+ for (const [i, f] of Object.entries(e)) {
1177
+ const { value: b, modifiers: y, arg: m } = f;
1178
+ if (i === "model" || i.startsWith("model:")) {
1179
+ const d = i.split(":"), C = d.length > 1 ? d[1] : m;
1180
+ Kt(
1181
+ b,
1182
+ // Pass the original value (could be string or reactive state object)
1183
+ y,
1184
+ n,
1185
+ c,
1186
+ o,
1187
+ s,
1188
+ t,
1189
+ C
1190
+ );
1191
+ continue;
1192
+ }
1193
+ switch (i) {
1194
+ case "bind":
1195
+ Ut(b, n, c, s, t);
1196
+ break;
1197
+ case "show":
1198
+ zt(b, c, s);
1199
+ break;
1200
+ case "class":
1201
+ Ft(b, c, s, r);
1202
+ break;
1203
+ case "style":
1204
+ qt(b, c, s);
1205
+ break;
1206
+ case "ref":
1207
+ Vt(b, n, s);
1208
+ break;
1209
+ }
1210
+ }
1211
+ try {
1212
+ if (Object.prototype.hasOwnProperty.call(n, "disabled") && t && Q(t)) {
1213
+ const f = n.disabled, b = f && typeof f == "object" && "value" in f;
1214
+ let y = !1;
1215
+ try {
1216
+ y = O(f);
1217
+ } catch {
1218
+ y = !1;
1219
+ }
1220
+ !b && !y && (c.disabled = f, delete n.disabled);
1221
+ }
1222
+ } catch {
1223
+ }
1224
+ return { props: n, attrs: c, listeners: o };
1225
+ }
1226
+ function me(e) {
1227
+ return e ? e.split(/\s+/).filter(Boolean) : [];
1228
+ }
1229
+ function ge(e, s) {
1230
+ if (s.length === 0) return;
1231
+ const t = s.filter(
1232
+ (r) => r && !e.classList.contains(r)
1233
+ );
1234
+ t.length > 0 && e.classList.add(...t);
1235
+ }
1236
+ function ye(e, s) {
1237
+ if (s.length === 0) return;
1238
+ const t = s.filter(Boolean);
1239
+ t.length > 0 && e.classList.remove(...t);
1240
+ }
1241
+ function Gt(e) {
1242
+ const s = window.getComputedStyle(e), t = s.transitionDuration || "0s", r = s.transitionDelay || "0s", n = (c) => {
1243
+ const o = parseFloat(c);
1244
+ return c.includes("ms") ? o : o * 1e3;
1245
+ };
1246
+ return n(t) + n(r);
1247
+ }
1248
+ function ht(e, s) {
1249
+ return new Promise((t) => {
1250
+ const r = s ?? Gt(e);
1251
+ if (r <= 0) {
1252
+ t();
1253
+ return;
1254
+ }
1255
+ let n = !1;
1256
+ const c = () => {
1257
+ n || (n = !0, e.removeEventListener("transitionend", o), e.removeEventListener("transitioncancel", o), t());
1258
+ }, o = () => c();
1259
+ e.addEventListener("transitionend", o), e.addEventListener("transitioncancel", o), setTimeout(c, r + 50);
1260
+ });
1261
+ }
1262
+ async function _e(e, s) {
1263
+ const { classes: t, hooks: r, css: n, duration: c } = s;
1264
+ if (r?.onBeforeEnter)
1265
+ try {
1266
+ r.onBeforeEnter(e);
1267
+ } catch (m) {
1268
+ W("Transition onBeforeEnter error:", m);
1269
+ }
1270
+ if (!n)
1271
+ return r?.onEnter ? new Promise((m) => {
1272
+ const d = r.onEnter;
1273
+ typeof d == "function" ? d(e, () => {
1274
+ if (r?.onAfterEnter)
1275
+ try {
1276
+ r.onAfterEnter(e);
1277
+ } catch (C) {
1278
+ W("Transition onAfterEnter error:", C);
1279
+ }
1280
+ m();
1281
+ }) : m();
1282
+ }) : void 0;
1283
+ const o = me(t?.enterFrom), i = me(t?.enterActive), f = me(t?.enterTo);
1284
+ ge(e, o), e.offsetHeight, ge(e, i), e.offsetHeight;
1285
+ let b;
1286
+ if (r?.onEnter) {
1287
+ const m = new Promise((d) => {
1288
+ b = d;
1289
+ });
1290
+ try {
1291
+ const d = r.onEnter;
1292
+ typeof d == "function" && d(e, () => {
1293
+ b && b();
1294
+ });
1295
+ } catch (d) {
1296
+ W("Transition onEnter error:", d);
1297
+ }
1298
+ b && await m;
1299
+ }
1300
+ await new Promise((m) => requestAnimationFrame(() => m())), e.offsetHeight, ye(e, o), ge(e, f), e.offsetHeight, await new Promise((m) => requestAnimationFrame(() => m()));
1301
+ let y;
1302
+ if (typeof c == "number" ? y = c : c && typeof c == "object" && "enter" in c && (y = c.enter), await ht(e, y), ye(e, i), r?.onAfterEnter)
1303
+ try {
1304
+ r.onAfterEnter(e);
1305
+ } catch (m) {
1306
+ W("Transition onAfterEnter error:", m);
1307
+ }
1308
+ }
1309
+ async function Ke(e, s) {
1310
+ const { classes: t, hooks: r, css: n, duration: c } = s;
1311
+ if (r?.onBeforeLeave)
1312
+ try {
1313
+ r.onBeforeLeave(e);
1314
+ } catch (m) {
1315
+ W("Transition onBeforeLeave error:", m);
1316
+ }
1317
+ if (!n)
1318
+ return r?.onLeave ? new Promise((m) => {
1319
+ const d = r.onLeave;
1320
+ typeof d == "function" ? d(e, () => {
1321
+ if (r?.onAfterLeave)
1322
+ try {
1323
+ r.onAfterLeave(e);
1324
+ } catch (C) {
1325
+ W("Transition onAfterLeave error:", C);
1326
+ }
1327
+ m();
1328
+ }) : m();
1329
+ }) : void 0;
1330
+ const o = me(t?.leaveFrom), i = me(t?.leaveActive), f = me(t?.leaveTo);
1331
+ ge(e, o), e.offsetHeight, ge(e, i);
1332
+ let b;
1333
+ if (r?.onLeave) {
1334
+ const m = new Promise((d) => {
1335
+ b = d;
1336
+ });
1337
+ try {
1338
+ const d = r.onLeave;
1339
+ typeof d == "function" && d(e, () => {
1340
+ b && b();
1341
+ });
1342
+ } catch (d) {
1343
+ W("Transition onLeave error:", d);
1344
+ }
1345
+ b && await m;
1346
+ }
1347
+ await new Promise((m) => requestAnimationFrame(() => m())), ye(e, o), ge(e, f);
1348
+ let y;
1349
+ if (typeof c == "number" ? y = c : c && typeof c == "object" && "leave" in c && (y = c.leave), await ht(e, y), ye(e, i), ye(e, f), ye(e, o), r?.onAfterLeave)
1350
+ try {
1351
+ r.onAfterLeave(e);
1352
+ } catch (m) {
1353
+ W("Transition onAfterLeave error:", m);
1354
+ }
1355
+ }
1356
+ const yt = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap();
1357
+ function xe(e) {
1358
+ if (!e) return;
1359
+ const s = yt.get(e);
1360
+ if (s !== void 0) return s;
1361
+ try {
1362
+ const t = e;
1363
+ if (t && t.key != null) return String(t.key);
1364
+ } catch {
1365
+ }
1366
+ if (e instanceof Element) {
1367
+ const t = e.getAttribute("data-anchor-key");
1368
+ if (t) return t;
1369
+ }
1370
+ }
1371
+ function G(e, s) {
1372
+ try {
1373
+ yt.set(e, s);
1374
+ } catch {
1375
+ }
1376
+ try {
1377
+ e.key = s;
1378
+ } catch {
1379
+ }
1380
+ try {
1381
+ if (e instanceof Element) {
1382
+ const t = F(s);
1383
+ t !== null && K(e, "data-anchor-key", t);
1384
+ }
1385
+ } catch {
1386
+ }
1387
+ }
1388
+ function Jt(e) {
1389
+ if (!e) return;
1390
+ const s = mt.get(e);
1391
+ if (s !== void 0) return s;
1392
+ try {
1393
+ const t = e;
1394
+ if (t && t._transitionGroup != null)
1395
+ return t._transitionGroup;
1396
+ } catch {
1397
+ }
1398
+ }
1399
+ function Zt(e, s) {
1400
+ try {
1401
+ mt.set(e, s);
1402
+ } catch {
1403
+ }
1404
+ try {
1405
+ e._transitionGroup = s;
1406
+ } catch {
1407
+ }
1408
+ }
1409
+ const Ie = /* @__PURE__ */ new WeakMap();
1410
+ function ue(e, s) {
1411
+ if (s) {
1412
+ if (e instanceof Element) {
1413
+ Y.cleanup(e);
1414
+ const t = [];
1415
+ for (const r in s)
1416
+ s[r] === e && t.push(r);
1417
+ for (const r of t)
1418
+ delete s[r];
1419
+ }
1420
+ if (e.hasChildNodes()) {
1421
+ const t = e.childNodes;
1422
+ for (let r = t.length - 1; r >= 0; r--)
1423
+ ue(t[r], s);
1424
+ }
1425
+ }
1426
+ }
1427
+ function Ae(e, s, t) {
1428
+ if (typeof e == "string") return;
1429
+ const r = e.props?.reactiveRef ?? (e.props?.props && e.props.props.reactiveRef), n = e.props?.ref ?? (e.props?.props && e.props.props.ref);
1430
+ if (r)
1431
+ try {
1432
+ if (O(r) || typeof r == "object" && "value" in r)
1433
+ r.value = s;
1434
+ else if (typeof r == "function")
1435
+ r(s);
1436
+ else if (typeof r == "string" && t)
1437
+ try {
1438
+ const c = String(r);
1439
+ t[c] = s;
1440
+ } catch {
1441
+ }
1442
+ } catch {
1443
+ }
1444
+ else if (n && t)
1445
+ try {
1446
+ const c = String(n);
1447
+ t[c] = s;
1448
+ } catch {
1449
+ }
1450
+ }
1451
+ function qe(e, s) {
1452
+ if (Array.isArray(e)) {
1453
+ const c = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Map();
1454
+ return e.map((i) => {
1455
+ if (!i || typeof i != "object") return i;
1456
+ let f = i.props?.key ?? i.key;
1457
+ if (!f) {
1458
+ const m = i.tag || "node", C = [
1459
+ // attrs (kebab-case)
1460
+ i.props?.attrs?.id,
1461
+ i.props?.attrs?.name,
1462
+ i.props?.attrs?.["data-key"],
1463
+ // promoted JS props (camelCase or original)
1464
+ i.props?.props?.id,
1465
+ i.props?.props?.name,
1466
+ i.props?.props?.dataKey,
1467
+ i.props?.props?.["data-key"]
1468
+ ].find((j) => j != null) ?? "";
1469
+ f = C ? `${s}:${m}:${C}` : `${s}:${m}`;
1470
+ }
1471
+ let b = f;
1472
+ if (c.has(b)) {
1473
+ const m = (o.get(b) ?? 1) + 1;
1474
+ o.set(b, m), b = `${f}#${m}`;
1475
+ }
1476
+ o.set(f, (o.get(f) ?? 0) + 1), c.add(b);
1477
+ let y = i.children;
1478
+ return Array.isArray(y) && (y = qe(y, b)), { ...i, key: b, children: y };
1479
+ });
1480
+ }
1481
+ const t = e, r = t.props?.key ?? t.key ?? s;
1482
+ let n = t.children;
1483
+ return Array.isArray(n) && (n = qe(n, r)), { ...t, key: r, children: n };
1484
+ }
1485
+ function it(e, s, t, r) {
1486
+ const n = t.directives ?? {}, c = t.attrs ? { ...t.attrs } : {}, o = pt(
1487
+ n,
1488
+ r,
1489
+ e,
1490
+ c
1491
+ ), i = {
1492
+ ...s.props || {},
1493
+ ...t.props || {},
1494
+ ...o.props || {}
1495
+ }, f = {
1496
+ ...c || {},
1497
+ ...o.attrs || {}
1498
+ }, b = s.props ?? {}, y = i, m = !!(t?.isCustomElement ?? s?.isCustomElement ?? !1);
1499
+ let d = !1;
1500
+ const C = /* @__PURE__ */ new Set();
1501
+ for (const a in b) C.add(a);
1502
+ for (const a in y) C.add(a);
1503
+ for (const a of C) {
1504
+ const k = b[a], h = y[a];
1505
+ let w = k, E = h;
1506
+ if (x(() => {
1507
+ O(k) ? w = k.peek() : Le(k) && (w = k.value);
1508
+ }), x(() => {
1509
+ O(h) ? E = h.peek() : Le(h) && (E = h.value);
1510
+ }), !(k === h && w === E))
1511
+ if (d = !0, a === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)) {
1512
+ const u = ze(h), g = u == null ? "" : String(u);
1513
+ e.value !== g && (e.value = g);
1514
+ } else if (a === "checked" && e instanceof HTMLInputElement) {
1515
+ const u = ze(h);
1516
+ e.checked = !!u;
1517
+ } else if (a.startsWith("on") && typeof h == "function") {
1518
+ const u = dt(a);
1519
+ typeof k == "function" && Y.removeListener(e, u, k), typeof h == "function" && Y.addListener(e, u, h);
1520
+ try {
1521
+ if (u && u.startsWith("update:")) {
1522
+ const g = u.split(":", 2)[1], l = y[g];
1523
+ let v = [];
1524
+ try {
1525
+ if (O(l)) {
1526
+ const A = l.value;
1527
+ v = A && typeof A == "object" ? Object.keys(A) : [];
1528
+ } else l && typeof l == "object" && (v = Object.keys(l));
1529
+ } catch {
1530
+ v = [];
1531
+ }
1532
+ const _ = v.filter(
1533
+ (A) => typeof A == "string" && !A.startsWith("_") && A !== "constructor"
1534
+ );
1535
+ for (const A of _) {
1536
+ const N = `update:${A}`, $ = (H) => {
1537
+ const M = H.detail !== void 0 ? H.detail : H.target instanceof HTMLInputElement || H.target instanceof HTMLTextAreaElement || H.target instanceof HTMLSelectElement ? H.target.value : void 0, R = { ...O(l) ? l.value || {} : y[g] || {}, [A]: M };
1538
+ try {
1539
+ typeof h == "function" && h({
1540
+ detail: R
1541
+ });
1542
+ } catch {
1543
+ }
1544
+ };
1545
+ x(() => {
1546
+ Y.addListener(e, N, $);
1547
+ });
1548
+ }
1549
+ }
1550
+ } catch {
1551
+ }
1552
+ } else if (h == null)
1553
+ Z(e, a);
1554
+ else {
1555
+ const u = t?.isCustomElement ?? s?.isCustomElement ?? !1;
1556
+ if (u || a in e)
1557
+ try {
1558
+ e[a] = h, a === "disabled" && h === !1 && !u && Q(e) && Z(e, "disabled");
1559
+ } catch {
1560
+ }
1561
+ else
1562
+ h === !1 && Z(e, a);
1563
+ }
1564
+ }
1565
+ const j = o.listeners ?? {}, S = Ie.get(e) ?? {};
1566
+ for (const [a, k] of Object.entries(S))
1567
+ Y.removeListener(e, a, k);
1568
+ for (const [a, k] of Object.entries(j))
1569
+ Y.addListener(e, a, k);
1570
+ Object.keys(j).length > 0 ? Ie.set(e, j) : Ie.delete(e);
1571
+ const L = { ...s.attrs ?? {} }, p = f, T = o && o.attrs || {};
1572
+ if (Object.prototype.hasOwnProperty.call(T, "class") && typeof e.getAttribute == "function") {
1573
+ const a = e.getAttribute("class");
1574
+ a !== null && (L.class = a);
1575
+ }
1576
+ if (Object.prototype.hasOwnProperty.call(T, "style") && typeof e.getAttribute == "function") {
1577
+ const a = e.getAttribute("style");
1578
+ a !== null && (L.style = a);
1579
+ }
1580
+ try {
1581
+ if (Object.prototype.hasOwnProperty.call(T, "class") && T.class === void 0 && typeof e.getAttribute == "function") {
1582
+ const a = e.getAttribute("class");
1583
+ a !== null && (L.class = a);
1584
+ }
1585
+ if (Object.prototype.hasOwnProperty.call(T, "style") && T.style === void 0 && typeof e.getAttribute == "function") {
1586
+ const a = e.getAttribute("style");
1587
+ a !== null && (L.style = a);
1588
+ }
1589
+ try {
1590
+ if (typeof e.getAttribute == "function") {
1591
+ const a = e.getAttribute("class");
1592
+ try {
1593
+ e instanceof HTMLInputElement && e.type === "text" && a !== null && a !== L.class && (L.class = a);
1594
+ } catch {
1595
+ }
1596
+ }
1597
+ } catch {
1598
+ }
1599
+ } catch {
1600
+ }
1601
+ for (const a in { ...L, ...p }) {
1602
+ const k = L[a], h = p[a];
1603
+ let w = k, E = h;
1604
+ if (O(k) && (w = k.peek()), O(h) && (E = h.peek()), w !== E)
1605
+ if (d = !0, E == null || E === !1)
1606
+ x(() => {
1607
+ Z(e, a);
1608
+ }), re(s, a, void 0), a === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? x(() => {
1609
+ e.value = "";
1610
+ }) : e instanceof HTMLSelectElement ? x(() => {
1611
+ e.value = "";
1612
+ }) : e instanceof HTMLProgressElement && x(() => {
1613
+ e.value = 0;
1614
+ })), a === "checked" && e instanceof HTMLInputElement && x(() => {
1615
+ e.checked = !1;
1616
+ }), a === "disabled" && Q(e) && x(() => {
1617
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = !1);
1618
+ });
1619
+ else {
1620
+ if (a === "value") {
1621
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {
1622
+ x(() => {
1623
+ e.value = E ?? "";
1624
+ });
1625
+ continue;
1626
+ } else if (e instanceof HTMLSelectElement) {
1627
+ x(() => {
1628
+ e.value = E ?? "";
1629
+ });
1630
+ continue;
1631
+ } else if (e instanceof HTMLProgressElement) {
1632
+ x(() => {
1633
+ e.value = Number(E);
1634
+ });
1635
+ continue;
1636
+ }
1637
+ }
1638
+ if (a === "checked" && e instanceof HTMLInputElement) {
1639
+ x(() => {
1640
+ e.checked = !!E;
1641
+ });
1642
+ continue;
1643
+ }
1644
+ if (a === "style") {
1645
+ const g = F(E);
1646
+ g !== null && K(e, a, String(g)), re(s, a, E);
1647
+ continue;
1648
+ }
1649
+ if (a === "class") {
1650
+ const g = F(E);
1651
+ g !== null && K(e, a, String(g)), re(s, a, E);
1652
+ continue;
1653
+ }
1654
+ if (a === "disabled" && Q(e)) {
1655
+ x(() => {
1656
+ const g = de(E);
1657
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = g);
1658
+ }), de(E) ? x(() => {
1659
+ K(e, a, "");
1660
+ }) : x(() => {
1661
+ Z(e, a);
1662
+ });
1663
+ continue;
1664
+ }
1665
+ const u = e.namespaceURI === "http://www.w3.org/2000/svg";
1666
+ if (m && !u && a.includes("-"))
1667
+ if (ft(a)) {
1668
+ const g = F(h ?? E);
1669
+ if (g !== null) {
1670
+ try {
1671
+ K(e, a, String(g));
1672
+ } catch {
1673
+ }
1674
+ re(s, a, E);
1675
+ }
1676
+ } else {
1677
+ const g = Ge(a);
1678
+ try {
1679
+ const l = e;
1680
+ l[g] = O(h) ? h : E, re(s, a, E);
1681
+ } catch {
1682
+ const l = F(h ?? E);
1683
+ l !== null && K(e, a, String(l));
1684
+ }
1685
+ }
1686
+ else if (!u && a in e)
1687
+ try {
1688
+ const g = e;
1689
+ g[a] = O(h) ? h : E, re(s, a, E);
1690
+ } catch {
1691
+ const g = F(E);
1692
+ g !== null && (K(e, a, String(g)), re(s, a, E));
1693
+ }
1694
+ else {
1695
+ const g = F(E);
1696
+ g !== null && (K(e, a, String(g)), re(s, a, E));
1697
+ }
1698
+ }
1699
+ }
1700
+ try {
1701
+ if (Q(e)) {
1702
+ const a = i.disabled;
1703
+ let k;
1704
+ try {
1705
+ const w = Object.prototype.hasOwnProperty.call(
1706
+ o.props || {},
1707
+ "disabled"
1708
+ ), E = a && typeof a == "object" && "value" in a;
1709
+ let u = !1;
1710
+ x(() => {
1711
+ u = !!O(a);
1712
+ });
1713
+ const g = Fe(a);
1714
+ u || E || w || g ? k = a : k = f.disabled;
1715
+ } catch {
1716
+ k = f.disabled;
1717
+ }
1718
+ const h = de(k);
1719
+ x(() => {
1720
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = h);
1721
+ }), h ? x(() => {
1722
+ K(e, "disabled", "");
1723
+ }) : x(() => {
1724
+ Z(e, "disabled");
1725
+ });
1726
+ }
1727
+ } catch {
1728
+ }
1729
+ if (m && d) {
1730
+ const a = e;
1731
+ x(() => {
1732
+ a._applyProps?.(a._cfg);
1733
+ }), x(() => {
1734
+ typeof a.requestRender == "function" ? a.requestRender() : typeof a._render == "function" && a._render?.(a._cfg);
1735
+ });
1736
+ }
1737
+ }
1738
+ function J(e, s, t, r = null) {
1739
+ if (typeof e == "string")
1740
+ return document.createTextNode(e);
1741
+ if (e.tag === "#text") {
1742
+ const p = document.createTextNode(
1743
+ typeof e.children == "string" ? e.children : ""
1744
+ );
1745
+ return e.key != null && G(p, e.key), p;
1746
+ }
1747
+ if (e.tag === "#raw") {
1748
+ const p = typeof e.children == "string" ? e.children : "";
1749
+ return te(
1750
+ "[#raw] Inserting unsanitized HTML. Ensure the content is trusted or sanitized before use — unsanitized input can lead to XSS vulnerabilities."
1751
+ ), document.createRange().createContextualFragment(p);
1752
+ }
1753
+ if (e.tag === "#anchor") {
1754
+ const p = e, T = Array.isArray(p.children) ? p.children : [], a = document.createTextNode(""), k = document.createTextNode("");
1755
+ p.key != null && (G(a, `${p.key}:start`), G(k, `${p.key}:end`)), p._startNode = a, p._endNode = k;
1756
+ const h = document.createDocumentFragment();
1757
+ h.appendChild(a);
1758
+ for (const w of T) {
1759
+ const E = J(
1760
+ w,
1761
+ s,
1762
+ t,
1763
+ // propagate parent namespace (was previously a boolean)
1764
+ r
1765
+ );
1766
+ if (p.key != null && E instanceof Element && !E.hasAttribute("data-anchor-key")) {
1767
+ const u = w;
1768
+ u && typeof u == "object" && u.key != null || G(E, String(p.key));
1769
+ }
1770
+ h.appendChild(E);
1771
+ }
1772
+ return h.appendChild(k), h;
1773
+ }
1774
+ const n = e && typeof e == "object" && e.props && e.props.attrs ? e.props.attrs : void 0, o = (n && typeof n.xmlns == "string" ? String(n.xmlns) : void 0) ?? r ?? _t[e.tag] ?? null, i = o ? document.createElementNS(o, e.tag) : document.createElement(e.tag);
1775
+ e.key != null && G(i, e.key), e.props && e.props?._transitionGroup && Zt(
1776
+ i,
1777
+ e.props?._transitionGroup
1778
+ );
1779
+ const { props: f = {}, attrs: b = {}, directives: y = {} } = e.props ?? {}, m = pt(
1780
+ y,
1781
+ s,
1782
+ i instanceof HTMLElement ? i : void 0,
1783
+ b
1784
+ ), d = {
1785
+ ...f,
1786
+ ...m.props
1787
+ }, C = {
1788
+ ...b,
1789
+ ...m.attrs
1790
+ };
1791
+ try {
1792
+ const p = (C && C.class) ?? (d && d.class) ?? (e.props && e.props.attrs && e.props.attrs.class) ?? (e.props && e.props.props && e.props.props.class), T = F(p);
1793
+ if (T !== null) {
1794
+ const a = String(T).trim();
1795
+ a && K(i, "class", a);
1796
+ }
1797
+ } catch {
1798
+ }
1799
+ try {
1800
+ if (d.disabled !== void 0 && i && Q(i)) {
1801
+ const p = d.disabled, T = p && typeof p == "object" && "value" in p;
1802
+ let a = !1;
1803
+ try {
1804
+ a = O(p);
1805
+ } catch {
1806
+ a = !1;
1807
+ }
1808
+ !T && !a && x(() => {
1809
+ C.disabled = p, delete d.disabled;
1810
+ });
1811
+ }
1812
+ } catch {
1813
+ }
1814
+ const j = i.namespaceURI === "http://www.w3.org/2000/svg";
1815
+ for (const p in C) {
1816
+ const T = C[p];
1817
+ if (typeof p != "string" || /\[object Object\]/.test(p))
1818
+ continue;
1819
+ const a = ze(T);
1820
+ if (typeof a == "boolean")
1821
+ a ? K(i, p, "") : x(() => {
1822
+ Z(i, p);
1823
+ });
1824
+ else if (a != null) {
1825
+ if (p === "disabled" && Q(i)) {
1826
+ const k = d.disabled, h = Fe(k) ? k : a, w = de(h);
1827
+ x(() => {
1828
+ i.disabled = w;
1829
+ }), w ? x(() => {
1830
+ K(i, p, "");
1831
+ }) : x(() => {
1832
+ Z(i, p);
1833
+ });
1834
+ continue;
1835
+ }
1836
+ if (!j && p === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement || i instanceof HTMLProgressElement))
1837
+ try {
1838
+ i instanceof HTMLProgressElement ? i.value = Number(a) : i.value = String(a ?? "");
1839
+ } catch {
1840
+ const k = F(a);
1841
+ k !== null && K(i, p, String(k));
1842
+ }
1843
+ else if (!j && p === "checked" && i instanceof HTMLInputElement)
1844
+ try {
1845
+ i.checked = !!a;
1846
+ } catch {
1847
+ const k = F(a);
1848
+ k !== null && K(i, p, String(k));
1849
+ }
1850
+ else if (!j && p in i)
1851
+ try {
1852
+ i[p] = a, p === "disabled" && a === !1 && Q(i) && Z(i, "disabled"), re(e.props, p, a);
1853
+ } catch {
1854
+ const k = F(a);
1855
+ k !== null && K(i, p, String(k));
1856
+ }
1857
+ else if ((e.props?.isCustomElement ?? !1) && !j && p.includes("-")) {
1858
+ const h = Ge(p);
1859
+ try {
1860
+ i[h] = a;
1861
+ } catch {
1862
+ const w = F(a);
1863
+ w !== null && K(i, p, String(w));
1864
+ }
1865
+ } else {
1866
+ const h = F(a);
1867
+ h !== null && K(i, p, String(h));
1868
+ }
1869
+ }
1870
+ }
1871
+ for (const p in d) {
1872
+ const T = d[p];
1873
+ if (!(typeof p != "string" || /\[object Object\]/.test(p)))
1874
+ if (p === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement)) {
1875
+ const a = typeof T == "object" && T !== null && Le(T) ? T.value : T;
1876
+ x(() => {
1877
+ i.value = String(a ?? "");
1878
+ });
1879
+ } else if (p.startsWith("on") && typeof T == "function") {
1880
+ const a = dt(p), k = a.includes(":") ? (() => {
1881
+ const h = a.split(":"), w = h[1];
1882
+ if (w.includes("-")) {
1883
+ const E = w.split("-").map(
1884
+ (u, g) => g === 0 ? u : u.charAt(0).toUpperCase() + u.slice(1)
1885
+ ).join("");
1886
+ return `${h[0]}:${E}`;
1887
+ } else {
1888
+ const E = w.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1889
+ return `${h[0]}:${E}`;
1890
+ }
1891
+ })() : a;
1892
+ m.listeners && (m.listeners[a] || m.listeners[k]) || Y.addListener(i, a, T);
1893
+ } else {
1894
+ if (p.startsWith("on") && T === void 0)
1895
+ continue;
1896
+ if (T == null || T === !1)
1897
+ Z(i, p);
1898
+ else {
1899
+ const a = e.props?.isCustomElement ?? !1, k = typeof T == "object" && T !== null && O(T) ? T : Le(T) && typeof T.value < "u" ? T.value : T;
1900
+ if (p === "class" || p === "style") {
1901
+ try {
1902
+ const h = F(k);
1903
+ h !== null && K(i, p, String(h));
1904
+ } catch {
1905
+ }
1906
+ continue;
1907
+ }
1908
+ if (a || p in i)
1909
+ try {
1910
+ const h = typeof T == "object" && T !== null && O(T) ? T : Le(T) ? T.value : T;
1911
+ if (p === "disabled" && Q(i)) {
1912
+ const w = d.disabled !== void 0 ? d.disabled : h, E = de(w);
1913
+ x(() => {
1914
+ i.disabled = E;
1915
+ }), E ? x(() => {
1916
+ K(i, p, "");
1917
+ }) : x(() => {
1918
+ Z(i, p);
1919
+ });
1920
+ continue;
1921
+ }
1922
+ try {
1923
+ if (typeof i[p] == "boolean") {
1924
+ let E = h;
1925
+ typeof h == "string" ? h === "false" ? E = !1 : h === "true" ? E = !0 : E = !!h && h !== "" : E = !!h, i[p] = E;
1926
+ } else
1927
+ i[p] = h;
1928
+ } catch {
1929
+ i[p] = h;
1930
+ }
1931
+ } catch {
1932
+ }
1933
+ }
1934
+ }
1935
+ }
1936
+ const S = m.listeners ?? {};
1937
+ for (const [p, T] of Object.entries(S))
1938
+ Y.addListener(i, p, T);
1939
+ Object.keys(S).length > 0 && Ie.set(i, S);
1940
+ const L = {
1941
+ ...e,
1942
+ props: {
1943
+ ...e.props,
1944
+ ...m.props
1945
+ }
1946
+ };
1947
+ Ae(L, i, t);
1948
+ try {
1949
+ const p = i;
1950
+ if (typeof p._applyProps == "function")
1951
+ try {
1952
+ p._applyProps(p._cfg);
1953
+ } catch {
1954
+ }
1955
+ typeof p.requestRender == "function" ? p.requestRender() : typeof p._render == "function" && p._render(p._cfg);
1956
+ } catch {
1957
+ }
1958
+ if (Array.isArray(e.children)) {
1959
+ const p = e.tag === "foreignObject" && o === At ? null : i.namespaceURI ?? null;
1960
+ for (const T of e.children)
1961
+ i.appendChild(J(T, s, t, p));
1962
+ } else typeof e.children == "string" && (i.textContent = e.children);
1963
+ try {
1964
+ if (i instanceof HTMLSelectElement && C && Object.prototype.hasOwnProperty.call(C, "value"))
1965
+ try {
1966
+ i.value = String(C.value ?? "");
1967
+ } catch {
1968
+ }
1969
+ } catch {
1970
+ }
1971
+ try {
1972
+ if (Q(i)) {
1973
+ const p = d.disabled, T = C.disabled, a = p && typeof p == "object" && "value" in p;
1974
+ let k = !1;
1975
+ try {
1976
+ k = !!O(p);
1977
+ } catch {
1978
+ k = !1;
1979
+ }
1980
+ const w = k || a || Fe(p) ? p : T, E = de(w);
1981
+ x(() => {
1982
+ i.disabled = E;
1983
+ }), E ? x(() => {
1984
+ K(i, "disabled", "");
1985
+ }) : x(() => {
1986
+ Z(i, "disabled");
1987
+ });
1988
+ }
1989
+ } catch {
1990
+ }
1991
+ return i;
1992
+ }
1993
+ function Yt(e, s, t, r, n) {
1994
+ if (typeof t == "string") {
1995
+ e.textContent !== t && (e.textContent = t);
1996
+ return;
1997
+ }
1998
+ if (!Array.isArray(t)) return;
1999
+ const c = e.childNodes, o = [];
2000
+ for (let S = 0; S < c.length; S++)
2001
+ o.push(c[S]);
2002
+ const i = Array.isArray(s) ? s : [], f = Jt(e);
2003
+ if (f) {
2004
+ const S = (a) => {
2005
+ if (typeof a == "string")
2006
+ return a.startsWith("each-") ? a.substring(5) : a;
2007
+ if (typeof a == "number") return String(a);
2008
+ }, L = [], p = [];
2009
+ for (const a of t)
2010
+ if (a && a.tag === "#anchor") {
2011
+ const k = Array.isArray(a.children) ? a.children : [];
2012
+ for (const h of k) {
2013
+ const w = S(
2014
+ h.key ?? a.key ?? "unknown"
2015
+ );
2016
+ L.push({ ...h, key: w });
2017
+ }
2018
+ } else a && L.push({ ...a, key: S(a.key) });
2019
+ for (const a of i)
2020
+ if (a && a.tag === "#anchor") {
2021
+ const k = Array.isArray(a.children) ? a.children : [];
2022
+ for (const h of k) {
2023
+ const w = S(
2024
+ h.key ?? a.key ?? "unknown"
2025
+ );
2026
+ p.push({ ...h, key: w });
2027
+ }
2028
+ } else a && p.push({
2029
+ ...a,
2030
+ key: S(a.key)
2031
+ });
2032
+ if (L.some((a) => a && a.key != null) || p.some((a) => a && a.key != null)) {
2033
+ const a = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
2034
+ for (const l of p)
2035
+ if (l && l.key != null) {
2036
+ const v = String(l.key);
2037
+ a.set(v, l);
2038
+ }
2039
+ for (let l = 0; l < o.length; l++) {
2040
+ const v = o[l];
2041
+ let _ = xe(v);
2042
+ if (_ = S(_), _ != null && v instanceof Element && v.nodeType === Node.ELEMENT_NODE) {
2043
+ let A = typeof _ == "string" && _.includes(":") ? _.substring(0, _.lastIndexOf(":")) : _;
2044
+ A = String(A), k.set(A, v);
2045
+ }
2046
+ }
2047
+ const h = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map(), E = o.length > 0;
2048
+ if (f.moveClass && E)
2049
+ for (let l = 0; l < o.length; l++) {
2050
+ const v = o[l];
2051
+ if (v instanceof HTMLElement && v.parentElement) {
2052
+ const _ = v.getBoundingClientRect();
2053
+ w.set(v, _);
2054
+ }
2055
+ }
2056
+ const u = [];
2057
+ for (const l of L) {
2058
+ let v = l.key;
2059
+ if (v == null) continue;
2060
+ v = String(v);
2061
+ const _ = a.get(v);
2062
+ let A = k.get(v);
2063
+ if (A && _) {
2064
+ const N = Te(A, _, l, r);
2065
+ h.add(A);
2066
+ const $ = String(v);
2067
+ G(N, $), u.push({
2068
+ node: N,
2069
+ key: v,
2070
+ newVNode: l,
2071
+ oldVNode: _,
2072
+ isNew: !1
2073
+ });
2074
+ } else {
2075
+ A = J(
2076
+ l,
2077
+ r,
2078
+ void 0,
2079
+ e instanceof Element ? e.namespaceURI ?? null : null
2080
+ ), G(A, String(v)), e.appendChild(A);
2081
+ const N = E || f.appear === !0;
2082
+ A instanceof HTMLElement && N && _e(A, f).catch(($) => {
2083
+ W("Enter transition error:", $);
2084
+ }), u.push({ node: A, key: v, newVNode: l, isNew: !0 });
2085
+ }
2086
+ }
2087
+ const g = [];
2088
+ for (let l = 0; l < o.length; l++) {
2089
+ const v = o[l], _ = xe(v);
2090
+ if (!h.has(v) && _ != null && v instanceof HTMLElement) {
2091
+ const N = Ke(v, f).then(() => {
2092
+ e.contains(v) && e.removeChild(v);
2093
+ }).catch(($) => {
2094
+ W("Leave transition error:", $), e.contains(v) && e.removeChild(v);
2095
+ });
2096
+ g.push(N);
2097
+ }
2098
+ }
2099
+ if (g.length === 0) {
2100
+ let l = e.firstChild;
2101
+ for (const { node: v } of u)
2102
+ v !== l && e.insertBefore(v, l), l = v.nextSibling;
2103
+ if (f.moveClass && w.size > 0) {
2104
+ const v = [];
2105
+ for (const { node: _, isNew: A } of u)
2106
+ if (!A && _ instanceof HTMLElement) {
2107
+ const N = w.get(_);
2108
+ if (N) {
2109
+ const $ = _.getBoundingClientRect(), H = N.left - $.left, M = N.top - $.top;
2110
+ if (H !== 0 || M !== 0) {
2111
+ const D = f.moveClass.split(/\s+/).filter((R) => R);
2112
+ v.push({ node: _, deltaX: H, deltaY: M, moveClasses: D });
2113
+ }
2114
+ }
2115
+ }
2116
+ if (v.length > 0) {
2117
+ for (const { node: _, deltaX: A, deltaY: N } of v)
2118
+ _.style.transform = `translate(${A}px, ${N}px)`, _.style.transitionProperty = "none";
2119
+ e.offsetHeight, requestAnimationFrame(() => {
2120
+ requestAnimationFrame(() => {
2121
+ for (const { node: _, moveClasses: A } of v)
2122
+ for (const N of A)
2123
+ _.classList.add(N);
2124
+ requestAnimationFrame(() => {
2125
+ const _ = f.moveClass || "", A = _.match(/duration-(\d+)/), N = A ? `${A[1]}ms` : "300ms", $ = _.match(
2126
+ /ease-(out|in|in-out|linear)/
2127
+ ), H = $ ? `ease-${$[1]}` : "ease-out";
2128
+ for (const { node: M } of v)
2129
+ M.style.transition = `transform ${N} ${H}`;
2130
+ requestAnimationFrame(() => {
2131
+ for (const { node: M, moveClasses: D } of v) {
2132
+ M.style.removeProperty("transform");
2133
+ const R = () => {
2134
+ for (const ee of D)
2135
+ M.classList.remove(ee);
2136
+ M.style.removeProperty("transition"), M.removeEventListener("transitionend", R), M.removeEventListener("transitioncancel", R);
2137
+ };
2138
+ M.addEventListener("transitionend", R, {
2139
+ once: !0
2140
+ }), M.addEventListener("transitioncancel", R, {
2141
+ once: !0
2142
+ });
2143
+ }
2144
+ });
2145
+ });
2146
+ });
2147
+ });
2148
+ }
2149
+ }
2150
+ }
2151
+ return;
2152
+ }
2153
+ }
2154
+ const b = /* @__PURE__ */ new Map();
2155
+ for (const S of i)
2156
+ S && S.key != null && b.set(S.key, S);
2157
+ const y = /* @__PURE__ */ new Map();
2158
+ for (let S = 0; S < o.length; S++) {
2159
+ const L = o[S], p = xe(L);
2160
+ p != null && y.set(p, L);
2161
+ }
2162
+ const m = /* @__PURE__ */ new Set();
2163
+ let d = e.firstChild;
2164
+ function C(S, L) {
2165
+ let p = S;
2166
+ for (; p && (m.add(p), p !== L); )
2167
+ p = p.nextSibling;
2168
+ }
2169
+ function j(S, L, p, T, a, k = !0) {
2170
+ const h = [];
2171
+ let w = S.nextSibling;
2172
+ for (; w && w !== L; )
2173
+ h.push(w), w = w.nextSibling;
2174
+ const E = Array.isArray(p) ? p : [];
2175
+ if (T.some((g) => g && g.key != null) || E.some((g) => g && g.key != null)) {
2176
+ const g = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2177
+ for (const N of E)
2178
+ N && N.key != null && g.set(N.key, N);
2179
+ for (const N of h) {
2180
+ const $ = xe(N);
2181
+ $ != null && l.set($, N);
2182
+ }
2183
+ const v = a && a.state === "visible" && E.length === 0 && T.length > 0, _ = /* @__PURE__ */ new Set();
2184
+ let A = S.nextSibling;
2185
+ for (const N of T) {
2186
+ if (typeof N == "object" && N.tag === "#anchor") {
2187
+ const H = N.key, M = `${H}:start`, D = `${H}:end`, R = l.get(M), ee = l.get(D), q = Array.isArray(N.children) ? N.children : [], I = g.get(H);
2188
+ let P, B;
2189
+ if (R && ee && e.contains(R))
2190
+ P = R, B = ee, j(
2191
+ P,
2192
+ B,
2193
+ I?.children,
2194
+ q
2195
+ );
2196
+ else {
2197
+ P = document.createTextNode(""), B = document.createTextNode(""), G(P, M), G(B, D), e.insertBefore(P, A);
2198
+ for (const pe of q) {
2199
+ const oe = J(
2200
+ pe,
2201
+ r,
2202
+ void 0,
2203
+ e instanceof Element ? e.namespaceURI ?? null : null
2204
+ );
2205
+ e.insertBefore(oe, A), _.add(oe);
2206
+ }
2207
+ e.insertBefore(B, A);
2208
+ }
2209
+ let U = P;
2210
+ for (; U && (_.add(U), U !== B); )
2211
+ U = U.nextSibling;
2212
+ N._startNode = P, N._endNode = B, A = B.nextSibling;
2213
+ continue;
2214
+ }
2215
+ let $;
2216
+ if (N.key != null && l.has(N.key)) {
2217
+ const H = g.get(N.key);
2218
+ $ = Te(
2219
+ l.get(N.key),
2220
+ H,
2221
+ N,
2222
+ r
2223
+ ), _.add($), a && $ instanceof HTMLElement && v && a.appear && _e($, a).catch((M) => {
2224
+ W("Transition enter error (appear):", M);
2225
+ }), $ !== A && e.contains($) && e.insertBefore($, A);
2226
+ } else
2227
+ $ = J(
2228
+ N,
2229
+ r,
2230
+ void 0,
2231
+ e instanceof Element ? e.namespaceURI ?? null : null
2232
+ ), e.insertBefore($, A), _.add($), a && $ instanceof HTMLElement && k && _e($, a).catch((H) => {
2233
+ W("Transition enter error:", H);
2234
+ });
2235
+ A = $.nextSibling;
2236
+ }
2237
+ for (const N of h)
2238
+ !_.has(N) && e.contains(N) && (a && N instanceof HTMLElement && k ? Ke(N, a).then(() => {
2239
+ e.contains(N) && e.removeChild(N);
2240
+ }).catch(($) => {
2241
+ W("Transition leave error:", $), e.contains(N) && e.removeChild(N);
2242
+ }) : e.removeChild(N));
2243
+ } else {
2244
+ const g = Math.min(
2245
+ E.length,
2246
+ T.length
2247
+ );
2248
+ for (let l = 0; l < g; l++) {
2249
+ const v = E[l], _ = T[l], A = Te(h[l], v, _, r);
2250
+ A !== h[l] && (e.insertBefore(A, h[l]), e.removeChild(h[l]));
2251
+ }
2252
+ for (let l = g; l < T.length; l++) {
2253
+ const v = J(
2254
+ T[l],
2255
+ r,
2256
+ void 0,
2257
+ e instanceof Element ? e.namespaceURI ?? null : null
2258
+ );
2259
+ e.insertBefore(v, L), a && v instanceof HTMLElement && k && _e(v, a).catch((_) => {
2260
+ W("Transition enter error:", _);
2261
+ });
2262
+ }
2263
+ for (let l = g; l < h.length; l++) {
2264
+ const v = h[l];
2265
+ a && v instanceof HTMLElement && k ? Ke(v, a).then(() => {
2266
+ e.contains(v) && e.removeChild(v);
2267
+ }).catch((_) => {
2268
+ W("Transition leave error:", _), e.contains(v) && e.removeChild(v);
2269
+ }) : e.removeChild(v);
2270
+ }
2271
+ }
2272
+ }
2273
+ for (const S of t) {
2274
+ let L;
2275
+ if (S.tag === "#anchor") {
2276
+ const p = S.key, T = `${p}:start`, a = `${p}:end`;
2277
+ let k = y.get(T), h = y.get(a);
2278
+ const w = Array.isArray(S.children) ? S.children : [];
2279
+ if (k || (k = document.createTextNode(""), G(k, T)), h || (h = document.createTextNode(""), G(h, a)), S._startNode = k, S._endNode = h, !e.contains(k) || !e.contains(h)) {
2280
+ e.insertBefore(k, d);
2281
+ const E = S._transition, g = !(E && E.state === "visible" && w.length > 0) || E.appear;
2282
+ for (const l of w) {
2283
+ const v = J(
2284
+ l,
2285
+ r,
2286
+ n,
2287
+ e instanceof Element ? e.namespaceURI ?? null : null
2288
+ );
2289
+ e.insertBefore(v, d), E && v instanceof HTMLElement && g && _e(v, E).catch((_) => {
2290
+ W("Transition enter error:", _);
2291
+ });
2292
+ }
2293
+ e.insertBefore(h, d);
2294
+ } else {
2295
+ const E = S._transition, g = b.get(p)._transition, l = g && g.state !== E?.state, v = E && E.state === "visible" && w.length > 0 && !l, _ = l || !v || E?.appear === !0;
2296
+ j(
2297
+ k,
2298
+ h,
2299
+ b.get(p)?.children,
2300
+ w,
2301
+ E,
2302
+ _
2303
+ );
2304
+ }
2305
+ C(k, h), d = h.nextSibling;
2306
+ continue;
2307
+ }
2308
+ if (S.key != null && y.has(S.key)) {
2309
+ const p = b.get(S.key);
2310
+ L = Te(
2311
+ y.get(S.key),
2312
+ p,
2313
+ S,
2314
+ r,
2315
+ n
2316
+ ), m.add(L), L !== d && e.contains(L) && (d && !e.contains(d) && (d = null), e.insertBefore(L, d));
2317
+ } else
2318
+ L = J(
2319
+ S,
2320
+ r,
2321
+ n,
2322
+ e instanceof Element ? e.namespaceURI ?? null : null
2323
+ ), d && !e.contains(d) && (d = null), e.insertBefore(L, d), m.add(L);
2324
+ d = L.nextSibling;
2325
+ }
2326
+ for (let S = 0; S < o.length; S++) {
2327
+ const L = o[S];
2328
+ !m.has(L) && e.contains(L) && (ue(L, n), e.removeChild(L));
2329
+ }
2330
+ }
2331
+ function Te(e, s, t, r, n) {
2332
+ if (s && typeof s != "string" && s.props?.ref && n && ue(e, n), s === t) return e;
2333
+ if (typeof t == "string") {
2334
+ if (e.nodeType === Node.TEXT_NODE)
2335
+ return e.textContent !== t && (e.textContent = t), e;
2336
+ {
2337
+ const o = document.createTextNode(t);
2338
+ return e.parentNode?.replaceChild(o, e), o;
2339
+ }
2340
+ }
2341
+ if (t && typeof t != "string" && t.tag === "#anchor") {
2342
+ const o = t, i = Array.isArray(o.children) ? o.children : [], f = o._startNode ?? document.createTextNode(""), b = o._endNode ?? document.createTextNode("");
2343
+ o.key != null && (G(f, `${o.key}:start`), G(b, `${o.key}:end`)), o._startNode = f, o._endNode = b;
2344
+ const y = document.createDocumentFragment();
2345
+ y.appendChild(f);
2346
+ for (const m of i) {
2347
+ const d = J(
2348
+ m,
2349
+ r,
2350
+ n,
2351
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2352
+ );
2353
+ y.appendChild(d);
2354
+ }
2355
+ return y.appendChild(b), e.parentNode?.replaceChild(y, e), f;
2356
+ }
2357
+ if (!t) {
2358
+ ue(e, n);
2359
+ const o = document.createComment("removed");
2360
+ return e.parentNode?.replaceChild(o, e), o;
2361
+ }
2362
+ if (!s || typeof s == "string") {
2363
+ ue(e, n);
2364
+ const o = J(
2365
+ t,
2366
+ r,
2367
+ n,
2368
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2369
+ );
2370
+ return Ae(t, o, n), e.parentNode?.replaceChild(o, e), o;
2371
+ }
2372
+ if (t.tag === "#anchor") {
2373
+ const o = Array.isArray(t.children) ? t.children : [], i = t._startNode ?? document.createTextNode(""), f = t._endNode ?? document.createTextNode("");
2374
+ t.key != null && (G(i, `${t.key}:start`), G(f, `${t.key}:end`)), t._startNode = i, t._endNode = f;
2375
+ const b = document.createDocumentFragment();
2376
+ b.appendChild(i);
2377
+ for (const y of o)
2378
+ b.appendChild(
2379
+ J(
2380
+ y,
2381
+ r,
2382
+ n,
2383
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2384
+ )
2385
+ );
2386
+ return b.appendChild(f), e.parentNode?.replaceChild(b, e), i;
2387
+ }
2388
+ if (typeof s != "string" && typeof t != "string" && s.tag === t.tag && s.key === t.key) {
2389
+ const o = e;
2390
+ return it(o, s.props || {}, t.props || {}, r), Yt(o, s.children, t.children, r, n), Ae(t, o, n), o;
2391
+ }
2392
+ if (typeof s != "string" && typeof t != "string" && s.tag === t.tag && (s.tag && String(s.tag).includes("-") || t.props && t.props.isCustomElement || s.props && s.props.isCustomElement))
2393
+ try {
2394
+ const i = e;
2395
+ return it(i, s.props || {}, t.props || {}, r), Ae(t, i, n), i;
2396
+ } catch {
2397
+ }
2398
+ ue(e, n);
2399
+ const c = J(
2400
+ t,
2401
+ r,
2402
+ n,
2403
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2404
+ );
2405
+ return Ae(t, c, n), e.parentNode?.replaceChild(c, e), c;
2406
+ }
2407
+ function Xt(e, s, t, r) {
2408
+ let n;
2409
+ Array.isArray(s) ? s.length === 1 ? (n = s[0], n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })) : n = { tag: "div", key: "__root__", children: s } : (n = s, n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })), n && typeof n == "object" && n.tag === "#anchor" && (n = {
2410
+ tag: "div",
2411
+ key: "__anchor_root__",
2412
+ props: {
2413
+ attrs: { "data-anchor-block-root": "", key: "__anchor_root__" }
2414
+ },
2415
+ children: [n]
2416
+ }), n = qe(n, String(n.key ?? "root"));
2417
+ const c = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null;
2418
+ let i;
2419
+ c && o ? typeof c != "string" && typeof n != "string" && c.tag === n.tag && c.key === n.key ? i = Te(o, c, n, t, r) : (i = J(
2420
+ n,
2421
+ t,
2422
+ r,
2423
+ e.host instanceof Element ? e.host.namespaceURI ?? null : null
2424
+ ), e.replaceChild(i, o)) : (i = J(
2425
+ n,
2426
+ t,
2427
+ r,
2428
+ e.host instanceof Element ? e.host.namespaceURI ?? null : null
2429
+ ), e.firstChild ? e.replaceChild(i, e.firstChild) : e.appendChild(i));
2430
+ const f = [];
2431
+ for (let y = 0; y < e.childNodes.length; y++) {
2432
+ const m = e.childNodes[y];
2433
+ m !== i && m.nodeName !== "STYLE" && (ue(m, r), f.push(m));
2434
+ }
2435
+ f.forEach((y) => e.removeChild(y));
2436
+ const b = n && typeof n == "object" && n.props ? {
2437
+ ...n,
2438
+ props: {
2439
+ ...n.props,
2440
+ attrs: n.props.attrs ? { ...n.props.attrs } : void 0,
2441
+ props: n.props.props ? { ...n.props.props } : void 0
2442
+ }
2443
+ } : n;
2444
+ e._prevVNode = b, e._prevDom = i;
2445
+ }
2446
+ const Ne = [], ot = /* @__PURE__ */ new WeakMap(), be = /* @__PURE__ */ new WeakMap();
2447
+ function Qt(e, s) {
2448
+ be.has(e) || be.set(e, /* @__PURE__ */ new Set()), be.get(e).add(s);
2449
+ }
2450
+ function en(e, s) {
2451
+ const t = be.get(e);
2452
+ t && (t.delete(s), t.size === 0 && be.delete(e));
2453
+ }
2454
+ function tn(e, s, t, r, n, c, o, i) {
2455
+ if (e) {
2456
+ Ne.push(t);
2457
+ try {
2458
+ const f = s.render(t);
2459
+ if (f instanceof Promise) {
2460
+ c(!0);
2461
+ const b = e.host.isConnected, y = e, m = y._asyncRenderToken = (y._asyncRenderToken ?? 0) + 1;
2462
+ f.then((d) => {
2463
+ b && !e.host.isConnected || y._asyncRenderToken === m && (c(!1), o(null), ct(e, d, t, r, n), i(e.innerHTML));
2464
+ }).catch((d) => {
2465
+ b && !e.host.isConnected || y._asyncRenderToken === m && (c(!1), o(d instanceof Error ? d : new Error(String(d))));
2466
+ });
2467
+ return;
2468
+ }
2469
+ ct(e, f, t, r, n), i(e.innerHTML);
2470
+ } catch (f) {
2471
+ o(f instanceof Error ? f : new Error(String(f)));
2472
+ } finally {
2473
+ Ne.pop();
2474
+ }
2475
+ }
2476
+ }
2477
+ function ct(e, s, t, r, n) {
2478
+ if (e)
2479
+ try {
2480
+ Xt(
2481
+ e,
2482
+ Array.isArray(s) ? s : [s],
2483
+ t,
2484
+ r
2485
+ ), n(e.innerHTML);
2486
+ } catch (c) {
2487
+ throw W("Error during VDOM rendering:", c), c;
2488
+ }
2489
+ }
2490
+ function nn(e, s, t, r, n, c, o) {
2491
+ c !== null && clearTimeout(c);
2492
+ const b = Date.now() - s < 16, y = (() => {
2493
+ try {
2494
+ return typeof window < "u" && !!window.Cypress;
2495
+ } catch {
2496
+ return !1;
2497
+ }
2498
+ })(), m = (() => {
2499
+ try {
2500
+ return globalThis.process?.env?.NODE_ENV === "test" && !y;
2501
+ } catch {
2502
+ return !1;
2503
+ }
2504
+ })(), d = m || y;
2505
+ if (b) {
2506
+ const S = t + 1;
2507
+ n(S);
2508
+ const L = d ? 50 : 10, p = d ? 100 : 25, T = m ? 12 : 50;
2509
+ if (S === L && !d)
2510
+ te(
2511
+ `⚠️ Component rendering frequently. Performance may be impacted.
2512
+ Common causes:
2513
+ • State updates during render cycle
2514
+ • Event handlers with immediate function calls
2515
+ • Missing effect dependencies`
2516
+ );
2517
+ else if (S === p && !d)
2518
+ te(
2519
+ `⚠️ Component is re-rendering rapidly. Applying throttling.
2520
+ This might indicate:
2521
+ • Event handler calling function immediately: @click="\${fn()}" should be @click="\${fn}"
2522
+ • State modification during render
2523
+ • Missing dependencies in computed/watch`
2524
+ );
2525
+ else if (S >= T) {
2526
+ W(
2527
+ `🛑 Infinite render loop detected. Stopping to prevent browser freeze.
2528
+ Possible causes:
2529
+ • State updates triggering immediate re-renders
2530
+ • Computed values changing during evaluation
2531
+ • Circular dependencies in reactive system`
2532
+ ), o(null);
2533
+ return;
2534
+ }
2535
+ } else
2536
+ n(0);
2537
+ let C = 0;
2538
+ d || (t >= 40 ? C = 500 : t >= 25 ? C = 100 : t >= 15 && (C = 16));
2539
+ const j = () => {
2540
+ r(Date.now());
2541
+ try {
2542
+ e();
2543
+ } catch (S) {
2544
+ W("Error during render execution:", S);
2545
+ } finally {
2546
+ o(null);
2547
+ }
2548
+ };
2549
+ if (C > 0) {
2550
+ const S = setTimeout(j, C);
2551
+ o(S);
2552
+ } else d ? j() : (o({}), queueMicrotask(j));
2553
+ }
2554
+ function sn(e, s) {
2555
+ let t = s;
2556
+ try {
2557
+ const r = be.get(e);
2558
+ if (r?.size)
2559
+ for (const n of r)
2560
+ try {
2561
+ const c = n.lastHtmlStringForJitCSS;
2562
+ c?.trim() && (t += `
2563
+ ` + c);
2564
+ } catch {
2565
+ }
2566
+ else {
2567
+ const n = e.querySelectorAll("*");
2568
+ for (const c of n)
2569
+ try {
2570
+ const o = c.lastHtmlStringForJitCSS;
2571
+ o?.trim() && (t += `
2572
+ ` + o);
2573
+ } catch {
2574
+ }
2575
+ }
2576
+ } catch {
2577
+ }
2578
+ return t;
2579
+ }
2580
+ function at(e) {
2581
+ return "adoptedStyleSheets" in e && typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype;
2582
+ }
2583
+ function lt(e, s) {
2584
+ let t = e.querySelector(
2585
+ "style[data-cer-runtime]"
2586
+ );
2587
+ t || (t = document.createElement("style"), K(t, "data-cer-runtime", "true"), e.appendChild(t));
2588
+ try {
2589
+ t.textContent = s;
2590
+ } catch {
2591
+ }
2592
+ }
2593
+ function rn(e, s, t, r, n) {
2594
+ if (!e) return;
2595
+ const c = sn(e, t);
2596
+ if (ot.get(e) === c)
2597
+ return;
2598
+ ot.set(e, c);
2599
+ const i = wt(e) ? Lt(c) : "", f = Nt(), b = s._computedStyle;
2600
+ if (!i?.trim() && !b && !f) {
2601
+ if (n(null), at(e))
2602
+ e.adoptedStyleSheets = [
2603
+ $e(),
2604
+ he()
2605
+ ];
2606
+ else {
2607
+ const p = ke(tt), T = he();
2608
+ let a = "";
2609
+ try {
2610
+ T?.cssRules && (a = Array.from(T.cssRules).map((h) => h.cssText).join(`
2611
+ `));
2612
+ } catch {
2613
+ a = "";
2614
+ }
2615
+ const k = ke(`${p}
2616
+ ${a}`);
2617
+ lt(e, k);
2618
+ try {
2619
+ e.adoptedStyleSheets = [$e(), he()];
2620
+ } catch {
2621
+ }
2622
+ }
2623
+ return;
2624
+ }
2625
+ let y = "";
2626
+ if (b && (y += b + `
2627
+ `), i && (y += i + `
2628
+ `), y = Mt(y), y = ke(y), at(e)) {
2629
+ let L = r;
2630
+ L || (L = new CSSStyleSheet());
2631
+ try {
2632
+ L.replaceSync(y);
2633
+ const p = [$e(), he()];
2634
+ f && p.push(f), p.push(L), e.adoptedStyleSheets = p, n(L);
2635
+ return;
2636
+ } catch {
2637
+ }
2638
+ }
2639
+ const d = ke(tt), C = he();
2640
+ let j = "";
2641
+ try {
2642
+ C?.cssRules && (j = Array.from(C.cssRules).map((L) => L.cssText).join(`
2643
+ `));
2644
+ } catch {
2645
+ j = "";
2646
+ }
2647
+ const S = ke(`${d}
2648
+ ${j}
2649
+ ${y}`);
2650
+ lt(e, S);
2651
+ try {
2652
+ const L = [
2653
+ $e(),
2654
+ he()
2655
+ ];
2656
+ if (f && L.push(f), typeof CSSStyleSheet < "u")
2657
+ try {
2658
+ const p = new CSSStyleSheet();
2659
+ p.replaceSync(y), L.push(p);
2660
+ } catch {
2661
+ L.push({
2662
+ cssRules: [],
2663
+ replaceSync: () => {
2664
+ }
2665
+ });
2666
+ }
2667
+ e.adoptedStyleSheets = L;
2668
+ } catch {
2669
+ }
2670
+ n(null);
2671
+ }
2672
+ function on(e, s) {
2673
+ if (!s.render)
2674
+ throw new Error("Component must have a render function");
2675
+ return typeof window > "u" ? class {
2676
+ constructor() {
2677
+ }
2678
+ } : class extends HTMLElement {
2679
+ context;
2680
+ _refs = {};
2681
+ _listeners = [];
2682
+ _watchers = /* @__PURE__ */ new Map();
2683
+ /** @internal */
2684
+ _renderTimeoutId = null;
2685
+ _mounted = !1;
2686
+ _hasError = !1;
2687
+ _initializing = !0;
2688
+ _componentId;
2689
+ _styleSheet = null;
2690
+ _lastHtmlStringForJitCSS = "";
2691
+ /**
2692
+ * Returns the last rendered HTML string for JIT CSS.
2693
+ */
2694
+ get lastHtmlStringForJitCSS() {
2695
+ return this._lastHtmlStringForJitCSS;
2696
+ }
2697
+ /**
2698
+ * Returns true if the most recent render or lifecycle call threw an error.
2699
+ */
2700
+ get hasError() {
2701
+ return this._hasError;
2702
+ }
2703
+ /**
2704
+ * Returns true if the component is currently loading.
2705
+ */
2706
+ get isLoading() {
2707
+ return this._templateLoading;
2708
+ }
2709
+ /**
2710
+ * Returns the last error thrown during rendering, or null if none.
2711
+ */
2712
+ get lastError() {
2713
+ return this._templateError;
2714
+ }
2715
+ _cfg;
2716
+ _lastRenderTime = 0;
2717
+ _renderCount = 0;
2718
+ _templateLoading = !1;
2719
+ _templateError = null;
2720
+ constructor() {
2721
+ super(), this.shadowRoot || this.attachShadow({ mode: "open" }), this._cfg = we.get(e) || s, this._componentId = `${e}-${crypto.randomUUID()}`;
2722
+ const t = this._initContext(s), r = (c, o, i) => {
2723
+ Object.defineProperty(c, o, {
2724
+ value: i,
2725
+ writable: !1,
2726
+ enumerable: !1,
2727
+ configurable: !1
2728
+ });
2729
+ };
2730
+ r(t, "refs", this._refs), r(
2731
+ t,
2732
+ "requestRender",
2733
+ () => this.requestRender()
2734
+ ), r(
2735
+ t,
2736
+ "_requestRender",
2737
+ () => this._requestRender()
2738
+ ), r(t, "_componentId", this._componentId), r(
2739
+ t,
2740
+ "_triggerWatchers",
2741
+ (c, o) => this._triggerWatchers(c, o)
2742
+ ), this.context = t, x(() => {
2743
+ r(t, "_host", this);
2744
+ }), r(
2745
+ this.context,
2746
+ "emit",
2747
+ (c, o, i) => {
2748
+ const f = {
2749
+ detail: o,
2750
+ bubbles: !0,
2751
+ composed: !0,
2752
+ ...i || {}
2753
+ }, b = new CustomEvent(c, f);
2754
+ this.dispatchEvent(b);
2755
+ const y = c.indexOf(":");
2756
+ if (y > 0) {
2757
+ const m = c.substring(0, y), d = c.substring(y + 1), C = d.includes("-") ? `${m}:${d.split("-").map(
2758
+ (j, S) => S === 0 ? j : j.charAt(0).toUpperCase() + j.slice(1)
2759
+ ).join("")}` : `${m}:${d.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
2760
+ C !== c && x(() => {
2761
+ this.dispatchEvent(new CustomEvent(C, f));
2762
+ });
2763
+ }
2764
+ return !b.defaultPrevented;
2765
+ }
2766
+ );
2767
+ const n = we.get(e) || s;
2768
+ for (const c in n) {
2769
+ const o = n[c];
2770
+ typeof o == "function" && (this.context[c] = (...i) => o(...i, this.context));
2771
+ }
2772
+ if (n.props)
2773
+ for (const c in n.props) {
2774
+ let o = this[c];
2775
+ Object.defineProperty(this, c, {
2776
+ get() {
2777
+ return o;
2778
+ },
2779
+ set(i) {
2780
+ const f = o;
2781
+ o = i, this.context[c] = i, this._initializing || (this._applyProps(n), f !== i && this._requestRender());
2782
+ },
2783
+ enumerable: !0,
2784
+ configurable: !0
2785
+ });
2786
+ }
2787
+ this._initializing = !1, this._initWatchers(n), this._applyProps(n), this._render(n);
2788
+ }
2789
+ connectedCallback() {
2790
+ this._runLogicWithinErrorBoundary(s, () => {
2791
+ const t = this.getRootNode();
2792
+ t && t !== document && "host" in t && Qt(t, this);
2793
+ const r = this.getAttribute("data-cer-hydrate");
2794
+ if (r !== "none") {
2795
+ if (r === "idle") {
2796
+ const n = () => this._hydrateNow(s);
2797
+ typeof requestIdleCallback < "u" ? requestIdleCallback(n) : setTimeout(n, 200);
2798
+ return;
2799
+ }
2800
+ if (r === "visible") {
2801
+ new IntersectionObserver(
2802
+ (c, o) => {
2803
+ c.some((i) => i.isIntersecting) && (o.disconnect(), this._hydrateNow(s));
2804
+ },
2805
+ { rootMargin: "0px", threshold: 0 }
2806
+ ).observe(this);
2807
+ return;
2808
+ }
2809
+ this._applyProps(s), this._requestRender(), nt(s, this.context, this._mounted, (n) => {
2810
+ this._mounted = n;
2811
+ });
2812
+ }
2813
+ });
2814
+ }
2815
+ /** Execute the standard hydration sequence (used by deferred strategies). */
2816
+ _hydrateNow(t) {
2817
+ this._runLogicWithinErrorBoundary(t, () => {
2818
+ this._applyProps(t), this._requestRender(), nt(t, this.context, this._mounted, (r) => {
2819
+ this._mounted = r;
2820
+ });
2821
+ });
2822
+ }
2823
+ disconnectedCallback() {
2824
+ this._runLogicWithinErrorBoundary(s, () => {
2825
+ const t = this.getRootNode();
2826
+ t && t !== document && "host" in t && en(t, this), xt(
2827
+ s,
2828
+ this.context,
2829
+ this._listeners,
2830
+ () => {
2831
+ this._listeners = [];
2832
+ },
2833
+ () => {
2834
+ this._watchers.clear();
2835
+ },
2836
+ (r) => {
2837
+ this._templateLoading = r;
2838
+ },
2839
+ (r) => {
2840
+ this._templateError = r;
2841
+ },
2842
+ (r) => {
2843
+ this._mounted = r;
2844
+ }
2845
+ ), Ue.cleanup(this._componentId);
2846
+ });
2847
+ }
2848
+ attributeChangedCallback(t, r, n) {
2849
+ this._runLogicWithinErrorBoundary(s, () => {
2850
+ this._applyProps(s), r !== n && this._requestRender(), Ht(s, t, r, n, this.context);
2851
+ });
2852
+ }
2853
+ static get observedAttributes() {
2854
+ return s.props ? Object.keys(s.props).map(X) : [];
2855
+ }
2856
+ // --- Render ---
2857
+ _render(t) {
2858
+ this._runLogicWithinErrorBoundary(t, () => {
2859
+ tn(
2860
+ this.shadowRoot,
2861
+ t,
2862
+ this.context,
2863
+ this._refs,
2864
+ (r) => {
2865
+ this._lastHtmlStringForJitCSS = r, typeof this.onHtmlStringUpdate == "function" && this?.onHtmlStringUpdate?.(r);
2866
+ },
2867
+ (r) => {
2868
+ this._templateLoading = r, this?.onLoadingStateChange?.(r);
2869
+ },
2870
+ (r) => {
2871
+ this._templateError = r, this?.onErrorStateChange?.(r);
2872
+ },
2873
+ (r) => this._applyStyle(t, r)
2874
+ );
2875
+ });
2876
+ }
2877
+ requestRender() {
2878
+ this._requestRender();
2879
+ }
2880
+ _requestRender() {
2881
+ this._runLogicWithinErrorBoundary(this._cfg, () => {
2882
+ Ce(() => {
2883
+ nn(
2884
+ () => this._render(this._cfg),
2885
+ this._lastRenderTime,
2886
+ this._renderCount,
2887
+ (t) => {
2888
+ this._lastRenderTime = t;
2889
+ },
2890
+ (t) => {
2891
+ this._renderCount = t;
2892
+ },
2893
+ this._renderTimeoutId,
2894
+ (t) => {
2895
+ this._renderTimeoutId = t;
2896
+ }
2897
+ );
2898
+ }, this._componentId);
2899
+ });
2900
+ }
2901
+ // --- Style ---
2902
+ _applyStyle(t, r) {
2903
+ this._runLogicWithinErrorBoundary(t, () => {
2904
+ rn(
2905
+ this.shadowRoot,
2906
+ this.context,
2907
+ r,
2908
+ this._styleSheet,
2909
+ (n) => {
2910
+ this._styleSheet = n;
2911
+ }
2912
+ );
2913
+ });
2914
+ }
2915
+ // --- Error Boundary function ---
2916
+ _runLogicWithinErrorBoundary(t, r) {
2917
+ try {
2918
+ r(), this._hasError = !1;
2919
+ } catch (n) {
2920
+ this._hasError = !0;
2921
+ try {
2922
+ const c = this.tagName?.toLowerCase?.() || "<unknown>", o = this._componentId || "<unknown-id>", i = {};
2923
+ if (t && t.props)
2924
+ for (const f of Object.keys(t.props))
2925
+ try {
2926
+ const b = this.context[f];
2927
+ b instanceof Node ? i[f] = `[DOM Node: ${b.nodeName}]` : typeof b == "object" && b !== null ? i[f] = Object.keys(b).length > 5 ? `[object(${Object.keys(b).length} keys)]` : b : i[f] = b;
2928
+ } catch {
2929
+ i[f] = "[unreadable]";
2930
+ }
2931
+ W(`Error rendering component <${c}> (id=${o}):`, n), W("Component props snapshot:", i), te(
2932
+ "Common causes: accessing properties of null/undefined inside template interpolations; expensive or throwing expressions inside templates that evaluate eagerly. Fixes: use optional chaining (obj?.prop), guard with ternary, or use the runtime lazy overload: when(cond, () => html`...`)."
2933
+ );
2934
+ } catch {
2935
+ }
2936
+ if (t.onError && t.onError(n, this.context), this.tagName.toLowerCase() !== "cer-error-boundary") {
2937
+ let c = this.parentElement;
2938
+ if (!c) {
2939
+ const o = this.getRootNode();
2940
+ o instanceof ShadowRoot && (c = o.host.parentElement);
2941
+ }
2942
+ for (; c; ) {
2943
+ if (c.tagName.toLowerCase() === "cer-error-boundary") {
2944
+ c._cerHandleChildError?.(
2945
+ n
2946
+ );
2947
+ break;
2948
+ }
2949
+ let o = c.parentElement;
2950
+ if (!o) {
2951
+ const i = c.getRootNode();
2952
+ i instanceof ShadowRoot && (o = i.host.parentElement);
2953
+ }
2954
+ c = o;
2955
+ }
2956
+ }
2957
+ }
2958
+ }
2959
+ // --- State, props, computed ---
2960
+ _initContext(t) {
2961
+ try {
2962
+ let r = function(c, o = "") {
2963
+ if (Array.isArray(c))
2964
+ return new Proxy(c, {
2965
+ get(i, f, b) {
2966
+ const y = Reflect.get(i, f, b);
2967
+ return typeof y == "function" && typeof f == "string" && [
2968
+ "push",
2969
+ "pop",
2970
+ "shift",
2971
+ "unshift",
2972
+ "splice",
2973
+ "sort",
2974
+ "reverse"
2975
+ ].includes(f) ? function(...d) {
2976
+ const C = y.apply(i, d);
2977
+ if (!n._initializing) {
2978
+ const j = o || "root";
2979
+ n._triggerWatchers(j, i), Ce(
2980
+ () => n._render(t),
2981
+ n._componentId
2982
+ );
2983
+ }
2984
+ return C;
2985
+ } : y;
2986
+ },
2987
+ set(i, f, b) {
2988
+ if (i[String(f)] = b, !n._initializing) {
2989
+ const y = o ? `${o}.${String(f)}` : String(f);
2990
+ n._triggerWatchers(y, b), Ce(() => n._render(t), n._componentId);
2991
+ }
2992
+ return !0;
2993
+ },
2994
+ deleteProperty(i, f) {
2995
+ if (delete i[String(f)], !n._initializing) {
2996
+ const b = o ? `${o}.${String(f)}` : String(f);
2997
+ n._triggerWatchers(b, void 0), Ce(() => n._render(t), n._componentId);
2998
+ }
2999
+ return !0;
3000
+ }
3001
+ });
3002
+ if (c && typeof c == "object") {
3003
+ if (O(c))
3004
+ return c;
3005
+ for (const i in c) {
3006
+ const f = o ? `${o}.${i}` : i;
3007
+ c[i] = r(c[i], f);
3008
+ }
3009
+ return new Proxy(c, {
3010
+ set(i, f, b) {
3011
+ const y = o ? `${o}.${String(f)}` : String(f);
3012
+ return i[String(f)] = r(b, y), n._initializing || (n._triggerWatchers(
3013
+ y,
3014
+ i[String(f)]
3015
+ ), Ce(() => n._render(t), n._componentId)), !0;
3016
+ },
3017
+ get(i, f, b) {
3018
+ return Reflect.get(i, f, b);
3019
+ }
3020
+ });
3021
+ }
3022
+ return c;
3023
+ };
3024
+ const n = this;
3025
+ return r({
3026
+ // For functional components, state is managed by state() function calls
3027
+ // Include prop defaults in initial reactive context so prop updates trigger reactivity
3028
+ ...t.props ? Object.fromEntries(
3029
+ Object.entries(t.props).map(([c, o]) => [
3030
+ c,
3031
+ o.default
3032
+ ])
3033
+ ) : {}
3034
+ });
3035
+ } catch {
3036
+ return {};
3037
+ }
3038
+ }
3039
+ _initWatchers(t) {
3040
+ this._runLogicWithinErrorBoundary(t, () => {
3041
+ jt(
3042
+ this.context,
3043
+ this._watchers,
3044
+ {}
3045
+ // Watchers are now handled by the watch() function in functional API
3046
+ );
3047
+ });
3048
+ }
3049
+ _triggerWatchers(t, r) {
3050
+ $t(this.context, this._watchers, t, r);
3051
+ }
3052
+ _applyProps(t) {
3053
+ this._runLogicWithinErrorBoundary(t, () => {
3054
+ Ot(this, t, this.context);
3055
+ });
3056
+ }
3057
+ };
3058
+ }
3059
+ function He(e, s, t, r) {
3060
+ for (const n of t)
3061
+ try {
3062
+ n(...r);
3063
+ } catch (c) {
3064
+ W(
3065
+ `[${e}] Error in ${s} lifecycle hook:`,
3066
+ c
3067
+ );
3068
+ }
3069
+ }
3070
+ function bn(e, s, t) {
3071
+ Tt();
3072
+ let r = X(e);
3073
+ r.includes("-") || (r = `cer-${r}`);
3074
+ const n = {}, c = {
3075
+ // Props are accessed via useProps() hook
3076
+ props: {},
3077
+ hydrate: t?.hydrate,
3078
+ // Add lifecycle hooks from the stored functions
3079
+ onConnected: (o) => {
3080
+ if (n.onConnected)
3081
+ try {
3082
+ n.onConnected(o);
3083
+ } catch (i) {
3084
+ W(`[${r}] Error in onConnected lifecycle hook:`, i);
3085
+ }
3086
+ },
3087
+ onDisconnected: (o) => {
3088
+ if (n.onDisconnected)
3089
+ try {
3090
+ n.onDisconnected(o);
3091
+ } catch (i) {
3092
+ W(`[${r}] Error in onDisconnected lifecycle hook:`, i);
3093
+ }
3094
+ },
3095
+ onAttributeChanged: (o, i, f, b) => {
3096
+ if (n.onAttributeChanged)
3097
+ try {
3098
+ n.onAttributeChanged(o, i, f, b);
3099
+ } catch (y) {
3100
+ W(`[${r}] Error in onAttributeChanged lifecycle hook:`, y);
3101
+ }
3102
+ },
3103
+ onError: (o, i) => {
3104
+ if (n.onError && o)
3105
+ try {
3106
+ n.onError(o, i);
3107
+ } catch (f) {
3108
+ W(`[${r}] Error in onError handler (the error handler itself threw):`, f);
3109
+ }
3110
+ },
3111
+ render: (o) => {
3112
+ const i = o, f = i._componentId || `${r}-${crypto.randomUUID()}`;
3113
+ Ue.setCurrentComponent(f, () => {
3114
+ o.requestRender && o.requestRender();
3115
+ });
3116
+ try {
3117
+ Object.defineProperty(o, "_hookCallbacks", {
3118
+ value: {},
3119
+ writable: !0,
3120
+ enumerable: !1,
3121
+ configurable: !0
3122
+ }), Object.defineProperty(o, "_computedStyle", {
3123
+ value: void 0,
3124
+ writable: !0,
3125
+ enumerable: !1,
3126
+ configurable: !0
3127
+ }), Ye(o), et();
3128
+ let b;
3129
+ try {
3130
+ b = s();
3131
+ } catch (y) {
3132
+ try {
3133
+ const d = i._hookCallbacks?.onError;
3134
+ if (Array.isArray(d))
3135
+ for (const C of d)
3136
+ try {
3137
+ C(y);
3138
+ } catch {
3139
+ }
3140
+ else if (typeof d == "function")
3141
+ try {
3142
+ d(y);
3143
+ } catch {
3144
+ }
3145
+ } catch {
3146
+ }
3147
+ try {
3148
+ const m = i._host;
3149
+ if (m?.parentElement) {
3150
+ let d = m.parentElement;
3151
+ for (; d; ) {
3152
+ if (d.tagName.toLowerCase() === "cer-error-boundary") {
3153
+ d._cerHandleChildError?.(
3154
+ y
3155
+ );
3156
+ break;
3157
+ }
3158
+ let C = d.parentElement;
3159
+ if (!C) {
3160
+ const j = d.getRootNode();
3161
+ j instanceof ShadowRoot && (C = j.host.parentElement);
3162
+ }
3163
+ d = C;
3164
+ }
3165
+ }
3166
+ } catch {
3167
+ }
3168
+ throw y;
3169
+ }
3170
+ if (i._hookCallbacks) {
3171
+ const y = i._hookCallbacks;
3172
+ if (y.onConnected) {
3173
+ const m = y.onConnected;
3174
+ n.onConnected = (d) => {
3175
+ He(r, "useOnConnected", m, [d]);
3176
+ };
3177
+ }
3178
+ if (y.onDisconnected) {
3179
+ const m = y.onDisconnected;
3180
+ n.onDisconnected = (d) => {
3181
+ He(r, "useOnDisconnected", m, [d]);
3182
+ };
3183
+ }
3184
+ if (y.onAttributeChanged) {
3185
+ const m = y.onAttributeChanged;
3186
+ n.onAttributeChanged = (d, C, j, S) => {
3187
+ He(r, "useOnAttributeChanged", m, [d, C, j, S]);
3188
+ };
3189
+ }
3190
+ if (y.onError) {
3191
+ const m = y.onError;
3192
+ n.onError = (d) => {
3193
+ He(r, "useOnError", m, [d]);
3194
+ };
3195
+ }
3196
+ if (y.props && !Object.keys(c.props ?? {}).length) {
3197
+ const m = y.props;
3198
+ c.props = Object.fromEntries(
3199
+ Object.entries(m).map(([d, C]) => [
3200
+ d,
3201
+ { type: typeof C == "boolean" ? Boolean : typeof C == "number" ? Number : typeof C == "string" ? String : Function, default: C }
3202
+ ])
3203
+ ), we.set(r, c);
3204
+ }
3205
+ }
3206
+ return b;
3207
+ } finally {
3208
+ Xe(), Ue.clearCurrentComponent();
3209
+ }
3210
+ }
3211
+ };
3212
+ if (we.set(r, c), typeof window < "u") {
3213
+ try {
3214
+ const o = {
3215
+ _hookCallbacks: {},
3216
+ requestRender: () => {
3217
+ },
3218
+ emit: () => !0
3219
+ };
3220
+ Ye(o), Et(), et();
3221
+ try {
3222
+ s();
3223
+ } catch (i) {
3224
+ try {
3225
+ const b = o?._hookCallbacks?.onError;
3226
+ if (Array.isArray(b))
3227
+ for (const y of b)
3228
+ try {
3229
+ y(i);
3230
+ } catch {
3231
+ }
3232
+ else if (typeof b == "function")
3233
+ try {
3234
+ b(i);
3235
+ } catch {
3236
+ }
3237
+ W(
3238
+ `Error during component discovery render <${r}>:`,
3239
+ i
3240
+ ), te(
3241
+ "Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when()."
3242
+ );
3243
+ } catch {
3244
+ }
3245
+ throw i;
3246
+ } finally {
3247
+ St(), Xe();
3248
+ }
3249
+ if (o._hookCallbacks?.props) {
3250
+ const i = o._hookCallbacks.props;
3251
+ c.props = Object.fromEntries(
3252
+ Object.entries(i).map(([f, b]) => [
3253
+ f,
3254
+ { type: typeof b == "boolean" ? Boolean : typeof b == "number" ? Number : typeof b == "string" ? String : Function, default: b }
3255
+ ])
3256
+ ), we.set(r, c);
3257
+ }
3258
+ } catch {
3259
+ }
3260
+ typeof customElements < "u" && !customElements.get(r) && customElements.define(
3261
+ r,
3262
+ on(r, c)
3263
+ );
3264
+ }
3265
+ }
3266
+ function ie(e, s = {}, t, r) {
3267
+ const n = r ?? s.key;
3268
+ return { tag: e, key: n, props: s, children: t };
3269
+ }
3270
+ function Me(e) {
3271
+ return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
3272
+ }
3273
+ function fe(e) {
3274
+ return typeof e == "object" && e !== null && "tag" in e && !Me(e);
3275
+ }
3276
+ function cn(e, s) {
3277
+ return e.key != null ? e : { ...e, key: s };
3278
+ }
3279
+ function an(e, s) {
3280
+ if (e == null) {
3281
+ te(
3282
+ `⚠️ Event handler for '@${s}' is ${e}. This will prevent the event from working. Use a function reference instead: @${s}="\${functionName}"`
3283
+ );
3284
+ return;
3285
+ }
3286
+ typeof e != "function" && te(
3287
+ `🚨 Potential infinite loop detected! Event handler for '@${s}' appears to be the result of a function call (${typeof e}) instead of a function reference. Change @${s}="\${functionName()}" to @${s}="\${functionName}" to pass the function reference instead of calling it immediately.`
3288
+ ), e === void 0 && typeof e != "function" && te(
3289
+ `💡 Tip: If your event handler function returns undefined, make sure you're passing the function reference, not calling it. Use @${s}="\${fn}" not @${s}="\${fn()}"`
3290
+ );
3291
+ }
3292
+ function ln(e, s = [], t = {}) {
3293
+ const r = {}, n = {}, c = {}, o = [], i = /([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g;
3294
+ let f;
3295
+ for (; f = i.exec(e); ) {
3296
+ const b = f[1], y = f[2];
3297
+ let m = "";
3298
+ for (let p = 3; p < f.length; p++)
3299
+ if (f[p] !== void 0) {
3300
+ m = f[p];
3301
+ break;
3302
+ }
3303
+ m.length >= 2 && (m[0] === '"' && m[m.length - 1] === '"' || m[0] === "'" && m[m.length - 1] === "'") && (m = m.slice(1, -1));
3304
+ const d = !/=/.test(f[0]), C = m.match(/^{{(\d+)}}$/), j = !C && /{{(\d+)}}/.test(m);
3305
+ let S = d ? !0 : C ? s[Number(C[1])] ?? null : j ? m.replace(
3306
+ /{{(\d+)}}/g,
3307
+ (p, T) => String(s[Number(T)] ?? "")
3308
+ ) : m;
3309
+ !C && !j && (S === "true" ? S = !0 : S === "false" ? S = !1 : S === "null" ? S = null : isNaN(Number(S)) || (S = Number(S)));
3310
+ const L = [
3311
+ "model",
3312
+ "bind",
3313
+ "show",
3314
+ "class",
3315
+ "style",
3316
+ "ref",
3317
+ "when"
3318
+ ];
3319
+ if (b === ":") {
3320
+ const [p, T] = y.split(":"), [a, ...k] = p.split(".");
3321
+ if (L.includes(a)) {
3322
+ const h = [...k], w = a === "model" && T ? `model:${T}` : a;
3323
+ c[w] = {
3324
+ value: S,
3325
+ modifiers: h,
3326
+ arg: T
3327
+ };
3328
+ } else if (y === "disabled") {
3329
+ let h = S;
3330
+ h && O(h) && (h = h.value);
3331
+ const w = typeof h;
3332
+ if (h === "" || w === "boolean" || w === "string" && (h === "true" || h === "false") || h == null || w === "number")
3333
+ r[y] = h;
3334
+ else {
3335
+ let g = S;
3336
+ g && O(g) && (g = g.value), n[y] = g;
3337
+ }
3338
+ o.push(y);
3339
+ } else {
3340
+ let h = S;
3341
+ h && O(h) && (h = h.value), n[y] = h, o.push(y);
3342
+ }
3343
+ } else if (b === "@") {
3344
+ const [p, ...T] = y.split("."), a = T;
3345
+ an(S, p);
3346
+ const k = typeof S == "function" ? S : typeof t[S] == "function" ? t[S] : void 0;
3347
+ if (k) {
3348
+ const h = (E) => {
3349
+ if (a.includes("prevent") && E.preventDefault(), a.includes("stop") && E.stopPropagation(), !(a.includes("self") && E.target !== E.currentTarget))
3350
+ return a.includes("once") && E.currentTarget?.removeEventListener(
3351
+ p,
3352
+ h
3353
+ ), k(E);
3354
+ }, w = "on" + p.charAt(0).toUpperCase() + p.slice(1);
3355
+ r[w] = h;
3356
+ }
3357
+ } else y === "ref" ? r.ref = S : n[y] = S;
3358
+ }
3359
+ return { props: r, attrs: n, directives: c, bound: o };
3360
+ }
3361
+ function Ve(e) {
3362
+ if (!fe(e) || Me(e))
3363
+ return e;
3364
+ const s = e.props?.directives;
3365
+ if (s && s.when) {
3366
+ const t = s.when.value, r = O(t) ? t.value : t, n = { ...s };
3367
+ delete n.when;
3368
+ const c = { ...e.props };
3369
+ Object.keys(n).length > 0 ? c.directives = n : delete c.directives;
3370
+ const o = {
3371
+ ...e,
3372
+ props: c
3373
+ };
3374
+ return Array.isArray(o.children) && (o.children = o.children.map(
3375
+ (f) => typeof f == "object" && f !== null ? Ve(f) : f
3376
+ )), {
3377
+ tag: "#anchor",
3378
+ key: e.key != null ? `when-${e.key}` : `when-${e.tag}`,
3379
+ children: r ? [o] : []
3380
+ };
3381
+ }
3382
+ if (Array.isArray(e.children)) {
3383
+ const t = e.children.map(
3384
+ (r) => typeof r == "object" && r !== null ? Ve(r) : r
3385
+ );
3386
+ return {
3387
+ ...e,
3388
+ children: t
3389
+ };
3390
+ }
3391
+ return e;
3392
+ }
3393
+ function fn(e, s, t) {
3394
+ const r = Ne.length > 0 ? Ne[Ne.length - 1] : void 0, n = t ?? r, c = !t && s.length === 0, o = c ? e.join("<!--TEMPLATE_DELIM-->") : null;
3395
+ if (c && o) {
3396
+ const l = De.get(o);
3397
+ if (l) return l;
3398
+ }
3399
+ function i(l, v) {
3400
+ return ie("#text", {}, l, v);
3401
+ }
3402
+ function f(l, v, _ = !1) {
3403
+ let A = typeof l == "string" ? Ct(l) : l;
3404
+ return !_ && typeof A == "string" && /[\r\n]/.test(A) && (A = A.replace(/\s+/g, " ")), ie("#text", {}, A, v);
3405
+ }
3406
+ let b = "";
3407
+ for (let l = 0; l < e.length; l++)
3408
+ b += e[l], l < s.length && (b += `{{${l}}}`);
3409
+ const y = /<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, m = [];
3410
+ let d, C = [], j = null, S = {}, L, p = 0;
3411
+ const T = [], a = /* @__PURE__ */ new Set([
3412
+ "pre",
3413
+ "code",
3414
+ "textarea",
3415
+ "script",
3416
+ "style"
3417
+ ]);
3418
+ function k() {
3419
+ if (j && a.has(j.toLowerCase()))
3420
+ return !0;
3421
+ for (const l of m)
3422
+ if (a.has(l.tag.toLowerCase()))
3423
+ return !0;
3424
+ return !1;
3425
+ }
3426
+ function h(l) {
3427
+ if (!l || typeof l != "object" || Me(l)) return;
3428
+ const v = l, _ = S;
3429
+ if (v.props || v.attrs) {
3430
+ const A = v;
3431
+ A.props && (_.props || (_.props = {}), Object.assign(_.props, A.props)), A.attrs && (_.attrs || (_.attrs = {}), Object.keys(A.attrs).forEach((N) => {
3432
+ if (N === "style" && _.attrs.style) {
3433
+ const $ = String(_.attrs.style).replace(/;?\s*$/, ""), H = String(A.attrs.style).replace(/^;?\s*/, "");
3434
+ _.attrs.style = $ + "; " + H;
3435
+ } else if (N === "class" && _.attrs.class) {
3436
+ const $ = String(_.attrs.class).trim().split(/\s+/).filter(Boolean), H = String(A.attrs.class).trim().split(/\s+/).filter(Boolean), M = [
3437
+ .../* @__PURE__ */ new Set([...$, ...H])
3438
+ ];
3439
+ _.attrs.class = M.join(" ");
3440
+ } else
3441
+ _.attrs[N] = A.attrs[N];
3442
+ }));
3443
+ } else
3444
+ _.props || (_.props = {}), Object.assign(_.props, v);
3445
+ }
3446
+ function w(l, v) {
3447
+ const _ = j ? C : T;
3448
+ if (Me(l)) {
3449
+ const A = l.key ?? v, N = l.children;
3450
+ _.push({
3451
+ ...l,
3452
+ key: A,
3453
+ children: N
3454
+ });
3455
+ return;
3456
+ }
3457
+ if (fe(l)) {
3458
+ _.push(cn(l, void 0));
3459
+ return;
3460
+ }
3461
+ if (Array.isArray(l)) {
3462
+ if (l.length === 0) return;
3463
+ for (let A = 0; A < l.length; A++) {
3464
+ const N = l[A];
3465
+ Me(N) || fe(N) || Array.isArray(N) ? w(N, `${v}-${A}`) : N !== null && typeof N == "object" ? Qe(N) ? _.push(
3466
+ ie(
3467
+ "#raw",
3468
+ {},
3469
+ N.__rawHTML,
3470
+ `${v}-${A}`
3471
+ )
3472
+ ) : h(N) : _.push(i(String(N), `${v}-${A}`));
3473
+ }
3474
+ return;
3475
+ }
3476
+ if (l !== null && typeof l == "object") {
3477
+ if (Qe(l)) {
3478
+ const A = l.__rawHTML ?? "";
3479
+ _.push(ie("#raw", {}, A, v));
3480
+ return;
3481
+ }
3482
+ h(l);
3483
+ return;
3484
+ }
3485
+ _.push(i(String(l), v));
3486
+ }
3487
+ const E = /* @__PURE__ */ new Set([
3488
+ "area",
3489
+ "base",
3490
+ "br",
3491
+ "col",
3492
+ "embed",
3493
+ "hr",
3494
+ "img",
3495
+ "input",
3496
+ "link",
3497
+ "meta",
3498
+ "param",
3499
+ "source",
3500
+ "track",
3501
+ "wbr"
3502
+ ]);
3503
+ for (; d = y.exec(b); )
3504
+ if (!(d[0].startsWith("<!--") && d[0].endsWith("-->"))) {
3505
+ if (d[1]) {
3506
+ const l = d[1], v = d[0][1] === "/", _ = d[0][d[0].length - 2] === "/" || E.has(l), {
3507
+ props: A,
3508
+ attrs: N,
3509
+ directives: $,
3510
+ bound: H
3511
+ } = ln(
3512
+ d[2] || "",
3513
+ s,
3514
+ n ?? {}
3515
+ ), M = { props: {}, attrs: {} };
3516
+ for (const D in A) M.props[D] = A[D];
3517
+ for (const D in N) M.attrs[D] = N[D];
3518
+ M.attrs && Object.prototype.hasOwnProperty.call(M.attrs, "key") && !(M.props && Object.prototype.hasOwnProperty.call(M.props, "key")) && x(() => {
3519
+ M.props.key = M.attrs.key;
3520
+ });
3521
+ try {
3522
+ const D = {
3523
+ input: [
3524
+ "value",
3525
+ "checked",
3526
+ "readonly",
3527
+ "required",
3528
+ "placeholder",
3529
+ "maxlength",
3530
+ "minlength"
3531
+ ],
3532
+ textarea: [
3533
+ "value",
3534
+ "readonly",
3535
+ "required",
3536
+ "placeholder",
3537
+ "maxlength",
3538
+ "minlength"
3539
+ ],
3540
+ select: ["value", "required", "multiple"],
3541
+ option: ["selected", "value"],
3542
+ video: ["muted", "autoplay", "controls", "loop", "playsinline"],
3543
+ audio: ["muted", "autoplay", "controls", "loop"],
3544
+ img: ["src", "alt", "width", "height"],
3545
+ button: ["type", "name", "value", "autofocus", "form"]
3546
+ }, R = l.toLowerCase(), ee = D[R] ?? [];
3547
+ if (M.attrs) {
3548
+ for (const I of ee)
3549
+ if (H && H.includes(I) && I in M.attrs && !(M.props && I in M.props)) {
3550
+ let P = M.attrs[I];
3551
+ if (P && O(P))
3552
+ P = P.value, M.props[I] = P, delete M.attrs[I];
3553
+ else if (P && typeof P == "object" && "value" in P && !(P instanceof Node))
3554
+ try {
3555
+ const B = P.value;
3556
+ M.props[I] = (R === "select" || R === "option") && I === "value" ? String(B) : B, delete M.attrs[I];
3557
+ } catch {
3558
+ }
3559
+ else {
3560
+ const B = typeof P;
3561
+ if (I === "disabled")
3562
+ (P === "" || B === "boolean" || B === "string" && (P === "true" || P === "false") || P == null || B === "number") && (M.props[I] = P, delete M.attrs[I]);
3563
+ else if (P === "" || B === "string" || B === "number" || B === "boolean" || P == null) {
3564
+ const U = (R === "select" || R === "option") && I === "value" ? String(P) : P;
3565
+ M.props[I] = U, delete M.attrs[I];
3566
+ }
3567
+ }
3568
+ }
3569
+ }
3570
+ if (l.includes("-") || !!n?.__customElements?.has?.(l)) {
3571
+ if (M.isCustomElement = !0, H && M.attrs) {
3572
+ const I = /* @__PURE__ */ new Set(["id", "name", "data-key", "key"]);
3573
+ for (const P of H)
3574
+ if (P in M.attrs && !(M.props && P in M.props)) {
3575
+ const B = P.includes("-") ? Ge(P) : P, U = M.attrs[P];
3576
+ if (M.props[B] = U, I.has(P) || ft(P))
3577
+ try {
3578
+ const oe = F(M.attrs[P]);
3579
+ oe === null ? delete M.attrs[P] : M.attrs[P] = oe;
3580
+ } catch {
3581
+ delete M.attrs[P];
3582
+ }
3583
+ else
3584
+ delete M.attrs[P];
3585
+ }
3586
+ }
3587
+ try {
3588
+ if (M.attrs && !(M.props && "modelValue" in M.props)) {
3589
+ const I = M.attrs["model-value"] ?? M.attrs.modelValue;
3590
+ typeof I < "u" && (M.props.modelValue = I);
3591
+ }
3592
+ } catch {
3593
+ }
3594
+ }
3595
+ } catch {
3596
+ }
3597
+ if ($ && Object.keys($).some(
3598
+ (D) => D === "model" || D.startsWith("model:")
3599
+ ))
3600
+ try {
3601
+ const R = globalThis[/* @__PURE__ */ Symbol.for("cer.registry")], ee = !!(R && typeof R.has == "function" && R.has(l)), q = n, I = !!(q && (q.__customElements instanceof Set && q.__customElements.has(l) || Array.isArray(q.__isCustomElements) && q.__isCustomElements.includes(l)));
3602
+ if (!!(l.includes("-") || I || ee))
3603
+ for (const U of Object.keys($)) {
3604
+ if (U !== "model" && !U.startsWith("model:")) continue;
3605
+ const pe = $[U], oe = pe.arg ?? (U.includes(":") ? U.split(":", 2)[1] : void 0), V = pe.value, Be = oe ?? "modelValue", Je = z, gt = Re, ve = n?._state || n;
3606
+ let se;
3607
+ if (typeof V == "string" && ve)
3608
+ se = Je(
3609
+ ve,
3610
+ V
3611
+ );
3612
+ else if (se = V, O(V))
3613
+ try {
3614
+ V.value;
3615
+ } catch {
3616
+ }
3617
+ M.props[Be] = se;
3618
+ try {
3619
+ const ce = X(Be);
3620
+ M.attrs || (M.attrs = {}), se != null && (typeof se == "string" || typeof se == "number" || typeof se == "boolean") && (M.attrs[ce] = se);
3621
+ } catch {
3622
+ }
3623
+ M.isCustomElement = !0;
3624
+ const Ze = `update:${X(Be)}`.replace(
3625
+ /-([a-z])/g,
3626
+ (ce, ne) => ne.toUpperCase()
3627
+ ), bt = "on" + Ze.charAt(0).toUpperCase() + Ze.slice(1);
3628
+ M.props[bt] = function(ce) {
3629
+ const ne = ce.detail !== void 0 ? ce.detail : ce.target ? ce.target.value : void 0;
3630
+ if (ve)
3631
+ if (V && O(V)) {
3632
+ const ae = V.value;
3633
+ if (Array.isArray(ne) && Array.isArray(ae) ? JSON.stringify([...ne].sort()) !== JSON.stringify([...ae].sort()) : ne !== ae) {
3634
+ V.value = ne;
3635
+ try {
3636
+ const le = n;
3637
+ if (le) {
3638
+ const Ee = le.requestRender, Se = le._requestRender;
3639
+ typeof Ee == "function" ? Ee() : typeof Se == "function" && Se();
3640
+ }
3641
+ } catch {
3642
+ }
3643
+ }
3644
+ } else {
3645
+ const ae = Je(
3646
+ ve || {},
3647
+ typeof V == "string" ? V : String(V)
3648
+ );
3649
+ if (Array.isArray(ne) && Array.isArray(ae) ? JSON.stringify([...ne].sort()) !== JSON.stringify([...ae].sort()) : ne !== ae) {
3650
+ gt(
3651
+ ve || {},
3652
+ typeof V == "string" ? V : String(V),
3653
+ ne
3654
+ );
3655
+ try {
3656
+ const le = n;
3657
+ if (le) {
3658
+ const Ee = le.requestRender, Se = le._requestRender;
3659
+ typeof Ee == "function" ? Ee() : typeof Se == "function" && Se();
3660
+ }
3661
+ } catch {
3662
+ }
3663
+ }
3664
+ }
3665
+ }, delete $[U];
3666
+ }
3667
+ } catch {
3668
+ }
3669
+ if (Object.keys($).length > 0 && (M.directives = { ...$ }), v) {
3670
+ const D = C.some(
3671
+ (I) => typeof I == "object" && I.tag !== "#text"
3672
+ );
3673
+ let R = C;
3674
+ if (D && C.length > 0) {
3675
+ let I = 0;
3676
+ for (; I < C.length; ) {
3677
+ const B = C[I];
3678
+ if (!fe(B) || B.tag !== "#text" || typeof B.children != "string" || B.children.trim() !== "")
3679
+ break;
3680
+ I++;
3681
+ }
3682
+ let P = C.length - 1;
3683
+ for (; P >= 0; ) {
3684
+ const B = C[P];
3685
+ if (!fe(B) || B.tag !== "#text" || typeof B.children != "string" || B.children.trim() !== "")
3686
+ break;
3687
+ P--;
3688
+ }
3689
+ I === 0 && P === C.length - 1 ? R = C : I > P ? R = [] : R = C.slice(I, P + 1);
3690
+ }
3691
+ const ee = ie(
3692
+ j,
3693
+ S,
3694
+ R.length === 1 && fe(R[0]) && R[0].tag === "#text" ? typeof R[0].children == "string" ? R[0].children : "" : R.length ? R : void 0,
3695
+ L
3696
+ ), q = m.pop();
3697
+ q ? (j = q.tag, S = q.props, L = q.key, C = q.children, C.push(ee)) : (T.push(ee), j = null, S = {}, L = void 0, C = []);
3698
+ } else _ ? j ? C.push(ie(l, M, void 0, void 0)) : T.push(ie(l, M, void 0, void 0)) : (j && m.push({
3699
+ tag: j,
3700
+ props: S,
3701
+ children: C,
3702
+ key: L
3703
+ }), j = l, S = M, C = []);
3704
+ } else if (typeof d[3] < "u") {
3705
+ const l = Number(d[3]), v = s[l], _ = `interp-${l}`;
3706
+ w(v, _);
3707
+ } else if (d[4]) {
3708
+ const l = d[4], v = j ? C : T, _ = l.split(/({{\d+}})/);
3709
+ for (const A of _) {
3710
+ if (!A) continue;
3711
+ const N = A.match(/^{{(\d+)}}$/);
3712
+ if (N) {
3713
+ const $ = Number(N[1]), H = s[$], M = `interp-${$}`;
3714
+ w(H, M);
3715
+ } else {
3716
+ const $ = `text-${p++}`, H = k();
3717
+ v.push(f(A, $, H));
3718
+ }
3719
+ }
3720
+ }
3721
+ }
3722
+ const g = T.filter((l) => fe(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0).map(
3723
+ (l) => Ve(l)
3724
+ );
3725
+ if (g.length === 1) {
3726
+ const l = g[0];
3727
+ return c && o && De.set(o, l), l;
3728
+ } else if (g.length > 1) {
3729
+ const l = g;
3730
+ return c && o && De.set(o, l), l;
3731
+ }
3732
+ return ie("div", {}, "", "fallback-root");
3733
+ }
3734
+ function vn(e, ...s) {
3735
+ if (kt()) return [];
3736
+ const t = s[s.length - 1], r = typeof t == "object" && t && !Array.isArray(t) ? t : void 0;
3737
+ return fn(e, s, r);
3738
+ }
3739
+ export {
3740
+ bn as c,
3741
+ vn as h,
3742
+ Xt as v
3743
+ };
3744
+ //# sourceMappingURL=template-compiler-DtpNsqE-.js.map