solely 0.1.1 → 0.1.3

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