@jasonshimmy/custom-elements-runtime 3.0.0 → 3.1.1

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 (68) hide show
  1. package/README.md +118 -81
  2. package/dist/custom-elements-runtime.cjs.js +3 -3
  3. package/dist/custom-elements-runtime.cjs.js.map +1 -1
  4. package/dist/custom-elements-runtime.es.js +77 -72
  5. package/dist/custom-elements-runtime.es.js.map +1 -1
  6. package/dist/custom-elements-runtime.jit-css.cjs.js +1 -1
  7. package/dist/custom-elements-runtime.jit-css.cjs.js.map +1 -1
  8. package/dist/custom-elements-runtime.jit-css.es.js +25 -26
  9. package/dist/custom-elements-runtime.jit-css.es.js.map +1 -1
  10. package/dist/custom-elements-runtime.router.cjs.js +8 -8
  11. package/dist/custom-elements-runtime.router.cjs.js.map +1 -1
  12. package/dist/custom-elements-runtime.router.es.js +134 -134
  13. package/dist/custom-elements-runtime.router.es.js.map +1 -1
  14. package/dist/custom-elements-runtime.ssr-middleware.cjs.js +2 -0
  15. package/dist/custom-elements-runtime.ssr-middleware.cjs.js.map +1 -0
  16. package/dist/custom-elements-runtime.ssr-middleware.es.js +69 -0
  17. package/dist/custom-elements-runtime.ssr-middleware.es.js.map +1 -0
  18. package/dist/custom-elements-runtime.ssr.cjs.js +3 -1
  19. package/dist/custom-elements-runtime.ssr.cjs.js.map +1 -1
  20. package/dist/custom-elements-runtime.ssr.es.js +158 -39
  21. package/dist/custom-elements-runtime.ssr.es.js.map +1 -1
  22. package/dist/custom-elements-runtime.vite-plugin.cjs.js +1 -1
  23. package/dist/custom-elements-runtime.vite-plugin.cjs.js.map +1 -1
  24. package/dist/custom-elements-runtime.vite-plugin.es.js +81 -49
  25. package/dist/custom-elements-runtime.vite-plugin.es.js.map +1 -1
  26. package/dist/hooks-x8M4knLc.cjs +6 -0
  27. package/dist/hooks-x8M4knLc.cjs.map +1 -0
  28. package/dist/hooks-xWZhQHco.js +1465 -0
  29. package/dist/hooks-xWZhQHco.js.map +1 -0
  30. package/dist/index.d.ts +3 -0
  31. package/dist/namespace-helpers-D4wC2-qA.js +61 -0
  32. package/dist/namespace-helpers-D4wC2-qA.js.map +1 -0
  33. package/dist/namespace-helpers-ckeEOxpR.cjs +2 -0
  34. package/dist/namespace-helpers-ckeEOxpR.cjs.map +1 -0
  35. package/dist/router/matcher.d.ts +14 -0
  36. package/dist/runtime/component/factory.d.ts +16 -2
  37. package/dist/runtime/hydration.d.ts +33 -0
  38. package/dist/runtime/render.d.ts +0 -11
  39. package/dist/runtime/scheduler.d.ts +12 -0
  40. package/dist/runtime/ssr-context.d.ts +47 -0
  41. package/dist/runtime/ssr-utils.d.ts +9 -0
  42. package/dist/runtime/types.d.ts +18 -0
  43. package/dist/runtime/vdom-ssr-dsd.d.ts +82 -0
  44. package/dist/runtime/vdom-ssr.d.ts +2 -6
  45. package/dist/ssr-middleware.d.ts +125 -0
  46. package/dist/ssr.d.ts +95 -33
  47. package/dist/template-compiler-CTUhEHr8.cjs +22 -0
  48. package/dist/template-compiler-CTUhEHr8.cjs.map +1 -0
  49. package/dist/template-compiler-ZhSg1yPh.js +3724 -0
  50. package/dist/template-compiler-ZhSg1yPh.js.map +1 -0
  51. package/dist/vite-plugin.d.ts +94 -4
  52. package/package.json +6 -1
  53. package/dist/helpers-CweFZFWU.js +0 -987
  54. package/dist/helpers-CweFZFWU.js.map +0 -1
  55. package/dist/helpers-DeWjSmOl.cjs +0 -5
  56. package/dist/helpers-DeWjSmOl.cjs.map +0 -1
  57. package/dist/hooks-BrrLKSub.cjs +0 -3
  58. package/dist/hooks-BrrLKSub.cjs.map +0 -1
  59. package/dist/hooks-DyShDHKo.js +0 -403
  60. package/dist/hooks-DyShDHKo.js.map +0 -1
  61. package/dist/namespace-helpers-CnpZ5__p.js +0 -45
  62. package/dist/namespace-helpers-CnpZ5__p.js.map +0 -1
  63. package/dist/namespace-helpers-CyIDtI97.cjs +0 -2
  64. package/dist/namespace-helpers-CyIDtI97.cjs.map +0 -1
  65. package/dist/template-compiler-B5uN1EQw.js +0 -3731
  66. package/dist/template-compiler-B5uN1EQw.js.map +0 -1
  67. package/dist/template-compiler-Cx623BSB.cjs +0 -23
  68. package/dist/template-compiler-Cx623BSB.cjs.map +0 -1
@@ -0,0 +1,3724 @@
1
+ import { C as z, D as X, l as O, E as Ie, F as H, G as F, H as Ve, I as at, J as bt, c as Ke, K as Se, L as Ze, M as vt, N as Et, O as Ye, P as Xe, f as St, Q as Ct } from "./hooks-xWZhQHco.js";
2
+ import { resetWhenCounter as Qe } 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 kt, S as _t, a as Te, i as At } from "./namespace-helpers-D4wC2-qA.js";
5
+ import { i as Tt, p as wt, g as Lt, a as je, m as Ce, b as et, s as Nt } from "./css-utils-Cg4o1MqY.js";
6
+ import { getTransitionStyleSheet as Mt } 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, E) => n(d, i[E]));
30
+ const f = o, b = i, g = Object.keys(f || {}), h = Object.keys(b || {});
31
+ return g.length !== h.length ? !1 : g.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 Be(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] = Be(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] = Be(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] = Be(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 g = e[c];
101
+ let h;
102
+ return O(g) || g && typeof g == "object" && "value" in g && !(g instanceof Node) ? h = g.value : h = g, h;
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 tt(e, s, t, r) {
118
+ e.onConnected && !t && (e.onConnected(s), r(!0));
119
+ }
120
+ function Ht(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 xt(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 lt {
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
+ }, We = new lt(
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 lt(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, g = null;
386
+ for (let j = 0; j < i.length; j++) {
387
+ const C = i[j];
388
+ if (g) {
389
+ if (C === "\\") {
390
+ j++;
391
+ continue;
392
+ }
393
+ C === g && (g = null);
394
+ } else if (C === '"' || C === "'")
395
+ g = C;
396
+ else if (C === "(" || C === "[" || C === "{")
397
+ b++;
398
+ else if (C === ")" || C === "]" || C === "}")
399
+ b--;
400
+ else if (C === ":" && b === 0) {
401
+ f = j;
402
+ break;
403
+ }
404
+ }
405
+ if (f === -1) continue;
406
+ const h = i.slice(0, f).trim(), d = i.slice(f + 1).trim(), E = h.replace(/^['"]|['"]$/g, "");
407
+ t.push({ key: E, 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
+ (h) => `<<#${n.push(h) - 1}#>>`
419
+ );
420
+ const c = r.match(/ctx\.[\w.]+/g) || [];
421
+ for (const h of c) {
422
+ const d = h.slice(4), E = z(t, d);
423
+ if (E === void 0) return;
424
+ const j = n.push(JSON.stringify(E)) - 1;
425
+ r = r.split(h).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 h of i) {
429
+ if (h.startsWith("ctx.")) continue;
430
+ const d = z(t, h);
431
+ if (d === void 0) return;
432
+ const E = n.push(JSON.stringify(d)) - 1;
433
+ r = r.split(h).join(`<<#${E}#>>`);
434
+ }
435
+ const f = /\b([a-zA-Z_][a-zA-Z0-9_]*)\b/g;
436
+ let b;
437
+ const g = /* @__PURE__ */ new Set();
438
+ for (; (b = f.exec(r)) !== null; ) {
439
+ const h = b[1];
440
+ if (Rt.has(h) || /^[0-9]+$/.test(h) || h === "ctx" || g.has(h)) continue;
441
+ g.add(h);
442
+ const d = z(t, h);
443
+ if (d === void 0) return;
444
+ const E = JSON.stringify(d), j = n.push(E) - 1;
445
+ h.includes(".") ? r = r.split(h).join(`<<#${j}#>>`) : r = r.replace(
446
+ new RegExp(
447
+ "\\b" + h.replace(/[.*+?^${}()|[\]\\]/g, "\\$&") + "\\b",
448
+ "g"
449
+ ),
450
+ `<<#${j}#>>`
451
+ ), f.lastIndex = 0;
452
+ }
453
+ r = r.replace(
454
+ /<<#(\d+)#>>/g,
455
+ (h, 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 m = t[r++];
480
+ if (u && !m)
481
+ throw new Error(`Unexpected token EOF, expected ${u}`);
482
+ if (u && m && m.type !== u && m.value !== u)
483
+ throw new Error(
484
+ `Unexpected token ${m.type}/${m.value}, expected ${u}`
485
+ );
486
+ return m;
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 m = Number(u);
496
+ return Number.isNaN(m) ? NaN : m;
497
+ }
498
+ function f(u, m) {
499
+ return typeof u == "string" || typeof m == "string" ? String(u) + String(m) : i(u) + i(m);
500
+ }
501
+ function b(u, m) {
502
+ return i(u) - i(m);
503
+ }
504
+ function g(u, m) {
505
+ return i(u) * i(m);
506
+ }
507
+ function h(u, m) {
508
+ return i(u) / i(m);
509
+ }
510
+ function d(u, m) {
511
+ return i(u) % i(m);
512
+ }
513
+ function E(u, m, l) {
514
+ if (typeof m == "number" && typeof l == "number")
515
+ switch (u) {
516
+ case ">":
517
+ return m > l;
518
+ case "<":
519
+ return m < l;
520
+ case ">=":
521
+ return m >= l;
522
+ case "<=":
523
+ return m <= l;
524
+ default:
525
+ return !1;
526
+ }
527
+ const v = String(m), _ = 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 = C(), m = n();
543
+ if (m && m.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 C() {
553
+ let u = A();
554
+ for (; ; ) {
555
+ const m = n();
556
+ if (!m || m.value !== "||") break;
557
+ c("OP");
558
+ const l = A();
559
+ u = u || l;
560
+ }
561
+ return u;
562
+ }
563
+ function A() {
564
+ let u = p();
565
+ for (; ; ) {
566
+ const m = n();
567
+ if (!m || m.value !== "&&") break;
568
+ c("OP");
569
+ const l = p();
570
+ u = u && l;
571
+ }
572
+ return u;
573
+ }
574
+ function p() {
575
+ let u = L();
576
+ for (; ; ) {
577
+ const m = n();
578
+ if (!m || !["==", "!=", "===", "!=="].includes(m.value)) break;
579
+ const l = c("OP").value, v = L();
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 L() {
598
+ let u = a();
599
+ for (; ; ) {
600
+ const m = n();
601
+ if (!m || ![">", "<", ">=", "<="].includes(m.value)) break;
602
+ const l = c("OP").value, v = a();
603
+ switch (l) {
604
+ case ">":
605
+ u = E(">", u, v);
606
+ break;
607
+ case "<":
608
+ u = E("<", u, v);
609
+ break;
610
+ case ">=":
611
+ u = E(">=", u, v);
612
+ break;
613
+ case "<=":
614
+ u = E("<=", u, v);
615
+ break;
616
+ }
617
+ }
618
+ return u;
619
+ }
620
+ function a() {
621
+ let u = k();
622
+ for (; ; ) {
623
+ const m = n();
624
+ if (!m || m.value !== "+" && m.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 = y();
632
+ for (; ; ) {
633
+ const m = n();
634
+ if (!m || m.value !== "*" && m.value !== "/" && m.value !== "%")
635
+ break;
636
+ const l = c("OP").value, v = y();
637
+ switch (l) {
638
+ case "*":
639
+ u = g(u, v);
640
+ break;
641
+ case "/":
642
+ u = h(u, v);
643
+ break;
644
+ case "%":
645
+ u = d(u, v);
646
+ break;
647
+ }
648
+ }
649
+ return u;
650
+ }
651
+ function y() {
652
+ const u = n();
653
+ if (u && u.value === "!")
654
+ return c("OP"), !y();
655
+ if (u && u.value === "-") {
656
+ c("OP");
657
+ const m = y();
658
+ return b(0, m);
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 m = [];
674
+ for (; ; ) {
675
+ const l = n();
676
+ if (!l || l.value === "]") break;
677
+ m.push(o());
678
+ const v = n();
679
+ v && v.value === "," && c("PUNC");
680
+ }
681
+ return c("PUNC"), m;
682
+ }
683
+ if (u.value === "(") {
684
+ c("PUNC");
685
+ const m = o();
686
+ return c("PUNC"), m;
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 $e(e, s) {
720
+ return Array.isArray(e) && Array.isArray(s) ? JSON.stringify([...e].sort()) !== JSON.stringify([...s].sort()) : e !== s;
721
+ }
722
+ function nt(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
+ Ie(c, s, t);
733
+ }
734
+ }
735
+ function Pe(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 st(e, s, t, r) {
754
+ const n = t;
755
+ if (H(() => {
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 ? H(() => {
766
+ typeof e.setAttribute == "function" && K(
767
+ e,
768
+ X(s),
769
+ String(c)
770
+ );
771
+ }) : H(() => {
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 we(e) {
786
+ return e != null && typeof e == "object" && "value" in e;
787
+ }
788
+ function Ue(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 ft(e) {
804
+ return e.substring(2, 3).toLowerCase() + e.substring(3);
805
+ }
806
+ function ze(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"), g = s.includes("number"), h = () => {
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 = h();
819
+ let E = "text";
820
+ o instanceof HTMLInputElement ? E = r?.type || o.type || "text" : o instanceof HTMLSelectElement ? E = "select" : o instanceof HTMLTextAreaElement && (E = "textarea");
821
+ const j = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement, A = j ? E === "checkbox" || E === "radio" ? "checked" : "value" : i ?? "modelValue";
822
+ if (E === "checkbox")
823
+ if (Array.isArray(d))
824
+ t[A] = d.includes(
825
+ String(o?.getAttribute("value") ?? r?.value ?? "")
826
+ );
827
+ else {
828
+ const a = o?.getAttribute("true-value") ?? !0;
829
+ t[A] = d === a;
830
+ }
831
+ else if (E === "radio")
832
+ t[A] = d === (r?.value ?? "");
833
+ else if (E === "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[A] = Array.isArray(d) ? d : [];
841
+ } else
842
+ t[A] = d;
843
+ else if (!j && O(e))
844
+ t[A] = e;
845
+ else {
846
+ t[A] = d;
847
+ try {
848
+ const a = X(A);
849
+ r && (r[a] = d);
850
+ } catch {
851
+ }
852
+ }
853
+ const p = f || E === "checkbox" || E === "radio" || E === "select" ? "change" : "input", L = (a) => {
854
+ if (a.isComposing || n._isComposing)
855
+ return;
856
+ const k = globalThis.process, y = !!k && k.env?.NODE_ENV === "test" || typeof window < "u" && globalThis.__vitest__;
857
+ if (a.isTrusted === !1 && !y)
858
+ return;
859
+ const w = a.target;
860
+ if (!w || w._modelUpdating)
861
+ return;
862
+ let S = w.value;
863
+ if (E === "checkbox") {
864
+ const l = h();
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 T = _.indexOf(v);
871
+ T > -1 && _.splice(T, 1);
872
+ }
873
+ S = _;
874
+ } else {
875
+ const v = w.getAttribute("true-value") ?? !0, _ = w.getAttribute("false-value") ?? !1;
876
+ S = w.checked ? v : _;
877
+ }
878
+ } else if (E === "radio")
879
+ S = w.getAttribute("value") ?? w.value;
880
+ else if (E === "select" && w.multiple)
881
+ S = Array.from(w.selectedOptions).map(
882
+ (l) => l.value
883
+ );
884
+ else if (b && typeof S == "string" && (S = S.trim()), g) {
885
+ const l = Number(S);
886
+ isNaN(l) || (S = l);
887
+ }
888
+ const u = h();
889
+ if ($e(S, u)) {
890
+ w._modelUpdating = !0;
891
+ try {
892
+ nt(O(e), e, S, c, i), Pe(c, O(e), e, S), w && Wt(w, A, S);
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] = L;
906
+ } else {
907
+ const a = `update:${X(A)}`, k = `update:${A}`;
908
+ if (n[a]) {
909
+ const y = n[a];
910
+ o && Y.removeListener(o, a, y);
911
+ }
912
+ if (n[k]) {
913
+ const y = n[k];
914
+ o && Y.removeListener(o, k, y);
915
+ }
916
+ if (n[a] = (y) => {
917
+ const w = y.detail;
918
+ let S = w !== void 0 ? w : void 0;
919
+ if (S === void 0) {
920
+ const l = y.target;
921
+ if (l && typeof l == "object" && "value" in l)
922
+ try {
923
+ S = l.value;
924
+ } catch {
925
+ S = void 0;
926
+ }
927
+ }
928
+ const u = Dt(
929
+ O(e),
930
+ e,
931
+ c,
932
+ i
933
+ );
934
+ if ($e(S, u)) {
935
+ nt(O(e), e, S, c, i), Pe(c, O(e), e, S);
936
+ const l = y.target;
937
+ l && st(
938
+ l,
939
+ A,
940
+ O(e) ? e : S,
941
+ O(e)
942
+ );
943
+ }
944
+ }, O(e) && typeof e.value == "object" && e.value !== null) {
945
+ let y;
946
+ try {
947
+ y = Reflect.ownKeys(e.value);
948
+ } catch {
949
+ y = Object.keys(e.value);
950
+ }
951
+ const w = y.filter(
952
+ (u) => typeof u == "string" && !String(u).startsWith("_") && u !== "constructor"
953
+ ), S = 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 && !S.has(u) && (o && Y.removeListener(o, u, n[u]), delete n[u]);
958
+ for (const u of w) {
959
+ const m = String(u), l = `update:${X(m)}`, v = `update:${m}`;
960
+ l !== a && (n[l] && o && (Y.removeListener(o, l, n[l]), delete n[l]), n[l] = (_) => {
961
+ const T = _.detail !== void 0 ? _.detail : _.target?.value, N = O(e) ? e.value[m] : z(
962
+ c?._state || c,
963
+ e
964
+ );
965
+ if (!$e(T, N)) return;
966
+ if (O(e)) {
967
+ const M = {
968
+ ...e.value
969
+ };
970
+ M[m] = T, e.value = M;
971
+ } else
972
+ Ie(
973
+ c?._state || c,
974
+ e,
975
+ T
976
+ );
977
+ Pe(c, O(e), e, T);
978
+ const x = _.currentTarget || o || _.target;
979
+ x && st(
980
+ x,
981
+ A,
982
+ O(e) ? e : T,
983
+ O(e)
984
+ );
985
+ }, n[v] = n[l]);
986
+ }
987
+ }
988
+ n[k] = n[a];
989
+ }
990
+ (E === "text" || E === "textarea") && (n.compositionstart = () => n._isComposing = !0, n.compositionend = (a) => {
991
+ n._isComposing = !1;
992
+ const k = a.target;
993
+ k && queueMicrotask(() => {
994
+ const y = k.value, w = c?._state || c, S = z(w, e);
995
+ let u = y;
996
+ if (b && (u = u.trim()), g) {
997
+ const l = Number(u);
998
+ isNaN(l) || (u = l);
999
+ }
1000
+ if ($e(u, S)) {
1001
+ k._modelUpdating = !0;
1002
+ try {
1003
+ Ie(w, e, u), Pe(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 = Me(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 = Me(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 Me(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 = Me(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, g] of Object.entries(n))
1115
+ g && 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 = Me(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
+ ), g = [
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 h = String(f);
1163
+ typeof f == "number" && g.includes(b) && (h = `${f}px`), o.push(`${b}: ${h}`);
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 = Me(e, t)), O(r) ? s.reactiveRef = r : s.ref = r;
1173
+ }
1174
+ function ut(e, s, t, r) {
1175
+ const n = {}, c = { ...r || {} }, o = {};
1176
+ for (const [i, f] of Object.entries(e)) {
1177
+ const { value: b, modifiers: g, arg: h } = f;
1178
+ if (i === "model" || i.startsWith("model:")) {
1179
+ const d = i.split(":"), E = d.length > 1 ? d[1] : h;
1180
+ Kt(
1181
+ b,
1182
+ // Pass the original value (could be string or reactive state object)
1183
+ g,
1184
+ n,
1185
+ c,
1186
+ o,
1187
+ s,
1188
+ t,
1189
+ E
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 g = !1;
1215
+ try {
1216
+ g = O(f);
1217
+ } catch {
1218
+ g = !1;
1219
+ }
1220
+ !b && !g && (c.disabled = f, delete n.disabled);
1221
+ }
1222
+ } catch {
1223
+ }
1224
+ return { props: n, attrs: c, listeners: o };
1225
+ }
1226
+ function ye(e) {
1227
+ return e ? e.split(/\s+/).filter(Boolean) : [];
1228
+ }
1229
+ function me(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 he(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 dt(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 ke(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 (h) {
1268
+ W("Transition onBeforeEnter error:", h);
1269
+ }
1270
+ if (!n)
1271
+ return r?.onEnter ? new Promise((h) => {
1272
+ const d = r.onEnter;
1273
+ typeof d == "function" ? d(e, () => {
1274
+ if (r?.onAfterEnter)
1275
+ try {
1276
+ r.onAfterEnter(e);
1277
+ } catch (E) {
1278
+ W("Transition onAfterEnter error:", E);
1279
+ }
1280
+ h();
1281
+ }) : h();
1282
+ }) : void 0;
1283
+ const o = ye(t?.enterFrom), i = ye(t?.enterActive), f = ye(t?.enterTo);
1284
+ me(e, o), e.offsetHeight, me(e, i), e.offsetHeight;
1285
+ let b;
1286
+ if (r?.onEnter) {
1287
+ const h = 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 h;
1299
+ }
1300
+ await new Promise((h) => requestAnimationFrame(() => h())), e.offsetHeight, he(e, o), me(e, f), e.offsetHeight, await new Promise((h) => requestAnimationFrame(() => h()));
1301
+ let g;
1302
+ if (typeof c == "number" ? g = c : c && typeof c == "object" && "enter" in c && (g = c.enter), await dt(e, g), he(e, i), r?.onAfterEnter)
1303
+ try {
1304
+ r.onAfterEnter(e);
1305
+ } catch (h) {
1306
+ W("Transition onAfterEnter error:", h);
1307
+ }
1308
+ }
1309
+ async function De(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 (h) {
1315
+ W("Transition onBeforeLeave error:", h);
1316
+ }
1317
+ if (!n)
1318
+ return r?.onLeave ? new Promise((h) => {
1319
+ const d = r.onLeave;
1320
+ typeof d == "function" ? d(e, () => {
1321
+ if (r?.onAfterLeave)
1322
+ try {
1323
+ r.onAfterLeave(e);
1324
+ } catch (E) {
1325
+ W("Transition onAfterLeave error:", E);
1326
+ }
1327
+ h();
1328
+ }) : h();
1329
+ }) : void 0;
1330
+ const o = ye(t?.leaveFrom), i = ye(t?.leaveActive), f = ye(t?.leaveTo);
1331
+ me(e, o), e.offsetHeight, me(e, i);
1332
+ let b;
1333
+ if (r?.onLeave) {
1334
+ const h = 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 h;
1346
+ }
1347
+ await new Promise((h) => requestAnimationFrame(() => h())), he(e, o), me(e, f);
1348
+ let g;
1349
+ if (typeof c == "number" ? g = c : c && typeof c == "object" && "leave" in c && (g = c.leave), await dt(e, g), he(e, i), he(e, f), he(e, o), r?.onAfterLeave)
1350
+ try {
1351
+ r.onAfterLeave(e);
1352
+ } catch (h) {
1353
+ W("Transition onAfterLeave error:", h);
1354
+ }
1355
+ }
1356
+ const pt = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap();
1357
+ function Oe(e) {
1358
+ if (!e) return;
1359
+ const s = pt.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
+ pt.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 = ht.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
+ ht.set(e, s);
1402
+ } catch {
1403
+ }
1404
+ try {
1405
+ e._transitionGroup = s;
1406
+ } catch {
1407
+ }
1408
+ }
1409
+ const xe = /* @__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 _e(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 Fe(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 h = i.tag || "node", E = [
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 = E ? `${s}:${h}:${E}` : `${s}:${h}`;
1470
+ }
1471
+ let b = f;
1472
+ if (c.has(b)) {
1473
+ const h = (o.get(b) ?? 1) + 1;
1474
+ o.set(b, h), b = `${f}#${h}`;
1475
+ }
1476
+ o.set(f, (o.get(f) ?? 0) + 1), c.add(b);
1477
+ let g = i.children;
1478
+ return Array.isArray(g) && (g = Fe(g, b)), { ...i, key: b, children: g };
1479
+ });
1480
+ }
1481
+ const t = e, r = t.props?.key ?? t.key ?? s;
1482
+ let n = t.children;
1483
+ return Array.isArray(n) && (n = Fe(n, r)), { ...t, key: r, children: n };
1484
+ }
1485
+ function rt(e, s, t, r) {
1486
+ const n = t.directives ?? {}, c = t.attrs ? { ...t.attrs } : {}, o = ut(
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 ?? {}, g = i, h = !!(t?.isCustomElement ?? s?.isCustomElement ?? !1);
1499
+ let d = !1;
1500
+ const E = /* @__PURE__ */ new Set();
1501
+ for (const a in b) E.add(a);
1502
+ for (const a in g) E.add(a);
1503
+ for (const a of E) {
1504
+ const k = b[a], y = g[a];
1505
+ let w = k, S = y;
1506
+ if (H(() => {
1507
+ O(k) ? w = k.peek() : we(k) && (w = k.value);
1508
+ }), H(() => {
1509
+ O(y) ? S = y.peek() : we(y) && (S = y.value);
1510
+ }), !(k === y && w === S))
1511
+ if (d = !0, a === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement)) {
1512
+ const u = Ue(y), m = u == null ? "" : String(u);
1513
+ e.value !== m && (e.value = m);
1514
+ } else if (a === "checked" && e instanceof HTMLInputElement) {
1515
+ const u = Ue(y);
1516
+ e.checked = !!u;
1517
+ } else if (a.startsWith("on") && typeof y == "function") {
1518
+ const u = ft(a);
1519
+ typeof k == "function" && Y.removeListener(e, u, k), typeof y == "function" && Y.addListener(e, u, y);
1520
+ try {
1521
+ if (u && u.startsWith("update:")) {
1522
+ const m = u.split(":", 2)[1], l = g[m];
1523
+ let v = [];
1524
+ try {
1525
+ if (O(l)) {
1526
+ const T = l.value;
1527
+ v = T && typeof T == "object" ? Object.keys(T) : [];
1528
+ } else l && typeof l == "object" && (v = Object.keys(l));
1529
+ } catch {
1530
+ v = [];
1531
+ }
1532
+ const _ = v.filter(
1533
+ (T) => typeof T == "string" && !T.startsWith("_") && T !== "constructor"
1534
+ );
1535
+ for (const T of _) {
1536
+ const N = `update:${T}`, $ = (x) => {
1537
+ const M = x.detail !== void 0 ? x.detail : x.target instanceof HTMLInputElement || x.target instanceof HTMLTextAreaElement || x.target instanceof HTMLSelectElement ? x.target.value : void 0, R = { ...O(l) ? l.value || {} : g[m] || {}, [T]: M };
1538
+ try {
1539
+ typeof y == "function" && y({
1540
+ detail: R
1541
+ });
1542
+ } catch {
1543
+ }
1544
+ };
1545
+ H(() => {
1546
+ Y.addListener(e, N, $);
1547
+ });
1548
+ }
1549
+ }
1550
+ } catch {
1551
+ }
1552
+ } else if (y == 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] = y, a === "disabled" && y === !1 && !u && Q(e) && Z(e, "disabled");
1559
+ } catch {
1560
+ }
1561
+ else
1562
+ y === !1 && Z(e, a);
1563
+ }
1564
+ }
1565
+ const j = o.listeners ?? {}, C = xe.get(e) ?? {};
1566
+ for (const [a, k] of Object.entries(C))
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 ? xe.set(e, j) : xe.delete(e);
1571
+ const A = { ...s.attrs ?? {} }, p = f, L = o && o.attrs || {};
1572
+ if (Object.prototype.hasOwnProperty.call(L, "class") && typeof e.getAttribute == "function") {
1573
+ const a = e.getAttribute("class");
1574
+ a !== null && (A.class = a);
1575
+ }
1576
+ if (Object.prototype.hasOwnProperty.call(L, "style") && typeof e.getAttribute == "function") {
1577
+ const a = e.getAttribute("style");
1578
+ a !== null && (A.style = a);
1579
+ }
1580
+ try {
1581
+ if (Object.prototype.hasOwnProperty.call(L, "class") && L.class === void 0 && typeof e.getAttribute == "function") {
1582
+ const a = e.getAttribute("class");
1583
+ a !== null && (A.class = a);
1584
+ }
1585
+ if (Object.prototype.hasOwnProperty.call(L, "style") && L.style === void 0 && typeof e.getAttribute == "function") {
1586
+ const a = e.getAttribute("style");
1587
+ a !== null && (A.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 !== A.class && (A.class = a);
1594
+ } catch {
1595
+ }
1596
+ }
1597
+ } catch {
1598
+ }
1599
+ } catch {
1600
+ }
1601
+ for (const a in { ...A, ...p }) {
1602
+ const k = A[a], y = p[a];
1603
+ let w = k, S = y;
1604
+ if (O(k) && (w = k.peek()), O(y) && (S = y.peek()), w !== S)
1605
+ if (d = !0, S == null || S === !1)
1606
+ H(() => {
1607
+ Z(e, a);
1608
+ }), re(s, a, void 0), a === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement ? H(() => {
1609
+ e.value = "";
1610
+ }) : e instanceof HTMLSelectElement ? H(() => {
1611
+ e.value = "";
1612
+ }) : e instanceof HTMLProgressElement && H(() => {
1613
+ e.value = 0;
1614
+ })), a === "checked" && e instanceof HTMLInputElement && H(() => {
1615
+ e.checked = !1;
1616
+ }), a === "disabled" && Q(e) && H(() => {
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
+ H(() => {
1623
+ e.value = S ?? "";
1624
+ });
1625
+ continue;
1626
+ } else if (e instanceof HTMLSelectElement) {
1627
+ H(() => {
1628
+ e.value = S ?? "";
1629
+ });
1630
+ continue;
1631
+ } else if (e instanceof HTMLProgressElement) {
1632
+ H(() => {
1633
+ e.value = Number(S);
1634
+ });
1635
+ continue;
1636
+ }
1637
+ }
1638
+ if (a === "checked" && e instanceof HTMLInputElement) {
1639
+ H(() => {
1640
+ e.checked = !!S;
1641
+ });
1642
+ continue;
1643
+ }
1644
+ if (a === "style") {
1645
+ const m = F(S);
1646
+ m !== null && K(e, a, String(m)), re(s, a, S);
1647
+ continue;
1648
+ }
1649
+ if (a === "class") {
1650
+ const m = F(S);
1651
+ m !== null && K(e, a, String(m)), re(s, a, S);
1652
+ continue;
1653
+ }
1654
+ if (a === "disabled" && Q(e)) {
1655
+ H(() => {
1656
+ const m = de(S);
1657
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = m);
1658
+ }), de(S) ? H(() => {
1659
+ K(e, a, "");
1660
+ }) : H(() => {
1661
+ Z(e, a);
1662
+ });
1663
+ continue;
1664
+ }
1665
+ const u = e.namespaceURI === "http://www.w3.org/2000/svg";
1666
+ if (h && !u && a.includes("-"))
1667
+ if (at(a)) {
1668
+ const m = F(y ?? S);
1669
+ if (m !== null) {
1670
+ try {
1671
+ K(e, a, String(m));
1672
+ } catch {
1673
+ }
1674
+ re(s, a, S);
1675
+ }
1676
+ } else {
1677
+ const m = Ve(a);
1678
+ try {
1679
+ const l = e;
1680
+ l[m] = O(y) ? y : S, re(s, a, S);
1681
+ } catch {
1682
+ const l = F(y ?? S);
1683
+ l !== null && K(e, a, String(l));
1684
+ }
1685
+ }
1686
+ else if (!u && a in e)
1687
+ try {
1688
+ const m = e;
1689
+ m[a] = O(y) ? y : S, re(s, a, S);
1690
+ } catch {
1691
+ const m = F(S);
1692
+ m !== null && (K(e, a, String(m)), re(s, a, S));
1693
+ }
1694
+ else {
1695
+ const m = F(S);
1696
+ m !== null && (K(e, a, String(m)), re(s, a, S));
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
+ ), S = a && typeof a == "object" && "value" in a;
1709
+ let u = !1;
1710
+ H(() => {
1711
+ u = !!O(a);
1712
+ });
1713
+ const m = ze(a);
1714
+ u || S || w || m ? k = a : k = f.disabled;
1715
+ } catch {
1716
+ k = f.disabled;
1717
+ }
1718
+ const y = de(k);
1719
+ H(() => {
1720
+ (e instanceof HTMLInputElement || e instanceof HTMLSelectElement || e instanceof HTMLTextAreaElement || e instanceof HTMLButtonElement) && (e.disabled = y);
1721
+ }), y ? H(() => {
1722
+ K(e, "disabled", "");
1723
+ }) : H(() => {
1724
+ Z(e, "disabled");
1725
+ });
1726
+ }
1727
+ } catch {
1728
+ }
1729
+ if (h && d) {
1730
+ const a = e;
1731
+ H(() => {
1732
+ a._applyProps?.(a._cfg);
1733
+ }), H(() => {
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, L = 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 y = document.createDocumentFragment();
1757
+ y.appendChild(a);
1758
+ for (const w of L) {
1759
+ const S = J(
1760
+ w,
1761
+ s,
1762
+ t,
1763
+ // propagate parent namespace (was previously a boolean)
1764
+ r
1765
+ );
1766
+ if (p.key != null && S instanceof Element && !S.hasAttribute("data-anchor-key")) {
1767
+ const u = w;
1768
+ u && typeof u == "object" && u.key != null || G(S, String(p.key));
1769
+ }
1770
+ y.appendChild(S);
1771
+ }
1772
+ return y.appendChild(k), y;
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 ?? kt[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: g = {} } = e.props ?? {}, h = ut(
1780
+ g,
1781
+ s,
1782
+ i instanceof HTMLElement ? i : void 0,
1783
+ b
1784
+ ), d = {
1785
+ ...f,
1786
+ ...h.props
1787
+ }, E = {
1788
+ ...b,
1789
+ ...h.attrs
1790
+ };
1791
+ try {
1792
+ const p = (E && E.class) ?? (d && d.class) ?? (e.props && e.props.attrs && e.props.attrs.class) ?? (e.props && e.props.props && e.props.props.class), L = F(p);
1793
+ if (L !== null) {
1794
+ const a = String(L).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, L = p && typeof p == "object" && "value" in p;
1802
+ let a = !1;
1803
+ try {
1804
+ a = O(p);
1805
+ } catch {
1806
+ a = !1;
1807
+ }
1808
+ !L && !a && H(() => {
1809
+ E.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 E) {
1816
+ const L = E[p];
1817
+ if (typeof p != "string" || /\[object Object\]/.test(p))
1818
+ continue;
1819
+ const a = Ue(L);
1820
+ if (typeof a == "boolean")
1821
+ a ? K(i, p, "") : H(() => {
1822
+ Z(i, p);
1823
+ });
1824
+ else if (a != null) {
1825
+ if (p === "disabled" && Q(i)) {
1826
+ const k = d.disabled, y = ze(k) ? k : a, w = de(y);
1827
+ H(() => {
1828
+ i.disabled = w;
1829
+ }), w ? H(() => {
1830
+ K(i, p, "");
1831
+ }) : H(() => {
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 y = Ve(p);
1859
+ try {
1860
+ i[y] = a;
1861
+ } catch {
1862
+ const w = F(a);
1863
+ w !== null && K(i, p, String(w));
1864
+ }
1865
+ } else {
1866
+ const y = F(a);
1867
+ y !== null && K(i, p, String(y));
1868
+ }
1869
+ }
1870
+ }
1871
+ for (const p in d) {
1872
+ const L = 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 L == "object" && L !== null && we(L) ? L.value : L;
1876
+ H(() => {
1877
+ i.value = String(a ?? "");
1878
+ });
1879
+ } else if (p.startsWith("on") && typeof L == "function") {
1880
+ const a = ft(p), k = a.includes(":") ? (() => {
1881
+ const y = a.split(":"), w = y[1];
1882
+ if (w.includes("-")) {
1883
+ const S = w.split("-").map(
1884
+ (u, m) => m === 0 ? u : u.charAt(0).toUpperCase() + u.slice(1)
1885
+ ).join("");
1886
+ return `${y[0]}:${S}`;
1887
+ } else {
1888
+ const S = w.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
1889
+ return `${y[0]}:${S}`;
1890
+ }
1891
+ })() : a;
1892
+ h.listeners && (h.listeners[a] || h.listeners[k]) || Y.addListener(i, a, L);
1893
+ } else {
1894
+ if (p.startsWith("on") && L === void 0)
1895
+ continue;
1896
+ if (L == null || L === !1)
1897
+ Z(i, p);
1898
+ else {
1899
+ const a = e.props?.isCustomElement ?? !1, k = typeof L == "object" && L !== null && O(L) ? L : we(L) && typeof L.value < "u" ? L.value : L;
1900
+ if (p === "class" || p === "style") {
1901
+ try {
1902
+ const y = F(k);
1903
+ y !== null && K(i, p, String(y));
1904
+ } catch {
1905
+ }
1906
+ continue;
1907
+ }
1908
+ if (a || p in i)
1909
+ try {
1910
+ const y = typeof L == "object" && L !== null && O(L) ? L : we(L) ? L.value : L;
1911
+ if (p === "disabled" && Q(i)) {
1912
+ const w = d.disabled !== void 0 ? d.disabled : y, S = de(w);
1913
+ H(() => {
1914
+ i.disabled = S;
1915
+ }), S ? H(() => {
1916
+ K(i, p, "");
1917
+ }) : H(() => {
1918
+ Z(i, p);
1919
+ });
1920
+ continue;
1921
+ }
1922
+ try {
1923
+ if (typeof i[p] == "boolean") {
1924
+ let S = y;
1925
+ typeof y == "string" ? y === "false" ? S = !1 : y === "true" ? S = !0 : S = !!y && y !== "" : S = !!y, i[p] = S;
1926
+ } else
1927
+ i[p] = y;
1928
+ } catch {
1929
+ i[p] = y;
1930
+ }
1931
+ } catch {
1932
+ }
1933
+ }
1934
+ }
1935
+ }
1936
+ const C = h.listeners ?? {};
1937
+ for (const [p, L] of Object.entries(C))
1938
+ Y.addListener(i, p, L);
1939
+ Object.keys(C).length > 0 && xe.set(i, C);
1940
+ const A = {
1941
+ ...e,
1942
+ props: {
1943
+ ...e.props,
1944
+ ...h.props
1945
+ }
1946
+ };
1947
+ _e(A, 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 === _t ? null : i.namespaceURI ?? null;
1960
+ for (const L of e.children)
1961
+ i.appendChild(J(L, s, t, p));
1962
+ } else typeof e.children == "string" && (i.textContent = e.children);
1963
+ try {
1964
+ if (i instanceof HTMLSelectElement && E && Object.prototype.hasOwnProperty.call(E, "value"))
1965
+ try {
1966
+ i.value = String(E.value ?? "");
1967
+ } catch {
1968
+ }
1969
+ } catch {
1970
+ }
1971
+ try {
1972
+ if (Q(i)) {
1973
+ const p = d.disabled, L = E.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 || ze(p) ? p : L, S = de(w);
1981
+ H(() => {
1982
+ i.disabled = S;
1983
+ }), S ? H(() => {
1984
+ K(i, "disabled", "");
1985
+ }) : H(() => {
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 C = 0; C < c.length; C++)
2001
+ o.push(c[C]);
2002
+ const i = Array.isArray(s) ? s : [], f = Jt(e);
2003
+ if (f) {
2004
+ const C = (a) => {
2005
+ if (typeof a == "string")
2006
+ return a.startsWith("each-") ? a.substring(5) : a;
2007
+ if (typeof a == "number") return String(a);
2008
+ }, A = [], 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 y of k) {
2013
+ const w = C(
2014
+ y.key ?? a.key ?? "unknown"
2015
+ );
2016
+ A.push({ ...y, key: w });
2017
+ }
2018
+ } else a && A.push({ ...a, key: C(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 y of k) {
2023
+ const w = C(
2024
+ y.key ?? a.key ?? "unknown"
2025
+ );
2026
+ p.push({ ...y, key: w });
2027
+ }
2028
+ } else a && p.push({
2029
+ ...a,
2030
+ key: C(a.key)
2031
+ });
2032
+ if (A.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 _ = Oe(v);
2042
+ if (_ = C(_), _ != null && v instanceof Element && v.nodeType === Node.ELEMENT_NODE) {
2043
+ let T = typeof _ == "string" && _.includes(":") ? _.substring(0, _.lastIndexOf(":")) : _;
2044
+ T = String(T), k.set(T, v);
2045
+ }
2046
+ }
2047
+ const y = /* @__PURE__ */ new Set(), w = /* @__PURE__ */ new Map(), S = o.length > 0;
2048
+ if (f.moveClass && S)
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 A) {
2058
+ let v = l.key;
2059
+ if (v == null) continue;
2060
+ v = String(v);
2061
+ const _ = a.get(v);
2062
+ let T = k.get(v);
2063
+ if (T && _) {
2064
+ const N = Ae(T, _, l, r);
2065
+ y.add(T);
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
+ T = J(
2076
+ l,
2077
+ r,
2078
+ void 0,
2079
+ e instanceof Element ? e.namespaceURI ?? null : null
2080
+ ), G(T, String(v)), e.appendChild(T);
2081
+ const N = S || f.appear === !0;
2082
+ T instanceof HTMLElement && N && ke(T, f).catch(($) => {
2083
+ W("Enter transition error:", $);
2084
+ }), u.push({ node: T, key: v, newVNode: l, isNew: !0 });
2085
+ }
2086
+ }
2087
+ const m = [];
2088
+ for (let l = 0; l < o.length; l++) {
2089
+ const v = o[l], _ = Oe(v);
2090
+ if (!y.has(v) && _ != null && v instanceof HTMLElement) {
2091
+ const N = De(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
+ m.push(N);
2097
+ }
2098
+ }
2099
+ if (m.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: T } of u)
2106
+ if (!T && _ instanceof HTMLElement) {
2107
+ const N = w.get(_);
2108
+ if (N) {
2109
+ const $ = _.getBoundingClientRect(), x = N.left - $.left, M = N.top - $.top;
2110
+ if (x !== 0 || M !== 0) {
2111
+ const D = f.moveClass.split(/\s+/).filter((R) => R);
2112
+ v.push({ node: _, deltaX: x, deltaY: M, moveClasses: D });
2113
+ }
2114
+ }
2115
+ }
2116
+ if (v.length > 0) {
2117
+ for (const { node: _, deltaX: T, deltaY: N } of v)
2118
+ _.style.transform = `translate(${T}px, ${N}px)`, _.style.transitionProperty = "none";
2119
+ e.offsetHeight, requestAnimationFrame(() => {
2120
+ requestAnimationFrame(() => {
2121
+ for (const { node: _, moveClasses: T } of v)
2122
+ for (const N of T)
2123
+ _.classList.add(N);
2124
+ requestAnimationFrame(() => {
2125
+ const _ = f.moveClass || "", T = _.match(/duration-(\d+)/), N = T ? `${T[1]}ms` : "300ms", $ = _.match(
2126
+ /ease-(out|in|in-out|linear)/
2127
+ ), x = $ ? `ease-${$[1]}` : "ease-out";
2128
+ for (const { node: M } of v)
2129
+ M.style.transition = `transform ${N} ${x}`;
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 C of i)
2156
+ C && C.key != null && b.set(C.key, C);
2157
+ const g = /* @__PURE__ */ new Map();
2158
+ for (let C = 0; C < o.length; C++) {
2159
+ const A = o[C], p = Oe(A);
2160
+ p != null && g.set(p, A);
2161
+ }
2162
+ const h = /* @__PURE__ */ new Set();
2163
+ let d = e.firstChild;
2164
+ function E(C, A) {
2165
+ let p = C;
2166
+ for (; p && (h.add(p), p !== A); )
2167
+ p = p.nextSibling;
2168
+ }
2169
+ function j(C, A, p, L, a, k = !0) {
2170
+ const y = [];
2171
+ let w = C.nextSibling;
2172
+ for (; w && w !== A; )
2173
+ y.push(w), w = w.nextSibling;
2174
+ const S = Array.isArray(p) ? p : [];
2175
+ if (L.some((m) => m && m.key != null) || S.some((m) => m && m.key != null)) {
2176
+ const m = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
2177
+ for (const N of S)
2178
+ N && N.key != null && m.set(N.key, N);
2179
+ for (const N of y) {
2180
+ const $ = Oe(N);
2181
+ $ != null && l.set($, N);
2182
+ }
2183
+ const v = a && a.state === "visible" && S.length === 0 && L.length > 0, _ = /* @__PURE__ */ new Set();
2184
+ let T = C.nextSibling;
2185
+ for (const N of L) {
2186
+ if (typeof N == "object" && N.tag === "#anchor") {
2187
+ const x = N.key, M = `${x}:start`, D = `${x}:end`, R = l.get(M), ee = l.get(D), q = Array.isArray(N.children) ? N.children : [], I = m.get(x);
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, T);
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, T), _.add(oe);
2206
+ }
2207
+ e.insertBefore(B, T);
2208
+ }
2209
+ let U = P;
2210
+ for (; U && (_.add(U), U !== B); )
2211
+ U = U.nextSibling;
2212
+ N._startNode = P, N._endNode = B, T = B.nextSibling;
2213
+ continue;
2214
+ }
2215
+ let $;
2216
+ if (N.key != null && l.has(N.key)) {
2217
+ const x = m.get(N.key);
2218
+ $ = Ae(
2219
+ l.get(N.key),
2220
+ x,
2221
+ N,
2222
+ r
2223
+ ), _.add($), a && $ instanceof HTMLElement && v && a.appear && ke($, a).catch((M) => {
2224
+ W("Transition enter error (appear):", M);
2225
+ }), $ !== T && e.contains($) && e.insertBefore($, T);
2226
+ } else
2227
+ $ = J(
2228
+ N,
2229
+ r,
2230
+ void 0,
2231
+ e instanceof Element ? e.namespaceURI ?? null : null
2232
+ ), e.insertBefore($, T), _.add($), a && $ instanceof HTMLElement && k && ke($, a).catch((x) => {
2233
+ W("Transition enter error:", x);
2234
+ });
2235
+ T = $.nextSibling;
2236
+ }
2237
+ for (const N of y)
2238
+ !_.has(N) && e.contains(N) && (a && N instanceof HTMLElement && k ? De(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 m = Math.min(
2245
+ S.length,
2246
+ L.length
2247
+ );
2248
+ for (let l = 0; l < m; l++) {
2249
+ const v = S[l], _ = L[l], T = Ae(y[l], v, _, r);
2250
+ T !== y[l] && (e.insertBefore(T, y[l]), e.removeChild(y[l]));
2251
+ }
2252
+ for (let l = m; l < L.length; l++) {
2253
+ const v = J(
2254
+ L[l],
2255
+ r,
2256
+ void 0,
2257
+ e instanceof Element ? e.namespaceURI ?? null : null
2258
+ );
2259
+ e.insertBefore(v, A), a && v instanceof HTMLElement && k && ke(v, a).catch((_) => {
2260
+ W("Transition enter error:", _);
2261
+ });
2262
+ }
2263
+ for (let l = m; l < y.length; l++) {
2264
+ const v = y[l];
2265
+ a && v instanceof HTMLElement && k ? De(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 C of t) {
2274
+ let A;
2275
+ if (C.tag === "#anchor") {
2276
+ const p = C.key, L = `${p}:start`, a = `${p}:end`;
2277
+ let k = g.get(L), y = g.get(a);
2278
+ const w = Array.isArray(C.children) ? C.children : [];
2279
+ if (k || (k = document.createTextNode(""), G(k, L)), y || (y = document.createTextNode(""), G(y, a)), C._startNode = k, C._endNode = y, !e.contains(k) || !e.contains(y)) {
2280
+ e.insertBefore(k, d);
2281
+ const S = C._transition, m = !(S && S.state === "visible" && w.length > 0) || S.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), S && v instanceof HTMLElement && m && ke(v, S).catch((_) => {
2290
+ W("Transition enter error:", _);
2291
+ });
2292
+ }
2293
+ e.insertBefore(y, d);
2294
+ } else {
2295
+ const S = C._transition, m = b.get(p)._transition, l = m && m.state !== S?.state, v = S && S.state === "visible" && w.length > 0 && !l, _ = l || !v || S?.appear === !0;
2296
+ j(
2297
+ k,
2298
+ y,
2299
+ b.get(p)?.children,
2300
+ w,
2301
+ S,
2302
+ _
2303
+ );
2304
+ }
2305
+ E(k, y), d = y.nextSibling;
2306
+ continue;
2307
+ }
2308
+ if (C.key != null && g.has(C.key)) {
2309
+ const p = b.get(C.key);
2310
+ A = Ae(
2311
+ g.get(C.key),
2312
+ p,
2313
+ C,
2314
+ r,
2315
+ n
2316
+ ), h.add(A), A !== d && e.contains(A) && (d && !e.contains(d) && (d = null), e.insertBefore(A, d));
2317
+ } else
2318
+ A = J(
2319
+ C,
2320
+ r,
2321
+ n,
2322
+ e instanceof Element ? e.namespaceURI ?? null : null
2323
+ ), d && !e.contains(d) && (d = null), e.insertBefore(A, d), h.add(A);
2324
+ d = A.nextSibling;
2325
+ }
2326
+ for (let C = 0; C < o.length; C++) {
2327
+ const A = o[C];
2328
+ !h.has(A) && e.contains(A) && (ue(A, n), e.removeChild(A));
2329
+ }
2330
+ }
2331
+ function Ae(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 g = document.createDocumentFragment();
2345
+ g.appendChild(f);
2346
+ for (const h of i) {
2347
+ const d = J(
2348
+ h,
2349
+ r,
2350
+ n,
2351
+ e.parentNode instanceof Element ? e.parentNode.namespaceURI ?? null : null
2352
+ );
2353
+ g.appendChild(d);
2354
+ }
2355
+ return g.appendChild(b), e.parentNode?.replaceChild(g, 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 _e(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 g of o)
2378
+ b.appendChild(
2379
+ J(
2380
+ g,
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 rt(o, s.props || {}, t.props || {}, r), Yt(o, s.children, t.children, r, n), _e(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 rt(i, s.props || {}, t.props || {}, r), _e(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 _e(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 = Fe(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 = Ae(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 g = 0; g < e.childNodes.length; g++) {
2432
+ const h = e.childNodes[g];
2433
+ h !== i && h.nodeName !== "STYLE" && (ue(h, r), f.push(h));
2434
+ }
2435
+ f.forEach((g) => e.removeChild(g));
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 Le = [], it = /* @__PURE__ */ new WeakMap(), ge = /* @__PURE__ */ new WeakMap();
2447
+ function Qt(e, s) {
2448
+ ge.has(e) || ge.set(e, /* @__PURE__ */ new Set()), ge.get(e).add(s);
2449
+ }
2450
+ function en(e, s) {
2451
+ const t = ge.get(e);
2452
+ t && (t.delete(s), t.size === 0 && ge.delete(e));
2453
+ }
2454
+ function tn(e, s, t, r, n, c, o, i) {
2455
+ if (e) {
2456
+ Le.push(t);
2457
+ try {
2458
+ const f = s.render(t);
2459
+ if (f instanceof Promise) {
2460
+ c(!0);
2461
+ const b = e.host.isConnected, g = e, h = g._asyncRenderToken = (g._asyncRenderToken ?? 0) + 1;
2462
+ f.then((d) => {
2463
+ b && !e.host.isConnected || g._asyncRenderToken === h && (c(!1), o(null), ot(e, d, t, r, n), i(e.innerHTML));
2464
+ }).catch((d) => {
2465
+ b && !e.host.isConnected || g._asyncRenderToken === h && (c(!1), o(d instanceof Error ? d : new Error(String(d))));
2466
+ });
2467
+ return;
2468
+ }
2469
+ ot(e, f, t, r, n), i(e.innerHTML);
2470
+ } catch (f) {
2471
+ o(f instanceof Error ? f : new Error(String(f)));
2472
+ } finally {
2473
+ Le.pop();
2474
+ }
2475
+ }
2476
+ }
2477
+ function ot(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, { isVitest: g, isCypress: h, isTest: d } = bt(), E = (g || d) && !h;
2493
+ if (b) {
2494
+ const A = t + 1;
2495
+ n(A);
2496
+ const p = d ? 50 : 10, L = d ? 100 : 25, a = E ? 12 : 50;
2497
+ if (A === p && !d)
2498
+ te(
2499
+ `⚠️ Component rendering frequently. Performance may be impacted.
2500
+ Common causes:
2501
+ • State updates during render cycle
2502
+ • Event handlers with immediate function calls
2503
+ • Missing effect dependencies`
2504
+ );
2505
+ else if (A === L && !d)
2506
+ te(
2507
+ `⚠️ Component is re-rendering rapidly. Applying throttling.
2508
+ This might indicate:
2509
+ • Event handler calling function immediately: @click="\${fn()}" should be @click="\${fn}"
2510
+ • State modification during render
2511
+ • Missing dependencies in computed/watch`
2512
+ );
2513
+ else if (A >= a) {
2514
+ W(
2515
+ `🛑 Infinite render loop detected. Stopping to prevent browser freeze.
2516
+ Possible causes:
2517
+ • State updates triggering immediate re-renders
2518
+ • Computed values changing during evaluation
2519
+ • Circular dependencies in reactive system`
2520
+ ), o(null);
2521
+ return;
2522
+ }
2523
+ } else
2524
+ n(0);
2525
+ let j = 0;
2526
+ d || (t >= 40 ? j = 500 : t >= 25 ? j = 100 : t >= 15 && (j = 16));
2527
+ const C = () => {
2528
+ r(Date.now());
2529
+ try {
2530
+ e();
2531
+ } catch (A) {
2532
+ W("Error during render execution:", A);
2533
+ } finally {
2534
+ o(null);
2535
+ }
2536
+ };
2537
+ if (j > 0) {
2538
+ const A = setTimeout(C, j);
2539
+ o(A);
2540
+ } else d ? C() : (o({}), queueMicrotask(C));
2541
+ }
2542
+ function sn(e, s) {
2543
+ let t = s;
2544
+ try {
2545
+ const r = ge.get(e);
2546
+ if (r?.size)
2547
+ for (const n of r)
2548
+ try {
2549
+ const c = n.lastHtmlStringForJitCSS;
2550
+ c?.trim() && (t += `
2551
+ ` + c);
2552
+ } catch {
2553
+ }
2554
+ else {
2555
+ const n = e.querySelectorAll("*");
2556
+ for (const c of n)
2557
+ try {
2558
+ const o = c.lastHtmlStringForJitCSS;
2559
+ o?.trim() && (t += `
2560
+ ` + o);
2561
+ } catch {
2562
+ }
2563
+ }
2564
+ } catch {
2565
+ }
2566
+ return t;
2567
+ }
2568
+ function rn(e) {
2569
+ return "adoptedStyleSheets" in e && typeof CSSStyleSheet < "u" && "replaceSync" in CSSStyleSheet.prototype;
2570
+ }
2571
+ function ct(e, s) {
2572
+ let t = e.querySelector(
2573
+ "style[data-cer-runtime]"
2574
+ );
2575
+ t || (t = document.createElement("style"), K(t, "data-cer-runtime", "true"), e.appendChild(t));
2576
+ try {
2577
+ t.textContent = s;
2578
+ } catch {
2579
+ }
2580
+ }
2581
+ function on(e, s, t, r, n) {
2582
+ if (!e) return;
2583
+ const c = sn(e, t);
2584
+ if (it.get(e) === c)
2585
+ return;
2586
+ it.set(e, c);
2587
+ const i = Tt(e) ? wt(c) : "", f = Lt(), b = s._computedStyle, g = rn(e), h = Mt();
2588
+ let d = "";
2589
+ if (!g)
2590
+ try {
2591
+ h?.cssRules && (d = Array.from(h.cssRules).map((A) => A.cssText).join(`
2592
+ `));
2593
+ } catch {
2594
+ d = "";
2595
+ }
2596
+ if (!i?.trim() && !b && !f) {
2597
+ if (n(null), g)
2598
+ e.adoptedStyleSheets = [
2599
+ je(),
2600
+ h
2601
+ ];
2602
+ else {
2603
+ const A = Ce(et), p = Ce(`${A}
2604
+ ${d}`);
2605
+ ct(e, p);
2606
+ try {
2607
+ e.adoptedStyleSheets = [je(), h];
2608
+ } catch {
2609
+ }
2610
+ }
2611
+ return;
2612
+ }
2613
+ let E = "";
2614
+ if (b && (E += b + `
2615
+ `), i && (E += i + `
2616
+ `), E = Nt(E), E = Ce(E), g) {
2617
+ let A = r;
2618
+ A || (A = new CSSStyleSheet());
2619
+ try {
2620
+ A.replaceSync(E);
2621
+ const p = [je(), h];
2622
+ f && p.push(f), p.push(A), e.adoptedStyleSheets = p, n(A);
2623
+ return;
2624
+ } catch {
2625
+ }
2626
+ }
2627
+ const j = Ce(et), C = Ce(`${j}
2628
+ ${d}
2629
+ ${E}`);
2630
+ ct(e, C);
2631
+ try {
2632
+ const A = [
2633
+ je(),
2634
+ h
2635
+ ];
2636
+ if (f && A.push(f), typeof CSSStyleSheet < "u")
2637
+ try {
2638
+ const p = new CSSStyleSheet();
2639
+ p.replaceSync(E), A.push(p);
2640
+ } catch {
2641
+ A.push({
2642
+ cssRules: [],
2643
+ replaceSync: () => {
2644
+ }
2645
+ });
2646
+ }
2647
+ e.adoptedStyleSheets = A;
2648
+ } catch {
2649
+ }
2650
+ n(null);
2651
+ }
2652
+ function cn(e, s) {
2653
+ if (!s.render)
2654
+ throw new Error("Component must have a render function");
2655
+ return typeof window > "u" ? class {
2656
+ constructor() {
2657
+ }
2658
+ } : class extends HTMLElement {
2659
+ context;
2660
+ _refs = {};
2661
+ _listeners = [];
2662
+ _watchers = /* @__PURE__ */ new Map();
2663
+ /** @internal */
2664
+ _renderTimeoutId = null;
2665
+ _mounted = !1;
2666
+ _hasError = !1;
2667
+ _initializing = !0;
2668
+ _componentId;
2669
+ _styleSheet = null;
2670
+ _lastHtmlStringForJitCSS = "";
2671
+ /**
2672
+ * Returns the last rendered HTML string for JIT CSS.
2673
+ */
2674
+ get lastHtmlStringForJitCSS() {
2675
+ return this._lastHtmlStringForJitCSS;
2676
+ }
2677
+ /**
2678
+ * Returns true if the most recent render or lifecycle call threw an error.
2679
+ */
2680
+ get hasError() {
2681
+ return this._hasError;
2682
+ }
2683
+ /**
2684
+ * Returns true if the component is currently loading.
2685
+ */
2686
+ get isLoading() {
2687
+ return this._templateLoading;
2688
+ }
2689
+ /**
2690
+ * Returns the last error thrown during rendering, or null if none.
2691
+ */
2692
+ get lastError() {
2693
+ return this._templateError;
2694
+ }
2695
+ _cfg;
2696
+ _lastRenderTime = 0;
2697
+ _renderCount = 0;
2698
+ _templateLoading = !1;
2699
+ _templateError = null;
2700
+ constructor() {
2701
+ super(), this.shadowRoot || this.attachShadow({ mode: "open" }), this._cfg = Te.get(e) || s, this._componentId = `${e}-${crypto.randomUUID()}`;
2702
+ const t = this._initContext(s), r = (c, o, i) => {
2703
+ Object.defineProperty(c, o, {
2704
+ value: i,
2705
+ writable: !1,
2706
+ enumerable: !1,
2707
+ configurable: !1
2708
+ });
2709
+ };
2710
+ r(t, "refs", this._refs), r(
2711
+ t,
2712
+ "requestRender",
2713
+ () => this.requestRender()
2714
+ ), r(
2715
+ t,
2716
+ "_requestRender",
2717
+ () => this._requestRender()
2718
+ ), r(t, "_componentId", this._componentId), r(
2719
+ t,
2720
+ "_triggerWatchers",
2721
+ (c, o) => this._triggerWatchers(c, o)
2722
+ ), this.context = t, H(() => {
2723
+ r(t, "_host", this);
2724
+ }), r(
2725
+ this.context,
2726
+ "emit",
2727
+ (c, o, i) => {
2728
+ const f = {
2729
+ detail: o,
2730
+ bubbles: !0,
2731
+ composed: !0,
2732
+ ...i || {}
2733
+ }, b = new CustomEvent(c, f);
2734
+ this.dispatchEvent(b);
2735
+ const g = c.indexOf(":");
2736
+ if (g > 0) {
2737
+ const h = c.substring(0, g), d = c.substring(g + 1), E = d.includes("-") ? `${h}:${d.split("-").map(
2738
+ (j, C) => C === 0 ? j : j.charAt(0).toUpperCase() + j.slice(1)
2739
+ ).join("")}` : `${h}:${d.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase()}`;
2740
+ E !== c && H(() => {
2741
+ this.dispatchEvent(new CustomEvent(E, f));
2742
+ });
2743
+ }
2744
+ return !b.defaultPrevented;
2745
+ }
2746
+ );
2747
+ const n = Te.get(e) || s;
2748
+ for (const c in n) {
2749
+ const o = n[c];
2750
+ typeof o == "function" && (this.context[c] = (...i) => o(...i, this.context));
2751
+ }
2752
+ if (n.props)
2753
+ for (const c in n.props) {
2754
+ let o = this[c];
2755
+ Object.defineProperty(this, c, {
2756
+ get() {
2757
+ return o;
2758
+ },
2759
+ set(i) {
2760
+ const f = o;
2761
+ o = i, this.context[c] = i, this._initializing || (this._applyProps(n), f !== i && this._requestRender());
2762
+ },
2763
+ enumerable: !0,
2764
+ configurable: !0
2765
+ });
2766
+ }
2767
+ this._initializing = !1, this._initWatchers(n), this._applyProps(n), this._render(n);
2768
+ }
2769
+ connectedCallback() {
2770
+ this._runLogicWithinErrorBoundary(s, () => {
2771
+ const t = this.getRootNode();
2772
+ t && t !== document && "host" in t && Qt(t, this);
2773
+ const r = this.getAttribute("data-cer-hydrate");
2774
+ if (r !== "none") {
2775
+ if (r === "idle") {
2776
+ const n = () => this._hydrateNow(s);
2777
+ typeof requestIdleCallback < "u" ? requestIdleCallback(n) : setTimeout(n, 200);
2778
+ return;
2779
+ }
2780
+ if (r === "visible") {
2781
+ new IntersectionObserver(
2782
+ (c, o) => {
2783
+ c.some((i) => i.isIntersecting) && (o.disconnect(), this._hydrateNow(s));
2784
+ },
2785
+ { rootMargin: "0px", threshold: 0 }
2786
+ ).observe(this);
2787
+ return;
2788
+ }
2789
+ this._applyProps(s), this._requestRender(), tt(s, this.context, this._mounted, (n) => {
2790
+ this._mounted = n;
2791
+ });
2792
+ }
2793
+ });
2794
+ }
2795
+ /** Execute the standard hydration sequence (used by deferred strategies). */
2796
+ _hydrateNow(t) {
2797
+ this._runLogicWithinErrorBoundary(t, () => {
2798
+ this._applyProps(t), this._requestRender(), tt(t, this.context, this._mounted, (r) => {
2799
+ this._mounted = r;
2800
+ });
2801
+ });
2802
+ }
2803
+ disconnectedCallback() {
2804
+ this._runLogicWithinErrorBoundary(s, () => {
2805
+ const t = this.getRootNode();
2806
+ t && t !== document && "host" in t && en(t, this), Ht(
2807
+ s,
2808
+ this.context,
2809
+ this._listeners,
2810
+ () => {
2811
+ this._listeners = [];
2812
+ },
2813
+ () => {
2814
+ this._watchers.clear();
2815
+ },
2816
+ (r) => {
2817
+ this._templateLoading = r;
2818
+ },
2819
+ (r) => {
2820
+ this._templateError = r;
2821
+ },
2822
+ (r) => {
2823
+ this._mounted = r;
2824
+ }
2825
+ ), Ke.cleanup(this._componentId);
2826
+ });
2827
+ }
2828
+ attributeChangedCallback(t, r, n) {
2829
+ this._runLogicWithinErrorBoundary(s, () => {
2830
+ this._applyProps(s), r !== n && this._requestRender(), xt(s, t, r, n, this.context);
2831
+ });
2832
+ }
2833
+ static get observedAttributes() {
2834
+ return s.props ? Object.keys(s.props).map(X) : [];
2835
+ }
2836
+ // --- Render ---
2837
+ _render(t) {
2838
+ this._runLogicWithinErrorBoundary(t, () => {
2839
+ tn(
2840
+ this.shadowRoot,
2841
+ t,
2842
+ this.context,
2843
+ this._refs,
2844
+ (r) => {
2845
+ this._lastHtmlStringForJitCSS = r, typeof this.onHtmlStringUpdate == "function" && this?.onHtmlStringUpdate?.(r);
2846
+ },
2847
+ (r) => {
2848
+ this._templateLoading = r, this?.onLoadingStateChange?.(r);
2849
+ },
2850
+ (r) => {
2851
+ this._templateError = r, this?.onErrorStateChange?.(r);
2852
+ },
2853
+ (r) => this._applyStyle(t, r)
2854
+ );
2855
+ });
2856
+ }
2857
+ requestRender() {
2858
+ this._requestRender();
2859
+ }
2860
+ _requestRender() {
2861
+ this._runLogicWithinErrorBoundary(this._cfg, () => {
2862
+ Se(() => {
2863
+ nn(
2864
+ () => this._render(this._cfg),
2865
+ this._lastRenderTime,
2866
+ this._renderCount,
2867
+ (t) => {
2868
+ this._lastRenderTime = t;
2869
+ },
2870
+ (t) => {
2871
+ this._renderCount = t;
2872
+ },
2873
+ this._renderTimeoutId,
2874
+ (t) => {
2875
+ this._renderTimeoutId = t;
2876
+ }
2877
+ );
2878
+ }, this._componentId);
2879
+ });
2880
+ }
2881
+ // --- Style ---
2882
+ _applyStyle(t, r) {
2883
+ this._runLogicWithinErrorBoundary(t, () => {
2884
+ on(
2885
+ this.shadowRoot,
2886
+ this.context,
2887
+ r,
2888
+ this._styleSheet,
2889
+ (n) => {
2890
+ this._styleSheet = n;
2891
+ }
2892
+ );
2893
+ });
2894
+ }
2895
+ // --- Error Boundary function ---
2896
+ _runLogicWithinErrorBoundary(t, r) {
2897
+ try {
2898
+ r(), this._hasError = !1;
2899
+ } catch (n) {
2900
+ this._hasError = !0;
2901
+ try {
2902
+ const c = this.tagName?.toLowerCase?.() || "<unknown>", o = this._componentId || "<unknown-id>", i = {};
2903
+ if (t && t.props)
2904
+ for (const f of Object.keys(t.props))
2905
+ try {
2906
+ const b = this.context[f];
2907
+ 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;
2908
+ } catch {
2909
+ i[f] = "[unreadable]";
2910
+ }
2911
+ W(`Error rendering component <${c}> (id=${o}):`, n), W("Component props snapshot:", i), te(
2912
+ "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`...`)."
2913
+ );
2914
+ } catch {
2915
+ }
2916
+ if (t.onError && t.onError(n, this.context), this.tagName.toLowerCase() !== "cer-error-boundary") {
2917
+ let c = this.parentElement;
2918
+ if (!c) {
2919
+ const o = this.getRootNode();
2920
+ o instanceof ShadowRoot && (c = o.host.parentElement);
2921
+ }
2922
+ for (; c; ) {
2923
+ if (c.tagName.toLowerCase() === "cer-error-boundary") {
2924
+ c._cerHandleChildError?.(
2925
+ n
2926
+ );
2927
+ break;
2928
+ }
2929
+ let o = c.parentElement;
2930
+ if (!o) {
2931
+ const i = c.getRootNode();
2932
+ i instanceof ShadowRoot && (o = i.host.parentElement);
2933
+ }
2934
+ c = o;
2935
+ }
2936
+ }
2937
+ }
2938
+ }
2939
+ // --- State, props, computed ---
2940
+ _initContext(t) {
2941
+ try {
2942
+ let r = function(c, o = "") {
2943
+ if (Array.isArray(c))
2944
+ return new Proxy(c, {
2945
+ get(i, f, b) {
2946
+ const g = Reflect.get(i, f, b);
2947
+ return typeof g == "function" && typeof f == "string" && [
2948
+ "push",
2949
+ "pop",
2950
+ "shift",
2951
+ "unshift",
2952
+ "splice",
2953
+ "sort",
2954
+ "reverse"
2955
+ ].includes(f) ? function(...d) {
2956
+ const E = g.apply(i, d);
2957
+ if (!n._initializing) {
2958
+ const j = o || "root";
2959
+ n._triggerWatchers(j, i), Se(
2960
+ () => n._render(t),
2961
+ n._componentId
2962
+ );
2963
+ }
2964
+ return E;
2965
+ } : g;
2966
+ },
2967
+ set(i, f, b) {
2968
+ if (i[String(f)] = b, !n._initializing) {
2969
+ const g = o ? `${o}.${String(f)}` : String(f);
2970
+ n._triggerWatchers(g, b), Se(() => n._render(t), n._componentId);
2971
+ }
2972
+ return !0;
2973
+ },
2974
+ deleteProperty(i, f) {
2975
+ if (delete i[String(f)], !n._initializing) {
2976
+ const b = o ? `${o}.${String(f)}` : String(f);
2977
+ n._triggerWatchers(b, void 0), Se(() => n._render(t), n._componentId);
2978
+ }
2979
+ return !0;
2980
+ }
2981
+ });
2982
+ if (c && typeof c == "object") {
2983
+ if (O(c))
2984
+ return c;
2985
+ for (const i in c) {
2986
+ const f = o ? `${o}.${i}` : i;
2987
+ c[i] = r(c[i], f);
2988
+ }
2989
+ return new Proxy(c, {
2990
+ set(i, f, b) {
2991
+ const g = o ? `${o}.${String(f)}` : String(f);
2992
+ return i[String(f)] = r(b, g), n._initializing || (n._triggerWatchers(
2993
+ g,
2994
+ i[String(f)]
2995
+ ), Se(() => n._render(t), n._componentId)), !0;
2996
+ },
2997
+ get(i, f, b) {
2998
+ return Reflect.get(i, f, b);
2999
+ }
3000
+ });
3001
+ }
3002
+ return c;
3003
+ };
3004
+ const n = this;
3005
+ return r({
3006
+ // For functional components, state is managed by state() function calls
3007
+ // Include prop defaults in initial reactive context so prop updates trigger reactivity
3008
+ ...t.props ? Object.fromEntries(
3009
+ Object.entries(t.props).map(([c, o]) => [
3010
+ c,
3011
+ o.default
3012
+ ])
3013
+ ) : {}
3014
+ });
3015
+ } catch {
3016
+ return {};
3017
+ }
3018
+ }
3019
+ _initWatchers(t) {
3020
+ this._runLogicWithinErrorBoundary(t, () => {
3021
+ jt(
3022
+ this.context,
3023
+ this._watchers,
3024
+ {}
3025
+ // Watchers are now handled by the watch() function in functional API
3026
+ );
3027
+ });
3028
+ }
3029
+ _triggerWatchers(t, r) {
3030
+ $t(this.context, this._watchers, t, r);
3031
+ }
3032
+ _applyProps(t) {
3033
+ this._runLogicWithinErrorBoundary(t, () => {
3034
+ Ot(this, t, this.context);
3035
+ });
3036
+ }
3037
+ };
3038
+ }
3039
+ function He(e, s, t, r) {
3040
+ for (const n of t)
3041
+ try {
3042
+ n(...r);
3043
+ } catch (c) {
3044
+ W(
3045
+ `[${e}] Error in ${s} lifecycle hook:`,
3046
+ c
3047
+ );
3048
+ }
3049
+ }
3050
+ function vn(e, s, t) {
3051
+ At();
3052
+ let r = X(e);
3053
+ r.includes("-") || (r = `cer-${r}`);
3054
+ const n = {}, c = {
3055
+ // Props are accessed via useProps() hook
3056
+ props: {},
3057
+ hydrate: t?.hydrate,
3058
+ // Add lifecycle hooks from the stored functions
3059
+ onConnected: (o) => {
3060
+ if (n.onConnected)
3061
+ try {
3062
+ n.onConnected(o);
3063
+ } catch (i) {
3064
+ W(`[${r}] Error in onConnected lifecycle hook:`, i);
3065
+ }
3066
+ },
3067
+ onDisconnected: (o) => {
3068
+ if (n.onDisconnected)
3069
+ try {
3070
+ n.onDisconnected(o);
3071
+ } catch (i) {
3072
+ W(`[${r}] Error in onDisconnected lifecycle hook:`, i);
3073
+ }
3074
+ },
3075
+ onAttributeChanged: (o, i, f, b) => {
3076
+ if (n.onAttributeChanged)
3077
+ try {
3078
+ n.onAttributeChanged(o, i, f, b);
3079
+ } catch (g) {
3080
+ W(`[${r}] Error in onAttributeChanged lifecycle hook:`, g);
3081
+ }
3082
+ },
3083
+ onError: (o, i) => {
3084
+ if (n.onError && o)
3085
+ try {
3086
+ n.onError(o, i);
3087
+ } catch (f) {
3088
+ W(`[${r}] Error in onError handler (the error handler itself threw):`, f);
3089
+ }
3090
+ },
3091
+ render: (o) => {
3092
+ const i = o, f = i._componentId || `${r}-${crypto.randomUUID()}`;
3093
+ Ke.setCurrentComponent(f, () => {
3094
+ o.requestRender && o.requestRender();
3095
+ });
3096
+ try {
3097
+ Object.defineProperty(o, "_hookCallbacks", {
3098
+ value: {},
3099
+ writable: !0,
3100
+ enumerable: !1,
3101
+ configurable: !0
3102
+ }), Object.defineProperty(o, "_computedStyle", {
3103
+ value: void 0,
3104
+ writable: !0,
3105
+ enumerable: !1,
3106
+ configurable: !0
3107
+ }), Ze(o), Qe();
3108
+ let b;
3109
+ try {
3110
+ b = s();
3111
+ } catch (g) {
3112
+ try {
3113
+ const d = i._hookCallbacks?.onError;
3114
+ if (Array.isArray(d))
3115
+ for (const E of d)
3116
+ try {
3117
+ E(g);
3118
+ } catch {
3119
+ }
3120
+ else if (typeof d == "function")
3121
+ try {
3122
+ d(g);
3123
+ } catch {
3124
+ }
3125
+ } catch {
3126
+ }
3127
+ try {
3128
+ const h = i._host;
3129
+ if (h?.parentElement) {
3130
+ let d = h.parentElement;
3131
+ for (; d; ) {
3132
+ if (d.tagName.toLowerCase() === "cer-error-boundary") {
3133
+ d._cerHandleChildError?.(
3134
+ g
3135
+ );
3136
+ break;
3137
+ }
3138
+ let E = d.parentElement;
3139
+ if (!E) {
3140
+ const j = d.getRootNode();
3141
+ j instanceof ShadowRoot && (E = j.host.parentElement);
3142
+ }
3143
+ d = E;
3144
+ }
3145
+ }
3146
+ } catch {
3147
+ }
3148
+ throw g;
3149
+ }
3150
+ if (i._hookCallbacks) {
3151
+ const g = i._hookCallbacks;
3152
+ if (g.onConnected) {
3153
+ const h = g.onConnected;
3154
+ n.onConnected = (d) => {
3155
+ He(r, "useOnConnected", h, [d]);
3156
+ };
3157
+ }
3158
+ if (g.onDisconnected) {
3159
+ const h = g.onDisconnected;
3160
+ n.onDisconnected = (d) => {
3161
+ He(r, "useOnDisconnected", h, [d]);
3162
+ };
3163
+ }
3164
+ if (g.onAttributeChanged) {
3165
+ const h = g.onAttributeChanged;
3166
+ n.onAttributeChanged = (d, E, j, C) => {
3167
+ He(r, "useOnAttributeChanged", h, [d, E, j, C]);
3168
+ };
3169
+ }
3170
+ if (g.onError) {
3171
+ const h = g.onError;
3172
+ n.onError = (d) => {
3173
+ He(r, "useOnError", h, [d]);
3174
+ };
3175
+ }
3176
+ if (g.props && !Object.keys(c.props ?? {}).length) {
3177
+ const h = g.props;
3178
+ c.props = Object.fromEntries(
3179
+ Object.entries(h).map(([d, E]) => [
3180
+ d,
3181
+ { type: typeof E == "boolean" ? Boolean : typeof E == "number" ? Number : typeof E == "string" ? String : Function, default: E }
3182
+ ])
3183
+ ), Te.set(r, c);
3184
+ }
3185
+ }
3186
+ return b;
3187
+ } finally {
3188
+ Ye(), Ke.clearCurrentComponent();
3189
+ }
3190
+ }
3191
+ };
3192
+ if (Te.set(r, c), typeof window < "u") {
3193
+ try {
3194
+ const o = {
3195
+ _hookCallbacks: {},
3196
+ requestRender: () => {
3197
+ },
3198
+ emit: () => !0
3199
+ };
3200
+ Ze(o), vt(), Qe();
3201
+ try {
3202
+ s();
3203
+ } catch (i) {
3204
+ try {
3205
+ const b = o?._hookCallbacks?.onError;
3206
+ if (Array.isArray(b))
3207
+ for (const g of b)
3208
+ try {
3209
+ g(i);
3210
+ } catch {
3211
+ }
3212
+ else if (typeof b == "function")
3213
+ try {
3214
+ b(i);
3215
+ } catch {
3216
+ }
3217
+ W(
3218
+ `Error during component discovery render <${r}>:`,
3219
+ i
3220
+ ), te(
3221
+ "Error occurred during initial component discovery render. Consider guarding expensive expressions or using lazy factories for directives like when()."
3222
+ );
3223
+ } catch {
3224
+ }
3225
+ throw i;
3226
+ } finally {
3227
+ Et(), Ye();
3228
+ }
3229
+ if (o._hookCallbacks?.props) {
3230
+ const i = o._hookCallbacks.props;
3231
+ c.props = Object.fromEntries(
3232
+ Object.entries(i).map(([f, b]) => [
3233
+ f,
3234
+ { type: typeof b == "boolean" ? Boolean : typeof b == "number" ? Number : typeof b == "string" ? String : Function, default: b }
3235
+ ])
3236
+ ), Te.set(r, c);
3237
+ }
3238
+ } catch {
3239
+ }
3240
+ typeof customElements < "u" && !customElements.get(r) && customElements.define(
3241
+ r,
3242
+ cn(r, c)
3243
+ );
3244
+ }
3245
+ }
3246
+ function ie(e, s = {}, t, r) {
3247
+ const n = r ?? s.key;
3248
+ return { tag: e, key: n, props: s, children: t };
3249
+ }
3250
+ function Ne(e) {
3251
+ return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
3252
+ }
3253
+ function fe(e) {
3254
+ return typeof e == "object" && e !== null && "tag" in e && !Ne(e);
3255
+ }
3256
+ function an(e, s) {
3257
+ return e.key != null ? e : { ...e, key: s };
3258
+ }
3259
+ function ln(e, s) {
3260
+ if (e == null) {
3261
+ te(
3262
+ `⚠️ Event handler for '@${s}' is ${e}. This will prevent the event from working. Use a function reference instead: @${s}="\${functionName}"`
3263
+ );
3264
+ return;
3265
+ }
3266
+ typeof e != "function" && te(
3267
+ `🚨 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.`
3268
+ ), e === void 0 && typeof e != "function" && te(
3269
+ `💡 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()}"`
3270
+ );
3271
+ }
3272
+ function fn(e, s = [], t = {}) {
3273
+ const r = {}, n = {}, c = {}, o = [], i = /([:@#]?)([a-zA-Z0-9-:.]+)(?:\s*=\s*("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)'|([^\s>]+)))?/g;
3274
+ let f;
3275
+ for (; f = i.exec(e); ) {
3276
+ const b = f[1], g = f[2];
3277
+ let h = "";
3278
+ for (let p = 3; p < f.length; p++)
3279
+ if (f[p] !== void 0) {
3280
+ h = f[p];
3281
+ break;
3282
+ }
3283
+ h.length >= 2 && (h[0] === '"' && h[h.length - 1] === '"' || h[0] === "'" && h[h.length - 1] === "'") && (h = h.slice(1, -1));
3284
+ const d = !/=/.test(f[0]), E = h.match(/^{{(\d+)}}$/), j = !E && /{{(\d+)}}/.test(h);
3285
+ let C = d ? !0 : E ? s[Number(E[1])] ?? null : j ? h.replace(
3286
+ /{{(\d+)}}/g,
3287
+ (p, L) => String(s[Number(L)] ?? "")
3288
+ ) : h;
3289
+ !E && !j && (C === "true" ? C = !0 : C === "false" ? C = !1 : C === "null" ? C = null : isNaN(Number(C)) || (C = Number(C)));
3290
+ const A = [
3291
+ "model",
3292
+ "bind",
3293
+ "show",
3294
+ "class",
3295
+ "style",
3296
+ "ref",
3297
+ "when"
3298
+ ];
3299
+ if (b === ":") {
3300
+ const [p, L] = g.split(":"), [a, ...k] = p.split(".");
3301
+ if (A.includes(a)) {
3302
+ const y = [...k], w = a === "model" && L ? `model:${L}` : a;
3303
+ c[w] = {
3304
+ value: C,
3305
+ modifiers: y,
3306
+ arg: L
3307
+ };
3308
+ } else if (g === "disabled") {
3309
+ let y = C;
3310
+ y && O(y) && (y = y.value);
3311
+ const w = typeof y;
3312
+ if (y === "" || w === "boolean" || w === "string" && (y === "true" || y === "false") || y == null || w === "number")
3313
+ r[g] = y;
3314
+ else {
3315
+ let m = C;
3316
+ m && O(m) && (m = m.value), n[g] = m;
3317
+ }
3318
+ o.push(g);
3319
+ } else {
3320
+ let y = C;
3321
+ y && O(y) && (y = y.value), n[g] = y, o.push(g);
3322
+ }
3323
+ } else if (b === "@") {
3324
+ const [p, ...L] = g.split("."), a = L;
3325
+ ln(C, p);
3326
+ const k = typeof C == "function" ? C : typeof t[C] == "function" ? t[C] : void 0;
3327
+ if (k) {
3328
+ const y = (S) => {
3329
+ if (a.includes("prevent") && S.preventDefault(), a.includes("stop") && S.stopPropagation(), !(a.includes("self") && S.target !== S.currentTarget))
3330
+ return a.includes("once") && S.currentTarget?.removeEventListener(
3331
+ p,
3332
+ y
3333
+ ), k(S);
3334
+ }, w = "on" + p.charAt(0).toUpperCase() + p.slice(1);
3335
+ r[w] = y;
3336
+ }
3337
+ } else g === "ref" ? r.ref = C : n[g] = C;
3338
+ }
3339
+ return { props: r, attrs: n, directives: c, bound: o };
3340
+ }
3341
+ function qe(e) {
3342
+ if (!fe(e) || Ne(e))
3343
+ return e;
3344
+ const s = e.props?.directives;
3345
+ if (s && s.when) {
3346
+ const t = s.when.value, r = O(t) ? t.value : t, n = { ...s };
3347
+ delete n.when;
3348
+ const c = { ...e.props };
3349
+ Object.keys(n).length > 0 ? c.directives = n : delete c.directives;
3350
+ const o = {
3351
+ ...e,
3352
+ props: c
3353
+ };
3354
+ return Array.isArray(o.children) && (o.children = o.children.map(
3355
+ (f) => typeof f == "object" && f !== null ? qe(f) : f
3356
+ )), {
3357
+ tag: "#anchor",
3358
+ key: e.key != null ? `when-${e.key}` : `when-${e.tag}`,
3359
+ children: r ? [o] : []
3360
+ };
3361
+ }
3362
+ if (Array.isArray(e.children)) {
3363
+ const t = e.children.map(
3364
+ (r) => typeof r == "object" && r !== null ? qe(r) : r
3365
+ );
3366
+ return {
3367
+ ...e,
3368
+ children: t
3369
+ };
3370
+ }
3371
+ return e;
3372
+ }
3373
+ function un(e, s, t) {
3374
+ const r = Le.length > 0 ? Le[Le.length - 1] : void 0, n = t ?? r, c = !t && s.length === 0, o = c ? e.join("<!--TEMPLATE_DELIM-->") : null;
3375
+ if (c && o) {
3376
+ const l = We.get(o);
3377
+ if (l) return l;
3378
+ }
3379
+ function i(l, v) {
3380
+ return ie("#text", {}, l, v);
3381
+ }
3382
+ function f(l, v, _ = !1) {
3383
+ let T = typeof l == "string" ? St(l) : l;
3384
+ return !_ && typeof T == "string" && /[\r\n]/.test(T) && (T = T.replace(/\s+/g, " ")), ie("#text", {}, T, v);
3385
+ }
3386
+ let b = "";
3387
+ for (let l = 0; l < e.length; l++)
3388
+ b += e[l], l < s.length && (b += `{{${l}}}`);
3389
+ const g = /<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, h = [];
3390
+ let d, E = [], j = null, C = {}, A, p = 0;
3391
+ const L = [], a = /* @__PURE__ */ new Set([
3392
+ "pre",
3393
+ "code",
3394
+ "textarea",
3395
+ "script",
3396
+ "style"
3397
+ ]);
3398
+ function k() {
3399
+ if (j && a.has(j.toLowerCase()))
3400
+ return !0;
3401
+ for (const l of h)
3402
+ if (a.has(l.tag.toLowerCase()))
3403
+ return !0;
3404
+ return !1;
3405
+ }
3406
+ function y(l) {
3407
+ if (!l || typeof l != "object" || Ne(l)) return;
3408
+ const v = l, _ = C;
3409
+ if (v.props || v.attrs) {
3410
+ const T = v;
3411
+ T.props && (_.props || (_.props = {}), Object.assign(_.props, T.props)), T.attrs && (_.attrs || (_.attrs = {}), Object.keys(T.attrs).forEach((N) => {
3412
+ if (N === "style" && _.attrs.style) {
3413
+ const $ = String(_.attrs.style).replace(/;?\s*$/, ""), x = String(T.attrs.style).replace(/^;?\s*/, "");
3414
+ _.attrs.style = $ + "; " + x;
3415
+ } else if (N === "class" && _.attrs.class) {
3416
+ const $ = String(_.attrs.class).trim().split(/\s+/).filter(Boolean), x = String(T.attrs.class).trim().split(/\s+/).filter(Boolean), M = [
3417
+ .../* @__PURE__ */ new Set([...$, ...x])
3418
+ ];
3419
+ _.attrs.class = M.join(" ");
3420
+ } else
3421
+ _.attrs[N] = T.attrs[N];
3422
+ }));
3423
+ } else
3424
+ _.props || (_.props = {}), Object.assign(_.props, v);
3425
+ }
3426
+ function w(l, v) {
3427
+ const _ = j ? E : L;
3428
+ if (Ne(l)) {
3429
+ const T = l.key ?? v, N = l.children;
3430
+ _.push({
3431
+ ...l,
3432
+ key: T,
3433
+ children: N
3434
+ });
3435
+ return;
3436
+ }
3437
+ if (fe(l)) {
3438
+ _.push(an(l, void 0));
3439
+ return;
3440
+ }
3441
+ if (Array.isArray(l)) {
3442
+ if (l.length === 0) return;
3443
+ for (let T = 0; T < l.length; T++) {
3444
+ const N = l[T];
3445
+ Ne(N) || fe(N) || Array.isArray(N) ? w(N, `${v}-${T}`) : N !== null && typeof N == "object" ? Xe(N) ? _.push(
3446
+ ie(
3447
+ "#raw",
3448
+ {},
3449
+ N.__rawHTML,
3450
+ `${v}-${T}`
3451
+ )
3452
+ ) : y(N) : _.push(i(String(N), `${v}-${T}`));
3453
+ }
3454
+ return;
3455
+ }
3456
+ if (l !== null && typeof l == "object") {
3457
+ if (Xe(l)) {
3458
+ const T = l.__rawHTML ?? "";
3459
+ _.push(ie("#raw", {}, T, v));
3460
+ return;
3461
+ }
3462
+ y(l);
3463
+ return;
3464
+ }
3465
+ _.push(i(String(l), v));
3466
+ }
3467
+ const S = /* @__PURE__ */ new Set([
3468
+ "area",
3469
+ "base",
3470
+ "br",
3471
+ "col",
3472
+ "embed",
3473
+ "hr",
3474
+ "img",
3475
+ "input",
3476
+ "link",
3477
+ "meta",
3478
+ "param",
3479
+ "source",
3480
+ "track",
3481
+ "wbr"
3482
+ ]);
3483
+ for (; d = g.exec(b); )
3484
+ if (!(d[0].startsWith("<!--") && d[0].endsWith("-->"))) {
3485
+ if (d[1]) {
3486
+ const l = d[1], v = d[0][1] === "/", _ = d[0][d[0].length - 2] === "/" || S.has(l), {
3487
+ props: T,
3488
+ attrs: N,
3489
+ directives: $,
3490
+ bound: x
3491
+ } = fn(
3492
+ d[2] || "",
3493
+ s,
3494
+ n ?? {}
3495
+ ), M = { props: {}, attrs: {} };
3496
+ for (const D in T) M.props[D] = T[D];
3497
+ for (const D in N) M.attrs[D] = N[D];
3498
+ M.attrs && Object.prototype.hasOwnProperty.call(M.attrs, "key") && !(M.props && Object.prototype.hasOwnProperty.call(M.props, "key")) && H(() => {
3499
+ M.props.key = M.attrs.key;
3500
+ });
3501
+ try {
3502
+ const D = {
3503
+ input: [
3504
+ "value",
3505
+ "checked",
3506
+ "readonly",
3507
+ "required",
3508
+ "placeholder",
3509
+ "maxlength",
3510
+ "minlength"
3511
+ ],
3512
+ textarea: [
3513
+ "value",
3514
+ "readonly",
3515
+ "required",
3516
+ "placeholder",
3517
+ "maxlength",
3518
+ "minlength"
3519
+ ],
3520
+ select: ["value", "required", "multiple"],
3521
+ option: ["selected", "value"],
3522
+ video: ["muted", "autoplay", "controls", "loop", "playsinline"],
3523
+ audio: ["muted", "autoplay", "controls", "loop"],
3524
+ img: ["src", "alt", "width", "height"],
3525
+ button: ["type", "name", "value", "autofocus", "form"]
3526
+ }, R = l.toLowerCase(), ee = D[R] ?? [];
3527
+ if (M.attrs) {
3528
+ for (const I of ee)
3529
+ if (x && x.includes(I) && I in M.attrs && !(M.props && I in M.props)) {
3530
+ let P = M.attrs[I];
3531
+ if (P && O(P))
3532
+ P = P.value, M.props[I] = P, delete M.attrs[I];
3533
+ else if (P && typeof P == "object" && "value" in P && !(P instanceof Node))
3534
+ try {
3535
+ const B = P.value;
3536
+ M.props[I] = (R === "select" || R === "option") && I === "value" ? String(B) : B, delete M.attrs[I];
3537
+ } catch {
3538
+ }
3539
+ else {
3540
+ const B = typeof P;
3541
+ if (I === "disabled")
3542
+ (P === "" || B === "boolean" || B === "string" && (P === "true" || P === "false") || P == null || B === "number") && (M.props[I] = P, delete M.attrs[I]);
3543
+ else if (P === "" || B === "string" || B === "number" || B === "boolean" || P == null) {
3544
+ const U = (R === "select" || R === "option") && I === "value" ? String(P) : P;
3545
+ M.props[I] = U, delete M.attrs[I];
3546
+ }
3547
+ }
3548
+ }
3549
+ }
3550
+ if (l.includes("-") || !!n?.__customElements?.has?.(l)) {
3551
+ if (M.isCustomElement = !0, x && M.attrs) {
3552
+ const I = /* @__PURE__ */ new Set(["id", "name", "data-key", "key"]);
3553
+ for (const P of x)
3554
+ if (P in M.attrs && !(M.props && P in M.props)) {
3555
+ const B = P.includes("-") ? Ve(P) : P, U = M.attrs[P];
3556
+ if (M.props[B] = U, I.has(P) || at(P))
3557
+ try {
3558
+ const oe = F(M.attrs[P]);
3559
+ oe === null ? delete M.attrs[P] : M.attrs[P] = oe;
3560
+ } catch {
3561
+ delete M.attrs[P];
3562
+ }
3563
+ else
3564
+ delete M.attrs[P];
3565
+ }
3566
+ }
3567
+ try {
3568
+ if (M.attrs && !(M.props && "modelValue" in M.props)) {
3569
+ const I = M.attrs["model-value"] ?? M.attrs.modelValue;
3570
+ typeof I < "u" && (M.props.modelValue = I);
3571
+ }
3572
+ } catch {
3573
+ }
3574
+ }
3575
+ } catch {
3576
+ }
3577
+ if ($ && Object.keys($).some(
3578
+ (D) => D === "model" || D.startsWith("model:")
3579
+ ))
3580
+ try {
3581
+ 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)));
3582
+ if (!!(l.includes("-") || I || ee))
3583
+ for (const U of Object.keys($)) {
3584
+ if (U !== "model" && !U.startsWith("model:")) continue;
3585
+ const pe = $[U], oe = pe.arg ?? (U.includes(":") ? U.split(":", 2)[1] : void 0), V = pe.value, Re = oe ?? "modelValue", Ge = z, yt = Ie, be = n?._state || n;
3586
+ let se;
3587
+ if (typeof V == "string" && be)
3588
+ se = Ge(
3589
+ be,
3590
+ V
3591
+ );
3592
+ else if (se = V, O(V))
3593
+ try {
3594
+ V.value;
3595
+ } catch {
3596
+ }
3597
+ M.props[Re] = se;
3598
+ try {
3599
+ const ce = X(Re);
3600
+ M.attrs || (M.attrs = {}), se != null && (typeof se == "string" || typeof se == "number" || typeof se == "boolean") && (M.attrs[ce] = se);
3601
+ } catch {
3602
+ }
3603
+ M.isCustomElement = !0;
3604
+ const Je = `update:${X(Re)}`.replace(
3605
+ /-([a-z])/g,
3606
+ (ce, ne) => ne.toUpperCase()
3607
+ ), mt = "on" + Je.charAt(0).toUpperCase() + Je.slice(1);
3608
+ M.props[mt] = function(ce) {
3609
+ const ne = ce.detail !== void 0 ? ce.detail : ce.target ? ce.target.value : void 0;
3610
+ if (be)
3611
+ if (V && O(V)) {
3612
+ const ae = V.value;
3613
+ if (Array.isArray(ne) && Array.isArray(ae) ? JSON.stringify([...ne].sort()) !== JSON.stringify([...ae].sort()) : ne !== ae) {
3614
+ V.value = ne;
3615
+ try {
3616
+ const le = n;
3617
+ if (le) {
3618
+ const ve = le.requestRender, Ee = le._requestRender;
3619
+ typeof ve == "function" ? ve() : typeof Ee == "function" && Ee();
3620
+ }
3621
+ } catch {
3622
+ }
3623
+ }
3624
+ } else {
3625
+ const ae = Ge(
3626
+ be || {},
3627
+ typeof V == "string" ? V : String(V)
3628
+ );
3629
+ if (Array.isArray(ne) && Array.isArray(ae) ? JSON.stringify([...ne].sort()) !== JSON.stringify([...ae].sort()) : ne !== ae) {
3630
+ yt(
3631
+ be || {},
3632
+ typeof V == "string" ? V : String(V),
3633
+ ne
3634
+ );
3635
+ try {
3636
+ const le = n;
3637
+ if (le) {
3638
+ const ve = le.requestRender, Ee = le._requestRender;
3639
+ typeof ve == "function" ? ve() : typeof Ee == "function" && Ee();
3640
+ }
3641
+ } catch {
3642
+ }
3643
+ }
3644
+ }
3645
+ }, delete $[U];
3646
+ }
3647
+ } catch {
3648
+ }
3649
+ if (Object.keys($).length > 0 && (M.directives = { ...$ }), v) {
3650
+ const D = E.some(
3651
+ (I) => typeof I == "object" && I.tag !== "#text"
3652
+ );
3653
+ let R = E;
3654
+ if (D && E.length > 0) {
3655
+ let I = 0;
3656
+ for (; I < E.length; ) {
3657
+ const B = E[I];
3658
+ if (!fe(B) || B.tag !== "#text" || typeof B.children != "string" || B.children.trim() !== "")
3659
+ break;
3660
+ I++;
3661
+ }
3662
+ let P = E.length - 1;
3663
+ for (; P >= 0; ) {
3664
+ const B = E[P];
3665
+ if (!fe(B) || B.tag !== "#text" || typeof B.children != "string" || B.children.trim() !== "")
3666
+ break;
3667
+ P--;
3668
+ }
3669
+ I === 0 && P === E.length - 1 ? R = E : I > P ? R = [] : R = E.slice(I, P + 1);
3670
+ }
3671
+ const ee = ie(
3672
+ j,
3673
+ C,
3674
+ R.length === 1 && fe(R[0]) && R[0].tag === "#text" ? typeof R[0].children == "string" ? R[0].children : "" : R.length ? R : void 0,
3675
+ A
3676
+ ), q = h.pop();
3677
+ q ? (j = q.tag, C = q.props, A = q.key, E = q.children, E.push(ee)) : (L.push(ee), j = null, C = {}, A = void 0, E = []);
3678
+ } else _ ? j ? E.push(ie(l, M, void 0, void 0)) : L.push(ie(l, M, void 0, void 0)) : (j && h.push({
3679
+ tag: j,
3680
+ props: C,
3681
+ children: E,
3682
+ key: A
3683
+ }), j = l, C = M, E = []);
3684
+ } else if (typeof d[3] < "u") {
3685
+ const l = Number(d[3]), v = s[l], _ = `interp-${l}`;
3686
+ w(v, _);
3687
+ } else if (d[4]) {
3688
+ const l = d[4], v = j ? E : L, _ = l.split(/({{\d+}})/);
3689
+ for (const T of _) {
3690
+ if (!T) continue;
3691
+ const N = T.match(/^{{(\d+)}}$/);
3692
+ if (N) {
3693
+ const $ = Number(N[1]), x = s[$], M = `interp-${$}`;
3694
+ w(x, M);
3695
+ } else {
3696
+ const $ = `text-${p++}`, x = k();
3697
+ v.push(f(T, $, x));
3698
+ }
3699
+ }
3700
+ }
3701
+ }
3702
+ const m = L.filter((l) => fe(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0).map(
3703
+ (l) => qe(l)
3704
+ );
3705
+ if (m.length === 1) {
3706
+ const l = m[0];
3707
+ return c && o && We.set(o, l), l;
3708
+ } else if (m.length > 1) {
3709
+ const l = m;
3710
+ return c && o && We.set(o, l), l;
3711
+ }
3712
+ return ie("div", {}, "", "fallback-root");
3713
+ }
3714
+ function En(e, ...s) {
3715
+ if (Ct()) return [];
3716
+ const t = s[s.length - 1], r = typeof t == "object" && t && !Array.isArray(t) ? t : void 0;
3717
+ return un(e, s, r);
3718
+ }
3719
+ export {
3720
+ vn as c,
3721
+ En as h,
3722
+ Xt as v
3723
+ };
3724
+ //# sourceMappingURL=template-compiler-ZhSg1yPh.js.map