@jasonshimmy/custom-elements-runtime 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- function vt(e, t) {
2
- return pe(e ? t : [], "when-block");
1
+ function we(e, t) {
2
+ return O(e ? t : [], "when-block");
3
3
  }
4
- function kt(e, t) {
4
+ function Ot(e, t) {
5
5
  return e.map((r, i) => {
6
6
  const n = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${i}` : String(r);
7
- return pe(t(r, i), `each-${n}`);
7
+ return O(t(r, i), `each-${n}`);
8
8
  });
9
9
  }
10
- function ze() {
10
+ function Ke() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function ze() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return He(...e);
20
+ return Je(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function He(...e) {
24
+ function Je(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, i] = e[t];
27
- if (r) return [pe(i, `whenChain-branch-${t}`)];
27
+ if (r) return [O(i, `whenChain-branch-${t}`)];
28
28
  }
29
- return [pe([], "whenChain-empty")];
29
+ return [O([], "whenChain-empty")];
30
30
  }
31
- function pe(e, t) {
31
+ function O(e, t) {
32
32
  const r = e ? Array.isArray(e) ? e.filter(Boolean) : [e].filter(Boolean) : [];
33
33
  return {
34
34
  tag: "#anchor",
@@ -36,7 +36,131 @@ function pe(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class X extends EventTarget {
39
+ function Pt(e, t) {
40
+ return we(!e, t);
41
+ }
42
+ function Mt(e, t) {
43
+ const r = !e || e.length === 0;
44
+ return we(r, t);
45
+ }
46
+ function Bt(e, t) {
47
+ const r = !!(e && e.length > 0);
48
+ return we(r, t);
49
+ }
50
+ function Wt(e, t, r) {
51
+ const i = [];
52
+ return e.forEach((n, s) => {
53
+ t(n, s) && i.push({ item: n, originalIndex: s });
54
+ }), i.map(({ item: n, originalIndex: s }, o) => {
55
+ const a = typeof n == "object" && n != null ? n?.key ?? n?.id ?? `filtered-${s}` : `filtered-${s}`;
56
+ return O(r(n, s, o), `each-where-${a}`);
57
+ });
58
+ }
59
+ function It(e, t) {
60
+ const r = e?.length ?? 0;
61
+ return r === 0 && t.empty ? O(t.empty, "switch-length-empty") : r === 1 && t.one ? O(t.one(e[0]), "switch-length-one") : t.exactly?.[r] ? O(t.exactly[r](e), `switch-length-${r}`) : r > 1 && t.many ? O(t.many(e), "switch-length-many") : O([], "switch-length-fallback");
62
+ }
63
+ function qt(e, t, r) {
64
+ const i = /* @__PURE__ */ new Map();
65
+ return e.forEach((n) => {
66
+ const s = t(n);
67
+ i.has(s) || i.set(s, []), i.get(s).push(n);
68
+ }), Array.from(i.entries()).map(([n, s], o) => O(
69
+ r(n, s, o),
70
+ `each-group-${n}`
71
+ ));
72
+ }
73
+ function zt(e, t, r, i) {
74
+ const n = r * t, s = Math.min(n + t, e.length);
75
+ return e.slice(n, s).map((a, c) => {
76
+ const u = n + c, m = typeof a == "object" && a != null ? a?.key ?? a?.id ?? `page-${u}` : `page-${u}`;
77
+ return O(i(a, u, c), `each-page-${m}`);
78
+ });
79
+ }
80
+ function Ht(e, t) {
81
+ return e.loading && t.loading ? O(t.loading, "promise-loading") : e.error && t.error ? O(t.error(e.error), "promise-error") : e.data !== void 0 && t.success ? O(t.success(e.data), "promise-success") : t.idle ? O(t.idle, "promise-idle") : O([], "promise-fallback");
82
+ }
83
+ function q(e, t) {
84
+ const r = typeof window < "u" && window.matchMedia?.(e)?.matches;
85
+ return we(!!r, t);
86
+ }
87
+ const G = {
88
+ // Responsive breakpoints (matching style.ts)
89
+ sm: "(min-width:640px)",
90
+ md: "(min-width:768px)",
91
+ lg: "(min-width:1024px)",
92
+ xl: "(min-width:1280px)",
93
+ "2xl": "(min-width:1536px)",
94
+ // Dark mode (matching style.ts)
95
+ dark: "(prefers-color-scheme: dark)"
96
+ }, ze = ["sm", "md", "lg", "xl", "2xl"], Ve = {
97
+ // Breakpoint-based rendering (matching style.ts exactly)
98
+ sm: (e) => q(G.sm, e),
99
+ md: (e) => q(G.md, e),
100
+ lg: (e) => q(G.lg, e),
101
+ xl: (e) => q(G.xl, e),
102
+ "2xl": (e) => q(G["2xl"], e),
103
+ // Dark mode (matching style.ts)
104
+ dark: (e) => q(G.dark, e),
105
+ light: (e) => q("(prefers-color-scheme: light)", e),
106
+ // Accessibility and interaction preferences
107
+ touch: (e) => q("(hover: none) and (pointer: coarse)", e),
108
+ mouse: (e) => q("(hover: hover) and (pointer: fine)", e),
109
+ reducedMotion: (e) => q("(prefers-reduced-motion: reduce)", e),
110
+ highContrast: (e) => q("(prefers-contrast: high)", e),
111
+ // Orientation
112
+ portrait: (e) => q("(orientation: portrait)", e),
113
+ landscape: (e) => q("(orientation: landscape)", e)
114
+ };
115
+ function Nt(e, t) {
116
+ const r = [];
117
+ e.includes("dark") ? r.push(G.dark) : e.includes("light") && r.push("(prefers-color-scheme: light)");
118
+ const i = e.filter(
119
+ (o) => ze.includes(o)
120
+ ), n = i[i.length - 1];
121
+ n && n in G && r.push(G[n]);
122
+ const s = r.length > 0 ? r.join(" and ") : "all";
123
+ return q(s, t);
124
+ }
125
+ function Dt(e) {
126
+ const t = [];
127
+ return e.base && t.push(O(e.base, "responsive-base")), ze.forEach((r) => {
128
+ const i = e[r];
129
+ i && t.push(Ve[r](i));
130
+ }), t;
131
+ }
132
+ function Ut(e) {
133
+ const t = [];
134
+ let r = null;
135
+ return {
136
+ case(i, n) {
137
+ const s = typeof i == "function" ? i : (o) => o === i;
138
+ return t.push({ condition: s, content: n }), this;
139
+ },
140
+ when(i, n) {
141
+ return t.push({ condition: i, content: n }), this;
142
+ },
143
+ otherwise(i) {
144
+ return r = i, this;
145
+ },
146
+ done() {
147
+ for (let i = 0; i < t.length; i++) {
148
+ const { condition: n, content: s } = t[i];
149
+ if (n(e))
150
+ return O(s, `switch-case-${i}`);
151
+ }
152
+ return O(r || [], "switch-otherwise");
153
+ }
154
+ };
155
+ }
156
+ const He = typeof process < "u" && process.env?.NODE_ENV !== "production";
157
+ function Y(e, ...t) {
158
+ He && console.error(e, ...t);
159
+ }
160
+ function pe(e, ...t) {
161
+ He && console.warn(e, ...t);
162
+ }
163
+ class ne extends EventTarget {
40
164
  handlers = {};
41
165
  static instance;
42
166
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +168,7 @@ class X extends EventTarget {
44
168
  * Returns the singleton instance of GlobalEventBus
45
169
  */
46
170
  static getInstance() {
47
- return X.instance || (X.instance = new X()), X.instance;
171
+ return ne.instance || (ne.instance = new ne()), ne.instance;
48
172
  }
49
173
  /**
50
174
  * Emit a global event with optional data. Includes event storm protection.
@@ -63,12 +187,12 @@ class X extends EventTarget {
63
187
  // Global events don't need to bubble
64
188
  cancelable: !0
65
189
  }));
66
- const o = this.handlers[t];
67
- o && o.forEach((s) => {
190
+ const s = this.handlers[t];
191
+ s && s.forEach((o) => {
68
192
  try {
69
- s(r);
193
+ o(r);
70
194
  } catch (a) {
71
- console.error(`Error in global event handler for "${t}":`, a);
195
+ Y(`Error in global event handler for "${t}":`, a);
72
196
  }
73
197
  });
74
198
  }
@@ -112,8 +236,8 @@ class X extends EventTarget {
112
236
  */
113
237
  once(t, r) {
114
238
  return new Promise((i) => {
115
- const n = this.on(t, (o) => {
116
- n(), r(o), i(o);
239
+ const n = this.on(t, (s) => {
240
+ n(), r(s), i(s);
117
241
  });
118
242
  });
119
243
  }
@@ -157,8 +281,8 @@ class X extends EventTarget {
157
281
  this.eventCounters.clear();
158
282
  }
159
283
  }
160
- const ie = X.getInstance(), _t = (e, t) => ie.emit(e, t), $t = (e, t) => ie.on(e, t), St = (e, t) => ie.off(e, t), Et = (e, t) => ie.once(e, t), Ct = (e, t, r) => ie.listen(e, t, r);
161
- function $e(e) {
284
+ const le = ne.getInstance(), Ft = (e, t) => le.emit(e, t), Kt = (e, t) => le.on(e, t), Jt = (e, t) => le.off(e, t), Vt = (e, t) => le.once(e, t), Gt = (e, t, r) => le.listen(e, t, r);
285
+ function Le(e) {
162
286
  let t = { ...e };
163
287
  const r = [];
164
288
  function i(a) {
@@ -167,19 +291,19 @@ function $e(e) {
167
291
  function n() {
168
292
  return t;
169
293
  }
170
- function o(a) {
171
- const f = typeof a == "function" ? a(t) : a;
172
- t = { ...t, ...f }, s();
294
+ function s(a) {
295
+ const c = typeof a == "function" ? a(t) : a;
296
+ t = { ...t, ...c }, o();
173
297
  }
174
- function s() {
298
+ function o() {
175
299
  r.forEach((a) => a(t));
176
300
  }
177
- return { subscribe: i, getState: n, setState: o };
301
+ return { subscribe: i, getState: n, setState: s };
178
302
  }
179
- function Y(e) {
303
+ function Q(e) {
180
304
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
181
305
  }
182
- function J(e) {
306
+ function Z(e) {
183
307
  return typeof e == "string" ? e.replace(
184
308
  /[&<>"']/g,
185
309
  (t) => ({
@@ -191,248 +315,342 @@ function J(e) {
191
315
  })[t]
192
316
  ) : e;
193
317
  }
194
- function W(e, t) {
318
+ function K(e, t) {
195
319
  return typeof t == "string" ? t.split(".").reduce((r, i) => r?.[i], e) : t;
196
320
  }
197
- function ce(e, t, r) {
321
+ function he(e, t, r) {
198
322
  const i = String(t).split("."), n = i.pop();
199
323
  if (!n) return;
200
- const o = i.reduce((s, a) => (s[a] == null && (s[a] = {}), s[a]), e);
201
- o[n] = r;
324
+ const s = i.reduce((o, a) => (o[a] == null && (o[a] = {}), o[a]), e);
325
+ s[n] = r;
202
326
  }
203
- function qe(e, t, r) {
327
+ function Ge(e, t, r) {
204
328
  if (r)
205
329
  for (const [i, n] of Object.entries(r)) {
206
- let o, s = {};
207
- if (Array.isArray(n) ? (o = n[0], s = n[1] || {}) : o = n, t.set(i, {
208
- callback: o,
209
- options: s,
210
- oldValue: W(e, i)
211
- }), s.immediate)
330
+ let s, o = {};
331
+ if (Array.isArray(n) ? (s = n[0], o = n[1] || {}) : s = n, t.set(i, {
332
+ callback: s,
333
+ options: o,
334
+ oldValue: K(e, i)
335
+ }), o.immediate)
212
336
  try {
213
- const a = W(e, i);
214
- o(a, void 0, e);
337
+ const a = K(e, i);
338
+ s(a, void 0, e);
215
339
  } catch (a) {
216
- console.error(`Error in immediate watcher for "${i}":`, a);
340
+ Y(`Error in immediate watcher for "${i}":`, a);
217
341
  }
218
342
  }
219
343
  }
220
- function Ie(e, t, r, i) {
221
- const n = (s, a) => {
222
- if (s === a) return !0;
223
- if (typeof s != typeof a || typeof s != "object" || s === null || a === null) return !1;
224
- if (Array.isArray(s) && Array.isArray(a))
225
- return s.length !== a.length ? !1 : s.every((h, C) => n(h, a[C]));
226
- const f = Object.keys(s), p = Object.keys(a);
227
- return f.length !== p.length ? !1 : f.every((h) => n(s[h], a[h]));
228
- }, o = t.get(r);
229
- if (o && !n(i, o.oldValue))
344
+ function Ze(e, t, r, i) {
345
+ const n = (o, a) => {
346
+ if (o === a) return !0;
347
+ if (typeof o != typeof a || typeof o != "object" || o === null || a === null) return !1;
348
+ if (Array.isArray(o) && Array.isArray(a))
349
+ return o.length !== a.length ? !1 : o.every((m, T) => n(m, a[T]));
350
+ const c = Object.keys(o), u = Object.keys(a);
351
+ return c.length !== u.length ? !1 : c.every((m) => n(o[m], a[m]));
352
+ }, s = t.get(r);
353
+ if (s && !n(i, s.oldValue))
230
354
  try {
231
- o.callback(i, o.oldValue, e), o.oldValue = i;
232
- } catch (s) {
233
- console.error(`Error in watcher for "${r}":`, s);
355
+ s.callback(i, s.oldValue, e), s.oldValue = i;
356
+ } catch (o) {
357
+ Y(`Error in watcher for "${r}":`, o);
234
358
  }
235
- for (const [s, a] of t.entries())
236
- if (a.options.deep && r.startsWith(s + "."))
359
+ for (const [o, a] of t.entries())
360
+ if (a.options.deep && r.startsWith(o + "."))
237
361
  try {
238
- const f = W(e, s);
239
- n(f, a.oldValue) || (a.callback(f, a.oldValue, e), a.oldValue = f);
240
- } catch (f) {
241
- console.error(`Error in deep watcher for "${s}":`, f);
362
+ const c = K(e, o);
363
+ n(c, a.oldValue) || (a.callback(c, a.oldValue, e), a.oldValue = c);
364
+ } catch (c) {
365
+ Y(`Error in deep watcher for "${o}":`, c);
242
366
  }
243
367
  }
244
- function Ne(e, t, r) {
368
+ function Ye(e, t, r) {
245
369
  if (!t.props) return;
246
- function i(n, o) {
247
- return o === Boolean ? n === "true" : o === Number ? Number(n) : n;
370
+ function i(n, s) {
371
+ return s === Boolean ? n === "true" : s === Number ? Number(n) : n;
248
372
  }
249
- Object.entries(t.props).forEach(([n, o]) => {
250
- if (o.type === Function && typeof e[n] == "function")
373
+ Object.entries(t.props).forEach(([n, s]) => {
374
+ if (s.type === Function && typeof e[n] == "function")
251
375
  r[n] = e[n];
252
376
  else {
253
- const s = Y(n), a = e.getAttribute(s);
377
+ const o = Q(n), a = e.getAttribute(o);
254
378
  if (typeof e[n] < "u")
255
379
  try {
256
- r[n] = J(i(e[n], o.type));
380
+ const c = e[n];
381
+ s.type === Boolean && typeof c == "boolean" || s.type === Number && typeof c == "number" || s.type === Function && typeof c == "function" ? r[n] = c : r[n] = Z(i(String(c), s.type));
257
382
  } catch {
258
383
  r[n] = e[n];
259
384
  }
260
- else a !== null ? r[n] = J(i(a, o.type)) : "default" in o && o.default !== void 0 && (r[n] = J(o.default));
385
+ else a !== null ? r[n] = Z(i(a, s.type)) : "default" in s && s.default !== void 0 && (r[n] = Z(s.default));
261
386
  }
262
387
  });
263
388
  }
264
- function We(e, t, r, i) {
389
+ function Qe(e, t, r, i) {
265
390
  e.onConnected && !r && (e.onConnected(t), i(!0));
266
391
  }
267
- function De(e, t, r, i, n, o, s, a) {
268
- e.onDisconnected && e.onDisconnected(t), r.forEach((f) => f()), i(), n(), o(!1), s(null), a(!1);
392
+ function Xe(e, t, r, i, n, s, o, a) {
393
+ e.onDisconnected && e.onDisconnected(t), r.forEach((c) => c()), i(), n(), s(!1), o(null), a(!1);
269
394
  }
270
- function Ue(e, t, r, i, n) {
395
+ function et(e, t, r, i, n) {
271
396
  e.onAttributeChanged && e.onAttributeChanged(t, r, i, n);
272
397
  }
273
- function V(e, t) {
398
+ function te(e, t) {
274
399
  if (t && e instanceof HTMLElement) {
275
400
  for (const r in t)
276
401
  t[r] === e && delete t[r];
277
402
  for (const r of Array.from(e.childNodes))
278
- V(r, t);
279
- }
280
- }
281
- function Fe(e, t, r, i, n, o, s, a) {
282
- if (!o) return;
283
- const f = t.includes("lazy"), p = t.includes("trim"), h = t.includes("number"), C = () => W(o._state || o, e), u = C();
284
- let c = "text";
285
- s instanceof HTMLInputElement ? c = i?.type || s.type || "text" : s instanceof HTMLSelectElement ? c = "select" : s instanceof HTMLTextAreaElement && (c = "textarea");
286
- const w = s instanceof HTMLInputElement || s instanceof HTMLTextAreaElement || s instanceof HTMLSelectElement, d = w ? c === "checkbox" || c === "radio" ? "checked" : "value" : a ?? "modelValue";
287
- if (c === "checkbox")
288
- if (Array.isArray(u))
289
- r[d] = u.includes(String(s?.getAttribute("value") ?? i?.value ?? ""));
403
+ te(r, t);
404
+ }
405
+ }
406
+ function tt(e, t, r, i, n, s, o, a) {
407
+ if (!s) return;
408
+ const c = t.includes("lazy"), u = t.includes("trim"), m = t.includes("number"), T = () => K(s._state || s, e), p = T();
409
+ let l = "text";
410
+ o instanceof HTMLInputElement ? l = i?.type || o.type || "text" : o instanceof HTMLSelectElement ? l = "select" : o instanceof HTMLTextAreaElement && (l = "textarea");
411
+ const w = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement, d = w ? l === "checkbox" || l === "radio" ? "checked" : "value" : a ?? "modelValue";
412
+ if (l === "checkbox")
413
+ if (Array.isArray(p))
414
+ r[d] = p.includes(String(o?.getAttribute("value") ?? i?.value ?? ""));
290
415
  else {
291
- const x = s?.getAttribute("true-value") ?? !0;
292
- r[d] = u === x;
293
- }
294
- else if (c === "radio")
295
- r[d] = u === (i?.value ?? "");
296
- else if (c === "select")
297
- if (s && s.hasAttribute("multiple") && s instanceof HTMLSelectElement) {
298
- const x = Array.isArray(u) ? u.map(String) : [];
416
+ const x = o?.getAttribute("true-value") ?? !0;
417
+ r[d] = p === x;
418
+ }
419
+ else if (l === "radio")
420
+ r[d] = p === (i?.value ?? "");
421
+ else if (l === "select")
422
+ if (o && o.hasAttribute("multiple") && o instanceof HTMLSelectElement) {
423
+ const x = Array.isArray(p) ? p.map(String) : [];
299
424
  setTimeout(() => {
300
- Array.from(s.options).forEach((l) => {
301
- l.selected = x.includes(l.value);
425
+ Array.from(o.options).forEach((f) => {
426
+ f.selected = x.includes(f.value);
302
427
  });
303
- }, 0), r[d] = Array.isArray(u) ? u : [];
428
+ }, 0), r[d] = Array.isArray(p) ? p : [];
304
429
  } else
305
- r[d] = u;
430
+ r[d] = p;
306
431
  else {
307
- r[d] = u;
432
+ r[d] = p;
308
433
  try {
309
- const x = Y(d);
310
- i && (i[x] = u);
434
+ const x = Q(d);
435
+ i && (i[x] = p);
311
436
  } catch {
312
437
  }
313
438
  }
314
- const g = f || c === "checkbox" || c === "radio" || c === "select" ? "change" : "input", m = (x) => {
315
- if (x.isComposing || n._isComposing || x.isTrusted === !1) return;
316
- const l = x.target;
317
- if (!l || l._modelUpdating) return;
318
- let b = l.value;
319
- if (c === "checkbox") {
320
- const S = C();
321
- if (Array.isArray(S)) {
322
- const A = l.getAttribute("value") ?? "", $ = Array.from(S);
323
- if (l.checked)
324
- $.includes(A) || $.push(A);
439
+ const g = c || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", y = (x) => {
440
+ if (x.isComposing || n._isComposing) return;
441
+ const f = typeof globalThis.process < "u" && globalThis.process.env?.NODE_ENV === "test" || typeof window < "u" && window.__vitest__;
442
+ if (x.isTrusted === !1 && !f) return;
443
+ const b = x.target;
444
+ if (!b || b._modelUpdating) return;
445
+ let h = b.value;
446
+ if (l === "checkbox") {
447
+ const E = T();
448
+ if (Array.isArray(E)) {
449
+ const C = b.getAttribute("value") ?? "", A = Array.from(E);
450
+ if (b.checked)
451
+ A.includes(C) || A.push(C);
325
452
  else {
326
- const T = $.indexOf(A);
327
- T > -1 && $.splice(T, 1);
453
+ const P = A.indexOf(C);
454
+ P > -1 && A.splice(P, 1);
328
455
  }
329
- b = $;
456
+ h = A;
330
457
  } else {
331
- const A = l.getAttribute("true-value") ?? !0, $ = l.getAttribute("false-value") ?? !1;
332
- b = l.checked ? A : $;
458
+ const C = b.getAttribute("true-value") ?? !0, A = b.getAttribute("false-value") ?? !1;
459
+ h = b.checked ? C : A;
333
460
  }
334
- } else if (c === "radio")
335
- b = l.getAttribute("value") ?? l.value;
336
- else if (c === "select" && l.multiple)
337
- b = Array.from(l.selectedOptions).map((S) => S.value);
338
- else if (p && typeof b == "string" && (b = b.trim()), h) {
339
- const S = Number(b);
340
- isNaN(S) || (b = S);
341
- }
342
- const y = o._state || o, _ = W(y, e);
343
- if (Array.isArray(b) && Array.isArray(_) ? JSON.stringify([...b].sort()) !== JSON.stringify([..._].sort()) : b !== _) {
344
- l._modelUpdating = !0;
461
+ } else if (l === "radio")
462
+ h = b.getAttribute("value") ?? b.value;
463
+ else if (l === "select" && b.multiple)
464
+ h = Array.from(b.selectedOptions).map((E) => E.value);
465
+ else if (u && typeof h == "string" && (h = h.trim()), m) {
466
+ const E = Number(h);
467
+ isNaN(E) || (h = E);
468
+ }
469
+ const _ = s._state || s, $ = K(_, e);
470
+ if (Array.isArray(h) && Array.isArray($) ? JSON.stringify([...h].sort()) !== JSON.stringify([...$].sort()) : h !== $) {
471
+ b._modelUpdating = !0;
345
472
  try {
346
- ce(y, e, b), o._requestRender && o._requestRender();
473
+ if (he(_, e, h), s._requestRender && s._requestRender(), s._triggerWatchers && s._triggerWatchers(e, h), b) {
474
+ const E = `update:${Q(d)}`, C = new CustomEvent(E, {
475
+ detail: h,
476
+ bubbles: !0,
477
+ composed: !0
478
+ });
479
+ b.dispatchEvent(C);
480
+ }
347
481
  } finally {
348
- setTimeout(() => l._modelUpdating = !1, 0);
482
+ setTimeout(() => b._modelUpdating = !1, 0);
349
483
  }
350
484
  }
351
485
  };
352
- w ? n[g] = m : n[`update:${Y(d)}`] = (x) => {
353
- const l = o._state || o, b = x.detail !== void 0 ? x.detail : x.target?.value, y = W(l, e);
354
- (Array.isArray(b) && Array.isArray(y) ? JSON.stringify([...b].sort()) !== JSON.stringify([...y].sort()) : b !== y) && (ce(l, e, b), o._requestRender && o._requestRender());
355
- }, (c === "text" || c === "textarea") && (n.compositionstart = (() => n._isComposing = !0), n.compositionend = (x) => {
486
+ if (w) {
487
+ if (n[g]) {
488
+ const x = n[g];
489
+ o && o.removeEventListener(g, x);
490
+ }
491
+ n[g] = y;
492
+ } else {
493
+ const x = `update:${Q(d)}`;
494
+ if (n[x]) {
495
+ const f = n[x];
496
+ o && o.removeEventListener(x, f);
497
+ }
498
+ n[x] = (f) => {
499
+ const b = s._state || s, h = f.detail !== void 0 ? f.detail : f.target?.value, _ = K(b, e);
500
+ if (Array.isArray(h) && Array.isArray(_) ? JSON.stringify([...h].sort()) !== JSON.stringify([..._].sort()) : h !== _) {
501
+ he(b, e, h), s._requestRender && s._requestRender(), s._triggerWatchers && s._triggerWatchers(e, h);
502
+ const S = f.target;
503
+ if (S) {
504
+ S[d] = h;
505
+ try {
506
+ const E = Q(d);
507
+ typeof h == "boolean" ? h ? S.setAttribute(E, "true") : S.setAttribute(E, "false") : S.setAttribute(E, String(h));
508
+ } catch {
509
+ }
510
+ queueMicrotask(() => {
511
+ typeof S._applyProps == "function" && S._applyProps(S._cfg), typeof S._requestRender == "function" && S._requestRender();
512
+ });
513
+ }
514
+ }
515
+ };
516
+ }
517
+ (l === "text" || l === "textarea") && (n.compositionstart = (() => n._isComposing = !0), n.compositionend = (x) => {
356
518
  n._isComposing = !1;
357
- const l = x.target;
358
- l && setTimeout(() => {
359
- const b = l.value, y = o._state || o, _ = W(y, e);
360
- let E = b;
361
- if (p && (E = E.trim()), h) {
362
- const A = Number(E);
363
- isNaN(A) || (E = A);
519
+ const f = x.target;
520
+ f && setTimeout(() => {
521
+ const b = f.value, h = s._state || s, _ = K(h, e);
522
+ let $ = b;
523
+ if (u && ($ = $.trim()), m) {
524
+ const E = Number($);
525
+ isNaN(E) || ($ = E);
364
526
  }
365
- if (Array.isArray(E) && Array.isArray(_) ? JSON.stringify([...E].sort()) !== JSON.stringify([..._].sort()) : E !== _) {
366
- l._modelUpdating = !0;
527
+ if (Array.isArray($) && Array.isArray(_) ? JSON.stringify([...$].sort()) !== JSON.stringify([..._].sort()) : $ !== _) {
528
+ f._modelUpdating = !0;
367
529
  try {
368
- ce(y, e, E), o._requestRender && o._requestRender();
530
+ he(h, e, $), s._requestRender && s._requestRender(), s._triggerWatchers && s._triggerWatchers(e, $);
369
531
  } finally {
370
- setTimeout(() => l._modelUpdating = !1, 0);
532
+ setTimeout(() => f._modelUpdating = !1, 0);
371
533
  }
372
534
  }
373
535
  }, 0);
374
536
  });
375
537
  }
376
- function Me(e) {
538
+ function Ne(e) {
377
539
  const t = e.slice(2);
378
540
  return t ? t.charAt(0).toLowerCase() + t.slice(1) : "";
379
541
  }
380
- function Ke(e, t, r, i) {
381
- if (i) {
382
- if (typeof e == "object" && e !== null)
383
- for (const [n, o] of Object.entries(e))
384
- t[n] = o;
385
- else if (typeof e == "string")
386
- try {
387
- const n = JSON.parse(e);
388
- if (typeof n == "object" && n !== null) {
389
- for (const [o, s] of Object.entries(n))
390
- t[o] = s;
391
- return;
392
- }
393
- } catch {
394
- const n = W(i, e);
542
+ function rt(e, t, r, i) {
543
+ if (typeof e == "object" && e !== null)
544
+ for (const [n, s] of Object.entries(e))
545
+ n.startsWith("data-") || n.startsWith("aria-") || n === "class" ? r[n] = s : t[n] = s;
546
+ else if (typeof e == "string") {
547
+ if (!i) return;
548
+ try {
549
+ const n = xe(e, i);
550
+ if (typeof n == "object" && n !== null) {
551
+ for (const [s, o] of Object.entries(n))
552
+ s.startsWith("data-") || s.startsWith("aria-") || s === "class" ? r[s] = o : t[s] = o;
553
+ return;
554
+ } else {
395
555
  r[e] = n;
556
+ return;
396
557
  }
558
+ } catch {
559
+ const n = K(i, e);
560
+ r[e] = n;
561
+ }
397
562
  }
398
563
  }
399
- function Je(e, t, r) {
400
- if (!r) return;
401
- const i = W(r, e), n = t.style || "", o = i ? "" : "none";
402
- if (n) {
403
- const s = n.split(";").filter(Boolean), a = s.findIndex(
404
- (f) => f.trim().startsWith("display:")
564
+ function nt(e, t, r) {
565
+ let i;
566
+ if (typeof e == "string") {
567
+ if (!r) return;
568
+ i = xe(e, r);
569
+ } else
570
+ i = e;
571
+ const n = t.style || "";
572
+ let s = n;
573
+ if (i) {
574
+ if (n) {
575
+ const o = n.split(";").map((c) => c.trim()).filter(Boolean), a = o.findIndex(
576
+ (c) => c.startsWith("display:")
577
+ );
578
+ a >= 0 && o[a] === "display: none" && (o.splice(a, 1), s = o.length > 0 ? o.join("; ") + ";" : "");
579
+ }
580
+ } else if (n) {
581
+ const o = n.split(";").filter(Boolean), a = o.findIndex(
582
+ (c) => c.trim().startsWith("display:")
405
583
  );
406
- a >= 0 ? s[a] = `display: ${o}` : s.push(`display: ${o}`), t.style = s.join("; ");
584
+ a >= 0 ? o[a] = "display: none" : o.push("display: none"), s = o.join("; ");
407
585
  } else
408
- t.style = `display: ${o}`;
586
+ s = "display: none";
587
+ s !== n && (s ? t.style = s : delete t.style);
588
+ }
589
+ function xe(e, t) {
590
+ if ([
591
+ /constructor/i,
592
+ /prototype/i,
593
+ /__proto__/i,
594
+ /function/i,
595
+ /eval/i,
596
+ /import/i,
597
+ /require/i,
598
+ /window/i,
599
+ /document/i,
600
+ /global/i,
601
+ /process/i
602
+ ].some((i) => i.test(e))) {
603
+ pe("Potentially dangerous expression blocked:", e);
604
+ return;
605
+ }
606
+ if (e.trim().startsWith("{") && e.trim().endsWith("}"))
607
+ try {
608
+ const i = Object.keys(t), n = i.map((a) => t[a]), s = e.replace(/ctx\./g, "");
609
+ if (s.length > 1e3) {
610
+ pe("Expression too long, blocked for security:", e);
611
+ return;
612
+ }
613
+ return new Function(...i, `return ${s}`)(...n);
614
+ } catch (i) {
615
+ pe("Failed to evaluate expression:", e, i);
616
+ return;
617
+ }
618
+ if (e.startsWith("ctx.")) {
619
+ const i = e.slice(4);
620
+ return K(t, i);
621
+ }
622
+ return K(t, e);
409
623
  }
410
- function Ge(e, t, r) {
411
- if (!r) return;
412
- const i = W(r, e);
624
+ function it(e, t, r) {
625
+ let i;
626
+ if (typeof e == "string") {
627
+ if (!r) return;
628
+ i = xe(e, r);
629
+ } else
630
+ i = e;
413
631
  let n = [];
414
- typeof i == "string" ? n = [i] : Array.isArray(i) ? n = i.filter(Boolean) : typeof i == "object" && (n = Object.entries(i).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
415
- const o = t.class || "", s = o ? `${o} ${n.join(" ")}`.trim() : n.join(" ");
416
- s && (t.class = s);
632
+ typeof i == "string" ? n = [i] : Array.isArray(i) ? n = i.filter(Boolean) : typeof i == "object" && i !== null && (n = Object.entries(i).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
633
+ const s = t.class || "", o = s ? `${s} ${n.join(" ")}`.trim() : n.join(" ");
634
+ o && (t.class = o);
417
635
  }
418
- function Ze(e, t, r) {
636
+ function st(e, t, r) {
419
637
  let i;
420
638
  if (typeof e == "string") {
421
639
  if (!r) return;
422
- i = W(r, e);
640
+ i = xe(e, r);
423
641
  } else
424
642
  i = e;
425
643
  let n = "";
426
644
  if (typeof i == "string")
427
645
  n = i;
428
646
  else if (i && typeof i == "object") {
429
- const s = [];
430
- for (const [a, f] of Object.entries(i))
431
- if (f != null && f !== "") {
432
- const p = a.replace(
647
+ const o = [];
648
+ for (const [a, c] of Object.entries(i))
649
+ if (c != null && c !== "") {
650
+ const u = a.replace(
433
651
  /[A-Z]/g,
434
- (u) => `-${u.toLowerCase()}`
435
- ), h = [
652
+ (p) => `-${p.toLowerCase()}`
653
+ ), m = [
436
654
  "width",
437
655
  "height",
438
656
  "top",
@@ -458,125 +676,126 @@ function Ze(e, t, r) {
458
676
  "min-height",
459
677
  "max-height"
460
678
  ];
461
- let C = String(f);
462
- typeof f == "number" && h.includes(p) && (C = `${f}px`), s.push(`${p}: ${C}`);
679
+ let T = String(c);
680
+ typeof c == "number" && m.includes(u) && (T = `${c}px`), o.push(`${u}: ${T}`);
463
681
  }
464
- n = s.join("; ") + (s.length > 0 ? ";" : "");
682
+ n = o.join("; ") + (o.length > 0 ? ";" : "");
465
683
  }
466
- const o = t.style || "";
467
- t.style = o + (o && !o.endsWith(";") ? "; " : "") + n;
684
+ const s = t.style || "";
685
+ t.style = s + (s && !s.endsWith(";") ? "; " : "") + n;
468
686
  }
469
- function Oe(e, t, r, i) {
470
- const n = {}, o = { ...i || {} }, s = {};
471
- for (const [a, f] of Object.entries(e)) {
472
- const { value: p, modifiers: h, arg: C } = f;
687
+ function De(e, t, r, i) {
688
+ const n = {}, s = { ...i || {} }, o = {};
689
+ for (const [a, c] of Object.entries(e)) {
690
+ const { value: u, modifiers: m, arg: T } = c;
473
691
  if (a === "model" || a.startsWith("model:")) {
474
- const u = a.split(":"), c = u.length > 1 ? u[1] : C;
475
- Fe(
476
- typeof p == "string" ? p : String(p),
477
- h,
692
+ const p = a.split(":"), l = p.length > 1 ? p[1] : T;
693
+ tt(
694
+ typeof u == "string" ? u : String(u),
695
+ m,
478
696
  n,
479
- o,
480
697
  s,
698
+ o,
481
699
  t,
482
700
  r,
483
- c
701
+ l
484
702
  );
485
703
  continue;
486
704
  }
487
705
  switch (a) {
488
706
  case "bind":
489
- Ke(p, n, o, t);
707
+ rt(u, n, s, t);
490
708
  break;
491
709
  case "show":
492
- Je(p, o, t);
710
+ nt(u, s, t);
493
711
  break;
494
712
  case "class":
495
- Ge(p, o, t);
713
+ it(u, s, t);
496
714
  break;
497
715
  case "style":
498
- Ze(p, o, t);
716
+ st(u, s, t);
499
717
  break;
500
718
  }
501
719
  }
502
- return { props: n, attrs: o, listeners: s };
720
+ return { props: n, attrs: s, listeners: o };
503
721
  }
504
- function _e(e, t) {
722
+ function je(e, t) {
505
723
  if (Array.isArray(e)) {
506
- const o = /* @__PURE__ */ new Set();
507
- return e.map((s) => {
508
- if (!s || typeof s != "object") return s;
509
- let a = s.props?.key ?? s.key;
724
+ const s = /* @__PURE__ */ new Set();
725
+ return e.map((o) => {
726
+ if (!o || typeof o != "object") return o;
727
+ let a = o.props?.key ?? o.key;
510
728
  if (!a) {
511
- const C = s.tag || "node", c = [
729
+ const T = o.tag || "node", l = [
512
730
  // attrs (kebab-case)
513
- s.props?.attrs?.id,
514
- s.props?.attrs?.name,
515
- s.props?.attrs?.["data-key"],
731
+ o.props?.attrs?.id,
732
+ o.props?.attrs?.name,
733
+ o.props?.attrs?.["data-key"],
516
734
  // promoted JS props (camelCase or original)
517
- s.props?.props?.id,
518
- s.props?.props?.name,
519
- s.props?.props?.dataKey,
520
- s.props?.props?.["data-key"]
735
+ o.props?.props?.id,
736
+ o.props?.props?.name,
737
+ o.props?.props?.dataKey,
738
+ o.props?.props?.["data-key"]
521
739
  ].find((w) => w != null) ?? "";
522
- a = c ? `${t}:${C}:${c}` : `${t}:${C}`;
740
+ a = l ? `${t}:${T}:${l}` : `${t}:${T}`;
523
741
  }
524
- let f = a, p = 1;
525
- for (; o.has(f); )
526
- f = `${a}#${p++}`;
527
- o.add(f);
528
- let h = s.children;
529
- return Array.isArray(h) && (h = _e(h, f)), { ...s, key: f, children: h };
742
+ let c = a, u = 1;
743
+ for (; s.has(c); )
744
+ c = `${a}#${u++}`;
745
+ s.add(c);
746
+ let m = o.children;
747
+ return Array.isArray(m) && (m = je(m, c)), { ...o, key: c, children: m };
530
748
  });
531
749
  }
532
750
  const r = e;
533
751
  let i = r.props?.key ?? r.key ?? t, n = r.children;
534
- return Array.isArray(n) && (n = _e(n, i)), { ...r, key: i, children: n };
752
+ return Array.isArray(n) && (n = je(n, i)), { ...r, key: i, children: n };
535
753
  }
536
- function Se(e, t, r, i) {
537
- const n = r.directives ?? {}, o = Oe(
754
+ function Re(e, t, r, i) {
755
+ const n = r.directives ?? {}, s = De(
538
756
  n,
539
757
  i,
540
758
  e,
541
759
  r.attrs
542
- ), s = {
760
+ ), o = {
543
761
  ...t.props,
544
762
  ...r.props,
545
- ...o.props
763
+ ...s.props
546
764
  }, a = {
547
765
  ...t.attrs,
548
766
  ...r.attrs,
549
- ...o.attrs
550
- }, f = t.props ?? {}, p = s, h = r?.isCustomElement ?? t?.isCustomElement ?? !1;
551
- let C = !1;
552
- for (const w in { ...f, ...p }) {
553
- const v = f[w], d = p[w];
554
- if (v !== d) {
555
- if (C = !0, w === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
767
+ ...s.attrs
768
+ }, c = t.props ?? {}, u = o, m = r?.isCustomElement ?? t?.isCustomElement ?? !1;
769
+ let T = !1;
770
+ for (const w in { ...c, ...u }) {
771
+ const v = c[w], d = u[w];
772
+ if (v !== d)
773
+ if (T = !0, w === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
556
774
  e.value !== d && (e.value = d ?? "");
557
775
  else if (w === "checked" && e instanceof HTMLInputElement)
558
776
  e.checked = !!d;
559
777
  else if (w.startsWith("on") && typeof d == "function") {
560
- const g = Me(w);
778
+ const g = Ne(w);
561
779
  typeof v == "function" && e.removeEventListener(g, v), e.addEventListener(g, d);
562
- } else if (d == null || d === !1)
780
+ } else if (d == null)
563
781
  e.removeAttribute(w);
564
782
  else if ((r?.isCustomElement ?? t?.isCustomElement ?? !1) || w in e)
565
783
  try {
566
784
  e[w] = d;
567
785
  } catch {
568
786
  }
569
- }
787
+ else
788
+ d === !1 && e.removeAttribute(w);
570
789
  }
571
790
  for (const [w, v] of Object.entries(
572
- o.listeners || {}
791
+ s.listeners || {}
573
792
  ))
574
793
  e.addEventListener(w, v);
575
- const u = t.attrs ?? {}, c = a;
576
- for (const w in { ...u, ...c }) {
577
- const v = u[w], d = c[w];
794
+ const p = t.attrs ?? {}, l = a;
795
+ for (const w in { ...p, ...l }) {
796
+ const v = p[w], d = l[w];
578
797
  if (v !== d)
579
- if (C = !0, d == null || d === !1) {
798
+ if (T = !0, d == null || d === !1) {
580
799
  if (e.removeAttribute(w), w === "value") {
581
800
  if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement)
582
801
  try {
@@ -634,6 +853,10 @@ function Se(e, t, r, i) {
634
853
  }
635
854
  continue;
636
855
  }
856
+ if (w === "style") {
857
+ e.setAttribute(w, String(d));
858
+ continue;
859
+ }
637
860
  if (!(e.namespaceURI === "http://www.w3.org/2000/svg") && w in e)
638
861
  try {
639
862
  e[w] = d;
@@ -644,7 +867,7 @@ function Se(e, t, r, i) {
644
867
  e.setAttribute(w, String(d));
645
868
  }
646
869
  }
647
- if (h && C)
870
+ if (m && T)
648
871
  try {
649
872
  if (typeof e._applyProps == "function")
650
873
  try {
@@ -655,90 +878,90 @@ function Se(e, t, r, i) {
655
878
  } catch {
656
879
  }
657
880
  }
658
- function D(e, t, r) {
881
+ function U(e, t, r) {
659
882
  if (typeof e == "string")
660
883
  return document.createTextNode(e);
661
884
  if (e.tag === "#text") {
662
- const u = document.createTextNode(
885
+ const p = document.createTextNode(
663
886
  typeof e.children == "string" ? e.children : ""
664
887
  );
665
- return e.key != null && (u.key = e.key), u;
888
+ return e.key != null && (p.key = e.key), p;
666
889
  }
667
890
  if (e.tag === "#anchor") {
668
- const u = e, c = Array.isArray(u.children) ? u.children : [], w = document.createTextNode(""), v = document.createTextNode("");
669
- u.key != null && (w.key = `${u.key}:start`, v.key = `${u.key}:end`), u._startNode = w, u._endNode = v;
891
+ const p = e, l = Array.isArray(p.children) ? p.children : [], w = document.createTextNode(""), v = document.createTextNode("");
892
+ p.key != null && (w.key = `${p.key}:start`, v.key = `${p.key}:end`), p._startNode = w, p._endNode = v;
670
893
  const d = document.createDocumentFragment();
671
894
  d.appendChild(w);
672
- for (const g of c) {
673
- const m = D(g, t);
674
- d.appendChild(m);
895
+ for (const g of l) {
896
+ const y = U(g, t);
897
+ d.appendChild(y);
675
898
  }
676
899
  return d.appendChild(v), d;
677
900
  }
678
901
  const i = document.createElement(e.tag);
679
902
  e.key != null && (i.key = e.key);
680
- const { props: n = {}, attrs: o = {}, directives: s = {} } = e.props ?? {}, a = Oe(s, t, i, o), f = {
903
+ const { props: n = {}, attrs: s = {}, directives: o = {} } = e.props ?? {}, a = De(o, t, i, s), c = {
681
904
  ...n,
682
905
  ...a.props
683
- }, p = {
684
- ...o,
906
+ }, u = {
907
+ ...s,
685
908
  ...a.attrs
686
- }, h = i.namespaceURI === "http://www.w3.org/2000/svg";
687
- for (const u in p) {
688
- const c = p[u];
689
- if (!(typeof u != "string" || /\[object Object\]/.test(u))) {
690
- if (typeof c == "boolean")
691
- c && i.setAttribute(u, "");
692
- else if (c != null)
693
- if (!h && u === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement || i instanceof HTMLProgressElement))
909
+ }, m = i.namespaceURI === "http://www.w3.org/2000/svg";
910
+ for (const p in u) {
911
+ const l = u[p];
912
+ if (!(typeof p != "string" || /\[object Object\]/.test(p))) {
913
+ if (typeof l == "boolean")
914
+ l && i.setAttribute(p, "");
915
+ else if (l != null)
916
+ if (!m && p === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement || i instanceof HTMLProgressElement))
694
917
  try {
695
- i instanceof HTMLProgressElement ? i.value = Number(c) : i.value = c ?? "";
918
+ i instanceof HTMLProgressElement ? i.value = Number(l) : i.value = l ?? "";
696
919
  } catch {
697
- i.setAttribute(u, String(c));
920
+ i.setAttribute(p, String(l));
698
921
  }
699
- else if (!h && u === "checked" && i instanceof HTMLInputElement)
922
+ else if (!m && p === "checked" && i instanceof HTMLInputElement)
700
923
  try {
701
- i.checked = !!c;
924
+ i.checked = !!l;
702
925
  } catch {
703
- i.setAttribute(u, String(c));
926
+ i.setAttribute(p, String(l));
704
927
  }
705
- else if (!h && u in i)
928
+ else if (!m && p in i)
706
929
  try {
707
- i[u] = c;
930
+ i[p] = l;
708
931
  } catch {
709
- i.setAttribute(u, String(c));
932
+ i.setAttribute(p, String(l));
710
933
  }
711
934
  else
712
- i.setAttribute(u, String(c));
713
- }
714
- }
715
- for (const u in f) {
716
- const c = f[u];
717
- if (!(typeof u != "string" || /\[object Object\]/.test(u)))
718
- if (u === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement))
719
- i.value = c ?? "";
720
- else if (u === "checked" && i instanceof HTMLInputElement)
721
- i.checked = !!c;
722
- else if (u.startsWith("on") && typeof c == "function")
723
- i.addEventListener(Me(u), c);
935
+ i.setAttribute(p, String(l));
936
+ }
937
+ }
938
+ for (const p in c) {
939
+ const l = c[p];
940
+ if (!(typeof p != "string" || /\[object Object\]/.test(p)))
941
+ if (p === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement))
942
+ i.value = l ?? "";
943
+ else if (p === "checked" && i instanceof HTMLInputElement)
944
+ i.checked = !!l;
945
+ else if (p.startsWith("on") && typeof l == "function")
946
+ i.addEventListener(Ne(p), l);
724
947
  else {
725
- if (u.startsWith("on") && c === void 0)
948
+ if (p.startsWith("on") && l === void 0)
726
949
  continue;
727
- if (c == null || c === !1)
728
- i.removeAttribute(u);
729
- else if ((e.props?.isCustomElement ?? !1) || u in i)
950
+ if (l == null || l === !1)
951
+ i.removeAttribute(p);
952
+ else if ((e.props?.isCustomElement ?? !1) || p in i)
730
953
  try {
731
- i[u] = c;
954
+ i[p] = l;
732
955
  } catch {
733
956
  }
734
957
  }
735
958
  }
736
- for (const [u, c] of Object.entries(
959
+ for (const [p, l] of Object.entries(
737
960
  a.listeners || {}
738
961
  ))
739
- i.addEventListener(u, c);
740
- const C = e.props?.ref ?? (e.props?.props && e.props.props.ref);
741
- typeof e != "string" && C && r && (r[C] = i);
962
+ i.addEventListener(p, l);
963
+ const T = e.props?.ref ?? (e.props?.props && e.props.props.ref);
964
+ typeof e != "string" && T && r && (r[T] = i);
742
965
  try {
743
966
  if (typeof i._applyProps == "function")
744
967
  try {
@@ -749,69 +972,69 @@ function D(e, t, r) {
749
972
  } catch {
750
973
  }
751
974
  if (Array.isArray(e.children))
752
- for (const u of e.children)
753
- i.appendChild(D(u, t, r));
975
+ for (const p of e.children)
976
+ i.appendChild(U(p, t, r));
754
977
  else typeof e.children == "string" && (i.textContent = e.children);
755
978
  try {
756
- if (i instanceof HTMLSelectElement && p && p.hasOwnProperty("value"))
979
+ if (i instanceof HTMLSelectElement && u && u.hasOwnProperty("value"))
757
980
  try {
758
- i.value = p.value ?? "";
981
+ i.value = u.value ?? "";
759
982
  } catch {
760
983
  }
761
984
  } catch {
762
985
  }
763
986
  return i;
764
987
  }
765
- function Ve(e, t, r, i, n) {
988
+ function ot(e, t, r, i, n) {
766
989
  if (typeof r == "string") {
767
990
  e.textContent !== r && (e.textContent = r);
768
991
  return;
769
992
  }
770
993
  if (!Array.isArray(r)) return;
771
- const o = Array.from(e.childNodes), s = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
772
- for (const c of s)
773
- c && c.key != null && a.set(c.key, c);
774
- const f = /* @__PURE__ */ new Map();
775
- for (const c of o) {
776
- const w = c.key;
777
- w != null && f.set(w, c);
778
- }
779
- const p = /* @__PURE__ */ new Set();
780
- let h = e.firstChild;
781
- function C(c, w) {
782
- let v = c;
783
- for (; v && (p.add(v), v !== w); )
994
+ const s = Array.from(e.childNodes), o = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
995
+ for (const l of o)
996
+ l && l.key != null && a.set(l.key, l);
997
+ const c = /* @__PURE__ */ new Map();
998
+ for (const l of s) {
999
+ const w = l.key;
1000
+ w != null && c.set(w, l);
1001
+ }
1002
+ const u = /* @__PURE__ */ new Set();
1003
+ let m = e.firstChild;
1004
+ function T(l, w) {
1005
+ let v = l;
1006
+ for (; v && (u.add(v), v !== w); )
784
1007
  v = v.nextSibling;
785
1008
  }
786
- function u(c, w, v, d) {
1009
+ function p(l, w, v, d) {
787
1010
  const g = [];
788
- let m = c.nextSibling;
789
- for (; m && m !== w; )
790
- g.push(m), m = m.nextSibling;
1011
+ let y = l.nextSibling;
1012
+ for (; y && y !== w; )
1013
+ g.push(y), y = y.nextSibling;
791
1014
  const x = Array.isArray(v) ? v : [];
792
1015
  if (d.some((b) => b && b.key != null) || x.some((b) => b && b.key != null)) {
793
- const b = /* @__PURE__ */ new Map(), y = /* @__PURE__ */ new Map();
1016
+ const b = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map();
794
1017
  for (const S of x)
795
1018
  S && S.key != null && b.set(S.key, S);
796
1019
  for (const S of g) {
797
- const A = S.key;
798
- A != null && y.set(A, S);
1020
+ const E = S.key;
1021
+ E != null && h.set(E, S);
799
1022
  }
800
1023
  const _ = /* @__PURE__ */ new Set();
801
- let E = c.nextSibling;
1024
+ let $ = l.nextSibling;
802
1025
  for (const S of d) {
803
- let A;
804
- if (S.key != null && y.has(S.key)) {
805
- const $ = b.get(S.key);
806
- A = le(
807
- y.get(S.key),
808
- $,
1026
+ let E;
1027
+ if (S.key != null && h.has(S.key)) {
1028
+ const C = b.get(S.key);
1029
+ E = ge(
1030
+ h.get(S.key),
1031
+ C,
809
1032
  S,
810
1033
  i
811
- ), _.add(A), A !== E && e.contains(A) && e.insertBefore(A, E);
1034
+ ), _.add(E), E !== $ && e.contains(E) && e.insertBefore(E, $);
812
1035
  } else
813
- A = D(S, i), e.insertBefore(A, E), _.add(A);
814
- E = A.nextSibling;
1036
+ E = U(S, i), e.insertBefore(E, $), _.add(E);
1037
+ $ = E.nextSibling;
815
1038
  }
816
1039
  for (const S of g)
817
1040
  !_.has(S) && e.contains(S) && e.removeChild(S);
@@ -820,155 +1043,155 @@ function Ve(e, t, r, i, n) {
820
1043
  x.length,
821
1044
  d.length
822
1045
  );
823
- for (let y = 0; y < b; y++) {
824
- const _ = x[y], E = d[y], S = le(g[y], _, E, i);
825
- S !== g[y] && (e.insertBefore(S, g[y]), e.removeChild(g[y]));
1046
+ for (let h = 0; h < b; h++) {
1047
+ const _ = x[h], $ = d[h], S = ge(g[h], _, $, i);
1048
+ S !== g[h] && (e.insertBefore(S, g[h]), e.removeChild(g[h]));
826
1049
  }
827
- for (let y = b; y < d.length; y++)
828
- e.insertBefore(D(d[y], i), w);
829
- for (let y = b; y < g.length; y++)
830
- e.removeChild(g[y]);
1050
+ for (let h = b; h < d.length; h++)
1051
+ e.insertBefore(U(d[h], i), w);
1052
+ for (let h = b; h < g.length; h++)
1053
+ e.removeChild(g[h]);
831
1054
  }
832
1055
  }
833
- for (const c of r) {
1056
+ for (const l of r) {
834
1057
  let w;
835
- if (c.tag === "#anchor") {
836
- const v = c.key, d = `${v}:start`, g = `${v}:end`;
837
- let m = f.get(d), x = f.get(g);
838
- const l = Array.isArray(c.children) ? c.children : [];
839
- if (m || (m = document.createTextNode(""), m.key = d), x || (x = document.createTextNode(""), x.key = g), c._startNode = m, c._endNode = x, !e.contains(m) || !e.contains(x)) {
840
- e.insertBefore(m, h);
841
- for (const b of l)
842
- e.insertBefore(D(b, i), h);
843
- e.insertBefore(x, h);
1058
+ if (l.tag === "#anchor") {
1059
+ const v = l.key, d = `${v}:start`, g = `${v}:end`;
1060
+ let y = c.get(d), x = c.get(g);
1061
+ const f = Array.isArray(l.children) ? l.children : [];
1062
+ if (y || (y = document.createTextNode(""), y.key = d), x || (x = document.createTextNode(""), x.key = g), l._startNode = y, l._endNode = x, !e.contains(y) || !e.contains(x)) {
1063
+ e.insertBefore(y, m);
1064
+ for (const b of f)
1065
+ e.insertBefore(U(b, i), m);
1066
+ e.insertBefore(x, m);
844
1067
  } else
845
- u(
846
- m,
1068
+ p(
1069
+ y,
847
1070
  x,
848
1071
  a.get(v)?.children,
849
- l
1072
+ f
850
1073
  );
851
- C(m, x), h = x.nextSibling;
1074
+ T(y, x), m = x.nextSibling;
852
1075
  continue;
853
1076
  }
854
- if (c.key != null && f.has(c.key)) {
855
- const v = a.get(c.key);
856
- w = le(
857
- f.get(c.key),
1077
+ if (l.key != null && c.has(l.key)) {
1078
+ const v = a.get(l.key);
1079
+ w = ge(
1080
+ c.get(l.key),
858
1081
  v,
859
- c,
1082
+ l,
860
1083
  i,
861
1084
  n
862
- ), p.add(w), w !== h && e.contains(w) && (h && !e.contains(h) && (h = null), e.insertBefore(w, h));
1085
+ ), u.add(w), w !== m && e.contains(w) && (m && !e.contains(m) && (m = null), e.insertBefore(w, m));
863
1086
  } else
864
- w = D(c, i, n), h && !e.contains(h) && (h = null), e.insertBefore(w, h), p.add(w);
865
- h = w.nextSibling;
1087
+ w = U(l, i, n), m && !e.contains(m) && (m = null), e.insertBefore(w, m), u.add(w);
1088
+ m = w.nextSibling;
866
1089
  }
867
- for (const c of o)
868
- !p.has(c) && e.contains(c) && (V(c, n), e.removeChild(c));
1090
+ for (const l of s)
1091
+ !u.has(l) && e.contains(l) && (te(l, n), e.removeChild(l));
869
1092
  }
870
- function le(e, t, r, i, n) {
871
- if (t && typeof t != "string" && t.props?.ref && n && V(e, n), t === r) return e;
1093
+ function ge(e, t, r, i, n) {
1094
+ if (t && typeof t != "string" && t.props?.ref && n && te(e, n), t === r) return e;
872
1095
  if (typeof r == "string") {
873
1096
  if (e.nodeType === Node.TEXT_NODE)
874
1097
  return e.textContent !== r && (e.textContent = r), e;
875
1098
  {
876
- const s = document.createTextNode(r);
877
- return e.parentNode?.replaceChild(s, e), s;
1099
+ const o = document.createTextNode(r);
1100
+ return e.parentNode?.replaceChild(o, e), o;
878
1101
  }
879
1102
  }
880
1103
  if (r && typeof r != "string" && r.tag === "#anchor") {
881
- const s = r, a = Array.isArray(s.children) ? s.children : [], f = s._startNode ?? document.createTextNode(""), p = s._endNode ?? document.createTextNode("");
882
- s.key != null && (f.key = `${s.key}:start`, p.key = `${s.key}:end`), s._startNode = f, s._endNode = p;
883
- const h = document.createDocumentFragment();
884
- h.appendChild(f);
885
- for (const C of a) {
886
- const u = D(C, i);
887
- h.appendChild(u);
1104
+ const o = r, a = Array.isArray(o.children) ? o.children : [], c = o._startNode ?? document.createTextNode(""), u = o._endNode ?? document.createTextNode("");
1105
+ o.key != null && (c.key = `${o.key}:start`, u.key = `${o.key}:end`), o._startNode = c, o._endNode = u;
1106
+ const m = document.createDocumentFragment();
1107
+ m.appendChild(c);
1108
+ for (const T of a) {
1109
+ const p = U(T, i);
1110
+ m.appendChild(p);
888
1111
  }
889
- return h.appendChild(p), e.parentNode?.replaceChild(h, e), f;
1112
+ return m.appendChild(u), e.parentNode?.replaceChild(m, e), c;
890
1113
  }
891
1114
  if (!r) {
892
- V(e, n);
893
- const s = document.createComment("removed");
894
- return e.parentNode?.replaceChild(s, e), s;
1115
+ te(e, n);
1116
+ const o = document.createComment("removed");
1117
+ return e.parentNode?.replaceChild(o, e), o;
895
1118
  }
896
1119
  if (!t || typeof t == "string") {
897
- V(e, n);
898
- const s = D(r, i, n);
899
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
1120
+ te(e, n);
1121
+ const o = U(r, i, n);
1122
+ return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), e.parentNode?.replaceChild(o, e), o;
900
1123
  }
901
1124
  if (r.tag === "#anchor") {
902
- const s = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), f = r._endNode ?? document.createTextNode("");
903
- r.key != null && (a.key = `${r.key}:start`, f.key = `${r.key}:end`), r._startNode = a, r._endNode = f;
904
- const p = document.createDocumentFragment();
905
- p.appendChild(a);
906
- for (const h of s)
907
- p.appendChild(D(h, i));
908
- return p.appendChild(f), e.parentNode?.replaceChild(p, e), a;
1125
+ const o = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), c = r._endNode ?? document.createTextNode("");
1126
+ r.key != null && (a.key = `${r.key}:start`, c.key = `${r.key}:end`), r._startNode = a, r._endNode = c;
1127
+ const u = document.createDocumentFragment();
1128
+ u.appendChild(a);
1129
+ for (const m of o)
1130
+ u.appendChild(U(m, i));
1131
+ return u.appendChild(c), e.parentNode?.replaceChild(u, e), a;
909
1132
  }
910
1133
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
911
- const s = e;
912
- return Se(s, t.props || {}, r.props || {}, i), Ve(s, t.children, r.children, i, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), s;
1134
+ const o = e;
1135
+ return Re(o, t.props || {}, r.props || {}, i), ot(o, t.children, r.children, i, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), o;
913
1136
  }
914
1137
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && (t.tag && String(t.tag).includes("-") || r.props && r.props.isCustomElement || t.props && t.props.isCustomElement))
915
1138
  try {
916
1139
  const a = e;
917
- return Se(a, t.props || {}, r.props || {}, i), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = a), a;
1140
+ return Re(a, t.props || {}, r.props || {}, i), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = a), a;
918
1141
  } catch {
919
1142
  }
920
- V(e, n);
921
- const o = D(r, i, n);
922
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), e.parentNode?.replaceChild(o, e), o;
1143
+ te(e, n);
1144
+ const s = U(r, i, n);
1145
+ return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
923
1146
  }
924
- function Ye(e, t, r, i) {
1147
+ function at(e, t, r, i) {
925
1148
  let n;
926
1149
  Array.isArray(t) ? t.length === 1 ? (n = t[0], n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })) : n = { tag: "div", key: "__root__", children: t } : (n = t, n && typeof n == "object" && n.key == null && (n = { ...n, key: "__root__" })), n && typeof n == "object" && n.tag === "#anchor" && (n = {
927
1150
  tag: "div",
928
1151
  key: "__anchor_root__",
929
1152
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
930
1153
  children: [n]
931
- }), n = _e(n, String(n.key ?? "root"));
932
- const o = e._prevVNode ?? null, s = e._prevDom ?? e.firstChild ?? null;
1154
+ }), n = je(n, String(n.key ?? "root"));
1155
+ const s = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null;
933
1156
  let a;
934
- o && s ? typeof o != "string" && typeof n != "string" && o.tag === n.tag && o.key === n.key ? a = le(s, o, n, r, i) : (a = D(n, r, i), e.replaceChild(a, s)) : (a = D(n, r, i), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
935
- const f = [];
936
- for (let p = 0; p < e.childNodes.length; p++) {
937
- const h = e.childNodes[p];
938
- h !== a && h.nodeName !== "STYLE" && (V(h, i), f.push(h));
1157
+ s && o ? typeof s != "string" && typeof n != "string" && s.tag === n.tag && s.key === n.key ? a = ge(o, s, n, r, i) : (a = U(n, r, i), e.replaceChild(a, o)) : (a = U(n, r, i), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
1158
+ const c = [];
1159
+ for (let u = 0; u < e.childNodes.length; u++) {
1160
+ const m = e.childNodes[u];
1161
+ m !== a && m.nodeName !== "STYLE" && (te(m, i), c.push(m));
939
1162
  }
940
- f.forEach((p) => e.removeChild(p)), e._prevVNode = n, e._prevDom = a;
1163
+ c.forEach((u) => e.removeChild(u)), e._prevVNode = n, e._prevDom = a;
941
1164
  }
942
- function ge(e) {
943
- if (typeof e == "string") return J(e);
1165
+ function ke(e) {
1166
+ if (typeof e == "string") return Z(e);
944
1167
  if (e.tag === "#text")
945
- return typeof e.children == "string" ? J(e.children) : "";
1168
+ return typeof e.children == "string" ? Z(e.children) : "";
946
1169
  if (e.tag === "#anchor")
947
- return (Array.isArray(e.children) ? e.children.filter(Boolean) : []).map(ge).join("");
1170
+ return (Array.isArray(e.children) ? e.children.filter(Boolean) : []).map(ke).join("");
948
1171
  let t = "";
949
- e.props && e.props.attrs && (t = Object.entries(e.props.attrs).map(([n, o]) => ` ${n}="${J(String(o))}"`).join(""));
1172
+ e.props && e.props.attrs && (t = Object.entries(e.props.attrs).map(([n, s]) => ` ${n}="${Z(String(s))}"`).join(""));
950
1173
  let r = "";
951
- e.props && (r = Object.entries(e.props).filter(([n]) => n !== "attrs" && n !== "directives" && n !== "ref" && n !== "key").map(([n, o]) => ` ${n}="${J(String(o))}"`).join(""));
952
- const i = Array.isArray(e.children) ? e.children.filter(Boolean).map(ge).join("") : typeof e.children == "string" ? J(e.children) : e.children ? ge(e.children) : "";
1174
+ e.props && (r = Object.entries(e.props).filter(([n]) => n !== "attrs" && n !== "directives" && n !== "ref" && n !== "key").map(([n, s]) => ` ${n}="${Z(String(s))}"`).join(""));
1175
+ const i = Array.isArray(e.children) ? e.children.filter(Boolean).map(ke).join("") : typeof e.children == "string" ? Z(e.children) : e.children ? ke(e.children) : "";
953
1176
  return `<${e.tag}${t}${r}>${i}</${e.tag}>`;
954
1177
  }
955
- function Pe(e, ...t) {
1178
+ function Ue(e, ...t) {
956
1179
  let r = "";
957
1180
  for (let i = 0; i < e.length; i++)
958
1181
  r += e[i], i < t.length && (r += t[i]);
959
1182
  return r;
960
1183
  }
961
- function Be(e) {
1184
+ function Fe(e) {
962
1185
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
963
1186
  }
964
- let oe = null;
965
- function Ee() {
966
- return oe || (oe = new CSSStyleSheet(), oe.replaceSync(Be(Xe))), oe;
1187
+ let ue = null;
1188
+ function Oe() {
1189
+ return ue || (ue = new CSSStyleSheet(), ue.replaceSync(Fe(lt))), ue;
967
1190
  }
968
- function Qe(e) {
1191
+ function ct(e) {
969
1192
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
970
1193
  }
971
- const Xe = Pe`
1194
+ const lt = Ue`
972
1195
  :host, *, ::before, ::after {
973
1196
  all: isolate;
974
1197
  box-sizing: border-box;
@@ -1026,7 +1249,7 @@ const Xe = Pe`
1026
1249
  sup { top: -.5em }
1027
1250
  [disabled], [aria-disabled=true] { cursor: not-allowed }
1028
1251
  [hidden] { display: none }
1029
- `, et = {
1252
+ `, ft = {
1030
1253
  neutral: {
1031
1254
  50: "#fafafa",
1032
1255
  100: "#f4f4f5",
@@ -1122,8 +1345,8 @@ const Xe = Pe`
1122
1345
  black: { DEFAULT: "#000000" },
1123
1346
  transparent: { DEFAULT: "transparent" },
1124
1347
  current: { DEFAULT: "currentColor" }
1125
- }, tt = Object.fromEntries(
1126
- Object.entries(et).map(([e, t]) => [
1348
+ }, ut = Object.fromEntries(
1349
+ Object.entries(ft).map(([e, t]) => [
1127
1350
  e,
1128
1351
  Object.fromEntries(
1129
1352
  Object.entries(t).map(([r, i]) => [
@@ -1132,7 +1355,7 @@ const Xe = Pe`
1132
1355
  ])
1133
1356
  )
1134
1357
  ])
1135
- ), me = {
1358
+ ), _e = {
1136
1359
  /* Display */
1137
1360
  block: "display:block;",
1138
1361
  inline: "display:inline;",
@@ -1347,7 +1570,7 @@ const Xe = Pe`
1347
1570
  "z-30": "z-index:30;",
1348
1571
  "z-40": "z-index:40;",
1349
1572
  "z-50": "z-index:50;"
1350
- }, rt = "0.25rem", Ce = {
1573
+ }, dt = "0.25rem", Pe = {
1351
1574
  m: ["margin"],
1352
1575
  mx: ["margin-inline"],
1353
1576
  my: ["margin-block"],
@@ -1379,34 +1602,34 @@ const Xe = Pe`
1379
1602
  "gap-x": ["column-gap"],
1380
1603
  "gap-y": ["row-gap"]
1381
1604
  };
1382
- function N(e, t) {
1605
+ function D(e, t) {
1383
1606
  let r = 0, i = 0;
1384
1607
  for (let n = 0; n < e.length; n++) {
1385
- const o = e[n];
1386
- if (o === "[") r++;
1387
- else if (o === "]" && r > 0) r--;
1388
- else if (o === "(") i++;
1389
- else if (o === ")" && i > 0) i--;
1390
- else if (r === 0 && i === 0 && (o === ">" || o === "+" || o === "~" || o === " "))
1608
+ const s = e[n];
1609
+ if (s === "[") r++;
1610
+ else if (s === "]" && r > 0) r--;
1611
+ else if (s === "(") i++;
1612
+ else if (s === ")" && i > 0) i--;
1613
+ else if (r === 0 && i === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
1391
1614
  return e.slice(0, n) + t + e.slice(n);
1392
1615
  }
1393
1616
  return e + t;
1394
1617
  }
1395
- const nt = {
1618
+ const pt = {
1396
1619
  before: (e, t) => `${e}::before{${t}}`,
1397
1620
  after: (e, t) => `${e}::after{${t}}`,
1398
- hover: (e, t) => `${N(e, ":hover")}{${t}}`,
1399
- focus: (e, t) => `${N(e, ":focus")}{${t}}`,
1400
- active: (e, t) => `${N(e, ":active")}{${t}}`,
1401
- disabled: (e, t) => `${N(e, ":disabled")}{${t}}`,
1402
- visited: (e, t) => `${N(e, ":visited")}{${t}}`,
1403
- checked: (e, t) => `${N(e, ":checked")}{${t}}`,
1404
- first: (e, t) => `${N(e, ":first-child")}{${t}}`,
1405
- last: (e, t) => `${N(e, ":last-child")}{${t}}`,
1406
- odd: (e, t) => `${N(e, ":nth-child(odd)")}{${t}}`,
1407
- even: (e, t) => `${N(e, ":nth-child(even)")}{${t}}`,
1408
- "focus-within": (e, t) => `${N(e, ":focus-within")}{${t}}`,
1409
- "focus-visible": (e, t) => `${N(e, ":focus-visible")}{${t}}`,
1621
+ hover: (e, t) => `${D(e, ":hover")}{${t}}`,
1622
+ focus: (e, t) => `${D(e, ":focus")}{${t}}`,
1623
+ active: (e, t) => `${D(e, ":active")}{${t}}`,
1624
+ disabled: (e, t) => `${D(e, ":disabled")}{${t}}`,
1625
+ visited: (e, t) => `${D(e, ":visited")}{${t}}`,
1626
+ checked: (e, t) => `${D(e, ":checked")}{${t}}`,
1627
+ first: (e, t) => `${D(e, ":first-child")}{${t}}`,
1628
+ last: (e, t) => `${D(e, ":last-child")}{${t}}`,
1629
+ odd: (e, t) => `${D(e, ":nth-child(odd)")}{${t}}`,
1630
+ even: (e, t) => `${D(e, ":nth-child(even)")}{${t}}`,
1631
+ "focus-within": (e, t) => `${D(e, ":focus-within")}{${t}}`,
1632
+ "focus-visible": (e, t) => `${D(e, ":focus-visible")}{${t}}`,
1410
1633
  "group-hover": (e, t) => `.group:hover ${e}{${t}}`,
1411
1634
  "group-focus": (e, t) => `.group:focus ${e}{${t}}`,
1412
1635
  "group-active": (e, t) => `.group:active ${e}{${t}}`,
@@ -1415,7 +1638,7 @@ const nt = {
1415
1638
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1416
1639
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1417
1640
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1418
- }, ye = {
1641
+ }, Ee = {
1419
1642
  // Responsive
1420
1643
  sm: "(min-width:640px)",
1421
1644
  md: "(min-width:768px)",
@@ -1424,25 +1647,25 @@ const nt = {
1424
1647
  "2xl": "(min-width:1536px)",
1425
1648
  // Dark mode (now plain string)
1426
1649
  dark: "(prefers-color-scheme: dark)"
1427
- }, be = ["sm", "md", "lg", "xl", "2xl"];
1428
- function we(e) {
1650
+ }, $e = ["sm", "md", "lg", "xl", "2xl"];
1651
+ function Se(e) {
1429
1652
  const t = e.startsWith("-"), i = (t ? e.slice(1) : e).split("-");
1430
1653
  if (i.length < 2) return null;
1431
- const n = i.slice(0, -1).join("-"), o = i[i.length - 1], s = parseFloat(o);
1432
- if (Number.isNaN(s) || !Ce[n]) return null;
1654
+ const n = i.slice(0, -1).join("-"), s = i[i.length - 1], o = parseFloat(s);
1655
+ if (Number.isNaN(o) || !Pe[n]) return null;
1433
1656
  const a = t ? "-" : "";
1434
- return Ce[n].map((f) => `${f}:calc(${a}${rt} * ${s});`).join("");
1657
+ return Pe[n].map((c) => `${c}:calc(${a}${dt} * ${o});`).join("");
1435
1658
  }
1436
- function Ae(e) {
1437
- const t = e.replace("#", ""), r = parseInt(t, 16), i = r >> 16 & 255, n = r >> 8 & 255, o = r & 255;
1438
- return `${i} ${n} ${o}`;
1659
+ function Me(e) {
1660
+ const t = e.replace("#", ""), r = parseInt(t, 16), i = r >> 16 & 255, n = r >> 8 & 255, s = r & 255;
1661
+ return `${i} ${n} ${s}`;
1439
1662
  }
1440
- function it(e) {
1663
+ function ht(e) {
1441
1664
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1442
1665
  if (!t) return null;
1443
- const [, r, i, n = "DEFAULT"] = t, o = tt[i]?.[n];
1444
- if (!o) return null;
1445
- if (r === "shadow") return `--ce-shadow-color:${o};`;
1666
+ const [, r, i, n = "DEFAULT"] = t, s = ut[i]?.[n];
1667
+ if (!s) return null;
1668
+ if (r === "shadow") return `--ce-shadow-color:${s};`;
1446
1669
  const a = {
1447
1670
  bg: "background-color",
1448
1671
  decoration: "text-decoration-color",
@@ -1454,49 +1677,49 @@ function it(e) {
1454
1677
  fill: "fill",
1455
1678
  stroke: "stroke"
1456
1679
  }[r];
1457
- return a ? `${a}:${o};` : null;
1680
+ return a ? `${a}:${s};` : null;
1458
1681
  }
1459
- function st(e) {
1682
+ function gt(e) {
1460
1683
  const [t, r] = e.split("/");
1461
1684
  if (!r) return { base: t };
1462
1685
  const i = parseInt(r, 10);
1463
1686
  return isNaN(i) || i < 0 || i > 100 ? { base: t } : { base: t, opacity: i / 100 };
1464
1687
  }
1465
- function xe(e) {
1466
- const { base: t, opacity: r } = st(e), i = it(t);
1688
+ function Ce(e) {
1689
+ const { base: t, opacity: r } = gt(e), i = ht(t);
1467
1690
  if (i) {
1468
1691
  if (r !== void 0) {
1469
- const o = /#([0-9a-f]{6})/i.exec(i);
1470
- if (o) {
1471
- const s = Ae(o[0]);
1472
- return i.replace(/#([0-9a-f]{6})/i, `rgb(${s} / ${r})`);
1692
+ const s = /#([0-9a-f]{6})/i.exec(i);
1693
+ if (s) {
1694
+ const o = Me(s[0]);
1695
+ return i.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
1473
1696
  }
1474
1697
  }
1475
1698
  return i;
1476
1699
  }
1477
- const n = fe(t);
1700
+ const n = me(t);
1478
1701
  if (n && r !== void 0) {
1479
- const o = /#([0-9a-f]{6})/i.exec(n);
1480
- if (o) {
1481
- const s = Ae(o[0]);
1482
- return n.replace(/#([0-9a-f]{6})/i, `rgb(${s} / ${r})`);
1702
+ const s = /#([0-9a-f]{6})/i.exec(n);
1703
+ if (s) {
1704
+ const o = Me(s[0]);
1705
+ return n.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
1483
1706
  }
1484
1707
  }
1485
1708
  return n;
1486
1709
  }
1487
- function ve(e) {
1710
+ function Ae(e) {
1488
1711
  const t = /^opacity-(\d{1,3})$/.exec(e);
1489
1712
  if (!t) return null;
1490
1713
  const r = parseInt(t[1], 10);
1491
1714
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1492
1715
  }
1493
- function fe(e) {
1716
+ function me(e) {
1494
1717
  if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
1495
1718
  const n = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1496
1719
  if (n) {
1497
- const o = n[1].trim();
1498
- let s = n[2].trim();
1499
- return s = s.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), s = s.replace(/^'([^']*)'$/g, '"$1"'), `${o}:${s};`;
1720
+ const s = n[1].trim();
1721
+ let o = n[2].trim();
1722
+ return o = o.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), o = o.replace(/^'([^']*)'$/g, '"$1"'), `${s}:${o};`;
1500
1723
  }
1501
1724
  return null;
1502
1725
  }
@@ -1505,7 +1728,7 @@ function fe(e) {
1505
1728
  const i = e.slice(0, t);
1506
1729
  let n = e.slice(t + 2, -1);
1507
1730
  n = n.replace(/_/g, " ");
1508
- const o = {
1731
+ const s = {
1509
1732
  bg: "background-color",
1510
1733
  text: "color",
1511
1734
  shadow: "box-shadow",
@@ -1549,12 +1772,12 @@ function fe(e) {
1549
1772
  };
1550
1773
  if (i === "rotate")
1551
1774
  return `transform:rotate(${n});`;
1552
- const s = o[i] ?? i.replace(/_/g, "-");
1553
- if (s && n) return `${s}:${n};`;
1775
+ const o = s[i] ?? i.replace(/_/g, "-");
1776
+ if (o && n) return `${o}:${n};`;
1554
1777
  }
1555
1778
  return null;
1556
1779
  }
1557
- function ot(e) {
1780
+ function mt(e) {
1558
1781
  if (e.startsWith("[") && e.endsWith("]")) {
1559
1782
  const r = e.slice(1, -1);
1560
1783
  return r.includes("&") ? r : e;
@@ -1566,10 +1789,10 @@ function ot(e) {
1566
1789
  }
1567
1790
  return null;
1568
1791
  }
1569
- function at(e) {
1792
+ function yt(e) {
1570
1793
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1571
1794
  }
1572
- function ct(e) {
1795
+ function bt(e) {
1573
1796
  const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
1574
1797
  let i;
1575
1798
  for (; i = t.exec(e); ) {
@@ -1578,31 +1801,31 @@ function ct(e) {
1578
1801
  }
1579
1802
  return r.filter(Boolean);
1580
1803
  }
1581
- const Te = /* @__PURE__ */ new Map(), lt = 16;
1582
- function ft(e) {
1583
- const t = Date.now(), r = Te.get(e);
1584
- if (r && t - r.timestamp < lt) return r.css;
1585
- const i = ct(e), n = new Set(i), o = [], s = [], a = [], f = [], p = {};
1586
- function h(d, g = !1) {
1587
- const m = (g ? "dark|" : "") + d;
1588
- if (m in p) return p[m];
1804
+ const Be = /* @__PURE__ */ new Map(), wt = 16;
1805
+ function xt(e) {
1806
+ const t = Date.now(), r = Be.get(e);
1807
+ if (r && t - r.timestamp < wt) return r.css;
1808
+ const i = bt(e), n = new Set(i), s = [], o = [], a = [], c = [], u = {};
1809
+ function m(d, g = !1) {
1810
+ const y = (g ? "dark|" : "") + d;
1811
+ if (y in u) return u[y];
1589
1812
  const x = w(d, g);
1590
- return p[m] = x, x;
1813
+ return u[y] = x, x;
1591
1814
  }
1592
- function C(d) {
1593
- const g = d.some((x) => be.includes(x)), m = d.includes("dark");
1594
- return d.length === 0 ? 1 : !g && !m ? 2 : g && !m ? 3 : 4;
1815
+ function T(d) {
1816
+ const g = d.some((x) => $e.includes(x)), y = d.includes("dark");
1817
+ return d.length === 0 ? 1 : !g && !y ? 2 : g && !y ? 3 : 4;
1595
1818
  }
1596
- function u(d) {
1819
+ function p(d) {
1597
1820
  const g = [];
1598
- let m = "", x = 0, l = 0;
1821
+ let y = "", x = 0, f = 0;
1599
1822
  for (let b = 0; b < d.length; b++) {
1600
- const y = d[b];
1601
- y === "[" ? x++ : y === "]" && x > 0 ? x-- : y === "(" ? l++ : y === ")" && l > 0 && l--, y === ":" && x === 0 && l === 0 ? (g.push(m), m = "") : m += y;
1823
+ const h = d[b];
1824
+ h === "[" ? x++ : h === "]" && x > 0 ? x-- : h === "(" ? f++ : h === ")" && f > 0 && f--, h === ":" && x === 0 && f === 0 ? (g.push(y), y = "") : y += h;
1602
1825
  }
1603
- return m && g.push(m), g;
1826
+ return y && g.push(y), g;
1604
1827
  }
1605
- function c(d) {
1828
+ function l(d) {
1606
1829
  switch (d) {
1607
1830
  case "hover":
1608
1831
  return ":hover";
@@ -1633,209 +1856,244 @@ function ft(e) {
1633
1856
  }
1634
1857
  }
1635
1858
  function w(d, g = !1) {
1636
- const m = u(d);
1859
+ const y = p(d);
1637
1860
  let x = !1;
1638
- const l = m.find((k) => (k.startsWith("!") && (x = !0, k = k.slice(1)), me[k] || we(k) || ve(k) || xe(k) || fe(k)));
1639
- if (!l) return null;
1640
- const b = l.replace(/^!/, ""), y = me[b] ?? we(b) ?? ve(b) ?? xe(b) ?? fe(b);
1641
- if (!y) return null;
1642
- const _ = m.indexOf(l);
1643
- let E = _ >= 0 ? m.slice(0, _) : [];
1644
- g && (E = E.filter((k) => k !== "dark"));
1645
- const S = `.${at(d)}`, A = "__SUBJECT__", $ = x ? y.replace(/;$/, " !important;") : y;
1646
- let T = A;
1647
- const B = [];
1648
- for (const k of E)
1649
- k.startsWith("group-") ? (T = `.group:${k.slice(6)} ${T}`, B.push(k)) : k.startsWith("peer-") && (T = T.replace(A, `.peer:${k.slice(5)}~${A}`), B.push(k));
1650
- E = E.filter((k) => !B.includes(k));
1651
- const G = [], ee = [];
1861
+ const f = y.find((k) => (k.startsWith("!") && (x = !0, k = k.slice(1)), _e[k] || Se(k) || Ae(k) || Ce(k) || me(k)));
1862
+ if (!f) return null;
1863
+ const b = f.replace(/^!/, ""), h = _e[b] ?? Se(b) ?? Ae(b) ?? Ce(b) ?? me(b);
1864
+ if (!h) return null;
1865
+ const _ = y.indexOf(f);
1866
+ let $ = _ >= 0 ? y.slice(0, _) : [];
1867
+ g && ($ = $.filter((k) => k !== "dark"));
1868
+ const S = `.${yt(d)}`, E = "__SUBJECT__", C = x ? h.replace(/;$/, " !important;") : h;
1869
+ let A = E;
1870
+ const P = [];
1871
+ for (const k of $)
1872
+ k.startsWith("group-") ? (A = `.group:${k.slice(6)} ${A}`, P.push(k)) : k.startsWith("peer-") && (A = A.replace(E, `.peer:${k.slice(5)}~${E}`), P.push(k));
1873
+ $ = $.filter((k) => !P.includes(k));
1874
+ const X = [], ie = [];
1652
1875
  let M = null;
1653
- for (const k of E) {
1654
- if (k === "dark" || be.includes(k)) continue;
1655
- const P = ot(k);
1656
- if (P) {
1657
- M = P;
1876
+ for (const k of $) {
1877
+ if (k === "dark" || $e.includes(k)) continue;
1878
+ const W = mt(k);
1879
+ if (W) {
1880
+ M = W;
1658
1881
  continue;
1659
1882
  }
1660
- const R = c(k);
1883
+ const R = l(k);
1661
1884
  if (R) {
1662
- M ? ee.push(R) : G.push(R);
1885
+ M ? ie.push(R) : X.push(R);
1663
1886
  continue;
1664
1887
  }
1665
- const O = nt[k];
1666
- typeof O == "function" && (T = O(T, $).split("{")[0]);
1888
+ const B = pt[k];
1889
+ typeof B == "function" && (A = B(A, C).split("{")[0]);
1667
1890
  }
1668
- function U(k, P) {
1669
- if (!P) return k;
1670
- let R = 0, O = 0;
1891
+ function F(k, W) {
1892
+ if (!W) return k;
1893
+ let R = 0, B = 0;
1671
1894
  if (k.length && (k[0] === ">" || k[0] === "+" || k[0] === "~" || k[0] === " ")) {
1672
1895
  let j = 1;
1673
1896
  for (; j < k.length && k[j] === " "; ) j++;
1674
1897
  for (; j < k.length; j++) {
1675
1898
  const L = k[j];
1676
- if (L === "[" ? R++ : L === "]" && R > 0 ? R-- : L === "(" ? O++ : L === ")" && O > 0 && O--, R === 0 && O === 0 && (k[j] === ">" || k[j] === "+" || k[j] === "~" || k[j] === " "))
1677
- return k.slice(0, j) + P + k.slice(j);
1899
+ if (L === "[" ? R++ : L === "]" && R > 0 ? R-- : L === "(" ? B++ : L === ")" && B > 0 && B--, R === 0 && B === 0 && (k[j] === ">" || k[j] === "+" || k[j] === "~" || k[j] === " "))
1900
+ return k.slice(0, j) + W + k.slice(j);
1678
1901
  }
1679
- return k + P;
1902
+ return k + W;
1680
1903
  }
1681
1904
  for (let j = 0; j < k.length; j++) {
1682
1905
  const L = k[j];
1683
- if (L === "[" ? R++ : L === "]" && R > 0 ? R-- : L === "(" ? O++ : L === ")" && O > 0 && O--, R === 0 && O === 0 && (L === ">" || L === "+" || L === "~" || L === " "))
1684
- return k.slice(0, j) + P + k.slice(j);
1906
+ if (L === "[" ? R++ : L === "]" && R > 0 ? R-- : L === "(" ? B++ : L === ")" && B > 0 && B--, R === 0 && B === 0 && (L === ">" || L === "+" || L === "~" || L === " "))
1907
+ return k.slice(0, j) + W + k.slice(j);
1685
1908
  }
1686
- return k + P;
1909
+ return k + W;
1687
1910
  }
1688
- const q = G.join(""), I = ee.join("");
1911
+ const H = X.join(""), N = ie.join("");
1689
1912
  if (M)
1690
1913
  if (M.includes("&")) {
1691
- const k = M.indexOf("&"), P = M.slice(0, k), R = M.slice(k + 1), O = A + q, j = T;
1692
- if (G.length === 0)
1693
- T = j.replace(A, P + O + I + R);
1914
+ const k = M.indexOf("&"), W = M.slice(0, k), R = M.slice(k + 1), B = E + H, j = A;
1915
+ if (X.length === 0)
1916
+ A = j.replace(E, W + B + N + R);
1694
1917
  else {
1695
- const L = U(R, I);
1696
- T = j.replace(A, P + O + L);
1918
+ const L = F(R, N);
1919
+ A = j.replace(E, W + B + L);
1697
1920
  }
1698
1921
  } else
1699
- T = T.replace(A, `${M}${A + q}`), I && (T = T.replace(A, `${A}${I}`));
1922
+ A = A.replace(E, `${M}${E + H}`), N && (A = A.replace(E, `${E}${N}`));
1700
1923
  else
1701
- T = A + q + I;
1702
- T = T.replace(new RegExp(A, "g"), S);
1703
- let z = `${T}{${$}}`;
1704
- const H = E.filter((k) => be.includes(k)), F = H.length ? H[H.length - 1] : null, te = E.includes("dark");
1705
- return g && F ? z = `@media (prefers-color-scheme: dark) and ${ye[F]}{${z}}` : g ? z = `@media (prefers-color-scheme: dark){${z}}` : te && F ? z = `@media (prefers-color-scheme: dark) and ${ye[F]}{${z}}` : te ? z = `@media (prefers-color-scheme: dark){${z}}` : F && (z = `@media ${ye[F]}{${z}}`), z;
1924
+ A = E + H + N;
1925
+ A = A.replace(new RegExp(E, "g"), S);
1926
+ let I = `${A}{${C}}`;
1927
+ const z = $.filter((k) => $e.includes(k)), J = z.length ? z[z.length - 1] : null, se = $.includes("dark");
1928
+ return g && J ? I = `@media (prefers-color-scheme: dark) and ${Ee[J]}{${I}}` : g ? I = `@media (prefers-color-scheme: dark){${I}}` : se && J ? I = `@media (prefers-color-scheme: dark) and ${Ee[J]}{${I}}` : se ? I = `@media (prefers-color-scheme: dark){${I}}` : J && (I = `@media ${Ee[J]}{${I}}`), I;
1706
1929
  }
1707
1930
  for (const d of n) {
1708
- const g = u(d), m = g.find(
1709
- (y) => me[y] || we(y) || ve(y) || xe(y) || fe(y)
1931
+ const g = p(d), y = g.find(
1932
+ (h) => _e[h] || Se(h) || Ae(h) || Ce(h) || me(h)
1710
1933
  );
1711
- if (!m) continue;
1712
- const x = g.indexOf(m), l = x >= 0 ? g.slice(0, x) : [], b = C(l);
1934
+ if (!y) continue;
1935
+ const x = g.indexOf(y), f = x >= 0 ? g.slice(0, x) : [], b = T(f);
1713
1936
  if (b === 4) {
1714
- const y = h(d, !0);
1715
- y && f.push(y);
1937
+ const h = m(d, !0);
1938
+ h && c.push(h);
1716
1939
  } else {
1717
- const y = h(d);
1718
- y && (b === 1 ? o.push(y) : b === 2 ? s.push(y) : b === 3 && a.push(y));
1940
+ const h = m(d);
1941
+ h && (b === 1 ? s.push(h) : b === 2 ? o.push(h) : b === 3 && a.push(h));
1719
1942
  }
1720
1943
  }
1721
- const v = [...o, ...s, ...a, ...f].join("");
1722
- return Te.set(e, { css: v, timestamp: t }), v;
1944
+ const v = [...s, ...o, ...a, ...c].join("");
1945
+ return Be.set(e, { css: v, timestamp: t }), v;
1723
1946
  }
1724
- const ne = [];
1725
- function ut(e, t, r, i, n, o, s, a) {
1947
+ const ce = [];
1948
+ function vt(e, t, r, i, n, s, o, a) {
1726
1949
  if (e) {
1727
- ne.push(r);
1950
+ ce.push(r);
1728
1951
  try {
1729
1952
  if (t.loadingTemplate && r.isLoading) {
1730
- Q(e, t.loadingTemplate(r), r, i, n);
1953
+ re(e, t.loadingTemplate(r), r, i, n);
1731
1954
  return;
1732
1955
  }
1733
1956
  if (t.errorTemplate && r.hasError) {
1734
- r.error instanceof Error && Q(e, t.errorTemplate(r.error, r), r, i, n);
1957
+ r.error instanceof Error && re(e, t.errorTemplate(r.error, r), r, i, n);
1735
1958
  return;
1736
1959
  }
1737
- const f = t.render(r);
1738
- if (f instanceof Promise) {
1739
- o(!0), f.then((p) => {
1740
- o(!1), s(null), Q(e, p, r, i, n), a(e.innerHTML);
1741
- }).catch((p) => {
1742
- o(!1), s(p), t.errorTemplate && Q(e, t.errorTemplate(p, r), r, i, n);
1743
- }), t.loadingTemplate && Q(e, t.loadingTemplate(r), r, i, n);
1960
+ const c = t.render(r);
1961
+ if (c instanceof Promise) {
1962
+ s(!0), c.then((u) => {
1963
+ s(!1), o(null), re(e, u, r, i, n), a(e.innerHTML);
1964
+ }).catch((u) => {
1965
+ s(!1), o(u), t.errorTemplate && re(e, t.errorTemplate(u, r), r, i, n);
1966
+ }), t.loadingTemplate && re(e, t.loadingTemplate(r), r, i, n);
1744
1967
  return;
1745
1968
  }
1746
- Q(e, f, r, i, n), a(e.innerHTML);
1969
+ re(e, c, r, i, n), a(e.innerHTML);
1747
1970
  } finally {
1748
- ne.pop();
1971
+ ce.pop();
1749
1972
  }
1750
1973
  }
1751
1974
  }
1752
- function Q(e, t, r, i, n) {
1753
- e && (Ye(
1975
+ function re(e, t, r, i, n) {
1976
+ e && (at(
1754
1977
  e,
1755
1978
  Array.isArray(t) ? t : [t],
1756
1979
  r,
1757
1980
  i
1758
1981
  ), n(e.innerHTML));
1759
1982
  }
1760
- function pt(e, t, r, i, n, o, s) {
1761
- if (o !== null && clearTimeout(o), Date.now() - t < 16) {
1983
+ function kt(e, t, r, i, n, s, o) {
1984
+ if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1762
1985
  if (n(r + 1), r > 10) {
1763
- s(null);
1986
+ o(null);
1764
1987
  return;
1765
1988
  }
1766
1989
  } else
1767
1990
  n(0);
1768
- const f = setTimeout(() => {
1769
- i(Date.now()), e(), s(null);
1991
+ const c = setTimeout(() => {
1992
+ i(Date.now()), e(), o(null);
1770
1993
  }, 0);
1771
- s(f);
1994
+ o(c);
1772
1995
  }
1773
- function dt(e, t, r, i, n, o) {
1996
+ function _t(e, t, r, i, n, s) {
1774
1997
  if (!e) return;
1775
- const s = ft(i);
1776
- if (!t.style && (!s || s.trim() === "")) {
1777
- o(null), e.adoptedStyleSheets = [Ee()];
1998
+ const o = xt(i);
1999
+ if (!t.style && (!o || o.trim() === "")) {
2000
+ s(null), e.adoptedStyleSheets = [Oe()];
1778
2001
  return;
1779
2002
  }
1780
2003
  let a = "";
1781
2004
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1782
- let f = Qe(`${a}
1783
- ${s}
2005
+ let c = ct(`${a}
2006
+ ${o}
1784
2007
  `);
1785
- f = Be(f);
1786
- let p = n;
1787
- p || (p = new CSSStyleSheet()), (p.cssRules.length === 0 || p.toString() !== f) && p.replaceSync(f), e.adoptedStyleSheets = [Ee(), p], o(p);
2008
+ c = Fe(c);
2009
+ let u = n;
2010
+ u || (u = new CSSStyleSheet()), (u.cssRules.length === 0 || u.toString() !== c) && u.replaceSync(c), e.adoptedStyleSheets = [Oe(), u], s(u);
1788
2011
  }
1789
- const de = /* @__PURE__ */ new Map(), je = Symbol.for("cer.registry");
2012
+ class Et {
2013
+ pendingUpdates = /* @__PURE__ */ new Map();
2014
+ isFlushScheduled = !1;
2015
+ /**
2016
+ * Schedule an update to be executed in the next microtask
2017
+ * Uses component identity to deduplicate multiple render requests for the same component
2018
+ */
2019
+ schedule(t, r) {
2020
+ const i = r || t.toString();
2021
+ this.pendingUpdates.set(i, t), this.isFlushScheduled || (this.isFlushScheduled = !0, typeof globalThis.process < "u" && globalThis.process.env?.NODE_ENV === "test" || typeof window < "u" && (window.__vitest__ || window.Cypress) ? this.flush() : queueMicrotask(() => this.flush()));
2022
+ }
2023
+ /**
2024
+ * Execute all pending updates
2025
+ */
2026
+ flush() {
2027
+ const t = Array.from(this.pendingUpdates.values());
2028
+ this.pendingUpdates.clear(), this.isFlushScheduled = !1;
2029
+ for (const r of t)
2030
+ try {
2031
+ r();
2032
+ } catch (i) {
2033
+ typeof console < "u" && console.error && console.error("Error in batched update:", i);
2034
+ }
2035
+ }
2036
+ /**
2037
+ * Get the number of pending updates
2038
+ */
2039
+ get pendingCount() {
2040
+ return this.pendingUpdates.size;
2041
+ }
2042
+ }
2043
+ const $t = new Et();
2044
+ function oe(e, t) {
2045
+ $t.schedule(e, t);
2046
+ }
2047
+ const be = /* @__PURE__ */ new Map(), We = Symbol.for("cer.registry");
1790
2048
  if (typeof window < "u") {
1791
2049
  const e = globalThis;
1792
- e[je] || (e[je] = de);
2050
+ e[We] || (e[We] = be);
1793
2051
  }
1794
- function Le(e, t, r) {
1795
- let i = Y(e);
2052
+ function Ie(e, t, r) {
2053
+ let i = Q(e);
1796
2054
  i.includes("-") || (i = `cer-${i}`);
1797
2055
  let n;
1798
- typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (o, s) => {
1799
- console.error(`[${i}] Error:`, o, s);
2056
+ typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (s, o) => {
2057
+ Y(`[${i}] Error:`, s, o);
1800
2058
  });
1801
2059
  try {
1802
- const o = /* @__PURE__ */ new Set([
2060
+ const s = /* @__PURE__ */ new Set([
1803
2061
  "refs",
1804
2062
  "requestRender",
1805
2063
  "error",
1806
2064
  "hasError",
1807
2065
  "isLoading",
1808
2066
  "emit"
1809
- ]), s = [];
2067
+ ]), o = [];
1810
2068
  if (n.state && typeof n.state == "object" && Object.keys(n.state).forEach((a) => {
1811
- o.has(a) && s.push(a);
2069
+ s.has(a) && o.push(a);
1812
2070
  }), n.props && typeof n.props == "object" && Object.keys(n.props).forEach((a) => {
1813
- o.has(a) && s.push(a);
2071
+ s.has(a) && o.push(a);
1814
2072
  }), n.computed && typeof n.computed == "object" && Object.keys(n.computed).forEach((a) => {
1815
- o.has(a) && s.push(a);
1816
- }), s.length > 0) {
1817
- const a = Array.from(new Set(s));
1818
- console.warn(
2073
+ s.has(a) && o.push(a);
2074
+ }), o.length > 0) {
2075
+ const a = Array.from(new Set(o));
2076
+ pe(
1819
2077
  `[${i}] Reserved runtime context keys used in component config: ${a.join(", ")}. These names are provided by the runtime (for example: refs, error, emit). Rename your state/prop/computed keys (e.g. 'error' -> 'errorMessage') to avoid collisions and TypeScript type conflicts.`
1820
2078
  );
1821
2079
  }
1822
2080
  } catch {
1823
2081
  }
1824
- if (de.set(i, n), typeof window < "u")
2082
+ if (be.set(i, n), typeof window < "u")
1825
2083
  if (!customElements.get(i))
1826
- customElements.define(i, ht(i, n));
2084
+ customElements.define(i, St(i, n));
1827
2085
  else
1828
2086
  try {
1829
- document.querySelectorAll(i).forEach((o) => {
2087
+ document.querySelectorAll(i).forEach((s) => {
1830
2088
  try {
1831
- typeof o._cfg < "u" && (o._cfg = n), typeof o._render == "function" && o._render(n);
2089
+ typeof s._cfg < "u" && (s._cfg = n), typeof s._render == "function" && s._render(n);
1832
2090
  } catch {
1833
2091
  }
1834
2092
  });
1835
2093
  } catch {
1836
2094
  }
1837
2095
  }
1838
- function ht(e, t) {
2096
+ function St(e, t) {
1839
2097
  if (!t.render)
1840
2098
  throw new Error(
1841
2099
  "Component must have a render function"
@@ -1853,6 +2111,7 @@ function ht(e, t) {
1853
2111
  _mounted = !1;
1854
2112
  _hasError = !1;
1855
2113
  _initializing = !0;
2114
+ _componentId;
1856
2115
  _styleSheet = null;
1857
2116
  _lastHtmlStringForJitCSS = "";
1858
2117
  /**
@@ -1879,7 +2138,7 @@ function ht(e, t) {
1879
2138
  _templateLoading = !1;
1880
2139
  _templateError = null;
1881
2140
  constructor() {
1882
- super(), this.attachShadow({ mode: "open" }), this._cfg = de.get(e) || t;
2141
+ super(), this.attachShadow({ mode: "open" }), this._cfg = be.get(e) || t, this._componentId = `${e}-${Math.random().toString(36).substr(2, 9)}`;
1883
2142
  const r = this._initContext(t);
1884
2143
  Object.defineProperty(r, "refs", {
1885
2144
  value: this._refs,
@@ -1891,13 +2150,23 @@ function ht(e, t) {
1891
2150
  writable: !1,
1892
2151
  enumerable: !1,
1893
2152
  configurable: !1
2153
+ }), Object.defineProperty(r, "_requestRender", {
2154
+ value: () => this._requestRender(),
2155
+ writable: !1,
2156
+ enumerable: !1,
2157
+ configurable: !1
2158
+ }), Object.defineProperty(r, "_triggerWatchers", {
2159
+ value: (n, s) => this._triggerWatchers(n, s),
2160
+ writable: !1,
2161
+ enumerable: !1,
2162
+ configurable: !1
1894
2163
  }), this.context = r, Object.defineProperty(this.context, "emit", {
1895
- value: (n, o, s) => {
2164
+ value: (n, s, o) => {
1896
2165
  const a = new CustomEvent(n, {
1897
- detail: o,
2166
+ detail: s,
1898
2167
  bubbles: !0,
1899
2168
  composed: !0,
1900
- ...s || {}
2169
+ ...o || {}
1901
2170
  });
1902
2171
  return this.dispatchEvent(a), !a.defaultPrevented;
1903
2172
  },
@@ -1905,15 +2174,28 @@ function ht(e, t) {
1905
2174
  enumerable: !1,
1906
2175
  configurable: !1
1907
2176
  });
1908
- const i = de.get(e) || t;
2177
+ const i = be.get(e) || t;
1909
2178
  Object.keys(i).forEach((n) => {
1910
- const o = i[n];
1911
- typeof o == "function" && (this.context[n] = (...s) => o(...s, this.context));
1912
- }), this._applyComputed(i), this._initializing = !1, this._initWatchers(i), this._render(i);
2179
+ const s = i[n];
2180
+ typeof s == "function" && (this.context[n] = (...o) => s(...o, this.context));
2181
+ }), this._applyComputed(i), i.props && Object.keys(i.props).forEach((n) => {
2182
+ let s = this[n];
2183
+ Object.defineProperty(this, n, {
2184
+ get() {
2185
+ return s;
2186
+ },
2187
+ set(o) {
2188
+ const a = s;
2189
+ s = o, this.context[n] = o, this._initializing || (this._applyProps(i), a !== o && this._requestRender());
2190
+ },
2191
+ enumerable: !0,
2192
+ configurable: !0
2193
+ });
2194
+ }), this._initializing = !1, this._initWatchers(i), this._render(i);
1913
2195
  }
1914
2196
  connectedCallback() {
1915
2197
  this._runLogicWithinErrorBoundary(t, () => {
1916
- this._applyProps(t), We(
2198
+ this._applyProps(t), Qe(
1917
2199
  t,
1918
2200
  this.context,
1919
2201
  this._mounted,
@@ -1925,7 +2207,7 @@ function ht(e, t) {
1925
2207
  }
1926
2208
  disconnectedCallback() {
1927
2209
  this._runLogicWithinErrorBoundary(t, () => {
1928
- De(
2210
+ Xe(
1929
2211
  t,
1930
2212
  this.context,
1931
2213
  this._listeners,
@@ -1949,7 +2231,7 @@ function ht(e, t) {
1949
2231
  }
1950
2232
  attributeChangedCallback(r, i, n) {
1951
2233
  this._runLogicWithinErrorBoundary(t, () => {
1952
- this._applyProps(t), Ue(
2234
+ this._applyProps(t), et(
1953
2235
  t,
1954
2236
  r,
1955
2237
  i,
@@ -1959,15 +2241,15 @@ function ht(e, t) {
1959
2241
  });
1960
2242
  }
1961
2243
  static get observedAttributes() {
1962
- return t.props ? Object.keys(t.props).map(Y) : [];
2244
+ return t.props ? Object.keys(t.props).map(Q) : [];
1963
2245
  }
1964
2246
  _applyComputed(r) {
1965
2247
  this._runLogicWithinErrorBoundary(t, () => {
1966
2248
  r.computed && Object.entries(r.computed).forEach(([i, n]) => {
1967
2249
  Object.defineProperty(this.context, i, {
1968
2250
  get: () => {
1969
- const o = n(this.context);
1970
- return J(o);
2251
+ const s = n(this.context);
2252
+ return Z(s);
1971
2253
  },
1972
2254
  enumerable: !0
1973
2255
  });
@@ -1977,7 +2259,7 @@ function ht(e, t) {
1977
2259
  // --- Render ---
1978
2260
  _render(r) {
1979
2261
  this._runLogicWithinErrorBoundary(r, () => {
1980
- ut(
2262
+ vt(
1981
2263
  this.shadowRoot,
1982
2264
  r,
1983
2265
  this.context,
@@ -2000,27 +2282,29 @@ function ht(e, t) {
2000
2282
  }
2001
2283
  _requestRender() {
2002
2284
  this._runLogicWithinErrorBoundary(this._cfg, () => {
2003
- pt(
2004
- () => this._render(this._cfg),
2005
- this._lastRenderTime,
2006
- this._renderCount,
2007
- (r) => {
2008
- this._lastRenderTime = r;
2009
- },
2010
- (r) => {
2011
- this._renderCount = r;
2012
- },
2013
- this._renderTimeoutId,
2014
- (r) => {
2015
- this._renderTimeoutId = r;
2016
- }
2017
- );
2285
+ oe(() => {
2286
+ kt(
2287
+ () => this._render(this._cfg),
2288
+ this._lastRenderTime,
2289
+ this._renderCount,
2290
+ (r) => {
2291
+ this._lastRenderTime = r;
2292
+ },
2293
+ (r) => {
2294
+ this._renderCount = r;
2295
+ },
2296
+ this._renderTimeoutId,
2297
+ (r) => {
2298
+ this._renderTimeoutId = r;
2299
+ }
2300
+ );
2301
+ }, this._componentId);
2018
2302
  });
2019
2303
  }
2020
2304
  // --- Style ---
2021
2305
  _applyStyle(r, i) {
2022
2306
  this._runLogicWithinErrorBoundary(r, () => {
2023
- dt(
2307
+ _t(
2024
2308
  this.shadowRoot,
2025
2309
  r,
2026
2310
  this.context,
@@ -2047,11 +2331,11 @@ function ht(e, t) {
2047
2331
  // --- State, props, computed ---
2048
2332
  _initContext(r) {
2049
2333
  try {
2050
- let i = function(o, s = "") {
2051
- return Array.isArray(o) ? new Proxy(o, {
2052
- get(a, f, p) {
2053
- const h = Reflect.get(a, f, p);
2054
- return typeof h == "function" && typeof f == "string" && [
2334
+ let i = function(s, o = "") {
2335
+ return Array.isArray(s) ? new Proxy(s, {
2336
+ get(a, c, u) {
2337
+ const m = Reflect.get(a, c, u);
2338
+ return typeof m == "function" && typeof c == "string" && [
2055
2339
  "push",
2056
2340
  "pop",
2057
2341
  "shift",
@@ -2059,44 +2343,44 @@ function ht(e, t) {
2059
2343
  "splice",
2060
2344
  "sort",
2061
2345
  "reverse"
2062
- ].includes(f) ? function(...u) {
2063
- const c = h.apply(a, u);
2346
+ ].includes(c) ? function(...p) {
2347
+ const l = m.apply(a, p);
2064
2348
  if (!n._initializing) {
2065
- const w = s || "root";
2066
- n._triggerWatchers(w, a), n._render(r);
2349
+ const w = o || "root";
2350
+ n._triggerWatchers(w, a), oe(() => n._render(r), n._componentId);
2067
2351
  }
2068
- return c;
2069
- } : h;
2352
+ return l;
2353
+ } : m;
2070
2354
  },
2071
- set(a, f, p) {
2072
- if (a[f] = p, !n._initializing) {
2073
- const h = s ? `${s}.${String(f)}` : String(f);
2074
- n._triggerWatchers(h, p), n._render(r);
2355
+ set(a, c, u) {
2356
+ if (a[c] = u, !n._initializing) {
2357
+ const m = o ? `${o}.${String(c)}` : String(c);
2358
+ n._triggerWatchers(m, u), oe(() => n._render(r), n._componentId);
2075
2359
  }
2076
2360
  return !0;
2077
2361
  },
2078
- deleteProperty(a, f) {
2079
- if (delete a[f], !n._initializing) {
2080
- const p = s ? `${s}.${String(f)}` : String(f);
2081
- n._triggerWatchers(p, void 0), n._render(r);
2362
+ deleteProperty(a, c) {
2363
+ if (delete a[c], !n._initializing) {
2364
+ const u = o ? `${o}.${String(c)}` : String(c);
2365
+ n._triggerWatchers(u, void 0), oe(() => n._render(r), n._componentId);
2082
2366
  }
2083
2367
  return !0;
2084
2368
  }
2085
- }) : o && typeof o == "object" ? (Object.keys(o).forEach((a) => {
2086
- const f = s ? `${s}.${a}` : a;
2087
- o[a] = i(o[a], f);
2088
- }), new Proxy(o, {
2089
- set(a, f, p) {
2090
- const h = s ? `${s}.${String(f)}` : String(f);
2091
- return a[f] = i(p, h), n._initializing || (n._triggerWatchers(
2092
- h,
2093
- a[f]
2094
- ), n._render(r)), !0;
2369
+ }) : s && typeof s == "object" ? (Object.keys(s).forEach((a) => {
2370
+ const c = o ? `${o}.${a}` : a;
2371
+ s[a] = i(s[a], c);
2372
+ }), new Proxy(s, {
2373
+ set(a, c, u) {
2374
+ const m = o ? `${o}.${String(c)}` : String(c);
2375
+ return a[c] = i(u, m), n._initializing || (n._triggerWatchers(
2376
+ m,
2377
+ a[c]
2378
+ ), oe(() => n._render(r), n._componentId)), !0;
2095
2379
  },
2096
- get(a, f, p) {
2097
- return Reflect.get(a, f, p);
2380
+ get(a, c, u) {
2381
+ return Reflect.get(a, c, u);
2098
2382
  }
2099
- })) : o;
2383
+ })) : s;
2100
2384
  };
2101
2385
  const n = this;
2102
2386
  return i({ ...r.state });
@@ -2106,7 +2390,7 @@ function ht(e, t) {
2106
2390
  }
2107
2391
  _initWatchers(r) {
2108
2392
  this._runLogicWithinErrorBoundary(r, () => {
2109
- qe(
2393
+ Ge(
2110
2394
  this.context,
2111
2395
  this._watchers,
2112
2396
  r.watch || {}
@@ -2114,12 +2398,12 @@ function ht(e, t) {
2114
2398
  });
2115
2399
  }
2116
2400
  _triggerWatchers(r, i) {
2117
- Ie(this.context, this._watchers, r, i);
2401
+ Ze(this.context, this._watchers, r, i);
2118
2402
  }
2119
2403
  _applyProps(r) {
2120
2404
  this._runLogicWithinErrorBoundary(r, () => {
2121
2405
  try {
2122
- Ne(this, r, this.context);
2406
+ Ye(this, r, this.context);
2123
2407
  } catch (i) {
2124
2408
  this._hasError = !0, r.onError && r.onError(i, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(i, this.context));
2125
2409
  }
@@ -2127,103 +2411,109 @@ function ht(e, t) {
2127
2411
  }
2128
2412
  };
2129
2413
  }
2130
- function re(e, t = {}, r, i) {
2414
+ function ae(e, t = {}, r, i) {
2131
2415
  const n = i ?? t.key;
2132
2416
  return { tag: e, key: n, props: t, children: r };
2133
2417
  }
2134
- function ue(e) {
2418
+ function ye(e) {
2135
2419
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
2136
2420
  }
2137
- function ae(e) {
2138
- return typeof e == "object" && e !== null && "tag" in e && !ue(e);
2421
+ function de(e) {
2422
+ return typeof e == "object" && e !== null && "tag" in e && !ye(e);
2139
2423
  }
2140
- function gt(e, t) {
2424
+ function Ct(e, t) {
2141
2425
  return e.key != null ? e : { ...e, key: t };
2142
2426
  }
2143
- function mt(e, t = [], r = {}) {
2144
- const i = {}, n = {}, o = {}, s = [], a = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
2145
- let f;
2146
- for (; f = a.exec(e); ) {
2147
- const p = f[1], h = f[2], C = (f[4] || f[6]) ?? "", u = C.match(/^{{(\d+)}}$/);
2148
- let c = u ? t[Number(u[1])] ?? null : C;
2149
- u || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
2427
+ function At(e, t = [], r = {}) {
2428
+ const i = {}, n = {}, s = {}, o = [], a = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
2429
+ let c;
2430
+ for (; c = a.exec(e); ) {
2431
+ const u = c[1], m = c[2], T = (c[4] || c[6]) ?? "", p = T.match(/^{{(\d+)}}$/);
2432
+ let l = p ? t[Number(p[1])] ?? null : T;
2433
+ p || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
2150
2434
  const w = ["model", "bind", "show", "class", "style"];
2151
- if (p === ":") {
2152
- const [v, d] = h.split(":"), [g, ...m] = v.split(".");
2435
+ if (u === ":") {
2436
+ const [v, d] = m.split(":"), [g, ...y] = v.split(".");
2153
2437
  if (w.includes(g)) {
2154
- const x = [...m], l = g === "model" && d ? `model:${d}` : g;
2155
- o[l] = {
2156
- value: c,
2438
+ const x = [...y], f = g === "model" && d ? `model:${d}` : g;
2439
+ s[f] = {
2440
+ value: l,
2157
2441
  modifiers: x,
2158
2442
  arg: d
2159
2443
  };
2160
2444
  } else
2161
- n[h] = c, s.push(h);
2162
- } else if (p === "@") {
2163
- const v = "on" + h.charAt(0).toUpperCase() + h.slice(1);
2164
- i[v] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
2165
- } else h === "ref" ? i.ref = c : n[h] = c;
2166
- }
2167
- return { props: i, attrs: n, directives: o, bound: s };
2168
- }
2169
- function yt(e, t, r) {
2170
- const i = ne.length > 0 ? ne[ne.length - 1] : void 0, n = r ?? i;
2171
- function o(l, b) {
2172
- return re("#text", {}, l, b);
2173
- }
2174
- let s = "";
2175
- for (let l = 0; l < e.length; l++)
2176
- s += e[l], l < t.length && (s += `{{${l}}}`);
2177
- const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, f = [];
2178
- let p, h = [], C = null, u = {}, c, w = 0, v = [];
2179
- function d(l) {
2180
- !l || typeof l != "object" || ue(l) || (l.props || l.attrs ? (l.props && (u.props || (u.props = {}), Object.assign(u.props, l.props)), l.attrs && (u.attrs || (u.attrs = {}), Object.keys(l.attrs).forEach((b) => {
2181
- if (b === "style" && u.attrs.style) {
2182
- const y = u.attrs.style.replace(
2445
+ n[m] = l, o.push(m);
2446
+ } else if (u === "@") {
2447
+ const [v, ...d] = m.split("."), g = d, y = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
2448
+ if (y) {
2449
+ const x = (b) => {
2450
+ if (g.includes("prevent") && b.preventDefault(), g.includes("stop") && b.stopPropagation(), !(g.includes("self") && b.target !== b.currentTarget))
2451
+ return g.includes("once") && b.currentTarget?.removeEventListener(v, x), y(b);
2452
+ }, f = "on" + v.charAt(0).toUpperCase() + v.slice(1);
2453
+ i[f] = x;
2454
+ }
2455
+ } else m === "ref" ? i.ref = l : n[m] = l;
2456
+ }
2457
+ return { props: i, attrs: n, directives: s, bound: o };
2458
+ }
2459
+ function Tt(e, t, r) {
2460
+ const i = ce.length > 0 ? ce[ce.length - 1] : void 0, n = r ?? i;
2461
+ function s(f, b) {
2462
+ return ae("#text", {}, f, b);
2463
+ }
2464
+ let o = "";
2465
+ for (let f = 0; f < e.length; f++)
2466
+ o += e[f], f < t.length && (o += `{{${f}}}`);
2467
+ const a = /<!--[\s\S]*?-->|<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
2468
+ let u, m = [], T = null, p = {}, l, w = 0, v = [];
2469
+ function d(f) {
2470
+ !f || typeof f != "object" || ye(f) || (f.props || f.attrs ? (f.props && (p.props || (p.props = {}), Object.assign(p.props, f.props)), f.attrs && (p.attrs || (p.attrs = {}), Object.keys(f.attrs).forEach((b) => {
2471
+ if (b === "style" && p.attrs.style) {
2472
+ const h = p.attrs.style.replace(
2183
2473
  /;?\s*$/,
2184
2474
  ""
2185
- ), _ = l.attrs.style.replace(/^;?\s*/, "");
2186
- u.attrs.style = y + "; " + _;
2187
- } else if (b === "class" && u.attrs.class) {
2188
- const y = u.attrs.class.trim().split(/\s+/).filter(Boolean), _ = l.attrs.class.trim().split(/\s+/).filter(Boolean), E = [
2189
- .../* @__PURE__ */ new Set([...y, ..._])
2475
+ ), _ = f.attrs.style.replace(/^;?\s*/, "");
2476
+ p.attrs.style = h + "; " + _;
2477
+ } else if (b === "class" && p.attrs.class) {
2478
+ const h = p.attrs.class.trim().split(/\s+/).filter(Boolean), _ = f.attrs.class.trim().split(/\s+/).filter(Boolean), $ = [
2479
+ .../* @__PURE__ */ new Set([...h, ..._])
2190
2480
  ];
2191
- u.attrs.class = E.join(" ");
2481
+ p.attrs.class = $.join(" ");
2192
2482
  } else
2193
- u.attrs[b] = l.attrs[b];
2194
- }))) : (u.props || (u.props = {}), Object.assign(u.props, l)));
2195
- }
2196
- function g(l, b) {
2197
- const y = C ? h : v;
2198
- if (ue(l)) {
2199
- const _ = l.key ?? b;
2200
- let E = l.children;
2201
- y.push({
2202
- ...l,
2483
+ p.attrs[b] = f.attrs[b];
2484
+ }))) : (p.props || (p.props = {}), Object.assign(p.props, f)));
2485
+ }
2486
+ function g(f, b) {
2487
+ const h = T ? m : v;
2488
+ if (ye(f)) {
2489
+ const _ = f.key ?? b;
2490
+ let $ = f.children;
2491
+ h.push({
2492
+ ...f,
2203
2493
  key: _,
2204
- children: E
2494
+ children: $
2205
2495
  });
2206
2496
  return;
2207
2497
  }
2208
- if (ae(l)) {
2209
- y.push(gt(l, void 0));
2498
+ if (de(f)) {
2499
+ h.push(Ct(f, void 0));
2210
2500
  return;
2211
2501
  }
2212
- if (Array.isArray(l)) {
2213
- if (l.length === 0) return;
2214
- for (let _ = 0; _ < l.length; _++) {
2215
- const E = l[_];
2216
- ue(E) || ae(E) || Array.isArray(E) ? g(E, `${b}-${_}`) : E !== null && typeof E == "object" ? d(E) : y.push(o(String(E), `${b}-${_}`));
2502
+ if (Array.isArray(f)) {
2503
+ if (f.length === 0) return;
2504
+ for (let _ = 0; _ < f.length; _++) {
2505
+ const $ = f[_];
2506
+ ye($) || de($) || Array.isArray($) ? g($, `${b}-${_}`) : $ !== null && typeof $ == "object" ? d($) : h.push(s(String($), `${b}-${_}`));
2217
2507
  }
2218
2508
  return;
2219
2509
  }
2220
- if (l !== null && typeof l == "object") {
2221
- d(l);
2510
+ if (f !== null && typeof f == "object") {
2511
+ d(f);
2222
2512
  return;
2223
2513
  }
2224
- y.push(o(String(l), b));
2514
+ h.push(s(String(f), b));
2225
2515
  }
2226
- const m = /* @__PURE__ */ new Set([
2516
+ const y = /* @__PURE__ */ new Set([
2227
2517
  "area",
2228
2518
  "base",
2229
2519
  "br",
@@ -2239,226 +2529,228 @@ function yt(e, t, r) {
2239
2529
  "track",
2240
2530
  "wbr"
2241
2531
  ]);
2242
- for (; p = a.exec(s); )
2243
- if (p[1]) {
2244
- const l = p[1], b = p[0][1] === "/", y = p[0][p[0].length - 2] === "/" || m.has(l), {
2245
- props: _,
2246
- attrs: E,
2247
- directives: S,
2248
- bound: A
2249
- } = mt(p[2] || "", t, n), $ = { props: {}, attrs: {} };
2250
- for (const T in _) $.props[T] = _[T];
2251
- for (const T in E) $.attrs[T] = E[T];
2252
- if ($.attrs && Object.prototype.hasOwnProperty.call($.attrs, "key") && !($.props && Object.prototype.hasOwnProperty.call($.props, "key")))
2253
- try {
2254
- $.props.key = $.attrs.key;
2255
- } catch {
2256
- }
2257
- try {
2258
- const T = {
2259
- input: ["value", "checked", "disabled", "readonly", "required", "placeholder", "maxlength", "minlength"],
2260
- textarea: ["value", "disabled", "readonly", "required", "placeholder", "maxlength", "minlength"],
2261
- select: ["value", "disabled", "required", "multiple"],
2262
- option: ["selected", "disabled", "value"],
2263
- video: ["muted", "autoplay", "controls", "loop", "playsinline"],
2264
- audio: ["muted", "autoplay", "controls", "loop"],
2265
- img: ["src", "alt", "width", "height"],
2266
- button: ["type", "name", "value", "disabled", "autofocus", "form"]
2267
- }, B = l.toLowerCase(), G = T[B] ?? [];
2268
- if ($.attrs)
2269
- for (const M of G)
2270
- A && A.includes(M) && M in $.attrs && !($.props && M in $.props) && ($.props[M] = $.attrs[M], delete $.attrs[M]);
2271
- if ((l.includes("-") || !!n?.__customElements?.has?.(l)) && A && $.attrs) {
2272
- const M = /* @__PURE__ */ new Set(["id", "name", "data-key", "key"]);
2273
- for (const U of A)
2274
- if (U in $.attrs && !($.props && U in $.props)) {
2275
- const q = U.includes("-") ? U.split("-").map((I, z) => z === 0 ? I : I.charAt(0).toUpperCase() + I.slice(1)).join("") : U;
2276
- $.props[q] = $.attrs[U], M.has(U) || delete $.attrs[U];
2277
- }
2278
- $.isCustomElement = !0;
2279
- }
2280
- } catch {
2281
- }
2282
- if (S && Object.keys(S).some((T) => T === "model" || T.startsWith("model:")))
2532
+ for (; u = a.exec(o); )
2533
+ if (!(u[0].startsWith("<!--") && u[0].endsWith("-->"))) {
2534
+ if (u[1]) {
2535
+ const f = u[1], b = u[0][1] === "/", h = u[0][u[0].length - 2] === "/" || y.has(f), {
2536
+ props: _,
2537
+ attrs: $,
2538
+ directives: S,
2539
+ bound: E
2540
+ } = At(u[2] || "", t, n), C = { props: {}, attrs: {} };
2541
+ for (const A in _) C.props[A] = _[A];
2542
+ for (const A in $) C.attrs[A] = $[A];
2543
+ if (C.attrs && Object.prototype.hasOwnProperty.call(C.attrs, "key") && !(C.props && Object.prototype.hasOwnProperty.call(C.props, "key")))
2544
+ try {
2545
+ C.props.key = C.attrs.key;
2546
+ } catch {
2547
+ }
2283
2548
  try {
2284
- const T = Symbol.for("cer.registry"), B = globalThis[T], G = !!(B && typeof B.has == "function" && B.has(l)), ee = !!(n && (n.__customElements instanceof Set && n.__customElements.has(l) || Array.isArray(n.__isCustomElements) && n.__isCustomElements.includes(l)));
2285
- if (!!(l.includes("-") || ee || G))
2286
- for (const q of Object.keys(S)) {
2287
- if (q !== "model" && !q.startsWith("model:")) continue;
2288
- const I = S[q], z = I.arg ?? (q.includes(":") ? q.split(":", 2)[1] : void 0), H = I.value, F = z ?? "modelValue", te = W, k = ce, P = n ? n._state || n : void 0;
2289
- let R;
2290
- typeof H == "string" && n ? R = te(P, H) : R = H, $.props[F] = R;
2291
- try {
2292
- const L = Y(F);
2293
- $.attrs || ($.attrs = {}), R !== void 0 && ($.attrs[L] = R);
2294
- } catch {
2549
+ const A = {
2550
+ input: ["value", "checked", "disabled", "readonly", "required", "placeholder", "maxlength", "minlength"],
2551
+ textarea: ["value", "disabled", "readonly", "required", "placeholder", "maxlength", "minlength"],
2552
+ select: ["value", "disabled", "required", "multiple"],
2553
+ option: ["selected", "disabled", "value"],
2554
+ video: ["muted", "autoplay", "controls", "loop", "playsinline"],
2555
+ audio: ["muted", "autoplay", "controls", "loop"],
2556
+ img: ["src", "alt", "width", "height"],
2557
+ button: ["type", "name", "value", "disabled", "autofocus", "form"]
2558
+ }, P = f.toLowerCase(), X = A[P] ?? [];
2559
+ if (C.attrs)
2560
+ for (const M of X)
2561
+ E && E.includes(M) && M in C.attrs && !(C.props && M in C.props) && (C.props[M] = C.attrs[M], delete C.attrs[M]);
2562
+ if ((f.includes("-") || !!n?.__customElements?.has?.(f)) && E && C.attrs) {
2563
+ const M = /* @__PURE__ */ new Set(["id", "name", "data-key", "key"]);
2564
+ for (const F of E)
2565
+ if (F in C.attrs && !(C.props && F in C.props)) {
2566
+ const H = F.includes("-") ? F.split("-").map((N, I) => I === 0 ? N : N.charAt(0).toUpperCase() + N.slice(1)).join("") : F;
2567
+ C.props[H] = C.attrs[F], M.has(F) || delete C.attrs[F];
2295
2568
  }
2296
- $.isCustomElement = !0;
2297
- const O = `update:${Y(F)}`, j = "on" + O.charAt(0).toUpperCase() + O.slice(1);
2298
- $.props[j] = function(L) {
2299
- const se = L.detail !== void 0 ? L.detail : L.target ? L.target.value : void 0;
2300
- if (!P) return;
2301
- const he = te(P, typeof H == "string" ? H : String(H));
2302
- (Array.isArray(se) && Array.isArray(he) ? JSON.stringify([...se].sort()) !== JSON.stringify([...he].sort()) : se !== he) && (k(P, typeof H == "string" ? H : String(H), se), n?.requestRender ? n.requestRender() : n?._requestRender && n._requestRender());
2303
- }, delete S[q];
2304
- }
2569
+ C.isCustomElement = !0;
2570
+ }
2305
2571
  } catch {
2306
2572
  }
2307
- if (Object.keys(S).length > 0 && ($.directives = { ...S }), b) {
2308
- const T = re(
2309
- C,
2310
- u,
2311
- h.length === 1 && ae(h[0]) && h[0].tag === "#text" ? typeof h[0].children == "string" ? h[0].children : "" : h.length ? h : void 0,
2312
- c
2313
- ), B = f.pop();
2314
- B ? (C = B.tag, u = B.props, c = B.key, h = B.children, h.push(T)) : (v.push(T), C = null, u = {}, c = void 0, h = []);
2315
- } else y ? C ? h.push(re(l, $, void 0, void 0)) : v.push(re(l, $, void 0, void 0)) : (C && f.push({
2316
- tag: C,
2317
- props: u,
2318
- children: h,
2319
- key: c
2320
- }), C = l, u = $, h = []);
2321
- } else if (typeof p[3] < "u") {
2322
- const l = Number(p[3]), b = t[l], y = `interp-${l}`;
2323
- g(b, y);
2324
- } else if (p[4]) {
2325
- const l = p[4], b = C ? h : v, y = l.split(/({{\d+}})/);
2326
- for (const _ of y) {
2327
- if (!_) continue;
2328
- const E = _.match(/^{{(\d+)}}$/);
2329
- if (E) {
2330
- const S = Number(E[1]), A = t[S], $ = `interp-${S}`;
2331
- g(A, $);
2332
- } else {
2333
- const S = `text-${w++}`;
2334
- b.push(o(_, S));
2573
+ if (S && Object.keys(S).some((A) => A === "model" || A.startsWith("model:")))
2574
+ try {
2575
+ const A = Symbol.for("cer.registry"), P = globalThis[A], X = !!(P && typeof P.has == "function" && P.has(f)), ie = !!(n && (n.__customElements instanceof Set && n.__customElements.has(f) || Array.isArray(n.__isCustomElements) && n.__isCustomElements.includes(f)));
2576
+ if (!!(f.includes("-") || ie || X))
2577
+ for (const H of Object.keys(S)) {
2578
+ if (H !== "model" && !H.startsWith("model:")) continue;
2579
+ const N = S[H], I = N.arg ?? (H.includes(":") ? H.split(":", 2)[1] : void 0), z = N.value, J = I ?? "modelValue", se = K, k = he, W = n ? n._state || n : void 0;
2580
+ let R;
2581
+ typeof z == "string" && n ? R = se(W, z) : R = z, C.props[J] = R;
2582
+ try {
2583
+ const L = Q(J);
2584
+ C.attrs || (C.attrs = {}), R !== void 0 && (C.attrs[L] = R);
2585
+ } catch {
2586
+ }
2587
+ C.isCustomElement = !0;
2588
+ const B = `update:${Q(J)}`, j = "on" + B.charAt(0).toUpperCase() + B.slice(1);
2589
+ C.props[j] = function(L) {
2590
+ const fe = L.detail !== void 0 ? L.detail : L.target ? L.target.value : void 0;
2591
+ if (!W) return;
2592
+ const ve = se(W, typeof z == "string" ? z : String(z));
2593
+ (Array.isArray(fe) && Array.isArray(ve) ? JSON.stringify([...fe].sort()) !== JSON.stringify([...ve].sort()) : fe !== ve) && (k(W, typeof z == "string" ? z : String(z), fe), n?.requestRender ? n.requestRender() : n?._requestRender && n._requestRender());
2594
+ }, delete S[H];
2595
+ }
2596
+ } catch {
2597
+ }
2598
+ if (Object.keys(S).length > 0 && (C.directives = { ...S }), b) {
2599
+ const A = ae(
2600
+ T,
2601
+ p,
2602
+ m.length === 1 && de(m[0]) && m[0].tag === "#text" ? typeof m[0].children == "string" ? m[0].children : "" : m.length ? m : void 0,
2603
+ l
2604
+ ), P = c.pop();
2605
+ P ? (T = P.tag, p = P.props, l = P.key, m = P.children, m.push(A)) : (v.push(A), T = null, p = {}, l = void 0, m = []);
2606
+ } else h ? T ? m.push(ae(f, C, void 0, void 0)) : v.push(ae(f, C, void 0, void 0)) : (T && c.push({
2607
+ tag: T,
2608
+ props: p,
2609
+ children: m,
2610
+ key: l
2611
+ }), T = f, p = C, m = []);
2612
+ } else if (typeof u[3] < "u") {
2613
+ const f = Number(u[3]), b = t[f], h = `interp-${f}`;
2614
+ g(b, h);
2615
+ } else if (u[4]) {
2616
+ const f = u[4], b = T ? m : v, h = f.split(/({{\d+}})/);
2617
+ for (const _ of h) {
2618
+ if (!_) continue;
2619
+ const $ = _.match(/^{{(\d+)}}$/);
2620
+ if ($) {
2621
+ const S = Number($[1]), E = t[S], C = `interp-${S}`;
2622
+ g(E, C);
2623
+ } else {
2624
+ const S = `text-${w++}`;
2625
+ b.push(s(_, S));
2626
+ }
2335
2627
  }
2336
2628
  }
2337
2629
  }
2338
- const x = v.filter((l) => ae(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0);
2339
- return x.length === 1 ? x[0] : x.length > 1 ? x : re("div", {}, "", "fallback-root");
2630
+ const x = v.filter((f) => de(f) && f.tag === "#text" ? typeof f.children == "string" && f.children.trim() !== "" : !0);
2631
+ return x.length === 1 ? x[0] : x.length > 1 ? x : ae("div", {}, "", "fallback-root");
2340
2632
  }
2341
- function Z(e, ...t) {
2633
+ function ee(e, ...t) {
2342
2634
  const r = t[t.length - 1], i = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2343
- return yt(e, t, i);
2635
+ return Tt(e, t, i);
2344
2636
  }
2345
- const Re = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, K = (e, t) => {
2637
+ const qe = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, V = (e, t) => {
2346
2638
  for (const r of e) {
2347
- const i = [], n = r.path.replace(/:[^/]+/g, (a) => (i.push(a.slice(1)), "([^/]+)")), o = new RegExp(`^${n}$`), s = t.match(o);
2348
- if (s) {
2639
+ const i = [], n = r.path.replace(/:[^/]+/g, (a) => (i.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${n}$`), o = t.match(s);
2640
+ if (o) {
2349
2641
  const a = {};
2350
- return i.forEach((f, p) => {
2351
- a[f] = s[p + 1];
2642
+ return i.forEach((c, u) => {
2643
+ a[c] = o[u + 1];
2352
2644
  }), { route: r, params: a };
2353
2645
  }
2354
2646
  }
2355
2647
  return { route: null, params: {} };
2356
- }, ke = {};
2357
- async function bt(e) {
2648
+ }, Te = {};
2649
+ async function jt(e) {
2358
2650
  if (e.component) return e.component;
2359
2651
  if (e.load) {
2360
- if (ke[e.path]) return ke[e.path];
2652
+ if (Te[e.path]) return Te[e.path];
2361
2653
  try {
2362
2654
  const t = await e.load();
2363
- return ke[e.path] = t.default, t.default;
2655
+ return Te[e.path] = t.default, t.default;
2364
2656
  } catch {
2365
2657
  throw new Error(`Failed to load component for route: ${e.path}`);
2366
2658
  }
2367
2659
  }
2368
2660
  throw new Error(`No component or loader defined for route: ${e.path}`);
2369
2661
  }
2370
- function wt(e) {
2662
+ function Lt(e) {
2371
2663
  const { routes: t, base: r = "", initialUrl: i } = e;
2372
- let n, o, s, a, f, p, h;
2373
- const C = async (v, d) => {
2374
- const g = t.find((m) => K([m], v.path).route !== null);
2664
+ let n, s, o, a, c, u, m;
2665
+ const T = async (v, d) => {
2666
+ const g = t.find((y) => V([y], v.path).route !== null);
2375
2667
  if (g?.beforeEnter)
2376
2668
  try {
2377
- const m = await g.beforeEnter(v, d);
2378
- return typeof m == "string" ? (await w(m, !0), !1) : m !== !1;
2379
- } catch (m) {
2380
- return console.error("beforeEnter error", m), !1;
2669
+ const y = await g.beforeEnter(v, d);
2670
+ return typeof y == "string" ? (await w(y, !0), !1) : y !== !1;
2671
+ } catch (y) {
2672
+ return Y("beforeEnter error", y), !1;
2381
2673
  }
2382
2674
  return !0;
2383
- }, u = async (v, d) => {
2384
- const g = t.find((m) => K([m], v.path).route !== null);
2675
+ }, p = async (v, d) => {
2676
+ const g = t.find((y) => V([y], v.path).route !== null);
2385
2677
  if (g?.onEnter)
2386
2678
  try {
2387
- const m = await g.onEnter(v, d);
2388
- return typeof m == "string" ? (await w(m, !0), !1) : m !== !1;
2389
- } catch (m) {
2390
- return console.error("onEnter error", m), !1;
2679
+ const y = await g.onEnter(v, d);
2680
+ return typeof y == "string" ? (await w(y, !0), !1) : y !== !1;
2681
+ } catch (y) {
2682
+ return Y("onEnter error", y), !1;
2391
2683
  }
2392
2684
  return !0;
2393
- }, c = (v, d) => {
2394
- const g = t.find((m) => K([m], v.path).route !== null);
2685
+ }, l = (v, d) => {
2686
+ const g = t.find((y) => V([y], v.path).route !== null);
2395
2687
  if (g?.afterEnter)
2396
2688
  try {
2397
2689
  g.afterEnter(v, d);
2398
- } catch (m) {
2399
- console.error("afterEnter error", m);
2690
+ } catch (y) {
2691
+ Y("afterEnter error", y);
2400
2692
  }
2401
2693
  }, w = async (v, d = !1) => {
2402
2694
  try {
2403
2695
  const g = {
2404
2696
  path: v.replace(r, "") || "/",
2405
2697
  query: {}
2406
- }, m = K(t, g.path);
2407
- if (!m) throw new Error(`No route found for ${g.path}`);
2408
- const x = s.getState(), l = {
2698
+ }, y = V(t, g.path);
2699
+ if (!y) throw new Error(`No route found for ${g.path}`);
2700
+ const x = o.getState(), f = {
2409
2701
  path: g.path,
2410
- params: m.params,
2702
+ params: y.params,
2411
2703
  query: g.query
2412
2704
  };
2413
- if (!await C(l, x) || !await u(l, x)) return;
2414
- typeof window < "u" && typeof document < "u" && (d ? window.history.replaceState({}, "", r + v) : window.history.pushState({}, "", r + v)), s.setState(l), c(l, x);
2705
+ if (!await T(f, x) || !await p(f, x)) return;
2706
+ typeof window < "u" && typeof document < "u" && (d ? window.history.replaceState({}, "", r + v) : window.history.pushState({}, "", r + v)), o.setState(f), l(f, x);
2415
2707
  } catch (g) {
2416
- console.error("Navigation error:", g);
2708
+ Y("Navigation error:", g);
2417
2709
  }
2418
2710
  };
2419
2711
  if (typeof window < "u" && typeof document < "u") {
2420
2712
  n = () => {
2421
- const d = new URL(window.location.href), g = d.pathname.replace(r, "") || "/", m = Re(d.search);
2422
- return { path: g, query: m };
2423
- }, o = n();
2424
- const v = K(t, o.path);
2425
- s = $e({
2426
- path: o.path,
2713
+ const d = new URL(window.location.href), g = d.pathname.replace(r, "") || "/", y = qe(d.search);
2714
+ return { path: g, query: y };
2715
+ }, s = n();
2716
+ const v = V(t, s.path);
2717
+ o = Le({
2718
+ path: s.path,
2427
2719
  params: v.params,
2428
- query: o.query
2720
+ query: s.query
2429
2721
  }), a = async (d = !1) => {
2430
2722
  const g = n();
2431
2723
  await w(g.path, d);
2432
- }, window.addEventListener("popstate", () => a(!0)), f = (d) => w(d, !1), p = (d) => w(d, !0), h = () => window.history.back();
2724
+ }, window.addEventListener("popstate", () => a(!0)), c = (d) => w(d, !1), u = (d) => w(d, !0), m = () => window.history.back();
2433
2725
  } else {
2434
2726
  n = () => {
2435
- const g = new URL(i || "/", "http://localhost"), m = g.pathname.replace(r, "") || "/", x = Re(g.search);
2436
- return { path: m, query: x };
2437
- }, o = n();
2438
- const v = K(t, o.path);
2439
- s = $e({
2440
- path: o.path,
2727
+ const g = new URL(i || "/", "http://localhost"), y = g.pathname.replace(r, "") || "/", x = qe(g.search);
2728
+ return { path: y, query: x };
2729
+ }, s = n();
2730
+ const v = V(t, s.path);
2731
+ o = Le({
2732
+ path: s.path,
2441
2733
  params: v.params,
2442
- query: o.query
2734
+ query: s.query
2443
2735
  }), a = async () => {
2444
2736
  const g = n();
2445
2737
  await d(g.path);
2446
2738
  };
2447
2739
  const d = async (g) => {
2448
2740
  try {
2449
- const m = {
2741
+ const y = {
2450
2742
  path: g.replace(r, "") || "/",
2451
2743
  query: {}
2452
- }, x = K(t, m.path);
2453
- if (!x) throw new Error(`No route found for ${m.path}`);
2454
- const l = s.getState(), b = {
2455
- path: m.path,
2744
+ }, x = V(t, y.path);
2745
+ if (!x) throw new Error(`No route found for ${y.path}`);
2746
+ const f = o.getState(), b = {
2747
+ path: y.path,
2456
2748
  params: x.params,
2457
- query: m.query
2458
- }, y = t.find((_) => K([_], b.path).route !== null);
2459
- if (y?.beforeEnter)
2749
+ query: y.query
2750
+ }, h = t.find((_) => V([_], b.path).route !== null);
2751
+ if (h?.beforeEnter)
2460
2752
  try {
2461
- const _ = await y.beforeEnter(b, l);
2753
+ const _ = await h.beforeEnter(b, f);
2462
2754
  if (typeof _ == "string") {
2463
2755
  await d(_);
2464
2756
  return;
@@ -2467,9 +2759,9 @@ function wt(e) {
2467
2759
  } catch {
2468
2760
  return;
2469
2761
  }
2470
- if (y?.onEnter)
2762
+ if (h?.onEnter)
2471
2763
  try {
2472
- const _ = await y.onEnter(b, l);
2764
+ const _ = await h.onEnter(b, f);
2473
2765
  if (typeof _ == "string") {
2474
2766
  await d(_);
2475
2767
  return;
@@ -2478,49 +2770,49 @@ function wt(e) {
2478
2770
  } catch {
2479
2771
  return;
2480
2772
  }
2481
- if (s.setState(b), y?.afterEnter)
2773
+ if (o.setState(b), h?.afterEnter)
2482
2774
  try {
2483
- y.afterEnter(b, l);
2775
+ h.afterEnter(b, f);
2484
2776
  } catch {
2485
2777
  }
2486
2778
  } catch {
2487
2779
  }
2488
2780
  };
2489
- f = async (g) => d(g), p = async (g) => d(g), h = () => {
2781
+ c = async (g) => d(g), u = async (g) => d(g), m = () => {
2490
2782
  };
2491
2783
  }
2492
2784
  return {
2493
- store: s,
2494
- push: f,
2495
- replace: p,
2496
- back: h,
2497
- subscribe: s.subscribe,
2498
- matchRoute: (v) => K(t, v),
2499
- getCurrent: () => s.getState(),
2500
- resolveRouteComponent: bt
2785
+ store: o,
2786
+ push: c,
2787
+ replace: u,
2788
+ back: m,
2789
+ subscribe: o.subscribe,
2790
+ matchRoute: (v) => V(t, v),
2791
+ getCurrent: () => o.getState(),
2792
+ resolveRouteComponent: jt
2501
2793
  };
2502
2794
  }
2503
- function At(e, t) {
2504
- return K(e, t);
2795
+ function Zt(e, t) {
2796
+ return V(e, t);
2505
2797
  }
2506
- function Tt(e) {
2507
- const t = wt(e);
2508
- return Le("router-view", {
2798
+ function Yt(e) {
2799
+ const t = Lt(e);
2800
+ return Ie("router-view", {
2509
2801
  async render() {
2510
- if (!t) return Z`<div>Router not initialized.</div>`;
2802
+ if (!t) return ee`<div>Router not initialized.</div>`;
2511
2803
  const r = t.getCurrent(), { path: i } = r, n = t.matchRoute(i);
2512
- if (!n.route) return Z`<div>Not found</div>`;
2804
+ if (!n.route) return ee`<div>Not found</div>`;
2513
2805
  try {
2514
- const o = await t.resolveRouteComponent(n.route);
2515
- if (typeof o == "string")
2516
- return { tag: o, props: {}, children: [] };
2517
- if (typeof o == "function") {
2518
- const s = o(), a = s instanceof Promise ? await s : s;
2806
+ const s = await t.resolveRouteComponent(n.route);
2807
+ if (typeof s == "string")
2808
+ return { tag: s, props: {}, children: [] };
2809
+ if (typeof s == "function") {
2810
+ const o = s(), a = o instanceof Promise ? await o : o;
2519
2811
  return typeof a == "string" ? { tag: a, props: {}, children: [] } : a;
2520
2812
  }
2521
- return Z`<div>Invalid route component</div>`;
2813
+ return ee`<div>Invalid route component</div>`;
2522
2814
  } catch {
2523
- return Z`<div>Invalid route component</div>`;
2815
+ return ee`<div>Invalid route component</div>`;
2524
2816
  }
2525
2817
  },
2526
2818
  onConnected(r) {
@@ -2528,7 +2820,7 @@ function Tt(e) {
2528
2820
  typeof r.requestRender == "function" && r.requestRender();
2529
2821
  });
2530
2822
  }
2531
- }), Le("router-link", {
2823
+ }), Ie("router-link", {
2532
2824
  state: {},
2533
2825
  props: {
2534
2826
  to: { type: String, default: "" },
@@ -2541,7 +2833,7 @@ function Tt(e) {
2541
2833
  disabled: { type: Boolean, default: !1 },
2542
2834
  external: { type: Boolean, default: !1 },
2543
2835
  class: { type: String, default: "" },
2544
- style: { type: String, default: Pe`
2836
+ style: { type: String, default: Ue`
2545
2837
  [aria-disabled="true"] {
2546
2838
  pointer-events: none;
2547
2839
  opacity: 0.5;
@@ -2550,32 +2842,32 @@ function Tt(e) {
2550
2842
  },
2551
2843
  style: (r) => r.style,
2552
2844
  render: (r) => {
2553
- const i = t.getCurrent(), n = r.to, o = r.exact, s = r.exactActiveClass, a = r.activeClass, f = r.ariaCurrentValue, p = r.tag, h = r.disabled, C = r.external, u = i.path === n, c = o ? u : i && typeof i.path == "string" ? i.path.startsWith(n) : !1, w = u ? `aria-current="${f}"` : "", v = (r.class || "").split(/\s+/).filter(Boolean), d = {};
2845
+ const i = t.getCurrent(), n = r.to, s = r.exact, o = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, u = r.tag, m = r.disabled, T = r.external, p = i.path === n, l = s ? p : i && typeof i.path == "string" ? i.path.startsWith(n) : !1, w = p ? `aria-current="${c}"` : "", v = (r.class || "").split(/\s+/).filter(Boolean), d = {};
2554
2846
  for (const b of v) d[b] = !0;
2555
2847
  const g = {
2556
2848
  ...d,
2557
2849
  // Also include the configurable names (may duplicate the above)
2558
- [a]: c,
2559
- [s]: u
2560
- }, m = p === "button", x = h ? m ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", l = C && (p === "a" || !p) ? 'target="_blank" rel="noopener noreferrer"' : "";
2561
- return Z`
2562
- ${ze().when(m, Z`
2850
+ [a]: l,
2851
+ [o]: p
2852
+ }, y = u === "button", x = m ? y ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", f = T && (u === "a" || !u) ? 'target="_blank" rel="noopener noreferrer"' : "";
2853
+ return ee`
2854
+ ${Ke().when(y, ee`
2563
2855
  <button
2564
2856
  part="button"
2565
2857
  :class="${g}"
2566
2858
  ${w}
2567
2859
  ${x}
2568
- ${l}
2860
+ ${f}
2569
2861
  @click="navigate"
2570
2862
  ><slot></slot></button>
2571
- `).otherwise(Z`
2863
+ `).otherwise(ee`
2572
2864
  <a
2573
2865
  part="link"
2574
2866
  href="${n}"
2575
2867
  :class="${g}"
2576
2868
  ${w}
2577
2869
  ${x}
2578
- ${l}
2870
+ ${f}
2579
2871
  @click="navigate"
2580
2872
  ><slot></slot></a>
2581
2873
  `).done()}
@@ -2591,26 +2883,42 @@ function Tt(e) {
2591
2883
  }), t;
2592
2884
  }
2593
2885
  export {
2594
- X as GlobalEventBus,
2595
- Le as component,
2596
- $e as createStore,
2597
- Pe as css,
2598
- kt as each,
2599
- _t as emit,
2600
- ie as eventBus,
2601
- Z as html,
2602
- Tt as initRouter,
2603
- Ct as listen,
2604
- ze as match,
2605
- K as matchRoute,
2606
- At as matchRouteSSR,
2607
- St as off,
2608
- $t as on,
2609
- Et as once,
2610
- Re as parseQuery,
2611
- ge as renderToString,
2612
- bt as resolveRouteComponent,
2613
- wt as useRouter,
2614
- vt as when
2886
+ ne as GlobalEventBus,
2887
+ O as anchorBlock,
2888
+ Ie as component,
2889
+ Le as createStore,
2890
+ Ue as css,
2891
+ Ot as each,
2892
+ qt as eachGroup,
2893
+ zt as eachPage,
2894
+ Wt as eachWhere,
2895
+ Ft as emit,
2896
+ le as eventBus,
2897
+ ee as html,
2898
+ Yt as initRouter,
2899
+ Gt as listen,
2900
+ Ke as match,
2901
+ V as matchRoute,
2902
+ Zt as matchRouteSSR,
2903
+ G as mediaVariants,
2904
+ Jt as off,
2905
+ Kt as on,
2906
+ Vt as once,
2907
+ qe as parseQuery,
2908
+ ke as renderToString,
2909
+ jt as resolveRouteComponent,
2910
+ Ve as responsive,
2911
+ ze as responsiveOrder,
2912
+ Dt as responsiveSwitch,
2913
+ Ut as switchOn,
2914
+ It as switchOnLength,
2915
+ Ht as switchOnPromise,
2916
+ Pt as unless,
2917
+ Lt as useRouter,
2918
+ we as when,
2919
+ Mt as whenEmpty,
2920
+ q as whenMedia,
2921
+ Bt as whenNotEmpty,
2922
+ Nt as whenVariants
2615
2923
  };
2616
2924
  //# sourceMappingURL=custom-elements-runtime.es.js.map