@jasonshimmy/custom-elements-runtime 2.5.1 → 2.5.5

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