xmmath 1.1.1 → 1.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/xmmath.es.js CHANGED
@@ -1,56 +1,56 @@
1
- var yt = Object.defineProperty;
2
- var wt = (t, n, e) => n in t ? yt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[n] = e;
3
- var S = (t, n, e) => (wt(t, typeof n != "symbol" ? n + "" : n, e), e);
4
- const qt = Intl.Segmenter, xt = new qt("emoji", { granularity: "grapheme" }), R = {
1
+ var xt = Object.defineProperty;
2
+ var _t = (t, n, o) => n in t ? xt(t, n, { enumerable: !0, configurable: !0, writable: !0, value: o }) : t[n] = o;
3
+ var S = (t, n, o) => (_t(t, typeof n != "symbol" ? n + "" : n, o), o);
4
+ const jt = Intl.Segmenter, At = new jt("emoji", { granularity: "grapheme" }), J = {
5
5
  emoji: null
6
6
  };
7
- function _t(t) {
8
- const n = /[a-zA-Z]/, e = /[(){}[\]]/, o = /[({[]/, r = /[)}\]]/, l = /^[ \t\n\r]+$/;
9
- let p = "", u = !1;
7
+ function Nt(t) {
8
+ const n = /[a-zA-Z]/, o = /[(){}[\]]/, e = /[({[]/, r = /[)}\]]/, l = /^[ \t\n\r]+$/;
9
+ let u = "", p = !1;
10
10
  const c = [], b = [];
11
11
  let v = c, w = "";
12
12
  t = t.replace(/(\\u\{[\dA-Fa-f]+\})/g, (a) => {
13
13
  const s = parseInt(a.slice(3, -1), 16);
14
14
  return String.fromCodePoint(s);
15
15
  });
16
- let k = R.emoji ? R.emoji(t) : Array.from(xt.segment(t)).map((a) => a.segment);
16
+ let k = J.emoji ? J.emoji(t) : Array.from(At.segment(t)).map((a) => a.segment);
17
17
  const d = [];
18
18
  for (const a of k)
19
19
  a.length > 1 && a.includes(",") ? d.push(...a) : d.push(a);
20
20
  k = d;
21
21
  for (let a = 0; a < k.length; a++) {
22
22
  const s = k[a], i = k[a + 1];
23
- if (s === "/" && i === "/" && (u = "line"), u === "line" && s === `
23
+ if (s === "/" && i === "/" && (p = "line"), p === "line" && s === `
24
24
  `) {
25
- u = !1;
25
+ p = !1;
26
26
  continue;
27
27
  }
28
- if (s === "/" && i === "*" && (u = "block"), u === "block" && s === "*" && i === "/") {
29
- a++, u = !1;
28
+ if (s === "/" && i === "*" && (p = "block"), p === "block" && s === "*" && i === "/") {
29
+ a++, p = !1;
30
30
  continue;
31
31
  }
32
- if (!u) {
33
- if (p === "blank" && !s.match(l) && (v.push({ type: p, value: "" }), p = ""), s === '"' && k[a - 1] !== "\\") {
34
- p !== "str" ? p = "str" : (v.push({ type: p, value: w }), p = "", w = "");
32
+ if (!p) {
33
+ if (u === "blank" && !s.match(l) && (v.push({ type: u, value: "" }), u = ""), s === '"' && k[a - 1] !== "\\") {
34
+ u !== "str" ? u = "str" : (v.push({ type: u, value: w }), u = "", w = "");
35
35
  continue;
36
36
  }
37
- if (p === "str") {
37
+ if (u === "str") {
38
38
  w += s;
39
39
  continue;
40
40
  }
41
- if (s.match(l) && (p = "blank"), s === "#") {
41
+ if (s.match(l) && (u = "blank"), s === "#") {
42
42
  v.push({ type: "sharp", value: "" });
43
43
  continue;
44
44
  }
45
- if (p === "" && (!k[a - 1] || !k[a - 1].match(n)) && (!k[a + 1] || !k[a + 1].match(n)) && !s.match(e)) {
45
+ if (u === "" && (!k[a - 1] || !k[a - 1].match(n)) && (!k[a + 1] || !k[a + 1].match(n)) && !s.match(o)) {
46
46
  v.push({ type: "v", value: s });
47
47
  continue;
48
48
  }
49
- if (p === "" && !s.match(n) && !s.match(e)) {
49
+ if (u === "" && !s.match(n) && !s.match(o)) {
50
50
  v.push({ type: "v", value: s });
51
51
  continue;
52
52
  }
53
- if ((k[a - 1] && k[a - 1].match(n) || k[a + 1] && k[a + 1].match(n)) && s.match(n) && (p = "f"), p === "f" && (w += s), p === "f" && (!k[a + 1] || !k[a + 1].match(n)) && (v.push({ type: p, value: w }), p = "", w = ""), s.match(o))
53
+ if ((k[a - 1] && k[a - 1].match(n) || k[a + 1] && k[a + 1].match(n)) && s.match(n) && (u = "f"), u === "f" && (w += s), u === "f" && (!k[a + 1] || !k[a + 1].match(n)) && (v.push({ type: u, value: w }), u = "", w = ""), s.match(e))
54
54
  if (k[a - 1] === "\\")
55
55
  v.push({ type: "v", value: s, esc: !0 });
56
56
  else {
@@ -62,7 +62,7 @@ function _t(t) {
62
62
  }
63
63
  return c;
64
64
  }
65
- const jt = `{
65
+ const zt = `{
66
66
  "abacus": "🧮",
67
67
  "abc": "🔤",
68
68
  "abcd": "🔡",
@@ -2186,7 +2186,7 @@ const jt = `{
2186
2186
  "zombie": "🧟",
2187
2187
  "zzz": "💤"
2188
2188
  }
2189
- `, At = `{
2189
+ `, $t = `{
2190
2190
  "wj": "⁠",
2191
2191
  "zwj": "‍",
2192
2192
  "zwnj": "‌",
@@ -3914,30 +3914,30 @@ const jt = `{
3914
3914
  }
3915
3915
  ]
3916
3916
  }
3917
- `, Nt = JSON.parse(At);
3918
- function ct(t) {
3917
+ `, Mt = JSON.parse($t);
3918
+ function pt(t) {
3919
3919
  const n = {};
3920
- for (const e in t)
3921
- if (typeof t[e] == "string")
3922
- n[e] = t[e];
3920
+ for (const o in t)
3921
+ if (typeof t[o] == "string")
3922
+ n[o] = t[o];
3923
3923
  else
3924
- for (const o of t[e])
3925
- if (typeof o == "string")
3926
- n[e] = o;
3924
+ for (const e of t[o])
3925
+ if (typeof e == "string")
3926
+ n[o] = e;
3927
3927
  else {
3928
- n[e] || (n[e] = o[Object.keys(o)[0]]);
3929
- for (const r in o) {
3930
- n[`${e}.${r}`] = o[r];
3928
+ n[o] || (n[o] = e[Object.keys(e)[0]]);
3929
+ for (const r in e) {
3930
+ n[`${o}.${r}`] = e[r];
3931
3931
  const l = r.split(".");
3932
- for (let p = 1; p < l.length; p++) {
3933
- const u = l.slice(0, p).join(".");
3934
- o[u] || (n[`${e}.${u}`] = o[r]);
3932
+ for (let u = 1; u < l.length; u++) {
3933
+ const p = l.slice(0, u).join(".");
3934
+ e[p] || (n[`${o}.${p}`] = e[r]);
3935
3935
  }
3936
3936
  }
3937
3937
  }
3938
3938
  return n;
3939
3939
  }
3940
- const _ = ct(Nt), zt = ct(JSON.parse(jt)), V = {
3940
+ const _ = pt(Mt), St = pt(JSON.parse(zt)), B = {
3941
3941
  "->": "arrow.r",
3942
3942
  "|->": "arrow.r.bar",
3943
3943
  "=>": "arrow.r.double",
@@ -3981,10 +3981,10 @@ const _ = ct(Nt), zt = ct(JSON.parse(jt)), V = {
3981
3981
  "'": "prime",
3982
3982
  "~": "space.nobreak"
3983
3983
  };
3984
- let X = 0;
3985
- for (const t in V)
3986
- t.length > X && (X = t.length);
3987
- const $t = ["√", "∛", "∜"], ut = [
3984
+ let Q = 0;
3985
+ for (const t in B)
3986
+ t.length > Q && (Q = t.length);
3987
+ const Ct = ["√", "∛", "∜"], dt = [
3988
3988
  { id: "arccos" },
3989
3989
  { id: "arcsin" },
3990
3990
  { id: "arctan" },
@@ -4028,7 +4028,7 @@ const $t = ["√", "∛", "∜"], ut = [
4028
4028
  { id: "limsup", str: "lim sup", limits: !0 },
4029
4029
  { id: "dif", str: "d" },
4030
4030
  { id: "Dif", str: "D" }
4031
- ], pt = [], dt = /* @__PURE__ */ new Set([
4031
+ ], ht = [], ft = /* @__PURE__ */ new Set([
4032
4032
  "angle.azimuth",
4033
4033
  "angzarr",
4034
4034
  "approx",
@@ -4354,7 +4354,7 @@ const $t = ["√", "∛", "∜"], ut = [
4354
4354
  "tilde.rev",
4355
4355
  "tilde.rev.equiv",
4356
4356
  "tilde.triple"
4357
- ]), ht = [
4357
+ ]), bt = [
4358
4358
  // 大算符:0.11.1 实测 inline 走角标、block(display) 才走上下
4359
4359
  "∏",
4360
4360
  "∐",
@@ -4381,15 +4381,15 @@ const $t = ["√", "∛", "∜"], ut = [
4381
4381
  "⨊"
4382
4382
  ];
4383
4383
  for (const t in _)
4384
- for (const n of ht)
4385
- _[t] === n && pt.push(t);
4384
+ for (const n of bt)
4385
+ _[t] === n && ht.push(t);
4386
4386
  function j(t) {
4387
4387
  return t.type === "group" ? t.kh === "()" ? t.children : [t] : [t];
4388
4388
  }
4389
- function Mt(t) {
4389
+ function Lt(t) {
4390
4390
  return t.length === 1 && t[0].type === "group" && t[0].kh.length > 1 && (t = [y(t[0].kh[0]), ...t[0].children, y(t[0].kh[1])]), t;
4391
4391
  }
4392
- function St(t) {
4392
+ function Tt(t) {
4393
4393
  return [{ type: "group", value: "", children: t, kh: "()" }];
4394
4394
  }
4395
4395
  function N(t) {
@@ -4401,43 +4401,43 @@ function z(t) {
4401
4401
  function T(t) {
4402
4402
  return q(t, { type: "v", value: "/" });
4403
4403
  }
4404
- function ot(t) {
4404
+ function lt(t) {
4405
4405
  return t && t.value === "br" && t.esc;
4406
4406
  }
4407
- const B = /* @__PURE__ */ new Set();
4407
+ const K = /* @__PURE__ */ new Set();
4408
4408
  {
4409
4409
  const t = /* @__PURE__ */ new Set();
4410
4410
  for (const n in _) {
4411
- const e = _[n];
4412
- if (!dt.has(n)) {
4413
- B.has(e) && t.add(e);
4411
+ const o = _[n];
4412
+ if (!ft.has(n)) {
4413
+ K.has(o) && t.add(o);
4414
4414
  continue;
4415
4415
  }
4416
- B.add(e);
4416
+ K.add(o);
4417
4417
  }
4418
4418
  for (const n of t)
4419
- B.delete(n);
4419
+ K.delete(n);
4420
4420
  }
4421
4421
  let E = !0;
4422
- function Ct(t) {
4422
+ function Y(t) {
4423
4423
  E = t;
4424
4424
  }
4425
- function Lt() {
4425
+ function mt() {
4426
4426
  return E;
4427
4427
  }
4428
- function Z(t) {
4428
+ function P(t) {
4429
4429
  if (t.length === 1) {
4430
4430
  const n = t[0];
4431
4431
  if (n.type === "f") {
4432
4432
  if (!n.children || n.children.length === 0) {
4433
- if (dt.has(n.value))
4433
+ if (ft.has(n.value))
4434
4434
  return !0;
4435
- if (pt.includes(n.value))
4435
+ if (ht.includes(n.value))
4436
4436
  return E;
4437
4437
  if (n.value.split(".").at(0) === "arrow")
4438
4438
  return !0;
4439
- for (const e of ut)
4440
- if (e.limits && n.value === e.id)
4439
+ for (const o of dt)
4440
+ if (o.limits && n.value === o.id)
4441
4441
  return E;
4442
4442
  }
4443
4443
  if (n.value === "scripts")
@@ -4445,33 +4445,33 @@ function Z(t) {
4445
4445
  if (n.value === "limits")
4446
4446
  return !0;
4447
4447
  if (n.value === "op") {
4448
- const { dic: e } = mt(n);
4449
- return K(e.limits) && E;
4448
+ const { dic: o } = kt(n);
4449
+ return R(o.limits) && E;
4450
4450
  }
4451
4451
  }
4452
4452
  if (n.type === "v") {
4453
- if (B.has(n.value))
4453
+ if (K.has(n.value))
4454
4454
  return !0;
4455
- if (ht.includes(n.value))
4455
+ if (bt.includes(n.value))
4456
4456
  return E;
4457
4457
  }
4458
4458
  } else
4459
4459
  return !1;
4460
4460
  }
4461
- function J(t) {
4462
- return nt(t, { type: "v", value: "." });
4461
+ function W(t) {
4462
+ return ot(t, { type: "v", value: "." });
4463
4463
  }
4464
- function rt(t) {
4464
+ function st(t) {
4465
4465
  return t && (t.type === "f" || t.type === "v" && t.value.match(/[a-z]/));
4466
4466
  }
4467
- function Tt(t) {
4467
+ function Ot(t) {
4468
4468
  return t && t.type === "v" && t.value === "!" && !t.esc;
4469
4469
  }
4470
4470
  const $ = { type: "v", value: "," };
4471
4471
  function y(t) {
4472
4472
  return { type: "v", value: t };
4473
4473
  }
4474
- function nt(t, n) {
4474
+ function ot(t, n) {
4475
4475
  return !t || !n ? !1 : t.type === n.type && t.value === n.value;
4476
4476
  }
4477
4477
  function q(t, n) {
@@ -4480,67 +4480,67 @@ function q(t, n) {
4480
4480
  function D(t, ...n) {
4481
4481
  return n.includes(t == null ? void 0 : t.type);
4482
4482
  }
4483
- function P(t) {
4483
+ function Z(t) {
4484
4484
  if (!(t != null && t[0]))
4485
4485
  return [];
4486
- let n = 0, e = t.length;
4487
- return t[0].type === "blank" && (n = 1), t.at(-1).type === "blank" && e--, t.slice(n, e);
4486
+ let n = 0, o = t.length;
4487
+ return t[0].type === "blank" && (n = 1), t.at(-1).type === "blank" && o--, t.slice(n, o);
4488
4488
  }
4489
4489
  function H(t) {
4490
4490
  const n = [];
4491
- for (const e in t) {
4492
- n.push({ type: "f", value: e }), n.push({ type: "v", value: ":" });
4493
- for (const o of t[e])
4494
- nt(o, $) && (o.esc = !0);
4495
- n.push(...t[e]), Number(e) + 1 !== Object.keys(t).length && n.push($);
4491
+ for (const o in t) {
4492
+ n.push({ type: "f", value: o }), n.push({ type: "v", value: ":" });
4493
+ for (const e of t[o])
4494
+ ot(e, $) && (e.esc = !0);
4495
+ n.push(...t[o]), Number(o) + 1 !== Object.keys(t).length && n.push($);
4496
4496
  }
4497
4497
  return n;
4498
4498
  }
4499
- function K(t) {
4499
+ function R(t) {
4500
4500
  var n;
4501
- return q((n = P(t)) == null ? void 0 : n[0], { type: "sharp", value: "true" });
4501
+ return q((n = Z(t)) == null ? void 0 : n[0], { type: "sharp", value: "true" });
4502
4502
  }
4503
- function ft(t) {
4504
- var n, e, o;
4503
+ function gt(t) {
4504
+ var n, o, e;
4505
4505
  {
4506
4506
  const r = [], l = /[0-9]/;
4507
- let p = "";
4508
- for (let u = 0; u < t.length; u++) {
4509
- const c = t[u];
4510
- c.value.match(l) || (n = t[u - 1]) != null && n.value.match(l) && J(c) && ((e = t[u + 1]) != null && e.value.match(l)) ? p += c.value : r.push(c), c.value.match(l) && (!t[u + 1] || !t[u + 1].value.match(l)) && !(J(t[u + 1]) && ((o = t[u + 2]) != null && o.value.match(l))) && (r.push({ type: "v", value: p }), p = "");
4507
+ let u = "";
4508
+ for (let p = 0; p < t.length; p++) {
4509
+ const c = t[p];
4510
+ c.value.match(l) || (n = t[p - 1]) != null && n.value.match(l) && W(c) && ((o = t[p + 1]) != null && o.value.match(l)) ? u += c.value : r.push(c), c.value.match(l) && (!t[p + 1] || !t[p + 1].value.match(l)) && !(W(t[p + 1]) && ((e = t[p + 2]) != null && e.value.match(l))) && (r.push({ type: "v", value: u }), u = "");
4511
4511
  }
4512
4512
  t = r;
4513
4513
  }
4514
4514
  {
4515
4515
  const r = [];
4516
4516
  for (let l = 0; l < t.length; l++) {
4517
- const p = t[l];
4518
- if (q(p, y("\\"))) {
4517
+ const u = t[l];
4518
+ if (q(u, y("\\"))) {
4519
4519
  if (t != null && t[l + 1]) {
4520
- const u = t[l + 1];
4521
- if (nt(u, y("\\")))
4520
+ const p = t[l + 1];
4521
+ if (ot(p, y("\\")))
4522
4522
  r.push({ type: "v", value: "\\", esc: !0 }), l++;
4523
- else if (u.type === "blank")
4523
+ else if (p.type === "blank")
4524
4524
  r.push({ type: "v", value: "br", esc: !0 }), l++;
4525
- else if (u.type === "f") {
4526
- const c = u.value;
4525
+ else if (p.type === "f") {
4526
+ const c = p.value;
4527
4527
  r.push({ type: "v", value: c[0] }), r.push({ type: c.length === 2 ? "v" : "f", value: c.slice(1) }), l++;
4528
- } else if (u.type === "sharp")
4528
+ } else if (p.type === "sharp")
4529
4529
  r.push({ type: "v", value: "#" }), l++;
4530
4530
  else {
4531
- const c = u;
4531
+ const c = p;
4532
4532
  c.esc = !0, r.push(c), l++;
4533
4533
  }
4534
4534
  }
4535
4535
  } else
4536
- r.push(p);
4536
+ r.push(u);
4537
4537
  }
4538
4538
  t = r;
4539
4539
  }
4540
4540
  return t;
4541
4541
  }
4542
- function bt(t) {
4543
- var n, e, o, r, l, p, u, c, b, v, w, k;
4542
+ function vt(t) {
4543
+ var n, o, e, r, l, u, p, c, b, v, w, k;
4544
4544
  {
4545
4545
  const d = [];
4546
4546
  for (let a = 0; a < t.length; a++) {
@@ -4550,12 +4550,12 @@ function bt(t) {
4550
4550
  else if (s.type === "v") {
4551
4551
  let i = a, f = s.value;
4552
4552
  const m = [];
4553
- for (V[f] && m.push(f); ((n = t == null ? void 0 : t[i + 1]) == null ? void 0 : n.type) === "v" && f.length <= X; )
4554
- f += t[i + 1].value, V[f] && m.push(f), i++;
4553
+ for (B[f] && m.push(f); ((n = t == null ? void 0 : t[i + 1]) == null ? void 0 : n.type) === "v" && f.length <= Q; )
4554
+ f += t[i + 1].value, B[f] && m.push(f), i++;
4555
4555
  if (m.length) {
4556
4556
  const A = {
4557
4557
  type: "f",
4558
- value: V[m.at(-1)],
4558
+ value: B[m.at(-1)],
4559
4559
  src: m.at(-1)
4560
4560
  };
4561
4561
  d.push(A), a += m.at(-1).length - 1;
@@ -4570,7 +4570,7 @@ function bt(t) {
4570
4570
  const d = [];
4571
4571
  for (let a = 0; a < t.length; a++) {
4572
4572
  const s = t[a];
4573
- s.type === "v" && ((e = t == null ? void 0 : t[a + 1]) == null ? void 0 : e.type) === "blank" && ((o = t == null ? void 0 : t[a + 2]) == null ? void 0 : o.type) === "str" ? (d.push(s), d.push({ type: "f", value: "space" })) : s.type === "str" && ((r = t == null ? void 0 : t[a + 1]) == null ? void 0 : r.type) === "blank" && ((l = t == null ? void 0 : t[a + 2]) == null ? void 0 : l.type) === "v" ? (d.push(s), d.push({ type: "f", value: "space" })) : d.push(s);
4573
+ s.type === "v" && ((o = t == null ? void 0 : t[a + 1]) == null ? void 0 : o.type) === "blank" && ((e = t == null ? void 0 : t[a + 2]) == null ? void 0 : e.type) === "str" ? (d.push(s), d.push({ type: "f", value: "space" })) : s.type === "str" && ((r = t == null ? void 0 : t[a + 1]) == null ? void 0 : r.type) === "blank" && ((l = t == null ? void 0 : t[a + 2]) == null ? void 0 : l.type) === "v" ? (d.push(s), d.push({ type: "f", value: "space" })) : d.push(s);
4574
4574
  }
4575
4575
  t = d;
4576
4576
  }
@@ -4579,7 +4579,7 @@ function bt(t) {
4579
4579
  let a = [];
4580
4580
  for (let s = 0; s < t.length; s++) {
4581
4581
  const i = t[s];
4582
- Tt(t == null ? void 0 : t[s + 1]) && !N(i) && !z(i) && !T(i) ? a.push(i) : a.length ? (a.push(i), d.push({ type: "group1", value: "", children: a }), a = []) : d.push(i);
4582
+ Ot(t == null ? void 0 : t[s + 1]) && !N(i) && !z(i) && !T(i) ? a.push(i) : a.length ? (a.push(i), d.push({ type: "group1", value: "", children: a }), a = []) : d.push(i);
4583
4583
  }
4584
4584
  t = d;
4585
4585
  }
@@ -4588,7 +4588,7 @@ function bt(t) {
4588
4588
  let a = "";
4589
4589
  for (let s = 0; s < t.length; s++) {
4590
4590
  const i = t[s];
4591
- rt(i) && J(t[s + 1]) ? a || !a && i.type === "f" ? (a += `${i.value}.`, s++) : d.push(i) : a && rt(i) ? (a += i.value, J(t[s + 1]) || (d.push({ type: "f", value: a }), a = "")) : d.push(i);
4591
+ st(i) && W(t[s + 1]) ? a || !a && i.type === "f" ? (a += `${i.value}.`, s++) : d.push(i) : a && st(i) ? (a += i.value, W(t[s + 1]) || (d.push({ type: "f", value: a }), a = "")) : d.push(i);
4592
4592
  }
4593
4593
  t = d;
4594
4594
  }
@@ -4596,13 +4596,13 @@ function bt(t) {
4596
4596
  const d = [];
4597
4597
  for (let a = 0; a < t.length; a++) {
4598
4598
  const s = t[a];
4599
- if (s.type === "v" && $t.includes(s.value) && t[a + 1]) {
4599
+ if (s.type === "v" && Ct.includes(s.value) && t[a + 1]) {
4600
4600
  s.type = "f";
4601
4601
  const i = t[a + 1], f = [];
4602
4602
  let m = a + 1, A = a + 2;
4603
4603
  for (; ; ) {
4604
4604
  let M = A;
4605
- for (; ((p = t[M]) == null ? void 0 : p.type) === "blank"; )
4605
+ for (; ((u = t[M]) == null ? void 0 : u.type) === "blank"; )
4606
4606
  M++;
4607
4607
  const O = t[M];
4608
4608
  if (!O)
@@ -4687,7 +4687,7 @@ function bt(t) {
4687
4687
  const i = t[s], f = t[s + 1];
4688
4688
  if (D(f, "group") && f.kh !== "()" && D(i, "f", "str", "v") && !i.value.match(/[0-9]/) && !z(i) && !N(i) && // `#box(...)` 的名字归下面的「处理#」(它吃 tree[n+1] 的值),
4689
4689
  // 这里抢先粘成 group1 会让 sharp 变成空值、名字连同参数被丢掉
4690
- ((u = t[s - 1]) == null ? void 0 : u.type) !== "sharp" && (!(D(i, "f") && a.includes(i.src) || D(i, "v") && a.includes(i.value)) || i.esc)) {
4690
+ ((p = t[s - 1]) == null ? void 0 : p.type) !== "sharp" && (!(D(i, "f") && a.includes(i.src) || D(i, "v") && a.includes(i.value)) || i.esc)) {
4691
4691
  d.push({ type: "group1", value: "", children: [i, f] }), s++;
4692
4692
  continue;
4693
4693
  }
@@ -4760,7 +4760,7 @@ function bt(t) {
4760
4760
  let f = t[d[0][1]];
4761
4761
  for (let m = d[0][1]; m >= d[0][0]; m--) {
4762
4762
  if (N(t[m - 1]) && z(t[m - 3])) {
4763
- const A = Z([t[m - 4]]) ? { t: j(f), b: j(t[m - 2]) } : { tr: j(f), br: j(t[m - 2]) };
4763
+ const A = P([t[m - 4]]) ? { t: j(f), b: j(t[m - 2]) } : { tr: j(f), br: j(t[m - 2]) };
4764
4764
  f = {
4765
4765
  type: "f",
4766
4766
  value: "attach",
@@ -4769,7 +4769,7 @@ function bt(t) {
4769
4769
  continue;
4770
4770
  }
4771
4771
  if (z(t[m - 1]) && N(t[m - 3])) {
4772
- const A = Z([t[m - 4]]) ? { t: j(t[m - 2]), b: j(f) } : { tr: j(t[m - 2]), br: j(f) };
4772
+ const A = P([t[m - 4]]) ? { t: j(t[m - 2]), b: j(f) } : { tr: j(t[m - 2]), br: j(f) };
4773
4773
  f = {
4774
4774
  type: "f",
4775
4775
  value: "attach",
@@ -4778,7 +4778,7 @@ function bt(t) {
4778
4778
  continue;
4779
4779
  }
4780
4780
  if (N(t[m - 1])) {
4781
- const A = Z([t[m - 2]]) ? { t: j(f) } : { tr: j(f) };
4781
+ const A = P([t[m - 2]]) ? { t: j(f) } : { tr: j(f) };
4782
4782
  f = {
4783
4783
  type: "f",
4784
4784
  value: "attach",
@@ -4787,7 +4787,7 @@ function bt(t) {
4787
4787
  continue;
4788
4788
  }
4789
4789
  if (z(t[m - 1])) {
4790
- const A = Z([t[m - 2]]) ? { b: j(f) } : { br: j(f) };
4790
+ const A = P([t[m - 2]]) ? { b: j(f) } : { br: j(f) };
4791
4791
  f = {
4792
4792
  type: "f",
4793
4793
  value: "attach",
@@ -4833,30 +4833,30 @@ function bt(t) {
4833
4833
  }
4834
4834
  return t;
4835
4835
  }
4836
- function mt(t) {
4836
+ function kt(t) {
4837
4837
  const n = [[]];
4838
4838
  for (const c of t.children)
4839
4839
  q(c, { type: "v", value: "," }) || q(c, { type: "v", value: ";" }) ? (n.push(c.value), n.push([])) : n.at(-1).push(c);
4840
- const e = [], o = [];
4840
+ const o = [], e = [];
4841
4841
  for (const c of n)
4842
- typeof c == "string" ? o.push(c) : c.find(
4842
+ typeof c == "string" ? e.push(c) : c.find(
4843
4843
  (b, v) => D(c[v - 1], "f", "v") && q(b, { type: "v", value: ":" })
4844
- ) ? e.push(c) : o.push(c);
4844
+ ) ? o.push(c) : e.push(c);
4845
4845
  let r = [];
4846
- for (let c = 0; c < o.length; c++) {
4847
- const b = o[c], v = o[c + 1];
4848
- b === "," && v === ";" || b === ";" && v === "," ? (r.push(";"), c++) : r.push(o[c]);
4846
+ for (let c = 0; c < e.length; c++) {
4847
+ const b = e[c], v = e[c + 1];
4848
+ b === "," && v === ";" || b === ";" && v === "," ? (r.push(";"), c++) : r.push(e[c]);
4849
4849
  }
4850
4850
  let l;
4851
4851
  if (typeof r.at(-1) == "string" && (r = r.slice(0, -1)), r.includes(";")) {
4852
- let c = Ot(r, (b) => b === ";");
4852
+ let c = Dt(r, (b) => b === ";");
4853
4853
  c.at(-1)[0].length === 0 && (c = c.slice(0, -1)), l = c.map((b) => b.filter((v) => typeof v != "string"));
4854
4854
  } else
4855
4855
  l = r.filter((c) => typeof c != "string").map(
4856
- (c) => P(c)
4856
+ (c) => Z(c)
4857
4857
  );
4858
- const u = {};
4859
- for (const c of e) {
4858
+ const p = {};
4859
+ for (const c of o) {
4860
4860
  let b = !1, v = "";
4861
4861
  const w = [];
4862
4862
  for (const k of c) {
@@ -4866,46 +4866,46 @@ function mt(t) {
4866
4866
  }
4867
4867
  b ? w.push(k) : v += k.value;
4868
4868
  }
4869
- u[v] = bt(ft(w));
4869
+ p[v] = vt(gt(w));
4870
4870
  }
4871
- return { attr: l, dic: u };
4871
+ return { attr: l, dic: p };
4872
4872
  }
4873
- function Ot(t, n) {
4874
- const e = [[]];
4875
- for (const o of t)
4876
- n(o) ? e.push([]) : e.at(-1).push(o);
4877
- return e;
4873
+ function Dt(t, n) {
4874
+ const o = [[]];
4875
+ for (const e of t)
4876
+ n(e) ? o.push([]) : o.at(-1).push(e);
4877
+ return o;
4878
4878
  }
4879
- class G {
4879
+ class U {
4880
4880
  constructor(n) {
4881
4881
  S(this, "type", "text");
4882
4882
  this.text = n;
4883
4883
  }
4884
4884
  }
4885
- class Dt {
4885
+ class Et {
4886
4886
  constructor() {
4887
4887
  S(this, "type", "frag");
4888
4888
  S(this, "childNodes", []);
4889
4889
  }
4890
4890
  append(...n) {
4891
- et(this.childNodes, n);
4891
+ rt(this.childNodes, n);
4892
4892
  }
4893
4893
  }
4894
- class Et {
4895
- constructor(n, e, o) {
4894
+ class Ht {
4895
+ constructor(n, o, e) {
4896
4896
  S(this, "type", "el");
4897
4897
  S(this, "attrs", {});
4898
4898
  S(this, "style", {});
4899
4899
  S(this, "childNodes", []);
4900
- if (this.tag = n, e && this.childNodes.push(new G(e)), o)
4901
- for (const r in o)
4902
- this.attrs[r] = o[r];
4900
+ if (this.tag = n, o && this.childNodes.push(new U(o)), e)
4901
+ for (const r in e)
4902
+ this.attrs[r] = e[r];
4903
4903
  }
4904
4904
  append(...n) {
4905
- et(this.childNodes, n);
4905
+ rt(this.childNodes, n);
4906
4906
  }
4907
- setAttribute(n, e) {
4908
- this.attrs[n] = e;
4907
+ setAttribute(n, o) {
4908
+ this.attrs[n] = o;
4909
4909
  }
4910
4910
  getAttribute(n) {
4911
4911
  return this.attrs[n] ?? null;
@@ -4917,86 +4917,86 @@ class Et {
4917
4917
  return this.childNodes.filter((n) => n.type === "text").map((n) => n.text).join("");
4918
4918
  }
4919
4919
  set textContent(n) {
4920
- this.childNodes.length = 0, n && this.childNodes.push(new G(n));
4920
+ this.childNodes.length = 0, n && this.childNodes.push(new U(n));
4921
4921
  }
4922
4922
  get innerHTML() {
4923
- return this.childNodes.map(W).join("");
4923
+ return this.childNodes.map(G).join("");
4924
4924
  }
4925
4925
  set innerHTML(n) {
4926
- this.childNodes.length = 0, this.childNodes.push(new G(n));
4926
+ this.childNodes.length = 0, this.childNodes.push(new U(n));
4927
4927
  }
4928
4928
  querySelectorAll(n) {
4929
- const e = [];
4930
- return Q(this, n, e), e;
4929
+ const o = [];
4930
+ return tt(this, n, o), o;
4931
4931
  }
4932
4932
  }
4933
- function et(t, n) {
4934
- for (const e of n)
4935
- if (e) {
4936
- if (Array.isArray(e)) {
4937
- et(t, e);
4933
+ function rt(t, n) {
4934
+ for (const o of n)
4935
+ if (o) {
4936
+ if (Array.isArray(o)) {
4937
+ rt(t, o);
4938
4938
  continue;
4939
4939
  }
4940
- e.type === "frag" ? t.push(...e.childNodes) : t.push(e);
4940
+ o.type === "frag" ? t.push(...o.childNodes) : t.push(o);
4941
4941
  }
4942
4942
  }
4943
- function Q(t, n, e) {
4944
- for (const o of t.childNodes)
4945
- o.type === "el" ? (o.tag === n && e.push(o), Q(o, n, e)) : o.type === "frag" && Q(o, n, e);
4943
+ function tt(t, n, o) {
4944
+ for (const e of t.childNodes)
4945
+ e.type === "el" ? (e.tag === n && o.push(e), tt(e, n, o)) : e.type === "frag" && tt(e, n, o);
4946
4946
  }
4947
- function h(t, n, e) {
4948
- return new Et(t, n, e);
4947
+ function h(t, n, o) {
4948
+ return new Ht(t, n, o);
4949
4949
  }
4950
- function gt() {
4951
- return new Dt();
4950
+ function yt() {
4951
+ return new Et();
4952
4952
  }
4953
- function Ht(t) {
4953
+ function Pt(t) {
4954
4954
  return t.replace(/[A-Z]/g, (n) => "-" + n.toLowerCase());
4955
4955
  }
4956
- function Pt(t) {
4956
+ function Zt(t) {
4957
4957
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/\u00A0/g, "&nbsp;");
4958
4958
  }
4959
- function lt(t) {
4959
+ function at(t) {
4960
4960
  return t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/\u00A0/g, "&nbsp;");
4961
4961
  }
4962
- function W(t) {
4962
+ function G(t) {
4963
4963
  if (t.type === "text")
4964
- return Pt(t.text);
4964
+ return Zt(t.text);
4965
4965
  if (t.type === "frag")
4966
- return t.childNodes.map(W).join("");
4966
+ return t.childNodes.map(G).join("");
4967
4967
  let n = `<${t.tag}`;
4968
- for (const o in t.attrs)
4969
- n += ` ${o}="${lt(t.attrs[o])}"`;
4970
- const e = Object.keys(t.style);
4971
- if (e.length) {
4972
- const o = e.map((r) => `${Ht(r)}: ${t.style[r]}`).join("; ");
4973
- n += ` style="${lt(o)}"`;
4968
+ for (const e in t.attrs)
4969
+ n += ` ${e}="${at(t.attrs[e])}"`;
4970
+ const o = Object.keys(t.style);
4971
+ if (o.length) {
4972
+ const e = o.map((r) => `${Pt(r)}: ${t.style[r]}`).join("; ");
4973
+ n += ` style="${at(e)}"`;
4974
4974
  }
4975
- return n += ">", n += t.childNodes.map(W).join(""), n += `</${t.tag}>`, n;
4975
+ return n += ">", n += t.childNodes.map(G).join(""), n += `</${t.tag}>`, n;
4976
4976
  }
4977
- function Zt(t) {
4978
- return W(t);
4977
+ function It(t) {
4978
+ return G(t);
4979
4979
  }
4980
- const It = "http://www.w3.org/1998/Math/MathML";
4981
- function Y(t, n = globalThis.document) {
4980
+ const Ft = "http://www.w3.org/1998/Math/MathML";
4981
+ function nt(t, n = globalThis.document) {
4982
4982
  if (t.type === "text")
4983
4983
  return n.createTextNode(t.text);
4984
4984
  if (t.type === "frag") {
4985
- const o = n.createDocumentFragment();
4985
+ const e = n.createDocumentFragment();
4986
4986
  for (const r of t.childNodes)
4987
- o.append(Y(r, n));
4988
- return o;
4987
+ e.append(nt(r, n));
4988
+ return e;
4989
4989
  }
4990
- const e = n.createElementNS(It, t.tag);
4991
- for (const o in t.attrs)
4992
- e.setAttribute(o, t.attrs[o]);
4993
- for (const o in t.style)
4994
- e.style[o] = t.style[o];
4995
- for (const o of t.childNodes)
4996
- e.append(Y(o, n));
4997
- return e;
4990
+ const o = n.createElementNS(Ft, t.tag);
4991
+ for (const e in t.attrs)
4992
+ o.setAttribute(e, t.attrs[e]);
4993
+ for (const e in t.style)
4994
+ o.style[e] = t.style[e];
4995
+ for (const e of t.childNodes)
4996
+ o.append(nt(e, n));
4997
+ return o;
4998
4998
  }
4999
- const C = "mathvariant", Ft = {
4999
+ const C = "mathvariant", Vt = {
5000
5000
  "(": ["(", ")"],
5001
5001
  "[": ["[", "]"],
5002
5002
  "{": ["{", "}"],
@@ -5004,94 +5004,109 @@ const C = "mathvariant", Ft = {
5004
5004
  "||": ["‖", "‖"],
5005
5005
  "": ["", ""]
5006
5006
  };
5007
- function U(t, n) {
5008
- const e = L(t, "delim");
5009
- let o = "";
5010
- return e !== null && (e === void 0 ? o = n : o = e), Ft[o];
5007
+ function Bt(t) {
5008
+ const n = t.length === 2 && t[0].type === "f" && t[0].value !== "prime" && t[1].type === "group" && t[1].kh === "()" ? [{ ...t[0], children: t[1].children }] : t;
5009
+ return !!P(n);
5010
+ }
5011
+ function I(t, n) {
5012
+ const o = mt();
5013
+ Y(t);
5014
+ try {
5015
+ return n();
5016
+ } finally {
5017
+ Y(o);
5018
+ }
5019
+ }
5020
+ function X(t, n) {
5021
+ const o = L(t, "delim");
5022
+ let e = "";
5023
+ return o !== null && (o === void 0 ? e = n : e = o), Vt[e];
5011
5024
  }
5012
5025
  const x = {
5013
- accent: (t, n, e) => {
5014
- const o = h("mrow");
5015
- o.append(g(t[0], e));
5026
+ accent: (t, n, o) => {
5027
+ const e = h("mrow");
5028
+ e.append(g(t[0], o));
5016
5029
  const r = h("mrow");
5017
- r.append(g(t[1], e)), r.children[0].innerHTML = Kt(r.children[0].innerHTML);
5030
+ r.append(g(t[1], o)), r.children[0].innerHTML = Jt(r.children[0].innerHTML);
5018
5031
  const l = h("mover");
5019
- return l.setAttribute("accent", "true"), l.append(o, r), l;
5032
+ return l.setAttribute("accent", "true"), l.append(e, r), l;
5020
5033
  },
5021
- attach: (t, n, e) => {
5022
- const o = h("mrow");
5023
- o.append(g(t[0]));
5024
- let r;
5025
- const l = h("mrow");
5026
- n.tl && l.append(g(n.tl, e));
5027
- const p = h("mrow");
5028
- n.bl && p.append(g(n.bl, e));
5034
+ attach: (t, n, o) => {
5035
+ const e = { ...n };
5036
+ Bt(t[0]) || (e.t && !e.tr && (e.tr = e.t, delete e.t), e.b && !e.br && (e.br = e.b, delete e.b));
5037
+ const r = h("mrow");
5038
+ r.append(g(t[0]));
5039
+ let l;
5029
5040
  const u = h("mrow");
5030
- n.tr && u.append(g(n.tr, e));
5041
+ e.tl && u.append(g(e.tl, o));
5042
+ const p = h("mrow");
5043
+ e.bl && p.append(g(e.bl, o));
5031
5044
  const c = h("mrow");
5032
- if (n.br && c.append(g(n.br, e)), (n.tl || n.bl || n.tr || n.br) && (n.tl || n.bl ? (r = h("mmultiscripts"), r.append(o, c, u, h("mprescripts"), p, l)) : n.tr && n.br ? (r = h("msubsup"), r.append(o, c, u)) : n.tr ? (r = h("msup"), r.append(o, u)) : (r = h("msub"), r.append(o, c))), n.t || n.b) {
5033
- const b = h("munderover");
5034
- r ? b.append(r) : b.append(o);
5035
- const v = h("mrow");
5036
- n.t && v.append(g(n.t, e));
5045
+ e.tr && c.append(g(e.tr, o));
5046
+ const b = h("mrow");
5047
+ if (e.br && b.append(g(e.br, o)), (e.tl || e.bl || e.tr || e.br) && (e.tl || e.bl ? (l = h("mmultiscripts"), l.append(r, b, c, h("mprescripts"), p, u)) : e.tr && e.br ? (l = h("msubsup"), l.append(r, b, c)) : e.tr ? (l = h("msup"), l.append(r, c)) : (l = h("msub"), l.append(r, b))), e.t || e.b) {
5048
+ const v = h("munderover");
5049
+ l ? v.append(l) : v.append(r);
5037
5050
  const w = h("mrow");
5038
- n.b && w.append(g(n.b, e)), b.append(w, v), r = b;
5051
+ e.t && w.append(g(e.t, o));
5052
+ const k = h("mrow");
5053
+ e.b && k.append(g(e.b, o)), v.append(k, w), l = v;
5039
5054
  }
5040
- return r;
5055
+ return l;
5041
5056
  },
5042
- scripts: (t, n, e) => g(t[0], e),
5043
- limits: (t, n, e) => g(t[0], e),
5044
- binom: (t, n, e) => {
5045
- const o = h("mrow"), r = h("mrow");
5046
- r.append(g(t[0], e));
5047
- const l = h("mrow"), p = [];
5057
+ scripts: (t, n, o) => g(t[0], o),
5058
+ limits: (t, n, o) => g(t[0], o),
5059
+ binom: (t, n, o) => {
5060
+ const e = h("mrow"), r = h("mrow");
5061
+ r.append(g(t[0], o));
5062
+ const l = h("mrow"), u = [];
5048
5063
  for (const v of t.slice(1))
5049
- p.push(...v, $);
5050
- l.append(g(p.slice(0, -1), e));
5051
- const u = h("mfrac", null, { linethickness: "0" });
5052
- u.append(r, l);
5064
+ u.push(...v, $);
5065
+ l.append(g(u.slice(0, -1), o));
5066
+ const p = h("mfrac", null, { linethickness: "0" });
5067
+ p.append(r, l);
5053
5068
  const c = h("mo", "("), b = h("mo", ")");
5054
- return o.append(c, u, b), o;
5069
+ return e.append(c, p, b), e;
5055
5070
  },
5056
- cancel: (t, n, e) => {
5057
- const o = h("mrow"), r = (p) => `linear-gradient(to ${p ? "left" : "right"} top, transparent 47.75%, currentColor 49.5%, currentColor 50.5%, transparent 52.25%)`;
5071
+ cancel: (t, n, o) => {
5072
+ const e = h("mrow"), r = (u) => `linear-gradient(to ${u ? "left" : "right"} top, transparent 47.75%, currentColor 49.5%, currentColor 50.5%, transparent 52.25%)`;
5058
5073
  let l = "";
5059
- return K(n.cross) ? l = `${r(!0)},${r(!1)}` : K(n.inverted) ? l = r(!1) : l = r(!0), o.style.backgroundImage = l, o.append(g(t[0], e)), o;
5074
+ return R(n.cross) ? l = `${r(!0)},${r(!1)}` : R(n.inverted) ? l = r(!1) : l = r(!0), e.style.backgroundImage = l, e.append(g(t[0], o)), e;
5060
5075
  },
5061
- cases: (t, n, e) => {
5062
- const o = h("mrow"), r = U(n, "{"), l = x.x_table(t, { cases: [] }, e), p = L(n, "gap") || "0.5em";
5063
- if (l.setAttribute("rowspacing", p), K(n == null ? void 0 : n.reverse)) {
5064
- const u = h("mo", r[1]);
5065
- o.append(l, u);
5076
+ cases: (t, n, o) => {
5077
+ const e = h("mrow"), r = X(n, "{"), l = x.x_table(t, { cases: [] }, o), u = L(n, "gap") || "0.5em";
5078
+ if (l.setAttribute("rowspacing", u), R(n == null ? void 0 : n.reverse)) {
5079
+ const p = h("mo", r[1]);
5080
+ e.append(l, p);
5066
5081
  } else {
5067
- const u = h("mo", r[0]);
5068
- o.append(u, l);
5082
+ const p = h("mo", r[0]);
5083
+ e.append(p, l);
5069
5084
  }
5070
- return o;
5085
+ return e;
5071
5086
  },
5072
- frac: (t, n, e) => {
5073
- const o = h("mrow");
5074
- o.append(g(t[0], e));
5087
+ frac: (t, n, o) => {
5088
+ const e = h("mrow");
5089
+ e.append(g(t[0], o));
5075
5090
  const r = h("mrow");
5076
- r.append(g(t[1], e));
5091
+ r.append(g(t[1], o));
5077
5092
  const l = h("mfrac");
5078
- return l.append(o, r), l;
5093
+ return l.append(e, r), l;
5079
5094
  },
5080
- lr: (t, n, e) => {
5081
- const o = vt(t.map((c) => Mt(c))), r = P(o), l = L(n, "size"), p = g(r, e), u = h("mrow");
5082
- if (u.append(p), l && l !== "auto") {
5083
- const c = u.children[0], b = u.children[u.children.length - 1];
5095
+ lr: (t, n, o) => {
5096
+ const e = wt(t.map((c) => Lt(c))), r = Z(e), l = L(n, "size"), u = g(r, o), p = h("mrow");
5097
+ if (p.append(u), l && l !== "auto") {
5098
+ const c = p.children[0], b = p.children[p.children.length - 1];
5084
5099
  c == null || c.setAttribute("maxsize", l), c == null || c.setAttribute("minsize", l), b == null || b.setAttribute("maxsize", l), b == null || b.setAttribute("minsize", l);
5085
5100
  }
5086
- return u;
5101
+ return p;
5087
5102
  },
5088
5103
  mid: (t, n) => {
5089
- var o, r;
5090
- return h("mo", (r = (o = t == null ? void 0 : t[0]) == null ? void 0 : o[0]) == null ? void 0 : r.value, { stretchy: "true" });
5104
+ var e, r;
5105
+ return h("mo", (r = (e = t == null ? void 0 : t[0]) == null ? void 0 : e[0]) == null ? void 0 : r.value, { stretchy: "true" });
5091
5106
  },
5092
- mat: (t, n, e) => {
5107
+ mat: (t, n, o) => {
5093
5108
  var d;
5094
- const o = U(n, "("), r = h("mrow"), l = h("mo", o[0]), p = h("mo", o[1]), u = h("mtable");
5109
+ const e = X(n, "("), r = h("mrow"), l = h("mo", e[0]), u = h("mo", e[1]), p = h("mtable");
5095
5110
  let c;
5096
5111
  (d = t[0][0]) != null && d.type ? c = [t] : c = t;
5097
5112
  const b = L(n, "augment");
@@ -5101,7 +5116,7 @@ const x = {
5101
5116
  const i = [];
5102
5117
  for (let f = 1; f < c.length; f++)
5103
5118
  i.push(f === s);
5104
- u.setAttribute(
5119
+ p.setAttribute(
5105
5120
  "rowlines",
5106
5121
  i.map((f) => f ? "solid" : "none").join(" ")
5107
5122
  );
@@ -5110,129 +5125,139 @@ const x = {
5110
5125
  const i = [];
5111
5126
  for (let f = 1; f < c[0].length; f++)
5112
5127
  i.push(f === a);
5113
- u.setAttribute(
5128
+ p.setAttribute(
5114
5129
  "columnlines",
5115
5130
  i.map((f) => f ? "solid" : "none").join(" ")
5116
5131
  );
5117
5132
  }
5118
5133
  }
5119
5134
  const v = L(n, "gap"), w = L(n, "row-gap"), k = L(n, "column-gap");
5120
- u.setAttribute("columnspacing", k || v || "0.5em"), u.setAttribute("rowspacing", w || v || "0.5em");
5135
+ p.setAttribute("columnspacing", k || v || "0.5em"), p.setAttribute("rowspacing", w || v || "0.5em");
5121
5136
  for (const a of c) {
5122
5137
  const s = h("mtr");
5123
5138
  for (const i of a) {
5124
5139
  const f = h("mtd");
5125
- f.append(g(i, e)), s.append(f);
5140
+ f.append(g(i, o)), s.append(f);
5126
5141
  }
5127
- u.append(s);
5142
+ p.append(s);
5128
5143
  }
5129
- return r.append(l, u, p), r;
5144
+ return r.append(l, p, u), r;
5130
5145
  },
5131
- root: (t, n, e) => {
5132
- const o = h("mrow");
5133
- o.append(g(t[0], e));
5146
+ root: (t, n, o) => {
5147
+ const e = h("mrow");
5148
+ e.append(g(t[0], o));
5134
5149
  const r = h("mrow");
5135
- r.append(g(t[1], e));
5150
+ r.append(g(t[1], o));
5136
5151
  const l = h("mroot");
5137
- return l.append(r, o), l;
5152
+ return l.append(r, e), l;
5138
5153
  },
5139
- sqrt: (t, n, e) => x.root([[], t[0]], null, e),
5140
- display: (t, n, e) => {
5141
- const o = h("mrow", null, { displaystyle: "true" });
5142
- return o.append(g(t[0], e)), o;
5154
+ // msqrt(与 typst html 导出一致:<msqrt>…</msqrt>),被开方数直接作为子元素,
5155
+ // 不包 mrow、不走 mroot——空指数的 mroot 会被 MathML 校验/渲染当成错误结构。
5156
+ sqrt: (t, n, o) => {
5157
+ const e = h("msqrt");
5158
+ return e.append(g(t[0], o)), e;
5143
5159
  },
5144
- inline: (t, n, e) => {
5145
- const o = h("mrow", null, {
5160
+ // display/inline/script/sscript 是局部样式(typst 的样式栈:内层覆盖外层,
5161
+ // `display(script(sum_1^2))` 仍走角标)。limits 的判定在 ast3 的「处理^_」
5162
+ // 里读全局 display 标志,故在渲染子树期间改写它、渲染完恢复;wrapper 用
5163
+ // mstyle 而不是 mrow —— MathML Core 里 displaystyle/scriptlevel 是 mstyle
5164
+ // 的属性,挂在 mrow 上浏览器会忽略(∑ 大小/脚标层级都随之失真)。
5165
+ display: (t, n, o) => I(!0, () => {
5166
+ const e = h("mstyle", null, { displaystyle: "true" });
5167
+ return e.append(g(t[0], o)), e;
5168
+ }),
5169
+ inline: (t, n, o) => I(!1, () => {
5170
+ const e = h("mstyle", null, {
5146
5171
  displaystyle: "false",
5147
5172
  scriptlevel: "0"
5148
5173
  });
5149
- return o.append(g(t[0], e)), o;
5150
- },
5151
- script: (t, n, e) => {
5152
- const o = h("mrow", null, {
5174
+ return e.append(g(t[0], o)), e;
5175
+ }),
5176
+ script: (t, n, o) => I(!1, () => {
5177
+ const e = h("mstyle", null, {
5153
5178
  displaystyle: "false",
5154
5179
  scriptlevel: "1"
5155
5180
  });
5156
- return o.append(g(t[0], e)), o;
5157
- },
5158
- sscript: (t, n, e) => {
5159
- const o = h("mrow", null, {
5181
+ return e.append(g(t[0], o)), e;
5182
+ }),
5183
+ sscript: (t, n, o) => I(!1, () => {
5184
+ const e = h("mstyle", null, {
5160
5185
  displaystyle: "false",
5161
5186
  scriptlevel: "2"
5162
5187
  });
5163
- return o.append(g(t[0], e)), o;
5164
- },
5165
- upright: (t, n, e) => {
5166
- const o = h("mrow");
5167
- return o.append(g(t[0], e)), o.querySelectorAll("mi").forEach((r) => {
5188
+ return e.append(g(t[0], o)), e;
5189
+ }),
5190
+ upright: (t, n, o) => {
5191
+ const e = h("mrow");
5192
+ return e.append(g(t[0], o)), e.querySelectorAll("mi").forEach((r) => {
5168
5193
  r.getAttribute(C) || r.setAttribute(C, "normal");
5169
- }), o.querySelectorAll("ms").forEach((r) => {
5194
+ }), e.querySelectorAll("ms").forEach((r) => {
5170
5195
  r.getAttribute(C) || r.setAttribute(C, "normal");
5171
- }), o;
5196
+ }), e;
5172
5197
  },
5173
- italic: (t, n, e) => {
5174
- const o = h("mrow");
5175
- return o.append(g(t[0], e)), o.querySelectorAll("mi").forEach((r) => {
5198
+ italic: (t, n, o) => {
5199
+ const e = h("mrow");
5200
+ return e.append(g(t[0], o)), e.querySelectorAll("mi").forEach((r) => {
5176
5201
  r.getAttribute(C) || r.setAttribute(C, "italic");
5177
- }), o.querySelectorAll("ms").forEach((r) => {
5202
+ }), e.querySelectorAll("ms").forEach((r) => {
5178
5203
  r.getAttribute(C) || r.setAttribute(C, "italic");
5179
- }), o;
5204
+ }), e;
5180
5205
  },
5181
- bold: (t, n, e) => {
5182
- const o = h("mrow");
5183
- return o.style.fontWeight = "bold", o.append(g(t[0], e)), o;
5206
+ bold: (t, n, o) => {
5207
+ const e = h("mrow");
5208
+ return e.style.fontWeight = "bold", e.append(g(t[0], o)), e;
5184
5209
  },
5185
- op: (t, n, e) => {
5186
- const o = h("mrow"), r = h("ms");
5187
- return r.append(g(t[0], e)), o.append(r), o;
5210
+ op: (t, n, o) => {
5211
+ const e = h("mrow"), r = h("ms");
5212
+ return r.append(g(t[0], o)), e.append(r), e;
5188
5213
  },
5189
- underline: (t, n, e) => at("under", t[0], e),
5190
- overline: (t, n, e) => at("over", t[0], e),
5191
- underbrace: (t, n, e) => I("under", t[0], "⏟", t == null ? void 0 : t[1], e),
5192
- overbrace: (t, n, e) => I("over", t[0], "⏞", t == null ? void 0 : t[1], e),
5193
- underbracket: (t, n, e) => I("under", t[0], "⎵", t == null ? void 0 : t[1], e),
5194
- overbracket: (t, n, e) => I("over", t[0], "⎴", t == null ? void 0 : t[1], e),
5214
+ underline: (t, n, o) => ct("under", t[0], o),
5215
+ overline: (t, n, o) => ct("over", t[0], o),
5216
+ underbrace: (t, n, o) => F("under", t[0], "⏟", t == null ? void 0 : t[1], o),
5217
+ overbrace: (t, n, o) => F("over", t[0], "⏞", t == null ? void 0 : t[1], o),
5218
+ underbracket: (t, n, o) => F("under", t[0], "⎵", t == null ? void 0 : t[1], o),
5219
+ overbracket: (t, n, o) => F("over", t[0], "⎴", t == null ? void 0 : t[1], o),
5195
5220
  serif: (t) => g(t[0], "serif"),
5196
5221
  sans: (t) => g(t[0], "sans"),
5197
5222
  frak: (t) => g(t[0], "frak"),
5198
5223
  mono: (t) => g(t[0], "mono"),
5199
5224
  bb: (t) => g(t[0], "bb"),
5200
5225
  cal: (t) => g(t[0], "cal"),
5201
- vec: (t, n, e) => {
5202
- const o = U(n, "("), r = h("mrow"), l = h("mo", o[0]), p = h("mo", o[1]), u = tt(t, e), c = L(n, "gap") || "0.5em";
5203
- return u.setAttribute("rowspacing", c), u.setAttribute("columnspacing", "0.5em"), r.append(l, u, p), r;
5226
+ vec: (t, n, o) => {
5227
+ const e = X(n, "("), r = h("mrow"), l = h("mo", e[0]), u = h("mo", e[1]), p = et(t, o), c = L(n, "gap") || "0.5em";
5228
+ return p.setAttribute("rowspacing", c), p.setAttribute("columnspacing", "0.5em"), r.append(l, p, u), r;
5204
5229
  },
5205
5230
  h: (t, n) => h("mspace", "", { width: t[0][0].value }),
5206
5231
  // 额外
5207
5232
  //
5208
5233
  x_table: (t, n) => {
5209
- const e = tt(t);
5210
- return n.cases && e.setAttribute("columnalign", "left"), e;
5234
+ const o = et(t);
5235
+ return n.cases && o.setAttribute("columnalign", "left"), o;
5211
5236
  }
5212
5237
  };
5213
- function tt(t, n, e) {
5214
- let o = 0;
5238
+ function et(t, n, o) {
5239
+ let e = 0;
5215
5240
  const r = h("mtable");
5216
5241
  for (const l of t) {
5217
- const p = l.filter((u) => q(u, y("&"))).length;
5218
- p > o && (o = p);
5242
+ const u = l.filter((p) => q(p, y("&"))).length;
5243
+ u > e && (e = u);
5219
5244
  }
5220
5245
  for (const l of t) {
5221
- const p = h("mtr"), u = [[]];
5246
+ const u = h("mtr"), p = [[]];
5222
5247
  for (let b = 0; b < l.length; b++)
5223
- q(l[b], y("&")) ? u.push([]) : u.at(-1).push(l[b]);
5224
- for (const b of u) {
5248
+ q(l[b], y("&")) ? p.push([]) : p.at(-1).push(l[b]);
5249
+ for (const b of p) {
5225
5250
  const v = h("mtd");
5226
- p.append(v), v.append(g(b, n));
5251
+ u.append(v), v.append(g(b, n));
5227
5252
  }
5228
5253
  const c = [];
5229
- for (let b = 0; b <= o; b++)
5230
- o > 0 ? c.push(b % 2 === 0 ? "right" : "left") : c.push(e ? "left" : "center");
5231
- r.setAttribute("columnalign", c.join(" ")), r.setAttribute("columnspacing", "0"), r.append(p);
5254
+ for (let b = 0; b <= e; b++)
5255
+ e > 0 ? c.push(b % 2 === 0 ? "right" : "left") : c.push(o ? "left" : "center");
5256
+ r.setAttribute("columnalign", c.join(" ")), r.setAttribute("columnspacing", "0"), r.append(u);
5232
5257
  }
5233
5258
  return r;
5234
5259
  }
5235
- function Vt(t) {
5260
+ function Kt(t) {
5236
5261
  const n = [
5237
5262
  _.prime,
5238
5263
  _["prime.double"],
@@ -5241,28 +5266,28 @@ function Vt(t) {
5241
5266
  ];
5242
5267
  return t <= 4 ? n[t - 1] : _.prime.repeat(t);
5243
5268
  }
5244
- function Bt() {
5245
- for (const t of ut)
5246
- x[t.id] = (n, e, o) => {
5247
- const r = x.op([[{ type: "str", value: t.str || t.id }]], {}, o);
5269
+ function Rt() {
5270
+ for (const t of dt)
5271
+ x[t.id] = (n, o, e) => {
5272
+ const r = x.op([[{ type: "str", value: t.str || t.id }]], {}, e);
5248
5273
  if (n) {
5249
- const l = gt();
5250
- return l.append(r, Wt(vt(n))), l;
5274
+ const l = yt();
5275
+ return l.append(r, Ut(wt(n))), l;
5251
5276
  } else
5252
5277
  return r;
5253
5278
  };
5254
5279
  }
5255
- Bt();
5256
- const st = {
5280
+ Rt();
5281
+ const it = {
5257
5282
  quad: "1em",
5258
5283
  med: "0.222em",
5259
5284
  thin: "0.17em",
5260
5285
  thick: "0.28em",
5261
5286
  wide: "2em"
5262
5287
  };
5263
- for (const t in st)
5264
- x[t] = () => x.h([[{ type: "str", value: st[t] }]]);
5265
- function Kt(t) {
5288
+ for (const t in it)
5289
+ x[t] = () => x.h([[{ type: "str", value: it[t] }]]);
5290
+ function Jt(t) {
5266
5291
  switch (t) {
5267
5292
  case "̀":
5268
5293
  case "`":
@@ -5333,7 +5358,7 @@ function Kt(t) {
5333
5358
  return t;
5334
5359
  }
5335
5360
  }
5336
- function Rt() {
5361
+ function Wt() {
5337
5362
  const t = [
5338
5363
  "grave",
5339
5364
  "acute",
@@ -5358,10 +5383,10 @@ function Rt() {
5358
5383
  "harpoon.lt"
5359
5384
  ];
5360
5385
  for (const n of t)
5361
- x[n] = (e, o, r) => x.accent([e[0], [{ type: "f", value: n }]], {}, r);
5386
+ x[n] = (o, e, r) => x.accent([o[0], [{ type: "f", value: n }]], {}, r);
5362
5387
  }
5363
- Rt();
5364
- function Jt() {
5388
+ Wt();
5389
+ function Gt() {
5365
5390
  const t = [
5366
5391
  { name: "abs", l: y("|"), r: y("|") },
5367
5392
  { name: "norm", l: y("‖"), r: y("‖") },
@@ -5370,74 +5395,74 @@ function Jt() {
5370
5395
  { name: "round", l: y("⌊"), r: y("⌉") }
5371
5396
  ];
5372
5397
  for (const n of t)
5373
- x[n.name] = (e, o, r) => x.lr([[n.l, ...e[0], n.r]], o, r);
5398
+ x[n.name] = (o, e, r) => x.lr([[n.l, ...o[0], n.r]], e, r);
5374
5399
  }
5375
- Jt();
5376
- function I(t, n, e, o, r) {
5377
- const l = t === "under" ? h("munder", null, { accentunder: "true" }) : h("mover", null, { accent: "true" }), p = h("mrow");
5378
- if (p.append(g(n, r)), o) {
5379
- const u = h("mrow");
5380
- u.append(g(o, r));
5381
- const c = h(t === "under" ? "munder" : "mover"), b = h("mo", e);
5382
- c.append(b, u), l.append(p, c);
5400
+ Gt();
5401
+ function F(t, n, o, e, r) {
5402
+ const l = t === "under" ? h("munder", null, { accentunder: "true" }) : h("mover", null, { accent: "true" }), u = h("mrow");
5403
+ if (u.append(g(n, r)), e) {
5404
+ const p = h("mrow");
5405
+ p.append(g(e, r));
5406
+ const c = h(t === "under" ? "munder" : "mover"), b = h("mo", o);
5407
+ c.append(b, p), l.append(u, c);
5383
5408
  } else {
5384
- const u = h("mo", e);
5385
- l.append(p, u);
5409
+ const p = h("mo", o);
5410
+ l.append(u, p);
5386
5411
  }
5387
5412
  return l;
5388
5413
  }
5389
- function at(t, n, e) {
5390
- const o = t === "under" ? h("munder", null, { accentunder: "true" }) : h("mover", null, { accent: "true" }), r = h("mrow");
5391
- return r.append(g(n, e)), t === "under" && (r.style.borderBottom = "1px solid black"), t === "over" && (r.style.borderTop = "1px solid black"), o.append(r), o;
5414
+ function ct(t, n, o) {
5415
+ const e = t === "under" ? h("munder", null, { accentunder: "true" }) : h("mover", null, { accent: "true" }), r = h("mrow");
5416
+ return r.append(g(n, o)), t === "under" && (r.style.borderBottom = "1px solid black"), t === "over" && (r.style.borderTop = "1px solid black"), e.append(r), e;
5392
5417
  }
5393
- const F = {
5418
+ const V = {
5394
5419
  "√": x.sqrt,
5395
- "∛": (t, n, e) => x.root([[y("3")], t[0]], null, e),
5396
- "∜": (t, n, e) => x.root([[y("4")], t[0]], null, e)
5420
+ "∛": (t, n, o) => x.root([[y("3")], t[0]], null, o),
5421
+ "∜": (t, n, o) => x.root([[y("4")], t[0]], null, o)
5397
5422
  };
5398
- function Wt(t) {
5399
- const n = h("mrow"), e = h("mo");
5400
- e.textContent = "(";
5401
- const o = g(t), r = h("mo");
5402
- return r.textContent = ")", n.append(e, o, r), n;
5423
+ function Ut(t) {
5424
+ const n = h("mrow"), o = h("mo");
5425
+ o.textContent = "(";
5426
+ const e = g(t), r = h("mo");
5427
+ return r.textContent = ")", n.append(o, e, r), n;
5403
5428
  }
5404
- function Gt(t) {
5405
- t = P(t);
5429
+ function Xt(t) {
5430
+ t = Z(t);
5406
5431
  const n = new Object();
5407
- let e = "", o = [];
5432
+ let o = "", e = [];
5408
5433
  t.push($);
5409
5434
  for (let r = 0; r < t.length; r++)
5410
- !e && t[r].type !== "blank" ? e = t[r].value : o.length ? q(t[r], $) ? (n[e] = P(o), e = "", o = []) : o.push(t[r]) : q(t[r], y(":")) && o.push(t[r + 1]);
5435
+ !o && t[r].type !== "blank" ? o = t[r].value : e.length ? q(t[r], $) ? (n[o] = Z(e), o = "", e = []) : e.push(t[r]) : q(t[r], y(":")) && e.push(t[r + 1]);
5411
5436
  return n;
5412
5437
  }
5413
5438
  function L(t, n) {
5414
- var o;
5415
- if (!((o = t == null ? void 0 : t[n]) != null && o[0]))
5439
+ var e;
5440
+ if (!((e = t == null ? void 0 : t[n]) != null && e[0]))
5416
5441
  return;
5417
- const e = t[n][0];
5418
- if (e.type === "sharp") {
5419
- if (e.value === "true")
5442
+ const o = t[n][0];
5443
+ if (o.type === "sharp") {
5444
+ if (o.value === "true")
5420
5445
  return !0;
5421
- if (e.value === "false")
5446
+ if (o.value === "false")
5422
5447
  return !1;
5423
- if (e.value === "none")
5448
+ if (o.value === "none")
5424
5449
  return null;
5425
- if (e.children)
5426
- return e.children.find((r) => q(r, y(":"))) ? Gt(e.children) : e.children.map((r) => r.value).join("");
5450
+ if (o.children)
5451
+ return o.children.find((r) => q(r, y(":"))) ? Xt(o.children) : o.children.map((r) => r.value).join("");
5427
5452
  }
5428
5453
  return t[n].map((r) => r.value).join("");
5429
5454
  }
5430
- function vt(t) {
5455
+ function wt(t) {
5431
5456
  const n = [];
5432
- for (const e of t)
5433
- n.push(...e, y(","));
5457
+ for (const o of t)
5458
+ n.push(...o, y(","));
5434
5459
  return n.slice(0, -1);
5435
5460
  }
5436
- function it(t, n = "serif") {
5437
- function e(r) {
5461
+ function ut(t, n = "serif") {
5462
+ function o(r) {
5438
5463
  return "abcdefghijklmnopqrstuvwxyz".indexOf(r.toLowerCase());
5439
5464
  }
5440
- const o = {
5465
+ const e = {
5441
5466
  sans: {
5442
5467
  num: "𝟢𝟣𝟤𝟥𝟦𝟧𝟨𝟩𝟪𝟫",
5443
5468
  low: "𝖺𝖻𝖼𝖽𝖾𝖿𝗀𝗁𝗂𝗃𝗄𝗅𝗆𝗇𝗈𝗉𝗊𝗋𝗌𝗍𝗎𝗏𝗐𝗑𝗒𝗓",
@@ -5462,59 +5487,59 @@ function it(t, n = "serif") {
5462
5487
  up: "𝒜ℬ𝒞𝒟ℰℱ𝒢ℋℐ𝒥𝒦ℒℳ𝒩𝒪𝒫𝒬ℛ𝒮𝒯𝒰𝒱𝒲𝒳𝒴𝒵"
5463
5488
  }
5464
5489
  };
5465
- return n === "serif" || (t = t.replace(/[0-9]/g, (r) => [...o[n].num][r]), t = t.replace(/[a-z]/g, (r) => [...o[n].low][e(r)]), t = t.replace(/[A-Z]/g, (r) => [...o[n].up][e(r)])), t;
5490
+ return n === "serif" || (t = t.replace(/[0-9]/g, (r) => [...e[n].num][r]), t = t.replace(/[a-z]/g, (r) => [...e[n].low][o(r)]), t = t.replace(/[A-Z]/g, (r) => [...e[n].up][o(r)])), t;
5466
5491
  }
5467
5492
  function g(t, n) {
5468
- const e = gt();
5469
- t = ft(t);
5493
+ const o = yt();
5494
+ t = gt(t);
5470
5495
  {
5471
- let o = !1;
5496
+ let e = !1;
5472
5497
  for (const r in t) {
5473
5498
  const l = t[r];
5474
- if (ot(l)) {
5475
- o = !0;
5499
+ if (lt(l)) {
5500
+ e = !0;
5476
5501
  break;
5477
5502
  }
5478
5503
  }
5479
- if (o) {
5504
+ if (e) {
5480
5505
  const r = [[]];
5481
5506
  for (let l = 0; l < t.length; l++) {
5482
- const p = t[l];
5483
- ot(p) ? r.push([]) : r.at(-1).push(p);
5507
+ const u = t[l];
5508
+ lt(u) ? r.push([]) : r.at(-1).push(u);
5484
5509
  }
5485
- return tt(r, void 0, !Lt());
5510
+ return et(r, void 0, !mt());
5486
5511
  }
5487
5512
  }
5488
- t = bt(t);
5513
+ t = vt(t);
5489
5514
  {
5490
- const o = [];
5515
+ const e = [];
5491
5516
  for (const r of t)
5492
- r.type === "v" && r.value === "&" && !r.esc || o.push(r);
5493
- t = o;
5517
+ r.type === "v" && r.value === "&" && !r.esc || e.push(r);
5518
+ t = e;
5494
5519
  }
5495
5520
  {
5496
- const o = [];
5521
+ const e = [];
5497
5522
  for (const r of t)
5498
- r.type === "group1" ? o.push(...r.children) : o.push(r);
5499
- t = o;
5523
+ r.type === "group1" ? e.push(...r.children) : e.push(r);
5524
+ t = e;
5500
5525
  }
5501
- for (const o in t) {
5502
- const r = Number(o), l = t[r];
5526
+ for (const e in t) {
5527
+ const r = Number(e), l = t[r];
5503
5528
  if (l.type === "f") {
5504
5529
  if (l.children && (l.kh === "()" || !l.kh)) {
5505
- const { attr: p, dic: u } = mt(l);
5530
+ const { attr: u, dic: p } = kt(l);
5506
5531
  if (x[l.value]) {
5507
- const c = x[l.value](p, u, n);
5508
- e.append(c);
5532
+ const c = x[l.value](u, p, n);
5533
+ o.append(c);
5509
5534
  } else if (_[l.value]) {
5510
5535
  const c = h("mi", _[l.value]);
5511
- e.append(c, g(St(l.children), n));
5512
- } else if (F[l.value]) {
5513
- const c = F[l.value](p, u, n);
5514
- e.append(c);
5536
+ o.append(c, g(Tt(l.children), n));
5537
+ } else if (V[l.value]) {
5538
+ const c = V[l.value](u, p, n);
5539
+ o.append(c);
5515
5540
  }
5516
5541
  } else if (_[l.value]) {
5517
- let p, u = null;
5542
+ let u, p = null;
5518
5543
  const c = {
5519
5544
  " ": "0.36em",
5520
5545
  " ": "0.5em",
@@ -5528,60 +5553,60 @@ function g(t, n) {
5528
5553
  " ": "0.17em",
5529
5554
  " ": "0.09em"
5530
5555
  };
5531
- _[l.value].match(/[a-zA-Z\u0391-\u03C9]/) ? p = "mi" : c[_[l.value]] ? (p = "mspace", u = { width: c[_[l.value]] }) : p = "mo";
5532
- const b = h(p, _[l.value], u);
5533
- e.append(b);
5556
+ _[l.value].match(/[a-zA-Z\u0391-\u03C9]/) ? u = "mi" : c[_[l.value]] ? (u = "mspace", p = { width: c[_[l.value]] }) : u = "mo";
5557
+ const b = h(u, _[l.value], p);
5558
+ o.append(b);
5534
5559
  } else if (x[l.value]) {
5535
- const p = x[l.value](null, null, n);
5536
- e.append(p);
5537
- } else if (F[l.value]) {
5538
- const p = F[l.value]([l.children], null, n);
5539
- e.append(p);
5560
+ const u = x[l.value](null, null, n);
5561
+ o.append(u);
5562
+ } else if (V[l.value]) {
5563
+ const u = V[l.value]([l.children], null, n);
5564
+ o.append(u);
5540
5565
  }
5541
5566
  }
5542
5567
  if (l.type === "str") {
5543
- const p = h("ms", it(l.value, n));
5544
- e.append(p);
5568
+ const u = h("ms", ut(l.value, n));
5569
+ o.append(u);
5545
5570
  }
5546
5571
  if (l.type === "v" || l.type === "sharp") {
5547
- let p, u = l.value;
5548
- l.value.match(/[0-9.]+/) ? p = "mn" : l.value.match(/[a-zA-Z\u0391-\u03C9]/) ? p = "mi" : (l.value.match(/^'+$/) && (l.esc || (u = Vt(l.value.length))), p = "mo"), l.type === "sharp" && l.value.startsWith("emoji.") && (p = "mi", u = zt[l.value.replace("emoji.", "")]);
5549
- const c = h(p, it(u, n));
5550
- e.append(c);
5572
+ let u, p = l.value;
5573
+ l.value.match(/[0-9.]+/) ? u = "mn" : l.value.match(/[a-zA-Z\u0391-\u03C9]/) ? u = "mi" : (l.value.match(/^'+$/) && (l.esc || (p = Kt(l.value.length))), u = "mo"), l.type === "sharp" && l.value.startsWith("emoji.") && (u = "mi", p = St[l.value.replace("emoji.", "")]);
5574
+ const c = h(u, ut(p, n));
5575
+ o.append(c);
5551
5576
  }
5552
- l.type === "group" && (l.kh && l.kh.length === 1 ? (e.append(h("mo", l.kh, { stretchy: "false" })), e.append(g(l.children, n))) : e.append(x.lr([[l]], null, n)));
5577
+ l.type === "group" && (l.kh && l.kh.length === 1 ? (o.append(h("mo", l.kh, { stretchy: "false" })), o.append(g(l.children, n))) : o.append(x.lr([[l]], null, n)));
5553
5578
  }
5554
- return e;
5579
+ return o;
5555
5580
  }
5556
- function Qt(t) {
5581
+ function tn(t) {
5557
5582
  for (const n in t)
5558
- R[n] && (R[n] = t[n]);
5583
+ J[n] && (J[n] = t[n]);
5559
5584
  }
5560
- function kt(t, n) {
5561
- Ct(!n);
5562
- const e = _t(t), o = h("math");
5563
- n || o.setAttribute("display", "block");
5564
- const r = g(e);
5565
- return o.append(r), o;
5585
+ function qt(t, n) {
5586
+ Y(!n);
5587
+ const o = Nt(t), e = h("math");
5588
+ n || e.setAttribute("display", "block");
5589
+ const r = g(o);
5590
+ return e.append(r), e;
5566
5591
  }
5567
- function Yt(t, n) {
5568
- return Y(kt(t, n));
5592
+ function nn(t, n) {
5593
+ return nt(qt(t, n));
5569
5594
  }
5570
- function tn(t) {
5571
- return Zt(kt(t));
5595
+ function en(t, n) {
5596
+ return It(qt(t, n));
5572
5597
  }
5573
- const nn = {
5598
+ const on = {
5574
5599
  lan: "0.11.1",
5575
5600
  symbol: "0.15.1",
5576
5601
  emoji: "0.15.1"
5577
5602
  };
5578
5603
  export {
5579
- ft as ast2,
5580
- bt as ast3,
5581
- Qt as init,
5582
- Yt as toMML,
5583
- tn as toMMLHTML,
5584
- kt as toMMLV,
5585
- nn as version
5604
+ gt as ast2,
5605
+ vt as ast3,
5606
+ tn as init,
5607
+ nn as toMML,
5608
+ en as toMMLHTML,
5609
+ qt as toMMLV,
5610
+ on as version
5586
5611
  };
5587
5612
  //# sourceMappingURL=xmmath.es.js.map