@pie-qti/default-components 0.1.20 → 0.1.22

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.
@@ -5035,9 +5035,7 @@ switch (he()) {
5035
5035
  case "windows":
5036
5036
  ge(y), ge(re), ge(ce), ge(ae);
5037
5037
  break;
5038
- case "linux":
5039
- ge(te), ge(ie), ge(le), ge(oe);
5040
- break;
5038
+ case "linux": ge(te), ge(ie), ge(le), ge(oe);
5041
5039
  }
5042
5040
  ge(ee);
5043
5041
  function x(e) {
@@ -6876,9 +6874,7 @@ function Ue(e) {
6876
6874
  case "monospace":
6877
6875
  n = `\\mathtt{${n}}`;
6878
6876
  break;
6879
- case "calligraphic":
6880
- n = `\\mathcal{${n}}`;
6881
- break;
6877
+ case "calligraphic": n = `\\mathcal{${n}}`;
6882
6878
  }
6883
6879
  switch (a) {
6884
6880
  case "bold":
@@ -6887,9 +6883,7 @@ function Ue(e) {
6887
6883
  case "italic":
6888
6884
  n = `\\mathit{${n}}`;
6889
6885
  break;
6890
- case "bolditalic":
6891
- n = `\\mathbfit{${n}}`;
6892
- break;
6886
+ case "bolditalic": n = `\\mathbfit{${n}}`;
6893
6887
  }
6894
6888
  return n;
6895
6889
  }
@@ -16978,7 +16972,7 @@ function Xo(e) {
16978
16972
  let t = e.charCodeAt(n + 1);
16979
16973
  if (t >= 56320 && t <= 57343) {
16980
16974
  let e = r - 55296, i = t - 56320;
16981
- r = 2 ** 16 + e * 2 ** 10 + i, n++;
16975
+ r = 2 ** 16 + e * 1024 + i, n++;
16982
16976
  }
16983
16977
  }
16984
16978
  t.push(r);
@@ -17055,7 +17049,8 @@ var is = class {
17055
17049
  if (e) return String.fromCodePoint(Number.parseInt(e.slice(e.lastIndexOf("^") + 1), 16));
17056
17050
  }
17057
17051
  return e;
17058
- } else if (e === "#") {
17052
+ }
17053
+ if (e === "#") {
17059
17054
  if (!this.end()) {
17060
17055
  let e = !1;
17061
17056
  if (/[\d?@]/.test(this.peek()) && (e = !0, this.pos + 1 < this.s.length)) {
@@ -17077,23 +17072,29 @@ function as(e, t) {
17077
17072
  else if (r === "\\bgroup") n.push("<{>");
17078
17073
  else if (r === "\\egroup") n.push("<}>");
17079
17074
  else if (r === "\\string") {
17080
- if (r = e.next(), r) if (r.startsWith("\\")) for (let e of r) n.push(e === "\\" ? "\\backslash" : e);
17081
- else r === "<{>" ? n.push("\\{") : r === "<space>" ? n.push("~") : r === "<}>" && n.push("\\}");
17075
+ if (r = e.next(), r) {
17076
+ if (r.startsWith("\\")) for (let e of r) n.push(e === "\\" ? "\\backslash" : e);
17077
+ else r === "<{>" ? n.push("\\{") : r === "<space>" ? n.push("~") : r === "<}>" && n.push("\\}");
17078
+ }
17082
17079
  } else if (r === "\\csname") {
17083
17080
  for (; e.peek() === "<space>";) e.next();
17084
17081
  let i = "", a = !1, o = [];
17085
17082
  do {
17086
- if (o.length === 0) if (/^#[\d?@]$/.test(e.peek())) {
17087
- let n = e.get().slice(1);
17088
- o = os(t?.(n) ?? t?.("?") ?? "\\placeholder{}", t), r = o[0];
17089
- } else r = e.next(), o = r ? [r] : [];
17083
+ if (o.length === 0) {
17084
+ if (/^#[\d?@]$/.test(e.peek())) {
17085
+ let n = e.get().slice(1);
17086
+ o = os(t?.(n) ?? t?.("?") ?? "\\placeholder{}", t), r = o[0];
17087
+ } else r = e.next(), o = r ? [r] : [];
17088
+ }
17090
17089
  a = o.length === 0, !a && r === "\\endcsname" && (a = !0, o.shift()), a || (a = r === "<$>" || r === "<$$>" || r === "<{>" || r === "<}>" || typeof r == "string" && r.length > 1 && r.startsWith("\\")), a || (i += o.shift());
17091
17090
  } while (!a);
17092
17091
  i && n.push("\\" + i), n.push(...o);
17093
- } else if (r !== "\\endcsname") if (r.length > 1 && r.startsWith("#")) {
17094
- let e = r.slice(1);
17095
- n.push(...os(t?.(e) ?? t?.("?") ?? "\\placeholder{}", t));
17096
- } else n.push(r);
17092
+ } else if (r !== "\\endcsname") {
17093
+ if (r.length > 1 && r.startsWith("#")) {
17094
+ let e = r.slice(1);
17095
+ n.push(...os(t?.(e) ?? t?.("?") ?? "\\placeholder{}", t));
17096
+ } else n.push(r);
17097
+ }
17097
17098
  }
17098
17099
  return n;
17099
17100
  }
@@ -17347,11 +17348,13 @@ var M = class e {
17347
17348
  let e = t.match(/([^=]+)=(.+$)/);
17348
17349
  if (e) {
17349
17350
  let t = Es(e[1]);
17350
- if (t) if (t === "href") {
17351
- let t = new URL(e[2]);
17352
- if (t.protocol !== "http:" && t.protocol !== "https:") throw Error(`Invalid URL: ${e[2]}`);
17353
- n.push(`href="${e[2].replace(/"/g, "&quot;")}"`);
17354
- } else n.push(`data-${t}=${Ds(e[2])}`);
17351
+ if (t) {
17352
+ if (t === "href") {
17353
+ let t = new URL(e[2]);
17354
+ if (t.protocol !== "http:" && t.protocol !== "https:") throw Error(`Invalid URL: ${e[2]}`);
17355
+ n.push(`href="${e[2].replace(/"/g, "&quot;")}"`);
17356
+ } else n.push(`data-${t}=${Ds(e[2])}`);
17357
+ }
17355
17358
  } else {
17356
17359
  let e = Es(t);
17357
17360
  e && n.push(`data-${e} `);
@@ -17440,7 +17443,7 @@ function ws(e, t) {
17440
17443
  return;
17441
17444
  }
17442
17445
  if (e.value) {
17443
- e.height = -Infinity, e.depth = -Infinity, e._width = 0, e.skew = -Infinity, e.italic = -Infinity;
17446
+ e.height = -1 / 0, e.depth = -1 / 0, e._width = 0, e.skew = -1 / 0, e.italic = -1 / 0;
17444
17447
  for (let n = 0; n < e.value.length; n++) {
17445
17448
  let r = Wo(e.value.codePointAt(n), t);
17446
17449
  e.height = Math.max(e.height, r.height), e.depth = Math.max(e.depth, r.depth), e._width += r.width, e.skew = r.skew, e.italic = r.italic;
@@ -17448,7 +17451,7 @@ function ws(e, t) {
17448
17451
  return;
17449
17452
  }
17450
17453
  if (e.children && e.children.length > 0) {
17451
- let t = -Infinity, n = -Infinity, r = 0;
17454
+ let t = -1 / 0, n = -1 / 0, r = 0;
17452
17455
  for (let i of e.children) i.height > t && (t = i.height), i.depth > n && (n = i.depth), r = Math.max(r, i.maxFontSize ?? 0);
17453
17456
  e.height = t, e.depth = n, e._width = e.children.reduce((e, t) => e + t.width, 0), e.maxFontSize = r;
17454
17457
  }
@@ -17488,17 +17491,17 @@ function Os(e) {
17488
17491
  let t = e.top;
17489
17492
  for (let n of e.children) t -= typeof n == "number" ? n : n.box.height + n.box.depth;
17490
17493
  return [e.children, t];
17491
- } else {
17492
- if ("bottom" in e) return [e.children, -e.bottom];
17493
- if ("firstBaseline" in e) {
17494
- let t = e.firstBaseline[0];
17495
- if (typeof t == "number") throw Error("First child must be an element.");
17496
- return [e.firstBaseline, -t.box.depth];
17497
- } else if ("shift" in e) {
17498
- let t = e.children[0];
17499
- if (typeof t == "number") throw Error("First child must be an element.");
17500
- return [e.children, -t.box.depth - e.shift];
17501
- }
17494
+ }
17495
+ if ("bottom" in e) return [e.children, -e.bottom];
17496
+ if ("firstBaseline" in e) {
17497
+ let t = e.firstBaseline[0];
17498
+ if (typeof t == "number") throw Error("First child must be an element.");
17499
+ return [e.firstBaseline, -t.box.depth];
17500
+ }
17501
+ if ("shift" in e) {
17502
+ let t = e.children[0];
17503
+ if (typeof t == "number") throw Error("First child must be an element.");
17504
+ return [e.children, -t.box.depth - e.shift];
17502
17505
  }
17503
17506
  return [null, 0];
17504
17507
  }
@@ -17750,11 +17753,13 @@ function Ks(e) {
17750
17753
  var t;
17751
17754
  if (e == null) return null;
17752
17755
  let n = "";
17753
- if ("dimension" in e && (n = `${e.dimension}${e.unit ?? "pt"}`), "glue" in e && (n = Gs(e)), "number" in e) if (!("base" in e) || e.base === "decimal") n = Number(e.number).toString();
17754
- else if (e.base === "alpha") n = `\`${String.fromCodePoint(e.number)}`;
17755
- else {
17756
- let t = Math.round(e.number) >>> 0;
17757
- e.base === "hexadecimal" ? (n = Number(t).toString(16).toUpperCase(), n = t <= 255 ? n.padStart(2, "0") : t <= 65535 ? n.padStart(4, "0") : t <= 16777215 ? n.padStart(6, "0") : n.padStart(8, "0"), n = `"${n}`) : e.base === "octal" && (n = Number(t).toString(8), n = t <= 63 ? n.padStart(2, "0") : t <= 30583 ? n.padStart(4, "0") : n.padStart(8, "0"), n = `'${n}`);
17756
+ if ("dimension" in e && (n = `${e.dimension}${e.unit ?? "pt"}`), "glue" in e && (n = Gs(e)), "number" in e) {
17757
+ if (!("base" in e) || e.base === "decimal") n = Number(e.number).toString();
17758
+ else if (e.base === "alpha") n = `\`${String.fromCodePoint(e.number)}`;
17759
+ else {
17760
+ let t = Math.round(e.number) >>> 0;
17761
+ e.base === "hexadecimal" ? (n = Number(t).toString(16).toUpperCase(), n = t <= 255 ? n.padStart(2, "0") : t <= 65535 ? n.padStart(4, "0") : t <= 16777215 ? n.padStart(6, "0") : n.padStart(8, "0"), n = `"${n}`) : e.base === "octal" && (n = Number(t).toString(8), n = t <= 63 ? n.padStart(2, "0") : t <= 30583 ? n.padStart(4, "0") : n.padStart(8, "0"), n = `'${n}`);
17762
+ }
17758
17763
  }
17759
17764
  return "register" in e && ("factor" in e && (e.factor === -1 ? n = "-" : e.factor !== 1 && (n = Number(e.factor).toString())), "global" in e && e.global && (n += "\\global"), n += `\\${e.register}`), "string" in e && (n = e.string), (t = e.relax) != null && t && (n += "\\relax"), n;
17760
17765
  }
@@ -17953,7 +17958,7 @@ function Xs() {
17953
17958
  var P = class e {
17954
17959
  constructor(t, n) {
17955
17960
  let r;
17956
- t != null && t.parent ? (this.parent = t.parent, r = t.parent, this.registers = {}) : (r = s(s({}, Xs()), t?.from ?? {}), this.registers = r.registers), r.atomIdsSettings && (this.atomIdsSettings = s({}, r.atomIdsSettings)), this.renderPlaceholder = r.renderPlaceholder, this.isPhantom = t?.isPhantom ?? this.parent?.isPhantom ?? !1, this.letterShapeStyle = r.letterShapeStyle, this.minFontScale = r.minFontScale, this.maxMatrixCols = r.maxMatrixCols, n != null && n.color && n.color !== "none" ? this.color = n.color : this.color = this.parent?.color ?? "", n != null && n.backgroundColor && n.backgroundColor !== "none" ? this.backgroundColor = n.backgroundColor : this.backgroundColor = this.parent?.backgroundColor ?? "", n != null && n.fontSize && n.fontSize !== "auto" && n.fontSize !== this.parent?.size ? this.size = n.fontSize : this.size = this.parent?.size ?? Ho;
17961
+ t != null && t.parent ? (this.parent = t.parent, r = t.parent, this.registers = {}) : (r = s(s({}, Xs()), t?.from ?? {}), this.registers = r.registers), r.atomIdsSettings && (this.atomIdsSettings = s({}, r.atomIdsSettings)), this.renderPlaceholder = r.renderPlaceholder, this.isPhantom = t?.isPhantom ?? this.parent?.isPhantom ?? !1, this.letterShapeStyle = r.letterShapeStyle, this.minFontScale = r.minFontScale, this.maxMatrixCols = r.maxMatrixCols, this.color = n != null && n.color && n.color !== "none" ? n.color : this.parent?.color ?? "", this.backgroundColor = n != null && n.backgroundColor && n.backgroundColor !== "none" ? n.backgroundColor : this.parent?.backgroundColor ?? "", this.size = n != null && n.fontSize && n.fontSize !== "auto" && n.fontSize !== this.parent?.size ? n.fontSize : this.parent?.size ?? Ho;
17957
17962
  let i = this.parent?.mathstyle ?? Vs.displaystyle;
17958
17963
  if (typeof t?.mathstyle == "string") {
17959
17964
  if (r instanceof e) switch (t.mathstyle) {
@@ -17983,11 +17988,7 @@ var P = class e {
17983
17988
  case "scriptstyle":
17984
17989
  i = Vs.scriptstyle;
17985
17990
  break;
17986
- case "scriptscriptstyle":
17987
- i = Vs.scriptscriptstyle;
17988
- break;
17989
- case "":
17990
- case "auto": break;
17991
+ case "scriptscriptstyle": i = Vs.scriptscriptstyle;
17991
17992
  }
17992
17993
  }
17993
17994
  this.mathstyle = i, this.smartFence = r.smartFence, this.placeholderSymbol = r.placeholderSymbol, this.colorMap = r.colorMap ?? ((e) => e), this.backgroundColorMap = r.backgroundColorMap ?? ((e) => e), this.getMacro = r.getMacro, this.parent !== void 0 || this.registers;
@@ -18283,7 +18284,7 @@ var F = class e {
18283
18284
  }
18284
18285
  hasEmptyBranch(e) {
18285
18286
  let t = this.branch(e);
18286
- return t ? (t.length, t[0].type, t.length === 1) : !0;
18287
+ return !t || (t.length, t[0].type, t.length === 1);
18287
18288
  }
18288
18289
  setChildren(e, t) {
18289
18290
  if (!e || (Qs(t), !Qs(t))) return;
@@ -18487,7 +18488,7 @@ var F = class e {
18487
18488
  return t.isTight && (o.isTight = !0), (this.mode !== "math" || this.style.variant === "main") && (o.italic = 0), o.right = o.italic, this.bind(t, o), this.caret && !this.superscript && !this.subscript && (o.caret = this.caret), o;
18488
18489
  }
18489
18490
  isDigit() {
18490
- return this.type === "mord" && this.value ? /^[\d,\.]$/.test(this.value) : this.type === "group" && this.body?.length === 2 ? this.body[0].type === "first" && this.body[1].value === "," : !1;
18491
+ return this.type === "mord" && this.value ? /^[\d,\.]$/.test(this.value) : this.type === "group" && this.body?.length === 2 && this.body[0].type === "first" && this.body[1].value === ",";
18491
18492
  }
18492
18493
  asDigit() {
18493
18494
  return this.type === "mord" && this.value && /^[\d,\.]$/.test(this.value) ? this.value : this.type === "group" && this.body?.length === 2 && this.body[0].type === "first" && this.body[1].value === "," ? "." : "";
@@ -18568,7 +18569,7 @@ function oc(e, t) {
18568
18569
  return e[0] === t[0] && e[1] === t[1] ? "equal" : "different";
18569
18570
  }
18570
18571
  function sc(e) {
18571
- let t = Infinity, n = -Infinity;
18572
+ let t = 1 / 0, n = -1 / 0;
18572
18573
  for (let r of e.ranges) t = Math.min(t, r[0], r[1]), n = Math.max(n, r[0], r[1]);
18573
18574
  return [t, n];
18574
18575
  }
@@ -20040,7 +20041,7 @@ function Rc(e, t) {
20040
20041
  return e.model.selection.ranges.reduce((n, r) => n.concat(...Lc(e, r, t)), []);
20041
20042
  }
20042
20043
  function zc(e, t) {
20043
- return e === "*" || t === "none" ? !0 : t === "same-origin" ? !window.origin || e === window.origin : typeof t == "function" ? t(e) : !1;
20044
+ return e === "*" || t === "none" ? !0 : t === "same-origin" ? !window.origin || e === window.origin : typeof t == "function" && t(e);
20044
20045
  }
20045
20046
  function Bc(e) {
20046
20047
  let t = 0, n = 0, r = e.offsetWidth, i = e.offsetHeight;
@@ -20111,10 +20112,7 @@ function Qc(e) {
20111
20112
  case "ui":
20112
20113
  t = Yc;
20113
20114
  break;
20114
- case "menu":
20115
- t = Xc;
20116
- break;
20117
- default:
20115
+ case "menu": t = Xc;
20118
20116
  }
20119
20117
  return t;
20120
20118
  }
@@ -20288,23 +20286,23 @@ function ll(e, t, n, r, i) {
20288
20286
  }
20289
20287
  let y = p + _ + ee, te = Math.max(0, Math.ceil((t - y) / (v * h))), ne = y + te * v * h, re = Lo;
20290
20288
  n && (re *= r.scalingFactor);
20291
- let ie = ne / 2 - re, b = .008, ae = [];
20292
- ae.push({ box: new M(u, { fontFamily: d }) }), ae.push(-b);
20293
- let oe = new M(l, { fontFamily: d });
20294
- if (o === null) for (let e = 0; e < te; e++) ae.push({ box: oe });
20289
+ let ie = ne / 2 - re, b = [];
20290
+ b.push({ box: new M(u, { fontFamily: d }) }), b.push(-.008);
20291
+ let ae = new M(l, { fontFamily: d });
20292
+ if (o === null) for (let e = 0; e < te; e++) b.push({ box: ae });
20295
20293
  else {
20296
- for (let e = 0; e < te; e++) ae.push({ box: oe });
20297
- ae.push(-b), ae.push({ box: new M(o, { fontFamily: d }) }), ae.push(-b);
20298
- for (let e = 0; e < te; e++) ae.push({ box: oe });
20294
+ for (let e = 0; e < te; e++) b.push({ box: ae });
20295
+ b.push(-.008), b.push({ box: new M(o, { fontFamily: d }) }), b.push(-.008);
20296
+ for (let e = 0; e < te; e++) b.push({ box: ae });
20299
20297
  }
20300
- ae.push(-b), ae.push({ box: new M(a, { fontFamily: d }) });
20301
- let se = "";
20302
- return d === "Size1-Regular" ? se = " delim-size1" : d === "Size4-Regular" && (se = " delim-size4"), new M(new N({
20298
+ b.push(-.008), b.push({ box: new M(a, { fontFamily: d }) });
20299
+ let oe = "";
20300
+ return d === "Size1-Regular" ? oe = " delim-size1" : d === "Size4-Regular" && (oe = " delim-size4"), new M(new N({
20303
20301
  bottom: ie,
20304
- children: ae
20305
- }, { classes: se }), c(s({}, i ?? {}), { classes: (i?.classes ?? "") + " ML__delim-mult" }));
20302
+ children: b
20303
+ }, { classes: oe }), c(s({}, i ?? {}), { classes: (i?.classes ?? "") + " ML__delim-mult" }));
20306
20304
  }
20307
- var ul = new Set([
20305
+ var ul = /* @__PURE__ */ new Set([
20308
20306
  "(",
20309
20307
  ")",
20310
20308
  "\\lparen",
@@ -20326,7 +20324,7 @@ var ul = new Set([
20326
20324
  "⌋",
20327
20325
  "⌈",
20328
20326
  "⌉"
20329
- ]), dl = new Set([
20327
+ ]), dl = /* @__PURE__ */ new Set([
20330
20328
  "\\uparrow",
20331
20329
  "\\downarrow",
20332
20330
  "\\updownarrow",
@@ -20351,7 +20349,7 @@ var ul = new Set([
20351
20349
  "⟯",
20352
20350
  "⎰",
20353
20351
  "⎱"
20354
- ]), fl = new Set([
20352
+ ]), fl = /* @__PURE__ */ new Set([
20355
20353
  "<",
20356
20354
  ">",
20357
20355
  "\\langle",
@@ -20650,7 +20648,7 @@ var L = class e extends F {
20650
20648
  { align: "l" },
20651
20649
  { align: "l" }
20652
20650
  ];
20653
- this.minColumns = r.minColumns ?? 1, this.minRows = r.minRows ?? 1, this.maxRows = r.maxRows ?? Infinity, this._rows = Ml(this, t, {
20651
+ this.minColumns = r.minColumns ?? 1, this.minRows = r.minRows ?? 1, this.maxRows = r.maxRows ?? 1 / 0, this._rows = Ml(this, t, {
20654
20652
  columns: this.colFormat,
20655
20653
  minColumns: this.minColumns,
20656
20654
  minRows: this.minRows,
@@ -21062,7 +21060,7 @@ var Kl = class e extends F {
21062
21060
  type: "macro",
21063
21061
  command: e,
21064
21062
  style: t.style
21065
- }), this.body = t.body, t.captureSelection === void 0 ? t.args ? this.captureSelection = !1 : this.captureSelection = !0 : this.captureSelection = t.captureSelection, this.macroArgs = t.args, this.expand = t.expand ?? !1;
21063
+ }), this.body = t.body, this.captureSelection = t.captureSelection === void 0 ? !t.args : t.captureSelection, this.macroArgs = t.args, this.expand = t.expand ?? !1;
21066
21064
  }
21067
21065
  static fromJson(t) {
21068
21066
  return new e(t.command, t);
@@ -21276,7 +21274,7 @@ var Zl = class {
21276
21274
  e && this.tokens.splice(this.index, 1, ...os(e));
21277
21275
  }
21278
21276
  match(e) {
21279
- return this.tokens[this.index] === e ? (this.index++, !0) : !1;
21277
+ return this.tokens[this.index] === e && (this.index++, !0);
21280
21278
  }
21281
21279
  lastSubsupAtom() {
21282
21280
  let e;
@@ -21348,7 +21346,7 @@ var Zl = class {
21348
21346
  let e = "", t = this.end(), n = 1;
21349
21347
  for (; !t;) {
21350
21348
  let r = this.get();
21351
- r === "<space>" ? e += " " : r === "<{>" ? (e += "{", n += 1) : r === "<}>" ? (--n, n > 0 ? e += "}" : --this.index) : r === "<$>" ? e += "$" : r === "<$$>" ? e += "$$" : e += r, t = n === 0 || this.end();
21349
+ r === "<space>" ? e += " " : r === "<{>" ? (e += "{", n += 1) : r === "<}>" ? (--n, n > 0 ? e += "}" : --this.index) : e += r === "<$>" ? "$" : r === "<$$>" ? "$$" : r, t = n === 0 || this.end();
21352
21350
  }
21353
21351
  return e;
21354
21352
  }
@@ -21465,7 +21463,7 @@ var Zl = class {
21465
21463
  scanColspec() {
21466
21464
  this.skipWhitespace();
21467
21465
  let e = [];
21468
- for (; !this.end() && !(this.peek() === "<}>" || this.peek() === "]");) {
21466
+ for (; !this.end() && this.peek() !== "<}>" && this.peek() !== "]";) {
21469
21467
  let t = this.get();
21470
21468
  t === "c" || t === "r" || t === "l" ? e.push({ align: t }) : t === "|" ? e.push({ separator: "solid" }) : t === ":" ? e.push({ separator: "dashed" }) : t === "@" && (this.match("<{>") && (this.beginContext({ mode: "math" }), e.push({ gap: this.scan((e) => e === "<}>") }), this.endContext()), this.match("<}>") || this.onError({ code: "unbalanced-braces" }));
21471
21469
  }
@@ -21521,19 +21519,21 @@ var Zl = class {
21521
21519
  }), o = !0), !o && this.match("\\end") && (this.scanArgument("string") !== e && this.onError({
21522
21520
  code: "unbalanced-environment",
21523
21521
  arg: e
21524
- }), o = !0), !o) if (this.matchColumnSeparator()) a.push(this.mathlist), this.mathlist = [];
21525
- else if (this.matchRowSeparator()) {
21526
- a.push(this.mathlist), this.mathlist = [];
21527
- let e = null;
21528
- this.skipWhitespace(), this.match("[") && (e = this.scanDimen(), this.skipWhitespace(), this.match("]")), i.push(e ?? { dimension: 0 }), r.push(a), a = [];
21529
- } else this.mathlist.push(...this.scan((e) => [
21530
- "<}>",
21531
- "&",
21532
- "\\end",
21533
- "\\cr",
21534
- "\\\\",
21535
- "\\tabularnewline"
21536
- ].includes(e)));
21522
+ }), o = !0), !o) {
21523
+ if (this.matchColumnSeparator()) a.push(this.mathlist), this.mathlist = [];
21524
+ else if (this.matchRowSeparator()) {
21525
+ a.push(this.mathlist), this.mathlist = [];
21526
+ let e = null;
21527
+ this.skipWhitespace(), this.match("[") && (e = this.scanDimen(), this.skipWhitespace(), this.match("]")), i.push(e ?? { dimension: 0 }), r.push(a), a = [];
21528
+ } else this.mathlist.push(...this.scan((e) => [
21529
+ "<}>",
21530
+ "&",
21531
+ "\\end",
21532
+ "\\cr",
21533
+ "\\\\",
21534
+ "\\tabularnewline"
21535
+ ].includes(e)));
21536
+ }
21537
21537
  while (!o);
21538
21538
  return a.push(this.mathlist), a.length > 0 && r.push(a), this.endContext(), t.rootOnly && (this.index = this.tokens.length), t.createAtom(e, r, i, n, this.context.maxMatrixCols);
21539
21539
  }
@@ -21637,7 +21637,7 @@ var Zl = class {
21637
21637
  let e = this.match("\\limits"), t = !e && this.match("\\nolimits"), n = !t && !e && this.match("\\displaylimits");
21638
21638
  if (!e && !t && !n) return !1;
21639
21639
  let r = this.mathlist.length > 0 ? this.mathlist[this.mathlist.length - 1] : null;
21640
- return r === null ? !1 : (r.explicitSubsupPlacement = !0, e && (r.subsupPlacement = "over-under"), t && (r.subsupPlacement = "adjacent"), n && (r.subsupPlacement = "auto"), !0);
21640
+ return r !== null && (r.explicitSubsupPlacement = !0, e && (r.subsupPlacement = "over-under"), t && (r.subsupPlacement = "adjacent"), n && (r.subsupPlacement = "auto"), !0);
21641
21641
  }
21642
21642
  scanArguments(e) {
21643
21643
  if (!(e != null && e.params)) return [void 0, []];
@@ -22001,8 +22001,10 @@ var z = {
22001
22001
  }
22002
22002
  },
22003
22003
  concatArray: function(e, t) {
22004
- if (t) if (Object.prototype.toString.call(t) === "[object Array]") for (var n = 0; n < t.length; n++) e.push(t[n]);
22005
- else e.push(t);
22004
+ if (t) {
22005
+ if (Object.prototype.toString.call(t) === "[object Array]") for (var n = 0; n < t.length; n++) e.push(t[n]);
22006
+ else e.push(t);
22007
+ }
22006
22008
  },
22007
22009
  patterns: {
22008
22010
  patterns: {
@@ -22223,7 +22225,8 @@ var z = {
22223
22225
  match_: l ? g.join("") : g,
22224
22226
  remainder: h.remainder
22225
22227
  };
22226
- } else return {
22228
+ }
22229
+ return {
22227
22230
  match_: m,
22228
22231
  remainder: e.substr(p.endMatchEnd)
22229
22232
  };
@@ -22969,7 +22972,8 @@ z.stateMachines = {
22969
22972
  if (e.beginsWithBond) {
22970
22973
  var n = [];
22971
22974
  return z.concatArray(n, this.output(e)), z.concatArray(n, z.actions.bond(e, t, "-")), n;
22972
- } else e.d = t;
22975
+ }
22976
+ e.d = t;
22973
22977
  },
22974
22978
  "- after o/d": function(e, t, n) {
22975
22979
  var r = z.patterns.match_("orbital", e.o || ""), i = z.patterns.match_("one lowercase greek letter $", e.o || ""), a = z.patterns.match_("one lowercase latin letter $", e.o || ""), o = z.patterns.match_("$one lowercase latin letter$ $", e.o || ""), s = t === "-" && (r && r.remainder === "" || i || a || o);
@@ -25239,10 +25243,7 @@ E([
25239
25243
  case "\\tbinom":
25240
25244
  t.hasBarLine = !1, t.leftDelim = "(", t.rightDelim = ")";
25241
25245
  break;
25242
- case "\\cfrac":
25243
- t.hasBarLine = !0, t.continuousFraction = !0;
25244
- break;
25245
- default:
25246
+ case "\\cfrac": t.hasBarLine = !0, t.continuousFraction = !0;
25246
25247
  }
25247
25248
  switch (n) {
25248
25249
  case "\\dfrac":
@@ -25250,10 +25251,7 @@ E([
25250
25251
  t.mathstyleName = "displaystyle";
25251
25252
  break;
25252
25253
  case "\\tfrac":
25253
- case "\\tbinom":
25254
- t.mathstyleName = "textstyle";
25255
- break;
25256
- default:
25254
+ case "\\tbinom": t.mathstyleName = "textstyle";
25257
25255
  }
25258
25256
  return new uu(r[0] ? w(r[0]) : [new Cl()], r[1] ? w(r[1]) : [new Cl()], t);
25259
25257
  },
@@ -27376,11 +27374,11 @@ function rd(e) {
27376
27374
  return (e instanceof MouseEvent || e instanceof PointerEvent || typeof TouchEvent < "u" && e instanceof TouchEvent || e instanceof KeyboardEvent) && (e.altKey && (t.alt = !0), e.ctrlKey && (t.control = !0), e.metaKey && (t.meta = !0), e.shiftKey && (t.shift = !0)), t;
27377
27375
  }
27378
27376
  function id(e, t) {
27379
- return !e && t || e && !t ? !1 : !e || !t ? !0 : e.alt === t.alt && e.control === t.control && e.shift === t.shift && e.meta === t.meta;
27377
+ return !e && t || e && !t ? !1 : !e || !t || e.alt === t.alt && e.control === t.control && e.shift === t.shift && e.meta === t.meta;
27380
27378
  }
27381
- var ad = new Set(/* @__PURE__ */ "Backquote.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Minus.Equal.IntlYen.KeyQ.KeyW.KeyE.KeyR.KeyT.KeyY.KeyU.KeyI.KeyO.KeyP.BracketLeft.BracketRight.Backslash.KeyA.KeyS.KeyD.KeyF.KeyG.KeyH.KeyJ.KeyK.KeyL.Semicolon.Quote.IntlBackslash.KeyZ.KeyX.KeyC.KeyV.KeyB.KeyN.KeyM.Comma.Period.Slash.IntlRo.Space.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEqual.NumpadHash.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadStar.NumpadSubstract".split("."));
27379
+ var ad = /* @__PURE__ */ new Set(/* @__PURE__ */ "Backquote.Digit0.Digit1.Digit2.Digit3.Digit4.Digit5.Digit6.Digit7.Digit8.Digit9.Minus.Equal.IntlYen.KeyQ.KeyW.KeyE.KeyR.KeyT.KeyY.KeyU.KeyI.KeyO.KeyP.BracketLeft.BracketRight.Backslash.KeyA.KeyS.KeyD.KeyF.KeyG.KeyH.KeyJ.KeyK.KeyL.Semicolon.Quote.IntlBackslash.KeyZ.KeyX.KeyC.KeyV.KeyB.KeyN.KeyM.Comma.Period.Slash.IntlRo.Space.Numpad0.Numpad1.Numpad2.Numpad3.Numpad4.Numpad5.Numpad6.Numpad7.Numpad8.Numpad9.NumpadAdd.NumpadComma.NumpadDecimal.NumpadDivide.NumpadEqual.NumpadHash.NumpadMultiply.NumpadParenLeft.NumpadParenRight.NumpadStar.NumpadSubstract".split("."));
27382
27380
  function od(e) {
27383
- return e.ctrlKey || e.metaKey || ["Dead", "Process"].includes(e.key) ? !1 : e.code === "" ? !0 : ad.has(e.code);
27381
+ return e.ctrlKey || e.metaKey || ["Dead", "Process"].includes(e.key) ? !1 : e.code === "" || ad.has(e.code);
27384
27382
  }
27385
27383
  function sd() {
27386
27384
  var e;
@@ -27564,7 +27562,7 @@ function fd(e) {
27564
27562
  let t = h(), n = e.startsWith("!"), r = e.endsWith(t);
27565
27563
  if (n && !r || !n && r) return !0;
27566
27564
  }
27567
- return e === "!other" ? !1 : e === "other";
27565
+ return e !== "!other" && e === "other";
27568
27566
  }
27569
27567
  function pd(e, t, n) {
27570
27568
  if (e.length === 0) return "";
@@ -28278,7 +28276,7 @@ function mf(e) {
28278
28276
  }
28279
28277
  var hf = "mathlive#virtual-keyboard-message";
28280
28278
  function gf(e) {
28281
- return e.type === "message" ? e.data?.type === hf : !1;
28279
+ return e.type === "message" && e.data?.type === hf;
28282
28280
  }
28283
28281
  var _f = class e {
28284
28282
  constructor() {
@@ -28356,7 +28354,7 @@ var _f = class e {
28356
28354
  this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].has(t) || this.listeners[e].add(t);
28357
28355
  }
28358
28356
  dispatchEvent(e) {
28359
- return !this.listeners[e.type] || this.listeners[e.type].size === 0 ? !0 : (this.listeners[e.type].forEach((t) => {
28357
+ return !this.listeners[e.type] || this.listeners[e.type].size === 0 || (this.listeners[e.type].forEach((t) => {
28360
28358
  typeof t == "function" ? t(e) : t?.handleEvent(e);
28361
28359
  }), !e.defaultPrevented);
28362
28360
  }
@@ -30758,7 +30756,7 @@ var rp = class e {
30758
30756
  this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set()), this.listeners[e].has(t) || this.listeners[e].add(t);
30759
30757
  }
30760
30758
  dispatchEvent(e) {
30761
- return !this.listeners[e.type] || this.listeners[e.type].size === 0 ? !0 : (this.listeners[e.type].forEach((t) => {
30759
+ return !this.listeners[e.type] || this.listeners[e.type].size === 0 || (this.listeners[e.type].forEach((t) => {
30762
30760
  typeof t == "function" ? t(e) : t?.handleEvent(e);
30763
30761
  }), !e.defaultPrevented);
30764
30762
  }
@@ -31031,7 +31029,7 @@ function op(e) {
31031
31029
  t.mathVirtualKeyboardPolicy = i;
31032
31030
  break;
31033
31031
  case "letterShapeStyle":
31034
- e.letterShapeStyle === "auto" ? S.locale.startsWith("fr") ? t.letterShapeStyle = "french" : t.letterShapeStyle = "tex" : t.letterShapeStyle = e.letterShapeStyle;
31032
+ t.letterShapeStyle = e.letterShapeStyle === "auto" ? S.locale.startsWith("fr") ? "french" : "tex" : e.letterShapeStyle;
31035
31033
  break;
31036
31034
  case "defaultMode":
31037
31035
  [
@@ -31043,7 +31041,7 @@ function op(e) {
31043
31041
  case "macros":
31044
31042
  t.macros = dt(e.macros);
31045
31043
  break;
31046
- default: x(e[n]) ? t[n] = [...e[n]] : typeof e[n] == "object" && !(e[n] instanceof Element) && n !== "computeEngine" ? t[n] = s({}, e[n]) : t[n] = e[n];
31044
+ default: t[n] = x(e[n]) ? [...e[n]] : typeof e[n] == "object" && !(e[n] instanceof Element) && n !== "computeEngine" ? s({}, e[n]) : e[n];
31047
31045
  }
31048
31046
  return t;
31049
31047
  }
@@ -31051,7 +31049,7 @@ function sp(e, t) {
31051
31049
  let n;
31052
31050
  n = typeof t == "string" ? [t] : t === void 0 ? Object.keys(e) : t;
31053
31051
  let r = {};
31054
- for (let t of n) e[t] === null ? r[t] = null : x(e[t]) ? r[t] = [...e[t]] : typeof e[t] == "object" && !(e[t] instanceof Element) && t !== "computeEngine" ? r[t] = s({}, e[t]) : r[t] = e[t];
31052
+ for (let t of n) r[t] = e[t] === null ? null : x(e[t]) ? [...e[t]] : typeof e[t] == "object" && !(e[t] instanceof Element) && t !== "computeEngine" ? s({}, e[t]) : e[t];
31055
31053
  return typeof t == "string" ? r[t] : r;
31056
31054
  }
31057
31055
  function cp() {
@@ -31068,7 +31066,7 @@ function cp() {
31068
31066
  smartMode: !1,
31069
31067
  smartFence: !0,
31070
31068
  smartSuperscript: !0,
31071
- scriptDepth: [Infinity, Infinity],
31069
+ scriptDepth: [1 / 0, 1 / 0],
31072
31070
  removeExtraneousParentheses: !0,
31073
31071
  isImplicitFunction: (e) => (/* @__PURE__ */ "\\sin.\\cos.\\tan.\\arcsin.\\arccos.\\arctan.\\arcsec.\\arccsc.\\arsinh.\\arcosh.\\artanh.\\arcsech.\\arccsch.\\arg.\\ch.\\cosec.\\cosh.\\cot.\\cotg.\\coth.\\csc.\\ctg.\\cth.\\sec.\\sinh.\\sh.\\tanh.\\tg.\\th.\\lg.\\lb.\\log.\\ln".split(".")).includes(e),
31074
31072
  mathModeSpace: "",
@@ -31132,7 +31130,7 @@ function pp(e, t) {
31132
31130
  }
31133
31131
  function mp(e, t, n) {
31134
31132
  let r = e.getCell(t, n);
31135
- return r?.length === 2 ? r[1].type === "placeholder" : !1;
31133
+ return r?.length === 2 && r[1].type === "placeholder";
31136
31134
  }
31137
31135
  function hp(e, t, n, r) {
31138
31136
  let i = t.getCell(n, r);
@@ -31225,9 +31223,7 @@ function Cp(e, t) {
31225
31223
  case "dcases":
31226
31224
  n = "\\lbrace";
31227
31225
  break;
31228
- case "rcases":
31229
- r = "\\rbrace";
31230
- break;
31226
+ case "rcases": r = "\\rbrace";
31231
31227
  }
31232
31228
  let i = e.at(e.position), a = i.type === "array" ? i : e.parentEnvironment;
31233
31229
  return a.environmentName = t, a.leftDelim = n, a.rightDelim = r, e.contentDidChange({}), !0;
@@ -31245,13 +31241,11 @@ function wp(e, t) {
31245
31241
  a = e.offsetOf(t[t.length - 1]);
31246
31242
  }
31247
31243
  break;
31248
- case "column":
31249
- if (r.colCount > r.minColumns) {
31250
- r.removeColumn(i[1]);
31251
- let t = r.getCell(i[0], Math.max(0, i[1] - 1));
31252
- a = e.offsetOf(t[t.length - 1]);
31253
- }
31254
- break;
31244
+ case "column": if (r.colCount > r.minColumns) {
31245
+ r.removeColumn(i[1]);
31246
+ let t = r.getCell(i[0], Math.max(0, i[1] - 1));
31247
+ a = e.offsetOf(t[t.length - 1]);
31248
+ }
31255
31249
  }
31256
31250
  a !== void 0 && e.setPositionHandlingPlaceholder(a);
31257
31251
  }
@@ -31337,7 +31331,7 @@ function Ap(e, t, n, r) {
31337
31331
  if (t === "forward" && !r || t === "backward" && r === "body") {
31338
31332
  let t = n.leftSibling;
31339
31333
  n.hasChildren && i.addChildrenAfter(n.removeBranch("body"), n), i.removeChild(n), e.position = e.offsetOf(t);
31340
- } else t === "forward" && r === "body" ? e.position = e.offsetOf(n) : !r && t === "backward" ? n.hasChildren ? e.position = e.offsetOf(n.lastChild) : (e.position = Math.max(0, e.offsetOf(n) - 1), i.removeChild(n)) : r === "above" && (n.hasEmptyBranch("above") && n.removeBranch("above"), t === "backward" ? e.position = e.offsetOf(n.leftSibling) : e.position = e.offsetOf(n.body[0]));
31334
+ } else t === "forward" && r === "body" ? e.position = e.offsetOf(n) : !r && t === "backward" ? n.hasChildren ? e.position = e.offsetOf(n.lastChild) : (e.position = Math.max(0, e.offsetOf(n) - 1), i.removeChild(n)) : r === "above" && (n.hasEmptyBranch("above") && n.removeBranch("above"), e.position = t === "backward" ? e.offsetOf(n.leftSibling) : e.offsetOf(n.body[0]));
31341
31335
  return !0;
31342
31336
  }
31343
31337
  if (i && (n.type === "box" || n.type === "enclose")) {
@@ -31351,7 +31345,7 @@ function Ap(e, t, n, r) {
31351
31345
  let t = n.removeBranch(a), r = n.removeBranch(o);
31352
31346
  return i.addChildrenAfter([...t, ...r], n), i.removeChild(n), e.position = e.offsetOf(t.length > 0 ? t[t.length - 1] : r[0]), !0;
31353
31347
  }
31354
- return t === "backward" ? e.position = e.offsetOf(n.leftSibling) : e.position = e.offsetOf(n), !0;
31348
+ return e.position = t === "backward" ? e.offsetOf(n.leftSibling) : e.offsetOf(n), !0;
31355
31349
  }
31356
31350
  if (n.type === "extensible-symbol" || n.type === "subsup" || n.type === "operator") {
31357
31351
  if (!r && t === "forward") return !1;
@@ -31371,9 +31365,9 @@ function Ap(e, t, n, r) {
31371
31365
  let r = t === "forward" ? e.offsetOf(n) : Math.max(0, e.offsetOf(n) - 1);
31372
31366
  return n.parent.removeChild(n), e.position = r, !0;
31373
31367
  }
31374
- return r === "superscript" && t === "backward" ? e.position = e.offsetOf(n.firstChild) - 1 : r === "subscript" && t === "backward" ? n.superscript ? e.position = e.offsetOf(n.superscript[0].lastSibling) : e.position = e.offsetOf(n.firstChild) - 1 : e.position = e.offsetOf(n), !0;
31368
+ return e.position = r === "superscript" && t === "backward" ? e.offsetOf(n.firstChild) - 1 : r === "subscript" && t === "backward" ? n.superscript ? e.offsetOf(n.superscript[0].lastSibling) : e.offsetOf(n.firstChild) - 1 : e.offsetOf(n), !0;
31375
31369
  }
31376
- return r === "superscript" ? t === "backward" ? e.position = e.offsetOf(n.firstChild) - 1 : n.subscript ? e.position = e.offsetOf(n.subscript[0]) : e.position = e.offsetOf(n) : r === "subscript" && (t === "backward" && n.superscript ? e.position = e.offsetOf(n.superscript[0].lastSibling) : t === "backward" ? e.position = e.offsetOf(n.firstChild) - 1 : e.position = e.offsetOf(n)), !0;
31370
+ return r === "superscript" ? e.position = t === "backward" ? e.offsetOf(n.firstChild) - 1 : n.subscript ? e.offsetOf(n.subscript[0]) : e.offsetOf(n) : r === "subscript" && (e.position = t === "backward" && n.superscript ? e.offsetOf(n.superscript[0].lastSibling) : t === "backward" ? e.offsetOf(n.firstChild) - 1 : e.offsetOf(n)), !0;
31377
31371
  }
31378
31372
  if (i?.type === "genfrac" && !r && n.type !== "first") {
31379
31373
  let t = e.offsetOf(n.leftSibling);
@@ -31568,11 +31562,11 @@ function Pp(e, t, n, r) {
31568
31562
  if (t.removeRow(n), r === "backward") {
31569
31563
  let r = t.getCell(n - 1, 0);
31570
31564
  if (!r) return e.position = e.offsetOf(t), !0;
31571
- r.length > 0 ? e.position = e.offsetOf(r[r.length - 1]) : e.position = e.offsetOf(t), t.setCell(n - 1, 0, [...r, ...i]);
31565
+ e.position = r.length > 0 ? e.offsetOf(r[r.length - 1]) : e.offsetOf(t), t.setCell(n - 1, 0, [...r, ...i]);
31572
31566
  } else {
31573
31567
  let r = t.getCell(n, 0);
31574
31568
  if (!r) return e.position = e.offsetOf(t), !0;
31575
- r.length > 0 ? e.position = e.offsetOf(r[0]) : e.position = e.offsetOf(t), t.setCell(n, 0, [...i, ...r]);
31569
+ e.position = r.length > 0 ? e.offsetOf(r[0]) : e.offsetOf(t), t.setCell(n, 0, [...i, ...r]);
31576
31570
  }
31577
31571
  return !0;
31578
31572
  }
@@ -31614,15 +31608,16 @@ function Ip(e, t, n) {
31614
31608
  if (t === "forward" && (s.type === "subsup" ? (s = s.rightSibling, s || (s = e.at(e.position + 1))) : s = e.at(e.position + 1)), !s) return e.announce("plonk"), !1;
31615
31609
  let c = e.offsetOf(s);
31616
31610
  if (s instanceof ic) c = Fp(e, c, t);
31617
- else if (s instanceof V) if (s.isSuggestion) for (; s && s instanceof V;) s.isSuggestion = !1, c = e.offsetOf(s), s = s.rightSibling;
31618
- else if (t === "forward") {
31619
- if (s = s.rightSibling, !s || !(s instanceof V)) return e.announce("plonk"), !1;
31620
- for (; s && s instanceof V && /[a-zA-Z\*]/.test(s.value);) c = e.offsetOf(s), s = s.rightSibling;
31621
- } else {
31622
- if (s = s.leftSibling, !s || !(s instanceof V)) return e.announce("plonk"), !1;
31623
- for (; s && s instanceof V && /[a-zA-Z\*]/.test(s.value);) c = e.offsetOf(s), s = s.leftSibling;
31624
- }
31625
- else if (t === "forward" && s.type === "mopen") {
31611
+ else if (s instanceof V) {
31612
+ if (s.isSuggestion) for (; s && s instanceof V;) s.isSuggestion = !1, c = e.offsetOf(s), s = s.rightSibling;
31613
+ else if (t === "forward") {
31614
+ if (s = s.rightSibling, !s || !(s instanceof V)) return e.announce("plonk"), !1;
31615
+ for (; s && s instanceof V && /[a-zA-Z\*]/.test(s.value);) c = e.offsetOf(s), s = s.rightSibling;
31616
+ } else {
31617
+ if (s = s.leftSibling, !s || !(s instanceof V)) return e.announce("plonk"), !1;
31618
+ for (; s && s instanceof V && /[a-zA-Z\*]/.test(s.value);) c = e.offsetOf(s), s = s.leftSibling;
31619
+ }
31620
+ } else if (t === "forward" && s.type === "mopen") {
31626
31621
  let t = 0;
31627
31622
  do
31628
31623
  s.type === "mopen" ? t += 1 : s.type === "mclose" && --t, s = s.rightSibling;
@@ -31634,14 +31629,15 @@ function Ip(e, t, n) {
31634
31629
  s.type === "mopen" ? t += 1 : s.type === "mclose" && --t, s = s.leftSibling;
31635
31630
  while (!s.isFirstSibling && t !== 0);
31636
31631
  c = e.offsetOf(s);
31637
- } else if (t === "backward") if (s.type === "first") for (; c > 0 && s.type === "first";) --c, s = e.at(c);
31638
- else {
31639
- let t = s.type;
31640
- s.type === "subsup" && (c = e.offsetOf(e.at(c).leftSibling)), --c;
31641
- let n = e.at(c)?.type;
31642
- for (; c >= 0 && n === t;) e.at(c)?.type === "subsup" ? c = e.offsetOf(e.at(c).leftSibling) : --c, n = e.at(c).type;
31643
- }
31644
- else {
31632
+ } else if (t === "backward") {
31633
+ if (s.type === "first") for (; c > 0 && s.type === "first";) --c, s = e.at(c);
31634
+ else {
31635
+ let t = s.type;
31636
+ s.type === "subsup" && (c = e.offsetOf(e.at(c).leftSibling)), --c;
31637
+ let n = e.at(c)?.type;
31638
+ for (; c >= 0 && n === t;) e.at(c)?.type === "subsup" ? c = e.offsetOf(e.at(c).leftSibling) : --c, n = e.at(c).type;
31639
+ }
31640
+ } else {
31645
31641
  let { type: t } = s, n = e.at(c)?.type, { lastOffset: r } = e;
31646
31642
  for (; c <= r && (n === t || n === "subsup");) {
31647
31643
  for (; e.at(c).rightSibling?.type === "subsup";) c = e.offsetOf(e.at(c).rightSibling);
@@ -31698,7 +31694,7 @@ function zp(e, t) {
31698
31694
  return !(i != null && i.inCaptureSelection || (n = r.parent) != null && n.skipBoundary && (!r.isFirstSibling && r.isLastSibling || r.type === "first") || e.mathfield.hasEditablePrompts && !r.parentPrompt);
31699
31695
  }
31700
31696
  function Bp(e, t, n) {
31701
- let r = Infinity, i = 0;
31697
+ let r = 1 / 0, i = 0;
31702
31698
  for (; i < t.length; i++) {
31703
31699
  let a = t[i], o = e.getHTMLElement(a);
31704
31700
  if (!o) continue;
@@ -32034,7 +32030,7 @@ function em(e, t, n, r) {
32034
32030
  return i;
32035
32031
  }
32036
32032
  function tm(e, t, n) {
32037
- typeof t == "function" && (n = t, t = Infinity), t === void 0 && (t = Infinity);
32033
+ typeof t == "function" && (n = t, t = 1 / 0), t === void 0 && (t = 1 / 0);
32038
32034
  let r = e.position, i = !1, a = "";
32039
32035
  for (; !i;) {
32040
32036
  let o = e.at(r);
@@ -32046,7 +32042,7 @@ function tm(e, t, n) {
32046
32042
  });
32047
32043
  }
32048
32044
  function nm(e, t, n) {
32049
- typeof t == "function" && (n = t, t = Infinity), t === void 0 && (t = Infinity);
32045
+ typeof t == "function" && (n = t, t = 1 / 0), t === void 0 && (t = 1 / 0);
32050
32046
  let r = e.position, i = !1, a = [];
32051
32047
  for (; !i;) {
32052
32048
  let o = e.at(r);
@@ -32146,18 +32142,20 @@ function um(e, t) {
32146
32142
  if (clearTimeout(e.inlineShortcutBufferFlushTimer), e.inlineShortcutBufferFlushTimer = 0, om(e, a), t.isTrusted && t.defaultPrevented) return e.flushInlineShortcutBuffer(), !1;
32147
32143
  let o, s = 0, c = "", l = 0, u = e.inlineShortcutBuffer, d = !1;
32148
32144
  if (e.isSelectionEditable && i.selectionIsPlaceholder && od(t) && (e.flushInlineShortcutBuffer(), i.deleteAtoms(sc(i.selection)), e.snapshot("delete"), d = !0), e.isSelectionEditable) {
32149
- if (i.mode === "math" && (!i.selectionIsPlaceholder || d)) if (a === "[Backspace]") e.undoManager.lastOp === "insert-shortcut" ? c = "undo" : u.pop();
32150
- else if (!od(t)) e.flushInlineShortcutBuffer();
32151
- else {
32152
- let n = ud(t), r = [...u[u.length - 1]?.keystrokes ?? [], n];
32153
- u.push({
32154
- state: i.getState(),
32155
- keystrokes: r,
32156
- leftSiblings: hm(e)
32157
- }), s = 0;
32158
- let a = "";
32159
- for (; !o && s < r.length;) l = u.length - (r.length - s), a = r.slice(s).join(""), o = pc(u[l].leftSiblings, a, e.options.inlineShortcuts), !o && /^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(a) && (o = e.options.onInlineShortcut(e, a)), s += 1;
32160
- e.flushInlineShortcutBuffer({ defer: !0 });
32145
+ if (i.mode === "math" && (!i.selectionIsPlaceholder || d)) {
32146
+ if (a === "[Backspace]") e.undoManager.lastOp === "insert-shortcut" ? c = "undo" : u.pop();
32147
+ else if (!od(t)) e.flushInlineShortcutBuffer();
32148
+ else {
32149
+ let n = ud(t), r = [...u[u.length - 1]?.keystrokes ?? [], n];
32150
+ u.push({
32151
+ state: i.getState(),
32152
+ keystrokes: r,
32153
+ leftSiblings: hm(e)
32154
+ }), s = 0;
32155
+ let a = "";
32156
+ for (; !o && s < r.length;) l = u.length - (r.length - s), a = r.slice(s).join(""), o = pc(u[l].leftSiblings, a, e.options.inlineShortcuts), !o && /^[a-zA-Z][a-zA-Z0-9]+?([_\^][a-zA-Z0-9\*\+\-]+?)?$/.test(a) && (o = e.options.onInlineShortcut(e, a)), s += 1;
32157
+ e.flushInlineShortcutBuffer({ defer: !0 });
32158
+ }
32161
32159
  }
32162
32160
  e.options.smartMode && (o ? e.switchMode("math") : am(e, a, t) && (e.switchMode({
32163
32161
  math: "text",
@@ -32438,7 +32436,7 @@ function vm(e, t, n) {
32438
32436
  }), e.mathfield.snapshot("insert-fence"), !0;
32439
32437
  if (!(i instanceof R)) {
32440
32438
  let t = r;
32441
- for (; t && !(t.type === "mclose" && t.value === s);) t = t.rightSibling;
32439
+ for (; t && (t.type !== "mclose" || t.value !== s);) t = t.rightSibling;
32442
32440
  if (t) {
32443
32441
  e.mathfield.snapshot();
32444
32442
  let n = e.extractAtoms([e.offsetOf(r), e.offsetOf(t)]);
@@ -32690,9 +32688,10 @@ function Sm(e, t, n) {
32690
32688
  return n === "backward" ? t - 1 : t;
32691
32689
  }
32692
32690
  if (i.mode === "latex") {
32693
- if (/[a-zA-Z\\*]/.test(i.value)) if (n === "backward") for (; i?.mode === "latex" && i.value !== "\\" && /[a-zA-Z]/.test(i.value);) t += a, i = e.at(t);
32694
- else for (; i?.mode === "latex" && /[a-zA-Z\\*]/.test(i.value);) t += a, i = e.at(t);
32695
- else if (i.value === "{") {
32691
+ if (/[a-zA-Z\\*]/.test(i.value)) {
32692
+ if (n === "backward") for (; i?.mode === "latex" && i.value !== "\\" && /[a-zA-Z]/.test(i.value);) t += a, i = e.at(t);
32693
+ else for (; i?.mode === "latex" && /[a-zA-Z\\*]/.test(i.value);) t += a, i = e.at(t);
32694
+ } else if (i.value === "{") {
32696
32695
  if (n === "forward") {
32697
32696
  for (; i?.mode === "latex" && i.value !== "}";) t += a, i = e.at(t);
32698
32697
  return t;
@@ -32852,22 +32851,22 @@ function Am(e, t, n) {
32852
32851
  return r * r + i * i;
32853
32852
  }
32854
32853
  function jm(e, t, n, r, i) {
32855
- if (!n.id) return [Infinity, null];
32854
+ if (!n.id) return [1 / 0, null];
32856
32855
  if (t.has(n.id)) return t.get(n.id);
32857
32856
  let a = Fc(e, n);
32858
- if (!a) return [Infinity, null];
32859
- let o = [Infinity, null], s = e.model;
32857
+ if (!a) return [1 / 0, null];
32858
+ let o = [1 / 0, null], s = e.model;
32860
32859
  if (n instanceof L) {
32861
- let a = -1, s = Infinity;
32860
+ let a = -1, s = 1 / 0;
32862
32861
  for (let t = 0; t < n.rows.length; t++) {
32863
32862
  let r = n.rows[t];
32864
32863
  if (!r || r.length === 0) continue;
32865
- let o = Infinity, c = -Infinity;
32864
+ let o = 1 / 0, c = -1 / 0;
32866
32865
  for (let t of r) if (t) for (let n of t) {
32867
32866
  let t = Fc(e, n);
32868
32867
  t && (o = Math.min(o, t.top), c = Math.max(c, t.bottom));
32869
32868
  }
32870
- if (o !== Infinity && c !== -Infinity) {
32869
+ if (o !== 1 / 0 && c !== -1 / 0) {
32871
32870
  let e;
32872
32871
  e = i < o ? o - i : i > c ? i - c : 0, e < s && (s = e, a = t);
32873
32872
  }
@@ -33074,7 +33073,7 @@ function Lm(e) {
33074
33073
  let n = t, r = !1;
33075
33074
  if (t.type === "mclose") {
33076
33075
  let e = al[t.value];
33077
- for (; !t.isFirstSibling && !(t.type === "mopen" && t.value === e);) {
33076
+ for (; !t.isFirstSibling && (t.type !== "mopen" || t.value !== e);) {
33078
33077
  let e = t.leftSibling;
33079
33078
  if (!e) break;
33080
33079
  t = e;
@@ -33989,7 +33988,7 @@ var Mh = class e extends Oh {
33989
33988
  super.handleEvent(e);
33990
33989
  }
33991
33990
  dispatchEvent(e) {
33992
- return this._host ? this._host.dispatchEvent(e) : !0;
33991
+ return !this._host || this._host.dispatchEvent(e);
33993
33992
  }
33994
33993
  get host() {
33995
33994
  return this._host;
@@ -34185,8 +34184,10 @@ function Wh(e) {
34185
34184
  function Gh(e, t, n) {
34186
34185
  let r = t.atoms[t.index - 1];
34187
34186
  if (!r) return !1;
34188
- if (!r.superscript && !r.subscript) if (t.atoms[t.index]?.type === "subsup") r = t.atoms[t.index], t.index += 1;
34189
- else return !1;
34187
+ if (!r.superscript && !r.subscript) {
34188
+ if (t.atoms[t.index]?.type === "subsup") r = t.atoms[t.index], t.index += 1;
34189
+ else return !1;
34190
+ }
34190
34191
  let i = t.lastType;
34191
34192
  t.lastType = "";
34192
34193
  let a = K(r.superscript, n);
@@ -34200,7 +34201,7 @@ function Kh(e, t, n) {
34200
34201
  t = t ?? e.atoms.length;
34201
34202
  let r = e.index, i = "", a = Wh(e);
34202
34203
  for (a >= 0 && a < t && (t = a); e.index < t && e.atoms[e.index].mode === "text";) i += e.atoms[e.index].value ? e.atoms[e.index].value : " ", e.index += 1;
34203
- return i.length > 0 ? (i = `<mtext ${G(e.atoms[r].id, n)}>${Vh(i)}</mtext>`, a < 0 && Uh(e) && (a = e.index, e.index += 1), Gh(i, e, n) || (e.mathML += i, e.lastType = "mtext"), !0) : !1;
34204
+ return i.length > 0 && (i = `<mtext ${G(e.atoms[r].id, n)}>${Vh(i)}</mtext>`, a < 0 && Uh(e) && (a = e.index, e.index += 1), Gh(i, e, n) || (e.mathML += i, e.lastType = "mtext"), !0);
34204
34205
  }
34205
34206
  function qh(e, t, n) {
34206
34207
  t = t ?? e.atoms.length;
@@ -34284,7 +34285,7 @@ function K(e, t, n, r) {
34284
34285
  for (r = r || (e ? e.length : 0); i.index < r;) if (Kh(i, r, t) || qh(i, r, t) || Hh(i, r, t) || Yh(i, r, t) || Jh(i, r, t)) n += 1;
34285
34286
  else if (i.index < r) {
34286
34287
  let e = Qh(i.atoms[i.index], t);
34287
- i.lastType === "mn" && e.length > 0 && i.atoms[i.index].type === "genfrac" && (e = "<mo>&#x2064;</mo>" + e), i.atoms[i.index].type === "genfrac" ? i.lastType = "mfrac" : i.lastType = "", i.index += 1, Gh(e, i, t) ? n += 1 : e.length > 0 && (i.mathML += e, n += 1);
34288
+ i.lastType === "mn" && e.length > 0 && i.atoms[i.index].type === "genfrac" && (e = "<mo>&#x2064;</mo>" + e), i.lastType = i.atoms[i.index].type === "genfrac" ? "mfrac" : "", i.index += 1, Gh(e, i, t) ? n += 1 : e.length > 0 && (i.mathML += e, n += 1);
34288
34289
  }
34289
34290
  n > 1 && (i.mathML = "<mrow>" + i.mathML + "</mrow>");
34290
34291
  }
@@ -34748,7 +34749,7 @@ function q(e, t) {
34748
34749
  let e = q("math", t.above);
34749
34750
  e = e.trim();
34750
34751
  let n = e.replace(/<mark([^/]*)\/>/g, "");
34751
- n === "3" ? r += " the cube root of <break time=\"200ms\"/>" + o + ". <break time=\"200ms\"/> End cube root" : n === "n" ? r += " the nth root of <break time=\"200ms\"/>" + o + ". <break time=\"200ms\"/> End root" : r += " the root with index: <break time=\"200ms\"/>" + e + ", of <break time=\"200ms\"/>" + o + ". <break time=\"200ms\"/> End root";
34752
+ r += n === "3" ? " the cube root of <break time=\"200ms\"/>" + o + ". <break time=\"200ms\"/> End cube root" : n === "n" ? " the nth root of <break time=\"200ms\"/>" + o + ". <break time=\"200ms\"/> End root" : " the root with index: <break time=\"200ms\"/>" + e + ", of <break time=\"200ms\"/>" + o + ". <break time=\"200ms\"/> End root";
34752
34753
  }
34753
34754
  break;
34754
34755
  case "leftright":
@@ -34800,44 +34801,43 @@ function q(e, t) {
34800
34801
  case "extensible-symbol":
34801
34802
  if (t.value !== "​") {
34802
34803
  let e = t.command;
34803
- if (e === "\\sum") if (!t.hasEmptyBranch("superscript") && !t.hasEmptyBranch("subscript")) {
34804
- let e = q("math", t.superscript);
34805
- e = e.trim();
34806
- let n = q("math", t.subscript);
34807
- n = n.trim(), r += " the summation from <break time=\"200ms\"/>" + n + "<break time=\"200ms\"/> to <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34808
- } else if (t.hasEmptyBranch("subscript")) r += " the summation of";
34809
- else {
34810
- let e = q("math", t.subscript);
34811
- e = e.trim(), r += " the summation from <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34812
- }
34813
- else if (e === "\\prod") if (!t.hasEmptyBranch("superscript") && !t.hasEmptyBranch("subscript")) {
34814
- let e = q("math", t.superscript);
34815
- e = e.trim();
34816
- let n = q("math", t.subscript);
34817
- n = n.trim(), r += " the product from <break time=\"200ms\"/>" + n + "<break time=\"200ms\"/> to <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34818
- } else if (t.hasEmptyBranch("subscript")) r += " the product of ";
34819
- else {
34820
- let e = q("math", t.subscript);
34821
- e = e.trim(), r += " the product from <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34822
- }
34823
- else if (e === "\\int") if (!t.hasEmptyBranch("superscript") && !t.hasEmptyBranch("subscript")) {
34824
- let e = q("math", t.superscript);
34825
- e = e.trim();
34826
- let n = q("math", t.subscript);
34827
- n = n.trim(), r += " the integral from <break time=\"200ms\"/>" + sg(n) + "<break time=\"200ms\"/> to <break time=\"200ms\"/>" + sg(e) + " <break time=\"200ms\"/> of ", s = !0;
34828
- } else r += " the integral of <break time=\"200ms\"/> ";
34829
- else if (e === "\\operatorname" || e === "\\operatorname*") r += ag(t.body) + " ";
34804
+ if (e === "\\sum") {
34805
+ if (!t.hasEmptyBranch("superscript") && !t.hasEmptyBranch("subscript")) {
34806
+ let e = q("math", t.superscript);
34807
+ e = e.trim();
34808
+ let n = q("math", t.subscript);
34809
+ n = n.trim(), r += " the summation from <break time=\"200ms\"/>" + n + "<break time=\"200ms\"/> to <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34810
+ } else if (t.hasEmptyBranch("subscript")) r += " the summation of";
34811
+ else {
34812
+ let e = q("math", t.subscript);
34813
+ e = e.trim(), r += " the summation from <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34814
+ }
34815
+ } else if (e === "\\prod") {
34816
+ if (!t.hasEmptyBranch("superscript") && !t.hasEmptyBranch("subscript")) {
34817
+ let e = q("math", t.superscript);
34818
+ e = e.trim();
34819
+ let n = q("math", t.subscript);
34820
+ n = n.trim(), r += " the product from <break time=\"200ms\"/>" + n + "<break time=\"200ms\"/> to <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34821
+ } else if (t.hasEmptyBranch("subscript")) r += " the product of ";
34822
+ else {
34823
+ let e = q("math", t.subscript);
34824
+ e = e.trim(), r += " the product from <break time=\"200ms\"/>" + e + "<break time=\"200ms\"/> of <break time=\"150ms\"/>", s = !0;
34825
+ }
34826
+ } else if (e === "\\int") {
34827
+ if (!t.hasEmptyBranch("superscript") && !t.hasEmptyBranch("subscript")) {
34828
+ let e = q("math", t.superscript);
34829
+ e = e.trim();
34830
+ let n = q("math", t.subscript);
34831
+ n = n.trim(), r += " the integral from <break time=\"200ms\"/>" + sg(n) + "<break time=\"200ms\"/> to <break time=\"200ms\"/>" + sg(e) + " <break time=\"200ms\"/> of ", s = !0;
34832
+ } else r += " the integral of <break time=\"200ms\"/> ";
34833
+ } else if (e === "\\operatorname" || e === "\\operatorname*") r += ag(t.body) + " ";
34830
34834
  else if (typeof t.value == "string") {
34831
34835
  let e = $h[t.value] ?? (t.command ? $h[t.command] : void 0);
34832
34836
  r += e || " " + t.value;
34833
34837
  } else t.command && (t.command === "\\mathop" ? r += q("math", t.body) : r += t.command.startsWith("\\") ? " " + t.command.slice(1) : " " + t.command);
34834
34838
  }
34835
34839
  break;
34836
- case "enclose":
34837
- o = q("math", t.body), r += " crossed out " + o + ". End crossed out.";
34838
- break;
34839
- case "space":
34840
- case "spacing": break;
34840
+ case "enclose": o = q("math", t.body), r += " crossed out " + o + ". End crossed out.";
34841
34841
  }
34842
34842
  if (!s && !t.hasEmptyBranch("superscript")) {
34843
34843
  let n = q(e, t.superscript);
@@ -34848,8 +34848,8 @@ function q(e, t) {
34848
34848
  let e = rg(t.superscript);
34849
34849
  e && (r += "<mark name=\"" + e + "\"/>");
34850
34850
  }
34851
- i === "′" ? r += " prime " : i === "2" ? r += " squared " : i === "3" ? r += " cubed " : Number.isNaN(Number.parseInt(i)) ? r += " to the " + n + "; " : r += " to the <say-as interpret-as=\"ordinal\">" + i + "</say-as> power; ";
34852
- } else Number.isNaN(Number.parseInt(i)) ? r += " raised to the " + n + "; " : r += " raised to the <say-as interpret-as=\"ordinal\">" + i + "</say-as> power; ";
34851
+ r += i === "′" ? " prime " : i === "2" ? " squared " : i === "3" ? " cubed " : Number.isNaN(Number.parseInt(i)) ? " to the " + n + "; " : " to the <say-as interpret-as=\"ordinal\">" + i + "</say-as> power; ";
34852
+ } else r += Number.isNaN(Number.parseInt(i)) ? " raised to the " + n + "; " : " raised to the <say-as interpret-as=\"ordinal\">" + i + "</say-as> power; ";
34853
34853
  }
34854
34854
  if (!s && !t.hasEmptyBranch("subscript")) {
34855
34855
  let e = q("math", t.subscript);
@@ -35142,9 +35142,7 @@ function J(e, t) {
35142
35142
  case "subsup":
35143
35143
  n = "";
35144
35144
  break;
35145
- case "macro":
35146
- n = ug[a] ?? ug[r] ?? dg[r] ?? J(e.body, t);
35147
- break;
35145
+ case "macro": n = ug[a] ?? ug[r] ?? dg[r] ?? J(e.body, t);
35148
35146
  }
35149
35147
  if (!e.hasEmptyBranch("subscript")) {
35150
35148
  n += "_";
@@ -36357,10 +36355,7 @@ function Z(e) {
36357
36355
  case "subsup":
36358
36356
  n = (t = e.leftSibling) != null && t.value ? "" : "\"\"";
36359
36357
  break;
36360
- case "macro":
36361
- n = e_[a] ?? e_[r] ?? r_[r] ?? Z(e.body);
36362
- break;
36363
- case "overunder": break;
36358
+ case "macro": n = e_[a] ?? e_[r] ?? r_[r] ?? Z(e.body);
36364
36359
  }
36365
36360
  if (!n) {
36366
36361
  let t = i_[e.command.slice(1)];
@@ -36534,10 +36529,10 @@ var p_ = class {
36534
36529
  let s = o[0] + 1;
36535
36530
  for (; s <= this.lastOffset && this.at(s)?.type === "first" && s < o[1];) s += 1;
36536
36531
  let c = s <= this.lastOffset ? this.at(s) : this.at(o[1]), l = this.at(o[1]), u = F.commonAncestor(c, l);
36537
- u?.type === "array" && c.parent === u && l.parent, this._selection = {
36532
+ this._selection = (u?.type === "array" && c.parent === u && l.parent, {
36538
36533
  ranges: [o],
36539
36534
  direction: a.direction
36540
- }, this._position >= 0 && (this._position, this.lastOffset);
36535
+ }), this._position >= 0 && (this._position, this.lastOffset);
36541
36536
  });
36542
36537
  }
36543
36538
  setPositionHandlingPlaceholder(e) {
@@ -36557,10 +36552,10 @@ var p_ = class {
36557
36552
  return this._anchor === this._position;
36558
36553
  }
36559
36554
  get selectionIsPlaceholder() {
36560
- return Math.abs(this._anchor - this._position) === 1 ? this.at(Math.max(this._anchor, this._position)).type === "placeholder" : !1;
36555
+ return Math.abs(this._anchor - this._position) === 1 && this.at(Math.max(this._anchor, this._position)).type === "placeholder";
36561
36556
  }
36562
36557
  collapseSelection(e = "forward") {
36563
- return this._anchor === this._position ? !1 : (e === "backward" ? this.position = Math.min(this._anchor, this._position) : this.position = Math.max(this._anchor, this._position), !0);
36558
+ return this._anchor !== this._position && (this.position = e === "backward" ? Math.min(this._anchor, this._position) : Math.max(this._anchor, this._position), !0);
36564
36559
  }
36565
36560
  get lastOffset() {
36566
36561
  return this.atoms.length - 1;
@@ -36686,7 +36681,7 @@ var p_ = class {
36686
36681
  }
36687
36682
  extendSelectionTo(e, t) {
36688
36683
  return !this.mathfield.contentEditable && this.mathfield.userSelect === "none" ? !1 : this.deferNotifications({ selection: !0 }, () => {
36689
- let [n, r] = this.normalizeRange([e, t]), i = new Set([
36684
+ let [n, r] = this.normalizeRange([e, t]), i = /* @__PURE__ */ new Set([
36690
36685
  "genfrac",
36691
36686
  "subsup",
36692
36687
  "accent",
@@ -37166,7 +37161,7 @@ var b_ = `<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox=
37166
37161
  else {
37167
37162
  let e = Rc(this);
37168
37163
  if (e.length > 0) {
37169
- let r = -Infinity, i = Infinity, a = -Infinity;
37164
+ let r = -1 / 0, i = 1 / 0, a = -1 / 0;
37170
37165
  for (let t of e) t.right > r && (r = t.right), t.top < i && (i = t.top), t.bottom > a && (a = t.bottom);
37171
37166
  let o = a - i;
37172
37167
  n = {
@@ -37302,7 +37297,7 @@ var b_ = `<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox=
37302
37297
  return this.model.getValue(r, i, t);
37303
37298
  }
37304
37299
  getPrompts(e) {
37305
- return this.model.atoms.filter((t) => t.type === "prompt" ? e ? !(e.id && t.placeholderId !== e.id || e.locked && t.locked !== e.locked || e.correctness === "undefined" && t.correctness || e.correctness && t.correctness !== e.correctness) : !0 : !1).map((e) => e.placeholderId);
37300
+ return this.model.atoms.filter((t) => t.type === "prompt" ? !e || !(e.id && t.placeholderId !== e.id || e.locked && t.locked !== e.locked || e.correctness === "undefined" && t.correctness || e.correctness && t.correctness !== e.correctness) : !1).map((e) => e.placeholderId);
37306
37301
  }
37307
37302
  setPromptValue(e, t, n) {
37308
37303
  if (t !== void 0) {
@@ -37410,18 +37405,20 @@ var b_ = `<svg xmlns="http://www.w3.org/2000/svg" style="width: 21px;" viewBox=
37410
37405
  let n = e._globallyFocusedMathfield;
37411
37406
  n && n !== this && !n.disabled && n.hasFocus() && n.onBlur({ dispatchEvents: !0 }), this.focusBlurInProgress = !0, this.blurred = !1, e._globallyFocusedMathfield = this, this.stopCoalescingUndo(), this.valueOnFocus = this.model.getValue(), this.hasEditablePrompts && !this.model.at(this.model.anchor).parentPrompt && this.executeCommand("moveToNextPlaceholder"), $d(this, { interactive: !0 }), setTimeout(() => {
37412
37407
  var e;
37413
- if (kc(this)) if (t?.suppressEvents ?? !1) {
37414
- let t = new AbortController(), n = t.signal, r = (e) => {
37415
- e.preventDefault(), e.stopPropagation();
37416
- };
37417
- for (let t of ["focus", "focusin"]) (e = this.host) == null || e.addEventListener(t, r, {
37418
- capture: !0,
37419
- signal: n
37420
- });
37421
- this.focusBlurInProgress = !1, this.keyboardDelegate.focus(), this.connectToVirtualKeyboard(), setTimeout(() => t.abort(), 0);
37422
- } else this.focusBlurInProgress = !1, this.keyboardDelegate.focus(), this.connectToVirtualKeyboard(), setTimeout(() => {
37423
- this.programmaticFocusInProgress = !1;
37424
- }, 0);
37408
+ if (kc(this)) {
37409
+ if (t?.suppressEvents ?? !1) {
37410
+ let t = new AbortController(), n = t.signal, r = (e) => {
37411
+ e.preventDefault(), e.stopPropagation();
37412
+ };
37413
+ for (let t of ["focus", "focusin"]) (e = this.host) == null || e.addEventListener(t, r, {
37414
+ capture: !0,
37415
+ signal: n
37416
+ });
37417
+ this.focusBlurInProgress = !1, this.keyboardDelegate.focus(), this.connectToVirtualKeyboard(), setTimeout(() => t.abort(), 0);
37418
+ } else this.focusBlurInProgress = !1, this.keyboardDelegate.focus(), this.connectToVirtualKeyboard(), setTimeout(() => {
37419
+ this.programmaticFocusInProgress = !1;
37420
+ }, 0);
37421
+ }
37425
37422
  }, 60);
37426
37423
  }
37427
37424
  onBlur(t) {
@@ -37572,9 +37569,7 @@ function C_(e, t, n) {
37572
37569
  case "parent":
37573
37570
  t = "no parent";
37574
37571
  break;
37575
- default:
37576
- console.error("unknown speak_ param value: \"" + e + "\"");
37577
- break;
37572
+ default: console.error("unknown speak_ param value: \"" + e + "\"");
37578
37573
  }
37579
37574
  return t;
37580
37575
  }
@@ -37582,7 +37577,7 @@ function C_(e, t, n) {
37582
37577
  if (c === null) return (r = s.speakHook) == null || r.call(s, o(t)), !1;
37583
37578
  (n.withHighlighting || s.speechEngine === "amazon") && (s.textToSpeechMarkup = globalThis.sre && s.textToSpeechRules === "sre" ? "ssml_step" : "ssml");
37584
37579
  let l = lg(c);
37585
- return d() && n.withHighlighting ? (iv().readAloudMathfield = e, $d(e, { forHighlighting: !0 }), s.readAloudHook && s.readAloudHook(e.field, l)) : s.speakHook && s.speakHook(l), !1;
37580
+ return d() && n.withHighlighting ? (q_().readAloudMathfield = e, $d(e, { forHighlighting: !0 }), s.readAloudHook && s.readAloudHook(e.field, l)) : s.speakHook && s.speakHook(l), !1;
37586
37581
  }
37587
37582
  function w_(e) {
37588
37583
  if (!d()) return;
@@ -37590,36 +37585,37 @@ function w_(e) {
37590
37585
  if (!t.speechEngine || t.speechEngine === "local") {
37591
37586
  let t = new SpeechSynthesisUtterance(e);
37592
37587
  globalThis.speechSynthesis.speak(t);
37593
- } else if (t.speechEngine === "amazon") if (!("AWS" in window)) console.error("MathLive 0.110.0: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");
37594
- else {
37595
- let n = new globalThis.AWS.Polly({ apiVersion: "2016-06-10" }), r = {
37596
- OutputFormat: "mp3",
37597
- VoiceId: t.speechEngineVoice ?? "Joanna",
37598
- Engine: [
37599
- "Amy",
37600
- "Emma",
37601
- "Brian",
37602
- "Ivy",
37603
- "Joanna",
37604
- "Kendra",
37605
- "Kimberly",
37606
- "Salli",
37607
- "Joey",
37608
- "Justin",
37609
- "Matthew"
37610
- ].includes(t.speechEngineVoice ?? "Joanna") ? "neural" : "standard",
37611
- Text: e,
37612
- TextType: "ssml"
37613
- };
37614
- n.synthesizeSpeech(r, (e, t) => {
37615
- if (e) console.trace(`MathLive 0.110.0: \`polly.synthesizeSpeech()\` error: ${e}`);
37616
- else if (t != null && t.AudioStream) {
37617
- let e = new Uint8Array(t.AudioStream), n = new Blob([e.buffer], { type: "audio/mpeg" }), r = URL.createObjectURL(n);
37618
- new Audio(r).play().catch((e) => console.error(e));
37619
- }
37620
- });
37621
- }
37622
- else t.speechEngine === "google" && console.error("MathLive 0.110.0: The Google speech engine is not supported yet. Please come again.");
37588
+ } else if (t.speechEngine === "amazon") {
37589
+ if (!("AWS" in window)) console.error("MathLive 0.110.0: AWS SDK not loaded. See https://www.npmjs.com/package/aws-sdk");
37590
+ else {
37591
+ let n = new globalThis.AWS.Polly({ apiVersion: "2016-06-10" }), r = {
37592
+ OutputFormat: "mp3",
37593
+ VoiceId: t.speechEngineVoice ?? "Joanna",
37594
+ Engine: [
37595
+ "Amy",
37596
+ "Emma",
37597
+ "Brian",
37598
+ "Ivy",
37599
+ "Joanna",
37600
+ "Kendra",
37601
+ "Kimberly",
37602
+ "Salli",
37603
+ "Joey",
37604
+ "Justin",
37605
+ "Matthew"
37606
+ ].includes(t.speechEngineVoice ?? "Joanna") ? "neural" : "standard",
37607
+ Text: e,
37608
+ TextType: "ssml"
37609
+ };
37610
+ n.synthesizeSpeech(r, (e, t) => {
37611
+ if (e) console.trace(`MathLive 0.110.0: \`polly.synthesizeSpeech()\` error: ${e}`);
37612
+ else if (t != null && t.AudioStream) {
37613
+ let e = new Uint8Array(t.AudioStream), n = new Blob([e.buffer], { type: "audio/mpeg" }), r = URL.createObjectURL(n);
37614
+ new Audio(r).play().catch((e) => console.error(e));
37615
+ }
37616
+ });
37617
+ }
37618
+ } else t.speechEngine === "google" && console.error("MathLive 0.110.0: The Google speech engine is not supported yet. Please come again.");
37623
37619
  }
37624
37620
  function T_(e) {
37625
37621
  if (e && (e.classList.remove("ML__highlight"), e.children)) for (let t of e.children) T_(t);
@@ -37649,22 +37645,22 @@ function D_(e, t) {
37649
37645
  TextType: "ssml",
37650
37646
  SpeechMarkTypes: ["ssml"]
37651
37647
  };
37652
- iv().readAloudElement = e, n.synthesizeSpeech(r, (e, i) => {
37648
+ q_().readAloudElement = e, n.synthesizeSpeech(r, (e, i) => {
37653
37649
  if (e) {
37654
37650
  console.trace(`MathLive 0.110.0: \`polly.synthesizeSpeech()\` error: ${e}`);
37655
37651
  return;
37656
37652
  }
37657
37653
  if (!(i != null && i.AudioStream)) return;
37658
37654
  let a = new TextDecoder("utf-8").decode(new Uint8Array(i.AudioStream));
37659
- iv().readAloudMarks = a.split("\n").map((e) => e ? JSON.parse(e) : {}), iv().readAloudTokens = [];
37660
- for (let e of iv().readAloudMarks) e.value && iv().readAloudTokens.push(e.value);
37661
- iv().readAloudCurrentMark = "", r.OutputFormat = "mp3", r.SpeechMarkTypes = [], n.synthesizeSpeech(r, (e, n) => {
37655
+ q_().readAloudMarks = a.split("\n").map((e) => e ? JSON.parse(e) : {}), q_().readAloudTokens = [];
37656
+ for (let e of q_().readAloudMarks) e.value && q_().readAloudTokens.push(e.value);
37657
+ q_().readAloudCurrentMark = "", r.OutputFormat = "mp3", r.SpeechMarkTypes = [], n.synthesizeSpeech(r, (e, n) => {
37662
37658
  if (e) {
37663
37659
  console.trace(`MathLive 0.110.0: \`polly.synthesizeSpeech("${t}") error:${e}`);
37664
37660
  return;
37665
37661
  }
37666
37662
  if (!(n != null && n.AudioStream)) return;
37667
- let r = new Uint8Array(n.AudioStream), i = new Blob([r.buffer], { type: "audio/mpeg" }), a = URL.createObjectURL(i), o = iv();
37663
+ let r = new Uint8Array(n.AudioStream), i = new Blob([r.buffer], { type: "audio/mpeg" }), a = URL.createObjectURL(i), o = q_();
37668
37664
  o.readAloudAudio ? o.readAloudAudio.pause() : (o.readAloudAudio = new Audio(), o.readAloudAudio.addEventListener("ended", () => {
37669
37665
  let e = o.readAloudMathfield;
37670
37666
  o.readAloudStatus = "ended", document.body.dispatchEvent(new Event("read-aloud-status-change", {
@@ -37737,12 +37733,15 @@ var Q = /* @__PURE__ */ new WeakMap(), O_ = .5, k_ = {
37737
37733
  constructor(e) {
37738
37734
  if (super(), this._observer = null, e) {
37739
37735
  let t = [];
37740
- for (let n of Object.keys(e)) if (k_[n]) if (k_[n].startsWith("mf.")) if (k_[n].startsWith(`mf.${n}`)) t.push(`Option \`${n}\` cannot be used as a constructor option. Use ${k_[n]}`);
37741
- else {
37742
- let e = k_[n].match(/([a-zA-Z]+) =/);
37743
- t.push(`Option \`${n}\` has been renamed \`${e[1]}\``);
37736
+ for (let n of Object.keys(e)) if (k_[n]) {
37737
+ if (k_[n].startsWith("mf.")) {
37738
+ if (k_[n].startsWith(`mf.${n}`)) t.push(`Option \`${n}\` cannot be used as a constructor option. Use ${k_[n]}`);
37739
+ else {
37740
+ let e = k_[n].match(/([a-zA-Z]+) =/);
37741
+ t.push(`Option \`${n}\` has been renamed \`${e[1]}\``);
37742
+ }
37743
+ } else t.push(`Option \`${n}\` cannot be used as a constructor option. Use ${k_[n]}`);
37744
37744
  }
37745
- else t.push(`Option \`${n}\` cannot be used as a constructor option. Use ${k_[n]}`);
37746
37745
  if (t.length > 0) {
37747
37746
  console.group("%cMathLive 0.110.0: %cInvalid Options", "color:#12b; font-size: 1.1rem", "color:#db1111; font-size: 1.1rem"), console.warn("Some of the options passed to `new MathfieldElement(...)` are invalid. \n See mathfield/changelog/ for details.");
37748
37747
  for (let e of t) console.warn(e);
@@ -37978,14 +37977,12 @@ var Q = /* @__PURE__ */ new WeakMap(), O_ = .5, k_ = {
37978
37977
  case "delete":
37979
37978
  t = this._keypressSound.delete;
37980
37979
  break;
37981
- case "plonk":
37982
- t = this.plonkSound;
37983
- break;
37980
+ case "plonk": t = this.plonkSound;
37984
37981
  }
37985
37982
  if (typeof t != "string") return;
37986
37983
  t = t.trim();
37987
37984
  let n = this.soundsDirectory;
37988
- if (!(n == null || n === "null" || t === "none" || t === "null")) try {
37985
+ if (n != null && n !== "null" && t !== "none" && t !== "null") try {
37989
37986
  let r = await (await fetch(await Gd(`${n}/${t}`))).arrayBuffer(), i = await this.audioContext.decodeAudioData(r);
37990
37987
  this.audioBuffers[e] = i;
37991
37988
  } catch {}
@@ -38293,10 +38290,7 @@ var Q = /* @__PURE__ */ new WeakMap(), O_ = .5, k_ = {
38293
38290
  this.disabled = r;
38294
38291
  break;
38295
38292
  case "read-only":
38296
- case "readonly":
38297
- this.readOnly = r;
38298
- break;
38299
- default:
38293
+ case "readonly": this.readOnly = r;
38300
38294
  }
38301
38295
  }
38302
38296
  get readonly() {
@@ -38341,7 +38335,7 @@ var Q = /* @__PURE__ */ new WeakMap(), O_ = .5, k_ = {
38341
38335
  if (typeof n == "string") return e._getOption("registers")[n];
38342
38336
  },
38343
38337
  set(t, n, r) {
38344
- return typeof n == "string" ? (e._setOptions({ registers: c(s({}, e._getOption("registers")), { [n]: r }) }), !0) : !1;
38338
+ return typeof n == "string" && (e._setOptions({ registers: c(s({}, e._getOption("registers")), { [n]: r }) }), !0);
38345
38339
  },
38346
38340
  ownKeys: () => Reflect.ownKeys(e._getOption("registers")),
38347
38341
  getOwnPropertyDescriptor: (t, n) => {
@@ -38779,241 +38773,24 @@ function W_() {
38779
38773
  typeof window < "u" && ((e = window.customElements) != null && e.get("math-span") || (t = window.customElements) == null || t.define("math-span", H_), (n = window.customElements) != null && n.get("math-div") || (r = window.customElements) == null || r.define("math-div", U_));
38780
38774
  }
38781
38775
  W_();
38782
- function G_(e, t, n) {
38783
- let r = n, i = 0, a = e.length;
38784
- for (; r < t.length;) {
38785
- let n = t[r];
38786
- if (i <= 0 && t.slice(r, r + a) === e) return r;
38787
- n === "\\" ? r++ : n === "{" ? i++ : n === "}" && i--, r++;
38788
- }
38789
- return -1;
38790
- }
38791
- function K_(e, t, n, r, i = "latex") {
38792
- let a = [];
38793
- for (let o of e) if (o.type === "text") {
38794
- let e = o.data, s = !0, c = 0, l;
38795
- l = e.indexOf(t), l !== -1 && (c = l, c > 0 && a.push({
38796
- type: "text",
38797
- data: e.slice(0, c)
38798
- }), s = !1);
38799
- let u = !1;
38800
- for (; !u;) {
38801
- if (s) {
38802
- if (l = e.indexOf(t, c), l === -1) {
38803
- u = !0;
38804
- break;
38805
- }
38806
- c !== l && a.push({
38807
- type: "text",
38808
- data: e.slice(c, l)
38809
- }), c = l;
38810
- } else {
38811
- if (l = G_(n, e, c + t.length), l === -1) {
38812
- u = !0;
38813
- break;
38814
- }
38815
- let o = e.slice(c + t.length, l);
38816
- i === "ascii-math" && ([, o] = hc(o, { format: "ascii-math" })), a.push({
38817
- type: "math",
38818
- data: o,
38819
- mathstyle: r
38820
- }), c = l + n.length;
38821
- }
38822
- s = !s;
38823
- }
38824
- c < e.length && a.push({
38825
- type: "text",
38826
- data: e.slice(c)
38827
- });
38828
- } else a.push(o);
38829
- return a;
38830
- }
38831
- function q_(e, t) {
38832
- var n, r, i, a;
38833
- let o = [{
38834
- type: "text",
38835
- data: e
38836
- }];
38837
- return (n = t.TeX?.delimiters) != null && n.display && t.TeX.delimiters.display.forEach(([e, t]) => {
38838
- o = K_(o, e, t, "displaystyle");
38839
- }), (r = t.TeX?.delimiters) != null && r.inline && t.TeX.delimiters.inline.forEach(([e, t]) => {
38840
- o = K_(o, e, t, "textstyle");
38841
- }), (i = t.asciiMath?.delimiters) != null && i.inline && t.asciiMath.delimiters.inline.forEach(([e, t]) => {
38842
- o = K_(o, e, t, "textstyle", "ascii-math");
38843
- }), (a = t.asciiMath?.delimiters) != null && a.display && t.asciiMath.delimiters.display.forEach(([e, t]) => {
38844
- o = K_(o, e, t, "displaystyle", "ascii-math");
38845
- }), o;
38846
- }
38847
- function J_(e, t) {
38848
- let n = document.createElement("span");
38849
- n.setAttribute("translate", "no");
38850
- try {
38851
- let r = "<math xmlns='http://www.w3.org/1998/Math/MathML'>" + t.renderToMathML(e) + "</math>";
38852
- n.innerHTML = globalThis.MathfieldElement.createHTML(r);
38853
- } catch (t) {
38854
- console.error(`MathLive 0.110.0: Could not convert "${e}"' to MathML with ${t}`), n.textContent = e;
38855
- }
38856
- return n.className = "ML__sr-only", n;
38857
- }
38858
- function Y_(e, t, n) {
38859
- try {
38860
- let r = t.renderToMarkup(e, c(s({}, t), { defaultMode: n === "displaystyle" ? "math" : "inline-math" })), i = document.createElement("span");
38861
- return i.dataset.latex = e, i.style.display = n === "displaystyle" ? "flex" : "inline-flex", i.setAttribute("aria-hidden", "true"), i.setAttribute("translate", "no"), i.innerHTML = globalThis.MathfieldElement.createHTML(r), i;
38862
- } catch (t) {
38863
- return console.error("Could not parse'" + e + "' with ", t), document.createTextNode(e);
38864
- }
38865
- }
38866
- function X_(e, t, n) {
38867
- let r = Y_(e, n, t || "textstyle"), i = n.renderAccessibleContent ?? "";
38868
- if (/\b(mathml|speakable-text)\b/i.test(i)) {
38869
- let t = document.createElement("span");
38870
- if (/\bmathml\b/i.test(i) && n.renderToMathML && t.append(J_(e, n)), /\bspeakable-text\b/i.test(i) && n.renderToSpeakableText) {
38871
- let r = document.createElement("span");
38872
- r.setAttribute("translate", "no");
38873
- let i = n.renderToSpeakableText(e);
38874
- r.innerHTML = globalThis.MathfieldElement.createHTML(i), r.className = "ML__sr-only", t.append(r);
38875
- }
38876
- return t.append(r), t;
38877
- }
38878
- return r;
38879
- }
38880
- function Z_(e, t) {
38881
- var n;
38882
- if (/^\s*$/.test(e)) return null;
38883
- if ((n = t.TeX) != null && n.processEnvironments && /^\s*\\begin/.test(e)) return [X_(e, "", t)];
38884
- let r = q_(e, t);
38885
- if (r.length === 1 && r[0].type === "text") return null;
38886
- let i = [];
38887
- for (let e of r) e.type === "text" ? i.push(e.data) : i.push(X_(e.data, e.mathstyle === "textstyle" ? "textstyle" : "displaystyle", t));
38888
- return i;
38889
- }
38890
- function Q_(e, t) {
38891
- var n, r, i, a, o, s, c;
38892
- if (e.childNodes.length === 1 && e.childNodes[0].nodeType === 3) {
38893
- let r = e.childNodes[0].textContent ?? "";
38894
- if ((n = t.TeX) != null && n.processEnvironments && /^\s*\\begin/.test(r)) {
38895
- e.textContent = "", e.append(X_(r, "", t));
38896
- return;
38897
- }
38898
- let i = q_(r, t);
38899
- if (i.length === 1) {
38900
- let n = i[0];
38901
- if (n.type === "text") return;
38902
- e.textContent = "", e.append(X_(n.data, n.mathstyle === "textstyle" ? "textstyle" : "displaystyle", t));
38903
- return;
38904
- }
38905
- }
38906
- let l = [...e.childNodes];
38907
- for (let e of l) if (e.nodeType === 3) {
38908
- let n = Z_(e.textContent ?? "", t);
38909
- n && e.replaceWith(...n);
38910
- } else if (e.nodeType === 1) {
38911
- let n = e.nodeName.toLowerCase();
38912
- if (n === "script") {
38913
- let n = e, a = n.type.toLowerCase();
38914
- if (a === "module" || a === "javascript") continue;
38915
- let o;
38916
- if ((r = t.processScriptTypePattern) != null && r.test(a)) o = n.textContent ?? "";
38917
- else if ((i = t.processMathJSONScriptTypePattern) != null && i.test(a)) try {
38918
- o = t.serializeToLatex?.call(t, JSON.parse(n.textContent ?? ""));
38919
- } catch (e) {
38920
- console.error(e);
38921
- }
38922
- if (o) {
38923
- let e = "textstyle";
38924
- for (let t of a.split(";")) {
38925
- let [n, r] = t.split("=");
38926
- n.trim() === "mode" && (e = r.trim() === "display" ? "displaystyle" : "textstyle");
38927
- }
38928
- tv(n, o, e, t);
38929
- }
38930
- } else {
38931
- let r = e;
38932
- if ((a = t.texClassDisplayPattern) != null && a.test(r.className)) {
38933
- tv(r, r.textContent ?? "", "displaystyle", t);
38934
- continue;
38935
- }
38936
- if ((o = t.texClassInlinePattern) != null && o.test(r.className)) {
38937
- tv(r, r.textContent ?? "", "textstyle", t);
38938
- continue;
38939
- }
38940
- ((t.processClassPattern?.test(r.className) ?? !1) || !((s = t.skipTags?.includes(n)) != null && s || (c = t.ignoreClassPattern?.test(r.className)) != null && c)) && Q_(r, t);
38941
- }
38942
- }
38943
- }
38944
- var $_ = {
38945
- skipTags: [
38946
- "math-field",
38947
- "noscript",
38948
- "style",
38949
- "textarea",
38950
- "pre",
38951
- "code",
38952
- "annotation",
38953
- "annotation-xml"
38954
- ],
38955
- processScriptType: "math/tex",
38956
- processMathJSONScriptType: "math/json",
38957
- ignoreClass: "^(tex2jax_ignore|ML__latex)$",
38958
- processClass: "tex2jax_process",
38959
- renderAccessibleContent: "mathml",
38960
- asciiMath: { delimiters: { inline: [["`", "`"]] } },
38961
- TeX: {
38962
- processEnvironments: !0,
38963
- delimiters: {
38964
- inline: [["\\(", "\\)"]],
38965
- display: [["$$", "$$"], ["\\[", "\\]"]]
38966
- }
38967
- }
38968
- };
38969
- function ev(e, t) {
38970
- var n, r;
38971
- try {
38972
- let i = s(s({}, $_), t);
38973
- i.ignoreClassPattern = new RegExp(i.ignoreClass ?? ""), i.processClassPattern = new RegExp(i.processClass ?? ""), i.processScriptTypePattern = new RegExp(i.processScriptType ?? ""), i.processMathJSONScriptTypePattern = new RegExp(i.processMathJSONScriptType ?? ""), (n = i.TeX?.className) != null && n.display && (i.texClassDisplayPattern = new RegExp(i.TeX.className.display)), (r = i.TeX?.className) != null && r.inline && (i.texClassInlinePattern = new RegExp(i.TeX.className.inline)), Yd(), tl("core"), Q_(e, i);
38974
- } catch (t) {
38975
- t instanceof Error ? console.error("renderMathInElement(): " + t.message) : console.error("renderMathInElement(): Could not render math for element", e);
38976
- }
38977
- }
38978
- function tv(e, t, n, r) {
38979
- e.parentNode.replaceChild(X_(t, n, r), e);
38980
- }
38981
- function nv(e, t) {
38776
+ function G_(e, t) {
38982
38777
  let n = rp.singleton;
38983
38778
  return n ? (n.show(), Sf(), n.currentLayer = t, n.render(), n.focus(), !0) : !1;
38984
38779
  }
38985
- function rv() {
38780
+ function K_() {
38986
38781
  let e = window.mathVirtualKeyboard;
38987
38782
  return e.visible ? e.hide({ animate: !0 }) : e.show({ animate: !0 }), !1;
38988
38783
  }
38989
38784
  sf({
38990
- switchKeyboardLayer: nv,
38991
- toggleVirtualKeyboard: rv,
38785
+ switchKeyboardLayer: G_,
38786
+ toggleVirtualKeyboard: K_,
38992
38787
  hideVirtualKeyboard: () => (window.mathVirtualKeyboard.hide({ animate: !0 }), !1),
38993
38788
  showVirtualKeyboard: () => (window.mathVirtualKeyboard.show({ animate: !0 }), !1)
38994
38789
  }, { target: "virtual-keyboard" });
38995
- function iv() {
38790
+ function q_() {
38996
38791
  var e;
38997
38792
  return globalThis[e = Symbol.for("io.cortexjs.mathlive")] ?? (globalThis[e] = {}), globalThis[Symbol.for("io.cortexjs.mathlive")];
38998
38793
  }
38999
- function av(e) {
39000
- if (typeof e == "string") {
39001
- let t = document.getElementById(e);
39002
- if (t === null) throw Error(`The element with ID "${e}" could not be found.`);
39003
- return t;
39004
- }
39005
- return e;
39006
- }
39007
- function ov(e, t) {
39008
- if (document.readyState === "loading") {
39009
- document.addEventListener("DOMContentLoaded", () => ov(e, t));
39010
- return;
39011
- }
39012
- let n = av(e);
39013
- if (!n) return;
39014
- let r = t ?? {};
39015
- r.renderToMarkup ?? (r.renderToMarkup = Y), r.renderToMathML ?? (r.renderToMathML = hg), r.renderToSpeakableText ?? (r.renderToSpeakableText = gg), r.serializeToLatex ?? (r.serializeToLatex = vg), ev(n, r);
39016
- }
39017
38794
  //#endregion
39018
38795
 
39019
- //# sourceMappingURL=mathlive.min-DeR46YTX.js.map
38796
+ //# sourceMappingURL=mathlive.min-3RSVNrlY.js.map