@jasonshimmy/custom-elements-runtime 0.0.10 → 0.0.11

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 N(e) {
1
+ function Ne(e) {
2
2
  let t = new Proxy(e, {
3
- set: (i, a, c) => (i[a] = c, s(), !0)
3
+ set: (o, c, d) => (o[c] = d, s(), !0)
4
4
  });
5
5
  const r = [];
6
- function n(i) {
7
- r.push(i), i(t);
6
+ function n(o) {
7
+ r.push(o), o(t);
8
8
  }
9
- function o() {
9
+ function i() {
10
10
  return t;
11
11
  }
12
12
  function s() {
13
- r.forEach((i) => i(t));
13
+ r.forEach((o) => o(t));
14
14
  }
15
- return { subscribe: n, getState: o };
15
+ return { subscribe: n, getState: i };
16
16
  }
17
- class y 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 y extends EventTarget {
22
22
  * Returns the singleton instance of GlobalEventBus
23
23
  */
24
24
  static getInstance() {
25
- return y.instance || (y.instance = new y()), y.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
  /**
@@ -31,10 +31,10 @@ class y extends EventTarget {
31
31
  * @param data - Optional event payload
32
32
  */
33
33
  emit(t, r) {
34
- const n = Date.now(), o = this.eventCounters.get(t);
35
- if (!o || n - o.window > 1e3)
34
+ const n = Date.now(), i = this.eventCounters.get(t);
35
+ if (!i || n - i.window > 1e3)
36
36
  this.eventCounters.set(t, { count: 1, window: n });
37
- else if (o.count++, o.count > 50 && (console.error(`Event storm detected for "${t}": ${o.count} events in 1 second. Throttling...`), o.count > 100)) {
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
38
  console.warn(`Blocking further "${t}" events to prevent infinite loop`);
39
39
  return;
40
40
  }
@@ -45,11 +45,11 @@ class y extends EventTarget {
45
45
  cancelable: !0
46
46
  }));
47
47
  const s = this.handlers[t];
48
- s && s.forEach((i) => {
48
+ s && s.forEach((o) => {
49
49
  try {
50
- i(r);
51
- } catch (a) {
52
- console.error(`Error in global event handler for "${t}":`, a);
50
+ o(r);
51
+ } catch (c) {
52
+ console.error(`Error in global event handler for "${t}":`, c);
53
53
  }
54
54
  });
55
55
  }
@@ -93,8 +93,8 @@ class y extends EventTarget {
93
93
  */
94
94
  once(t, r) {
95
95
  return new Promise((n) => {
96
- const o = this.on(t, (s) => {
97
- o(), r(s), n(s);
96
+ const i = this.on(t, (s) => {
97
+ i(), r(s), n(s);
98
98
  });
99
99
  });
100
100
  }
@@ -138,1545 +138,1590 @@ class y extends EventTarget {
138
138
  this.eventCounters.clear();
139
139
  }
140
140
  }
141
- const w = y.getInstance(), G = typeof window > "u" || typeof document > "u";
142
- function Z(e) {
143
- return {
144
- state: e,
145
- emit: () => {
146
- },
147
- // No-op on server
148
- onGlobal: () => () => {
149
- },
150
- offGlobal: () => {
151
- },
152
- emitGlobal: () => {
153
- },
154
- render: () => {
155
- }
156
- };
157
- }
158
- function V(e, t = {}) {
159
- G || console.warn("[SSR] renderToString should only be used on the server");
160
- try {
161
- const r = e.state, n = Z(r), o = e.template(r, n);
162
- let s = "";
163
- t.includeStyles && e.style && (s = `<style>${typeof e.style == "function" ? e.style(r) : e.style}</style>`);
164
- const i = t.sanitizeAttributes ? t.sanitizeAttributes(e.attrs || {}) : e.attrs || {}, a = Object.entries(i).map(([u, d]) => `${D(u)}="${D(d)}"`).join(" "), l = `${a ? `<${e.tag} ${a}>` : `<${e.tag}>`}${s}${o}</${e.tag}>`;
165
- return t.prettyPrint ? Y(l) : l;
166
- } catch (r) {
167
- return console.error(`[SSR] Error rendering ${e.tag}:`, r), `<${e.tag}><div style="color: red;">SSR Error: ${X(String(r))}</div></${e.tag}>`;
168
- }
169
- }
170
- function lt(e, t = {}) {
171
- const r = {
172
- components: /* @__PURE__ */ new Map(),
173
- styles: /* @__PURE__ */ new Set()
174
- }, n = [];
175
- e.forEach((i) => {
176
- if (r.components.set(i.tag, i), i.style) {
177
- const c = typeof i.style == "function" ? i.style(i.state) : i.style;
178
- r.styles.add(c);
179
- }
180
- const a = V(i, { ...t, includeStyles: !1 });
181
- n.push(a);
182
- });
183
- const o = Array.from(r.styles).join(`
184
- `);
185
- return { html: n.join(`
186
- `), styles: o, context: r };
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 };
187
145
  }
188
- function ut(e) {
189
- const t = Array.from(e.components.entries()).map(([r, n]) => ({
190
- tag: r,
191
- state: n.state
192
- }));
193
- return `
194
- <script type="module">
195
- // Hydration data from SSR
196
- window.__SSR_CONTEXT__ = ${JSON.stringify({ components: t })};
197
-
198
- // Auto-hydrate when DOM is ready
199
- if (document.readyState === 'loading') {
200
- document.addEventListener('DOMContentLoaded', hydrate);
201
- } else {
202
- hydrate();
203
- }
204
-
205
- function hydrate() {
206
- const context = window.__SSR_CONTEXT__;
207
- if (!context?.components) return;
208
-
209
- context.components.forEach(({ tag, state }) => {
210
- const elements = document.querySelectorAll(tag);
211
- elements.forEach(el => {
212
- // Mark as hydrated to prevent re-initialization
213
- if (!el.hasAttribute('data-hydrated')) {
214
- el.setAttribute('data-hydrated', 'true');
215
- // Restore state if component supports it
216
- if (el._hydrateWithState) {
217
- el._hydrateWithState(state);
218
- }
219
- }
220
- });
221
- });
222
-
223
- // Clean up
224
- delete window.__SSR_CONTEXT__;
225
- }
226
- <\/script>`.trim();
146
+ function V(e) {
147
+ return !!e && typeof e == "object" && (e.type === "AnchorBlock" || e.tag === "#anchor");
227
148
  }
228
- const X = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), D = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#39;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), Y = (e) => e.replace(/></g, `>
229
- <`).split(`
230
- `).map((t) => {
231
- const r = (t.match(/^<[^\/]/g) || []).length - (t.match(/<\//g) || []).length;
232
- return " ".repeat(Math.max(0, r)) + t.trim();
233
- }).join(`
234
- `);
235
- function F(e) {
236
- return typeof e != "string" ? String(e) : /expression\s*\(|url\s*\(\s*['"]?javascript:/i.test(e) ? "" : e.replace(/[\u0000-\u001F\u007F-\u009F]/g, "").replace(/<|>|"|'|`|;/g, "");
149
+ function z(e) {
150
+ return typeof e == "object" && e !== null && "tag" in e && !V(e);
237
151
  }
238
- function I(e) {
239
- return String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
152
+ function oe(e, t) {
153
+ return e.key != null ? e : { ...e, key: t };
240
154
  }
241
- function L(e, t) {
242
- if (typeof e != "string" || !t) return String(e);
243
- for (const r in t) {
244
- if (typeof t[r] == "string" && e === t[r])
245
- return I(e);
246
- if (Array.isArray(t[r])) {
247
- for (const n of t[r])
248
- if (n && typeof n == "object") {
249
- for (const o in n)
250
- if (typeof n[o] == "string" && e === n[o])
251
- return I(e);
252
- }
253
- }
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
+ }
177
+ s[w] = {
178
+ value: g,
179
+ modifiers: l
180
+ };
181
+ } else
182
+ i[a] = f;
254
183
  }
255
- return String(e);
184
+ return { props: n, attrs: i, directives: s };
256
185
  }
257
- function T(e, ...t) {
258
- function r(n, o, s) {
259
- if (Array.isArray(n)) {
260
- const i = n.map((a) => r(a, o, s));
261
- return i.some((a) => a instanceof Promise) ? Promise.all(i).then((a) => a.join("")) : i.join("");
186
+ function ae(e, t, r) {
187
+ function n(l, b) {
188
+ return P("#text", {}, l, b);
189
+ }
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
+ /;?\s*$/,
200
+ ""
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
+ ];
207
+ y.attrs.class = x.join(" ");
208
+ } else
209
+ y.attrs[b] = l.attrs[b];
210
+ }))) : (y.props || (y.props = {}), Object.assign(y.props, l)));
211
+ }
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
+ m.push({
218
+ ...l,
219
+ key: h,
220
+ children: x
221
+ });
222
+ return;
262
223
  }
263
- if (typeof n == "function") {
264
- const i = r(n(o, s), o, s);
265
- return i instanceof Promise, i;
224
+ if (z(l)) {
225
+ m.push(oe(l, void 0));
226
+ return;
266
227
  }
267
- return n == null ? "" : n instanceof Promise ? n : String(n);
268
- }
269
- return (n, o) => {
270
- let s = "", i = !1;
271
- const a = [];
272
- for (let c = 0; c < e.length; c++)
273
- if (s += e[c], c < t.length) {
274
- let l = t[c];
275
- const u = e[c], d = /data-on-[a-z]+="?$/.test(u);
276
- l = r(l, n, o), l instanceof Promise ? (i = !0, a.push(l)) : /=\s*"?$/.test(u) && typeof l == "string" && !d ? (l = l.replace(/"/g, "&quot;").replace(/'/g, "&#39;"), s += l) : !d && !/=\s*"?$/.test(u) ? s += L(l, n) : s += l;
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}`));
277
233
  }
278
- return i ? Promise.all(a).then((c) => {
279
- let l = "", u = 0;
280
- for (let d = 0; d < e.length; d++)
281
- if (l += e[d], d < t.length) {
282
- let f = t[d];
283
- const h = e[d], m = /data-on-[a-z]+="?$/.test(h);
284
- f = r(f, n, o), f instanceof Promise ? l += c[u++] : /=\s*"?$/.test(h) && typeof f == "string" && !m ? (f = f.replace(/"/g, "&quot;").replace(/'/g, "&#39;"), l += f) : !m && !/=\s*"?$/.test(h) ? l += L(f, n) : l += f;
234
+ return;
235
+ }
236
+ if (l !== null && typeof l == "object") {
237
+ C(l);
238
+ return;
239
+ }
240
+ m.push(n(String(l), b));
241
+ }
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
+ .../* @__PURE__ */ new Set([
277
+ ...B.split(/\s+/).filter(Boolean),
278
+ ...E
279
+ ])
280
+ ];
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
+ /[A-Z]/g,
293
+ (ie) => `-${ie.toLowerCase()}`
294
+ ), ne = [
295
+ "width",
296
+ "height",
297
+ "top",
298
+ "right",
299
+ "bottom",
300
+ "left",
301
+ "margin",
302
+ "margin-top",
303
+ "margin-right",
304
+ "margin-bottom",
305
+ "margin-left",
306
+ "padding",
307
+ "padding-top",
308
+ "padding-right",
309
+ "padding-bottom",
310
+ "padding-left",
311
+ "font-size",
312
+ "line-height",
313
+ "border-width",
314
+ "border-radius",
315
+ "min-width",
316
+ "max-width",
317
+ "min-height",
318
+ "max-height"
319
+ ];
320
+ let Q = String(N);
321
+ typeof N == "number" && ne.includes(M) && (Q = `${N}px`), O.push(`${M}: ${Q}`);
322
+ }
323
+ E = O.join("; ") + (O.length > 0 ? ";" : "");
324
+ }
325
+ const B = k.attrs.style || "";
326
+ k.attrs.style = B + (B && !B.endsWith(";") ? "; " : "") + E;
327
+ }
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
+ } else {
357
+ const S = `text-${w++}`;
358
+ b.push(n(h, S));
285
359
  }
286
- return l;
287
- }) : s;
288
- };
289
- }
290
- function dt(e, ...t) {
291
- const r = "compiled-" + Math.random().toString(36).slice(2);
292
- function n(s, i, a) {
293
- return Array.isArray(s) ? s.map((c) => n(c, i, a)).join("") : typeof s == "function" ? n(s(i, a), i, a) : s == null ? "" : String(s);
294
- }
295
- const o = (s, i) => {
296
- let a = "";
297
- for (let c = 0; c < e.length; c++)
298
- if (a += e[c], c < t.length) {
299
- let l = t[c];
300
- const u = e[c], d = /data-on-[a-z]+="?$/.test(u);
301
- l = n(l, s, i), /=\s*"?$/.test(u) && typeof l == "string" && !d ? (l = l.replace(/"/g, "&quot;").replace(/'/g, "&#39;"), a += l) : !d && !/=\s*"?$/.test(u) ? a += L(l, s) : a += l ?? "";
302
360
  }
303
- return a;
304
- };
305
- return o.id = r, o;
361
+ }
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
+ // keep non-element VNodes (including anchors) as-is
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
+ );
371
+ return l.length === 1 ? l[0] : l;
372
+ }
373
+ return P("div", {}, "", "fallback-root");
306
374
  }
307
- function J(e, ...t) {
308
- let r = "";
309
- for (let n = 0; n < e.length; n++)
310
- r += e[n], n < t.length && (r += F(t[n]));
311
- return r;
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);
312
378
  }
313
- function ft(e) {
314
- return Object.keys(e).filter((t) => e[t]).join(" ");
379
+ function Re(e, t) {
380
+ return H(e ? t : [], "when-block");
315
381
  }
316
- function ht(e) {
317
- return Object.entries(e).map(([t, r]) => {
318
- const n = t.replace(/[^a-zA-Z0-9\-]/g, ""), o = typeof r == "string" ? F(r) : r;
319
- return `${n}: ${o}`;
320
- }).join("; ");
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
+ });
321
387
  }
322
- function Q(e, t, r) {
323
- const [n, ...o] = r.split("|").map((a) => a.trim());
324
- if (!n || n === "__proto__" || n === "constructor" || n === "prototype") return;
325
- function s(a, c, l) {
326
- const u = c.split(".");
327
- let d = a;
328
- for (let f = 0; f < u.length - 1; f++)
329
- u[f] in d || (d[u[f]] = {}), d = d[u[f]];
330
- d[u[u.length - 1]] = l;
331
- }
332
- const i = (a) => {
333
- let c;
334
- if (e instanceof HTMLInputElement && e.type === "checkbox") {
335
- c = e.value;
336
- const l = e.getAttribute("data-true-value"), u = e.getAttribute("data-false-value");
337
- let d = Array.isArray(t[n]) ? t[n] : void 0;
338
- if (d) {
339
- if (e.checked)
340
- d.includes(c) || d.push(c);
341
- else {
342
- const f = d.indexOf(c);
343
- f !== -1 && d.splice(f, 1);
344
- }
345
- s(t, n, [...d]);
346
- } else
347
- l !== null || u !== null ? e.checked ? s(t, n, l) : s(t, n, u !== null ? u : !1) : s(t, n, e.checked);
348
- } else e instanceof HTMLInputElement && e.type === "radio" ? (c = e.value, s(t, n, c), ((e.form || e.closest("form") || e.getRootNode()) instanceof Element ? (e.form || e.closest("form") || e.getRootNode()).querySelectorAll(`input[type="radio"][name="${e.name}"][data-model="${r}"]`) : []).forEach((u) => {
349
- u.checked = u.value === String(c);
350
- })) : (c = e.value, e instanceof HTMLInputElement && e.type === "number" && (c = Number(c)), o.includes("trim") && typeof c == "string" && (c = c.trim()), o.includes("number") && (c = Number(c)), s(t, n, c));
351
- if ("_vnode" in e && typeof e._vnode == "object" && e._vnode?.props && (e._vnode.props.value = c), a.type === "input" && (e._isDirty = !0), a.type === "keydown" && a.key === "Enter" && (e._isDirty = !1, e instanceof HTMLElement && e.isConnected)) {
352
- let l = e.parentElement;
353
- for (; l && !(l instanceof HTMLElement && l.shadowRoot); )
354
- l = l.parentElement;
355
- l && typeof l == "object" && l !== null && "render" in l && typeof l.render == "function" && l.render();
388
+ function Oe() {
389
+ const e = [];
390
+ return {
391
+ when(t, r) {
392
+ return e.push([t, r]), this;
393
+ },
394
+ otherwise(t) {
395
+ return e.push([!0, t]), this;
396
+ },
397
+ done() {
398
+ return le(...e);
356
399
  }
357
- a.type === "blur" && (e._isDirty = !1);
358
400
  };
359
- e.addEventListener("input", i), e.addEventListener("change", i), e.addEventListener("keydown", i), e.addEventListener("blur", i);
360
401
  }
361
- const j = (() => {
362
- try {
363
- if (typeof process < "u" && process.env)
364
- return process.env.NODE_ENV === "development";
365
- } catch {
366
- }
367
- return typeof window < "u" ? window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" : !1;
368
- })();
369
- function pt(e, t = {}) {
370
- const { development: r = j, cache: n = !0, optimize: o = !0 } = t, s = U(e);
371
- if (n && S.has(s)) {
372
- if (r) {
373
- const i = v.get(s) || {
374
- compilationTime: 0,
375
- renderTime: 0,
376
- updateTime: 0,
377
- cacheHits: 0,
378
- cacheMisses: 0
379
- };
380
- i.cacheHits++, v.set(s, i);
381
- }
382
- return S.get(s);
383
- }
384
- if (r) {
385
- const i = v.get(s) || {
386
- compilationTime: 0,
387
- renderTime: 0,
388
- updateTime: 0,
389
- cacheHits: 0,
390
- cacheMisses: 0
391
- };
392
- i.cacheMisses++, v.set(s, i);
393
- }
394
- try {
395
- const i = et(e, { development: r, optimize: o });
396
- return n && S.set(s, i), i;
397
- } catch (i) {
398
- return r && (console.error("[Template Compiler] Error compiling template:", i), console.error("[Template Compiler] Template:", e)), {
399
- statics: [e],
400
- dynamics: [],
401
- fragment: null,
402
- id: s,
403
- hasDynamics: !1,
404
- render: () => e
405
- };
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
+ return [H([], "whenChain-empty")];
407
408
  }
408
- function tt(e, t) {
409
- if (typeof document > "u")
410
- return [0];
411
- try {
412
- let r = function(a, c = []) {
413
- if (a.nodeType === Node.TEXT_NODE) {
414
- if (a.textContent?.includes(t))
415
- return c;
416
- } else if (a.nodeType === Node.ELEMENT_NODE) {
417
- let l = 0;
418
- for (let u = 0; u < a.childNodes.length; u++) {
419
- const d = a.childNodes[u], f = r(d, [...c, l]);
420
- if (f)
421
- return f;
422
- l++;
423
- }
424
- }
425
- return null;
426
- };
427
- const s = new DOMParser().parseFromString(`<div>${e}</div>`, "text/html").body.firstElementChild;
428
- return r(s) || [0];
429
- } catch (r) {
430
- return j && console.warn("[Template Compiler] Error finding DOM path for placeholder:", t, r), [0];
431
- }
409
+ function H(e, t) {
410
+ const r = e ? Array.isArray(e) ? e.filter(Boolean) : [e].filter(Boolean) : [];
411
+ return {
412
+ tag: "#anchor",
413
+ key: t,
414
+ children: r
415
+ };
432
416
  }
433
- function et(e, t) {
434
- return new rt(e, t).compile();
417
+ function j(e, t) {
418
+ return t.split(".").reduce((r, n) => r?.[n], e);
435
419
  }
436
- class rt {
437
- template;
438
- options;
439
- dynamics = [];
440
- statics = [];
441
- constructor(t, r) {
442
- this.template = t, this.options = r;
443
- }
444
- compile() {
445
- this.parseTemplate();
446
- const t = this.createStaticFragment(), r = U(this.template), n = (o, s) => {
447
- let i = "";
448
- for (let a = 0; a < this.statics.length; a++)
449
- if (i += this.statics[a], a < this.dynamics.length) {
450
- let c = this.dynamics[a].getValue(o, s);
451
- if (c instanceof Promise)
452
- return Promise.all(this.dynamics.map((l) => {
453
- const u = l.getValue(o, s);
454
- return u instanceof Promise ? u : Promise.resolve(u);
455
- })).then((l) => {
456
- let u = "";
457
- for (let d = 0; d < this.statics.length; d++)
458
- u += this.statics[d], d < l.length && (u += l[d]);
459
- return u;
460
- });
461
- i += c;
420
+ function X(e, t, r) {
421
+ const n = t.split("."), i = n.pop();
422
+ if (!i) return;
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
+ } else {
439
+ const g = o?.getAttribute("true-value") || !0, l = y === g;
440
+ o && o.checked !== l && (r.checked = l);
441
+ }
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
+ if (o && o.hasAttribute("multiple")) {
447
+ const g = o, l = Array.isArray(y) ? y : [];
448
+ setTimeout(() => {
449
+ Array.from(g.options).forEach((b) => {
450
+ const m = l.includes(b.value);
451
+ b.selected !== m && (b.selected = m);
452
+ });
453
+ }, 0);
454
+ } else
455
+ setTimeout(() => {
456
+ o instanceof HTMLSelectElement && o.value !== String(y) && (o.value = String(y));
457
+ }, 0);
458
+ else {
459
+ const g = String(y ?? "");
460
+ (!o || o.value !== g) && (r.value = y);
461
+ }
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
+ else {
474
+ const _ = v.indexOf(k);
475
+ _ > -1 && v.splice(_, 1);
462
476
  }
463
- return i;
464
- };
465
- return {
466
- statics: this.statics,
467
- dynamics: this.dynamics,
468
- fragment: t,
469
- id: r,
470
- hasDynamics: this.dynamics.length > 0,
471
- render: n
472
- };
473
- }
474
- parseTemplate() {
475
- const t = /\{\{([^}]+)\}\}/g;
476
- let r = 0, n;
477
- for (; (n = t.exec(this.template)) !== null; ) {
478
- const s = this.template.slice(r, n.index);
479
- this.statics.push(s);
480
- let i = s.match(/([a-zA-Z0-9_-]+)\s*=\s*"?$/), a = i ? i[1] : void 0, c;
481
- if (s.endsWith('style="color:'))
482
- a = "style", c = "color";
483
- else if (a === "style") {
484
- const u = s.match(/style\s*=\s*"?([^:;]+):\s*$/);
485
- u && (c = u[1].trim());
477
+ m = v;
478
+ } else {
479
+ const k = l.getAttribute("true-value") || !0, v = l.getAttribute("false-value") || !1;
480
+ m = l.checked ? k : v;
486
481
  }
487
- const l = n[1].trim();
488
- this.analyzeDynamicExpression(l, this.dynamics.length, a, c), r = n.index + n[0].length;
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
+ );
489
+ } else if (d && (m = m.trim()), a) {
490
+ const k = Number(m);
491
+ isNaN(k) || (m = k);
489
492
  }
490
- const o = this.template.slice(r);
491
- this.statics.push(o);
492
- }
493
- analyzeDynamicExpression(t, r, n, o) {
494
- let s = "text", i;
495
- n ? n === "class" ? (s = "class", i = "class") : n === "style" ? (s = "style", i = o || "style") : n === "value" ? (s = "property", i = "value") : (s = "attribute", i = n) : t.includes("class.") ? (s = "class", i = t.split(".")[1]) : t.includes("style.") ? (s = "style", i = t.split(".")[1]) : t.includes("@") ? (s = "event", i = t.split("@")[1]) : t === "class" ? (s = "class", i = "class") : t === "style" ? (s = "style", i = "style") : t === "value" ? (s = "property", i = "value") : t === "title" && (s = "attribute", i = "title");
496
- const a = `__DYNAMIC_${r}__`, c = this.statics.join(a);
497
- let l = tt(c, a);
498
- this.statics.length === 2 && s !== "text" ? l = [0] : this.statics.length === 2 && l.length === 0 && (l = [0]), this.dynamics.push({
499
- path: l,
500
- type: s,
501
- target: i,
502
- getValue: this.createValueGetter(t)
503
- });
504
- }
505
- createValueGetter(t) {
506
- return (r, n) => {
507
- try {
508
- let o;
509
- if (t && typeof t == "function")
510
- o = t(r);
511
- else if (typeof t == "string" && t.startsWith("state.")) {
512
- const s = t.slice(6);
513
- o = r[s];
514
- } else typeof t == "string" && /^[a-zA-Z0-9_$]+$/.test(t) ? o = r[t] : (typeof t == "string" && t.includes("("), o = "");
515
- return o;
516
- } catch (o) {
517
- return this.options.development && console.warn(`[Template Compiler] Error evaluating expression: ${t}`, o), "";
518
- }
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
+ }
500
+ };
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
+ setTimeout(() => {
508
+ if (m) {
509
+ let h = m.value;
510
+ if (d && (h = h.trim()), a) {
511
+ const v = Number(h);
512
+ isNaN(v) || (h = v);
513
+ }
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
+ m._modelUpdating = !1;
517
+ }, 0)), X(x, e, h), s._requestRender && s._requestRender());
518
+ }
519
+ }, 0);
519
520
  };
521
+ i.compositionstart = g, i.compositionend = l;
520
522
  }
521
- createStaticFragment() {
522
- if (typeof document > "u")
523
- return null;
523
+ }
524
+ function fe(e, t, r, n) {
525
+ if (n)
524
526
  try {
525
- const t = this.statics.join("");
526
- if (!t.trim())
527
- return null;
528
- const n = new DOMParser().parseFromString(t, "text/html"), o = document.createDocumentFragment();
529
- for (; n.body.firstChild; )
530
- o.appendChild(n.body.firstChild);
531
- return o;
532
- } catch (t) {
533
- return this.options.development && console.warn("[Template Compiler] Could not create static fragment:", t), null;
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
+ } catch {
532
+ const i = j(n, e);
533
+ r[e] = i;
534
534
  }
535
- }
536
535
  }
537
- function R(e, t) {
538
- try {
539
- if (t.length === 1 && t[0] === 0 && e instanceof Element)
540
- return e;
541
- let r = e;
542
- for (let n = 0; n < t.length; n++) {
543
- const o = t[n];
544
- if (!r.childNodes || r.childNodes.length <= o)
545
- return null;
546
- r = r.childNodes[o];
547
- }
548
- return r;
549
- } catch {
550
- return null;
551
- }
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
+ );
543
+ c >= 0 ? o[c] = `display: ${s}` : o.push(`display: ${s}`), t.style = o.join("; ");
544
+ } else
545
+ t.style = `display: ${s}`;
552
546
  }
553
- function P(e, t, r) {
554
- let n;
555
- return e.fragment && !e.hasDynamics ? n = e.fragment.cloneNode(!0) : n = st(e, t, r), n;
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);
556
554
  }
557
- function nt(e, t, r, n, o) {
558
- if (e.hasDynamics)
559
- for (const s of e.dynamics)
560
- try {
561
- const i = s.getValue(r, n);
562
- if (o !== void 0 && s.getValue(o, n) === i)
563
- continue;
564
- K(t, s, i);
565
- } catch (i) {
566
- console.warn("[Template Compiler] Error applying update:", i);
555
+ function he(e, t, r) {
556
+ let n;
557
+ if (typeof e == "string") {
558
+ if (!r) return;
559
+ n = j(r, e);
560
+ } else
561
+ n = e;
562
+ let i = "";
563
+ if (typeof n == "string")
564
+ i = n;
565
+ else if (n && typeof n == "object") {
566
+ const o = [];
567
+ for (const [c, d] of Object.entries(n))
568
+ if (d != null && d !== "") {
569
+ const a = c.replace(
570
+ /[A-Z]/g,
571
+ (f) => `-${f.toLowerCase()}`
572
+ ), u = [
573
+ "width",
574
+ "height",
575
+ "top",
576
+ "right",
577
+ "bottom",
578
+ "left",
579
+ "margin",
580
+ "margin-top",
581
+ "margin-right",
582
+ "margin-bottom",
583
+ "margin-left",
584
+ "padding",
585
+ "padding-top",
586
+ "padding-right",
587
+ "padding-bottom",
588
+ "padding-left",
589
+ "font-size",
590
+ "line-height",
591
+ "border-width",
592
+ "border-radius",
593
+ "min-width",
594
+ "max-width",
595
+ "min-height",
596
+ "max-height"
597
+ ];
598
+ let y = String(d);
599
+ typeof d == "number" && u.includes(a) && (y = `${d}px`), o.push(`${a}: ${y}`);
567
600
  }
568
- }
569
- function st(e, t, r) {
570
- let n = "";
571
- for (let a = 0; a < e.statics.length; a++)
572
- if (n += e.statics[a], a < e.dynamics.length) {
573
- const c = e.dynamics[a];
574
- if (c.type === "text" || c.type === "attribute") {
575
- const l = c.getValue(t, r);
576
- n += String(l ?? "");
577
- } else (c.type === "property" || c.type === "class" || c.type === "style") && (n += "");
578
- }
579
- if (typeof document > "u")
580
- return new DocumentFragment();
581
- const s = new DOMParser().parseFromString(n, "text/html"), i = document.createDocumentFragment();
582
- for (; s.body.firstChild; )
583
- i.appendChild(s.body.firstChild);
584
- for (const a of e.dynamics) {
585
- const c = a.getValue(t, r), l = R(i, a.path);
586
- K(l, a, c);
601
+ i = o.join("; ") + (o.length > 0 ? ";" : "");
587
602
  }
588
- return i;
603
+ const s = t.style || "";
604
+ t.style = s + (s && !s.endsWith(";") ? "; " : "") + i;
589
605
  }
590
- function K(e, t, r) {
591
- try {
592
- if (t.type === "text") {
593
- const o = document.createTreeWalker(
594
- e,
595
- NodeFilter.SHOW_TEXT
596
- );
597
- let s = !1, i;
598
- for (; i = o.nextNode(); ) {
599
- const c = i.textContent || "";
600
- if (c.includes("Count: ")) {
601
- const l = c.replace(/Count: \d+/, `Count: ${r}`);
602
- i.textContent = l, s = !0;
603
- }
604
- }
605
- if (s) return;
606
- const a = R(e, t.path);
607
- a && a.nodeType === Node.TEXT_NODE && (a.textContent = r == null ? "" : String(r));
608
- return;
609
- }
610
- const n = R(e, t.path);
611
- if (!n)
612
- return;
613
- switch (t.type) {
614
- case "attribute":
615
- if (n.nodeType === Node.ELEMENT_NODE && t.target) {
616
- const o = n;
617
- r == null || r === "" ? o.removeAttribute(t.target) : o.setAttribute(t.target, String(r));
618
- }
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
+ case "model":
612
+ ce(
613
+ typeof a == "string" ? a : String(a),
614
+ u,
615
+ i,
616
+ s,
617
+ o,
618
+ t,
619
+ r
620
+ );
621
+ break;
622
+ case "bind":
623
+ fe(a, i, s, t);
619
624
  break;
620
- case "property":
621
- n.nodeType === Node.ELEMENT_NODE && t.target && (n[t.target] = r ?? "", n.setAttribute(t.target, r == null ? "" : String(r)));
625
+ case "show":
626
+ de(a, s, t);
622
627
  break;
623
628
  case "class":
624
- if (n.nodeType === Node.ELEMENT_NODE && t.target) {
625
- const o = n;
626
- o.className = r == null ? "" : String(r), o.setAttribute("class", r == null ? "" : String(r));
627
- }
629
+ ue(a, s, t);
628
630
  break;
629
631
  case "style":
630
- if (n.nodeType === Node.ELEMENT_NODE && t.target) {
631
- const o = n;
632
- o.style[t.target] = r == null ? "" : String(r), o.setAttribute("style", r == null ? `${t.target}:` : `${t.target}:${r}`);
633
- }
632
+ he(a, s, t);
634
633
  break;
635
- default:
636
- throw new Error(`Unknown update type: ${t.type}`);
637
634
  }
638
- } catch (n) {
639
- (typeof globalThis < "u" ? globalThis.isDevelopment : j) && console.warn("[Template Compiler] Error applying update:", t, n);
640
635
  }
636
+ return { props: i, attrs: s, listeners: o };
641
637
  }
642
- const S = /* @__PURE__ */ new Map(), v = /* @__PURE__ */ new Map();
643
- function U(e) {
644
- let t = 0;
645
- for (let r = 0; r < e.length; r++) {
646
- const n = e.charCodeAt(r);
647
- t = (t << 5) - t + n, t = t & t;
638
+ function J(e, t) {
639
+ if (Array.isArray(e)) {
640
+ const s = /* @__PURE__ */ new Set();
641
+ return e.map((o) => {
642
+ if (!o || typeof o != "object") return o;
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
+ }
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
+ });
648
655
  }
649
- return `tpl_${Math.abs(t).toString(36)}`;
650
- }
651
- function q(e, t, r, n, o) {
652
- return n && o ? `${t}.${e}[${r}]:${n}:${o}` : n ? `${t}.${e}[${r}]:${n}` : `${t}.${e}[${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 };
653
659
  }
654
- function z(e, t, r) {
655
- if (!(!e || !(e instanceof Element)) && e.contains(r) && r.parentNode === e)
656
- try {
657
- e.replaceChild(t, r);
658
- } catch (n) {
659
- console.error("[VDOM] safeReplaceChild: error replacing child", n, {
660
- parent: e,
661
- newChild: t,
662
- oldChild: r,
663
- parentHTML: e.outerHTML,
664
- newChildHTML: t.outerHTML,
665
- oldChildHTML: r.outerHTML
666
- });
667
- }
668
- }
669
- function g(e) {
670
- if (e.type === "#whitespace")
671
- return null;
672
- if (e.type === "#text") {
673
- const r = document.createTextNode(e.props.nodeValue ?? "");
674
- return e.dom = r, r;
675
- }
676
- const t = document.createElement(e.type);
677
- for (const [r, n] of Object.entries(e.props))
678
- r === "value" && t instanceof HTMLInputElement ? t.type === "radio" ? t.setAttribute("value", n) : (t.type, t.value = n, t.setAttribute("value", n)) : t.setAttribute(r, n);
679
- e.dom = t;
680
- for (const r of e.children) {
681
- const n = g(r);
682
- n && t.appendChild(n);
660
+ function pe(e, t, r, n) {
661
+ const i = r.directives ?? {}, s = re(
662
+ i,
663
+ n,
664
+ e,
665
+ r.attrs
666
+ ), o = {
667
+ ...t.props,
668
+ ...r.props,
669
+ ...s.props
670
+ }, c = {
671
+ ...t.attrs,
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
+ }
679
+ for (const [f, w] of Object.entries(
680
+ s.listeners || {}
681
+ ))
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)));
683
687
  }
684
- return t;
685
688
  }
686
- function it(e) {
687
- const t = document.createElement("template");
688
- t.innerHTML = e.trim();
689
- const r = Array.from(t.content.childNodes);
690
- return r.length === 1 ? $(r[0]) : {
691
- type: "#fragment",
692
- key: void 0,
693
- props: {},
694
- children: r.map((o, s) => $(o, "#fragment", s)),
695
- dom: void 0
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
+ );
696
+ return e.key != null && (a.key = e.key), a;
697
+ }
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
+ }
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
+ ...o.props
712
+ }, d = {
713
+ ...i,
714
+ ...o.attrs
696
715
  };
697
- }
698
- function $(e, t = "", r = 0) {
699
- if (!e)
700
- return { type: "#unknown", key: void 0, props: {}, children: [], dom: void 0 };
701
- if (e.nodeType === Node.TEXT_NODE)
702
- return !e.nodeValue || /^\s*$/.test(e.nodeValue) ? { type: "#whitespace", key: void 0, props: {}, children: [], dom: void 0 } : { type: "#text", key: q("#text", t, r), props: { nodeValue: e.nodeValue }, children: [], dom: e };
703
- if (e.nodeType === Node.ELEMENT_NODE) {
704
- const n = e, o = {};
705
- Array.from(n.attributes).forEach((l) => {
706
- o[l.name] = l.value;
707
- });
708
- const s = n.tagName.toLowerCase();
709
- let i;
710
- if ((s === "input" || s === "select" || s === "textarea") && n.hasAttribute("data-model")) {
711
- const l = n.getAttribute("data-model"), u = n.getAttribute("type") ?? "";
712
- i = `${s}:${l}:${u}`, o["data-uid"] = i, n.setAttribute("data-uid", i);
713
- let d = n.getAttribute("value"), f = n.getAttribute("checked");
714
- d && (o.value = d), f && (o.checked = f);
715
- } else s === "input" || s === "textarea" || s === "select" || n.hasAttribute("contenteditable") ? (i = `${s}:${t}:${r}`, o["data-uid"] = i, n.setAttribute("data-uid", i)) : (i = q(s, t, r), s === "li" && (o["data-uid"] = i, n.setAttribute("data-uid", i)));
716
- const a = Array.from(n.childNodes).map((l, u) => $(l, i, u));
717
- return {
718
- type: s,
719
- key: i,
720
- props: o,
721
- children: a,
722
- dom: n
723
- };
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
+ }
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
+ else {
729
+ if (a.startsWith("on") && u === void 0)
730
+ continue;
731
+ u == null || u === !1 ? r.removeAttribute(a) : r.setAttribute(a, String(u));
732
+ }
724
733
  }
725
- return { type: "#unknown", key: void 0, props: {}, children: [], dom: void 0 };
734
+ for (const [a, u] of Object.entries(
735
+ o.listeners || {}
736
+ ))
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;
726
743
  }
727
- function M(e, t, r) {
728
- if (!t || !r) return;
729
- function n(c) {
730
- return !!c && c.type !== "#whitespace" && !(c.type === "#text" && (!c.props?.nodeValue || /^\s*$/.test(c.props.nodeValue)));
731
- }
732
- const o = Array.isArray(t.children) ? t.children.filter(n) : [], s = Array.isArray(r.children) ? r.children.filter(n) : [], i = r.type === "input" || r.type === "select" || r.type === "textarea";
733
- if (t.type !== r.type || t.key !== r.key) {
734
- const c = g(r);
735
- if (c instanceof Node && t.dom instanceof Node && e.contains(t.dom)) {
736
- if (z(e, c, t.dom), i && r.props && e.firstChild instanceof HTMLInputElement) {
737
- const l = e.firstChild;
738
- l.type === "radio" || l.type, l.value = r.props.value, l.setAttribute("value", r.props.value), "checked" in r.props && (l.checked = r.props.checked === !0 || r.props.checked === "true");
739
- }
740
- } else if (c instanceof Node)
741
- if (c) {
742
- if (e.appendChild(c), r.dom = c, i && r.props && e.firstChild instanceof HTMLInputElement) {
743
- const l = e.firstChild;
744
- l.type === "radio" ? l.setAttribute("value", r.props.value) : (l.type, l.value = r.props.value, l.setAttribute("value", r.props.value)), "checked" in r.props && (l.checked = r.props.checked === !0 || r.props.checked === "true");
745
- }
746
- } else
747
- r.dom = void 0;
748
- else
749
- r.dom = void 0;
750
- return;
751
- }
752
- if (i && t.dom instanceof HTMLElement && r.props) {
753
- for (const [c, l] of Object.entries(r.props))
754
- if (c === "value" && e.firstChild instanceof HTMLInputElement)
755
- e.firstChild.value = l;
756
- else if (c === "checked" && e.firstChild instanceof HTMLInputElement)
757
- e.firstChild.checked = l === !0 || l === "true";
758
- else if (c in t.dom)
759
- try {
760
- t.dom[c] = l;
761
- } catch {
762
- }
763
- else
764
- t.dom.setAttribute(c, l);
765
- for (let c = r.children.length; c < o.length; c++)
766
- o[c] && o[c].dom && t.dom && t.dom.contains(o[c].dom) && t.dom.removeChild(o[c].dom);
744
+ function ge(e, t, r, n) {
745
+ if (typeof r == "string") {
746
+ e.textContent !== r && (e.textContent = r);
767
747
  return;
768
748
  }
769
- const a = t.dom;
770
- if (a && a instanceof Element && r.props) {
771
- const c = a.tagName.toLowerCase() === "input" ? a.getAttribute("type") : void 0, l = a.tagName.includes("-");
772
- for (const [u, d] of Object.entries(r.props))
773
- if (!(c === "radio" && u === "value")) {
774
- if (c === "checkbox" && u === "value") {
775
- a.setAttribute("value", d);
776
- continue;
777
- }
778
- a.setAttribute(u, d);
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
+ }
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
+ }
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);
779
778
  }
780
- if (l)
781
- for (const [u, d] of Object.entries(r.props))
782
- a.setAttribute(u, d);
783
- for (const u of Array.from(a.attributes).map((d) => d.name))
784
- if (!(u in r.props)) {
785
- if (c === "radio" && u === "value" || c === "checkbox" && u === "value") continue;
786
- a.removeAttribute(u);
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
+ } else
792
+ _ = T(v, n), e.insertBefore(_, k), S.add(_);
793
+ k = _.nextSibling;
787
794
  }
788
- }
789
- if (r.type === "#text") {
790
- if (a && a.nodeType === Node.TEXT_NODE)
791
- a.nodeValue !== r.props.nodeValue && (a.nodeValue = r.props.nodeValue), r.dom = a;
792
- else {
793
- const c = document.createTextNode(r.props.nodeValue ?? "");
794
- a && e.contains(a) && a.parentNode === e ? z(e, c, a) : e.appendChild(c), r.dom = c;
795
- }
796
- return;
797
- }
798
- if (a instanceof Element) {
799
- const c = /* @__PURE__ */ new Map();
800
- o.forEach((f) => f.key && c.set(f.key, f));
801
- const l = new Set(s.map((f) => f.key));
802
- let u = [];
803
- for (let f = 0; f < s.length; f++) {
804
- const h = s[f], m = h.key ? c.get(h.key) : o[f];
805
- let p;
806
- const C = h.type === "input" || h.type === "select" || h.type === "textarea";
807
- if (m && m.dom && (!C || m.type === h.type && m.key === h.key))
808
- M(a, m, h), p = m.dom;
809
- else {
810
- const E = g(h);
811
- if (p = E instanceof Node ? E : void 0, p) {
812
- if ((p instanceof Element || p instanceof Node) && p.contains(a))
813
- throw console.error("[VDOM] Attempted to insert a parent into its own child:", {
814
- parentTag: a.tagName,
815
- childTag: p.tagName,
816
- parentUid: a.getAttribute?.("data-uid"),
817
- childUid: p.getAttribute?.("data-uid"),
818
- parent: a,
819
- child: p
820
- }), new Error("VDOM patch error: Attempted to insert a parent into its own child");
821
- a.insertBefore(p, a.childNodes[f] || null);
822
- }
795
+ for (const v of g)
796
+ !S.has(v) && e.contains(v) && e.removeChild(v);
797
+ } else {
798
+ const h = Math.min(
799
+ b.length,
800
+ C.length
801
+ );
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]));
823
805
  }
824
- h.dom = p, p && u.push(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]);
825
810
  }
826
- for (o.forEach((f) => {
827
- !l.has(f.key) && f.dom && a.contains(f.dom) && a.removeChild(f.dom);
828
- }); a.childNodes.length > s.length; )
829
- a.removeChild(a.lastChild);
830
- for (let f = 0; f < u.length; f++)
831
- if (a.childNodes[f] !== u[f]) {
832
- if ((u[f] instanceof Element || u[f] instanceof Node) && u[f].contains(a))
833
- throw new Error("VDOM patch error: Attempted to insert a parent into its own child");
834
- a.insertBefore(u[f], a.childNodes[f] || null);
835
- }
836
- r.dom = a;
837
- const d = new Set(s.map((f) => f.key));
838
- Array.from(a.childNodes).forEach((f, h) => {
839
- const m = f.getAttribute?.("data-uid");
840
- (m && !d.has(m) || h >= s.length) && a.removeChild(f);
841
- });
842
811
  }
843
- }
844
- const ot = (e) => e ? typeof URLSearchParams > "u" ? {} : Object.fromEntries(new URLSearchParams(e)) : {}, b = (e, t) => {
845
- for (const r of e) {
846
- const n = [], o = r.path.replace(/:[^/]+/g, (a) => (n.push(a.slice(1)), "([^/]+)")), s = new RegExp(`^${o}$`), i = t.match(s);
847
- if (i) {
848
- const a = {};
849
- return n.forEach((c, l) => {
850
- a[c] = i[l + 1];
851
- }), { route: r, params: a };
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
+ } else
824
+ y(
825
+ l,
826
+ b,
827
+ o.get(p)?.children,
828
+ m
829
+ );
830
+ u(l, b), a = b.nextSibling;
831
+ continue;
852
832
  }
853
- }
854
- return { route: null, params: {} };
855
- }, k = {};
856
- async function at(e) {
857
- if (e.component) return e.component;
858
- if (e.load) {
859
- if (k[e.path]) return k[e.path];
860
- try {
861
- const t = await e.load();
862
- return k[e.path] = t.default, t.default;
863
- } catch {
864
- throw new Error(`Failed to load component for route: ${e.path}`);
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
+ } else
842
+ w = T(f, n), a && !e.contains(a) && (a = null), e.insertBefore(w, a), d.add(w);
843
+ a = w.nextSibling;
844
+ }
845
+ for (const f of i)
846
+ !d.has(f) && e.contains(f) && e.removeChild(f);
847
+ }
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
+ {
854
+ const s = document.createTextNode(r);
855
+ return e.parentNode?.replaceChild(s, e), s;
865
856
  }
866
857
  }
867
- throw new Error(`No component or loader defined for route: ${e.path}`);
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
+ }
867
+ if (!r) {
868
+ const s = document.createComment("removed");
869
+ return e.parentNode?.replaceChild(s, e), s;
870
+ }
871
+ if (!t || typeof t == "string") {
872
+ const s = T(r, n);
873
+ return e.parentNode?.replaceChild(s, e), s;
874
+ }
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
+ }
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
+ }
888
+ const i = T(r, n);
889
+ return e.parentNode?.replaceChild(i, e), i;
868
890
  }
869
- function ct(e) {
870
- const { routes: t, base: r = "" } = e;
871
- let n, o, s, i, a, c, l;
872
- if (typeof window < "u" && typeof document < "u") {
873
- n = () => {
874
- const d = new URL(window.location.href), f = d.pathname.replace(r, "") || "/", h = ot(d.search);
875
- return { path: f, query: h };
876
- }, o = n();
877
- const u = b(t, o.path);
878
- s = N({
879
- path: o.path,
880
- params: u.params,
881
- query: o.query
882
- }), i = () => {
883
- const d = n(), f = b(t, d.path), h = s.getState();
884
- h.path = d.path, h.params = f.params, h.query = d.query;
885
- }, window.addEventListener("popstate", i), a = (d) => {
886
- window.history.pushState({}, "", r + d), i();
887
- }, c = (d) => {
888
- window.history.replaceState({}, "", r + d), i();
889
- }, l = () => window.history.back();
890
- } else {
891
- n = () => ({ path: "/", query: {} }), o = n();
892
- const u = b(t, o.path);
893
- s = N({
894
- path: o.path,
895
- params: u.params,
896
- query: o.query
897
- }), i = () => {
898
- }, a = () => {
899
- }, c = () => {
900
- }, l = () => {
901
- };
902
- }
903
- return {
904
- store: s,
905
- push: a,
906
- replace: c,
907
- back: l,
908
- subscribe: s.subscribe,
909
- matchRoute: (u) => b(t, u),
910
- getCurrent: () => s.getState(),
911
- resolveRouteComponent: at
912
- };
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
+ }
903
+ d.forEach((a) => e.removeChild(a)), e._prevVNode = i, e._prevDom = c;
913
904
  }
914
- function mt(e, t) {
915
- return b(e, t);
905
+ function ye(e) {
906
+ return e.replace(/\/\*[\s\S]*?\*\//g, "").replace(/\s+/g, " ").replace(/\s*([{}:;,>+~])\s*/g, "$1").replace(/;}/g, "}").trim();
916
907
  }
917
- function x(e, t) {
918
- const r = [], n = t ? Object.keys(t) : [], o = { ...e };
919
- let s = null;
920
- function i(u) {
921
- return r.push(u), () => {
922
- const d = r.indexOf(u);
923
- d !== -1 && r.splice(d, 1);
924
- };
925
- }
926
- function a(u) {
927
- Object.assign(s, u), r.forEach((d) => d(s));
928
- }
929
- const c = /* @__PURE__ */ new WeakMap();
930
- function l(u) {
931
- if (c.has(u)) return c.get(u);
932
- const d = new Proxy(u, {
933
- get(f, h, m) {
934
- if (h === "subscribe") return i;
935
- if (h === "set") return a;
936
- if (t && n.includes(h))
937
- return t[h](s);
938
- const p = Reflect.get(f, h, m);
939
- return typeof p == "object" && p !== null ? l(p) : p;
940
- },
941
- set(f, h, m, p) {
942
- if (t && n.includes(h))
943
- return !1;
944
- const C = f[h], E = Reflect.set(f, h, m, p);
945
- return C !== m && r.forEach((B) => B(s)), E;
946
- },
947
- deleteProperty(f, h) {
948
- if (t && n.includes(h))
949
- return !1;
950
- const m = Reflect.deleteProperty(f, h);
951
- return r.forEach((p) => p(s)), m;
952
- }
953
- });
954
- return c.set(u, d), d;
955
- }
956
- return s = l(o), s;
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%;
915
+ }
916
+ *,::before,::after {
917
+ box-sizing:inherit;
918
+ margin:0;
919
+ padding:0;
920
+ border:0 solid currentColor;
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("");
957
1235
  }
958
- const A = [];
959
- function yt(e) {
960
- A.push(e);
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}`;
961
1239
  }
962
- function _(e, t = /* @__PURE__ */ new WeakSet()) {
963
- if (e === null || typeof e != "object" || t.has(e)) return e;
964
- if (t.add(e), Array.isArray(e)) return e.map((o) => _(o, t));
965
- Object.getPrototypeOf(e) !== Object.prototype && Object.getPrototypeOf(e) !== null && Object.setPrototypeOf(e, null);
966
- const r = ["__proto__", "constructor", "prototype"], n = /* @__PURE__ */ Object.create(null);
967
- for (const o of Object.keys(e))
968
- r.includes(o) || (n[o] = _(e[o], t));
969
- return n;
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;
970
1253
  }
971
- function O(e) {
972
- return !!e && typeof e.then == "function";
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 };
973
1259
  }
974
- let H;
975
- typeof HTMLElement < "u" ? H = class extends HTMLElement {
976
- /**
977
- * Syncs whitelisted state properties to attributes after render.
978
- * Only keys listed in config.reflect are reflected.
979
- */
980
- syncStateToAttributes() {
981
- if (!this.stateObj || !this.config?.reflect || !Array.isArray(this.config.reflect)) return;
982
- const e = ["__proto__", "constructor", "prototype"];
983
- this.config.reflect.forEach((t) => {
984
- if (e.includes(t)) {
985
- this.removeAttribute(t);
986
- return;
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})`);
987
1268
  }
988
- const r = this.stateObj[t];
989
- ["string", "number", "boolean"].includes(typeof r) ? r == null ? this.removeAttribute(t) : this.setAttribute(t, String(r)) : this.removeAttribute(t);
990
- });
991
- }
992
- /**
993
- * Allows updating the template function at runtime and triggers a re-render.
994
- * @param newTemplate - New template function or string
995
- */
996
- setTemplate(e) {
997
- const t = this.config;
998
- typeof e == "function" ? t.template = e : t.template = () => e, this.render();
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
+ }
999
1279
  }
1000
- _hasError = !1;
1001
- _mountedCalled = !1;
1002
- _unmountedCalled = !1;
1003
- /**
1004
- * Tracks auto-wired config event handlers for removal
1005
- */
1006
- _autoWiredHandlers = {};
1007
- /**
1008
- * Override removeEventListener to support auto-wired config handler removal
1009
- */
1010
- removeEventListener(e, t, r) {
1011
- super.removeEventListener(e, t, r), this._autoWiredHandlers[e] && (this._autoWiredHandlers[e] = this._autoWiredHandlers[e].filter((n) => n === t ? (super.removeEventListener(e, n, r), !1) : !0), this._autoWiredHandlers[e].length === 0 && delete this._autoWiredHandlers[e]);
1280
+ return i;
1281
+ }
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};`;
1329
+ }
1330
+ return null;
1331
+ }
1332
+ function $e(e) {
1333
+ return e.replace(/([!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, "\\$1");
1334
+ }
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);
1012
1343
  }
1013
- /**
1014
- * observedAttributes automatically returns all primitive keys from static state.
1015
- * This enables automatic attribute observation for all primitive state properties.
1016
- */
1017
- static get observedAttributes() {
1018
- const e = this.stateObj || {};
1019
- return Object.keys(e).filter(
1020
- (t) => ["string", "number", "boolean"].includes(typeof e[t])
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;
1356
+ }
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($)
1021
1364
  );
1022
- }
1023
- /**
1024
- * Called when an observed attribute changes. Syncs attribute to state and triggers render.
1025
- */
1026
- attributeChangedCallback(e, t, r) {
1027
- if (e === "__proto__" || e === "constructor" || e === "prototype" || !this.stateObj) return;
1028
- const n = e.replace(/-([a-z])/g, (s, i) => i.toUpperCase()), o = e in this.stateObj ? e : n in this.stateObj ? n : null;
1029
- if (o) {
1030
- const s = typeof this.config?.state?.[o];
1031
- let i = r;
1032
- if (r === null)
1033
- i = void 0;
1034
- else if (s === "number")
1035
- if (i === void 0 || i === "")
1036
- i = this.config?.state?.[o];
1037
- else {
1038
- const a = Number(i);
1039
- i = isNaN(a) ? this.config?.state?.[o] : a;
1040
- }
1041
- else s === "boolean" && (i = i === "true");
1042
- i = _(i), this.stateObj[o] !== i && (this.config?.debug && console.log("[runtime] state update:", { stateKey: o, value: i }), this.stateObj[o] = i, this.render());
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(/\{.*$/, ""));
1043
1377
  }
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]}{${_}}`), _;
1044
1380
  }
1045
- /**
1046
- * Force sync all controlled input values and event listeners after VDOM patching.
1047
- */
1048
- forceSyncControlledInputs() {
1049
- this.shadowRoot && (this.shadowRoot.querySelectorAll("input[data-model]").forEach((e) => {
1050
- const t = e.getAttribute("data-model");
1051
- if (!t || !this.stateObj || typeof this.stateObj[t] > "u") return;
1052
- const r = e, n = String(this.stateObj[t]), o = document.activeElement === r;
1053
- r._hasDirtyListener || (r.addEventListener("input", () => {
1054
- r._isDirty = !0;
1055
- }), r.addEventListener("blur", () => {
1056
- r._isDirty = !1;
1057
- }), r._hasDirtyListener = !0);
1058
- const s = !!r._isDirty;
1059
- o || s || r.type !== "radio" && r.type !== "checkbox" && r.value !== n && (r.value = n);
1060
- }), this.rebindEventListeners());
1061
- }
1062
- /**
1063
- * Sync all controlled inputs and event listeners after render
1064
- */
1065
- syncControlledInputsAndEvents() {
1066
- this.shadowRoot && (this.shadowRoot.querySelectorAll('input[type="radio"][data-model]').forEach((e) => {
1067
- const t = e.getAttribute("data-model");
1068
- if (!t || !this.stateObj || typeof this.stateObj[t] > "u")
1069
- return;
1070
- const r = e, n = String(this.stateObj[t]);
1071
- r.checked = r.value === n;
1072
- }), this.shadowRoot.querySelectorAll("input[data-model]").forEach((e) => {
1073
- const t = e.getAttribute("data-model");
1074
- if (!t || !this.stateObj || typeof this.stateObj[t] > "u") return;
1075
- const r = e, n = String(this.stateObj[t]);
1076
- if (r.type === "checkbox") {
1077
- const o = this.stateObj[t];
1078
- if (Array.isArray(o))
1079
- r.checked = o.includes(r.value);
1080
- else {
1081
- const s = r.getAttribute("data-true-value"), i = r.getAttribute("data-false-value");
1082
- s !== null || i !== null ? String(o) === s ? r.checked = !0 : String(o) === i ? r.checked = !1 : o === !0 ? r.checked = !0 : r.checked = !1 : r.checked = o === !0 || o === "true" || o === 1;
1083
- }
1084
- } else r.type === "radio" || (r.value = n);
1085
- }), this.shadowRoot.querySelectorAll("textarea[data-model]").forEach((e) => {
1086
- const t = e.getAttribute("data-model");
1087
- !t || !this.stateObj || typeof this.stateObj[t] > "u" || (e.value = String(this.stateObj[t]));
1088
- }), this.shadowRoot.querySelectorAll("select[data-model]").forEach((e) => {
1089
- const t = e.getAttribute("data-model");
1090
- !t || !this.stateObj || typeof this.stateObj[t] > "u" || (e.value = String(this.stateObj[t]));
1091
- }));
1092
- }
1093
- /**
1094
- * Attach event listeners for input[data-bind] after VDOM patching
1095
- */
1096
- attachListItemModelListeners() {
1097
- this.shadowRoot && this.shadowRoot.querySelectorAll("input[data-bind]").forEach((e) => {
1098
- const t = e.getAttribute("data-bind");
1099
- if (!t) return;
1100
- e._listItemModelListener && (e.removeEventListener("input", e._listItemModelListener), e.removeEventListener("change", e._listItemModelListener), delete e._listItemModelListener);
1101
- const r = t.match(/^([a-zA-Z0-9_]+)\[(\d+)\]\.([a-zA-Z0-9_]+)$/);
1102
- if (r) {
1103
- const [, o, s, i] = r, a = parseInt(s, 10), c = this.stateObj[o];
1104
- e instanceof HTMLInputElement && e.type === "checkbox" && (e.checked = !!(Array.isArray(c) && c[a] && c[a][i]));
1105
- const l = (u) => {
1106
- !Array.isArray(c) || !c[a] || (e instanceof HTMLInputElement && e.type === "checkbox" ? c[a][i] = e.checked : c[a][i] = e.value);
1107
- };
1108
- e.addEventListener("input", l), e.addEventListener("change", l), e._listItemModelListener = l;
1109
- return;
1110
- }
1111
- const n = t.match(/^([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)((?:\|[a-zA-Z0-9_]+)*)$/);
1112
- if (n) {
1113
- const [, o, s, i] = n, a = this.stateObj[o], c = i ? i.split("|").map((u) => u.trim()).filter(Boolean) : [];
1114
- e instanceof HTMLInputElement && e.type === "checkbox" ? e.checked = !!(a && a[s]) : e instanceof HTMLInputElement && (e.value = a ? String(a[s] ?? "") : "");
1115
- const l = (u) => {
1116
- if (!a) return;
1117
- let d;
1118
- e instanceof HTMLInputElement && e.type === "checkbox" ? d = e.checked : (d = e.value, c.includes("number") && (d = Number(d)), c.includes("trim") && typeof d == "string" && (d = d.trim())), a[s] = d;
1119
- };
1120
- e.addEventListener("input", l), e.addEventListener("change", l), e._listItemModelListener = l;
1121
- }
1122
- });
1123
- }
1124
- /**
1125
- * Attach controlled input listeners to sync DOM value to state
1126
- */
1127
- attachControlledInputListeners() {
1128
- const e = this.shadowRoot;
1129
- e && (e.querySelectorAll("[data-model]").forEach((t) => {
1130
- const r = t.getAttribute("data-model");
1131
- r && (t._dataModelBound || (Q(t, this.stateObj, r), t._dataModelBound = !0));
1132
- }), e.querySelectorAll("[data-model]").forEach((t) => {
1133
- const [r] = t.getAttribute("data-model")?.split("|").map((n) => n.trim()) ?? [];
1134
- if (!(!r || !(r in this.stateObj)))
1135
- if (t instanceof HTMLInputElement)
1136
- if (t.type === "checkbox") {
1137
- const n = this.stateObj[r], o = t.getAttribute("data-true-value"), s = t.getAttribute("data-false-value");
1138
- Array.isArray(n) ? t.checked = n.includes(t.value) : o !== null || s !== null ? String(n) === o ? t.checked = !0 : String(n) === s ? t.checked = !1 : n === !0 ? t.checked = !0 : t.checked = !1 : t.checked = n === !0 || n === "true" || n === 1;
1139
- } else t.type === "radio" ? t.checked = t.value === String(this.stateObj[r]) : t.value = String(this.stateObj[r] ?? "");
1140
- else (t instanceof HTMLTextAreaElement || t instanceof HTMLSelectElement) && (t.value = String(this.stateObj[r] ?? ""));
1141
- }));
1142
- }
1143
- config;
1144
- stateObj;
1145
- api;
1146
- _globalUnsubscribes = [];
1147
- unsubscribes = [];
1148
- lastCompiledTemplate = null;
1149
- lastState = null;
1150
- rafId = null;
1151
- /**
1152
- * Construct a new runtime component element.
1153
- * @param config - Component configuration
1154
- */
1155
- constructor() {
1156
- super();
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
+ }
1157
1394
  }
1158
- initializeConfig() {
1159
- if (this.config) return;
1160
- const e = this.tagName.toLowerCase(), r = (window.__componentRegistry || {})[e];
1161
- if (!r || typeof r != "object")
1162
- throw new Error("Invalid component config: must be an object");
1163
- if (!r.state || typeof r.state != "object")
1164
- throw new Error("Invalid component config: state must be an object");
1165
- this.config = r;
1166
- const n = r.computed ? x(r.state, r.computed) : x(r.state);
1167
- if (this.stateObj = n, typeof this.stateObj.subscribe == "function" && this.unsubscribes.push(this.stateObj.subscribe(() => {
1168
- this.scheduleRender();
1169
- })), this.api = {
1170
- state: this.stateObj,
1171
- emit: (s, i) => this.dispatchEvent(new CustomEvent(s, { detail: i, bubbles: !0 })),
1172
- onGlobal: (s, i) => {
1173
- const a = w.on(s, i);
1174
- return this._globalUnsubscribes.push(a), a;
1175
- },
1176
- offGlobal: (s, i) => w.off(s, i),
1177
- emitGlobal: (s, i) => w.emit(s, i),
1178
- render: () => this.render()
1179
- }, Object.keys(this.config).forEach((s) => {
1180
- if (s.startsWith("on") && s.length > 2 && typeof this.config[s] == "function") {
1181
- const i = s.charAt(2).toLowerCase() + s.slice(3), a = (c) => {
1182
- const l = c.detail ?? c;
1183
- this.config[s](l, this.api.state, this.api);
1184
- };
1185
- this.addEventListener(i, a), this._autoWiredHandlers[i] || (this._autoWiredHandlers[i] = []), this._autoWiredHandlers[i].push(a);
1186
- }
1187
- }), this.attachShadow({ mode: "open" }), r.style) {
1188
- const s = document.createElement("style");
1189
- s.textContent = typeof r.style == "function" ? r.style(this.stateObj) : r.style, this.shadowRoot.appendChild(s);
1395
+ const w = [...s, ...o, ...c, ...d].join("");
1396
+ return te.set(e, { css: w, timestamp: t }), w;
1397
+ }
1398
+ const Ee = /* @__PURE__ */ new Map();
1399
+ function Z(e) {
1400
+ return e.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1401
+ }
1402
+ function q(e) {
1403
+ return typeof e == "string" ? e.replace(
1404
+ /[&<>"']/g,
1405
+ (t) => ({
1406
+ "&": "&amp;",
1407
+ "<": "&lt;",
1408
+ ">": "&gt;",
1409
+ '"': "&quot;",
1410
+ "'": "&#39;"
1411
+ })[t]
1412
+ ) : e;
1413
+ }
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, "");
1416
+ }
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;
1422
+ }
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));
1430
+ }
1431
+ function Le(e) {
1432
+ if (!e.render)
1433
+ throw new Error(
1434
+ "Component must have a render function"
1435
+ );
1436
+ return typeof window > "u" ? class {
1437
+ constructor() {
1190
1438
  }
1191
- if (typeof this.config.hydrate == "function") {
1192
- const s = this.shadowRoot?.querySelectorAll("[data-hydrate]");
1193
- try {
1194
- s && s.length > 0 ? s.forEach((i) => {
1195
- try {
1196
- this.config.hydrate(i, this.stateObj, this.api);
1197
- } catch (a) {
1198
- typeof this.config.onError == "function" && this.config.onError(a instanceof Error ? a : new Error(String(a)), this.api.state, this.api), this._handleRenderError(a);
1199
- }
1200
- }) : this.config.hydrate(this.shadowRoot, this.stateObj, this.api);
1201
- } catch (i) {
1202
- typeof this.config.onError == "function" && this.config.onError(i instanceof Error ? i : new Error(String(i)), this.api.state, this.api), this._handleRenderError(i);
1203
- }
1439
+ } : class extends HTMLElement {
1440
+ context;
1441
+ _listeners = [];
1442
+ _watchers = /* @__PURE__ */ new Map();
1443
+ /** @internal */
1444
+ _renderTimeoutId = null;
1445
+ _mounted = !1;
1446
+ _hasError = !1;
1447
+ _initializing = !0;
1448
+ _styleSheet = null;
1449
+ _lastHtmlStringForJitCSS = "";
1450
+ _cfg;
1451
+ _lastRenderTime = 0;
1452
+ _renderCount = 0;
1453
+ _templateLoading = !1;
1454
+ _templateError = null;
1455
+ constructor() {
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);
1204
1460
  }
1205
- if (this.hasAttribute("data-hydrated") ? this.processRefs() : this.render(), !this._mountedCalled && typeof this.config.onMounted == "function")
1206
- try {
1207
- const s = this.config.onMounted(this.api.state, this.api);
1208
- O(s) ? s.catch((i) => {
1209
- typeof this.config.onError == "function" && this.config.onError(i, this.api.state, this.api), this._handleRenderError(i);
1210
- }).finally(() => {
1211
- this._mountedCalled = !0;
1212
- }) : this._mountedCalled = !0;
1213
- } catch (s) {
1214
- typeof this.config.onError == "function" && this.config.onError(s, this.api.state, this.api), this._handleRenderError(s), this._mountedCalled = !0;
1215
- }
1216
- }
1217
- connectedCallback() {
1218
- if (this.initializeConfig(), this.stateObj)
1219
- for (const e of this.getAttributeNames()) {
1220
- const r = e.replace(/-([a-z])/g, (n, o) => o.toUpperCase());
1221
- if (r in this.stateObj) {
1222
- const n = typeof this.config?.state?.[r];
1223
- let o = this.getAttribute(e);
1224
- n === "number" ? o = Number(o) : n === "boolean" && (o = o === "true"), this.stateObj[r] = o === null ? void 0 : o;
1225
- }
1226
- }
1227
- if (!this._mountedCalled && typeof this.config.onMounted == "function")
1228
- try {
1229
- const e = this.config.onMounted(this.api.state, this.api);
1230
- O(e) ? e.catch((t) => {
1231
- typeof this.config.onError == "function" && this.config.onError(t, this.api.state, this.api), this._handleRenderError(t);
1232
- }).finally(() => {
1233
- this._mountedCalled = !0;
1234
- }) : this._mountedCalled = !0;
1235
- } catch (e) {
1236
- typeof this.config.onError == "function" && this.config.onError(e, this.api.state, this.api), this._handleRenderError(e), this._mountedCalled = !0;
1237
- }
1238
- typeof this.render == "function" && this.render();
1239
- }
1240
- /**
1241
- * Lifecycle: called when element is removed from DOM.
1242
- */
1243
- disconnectedCallback() {
1244
- if (Object.entries(this._autoWiredHandlers).forEach(([e, t]) => {
1245
- t.forEach((r) => {
1246
- super.removeEventListener(e, r);
1461
+ connectedCallback() {
1462
+ this._runLogicWithinErrorBoundary(e, () => {
1463
+ e.onConnected && !this._mounted && (e.onConnected(this.context), this._mounted = !0);
1247
1464
  });
1248
- }), this._autoWiredHandlers = {}, this.unsubscribes.forEach((e) => e()), this.unsubscribes = [], this._globalUnsubscribes.forEach((e) => e()), this._globalUnsubscribes = [], !this._unmountedCalled && typeof this.config.onUnmounted == "function")
1249
- try {
1250
- const e = this.config.onUnmounted(this.api.state, this.api);
1251
- O(e) ? e.catch((t) => {
1252
- typeof this.config.onError == "function" && this.config.onError(t, this.api.state, this.api), this._handleRenderError(t);
1253
- }).finally(() => {
1254
- this._unmountedCalled = !0;
1255
- }) : this._unmountedCalled = !0;
1256
- } catch (e) {
1257
- typeof this.config.onError == "function" && this.config.onError(e, this.api.state, this.api), this._handleRenderError(e), this._unmountedCalled = !0;
1258
- }
1259
- this._mountedCalled = !1, this._unmountedCalled = !1;
1260
- }
1261
- /**
1262
- * Render the component. Handles both string and compiled templates, refs, and error boundaries.
1263
- */
1264
- render() {
1265
- this._hasError = !1, this.syncControlledInputsAndEvents(), setTimeout(() => this.attachControlledInputListeners(), 0);
1266
- try {
1267
- A.forEach((t) => {
1268
- try {
1269
- t.onRender?.(this.stateObj, this.api);
1270
- } catch (r) {
1271
- this._handleRenderError(r);
1465
+ }
1466
+ disconnectedCallback() {
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;
1469
+ });
1470
+ }
1471
+ attributeChangedCallback(t, r, n) {
1472
+ this._runLogicWithinErrorBoundary(e, () => {
1473
+ this._applyProps(e), e.onAttributeChanged && e.onAttributeChanged(
1474
+ t,
1475
+ r,
1476
+ n,
1477
+ this.context
1478
+ );
1479
+ });
1480
+ }
1481
+ static get observedAttributes() {
1482
+ return e.props ? Object.keys(e.props).map(Z) : [];
1483
+ }
1484
+ _applyComputed(t) {
1485
+ this._runLogicWithinErrorBoundary(e, () => {
1486
+ t.computed && Object.entries(t.computed).forEach(([r, n]) => {
1487
+ Object.defineProperty(this.context, r, {
1488
+ get: () => {
1489
+ const i = n(this.context);
1490
+ return q(i);
1491
+ },
1492
+ enumerable: !0
1493
+ });
1494
+ });
1495
+ });
1496
+ }
1497
+ // --- Render ---
1498
+ _render(t) {
1499
+ this._runLogicWithinErrorBoundary(t, () => {
1500
+ if (!this.shadowRoot) return;
1501
+ if (this._templateLoading && t.loadingTemplate) {
1502
+ this._renderOutput(t.loadingTemplate(this.context));
1503
+ return;
1272
1504
  }
1273
- }), this.config.computed && Object.values(this.config.computed).forEach((t) => {
1274
- try {
1275
- t(this.stateObj);
1276
- } catch (r) {
1277
- this._handleRenderError(r);
1505
+ if (this._templateError && t.errorTemplate) {
1506
+ this._renderOutput(t.errorTemplate(this._templateError, this.context));
1507
+ return;
1278
1508
  }
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;
1515
+ }
1516
+ throw n;
1517
+ }), t.loadingTemplate && this._renderOutput(t.loadingTemplate(this.context));
1518
+ return;
1519
+ }
1520
+ this._renderOutput(r), this._applyStyle(t);
1279
1521
  });
1280
- const e = this.config.template(this.stateObj, this.api);
1281
- e instanceof Promise ? e.then((t) => {
1282
- this._hasError || (this._renderTemplateResult(t), this.syncStateToAttributes(), setTimeout(() => this.attachListItemModelListeners(), 0));
1283
- }).catch((t) => {
1284
- this._handleRenderError(t);
1285
- }) : this._hasError || (this._renderTemplateResult(e), this.syncStateToAttributes(), setTimeout(() => this.attachListItemModelListeners(), 0));
1286
- } catch (e) {
1287
- this._handleRenderError(e), this.renderError(e instanceof Error ? e : new Error(String(e)));
1288
1522
  }
1289
- }
1290
- /**
1291
- * Internal: render a template result (string or compiled template)
1292
- */
1293
- _prevVNode = null;
1294
- /**
1295
- * Rebind event listeners for elements with data-on-* attributes in the shadow DOM
1296
- */
1297
- rebindEventListeners() {
1298
- if (!this.shadowRoot) return;
1299
- ["data-on-input", "data-on-change", "data-on-blur", "data-on-click"].forEach((t) => {
1300
- this.shadowRoot.querySelectorAll(`[${t}]`).forEach((r) => {
1301
- const n = t.replace("data-on-", ""), o = r.getAttribute(t);
1302
- if (!o || typeof this.config[o] != "function") return;
1303
- r._boundHandlers && r._boundHandlers[n] && r.removeEventListener(n, r._boundHandlers[n]);
1304
- const s = this.config[o], i = (a) => s.call(this, a, this.stateObj, this.api);
1305
- r.addEventListener(n, i), r._boundHandlers || (r._boundHandlers = {}), r._boundHandlers[n] = i;
1306
- });
1307
- }), Array.from(this.shadowRoot.children).forEach((t) => {
1308
- t instanceof HTMLElement && typeof t.rebindEventListeners == "function" && t.rebindEventListeners();
1309
- });
1310
- }
1311
- /**
1312
- * Internal: render a template result (string or compiled template).
1313
- * Handles VDOM patching, style updates, refs, and event binding.
1314
- * @param templateResult - HTML string or compiled template
1315
- */
1316
- _renderTemplateResult(e) {
1317
- if (!this._hasError)
1318
- try {
1319
- let t = function(r) {
1320
- const n = /* @__PURE__ */ new WeakSet();
1321
- function o(s) {
1322
- if (s === null || typeof s != "object" || n.has(s)) return s;
1323
- if (n.add(s), Array.isArray(s)) return s.map(o);
1324
- const i = {};
1325
- for (const a in s)
1326
- Object.prototype.hasOwnProperty.call(s, a) && (i[a] = o(s[a]));
1327
- return i;
1328
- }
1329
- return o(r);
1330
- };
1331
- if (typeof e == "string") {
1332
- let r = function(c) {
1333
- return c.replace(/<([a-zA-Z0-9]+)([^>]*)>/g, (l, u, d) => {
1334
- const f = d.replace(/\s+on[a-zA-Z]+\s*=\s*(['"][^'"]*['"]|[^\s>]*)/gi, "");
1335
- return `<${u}${f}>`;
1336
- });
1337
- }, n = function(c) {
1338
- c.children.forEach(n);
1339
- };
1340
- const o = r(e), s = it(o);
1341
- n(s);
1342
- const i = this.shadowRoot;
1343
- if (!i)
1344
- return;
1345
- let a = i.querySelector("style");
1346
- if (a || (a = document.createElement("style"), i.appendChild(a)), this.config.style ? a.textContent = typeof this.config.style == "function" ? this.config.style(this.stateObj) : this.config.style : a.textContent = "", s.type === "#fragment") {
1347
- const c = Array.from(i.childNodes).find(
1348
- (l) => l.nodeType === 1 && l !== a
1349
- );
1350
- if (c) {
1351
- Array.from(c.childNodes).forEach((d) => {
1352
- d.nodeType === 1 && d.nodeName === "STYLE" || c.removeChild(d);
1353
- });
1354
- const l = {
1355
- type: "#fragment",
1356
- dom: c,
1357
- children: s.children,
1358
- props: {},
1359
- key: void 0
1360
- }, u = this._prevVNode && this._prevVNode.type === "#fragment" ? { ...this._prevVNode, dom: c } : l;
1361
- M(c, u, l);
1362
- } else
1363
- s.children.forEach((l) => {
1364
- const u = g(l);
1365
- u && i.appendChild(u), l.dom = u ?? void 0;
1366
- });
1367
- } else {
1368
- let c = Array.from(this.shadowRoot.childNodes).find(
1369
- (l) => l !== a && l.nodeType === 1
1370
- );
1371
- if (c)
1372
- if (this._prevVNode && (this._prevVNode.type !== s.type || this._prevVNode.key !== s.key)) {
1373
- const l = g(s);
1374
- l && (this.shadowRoot.contains(c) && this.shadowRoot.replaceChild(l, c), c = l);
1375
- } else
1376
- M(c, this._prevVNode, s);
1377
- else
1378
- c = g(s), c && this.shadowRoot.appendChild(c);
1379
- s.dom = c;
1380
- }
1381
- this._prevVNode = s, this.forceSyncControlledInputs(), this.lastCompiledTemplate = null;
1382
- } else {
1383
- const r = !this.shadowRoot.firstElementChild, n = this.lastCompiledTemplate?.id === e.id;
1384
- if (r) {
1385
- const o = P(e, this.stateObj, this.api);
1386
- this.shadowRoot.appendChild(o);
1387
- } else if (n && this.shadowRoot.firstElementChild) {
1388
- const o = this.lastState;
1389
- nt(e, this.shadowRoot.firstElementChild, this.stateObj, this.api, o || void 0);
1390
- } else {
1391
- const o = P(e, this.stateObj, this.api);
1392
- let s = this.shadowRoot.querySelector("style");
1393
- s || (s = document.createElement("style"), this.shadowRoot.insertBefore(s, this.shadowRoot.firstChild)), this.config.style ? s.textContent = typeof this.config.style == "function" ? this.config.style(this.stateObj) : this.config.style : s.textContent = "";
1394
- let i = this.shadowRoot.querySelector("[data-root]");
1395
- for (i || (i = document.createElement("div"), i.setAttribute("data-root", ""), this.shadowRoot.appendChild(i)); i.firstChild; )
1396
- i.removeChild(i.firstChild);
1397
- i.appendChild(o);
1523
+ // --- Helper to render output ---
1524
+ _renderOutput(t) {
1525
+ if (!this.shadowRoot) return;
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;
1398
1534
  }
1399
- this.lastCompiledTemplate = e;
1400
- }
1401
- this.lastState = t(this.stateObj), this.updateStyle(), this.processRefs(), this.bindEvents(), this.syncControlledInputsAndEvents();
1402
- } catch (t) {
1403
- this._handleRenderError(t);
1404
- }
1405
- }
1406
- /**
1407
- * Internal: handle render errors and error boundaries.
1408
- * Logs details and allows fallback UI.
1409
- * @param error - Error object
1410
- */
1411
- _handleRenderError(e) {
1412
- if (this._hasError = !0, this.config.debug && console.error(`[runtime] Render error in <${this.tagName.toLowerCase()}>:`, e), A.forEach((t) => t.onError?.(e instanceof Error ? e : new Error(String(e)), this.stateObj, this.api)), "onError" in this.config && typeof this.config.onError == "function")
1413
- try {
1414
- this.config.onError(e instanceof Error ? e : new Error(String(e)), this.api.state, this.api);
1415
- } catch (t) {
1416
- this.config.debug && console.error("[runtime] Error in onError handler:", t);
1417
- }
1418
- this.renderError(e instanceof Error ? e : new Error(String(e)));
1419
- }
1420
- /**
1421
- * Schedule a render using requestAnimationFrame, batching multiple state changes.
1422
- */
1423
- scheduleRender() {
1424
- this.rafId !== void 0 && this.rafId !== null && cancelAnimationFrame(this.rafId), this.rafId = requestAnimationFrame(() => {
1425
- this.render(), this.rafId = null;
1426
- });
1427
- }
1428
- /**
1429
- * Updates the style element in the shadow root based on the current state.
1430
- */
1431
- updateStyle() {
1432
- const e = this.shadowRoot.querySelector("style");
1433
- if (!e || !this.config.style) return;
1434
- const t = typeof this.config.style == "function" ? this.config.style(this.api.state) : this.config.style;
1435
- e.textContent = t;
1436
- }
1437
- /**
1438
- * Processes and attaches ref handlers for elements with data-ref attributes.
1439
- */
1440
- processRefs() {
1441
- if (!this.config.refs) return;
1442
- const e = /* @__PURE__ */ new WeakMap();
1443
- Object.entries(this.config.refs).forEach(([t, r]) => {
1444
- const n = this.shadowRoot.querySelector(`[data-ref="${t}"]`);
1445
- if (n) {
1446
- e.has(n) || e.set(n, /* @__PURE__ */ new Set());
1447
- const o = e.get(n), s = n.addEventListener;
1448
- n.addEventListener = function(i, a, c) {
1449
- const l = `${i}`;
1450
- o.has(l) || (o.add(l), s.call(n, i, a, c));
1451
- }, n.setAttribute("data-refs-processed", "true");
1452
- try {
1453
- r(n, this.api.state, this.api);
1454
- } catch (i) {
1455
- this._handleRenderError(i);
1535
+ return n[i] = s, !0;
1456
1536
  }
1457
- }
1458
- });
1459
- }
1460
- /**
1461
- * Automatically bind events for elements with data-on-* attributes.
1462
- * Ensures events are not attached multiple times after rerender.
1463
- */
1464
- bindEvents() {
1465
- if (!this.shadowRoot) return;
1466
- const e = document.createTreeWalker(this.shadowRoot, NodeFilter.SHOW_ELEMENT);
1467
- let t = e.nextNode();
1468
- for (; t; ) {
1469
- const r = t;
1470
- Array.from(r.attributes).forEach((n) => {
1471
- if (n.name.startsWith("data-on-")) {
1472
- const o = n.name.slice(8), s = n.value, i = this.config[s];
1473
- if (typeof i == "function") {
1474
- r._boundHandlers && r._boundHandlers[o] && r.removeEventListener(o, r._boundHandlers[o]);
1475
- const a = (c) => {
1476
- i.call(this.config, c, this.api.state, this.api), this.syncControlledInputsAndEvents();
1477
- };
1478
- r.addEventListener(o, a), r._boundHandlers || (r._boundHandlers = {}), r._boundHandlers[o] = a;
1479
- } else
1480
- this.config.debug && console.warn(`[runtime] Handler '${s}' not found on config for event '${o}'`, r);
1537
+ });
1538
+ me(
1539
+ this.shadowRoot,
1540
+ Array.isArray(t) ? t : [t],
1541
+ r
1542
+ ), this._lastHtmlStringForJitCSS = this.shadowRoot.innerHTML;
1543
+ }
1544
+ _requestRender() {
1545
+ if (this._renderTimeoutId !== null && clearTimeout(this._renderTimeoutId), Date.now() - this._lastRenderTime < 16) {
1546
+ if (this._renderCount++, this._renderCount > 10) {
1547
+ console.warn(
1548
+ `[${this.tagName}] Potential infinite render loop detected. Skipping render.`
1549
+ ), this._renderTimeoutId = null;
1550
+ return;
1481
1551
  }
1482
- }), t = e.nextNode();
1552
+ } else
1553
+ this._renderCount = 0;
1554
+ this._renderTimeoutId = setTimeout(() => {
1555
+ this._lastRenderTime = Date.now(), this._render(this._cfg), this._renderTimeoutId = null;
1556
+ }, 0);
1483
1557
  }
1484
- }
1485
- /**
1486
- * Renders a fallback error UI in the shadow root.
1487
- * @param error - Error object
1488
- */
1489
- renderError(e) {
1490
- const t = this.config.style ? typeof this.config.style == "function" ? this.config.style(this.api.state) : this.config.style : "";
1491
- this.shadowRoot.innerHTML = `
1492
- <style>${t}</style>
1493
- <div style="color: red; border: 1px solid red; padding: 1rem; border-radius: 4px;">
1494
- <h3>Error Boundary</h3>
1495
- <div>Error: ${e.message}</div>
1496
- </div>
1497
- `;
1498
- }
1499
- } : H = class {
1500
- // No-op for SSR, just a stub
1501
- constructor() {
1502
- }
1503
- };
1504
- function W(e, t) {
1505
- if (t = _(t), t.debug && console.log(`[runtime] Debugging component: ${e}`, t), !e || !t.template) {
1506
- t && typeof t.onError == "function" && t.onError(new Error("Component requires tag and template"), t.state ?? {}, {
1507
- state: t.state ?? {},
1508
- emit: () => {
1509
- },
1510
- onGlobal: () => () => {
1511
- },
1512
- offGlobal: () => {
1513
- },
1514
- emitGlobal: () => {
1515
- }
1516
- }), t && t.debug && console.error("[runtime] Malformed config:", { tag: e, config: t });
1517
- return;
1518
- }
1519
- if (A.forEach((u) => {
1520
- try {
1521
- u.onInit?.(t);
1522
- } catch (d) {
1523
- t && typeof t.onError == "function" && t.onError(d instanceof Error ? d : new Error(String(d)), t.state, {
1524
- state: t.state,
1525
- emit: () => {
1526
- },
1527
- onGlobal: () => () => {
1528
- },
1529
- offGlobal: () => {
1530
- },
1531
- emitGlobal: () => {
1558
+ // --- Style ---
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;
1565
+ return;
1532
1566
  }
1533
- }), t && t.debug && console.error("[runtime] Plugin onInit error:", d);
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];
1574
+ });
1534
1575
  }
1535
- }), (typeof window < "u" && window.VITE_DEV_HMR || typeof import.meta < "u" && void 0) && typeof customElements < "u" && customElements.get(e))
1536
- try {
1537
- document.querySelectorAll(e).forEach((u) => u.remove()), window.customElements._definitions && delete window.customElements._definitions[e];
1538
- } catch {
1576
+ // --- Error Boundary function ---
1577
+ _runLogicWithinErrorBoundary(t, r) {
1578
+ this._hasError && (this._hasError = !1);
1579
+ try {
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,
1584
+ this.context
1585
+ ));
1586
+ }
1539
1587
  }
1540
- if (typeof customElements < "u" && customElements.get(e)) {
1541
- t.debug && console.warn(`[runtime] Component "${e}" already registered`);
1542
- return;
1543
- }
1544
- const s = x(t.state ?? {}, t.computed);
1545
- t.state = s, t._subscribe = s.subscribe;
1546
- const i = t.state ?? {}, a = Object.keys(i).filter(
1547
- (u) => ["string", "number", "boolean"].includes(typeof i[u])
1548
- );
1549
- class c extends H {
1550
- static get observedAttributes() {
1551
- return a;
1588
+ // --- State, props, computed ---
1589
+ _initContext(t) {
1590
+ try {
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" && [
1596
+ "push",
1597
+ "pop",
1598
+ "shift",
1599
+ "unshift",
1600
+ "splice",
1601
+ "sort",
1602
+ "reverse"
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);
1608
+ }
1609
+ return f;
1610
+ } : a;
1611
+ },
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);
1616
+ }
1617
+ return !0;
1618
+ },
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);
1623
+ }
1624
+ return !0;
1625
+ }
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;
1636
+ },
1637
+ get(o, c, d) {
1638
+ return Reflect.get(o, c, d);
1639
+ }
1640
+ })) : i;
1641
+ };
1642
+ const n = this;
1643
+ return r({ ...t.state });
1644
+ } catch {
1645
+ return {};
1646
+ }
1552
1647
  }
1553
- constructor() {
1554
- super();
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)
1657
+ try {
1658
+ const o = this._getNestedValue(r);
1659
+ i(o, void 0, this.context);
1660
+ } catch (o) {
1661
+ console.error(`Error in immediate watcher for "${r}":`, o);
1662
+ }
1663
+ }
1555
1664
  }
1556
- }
1557
- const l = c;
1558
- typeof customElements < "u" && !customElements.get(e) && (window.__componentRegistry = window.__componentRegistry || {}, window.__componentRegistry[e] = t, customElements.define(e, l));
1559
- }
1560
- function gt(e) {
1561
- const t = ct(e);
1562
- return W("router-view", {
1563
- template: async () => {
1564
- if (!t) return "<div>Router not initialized.</div>";
1565
- const r = t.getCurrent(), { path: n } = r, o = t.matchRoute(n);
1566
- return o.route ? (o.route.load && await o.route.load(), `<${o.route.component}></${o.route.component}>`) : "<div>Not found</div>";
1567
- },
1568
- onMounted(r, n) {
1569
- t && typeof t.subscribe == "function" && t.subscribe(() => {
1570
- n.render();
1571
- });
1665
+ _getNestedValue(t) {
1666
+ return t.split(".").reduce(
1667
+ (r, n) => r?.[n],
1668
+ this.context
1669
+ );
1572
1670
  }
1573
- }), W("router-link", {
1574
- state: {
1575
- to: "",
1576
- tag: "a",
1577
- replace: !1,
1578
- exact: !1,
1579
- activeClass: "active",
1580
- exactActiveClass: "exact-active",
1581
- ariaCurrentValue: "page",
1582
- disabled: !1,
1583
- external: !1,
1584
- style: J`
1585
- [aria-disabled="true"] {
1586
- pointer-events: none;
1587
- opacity: 0.5;
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))
1681
+ try {
1682
+ i.callback(r, i.oldValue, this.context), i.oldValue = r;
1683
+ } catch (s) {
1684
+ console.error(`Error in watcher for "${t}":`, s);
1588
1685
  }
1589
- `
1590
- },
1591
- computed: {
1592
- current() {
1593
- return t.getCurrent();
1594
- },
1595
- isExactActive(r) {
1596
- return r.current.path === r.to;
1597
- },
1598
- isActive(r) {
1599
- const n = r.current;
1600
- return r.exact ? r.isExactActive : n && typeof n.path == "string" ? n.path.startsWith(r.to) : !1;
1601
- },
1602
- className(r) {
1603
- return r.isExactActive ? r.exactActiveClass : r.isActive ? r.activeClass : "";
1604
- },
1605
- ariaCurrent(r) {
1606
- return r.isExactActive ? `aria-current="${r.ariaCurrentValue}"` : "";
1607
- },
1608
- isButton(r) {
1609
- return r.tag === "button";
1610
- },
1611
- disabledAttr(r) {
1612
- return r.disabled ? r.isButton ? 'disabled aria-disabled="true" tabindex="-1"' : 'aria-disabled="true" tabindex="-1"' : "";
1613
- },
1614
- externalAttr(r) {
1615
- return r.external && (r.tag === "a" || !r.tag) ? 'target="_blank" rel="noopener noreferrer"' : "";
1616
- }
1617
- },
1618
- reflect: ["to", "tag", "replace", "exact", "activeClass", "exactActiveClass", "ariaCurrentValue", "disabled", "external", "style"],
1619
- style: (r) => r.style,
1620
- template: (r) => T`
1621
- ${r.isButton ? T`
1622
- <button
1623
- part="button"
1624
- class="${r.className}"
1625
- ${r.ariaCurrent}
1626
- ${r.disabledAttr}
1627
- ${r.externalAttr}
1628
- data-on-click="navigate"
1629
- ><slot></slot></button>
1630
- `(r) : T`
1631
- <a
1632
- part="link"
1633
- href="${r.to}"
1634
- class="${r.className}"
1635
- ${r.ariaCurrent}
1636
- ${r.disabledAttr}
1637
- ${r.externalAttr}
1638
- data-on-click="navigate"
1639
- ><slot></slot></a>
1640
- `(r)}
1641
- `(r),
1642
- navigate: (r, n) => {
1643
- if (n.disabled) {
1644
- r.preventDefault();
1645
- return;
1686
+ for (const [s, o] of this._watchers.entries())
1687
+ if (o.options.deep && t.startsWith(s + "."))
1688
+ try {
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);
1693
+ }
1694
+ }
1695
+ _applyProps(t) {
1696
+ try {
1697
+ let r = function(n, i) {
1698
+ return i === Boolean ? n === "true" : i === Number ? Number(n) : n;
1699
+ };
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));
1706
+ });
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,
1710
+ this.context
1711
+ ));
1646
1712
  }
1647
- n.external && (n.tag === "a" || !n.tag) || (r.preventDefault(), n.replace ? t.replace(n.to) : t.push(n.to));
1648
1713
  }
1649
- }), t;
1714
+ };
1650
1715
  }
1651
1716
  export {
1652
- N as Store,
1653
- ft as classes,
1654
- dt as compile,
1655
- pt as compileTemplate,
1656
- W as component,
1657
- $ as createVNodeFromElement,
1658
- J as css,
1659
- _ as deepSanitizeObject,
1660
- w as eventBus,
1661
- ut as generateHydrationScript,
1662
- q as getVNodeKey,
1663
- T as html,
1664
- gt as initRouter,
1665
- O as isPromise,
1666
- mt as matchRouteSSR,
1667
- g as mountVNode,
1668
- it as parseVNodeFromHTML,
1669
- M as patchVNode,
1670
- P as renderCompiledTemplate,
1671
- lt as renderComponentsToString,
1672
- V as renderToString,
1673
- at as resolveRouteComponent,
1674
- A as runtimePlugins,
1675
- z as safeReplaceChild,
1676
- ht as styles,
1677
- nt as updateCompiledTemplate,
1678
- Q as useDataModel,
1679
- ct as useRouter,
1680
- yt as useRuntimePlugin
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
1681
1726
  };
1682
1727
  //# sourceMappingURL=custom-elements-runtime.es.js.map