@jasonshimmy/custom-elements-runtime 0.1.12 → 0.1.14

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 at(e, t) {
2
- return Y(e ? t : [], "when-block");
1
+ function Xe(e, t) {
2
+ return F(e ? t : [], "when-block");
3
3
  }
4
- function lt(e, t) {
4
+ function Ye(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 Y(t(r, n), `each-${o}`);
7
+ return F(t(r, n), `each-${o}`);
8
8
  });
9
9
  }
10
- function $e() {
10
+ function pe() {
11
11
  const e = [];
12
12
  return {
13
13
  when(t, r) {
@@ -17,18 +17,18 @@ function $e() {
17
17
  return e.push([!0, t]), this;
18
18
  },
19
19
  done() {
20
- return Se(...e);
20
+ return he(...e);
21
21
  }
22
22
  };
23
23
  }
24
- function Se(...e) {
24
+ function he(...e) {
25
25
  for (let t = 0; t < e.length; t++) {
26
26
  const [r, n] = e[t];
27
- if (r) return [Y(n, `whenChain-branch-${t}`)];
27
+ if (r) return [F(n, `whenChain-branch-${t}`)];
28
28
  }
29
- return [Y([], "whenChain-empty")];
29
+ return [F([], "whenChain-empty")];
30
30
  }
31
- function Y(e, t) {
31
+ function F(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 Y(e, t) {
36
36
  children: r
37
37
  };
38
38
  }
39
- class D extends EventTarget {
39
+ class N extends EventTarget {
40
40
  handlers = {};
41
41
  static instance;
42
42
  eventCounters = /* @__PURE__ */ new Map();
@@ -44,7 +44,7 @@ class D extends EventTarget {
44
44
  * Returns the singleton instance of GlobalEventBus
45
45
  */
46
46
  static getInstance() {
47
- return D.instance || (D.instance = new D()), D.instance;
47
+ return N.instance || (N.instance = new N()), N.instance;
48
48
  }
49
49
  // Enhanced emit method with better typing and event storm protection
50
50
  /**
@@ -160,8 +160,8 @@ class D extends EventTarget {
160
160
  this.eventCounters.clear();
161
161
  }
162
162
  }
163
- const K = D.getInstance(), ct = (e, t) => K.emit(e, t), ft = (e, t) => K.on(e, t), ut = (e, t) => K.off(e, t), dt = (e, t) => K.once(e, t), pt = (e, t, r) => K.listen(e, t, r);
164
- function ce(e) {
163
+ const P = N.getInstance(), Ge = (e, t) => P.emit(e, t), et = (e, t) => P.on(e, t), tt = (e, t) => P.off(e, t), rt = (e, t) => P.once(e, t), nt = (e, t, r) => P.listen(e, t, r);
164
+ function te(e) {
165
165
  let t = { ...e };
166
166
  const r = [];
167
167
  function n(a) {
@@ -179,10 +179,10 @@ function ce(e) {
179
179
  }
180
180
  return { subscribe: n, getState: o, setState: s };
181
181
  }
182
- function ae(e) {
182
+ function ee(e) {
183
183
  return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
184
184
  }
185
- function oe(e) {
185
+ function X(e) {
186
186
  return typeof e == "string" ? e.replace(
187
187
  /[&<>"']/g,
188
188
  (t) => ({
@@ -194,32 +194,32 @@ function oe(e) {
194
194
  })[t]
195
195
  ) : e;
196
196
  }
197
- function _e(e, t, r) {
197
+ function ge(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: ie(e, n)
204
+ oldValue: Y(e, n)
205
205
  }), i.immediate)
206
206
  try {
207
- const a = ie(e, n);
207
+ const a = Y(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 ie(e, t) {
214
+ function Y(e, t) {
215
215
  return t.split(".").reduce((r, n) => r?.[n], e);
216
216
  }
217
- function Ce(e, t, r, n) {
217
+ function ye(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((h, g) => o(h, a[g]));
222
+ return i.length !== a.length ? !1 : i.every((h, p) => o(h, a[p]));
223
223
  const c = Object.keys(i), f = Object.keys(a);
224
224
  return c.length !== f.length ? !1 : c.every((h) => o(i[h], a[h]));
225
225
  }, s = t.get(r);
@@ -232,13 +232,13 @@ function Ce(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 = ie(e, i);
235
+ const c = Y(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 Ee(e, t, r) {
241
+ function me(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,150 +247,157 @@ function Ee(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(ae(o));
251
- i !== null ? r[o] = oe(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = oe(s.default));
250
+ const i = e.getAttribute(ee(o));
251
+ i !== null ? r[o] = X(n(i, s.type)) : "default" in s && s.default !== void 0 && (r[o] = X(s.default));
252
252
  }
253
253
  });
254
254
  }
255
- function Ae(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 Te(e, t, r, n, o, s, i, a) {
258
+ function ve(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 je(e, t, r, n, o) {
261
+ function xe(e, t, r, n, o) {
262
262
  e.onAttributeChanged && e.onAttributeChanged(t, r, n, o);
263
263
  }
264
- function M(e, t) {
264
+ function j(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
- M(r, t);
269
+ j(r, t);
270
270
  }
271
271
  }
272
- function O(e, t) {
272
+ function z(e, t) {
273
273
  return typeof t == "string" ? t.split(".").reduce((r, n) => r?.[n], e) : t;
274
274
  }
275
- function fe(e, t, r) {
275
+ function re(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 Le(e, t, r, n, o, s, i) {
281
+ function we(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"), h = () => {
284
- const p = s._state || s;
285
- return O(p, e);
286
- }, g = h();
284
+ const g = s._state || s;
285
+ return z(g, e);
286
+ }, p = h();
287
287
  let l = "text";
288
288
  const x = n?.type;
289
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(g)) {
291
- const p = i?.getAttribute("value") || n?.value || "", u = g.includes(p);
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 p = i?.getAttribute("true-value") || !0, u = g === p;
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 p = n?.value || "", u = g === p;
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 p = i, u = Array.isArray(g) ? g : [];
302
+ const g = i, u = Array.isArray(p) ? p : [];
303
303
  setTimeout(() => {
304
- Array.from(p.options).forEach((y) => {
305
- const b = u.includes(y.value);
306
- y.selected !== b && (y.selected = b);
304
+ Array.from(g.options).forEach((m) => {
305
+ const v = u.includes(m.value);
306
+ m.selected !== v && (m.selected = v);
307
307
  });
308
308
  }, 0);
309
309
  } else
310
310
  setTimeout(() => {
311
- i instanceof HTMLSelectElement && i.value !== String(g) && (i.value = String(g));
311
+ i instanceof HTMLSelectElement && i.value !== String(p) && (i.value = String(p));
312
312
  }, 0);
313
313
  else {
314
- const p = String(g ?? "");
315
- (!i || i.value !== p) && (r.value = g);
314
+ const g = String(p ?? "");
315
+ (!i || i.value !== g) && (r.value = p);
316
316
  }
317
- const m = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", v = (p) => {
318
- if (p.isComposing || o._isComposing || p.isTrusted === !1) return;
319
- const u = p.target;
317
+ const y = a || l === "checkbox" || l === "radio" || l === "select" ? "change" : "input", b = (g) => {
318
+ if (g.isComposing || o._isComposing || g.isTrusted === !1) return;
319
+ const u = g.target;
320
320
  if (u._modelUpdating) return;
321
- const y = h();
322
- let b = u.value;
321
+ const m = h();
322
+ let v = u.value;
323
323
  if (l === "checkbox")
324
- if (Array.isArray(y)) {
325
- const k = u.getAttribute("value") || "", _ = [...y];
324
+ if (Array.isArray(m)) {
325
+ const w = u.getAttribute("value") || "", _ = [...m];
326
326
  if (u.checked)
327
- _.includes(k) || _.push(k);
327
+ _.includes(w) || _.push(w);
328
328
  else {
329
- const C = _.indexOf(k);
330
- C > -1 && _.splice(C, 1);
329
+ const S = _.indexOf(w);
330
+ S > -1 && _.splice(S, 1);
331
331
  }
332
- b = _;
332
+ v = _;
333
333
  } else {
334
- const k = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
- b = u.checked ? k : _;
334
+ const w = u.getAttribute("true-value") || !0, _ = u.getAttribute("false-value") || !1;
335
+ v = u.checked ? w : _;
336
336
  }
337
337
  else if (l === "radio")
338
- b = u.getAttribute("value") || u.value;
338
+ v = u.getAttribute("value") || u.value;
339
339
  else if (l === "select" && u.multiple) {
340
- const k = u;
341
- b = Array.from(k.selectedOptions).map(
340
+ const w = u;
341
+ v = Array.from(w.selectedOptions).map(
342
342
  (_) => _.value
343
343
  );
344
- } else if (c && (b = b.trim()), f) {
345
- const k = Number(b);
346
- isNaN(k) || (b = k);
344
+ } else if (c && (v = v.trim()), f) {
345
+ const w = Number(v);
346
+ isNaN(w) || (v = w);
347
347
  }
348
- const d = s._state || s, $ = O(d, e);
349
- if (Array.isArray(b) && Array.isArray($) ? JSON.stringify([...b].sort()) !== JSON.stringify([...$].sort()) : b !== $) {
350
- const k = p.target;
351
- k._modelUpdating = !0, fe(d, e, b), setTimeout(() => {
352
- k._modelUpdating = !1;
348
+ const d = s._state || s, $ = z(d, e);
349
+ if (Array.isArray(v) && Array.isArray($) ? JSON.stringify([...v].sort()) !== JSON.stringify([...$].sort()) : v !== $) {
350
+ const w = g.target;
351
+ w._modelUpdating = !0, re(d, e, v), setTimeout(() => {
352
+ w._modelUpdating = !1;
353
353
  }, 0), s._requestRender && s._requestRender();
354
354
  }
355
355
  };
356
- if (o[m] = v, l === "text" || l === "textarea") {
357
- const p = () => {
356
+ if (o[y] = b, l === "text" || l === "textarea") {
357
+ const g = () => {
358
358
  o._isComposing = !0;
359
- }, u = (y) => {
359
+ }, u = (m) => {
360
360
  o._isComposing = !1;
361
- const b = y.target;
361
+ const v = m.target;
362
362
  setTimeout(() => {
363
- if (b) {
364
- let d = b.value;
363
+ if (v) {
364
+ let d = v.value;
365
365
  if (c && (d = d.trim()), f) {
366
366
  const _ = Number(d);
367
367
  isNaN(_) || (d = _);
368
368
  }
369
- const $ = s._state || s, w = O($, e);
370
- (Array.isArray(d) && Array.isArray(w) ? JSON.stringify([...d].sort()) !== JSON.stringify([...w].sort()) : d !== w) && (b && (b._modelUpdating = !0, setTimeout(() => {
371
- b._modelUpdating = !1;
372
- }, 0)), fe($, e, d), s._requestRender && s._requestRender());
369
+ const $ = s._state || s, k = z($, e);
370
+ (Array.isArray(d) && Array.isArray(k) ? JSON.stringify([...d].sort()) !== JSON.stringify([...k].sort()) : d !== k) && (v && (v._modelUpdating = !0, setTimeout(() => {
371
+ v._modelUpdating = !1;
372
+ }, 0)), re($, e, d), s._requestRender && s._requestRender());
373
373
  }
374
374
  }, 0);
375
375
  };
376
- o.compositionstart = p, o.compositionend = u;
376
+ o.compositionstart = g, o.compositionend = u;
377
377
  }
378
378
  }
379
- function Be(e, t, r, n) {
380
- if (n)
381
- try {
382
- const o = JSON.parse(e);
383
- if (typeof o == "object")
384
- for (const [s, i] of Object.entries(o))
385
- t[s] = i;
386
- } catch {
387
- const o = O(n, e);
388
- r[e] = o;
389
- }
379
+ function ke(e, t, r, n) {
380
+ if (n) {
381
+ if (typeof e == "object" && e !== null)
382
+ for (const [o, s] of Object.entries(e))
383
+ t[o] = s;
384
+ else if (typeof e == "string")
385
+ try {
386
+ const o = JSON.parse(e);
387
+ if (typeof o == "object" && o !== null) {
388
+ for (const [s, i] of Object.entries(o))
389
+ t[s] = i;
390
+ return;
391
+ }
392
+ } catch {
393
+ const o = z(n, e);
394
+ r[e] = o;
395
+ }
396
+ }
390
397
  }
391
- function ze(e, t, r) {
398
+ function $e(e, t, r) {
392
399
  if (!r) return;
393
- const n = O(r, e), o = t.style || "", s = n ? "" : "none";
400
+ const n = z(r, e), o = t.style || "", s = n ? "" : "none";
394
401
  if (o) {
395
402
  const i = o.split(";").filter(Boolean), a = i.findIndex(
396
403
  (c) => c.trim().startsWith("display:")
@@ -399,19 +406,19 @@ function ze(e, t, r) {
399
406
  } else
400
407
  t.style = `display: ${s}`;
401
408
  }
402
- function Re(e, t, r) {
409
+ function _e(e, t, r) {
403
410
  if (!r) return;
404
- const n = O(r, e);
411
+ const n = z(r, e);
405
412
  let o = [];
406
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)));
407
414
  const s = t.class || "", i = s ? `${s} ${o.join(" ")}`.trim() : o.join(" ");
408
415
  i && (t.class = i);
409
416
  }
410
- function Ne(e, t, r) {
417
+ function Se(e, t, r) {
411
418
  let n;
412
419
  if (typeof e == "string") {
413
420
  if (!r) return;
414
- n = O(r, e);
421
+ n = z(r, e);
415
422
  } else
416
423
  n = e;
417
424
  let o = "";
@@ -450,21 +457,21 @@ function Ne(e, t, r) {
450
457
  "min-height",
451
458
  "max-height"
452
459
  ];
453
- let g = String(c);
454
- typeof c == "number" && h.includes(f) && (g = `${c}px`), i.push(`${f}: ${g}`);
460
+ let p = String(c);
461
+ typeof c == "number" && h.includes(f) && (p = `${c}px`), i.push(`${f}: ${p}`);
455
462
  }
456
463
  o = i.join("; ") + (i.length > 0 ? ";" : "");
457
464
  }
458
465
  const s = t.style || "";
459
466
  t.style = s + (s && !s.endsWith(";") ? "; " : "") + o;
460
467
  }
461
- function be(e, t, r, n) {
468
+ function fe(e, t, r, n) {
462
469
  const o = {}, s = { ...n || {} }, i = {};
463
470
  for (const [a, c] of Object.entries(e)) {
464
471
  const { value: f, modifiers: h } = c;
465
472
  switch (a) {
466
473
  case "model":
467
- Le(
474
+ we(
468
475
  typeof f == "string" ? f : String(f),
469
476
  h,
470
477
  o,
@@ -475,45 +482,45 @@ function be(e, t, r, n) {
475
482
  );
476
483
  break;
477
484
  case "bind":
478
- Be(f, o, s, t);
485
+ ke(f, o, s, t);
479
486
  break;
480
487
  case "show":
481
- ze(f, s, t);
488
+ $e(f, s, t);
482
489
  break;
483
490
  case "class":
484
- Re(f, s, t);
491
+ _e(f, s, t);
485
492
  break;
486
493
  case "style":
487
- Ne(f, s, t);
494
+ Se(f, s, t);
488
495
  break;
489
496
  }
490
497
  }
491
498
  return { props: o, attrs: s, listeners: i };
492
499
  }
493
- function se(e, t) {
500
+ function G(e, t) {
494
501
  if (Array.isArray(e)) {
495
502
  const s = /* @__PURE__ */ new Set();
496
503
  return e.map((i) => {
497
504
  if (!i || typeof i != "object") return i;
498
505
  let a = i.props?.key ?? i.key;
499
506
  if (!a) {
500
- const g = i.tag || "node", l = i.props?.attrs?.id ?? i.props?.attrs?.name ?? i.props?.attrs?.["data-key"] ?? "";
501
- a = l ? `${t}:${g}:${l}` : `${t}:${g}`;
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}`;
502
509
  }
503
510
  let c = a, f = 1;
504
511
  for (; s.has(c); )
505
512
  c = `${a}#${f++}`;
506
513
  s.add(c);
507
514
  let h = i.children;
508
- return Array.isArray(h) && (h = se(h, c)), { ...i, key: c, children: h };
515
+ return Array.isArray(h) && (h = G(h, c)), { ...i, key: c, children: h };
509
516
  });
510
517
  }
511
518
  const r = e;
512
519
  let n = r.props?.key ?? r.key ?? t, o = r.children;
513
- return Array.isArray(o) && (o = se(o, n)), { ...r, key: n, children: o };
520
+ return Array.isArray(o) && (o = G(o, n)), { ...r, key: n, children: o };
514
521
  }
515
- function Me(e, t, r, n) {
516
- const o = r.directives ?? {}, s = be(
522
+ function Ce(e, t, r, n) {
523
+ const o = r.directives ?? {}, s = fe(
517
524
  o,
518
525
  n,
519
526
  e,
@@ -528,78 +535,86 @@ function Me(e, t, r, n) {
528
535
  ...s.attrs
529
536
  }, c = t.props ?? {}, f = i;
530
537
  for (const l in { ...c, ...f }) {
531
- const x = c[l], m = f[l];
532
- x !== m && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== m && (e.value = m ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!m : l.startsWith("on") && typeof m == "function" ? (typeof x == "function" && e.removeEventListener(l.slice(2).toLowerCase(), x), e.addEventListener(l.slice(2).toLowerCase(), m)) : m == null || m === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(m)));
538
+ const x = c[l], y = f[l];
539
+ x !== y && (l === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== y && (e.value = y ?? "") : l === "checked" && e instanceof HTMLInputElement ? e.checked = !!y : l.startsWith("on") && typeof y == "function" ? (typeof x == "function" && e.removeEventListener(l.slice(2).toLowerCase(), x), e.addEventListener(l.slice(2).toLowerCase(), y)) : y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
533
540
  }
534
541
  for (const [l, x] of Object.entries(
535
542
  s.listeners || {}
536
543
  ))
537
544
  e.addEventListener(l, x);
538
- const h = t.attrs ?? {}, g = a;
539
- for (const l in { ...h, ...g }) {
540
- const x = h[l], m = g[l];
541
- x !== m && (m == null || m === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(m)));
545
+ const h = t.attrs ?? {}, p = a;
546
+ for (const l in { ...h, ...p }) {
547
+ const x = h[l], y = p[l];
548
+ x !== y && (y == null || y === !1 ? e.removeAttribute(l) : e.setAttribute(l, String(y)));
542
549
  }
543
550
  }
544
- function L(e, t, r) {
551
+ function A(e, t, r) {
545
552
  if (typeof e == "string")
546
553
  return document.createTextNode(e);
547
554
  if (e.tag === "#text") {
548
- const g = document.createTextNode(
555
+ const p = document.createTextNode(
549
556
  typeof e.children == "string" ? e.children : ""
550
557
  );
551
- return e.key != null && (g.key = e.key), g;
558
+ return e.key != null && (p.key = e.key), p;
552
559
  }
553
560
  if (e.tag === "#anchor") {
554
- const g = e, l = Array.isArray(g.children) ? g.children : [], x = document.createTextNode(""), m = document.createTextNode("");
555
- g.key != null && (x.key = `${g.key}:start`, m.key = `${g.key}:end`), g._startNode = x, g._endNode = m;
556
- const v = document.createDocumentFragment();
557
- v.appendChild(x);
558
- for (const p of l) {
559
- const u = L(p, t);
560
- v.appendChild(u);
561
+ const p = e, l = Array.isArray(p.children) ? p.children : [], x = document.createTextNode(""), y = document.createTextNode("");
562
+ p.key != null && (x.key = `${p.key}:start`, y.key = `${p.key}:end`), p._startNode = x, p._endNode = y;
563
+ const b = document.createDocumentFragment();
564
+ b.appendChild(x);
565
+ for (const g of l) {
566
+ const u = A(g, t);
567
+ b.appendChild(u);
561
568
  }
562
- return v.appendChild(m), v;
569
+ return b.appendChild(y), b;
563
570
  }
564
571
  const n = document.createElement(e.tag);
565
572
  e.key != null && (n.key = e.key);
566
- const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = be(i, t, n, s), c = {
573
+ const { props: o = {}, attrs: s = {}, directives: i = {} } = e.props ?? {}, a = fe(i, t, n, s), c = {
567
574
  ...o,
568
575
  ...a.props
569
576
  }, f = {
570
577
  ...s,
571
578
  ...a.attrs
572
579
  };
573
- for (const g in f) {
574
- const l = f[g];
575
- typeof l == "boolean" ? l && n.setAttribute(g, "") : l != null && n.setAttribute(g, String(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
+ continue;
585
+ }
586
+ typeof l == "boolean" ? l && n.setAttribute(p, "") : l != null && n.setAttribute(p, l);
576
587
  }
577
- for (const g in c) {
578
- const l = c[g];
579
- if (g === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
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
+ continue;
593
+ }
594
+ if (p === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement))
580
595
  n.value = l ?? "";
581
- else if (g === "checked" && n instanceof HTMLInputElement)
596
+ else if (p === "checked" && n instanceof HTMLInputElement)
582
597
  n.checked = !!l;
583
- else if (g.startsWith("on") && typeof l == "function")
584
- n.addEventListener(g.slice(2).toLowerCase(), l);
598
+ else if (p.startsWith("on") && typeof l == "function")
599
+ n.addEventListener(p.slice(2).toLowerCase(), l);
585
600
  else {
586
- if (g.startsWith("on") && l === void 0)
601
+ if (p.startsWith("on") && l === void 0)
587
602
  continue;
588
- l == null || l === !1 ? n.removeAttribute(g) : n.setAttribute(g, String(l));
603
+ l == null || l === !1 ? n.removeAttribute(p) : n.setAttribute(p, String(l));
589
604
  }
590
605
  }
591
- for (const [g, l] of Object.entries(
606
+ for (const [p, l] of Object.entries(
592
607
  a.listeners || {}
593
608
  ))
594
- n.addEventListener(g, l);
609
+ n.addEventListener(p, l);
595
610
  const h = e.props?.ref ?? (e.props?.props && e.props.props.ref);
596
611
  if (typeof e != "string" && h && r && (r[h] = n), Array.isArray(e.children))
597
- for (const g of e.children)
598
- n.appendChild(L(g, t, r));
612
+ for (const p of e.children)
613
+ n.appendChild(A(p, t, r));
599
614
  else typeof e.children == "string" && (n.textContent = e.children);
600
615
  return n;
601
616
  }
602
- function Oe(e, t, r, n, o) {
617
+ function Ee(e, t, r, n, o) {
603
618
  if (typeof r == "string") {
604
619
  e.textContent !== r && (e.textContent = r);
605
620
  return;
@@ -610,102 +625,102 @@ function Oe(e, t, r, n, o) {
610
625
  x && x.key != null && a.set(x.key, x);
611
626
  const c = /* @__PURE__ */ new Map();
612
627
  for (const x of s) {
613
- const m = x.key;
614
- m != null && c.set(m, x);
628
+ const y = x.key;
629
+ y != null && c.set(y, x);
615
630
  }
616
631
  const f = /* @__PURE__ */ new Set();
617
632
  let h = e.firstChild;
618
- function g(x, m) {
619
- let v = x;
620
- for (; v && (f.add(v), v !== m); )
621
- v = v.nextSibling;
633
+ function p(x, y) {
634
+ let b = x;
635
+ for (; b && (f.add(b), b !== y); )
636
+ b = b.nextSibling;
622
637
  }
623
- function l(x, m, v, p) {
638
+ function l(x, y, b, g) {
624
639
  const u = [];
625
- let y = x.nextSibling;
626
- for (; y && y !== m; )
627
- u.push(y), y = y.nextSibling;
628
- const b = Array.isArray(v) ? v : [];
629
- if (p.some(($) => $ && $.key != null) || b.some(($) => $ && $.key != null)) {
630
- const $ = /* @__PURE__ */ new Map(), w = /* @__PURE__ */ new Map();
631
- for (const C of b)
632
- C && C.key != null && $.set(C.key, C);
633
- for (const C of u) {
634
- const S = C.key;
635
- S != null && w.set(S, C);
640
+ let m = x.nextSibling;
641
+ for (; m && m !== y; )
642
+ u.push(m), m = m.nextSibling;
643
+ const v = Array.isArray(b) ? b : [];
644
+ if (g.some(($) => $ && $.key != null) || v.some(($) => $ && $.key != null)) {
645
+ const $ = /* @__PURE__ */ new Map(), k = /* @__PURE__ */ new Map();
646
+ for (const S of v)
647
+ S && S.key != null && $.set(S.key, S);
648
+ for (const S of u) {
649
+ const C = S.key;
650
+ C != null && k.set(C, S);
636
651
  }
637
- const k = /* @__PURE__ */ new Set();
652
+ const w = /* @__PURE__ */ new Set();
638
653
  let _ = x.nextSibling;
639
- for (const C of p) {
640
- let S;
641
- if (C.key != null && w.has(C.key)) {
642
- const B = $.get(C.key);
643
- S = Q(
644
- w.get(C.key),
645
- B,
646
- C,
654
+ for (const S of g) {
655
+ let C;
656
+ if (S.key != null && k.has(S.key)) {
657
+ const E = $.get(S.key);
658
+ C = H(
659
+ k.get(S.key),
660
+ E,
661
+ S,
647
662
  n
648
- ), k.add(S), S !== _ && e.contains(S) && e.insertBefore(S, _);
663
+ ), w.add(C), C !== _ && e.contains(C) && e.insertBefore(C, _);
649
664
  } else
650
- S = L(C, n), e.insertBefore(S, _), k.add(S);
651
- _ = S.nextSibling;
665
+ C = A(S, n), e.insertBefore(C, _), w.add(C);
666
+ _ = C.nextSibling;
652
667
  }
653
- for (const C of u)
654
- !k.has(C) && e.contains(C) && e.removeChild(C);
668
+ for (const S of u)
669
+ !w.has(S) && e.contains(S) && e.removeChild(S);
655
670
  } else {
656
671
  const $ = Math.min(
657
- b.length,
658
- p.length
672
+ v.length,
673
+ g.length
659
674
  );
660
- for (let w = 0; w < $; w++) {
661
- const k = b[w], _ = p[w], C = Q(u[w], k, _, n);
662
- C !== u[w] && (e.insertBefore(C, u[w]), e.removeChild(u[w]));
675
+ for (let k = 0; k < $; k++) {
676
+ const w = v[k], _ = g[k], S = H(u[k], w, _, n);
677
+ S !== u[k] && (e.insertBefore(S, u[k]), e.removeChild(u[k]));
663
678
  }
664
- for (let w = $; w < p.length; w++)
665
- e.insertBefore(L(p[w], n), m);
666
- for (let w = $; w < u.length; w++)
667
- e.removeChild(u[w]);
679
+ for (let k = $; k < g.length; k++)
680
+ e.insertBefore(A(g[k], n), y);
681
+ for (let k = $; k < u.length; k++)
682
+ e.removeChild(u[k]);
668
683
  }
669
684
  }
670
685
  for (const x of r) {
671
- let m;
686
+ let y;
672
687
  if (x.tag === "#anchor") {
673
- const v = x.key, p = `${v}:start`, u = `${v}:end`;
674
- let y = c.get(p), b = c.get(u);
688
+ const b = x.key, g = `${b}:start`, u = `${b}:end`;
689
+ let m = c.get(g), v = c.get(u);
675
690
  const d = Array.isArray(x.children) ? x.children : [];
676
- if (y || (y = document.createTextNode(""), y.key = p), b || (b = document.createTextNode(""), b.key = u), x._startNode = y, x._endNode = b, !e.contains(y) || !e.contains(b)) {
677
- e.insertBefore(y, h);
691
+ if (m || (m = document.createTextNode(""), m.key = g), v || (v = document.createTextNode(""), v.key = u), x._startNode = m, x._endNode = v, !e.contains(m) || !e.contains(v)) {
692
+ e.insertBefore(m, h);
678
693
  for (const $ of d)
679
- e.insertBefore(L($, n), h);
680
- e.insertBefore(b, h);
694
+ e.insertBefore(A($, n), h);
695
+ e.insertBefore(v, h);
681
696
  } else
682
697
  l(
683
- y,
684
- b,
685
- a.get(v)?.children,
698
+ m,
699
+ v,
700
+ a.get(b)?.children,
686
701
  d
687
702
  );
688
- g(y, b), h = b.nextSibling;
703
+ p(m, v), h = v.nextSibling;
689
704
  continue;
690
705
  }
691
706
  if (x.key != null && c.has(x.key)) {
692
- const v = a.get(x.key);
693
- m = Q(
707
+ const b = a.get(x.key);
708
+ y = H(
694
709
  c.get(x.key),
695
- v,
710
+ b,
696
711
  x,
697
712
  n,
698
713
  o
699
- ), f.add(m), m !== h && e.contains(m) && (h && !e.contains(h) && (h = null), e.insertBefore(m, h));
714
+ ), f.add(y), y !== h && e.contains(y) && (h && !e.contains(h) && (h = null), e.insertBefore(y, h));
700
715
  } else
701
- m = L(x, n, o), h && !e.contains(h) && (h = null), e.insertBefore(m, h), f.add(m);
702
- h = m.nextSibling;
716
+ y = A(x, n, o), h && !e.contains(h) && (h = null), e.insertBefore(y, h), f.add(y);
717
+ h = y.nextSibling;
703
718
  }
704
719
  for (const x of s)
705
- !f.has(x) && e.contains(x) && (M(x, o), e.removeChild(x));
720
+ !f.has(x) && e.contains(x) && (j(x, o), e.removeChild(x));
706
721
  }
707
- function Q(e, t, r, n, o) {
708
- if (t && typeof t != "string" && t.props?.ref && o && M(e, o), t === r) return e;
722
+ function H(e, t, r, n, o) {
723
+ if (t && typeof t != "string" && t.props?.ref && o && j(e, o), t === r) return e;
709
724
  if (typeof r == "string") {
710
725
  if (e.nodeType === Node.TEXT_NODE)
711
726
  return e.textContent !== r && (e.textContent = r), e;
@@ -719,20 +734,20 @@ function Q(e, t, r, n, o) {
719
734
  i.key != null && (c.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = c, i._endNode = f;
720
735
  const h = document.createDocumentFragment();
721
736
  h.appendChild(c);
722
- for (const g of a) {
723
- const l = L(g, n);
737
+ for (const p of a) {
738
+ const l = A(p, n);
724
739
  h.appendChild(l);
725
740
  }
726
741
  return h.appendChild(f), e.parentNode?.replaceChild(h, e), c;
727
742
  }
728
743
  if (!r) {
729
- M(e, o);
744
+ j(e, o);
730
745
  const i = document.createComment("removed");
731
746
  return e.parentNode?.replaceChild(i, e), i;
732
747
  }
733
748
  if (!t || typeof t == "string") {
734
- M(e, o);
735
- const i = L(r, n, o);
749
+ j(e, o);
750
+ const i = A(r, n, o);
736
751
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), e.parentNode?.replaceChild(i, e), i;
737
752
  }
738
753
  if (r.tag === "#anchor") {
@@ -741,52 +756,52 @@ function Q(e, t, r, n, o) {
741
756
  const f = document.createDocumentFragment();
742
757
  f.appendChild(a);
743
758
  for (const h of i)
744
- f.appendChild(L(h, n));
759
+ f.appendChild(A(h, n));
745
760
  return f.appendChild(c), e.parentNode?.replaceChild(f, e), a;
746
761
  }
747
762
  if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
748
763
  const i = e;
749
- return Me(i, t.props || {}, r.props || {}, n), Oe(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
764
+ return Ce(i, t.props || {}, r.props || {}, n), Ee(i, t.children, r.children, n, o), typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = i), i;
750
765
  }
751
- M(e, o);
752
- const s = L(r, n, o);
766
+ j(e, o);
767
+ const s = A(r, n, o);
753
768
  return typeof r != "string" && r.props?.ref && o && (o[r.props.ref] = s), e.parentNode?.replaceChild(s, e), s;
754
769
  }
755
- function Pe(e, t, r, n) {
770
+ function Ae(e, t, r, n) {
756
771
  let o;
757
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 = {
758
773
  tag: "div",
759
774
  key: "__anchor_root__",
760
775
  props: { attrs: { "data-anchor-block-root": "", key: "__anchor_root__" } },
761
776
  children: [o]
762
- }), o = se(o, String(o.key ?? "root"));
777
+ }), o = G(o, String(o.key ?? "root"));
763
778
  const s = e._prevVNode ?? null, i = e._prevDom ?? e.firstChild ?? null;
764
779
  let a;
765
- s && i ? typeof s != "string" && typeof o != "string" && s.tag === o.tag && s.key === o.key ? a = Q(i, s, o, r, n) : (a = L(o, r, n), e.replaceChild(a, i)) : (a = L(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 = H(i, s, o, r, n) : (a = A(o, r, n), e.replaceChild(a, i)) : (a = A(o, r, n), e.firstChild ? e.replaceChild(a, e.firstChild) : e.appendChild(a));
766
781
  const c = [];
767
782
  for (let f = 0; f < e.childNodes.length; f++) {
768
783
  const h = e.childNodes[f];
769
- h !== a && h.nodeName !== "STYLE" && (M(h, n), c.push(h));
784
+ h !== a && h.nodeName !== "STYLE" && (j(h, n), c.push(h));
770
785
  }
771
786
  c.forEach((f) => e.removeChild(f)), e._prevVNode = o, e._prevDom = a;
772
787
  }
773
- function ve(e, ...t) {
788
+ function ue(e, ...t) {
774
789
  let r = "";
775
790
  for (let n = 0; n < e.length; n++)
776
791
  r += e[n], n < t.length && (r += t[n]);
777
792
  return r;
778
793
  }
779
- function xe(e) {
794
+ function de(e) {
780
795
  return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
781
796
  }
782
- let U = null;
783
- function ue() {
784
- return U || (U = new CSSStyleSheet(), U.replaceSync(xe(De))), U;
797
+ let W = null;
798
+ function ne() {
799
+ return W || (W = new CSSStyleSheet(), W.replaceSync(de(Le))), W;
785
800
  }
786
- function We(e) {
801
+ function Te(e) {
787
802
  return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
788
803
  }
789
- const De = ve`
804
+ const Le = ue`
790
805
  :host, *, ::before, ::after {
791
806
  all: isolate;
792
807
  box-sizing: border-box;
@@ -844,7 +859,7 @@ const De = ve`
844
859
  sup { top: -.5em }
845
860
  [disabled], [aria-disabled=true] { cursor: not-allowed }
846
861
  [hidden] { display: none }
847
- `, He = {
862
+ `, je = {
848
863
  gray: {
849
864
  50: "var(--color-gray-50, #f9fafb)",
850
865
  100: "var(--color-gray-100, #f3f4f6)",
@@ -979,7 +994,7 @@ const De = ve`
979
994
  },
980
995
  white: { DEFAULT: "var(--color-white, #ffffff)" },
981
996
  black: { DEFAULT: "var(--color-black, #000000)" }
982
- }, G = {
997
+ }, K = {
983
998
  /* Display */
984
999
  block: "display:block;",
985
1000
  inline: "display:inline;",
@@ -1152,8 +1167,15 @@ const De = ve`
1152
1167
  /* Transition Delay/Property */
1153
1168
  "transition-colors": "transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;",
1154
1169
  "transition-opacity": "transition-property:opacity;",
1155
- "transition-transform": "transition-property:transform;"
1156
- }, qe = "0.25rem", de = {
1170
+ "transition-transform": "transition-property:transform;",
1171
+ /* Z-index */
1172
+ "z-0": "z-index:0;",
1173
+ "z-10": "z-index:10;",
1174
+ "z-20": "z-index:20;",
1175
+ "z-30": "z-index:30;",
1176
+ "z-40": "z-index:40;",
1177
+ "z-50": "z-index:50;"
1178
+ }, ze = "0.25rem", oe = {
1157
1179
  m: ["margin"],
1158
1180
  mx: ["margin-inline"],
1159
1181
  my: ["margin-block"],
@@ -1184,7 +1206,7 @@ const De = ve`
1184
1206
  gap: ["gap"],
1185
1207
  "gap-x": ["column-gap"],
1186
1208
  "gap-y": ["row-gap"]
1187
- }, Ie = {
1209
+ }, Re = {
1188
1210
  // State variants
1189
1211
  before: (e, t) => `${e}::before{${t}}`,
1190
1212
  after: (e, t) => `${e}::after{${t}}`,
@@ -1210,7 +1232,7 @@ const De = ve`
1210
1232
  "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1211
1233
  "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1212
1234
  "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1213
- }, pe = {
1235
+ }, ie = {
1214
1236
  // Responsive
1215
1237
  sm: "(min-width:640px)",
1216
1238
  md: "(min-width:768px)",
@@ -1219,23 +1241,23 @@ const De = ve`
1219
1241
  "2xl": "(min-width:1536px)",
1220
1242
  // Dark mode (now plain string)
1221
1243
  dark: "(prefers-color-scheme: dark)"
1222
- }, ee = ["sm", "md", "lg", "xl", "2xl"];
1223
- function te(e) {
1244
+ }, U = ["sm", "md", "lg", "xl", "2xl"];
1245
+ function V(e) {
1224
1246
  const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
1225
1247
  if (n.length < 2) return null;
1226
1248
  const o = n.slice(0, -1).join("-"), s = n[n.length - 1], i = parseFloat(s);
1227
- if (Number.isNaN(i) || !de[o]) return null;
1249
+ if (Number.isNaN(i) || !oe[o]) return null;
1228
1250
  const a = t ? "-" : "";
1229
- return de[o].map((c) => `${c}:calc(${a}${qe} * ${i});`).join("");
1251
+ return oe[o].map((c) => `${c}:calc(${a}${ze} * ${i});`).join("");
1230
1252
  }
1231
- function he(e) {
1253
+ function se(e) {
1232
1254
  const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, o = r >> 8 & 255, s = r & 255;
1233
1255
  return `${n} ${o} ${s}`;
1234
1256
  }
1235
- function Fe(e) {
1257
+ function Be(e) {
1236
1258
  const t = /^(bg|text|border|decoration|shadow|outline|caret|accent|fill|stroke)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1237
1259
  if (!t) return null;
1238
- const [, r, n, o = "DEFAULT"] = t, s = He[n]?.[o];
1260
+ const [, r, n, o = "DEFAULT"] = t, s = je[n]?.[o];
1239
1261
  return s ? `${{
1240
1262
  bg: "background-color",
1241
1263
  decoration: "text-decoration-color",
@@ -1250,35 +1272,41 @@ function Fe(e) {
1250
1272
  stroke: "stroke-color"
1251
1273
  }[r]}:${s};` : null;
1252
1274
  }
1253
- function Ke(e) {
1275
+ function Ne(e) {
1254
1276
  const [t, r] = e.split("/");
1255
1277
  if (!r) return { base: t };
1256
1278
  const n = parseInt(r, 10);
1257
1279
  return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
1258
1280
  }
1259
- function re(e) {
1260
- const { base: t, opacity: r } = Ke(e), n = Fe(t);
1281
+ function J(e) {
1282
+ const { base: t, opacity: r } = Ne(e), n = Be(t);
1261
1283
  if (n) {
1262
1284
  if (r !== void 0) {
1263
1285
  const s = /#([0-9a-f]{6})/i.exec(n);
1264
1286
  if (s) {
1265
- const i = he(s[0]);
1287
+ const i = se(s[0]);
1266
1288
  return n.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1267
1289
  }
1268
1290
  }
1269
1291
  return n;
1270
1292
  }
1271
- const o = Z(t);
1293
+ const o = q(t);
1272
1294
  if (o && r !== void 0) {
1273
1295
  const s = /#([0-9a-f]{6})/i.exec(o);
1274
1296
  if (s) {
1275
- const i = he(s[0]);
1297
+ const i = se(s[0]);
1276
1298
  return o.replace(/#([0-9a-f]{6})/i, `rgb(${i} / ${r})`);
1277
1299
  }
1278
1300
  }
1279
1301
  return o;
1280
1302
  }
1281
- function Z(e) {
1303
+ function Q(e) {
1304
+ const t = /^opacity-(\d{1,3})$/.exec(e);
1305
+ if (!t) return null;
1306
+ const r = parseInt(t[1], 10);
1307
+ return r < 0 || r > 100 ? null : `opacity:${r / 100};`;
1308
+ }
1309
+ function q(e) {
1282
1310
  const t = e.indexOf("-["), r = e.endsWith("]");
1283
1311
  if (t > 0 && r) {
1284
1312
  const n = e.slice(0, t);
@@ -1328,13 +1356,13 @@ function Z(e) {
1328
1356
  }
1329
1357
  return null;
1330
1358
  }
1331
- function Ve(e) {
1359
+ function Me(e) {
1332
1360
  return e.startsWith("[") && e.endsWith("]") ? e : e.indexOf("-[") > 0 && e.endsWith("]") ? e.replace(/_/g, "-") : null;
1333
1361
  }
1334
- function Ue(e) {
1362
+ function Oe(e) {
1335
1363
  return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1336
1364
  }
1337
- function Je(e) {
1365
+ function Pe(e) {
1338
1366
  const t = /class\s*=\s*["']([^"']+)["']/g, r = [];
1339
1367
  let n;
1340
1368
  for (; n = t.exec(e); ) {
@@ -1343,100 +1371,100 @@ function Je(e) {
1343
1371
  }
1344
1372
  return r.filter(Boolean);
1345
1373
  }
1346
- const ge = /* @__PURE__ */ new Map(), Qe = 16;
1347
- function Ze(e) {
1348
- const t = Date.now(), r = ge.get(e);
1349
- if (r && t - r.timestamp < Qe) return r.css;
1350
- const n = Je(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1351
- function h(m, v = !1) {
1352
- const p = (v ? "dark|" : "") + m;
1353
- if (p in f) return f[p];
1354
- const u = l(m, v);
1355
- return f[p] = u, u;
1356
- }
1357
- function g(m) {
1358
- const v = m.some((u) => ee.includes(u)), p = m.includes("dark");
1359
- return m.length === 0 ? 1 : !v && !p ? 2 : v && !p ? 3 : 4;
1360
- }
1361
- function l(m, v = !1) {
1362
- const p = m.split(":"), u = p.find(
1363
- (S) => G[S] || te(S) || re(S) || Z(S)
1374
+ const ae = /* @__PURE__ */ new Map(), We = 16;
1375
+ function De(e) {
1376
+ const t = Date.now(), r = ae.get(e);
1377
+ if (r && t - r.timestamp < We) return r.css;
1378
+ const n = Pe(e), o = new Set(n), s = [], i = [], a = [], c = [], f = {};
1379
+ function h(y, b = !1) {
1380
+ const g = (b ? "dark|" : "") + y;
1381
+ if (g in f) return f[g];
1382
+ const u = l(y, b);
1383
+ return f[g] = u, u;
1384
+ }
1385
+ function p(y) {
1386
+ const b = y.some((u) => U.includes(u)), g = y.includes("dark");
1387
+ return y.length === 0 ? 1 : !b && !g ? 2 : b && !g ? 3 : 4;
1388
+ }
1389
+ function l(y, b = !1) {
1390
+ const g = y.split(":"), u = g.find(
1391
+ (C) => K[C] || V(C) || Q(C) || J(C) || q(C)
1364
1392
  );
1365
1393
  if (!u) return null;
1366
- const y = G[u] ?? te(u) ?? re(u) ?? Z(u);
1367
- if (!y) return null;
1368
- let b = `.${Ue(m)}`, d = y;
1369
- const $ = p.indexOf(u);
1370
- let w = $ >= 0 ? p.slice(0, $) : [];
1371
- v && (w = w.filter((S) => S !== "dark"));
1372
- const k = w.filter((S) => ee.includes(S)), _ = k.length ? k[k.length - 1] : null;
1373
- for (const S of w) {
1374
- const B = Ve(S);
1375
- if (B) {
1376
- b = `${B}${b}`;
1394
+ const m = K[u] ?? V(u) ?? Q(u) ?? J(u) ?? q(u);
1395
+ if (!m) return null;
1396
+ let v = `.${Oe(y)}`, d = m;
1397
+ const $ = g.indexOf(u);
1398
+ let k = $ >= 0 ? g.slice(0, $) : [];
1399
+ b && (k = k.filter((C) => C !== "dark"));
1400
+ const w = k.filter((C) => U.includes(C)), _ = w.length ? w[w.length - 1] : null;
1401
+ for (const C of k) {
1402
+ const E = Me(C);
1403
+ if (E) {
1404
+ v = `${E}${v}`;
1377
1405
  continue;
1378
1406
  }
1379
- if (ee.includes(S)) continue;
1380
- const E = Ie[S];
1381
- typeof E == "function" && (b = E(b, d).replace(/\{.*$/, ""));
1407
+ if (U.includes(C)) continue;
1408
+ const L = Re[C];
1409
+ typeof L == "function" && (v = L(v, d).replace(/\{.*$/, ""));
1382
1410
  }
1383
- let C = `${b}{${d}}`;
1384
- return v && _ ? C = `@media (prefers-color-scheme: dark) and ${pe[_]}{${C}}` : v ? C = `@media (prefers-color-scheme: dark){${C}}` : _ && (C = `@media ${pe[_]}{${C}}`), C;
1411
+ let S = `${v}{${d}}`;
1412
+ return b && _ ? S = `@media (prefers-color-scheme: dark) and ${ie[_]}{${S}}` : b ? S = `@media (prefers-color-scheme: dark){${S}}` : _ && (S = `@media ${ie[_]}{${S}}`), S;
1385
1413
  }
1386
- for (const m of o) {
1387
- const v = m.split(":"), p = v.find(
1388
- (d) => G[d] || te(d) || re(d) || Z(d)
1414
+ for (const y of o) {
1415
+ const b = y.split(":"), g = b.find(
1416
+ (d) => K[d] || V(d) || Q(d) || J(d) || q(d)
1389
1417
  );
1390
- if (!p) continue;
1391
- const u = v.indexOf(p), y = u >= 0 ? v.slice(0, u) : [], b = g(y);
1392
- if (b === 4) {
1393
- const d = h(m, !0);
1418
+ if (!g) continue;
1419
+ const u = b.indexOf(g), m = u >= 0 ? b.slice(0, u) : [], v = p(m);
1420
+ if (v === 4) {
1421
+ const d = h(y, !0);
1394
1422
  d && c.push(d);
1395
1423
  } else {
1396
- const d = h(m);
1397
- d && (b === 1 ? s.push(d) : b === 2 ? i.push(d) : b === 3 && a.push(d));
1424
+ const d = h(y);
1425
+ d && (v === 1 ? s.push(d) : v === 2 ? i.push(d) : v === 3 && a.push(d));
1398
1426
  }
1399
1427
  }
1400
1428
  const x = [...s, ...i, ...a, ...c].join("");
1401
- return ge.set(e, { css: x, timestamp: t }), x;
1429
+ return ae.set(e, { css: x, timestamp: t }), x;
1402
1430
  }
1403
- const F = [];
1404
- function Xe(e, t, r, n, o, s, i, a) {
1431
+ const O = [];
1432
+ function He(e, t, r, n, o, s, i, a) {
1405
1433
  if (e) {
1406
- F.push(r);
1434
+ O.push(r);
1407
1435
  try {
1408
1436
  if (t.loadingTemplate && r.isLoading) {
1409
- P(e, t.loadingTemplate(r), r, n, o);
1437
+ R(e, t.loadingTemplate(r), r, n, o);
1410
1438
  return;
1411
1439
  }
1412
1440
  if (t.errorTemplate && r.hasError) {
1413
- r.error instanceof Error && P(e, t.errorTemplate(r.error, r), r, n, o);
1441
+ r.error instanceof Error && R(e, t.errorTemplate(r.error, r), r, n, o);
1414
1442
  return;
1415
1443
  }
1416
1444
  const c = t.render(r);
1417
1445
  if (c instanceof Promise) {
1418
1446
  s(!0), c.then((f) => {
1419
- s(!1), i(null), P(e, f, r, n, o), a(e.innerHTML);
1447
+ s(!1), i(null), R(e, f, r, n, o), a(e.innerHTML);
1420
1448
  }).catch((f) => {
1421
- s(!1), i(f), t.errorTemplate && P(e, t.errorTemplate(f, r), r, n, o);
1422
- }), t.loadingTemplate && P(e, t.loadingTemplate(r), r, n, o);
1449
+ s(!1), i(f), t.errorTemplate && R(e, t.errorTemplate(f, r), r, n, o);
1450
+ }), t.loadingTemplate && R(e, t.loadingTemplate(r), r, n, o);
1423
1451
  return;
1424
1452
  }
1425
- P(e, c, r, n, o), a(e.innerHTML);
1453
+ R(e, c, r, n, o), a(e.innerHTML);
1426
1454
  } finally {
1427
- F.pop();
1455
+ O.pop();
1428
1456
  }
1429
1457
  }
1430
1458
  }
1431
- function P(e, t, r, n, o) {
1432
- e && (Pe(
1459
+ function R(e, t, r, n, o) {
1460
+ e && (Ae(
1433
1461
  e,
1434
1462
  Array.isArray(t) ? t : [t],
1435
1463
  r,
1436
1464
  n
1437
1465
  ), o(e.innerHTML));
1438
1466
  }
1439
- function Ye(e, t, r, n, o, s, i) {
1467
+ function qe(e, t, r, n, o, s, i) {
1440
1468
  if (s !== null && clearTimeout(s), Date.now() - t < 16) {
1441
1469
  if (o(r + 1), r > 10) {
1442
1470
  console.warn("Potential infinite render loop detected. Skipping render."), i(null);
@@ -1449,32 +1477,32 @@ function Ye(e, t, r, n, o, s, i) {
1449
1477
  }, 0);
1450
1478
  i(c);
1451
1479
  }
1452
- function Ge(e, t, r, n, o, s) {
1480
+ function Ie(e, t, r, n, o, s) {
1453
1481
  if (!e) return;
1454
- const i = Ze(n);
1482
+ const i = De(n);
1455
1483
  if (!t.style && (!i || i.trim() === "")) {
1456
- s(null), e.adoptedStyleSheets = [ue()];
1484
+ s(null), e.adoptedStyleSheets = [ne()];
1457
1485
  return;
1458
1486
  }
1459
1487
  let a = "";
1460
1488
  t.style && (typeof t.style == "string" ? a = t.style : typeof t.style == "function" && (a = t.style(r)));
1461
- let c = We(`${a}
1489
+ let c = Te(`${a}
1462
1490
  ${i}
1463
1491
  `);
1464
- c = xe(c);
1492
+ c = de(c);
1465
1493
  let f = o;
1466
- f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [ue(), f], s(f);
1494
+ f || (f = new CSSStyleSheet()), (f.cssRules.length === 0 || f.toString() !== c) && f.replaceSync(c), e.adoptedStyleSheets = [ne(), f], s(f);
1467
1495
  }
1468
- const et = /* @__PURE__ */ new Map();
1469
- function ye(e, t, r) {
1470
- let n = ae(e);
1496
+ const Fe = /* @__PURE__ */ new Map();
1497
+ function le(e, t, r) {
1498
+ let n = ee(e);
1471
1499
  n.includes("-") || (n = `cer-${n}`);
1472
1500
  let o;
1473
1501
  typeof t == "function" ? o = { ...r, render: t } : o = t, typeof o.onError != "function" && (o.onError = (s, i) => {
1474
1502
  console.error(`[${n}] Error:`, s, i);
1475
- }), et.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, tt(o));
1503
+ }), Fe.set(n, o), typeof window < "u" && !customElements.get(n) && customElements.define(n, Ke(o));
1476
1504
  }
1477
- function tt(e) {
1505
+ function Ke(e) {
1478
1506
  if (!e.render)
1479
1507
  throw new Error(
1480
1508
  "Component must have a render function"
@@ -1561,7 +1589,7 @@ function tt(e) {
1561
1589
  }
1562
1590
  connectedCallback() {
1563
1591
  this._runLogicWithinErrorBoundary(e, () => {
1564
- Ae(
1592
+ be(
1565
1593
  e,
1566
1594
  this.context,
1567
1595
  this._mounted,
@@ -1573,7 +1601,7 @@ function tt(e) {
1573
1601
  }
1574
1602
  disconnectedCallback() {
1575
1603
  this._runLogicWithinErrorBoundary(e, () => {
1576
- Te(
1604
+ ve(
1577
1605
  e,
1578
1606
  this.context,
1579
1607
  this._listeners,
@@ -1597,7 +1625,7 @@ function tt(e) {
1597
1625
  }
1598
1626
  attributeChangedCallback(t, r, n) {
1599
1627
  this._runLogicWithinErrorBoundary(e, () => {
1600
- this._applyProps(e), je(
1628
+ this._applyProps(e), xe(
1601
1629
  e,
1602
1630
  t,
1603
1631
  r,
@@ -1607,7 +1635,7 @@ function tt(e) {
1607
1635
  });
1608
1636
  }
1609
1637
  static get observedAttributes() {
1610
- return e.props ? Object.keys(e.props).map(ae) : [];
1638
+ return e.props ? Object.keys(e.props).map(ee) : [];
1611
1639
  }
1612
1640
  _applyComputed(t) {
1613
1641
  this._runLogicWithinErrorBoundary(e, () => {
@@ -1615,7 +1643,7 @@ function tt(e) {
1615
1643
  Object.defineProperty(this.context, r, {
1616
1644
  get: () => {
1617
1645
  const o = n(this.context);
1618
- return oe(o);
1646
+ return X(o);
1619
1647
  },
1620
1648
  enumerable: !0
1621
1649
  });
@@ -1625,7 +1653,7 @@ function tt(e) {
1625
1653
  // --- Render ---
1626
1654
  _render(t) {
1627
1655
  this._runLogicWithinErrorBoundary(t, () => {
1628
- Xe(
1656
+ He(
1629
1657
  this.shadowRoot,
1630
1658
  t,
1631
1659
  this.context,
@@ -1648,7 +1676,7 @@ function tt(e) {
1648
1676
  }
1649
1677
  _requestRender() {
1650
1678
  this._runLogicWithinErrorBoundary(this._cfg, () => {
1651
- Ye(
1679
+ qe(
1652
1680
  () => this._render(this._cfg),
1653
1681
  this._lastRenderTime,
1654
1682
  this._renderCount,
@@ -1668,7 +1696,7 @@ function tt(e) {
1668
1696
  // --- Style ---
1669
1697
  _applyStyle(t, r) {
1670
1698
  this._runLogicWithinErrorBoundary(t, () => {
1671
- Ge(
1699
+ Ie(
1672
1700
  this.shadowRoot,
1673
1701
  t,
1674
1702
  this.context,
@@ -1707,8 +1735,8 @@ function tt(e) {
1707
1735
  "splice",
1708
1736
  "sort",
1709
1737
  "reverse"
1710
- ].includes(a) ? function(...g) {
1711
- const l = f.apply(i, g);
1738
+ ].includes(a) ? function(...p) {
1739
+ const l = f.apply(i, p);
1712
1740
  if (!n._initializing) {
1713
1741
  const x = s || "root";
1714
1742
  n._triggerWatchers(x, i), n._render(t);
@@ -1754,7 +1782,7 @@ function tt(e) {
1754
1782
  }
1755
1783
  _initWatchers(t) {
1756
1784
  this._runLogicWithinErrorBoundary(t, () => {
1757
- _e(
1785
+ ge(
1758
1786
  this.context,
1759
1787
  this._watchers,
1760
1788
  t.watch || {}
@@ -1762,12 +1790,12 @@ function tt(e) {
1762
1790
  });
1763
1791
  }
1764
1792
  _triggerWatchers(t, r) {
1765
- Ce(this.context, this._watchers, t, r);
1793
+ ye(this.context, this._watchers, t, r);
1766
1794
  }
1767
1795
  _applyProps(t) {
1768
1796
  this._runLogicWithinErrorBoundary(t, () => {
1769
1797
  try {
1770
- Ee(this, t, this.context);
1798
+ me(this, t, this.context);
1771
1799
  } catch (r) {
1772
1800
  this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(r, this.context));
1773
1801
  }
@@ -1775,70 +1803,65 @@ function tt(e) {
1775
1803
  }
1776
1804
  };
1777
1805
  }
1778
- function I(e, t = {}, r, n) {
1806
+ function M(e, t = {}, r, n) {
1779
1807
  const o = n ?? t.key;
1780
1808
  return { tag: e, key: o, props: t, children: r };
1781
1809
  }
1782
- function X(e) {
1810
+ function I(e) {
1783
1811
  return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
1784
1812
  }
1785
- function J(e) {
1786
- return typeof e == "object" && e !== null && "tag" in e && !X(e);
1813
+ function D(e) {
1814
+ return typeof e == "object" && e !== null && "tag" in e && !I(e);
1787
1815
  }
1788
- function rt(e, t) {
1816
+ function Ue(e, t) {
1789
1817
  return e.key != null ? e : { ...e, key: t };
1790
1818
  }
1791
- function nt(e, t = [], r = {}) {
1819
+ function Ve(e, t = [], r = {}) {
1792
1820
  const n = {}, o = {}, s = {}, i = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
1793
1821
  let a;
1794
1822
  for (; a = i.exec(e); ) {
1795
- const c = a[1], f = a[2], h = (a[4] || a[6]) ?? "", g = h.match(/^{{(\d+)}}$/);
1796
- let l = g ? t[Number(g[1])] ?? null : h;
1797
- if (g || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l))), c === ":" && f === "class" || c === "#") {
1798
- const [x, ...m] = f.split("."), v = [...m];
1799
- let p = l, u = [...v];
1800
- if (x === "model" && typeof p == "string" && p.includes(".")) {
1801
- const y = ["trim", "number", "lazy"], b = p.split(".");
1802
- let d = p;
1803
- const $ = [];
1804
- for (let w = b.length - 1; w > 0 && y.includes(b[w]); w--)
1805
- $.unshift(b[w]), d = b.slice(0, w).join(".");
1806
- p = d, u.push(...$);
1807
- }
1808
- s[x] = {
1809
- value: p,
1810
- modifiers: u
1811
- };
1812
- } else if (c === ":")
1813
- typeof l == "boolean" ? o[f] = l : l != null && (typeof r[l] < "u" ? n[f] = r[l] : n[f] = l);
1814
- else if (c === "@") {
1815
- const x = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1816
- n[x] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1823
+ const c = a[1], f = a[2], h = (a[4] || a[6]) ?? "", p = h.match(/^{{(\d+)}}$/);
1824
+ let l = p ? t[Number(p[1])] ?? null : h;
1825
+ p || (l === "true" ? l = !0 : l === "false" ? l = !1 : l === "null" ? l = null : isNaN(Number(l)) || (l = Number(l)));
1826
+ const x = ["model", "bind", "show", "class", "style"];
1827
+ if (c === ":") {
1828
+ const [y, ...b] = f.split(".");
1829
+ if (x.includes(y)) {
1830
+ const g = [...b];
1831
+ s[y] = {
1832
+ value: l,
1833
+ modifiers: g
1834
+ };
1835
+ } else
1836
+ o[f] = l;
1837
+ } else if (c === "@") {
1838
+ const y = "on" + f.charAt(0).toUpperCase() + f.slice(1);
1839
+ n[y] = typeof l == "function" ? l : typeof r[l] == "function" ? r[l] : void 0;
1817
1840
  } else f === "ref" ? n.ref = l : o[f] = l;
1818
1841
  }
1819
1842
  return { props: n, attrs: o, directives: s };
1820
1843
  }
1821
- function ot(e, t, r) {
1822
- const n = F.length > 0 ? F[F.length - 1] : void 0, o = r ?? n;
1844
+ function Je(e, t, r) {
1845
+ const n = O.length > 0 ? O[O.length - 1] : void 0, o = r ?? n;
1823
1846
  function s(d, $) {
1824
- return I("#text", {}, d, $);
1847
+ return M("#text", {}, d, $);
1825
1848
  }
1826
1849
  let i = "";
1827
1850
  for (let d = 0; d < e.length; d++)
1828
1851
  i += e[d], d < t.length && (i += `{{${d}}}`);
1829
1852
  const a = /<\/?([a-zA-Z0-9-]+)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|[^\s>]+))?)*)\s*\/?>|{{(\d+)}}|([^<]+)/g, c = [];
1830
- let f, h = [], g = null, l = {}, x, m = 0, v = [];
1831
- function p(d) {
1832
- !d || typeof d != "object" || X(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(($) => {
1853
+ let f, h = [], p = null, l = {}, x, y = 0, b = [];
1854
+ function g(d) {
1855
+ !d || typeof d != "object" || I(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(($) => {
1833
1856
  if ($ === "style" && l.attrs.style) {
1834
- const w = l.attrs.style.replace(
1857
+ const k = l.attrs.style.replace(
1835
1858
  /;?\s*$/,
1836
1859
  ""
1837
- ), k = d.attrs.style.replace(/^;?\s*/, "");
1838
- l.attrs.style = w + "; " + k;
1860
+ ), w = d.attrs.style.replace(/^;?\s*/, "");
1861
+ l.attrs.style = k + "; " + w;
1839
1862
  } else if ($ === "class" && l.attrs.class) {
1840
- const w = l.attrs.class.trim().split(/\s+/).filter(Boolean), k = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1841
- .../* @__PURE__ */ new Set([...w, ...k])
1863
+ const k = l.attrs.class.trim().split(/\s+/).filter(Boolean), w = d.attrs.class.trim().split(/\s+/).filter(Boolean), _ = [
1864
+ .../* @__PURE__ */ new Set([...k, ...w])
1842
1865
  ];
1843
1866
  l.attrs.class = _.join(" ");
1844
1867
  } else
@@ -1846,36 +1869,36 @@ function ot(e, t, r) {
1846
1869
  }))) : (l.props || (l.props = {}), Object.assign(l.props, d)));
1847
1870
  }
1848
1871
  function u(d, $) {
1849
- const w = g ? h : v;
1850
- if (X(d)) {
1851
- const k = d.key ?? $;
1872
+ const k = p ? h : b;
1873
+ if (I(d)) {
1874
+ const w = d.key ?? $;
1852
1875
  let _ = d.children;
1853
- w.push({
1876
+ k.push({
1854
1877
  ...d,
1855
- key: k,
1878
+ key: w,
1856
1879
  children: _
1857
1880
  });
1858
1881
  return;
1859
1882
  }
1860
- if (J(d)) {
1861
- w.push(rt(d, void 0));
1883
+ if (D(d)) {
1884
+ k.push(Ue(d, void 0));
1862
1885
  return;
1863
1886
  }
1864
1887
  if (Array.isArray(d)) {
1865
1888
  if (d.length === 0) return;
1866
- for (let k = 0; k < d.length; k++) {
1867
- const _ = d[k];
1868
- X(_) || J(_) || Array.isArray(_) ? u(_, `${$}-${k}`) : _ !== null && typeof _ == "object" ? p(_) : w.push(s(String(_), `${$}-${k}`));
1889
+ for (let w = 0; w < d.length; w++) {
1890
+ const _ = d[w];
1891
+ I(_) || D(_) || Array.isArray(_) ? u(_, `${$}-${w}`) : _ !== null && typeof _ == "object" ? g(_) : k.push(s(String(_), `${$}-${w}`));
1869
1892
  }
1870
1893
  return;
1871
1894
  }
1872
1895
  if (d !== null && typeof d == "object") {
1873
- p(d);
1896
+ g(d);
1874
1897
  return;
1875
1898
  }
1876
- w.push(s(String(d), $));
1899
+ k.push(s(String(d), $));
1877
1900
  }
1878
- const y = /* @__PURE__ */ new Set([
1901
+ const m = /* @__PURE__ */ new Set([
1879
1902
  "area",
1880
1903
  "base",
1881
1904
  "br",
@@ -1893,133 +1916,52 @@ function ot(e, t, r) {
1893
1916
  ]);
1894
1917
  for (; f = a.exec(i); )
1895
1918
  if (f[1]) {
1896
- const d = f[1], $ = f[0][1] === "/", w = f[0][f[0].length - 2] === "/" || y.has(d), {
1897
- props: k,
1919
+ const d = f[1], $ = f[0][1] === "/", k = f[0][f[0].length - 2] === "/" || m.has(d), {
1920
+ props: w,
1898
1921
  attrs: _,
1899
- directives: C
1900
- } = nt(f[2] || "", t, o), S = { props: {}, attrs: {} };
1901
- for (const E in k) S.props[E] = k[E];
1902
- for (const E in _) S.attrs[E] = _[E];
1903
- for (const [E, T] of Object.entries(C)) {
1904
- if (E === "bind")
1905
- if (typeof T.value == "object" && T.value !== null)
1906
- for (const [A, j] of Object.entries(T.value))
1907
- typeof j == "boolean" ? S.attrs[A] = j : j != null && (S.attrs[A] = String(j));
1908
- else T.value != null && (S.attrs[E] = String(T.value));
1909
- if (["show", "class", "style"].includes(E) && (S.directives || (S.directives = {}), S.directives[E] = T), E === "show") {
1910
- const A = !!T.value;
1911
- S.attrs.style = (S.attrs.style || "") + (A ? "" : "; display: none !important");
1912
- } else if (E === "class") {
1913
- const A = T.value;
1914
- let j = [];
1915
- if (typeof A == "string")
1916
- j = A.split(/\s+/).filter(Boolean);
1917
- else if (Array.isArray(A)) {
1918
- for (const R of A)
1919
- if (typeof R == "string")
1920
- j.push(...R.split(/\s+/).filter(Boolean));
1921
- else if (R && typeof R == "object")
1922
- for (const [N, V] of Object.entries(R))
1923
- V && j.push(...N.split(/\s+/).filter(Boolean));
1924
- } else if (A && typeof A == "object")
1925
- for (const [R, N] of Object.entries(A))
1926
- N && j.push(...R.split(/\s+/).filter(Boolean));
1927
- const H = S.attrs.class || "", q = [
1928
- .../* @__PURE__ */ new Set([
1929
- ...H.split(/\s+/).filter(Boolean),
1930
- ...j
1931
- ])
1932
- ];
1933
- S.attrs.class = q.join(" ");
1934
- } else if (E === "style") {
1935
- const A = T.value;
1936
- let j = "";
1937
- if (typeof A == "string")
1938
- j = A;
1939
- else if (A && typeof A == "object") {
1940
- const q = [];
1941
- for (const [R, N] of Object.entries(A))
1942
- if (N != null && N !== "") {
1943
- const V = R.replace(
1944
- /[A-Z]/g,
1945
- (ke) => `-${ke.toLowerCase()}`
1946
- ), we = [
1947
- "width",
1948
- "height",
1949
- "top",
1950
- "right",
1951
- "bottom",
1952
- "left",
1953
- "margin",
1954
- "margin-top",
1955
- "margin-right",
1956
- "margin-bottom",
1957
- "margin-left",
1958
- "padding",
1959
- "padding-top",
1960
- "padding-right",
1961
- "padding-bottom",
1962
- "padding-left",
1963
- "font-size",
1964
- "line-height",
1965
- "border-width",
1966
- "border-radius",
1967
- "min-width",
1968
- "max-width",
1969
- "min-height",
1970
- "max-height"
1971
- ];
1972
- let le = String(N);
1973
- typeof N == "number" && we.includes(V) && (le = `${N}px`), q.push(`${V}: ${le}`);
1974
- }
1975
- j = q.join("; ") + (q.length > 0 ? ";" : "");
1976
- }
1977
- const H = S.attrs.style || "";
1978
- S.attrs.style = H + (H && !H.endsWith(";") ? "; " : "") + j;
1979
- }
1980
- }
1981
- const B = {};
1982
- for (const [E, T] of Object.entries(C))
1983
- ["bind", "show", "class", "style"].includes(E) || (B[E] = T);
1984
- if (Object.keys(B).length > 0 && (S.directives = B), $) {
1985
- const E = I(
1986
- g,
1922
+ directives: S
1923
+ } = Ve(f[2] || "", t, o), C = { props: {}, attrs: {} };
1924
+ for (const E in w) C.props[E] = w[E];
1925
+ for (const E in _) C.attrs[E] = _[E];
1926
+ if (Object.keys(S).length > 0 && (C.directives = { ...S }), $) {
1927
+ const E = M(
1928
+ p,
1987
1929
  l,
1988
- h.length === 1 && J(h[0]) && h[0].tag === "#text" ? typeof h[0].children == "string" ? h[0].children : "" : h.length ? h : void 0,
1930
+ h.length === 1 && D(h[0]) && h[0].tag === "#text" ? typeof h[0].children == "string" ? h[0].children : "" : h.length ? h : void 0,
1989
1931
  x
1990
- ), T = c.pop();
1991
- T ? (g = T.tag, l = T.props, x = T.key, h = T.children, h.push(E)) : (v.push(E), g = null, l = {}, x = void 0, h = []);
1992
- } else w ? g ? h.push(I(d, S, void 0, void 0)) : v.push(I(d, S, void 0, void 0)) : (g && c.push({
1993
- tag: g,
1932
+ ), L = c.pop();
1933
+ L ? (p = L.tag, l = L.props, x = L.key, h = L.children, h.push(E)) : (b.push(E), p = null, l = {}, x = void 0, h = []);
1934
+ } else k ? p ? h.push(M(d, C, void 0, void 0)) : b.push(M(d, C, void 0, void 0)) : (p && c.push({
1935
+ tag: p,
1994
1936
  props: l,
1995
1937
  children: h,
1996
1938
  key: x
1997
- }), g = d, l = S, h = []);
1939
+ }), p = d, l = C, h = []);
1998
1940
  } else if (typeof f[3] < "u") {
1999
- const d = Number(f[3]), $ = t[d], w = `interp-${d}`;
2000
- u($, w);
1941
+ const d = Number(f[3]), $ = t[d], k = `interp-${d}`;
1942
+ u($, k);
2001
1943
  } else if (f[4]) {
2002
- const d = f[4], $ = g ? h : v, w = d.split(/({{\d+}})/);
2003
- for (const k of w) {
2004
- if (!k) continue;
2005
- const _ = k.match(/^{{(\d+)}}$/);
1944
+ const d = f[4], $ = p ? h : b, k = d.split(/({{\d+}})/);
1945
+ for (const w of k) {
1946
+ if (!w) continue;
1947
+ const _ = w.match(/^{{(\d+)}}$/);
2006
1948
  if (_) {
2007
- const C = Number(_[1]), S = t[C], B = `interp-${C}`;
2008
- u(S, B);
1949
+ const S = Number(_[1]), C = t[S], E = `interp-${S}`;
1950
+ u(C, E);
2009
1951
  } else {
2010
- const C = `text-${m++}`;
2011
- $.push(s(k, C));
1952
+ const S = `text-${y++}`;
1953
+ $.push(s(w, S));
2012
1954
  }
2013
1955
  }
2014
1956
  }
2015
- const b = v.filter((d) => J(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
2016
- return b.length === 1 ? b[0] : b.length > 1 ? b : I("div", {}, "", "fallback-root");
1957
+ const v = b.filter((d) => D(d) && d.tag === "#text" ? typeof d.children == "string" && d.children.trim() !== "" : !0);
1958
+ return v.length === 1 ? v[0] : v.length > 1 ? v : M("div", {}, "", "fallback-root");
2017
1959
  }
2018
- function W(e, ...t) {
1960
+ function B(e, ...t) {
2019
1961
  const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
2020
- return ot(e, t, n);
1962
+ return Je(e, t, n);
2021
1963
  }
2022
- const me = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, z = (e, t) => {
1964
+ const ce = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, T = (e, t) => {
2023
1965
  for (const r of e) {
2024
1966
  const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
2025
1967
  if (i) {
@@ -2030,140 +1972,140 @@ const me = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new
2030
1972
  }
2031
1973
  }
2032
1974
  return { route: null, params: {} };
2033
- }, ne = {};
2034
- async function it(e) {
1975
+ }, Z = {};
1976
+ async function Qe(e) {
2035
1977
  if (e.component) return e.component;
2036
1978
  if (e.load) {
2037
- if (ne[e.path]) return ne[e.path];
1979
+ if (Z[e.path]) return Z[e.path];
2038
1980
  try {
2039
1981
  const t = await e.load();
2040
- return ne[e.path] = t.default, t.default;
1982
+ return Z[e.path] = t.default, t.default;
2041
1983
  } catch {
2042
1984
  throw new Error(`Failed to load component for route: ${e.path}`);
2043
1985
  }
2044
1986
  }
2045
1987
  throw new Error(`No component or loader defined for route: ${e.path}`);
2046
1988
  }
2047
- function st(e) {
1989
+ function Ze(e) {
2048
1990
  const { routes: t, base: r = "", initialUrl: n } = e;
2049
1991
  let o, s, i, a, c, f, h;
2050
- const g = async (v, p) => {
2051
- const u = t.find((y) => z([y], v.path).route !== null);
1992
+ const p = async (b, g) => {
1993
+ const u = t.find((m) => T([m], b.path).route !== null);
2052
1994
  if (u?.beforeEnter)
2053
1995
  try {
2054
- const y = await u.beforeEnter(v, p);
2055
- return typeof y == "string" ? (await m(y, !0), !1) : y !== !1;
2056
- } catch (y) {
2057
- return console.error("beforeEnter error", y), !1;
1996
+ const m = await u.beforeEnter(b, g);
1997
+ return typeof m == "string" ? (await y(m, !0), !1) : m !== !1;
1998
+ } catch (m) {
1999
+ return console.error("beforeEnter error", m), !1;
2058
2000
  }
2059
2001
  return !0;
2060
- }, l = async (v, p) => {
2061
- const u = t.find((y) => z([y], v.path).route !== null);
2002
+ }, l = async (b, g) => {
2003
+ const u = t.find((m) => T([m], b.path).route !== null);
2062
2004
  if (u?.onEnter)
2063
2005
  try {
2064
- const y = await u.onEnter(v, p);
2065
- return typeof y == "string" ? (await m(y, !0), !1) : y !== !1;
2066
- } catch (y) {
2067
- return console.error("onEnter error", y), !1;
2006
+ const m = await u.onEnter(b, g);
2007
+ return typeof m == "string" ? (await y(m, !0), !1) : m !== !1;
2008
+ } catch (m) {
2009
+ return console.error("onEnter error", m), !1;
2068
2010
  }
2069
2011
  return !0;
2070
- }, x = (v, p) => {
2071
- const u = t.find((y) => z([y], v.path).route !== null);
2012
+ }, x = (b, g) => {
2013
+ const u = t.find((m) => T([m], b.path).route !== null);
2072
2014
  if (u?.afterEnter)
2073
2015
  try {
2074
- u.afterEnter(v, p);
2075
- } catch (y) {
2076
- console.error("afterEnter error", y);
2016
+ u.afterEnter(b, g);
2017
+ } catch (m) {
2018
+ console.error("afterEnter error", m);
2077
2019
  }
2078
- }, m = async (v, p = !1) => {
2020
+ }, y = async (b, g = !1) => {
2079
2021
  try {
2080
2022
  const u = {
2081
- path: v.replace(r, "") || "/",
2023
+ path: b.replace(r, "") || "/",
2082
2024
  query: {}
2083
- }, y = z(t, u.path);
2084
- if (!y) throw new Error(`No route found for ${u.path}`);
2085
- const b = i.getState(), d = {
2025
+ }, m = T(t, u.path);
2026
+ if (!m) throw new Error(`No route found for ${u.path}`);
2027
+ const v = i.getState(), d = {
2086
2028
  path: u.path,
2087
- params: y.params,
2029
+ params: m.params,
2088
2030
  query: u.query
2089
2031
  };
2090
- if (!await g(d, b) || !await l(d, b)) return;
2091
- typeof window < "u" && typeof document < "u" && (p ? window.history.replaceState({}, "", r + v) : window.history.pushState({}, "", r + v)), i.setState(d), x(d, b);
2032
+ if (!await p(d, v) || !await l(d, v)) return;
2033
+ typeof window < "u" && typeof document < "u" && (g ? window.history.replaceState({}, "", r + b) : window.history.pushState({}, "", r + b)), i.setState(d), x(d, v);
2092
2034
  } catch (u) {
2093
2035
  console.error("Navigation error:", u);
2094
2036
  }
2095
2037
  };
2096
2038
  if (typeof window < "u" && typeof document < "u") {
2097
2039
  o = () => {
2098
- const p = new URL(window.location.href), u = p.pathname.replace(r, "") || "/", y = me(p.search);
2099
- return { path: u, query: y };
2040
+ const g = new URL(window.location.href), u = g.pathname.replace(r, "") || "/", m = ce(g.search);
2041
+ return { path: u, query: m };
2100
2042
  }, s = o();
2101
- const v = z(t, s.path);
2102
- i = ce({
2043
+ const b = T(t, s.path);
2044
+ i = te({
2103
2045
  path: s.path,
2104
- params: v.params,
2046
+ params: b.params,
2105
2047
  query: s.query
2106
- }), a = async (p = !1) => {
2048
+ }), a = async (g = !1) => {
2107
2049
  const u = o();
2108
- await m(u.path, p);
2109
- }, window.addEventListener("popstate", () => a(!0)), c = (p) => m(p, !1), f = (p) => m(p, !0), h = () => window.history.back();
2050
+ await y(u.path, g);
2051
+ }, window.addEventListener("popstate", () => a(!0)), c = (g) => y(g, !1), f = (g) => y(g, !0), h = () => window.history.back();
2110
2052
  } else {
2111
2053
  o = () => {
2112
- const u = new URL(n || "/", "http://localhost"), y = u.pathname.replace(r, "") || "/", b = me(u.search);
2113
- return { path: y, query: b };
2054
+ const u = new URL(n || "/", "http://localhost"), m = u.pathname.replace(r, "") || "/", v = ce(u.search);
2055
+ return { path: m, query: v };
2114
2056
  }, s = o();
2115
- const v = z(t, s.path);
2116
- i = ce({
2057
+ const b = T(t, s.path);
2058
+ i = te({
2117
2059
  path: s.path,
2118
- params: v.params,
2060
+ params: b.params,
2119
2061
  query: s.query
2120
2062
  }), a = async () => {
2121
2063
  const u = o();
2122
- await p(u.path);
2064
+ await g(u.path);
2123
2065
  };
2124
- const p = async (u) => {
2066
+ const g = async (u) => {
2125
2067
  try {
2126
- const y = {
2068
+ const m = {
2127
2069
  path: u.replace(r, "") || "/",
2128
2070
  query: {}
2129
- }, b = z(t, y.path);
2130
- if (!b) throw new Error(`No route found for ${y.path}`);
2071
+ }, v = T(t, m.path);
2072
+ if (!v) throw new Error(`No route found for ${m.path}`);
2131
2073
  const d = i.getState(), $ = {
2132
- path: y.path,
2133
- params: b.params,
2134
- query: y.query
2135
- }, w = t.find((k) => z([k], $.path).route !== null);
2136
- if (w?.beforeEnter)
2074
+ path: m.path,
2075
+ params: v.params,
2076
+ query: m.query
2077
+ }, k = t.find((w) => T([w], $.path).route !== null);
2078
+ if (k?.beforeEnter)
2137
2079
  try {
2138
- const k = await w.beforeEnter($, d);
2139
- if (typeof k == "string") {
2140
- await p(k);
2080
+ const w = await k.beforeEnter($, d);
2081
+ if (typeof w == "string") {
2082
+ await g(w);
2141
2083
  return;
2142
2084
  }
2143
- if (k === !1) return;
2085
+ if (w === !1) return;
2144
2086
  } catch {
2145
2087
  return;
2146
2088
  }
2147
- if (w?.onEnter)
2089
+ if (k?.onEnter)
2148
2090
  try {
2149
- const k = await w.onEnter($, d);
2150
- if (typeof k == "string") {
2151
- await p(k);
2091
+ const w = await k.onEnter($, d);
2092
+ if (typeof w == "string") {
2093
+ await g(w);
2152
2094
  return;
2153
2095
  }
2154
- if (k === !1) return;
2096
+ if (w === !1) return;
2155
2097
  } catch {
2156
2098
  return;
2157
2099
  }
2158
- if (i.setState($), w?.afterEnter)
2100
+ if (i.setState($), k?.afterEnter)
2159
2101
  try {
2160
- w.afterEnter($, d);
2102
+ k.afterEnter($, d);
2161
2103
  } catch {
2162
2104
  }
2163
2105
  } catch {
2164
2106
  }
2165
2107
  };
2166
- c = async (u) => p(u), f = async (u) => p(u), h = () => {
2108
+ c = async (u) => g(u), f = async (u) => g(u), h = () => {
2167
2109
  };
2168
2110
  }
2169
2111
  return {
@@ -2172,34 +2114,34 @@ function st(e) {
2172
2114
  replace: f,
2173
2115
  back: h,
2174
2116
  subscribe: i.subscribe,
2175
- matchRoute: (v) => z(t, v),
2117
+ matchRoute: (b) => T(t, b),
2176
2118
  getCurrent: () => i.getState(),
2177
- resolveRouteComponent: it
2119
+ resolveRouteComponent: Qe
2178
2120
  };
2179
2121
  }
2180
- function ht(e, t) {
2181
- return z(e, t);
2122
+ function ot(e, t) {
2123
+ return T(e, t);
2182
2124
  }
2183
- function gt(e) {
2184
- const t = st(e);
2185
- return ye("router-view", {
2125
+ function it(e) {
2126
+ const t = Ze(e);
2127
+ return le("router-view", {
2186
2128
  async render() {
2187
- if (!t) return W`<div>Router not initialized.</div>`;
2129
+ if (!t) return B`<div>Router not initialized.</div>`;
2188
2130
  const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
2189
- if (!o.route) return W`<div>Not found</div>`;
2131
+ if (!o.route) return B`<div>Not found</div>`;
2190
2132
  let s = o.route.component;
2191
2133
  if (o.route.load) {
2192
2134
  const i = await o.route.load();
2193
2135
  typeof i.default == "string" && (s = i.default);
2194
2136
  }
2195
- return typeof s == "string" ? { tag: s, props: {}, children: [] } : W`<div>Invalid route component</div>`;
2137
+ return typeof s == "string" ? { tag: s, props: {}, children: [] } : B`<div>Invalid route component</div>`;
2196
2138
  },
2197
2139
  onConnected(r) {
2198
2140
  t && typeof t.subscribe == "function" && t.subscribe(() => {
2199
2141
  typeof r.requestRender == "function" && r.requestRender();
2200
2142
  });
2201
2143
  }
2202
- }), ye("router-link", {
2144
+ }), le("router-link", {
2203
2145
  state: {},
2204
2146
  props: {
2205
2147
  to: { type: String, default: "" },
@@ -2212,7 +2154,7 @@ function gt(e) {
2212
2154
  disabled: { type: Boolean, default: !1 },
2213
2155
  external: { type: Boolean, default: !1 },
2214
2156
  class: { type: String, default: "" },
2215
- style: { type: String, default: ve`
2157
+ style: { type: String, default: ue`
2216
2158
  [aria-disabled="true"] {
2217
2159
  pointer-events: none;
2218
2160
  opacity: 0.5;
@@ -2221,25 +2163,25 @@ function gt(e) {
2221
2163
  },
2222
2164
  style: (r) => r.style,
2223
2165
  render: (r) => {
2224
- const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, h = r.disabled, g = r.external, l = n.path === o, x = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, m = l ? i : x ? a : "", v = l ? `aria-current="${c}"` : "", p = f === "button", u = h ? p ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", y = g && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2225
- return W`
2226
- ${$e().when(p, W`
2166
+ const n = t.getCurrent(), o = r.to, s = r.exact, i = r.exactActiveClass, a = r.activeClass, c = r.ariaCurrentValue, f = r.tag, h = r.disabled, p = r.external, l = n.path === o, x = s ? l : n && typeof n.path == "string" ? n.path.startsWith(o) : !1, y = l ? i : x ? a : "", b = l ? `aria-current="${c}"` : "", g = f === "button", u = h ? g ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "", m = p && (f === "a" || !f) ? 'target="_blank" rel="noopener noreferrer"' : "";
2167
+ return B`
2168
+ ${pe().when(g, B`
2227
2169
  <button
2228
2170
  part="button"
2229
- :class="${r.class} ${m}"
2230
- ${v}
2171
+ :class="${r.class} ${y}"
2172
+ ${b}
2231
2173
  ${u}
2232
- ${y}
2174
+ ${m}
2233
2175
  @click="navigate"
2234
2176
  ><slot></slot></button>
2235
- `).otherwise(W`
2177
+ `).otherwise(B`
2236
2178
  <a
2237
2179
  part="link"
2238
2180
  href="${o}"
2239
- :class="${r.class} ${m}"
2240
- ${v}
2181
+ :class="${r.class} ${y}"
2182
+ ${b}
2241
2183
  ${u}
2242
- ${y}
2184
+ ${m}
2243
2185
  @click="navigate"
2244
2186
  ><slot></slot></a>
2245
2187
  `).done()}
@@ -2255,25 +2197,25 @@ function gt(e) {
2255
2197
  }), t;
2256
2198
  }
2257
2199
  export {
2258
- D as GlobalEventBus,
2259
- ye as component,
2260
- ce as createStore,
2261
- ve as css,
2262
- lt as each,
2263
- ct as emit,
2264
- K as eventBus,
2265
- W as html,
2266
- gt as initRouter,
2267
- pt as listen,
2268
- $e as match,
2269
- z as matchRoute,
2270
- ht as matchRouteSSR,
2271
- ut as off,
2272
- ft as on,
2273
- dt as once,
2274
- me as parseQuery,
2275
- it as resolveRouteComponent,
2276
- st as useRouter,
2277
- at as when
2200
+ N as GlobalEventBus,
2201
+ le as component,
2202
+ te as createStore,
2203
+ ue as css,
2204
+ Ye as each,
2205
+ Ge as emit,
2206
+ P as eventBus,
2207
+ B as html,
2208
+ it as initRouter,
2209
+ nt as listen,
2210
+ pe as match,
2211
+ T as matchRoute,
2212
+ ot as matchRouteSSR,
2213
+ tt as off,
2214
+ et as on,
2215
+ rt as once,
2216
+ ce as parseQuery,
2217
+ Qe as resolveRouteComponent,
2218
+ Ze as useRouter,
2219
+ Xe as when
2278
2220
  };
2279
2221
  //# sourceMappingURL=custom-elements-runtime.es.js.map