solely 0.1.0 → 0.1.2

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
- var Xt = Object.defineProperty;
2
- var Nt = (n) => {
3
- throw TypeError(n);
1
+ var te = Object.defineProperty;
2
+ var Nt = (s) => {
3
+ throw TypeError(s);
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 L = (n, t, e) => te(n, typeof t != "symbol" ? t + "" : t, e), wt = (n, t, e) => t.has(n) || Nt("Cannot " + e);
7
- var k = (n, t, e) => (wt(n, t, "read from private field"), e ? e.call(n) : t.get(n)), P = (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, t, e, s) => (wt(n, t, "write to private field"), s ? s.call(n, e) : t.set(n, e), e), N = (n, t, e) => (wt(n, t, "access private method"), e);
8
- const ee = {
5
+ var ee = (s, t, e) => t in s ? te(s, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[t] = e;
6
+ var C = (s, t, e) => ee(s, typeof t != "symbol" ? t + "" : t, e), vt = (s, t, e) => t.has(s) || Nt("Cannot " + e);
7
+ var R = (s, t, e) => (vt(s, t, "read from private field"), e ? e.call(s) : t.get(s)), N = (s, t, e) => t.has(s) ? Nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, e), _ = (s, t, e, n) => (vt(s, t, "write to private field"), n ? n.call(s, e) : t.set(s, e), e), O = (s, t, e) => (vt(s, t, "access private method"), e);
8
+ const se = {
9
9
  dark: {
10
10
  gutter: "#858585",
11
11
  errorLineBg: "#3c1e1e",
@@ -16,27 +16,27 @@ const ee = {
16
16
  exprLabel: "#a0a0a0",
17
17
  exprCode: "#5ddcff"
18
18
  }
19
- }, W = ee.dark;
20
- function lt(n) {
19
+ }, T = se.dark;
20
+ function lt(s) {
21
21
  let t = 0;
22
- for (let e = 0; e < n.length; ) {
23
- const s = n.codePointAt(e);
24
- if (n[e] === " ") {
22
+ for (let e = 0; e < s.length; ) {
23
+ const n = s.codePointAt(e);
24
+ if (s[e] === " ") {
25
25
  t += 4, e++;
26
26
  continue;
27
27
  }
28
- s >= 9472 && s <= 9599 || s > 255 ? t += 2 : t += 1, e += s > 65535 ? 2 : 1;
28
+ n >= 9472 && n <= 9599 || n > 255 ? t += 2 : t += 1, e += n > 65535 ? 2 : 1;
29
29
  }
30
30
  return t;
31
31
  }
32
- function Tt(n, t) {
33
- return (t ? "~" : "^").repeat(Math.max(1, n));
32
+ function _t(s, t) {
33
+ return (t ? "~" : "^").repeat(Math.max(1, s));
34
34
  }
35
- function ne(n, t = "", e, s = "component") {
35
+ function ne(s, t = "", e, n = "component") {
36
36
  var I;
37
- const r = (n == null ? void 0 : n.message) ?? String(n), i = `%cTemplate Error%c in <${s}> → ${r}`, o = [
38
- `color:${W.badgeFg};background:${W.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
39
- `color:${W.arrow};font-weight:bold;`
37
+ const r = (s == null ? void 0 : s.message) ?? String(s), i = `%cTemplate Error%c in <${n}> → ${r}`, o = [
38
+ `color:${T.badgeFg};background:${T.badgeBg};padding:4px 10px;border-radius:6px;font-weight:bold;`,
39
+ `color:${T.arrow};font-weight:bold;`
40
40
  ];
41
41
  if (!t || !(e != null && e.loc) || e.loc.length < 2) {
42
42
  console.error(i, ...o), e != null && e.expr && console.log(`Expression: ${e.expr.trim()}`);
@@ -51,108 +51,108 @@ function ne(n, t = "", e, s = "component") {
51
51
  console.error(`[Template Error] 行号 ${a} 超出范围`);
52
52
  return;
53
53
  }
54
- const h = a - 1, p = Math.max(0, h - 3), v = Math.min(u.length - 1, h + 3), m = String(v + 1).length, d = ((I = e.expr) == null ? void 0 : I.trim()) ?? "", C = d ? d.split(`
55
- `) : [], b = d ? Math.max(...C.map(lt)) : 0, $ = C.length > 1, S = `color:${W.gutter};`, R = `color:${W.arrow};font-weight:bold;`, f = `color:${W.gutter};`, w = `color:${W.errorLineFg};background:${W.errorLineBg};padding:0 4px;`, E = `color:${W.gutter};`, g = `color:${W.arrow};font-weight:bold;padding:0 4px;`;
54
+ const h = a - 1, p = Math.max(0, h - 3), v = Math.min(u.length - 1, h + 3), m = String(v + 1).length, d = ((I = e.expr) == null ? void 0 : I.trim()) ?? "", L = d ? d.split(`
55
+ `) : [], b = d ? Math.max(...L.map(lt)) : 0, $ = L.length > 1, S = `color:${T.gutter};`, A = `color:${T.arrow};font-weight:bold;`, f = `color:${T.gutter};`, w = `color:${T.errorLineFg};background:${T.errorLineBg};padding:0 4px;`, E = `color:${T.gutter};`, y = `color:${T.arrow};font-weight:bold;padding:0 4px;`;
56
56
  console.groupCollapsed(
57
57
  `${i} %c(Line:${a}, Col:${l})`,
58
58
  ...o,
59
- `color:${W.gutter};font-weight:normal;`
59
+ `color:${T.gutter};font-weight:normal;`
60
60
  );
61
61
  for (let x = p; x <= v; x++) {
62
- const M = u[x], O = String(x + 1).padStart(m, " ");
62
+ const M = u[x], P = String(x + 1).padStart(m, " ");
63
63
  if (!(x === h)) {
64
- console.log(`%c${O} │%c ${M}`, S, f);
64
+ console.log(`%c${P} │%c ${M}`, S, f);
65
65
  continue;
66
66
  }
67
- const j = M.slice(0, Math.max(0, l - 1)), F = lt(j), at = " ".repeat(m + 3), Zt = O.padEnd(m, " ");
68
- if (console.log(`%c${Zt} │%c ${M}`, R, w), $)
69
- for (let B = 0; B < C.length; B++) {
70
- const gt = C[B], et = h + B;
71
- let bt = 0;
67
+ const j = M.slice(0, Math.max(0, l - 1)), D = lt(j), at = " ".repeat(m + 3), Jt = P.padEnd(m, " ");
68
+ if (console.log(`%c${Jt} │%c ${M}`, A, w), $)
69
+ for (let B = 0; B < L.length; B++) {
70
+ const bt = L[B], et = h + B;
71
+ let wt = 0;
72
72
  if (B === 0)
73
- bt = F;
73
+ wt = D;
74
74
  else if (et < u.length) {
75
- const nt = u[et], ct = nt.search(/\S/), Qt = ct === -1 ? nt : nt.slice(0, ct);
76
- bt = lt(Qt);
75
+ const st = u[et], ct = st.search(/\S/), Xt = ct === -1 ? st : st.slice(0, ct);
76
+ wt = lt(Xt);
77
77
  }
78
- const Jt = Math.max(1, lt(gt)), Pt = Tt(Jt, !0), _t = at + " ".repeat(bt);
78
+ const Qt = Math.max(1, lt(bt)), Pt = _t(Qt, !0), Ot = at + " ".repeat(wt);
79
79
  if (B === 0)
80
- console.log(`%c${_t}%c${Pt}`, E, g);
80
+ console.log(`%c${Ot}%c${Pt}`, E, y);
81
81
  else if (et < u.length) {
82
- const nt = String(et + 1).padEnd(m, " "), ct = u[et];
83
- console.log(`%c${nt} │%c ${ct}`, R, w), console.log(`%c${_t}%c${Pt}`, E, g);
82
+ const st = String(et + 1).padEnd(m, " "), ct = u[et];
83
+ console.log(`%c${st} │%c ${ct}`, A, w), console.log(`%c${Ot}%c${Pt}`, E, y);
84
84
  }
85
85
  }
86
86
  else {
87
- const B = at + " ".repeat(F), gt = Tt(b || 1, !1);
88
- console.log(`%c${B}%c${gt}`, E, g);
87
+ const B = at + " ".repeat(D), bt = _t(b || 1, !1);
88
+ console.log(`%c${B}%c${bt}`, E, y);
89
89
  }
90
90
  }
91
91
  d && console.log(
92
92
  `%cExpression:%c ${d}`,
93
- `color:${W.exprLabel};font-weight:bold;`,
94
- `color:${W.exprCode};font-family:monospace;`
93
+ `color:${T.exprLabel};font-weight:bold;`,
94
+ `color:${T.exprCode};font-family:monospace;`
95
95
  ), console.groupEnd();
96
96
  }
97
- const vt = {};
98
- function se(n) {
99
- const t = n.map((e) => e.replace(/[',"]/g, "")).join(",");
100
- if (!vt[t]) {
101
- const e = n[n.length - 1];
97
+ const Et = {};
98
+ function re(s) {
99
+ const t = s.map((e) => e.replace(/[',"]/g, "")).join(",");
100
+ if (!Et[t]) {
101
+ const e = s[s.length - 1];
102
102
  if (e.trim() === "")
103
103
  throw new Error("Function body cannot be empty");
104
- if (ie(e))
104
+ if (oe(e))
105
105
  throw new Error("Input contains potentially dangerous code: " + e);
106
- vt[t] = new Function(...n);
106
+ Et[t] = new Function(...s);
107
107
  }
108
- return vt[t];
108
+ return Et[t];
109
109
  }
110
- const re = ["eval", "Function", "process", "require"];
111
- function ie(n) {
112
- return re.some((t) => new RegExp(`\\b${t}\\b`, "g").test(n));
110
+ const ie = ["eval", "Function", "process", "require"];
111
+ function oe(s) {
112
+ return ie.some((t) => new RegExp(`\\b${t}\\b`, "g").test(s));
113
113
  }
114
- function oe(n, t) {
115
- if (!(n != null && n.trim())) return "";
116
- if (/\{\{\{\s*.*?\s*\}\}\}/.test(n))
114
+ function ae(s, t) {
115
+ if (!(s != null && s.trim())) return "";
116
+ if (/\{\{\{\s*.*?\s*\}\}\}/.test(s))
117
117
  throw new Error("Illegal interpolation syntax: use {{ }} instead of {{{ }}}");
118
- return t === "template" ? n.replace(/\{\{\s*(.*?)\s*\}\}/g, (e, s) => `\${${s.trim()}}`) : n;
118
+ return t === "template" ? s.replace(/\{\{\s*(.*?)\s*\}\}/g, (e, n) => `\${${n.trim()}}`) : s;
119
119
  }
120
- function ae(n, t) {
121
- const e = (s) => s.endsWith(";") ? s : s + ";";
120
+ function ce(s, t) {
121
+ const e = (n) => n.endsWith(";") ? n : n + ";";
122
122
  switch (t) {
123
123
  case "template":
124
- return `return \`${n}\`;`;
124
+ return `return \`${s}\`;`;
125
125
  case "expression":
126
- return `return (${n});`;
126
+ return `return (${s});`;
127
127
  case "handler":
128
128
  case "lifecycle":
129
- return e(n);
129
+ return e(s);
130
130
  }
131
131
  }
132
- function ce(n) {
133
- if (!n.length) return { loopValues: "", loopIndices: "" };
134
- const t = n.map((s) => s.item).join(", "), e = n.map((s) => s.index).join(", ");
132
+ function le(s) {
133
+ if (!s.length) return { loopValues: "", loopIndices: "" };
134
+ const t = s.map((n) => n.item).join(", "), e = s.map((n) => n.index).join(", ");
135
135
  return {
136
136
  loopValues: `var [${t}] = loops.map(l => l.itmVal);`,
137
137
  loopIndices: `var [${e}] = loops.map(l => l.idxVal);`
138
138
  };
139
139
  }
140
- function le(n, t, e, s) {
141
- const r = n === "lifecycle" ? ["el", "loops"] : n === "handler" ? ["event", "loops"] : ["loops"], o = `
140
+ function ue(s, t, e, n) {
141
+ const r = s === "lifecycle" ? ["el", "loops"] : s === "handler" ? ["event", "loops"] : ["loops"], o = `
142
142
  const { $data } = this;
143
- ${n === "handler" ? "const { value, checked } = event?.target || {};" : ""}
143
+ ${s === "handler" ? "const { value, checked } = event?.target || {};" : ""}
144
144
  ${e}
145
- ${s}
145
+ ${n}
146
146
  ${t}
147
147
  `.replace(/^\s+|\s+$/gm, "");
148
148
  return r.push(o), r;
149
149
  }
150
- function ue(n, t, e) {
151
- if (!(n != null && n.trim())) return () => "";
152
- const s = oe(n, t), r = ae(s, t), { loopValues: i, loopIndices: o } = ce(e), c = le(t, r, i, o);
153
- return se(c);
150
+ function he(s, t, e) {
151
+ if (!(s != null && s.trim())) return () => "";
152
+ const n = ae(s, t), r = ce(n, t), { loopValues: i, loopIndices: o } = le(e), c = ue(t, r, i, o);
153
+ return re(c);
154
154
  }
155
- const he = /* @__PURE__ */ new Set([
155
+ const fe = /* @__PURE__ */ new Set([
156
156
  "onabort",
157
157
  "onautocomplete",
158
158
  "onautocompleteerror",
@@ -215,9 +215,9 @@ const he = /* @__PURE__ */ new Set([
215
215
  "ontoggle",
216
216
  "onvolumechange",
217
217
  "onwaiting"
218
- ]), z = (n) => {
219
- if (n === null || typeof n != "object") return !1;
220
- const t = Object.prototype.toString.call(n);
218
+ ]), Y = (s) => {
219
+ if (s === null || typeof s != "object") return !1;
220
+ const t = Object.prototype.toString.call(s);
221
221
  return ![
222
222
  "[object Function]",
223
223
  "[object Date]",
@@ -228,74 +228,74 @@ const he = /* @__PURE__ */ new Set([
228
228
  "[object WeakSet]"
229
229
  ].includes(t);
230
230
  };
231
- function Ze(n = window.location) {
231
+ function Je(s = window.location) {
232
232
  let t;
233
- typeof n == "string" ? t = new URL(n).hash : t = n.hash;
233
+ typeof s == "string" ? t = new URL(s).hash : t = s.hash;
234
234
  const e = t.split("?");
235
- let s = e[0];
235
+ let n = e[0];
236
236
  const r = e[1], i = {};
237
- return s = s.replace(/^#\/?/, ""), r && r.split("&").forEach((o) => {
237
+ return n = n.replace(/^#\/?/, ""), r && r.split("&").forEach((o) => {
238
238
  const [c, a] = o.split("=");
239
239
  c && a && (i[decodeURIComponent(c)] = decodeURIComponent(a));
240
240
  }), {
241
- path: s.split("/").filter(Boolean),
241
+ path: n.split("/").filter(Boolean),
242
242
  // 将路径分割成数组并过滤空字符串
243
243
  query: i
244
244
  // 查询参数对象
245
245
  };
246
246
  }
247
- 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 || {});
248
- const fe = {
247
+ var g = /* @__PURE__ */ ((s) => (s[s.Element = 0] = "Element", s[s.Text = 1] = "Text", s[s.Comment = 2] = "Comment", s[s.If = 3] = "If", s[s.ElseIf = 4] = "ElseIf", s[s.Else = 5] = "Else", s[s.For = 6] = "For", s[s.Conditional = 7] = "Conditional", s[s.Other = 99] = "Other", s))(g || {});
248
+ const de = {
249
249
  // 可选别名
250
250
  onMounted: "mounted",
251
251
  onUpdated: "updated",
252
252
  onUnmounted: "unmounted"
253
253
  };
254
- function de(n) {
255
- return fe[n] ?? null;
254
+ function pe(s) {
255
+ return de[s] ?? null;
256
256
  }
257
- function pe(n) {
258
- return n === "mounted" || n === "updated" || n === "unmounted";
257
+ function me(s) {
258
+ return s === "mounted" || s === "updated" || s === "unmounted";
259
259
  }
260
- const xt = Symbol.for("solely.irMeta"), tt = process.env.NODE_ENV !== "production", me = /\{\{.*?\}\}/;
260
+ const $t = Symbol.for("solely.irMeta"), tt = process.env.NODE_ENV !== "production", ge = /\{\{.*?\}\}/;
261
261
  class ye {
262
262
  constructor() {
263
- L(this, "compilers", /* @__PURE__ */ new Map());
263
+ C(this, "compilers", /* @__PURE__ */ new Map());
264
264
  }
265
265
  get(t = "anonymous") {
266
266
  let e = this.compilers.get(t);
267
- return e || (e = new ge(), this.compilers.set(t, e)), e;
267
+ return e || (e = new be(), this.compilers.set(t, e)), e;
268
268
  }
269
269
  clear(t) {
270
270
  var e;
271
271
  if (t)
272
272
  (e = this.compilers.get(t)) == null || e.clear(), this.compilers.delete(t);
273
273
  else {
274
- for (const s of this.compilers.values()) s.clear();
274
+ for (const n of this.compilers.values()) n.clear();
275
275
  this.compilers.clear();
276
276
  }
277
277
  }
278
278
  }
279
- const Dt = new ye();
280
- class ge {
279
+ const jt = new ye();
280
+ class be {
281
281
  constructor() {
282
- L(this, "cache", /* @__PURE__ */ new Map());
283
- L(this, "functions", []);
282
+ C(this, "cache", /* @__PURE__ */ new Map());
283
+ C(this, "functions", []);
284
284
  }
285
285
  // 缓存 key 生成优化:避免每次都重新分配数组
286
- makeCacheKey(t, e, s) {
287
- if (s.length === 0) return `${t}:${e}`;
288
- const r = s.map((i) => Object.keys(i).sort().join(",")).join(";");
286
+ makeCacheKey(t, e, n) {
287
+ if (n.length === 0) return `${t}:${e}`;
288
+ const r = n.map((i) => Object.keys(i).sort().join(",")).join(";");
289
289
  return `${t}:${e}:${r}`;
290
290
  }
291
- compile(t, e, s) {
291
+ compile(t, e, n) {
292
292
  const r = e == null ? void 0 : e.trim();
293
293
  if (!r) return 0;
294
- const i = this.makeCacheKey(t, r, s), o = this.cache.get(i);
294
+ const i = this.makeCacheKey(t, r, n), o = this.cache.get(i);
295
295
  if (o !== void 0) return o;
296
296
  let c;
297
297
  try {
298
- c = ue(r, t, s);
298
+ c = he(r, t, n);
299
299
  } catch (l) {
300
300
  tt && console.error(`[IR Compile Error] Type: ${t}, Expr: "${r}"`, l), c = () => "";
301
301
  }
@@ -312,29 +312,29 @@ class ge {
312
312
  this.cache.clear(), this.functions = [];
313
313
  }
314
314
  }
315
- function Vt(n) {
316
- const t = n[0];
317
- return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : pe(n) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
315
+ function Vt(s) {
316
+ const t = s[0];
317
+ return t === ":" ? { isDynamic: !0, type: "expression" } : t === "@" ? { isDynamic: !0, type: "handler" } : me(s) ? { isDynamic: !0, type: "lifecycle" } : { isDynamic: !1, type: null };
318
318
  }
319
- function be(n) {
320
- return n ? me.test(n) : !1;
319
+ function we(s) {
320
+ return s ? ge.test(s) : !1;
321
321
  }
322
- function $t(n, t, e) {
323
- tt && (n[xt] = { expr: t ?? "", loc: e ?? null });
322
+ function St(s, t, e) {
323
+ tt && (s[$t] = { expr: t ?? "", loc: e ?? null });
324
324
  }
325
- function we(n) {
326
- if (!n.attrs) return;
327
- const t = n.attrs.find((a) => a.key === "s-model");
325
+ function ve(s) {
326
+ if (!s.attrs) return;
327
+ const t = s.attrs.find((a) => a.key === "s-model");
328
328
  if (!t) return;
329
- 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";
330
- n.attrs = n.attrs.filter((a) => a !== t);
329
+ const e = "$data." + t.value.replace("this.", "").replace("$data.", ""), n = t.loc, r = (s.tag || "").toLowerCase(), i = s.attrs.find((a) => a.key === "type"), o = (i == null ? void 0 : i.value) ?? "text";
330
+ s.attrs = s.attrs.filter((a) => a !== t);
331
331
  const c = (a, l, u) => {
332
332
  var h;
333
- (h = n.attrs) == null || h.push({ key: a, value: l, role: u, loc: s });
333
+ (h = s.attrs) == null || h.push({ key: a, value: l, role: u, loc: n });
334
334
  };
335
335
  if (r === "input") {
336
336
  if (o === "checkbox") {
337
- const a = n.attrs.find((p) => p.key === "value"), l = a ? JSON.stringify(a.value) : '"on"', u = `Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;
337
+ const a = s.attrs.find((p) => p.key === "value"), l = a ? JSON.stringify(a.value) : '"on"', u = `Array.isArray(${e}) ? ${e}.includes(${l}) : ${e}`;
338
338
  c(":checked", u);
339
339
  const h = `
340
340
  const _v = ${l};
@@ -349,7 +349,7 @@ function we(n) {
349
349
  return;
350
350
  }
351
351
  if (o === "radio") {
352
- const a = n.attrs.find((u) => u.key === "value"), l = (a == null ? void 0 : a.value) ?? "null";
352
+ const a = s.attrs.find((u) => u.key === "value"), l = (a == null ? void 0 : a.value) ?? "null";
353
353
  c(":checked", `${e} == ${JSON.stringify(l)}`), c("@change", `if (checked) ${e} = ${JSON.stringify(l)}`, "model");
354
354
  return;
355
355
  }
@@ -361,7 +361,7 @@ function we(n) {
361
361
  return;
362
362
  }
363
363
  if (r === "select") {
364
- n.attrs.some((l) => l.key === "multiple") ? (c("updated", `
364
+ s.attrs.some((l) => l.key === "multiple") ? (c("updated", `
365
365
  const values = Array.isArray(${e}) ? ${e} : ${e} != null ? [${e}] : [];
366
366
  for (const opt of el.options) {
367
367
  opt.selected = values.includes(opt.value);
@@ -370,99 +370,99 @@ function we(n) {
370
370
  }
371
371
  c(":value", e), c("@input", `${e} = $event`, "model");
372
372
  }
373
- function ft(n, t, e, s = null) {
374
- if (!n.attrs || n.attrs.length === 0) return [];
373
+ function ft(s, t, e, n = null) {
374
+ if (!s.attrs || s.attrs.length === 0) return [];
375
375
  const r = [];
376
- for (const i of n.attrs) {
377
- if (s && s.has(i.key)) continue;
376
+ for (const i of s.attrs) {
377
+ if (n && n.has(i.key)) continue;
378
378
  const { key: o, value: c, role: a } = i, { isDynamic: l, type: u } = Vt(o);
379
379
  if (l && u) {
380
380
  const h = e.compile(u, c ?? "", t), p = { key: o, fid: h, dynamic: 1, role: a };
381
- $t(p, c, i.loc ?? n.loc), r.push(p);
381
+ St(p, c, i.loc ?? s.loc), r.push(p);
382
382
  } else
383
383
  r.push({ key: o, value: c, dynamic: 0, role: a });
384
384
  }
385
385
  return r;
386
386
  }
387
- function ve(n, t, e) {
387
+ function Ee(s, t, e) {
388
388
  var i, o, c, a, l, u;
389
- const s = { type: n.type, dynamic: 0 };
389
+ const n = { type: s.type, dynamic: 0 };
390
390
  let r = !1;
391
- switch (n.type === y.Text ? be(n.content) && (r = !0) : ((i = n.attrs) != null && i.some((h) => h.key === "s-model" || Vt(h.key).isDynamic) && (r = !0), n.type === y.For && (r = !0)), s.dynamic = r ? 1 : 0, n.type) {
392
- case y.Text: {
393
- const h = n.content ?? "";
394
- r ? (s.fid = e.compile("template", h, t), $t(s, h, n.loc)) : s.txt = h;
391
+ switch (s.type === g.Text ? we(s.content) && (r = !0) : ((i = s.attrs) != null && i.some((h) => h.key === "s-model" || Vt(h.key).isDynamic) && (r = !0), s.type === g.For && (r = !0)), n.dynamic = r ? 1 : 0, s.type) {
392
+ case g.Text: {
393
+ const h = s.content ?? "";
394
+ r ? (n.fid = e.compile("template", h, t), St(n, h, s.loc)) : n.txt = h;
395
395
  break;
396
396
  }
397
- case y.Element: {
398
- s.tag = n.tag, we(n), s.attrs = ft(n, t, e), n.children && (s.children = st(n.children, t, e));
397
+ case g.Element: {
398
+ n.tag = s.tag, ve(s), n.attrs = ft(s, t, e), s.children && (n.children = nt(s.children, t, e));
399
399
  break;
400
400
  }
401
- case y.For: {
402
- const h = (o = n.attrs) == null ? void 0 : o.find((d) => d.key === "each"), p = (h == null ? void 0 : h.value) ?? "";
403
- s.fid = e.compile("expression", p, t), s.item = ((a = (c = n.attrs) == null ? void 0 : c.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", s.index = ((u = (l = n.attrs) == null ? void 0 : l.find((d) => d.key === "index")) == null ? void 0 : u.value) ?? "index", $t(s, p, (h == null ? void 0 : h.loc) ?? n.loc);
401
+ case g.For: {
402
+ const h = (o = s.attrs) == null ? void 0 : o.find((d) => d.key === "each"), p = (h == null ? void 0 : h.value) ?? "";
403
+ n.fid = e.compile("expression", p, t), n.item = ((a = (c = s.attrs) == null ? void 0 : c.find((d) => d.key === "item")) == null ? void 0 : a.value) ?? "item", n.index = ((u = (l = s.attrs) == null ? void 0 : l.find((d) => d.key === "index")) == null ? void 0 : u.value) ?? "index", St(n, p, (h == null ? void 0 : h.loc) ?? s.loc);
404
404
  const v = /* @__PURE__ */ new Set(["each", "item", "index"]);
405
- s.attrs = ft(n, t, e, v);
406
- const m = [...t, { item: s.item, index: s.index }];
407
- n.children && (s.children = st(n.children, m, e));
405
+ n.attrs = ft(s, t, e, v);
406
+ const m = [...t, { item: n.item, index: n.index }];
407
+ s.children && (n.children = nt(s.children, m, e));
408
408
  break;
409
409
  }
410
- case y.If:
411
- case y.ElseIf:
412
- case y.Else: {
413
- 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));
410
+ case g.If:
411
+ case g.ElseIf:
412
+ case g.Else: {
413
+ tt && console.warn(`[IR] Orphaned conditional node found: ${g[s.type]}`), n.attrs = ft(s, t, e), s.children && (n.children = nt(s.children, t, e));
414
414
  break;
415
415
  }
416
- case y.Comment: {
417
- s.txt = n.content ?? "";
416
+ case g.Comment: {
417
+ n.txt = s.content ?? "";
418
418
  break;
419
419
  }
420
420
  }
421
- return s;
421
+ return n;
422
422
  }
423
- function st(n, t, e) {
423
+ function nt(s, t, e) {
424
424
  var i;
425
- const s = [];
425
+ const n = [];
426
426
  let r = 0;
427
- for (; r < n.length; ) {
428
- const o = n[r];
429
- if (o.type === y.If) {
427
+ for (; r < s.length; ) {
428
+ const o = s[r];
429
+ if (o.type === g.If) {
430
430
  const c = [];
431
431
  let a = r;
432
- for (; a < n.length; ) {
433
- const l = n[a], u = l.type;
434
- if (u !== y.If && u !== y.ElseIf && u !== y.Else)
432
+ for (; a < s.length; ) {
433
+ const l = s[a], u = l.type;
434
+ if (u !== g.If && u !== g.ElseIf && u !== g.Else)
435
435
  break;
436
436
  let h = null, p = "";
437
- if (u !== y.Else) {
438
- const C = (i = l.attrs) == null ? void 0 : i.find(
437
+ if (u !== g.Else) {
438
+ const L = (i = l.attrs) == null ? void 0 : i.find(
439
439
  (b) => b.key === "test" || b.key === "condition"
440
440
  );
441
- p = (C == null ? void 0 : C.value) ?? "false", h = e.compile("expression", p, t);
441
+ p = (L == null ? void 0 : L.value) ?? "false", h = e.compile("expression", p, t);
442
442
  }
443
- const v = l.children ? st(l.children, t, e) : [], d = ft(l, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
443
+ const v = l.children ? nt(l.children, t, e) : [], d = ft(l, t, e, /* @__PURE__ */ new Set(["test", "condition"]));
444
444
  if (c.push({
445
445
  condFid: h,
446
446
  children: v,
447
447
  attrs: d.length > 0 ? d : void 0,
448
- [xt]: tt ? { expr: p, loc: l.loc } : void 0
449
- }), a++, u === y.Else) break;
448
+ [$t]: tt ? { expr: p, loc: l.loc } : void 0
449
+ }), a++, u === g.Else) break;
450
450
  }
451
- s.push({
452
- type: y.Conditional,
451
+ n.push({
452
+ type: g.Conditional,
453
453
  dynamic: 1,
454
454
  branches: c,
455
- ...tt && { [xt]: { loc: o.loc } }
455
+ ...tt && { [$t]: { loc: o.loc } }
456
456
  }), r = a;
457
457
  } else
458
- s.push(ve(o, t, e)), r++;
458
+ n.push(Ee(o, t, e)), r++;
459
459
  }
460
- return s;
460
+ return n;
461
461
  }
462
- function Ee(n, t = {}) {
463
- const { filename: e = "anonymous", source: s } = t, r = Dt.get(e);
462
+ function xe(s, t = {}) {
463
+ const { filename: e = "anonymous", source: n } = t, r = jt.get(e);
464
464
  r.clear();
465
- const i = performance.now(), o = st(n, [], r), c = performance.now(), a = r.getStats(), l = o.filter((h) => h.dynamic === 1).length, u = {
465
+ const i = performance.now(), o = nt(s, [], r), c = performance.now(), a = r.getStats(), l = o.filter((h) => h.dynamic === 1).length, u = {
466
466
  type: "root",
467
467
  version: "1.1.0",
468
468
  // Bump version
@@ -477,19 +477,19 @@ function Ee(n, t = {}) {
477
477
  },
478
478
  metadata: {
479
479
  compiledAt: (/* @__PURE__ */ new Date()).toISOString(),
480
- astSize: n.length,
480
+ astSize: s.length,
481
481
  filename: e,
482
- ...s && { source: s }
482
+ ...n && { source: n }
483
483
  }
484
484
  };
485
485
  return tt && console.log(
486
486
  `[IRBuilder] ${e} | ${(c - i).toFixed(2)}ms | Nodes: ${o.length} | Fns: ${a.total}`
487
487
  ), u;
488
488
  }
489
- function Je(n) {
490
- Dt.clear(n);
489
+ function Qe(s) {
490
+ jt.clear(s);
491
491
  }
492
- const xe = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, $e = /* @__PURE__ */ new Set([
492
+ const $e = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, Se = /* @__PURE__ */ new Set([
493
493
  "area",
494
494
  "base",
495
495
  "br",
@@ -504,18 +504,18 @@ const xe = /<\/?([A-Za-z][A-Za-z0-9\-\:]*)[>\s\/]/, $e = /* @__PURE__ */ new Set
504
504
  "source",
505
505
  "track",
506
506
  "wbr"
507
- ]), Se = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
508
- function ke(n, t) {
507
+ ]), ke = /\s*([^\s"'/>=]+)(?:=(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gs;
508
+ function Ce(s, t) {
509
509
  const e = [];
510
- let s;
511
- const r = n.replace(/^\s*[^\s"'/>]+/, ""), i = n.length - r.length;
512
- for (; (s = Se.exec(r)) !== null; ) {
513
- const o = s[1];
510
+ let n;
511
+ const r = s.replace(/^\s*[^\s"'/>]+/, ""), i = s.length - r.length;
512
+ for (; (n = ke.exec(r)) !== null; ) {
513
+ const o = n[1];
514
514
  if (!o) continue;
515
- const c = s[2] ?? s[3] ?? s[4] ?? "";
515
+ const c = n[2] ?? n[3] ?? n[4] ?? "";
516
516
  let a = o;
517
- he.has(o) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = de(a) || a;
518
- const l = s[0], u = l.indexOf("=");
517
+ fe.has(o) && (a = a.replace(/^on/, "@")), a !== "s-model" && (a = a.replace(/^on-/, "@").replace(/^s-/, ":")), a = pe(a) || a;
518
+ const l = n[0], u = l.indexOf("=");
519
519
  let h;
520
520
  if (u === -1)
521
521
  h = l.indexOf(o) + o.length;
@@ -533,68 +533,68 @@ function ke(n, t) {
533
533
  h = $;
534
534
  }
535
535
  }
536
- let p = s.index + h + i;
537
- const m = n.slice(0, p).split(`
538
- `), d = t[0] + m.length - 1, C = m.length > 1 ? m[m.length - 1].length + 1 : t[1] + p;
539
- e.push({ key: a, value: c, loc: [d, C] });
536
+ let p = n.index + h + i;
537
+ const m = s.slice(0, p).split(`
538
+ `), d = t[0] + m.length - 1, L = m.length > 1 ? m[m.length - 1].length + 1 : t[1] + p;
539
+ e.push({ key: a, value: c, loc: [d, L] });
540
540
  }
541
541
  return e;
542
542
  }
543
- function Ce(n, t) {
543
+ function Re(s, t) {
544
544
  var o;
545
- const e = ((o = (n.match(xe) || [])[1]) == null ? void 0 : o.toLowerCase()) ?? "", s = ke(n, t);
545
+ const e = ((o = (s.match($e) || [])[1]) == null ? void 0 : o.toLowerCase()) ?? "", n = Ce(s, t);
546
546
  return {
547
547
  type: {
548
- for: y.For,
549
- if: y.If,
550
- elseif: y.ElseIf,
551
- else: y.Else
552
- }[e] ?? y.Element,
548
+ for: g.For,
549
+ if: g.If,
550
+ elseif: g.ElseIf,
551
+ else: g.Else
552
+ }[e] ?? g.Element,
553
553
  tag: e,
554
554
  loc: t,
555
555
  children: [],
556
- attrs: s
556
+ attrs: n
557
557
  };
558
558
  }
559
- function Re(n, t) {
560
- const e = n.length;
561
- if (n.startsWith("!--", t)) {
562
- const o = n.indexOf("-->", t + 3);
559
+ function Le(s, t) {
560
+ const e = s.length;
561
+ if (s.startsWith("!--", t)) {
562
+ const o = s.indexOf("-->", t + 3);
563
563
  return o === -1 ? -1 : o + 2;
564
564
  }
565
- if (n.startsWith("![CDATA[", t)) {
566
- const o = n.indexOf("]]>", t + 8);
565
+ if (s.startsWith("![CDATA[", t)) {
566
+ const o = s.indexOf("]]>", t + 8);
567
567
  return o === -1 ? -1 : o + 2;
568
568
  }
569
- if (n[t] === "!")
570
- return n.indexOf(">", t + 1);
571
- if (n[t] === "?") {
572
- const o = n.indexOf("?>", t + 1);
569
+ if (s[t] === "!")
570
+ return s.indexOf(">", t + 1);
571
+ if (s[t] === "?") {
572
+ const o = s.indexOf("?>", t + 1);
573
573
  return o === -1 ? -1 : o + 1;
574
574
  }
575
- let s = !1, r = !1, i = t;
575
+ let n = !1, r = !1, i = t;
576
576
  for (; i < e; ) {
577
- const o = n[i];
577
+ const o = s[i];
578
578
  if (o === "'" && !r)
579
- s = !s;
580
- else if (o === '"' && !s)
579
+ n = !n;
580
+ else if (o === '"' && !n)
581
581
  r = !r;
582
- else if (o === ">" && !s && !r)
582
+ else if (o === ">" && !n && !r)
583
583
  return i;
584
584
  i++;
585
585
  }
586
586
  return -1;
587
587
  }
588
- function Le(n) {
588
+ function Ae(s) {
589
589
  const t = [];
590
- if (!n) return [];
591
- const e = [], s = [], r = () => {
590
+ if (!s) return [];
591
+ const e = [], n = [], r = () => {
592
592
  var l;
593
593
  return e.length === 0 ? t : (l = e[e.length - 1]).children || (l.children = []);
594
594
  };
595
595
  let i = 0;
596
- const o = n.length, c = [0];
597
- for (let l = 0; l < o; l++) n[l] === `
596
+ const o = s.length, c = [0];
597
+ for (let l = 0; l < o; l++) s[l] === `
598
598
  ` && c.push(l + 1);
599
599
  function a(l) {
600
600
  let u = 0;
@@ -603,15 +603,15 @@ function Le(n) {
603
603
  return [u + 1, l - c[u] + 1];
604
604
  }
605
605
  for (; i < o; ) {
606
- const l = n.indexOf("<", i);
606
+ const l = s.indexOf("<", i);
607
607
  if (l === -1 || l > i) {
608
- const S = n.substring(i, l === -1 ? void 0 : l), R = S.trim();
609
- if (R) {
610
- const f = S.indexOf(R), w = i + f, E = a(w);
608
+ const S = s.substring(i, l === -1 ? void 0 : l), A = S.trim();
609
+ if (A) {
610
+ const f = S.indexOf(A), w = i + f, E = a(w);
611
611
  r().push({
612
- type: y.Text,
612
+ type: g.Text,
613
613
  tag: "text",
614
- content: R,
614
+ content: A,
615
615
  loc: E,
616
616
  children: []
617
617
  });
@@ -619,11 +619,11 @@ function Le(n) {
619
619
  if (l === -1) break;
620
620
  i = l;
621
621
  }
622
- const u = Re(n, i + 1);
622
+ const u = Le(s, i + 1);
623
623
  if (u === -1) {
624
- const S = n.substring(i);
624
+ const S = s.substring(i);
625
625
  S.trim() && r().push({
626
- type: y.Text,
626
+ type: g.Text,
627
627
  tag: "text",
628
628
  content: S.trim(),
629
629
  children: [],
@@ -631,10 +631,10 @@ function Le(n) {
631
631
  });
632
632
  break;
633
633
  }
634
- const h = n.substring(i, u + 1), p = r(), v = a(i);
634
+ const h = s.substring(i, u + 1), p = r(), v = a(i);
635
635
  if (h.startsWith("<!--")) {
636
636
  p.push({
637
- type: y.Comment,
637
+ type: g.Comment,
638
638
  tag: "comment",
639
639
  content: h.slice(4, -3),
640
640
  loc: v,
@@ -644,7 +644,7 @@ function Le(n) {
644
644
  }
645
645
  if (h.startsWith("<![CDATA[")) {
646
646
  p.push({
647
- type: y.Text,
647
+ type: g.Text,
648
648
  tag: "text",
649
649
  content: h.slice(9, -3),
650
650
  loc: v,
@@ -654,7 +654,7 @@ function Le(n) {
654
654
  }
655
655
  if (h.startsWith("<!") && !h.startsWith("<!--")) {
656
656
  p.push({
657
- type: y.Comment,
657
+ type: g.Comment,
658
658
  tag: "comment",
659
659
  content: h.slice(2, -1),
660
660
  loc: v,
@@ -664,7 +664,7 @@ function Le(n) {
664
664
  }
665
665
  if (h.startsWith("<?")) {
666
666
  p.push({
667
- type: y.Comment,
667
+ type: g.Comment,
668
668
  tag: "comment",
669
669
  content: h.slice(2, -2),
670
670
  loc: v,
@@ -673,7 +673,7 @@ function Le(n) {
673
673
  continue;
674
674
  }
675
675
  if (h.startsWith("</")) {
676
- const S = s.pop();
676
+ const S = n.pop();
677
677
  for (; e.length > 0; ) {
678
678
  if ((e[e.length - 1].tag || "").toLowerCase() === (S == null ? void 0 : S.toLowerCase())) {
679
679
  e.pop();
@@ -684,25 +684,25 @@ function Le(n) {
684
684
  i = u + 1;
685
685
  continue;
686
686
  }
687
- const m = Ce(h, v);
687
+ const m = Re(h, v);
688
688
  p.push(m);
689
- const d = m.tag || "", C = d.toLowerCase().startsWith("script"), b = d.toLowerCase().startsWith("style"), $ = h.endsWith("/>") || $e.has(d.toLowerCase());
690
- if ((C || b) && !$) {
691
- const S = `</${d}>`, R = n.toLowerCase().indexOf(S, u + 1);
692
- if (R !== -1) {
693
- const f = n.substring(u + 1, R);
689
+ const d = m.tag || "", L = d.toLowerCase().startsWith("script"), b = d.toLowerCase().startsWith("style"), $ = h.endsWith("/>") || Se.has(d.toLowerCase());
690
+ if ((L || b) && !$) {
691
+ const S = `</${d}>`, A = s.toLowerCase().indexOf(S, u + 1);
692
+ if (A !== -1) {
693
+ const f = s.substring(u + 1, A);
694
694
  f.length && m.children.push({
695
- type: y.Text,
695
+ type: g.Text,
696
696
  tag: "text",
697
697
  content: f,
698
698
  loc: a(u + 1),
699
699
  children: []
700
- }), i = R + S.length;
700
+ }), i = A + S.length;
701
701
  continue;
702
702
  } else {
703
- const f = n.substring(u + 1);
703
+ const f = s.substring(u + 1);
704
704
  f.length && m.children.push({
705
- type: y.Text,
705
+ type: g.Text,
706
706
  tag: "text",
707
707
  content: f,
708
708
  loc: a(u + 1),
@@ -711,141 +711,141 @@ function Le(n) {
711
711
  continue;
712
712
  }
713
713
  }
714
- !$ && m.type !== y.Text && m.type !== y.Comment && (e.push(m), s.push(d)), i = u + 1;
714
+ !$ && m.type !== g.Text && m.type !== g.Comment && (e.push(m), n.push(d)), i = u + 1;
715
715
  }
716
716
  return t;
717
717
  }
718
718
  const pt = Symbol("solely.raw");
719
- function Bt(n) {
720
- const t = n && n[pt];
721
- return t ? Bt(t) : n;
719
+ function Bt(s) {
720
+ const t = s && s[pt];
721
+ return t ? Bt(t) : s;
722
722
  }
723
- function Ae(n) {
724
- return !!(n && n[pt]);
723
+ function Ie(s) {
724
+ return !!(s && s[pt]);
725
725
  }
726
- const St = (n, t, e = /* @__PURE__ */ new WeakMap()) => {
727
- if (n === t) return !0;
728
- if (n == null || t == null || typeof n != "object" || typeof t != "object") return n === t;
729
- if (Array.isArray(n) && Array.isArray(t)) {
730
- if (n.length !== t.length) return !1;
731
- if (e.has(n)) return e.get(n) === t;
732
- e.set(n, t);
733
- for (let r = 0; r < n.length; r++)
734
- if (!St(n[r], t[r], e)) return !1;
726
+ const kt = (s, t, e = /* @__PURE__ */ new WeakMap()) => {
727
+ if (s === t) return !0;
728
+ if (s == null || t == null || typeof s != "object" || typeof t != "object") return s === t;
729
+ if (Array.isArray(s) && Array.isArray(t)) {
730
+ if (s.length !== t.length) return !1;
731
+ if (e.has(s)) return e.get(s) === t;
732
+ e.set(s, t);
733
+ for (let r = 0; r < s.length; r++)
734
+ if (!kt(s[r], t[r], e)) return !1;
735
735
  return !0;
736
736
  }
737
- if (Array.isArray(n) !== Array.isArray(t)) return !1;
738
- if (e.has(n)) return e.get(n) === t;
739
- e.set(n, t);
740
- const s = Reflect.ownKeys(n);
741
- if (s.length !== Reflect.ownKeys(t).length) return !1;
742
- for (const r of s)
743
- if (!Reflect.has(t, r) || !St(n[r], t[r], e)) return !1;
737
+ if (Array.isArray(s) !== Array.isArray(t)) return !1;
738
+ if (e.has(s)) return e.get(s) === t;
739
+ e.set(s, t);
740
+ const n = Reflect.ownKeys(s);
741
+ if (n.length !== Reflect.ownKeys(t).length) return !1;
742
+ for (const r of n)
743
+ if (!Reflect.has(t, r) || !kt(s[r], t[r], e)) return !1;
744
744
  return !0;
745
745
  };
746
- function Ie(n, t, e = {}) {
747
- const { throttle: s = 0, onBatch: r, immediate: i = !1, deepCompare: o = !1 } = e;
746
+ function Me(s, t, e = {}) {
747
+ const { throttle: n = 0, onBatch: r, immediate: i = !1, deepCompare: o = !1 } = e;
748
748
  let c = !0, a = null, l = [], u = 0;
749
749
  const h = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), v = /* @__PURE__ */ new WeakMap(), m = Array.isArray(e.filter) ? e.filter : e.filter ? [e.filter] : [], d = (f) => {
750
750
  if (m.length === 0) return !0;
751
751
  const w = f.map(String).join(".");
752
752
  return m.some((E) => {
753
753
  if (E === "") return !0;
754
- const g = E.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
755
- return new RegExp(`^${g}$`).test(w);
754
+ const y = E.replace(/\./g, "\\.").replace(/\*\*/g, "(.+)").replace(/\*/g, "[^.]+").replace(/\[\d+\]/g, "\\[\\d+\\]");
755
+ return new RegExp(`^${y}$`).test(w);
756
756
  });
757
- }, C = (f) => {
757
+ }, L = (f) => {
758
758
  const w = [];
759
759
  let E = f;
760
760
  for (; E; ) {
761
- const g = p.get(E);
762
- if (!g || g.key == null) break;
763
- w.unshift(g.key), E = g.parent;
761
+ const y = p.get(E);
762
+ if (!y || y.key == null) break;
763
+ w.unshift(y.key), E = y.parent;
764
764
  }
765
765
  return w;
766
766
  }, b = (f, w) => {
767
767
  if (!c) return;
768
- const E = C(f);
768
+ const E = L(f);
769
769
  if (!d(E)) return;
770
- const g = { ...w, path: E };
771
- s > 0 ? (l.push(g), a || (a = setTimeout(() => {
770
+ const y = { ...w, path: E };
771
+ n > 0 ? (l.push(y), a || (a = setTimeout(() => {
772
772
  const I = [...l];
773
773
  l = [], a = null, c && (r == null || r(I), I.forEach(t));
774
- }, s))) : (r == null || r([g]), t(g));
774
+ }, n))) : (r == null || r([y]), t(y));
775
775
  }, $ = (f, w) => {
776
776
  const E = {};
777
- return ["push", "pop", "shift", "unshift", "splice"].forEach((g) => {
778
- E[g] = function(...I) {
777
+ return ["push", "pop", "shift", "unshift", "splice"].forEach((y) => {
778
+ E[y] = function(...I) {
779
779
  u++;
780
- const x = f[g].apply(f, I);
781
- if (u--, g === "push")
780
+ const x = f[y].apply(f, I);
781
+ if (u--, y === "push")
782
782
  b(w, { type: "array-push", index: f.length - I.length, values: I });
783
- else if (g === "unshift")
783
+ else if (y === "unshift")
784
784
  b(w, { type: "array-push", index: 0, values: I });
785
- else if (g === "pop")
785
+ else if (y === "pop")
786
786
  b(w, { type: "array-splice", index: f.length, deleteCount: 1, insert: [] });
787
- else if (g === "shift")
787
+ else if (y === "shift")
788
788
  b(w, { type: "array-splice", index: 0, deleteCount: 1, insert: [] });
789
- else if (g === "splice") {
790
- const [M, O, ...T] = I;
791
- b(w, { type: "array-splice", index: M, deleteCount: O, insert: T });
789
+ else if (y === "splice") {
790
+ const [M, P, ...W] = I;
791
+ b(w, { type: "array-splice", index: M, deleteCount: P, insert: W });
792
792
  }
793
793
  return x;
794
794
  };
795
- }), ["sort", "reverse", "fill", "copyWithin"].forEach((g) => {
796
- E[g] = function(...I) {
795
+ }), ["sort", "reverse", "fill", "copyWithin"].forEach((y) => {
796
+ E[y] = function(...I) {
797
797
  u++;
798
- const x = f[g].apply(f, I);
799
- return u--, b(w, { type: "array-reset", method: g }), x;
798
+ const x = f[y].apply(f, I);
799
+ return u--, b(w, { type: "array-reset", method: y }), x;
800
800
  };
801
- }), ["indexOf", "lastIndexOf", "includes"].forEach((g) => {
802
- E[g] = function(I, ...x) {
803
- let M = f[g].apply(f, [I, ...x]);
804
- return (M === -1 || M === !1) && Ae(I) && (M = f[g].apply(f, [Bt(I), ...x])), M;
801
+ }), ["indexOf", "lastIndexOf", "includes"].forEach((y) => {
802
+ E[y] = function(I, ...x) {
803
+ let M = f[y].apply(f, [I, ...x]);
804
+ return (M === -1 || M === !1) && Ie(I) && (M = f[y].apply(f, [Bt(I), ...x])), M;
805
805
  };
806
806
  }), E;
807
807
  }, S = (f, w, E) => {
808
808
  if (!Object.isExtensible(f) || f[pt])
809
809
  return f;
810
- const g = h.get(f);
811
- if (g)
812
- return p.set(g, { parent: w, key: E }), g;
810
+ const y = h.get(f);
811
+ if (y)
812
+ return p.set(y, { parent: w, key: E }), y;
813
813
  const I = {
814
- get(M, O, T) {
815
- if (O === pt) return M;
814
+ get(M, P, W) {
815
+ if (P === pt) return M;
816
816
  if (Array.isArray(M)) {
817
- const F = v.get(x);
818
- if (F && Object.prototype.hasOwnProperty.call(F, O))
819
- return Reflect.get(F, O, T);
817
+ const D = v.get(x);
818
+ if (D && Object.prototype.hasOwnProperty.call(D, P))
819
+ return Reflect.get(D, P, W);
820
820
  }
821
- const j = Reflect.get(M, O, T);
822
- return typeof O == "symbol" ? j : z(j) ? S(j, x, O) : j;
821
+ const j = Reflect.get(M, P, W);
822
+ return typeof P == "symbol" ? j : Y(j) ? S(j, x, P) : j;
823
823
  },
824
- set(M, O, T, j) {
825
- const F = M[O];
826
- if (o ? St(F, T) : F === T) return !0;
827
- const at = Reflect.set(M, O, T, j);
828
- return u === 0 && (Array.isArray(F) && Array.isArray(T) ? b(x, { type: "array-replace", oldValue: F, newValue: T }) : b(x, { type: "set", key: O, newValue: T, oldValue: F })), at;
824
+ set(M, P, W, j) {
825
+ const D = M[P];
826
+ if (o ? kt(D, W) : D === W) return !0;
827
+ const at = Reflect.set(M, P, W, j);
828
+ return u === 0 && (Array.isArray(D) && Array.isArray(W) ? b(x, { type: "array-replace", oldValue: D, newValue: W }) : b(x, { type: "set", key: P, newValue: W, oldValue: D })), at;
829
829
  },
830
- deleteProperty(M, O) {
831
- if (!Reflect.has(M, O)) return !1;
832
- const T = M[O], j = Reflect.deleteProperty(M, O);
833
- return j && u === 0 && b(x, { type: "delete", key: O, oldValue: T }), j;
830
+ deleteProperty(M, P) {
831
+ if (!Reflect.has(M, P)) return !1;
832
+ const W = M[P], j = Reflect.deleteProperty(M, P);
833
+ return j && u === 0 && b(x, { type: "delete", key: P, oldValue: W }), j;
834
834
  }
835
835
  }, x = new Proxy(f, I);
836
836
  return h.set(f, x), p.set(x, { parent: w, key: E }), Array.isArray(f) && v.set(x, $(f, x)), x;
837
- }, R = S(n, null, null);
837
+ }, A = S(s, null, null);
838
838
  if (i) {
839
- const f = (w, E, g = /* @__PURE__ */ new WeakSet()) => {
840
- !z(w) || g.has(w) || (g.add(w), Reflect.ownKeys(w).forEach((I) => {
839
+ const f = (w, E, y = /* @__PURE__ */ new WeakSet()) => {
840
+ !Y(w) || y.has(w) || (y.add(w), Reflect.ownKeys(w).forEach((I) => {
841
841
  const x = w[I];
842
- b(E, { type: "set", key: I, newValue: x, oldValue: void 0 }), z(x) && f(x, S(x, E, I), g);
842
+ b(E, { type: "set", key: I, newValue: x, oldValue: void 0 }), Y(x) && f(x, S(x, E, I), y);
843
843
  }));
844
844
  };
845
- f(n, R);
845
+ f(s, A);
846
846
  }
847
847
  return {
848
- proxy: R,
848
+ proxy: A,
849
849
  unobserve: () => {
850
850
  c = !1, l = [], a && clearTimeout(a);
851
851
  },
@@ -855,77 +855,79 @@ function Ie(n, t, e = {}) {
855
855
  };
856
856
  }
857
857
  const Wt = Symbol.for("solely.manifest");
858
- var q, H, Z, rt, J, K, Q, X, Y, it, ot, U, A, kt, qt, Ct, Rt, dt, Kt, Yt, Lt, Ot;
859
- const D = class D extends HTMLElement {
858
+ var q, H, Z, rt, J, G, Q, X, K, it, ot, z, k, qt, Ct, Gt, Rt, Lt, dt, Kt, zt, At, Mt;
859
+ const F = class F extends HTMLElement {
860
860
  /* -------------------- 构造 -------------------- */
861
861
  constructor(e = {}) {
862
- var r;
862
+ var i;
863
863
  super();
864
- P(this, A);
865
- P(this, q);
866
- P(this, H);
867
- P(this, Z);
868
- P(this, rt);
869
- P(this, J);
870
- P(this, K);
871
- P(this, Q, !1);
872
- P(this, X, !1);
873
- P(this, Y, !1);
874
- P(this, it, !1);
875
- _(this, q, this.constructor[Wt] || {});
876
- const s = k(this, q);
877
- _(this, J, (r = s.shadowDOM) != null && r.use ? this.attachShadow({ mode: s.shadowDOM.mode || "open" }) : this), N(this, A, kt).call(this, e), N(this, A, qt).call(this, s), queueMicrotask(() => N(this, A, Lt).call(this));
864
+ N(this, k);
865
+ N(this, q);
866
+ N(this, H);
867
+ N(this, Z);
868
+ N(this, rt);
869
+ N(this, J);
870
+ N(this, G);
871
+ N(this, Q, !1);
872
+ N(this, X, !1);
873
+ N(this, K, !1);
874
+ N(this, it, !1);
875
+ const n = this.constructor;
876
+ _(this, q, n[Wt] || { tagName: "base-element" });
877
+ const r = R(this, q);
878
+ _(this, J, (i = r.shadowDOM) != null && i.use ? this.attachShadow({ mode: r.shadowDOM.mode || "open" }) : this), O(this, k, Ct).call(this, e), O(this, k, Gt).call(this, r), queueMicrotask(() => O(this, k, At).call(this));
878
879
  }
879
880
  static get observedAttributes() {
880
- if (k(D, U).has(this))
881
- return k(D, U).get(this);
881
+ if (R(F, z).has(this))
882
+ return R(F, z).get(this);
882
883
  const e = this[Wt];
883
884
  if (!(e != null && e.props))
884
- return k(D, U).set(this, []), [];
885
- const s = e.props.map((r) => (typeof r == "string" ? r : r.name).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase());
886
- return k(D, U).set(this, s), s;
885
+ return R(F, z).set(this, []), [];
886
+ const n = e.props.map((r) => (typeof r == "string" ? r : r.name).replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase());
887
+ return R(F, z).set(this, n), n;
887
888
  }
888
889
  /* -------------------- $data -------------------- */
889
890
  get $data() {
890
- return k(this, rt);
891
+ return R(this, rt);
891
892
  }
892
893
  set $data(e) {
893
- var s;
894
- z(e) || (e = {}), (s = k(this, K)) == null || s.call(this), N(this, A, kt).call(this, e), N(this, A, dt).call(this);
894
+ var n;
895
+ Y(e) || (e = {}), (n = R(this, G)) == null || n.call(this), O(this, k, Ct).call(this, e), O(this, k, dt).call(this);
895
896
  }
896
897
  refresh() {
897
- N(this, A, dt).call(this);
898
+ O(this, k, dt).call(this);
898
899
  }
899
900
  /* -------------------- 生命周期 -------------------- */
900
901
  connectedCallback() {
901
- var r;
902
- N(this, A, Lt).call(this);
903
- const e = k(this, q);
904
- if ((e.className || e.tagName || "").split(" ").forEach((i) => i && this.classList.add(i)), N(this, A, Yt).call(this), e.props && z(this.$data))
905
- for (const i of e.props) {
906
- const o = typeof i == "string" ? i : i.name, c = N(this, A, Ct).call(this, o), a = o.replace(
902
+ var i;
903
+ const e = this.constructor;
904
+ Array.isArray(e.upgradeProps) && O(this, k, qt).call(this, e.upgradeProps), O(this, k, At).call(this);
905
+ const n = R(this, q);
906
+ if ((n.className || n.tagName || "").split(" ").forEach((o) => o && this.classList.add(o)), O(this, k, zt).call(this), n.props && Y(this.$data))
907
+ for (const o of n.props) {
908
+ const c = typeof o == "string" ? o : o.name, a = O(this, k, Rt).call(this, c), l = c.replace(
907
909
  /-([a-z])/g,
908
- (l, u) => u.toUpperCase()
910
+ (u, h) => h.toUpperCase()
909
911
  );
910
- if (this.hasAttribute(o)) {
911
- const l = this.getAttribute(o), u = N(this, A, Rt).call(this, l, c == null ? void 0 : c.default, c == null ? void 0 : c.type);
912
- this.$data[a] = u;
913
- } else c && "default" in c && (this.$data[a] = c.default);
912
+ if (this.hasAttribute(c)) {
913
+ const u = this.getAttribute(c), h = O(this, k, Lt).call(this, u, a == null ? void 0 : a.default, a == null ? void 0 : a.type);
914
+ this.$data[l] = h;
915
+ } else a && "default" in a && (this.$data[l] = a.default);
914
916
  }
915
- k(this, Z) && _(this, H, qe(
916
- k(this, Z),
917
- k(this, J),
917
+ R(this, Z) && _(this, H, Ge(
918
+ R(this, Z),
919
+ R(this, J),
918
920
  this
919
- )), this.mounted(), (r = this.onInit) == null || r.call(this);
921
+ )), this.mounted(), (i = this.onInit) == null || i.call(this);
920
922
  }
921
923
  disconnectedCallback() {
922
924
  var e;
923
- this.unmounted(), (e = k(this, K)) == null || e.call(this), _(this, K, void 0);
925
+ this.unmounted(), (e = R(this, G)) == null || e.call(this), _(this, G, void 0);
924
926
  }
925
- attributeChangedCallback(e, s, r) {
926
- if (s === r || !z(this.$data)) return;
927
- const i = N(this, A, Ct).call(this, e), o = e.replace(/-([a-z])/g, (l, u) => u.toUpperCase()), c = this.$data[o], a = N(this, A, Rt).call(this, r, (i == null ? void 0 : i.default) ?? c, i == null ? void 0 : i.type);
928
- this.$data[o] = a, _(this, Y, !0), this.attributeChanged(e, c, a), this.emit("change", {
927
+ attributeChangedCallback(e, n, r) {
928
+ if (n === r || !Y(this.$data)) return;
929
+ const i = O(this, k, Rt).call(this, e), o = e.replace(/-([a-z])/g, (l, u) => u.toUpperCase()), c = this.$data[o], a = O(this, k, Lt).call(this, r, (i == null ? void 0 : i.default) ?? c, i == null ? void 0 : i.type);
930
+ this.$data[o] = a, _(this, K, !0), this.attributeChanged(e, c, a), this.emit("change", {
929
931
  source: "attribute",
930
932
  name: e,
931
933
  oldValue: c,
@@ -933,12 +935,12 @@ const D = class D extends HTMLElement {
933
935
  });
934
936
  }
935
937
  /* -------------------- 事件派发 -------------------- */
936
- emit(e, s, r) {
938
+ emit(e, n, r) {
937
939
  this.dispatchEvent(
938
940
  new CustomEvent(e, {
939
941
  bubbles: !0,
940
942
  composed: !0,
941
- detail: s,
943
+ detail: n,
942
944
  ...r
943
945
  })
944
946
  );
@@ -956,46 +958,53 @@ const D = class D extends HTMLElement {
956
958
  }
957
959
  unmounted() {
958
960
  }
959
- attributeChanged(e, s, r) {
961
+ attributeChanged(e, n, r) {
960
962
  }
961
963
  beforeAttributesUpdate() {
962
964
  }
963
965
  afterAttributesUpdate() {
964
966
  }
965
967
  };
966
- q = new WeakMap(), H = new WeakMap(), Z = new WeakMap(), rt = new WeakMap(), J = new WeakMap(), K = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), U = new WeakMap(), A = new WeakSet(), /* -------------------- 初始化 -------------------- */
967
- kt = function(e) {
968
- const { proxy: s, unobserve: r } = Ie(e, (i) => {
968
+ q = new WeakMap(), H = new WeakMap(), Z = new WeakMap(), rt = new WeakMap(), J = new WeakMap(), G = new WeakMap(), Q = new WeakMap(), X = new WeakMap(), K = new WeakMap(), it = new WeakMap(), ot = new WeakMap(), z = new WeakMap(), k = new WeakSet(), // 升级属性(Upgrade Property), 保障在元素被定义前设置的属性能正确触发响应式更新
969
+ qt = function(e) {
970
+ for (const n of e)
971
+ if (this.hasOwnProperty(n)) {
972
+ const r = this[n];
973
+ delete this[n], this[n] = r;
974
+ }
975
+ }, /* -------------------- 初始化 -------------------- */
976
+ Ct = function(e) {
977
+ const { proxy: n, unobserve: r } = Me(e, (i) => {
969
978
  this.emit("change", {
970
979
  source: "state",
971
980
  ...i
972
- }), N(this, A, dt).call(this);
981
+ }), O(this, k, dt).call(this);
973
982
  });
974
- _(this, rt, s), _(this, K, r);
975
- }, qt = function(e) {
976
- const s = e.template;
977
- if (typeof s == "string") {
978
- const r = Le(s);
979
- _(this, Z, Ee(r, {
980
- source: s,
983
+ _(this, rt, n), _(this, G, r);
984
+ }, Gt = function(e) {
985
+ const n = e.template;
986
+ if (typeof n == "string") {
987
+ const r = Ae(n);
988
+ _(this, Z, xe(r, {
989
+ source: n,
981
990
  filename: e.tagName
982
991
  }));
983
992
  }
984
993
  }, /* -------------------- Prop 工具 -------------------- */
985
- Ct = function(e) {
986
- const s = k(this, q).props;
987
- if (!s) return;
988
- const r = e.replace(/-([a-z])/g, (o, c) => c.toUpperCase()), i = s.find(
994
+ Rt = function(e) {
995
+ const n = R(this, q).props;
996
+ if (!n) return;
997
+ const r = e.replace(/-([a-z])/g, (o, c) => c.toUpperCase()), i = n.find(
989
998
  (o) => typeof o == "string" ? o === r : o.name === r
990
999
  );
991
1000
  if (i)
992
1001
  return typeof i == "string" ? { name: i } : i;
993
- }, Rt = function(e, s, r) {
994
- if (e === null) return s;
1002
+ }, Lt = function(e, n, r) {
1003
+ if (e === null) return n;
995
1004
  switch (r) {
996
1005
  case "number": {
997
1006
  const i = Number(e);
998
- return isNaN(i) ? s : i;
1007
+ return isNaN(i) ? n : i;
999
1008
  }
1000
1009
  case "boolean":
1001
1010
  return e !== null && e !== "false";
@@ -1003,26 +1012,26 @@ Ct = function(e) {
1003
1012
  try {
1004
1013
  return JSON.parse(e);
1005
1014
  } catch {
1006
- return s;
1015
+ return n;
1007
1016
  }
1008
1017
  default:
1009
1018
  return e;
1010
1019
  }
1011
1020
  }, /* -------------------- 刷新调度 -------------------- */
1012
1021
  dt = function() {
1013
- k(this, X) || !k(this, H) || (_(this, X, !0), queueMicrotask(() => {
1014
- _(this, X, !1), N(this, A, Kt).call(this);
1022
+ R(this, X) || !R(this, H) || (_(this, X, !0), queueMicrotask(() => {
1023
+ _(this, X, !1), O(this, k, Kt).call(this);
1015
1024
  }));
1016
1025
  }, Kt = function() {
1017
- k(this, Q) || !this.isConnected || (_(this, Q, !0), k(this, Y) && this.beforeAttributesUpdate(), this.beforeUpdate(), k(this, H).update(), this.updated(), k(this, Y) && (this.afterAttributesUpdate(), _(this, Y, !1)), _(this, Q, !1));
1018
- }, Yt = function() {
1019
- const s = k(this, q).styles;
1020
- if (!s) return;
1021
- const r = k(this, J);
1026
+ R(this, Q) || !this.isConnected || (_(this, Q, !0), R(this, K) && this.beforeAttributesUpdate(), this.beforeUpdate(), R(this, H).update(), this.updated(), R(this, K) && (this.afterAttributesUpdate(), _(this, K, !1)), _(this, Q, !1));
1027
+ }, zt = function() {
1028
+ const n = R(this, q).styles;
1029
+ if (!n) return;
1030
+ const r = R(this, J);
1022
1031
  if ("adoptedStyleSheets" in r) {
1023
1032
  if (r._styleInjected) return;
1024
- let o = k(D, ot).get(s);
1025
- o || (o = new CSSStyleSheet(), o.replaceSync(s), k(D, ot).set(s, o)), r.adoptedStyleSheets = [
1033
+ let o = R(F, ot).get(n);
1034
+ o || (o = new CSSStyleSheet(), o.replaceSync(n), R(F, ot).set(n, o)), r.adoptedStyleSheets = [
1026
1035
  ...r.adoptedStyleSheets,
1027
1036
  o
1028
1037
  ], r._styleInjected = !0;
@@ -1030,187 +1039,183 @@ dt = function() {
1030
1039
  }
1031
1040
  if (r.querySelector("style[data-manifest-style]")) return;
1032
1041
  const i = document.createElement("style");
1033
- i.dataset.manifestStyle = "true", i.textContent = s, r.appendChild(i);
1042
+ i.dataset.manifestStyle = "true", i.textContent = n, r.appendChild(i);
1034
1043
  }, /* -------------------- created 保障 -------------------- */
1035
- Lt = function() {
1036
- k(this, it) || (_(this, it, !0), this.created());
1037
- }, Ot = new WeakMap(), P(D, ot, /* @__PURE__ */ new Map()), /* -------------------- observedAttributes -------------------- */
1038
- P(D, U, /* @__PURE__ */ new WeakMap()), /* -------------------- DEV define 保护 -------------------- */
1039
- P(D, Ot, !1);
1040
- let mt = D;
1041
- const Me = Symbol.for("solely.manifest"), Ut = (n) => (t) => {
1042
- if (customElements.get(n.tagName))
1043
- return console.warn(`标签名称 "${n.tagName}" 已经被注册`), t;
1044
+ At = function() {
1045
+ R(this, it) || (_(this, it, !0), this.created());
1046
+ }, Mt = new WeakMap(), C(F, "upgradeProps"), // 需要在元素定义前设置的属性列表(Upgrade Property)
1047
+ N(F, ot, /* @__PURE__ */ new Map()), /* -------------------- observedAttributes -------------------- */
1048
+ N(F, z, /* @__PURE__ */ new WeakMap()), /* -------------------- DEV define 保护 -------------------- */
1049
+ N(F, Mt, !1);
1050
+ let mt = F;
1051
+ const Pe = Symbol.for("solely.manifest"), Ut = (s) => (t) => {
1052
+ if (customElements.get(s.tagName))
1053
+ return console.warn(`标签名称 "${s.tagName}" 已经被注册`), t;
1044
1054
  class e extends t {
1045
1055
  }
1046
- return e[Me] = n, customElements.define(n.tagName, e), e;
1047
- }, ut = Symbol("solely.irCtx"), ht = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), At = Symbol("solely.staticClass"), It = Symbol("solely.staticStyle"), Ft = Symbol("solely.dynamicStyle"), Oe = {
1056
+ return e[Pe] = s, customElements.define(s.tagName, e), e;
1057
+ }, gt = Symbol("solely.isSVG"), ut = Symbol("solely.irCtx"), ht = Symbol("solely.irEvents"), V = Symbol.for("solely.irMeta"), Tt = Symbol("solely.lastDynamicClass"), Dt = Symbol("solely.dynamicStyleLast"), Oe = {
1048
1058
  xml: "http://www.w3.org/XML/1998/namespace",
1049
1059
  xlink: "http://www.w3.org/1999/xlink",
1050
1060
  xmlns: "http://www.w3.org/2000/xmlns/"
1051
- }, Pe = {
1061
+ }, Ne = {
1052
1062
  readonly: "readOnly",
1053
1063
  for: "htmlFor",
1054
1064
  tabindex: "tabIndex",
1055
1065
  contenteditable: "contentEditable",
1056
1066
  maxlength: "maxLength"
1057
- }, _e = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), Ne = /* @__PURE__ */ new Set([
1067
+ }, _e = /* @__PURE__ */ new Set(["data-", "aria-", "role", "form"]), We = /* @__PURE__ */ new Set([
1058
1068
  "value",
1059
1069
  "selectedIndex"
1060
1070
  ]);
1061
- function Te(n, t) {
1062
- var s;
1063
- const e = n;
1064
- if (e[At] === void 0) {
1065
- const r = (s = t.attrs) == null ? void 0 : s.find((i) => i.key === "class" && !i.dynamic);
1066
- e[At] = r ? r.value : "";
1067
- }
1071
+ function Te(s, t) {
1072
+ var i;
1073
+ const e = s, n = (i = t.attrs) == null ? void 0 : i.find((o) => o.key === "class" && !o.dynamic), r = n ? n.value : "";
1074
+ r && (e[gt] ? e.className.baseVal = r : e.className = r);
1068
1075
  }
1069
- function We(n, t) {
1070
- var s;
1071
- const e = n;
1072
- if (e[It] === void 0) {
1073
- const r = (s = t.attrs) == null ? void 0 : s.find((i) => i.key === "style" && !i.dynamic);
1074
- e[It] = r ? Gt(r.value) : {};
1076
+ function De(s, t) {
1077
+ var r;
1078
+ const e = (r = t.attrs) == null ? void 0 : r.find((i) => i.key === "style" && !i.dynamic), n = e ? Yt(e.value) : {};
1079
+ for (const i in n) {
1080
+ const o = n[i];
1081
+ i.startsWith("--") ? s.style.setProperty(i, o) : s.style[i] = o;
1075
1082
  }
1076
1083
  }
1077
- const Fe = (n, t) => {
1078
- const e = n, s = e[It] || {}, r = Gt(t), i = { ...s };
1079
- for (const c in r) {
1080
- const a = r[c];
1081
- a === "" || a == null ? delete i[c] : i[c] = a;
1082
- }
1083
- const o = e[Ft] || {};
1084
- for (const c in o)
1085
- c in i || (c.startsWith("--") ? n.style.removeProperty(c) : n.style[c] = "");
1086
- for (const c in i) {
1087
- const a = i[c];
1088
- c.startsWith("--") ? n.style.getPropertyValue(c) !== a && n.style.setProperty(c, a) : n.style[c] !== a && (n.style[c] = a);
1089
- }
1090
- e[Ft] = r;
1091
- }, je = (n, t) => {
1092
- const s = n[At] || "", r = De(t), i = /* @__PURE__ */ new Set();
1093
- s && s.split(/\s+/).forEach((c) => {
1094
- (!r.hasOwnProperty(c) || r[c]) && i.add(c);
1095
- });
1096
- for (const [c, a] of Object.entries(r))
1097
- a && i.add(c);
1098
- const o = [...i].join(" ");
1099
- n.className !== o && (n.className = o);
1084
+ const Fe = (s, t) => {
1085
+ const e = s, n = Yt(t), r = e[Dt] || {};
1086
+ for (const i in r)
1087
+ i in n || (i.startsWith("--") ? s.style.removeProperty(i) : s.style[i] = "");
1088
+ for (const i in n) {
1089
+ const o = n[i];
1090
+ i.startsWith("--") ? s.style.setProperty(i, o) : s.style[i] = o;
1091
+ }
1092
+ e[Dt] = n;
1093
+ }, je = (s, t) => {
1094
+ const e = s, n = e[Tt] || {}, r = Ve(t);
1095
+ for (const i in n)
1096
+ n[i] && !r[i] && (e[gt] ? e.className.baseVal = e.className.baseVal.replace(new RegExp(`\\b${i}\\b`, "g"), "").trim() : e.classList.remove(i));
1097
+ for (const i in r)
1098
+ if (r[i])
1099
+ if (e[gt]) {
1100
+ const o = e.className.baseVal.split(/\s+/);
1101
+ o.includes(i) || (o.push(i), e.className.baseVal = o.join(" "));
1102
+ } else
1103
+ e.classList.add(i);
1104
+ e[Tt] = r;
1100
1105
  };
1101
- function Gt(n) {
1102
- const t = {}, e = [[n]];
1106
+ function Yt(s) {
1107
+ const t = {}, e = [[s]];
1103
1108
  for (; e.length; ) {
1104
- const [s, r] = e.pop();
1105
- if (typeof s == "string") {
1106
- s.split(";").forEach((i) => {
1109
+ const [n, r] = e.pop();
1110
+ if (typeof n == "string") {
1111
+ n.split(";").forEach((i) => {
1107
1112
  const [o, c] = i.split(":").map((a) => a.trim());
1108
1113
  o && c && (t[o] = c);
1109
1114
  });
1110
1115
  continue;
1111
1116
  }
1112
- if (Array.isArray(s)) {
1113
- s.forEach((i) => e.push([i]));
1117
+ if (Array.isArray(n)) {
1118
+ n.forEach((i) => e.push([i]));
1114
1119
  continue;
1115
1120
  }
1116
- if (s && typeof s == "object")
1117
- for (const [i, o] of Object.entries(s)) {
1121
+ if (n && typeof n == "object")
1122
+ for (const [i, o] of Object.entries(n)) {
1118
1123
  const c = r ? `${r}-${i}` : i;
1119
1124
  o && typeof o == "object" && !Array.isArray(o) ? e.push([o, c]) : t[c] = String(o ?? "");
1120
1125
  }
1121
1126
  }
1122
1127
  return t;
1123
1128
  }
1124
- function De(n) {
1125
- const t = {}, e = [n];
1129
+ function Ve(s) {
1130
+ const t = {}, e = [s];
1126
1131
  for (; e.length; ) {
1127
- const s = e.pop();
1128
- if (s) {
1129
- if (typeof s == "string")
1130
- s.split(/\s+/).forEach((r) => r && (t[r] = !0));
1131
- else if (Array.isArray(s))
1132
- e.push(...s);
1133
- else if (typeof s == "object")
1134
- for (const [r, i] of Object.entries(s))
1132
+ const n = e.pop();
1133
+ if (n) {
1134
+ if (typeof n == "string")
1135
+ n.split(/\s+/).forEach((r) => r && (t[r] = !0));
1136
+ else if (Array.isArray(n))
1137
+ e.push(...n);
1138
+ else if (typeof n == "object")
1139
+ for (const [r, i] of Object.entries(n))
1135
1140
  t[r] = !!i;
1136
1141
  }
1137
1142
  }
1138
1143
  return t;
1139
1144
  }
1140
- function Ve(n, t, e) {
1141
- const s = t.indexOf(":");
1142
- if (s > 0) {
1143
- const r = t.slice(0, s), i = Oe[r];
1144
- if (i) return n.setAttributeNS(i, t, e);
1145
+ function Be(s, t, e) {
1146
+ const n = t.indexOf(":");
1147
+ if (n > 0) {
1148
+ const r = t.slice(0, n), i = Oe[r];
1149
+ if (i) return s.setAttributeNS(i, t, e);
1145
1150
  }
1146
- n.setAttribute(t, e);
1151
+ s.setAttribute(t, e);
1147
1152
  }
1148
- function jt(n, t, e) {
1153
+ function Ft(s, t, e) {
1149
1154
  if (t.startsWith("data-") || t.startsWith("aria-") || _e.has(t)) {
1150
- n.setAttribute(t, e);
1155
+ s.setAttribute(t, e);
1151
1156
  return;
1152
1157
  }
1153
- const s = Pe[t] || t;
1154
- n[s] = e;
1158
+ const n = Ne[t] || t;
1159
+ s[n] = e;
1155
1160
  }
1156
- class Be {
1157
- constructor(t, e, s = {}) {
1158
- L(this, "nodeMap", /* @__PURE__ */ new Map());
1159
- L(this, "marker", !1);
1160
- this.ir = t, this.container = e, this.scope = s;
1161
+ class qe {
1162
+ constructor(t, e, n = {}) {
1163
+ C(this, "nodeMap", /* @__PURE__ */ new Map());
1164
+ C(this, "marker", !1);
1165
+ this.ir = t, this.container = e, this.scope = n;
1161
1166
  }
1162
- evalIR(t, e, s) {
1167
+ evalIR(t, e, n) {
1163
1168
  var i;
1164
1169
  const r = this.ir.functions[t - 1];
1165
1170
  try {
1166
1171
  return r ? r.apply(this.scope, e) : "";
1167
1172
  } catch (o) {
1168
- return ne(o.message || o.toString(), ((i = this.ir.metadata) == null ? void 0 : i.source) || "", s, this.scope.tagName), "";
1173
+ return ne(o.message || o.toString(), ((i = this.ir.metadata) == null ? void 0 : i.source) || "", n, this.scope.tagName), "";
1169
1174
  }
1170
1175
  }
1171
1176
  // ================ 创建节点 ================
1172
- createElement(t) {
1173
- const e = t.tag;
1174
- return e === "svg" ? document.createElementNS("http://www.w3.org/2000/svg", e) : document.createElement(e);
1177
+ createElement(t, e) {
1178
+ const n = t.tag, r = e instanceof SVGElement || n === "svg", i = r ? document.createElementNS("http://www.w3.org/2000/svg", n) : document.createElement(n);
1179
+ return i[gt] = r, i;
1175
1180
  }
1176
1181
  createText(t, e) {
1177
- const s = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1178
- return document.createTextNode(s);
1182
+ const n = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1183
+ return document.createTextNode(n);
1179
1184
  }
1180
1185
  createComment(t, e) {
1181
- const s = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1182
- return document.createComment(s);
1186
+ const n = t.dynamic ? this.evalIR(t.fid, [e], t[V]) : t.txt || "";
1187
+ return document.createComment(n);
1183
1188
  }
1184
1189
  // ================ 属性全量应用(创建或更新时用) ================
1185
- applyAttrs(t, e, s, r = !1) {
1190
+ applyAttrs(t, e, n, r = !1) {
1186
1191
  const i = [], o = t;
1187
1192
  o[ut] || (o[ut] = {
1188
1193
  loops: null
1189
- }), o[ut].loops = s, o[ht] || (o[ht] = /* @__PURE__ */ Object.create(null));
1194
+ }), o[ut].loops = n, o[ht] || (o[ht] = /* @__PURE__ */ Object.create(null));
1190
1195
  let c, a = !1, l, u = !1;
1191
1196
  for (const h of e) {
1192
1197
  const { key: p, fid: v, dynamic: m, value: d } = h;
1193
1198
  if (p === ":class") {
1194
- c = this.evalIR(v, [s]), a = !0;
1199
+ c = this.evalIR(v, [n]), a = !0;
1195
1200
  continue;
1196
1201
  }
1197
1202
  if (p === ":style") {
1198
- l = this.evalIR(v, [s]), u = !0;
1203
+ l = this.evalIR(v, [n]), u = !0;
1199
1204
  continue;
1200
1205
  }
1201
1206
  if (p === "class" || p === "style")
1202
1207
  continue;
1203
- const C = p[0];
1204
- if (C === "@") {
1208
+ const L = p[0];
1209
+ if (L === "@") {
1205
1210
  const $ = p.slice(1), S = h.role ?? "user";
1206
- let R = o[ht][$];
1207
- if (R || (R = o[ht][$] = {
1211
+ let A = o[ht][$];
1212
+ if (A || (A = o[ht][$] = {
1208
1213
  model: [],
1209
1214
  user: []
1210
1215
  }, t.addEventListener($, (f) => {
1211
- for (const w of R.model)
1216
+ for (const w of A.model)
1212
1217
  w(f);
1213
- for (const w of R.user)
1218
+ for (const w of A.user)
1214
1219
  w(f);
1215
1220
  })), !r) {
1216
1221
  const f = (w) => this.evalIR(
@@ -1218,19 +1223,19 @@ class Be {
1218
1223
  [w, o[ut].loops],
1219
1224
  h[V]
1220
1225
  );
1221
- R[S].push(f);
1226
+ A[S].push(f);
1222
1227
  }
1223
1228
  continue;
1224
1229
  }
1225
1230
  if (p === "mounted") {
1226
1231
  r || requestAnimationFrame(
1227
- () => this.evalIR(v, [t, s], h[V])
1232
+ () => this.evalIR(v, [t, n], h[V])
1228
1233
  );
1229
1234
  continue;
1230
1235
  }
1231
1236
  if (p === "updated") {
1232
1237
  r && requestAnimationFrame(
1233
- () => this.evalIR(v, [t, s], h[V])
1238
+ () => this.evalIR(v, [t, n], h[V])
1234
1239
  );
1235
1240
  continue;
1236
1241
  }
@@ -1238,29 +1243,29 @@ class Be {
1238
1243
  this.scope.$refs = this.scope.$refs || {}, this.scope.$refs[d] = t;
1239
1244
  continue;
1240
1245
  }
1241
- const b = m ? this.evalIR(v, [s], h[V]) : d ?? "";
1242
- if (C === ":") {
1246
+ const b = m ? this.evalIR(v, [n], h[V]) : d ?? "";
1247
+ if (L === ":") {
1243
1248
  const $ = p.slice(1);
1244
- t.tagName === "SELECT" && Ne.has($) ? i.push(() => jt(t, $, b)) : jt(t, $, b);
1249
+ t.tagName === "SELECT" && We.has($) ? i.push(() => Ft(t, $, b)) : Ft(t, $, b);
1245
1250
  } else
1246
- Ve(t, p, String(b));
1251
+ Be(t, p, String(b));
1247
1252
  }
1248
1253
  return (a || !r) && je(t, c), (u || !r) && Fe(t, l), i;
1249
1254
  }
1250
1255
  // ================ 更新已有节点 Text Or Comment ================
1251
- updateNode(t, e, s) {
1252
- const r = e.dynamic ? this.evalIR(e.fid, [s], e[V]) : e.txt || "";
1256
+ updateNode(t, e, n) {
1257
+ const r = e.dynamic ? this.evalIR(e.fid, [n], e[V]) : e.txt || "";
1253
1258
  e.dynamic && t.textContent !== r && (t.textContent = r);
1254
1259
  }
1255
1260
  // ================ 核心遍历 ================
1256
- irToNode(t, e, s, r, i) {
1261
+ irToNode(t, e, n, r, i) {
1257
1262
  var l, u, h, p;
1258
- const o = s + "-" + e, c = this.nodeMap.get(o);
1263
+ const o = n + "-" + e, c = this.nodeMap.get(o);
1259
1264
  let a;
1260
1265
  if (c) {
1261
1266
  a = c.node, c.marker = this.marker;
1262
1267
  let v = [];
1263
- t.dynamic && (t.type === y.Element ? v = this.applyAttrs(
1268
+ t.dynamic && (t.type === g.Element ? v = this.applyAttrs(
1264
1269
  a,
1265
1270
  t.attrs ?? [],
1266
1271
  i,
@@ -1270,48 +1275,48 @@ class Be {
1270
1275
  }), v.forEach((m) => m());
1271
1276
  } else
1272
1277
  switch (t.type) {
1273
- case y.Element:
1274
- a = this.createElement(t), Te(a, t), We(a, t);
1278
+ case g.Element:
1279
+ a = this.createElement(t, r), Te(a, t), De(a, t);
1275
1280
  const v = this.applyAttrs(a, t.attrs ?? [], i);
1276
1281
  r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker }), (u = t.children) == null || u.forEach((m, d) => {
1277
1282
  this.irToNode(m, d, o, a, i);
1278
1283
  }), v.forEach((m) => m());
1279
1284
  break;
1280
- case y.Text:
1285
+ case g.Text:
1281
1286
  a = this.createText(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
1282
1287
  break;
1283
- case y.Comment:
1288
+ case g.Comment:
1284
1289
  a = this.createComment(t, i), r.appendChild(a), this.nodeMap.set(o, { irNode: t, node: a, loops: i, marker: this.marker });
1285
1290
  break;
1286
- case y.For: {
1291
+ case g.For: {
1287
1292
  const m = `${o}-end`;
1288
1293
  let d = (h = this.nodeMap.get(m)) == null ? void 0 : h.node;
1289
1294
  d ? this.nodeMap.get(m).marker = this.marker : (d = document.createComment(`for:${o}`), r.appendChild(d), this.nodeMap.set(m, {
1290
- irNode: { type: y.Comment },
1295
+ irNode: { type: g.Comment },
1291
1296
  node: d,
1292
1297
  loops: i,
1293
1298
  marker: this.marker
1294
1299
  }));
1295
- const C = this.evalIR(t.fid, [i], t[V]) || [], b = document.createDocumentFragment();
1296
- C.forEach(($, S) => {
1300
+ const L = this.evalIR(t.fid, [i], t[V]) || [], b = document.createDocumentFragment();
1301
+ L.forEach(($, S) => {
1297
1302
  var f;
1298
- const R = [...i, { itmVal: $, idxVal: S }];
1303
+ const A = [...i, { itmVal: $, idxVal: S }];
1299
1304
  (f = t.children) == null || f.forEach((w, E) => {
1300
- this.irToNode(w, E, `${o}-for-${S}`, b, R);
1305
+ this.irToNode(w, E, `${o}-for-${S}`, b, A);
1301
1306
  });
1302
1307
  }), d.parentNode.insertBefore(b, d);
1303
1308
  break;
1304
1309
  }
1305
- case y.Conditional: {
1310
+ case g.Conditional: {
1306
1311
  const m = `${o}-end`;
1307
1312
  let d = (p = this.nodeMap.get(m)) == null ? void 0 : p.node;
1308
1313
  d ? this.nodeMap.get(m).marker = this.marker : (d = document.createComment(`if:${o}`), r.appendChild(d), this.nodeMap.set(m, { irNode: {}, node: d, loops: i, marker: this.marker }));
1309
- for (let C = 0; C < (t.branches || []).length; C++) {
1310
- const b = t.branches[C];
1314
+ for (let L = 0; L < (t.branches || []).length; L++) {
1315
+ const b = t.branches[L];
1311
1316
  if (b.condFid === null || this.evalIR(b.condFid, [i], b[V])) {
1312
1317
  const S = document.createDocumentFragment();
1313
- b.children.forEach((R, f) => {
1314
- this.irToNode(R, f, `${o}-if-${C}`, S, i);
1318
+ b.children.forEach((A, f) => {
1319
+ this.irToNode(A, f, `${o}-if-${L}`, S, i);
1315
1320
  }), d.parentNode.insertBefore(S, d);
1316
1321
  break;
1317
1322
  }
@@ -1324,9 +1329,9 @@ class Be {
1324
1329
  cleanupOldNodes() {
1325
1330
  for (const [t, e] of this.nodeMap.entries())
1326
1331
  if (e.marker !== this.marker) {
1327
- const { irNode: s, node: r, loops: i } = e;
1328
- if (s.attrs) {
1329
- const o = s.attrs.find((a) => a.key === "unmounted");
1332
+ const { irNode: n, node: r, loops: i } = e;
1333
+ if (n.attrs) {
1334
+ const o = n.attrs.find((a) => a.key === "unmounted");
1330
1335
  o && requestAnimationFrame(() => {
1331
1336
  this.evalIR(
1332
1337
  o.fid,
@@ -1334,7 +1339,7 @@ class Be {
1334
1339
  o[V]
1335
1340
  );
1336
1341
  });
1337
- const c = s.attrs.find((a) => a.key === "ref");
1342
+ const c = n.attrs.find((a) => a.key === "ref");
1338
1343
  c && c.value && delete this.scope.$refs[c.value];
1339
1344
  }
1340
1345
  r == null || r.remove(), this.nodeMap.delete(t);
@@ -1355,38 +1360,38 @@ class Be {
1355
1360
  this.container.innerHTML = "", this.nodeMap.clear();
1356
1361
  }
1357
1362
  }
1358
- const qe = (n, t, e = {}) => {
1359
- const s = new Be(n, t, e);
1360
- return s.mount(), {
1361
- update: () => s.update(),
1362
- destroy: () => s.destroy()
1363
+ const Ge = (s, t, e = {}) => {
1364
+ const n = new qe(s, t, e);
1365
+ return n.mount(), {
1366
+ update: () => n.update(),
1367
+ destroy: () => n.destroy()
1363
1368
  };
1364
1369
  };
1365
- let G = null, zt;
1366
- const Ht = new Promise((n) => {
1367
- zt = n;
1370
+ let U = null, Ht;
1371
+ const Zt = new Promise((s) => {
1372
+ Ht = s;
1368
1373
  });
1369
- function Qe(n) {
1370
- return G || (G = new Ke(n), zt(G), G);
1374
+ function Xe(s) {
1375
+ return U || (U = new Ke(s), Ht(U), U);
1371
1376
  }
1372
- function Et() {
1373
- return G;
1377
+ function xt() {
1378
+ return U;
1374
1379
  }
1375
1380
  class Ke {
1376
1381
  constructor(t) {
1377
- L(this, "routes");
1378
- L(this, "base");
1379
- L(this, "mode");
1380
- L(this, "beforeEachGuard");
1381
- L(this, "afterEachGuard");
1382
- L(this, "currentRoute", null);
1383
- L(this, "listeners", /* @__PURE__ */ new Set());
1384
- L(this, "isStarted", !1);
1385
- this.routes = t.routes, this.base = t.base || "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
1382
+ C(this, "routes");
1383
+ C(this, "base");
1384
+ C(this, "mode");
1385
+ C(this, "beforeEachGuard");
1386
+ C(this, "afterEachGuard");
1387
+ C(this, "currentRoute", null);
1388
+ C(this, "listeners", /* @__PURE__ */ new Set());
1389
+ C(this, "isStarted", !1);
1390
+ this.routes = t.routes, this.base = t.base ?? "/", this.mode = t.mode || "history", this.beforeEachGuard = t.beforeEach, this.afterEachGuard = t.afterEach;
1386
1391
  }
1387
1392
  // --- 核心匹配逻辑 ---
1388
- matchRoute(t) {
1389
- const e = t.startsWith("/") ? t : "/" + t, [s, r] = e.split("?"), i = s.split("/").filter(Boolean), o = this.parseQuery(r), c = this.recursiveMatch(this.routes, i);
1393
+ matchRoute(t = "/") {
1394
+ const e = t.startsWith("/") ? t : "/" + t, [n, r] = e.split("?"), i = n.split("/").filter(Boolean), o = this.parseQuery(r), c = this.recursiveMatch(this.routes, i);
1390
1395
  if (c) {
1391
1396
  const a = c.matched[c.matched.length - 1];
1392
1397
  return a.config.redirect ? this.matchRoute(a.config.redirect) : {
@@ -1403,8 +1408,8 @@ class Ke {
1403
1408
  return null;
1404
1409
  }
1405
1410
  recursiveMatch(t, e) {
1406
- const s = [...t].sort((r, i) => this.calculateScore(i.path) - this.calculateScore(r.path));
1407
- for (const r of s) {
1411
+ const n = [...t].sort((r, i) => this.calculateScore(i.path) - this.calculateScore(r.path));
1412
+ for (const r of n) {
1408
1413
  const i = r.path.split("/").filter(Boolean), o = {};
1409
1414
  let c = !0;
1410
1415
  if (i.length === 0 && e.length === 0)
@@ -1447,9 +1452,9 @@ class Ke {
1447
1452
  }
1448
1453
  return null;
1449
1454
  }
1450
- calculateScore(t) {
1455
+ calculateScore(t = "/") {
1451
1456
  const e = t.split("/").filter(Boolean);
1452
- return e.length === 0 ? 1 : e.reduce((s, r) => r.startsWith(":") ? s + 5 : r === "*" ? s + 0 : s + 10, 0);
1457
+ return e.length === 0 ? 1 : e.reduce((n, r) => r.startsWith(":") ? n + 5 : r === "*" ? n + 0 : n + 10, 0);
1453
1458
  }
1454
1459
  parseQuery(t) {
1455
1460
  const e = {};
@@ -1457,46 +1462,57 @@ class Ke {
1457
1462
  e[i] = r;
1458
1463
  }), e;
1459
1464
  }
1460
- // --- 导航逻辑 (已修复循环跳转) ---
1465
+ normalizePath(t = "/") {
1466
+ let e = t && typeof t == "string" ? t : "/";
1467
+ return e.startsWith("/") || (e = "/" + e), e.length > 1 && e.endsWith("/") && (e = e.slice(0, -1)), e;
1468
+ }
1469
+ // --- 导航逻辑 ---
1461
1470
  getPath() {
1462
- let t = this.mode === "hash" ? window.location.hash.slice(1) || "/" : window.location.pathname;
1463
- return this.base && this.base !== "/" && t.startsWith(this.base) && (t = t.slice(this.base.length) || "/"), t.startsWith("/") ? t : "/" + t;
1464
- }
1465
- updateBrowserHistory(t, e) {
1466
- if (this.mode === "hash") {
1467
- const s = t.startsWith("/") ? t : "/" + t;
1468
- e ? window.location.replace(`#${s}`) : window.location.hash = s;
1469
- } else {
1470
- const s = this.base && this.base !== "/" ? (this.base.endsWith("/") ? this.base.slice(0, -1) : this.base) + t : t;
1471
- e ? window.history.replaceState({ path: s }, "", s) : window.history.pushState({ path: s }, "", s);
1471
+ let t;
1472
+ try {
1473
+ t = this.mode === "hash" ? window.location.hash.slice(1) || "/" : window.location.pathname || "/";
1474
+ } catch {
1475
+ t = "/";
1476
+ }
1477
+ const e = this.base || "/";
1478
+ return e !== "/" && t.startsWith(e) && (t = t.slice(e.length) || "/"), this.normalizePath(t);
1479
+ }
1480
+ updateBrowserHistory(t = "/", e) {
1481
+ const n = this.normalizePath(t), r = this.base || "/";
1482
+ if (this.mode === "hash")
1483
+ e ? window.location.replace(`#${n}`) : window.location.hash = n;
1484
+ else {
1485
+ const i = r.endsWith("/") ? r.slice(0, -1) : r, o = i === "/" ? n : i + n;
1486
+ e ? window.history.replaceState({ path: o }, "", o) : window.history.pushState({ path: o }, "", o);
1472
1487
  }
1473
1488
  }
1474
1489
  /**
1475
1490
  * @param fromEvent 标志位:是否由浏览器 popstate 事件触发
1476
1491
  */
1477
- async navigate(t, e = !1, s = !1) {
1478
- const r = this.currentRoute, i = this.matchRoute(t);
1479
- if (!i) return { success: !1, error: `No route matched: ${t}` };
1480
- if (r && r.fullPath === i.fullPath)
1481
- return { success: !0 };
1492
+ async navigate(t = "/", e = !1, n = !1) {
1493
+ const r = this.normalizePath(t), i = this.currentRoute, o = this.matchRoute(r);
1494
+ if (!o) return { success: !1, error: `No route matched: ${r}` };
1495
+ if (i && i.fullPath === o.fullPath) return { success: !0 };
1482
1496
  if (this.beforeEachGuard)
1483
1497
  try {
1484
- const o = await this.beforeEachGuard(i, r);
1485
- if (o === !1) return { success: !1, cancelled: !0 };
1486
- if (typeof o == "string") return this.navigate(o, e);
1487
- } catch (o) {
1488
- return { success: !1, error: o instanceof Error ? o.message : "Guard Error" };
1498
+ const c = await this.beforeEachGuard(o, i);
1499
+ if (c === !1) return { success: !1, cancelled: !0 };
1500
+ if (typeof c == "string") return this.navigate(c, e);
1501
+ } catch (c) {
1502
+ return { success: !1, error: c instanceof Error ? c.message : "Guard Error" };
1489
1503
  }
1490
- return this.currentRoute = i, s || this.updateBrowserHistory(t, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(i, r), { success: !0 };
1504
+ return this.currentRoute = o, n || this.updateBrowserHistory(r, e), this.notifyListeners(), this.afterEachGuard && this.afterEachGuard(o, i), { success: !0 };
1491
1505
  }
1492
1506
  // --- 路径解析逻辑 ---
1493
1507
  /**
1494
1508
  * 将逻辑路径解析为浏览器真实的 URL 路径
1495
1509
  * 供 RouterLink 等组件生成 href 使用
1496
1510
  */
1497
- resolve(t) {
1498
- const e = t.startsWith("/") ? t : "/" + t;
1499
- return this.mode === "hash" ? `#${e}` : (this.base.endsWith("/") ? this.base.slice(0, -1) : this.base) + e;
1511
+ resolve(t = "/") {
1512
+ const e = this.normalizePath(t);
1513
+ if (this.mode === "hash") return `#${e}`;
1514
+ const n = this.base.endsWith("/") ? this.base.slice(0, -1) : this.base;
1515
+ return n === "/" ? e : n + e;
1500
1516
  }
1501
1517
  /**
1502
1518
  * 获取当前模式(供外部组件判断,如 RouterLink)
@@ -1504,14 +1520,14 @@ class Ke {
1504
1520
  get modeType() {
1505
1521
  return this.mode;
1506
1522
  }
1507
- pushWithQuery(t, e) {
1508
- const s = new URLSearchParams(e).toString(), r = t.includes("?") ? "&" : "?";
1509
- return this.push(t + (s ? r + s : ""));
1523
+ pushWithQuery(t = "/", e) {
1524
+ const n = new URLSearchParams(e).toString(), r = t.includes("?") ? "&" : "?";
1525
+ return this.push(t + (n ? r + n : ""));
1510
1526
  }
1511
- push(t) {
1527
+ push(t = "/") {
1512
1528
  return this.navigate(t, !1);
1513
1529
  }
1514
- replace(t) {
1530
+ replace(t = "/") {
1515
1531
  return this.navigate(t, !0);
1516
1532
  }
1517
1533
  back() {
@@ -1534,28 +1550,28 @@ class Ke {
1534
1550
  return this.currentRoute;
1535
1551
  }
1536
1552
  }
1537
- var Ye = Object.getOwnPropertyDescriptor, Ue = (n, t, e, s) => {
1538
- for (var r = s > 1 ? void 0 : s ? Ye(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1539
- (o = n[i]) && (r = o(r) || r);
1553
+ var ze = Object.getOwnPropertyDescriptor, Ue = (s, t, e, n) => {
1554
+ for (var r = n > 1 ? void 0 : n ? ze(t, e) : t, i = s.length - 1, o; i >= 0; i--)
1555
+ (o = s[i]) && (r = o(r) || r);
1540
1556
  return r;
1541
1557
  };
1542
1558
  let yt = class extends mt {
1543
1559
  constructor() {
1544
1560
  super(...arguments);
1545
- L(this, "unsubscribe");
1546
- L(this, "level", 0);
1547
- L(this, "currentElement", null);
1548
- L(this, "currentTagName", null);
1549
- L(this, "routerAttrs", /* @__PURE__ */ new Set());
1550
- L(this, "prevPropKeys", /* @__PURE__ */ new Set());
1551
- L(this, "scheduled", !1);
1552
- L(this, "cache", /* @__PURE__ */ new Map());
1553
- L(this, "latestLoadId", 0);
1561
+ C(this, "unsubscribe");
1562
+ C(this, "level", 0);
1563
+ C(this, "currentElement", null);
1564
+ C(this, "currentTagName", null);
1565
+ C(this, "routerAttrs", /* @__PURE__ */ new Set());
1566
+ C(this, "prevPropKeys", /* @__PURE__ */ new Set());
1567
+ C(this, "scheduled", !1);
1568
+ C(this, "cache", /* @__PURE__ */ new Map());
1569
+ C(this, "latestLoadId", 0);
1554
1570
  }
1555
1571
  /* -------------------- 生命周期 -------------------- */
1556
1572
  async mounted() {
1557
1573
  this.detectLevel();
1558
- const t = await Ht;
1574
+ const t = await Zt;
1559
1575
  this.unsubscribe = t.listen(() => {
1560
1576
  this.scheduleLoad(t.getCurrentRoute());
1561
1577
  }), this.loadRoute(t.getCurrentRoute());
@@ -1577,46 +1593,46 @@ let yt = class extends mt {
1577
1593
  this.level = t;
1578
1594
  }
1579
1595
  async loadRoute(t) {
1580
- const e = ++this.latestLoadId, s = t == null ? void 0 : t.matched[this.level];
1581
- if (!s) {
1596
+ const e = ++this.latestLoadId, n = t == null ? void 0 : t.matched[this.level];
1597
+ if (!n) {
1582
1598
  this.handleEmptyRoute();
1583
1599
  return;
1584
1600
  }
1585
- const { config: r, params: i } = s;
1586
- let o = r.tagName;
1587
- if (!o && typeof r.component == "function") {
1601
+ const { config: r } = n;
1602
+ let i = r.tagName;
1603
+ if (!i && typeof r.component == "function") {
1588
1604
  this.renderLoading();
1589
1605
  try {
1590
- const a = await r.component();
1591
- o = typeof a == "string" ? a : a.tagName;
1592
- } catch (a) {
1593
- this.renderError(`Load Error: ${a}`);
1606
+ const c = await r.component();
1607
+ i = typeof c == "string" ? c : c.tagName;
1608
+ } catch (c) {
1609
+ this.renderError(`Load Error: ${c}`);
1594
1610
  return;
1595
1611
  }
1596
1612
  }
1597
1613
  if (e !== this.latestLoadId) return;
1598
- if (!o) {
1614
+ if (!i) {
1599
1615
  this.clear();
1600
1616
  return;
1601
1617
  }
1602
- if (!r.forceReload && this.currentElement && this.currentTagName === o.toLowerCase()) {
1603
- this.syncState(this.currentElement, i, (t == null ? void 0 : t.query) || {}, r.props);
1618
+ if (!r.forceReload && this.currentElement && this.currentTagName === i.toLowerCase()) {
1619
+ this.syncState(this.currentElement, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props);
1604
1620
  return;
1605
1621
  }
1606
1622
  this.clear(r.keepAlive);
1607
- const c = this.getOrCreateComponent(o, r);
1608
- this.syncState(c, i, (t == null ? void 0 : t.query) || {}, r.props), this.appendChild(c), this.currentElement = c, this.currentTagName = o.toLowerCase();
1623
+ const o = this.getOrCreateComponent(i, r);
1624
+ this.syncState(o, t == null ? void 0 : t.params, (t == null ? void 0 : t.query) || {}, r.props), this.appendChild(o), this.currentElement = o, this.currentTagName = i.toLowerCase();
1609
1625
  }
1610
1626
  getOrCreateComponent(t, e) {
1611
- const s = t.toLowerCase();
1612
- if (e.keepAlive && this.cache.has(s))
1613
- return this.cache.get(s);
1627
+ const n = t.toLowerCase();
1628
+ if (e.keepAlive && this.cache.has(n))
1629
+ return this.cache.get(n);
1614
1630
  const r = document.createElement(t);
1615
- return e.keepAlive && this.cache.set(s, r), r;
1631
+ return e.keepAlive && this.cache.set(n, r), r;
1616
1632
  }
1617
- syncState(t, e, s, r = {}) {
1633
+ syncState(t, e, n, r = {}) {
1618
1634
  const i = (a) => a.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase(), o = /* @__PURE__ */ new Map();
1619
- Object.entries(e).forEach(([a, l]) => o.set(i(a), String(l))), Object.entries(s).forEach(([a, l]) => o.set(`query-${i(a)}`, String(l))), this.routerAttrs.forEach((a) => {
1635
+ Object.entries(e).forEach(([a, l]) => o.set(i(a), String(l))), Object.entries(n).forEach(([a, l]) => o.set(`query-${i(a)}`, String(l))), this.routerAttrs.forEach((a) => {
1620
1636
  o.has(a) || (t.removeAttribute(a), this.routerAttrs.delete(a));
1621
1637
  }), o.forEach((a, l) => {
1622
1638
  t.getAttribute(l) !== a && t.setAttribute(l, a), this.routerAttrs.add(l);
@@ -1647,27 +1663,33 @@ yt = Ue([
1647
1663
  // 注意:删除了 shadowDOM 配置,默认为 false
1648
1664
  })
1649
1665
  ], yt);
1650
- const Xe = yt;
1651
- var Ge = Object.getOwnPropertyDescriptor, ze = (n, t, e, s) => {
1652
- for (var r = s > 1 ? void 0 : s ? Ge(t, e) : t, i = n.length - 1, o; i >= 0; i--)
1653
- (o = n[i]) && (r = o(r) || r);
1666
+ const ts = yt;
1667
+ var Ye = Object.getOwnPropertyDescriptor, He = (s, t, e, n) => {
1668
+ for (var r = n > 1 ? void 0 : n ? Ye(t, e) : t, i = s.length - 1, o; i >= 0; i--)
1669
+ (o = s[i]) && (r = o(r) || r);
1654
1670
  return r;
1655
1671
  };
1656
- let Mt = class extends mt {
1672
+ let It = class extends mt {
1657
1673
  constructor() {
1658
1674
  super(...arguments);
1659
- L(this, "_prefetched", !1);
1675
+ C(this, "_prefetched", !1);
1676
+ }
1677
+ set to(t) {
1678
+ this.$data.to = t, this.updateState();
1679
+ }
1680
+ get to() {
1681
+ return this.$data.to;
1660
1682
  }
1661
1683
  async mounted() {
1662
- (await Ht).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1684
+ (await Zt).listen(() => this.updateState()), this.updateState(), this.addEventListener("click", (e) => {
1663
1685
  var r, i;
1664
- 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));
1686
+ 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 = xt()) == null || i.push(this.$data.to));
1665
1687
  }), this.addEventListener("mouseenter", () => {
1666
1688
  this.prefetchRoute();
1667
1689
  }, { once: !0 });
1668
1690
  }
1669
1691
  updateState() {
1670
- const t = Et();
1692
+ const t = xt();
1671
1693
  if (!t) return;
1672
1694
  this.$data.href = t.resolve(this.$data.to);
1673
1695
  let e = !1;
@@ -1681,17 +1703,17 @@ let Mt = class extends mt {
1681
1703
  }
1682
1704
  }
1683
1705
  this.$data.isActive = e;
1684
- const s = this.$data.activeClass || "active";
1685
- this.classList.toggle(s, e);
1706
+ const n = this.$data.activeClass || "active";
1707
+ this.classList.toggle(n, e);
1686
1708
  }
1687
1709
  // 预加载路由的具体实现
1688
1710
  prefetchRoute() {
1689
1711
  if (this._prefetched || !this.hasAttribute("prefetch")) return;
1690
- const t = Et();
1712
+ const t = xt();
1691
1713
  t && typeof t.prefetch == "function" && (t.prefetch(this.$data.to), this._prefetched = !0);
1692
1714
  }
1693
1715
  };
1694
- Mt = ze([
1716
+ It = He([
1695
1717
  Ut({
1696
1718
  tagName: "router-link",
1697
1719
  // template 中 slot 包裹 label 作为 fallback:
@@ -1703,7 +1725,6 @@ Mt = ze([
1703
1725
  `,
1704
1726
  styles: `
1705
1727
  :host {
1706
- display: inline-block;
1707
1728
  }
1708
1729
 
1709
1730
  a {
@@ -1726,31 +1747,32 @@ Mt = ze([
1726
1747
  // 注册所有支持的 props
1727
1748
  props: ["to", "active", "exact", "label", "custom", "activeClass", "prefetch"]
1728
1749
  })
1729
- ], Mt);
1730
- const tn = Mt;
1750
+ ], It);
1751
+ const es = It;
1731
1752
  export {
1732
- y as ASTType,
1753
+ g as ASTType,
1733
1754
  mt as BaseElement,
1734
1755
  Ut as CustomElement,
1735
- Be as IRRenderer,
1736
- fe as LIFECYCLE_ATTRS_MAP,
1756
+ qe as IRRenderer,
1757
+ de as LIFECYCLE_ATTRS_MAP,
1737
1758
  Ke as Router,
1738
- tn as RouterLink,
1739
- Xe as RouterView,
1740
- Ee as buildIR,
1741
- Je as clearIRCache,
1742
- se as createFunction,
1743
- qe as createRender,
1744
- Qe as createRouter,
1745
- ue as genFunction,
1746
- Et as getRouter,
1747
- pe as isLifecycleKind,
1748
- z as isObject,
1749
- he as listeners,
1750
- de as mapAttrKeyToLifecycleKind,
1751
- Ie as observe,
1752
- Ze as parseHashUrl,
1753
- Le as parseHtml,
1759
+ es as RouterLink,
1760
+ ts as RouterView,
1761
+ xe as buildIR,
1762
+ Qe as clearIRCache,
1763
+ re as createFunction,
1764
+ Ge as createRender,
1765
+ Xe as createRouter,
1766
+ he as genFunction,
1767
+ xt as getRouter,
1768
+ me as isLifecycleKind,
1769
+ Y as isObject,
1770
+ fe as listeners,
1771
+ pe as mapAttrKeyToLifecycleKind,
1772
+ Me as observe,
1773
+ Je as parseHashUrl,
1774
+ Ae as parseHtml,
1775
+ Zt as routerReady,
1754
1776
  ne as showTemplateError,
1755
- we as transformModel
1777
+ ve as transformModel
1756
1778
  };