vue3-math-editor 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,7 +29,7 @@ function k(e) {
29
29
  default: return [];
30
30
  }
31
31
  }
32
- function ye(e) {
32
+ function A(e) {
33
33
  if (e === "otherwise") return { part: "otherwise" };
34
34
  let t = /^(value|cond)(\d+)$/.exec(e);
35
35
  return t ? {
@@ -37,9 +37,9 @@ function ye(e) {
37
37
  piece: Number(t[2])
38
38
  } : null;
39
39
  }
40
- function A(e, t, n) {
40
+ function j(e, t, n) {
41
41
  if (e.kind === "piecewise") {
42
- let r = ye(t);
42
+ let r = A(t);
43
43
  if (!r) throw Error(`No branch ${t} in a piecewise`);
44
44
  if (r.part === "otherwise") return {
45
45
  ...e,
@@ -62,93 +62,93 @@ function A(e, t, n) {
62
62
  [t]: n
63
63
  };
64
64
  }
65
- function be(e, t) {
65
+ function ye(e, t) {
66
66
  return k(e).find(([e]) => e === t)?.[1] ?? null;
67
67
  }
68
- function j(e, t) {
68
+ function M(e, t) {
69
69
  let n = e;
70
70
  for (let e of t) {
71
71
  let t = n[e.atom];
72
72
  if (!t) return null;
73
- let r = be(t, e.branch);
73
+ let r = ye(t, e.branch);
74
74
  if (!r) return null;
75
75
  n = r;
76
76
  }
77
77
  return n;
78
78
  }
79
- function M(e, t) {
79
+ function N(e, t) {
80
80
  return e.length === t.length && e.every((e, n) => e.atom === t[n].atom && e.branch === t[n].branch);
81
81
  }
82
- var xe = 0;
83
- function N() {
84
- return xe += 1, `a${xe}`;
82
+ var be = 0;
83
+ function P() {
84
+ return be += 1, `a${be}`;
85
85
  }
86
- function P(e) {
86
+ function F(e) {
87
87
  return {
88
88
  kind: "symbol",
89
- id: N(),
89
+ id: P(),
90
90
  value: e
91
91
  };
92
92
  }
93
- function F(e) {
93
+ function I(e) {
94
94
  return {
95
95
  kind: "function",
96
- id: N(),
96
+ id: P(),
97
97
  name: e
98
98
  };
99
99
  }
100
- function Se(e = [], t = []) {
100
+ function xe(e = [], t = []) {
101
101
  return {
102
102
  kind: "fraction",
103
- id: N(),
103
+ id: P(),
104
104
  num: e,
105
105
  den: t
106
106
  };
107
107
  }
108
- function Ce(e = []) {
108
+ function Se(e = []) {
109
109
  return {
110
110
  kind: "superscript",
111
- id: N(),
111
+ id: P(),
112
112
  sup: e
113
113
  };
114
114
  }
115
- function we(e = [], t = null) {
115
+ function Ce(e = [], t = null) {
116
116
  return {
117
117
  kind: "root",
118
- id: N(),
118
+ id: P(),
119
119
  index: t,
120
120
  body: e
121
121
  };
122
122
  }
123
- function I(e = [], t = "(", n) {
123
+ function L(e = [], t = "(", n) {
124
124
  let r = n ?? O[t] ?? t;
125
125
  return {
126
126
  kind: "group",
127
- id: N(),
127
+ id: P(),
128
128
  open: t,
129
129
  close: r,
130
130
  body: e
131
131
  };
132
132
  }
133
- function Te(e = [], t = []) {
133
+ function we(e = [], t = []) {
134
134
  return {
135
135
  kind: "derivative",
136
- id: N(),
136
+ id: P(),
137
137
  expr: e,
138
138
  variable: t
139
139
  };
140
140
  }
141
- function Ee(e = []) {
141
+ function Te(e = []) {
142
142
  return {
143
143
  kind: "units",
144
- id: N(),
144
+ id: P(),
145
145
  units: e
146
146
  };
147
147
  }
148
- function De(e = [[[], []]], t = null) {
148
+ function Ee(e = [[[], []]], t = null) {
149
149
  return {
150
150
  kind: "piecewise",
151
- id: N(),
151
+ id: P(),
152
152
  pieces: e.map(([e, t]) => ({
153
153
  value: e,
154
154
  condition: t
@@ -156,12 +156,12 @@ function De(e = [[[], []]], t = null) {
156
156
  otherwise: t
157
157
  };
158
158
  }
159
- function L(...e) {
160
- return e.flatMap((e) => typeof e == "string" ? Array.from(e).map((e) => P(e)) : [e]);
159
+ function R(...e) {
160
+ return e.flatMap((e) => typeof e == "string" ? Array.from(e).map((e) => F(e)) : [e]);
161
161
  }
162
162
  //#endregion
163
163
  //#region src/editor/constants.ts
164
- var Oe = [
164
+ var De = [
165
165
  {
166
166
  symbol: "pi",
167
167
  latex: "\\pi",
@@ -212,22 +212,22 @@ var Oe = [
212
212
  mathJson: "False",
213
213
  commands: ["false"]
214
214
  }
215
- ], ke = new Map(Oe.map((e) => [e.symbol, e])), Ae = new Map(Oe.flatMap((e) => e.commands.map((t) => [t, e]))), je = (e) => ke.get(e), Me = (e) => Ae.get(e), Ne = /* @__PURE__ */ new Map([["pi", "pi"], ["infty", "infinity"]]), Pe = /* @__PURE__ */ new Map([
215
+ ], Oe = new Map(De.map((e) => [e.symbol, e])), ke = new Map(De.flatMap((e) => e.commands.map((t) => [t, e]))), Ae = (e) => Oe.get(e), je = (e) => ke.get(e), Me = /* @__PURE__ */ new Map([["pi", "pi"], ["infty", "infinity"]]), Ne = /* @__PURE__ */ new Map([
216
216
  ["e", "exponentiale"],
217
217
  ["NaN", "notanumber"],
218
218
  ["true", "true"],
219
219
  ["false", "false"]
220
- ]), Fe = (e) => Ne.get(e), Ie = (e) => Pe.get(e), R = (e) => e?.kind === "symbol" ? e.value : null, Le = (e) => e !== null && /^[0-9]$/.test(e), Re = (e) => Le(e) || e === ".", ze = (e) => Re(R(e));
221
- function Be(e, t) {
222
- if (!ze(e[t])) return null;
220
+ ]), Pe = (e) => Me.get(e), Fe = (e) => Ne.get(e), z = (e) => e?.kind === "symbol" ? e.value : null, Ie = (e) => e !== null && /^[0-9]$/.test(e), Le = (e) => Ie(e) || e === ".", Re = (e) => Le(z(e));
221
+ function ze(e, t) {
222
+ if (!Re(e[t])) return null;
223
223
  let n = t, r = "";
224
- for (; Re(R(e[n]));) r += R(e[n++]);
225
- let i = null, a = R(e[n]);
224
+ for (; Le(z(e[n]));) r += z(e[n++]);
225
+ let i = null, a = z(e[n]);
226
226
  if (a === "e" || a === "E") {
227
- let t = n + 1, r = "", a = R(e[t]);
228
- if ((a === "+" || a === "-" || a === "−") && (r = a === "+" ? "+" : "-", t++), Le(R(e[t]))) {
227
+ let t = n + 1, r = "", a = z(e[t]);
228
+ if ((a === "+" || a === "-" || a === "−") && (r = a === "+" ? "+" : "-", t++), Ie(z(e[t]))) {
229
229
  let a = "";
230
- for (; Re(R(e[t]));) a += R(e[t++]);
230
+ for (; Le(z(e[t]));) a += z(e[t++]);
231
231
  i = r + a, n = t;
232
232
  }
233
233
  }
@@ -239,14 +239,14 @@ function Be(e, t) {
239
239
  exponent: i
240
240
  };
241
241
  }
242
- function Ve(e, t) {
243
- let n = R(e[t - 1]);
244
- if (n !== "e" && n !== "E" || !Re(R(e[t - 2]))) return !1;
242
+ function Be(e, t) {
243
+ let n = z(e[t - 1]);
244
+ if (n !== "e" && n !== "E" || !Le(z(e[t - 2]))) return !1;
245
245
  let r = t - 2;
246
- for (; Re(R(e[r - 1]));) r--;
247
- return !/^[A-Za-z_]$/.test(R(e[r - 1]) ?? "");
246
+ for (; Le(z(e[r - 1]));) r--;
247
+ return !/^[A-Za-z_]$/.test(z(e[r - 1]) ?? "");
248
248
  }
249
- var He = Object.fromEntries([
249
+ var Ve = Object.fromEntries([
250
250
  [
251
251
  "exp",
252
252
  "exp",
@@ -480,14 +480,14 @@ var He = Object.fromEntries([
480
480
  mathJson: i,
481
481
  ...a && { aliases: a }
482
482
  }]));
483
- function Ue(e) {
484
- return He[e.toLowerCase()] ?? null;
483
+ function He(e) {
484
+ return Ve[e.toLowerCase()] ?? null;
485
485
  }
486
- function We(e) {
487
- let t = Ue(e);
486
+ function Ue(e) {
487
+ let t = He(e);
488
488
  return t ? t.latexCommand ? `\\${t.latexName} ` : `\\operatorname{${t.latexName}}` : `\\operatorname{${e}}`;
489
489
  }
490
- var Ge = {
490
+ var We = {
491
491
  floor: {
492
492
  open: "⌊",
493
493
  close: "⌋",
@@ -500,12 +500,12 @@ var Ge = {
500
500
  latexOpen: "\\lceil",
501
501
  latexClose: "\\rceil"
502
502
  }
503
- }, Ke = (e) => Ge[e];
504
- function qe(e) {
505
- return Object.keys(Ge).find((t) => Ge[t].open === e);
503
+ }, Ge = (e) => We[e];
504
+ function Ke(e) {
505
+ return Object.keys(We).find((t) => We[t].open === e);
506
506
  }
507
- function Je(e) {
508
- for (let t of Object.values(Ge)) {
507
+ function qe(e) {
508
+ for (let t of Object.values(We)) {
509
509
  if (e === t.open) return t.latexOpen;
510
510
  if (e === t.close) return t.latexClose;
511
511
  }
@@ -513,78 +513,78 @@ function Je(e) {
513
513
  }
514
514
  //#endregion
515
515
  //#region src/editor/identifiers.ts
516
- var z = /* @__PURE__ */ new Set(/* @__PURE__ */ "alpha.beta.gamma.delta.epsilon.varepsilon.zeta.eta.theta.vartheta.iota.kappa.lambda.mu.nu.xi.pi.rho.sigma.tau.upsilon.phi.varphi.chi.psi.omega.Gamma.Delta.Theta.Lambda.Xi.Pi.Sigma.Upsilon.Phi.Psi.Omega".split(".")), Ye = /* @__PURE__ */ new Map();
517
- for (let e of Object.values(He)) {
518
- Ye.set(e.name, e.name), Ye.set(e.latexName, e.name);
519
- for (let t of e.aliases ?? []) Ye.set(t, e.name);
516
+ var B = /* @__PURE__ */ new Set(/* @__PURE__ */ "alpha.beta.gamma.delta.epsilon.varepsilon.zeta.eta.theta.vartheta.iota.kappa.lambda.mu.nu.xi.pi.rho.sigma.tau.upsilon.phi.varphi.chi.psi.omega.Gamma.Delta.Theta.Lambda.Xi.Pi.Sigma.Upsilon.Phi.Psi.Omega".split(".")), Je = /* @__PURE__ */ new Map();
517
+ for (let e of Object.values(Ve)) {
518
+ Je.set(e.name, e.name), Je.set(e.latexName, e.name);
519
+ for (let t of e.aliases ?? []) Je.set(t, e.name);
520
520
  }
521
- function Xe(e) {
522
- return Ye.get(e);
521
+ function Ye(e) {
522
+ return Je.get(e);
523
523
  }
524
- var Ze = (e, t) => e?.kind === "symbol" && t.test(e.value), B = (e) => e?.kind === "symbol" && z.has(e.value) && !je(e.value), Qe = (e) => Ze(e, /^[A-Za-z]$/), $e = (e) => Qe(e) || B(e), et = (e) => Ze(e, /^[A-Za-z0-9_]$/) || B(e);
525
- function tt(e, t) {
524
+ var Xe = (e, t) => e?.kind === "symbol" && t.test(e.value), V = (e) => e?.kind === "symbol" && B.has(e.value) && !Ae(e.value), Ze = (e) => Xe(e, /^[A-Za-z]$/), Qe = (e) => Ze(e) || V(e), $e = (e) => Xe(e, /^[A-Za-z0-9_]$/) || V(e);
525
+ function et(e, t) {
526
526
  let n = t;
527
- for (; n < e.length && et(e[n]);) {
528
- let r = e[n - 1], i = B(e[n]);
529
- if (n > t && (i && !Ze(r, /^_$/) || Qe(e[n]) && B(r)) || n === t && !i && !Qe(e[n])) break;
527
+ for (; n < e.length && $e(e[n]);) {
528
+ let r = e[n - 1], i = V(e[n]);
529
+ if (n > t && (i && !Xe(r, /^_$/) || Ze(e[n]) && V(r)) || n === t && !i && !Ze(e[n])) break;
530
530
  n++;
531
531
  }
532
532
  return n;
533
533
  }
534
- function nt(e) {
535
- return je(e)?.symbol;
534
+ function tt(e) {
535
+ return Ae(e)?.symbol;
536
536
  }
537
- function rt(e) {
537
+ function nt(e) {
538
538
  let t = [], n = 0;
539
539
  for (; n < e.length;) {
540
- let r = Be(e, n);
540
+ let r = ze(e, n);
541
541
  if (r) {
542
542
  n = r.end;
543
543
  continue;
544
544
  }
545
- if (!$e(e[n])) {
545
+ if (!Qe(e[n])) {
546
546
  n++;
547
547
  continue;
548
548
  }
549
549
  let i = n;
550
- n = tt(e, i);
550
+ n = et(e, i);
551
551
  let a = e.slice(i, n).map((e) => e.value).join("");
552
552
  t.push({
553
553
  start: i,
554
554
  end: n,
555
555
  name: a,
556
- functionName: Xe(a) ?? null
556
+ functionName: Ye(a) ?? null
557
557
  });
558
558
  }
559
559
  return t;
560
560
  }
561
- function it(e) {
561
+ function rt(e) {
562
562
  let t = [], n = 0;
563
563
  for (; n < e.length;) {
564
- if ($e(e[n])) {
565
- n = tt(e, n);
564
+ if (Qe(e[n])) {
565
+ n = et(e, n);
566
566
  continue;
567
567
  }
568
- let r = Be(e, n);
568
+ let r = ze(e, n);
569
569
  r ? (t.push(r), n = r.end) : n++;
570
570
  }
571
571
  return t;
572
572
  }
573
- var at = (e) => e.units.map((e) => e.kind === "symbol" ? e.value : "").join("");
574
- function ot(e) {
573
+ var it = (e) => e.units.map((e) => e.kind === "symbol" ? e.value : "").join("");
574
+ function at(e) {
575
575
  if (e.otherwise?.map((e) => e.kind === "symbol" ? e.value : "\0").join("") !== "0.0") return null;
576
- let t = e.pieces[0]?.value ?? [], n = Be(t, +(t[0]?.kind === "symbol" && t[0].value === "-")), r = t[t.length - 1];
577
- return !n || n.end !== t.length - 1 || r?.kind !== "units" ? null : at(r) || null;
576
+ let t = e.pieces[0]?.value ?? [], n = ze(t, +(t[0]?.kind === "symbol" && t[0].value === "-")), r = t[t.length - 1];
577
+ return !n || n.end !== t.length - 1 || r?.kind !== "units" ? null : it(r) || null;
578
578
  }
579
- var st = /* @__PURE__ */ new WeakMap(), ct = /^[A-Za-z][A-Za-z0-9_]*$/;
580
- function lt(e) {
581
- let t = st.get(e);
579
+ var ot = /* @__PURE__ */ new WeakMap(), st = /^[A-Za-z][A-Za-z0-9_]*$/;
580
+ function ct(e) {
581
+ let t = ot.get(e);
582
582
  if (t) return t;
583
583
  let n = /* @__PURE__ */ new Map(), r = (e, t) => {
584
584
  let r = n.get(e);
585
585
  r ? r.push(t) : n.set(e, [t]);
586
586
  }, i = (e) => {
587
- let t = new Map(rt(e).map((e) => [e.start, e]));
587
+ let t = new Map(nt(e).map((e) => [e.start, e]));
588
588
  for (let n = 0; n < e.length; n++) {
589
589
  let a = e[n], o = t.get(n);
590
590
  if (o) {
@@ -595,20 +595,20 @@ function lt(e) {
595
595
  n = o.end - 1;
596
596
  continue;
597
597
  }
598
- if (a.kind === "symbol" && ct.test(a.value) && !je(a.value) && r(a.value, [a.id]), a.kind !== "units") for (let [, e] of k(a)) i(e);
598
+ if (a.kind === "symbol" && st.test(a.value) && !Ae(a.value) && r(a.value, [a.id]), a.kind !== "units") for (let [, e] of k(a)) i(e);
599
599
  }
600
600
  };
601
- return i(e), st.set(e, n), n;
601
+ return i(e), ot.set(e, n), n;
602
602
  }
603
- function ut(e) {
603
+ function lt(e) {
604
604
  let t = [], n = (e, r = null) => {
605
- for (let n of it(e)) {
605
+ for (let n of rt(e)) {
606
606
  let i = e[n.end], a = i?.kind === "units" ? i : null, o = e.slice(n.start, n.end + +!!a).map((e) => e.id), s = e.slice(n.start, n.end).map((e) => e.id), c = Number(n.text);
607
607
  a ? t.push({
608
608
  value: c,
609
609
  atomIds: o,
610
610
  digitIds: s,
611
- units: at(a)
611
+ units: it(a)
612
612
  }) : r ? t.push({
613
613
  value: c,
614
614
  atomIds: o,
@@ -624,21 +624,21 @@ function ut(e) {
624
624
  }
625
625
  for (let t of e) if (t.kind !== "units") for (let [e, r] of k(t)) {
626
626
  let i = t.kind === "piecewise" && e === "otherwise";
627
- n(r, i ? ot(t) : null);
627
+ n(r, i ? at(t) : null);
628
628
  }
629
629
  };
630
630
  return n(e), t;
631
631
  }
632
- function dt(e, t) {
632
+ function ut(e, t) {
633
633
  let n = e[t - 1];
634
634
  if (n?.kind === "function") {
635
- let e = Ke(n.name);
635
+ let e = Ge(n.name);
636
636
  return e ? {
637
637
  start: t - 1,
638
638
  open: e.open
639
639
  } : null;
640
640
  }
641
- let r = rt(e.slice(0, t)).find((e) => e.end === t), i = r?.functionName ? Ke(r.functionName) : void 0;
641
+ let r = nt(e.slice(0, t)).find((e) => e.end === t), i = r?.functionName ? Ge(r.functionName) : void 0;
642
642
  return r && i ? {
643
643
  start: r.start,
644
644
  open: i.open
@@ -646,42 +646,42 @@ function dt(e, t) {
646
646
  }
647
647
  //#endregion
648
648
  //#region src/editor/names.ts
649
- var ft = /^([A-Za-z]+?)(\d*)$/;
650
- function pt(e) {
651
- let t = ft.exec(e);
649
+ var dt = /^([A-Za-z]+?)(\d*)$/;
650
+ function ft(e) {
651
+ let t = dt.exec(e);
652
652
  if (!t) return null;
653
653
  let [, n] = t;
654
- return z.has(n) && !je(n) ? n : null;
654
+ return B.has(n) && !Ae(n) ? n : null;
655
655
  }
656
- function mt(e, t = {}) {
657
- let n = nt(e);
658
- return n ? [P(n)] : t.greekNames === !1 ? L(e) : e.split("_").flatMap((e, t) => {
659
- let n = t > 0 ? [P("_")] : [], r = pt(e);
656
+ function pt(e, t = {}) {
657
+ let n = tt(e);
658
+ return n ? [F(n)] : t.greekNames === !1 ? R(e) : e.split("_").flatMap((e, t) => {
659
+ let n = t > 0 ? [F("_")] : [], r = ft(e);
660
660
  return r ? [
661
661
  ...n,
662
- P(r),
663
- ...L(e.slice(r.length))
664
- ] : [...n, ...L(e)];
662
+ F(r),
663
+ ...R(e.slice(r.length))
664
+ ] : [...n, ...R(e)];
665
665
  });
666
666
  }
667
- var ht = (e) => e.map((e) => `${e.atom}.${e.branch}`).join("/");
668
- function gt(e, t, n, r) {
669
- return !!e && ht(e.path) === ht(t) && e.offset >= n && e.offset <= r;
667
+ var mt = (e) => e.map((e) => `${e.atom}.${e.branch}`).join("/");
668
+ function ht(e, t, n, r) {
669
+ return !!e && mt(e.path) === mt(t) && e.offset >= n && e.offset <= r;
670
670
  }
671
- function _t(e, t = {}) {
672
- let n = /* @__PURE__ */ new Map(), r = vt(e.root, [], e, t, n);
671
+ function gt(e, t = {}) {
672
+ let n = /* @__PURE__ */ new Map(), r = _t(e.root, [], e, t, n);
673
673
  return n.size === 0 ? e : {
674
674
  ...e,
675
675
  root: r,
676
- cursor: yt(e.cursor, n),
677
- anchor: e.anchor ? yt(e.anchor, n) : e.anchor
676
+ cursor: vt(e.cursor, n),
677
+ anchor: e.anchor ? vt(e.anchor, n) : e.anchor
678
678
  };
679
679
  }
680
- function vt(e, t, n, r, i) {
681
- let a = ht(t), o = (e, i) => !r.cursorAway && (gt(n.cursor, t, e, i) || gt(n.anchor, t, e, i)), s = [];
682
- for (let t of rt(e)) {
680
+ function _t(e, t, n, r, i) {
681
+ let a = mt(t), o = (e, i) => !r.cursorAway && (ht(n.cursor, t, e, i) || ht(n.anchor, t, e, i)), s = [];
682
+ for (let t of nt(e)) {
683
683
  if (t.functionName || o(t.start, t.end)) continue;
684
- let n = e.slice(t.start, t.end), i = mt(t.name, r), a = i.length === n.length && i.every((e, t) => e.kind === "symbol" && n[t].kind === "symbol" && e.value === n[t].value), c = r.greekNames === !1 && n.some(B);
684
+ let n = e.slice(t.start, t.end), i = pt(t.name, r), a = i.length === n.length && i.every((e, t) => e.kind === "symbol" && n[t].kind === "symbol" && e.value === n[t].value), c = r.greekNames === !1 && n.some(V);
685
685
  !a && !c && s.push({
686
686
  start: t.start,
687
687
  end: t.end,
@@ -691,11 +691,11 @@ function vt(e, t, n, r, i) {
691
691
  let c = e, l = !1, u = e.map((e, a) => {
692
692
  let o = e;
693
693
  for (let [s, c] of k(e)) {
694
- let e = vt(c, [...t, {
694
+ let e = _t(c, [...t, {
695
695
  atom: a,
696
696
  branch: s
697
697
  }], n, r, i);
698
- e !== c && (o = A(o, s, e));
698
+ e !== c && (o = j(o, s, e));
699
699
  }
700
700
  return o !== e && (l = !0), o;
701
701
  });
@@ -708,7 +708,7 @@ function vt(e, t, n, r, i) {
708
708
  count: e.atoms.length
709
709
  }))), d;
710
710
  }
711
- function yt(e, t) {
711
+ function vt(e, t) {
712
712
  let n = (e, t) => {
713
713
  let n = 0;
714
714
  for (let r of t) if (e >= r.end) n += r.end - r.start - r.count;
@@ -717,13 +717,13 @@ function yt(e, t) {
717
717
  return e - n;
718
718
  }, r = [];
719
719
  for (let i = 0; i < e.path.length; i++) {
720
- let a = t.get(ht(e.path.slice(0, i))), o = e.path[i];
720
+ let a = t.get(mt(e.path.slice(0, i))), o = e.path[i];
721
721
  r.push({
722
722
  ...o,
723
723
  atom: a ? n(o.atom, a) : o.atom
724
724
  });
725
725
  }
726
- let i = t.get(ht(e.path));
726
+ let i = t.get(mt(e.path));
727
727
  return {
728
728
  path: r,
729
729
  offset: i ? n(e.offset, i) : e.offset
@@ -731,7 +731,7 @@ function yt(e, t) {
731
731
  }
732
732
  //#endregion
733
733
  //#region src/editor/nameScripts.ts
734
- function bt(e) {
734
+ function yt(e) {
735
735
  let t = e.indexOf("_");
736
736
  if (t <= 0) return null;
737
737
  let n = [], r = t;
@@ -756,7 +756,7 @@ function bt(e) {
756
756
  }
757
757
  //#endregion
758
758
  //#region src/editor/operators.ts
759
- var V = [
759
+ var bt = [
760
760
  {
761
761
  role: "comparison",
762
762
  symbol: "<",
@@ -841,7 +841,7 @@ var V = [
841
841
  "neg"
842
842
  ]
843
843
  }
844
- ], xt = new Map(V.map((e) => [e.symbol, e])), St = new Map(V.map((e) => [e.type, e])), Ct = new Map(V.flatMap((e) => e.commands.map((t) => [t, e]))), wt = (e) => xt.get(e), Tt = (e) => St.get(e), Et = (e) => Ct.get(e), Dt = {
844
+ ], xt = new Map(bt.map((e) => [e.symbol, e])), St = new Map(bt.map((e) => [e.type, e])), Ct = new Map(bt.flatMap((e) => e.commands.map((t) => [t, e]))), wt = (e) => xt.get(e), Tt = (e) => St.get(e), Et = (e) => Ct.get(e), Dt = {
845
845
  "<": "≤",
846
846
  ">": "≥",
847
847
  "¬": "≠"
@@ -878,10 +878,10 @@ var Mt = {
878
878
  "*": "\\cdot",
879
879
  "·": "\\cdot",
880
880
  "×": "\\times",
881
- ...Object.fromEntries(V.filter((e) => e.role === "logic").map((e) => [e.symbol, e.latex]))
881
+ ...Object.fromEntries(bt.filter((e) => e.role === "logic").map((e) => [e.symbol, e.latex]))
882
882
  }, Nt = {
883
883
  "=": "=",
884
- ...Object.fromEntries(V.filter((e) => e.role === "comparison").map((e) => [e.symbol, e.latex]))
884
+ ...Object.fromEntries(bt.filter((e) => e.role === "comparison").map((e) => [e.symbol, e.latex]))
885
885
  }, Pt = { "¬": "\\lnot" }, Ft = {
886
886
  "\\": "\\textbackslash{}",
887
887
  "{": "\\{",
@@ -901,7 +901,7 @@ function H(e, t) {
901
901
  return `\\htmlData{atom=${e}}{${t}}`;
902
902
  }
903
903
  function Lt(e, t) {
904
- return e === "_" ? "\\_" : z.has(e) && t.greekNames !== !1 ? `\\${e}` : `\\mathit{${e}}`;
904
+ return e === "_" ? "\\_" : B.has(e) && t.greekNames !== !1 ? `\\${e}` : `\\mathit{${e}}`;
905
905
  }
906
906
  function Rt(e, t) {
907
907
  let [n] = e;
@@ -915,7 +915,7 @@ function zt(e, t, n) {
915
915
  return `{{${Rt(r(t.base), n)}}${a ? `_{${a}}` : ""}${o ? `^{${o}}` : ""}}`;
916
916
  }
917
917
  function Bt(e, t, n, r) {
918
- return r.typesetNames === !1 || e.functionName || r.cursors?.some((t) => gt(t, n, e.start, e.end)) ? null : bt(t.map((e) => e.value));
918
+ return r.typesetNames === !1 || e.functionName || r.cursors?.some((t) => ht(t, n, e.start, e.end)) ? null : yt(t.map((e) => e.value));
919
919
  }
920
920
  function Vt(e) {
921
921
  return e === "e" || e === "E" ? `\\mathrm{${e}}` : e === "-" || e === "−" ? "{-}" : e === "+" ? "{+}" : e;
@@ -925,17 +925,17 @@ function Ht(e, t, n = {}) {
925
925
  if (t in Nt) return `\\mathrel{${H(e, Nt[t])}}`;
926
926
  if (t === ",") return `\\mathpunct{${H(e, ",")}}`;
927
927
  if (t in Pt) return H(e, Pt[t]);
928
- let r = je(t);
929
- return r ? H(e, r.latex) : /^[0-9.]$/.test(t) || /^[A-Za-z]$/.test(t) ? H(e, t) : z.has(t) && n.greekNames !== !1 ? H(e, `\\${t}`) : /^[A-Za-z]+$/.test(t) ? H(e, `\\mathit{${t}}`) : H(e, `\\text{${Array.from(t).map((e) => Ft[e] ?? e).join("")}}`);
928
+ let r = Ae(t);
929
+ return r ? H(e, r.latex) : /^[0-9.]$/.test(t) || /^[A-Za-z]$/.test(t) ? H(e, t) : B.has(t) && n.greekNames !== !1 ? H(e, `\\${t}`) : /^[A-Za-z]+$/.test(t) ? H(e, `\\mathit{${t}}`) : H(e, `\\text{${Array.from(t).map((e) => Ft[e] ?? e).join("")}}`);
930
930
  }
931
931
  function Ut(e, t = {}) {
932
932
  return Wt(e, [], t);
933
933
  }
934
934
  function Wt(e, t, n) {
935
935
  let r;
936
- if (e.length === 0) r = `\\htmlClass{me-ph${n.activeRow && M(n.activeRow, t) ? " me-ph-active" : ""}}{\\square}`;
936
+ if (e.length === 0) r = `\\htmlClass{me-ph${n.activeRow && N(n.activeRow, t) ? " me-ph-active" : ""}}{\\square}`;
937
937
  else {
938
- let i = [], a = new Map(rt(e).map((e) => [e.start, e])), o = new Map(it(e).filter((e) => e.exponent !== null).map((e) => [e.start, e]));
938
+ let i = [], a = new Map(nt(e).map((e) => [e.start, e])), o = new Map(rt(e).filter((e) => e.exponent !== null).map((e) => [e.start, e]));
939
939
  for (let r = 0; r < e.length; r++) {
940
940
  let s = e[r], c = (e) => [...t, {
941
941
  atom: r,
@@ -971,13 +971,13 @@ function Gt(e, t, n) {
971
971
  switch (e.kind) {
972
972
  case "symbol": return Ht(e.id, e.value, n);
973
973
  case "function": {
974
- let t = Ue(e.name)?.latexName ?? e.name;
974
+ let t = He(e.name)?.latexName ?? e.name;
975
975
  return `\\mathop{${H(e.id, `\\mathrm{${t}}`)}}`;
976
976
  }
977
977
  case "fraction": return H(e.id, `\\frac{${r(e.num, "num")}}{${r(e.den, "den")}}`);
978
978
  case "root": return H(e.id, e.index ? `\\sqrt[${r(e.index, "index")}]{${r(e.body, "body")}}` : `\\sqrt{${r(e.body, "body")}}`);
979
979
  case "group": {
980
- let t = Je(e.open), n = Je(e.close);
980
+ let t = qe(e.open), n = qe(e.close);
981
981
  return H(e.id, `\\left${t}${r(e.body, "body")}\\right${n}`);
982
982
  }
983
983
  case "derivative": return H(e.id, `\\frac{\\mathrm{d}${r(e.expr, "expr")}}{\\mathrm{d}${r(e.variable, "variable")}}`);
@@ -990,7 +990,7 @@ function Gt(e, t, n) {
990
990
  }
991
991
  function Kt(e, t, n) {
992
992
  if (e.length === 0) {
993
- let e = `me-ph me-units-ph${n.activeRow && M(n.activeRow, t) ? " me-ph-active" : ""}`;
993
+ let e = `me-ph me-units-ph${n.activeRow && N(n.activeRow, t) ? " me-ph-active" : ""}`;
994
994
  return `\\htmlData{row=${At(t)}}{\\htmlClass{${e}}{\\text{\\scriptsize units}}}`;
995
995
  }
996
996
  let r = e.map((e, r) => {
@@ -1050,7 +1050,7 @@ function $t(e, t) {
1050
1050
  }
1051
1051
  var en = (e) => e?.kind === "symbol" || e?.kind === "function";
1052
1052
  function tn(e, t, n, r) {
1053
- let i = j(t, n);
1053
+ let i = M(t, n);
1054
1054
  if (!i) return null;
1055
1055
  if (i.length === 0) {
1056
1056
  let t = Qt(e, n), r = t ? Xt(t) : null;
@@ -1090,7 +1090,7 @@ function nn(e, t, n) {
1090
1090
  };
1091
1091
  }
1092
1092
  function rn(e, t, n, r) {
1093
- let i = j(t, n);
1093
+ let i = M(t, n);
1094
1094
  if (!i) return 0;
1095
1095
  let a = 0, o = Infinity;
1096
1096
  for (let s = 0; s <= i.length; s++) {
@@ -1113,7 +1113,7 @@ function on(e, t, n, r) {
1113
1113
  let i = [];
1114
1114
  for (let a of Array.from(e.querySelectorAll("[data-row]"))) {
1115
1115
  let e = jt(a.getAttribute("data-row"));
1116
- if (!e || e.length <= i.length || !j(t, e) || an(a, n, r)) continue;
1116
+ if (!e || e.length <= i.length || !M(t, e) || an(a, n, r)) continue;
1117
1117
  let o = Xt(a);
1118
1118
  o && n >= o.left - 2 && n <= o.right + 2 && r >= o.top - 2 && r <= o.bottom + 2 && (i = e);
1119
1119
  }
@@ -1123,7 +1123,7 @@ function on(e, t, n, r) {
1123
1123
  };
1124
1124
  }
1125
1125
  function sn(e, t, n) {
1126
- let r = j(t, n.path);
1126
+ let r = M(t, n.path);
1127
1127
  return r ? cn(e, r.slice(n.start, n.end).map((e) => e.id)) : null;
1128
1128
  }
1129
1129
  function cn(e, t, n = 2) {
@@ -1198,9 +1198,9 @@ function hn(e) {
1198
1198
  return e.map((e) => {
1199
1199
  let t = {
1200
1200
  ...e,
1201
- id: N()
1201
+ id: P()
1202
1202
  };
1203
- for (let [n, r] of k(e)) t = A(t, n, hn(r));
1203
+ for (let [n, r] of k(e)) t = j(t, n, hn(r));
1204
1204
  return t;
1205
1205
  });
1206
1206
  }
@@ -1209,7 +1209,7 @@ var gn = {
1209
1209
  "*": "\\cdot ",
1210
1210
  "×": "\\times ",
1211
1211
  "−": "-",
1212
- ...Object.fromEntries(V.map((e) => [e.symbol, e.latex.startsWith("\\") ? `${e.latex} ` : e.latex]))
1212
+ ...Object.fromEntries(bt.map((e) => [e.symbol, e.latex.startsWith("\\") ? `${e.latex} ` : e.latex]))
1213
1213
  }, _n = {
1214
1214
  "\\": "\\textbackslash{}",
1215
1215
  "{": "\\{",
@@ -1225,12 +1225,12 @@ var gn = {
1225
1225
  function vn(e, t = {}) {
1226
1226
  if (e in gn) return gn[e];
1227
1227
  if (/^[A-Za-z0-9.+\-=,]$/.test(e)) return e;
1228
- let n = je(e);
1229
- return n ? /[a-z]$/i.test(n.latex) ? `${n.latex} ` : n.latex : z.has(e) && t.greekNames !== !1 ? `\\${e} ` : /^[A-Za-z]+$/.test(e) ? `\\mathit{${e}}` : `\\text{${Array.from(e, (e) => _n[e] ?? e).join("")}}`;
1228
+ let n = Ae(e);
1229
+ return n ? /[a-z]$/i.test(n.latex) ? `${n.latex} ` : n.latex : B.has(e) && t.greekNames !== !1 ? `\\${e} ` : /^[A-Za-z]+$/.test(e) ? `\\mathit{${e}}` : `\\text{${Array.from(e, (e) => _n[e] ?? e).join("")}}`;
1230
1230
  }
1231
1231
  var yn = (e) => e?.kind === "symbol" && (/^[+\-−=,·*×]$/.test(e.value) || wt(e.value) !== void 0);
1232
1232
  function W(e, t = {}) {
1233
- let n = new Map(rt(e).map((e) => [e.start, e])), r = new Map(it(e).filter((e) => e.exponent !== null).map((e) => [e.start, e])), i = "";
1233
+ let n = new Map(nt(e).map((e) => [e.start, e])), r = new Map(rt(e).filter((e) => e.exponent !== null).map((e) => [e.start, e])), i = "";
1234
1234
  for (let a = 0; a < e.length;) {
1235
1235
  let o = r.get(a);
1236
1236
  if (o) {
@@ -1248,38 +1248,38 @@ function W(e, t = {}) {
1248
1248
  return i.trim() || "\\square";
1249
1249
  }
1250
1250
  function bn(e, t, n) {
1251
- if (t) return We(t);
1252
- let r = nt(e);
1251
+ if (t) return Ue(t);
1252
+ let r = tt(e);
1253
1253
  if (r) return vn(r);
1254
1254
  let i = n.typesetNames === !1 ? null : xn(e, n);
1255
1255
  if (i) return i;
1256
1256
  let a = e.split("_");
1257
- return n.greekNames !== !1 && a.some((e) => pt(e)) ? a.map((e) => {
1258
- let t = pt(e);
1257
+ return n.greekNames !== !1 && a.some((e) => ft(e)) ? a.map((e) => {
1258
+ let t = ft(e);
1259
1259
  return t ? `\\${t}${e.slice(t.length) || " "}` : e.length === 1 ? e : `\\mathit{${e}}`;
1260
1260
  }).join("\\_") : e.length === 1 ? e : `\\mathit{${e.replace(/_/g, "\\_")}}`;
1261
1261
  }
1262
1262
  function xn(e, t) {
1263
- let n = mt(e, t).map((e) => e.value), r = bt(n);
1263
+ let n = pt(e, t).map((e) => e.value), r = yt(n);
1264
1264
  if (!r) return null;
1265
1265
  let i = ([e, r]) => Sn(n.slice(e, r), t), a = (e) => r.parts.filter((t) => t.role === e).map((e) => i(e.text)).join(","), o = a("sub"), s = a("sup"), c = `${i(r.base)}${o ? `_{${o}}` : ""}${s ? `^{${s}}` : ""}`;
1266
1266
  return s ? `{${c}}` : c;
1267
1267
  }
1268
1268
  function Sn(e, t) {
1269
1269
  let [n, ...r] = e;
1270
- if (n.length > 1 && z.has(n) && t.greekNames !== !1) return `\\${n}${r.join("")}`;
1270
+ if (n.length > 1 && B.has(n) && t.greekNames !== !1) return `\\${n}${r.join("")}`;
1271
1271
  let i = e.join("");
1272
1272
  return i.length === 1 || /^[0-9]+$/.test(i) ? i : `\\mathit{${i}}`;
1273
1273
  }
1274
1274
  function Cn(e, t, n) {
1275
1275
  switch (e.kind) {
1276
1276
  case "symbol": return vn(e.value, n);
1277
- case "function": return We(e.name);
1277
+ case "function": return Ue(e.name);
1278
1278
  case "fraction": return `\\frac{${W(e.num, n)}}{${W(e.den, n)}}`;
1279
1279
  case "superscript": return `${t && !yn(t) ? "" : "{}"}^{${W(e.sup, n)}}`;
1280
1280
  case "root": return e.index ? `\\sqrt[${W(e.index, n)}]{${W(e.body, n)}}` : `\\sqrt{${W(e.body, n)}}`;
1281
1281
  case "group": {
1282
- let t = Je(e.open), r = Je(e.close), i = (e) => /[a-z]$/.test(e) ? " " : "";
1282
+ let t = qe(e.open), r = qe(e.close), i = (e) => /[a-z]$/.test(e) ? " " : "";
1283
1283
  return `\\left${t}${i(t)}${W(e.body, n)}\\right${r}${i(r)}`;
1284
1284
  }
1285
1285
  case "derivative": return `\\frac{\\mathrm{d}${W(e.expr, n)}}{\\mathrm{d}${W(e.variable, n)}}`;
@@ -1394,7 +1394,7 @@ var Tn = [
1394
1394
  break;
1395
1395
  }
1396
1396
  }
1397
- return this.casesDepth--, De(e.length > 0 ? e : [[[], []]], t);
1397
+ return this.casesDepth--, Ee(e.length > 0 ? e : [[[], []]], t);
1398
1398
  }
1399
1399
  readConditionWord() {
1400
1400
  let e = this.peek();
@@ -1440,42 +1440,42 @@ var Tn = [
1440
1440
  case "|": {
1441
1441
  this.absDepth++;
1442
1442
  let e = this.readUntilChar("|");
1443
- this.absDepth--, t.push(I(e, "|"));
1443
+ this.absDepth--, t.push(L(e, "|"));
1444
1444
  return;
1445
1445
  }
1446
1446
  case ")":
1447
1447
  case "]": return;
1448
1448
  case "^":
1449
- t.push(Ce(this.readScript()));
1449
+ t.push(Se(this.readScript()));
1450
1450
  return;
1451
1451
  case "_":
1452
- t.push(P("_"), ...Mn(this.readScript(), 1));
1452
+ t.push(F("_"), ...Mn(this.readScript(), 1));
1453
1453
  return;
1454
1454
  case "/":
1455
1455
  t.push(this.readInfixFraction(t));
1456
1456
  return;
1457
1457
  case "*":
1458
- t.push(P("·"));
1458
+ t.push(F("·"));
1459
1459
  return;
1460
1460
  case "=": {
1461
1461
  let e = t[t.length - 1], n = e?.kind === "symbol" ? e.value : "", r = Ot(n === "!" ? "¬" : n);
1462
- r ? t[t.length - 1] = P(r) : n !== "=" && t.push(P("="));
1462
+ r ? t[t.length - 1] = F(r) : n !== "=" && t.push(F("="));
1463
1463
  return;
1464
1464
  }
1465
1465
  case "!":
1466
- t.push(P("¬"));
1466
+ t.push(F("¬"));
1467
1467
  return;
1468
1468
  case "&": {
1469
1469
  let e = t[t.length - 1];
1470
- (e?.kind !== "symbol" || e.value !== "∧") && t.push(P("∧"));
1470
+ (e?.kind !== "symbol" || e.value !== "∧") && t.push(F("∧"));
1471
1471
  return;
1472
1472
  }
1473
- default: t.push(P(e === "−" ? "-" : e));
1473
+ default: t.push(F(e === "−" ? "-" : e));
1474
1474
  }
1475
1475
  }
1476
1476
  pushBrackets(e, t, n) {
1477
- let r = n === "(" ? dt(e, e.length) : null;
1478
- r ? e.splice(r.start, e.length - r.start, I(t, r.open)) : e.push(I(t, n === "[" ? "(" : n));
1477
+ let r = n === "(" ? ut(e, e.length) : null;
1478
+ r ? e.splice(r.start, e.length - r.start, L(t, r.open)) : e.push(L(t, n === "[" ? "(" : n));
1479
1479
  }
1480
1480
  readUntilChar(e) {
1481
1481
  let t = this.readRow({ char: e });
@@ -1492,7 +1492,7 @@ var Tn = [
1492
1492
  close: !0,
1493
1493
  right: !0
1494
1494
  }), a = i[0];
1495
- return i.length === 1 && a.kind === "group" && a.open === "(" && (i = a.body), Se(n, i);
1495
+ return i.length === 1 && a.kind === "group" && a.open === "(" && (i = a.body), xe(n, i);
1496
1496
  }
1497
1497
  readScript() {
1498
1498
  let e = this.peek();
@@ -1500,7 +1500,7 @@ var Tn = [
1500
1500
  if (e.kind === "char" && /[0-9]/.test(e.value)) {
1501
1501
  let e = "";
1502
1502
  for (; this.peek()?.kind === "char" && /[0-9.]/.test(this.peek().value);) e += this.next().value;
1503
- return Array.from(e, (e) => P(e));
1503
+ return Array.from(e, (e) => F(e));
1504
1504
  }
1505
1505
  return this.readArgument();
1506
1506
  }
@@ -1538,7 +1538,7 @@ var Tn = [
1538
1538
  if (On.has(e)) return;
1539
1539
  let r = Et(e);
1540
1540
  if (r) {
1541
- t.push(P(r.symbol));
1541
+ t.push(F(r.symbol));
1542
1542
  return;
1543
1543
  }
1544
1544
  switch (e) {
@@ -1554,12 +1554,12 @@ var Tn = [
1554
1554
  case "dfrac":
1555
1555
  case "tfrac": {
1556
1556
  let e = this.readArgument(), n = this.readArgument(), r = (e) => e[0] !== void 0 && this.uprightD.has(e[0]);
1557
- t.push(r(e) && r(n) ? Te(e.slice(1), n.slice(1)) : Se(e, n));
1557
+ t.push(r(e) && r(n) ? we(e.slice(1), n.slice(1)) : xe(e, n));
1558
1558
  return;
1559
1559
  }
1560
1560
  case "sqrt": {
1561
1561
  let e = null;
1562
- this.peek()?.kind === "char" && this.peek().value === "[" && (this.next(), e = this.readUntilChar("]")), t.push(we(this.readArgument(), e));
1562
+ this.peek()?.kind === "char" && this.peek().value === "[" && (this.next(), e = this.readUntilChar("]")), t.push(Ce(this.readArgument(), e));
1563
1563
  return;
1564
1564
  }
1565
1565
  case "left": {
@@ -1572,7 +1572,7 @@ var Tn = [
1572
1572
  case "lfloor":
1573
1573
  case "lceil": {
1574
1574
  let n = this.readRow({ command: e === "lfloor" ? "rfloor" : "rceil" });
1575
- this.next(), t.push(I(n, e === "lfloor" ? "⌊" : "⌈"));
1575
+ this.next(), t.push(L(n, e === "lfloor" ? "⌊" : "⌈"));
1576
1576
  return;
1577
1577
  }
1578
1578
  case "rfloor":
@@ -1580,17 +1580,17 @@ var Tn = [
1580
1580
  case "right": return;
1581
1581
  case "cdot":
1582
1582
  case "ast":
1583
- t.push(P("·"));
1583
+ t.push(F("·"));
1584
1584
  return;
1585
1585
  case "times":
1586
- t.push(P("×"));
1586
+ t.push(F("×"));
1587
1587
  return;
1588
1588
  case "square":
1589
1589
  case "Box": return;
1590
1590
  case "{":
1591
1591
  case "}":
1592
1592
  case "|":
1593
- t.push(P(e));
1593
+ t.push(F(e));
1594
1594
  return;
1595
1595
  case "mathrm":
1596
1596
  case "operatorname":
@@ -1603,61 +1603,61 @@ var Tn = [
1603
1603
  return;
1604
1604
  }
1605
1605
  }
1606
- let i = Xe(e);
1606
+ let i = Ye(e);
1607
1607
  if (i) {
1608
- t.push(F(i));
1608
+ t.push(I(i));
1609
1609
  return;
1610
1610
  }
1611
- let a = Fe(e);
1612
- t.push(P(a ?? e));
1611
+ let a = Pe(e);
1612
+ t.push(F(a ?? e));
1613
1613
  }
1614
1614
  readNamed(e, t, n) {
1615
1615
  if (!t) return;
1616
1616
  if (e === "mathrm" && (t === "E" || t === "e" && this.peek()?.kind === "open")) {
1617
- n.push(P(t));
1617
+ n.push(F(t));
1618
1618
  return;
1619
1619
  }
1620
- let r = e === "mathrm" ? Ie(t) : void 0;
1620
+ let r = e === "mathrm" ? Fe(t) : void 0;
1621
1621
  if (r) {
1622
- n.push(P(r));
1622
+ n.push(F(r));
1623
1623
  return;
1624
1624
  }
1625
1625
  if (e === "mathrm" && t === "d") {
1626
- let e = P("d");
1626
+ let e = F("d");
1627
1627
  this.uprightD.add(e), n.push(e);
1628
1628
  return;
1629
1629
  }
1630
1630
  if (e === "operatorname" || e === "mathrm") {
1631
- n.push(F(Xe(t) ?? t));
1631
+ n.push(I(Ye(t) ?? t));
1632
1632
  return;
1633
1633
  }
1634
1634
  if (e === "text" || e === "textrm") {
1635
- n.push(...Array.from(t, (e) => P(e)));
1635
+ n.push(...Array.from(t, (e) => F(e)));
1636
1636
  return;
1637
1637
  }
1638
- n.push(...Array.from(t, (e) => P(e)));
1638
+ n.push(...Array.from(t, (e) => F(e)));
1639
1639
  }
1640
1640
  };
1641
1641
  function jn(e) {
1642
- let t = it(e);
1642
+ let t = rt(e);
1643
1643
  return t.length > 0 && t[t.length - 1].end === e.length;
1644
1644
  }
1645
1645
  function Mn(e, t) {
1646
- return e.flatMap((e) => e.kind === "symbol" && e.value === "," ? Array.from({ length: t }, () => P("_")) : [e]);
1646
+ return e.flatMap((e) => e.kind === "symbol" && e.value === "," ? Array.from({ length: t }, () => F("_")) : [e]);
1647
1647
  }
1648
1648
  function Nn(e) {
1649
1649
  let t = e[e.length - 1];
1650
1650
  if (t?.kind !== "superscript" || e.length < 2) return e;
1651
1651
  let n = [
1652
1652
  ...e.slice(0, -1),
1653
- P("_"),
1654
- P("_"),
1653
+ F("_"),
1654
+ F("_"),
1655
1655
  ...Mn(t.sup, 2)
1656
- ], r = rt(n);
1657
- return r.length !== 1 || r[0].start !== 0 || r[0].end !== n.length || r[0].functionName ? e : bt(n.map((e) => e.value))?.parts.filter((e) => e.role === "sup").every((e) => $e(n[e.text[0]])) ? n : e;
1656
+ ], r = nt(n);
1657
+ return r.length !== 1 || r[0].start !== 0 || r[0].end !== n.length || r[0].functionName ? e : yt(n.map((e) => e.value))?.parts.filter((e) => e.role === "sup").every((e) => Qe(n[e.text[0]])) ? n : e;
1658
1658
  }
1659
1659
  function Pn(e) {
1660
- return Ee(Array.from(e.trim(), (e) => P(e)));
1660
+ return Te(Array.from(e.trim(), (e) => F(e)));
1661
1661
  }
1662
1662
  function Fn(e) {
1663
1663
  return new An(wn(e)).readAll();
@@ -1683,7 +1683,7 @@ function Vn(e, t) {
1683
1683
  if (!(Bn(t) || t === "." || t === "e" || t === "E" || r)) break;
1684
1684
  n--;
1685
1685
  }
1686
- return n > 0 && et(e[n - 1]) ? null : e.slice(n, t).map((e) => zn(e)).join("");
1686
+ return n > 0 && $e(e[n - 1]) ? null : e.slice(n, t).map((e) => zn(e)).join("");
1687
1687
  }
1688
1688
  var Hn = /^(\d+\.?\d*|\.\d*)([eE][+-]?\d*)?$/;
1689
1689
  function Un(e, t) {
@@ -1695,7 +1695,7 @@ function Wn(e, t, n) {
1695
1695
  return r !== null && Hn.test(r + n);
1696
1696
  }
1697
1697
  function Gn(e, t) {
1698
- let n = j(e, t.path);
1698
+ let n = M(e, t.path);
1699
1699
  return n && In(n[t.offset]) ? {
1700
1700
  ...t,
1701
1701
  offset: t.offset + 1
@@ -1727,7 +1727,7 @@ function Jn(e, t, n, r) {
1727
1727
  atom: c,
1728
1728
  branch: e
1729
1729
  }], n, r);
1730
- a !== i && (l = A(l, e, a));
1730
+ a !== i && (l = j(l, e, a));
1731
1731
  }
1732
1732
  return l !== s && (o = !0), [l];
1733
1733
  });
@@ -1764,7 +1764,7 @@ function Zn(e) {
1764
1764
  };
1765
1765
  }
1766
1766
  function Qn(e, t) {
1767
- return e.offset === t.offset && M(e.path, t.path);
1767
+ return e.offset === t.offset && N(e.path, t.path);
1768
1768
  }
1769
1769
  function $n(e) {
1770
1770
  return `${e.path.map((e) => `${e.atom}.${e.branch}`).join(" › ") || "root"} @ ${e.offset}`;
@@ -1783,7 +1783,7 @@ function er(e) {
1783
1783
  }
1784
1784
  function tr(e, t) {
1785
1785
  if (t.length === 0) return null;
1786
- let n = t.slice(0, -1), r = j(e, n), { atom: i, branch: a } = t[t.length - 1];
1786
+ let n = t.slice(0, -1), r = M(e, n), { atom: i, branch: a } = t[t.length - 1];
1787
1787
  if (!r || !r[i]) throw Error("Cursor path does not resolve");
1788
1788
  return {
1789
1789
  rowPath: n,
@@ -1794,7 +1794,7 @@ function tr(e, t) {
1794
1794
  };
1795
1795
  }
1796
1796
  function nr(e, t) {
1797
- let n = j(e, t);
1797
+ let n = M(e, t);
1798
1798
  if (!n) throw Error("Cursor path does not resolve");
1799
1799
  return n;
1800
1800
  }
@@ -1881,7 +1881,7 @@ var ar = {
1881
1881
  };
1882
1882
  function or(e, t) {
1883
1883
  if (e.kind !== "piecewise") return ar[e.kind] ?? null;
1884
- let n = ye(t);
1884
+ let n = A(t);
1885
1885
  if (!n) return null;
1886
1886
  let r = n.part === "otherwise" ? "value" : n.part, i = e.pieces.map((e, t) => `${r}${t}`);
1887
1887
  return e.otherwise ? [...i, "otherwise"] : i;
@@ -1926,7 +1926,7 @@ function G(e) {
1926
1926
  }
1927
1927
  function dr(e) {
1928
1928
  let t = G(e);
1929
- return t ? j(e.root, t.path).slice(t.start, t.end) : [];
1929
+ return t ? M(e.root, t.path).slice(t.start, t.end) : [];
1930
1930
  }
1931
1931
  function fr(e) {
1932
1932
  return `${e.path.map((e) => `${e.atom}.${e.branch}`).join(" › ") || "root"} ${e.start}–${e.end}`;
@@ -1944,7 +1944,7 @@ function pr(e, t, n) {
1944
1944
  };
1945
1945
  }
1946
1946
  function mr(e, t) {
1947
- let n = e.anchor ?? e.cursor, { path: r, offset: i } = e.cursor, a = j(e.root, r), o;
1947
+ let n = e.anchor ?? e.cursor, { path: r, offset: i } = e.cursor, a = M(e.root, r), o;
1948
1948
  if (t === "forward" ? i < a.length : i > 0) {
1949
1949
  let e = i + (t === "forward" ? 1 : -1);
1950
1950
  t === "backward" && In(a[i - 1]) && (e = Math.max(0, i - 2)), t === "forward" && In(a[e]) && e++, o = {
@@ -2010,16 +2010,16 @@ function xr() {
2010
2010
  };
2011
2011
  }
2012
2012
  function K(e, t) {
2013
- let n = j(e, t);
2013
+ let n = M(e, t);
2014
2014
  if (!n) throw Error("Cursor path does not resolve");
2015
2015
  return n;
2016
2016
  }
2017
2017
  function Sr(e, t, n) {
2018
2018
  if (t.length === 0) return n(e);
2019
- let [r, ...i] = t, a = e[r.atom], o = be(a, r.branch);
2019
+ let [r, ...i] = t, a = e[r.atom], o = ye(a, r.branch);
2020
2020
  if (!o) throw Error("Cursor path does not resolve");
2021
2021
  let s = e.slice();
2022
- return s[r.atom] = A(a, r.branch, Sr(o, i, n)), s;
2022
+ return s[r.atom] = j(a, r.branch, Sr(o, i, n)), s;
2023
2023
  }
2024
2024
  function q(e, t, n, r, i, a) {
2025
2025
  return {
@@ -2091,7 +2091,7 @@ var Ar = (e, t) => [...e.rowPath, {
2091
2091
  }], jr = (e) => e.value.length === 0 && e.condition.length === 0, Mr = (e) => {
2092
2092
  let t = kr(e);
2093
2093
  if (!t) return e;
2094
- let n = ye(t.branch), { pieces: r } = t.atom, i = n.part === "otherwise" ? r.length : n.piece + 1, a = {
2094
+ let n = A(t.branch), { pieces: r } = t.atom, i = n.part === "otherwise" ? r.length : n.piece + 1, a = {
2095
2095
  ...t.atom,
2096
2096
  pieces: [
2097
2097
  ...r.slice(0, i),
@@ -2117,7 +2117,7 @@ var Ar = (e, t) => [...e.rowPath, {
2117
2117
  offset: t.atom.otherwise.length
2118
2118
  }
2119
2119
  };
2120
- let r = L("0.0");
2120
+ let r = R("0.0");
2121
2121
  return {
2122
2122
  ...q(e, t.rowPath, t.index, 1, [{
2123
2123
  ...t.atom,
@@ -2133,7 +2133,7 @@ var Ar = (e, t) => [...e.rowPath, {
2133
2133
  };
2134
2134
  };
2135
2135
  function Pr(e, t) {
2136
- let n = ye(t.branch), { pieces: r, otherwise: i } = t.atom;
2136
+ let n = A(t.branch), { pieces: r, otherwise: i } = t.atom;
2137
2137
  if (n.part === "otherwise") {
2138
2138
  if (!i || i.length > 0) return null;
2139
2139
  let n = r.length - 1;
@@ -2159,7 +2159,7 @@ function Pr(e, t) {
2159
2159
  return q(e, t.rowPath, t.index, 1, [a], o);
2160
2160
  }
2161
2161
  function Fr(e, t) {
2162
- let n = ye(t.branch), { pieces: r, otherwise: i } = t.atom;
2162
+ let n = A(t.branch), { pieces: r, otherwise: i } = t.atom;
2163
2163
  if (n.part === "otherwise") return !i || i.length > 0 ? null : q(e, t.rowPath, t.index, 1, [{
2164
2164
  ...t.atom,
2165
2165
  otherwise: null
@@ -2224,7 +2224,7 @@ function Rr(e, t, n) {
2224
2224
  };
2225
2225
  }
2226
2226
  function zr(e) {
2227
- return Ue(e)?.latexName ?? e;
2227
+ return He(e)?.latexName ?? e;
2228
2228
  }
2229
2229
  function Br(e) {
2230
2230
  return (t) => {
@@ -2240,7 +2240,7 @@ function Br(e) {
2240
2240
  function J(e) {
2241
2241
  return (t) => {
2242
2242
  let n = Ir(t), { path: r, offset: i } = n.cursor;
2243
- return q(n, r, i, 0, [P(e)], {
2243
+ return q(n, r, i, 0, [F(e)], {
2244
2244
  path: r,
2245
2245
  offset: i + 1
2246
2246
  });
@@ -2252,7 +2252,7 @@ var Vr = (e) => {
2252
2252
  if (i) return q({
2253
2253
  root: e.root,
2254
2254
  cursor: e.cursor
2255
- }, t, n - 1, 1, [P(i)], {
2255
+ }, t, n - 1, 1, [F(i)], {
2256
2256
  path: t,
2257
2257
  offset: n
2258
2258
  });
@@ -2261,7 +2261,7 @@ var Vr = (e) => {
2261
2261
  }, Hr = (e) => {
2262
2262
  let t = G(e);
2263
2263
  if (t) {
2264
- let { path: n, start: r, end: i } = t, a = De([[K(e.root, n).slice(r, i), []]], L("0.0"));
2264
+ let { path: n, start: r, end: i } = t, a = Ee([[K(e.root, n).slice(r, i), []]], R("0.0"));
2265
2265
  return q(e, n, r, i - r, [a], {
2266
2266
  path: [...n, {
2267
2267
  atom: r,
@@ -2270,7 +2270,7 @@ var Vr = (e) => {
2270
2270
  offset: 0
2271
2271
  });
2272
2272
  }
2273
- return Ur(De([[[], []]], L("0.0")), "value0")(e);
2273
+ return Ur(Ee([[[], []]], R("0.0")), "value0")(e);
2274
2274
  };
2275
2275
  function Ur(e, t) {
2276
2276
  return (n) => {
@@ -2284,12 +2284,12 @@ function Ur(e, t) {
2284
2284
  });
2285
2285
  };
2286
2286
  }
2287
- var Wr = Rr((e) => Se(Lr(e), []), "den", "num"), Gr = (e) => {
2287
+ var Wr = Rr((e) => xe(Lr(e), []), "den", "num"), Gr = (e) => {
2288
2288
  if (G(e)) return Wr(e);
2289
2289
  let t = Ir(e), { path: n, offset: r } = t.cursor, i = K(t.root, n), a = r;
2290
2290
  for (; a > 0 && !wr(i[a - 1]);) a--;
2291
2291
  let o = Lr(i.slice(a, r)), s = o.length > 0 ? "den" : "num";
2292
- return q(t, n, a, r - a, [Se(o, [])], {
2292
+ return q(t, n, a, r - a, [xe(o, [])], {
2293
2293
  path: [...n, {
2294
2294
  atom: a,
2295
2295
  branch: s
@@ -2299,8 +2299,8 @@ var Wr = Rr((e) => Se(Lr(e), []), "den", "num"), Gr = (e) => {
2299
2299
  }, Kr = (e) => {
2300
2300
  let t = G(e);
2301
2301
  if (t) {
2302
- let { path: n, start: r, end: i } = t, a = K(e.root, n).slice(r, i), o = a.length === 1 ? a : [I(a, "(")];
2303
- return q(e, n, r, i - r, [...o, Ce()], {
2302
+ let { path: n, start: r, end: i } = t, a = K(e.root, n).slice(r, i), o = a.length === 1 ? a : [L(a, "(")];
2303
+ return q(e, n, r, i - r, [...o, Se()], {
2304
2304
  path: [...n, {
2305
2305
  atom: r + o.length,
2306
2306
  branch: "sup"
@@ -2327,7 +2327,7 @@ var Wr = Rr((e) => Se(Lr(e), []), "den", "num"), Gr = (e) => {
2327
2327
  }],
2328
2328
  offset: s.sup.length
2329
2329
  }
2330
- } : Tr(s) ? Ur(Ce(), "sup")(n) : e;
2330
+ } : Tr(s) ? Ur(Se(), "sup")(n) : e;
2331
2331
  };
2332
2332
  function qr(e, t) {
2333
2333
  for (let n = e.cursor.path.length; n > 0; n--) {
@@ -2358,10 +2358,10 @@ function Jr(e) {
2358
2358
  return q(n, i.rowPath, i.index, 1, [l, ...s.slice(c)], o);
2359
2359
  };
2360
2360
  }
2361
- var Yr = (e) => Rr((t) => I(t, e), "after", "body"), Xr = (e) => {
2361
+ var Yr = (e) => Rr((t) => L(t, e), "after", "body"), Xr = (e) => {
2362
2362
  if (!G(e)) {
2363
- let { path: t, offset: n } = e.cursor, r = dt(K(e.root, t), n);
2364
- if (r) return q(e, t, r.start, n - r.start, [I([], r.open)], {
2363
+ let { path: t, offset: n } = e.cursor, r = ut(K(e.root, t), n);
2364
+ if (r) return q(e, t, r.start, n - r.start, [L([], r.open)], {
2365
2365
  path: [...t, {
2366
2366
  atom: r.start,
2367
2367
  branch: "body"
@@ -2391,12 +2391,12 @@ var Yr = (e) => Rr((t) => I(t, e), "after", "body"), Xr = (e) => {
2391
2391
  };
2392
2392
  }
2393
2393
  let i = Ir(e), a = i.cursor.offset;
2394
- return it(K(i.root, i.cursor.path).slice(0, a)).find((e) => e.end === a) ? Ur(Ee(), "units")(i) : e;
2394
+ return rt(K(i.root, i.cursor.path).slice(0, a)).find((e) => e.end === a) ? Ur(Te(), "units")(i) : e;
2395
2395
  };
2396
2396
  function Qr(e) {
2397
2397
  return (t) => {
2398
2398
  let { path: n, offset: r } = t.cursor, i = K(t.root, n);
2399
- return !G(t) && In(i[r - 1]) && Wn(i, r - 1, e) ? q(t, n, r - 1, 0, [P(e)], {
2399
+ return !G(t) && In(i[r - 1]) && Wn(i, r - 1, e) ? q(t, n, r - 1, 0, [F(e)], {
2400
2400
  path: n,
2401
2401
  offset: r + 1
2402
2402
  }) : J(e)(t);
@@ -2422,7 +2422,7 @@ var $r = (e) => {
2422
2422
  ]), ri = (e) => {
2423
2423
  if (G(e)) return di(e);
2424
2424
  let t = Dr(e);
2425
- return t?.atom.kind === "group" && t.atom.open === "|" ? Jr(["|"])(e) : Ur(I([], "|"), "body")(e);
2425
+ return t?.atom.kind === "group" && t.atom.open === "|" ? Jr(["|"])(e) : Ur(L([], "|"), "body")(e);
2426
2426
  }, ii = (e) => {
2427
2427
  if (G(e)) return vr(e, "end");
2428
2428
  let t = Dr(e);
@@ -2453,7 +2453,7 @@ var $r = (e) => {
2453
2453
  offset: a
2454
2454
  });
2455
2455
  if (i.kind === "function") {
2456
- let n = L(zr(i.name).slice(0, -1));
2456
+ let n = R(zr(i.name).slice(0, -1));
2457
2457
  return q(e, t, a, 1, n, {
2458
2458
  path: t,
2459
2459
  offset: a + n.length
@@ -2509,7 +2509,7 @@ var $r = (e) => {
2509
2509
  path: t,
2510
2510
  offset: n
2511
2511
  });
2512
- if (i.kind === "function") return q(e, t, n, 1, L(zr(i.name).slice(1)), {
2512
+ if (i.kind === "function") return q(e, t, n, 1, R(zr(i.name).slice(1)), {
2513
2513
  path: t,
2514
2514
  offset: n
2515
2515
  });
@@ -2571,13 +2571,13 @@ function ci(e) {
2571
2571
  let n = G(t);
2572
2572
  if (n) {
2573
2573
  let { path: r, start: i, end: a } = n, o = K(t.root, r).slice(i, a);
2574
- return q(t, r, i, a - i, [F(e), I(o, "(")], {
2574
+ return q(t, r, i, a - i, [I(e), L(o, "(")], {
2575
2575
  path: r,
2576
2576
  offset: i + 2
2577
2577
  });
2578
2578
  }
2579
2579
  let r = Ir(t), { path: i, offset: a } = r.cursor;
2580
- return q(r, i, a, 0, [F(e), I([], "(")], {
2580
+ return q(r, i, a, 0, [I(e), L([], "(")], {
2581
2581
  path: [...i, {
2582
2582
  atom: a + 1,
2583
2583
  branch: "body"
@@ -2586,7 +2586,7 @@ function ci(e) {
2586
2586
  });
2587
2587
  };
2588
2588
  }
2589
- var li = Rr((e) => we(e), "after", "body"), ui = Rr((e) => we(e, []), "index", "index"), di = Rr((e) => I(e, "|"), "after", "body"), fi = Rr((e) => Te(e, []), "variable", "expr"), pi = [
2589
+ var li = Rr((e) => Ce(e), "after", "body"), ui = Rr((e) => Ce(e, []), "index", "index"), di = Rr((e) => L(e, "|"), "after", "body"), fi = Rr((e) => we(e, []), "variable", "expr"), pi = [
2590
2590
  {
2591
2591
  names: ["frac", "fraction"],
2592
2592
  title: "Fraction",
@@ -2667,10 +2667,10 @@ function hi(e) {
2667
2667
  if (t) return t.command;
2668
2668
  let n = Et(e);
2669
2669
  if (n) return J(n.symbol);
2670
- let r = Me(e);
2670
+ let r = je(e);
2671
2671
  if (r) return J(r.symbol);
2672
- let i = Xe(e);
2673
- return i ? ci(i) : Br(z.has(e) ? [P(e)] : L(e));
2672
+ let i = Ye(e);
2673
+ return i ? ci(i) : Br(B.has(e) ? [F(e)] : R(e));
2674
2674
  }
2675
2675
  var gi = {
2676
2676
  Less: "Less than",
@@ -2692,26 +2692,26 @@ var gi = {
2692
2692
  }, vi = (() => {
2693
2693
  let e = [
2694
2694
  ...pi,
2695
- ...V.map((e) => ({
2695
+ ...bt.map((e) => ({
2696
2696
  names: e.commands,
2697
2697
  title: gi[e.type],
2698
2698
  latex: e.latex
2699
2699
  })),
2700
- ...Oe.map((e) => ({
2700
+ ...De.map((e) => ({
2701
2701
  names: e.commands,
2702
2702
  title: _i[e.symbol] ?? e.symbol,
2703
2703
  latex: e.latex
2704
2704
  })),
2705
- ...Object.values(He).map((e) => ({
2705
+ ...Object.values(Ve).map((e) => ({
2706
2706
  names: [
2707
2707
  e.name,
2708
2708
  e.latexName,
2709
2709
  ...e.aliases ?? []
2710
2710
  ],
2711
2711
  title: "Function",
2712
- latex: We(e.name)
2712
+ latex: Ue(e.name)
2713
2713
  })),
2714
- ...[...z].map((e) => ({
2714
+ ...[...B].map((e) => ({
2715
2715
  names: [e],
2716
2716
  title: "Greek letter",
2717
2717
  latex: `\\${e}`
@@ -2887,7 +2887,7 @@ var ji = (e) => Array.from(e.children), Y = {
2887
2887
  symbol: "∧",
2888
2888
  level: Y.And
2889
2889
  }
2890
- }, Ni = new Map(V.filter((e) => e.role === "comparison").map((e) => [e.mathml, e.symbol])), Pi = new Map(Oe.map((e) => [e.mathml, e.symbol])), Fi = new Map(Object.values(He).map((e) => [e.mathMlTag, e.name])), Ii = /^[A-Za-z_][A-Za-z0-9_]*$/, Li = class {
2890
+ }, Ni = new Map(bt.filter((e) => e.role === "comparison").map((e) => [e.mathml, e.symbol])), Pi = new Map(De.map((e) => [e.mathml, e.symbol])), Fi = new Map(Object.values(Ve).map((e) => [e.mathMlTag, e.name])), Ii = /^[A-Za-z_][A-Za-z0-9_]*$/, Li = class {
2891
2891
  problems;
2892
2892
  constructor(e) {
2893
2893
  this.problems = e;
@@ -2900,7 +2900,7 @@ var ji = (e) => Array.from(e.children), Y = {
2900
2900
  case "piecewise": return this.piecewise(e);
2901
2901
  default: {
2902
2902
  let t = Pi.get(e.localName);
2903
- return t ? X([P(t)]) : this.unsupported(`<${e.localName}>`);
2903
+ return t ? X([F(t)]) : this.unsupported(`<${e.localName}>`);
2904
2904
  }
2905
2905
  }
2906
2906
  }
@@ -2909,7 +2909,7 @@ var ji = (e) => Array.from(e.children), Y = {
2909
2909
  }
2910
2910
  identifier(e) {
2911
2911
  let t = (e.textContent ?? "").trim();
2912
- return t === "_" ? X([]) : Ii.test(t) ? (Xe(t) ? this.problems.add(`The variable ${t} has the name of a function, so it reads as one here`) : nt(t) && this.problems.add(`The variable ${t} has a reserved name, so it reads as the constant here`), X(mt(t))) : (this.problems.add(`"${t}" isn't a CellML variable name`), X(L(t)));
2912
+ return t === "_" ? X([]) : Ii.test(t) ? (Ye(t) ? this.problems.add(`The variable ${t} has the name of a function, so it reads as one here`) : tt(t) && this.problems.add(`The variable ${t} has a reserved name, so it reads as the constant here`), X(pt(t))) : (this.problems.add(`"${t}" isn't a CellML variable name`), X(R(t)));
2913
2913
  }
2914
2914
  number(e) {
2915
2915
  let t = Hi(e), n;
@@ -2919,9 +2919,9 @@ var ji = (e) => Array.from(e.children), Y = {
2919
2919
  } else n = (e.textContent ?? "").trim();
2920
2920
  let r = n.startsWith("-"), i = r ? n.slice(1) : n.replace(/^\+/, "");
2921
2921
  /^(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(i) || this.problems.add(`"${n}" isn't a number`);
2922
- let a = L(i);
2923
- return t && t !== "dimensionless" && (Ii.test(t) || this.problems.add(`"${t}" isn't a units name`), a.push(Ee(L(t)))), r ? {
2924
- row: [P("-"), ...a],
2922
+ let a = R(i);
2923
+ return t && t !== "dimensionless" && (Ii.test(t) || this.problems.add(`"${t}" isn't a units name`), a.push(Te(R(t)))), r ? {
2924
+ row: [F("-"), ...a],
2925
2925
  level: Y.Unary
2926
2926
  } : X(a);
2927
2927
  }
@@ -2936,7 +2936,7 @@ var ji = (e) => Array.from(e.children), Y = {
2936
2936
  return {
2937
2937
  row: [
2938
2938
  ...Bi(e, Y.Additive),
2939
- P(n),
2939
+ F(n),
2940
2940
  ...Bi(t, Y.Additive)
2941
2941
  ],
2942
2942
  level: Y.Comparison
@@ -2953,7 +2953,7 @@ var ji = (e) => Array.from(e.children), Y = {
2953
2953
  case "not": {
2954
2954
  let [e] = a();
2955
2955
  return e ? {
2956
- row: [P("¬"), ...Bi(e, Y.Not)],
2956
+ row: [F("¬"), ...Bi(e, Y.Not)],
2957
2957
  level: Y.Not
2958
2958
  } : this.unsupported("<not> without an operand");
2959
2959
  }
@@ -2964,7 +2964,7 @@ var ji = (e) => Array.from(e.children), Y = {
2964
2964
  case "minus": {
2965
2965
  let e = a();
2966
2966
  if (e.length === 1) return {
2967
- row: [P("-"), ...Bi(e[0], Y.Term)],
2967
+ row: [F("-"), ...Bi(e[0], Y.Term)],
2968
2968
  level: Y.Unary
2969
2969
  };
2970
2970
  if (e.length !== 2) return this.unsupported("<minus> with more than two operands");
@@ -2972,7 +2972,7 @@ var ji = (e) => Array.from(e.children), Y = {
2972
2972
  return {
2973
2973
  row: [
2974
2974
  ...Bi(t, Y.Additive),
2975
- P("-"),
2975
+ F("-"),
2976
2976
  ...Bi(n, Y.Term)
2977
2977
  ],
2978
2978
  level: Y.Additive
@@ -2984,21 +2984,21 @@ var ji = (e) => Array.from(e.children), Y = {
2984
2984
  };
2985
2985
  case "divide": {
2986
2986
  let [e, t] = a();
2987
- return !e || !t ? this.unsupported("<divide> without two operands") : X([Se(e.row, t.row)]);
2987
+ return !e || !t ? this.unsupported("<divide> without two operands") : X([xe(e.row, t.row)]);
2988
2988
  }
2989
2989
  case "power": {
2990
2990
  let [e, t] = a();
2991
- return !e || !t ? this.unsupported("<power> without two operands") : X([...Bi(e, Y.Primary), Ce(t.row)]);
2991
+ return !e || !t ? this.unsupported("<power> without two operands") : X([...Bi(e, Y.Primary), Se(t.row)]);
2992
2992
  }
2993
2993
  case "root": {
2994
2994
  let [e] = a();
2995
2995
  if (!e) return this.unsupported("<root> without an operand");
2996
2996
  let t = zi(r, "degree"), n = t ? this.inner(t) : null;
2997
- return X([we(e.row, n)]);
2997
+ return X([Ce(e.row, n)]);
2998
2998
  }
2999
2999
  case "abs": {
3000
3000
  let [e] = a();
3001
- return e ? X([I(e.row, "|")]) : this.unsupported("<abs> without an operand");
3001
+ return e ? X([L(e.row, "|")]) : this.unsupported("<abs> without an operand");
3002
3002
  }
3003
3003
  case "diff": return this.derivative(r, i);
3004
3004
  default: return this.functionCall(o, r, a());
@@ -3008,19 +3008,19 @@ var ji = (e) => Array.from(e.children), Y = {
3008
3008
  let r = Fi.get(e);
3009
3009
  if (!r) return this.unsupported(`<${e}>`);
3010
3010
  if (n.length === 0) return this.unsupported(`<${e}> without an operand`);
3011
- let i = Ke(r);
3012
- if (i && n.length === 1) return X([I(n[0].row, i.open, i.close)]);
3011
+ let i = Ge(r);
3012
+ if (i && n.length === 1) return X([L(n[0].row, i.open, i.close)]);
3013
3013
  let a = e === "log" ? zi(t, "logbase") : void 0, o = (a ? [n[0], {
3014
3014
  row: this.inner(a),
3015
3015
  level: Y.Primary
3016
- }] : n).flatMap((e, t) => t === 0 ? e.row : [P(","), ...e.row]);
3017
- return X([F(r), I(o)]);
3016
+ }] : n).flatMap((e, t) => t === 0 ? e.row : [F(","), ...e.row]);
3017
+ return X([I(r), L(o)]);
3018
3018
  }
3019
3019
  derivative(e, t) {
3020
3020
  let n = zi(e, "bvar"), [r] = t;
3021
3021
  if (!n || !r) return this.unsupported("<diff> without <bvar> and an operand");
3022
3022
  let i = ji(n).find((e) => e.localName === "ci"), a = ji(n).find((e) => e.localName === "degree");
3023
- return a && (a.textContent ?? "").trim() !== "1" ? this.unsupported("A derivative of order other than 1") : i ? X([Te(this.expression(r).row, this.expression(i).row)]) : this.unsupported("<bvar> without a <ci>");
3023
+ return a && (a.textContent ?? "").trim() !== "1" ? this.unsupported("A derivative of order other than 1") : i ? X([we(this.expression(r).row, this.expression(i).row)]) : this.unsupported("<bvar> without a <ci>");
3024
3024
  }
3025
3025
  piecewise(e) {
3026
3026
  let t = [], n = null, r = (e) => e ? this.expression(e).row : [];
@@ -3028,7 +3028,7 @@ var ji = (e) => Array.from(e.children), Y = {
3028
3028
  let [e, a] = ji(i);
3029
3029
  i.localName === "piece" ? ((!e || !a) && this.problems.add("A <piece> without a value and a condition"), t.push([r(e), r(a)])) : i.localName === "otherwise" ? (e || this.problems.add("An <otherwise> without a value"), n = r(e)) : this.problems.add(`<${i.localName}> in <piecewise> isn't supported; it was left out`);
3030
3030
  }
3031
- return t.length === 0 ? this.unsupported("A <piecewise> without a <piece>") : X([De(t, n)]);
3031
+ return t.length === 0 ? this.unsupported("A <piecewise> without a <piece>") : X([Ee(t, n)]);
3032
3032
  }
3033
3033
  inner(e) {
3034
3034
  let [t] = ji(e);
@@ -3043,12 +3043,12 @@ var ji = (e) => Array.from(e.children), Y = {
3043
3043
  level: Y.Primary
3044
3044
  });
3045
3045
  function Bi(e, t) {
3046
- return e.level < t ? [I(e.row)] : e.row;
3046
+ return e.level < t ? [L(e.row)] : e.row;
3047
3047
  }
3048
3048
  function Vi(e, t, n) {
3049
3049
  let r = [];
3050
3050
  return e.forEach((e, i) => {
3051
- i > 0 && r.push(P(t));
3051
+ i > 0 && r.push(F(t));
3052
3052
  let a = e.level === Y.Unary && (t === "+" && i > 0 || t === "·" && i === 0) ? Y.Unary : n;
3053
3053
  r.push(...Bi(e, a));
3054
3054
  }), r;
@@ -3127,7 +3127,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3127
3127
  top: `${t.top}px`,
3128
3128
  height: `${t.height}px`
3129
3129
  } : null, g.value = t?.placeholder ?? !1;
3130
- let n = c.cursor.path, r = e && n.length > 0 && j(c.modelValue, n)?.length ? ln(e, n) : null;
3130
+ let n = c.cursor.path, r = e && n.length > 0 && M(c.modelValue, n)?.length ? ln(e, n) : null;
3131
3131
  re.value = r ? {
3132
3132
  left: `${r.left}px`,
3133
3133
  top: `${r.top}px`,
@@ -3185,9 +3185,9 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3185
3185
  immediate: !0,
3186
3186
  deep: !0
3187
3187
  }), te(() => {
3188
- window.addEventListener("resize", de), document.addEventListener("copy", P), document.addEventListener("cut", F), document.addEventListener("paste", Se), document.fonts?.ready.then(de);
3188
+ window.addEventListener("resize", de), document.addEventListener("copy", F), document.addEventListener("cut", I), document.addEventListener("paste", xe), document.fonts?.ready.then(de);
3189
3189
  }), ee(() => {
3190
- window.removeEventListener("resize", de), document.removeEventListener("copy", P), document.removeEventListener("cut", F), document.removeEventListener("paste", Se), M();
3190
+ window.removeEventListener("resize", de), document.removeEventListener("copy", F), document.removeEventListener("cut", I), document.removeEventListener("paste", xe), N();
3191
3191
  });
3192
3192
  let me = (e, t) => {
3193
3193
  let n = u.value, r = n ? nn(n, c.modelValue, c.cursor) : null;
@@ -3260,12 +3260,12 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3260
3260
  function O(e, t) {
3261
3261
  let n = G(t) !== null, r = Ti(e);
3262
3262
  if (r !== null) {
3263
- let e = j(t.root, t.cursor.path), i = t.cursor.offset - +!!In(e?.[t.cursor.offset - 1]);
3263
+ let e = M(t.root, t.cursor.path), i = t.cursor.offset - +!!In(e?.[t.cursor.offset - 1]);
3264
3264
  return {
3265
3265
  kind: "type",
3266
3266
  text: r,
3267
3267
  replacedSelection: n,
3268
- exponentSign: !n && (r === "-" || r === "+") && !!e && Ve(e, i)
3268
+ exponentSign: !n && (r === "-" || r === "+") && !!e && Be(e, i)
3269
3269
  };
3270
3270
  }
3271
3271
  return e.key === "Backspace" ? {
@@ -3277,42 +3277,42 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3277
3277
  } : bi;
3278
3278
  }
3279
3279
  let k = null;
3280
- function ye(e) {
3280
+ function A(e) {
3281
3281
  let t = u.value;
3282
3282
  return t ? on(t, c.modelValue, e.clientX, e.clientY) : null;
3283
3283
  }
3284
- function A(e) {
3284
+ function j(e) {
3285
3285
  if (e.preventDefault(), x.value = null, e.button !== 0) return;
3286
- let t = ye(e);
3286
+ let t = A(e);
3287
3287
  if (!t) return;
3288
3288
  u.value?.focus();
3289
3289
  let n = oe();
3290
- k = e.shiftKey ? n.anchor ?? n.cursor : t, he(_r(n, k, t)), window.addEventListener("mousemove", be), window.addEventListener("mouseup", M);
3290
+ k = e.shiftKey ? n.anchor ?? n.cursor : t, he(_r(n, k, t)), window.addEventListener("mousemove", ye), window.addEventListener("mouseup", N);
3291
3291
  }
3292
- function be(e) {
3292
+ function ye(e) {
3293
3293
  if (!k) return;
3294
- let t = ye(e);
3294
+ let t = A(e);
3295
3295
  t && he(_r(oe(), k, t));
3296
3296
  }
3297
- function M() {
3298
- k = null, window.removeEventListener("mousemove", be), window.removeEventListener("mouseup", M);
3297
+ function N() {
3298
+ k = null, window.removeEventListener("mousemove", ye), window.removeEventListener("mouseup", N);
3299
3299
  }
3300
- let xe = () => !!u.value && document.activeElement === u.value;
3301
- function N(e) {
3300
+ let be = () => !!u.value && document.activeElement === u.value;
3301
+ function P(e) {
3302
3302
  let t = dr(oe());
3303
3303
  return t.length === 0 || !e.clipboardData ? !1 : (e.preventDefault(), e.clipboardData.setData("text/plain", W(t, {
3304
3304
  greekNames: c.greekNames,
3305
3305
  typesetNames: c.typesetNames
3306
3306
  })), e.clipboardData.setData(un, dn(t)), !0);
3307
3307
  }
3308
- function P(e) {
3309
- xe() && N(e);
3310
- }
3311
3308
  function F(e) {
3312
- xe() && !c.readonly && N(e) && l("edit", ai(oe()), bi);
3309
+ be() && P(e);
3310
+ }
3311
+ function I(e) {
3312
+ be() && !c.readonly && P(e) && l("edit", ai(oe()), bi);
3313
3313
  }
3314
- function Se(e) {
3315
- if (!xe() || c.readonly || !e.clipboardData) return;
3314
+ function xe(e) {
3315
+ if (!be() || c.readonly || !e.clipboardData) return;
3316
3316
  e.preventDefault();
3317
3317
  let t = e.clipboardData, n = fn(t.getData(un)), r = t.getData("text/plain");
3318
3318
  if (!n && ki(r)) {
@@ -3326,7 +3326,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3326
3326
  let i = n ?? Fn(r);
3327
3327
  i.length > 0 && l("edit", Br(i)(oe()), bi);
3328
3328
  }
3329
- function Ce() {
3329
+ function Se() {
3330
3330
  let e = u.value, t = e ? nn(e, c.modelValue, c.cursor) : null;
3331
3331
  if (!e || !t) return null;
3332
3332
  let n = e.getBoundingClientRect();
@@ -3334,7 +3334,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3334
3334
  }
3335
3335
  return r({
3336
3336
  focus: () => u.value?.focus(),
3337
- caretRect: Ce
3337
+ caretRect: Se
3338
3338
  }), (n, r) => (_(), a("div", {
3339
3339
  ref_key: "surfaceEl",
3340
3340
  ref: u,
@@ -3347,7 +3347,7 @@ var Gi = (e) => e.kind ?? "error", Ki = (e) => Gi(e) !== "hint", qi = ["aria-inv
3347
3347
  "aria-label": "Equation",
3348
3348
  "aria-invalid": t.marks.some(S(Ki)) || void 0,
3349
3349
  onKeydown: ge,
3350
- onMousedown: A,
3350
+ onMousedown: j,
3351
3351
  onMouseenter: de,
3352
3352
  onMousemove: pe,
3353
3353
  onMouseleave: r[0] ||= (e) => x.value = null,
@@ -3434,7 +3434,7 @@ var ta = {
3434
3434
  "·": "*",
3435
3435
  "×": "*",
3436
3436
  ",": ",",
3437
- ...Object.fromEntries(V.map((e) => [e.symbol, e.symbol]))
3437
+ ...Object.fromEntries(bt.map((e) => [e.symbol, e.symbol]))
3438
3438
  }, na = /^[A-Za-z_][A-Za-z0-9_]*$/, ra = [
3439
3439
  {
3440
3440
  symbol: "∨",
@@ -3461,10 +3461,10 @@ function ia(e, t) {
3461
3461
  }), r++;
3462
3462
  continue;
3463
3463
  }
3464
- if ($e(i)) {
3465
- let t = tt(e, r), i = e.slice(r, t), a = i.map((e) => e.value).join(""), o = i.map((e) => e.id);
3464
+ if (Qe(i)) {
3465
+ let t = et(e, r), i = e.slice(r, t), a = i.map((e) => e.value).join(""), o = i.map((e) => e.id);
3466
3466
  r = t;
3467
- let s = Xe(a), c = nt(a);
3467
+ let s = Ye(a), c = tt(a);
3468
3468
  n.push(s ? {
3469
3469
  kind: "function",
3470
3470
  name: s,
@@ -3488,7 +3488,7 @@ function ia(e, t) {
3488
3488
  }), r++;
3489
3489
  continue;
3490
3490
  }
3491
- let a = Be(e, r);
3491
+ let a = ze(e, r);
3492
3492
  if (a) {
3493
3493
  let i = e.slice(a.start, a.end).map((e) => e.id);
3494
3494
  r = a.end;
@@ -3528,7 +3528,7 @@ function ia(e, t) {
3528
3528
  kind: "operator",
3529
3529
  op: o,
3530
3530
  atomIds: s
3531
- }) : je(i.value) ? n.push({
3531
+ }) : Ae(i.value) ? n.push({
3532
3532
  kind: "constant",
3533
3533
  name: i.value,
3534
3534
  atomIds: s
@@ -3737,7 +3737,7 @@ var la = class {
3737
3737
  type: "Abs",
3738
3738
  value: n(e.body, "Empty absolute value")
3739
3739
  };
3740
- let t = qe(e.open);
3740
+ let t = Ke(e.open);
3741
3741
  return t ? {
3742
3742
  type: "FunctionCall",
3743
3743
  name: t,
@@ -3758,7 +3758,7 @@ var la = class {
3758
3758
  variable: n(e.variable, "Empty derivative variable")
3759
3759
  };
3760
3760
  case "piecewise": {
3761
- let t = e.otherwise ? n(e.otherwise, "Empty otherwise value") : null, r = ot(e);
3761
+ let t = e.otherwise ? n(e.otherwise, "Empty otherwise value") : null, r = at(e);
3762
3762
  return t?.type === "Number" && r && (t = {
3763
3763
  ...t,
3764
3764
  units: r
@@ -3845,13 +3845,13 @@ var la = class {
3845
3845
  //#endregion
3846
3846
  //#region src/renderers/mathjson.ts
3847
3847
  function ua(e) {
3848
- return Ue(e)?.mathJson ?? e;
3848
+ return He(e)?.mathJson ?? e;
3849
3849
  }
3850
3850
  function Z(e) {
3851
3851
  switch (e.type) {
3852
3852
  case "Number": return e.value;
3853
3853
  case "Identifier": return e.name;
3854
- case "Constant": return je(e.name).mathJson;
3854
+ case "Constant": return Ae(e.name).mathJson;
3855
3855
  case "Add": return ["Add", ...e.children.map(Z)];
3856
3856
  case "Multiply": return ["Multiply", ...e.children.map(Z)];
3857
3857
  case "Subtract": return [
@@ -3936,7 +3936,7 @@ function $(e, t = {}) {
3936
3936
  switch (e.type) {
3937
3937
  case "Number": return pa(e, t);
3938
3938
  case "Identifier": return `<ci>${e.name}</ci>`;
3939
- case "Constant": return `<${je(e.name).mathml}/>`;
3939
+ case "Constant": return `<${Ae(e.name).mathml}/>`;
3940
3940
  case "Add": return Q("plus", e.children.map((e) => $(e, t)));
3941
3941
  case "Multiply": return Q("times", e.children.map((e) => $(e, t)));
3942
3942
  case "Subtract": return Q("minus", [$(e.minuend, t), $(e.subtrahend, t)]);
@@ -3953,7 +3953,7 @@ function $(e, t = {}) {
3953
3953
  </apply>
3954
3954
  ` : Q("root", [$(e.radicand, t)]);
3955
3955
  case "FunctionCall": {
3956
- let n = Ue(e.name), r = e.args.map((e) => $(e, t));
3956
+ let n = He(e.name), r = e.args.map((e) => $(e, t));
3957
3957
  return n?.mathMlTag ? n.mathMlTag === "log" && r.length === 2 ? `
3958
3958
  <apply>
3959
3959
  <log/>
@@ -4018,14 +4018,30 @@ function _a(e, t, n = {}) {
4018
4018
  switch (t) {
4019
4019
  case "latex": return W(e, n);
4020
4020
  case "mathjson": return da(ea(e).ast);
4021
- case "mathml": return va(e, n);
4021
+ case "mathml": return ba(e, n);
4022
4022
  }
4023
4023
  }
4024
- function va(e, t = {}) {
4025
- let n = $(ea(e).ast, t);
4026
- return ya(`<math ${t.cellml ? `xmlns="${ha}" xmlns:cellml="${ga}"` : `xmlns="${ha}"`}>${n}</math>`);
4024
+ function va(e, t, n = {}) {
4025
+ let r = e.filter((e) => e.length > 0);
4026
+ if (r.length === 1) return _a(r[0], t, n);
4027
+ switch (t) {
4028
+ case "latex": return `\\begin{aligned}\n${r.map((e) => ya(e, n)).join(" \\\\\n")}\n\\end{aligned}`;
4029
+ case "mathjson": return JSON.stringify(r.map((e) => Z(ea(e).ast)), null, 2);
4030
+ case "mathml": return xa(r, n);
4031
+ }
4032
+ }
4033
+ function ya(e, t) {
4034
+ let n = e.findIndex((e) => e.kind === "symbol" && e.value === "=");
4035
+ return n < 0 ? `&${W(e, t)}` : `${W(e.slice(0, n), t)} &= ${W(e.slice(n + 1), t)}`;
4036
+ }
4037
+ function ba(e, t = {}) {
4038
+ return xa([e], t);
4039
+ }
4040
+ function xa(e, t) {
4041
+ let n = e.map((e) => $(ea(e).ast, t)).join("");
4042
+ return Sa(`<math ${t.cellml ? `xmlns="${ha}" xmlns:cellml="${ga}"` : `xmlns="${ha}"`}>${n}</math>`);
4027
4043
  }
4028
- function ya(e, t = " ") {
4044
+ function Sa(e, t = " ") {
4029
4045
  let n = e.match(/<[^>]+>|[^<]+/g) ?? [], r = [], i = 0;
4030
4046
  for (let e = 0; e < n.length; e++) {
4031
4047
  let a = n[e];
@@ -4060,7 +4076,7 @@ function ya(e, t = " ") {
4060
4076
  }
4061
4077
  //#endregion
4062
4078
  //#region src/editor/units.ts
4063
- function ba(e, t, n, r = 0) {
4079
+ function Ca(e, t, n, r = 0) {
4064
4080
  if (!n) return {
4065
4081
  id: e,
4066
4082
  mathml: "",
@@ -4070,20 +4086,20 @@ function ba(e, t, n, r = 0) {
4070
4086
  };
4071
4087
  let i = [], a = [], o = 0, s = (e) => {
4072
4088
  e.type === "Identifier" && !i.includes(e.name) && i.push(e.name), e.type === "Number" && e.units && !a.includes(e.units) && a.push(e.units), e.type === "Placeholder" && o++;
4073
- for (let t of Sa(e)) s(t);
4089
+ for (let t of Ta(e)) s(t);
4074
4090
  };
4075
4091
  return s(n.ast), {
4076
4092
  id: e,
4077
- mathml: va(t, { cellml: !0 }),
4093
+ mathml: ba(t, { cellml: !0 }),
4078
4094
  variables: i,
4079
4095
  units: a,
4080
- complete: n.diagnostics.length === 0 && r === 0 && o === 0 && !xa(t)
4096
+ complete: n.diagnostics.length === 0 && r === 0 && o === 0 && !wa(t)
4081
4097
  };
4082
4098
  }
4083
- function xa(e) {
4084
- return e.some((e) => e.kind === "units" && e.units.length === 0 || k(e).some(([, e]) => xa(e)));
4099
+ function wa(e) {
4100
+ return e.some((e) => e.kind === "units" && e.units.length === 0 || k(e).some(([, e]) => wa(e)));
4085
4101
  }
4086
- function Sa(e) {
4102
+ function Ta(e) {
4087
4103
  switch (e.type) {
4088
4104
  case "Add":
4089
4105
  case "Multiply":
@@ -4110,8 +4126,8 @@ function Sa(e) {
4110
4126
  default: return [];
4111
4127
  }
4112
4128
  }
4113
- function Ca(e, t) {
4114
- let n = [], r = t.some((e) => e.numbers?.length || e.units?.length) ? ut(e) : [], i = t.some((e) => e.variables?.length) ? lt(e) : null;
4129
+ function Ea(e, t) {
4130
+ let n = [], r = t.some((e) => e.numbers?.length || e.units?.length) ? lt(e) : [], i = t.some((e) => e.variables?.length) ? ct(e) : null;
4115
4131
  for (let e of t) {
4116
4132
  for (let t of e.variables ?? []) for (let r of i?.get(t) ?? []) n.push({
4117
4133
  message: e.message,
@@ -4126,9 +4142,9 @@ function Ca(e, t) {
4126
4142
  }
4127
4143
  return n;
4128
4144
  }
4129
- function wa(e, t) {
4145
+ function Da(e, t) {
4130
4146
  let n = [];
4131
- if (t) for (let [r, i] of lt(e)) {
4147
+ if (t) for (let [r, i] of ct(e)) {
4132
4148
  if (!Object.hasOwn(t, r)) continue;
4133
4149
  let e = t[r];
4134
4150
  for (let t of i) n.push({
@@ -4137,7 +4153,7 @@ function wa(e, t) {
4137
4153
  kind: "hint"
4138
4154
  });
4139
4155
  }
4140
- for (let r of ut(e)) {
4156
+ for (let r of lt(e)) {
4141
4157
  if (!r.units && !t) continue;
4142
4158
  let e = r.inherited ? ", as in the first piece" : "";
4143
4159
  n.push({
@@ -4150,29 +4166,29 @@ function wa(e, t) {
4150
4166
  }
4151
4167
  //#endregion
4152
4168
  //#region src/editor/toolbar.ts
4153
- function Ta(e, t) {
4154
- let { latexName: n, latexCommand: r } = He[e];
4169
+ function Oa(e, t) {
4170
+ let { latexName: n, latexCommand: r } = Ve[e];
4155
4171
  return {
4156
4172
  latex: r ? `\\${n}` : `\\operatorname{${n}}`,
4157
4173
  title: `${t} ( ${n} )`,
4158
4174
  command: ci(e)
4159
4175
  };
4160
4176
  }
4161
- var Ea = [
4177
+ var ka = [
4162
4178
  ["sin", "Sine"],
4163
4179
  ["cos", "Cosine"],
4164
4180
  ["tan", "Tangent"],
4165
4181
  ["sec", "Secant"],
4166
4182
  ["csc", "Cosecant"],
4167
4183
  ["cot", "Cotangent"]
4168
- ], Da = (e, t) => Ea.map(([n, r]) => {
4184
+ ], Aa = (e, t) => ka.map(([n, r]) => {
4169
4185
  let i = [
4170
4186
  t && "inverse",
4171
4187
  e && "hyperbolic",
4172
4188
  r.toLowerCase()
4173
4189
  ].filter(Boolean).join(" ");
4174
- return Ta(`${t ? "a" : ""}${n}${e}`, i[0].toUpperCase() + i.slice(1));
4175
- }), Oa = [
4190
+ return Oa(`${t ? "a" : ""}${n}${e}`, i[0].toUpperCase() + i.slice(1));
4191
+ }), ja = [
4176
4192
  {
4177
4193
  id: "fraction",
4178
4194
  title: "Fraction ( / )",
@@ -4228,26 +4244,26 @@ var Ea = [
4228
4244
  sections: [
4229
4245
  {
4230
4246
  label: "Trigonometric",
4231
- items: Da("", !1)
4247
+ items: Aa("", !1)
4232
4248
  },
4233
4249
  {
4234
4250
  label: "Hyperbolic",
4235
- items: Da("h", !1)
4251
+ items: Aa("h", !1)
4236
4252
  },
4237
4253
  {
4238
4254
  label: "Inverse trigonometric",
4239
- items: Da("", !0)
4255
+ items: Aa("", !0)
4240
4256
  },
4241
4257
  {
4242
4258
  label: "Inverse hyperbolic",
4243
- items: Da("h", !0)
4259
+ items: Aa("h", !0)
4244
4260
  },
4245
4261
  {
4246
4262
  label: "Exponential and logarithm",
4247
4263
  items: [
4248
- Ta("exp", "Exponential"),
4249
- Ta("ln", "Natural logarithm"),
4250
- Ta("log", "Logarithm")
4264
+ Oa("exp", "Exponential"),
4265
+ Oa("ln", "Natural logarithm"),
4266
+ Oa("log", "Logarithm")
4251
4267
  ]
4252
4268
  }
4253
4269
  ]
@@ -4371,64 +4387,66 @@ var Ea = [
4371
4387
  }
4372
4388
  ]
4373
4389
  }
4374
- ], ka = { class: "me-workbench" }, Aa = [
4390
+ ], Ma = { class: "me-workbench" }, Na = [
4375
4391
  "title",
4376
4392
  "data-role",
4377
4393
  "aria-haspopup",
4378
4394
  "disabled",
4379
4395
  "onClick"
4380
- ], ja = ["innerHTML"], Ma = {
4396
+ ], Pa = ["innerHTML"], Fa = {
4381
4397
  key: 0,
4382
4398
  class: "pi pi-chevron-down tool-chevron",
4383
4399
  "aria-hidden": "true"
4384
- }, Na = ["disabled"], Pa = { class: "toolbar-group toolbar-lines" }, Fa = {
4400
+ }, Ia = ["disabled"], La = { class: "toolbar-group toolbar-lines" }, Ra = {
4385
4401
  key: 0,
4386
4402
  class: "toolbar-group toolbar-copy"
4387
- }, Ia = {
4403
+ }, za = {
4388
4404
  key: 0,
4389
4405
  class: "gallery"
4390
- }, La = {
4406
+ }, Ba = {
4391
4407
  key: 0,
4392
4408
  class: "gallery-label"
4393
- }, Ra = { class: "gallery-items" }, za = ["title", "onClick"], Ba = ["innerHTML"], Va = {
4409
+ }, Va = { class: "gallery-items" }, Ha = ["title", "onClick"], Ua = ["innerHTML"], Wa = {
4394
4410
  class: "command-chip",
4395
4411
  "data-role": "command"
4396
- }, Ha = {
4412
+ }, Ga = {
4397
4413
  key: 0,
4398
4414
  class: "command-options",
4399
4415
  role: "listbox",
4400
4416
  "aria-label": "Commands"
4401
- }, Ua = [
4417
+ }, Ka = [
4402
4418
  "aria-selected",
4403
4419
  "data-command",
4404
4420
  "onClick"
4405
- ], Wa = ["innerHTML"], Ga = { class: "command-name" }, Ka = { class: "command-title" }, qa = { class: "command-hint" }, Ja = [
4421
+ ], qa = ["innerHTML"], Ja = { class: "command-name" }, Ya = { class: "command-title" }, Xa = { class: "command-hint" }, Za = [
4406
4422
  "data-line",
4407
4423
  "data-line-id",
4424
+ "data-selected",
4408
4425
  "onFocusin",
4409
4426
  "onDragover"
4410
- ], Ya = [
4427
+ ], Qa = [
4411
4428
  "draggable",
4412
4429
  "title",
4430
+ "onMousedown",
4413
4431
  "onDragstart"
4414
- ], Xa = { class: "line-number" }, Za = [
4432
+ ], $a = { class: "line-number" }, eo = [
4415
4433
  "aria-label",
4416
4434
  "title",
4417
4435
  "data-kind"
4418
- ], Qa = { role: "status" }, $a = ["data-kind", "title"], eo = { class: "status-text" }, to = {
4436
+ ], to = { role: "status" }, no = ["data-kind", "title"], ro = { class: "status-text" }, io = {
4419
4437
  key: 0,
4420
4438
  class: "status-more"
4421
- }, no = {
4439
+ }, ao = {
4422
4440
  key: 0,
4423
4441
  class: "focus-meta"
4424
- }, ro = { "data-role": "cursor" }, io = { "data-role": "selection" }, ao = {
4442
+ }, oo = { "data-role": "cursor" }, so = { "data-role": "selection" }, co = {
4425
4443
  class: "key-help",
4426
4444
  "data-role": "key-help"
4427
- }, oo = { class: "key-hint" }, so = { class: "key-hint" }, co = { class: "key-hint" }, lo = {
4445
+ }, lo = { class: "key-hint" }, uo = { class: "key-hint" }, fo = { class: "key-hint" }, po = {
4428
4446
  key: 0,
4429
4447
  class: "side-column",
4430
4448
  "data-role": "side"
4431
- }, uo = { "data-role": "mathml" }, fo = { class: "output-actions" }, po = { "data-role": "mathjson" }, mo = { "data-role": "latex" }, ho = { "data-role": "ast" }, go = "A CellML line must be an equation (… = …)", _o = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
4449
+ }, mo = { "data-role": "mathml" }, ho = { class: "output-actions" }, go = { "data-role": "mathjson" }, _o = { "data-role": "latex" }, vo = { "data-role": "ast" }, yo = "A CellML line must be an equation (… = …)", bo = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
4432
4450
  __name: "EquationWorkbench",
4433
4451
  props: {
4434
4452
  cellml: {
@@ -4473,228 +4491,249 @@ var Ea = [
4473
4491
  cellml: g.cellml,
4474
4492
  greekNames: g.greekNames,
4475
4493
  typesetNames: g.typesetNames
4476
- })), C = re([xr()]), oe = (e, t) => C.value.map((n, r) => r === e ? t : n), se = 0, T = () => `line-${++se}`, O = v([T()]), k = v(/* @__PURE__ */ new Map()), ye = v(/* @__PURE__ */ new Map()), A = v(0), be = v([]), j = v(null);
4477
- function M() {
4478
- return C.value[A.value];
4494
+ })), C = re([xr()]), oe = (e, t) => C.value.map((n, r) => r === e ? t : n), se = 0, T = () => `line-${++se}`, O = v([T()]), k = v(/* @__PURE__ */ new Map()), A = v(/* @__PURE__ */ new Map()), j = v(0), ye = v([]), M = v(null);
4495
+ function N() {
4496
+ return C.value[j.value];
4479
4497
  }
4480
- function xe(e, t) {
4481
- C.value = oe(e, N(t));
4498
+ function be(e, t) {
4499
+ C.value = oe(e, P(t));
4482
4500
  }
4483
- let N = (e, t = !1) => _t(Kn(e), {
4501
+ let P = (e, t = !1) => gt(Kn(e), {
4484
4502
  greekNames: g.greekNames,
4485
4503
  cursorAway: t
4486
4504
  });
4487
- ce(A, (e, t) => {
4505
+ ce(j, (e, t) => {
4488
4506
  let n = C.value[t];
4489
- n && (C.value = oe(t, N(n, !0)));
4507
+ n && (C.value = oe(t, P(n, !0)));
4490
4508
  }), ce(() => g.greekNames, () => {
4491
- C.value = C.value.map((e, t) => N(e, t !== A.value));
4509
+ C.value = C.value.map((e, t) => P(e, t !== j.value));
4492
4510
  });
4493
- function P() {
4494
- p(() => be.value[A.value]?.focus());
4511
+ function F() {
4512
+ p(() => ye.value[j.value]?.focus());
4495
4513
  }
4496
- let F = new Ci(), Se = v(0);
4497
- function Ce() {
4514
+ let I = new Ci(), xe = v(0);
4515
+ function Se() {
4498
4516
  return JSON.parse(JSON.stringify({
4499
4517
  equations: C.value,
4500
4518
  lineIds: O.value,
4501
- active: A.value
4519
+ active: j.value
4502
4520
  }));
4503
4521
  }
4504
- function we(e = A.value, t = bi) {
4505
- g.history && (F.checkpoint(Ce, Si(e, t)), Se.value++);
4522
+ function Ce(e = j.value, t = bi) {
4523
+ g.history && (I.checkpoint(Se, Si(e, t)), xe.value++);
4506
4524
  }
4507
- function I(e) {
4508
- e && (C.value = e.equations, O.value = e.lineIds, A.value = Math.min(e.active, e.equations.length - 1), Se.value++, P());
4525
+ function L(e) {
4526
+ e && (C.value = e.equations, O.value = e.lineIds, j.value = Math.min(e.active, e.equations.length - 1), xe.value++, F());
4509
4527
  }
4510
- let Te = () => I(F.undo(Ce())), Ee = () => I(F.redo(Ce())), De = n(() => Se.value >= 0 && F.canUndo), L = n(() => Se.value >= 0 && F.canRedo), Oe = /mac/i.test(navigator.userAgentData?.platform ?? navigator.platform), ke = Oe ? "⌘" : "Ctrl", Ae = Oe ? "⌥" : "Alt";
4511
- function je(e, t, n) {
4528
+ let we = () => L(I.undo(Se())), Te = () => L(I.redo(Se())), Ee = n(() => xe.value >= 0 && I.canUndo), R = n(() => xe.value >= 0 && I.canRedo), De = /mac/i.test(navigator.userAgentData?.platform ?? navigator.platform), Oe = De ? "⌘" : "Ctrl", ke = De ? "⌥" : "Alt";
4529
+ function Ae(e, t, n) {
4512
4530
  if (ie(t.root) === ie(C.value[e].root)) {
4513
- Ne(e, {
4531
+ Me(e, {
4514
4532
  cursor: t.cursor,
4515
4533
  anchor: t.anchor ?? null
4516
4534
  });
4517
4535
  return;
4518
4536
  }
4519
- we(e, n), xe(e, t), Me(e);
4537
+ Ce(e, n), be(e, t), je(e);
4520
4538
  }
4521
- function Me(e) {
4522
- ye.value.delete(O.value[e]), Fe.value = null;
4539
+ function je(e) {
4540
+ A.value.delete(O.value[e]), Pe.value = null, ct();
4523
4541
  }
4524
- function Ne(e, { cursor: t, anchor: n }) {
4525
- F.breakGroup(), xe(e, {
4542
+ function Me(e, { cursor: t, anchor: n }) {
4543
+ I.breakGroup(), be(e, {
4526
4544
  ...C.value[e],
4527
4545
  cursor: t,
4528
4546
  anchor: n
4529
4547
  });
4530
4548
  }
4531
- function Pe(e, t = []) {
4532
- let n = e.map((e) => N({
4549
+ function Ne(e, t = []) {
4550
+ let n = e.map((e) => P({
4533
4551
  root: e,
4534
4552
  cursor: Zn(e),
4535
4553
  anchor: null
4536
4554
  }, !0));
4537
- C.value = n.length ? n : [xr()], O.value = C.value.map(() => T()), A.value = 0, ye.value = new Map(O.value.flatMap((e, n) => t[n]?.length ? [[e, t[n]]] : [])), k.value = new Map(Wt.value.map((e) => [e.id, e.mathml]));
4555
+ C.value = n.length ? n : [xr()], O.value = C.value.map(() => T()), j.value = 0, ct(), A.value = new Map(O.value.flatMap((e, n) => t[n]?.length ? [[e, t[n]]] : [])), k.value = new Map($t.value.map((e) => [e.id, e.mathml]));
4538
4556
  }
4539
- let Fe = v(null);
4540
- function Ie(e, t) {
4557
+ let Pe = v(null);
4558
+ function Fe(e, t) {
4541
4559
  if (g.readonly) return;
4542
4560
  let n = t.equations.length;
4543
- if (n === 1) je(e, Br(t.equations[0])(C.value[e]), bi), t.problems.length && ye.value.set(O.value[e], t.problems);
4561
+ if (n === 1) Ae(e, Br(t.equations[0])(C.value[e]), bi), t.problems.length && A.value.set(O.value[e], t.problems);
4544
4562
  else if (n > 1) {
4545
- we(e), Pe(t.equations, t.lineProblems);
4546
- for (let e of Wt.value) x("line-commit", e, { reason: "paste" });
4547
- P();
4563
+ Ce(e), Ne(t.equations, t.lineProblems);
4564
+ for (let e of $t.value) x("line-commit", e, { reason: "paste" });
4565
+ F();
4548
4566
  }
4549
- Fe.value = n > 1 ? `Imported ${n} equations from Content MathML, replacing the lines there were.` : n === 0 ? t.problems[0] ?? "Nothing was imported." : null;
4567
+ Pe.value = n > 1 ? `Imported ${n} equations from Content MathML, replacing the lines there were.` : n === 0 ? t.problems[0] ?? "Nothing was imported." : null;
4550
4568
  }
4551
- function R(e) {
4569
+ function z(e) {
4552
4570
  let t = Ai(e);
4553
- return t ? (Kt = "load", Pe(t.equations, t.lineProblems), j.value = null, Fe.value = null, F.clear(), Se.value++, t) : {
4571
+ return t ? (tn = "load", Ne(t.equations, t.lineProblems), M.value = null, Pe.value = null, I.clear(), xe.value++, t) : {
4554
4572
  equations: [],
4555
4573
  problems: ["The MathML isn't well-formed XML, so nothing was loaded"],
4556
4574
  lineProblems: []
4557
4575
  };
4558
4576
  }
4559
4577
  d({
4560
- setMathML: R,
4561
- focus: P
4578
+ setMathML: z,
4579
+ focus: F
4562
4580
  });
4563
- let Le = v(null), Re = v(null), ze = v(!1), Be = 0;
4564
- function Ve() {
4565
- if (Be = 0, !Le.value || !Re.value) return;
4566
- let e = Re.value.getBoundingClientRect().top - Le.value.getBoundingClientRect().top;
4567
- ze.value = e > .5, j.value !== null && dt();
4581
+ let Ie = v(null), Le = v(null), Re = v(!1), ze = 0;
4582
+ function Be() {
4583
+ if (ze = 0, !Ie.value || !Le.value) return;
4584
+ let e = Le.value.getBoundingClientRect().top - Ie.value.getBoundingClientRect().top;
4585
+ Re.value = e > .5, M.value !== null && bt();
4568
4586
  }
4569
- function He() {
4570
- Be ||= requestAnimationFrame(Ve);
4587
+ function Ve() {
4588
+ ze ||= requestAnimationFrame(Be);
4571
4589
  }
4572
4590
  te(() => {
4573
- if (g.autofocus && P(), document.addEventListener("scroll", He, {
4591
+ if (g.autofocus && F(), document.addEventListener("scroll", Ve, {
4574
4592
  capture: !0,
4575
4593
  passive: !0
4576
- }), window.addEventListener("resize", He, { passive: !0 }), Ve(), typeof ResizeObserver < "u" && V.value) {
4577
- Ct = new ResizeObserver(wt), Ct.observe(V.value);
4578
- for (let e of V.value.children) Ct.observe(e);
4594
+ }), window.addEventListener("resize", Ve, { passive: !0 }), Be(), typeof ResizeObserver < "u" && kt.value) {
4595
+ Mt = new ResizeObserver(Nt), Mt.observe(kt.value);
4596
+ for (let e of kt.value.children) Mt.observe(e);
4579
4597
  }
4580
- wt();
4598
+ Nt();
4581
4599
  }), ee(() => {
4582
- document.removeEventListener("scroll", He, { capture: !0 }), window.removeEventListener("resize", He), Be && cancelAnimationFrame(Be), Ct?.disconnect();
4600
+ document.removeEventListener("scroll", Ve, { capture: !0 }), window.removeEventListener("resize", Ve), ze && cancelAnimationFrame(ze), Mt?.disconnect();
4583
4601
  });
4584
- function Ue(e) {
4602
+ function He(e) {
4585
4603
  if (g.readonly) return;
4586
- let t = M(), n = e(t);
4587
- n !== t && (we(), xe(A.value, n), Me(A.value)), P();
4604
+ let t = N(), n = e(t);
4605
+ n !== t && (Ce(), be(j.value, n), je(j.value)), F();
4588
4606
  }
4589
- function We(e) {
4607
+ function Ue(e) {
4590
4608
  if (g.readonly) return;
4591
- z(A.value, e), we();
4592
- let t = A.value + 1;
4609
+ B(j.value, e), Ce();
4610
+ let t = j.value + 1;
4593
4611
  C.value = [
4594
4612
  ...C.value.slice(0, t),
4595
4613
  xr(),
4596
4614
  ...C.value.slice(t)
4597
- ], O.value.splice(t, 0, T()), A.value = t, P();
4615
+ ], O.value.splice(t, 0, T()), j.value = t, F();
4598
4616
  }
4599
- function Ge(e) {
4600
- e < 0 || e >= C.value.length || (e !== A.value && z(A.value, "navigate"), F.breakGroup(), A.value = e, P());
4617
+ function We(e) {
4618
+ e < 0 || e >= C.value.length || (e !== j.value && B(j.value, "navigate"), ct(), I.breakGroup(), j.value = e, F());
4601
4619
  }
4602
- function Ke(e) {
4603
- e !== A.value && (j.value = null, z(A.value, "navigate"), A.value = e);
4620
+ function Ge(e) {
4621
+ e !== j.value && (M.value = null, ct(), B(j.value, "navigate"), j.value = e);
4604
4622
  }
4605
- let qe = v(null);
4606
- function Je(e) {
4623
+ let Ke = v(null);
4624
+ function qe(e) {
4607
4625
  let t = e.relatedTarget;
4608
- t && (qe.value?.contains(t) || t.closest("[data-me-popover]")) || (j.value = null, z(A.value, "blur"));
4626
+ t && (Ke.value?.contains(t) || t.closest("[data-me-popover]")) || (M.value = null, B(j.value, "blur"));
4609
4627
  }
4610
- function z(e, t) {
4611
- let n = Wt.value[e];
4628
+ function B(e, t) {
4629
+ let n = $t.value[e];
4612
4630
  n && (k.value.get(n.id) ?? "") !== n.mathml && (k.value.set(n.id, n.mathml), x("line-commit", n, { reason: t }));
4613
4631
  }
4614
- function Ye() {
4632
+ function Je() {
4615
4633
  if (g.readonly || C.value.length <= 1) return;
4616
- we();
4617
- let e = A.value;
4618
- C.value = C.value.filter((t, n) => n !== e), O.value.splice(A.value, 1), A.value = Math.max(0, A.value - 1);
4619
- let t = M();
4620
- xe(A.value, {
4634
+ Ce();
4635
+ let e = j.value;
4636
+ C.value = C.value.filter((t, n) => n !== e), O.value.splice(j.value, 1), j.value = Math.max(0, j.value - 1);
4637
+ let t = N();
4638
+ be(j.value, {
4621
4639
  ...t,
4622
4640
  cursor: Zn(t.root),
4623
4641
  anchor: null
4624
- }), P();
4642
+ }), F();
4625
4643
  }
4626
- let Xe = n(() => !g.readonly && C.value.length > 1);
4627
- function Ze(e, t) {
4644
+ let Ye = n(() => !g.readonly && C.value.length > 1);
4645
+ function Xe(e, t) {
4628
4646
  let n = C.value.length;
4629
- if (!Xe.value || e === t || Math.min(e, t) < 0 || Math.max(e, t) >= n) return;
4630
- if (e !== A.value) {
4631
- z(A.value, "navigate");
4632
- let e = A.value;
4633
- C.value = oe(e, N(C.value[e], !0));
4647
+ if (!Ye.value || e === t || Math.min(e, t) < 0 || Math.max(e, t) >= n) return;
4648
+ if (e !== j.value) {
4649
+ B(j.value, "navigate");
4650
+ let e = j.value;
4651
+ C.value = oe(e, P(C.value[e], !0));
4634
4652
  }
4635
- we();
4653
+ Ce();
4636
4654
  let r = C.value.map((e, t) => t);
4637
- r.splice(t, 0, ...r.splice(e, 1)), C.value = r.map((e) => C.value[e]), O.value = r.map((e) => O.value[e]), A.value = t, P();
4655
+ r.splice(t, 0, ...r.splice(e, 1)), C.value = r.map((e) => C.value[e]), O.value = r.map((e) => O.value[e]), j.value = t, F();
4638
4656
  }
4639
- let B = v(null), Qe = v(null);
4640
- function $e() {
4641
- if (B.value === null || !Qe.value) return null;
4642
- let { index: e, after: t } = Qe.value, n = e + +!!t, r = n > B.value ? n - 1 : n;
4643
- return r === B.value ? null : r;
4657
+ let V = v(null), Ze = v(null);
4658
+ function Qe() {
4659
+ if (V.value === null || !Ze.value) return null;
4660
+ let { index: e, after: t } = Ze.value, n = e + +!!t, r = n > V.value ? n - 1 : n;
4661
+ return r === V.value ? null : r;
4644
4662
  }
4645
- function et(e, t) {
4646
- if (!Xe.value || !t.dataTransfer) return;
4647
- B.value = e, t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", `Line ${e + 1}`);
4663
+ function $e(e, t) {
4664
+ if (!Ye.value || !t.dataTransfer) return;
4665
+ V.value = e, t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", `Line ${e + 1}`);
4648
4666
  let n = t.currentTarget.closest(".equation-row");
4649
4667
  if (n) {
4650
4668
  let e = n.getBoundingClientRect();
4651
4669
  t.dataTransfer.setDragImage(n, t.clientX - e.left, t.clientY - e.top);
4652
4670
  }
4653
4671
  }
4654
- function tt(e, t) {
4655
- if (B.value === null) return;
4672
+ function et(e, t) {
4673
+ if (V.value === null) return;
4656
4674
  t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = "move");
4657
4675
  let n = t.currentTarget.getBoundingClientRect();
4658
- Qe.value = {
4676
+ Ze.value = {
4659
4677
  index: e,
4660
4678
  after: t.clientY > n.top + n.height / 2
4661
4679
  };
4662
4680
  }
4663
- function nt(e) {
4664
- if (B.value === null) return;
4681
+ function tt(e) {
4682
+ if (V.value === null) return;
4665
4683
  e.preventDefault();
4666
- let t = B.value, n = $e();
4667
- rt(), n !== null && Ze(t, n);
4668
- }
4669
- function rt() {
4670
- B.value = null, Qe.value = null;
4684
+ let t = V.value, n = Qe();
4685
+ nt(), n !== null && Xe(t, n);
4686
+ }
4687
+ function nt() {
4688
+ V.value = null, Ze.value = null;
4689
+ }
4690
+ function rt(e) {
4691
+ return Qe() === null || Ze.value?.index !== e ? null : Ze.value.after ? "drop-after" : "drop-before";
4692
+ }
4693
+ let it = v(/* @__PURE__ */ new Set()), at = n(() => O.value.flatMap((e, t) => it.value.has(e) ? [t] : [])), ot = n(() => at.value.length > 0), st = (e) => it.value.has(O.value[e]);
4694
+ function ct() {
4695
+ it.value.size && (it.value = /* @__PURE__ */ new Set());
4696
+ }
4697
+ let lt = (e) => e.shiftKey || e.metaKey || e.ctrlKey;
4698
+ function ut(e, t) {
4699
+ if (!g.outputs || !lt(t)) return;
4700
+ t.preventDefault();
4701
+ let n = O.value;
4702
+ if (t.shiftKey) {
4703
+ let [t, r] = [j.value, e].sort((e, t) => e - t);
4704
+ it.value = new Set(n.slice(t, r + 1));
4705
+ return;
4706
+ }
4707
+ let r = new Set(it.value.size ? it.value : [n[j.value]]);
4708
+ r.has(n[e]) ? r.delete(n[e]) : r.add(n[e]), it.value = r;
4671
4709
  }
4672
- function it(e) {
4673
- return $e() === null || Qe.value?.index !== e ? null : Qe.value.after ? "drop-after" : "drop-before";
4710
+ function dt(e) {
4711
+ e.target?.closest?.("[data-role=\"line-handle\"]") && lt(e) || ct();
4674
4712
  }
4675
- function at() {
4676
- let e = (j.value ?? "").trim();
4677
- j.value = null, e && Ue(hi(e));
4713
+ let ft = n(() => [Ye.value && `Drag to reorder (${ke}+↑/↓)`, g.outputs && `Shift+click or ${Oe}+click to select lines to copy`].filter(Boolean).join(" · ") || void 0);
4714
+ function pt() {
4715
+ let e = (M.value ?? "").trim();
4716
+ M.value = null, e && He(hi(e));
4678
4717
  }
4679
- let ot = n(() => j.value === null ? [] : yi(j.value)), st = v(-1);
4680
- ce(j, (e) => {
4681
- st.value = e && ot.value.length ? 0 : -1, e !== null && p(dt);
4718
+ let mt = n(() => M.value === null ? [] : yi(M.value)), ht = v(-1);
4719
+ ce(M, (e) => {
4720
+ ht.value = e && mt.value.length ? 0 : -1, e !== null && p(bt);
4682
4721
  });
4683
- function ct(e) {
4684
- let t = ot.value[e];
4685
- if (!t) return at();
4686
- j.value = null, Ue(hi(t.name));
4687
- }
4688
- function lt(e) {
4689
- let t = ot.value.length;
4690
- t && (st.value = (st.value + e + t) % t);
4691
- }
4692
- let ut = v({});
4693
- function dt() {
4694
- let e = be.value[A.value]?.caretRect();
4722
+ function _t(e) {
4723
+ let t = mt.value[e];
4724
+ if (!t) return pt();
4725
+ M.value = null, He(hi(t.name));
4726
+ }
4727
+ function vt(e) {
4728
+ let t = mt.value.length;
4729
+ t && (ht.value = (ht.value + e + t) % t);
4730
+ }
4731
+ let yt = v({});
4732
+ function bt() {
4733
+ let e = ye.value[j.value]?.caretRect();
4695
4734
  if (!e) return;
4696
4735
  let t = Math.max(8, Math.min(e.left - 8, window.innerWidth - 336));
4697
- ut.value = e.bottom < window.innerHeight * .6 ? {
4736
+ yt.value = e.bottom < window.innerHeight * .6 ? {
4698
4737
  left: `${t}px`,
4699
4738
  top: `${e.bottom + 6}px`
4700
4739
  } : {
@@ -4702,85 +4741,89 @@ var Ea = [
4702
4741
  bottom: `${window.innerHeight - e.top + 6}px`
4703
4742
  };
4704
4743
  }
4705
- function ft(e) {
4706
- if (/^[a-zA-Z0-9]$/.test(e.key)) j.value += e.key;
4707
- else if (e.key === "Backspace") j.value = j.value ? j.value.slice(0, -1) : null;
4708
- else if (e.key === "ArrowDown" || e.key === "ArrowUp") lt(e.key === "ArrowDown" ? 1 : -1);
4709
- else if (e.key === "Enter" || e.key === "Tab") ct(st.value);
4710
- else if (e.key === " " || e.key === "(") at();
4711
- else if (e.key === "Escape") j.value = null;
4744
+ function xt(e) {
4745
+ if (/^[a-zA-Z0-9]$/.test(e.key)) M.value += e.key;
4746
+ else if (e.key === "Backspace") M.value = M.value ? M.value.slice(0, -1) : null;
4747
+ else if (e.key === "ArrowDown" || e.key === "ArrowUp") vt(e.key === "ArrowDown" ? 1 : -1);
4748
+ else if (e.key === "Enter" || e.key === "Tab") _t(ht.value);
4749
+ else if (e.key === " " || e.key === "(") pt();
4750
+ else if (e.key === "Escape") M.value = null;
4712
4751
  else return;
4713
4752
  e.preventDefault(), e.stopPropagation();
4714
4753
  }
4715
- function pt(e) {
4754
+ function St(e) {
4716
4755
  if (!e.target?.closest?.("[data-role=\"side\"]")) {
4717
- if (j.value !== null) {
4718
- ft(e);
4756
+ if (M.value !== null) {
4757
+ xt(e);
4758
+ return;
4759
+ }
4760
+ if (e.key === "Escape" && ot.value) {
4761
+ e.preventDefault(), e.stopPropagation(), ct();
4719
4762
  return;
4720
4763
  }
4721
4764
  if ((e.ctrlKey || e.metaKey) && !e.altKey) {
4722
4765
  let t = e.key.toLowerCase();
4723
4766
  if ((t === "z" || t === "y") && g.history) {
4724
4767
  if (e.preventDefault(), e.stopPropagation(), g.readonly) return;
4725
- t === "y" || e.shiftKey ? Ee() : Te();
4768
+ t === "y" || e.shiftKey ? Te() : we();
4726
4769
  }
4727
4770
  return;
4728
4771
  }
4729
- e.key === "\\" && !e.altKey && !g.readonly && (e.preventDefault(), e.stopPropagation(), j.value = "");
4772
+ e.key === "\\" && !e.altKey && !g.readonly && (e.preventDefault(), e.stopPropagation(), M.value = "");
4730
4773
  }
4731
4774
  }
4732
- function mt(e) {
4775
+ function Ct(e) {
4733
4776
  if (!e.defaultPrevented) {
4734
4777
  if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
4735
- e.preventDefault(), Ze(A.value, A.value + (e.key === "ArrowUp" ? -1 : 1));
4778
+ e.preventDefault(), Xe(j.value, j.value + (e.key === "ArrowUp" ? -1 : 1));
4736
4779
  return;
4737
4780
  }
4738
4781
  switch (e.key) {
4739
4782
  case "Enter":
4740
- e.preventDefault(), We("enter");
4783
+ e.preventDefault(), Ue("enter");
4741
4784
  return;
4742
4785
  case "ArrowUp":
4743
- e.preventDefault(), Ge(A.value - 1);
4786
+ e.preventDefault(), We(j.value - 1);
4744
4787
  return;
4745
4788
  case "ArrowDown":
4746
- e.preventDefault(), Ge(A.value + 1);
4789
+ e.preventDefault(), We(j.value + 1);
4747
4790
  return;
4748
4791
  case "Backspace":
4749
- M().root.length === 0 && (e.preventDefault(), Ye());
4792
+ N().root.length === 0 && (e.preventDefault(), Je());
4750
4793
  return;
4751
4794
  }
4752
4795
  }
4753
4796
  }
4754
- let ht = v(null), gt = v(null);
4755
- function vt(e, t) {
4797
+ let wt = v(null), Tt = v(null);
4798
+ function Et(e, t) {
4756
4799
  if (e.command) {
4757
- Ue(e.command);
4800
+ He(e.command);
4758
4801
  return;
4759
4802
  }
4760
- gt.value?.id !== e.id && ht.value?.hide(), gt.value = e, p(() => ht.value?.toggle(t));
4803
+ Tt.value?.id !== e.id && wt.value?.hide(), Tt.value = e, p(() => wt.value?.toggle(t));
4761
4804
  }
4762
- function yt(e) {
4763
- ht.value?.hide(), Ue(e);
4805
+ function Dt(e) {
4806
+ wt.value?.hide(), He(e);
4764
4807
  }
4765
- function bt(e) {
4808
+ function Ot(e) {
4766
4809
  return le.renderToString(e, {
4767
4810
  throwOnError: !1,
4768
4811
  strict: "ignore"
4769
4812
  });
4770
4813
  }
4771
- let V = v(null), xt = v(null), St = v(Oa.length), Ct = null;
4772
- function wt() {
4773
- let e = V.value, t = xt.value;
4814
+ let kt = v(null), At = v(null), jt = v(ja.length), Mt = null;
4815
+ function Nt() {
4816
+ let e = kt.value, t = At.value;
4774
4817
  if (!e || !t) return;
4775
4818
  let n = (e) => e.getBoundingClientRect().width, r = n(e) + .5, i = parseFloat(getComputedStyle(e).columnGap) || 0, a = [...e.querySelectorAll("[data-tool]")].map(n), o = (e, o) => {
4776
4819
  let s = [...a.slice(0, e), ...o ? [n(t)] : []];
4777
4820
  return s.reduce((e, t) => e + t, 0) + i * Math.max(0, s.length - 1) <= r;
4778
4821
  }, s = a.length;
4779
4822
  if (!o(s, !1)) for (s--; s > 0 && !o(s, !0);) s--;
4780
- St.value = s;
4823
+ jt.value = s;
4781
4824
  }
4782
- let Tt = n(() => {
4783
- let e = Oa.slice(St.value);
4825
+ let Pt = n(() => {
4826
+ let e = ja.slice(jt.value);
4784
4827
  if (!e.length) return null;
4785
4828
  let t = [];
4786
4829
  for (let n of e) if (n.command) {
@@ -4800,50 +4843,50 @@ var Ea = [
4800
4843
  latex: "",
4801
4844
  sections: t
4802
4845
  };
4803
- }), Et = /* @__PURE__ */ new WeakMap();
4804
- function Dt(e) {
4846
+ }), Ft = /* @__PURE__ */ new WeakMap();
4847
+ function It(e) {
4805
4848
  if (e.length === 0) return null;
4806
- let t = Et.get(e);
4807
- return t || (t = ea(e), Et.set(e, t)), t;
4849
+ let t = Ft.get(e);
4850
+ return t || (t = ea(e), Ft.set(e, t)), t;
4808
4851
  }
4809
- let Ot = n(() => C.value.map((e) => Dt(e.root))), kt = n(() => Ot.value[A.value] ?? null);
4810
- function At(e, t) {
4811
- let n = Ot.value[t]?.ast;
4852
+ let H = n(() => C.value.map((e) => It(e.root))), Lt = n(() => H.value[j.value] ?? null);
4853
+ function Rt(e, t) {
4854
+ let n = H.value[t]?.ast;
4812
4855
  return !g.cellml || !n || n.type === "Equal" ? null : {
4813
- message: go,
4856
+ message: yo,
4814
4857
  atomIds: e.map((e) => e.id),
4815
4858
  incomplete: !0
4816
4859
  };
4817
4860
  }
4818
- let jt = $i(() => g.issues), Mt = $i(() => g.variableUnits ?? null), Nt = n(() => {
4861
+ let zt = $i(() => g.issues), Bt = $i(() => g.variableUnits ?? null), Vt = n(() => {
4819
4862
  let e = /* @__PURE__ */ new Map();
4820
- for (let t of jt.value) e.set(t.lineId, [...e.get(t.lineId) ?? [], t]);
4863
+ for (let t of zt.value) e.set(t.lineId, [...e.get(t.lineId) ?? [], t]);
4821
4864
  return e;
4822
- }), Pt = n(() => (Nt.value, Mt.value, g.cellml, /* @__PURE__ */ new WeakMap())), Ft = n(() => C.value.map((e, t) => {
4823
- let n = e.root, r = Pt.value.get(n);
4865
+ }), Ht = n(() => (Vt.value, Bt.value, g.cellml, /* @__PURE__ */ new WeakMap())), Ut = n(() => C.value.map((e, t) => {
4866
+ let n = e.root, r = Ht.value.get(n);
4824
4867
  if (!r) {
4825
- let e = At(n, t), i = [
4826
- ...Ot.value[t]?.diagnostics ?? [],
4868
+ let e = Rt(n, t), i = [
4869
+ ...H.value[t]?.diagnostics ?? [],
4827
4870
  ...e ? [e] : [],
4828
- ...Ca(n, Nt.value.get(O.value[t]) ?? [])
4829
- ], a = wa(n, Mt.value);
4871
+ ...Ea(n, Vt.value.get(O.value[t]) ?? [])
4872
+ ], a = Da(n, Bt.value);
4830
4873
  r = {
4831
4874
  all: [...i, ...a],
4832
4875
  complete: [...i.filter((e) => !e.incomplete), ...a],
4833
4876
  hints: a
4834
- }, Pt.value.set(n, r);
4877
+ }, Ht.value.set(n, r);
4835
4878
  }
4836
4879
  return r;
4837
4880
  }));
4838
- function It(e) {
4881
+ function Wt(e) {
4839
4882
  if (g.validate === "commit") {
4840
- let t = Wt.value[e];
4883
+ let t = $t.value[e];
4841
4884
  return (k.value.get(t.id) ?? "") === t.mathml ? "all" : "hints";
4842
4885
  }
4843
- return e === A.value ? "complete" : "all";
4886
+ return e === j.value ? "complete" : "all";
4844
4887
  }
4845
- let H = n(() => Ft.value.map((e, t) => e[It(t)])), Lt = n(() => H.value.map((e, t) => {
4846
- let n = [...(It(t) === "hints" ? [] : ye.value.get(O.value[t]) ?? []).map((e) => ({
4888
+ let Gt = n(() => Ut.value.map((e, t) => e[Wt(t)])), Kt = n(() => Gt.value.map((e, t) => {
4889
+ let n = [...(Wt(t) === "hints" ? [] : A.value.get(O.value[t]) ?? []).map((e) => ({
4847
4890
  line: t,
4848
4891
  message: e,
4849
4892
  kind: "error"
@@ -4853,44 +4896,44 @@ var Ea = [
4853
4896
  kind: Gi(e) === "units" ? "units" : "error"
4854
4897
  }))];
4855
4898
  return n.filter((e, t) => n.findIndex((t) => t.message === e.message) === t);
4856
- })), Rt = (e) => {
4857
- let t = Lt.value[e];
4899
+ })), qt = (e) => {
4900
+ let t = Kt.value[e];
4858
4901
  return t.length ? t.some((e) => e.kind === "error") ? "has-error" : "has-units-issue" : null;
4859
- }, zt = n(() => {
4860
- let e = Lt.value.flat(), t = Lt.value[A.value][0] ?? e[0];
4902
+ }, Jt = n(() => {
4903
+ let e = Kt.value.flat(), t = Kt.value[j.value][0] ?? e[0];
4861
4904
  return t ? {
4862
4905
  kind: t.kind,
4863
4906
  text: `Line ${t.line + 1}: ${t.message}`,
4864
4907
  more: e.length - 1,
4865
4908
  line: t.line
4866
- } : Fe.value ? {
4909
+ } : Pe.value ? {
4867
4910
  kind: "info",
4868
- text: Fe.value
4911
+ text: Pe.value
4869
4912
  } : null;
4870
- }), Bt = n(() => Lt.value.flat().map((e) => `Line ${e.line + 1}: ${e.message}`).join("\n")), Vt = (e) => Lt.value[e].map((e) => e.message).join("\n");
4871
- function Ht() {
4872
- let e = zt.value?.line;
4873
- e !== void 0 && Ge(e);
4913
+ }), Yt = n(() => Kt.value.flat().map((e) => `Line ${e.line + 1}: ${e.message}`).join("\n")), Xt = (e) => Kt.value[e].map((e) => e.message).join("\n");
4914
+ function Zt() {
4915
+ let e = Jt.value?.line;
4916
+ e !== void 0 && We(e);
4874
4917
  }
4875
- let Ut = n(() => (ye.value.size, g.cellml, /* @__PURE__ */ new WeakMap())), Wt = n(() => C.value.map((e, t) => {
4876
- let n = O.value[t], r = Ut.value.get(e.root);
4918
+ let Qt = n(() => (A.value.size, g.cellml, /* @__PURE__ */ new WeakMap())), $t = n(() => C.value.map((e, t) => {
4919
+ let n = O.value[t], r = Qt.value.get(e.root);
4877
4920
  if (!r || r.id !== n) {
4878
- let i = (ye.value.get(n)?.length ?? 0) + +!!At(e.root, t);
4879
- r = ba(n, e.root, Ot.value[t], i), Ut.value.set(e.root, r);
4921
+ let i = (A.value.get(n)?.length ?? 0) + +!!Rt(e.root, t);
4922
+ r = Ca(n, e.root, H.value[t], i), Qt.value.set(e.root, r);
4880
4923
  }
4881
4924
  return r;
4882
- })), Gt = "", Kt = "load";
4883
- ce(Wt, (e) => {
4884
- let t = Kt;
4885
- Kt = "edit";
4925
+ })), en = "", tn = "load";
4926
+ ce($t, (e) => {
4927
+ let t = tn;
4928
+ tn = "edit";
4886
4929
  let n = JSON.stringify(e);
4887
- n !== Gt && (Gt = n, x("equations-change", e, { source: t }));
4930
+ n !== en && (en = n, x("equations-change", e, { source: t }));
4888
4931
  }, { immediate: !0 });
4889
- let qt = n(() => kt.value?.ast ?? null), Jt = n(() => qt.value ? _a(M().root, "latex", ae.value) : ""), Yt = n(() => qt.value ? da(qt.value) : ""), Xt = n(() => qt.value ? va(M().root, ae.value) : ""), Zt = n(() => $n(M().cursor)), Qt = n(() => {
4890
- let e = G(M());
4932
+ let nn = n(() => Lt.value?.ast ?? null), rn = n(() => nn.value ? _a(N().root, "latex", ae.value) : ""), an = n(() => nn.value ? da(nn.value) : ""), on = n(() => nn.value ? ba(N().root, ae.value) : ""), sn = n(() => $n(N().cursor)), cn = n(() => {
4933
+ let e = G(N());
4891
4934
  return e ? fr(e) : null;
4892
- }), $t = v(!1), en = v("mathml");
4893
- function tn(e) {
4935
+ }), ln = v(!1), un = v("mathml");
4936
+ function dn(e) {
4894
4937
  let t = document.createElement("textarea");
4895
4938
  t.value = e, t.setAttribute("readonly", "true"), t.style.position = "fixed", t.style.opacity = "0", document.body.appendChild(t), t.select();
4896
4939
  try {
@@ -4901,72 +4944,76 @@ var Ea = [
4901
4944
  document.body.removeChild(t);
4902
4945
  }
4903
4946
  }
4904
- async function nn(e) {
4947
+ async function fn(e) {
4905
4948
  try {
4906
4949
  if (navigator.clipboard?.writeText) {
4907
4950
  await navigator.clipboard.writeText(e);
4908
4951
  return;
4909
4952
  }
4910
4953
  } catch {}
4911
- tn(e);
4954
+ dn(e);
4912
4955
  }
4913
- async function rn() {
4914
- if (Yt.value) {
4915
- $t.value = !0;
4956
+ async function pn() {
4957
+ if (an.value) {
4958
+ ln.value = !0;
4916
4959
  try {
4917
- await nn(Yt.value);
4960
+ await fn(an.value);
4918
4961
  } finally {
4919
4962
  window.setTimeout(() => {
4920
- $t.value = !1;
4963
+ ln.value = !1;
4921
4964
  }, 1200);
4922
4965
  }
4923
4966
  }
4924
4967
  }
4925
- let an = v(null), on = v(null), sn, cn = n(() => G(M()) !== null), ln = n(() => M().root.length > 0), un = n(() => on.value ? `Copied ${on.value}` : cn.value ? "Copy selection as" : "Copy as");
4926
- async function dn(e, t) {
4927
- let n = M(), r = G(n) ? dr(n) : n.root;
4928
- r.length > 0 && (await nn(_a(r, e, ae.value)), on.value = t, window.clearTimeout(sn), sn = window.setTimeout(() => on.value = null, 1500)), P();
4968
+ let U = v(null), mn = v(null), hn, gn = n(() => G(N()) !== null), _n = n(() => ot.value ? at.value.some((e) => C.value[e].root.length > 0) : N().root.length > 0), vn = n(() => {
4969
+ if (mn.value) return `Copied ${mn.value}`;
4970
+ let e = at.value.length;
4971
+ return e > 1 ? `Copy ${e} lines as` : e === 1 ? `Copy line ${at.value[0] + 1} as` : gn.value ? "Copy selection as" : "Copy as";
4972
+ });
4973
+ async function yn(e, t) {
4974
+ let n = ot.value ? at.value.map((e) => C.value[e].root) : [G(N()) ? dr(N()) : N().root];
4975
+ n.some((e) => e.length > 0) && (await fn(va(n, e, ae.value)), mn.value = t, window.clearTimeout(hn), hn = window.setTimeout(() => mn.value = null, 1500)), F();
4929
4976
  }
4930
- let fn = n(() => ma.map(({ format: e, label: t }) => {
4977
+ let W = n(() => ma.map(({ format: e, label: t }) => {
4931
4978
  let n = e === "mathml" && g.cellml ? `${t} (CellML)` : t;
4932
4979
  return {
4933
4980
  label: n,
4934
- command: () => dn(e, n)
4981
+ command: () => yn(e, n)
4935
4982
  };
4936
4983
  }));
4937
- function pn(e) {
4938
- an.value?.toggle(e);
4984
+ function bn(e) {
4985
+ U.value?.toggle(e);
4939
4986
  }
4940
- return (n, d) => (_(), a("div", ka, [o("section", {
4987
+ return (n, d) => (_(), a("div", Ma, [o("section", {
4941
4988
  class: m(["editor-grid", {
4942
4989
  "has-side": !!n.$slots.side,
4943
4990
  "no-outputs": !u.outputs,
4944
4991
  readonly: u.readonly
4945
4992
  }]),
4946
- onKeydownCapture: pt
4993
+ onKeydownCapture: St
4947
4994
  }, [
4948
4995
  o("div", {
4949
4996
  ref_key: "panelEl",
4950
- ref: Le,
4997
+ ref: Ie,
4951
4998
  class: "editor-panel"
4952
4999
  }, [
4953
5000
  o("div", {
4954
5001
  ref_key: "toolbarEl",
4955
- ref: Re,
4956
- class: m(["toolbar", { stuck: ze.value }]),
5002
+ ref: Le,
5003
+ class: m(["toolbar", { stuck: Re.value }]),
4957
5004
  role: "toolbar",
4958
5005
  "aria-label": "Equation tools"
4959
5006
  }, [
4960
5007
  o("div", {
4961
5008
  ref_key: "toolsEl",
4962
- ref: V,
5009
+ ref: kt,
4963
5010
  class: "toolbar-group toolbar-tools"
4964
- }, [(_(!0), a(e, null, y(S(Oa), (e, t) => (_(), a("button", {
5011
+ }, [(_(!0), a(e, null, y(S(ja), (e, t) => (_(), a("button", {
4965
5012
  key: e.id,
4966
5013
  type: "button",
4967
5014
  class: m(["tool-button", {
4968
5015
  "has-gallery": !!e.sections,
4969
- overflowed: t >= St.value
5016
+ overflowed: t >= jt.value
4970
5017
  }]),
4971
5018
  title: e.title,
4972
5019
  "data-role": `toolbar-${e.id}`,
@@ -4974,27 +5021,27 @@ var Ea = [
4974
5021
  "aria-haspopup": e.sections ? "true" : void 0,
4975
5022
  disabled: u.readonly,
4976
5023
  onMousedown: d[0] ||= E(() => {}, ["prevent"]),
4977
- onClick: (t) => vt(e, t)
4978
- }, [o("span", { innerHTML: bt(e.latex) }, null, 8, ja), e.sections ? (_(), a("i", Ma)) : i("", !0)], 42, Aa))), 128)), o("button", {
5024
+ onClick: (t) => Et(e, t)
5025
+ }, [o("span", { innerHTML: Ot(e.latex) }, null, 8, Pa), e.sections ? (_(), a("i", Fa)) : i("", !0)], 42, Na))), 128)), o("button", {
4979
5026
  ref_key: "moreEl",
4980
- ref: xt,
5027
+ ref: At,
4981
5028
  type: "button",
4982
- class: m(["tool-button has-gallery", { overflowed: !Tt.value }]),
5029
+ class: m(["tool-button has-gallery", { overflowed: !Pt.value }]),
4983
5030
  title: "More tools",
4984
5031
  "aria-label": "More tools",
4985
5032
  "aria-haspopup": "true",
4986
5033
  "data-role": "toolbar-more",
4987
5034
  disabled: u.readonly,
4988
5035
  onMousedown: d[1] ||= E(() => {}, ["prevent"]),
4989
- onClick: d[2] ||= (e) => Tt.value && vt(Tt.value, e)
5036
+ onClick: d[2] ||= (e) => Pt.value && Et(Pt.value, e)
4990
5037
  }, [...d[13] ||= [o("i", {
4991
5038
  class: "pi pi-ellipsis-h",
4992
5039
  "aria-hidden": "true"
4993
5040
  }, null, -1), o("i", {
4994
5041
  class: "pi pi-chevron-down tool-chevron",
4995
5042
  "aria-hidden": "true"
4996
- }, null, -1)]], 42, Na)], 512),
4997
- o("div", Pa, [
5043
+ }, null, -1)]], 42, Ia)], 512),
5044
+ o("div", La, [
4998
5045
  l(S(D), {
4999
5046
  icon: "pi pi-plus",
5000
5047
  size: "small",
@@ -5004,7 +5051,7 @@ var Ea = [
5004
5051
  "data-role": "add-line",
5005
5052
  disabled: u.readonly,
5006
5053
  onMousedown: d[3] ||= E(() => {}, ["prevent"]),
5007
- onClick: d[4] ||= (e) => We("new-line")
5054
+ onClick: d[4] ||= (e) => Ue("new-line")
5008
5055
  }, null, 8, ["disabled"]),
5009
5056
  l(S(D), {
5010
5057
  icon: "pi pi-trash",
@@ -5015,19 +5062,19 @@ var Ea = [
5015
5062
  "aria-label": "Remove equation line",
5016
5063
  disabled: u.readonly || C.value.length <= 1,
5017
5064
  onMousedown: d[5] ||= E(() => {}, ["prevent"]),
5018
- onClick: Ye
5065
+ onClick: Je
5019
5066
  }, null, 8, ["disabled"]),
5020
5067
  g.history ? (_(), r(S(D), {
5021
5068
  key: 0,
5022
5069
  icon: "pi pi-undo",
5023
5070
  size: "small",
5024
5071
  text: "",
5025
- title: `Undo (${S(ke)}+Z)`,
5072
+ title: `Undo (${S(Oe)}+Z)`,
5026
5073
  "aria-label": "Undo",
5027
5074
  "data-role": "undo",
5028
- disabled: u.readonly || !De.value,
5075
+ disabled: u.readonly || !Ee.value,
5029
5076
  onMousedown: d[6] ||= E(() => {}, ["prevent"]),
5030
- onClick: Te
5077
+ onClick: we
5031
5078
  }, null, 8, ["title", "disabled"])) : i("", !0),
5032
5079
  g.history ? (_(), r(S(D), {
5033
5080
  key: 1,
@@ -5035,84 +5082,84 @@ var Ea = [
5035
5082
  class: "redo-button",
5036
5083
  size: "small",
5037
5084
  text: "",
5038
- title: `Redo (${S(ke)}+Shift+Z)`,
5085
+ title: `Redo (${S(Oe)}+Shift+Z)`,
5039
5086
  "aria-label": "Redo",
5040
5087
  "data-role": "redo",
5041
- disabled: u.readonly || !L.value,
5088
+ disabled: u.readonly || !R.value,
5042
5089
  onMousedown: d[7] ||= E(() => {}, ["prevent"]),
5043
- onClick: Ee
5090
+ onClick: Te
5044
5091
  }, null, 8, ["title", "disabled"])) : i("", !0)
5045
5092
  ]),
5046
- u.outputs ? (_(), a("div", Fa, [l(S(D), {
5093
+ u.outputs ? (_(), a("div", Ra, [l(S(D), {
5047
5094
  icon: "pi pi-copy",
5048
- label: un.value,
5095
+ label: vn.value,
5049
5096
  size: "small",
5050
5097
  text: "",
5051
- title: "Copy the selection, or the whole equation, as LaTeX, MathJSON or Content MathML",
5098
+ title: "Copy the selection, the whole equation, or the lines selected (Shift+click their numbers), as LaTeX, MathJSON or Content MathML",
5052
5099
  "aria-haspopup": "true",
5053
5100
  "aria-controls": "copy-as-menu",
5054
5101
  "data-role": "copy-as",
5055
- disabled: !ln.value,
5102
+ disabled: !_n.value,
5056
5103
  onMousedown: d[8] ||= E(() => {}, ["prevent"]),
5057
- onClick: pn
5104
+ onClick: bn
5058
5105
  }, null, 8, ["label", "disabled"]), l(S(de), {
5059
5106
  id: "copy-as-menu",
5060
5107
  ref_key: "copyMenu",
5061
- ref: an,
5062
- model: fn.value,
5108
+ ref: U,
5109
+ model: W.value,
5063
5110
  popup: !0
5064
5111
  }, null, 8, ["model"])])) : i("", !0)
5065
5112
  ], 2),
5066
5113
  l(S(fe), {
5067
5114
  ref_key: "gallery",
5068
- ref: ht,
5115
+ ref: wt,
5069
5116
  "data-me-popover": "",
5070
5117
  "data-role": "gallery",
5071
5118
  class: "me-gallery"
5072
5119
  }, {
5073
- default: w(() => [gt.value ? (_(), a("div", Ia, [(_(!0), a(e, null, y(gt.value.sections, (t, n) => (_(), a("div", {
5120
+ default: w(() => [Tt.value ? (_(), a("div", za, [(_(!0), a(e, null, y(Tt.value.sections, (t, n) => (_(), a("div", {
5074
5121
  key: n,
5075
5122
  class: "gallery-section"
5076
- }, [t.label ? (_(), a("div", La, b(t.label), 1)) : i("", !0), o("div", Ra, [(_(!0), a(e, null, y(t.items, (e) => (_(), a("button", {
5123
+ }, [t.label ? (_(), a("div", Ba, b(t.label), 1)) : i("", !0), o("div", Va, [(_(!0), a(e, null, y(t.items, (e) => (_(), a("button", {
5077
5124
  key: e.title,
5078
5125
  type: "button",
5079
5126
  class: "tool-button",
5080
5127
  title: e.title,
5081
5128
  onMousedown: d[9] ||= E(() => {}, ["prevent"]),
5082
- onClick: (t) => yt(e.command)
5083
- }, [o("span", { innerHTML: bt(e.latex) }, null, 8, Ba)], 40, za))), 128))])]))), 128))])) : i("", !0)]),
5129
+ onClick: (t) => Dt(e.command)
5130
+ }, [o("span", { innerHTML: Ot(e.latex) }, null, 8, Ua)], 40, Ha))), 128))])]))), 128))])) : i("", !0)]),
5084
5131
  _: 1
5085
5132
  }, 512),
5086
- (_(), r(t, { to: "body" }, [j.value === null ? i("", !0) : (_(), a("div", {
5133
+ (_(), r(t, { to: "body" }, [M.value === null ? i("", !0) : (_(), a("div", {
5087
5134
  key: 0,
5088
5135
  class: "command-list",
5089
5136
  "data-me-popover": "",
5090
5137
  "data-role": "command-list",
5091
- style: h(ut.value),
5138
+ style: h(yt.value),
5092
5139
  onMousedown: d[10] ||= E(() => {}, ["prevent"])
5093
5140
  }, [
5094
- o("span", Va, [
5141
+ o("span", Wa, [
5095
5142
  d[14] ||= o("span", { class: "command-slash" }, "\\", -1),
5096
- c(b(j.value), 1),
5143
+ c(b(M.value), 1),
5097
5144
  d[15] ||= o("span", { class: "command-caret" }, null, -1)
5098
5145
  ]),
5099
- ot.value.length ? (_(), a("ul", Ha, [(_(!0), a(e, null, y(ot.value, (e, t) => (_(), a("li", {
5146
+ mt.value.length ? (_(), a("ul", Ga, [(_(!0), a(e, null, y(mt.value, (e, t) => (_(), a("li", {
5100
5147
  key: e.name,
5101
- class: m(["command-option", { highlighted: t === st.value }]),
5148
+ class: m(["command-option", { highlighted: t === ht.value }]),
5102
5149
  role: "option",
5103
- "aria-selected": t === st.value,
5150
+ "aria-selected": t === ht.value,
5104
5151
  "data-command": e.name,
5105
- onClick: (e) => ct(t)
5152
+ onClick: (e) => _t(t)
5106
5153
  }, [
5107
5154
  o("span", {
5108
5155
  class: "command-preview",
5109
- innerHTML: bt(e.latex)
5110
- }, null, 8, Wa),
5111
- o("span", Ga, "\\" + b(e.name), 1),
5112
- o("span", Ka, b(e.title), 1)
5113
- ], 10, Ua))), 128))])) : i("", !0),
5114
- o("p", qa, [
5115
- ot.value.length ? (_(), a(e, { key: 0 }, [
5156
+ innerHTML: Ot(e.latex)
5157
+ }, null, 8, qa),
5158
+ o("span", Ja, "\\" + b(e.name), 1),
5159
+ o("span", Ya, b(e.title), 1)
5160
+ ], 10, Ka))), 128))])) : i("", !0),
5161
+ o("p", Xa, [
5162
+ mt.value.length ? (_(), a(e, { key: 0 }, [
5116
5163
  d[16] ||= o("kbd", null, "↑", -1),
5117
5164
  d[17] ||= o("kbd", null, "↓", -1),
5118
5165
  d[18] ||= c(" choose · ", -1),
@@ -5127,56 +5174,60 @@ var Ea = [
5127
5174
  ], 36))])),
5128
5175
  o("div", {
5129
5176
  ref_key: "stackEl",
5130
- ref: qe,
5177
+ ref: Ke,
5131
5178
  class: "equations-stack",
5132
- onKeydown: mt,
5133
- onFocusout: Je
5179
+ onMousedown: dt,
5180
+ onKeydown: Ct,
5181
+ onFocusout: qe
5134
5182
  }, [(_(!0), a(e, null, y(C.value, (e, t) => (_(), a("div", {
5135
5183
  key: O.value[t],
5136
5184
  class: m(["equation-row", [
5137
5185
  {
5138
- active: t === A.value,
5139
- dragging: t === B.value
5186
+ active: t === j.value,
5187
+ dragging: t === V.value,
5188
+ "line-selected": st(t)
5140
5189
  },
5141
- Rt(t),
5142
- it(t)
5190
+ qt(t),
5191
+ rt(t)
5143
5192
  ]]),
5144
5193
  "data-line": t,
5145
5194
  "data-line-id": O.value[t],
5146
- onFocusin: (e) => Ke(t),
5147
- onDragover: (e) => tt(t, e),
5148
- onDrop: nt
5195
+ "data-selected": st(t) || void 0,
5196
+ onFocusin: (e) => Ge(t),
5197
+ onDragover: (e) => et(t, e),
5198
+ onDrop: tt
5149
5199
  }, [o("div", {
5150
5200
  class: "equation-label",
5151
5201
  "data-role": "line-handle",
5152
- draggable: Xe.value ? "true" : void 0,
5153
- title: Xe.value ? `Drag to reorder (${S(Ae)}+↑/↓)` : void 0,
5154
- onDragstart: (e) => et(t, e),
5155
- onDragend: rt
5156
- }, [o("span", Xa, b(t + 1), 1), Rt(t) ? (_(), a("i", {
5202
+ draggable: Ye.value ? "true" : void 0,
5203
+ title: ft.value,
5204
+ onMousedown: (e) => ut(t, e),
5205
+ onDragstart: (e) => $e(t, e),
5206
+ onDragend: nt
5207
+ }, [o("span", $a, b(t + 1), 1), qt(t) ? (_(), a("i", {
5157
5208
  key: 0,
5158
- class: m(["pi line-problem", Rt(t) === "has-error" ? "pi-exclamation-circle" : "pi-exclamation-triangle"]),
5209
+ class: m(["pi line-problem", qt(t) === "has-error" ? "pi-exclamation-circle" : "pi-exclamation-triangle"]),
5159
5210
  role: "img",
5160
- "aria-label": Vt(t),
5161
- title: Vt(t),
5211
+ "aria-label": Xt(t),
5212
+ title: Xt(t),
5162
5213
  "data-role": "line-problem",
5163
- "data-kind": Rt(t) === "has-error" ? "error" : "units"
5164
- }, null, 10, Za)) : i("", !0)], 40, Ya), l(Qi, {
5214
+ "data-kind": qt(t) === "has-error" ? "error" : "units"
5215
+ }, null, 10, eo)) : i("", !0)], 40, Qa), l(Qi, {
5165
5216
  ref_for: !0,
5166
- ref: (e) => be.value[t] = e,
5217
+ ref: (e) => ye.value[t] = e,
5167
5218
  class: "equation-field",
5168
5219
  "model-value": e.root,
5169
5220
  cursor: e.cursor,
5170
5221
  anchor: e.anchor ?? null,
5171
- active: t === A.value,
5222
+ active: t === j.value,
5172
5223
  readonly: u.readonly,
5173
- autofocus: u.autofocus && t === A.value ? !0 : void 0,
5174
- marks: H.value[t],
5224
+ autofocus: u.autofocus && t === j.value ? !0 : void 0,
5225
+ marks: Gt.value[t],
5175
5226
  "greek-names": u.greekNames,
5176
5227
  "typeset-names": u.typesetNames,
5177
- onNavigate: (e) => Ne(t, e),
5178
- onEdit: (e, n) => je(t, e, n),
5179
- onImport: (e) => Ie(t, e)
5228
+ onNavigate: (e) => Me(t, e),
5229
+ onEdit: (e, n) => Ae(t, e, n),
5230
+ onImport: (e) => Fe(t, e)
5180
5231
  }, null, 8, [
5181
5232
  "model-value",
5182
5233
  "cursor",
@@ -5190,74 +5241,81 @@ var Ea = [
5190
5241
  "onNavigate",
5191
5242
  "onEdit",
5192
5243
  "onImport"
5193
- ])], 42, Ja))), 128))], 544),
5194
- o("div", Qa, [zt.value ? (_(), a("div", {
5244
+ ])], 42, Za))), 128))], 544),
5245
+ o("div", to, [Jt.value ? (_(), a("div", {
5195
5246
  key: 0,
5196
- class: m(["status-bar", `status-${zt.value.kind}`]),
5247
+ class: m(["status-bar", `status-${Jt.value.kind}`]),
5197
5248
  "data-role": "status",
5198
- "data-kind": zt.value.kind,
5199
- title: Bt.value || void 0,
5249
+ "data-kind": Jt.value.kind,
5250
+ title: Yt.value || void 0,
5200
5251
  onMousedown: d[11] ||= E(() => {}, ["prevent"]),
5201
- onClick: Ht
5202
- }, [o("span", eo, b(zt.value.text), 1), zt.value.more ? (_(), a("span", to, "+" + b(zt.value.more) + " more", 1)) : i("", !0)], 42, $a)) : i("", !0)]),
5203
- u.debug ? (_(), a("p", no, [
5252
+ onClick: Zt
5253
+ }, [o("span", ro, b(Jt.value.text), 1), Jt.value.more ? (_(), a("span", io, "+" + b(Jt.value.more) + " more", 1)) : i("", !0)], 42, no)) : i("", !0)]),
5254
+ u.debug ? (_(), a("p", ao, [
5204
5255
  d[26] ||= c(" Cursor: ", -1),
5205
- o("span", ro, b(Zt.value), 1),
5206
- Qt.value ? (_(), a(e, { key: 0 }, [d[25] ||= c(" · Selection: ", -1), o("span", io, b(Qt.value), 1)], 64)) : i("", !0)
5256
+ o("span", oo, b(sn.value), 1),
5257
+ cn.value ? (_(), a(e, { key: 0 }, [d[25] ||= c(" · Selection: ", -1), o("span", so, b(cn.value), 1)], 64)) : i("", !0)
5207
5258
  ])) : i("", !0),
5208
- o("details", ao, [
5209
- d[58] ||= o("summary", null, "Keys and typing", -1),
5210
- o("p", oo, [
5211
- d[27] ||= s("<kbd data-v-bd4a6d07>←</kbd><kbd data-v-bd4a6d07>→</kbd> move through every position · <kbd data-v-bd4a6d07>↑</kbd><kbd data-v-bd4a6d07>↓</kbd> numerator/denominator, else previous/next line · <kbd data-v-bd4a6d07>Home</kbd><kbd data-v-bd4a6d07>End</kbd> start/end · <kbd data-v-bd4a6d07>Tab</kbd> next empty slot · <kbd data-v-bd4a6d07>Space</kbd> step out of a fraction, exponent or bracket · <kbd data-v-bd4a6d07>Enter</kbd> new line (in a piecewise: new piece; <kbd data-v-bd4a6d07>Backspace</kbd> in an empty piece removes it; <code data-v-bd4a6d07>\\otherwise</code> adds one) · ", 19),
5212
- o("kbd", null, b(S(Ae)), 1),
5213
- d[28] ||= c("+", -1),
5214
- d[29] ||= o("kbd", null, "↑", -1),
5215
- d[30] ||= o("kbd", null, "↓", -1),
5216
- d[31] ||= c(" move the line up/down, or drag it by its number ", -1)
5217
- ]),
5218
- o("p", so, [
5219
- d[32] ||= c(" Select with ", -1),
5220
- d[33] ||= o("kbd", null, "Shift", -1),
5221
- d[34] ||= c("+", -1),
5222
- d[35] ||= o("kbd", null, "←", -1),
5223
- d[36] ||= o("kbd", null, "→", -1),
5224
- d[37] ||= c(", ", -1),
5225
- d[38] ||= o("kbd", null, "Shift", -1),
5226
- d[39] ||= c("+", -1),
5227
- d[40] ||= o("kbd", null, "Home", -1),
5228
- d[41] ||= o("kbd", null, "End", -1),
5229
- d[42] ||= c(", ", -1),
5230
- o("kbd", null, b(S(ke)), 1),
5231
- d[43] ||= s("+<kbd data-v-bd4a6d07>A</kbd> or by dragging · <code data-v-bd4a6d07>/</code>, <code data-v-bd4a6d07>^</code>, <code data-v-bd4a6d07>(</code>, <code data-v-bd4a6d07>|</code>, <code data-v-bd4a6d07>\\sqrt</code>, <code data-v-bd4a6d07>\\sin</code>, … or a toolbar button then wraps the selection · typing replaces it · <kbd data-v-bd4a6d07>Esc</kbd> clears it · ", 17),
5259
+ o("details", co, [
5260
+ d[62] ||= o("summary", null, "Keys and typing", -1),
5261
+ o("p", lo, [
5262
+ d[31] ||= s("<kbd data-v-99af4c22>←</kbd><kbd data-v-99af4c22>→</kbd> move through every position · <kbd data-v-99af4c22>↑</kbd><kbd data-v-99af4c22>↓</kbd> numerator/denominator, else previous/next line · <kbd data-v-99af4c22>Home</kbd><kbd data-v-99af4c22>End</kbd> start/end · <kbd data-v-99af4c22>Tab</kbd> next empty slot · <kbd data-v-99af4c22>Space</kbd> step out of a fraction, exponent or bracket · <kbd data-v-99af4c22>Enter</kbd> new line (in a piecewise: new piece; <kbd data-v-99af4c22>Backspace</kbd> in an empty piece removes it; <code data-v-99af4c22>\\otherwise</code> adds one) · ", 19),
5232
5263
  o("kbd", null, b(S(ke)), 1),
5233
- d[44] ||= c("+", -1),
5234
- d[45] ||= o("kbd", null, "C", -1),
5235
- d[46] ||= c("/", -1),
5236
- d[47] ||= o("kbd", null, "X", -1),
5237
- d[48] ||= c("/", -1),
5238
- d[49] ||= o("kbd", null, "V", -1),
5239
- d[50] ||= c(" copy, cut and paste (copies as LaTeX for other apps; pastes LaTeX or plain text such as ", -1),
5240
- d[51] ||= o("code", null, "(x+1)/2", -1),
5241
- d[52] ||= c(") ", -1)
5264
+ d[32] ||= c("+", -1),
5265
+ d[33] ||= o("kbd", null, "↑", -1),
5266
+ d[34] ||= o("kbd", null, "↓", -1),
5267
+ d[35] ||= c(" move the line up/down, or drag it by its number", -1),
5268
+ u.outputs ? (_(), a(e, { key: 0 }, [
5269
+ d[27] ||= c(" · ", -1),
5270
+ d[28] ||= o("kbd", null, "Shift", -1),
5271
+ d[29] ||= c("+click or ", -1),
5272
+ o("kbd", null, b(S(Oe)), 1),
5273
+ d[30] ||= c("+click line numbers to select lines for \"Copy as\"", -1)
5274
+ ], 64)) : i("", !0)
5242
5275
  ]),
5243
- o("p", co, [d[57] ||= s(" Type letters, numbers and <code data-v-bd4a6d07>+ − * = ,</code> where the caret is · conditions: <code data-v-bd4a6d07>&lt; &gt; &lt;= &gt;= !=</code>, <code data-v-bd4a6d07>&amp;</code> (∧), <code data-v-bd4a6d07>!</code> (¬), <code data-v-bd4a6d07>\\or</code> (∨) · <code data-v-bd4a6d07>/</code> makes a fraction of what&#39;s before the caret · <code data-v-bd4a6d07>^</code> exponent · <code data-v-bd4a6d07>( )</code> and <code data-v-bd4a6d07>| |</code> brackets · <code data-v-bd4a6d07>0.25{mV}</code> a number&#39;s units · letters, digits and <code data-v-bd4a6d07>_</code> with no operator between them are one name (<code data-v-bd4a6d07>Vm_init</code>); multiply names with <code data-v-bd4a6d07>*</code> (<code data-v-bd4a6d07>a*b</code>) · a name spelling a function (<code data-v-bd4a6d07>sin</code>, <code data-v-bd4a6d07>cosh</code>, …) is that function · <code data-v-bd4a6d07>\\</code> commands (<code data-v-bd4a6d07>\\frac \\sqrt \\root \\abs \\dd \\cases \\sin \\pi \\e \\inf \\alpha</code> …) · <kbd data-v-bd4a6d07>Backspace</kbd>/<kbd data-v-bd4a6d07>Delete</kbd> delete", 41), g.history ? (_(), a(e, { key: 0 }, [
5244
- d[53] ||= c(" · ", -1),
5245
- o("kbd", null, b(S(ke)), 1),
5246
- d[54] ||= c("+", -1),
5247
- d[55] ||= o("kbd", null, "Z", -1),
5248
- d[56] ||= c(" undo", -1)
5276
+ o("p", uo, [
5277
+ d[36] ||= c(" Select with ", -1),
5278
+ d[37] ||= o("kbd", null, "Shift", -1),
5279
+ d[38] ||= c("+", -1),
5280
+ d[39] ||= o("kbd", null, "←", -1),
5281
+ d[40] ||= o("kbd", null, "→", -1),
5282
+ d[41] ||= c(", ", -1),
5283
+ d[42] ||= o("kbd", null, "Shift", -1),
5284
+ d[43] ||= c("+", -1),
5285
+ d[44] ||= o("kbd", null, "Home", -1),
5286
+ d[45] ||= o("kbd", null, "End", -1),
5287
+ d[46] ||= c(", ", -1),
5288
+ o("kbd", null, b(S(Oe)), 1),
5289
+ d[47] ||= s("+<kbd data-v-99af4c22>A</kbd> or by dragging · <code data-v-99af4c22>/</code>, <code data-v-99af4c22>^</code>, <code data-v-99af4c22>(</code>, <code data-v-99af4c22>|</code>, <code data-v-99af4c22>\\sqrt</code>, <code data-v-99af4c22>\\sin</code>, … or a toolbar button then wraps the selection · typing replaces it · <kbd data-v-99af4c22>Esc</kbd> clears it · ", 17),
5290
+ o("kbd", null, b(S(Oe)), 1),
5291
+ d[48] ||= c("+", -1),
5292
+ d[49] ||= o("kbd", null, "C", -1),
5293
+ d[50] ||= c("/", -1),
5294
+ d[51] ||= o("kbd", null, "X", -1),
5295
+ d[52] ||= c("/", -1),
5296
+ d[53] ||= o("kbd", null, "V", -1),
5297
+ d[54] ||= c(" copy, cut and paste (copies as LaTeX for other apps; pastes LaTeX or plain text such as ", -1),
5298
+ d[55] ||= o("code", null, "(x+1)/2", -1),
5299
+ d[56] ||= c(") ", -1)
5300
+ ]),
5301
+ o("p", fo, [d[61] ||= s(" Type letters, numbers and <code data-v-99af4c22>+ − * = ,</code> where the caret is · conditions: <code data-v-99af4c22>&lt; &gt; &lt;= &gt;= !=</code>, <code data-v-99af4c22>&amp;</code> (∧), <code data-v-99af4c22>!</code> (¬), <code data-v-99af4c22>\\or</code> (∨) · <code data-v-99af4c22>/</code> makes a fraction of what&#39;s before the caret · <code data-v-99af4c22>^</code> exponent · <code data-v-99af4c22>( )</code> and <code data-v-99af4c22>| |</code> brackets · <code data-v-99af4c22>0.25{mV}</code> a number&#39;s units · letters, digits and <code data-v-99af4c22>_</code> with no operator between them are one name (<code data-v-99af4c22>Vm_init</code>); multiply names with <code data-v-99af4c22>*</code> (<code data-v-99af4c22>a*b</code>) · a name spelling a function (<code data-v-99af4c22>sin</code>, <code data-v-99af4c22>cosh</code>, …) is that function · <code data-v-99af4c22>\\</code> commands (<code data-v-99af4c22>\\frac \\sqrt \\root \\abs \\dd \\cases \\sin \\pi \\e \\inf \\alpha</code> …) · <kbd data-v-99af4c22>Backspace</kbd>/<kbd data-v-99af4c22>Delete</kbd> delete", 41), g.history ? (_(), a(e, { key: 0 }, [
5302
+ d[57] ||= c(" · ", -1),
5303
+ o("kbd", null, b(S(Oe)), 1),
5304
+ d[58] ||= c("+", -1),
5305
+ d[59] ||= o("kbd", null, "Z", -1),
5306
+ d[60] ||= c(" undo", -1)
5249
5307
  ], 64)) : i("", !0)])
5250
5308
  ])
5251
5309
  ], 512),
5252
- n.$slots.side ? (_(), a("aside", lo, [ne(n.$slots, "side", {}, void 0, !0)])) : i("", !0),
5310
+ n.$slots.side ? (_(), a("aside", po, [ne(n.$slots, "side", {}, void 0, !0)])) : i("", !0),
5253
5311
  u.outputs ? (_(), r(S(ue), {
5254
5312
  key: 1,
5255
5313
  class: "output-card",
5256
5314
  "data-role": "outputs"
5257
5315
  }, {
5258
5316
  content: w(() => [l(S(_e), {
5259
- value: en.value,
5260
- "onUpdate:value": d[12] ||= (e) => en.value = e
5317
+ value: un.value,
5318
+ "onUpdate:value": d[12] ||= (e) => un.value = e
5261
5319
  }, {
5262
5320
  default: w(() => [l(S(me), null, {
5263
5321
  default: w(() => [
@@ -5265,7 +5323,7 @@ var Ea = [
5265
5323
  value: "mathml",
5266
5324
  "data-role": "tab-mathml"
5267
5325
  }, {
5268
- default: w(() => [d[59] ||= c(" Content MathML ", -1), u.cellml ? (_(), r(S(ve), {
5326
+ default: w(() => [d[63] ||= c(" Content MathML ", -1), u.cellml ? (_(), r(S(ve), {
5269
5327
  key: 0,
5270
5328
  class: "tab-tag",
5271
5329
  severity: "secondary",
@@ -5278,21 +5336,21 @@ var Ea = [
5278
5336
  value: "mathjson",
5279
5337
  "data-role": "tab-mathjson"
5280
5338
  }, {
5281
- default: w(() => [...d[60] ||= [c("MathJSON", -1)]]),
5339
+ default: w(() => [...d[64] ||= [c("MathJSON", -1)]]),
5282
5340
  _: 1
5283
5341
  }),
5284
5342
  l(S(pe), {
5285
5343
  value: "latex",
5286
5344
  "data-role": "tab-latex"
5287
5345
  }, {
5288
- default: w(() => [...d[61] ||= [c("LaTeX", -1)]]),
5346
+ default: w(() => [...d[65] ||= [c("LaTeX", -1)]]),
5289
5347
  _: 1
5290
5348
  }),
5291
5349
  l(S(pe), {
5292
5350
  value: "ast",
5293
5351
  "data-role": "tab-ast"
5294
5352
  }, {
5295
- default: w(() => [...d[62] ||= [c("AST", -1)]]),
5353
+ default: w(() => [...d[66] ||= [c("AST", -1)]]),
5296
5354
  _: 1
5297
5355
  })
5298
5356
  ]),
@@ -5300,26 +5358,26 @@ var Ea = [
5300
5358
  }), l(S(ge), null, {
5301
5359
  default: w(() => [
5302
5360
  l(S(he), { value: "mathml" }, {
5303
- default: w(() => [o("pre", uo, b(Xt.value), 1)]),
5361
+ default: w(() => [o("pre", mo, b(on.value), 1)]),
5304
5362
  _: 1
5305
5363
  }),
5306
5364
  l(S(he), { value: "mathjson" }, {
5307
- default: w(() => [o("div", fo, [l(S(D), {
5365
+ default: w(() => [o("div", ho, [l(S(D), {
5308
5366
  icon: "pi pi-copy",
5309
- label: $t.value ? "Copied" : "Copy MathJSON",
5367
+ label: ln.value ? "Copied" : "Copy MathJSON",
5310
5368
  size: "small",
5311
5369
  text: "",
5312
- disabled: !Yt.value,
5313
- onClick: rn
5314
- }, null, 8, ["label", "disabled"])]), o("pre", po, b(Yt.value), 1)]),
5370
+ disabled: !an.value,
5371
+ onClick: pn
5372
+ }, null, 8, ["label", "disabled"])]), o("pre", go, b(an.value), 1)]),
5315
5373
  _: 1
5316
5374
  }),
5317
5375
  l(S(he), { value: "latex" }, {
5318
- default: w(() => [o("pre", mo, b(Jt.value), 1)]),
5376
+ default: w(() => [o("pre", _o, b(rn.value), 1)]),
5319
5377
  _: 1
5320
5378
  }),
5321
5379
  l(S(he), { value: "ast" }, {
5322
- default: w(() => [o("pre", ho, b(qt.value ? JSON.stringify(qt.value, null, 2) : ""), 1)]),
5380
+ default: w(() => [o("pre", vo, b(nn.value ? JSON.stringify(nn.value, null, 2) : ""), 1)]),
5323
5381
  _: 1
5324
5382
  })
5325
5383
  ]),
@@ -5331,7 +5389,7 @@ var Ea = [
5331
5389
  })) : i("", !0)
5332
5390
  ], 34)]));
5333
5391
  }
5334
- }), [["__scopeId", "data-v-bd4a6d07"]]), vo = "new units", yo = [
5392
+ }), [["__scopeId", "data-v-99af4c22"]]), xo = "new units", So = [
5335
5393
  "yotta",
5336
5394
  "zetta",
5337
5395
  "exa",
@@ -5352,15 +5410,15 @@ var Ea = [
5352
5410
  "atto",
5353
5411
  "zepto",
5354
5412
  "yocto"
5355
- ], bo = /^[A-Za-z_][A-Za-z0-9_]*$/;
5356
- function xo(e, t, n) {
5413
+ ], Co = /^[A-Za-z_][A-Za-z0-9_]*$/;
5414
+ function wo(e, t, n) {
5357
5415
  let r = [], { name: i, parts: a } = e;
5358
- return i ? bo.test(i) ? (t.some((e) => e.name === i) || n?.includes(i)) && r.push(`There are units called ${i} already`) : r.push(`${i} isn't a units name: use letters, digits and _, not starting with a digit`) : r.push("Give the units a name"), a.length === 0 && r.push("Add what the units are made of"), a.forEach((e, o) => {
5416
+ return i ? Co.test(i) ? (t.some((e) => e.name === i) || n?.includes(i)) && r.push(`There are units called ${i} already`) : r.push(`${i} isn't a units name: use letters, digits and _, not starting with a digit`) : r.push("Give the units a name"), a.length === 0 && r.push("Add what the units are made of"), a.forEach((e, o) => {
5359
5417
  let s = a.length > 1 ? `Part ${o + 1}: ` : "";
5360
- e.units ? e.units === i ? r.push(`${s}units can't be made of themselves`) : n && !n.includes(e.units) && !t.some((t) => t.name === e.units) && r.push(`${s}no units called ${e.units} are defined`) : r.push(`${s}choose the units it is made of`), e.prefix && !yo.includes(e.prefix) && r.push(`${s}${e.prefix} isn't a prefix`), e.exponent !== void 0 && !Number.isFinite(e.exponent) && r.push(`${s}the exponent must be a number`), e.multiplier !== void 0 && !Number.isFinite(e.multiplier) && r.push(`${s}the multiplier must be a number`);
5361
- }), i && bo.test(i) && So(i, a, t) && r.push(`${i} would be made of itself, through other new units`), r;
5418
+ e.units ? e.units === i ? r.push(`${s}units can't be made of themselves`) : n && !n.includes(e.units) && !t.some((t) => t.name === e.units) && r.push(`${s}no units called ${e.units} are defined`) : r.push(`${s}choose the units it is made of`), e.prefix && !So.includes(e.prefix) && r.push(`${s}${e.prefix} isn't a prefix`), e.exponent !== void 0 && !Number.isFinite(e.exponent) && r.push(`${s}the exponent must be a number`), e.multiplier !== void 0 && !Number.isFinite(e.multiplier) && r.push(`${s}the multiplier must be a number`);
5419
+ }), i && Co.test(i) && To(i, a, t) && r.push(`${i} would be made of itself, through other new units`), r;
5362
5420
  }
5363
- function So(e, t, n) {
5421
+ function To(e, t, n) {
5364
5422
  let r = /* @__PURE__ */ new Set(), i = (t) => {
5365
5423
  if (t === e) return !0;
5366
5424
  if (r.has(t)) return !1;
@@ -5370,17 +5428,17 @@ function So(e, t, n) {
5370
5428
  };
5371
5429
  return t.some((t) => t.units !== e && i(t.units));
5372
5430
  }
5373
- function Co(e, t) {
5431
+ function Eo(e, t) {
5374
5432
  return t.filter((t) => t.parts.some((t) => t.units === e)).map((e) => e.name);
5375
5433
  }
5376
- function wo(e) {
5434
+ function Do(e) {
5377
5435
  return e.parts.map((e) => {
5378
5436
  let t = [e.multiplier !== void 0 && e.multiplier !== 1 ? e.multiplier : ""].concat(e.prefix ?? "", e.units).filter((e) => e !== "").join(" "), n = e.exponent ?? 1;
5379
5437
  return n === 1 ? t : t.includes(" ") ? `(${t})^${n}` : `${t}^${n}`;
5380
5438
  }).join(" · ");
5381
5439
  }
5382
- var To = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
5383
- function Eo(e, t = "new_units") {
5440
+ var Oo = (e) => e.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;");
5441
+ function ko(e, t = "new_units") {
5384
5442
  let n = [], r = (t, i) => {
5385
5443
  if (!(n.includes(t) || i.has(t.name))) {
5386
5444
  i.add(t.name);
@@ -5394,20 +5452,20 @@ function Eo(e, t = "new_units") {
5394
5452
  for (let t of e) r(t, /* @__PURE__ */ new Set());
5395
5453
  let i = n.map((e) => {
5396
5454
  let t = e.parts.map((e) => ` <unit${[
5397
- e.prefix ? ` prefix="${To(e.prefix)}"` : "",
5398
- ` units="${To(e.units)}"`,
5455
+ e.prefix ? ` prefix="${Oo(e.prefix)}"` : "",
5456
+ ` units="${Oo(e.units)}"`,
5399
5457
  e.exponent !== void 0 && e.exponent !== 1 ? ` exponent="${e.exponent}"` : "",
5400
5458
  e.multiplier !== void 0 && e.multiplier !== 1 ? ` multiplier="${e.multiplier}"` : ""
5401
5459
  ].join("")}/>`);
5402
5460
  return [
5403
- ` <units name="${To(e.name)}">`,
5461
+ ` <units name="${Oo(e.name)}">`,
5404
5462
  ...t,
5405
5463
  " </units>"
5406
5464
  ].join("\n");
5407
5465
  });
5408
5466
  return [
5409
5467
  "<?xml version=\"1.0\" encoding=\"UTF-8\"?>",
5410
- `<model xmlns="http://www.cellml.org/cellml/2.0#" name="${To(t)}">`,
5468
+ `<model xmlns="http://www.cellml.org/cellml/2.0#" name="${Oo(t)}">`,
5411
5469
  ...i,
5412
5470
  "</model>",
5413
5471
  ""
@@ -5415,15 +5473,15 @@ function Eo(e, t = "new_units") {
5415
5473
  }
5416
5474
  //#endregion
5417
5475
  //#region src/units/UnitsDefinitionForm.vue?vue&type=script&setup=true&lang.ts
5418
- var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:modelValue", "aria-label"], Ao = ["value"], jo = [
5476
+ var Ao = { class: "form-name" }, jo = { class: "form-parts" }, Mo = ["onUpdate:modelValue", "aria-label"], No = ["value"], Po = [
5419
5477
  "onUpdate:modelValue",
5420
5478
  "list",
5421
5479
  "aria-label"
5422
- ], Mo = ["onUpdate:modelValue", "aria-label"], No = ["onUpdate:modelValue", "aria-label"], Po = ["id"], Fo = ["value"], Io = {
5480
+ ], Fo = ["onUpdate:modelValue", "aria-label"], Io = ["onUpdate:modelValue", "aria-label"], Lo = ["id"], Ro = ["value"], zo = {
5423
5481
  key: 0,
5424
5482
  class: "form-problems",
5425
5483
  "data-role": "units-form-problems"
5426
- }, Lo = { class: "form-actions" }, Ro = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5484
+ }, Bo = { class: "form-actions" }, Vo = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5427
5485
  __name: "UnitsDefinitionForm",
5428
5486
  props: {
5429
5487
  definition: {},
@@ -5450,7 +5508,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5450
5508
  ...n !== void 0 && n !== 1 ? { multiplier: n } : {}
5451
5509
  };
5452
5510
  })
5453
- })), te = n(() => xo(ee.value, s.others, s.known));
5511
+ })), te = n(() => wo(ee.value, s.others, s.known));
5454
5512
  function g() {
5455
5513
  m.value = !0, te.value.length === 0 && c("save", ee.value);
5456
5514
  }
@@ -5460,7 +5518,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5460
5518
  "data-role": "units-form",
5461
5519
  onSubmit: E(g, ["prevent"])
5462
5520
  }, [
5463
- o("label", Do, [r[3] ||= o("span", null, "Name", -1), T(o("input", {
5521
+ o("label", Ao, [r[3] ||= o("span", null, "Name", -1), T(o("input", {
5464
5522
  "onUpdate:modelValue": r[0] ||= (e) => f.value = e,
5465
5523
  type: "text",
5466
5524
  spellcheck: "false",
@@ -5468,7 +5526,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5468
5526
  placeholder: "mV_per_ms",
5469
5527
  "data-role": "units-form-name"
5470
5528
  }, null, 512), [[se, f.value]])]),
5471
- o("table", Oo, [r[5] ||= o("thead", null, [o("tr", null, [
5529
+ o("table", jo, [r[5] ||= o("thead", null, [o("tr", null, [
5472
5530
  o("th", { scope: "col" }, "Prefix"),
5473
5531
  o("th", { scope: "col" }, "Units"),
5474
5532
  o("th", {
@@ -5487,10 +5545,10 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5487
5545
  o("td", null, [T(o("select", {
5488
5546
  "onUpdate:modelValue": (e) => t.prefix = e,
5489
5547
  "aria-label": `Prefix of part ${n + 1}`
5490
- }, [r[4] ||= o("option", { value: "" }, "—", -1), (_(!0), a(e, null, y(S(yo), (e) => (_(), a("option", {
5548
+ }, [r[4] ||= o("option", { value: "" }, "—", -1), (_(!0), a(e, null, y(S(So), (e) => (_(), a("option", {
5491
5549
  key: e,
5492
5550
  value: e
5493
- }, b(e), 9, Ao))), 128))], 8, ko), [[oe, t.prefix]])]),
5551
+ }, b(e), 9, No))), 128))], 8, Mo), [[oe, t.prefix]])]),
5494
5552
  o("td", null, [T(o("input", {
5495
5553
  "onUpdate:modelValue": (e) => t.units = e,
5496
5554
  type: "text",
@@ -5499,7 +5557,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5499
5557
  autocomplete: "off",
5500
5558
  placeholder: "second",
5501
5559
  "aria-label": `Units of part ${n + 1}`
5502
- }, null, 8, jo), [[se, t.units]])]),
5560
+ }, null, 8, Po), [[se, t.units]])]),
5503
5561
  o("td", null, [T(o("input", {
5504
5562
  "onUpdate:modelValue": (e) => t.exponent = e,
5505
5563
  class: "number",
@@ -5507,7 +5565,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5507
5565
  inputmode: "decimal",
5508
5566
  placeholder: "1",
5509
5567
  "aria-label": `Exponent of part ${n + 1}`
5510
- }, null, 8, Mo), [[se, t.exponent]])]),
5568
+ }, null, 8, Fo), [[se, t.exponent]])]),
5511
5569
  o("td", null, [T(o("input", {
5512
5570
  "onUpdate:modelValue": (e) => t.multiplier = e,
5513
5571
  class: "number",
@@ -5515,7 +5573,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5515
5573
  inputmode: "decimal",
5516
5574
  placeholder: "1",
5517
5575
  "aria-label": `Multiplier of part ${n + 1}`
5518
- }, null, 8, No), [[se, t.multiplier]])]),
5576
+ }, null, 8, Io), [[se, t.multiplier]])]),
5519
5577
  o("td", null, [l(S(D), {
5520
5578
  icon: "pi pi-times",
5521
5579
  size: "small",
@@ -5535,9 +5593,9 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5535
5593
  o("datalist", { id: S(ne) }, [(_(!0), a(e, null, y(t.choices, (e) => (_(), a("option", {
5536
5594
  key: e,
5537
5595
  value: e
5538
- }, null, 8, Fo))), 128))], 8, Po),
5539
- m.value && te.value.length ? (_(), a("ul", Io, [(_(!0), a(e, null, y(te.value, (e) => (_(), a("li", { key: e }, b(e), 1))), 128))])) : i("", !0),
5540
- o("div", Lo, [
5596
+ }, null, 8, Ro))), 128))], 8, Lo),
5597
+ m.value && te.value.length ? (_(), a("ul", zo, [(_(!0), a(e, null, y(te.value, (e) => (_(), a("li", { key: e }, b(e), 1))), 128))])) : i("", !0),
5598
+ o("div", Bo, [
5541
5599
  l(S(D), {
5542
5600
  icon: "pi pi-plus",
5543
5601
  label: "Part",
@@ -5568,7 +5626,7 @@ var Do = { class: "form-name" }, Oo = { class: "form-parts" }, ko = ["onUpdate:m
5568
5626
  }), [["__scopeId", "data-v-effe158e"]]);
5569
5627
  //#endregion
5570
5628
  //#region src/units/panel.ts
5571
- function zo(e, t, n) {
5629
+ function Ho(e, t, n) {
5572
5630
  let r = [...new Set(e.flatMap((e) => e.variables))], i = Object.keys(t).filter((e) => !r.includes(e)), a = n ? new Set(n) : null;
5573
5631
  return [...r, ...i].map((e) => {
5574
5632
  let n = t[e] ?? "", i = n ? a && !a.has(n) ? "unknown" : "ok" : "missing";
@@ -5580,11 +5638,11 @@ function zo(e, t, n) {
5580
5638
  };
5581
5639
  });
5582
5640
  }
5583
- function Bo(e, t, n) {
5641
+ function Uo(e, t, n) {
5584
5642
  let r = { ...e }, i = n.trim();
5585
5643
  return i ? r[t] = i : delete r[t], r;
5586
5644
  }
5587
- function Vo(e, t) {
5645
+ function Wo(e, t) {
5588
5646
  let n = [...e];
5589
5647
  for (let e of t) {
5590
5648
  let t = n.findIndex((t) => t.name === e.name);
@@ -5594,67 +5652,67 @@ function Vo(e, t) {
5594
5652
  }
5595
5653
  //#endregion
5596
5654
  //#region src/units/UnitsPanel.vue?vue&type=script&setup=true&lang.ts
5597
- var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5655
+ var Go = { class: "units-title" }, Ko = { "data-role": "units-summary" }, qo = {
5598
5656
  class: "units-section",
5599
5657
  "aria-labelledby": "units-files-title"
5600
- }, Go = { class: "section-head" }, Ko = { class: "section-actions" }, qo = {
5658
+ }, Jo = { class: "section-head" }, Yo = { class: "section-actions" }, Xo = {
5601
5659
  key: 0,
5602
5660
  class: "hint"
5603
- }, Jo = {
5661
+ }, Zo = {
5604
5662
  key: 1,
5605
5663
  class: "files",
5606
5664
  "data-role": "units-files"
5607
- }, Yo = ["data-file"], Xo = { class: "file-head" }, Zo = { class: "file-name" }, Qo = { class: "file-count" }, $o = {
5665
+ }, Qo = ["data-file"], $o = { class: "file-head" }, es = { class: "file-name" }, ts = { class: "file-count" }, ns = {
5608
5666
  key: 0,
5609
5667
  class: "units-names"
5610
- }, es = {
5668
+ }, rs = {
5611
5669
  key: 1,
5612
5670
  class: "problems",
5613
5671
  "data-role": "units-problems"
5614
- }, ts = {
5672
+ }, is = {
5615
5673
  class: "units-section",
5616
5674
  "aria-labelledby": "units-new-title",
5617
5675
  "data-role": "new-units"
5618
- }, ns = { class: "section-head" }, rs = { class: "section-actions" }, is = {
5676
+ }, as = { class: "section-head" }, os = { class: "section-actions" }, ss = {
5619
5677
  key: 0,
5620
5678
  class: "hint"
5621
- }, as = {
5679
+ }, cs = {
5622
5680
  key: 1,
5623
5681
  class: "new-units"
5624
- }, os = ["data-units"], ss = {
5682
+ }, ls = ["data-units"], us = {
5625
5683
  key: 1,
5626
5684
  class: "new-units-row"
5627
- }, cs = { class: "new-units-name" }, ls = {
5685
+ }, ds = { class: "new-units-name" }, fs = {
5628
5686
  class: "new-units-definition",
5629
5687
  "data-role": "new-units-definition"
5630
- }, us = {
5688
+ }, ps = {
5631
5689
  key: 3,
5632
5690
  class: "problems",
5633
5691
  "data-role": "new-units-problems"
5634
- }, ds = {
5692
+ }, ms = {
5635
5693
  class: "units-section",
5636
5694
  "aria-labelledby": "units-variables-title"
5637
- }, fs = { class: "section-head" }, ps = {
5695
+ }, hs = { class: "section-head" }, gs = {
5638
5696
  key: 0,
5639
5697
  class: "missing-count",
5640
5698
  "data-role": "missing-count"
5641
- }, ms = {
5699
+ }, _s = {
5642
5700
  key: 0,
5643
5701
  class: "hint"
5644
- }, hs = {
5702
+ }, vs = {
5645
5703
  key: 1,
5646
5704
  class: "variables",
5647
5705
  "data-role": "variables"
5648
- }, gs = ["data-variable", "data-state"], _s = {
5706
+ }, ys = ["data-variable", "data-state"], bs = {
5649
5707
  scope: "row",
5650
5708
  class: "variable-name"
5651
- }, vs = [
5709
+ }, xs = [
5652
5710
  "value",
5653
5711
  "list",
5654
5712
  "aria-label",
5655
5713
  "aria-invalid",
5656
5714
  "onChange"
5657
- ], ys = { class: "variable-state" }, bs = ["id"], xs = ["value"], Ss = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5715
+ ], Ss = { class: "variable-state" }, Cs = ["id"], ws = ["value"], Ts = /*#__PURE__*/ Zi(/* @__PURE__ */ u({
5658
5716
  __name: "UnitsPanel",
5659
5717
  props: /*@__PURE__*/ f({
5660
5718
  status: {},
@@ -5681,7 +5739,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5681
5739
  "update:newUnits"
5682
5740
  ],
5683
5741
  setup(t) {
5684
- let s = t, u = C(t, "sources"), d = C(t, "variableUnits"), f = C(t, "newUnits"), p = n(() => s.status === "ready"), h = n(() => zo(s.lines, d.value, p.value ? s.unitsNames : null)), ee = n(() => h.value.filter((e) => e.state === "missing").length), te = n(() => ({
5742
+ let s = t, u = C(t, "sources"), d = C(t, "variableUnits"), f = C(t, "newUnits"), p = n(() => s.status === "ready"), h = n(() => Ho(s.lines, d.value, p.value ? s.unitsNames : null)), ee = n(() => h.value.filter((e) => e.state === "missing").length), te = n(() => ({
5685
5743
  ready: {
5686
5744
  value: "libCellML",
5687
5745
  severity: "success"
@@ -5710,12 +5768,12 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5710
5768
  name: e.name,
5711
5769
  text: await e.text()
5712
5770
  })));
5713
- r.length && (u.value = Vo(u.value, r));
5771
+ r.length && (u.value = Wo(u.value, r));
5714
5772
  }
5715
5773
  function oe(e) {
5716
5774
  u.value = u.value.filter((t) => t.name !== e);
5717
5775
  }
5718
- let se = (e) => s.problems.filter((t) => t.source === e), ce = (e) => s.files.find((t) => t.name === e)?.units ?? [], T = v(void 0), E = n(() => T.value === void 0 || T.value === null ? null : f.value[T.value]), le = n(() => f.value.filter((e, t) => t !== T.value)), de = n(() => p.value ? s.unitsNames.filter((e) => e !== E.value?.name) : null), fe = n(() => [.../* @__PURE__ */ new Set([...s.unitsNames, ...le.value.map((e) => e.name)])].filter((e) => e !== E.value?.name)), pe = n(() => se(vo));
5776
+ let se = (e) => s.problems.filter((t) => t.source === e), ce = (e) => s.files.find((t) => t.name === e)?.units ?? [], T = v(void 0), E = n(() => T.value === void 0 || T.value === null ? null : f.value[T.value]), le = n(() => f.value.filter((e, t) => t !== T.value)), de = n(() => p.value ? s.unitsNames.filter((e) => e !== E.value?.name) : null), fe = n(() => [.../* @__PURE__ */ new Set([...s.unitsNames, ...le.value.map((e) => e.name)])].filter((e) => e !== E.value?.name)), pe = n(() => se(xo));
5719
5777
  function me(e) {
5720
5778
  let t = [...f.value], n = T.value;
5721
5779
  if (n == null) t.push(e);
@@ -5736,7 +5794,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5736
5794
  }
5737
5795
  let ge = ae();
5738
5796
  function _e(e, t) {
5739
- d.value = Bo(d.value, e, t.target.value);
5797
+ d.value = Uo(d.value, e, t.target.value);
5740
5798
  }
5741
5799
  let O = {
5742
5800
  ok: "",
@@ -5748,14 +5806,14 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5748
5806
  "data-role": "units-panel",
5749
5807
  "data-status": t.status
5750
5808
  }, {
5751
- title: w(() => [o("div", Ho, [s[4] ||= o("span", null, "Units", -1), l(S(ve), {
5809
+ title: w(() => [o("div", Go, [s[4] ||= o("span", null, "Units", -1), l(S(ve), {
5752
5810
  severity: te.value.severity,
5753
5811
  value: te.value.value,
5754
5812
  "data-role": "units-status"
5755
5813
  }, null, 8, ["severity", "value"])])]),
5756
- subtitle: w(() => [o("span", Uo, b(g.value), 1)]),
5814
+ subtitle: w(() => [o("span", Ko, b(g.value), 1)]),
5757
5815
  content: w(() => [
5758
- o("section", Wo, [o("div", Go, [s[5] ||= o("h3", { id: "units-files-title" }, "Units files", -1), o("div", Ko, [
5816
+ o("section", qo, [o("div", Jo, [s[5] ||= o("h3", { id: "units-files-title" }, "Units files", -1), o("div", Yo, [
5759
5817
  ne(n.$slots, "actions", {}, void 0, !0),
5760
5818
  l(S(D), {
5761
5819
  icon: "pi pi-folder-open",
@@ -5776,7 +5834,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5776
5834
  "data-role": "units-file-input",
5777
5835
  onChange: x
5778
5836
  }, null, 544)
5779
- ])]), u.value.length === 0 ? (_(), a("p", qo, [...s[6] ||= [
5837
+ ])]), u.value.length === 0 ? (_(), a("p", Xo, [...s[6] ||= [
5780
5838
  c(" Built-in units (", -1),
5781
5839
  o("code", null, "second", -1),
5782
5840
  c(", ", -1),
@@ -5784,13 +5842,13 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5784
5842
  c(", ", -1),
5785
5843
  o("code", null, "volt", -1),
5786
5844
  c(", …) are always available. Load CellML files for others; only their units are kept. ", -1)
5787
- ]])) : (_(), a("ul", Jo, [(_(!0), a(e, null, y(u.value, (t) => (_(), a("li", {
5845
+ ]])) : (_(), a("ul", Zo, [(_(!0), a(e, null, y(u.value, (t) => (_(), a("li", {
5788
5846
  key: t.name,
5789
5847
  "data-file": t.name
5790
5848
  }, [
5791
- o("div", Xo, [
5792
- o("span", Zo, b(t.name), 1),
5793
- o("span", Qo, b(p.value ? re(ce(t.name).length, "units definition") : ""), 1),
5849
+ o("div", $o, [
5850
+ o("span", es, b(t.name), 1),
5851
+ o("span", ts, b(p.value ? re(ce(t.name).length, "units definition") : ""), 1),
5794
5852
  l(S(D), {
5795
5853
  icon: "pi pi-times",
5796
5854
  size: "small",
@@ -5802,11 +5860,11 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5802
5860
  onClick: (e) => oe(t.name)
5803
5861
  }, null, 8, ["aria-label", "onClick"])
5804
5862
  ]),
5805
- ce(t.name).length ? (_(), a("div", $o, [(_(!0), a(e, null, y(ce(t.name), (e) => (_(), a("code", { key: e }, b(e), 1))), 128))])) : i("", !0),
5806
- se(t.name).length ? (_(), a("ul", es, [(_(!0), a(e, null, y(se(t.name), (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5807
- ], 8, Yo))), 128))]))]),
5808
- o("section", ts, [
5809
- o("div", ns, [s[7] ||= o("h3", { id: "units-new-title" }, "New units", -1), o("div", rs, [ne(n.$slots, "new-units-actions", { definitions: f.value }, void 0, !0), l(S(D), {
5863
+ ce(t.name).length ? (_(), a("div", ns, [(_(!0), a(e, null, y(ce(t.name), (e) => (_(), a("code", { key: e }, b(e), 1))), 128))])) : i("", !0),
5864
+ se(t.name).length ? (_(), a("ul", rs, [(_(!0), a(e, null, y(se(t.name), (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5865
+ ], 8, Qo))), 128))]))]),
5866
+ o("section", is, [
5867
+ o("div", as, [s[7] ||= o("h3", { id: "units-new-title" }, "New units", -1), o("div", os, [ne(n.$slots, "new-units-actions", { definitions: f.value }, void 0, !0), l(S(D), {
5810
5868
  icon: "pi pi-plus",
5811
5869
  label: "Define units",
5812
5870
  size: "small",
@@ -5816,11 +5874,11 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5816
5874
  title: "Define units of your own, kept in a file apart from the units files",
5817
5875
  onClick: s[1] ||= (e) => T.value = null
5818
5876
  }, null, 8, ["disabled"])])]),
5819
- f.value.length === 0 && T.value === void 0 ? (_(), a("p", is, " Units you define are kept in a units file of their own, apart from the files loaded. ")) : i("", !0),
5820
- f.value.length ? (_(), a("ul", as, [(_(!0), a(e, null, y(f.value, (e, t) => (_(), a("li", {
5877
+ f.value.length === 0 && T.value === void 0 ? (_(), a("p", ss, " Units you define are kept in a units file of their own, apart from the files loaded. ")) : i("", !0),
5878
+ f.value.length ? (_(), a("ul", cs, [(_(!0), a(e, null, y(f.value, (e, t) => (_(), a("li", {
5821
5879
  key: e.name,
5822
5880
  "data-units": e.name
5823
- }, [T.value === t ? (_(), r(Ro, {
5881
+ }, [T.value === t ? (_(), r(Vo, {
5824
5882
  key: 0,
5825
5883
  definition: e,
5826
5884
  others: le.value,
@@ -5833,9 +5891,9 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5833
5891
  "others",
5834
5892
  "known",
5835
5893
  "choices"
5836
- ])) : (_(), a("div", ss, [
5837
- o("code", cs, b(e.name), 1),
5838
- o("span", ls, " = " + b(S(wo)(e)), 1),
5894
+ ])) : (_(), a("div", us, [
5895
+ o("code", ds, b(e.name), 1),
5896
+ o("span", fs, " = " + b(S(Do)(e)), 1),
5839
5897
  l(S(D), {
5840
5898
  icon: "pi pi-pencil",
5841
5899
  size: "small",
@@ -5858,8 +5916,8 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5858
5916
  rounded: "",
5859
5917
  severity: "secondary",
5860
5918
  "aria-label": `Remove ${e.name}`,
5861
- title: S(Co)(e.name, f.value).length ? `Used by ${S(Co)(e.name, f.value).join(", ")}` : "Remove these units",
5862
- disabled: T.value !== void 0 || S(Co)(e.name, f.value).length > 0,
5919
+ title: S(Eo)(e.name, f.value).length ? `Used by ${S(Eo)(e.name, f.value).join(", ")}` : "Remove these units",
5920
+ disabled: T.value !== void 0 || S(Eo)(e.name, f.value).length > 0,
5863
5921
  onClick: (e) => he(t)
5864
5922
  }, null, 8, [
5865
5923
  "aria-label",
@@ -5867,8 +5925,8 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5867
5925
  "disabled",
5868
5926
  "onClick"
5869
5927
  ])
5870
- ]))], 8, os))), 128))])) : i("", !0),
5871
- T.value === null ? (_(), r(Ro, {
5928
+ ]))], 8, ls))), 128))])) : i("", !0),
5929
+ T.value === null ? (_(), r(Vo, {
5872
5930
  key: 2,
5873
5931
  others: le.value,
5874
5932
  known: de.value,
@@ -5880,17 +5938,17 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5880
5938
  "known",
5881
5939
  "choices"
5882
5940
  ])) : i("", !0),
5883
- pe.value.length ? (_(), a("ul", us, [(_(!0), a(e, null, y(pe.value, (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5941
+ pe.value.length ? (_(), a("ul", ps, [(_(!0), a(e, null, y(pe.value, (e, t) => (_(), a("li", { key: t }, b(e.message), 1))), 128))])) : i("", !0)
5884
5942
  ]),
5885
- o("section", ds, [
5886
- o("div", fs, [s[8] ||= o("h3", { id: "units-variables-title" }, "Variables", -1), ee.value ? (_(), a("span", ps, b(re(ee.value, "variable")) + " without units ", 1)) : i("", !0)]),
5887
- h.value.length === 0 ? (_(), a("p", ms, " The variables in your equations are listed here, to give each one its units. ")) : (_(), a("table", hs, [o("tbody", null, [(_(!0), a(e, null, y(h.value, (t) => (_(), a("tr", {
5943
+ o("section", ms, [
5944
+ o("div", hs, [s[8] ||= o("h3", { id: "units-variables-title" }, "Variables", -1), ee.value ? (_(), a("span", gs, b(re(ee.value, "variable")) + " without units ", 1)) : i("", !0)]),
5945
+ h.value.length === 0 ? (_(), a("p", _s, " The variables in your equations are listed here, to give each one its units. ")) : (_(), a("table", vs, [o("tbody", null, [(_(!0), a(e, null, y(h.value, (t) => (_(), a("tr", {
5888
5946
  key: t.name,
5889
5947
  class: m([`state-${t.state}`, { unused: !t.used }]),
5890
5948
  "data-variable": t.name,
5891
5949
  "data-state": t.state
5892
5950
  }, [
5893
- o("th", _s, b(t.name), 1),
5951
+ o("th", bs, b(t.name), 1),
5894
5952
  o("td", null, [o("input", {
5895
5953
  class: "units-input",
5896
5954
  type: "text",
@@ -5902,8 +5960,8 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5902
5960
  "aria-label": `Units of ${t.name}`,
5903
5961
  "aria-invalid": t.state !== "ok",
5904
5962
  onChange: (e) => _e(t.name, e)
5905
- }, null, 40, vs)]),
5906
- o("td", ys, [t.used ? (_(), a(e, { key: 0 }, [c(b(O[t.state]), 1)], 64)) : (_(), a(e, { key: 1 }, [s[9] ||= c(" not used ", -1), l(S(D), {
5963
+ }, null, 40, xs)]),
5964
+ o("td", Ss, [t.used ? (_(), a(e, { key: 0 }, [c(b(O[t.state]), 1)], 64)) : (_(), a(e, { key: 1 }, [s[9] ||= c(" not used ", -1), l(S(D), {
5907
5965
  icon: "pi pi-times",
5908
5966
  size: "small",
5909
5967
  text: "",
@@ -5911,13 +5969,13 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5911
5969
  severity: "secondary",
5912
5970
  "aria-label": `Forget the units of ${t.name}`,
5913
5971
  title: "Forget these units",
5914
- onClick: (e) => d.value = S(Bo)(d.value, t.name, "")
5972
+ onClick: (e) => d.value = S(Uo)(d.value, t.name, "")
5915
5973
  }, null, 8, ["aria-label", "onClick"])], 64))])
5916
- ], 10, gs))), 128))])])),
5974
+ ], 10, ys))), 128))])])),
5917
5975
  o("datalist", { id: S(ge) }, [(_(!0), a(e, null, y(t.unitsNames, (e) => (_(), a("option", {
5918
5976
  key: e,
5919
5977
  value: e
5920
- }, null, 8, xs))), 128))], 8, bs)
5978
+ }, null, 8, ws))), 128))], 8, Cs)
5921
5979
  ])
5922
5980
  ]),
5923
5981
  _: 3
@@ -5926,7 +5984,7 @@ var Ho = { class: "units-title" }, Uo = { "data-role": "units-summary" }, Wo = {
5926
5984
  }), [["__scopeId", "data-v-ada663af"]]);
5927
5985
  //#endregion
5928
5986
  //#region src/units/libcellml.ts
5929
- function Cs(e) {
5987
+ function Es(e) {
5930
5988
  let t = [];
5931
5989
  for (let n = 0; n < e.issueCount(); n++) {
5932
5990
  let r = e.issue(n), i = r.level(), a = r.referenceRule();
@@ -5934,14 +5992,14 @@ function Cs(e) {
5934
5992
  message: r.description(),
5935
5993
  level: i.value,
5936
5994
  rule: a?.value ?? -1
5937
- }), ws(i), a && ws(a), r.delete();
5995
+ }), Ds(i), a && Ds(a), r.delete();
5938
5996
  }
5939
5997
  return t;
5940
5998
  }
5941
- function ws(e) {
5999
+ function Ds(e) {
5942
6000
  e.delete?.();
5943
6001
  }
5944
- var Ts = class {
6002
+ var Os = class {
5945
6003
  held = [];
5946
6004
  track(e) {
5947
6005
  return e && this.held.push(e), e;
@@ -5950,16 +6008,16 @@ var Ts = class {
5950
6008
  for (let e of this.held.splice(0).reverse()) e.delete();
5951
6009
  }
5952
6010
  };
5953
- function Es(e) {
6011
+ function ks(e) {
5954
6012
  return Object.keys(e.Units.StandardUnit).filter((e) => /^[A-Z_]+$/.test(e)).map((e) => e.toLowerCase());
5955
6013
  }
5956
6014
  //#endregion
5957
6015
  //#region src/units/messages.ts
5958
- var Ds = /'([^']+)' is (?:in )?'([^']+)'(?: \(i\.e\. '[^']*'\))?/g;
5959
- function Os(e) {
6016
+ var As = /'([^']+)' is (?:in )?'([^']+)'(?: \(i\.e\. '[^']*'\))?/g;
6017
+ function js(e) {
5960
6018
  let t = /^The units in '([^']+)'.* are not equivalent\. (.*)$/s.exec(e), n = /^The unit of '[^']+' in '([^']+)'.* is not dimensionless\. (.*)$/s.exec(e), r = t ?? n;
5961
6019
  if (!r) return null;
5962
- let i = [...r[2].matchAll(Ds)].map(([, e, t]) => ({
6020
+ let i = [...r[2].matchAll(As)].map(([, e, t]) => ({
5963
6021
  text: e,
5964
6022
  units: t
5965
6023
  }));
@@ -5969,27 +6027,27 @@ function Os(e) {
5969
6027
  operands: i
5970
6028
  };
5971
6029
  }
5972
- function ks(e) {
6030
+ function Ms(e) {
5973
6031
  let [t, n] = e.operands;
5974
- return e.kind === "notDimensionless" ? `${t.text} in ${e.expression} must be dimensionless, but is in ${t.units}` : n && t.units === n.units ? `The parts of ${n.text} have different units` : n ? `Units don't match in ${e.expression}: ${As(t)}, ${As(n)}` : `Units don't match in ${e.expression}`;
6032
+ return e.kind === "notDimensionless" ? `${t.text} in ${e.expression} must be dimensionless, but is in ${t.units}` : n && t.units === n.units ? `The parts of ${n.text} have different units` : n ? `Units don't match in ${e.expression}: ${Ns(t)}, ${Ns(n)}` : `Units don't match in ${e.expression}`;
5975
6033
  }
5976
- var As = (e) => e.units === "dimensionless" ? `${e.text} is dimensionless` : `${e.text} is in ${e.units}`, js = /[A-Za-z_][A-Za-z0-9_]*/g, Ms = /\bd(?:\^\d+)?([A-Za-z_][A-Za-z0-9_]*)\/d([A-Za-z_][A-Za-z0-9_]*)(?:\^\d+)?/g, Ns = /(?<![A-Za-z_0-9.])\d+(?:\.\d*)?(?:e[+-]?\d+)?/g;
5977
- function Ps(e, t) {
6034
+ var Ns = (e) => e.units === "dimensionless" ? `${e.text} is dimensionless` : `${e.text} is in ${e.units}`, Ps = /[A-Za-z_][A-Za-z0-9_]*/g, Fs = /\bd(?:\^\d+)?([A-Za-z_][A-Za-z0-9_]*)\/d([A-Za-z_][A-Za-z0-9_]*)(?:\^\d+)?/g, Is = /(?<![A-Za-z_0-9.])\d+(?:\.\d*)?(?:e[+-]?\d+)?/g;
6035
+ function Ls(e, t) {
5978
6036
  let n = /* @__PURE__ */ new Set(), r = (e) => {
5979
6037
  t.includes(e) && n.add(e);
5980
- }, i = e.replace(Ms, (e, n, i) => t.includes(`d${n}`) || t.includes(`d${i}`) ? e : (r(n), r(i), " "));
5981
- for (let [e] of i.replace(Ns, " ").matchAll(js)) r(e);
6038
+ }, i = e.replace(Fs, (e, n, i) => t.includes(`d${n}`) || t.includes(`d${i}`) ? e : (r(n), r(i), " "));
6039
+ for (let [e] of i.replace(Is, " ").matchAll(Ps)) r(e);
5982
6040
  return [...n];
5983
6041
  }
5984
- function Fs(e) {
5985
- return [...e.matchAll(Ns)].map(([e]) => Number(e));
6042
+ function Rs(e) {
6043
+ return [...e.matchAll(Is)].map(([e]) => Number(e));
5986
6044
  }
5987
6045
  //#endregion
5988
6046
  //#region src/units/check.ts
5989
- function Is(e, t) {
6047
+ function zs(e, t) {
5990
6048
  return e.variables.filter((e) => !t[e]);
5991
6049
  }
5992
- var Ls = 500, Rs = class {
6050
+ var Bs = 500, Vs = class {
5993
6051
  lc;
5994
6052
  library;
5995
6053
  cache = /* @__PURE__ */ new Map();
@@ -6006,7 +6064,7 @@ var Ls = 500, Rs = class {
6006
6064
  })) : [];
6007
6065
  }
6008
6066
  prechecked(e, t) {
6009
- let n = Is(e, t).map((e) => ({
6067
+ let n = zs(e, t).map((e) => ({
6010
6068
  message: `${e} has no units`,
6011
6069
  variables: [e]
6012
6070
  })), r = [.../* @__PURE__ */ new Set([...e.variables.map((e) => t[e]), ...e.units])].filter((e) => e && !this.library.isKnown(e)).map((n) => ({
@@ -6020,10 +6078,10 @@ var Ls = 500, Rs = class {
6020
6078
  let n = `${e.mathml}\n${e.variables.map((e) => `${e}:${t[e]}`).join(" ")}`, r = this.cache.get(n);
6021
6079
  if (r) return r;
6022
6080
  let i = this.analyse(e, t);
6023
- return this.cache.size >= Ls && this.cache.delete(this.cache.keys().next().value), this.cache.set(n, i), i;
6081
+ return this.cache.size >= Bs && this.cache.delete(this.cache.keys().next().value), this.cache.set(n, i), i;
6024
6082
  }
6025
6083
  analyse(e, t) {
6026
- let { lc: n } = this, r = new Ts();
6084
+ let { lc: n } = this, r = new Os();
6027
6085
  try {
6028
6086
  let i = r.track(new n.Model());
6029
6087
  i.setName("units_check"), this.library.addTo(i, [...e.variables.map((e) => t[e]), ...e.units], r);
@@ -6036,12 +6094,12 @@ var Ls = 500, Rs = class {
6036
6094
  a.setMath(e.mathml), i.addComponent(a), i.linkUnits();
6037
6095
  let o = r.track(new n.Validator());
6038
6096
  o.validateModel(i);
6039
- let s = Cs(o).filter((e) => e.level === 0);
6040
- if (s.length) return s.map((e) => ({ message: `libCellML: ${Bs(e.message)}` }));
6097
+ let s = Es(o).filter((e) => e.level === 0);
6098
+ if (s.length) return s.map((e) => ({ message: `libCellML: ${Us(e.message)}` }));
6041
6099
  let c = r.track(new n.Analyser());
6042
6100
  c.analyseModel(i);
6043
- let l = Cs(c).filter((e) => e.rule === 112).map((e) => e.message);
6044
- return [...new Set(l)].map((t) => zs(t, e.variables));
6101
+ let l = Es(c).filter((e) => e.rule === 112).map((e) => e.message);
6102
+ return [...new Set(l)].map((t) => Hs(t, e.variables));
6045
6103
  } finally {
6046
6104
  r.dispose();
6047
6105
  }
@@ -6050,36 +6108,36 @@ var Ls = 500, Rs = class {
6050
6108
  this.cache.clear();
6051
6109
  }
6052
6110
  };
6053
- function zs(e, t) {
6054
- let n = Os(e);
6055
- if (!n) return { message: Bs(e) };
6111
+ function Hs(e, t) {
6112
+ let n = js(e);
6113
+ if (!n) return { message: Us(e) };
6056
6114
  let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
6057
6115
  for (let e of n.operands) {
6058
- let n = Ps(e.text, t);
6116
+ let n = Ls(e.text, t);
6059
6117
  for (let e of n) r.add(e);
6060
- if (n.length === 0) for (let t of Fs(e.text)) i.add(t);
6118
+ if (n.length === 0) for (let t of Rs(e.text)) i.add(t);
6061
6119
  }
6062
6120
  return {
6063
- message: ks(n),
6121
+ message: Ms(n),
6064
6122
  ...r.size ? { variables: [...r] } : {},
6065
6123
  ...i.size ? { numbers: [...i] } : {}
6066
6124
  };
6067
6125
  }
6068
- function Bs(e) {
6126
+ function Us(e) {
6069
6127
  return e.replace(/ in component 'equation'/g, "").replace(/ in model 'units_check'/g, "");
6070
6128
  }
6071
6129
  //#endregion
6072
6130
  //#region src/units/library.ts
6073
- var Vs = class e {
6131
+ var Ws = class e {
6074
6132
  lc;
6075
6133
  names;
6076
6134
  sources;
6077
6135
  problems;
6078
6136
  standard;
6079
6137
  defined = /* @__PURE__ */ new Map();
6080
- handles = new Ts();
6138
+ handles = new Os();
6081
6139
  constructor(e, t) {
6082
- this.lc = e, this.standard = new Set(Es(e));
6140
+ this.lc = e, this.standard = new Set(ks(e));
6083
6141
  let n = [], r = [], i = /* @__PURE__ */ new Map();
6084
6142
  for (let e of t) {
6085
6143
  let t = [];
@@ -6135,7 +6193,7 @@ var Vs = class e {
6135
6193
  let n = new this.lc.Parser(!1);
6136
6194
  try {
6137
6195
  let r = this.handles.track(n.parseModel(e.text));
6138
- for (let r of Cs(n)) r.level === 0 && t.push({
6196
+ for (let r of Es(n)) r.level === 0 && t.push({
6139
6197
  source: e.name,
6140
6198
  message: r.message
6141
6199
  });
@@ -6144,21 +6202,21 @@ var Vs = class e {
6144
6202
  n.delete();
6145
6203
  }
6146
6204
  }
6147
- }, Hs = "$libcellml";
6148
- function Us(e) {
6149
- let t = e.libcellml === void 0 ? d(Hs, null) : e.libcellml, r = e.delay ?? 300, i = n(() => x(e.enabled) ?? !0), a = n(() => Ws(t)), o = n(() => t !== null), s = n(() => a.value !== null), c = n(() => s.value ? "ready" : o.value ? "loading" : "unavailable"), l = re(null), u = re([]), f = null, p, m = () => {
6205
+ }, Gs = "$libcellml";
6206
+ function Ks(e) {
6207
+ let t = e.libcellml === void 0 ? d(Gs, null) : e.libcellml, r = e.delay ?? 300, i = n(() => x(e.enabled) ?? !0), a = n(() => qs(t)), o = n(() => t !== null), s = n(() => a.value !== null), c = n(() => s.value ? "ready" : o.value ? "loading" : "unavailable"), l = re(null), u = re([]), f = null, p, m = () => {
6150
6208
  clearTimeout(p), p = void 0, u.value = f && i.value ? f.check(x(e.lines), x(e.variableUnits)) : [];
6151
6209
  }, h = () => {
6152
6210
  f?.dispose(), l.value?.dispose(), f = null, l.value = null;
6153
6211
  }, ee = n(() => {
6154
6212
  let t = x(e.newUnits) ?? [];
6155
- return t.length ? Eo(t) : "";
6213
+ return t.length ? ko(t) : "";
6156
6214
  });
6157
6215
  return ce([a, () => [...x(e.sources), ...ee.value ? [{
6158
- name: vo,
6216
+ name: xo,
6159
6217
  text: ee.value
6160
6218
  }] : []]], ([e, t]) => {
6161
- h(), e && (l.value = Vs.load(e, t), f = new Rs(e, l.value)), m();
6219
+ h(), e && (l.value = Ws.load(e, t), f = new Vs(e, l.value)), m();
6162
6220
  }, { immediate: !0 }), ce(i, () => m()), ce([() => x(e.lines), () => x(e.variableUnits)], () => {
6163
6221
  clearTimeout(p), p = setTimeout(m, r);
6164
6222
  }), g(() => {
@@ -6172,16 +6230,16 @@ function Us(e) {
6172
6230
  files: n(() => l.value?.sources ?? []),
6173
6231
  problems: n(() => l.value?.problems ?? []),
6174
6232
  newUnitsFile: ee,
6175
- unitsNames: n(() => a.value && l.value ? [...Es(a.value), ...l.value.names] : []),
6233
+ unitsNames: n(() => a.value && l.value ? [...ks(a.value), ...l.value.names] : []),
6176
6234
  missing: n(() => {
6177
6235
  let t = x(e.variableUnits);
6178
- return [...new Set(x(e.lines).flatMap((e) => Is(e, t)))];
6236
+ return [...new Set(x(e.lines).flatMap((e) => zs(e, t)))];
6179
6237
  }),
6180
6238
  check: m
6181
6239
  };
6182
6240
  }
6183
- function Ws(e) {
6241
+ function qs(e) {
6184
6242
  return e ? "Parser" in e ? ie(e) : e.status === "ready" && e.library ? ie(e.library) : null : null;
6185
6243
  }
6186
6244
  //#endregion
6187
- export { _o as EquationWorkbench, Hs as LIBCELLML_KEY, Ss as UnitsPanel, Ai as importContentMathML, Us as useUnitsChecker };
6245
+ export { bo as EquationWorkbench, Gs as LIBCELLML_KEY, Ts as UnitsPanel, Ai as importContentMathML, Ks as useUnitsChecker };