@pie-element/element-player 0.1.9-next.20261021000713 → 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.
@@ -0,0 +1,1160 @@
1
+ //#region ../shared/math-rendering-mathjax/dist/index.js
2
+ var e = "4.1.3", t = "https://github.com/pie-framework/pie-elements-ng/blob/develop/docs/MATH-RENDERING.md#assets", n = "@pie-lib/math-rendering@2", r = ["nemeth", "euro"];
3
+ `${e}`;
4
+ var i = /^[^@]+@[^@]+$/;
5
+ function a(e) {
6
+ if (!e) return;
7
+ let t;
8
+ try {
9
+ t = new URL(e);
10
+ } catch {
11
+ return;
12
+ }
13
+ if (t.origin === "null") return;
14
+ let n = t.pathname.split("/");
15
+ for (let e = n.length - 1; e > 0; e--) {
16
+ let r = n[e];
17
+ if (r === "node_modules") return;
18
+ if (!i.test(r)) continue;
19
+ let a = n[e - 1]?.startsWith("@") ? e - 1 : e;
20
+ return t.origin + n.slice(0, a).join("/");
21
+ }
22
+ }
23
+ function o() {
24
+ let e = globalThis[n]?.opts;
25
+ return e && typeof e == "object" ? e : {};
26
+ }
27
+ function s() {
28
+ return o().inTabOrder === !0;
29
+ }
30
+ function c(e) {
31
+ if (typeof e != "string" || !e) return;
32
+ let t = typeof document > "u" ? void 0 : document.baseURI;
33
+ try {
34
+ return new URL(e, t).href.replace(/\/+$/, "");
35
+ } catch {
36
+ return;
37
+ }
38
+ }
39
+ function l(e) {
40
+ if (!e || typeof e != "object") return;
41
+ let t = /* @__PURE__ */ new Map();
42
+ for (let [n, r] of Object.entries(e)) {
43
+ let e = c(r);
44
+ e && t.set(n, e);
45
+ }
46
+ return t.size ? t : void 0;
47
+ }
48
+ function u(e) {
49
+ if (Array.isArray(e)) return new Map(e.filter((e) => typeof e == "string").map((e) => [e, void 0]));
50
+ if (e && typeof e == "object") return new Map(Object.entries(e).map(([e, t]) => [e, typeof t == "string" ? t : void 0]));
51
+ }
52
+ function d(e, t) {
53
+ let n = o(), r = c(e.assetRoot ?? n.assetRoot) ?? a(t);
54
+ return {
55
+ root: r,
56
+ speechPath: c(e.speechPath ?? n.speechPath) ?? (r ? `${r}/mathjax@4.1.3/sre` : void 0),
57
+ speechLocales: u(e.speechLocales ?? n.speechLocales),
58
+ urls: l(e.assetUrls ?? n.assetUrls)
59
+ };
60
+ }
61
+ function f(e, t) {
62
+ if (e && t) {
63
+ for (let n of [...e.keys()]) !t.has(n) && !r.includes(n) && e.delete(n);
64
+ for (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);
65
+ }
66
+ }
67
+ function p(e) {
68
+ if (e && !e.has("en")) return [...e.keys()].find((e) => !r.includes(e));
69
+ }
70
+ var m = {
71
+ untypeset: "no MathJax loads, so math stays untypeset",
72
+ "no-web-fonts": "math renders without web fonts",
73
+ "no-web-fonts-or-speech": "math renders without web fonts and speech"
74
+ }, h = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
75
+ function g(e) {
76
+ let r = globalThis;
77
+ r[h] ??= [];
78
+ let i = r[h];
79
+ if (i.includes(e)) return;
80
+ i.push(e);
81
+ let a = `[math-rendering] No asset root for MathJax: ${m[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;
82
+ e === "untypeset" ? console.error(a) : console.warn(a), typeof window < "u" && window.dispatchEvent(new CustomEvent("pie-mathjax-no-asset-root", { detail: {
83
+ effect: e,
84
+ message: a,
85
+ docsUrl: t
86
+ } }));
87
+ }
88
+ var _ = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", v = "pie-mathjax-version-conflict", ee = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
89
+ function y(e, t) {
90
+ if (typeof window > "u") return;
91
+ let n = globalThis;
92
+ n[ee] ??= {
93
+ logged: !1,
94
+ conditions: []
95
+ };
96
+ let r = n[ee];
97
+ if (r.conditions.includes(e)) return;
98
+ r.conditions.push(e);
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 ${_}`;
100
+ r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(v, { detail: {
101
+ condition: e,
102
+ message: i,
103
+ docsUrl: _
104
+ } }));
105
+ }
106
+ function te() {
107
+ let e = window.MathJax?.version;
108
+ return typeof e == "string" && e.startsWith("3.") ? e : void 0;
109
+ }
110
+ function b() {
111
+ return window.MathJax;
112
+ }
113
+ function ne(t, { root: n, speechPath: r }) {
114
+ n && (t.loader = {
115
+ ...t.loader,
116
+ paths: {
117
+ fonts: `${n}/@mathjax`,
118
+ "mathjax-newcm": `${n}/@mathjax/mathjax-newcm-font@${e}`,
119
+ "mathjax-mhchem-extension": `${n}/@mathjax/mathjax-mhchem-font-extension@${e}`
120
+ }
121
+ }), r && (t.options = {
122
+ ...t.options,
123
+ worker: {
124
+ path: r,
125
+ maps: `${r}/mathmaps`
126
+ }
127
+ });
128
+ }
129
+ function re(e, t) {
130
+ let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
131
+ return n ? (ne(e, t), new Promise((t, r) => {
132
+ window.MathJax = e;
133
+ let i = document.createElement("script");
134
+ i.src = n, i.async = !0, i.onload = () => t(!0), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
135
+ })) : (g("untypeset"), Promise.resolve(!1));
136
+ }
137
+ var ie = globalThis, x = "PIE-MJX-CHTML-styles", ae = ["MJX-CHTML-styles", "MJX-SVG-styles"], oe = te, se = "http://www.w3.org/1998/Math/MathML", ce = /^([a-z_][\w.-]*):math$/, le = /^[a-z][a-z0-9-]*$/;
138
+ function ue(e) {
139
+ for (let t of e.querySelectorAll("*")) {
140
+ let n = ce.exec(t.tagName.toLowerCase())?.[1];
141
+ n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(de(t, `${n}:`));
142
+ }
143
+ }
144
+ function de(e, t) {
145
+ let n = e.tagName.toLowerCase().slice(t.length);
146
+ if (!le.test(n)) return e;
147
+ let r = e.ownerDocument.createElementNS(se, n);
148
+ for (let t of e.attributes) r.setAttribute(t.name, t.value);
149
+ for (let n of [...e.childNodes]) {
150
+ let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
151
+ r.appendChild(e ? de(n, t) : n);
152
+ }
153
+ return r;
154
+ }
155
+ var fe = /* @__PURE__ */ new Set([
156
+ "updiagonalstrike",
157
+ "downdiagonalstrike",
158
+ "verticalstrike",
159
+ "horizontalstrike"
160
+ ]), pe = {
161
+ thin: "0.035em",
162
+ medium: "0.07em",
163
+ thick: "0.14em"
164
+ }, me = {
165
+ tight: "0em",
166
+ medium: "0.1em",
167
+ loose: "0.2em"
168
+ }, he = /^(\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([
169
+ "mn",
170
+ "mo",
171
+ "mi",
172
+ "mtext"
173
+ ]), ye = /* @__PURE__ */ new Set([
174
+ "stackalign",
175
+ "charalign",
176
+ "charspacing",
177
+ "longdivstyle"
178
+ ]);
179
+ function S(e, t, n = [], r = {}) {
180
+ let i = e.createElementNS(se, t);
181
+ for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
182
+ for (let e of n) e && i.appendChild(e);
183
+ return i;
184
+ }
185
+ function C(e, t) {
186
+ let n = S(e.document, "mo");
187
+ return n.textContent = t, n;
188
+ }
189
+ function w(e) {
190
+ let t = S(e.document, "mn");
191
+ return t.textContent = "0", S(e.document, "mphantom", [t]);
192
+ }
193
+ function T(e, t) {
194
+ return e.getAttribute(t)?.trim().toLowerCase() || void 0;
195
+ }
196
+ function E(e, t) {
197
+ let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
198
+ return Number.isFinite(n) ? n : 0;
199
+ }
200
+ function D(e) {
201
+ return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
202
+ }
203
+ function O(e, t, n = e) {
204
+ switch (t) {
205
+ case "left": return 0;
206
+ case "center": return Math.floor(e / 2);
207
+ case "right": return e;
208
+ default: return n;
209
+ }
210
+ }
211
+ function k(e, t, n) {
212
+ let r = [], i, a, o = (e, t) => {
213
+ let s = (e) => t.reduceRight((e, t) => {
214
+ let n = t.cloneNode(!1);
215
+ return n.appendChild(e), n;
216
+ }, e);
217
+ if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
218
+ else if (D(e)) r.push(null);
219
+ else if (e.localName === "mn" && e.children.length === 0) {
220
+ let t = [...(e.textContent ?? "").trim()];
221
+ for (let a of t) {
222
+ a === n.decimalPoint && (i ??= r.length);
223
+ let t = e.cloneNode(!1);
224
+ t.textContent = a, r.push(s(t));
225
+ }
226
+ t.length && (a ??= r.length);
227
+ } else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
228
+ };
229
+ for (let t of e) o(t, []);
230
+ return {
231
+ kind: "digits",
232
+ cells: r,
233
+ anchor: O(r.length, n.stackAlign, i ?? a),
234
+ position: t
235
+ };
236
+ }
237
+ function be(e) {
238
+ return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
239
+ }
240
+ function xe(e, t) {
241
+ let n = [...e.children].filter((e) => !D(e));
242
+ return n.length <= 1 ? n[0] ?? null : S(t.document, "mrow", n);
243
+ }
244
+ function Se(e, t, n) {
245
+ let r = T(e, "location") ?? "n", i = be(e.getAttribute("crossout")), a = [...e.children].map((e) => D(e) ? null : e.localName === "mscarry" ? {
246
+ content: xe(e, n),
247
+ location: T(e, "location") ?? r,
248
+ crossout: e.hasAttribute("crossout") ? be(e.getAttribute("crossout")) : i
249
+ } : {
250
+ content: e,
251
+ location: r,
252
+ crossout: i
253
+ }), o = e.getAttribute("scriptsizemultiplier")?.trim() ?? "";
254
+ return {
255
+ kind: "carries",
256
+ carries: a,
257
+ anchor: O(a.length, n.stackAlign),
258
+ position: t,
259
+ scale: _e.test(o) ? o : "0.6"
260
+ };
261
+ }
262
+ function Ce(e) {
263
+ let t = T(e, "mslinethickness") ?? "medium", n = pe[t] ?? (he.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
264
+ return `${n} solid ${ge.test(r) ? r : "currentColor"}`;
265
+ }
266
+ function we(e, t, n) {
267
+ let r = Math.max(0, E(e, "length"));
268
+ return {
269
+ kind: "line",
270
+ length: r,
271
+ anchor: O(r, n.stackAlign),
272
+ position: t,
273
+ border: Ce(e)
274
+ };
275
+ }
276
+ function A(e, t, n, r, i) {
277
+ e.forEach((e, a) => {
278
+ let o = t + a * n + E(e, "position");
279
+ switch (e.localName) {
280
+ case "msgroup":
281
+ A([...e.children], o, E(e, "shift"), r, i);
282
+ break;
283
+ case "msline":
284
+ i.push(we(e, o, r));
285
+ break;
286
+ case "mscarries":
287
+ i.push(Se(e, o, r));
288
+ break;
289
+ case "msrow":
290
+ case "mrow":
291
+ i.push(k([...e.children], o, r));
292
+ break;
293
+ default: i.push(k([e], o, r));
294
+ }
295
+ });
296
+ }
297
+ function j(e) {
298
+ return -e.anchor - e.position;
299
+ }
300
+ function Te(e) {
301
+ return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
302
+ }
303
+ function Ee(e) {
304
+ return j(e) + Te(e) - 1;
305
+ }
306
+ function De(e, t, n, r) {
307
+ let i = (e) => S(r.document, "mpadded", [t], {
308
+ width: "0",
309
+ ...e ? { lspace: e } : {}
310
+ }), a = (e, t) => S(r.document, e, t);
311
+ switch (n) {
312
+ case "s": return a("munder", [e, i("-0.5width")]);
313
+ case "ne": return a("msup", [e, i()]);
314
+ case "se": return a("msub", [e, i()]);
315
+ case "nw": return a("mmultiscripts", [
316
+ e,
317
+ a("mprescripts", []),
318
+ a("none", []),
319
+ i("-1width")
320
+ ]);
321
+ case "sw": return a("mmultiscripts", [
322
+ e,
323
+ a("mprescripts", []),
324
+ i("-1width"),
325
+ a("none", [])
326
+ ]);
327
+ case "w": return t.setAttribute("scriptlevel", "+1"), a("mrow", [i("-1width"), e]);
328
+ case "e": return t.setAttribute("scriptlevel", "+1"), a("mrow", [e, i()]);
329
+ default: return a("mover", [e, i("-0.5width")]);
330
+ }
331
+ }
332
+ function Oe(e, t, n) {
333
+ let r = S(n.document, "menclose", [e], {
334
+ notation: t.join(" "),
335
+ "data-padding": "0.1em",
336
+ "data-thickness": "0.067em"
337
+ }), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
338
+ return i ? S(n.document, "mpadded", [r], {
339
+ lspace: `-${i}em`,
340
+ width: `-${2 * i}em`
341
+ }) : r;
342
+ }
343
+ function ke(e, t, n, r, i) {
344
+ let a = e && t.crossout.length ? Oe(e, t.crossout, i) : e;
345
+ if (!t.content) return a;
346
+ let o = S(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
347
+ return De(a ?? w(i), o, n, i);
348
+ }
349
+ function Ae(e, t) {
350
+ return e.carries[t - j(e)] ?? null;
351
+ }
352
+ function je(e, t, n, r) {
353
+ let i = e.content;
354
+ n.forEach((e, a) => {
355
+ let o = n.length - 1 - a, s = n[o], c = Ae(s, t), l = n.slice(0, o).some((e) => Ae(e, t));
356
+ if (!c && !l) return;
357
+ let u = c ?? {
358
+ content: w(r),
359
+ location: "n",
360
+ crossout: []
361
+ }, d = a === 0 ? u.location : "n";
362
+ i = ke(i, u, d, s.scale, r);
363
+ }), e.content = i;
364
+ }
365
+ function Me(e, t) {
366
+ let n = e.filter((e) => Te(e) > 0), r = Math.min(0, ...n.map(j)), i = Math.max(r, ...n.map(Ee)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
367
+ content: null,
368
+ borders: {}
369
+ })), 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) => {
370
+ let n = c();
371
+ e.cells.forEach((t, r) => {
372
+ n[a + j(e) + r].content = t;
373
+ }), u.length && n.forEach((e, n) => {
374
+ je(e, n - a, u, t);
375
+ });
376
+ for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
377
+ u = [], d = [], s.set(e, o.length), o.push(n);
378
+ };
379
+ for (let t of e) t.kind === "digits" ? f(t) : t.kind === "carries" ? u.push(t) : d.push(t);
380
+ (u.length || !o.length) && f({
381
+ kind: "digits",
382
+ cells: [],
383
+ anchor: 0,
384
+ position: 0
385
+ });
386
+ let p = o[o.length - 1];
387
+ for (let e of d) for (let t of l(e)) p[t].borders.bottom = e.border;
388
+ return {
389
+ rows: o,
390
+ rowOf: s,
391
+ origin: a
392
+ };
393
+ }
394
+ function M(e, { rows: t }, n) {
395
+ let r = S(n.document, "mtable", t.map((e) => S(n.document, "mtr", e.map((e) => {
396
+ let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
397
+ return S(n.document, "mtd", [e.content], {
398
+ ...t ? { style: t } : {},
399
+ ...e.align ? { columnalign: e.align } : {}
400
+ });
401
+ }))));
402
+ for (let { name: t, value: n } of [...e.attributes]) ye.has(t) || r.setAttribute(t, n);
403
+ let i = T(e, "charspacing") ?? "medium", a = T(e, "charalign");
404
+ return r.setAttribute("columnspacing", me[i] ?? (he.test(i) ? i : me.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
405
+ }
406
+ function N(e) {
407
+ return {
408
+ document: e.ownerDocument,
409
+ stackAlign: T(e, "stackalign") ?? "decimalpoint",
410
+ decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
411
+ };
412
+ }
413
+ function Ne(e) {
414
+ let t = N(e), n = [];
415
+ return A([...e.children], 0, 0, t, n), M(e, Me(n, t), t);
416
+ }
417
+ function P(e, t, n, r, i, a) {
418
+ for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
419
+ }
420
+ function Pe(e, t) {
421
+ let n = C(t, ")");
422
+ return n.setAttribute("minsize", "1.2em"), [S(t.document, "mrow", [e, S(t.document, "mspace", [], { width: "0.2em" })]), S(t.document, "mpadded", [n], {
423
+ voffset: "0.1em",
424
+ lspace: "-0.15em",
425
+ depth: "-0.2em",
426
+ height: "-0.2em"
427
+ })];
428
+ }
429
+ function Fe(e) {
430
+ let t = N(e), [n, r, ...i] = [...e.children], a = n && !D(n) ? n : null, o = r && !D(r) ? r : null, s = T(e, "longdivstyle") ?? "lefttop", c = Ce(e), l = [];
431
+ A(i, 0, 0, t, l);
432
+ let u = l.find((e) => e.kind === "digits");
433
+ u || (u = {
434
+ kind: "digits",
435
+ cells: [],
436
+ anchor: 0,
437
+ position: 0
438
+ }, l.unshift(u));
439
+ let d = [], f = (...e) => {
440
+ u.cells.unshift(...e), u.anchor += e.length;
441
+ }, p = (...e) => {
442
+ let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
443
+ u.cells.push(...k(n, 0, t).cells);
444
+ };
445
+ switch (s) {
446
+ case "left/\\right":
447
+ f(a, C(t, "/")), p(C(t, "\\"), o);
448
+ break;
449
+ case "left)(right":
450
+ f(a, C(t, ")")), p(C(t, "("), o);
451
+ break;
452
+ case ":right=right":
453
+ p(C(t, ":"), a, C(t, "="), o);
454
+ break;
455
+ case "righttop":
456
+ case "stackedleftlinetop":
457
+ 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));
458
+ }
459
+ let m = Me(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 + Ee(e)));
460
+ switch (s) {
461
+ case "left/\\right":
462
+ case "left)(right":
463
+ case ":right=right": break;
464
+ case "righttop": {
465
+ let e = h[g][_(u.cells.length - 1)];
466
+ e.borders.left = c, e.borders.bottom = c, P(h, g, _(0), _(u.cells.length - 1), "top", c);
467
+ break;
468
+ }
469
+ case "stackedleftlinetop": {
470
+ let e = h[g][_(0)];
471
+ e.borders.right = c, e.borders.bottom = c, P(h, g, _(1), v, "top", c);
472
+ break;
473
+ }
474
+ case "stackedrightright":
475
+ case "mediumstackedrightright":
476
+ case "shortstackedrightright":
477
+ case "stackedleftleft":
478
+ Ie(h, g, s, a, o, c, t);
479
+ break;
480
+ default: P(h, g, _(1), v, "top", c);
481
+ }
482
+ return M(e, m, t);
483
+ }
484
+ function Ie(e, t, n, r, i, a, o) {
485
+ let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && S(o.document, "mpadded", [e], {
486
+ lspace: "0.2em",
487
+ width: "+0.4em"
488
+ });
489
+ e.length < t + 2 && e.push(e[0].map(() => ({
490
+ content: null,
491
+ borders: {}
492
+ }))), e.forEach((e, o) => {
493
+ let u = {
494
+ content: null,
495
+ borders: {},
496
+ align: s ? "right" : "left"
497
+ };
498
+ o === t ? (u.content = l(r), u.borders = {
499
+ [c]: a,
500
+ bottom: a
501
+ }) : 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);
502
+ });
503
+ }
504
+ function Le(e) {
505
+ for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) t.closest("math") && !t.closest("mjx-container") && t.replaceWith(t.localName === "mstack" ? Ne(t) : Fe(t));
506
+ }
507
+ var Re = "PIE-MJX-explorer-styles", F = "var(--pie-text, black)", ze = "var(--pie-background, #ffffff)", Be = "var(--pie-border-dark, #66686A)", I = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", L = `color-mix(in srgb, ${I} 15%, transparent)`, Ve = `
508
+ :root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
509
+ color: ${F} !important;
510
+ fill: ${F} !important;
511
+ }
512
+ :root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
513
+ background-color: ${L} !important;
514
+ }
515
+ :root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
516
+ fill: ${L} !important;
517
+ }
518
+ :root mjx-container .mjx-selected {
519
+ outline: 2px solid ${I} !important;
520
+ }
521
+ :root mjx-container [data-sre-highlight-2] {
522
+ color: ${F} !important;
523
+ background-color: transparent !important;
524
+ fill: ${F} !important;
525
+ outline: 2px dashed ${I} !important;
526
+ }
527
+ :root mjx-container rect[data-sre-highlight-2] {
528
+ fill: transparent !important;
529
+ stroke: ${I} !important;
530
+ stroke-width: 2px !important;
531
+ vector-effect: non-scaling-stroke;
532
+ }
533
+ :root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
534
+ color: ${F} !important;
535
+ background-color: ${ze} !important;
536
+ border-color: ${Be} !important;
537
+ }
538
+ :root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
539
+ color: ${F} !important;
540
+ background-color: ${L} !important;
541
+ }
542
+ `;
543
+ function He(e = document) {
544
+ if (e.getElementById("PIE-MJX-explorer-styles")) return;
545
+ let t = e.createElement("style");
546
+ t.id = Re, t.textContent = Ve, e.head.appendChild(t);
547
+ }
548
+ var Ue = /[⁡-⁤]/g, R = {
549
+ "+": "positive",
550
+ "-": "negative",
551
+ "−": "negative",
552
+ "±": "plus or minus",
553
+ "∓": "minus or plus"
554
+ }, We = {
555
+ "(": "open parenthesis",
556
+ "[": "open bracket",
557
+ "{": "open brace",
558
+ "⟨": "open angle bracket",
559
+ "⌊": "open floor",
560
+ "⌈": "open ceiling"
561
+ }, z = {
562
+ ")": "close parenthesis",
563
+ "]": "close bracket",
564
+ "}": "close brace",
565
+ "⟩": "close angle bracket",
566
+ "⌋": "close floor",
567
+ "⌉": "close ceiling"
568
+ }, B = {
569
+ "!": "factorial",
570
+ "%": "percent",
571
+ "°": "degrees",
572
+ "′": "prime",
573
+ "″": "double prime"
574
+ }, Ge = {
575
+ "+": "plus",
576
+ "-": "minus",
577
+ "−": "minus",
578
+ "±": "plus or minus",
579
+ "∓": "minus or plus",
580
+ "×": "times",
581
+ "⋅": "times",
582
+ "·": "times",
583
+ "*": "times",
584
+ "÷": "divided by",
585
+ "/": "divided by",
586
+ "=": "equals",
587
+ "≠": "does not equal",
588
+ "<": "is less than",
589
+ ">": "is greater than",
590
+ "≤": "is less than or equal to",
591
+ "≥": "is greater than or equal to",
592
+ "≈": "is approximately equal to",
593
+ "≡": "is equivalent to",
594
+ "∝": "is proportional to",
595
+ "∈": "is an element of",
596
+ "∉": "is not an element of",
597
+ "⊂": "is a subset of",
598
+ "⊆": "is a subset of or equal to",
599
+ "∪": "union",
600
+ "∩": "intersection",
601
+ "→": "right arrow",
602
+ "←": "left arrow",
603
+ "⇒": "implies",
604
+ "⇔": "if and only if",
605
+ "∑": "sum",
606
+ "∏": "product",
607
+ "∫": "integral",
608
+ "∞": "infinity",
609
+ "∠": "angle",
610
+ "⊥": "is perpendicular to",
611
+ "∥": "is parallel to",
612
+ "∴": "therefore",
613
+ ",": "comma",
614
+ ";": "semicolon",
615
+ ":": "colon",
616
+ "|": "vertical bar",
617
+ "‖": "double vertical bar",
618
+ ...We,
619
+ ...z,
620
+ ...B
621
+ }, Ke = /* @__PURE__ */ new Set(["|", "‖"]), qe = /* @__PURE__ */ new Set([
622
+ "∑",
623
+ "∏",
624
+ "∫",
625
+ "∪",
626
+ "∩"
627
+ ]), Je = {
628
+ α: "alpha",
629
+ β: "beta",
630
+ γ: "gamma",
631
+ δ: "delta",
632
+ ε: "epsilon",
633
+ θ: "theta",
634
+ λ: "lambda",
635
+ μ: "mu",
636
+ π: "pi",
637
+ ρ: "rho",
638
+ σ: "sigma",
639
+ τ: "tau",
640
+ φ: "phi",
641
+ ω: "omega",
642
+ Δ: "capital delta",
643
+ Σ: "capital sigma",
644
+ Ω: "capital omega",
645
+ "∞": "infinity",
646
+ sin: "sine",
647
+ cos: "cosine",
648
+ tan: "tangent",
649
+ sec: "secant",
650
+ csc: "cosecant",
651
+ cot: "cotangent",
652
+ ln: "natural log",
653
+ lim: "limit"
654
+ }, Ye = {
655
+ "¯": "bar",
656
+ "‾": "bar",
657
+ "―": "bar",
658
+ "^": "hat",
659
+ ˆ: "hat",
660
+ "~": "tilde",
661
+ "˜": "tilde",
662
+ "→": "vector",
663
+ "⃗": "vector",
664
+ "˙": "dot"
665
+ }, V = (e) => (e.textContent ?? "").replace(Ue, "").replace(/\s+/g, " ").trim(), H = (e) => e.replace(/\s+/g, " ").trim(), U = (e) => [...e.children];
666
+ function W(e) {
667
+ return !e || [
668
+ "mn",
669
+ "mi",
670
+ "mtext",
671
+ "mo"
672
+ ].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? W(e.children[0]) : !1;
673
+ }
674
+ function Xe(e) {
675
+ let t = e ? V(e) : "";
676
+ return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
677
+ }
678
+ function Ze(e) {
679
+ return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
680
+ 1: "st",
681
+ 2: "nd",
682
+ 3: "rd"
683
+ }[e % 10] ?? "th"}`;
684
+ }
685
+ function Qe(e) {
686
+ return Je[e] ?? e;
687
+ }
688
+ function G(e) {
689
+ return Ge[e] ?? e;
690
+ }
691
+ function K(e) {
692
+ let t = [], n = !1;
693
+ for (let r of e) {
694
+ if (r.localName !== "mo") {
695
+ t.push(J(r)), n = !0;
696
+ continue;
697
+ }
698
+ let e = V(r);
699
+ e && (!n && R[e] ? t.push(R[e]) : e in B ? t.push(B[e]) : (t.push(G(e)), n = e in z || Ke.has(e) && n));
700
+ }
701
+ return t.filter(Boolean).join(" ");
702
+ }
703
+ function $e(e) {
704
+ let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(V(e)), a = n.slice(0, -1);
705
+ if (a.length && i(t) && i(r) && V(t) === V(r) && !a.some(i)) {
706
+ let e = H(K(a));
707
+ return V(t) === "|" ? `absolute value of ${e} end absolute value` : `norm of ${e} end norm`;
708
+ }
709
+ return K(e);
710
+ }
711
+ function et(e, t) {
712
+ let n = e ? J(e) : "", r = t ? J(t) : "";
713
+ return W(e) && W(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
714
+ }
715
+ function tt(e, t, n) {
716
+ return n ? `${t} of ${e}` : `${t} of ${e} end root`;
717
+ }
718
+ function nt(e, t) {
719
+ let n = t ? V(t) : "";
720
+ if (t && W(t)) {
721
+ if (n === "2") return `${e} squared`;
722
+ if (n === "3") return `${e} cubed`;
723
+ if (n in B) return `${e} ${B[n]}`;
724
+ }
725
+ let r = t ? J(t) : "";
726
+ return W(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
727
+ }
728
+ function q(e, t) {
729
+ let n = t ? J(t) : "";
730
+ return W(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
731
+ }
732
+ function rt(e, t, n) {
733
+ let r = V(e);
734
+ if (r === "lim") return `limit as ${t ? J(t) : ""} of`;
735
+ if (!qe.has(r)) return;
736
+ let i = t ? `from ${J(t)}` : "", a = n ? `to ${J(n)}` : "";
737
+ return `${G(r)} ${i} ${a} of`;
738
+ }
739
+ function it(e) {
740
+ 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(", ")}`);
741
+ return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
742
+ }
743
+ function at(e) {
744
+ 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 ? `${J(e)} ${G(r[Math.min(t, r.length - 1)] ?? ",")}` : J(e));
745
+ return [
746
+ G(t),
747
+ ...i,
748
+ G(n)
749
+ ].filter(Boolean).join(" ");
750
+ }
751
+ function J(e) {
752
+ let t = U(e);
753
+ switch (e.localName) {
754
+ case "mi": return Qe(V(e));
755
+ case "mn":
756
+ case "mtext":
757
+ case "ms": return V(e);
758
+ case "mo": return G(V(e));
759
+ case "mspace":
760
+ case "mphantom":
761
+ case "annotation":
762
+ case "annotation-xml": return "";
763
+ case "semantics": return t[0] ? J(t[0]) : "";
764
+ case "mfrac": return et(t[0], t[1]);
765
+ case "msqrt": return tt(H(K(t)), "square root", t.length === 1 && W(t[0]));
766
+ case "mroot": {
767
+ let e = Xe(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Ze(e)} root` : `root with index ${t[1] ? J(t[1]) : ""}`;
768
+ return tt(t[0] ? J(t[0]) : "", n, W(t[0]));
769
+ }
770
+ case "msup": return nt(t[0] ? J(t[0]) : "", t[1]);
771
+ case "msub": return q(t[0] ? J(t[0]) : "", t[1]);
772
+ case "msubsup": return (t[0] ? rt(t[0], t[1], t[2]) : void 0) || nt(q(t[0] ? J(t[0]) : "", t[1]), t[2]);
773
+ case "munder":
774
+ case "mover":
775
+ case "munderover": {
776
+ 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 ? rt(n, a, o) : void 0;
777
+ if (s) return s;
778
+ let c = n ? J(n) : "", l = e.localName === "mover" && r ? Ye[V(r)] : void 0;
779
+ return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
780
+ c,
781
+ a ? `with ${J(a)} below` : "",
782
+ o ? `with ${J(o)} above` : ""
783
+ ].filter(Boolean).join(" ");
784
+ }
785
+ case "mfenced": return at(e);
786
+ case "mtable": return it(e);
787
+ case "mrow":
788
+ case "math": return $e(t);
789
+ default: return t.length ? K(t) : V(e);
790
+ }
791
+ }
792
+ function ot(e) {
793
+ return H(J(e));
794
+ }
795
+ var st = [
796
+ "a[href]",
797
+ "button",
798
+ "label",
799
+ "summary",
800
+ ...[
801
+ "button",
802
+ "checkbox",
803
+ "combobox",
804
+ "link",
805
+ "menuitem",
806
+ "menuitemcheckbox",
807
+ "menuitemradio",
808
+ "option",
809
+ "radio",
810
+ "switch",
811
+ "tab",
812
+ "treeitem"
813
+ ].map((e) => `[role="${e}"]`)
814
+ ].join(", "), Y = "data-pie-math-name";
815
+ function ct(e) {
816
+ if (e.localName !== "label") return e;
817
+ let t = e;
818
+ if (t.control) return t.control;
819
+ let n = t.getAttribute("for"), r = t.getRootNode();
820
+ return (n ? r.getElementById?.(n) : null) ?? t.querySelector("input, select, textarea, button");
821
+ }
822
+ function lt(e, t) {
823
+ let n = e.getRootNode();
824
+ 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;
825
+ }
826
+ function ut(e, t) {
827
+ let n = ct(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
828
+ if (!n?.length) return !1;
829
+ let r = n.map((e) => lt(t, e)).filter((e) => e !== null);
830
+ return r.length > 0 && !r.some((e) => e.contains(t));
831
+ }
832
+ function dt(e) {
833
+ let t = e.getAttribute(Y);
834
+ t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(Y));
835
+ }
836
+ function ft(e) {
837
+ if (e.hasAttribute("aria-label") && !e.hasAttribute(Y)) return;
838
+ let t = e.closest(st);
839
+ if (!t) return;
840
+ if (ut(t, e)) {
841
+ dt(e);
842
+ return;
843
+ }
844
+ if (e.hasAttribute("aria-label")) return;
845
+ let n = e.querySelector("math"), r = n ? ot(n) : "";
846
+ r && (e.setAttribute("aria-label", r), e.setAttribute(Y, r));
847
+ }
848
+ function X(e) {
849
+ for (let t of e.querySelectorAll("mjx-container")) ft(t);
850
+ }
851
+ var pt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
852
+ function mt() {
853
+ let e = globalThis;
854
+ e[pt] || (e[pt] = !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}`));
855
+ }
856
+ function ht(e) {
857
+ let t = e.webworker;
858
+ if (!t || t.ready) return;
859
+ e.options ??= {};
860
+ let n = e.options;
861
+ n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), mt();
862
+ }
863
+ function gt(e) {
864
+ let t = e?.adaptor, n = t?.createWorker;
865
+ e && t && n && (t.createWorker = async (r, i) => {
866
+ let a = await n.call(t, r, i);
867
+ return a.addEventListener("error", () => ht(e), { once: !0 }), a;
868
+ });
869
+ }
870
+ var _t = {
871
+ parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
872
+ overarc: "\\overparen",
873
+ napprox: "\\not\\approx",
874
+ longdiv: "\\enclose{longdiv}",
875
+ abs: ["\\left|#1\\right|", 1],
876
+ perpendicular: "\\perp",
877
+ divide: "\\div"
878
+ }, vt = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, yt = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, bt = /\\embed\{newLine\}\[\]/g, xt = [
879
+ ["$$", "$$"],
880
+ ["$", "$"],
881
+ ["\\[", "\\]"],
882
+ ["\\(", "\\)"]
883
+ ];
884
+ function St(e) {
885
+ for (let [t, n] of xt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
886
+ return e;
887
+ }
888
+ function Ct(e) {
889
+ return `\\(${St(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e)}\\)`.replace(bt, "\\newline ");
890
+ }
891
+ var wt = "mathjax_ignore", Tt = "mathjax_process", Et = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", Dt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), Ot = "MJX-CHTML-styles", kt = "PIE-MJX-SVG-styles", Z = "PIE-MathJax-Menu-Settings", At = { "mjx-container[overflow=\"linebreak\"][display]": {
892
+ overflow: "auto clip",
893
+ "min-width": "initial !important"
894
+ } }, jt = 200, Mt = 201, Nt = 202;
895
+ function Q(e) {
896
+ let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
897
+ 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");
898
+ }
899
+ function Pt(e, t) {
900
+ let n = e.closest(`.${wt}, .${Tt}`);
901
+ return n !== null && t.contains(n) && !n.classList.contains("mathjax_process");
902
+ }
903
+ function Ft(e) {
904
+ for (let t of e.querySelectorAll("[data-latex]")) {
905
+ if (t.dataset.mathHandled || t.closest("mjx-container") || t.closest("math") || Pt(t, e)) continue;
906
+ let n = t.textContent;
907
+ n && (t.textContent = Ct(n), t.dataset.mathHandled = "true");
908
+ }
909
+ }
910
+ function It(e) {
911
+ for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
912
+ }
913
+ function Lt(e, t) {
914
+ for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
915
+ return (t ? yt : vt).test(e.textContent ?? "");
916
+ }
917
+ function Rt(e) {
918
+ return new Promise((t, n) => {
919
+ let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, c = d(e, import.meta.url), l = s(), u = {
920
+ loader: {
921
+ load: i ? ["a11y/assistive-mml"] : [],
922
+ failed: (e) => n(e),
923
+ "output/svg": { ready: (e) => {
924
+ let t = b();
925
+ return zt(t) && Bt(t), e;
926
+ } }
927
+ },
928
+ startup: {
929
+ typeset: !1,
930
+ ready: () => {
931
+ let e = b(), r = e?.startup, i = zt(e);
932
+ i && (Bt(e), Vt(e, c.speechLocales), f(e?._?.a11y?.sre_ts?.locales, c.speechLocales)), r?.defaultReady?.(), i && (Ht(r?.document), Ut(r?.document), r?.document?.addStyles?.(At), gt(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
933
+ }
934
+ },
935
+ tex: { macros: { ..._t } },
936
+ output: { displayOverflow: "linebreak" },
937
+ options: {
938
+ enableMenu: i,
939
+ menuOptions: { settings: {
940
+ assistiveMml: i,
941
+ enrich: !1,
942
+ inTabOrder: l
943
+ } },
944
+ a11y: { inTabOrder: l }
945
+ }
946
+ };
947
+ r && u.tex && (console.warn(Et), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
948
+ let m = p(c.speechLocales);
949
+ m && u.options && (u.options.sre = { locale: m }), re(u, {
950
+ ...c,
951
+ srcUrl: o
952
+ }).then((e) => {
953
+ e || t();
954
+ }, n);
955
+ });
956
+ }
957
+ function zt(e) {
958
+ return !!e?.version?.startsWith("4.");
959
+ }
960
+ function Bt(e) {
961
+ let t = e?._?.output, n = t?.chtml_ts?.CHTML;
962
+ n && (n.STYLESHEETID = x);
963
+ let r = t?.svg_ts?.SVG;
964
+ r && (r.STYLESHEETID = kt);
965
+ }
966
+ function Vt(e, t) {
967
+ let n = e?._?.ui?.menu?.Menu?.Menu;
968
+ if (n) {
969
+ n.MENU_STORAGE = Z;
970
+ try {
971
+ let e = localStorage.getItem(Z);
972
+ if (!e) return;
973
+ let { assistiveMml: n, locale: r, ...i } = JSON.parse(e), a = r === void 0 || !t || t.has(r);
974
+ if (n === void 0 && a) return;
975
+ a && r !== void 0 && (i.locale = r), Object.keys(i).length ? localStorage.setItem(Z, JSON.stringify(i)) : localStorage.removeItem(Z);
976
+ } catch {}
977
+ }
978
+ }
979
+ function Ht(e) {
980
+ if (!e) return;
981
+ let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
982
+ let n = e.typesetRoot;
983
+ n && !t.has(n) && (Q(n), t.add(n));
984
+ };
985
+ e.addRenderAction?.("pie-strip-latex", Mt, (e) => {
986
+ for (let t of e.math ?? []) n(t);
987
+ return !1;
988
+ }, (e) => {
989
+ let t = e.typesetRoot;
990
+ return t && Q(t), !1;
991
+ });
992
+ let r = e.outputJax?.chtmlStyles;
993
+ r?.id === Ot && (r.id = x), Kt();
994
+ }
995
+ function Ut(e) {
996
+ let t = (e) => {
997
+ e.typesetRoot && ft(e.typesetRoot);
998
+ };
999
+ e?.addRenderAction?.("pie-name-math", Nt, (e) => {
1000
+ for (let n of e.math ?? []) t(n);
1001
+ return !1;
1002
+ }, (e) => (t(e), !1));
1003
+ }
1004
+ function Wt(e) {
1005
+ return e instanceof HTMLStyleElement && ae.includes(e.id);
1006
+ }
1007
+ function Gt(e) {
1008
+ y("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
1009
+ }
1010
+ function Kt() {
1011
+ let e = document.head, t = [...e.children].find(Wt);
1012
+ if (t) {
1013
+ Gt(t);
1014
+ return;
1015
+ }
1016
+ let n = new MutationObserver((e) => {
1017
+ for (let t of e) {
1018
+ let e = [...t.addedNodes].find(Wt);
1019
+ if (e) {
1020
+ Gt(e), n.disconnect();
1021
+ return;
1022
+ }
1023
+ }
1024
+ });
1025
+ n.observe(e, { childList: !0 });
1026
+ }
1027
+ function qt(e) {
1028
+ let t = e?.math;
1029
+ if (!t?.remove) return;
1030
+ let n = [...t].filter((e) => (e.state?.() ?? 0) >= jt && e.typesetRoot?.isConnected === !1);
1031
+ if (n.length !== 0) {
1032
+ for (let e of [...n].reverse()) e.clear?.();
1033
+ t.remove(...n);
1034
+ }
1035
+ }
1036
+ function Jt(e) {
1037
+ return new Promise((t, n) => {
1038
+ let r = e.startup ?? {};
1039
+ e.startup = r;
1040
+ let i = r.ready;
1041
+ r.ready = () => {
1042
+ let e = b()?.startup;
1043
+ i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
1044
+ };
1045
+ });
1046
+ }
1047
+ function Yt(e) {
1048
+ let t = b();
1049
+ return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Jt(t) : Rt(e);
1050
+ }
1051
+ function Xt(e) {
1052
+ return Yt(e).then(() => {
1053
+ let e = b();
1054
+ e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
1055
+ });
1056
+ }
1057
+ function Zt(e) {
1058
+ let t = ie, n = t[Dt];
1059
+ return n || (n = Xt(e), t[Dt] = n), n;
1060
+ }
1061
+ function Qt(e = {}) {
1062
+ let t = e.useSingleDollar ?? !1;
1063
+ return async (n) => {
1064
+ if (typeof window > "u") return;
1065
+ let r = oe();
1066
+ r && y("mathjax-3-global", `window.MathJax is MathJax ${r}`), Ft(n), ue(n), It(n), Le(n);
1067
+ let i = Zt(e);
1068
+ if (!Lt(n, t)) {
1069
+ i.catch(() => {}), X(n);
1070
+ return;
1071
+ }
1072
+ await i;
1073
+ let a = b();
1074
+ if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
1075
+ He(), qt(a.startup?.document);
1076
+ try {
1077
+ await a.typesetPromise([n]);
1078
+ } catch (e) {
1079
+ throw a.typesetClear?.([n]), e;
1080
+ }
1081
+ Q(n), X(n);
1082
+ }
1083
+ };
1084
+ }
1085
+ var $t = "@pie-lib/math-rendering", en = "@pie-lib/math-rendering@2", tn = "pie-print", nn = 50, rn = 1e4, an = null;
1086
+ function on() {
1087
+ return !!window[en]?.opts?.useSingleDollar;
1088
+ }
1089
+ function sn() {
1090
+ return an ||= Qt({ useSingleDollar: on() }), an;
1091
+ }
1092
+ function $() {
1093
+ if (typeof window > "u") return null;
1094
+ let e = window[$t];
1095
+ return typeof e?.renderMath == "function" && e.renderMath !== dn ? e : null;
1096
+ }
1097
+ function cn(e) {
1098
+ let t = e;
1099
+ for (; t;) {
1100
+ if (t instanceof Element && t.localName === tn) return t;
1101
+ t = t instanceof ShadowRoot ? t.host : t.parentNode;
1102
+ }
1103
+ return null;
1104
+ }
1105
+ function ln() {
1106
+ let e = window.renderMath;
1107
+ return typeof e == "function" ? e : null;
1108
+ }
1109
+ async function un(e) {
1110
+ let t = cn(e);
1111
+ if (!t) return null;
1112
+ let n = ln();
1113
+ if (n || t.mathRenderingModuleUrlImported !== !0) return n;
1114
+ let r = Date.now() + rn;
1115
+ for (; Date.now() < r;) {
1116
+ await new Promise((e) => setTimeout(e, nn));
1117
+ let e = ln();
1118
+ if (e) return e;
1119
+ }
1120
+ return null;
1121
+ }
1122
+ var dn = async (e) => {
1123
+ if (typeof window > "u") return;
1124
+ let t = typeof e == "string", n;
1125
+ t ? (n = document.createElement("div"), n.innerHTML = e) : n = e || document.body;
1126
+ let r = $(), i = r || t ? null : await un(n);
1127
+ return r ? (await r.renderMath?.(n), X(n)) : i && i !== dn ? (await i(n), X(n)) : await sn()(n), t ? n.innerHTML : void 0;
1128
+ }, fn = /\sdata-latex(?:-item)?="[^"]*"/g, pn = /<merror|<mtext[^>]*mathcolor="red"[^>]*>\\/;
1129
+ function mn(e, t) {
1130
+ let n = $()?.renderMath;
1131
+ if (typeof n != "function") return null;
1132
+ let [r, i] = t.display ? ["\\[", "\\]"] : ["\\(", "\\)"], a = `<span data-latex="" data-raw="${e.replace(/&/g, "&amp;").replace(/"/g, "&quot;")}">${r}${e}${i}</span>`;
1133
+ try {
1134
+ let e = n(a, { skipWaitForMathRenderingLib: !0 });
1135
+ if (typeof e?.then == "function") return e.catch(() => {}), null;
1136
+ let t = typeof e == "string" && e !== a ? e.replace(/\n\s*/g, "").replace(fn, "") : "";
1137
+ return t.startsWith("<math") && !pn.test(t) ? t : null;
1138
+ } catch {
1139
+ return null;
1140
+ }
1141
+ }
1142
+ var hn = (e, t = {}) => {
1143
+ let n = $()?.latexToMml;
1144
+ if (n && n !== hn) try {
1145
+ return n(e, t) ?? null;
1146
+ } catch {
1147
+ return null;
1148
+ }
1149
+ let r = b();
1150
+ if (!r?.tex2mml || !r.startup?.document) return mn(e, t);
1151
+ try {
1152
+ r.texReset?.();
1153
+ let n = r.tex2mml(e, { display: !!t.display })?.replace(/\n\s*/g, "").replace(fn, "");
1154
+ return n && !pn.test(n) ? n : null;
1155
+ } catch {
1156
+ return null;
1157
+ }
1158
+ };
1159
+ //#endregion
1160
+ export { Qt as n, hn as t };