@pie-element/element-player 0.1.9-next.20261020153832 → 0.1.9-next.20261022133444
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/{math-mathjax-DnCAlbL7.js → math-mathjax-kt3WP-5E.js} +350 -276
- package/dist/pie-element-player.js +1021 -1018
- package/package.json +2 -2
|
@@ -86,7 +86,7 @@ function g(e) {
|
|
|
86
86
|
} }));
|
|
87
87
|
}
|
|
88
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
|
|
89
|
+
function y(e, t) {
|
|
90
90
|
if (typeof window > "u") return;
|
|
91
91
|
let n = globalThis;
|
|
92
92
|
n[ee] ??= {
|
|
@@ -103,14 +103,14 @@ function te(e, t) {
|
|
|
103
103
|
docsUrl: _
|
|
104
104
|
} }));
|
|
105
105
|
}
|
|
106
|
-
function
|
|
106
|
+
function te() {
|
|
107
107
|
let e = window.MathJax?.version;
|
|
108
108
|
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function b() {
|
|
111
111
|
return window.MathJax;
|
|
112
112
|
}
|
|
113
|
-
function
|
|
113
|
+
function ne(t, { root: n, speechPath: r }) {
|
|
114
114
|
n && (t.loader = {
|
|
115
115
|
...t.loader,
|
|
116
116
|
paths: {
|
|
@@ -126,81 +126,81 @@ function re(t, { root: n, speechPath: r }) {
|
|
|
126
126
|
}
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
function
|
|
129
|
+
function re(e, t) {
|
|
130
130
|
let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
|
|
131
|
-
return n ? (
|
|
131
|
+
return n ? (ne(e, t), new Promise((t, r) => {
|
|
132
132
|
window.MathJax = e;
|
|
133
133
|
let i = document.createElement("script");
|
|
134
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
135
|
})) : (g("untypeset"), Promise.resolve(!1));
|
|
136
136
|
}
|
|
137
|
-
var
|
|
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
138
|
function ue(e) {
|
|
139
139
|
for (let t of e.querySelectorAll("*")) {
|
|
140
140
|
let n = ce.exec(t.tagName.toLowerCase())?.[1];
|
|
141
|
-
n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(
|
|
141
|
+
n && e.contains(t) && !t.closest("mjx-container") && t.replaceWith(de(t, `${n}:`));
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
|
-
function
|
|
144
|
+
function de(e, t) {
|
|
145
145
|
let n = e.tagName.toLowerCase().slice(t.length);
|
|
146
146
|
if (!le.test(n)) return e;
|
|
147
|
-
let r = e.ownerDocument.createElementNS(
|
|
147
|
+
let r = e.ownerDocument.createElementNS(se, n);
|
|
148
148
|
for (let t of e.attributes) r.setAttribute(t.name, t.value);
|
|
149
149
|
for (let n of [...e.childNodes]) {
|
|
150
150
|
let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
|
|
151
|
-
r.appendChild(e ?
|
|
151
|
+
r.appendChild(e ? de(n, t) : n);
|
|
152
152
|
}
|
|
153
153
|
return r;
|
|
154
154
|
}
|
|
155
|
-
var
|
|
155
|
+
var fe = /* @__PURE__ */ new Set([
|
|
156
156
|
"updiagonalstrike",
|
|
157
157
|
"downdiagonalstrike",
|
|
158
158
|
"verticalstrike",
|
|
159
159
|
"horizontalstrike"
|
|
160
|
-
]),
|
|
160
|
+
]), pe = {
|
|
161
161
|
thin: "0.035em",
|
|
162
162
|
medium: "0.07em",
|
|
163
163
|
thick: "0.14em"
|
|
164
|
-
},
|
|
164
|
+
}, me = {
|
|
165
165
|
tight: "0em",
|
|
166
166
|
medium: "0.1em",
|
|
167
167
|
loose: "0.2em"
|
|
168
|
-
},
|
|
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
169
|
"mn",
|
|
170
170
|
"mo",
|
|
171
171
|
"mi",
|
|
172
172
|
"mtext"
|
|
173
|
-
]),
|
|
173
|
+
]), ye = /* @__PURE__ */ new Set([
|
|
174
174
|
"stackalign",
|
|
175
175
|
"charalign",
|
|
176
176
|
"charspacing",
|
|
177
177
|
"longdivstyle"
|
|
178
178
|
]);
|
|
179
|
-
function
|
|
180
|
-
let i = e.createElementNS(
|
|
179
|
+
function S(e, t, n = [], r = {}) {
|
|
180
|
+
let i = e.createElementNS(se, t);
|
|
181
181
|
for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
|
|
182
182
|
for (let e of n) e && i.appendChild(e);
|
|
183
183
|
return i;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
let n =
|
|
185
|
+
function C(e, t) {
|
|
186
|
+
let n = S(e.document, "mo");
|
|
187
187
|
return n.textContent = t, n;
|
|
188
188
|
}
|
|
189
|
-
function
|
|
190
|
-
let t =
|
|
191
|
-
return t.textContent = "0",
|
|
189
|
+
function w(e) {
|
|
190
|
+
let t = S(e.document, "mn");
|
|
191
|
+
return t.textContent = "0", S(e.document, "mphantom", [t]);
|
|
192
192
|
}
|
|
193
|
-
function
|
|
193
|
+
function T(e, t) {
|
|
194
194
|
return e.getAttribute(t)?.trim().toLowerCase() || void 0;
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function E(e, t) {
|
|
197
197
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
198
198
|
return Number.isFinite(n) ? n : 0;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function D(e) {
|
|
201
201
|
return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function O(e, t, n = e) {
|
|
204
204
|
switch (t) {
|
|
205
205
|
case "left": return 0;
|
|
206
206
|
case "center": return Math.floor(e / 2);
|
|
@@ -208,14 +208,14 @@ function A(e, t, n = e) {
|
|
|
208
208
|
default: return n;
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function k(e, t, n) {
|
|
212
212
|
let r = [], i, a, o = (e, t) => {
|
|
213
213
|
let s = (e) => t.reduceRight((e, t) => {
|
|
214
214
|
let n = t.cloneNode(!1);
|
|
215
215
|
return n.appendChild(e), n;
|
|
216
216
|
}, e);
|
|
217
217
|
if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
|
|
218
|
-
else if (
|
|
218
|
+
else if (D(e)) r.push(null);
|
|
219
219
|
else if (e.localName === "mn" && e.children.length === 0) {
|
|
220
220
|
let t = [...(e.textContent ?? "").trim()];
|
|
221
221
|
for (let a of t) {
|
|
@@ -224,28 +224,28 @@ function j(e, t, n) {
|
|
|
224
224
|
t.textContent = a, r.push(s(t));
|
|
225
225
|
}
|
|
226
226
|
t.length && (a ??= r.length);
|
|
227
|
-
} else
|
|
227
|
+
} else ve.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
|
|
228
228
|
};
|
|
229
229
|
for (let t of e) o(t, []);
|
|
230
230
|
return {
|
|
231
231
|
kind: "digits",
|
|
232
232
|
cells: r,
|
|
233
|
-
anchor:
|
|
233
|
+
anchor: O(r.length, n.stackAlign, i ?? a),
|
|
234
234
|
position: t
|
|
235
235
|
};
|
|
236
236
|
}
|
|
237
|
-
function
|
|
238
|
-
return (e ?? "").toLowerCase().split(/\s+/).filter((e) =>
|
|
237
|
+
function be(e) {
|
|
238
|
+
return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
|
|
239
239
|
}
|
|
240
|
-
function
|
|
241
|
-
let n = [...e.children].filter((e) => !
|
|
242
|
-
return n.length <= 1 ? n[0] ?? null :
|
|
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
243
|
}
|
|
244
|
-
function
|
|
245
|
-
let r =
|
|
246
|
-
content:
|
|
247
|
-
location:
|
|
248
|
-
crossout: e.hasAttribute("crossout") ?
|
|
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
249
|
} : {
|
|
250
250
|
content: e,
|
|
251
251
|
location: r,
|
|
@@ -254,60 +254,60 @@ function ye(e, t, n) {
|
|
|
254
254
|
return {
|
|
255
255
|
kind: "carries",
|
|
256
256
|
carries: a,
|
|
257
|
-
anchor:
|
|
257
|
+
anchor: O(a.length, n.stackAlign),
|
|
258
258
|
position: t,
|
|
259
|
-
scale:
|
|
259
|
+
scale: _e.test(o) ? o : "0.6"
|
|
260
260
|
};
|
|
261
261
|
}
|
|
262
|
-
function
|
|
263
|
-
let t =
|
|
264
|
-
return `${n} solid ${
|
|
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
265
|
}
|
|
266
|
-
function
|
|
267
|
-
let r = Math.max(0,
|
|
266
|
+
function we(e, t, n) {
|
|
267
|
+
let r = Math.max(0, E(e, "length"));
|
|
268
268
|
return {
|
|
269
269
|
kind: "line",
|
|
270
270
|
length: r,
|
|
271
|
-
anchor:
|
|
271
|
+
anchor: O(r, n.stackAlign),
|
|
272
272
|
position: t,
|
|
273
|
-
border:
|
|
273
|
+
border: Ce(e)
|
|
274
274
|
};
|
|
275
275
|
}
|
|
276
|
-
function
|
|
276
|
+
function A(e, t, n, r, i) {
|
|
277
277
|
e.forEach((e, a) => {
|
|
278
|
-
let o = t + a * n +
|
|
278
|
+
let o = t + a * n + E(e, "position");
|
|
279
279
|
switch (e.localName) {
|
|
280
280
|
case "msgroup":
|
|
281
|
-
|
|
281
|
+
A([...e.children], o, E(e, "shift"), r, i);
|
|
282
282
|
break;
|
|
283
283
|
case "msline":
|
|
284
|
-
i.push(
|
|
284
|
+
i.push(we(e, o, r));
|
|
285
285
|
break;
|
|
286
286
|
case "mscarries":
|
|
287
|
-
i.push(
|
|
287
|
+
i.push(Se(e, o, r));
|
|
288
288
|
break;
|
|
289
289
|
case "msrow":
|
|
290
290
|
case "mrow":
|
|
291
|
-
i.push(
|
|
291
|
+
i.push(k([...e.children], o, r));
|
|
292
292
|
break;
|
|
293
|
-
default: i.push(
|
|
293
|
+
default: i.push(k([e], o, r));
|
|
294
294
|
}
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function j(e) {
|
|
298
298
|
return -e.anchor - e.position;
|
|
299
299
|
}
|
|
300
|
-
function
|
|
300
|
+
function Te(e) {
|
|
301
301
|
return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
|
|
302
302
|
}
|
|
303
|
-
function
|
|
304
|
-
return
|
|
303
|
+
function Ee(e) {
|
|
304
|
+
return j(e) + Te(e) - 1;
|
|
305
305
|
}
|
|
306
|
-
function
|
|
307
|
-
let i = (e) =>
|
|
306
|
+
function De(e, t, n, r) {
|
|
307
|
+
let i = (e) => S(r.document, "mpadded", [t], {
|
|
308
308
|
width: "0",
|
|
309
309
|
...e ? { lspace: e } : {}
|
|
310
|
-
}), a = (e, t) =>
|
|
310
|
+
}), a = (e, t) => S(r.document, e, t);
|
|
311
311
|
switch (n) {
|
|
312
312
|
case "s": return a("munder", [e, i("-0.5width")]);
|
|
313
313
|
case "ne": return a("msup", [e, i()]);
|
|
@@ -329,49 +329,49 @@ function Ce(e, t, n, r) {
|
|
|
329
329
|
default: return a("mover", [e, i("-0.5width")]);
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
|
-
function
|
|
333
|
-
let r =
|
|
332
|
+
function Oe(e, t, n) {
|
|
333
|
+
let r = S(n.document, "menclose", [e], {
|
|
334
334
|
notation: t.join(" "),
|
|
335
335
|
"data-padding": "0.1em",
|
|
336
336
|
"data-thickness": "0.067em"
|
|
337
337
|
}), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
|
|
338
|
-
return i ?
|
|
338
|
+
return i ? S(n.document, "mpadded", [r], {
|
|
339
339
|
lspace: `-${i}em`,
|
|
340
340
|
width: `-${2 * i}em`
|
|
341
341
|
}) : r;
|
|
342
342
|
}
|
|
343
|
-
function
|
|
344
|
-
let a = e && t.crossout.length ?
|
|
343
|
+
function ke(e, t, n, r, i) {
|
|
344
|
+
let a = e && t.crossout.length ? Oe(e, t.crossout, i) : e;
|
|
345
345
|
if (!t.content) return a;
|
|
346
|
-
let o =
|
|
347
|
-
return
|
|
346
|
+
let o = S(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
|
|
347
|
+
return De(a ?? w(i), o, n, i);
|
|
348
348
|
}
|
|
349
|
-
function
|
|
350
|
-
return e.carries[t -
|
|
349
|
+
function Ae(e, t) {
|
|
350
|
+
return e.carries[t - j(e)] ?? null;
|
|
351
351
|
}
|
|
352
|
-
function
|
|
352
|
+
function je(e, t, n, r) {
|
|
353
353
|
let i = e.content;
|
|
354
354
|
n.forEach((e, a) => {
|
|
355
|
-
let o = n.length - 1 - a, s = n[o], c =
|
|
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
356
|
if (!c && !l) return;
|
|
357
357
|
let u = c ?? {
|
|
358
|
-
content:
|
|
358
|
+
content: w(r),
|
|
359
359
|
location: "n",
|
|
360
360
|
crossout: []
|
|
361
361
|
}, d = a === 0 ? u.location : "n";
|
|
362
|
-
i =
|
|
362
|
+
i = ke(i, u, d, s.scale, r);
|
|
363
363
|
}), e.content = i;
|
|
364
364
|
}
|
|
365
|
-
function
|
|
366
|
-
let n = e.filter((e) =>
|
|
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
367
|
content: null,
|
|
368
368
|
borders: {}
|
|
369
|
-
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a +
|
|
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
370
|
let n = c();
|
|
371
371
|
e.cells.forEach((t, r) => {
|
|
372
|
-
n[a +
|
|
372
|
+
n[a + j(e) + r].content = t;
|
|
373
373
|
}), u.length && n.forEach((e, n) => {
|
|
374
|
-
|
|
374
|
+
je(e, n - a, u, t);
|
|
375
375
|
});
|
|
376
376
|
for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
|
|
377
377
|
u = [], d = [], s.set(e, o.length), o.push(n);
|
|
@@ -391,44 +391,44 @@ function Oe(e, t) {
|
|
|
391
391
|
origin: a
|
|
392
392
|
};
|
|
393
393
|
}
|
|
394
|
-
function
|
|
395
|
-
let r =
|
|
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
396
|
let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
|
|
397
|
-
return
|
|
397
|
+
return S(n.document, "mtd", [e.content], {
|
|
398
398
|
...t ? { style: t } : {},
|
|
399
399
|
...e.align ? { columnalign: e.align } : {}
|
|
400
400
|
});
|
|
401
401
|
}))));
|
|
402
|
-
for (let { name: t, value: n } of [...e.attributes])
|
|
403
|
-
let i =
|
|
404
|
-
return r.setAttribute("columnspacing",
|
|
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
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function N(e) {
|
|
407
407
|
return {
|
|
408
408
|
document: e.ownerDocument,
|
|
409
|
-
stackAlign:
|
|
409
|
+
stackAlign: T(e, "stackalign") ?? "decimalpoint",
|
|
410
410
|
decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
|
|
411
411
|
};
|
|
412
412
|
}
|
|
413
|
-
function
|
|
414
|
-
let t =
|
|
415
|
-
return
|
|
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
416
|
}
|
|
417
|
-
function
|
|
417
|
+
function P(e, t, n, r, i, a) {
|
|
418
418
|
for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
|
|
419
419
|
}
|
|
420
|
-
function
|
|
421
|
-
let n =
|
|
422
|
-
return n.setAttribute("minsize", "1.2em"), [
|
|
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
423
|
voffset: "0.1em",
|
|
424
424
|
lspace: "-0.15em",
|
|
425
425
|
depth: "-0.2em",
|
|
426
426
|
height: "-0.2em"
|
|
427
427
|
})];
|
|
428
428
|
}
|
|
429
|
-
function
|
|
430
|
-
let t =
|
|
431
|
-
|
|
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
432
|
let u = l.find((e) => e.kind === "digits");
|
|
433
433
|
u || (u = {
|
|
434
434
|
kind: "digits",
|
|
@@ -440,49 +440,49 @@ function Ne(e) {
|
|
|
440
440
|
u.cells.unshift(...e), u.anchor += e.length;
|
|
441
441
|
}, p = (...e) => {
|
|
442
442
|
let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
|
|
443
|
-
u.cells.push(...
|
|
443
|
+
u.cells.push(...k(n, 0, t).cells);
|
|
444
444
|
};
|
|
445
445
|
switch (s) {
|
|
446
446
|
case "left/\\right":
|
|
447
|
-
f(a,
|
|
447
|
+
f(a, C(t, "/")), p(C(t, "\\"), o);
|
|
448
448
|
break;
|
|
449
449
|
case "left)(right":
|
|
450
|
-
f(a,
|
|
450
|
+
f(a, C(t, ")")), p(C(t, "("), o);
|
|
451
451
|
break;
|
|
452
452
|
case ":right=right":
|
|
453
|
-
p(
|
|
453
|
+
p(C(t, ":"), a, C(t, "="), o);
|
|
454
454
|
break;
|
|
455
455
|
case "righttop":
|
|
456
456
|
case "stackedleftlinetop":
|
|
457
|
-
case "lefttop": o &&
|
|
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
458
|
}
|
|
459
|
-
let m =
|
|
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
460
|
switch (s) {
|
|
461
461
|
case "left/\\right":
|
|
462
462
|
case "left)(right":
|
|
463
463
|
case ":right=right": break;
|
|
464
464
|
case "righttop": {
|
|
465
465
|
let e = h[g][_(u.cells.length - 1)];
|
|
466
|
-
e.borders.left = c, e.borders.bottom = c,
|
|
466
|
+
e.borders.left = c, e.borders.bottom = c, P(h, g, _(0), _(u.cells.length - 1), "top", c);
|
|
467
467
|
break;
|
|
468
468
|
}
|
|
469
469
|
case "stackedleftlinetop": {
|
|
470
470
|
let e = h[g][_(0)];
|
|
471
|
-
e.borders.right = c, e.borders.bottom = c,
|
|
471
|
+
e.borders.right = c, e.borders.bottom = c, P(h, g, _(1), v, "top", c);
|
|
472
472
|
break;
|
|
473
473
|
}
|
|
474
474
|
case "stackedrightright":
|
|
475
475
|
case "mediumstackedrightright":
|
|
476
476
|
case "shortstackedrightright":
|
|
477
477
|
case "stackedleftleft":
|
|
478
|
-
|
|
478
|
+
Ie(h, g, s, a, o, c, t);
|
|
479
479
|
break;
|
|
480
|
-
default:
|
|
480
|
+
default: P(h, g, _(1), v, "top", c);
|
|
481
481
|
}
|
|
482
|
-
return
|
|
482
|
+
return M(e, m, t);
|
|
483
483
|
}
|
|
484
|
-
function
|
|
485
|
-
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e &&
|
|
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
486
|
lspace: "0.2em",
|
|
487
487
|
width: "+0.4em"
|
|
488
488
|
});
|
|
@@ -501,77 +501,77 @@ function Pe(e, t, n, r, i, a, o) {
|
|
|
501
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
502
|
});
|
|
503
503
|
}
|
|
504
|
-
function
|
|
505
|
-
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) t.closest("math") && !t.closest("mjx-container") && t.replaceWith(t.localName === "mstack" ?
|
|
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
506
|
}
|
|
507
|
-
var
|
|
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
508
|
:root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
|
|
509
|
-
color: ${
|
|
510
|
-
fill: ${
|
|
509
|
+
color: ${F} !important;
|
|
510
|
+
fill: ${F} !important;
|
|
511
511
|
}
|
|
512
512
|
:root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
|
|
513
|
-
background-color: ${
|
|
513
|
+
background-color: ${L} !important;
|
|
514
514
|
}
|
|
515
515
|
:root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
|
|
516
|
-
fill: ${
|
|
516
|
+
fill: ${L} !important;
|
|
517
517
|
}
|
|
518
518
|
:root mjx-container .mjx-selected {
|
|
519
|
-
outline: 2px solid ${
|
|
519
|
+
outline: 2px solid ${I} !important;
|
|
520
520
|
}
|
|
521
521
|
:root mjx-container [data-sre-highlight-2] {
|
|
522
|
-
color: ${
|
|
522
|
+
color: ${F} !important;
|
|
523
523
|
background-color: transparent !important;
|
|
524
|
-
fill: ${
|
|
525
|
-
outline: 2px dashed ${
|
|
524
|
+
fill: ${F} !important;
|
|
525
|
+
outline: 2px dashed ${I} !important;
|
|
526
526
|
}
|
|
527
527
|
:root mjx-container rect[data-sre-highlight-2] {
|
|
528
528
|
fill: transparent !important;
|
|
529
|
-
stroke: ${
|
|
529
|
+
stroke: ${I} !important;
|
|
530
530
|
stroke-width: 2px !important;
|
|
531
531
|
vector-effect: non-scaling-stroke;
|
|
532
532
|
}
|
|
533
533
|
:root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
|
|
534
|
-
color: ${
|
|
535
|
-
background-color: ${
|
|
536
|
-
border-color: ${
|
|
534
|
+
color: ${F} !important;
|
|
535
|
+
background-color: ${ze} !important;
|
|
536
|
+
border-color: ${Be} !important;
|
|
537
537
|
}
|
|
538
538
|
:root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
|
|
539
|
-
color: ${
|
|
540
|
-
background-color: ${
|
|
539
|
+
color: ${F} !important;
|
|
540
|
+
background-color: ${L} !important;
|
|
541
541
|
}
|
|
542
542
|
`;
|
|
543
|
-
function
|
|
543
|
+
function He(e = document) {
|
|
544
544
|
if (e.getElementById("PIE-MJX-explorer-styles")) return;
|
|
545
545
|
let t = e.createElement("style");
|
|
546
|
-
t.id =
|
|
546
|
+
t.id = Re, t.textContent = Ve, e.head.appendChild(t);
|
|
547
547
|
}
|
|
548
|
-
var
|
|
548
|
+
var Ue = /[-]/g, R = {
|
|
549
549
|
"+": "positive",
|
|
550
550
|
"-": "negative",
|
|
551
551
|
"−": "negative",
|
|
552
552
|
"±": "plus or minus",
|
|
553
553
|
"∓": "minus or plus"
|
|
554
|
-
},
|
|
554
|
+
}, We = {
|
|
555
555
|
"(": "open parenthesis",
|
|
556
556
|
"[": "open bracket",
|
|
557
557
|
"{": "open brace",
|
|
558
558
|
"⟨": "open angle bracket",
|
|
559
559
|
"⌊": "open floor",
|
|
560
560
|
"⌈": "open ceiling"
|
|
561
|
-
},
|
|
561
|
+
}, z = {
|
|
562
562
|
")": "close parenthesis",
|
|
563
563
|
"]": "close bracket",
|
|
564
564
|
"}": "close brace",
|
|
565
565
|
"⟩": "close angle bracket",
|
|
566
566
|
"⌋": "close floor",
|
|
567
567
|
"⌉": "close ceiling"
|
|
568
|
-
},
|
|
568
|
+
}, B = {
|
|
569
569
|
"!": "factorial",
|
|
570
570
|
"%": "percent",
|
|
571
571
|
"°": "degrees",
|
|
572
572
|
"′": "prime",
|
|
573
573
|
"″": "double prime"
|
|
574
|
-
},
|
|
574
|
+
}, Ge = {
|
|
575
575
|
"+": "plus",
|
|
576
576
|
"-": "minus",
|
|
577
577
|
"−": "minus",
|
|
@@ -615,16 +615,16 @@ var Ve = /[-]/g, B = {
|
|
|
615
615
|
":": "colon",
|
|
616
616
|
"|": "vertical bar",
|
|
617
617
|
"‖": "double vertical bar",
|
|
618
|
-
...
|
|
619
|
-
...
|
|
620
|
-
...
|
|
621
|
-
},
|
|
618
|
+
...We,
|
|
619
|
+
...z,
|
|
620
|
+
...B
|
|
621
|
+
}, Ke = /* @__PURE__ */ new Set(["|", "‖"]), qe = /* @__PURE__ */ new Set([
|
|
622
622
|
"∑",
|
|
623
623
|
"∏",
|
|
624
624
|
"∫",
|
|
625
625
|
"∪",
|
|
626
626
|
"∩"
|
|
627
|
-
]),
|
|
627
|
+
]), Je = {
|
|
628
628
|
α: "alpha",
|
|
629
629
|
β: "beta",
|
|
630
630
|
γ: "gamma",
|
|
@@ -651,7 +651,7 @@ var Ve = /[-]/g, B = {
|
|
|
651
651
|
cot: "cotangent",
|
|
652
652
|
ln: "natural log",
|
|
653
653
|
lim: "limit"
|
|
654
|
-
},
|
|
654
|
+
}, Ye = {
|
|
655
655
|
"¯": "bar",
|
|
656
656
|
"‾": "bar",
|
|
657
657
|
"―": "bar",
|
|
@@ -662,137 +662,137 @@ var Ve = /[-]/g, B = {
|
|
|
662
662
|
"→": "vector",
|
|
663
663
|
"⃗": "vector",
|
|
664
664
|
"˙": "dot"
|
|
665
|
-
},
|
|
666
|
-
function
|
|
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
667
|
return !e || [
|
|
668
668
|
"mn",
|
|
669
669
|
"mi",
|
|
670
670
|
"mtext",
|
|
671
671
|
"mo"
|
|
672
|
-
].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ?
|
|
672
|
+
].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? W(e.children[0]) : !1;
|
|
673
673
|
}
|
|
674
|
-
function
|
|
675
|
-
let t = e ?
|
|
674
|
+
function Xe(e) {
|
|
675
|
+
let t = e ? V(e) : "";
|
|
676
676
|
return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
|
|
677
677
|
}
|
|
678
|
-
function
|
|
678
|
+
function Ze(e) {
|
|
679
679
|
return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
|
|
680
680
|
1: "st",
|
|
681
681
|
2: "nd",
|
|
682
682
|
3: "rd"
|
|
683
683
|
}[e % 10] ?? "th"}`;
|
|
684
684
|
}
|
|
685
|
-
function
|
|
686
|
-
return
|
|
685
|
+
function Qe(e) {
|
|
686
|
+
return Je[e] ?? e;
|
|
687
687
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
688
|
+
function G(e) {
|
|
689
|
+
return Ge[e] ?? e;
|
|
690
690
|
}
|
|
691
|
-
function
|
|
691
|
+
function K(e) {
|
|
692
692
|
let t = [], n = !1;
|
|
693
693
|
for (let r of e) {
|
|
694
694
|
if (r.localName !== "mo") {
|
|
695
|
-
t.push(
|
|
695
|
+
t.push(J(r)), n = !0;
|
|
696
696
|
continue;
|
|
697
697
|
}
|
|
698
|
-
let e =
|
|
699
|
-
e && (!n &&
|
|
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
700
|
}
|
|
701
701
|
return t.filter(Boolean).join(" ");
|
|
702
702
|
}
|
|
703
|
-
function
|
|
704
|
-
let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(
|
|
705
|
-
if (a.length && i(t) && i(r) &&
|
|
706
|
-
let e =
|
|
707
|
-
return
|
|
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
708
|
}
|
|
709
|
-
return
|
|
709
|
+
return K(e);
|
|
710
710
|
}
|
|
711
|
-
function
|
|
712
|
-
let n = e ?
|
|
713
|
-
return
|
|
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
714
|
}
|
|
715
|
-
function
|
|
715
|
+
function tt(e, t, n) {
|
|
716
716
|
return n ? `${t} of ${e}` : `${t} of ${e} end root`;
|
|
717
717
|
}
|
|
718
|
-
function
|
|
719
|
-
let n = t ?
|
|
720
|
-
if (t &&
|
|
718
|
+
function nt(e, t) {
|
|
719
|
+
let n = t ? V(t) : "";
|
|
720
|
+
if (t && W(t)) {
|
|
721
721
|
if (n === "2") return `${e} squared`;
|
|
722
722
|
if (n === "3") return `${e} cubed`;
|
|
723
|
-
if (n in
|
|
723
|
+
if (n in B) return `${e} ${B[n]}`;
|
|
724
724
|
}
|
|
725
|
-
let r = t ?
|
|
726
|
-
return
|
|
727
|
-
}
|
|
728
|
-
function
|
|
729
|
-
let n = t ?
|
|
730
|
-
return
|
|
731
|
-
}
|
|
732
|
-
function
|
|
733
|
-
let r =
|
|
734
|
-
if (r === "lim") return `limit as ${t ?
|
|
735
|
-
if (!
|
|
736
|
-
let i = t ? `from ${
|
|
737
|
-
return `${
|
|
738
|
-
}
|
|
739
|
-
function rt(e) {
|
|
740
|
-
let t = G(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => G(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) => W(J(G(e)))).join(", ")}`);
|
|
741
|
-
return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
|
|
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`;
|
|
742
738
|
}
|
|
743
739
|
function it(e) {
|
|
744
|
-
let t = 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
745
|
return [
|
|
746
|
-
|
|
746
|
+
G(t),
|
|
747
747
|
...i,
|
|
748
|
-
|
|
748
|
+
G(n)
|
|
749
749
|
].filter(Boolean).join(" ");
|
|
750
750
|
}
|
|
751
|
-
function
|
|
752
|
-
let t =
|
|
751
|
+
function J(e) {
|
|
752
|
+
let t = U(e);
|
|
753
753
|
switch (e.localName) {
|
|
754
|
-
case "mi": return
|
|
754
|
+
case "mi": return Qe(V(e));
|
|
755
755
|
case "mn":
|
|
756
756
|
case "mtext":
|
|
757
|
-
case "ms": return
|
|
758
|
-
case "mo": return
|
|
757
|
+
case "ms": return V(e);
|
|
758
|
+
case "mo": return G(V(e));
|
|
759
759
|
case "mspace":
|
|
760
760
|
case "mphantom":
|
|
761
761
|
case "annotation":
|
|
762
762
|
case "annotation-xml": return "";
|
|
763
|
-
case "semantics": return t[0] ?
|
|
764
|
-
case "mfrac": return
|
|
765
|
-
case "msqrt": 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
766
|
case "mroot": {
|
|
767
|
-
let e =
|
|
768
|
-
return
|
|
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
769
|
}
|
|
770
|
-
case "msup": return
|
|
771
|
-
case "msub": return
|
|
772
|
-
case "msubsup": return (t[0] ?
|
|
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
773
|
case "munder":
|
|
774
774
|
case "mover":
|
|
775
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 ?
|
|
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
777
|
if (s) return s;
|
|
778
|
-
let c = n ?
|
|
778
|
+
let c = n ? J(n) : "", l = e.localName === "mover" && r ? Ye[V(r)] : void 0;
|
|
779
779
|
return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
|
|
780
780
|
c,
|
|
781
|
-
a ? `with ${
|
|
782
|
-
o ? `with ${
|
|
781
|
+
a ? `with ${J(a)} below` : "",
|
|
782
|
+
o ? `with ${J(o)} above` : ""
|
|
783
783
|
].filter(Boolean).join(" ");
|
|
784
784
|
}
|
|
785
|
-
case "mfenced": return
|
|
786
|
-
case "mtable": return
|
|
785
|
+
case "mfenced": return at(e);
|
|
786
|
+
case "mtable": return it(e);
|
|
787
787
|
case "mrow":
|
|
788
|
-
case "math": return
|
|
789
|
-
default: return t.length ?
|
|
788
|
+
case "math": return $e(t);
|
|
789
|
+
default: return t.length ? K(t) : V(e);
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
|
-
function
|
|
793
|
-
return
|
|
792
|
+
function ot(e) {
|
|
793
|
+
return H(J(e));
|
|
794
794
|
}
|
|
795
|
-
var
|
|
795
|
+
var st = [
|
|
796
796
|
"a[href]",
|
|
797
797
|
"button",
|
|
798
798
|
"label",
|
|
@@ -811,42 +811,42 @@ var ot = [
|
|
|
811
811
|
"tab",
|
|
812
812
|
"treeitem"
|
|
813
813
|
].map((e) => `[role="${e}"]`)
|
|
814
|
-
].join(", "),
|
|
815
|
-
function
|
|
814
|
+
].join(", "), Y = "data-pie-math-name";
|
|
815
|
+
function ct(e) {
|
|
816
816
|
if (e.localName !== "label") return e;
|
|
817
817
|
let t = e;
|
|
818
818
|
if (t.control) return t.control;
|
|
819
819
|
let n = t.getAttribute("for"), r = t.getRootNode();
|
|
820
820
|
return (n ? r.getElementById?.(n) : null) ?? t.querySelector("input, select, textarea, button");
|
|
821
821
|
}
|
|
822
|
-
function
|
|
822
|
+
function lt(e, t) {
|
|
823
823
|
let n = e.getRootNode();
|
|
824
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
825
|
}
|
|
826
|
-
function
|
|
827
|
-
let n =
|
|
826
|
+
function ut(e, t) {
|
|
827
|
+
let n = ct(e)?.getAttribute("aria-labelledby")?.split(/\s+/).filter(Boolean);
|
|
828
828
|
if (!n?.length) return !1;
|
|
829
|
-
let r = n.map((e) =>
|
|
829
|
+
let r = n.map((e) => lt(t, e)).filter((e) => e !== null);
|
|
830
830
|
return r.length > 0 && !r.some((e) => e.contains(t));
|
|
831
831
|
}
|
|
832
|
-
function ut(e) {
|
|
833
|
-
let t = e.getAttribute(X);
|
|
834
|
-
t !== null && (e.getAttribute("aria-label") === t && e.removeAttribute("aria-label"), e.removeAttribute(X));
|
|
835
|
-
}
|
|
836
832
|
function dt(e) {
|
|
837
|
-
|
|
838
|
-
|
|
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
839
|
if (!t) return;
|
|
840
|
-
if (
|
|
841
|
-
|
|
840
|
+
if (ut(t, e)) {
|
|
841
|
+
dt(e);
|
|
842
842
|
return;
|
|
843
843
|
}
|
|
844
844
|
if (e.hasAttribute("aria-label")) return;
|
|
845
|
-
let n = e.querySelector("math"), r = n ?
|
|
846
|
-
r && (e.setAttribute("aria-label", r), e.setAttribute(
|
|
845
|
+
let n = e.querySelector("math"), r = n ? ot(n) : "";
|
|
846
|
+
r && (e.setAttribute("aria-label", r), e.setAttribute(Y, r));
|
|
847
847
|
}
|
|
848
|
-
function
|
|
849
|
-
for (let t of e.querySelectorAll("mjx-container"))
|
|
848
|
+
function X(e) {
|
|
849
|
+
for (let t of e.querySelectorAll("mjx-container")) ft(t);
|
|
850
850
|
}
|
|
851
851
|
var pt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
|
|
852
852
|
function mt() {
|
|
@@ -902,7 +902,7 @@ function Pt(e, t) {
|
|
|
902
902
|
}
|
|
903
903
|
function Ft(e) {
|
|
904
904
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
905
|
-
if (t.dataset.mathHandled || t.closest("mjx-container") || Pt(t, e)) continue;
|
|
905
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || t.closest("math") || Pt(t, e)) continue;
|
|
906
906
|
let n = t.textContent;
|
|
907
907
|
n && (t.textContent = Ct(n), t.dataset.mathHandled = "true");
|
|
908
908
|
}
|
|
@@ -921,15 +921,15 @@ function Rt(e) {
|
|
|
921
921
|
load: i ? ["a11y/assistive-mml"] : [],
|
|
922
922
|
failed: (e) => n(e),
|
|
923
923
|
"output/svg": { ready: (e) => {
|
|
924
|
-
let t =
|
|
925
|
-
return zt(t) &&
|
|
924
|
+
let t = b();
|
|
925
|
+
return zt(t) && Bt(t), e;
|
|
926
926
|
} }
|
|
927
927
|
},
|
|
928
928
|
startup: {
|
|
929
929
|
typeset: !1,
|
|
930
930
|
ready: () => {
|
|
931
|
-
let e =
|
|
932
|
-
i && (
|
|
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
933
|
}
|
|
934
934
|
},
|
|
935
935
|
tex: { macros: { ..._t } },
|
|
@@ -946,7 +946,7 @@ function Rt(e) {
|
|
|
946
946
|
};
|
|
947
947
|
r && u.tex && (console.warn(Et), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
|
|
948
948
|
let m = p(c.speechLocales);
|
|
949
|
-
m && u.options && (u.options.sre = { locale: m }),
|
|
949
|
+
m && u.options && (u.options.sre = { locale: m }), re(u, {
|
|
950
950
|
...c,
|
|
951
951
|
srcUrl: o
|
|
952
952
|
}).then((e) => {
|
|
@@ -957,13 +957,13 @@ function Rt(e) {
|
|
|
957
957
|
function zt(e) {
|
|
958
958
|
return !!e?.version?.startsWith("4.");
|
|
959
959
|
}
|
|
960
|
-
function
|
|
960
|
+
function Bt(e) {
|
|
961
961
|
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
962
|
-
n && (n.STYLESHEETID =
|
|
962
|
+
n && (n.STYLESHEETID = x);
|
|
963
963
|
let r = t?.svg_ts?.SVG;
|
|
964
964
|
r && (r.STYLESHEETID = kt);
|
|
965
965
|
}
|
|
966
|
-
function
|
|
966
|
+
function Vt(e, t) {
|
|
967
967
|
let n = e?._?.ui?.menu?.Menu?.Menu;
|
|
968
968
|
if (n) {
|
|
969
969
|
n.MENU_STORAGE = Z;
|
|
@@ -976,7 +976,7 @@ function Bt(e, t) {
|
|
|
976
976
|
} catch {}
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function Ht(e) {
|
|
980
980
|
if (!e) return;
|
|
981
981
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
982
982
|
let n = e.typesetRoot;
|
|
@@ -990,41 +990,41 @@ function Vt(e) {
|
|
|
990
990
|
return t && Q(t), !1;
|
|
991
991
|
});
|
|
992
992
|
let r = e.outputJax?.chtmlStyles;
|
|
993
|
-
r?.id === Ot && (r.id =
|
|
993
|
+
r?.id === Ot && (r.id = x), Kt();
|
|
994
994
|
}
|
|
995
|
-
function
|
|
995
|
+
function Ut(e) {
|
|
996
996
|
let t = (e) => {
|
|
997
|
-
e.typesetRoot &&
|
|
997
|
+
e.typesetRoot && ft(e.typesetRoot);
|
|
998
998
|
};
|
|
999
999
|
e?.addRenderAction?.("pie-name-math", Nt, (e) => {
|
|
1000
1000
|
for (let n of e.math ?? []) t(n);
|
|
1001
1001
|
return !1;
|
|
1002
1002
|
}, (e) => (t(e), !1));
|
|
1003
1003
|
}
|
|
1004
|
-
function Ut(e) {
|
|
1005
|
-
return e instanceof HTMLStyleElement && oe.includes(e.id);
|
|
1006
|
-
}
|
|
1007
1004
|
function Wt(e) {
|
|
1008
|
-
|
|
1005
|
+
return e instanceof HTMLStyleElement && ae.includes(e.id);
|
|
1009
1006
|
}
|
|
1010
|
-
function Gt() {
|
|
1011
|
-
|
|
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
1012
|
if (t) {
|
|
1013
|
-
|
|
1013
|
+
Gt(t);
|
|
1014
1014
|
return;
|
|
1015
1015
|
}
|
|
1016
1016
|
let n = new MutationObserver((e) => {
|
|
1017
1017
|
for (let t of e) {
|
|
1018
|
-
let e = [...t.addedNodes].find(
|
|
1018
|
+
let e = [...t.addedNodes].find(Wt);
|
|
1019
1019
|
if (e) {
|
|
1020
|
-
|
|
1020
|
+
Gt(e), n.disconnect();
|
|
1021
1021
|
return;
|
|
1022
1022
|
}
|
|
1023
1023
|
}
|
|
1024
1024
|
});
|
|
1025
1025
|
n.observe(e, { childList: !0 });
|
|
1026
1026
|
}
|
|
1027
|
-
function
|
|
1027
|
+
function qt(e) {
|
|
1028
1028
|
let t = e?.math;
|
|
1029
1029
|
if (!t?.remove) return;
|
|
1030
1030
|
let n = [...t].filter((e) => (e.state?.() ?? 0) >= jt && e.typesetRoot?.isConnected === !1);
|
|
@@ -1033,54 +1033,128 @@ function Kt(e) {
|
|
|
1033
1033
|
t.remove(...n);
|
|
1034
1034
|
}
|
|
1035
1035
|
}
|
|
1036
|
-
function
|
|
1036
|
+
function Jt(e) {
|
|
1037
1037
|
return new Promise((t, n) => {
|
|
1038
1038
|
let r = e.startup ?? {};
|
|
1039
1039
|
e.startup = r;
|
|
1040
1040
|
let i = r.ready;
|
|
1041
1041
|
r.ready = () => {
|
|
1042
|
-
let e =
|
|
1042
|
+
let e = b()?.startup;
|
|
1043
1043
|
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
1044
1044
|
};
|
|
1045
1045
|
});
|
|
1046
1046
|
}
|
|
1047
|
-
function Jt(e) {
|
|
1048
|
-
let t = y();
|
|
1049
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : qt(t) : Rt(e);
|
|
1050
|
-
}
|
|
1051
1047
|
function Yt(e) {
|
|
1052
|
-
|
|
1053
|
-
|
|
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
1054
|
e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
1055
1055
|
});
|
|
1056
1056
|
}
|
|
1057
|
-
function
|
|
1058
|
-
let t =
|
|
1059
|
-
return n || (n =
|
|
1057
|
+
function Zt(e) {
|
|
1058
|
+
let t = ie, n = t[Dt];
|
|
1059
|
+
return n || (n = Xt(e), t[Dt] = n), n;
|
|
1060
1060
|
}
|
|
1061
|
-
function
|
|
1061
|
+
function Qt(e = {}) {
|
|
1062
1062
|
let t = e.useSingleDollar ?? !1;
|
|
1063
1063
|
return async (n) => {
|
|
1064
1064
|
if (typeof window > "u") return;
|
|
1065
|
-
let r =
|
|
1066
|
-
r &&
|
|
1067
|
-
let i =
|
|
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
1068
|
if (!Lt(n, t)) {
|
|
1069
|
-
i.catch(() => {}),
|
|
1069
|
+
i.catch(() => {}), X(n);
|
|
1070
1070
|
return;
|
|
1071
1071
|
}
|
|
1072
1072
|
await i;
|
|
1073
|
-
let a =
|
|
1073
|
+
let a = b();
|
|
1074
1074
|
if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
|
|
1075
|
-
|
|
1075
|
+
He(), qt(a.startup?.document);
|
|
1076
1076
|
try {
|
|
1077
1077
|
await a.typesetPromise([n]);
|
|
1078
1078
|
} catch (e) {
|
|
1079
1079
|
throw a.typesetClear?.([n]), e;
|
|
1080
1080
|
}
|
|
1081
|
-
Q(n),
|
|
1081
|
+
Q(n), X(n);
|
|
1082
1082
|
}
|
|
1083
1083
|
};
|
|
1084
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, "&").replace(/"/g, """)}">${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
|
+
};
|
|
1085
1159
|
//#endregion
|
|
1086
|
-
export {
|
|
1160
|
+
export { Qt as n, hn as t };
|