solely 0.1.6 → 0.1.8

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