@jasonshimmy/custom-elements-runtime 0.2.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,13 +1,13 @@
1
- function xt(e, t) {
2
- return fe(e ? t : [], "when-block");
1
+ function vt(e, t) {
2
+ return pe(e ? t : [], "when-block");
3
3
  }
4
4
  function kt(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 fe(t(r, i), `each-${n}`);
7
+ return pe(t(r, i), `each-${n}`);
8
8
  });
9
9
  }
10
- function Pe() {
10
+ function ze() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function Pe() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return Ne(...e);
20
+ return He(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function Ne(...e) {
24
+ function He(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, i] = e[t];
27
- if (r) return [fe(i, `whenChain-branch-${t}`)];
27
+ if (r) return [pe(i, `whenChain-branch-${t}`)];
28
28
  }
29
- return [fe([], "whenChain-empty")];
29
+ return [pe([], "whenChain-empty")];
30
30
  }
31
- function fe(e, t) {
31
+ function pe(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,7 @@ function fe(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class G extends EventTarget {
39
+ class X extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class G extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return G.instance || (G.instance = new G()), G.instance;
47
+ return X.instance || (X.instance = new X()), X.instance;
48
48
  }
49
49
  /**
50
50
  * Emit a global event with optional data. Includes event storm protection.
@@ -63,10 +63,10 @@ class G extends EventTarget {
63
63
  // Global events don't need to bubble
64
64
  cancelable: !0
65
65
  }));
66
- const s = this.handlers[t];
67
- s && s.forEach((o) => {
66
+ const o = this.handlers[t];
67
+ o && o.forEach((s) => {
68
68
  try {
69
- o(r);
69
+ s(r);
70
70
  } catch (a) {
71
71
  console.error(`Error in global event handler for "${t}":`, a);
72
72
  }
@@ -112,8 +112,8 @@ class G extends EventTarget {
112
112
  */
113
113
  once(t, r) {
114
114
  return new Promise((i) => {
115
- const n = this.on(t, (s) => {
116
- n(), r(s), i(s);
115
+ const n = this.on(t, (o) => {
116
+ n(), r(o), i(o);
117
117
  });
118
118
  });
119
119
  }
@@ -157,7 +157,7 @@ class G extends EventTarget {
157
157
  this.eventCounters.clear();
158
158
  }
159
159
  }
160
- const re = G.getInstance(), vt = (e, t) => re.emit(e, t), $t = (e, t) => re.on(e, t), _t = (e, t) => re.off(e, t), St = (e, t) => re.once(e, t), Et = (e, t, r) => re.listen(e, t, r);
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
161
  function $e(e) {
162
162
  let t = { ...e };
163
163
  const r = [];
@@ -167,19 +167,19 @@ function $e(e) {
167
167
  function n() {
168
168
  return t;
169
169
  }
170
- function s(a) {
170
+ function o(a) {
171
171
  const f = typeof a == "function" ? a(t) : a;
172
- t = { ...t, ...f }, o();
172
+ t = { ...t, ...f }, s();
173
173
  }
174
- function o() {
174
+ function s() {
175
175
  r.forEach((a) => a(t));
176
176
  }
177
- return { subscribe: i, getState: n, setState: s };
177
+ return { subscribe: i, getState: n, setState: o };
178
178
  }
179
- function J(e) {
179
+ function Y(e) {
180
180
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
181
181
  }
182
- function H(e) {
182
+ function J(e) {
183
183
  return typeof e == "string" ? e.replace(
184
184
  /[&<>"']/g,
185
185
  (t) => ({
@@ -191,77 +191,83 @@ function H(e) {
191
191
  })[t]
192
192
  ) : e;
193
193
  }
194
- function z(e, t) {
194
+ function W(e, t) {
195
195
  return typeof t == "string" ? t.split(".").reduce((r, i) => r?.[i], e) : t;
196
196
  }
197
- function oe(e, t, r) {
197
+ function ce(e, t, r) {
198
198
  const i = String(t).split("."), n = i.pop();
199
199
  if (!n) return;
200
- const s = i.reduce((o, a) => (o[a] == null && (o[a] = {}), o[a]), e);
201
- s[n] = r;
200
+ const o = i.reduce((s, a) => (s[a] == null && (s[a] = {}), s[a]), e);
201
+ o[n] = r;
202
202
  }
203
- function ze(e, t, r) {
203
+ function qe(e, t, r) {
204
204
  if (r)
205
205
  for (const [i, n] of Object.entries(r)) {
206
- let s, o = {};
207
- if (Array.isArray(n) ? (s = n[0], o = n[1] || {}) : s = n, t.set(i, {
208
- callback: s,
209
- options: o,
210
- oldValue: z(e, i)
211
- }), o.immediate)
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)
212
212
  try {
213
- const a = z(e, i);
214
- s(a, void 0, e);
213
+ const a = W(e, i);
214
+ o(a, void 0, e);
215
215
  } catch (a) {
216
216
  console.error(`Error in immediate watcher for "${i}":`, a);
217
217
  }
218
218
  }
219
219
  }
220
- function Me(e, t, r, i) {
221
- const n = (o, a) => {
222
- if (o === a) return !0;
223
- if (typeof o != typeof a || typeof o != "object" || o === null || a === null) return !1;
224
- if (Array.isArray(o) && Array.isArray(a))
225
- return o.length !== a.length ? !1 : o.every((d, y) => n(d, a[y]));
226
- const f = Object.keys(o), u = Object.keys(a);
227
- return f.length !== u.length ? !1 : f.every((d) => n(o[d], a[d]));
228
- }, s = t.get(r);
229
- if (s && !n(i, s.oldValue))
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))
230
230
  try {
231
- s.callback(i, s.oldValue, e), s.oldValue = i;
232
- } catch (o) {
233
- console.error(`Error in watcher for "${r}":`, o);
231
+ o.callback(i, o.oldValue, e), o.oldValue = i;
232
+ } catch (s) {
233
+ console.error(`Error in watcher for "${r}":`, s);
234
234
  }
235
- for (const [o, a] of t.entries())
236
- if (a.options.deep && r.startsWith(o + "."))
235
+ for (const [s, a] of t.entries())
236
+ if (a.options.deep && r.startsWith(s + "."))
237
237
  try {
238
- const f = z(e, o);
238
+ const f = W(e, s);
239
239
  n(f, a.oldValue) || (a.callback(f, a.oldValue, e), a.oldValue = f);
240
240
  } catch (f) {
241
- console.error(`Error in deep watcher for "${o}":`, f);
241
+ console.error(`Error in deep watcher for "${s}":`, f);
242
242
  }
243
243
  }
244
- function We(e, t, r) {
244
+ function Ne(e, t, r) {
245
245
  if (!t.props) return;
246
- function i(n, s) {
247
- return s === Boolean ? n === "true" : s === Number ? Number(n) : n;
246
+ function i(n, o) {
247
+ return o === Boolean ? n === "true" : o === Number ? Number(n) : n;
248
248
  }
249
- Object.entries(t.props).forEach(([n, s]) => {
250
- if (s.type === Function && typeof e[n] == "function")
249
+ Object.entries(t.props).forEach(([n, o]) => {
250
+ if (o.type === Function && typeof e[n] == "function")
251
251
  r[n] = e[n];
252
252
  else {
253
- const o = e.getAttribute(J(n));
254
- o !== null ? r[n] = H(i(o, s.type)) : "default" in s && s.default !== void 0 && (r[n] = H(s.default));
253
+ const s = Y(n), a = e.getAttribute(s);
254
+ if (typeof e[n] < "u")
255
+ try {
256
+ r[n] = J(i(e[n], o.type));
257
+ } catch {
258
+ r[n] = e[n];
259
+ }
260
+ else a !== null ? r[n] = J(i(a, o.type)) : "default" in o && o.default !== void 0 && (r[n] = J(o.default));
255
261
  }
256
262
  });
257
263
  }
258
- function qe(e, t, r, i) {
264
+ function We(e, t, r, i) {
259
265
  e.onConnected && !r && (e.onConnected(t), i(!0));
260
266
  }
261
- function De(e, t, r, i, n, s, o, a) {
262
- e.onDisconnected && e.onDisconnected(t), r.forEach((f) => f()), i(), n(), s(!1), o(null), a(!1);
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);
263
269
  }
264
- function Ie(e, t, r, i, n) {
270
+ function Ue(e, t, r, i, n) {
265
271
  e.onAttributeChanged && e.onAttributeChanged(t, r, i, n);
266
272
  }
267
273
  function V(e, t) {
@@ -272,94 +278,94 @@ function V(e, t) {
272
278
  V(r, t);
273
279
  }
274
280
  }
275
- function He(e, t, r, i, n, s, o, a) {
276
- if (!s) return;
277
- const f = t.includes("lazy"), u = t.includes("trim"), d = t.includes("number"), y = () => z(s._state || s, e), c = y();
278
- let h = "text";
279
- o instanceof HTMLInputElement ? h = i?.type || o.type || "text" : o instanceof HTMLSelectElement ? h = "select" : o instanceof HTMLTextAreaElement && (h = "textarea");
280
- const k = o instanceof HTMLInputElement || o instanceof HTMLTextAreaElement || o instanceof HTMLSelectElement, w = k ? h === "checkbox" || h === "radio" ? "checked" : "value" : a ?? "modelValue";
281
- if (h === "checkbox")
282
- if (Array.isArray(c))
283
- r[w] = c.includes(String(o?.getAttribute("value") ?? i?.value ?? ""));
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 ?? ""));
284
290
  else {
285
- const x = o?.getAttribute("true-value") ?? !0;
286
- r[w] = c === x;
291
+ const x = s?.getAttribute("true-value") ?? !0;
292
+ r[d] = u === x;
287
293
  }
288
- else if (h === "radio")
289
- r[w] = c === (i?.value ?? "");
290
- else if (h === "select")
291
- if (o && o.hasAttribute("multiple") && o instanceof HTMLSelectElement) {
292
- const x = Array.isArray(c) ? c.map(String) : [];
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) : [];
293
299
  setTimeout(() => {
294
- Array.from(o.options).forEach((l) => {
300
+ Array.from(s.options).forEach((l) => {
295
301
  l.selected = x.includes(l.value);
296
302
  });
297
- }, 0), r[w] = Array.isArray(c) ? c : [];
303
+ }, 0), r[d] = Array.isArray(u) ? u : [];
298
304
  } else
299
- r[w] = c;
305
+ r[d] = u;
300
306
  else {
301
- r[w] = c;
307
+ r[d] = u;
302
308
  try {
303
- const x = J(w);
304
- i && (i[x] = c);
309
+ const x = Y(d);
310
+ i && (i[x] = u);
305
311
  } catch {
306
312
  }
307
313
  }
308
- const b = f || h === "checkbox" || h === "radio" || h === "select" ? "change" : "input", m = (x) => {
314
+ const g = f || c === "checkbox" || c === "radio" || c === "select" ? "change" : "input", m = (x) => {
309
315
  if (x.isComposing || n._isComposing || x.isTrusted === !1) return;
310
316
  const l = x.target;
311
317
  if (!l || l._modelUpdating) return;
312
- let g = l.value;
313
- if (h === "checkbox") {
314
- const E = y();
315
- if (Array.isArray(E)) {
316
- const S = l.getAttribute("value") ?? "", A = Array.from(E);
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);
317
323
  if (l.checked)
318
- A.includes(S) || A.push(S);
324
+ $.includes(A) || $.push(A);
319
325
  else {
320
- const j = A.indexOf(S);
321
- j > -1 && A.splice(j, 1);
326
+ const T = $.indexOf(A);
327
+ T > -1 && $.splice(T, 1);
322
328
  }
323
- g = A;
329
+ b = $;
324
330
  } else {
325
- const S = l.getAttribute("true-value") ?? !0, A = l.getAttribute("false-value") ?? !1;
326
- g = l.checked ? S : A;
331
+ const A = l.getAttribute("true-value") ?? !0, $ = l.getAttribute("false-value") ?? !1;
332
+ b = l.checked ? A : $;
327
333
  }
328
- } else if (h === "radio")
329
- g = l.getAttribute("value") ?? l.value;
330
- else if (h === "select" && l.multiple)
331
- g = Array.from(l.selectedOptions).map((E) => E.value);
332
- else if (u && typeof g == "string" && (g = g.trim()), d) {
333
- const E = Number(g);
334
- isNaN(E) || (g = E);
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);
335
341
  }
336
- const p = s._state || s, _ = z(p, e);
337
- if (Array.isArray(g) && Array.isArray(_) ? JSON.stringify([...g].sort()) !== JSON.stringify([..._].sort()) : g !== _) {
342
+ const y = o._state || o, _ = W(y, e);
343
+ if (Array.isArray(b) && Array.isArray(_) ? JSON.stringify([...b].sort()) !== JSON.stringify([..._].sort()) : b !== _) {
338
344
  l._modelUpdating = !0;
339
345
  try {
340
- oe(p, e, g), s._requestRender && s._requestRender();
346
+ ce(y, e, b), o._requestRender && o._requestRender();
341
347
  } finally {
342
348
  setTimeout(() => l._modelUpdating = !1, 0);
343
349
  }
344
350
  }
345
351
  };
346
- k ? n[b] = m : n[`update:${J(w)}`] = (x) => {
347
- const l = s._state || s, g = x.detail !== void 0 ? x.detail : x.target?.value, p = z(l, e);
348
- (Array.isArray(g) && Array.isArray(p) ? JSON.stringify([...g].sort()) !== JSON.stringify([...p].sort()) : g !== p) && (oe(l, e, g), s._requestRender && s._requestRender());
349
- }, (h === "text" || h === "textarea") && (n.compositionstart = (() => n._isComposing = !0), n.compositionend = (x) => {
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) => {
350
356
  n._isComposing = !1;
351
357
  const l = x.target;
352
358
  l && setTimeout(() => {
353
- const g = l.value, p = s._state || s, _ = z(p, e);
354
- let C = g;
355
- if (u && (C = C.trim()), d) {
356
- const S = Number(C);
357
- isNaN(S) || (C = S);
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);
358
364
  }
359
- if (Array.isArray(C) && Array.isArray(_) ? JSON.stringify([...C].sort()) !== JSON.stringify([..._].sort()) : C !== _) {
365
+ if (Array.isArray(E) && Array.isArray(_) ? JSON.stringify([...E].sort()) !== JSON.stringify([..._].sort()) : E !== _) {
360
366
  l._modelUpdating = !0;
361
367
  try {
362
- oe(p, e, C), s._requestRender && s._requestRender();
368
+ ce(y, e, E), o._requestRender && o._requestRender();
363
369
  } finally {
364
370
  setTimeout(() => l._modelUpdating = !1, 0);
365
371
  }
@@ -367,66 +373,66 @@ function He(e, t, r, i, n, s, o, a) {
367
373
  }, 0);
368
374
  });
369
375
  }
370
- function Le(e) {
376
+ function Me(e) {
371
377
  const t = e.slice(2);
372
378
  return t ? t.charAt(0).toLowerCase() + t.slice(1) : "";
373
379
  }
374
- function Fe(e, t, r, i) {
380
+ function Ke(e, t, r, i) {
375
381
  if (i) {
376
382
  if (typeof e == "object" && e !== null)
377
- for (const [n, s] of Object.entries(e))
378
- t[n] = s;
383
+ for (const [n, o] of Object.entries(e))
384
+ t[n] = o;
379
385
  else if (typeof e == "string")
380
386
  try {
381
387
  const n = JSON.parse(e);
382
388
  if (typeof n == "object" && n !== null) {
383
- for (const [s, o] of Object.entries(n))
384
- t[s] = o;
389
+ for (const [o, s] of Object.entries(n))
390
+ t[o] = s;
385
391
  return;
386
392
  }
387
393
  } catch {
388
- const n = z(i, e);
394
+ const n = W(i, e);
389
395
  r[e] = n;
390
396
  }
391
397
  }
392
398
  }
393
- function Ke(e, t, r) {
399
+ function Je(e, t, r) {
394
400
  if (!r) return;
395
- const i = z(r, e), n = t.style || "", s = i ? "" : "none";
401
+ const i = W(r, e), n = t.style || "", o = i ? "" : "none";
396
402
  if (n) {
397
- const o = n.split(";").filter(Boolean), a = o.findIndex(
403
+ const s = n.split(";").filter(Boolean), a = s.findIndex(
398
404
  (f) => f.trim().startsWith("display:")
399
405
  );
400
- a >= 0 ? o[a] = `display: ${s}` : o.push(`display: ${s}`), t.style = o.join("; ");
406
+ a >= 0 ? s[a] = `display: ${o}` : s.push(`display: ${o}`), t.style = s.join("; ");
401
407
  } else
402
- t.style = `display: ${s}`;
408
+ t.style = `display: ${o}`;
403
409
  }
404
- function Ue(e, t, r) {
410
+ function Ge(e, t, r) {
405
411
  if (!r) return;
406
- const i = z(r, e);
412
+ const i = W(r, e);
407
413
  let n = [];
408
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)));
409
- const s = t.class || "", o = s ? `${s} ${n.join(" ")}`.trim() : n.join(" ");
410
- o && (t.class = o);
415
+ const o = t.class || "", s = o ? `${o} ${n.join(" ")}`.trim() : n.join(" ");
416
+ s && (t.class = s);
411
417
  }
412
- function Ve(e, t, r) {
418
+ function Ze(e, t, r) {
413
419
  let i;
414
420
  if (typeof e == "string") {
415
421
  if (!r) return;
416
- i = z(r, e);
422
+ i = W(r, e);
417
423
  } else
418
424
  i = e;
419
425
  let n = "";
420
426
  if (typeof i == "string")
421
427
  n = i;
422
428
  else if (i && typeof i == "object") {
423
- const o = [];
429
+ const s = [];
424
430
  for (const [a, f] of Object.entries(i))
425
431
  if (f != null && f !== "") {
426
- const u = a.replace(
432
+ const p = a.replace(
427
433
  /[A-Z]/g,
428
- (c) => `-${c.toLowerCase()}`
429
- ), d = [
434
+ (u) => `-${u.toLowerCase()}`
435
+ ), h = [
430
436
  "width",
431
437
  "height",
432
438
  "top",
@@ -452,175 +458,287 @@ function Ve(e, t, r) {
452
458
  "min-height",
453
459
  "max-height"
454
460
  ];
455
- let y = String(f);
456
- typeof f == "number" && d.includes(u) && (y = `${f}px`), o.push(`${u}: ${y}`);
461
+ let C = String(f);
462
+ typeof f == "number" && h.includes(p) && (C = `${f}px`), s.push(`${p}: ${C}`);
457
463
  }
458
- n = o.join("; ") + (o.length > 0 ? ";" : "");
464
+ n = s.join("; ") + (s.length > 0 ? ";" : "");
459
465
  }
460
- const s = t.style || "";
461
- t.style = s + (s && !s.endsWith(";") ? "; " : "") + n;
466
+ const o = t.style || "";
467
+ t.style = o + (o && !o.endsWith(";") ? "; " : "") + n;
462
468
  }
463
- function Re(e, t, r, i) {
464
- const n = {}, s = { ...i || {} }, o = {};
469
+ function Oe(e, t, r, i) {
470
+ const n = {}, o = { ...i || {} }, s = {};
465
471
  for (const [a, f] of Object.entries(e)) {
466
- const { value: u, modifiers: d, arg: y } = f;
472
+ const { value: p, modifiers: h, arg: C } = f;
467
473
  if (a === "model" || a.startsWith("model:")) {
468
- const c = a.split(":"), h = c.length > 1 ? c[1] : y;
469
- He(
470
- typeof u == "string" ? u : String(u),
471
- d,
474
+ const u = a.split(":"), c = u.length > 1 ? u[1] : C;
475
+ Fe(
476
+ typeof p == "string" ? p : String(p),
477
+ h,
472
478
  n,
473
- s,
474
479
  o,
480
+ s,
475
481
  t,
476
482
  r,
477
- h
483
+ c
478
484
  );
479
485
  continue;
480
486
  }
481
487
  switch (a) {
482
488
  case "bind":
483
- Fe(u, n, s, t);
489
+ Ke(p, n, o, t);
484
490
  break;
485
491
  case "show":
486
- Ke(u, s, t);
492
+ Je(p, o, t);
487
493
  break;
488
494
  case "class":
489
- Ue(u, s, t);
495
+ Ge(p, o, t);
490
496
  break;
491
497
  case "style":
492
- Ve(u, s, t);
498
+ Ze(p, o, t);
493
499
  break;
494
500
  }
495
501
  }
496
- return { props: n, attrs: s, listeners: o };
502
+ return { props: n, attrs: o, listeners: s };
497
503
  }
498
- function ve(e, t) {
504
+ function _e(e, t) {
499
505
  if (Array.isArray(e)) {
500
- const s = /* @__PURE__ */ new Set();
501
- return e.map((o) => {
502
- if (!o || typeof o != "object") return o;
503
- let a = o.props?.key ?? o.key;
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;
504
510
  if (!a) {
505
- const y = o.tag || "node", c = o.props?.attrs?.id ?? o.props?.attrs?.name ?? o.props?.attrs?.["data-key"] ?? "";
506
- a = c ? `${t}:${y}:${c}` : `${t}:${y}`;
511
+ const C = s.tag || "node", c = [
512
+ // attrs (kebab-case)
513
+ s.props?.attrs?.id,
514
+ s.props?.attrs?.name,
515
+ s.props?.attrs?.["data-key"],
516
+ // 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"]
521
+ ].find((w) => w != null) ?? "";
522
+ a = c ? `${t}:${C}:${c}` : `${t}:${C}`;
507
523
  }
508
- let f = a, u = 1;
509
- for (; s.has(f); )
510
- f = `${a}#${u++}`;
511
- s.add(f);
512
- let d = o.children;
513
- return Array.isArray(d) && (d = ve(d, f)), { ...o, key: f, children: d };
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 };
514
530
  });
515
531
  }
516
532
  const r = e;
517
533
  let i = r.props?.key ?? r.key ?? t, n = r.children;
518
- return Array.isArray(n) && (n = ve(n, i)), { ...r, key: i, children: n };
534
+ return Array.isArray(n) && (n = _e(n, i)), { ...r, key: i, children: n };
519
535
  }
520
- function Je(e, t, r, i) {
521
- const n = r.directives ?? {}, s = Re(
536
+ function Se(e, t, r, i) {
537
+ const n = r.directives ?? {}, o = Oe(
522
538
  n,
523
539
  i,
524
540
  e,
525
541
  r.attrs
526
- ), o = {
542
+ ), s = {
527
543
  ...t.props,
528
544
  ...r.props,
529
- ...s.props
545
+ ...o.props
530
546
  }, a = {
531
547
  ...t.attrs,
532
548
  ...r.attrs,
533
- ...s.attrs
534
- }, f = t.props ?? {}, u = o;
535
- for (const c in { ...f, ...u }) {
536
- const h = f[c], k = u[c];
537
- if (h !== k) {
538
- if (c === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement))
539
- e.value !== k && (e.value = k ?? "");
540
- else if (c === "checked" && e instanceof HTMLInputElement)
541
- e.checked = !!k;
542
- else if (c.startsWith("on") && typeof k == "function") {
543
- const $ = Le(c);
544
- typeof h == "function" && e.removeEventListener($, h), e.addEventListener($, k);
545
- } else if (k == null || k === !1)
546
- e.removeAttribute(c);
547
- else if ((r?.isCustomElement ?? t?.isCustomElement ?? !1) || c in e)
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))
556
+ e.value !== d && (e.value = d ?? "");
557
+ else if (w === "checked" && e instanceof HTMLInputElement)
558
+ e.checked = !!d;
559
+ else if (w.startsWith("on") && typeof d == "function") {
560
+ const g = Me(w);
561
+ typeof v == "function" && e.removeEventListener(g, v), e.addEventListener(g, d);
562
+ } else if (d == null || d === !1)
563
+ e.removeAttribute(w);
564
+ else if ((r?.isCustomElement ?? t?.isCustomElement ?? !1) || w in e)
548
565
  try {
549
- e[c] = k;
566
+ e[w] = d;
550
567
  } catch {
551
568
  }
552
569
  }
553
570
  }
554
- for (const [c, h] of Object.entries(
555
- s.listeners || {}
571
+ for (const [w, v] of Object.entries(
572
+ o.listeners || {}
556
573
  ))
557
- e.addEventListener(c, h);
558
- const d = t.attrs ?? {}, y = a;
559
- for (const c in { ...d, ...y }) {
560
- const h = d[c], k = y[c];
561
- h !== k && (k == null || k === !1 ? e.removeAttribute(c) : e.setAttribute(c, String(k)));
574
+ 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];
578
+ if (v !== d)
579
+ if (C = !0, d == null || d === !1) {
580
+ if (e.removeAttribute(w), w === "value") {
581
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement)
582
+ try {
583
+ e.value = "";
584
+ } catch {
585
+ }
586
+ else if (e instanceof HTMLSelectElement)
587
+ try {
588
+ e.value = "";
589
+ } catch {
590
+ }
591
+ else if (e instanceof HTMLProgressElement)
592
+ try {
593
+ e.value = 0;
594
+ } catch {
595
+ }
596
+ }
597
+ if (w === "checked" && e instanceof HTMLInputElement)
598
+ try {
599
+ e.checked = !1;
600
+ } catch {
601
+ }
602
+ if (w === "disabled")
603
+ try {
604
+ e.disabled = !1;
605
+ } catch {
606
+ }
607
+ } else {
608
+ if (w === "value") {
609
+ if (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement) {
610
+ try {
611
+ e.value = d ?? "";
612
+ } catch {
613
+ e.setAttribute(w, String(d));
614
+ }
615
+ continue;
616
+ } else if (e instanceof HTMLSelectElement) {
617
+ try {
618
+ e.value = d ?? "";
619
+ } catch {
620
+ }
621
+ continue;
622
+ } else if (e instanceof HTMLProgressElement) {
623
+ try {
624
+ e.value = Number(d);
625
+ } catch {
626
+ }
627
+ continue;
628
+ }
629
+ }
630
+ if (w === "checked" && e instanceof HTMLInputElement) {
631
+ try {
632
+ e.checked = !!d;
633
+ } catch {
634
+ }
635
+ continue;
636
+ }
637
+ if (!(e.namespaceURI === "http://www.w3.org/2000/svg") && w in e)
638
+ try {
639
+ e[w] = d;
640
+ } catch {
641
+ e.setAttribute(w, String(d));
642
+ }
643
+ else
644
+ e.setAttribute(w, String(d));
645
+ }
562
646
  }
647
+ if (h && C)
648
+ try {
649
+ if (typeof e._applyProps == "function")
650
+ try {
651
+ e._applyProps(e._cfg);
652
+ } catch {
653
+ }
654
+ typeof e.requestRender == "function" ? e.requestRender() : typeof e._render == "function" && e._render(e._cfg);
655
+ } catch {
656
+ }
563
657
  }
564
- function M(e, t, r) {
658
+ function D(e, t, r) {
565
659
  if (typeof e == "string")
566
660
  return document.createTextNode(e);
567
661
  if (e.tag === "#text") {
568
- const y = document.createTextNode(
662
+ const u = document.createTextNode(
569
663
  typeof e.children == "string" ? e.children : ""
570
664
  );
571
- return e.key != null && (y.key = e.key), y;
665
+ return e.key != null && (u.key = e.key), u;
572
666
  }
573
667
  if (e.tag === "#anchor") {
574
- const y = e, c = Array.isArray(y.children) ? y.children : [], h = document.createTextNode(""), k = document.createTextNode("");
575
- y.key != null && (h.key = `${y.key}:start`, k.key = `${y.key}:end`), y._startNode = h, y._endNode = k;
576
- const $ = document.createDocumentFragment();
577
- $.appendChild(h);
578
- for (const w of c) {
579
- const b = M(w, t);
580
- $.appendChild(b);
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;
670
+ const d = document.createDocumentFragment();
671
+ d.appendChild(w);
672
+ for (const g of c) {
673
+ const m = D(g, t);
674
+ d.appendChild(m);
581
675
  }
582
- return $.appendChild(k), $;
676
+ return d.appendChild(v), d;
583
677
  }
584
678
  const i = document.createElement(e.tag);
585
679
  e.key != null && (i.key = e.key);
586
- const { props: n = {}, attrs: s = {}, directives: o = {} } = e.props ?? {}, a = Re(o, t, i, s), f = {
680
+ const { props: n = {}, attrs: o = {}, directives: s = {} } = e.props ?? {}, a = Oe(s, t, i, o), f = {
587
681
  ...n,
588
682
  ...a.props
589
- }, u = {
590
- ...s,
683
+ }, p = {
684
+ ...o,
591
685
  ...a.attrs
592
- };
593
- for (const y in u) {
594
- const c = u[y];
595
- typeof y != "string" || /\[object Object\]/.test(y) || (typeof c == "boolean" ? c && i.setAttribute(y, "") : c != null && i.setAttribute(y, c));
596
- }
597
- for (const y in f) {
598
- const c = f[y];
599
- if (!(typeof y != "string" || /\[object Object\]/.test(y)))
600
- if (y === "value" && (i instanceof HTMLInputElement || i instanceof HTMLTextAreaElement || i instanceof HTMLSelectElement))
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))
694
+ try {
695
+ i instanceof HTMLProgressElement ? i.value = Number(c) : i.value = c ?? "";
696
+ } catch {
697
+ i.setAttribute(u, String(c));
698
+ }
699
+ else if (!h && u === "checked" && i instanceof HTMLInputElement)
700
+ try {
701
+ i.checked = !!c;
702
+ } catch {
703
+ i.setAttribute(u, String(c));
704
+ }
705
+ else if (!h && u in i)
706
+ try {
707
+ i[u] = c;
708
+ } catch {
709
+ i.setAttribute(u, String(c));
710
+ }
711
+ 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))
601
719
  i.value = c ?? "";
602
- else if (y === "checked" && i instanceof HTMLInputElement)
720
+ else if (u === "checked" && i instanceof HTMLInputElement)
603
721
  i.checked = !!c;
604
- else if (y.startsWith("on") && typeof c == "function")
605
- i.addEventListener(Le(y), c);
722
+ else if (u.startsWith("on") && typeof c == "function")
723
+ i.addEventListener(Me(u), c);
606
724
  else {
607
- if (y.startsWith("on") && c === void 0)
725
+ if (u.startsWith("on") && c === void 0)
608
726
  continue;
609
727
  if (c == null || c === !1)
610
- i.removeAttribute(y);
611
- else if ((e.props?.isCustomElement ?? !1) || y in i)
728
+ i.removeAttribute(u);
729
+ else if ((e.props?.isCustomElement ?? !1) || u in i)
612
730
  try {
613
- i[y] = c;
731
+ i[u] = c;
614
732
  } catch {
615
733
  }
616
734
  }
617
735
  }
618
- for (const [y, c] of Object.entries(
736
+ for (const [u, c] of Object.entries(
619
737
  a.listeners || {}
620
738
  ))
621
- i.addEventListener(y, c);
622
- const d = e.props?.ref ?? (e.props?.props && e.props.props.ref);
623
- typeof e != "string" && d && r && (r[d] = i);
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);
624
742
  try {
625
743
  if (typeof i._applyProps == "function")
626
744
  try {
@@ -631,163 +749,177 @@ function M(e, t, r) {
631
749
  } catch {
632
750
  }
633
751
  if (Array.isArray(e.children))
634
- for (const y of e.children)
635
- i.appendChild(M(y, t, r));
752
+ for (const u of e.children)
753
+ i.appendChild(D(u, t, r));
636
754
  else typeof e.children == "string" && (i.textContent = e.children);
755
+ try {
756
+ if (i instanceof HTMLSelectElement && p && p.hasOwnProperty("value"))
757
+ try {
758
+ i.value = p.value ?? "";
759
+ } catch {
760
+ }
761
+ } catch {
762
+ }
637
763
  return i;
638
764
  }
639
- function Ze(e, t, r, i, n) {
765
+ function Ve(e, t, r, i, n) {
640
766
  if (typeof r == "string") {
641
767
  e.textContent !== r && (e.textContent = r);
642
768
  return;
643
769
  }
644
770
  if (!Array.isArray(r)) return;
645
- const s = Array.from(e.childNodes), o = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
646
- for (const h of o)
647
- h && h.key != null && a.set(h.key, h);
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);
648
774
  const f = /* @__PURE__ */ new Map();
649
- for (const h of s) {
650
- const k = h.key;
651
- k != null && f.set(k, h);
652
- }
653
- const u = /* @__PURE__ */ new Set();
654
- let d = e.firstChild;
655
- function y(h, k) {
656
- let $ = h;
657
- for (; $ && (u.add($), $ !== k); )
658
- $ = $.nextSibling;
659
- }
660
- function c(h, k, $, w) {
661
- const b = [];
662
- let m = h.nextSibling;
663
- for (; m && m !== k; )
664
- b.push(m), m = m.nextSibling;
665
- const x = Array.isArray($) ? $ : [];
666
- if (w.some((g) => g && g.key != null) || x.some((g) => g && g.key != null)) {
667
- const g = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
668
- for (const E of x)
669
- E && E.key != null && g.set(E.key, E);
670
- for (const E of b) {
671
- const S = E.key;
672
- S != null && p.set(S, E);
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); )
784
+ v = v.nextSibling;
785
+ }
786
+ function u(c, w, v, d) {
787
+ const g = [];
788
+ let m = c.nextSibling;
789
+ for (; m && m !== w; )
790
+ g.push(m), m = m.nextSibling;
791
+ const x = Array.isArray(v) ? v : [];
792
+ 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();
794
+ for (const S of x)
795
+ S && S.key != null && b.set(S.key, S);
796
+ for (const S of g) {
797
+ const A = S.key;
798
+ A != null && y.set(A, S);
673
799
  }
674
800
  const _ = /* @__PURE__ */ new Set();
675
- let C = h.nextSibling;
676
- for (const E of w) {
677
- let S;
678
- if (E.key != null && p.has(E.key)) {
679
- const A = g.get(E.key);
680
- S = ae(
681
- p.get(E.key),
682
- A,
683
- E,
801
+ let E = c.nextSibling;
802
+ 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
+ $,
809
+ S,
684
810
  i
685
- ), _.add(S), S !== C && e.contains(S) && e.insertBefore(S, C);
811
+ ), _.add(A), A !== E && e.contains(A) && e.insertBefore(A, E);
686
812
  } else
687
- S = M(E, i), e.insertBefore(S, C), _.add(S);
688
- C = S.nextSibling;
813
+ A = D(S, i), e.insertBefore(A, E), _.add(A);
814
+ E = A.nextSibling;
689
815
  }
690
- for (const E of b)
691
- !_.has(E) && e.contains(E) && e.removeChild(E);
816
+ for (const S of g)
817
+ !_.has(S) && e.contains(S) && e.removeChild(S);
692
818
  } else {
693
- const g = Math.min(
819
+ const b = Math.min(
694
820
  x.length,
695
- w.length
821
+ d.length
696
822
  );
697
- for (let p = 0; p < g; p++) {
698
- const _ = x[p], C = w[p], E = ae(b[p], _, C, i);
699
- E !== b[p] && (e.insertBefore(E, b[p]), e.removeChild(b[p]));
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]));
700
826
  }
701
- for (let p = g; p < w.length; p++)
702
- e.insertBefore(M(w[p], i), k);
703
- for (let p = g; p < b.length; p++)
704
- e.removeChild(b[p]);
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]);
705
831
  }
706
832
  }
707
- for (const h of r) {
708
- let k;
709
- if (h.tag === "#anchor") {
710
- const $ = h.key, w = `${$}:start`, b = `${$}:end`;
711
- let m = f.get(w), x = f.get(b);
712
- const l = Array.isArray(h.children) ? h.children : [];
713
- if (m || (m = document.createTextNode(""), m.key = w), x || (x = document.createTextNode(""), x.key = b), h._startNode = m, h._endNode = x, !e.contains(m) || !e.contains(x)) {
714
- e.insertBefore(m, d);
715
- for (const g of l)
716
- e.insertBefore(M(g, i), d);
717
- e.insertBefore(x, d);
833
+ for (const c of r) {
834
+ 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);
718
844
  } else
719
- c(
845
+ u(
720
846
  m,
721
847
  x,
722
- a.get($)?.children,
848
+ a.get(v)?.children,
723
849
  l
724
850
  );
725
- y(m, x), d = x.nextSibling;
851
+ C(m, x), h = x.nextSibling;
726
852
  continue;
727
853
  }
728
- if (h.key != null && f.has(h.key)) {
729
- const $ = a.get(h.key);
730
- k = ae(
731
- f.get(h.key),
732
- $,
733
- h,
854
+ if (c.key != null && f.has(c.key)) {
855
+ const v = a.get(c.key);
856
+ w = le(
857
+ f.get(c.key),
858
+ v,
859
+ c,
734
860
  i,
735
861
  n
736
- ), u.add(k), k !== d && e.contains(k) && (d && !e.contains(d) && (d = null), e.insertBefore(k, d));
862
+ ), p.add(w), w !== h && e.contains(w) && (h && !e.contains(h) && (h = null), e.insertBefore(w, h));
737
863
  } else
738
- k = M(h, i, n), d && !e.contains(d) && (d = null), e.insertBefore(k, d), u.add(k);
739
- d = k.nextSibling;
864
+ w = D(c, i, n), h && !e.contains(h) && (h = null), e.insertBefore(w, h), p.add(w);
865
+ h = w.nextSibling;
740
866
  }
741
- for (const h of s)
742
- !u.has(h) && e.contains(h) && (V(h, n), e.removeChild(h));
867
+ for (const c of o)
868
+ !p.has(c) && e.contains(c) && (V(c, n), e.removeChild(c));
743
869
  }
744
- function ae(e, t, r, i, n) {
870
+ function le(e, t, r, i, n) {
745
871
  if (t && typeof t != "string" && t.props?.ref && n && V(e, n), t === r) return e;
746
872
  if (typeof r == "string") {
747
873
  if (e.nodeType === Node.TEXT_NODE)
748
874
  return e.textContent !== r && (e.textContent = r), e;
749
875
  {
750
- const o = document.createTextNode(r);
751
- return e.parentNode?.replaceChild(o, e), o;
876
+ const s = document.createTextNode(r);
877
+ return e.parentNode?.replaceChild(s, e), s;
752
878
  }
753
879
  }
754
880
  if (r && typeof r != "string" && r.tag === "#anchor") {
755
- const o = r, a = Array.isArray(o.children) ? o.children : [], f = o._startNode ?? document.createTextNode(""), u = o._endNode ?? document.createTextNode("");
756
- o.key != null && (f.key = `${o.key}:start`, u.key = `${o.key}:end`), o._startNode = f, o._endNode = u;
757
- const d = document.createDocumentFragment();
758
- d.appendChild(f);
759
- for (const y of a) {
760
- const c = M(y, i);
761
- d.appendChild(c);
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);
762
888
  }
763
- return d.appendChild(u), e.parentNode?.replaceChild(d, e), f;
889
+ return h.appendChild(p), e.parentNode?.replaceChild(h, e), f;
764
890
  }
765
891
  if (!r) {
766
892
  V(e, n);
767
- const o = document.createComment("removed");
768
- return e.parentNode?.replaceChild(o, e), o;
893
+ const s = document.createComment("removed");
894
+ return e.parentNode?.replaceChild(s, e), s;
769
895
  }
770
896
  if (!t || typeof t == "string") {
771
897
  V(e, n);
772
- const o = M(r, i, n);
773
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), e.parentNode?.replaceChild(o, e), o;
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;
774
900
  }
775
901
  if (r.tag === "#anchor") {
776
- const o = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), f = r._endNode ?? document.createTextNode("");
902
+ const s = Array.isArray(r.children) ? r.children : [], a = r._startNode ?? document.createTextNode(""), f = r._endNode ?? document.createTextNode("");
777
903
  r.key != null && (a.key = `${r.key}:start`, f.key = `${r.key}:end`), r._startNode = a, r._endNode = f;
778
- const u = document.createDocumentFragment();
779
- u.appendChild(a);
780
- for (const d of o)
781
- u.appendChild(M(d, i));
782
- return u.appendChild(f), e.parentNode?.replaceChild(u, e), a;
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;
783
909
  }
784
910
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
785
- const o = e;
786
- return Je(o, t.props || {}, r.props || {}, i), Ze(o, t.children, r.children, i, n), typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = o), o;
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;
787
913
  }
914
+ 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
+ try {
916
+ 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;
918
+ } catch {
919
+ }
788
920
  V(e, n);
789
- const s = M(r, i, n);
790
- return typeof r != "string" && r.props?.ref && n && (n[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
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;
791
923
  }
792
924
  function Ye(e, t, r, i) {
793
925
  let n;
@@ -796,31 +928,31 @@ function Ye(e, t, r, i) {
796
928
  key: "__anchor_root__",
797
929
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
798
930
  children: [n]
799
- }), n = ve(n, String(n.key ?? "root"));
800
- const s = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null;
931
+ }), n = _e(n, String(n.key ?? "root"));
932
+ const o = e._prevVNode ?? null, s = e._prevDom ?? e.firstChild ?? null;
801
933
  let a;
802
- s && o ? typeof s != "string" && typeof n != "string" && s.tag === n.tag && s.key === n.key ? a = ae(o, s, n, r, i) : (a = M(n, r, i), e.replaceChild(a, o)) : (a = M(n, r, i), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(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));
803
935
  const f = [];
804
- for (let u = 0; u < e.childNodes.length; u++) {
805
- const d = e.childNodes[u];
806
- d !== a && d.nodeName !== "STYLE" && (V(d, i), f.push(d));
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));
807
939
  }
808
- f.forEach((u) => e.removeChild(u)), e._prevVNode = n, e._prevDom = a;
940
+ f.forEach((p) => e.removeChild(p)), e._prevVNode = n, e._prevDom = a;
809
941
  }
810
- function he(e) {
811
- if (typeof e == "string") return H(e);
942
+ function ge(e) {
943
+ if (typeof e == "string") return J(e);
812
944
  if (e.tag === "#text")
813
- return typeof e.children == "string" ? H(e.children) : "";
945
+ return typeof e.children == "string" ? J(e.children) : "";
814
946
  if (e.tag === "#anchor")
815
- return (Array.isArray(e.children) ? e.children.filter(Boolean) : []).map(he).join("");
947
+ return (Array.isArray(e.children) ? e.children.filter(Boolean) : []).map(ge).join("");
816
948
  let t = "";
817
- e.props && e.props.attrs && (t = Object.entries(e.props.attrs).map(([n, s]) => ` ${n}="${H(String(s))}"`).join(""));
949
+ e.props && e.props.attrs && (t = Object.entries(e.props.attrs).map(([n, o]) => ` ${n}="${J(String(o))}"`).join(""));
818
950
  let r = "";
819
- e.props && (r = Object.entries(e.props).filter(([n]) => n !== "attrs" && n !== "directives" && n !== "ref" && n !== "key").map(([n, s]) => ` ${n}="${H(String(s))}"`).join(""));
820
- const i = Array.isArray(e.children) ? e.children.filter(Boolean).map(he).join("") : typeof e.children == "string" ? H(e.children) : e.children ? he(e.children) : "";
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) : "";
821
953
  return `<${e.tag}${t}${r}>${i}</${e.tag}>`;
822
954
  }
823
- function Oe(e, ...t) {
955
+ function Pe(e, ...t) {
824
956
  let r = "";
825
957
  for (let i = 0; i < e.length; i++)
826
958
  r += e[i], i < t.length && (r += t[i]);
@@ -829,14 +961,14 @@ function Oe(e, ...t) {
829
961
  function Be(e) {
830
962
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
831
963
  }
832
- let ie = null;
833
- function _e() {
834
- return ie || (ie = new CSSStyleSheet(), ie.replaceSync(Be(Qe))), ie;
964
+ let oe = null;
965
+ function Ee() {
966
+ return oe || (oe = new CSSStyleSheet(), oe.replaceSync(Be(Xe))), oe;
835
967
  }
836
- function Ge(e) {
968
+ function Qe(e) {
837
969
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
838
970
  }
839
- const Qe = Oe`
971
+ const Xe = Pe`
840
972
  :host, *, ::before, ::after {
841
973
  all: isolate;
842
974
  box-sizing: border-box;
@@ -894,7 +1026,7 @@ const Qe = Oe`
894
1026
  sup { top: -.5em }
895
1027
  [disabled], [aria-disabled=true] { cursor: not-allowed }
896
1028
  [hidden] { display: none }
897
- `, Xe = {
1029
+ `, et = {
898
1030
  neutral: {
899
1031
  50: "#fafafa",
900
1032
  100: "#f4f4f5",
@@ -990,8 +1122,8 @@ const Qe = Oe`
990
1122
  black: { DEFAULT: "#000000" },
991
1123
  transparent: { DEFAULT: "transparent" },
992
1124
  current: { DEFAULT: "currentColor" }
993
- }, et = Object.fromEntries(
994
- Object.entries(Xe).map(([e, t]) => [
1125
+ }, tt = Object.fromEntries(
1126
+ Object.entries(et).map(([e, t]) => [
995
1127
  e,
996
1128
  Object.fromEntries(
997
1129
  Object.entries(t).map(([r, i]) => [
@@ -1000,7 +1132,7 @@ const Qe = Oe`
1000
1132
  ])
1001
1133
  )
1002
1134
  ])
1003
- ), ge = {
1135
+ ), me = {
1004
1136
  /* Display */
1005
1137
  block: "display:block;",
1006
1138
  inline: "display:inline;",
@@ -1127,6 +1259,10 @@ const Qe = Oe`
1127
1259
  "rounded-sm": "border-radius:0.25rem;",
1128
1260
  "rounded-md": "border-radius:0.375rem;",
1129
1261
  "rounded-lg": "border-radius:0.5rem;",
1262
+ "rounded-xl": "border-radius:0.75rem;",
1263
+ "rounded-2xl": "border-radius:1rem;",
1264
+ "rounded-3xl": "border-radius:1.5rem;",
1265
+ "rounded-4xl": "border-radius:2rem;",
1130
1266
  "rounded-full": "border-radius:9999px;",
1131
1267
  /* Shadow and effects */
1132
1268
  // Shadows use a CSS variable for color so color utilities can modify --ce-shadow-color
@@ -1211,7 +1347,7 @@ const Qe = Oe`
1211
1347
  "z-30": "z-index:30;",
1212
1348
  "z-40": "z-index:40;",
1213
1349
  "z-50": "z-index:50;"
1214
- }, tt = "0.25rem", Se = {
1350
+ }, rt = "0.25rem", Ce = {
1215
1351
  m: ["margin"],
1216
1352
  mx: ["margin-inline"],
1217
1353
  my: ["margin-block"],
@@ -1246,17 +1382,17 @@ const Qe = Oe`
1246
1382
  function N(e, t) {
1247
1383
  let r = 0, i = 0;
1248
1384
  for (let n = 0; n < e.length; n++) {
1249
- const s = e[n];
1250
- if (s === "[") r++;
1251
- else if (s === "]" && r > 0) r--;
1252
- else if (s === "(") i++;
1253
- else if (s === ")" && i > 0) i--;
1254
- else if (r === 0 && i === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
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 === " "))
1255
1391
  return e.slice(0, n) + t + e.slice(n);
1256
1392
  }
1257
1393
  return e + t;
1258
1394
  }
1259
- const rt = {
1395
+ const nt = {
1260
1396
  before: (e, t) => `${e}::before{${t}}`,
1261
1397
  after: (e, t) => `${e}::after{${t}}`,
1262
1398
  hover: (e, t) => `${N(e, ":hover")}{${t}}`,
@@ -1279,7 +1415,7 @@ const rt = {
1279
1415
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1280
1416
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1281
1417
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1282
- }, me = {
1418
+ }, ye = {
1283
1419
  // Responsive
1284
1420
  sm: "(min-width:640px)",
1285
1421
  md: "(min-width:768px)",
@@ -1288,25 +1424,25 @@ const rt = {
1288
1424
  "2xl": "(min-width:1536px)",
1289
1425
  // Dark mode (now plain string)
1290
1426
  dark: "(prefers-color-scheme: dark)"
1291
- }, ye = ["sm", "md", "lg", "xl", "2xl"];
1292
- function be(e) {
1427
+ }, be = ["sm", "md", "lg", "xl", "2xl"];
1428
+ function we(e) {
1293
1429
  const t = e.startsWith("-"), i = (t ? e.slice(1) : e).split("-");
1294
1430
  if (i.length < 2) return null;
1295
- const n = i.slice(0, -1).join("-"), s = i[i.length - 1], o = parseFloat(s);
1296
- if (Number.isNaN(o) || !Se[n]) 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;
1297
1433
  const a = t ? "-" : "";
1298
- return Se[n].map((f) => `${f}:calc(${a}${tt} * ${o});`).join("");
1434
+ return Ce[n].map((f) => `${f}:calc(${a}${rt} * ${s});`).join("");
1299
1435
  }
1300
- function Ee(e) {
1301
- const t = e.replace("#", ""), r = parseInt(t, 16), i = r >> 16 & 255, n = r >> 8 & 255, s = r & 255;
1302
- return `${i} ${n} ${s}`;
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}`;
1303
1439
  }
1304
- function nt(e) {
1440
+ function it(e) {
1305
1441
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1306
1442
  if (!t) return null;
1307
- const [, r, i, n = "DEFAULT"] = t, s = et[i]?.[n];
1308
- if (!s) return null;
1309
- if (r === "shadow") return `--ce-shadow-color:${s};`;
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};`;
1310
1446
  const a = {
1311
1447
  bg: "background-color",
1312
1448
  decoration: "text-decoration-color",
@@ -1318,49 +1454,49 @@ function nt(e) {
1318
1454
  fill: "fill",
1319
1455
  stroke: "stroke"
1320
1456
  }[r];
1321
- return a ? `${a}:${s};` : null;
1457
+ return a ? `${a}:${o};` : null;
1322
1458
  }
1323
- function it(e) {
1459
+ function st(e) {
1324
1460
  const [t, r] = e.split("/");
1325
1461
  if (!r) return { base: t };
1326
1462
  const i = parseInt(r, 10);
1327
1463
  return isNaN(i) || i < 0 || i > 100 ? { base: t } : { base: t, opacity: i / 100 };
1328
1464
  }
1329
- function we(e) {
1330
- const { base: t, opacity: r } = it(e), i = nt(t);
1465
+ function xe(e) {
1466
+ const { base: t, opacity: r } = st(e), i = it(t);
1331
1467
  if (i) {
1332
1468
  if (r !== void 0) {
1333
- const s = /#([0-9a-f]{6})/i.exec(i);
1334
- if (s) {
1335
- const o = Ee(s[0]);
1336
- return i.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
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})`);
1337
1473
  }
1338
1474
  }
1339
1475
  return i;
1340
1476
  }
1341
- const n = ce(t);
1477
+ const n = fe(t);
1342
1478
  if (n && r !== void 0) {
1343
- const s = /#([0-9a-f]{6})/i.exec(n);
1344
- if (s) {
1345
- const o = Ee(s[0]);
1346
- return n.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
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})`);
1347
1483
  }
1348
1484
  }
1349
1485
  return n;
1350
1486
  }
1351
- function xe(e) {
1487
+ function ve(e) {
1352
1488
  const t = /^opacity-(\d{1,3})$/.exec(e);
1353
1489
  if (!t) return null;
1354
1490
  const r = parseInt(t[1], 10);
1355
1491
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1356
1492
  }
1357
- function ce(e) {
1493
+ function fe(e) {
1358
1494
  if (e.startsWith("[") && e.endsWith("]") && !e.includes("-[")) {
1359
1495
  const n = e.slice(1, -1).trim().match(/^([a-zA-Z][a-zA-Z0-9-]*)\s*:(.*)$/);
1360
1496
  if (n) {
1361
- const s = n[1].trim();
1362
- let o = n[2].trim();
1363
- return o = o.replace(/url\('\s*([^']*?)\s*'\)/g, 'url("$1")'), o = o.replace(/^'([^']*)'$/g, '"$1"'), `${s}:${o};`;
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};`;
1364
1500
  }
1365
1501
  return null;
1366
1502
  }
@@ -1369,7 +1505,7 @@ function ce(e) {
1369
1505
  const i = e.slice(0, t);
1370
1506
  let n = e.slice(t + 2, -1);
1371
1507
  n = n.replace(/_/g, " ");
1372
- const s = {
1508
+ const o = {
1373
1509
  bg: "background-color",
1374
1510
  text: "color",
1375
1511
  shadow: "box-shadow",
@@ -1413,12 +1549,12 @@ function ce(e) {
1413
1549
  };
1414
1550
  if (i === "rotate")
1415
1551
  return `transform:rotate(${n});`;
1416
- const o = s[i] ?? i.replace(/_/g, "-");
1417
- if (o && n) return `${o}:${n};`;
1552
+ const s = o[i] ?? i.replace(/_/g, "-");
1553
+ if (s && n) return `${s}:${n};`;
1418
1554
  }
1419
1555
  return null;
1420
1556
  }
1421
- function st(e) {
1557
+ function ot(e) {
1422
1558
  if (e.startsWith("[") && e.endsWith("]")) {
1423
1559
  const r = e.slice(1, -1);
1424
1560
  return r.includes("&") ? r : e;
@@ -1430,10 +1566,10 @@ function st(e) {
1430
1566
  }
1431
1567
  return null;
1432
1568
  }
1433
- function ot(e) {
1569
+ function at(e) {
1434
1570
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1435
1571
  }
1436
- function at(e) {
1572
+ function ct(e) {
1437
1573
  const t = /class\s*=\s*(['"])(.*?)\1/g, r = [];
1438
1574
  let i;
1439
1575
  for (; i = t.exec(e); ) {
@@ -1442,32 +1578,32 @@ function at(e) {
1442
1578
  }
1443
1579
  return r.filter(Boolean);
1444
1580
  }
1445
- const Ce = /* @__PURE__ */ new Map(), ct = 16;
1446
- function lt(e) {
1447
- const t = Date.now(), r = Ce.get(e);
1448
- if (r && t - r.timestamp < ct) return r.css;
1449
- const i = at(e), n = new Set(i), s = [], o = [], a = [], f = [], u = {};
1450
- function d(w, b = !1) {
1451
- const m = (b ? "dark|" : "") + w;
1452
- if (m in u) return u[m];
1453
- const x = k(w, b);
1454
- return u[m] = x, x;
1455
- }
1456
- function y(w) {
1457
- const b = w.some((x) => ye.includes(x)), m = w.includes("dark");
1458
- return w.length === 0 ? 1 : !b && !m ? 2 : b && !m ? 3 : 4;
1459
- }
1460
- function c(w) {
1461
- const b = [];
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];
1589
+ const x = w(d, g);
1590
+ return p[m] = x, x;
1591
+ }
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;
1595
+ }
1596
+ function u(d) {
1597
+ const g = [];
1462
1598
  let m = "", x = 0, l = 0;
1463
- for (let g = 0; g < w.length; g++) {
1464
- const p = w[g];
1465
- p === "[" ? x++ : p === "]" && x > 0 ? x-- : p === "(" ? l++ : p === ")" && l > 0 && l--, p === ":" && x === 0 && l === 0 ? (b.push(m), m = "") : m += p;
1599
+ 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;
1466
1602
  }
1467
- return m && b.push(m), b;
1603
+ return m && g.push(m), g;
1468
1604
  }
1469
- function h(w) {
1470
- switch (w) {
1605
+ function c(d) {
1606
+ switch (d) {
1471
1607
  case "hover":
1472
1608
  return ":hover";
1473
1609
  case "focus":
@@ -1496,124 +1632,124 @@ function lt(e) {
1496
1632
  return null;
1497
1633
  }
1498
1634
  }
1499
- function k(w, b = !1) {
1500
- const m = c(w);
1635
+ function w(d, g = !1) {
1636
+ const m = u(d);
1501
1637
  let x = !1;
1502
- const l = m.find((v) => (v.startsWith("!") && (x = !0, v = v.slice(1)), ge[v] || be(v) || xe(v) || we(v) || ce(v)));
1638
+ const l = m.find((k) => (k.startsWith("!") && (x = !0, k = k.slice(1)), me[k] || we(k) || ve(k) || xe(k) || fe(k)));
1503
1639
  if (!l) return null;
1504
- const g = l.replace(/^!/, ""), p = ge[g] ?? be(g) ?? xe(g) ?? we(g) ?? ce(g);
1505
- if (!p) return null;
1640
+ const b = l.replace(/^!/, ""), y = me[b] ?? we(b) ?? ve(b) ?? xe(b) ?? fe(b);
1641
+ if (!y) return null;
1506
1642
  const _ = m.indexOf(l);
1507
- let C = _ >= 0 ? m.slice(0, _) : [];
1508
- b && (C = C.filter((v) => v !== "dark"));
1509
- const E = `.${ot(w)}`, S = "__SUBJECT__", A = x ? p.replace(/;$/, " !important;") : p;
1510
- let j = S;
1511
- const Q = [];
1512
- for (const v of C)
1513
- v.startsWith("group-") ? (j = `.group:${v.slice(6)} ${j}`, Q.push(v)) : v.startsWith("peer-") && (j = j.replace(S, `.peer:${v.slice(5)}~${S}`), Q.push(v));
1514
- C = C.filter((v) => !Q.includes(v));
1515
- const X = [], de = [];
1516
- let q = null;
1517
- for (const v of C) {
1518
- if (v === "dark" || ye.includes(v)) continue;
1519
- const B = st(v);
1520
- if (B) {
1521
- q = B;
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 = [];
1652
+ 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;
1522
1658
  continue;
1523
1659
  }
1524
- const O = h(v);
1525
- if (O) {
1526
- q ? de.push(O) : X.push(O);
1660
+ const R = c(k);
1661
+ if (R) {
1662
+ M ? ee.push(R) : G.push(R);
1527
1663
  continue;
1528
1664
  }
1529
- const P = rt[v];
1530
- typeof P == "function" && (j = P(j, A).split("{")[0]);
1665
+ const O = nt[k];
1666
+ typeof O == "function" && (T = O(T, $).split("{")[0]);
1531
1667
  }
1532
- function I(v, B) {
1533
- if (!B) return v;
1534
- let O = 0, P = 0;
1535
- if (v.length && (v[0] === ">" || v[0] === "+" || v[0] === "~" || v[0] === " ")) {
1536
- let T = 1;
1537
- for (; T < v.length && v[T] === " "; ) T++;
1538
- for (; T < v.length; T++) {
1539
- const R = v[T];
1540
- if (R === "[" ? O++ : R === "]" && O > 0 ? O-- : R === "(" ? P++ : R === ")" && P > 0 && P--, O === 0 && P === 0 && (v[T] === ">" || v[T] === "+" || v[T] === "~" || v[T] === " "))
1541
- return v.slice(0, T) + B + v.slice(T);
1668
+ function U(k, P) {
1669
+ if (!P) return k;
1670
+ let R = 0, O = 0;
1671
+ if (k.length && (k[0] === ">" || k[0] === "+" || k[0] === "~" || k[0] === " ")) {
1672
+ let j = 1;
1673
+ for (; j < k.length && k[j] === " "; ) j++;
1674
+ for (; j < k.length; j++) {
1675
+ 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);
1542
1678
  }
1543
- return v + B;
1679
+ return k + P;
1544
1680
  }
1545
- for (let T = 0; T < v.length; T++) {
1546
- const R = v[T];
1547
- if (R === "[" ? O++ : R === "]" && O > 0 ? O-- : R === "(" ? P++ : R === ")" && P > 0 && P--, O === 0 && P === 0 && (R === ">" || R === "+" || R === "~" || R === " "))
1548
- return v.slice(0, T) + B + v.slice(T);
1681
+ for (let j = 0; j < k.length; j++) {
1682
+ 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);
1549
1685
  }
1550
- return v + B;
1686
+ return k + P;
1551
1687
  }
1552
- const Z = X.join(""), F = de.join("");
1553
- if (q)
1554
- if (q.includes("&")) {
1555
- const v = q.indexOf("&"), B = q.slice(0, v), O = q.slice(v + 1), P = S + Z, T = j;
1556
- if (X.length === 0)
1557
- j = T.replace(S, B + P + F + O);
1688
+ const q = G.join(""), I = ee.join("");
1689
+ if (M)
1690
+ 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);
1558
1694
  else {
1559
- const R = I(O, F);
1560
- j = T.replace(S, B + P + R);
1695
+ const L = U(R, I);
1696
+ T = j.replace(A, P + O + L);
1561
1697
  }
1562
1698
  } else
1563
- j = j.replace(S, `${q}${S + Z}`), F && (j = j.replace(S, `${S}${F}`));
1699
+ T = T.replace(A, `${M}${A + q}`), I && (T = T.replace(A, `${A}${I}`));
1564
1700
  else
1565
- j = S + Z + F;
1566
- j = j.replace(new RegExp(S, "g"), E);
1567
- let L = `${j}{${A}}`;
1568
- const K = C.filter((v) => ye.includes(v)), D = K.length ? K[K.length - 1] : null, ne = C.includes("dark");
1569
- return b && D ? L = `@media (prefers-color-scheme: dark) and ${me[D]}{${L}}` : b ? L = `@media (prefers-color-scheme: dark){${L}}` : ne && D ? L = `@media (prefers-color-scheme: dark) and ${me[D]}{${L}}` : ne ? L = `@media (prefers-color-scheme: dark){${L}}` : D && (L = `@media ${me[D]}{${L}}`), L;
1570
- }
1571
- for (const w of n) {
1572
- const b = c(w), m = b.find(
1573
- (p) => ge[p] || be(p) || xe(p) || we(p) || ce(p)
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;
1706
+ }
1707
+ 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)
1574
1710
  );
1575
1711
  if (!m) continue;
1576
- const x = b.indexOf(m), l = x >= 0 ? b.slice(0, x) : [], g = y(l);
1577
- if (g === 4) {
1578
- const p = d(w, !0);
1579
- p && f.push(p);
1712
+ const x = g.indexOf(m), l = x >= 0 ? g.slice(0, x) : [], b = C(l);
1713
+ if (b === 4) {
1714
+ const y = h(d, !0);
1715
+ y && f.push(y);
1580
1716
  } else {
1581
- const p = d(w);
1582
- p && (g === 1 ? s.push(p) : g === 2 ? o.push(p) : g === 3 && a.push(p));
1717
+ const y = h(d);
1718
+ y && (b === 1 ? o.push(y) : b === 2 ? s.push(y) : b === 3 && a.push(y));
1583
1719
  }
1584
1720
  }
1585
- const $ = [...s, ...o, ...a, ...f].join("");
1586
- return Ce.set(e, { css: $, timestamp: t }), $;
1721
+ const v = [...o, ...s, ...a, ...f].join("");
1722
+ return Te.set(e, { css: v, timestamp: t }), v;
1587
1723
  }
1588
- const te = [];
1589
- function ft(e, t, r, i, n, s, o, a) {
1724
+ const ne = [];
1725
+ function ut(e, t, r, i, n, o, s, a) {
1590
1726
  if (e) {
1591
- te.push(r);
1727
+ ne.push(r);
1592
1728
  try {
1593
1729
  if (t.loadingTemplate && r.isLoading) {
1594
- Y(e, t.loadingTemplate(r), r, i, n);
1730
+ Q(e, t.loadingTemplate(r), r, i, n);
1595
1731
  return;
1596
1732
  }
1597
1733
  if (t.errorTemplate && r.hasError) {
1598
- r.error instanceof Error && Y(e, t.errorTemplate(r.error, r), r, i, n);
1734
+ r.error instanceof Error && Q(e, t.errorTemplate(r.error, r), r, i, n);
1599
1735
  return;
1600
1736
  }
1601
1737
  const f = t.render(r);
1602
1738
  if (f instanceof Promise) {
1603
- s(!0), f.then((u) => {
1604
- s(!1), o(null), Y(e, u, r, i, n), a(e.innerHTML);
1605
- }).catch((u) => {
1606
- s(!1), o(u), t.errorTemplate && Y(e, t.errorTemplate(u, r), r, i, n);
1607
- }), t.loadingTemplate && Y(e, t.loadingTemplate(r), r, i, n);
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);
1608
1744
  return;
1609
1745
  }
1610
- Y(e, f, r, i, n), a(e.innerHTML);
1746
+ Q(e, f, r, i, n), a(e.innerHTML);
1611
1747
  } finally {
1612
- te.pop();
1748
+ ne.pop();
1613
1749
  }
1614
1750
  }
1615
1751
  }
1616
- function Y(e, t, r, i, n) {
1752
+ function Q(e, t, r, i, n) {
1617
1753
  e && (Ye(
1618
1754
  e,
1619
1755
  Array.isArray(t) ? t : [t],
@@ -1621,85 +1757,85 @@ function Y(e, t, r, i, n) {
1621
1757
  i
1622
1758
  ), n(e.innerHTML));
1623
1759
  }
1624
- function ut(e, t, r, i, n, s, o) {
1625
- if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1760
+ function pt(e, t, r, i, n, o, s) {
1761
+ if (o !== null && clearTimeout(o), Date.now() - t < 16) {
1626
1762
  if (n(r + 1), r > 10) {
1627
- o(null);
1763
+ s(null);
1628
1764
  return;
1629
1765
  }
1630
1766
  } else
1631
1767
  n(0);
1632
1768
  const f = setTimeout(() => {
1633
- i(Date.now()), e(), o(null);
1769
+ i(Date.now()), e(), s(null);
1634
1770
  }, 0);
1635
- o(f);
1771
+ s(f);
1636
1772
  }
1637
- function dt(e, t, r, i, n, s) {
1773
+ function dt(e, t, r, i, n, o) {
1638
1774
  if (!e) return;
1639
- const o = lt(i);
1640
- if (!t.style && (!o || o.trim() === "")) {
1641
- s(null), e.adoptedStyleSheets = [_e()];
1775
+ const s = ft(i);
1776
+ if (!t.style && (!s || s.trim() === "")) {
1777
+ o(null), e.adoptedStyleSheets = [Ee()];
1642
1778
  return;
1643
1779
  }
1644
1780
  let a = "";
1645
1781
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1646
- let f = Ge(`${a}
1647
- ${o}
1782
+ let f = Qe(`${a}
1783
+ ${s}
1648
1784
  `);
1649
1785
  f = Be(f);
1650
- let u = n;
1651
- u || (u = new CSSStyleSheet()), (u.cssRules.length === 0 || u.toString() !== f) && u.replaceSync(f), e.adoptedStyleSheets = [_e(), u], s(u);
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);
1652
1788
  }
1653
- const ue = /* @__PURE__ */ new Map(), Ae = Symbol.for("cer.registry");
1789
+ const de = /* @__PURE__ */ new Map(), je = Symbol.for("cer.registry");
1654
1790
  if (typeof window < "u") {
1655
1791
  const e = globalThis;
1656
- e[Ae] || (e[Ae] = ue);
1792
+ e[je] || (e[je] = de);
1657
1793
  }
1658
- function je(e, t, r) {
1659
- let i = J(e);
1794
+ function Le(e, t, r) {
1795
+ let i = Y(e);
1660
1796
  i.includes("-") || (i = `cer-${i}`);
1661
1797
  let n;
1662
- typeof t == "function" ? n = { ...r, render: t } : n = t, typeof n.onError != "function" && (n.onError = (s, o) => {
1663
- console.error(`[${i}] Error:`, s, o);
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);
1664
1800
  });
1665
1801
  try {
1666
- const s = /* @__PURE__ */ new Set([
1802
+ const o = /* @__PURE__ */ new Set([
1667
1803
  "refs",
1668
1804
  "requestRender",
1669
1805
  "error",
1670
1806
  "hasError",
1671
1807
  "isLoading",
1672
1808
  "emit"
1673
- ]), o = [];
1809
+ ]), s = [];
1674
1810
  if (n.state && typeof n.state == "object" && Object.keys(n.state).forEach((a) => {
1675
- s.has(a) && o.push(a);
1811
+ o.has(a) && s.push(a);
1676
1812
  }), n.props && typeof n.props == "object" && Object.keys(n.props).forEach((a) => {
1677
- s.has(a) && o.push(a);
1813
+ o.has(a) && s.push(a);
1678
1814
  }), n.computed && typeof n.computed == "object" && Object.keys(n.computed).forEach((a) => {
1679
- s.has(a) && o.push(a);
1680
- }), o.length > 0) {
1681
- const a = Array.from(new Set(o));
1815
+ o.has(a) && s.push(a);
1816
+ }), s.length > 0) {
1817
+ const a = Array.from(new Set(s));
1682
1818
  console.warn(
1683
1819
  `[${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.`
1684
1820
  );
1685
1821
  }
1686
1822
  } catch {
1687
1823
  }
1688
- if (ue.set(i, n), typeof window < "u")
1824
+ if (de.set(i, n), typeof window < "u")
1689
1825
  if (!customElements.get(i))
1690
- customElements.define(i, pt(i, n));
1826
+ customElements.define(i, ht(i, n));
1691
1827
  else
1692
1828
  try {
1693
- document.querySelectorAll(i).forEach((s) => {
1829
+ document.querySelectorAll(i).forEach((o) => {
1694
1830
  try {
1695
- typeof s._cfg < "u" && (s._cfg = n), typeof s._render == "function" && s._render(n);
1831
+ typeof o._cfg < "u" && (o._cfg = n), typeof o._render == "function" && o._render(n);
1696
1832
  } catch {
1697
1833
  }
1698
1834
  });
1699
1835
  } catch {
1700
1836
  }
1701
1837
  }
1702
- function pt(e, t) {
1838
+ function ht(e, t) {
1703
1839
  if (!t.render)
1704
1840
  throw new Error(
1705
1841
  "Component must have a render function"
@@ -1743,7 +1879,7 @@ function pt(e, t) {
1743
1879
  _templateLoading = !1;
1744
1880
  _templateError = null;
1745
1881
  constructor() {
1746
- super(), this.attachShadow({ mode: "open" }), this._cfg = ue.get(e) || t;
1882
+ super(), this.attachShadow({ mode: "open" }), this._cfg = de.get(e) || t;
1747
1883
  const r = this._initContext(t);
1748
1884
  Object.defineProperty(r, "refs", {
1749
1885
  value: this._refs,
@@ -1756,12 +1892,12 @@ function pt(e, t) {
1756
1892
  enumerable: !1,
1757
1893
  configurable: !1
1758
1894
  }), this.context = r, Object.defineProperty(this.context, "emit", {
1759
- value: (n, s, o) => {
1895
+ value: (n, o, s) => {
1760
1896
  const a = new CustomEvent(n, {
1761
- detail: s,
1897
+ detail: o,
1762
1898
  bubbles: !0,
1763
1899
  composed: !0,
1764
- ...o || {}
1900
+ ...s || {}
1765
1901
  });
1766
1902
  return this.dispatchEvent(a), !a.defaultPrevented;
1767
1903
  },
@@ -1769,15 +1905,15 @@ function pt(e, t) {
1769
1905
  enumerable: !1,
1770
1906
  configurable: !1
1771
1907
  });
1772
- const i = ue.get(e) || t;
1908
+ const i = de.get(e) || t;
1773
1909
  Object.keys(i).forEach((n) => {
1774
- const s = i[n];
1775
- typeof s == "function" && (this.context[n] = (...o) => s(...o, this.context));
1910
+ const o = i[n];
1911
+ typeof o == "function" && (this.context[n] = (...s) => o(...s, this.context));
1776
1912
  }), this._applyComputed(i), this._initializing = !1, this._initWatchers(i), this._render(i);
1777
1913
  }
1778
1914
  connectedCallback() {
1779
1915
  this._runLogicWithinErrorBoundary(t, () => {
1780
- this._applyProps(t), qe(
1916
+ this._applyProps(t), We(
1781
1917
  t,
1782
1918
  this.context,
1783
1919
  this._mounted,
@@ -1813,7 +1949,7 @@ function pt(e, t) {
1813
1949
  }
1814
1950
  attributeChangedCallback(r, i, n) {
1815
1951
  this._runLogicWithinErrorBoundary(t, () => {
1816
- this._applyProps(t), Ie(
1952
+ this._applyProps(t), Ue(
1817
1953
  t,
1818
1954
  r,
1819
1955
  i,
@@ -1823,15 +1959,15 @@ function pt(e, t) {
1823
1959
  });
1824
1960
  }
1825
1961
  static get observedAttributes() {
1826
- return t.props ? Object.keys(t.props).map(J) : [];
1962
+ return t.props ? Object.keys(t.props).map(Y) : [];
1827
1963
  }
1828
1964
  _applyComputed(r) {
1829
1965
  this._runLogicWithinErrorBoundary(t, () => {
1830
1966
  r.computed && Object.entries(r.computed).forEach(([i, n]) => {
1831
1967
  Object.defineProperty(this.context, i, {
1832
1968
  get: () => {
1833
- const s = n(this.context);
1834
- return H(s);
1969
+ const o = n(this.context);
1970
+ return J(o);
1835
1971
  },
1836
1972
  enumerable: !0
1837
1973
  });
@@ -1841,7 +1977,7 @@ function pt(e, t) {
1841
1977
  // --- Render ---
1842
1978
  _render(r) {
1843
1979
  this._runLogicWithinErrorBoundary(r, () => {
1844
- ft(
1980
+ ut(
1845
1981
  this.shadowRoot,
1846
1982
  r,
1847
1983
  this.context,
@@ -1864,7 +2000,7 @@ function pt(e, t) {
1864
2000
  }
1865
2001
  _requestRender() {
1866
2002
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1867
- ut(
2003
+ pt(
1868
2004
  () => this._render(this._cfg),
1869
2005
  this._lastRenderTime,
1870
2006
  this._renderCount,
@@ -1911,11 +2047,11 @@ function pt(e, t) {
1911
2047
  // --- State, props, computed ---
1912
2048
  _initContext(r) {
1913
2049
  try {
1914
- let i = function(s, o = "") {
1915
- return Array.isArray(s) ? new Proxy(s, {
1916
- get(a, f, u) {
1917
- const d = Reflect.get(a, f, u);
1918
- return typeof d == "function" && typeof f == "string" && [
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" && [
1919
2055
  "push",
1920
2056
  "pop",
1921
2057
  "shift",
@@ -1923,44 +2059,44 @@ function pt(e, t) {
1923
2059
  "splice",
1924
2060
  "sort",
1925
2061
  "reverse"
1926
- ].includes(f) ? function(...c) {
1927
- const h = d.apply(a, c);
2062
+ ].includes(f) ? function(...u) {
2063
+ const c = h.apply(a, u);
1928
2064
  if (!n._initializing) {
1929
- const k = o || "root";
1930
- n._triggerWatchers(k, a), n._render(r);
2065
+ const w = s || "root";
2066
+ n._triggerWatchers(w, a), n._render(r);
1931
2067
  }
1932
- return h;
1933
- } : d;
2068
+ return c;
2069
+ } : h;
1934
2070
  },
1935
- set(a, f, u) {
1936
- if (a[f] = u, !n._initializing) {
1937
- const d = o ? `${o}.${String(f)}` : String(f);
1938
- n._triggerWatchers(d, u), n._render(r);
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);
1939
2075
  }
1940
2076
  return !0;
1941
2077
  },
1942
2078
  deleteProperty(a, f) {
1943
2079
  if (delete a[f], !n._initializing) {
1944
- const u = o ? `${o}.${String(f)}` : String(f);
1945
- n._triggerWatchers(u, void 0), n._render(r);
2080
+ const p = s ? `${s}.${String(f)}` : String(f);
2081
+ n._triggerWatchers(p, void 0), n._render(r);
1946
2082
  }
1947
2083
  return !0;
1948
2084
  }
1949
- }) : s && typeof s == "object" ? (Object.keys(s).forEach((a) => {
1950
- const f = o ? `${o}.${a}` : a;
1951
- s[a] = i(s[a], f);
1952
- }), new Proxy(s, {
1953
- set(a, f, u) {
1954
- const d = o ? `${o}.${String(f)}` : String(f);
1955
- return a[f] = i(u, d), n._initializing || (n._triggerWatchers(
1956
- d,
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,
1957
2093
  a[f]
1958
2094
  ), n._render(r)), !0;
1959
2095
  },
1960
- get(a, f, u) {
1961
- return Reflect.get(a, f, u);
2096
+ get(a, f, p) {
2097
+ return Reflect.get(a, f, p);
1962
2098
  }
1963
- })) : s;
2099
+ })) : o;
1964
2100
  };
1965
2101
  const n = this;
1966
2102
  return i({ ...r.state });
@@ -1970,7 +2106,7 @@ function pt(e, t) {
1970
2106
  }
1971
2107
  _initWatchers(r) {
1972
2108
  this._runLogicWithinErrorBoundary(r, () => {
1973
- ze(
2109
+ qe(
1974
2110
  this.context,
1975
2111
  this._watchers,
1976
2112
  r.watch || {}
@@ -1978,12 +2114,12 @@ function pt(e, t) {
1978
2114
  });
1979
2115
  }
1980
2116
  _triggerWatchers(r, i) {
1981
- Me(this.context, this._watchers, r, i);
2117
+ Ie(this.context, this._watchers, r, i);
1982
2118
  }
1983
2119
  _applyProps(r) {
1984
2120
  this._runLogicWithinErrorBoundary(r, () => {
1985
2121
  try {
1986
- We(this, r, this.context);
2122
+ Ne(this, r, this.context);
1987
2123
  } catch (i) {
1988
2124
  this._hasError = !0, r.onError && r.onError(i, this.context), r.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = r.errorFallback(i, this.context));
1989
2125
  }
@@ -1991,101 +2127,101 @@ function pt(e, t) {
1991
2127
  }
1992
2128
  };
1993
2129
  }
1994
- function ee(e, t = {}, r, i) {
2130
+ function re(e, t = {}, r, i) {
1995
2131
  const n = i ?? t.key;
1996
2132
  return { tag: e, key: n, props: t, children: r };
1997
2133
  }
1998
- function le(e) {
2134
+ function ue(e) {
1999
2135
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
2000
2136
  }
2001
- function se(e) {
2002
- return typeof e == "object" && e !== null && "tag" in e && !le(e);
2137
+ function ae(e) {
2138
+ return typeof e == "object" && e !== null && "tag" in e && !ue(e);
2003
2139
  }
2004
- function ht(e, t) {
2140
+ function gt(e, t) {
2005
2141
  return e.key != null ? e : { ...e, key: t };
2006
2142
  }
2007
- function gt(e, t = [], r = {}) {
2008
- const i = {}, n = {}, s = {}, o = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
2009
- let a;
2010
- for (; a = o.exec(e); ) {
2011
- const f = a[1], u = a[2], d = (a[4] || a[6]) ?? "", y = d.match(/^{{(\d+)}}$/);
2012
- let c = y ? t[Number(y[1])] ?? null : d;
2013
- y || (c === "true" ? c = !0 : c === "false" ? c = !1 : c === "null" ? c = null : isNaN(Number(c)) || (c = Number(c)));
2014
- const h = ["model", "bind", "show", "class", "style"];
2015
- if (f === ":") {
2016
- const [k, $] = u.split(":"), [w, ...b] = k.split(".");
2017
- if (h.includes(w)) {
2018
- const m = [...b], x = w === "model" && $ ? `model:${$}` : w;
2019
- s[x] = {
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)));
2150
+ const w = ["model", "bind", "show", "class", "style"];
2151
+ if (p === ":") {
2152
+ const [v, d] = h.split(":"), [g, ...m] = v.split(".");
2153
+ if (w.includes(g)) {
2154
+ const x = [...m], l = g === "model" && d ? `model:${d}` : g;
2155
+ o[l] = {
2020
2156
  value: c,
2021
- modifiers: m,
2022
- arg: $
2157
+ modifiers: x,
2158
+ arg: d
2023
2159
  };
2024
2160
  } else
2025
- n[u] = c;
2026
- } else if (f === "@") {
2027
- const k = "on" + u.charAt(0).toUpperCase() + u.slice(1);
2028
- i[k] = typeof c == "function" ? c : typeof r[c] == "function" ? r[c] : void 0;
2029
- } else u === "ref" ? i.ref = c : n[u] = c;
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;
2030
2166
  }
2031
- return { props: i, attrs: n, directives: s };
2167
+ return { props: i, attrs: n, directives: o, bound: s };
2032
2168
  }
2033
- function mt(e, t, r) {
2034
- const i = te.length > 0 ? te[te.length - 1] : void 0, n = r ?? i;
2035
- function s(l, g) {
2036
- return ee("#text", {}, l, g);
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);
2037
2173
  }
2038
- let o = "";
2174
+ let s = "";
2039
2175
  for (let l = 0; l < e.length; l++)
2040
- o += e[l], l < t.length && (o += `{{${l}}}`);
2176
+ s += e[l], l < t.length && (s += `{{${l}}}`);
2041
2177
  const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, f = [];
2042
- let u, d = [], y = null, c = {}, h, k = 0, $ = [];
2043
- function w(l) {
2044
- !l || typeof l != "object" || le(l) || (l.props || l.attrs ? (l.props && (c.props || (c.props = {}), Object.assign(c.props, l.props)), l.attrs && (c.attrs || (c.attrs = {}), Object.keys(l.attrs).forEach((g) => {
2045
- if (g === "style" && c.attrs.style) {
2046
- const p = c.attrs.style.replace(
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(
2047
2183
  /;?\s*$/,
2048
2184
  ""
2049
2185
  ), _ = l.attrs.style.replace(/^;?\s*/, "");
2050
- c.attrs.style = p + "; " + _;
2051
- } else if (g === "class" && c.attrs.class) {
2052
- const p = c.attrs.class.trim().split(/\s+/).filter(Boolean), _ = l.attrs.class.trim().split(/\s+/).filter(Boolean), C = [
2053
- .../* @__PURE__ */ new Set([...p, ..._])
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, ..._])
2054
2190
  ];
2055
- c.attrs.class = C.join(" ");
2191
+ u.attrs.class = E.join(" ");
2056
2192
  } else
2057
- c.attrs[g] = l.attrs[g];
2058
- }))) : (c.props || (c.props = {}), Object.assign(c.props, l)));
2059
- }
2060
- function b(l, g) {
2061
- const p = y ? d : $;
2062
- if (le(l)) {
2063
- const _ = l.key ?? g;
2064
- let C = l.children;
2065
- p.push({
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({
2066
2202
  ...l,
2067
2203
  key: _,
2068
- children: C
2204
+ children: E
2069
2205
  });
2070
2206
  return;
2071
2207
  }
2072
- if (se(l)) {
2073
- p.push(ht(l, void 0));
2208
+ if (ae(l)) {
2209
+ y.push(gt(l, void 0));
2074
2210
  return;
2075
2211
  }
2076
2212
  if (Array.isArray(l)) {
2077
2213
  if (l.length === 0) return;
2078
2214
  for (let _ = 0; _ < l.length; _++) {
2079
- const C = l[_];
2080
- le(C) || se(C) || Array.isArray(C) ? b(C, `${g}-${_}`) : C !== null && typeof C == "object" ? w(C) : p.push(s(String(C), `${g}-${_}`));
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}-${_}`));
2081
2217
  }
2082
2218
  return;
2083
2219
  }
2084
2220
  if (l !== null && typeof l == "object") {
2085
- w(l);
2221
+ d(l);
2086
2222
  return;
2087
2223
  }
2088
- p.push(s(String(l), g));
2224
+ y.push(o(String(l), b));
2089
2225
  }
2090
2226
  const m = /* @__PURE__ */ new Set([
2091
2227
  "area",
@@ -2103,91 +2239,122 @@ function mt(e, t, r) {
2103
2239
  "track",
2104
2240
  "wbr"
2105
2241
  ]);
2106
- for (; u = a.exec(o); )
2107
- if (u[1]) {
2108
- const l = u[1], g = u[0][1] === "/", p = u[0][u[0].length - 2] === "/" || m.has(l), {
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), {
2109
2245
  props: _,
2110
- attrs: C,
2111
- directives: E
2112
- } = gt(u[2] || "", t, n), S = { props: {}, attrs: {} };
2113
- for (const A in _) S.props[A] = _[A];
2114
- for (const A in C) S.attrs[A] = C[A];
2115
- if (E && Object.keys(E).some((A) => A === "model" || A.startsWith("model:")))
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")))
2116
2253
  try {
2117
- const A = Symbol.for("cer.registry"), j = globalThis[A], Q = !!(j && typeof j.has == "function" && j.has(l)), X = !!(n && (n.__customElements instanceof Set && n.__customElements.has(l) || Array.isArray(n.__isCustomElements) && n.__isCustomElements.includes(l)));
2118
- if (!!(l.includes("-") || X || Q))
2119
- for (const I of Object.keys(E)) {
2120
- if (I !== "model" && !I.startsWith("model:")) continue;
2121
- const Z = E[I], F = Z.arg ?? (I.includes(":") ? I.split(":", 2)[1] : void 0), L = Z.value, K = F ?? "modelValue", D = z, ne = oe, v = n ? n._state || n : void 0;
2122
- let B;
2123
- typeof L == "string" && n ? B = D(v, L) : B = L, S.props[K] = B;
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:")))
2283
+ 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;
2124
2291
  try {
2125
- const T = J(K);
2126
- S.attrs || (S.attrs = {}), B !== void 0 && (S.attrs[T] = B);
2292
+ const L = Y(F);
2293
+ $.attrs || ($.attrs = {}), R !== void 0 && ($.attrs[L] = R);
2127
2294
  } catch {
2128
2295
  }
2129
- S.isCustomElement = !0;
2130
- const O = `update:${J(K)}`, P = "on" + O.charAt(0).toUpperCase() + O.slice(1);
2131
- S.props[P] = function(T) {
2132
- const R = T.detail !== void 0 ? T.detail : T.target ? T.target.value : void 0;
2133
- if (!v) return;
2134
- const pe = D(v, typeof L == "string" ? L : String(L));
2135
- (Array.isArray(R) && Array.isArray(pe) ? JSON.stringify([...R].sort()) !== JSON.stringify([...pe].sort()) : R !== pe) && (ne(v, typeof L == "string" ? L : String(L), R), n?.requestRender ? n.requestRender() : n?._requestRender && n._requestRender());
2136
- }, delete E[I];
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];
2137
2304
  }
2138
2305
  } catch {
2139
2306
  }
2140
- if (Object.keys(E).length > 0 && (S.directives = { ...E }), g) {
2141
- const A = ee(
2142
- y,
2143
- c,
2144
- d.length === 1 && se(d[0]) && d[0].tag === "#text" ? typeof d[0].children == "string" ? d[0].children : "" : d.length ? d : void 0,
2145
- h
2146
- ), j = f.pop();
2147
- j ? (y = j.tag, c = j.props, h = j.key, d = j.children, d.push(A)) : ($.push(A), y = null, c = {}, h = void 0, d = []);
2148
- } else p ? y ? d.push(ee(l, S, void 0, void 0)) : $.push(ee(l, S, void 0, void 0)) : (y && f.push({
2149
- tag: y,
2150
- props: c,
2151
- children: d,
2152
- key: h
2153
- }), y = l, c = S, d = []);
2154
- } else if (typeof u[3] < "u") {
2155
- const l = Number(u[3]), g = t[l], p = `interp-${l}`;
2156
- b(g, p);
2157
- } else if (u[4]) {
2158
- const l = u[4], g = y ? d : $, p = l.split(/({{\d+}})/);
2159
- for (const _ of p) {
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) {
2160
2327
  if (!_) continue;
2161
- const C = _.match(/^{{(\d+)}}$/);
2162
- if (C) {
2163
- const E = Number(C[1]), S = t[E], A = `interp-${E}`;
2164
- b(S, A);
2328
+ const E = _.match(/^{{(\d+)}}$/);
2329
+ if (E) {
2330
+ const S = Number(E[1]), A = t[S], $ = `interp-${S}`;
2331
+ g(A, $);
2165
2332
  } else {
2166
- const E = `text-${k++}`;
2167
- g.push(s(_, E));
2333
+ const S = `text-${w++}`;
2334
+ b.push(o(_, S));
2168
2335
  }
2169
2336
  }
2170
2337
  }
2171
- const x = $.filter((l) => se(l) && l.tag === "#text" ? typeof l.children == "string" && l.children.trim() !== "" : !0);
2172
- return x.length === 1 ? x[0] : x.length > 1 ? x : ee("div", {}, "", "fallback-root");
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");
2173
2340
  }
2174
- function U(e, ...t) {
2341
+ function Z(e, ...t) {
2175
2342
  const r = t[t.length - 1], i = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2176
- return mt(e, t, i);
2343
+ return yt(e, t, i);
2177
2344
  }
2178
- const Te = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, W = (e, t) => {
2345
+ const Re = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, K = (e, t) => {
2179
2346
  for (const r of e) {
2180
- const i = [], n = r.path.replace(/:[^/]+/g, (a) => (i.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${n}$`), o = t.match(s);
2181
- if (o) {
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) {
2182
2349
  const a = {};
2183
- return i.forEach((f, u) => {
2184
- a[f] = o[u + 1];
2350
+ return i.forEach((f, p) => {
2351
+ a[f] = s[p + 1];
2185
2352
  }), { route: r, params: a };
2186
2353
  }
2187
2354
  }
2188
2355
  return { route: null, params: {} };
2189
2356
  }, ke = {};
2190
- async function yt(e) {
2357
+ async function bt(e) {
2191
2358
  if (e.component) return e.component;
2192
2359
  if (e.load) {
2193
2360
  if (ke[e.path]) return ke[e.path];
@@ -2200,160 +2367,160 @@ async function yt(e) {
2200
2367
  }
2201
2368
  throw new Error(`No component or loader defined for route: ${e.path}`);
2202
2369
  }
2203
- function bt(e) {
2370
+ function wt(e) {
2204
2371
  const { routes: t, base: r = "", initialUrl: i } = e;
2205
- let n, s, o, a, f, u, d;
2206
- const y = async ($, w) => {
2207
- const b = t.find((m) => W([m], $.path).route !== null);
2208
- if (b?.beforeEnter)
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);
2375
+ if (g?.beforeEnter)
2209
2376
  try {
2210
- const m = await b.beforeEnter($, w);
2211
- return typeof m == "string" ? (await k(m, !0), !1) : m !== !1;
2377
+ const m = await g.beforeEnter(v, d);
2378
+ return typeof m == "string" ? (await w(m, !0), !1) : m !== !1;
2212
2379
  } catch (m) {
2213
2380
  return console.error("beforeEnter error", m), !1;
2214
2381
  }
2215
2382
  return !0;
2216
- }, c = async ($, w) => {
2217
- const b = t.find((m) => W([m], $.path).route !== null);
2218
- if (b?.onEnter)
2383
+ }, u = async (v, d) => {
2384
+ const g = t.find((m) => K([m], v.path).route !== null);
2385
+ if (g?.onEnter)
2219
2386
  try {
2220
- const m = await b.onEnter($, w);
2221
- return typeof m == "string" ? (await k(m, !0), !1) : m !== !1;
2387
+ const m = await g.onEnter(v, d);
2388
+ return typeof m == "string" ? (await w(m, !0), !1) : m !== !1;
2222
2389
  } catch (m) {
2223
2390
  return console.error("onEnter error", m), !1;
2224
2391
  }
2225
2392
  return !0;
2226
- }, h = ($, w) => {
2227
- const b = t.find((m) => W([m], $.path).route !== null);
2228
- if (b?.afterEnter)
2393
+ }, c = (v, d) => {
2394
+ const g = t.find((m) => K([m], v.path).route !== null);
2395
+ if (g?.afterEnter)
2229
2396
  try {
2230
- b.afterEnter($, w);
2397
+ g.afterEnter(v, d);
2231
2398
  } catch (m) {
2232
2399
  console.error("afterEnter error", m);
2233
2400
  }
2234
- }, k = async ($, w = !1) => {
2401
+ }, w = async (v, d = !1) => {
2235
2402
  try {
2236
- const b = {
2237
- path: $.replace(r, "") || "/",
2403
+ const g = {
2404
+ path: v.replace(r, "") || "/",
2238
2405
  query: {}
2239
- }, m = W(t, b.path);
2240
- if (!m) throw new Error(`No route found for ${b.path}`);
2241
- const x = o.getState(), l = {
2242
- path: b.path,
2406
+ }, m = K(t, g.path);
2407
+ if (!m) throw new Error(`No route found for ${g.path}`);
2408
+ const x = s.getState(), l = {
2409
+ path: g.path,
2243
2410
  params: m.params,
2244
- query: b.query
2411
+ query: g.query
2245
2412
  };
2246
- if (!await y(l, x) || !await c(l, x)) return;
2247
- typeof window < "u" && typeof document < "u" && (w ? window.history.replaceState({}, "", r + $) : window.history.pushState({}, "", r + $)), o.setState(l), h(l, x);
2248
- } catch (b) {
2249
- console.error("Navigation error:", b);
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);
2415
+ } catch (g) {
2416
+ console.error("Navigation error:", g);
2250
2417
  }
2251
2418
  };
2252
2419
  if (typeof window < "u" && typeof document < "u") {
2253
2420
  n = () => {
2254
- const w = new URL(window.location.href), b = w.pathname.replace(r, "") || "/", m = Te(w.search);
2255
- return { path: b, query: m };
2256
- }, s = n();
2257
- const $ = W(t, s.path);
2258
- o = $e({
2259
- path: s.path,
2260
- params: $.params,
2261
- query: s.query
2262
- }), a = async (w = !1) => {
2263
- const b = n();
2264
- await k(b.path, w);
2265
- }, window.addEventListener("popstate", () => a(!0)), f = (w) => k(w, !1), u = (w) => k(w, !0), d = () => window.history.back();
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,
2427
+ params: v.params,
2428
+ query: o.query
2429
+ }), a = async (d = !1) => {
2430
+ const g = n();
2431
+ 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();
2266
2433
  } else {
2267
2434
  n = () => {
2268
- const b = new URL(i || "/", "http://localhost"), m = b.pathname.replace(r, "") || "/", x = Te(b.search);
2435
+ const g = new URL(i || "/", "http://localhost"), m = g.pathname.replace(r, "") || "/", x = Re(g.search);
2269
2436
  return { path: m, query: x };
2270
- }, s = n();
2271
- const $ = W(t, s.path);
2272
- o = $e({
2273
- path: s.path,
2274
- params: $.params,
2275
- query: s.query
2437
+ }, o = n();
2438
+ const v = K(t, o.path);
2439
+ s = $e({
2440
+ path: o.path,
2441
+ params: v.params,
2442
+ query: o.query
2276
2443
  }), a = async () => {
2277
- const b = n();
2278
- await w(b.path);
2444
+ const g = n();
2445
+ await d(g.path);
2279
2446
  };
2280
- const w = async (b) => {
2447
+ const d = async (g) => {
2281
2448
  try {
2282
2449
  const m = {
2283
- path: b.replace(r, "") || "/",
2450
+ path: g.replace(r, "") || "/",
2284
2451
  query: {}
2285
- }, x = W(t, m.path);
2452
+ }, x = K(t, m.path);
2286
2453
  if (!x) throw new Error(`No route found for ${m.path}`);
2287
- const l = o.getState(), g = {
2454
+ const l = s.getState(), b = {
2288
2455
  path: m.path,
2289
2456
  params: x.params,
2290
2457
  query: m.query
2291
- }, p = t.find((_) => W([_], g.path).route !== null);
2292
- if (p?.beforeEnter)
2458
+ }, y = t.find((_) => K([_], b.path).route !== null);
2459
+ if (y?.beforeEnter)
2293
2460
  try {
2294
- const _ = await p.beforeEnter(g, l);
2461
+ const _ = await y.beforeEnter(b, l);
2295
2462
  if (typeof _ == "string") {
2296
- await w(_);
2463
+ await d(_);
2297
2464
  return;
2298
2465
  }
2299
2466
  if (_ === !1) return;
2300
2467
  } catch {
2301
2468
  return;
2302
2469
  }
2303
- if (p?.onEnter)
2470
+ if (y?.onEnter)
2304
2471
  try {
2305
- const _ = await p.onEnter(g, l);
2472
+ const _ = await y.onEnter(b, l);
2306
2473
  if (typeof _ == "string") {
2307
- await w(_);
2474
+ await d(_);
2308
2475
  return;
2309
2476
  }
2310
2477
  if (_ === !1) return;
2311
2478
  } catch {
2312
2479
  return;
2313
2480
  }
2314
- if (o.setState(g), p?.afterEnter)
2481
+ if (s.setState(b), y?.afterEnter)
2315
2482
  try {
2316
- p.afterEnter(g, l);
2483
+ y.afterEnter(b, l);
2317
2484
  } catch {
2318
2485
  }
2319
2486
  } catch {
2320
2487
  }
2321
2488
  };
2322
- f = async (b) => w(b), u = async (b) => w(b), d = () => {
2489
+ f = async (g) => d(g), p = async (g) => d(g), h = () => {
2323
2490
  };
2324
2491
  }
2325
2492
  return {
2326
- store: o,
2493
+ store: s,
2327
2494
  push: f,
2328
- replace: u,
2329
- back: d,
2330
- subscribe: o.subscribe,
2331
- matchRoute: ($) => W(t, $),
2332
- getCurrent: () => o.getState(),
2333
- resolveRouteComponent: yt
2495
+ replace: p,
2496
+ back: h,
2497
+ subscribe: s.subscribe,
2498
+ matchRoute: (v) => K(t, v),
2499
+ getCurrent: () => s.getState(),
2500
+ resolveRouteComponent: bt
2334
2501
  };
2335
2502
  }
2336
- function Ct(e, t) {
2337
- return W(e, t);
2503
+ function At(e, t) {
2504
+ return K(e, t);
2338
2505
  }
2339
- function At(e) {
2340
- const t = bt(e);
2341
- return je("router-view", {
2506
+ function Tt(e) {
2507
+ const t = wt(e);
2508
+ return Le("router-view", {
2342
2509
  async render() {
2343
- if (!t) return U`<div>Router not initialized.</div>`;
2510
+ if (!t) return Z`<div>Router not initialized.</div>`;
2344
2511
  const r = t.getCurrent(), { path: i } = r, n = t.matchRoute(i);
2345
- if (!n.route) return U`<div>Not found</div>`;
2512
+ if (!n.route) return Z`<div>Not found</div>`;
2346
2513
  try {
2347
- const s = await t.resolveRouteComponent(n.route);
2348
- if (typeof s == "string")
2349
- return { tag: s, props: {}, children: [] };
2350
- if (typeof s == "function") {
2351
- const o = s(), a = o instanceof Promise ? await o : o;
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;
2352
2519
  return typeof a == "string" ? { tag: a, props: {}, children: [] } : a;
2353
2520
  }
2354
- return U`<div>Invalid route component</div>`;
2521
+ return Z`<div>Invalid route component</div>`;
2355
2522
  } catch {
2356
- return U`<div>Invalid route component</div>`;
2523
+ return Z`<div>Invalid route component</div>`;
2357
2524
  }
2358
2525
  },
2359
2526
  onConnected(r) {
@@ -2361,7 +2528,7 @@ function At(e) {
2361
2528
  typeof r.requestRender == "function" && r.requestRender();
2362
2529
  });
2363
2530
  }
2364
- }), je("router-link", {
2531
+ }), Le("router-link", {
2365
2532
  state: {},
2366
2533
  props: {
2367
2534
  to: { type: String, default: "" },
@@ -2374,7 +2541,7 @@ function At(e) {
2374
2541
  disabled: { type: Boolean, default: !1 },
2375
2542
  external: { type: Boolean, default: !1 },
2376
2543
  class: { type: String, default: "" },
2377
- style: { type: String, default: Oe`
2544
+ style: { type: String, default: Pe`
2378
2545
  [aria-disabled="true"] {
2379
2546
  pointer-events: none;
2380
2547
  opacity: 0.5;
@@ -2383,30 +2550,30 @@ function At(e) {
2383
2550
  },
2384
2551
  style: (r) => r.style,
2385
2552
  render: (r) => {
2386
- const i = t.getCurrent(), n = r.to, s = r.exact, o = r.exactActiveClass, a = r.activeClass, f = r.ariaCurrentValue, u = r.tag, d = r.disabled, y = r.external, c = i.path === n, h = s ? c : i && typeof i.path == "string" ? i.path.startsWith(n) : !1, k = c ? `aria-current="${f}"` : "", $ = (r.class || "").split(/\s+/).filter(Boolean), w = {};
2387
- for (const g of $) w[g] = !0;
2388
- const b = {
2389
- ...w,
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 = {};
2554
+ for (const b of v) d[b] = !0;
2555
+ const g = {
2556
+ ...d,
2390
2557
  // Also include the configurable names (may duplicate the above)
2391
- [a]: h,
2392
- [o]: c
2393
- }, m = u === "button", x = d ? m ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", l = y && (u === "a" || !u) ? 'target="_blank" rel="noopener noreferrer"' : "";
2394
- return U`
2395
- ${Pe().when(m, U`
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`
2396
2563
  <button
2397
2564
  part="button"
2398
- :class="${b}"
2399
- ${k}
2565
+ :class="${g}"
2566
+ ${w}
2400
2567
  ${x}
2401
2568
  ${l}
2402
2569
  @click="navigate"
2403
2570
  ><slot></slot></button>
2404
- `).otherwise(U`
2571
+ `).otherwise(Z`
2405
2572
  <a
2406
2573
  part="link"
2407
2574
  href="${n}"
2408
- :class="${b}"
2409
- ${k}
2575
+ :class="${g}"
2576
+ ${w}
2410
2577
  ${x}
2411
2578
  ${l}
2412
2579
  @click="navigate"
@@ -2424,26 +2591,26 @@ function At(e) {
2424
2591
  }), t;
2425
2592
  }
2426
2593
  export {
2427
- G as GlobalEventBus,
2428
- je as component,
2594
+ X as GlobalEventBus,
2595
+ Le as component,
2429
2596
  $e as createStore,
2430
- Oe as css,
2597
+ Pe as css,
2431
2598
  kt as each,
2432
- vt as emit,
2433
- re as eventBus,
2434
- U as html,
2435
- At as initRouter,
2436
- Et as listen,
2437
- Pe as match,
2438
- W as matchRoute,
2439
- Ct as matchRouteSSR,
2440
- _t as off,
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,
2441
2608
  $t as on,
2442
- St as once,
2443
- Te as parseQuery,
2444
- he as renderToString,
2445
- yt as resolveRouteComponent,
2446
- bt as useRouter,
2447
- xt as when
2609
+ Et as once,
2610
+ Re as parseQuery,
2611
+ ge as renderToString,
2612
+ bt as resolveRouteComponent,
2613
+ wt as useRouter,
2614
+ vt as when
2448
2615
  };
2449
2616
  //# sourceMappingURL=custom-elements-runtime.es.js.map