@pie-element/shared-math-rendering-mathjax 0.1.9-next.20261110072702 → 0.1.9

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.
Files changed (45) hide show
  1. package/dist/browser/{PUA-B9NpQDvw.js → PUA-D2D5AQW0.js} +1 -1
  2. package/dist/browser/{accents-ysi9Df8S.js → accents-BorzKdYI.js} +1 -1
  3. package/dist/browser/{accents-b-i-DutO7IRR.js → accents-b-i-CTKzj2iJ.js} +1 -1
  4. package/dist/browser/{arabic-DCupRFds.js → arabic-CPCgwVER.js} +1 -1
  5. package/dist/browser/{arrows-BqV08kgE.js → arrows-BmBQXrtH.js} +1 -1
  6. package/dist/browser/{braille-B-E6TW2B.js → braille-B19oCKrJ.js} +1 -1
  7. package/dist/browser/{braille-d-ANRolKQ5.js → braille-d-BhzmlHLO.js} +1 -1
  8. package/dist/browser/{calligraphic-ByxS3vaH.js → calligraphic-BzHSim3n.js} +1 -1
  9. package/dist/browser/{cherokee-B6MTQmt8.js → cherokee-D72pIHhj.js} +1 -1
  10. package/dist/browser/{cyrillic-lN6m23ZK.js → cyrillic-So36GKCn.js} +1 -1
  11. package/dist/browser/{cyrillic-ss-BC9eWtr6.js → cyrillic-ss-C6jaQN29.js} +1 -1
  12. package/dist/browser/{devanagari-DTwbmBIo.js → devanagari-B2LvMkHp.js} +1 -1
  13. package/dist/browser/{double-struck-UyrNIJ4o.js → double-struck-B5RyeZwJ.js} +1 -1
  14. package/dist/browser/{fraktur-DI50ytiq.js → fraktur-DORLOSJk.js} +1 -1
  15. package/dist/browser/{greek-BvWuUgxF.js → greek-DFeJRkYa.js} +1 -1
  16. package/dist/browser/{greek-ss-cWSH_J75.js → greek-ss-BrNb97X_.js} +1 -1
  17. package/dist/browser/{hebrew-CUCA8Aqt.js → hebrew-NTohGwst.js} +1 -1
  18. package/dist/browser/index.js +2 -2
  19. package/dist/browser/{latin-CAwh7kTg.js → latin-DTXiVygB.js} +1 -1
  20. package/dist/browser/{latin-b-BZ0OiwUs.js → latin-b-BkL2TEbp.js} +1 -1
  21. package/dist/browser/{latin-bi-DSEmhbix.js → latin-bi-BuPlINT_.js} +1 -1
  22. package/dist/browser/{latin-i-CBdjBBDm.js → latin-i-e7zVcTkb.js} +1 -1
  23. package/dist/browser/{marrows-DRTuumpl.js → marrows-BGkVZyA5.js} +1 -1
  24. package/dist/browser/{math-sEA-NCjX.js → math-H-5-v474.js} +1 -1
  25. package/dist/browser/{mathjax-CSiPEd6T.js → mathjax-hHBxoDXn.js} +41 -41
  26. package/dist/browser/{monospace-B73HYW2v.js → monospace-DSaRUx9O.js} +1 -1
  27. package/dist/browser/{monospace-ex-D0cGJVr_.js → monospace-ex-udgCTH65.js} +1 -1
  28. package/dist/browser/{monospace-l-CtgpPjAZ.js → monospace-l-Dka5DkjS.js} +1 -1
  29. package/dist/browser/{mshapes-D6tj3BKO.js → mshapes-CGKaTEhC.js} +1 -1
  30. package/dist/browser/{phonetics-Dq6MGT2G.js → phonetics-DIka7zu6.js} +1 -1
  31. package/dist/browser/{phonetics-ss-B2cN4lsU.js → phonetics-ss-CAxB-AJ5.js} +1 -1
  32. package/dist/browser/{sans-serif-PeA-3D2x.js → sans-serif-CGdEIddA.js} +1 -1
  33. package/dist/browser/{sans-serif-b-D4gCgGlx.js → sans-serif-b-CuHMywxE.js} +1 -1
  34. package/dist/browser/{sans-serif-bi-DN7E-veg.js → sans-serif-bi-CurpWpEo.js} +1 -1
  35. package/dist/browser/{sans-serif-ex-DguyqUC4.js → sans-serif-ex-4wGLfdTJ.js} +1 -1
  36. package/dist/browser/{sans-serif-i-BSAo_sXu.js → sans-serif-i-CCc3BM9t.js} +1 -1
  37. package/dist/browser/{sans-serif-r-CCN-xTJ7.js → sans-serif-r-CkHYML6D.js} +1 -1
  38. package/dist/browser/{script-tCIvcbiA.js → script-DMr0s_yK.js} +1 -1
  39. package/dist/browser/{shapes-CGT8pJKt.js → shapes-hW-KK-6x.js} +1 -1
  40. package/dist/browser/{speech-worker-fbxD4XrK.js → speech-worker-h68ITNMx.js} +31 -14
  41. package/dist/browser/{symbols-KuaSz5oY.js → symbols-BOBuaOEZ.js} +1 -1
  42. package/dist/browser/{symbols-b-i-DwKU5Bw4.js → symbols-b-i-DcXnmzmg.js} +1 -1
  43. package/dist/browser/{variants-Bok8-uuT.js → variants-C5SQ6RwX.js} +1 -1
  44. package/dist/index.js +352 -330
  45. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -136,21 +136,21 @@ function ae(e, t) {
136
136
  i.src = n, i.async = !0, i.onload = () => t(!0), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
137
137
  })) : (_("untypeset"), Promise.resolve(!1));
138
138
  }
139
- var oe = globalThis, b = "PIE-MJX-CHTML-styles", se = ["MJX-CHTML-styles", "MJX-SVG-styles"], ce = re, le = "http://www.w3.org/1998/Math/MathML", ue = /^([a-z_][\w.-]*):math$/, de = /^[a-z][a-z0-9-]*$/;
140
- function fe(e) {
139
+ var oe = globalThis, se = "PIE-MJX-CHTML-styles", ce = ["MJX-CHTML-styles", "MJX-SVG-styles"], le = re, ue = "http://www.w3.org/1998/Math/MathML", de = /^([a-z_][\w.-]*):math$/, fe = /^[a-z][a-z0-9-]*$/;
140
+ function pe(e) {
141
141
  for (let t of e.querySelectorAll("*")) {
142
- let n = ue.exec(t.tagName.toLowerCase())?.[1];
143
- n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(pe(t, `${n}:`));
142
+ let n = de.exec(t.tagName.toLowerCase())?.[1];
143
+ n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(b(t, `${n}:`));
144
144
  }
145
145
  }
146
- function pe(e, t) {
146
+ function b(e, t) {
147
147
  let n = e.tagName.toLowerCase().slice(t.length);
148
- if (!de.test(n)) return e;
149
- let r = e.ownerDocument.createElementNS(le, n);
148
+ if (!fe.test(n)) return e;
149
+ let r = e.ownerDocument.createElementNS(ue, n);
150
150
  for (let t of e.attributes) r.setAttribute(t.name, t.value);
151
151
  for (let n of [...e.childNodes]) {
152
152
  let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
153
- r.appendChild(e ? pe(n, t) : n);
153
+ r.appendChild(e ? b(n, t) : n);
154
154
  }
155
155
  return r;
156
156
  }
@@ -164,46 +164,46 @@ var me = /* @__PURE__ */ new Set([
164
164
  thin: "0.035em",
165
165
  medium: "0.07em",
166
166
  thick: "0.14em"
167
- }, ge = {
167
+ }, x = {
168
168
  tight: "0em",
169
169
  medium: "0.1em",
170
170
  loose: "0.2em"
171
- }, _e = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, ve = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, ye = /^(\d+(\.\d*)?|\.\d+)$/, be = /* @__PURE__ */ new Set([
171
+ }, ge = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, _e = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, ve = /^(\d+(\.\d*)?|\.\d+)$/, ye = /* @__PURE__ */ new Set([
172
172
  "mn",
173
173
  "mo",
174
174
  "mi",
175
175
  "mtext"
176
- ]), xe = /* @__PURE__ */ new Set([
176
+ ]), be = /* @__PURE__ */ new Set([
177
177
  "stackalign",
178
178
  "charalign",
179
179
  "charspacing",
180
180
  "longdivstyle"
181
181
  ]);
182
- function x(e, t, n = [], r = {}) {
183
- let i = e.createElementNS(le, t);
182
+ function S(e, t, n = [], r = {}) {
183
+ let i = e.createElementNS(ue, t);
184
184
  for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
185
185
  for (let e of n) e && i.appendChild(e);
186
186
  return i;
187
187
  }
188
- function S(e, t) {
189
- let n = x(e.document, "mo");
188
+ function C(e, t) {
189
+ let n = S(e.document, "mo");
190
190
  return n.textContent = t, n;
191
191
  }
192
- function Se(e) {
193
- let t = x(e.document, "mn");
194
- return t.textContent = "0", x(e.document, "mphantom", [t]);
192
+ function xe(e) {
193
+ let t = S(e.document, "mn");
194
+ return t.textContent = "0", S(e.document, "mphantom", [t]);
195
195
  }
196
- function C(e, t) {
196
+ function w(e, t) {
197
197
  return e.getAttribute(t)?.trim().toLowerCase() || void 0;
198
198
  }
199
- function w(e, t) {
199
+ function T(e, t) {
200
200
  let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
201
201
  return Number.isFinite(n) ? n : 0;
202
202
  }
203
- function T(e) {
203
+ function E(e) {
204
204
  return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
205
205
  }
206
- function E(e, t, n = e) {
206
+ function D(e, t, n = e) {
207
207
  switch (t) {
208
208
  case "left": return 0;
209
209
  case "center": return Math.floor(e / 2);
@@ -211,14 +211,14 @@ function E(e, t, n = e) {
211
211
  default: return n;
212
212
  }
213
213
  }
214
- function D(e, t, n) {
214
+ function O(e, t, n) {
215
215
  let r = [], i, a, o = (e, t) => {
216
216
  let s = (e) => t.reduceRight((e, t) => {
217
217
  let n = t.cloneNode(!1);
218
218
  return n.appendChild(e), n;
219
219
  }, e);
220
220
  if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
221
- else if (T(e)) r.push(null);
221
+ else if (E(e)) r.push(null);
222
222
  else if (e.localName === "mn" && e.children.length === 0) {
223
223
  let t = [...(e.textContent ?? "").trim()];
224
224
  for (let a of t) {
@@ -227,28 +227,28 @@ function D(e, t, n) {
227
227
  t.textContent = a, r.push(s(t));
228
228
  }
229
229
  t.length && (a ??= r.length);
230
- } else be.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
230
+ } else ye.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
231
231
  };
232
232
  for (let t of e) o(t, []);
233
233
  return {
234
234
  kind: "digits",
235
235
  cells: r,
236
- anchor: E(r.length, n.stackAlign, i ?? a),
236
+ anchor: D(r.length, n.stackAlign, i ?? a),
237
237
  position: t
238
238
  };
239
239
  }
240
- function O(e) {
240
+ function k(e) {
241
241
  return (e ?? "").toLowerCase().split(/\s+/).filter((e) => me.has(e));
242
242
  }
243
- function Ce(e, t) {
244
- let n = [...e.children].filter((e) => !T(e));
245
- return n.length <= 1 ? n[0] ?? null : x(t.document, "mrow", n);
243
+ function Se(e, t) {
244
+ let n = [...e.children].filter((e) => !E(e));
245
+ return n.length <= 1 ? n[0] ?? null : S(t.document, "mrow", n);
246
246
  }
247
- function we(e, t, n) {
248
- let r = C(e, "location") ?? "n", i = O(e.getAttribute("crossout")), a = [...e.children].map((e) => T(e) ? null : e.localName === "mscarry" ? {
249
- content: Ce(e, n),
250
- location: C(e, "location") ?? r,
251
- crossout: e.hasAttribute("crossout") ? O(e.getAttribute("crossout")) : i
247
+ function Ce(e, t, n) {
248
+ let r = w(e, "location") ?? "n", i = k(e.getAttribute("crossout")), a = [...e.children].map((e) => E(e) ? null : e.localName === "mscarry" ? {
249
+ content: Se(e, n),
250
+ location: w(e, "location") ?? r,
251
+ crossout: e.hasAttribute("crossout") ? k(e.getAttribute("crossout")) : i
252
252
  } : {
253
253
  content: e,
254
254
  location: r,
@@ -257,60 +257,60 @@ function we(e, t, n) {
257
257
  return {
258
258
  kind: "carries",
259
259
  carries: a,
260
- anchor: E(a.length, n.stackAlign),
260
+ anchor: D(a.length, n.stackAlign),
261
261
  position: t,
262
- scale: ye.test(o) ? o : "0.6"
262
+ scale: ve.test(o) ? o : "0.6"
263
263
  };
264
264
  }
265
- function k(e) {
266
- let t = C(e, "mslinethickness") ?? "medium", n = he[t] ?? (_e.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
267
- return `${n} solid ${ve.test(r) ? r : "currentColor"}`;
265
+ function A(e) {
266
+ let t = w(e, "mslinethickness") ?? "medium", n = he[t] ?? (ge.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
267
+ return `${n} solid ${_e.test(r) ? r : "currentColor"}`;
268
268
  }
269
- function Te(e, t, n) {
270
- let r = Math.max(0, w(e, "length"));
269
+ function we(e, t, n) {
270
+ let r = Math.max(0, T(e, "length"));
271
271
  return {
272
272
  kind: "line",
273
273
  length: r,
274
- anchor: E(r, n.stackAlign),
274
+ anchor: D(r, n.stackAlign),
275
275
  position: t,
276
- border: k(e)
276
+ border: A(e)
277
277
  };
278
278
  }
279
- function A(e, t, n, r, i) {
279
+ function j(e, t, n, r, i) {
280
280
  e.forEach((e, a) => {
281
- let o = t + a * n + w(e, "position");
281
+ let o = t + a * n + T(e, "position");
282
282
  switch (e.localName) {
283
283
  case "msgroup":
284
- A([...e.children], o, w(e, "shift"), r, i);
284
+ j([...e.children], o, T(e, "shift"), r, i);
285
285
  break;
286
286
  case "msline":
287
- i.push(Te(e, o, r));
287
+ i.push(we(e, o, r));
288
288
  break;
289
289
  case "mscarries":
290
- i.push(we(e, o, r));
290
+ i.push(Ce(e, o, r));
291
291
  break;
292
292
  case "msrow":
293
293
  case "mrow":
294
- i.push(D([...e.children], o, r));
294
+ i.push(O([...e.children], o, r));
295
295
  break;
296
- default: i.push(D([e], o, r));
296
+ default: i.push(O([e], o, r));
297
297
  }
298
298
  });
299
299
  }
300
- function j(e) {
300
+ function M(e) {
301
301
  return -e.anchor - e.position;
302
302
  }
303
- function M(e) {
303
+ function N(e) {
304
304
  return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
305
305
  }
306
- function N(e) {
307
- return j(e) + M(e) - 1;
306
+ function P(e) {
307
+ return M(e) + N(e) - 1;
308
308
  }
309
- function Ee(e, t, n, r) {
310
- let i = (e) => x(r.document, "mpadded", [t], {
309
+ function Te(e, t, n, r) {
310
+ let i = (e) => S(r.document, "mpadded", [t], {
311
311
  width: "0",
312
312
  ...e ? { lspace: e } : {}
313
- }), a = (e, t) => x(r.document, e, t);
313
+ }), a = (e, t) => S(r.document, e, t);
314
314
  switch (n) {
315
315
  case "s": return a("munder", [e, i("-0.5width")]);
316
316
  case "ne": return a("msup", [e, i()]);
@@ -332,49 +332,49 @@ function Ee(e, t, n, r) {
332
332
  default: return a("mover", [e, i("-0.5width")]);
333
333
  }
334
334
  }
335
- function De(e, t, n) {
336
- let r = x(n.document, "menclose", [e], {
335
+ function Ee(e, t, n) {
336
+ let r = S(n.document, "menclose", [e], {
337
337
  notation: t.join(" "),
338
338
  "data-padding": "0.1em",
339
339
  "data-thickness": "0.067em"
340
340
  }), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
341
- return i ? x(n.document, "mpadded", [r], {
341
+ return i ? S(n.document, "mpadded", [r], {
342
342
  lspace: `-${i}em`,
343
343
  width: `-${2 * i}em`
344
344
  }) : r;
345
345
  }
346
- function Oe(e, t, n, r, i) {
347
- let a = e && t.crossout.length ? De(e, t.crossout, i) : e;
346
+ function De(e, t, n, r, i) {
347
+ let a = e && t.crossout.length ? Ee(e, t.crossout, i) : e;
348
348
  if (!t.content) return a;
349
- let o = x(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
350
- return Ee(a ?? Se(i), o, n, i);
349
+ let o = S(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
350
+ return Te(a ?? xe(i), o, n, i);
351
351
  }
352
- function P(e, t) {
353
- return e.carries[t - j(e)] ?? null;
352
+ function F(e, t) {
353
+ return e.carries[t - M(e)] ?? null;
354
354
  }
355
- function ke(e, t, n, r) {
355
+ function Oe(e, t, n, r) {
356
356
  let i = e.content;
357
357
  n.forEach((e, a) => {
358
- let o = n.length - 1 - a, s = n[o], c = P(s, t), l = n.slice(0, o).some((e) => P(e, t));
358
+ let o = n.length - 1 - a, s = n[o], c = F(s, t), l = n.slice(0, o).some((e) => F(e, t));
359
359
  if (!c && !l) return;
360
360
  let u = c ?? {
361
- content: Se(r),
361
+ content: xe(r),
362
362
  location: "n",
363
363
  crossout: []
364
364
  }, d = a === 0 ? u.location : "n";
365
- i = Oe(i, u, d, s.scale, r);
365
+ i = De(i, u, d, s.scale, r);
366
366
  }), e.content = i;
367
367
  }
368
- function Ae(e, t) {
369
- let n = e.filter((e) => M(e) > 0), r = Math.min(0, ...n.map(j)), i = Math.max(r, ...n.map(N)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
368
+ function ke(e, t) {
369
+ let n = e.filter((e) => N(e) > 0), r = Math.min(0, ...n.map(M)), i = Math.max(r, ...n.map(P)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
370
370
  content: null,
371
371
  borders: {}
372
- })), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + j(e) + n), u = [], d = [], f = (e) => {
372
+ })), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + M(e) + n), u = [], d = [], f = (e) => {
373
373
  let n = c();
374
374
  e.cells.forEach((t, r) => {
375
- n[a + j(e) + r].content = t;
375
+ n[a + M(e) + r].content = t;
376
376
  }), u.length && n.forEach((e, n) => {
377
- ke(e, n - a, u, t);
377
+ Oe(e, n - a, u, t);
378
378
  });
379
379
  for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
380
380
  u = [], d = [], s.set(e, o.length), o.push(n);
@@ -394,44 +394,44 @@ function Ae(e, t) {
394
394
  origin: a
395
395
  };
396
396
  }
397
- function je(e, { rows: t }, n) {
398
- let r = x(n.document, "mtable", t.map((e) => x(n.document, "mtr", e.map((e) => {
397
+ function Ae(e, { rows: t }, n) {
398
+ let r = S(n.document, "mtable", t.map((e) => S(n.document, "mtr", e.map((e) => {
399
399
  let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
400
- return x(n.document, "mtd", [e.content], {
400
+ return S(n.document, "mtd", [e.content], {
401
401
  ...t ? { style: t } : {},
402
402
  ...e.align ? { columnalign: e.align } : {}
403
403
  });
404
404
  }))));
405
- for (let { name: t, value: n } of [...e.attributes]) xe.has(t) || r.setAttribute(t, n);
406
- let i = C(e, "charspacing") ?? "medium", a = C(e, "charalign");
407
- return r.setAttribute("columnspacing", ge[i] ?? (_e.test(i) ? i : ge.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
405
+ for (let { name: t, value: n } of [...e.attributes]) be.has(t) || r.setAttribute(t, n);
406
+ let i = w(e, "charspacing") ?? "medium", a = w(e, "charalign");
407
+ return r.setAttribute("columnspacing", x[i] ?? (ge.test(i) ? i : x.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
408
408
  }
409
- function Me(e) {
409
+ function je(e) {
410
410
  return {
411
411
  document: e.ownerDocument,
412
- stackAlign: C(e, "stackalign") ?? "decimalpoint",
412
+ stackAlign: w(e, "stackalign") ?? "decimalpoint",
413
413
  decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
414
414
  };
415
415
  }
416
- function Ne(e) {
417
- let t = Me(e), n = [];
418
- return A([...e.children], 0, 0, t, n), je(e, Ae(n, t), t);
416
+ function Me(e) {
417
+ let t = je(e), n = [];
418
+ return j([...e.children], 0, 0, t, n), Ae(e, ke(n, t), t);
419
419
  }
420
- function F(e, t, n, r, i, a) {
420
+ function I(e, t, n, r, i, a) {
421
421
  for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
422
422
  }
423
- function Pe(e, t) {
424
- let n = S(t, ")");
425
- return n.setAttribute("minsize", "1.2em"), [x(t.document, "mrow", [e, x(t.document, "mspace", [], { width: "0.2em" })]), x(t.document, "mpadded", [n], {
423
+ function Ne(e, t) {
424
+ let n = C(t, ")");
425
+ return n.setAttribute("minsize", "1.2em"), [S(t.document, "mrow", [e, S(t.document, "mspace", [], { width: "0.2em" })]), S(t.document, "mpadded", [n], {
426
426
  voffset: "0.1em",
427
427
  lspace: "-0.15em",
428
428
  depth: "-0.2em",
429
429
  height: "-0.2em"
430
430
  })];
431
431
  }
432
- function Fe(e) {
433
- let t = Me(e), [n, r, ...i] = [...e.children], a = n && !T(n) ? n : null, o = r && !T(r) ? r : null, s = C(e, "longdivstyle") ?? "lefttop", c = k(e), l = [];
434
- A(i, 0, 0, t, l);
432
+ function Pe(e) {
433
+ let t = je(e), [n, r, ...i] = [...e.children], a = n && !E(n) ? n : null, o = r && !E(r) ? r : null, s = w(e, "longdivstyle") ?? "lefttop", c = A(e), l = [];
434
+ j(i, 0, 0, t, l);
435
435
  let u = l.find((e) => e.kind === "digits");
436
436
  u || (u = {
437
437
  kind: "digits",
@@ -443,49 +443,49 @@ function Fe(e) {
443
443
  u.cells.unshift(...e), u.anchor += e.length;
444
444
  }, p = (...e) => {
445
445
  let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
446
- u.cells.push(...D(n, 0, t).cells);
446
+ u.cells.push(...O(n, 0, t).cells);
447
447
  };
448
448
  switch (s) {
449
449
  case "left/\\right":
450
- f(a, S(t, "/")), p(S(t, "\\"), o);
450
+ f(a, C(t, "/")), p(C(t, "\\"), o);
451
451
  break;
452
452
  case "left)(right":
453
- f(a, S(t, ")")), p(S(t, "("), o);
453
+ f(a, C(t, ")")), p(C(t, "("), o);
454
454
  break;
455
455
  case ":right=right":
456
- p(S(t, ":"), a, S(t, "="), o);
456
+ p(C(t, ":"), a, C(t, "="), o);
457
457
  break;
458
458
  case "righttop":
459
459
  case "stackedleftlinetop":
460
- case "lefttop": o && A([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Pe(a, t));
460
+ case "lefttop": o && j([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Ne(a, t));
461
461
  }
462
- let m = Ae(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + j(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + N(e)));
462
+ let m = ke(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + M(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + P(e)));
463
463
  switch (s) {
464
464
  case "left/\\right":
465
465
  case "left)(right":
466
466
  case ":right=right": break;
467
467
  case "righttop": {
468
468
  let e = h[g][_(u.cells.length - 1)];
469
- e.borders.left = c, e.borders.bottom = c, F(h, g, _(0), _(u.cells.length - 1), "top", c);
469
+ e.borders.left = c, e.borders.bottom = c, I(h, g, _(0), _(u.cells.length - 1), "top", c);
470
470
  break;
471
471
  }
472
472
  case "stackedleftlinetop": {
473
473
  let e = h[g][_(0)];
474
- e.borders.right = c, e.borders.bottom = c, F(h, g, _(1), v, "top", c);
474
+ e.borders.right = c, e.borders.bottom = c, I(h, g, _(1), v, "top", c);
475
475
  break;
476
476
  }
477
477
  case "stackedrightright":
478
478
  case "mediumstackedrightright":
479
479
  case "shortstackedrightright":
480
480
  case "stackedleftleft":
481
- Ie(h, g, s, a, o, c, t);
481
+ Fe(h, g, s, a, o, c, t);
482
482
  break;
483
- default: F(h, g, _(1), v, "top", c);
483
+ default: I(h, g, _(1), v, "top", c);
484
484
  }
485
- return je(e, m, t);
485
+ return Ae(e, m, t);
486
486
  }
487
- function Ie(e, t, n, r, i, a, o) {
488
- let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && x(o.document, "mpadded", [e], {
487
+ function Fe(e, t, n, r, i, a, o) {
488
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && S(o.document, "mpadded", [e], {
489
489
  lspace: "0.2em",
490
490
  width: "+0.4em"
491
491
  });
@@ -504,79 +504,79 @@ function Ie(e, t, n, r, i, a, o) {
504
504
  }) : o === t + 1 ? (u.content = l(i), n !== "shortstackedrightright" && (u.borders[c] = a)) : o > t + 1 && (n === "stackedrightright" || s) && (u.borders[c] = a), s ? e.unshift(u) : e.push(u);
505
505
  });
506
506
  }
507
- function Le(e) {
508
- for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) t.closest("math") && !t.closest("mjx-container") && t.replaceWith(t.localName === "mstack" ? Ne(t) : Fe(t));
507
+ function Ie(e) {
508
+ for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) t.closest("math") && !t.closest("mjx-container") && t.replaceWith(t.localName === "mstack" ? Me(t) : Pe(t));
509
509
  }
510
510
  // src/explorer-styles.ts
511
- var Re = "PIE-MJX-explorer-styles", I = "var(--pie-text, black)", ze = "var(--pie-background, #ffffff)", Be = "var(--pie-border-dark, #66686A)", L = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", R = `color-mix(in srgb, ${L} 15%, transparent)`, Ve = `
511
+ var Le = "PIE-MJX-explorer-styles", L = "var(--pie-text, black)", Re = "var(--pie-background, #ffffff)", ze = "var(--pie-border-dark, #66686A)", R = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", z = `color-mix(in srgb, ${R} 15%, transparent)`, Be = `
512
512
  :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
513
- color: ${I} !important;
514
- fill: ${I} !important;
513
+ color: ${L} !important;
514
+ fill: ${L} !important;
515
515
  }
516
516
  :root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
517
- background-color: ${R} !important;
517
+ background-color: ${z} !important;
518
518
  }
519
519
  :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
520
- fill: ${R} !important;
520
+ fill: ${z} !important;
521
521
  }
522
522
  :root mjx-container .mjx-selected {
523
- outline: 2px solid ${L} !important;
523
+ outline: 2px solid ${R} !important;
524
524
  }
525
525
  :root mjx-container [data-sre-highlight-2] {
526
- color: ${I} !important;
526
+ color: ${L} !important;
527
527
  background-color: transparent !important;
528
- fill: ${I} !important;
529
- outline: 2px dashed ${L} !important;
528
+ fill: ${L} !important;
529
+ outline: 2px dashed ${R} !important;
530
530
  }
531
531
  :root mjx-container rect[data-sre-highlight-2] {
532
532
  fill: transparent !important;
533
- stroke: ${L} !important;
533
+ stroke: ${R} !important;
534
534
  stroke-width: 2px !important;
535
535
  vector-effect: non-scaling-stroke;
536
536
  }
537
537
  :root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
538
- color: ${I} !important;
539
- background-color: ${ze} !important;
540
- border-color: ${Be} !important;
538
+ color: ${L} !important;
539
+ background-color: ${Re} !important;
540
+ border-color: ${ze} !important;
541
541
  }
542
542
  :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
543
- color: ${I} !important;
544
- background-color: ${R} !important;
543
+ color: ${L} !important;
544
+ background-color: ${z} !important;
545
545
  }
546
546
  `;
547
- function He(e = document) {
547
+ function Ve(e = document) {
548
548
  if (e.getElementById("PIE-MJX-explorer-styles")) return;
549
549
  let t = e.createElement("style");
550
- t.id = Re, t.textContent = Ve, e.head.appendChild(t);
550
+ t.id = Le, t.textContent = Be, e.head.appendChild(t);
551
551
  }
552
552
  // src/math-speech.ts
553
- var Ue = /[⁡-⁤]/g, We = {
553
+ var He = /[⁡-⁤]/g, Ue = {
554
554
  "+": "positive",
555
555
  "-": "negative",
556
556
  "−": "negative",
557
557
  "±": "plus or minus",
558
558
  "∓": "minus or plus"
559
- }, Ge = {
559
+ }, We = {
560
560
  "(": "open parenthesis",
561
561
  "[": "open bracket",
562
562
  "{": "open brace",
563
563
  "⟨": "open angle bracket",
564
564
  "⌊": "open floor",
565
565
  "⌈": "open ceiling"
566
- }, Ke = {
566
+ }, Ge = {
567
567
  ")": "close parenthesis",
568
568
  "]": "close bracket",
569
569
  "}": "close brace",
570
570
  "⟩": "close angle bracket",
571
571
  "⌋": "close floor",
572
572
  "⌉": "close ceiling"
573
- }, z = {
573
+ }, B = {
574
574
  "!": "factorial",
575
575
  "%": "percent",
576
576
  "°": "degrees",
577
577
  "′": "prime",
578
578
  "″": "double prime"
579
- }, qe = {
579
+ }, Ke = {
580
580
  "+": "plus",
581
581
  "-": "minus",
582
582
  "−": "minus",
@@ -620,16 +620,16 @@ var Ue = /[⁡-⁤]/g, We = {
620
620
  ":": "colon",
621
621
  "|": "vertical bar",
622
622
  "‖": "double vertical bar",
623
+ ...We,
623
624
  ...Ge,
624
- ...Ke,
625
- ...z
626
- }, Je = /* @__PURE__ */ new Set(["|", "‖"]), Ye = /* @__PURE__ */ new Set([
625
+ ...B
626
+ }, qe = /* @__PURE__ */ new Set(["|", "‖"]), Je = /* @__PURE__ */ new Set([
627
627
  "∑",
628
628
  "∏",
629
629
  "∫",
630
630
  "∪",
631
631
  "∩"
632
- ]), Xe = {
632
+ ]), Ye = {
633
633
  α: "alpha",
634
634
  β: "beta",
635
635
  γ: "gamma",
@@ -656,7 +656,7 @@ var Ue = /[⁡-⁤]/g, We = {
656
656
  cot: "cotangent",
657
657
  ln: "natural log",
658
658
  lim: "limit"
659
- }, Ze = {
659
+ }, Xe = {
660
660
  "¯": "bar",
661
661
  "‾": "bar",
662
662
  "―": "bar",
@@ -667,138 +667,138 @@ var Ue = /[⁡-⁤]/g, We = {
667
667
  "→": "vector",
668
668
  "⃗": "vector",
669
669
  "˙": "dot"
670
- }, B = (e) => (e.textContent ?? "").replace(Ue, "").replace(/\s+/g, " ").trim(), V = (e) => e.replace(/\s+/g, " ").trim(), H = (e) => [...e.children];
671
- function U(e) {
670
+ }, V = (e) => (e.textContent ?? "").replace(He, "").replace(/\s+/g, " ").trim(), H = (e) => e.replace(/\s+/g, " ").trim(), U = (e) => [...e.children];
671
+ function W(e) {
672
672
  return !e || [
673
673
  "mn",
674
674
  "mi",
675
675
  "mtext",
676
676
  "mo"
677
- ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? U(e.children[0]) : !1;
677
+ ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? W(e.children[0]) : !1;
678
678
  }
679
- function Qe(e) {
680
- let t = e ? B(e) : "";
679
+ function Ze(e) {
680
+ let t = e ? V(e) : "";
681
681
  return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
682
682
  }
683
- function $e(e) {
683
+ function Qe(e) {
684
684
  return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
685
685
  1: "st",
686
686
  2: "nd",
687
687
  3: "rd"
688
688
  }[e % 10] ?? "th"}`;
689
689
  }
690
- function et(e) {
691
- return Xe[e] ?? e;
692
- }
693
- function W(e) {
694
- return qe[e] ?? e;
690
+ function $e(e) {
691
+ return Ye[e] ?? e;
695
692
  }
696
693
  function G(e) {
694
+ return Ke[e] ?? e;
695
+ }
696
+ function K(e) {
697
697
  let t = [], n = !1;
698
698
  for (let r of e) {
699
699
  if (r.localName !== "mo") {
700
- t.push(K(r)), n = !0;
700
+ t.push(q(r)), n = !0;
701
701
  continue;
702
702
  }
703
- let e = B(r);
704
- e && (!n && We[e] ? t.push(We[e]) : e in z ? t.push(z[e]) : (t.push(W(e)), n = e in Ke || Je.has(e) && n));
703
+ let e = V(r);
704
+ e && (!n && Ue[e] ? t.push(Ue[e]) : e in B ? t.push(B[e]) : (t.push(G(e)), n = e in Ge || qe.has(e) && n));
705
705
  }
706
706
  return t.filter(Boolean).join(" ");
707
707
  }
708
- function tt(e) {
709
- let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(B(e)), a = n.slice(0, -1);
710
- if (a.length && i(t) && i(r) && B(t) === B(r) && !a.some(i)) {
711
- let e = V(G(a));
712
- return B(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
708
+ function et(e) {
709
+ let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(V(e)), a = n.slice(0, -1);
710
+ if (a.length && i(t) && i(r) && V(t) === V(r) && !a.some(i)) {
711
+ let e = H(K(a));
712
+ return V(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
713
713
  }
714
- return G(e);
714
+ return K(e);
715
715
  }
716
- function nt(e, t) {
717
- let n = e ? K(e) : "", r = t ? K(t) : "";
718
- return U(e) && U(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
716
+ function tt(e, t) {
717
+ let n = e ? q(e) : "", r = t ? q(t) : "";
718
+ return W(e) && W(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
719
719
  }
720
- function rt(e, t, n) {
720
+ function nt(e, t, n) {
721
721
  return n ? `${t} of ${e}` : `${t} of ${e} end root`;
722
722
  }
723
- function it(e, t) {
724
- let n = t ? B(t) : "";
725
- if (t && U(t)) {
723
+ function rt(e, t) {
724
+ let n = t ? V(t) : "";
725
+ if (t && W(t)) {
726
726
  if (n === "2") return `${e} squared`;
727
727
  if (n === "3") return `${e} cubed`;
728
- if (n in z) return `${e} ${z[n]}`;
728
+ if (n in B) return `${e} ${B[n]}`;
729
729
  }
730
- let r = t ? K(t) : "";
731
- return U(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
732
- }
733
- function at(e, t) {
734
- let n = t ? K(t) : "";
735
- return U(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
730
+ let r = t ? q(t) : "";
731
+ return W(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
736
732
  }
737
- function ot(e, t, n) {
738
- let r = B(e);
739
- if (r === "lim") return `limit as ${t ? K(t) : ""} of`;
740
- if (!Ye.has(r)) return;
741
- let i = t ? `from ${K(t)}` : "", a = n ? `to ${K(n)}` : "";
742
- return `${W(r)} ${i} ${a} of`;
743
- }
744
- function st(e) {
745
- let t = H(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => H(e).filter((e) => e.localName === "mtd")), r = Math.max(0, ...n.map((e) => e.length)), i = n.map((e, t) => `row ${t + 1}: ${e.map((e) => V(G(H(e)))).join(", ")}`);
733
+ function it(e, t) {
734
+ let n = t ? q(t) : "";
735
+ return W(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
736
+ }
737
+ function at(e, t, n) {
738
+ let r = V(e);
739
+ if (r === "lim") return `limit as ${t ? q(t) : ""} of`;
740
+ if (!Je.has(r)) return;
741
+ let i = t ? `from ${q(t)}` : "", a = n ? `to ${q(n)}` : "";
742
+ return `${G(r)} ${i} ${a} of`;
743
+ }
744
+ function ot(e) {
745
+ let t = U(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => U(e).filter((e) => e.localName === "mtd")), r = Math.max(0, ...n.map((e) => e.length)), i = n.map((e, t) => `row ${t + 1}: ${e.map((e) => H(K(U(e)))).join(", ")}`);
746
746
  return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
747
747
  }
748
- function ct(e) {
749
- let t = e.getAttribute("open") ?? "(", n = e.getAttribute("close") ?? ")", r = (e.getAttribute("separators") ?? ",").replace(/\s+/g, "").split(""), i = H(e).map((e, t, n) => t < n.length - 1 ? `${K(e)} ${W(r[Math.min(t, r.length - 1)] ?? ",")}` : K(e));
748
+ function st(e) {
749
+ let t = e.getAttribute("open") ?? "(", n = e.getAttribute("close") ?? ")", r = (e.getAttribute("separators") ?? ",").replace(/\s+/g, "").split(""), i = U(e).map((e, t, n) => t < n.length - 1 ? `${q(e)} ${G(r[Math.min(t, r.length - 1)] ?? ",")}` : q(e));
750
750
  return [
751
- W(t),
751
+ G(t),
752
752
  ...i,
753
- W(n)
753
+ G(n)
754
754
  ].filter(Boolean).join(" ");
755
755
  }
756
- function K(e) {
757
- let t = H(e);
756
+ function q(e) {
757
+ let t = U(e);
758
758
  switch (e.localName) {
759
- case "mi": return et(B(e));
759
+ case "mi": return $e(V(e));
760
760
  case "mn":
761
761
  case "mtext":
762
- case "ms": return B(e);
763
- case "mo": return W(B(e));
762
+ case "ms": return V(e);
763
+ case "mo": return G(V(e));
764
764
  case "mspace":
765
765
  case "mphantom":
766
766
  case "annotation":
767
767
  case "annotation-xml": return "";
768
- case "semantics": return t[0] ? K(t[0]) : "";
769
- case "mfrac": return nt(t[0], t[1]);
770
- case "msqrt": return rt(V(G(t)), "square root", t.length === 1 && U(t[0]));
768
+ case "semantics": return t[0] ? q(t[0]) : "";
769
+ case "mfrac": return tt(t[0], t[1]);
770
+ case "msqrt": return nt(H(K(t)), "square root", t.length === 1 && W(t[0]));
771
771
  case "mroot": {
772
- let e = Qe(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${$e(e)} root` : `root with index ${t[1] ? K(t[1]) : ""}`;
773
- return rt(t[0] ? K(t[0]) : "", n, U(t[0]));
772
+ let e = Ze(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Qe(e)} root` : `root with index ${t[1] ? q(t[1]) : ""}`;
773
+ return nt(t[0] ? q(t[0]) : "", n, W(t[0]));
774
774
  }
775
- case "msup": return it(t[0] ? K(t[0]) : "", t[1]);
776
- case "msub": return at(t[0] ? K(t[0]) : "", t[1]);
777
- case "msubsup": return (t[0] ? ot(t[0], t[1], t[2]) : void 0) || it(at(t[0] ? K(t[0]) : "", t[1]), t[2]);
775
+ case "msup": return rt(t[0] ? q(t[0]) : "", t[1]);
776
+ case "msub": return it(t[0] ? q(t[0]) : "", t[1]);
777
+ case "msubsup": return (t[0] ? at(t[0], t[1], t[2]) : void 0) || rt(it(t[0] ? q(t[0]) : "", t[1]), t[2]);
778
778
  case "munder":
779
779
  case "mover":
780
780
  case "munderover": {
781
- let [n, r, i] = t, a = e.localName === "mover" ? void 0 : r, o = e.localName === "munder" ? void 0 : e.localName === "mover" ? r : i, s = n ? ot(n, a, o) : void 0;
781
+ let [n, r, i] = t, a = e.localName === "mover" ? void 0 : r, o = e.localName === "munder" ? void 0 : e.localName === "mover" ? r : i, s = n ? at(n, a, o) : void 0;
782
782
  if (s) return s;
783
- let c = n ? K(n) : "", l = e.localName === "mover" && r ? Ze[B(r)] : void 0;
783
+ let c = n ? q(n) : "", l = e.localName === "mover" && r ? Xe[V(r)] : void 0;
784
784
  return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
785
785
  c,
786
- a ? `with ${K(a)} below` : "",
787
- o ? `with ${K(o)} above` : ""
786
+ a ? `with ${q(a)} below` : "",
787
+ o ? `with ${q(o)} above` : ""
788
788
  ].filter(Boolean).join(" ");
789
789
  }
790
- case "mfenced": return ct(e);
791
- case "mtable": return st(e);
790
+ case "mfenced": return st(e);
791
+ case "mtable": return ot(e);
792
792
  case "mrow":
793
- case "math": return tt(t);
794
- default: return t.length ? G(t) : B(e);
793
+ case "math": return et(t);
794
+ default: return t.length ? K(t) : V(e);
795
795
  }
796
796
  }
797
- function lt(e) {
798
- return V(K(e));
797
+ function ct(e) {
798
+ return H(q(e));
799
799
  }
800
800
  // src/math-name.ts
801
- var ut = [
801
+ var lt = [
802
802
  "a[href]",
803
803
  "button",
804
804
  "label",
@@ -817,65 +817,87 @@ var ut = [
817
817
  "tab",
818
818
  "treeitem"
819
819
  ].map((e) => `[role="${e}"]`)
820
- ].join(", "), q = "data-pie-math-name";
821
- function dt(e) {
820
+ ].join(", "), J = "data-pie-math-name";
821
+ function ut(e) {
822
822
  if (e.localName !== "label") return e;
823
823
  let t = e;
824
824
  if (t.control) return t.control;
825
825
  let n = t.getAttribute("for"), r = t.getRootNode();
826
826
  return (n ? r.getElementById?.(n) : null) ?? t.querySelector("input, select, textarea, button");
827
827
  }
828
- function ft(e, t) {
828
+ function dt(e, t) {
829
829
  let n = e.getRootNode();
830
830
  return "getElementById" in n && typeof n.getElementById == "function" ? n.getElementById(t) : n instanceof Element ? (n.id === t ? n : null) ?? n.querySelector(`[id="${CSS.escape(t)}"]`) : null;
831
831
  }
832
- function pt(e, t) {
833
- let n = dt(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
832
+ function ft(e, t) {
833
+ let n = ut(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
834
834
  if (!n?.length) return !1;
835
- let r = n.map((e) => ft(t, e)).filter((e) => e !== null);
835
+ let r = n.map((e) => dt(t, e)).filter((e) => e !== null);
836
836
  return r.length > 0 && !r.some((e) => e.contains(t));
837
837
  }
838
- function mt(e) {
839
- let t = e.getAttribute(q);
840
- t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(q));
838
+ function pt(e) {
839
+ let t = e.getAttribute(J);
840
+ t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(J));
841
841
  }
842
- function ht(e) {
843
- if (e.hasAttribute("aria-label") && !e.hasAttribute(q)) return;
844
- let t = e.closest(ut);
842
+ function mt(e) {
843
+ if (e.hasAttribute("aria-label") && !e.hasAttribute(J)) return;
844
+ let t = e.closest(lt);
845
845
  if (!t) return;
846
- if (pt(t, e)) {
847
- mt(e);
846
+ if (ft(t, e)) {
847
+ pt(e);
848
848
  return;
849
849
  }
850
850
  if (e.hasAttribute("aria-label")) return;
851
- let n = e.querySelector("math"), r = n ? lt(n) : "";
852
- r && (e.setAttribute("aria-label", r), e.setAttribute(q, r));
851
+ let n = e.querySelector("math"), r = n ? ct(n) : "";
852
+ r && (e.setAttribute("aria-label", r), e.setAttribute(J, r));
853
853
  }
854
- function J(e) {
855
- for (let t of e.querySelectorAll("mjx-container")) ht(t);
854
+ function Y(e) {
855
+ for (let t of e.querySelectorAll("mjx-container")) mt(t);
856
856
  }
857
857
  // src/speech-worker.ts
858
- var gt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
859
- function _t() {
858
+ var ht = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
859
+ function gt() {
860
860
  let e = globalThis;
861
- e[gt] || (e[gt] = !0, console.warn(`[math-rendering] MathJax's speech worker did not start, so speech, braille and the explorer are off. A content security policy must allow blob: workers, and scripts and fetches from the asset root. See ${t}`));
861
+ e[ht] || (e[ht] = !0, console.warn(`[math-rendering] MathJax's speech worker did not start, so speech, braille and the explorer are off. A content security policy must allow blob: workers, and scripts and fetches from the asset root. See ${t}`));
862
862
  }
863
- function vt(e) {
863
+ function _t(e) {
864
864
  let t = e.webworker;
865
865
  if (!t || t.ready) return;
866
866
  e.options ??= {};
867
867
  let n = e.options;
868
- n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), _t();
868
+ n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), gt();
869
869
  }
870
- function yt(e) {
870
+ function vt(e, t) {
871
+ let n = () => {
872
+ for (let e of t) URL.revokeObjectURL(e);
873
+ };
874
+ e.addEventListener("message", n, { once: !0 }), e.addEventListener("error", n, { once: !0 }), setTimeout(n, 1e4);
875
+ }
876
+ async function yt(e, t, n, r) {
877
+ let i = [], a = URL.revokeObjectURL.bind(URL);
878
+ URL.revokeObjectURL = (e) => {
879
+ i.push(e);
880
+ };
881
+ let o;
882
+ try {
883
+ o = await e.call(t, n, r);
884
+ } catch (e) {
885
+ for (let e of i) a(e);
886
+ throw e;
887
+ } finally {
888
+ URL.revokeObjectURL = a;
889
+ }
890
+ return vt(o, i), o;
891
+ }
892
+ function bt(e) {
871
893
  let t = e?.adaptor, n = t?.createWorker;
872
894
  e && t && n && (t.createWorker = async (r, i) => {
873
- let a = await n.call(t, r, i);
874
- return a.addEventListener("error", () => vt(e), { once: !0 }), a;
895
+ let a = await yt(n, t, r, i);
896
+ return a.addEventListener("error", () => _t(e), { once: !0 }), a;
875
897
  });
876
898
  }
877
899
  // src/tex-dialect.ts
878
- var bt = {
900
+ var xt = {
879
901
  parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
880
902
  overarc: "\\overparen",
881
903
  napprox: "\\not\\approx",
@@ -883,49 +905,49 @@ var bt = {
883
905
  abs: ["\\left|#1\\right|", 1],
884
906
  perpendicular: "\\perp",
885
907
  divide: "\\div"
886
- }, xt = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, St = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, Ct = /\\embed\{newLine\}\[\]/g, wt = [
908
+ }, St = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, Ct = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, wt = /\\embed\{newLine\}\[\]/g, Tt = [
887
909
  ["$$", "$$"],
888
910
  ["$", "$"],
889
911
  ["\\[", "\\]"],
890
912
  ["\\(", "\\)"]
891
913
  ];
892
- function Tt(e) {
893
- for (let [t, n] of wt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
914
+ function Et(e) {
915
+ for (let [t, n] of Tt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
894
916
  return e;
895
917
  }
896
- function Et(e) {
897
- return `\\(${Tt(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e)}\\)`.replace(Ct, "\\newline ");
918
+ function Dt(e) {
919
+ return `\\(${Et(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e)}\\)`.replace(wt, "\\newline ");
898
920
  }
899
- var Dt = "mathjax_ignore", Ot = "mathjax_process", kt = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", At = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), jt = "MJX-CHTML-styles", Mt = "PIE-MJX-SVG-styles", Y = "PIE-MathJax-Menu-Settings", Nt = { "mjx-container[overflow=\"linebreak\"][display]": {
921
+ var Ot = "mathjax_ignore", kt = "mathjax_process", At = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", jt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), Mt = "MJX-CHTML-styles", Nt = "PIE-MJX-SVG-styles", X = "PIE-MathJax-Menu-Settings", Pt = { "mjx-container[overflow=\"linebreak\"][display]": {
900
922
  overflow: "auto clip",
901
923
  "min-width": "initial !important"
902
- } }, Pt = { "mjx-over > mjx-mo > mjx-stretchy-h.mjx-c2015": {
924
+ } }, Ft = { "mjx-over > mjx-mo > mjx-stretchy-h.mjx-c2015": {
903
925
  position: "relative",
904
926
  top: "-0.13em"
905
- } }, Ft = 200, It = 201, Lt = 202;
906
- function X(e) {
927
+ } }, It = 200, Lt = 201, Rt = 202;
928
+ function Z(e) {
907
929
  let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
908
930
  for (let e of t) for (let t of [e, ...e.querySelectorAll("[data-latex],[data-latex-item]")]) t.removeAttribute("data-latex"), t.removeAttribute("data-latex-item");
909
931
  }
910
- function Rt(e, t) {
911
- let n = e.closest(`.${Dt}, .${Ot}`);
932
+ function zt(e, t) {
933
+ let n = e.closest(`.${Ot}, .${kt}`);
912
934
  return n !== null && t.contains(n) && !n.classList.contains("mathjax_process");
913
935
  }
914
- function zt(e) {
936
+ function Bt(e) {
915
937
  for (let t of e.querySelectorAll("[data-latex]")) {
916
- if (t.dataset.mathHandled || t.closest("mjx-container") || t.closest("math") || Rt(t, e)) continue;
938
+ if (t.dataset.mathHandled || t.closest("mjx-container") || t.closest("math") || zt(t, e)) continue;
917
939
  let n = t.textContent;
918
- n && (t.textContent = Et(n), t.dataset.mathHandled = "true");
940
+ n && (t.textContent = Dt(n), t.dataset.mathHandled = "true");
919
941
  }
920
942
  }
921
- function Bt(e) {
943
+ function Vt(e) {
922
944
  for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
923
945
  }
924
- function Vt(e, t) {
946
+ function Ht(e, t) {
925
947
  for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
926
- return (t ? St : xt).test(e.textContent ?? "");
948
+ return (t ? Ct : St).test(e.textContent ?? "");
927
949
  }
928
- function Ht(e) {
950
+ function Ut(e) {
929
951
  return new Promise((t, n) => {
930
952
  let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, c = d(e, import.meta.url), l = s(), u = {
931
953
  loader: {
@@ -933,17 +955,17 @@ function Ht(e) {
933
955
  failed: (e) => n(e),
934
956
  "output/svg": { ready: (e) => {
935
957
  let t = y();
936
- return Ut(t) && Wt(t), e;
958
+ return Wt(t) && Gt(t), e;
937
959
  } }
938
960
  },
939
961
  startup: {
940
962
  typeset: !1,
941
963
  ready: () => {
942
- let e = y(), r = e?.startup, i = Ut(e);
943
- i && (Wt(e), Gt(e, c.speechLocales), f(e?._?.a11y?.sre_ts?.locales, c.speechLocales)), r?.defaultReady?.(), i && (Kt(r?.document), qt(r?.document), r?.document?.addStyles?.(Nt), r?.document?.addStyles?.(Pt), yt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
964
+ let e = y(), r = e?.startup, i = Wt(e);
965
+ i && (Gt(e), Kt(e, c.speechLocales), f(e?._?.a11y?.sre_ts?.locales, c.speechLocales)), r?.defaultReady?.(), i && (qt(r?.document), Jt(r?.document), r?.document?.addStyles?.(Pt), r?.document?.addStyles?.(Ft), bt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
944
966
  }
945
967
  },
946
- tex: { macros: { ...bt } },
968
+ tex: { macros: { ...xt } },
947
969
  output: { displayOverflow: "linebreak" },
948
970
  options: {
949
971
  enableMenu: i,
@@ -955,7 +977,7 @@ function Ht(e) {
955
977
  a11y: { inTabOrder: l }
956
978
  }
957
979
  };
958
- r && u.tex && (console.warn(kt), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
980
+ r && u.tex && (console.warn(At), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
959
981
  let m = p(c.speechLocales);
960
982
  m && u.options && (u.options.sre = { locale: m }), ae(u, {
961
983
  ...c,
@@ -965,86 +987,86 @@ function Ht(e) {
965
987
  }, n);
966
988
  });
967
989
  }
968
- function Ut(e) {
990
+ function Wt(e) {
969
991
  return !!e?.version?.startsWith("4.");
970
992
  }
971
- function Wt(e) {
993
+ function Gt(e) {
972
994
  let t = e?._?.output, n = t?.chtml_ts?.CHTML;
973
- n && (n.STYLESHEETID = b);
995
+ n && (n.STYLESHEETID = se);
974
996
  let r = t?.svg_ts?.SVG;
975
- r && (r.STYLESHEETID = Mt);
997
+ r && (r.STYLESHEETID = Nt);
976
998
  }
977
- function Gt(e, t) {
999
+ function Kt(e, t) {
978
1000
  let n = e?._?.ui?.menu?.Menu?.Menu;
979
1001
  if (n) {
980
- n.MENU_STORAGE = Y;
1002
+ n.MENU_STORAGE = X;
981
1003
  try {
982
- let e = localStorage.getItem(Y);
1004
+ let e = localStorage.getItem(X);
983
1005
  if (!e) return;
984
1006
  let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
985
1007
  if (n === void 0 && a) return;
986
- a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Y, JSON.stringify(i)) : localStorage.removeItem(Y);
1008
+ a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(X, JSON.stringify(i)) : localStorage.removeItem(X);
987
1009
  } catch {}
988
1010
  }
989
1011
  }
990
- function Kt(e) {
1012
+ function qt(e) {
991
1013
  if (!e) return;
992
1014
  let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
993
1015
  let n = e.typesetRoot;
994
- n && !t.has(n) && (X(n), t.add(n));
1016
+ n && !t.has(n) && (Z(n), t.add(n));
995
1017
  };
996
- e.addRenderAction?.("pie-strip-latex", It, (e) => {
1018
+ e.addRenderAction?.("pie-strip-latex", Lt, (e) => {
997
1019
  for (let t of e.math ?? []) n(t);
998
1020
  return !1;
999
1021
  }, (e) => {
1000
1022
  let t = e.typesetRoot;
1001
- return t && X(t), !1;
1023
+ return t && Z(t), !1;
1002
1024
  });
1003
1025
  let r = e.outputJax?.chtmlStyles;
1004
- r?.id === jt && (r.id = b), Yt();
1026
+ r?.id === Mt && (r.id = se), Zt();
1005
1027
  }
1006
- function qt(e) {
1028
+ function Jt(e) {
1007
1029
  let t = (e) => {
1008
- e.typesetRoot && ht(e.typesetRoot);
1030
+ e.typesetRoot && mt(e.typesetRoot);
1009
1031
  };
1010
- e?.addRenderAction?.("pie-name-math", Lt, (e) => {
1032
+ e?.addRenderAction?.("pie-name-math", Rt, (e) => {
1011
1033
  for (let n of e.math ?? []) t(n);
1012
1034
  return !1;
1013
1035
  }, (e) => (t(e), !1));
1014
1036
  }
1015
- function Jt(e) {
1016
- return e instanceof HTMLStyleElement && se.includes(e.id);
1037
+ function Yt(e) {
1038
+ return e instanceof HTMLStyleElement && ce.includes(e.id);
1017
1039
  }
1018
- function Z(e) {
1040
+ function Xt(e) {
1019
1041
  ne("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
1020
1042
  }
1021
- function Yt() {
1022
- let e = document.head, t = [...e.children].find(Jt);
1043
+ function Zt() {
1044
+ let e = document.head, t = [...e.children].find(Yt);
1023
1045
  if (t) {
1024
- Z(t);
1046
+ Xt(t);
1025
1047
  return;
1026
1048
  }
1027
1049
  let n = new MutationObserver((e) => {
1028
1050
  for (let t of e) {
1029
- let e = [...t.addedNodes].find(Jt);
1051
+ let e = [...t.addedNodes].find(Yt);
1030
1052
  if (e) {
1031
- Z(e), n.disconnect();
1053
+ Xt(e), n.disconnect();
1032
1054
  return;
1033
1055
  }
1034
1056
  }
1035
1057
  });
1036
1058
  n.observe(e, { childList: !0 });
1037
1059
  }
1038
- function Xt(e) {
1060
+ function Qt(e) {
1039
1061
  let t = e?.math;
1040
1062
  if (!t?.remove) return;
1041
- let n = [...t].filter((e) => (e.state?.() ?? 0) >= Ft && e.typesetRoot?.isConnected === !1);
1063
+ let n = [...t].filter((e) => (e.state?.() ?? 0) >= It && e.typesetRoot?.isConnected === !1);
1042
1064
  if (n.length !== 0) {
1043
1065
  for (let e of [...n].reverse()) e.clear?.();
1044
1066
  t.remove(...n);
1045
1067
  }
1046
1068
  }
1047
- function Zt(e) {
1069
+ function $t(e) {
1048
1070
  return new Promise((t, n) => {
1049
1071
  let r = e.startup ?? {};
1050
1072
  e.startup = r;
@@ -1055,81 +1077,81 @@ function Zt(e) {
1055
1077
  };
1056
1078
  });
1057
1079
  }
1058
- function Qt(e) {
1080
+ function en(e) {
1059
1081
  let t = y();
1060
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Zt(t) : Ht(e);
1082
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : $t(t) : Ut(e);
1061
1083
  }
1062
- function $t(e) {
1063
- return Qt(e).then(() => {
1084
+ function tn(e) {
1085
+ return en(e).then(() => {
1064
1086
  let e = y();
1065
1087
  e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
1066
1088
  });
1067
1089
  }
1068
- function en(e) {
1069
- let t = oe, n = t[At];
1070
- return n || (n = $t(e), t[At] = n), n;
1090
+ function nn(e) {
1091
+ let t = oe, n = t[jt];
1092
+ return n || (n = tn(e), t[jt] = n), n;
1071
1093
  }
1072
- function tn(e = {}) {
1094
+ function rn(e = {}) {
1073
1095
  let t = e.useSingleDollar ?? !1;
1074
1096
  return async (n) => {
1075
1097
  if (typeof window > "u") return;
1076
- let r = ce();
1077
- r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), zt(n), fe(n), Bt(n), Le(n);
1078
- let i = en(e);
1079
- if (!Vt(n, t)) {
1080
- i.catch(() => {}), J(n);
1098
+ let r = le();
1099
+ r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), Bt(n), pe(n), Vt(n), Ie(n);
1100
+ let i = nn(e);
1101
+ if (!Ht(n, t)) {
1102
+ i.catch(() => {}), Y(n);
1081
1103
  return;
1082
1104
  }
1083
1105
  await i;
1084
1106
  let a = y();
1085
1107
  if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
1086
- He(), Xt(a.startup?.document);
1108
+ Ve(), Qt(a.startup?.document);
1087
1109
  try {
1088
1110
  await a.typesetPromise([n]);
1089
1111
  } catch (e) {
1090
1112
  throw a.typesetClear?.([n]), e;
1091
1113
  }
1092
- X(n), J(n);
1114
+ Z(n), Y(n);
1093
1115
  }
1094
1116
  };
1095
1117
  }
1096
- function nn() {
1118
+ function an() {
1097
1119
  return [];
1098
1120
  }
1099
1121
  // src/render-math.ts
1100
- var rn = "@pie-lib/math-rendering", an = "@pie-lib/math-rendering@2", on = "pie-print", sn = 50, cn = 1e4, ln = null;
1101
- function un() {
1102
- return !!window[an]?.opts?.useSingleDollar;
1122
+ var on = "@pie-lib/math-rendering", sn = "@pie-lib/math-rendering@2", cn = "pie-print", ln = 50, un = 1e4, dn = null;
1123
+ function fn() {
1124
+ return !!window[sn]?.opts?.useSingleDollar;
1103
1125
  }
1104
- function dn() {
1105
- return ln ||= tn({ useSingleDollar: un() }), ln;
1126
+ function pn() {
1127
+ return dn ||= rn({ useSingleDollar: fn() }), dn;
1106
1128
  }
1107
1129
  function Q() {
1108
1130
  if (typeof window > "u") return null;
1109
- let e = window[rn];
1131
+ let e = window[on];
1110
1132
  return typeof e?.renderMath == "function" && e.renderMath !== $ ? e : null;
1111
1133
  }
1112
- function fn(e) {
1134
+ function mn(e) {
1113
1135
  let t = e;
1114
1136
  for (; t;) {
1115
- if (t instanceof Element && t.localName === on) return t;
1137
+ if (t instanceof Element && t.localName === cn) return t;
1116
1138
  t = t instanceof ShadowRoot ? t.host : t.parentNode;
1117
1139
  }
1118
1140
  return null;
1119
1141
  }
1120
- function pn() {
1142
+ function hn() {
1121
1143
  let e = window.renderMath;
1122
1144
  return typeof e == "function" ? e : null;
1123
1145
  }
1124
- async function mn(e) {
1125
- let t = fn(e);
1146
+ async function gn(e) {
1147
+ let t = mn(e);
1126
1148
  if (!t) return null;
1127
- let n = pn();
1149
+ let n = hn();
1128
1150
  if (n || t.mathRenderingModuleUrlImported !== !0) return n;
1129
- let r = Date.now() + cn;
1151
+ let r = Date.now() + un;
1130
1152
  for (; Date.now() < r;) {
1131
- await new Promise((e) => setTimeout(e, sn));
1132
- let e = pn();
1153
+ await new Promise((e) => setTimeout(e, ln));
1154
+ let e = hn();
1133
1155
  if (e) return e;
1134
1156
  }
1135
1157
  return null;
@@ -1138,14 +1160,14 @@ var $ = async (e) => {
1138
1160
  if (typeof window > "u") return;
1139
1161
  let t = typeof e == "string", n;
1140
1162
  t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
1141
- let r = Q(), i = r || t ? null : await mn(n);
1142
- return r ? (await r.renderMath?.(n), J(n)) : i && i !== $ ? (await i(n), J(n)) : await dn()(n), t ? n.innerHTML : void 0;
1143
- }, hn = (e, t) => {
1163
+ let r = Q(), i = r || t ? null : await gn(n);
1164
+ return r ? (await r.renderMath?.(n), Y(n)) : i && i !== $ ? (await i(n), Y(n)) : await pn()(n), t ? n.innerHTML : void 0;
1165
+ }, _n = (e, t) => {
1144
1166
  let n = Q()?.wrapMath?.(e, t);
1145
1167
  if (n != null) return n;
1146
1168
  let [r, i] = t === "dollar" || t === "double_dollar" ? ["$", "$"] : ["\\(", "\\)"];
1147
- return `${r}${Tt(e)}${i}`;
1148
- }, gn = (e) => {
1169
+ return `${r}${Et(e)}${i}`;
1170
+ }, vn = (e) => {
1149
1171
  let t = e.trim();
1150
1172
  return t.startsWith("\\[") && t.endsWith("\\]") ? {
1151
1173
  unwrapped: t.slice(2, -2).trim(),
@@ -1172,35 +1194,35 @@ var $ = async (e) => {
1172
1194
  close: "$"
1173
1195
  }
1174
1196
  } : { unwrapped: t };
1175
- }, _n = (e) => Q()?.mmlToLatex?.(e) ?? e, vn = /\sdata-latex(?:-item)?="[^"]*"/g, yn = /<merror|<mtext[^>]*mathcolor="red"[^>]*>\\/;
1176
- function bn(e, t) {
1197
+ }, yn = (e) => Q()?.mmlToLatex?.(e) ?? e, bn = /\sdata-latex(?:-item)?="[^"]*"/g, xn = /<merror|<mtext[^>]*mathcolor="red"[^>]*>\\/;
1198
+ function Sn(e, t) {
1177
1199
  let n = Q()?.renderMath;
1178
1200
  if (typeof n != "function") return null;
1179
1201
  let [r, i] = t.display ? ["\\[", "\\]"] : ["\\(", "\\)"], a = `<span data-latex="" data-raw="${e.replace(/&/g, "&amp;").replace(/"/g, "&quot;")}">${r}${e}${i}</span>`;
1180
1202
  try {
1181
1203
  let e = n(a, { skipWaitForMathRenderingLib: !0 });
1182
1204
  if (typeof e?.then == "function") return e.catch(() => {}), null;
1183
- let t = typeof e == "string" && e !== a ? e.replace(/\n\s*/g, "").replace(vn, "") : "";
1184
- return t.startsWith("<math") && !yn.test(t) ? t : null;
1205
+ let t = typeof e == "string" && e !== a ? e.replace(/\n\s*/g, "").replace(bn, "") : "";
1206
+ return t.startsWith("<math") && !xn.test(t) ? t : null;
1185
1207
  } catch {
1186
1208
  return null;
1187
1209
  }
1188
1210
  }
1189
- var xn = (e, t = {}) => {
1211
+ var Cn = (e, t = {}) => {
1190
1212
  let n = Q()?.latexToMml;
1191
- if (n && n !== xn) try {
1213
+ if (n && n !== Cn) try {
1192
1214
  return n(e, t) ?? null;
1193
1215
  } catch {
1194
1216
  return null;
1195
1217
  }
1196
1218
  let r = y();
1197
- if (!r?.tex2mml || !r.startup?.document) return bn(e, t);
1219
+ if (!r?.tex2mml || !r.startup?.document) return Sn(e, t);
1198
1220
  try {
1199
1221
  r.texReset?.();
1200
- let n = r.tex2mml(e, { display: !!t.display })?.replace(/\n\s*/g, "").replace(vn, "");
1201
- return n && !yn.test(n) ? n : null;
1222
+ let n = r.tex2mml(e, { display: !!t.display })?.replace(/\n\s*/g, "").replace(bn, "");
1223
+ return n && !xn.test(n) ? n : null;
1202
1224
  } catch {
1203
1225
  return null;
1204
1226
  }
1205
1227
  };
1206
- export { ee as MATHJAX_CONFLICT_EVENT, m as NO_ASSET_ROOT_EVENT, v as UNSUPPORTED_PAGE_DOCS_URL, tn as createMathjaxRenderer, nn as getMathjaxCssUrls, xn as latexToMml, _n as mmlToLatex, $ as renderMath, lt as speakMathml, gn as unWrapMath, hn as wrapMath };
1228
+ export { ee as MATHJAX_CONFLICT_EVENT, m as NO_ASSET_ROOT_EVENT, v as UNSUPPORTED_PAGE_DOCS_URL, rn as createMathjaxRenderer, an as getMathjaxCssUrls, Cn as latexToMml, yn as mmlToLatex, $ as renderMath, ct as speakMathml, vn as unWrapMath, _n as wrapMath };