@jasonshimmy/custom-elements-runtime 2.8.1 → 3.0.0

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