@pie-element/shared-math-rendering-mathjax 0.1.5-next.20261008072957 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -22,7 +22,10 @@ function s() {
22
22
  let e = globalThis[n]?.opts;
23
23
  return e && typeof e == "object" ? e : {};
24
24
  }
25
- function c(e) {
25
+ function c() {
26
+ return s().inTabOrder === !0;
27
+ }
28
+ function l(e) {
26
29
  if (typeof e != "string" || !e) return;
27
30
  let t = typeof document > "u" ? void 0 : document.baseURI;
28
31
  try {
@@ -31,50 +34,50 @@ function c(e) {
31
34
  return;
32
35
  }
33
36
  }
34
- function l(e) {
37
+ function u(e) {
35
38
  if (!e || typeof e != "object") return;
36
39
  let t = /* @__PURE__ */ new Map();
37
40
  for (let [n, r] of Object.entries(e)) {
38
- let e = c(r);
41
+ let e = l(r);
39
42
  e && t.set(n, e);
40
43
  }
41
44
  return t.size ? t : void 0;
42
45
  }
43
- function u(e) {
46
+ function d(e) {
44
47
  if (Array.isArray(e)) return new Map(e.filter((e) => typeof e == "string").map((e) => [e, void 0]));
45
48
  if (e && typeof e == "object") return new Map(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? t : void 0]));
46
49
  }
47
- function d(e, t) {
48
- let n = s(), r = c(e.assetRoot ?? n.assetRoot) ?? o(t);
50
+ function f(e, t) {
51
+ let n = s(), r = l(e.assetRoot ?? n.assetRoot) ?? o(t);
49
52
  return {
50
53
  root: r,
51
- speechPath: c(e.speechPath ?? n.speechPath) ?? (r ? `${r}/${i}` : void 0),
52
- speechLocales: u(e.speechLocales ?? n.speechLocales),
53
- urls: l(e.assetUrls ?? n.assetUrls)
54
+ speechPath: l(e.speechPath ?? n.speechPath) ?? (r ? `${r}/${i}` : void 0),
55
+ speechLocales: d(e.speechLocales ?? n.speechLocales),
56
+ urls: u(e.assetUrls ?? n.assetUrls)
54
57
  };
55
58
  }
56
- function f(e, t) {
59
+ function p(e, t) {
57
60
  if (!(!e || !t)) {
58
61
  for (let n of [...e.keys()]) !t.has(n) && !r.includes(n) && e.delete(n);
59
62
  for (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);
60
63
  }
61
64
  }
62
- function p(e) {
65
+ function m(e) {
63
66
  if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !r.includes(e));
64
67
  }
65
- var m = "pie-mathjax-no-asset-root", h = {
68
+ var h = "pie-mathjax-no-asset-root", g = {
66
69
  untypeset: "no MathJax loads, so math stays untypeset",
67
70
  "no-web-fonts": "math renders without web fonts",
68
71
  "no-web-fonts-or-speech": "math renders without web fonts and speech"
69
- }, g = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
70
- function _(e) {
72
+ }, _ = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
73
+ function v(e) {
71
74
  let r = globalThis;
72
- r[g] ??= [];
73
- let i = r[g];
75
+ r[_] ??= [];
76
+ let i = r[_];
74
77
  if (i.includes(e)) return;
75
78
  i.push(e);
76
- let a = `[math-rendering] No asset root for MathJax: ${h[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;
77
- e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent(m, { detail: {
79
+ let a = `[math-rendering] No asset root for MathJax: ${g[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;
80
+ e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent(h, { detail: {
78
81
  effect: e,
79
82
  message: a,
80
83
  docsUrl: t
@@ -82,34 +85,34 @@ function _(e) {
82
85
  }
83
86
  //#endregion
84
87
  //#region src/unsupported-page.ts
85
- var v = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", ee = "pie-mathjax-version-conflict", te = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
86
- function ne(e, t) {
88
+ var y = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", ee = "pie-mathjax-version-conflict", b = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
89
+ function te(e, t) {
87
90
  if (typeof window > "u") return;
88
91
  let n = globalThis;
89
- n[te] ??= {
92
+ n[b] ??= {
90
93
  logged: !1,
91
94
  conditions: []
92
95
  };
93
- let r = n[te];
96
+ let r = n[b];
94
97
  if (r.conditions.includes(e)) return;
95
98
  r.conditions.push(e);
96
- let i = `[math-rendering] Unsupported page (${e}): ${t}. PIE supports one MathJax major version per page; with MathJax 3 and 4 on one page, math rendering is best effort and may break. See ${v}`;
99
+ let i = `[math-rendering] Unsupported page (${e}): ${t}. PIE supports one MathJax major version per page; with MathJax 3 and 4 on one page, math rendering is best effort and may break. See ${y}`;
97
100
  r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(ee, { detail: {
98
101
  condition: e,
99
102
  message: i,
100
- docsUrl: v
103
+ docsUrl: y
101
104
  } }));
102
105
  }
103
- function re() {
106
+ function ne() {
104
107
  let e = window.MathJax?.version;
105
108
  return typeof e == "string" && e.startsWith("3.") ? e : void 0;
106
109
  }
107
110
  //#endregion
108
111
  //#region src/engine/page.ts
109
- function y() {
112
+ function x() {
110
113
  return window.MathJax;
111
114
  }
112
- function ie(t, { root: n, speechPath: r }) {
115
+ function re(t, { root: n, speechPath: r }) {
113
116
  n && (t.loader = {
114
117
  ...t.loader,
115
118
  paths: {
@@ -125,15 +128,15 @@ function ie(t, { root: n, speechPath: r }) {
125
128
  }
126
129
  });
127
130
  }
128
- function ae(e, t) {
131
+ function ie(e, t) {
129
132
  let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
130
- return n ? (ie(e, t), new Promise((t, r) => {
133
+ return n ? (re(e, t), new Promise((t, r) => {
131
134
  window.MathJax = e;
132
135
  let i = document.createElement("script");
133
136
  i.src = n, i.async = !0, i.onload = () => t(!0), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
134
- })) : (_("untypeset"), Promise.resolve(!1));
137
+ })) : (v("untypeset"), Promise.resolve(!1));
135
138
  }
136
- 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-]*$/;
139
+ var ae = globalThis, oe = "PIE-MJX-CHTML-styles", se = ["MJX-CHTML-styles", "MJX-SVG-styles"], ce = ne, le = "http://www.w3.org/1998/Math/MathML", ue = /^([a-z_][\w.-]*):math$/, de = /^[a-z][a-z0-9-]*$/;
137
140
  function fe(e) {
138
141
  for (let t of e.querySelectorAll("*")) {
139
142
  let n = ue.exec(t.tagName.toLowerCase())?.[1];
@@ -162,46 +165,46 @@ var me = /* @__PURE__ */ new Set([
162
165
  thin: "0.035em",
163
166
  medium: "0.07em",
164
167
  thick: "0.14em"
165
- }, ge = {
168
+ }, S = {
166
169
  tight: "0em",
167
170
  medium: "0.1em",
168
171
  loose: "0.2em"
169
- }, _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([
172
+ }, C = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, ge = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, _e = /^(\d+(\.\d*)?|\.\d+)$/, ve = /* @__PURE__ */ new Set([
170
173
  "mn",
171
174
  "mo",
172
175
  "mi",
173
176
  "mtext"
174
- ]), xe = /* @__PURE__ */ new Set([
177
+ ]), ye = /* @__PURE__ */ new Set([
175
178
  "stackalign",
176
179
  "charalign",
177
180
  "charspacing",
178
181
  "longdivstyle"
179
182
  ]);
180
- function x(e, t, n = [], r = {}) {
183
+ function w(e, t, n = [], r = {}) {
181
184
  let i = e.createElementNS(le, t);
182
185
  for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
183
186
  for (let e of n) e && i.appendChild(e);
184
187
  return i;
185
188
  }
186
- function S(e, t) {
187
- let n = x(e.document, "mo");
189
+ function T(e, t) {
190
+ let n = w(e.document, "mo");
188
191
  return n.textContent = t, n;
189
192
  }
190
- function Se(e) {
191
- let t = x(e.document, "mn");
192
- return t.textContent = "0", x(e.document, "mphantom", [t]);
193
+ function be(e) {
194
+ let t = w(e.document, "mn");
195
+ return t.textContent = "0", w(e.document, "mphantom", [t]);
193
196
  }
194
- function C(e, t) {
197
+ function E(e, t) {
195
198
  return e.getAttribute(t)?.trim().toLowerCase() || void 0;
196
199
  }
197
- function w(e, t) {
200
+ function D(e, t) {
198
201
  let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
199
202
  return Number.isFinite(n) ? n : 0;
200
203
  }
201
- function T(e) {
204
+ function O(e) {
202
205
  return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
203
206
  }
204
- function E(e, t, n = e) {
207
+ function k(e, t, n = e) {
205
208
  switch (t) {
206
209
  case "left": return 0;
207
210
  case "center": return Math.floor(e / 2);
@@ -209,14 +212,14 @@ function E(e, t, n = e) {
209
212
  default: return n;
210
213
  }
211
214
  }
212
- function D(e, t, n) {
215
+ function A(e, t, n) {
213
216
  let r = [], i, a, o = (e, t) => {
214
217
  let s = (e) => t.reduceRight((e, t) => {
215
218
  let n = t.cloneNode(!1);
216
219
  return n.appendChild(e), n;
217
220
  }, e);
218
221
  if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
219
- else if (T(e)) r.push(null);
222
+ else if (O(e)) r.push(null);
220
223
  else if (e.localName === "mn" && e.children.length === 0) {
221
224
  let t = [...(e.textContent ?? "").trim()];
222
225
  for (let a of t) {
@@ -225,28 +228,28 @@ function D(e, t, n) {
225
228
  t.textContent = a, r.push(s(t));
226
229
  }
227
230
  t.length && (a ??= r.length);
228
- } else be.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
231
+ } else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
229
232
  };
230
233
  for (let t of e) o(t, []);
231
234
  return {
232
235
  kind: "digits",
233
236
  cells: r,
234
- anchor: E(r.length, n.stackAlign, i ?? a),
237
+ anchor: k(r.length, n.stackAlign, i ?? a),
235
238
  position: t
236
239
  };
237
240
  }
238
- function O(e) {
241
+ function xe(e) {
239
242
  return (e ?? "").toLowerCase().split(/\s+/).filter((e) => me.has(e));
240
243
  }
241
- function Ce(e, t) {
242
- let n = [...e.children].filter((e) => !T(e));
243
- return n.length <= 1 ? n[0] ?? null : x(t.document, "mrow", n);
244
+ function Se(e, t) {
245
+ let n = [...e.children].filter((e) => !O(e));
246
+ return n.length <= 1 ? n[0] ?? null : w(t.document, "mrow", n);
244
247
  }
245
- function we(e, t, n) {
246
- let r = C(e, "location") ?? "n", i = O(e.getAttribute("crossout")), a = [...e.children].map((e) => T(e) ? null : e.localName === "mscarry" ? {
247
- content: Ce(e, n),
248
- location: C(e, "location") ?? r,
249
- crossout: e.hasAttribute("crossout") ? O(e.getAttribute("crossout")) : i
248
+ function Ce(e, t, n) {
249
+ let r = E(e, "location") ?? "n", i = xe(e.getAttribute("crossout")), a = [...e.children].map((e) => O(e) ? null : e.localName === "mscarry" ? {
250
+ content: Se(e, n),
251
+ location: E(e, "location") ?? r,
252
+ crossout: e.hasAttribute("crossout") ? xe(e.getAttribute("crossout")) : i
250
253
  } : {
251
254
  content: e,
252
255
  location: r,
@@ -255,60 +258,60 @@ function we(e, t, n) {
255
258
  return {
256
259
  kind: "carries",
257
260
  carries: a,
258
- anchor: E(a.length, n.stackAlign),
261
+ anchor: k(a.length, n.stackAlign),
259
262
  position: t,
260
- scale: ye.test(o) ? o : "0.6"
263
+ scale: _e.test(o) ? o : "0.6"
261
264
  };
262
265
  }
263
- function k(e) {
264
- let t = C(e, "mslinethickness") ?? "medium", n = he[t] ?? (_e.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
265
- return `${n} solid ${ve.test(r) ? r : "currentColor"}`;
266
+ function we(e) {
267
+ let t = E(e, "mslinethickness") ?? "medium", n = he[t] ?? (C.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
268
+ return `${n} solid ${ge.test(r) ? r : "currentColor"}`;
266
269
  }
267
270
  function Te(e, t, n) {
268
- let r = Math.max(0, w(e, "length"));
271
+ let r = Math.max(0, D(e, "length"));
269
272
  return {
270
273
  kind: "line",
271
274
  length: r,
272
- anchor: E(r, n.stackAlign),
275
+ anchor: k(r, n.stackAlign),
273
276
  position: t,
274
- border: k(e)
277
+ border: we(e)
275
278
  };
276
279
  }
277
- function A(e, t, n, r, i) {
280
+ function j(e, t, n, r, i) {
278
281
  e.forEach((e, a) => {
279
- let o = t + a * n + w(e, "position");
282
+ let o = t + a * n + D(e, "position");
280
283
  switch (e.localName) {
281
284
  case "msgroup":
282
- A([...e.children], o, w(e, "shift"), r, i);
285
+ j([...e.children], o, D(e, "shift"), r, i);
283
286
  break;
284
287
  case "msline":
285
288
  i.push(Te(e, o, r));
286
289
  break;
287
290
  case "mscarries":
288
- i.push(we(e, o, r));
291
+ i.push(Ce(e, o, r));
289
292
  break;
290
293
  case "msrow":
291
294
  case "mrow":
292
- i.push(D([...e.children], o, r));
295
+ i.push(A([...e.children], o, r));
293
296
  break;
294
- default: i.push(D([e], o, r));
297
+ default: i.push(A([e], o, r));
295
298
  }
296
299
  });
297
300
  }
298
- function j(e) {
301
+ function M(e) {
299
302
  return -e.anchor - e.position;
300
303
  }
301
- function M(e) {
304
+ function N(e) {
302
305
  return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
303
306
  }
304
- function N(e) {
305
- return j(e) + M(e) - 1;
307
+ function P(e) {
308
+ return M(e) + N(e) - 1;
306
309
  }
307
310
  function Ee(e, t, n, r) {
308
- let i = (e) => x(r.document, "mpadded", [t], {
311
+ let i = (e) => w(r.document, "mpadded", [t], {
309
312
  width: "0",
310
313
  ...e ? { lspace: e } : {}
311
- }), a = (e, t) => x(r.document, e, t);
314
+ }), a = (e, t) => w(r.document, e, t);
312
315
  switch (n) {
313
316
  case "s": return a("munder", [e, i("-0.5width")]);
314
317
  case "ne": return a("msup", [e, i()]);
@@ -331,12 +334,12 @@ function Ee(e, t, n, r) {
331
334
  }
332
335
  }
333
336
  function De(e, t, n) {
334
- let r = x(n.document, "menclose", [e], {
337
+ let r = w(n.document, "menclose", [e], {
335
338
  notation: t.join(" "),
336
339
  "data-padding": "0.1em",
337
340
  "data-thickness": "0.067em"
338
341
  }), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
339
- return i ? x(n.document, "mpadded", [r], {
342
+ return i ? w(n.document, "mpadded", [r], {
340
343
  lspace: `-${i}em`,
341
344
  width: `-${2 * i}em`
342
345
  }) : r;
@@ -344,35 +347,35 @@ function De(e, t, n) {
344
347
  function Oe(e, t, n, r, i) {
345
348
  let a = e && t.crossout.length ? De(e, t.crossout, i) : e;
346
349
  if (!t.content) return a;
347
- let o = x(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
348
- return Ee(a ?? Se(i), o, n, i);
350
+ let o = w(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
351
+ return Ee(a ?? be(i), o, n, i);
349
352
  }
350
- function P(e, t) {
351
- return e.carries[t - j(e)] ?? null;
353
+ function ke(e, t) {
354
+ return e.carries[t - M(e)] ?? null;
352
355
  }
353
- function ke(e, t, n, r) {
356
+ function Ae(e, t, n, r) {
354
357
  let i = e.content;
355
358
  n.forEach((e, a) => {
356
- let o = n.length - 1 - a, s = n[o], c = P(s, t), l = n.slice(0, o).some((e) => P(e, t));
359
+ let o = n.length - 1 - a, s = n[o], c = ke(s, t), l = n.slice(0, o).some((e) => ke(e, t));
357
360
  if (!c && !l) return;
358
361
  let u = c ?? {
359
- content: Se(r),
362
+ content: be(r),
360
363
  location: "n",
361
364
  crossout: []
362
365
  }, d = a === 0 ? u.location : "n";
363
366
  i = Oe(i, u, d, s.scale, r);
364
367
  }), e.content = i;
365
368
  }
366
- function F(e, t) {
367
- 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 }, () => ({
369
+ function je(e, t) {
370
+ 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 }, () => ({
368
371
  content: null,
369
372
  borders: {}
370
- })), 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) => {
373
+ })), 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) => {
371
374
  let n = c();
372
375
  e.cells.forEach((t, r) => {
373
- n[a + j(e) + r].content = t;
376
+ n[a + M(e) + r].content = t;
374
377
  }), u.length && n.forEach((e, n) => {
375
- ke(e, n - a, u, t);
378
+ Ae(e, n - a, u, t);
376
379
  });
377
380
  for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
378
381
  u = [], d = [], s.set(e, o.length), o.push(n);
@@ -392,44 +395,44 @@ function F(e, t) {
392
395
  origin: a
393
396
  };
394
397
  }
395
- function Ae(e, { rows: t }, n) {
396
- let r = x(n.document, "mtable", t.map((e) => x(n.document, "mtr", e.map((e) => {
398
+ function Me(e, { rows: t }, n) {
399
+ let r = w(n.document, "mtable", t.map((e) => w(n.document, "mtr", e.map((e) => {
397
400
  let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
398
- return x(n.document, "mtd", [e.content], {
401
+ return w(n.document, "mtd", [e.content], {
399
402
  ...t ? { style: t } : {},
400
403
  ...e.align ? { columnalign: e.align } : {}
401
404
  });
402
405
  }))));
403
- for (let { name: t, value: n } of [...e.attributes]) xe.has(t) || r.setAttribute(t, n);
404
- let i = C(e, "charspacing") ?? "medium", a = C(e, "charalign");
405
- 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;
406
+ for (let { name: t, value: n } of [...e.attributes]) ye.has(t) || r.setAttribute(t, n);
407
+ let i = E(e, "charspacing") ?? "medium", a = E(e, "charalign");
408
+ return r.setAttribute("columnspacing", S[i] ?? (C.test(i) ? i : S.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
406
409
  }
407
- function je(e) {
410
+ function Ne(e) {
408
411
  return {
409
412
  document: e.ownerDocument,
410
- stackAlign: C(e, "stackalign") ?? "decimalpoint",
413
+ stackAlign: E(e, "stackalign") ?? "decimalpoint",
411
414
  decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
412
415
  };
413
416
  }
414
- function Me(e) {
415
- let t = je(e), n = [];
416
- return A([...e.children], 0, 0, t, n), Ae(e, F(n, t), t);
417
+ function Pe(e) {
418
+ let t = Ne(e), n = [];
419
+ return j([...e.children], 0, 0, t, n), Me(e, je(n, t), t);
417
420
  }
418
- function I(e, t, n, r, i, a) {
421
+ function F(e, t, n, r, i, a) {
419
422
  for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
420
423
  }
421
- function Ne(e, t) {
422
- let n = S(t, ")");
423
- return n.setAttribute("minsize", "1.2em"), [x(t.document, "mrow", [e, x(t.document, "mspace", [], { width: "0.2em" })]), x(t.document, "mpadded", [n], {
424
+ function Fe(e, t) {
425
+ let n = T(t, ")");
426
+ return n.setAttribute("minsize", "1.2em"), [w(t.document, "mrow", [e, w(t.document, "mspace", [], { width: "0.2em" })]), w(t.document, "mpadded", [n], {
424
427
  voffset: "0.1em",
425
428
  lspace: "-0.15em",
426
429
  depth: "-0.2em",
427
430
  height: "-0.2em"
428
431
  })];
429
432
  }
430
- function Pe(e) {
431
- let t = je(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 = [];
432
- A(i, 0, 0, t, l);
433
+ function Ie(e) {
434
+ let t = Ne(e), [n, r, ...i] = [...e.children], a = n && !O(n) ? n : null, o = r && !O(r) ? r : null, s = E(e, "longdivstyle") ?? "lefttop", c = we(e), l = [];
435
+ j(i, 0, 0, t, l);
433
436
  let u = l.find((e) => e.kind === "digits");
434
437
  u || (u = {
435
438
  kind: "digits",
@@ -441,51 +444,51 @@ function Pe(e) {
441
444
  u.cells.unshift(...e), u.anchor += e.length;
442
445
  }, p = (...e) => {
443
446
  let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
444
- u.cells.push(...D(n, 0, t).cells);
447
+ u.cells.push(...A(n, 0, t).cells);
445
448
  };
446
449
  switch (s) {
447
450
  case "left/\\right":
448
- f(a, S(t, "/")), p(S(t, "\\"), o);
451
+ f(a, T(t, "/")), p(T(t, "\\"), o);
449
452
  break;
450
453
  case "left)(right":
451
- f(a, S(t, ")")), p(S(t, "("), o);
454
+ f(a, T(t, ")")), p(T(t, "("), o);
452
455
  break;
453
456
  case ":right=right":
454
- p(S(t, ":"), a, S(t, "="), o);
457
+ p(T(t, ":"), a, T(t, "="), o);
455
458
  break;
456
459
  case "righttop":
457
460
  case "stackedleftlinetop":
458
461
  case "lefttop":
459
- o && A([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Ne(a, t));
462
+ o && j([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Fe(a, t));
460
463
  break;
461
464
  }
462
- let m = F(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)));
465
+ let m = je(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
466
  switch (s) {
464
467
  case "left/\\right":
465
468
  case "left)(right":
466
469
  case ":right=right": break;
467
470
  case "righttop": {
468
471
  let e = h[g][_(u.cells.length - 1)];
469
- e.borders.left = c, e.borders.bottom = c, I(h, g, _(0), _(u.cells.length - 1), "top", c);
472
+ e.borders.left = c, e.borders.bottom = c, F(h, g, _(0), _(u.cells.length - 1), "top", c);
470
473
  break;
471
474
  }
472
475
  case "stackedleftlinetop": {
473
476
  let e = h[g][_(0)];
474
- e.borders.right = c, e.borders.bottom = c, I(h, g, _(1), v, "top", c);
477
+ e.borders.right = c, e.borders.bottom = c, F(h, g, _(1), v, "top", c);
475
478
  break;
476
479
  }
477
480
  case "stackedrightright":
478
481
  case "mediumstackedrightright":
479
482
  case "shortstackedrightright":
480
483
  case "stackedleftleft":
481
- Fe(h, g, s, a, o, c, t);
484
+ Le(h, g, s, a, o, c, t);
482
485
  break;
483
- default: I(h, g, _(1), v, "top", c);
486
+ default: F(h, g, _(1), v, "top", c);
484
487
  }
485
- return Ae(e, m, t);
488
+ return Me(e, m, t);
486
489
  }
487
- function Fe(e, t, n, r, i, a, o) {
488
- let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && x(o.document, "mpadded", [e], {
490
+ function Le(e, t, n, r, i, a, o) {
491
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && w(o.document, "mpadded", [e], {
489
492
  lspace: "0.2em",
490
493
  width: "+0.4em"
491
494
  });
@@ -504,75 +507,75 @@ function Fe(e, t, n, r, i, a, o) {
504
507
  }) : 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
508
  });
506
509
  }
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));
510
+ function Re(e) {
511
+ for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? Pe(t) : Ie(t));
509
512
  }
510
513
  //#endregion
511
514
  //#region src/explorer-styles.ts
512
- 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 = `
515
+ var ze = "PIE-MJX-explorer-styles", I = "var(--pie-text, black)", Be = "var(--pie-background, #ffffff)", Ve = "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)`, He = `
513
516
  :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
514
- color: ${L} !important;
515
- fill: ${L} !important;
517
+ color: ${I} !important;
518
+ fill: ${I} !important;
516
519
  }
517
520
  :root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
518
- background-color: ${z} !important;
521
+ background-color: ${R} !important;
519
522
  }
520
523
  :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
521
- fill: ${z} !important;
524
+ fill: ${R} !important;
522
525
  }
523
526
  :root mjx-container .mjx-selected {
524
- outline: 2px solid ${R} !important;
527
+ outline: 2px solid ${L} !important;
525
528
  }
526
529
  :root mjx-container [data-sre-highlight-2] {
527
- color: ${L} !important;
530
+ color: ${I} !important;
528
531
  background-color: transparent !important;
529
- fill: ${L} !important;
530
- outline: 2px dashed ${R} !important;
532
+ fill: ${I} !important;
533
+ outline: 2px dashed ${L} !important;
531
534
  }
532
535
  :root mjx-container rect[data-sre-highlight-2] {
533
536
  fill: transparent !important;
534
- stroke: ${R} !important;
537
+ stroke: ${L} !important;
535
538
  stroke-width: 2px !important;
536
539
  vector-effect: non-scaling-stroke;
537
540
  }
538
541
  :root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
539
- color: ${L} !important;
540
- background-color: ${Re} !important;
541
- border-color: ${ze} !important;
542
+ color: ${I} !important;
543
+ background-color: ${Be} !important;
544
+ border-color: ${Ve} !important;
542
545
  }
543
546
  :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
544
- color: ${L} !important;
545
- background-color: ${z} !important;
547
+ color: ${I} !important;
548
+ background-color: ${R} !important;
546
549
  }
547
550
  `;
548
- function Ve(e = document) {
551
+ function Ue(e = document) {
549
552
  if (e.getElementById("PIE-MJX-explorer-styles")) return;
550
553
  let t = e.createElement("style");
551
- t.id = Le, t.textContent = Be, e.head.appendChild(t);
554
+ t.id = ze, t.textContent = He, e.head.appendChild(t);
552
555
  }
553
556
  //#endregion
554
557
  //#region src/math-speech.ts
555
- var He = /[⁡-⁤]/g, Ue = {
558
+ var We = /[⁡-⁤]/g, z = {
556
559
  "+": "positive",
557
560
  "-": "negative",
558
561
  "−": "negative",
559
562
  "±": "plus or minus",
560
563
  "∓": "minus or plus"
561
- }, We = {
564
+ }, Ge = {
562
565
  "(": "open parenthesis",
563
566
  "[": "open bracket",
564
567
  "{": "open brace",
565
568
  "⟨": "open angle bracket",
566
569
  "⌊": "open floor",
567
570
  "⌈": "open ceiling"
568
- }, Ge = {
571
+ }, B = {
569
572
  ")": "close parenthesis",
570
573
  "]": "close bracket",
571
574
  "}": "close brace",
572
575
  "⟩": "close angle bracket",
573
576
  "⌋": "close floor",
574
577
  "⌉": "close ceiling"
575
- }, B = {
578
+ }, V = {
576
579
  "!": "factorial",
577
580
  "%": "percent",
578
581
  "°": "degrees",
@@ -622,9 +625,9 @@ var He = /[⁡-⁤]/g, Ue = {
622
625
  ":": "colon",
623
626
  "|": "vertical bar",
624
627
  "‖": "double vertical bar",
625
- ...We,
626
628
  ...Ge,
627
- ...B
629
+ ...B,
630
+ ...V
628
631
  }, qe = /* @__PURE__ */ new Set(["|", "‖"]), Je = /* @__PURE__ */ new Set([
629
632
  "∑",
630
633
  "∏",
@@ -669,17 +672,17 @@ var He = /[⁡-⁤]/g, Ue = {
669
672
  "→": "vector",
670
673
  "⃗": "vector",
671
674
  "˙": "dot"
672
- }, V = (e) => (e.textContent ?? "").replace(He, "").replace(/\s+/g, " ").trim(), H = (e) => e.replace(/\s+/g, " ").trim(), U = (e) => [...e.children];
673
- function W(e) {
675
+ }, H = (e) => (e.textContent ?? "").replace(We, "").replace(/\s+/g, " ").trim(), U = (e) => e.replace(/\s+/g, " ").trim(), W = (e) => [...e.children];
676
+ function G(e) {
674
677
  return !e || [
675
678
  "mn",
676
679
  "mi",
677
680
  "mtext",
678
681
  "mo"
679
- ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? W(e.children[0]) : !1;
682
+ ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? G(e.children[0]) : !1;
680
683
  }
681
684
  function Ze(e) {
682
- let t = e ? V(e) : "";
685
+ let t = e ? H(e) : "";
683
686
  return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
684
687
  }
685
688
  function Qe(e) {
@@ -692,112 +695,112 @@ function Qe(e) {
692
695
  function $e(e) {
693
696
  return Ye[e] ?? e;
694
697
  }
695
- function G(e) {
698
+ function K(e) {
696
699
  return Ke[e] ?? e;
697
700
  }
698
- function K(e) {
701
+ function q(e) {
699
702
  let t = [], n = !1;
700
703
  for (let r of e) {
701
704
  if (r.localName !== "mo") {
702
- t.push(q(r)), n = !0;
705
+ t.push(J(r)), n = !0;
703
706
  continue;
704
707
  }
705
- let e = V(r);
706
- 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));
708
+ let e = H(r);
709
+ e && (!n && z[e] ? t.push(z[e]) : e in V ? t.push(V[e]) : (t.push(K(e)), n = e in B || qe.has(e) && n));
707
710
  }
708
711
  return t.filter(Boolean).join(" ");
709
712
  }
710
713
  function et(e) {
711
- let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(V(e)), a = n.slice(0, -1);
712
- if (a.length && i(t) && i(r) && V(t) === V(r) && !a.some(i)) {
713
- let e = H(K(a));
714
- return V(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
714
+ let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(H(e)), a = n.slice(0, -1);
715
+ if (a.length && i(t) && i(r) && H(t) === H(r) && !a.some(i)) {
716
+ let e = U(q(a));
717
+ return H(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
715
718
  }
716
- return K(e);
719
+ return q(e);
717
720
  }
718
721
  function tt(e, t) {
719
- let n = e ? q(e) : "", r = t ? q(t) : "";
720
- return W(e) && W(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
722
+ let n = e ? J(e) : "", r = t ? J(t) : "";
723
+ return G(e) && G(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
721
724
  }
722
725
  function nt(e, t, n) {
723
726
  return n ? `${t} of ${e}` : `${t} of ${e} end root`;
724
727
  }
725
728
  function rt(e, t) {
726
- let n = t ? V(t) : "";
727
- if (t && W(t)) {
729
+ let n = t ? H(t) : "";
730
+ if (t && G(t)) {
728
731
  if (n === "2") return `${e} squared`;
729
732
  if (n === "3") return `${e} cubed`;
730
- if (n in B) return `${e} ${B[n]}`;
733
+ if (n in V) return `${e} ${V[n]}`;
731
734
  }
732
- let r = t ? q(t) : "";
733
- return W(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
735
+ let r = t ? J(t) : "";
736
+ return G(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
734
737
  }
735
738
  function it(e, t) {
736
- let n = t ? q(t) : "";
737
- return W(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
739
+ let n = t ? J(t) : "";
740
+ return G(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
738
741
  }
739
742
  function at(e, t, n) {
740
- let r = V(e);
741
- if (r === "lim") return `limit as ${t ? q(t) : ""} of`;
743
+ let r = H(e);
744
+ if (r === "lim") return `limit as ${t ? J(t) : ""} of`;
742
745
  if (!Je.has(r)) return;
743
- let i = t ? `from ${q(t)}` : "", a = n ? `to ${q(n)}` : "";
744
- return `${G(r)} ${i} ${a} of`;
746
+ let i = t ? `from ${J(t)}` : "", a = n ? `to ${J(n)}` : "";
747
+ return `${K(r)} ${i} ${a} of`;
745
748
  }
746
749
  function ot(e) {
747
- 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(", ")}`);
750
+ let t = W(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => W(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) => U(q(W(e)))).join(", ")}`);
748
751
  return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
749
752
  }
750
753
  function st(e) {
751
- 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));
754
+ let t = e.getAttribute("open") ?? "(", n = e.getAttribute("close") ?? ")", r = (e.getAttribute("separators") ?? ",").replace(/\s+/g, "").split(""), i = W(e).map((e, t, n) => t < n.length - 1 ? `${J(e)} ${K(r[Math.min(t, r.length - 1)] ?? ",")}` : J(e));
752
755
  return [
753
- G(t),
756
+ K(t),
754
757
  ...i,
755
- G(n)
758
+ K(n)
756
759
  ].filter(Boolean).join(" ");
757
760
  }
758
- function q(e) {
759
- let t = U(e);
761
+ function J(e) {
762
+ let t = W(e);
760
763
  switch (e.localName) {
761
- case "mi": return $e(V(e));
764
+ case "mi": return $e(H(e));
762
765
  case "mn":
763
766
  case "mtext":
764
- case "ms": return V(e);
765
- case "mo": return G(V(e));
767
+ case "ms": return H(e);
768
+ case "mo": return K(H(e));
766
769
  case "mspace":
767
770
  case "mphantom":
768
771
  case "annotation":
769
772
  case "annotation-xml": return "";
770
- case "semantics": return t[0] ? q(t[0]) : "";
773
+ case "semantics": return t[0] ? J(t[0]) : "";
771
774
  case "mfrac": return tt(t[0], t[1]);
772
- case "msqrt": return nt(H(K(t)), "square root", t.length === 1 && W(t[0]));
775
+ case "msqrt": return nt(U(q(t)), "square root", t.length === 1 && G(t[0]));
773
776
  case "mroot": {
774
- 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]) : ""}`;
775
- return nt(t[0] ? q(t[0]) : "", n, W(t[0]));
777
+ let e = Ze(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Qe(e)} root` : `root with index ${t[1] ? J(t[1]) : ""}`;
778
+ return nt(t[0] ? J(t[0]) : "", n, G(t[0]));
776
779
  }
777
- case "msup": return rt(t[0] ? q(t[0]) : "", t[1]);
778
- case "msub": return it(t[0] ? q(t[0]) : "", t[1]);
779
- 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]);
780
+ case "msup": return rt(t[0] ? J(t[0]) : "", t[1]);
781
+ case "msub": return it(t[0] ? J(t[0]) : "", t[1]);
782
+ case "msubsup": return (t[0] ? at(t[0], t[1], t[2]) : void 0) || rt(it(t[0] ? J(t[0]) : "", t[1]), t[2]);
780
783
  case "munder":
781
784
  case "mover":
782
785
  case "munderover": {
783
786
  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;
784
787
  if (s) return s;
785
- let c = n ? q(n) : "", l = e.localName === "mover" && r ? Xe[V(r)] : void 0;
788
+ let c = n ? J(n) : "", l = e.localName === "mover" && r ? Xe[H(r)] : void 0;
786
789
  return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
787
790
  c,
788
- a ? `with ${q(a)} below` : "",
789
- o ? `with ${q(o)} above` : ""
791
+ a ? `with ${J(a)} below` : "",
792
+ o ? `with ${J(o)} above` : ""
790
793
  ].filter(Boolean).join(" ");
791
794
  }
792
795
  case "mfenced": return st(e);
793
796
  case "mtable": return ot(e);
794
797
  case "mrow":
795
798
  case "math": return et(t);
796
- default: return t.length ? K(t) : V(e);
799
+ default: return t.length ? q(t) : H(e);
797
800
  }
798
801
  }
799
802
  function ct(e) {
800
- return H(q(e));
803
+ return U(J(e));
801
804
  }
802
805
  //#endregion
803
806
  //#region src/math-name.ts
@@ -826,7 +829,7 @@ function ut(e) {
826
829
  let t = e.querySelector("math"), n = t ? ct(t) : "";
827
830
  n && e.setAttribute("aria-label", n);
828
831
  }
829
- function J(e) {
832
+ function Y(e) {
830
833
  for (let t of e.querySelectorAll("mjx-container")) ut(t);
831
834
  }
832
835
  //#endregion
@@ -864,11 +867,11 @@ var ht = {
864
867
  ["$", "$"],
865
868
  ["\\[", "\\]"],
866
869
  ["\\(", "\\)"]
867
- ], xt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), St = "MJX-CHTML-styles", Ct = "PIE-MJX-SVG-styles", Y = "PIE-MathJax-Menu-Settings", wt = { "mjx-container[overflow=\"linebreak\"][display]": {
870
+ ], xt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), St = "MJX-CHTML-styles", Ct = "PIE-MJX-SVG-styles", X = "PIE-MathJax-Menu-Settings", wt = { "mjx-container[overflow=\"linebreak\"][display]": {
868
871
  overflow: "auto clip",
869
872
  "min-width": "initial !important"
870
873
  } }, Tt = 200, Et = 201, Dt = 202;
871
- function X(e) {
874
+ function Z(e) {
872
875
  let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
873
876
  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");
874
877
  }
@@ -900,20 +903,20 @@ function Ft(e, t) {
900
903
  }
901
904
  function It(e) {
902
905
  return new Promise((t, n) => {
903
- let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = d(e, import.meta.url), c = {
906
+ let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = f(e, import.meta.url), l = c(), u = {
904
907
  loader: {
905
908
  load: i ? ["a11y/assistive-mml"] : [],
906
909
  failed: (e) => n(e),
907
910
  "output/svg": { ready: (e) => {
908
- let t = y();
911
+ let t = x();
909
912
  return Lt(t) && Rt(t), e;
910
913
  } }
911
914
  },
912
915
  startup: {
913
916
  typeset: !1,
914
917
  ready: () => {
915
- let e = y(), r = e?.startup, i = Lt(e);
916
- i && (Rt(e), zt(e, s.speechLocales), f(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (Bt(r?.document), Vt(r?.document), r?.document?.addStyles?.(wt), mt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
918
+ let e = x(), r = e?.startup, i = Lt(e);
919
+ i && (Rt(e), zt(e, s.speechLocales), p(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (Bt(r?.document), Vt(r?.document), r?.document?.addStyles?.(wt), mt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
917
920
  }
918
921
  },
919
922
  tex: { macros: { ...ht } },
@@ -923,14 +926,14 @@ function It(e) {
923
926
  menuOptions: { settings: {
924
927
  assistiveMml: i,
925
928
  enrich: !1,
926
- inTabOrder: !1
929
+ inTabOrder: l
927
930
  } },
928
- a11y: { inTabOrder: !1 }
931
+ a11y: { inTabOrder: l }
929
932
  }
930
933
  };
931
- r && c.tex && (console.warn(gt), c.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], c.tex.processEscapes = !0), a || (c.chtml = { fontURL: "" });
932
- let l = p(s.speechLocales);
933
- l && c.options && (c.options.sre = { locale: l }), ae(c, {
934
+ r && u.tex && (console.warn(gt), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
935
+ let d = m(s.speechLocales);
936
+ d && u.options && (u.options.sre = { locale: d }), ie(u, {
934
937
  ...s,
935
938
  srcUrl: o
936
939
  }).then((e) => {
@@ -943,20 +946,20 @@ function Lt(e) {
943
946
  }
944
947
  function Rt(e) {
945
948
  let t = e?._?.output, n = t?.chtml_ts?.CHTML;
946
- n && (n.STYLESHEETID = b);
949
+ n && (n.STYLESHEETID = oe);
947
950
  let r = t?.svg_ts?.SVG;
948
951
  r && (r.STYLESHEETID = Ct);
949
952
  }
950
953
  function zt(e, t) {
951
954
  let n = e?._?.ui?.menu?.Menu?.Menu;
952
955
  if (n) {
953
- n.MENU_STORAGE = Y;
956
+ n.MENU_STORAGE = X;
954
957
  try {
955
- let e = localStorage.getItem(Y);
958
+ let e = localStorage.getItem(X);
956
959
  if (!e) return;
957
960
  let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
958
961
  if (n === void 0 && a) return;
959
- a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Y, JSON.stringify(i)) : localStorage.removeItem(Y);
962
+ a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(X, JSON.stringify(i)) : localStorage.removeItem(X);
960
963
  } catch {}
961
964
  }
962
965
  }
@@ -964,17 +967,17 @@ function Bt(e) {
964
967
  if (!e) return;
965
968
  let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
966
969
  let n = e.typesetRoot;
967
- !n || t.has(n) || (X(n), t.add(n));
970
+ !n || t.has(n) || (Z(n), t.add(n));
968
971
  };
969
972
  e.addRenderAction?.("pie-strip-latex", Et, (e) => {
970
973
  for (let t of e.math ?? []) n(t);
971
974
  return !1;
972
975
  }, (e) => {
973
976
  let t = e.typesetRoot;
974
- return t && X(t), !1;
977
+ return t && Z(t), !1;
975
978
  });
976
979
  let r = e.outputJax?.chtmlStyles;
977
- r?.id === St && (r.id = b), Ut();
980
+ r?.id === St && (r.id = oe), Wt();
978
981
  }
979
982
  function Vt(e) {
980
983
  let t = (e) => {
@@ -985,30 +988,30 @@ function Vt(e) {
985
988
  return !1;
986
989
  }, (e) => (t(e), !1));
987
990
  }
988
- function Z(e) {
991
+ function Ht(e) {
989
992
  return e instanceof HTMLStyleElement && se.includes(e.id);
990
993
  }
991
- function Ht(e) {
992
- ne("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
994
+ function Ut(e) {
995
+ te("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
993
996
  }
994
- function Ut() {
995
- let e = document.head, t = [...e.children].find(Z);
997
+ function Wt() {
998
+ let e = document.head, t = [...e.children].find(Ht);
996
999
  if (t) {
997
- Ht(t);
1000
+ Ut(t);
998
1001
  return;
999
1002
  }
1000
1003
  let n = new MutationObserver((e) => {
1001
1004
  for (let t of e) {
1002
- let e = [...t.addedNodes].find(Z);
1005
+ let e = [...t.addedNodes].find(Ht);
1003
1006
  if (e) {
1004
- Ht(e), n.disconnect();
1007
+ Ut(e), n.disconnect();
1005
1008
  return;
1006
1009
  }
1007
1010
  }
1008
1011
  });
1009
1012
  n.observe(e, { childList: !0 });
1010
1013
  }
1011
- function Wt(e) {
1014
+ function Gt(e) {
1012
1015
  let t = e?.math;
1013
1016
  if (!t?.remove) return;
1014
1017
  let n = [...t].filter((e) => (e.state?.() ?? 0) >= Tt && e.typesetRoot?.isConnected === !1);
@@ -1017,93 +1020,93 @@ function Wt(e) {
1017
1020
  t.remove(...n);
1018
1021
  }
1019
1022
  }
1020
- function Gt(e) {
1023
+ function Kt(e) {
1021
1024
  return new Promise((t, n) => {
1022
1025
  let r = e.startup ?? {};
1023
1026
  e.startup = r;
1024
1027
  let i = r.ready;
1025
1028
  r.ready = () => {
1026
- let e = y()?.startup;
1029
+ let e = x()?.startup;
1027
1030
  i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
1028
1031
  };
1029
1032
  });
1030
1033
  }
1031
- function Kt(e) {
1032
- let t = y();
1033
- return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Gt(t) : It(e);
1034
- }
1035
1034
  function qt(e) {
1036
- return Kt(e).then(() => {
1037
- let e = y();
1035
+ let t = x();
1036
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Kt(t) : It(e);
1037
+ }
1038
+ function Jt(e) {
1039
+ return qt(e).then(() => {
1040
+ let e = x();
1038
1041
  e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
1039
1042
  });
1040
1043
  }
1041
- function Jt(e) {
1042
- let t = oe, n = t[xt];
1043
- return n || (n = qt(e), t[xt] = n), n;
1044
+ function Yt(e) {
1045
+ let t = ae, n = t[xt];
1046
+ return n || (n = Jt(e), t[xt] = n), n;
1044
1047
  }
1045
- function Yt(e = {}) {
1048
+ function Xt(e = {}) {
1046
1049
  let t = e.useSingleDollar ?? !1;
1047
1050
  return async (n) => {
1048
1051
  if (typeof window > "u") return;
1049
1052
  let r = ce();
1050
- r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), Nt(n), fe(n), Pt(n), Ie(n);
1051
- let i = Jt(e);
1053
+ r && te("mathjax-3-global", `window.MathJax is MathJax ${r}`), Nt(n), fe(n), Pt(n), Re(n);
1054
+ let i = Yt(e);
1052
1055
  if (!Ft(n, t)) {
1053
1056
  i.catch(() => {});
1054
1057
  return;
1055
1058
  }
1056
1059
  await i;
1057
- let a = y();
1060
+ let a = x();
1058
1061
  if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
1059
- Ve(), Wt(a.startup?.document);
1062
+ Ue(), Gt(a.startup?.document);
1060
1063
  try {
1061
1064
  await a.typesetPromise([n]);
1062
1065
  } catch (e) {
1063
1066
  throw a.typesetClear?.([n]), e;
1064
1067
  }
1065
- X(n), J(n);
1068
+ Z(n), Y(n);
1066
1069
  }
1067
1070
  };
1068
1071
  }
1069
- function Xt() {
1072
+ function Zt() {
1070
1073
  return [];
1071
1074
  }
1072
1075
  //#endregion
1073
1076
  //#region src/render-math.ts
1074
- var Zt = "@pie-lib/math-rendering", Qt = "@pie-lib/math-rendering@2", $t = "pie-print", en = 50, tn = 1e4, nn = null;
1075
- function rn() {
1076
- return !!window[Qt]?.opts?.useSingleDollar;
1077
- }
1077
+ var Qt = "@pie-lib/math-rendering", $t = "@pie-lib/math-rendering@2", en = "pie-print", tn = 50, nn = 1e4, rn = null;
1078
1078
  function an() {
1079
- return nn ||= Yt({ useSingleDollar: rn() }), nn;
1079
+ return !!window[$t]?.opts?.useSingleDollar;
1080
+ }
1081
+ function on() {
1082
+ return rn ||= Xt({ useSingleDollar: an() }), rn;
1080
1083
  }
1081
1084
  function Q() {
1082
1085
  if (typeof window > "u") return null;
1083
- let e = window[Zt];
1086
+ let e = window[Qt];
1084
1087
  return typeof e?.renderMath == "function" && e.renderMath !== $ ? e : null;
1085
1088
  }
1086
- function on(e) {
1089
+ function sn(e) {
1087
1090
  let t = e;
1088
1091
  for (; t;) {
1089
- if (t instanceof Element && t.localName === $t) return t;
1092
+ if (t instanceof Element && t.localName === en) return t;
1090
1093
  t = t instanceof ShadowRoot ? t.host : t.parentNode;
1091
1094
  }
1092
1095
  return null;
1093
1096
  }
1094
- function sn() {
1097
+ function cn() {
1095
1098
  let e = window.renderMath;
1096
1099
  return typeof e == "function" ? e : null;
1097
1100
  }
1098
- async function cn(e) {
1099
- let t = on(e);
1101
+ async function ln(e) {
1102
+ let t = sn(e);
1100
1103
  if (!t) return null;
1101
- let n = sn();
1104
+ let n = cn();
1102
1105
  if (n || t.mathRenderingModuleUrlImported !== !0) return n;
1103
- let r = Date.now() + tn;
1106
+ let r = Date.now() + nn;
1104
1107
  for (; Date.now() < r;) {
1105
- await new Promise((e) => setTimeout(e, en));
1106
- let e = sn();
1108
+ await new Promise((e) => setTimeout(e, tn));
1109
+ let e = cn();
1107
1110
  if (e) return e;
1108
1111
  }
1109
1112
  return null;
@@ -1112,14 +1115,14 @@ var $ = async (e) => {
1112
1115
  if (typeof window > "u") return;
1113
1116
  let t = typeof e == "string", n;
1114
1117
  t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
1115
- let r = Q(), i = r || t ? null : await cn(n);
1116
- return r ? (await r.renderMath?.(n), J(n)) : i && i !== $ ? (await i(n), J(n)) : await an()(n), t ? n.innerHTML : void 0;
1117
- }, ln = (e, t) => {
1118
+ let r = Q(), i = r || t ? null : await ln(n);
1119
+ return r ? (await r.renderMath?.(n), Y(n)) : i && i !== $ ? (await i(n), Y(n)) : await on()(n), t ? n.innerHTML : void 0;
1120
+ }, un = (e, t) => {
1118
1121
  let n = Q()?.wrapMath?.(e, t);
1119
1122
  if (n != null) return n;
1120
1123
  let [r, i] = t === "dollar" || t === "double_dollar" ? ["$", "$"] : ["\\(", "\\)"];
1121
1124
  return `${r}${Ot(e)}${i}`;
1122
- }, un = (e) => {
1125
+ }, dn = (e) => {
1123
1126
  let t = e.trim();
1124
1127
  return t.startsWith("\\[") && t.endsWith("\\]") ? {
1125
1128
  unwrapped: t.slice(2, -2).trim(),
@@ -1146,6 +1149,6 @@ var $ = async (e) => {
1146
1149
  close: "$"
1147
1150
  }
1148
1151
  } : { unwrapped: t };
1149
- }, dn = (e) => Q()?.mmlToLatex?.(e) ?? e;
1152
+ }, fn = (e) => Q()?.mmlToLatex?.(e) ?? e;
1150
1153
  //#endregion
1151
- export { ee as MATHJAX_CONFLICT_EVENT, m as NO_ASSET_ROOT_EVENT, v as UNSUPPORTED_PAGE_DOCS_URL, Yt as createMathjaxRenderer, Xt as getMathjaxCssUrls, dn as mmlToLatex, $ as renderMath, ct as speakMathml, un as unWrapMath, ln as wrapMath };
1154
+ export { ee as MATHJAX_CONFLICT_EVENT, h as NO_ASSET_ROOT_EVENT, y as UNSUPPORTED_PAGE_DOCS_URL, Xt as createMathjaxRenderer, Zt as getMathjaxCssUrls, fn as mmlToLatex, $ as renderMath, ct as speakMathml, dn as unWrapMath, un as wrapMath };