solely 0.1.3 → 0.1.5

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.
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  var Xt = Object.defineProperty;
2
- var Nt = (n) => {
2
+ var Pt = (n) => {
3
3
  throw TypeError(n);
4
4
  };
5
- var te = (n, t, e) => t in n ? Xt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
- var C = (n, t, e) => te(n, typeof t != "symbol" ? t + "" : t, e), wt = (n, t, e) => t.has(n) || Nt("Cannot " + e);
7
- var R = (n, t, e) => (wt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), _ = (n, t, e) => t.has(n) ? Nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), N = (n, t, e, s) => (wt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), O = (n, t, e) => (wt(n, t, "access private method"), e);
8
- const ee = {
5
+ var Qt = (n, t, e) => t in n ? Xt(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
6
+ var k = (n, t, e) => Qt(n, typeof t != "symbol" ? t + "" : t, e), gt = (n, t, e) => t.has(n) || Pt("Cannot " + e);
7
+ var P = (n, t, e) => (gt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), T = (n, t, e) => t.has(n) ? Pt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, e), O = (n, t, e, s) => (gt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), N = (n, t, e) => (gt(n, t, "access private method"), e);
8
+ const te = {
9
9
  dark: {
10
10
  gutter: "#858585",
11
11
  errorLineBg: "#3c1e1e",
@@ -16,8 +16,8 @@ const ee = {
16
16
  exprLabel: "#a0a0a0",
17
17
  exprCode: "#5ddcff"
18
18
  }
19
- }, T = ee.dark;
20
- function lt(n) {
19
+ }, W = te.dark;
20
+ function it(n) {
21
21
  let t = 0;
22
22
  for (let e = 0; e < n.length; ) {
23
23
  const s = n.codePointAt(e);
@@ -29,15 +29,15 @@ function lt(n) {
29
29
  }
30
30
  return t;
31
31
  }
32
- function Wt(n, t = {}) {
32
+ function Ot(n, t = {}) {
33
33
  const { lineIndex: e = 0, totalLines: s = 1 } = t, r = Math.max(1, Math.floor(n));
34
34
  return (s <= 1 || e === 0 ? "^" : "~").repeat(r);
35
35
  }
36
- function ne(n, t = "", e, s = "component") {
37
- var A;
36
+ function ee(n, t = "", e, s = "component") {
37
+ var L;
38
38
  const r = (n == null ? void 0 : n.message) ?? String(n), i = `%cTemplate Error%c in <${s}> → ${r}`, o = [
39
- `color:${T.badgeFg};background:${T.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
40
- `color:${T.arrow};font-weight:bold;`
39
+ `color:${W.badgeFg};background:${W.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
40
+ `color:${W.arrow};font-weight:bold;`
41
41
  ];
42
42
  if (!t || !(e != null && e.loc) || e.loc.length < 2) {
43
43
  console.error(i, ...o), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
@@ -46,80 +46,80 @@ function ne(n, t = "", e, s = "component") {
46
46
  const c = e.loc;
47
47
  let a = c[0] || 0, l = c[1] || 0;
48
48
  a |= 0, l |= 0, a < 1 && (a = 1), l < 1 && (l = 1);
49
- const h = t.split(`
49
+ const u = t.split(`
50
50
  `);
51
- if (a > h.length) {
51
+ if (a > u.length) {
52
52
  console.error(`[Template Error] 行号 ${a} 超出范围`);
53
53
  return;
54
54
  }
55
- const u = a - 1, m = Math.max(0, u - 3), E = Math.min(h.length - 1, u + 3), p = String(E + 1).length, d = ((A = e.expr) == null ? void 0 : A.trim()) ?? "", L = d ? d.split(`
56
- `) : [], g = d ? Math.max(...L.map(lt)) : 0, v = L.length > 1, k = `color:${T.gutter};`, I = `color:${T.arrow};font-weight:bold;`, f = `color:${T.gutter};`, w = `color:${T.errorLineFg};background:${T.errorLineBg};padding:0 4px;`, x = `color:${T.gutter};`, b = `color:${T.arrow};font-weight:bold;padding:0 4px;`;
55
+ const h = a - 1, d = Math.max(0, h - 3), E = Math.min(u.length - 1, h + 3), m = String(E + 1).length, p = ((L = e.expr) == null ? void 0 : L.trim()) ?? "", R = p ? p.split(`
56
+ `) : [], g = p ? Math.max(...R.map(it)) : 0, v = R.length > 1, S = `color:${W.gutter};`, A = `color:${W.arrow};font-weight:bold;`, f = `color:${W.gutter};`, w = `color:${W.errorLineFg};background:${W.errorLineBg};padding:0 4px;`, $ = `color:${W.gutter};`, b = `color:${W.arrow};font-weight:bold;padding:0 4px;`;
57
57
  console.groupCollapsed(
58
58
  `${i} %c(Line:${a}, Col:${l})`,
59
59
  ...o,
60
- `color:${T.gutter};font-weight:normal;`
60
+ `color:${W.gutter};font-weight:normal;`
61
61
  );
62
- for (let $ = m; $ <= E; $++) {
63
- const M = h[$], P = String($ + 1).padStart(p, " ");
64
- if (!($ === u)) {
65
- console.log(`%c${P} │%c ${M}`, k, f);
62
+ for (let x = d; x <= E; x++) {
63
+ const I = u[x], M = String(x + 1).padStart(m, " ");
64
+ if (!(x === h)) {
65
+ console.log(`%c${M} │%c ${I}`, S, f);
66
66
  continue;
67
67
  }
68
- const V = M.slice(0, Math.max(0, l - 1)), D = lt(V), at = " ".repeat(p + 3), Jt = P.padEnd(p, " ");
69
- if (console.log(`%c${Jt} │%c ${M}`, I, w), v)
70
- for (let B = 0; B < L.length; B++) {
71
- const yt = L[B], et = u + B;
72
- let bt = 0;
73
- if (B === 0)
74
- bt = D;
75
- else if (et < h.length) {
76
- const nt = h[et], ct = nt.search(/\S/), Qt = ct === -1 ? nt : nt.slice(0, ct);
77
- bt = lt(Qt);
68
+ const D = I.slice(0, Math.max(0, l - 1)), F = it(D), rt = " ".repeat(m + 3), Yt = M.padEnd(m, " ");
69
+ if (console.log(`%c${Yt} │%c ${I}`, A, w), v)
70
+ for (let j = 0; j < R.length; j++) {
71
+ const pt = R[j], Q = h + j;
72
+ let mt = 0;
73
+ if (j === 0)
74
+ mt = F;
75
+ else if (Q < u.length) {
76
+ const tt = u[Q], ot = tt.search(/\S/), Jt = ot === -1 ? tt : tt.slice(0, ot);
77
+ mt = it(Jt);
78
78
  }
79
- const Zt = Math.max(1, lt(yt.trim())), Ot = Wt(Zt, { lineIndex: B, totalLines: L.length }), _t = at + " ".repeat(bt);
80
- if (B === 0)
81
- console.log(`%c${_t}%c${Ot}`, x, b);
82
- else if (et < h.length) {
83
- const nt = String(et + 1).padEnd(p, " "), ct = h[et];
84
- console.log(`%c${nt} │%c ${ct}`, I, w), console.log(`%c${_t}%c${Ot}`, x, b);
79
+ const Zt = Math.max(1, it(pt.trim())), It = Ot(Zt, { lineIndex: j, totalLines: R.length }), Mt = rt + " ".repeat(mt);
80
+ if (j === 0)
81
+ console.log(`%c${Mt}%c${It}`, $, b);
82
+ else if (Q < u.length) {
83
+ const tt = String(Q + 1).padEnd(m, " "), ot = u[Q];
84
+ console.log(`%c${tt} │%c ${ot}`, A, w), console.log(`%c${Mt}%c${It}`, $, b);
85
85
  }
86
86
  }
87
87
  else {
88
- const B = at + " ".repeat(D), yt = Wt(g || 1);
89
- console.log(`%c${B}%c${yt}`, x, b);
88
+ const j = rt + " ".repeat(F), pt = Ot(g || 1);
89
+ console.log(`%c${j}%c${pt}`, $, b);
90
90
  }
91
91
  }
92
- d && console.log(
93
- `%cExpression:%c ${d}`,
94
- `color:${T.exprLabel};font-weight:bold;`,
95
- `color:${T.exprCode};font-family:monospace;`
92
+ p && console.log(
93
+ `%cExpression:%c ${p}`,
94
+ `color:${W.exprLabel};font-weight:bold;`,
95
+ `color:${W.exprCode};font-family:monospace;`
96
96
  ), console.groupEnd();
97
97
  }
98
- const vt = {};
99
- function se(n) {
98
+ const yt = {};
99
+ function ne(n) {
100
100
  const t = n.map((e) => e.replace(/[',"]/g, "")).join(",");
101
- if (!vt[t]) {
101
+ if (!yt[t]) {
102
102
  const e = n[n.length - 1];
103
103
  if (e.trim() === "")
104
104
  throw new Error("Function body cannot be empty");
105
- if (ie(e))
105
+ if (re(e))
106
106
  throw new Error("Input contains potentially dangerous code: " + e);
107
- vt[t] = new Function(...n);
107
+ yt[t] = new Function(...n);
108
108
  }
109
- return vt[t];
109
+ return yt[t];
110
110
  }
111
- const re = ["eval", "Function", "process", "require"];
112
- function ie(n) {
113
- return re.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
111
+ const se = ["eval", "Function", "process", "require"];
112
+ function re(n) {
113
+ return se.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
114
114
  }
115
- const oe = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, ae = /\{\{\s*([\s\S]*?)\s*\}\}/g;
116
- function ce(n, t) {
115
+ const oe = /\{\{\{\s*[\s\S]*?\s*\}\}\}/, ie = /\{\{\s*([\s\S]*?)\s*\}\}/g;
116
+ function ae(n, t) {
117
117
  if (!(n != null && n.trim())) return "";
118
118
  if (oe.test(n))
119
119
  throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");
120
- return t === "template" ? n.replace(ae, (e, s) => `\${${s.trim()}}`) : n;
120
+ return t === "template" ? n.replace(ie, (e, s) => `\${${s.trim()}}`) : n;
121
121
  }
122
- function le(n, t) {
122
+ function ce(n, t) {
123
123
  const e = (s) => s.endsWith(";") ? s : s + ";";
124
124
  switch (t) {
125
125
  case "template":
@@ -131,7 +131,7 @@ function le(n, t) {
131
131
  return e(n);
132
132
  }
133
133
  }
134
- function ue(n) {
134
+ function le(n) {
135
135
  if (!n.length) return { loopValues: "", loopIndices: "" };
136
136
  const t = n.map((s) => s.item).join(", "), e = n.map((s) => s.index).join(", ");
137
137
  return {
@@ -139,7 +139,7 @@ function ue(n) {
139
139
  loopIndices: `var [${e}] = loops.map(l => l.idxVal);`
140
140
  };
141
141
  }
142
- function he(n, t, e, s) {
142
+ function ue(n, t, e, s) {
143
143
  const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], o = `
144
144
  const { $data } = this;
145
145
  ${n === "handler" ? "const { value, checked } = event?.target || {};" : ""}
@@ -149,12 +149,12 @@ function he(n, t, e, s) {
149
149
  `.replace(/^\s+|\s+$/gm, "");
150
150
  return r.push(o), r;
151
151
  }
152
- function fe(n, t, e) {
152
+ function he(n, t, e) {
153
153
  if (!(n != null && n.trim())) return () => "";
154
- const s = ce(n, t), r = le(s, t), { loopValues: i, loopIndices: o } = ue(e), c = he(t, r, i, o);
155
- return se(c);
154
+ const s = ae(n, t), r = ce(s, t), { loopValues: i, loopIndices: o } = le(e), c = ue(t, r, i, o);
155
+ return ne(c);
156
156
  }
157
- const de = /* @__PURE__ */ new Set([
157
+ const fe = /* @__PURE__ */ new Set([
158
158
  "onabort",
159
159
  "onautocomplete",
160
160
  "onautocompleteerror",
@@ -217,7 +217,7 @@ const de = /* @__PURE__ */ new Set([
217
217
  "ontoggle",
218
218
  "onvolumechange",
219
219
  "onwaiting"
220
- ]), H = (n) => {
220
+ ]), G = (n) => {
221
221
  if (n === null || typeof n != "object") return !1;
222
222
  const t = Object.prototype.toString.call(n);
223
223
  return ![
@@ -230,7 +230,7 @@ const de = /* @__PURE__ */ new Set([
230
230
  "[object WeakSet]"
231
231
  ].includes(t);
232
232
  };
233
- function Qe(n = window.location) {
233
+ function Ye(n = window.location) {
234
234
  let t;
235
235
  typeof n == "string" ? t = new URL(n).hash : t = n.hash;
236
236
  const e = t.split("?");
@@ -247,26 +247,26 @@ function Qe(n = window.location) {
247
247
  };
248
248
  }
249
249
  var y = /* @__PURE__ */ ((n) => (n[n.Element = 0] = "Element", n[n.Text = 1] = "Text", n[n.Comment = 2] = "Comment", n[n.If = 3] = "If", n[n.ElseIf = 4] = "ElseIf", n[n.Else = 5] = "Else", n[n.For = 6] = "For", n[n.Conditional = 7] = "Conditional", n[n.Other = 99] = "Other", n))(y || {});
250
- const pe = {
250
+ const de = {
251
251
  // 可选别名
252
252
  onMounted: "mounted",
253
253
  onUpdated: "updated",
254
254
  onUnmounted: "unmounted"
255
255
  };
256
- function me(n) {
257
- return pe[n] ?? null;
256
+ function pe(n) {
257
+ return de[n] ?? null;
258
258
  }
259
- function ge(n) {
259
+ function me(n) {
260
260
  return n === "mounted" || n === "updated" || n === "unmounted";
261
261
  }
262
- const kt = Symbol.for("solely.irMeta"), tt = process.env.NODE_ENV !== "production", ye = /\{\{[\s\S]*?\}\}/;
263
- class be {
262
+ const vt = Symbol.for("solely.irMeta"), X = process.env.NODE_ENV !== "production", ge = /\{\{[\s\S]*?\}\}/;
263
+ class ye {
264
264
  constructor() {
265
- C(this, "compilers", /* @__PURE__ */ new Map());
265
+ k(this, "compilers", /* @__PURE__ */ new Map());
266
266
  }
267
267
  get(t = "anonymous") {
268
268
  let e = this.compilers.get(t);
269
- return e || (e = new we(), this.compilers.set(t, e)), e;
269
+ return e || (e = new be(), this.compilers.set(t, e)), e;
270
270
  }
271
271
  clear(t) {
272
272
  var e;
@@ -278,11 +278,11 @@ class be {
278
278
  }
279
279
  }
280
280
  }
281
- const Ft = new be();
282
- class we {
281
+ const Wt = new ye();
282
+ class be {
283
283
  constructor() {
284
- C(this, "cache", /* @__PURE__ */ new Map());
285
- C(this, "functions", []);
284
+ k(this, "cache", /* @__PURE__ */ new Map());
285
+ k(this, "functions", []);
286
286
  }
287
287
  // 缓存 key 生成优化:避免每次都重新分配数组
288
288
  makeCacheKey(t, e, s) {
@@ -297,9 +297,9 @@ class we {
297
297
  if (o !== void 0) return o;
298
298
  let c;
299
299
  try {
300
- c = fe(r, t, s);
300
+ c = he(r, t, s);
301
301
  } catch (l) {
302
- tt && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, l), c = () => "";
302
+ X && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, l), c = () => "";
303
303
  }
304
304
  const a = this.functions.push(c);
305
305
  return this.cache.set(i, a), a;
@@ -314,15 +314,15 @@ class we {
314
314
  this.cache.clear(), this.functions = [];
315
315
  }
316
316
  }
317
- function jt(n) {
317
+ function Ft(n) {
318
318
  const t = n[0];
319
- return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : ge(n) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
319
+ return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : me(n) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
320
320
  }
321
- function ve(n) {
322
- return n ? ye.test(n) : !1;
321
+ function we(n) {
322
+ return n ? ge.test(n) : !1;
323
323
  }
324
- function St(n, t, e) {
325
- tt && (n[kt] = { expr: t ?? "", loc: e ?? null });
324
+ function xt(n, t, e) {
325
+ X && (n[vt] = { expr: t ?? "", loc: e ?? null });
326
326
  }
327
327
  function Ee(n) {
328
328
  if (!n.attrs) return;
@@ -330,15 +330,15 @@ function Ee(n) {
330
330
  if (!t) return;
331
331
  const e = "$data." + t.value.replace("this.", "").replace("$data.", ""), s = t.loc, r = (n.tag || "").toLowerCase(), i = n.attrs.find((a) => a.key === "type"), o = (i == null ? void 0 : i.value) ?? "text";
332
332
  n.attrs = n.attrs.filter((a) => a !== t);
333
- const c = (a, l, h) => {
334
- var u;
335
- (u = n.attrs) == null || u.push({ key: a, value: l, role: h, loc: s });
333
+ const c = (a, l, u) => {
334
+ var h;
335
+ (h = n.attrs) == null || h.push({ key: a, value: l, role: u, loc: s });
336
336
  };
337
337
  if (r === "input") {
338
338
  if (o === "checkbox") {
339
- const a = n.attrs.find((m) => m.key === "value"), l = a ? JSON.stringify(a.value) : '"on"', h = `Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;
340
- c(":checked", h);
341
- const u = `
339
+ const a = n.attrs.find((d) => d.key === "value"), l = a ? JSON.stringify(a.value) : '"on"', u = `Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;
340
+ c(":checked", u);
341
+ const h = `
342
342
  const _v = ${l};
343
343
  if(Array.isArray(${e})) {
344
344
  const _i = ${e}.indexOf(_v);
@@ -347,11 +347,11 @@ function Ee(n) {
347
347
  } else {
348
348
  ${e} = checked;
349
349
  }`;
350
- c("@change", u, "model");
350
+ c("@change", h, "model");
351
351
  return;
352
352
  }
353
353
  if (o === "radio") {
354
- const a = n.attrs.find((h) => h.key === "value"), l = (a == null ? void 0 : a.value) ?? "null";
354
+ const a = n.attrs.find((u) => u.key === "value"), l = (a == null ? void 0 : a.value) ?? "null";
355
355
  c(":checked", `${e} == ${JSON.stringify(l)}`), c("@change", `if (checked) ${e} = ${JSON.stringify(l)}`, "model");
356
356
  return;
357
357
  }
@@ -372,47 +372,47 @@ function Ee(n) {
372
372
  }
373
373
  c(":value", e), c("@input", `${e} = $event`, "model");
374
374
  }
375
- function ft(n, t, e, s = null) {
375
+ function lt(n, t, e, s = null) {
376
376
  if (!n.attrs || n.attrs.length === 0) return [];
377
377
  const r = [];
378
378
  for (const i of n.attrs) {
379
379
  if (s && s.has(i.key)) continue;
380
- const { key: o, value: c, role: a } = i, { isDynamic: l, type: h } = jt(o);
381
- if (l && h) {
382
- const u = e.compile(h, c ?? "", t), m = { key: o, fid: u, dynamic: 1, role: a };
383
- St(m, c, i.loc ?? n.loc), r.push(m);
380
+ const { key: o, value: c, role: a } = i, { isDynamic: l, type: u } = Ft(o);
381
+ if (l && u) {
382
+ const h = e.compile(u, c ?? "", t), d = { key: o, fid: h, dynamic: 1, role: a };
383
+ xt(d, c, i.loc ?? n.loc), r.push(d);
384
384
  } else
385
385
  r.push({ key: o, value: c, dynamic: 0, role: a });
386
386
  }
387
387
  return r;
388
388
  }
389
- function xe(n, t, e) {
390
- var i, o, c, a, l, h;
389
+ function ve(n, t, e) {
390
+ var i, o, c, a, l, u;
391
391
  const s = { type: n.type, dynamic: 0 };
392
392
  let r = !1;
393
- switch (n.type === y.Text ? ve(n.content) && (r = !0) : ((i = n.attrs) != null && i.some((u) => u.key === "s-model" || jt(u.key).isDynamic) && (r = !0), n.type === y.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
393
+ switch (n.type === y.Text ? we(n.content) && (r = !0) : ((i = n.attrs) != null && i.some((h) => h.key === "s-model" || Ft(h.key).isDynamic) && (r = !0), n.type === y.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
394
394
  case y.Text: {
395
- const u = n.content ?? "";
396
- r ? (s.fid = e.compile("template", u, t), St(s, u, n.loc)) : s.txt = u;
395
+ const h = n.content ?? "";
396
+ r ? (s.fid = e.compile("template", h, t), xt(s, h, n.loc)) : s.txt = h;
397
397
  break;
398
398
  }
399
399
  case y.Element: {
400
- s.tag = n.tag, Ee(n), s.attrs = ft(n, t, e), n.children && (s.children = st(n.children, t, e));
400
+ s.tag = n.tag, Ee(n), s.attrs = lt(n, t, e), n.children && (s.children = et(n.children, t, e));
401
401
  break;
402
402
  }
403
403
  case y.For: {
404
- const u = (o = n.attrs) == null ? void 0 : o.find((d) => d.key === "each"), m = (u == null ? void 0 : u.value) ?? "";
405
- s.fid = e.compile("expression", m, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((h = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "index")) == null ? void 0 : h.value) ?? "index", St(s, m, (u == null ? void 0 : u.loc) ?? n.loc);
404
+ const h = (o = n.attrs) == null ? void 0 : o.find((p) => p.key === "each"), d = (h == null ? void 0 : h.value) ?? "";
405
+ s.fid = e.compile("expression", d, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((p) => p.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((u = (l = n.attrs) == null ? void 0 : l.find((p) => p.key === "index")) == null ? void 0 : u.value) ?? "index", xt(s, d, (h == null ? void 0 : h.loc) ?? n.loc);
406
406
  const E = /* @__PURE__ */ new Set(["each", "item", "index"]);
407
- s.attrs = ft(n, t, e, E);
408
- const p = [...t, { item: s.item, index: s.index }];
409
- n.children && (s.children = st(n.children, p, e));
407
+ s.attrs = lt(n, t, e, E);
408
+ const m = [...t, { item: s.item, index: s.index }];
409
+ n.children && (s.children = et(n.children, m, e));
410
410
  break;
411
411
  }
412
412
  case y.If:
413
413
  case y.ElseIf:
414
414
  case y.Else: {
415
- tt && console.warn(`[IR] Orphaned conditional node found: ${y[n.type]}`), s.attrs = ft(n, t, e), n.children && (s.children = st(n.children, t, e));
415
+ X && console.warn(`[IR] Orphaned conditional node found: ${y[n.type]}`), s.attrs = lt(n, t, e), n.children && (s.children = et(n.children, t, e));
416
416
  break;
417
417
  }
418
418
  case y.Comment: {
@@ -422,7 +422,7 @@ function xe(n, t, e) {
422
422
  }
423
423
  return s;
424
424
  }
425
- function st(n, t, e) {
425
+ function et(n, t, e) {
426
426
  var i;
427
427
  const s = [];
428
428
  let r = 0;
@@ -432,39 +432,39 @@ function st(n, t, e) {
432
432
  const c = [];
433
433
  let a = r;
434
434
  for (; a < n.length; ) {
435
- const l = n[a], h = l.type;
436
- if (h !== y.If && h !== y.ElseIf && h !== y.Else)
435
+ const l = n[a], u = l.type;
436
+ if (u !== y.If && u !== y.ElseIf && u !== y.Else || u === y.If && c.length > 0)
437
437
  break;
438
- let u = null, m = "", E = null;
439
- if (h !== y.Else) {
438
+ let h = null, d = "", E = null;
439
+ if (u !== y.Else) {
440
440
  const g = (i = l.attrs) == null ? void 0 : i.find(
441
441
  (v) => v.key === "test" || v.key === "condition"
442
442
  );
443
- m = (g == null ? void 0 : g.value) ?? "false", u = e.compile("expression", m, t), E = (g == null ? void 0 : g.loc) ?? l.loc;
443
+ d = (g == null ? void 0 : g.value) ?? "false", h = e.compile("expression", d, t), E = (g == null ? void 0 : g.loc) ?? l.loc;
444
444
  }
445
- const p = l.children ? st(l.children, t, e) : [], L = ft(l, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
445
+ const m = l.children ? et(l.children, t, e) : [], R = lt(l, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
446
446
  if (c.push({
447
- condFid: u,
448
- children: p,
449
- attrs: L.length > 0 ? L : void 0,
450
- [kt]: tt ? { expr: m, loc: E } : void 0
451
- }), a++, h === y.Else) break;
447
+ condFid: h,
448
+ children: m,
449
+ attrs: R.length > 0 ? R : void 0,
450
+ [vt]: X ? { expr: d, loc: E } : void 0
451
+ }), a++, u === y.Else) break;
452
452
  }
453
453
  s.push({
454
454
  type: y.Conditional,
455
455
  dynamic: 1,
456
456
  branches: c,
457
- ...tt && { [kt]: { loc: o.loc } }
457
+ ...X && { [vt]: { loc: o.loc } }
458
458
  }), r = a;
459
459
  } else
460
- s.push(xe(o, t, e)), r++;
460
+ s.push(ve(o, t, e)), r++;
461
461
  }
462
462
  return s;
463
463
  }
464
- function $e(n, t = {}) {
465
- const { filename: e = "anonymous", source: s } = t, r = Ft.get(e);
464
+ function xe(n, t = {}) {
465
+ const { filename: e = "anonymous", source: s } = t, r = Wt.get(e);
466
466
  r.clear();
467
- const i = performance.now(), o = st(n, [], r), c = performance.now(), a = r.getStats(), l = o.filter((u) => u.dynamic === 1).length, h = {
467
+ const i = performance.now(), o = et(n, [], r), c = performance.now(), a = r.getStats(), l = o.filter((h) => h.dynamic === 1).length, u = {
468
468
  type: "root",
469
469
  version: "1.1.0",
470
470
  // Bump version
@@ -484,14 +484,14 @@ function $e(n, t = {}) {
484
484
  ...s && { source: s }
485
485
  }
486
486
  };
487
- return tt && console.log(
487
+ return X && console.log(
488
488
  `[IRBuilder] ${e} | ${(c - i).toFixed(2)}ms | Nodes: ${o.length} | Fns: ${a.total}`
489
- ), h;
489
+ ), u;
490
490
  }
491
- function Xe(n) {
492
- Ft.clear(n);
491
+ function Ze(n) {
492
+ Wt.clear(n);
493
493
  }
494
- const ke = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set([
494
+ const $e = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set([
495
495
  "area",
496
496
  "base",
497
497
  "br",
@@ -506,45 +506,45 @@ const ke = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set
506
506
  "source",
507
507
  "track",
508
508
  "wbr"
509
- ]), Ce = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
510
- function Re(n, t) {
509
+ ]), ke = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
510
+ function Ce(n, t) {
511
511
  const e = [];
512
512
  let s;
513
513
  const r = n.replace(/^\s*[^\s"'/>]+/, ""), i = n.length - r.length;
514
- for (; (s = Ce.exec(r)) !== null; ) {
514
+ for (; (s = ke.exec(r)) !== null; ) {
515
515
  const o = s[1];
516
516
  if (!o) continue;
517
517
  const c = s[2] ?? s[3] ?? s[4] ?? "";
518
518
  let a = o;
519
- de.has(o) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = me(a) || a;
520
- const l = s[0], h = l.indexOf("=");
521
- let u;
522
- if (h === -1)
523
- u = l.indexOf(o) + o.length;
519
+ fe.has(o) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = pe(a) || a;
520
+ const l = s[0], u = l.indexOf("=");
521
+ let h;
522
+ if (u === -1)
523
+ h = l.indexOf(o) + o.length;
524
524
  else {
525
- let g = h + 1;
525
+ let g = u + 1;
526
526
  for (; g < l.length && /\s/.test(l[g]); ) g++;
527
527
  if (l[g] === '"' || l[g] === "'") {
528
528
  let v = g + 1;
529
529
  for (; v < l.length && /\s/.test(l[v]); )
530
530
  v++;
531
- u = v;
531
+ h = v;
532
532
  } else {
533
533
  let v = g;
534
534
  for (; v < l.length && /\s/.test(l[v]); ) v++;
535
- u = v;
535
+ h = v;
536
536
  }
537
537
  }
538
- let m = s.index + u + i;
539
- const p = n.slice(0, m).split(`
540
- `), d = t[0] + p.length - 1, L = p.length > 1 ? p[p.length - 1].length + 1 : t[1] + m;
541
- e.push({ key: a, value: c, loc: [d, L] });
538
+ let d = s.index + h + i;
539
+ const m = n.slice(0, d).split(`
540
+ `), p = t[0] + m.length - 1, R = m.length > 1 ? m[m.length - 1].length + 1 : t[1] + d;
541
+ e.push({ key: a, value: c, loc: [p, R] });
542
542
  }
543
543
  return e;
544
544
  }
545
- function Le(n, t) {
545
+ function Re(n, t) {
546
546
  var o;
547
- const e = ((o = (n.match(ke) || [])[1]) == null ? void 0 : o.toLowerCase()) ?? "", s = Re(n, t);
547
+ const e = ((o = (n.match($e) || [])[1]) == null ? void 0 : o.toLowerCase()) ?? "", s = Ce(n, t);
548
548
  return {
549
549
  type: {
550
550
  for: y.For,
@@ -558,7 +558,7 @@ function Le(n, t) {
558
558
  attrs: s
559
559
  };
560
560
  }
561
- function Ie(n, t) {
561
+ function Ae(n, t) {
562
562
  const e = n.length;
563
563
  if (n.startsWith("!--", t)) {
564
564
  const o = n.indexOf("-->", t + 3);
@@ -587,7 +587,7 @@ function Ie(n, t) {
587
587
  }
588
588
  return -1;
589
589
  }
590
- function Ae(n) {
590
+ function Le(n) {
591
591
  const t = [];
592
592
  if (!n) return [];
593
593
  const e = [], s = [], r = () => {
@@ -599,133 +599,133 @@ function Ae(n) {
599
599
  for (let l = 0; l < o; l++) n[l] === `
600
600
  ` && c.push(l + 1);
601
601
  function a(l) {
602
- let h = 0;
603
- for (let u = 1; u < c.length && !(c[u] > l); u++)
604
- h = u;
605
- return [h + 1, l - c[h] + 1];
602
+ let u = 0;
603
+ for (let h = 1; h < c.length && !(c[h] > l); h++)
604
+ u = h;
605
+ return [u + 1, l - c[u] + 1];
606
606
  }
607
607
  for (; i < o; ) {
608
608
  const l = n.indexOf("<", i);
609
609
  if (l === -1 || l > i) {
610
- const k = n.substring(i, l === -1 ? void 0 : l), I = k.trim();
611
- if (I) {
612
- const f = k.indexOf(I), w = i + f, x = a(w);
610
+ const S = n.substring(i, l === -1 ? void 0 : l), A = S.trim();
611
+ if (A) {
612
+ const f = S.indexOf(A), w = i + f, $ = a(w);
613
613
  r().push({
614
614
  type: y.Text,
615
615
  tag: "text",
616
- content: I,
617
- loc: x,
616
+ content: A,
617
+ loc: $,
618
618
  children: []
619
619
  });
620
620
  }
621
621
  if (l === -1) break;
622
622
  i = l;
623
623
  }
624
- const h = Ie(n, i + 1);
625
- if (h === -1) {
626
- const k = n.substring(i);
627
- k.trim() && r().push({
624
+ const u = Ae(n, i + 1);
625
+ if (u === -1) {
626
+ const S = n.substring(i);
627
+ S.trim() && r().push({
628
628
  type: y.Text,
629
629
  tag: "text",
630
- content: k.trim(),
630
+ content: S.trim(),
631
631
  children: [],
632
632
  loc: a(i)
633
633
  });
634
634
  break;
635
635
  }
636
- const u = n.substring(i, h + 1), m = r(), E = a(i);
637
- if (u.startsWith("<!--")) {
638
- m.push({
636
+ const h = n.substring(i, u + 1), d = r(), E = a(i);
637
+ if (h.startsWith("<!--")) {
638
+ d.push({
639
639
  type: y.Comment,
640
640
  tag: "comment",
641
- content: u.slice(4, -3),
641
+ content: h.slice(4, -3),
642
642
  loc: E,
643
643
  children: []
644
- }), i = h + 1;
644
+ }), i = u + 1;
645
645
  continue;
646
646
  }
647
- if (u.startsWith("<![CDATA[")) {
648
- m.push({
647
+ if (h.startsWith("<![CDATA[")) {
648
+ d.push({
649
649
  type: y.Text,
650
650
  tag: "text",
651
- content: u.slice(9, -3),
651
+ content: h.slice(9, -3),
652
652
  loc: E,
653
653
  children: []
654
- }), i = h + 1;
654
+ }), i = u + 1;
655
655
  continue;
656
656
  }
657
- if (u.startsWith("<!") && !u.startsWith("<!--")) {
658
- m.push({
657
+ if (h.startsWith("<!") && !h.startsWith("<!--")) {
658
+ d.push({
659
659
  type: y.Comment,
660
660
  tag: "comment",
661
- content: u.slice(2, -1),
661
+ content: h.slice(2, -1),
662
662
  loc: E,
663
663
  children: []
664
- }), i = h + 1;
664
+ }), i = u + 1;
665
665
  continue;
666
666
  }
667
- if (u.startsWith("<?")) {
668
- m.push({
667
+ if (h.startsWith("<?")) {
668
+ d.push({
669
669
  type: y.Comment,
670
670
  tag: "comment",
671
- content: u.slice(2, -2),
671
+ content: h.slice(2, -2),
672
672
  loc: E,
673
673
  children: []
674
- }), i = h + 1;
674
+ }), i = u + 1;
675
675
  continue;
676
676
  }
677
- if (u.startsWith("</")) {
678
- const k = s.pop();
677
+ if (h.startsWith("</")) {
678
+ const S = s.pop();
679
679
  for (; e.length > 0; ) {
680
- if ((e[e.length - 1].tag || "").toLowerCase() === (k == null ? void 0 : k.toLowerCase())) {
680
+ if ((e[e.length - 1].tag || "").toLowerCase() === (S == null ? void 0 : S.toLowerCase())) {
681
681
  e.pop();
682
682
  break;
683
683
  }
684
684
  e.pop();
685
685
  }
686
- i = h + 1;
686
+ i = u + 1;
687
687
  continue;
688
688
  }
689
- const p = Le(u, E);
690
- m.push(p);
691
- const d = p.tag || "", L = d.toLowerCase().startsWith("script"), g = d.toLowerCase().startsWith("style"), v = u.endsWith("/>") || Se.has(d.toLowerCase());
692
- if ((L || g) && !v) {
693
- const k = `</${d}>`, I = n.toLowerCase().indexOf(k, h + 1);
694
- if (I !== -1) {
695
- const f = n.substring(h + 1, I);
696
- f.length && p.children.push({
689
+ const m = Re(h, E);
690
+ d.push(m);
691
+ const p = m.tag || "", R = p.toLowerCase().startsWith("script"), g = p.toLowerCase().startsWith("style"), v = h.endsWith("/>") || Se.has(p.toLowerCase());
692
+ if ((R || g) && !v) {
693
+ const S = `</${p}>`, A = n.toLowerCase().indexOf(S, u + 1);
694
+ if (A !== -1) {
695
+ const f = n.substring(u + 1, A);
696
+ f.length && m.children.push({
697
697
  type: y.Text,
698
698
  tag: "text",
699
699
  content: f,
700
- loc: a(h + 1),
700
+ loc: a(u + 1),
701
701
  children: []
702
- }), i = I + k.length;
702
+ }), i = A + S.length;
703
703
  continue;
704
704
  } else {
705
- const f = n.substring(h + 1);
706
- f.length && p.children.push({
705
+ const f = n.substring(u + 1);
706
+ f.length && m.children.push({
707
707
  type: y.Text,
708
708
  tag: "text",
709
709
  content: f,
710
- loc: a(h + 1),
710
+ loc: a(u + 1),
711
711
  children: []
712
712
  }), i = o;
713
713
  continue;
714
714
  }
715
715
  }
716
- !v && p.type !== y.Text && p.type !== y.Comment && (e.push(p), s.push(d)), i = h + 1;
716
+ !v && m.type !== y.Text && m.type !== y.Comment && (e.push(m), s.push(p)), i = u + 1;
717
717
  }
718
718
  return t;
719
719
  }
720
- const pt = Symbol("solely.raw");
720
+ const ht = Symbol("solely.raw");
721
721
  function Vt(n) {
722
- const t = n && n[pt];
722
+ const t = n && n[ht];
723
723
  return t ? Vt(t) : n;
724
724
  }
725
- function Me(n) {
726
- return !!(n && n[pt]);
725
+ function Ie(n) {
726
+ return !!(n && n[ht]);
727
727
  }
728
- const Ct = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
728
+ const $t = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
729
729
  if (n === t) return !0;
730
730
  if (n == null || t == null || typeof n != "object" || typeof t != "object") return n === t;
731
731
  if (Array.isArray(n) && Array.isArray(t)) {
@@ -733,7 +733,7 @@ const Ct = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
733
733
  if (e.has(n)) return e.get(n) === t;
734
734
  e.set(n, t);
735
735
  for (let r = 0; r < n.length; r++)
736
- if (!Ct(n[r], t[r], e)) return !1;
736
+ if (!$t(n[r], t[r], e)) return !1;
737
737
  return !0;
738
738
  }
739
739
  if (Array.isArray(n) !== Array.isArray(t)) return !1;
@@ -742,112 +742,112 @@ const Ct = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
742
742
  const s = Reflect.ownKeys(n);
743
743
  if (s.length !== Reflect.ownKeys(t).length) return !1;
744
744
  for (const r of s)
745
- if (!Reflect.has(t, r) || !Ct(n[r], t[r], e)) return !1;
745
+ if (!Reflect.has(t, r) || !$t(n[r], t[r], e)) return !1;
746
746
  return !0;
747
747
  };
748
- function Pe(n, t, e = {}) {
748
+ function Me(n, t, e = {}) {
749
749
  const { throttle: s = 0, onBatch: r, immediate: i = !1, deepCompare: o = !1 } = e;
750
- let c = !0, a = null, l = [], h = 0;
751
- const u = /* @__PURE__ */ new WeakMap(), m = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), p = Array.isArray(e.filter) ? e.filter : e.filter ? [e.filter] : [], d = (f) => {
752
- if (p.length === 0) return !0;
750
+ let c = !0, a = null, l = [], u = 0;
751
+ const h = /* @__PURE__ */ new WeakMap(), d = /* @__PURE__ */ new WeakMap(), E = /* @__PURE__ */ new WeakMap(), m = Array.isArray(e.filter) ? e.filter : e.filter ? [e.filter] : [], p = (f) => {
752
+ if (m.length === 0) return !0;
753
753
  const w = f.map(String).join(".");
754
- return p.some((x) => {
755
- if (x === "") return !0;
756
- const b = x.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
754
+ return m.some(($) => {
755
+ if ($ === "") return !0;
756
+ const b = $.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
757
757
  return new RegExp(`^${b}$`).test(w);
758
758
  });
759
- }, L = (f) => {
759
+ }, R = (f) => {
760
760
  const w = [];
761
- let x = f;
762
- for (; x; ) {
763
- const b = m.get(x);
761
+ let $ = f;
762
+ for (; $; ) {
763
+ const b = d.get($);
764
764
  if (!b || b.key == null) break;
765
- w.unshift(b.key), x = b.parent;
765
+ w.unshift(b.key), $ = b.parent;
766
766
  }
767
767
  return w;
768
768
  }, g = (f, w) => {
769
769
  if (!c) return;
770
- const x = L(f);
771
- if (!d(x)) return;
772
- const b = { ...w, path: x };
770
+ const $ = R(f);
771
+ if (!p($)) return;
772
+ const b = { ...w, path: $ };
773
773
  s > 0 ? (l.push(b), a || (a = setTimeout(() => {
774
- const A = [...l];
775
- l = [], a = null, c && (r == null || r(A), A.forEach(t));
774
+ const L = [...l];
775
+ l = [], a = null, c && (r == null || r(L), L.forEach(t));
776
776
  }, s))) : (r == null || r([b]), t(b));
777
777
  }, v = (f, w) => {
778
- const x = {};
778
+ const $ = {};
779
779
  return ["push", "pop", "shift", "unshift", "splice"].forEach((b) => {
780
- x[b] = function(...A) {
781
- h++;
782
- const $ = f[b].apply(f, A);
783
- if (h--, b === "push")
784
- g(w, { type: "array-push", index: f.length - A.length, values: A });
780
+ $[b] = function(...L) {
781
+ u++;
782
+ const x = f[b].apply(f, L);
783
+ if (u--, b === "push")
784
+ g(w, { type: "array-push", index: f.length - L.length, values: L });
785
785
  else if (b === "unshift")
786
- g(w, { type: "array-push", index: 0, values: A });
786
+ g(w, { type: "array-push", index: 0, values: L });
787
787
  else if (b === "pop")
788
788
  g(w, { type: "array-splice", index: f.length, deleteCount: 1, insert: [] });
789
789
  else if (b === "shift")
790
790
  g(w, { type: "array-splice", index: 0, deleteCount: 1, insert: [] });
791
791
  else if (b === "splice") {
792
- const [M, P, ...W] = A;
793
- g(w, { type: "array-splice", index: M, deleteCount: P, insert: W });
792
+ const [I, M, ..._] = L;
793
+ g(w, { type: "array-splice", index: I, deleteCount: M, insert: _ });
794
794
  }
795
- return $;
795
+ return x;
796
796
  };
797
797
  }), ["sort", "reverse", "fill", "copyWithin"].forEach((b) => {
798
- x[b] = function(...A) {
799
- h++;
800
- const $ = f[b].apply(f, A);
801
- return h--, g(w, { type: "array-reset", method: b }), $;
798
+ $[b] = function(...L) {
799
+ u++;
800
+ const x = f[b].apply(f, L);
801
+ return u--, g(w, { type: "array-reset", method: b }), x;
802
802
  };
803
803
  }), ["indexOf", "lastIndexOf", "includes"].forEach((b) => {
804
- x[b] = function(A, ...$) {
805
- let M = f[b].apply(f, [A, ...$]);
806
- return (M === -1 || M === !1) && Me(A) && (M = f[b].apply(f, [Vt(A), ...$])), M;
804
+ $[b] = function(L, ...x) {
805
+ let I = f[b].apply(f, [L, ...x]);
806
+ return (I === -1 || I === !1) && Ie(L) && (I = f[b].apply(f, [Vt(L), ...x])), I;
807
807
  };
808
- }), x;
809
- }, k = (f, w, x) => {
810
- if (!Object.isExtensible(f) || f[pt])
808
+ }), $;
809
+ }, S = (f, w, $) => {
810
+ if (!Object.isExtensible(f) || f[ht])
811
811
  return f;
812
- const b = u.get(f);
812
+ const b = h.get(f);
813
813
  if (b)
814
- return m.set(b, { parent: w, key: x }), b;
815
- const A = {
816
- get(M, P, W) {
817
- if (P === pt) return M;
818
- if (Array.isArray(M)) {
819
- const D = E.get($);
820
- if (D && Object.prototype.hasOwnProperty.call(D, P))
821
- return Reflect.get(D, P, W);
814
+ return d.set(b, { parent: w, key: $ }), b;
815
+ const L = {
816
+ get(I, M, _) {
817
+ if (M === ht) return I;
818
+ if (Array.isArray(I)) {
819
+ const F = E.get(x);
820
+ if (F && Object.prototype.hasOwnProperty.call(F, M))
821
+ return Reflect.get(F, M, _);
822
822
  }
823
- const V = Reflect.get(M, P, W);
824
- return typeof P == "symbol" ? V : H(V) ? k(V, $, P) : V;
823
+ const D = Reflect.get(I, M, _);
824
+ return typeof M == "symbol" ? D : G(D) ? S(D, x, M) : D;
825
825
  },
826
- set(M, P, W, V) {
827
- const D = M[P];
828
- if (o ? Ct(D, W) : D === W) return !0;
829
- const at = Reflect.set(M, P, W, V);
830
- return h === 0 && (Array.isArray(D) && Array.isArray(W) ? g($, { type: "array-replace", oldValue: D, newValue: W }) : g($, { type: "set", key: P, newValue: W, oldValue: D })), at;
826
+ set(I, M, _, D) {
827
+ const F = I[M];
828
+ if (o ? $t(F, _) : F === _) return !0;
829
+ const rt = Reflect.set(I, M, _, D);
830
+ return u === 0 && (Array.isArray(F) && Array.isArray(_) ? g(x, { type: "array-replace", oldValue: F, newValue: _ }) : g(x, { type: "set", key: M, newValue: _, oldValue: F })), rt;
831
831
  },
832
- deleteProperty(M, P) {
833
- if (!Reflect.has(M, P)) return !1;
834
- const W = M[P], V = Reflect.deleteProperty(M, P);
835
- return V && h === 0 && g($, { type: "delete", key: P, oldValue: W }), V;
832
+ deleteProperty(I, M) {
833
+ if (!Reflect.has(I, M)) return !1;
834
+ const _ = I[M], D = Reflect.deleteProperty(I, M);
835
+ return D && u === 0 && g(x, { type: "delete", key: M, oldValue: _ }), D;
836
836
  }
837
- }, $ = new Proxy(f, A);
838
- return u.set(f, $), m.set($, { parent: w, key: x }), Array.isArray(f) && E.set($, v(f, $)), $;
839
- }, I = k(n, null, null);
837
+ }, x = new Proxy(f, L);
838
+ return h.set(f, x), d.set(x, { parent: w, key: $ }), Array.isArray(f) && E.set(x, v(f, x)), x;
839
+ }, A = S(n, null, null);
840
840
  if (i) {
841
- const f = (w, x, b = /* @__PURE__ */ new WeakSet()) => {
842
- !H(w) || b.has(w) || (b.add(w), Reflect.ownKeys(w).forEach((A) => {
843
- const $ = w[A];
844
- g(x, { type: "set", key: A, newValue: $, oldValue: void 0 }), H($) && f($, k($, x, A), b);
841
+ const f = (w, $, b = /* @__PURE__ */ new WeakSet()) => {
842
+ !G(w) || b.has(w) || (b.add(w), Reflect.ownKeys(w).forEach((L) => {
843
+ const x = w[L];
844
+ G(x) && b.has(x) || (g($, { type: "set", key: L, newValue: x, oldValue: void 0 }), G(x) && f(x, S(x, $, L), b));
845
845
  }));
846
846
  };
847
- f(n, I);
847
+ f(n, A);
848
848
  }
849
849
  return {
850
- proxy: I,
850
+ proxy: A,
851
851
  unobserve: () => {
852
852
  c = !1, l = [], a && clearTimeout(a);
853
853
  },
@@ -856,241 +856,42 @@ function Pe(n, t, e = {}) {
856
856
  }
857
857
  };
858
858
  }
859
- const Tt = Symbol.for("solely.manifest");
860
- var q, Y, J, rt, Z, G, Q, X, K, it, ot, z, S, Bt, Rt, qt, Lt, It, dt, Gt, Kt, At, Pt;
861
- const j = class j extends HTMLElement {
862
- /* -------------------- 构造 -------------------- */
863
- constructor(e = {}) {
864
- var i;
865
- super();
866
- _(this, S);
867
- _(this, q);
868
- _(this, Y);
869
- _(this, J);
870
- _(this, rt);
871
- _(this, Z);
872
- _(this, G);
873
- _(this, Q, !1);
874
- _(this, X, !1);
875
- _(this, K, !1);
876
- _(this, it, !1);
877
- const s = this.constructor;
878
- N(this, q, s[Tt] || { tagName: "base-element" });
879
- const r = R(this, q);
880
- N(this, Z, (i = r.shadowDOM) != null && i.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), O(this, S, Rt).call(this, e), O(this, S, qt).call(this, r), queueMicrotask(() => O(this, S, At).call(this));
881
- }
882
- static get observedAttributes() {
883
- if (R(j, z).has(this))
884
- return R(j, z).get(this);
885
- const e = this[Tt];
886
- if (!(e != null && e.props))
887
- return R(j, z).set(this, []), [];
888
- const s = e.props.map((r) => (typeof r == "string" ? r : r.name).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase());
889
- return R(j, z).set(this, s), s;
890
- }
891
- /* -------------------- $data -------------------- */
892
- get $data() {
893
- return R(this, rt);
894
- }
895
- set $data(e) {
896
- var s;
897
- H(e) || (e = {}), (s = R(this, G)) == null || s.call(this), O(this, S, Rt).call(this, e), O(this, S, dt).call(this);
898
- }
899
- refresh() {
900
- O(this, S, dt).call(this);
901
- }
902
- /* -------------------- 生命周期 -------------------- */
903
- connectedCallback() {
904
- var i;
905
- const e = this.constructor;
906
- Array.isArray(e.upgradeProps) && O(this, S, Bt).call(this, e.upgradeProps), O(this, S, At).call(this);
907
- const s = R(this, q);
908
- if ((s.className || s.tagName || "").split(" ").forEach((o) => o && this.classList.add(o)), O(this, S, Kt).call(this), s.props && H(this.$data))
909
- for (const o of s.props) {
910
- const c = typeof o == "string" ? o : o.name, a = O(this, S, Lt).call(this, c), l = c.replace(
911
- /-([a-z])/g,
912
- (h, u) => u.toUpperCase()
913
- );
914
- if (this.hasAttribute(c)) {
915
- const h = this.getAttribute(c), u = O(this, S, It).call(this, h, a == null ? void 0 : a.default, a == null ? void 0 : a.type);
916
- this.$data[l] = u;
917
- } else a && "default" in a && (this.$data[l] = a.default);
918
- }
919
- R(this, J) && N(this, Y, Ke(
920
- R(this, J),
921
- R(this, Z),
922
- this
923
- )), this.mounted(), (i = this.onInit) == null || i.call(this);
924
- }
925
- disconnectedCallback() {
926
- var e;
927
- this.unmounted(), (e = R(this, G)) == null || e.call(this), N(this, G, void 0);
928
- }
929
- attributeChangedCallback(e, s, r) {
930
- if (s === r || !H(this.$data)) return;
931
- const i = O(this, S, Lt).call(this, e), o = e.replace(/-([a-z])/g, (l, h) => h.toUpperCase()), c = this.$data[o], a = O(this, S, It).call(this, r, (i == null ? void 0 : i.default) ?? c, i == null ? void 0 : i.type);
932
- this.$data[o] = a, N(this, K, !0), this.attributeChanged(e, c, a), this.emit("change", {
933
- source: "attribute",
934
- name: e,
935
- oldValue: c,
936
- newValue: a
937
- });
938
- }
939
- /* -------------------- 事件派发 -------------------- */
940
- emit(e, s, r) {
941
- this.dispatchEvent(
942
- new CustomEvent(e, {
943
- bubbles: !0,
944
- composed: !0,
945
- detail: s,
946
- ...r
947
- })
948
- );
949
- }
950
- /* -------------------- 钩子 -------------------- */
951
- onInit() {
952
- }
953
- created() {
954
- }
955
- mounted() {
956
- }
957
- beforeUpdate() {
958
- }
959
- updated() {
960
- }
961
- unmounted() {
962
- }
963
- attributeChanged(e, s, r) {
964
- }
965
- beforeAttributesUpdate() {
966
- }
967
- afterAttributesUpdate() {
968
- }
969
- };
970
- q = new WeakMap(), Y = new WeakMap(), J = new WeakMap(), rt = new WeakMap(), Z = new WeakMap(), G = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), K = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), z = new WeakMap(), S = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
971
- Bt = function(e) {
972
- for (const s of e)
973
- if (this.hasOwnProperty(s)) {
974
- const r = this[s];
975
- delete this[s], this[s] = r;
976
- }
977
- }, /* -------------------- 初始化 -------------------- */
978
- Rt = function(e) {
979
- const { proxy: s, unobserve: r } = Pe(e, (i) => {
980
- this.emit("change", {
981
- source: "state",
982
- ...i
983
- }), O(this, S, dt).call(this);
984
- });
985
- N(this, rt, s), N(this, G, r);
986
- }, qt = function(e) {
987
- const s = e.template;
988
- if (typeof s == "string") {
989
- const r = Ae(s);
990
- N(this, J, $e(r, {
991
- source: s,
992
- filename: e.tagName
993
- }));
994
- }
995
- }, /* -------------------- Prop 工具 -------------------- */
996
- Lt = function(e) {
997
- const s = R(this, q).props;
998
- if (!s) return;
999
- const r = e.replace(/-([a-z])/g, (o, c) => c.toUpperCase()), i = s.find(
1000
- (o) => typeof o == "string" ? o === r : o.name === r
1001
- );
1002
- if (i)
1003
- return typeof i == "string" ? { name: i } : i;
1004
- }, It = function(e, s, r) {
1005
- if (e === null) return s;
1006
- switch (r) {
1007
- case "number": {
1008
- const i = Number(e);
1009
- return isNaN(i) ? s : i;
1010
- }
1011
- case "boolean":
1012
- return e !== null && e !== "false";
1013
- case "object":
1014
- try {
1015
- return JSON.parse(e);
1016
- } catch {
1017
- return s;
1018
- }
1019
- default:
1020
- return e;
1021
- }
1022
- }, /* -------------------- 刷新调度 -------------------- */
1023
- dt = function() {
1024
- R(this, X) || !R(this, Y) || (N(this, X, !0), queueMicrotask(() => {
1025
- N(this, X, !1), O(this, S, Gt).call(this);
1026
- }));
1027
- }, Gt = function() {
1028
- R(this, Q) || !this.isConnected || (N(this, Q, !0), R(this, K) && this.beforeAttributesUpdate(), this.beforeUpdate(), R(this, Y).update(), this.updated(), R(this, K) && (this.afterAttributesUpdate(), N(this, K, !1)), N(this, Q, !1));
1029
- }, Kt = function() {
1030
- const s = R(this, q).styles;
1031
- if (!s) return;
1032
- const r = R(this, Z);
1033
- if ("adoptedStyleSheets" in r) {
1034
- if (r._styleInjected) return;
1035
- let o = R(j, ot).get(s);
1036
- o || (o = new CSSStyleSheet(), o.replaceSync(s), R(j, ot).set(s, o)), r.adoptedStyleSheets = [
1037
- ...r.adoptedStyleSheets,
1038
- o
1039
- ], r._styleInjected = !0;
1040
- return;
1041
- }
1042
- if (r.querySelector("style[data-manifest-style]")) return;
1043
- const i = document.createElement("style");
1044
- i.dataset.manifestStyle = "true", i.textContent = s, r.appendChild(i);
1045
- }, /* -------------------- created 保障 -------------------- */
1046
- At = function() {
1047
- R(this, it) || (N(this, it, !0), this.created());
1048
- }, Pt = new WeakMap(), C(j, "upgradeProps"), // 需要在元素定义前设置的属性列表(Upgrade Property)
1049
- _(j, ot, /* @__PURE__ */ new Map()), /* -------------------- observedAttributes -------------------- */
1050
- _(j, z, /* @__PURE__ */ new WeakMap()), /* -------------------- DEV define 保护 -------------------- */
1051
- _(j, Pt, !1);
1052
- let mt = j;
1053
- const Oe = Symbol.for("solely.manifest"), zt = (n) => (t) => {
1054
- if (customElements.get(n.tagName))
1055
- return console.warn(`标签名称 "${n.tagName}" 已经被注册`), t;
1056
- class e extends t {
1057
- }
1058
- return e[Oe] = n, customElements.define(n.tagName, e), e;
1059
- }, ut = Symbol("solely.irCtx"), ht = Symbol("solely.irEvents"), F = Symbol.for("solely.irMeta"), Et = Symbol("solely.prevClassObj"), xt = Symbol("solely.prevStyleObj"), _e = {
859
+ const at = Symbol("solely.irCtx"), ct = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), bt = Symbol("solely.prevClassObj"), wt = Symbol("solely.prevStyleObj"), Pe = {
1060
860
  xml: "http://www.w3.org/XML/1998/namespace",
1061
861
  xlink: "http://www.w3.org/1999/xlink",
1062
862
  xmlns: "http://www.w3.org/2000/xmlns/"
1063
- }, Ne = {
863
+ }, Nt = {
1064
864
  readonly: "readOnly",
1065
865
  for: "htmlFor",
1066
866
  tabindex: "tabIndex",
1067
867
  contenteditable: "contentEditable",
1068
868
  maxlength: "maxLength"
1069
- }, We = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Te = /* @__PURE__ */ new Set([
869
+ }, Oe = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Ne = /* @__PURE__ */ new Set([
1070
870
  "value",
1071
871
  "selectedIndex"
1072
872
  ]);
1073
- function De(n, t) {
873
+ function _e(n, t) {
1074
874
  var s;
1075
875
  const e = (s = t.attrs) == null ? void 0 : s.find((r) => r.key === "class" && !r.dynamic);
1076
876
  e != null && e.value && n.setAttribute("class", e.value);
1077
877
  }
1078
- function Fe(n, t) {
1079
- var r;
1080
- const e = (r = t.attrs) == null ? void 0 : r.find((i) => i.key === "style" && !i.dynamic), s = e ? Ut(e.value) : {};
1081
- for (const i in s) {
1082
- const o = s[i];
1083
- i.startsWith("--") ? n.style.setProperty(i, o) : n.style[i] = o;
878
+ function Te(n, t) {
879
+ var i;
880
+ if (!n.style) return;
881
+ const s = (i = t.attrs) == null ? void 0 : i.find((o) => o.key === "style" && !o.dynamic), r = s ? Dt(s.value) : {};
882
+ for (const o in r) {
883
+ const c = r[o];
884
+ o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c;
1084
885
  }
1085
886
  }
1086
- const je = (n, t) => {
1087
- const e = n, s = Ut(t), r = e[xt];
887
+ const We = (n, t) => {
888
+ const e = n, s = Dt(t), r = e[wt];
1088
889
  if (!r) {
1089
890
  for (const o in s) {
1090
891
  const c = s[o];
1091
892
  o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c;
1092
893
  }
1093
- e[xt] = s;
894
+ e[wt] = s;
1094
895
  return;
1095
896
  }
1096
897
  let i = !1;
@@ -1100,13 +901,13 @@ const je = (n, t) => {
1100
901
  const c = s[o], a = r[o];
1101
902
  c !== a && (o.startsWith("--") ? n.style.setProperty(o, c) : n.style[o] = c, i = !0);
1102
903
  }
1103
- i && (e[xt] = s);
1104
- }, Ve = (n, t) => {
1105
- const e = n, s = e[Et], r = Be(t);
904
+ i && (e[wt] = s);
905
+ }, Fe = (n, t) => {
906
+ const e = n, s = e[bt], r = Ve(t);
1106
907
  if (!s) {
1107
908
  for (const o in r)
1108
909
  n.classList.add(o);
1109
- e[Et] = r;
910
+ e[bt] = r;
1110
911
  return;
1111
912
  }
1112
913
  let i = !1;
@@ -1114,9 +915,9 @@ const je = (n, t) => {
1114
915
  r[o] || (n.classList.remove(o), i = !0);
1115
916
  for (const o in r)
1116
917
  s[o] || (n.classList.add(o), i = !0);
1117
- i && (e[Et] = r);
918
+ i && (e[bt] = r);
1118
919
  };
1119
- function Ut(n) {
920
+ function Dt(n) {
1120
921
  const t = {}, e = [[n]];
1121
922
  for (; e.length; ) {
1122
923
  const [s, r] = e.pop();
@@ -1146,7 +947,7 @@ function Ut(n) {
1146
947
  }
1147
948
  return t;
1148
949
  }
1149
- function Be(n) {
950
+ function Ve(n) {
1150
951
  const t = {}, e = [n];
1151
952
  for (; e.length; ) {
1152
953
  const s = e.pop();
@@ -1167,26 +968,52 @@ function Be(n) {
1167
968
  }
1168
969
  return t;
1169
970
  }
1170
- function qe(n, t, e) {
1171
- const s = t.indexOf(":");
1172
- if (s > 0) {
1173
- const r = t.slice(0, s), i = _e[r];
1174
- if (i) return n.setAttributeNS(i, t, e);
971
+ function St(n, t, e) {
972
+ const s = e == null ? "" : String(e), r = t.indexOf(":");
973
+ if (r > 0) {
974
+ const i = t.slice(0, r), o = Pe[i];
975
+ if (o) {
976
+ n.getAttributeNS(o, t) !== s && n.setAttributeNS(o, t, s);
977
+ return;
978
+ }
1175
979
  }
1176
- n.setAttribute(t, e);
980
+ n.getAttribute(t) !== s && n.setAttribute(t, s);
1177
981
  }
1178
- function Dt(n, t, e) {
1179
- if (t.startsWith("data-") || t.startsWith("aria-") || We.has(t)) {
1180
- n.setAttribute(t, e);
982
+ function _t(n, t, e) {
983
+ const s = Nt[t] || t;
984
+ if (t.startsWith("data-") || t.startsWith("aria-") || Oe.has(t)) {
985
+ St(n, t, e);
1181
986
  return;
1182
987
  }
1183
- const s = Ne[t] || t;
1184
- n[s] = e;
988
+ const r = n, i = r.tagName;
989
+ if (e == null) {
990
+ if (typeof r[s] == "boolean")
991
+ r[s] !== !1 && (r[s] = !1);
992
+ else {
993
+ const c = r[s];
994
+ c !== "" && c !== void 0 && (r[s] = ""), n.hasAttribute(t) && n.removeAttribute(t);
995
+ }
996
+ return;
997
+ }
998
+ if (s === "src" || s === "href") {
999
+ const c = String(e);
1000
+ if (r[s] === c || n.getAttribute(s) === c)
1001
+ return;
1002
+ }
1003
+ if (s === "value" && (i === "INPUT" || i === "TEXTAREA") && r.value === e)
1004
+ return;
1005
+ if (typeof e == "boolean") {
1006
+ if (r[s] === e)
1007
+ return;
1008
+ r[s] = e;
1009
+ return;
1010
+ }
1011
+ (n instanceof SVGElement || r.ownerSVGElement !== void 0) && !Nt[t] ? St(n, t, e) : r[s] !== e && (r[s] = e);
1185
1012
  }
1186
- class Ge {
1013
+ class De {
1187
1014
  constructor(t, e, s = {}) {
1188
- C(this, "nodeMap", /* @__PURE__ */ new Map());
1189
- C(this, "marker", !1);
1015
+ k(this, "nodeMap", /* @__PURE__ */ new Map());
1016
+ k(this, "marker", !1);
1190
1017
  this.ir = t, this.container = e, this.scope = s;
1191
1018
  }
1192
1019
  evalIR(t, e, s) {
@@ -1195,7 +1022,7 @@ class Ge {
1195
1022
  try {
1196
1023
  return r ? r.apply(this.scope, e) : "";
1197
1024
  } catch (o) {
1198
- return ne(o.message || o.toString(), ((i = this.ir.metadata) == null ? void 0 : i.source) || "", s, this.scope.tagName), "";
1025
+ return ee(o.message || o.toString(), ((i = this.ir.metadata) == null ? void 0 : i.source) || "", s, this.scope.tagName), "";
1199
1026
  }
1200
1027
  }
1201
1028
  // ================ 创建节点 ================
@@ -1204,86 +1031,86 @@ class Ge {
1204
1031
  return e instanceof SVGElement || s === "svg" ? document.createElementNS("http://www.w3.org/2000/svg", s) : document.createElement(s);
1205
1032
  }
1206
1033
  createText(t, e) {
1207
- const s = t.dynamic ? this.evalIR(t.fid, [e], t[F]) : t.txt || "";
1034
+ const s = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1208
1035
  return document.createTextNode(s);
1209
1036
  }
1210
1037
  createComment(t, e) {
1211
- const s = t.dynamic ? this.evalIR(t.fid, [e], t[F]) : t.txt || "";
1038
+ const s = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1212
1039
  return document.createComment(s);
1213
1040
  }
1214
1041
  // ================ 属性全量应用(创建或更新时用) ================
1215
1042
  applyAttrs(t, e, s, r = !1) {
1216
1043
  const i = [], o = t;
1217
- o[ut] || (o[ut] = {
1044
+ o[at] || (o[at] = {
1218
1045
  loops: null
1219
- }), o[ut].loops = s, o[ht] || (o[ht] = /* @__PURE__ */ Object.create(null));
1220
- let c, a = !1, l, h = !1;
1221
- for (const u of e) {
1222
- const { key: m, fid: E, dynamic: p, value: d } = u;
1223
- if (m === ":class") {
1224
- c = this.evalIR(E, [s], u[F]), a = !0;
1046
+ }), o[at].loops = s, o[ct] || (o[ct] = /* @__PURE__ */ Object.create(null));
1047
+ let c, a = !1, l, u = !1;
1048
+ for (const h of e) {
1049
+ const { key: d, fid: E, dynamic: m, value: p } = h;
1050
+ if (d === ":class") {
1051
+ c = this.evalIR(E, [s], h[V]), a = !0;
1225
1052
  continue;
1226
1053
  }
1227
- if (m === ":style") {
1228
- l = this.evalIR(E, [s], u[F]), h = !0;
1054
+ if (d === ":style") {
1055
+ l = this.evalIR(E, [s], h[V]), u = !0;
1229
1056
  continue;
1230
1057
  }
1231
- if (m === "class" || m === "style")
1058
+ if (d === "class" || d === "style")
1232
1059
  continue;
1233
- const L = m[0];
1234
- if (L === "@") {
1235
- const v = m.slice(1), k = u.role ?? "user";
1236
- let I = o[ht][v];
1237
- if (I || (I = o[ht][v] = {
1060
+ const R = d[0];
1061
+ if (R === "@") {
1062
+ const v = d.slice(1), S = h.role ?? "user";
1063
+ let A = o[ct][v];
1064
+ if (A || (A = o[ct][v] = {
1238
1065
  model: [],
1239
1066
  user: []
1240
1067
  }, t.addEventListener(v, (f) => {
1241
- for (const w of I.model)
1068
+ for (const w of A.model)
1242
1069
  w(f);
1243
- for (const w of I.user)
1070
+ for (const w of A.user)
1244
1071
  w(f);
1245
1072
  })), !r) {
1246
1073
  const f = (w) => this.evalIR(
1247
1074
  E,
1248
- [w, o[ut].loops],
1249
- u[F]
1075
+ [w, o[at].loops],
1076
+ h[V]
1250
1077
  );
1251
- I[k].push(f);
1078
+ A[S].push(f);
1252
1079
  }
1253
1080
  continue;
1254
1081
  }
1255
- if (m === "mounted") {
1082
+ if (d === "mounted") {
1256
1083
  r || requestAnimationFrame(
1257
- () => this.evalIR(E, [t, s], u[F])
1084
+ () => this.evalIR(E, [t, s], h[V])
1258
1085
  );
1259
1086
  continue;
1260
1087
  }
1261
- if (m === "updated") {
1088
+ if (d === "updated") {
1262
1089
  r && requestAnimationFrame(
1263
- () => this.evalIR(E, [t, s], u[F])
1090
+ () => this.evalIR(E, [t, s], h[V])
1264
1091
  );
1265
1092
  continue;
1266
1093
  }
1267
- if (m === "ref" && d) {
1268
- this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[d] = t;
1094
+ if (d === "ref" && p) {
1095
+ this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[p] = t;
1269
1096
  continue;
1270
1097
  }
1271
- const g = p ? this.evalIR(E, [s], u[F]) : d ?? "";
1272
- if (L === ":") {
1273
- const v = m.slice(1);
1274
- t.tagName === "SELECT" && Te.has(v) ? i.push(() => Dt(t, v, g)) : Dt(t, v, g);
1275
- } else r || qe(t, m, String(g));
1098
+ const g = m ? this.evalIR(E, [s], h[V]) : p ?? "";
1099
+ if (R === ":") {
1100
+ const v = d.slice(1);
1101
+ t.tagName === "SELECT" && Ne.has(v) ? i.push(() => _t(t, v, g)) : _t(t, v, g);
1102
+ } else r || St(t, d, String(g));
1276
1103
  }
1277
- return a && Ve(t, c), h && je(t, l), i;
1104
+ return a && Fe(t, c), u && We(t, l), i;
1278
1105
  }
1279
1106
  // ================ 更新已有节点 Text Or Comment ================
1280
1107
  updateNode(t, e, s) {
1281
- const r = e.dynamic ? this.evalIR(e.fid, [s], e[F]) : e.txt || "";
1108
+ const r = e.dynamic ? this.evalIR(e.fid, [s], e[V]) : e.txt || "";
1282
1109
  e.dynamic && t.textContent !== r && (t.textContent = r);
1283
1110
  }
1284
1111
  // ================ 核心遍历 ================
1285
1112
  irToNode(t, e, s, r, i) {
1286
- var l, h, u, m;
1113
+ var l, u, h, d;
1287
1114
  const o = s + "-" + e, c = this.nodeMap.get(o);
1288
1115
  let a;
1289
1116
  if (c) {
@@ -1294,17 +1121,17 @@ class Ge {
1294
1121
  t.attrs ?? [],
1295
1122
  i,
1296
1123
  !0
1297
- ) : this.updateNode(a, t, i)), (l = t.children) == null || l.forEach((p, d) => {
1298
- this.irToNode(p, d, o, a, i);
1299
- }), E.forEach((p) => p());
1124
+ ) : this.updateNode(a, t, i)), (l = t.children) == null || l.forEach((m, p) => {
1125
+ this.irToNode(m, p, o, a, i);
1126
+ }), E.forEach((m) => m());
1300
1127
  } else
1301
1128
  switch (t.type) {
1302
1129
  case y.Element:
1303
- a = this.createElement(t, r), De(a, t), Fe(a, t);
1130
+ a = this.createElement(t, r), _e(a, t), Te(a, t);
1304
1131
  const E = this.applyAttrs(a, t.attrs ?? [], i);
1305
- r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker }), (h = t.children) == null || h.forEach((p, d) => {
1306
- this.irToNode(p, d, o, a, i);
1307
- }), E.forEach((p) => p());
1132
+ r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker }), (u = t.children) == null || u.forEach((m, p) => {
1133
+ this.irToNode(m, p, o, a, i);
1134
+ }), E.forEach((m) => m());
1308
1135
  break;
1309
1136
  case y.Text:
1310
1137
  a = this.createText(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
@@ -1313,35 +1140,35 @@ class Ge {
1313
1140
  a = this.createComment(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
1314
1141
  break;
1315
1142
  case y.For: {
1316
- const p = `${o}-end`;
1317
- let d = (u = this.nodeMap.get(p)) == null ? void 0 : u.node;
1318
- d ? this.nodeMap.get(p).marker = this.marker : (d = document.createComment(`for:${o}`), r.appendChild(d), this.nodeMap.set(p, {
1143
+ const m = `${o}-end`;
1144
+ let p = (h = this.nodeMap.get(m)) == null ? void 0 : h.node;
1145
+ p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`for:${o}`), r.appendChild(p), this.nodeMap.set(m, {
1319
1146
  irNode: { type: y.Comment },
1320
- node: d,
1147
+ node: p,
1321
1148
  loops: i,
1322
1149
  marker: this.marker
1323
1150
  }));
1324
- const L = this.evalIR(t.fid, [i], t[F]) || [], g = document.createDocumentFragment();
1325
- L.forEach((v, k) => {
1151
+ const R = this.evalIR(t.fid, [i], t[V]) || [], g = document.createDocumentFragment();
1152
+ R.forEach((v, S) => {
1326
1153
  var f;
1327
- const I = [...i, { itmVal: v, idxVal: k }];
1328
- (f = t.children) == null || f.forEach((w, x) => {
1329
- this.irToNode(w, x, `${o}-for-${k}`, g, I);
1154
+ const A = [...i, { itmVal: v, idxVal: S }];
1155
+ (f = t.children) == null || f.forEach((w, $) => {
1156
+ this.irToNode(w, $, `${o}-for-${S}`, g, A);
1330
1157
  });
1331
- }), d.parentNode.insertBefore(g, d);
1158
+ }), p.parentNode.insertBefore(g, p);
1332
1159
  break;
1333
1160
  }
1334
1161
  case y.Conditional: {
1335
- const p = `${o}-end`;
1336
- let d = (m = this.nodeMap.get(p)) == null ? void 0 : m.node;
1337
- d ? this.nodeMap.get(p).marker = this.marker : (d = document.createComment(`if:${o}`), r.appendChild(d), this.nodeMap.set(p, { irNode: {}, node: d, loops: i, marker: this.marker }));
1338
- for (let L = 0; L < (t.branches || []).length; L++) {
1339
- const g = t.branches[L];
1340
- if (g.condFid === null || this.evalIR(g.condFid, [i], g[F])) {
1341
- const k = document.createDocumentFragment();
1342
- g.children.forEach((I, f) => {
1343
- this.irToNode(I, f, `${o}-if-${L}`, k, i);
1344
- }), d.parentNode.insertBefore(k, d);
1162
+ const m = `${o}-end`;
1163
+ let p = (d = this.nodeMap.get(m)) == null ? void 0 : d.node;
1164
+ p ? this.nodeMap.get(m).marker = this.marker : (p = document.createComment(`if:${o}`), r.appendChild(p), this.nodeMap.set(m, { irNode: {}, node: p, loops: i, marker: this.marker }));
1165
+ for (let R = 0; R < (t.branches || []).length; R++) {
1166
+ const g = t.branches[R];
1167
+ if (g.condFid === null || this.evalIR(g.condFid, [i], g[V])) {
1168
+ const S = document.createDocumentFragment();
1169
+ g.children.forEach((A, f) => {
1170
+ this.irToNode(A, f, `${o}-if-${R}`, S, i);
1171
+ }), p.parentNode.insertBefore(S, p);
1345
1172
  break;
1346
1173
  }
1347
1174
  }
@@ -1360,7 +1187,7 @@ class Ge {
1360
1187
  this.evalIR(
1361
1188
  o.fid,
1362
1189
  [r, i],
1363
- o[F]
1190
+ o[V]
1364
1191
  );
1365
1192
  });
1366
1193
  const c = s.attrs.find((a) => a.key === "ref");
@@ -1384,33 +1211,247 @@ class Ge {
1384
1211
  this.container.innerHTML = "", this.nodeMap.clear();
1385
1212
  }
1386
1213
  }
1387
- const Ke = (n, t, e = {}) => {
1388
- const s = new Ge(n, t, e);
1214
+ const je = (n, t, e = {}) => {
1215
+ const s = new De(n, t, e);
1389
1216
  return s.mount(), {
1390
1217
  update: () => s.update(),
1391
1218
  destroy: () => s.destroy()
1392
1219
  };
1220
+ }, Tt = Symbol.for("solely.manifest");
1221
+ var B, U, H, nt, Y, q, Z, J, z, st, C, jt, kt, Bt, Gt, Ct, ut, qt, zt, Rt, Lt;
1222
+ class ft extends HTMLElement {
1223
+ /* -------------------- 构造 -------------------- */
1224
+ constructor(e = {}) {
1225
+ var i;
1226
+ super();
1227
+ T(this, C);
1228
+ T(this, B);
1229
+ T(this, U);
1230
+ T(this, H);
1231
+ T(this, nt);
1232
+ T(this, Y);
1233
+ T(this, q);
1234
+ T(this, Z, !1);
1235
+ T(this, J, !1);
1236
+ T(this, z, !1);
1237
+ T(this, st, !1);
1238
+ const s = this.constructor;
1239
+ O(this, B, s[Tt] || { tagName: "base-element" });
1240
+ const r = P(this, B);
1241
+ O(this, Y, (i = r.shadowDOM) != null && i.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), N(this, C, kt).call(this, e), N(this, C, Gt).call(this, r), queueMicrotask(() => N(this, C, Rt).call(this));
1242
+ }
1243
+ // 需要在元素定义前设置的属性列表(Upgrade Property)
1244
+ /* -------------------- observedAttributes -------------------- */
1245
+ static get observedAttributes() {
1246
+ const e = this[Tt];
1247
+ return e != null && e.propMap ? Array.from(e.propMap.keys()) : [];
1248
+ }
1249
+ /* -------------------- $data -------------------- */
1250
+ get $data() {
1251
+ return P(this, nt);
1252
+ }
1253
+ set $data(e) {
1254
+ var s;
1255
+ G(e) || (e = {}), (s = P(this, q)) == null || s.call(this), N(this, C, kt).call(this, e), N(this, C, ut).call(this);
1256
+ }
1257
+ refresh() {
1258
+ N(this, C, ut).call(this);
1259
+ }
1260
+ /* -------------------- 生命周期 -------------------- */
1261
+ connectedCallback() {
1262
+ var i;
1263
+ const e = this.constructor;
1264
+ Array.isArray(e.upgradeProps) && N(this, C, jt).call(this, e.upgradeProps), N(this, C, Rt).call(this);
1265
+ const s = P(this, B);
1266
+ if ((s.className || s.tagName || "").split(" ").forEach((o) => o && this.classList.add(o)), N(this, C, zt).call(this), s.propMap && G(this.$data))
1267
+ for (const [o, c] of s.propMap) {
1268
+ const a = c.name;
1269
+ if (this.hasAttribute(o)) {
1270
+ const l = this.getAttribute(o), u = N(this, C, Ct).call(this, l, c.default, c.type);
1271
+ this.$data[a] = u;
1272
+ } else "default" in c && (this.$data[a] = c.default);
1273
+ }
1274
+ P(this, H) && O(this, U, je(
1275
+ P(this, H),
1276
+ P(this, Y),
1277
+ this
1278
+ )), this.mounted(), (i = this.onInit) == null || i.call(this);
1279
+ }
1280
+ disconnectedCallback() {
1281
+ var e;
1282
+ this.unmounted(), (e = P(this, q)) == null || e.call(this), O(this, q, void 0);
1283
+ }
1284
+ attributeChangedCallback(e, s, r) {
1285
+ var u;
1286
+ if (s === r || !G(this.$data)) return;
1287
+ const o = (u = P(this, B).propMap) == null ? void 0 : u.get(e);
1288
+ if (!o) return;
1289
+ const c = o.name, a = this.$data[c], l = N(this, C, Ct).call(this, r, o.default ?? a, o.type);
1290
+ this.$data[c] = l, O(this, z, !0), this.attributeChanged(e, a, l);
1291
+ }
1292
+ /* -------------------- 事件派发 -------------------- */
1293
+ emit(e, s, r) {
1294
+ this.dispatchEvent(
1295
+ new CustomEvent(e, {
1296
+ bubbles: !0,
1297
+ composed: !0,
1298
+ detail: s,
1299
+ ...r
1300
+ })
1301
+ );
1302
+ }
1303
+ /* -------------------- 钩子 -------------------- */
1304
+ onInit() {
1305
+ }
1306
+ created() {
1307
+ }
1308
+ mounted() {
1309
+ }
1310
+ beforeUpdate() {
1311
+ }
1312
+ updated() {
1313
+ }
1314
+ unmounted() {
1315
+ }
1316
+ attributeChanged(e, s, r) {
1317
+ }
1318
+ beforeAttributesUpdate() {
1319
+ }
1320
+ afterAttributesUpdate() {
1321
+ }
1322
+ }
1323
+ B = new WeakMap(), U = new WeakMap(), H = new WeakMap(), nt = new WeakMap(), Y = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), J = new WeakMap(), z = new WeakMap(), st = new WeakMap(), C = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
1324
+ jt = function(e) {
1325
+ for (const s of e)
1326
+ if (this.hasOwnProperty(s)) {
1327
+ const r = this[s];
1328
+ delete this[s], this[s] = r;
1329
+ }
1330
+ }, /* -------------------- 初始化 -------------------- */
1331
+ kt = function(e) {
1332
+ const { proxy: s, unobserve: r } = Me(e, (i) => {
1333
+ var o, c;
1334
+ if (i.type === "set") {
1335
+ const { key: a, newValue: l } = i, u = P(this, B), h = String(a), d = ((o = u.propMap) == null ? void 0 : o.get(
1336
+ h.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()
1337
+ )) || Array.from(((c = u.propMap) == null ? void 0 : c.values()) || []).find((E) => E.name === h);
1338
+ d != null && d.reflect && N(this, C, Bt).call(this, d, l);
1339
+ }
1340
+ this.emit("change", {
1341
+ source: "state",
1342
+ ...i
1343
+ }), N(this, C, ut).call(this);
1344
+ });
1345
+ O(this, nt, s), O(this, q, r);
1346
+ }, Bt = function(e, s) {
1347
+ const r = e.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
1348
+ if (e.type === "boolean")
1349
+ s ? this.setAttribute(r, "") : this.removeAttribute(r);
1350
+ else {
1351
+ const i = typeof s == "object" ? JSON.stringify(s) : String(s);
1352
+ this.setAttribute(r, i);
1353
+ }
1354
+ }, Gt = function(e) {
1355
+ e.ir && O(this, H, e.ir);
1356
+ }, Ct = function(e, s, r) {
1357
+ if (e === null)
1358
+ return r === "boolean" ? s ?? !1 : s;
1359
+ switch (r) {
1360
+ case "boolean":
1361
+ return !0;
1362
+ case "number": {
1363
+ const i = Number(e);
1364
+ return isNaN(i) ? s : i;
1365
+ }
1366
+ case "object":
1367
+ try {
1368
+ return JSON.parse(e);
1369
+ } catch {
1370
+ return s;
1371
+ }
1372
+ default:
1373
+ return e;
1374
+ }
1375
+ }, /* -------------------- 刷新调度 -------------------- */
1376
+ ut = function() {
1377
+ P(this, J) || !P(this, U) || (O(this, J, !0), queueMicrotask(() => {
1378
+ O(this, J, !1), N(this, C, qt).call(this);
1379
+ }));
1380
+ }, qt = function() {
1381
+ P(this, Z) || !this.isConnected || (O(this, Z, !0), P(this, z) && this.beforeAttributesUpdate(), this.beforeUpdate(), P(this, U).update(), this.updated(), P(this, z) && (this.afterAttributesUpdate(), O(this, z, !1)), O(this, Z, !1));
1382
+ }, zt = function() {
1383
+ const e = P(this, B);
1384
+ if (!e.styles) return;
1385
+ const s = P(this, Y);
1386
+ if (e.sheet && s instanceof ShadowRoot && "adoptedStyleSheets" in s) {
1387
+ s.adoptedStyleSheets.includes(e.sheet) || (s.adoptedStyleSheets = [...s.adoptedStyleSheets, e.sheet]);
1388
+ return;
1389
+ }
1390
+ const r = s instanceof ShadowRoot ? s : document.head, i = `solely-style-${e.tagName}`;
1391
+ if (!r.querySelector(`#${i}`)) {
1392
+ const o = document.createElement("style");
1393
+ o.id = i, o.textContent = e.styles, r.appendChild(o);
1394
+ }
1395
+ }, /* -------------------- created 保障 -------------------- */
1396
+ Rt = function() {
1397
+ P(this, st) || (O(this, st, !0), this.created());
1398
+ }, Lt = new WeakMap(), k(ft, "upgradeProps"), /* -------------------- DEV define 保护 -------------------- */
1399
+ T(ft, Lt, !1);
1400
+ const Be = Symbol.for("solely.manifest"), Kt = (n) => {
1401
+ const t = n;
1402
+ return (e) => {
1403
+ const { tagName: s } = t;
1404
+ if (customElements.get(s))
1405
+ return e;
1406
+ if (typeof t.template == "string" && !t.ir)
1407
+ try {
1408
+ const i = Le(t.template);
1409
+ t.ir = xe(i, {
1410
+ source: t.template,
1411
+ filename: s
1412
+ });
1413
+ } catch (i) {
1414
+ console.error(`[Compiler Error] <${s}>:`, i);
1415
+ }
1416
+ if (t.styles && !t.sheet && "CSSStyleSheet" in window)
1417
+ try {
1418
+ const i = new CSSStyleSheet();
1419
+ i.replaceSync(t.styles), t.sheet = i;
1420
+ } catch (i) {
1421
+ console.error(`[Style Error] <${s}>:`, i);
1422
+ }
1423
+ if (t.props && !t.propMap) {
1424
+ const i = /* @__PURE__ */ new Map();
1425
+ t.props.forEach((o) => {
1426
+ const c = typeof o == "string" ? { name: o } : o, a = c.name.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), l = a.replace(/-([a-z])/g, (u, h) => h.toUpperCase());
1427
+ i.set(a, { ...c, name: l });
1428
+ }), t.propMap = i;
1429
+ }
1430
+ class r extends e {
1431
+ }
1432
+ return r[Be] = t, customElements.define(s, r), r;
1433
+ };
1393
1434
  };
1394
- let U = null, Ht;
1395
- const Yt = new Promise((n) => {
1396
- Ht = n;
1435
+ let K = null, Ut;
1436
+ const Ht = new Promise((n) => {
1437
+ Ut = n;
1397
1438
  });
1398
- function tn(n) {
1399
- return U || (U = new ze(n), Ht(U), U);
1439
+ function Je(n) {
1440
+ return K || (K = new Ge(n), Ut(K), K);
1400
1441
  }
1401
- function $t() {
1402
- return U;
1442
+ function Et() {
1443
+ return K;
1403
1444
  }
1404
- class ze {
1445
+ class Ge {
1405
1446
  constructor(t) {
1406
- C(this, "routes");
1407
- C(this, "base");
1408
- C(this, "mode");
1409
- C(this, "beforeEachGuard");
1410
- C(this, "afterEachGuard");
1411
- C(this, "currentRoute", null);
1412
- C(this, "listeners", /* @__PURE__ */ new Set());
1413
- C(this, "isStarted", !1);
1447
+ k(this, "routes");
1448
+ k(this, "base");
1449
+ k(this, "mode");
1450
+ k(this, "beforeEachGuard");
1451
+ k(this, "afterEachGuard");
1452
+ k(this, "currentRoute", null);
1453
+ k(this, "listeners", /* @__PURE__ */ new Set());
1454
+ k(this, "isStarted", !1);
1414
1455
  this.routes = t.routes, this.base = t.base ?? "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
1415
1456
  }
1416
1457
  // --- 核心匹配逻辑 ---
@@ -1426,7 +1467,7 @@ class ze {
1426
1467
  query: o,
1427
1468
  fullPath: e,
1428
1469
  // 合并所有层级的 meta
1429
- meta: c.matched.reduce((l, h) => ({ ...l, ...h.config.meta || {} }), {})
1470
+ meta: c.matched.reduce((l, u) => ({ ...l, ...u.config.meta || {} }), {})
1430
1471
  };
1431
1472
  }
1432
1473
  return null;
@@ -1442,34 +1483,34 @@ class ze {
1442
1483
  params: {}
1443
1484
  };
1444
1485
  for (let a = 0; a < i.length; a++) {
1445
- const l = i[a], h = e[a];
1486
+ const l = i[a], u = e[a];
1446
1487
  if (l.startsWith(":")) {
1447
- if (!h) {
1488
+ if (!u) {
1448
1489
  c = !1;
1449
1490
  break;
1450
1491
  }
1451
- o[l.slice(1)] = h;
1492
+ o[l.slice(1)] = u;
1452
1493
  } else if (l === "*") {
1453
1494
  c = !0;
1454
1495
  break;
1455
- } else if (l !== h) {
1496
+ } else if (l !== u) {
1456
1497
  c = !1;
1457
1498
  break;
1458
1499
  }
1459
1500
  }
1460
1501
  if (c) {
1461
- const a = i.length, l = e.slice(a), h = { config: r, params: o };
1502
+ const a = i.length, l = e.slice(a), u = { config: r, params: o };
1462
1503
  if (l.length > 0 && r.children) {
1463
- const u = this.recursiveMatch(r.children, l);
1464
- if (u)
1504
+ const h = this.recursiveMatch(r.children, l);
1505
+ if (h)
1465
1506
  return {
1466
- matched: [h, ...u.matched],
1467
- params: { ...o, ...u.params }
1507
+ matched: [u, ...h.matched],
1508
+ params: { ...o, ...h.params }
1468
1509
  // 全局合并 params
1469
1510
  };
1470
1511
  } else if (l.length === 0 || i.includes("*"))
1471
1512
  return {
1472
- matched: [h],
1513
+ matched: [u],
1473
1514
  params: o
1474
1515
  };
1475
1516
  }
@@ -1574,28 +1615,28 @@ class ze {
1574
1615
  return this.currentRoute;
1575
1616
  }
1576
1617
  }
1577
- var Ue = Object.getOwnPropertyDescriptor, He = (n, t, e, s) => {
1578
- for (var r = s > 1 ? void 0 : s ? Ue(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1618
+ var qe = Object.getOwnPropertyDescriptor, ze = (n, t, e, s) => {
1619
+ for (var r = s > 1 ? void 0 : s ? qe(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1579
1620
  (o = n[i]) && (r = o(r) || r);
1580
1621
  return r;
1581
1622
  };
1582
- let gt = class extends mt {
1623
+ let dt = class extends ft {
1583
1624
  constructor() {
1584
1625
  super(...arguments);
1585
- C(this, "unsubscribe");
1586
- C(this, "level", 0);
1587
- C(this, "currentElement", null);
1588
- C(this, "currentTagName", null);
1589
- C(this, "routerAttrs", /* @__PURE__ */ new Set());
1590
- C(this, "prevPropKeys", /* @__PURE__ */ new Set());
1591
- C(this, "scheduled", !1);
1592
- C(this, "cache", /* @__PURE__ */ new Map());
1593
- C(this, "latestLoadId", 0);
1626
+ k(this, "unsubscribe");
1627
+ k(this, "level", 0);
1628
+ k(this, "currentElement", null);
1629
+ k(this, "currentTagName", null);
1630
+ k(this, "routerAttrs", /* @__PURE__ */ new Set());
1631
+ k(this, "prevPropKeys", /* @__PURE__ */ new Set());
1632
+ k(this, "scheduled", !1);
1633
+ k(this, "cache", /* @__PURE__ */ new Map());
1634
+ k(this, "latestLoadId", 0);
1594
1635
  }
1595
1636
  /* -------------------- 生命周期 -------------------- */
1596
1637
  async mounted() {
1597
1638
  this.detectLevel();
1598
- const t = await Yt;
1639
+ const t = await Ht;
1599
1640
  this.unsubscribe = t.listen(() => {
1600
1641
  this.scheduleLoad(t.getCurrentRoute());
1601
1642
  }), this.loadRoute(t.getCurrentRoute());
@@ -1613,7 +1654,7 @@ let gt = class extends mt {
1613
1654
  detectLevel() {
1614
1655
  let t = 0, e = this.parentElement;
1615
1656
  for (; e; )
1616
- e instanceof gt && t++, e = e.parentElement;
1657
+ e instanceof dt && t++, e = e.parentElement;
1617
1658
  this.level = t;
1618
1659
  }
1619
1660
  async loadRoute(t) {
@@ -1681,22 +1722,22 @@ let gt = class extends mt {
1681
1722
  this.currentElement ? this.contains(this.currentElement) && this.removeChild(this.currentElement) : t || (this.innerHTML = ""), this.currentElement = null, this.currentTagName = null, this.routerAttrs.clear(), this.prevPropKeys.clear();
1682
1723
  }
1683
1724
  };
1684
- gt = He([
1685
- zt({
1725
+ dt = ze([
1726
+ Kt({
1686
1727
  tagName: "router-view"
1687
1728
  // 注意:删除了 shadowDOM 配置,默认为 false
1688
1729
  })
1689
- ], gt);
1690
- const en = gt;
1691
- var Ye = Object.getOwnPropertyDescriptor, Je = (n, t, e, s) => {
1692
- for (var r = s > 1 ? void 0 : s ? Ye(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1730
+ ], dt);
1731
+ const Xe = dt;
1732
+ var Ke = Object.getOwnPropertyDescriptor, Ue = (n, t, e, s) => {
1733
+ for (var r = s > 1 ? void 0 : s ? Ke(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1693
1734
  (o = n[i]) && (r = o(r) || r);
1694
1735
  return r;
1695
1736
  };
1696
- let Mt = class extends mt {
1737
+ let At = class extends ft {
1697
1738
  constructor() {
1698
1739
  super(...arguments);
1699
- C(this, "_prefetched", !1);
1740
+ k(this, "_prefetched", !1);
1700
1741
  }
1701
1742
  set to(t) {
1702
1743
  this.$data.to = t, this.updateState();
@@ -1705,15 +1746,15 @@ let Mt = class extends mt {
1705
1746
  return this.$data.to;
1706
1747
  }
1707
1748
  async mounted() {
1708
- (await Yt).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1749
+ (await Ht).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1709
1750
  var r, i;
1710
- e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (i = $t()) == null || i.push(this.$data.to));
1751
+ e.defaultPrevented || e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0 || (r = e.target.closest("a")) != null && r.getAttribute("target") || (e.preventDefault(), (i = Et()) == null || i.push(this.$data.to));
1711
1752
  }), this.addEventListener("mouseenter", () => {
1712
1753
  this.prefetchRoute();
1713
1754
  }, { once: !0 });
1714
1755
  }
1715
1756
  updateState() {
1716
- const t = $t();
1757
+ const t = Et();
1717
1758
  if (!t) return;
1718
1759
  this.$data.href = t.resolve(this.$data.to);
1719
1760
  let e = !1;
@@ -1733,12 +1774,12 @@ let Mt = class extends mt {
1733
1774
  // 预加载路由的具体实现
1734
1775
  prefetchRoute() {
1735
1776
  if (this._prefetched || !this.hasAttribute("prefetch")) return;
1736
- const t = $t();
1777
+ const t = Et();
1737
1778
  t && typeof t.prefetch == "function" && (t.prefetch(this.$data.to), this._prefetched = !0);
1738
1779
  }
1739
1780
  };
1740
- Mt = Je([
1741
- zt({
1781
+ At = Ue([
1782
+ Kt({
1742
1783
  tagName: "router-link",
1743
1784
  // template 中 slot 包裹 label 作为 fallback:
1744
1785
  // 如果有子节点,显示子节点;如果没有,显示 label 属性的内容。
@@ -1771,32 +1812,32 @@ Mt = Je([
1771
1812
  // 注册所有支持的 props
1772
1813
  props: ["to", "active", "exact", "label", "custom", "activeClass", "prefetch"]
1773
1814
  })
1774
- ], Mt);
1775
- const nn = Mt;
1815
+ ], At);
1816
+ const Qe = At;
1776
1817
  export {
1777
1818
  y as ASTType,
1778
- mt as BaseElement,
1779
- zt as CustomElement,
1780
- Ge as IRRenderer,
1781
- pe as LIFECYCLE_ATTRS_MAP,
1782
- ze as Router,
1783
- nn as RouterLink,
1784
- en as RouterView,
1785
- $e as buildIR,
1786
- Xe as clearIRCache,
1787
- se as createFunction,
1788
- Ke as createRender,
1789
- tn as createRouter,
1790
- fe as genFunction,
1791
- $t as getRouter,
1792
- ge as isLifecycleKind,
1793
- H as isObject,
1794
- de as listeners,
1795
- me as mapAttrKeyToLifecycleKind,
1796
- Pe as observe,
1797
- Qe as parseHashUrl,
1798
- Ae as parseHtml,
1799
- Yt as routerReady,
1800
- ne as showTemplateError,
1819
+ ft as BaseElement,
1820
+ Kt as CustomElement,
1821
+ De as IRRenderer,
1822
+ de as LIFECYCLE_ATTRS_MAP,
1823
+ Ge as Router,
1824
+ Qe as RouterLink,
1825
+ Xe as RouterView,
1826
+ xe as buildIR,
1827
+ Ze as clearIRCache,
1828
+ ne as createFunction,
1829
+ je as createRender,
1830
+ Je as createRouter,
1831
+ he as genFunction,
1832
+ Et as getRouter,
1833
+ me as isLifecycleKind,
1834
+ G as isObject,
1835
+ fe as listeners,
1836
+ pe as mapAttrKeyToLifecycleKind,
1837
+ Me as observe,
1838
+ Ye as parseHashUrl,
1839
+ Le as parseHtml,
1840
+ Ht as routerReady,
1841
+ ee as showTemplateError,
1801
1842
  Ee as transformModel
1802
1843
  };