@jasonshimmy/custom-elements-runtime 0.1.16 → 0.1.17

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 tt(e, t) {
2
- return U(e ? t : [], "when-block");
1
+ function ft(e, t) {
2
+ return Q(e ? t : [], "when-block");
3
3
  }
4
- function rt(e, t) {
4
+ function ut(e, t) {
5
5
  return e.map((r, n) => {
6
6
  const o = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${n}` : String(r);
7
- return U(t(r, n), `each-${o}`);
7
+ return Q(t(r, n), `each-${o}`);
8
8
  });
9
9
  }
10
- function be() {
10
+ function Ae() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function be() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return ve(...e);
20
+ return Te(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function ve(...e) {
24
+ function Te(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, n] = e[t];
27
- if (r) return [U(n, `whenChain-branch-${t}`)];
27
+ if (r) return [Q(n, `whenChain-branch-${t}`)];
28
28
  }
29
- return [U([], "whenChain-empty")];
29
+ return [Q([], "whenChain-empty")];
30
30
  }
31
- function U(e, t) {
31
+ function Q(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 U(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class O extends EventTarget {
39
+ class D extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class O extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return O.instance || (O.instance = new O()), O.instance;
47
+ return D.instance || (D.instance = new D()), D.instance;
48
48
  }
49
49
  // Enhanced emit method with better typing and event storm protection
50
50
  /**
@@ -160,8 +160,8 @@ class O extends EventTarget {
160
160
  this.eventCounters.clear();
161
161
  }
162
162
  }
163
- const D = O.getInstance(), nt = (e, t) => D.emit(e, t), ot = (e, t) => D.on(e, t), it = (e, t) => D.off(e, t), st = (e, t) => D.once(e, t), at = (e, t, r) => D.listen(e, t, r);
164
- function se(e) {
163
+ const I = D.getInstance(), dt = (e, t) => I.emit(e, t), pt = (e, t) => I.on(e, t), ht = (e, t) => I.off(e, t), gt = (e, t) => I.once(e, t), yt = (e, t, r) => I.listen(e, t, r);
164
+ function de(e) {
165
165
  let t = { ...e };
166
166
  const r = [];
167
167
  function n(a) {
@@ -179,10 +179,10 @@ function se(e) {
179
179
  }
180
180
  return { subscribe: n, getState: o, setState: s };
181
181
  }
182
- function ne(e) {
182
+ function ce(e) {
183
183
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
184
184
  }
185
- function ee(e) {
185
+ function se(e) {
186
186
  return typeof e == "string" ? e.replace(
187
187
  /[&<>"']/g,
188
188
  (t) => ({
@@ -194,32 +194,32 @@ function ee(e) {
194
194
  })[t]
195
195
  ) : e;
196
196
  }
197
- function xe(e, t, r) {
197
+ function Le(e, t, r) {
198
198
  if (r)
199
199
  for (const [n, o] of Object.entries(r)) {
200
200
  let s, i = {};
201
201
  if (Array.isArray(o) ? (s = o[0], i = o[1] || {}) : s = o, t.set(n, {
202
202
  callback: s,
203
203
  options: i,
204
- oldValue: te(e, n)
204
+ oldValue: ae(e, n)
205
205
  }), i.immediate)
206
206
  try {
207
- const a = te(e, n);
207
+ const a = ae(e, n);
208
208
  s(a, void 0, e);
209
209
  } catch (a) {
210
210
  console.error(`Error in immediate watcher for "${n}":`, a);
211
211
  }
212
212
  }
213
213
  }
214
- function te(e, t) {
214
+ function ae(e, t) {
215
215
  return t.split(".").reduce((r, n) => r?.[n], e);
216
216
  }
217
- function we(e, t, r, n) {
217
+ function je(e, t, r, n) {
218
218
  const o = (i, a) => {
219
219
  if (i === a) return !0;
220
220
  if (typeof i != typeof a || typeof i != "object" || i === null || a === null) return !1;
221
221
  if (Array.isArray(i) && Array.isArray(a))
222
- return i.length !== a.length ? !1 : i.every((y, h) => o(y, a[h]));
222
+ return i.length !== a.length ? !1 : i.every((y, p) => o(y, a[p]));
223
223
  const c = Object.keys(i), f = Object.keys(a);
224
224
  return c.length !== f.length ? !1 : c.every((y) => o(i[y], a[y]));
225
225
  }, s = t.get(r);
@@ -232,13 +232,13 @@ function we(e, t, r, n) {
232
232
  for (const [i, a] of t.entries())
233
233
  if (a.options.deep && r.startsWith(i + "."))
234
234
  try {
235
- const c = te(e, i);
235
+ const c = ae(e, i);
236
236
  o(c, a.oldValue) || (a.callback(c, a.oldValue, e), a.oldValue = c);
237
237
  } catch (c) {
238
238
  console.error(`Error in deep watcher for "${i}":`, c);
239
239
  }
240
240
  }
241
- function ke(e, t, r) {
241
+ function ze(e, t, r) {
242
242
  if (!t.props) return;
243
243
  function n(o, s) {
244
244
  return s === Boolean ? o === "true" : s === Number ? Number(o) : o;
@@ -247,136 +247,136 @@ function ke(e, t, r) {
247
247
  if (s.type === Function && typeof e[o] == "function")
248
248
  r[o] = e[o];
249
249
  else {
250
- const i = e.getAttribute(ne(o));
251
- i !== null ? r[o] = ee(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = ee(s.default));
250
+ const i = e.getAttribute(ce(o));
251
+ i !== null ? r[o] = se(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = se(s.default));
252
252
  }
253
253
  });
254
254
  }
255
- function $e(e, t, r, n) {
255
+ function Be(e, t, r, n) {
256
256
  e.onConnected && !r && (e.onConnected(t), n(!0));
257
257
  }
258
- function _e(e, t, r, n, o, s, i, a) {
258
+ function Re(e, t, r, n, o, s, i, a) {
259
259
  e.onDisconnected && e.onDisconnected(t), r.forEach((c) => c()), n(), o(), s(!1), i(null), a(!1);
260
260
  }
261
- function Se(e, t, r, n, o) {
261
+ function Ne(e, t, r, n, o) {
262
262
  e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
263
263
  }
264
- function B(e, t) {
264
+ function N(e, t) {
265
265
  if (t && e instanceof HTMLElement) {
266
266
  for (const r in t)
267
267
  t[r] === e && delete t[r];
268
268
  for (const r of Array.from(e.childNodes))
269
- B(r, t);
269
+ N(r, t);
270
270
  }
271
271
  }
272
- function R(e, t) {
272
+ function P(e, t) {
273
273
  return typeof t == "string" ? t.split(".").reduce((r, n) => r?.[n], e) : t;
274
274
  }
275
- function ae(e, t, r) {
275
+ function pe(e, t, r) {
276
276
  const n = t.split("."), o = n.pop();
277
277
  if (!o) return;
278
278
  const s = n.reduce((i, a) => (a in i || (i[a] = {}), i[a]), e);
279
279
  s[o] = r;
280
280
  }
281
- function Ce(e, t, r, n, o, s, i) {
281
+ function Pe(e, t, r, n, o, s, i) {
282
282
  if (!s) return;
283
283
  const a = t.includes("lazy"), c = t.includes("trim"), f = t.includes("number"), y = () => {
284
284
  const g = s._state || s;
285
- return R(g, e);
286
- }, h = y();
285
+ return P(g, e);
286
+ }, p = y();
287
287
  let l = "text";
288
- const v = n?.type;
289
- if (i instanceof HTMLInputElement ? l = v || i.type || "text" : i instanceof HTMLSelectElement ? l = "select" : i instanceof HTMLTextAreaElement && (l = "textarea"), l === "checkbox")
290
- if (Array.isArray(h)) {
291
- const g = i?.getAttribute("value") || n?.value || "", u = h.includes(g);
288
+ const x = n?.type;
289
+ if (i instanceof HTMLInputElement ? l = x || i.type || "text" : i instanceof HTMLSelectElement ? l = "select" : i instanceof HTMLTextAreaElement && (l = "textarea"), l === "checkbox")
290
+ if (Array.isArray(p)) {
291
+ const g = i?.getAttribute("value") || n?.value || "", u = p.includes(g);
292
292
  i && i.checked !== u && (r.checked = u);
293
293
  } else {
294
- const g = i?.getAttribute("true-value") || !0, u = h === g;
294
+ const g = i?.getAttribute("true-value") || !0, u = p === g;
295
295
  i && i.checked !== u && (r.checked = u);
296
296
  }
297
297
  else if (l === "radio") {
298
- const g = n?.value || "", u = h === g;
298
+ const g = n?.value || "", u = p === g;
299
299
  i && i.checked !== u && (r.checked = u);
300
300
  } else if (l === "select")
301
301
  if (i && i.hasAttribute("multiple")) {
302
- const g = i, u = Array.isArray(h) ? h : [];
302
+ const g = i, u = Array.isArray(p) ? p : [];
303
303
  setTimeout(() => {
304
- Array.from(g.options).forEach((p) => {
305
- const w = u.includes(p.value);
306
- p.selected !== w && (p.selected = w);
304
+ Array.from(g.options).forEach((h) => {
305
+ const b = u.includes(h.value);
306
+ h.selected !== b && (h.selected = b);
307
307
  });
308
308
  }, 0);
309
309
  } else
310
310
  setTimeout(() => {
311
- i instanceof HTMLSelectElement && i.value !== String(h) && (i.value = String(h));
311
+ i instanceof HTMLSelectElement && i.value !== String(p) && (i.value = String(p));
312
312
  }, 0);
313
313
  else {
314
- const g = String(h ?? "");
315
- (!i || i.value !== g) && (r.value = h);
314
+ const g = String(p ?? "");
315
+ (!i || i.value !== g) && (r.value = p);
316
316
  }
317
- const x = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", m = (g) => {
317
+ const w = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", $ = (g) => {
318
318
  if (g.isComposing || o._isComposing || g.isTrusted === !1) return;
319
319
  const u = g.target;
320
320
  if (u._modelUpdating) return;
321
- const p = y();
322
- let w = u.value;
321
+ const h = y();
322
+ let b = u.value;
323
323
  if (l === "checkbox")
324
- if (Array.isArray(p)) {
325
- const k = u.getAttribute("value") || "", _ = [...p];
324
+ if (Array.isArray(h)) {
325
+ const k = u.getAttribute("value") || "", _ = [...h];
326
326
  if (u.checked)
327
327
  _.includes(k) || _.push(k);
328
328
  else {
329
329
  const S = _.indexOf(k);
330
330
  S > -1 && _.splice(S, 1);
331
331
  }
332
- w = _;
332
+ b = _;
333
333
  } else {
334
334
  const k = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
- w = u.checked ? k : _;
335
+ b = u.checked ? k : _;
336
336
  }
337
337
  else if (l === "radio")
338
- w = u.getAttribute("value") || u.value;
338
+ b = u.getAttribute("value") || u.value;
339
339
  else if (l === "select" && u.multiple) {
340
340
  const k = u;
341
- w = Array.from(k.selectedOptions).map(
341
+ b = Array.from(k.selectedOptions).map(
342
342
  (_) => _.value
343
343
  );
344
- } else if (c && (w = w.trim()), f) {
345
- const k = Number(w);
346
- isNaN(k) || (w = k);
344
+ } else if (c && (b = b.trim()), f) {
345
+ const k = Number(b);
346
+ isNaN(k) || (b = k);
347
347
  }
348
- const d = s._state || s, b = R(d, e);
349
- if (Array.isArray(w) && Array.isArray(b) ? JSON.stringify([...w].sort()) !== JSON.stringify([...b].sort()) : w !== b) {
348
+ const d = s._state || s, v = P(d, e);
349
+ if (Array.isArray(b) && Array.isArray(v) ? JSON.stringify([...b].sort()) !== JSON.stringify([...v].sort()) : b !== v) {
350
350
  const k = g.target;
351
- k._modelUpdating = !0, ae(d, e, w), setTimeout(() => {
351
+ k._modelUpdating = !0, pe(d, e, b), setTimeout(() => {
352
352
  k._modelUpdating = !1;
353
353
  }, 0), s._requestRender && s._requestRender();
354
354
  }
355
355
  };
356
- if (o[x] = m, l === "text" || l === "textarea") {
356
+ if (o[w] = $, l === "text" || l === "textarea") {
357
357
  const g = () => {
358
358
  o._isComposing = !0;
359
- }, u = (p) => {
359
+ }, u = (h) => {
360
360
  o._isComposing = !1;
361
- const w = p.target;
361
+ const b = h.target;
362
362
  setTimeout(() => {
363
- if (w) {
364
- let d = w.value;
363
+ if (b) {
364
+ let d = b.value;
365
365
  if (c && (d = d.trim()), f) {
366
366
  const _ = Number(d);
367
367
  isNaN(_) || (d = _);
368
368
  }
369
- const b = s._state || s, $ = R(b, e);
370
- (Array.isArray(d) && Array.isArray($) ? JSON.stringify([...d].sort()) !== JSON.stringify([...$].sort()) : d !== $) && (w && (w._modelUpdating = !0, setTimeout(() => {
371
- w._modelUpdating = !1;
372
- }, 0)), ae(b, e, d), s._requestRender && s._requestRender());
369
+ const v = s._state || s, m = P(v, e);
370
+ (Array.isArray(d) && Array.isArray(m) ? JSON.stringify([...d].sort()) !== JSON.stringify([...m].sort()) : d !== m) && (b && (b._modelUpdating = !0, setTimeout(() => {
371
+ b._modelUpdating = !1;
372
+ }, 0)), pe(v, e, d), s._requestRender && s._requestRender());
373
373
  }
374
374
  }, 0);
375
375
  };
376
376
  o.compositionstart = g, o.compositionend = u;
377
377
  }
378
378
  }
379
- function Ee(e, t, r, n) {
379
+ function Me(e, t, r, n) {
380
380
  if (n) {
381
381
  if (typeof e == "object" && e !== null)
382
382
  for (const [o, s] of Object.entries(e))
@@ -390,14 +390,14 @@ function Ee(e, t, r, n) {
390
390
  return;
391
391
  }
392
392
  } catch {
393
- const o = R(n, e);
393
+ const o = P(n, e);
394
394
  r[e] = o;
395
395
  }
396
396
  }
397
397
  }
398
- function Ae(e, t, r) {
398
+ function Oe(e, t, r) {
399
399
  if (!r) return;
400
- const n = R(r, e), o = t.style || "", s = n ? "" : "none";
400
+ const n = P(r, e), o = t.style || "", s = n ? "" : "none";
401
401
  if (o) {
402
402
  const i = o.split(";").filter(Boolean), a = i.findIndex(
403
403
  (c) => c.trim().startsWith("display:")
@@ -406,19 +406,19 @@ function Ae(e, t, r) {
406
406
  } else
407
407
  t.style = `display: ${s}`;
408
408
  }
409
- function Te(e, t, r) {
409
+ function We(e, t, r) {
410
410
  if (!r) return;
411
- const n = R(r, e);
411
+ const n = P(r, e);
412
412
  let o = [];
413
413
  typeof n == "string" ? o = [n] : Array.isArray(n) ? o = n.filter(Boolean) : typeof n == "object" && (o = Object.entries(n).filter(([, a]) => !!a).flatMap(([a]) => a.split(/\s+/).filter(Boolean)));
414
414
  const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
415
415
  i && (t.class = i);
416
416
  }
417
- function Le(e, t, r) {
417
+ function De(e, t, r) {
418
418
  let n;
419
419
  if (typeof e == "string") {
420
420
  if (!r) return;
421
- n = R(r, e);
421
+ n = P(r, e);
422
422
  } else
423
423
  n = e;
424
424
  let o = "";
@@ -457,21 +457,21 @@ function Le(e, t, r) {
457
457
  "min-height",
458
458
  "max-height"
459
459
  ];
460
- let h = String(c);
461
- typeof c == "number" && y.includes(f) && (h = `${c}px`), i.push(`${f}: ${h}`);
460
+ let p = String(c);
461
+ typeof c == "number" && y.includes(f) && (p = `${c}px`), i.push(`${f}: ${p}`);
462
462
  }
463
463
  o = i.join("; ") + (i.length > 0 ? ";" : "");
464
464
  }
465
465
  const s = t.style || "";
466
466
  t.style = s + (s && !s.endsWith(";") ? "; " : "") + o;
467
467
  }
468
- function ge(e, t, r, n) {
468
+ function we(e, t, r, n) {
469
469
  const o = {}, s = { ...n || {} }, i = {};
470
470
  for (const [a, c] of Object.entries(e)) {
471
471
  const { value: f, modifiers: y } = c;
472
472
  switch (a) {
473
473
  case "model":
474
- Ce(
474
+ Pe(
475
475
  typeof f == "string" ? f : String(f),
476
476
  y,
477
477
  o,
@@ -482,45 +482,45 @@ function ge(e, t, r, n) {
482
482
  );
483
483
  break;
484
484
  case "bind":
485
- Ee(f, o, s, t);
485
+ Me(f, o, s, t);
486
486
  break;
487
487
  case "show":
488
- Ae(f, s, t);
488
+ Oe(f, s, t);
489
489
  break;
490
490
  case "class":
491
- Te(f, s, t);
491
+ We(f, s, t);
492
492
  break;
493
493
  case "style":
494
- Le(f, s, t);
494
+ De(f, s, t);
495
495
  break;
496
496
  }
497
497
  }
498
498
  return { props: o, attrs: s, listeners: i };
499
499
  }
500
- function re(e, t) {
500
+ function le(e, t) {
501
501
  if (Array.isArray(e)) {
502
502
  const s = /* @__PURE__ */ new Set();
503
503
  return e.map((i) => {
504
504
  if (!i || typeof i != "object") return i;
505
505
  let a = i.props?.key ?? i.key;
506
506
  if (!a) {
507
- const h = i.tag || "node", l = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
508
- a = l ? `${t}:${h}:${l}` : `${t}:${h}`;
507
+ const p = i.tag || "node", l = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
508
+ a = l ? `${t}:${p}:${l}` : `${t}:${p}`;
509
509
  }
510
510
  let c = a, f = 1;
511
511
  for (; s.has(c); )
512
512
  c = `${a}#${f++}`;
513
513
  s.add(c);
514
514
  let y = i.children;
515
- return Array.isArray(y) && (y = re(y, c)), { ...i, key: c, children: y };
515
+ return Array.isArray(y) && (y = le(y, c)), { ...i, key: c, children: y };
516
516
  });
517
517
  }
518
518
  const r = e;
519
519
  let n = r.props?.key ?? r.key ?? t, o = r.children;
520
- return Array.isArray(o) && (o = re(o, n)), { ...r, key: n, children: o };
520
+ return Array.isArray(o) && (o = le(o, n)), { ...r, key: n, children: o };
521
521
  }
522
- function je(e, t, r, n) {
523
- const o = r.directives ?? {}, s = ge(
522
+ function He(e, t, r, n) {
523
+ const o = r.directives ?? {}, s = we(
524
524
  o,
525
525
  n,
526
526
  e,
@@ -535,192 +535,192 @@ function je(e, t, r, n) {
535
535
  ...s.attrs
536
536
  }, c = t.props ?? {}, f = i;
537
537
  for (const l in { ...c, ...f }) {
538
- const v = c[l], x = f[l];
539
- v !== x && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== x && (e.value = x ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!x : l.startsWith("on") && typeof x == "function" ? (typeof v == "function" && e.removeEventListener(l.slice(2).toLowerCase(), v), e.addEventListener(l.slice(2).toLowerCase(), x)) : x == null || x === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(x)));
538
+ const x = c[l], w = f[l];
539
+ x !== w && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== w && (e.value = w ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!w : l.startsWith("on") && typeof w == "function" ? (typeof x == "function" && e.removeEventListener(l.slice(2).toLowerCase(), x), e.addEventListener(l.slice(2).toLowerCase(), w)) : w == null || w === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(w)));
540
540
  }
541
- for (const [l, v] of Object.entries(
541
+ for (const [l, x] of Object.entries(
542
542
  s.listeners || {}
543
543
  ))
544
- e.addEventListener(l, v);
545
- const y = t.attrs ?? {}, h = a;
546
- for (const l in { ...y, ...h }) {
547
- const v = y[l], x = h[l];
548
- v !== x && (x == null || x === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(x)));
544
+ e.addEventListener(l, x);
545
+ const y = t.attrs ?? {}, p = a;
546
+ for (const l in { ...y, ...p }) {
547
+ const x = y[l], w = p[l];
548
+ x !== w && (w == null || w === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(w)));
549
549
  }
550
550
  }
551
551
  function j(e, t, r) {
552
552
  if (typeof e == "string")
553
553
  return document.createTextNode(e);
554
554
  if (e.tag === "#text") {
555
- const h = document.createTextNode(
555
+ const p = document.createTextNode(
556
556
  typeof e.children == "string" ? e.children : ""
557
557
  );
558
- return e.key != null && (h.key = e.key), h;
558
+ return e.key != null && (p.key = e.key), p;
559
559
  }
560
560
  if (e.tag === "#anchor") {
561
- const h = e, l = Array.isArray(h.children) ? h.children : [], v = document.createTextNode(""), x = document.createTextNode("");
562
- h.key != null && (v.key = `${h.key}:start`, x.key = `${h.key}:end`), h._startNode = v, h._endNode = x;
563
- const m = document.createDocumentFragment();
564
- m.appendChild(v);
561
+ const p = e, l = Array.isArray(p.children) ? p.children : [], x = document.createTextNode(""), w = document.createTextNode("");
562
+ p.key != null && (x.key = `${p.key}:start`, w.key = `${p.key}:end`), p._startNode = x, p._endNode = w;
563
+ const $ = document.createDocumentFragment();
564
+ $.appendChild(x);
565
565
  for (const g of l) {
566
566
  const u = j(g, t);
567
- m.appendChild(u);
567
+ $.appendChild(u);
568
568
  }
569
- return m.appendChild(x), m;
569
+ return $.appendChild(w), $;
570
570
  }
571
571
  const n = document.createElement(e.tag);
572
572
  e.key != null && (n.key = e.key);
573
- const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = ge(i, t, n, s), c = {
573
+ const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = we(i, t, n, s), c = {
574
574
  ...o,
575
575
  ...a.props
576
576
  }, f = {
577
577
  ...s,
578
578
  ...a.attrs
579
579
  };
580
- for (const h in f) {
581
- const l = f[h];
582
- if (typeof h != "string" || /\[object Object\]/.test(h)) {
583
- typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", h, l);
580
+ for (const p in f) {
581
+ const l = f[p];
582
+ if (typeof p != "string" || /\[object Object\]/.test(p)) {
583
+ typeof window < "u" && window.console && console.warn("Skipping invalid attribute key:", p, l);
584
584
  continue;
585
585
  }
586
- typeof l == "boolean" ? l && n.setAttribute(h, "") : l != null && n.setAttribute(h, l);
586
+ typeof l == "boolean" ? l && n.setAttribute(p, "") : l != null && n.setAttribute(p, l);
587
587
  }
588
- for (const h in c) {
589
- const l = c[h];
590
- if (typeof h != "string" || /\[object Object\]/.test(h)) {
591
- typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", h, l);
588
+ for (const p in c) {
589
+ const l = c[p];
590
+ if (typeof p != "string" || /\[object Object\]/.test(p)) {
591
+ typeof window < "u" && window.console && console.warn("Skipping invalid prop key:", p, l);
592
592
  continue;
593
593
  }
594
- if (h === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
594
+ if (p === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
595
595
  n.value = l ?? "";
596
- else if (h === "checked" && n instanceof HTMLInputElement)
596
+ else if (p === "checked" && n instanceof HTMLInputElement)
597
597
  n.checked = !!l;
598
- else if (h.startsWith("on") && typeof l == "function")
599
- n.addEventListener(h.slice(2).toLowerCase(), l);
598
+ else if (p.startsWith("on") && typeof l == "function")
599
+ n.addEventListener(p.slice(2).toLowerCase(), l);
600
600
  else {
601
- if (h.startsWith("on") && l === void 0)
601
+ if (p.startsWith("on") && l === void 0)
602
602
  continue;
603
- l == null || l === !1 ? n.removeAttribute(h) : n.setAttribute(h, String(l));
603
+ l == null || l === !1 ? n.removeAttribute(p) : n.setAttribute(p, String(l));
604
604
  }
605
605
  }
606
- for (const [h, l] of Object.entries(
606
+ for (const [p, l] of Object.entries(
607
607
  a.listeners || {}
608
608
  ))
609
- n.addEventListener(h, l);
609
+ n.addEventListener(p, l);
610
610
  const y = e.props?.ref ?? (e.props?.props && e.props.props.ref);
611
611
  if (typeof e != "string" && y && r && (r[y] = n), Array.isArray(e.children))
612
- for (const h of e.children)
613
- n.appendChild(j(h, t, r));
612
+ for (const p of e.children)
613
+ n.appendChild(j(p, t, r));
614
614
  else typeof e.children == "string" && (n.textContent = e.children);
615
615
  return n;
616
616
  }
617
- function ze(e, t, r, n, o) {
617
+ function qe(e, t, r, n, o) {
618
618
  if (typeof r == "string") {
619
619
  e.textContent !== r && (e.textContent = r);
620
620
  return;
621
621
  }
622
622
  if (!Array.isArray(r)) return;
623
623
  const s = Array.from(e.childNodes), i = Array.isArray(t) ? t : [], a = /* @__PURE__ */ new Map();
624
- for (const v of i)
625
- v && v.key != null && a.set(v.key, v);
624
+ for (const x of i)
625
+ x && x.key != null && a.set(x.key, x);
626
626
  const c = /* @__PURE__ */ new Map();
627
- for (const v of s) {
628
- const x = v.key;
629
- x != null && c.set(x, v);
627
+ for (const x of s) {
628
+ const w = x.key;
629
+ w != null && c.set(w, x);
630
630
  }
631
631
  const f = /* @__PURE__ */ new Set();
632
632
  let y = e.firstChild;
633
- function h(v, x) {
634
- let m = v;
635
- for (; m && (f.add(m), m !== x); )
636
- m = m.nextSibling;
633
+ function p(x, w) {
634
+ let $ = x;
635
+ for (; $ && (f.add($), $ !== w); )
636
+ $ = $.nextSibling;
637
637
  }
638
- function l(v, x, m, g) {
638
+ function l(x, w, $, g) {
639
639
  const u = [];
640
- let p = v.nextSibling;
641
- for (; p && p !== x; )
642
- u.push(p), p = p.nextSibling;
643
- const w = Array.isArray(m) ? m : [];
644
- if (g.some((b) => b && b.key != null) || w.some((b) => b && b.key != null)) {
645
- const b = /* @__PURE__ */ new Map(), $ = /* @__PURE__ */ new Map();
646
- for (const S of w)
647
- S && S.key != null && b.set(S.key, S);
640
+ let h = x.nextSibling;
641
+ for (; h && h !== w; )
642
+ u.push(h), h = h.nextSibling;
643
+ const b = Array.isArray($) ? $ : [];
644
+ if (g.some((v) => v && v.key != null) || b.some((v) => v && v.key != null)) {
645
+ const v = /* @__PURE__ */ new Map(), m = /* @__PURE__ */ new Map();
646
+ for (const S of b)
647
+ S && S.key != null && v.set(S.key, S);
648
648
  for (const S of u) {
649
- const C = S.key;
650
- C != null && $.set(C, S);
649
+ const E = S.key;
650
+ E != null && m.set(E, S);
651
651
  }
652
652
  const k = /* @__PURE__ */ new Set();
653
- let _ = v.nextSibling;
653
+ let _ = x.nextSibling;
654
654
  for (const S of g) {
655
- let C;
656
- if (S.key != null && $.has(S.key)) {
657
- const A = b.get(S.key);
658
- C = I(
659
- $.get(S.key),
655
+ let E;
656
+ if (S.key != null && m.has(S.key)) {
657
+ const A = v.get(S.key);
658
+ E = V(
659
+ m.get(S.key),
660
660
  A,
661
661
  S,
662
662
  n
663
- ), k.add(C), C !== _ && e.contains(C) && e.insertBefore(C, _);
663
+ ), k.add(E), E !== _ && e.contains(E) && e.insertBefore(E, _);
664
664
  } else
665
- C = j(S, n), e.insertBefore(C, _), k.add(C);
666
- _ = C.nextSibling;
665
+ E = j(S, n), e.insertBefore(E, _), k.add(E);
666
+ _ = E.nextSibling;
667
667
  }
668
668
  for (const S of u)
669
669
  !k.has(S) && e.contains(S) && e.removeChild(S);
670
670
  } else {
671
- const b = Math.min(
672
- w.length,
671
+ const v = Math.min(
672
+ b.length,
673
673
  g.length
674
674
  );
675
- for (let $ = 0; $ < b; $++) {
676
- const k = w[$], _ = g[$], S = I(u[$], k, _, n);
677
- S !== u[$] && (e.insertBefore(S, u[$]), e.removeChild(u[$]));
675
+ for (let m = 0; m < v; m++) {
676
+ const k = b[m], _ = g[m], S = V(u[m], k, _, n);
677
+ S !== u[m] && (e.insertBefore(S, u[m]), e.removeChild(u[m]));
678
678
  }
679
- for (let $ = b; $ < g.length; $++)
680
- e.insertBefore(j(g[$], n), x);
681
- for (let $ = b; $ < u.length; $++)
682
- e.removeChild(u[$]);
679
+ for (let m = v; m < g.length; m++)
680
+ e.insertBefore(j(g[m], n), w);
681
+ for (let m = v; m < u.length; m++)
682
+ e.removeChild(u[m]);
683
683
  }
684
684
  }
685
- for (const v of r) {
686
- let x;
687
- if (v.tag === "#anchor") {
688
- const m = v.key, g = `${m}:start`, u = `${m}:end`;
689
- let p = c.get(g), w = c.get(u);
690
- const d = Array.isArray(v.children) ? v.children : [];
691
- if (p || (p = document.createTextNode(""), p.key = g), w || (w = document.createTextNode(""), w.key = u), v._startNode = p, v._endNode = w, !e.contains(p) || !e.contains(w)) {
692
- e.insertBefore(p, y);
693
- for (const b of d)
694
- e.insertBefore(j(b, n), y);
695
- e.insertBefore(w, y);
685
+ for (const x of r) {
686
+ let w;
687
+ if (x.tag === "#anchor") {
688
+ const $ = x.key, g = `${$}:start`, u = `${$}:end`;
689
+ let h = c.get(g), b = c.get(u);
690
+ const d = Array.isArray(x.children) ? x.children : [];
691
+ if (h || (h = document.createTextNode(""), h.key = g), b || (b = document.createTextNode(""), b.key = u), x._startNode = h, x._endNode = b, !e.contains(h) || !e.contains(b)) {
692
+ e.insertBefore(h, y);
693
+ for (const v of d)
694
+ e.insertBefore(j(v, n), y);
695
+ e.insertBefore(b, y);
696
696
  } else
697
697
  l(
698
- p,
699
- w,
700
- a.get(m)?.children,
698
+ h,
699
+ b,
700
+ a.get($)?.children,
701
701
  d
702
702
  );
703
- h(p, w), y = w.nextSibling;
703
+ p(h, b), y = b.nextSibling;
704
704
  continue;
705
705
  }
706
- if (v.key != null && c.has(v.key)) {
707
- const m = a.get(v.key);
708
- x = I(
709
- c.get(v.key),
710
- m,
711
- v,
706
+ if (x.key != null && c.has(x.key)) {
707
+ const $ = a.get(x.key);
708
+ w = V(
709
+ c.get(x.key),
710
+ $,
711
+ x,
712
712
  n,
713
713
  o
714
- ), f.add(x), x !== y && e.contains(x) && (y && !e.contains(y) && (y = null), e.insertBefore(x, y));
714
+ ), f.add(w), w !== y && e.contains(w) && (y && !e.contains(y) && (y = null), e.insertBefore(w, y));
715
715
  } else
716
- x = j(v, n, o), y && !e.contains(y) && (y = null), e.insertBefore(x, y), f.add(x);
717
- y = x.nextSibling;
716
+ w = j(x, n, o), y && !e.contains(y) && (y = null), e.insertBefore(w, y), f.add(w);
717
+ y = w.nextSibling;
718
718
  }
719
- for (const v of s)
720
- !f.has(v) && e.contains(v) && (B(v, o), e.removeChild(v));
719
+ for (const x of s)
720
+ !f.has(x) && e.contains(x) && (N(x, o), e.removeChild(x));
721
721
  }
722
- function I(e, t, r, n, o) {
723
- if (t && typeof t != "string" && t.props?.ref && o && B(e, o), t === r) return e;
722
+ function V(e, t, r, n, o) {
723
+ if (t && typeof t != "string" && t.props?.ref && o && N(e, o), t === r) return e;
724
724
  if (typeof r == "string") {
725
725
  if (e.nodeType === Node.TEXT_NODE)
726
726
  return e.textContent !== r && (e.textContent = r), e;
@@ -734,19 +734,19 @@ function I(e, t, r, n, o) {
734
734
  i.key != null && (c.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = c, i._endNode = f;
735
735
  const y = document.createDocumentFragment();
736
736
  y.appendChild(c);
737
- for (const h of a) {
738
- const l = j(h, n);
737
+ for (const p of a) {
738
+ const l = j(p, n);
739
739
  y.appendChild(l);
740
740
  }
741
741
  return y.appendChild(f), e.parentNode?.replaceChild(y, e), c;
742
742
  }
743
743
  if (!r) {
744
- B(e, o);
744
+ N(e, o);
745
745
  const i = document.createComment("removed");
746
746
  return e.parentNode?.replaceChild(i, e), i;
747
747
  }
748
748
  if (!t || typeof t == "string") {
749
- B(e, o);
749
+ N(e, o);
750
750
  const i = j(r, n, o);
751
751
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
752
752
  }
@@ -761,47 +761,47 @@ function I(e, t, r, n, o) {
761
761
  }
762
762
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
763
763
  const i = e;
764
- return je(i, t.props || {}, r.props || {}, n), ze(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
764
+ return He(i, t.props || {}, r.props || {}, n), qe(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
765
765
  }
766
- B(e, o);
766
+ N(e, o);
767
767
  const s = j(r, n, o);
768
768
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
769
769
  }
770
- function Be(e, t, r, n) {
770
+ function Ie(e, t, r, n) {
771
771
  let o;
772
772
  Array.isArray(t) ? t.length === 1 ? (o = t[0], o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })) : o = { tag: "div", key: "__root__", children: t } : (o = t, o && typeof o == "object" && o.key == null && (o = { ...o, key: "__root__" })), o && typeof o == "object" && o.tag === "#anchor" && (o = {
773
773
  tag: "div",
774
774
  key: "__anchor_root__",
775
775
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
776
776
  children: [o]
777
- }), o = re(o, String(o.key ?? "root"));
777
+ }), o = le(o, String(o.key ?? "root"));
778
778
  const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
779
779
  let a;
780
- s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = I(i, s, o, r, n) : (a = j(o, r, n), e.replaceChild(a, i)) : (a = j(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
780
+ s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = V(i, s, o, r, n) : (a = j(o, r, n), e.replaceChild(a, i)) : (a = j(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
781
781
  const c = [];
782
782
  for (let f = 0; f < e.childNodes.length; f++) {
783
783
  const y = e.childNodes[f];
784
- y !== a && y.nodeName !== "STYLE" && (B(y, n), c.push(y));
784
+ y !== a && y.nodeName !== "STYLE" && (N(y, n), c.push(y));
785
785
  }
786
786
  c.forEach((f) => e.removeChild(f)), e._prevVNode = o, e._prevDom = a;
787
787
  }
788
- function ye(e, ...t) {
788
+ function ke(e, ...t) {
789
789
  let r = "";
790
790
  for (let n = 0; n < e.length; n++)
791
791
  r += e[n], n < t.length && (r += t[n]);
792
792
  return r;
793
793
  }
794
- function me(e) {
794
+ function $e(e) {
795
795
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
796
796
  }
797
- let H = null;
798
- function le() {
799
- return H || (H = new CSSStyleSheet(), H.replaceSync(me(Ne))), H;
797
+ let U = null;
798
+ function he() {
799
+ return U || (U = new CSSStyleSheet(), U.replaceSync($e(Ue))), U;
800
800
  }
801
- function Re(e) {
801
+ function Fe(e) {
802
802
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
803
803
  }
804
- const Ne = ye`
804
+ const Ue = ke`
805
805
  :host, *, ::before, ::after {
806
806
  all: isolate;
807
807
  box-sizing: border-box;
@@ -859,7 +859,7 @@ const Ne = ye`
859
859
  sup { top: -.5em }
860
860
  [disabled], [aria-disabled=true] { cursor: not-allowed }
861
861
  [hidden] { display: none }
862
- `, Me = {
862
+ `, Ke = {
863
863
  gray: {
864
864
  50: "var(--color-gray-50, #f9fafb)",
865
865
  100: "var(--color-gray-100, #f3f4f6)",
@@ -994,7 +994,7 @@ const Ne = ye`
994
994
  },
995
995
  white: { DEFAULT: "var(--color-white, #ffffff)" },
996
996
  black: { DEFAULT: "var(--color-black, #000000)" }
997
- }, V = {
997
+ }, Y = {
998
998
  /* Display */
999
999
  block: "display:block;",
1000
1000
  inline: "display:inline;",
@@ -1175,7 +1175,7 @@ const Ne = ye`
1175
1175
  "z-30": "z-index:30;",
1176
1176
  "z-40": "z-index:40;",
1177
1177
  "z-50": "z-index:50;"
1178
- }, Oe = "0.25rem", ce = {
1178
+ }, Ve = "0.25rem", ge = {
1179
1179
  m: ["margin"],
1180
1180
  mx: ["margin-inline"],
1181
1181
  my: ["margin-block"],
@@ -1208,18 +1208,19 @@ const Ne = ye`
1208
1208
  "gap-y": ["row-gap"]
1209
1209
  };
1210
1210
  function L(e, t) {
1211
- let r = 0;
1212
- for (let n = 0; n < e.length; n++) {
1213
- const o = e[n];
1214
- if (o === "[") r++;
1215
- else if (o === "]") r--;
1216
- else if (r === 0 && (o === ">" || o === "+" || o === "~" || o === " "))
1217
- return e.slice(0, n) + t + e.slice(n);
1211
+ let r = 0, n = 0;
1212
+ for (let o = 0; o < e.length; o++) {
1213
+ const s = e[o];
1214
+ if (s === "[") r++;
1215
+ else if (s === "]" && r > 0) r--;
1216
+ else if (s === "(") n++;
1217
+ else if (s === ")" && n > 0) n--;
1218
+ else if (r === 0 && n === 0 && (s === ">" || s === "+" || s === "~" || s === " "))
1219
+ return e.slice(0, o) + t + e.slice(o);
1218
1220
  }
1219
1221
  return e + t;
1220
1222
  }
1221
- const Pe = {
1222
- // State variants
1223
+ const G = {
1223
1224
  before: (e, t) => `${e}::before{${t}}`,
1224
1225
  after: (e, t) => `${e}::after{${t}}`,
1225
1226
  hover: (e, t) => `${L(e, ":hover")}{${t}}`,
@@ -1234,17 +1235,15 @@ const Pe = {
1234
1235
  even: (e, t) => `${L(e, ":nth-child(even)")}{${t}}`,
1235
1236
  "focus-within": (e, t) => `${L(e, ":focus-within")}{${t}}`,
1236
1237
  "focus-visible": (e, t) => `${L(e, ":focus-visible")}{${t}}`,
1237
- // Group variants
1238
1238
  "group-hover": (e, t) => `.group:hover ${e}{${t}}`,
1239
1239
  "group-focus": (e, t) => `.group:focus ${e}{${t}}`,
1240
1240
  "group-active": (e, t) => `.group:active ${e}{${t}}`,
1241
1241
  "group-disabled": (e, t) => `.group:disabled ${e}{${t}}`,
1242
- // Peer variants
1243
1242
  "peer-hover": (e, t) => `.peer:hover ~ ${e}{${t}}`,
1244
1243
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1245
1244
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1246
1245
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1247
- }, J = {
1246
+ }, ee = {
1248
1247
  // Responsive
1249
1248
  sm: "(min-width:640px)",
1250
1249
  md: "(min-width:768px)",
@@ -1253,23 +1252,23 @@ const Pe = {
1253
1252
  "2xl": "(min-width:1536px)",
1254
1253
  // Dark mode (now plain string)
1255
1254
  dark: "(prefers-color-scheme: dark)"
1256
- }, Q = ["sm", "md", "lg", "xl", "2xl"];
1257
- function Z(e) {
1255
+ }, te = ["sm", "md", "lg", "xl", "2xl"];
1256
+ function re(e) {
1258
1257
  const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
1259
1258
  if (n.length < 2) return null;
1260
1259
  const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
1261
- if (Number.isNaN(i) || !ce[o]) return null;
1260
+ if (Number.isNaN(i) || !ge[o]) return null;
1262
1261
  const a = t ? "-" : "";
1263
- return ce[o].map((c) => `${c}:calc(${a}${Oe} * ${i});`).join("");
1262
+ return ge[o].map((c) => `${c}:calc(${a}${Ve} * ${i});`).join("");
1264
1263
  }
1265
- function fe(e) {
1264
+ function ye(e) {
1266
1265
  const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
1267
1266
  return `${n} ${o} ${s}`;
1268
1267
  }
1269
- function We(e) {
1268
+ function Je(e) {
1270
1269
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1271
1270
  if (!t) return null;
1272
- const [, r, n, o = "DEFAULT"] = t, s = Me[n]?.[o];
1271
+ const [, r, n, o = "DEFAULT"] = t, s = Ke[n]?.[o];
1273
1272
  return s ? `${{
1274
1273
  bg: "background-color",
1275
1274
  decoration: "text-decoration-color",
@@ -1284,41 +1283,41 @@ function We(e) {
1284
1283
  stroke: "stroke-color"
1285
1284
  }[r]}:${s};` : null;
1286
1285
  }
1287
- function De(e) {
1286
+ function Ze(e) {
1288
1287
  const [t, r] = e.split("/");
1289
1288
  if (!r) return { base: t };
1290
1289
  const n = parseInt(r, 10);
1291
1290
  return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
1292
1291
  }
1293
- function X(e) {
1294
- const { base: t, opacity: r } = De(e), n = We(t);
1292
+ function ne(e) {
1293
+ const { base: t, opacity: r } = Ze(e), n = Je(t);
1295
1294
  if (n) {
1296
1295
  if (r !== void 0) {
1297
1296
  const s = /#([0-9a-f]{6})/i.exec(n);
1298
1297
  if (s) {
1299
- const i = fe(s[0]);
1298
+ const i = ye(s[0]);
1300
1299
  return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1301
1300
  }
1302
1301
  }
1303
1302
  return n;
1304
1303
  }
1305
- const o = F(t);
1304
+ const o = J(t);
1306
1305
  if (o && r !== void 0) {
1307
1306
  const s = /#([0-9a-f]{6})/i.exec(o);
1308
1307
  if (s) {
1309
- const i = fe(s[0]);
1308
+ const i = ye(s[0]);
1310
1309
  return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1311
1310
  }
1312
1311
  }
1313
1312
  return o;
1314
1313
  }
1315
- function Y(e) {
1314
+ function oe(e) {
1316
1315
  const t = /^opacity-(\d{1,3})$/.exec(e);
1317
1316
  if (!t) return null;
1318
1317
  const r = parseInt(t[1], 10);
1319
1318
  return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1320
1319
  }
1321
- function F(e) {
1320
+ function J(e) {
1322
1321
  const t = e.indexOf("-["), r = e.endsWith("]");
1323
1322
  if (t > 0 && r) {
1324
1323
  const n = e.slice(0, t);
@@ -1368,7 +1367,7 @@ function F(e) {
1368
1367
  }
1369
1368
  return null;
1370
1369
  }
1371
- function ue(e) {
1370
+ function me(e) {
1372
1371
  if (e.startsWith("[") && e.endsWith("]")) {
1373
1372
  const r = e.slice(1, -1);
1374
1373
  return r.includes("&") ? r : e;
@@ -1380,10 +1379,10 @@ function ue(e) {
1380
1379
  }
1381
1380
  return null;
1382
1381
  }
1383
- function He(e) {
1382
+ function Qe(e) {
1384
1383
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1385
1384
  }
1386
- function qe(e) {
1385
+ function Xe(e) {
1387
1386
  const t = /class\s*=\s*["']([^"']+)["']/g, r = [];
1388
1387
  let n;
1389
1388
  for (; n = t.exec(e); ) {
@@ -1392,111 +1391,158 @@ function qe(e) {
1392
1391
  }
1393
1392
  return r.filter(Boolean);
1394
1393
  }
1395
- const de = /* @__PURE__ */ new Map(), Ie = 16;
1396
- function Fe(e) {
1397
- const t = Date.now(), r = de.get(e);
1398
- if (r && t - r.timestamp < Ie) return r.css;
1399
- const n = qe(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1400
- function y(m, g = !1) {
1401
- const u = (g ? "dark|" : "") + m;
1402
- if (u in f) return f[u];
1403
- const p = v(m, g);
1404
- return f[u] = p, p;
1405
- }
1406
- function h(m) {
1407
- const g = m.some((p) => Q.includes(p)), u = m.includes("dark");
1408
- return m.length === 0 ? 1 : !g && !u ? 2 : g && !u ? 3 : 4;
1409
- }
1410
- function l(m) {
1411
- const g = [];
1412
- let u = "", p = 0;
1413
- for (let w = 0; w < m.length; w++) {
1414
- const d = m[w];
1415
- d === "[" && p++, d === "]" && p > 0 && p--, d === ":" && p === 0 ? (g.push(u), u = "") : u += d;
1394
+ const be = /* @__PURE__ */ new Map(), Ye = 16;
1395
+ function Ge(e) {
1396
+ const t = Date.now(), r = be.get(e);
1397
+ if (r && t - r.timestamp < Ye) return r.css;
1398
+ const n = Xe(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1399
+ function y(g, u = !1) {
1400
+ const h = (u ? "dark|" : "") + g;
1401
+ if (h in f) return f[h];
1402
+ const b = w(g, u);
1403
+ return f[h] = b, b;
1404
+ }
1405
+ function p(g) {
1406
+ const u = g.some((b) => te.includes(b)), h = g.includes("dark");
1407
+ return g.length === 0 ? 1 : !u && !h ? 2 : u && !h ? 3 : 4;
1408
+ }
1409
+ function l(g) {
1410
+ const u = [];
1411
+ let h = "", b = 0, d = 0;
1412
+ for (let v = 0; v < g.length; v++) {
1413
+ const m = g[v];
1414
+ m === "[" ? b++ : m === "]" && b > 0 ? b-- : m === "(" ? d++ : m === ")" && d > 0 && d--, m === ":" && b === 0 && d === 0 ? (u.push(h), h = "") : h += m;
1415
+ }
1416
+ return h && u.push(h), u;
1417
+ }
1418
+ function x(g) {
1419
+ switch (g) {
1420
+ case "hover":
1421
+ return ":hover";
1422
+ case "focus":
1423
+ return ":focus";
1424
+ case "active":
1425
+ return ":active";
1426
+ case "visited":
1427
+ return ":visited";
1428
+ case "disabled":
1429
+ return ":disabled";
1430
+ case "checked":
1431
+ return ":checked";
1432
+ case "first":
1433
+ return ":first-child";
1434
+ case "last":
1435
+ return ":last-child";
1436
+ case "odd":
1437
+ return ":nth-child(odd)";
1438
+ case "even":
1439
+ return ":nth-child(even)";
1440
+ case "focus-within":
1441
+ return ":focus-within";
1442
+ case "focus-visible":
1443
+ return ":focus-visible";
1444
+ default:
1445
+ return null;
1416
1446
  }
1417
- return u && g.push(u), g;
1418
1447
  }
1419
- function v(m, g = !1) {
1420
- const u = l(m), p = u.find(
1421
- (E) => V[E] || Z(E) || Y(E) || X(E) || F(E)
1422
- );
1423
- if (!p) return null;
1424
- const w = V[p] ?? Z(p) ?? Y(p) ?? X(p) ?? F(p);
1425
- if (!w) return null;
1426
- const d = u.indexOf(p);
1427
- let b = d >= 0 ? u.slice(0, d) : [];
1428
- g && (b = b.filter((E) => E !== "dark"));
1429
- const $ = b.find((E) => ue(E)), k = `.${He(m)}`;
1430
- let _;
1431
- const S = w;
1432
- if ($) {
1433
- const E = ue($);
1434
- E ? E.includes("&") ? _ = E.replace(/&/g, k) : _ = `${E}${k}` : _ = k;
1448
+ function w(g, u = !1) {
1449
+ const h = l(g);
1450
+ let b = !1, d = h.find((C) => (C.startsWith("!") && (b = !0, C = C.slice(1)), Y[C] || re(C) || oe(C) || ne(C) || J(C)));
1451
+ if (!d) return null;
1452
+ const v = d.replace(/^!/, ""), m = Y[v] ?? re(v) ?? oe(v) ?? ne(v) ?? J(v);
1453
+ if (!m) return null;
1454
+ const k = h.indexOf(d);
1455
+ let _ = k >= 0 ? h.slice(0, k) : [];
1456
+ u && (_ = _.filter((C) => C !== "dark"));
1457
+ const S = _.find((C) => me(C)), E = `.${Qe(g)}`, A = "__TW_SUBJECT__";
1458
+ let T, F = b ? m.replace(/;$/, " !important;") : m;
1459
+ if (S) {
1460
+ const C = me(S);
1461
+ C ? C.includes("&") ? T = C.replace(/&/g, A) : T = `${C}${A}` : T = A;
1435
1462
  } else
1436
- _ = k;
1437
- for (const E of b) {
1438
- if (Q.includes(E) || E === "dark" || E === $) continue;
1439
- const ie = Pe[E];
1440
- typeof ie == "function" && (_ = ie(_, S).replace(/\{.*$/, ""));
1463
+ T = A;
1464
+ const _e = _.filter((C) => C.startsWith("peer-")), Se = _.filter((C) => C.startsWith("group-")), Ce = _.filter(
1465
+ (C) => !C.startsWith("group-") && !C.startsWith("peer-") && !te.includes(C) && C !== "dark" && C !== S
1466
+ );
1467
+ for (const C of _e) {
1468
+ const R = G[C];
1469
+ typeof R == "function" && (T = R(T, F).replace(/\{.*$/, ""));
1441
1470
  }
1442
- let C = `${_}{${S}}`;
1443
- const A = b.filter((E) => Q.includes(E)), T = A.length ? A[A.length - 1] : null, oe = b.includes("dark");
1444
- return g && T ? C = `@media (prefers-color-scheme: dark) and ${J[T]}{${C}}` : g ? C = `@media (prefers-color-scheme: dark){${C}}` : oe && T ? C = `@media (prefers-color-scheme: dark) and ${J[T]}{${C}}` : oe ? C = `@media (prefers-color-scheme: dark){${C}}` : T && (C = `@media ${J[T]}{${C}}`), C;
1445
- }
1446
- for (const m of o) {
1447
- const g = m.split(":"), u = g.find(
1448
- (b) => V[b] || Z(b) || Y(b) || X(b) || F(b)
1471
+ for (const C of Se) {
1472
+ const R = G[C];
1473
+ typeof R == "function" && (T = R(T, F).replace(/\{.*$/, ""));
1474
+ }
1475
+ for (const C of Ce) {
1476
+ const R = x(C);
1477
+ if (R)
1478
+ T = T.replace(A, A + R);
1479
+ else {
1480
+ const ue = G[C];
1481
+ if (typeof ue == "function") {
1482
+ const Ee = ue(A, F).replace(/\{.*$/, "");
1483
+ T = T.replace(A, Ee);
1484
+ }
1485
+ }
1486
+ }
1487
+ T = T.replace(new RegExp(A, "g"), E);
1488
+ let z = `${T}{${F}}`;
1489
+ const X = _.filter((C) => te.includes(C)), M = X.length ? X[X.length - 1] : null, fe = _.includes("dark");
1490
+ return u && M ? z = `@media (prefers-color-scheme: dark) and ${ee[M]}{${z}}` : u ? z = `@media (prefers-color-scheme: dark){${z}}` : fe && M ? z = `@media (prefers-color-scheme: dark) and ${ee[M]}{${z}}` : fe ? z = `@media (prefers-color-scheme: dark){${z}}` : M && (z = `@media ${ee[M]}{${z}}`), z;
1491
+ }
1492
+ for (const g of o) {
1493
+ const u = l(g), h = u.find(
1494
+ (m) => Y[m] || re(m) || oe(m) || ne(m) || J(m)
1449
1495
  );
1450
- if (!u) continue;
1451
- const p = g.indexOf(u), w = p >= 0 ? g.slice(0, p) : [], d = h(w);
1452
- if (d === 4) {
1453
- const b = y(m, !0);
1454
- b && c.push(b);
1496
+ if (!h) continue;
1497
+ const b = u.indexOf(h), d = b >= 0 ? u.slice(0, b) : [], v = p(d);
1498
+ if (v === 4) {
1499
+ const m = y(g, !0);
1500
+ m && c.push(m);
1455
1501
  } else {
1456
- const b = y(m);
1457
- b && (d === 1 ? s.push(b) : d === 2 ? i.push(b) : d === 3 && a.push(b));
1502
+ const m = y(g);
1503
+ m && (v === 1 ? s.push(m) : v === 2 ? i.push(m) : v === 3 && a.push(m));
1458
1504
  }
1459
1505
  }
1460
- const x = [...s, ...i, ...a, ...c].join("");
1461
- return de.set(e, { css: x, timestamp: t }), x;
1506
+ const $ = [...s, ...i, ...a, ...c].join("");
1507
+ return be.set(e, { css: $, timestamp: t }), $;
1462
1508
  }
1463
- const W = [];
1464
- function Ke(e, t, r, n, o, s, i, a) {
1509
+ const q = [];
1510
+ function et(e, t, r, n, o, s, i, a) {
1465
1511
  if (e) {
1466
- W.push(r);
1512
+ q.push(r);
1467
1513
  try {
1468
1514
  if (t.loadingTemplate && r.isLoading) {
1469
- N(e, t.loadingTemplate(r), r, n, o);
1515
+ O(e, t.loadingTemplate(r), r, n, o);
1470
1516
  return;
1471
1517
  }
1472
1518
  if (t.errorTemplate && r.hasError) {
1473
- r.error instanceof Error && N(e, t.errorTemplate(r.error, r), r, n, o);
1519
+ r.error instanceof Error && O(e, t.errorTemplate(r.error, r), r, n, o);
1474
1520
  return;
1475
1521
  }
1476
1522
  const c = t.render(r);
1477
1523
  if (c instanceof Promise) {
1478
1524
  s(!0), c.then((f) => {
1479
- s(!1), i(null), N(e, f, r, n, o), a(e.innerHTML);
1525
+ s(!1), i(null), O(e, f, r, n, o), a(e.innerHTML);
1480
1526
  }).catch((f) => {
1481
- s(!1), i(f), t.errorTemplate && N(e, t.errorTemplate(f, r), r, n, o);
1482
- }), t.loadingTemplate && N(e, t.loadingTemplate(r), r, n, o);
1527
+ s(!1), i(f), t.errorTemplate && O(e, t.errorTemplate(f, r), r, n, o);
1528
+ }), t.loadingTemplate && O(e, t.loadingTemplate(r), r, n, o);
1483
1529
  return;
1484
1530
  }
1485
- N(e, c, r, n, o), a(e.innerHTML);
1531
+ O(e, c, r, n, o), a(e.innerHTML);
1486
1532
  } finally {
1487
- W.pop();
1533
+ q.pop();
1488
1534
  }
1489
1535
  }
1490
1536
  }
1491
- function N(e, t, r, n, o) {
1492
- e && (Be(
1537
+ function O(e, t, r, n, o) {
1538
+ e && (Ie(
1493
1539
  e,
1494
1540
  Array.isArray(t) ? t : [t],
1495
1541
  r,
1496
1542
  n
1497
1543
  ), o(e.innerHTML));
1498
1544
  }
1499
- function Ue(e, t, r, n, o, s, i) {
1545
+ function tt(e, t, r, n, o, s, i) {
1500
1546
  if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1501
1547
  if (o(r + 1), r > 10) {
1502
1548
  console.warn("Potential infinite render loop detected. Skipping render."), i(null);
@@ -1509,32 +1555,32 @@ function Ue(e, t, r, n, o, s, i) {
1509
1555
  }, 0);
1510
1556
  i(c);
1511
1557
  }
1512
- function Ve(e, t, r, n, o, s) {
1558
+ function rt(e, t, r, n, o, s) {
1513
1559
  if (!e) return;
1514
- const i = Fe(n);
1560
+ const i = Ge(n);
1515
1561
  if (!t.style && (!i || i.trim() === "")) {
1516
- s(null), e.adoptedStyleSheets = [le()];
1562
+ s(null), e.adoptedStyleSheets = [he()];
1517
1563
  return;
1518
1564
  }
1519
1565
  let a = "";
1520
1566
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1521
- let c = Re(`${a}
1567
+ let c = Fe(`${a}
1522
1568
  ${i}
1523
1569
  `);
1524
- c = me(c);
1570
+ c = $e(c);
1525
1571
  let f = o;
1526
- f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [le(), f], s(f);
1572
+ f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [he(), f], s(f);
1527
1573
  }
1528
- const Je = /* @__PURE__ */ new Map();
1529
- function pe(e, t, r) {
1530
- let n = ne(e);
1574
+ const nt = /* @__PURE__ */ new Map();
1575
+ function ve(e, t, r) {
1576
+ let n = ce(e);
1531
1577
  n.includes("-") || (n = `cer-${n}`);
1532
1578
  let o;
1533
1579
  typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
1534
1580
  console.error(`[${n}] Error:`, s, i);
1535
- }), Je.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, Qe(o));
1581
+ }), nt.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, ot(o));
1536
1582
  }
1537
- function Qe(e) {
1583
+ function ot(e) {
1538
1584
  if (!e.render)
1539
1585
  throw new Error(
1540
1586
  "Component must have a render function"
@@ -1621,7 +1667,7 @@ function Qe(e) {
1621
1667
  }
1622
1668
  connectedCallback() {
1623
1669
  this._runLogicWithinErrorBoundary(e, () => {
1624
- $e(
1670
+ Be(
1625
1671
  e,
1626
1672
  this.context,
1627
1673
  this._mounted,
@@ -1633,7 +1679,7 @@ function Qe(e) {
1633
1679
  }
1634
1680
  disconnectedCallback() {
1635
1681
  this._runLogicWithinErrorBoundary(e, () => {
1636
- _e(
1682
+ Re(
1637
1683
  e,
1638
1684
  this.context,
1639
1685
  this._listeners,
@@ -1657,7 +1703,7 @@ function Qe(e) {
1657
1703
  }
1658
1704
  attributeChangedCallback(t, r, n) {
1659
1705
  this._runLogicWithinErrorBoundary(e, () => {
1660
- this._applyProps(e), Se(
1706
+ this._applyProps(e), Ne(
1661
1707
  e,
1662
1708
  t,
1663
1709
  r,
@@ -1667,7 +1713,7 @@ function Qe(e) {
1667
1713
  });
1668
1714
  }
1669
1715
  static get observedAttributes() {
1670
- return e.props ? Object.keys(e.props).map(ne) : [];
1716
+ return e.props ? Object.keys(e.props).map(ce) : [];
1671
1717
  }
1672
1718
  _applyComputed(t) {
1673
1719
  this._runLogicWithinErrorBoundary(e, () => {
@@ -1675,7 +1721,7 @@ function Qe(e) {
1675
1721
  Object.defineProperty(this.context, r, {
1676
1722
  get: () => {
1677
1723
  const o = n(this.context);
1678
- return ee(o);
1724
+ return se(o);
1679
1725
  },
1680
1726
  enumerable: !0
1681
1727
  });
@@ -1685,7 +1731,7 @@ function Qe(e) {
1685
1731
  // --- Render ---
1686
1732
  _render(t) {
1687
1733
  this._runLogicWithinErrorBoundary(t, () => {
1688
- Ke(
1734
+ et(
1689
1735
  this.shadowRoot,
1690
1736
  t,
1691
1737
  this.context,
@@ -1708,7 +1754,7 @@ function Qe(e) {
1708
1754
  }
1709
1755
  _requestRender() {
1710
1756
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1711
- Ue(
1757
+ tt(
1712
1758
  () => this._render(this._cfg),
1713
1759
  this._lastRenderTime,
1714
1760
  this._renderCount,
@@ -1728,7 +1774,7 @@ function Qe(e) {
1728
1774
  // --- Style ---
1729
1775
  _applyStyle(t, r) {
1730
1776
  this._runLogicWithinErrorBoundary(t, () => {
1731
- Ve(
1777
+ rt(
1732
1778
  this.shadowRoot,
1733
1779
  t,
1734
1780
  this.context,
@@ -1767,11 +1813,11 @@ function Qe(e) {
1767
1813
  "splice",
1768
1814
  "sort",
1769
1815
  "reverse"
1770
- ].includes(a) ? function(...h) {
1771
- const l = f.apply(i, h);
1816
+ ].includes(a) ? function(...p) {
1817
+ const l = f.apply(i, p);
1772
1818
  if (!n._initializing) {
1773
- const v = s || "root";
1774
- n._triggerWatchers(v, i), n._render(t);
1819
+ const x = s || "root";
1820
+ n._triggerWatchers(x, i), n._render(t);
1775
1821
  }
1776
1822
  return l;
1777
1823
  } : f;
@@ -1814,7 +1860,7 @@ function Qe(e) {
1814
1860
  }
1815
1861
  _initWatchers(t) {
1816
1862
  this._runLogicWithinErrorBoundary(t, () => {
1817
- xe(
1863
+ Le(
1818
1864
  this.context,
1819
1865
  this._watchers,
1820
1866
  t.watch || {}
@@ -1822,12 +1868,12 @@ function Qe(e) {
1822
1868
  });
1823
1869
  }
1824
1870
  _triggerWatchers(t, r) {
1825
- we(this.context, this._watchers, t, r);
1871
+ je(this.context, this._watchers, t, r);
1826
1872
  }
1827
1873
  _applyProps(t) {
1828
1874
  this._runLogicWithinErrorBoundary(t, () => {
1829
1875
  try {
1830
- ke(this, t, this.context);
1876
+ ze(this, t, this.context);
1831
1877
  } catch (r) {
1832
1878
  this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(r, this.context));
1833
1879
  }
@@ -1835,92 +1881,92 @@ function Qe(e) {
1835
1881
  }
1836
1882
  };
1837
1883
  }
1838
- function P(e, t = {}, r, n) {
1884
+ function H(e, t = {}, r, n) {
1839
1885
  const o = n ?? t.key;
1840
1886
  return { tag: e, key: o, props: t, children: r };
1841
1887
  }
1842
- function K(e) {
1888
+ function Z(e) {
1843
1889
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
1844
1890
  }
1845
- function q(e) {
1846
- return typeof e == "object" && e !== null && "tag" in e && !K(e);
1891
+ function K(e) {
1892
+ return typeof e == "object" && e !== null && "tag" in e && !Z(e);
1847
1893
  }
1848
- function Ze(e, t) {
1894
+ function it(e, t) {
1849
1895
  return e.key != null ? e : { ...e, key: t };
1850
1896
  }
1851
- function Xe(e, t = [], r = {}) {
1897
+ function st(e, t = [], r = {}) {
1852
1898
  const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1853
1899
  let a;
1854
1900
  for (; a = i.exec(e); ) {
1855
- const c = a[1], f = a[2], y = (a[4] || a[6]) ?? "", h = y.match(/^{{(\d+)}}$/);
1856
- let l = h ? t[Number(h[1])] ?? null : y;
1857
- h || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
1858
- const v = ["model", "bind", "show", "class", "style"];
1901
+ const c = a[1], f = a[2], y = (a[4] || a[6]) ?? "", p = y.match(/^{{(\d+)}}$/);
1902
+ let l = p ? t[Number(p[1])] ?? null : y;
1903
+ p || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
1904
+ const x = ["model", "bind", "show", "class", "style"];
1859
1905
  if (c === ":") {
1860
- const [x, ...m] = f.split(".");
1861
- if (v.includes(x)) {
1862
- const g = [...m];
1863
- s[x] = {
1906
+ const [w, ...$] = f.split(".");
1907
+ if (x.includes(w)) {
1908
+ const g = [...$];
1909
+ s[w] = {
1864
1910
  value: l,
1865
1911
  modifiers: g
1866
1912
  };
1867
1913
  } else
1868
1914
  o[f] = l;
1869
1915
  } else if (c === "@") {
1870
- const x = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1871
- n[x] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1916
+ const w = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1917
+ n[w] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1872
1918
  } else f === "ref" ? n.ref = l : o[f] = l;
1873
1919
  }
1874
1920
  return { props: n, attrs: o, directives: s };
1875
1921
  }
1876
- function Ye(e, t, r) {
1877
- const n = W.length > 0 ? W[W.length - 1] : void 0, o = r ?? n;
1878
- function s(d, b) {
1879
- return P("#text", {}, d, b);
1922
+ function at(e, t, r) {
1923
+ const n = q.length > 0 ? q[q.length - 1] : void 0, o = r ?? n;
1924
+ function s(d, v) {
1925
+ return H("#text", {}, d, v);
1880
1926
  }
1881
1927
  let i = "";
1882
1928
  for (let d = 0; d < e.length; d++)
1883
1929
  i += e[d], d < t.length && (i += `{{${d}}}`);
1884
1930
  const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
1885
- let f, y = [], h = null, l = {}, v, x = 0, m = [];
1931
+ let f, y = [], p = null, l = {}, x, w = 0, $ = [];
1886
1932
  function g(d) {
1887
- !d || typeof d != "object" || K(d) || (d.props || d.attrs ? (d.props && (l.props || (l.props = {}), Object.assign(l.props, d.props)), d.attrs && (l.attrs || (l.attrs = {}), Object.keys(d.attrs).forEach((b) => {
1888
- if (b === "style" && l.attrs.style) {
1889
- const $ = l.attrs.style.replace(
1933
+ !d || typeof d != "object" || Z(d) || (d.props || d.attrs ? (d.props && (l.props || (l.props = {}), Object.assign(l.props, d.props)), d.attrs && (l.attrs || (l.attrs = {}), Object.keys(d.attrs).forEach((v) => {
1934
+ if (v === "style" && l.attrs.style) {
1935
+ const m = l.attrs.style.replace(
1890
1936
  /;?\s*$/,
1891
1937
  ""
1892
1938
  ), k = d.attrs.style.replace(/^;?\s*/, "");
1893
- l.attrs.style = $ + "; " + k;
1894
- } else if (b === "class" && l.attrs.class) {
1895
- const $ = l.attrs.class.trim().split(/\s+/).filter(Boolean), k = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1896
- .../* @__PURE__ */ new Set([...$, ...k])
1939
+ l.attrs.style = m + "; " + k;
1940
+ } else if (v === "class" && l.attrs.class) {
1941
+ const m = l.attrs.class.trim().split(/\s+/).filter(Boolean), k = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1942
+ .../* @__PURE__ */ new Set([...m, ...k])
1897
1943
  ];
1898
1944
  l.attrs.class = _.join(" ");
1899
1945
  } else
1900
- l.attrs[b] = d.attrs[b];
1946
+ l.attrs[v] = d.attrs[v];
1901
1947
  }))) : (l.props || (l.props = {}), Object.assign(l.props, d)));
1902
1948
  }
1903
- function u(d, b) {
1904
- const $ = h ? y : m;
1905
- if (K(d)) {
1906
- const k = d.key ?? b;
1949
+ function u(d, v) {
1950
+ const m = p ? y : $;
1951
+ if (Z(d)) {
1952
+ const k = d.key ?? v;
1907
1953
  let _ = d.children;
1908
- $.push({
1954
+ m.push({
1909
1955
  ...d,
1910
1956
  key: k,
1911
1957
  children: _
1912
1958
  });
1913
1959
  return;
1914
1960
  }
1915
- if (q(d)) {
1916
- $.push(Ze(d, void 0));
1961
+ if (K(d)) {
1962
+ m.push(it(d, void 0));
1917
1963
  return;
1918
1964
  }
1919
1965
  if (Array.isArray(d)) {
1920
1966
  if (d.length === 0) return;
1921
1967
  for (let k = 0; k < d.length; k++) {
1922
1968
  const _ = d[k];
1923
- K(_) || q(_) || Array.isArray(_) ? u(_, `${b}-${k}`) : _ !== null && typeof _ == "object" ? g(_) : $.push(s(String(_), `${b}-${k}`));
1969
+ Z(_) || K(_) || Array.isArray(_) ? u(_, `${v}-${k}`) : _ !== null && typeof _ == "object" ? g(_) : m.push(s(String(_), `${v}-${k}`));
1924
1970
  }
1925
1971
  return;
1926
1972
  }
@@ -1928,9 +1974,9 @@ function Ye(e, t, r) {
1928
1974
  g(d);
1929
1975
  return;
1930
1976
  }
1931
- $.push(s(String(d), b));
1977
+ m.push(s(String(d), v));
1932
1978
  }
1933
- const p = /* @__PURE__ */ new Set([
1979
+ const h = /* @__PURE__ */ new Set([
1934
1980
  "area",
1935
1981
  "base",
1936
1982
  "br",
@@ -1948,52 +1994,52 @@ function Ye(e, t, r) {
1948
1994
  ]);
1949
1995
  for (; f = a.exec(i); )
1950
1996
  if (f[1]) {
1951
- const d = f[1], b = f[0][1] === "/", $ = f[0][f[0].length - 2] === "/" || p.has(d), {
1997
+ const d = f[1], v = f[0][1] === "/", m = f[0][f[0].length - 2] === "/" || h.has(d), {
1952
1998
  props: k,
1953
1999
  attrs: _,
1954
2000
  directives: S
1955
- } = Xe(f[2] || "", t, o), C = { props: {}, attrs: {} };
1956
- for (const A in k) C.props[A] = k[A];
1957
- for (const A in _) C.attrs[A] = _[A];
1958
- if (Object.keys(S).length > 0 && (C.directives = { ...S }), b) {
1959
- const A = P(
1960
- h,
2001
+ } = st(f[2] || "", t, o), E = { props: {}, attrs: {} };
2002
+ for (const A in k) E.props[A] = k[A];
2003
+ for (const A in _) E.attrs[A] = _[A];
2004
+ if (Object.keys(S).length > 0 && (E.directives = { ...S }), v) {
2005
+ const A = H(
2006
+ p,
1961
2007
  l,
1962
- y.length === 1 && q(y[0]) && y[0].tag === "#text" ? typeof y[0].children == "string" ? y[0].children : "" : y.length ? y : void 0,
1963
- v
2008
+ y.length === 1 && K(y[0]) && y[0].tag === "#text" ? typeof y[0].children == "string" ? y[0].children : "" : y.length ? y : void 0,
2009
+ x
1964
2010
  ), T = c.pop();
1965
- T ? (h = T.tag, l = T.props, v = T.key, y = T.children, y.push(A)) : (m.push(A), h = null, l = {}, v = void 0, y = []);
1966
- } else $ ? h ? y.push(P(d, C, void 0, void 0)) : m.push(P(d, C, void 0, void 0)) : (h && c.push({
1967
- tag: h,
2011
+ T ? (p = T.tag, l = T.props, x = T.key, y = T.children, y.push(A)) : ($.push(A), p = null, l = {}, x = void 0, y = []);
2012
+ } else m ? p ? y.push(H(d, E, void 0, void 0)) : $.push(H(d, E, void 0, void 0)) : (p && c.push({
2013
+ tag: p,
1968
2014
  props: l,
1969
2015
  children: y,
1970
- key: v
1971
- }), h = d, l = C, y = []);
2016
+ key: x
2017
+ }), p = d, l = E, y = []);
1972
2018
  } else if (typeof f[3] < "u") {
1973
- const d = Number(f[3]), b = t[d], $ = `interp-${d}`;
1974
- u(b, $);
2019
+ const d = Number(f[3]), v = t[d], m = `interp-${d}`;
2020
+ u(v, m);
1975
2021
  } else if (f[4]) {
1976
- const d = f[4], b = h ? y : m, $ = d.split(/({{\d+}})/);
1977
- for (const k of $) {
2022
+ const d = f[4], v = p ? y : $, m = d.split(/({{\d+}})/);
2023
+ for (const k of m) {
1978
2024
  if (!k) continue;
1979
2025
  const _ = k.match(/^{{(\d+)}}$/);
1980
2026
  if (_) {
1981
- const S = Number(_[1]), C = t[S], A = `interp-${S}`;
1982
- u(C, A);
2027
+ const S = Number(_[1]), E = t[S], A = `interp-${S}`;
2028
+ u(E, A);
1983
2029
  } else {
1984
- const S = `text-${x++}`;
1985
- b.push(s(k, S));
2030
+ const S = `text-${w++}`;
2031
+ v.push(s(k, S));
1986
2032
  }
1987
2033
  }
1988
2034
  }
1989
- const w = m.filter((d) => q(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
1990
- return w.length === 1 ? w[0] : w.length > 1 ? w : P("div", {}, "", "fallback-root");
2035
+ const b = $.filter((d) => K(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
2036
+ return b.length === 1 ? b[0] : b.length > 1 ? b : H("div", {}, "", "fallback-root");
1991
2037
  }
1992
- function M(e, ...t) {
2038
+ function W(e, ...t) {
1993
2039
  const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
1994
- return Ye(e, t, n);
2040
+ return at(e, t, n);
1995
2041
  }
1996
- const he = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, z = (e, t) => {
2042
+ const xe = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, B = (e, t) => {
1997
2043
  for (const r of e) {
1998
2044
  const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
1999
2045
  if (i) {
@@ -2004,92 +2050,92 @@ const he = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new
2004
2050
  }
2005
2051
  }
2006
2052
  return { route: null, params: {} };
2007
- }, G = {};
2008
- async function Ge(e) {
2053
+ }, ie = {};
2054
+ async function lt(e) {
2009
2055
  if (e.component) return e.component;
2010
2056
  if (e.load) {
2011
- if (G[e.path]) return G[e.path];
2057
+ if (ie[e.path]) return ie[e.path];
2012
2058
  try {
2013
2059
  const t = await e.load();
2014
- return G[e.path] = t.default, t.default;
2060
+ return ie[e.path] = t.default, t.default;
2015
2061
  } catch {
2016
2062
  throw new Error(`Failed to load component for route: ${e.path}`);
2017
2063
  }
2018
2064
  }
2019
2065
  throw new Error(`No component or loader defined for route: ${e.path}`);
2020
2066
  }
2021
- function et(e) {
2067
+ function ct(e) {
2022
2068
  const { routes: t, base: r = "", initialUrl: n } = e;
2023
2069
  let o, s, i, a, c, f, y;
2024
- const h = async (m, g) => {
2025
- const u = t.find((p) => z([p], m.path).route !== null);
2070
+ const p = async ($, g) => {
2071
+ const u = t.find((h) => B([h], $.path).route !== null);
2026
2072
  if (u?.beforeEnter)
2027
2073
  try {
2028
- const p = await u.beforeEnter(m, g);
2029
- return typeof p == "string" ? (await x(p, !0), !1) : p !== !1;
2030
- } catch (p) {
2031
- return console.error("beforeEnter error", p), !1;
2074
+ const h = await u.beforeEnter($, g);
2075
+ return typeof h == "string" ? (await w(h, !0), !1) : h !== !1;
2076
+ } catch (h) {
2077
+ return console.error("beforeEnter error", h), !1;
2032
2078
  }
2033
2079
  return !0;
2034
- }, l = async (m, g) => {
2035
- const u = t.find((p) => z([p], m.path).route !== null);
2080
+ }, l = async ($, g) => {
2081
+ const u = t.find((h) => B([h], $.path).route !== null);
2036
2082
  if (u?.onEnter)
2037
2083
  try {
2038
- const p = await u.onEnter(m, g);
2039
- return typeof p == "string" ? (await x(p, !0), !1) : p !== !1;
2040
- } catch (p) {
2041
- return console.error("onEnter error", p), !1;
2084
+ const h = await u.onEnter($, g);
2085
+ return typeof h == "string" ? (await w(h, !0), !1) : h !== !1;
2086
+ } catch (h) {
2087
+ return console.error("onEnter error", h), !1;
2042
2088
  }
2043
2089
  return !0;
2044
- }, v = (m, g) => {
2045
- const u = t.find((p) => z([p], m.path).route !== null);
2090
+ }, x = ($, g) => {
2091
+ const u = t.find((h) => B([h], $.path).route !== null);
2046
2092
  if (u?.afterEnter)
2047
2093
  try {
2048
- u.afterEnter(m, g);
2049
- } catch (p) {
2050
- console.error("afterEnter error", p);
2094
+ u.afterEnter($, g);
2095
+ } catch (h) {
2096
+ console.error("afterEnter error", h);
2051
2097
  }
2052
- }, x = async (m, g = !1) => {
2098
+ }, w = async ($, g = !1) => {
2053
2099
  try {
2054
2100
  const u = {
2055
- path: m.replace(r, "") || "/",
2101
+ path: $.replace(r, "") || "/",
2056
2102
  query: {}
2057
- }, p = z(t, u.path);
2058
- if (!p) throw new Error(`No route found for ${u.path}`);
2059
- const w = i.getState(), d = {
2103
+ }, h = B(t, u.path);
2104
+ if (!h) throw new Error(`No route found for ${u.path}`);
2105
+ const b = i.getState(), d = {
2060
2106
  path: u.path,
2061
- params: p.params,
2107
+ params: h.params,
2062
2108
  query: u.query
2063
2109
  };
2064
- if (!await h(d, w) || !await l(d, w)) return;
2065
- typeof window < "u" && typeof document < "u" && (g ? window.history.replaceState({}, "", r + m) : window.history.pushState({}, "", r + m)), i.setState(d), v(d, w);
2110
+ if (!await p(d, b) || !await l(d, b)) return;
2111
+ typeof window < "u" && typeof document < "u" && (g ? window.history.replaceState({}, "", r + $) : window.history.pushState({}, "", r + $)), i.setState(d), x(d, b);
2066
2112
  } catch (u) {
2067
2113
  console.error("Navigation error:", u);
2068
2114
  }
2069
2115
  };
2070
2116
  if (typeof window < "u" && typeof document < "u") {
2071
2117
  o = () => {
2072
- const g = new URL(window.location.href), u = g.pathname.replace(r, "") || "/", p = he(g.search);
2073
- return { path: u, query: p };
2118
+ const g = new URL(window.location.href), u = g.pathname.replace(r, "") || "/", h = xe(g.search);
2119
+ return { path: u, query: h };
2074
2120
  }, s = o();
2075
- const m = z(t, s.path);
2076
- i = se({
2121
+ const $ = B(t, s.path);
2122
+ i = de({
2077
2123
  path: s.path,
2078
- params: m.params,
2124
+ params: $.params,
2079
2125
  query: s.query
2080
2126
  }), a = async (g = !1) => {
2081
2127
  const u = o();
2082
- await x(u.path, g);
2083
- }, window.addEventListener("popstate", () => a(!0)), c = (g) => x(g, !1), f = (g) => x(g, !0), y = () => window.history.back();
2128
+ await w(u.path, g);
2129
+ }, window.addEventListener("popstate", () => a(!0)), c = (g) => w(g, !1), f = (g) => w(g, !0), y = () => window.history.back();
2084
2130
  } else {
2085
2131
  o = () => {
2086
- const u = new URL(n || "/", "http://localhost"), p = u.pathname.replace(r, "") || "/", w = he(u.search);
2087
- return { path: p, query: w };
2132
+ const u = new URL(n || "/", "http://localhost"), h = u.pathname.replace(r, "") || "/", b = xe(u.search);
2133
+ return { path: h, query: b };
2088
2134
  }, s = o();
2089
- const m = z(t, s.path);
2090
- i = se({
2135
+ const $ = B(t, s.path);
2136
+ i = de({
2091
2137
  path: s.path,
2092
- params: m.params,
2138
+ params: $.params,
2093
2139
  query: s.query
2094
2140
  }), a = async () => {
2095
2141
  const u = o();
@@ -2097,19 +2143,19 @@ function et(e) {
2097
2143
  };
2098
2144
  const g = async (u) => {
2099
2145
  try {
2100
- const p = {
2146
+ const h = {
2101
2147
  path: u.replace(r, "") || "/",
2102
2148
  query: {}
2103
- }, w = z(t, p.path);
2104
- if (!w) throw new Error(`No route found for ${p.path}`);
2105
- const d = i.getState(), b = {
2106
- path: p.path,
2107
- params: w.params,
2108
- query: p.query
2109
- }, $ = t.find((k) => z([k], b.path).route !== null);
2110
- if ($?.beforeEnter)
2149
+ }, b = B(t, h.path);
2150
+ if (!b) throw new Error(`No route found for ${h.path}`);
2151
+ const d = i.getState(), v = {
2152
+ path: h.path,
2153
+ params: b.params,
2154
+ query: h.query
2155
+ }, m = t.find((k) => B([k], v.path).route !== null);
2156
+ if (m?.beforeEnter)
2111
2157
  try {
2112
- const k = await $.beforeEnter(b, d);
2158
+ const k = await m.beforeEnter(v, d);
2113
2159
  if (typeof k == "string") {
2114
2160
  await g(k);
2115
2161
  return;
@@ -2118,9 +2164,9 @@ function et(e) {
2118
2164
  } catch {
2119
2165
  return;
2120
2166
  }
2121
- if ($?.onEnter)
2167
+ if (m?.onEnter)
2122
2168
  try {
2123
- const k = await $.onEnter(b, d);
2169
+ const k = await m.onEnter(v, d);
2124
2170
  if (typeof k == "string") {
2125
2171
  await g(k);
2126
2172
  return;
@@ -2129,9 +2175,9 @@ function et(e) {
2129
2175
  } catch {
2130
2176
  return;
2131
2177
  }
2132
- if (i.setState(b), $?.afterEnter)
2178
+ if (i.setState(v), m?.afterEnter)
2133
2179
  try {
2134
- $.afterEnter(b, d);
2180
+ m.afterEnter(v, d);
2135
2181
  } catch {
2136
2182
  }
2137
2183
  } catch {
@@ -2146,34 +2192,34 @@ function et(e) {
2146
2192
  replace: f,
2147
2193
  back: y,
2148
2194
  subscribe: i.subscribe,
2149
- matchRoute: (m) => z(t, m),
2195
+ matchRoute: ($) => B(t, $),
2150
2196
  getCurrent: () => i.getState(),
2151
- resolveRouteComponent: Ge
2197
+ resolveRouteComponent: lt
2152
2198
  };
2153
2199
  }
2154
- function lt(e, t) {
2155
- return z(e, t);
2200
+ function mt(e, t) {
2201
+ return B(e, t);
2156
2202
  }
2157
- function ct(e) {
2158
- const t = et(e);
2159
- return pe("router-view", {
2203
+ function bt(e) {
2204
+ const t = ct(e);
2205
+ return ve("router-view", {
2160
2206
  async render() {
2161
- if (!t) return M`<div>Router not initialized.</div>`;
2207
+ if (!t) return W`<div>Router not initialized.</div>`;
2162
2208
  const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
2163
- if (!o.route) return M`<div>Not found</div>`;
2209
+ if (!o.route) return W`<div>Not found</div>`;
2164
2210
  let s = o.route.component;
2165
2211
  if (o.route.load) {
2166
2212
  const i = await o.route.load();
2167
2213
  typeof i.default == "string" && (s = i.default);
2168
2214
  }
2169
- return typeof s == "string" ? { tag: s, props: {}, children: [] } : M`<div>Invalid route component</div>`;
2215
+ return typeof s == "string" ? { tag: s, props: {}, children: [] } : W`<div>Invalid route component</div>`;
2170
2216
  },
2171
2217
  onConnected(r) {
2172
2218
  t && typeof t.subscribe == "function" && t.subscribe(() => {
2173
2219
  typeof r.requestRender == "function" && r.requestRender();
2174
2220
  });
2175
2221
  }
2176
- }), pe("router-link", {
2222
+ }), ve("router-link", {
2177
2223
  state: {},
2178
2224
  props: {
2179
2225
  to: { type: String, default: "" },
@@ -2186,7 +2232,7 @@ function ct(e) {
2186
2232
  disabled: { type: Boolean, default: !1 },
2187
2233
  external: { type: Boolean, default: !1 },
2188
2234
  class: { type: String, default: "" },
2189
- style: { type: String, default: ye`
2235
+ style: { type: String, default: ke`
2190
2236
  [aria-disabled="true"] {
2191
2237
  pointer-events: none;
2192
2238
  opacity: 0.5;
@@ -2195,25 +2241,25 @@ function ct(e) {
2195
2241
  },
2196
2242
  style: (r) => r.style,
2197
2243
  render: (r) => {
2198
- const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, y = r.disabled, h = r.external, l = n.path === o, v = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, x = l ? i : v ? a : "", m = l ? `aria-current="${c}"` : "", g = f === "button", u = y ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", p = h && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2199
- return M`
2200
- ${be().when(g, M`
2244
+ const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, y = r.disabled, p = r.external, l = n.path === o, x = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, w = l ? i : x ? a : "", $ = l ? `aria-current="${c}"` : "", g = f === "button", u = y ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", h = p && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2245
+ return W`
2246
+ ${Ae().when(g, W`
2201
2247
  <button
2202
2248
  part="button"
2203
- :class="${r.class} ${x}"
2204
- ${m}
2249
+ :class="${r.class} ${w}"
2250
+ ${$}
2205
2251
  ${u}
2206
- ${p}
2252
+ ${h}
2207
2253
  @click="navigate"
2208
2254
  ><slot></slot></button>
2209
- `).otherwise(M`
2255
+ `).otherwise(W`
2210
2256
  <a
2211
2257
  part="link"
2212
2258
  href="${o}"
2213
- :class="${r.class} ${x}"
2214
- ${m}
2259
+ :class="${r.class} ${w}"
2260
+ ${$}
2215
2261
  ${u}
2216
- ${p}
2262
+ ${h}
2217
2263
  @click="navigate"
2218
2264
  ><slot></slot></a>
2219
2265
  `).done()}
@@ -2229,25 +2275,25 @@ function ct(e) {
2229
2275
  }), t;
2230
2276
  }
2231
2277
  export {
2232
- O as GlobalEventBus,
2233
- pe as component,
2234
- se as createStore,
2235
- ye as css,
2236
- rt as each,
2237
- nt as emit,
2238
- D as eventBus,
2239
- M as html,
2240
- ct as initRouter,
2241
- at as listen,
2242
- be as match,
2243
- z as matchRoute,
2244
- lt as matchRouteSSR,
2245
- it as off,
2246
- ot as on,
2247
- st as once,
2248
- he as parseQuery,
2249
- Ge as resolveRouteComponent,
2250
- et as useRouter,
2251
- tt as when
2278
+ D as GlobalEventBus,
2279
+ ve as component,
2280
+ de as createStore,
2281
+ ke as css,
2282
+ ut as each,
2283
+ dt as emit,
2284
+ I as eventBus,
2285
+ W as html,
2286
+ bt as initRouter,
2287
+ yt as listen,
2288
+ Ae as match,
2289
+ B as matchRoute,
2290
+ mt as matchRouteSSR,
2291
+ ht as off,
2292
+ pt as on,
2293
+ gt as once,
2294
+ xe as parseQuery,
2295
+ lt as resolveRouteComponent,
2296
+ ct as useRouter,
2297
+ ft as when
2252
2298
  };
2253
2299
  //# sourceMappingURL=custom-elements-runtime.es.js.map