@jasonshimmy/custom-elements-runtime 0.0.10-beta.0 → 0.0.10-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,20 +1,20 @@
1
- function _e(n) {
2
- let e = new Proxy(n, {
3
- set: (o, l, f) => (o[l] = f, i(), !0)
1
+ function Ne(e) {
2
+ let t = new Proxy(e, {
3
+ set: (o, c, d) => (o[c] = d, s(), !0)
4
4
  });
5
- const t = [];
6
- function s(o) {
7
- t.push(o), o(e);
8
- }
9
- function r() {
10
- return e;
5
+ const r = [];
6
+ function n(o) {
7
+ r.push(o), o(t);
11
8
  }
12
9
  function i() {
13
- t.forEach((o) => o(e));
10
+ return t;
11
+ }
12
+ function s() {
13
+ r.forEach((o) => o(t));
14
14
  }
15
- return { subscribe: s, getState: r };
15
+ return { subscribe: n, getState: i };
16
16
  }
17
- class j extends EventTarget {
17
+ class R extends EventTarget {
18
18
  handlers = {};
19
19
  static instance;
20
20
  eventCounters = /* @__PURE__ */ new Map();
@@ -22,7 +22,7 @@ class j extends EventTarget {
22
22
  * Returns the singleton instance of GlobalEventBus
23
23
  */
24
24
  static getInstance() {
25
- return j.instance || (j.instance = new j()), j.instance;
25
+ return R.instance || (R.instance = new R()), R.instance;
26
26
  }
27
27
  // Enhanced emit method with better typing and event storm protection
28
28
  /**
@@ -30,26 +30,26 @@ class j extends EventTarget {
30
30
  * @param eventName - Name of the event
31
31
  * @param data - Optional event payload
32
32
  */
33
- emit(e, t) {
34
- const s = Date.now(), r = this.eventCounters.get(e);
35
- if (!r || s - r.window > 1e3)
36
- this.eventCounters.set(e, { count: 1, window: s });
37
- else if (r.count++, r.count > 50 && (console.error(`Event storm detected for "${e}": ${r.count} events in 1 second. Throttling...`), r.count > 100)) {
38
- console.warn(`Blocking further "${e}" events to prevent infinite loop`);
33
+ emit(t, r) {
34
+ const n = Date.now(), i = this.eventCounters.get(t);
35
+ if (!i || n - i.window > 1e3)
36
+ this.eventCounters.set(t, { count: 1, window: n });
37
+ else if (i.count++, i.count > 50 && (console.error(`Event storm detected for "${t}": ${i.count} events in 1 second. Throttling...`), i.count > 100)) {
38
+ console.warn(`Blocking further "${t}" events to prevent infinite loop`);
39
39
  return;
40
40
  }
41
- this.dispatchEvent(new CustomEvent(e, {
42
- detail: t,
41
+ this.dispatchEvent(new CustomEvent(t, {
42
+ detail: r,
43
43
  bubbles: !1,
44
44
  // Global events don't need to bubble
45
45
  cancelable: !0
46
46
  }));
47
- const i = this.handlers[e];
48
- i && i.forEach((o) => {
47
+ const s = this.handlers[t];
48
+ s && s.forEach((o) => {
49
49
  try {
50
- o(t);
51
- } catch (l) {
52
- console.error(`Error in global event handler for "${e}":`, l);
50
+ o(r);
51
+ } catch (c) {
52
+ console.error(`Error in global event handler for "${t}":`, c);
53
53
  }
54
54
  });
55
55
  }
@@ -58,24 +58,24 @@ class j extends EventTarget {
58
58
  * @param eventName - Name of the event
59
59
  * @param handler - Handler function
60
60
  */
61
- on(e, t) {
62
- return this.handlers[e] || (this.handlers[e] = /* @__PURE__ */ new Set()), this.handlers[e].add(t), () => this.off(e, t);
61
+ on(t, r) {
62
+ return this.handlers[t] || (this.handlers[t] = /* @__PURE__ */ new Set()), this.handlers[t].add(r), () => this.off(t, r);
63
63
  }
64
64
  /**
65
65
  * Remove a specific handler for a global event.
66
66
  * @param eventName - Name of the event
67
67
  * @param handler - Handler function to remove
68
68
  */
69
- off(e, t) {
70
- const s = this.handlers[e];
71
- s && s.delete(t);
69
+ off(t, r) {
70
+ const n = this.handlers[t];
71
+ n && n.delete(r);
72
72
  }
73
73
  /**
74
74
  * Remove all handlers for a specific event.
75
75
  * @param eventName - Name of the event
76
76
  */
77
- offAll(e) {
78
- delete this.handlers[e];
77
+ offAll(t) {
78
+ delete this.handlers[t];
79
79
  }
80
80
  /**
81
81
  * Listen for a native CustomEvent. Returns an unsubscribe function.
@@ -83,18 +83,18 @@ class j extends EventTarget {
83
83
  * @param handler - CustomEvent handler
84
84
  * @param options - AddEventListener options
85
85
  */
86
- listen(e, t, s) {
87
- return this.addEventListener(e, t, s), () => this.removeEventListener(e, t);
86
+ listen(t, r, n) {
87
+ return this.addEventListener(t, r, n), () => this.removeEventListener(t, r);
88
88
  }
89
89
  /**
90
90
  * Register a one-time event handler. Returns a promise that resolves with the event data.
91
91
  * @param eventName - Name of the event
92
92
  * @param handler - Handler function
93
93
  */
94
- once(e, t) {
95
- return new Promise((s) => {
96
- const r = this.on(e, (i) => {
97
- r(), t(i), s(i);
94
+ once(t, r) {
95
+ return new Promise((n) => {
96
+ const i = this.on(t, (s) => {
97
+ i(), r(s), n(s);
98
98
  });
99
99
  });
100
100
  }
@@ -103,7 +103,7 @@ class j extends EventTarget {
103
103
  */
104
104
  getActiveEvents() {
105
105
  return Object.keys(this.handlers).filter(
106
- (e) => this.handlers[e] && this.handlers[e].size > 0
106
+ (t) => this.handlers[t] && this.handlers[t].size > 0
107
107
  );
108
108
  }
109
109
  /**
@@ -116,20 +116,20 @@ class j extends EventTarget {
116
116
  * Get the number of handlers registered for a specific event.
117
117
  * @param eventName - Name of the event
118
118
  */
119
- getHandlerCount(e) {
120
- return this.handlers[e]?.size || 0;
119
+ getHandlerCount(t) {
120
+ return this.handlers[t]?.size || 0;
121
121
  }
122
122
  /**
123
123
  * Get event statistics for debugging.
124
124
  */
125
125
  getEventStats() {
126
- const e = {};
127
- for (const [t, s] of this.eventCounters.entries())
128
- e[t] = {
129
- count: s.count,
130
- handlersCount: this.getHandlerCount(t)
126
+ const t = {};
127
+ for (const [r, n] of this.eventCounters.entries())
128
+ t[r] = {
129
+ count: n.count,
130
+ handlersCount: this.getHandlerCount(r)
131
131
  };
132
- return e;
132
+ return t;
133
133
  }
134
134
  /**
135
135
  * Reset event counters (useful for testing or after resolving issues).
@@ -138,160 +138,160 @@ class j extends EventTarget {
138
138
  this.eventCounters.clear();
139
139
  }
140
140
  }
141
- const be = j.getInstance();
142
- function P(n, e = {}, t, s) {
143
- const r = s ?? e.key;
144
- return { tag: n, key: r, props: e, children: t };
141
+ const je = R.getInstance();
142
+ function P(e, t = {}, r, n) {
143
+ const i = n ?? t.key;
144
+ return { tag: e, key: i, props: t, children: r };
145
145
  }
146
- function z(n) {
147
- return !!n && typeof n == "object" && (n.type === "AnchorBlock" || n.tag === "#anchor");
146
+ function V(e) {
147
+ return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
148
148
  }
149
- function M(n) {
150
- return typeof n == "object" && n !== null && "tag" in n && !z(n);
149
+ function z(e) {
150
+ return typeof e == "object" && e !== null && "tag" in e && !V(e);
151
151
  }
152
- function X(n, e) {
153
- return n.key != null ? n : { ...n, key: e };
152
+ function oe(e, t) {
153
+ return e.key != null ? e : { ...e, key: t };
154
154
  }
155
- function Y(n, e = [], t = {}) {
156
- const s = {}, r = {}, i = {}, o = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
157
- let l;
158
- for (; l = o.exec(n); ) {
159
- const f = l[1], c = l[2], h = (l[4] || l[6]) ?? "", d = h.match(/^{{(\d+)}}$/);
160
- let a = d ? e[Number(d[1])] ?? null : h;
161
- if (d || (a === "true" ? a = !0 : a === "false" ? a = !1 : a === "null" ? a = null : isNaN(Number(a)) || (a = Number(a))), f === ":")
162
- typeof a == "boolean" ? r[c] = a : a != null && (s[c] = a);
163
- else if (f === "@") {
164
- const _ = "on" + c.charAt(0).toUpperCase() + c.slice(1);
165
- s[_] = typeof a == "function" ? a : typeof t[a] == "function" ? t[a] : void 0;
166
- } else if (f === "#") {
167
- const [_, ...b] = c.split("."), T = [...b];
168
- let k = a, u = [...T];
169
- if (_ === "model" && typeof k == "string" && k.includes(".")) {
170
- const y = ["trim", "number", "lazy"], m = k.split(".");
171
- let g = k;
172
- const p = [];
173
- for (let x = m.length - 1; x > 0 && y.includes(m[x]); x--)
174
- p.unshift(m[x]), g = m.slice(0, x).join(".");
175
- k = g, u.push(...p);
155
+ function se(e, t = [], r = {}) {
156
+ const n = {}, i = {}, s = {}, o = /([:@#]?)([a-zA-Z0-9-:\.]+)=("([^"\\]*(\\.[^"\\]*)*)"|'([^'\\]*(\\.[^'\\]*)*)')/g;
157
+ let c;
158
+ for (; c = o.exec(e); ) {
159
+ const d = c[1], a = c[2], u = (c[4] || c[6]) ?? "", y = u.match(/^{{(\d+)}}$/);
160
+ let f = y ? t[Number(y[1])] ?? null : u;
161
+ if (y || (f === "true" ? f = !0 : f === "false" ? f = !1 : f === "null" ? f = null : isNaN(Number(f)) || (f = Number(f))), d === ":")
162
+ typeof f == "boolean" ? i[a] = f : f != null && (n[a] = f);
163
+ else if (d === "@") {
164
+ const w = "on" + a.charAt(0).toUpperCase() + a.slice(1);
165
+ n[w] = typeof f == "function" ? f : typeof r[f] == "function" ? r[f] : void 0;
166
+ } else if (d === "#") {
167
+ const [w, ...p] = a.split("."), C = [...p];
168
+ let g = f, l = [...C];
169
+ if (w === "model" && typeof g == "string" && g.includes(".")) {
170
+ const b = ["trim", "number", "lazy"], m = g.split(".");
171
+ let h = g;
172
+ const x = [];
173
+ for (let S = m.length - 1; S > 0 && b.includes(m[S]); S--)
174
+ x.unshift(m[S]), h = m.slice(0, S).join(".");
175
+ g = h, l.push(...x);
176
176
  }
177
- i[_] = {
178
- value: k,
179
- modifiers: u
177
+ s[w] = {
178
+ value: g,
179
+ modifiers: l
180
180
  };
181
181
  } else
182
- r[c] = a;
182
+ i[a] = f;
183
183
  }
184
- return { props: s, attrs: r, directives: i };
184
+ return { props: n, attrs: i, directives: s };
185
185
  }
186
- function Q(n, e, t) {
187
- function s(u, y) {
188
- return P("#text", {}, u, y);
186
+ function ae(e, t, r) {
187
+ function n(l, b) {
188
+ return P("#text", {}, l, b);
189
189
  }
190
- let r = "";
191
- for (let u = 0; u < n.length; u++)
192
- r += n[u], u < e.length && (r += `{{${u}}}`);
193
- const i = /<\/?([a-zA-Z0-9-]+)([^>]*)\/?>|{{(\d+)}}|([^<]+)/g, o = [];
194
- let l = null, f, c = [], h = null, d = {}, a, _ = 0, b = [];
195
- function T(u) {
196
- !u || typeof u != "object" || z(u) || (u.props || u.attrs ? (u.props && (d.props || (d.props = {}), Object.assign(d.props, u.props)), u.attrs && (d.attrs || (d.attrs = {}), Object.keys(u.attrs).forEach((y) => {
197
- if (y === "style" && d.attrs.style) {
198
- const m = d.attrs.style.replace(
190
+ let i = "";
191
+ for (let l = 0; l < e.length; l++)
192
+ i += e[l], l < t.length && (i += `{{${l}}}`);
193
+ const s = /<\/?([a-zA-Z0-9-]+)([^>]*)\/?>|{{(\d+)}}|([^<]+)/g, o = [];
194
+ let c = null, d, a = [], u = null, y = {}, f, w = 0, p = [];
195
+ function C(l) {
196
+ !l || typeof l != "object" || V(l) || (l.props || l.attrs ? (l.props && (y.props || (y.props = {}), Object.assign(y.props, l.props)), l.attrs && (y.attrs || (y.attrs = {}), Object.keys(l.attrs).forEach((b) => {
197
+ if (b === "style" && y.attrs.style) {
198
+ const m = y.attrs.style.replace(
199
199
  /;?\s*$/,
200
200
  ""
201
- ), g = u.attrs.style.replace(/^;?\s*/, "");
202
- d.attrs.style = m + "; " + g;
203
- } else if (y === "class" && d.attrs.class) {
204
- const m = d.attrs.class.trim().split(/\s+/).filter(Boolean), g = u.attrs.class.trim().split(/\s+/).filter(Boolean), p = [
205
- .../* @__PURE__ */ new Set([...m, ...g])
201
+ ), h = l.attrs.style.replace(/^;?\s*/, "");
202
+ y.attrs.style = m + "; " + h;
203
+ } else if (b === "class" && y.attrs.class) {
204
+ const m = y.attrs.class.trim().split(/\s+/).filter(Boolean), h = l.attrs.class.trim().split(/\s+/).filter(Boolean), x = [
205
+ .../* @__PURE__ */ new Set([...m, ...h])
206
206
  ];
207
- d.attrs.class = p.join(" ");
207
+ y.attrs.class = x.join(" ");
208
208
  } else
209
- d.attrs[y] = u.attrs[y];
210
- }))) : (d.props || (d.props = {}), Object.assign(d.props, u)));
209
+ y.attrs[b] = l.attrs[b];
210
+ }))) : (y.props || (y.props = {}), Object.assign(y.props, l)));
211
211
  }
212
- function k(u, y) {
213
- const m = h ? c : b;
214
- if (z(u)) {
215
- const g = u.key ?? y;
216
- let p = u.children;
212
+ function g(l, b) {
213
+ const m = u ? a : p;
214
+ if (V(l)) {
215
+ const h = l.key ?? b;
216
+ let x = l.children;
217
217
  m.push({
218
- ...u,
219
- key: g,
220
- children: p
218
+ ...l,
219
+ key: h,
220
+ children: x
221
221
  });
222
222
  return;
223
223
  }
224
- if (M(u)) {
225
- m.push(X(u, void 0));
224
+ if (z(l)) {
225
+ m.push(oe(l, void 0));
226
226
  return;
227
227
  }
228
- if (Array.isArray(u)) {
229
- if (u.length === 0) return;
230
- for (let g = 0; g < u.length; g++) {
231
- const p = u[g];
232
- z(p) || M(p) || Array.isArray(p) ? k(p, `${y}-${g}`) : p !== null && typeof p == "object" ? T(p) : m.push(s(String(p), `${y}-${g}`));
228
+ if (Array.isArray(l)) {
229
+ if (l.length === 0) return;
230
+ for (let h = 0; h < l.length; h++) {
231
+ const x = l[h];
232
+ V(x) || z(x) || Array.isArray(x) ? g(x, `${b}-${h}`) : x !== null && typeof x == "object" ? C(x) : m.push(n(String(x), `${b}-${h}`));
233
233
  }
234
234
  return;
235
235
  }
236
- if (u !== null && typeof u == "object") {
237
- T(u);
236
+ if (l !== null && typeof l == "object") {
237
+ C(l);
238
238
  return;
239
239
  }
240
- m.push(s(String(u), y));
240
+ m.push(n(String(l), b));
241
241
  }
242
- for (; f = i.exec(r); )
243
- if (f[1]) {
244
- const u = f[1], y = f[0][1] === "/", m = f[0][f[0].length - 2] === "/", {
245
- props: g,
246
- attrs: p,
247
- directives: x
248
- } = Y(f[2] || "", e, t), S = { props: {}, attrs: {} };
249
- for (const A in g) S.props[A] = g[A];
250
- for (const A in p) S.attrs[A] = p[A];
251
- for (const [A, E] of Object.entries(x))
252
- if (A === "bind")
253
- if (typeof E.value == "object" && E.value !== null)
254
- for (const [w, v] of Object.entries(E.value))
255
- typeof v == "boolean" ? S.attrs[w] = v : v != null && (S.attrs[w] = String(v));
256
- else E.value != null && (S.attrs[A] = String(E.value));
257
- else if (A === "show") {
258
- const w = !!E.value;
259
- S.attrs.style = (S.attrs.style || "") + (w ? "" : "; display: none !important");
260
- } else if (A === "class") {
261
- const w = E.value;
262
- let v = [];
263
- if (typeof w == "string")
264
- v = w.split(/\s+/).filter(Boolean);
265
- else if (Array.isArray(w)) {
266
- for (const N of w)
267
- if (typeof N == "string")
268
- v.push(...N.split(/\s+/).filter(Boolean));
269
- else if (N && typeof N == "object")
270
- for (const [L, R] of Object.entries(N))
271
- R && v.push(...L.split(/\s+/).filter(Boolean));
272
- } else if (w && typeof w == "object")
273
- for (const [N, L] of Object.entries(w))
274
- L && v.push(...N.split(/\s+/).filter(Boolean));
275
- const B = S.attrs.class || "", D = [
242
+ for (; d = s.exec(i); )
243
+ if (d[1]) {
244
+ const l = d[1], b = d[0][1] === "/", m = d[0][d[0].length - 2] === "/", {
245
+ props: h,
246
+ attrs: x,
247
+ directives: S
248
+ } = se(d[2] || "", t, r), k = { props: {}, attrs: {} };
249
+ for (const _ in h) k.props[_] = h[_];
250
+ for (const _ in x) k.attrs[_] = x[_];
251
+ for (const [_, $] of Object.entries(S))
252
+ if (_ === "bind")
253
+ if (typeof $.value == "object" && $.value !== null)
254
+ for (const [A, E] of Object.entries($.value))
255
+ typeof E == "boolean" ? k.attrs[A] = E : E != null && (k.attrs[A] = String(E));
256
+ else $.value != null && (k.attrs[_] = String($.value));
257
+ else if (_ === "show") {
258
+ const A = !!$.value;
259
+ k.attrs.style = (k.attrs.style || "") + (A ? "" : "; display: none !important");
260
+ } else if (_ === "class") {
261
+ const A = $.value;
262
+ let E = [];
263
+ if (typeof A == "string")
264
+ E = A.split(/\s+/).filter(Boolean);
265
+ else if (Array.isArray(A)) {
266
+ for (const L of A)
267
+ if (typeof L == "string")
268
+ E.push(...L.split(/\s+/).filter(Boolean));
269
+ else if (L && typeof L == "object")
270
+ for (const [N, M] of Object.entries(L))
271
+ M && E.push(...N.split(/\s+/).filter(Boolean));
272
+ } else if (A && typeof A == "object")
273
+ for (const [L, N] of Object.entries(A))
274
+ N && E.push(...L.split(/\s+/).filter(Boolean));
275
+ const B = k.attrs.class || "", O = [
276
276
  .../* @__PURE__ */ new Set([
277
277
  ...B.split(/\s+/).filter(Boolean),
278
- ...v
278
+ ...E
279
279
  ])
280
280
  ];
281
- S.attrs.class = D.join(" ");
282
- } else if (A === "style") {
283
- const w = E.value;
284
- let v = "";
285
- if (typeof w == "string")
286
- v = w;
287
- else if (w && typeof w == "object") {
288
- const D = [];
289
- for (const [N, L] of Object.entries(w))
290
- if (L != null && L !== "") {
291
- const R = N.replace(
281
+ k.attrs.class = O.join(" ");
282
+ } else if (_ === "style") {
283
+ const A = $.value;
284
+ let E = "";
285
+ if (typeof A == "string")
286
+ E = A;
287
+ else if (A && typeof A == "object") {
288
+ const O = [];
289
+ for (const [L, N] of Object.entries(A))
290
+ if (N != null && N !== "") {
291
+ const M = L.replace(
292
292
  /[A-Z]/g,
293
- (Z) => `-${Z.toLowerCase()}`
294
- ), J = [
293
+ (ie) => `-${ie.toLowerCase()}`
294
+ ), ne = [
295
295
  "width",
296
296
  "height",
297
297
  "top",
@@ -317,259 +317,259 @@ function Q(n, e, t) {
317
317
  "min-height",
318
318
  "max-height"
319
319
  ];
320
- let q = String(L);
321
- typeof L == "number" && J.includes(R) && (q = `${L}px`), D.push(`${R}: ${q}`);
320
+ let Q = String(N);
321
+ typeof N == "number" && ne.includes(M) && (Q = `${N}px`), O.push(`${M}: ${Q}`);
322
322
  }
323
- v = D.join("; ") + (D.length > 0 ? ";" : "");
323
+ E = O.join("; ") + (O.length > 0 ? ";" : "");
324
324
  }
325
- const B = S.attrs.style || "";
326
- S.attrs.style = B + (B && !B.endsWith(";") ? "; " : "") + v;
325
+ const B = k.attrs.style || "";
326
+ k.attrs.style = B + (B && !B.endsWith(";") ? "; " : "") + E;
327
327
  }
328
- const C = {};
329
- for (const [A, E] of Object.entries(x))
330
- ["bind", "show", "class", "style"].includes(A) || (C[A] = E);
331
- if (Object.keys(C).length > 0 && (S.directives = C), y) {
332
- const A = P(
333
- h,
334
- d,
335
- c.length === 1 && M(c[0]) && c[0].tag === "#text" ? typeof c[0].children == "string" ? c[0].children : "" : c.length ? c : void 0,
336
- a
337
- ), E = o.pop();
338
- E ? (h = E.tag, d = E.props, a = E.key, c = E.children, c.push(A)) : l = A;
339
- } else m ? (h ? c : b).push(P(u, S, void 0, void 0)) : (h && o.push({
340
- tag: h,
341
- props: d,
342
- children: c,
343
- key: a
344
- }), h = u, d = S, c = []);
345
- } else if (typeof f[3] < "u") {
346
- const u = Number(f[3]), y = e[u], m = `interp-${u}`;
347
- k(y, m);
348
- } else if (f[4]) {
349
- const u = f[4], y = h ? c : b, m = u.split(/({{\d+}})/);
350
- for (const g of m) {
351
- if (!g) continue;
352
- const p = g.match(/^{{(\d+)}}$/);
353
- if (p) {
354
- const x = Number(p[1]), S = e[x], C = `interp-${x}`;
355
- k(S, C);
328
+ const v = {};
329
+ for (const [_, $] of Object.entries(S))
330
+ ["bind", "show", "class", "style"].includes(_) || (v[_] = $);
331
+ if (Object.keys(v).length > 0 && (k.directives = v), b) {
332
+ const _ = P(
333
+ u,
334
+ y,
335
+ a.length === 1 && z(a[0]) && a[0].tag === "#text" ? typeof a[0].children == "string" ? a[0].children : "" : a.length ? a : void 0,
336
+ f
337
+ ), $ = o.pop();
338
+ $ ? (u = $.tag, y = $.props, f = $.key, a = $.children, a.push(_)) : c = _;
339
+ } else m ? (u ? a : p).push(P(l, k, void 0, void 0)) : (u && o.push({
340
+ tag: u,
341
+ props: y,
342
+ children: a,
343
+ key: f
344
+ }), u = l, y = k, a = []);
345
+ } else if (typeof d[3] < "u") {
346
+ const l = Number(d[3]), b = t[l], m = `interp-${l}`;
347
+ g(b, m);
348
+ } else if (d[4]) {
349
+ const l = d[4], b = u ? a : p, m = l.split(/({{\d+}})/);
350
+ for (const h of m) {
351
+ if (!h) continue;
352
+ const x = h.match(/^{{(\d+)}}$/);
353
+ if (x) {
354
+ const S = Number(x[1]), k = t[S], v = `interp-${S}`;
355
+ g(k, v);
356
356
  } else {
357
- const x = `text-${_++}`;
358
- y.push(s(g, x));
357
+ const S = `text-${w++}`;
358
+ b.push(n(h, S));
359
359
  }
360
360
  }
361
361
  }
362
- if (l)
363
- return M(l) && Array.isArray(l.children) && (l.children = l.children.filter(
364
- (u) => M(u) ? u.tag !== "#text" || typeof u.children == "string" && u.children.trim() !== "" : !0
362
+ if (c)
363
+ return z(c) && Array.isArray(c.children) && (c.children = c.children.filter(
364
+ (l) => z(l) ? l.tag !== "#text" || typeof l.children == "string" && l.children.trim() !== "" : !0
365
365
  // keep non-element VNodes (including anchors) as-is
366
- )), l;
367
- if (b.length > 0) {
368
- const u = b.filter(
369
- (y) => M(y) ? y.tag !== "#text" || typeof y.children == "string" && y.children.trim() !== "" : !0
366
+ )), c;
367
+ if (p.length > 0) {
368
+ const l = p.filter(
369
+ (b) => z(b) ? b.tag !== "#text" || typeof b.children == "string" && b.children.trim() !== "" : !0
370
370
  );
371
- return u.length === 1 ? u[0] : u;
371
+ return l.length === 1 ? l[0] : l;
372
372
  }
373
373
  return P("div", {}, "", "fallback-root");
374
374
  }
375
- function ke(n, ...e) {
376
- const t = e[e.length - 1], s = typeof t == "object" && t && !Array.isArray(t) ? t : void 0;
377
- return Q(n, e, s);
375
+ function ze(e, ...t) {
376
+ const r = t[t.length - 1], n = typeof r == "object" && r && !Array.isArray(r) ? r : void 0;
377
+ return ae(e, t, n);
378
378
  }
379
- function Ce(n, e) {
380
- return H(n ? e : [], "when-block");
379
+ function Re(e, t) {
380
+ return H(e ? t : [], "when-block");
381
381
  }
382
- function Se(n, e) {
383
- return n.map((t, s) => {
384
- const r = typeof t == "object" ? t?.key ?? t?.id ?? `idx-${s}` : String(t);
385
- return H(e(t, s), `each-${r}`);
382
+ function Be(e, t) {
383
+ return e.map((r, n) => {
384
+ const i = typeof r == "object" ? r?.key ?? r?.id ?? `idx-${n}` : String(r);
385
+ return H(t(r, n), `each-${i}`);
386
386
  });
387
387
  }
388
- function Ae() {
389
- const n = [];
388
+ function Oe() {
389
+ const e = [];
390
390
  return {
391
- when(e, t) {
392
- return n.push([e, t]), this;
391
+ when(t, r) {
392
+ return e.push([t, r]), this;
393
393
  },
394
- otherwise(e) {
395
- return n.push([!0, e]), this;
394
+ otherwise(t) {
395
+ return e.push([!0, t]), this;
396
396
  },
397
397
  done() {
398
- return G(...n);
398
+ return le(...e);
399
399
  }
400
400
  };
401
401
  }
402
- function G(...n) {
403
- for (let e = 0; e < n.length; e++) {
404
- const [t, s] = n[e];
405
- if (t) return [H(s, `whenChain-branch-${e}`)];
402
+ function le(...e) {
403
+ for (let t = 0; t < e.length; t++) {
404
+ const [r, n] = e[t];
405
+ if (r) return [H(n, `whenChain-branch-${t}`)];
406
406
  }
407
407
  return [H([], "whenChain-empty")];
408
408
  }
409
- function H(n, e) {
410
- const t = n ? Array.isArray(n) ? n.filter(Boolean) : [n].filter(Boolean) : [];
409
+ function H(e, t) {
410
+ const r = e ? Array.isArray(e) ? e.filter(Boolean) : [e].filter(Boolean) : [];
411
411
  return {
412
412
  tag: "#anchor",
413
- key: e,
414
- children: t
413
+ key: t,
414
+ children: r
415
415
  };
416
416
  }
417
- function O(n, e) {
418
- return e.split(".").reduce((t, s) => t?.[s], n);
419
- }
420
- function U(n, e, t) {
421
- const s = e.split("."), r = s.pop();
422
- if (!r) return;
423
- const i = s.reduce((o, l) => (l in o || (o[l] = {}), o[l]), n);
424
- i[r] = t;
417
+ function j(e, t) {
418
+ return t.split(".").reduce((r, n) => r?.[n], e);
425
419
  }
426
- function ee(n, e, t, s, r, i, o) {
420
+ function X(e, t, r) {
421
+ const n = t.split("."), i = n.pop();
427
422
  if (!i) return;
428
- const l = e.includes("lazy"), f = e.includes("trim"), c = e.includes("number"), h = () => {
429
- const k = i._state || i;
430
- return O(k, n);
431
- }, d = h();
432
- let a = "text";
433
- const _ = s?.type;
434
- if (o instanceof HTMLInputElement ? a = _ || o.type || "text" : o instanceof HTMLSelectElement ? a = "select" : o instanceof HTMLTextAreaElement && (a = "textarea"), a === "checkbox")
435
- if (Array.isArray(d)) {
436
- const k = o?.getAttribute("value") || s?.value || "", u = d.includes(k);
437
- o && o.checked !== u && (t.checked = u);
423
+ const s = n.reduce((o, c) => (c in o || (o[c] = {}), o[c]), e);
424
+ s[i] = r;
425
+ }
426
+ function ce(e, t, r, n, i, s, o) {
427
+ if (!s) return;
428
+ const c = t.includes("lazy"), d = t.includes("trim"), a = t.includes("number"), u = () => {
429
+ const g = s._state || s;
430
+ return j(g, e);
431
+ }, y = u();
432
+ let f = "text";
433
+ const w = n?.type;
434
+ if (o instanceof HTMLInputElement ? f = w || o.type || "text" : o instanceof HTMLSelectElement ? f = "select" : o instanceof HTMLTextAreaElement && (f = "textarea"), f === "checkbox")
435
+ if (Array.isArray(y)) {
436
+ const g = o?.getAttribute("value") || n?.value || "", l = y.includes(g);
437
+ o && o.checked !== l && (r.checked = l);
438
438
  } else {
439
- const k = o?.getAttribute("true-value") || !0, u = d === k;
440
- o && o.checked !== u && (t.checked = u);
439
+ const g = o?.getAttribute("true-value") || !0, l = y === g;
440
+ o && o.checked !== l && (r.checked = l);
441
441
  }
442
- else if (a === "radio") {
443
- const k = s?.value || "", u = d === k;
444
- o && o.checked !== u && (t.checked = u);
445
- } else if (a === "select")
442
+ else if (f === "radio") {
443
+ const g = n?.value || "", l = y === g;
444
+ o && o.checked !== l && (r.checked = l);
445
+ } else if (f === "select")
446
446
  if (o && o.hasAttribute("multiple")) {
447
- const k = o, u = Array.isArray(d) ? d : [];
447
+ const g = o, l = Array.isArray(y) ? y : [];
448
448
  setTimeout(() => {
449
- Array.from(k.options).forEach((y) => {
450
- const m = u.includes(y.value);
451
- y.selected !== m && (y.selected = m);
449
+ Array.from(g.options).forEach((b) => {
450
+ const m = l.includes(b.value);
451
+ b.selected !== m && (b.selected = m);
452
452
  });
453
453
  }, 0);
454
454
  } else
455
455
  setTimeout(() => {
456
- o instanceof HTMLSelectElement && o.value !== String(d) && (o.value = String(d));
456
+ o instanceof HTMLSelectElement && o.value !== String(y) && (o.value = String(y));
457
457
  }, 0);
458
458
  else {
459
- const k = String(d ?? "");
460
- (!o || o.value !== k) && (t.value = d);
459
+ const g = String(y ?? "");
460
+ (!o || o.value !== g) && (r.value = y);
461
461
  }
462
- const b = l || a === "checkbox" || a === "radio" || a === "select" ? "change" : "input", T = (k) => {
463
- if (k.isComposing || r._isComposing || k.isTrusted === !1) return;
464
- const u = k.target;
465
- if (u._modelUpdating) return;
466
- const y = h();
467
- let m = u.value;
468
- if (a === "checkbox")
469
- if (Array.isArray(y)) {
470
- const S = u.getAttribute("value") || "", C = [...y];
471
- if (u.checked)
472
- C.includes(S) || C.push(S);
462
+ const p = c || f === "checkbox" || f === "radio" || f === "select" ? "change" : "input", C = (g) => {
463
+ if (g.isComposing || i._isComposing || g.isTrusted === !1) return;
464
+ const l = g.target;
465
+ if (l._modelUpdating) return;
466
+ const b = u();
467
+ let m = l.value;
468
+ if (f === "checkbox")
469
+ if (Array.isArray(b)) {
470
+ const k = l.getAttribute("value") || "", v = [...b];
471
+ if (l.checked)
472
+ v.includes(k) || v.push(k);
473
473
  else {
474
- const A = C.indexOf(S);
475
- A > -1 && C.splice(A, 1);
474
+ const _ = v.indexOf(k);
475
+ _ > -1 && v.splice(_, 1);
476
476
  }
477
- m = C;
477
+ m = v;
478
478
  } else {
479
- const S = u.getAttribute("true-value") || !0, C = u.getAttribute("false-value") || !1;
480
- m = u.checked ? S : C;
479
+ const k = l.getAttribute("true-value") || !0, v = l.getAttribute("false-value") || !1;
480
+ m = l.checked ? k : v;
481
481
  }
482
- else if (a === "radio")
483
- m = u.getAttribute("value") || u.value;
484
- else if (a === "select" && u.multiple) {
485
- const S = u;
486
- m = Array.from(S.selectedOptions).map(
487
- (C) => C.value
482
+ else if (f === "radio")
483
+ m = l.getAttribute("value") || l.value;
484
+ else if (f === "select" && l.multiple) {
485
+ const k = l;
486
+ m = Array.from(k.selectedOptions).map(
487
+ (v) => v.value
488
488
  );
489
- } else if (f && (m = m.trim()), c) {
490
- const S = Number(m);
491
- isNaN(S) || (m = S);
489
+ } else if (d && (m = m.trim()), a) {
490
+ const k = Number(m);
491
+ isNaN(k) || (m = k);
492
492
  }
493
- const g = i._state || i, p = O(g, n);
494
- if (Array.isArray(m) && Array.isArray(p) ? JSON.stringify([...m].sort()) !== JSON.stringify([...p].sort()) : m !== p) {
495
- const S = k.target;
496
- S._modelUpdating = !0, U(g, n, m), setTimeout(() => {
497
- S._modelUpdating = !1;
498
- }, 0), i._requestRender && i._requestRender();
493
+ const h = s._state || s, x = j(h, e);
494
+ if (Array.isArray(m) && Array.isArray(x) ? JSON.stringify([...m].sort()) !== JSON.stringify([...x].sort()) : m !== x) {
495
+ const k = g.target;
496
+ k._modelUpdating = !0, X(h, e, m), setTimeout(() => {
497
+ k._modelUpdating = !1;
498
+ }, 0), s._requestRender && s._requestRender();
499
499
  }
500
500
  };
501
- if (r[b] = T, a === "text" || a === "textarea") {
502
- const k = () => {
503
- r._isComposing = !0;
504
- }, u = (y) => {
505
- r._isComposing = !1;
506
- const m = y.target;
501
+ if (i[p] = C, f === "text" || f === "textarea") {
502
+ const g = () => {
503
+ i._isComposing = !0;
504
+ }, l = (b) => {
505
+ i._isComposing = !1;
506
+ const m = b.target;
507
507
  setTimeout(() => {
508
508
  if (m) {
509
- let g = m.value;
510
- if (f && (g = g.trim()), c) {
511
- const C = Number(g);
512
- isNaN(C) || (g = C);
509
+ let h = m.value;
510
+ if (d && (h = h.trim()), a) {
511
+ const v = Number(h);
512
+ isNaN(v) || (h = v);
513
513
  }
514
- const p = i._state || i, x = O(p, n);
515
- (Array.isArray(g) && Array.isArray(x) ? JSON.stringify([...g].sort()) !== JSON.stringify([...x].sort()) : g !== x) && (m && (m._modelUpdating = !0, setTimeout(() => {
514
+ const x = s._state || s, S = j(x, e);
515
+ (Array.isArray(h) && Array.isArray(S) ? JSON.stringify([...h].sort()) !== JSON.stringify([...S].sort()) : h !== S) && (m && (m._modelUpdating = !0, setTimeout(() => {
516
516
  m._modelUpdating = !1;
517
- }, 0)), U(p, n, g), i._requestRender && i._requestRender());
517
+ }, 0)), X(x, e, h), s._requestRender && s._requestRender());
518
518
  }
519
519
  }, 0);
520
520
  };
521
- r.compositionstart = k, r.compositionend = u;
521
+ i.compositionstart = g, i.compositionend = l;
522
522
  }
523
523
  }
524
- function te(n, e, t, s) {
525
- if (s)
524
+ function fe(e, t, r, n) {
525
+ if (n)
526
526
  try {
527
- const r = JSON.parse(n);
528
- if (typeof r == "object")
529
- for (const [i, o] of Object.entries(r))
530
- e[i] = o;
527
+ const i = JSON.parse(e);
528
+ if (typeof i == "object")
529
+ for (const [s, o] of Object.entries(i))
530
+ t[s] = o;
531
531
  } catch {
532
- const r = O(s, n);
533
- t[n] = r;
532
+ const i = j(n, e);
533
+ r[e] = i;
534
534
  }
535
535
  }
536
- function ne(n, e, t) {
537
- if (!t) return;
538
- const s = O(t, n), r = e.style || "", i = s ? "" : "none";
539
- if (r) {
540
- const o = r.split(";").filter(Boolean), l = o.findIndex(
541
- (f) => f.trim().startsWith("display:")
536
+ function de(e, t, r) {
537
+ if (!r) return;
538
+ const n = j(r, e), i = t.style || "", s = n ? "" : "none";
539
+ if (i) {
540
+ const o = i.split(";").filter(Boolean), c = o.findIndex(
541
+ (d) => d.trim().startsWith("display:")
542
542
  );
543
- l >= 0 ? o[l] = `display: ${i}` : o.push(`display: ${i}`), e.style = o.join("; ");
543
+ c >= 0 ? o[c] = `display: ${s}` : o.push(`display: ${s}`), t.style = o.join("; ");
544
544
  } else
545
- e.style = `display: ${i}`;
545
+ t.style = `display: ${s}`;
546
546
  }
547
- function se(n, e, t) {
548
- if (!t) return;
549
- const s = O(t, n);
550
- let r = [];
551
- typeof s == "string" ? r = [s] : Array.isArray(s) ? r = s.filter(Boolean) : typeof s == "object" && (r = Object.entries(s).filter(([, l]) => !!l).map(([l]) => l));
552
- const i = e.class || "", o = i ? `${i} ${r.join(" ")}`.trim() : r.join(" ");
553
- o && (e.class = o);
547
+ function ue(e, t, r) {
548
+ if (!r) return;
549
+ const n = j(r, e);
550
+ let i = [];
551
+ typeof n == "string" ? i = [n] : Array.isArray(n) ? i = n.filter(Boolean) : typeof n == "object" && (i = Object.entries(n).filter(([, c]) => !!c).map(([c]) => c));
552
+ const s = t.class || "", o = s ? `${s} ${i.join(" ")}`.trim() : i.join(" ");
553
+ o && (t.class = o);
554
554
  }
555
- function re(n, e, t) {
556
- let s;
557
- if (typeof n == "string") {
558
- if (!t) return;
559
- s = O(t, n);
555
+ function he(e, t, r) {
556
+ let n;
557
+ if (typeof e == "string") {
558
+ if (!r) return;
559
+ n = j(r, e);
560
560
  } else
561
- s = n;
562
- let r = "";
563
- if (typeof s == "string")
564
- r = s;
565
- else if (s && typeof s == "object") {
561
+ n = e;
562
+ let i = "";
563
+ if (typeof n == "string")
564
+ i = n;
565
+ else if (n && typeof n == "object") {
566
566
  const o = [];
567
- for (const [l, f] of Object.entries(s))
568
- if (f != null && f !== "") {
569
- const c = l.replace(
567
+ for (const [c, d] of Object.entries(n))
568
+ if (d != null && d !== "") {
569
+ const a = c.replace(
570
570
  /[A-Z]/g,
571
- (a) => `-${a.toLowerCase()}`
572
- ), h = [
571
+ (f) => `-${f.toLowerCase()}`
572
+ ), u = [
573
573
  "width",
574
574
  "height",
575
575
  "top",
@@ -595,473 +595,841 @@ function re(n, e, t) {
595
595
  "min-height",
596
596
  "max-height"
597
597
  ];
598
- let d = String(f);
599
- typeof f == "number" && h.includes(c) && (d = `${f}px`), o.push(`${c}: ${d}`);
598
+ let y = String(d);
599
+ typeof d == "number" && u.includes(a) && (y = `${d}px`), o.push(`${a}: ${y}`);
600
600
  }
601
- r = o.join("; ") + (o.length > 0 ? ";" : "");
601
+ i = o.join("; ") + (o.length > 0 ? ";" : "");
602
602
  }
603
- const i = e.style || "";
604
- e.style = i + (i && !i.endsWith(";") ? "; " : "") + r;
603
+ const s = t.style || "";
604
+ t.style = s + (s && !s.endsWith(";") ? "; " : "") + i;
605
605
  }
606
- function F(n, e, t, s) {
607
- const r = {}, i = { ...s || {} }, o = {};
608
- for (const [l, f] of Object.entries(n)) {
609
- const { value: c, modifiers: h } = f;
610
- switch (l) {
606
+ function re(e, t, r, n) {
607
+ const i = {}, s = { ...n || {} }, o = {};
608
+ for (const [c, d] of Object.entries(e)) {
609
+ const { value: a, modifiers: u } = d;
610
+ switch (c) {
611
611
  case "model":
612
- ee(
613
- typeof c == "string" ? c : String(c),
614
- h,
615
- r,
612
+ ce(
613
+ typeof a == "string" ? a : String(a),
614
+ u,
616
615
  i,
616
+ s,
617
617
  o,
618
- e,
619
- t
618
+ t,
619
+ r
620
620
  );
621
621
  break;
622
622
  case "bind":
623
- te(c, r, i, e);
623
+ fe(a, i, s, t);
624
624
  break;
625
625
  case "show":
626
- ne(c, i, e);
626
+ de(a, s, t);
627
627
  break;
628
628
  case "class":
629
- se(c, i, e);
629
+ ue(a, s, t);
630
630
  break;
631
631
  case "style":
632
- re(c, i, e);
632
+ he(a, s, t);
633
633
  break;
634
634
  }
635
635
  }
636
- return { props: r, attrs: i, listeners: o };
636
+ return { props: i, attrs: s, listeners: o };
637
637
  }
638
- function W(n, e) {
639
- if (Array.isArray(n)) {
640
- const i = /* @__PURE__ */ new Set();
641
- return n.map((o) => {
638
+ function J(e, t) {
639
+ if (Array.isArray(e)) {
640
+ const s = /* @__PURE__ */ new Set();
641
+ return e.map((o) => {
642
642
  if (!o || typeof o != "object") return o;
643
- let l = o.props?.key ?? o.key;
644
- if (!l) {
645
- const d = o.tag || "node", a = o.props?.attrs?.id ?? o.props?.attrs?.name ?? o.props?.attrs?.["data-key"] ?? "";
646
- l = a ? `${e}:${d}:${a}` : `${e}:${d}`;
643
+ let c = o.props?.key ?? o.key;
644
+ if (!c) {
645
+ const y = o.tag || "node", f = o.props?.attrs?.id ?? o.props?.attrs?.name ?? o.props?.attrs?.["data-key"] ?? "";
646
+ c = f ? `${t}:${y}:${f}` : `${t}:${y}`;
647
647
  }
648
- let f = l, c = 1;
649
- for (; i.has(f); )
650
- f = `${l}#${c++}`;
651
- i.add(f);
652
- let h = o.children;
653
- return Array.isArray(h) && (h = W(h, f)), { ...o, key: f, children: h };
648
+ let d = c, a = 1;
649
+ for (; s.has(d); )
650
+ d = `${c}#${a++}`;
651
+ s.add(d);
652
+ let u = o.children;
653
+ return Array.isArray(u) && (u = J(u, d)), { ...o, key: d, children: u };
654
654
  });
655
655
  }
656
- const t = n;
657
- let s = t.props?.key ?? t.key ?? e, r = t.children;
658
- return Array.isArray(r) && (r = W(r, s)), { ...t, key: s, children: r };
656
+ const r = e;
657
+ let n = r.props?.key ?? r.key ?? t, i = r.children;
658
+ return Array.isArray(i) && (i = J(i, n)), { ...r, key: n, children: i };
659
659
  }
660
- function ie(n, e, t, s) {
661
- const r = t.directives ?? {}, i = F(
662
- r,
663
- s,
660
+ function pe(e, t, r, n) {
661
+ const i = r.directives ?? {}, s = re(
662
+ i,
664
663
  n,
665
- t.attrs
664
+ e,
665
+ r.attrs
666
666
  ), o = {
667
- ...e.props,
668
667
  ...t.props,
669
- ...i.props
670
- }, l = {
671
- ...e.attrs,
668
+ ...r.props,
669
+ ...s.props
670
+ }, c = {
672
671
  ...t.attrs,
673
- ...i.attrs
674
- }, f = e.props ?? {}, c = o;
675
- for (const a in { ...f, ...c }) {
676
- const _ = f[a], b = c[a];
677
- _ !== b && (a === "value" && (n instanceof HTMLInputElement || n instanceof HTMLTextAreaElement || n instanceof HTMLSelectElement) ? n.value !== b && (n.value = b ?? "") : a === "checked" && n instanceof HTMLInputElement ? n.checked = !!b : a.startsWith("on") && typeof b == "function" ? (typeof _ == "function" && n.removeEventListener(a.slice(2).toLowerCase(), _), n.addEventListener(a.slice(2).toLowerCase(), b)) : b == null || b === !1 ? n.removeAttribute(a) : n.setAttribute(a, String(b)));
672
+ ...r.attrs,
673
+ ...s.attrs
674
+ }, d = t.props ?? {}, a = o;
675
+ for (const f in { ...d, ...a }) {
676
+ const w = d[f], p = a[f];
677
+ w !== p && (f === "value" && (e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLSelectElement) ? e.value !== p && (e.value = p ?? "") : f === "checked" && e instanceof HTMLInputElement ? e.checked = !!p : f.startsWith("on") && typeof p == "function" ? (typeof w == "function" && e.removeEventListener(f.slice(2).toLowerCase(), w), e.addEventListener(f.slice(2).toLowerCase(), p)) : p == null || p === !1 ? e.removeAttribute(f) : e.setAttribute(f, String(p)));
678
678
  }
679
- for (const [a, _] of Object.entries(
680
- i.listeners || {}
679
+ for (const [f, w] of Object.entries(
680
+ s.listeners || {}
681
681
  ))
682
- n.addEventListener(a, _);
683
- const h = e.attrs ?? {}, d = l;
684
- for (const a in { ...h, ...d }) {
685
- const _ = h[a], b = d[a];
686
- _ !== b && (b == null || b === !1 ? n.removeAttribute(a) : n.setAttribute(a, String(b)));
682
+ e.addEventListener(f, w);
683
+ const u = t.attrs ?? {}, y = c;
684
+ for (const f in { ...u, ...y }) {
685
+ const w = u[f], p = y[f];
686
+ w !== p && (p == null || p === !1 ? e.removeAttribute(f) : e.setAttribute(f, String(p)));
687
687
  }
688
688
  }
689
- function $(n, e) {
690
- if (typeof n == "string")
691
- return document.createTextNode(n);
692
- if (n.tag === "#text") {
693
- const c = document.createTextNode(
694
- typeof n.children == "string" ? n.children : ""
689
+ function T(e, t) {
690
+ if (typeof e == "string")
691
+ return document.createTextNode(e);
692
+ if (e.tag === "#text") {
693
+ const a = document.createTextNode(
694
+ typeof e.children == "string" ? e.children : ""
695
695
  );
696
- return n.key != null && (c.key = n.key), c;
696
+ return e.key != null && (a.key = e.key), a;
697
697
  }
698
- if (n.tag === "#anchor") {
699
- const c = n, h = Array.isArray(c.children) ? c.children : [], d = document.createTextNode(""), a = document.createTextNode("");
700
- c.key != null && (d.key = `${c.key}:start`, a.key = `${c.key}:end`), c._startNode = d, c._endNode = a;
701
- const _ = document.createDocumentFragment();
702
- _.appendChild(d);
703
- for (const b of h)
704
- _.appendChild($(b, e));
705
- return _.appendChild(a), _;
698
+ if (e.tag === "#anchor") {
699
+ const a = e, u = Array.isArray(a.children) ? a.children : [], y = document.createTextNode(""), f = document.createTextNode("");
700
+ a.key != null && (y.key = `${a.key}:start`, f.key = `${a.key}:end`), a._startNode = y, a._endNode = f;
701
+ const w = document.createDocumentFragment();
702
+ w.appendChild(y);
703
+ for (const p of u)
704
+ w.appendChild(T(p, t));
705
+ return w.appendChild(f), w;
706
706
  }
707
- const t = document.createElement(n.tag);
708
- n.key != null && (t.key = n.key);
709
- const { props: s = {}, attrs: r = {}, directives: i = {} } = n.props ?? {}, o = F(i, e, t, r), l = {
710
- ...s,
707
+ const r = document.createElement(e.tag);
708
+ e.key != null && (r.key = e.key);
709
+ const { props: n = {}, attrs: i = {}, directives: s = {} } = e.props ?? {}, o = re(s, t, r, i), c = {
710
+ ...n,
711
711
  ...o.props
712
- }, f = {
713
- ...r,
712
+ }, d = {
713
+ ...i,
714
714
  ...o.attrs
715
715
  };
716
- for (const c in f) {
717
- const h = f[c];
718
- typeof h == "boolean" ? h && t.setAttribute(c, "") : h != null && t.setAttribute(c, String(h));
716
+ for (const a in d) {
717
+ const u = d[a];
718
+ typeof u == "boolean" ? u && r.setAttribute(a, "") : u != null && r.setAttribute(a, String(u));
719
719
  }
720
- for (const c in l) {
721
- const h = l[c];
722
- if (c === "value" && (t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement))
723
- t.value = h ?? "";
724
- else if (c === "checked" && t instanceof HTMLInputElement)
725
- t.checked = !!h;
726
- else if (c.startsWith("on") && typeof h == "function")
727
- t.addEventListener(c.slice(2).toLowerCase(), h);
720
+ for (const a in c) {
721
+ const u = c[a];
722
+ if (a === "value" && (r instanceof HTMLInputElement || r instanceof HTMLTextAreaElement || r instanceof HTMLSelectElement))
723
+ r.value = u ?? "";
724
+ else if (a === "checked" && r instanceof HTMLInputElement)
725
+ r.checked = !!u;
726
+ else if (a.startsWith("on") && typeof u == "function")
727
+ r.addEventListener(a.slice(2).toLowerCase(), u);
728
728
  else {
729
- if (c.startsWith("on") && h === void 0)
729
+ if (a.startsWith("on") && u === void 0)
730
730
  continue;
731
- h == null || h === !1 ? t.removeAttribute(c) : t.setAttribute(c, String(h));
731
+ u == null || u === !1 ? r.removeAttribute(a) : r.setAttribute(a, String(u));
732
732
  }
733
733
  }
734
- for (const [c, h] of Object.entries(
734
+ for (const [a, u] of Object.entries(
735
735
  o.listeners || {}
736
736
  ))
737
- t.addEventListener(c, h);
738
- if (Array.isArray(n.children))
739
- for (const c of n.children)
740
- t.appendChild($(c, e));
741
- else typeof n.children == "string" && (t.textContent = n.children);
742
- return t;
737
+ r.addEventListener(a, u);
738
+ if (Array.isArray(e.children))
739
+ for (const a of e.children)
740
+ r.appendChild(T(a, t));
741
+ else typeof e.children == "string" && (r.textContent = e.children);
742
+ return r;
743
743
  }
744
- function oe(n, e, t, s) {
745
- if (typeof t == "string") {
746
- n.textContent !== t && (n.textContent = t);
744
+ function ge(e, t, r, n) {
745
+ if (typeof r == "string") {
746
+ e.textContent !== r && (e.textContent = r);
747
747
  return;
748
748
  }
749
- if (!Array.isArray(t)) return;
750
- const r = Array.from(n.childNodes), i = Array.isArray(e) ? e : [], o = /* @__PURE__ */ new Map();
751
- for (const a of i)
752
- a && a.key != null && o.set(a.key, a);
753
- const l = /* @__PURE__ */ new Map();
754
- for (const a of r) {
755
- const _ = a.key;
756
- _ != null && l.set(_, a);
749
+ if (!Array.isArray(r)) return;
750
+ const i = Array.from(e.childNodes), s = Array.isArray(t) ? t : [], o = /* @__PURE__ */ new Map();
751
+ for (const f of s)
752
+ f && f.key != null && o.set(f.key, f);
753
+ const c = /* @__PURE__ */ new Map();
754
+ for (const f of i) {
755
+ const w = f.key;
756
+ w != null && c.set(w, f);
757
757
  }
758
- const f = /* @__PURE__ */ new Set();
759
- let c = n.firstChild;
760
- function h(a, _) {
761
- let b = a;
762
- for (; b && (f.add(b), b !== _); )
763
- b = b.nextSibling;
758
+ const d = /* @__PURE__ */ new Set();
759
+ let a = e.firstChild;
760
+ function u(f, w) {
761
+ let p = f;
762
+ for (; p && (d.add(p), p !== w); )
763
+ p = p.nextSibling;
764
764
  }
765
- function d(a, _, b, T) {
766
- const k = [];
767
- let u = a.nextSibling;
768
- for (; u && u !== _; )
769
- k.push(u), u = u.nextSibling;
770
- const y = Array.isArray(b) ? b : [];
771
- if (T.some((g) => g && g.key != null) || y.some((g) => g && g.key != null)) {
772
- const g = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map();
773
- for (const C of y)
774
- C && C.key != null && g.set(C.key, C);
775
- for (const C of k) {
776
- const A = C.key;
777
- A != null && p.set(A, C);
765
+ function y(f, w, p, C) {
766
+ const g = [];
767
+ let l = f.nextSibling;
768
+ for (; l && l !== w; )
769
+ g.push(l), l = l.nextSibling;
770
+ const b = Array.isArray(p) ? p : [];
771
+ if (C.some((h) => h && h.key != null) || b.some((h) => h && h.key != null)) {
772
+ const h = /* @__PURE__ */ new Map(), x = /* @__PURE__ */ new Map();
773
+ for (const v of b)
774
+ v && v.key != null && h.set(v.key, v);
775
+ for (const v of g) {
776
+ const _ = v.key;
777
+ _ != null && x.set(_, v);
778
778
  }
779
- const x = /* @__PURE__ */ new Set();
780
- let S = a.nextSibling;
781
- for (const C of T) {
782
- let A;
783
- if (C.key != null && p.has(C.key)) {
784
- const E = g.get(C.key);
785
- A = V(
786
- p.get(C.key),
787
- E,
788
- C,
789
- s
790
- ), x.add(A), A !== S && n.contains(A) && n.insertBefore(A, S);
779
+ const S = /* @__PURE__ */ new Set();
780
+ let k = f.nextSibling;
781
+ for (const v of C) {
782
+ let _;
783
+ if (v.key != null && x.has(v.key)) {
784
+ const $ = h.get(v.key);
785
+ _ = I(
786
+ x.get(v.key),
787
+ $,
788
+ v,
789
+ n
790
+ ), S.add(_), _ !== k && e.contains(_) && e.insertBefore(_, k);
791
791
  } else
792
- A = $(C, s), n.insertBefore(A, S), x.add(A);
793
- S = A.nextSibling;
792
+ _ = T(v, n), e.insertBefore(_, k), S.add(_);
793
+ k = _.nextSibling;
794
794
  }
795
- for (const C of k)
796
- !x.has(C) && n.contains(C) && n.removeChild(C);
795
+ for (const v of g)
796
+ !S.has(v) && e.contains(v) && e.removeChild(v);
797
797
  } else {
798
- const g = Math.min(
799
- y.length,
800
- T.length
798
+ const h = Math.min(
799
+ b.length,
800
+ C.length
801
801
  );
802
- for (let p = 0; p < g; p++) {
803
- const x = y[p], S = T[p], C = V(k[p], x, S, s);
804
- C !== k[p] && (n.insertBefore(C, k[p]), n.removeChild(k[p]));
802
+ for (let x = 0; x < h; x++) {
803
+ const S = b[x], k = C[x], v = I(g[x], S, k, n);
804
+ v !== g[x] && (e.insertBefore(v, g[x]), e.removeChild(g[x]));
805
805
  }
806
- for (let p = g; p < T.length; p++)
807
- n.insertBefore($(T[p], s), _);
808
- for (let p = g; p < k.length; p++)
809
- n.removeChild(k[p]);
806
+ for (let x = h; x < C.length; x++)
807
+ e.insertBefore(T(C[x], n), w);
808
+ for (let x = h; x < g.length; x++)
809
+ e.removeChild(g[x]);
810
810
  }
811
811
  }
812
- for (const a of t) {
813
- let _;
814
- if (a.tag === "#anchor") {
815
- const b = a.key, T = `${b}:start`, k = `${b}:end`;
816
- let u = l.get(T), y = l.get(k);
817
- const m = Array.isArray(a.children) ? a.children : [];
818
- if (u || (u = document.createTextNode(""), u.key = T), y || (y = document.createTextNode(""), y.key = k), a._startNode = u, a._endNode = y, !n.contains(u) || !n.contains(y)) {
819
- n.insertBefore(u, c);
820
- for (const g of m)
821
- n.insertBefore($(g, s), c);
822
- n.insertBefore(y, c);
812
+ for (const f of r) {
813
+ let w;
814
+ if (f.tag === "#anchor") {
815
+ const p = f.key, C = `${p}:start`, g = `${p}:end`;
816
+ let l = c.get(C), b = c.get(g);
817
+ const m = Array.isArray(f.children) ? f.children : [];
818
+ if (l || (l = document.createTextNode(""), l.key = C), b || (b = document.createTextNode(""), b.key = g), f._startNode = l, f._endNode = b, !e.contains(l) || !e.contains(b)) {
819
+ e.insertBefore(l, a);
820
+ for (const h of m)
821
+ e.insertBefore(T(h, n), a);
822
+ e.insertBefore(b, a);
823
823
  } else
824
- d(
825
- u,
826
- y,
827
- o.get(b)?.children,
824
+ y(
825
+ l,
826
+ b,
827
+ o.get(p)?.children,
828
828
  m
829
829
  );
830
- h(u, y), c = y.nextSibling;
830
+ u(l, b), a = b.nextSibling;
831
831
  continue;
832
832
  }
833
- if (a.key != null && l.has(a.key)) {
834
- const b = o.get(a.key);
835
- _ = V(
836
- l.get(a.key),
837
- b,
838
- a,
839
- s
840
- ), f.add(_), _ !== c && n.contains(_) && (c && !n.contains(c) && (c = null), n.insertBefore(_, c));
833
+ if (f.key != null && c.has(f.key)) {
834
+ const p = o.get(f.key);
835
+ w = I(
836
+ c.get(f.key),
837
+ p,
838
+ f,
839
+ n
840
+ ), d.add(w), w !== a && e.contains(w) && (a && !e.contains(a) && (a = null), e.insertBefore(w, a));
841
841
  } else
842
- _ = $(a, s), c && !n.contains(c) && (c = null), n.insertBefore(_, c), f.add(_);
843
- c = _.nextSibling;
842
+ w = T(f, n), a && !e.contains(a) && (a = null), e.insertBefore(w, a), d.add(w);
843
+ a = w.nextSibling;
844
844
  }
845
- for (const a of r)
846
- !f.has(a) && n.contains(a) && n.removeChild(a);
845
+ for (const f of i)
846
+ !d.has(f) && e.contains(f) && e.removeChild(f);
847
847
  }
848
- function V(n, e, t, s) {
849
- if (e === t) return n;
850
- if (typeof t == "string") {
851
- if (n.nodeType === Node.TEXT_NODE)
852
- return n.textContent !== t && (n.textContent = t), n;
848
+ function I(e, t, r, n) {
849
+ if (t === r) return e;
850
+ if (typeof r == "string") {
851
+ if (e.nodeType === Node.TEXT_NODE)
852
+ return e.textContent !== r && (e.textContent = r), e;
853
853
  {
854
- const i = document.createTextNode(t);
855
- return n.parentNode?.replaceChild(i, n), i;
854
+ const s = document.createTextNode(r);
855
+ return e.parentNode?.replaceChild(s, e), s;
856
856
  }
857
857
  }
858
- if (t && typeof t != "string" && t.tag === "#anchor") {
859
- const i = t, o = Array.isArray(i.children) ? i.children : [], l = i._startNode ?? document.createTextNode(""), f = i._endNode ?? document.createTextNode("");
860
- i.key != null && (l.key = `${i.key}:start`, f.key = `${i.key}:end`), i._startNode = l, i._endNode = f;
861
- const c = document.createDocumentFragment();
862
- c.appendChild(l);
863
- for (const h of o)
864
- c.appendChild($(h, s));
865
- return c.appendChild(f), n.parentNode?.replaceChild(c, n), l;
858
+ if (r && typeof r != "string" && r.tag === "#anchor") {
859
+ const s = r, o = Array.isArray(s.children) ? s.children : [], c = s._startNode ?? document.createTextNode(""), d = s._endNode ?? document.createTextNode("");
860
+ s.key != null && (c.key = `${s.key}:start`, d.key = `${s.key}:end`), s._startNode = c, s._endNode = d;
861
+ const a = document.createDocumentFragment();
862
+ a.appendChild(c);
863
+ for (const u of o)
864
+ a.appendChild(T(u, n));
865
+ return a.appendChild(d), e.parentNode?.replaceChild(a, e), c;
866
866
  }
867
- if (!t) {
868
- const i = document.createComment("removed");
869
- return n.parentNode?.replaceChild(i, n), i;
867
+ if (!r) {
868
+ const s = document.createComment("removed");
869
+ return e.parentNode?.replaceChild(s, e), s;
870
870
  }
871
- if (!e || typeof e == "string") {
872
- const i = $(t, s);
873
- return n.parentNode?.replaceChild(i, n), i;
871
+ if (!t || typeof t == "string") {
872
+ const s = T(r, n);
873
+ return e.parentNode?.replaceChild(s, e), s;
874
874
  }
875
- if (t.tag === "#anchor") {
876
- const i = Array.isArray(t.children) ? t.children : [], o = t._startNode ?? document.createTextNode(""), l = t._endNode ?? document.createTextNode("");
877
- t.key != null && (o.key = `${t.key}:start`, l.key = `${t.key}:end`), t._startNode = o, t._endNode = l;
878
- const f = document.createDocumentFragment();
879
- f.appendChild(o);
880
- for (const c of i)
881
- f.appendChild($(c, s));
882
- return f.appendChild(l), n.parentNode?.replaceChild(f, n), o;
875
+ if (r.tag === "#anchor") {
876
+ const s = Array.isArray(r.children) ? r.children : [], o = r._startNode ?? document.createTextNode(""), c = r._endNode ?? document.createTextNode("");
877
+ r.key != null && (o.key = `${r.key}:start`, c.key = `${r.key}:end`), r._startNode = o, r._endNode = c;
878
+ const d = document.createDocumentFragment();
879
+ d.appendChild(o);
880
+ for (const a of s)
881
+ d.appendChild(T(a, n));
882
+ return d.appendChild(c), e.parentNode?.replaceChild(d, e), o;
883
883
  }
884
- if (typeof e != "string" && typeof t != "string" && e.tag === t.tag && e.key === t.key) {
885
- const i = n;
886
- return ie(i, e.props || {}, t.props || {}, s), oe(i, e.children, t.children, s), i;
884
+ if (typeof t != "string" && typeof r != "string" && t.tag === r.tag && t.key === r.key) {
885
+ const s = e;
886
+ return pe(s, t.props || {}, r.props || {}, n), ge(s, t.children, r.children, n), s;
887
887
  }
888
- const r = $(t, s);
889
- return n.parentNode?.replaceChild(r, n), r;
888
+ const i = T(r, n);
889
+ return e.parentNode?.replaceChild(i, e), i;
890
890
  }
891
- function ce(n, e, t) {
892
- const s = (c) => c.key == null ? { ...c, key: "__root__" } : c;
893
- let r = Array.isArray(e) ? { tag: "div", key: "__root__", children: e } : s(e);
894
- r = W(r, String(r.key ?? "root"));
895
- const i = n._prevVNode ?? null, o = n._prevDom ?? n.firstChild ?? null;
896
- let l;
897
- i && o ? typeof i != "string" && typeof r != "string" && i.tag === r.tag && i.key === r.key ? l = V(o, i, r, t) : (l = $(r, t), n.replaceChild(l, o)) : (l = $(r, t), n.firstChild ? n.replaceChild(l, n.firstChild) : n.appendChild(l));
898
- const f = [];
899
- for (let c = 0; c < n.childNodes.length; c++) {
900
- const h = n.childNodes[c];
901
- h !== l && h.nodeName !== "STYLE" && f.push(h);
891
+ function me(e, t, r) {
892
+ const n = (a) => a.key == null ? { ...a, key: "__root__" } : a;
893
+ let i = Array.isArray(t) ? { tag: "div", key: "__root__", children: t } : n(t);
894
+ i = J(i, String(i.key ?? "root"));
895
+ const s = e._prevVNode ?? null, o = e._prevDom ?? e.firstChild ?? null;
896
+ let c;
897
+ s && o ? typeof s != "string" && typeof i != "string" && s.tag === i.tag && s.key === i.key ? c = I(o, s, i, r) : (c = T(i, r), e.replaceChild(c, o)) : (c = T(i, r), e.firstChild ? e.replaceChild(c, e.firstChild) : e.appendChild(c));
898
+ const d = [];
899
+ for (let a = 0; a < e.childNodes.length; a++) {
900
+ const u = e.childNodes[a];
901
+ u !== c && u.nodeName !== "STYLE" && d.push(u);
902
902
  }
903
- f.forEach((c) => n.removeChild(c)), n._prevVNode = r, n._prevDom = l;
903
+ d.forEach((a) => e.removeChild(a)), e._prevVNode = i, e._prevDom = c;
904
904
  }
905
- class le {
906
- cache = /* @__PURE__ */ new Map();
907
- maxSize;
908
- accessOrder = /* @__PURE__ */ new Map();
909
- accessCounter = 0;
910
- constructor(e = 100) {
911
- this.maxSize = e;
912
- }
913
- set(e, t, s = []) {
914
- this.cache.size >= this.maxSize && this.evictOldest(), this.cache.set(e, {
915
- css: t,
916
- timestamp: Date.now(),
917
- dependencies: s
918
- }), this.accessOrder.set(e, ++this.accessCounter);
919
- }
920
- get(e) {
921
- const t = this.cache.get(e);
922
- return t ? (this.accessOrder.set(e, ++this.accessCounter), t.css) : null;
923
- }
924
- has(e) {
925
- return this.cache.has(e);
926
- }
927
- invalidate(e) {
928
- const t = [];
929
- for (const [s, r] of this.cache)
930
- r.dependencies.includes(e) && t.push(s);
931
- t.forEach((s) => {
932
- this.cache.delete(s), this.accessOrder.delete(s);
933
- });
934
- }
935
- clear() {
936
- this.cache.clear(), this.accessOrder.clear(), this.accessCounter = 0;
937
- }
938
- evictOldest() {
939
- let e = "", t = 1 / 0;
940
- for (const [s, r] of this.accessOrder)
941
- r < t && (t = r, e = s);
942
- e && (this.cache.delete(e), this.accessOrder.delete(e));
905
+ function ye(e) {
906
+ return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
907
+ }
908
+ const be = `
909
+ :host {
910
+ box-sizing:border-box;
911
+ line-height:1.5;
912
+ font-family:ui-sans-serif,system-ui,sans-serif;
913
+ -webkit-text-size-adjust:100%;
914
+ text-size-adjust:100%;
943
915
  }
944
- getStats() {
945
- return {
946
- size: this.cache.size,
947
- maxSize: this.maxSize,
948
- hitRate: this.accessCounter > 0 ? this.cache.size / this.accessCounter : 0
949
- };
916
+ *,::before,::after {
917
+ box-sizing:inherit;
918
+ margin:0;
919
+ padding:0;
920
+ border:0 solid currentColor;
950
921
  }
922
+ `, xe = {
923
+ gray: {
924
+ 50: "var(--color-gray-50, #f9fafb)",
925
+ 100: "var(--color-gray-100, #f3f4f6)",
926
+ 200: "var(--color-gray-200, #e5e7eb)",
927
+ 300: "var(--color-gray-300, #d1d5db)",
928
+ 400: "var(--color-gray-400, #9ca3af)",
929
+ 500: "var(--color-gray-500, #6b7280)",
930
+ 600: "var(--color-gray-600, #4b5563)",
931
+ 700: "var(--color-gray-700, #374151)",
932
+ 800: "var(--color-gray-800, #1f2937)",
933
+ 900: "var(--color-gray-900, #111827)"
934
+ },
935
+ slate: {
936
+ 50: "var(--color-slate-50, #f8fafc)",
937
+ 100: "var(--color-slate-100, #f1f5f9)",
938
+ 200: "var(--color-slate-200, #e2e8f0)",
939
+ 300: "var(--color-slate-300, #cbd5e1)",
940
+ 400: "var(--color-slate-400, #94a3b8)",
941
+ 500: "var(--color-slate-500, #64748b)",
942
+ 600: "var(--color-slate-600, #475569)",
943
+ 700: "var(--color-slate-700, #334155)",
944
+ 800: "var(--color-slate-800, #1e293b)",
945
+ 900: "var(--color-slate-900, #0f172a)"
946
+ },
947
+ zinc: {
948
+ 50: "var(--color-zinc-50, #fafafa)",
949
+ 100: "var(--color-zinc-100, #f4f4f5)",
950
+ 200: "var(--color-zinc-200, #e4e4e7)",
951
+ 300: "var(--color-zinc-300, #d4d4d8)",
952
+ 400: "var(--color-zinc-400, #a1a1aa)",
953
+ 500: "var(--color-zinc-500, #71717a)",
954
+ 600: "var(--color-zinc-600, #52525b)",
955
+ 700: "var(--color-zinc-700, #3f3f46)",
956
+ 800: "var(--color-zinc-800, #27272a)",
957
+ 900: "var(--color-zinc-900, #18181b)"
958
+ },
959
+ red: {
960
+ 50: "var(--color-red-50, #fef2f2)",
961
+ 100: "var(--color-red-100, #fee2e2)",
962
+ 200: "var(--color-red-200, #fecaca)",
963
+ 300: "var(--color-red-300, #fca5a5)",
964
+ 400: "var(--color-red-400, #f87171)",
965
+ 500: "var(--color-red-500, #ef4444)",
966
+ 600: "var(--color-red-600, #dc2626)",
967
+ 700: "var(--color-red-700, #b91c1c)",
968
+ 800: "var(--color-red-800, #991b1b)",
969
+ 900: "var(--color-red-900, #7f1d1d)"
970
+ },
971
+ blue: {
972
+ 50: "var(--color-blue-50, #eff6ff)",
973
+ 100: "var(--color-blue-100, #dbeafe)",
974
+ 200: "var(--color-blue-200, #bfdbfe)",
975
+ 300: "var(--color-blue-300, #93c5fd)",
976
+ 400: "var(--color-blue-400, #60a5fa)",
977
+ 500: "var(--color-blue-500, #3b82f6)",
978
+ 600: "var(--color-blue-600, #2563eb)",
979
+ 700: "var(--color-blue-700, #1d4ed8)",
980
+ 800: "var(--color-blue-800, #1e40af)",
981
+ 900: "var(--color-blue-900, #1e3a8a)"
982
+ },
983
+ green: {
984
+ 50: "var(--color-green-50, #f0fdf4)",
985
+ 100: "var(--color-green-100, #dcfce7)",
986
+ 200: "var(--color-green-200, #bbf7d0)",
987
+ 300: "var(--color-green-300, #86efac)",
988
+ 400: "var(--color-green-400, #4ade80)",
989
+ 500: "var(--color-green-500, #22c55e)",
990
+ 600: "var(--color-green-600, #16a34a)",
991
+ 700: "var(--color-green-700, #15803d)",
992
+ 800: "var(--color-green-800, #166534)",
993
+ 900: "var(--color-green-900, #14532d)"
994
+ },
995
+ amber: {
996
+ 50: "var(--color-amber-50, #fffbeb)",
997
+ 100: "var(--color-amber-100, #fef3c7)",
998
+ 200: "var(--color-amber-200, #fde68a)",
999
+ 300: "var(--color-amber-300, #fcd34d)",
1000
+ 400: "var(--color-amber-400, #fbbf24)",
1001
+ 500: "var(--color-amber-500, #f59e0b)",
1002
+ 600: "var(--color-amber-600, #d97706)",
1003
+ 700: "var(--color-amber-700, #b45309)",
1004
+ 800: "var(--color-amber-800, #92400e)",
1005
+ 900: "var(--color-amber-900, #78350f)"
1006
+ },
1007
+ indigo: {
1008
+ 50: "var(--color-indigo-50, #eef2ff)",
1009
+ 100: "var(--color-indigo-100, #e0e7ff)",
1010
+ 200: "var(--color-indigo-200, #c7d2fe)",
1011
+ 300: "var(--color-indigo-300, #a5b4fc)",
1012
+ 400: "var(--color-indigo-400, #818cf8)",
1013
+ 500: "var(--color-indigo-500, #6366f1)",
1014
+ 600: "var(--color-indigo-600, #4f46e5)",
1015
+ 700: "var(--color-indigo-700, #4338ca)",
1016
+ 800: "var(--color-indigo-800, #3730a3)",
1017
+ 900: "var(--color-indigo-900, #312e81)"
1018
+ },
1019
+ emerald: {
1020
+ 50: "var(--color-emerald-50, #ecfdf5)",
1021
+ 100: "var(--color-emerald-100, #d1fae5)",
1022
+ 200: "var(--color-emerald-200, #a7f3d0)",
1023
+ 300: "var(--color-emerald-300, #6ee7b7)",
1024
+ 400: "var(--color-emerald-400, #34d399)",
1025
+ 500: "var(--color-emerald-500, #10b981)",
1026
+ 600: "var(--color-emerald-600, #059669)",
1027
+ 700: "var(--color-emerald-700, #047857)",
1028
+ 800: "var(--color-emerald-800, #065f46)",
1029
+ 900: "var(--color-emerald-900, #064e3b)"
1030
+ },
1031
+ rose: {
1032
+ 50: "var(--color-rose-50, #fff1f2)",
1033
+ 100: "var(--color-rose-100, #ffe4e6)",
1034
+ 200: "var(--color-rose-200, #fecdd3)",
1035
+ 300: "var(--color-rose-300, #fda4af)",
1036
+ 400: "var(--color-rose-400, #fb7185)",
1037
+ 500: "var(--color-rose-500, #f43f5e)",
1038
+ 600: "var(--color-rose-600, #e11d48)",
1039
+ 700: "var(--color-rose-700, #be123c)",
1040
+ 800: "var(--color-rose-800, #9f1239)",
1041
+ 900: "var(--color-rose-900, #881337)"
1042
+ },
1043
+ white: { DEFAULT: "var(--color-white, #ffffff)" },
1044
+ black: { DEFAULT: "var(--color-black, #000000)" }
1045
+ }, W = {
1046
+ /* Display */
1047
+ block: "display:block;",
1048
+ inline: "display:inline;",
1049
+ "inline-block": "display:inline-block;",
1050
+ flex: "display:flex;",
1051
+ "inline-flex": "display:inline-flex;",
1052
+ grid: "display:grid;",
1053
+ hidden: "display:none;",
1054
+ /* Accessibility */
1055
+ "sr-only": "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border-width:0;",
1056
+ "not-sr-only": "position:static;width:auto;height:auto;padding:0;margin:0;overflow:visible;clip:auto;white-space:normal;",
1057
+ /* Grid Layout */
1058
+ "grid-cols-1": "grid-template-columns:repeat(1,minmax(0,1fr));",
1059
+ "grid-cols-2": "grid-template-columns:repeat(2,minmax(0,1fr));",
1060
+ "grid-cols-3": "grid-template-columns:repeat(3,minmax(0,1fr));",
1061
+ "grid-cols-4": "grid-template-columns:repeat(4,minmax(0,1fr));",
1062
+ "grid-cols-5": "grid-template-columns:repeat(5,minmax(0,1fr));",
1063
+ "grid-cols-6": "grid-template-columns:repeat(6,minmax(0,1fr));",
1064
+ "grid-cols-12": "grid-template-columns:repeat(12,minmax(0,1fr));",
1065
+ "grid-rows-1": "grid-template-rows:repeat(1,minmax(0,1fr));",
1066
+ "grid-rows-2": "grid-template-rows:repeat(2,minmax(0,1fr));",
1067
+ "grid-rows-3": "grid-template-rows:repeat(3,minmax(0,1fr));",
1068
+ "grid-rows-4": "grid-template-rows:repeat(4,minmax(0,1fr));",
1069
+ "grid-rows-6": "grid-template-rows:repeat(6,minmax(0,1fr));",
1070
+ "grid-rows-12": "grid-template-rows:repeat(12,minmax(0,1fr));",
1071
+ /* Grid Placement */
1072
+ "col-span-1": "grid-column:span 1 / span 1;",
1073
+ "col-span-2": "grid-column:span 2 / span 2;",
1074
+ "col-span-3": "grid-column:span 3 / span 3;",
1075
+ "col-span-4": "grid-column:span 4 / span 4;",
1076
+ "col-span-5": "grid-column:span 5 / span 5;",
1077
+ "col-span-6": "grid-column:span 6 / span 6;",
1078
+ "col-span-12": "grid-column:span 12 / span 12;",
1079
+ "row-span-1": "grid-row:span 1 / span 1;",
1080
+ "row-span-2": "grid-row:span 2 / span 2;",
1081
+ "row-span-3": "grid-row:span 3 / span 3;",
1082
+ "row-span-4": "grid-row:span 4 / span 4;",
1083
+ "row-span-6": "grid-row:span 6 / span 6;",
1084
+ "row-span-12": "grid-row:span 12 / span 12;",
1085
+ /* Positioning */
1086
+ absolute: "position:absolute;",
1087
+ relative: "position:relative;",
1088
+ fixed: "position:fixed;",
1089
+ sticky: "position:sticky;",
1090
+ /* Typography */
1091
+ "font-bold": "font-weight:700;",
1092
+ "font-semibold": "font-weight:600;",
1093
+ "font-medium": "font-weight:500;",
1094
+ "font-light": "font-weight:300;",
1095
+ underline: "text-decoration-line:underline;",
1096
+ overline: "text-decoration-line:overline;",
1097
+ "line-through": "text-decoration-line:line-through;",
1098
+ "no-underline": "text-decoration-line:none;",
1099
+ italic: "font-style:italic;",
1100
+ "not-italic": "font-style:normal;",
1101
+ uppercase: "text-transform:uppercase;",
1102
+ lowercase: "text-transform:lowercase;",
1103
+ capitalize: "text-transform:capitalize;",
1104
+ "normal-case": "text-transform:none;",
1105
+ "text-left": "text-align:left;",
1106
+ "text-center": "text-align:center;",
1107
+ "text-right": "text-align:right;",
1108
+ "text-xs": "font-size:0.75rem;line-height:calc(1 / 0.75)",
1109
+ "text-sm": "font-size:0.875rem;line-height:calc(1.25 / 0.875)",
1110
+ "text-base": "font-size:1rem;line-height:calc(1.5 / 1)",
1111
+ "text-lg": "font-size:1.125rem;line-height:calc(1.75 / 1.125)",
1112
+ "text-xl": "font-size:1.25rem;line-height:calc(1.75 / 1.25)",
1113
+ "text-2xl": "font-size:1.5rem;line-height:calc(2 / 1.5)",
1114
+ "text-3xl": "font-size:1.875rem;line-height:calc(2.25 / 1.875)",
1115
+ "text-4xl": "font-size:2.25rem;line-height:calc(2.5 / 2.25)",
1116
+ "text-5xl": "font-size:3rem;line-height:1",
1117
+ "text-6xl": "font-size:3.75rem;line-height:1",
1118
+ "text-7xl": "font-size:4.5rem;line-height:1",
1119
+ "text-8xl": "font-size:6rem;line-height:1",
1120
+ /* Borders */
1121
+ border: "border-width:1px;",
1122
+ "rounded-none": "border-radius:0;",
1123
+ "rounded-xs": "border-radius:0.125rem;",
1124
+ "rounded-sm": "border-radius:0.25rem;",
1125
+ "rounded-md": "border-radius:0.375rem;",
1126
+ "rounded-lg": "border-radius:0.5rem;",
1127
+ "rounded-full": "border-radius:9999px;",
1128
+ /* Ring (box-shadow for focus) */
1129
+ "ring-0": "box-shadow:none;",
1130
+ "ring-1": "box-shadow:0 0 0 1px rgba(59,130,246,0.5);",
1131
+ "ring-2": "box-shadow:0 0 0 2px rgba(59,130,246,0.5);",
1132
+ "ring-4": "box-shadow:0 0 0 4px rgba(59,130,246,0.5);",
1133
+ "ring-8": "box-shadow:0 0 0 8px rgba(59,130,246,0.5);",
1134
+ /* Shadow and effects */
1135
+ "shadow-none": "box-shadow:0 0 #0000;",
1136
+ "shadow-xs": "box-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);",
1137
+ "shadow-sm": "box-shadow:0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);",
1138
+ "shadow-md": "box-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);",
1139
+ "shadow-lg": "box-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);",
1140
+ "shadow-xl": "box-shadow:0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);",
1141
+ "shadow-2xl": "box-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);",
1142
+ /* Transitions */
1143
+ transition: "transition-property:all;transition-duration:150ms;transition-timing-function:cubic-bezier(0.4,0,0.2,1);",
1144
+ /* Text Overflow & Whitespace */
1145
+ truncate: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;",
1146
+ /* Visibility */
1147
+ visible: "visibility:visible;",
1148
+ invisible: "visibility:hidden;",
1149
+ /* Flex Grow/Shrink/Basis */
1150
+ grow: "flex-grow:1;",
1151
+ shrink: "flex-shrink:1;",
1152
+ "grow-0": "flex-grow:0;",
1153
+ "shrink-0": "flex-shrink:0;",
1154
+ /* Font Family */
1155
+ "font-sans": "font-family:ui-sans-serif,system-ui,sans-serif;",
1156
+ "font-serif": "font-family:ui-serif,Georgia,serif;",
1157
+ "font-mono": "font-family:ui-monospace,SFMono-Regular,monospace;",
1158
+ /* Line Clamp (for webkit) */
1159
+ "line-clamp-1": "display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden;",
1160
+ "line-clamp-2": "display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;",
1161
+ "line-clamp-3": "display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;",
1162
+ "line-clamp-4": "display:-webkit-box;-webkit-line-clamp:4;-webkit-box-orient:vertical;overflow:hidden;",
1163
+ /* Transition Delay/Property */
1164
+ "transition-colors": "transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;",
1165
+ "transition-opacity": "transition-property:opacity;",
1166
+ "transition-transform": "transition-property:transform;"
1167
+ }, ve = "0.25rem", Y = {
1168
+ m: ["margin"],
1169
+ mx: ["margin-inline"],
1170
+ my: ["margin-block"],
1171
+ mt: ["margin-top"],
1172
+ mr: ["margin-right"],
1173
+ mb: ["margin-bottom"],
1174
+ ml: ["margin-left"],
1175
+ p: ["padding"],
1176
+ px: ["padding-inline"],
1177
+ py: ["padding-block"],
1178
+ pt: ["padding-top"],
1179
+ pr: ["padding-right"],
1180
+ pb: ["padding-bottom"],
1181
+ pl: ["padding-left"],
1182
+ inset: ["inset"],
1183
+ "inset-x": ["inset-inline"],
1184
+ "inset-y": ["inset-block"],
1185
+ top: ["top"],
1186
+ bottom: ["bottom"],
1187
+ left: ["left"],
1188
+ right: ["right"],
1189
+ gap: ["gap"],
1190
+ "gap-x": ["column-gap"],
1191
+ "gap-y": ["row-gap"]
1192
+ }, we = {
1193
+ // State variants
1194
+ before: (e, t) => `${e}::before{${t}}`,
1195
+ after: (e, t) => `${e}::after{${t}}`,
1196
+ hover: (e, t) => `${e}:hover{${t}}`,
1197
+ focus: (e, t) => `${e}:focus{${t}}`,
1198
+ active: (e, t) => `${e}:active{${t}}`,
1199
+ disabled: (e, t) => `${e}:disabled{${t}}`,
1200
+ visited: (e, t) => `${e}:visited{${t}}`,
1201
+ checked: (e, t) => `${e}:checked{${t}}`,
1202
+ first: (e, t) => `${e}:first-child{${t}}`,
1203
+ last: (e, t) => `${e}:last-child{${t}}`,
1204
+ odd: (e, t) => `${e}:nth-child(odd){${t}}`,
1205
+ even: (e, t) => `${e}:nth-child(even){${t}}`,
1206
+ "focus-within": (e, t) => `${e}:focus-within{${t}}`,
1207
+ "focus-visible": (e, t) => `${e}:focus-visible{${t}}`,
1208
+ // Group variants
1209
+ "group-hover": (e, t) => `.group:hover ${e}{${t}}`,
1210
+ "group-focus": (e, t) => `.group:focus ${e}{${t}}`,
1211
+ "group-active": (e, t) => `.group:active ${e}{${t}}`,
1212
+ "group-disabled": (e, t) => `.group:disabled ${e}{${t}}`,
1213
+ // Peer variants
1214
+ "peer-hover": (e, t) => `.peer:hover ~ ${e}{${t}}`,
1215
+ "peer-focus": (e, t) => `.peer:focus ~ ${e}{${t}}`,
1216
+ "peer-checked": (e, t) => `.peer:checked ~ ${e}{${t}}`,
1217
+ "peer-disabled": (e, t) => `.peer:disabled ~ ${e}{${t}}`
1218
+ }, G = {
1219
+ // Responsive
1220
+ sm: "(min-width:640px)",
1221
+ md: "(min-width:768px)",
1222
+ lg: "(min-width:1024px)",
1223
+ xl: "(min-width:1280px)",
1224
+ "2xl": "(min-width:1536px)",
1225
+ // Dark mode (now plain string)
1226
+ dark: "(prefers-color-scheme: dark)"
1227
+ }, K = ["sm", "md", "lg", "xl", "2xl"];
1228
+ function F(e) {
1229
+ const t = e.startsWith("-"), n = (t ? e.slice(1) : e).split("-");
1230
+ if (n.length < 2) return null;
1231
+ const i = n.slice(0, -1).join("-"), s = n[n.length - 1], o = parseFloat(s);
1232
+ if (Number.isNaN(o) || !Y[i]) return null;
1233
+ const c = t ? "-" : "";
1234
+ return Y[i].map((d) => `${d}:calc(${c}${ve} * ${o});`).join("");
1235
+ }
1236
+ function ee(e) {
1237
+ const t = e.replace("#", ""), r = parseInt(t, 16), n = r >> 16 & 255, i = r >> 8 & 255, s = r & 255;
1238
+ return `${n} ${i} ${s}`;
951
1239
  }
952
- function ae(n) {
953
- return n.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
1240
+ function ke(e) {
1241
+ const t = /^(bg|text|border|shadow|outline|caret|accent)-([a-z]+)-?(\d{2,3}|DEFAULT)?$/.exec(e);
1242
+ if (!t) return null;
1243
+ const [, r, n, i = "DEFAULT"] = t, s = xe[n]?.[i];
1244
+ return s ? `${{
1245
+ bg: "background-color",
1246
+ text: "color",
1247
+ border: "border-color",
1248
+ shadow: "box-shadow",
1249
+ outline: "outline-color",
1250
+ caret: "caret-color",
1251
+ accent: "accent-color"
1252
+ }[r]}:${s};` : null;
954
1253
  }
955
- function ue(n) {
956
- try {
957
- return JSON.stringify(n, (e, t) => {
958
- if (typeof t == "function")
959
- return t.toString();
960
- if (typeof t == "object" && t !== null) {
961
- if (t.__hashed) return "[Circular]";
962
- t.__hashed = !0;
963
- const s = { ...t };
964
- return delete s.__hashed, s;
1254
+ function _e(e) {
1255
+ const [t, r] = e.split("/");
1256
+ if (!r) return { base: t };
1257
+ const n = parseInt(r, 10);
1258
+ return isNaN(n) || n < 0 || n > 100 ? { base: t } : { base: t, opacity: n / 100 };
1259
+ }
1260
+ function U(e) {
1261
+ const { base: t, opacity: r } = _e(e), n = ke(t);
1262
+ if (n) {
1263
+ if (r !== void 0) {
1264
+ const s = /#([0-9a-f]{6})/i.exec(n);
1265
+ if (s) {
1266
+ const o = ee(s[0]);
1267
+ return n.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
965
1268
  }
966
- return t;
967
- });
968
- } catch {
969
- return n.map((e) => String(e)).join("|");
1269
+ }
1270
+ return n;
1271
+ }
1272
+ const i = D(t);
1273
+ if (i && r !== void 0) {
1274
+ const s = /#([0-9a-f]{6})/i.exec(i);
1275
+ if (s) {
1276
+ const o = ee(s[0]);
1277
+ return i.replace(/#([0-9a-f]{6})/i, `rgb(${o} / ${r})`);
1278
+ }
970
1279
  }
1280
+ return i;
971
1281
  }
972
- function fe(n) {
973
- const e = n.split("}").filter((r) => r.trim()), t = /* @__PURE__ */ new Set(), s = [];
974
- for (const r of e) {
975
- const i = r.trim().replace(/\s+/g, " ");
976
- i && !t.has(i) && (t.add(i), s.push(r + "}"));
1282
+ function D(e) {
1283
+ const t = e.indexOf("-["), r = e.endsWith("]");
1284
+ if (t > 0 && r) {
1285
+ const n = e.slice(0, t);
1286
+ let i = e.slice(t + 2, -1);
1287
+ i = i.replace(/_/g, " ");
1288
+ const o = {
1289
+ bg: "background-color",
1290
+ text: "color",
1291
+ p: "padding",
1292
+ px: "padding-inline",
1293
+ py: "padding-block",
1294
+ m: "margin",
1295
+ mx: "margin-inline",
1296
+ my: "margin-block",
1297
+ w: "width",
1298
+ h: "height",
1299
+ "min-w": "min-width",
1300
+ "max-w": "max-width",
1301
+ "min-h": "min-height",
1302
+ "max-h": "max-height",
1303
+ "border-t": "border-top",
1304
+ "border-b": "border-bottom",
1305
+ "border-l": "border-left",
1306
+ "border-r": "border-right",
1307
+ "border-x": "border-inline",
1308
+ "border-y": "border-block",
1309
+ shadow: "box-shadow",
1310
+ duration: "transition-duration",
1311
+ list: "list-style",
1312
+ break: "word-break",
1313
+ flex: "flex-direction",
1314
+ items: "align-items",
1315
+ justify: "justify-content",
1316
+ whitespace: "white-space",
1317
+ select: "user-select",
1318
+ content: "align-content",
1319
+ self: "align-self",
1320
+ basis: "flex-basis",
1321
+ tracking: "letter-spacing",
1322
+ scroll: "scroll-behavior",
1323
+ delay: "transition-delay",
1324
+ weight: "font-weight",
1325
+ leading: "line-height",
1326
+ z: "z-index"
1327
+ }[n] ?? n.replace(/_/g, "-");
1328
+ if (o && i) return `${o}:${i};`;
977
1329
  }
978
- return s.join("").replace(/}$/, "");
1330
+ return null;
979
1331
  }
980
- function he(n, e) {
981
- let t = null;
982
- const s = ((...r) => {
983
- t !== null && clearTimeout(t), t = setTimeout(() => {
984
- n(...r), t = null;
985
- }, e);
986
- });
987
- return s.cancel = () => {
988
- t !== null && (clearTimeout(t), t = null);
989
- }, s;
1332
+ function $e(e) {
1333
+ return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
990
1334
  }
991
- class de {
992
- metrics = /* @__PURE__ */ new Map();
993
- startTimer(e) {
994
- const t = performance.now();
995
- return () => {
996
- const s = performance.now() - t;
997
- return this.recordMetric(e, s), s;
998
- };
1335
+ function Ce(e) {
1336
+ const t = /class\s*=\s*["']([^"']+)["']/g, r = [];
1337
+ let n;
1338
+ for (; n = t.exec(e); ) {
1339
+ let i = "", s = !1;
1340
+ for (const o of n[1])
1341
+ o === "[" && (s = !0), o === "]" && (s = !1), o === " " && !s ? (i && r.push(i), i = "") : i += o;
1342
+ i && r.push(i);
999
1343
  }
1000
- recordMetric(e, t) {
1001
- this.metrics.has(e) || this.metrics.set(e, []);
1002
- const s = this.metrics.get(e);
1003
- s.push(t), s.length > 100 && s.shift();
1344
+ return r.filter(Boolean);
1345
+ }
1346
+ const te = /* @__PURE__ */ new Map(), Se = 16;
1347
+ function Ae(e) {
1348
+ const t = Date.now(), r = te.get(e);
1349
+ if (r && t - r.timestamp < Se) return r.css;
1350
+ const n = Ce(e), i = new Set(n), s = [], o = [], c = [], d = [], a = {};
1351
+ function u(p, C = !1) {
1352
+ const g = (C ? "dark|" : "") + p;
1353
+ if (g in a) return a[g];
1354
+ const l = f(p, C);
1355
+ return a[g] = l, l;
1004
1356
  }
1005
- getStats(e) {
1006
- if (e) {
1007
- const s = this.metrics.get(e) || [];
1008
- return s.length === 0 ? null : {
1009
- operation: e,
1010
- count: s.length,
1011
- average: s.reduce((r, i) => r + i, 0) / s.length,
1012
- min: Math.min(...s),
1013
- max: Math.max(...s)
1014
- };
1357
+ function y(p) {
1358
+ const C = p.some((l) => K.includes(l)), g = p.includes("dark");
1359
+ return p.length === 0 ? 1 : !C && !g ? 2 : C && !g ? 3 : 4;
1360
+ }
1361
+ function f(p, C = !1) {
1362
+ const g = p.split(":"), l = g.find(
1363
+ ($) => W[$] || F($) || U($) || D($)
1364
+ );
1365
+ if (!l) return null;
1366
+ const b = W[l] ?? F(l) ?? U(l) ?? D(l);
1367
+ if (!b) return null;
1368
+ let m = `.${$e(p)}`, h = b;
1369
+ const x = g.indexOf(l);
1370
+ let S = x >= 0 ? g.slice(0, x) : [];
1371
+ C && (S = S.filter(($) => $ !== "dark"));
1372
+ const k = S.filter(($) => K.includes($)), v = k.length ? k[k.length - 1] : null;
1373
+ for (const $ of S) {
1374
+ if (K.includes($)) continue;
1375
+ const A = we[$];
1376
+ typeof A == "function" && (m = A(m, h).replace(/\{.*$/, ""));
1015
1377
  }
1016
- const t = {};
1017
- for (const [s, r] of this.metrics)
1018
- r.length > 0 && (t[s] = {
1019
- count: r.length,
1020
- average: r.reduce((i, o) => i + o, 0) / r.length,
1021
- min: Math.min(...r),
1022
- max: Math.max(...r)
1023
- });
1024
- return t;
1378
+ let _ = `${m}{${h}}`;
1379
+ return C && v ? _ = `@media (prefers-color-scheme: dark) and ${G[v]}{${_}}` : C ? _ = `@media (prefers-color-scheme: dark){${_}}` : v && (_ = `@media ${G[v]}{${_}}`), _;
1025
1380
  }
1026
- reset(e) {
1027
- e ? this.metrics.delete(e) : this.metrics.clear();
1381
+ for (const p of i) {
1382
+ const C = p.split(":"), g = C.find(
1383
+ (h) => W[h] || F(h) || U(h) || D(h)
1384
+ );
1385
+ if (!g) continue;
1386
+ const l = C.indexOf(g), b = l >= 0 ? C.slice(0, l) : [], m = y(b);
1387
+ if (m === 4) {
1388
+ const h = u(p, !0);
1389
+ h && d.push(h);
1390
+ } else {
1391
+ const h = u(p);
1392
+ h && (m === 1 ? s.push(h) : m === 2 ? o.push(h) : m === 3 && c.push(h));
1393
+ }
1028
1394
  }
1395
+ const w = [...s, ...o, ...c, ...d].join("");
1396
+ return te.set(e, { css: w, timestamp: t }), w;
1029
1397
  }
1030
- const pe = new de(), ye = /* @__PURE__ */ new Map();
1031
- function K(n) {
1032
- return n.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1398
+ const Ee = /* @__PURE__ */ new Map();
1399
+ function Z(e) {
1400
+ return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1033
1401
  }
1034
- function I(n) {
1035
- return typeof n == "string" ? n.replace(
1402
+ function q(e) {
1403
+ return typeof e == "string" ? e.replace(
1036
1404
  /[&<>"']/g,
1037
- (e) => ({
1405
+ (t) => ({
1038
1406
  "&": "&amp;",
1039
1407
  "<": "&lt;",
1040
1408
  ">": "&gt;",
1041
1409
  '"': "&quot;",
1042
1410
  "'": "&#39;"
1043
- })[e]
1044
- ) : n;
1411
+ })[t]
1412
+ ) : e;
1045
1413
  }
1046
- function ge(n) {
1047
- return n.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
1414
+ function Te(e) {
1415
+ return e.replace(/url\s*\(\s*['"]?javascript:[^)]*\)/gi, "").replace(/<script[\s\S]*?>[\s\S]*?<\/script>/gi, "").replace(/expression\s*\([^)]*\)/gi, "");
1048
1416
  }
1049
- function xe(n, ...e) {
1050
- let t = "";
1051
- for (let s = 0; s < n.length; s++)
1052
- t += n[s], s < e.length && (t += e[s]);
1053
- return t;
1417
+ function Me(e, ...t) {
1418
+ let r = "";
1419
+ for (let n = 0; n < e.length; n++)
1420
+ r += e[n], n < t.length && (r += t[n]);
1421
+ return r;
1054
1422
  }
1055
- function Ee(n, e, t) {
1056
- let s = K(n);
1057
- s.includes("-") || (s = `cer-${s}`);
1058
- let r;
1059
- typeof e == "function" ? r = { ...t, render: e } : r = e, typeof r.onError != "function" && (r.onError = (i, o) => {
1060
- console.error(`[${s}] Error:`, i, o);
1061
- }), ye.set(s, r), typeof window < "u" && !customElements.get(s) && customElements.define(s, me(r));
1423
+ function Pe(e, t, r) {
1424
+ let n = Z(e);
1425
+ n.includes("-") || (n = `cer-${n}`);
1426
+ let i;
1427
+ typeof t == "function" ? i = { ...r, render: t } : i = t, typeof i.onError != "function" && (i.onError = (s, o) => {
1428
+ console.error(`[${n}] Error:`, s, o);
1429
+ }), Ee.set(n, i), typeof window < "u" && !customElements.get(n) && customElements.define(n, Le(i));
1062
1430
  }
1063
- function me(n) {
1064
- if (!n.render)
1431
+ function Le(e) {
1432
+ if (!e.render)
1065
1433
  throw new Error(
1066
1434
  "Component must have a render function"
1067
1435
  );
@@ -1077,60 +1445,49 @@ function me(n) {
1077
1445
  _mounted = !1;
1078
1446
  _hasError = !1;
1079
1447
  _initializing = !0;
1080
- _styleElement = null;
1081
- _styleCache = new le(100);
1082
- _lastStyleHash = "";
1083
- _styleDependencies = /* @__PURE__ */ new Set();
1084
- _styleUpdateDebounced;
1448
+ _styleSheet = null;
1449
+ _lastHtmlStringForJitCSS = "";
1085
1450
  _cfg;
1086
1451
  _lastRenderTime = 0;
1087
1452
  _renderCount = 0;
1088
1453
  _templateLoading = !1;
1089
1454
  _templateError = null;
1090
1455
  constructor() {
1091
- super(), this.attachShadow({ mode: "open" }), this._cfg = n;
1092
- const e = {
1093
- debounceMs: 16,
1094
- ...n.styleOptimizations
1095
- };
1096
- this._styleUpdateDebounced = he(
1097
- (t) => this._applyStyle(t),
1098
- e.debounceMs
1099
- ), this.context = this._initContext(n), Object.keys(n).forEach((t) => {
1100
- const s = n[t];
1101
- typeof s == "function" && !t.startsWith("on") && (this.context[t] = (...r) => s(...r, this.context));
1102
- }), this._applyProps(n), this._applyComputed(n), this._initializing = !1, this._initWatchers(n), this._render(n);
1456
+ super(), this.attachShadow({ mode: "open" }), this._cfg = e, this.context = this._initContext(e), Object.keys(e).forEach((t) => {
1457
+ const r = e[t];
1458
+ typeof r == "function" && !t.startsWith("on") && (this.context[t] = (...n) => r(...n, this.context));
1459
+ }), this._applyProps(e), this._applyComputed(e), this._initializing = !1, this._initWatchers(e), this._render(e);
1103
1460
  }
1104
1461
  connectedCallback() {
1105
- this._runLogicWithinErrorBoundary(n, () => {
1106
- n.onConnected && !this._mounted && (n.onConnected(this.context), this._mounted = !0);
1462
+ this._runLogicWithinErrorBoundary(e, () => {
1463
+ e.onConnected && !this._mounted && (e.onConnected(this.context), this._mounted = !0);
1107
1464
  });
1108
1465
  }
1109
1466
  disconnectedCallback() {
1110
- this._runLogicWithinErrorBoundary(n, () => {
1111
- n.onDisconnected && n.onDisconnected(this.context), this._listeners.forEach((e) => e()), this._listeners = [], this._watchers.clear(), this._styleCache.clear(), this._styleDependencies.clear(), this._styleElement = null, this._lastStyleHash = "", this._styleUpdateDebounced.cancel(), this._templateLoading = !1, this._templateError = null, this._mounted = !1;
1467
+ this._runLogicWithinErrorBoundary(e, () => {
1468
+ e.onDisconnected && e.onDisconnected(this.context), this._listeners.forEach((t) => t()), this._listeners = [], this._watchers.clear(), this._templateLoading = !1, this._templateError = null, this._mounted = !1;
1112
1469
  });
1113
1470
  }
1114
- attributeChangedCallback(e, t, s) {
1115
- this._runLogicWithinErrorBoundary(n, () => {
1116
- this._applyProps(n), n.onAttributeChanged && n.onAttributeChanged(
1117
- e,
1471
+ attributeChangedCallback(t, r, n) {
1472
+ this._runLogicWithinErrorBoundary(e, () => {
1473
+ this._applyProps(e), e.onAttributeChanged && e.onAttributeChanged(
1118
1474
  t,
1119
- s,
1475
+ r,
1476
+ n,
1120
1477
  this.context
1121
1478
  );
1122
1479
  });
1123
1480
  }
1124
1481
  static get observedAttributes() {
1125
- return n.props ? Object.keys(n.props).map(K) : [];
1482
+ return e.props ? Object.keys(e.props).map(Z) : [];
1126
1483
  }
1127
- _applyComputed(e) {
1128
- this._runLogicWithinErrorBoundary(n, () => {
1129
- e.computed && Object.entries(e.computed).forEach(([t, s]) => {
1130
- Object.defineProperty(this.context, t, {
1484
+ _applyComputed(t) {
1485
+ this._runLogicWithinErrorBoundary(e, () => {
1486
+ t.computed && Object.entries(t.computed).forEach(([r, n]) => {
1487
+ Object.defineProperty(this.context, r, {
1131
1488
  get: () => {
1132
- const r = s(this.context);
1133
- return I(r);
1489
+ const i = n(this.context);
1490
+ return q(i);
1134
1491
  },
1135
1492
  enumerable: !0
1136
1493
  });
@@ -1138,51 +1495,51 @@ function me(n) {
1138
1495
  });
1139
1496
  }
1140
1497
  // --- Render ---
1141
- _render(e) {
1142
- this._runLogicWithinErrorBoundary(e, () => {
1498
+ _render(t) {
1499
+ this._runLogicWithinErrorBoundary(t, () => {
1143
1500
  if (!this.shadowRoot) return;
1144
- if (this._styleDependencies.clear(), this._templateLoading && e.loadingTemplate) {
1145
- this._renderOutput(e.loadingTemplate(this.context));
1501
+ if (this._templateLoading && t.loadingTemplate) {
1502
+ this._renderOutput(t.loadingTemplate(this.context));
1146
1503
  return;
1147
1504
  }
1148
- if (this._templateError && e.errorTemplate) {
1149
- this._renderOutput(e.errorTemplate(this._templateError, this.context));
1505
+ if (this._templateError && t.errorTemplate) {
1506
+ this._renderOutput(t.errorTemplate(this._templateError, this.context));
1150
1507
  return;
1151
1508
  }
1152
- const t = e.render(this.context);
1153
- if (t instanceof Promise) {
1154
- this._templateLoading = !0, t.then((s) => (this._templateLoading = !1, this._templateError = null, this._renderOutput(s), s)).catch((s) => {
1155
- if (this._templateLoading = !1, this._templateError = s, e.errorTemplate) {
1156
- const r = e.errorTemplate(s, this.context);
1157
- return this._renderOutput(r), r;
1509
+ const r = t.render(this.context);
1510
+ if (r instanceof Promise) {
1511
+ this._templateLoading = !0, r.then((n) => (this._templateLoading = !1, this._templateError = null, this._renderOutput(n), n)).catch((n) => {
1512
+ if (this._templateLoading = !1, this._templateError = n, t.errorTemplate) {
1513
+ const i = t.errorTemplate(n, this.context);
1514
+ return this._renderOutput(i), i;
1158
1515
  }
1159
- throw s;
1160
- }), e.loadingTemplate && this._renderOutput(e.loadingTemplate(this.context));
1516
+ throw n;
1517
+ }), t.loadingTemplate && this._renderOutput(t.loadingTemplate(this.context));
1161
1518
  return;
1162
1519
  }
1163
- this._renderOutput(t), this._applyStyle(e);
1520
+ this._renderOutput(r), this._applyStyle(t);
1164
1521
  });
1165
1522
  }
1166
1523
  // --- Helper to render output ---
1167
- _renderOutput(e) {
1524
+ _renderOutput(t) {
1168
1525
  if (!this.shadowRoot) return;
1169
- const t = new Proxy(this.context, {
1170
- get: (s, r) => r === "_requestRender" ? () => this._requestRender() : r === "context" ? s : typeof r == "string" && r.includes(".") ? r.split(".").reduce((i, o) => i?.[o], s) : s[r],
1171
- set: (s, r, i) => {
1172
- if (typeof r == "string" && r.includes(".")) {
1173
- const o = r.split("."), l = o.pop();
1174
- if (!l) return !1;
1175
- const f = o.reduce((c, h) => (h in c || (c[h] = {}), c[h]), s);
1176
- return f[l] = i, !0;
1526
+ const r = new Proxy(this.context, {
1527
+ get: (n, i) => i === "_requestRender" ? () => this._requestRender() : i === "context" ? n : typeof i == "string" && i.includes(".") ? i.split(".").reduce((s, o) => s?.[o], n) : n[i],
1528
+ set: (n, i, s) => {
1529
+ if (typeof i == "string" && i.includes(".")) {
1530
+ const o = i.split("."), c = o.pop();
1531
+ if (!c) return !1;
1532
+ const d = o.reduce((a, u) => (u in a || (a[u] = {}), a[u]), n);
1533
+ return d[c] = s, !0;
1177
1534
  }
1178
- return s[r] = i, !0;
1535
+ return n[i] = s, !0;
1179
1536
  }
1180
1537
  });
1181
- ce(
1538
+ me(
1182
1539
  this.shadowRoot,
1183
- Array.isArray(e) ? e : [e],
1184
- t
1185
- ), this._requestStyleUpdate();
1540
+ Array.isArray(t) ? t : [t],
1541
+ r
1542
+ ), this._lastHtmlStringForJitCSS = this.shadowRoot.innerHTML;
1186
1543
  }
1187
1544
  _requestRender() {
1188
1545
  if (this._renderTimeoutId !== null && clearTimeout(this._renderTimeoutId), Date.now() - this._lastRenderTime < 16) {
@@ -1198,85 +1555,44 @@ function me(n) {
1198
1555
  this._lastRenderTime = Date.now(), this._render(this._cfg), this._renderTimeoutId = null;
1199
1556
  }, 0);
1200
1557
  }
1201
- // Request style-only update (more efficient than full render)
1202
- _requestStyleUpdate() {
1203
- this._styleUpdateDebounced(this._cfg);
1204
- }
1205
1558
  // --- Style ---
1206
- _applyStyle(e) {
1207
- this._runLogicWithinErrorBoundary(e, () => {
1208
- if (!this.shadowRoot)
1559
+ _applyStyle(t) {
1560
+ this._runLogicWithinErrorBoundary(t, () => {
1561
+ if (!this.shadowRoot) return;
1562
+ const r = Ae(this._lastHtmlStringForJitCSS);
1563
+ if (!t.style && (!r || r.trim() === "")) {
1564
+ this._styleSheet = null;
1209
1565
  return;
1210
- const t = pe.startTimer("applyStyle");
1211
- try {
1212
- if (this._styleElement || (this._styleElement = this.shadowRoot.querySelector(
1213
- "style"
1214
- ), this._styleElement || typeof document < "u" && (this._styleElement = document.createElement("style"), this.shadowRoot.prepend(this._styleElement))), !e.style) {
1215
- this._styleElement.textContent = "";
1216
- return;
1217
- }
1218
- const s = {
1219
- enableCaching: !0,
1220
- enableMinification: !1,
1221
- enableDeduplication: !0,
1222
- cacheSize: 100,
1223
- debounceMs: 16,
1224
- ...e.styleOptimizations
1225
- };
1226
- let r;
1227
- typeof e.style == "string" ? r = {
1228
- css: e.style,
1229
- cache: s.enableCaching
1230
- } : typeof e.style == "function" ? r = {
1231
- css: e.style,
1232
- cache: s.enableCaching
1233
- } : r = {
1234
- cache: s.enableCaching,
1235
- ...e.style
1236
- };
1237
- const i = r.dependencies || [], o = r.cache !== !1 && s.enableCaching;
1238
- let l = "";
1239
- if (o && i.length > 0) {
1240
- const h = i.map((d) => this.context[d]);
1241
- if (l = ue(h), this._lastStyleHash === l && this._styleCache.has(l)) {
1242
- const d = this._styleCache.get(l);
1243
- this._styleElement.textContent !== d && (this._styleElement.textContent = d);
1244
- return;
1245
- }
1246
- }
1247
- (!o || i.length === 0) && (l = "no-deps-" + Date.now());
1248
- const f = typeof r.css == "function" ? r.css(this.context) : r.css;
1249
- let c = ge(f);
1250
- s.enableMinification && (c = ae(c)), s.enableDeduplication && (c = fe(c)), o && i.length > 0 && (this._styleCache.set(
1251
- l,
1252
- c,
1253
- i.map(String)
1254
- ), this._lastStyleHash = l), this._styleElement.textContent !== c && (this._styleElement.textContent = c);
1255
- } finally {
1256
- t();
1257
1566
  }
1567
+ let n = "";
1568
+ t.style && (typeof t.style == "string" ? n = t.style : typeof t.style == "function" && (n = t.style(this.context)));
1569
+ let i = Te(`${be}
1570
+ ${n}
1571
+ ${r}
1572
+ `);
1573
+ t.minifyCSS && (i = ye(i)), this._styleSheet || (this._styleSheet = new CSSStyleSheet()), this._styleSheet.replaceSync(i), this.shadowRoot.adoptedStyleSheets = [this._styleSheet];
1258
1574
  });
1259
1575
  }
1260
1576
  // --- Error Boundary function ---
1261
- _runLogicWithinErrorBoundary(e, t) {
1577
+ _runLogicWithinErrorBoundary(t, r) {
1262
1578
  this._hasError && (this._hasError = !1);
1263
1579
  try {
1264
- t();
1265
- } catch (s) {
1266
- this._hasError = !0, e.onError && e.onError(s, this.context), e.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = e.errorFallback(
1267
- s,
1580
+ r();
1581
+ } catch (n) {
1582
+ this._hasError = !0, t.onError && t.onError(n, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(
1583
+ n,
1268
1584
  this.context
1269
1585
  ));
1270
1586
  }
1271
1587
  }
1272
1588
  // --- State, props, computed ---
1273
- _initContext(e) {
1589
+ _initContext(t) {
1274
1590
  try {
1275
- let t = function(r, i = "") {
1276
- return Array.isArray(r) ? new Proxy(r, {
1277
- get(o, l, f) {
1278
- const c = Reflect.get(o, l, f);
1279
- return typeof c == "function" && typeof l == "string" && [
1591
+ let r = function(i, s = "") {
1592
+ return Array.isArray(i) ? new Proxy(i, {
1593
+ get(o, c, d) {
1594
+ const a = Reflect.get(o, c, d);
1595
+ return typeof a == "function" && typeof c == "string" && [
1280
1596
  "push",
1281
1597
  "pop",
1282
1598
  "shift",
@@ -1284,122 +1600,113 @@ function me(n) {
1284
1600
  "splice",
1285
1601
  "sort",
1286
1602
  "reverse"
1287
- ].includes(l) ? function(...d) {
1288
- const a = c.apply(o, d);
1289
- if (!s._initializing) {
1290
- const _ = i || "root";
1291
- s._triggerWatchers(_, o), s._render(e);
1603
+ ].includes(c) ? function(...y) {
1604
+ const f = a.apply(o, y);
1605
+ if (!n._initializing) {
1606
+ const w = s || "root";
1607
+ n._triggerWatchers(w, o), n._render(t);
1292
1608
  }
1293
- return a;
1294
- } : c;
1609
+ return f;
1610
+ } : a;
1295
1611
  },
1296
- set(o, l, f) {
1297
- if (o[l] = f, !s._initializing) {
1298
- const c = i ? `${i}.${String(l)}` : String(l);
1299
- s._styleDependencies.add(String(l)), s._styleCache.invalidate(String(l)), s._triggerWatchers(c, f);
1300
- const h = e.style;
1301
- let d = !1;
1302
- if (h && typeof h == "object" && "dependencies" in h) {
1303
- const a = h.dependencies || [];
1304
- d = a.includes(String(l)) && a.every(
1305
- (_) => !s._styleDependencies.has(String(_)) || _ === l
1306
- );
1307
- }
1308
- d ? s._requestStyleUpdate() : s._render(e);
1612
+ set(o, c, d) {
1613
+ if (o[c] = d, !n._initializing) {
1614
+ const a = s ? `${s}.${String(c)}` : String(c);
1615
+ n._triggerWatchers(a, d), n._render(t);
1309
1616
  }
1310
1617
  return !0;
1311
1618
  },
1312
- deleteProperty(o, l) {
1313
- if (delete o[l], !s._initializing) {
1314
- const f = i ? `${i}.${String(l)}` : String(l);
1315
- s._styleDependencies.add(String(l)), s._triggerWatchers(f, void 0), s._render(e);
1619
+ deleteProperty(o, c) {
1620
+ if (delete o[c], !n._initializing) {
1621
+ const d = s ? `${s}.${String(c)}` : String(c);
1622
+ n._triggerWatchers(d, void 0), n._render(t);
1316
1623
  }
1317
1624
  return !0;
1318
1625
  }
1319
- }) : r && typeof r == "object" ? (Object.keys(r).forEach((o) => {
1320
- const l = i ? `${i}.${o}` : o;
1321
- r[o] = t(r[o], l);
1322
- }), new Proxy(r, {
1323
- set(o, l, f) {
1324
- const c = i ? `${i}.${String(l)}` : String(l);
1325
- return o[l] = t(f, c), s._initializing || (s._triggerWatchers(
1326
- c,
1327
- o[l]
1328
- ), s._render(e)), !0;
1626
+ }) : i && typeof i == "object" ? (Object.keys(i).forEach((o) => {
1627
+ const c = s ? `${s}.${o}` : o;
1628
+ i[o] = r(i[o], c);
1629
+ }), new Proxy(i, {
1630
+ set(o, c, d) {
1631
+ const a = s ? `${s}.${String(c)}` : String(c);
1632
+ return o[c] = r(d, a), n._initializing || (n._triggerWatchers(
1633
+ a,
1634
+ o[c]
1635
+ ), n._render(t)), !0;
1329
1636
  },
1330
- get(o, l, f) {
1331
- return Reflect.get(o, l, f);
1637
+ get(o, c, d) {
1638
+ return Reflect.get(o, c, d);
1332
1639
  }
1333
- })) : r;
1640
+ })) : i;
1334
1641
  };
1335
- const s = this;
1336
- return t({ ...e.state });
1642
+ const n = this;
1643
+ return r({ ...t.state });
1337
1644
  } catch {
1338
1645
  return {};
1339
1646
  }
1340
1647
  }
1341
- _initWatchers(e) {
1342
- if (e.watch)
1343
- for (const [t, s] of Object.entries(e.watch)) {
1344
- let r, i = {};
1345
- if (Array.isArray(s) ? (r = s[0], i = s[1] || {}) : r = s, this._watchers.set(t, {
1346
- callback: r,
1347
- options: i,
1348
- oldValue: this._getNestedValue(t)
1349
- }), i.immediate)
1648
+ _initWatchers(t) {
1649
+ if (t.watch)
1650
+ for (const [r, n] of Object.entries(t.watch)) {
1651
+ let i, s = {};
1652
+ if (Array.isArray(n) ? (i = n[0], s = n[1] || {}) : i = n, this._watchers.set(r, {
1653
+ callback: i,
1654
+ options: s,
1655
+ oldValue: this._getNestedValue(r)
1656
+ }), s.immediate)
1350
1657
  try {
1351
- const o = this._getNestedValue(t);
1352
- r(o, void 0, this.context);
1658
+ const o = this._getNestedValue(r);
1659
+ i(o, void 0, this.context);
1353
1660
  } catch (o) {
1354
- console.error(`Error in immediate watcher for "${t}":`, o);
1661
+ console.error(`Error in immediate watcher for "${r}":`, o);
1355
1662
  }
1356
1663
  }
1357
1664
  }
1358
- _getNestedValue(e) {
1359
- return e.split(".").reduce(
1360
- (t, s) => t?.[s],
1665
+ _getNestedValue(t) {
1666
+ return t.split(".").reduce(
1667
+ (r, n) => r?.[n],
1361
1668
  this.context
1362
1669
  );
1363
1670
  }
1364
- _triggerWatchers(e, t) {
1365
- const s = (i, o) => {
1366
- if (i === o) return !0;
1367
- if (typeof i != typeof o || typeof i != "object" || i === null || o === null) return !1;
1368
- if (Array.isArray(i) && Array.isArray(o))
1369
- return i.length !== o.length ? !1 : i.every((c, h) => s(c, o[h]));
1370
- const l = Object.keys(i), f = Object.keys(o);
1371
- return l.length !== f.length ? !1 : l.every((c) => s(i[c], o[c]));
1372
- }, r = this._watchers.get(e);
1373
- if (r && !s(t, r.oldValue))
1671
+ _triggerWatchers(t, r) {
1672
+ const n = (s, o) => {
1673
+ if (s === o) return !0;
1674
+ if (typeof s != typeof o || typeof s != "object" || s === null || o === null) return !1;
1675
+ if (Array.isArray(s) && Array.isArray(o))
1676
+ return s.length !== o.length ? !1 : s.every((a, u) => n(a, o[u]));
1677
+ const c = Object.keys(s), d = Object.keys(o);
1678
+ return c.length !== d.length ? !1 : c.every((a) => n(s[a], o[a]));
1679
+ }, i = this._watchers.get(t);
1680
+ if (i && !n(r, i.oldValue))
1374
1681
  try {
1375
- r.callback(t, r.oldValue, this.context), r.oldValue = t;
1376
- } catch (i) {
1377
- console.error(`Error in watcher for "${e}":`, i);
1682
+ i.callback(r, i.oldValue, this.context), i.oldValue = r;
1683
+ } catch (s) {
1684
+ console.error(`Error in watcher for "${t}":`, s);
1378
1685
  }
1379
- for (const [i, o] of this._watchers.entries())
1380
- if (o.options.deep && e.startsWith(i + "."))
1686
+ for (const [s, o] of this._watchers.entries())
1687
+ if (o.options.deep && t.startsWith(s + "."))
1381
1688
  try {
1382
- const l = this._getNestedValue(i);
1383
- s(l, o.oldValue) || (o.callback(l, o.oldValue, this.context), o.oldValue = l);
1384
- } catch (l) {
1385
- console.error(`Error in deep watcher for "${i}":`, l);
1689
+ const c = this._getNestedValue(s);
1690
+ n(c, o.oldValue) || (o.callback(c, o.oldValue, this.context), o.oldValue = c);
1691
+ } catch (c) {
1692
+ console.error(`Error in deep watcher for "${s}":`, c);
1386
1693
  }
1387
1694
  }
1388
- _applyProps(e) {
1695
+ _applyProps(t) {
1389
1696
  try {
1390
- let t = function(s, r) {
1391
- return r === Boolean ? s === "true" : r === Number ? Number(s) : s;
1697
+ let r = function(n, i) {
1698
+ return i === Boolean ? n === "true" : i === Number ? Number(n) : n;
1392
1699
  };
1393
- if (!e.props) return;
1394
- Object.entries(e.props).forEach(([s, r]) => {
1395
- const i = this.getAttribute(K(s));
1396
- i !== null ? this.context[s] = I(
1397
- t(i, r.type)
1398
- ) : "default" in r && r.default !== void 0 && (this.context[s] = I(r.default));
1700
+ if (!t.props) return;
1701
+ Object.entries(t.props).forEach(([n, i]) => {
1702
+ const s = this.getAttribute(Z(n));
1703
+ s !== null ? this.context[n] = q(
1704
+ r(s, i.type)
1705
+ ) : "default" in i && i.default !== void 0 && (this.context[n] = q(i.default));
1399
1706
  });
1400
- } catch (t) {
1401
- this._hasError = !0, e.onError && e.onError(t, this.context), e.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = e.errorFallback(
1402
- t,
1707
+ } catch (r) {
1708
+ this._hasError = !0, t.onError && t.onError(r, this.context), t.errorFallback && this.shadowRoot && (this.shadowRoot.innerHTML = t.errorFallback(
1709
+ r,
1403
1710
  this.context
1404
1711
  ));
1405
1712
  }
@@ -1407,14 +1714,14 @@ function me(n) {
1407
1714
  };
1408
1715
  }
1409
1716
  export {
1410
- Ee as component,
1411
- me as createElementClass,
1412
- _e as createStore,
1413
- xe as css,
1414
- Se as each,
1415
- be as eventBus,
1416
- ke as html,
1417
- Ae as match,
1418
- Ce as when
1717
+ Pe as component,
1718
+ Le as createElementClass,
1719
+ Ne as createStore,
1720
+ Me as css,
1721
+ Be as each,
1722
+ je as eventBus,
1723
+ ze as html,
1724
+ Oe as match,
1725
+ Re as when
1419
1726
  };
1420
1727
  //# sourceMappingURL=custom-elements-runtime.es.js.map