@pie-element/element-player 0.1.6-next.20261008072957 → 0.1.6
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.
|
@@ -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(
|
|
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,81 +34,81 @@ function c(e) {
|
|
|
31
34
|
return;
|
|
32
35
|
}
|
|
33
36
|
}
|
|
34
|
-
function
|
|
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 =
|
|
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
|
|
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
|
|
48
|
-
let n = s(), r =
|
|
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:
|
|
52
|
-
speechLocales:
|
|
53
|
-
urls:
|
|
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
|
|
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
|
|
65
|
+
function m(e) {
|
|
63
66
|
if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !r.includes(e));
|
|
64
67
|
}
|
|
65
|
-
var
|
|
68
|
+
var h = {
|
|
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
|
-
},
|
|
70
|
-
function
|
|
72
|
+
}, g = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
|
|
73
|
+
function _(e) {
|
|
71
74
|
let r = globalThis;
|
|
72
|
-
r[
|
|
73
|
-
let i = r[
|
|
75
|
+
r[g] ??= [];
|
|
76
|
+
let i = r[g];
|
|
74
77
|
if (i.includes(e)) return;
|
|
75
78
|
i.push(e);
|
|
76
|
-
let a = `[math-rendering] No asset root for MathJax: ${
|
|
79
|
+
let a = `[math-rendering] No asset root for MathJax: ${h[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;
|
|
77
80
|
e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent("pie-mathjax-no-asset-root", { detail: {
|
|
78
81
|
effect: e,
|
|
79
82
|
message: a,
|
|
80
83
|
docsUrl: t
|
|
81
84
|
} }));
|
|
82
85
|
}
|
|
83
|
-
var
|
|
84
|
-
function
|
|
86
|
+
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");
|
|
87
|
+
function ne(e, t) {
|
|
85
88
|
if (typeof window > "u") return;
|
|
86
89
|
let n = globalThis;
|
|
87
|
-
n[
|
|
90
|
+
n[te] ??= {
|
|
88
91
|
logged: !1,
|
|
89
92
|
conditions: []
|
|
90
93
|
};
|
|
91
|
-
let r = n[
|
|
94
|
+
let r = n[te];
|
|
92
95
|
if (r.conditions.includes(e)) return;
|
|
93
96
|
r.conditions.push(e);
|
|
94
|
-
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 ${
|
|
95
|
-
r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(
|
|
97
|
+
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}`;
|
|
98
|
+
r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(ee, { detail: {
|
|
96
99
|
condition: e,
|
|
97
100
|
message: i,
|
|
98
|
-
docsUrl:
|
|
101
|
+
docsUrl: v
|
|
99
102
|
} }));
|
|
100
103
|
}
|
|
101
|
-
function
|
|
104
|
+
function re() {
|
|
102
105
|
let e = window.MathJax?.version;
|
|
103
106
|
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
104
107
|
}
|
|
105
|
-
function
|
|
108
|
+
function y() {
|
|
106
109
|
return window.MathJax;
|
|
107
110
|
}
|
|
108
|
-
function
|
|
111
|
+
function ie(t, { root: n, speechPath: r }) {
|
|
109
112
|
n && (t.loader = {
|
|
110
113
|
...t.loader,
|
|
111
114
|
paths: {
|
|
@@ -121,29 +124,29 @@ function ne(t, { root: n, speechPath: r }) {
|
|
|
121
124
|
}
|
|
122
125
|
});
|
|
123
126
|
}
|
|
124
|
-
function
|
|
127
|
+
function ae(e, t) {
|
|
125
128
|
let n = t.srcUrl || (t.root ? `${t.root}/mathjax@4.1.3/tex-mml-chtml.js` : void 0);
|
|
126
|
-
return n ? (
|
|
129
|
+
return n ? (ie(e, t), new Promise((t, r) => {
|
|
127
130
|
window.MathJax = e;
|
|
128
131
|
let i = document.createElement("script");
|
|
129
132
|
i.src = n, i.async = !0, i.onload = () => t(!0), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
|
|
130
|
-
})) : (
|
|
133
|
+
})) : (_("untypeset"), Promise.resolve(!1));
|
|
131
134
|
}
|
|
132
|
-
var
|
|
133
|
-
function
|
|
135
|
+
var oe = globalThis, b = "PIE-MJX-CHTML-styles", se = ["MJX-CHTML-styles", "MJX-SVG-styles"], ce = re, x = "http://www.w3.org/1998/Math/MathML", le = /^([a-z_][\w.-]*):math$/, ue = /^[a-z][a-z0-9-]*$/;
|
|
136
|
+
function de(e) {
|
|
134
137
|
for (let t of e.querySelectorAll("*")) {
|
|
135
|
-
let n =
|
|
136
|
-
!n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(
|
|
138
|
+
let n = le.exec(t.tagName.toLowerCase())?.[1];
|
|
139
|
+
!n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(S(t, `${n}:`));
|
|
137
140
|
}
|
|
138
141
|
}
|
|
139
|
-
function
|
|
142
|
+
function S(e, t) {
|
|
140
143
|
let n = e.tagName.toLowerCase().slice(t.length);
|
|
141
|
-
if (!
|
|
142
|
-
let r = e.ownerDocument.createElementNS(
|
|
144
|
+
if (!ue.test(n)) return e;
|
|
145
|
+
let r = e.ownerDocument.createElementNS(x, n);
|
|
143
146
|
for (let t of e.attributes) r.setAttribute(t.name, t.value);
|
|
144
147
|
for (let n of [...e.childNodes]) {
|
|
145
148
|
let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
|
|
146
|
-
r.appendChild(e ?
|
|
149
|
+
r.appendChild(e ? S(n, t) : n);
|
|
147
150
|
}
|
|
148
151
|
return r;
|
|
149
152
|
}
|
|
@@ -156,46 +159,46 @@ var fe = /* @__PURE__ */ new Set([
|
|
|
156
159
|
thin: "0.035em",
|
|
157
160
|
medium: "0.07em",
|
|
158
161
|
thick: "0.14em"
|
|
159
|
-
},
|
|
162
|
+
}, C = {
|
|
160
163
|
tight: "0em",
|
|
161
164
|
medium: "0.1em",
|
|
162
165
|
loose: "0.2em"
|
|
163
|
-
},
|
|
166
|
+
}, w = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, me = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, he = /^(\d+(\.\d*)?|\.\d+)$/, ge = /* @__PURE__ */ new Set([
|
|
164
167
|
"mn",
|
|
165
168
|
"mo",
|
|
166
169
|
"mi",
|
|
167
170
|
"mtext"
|
|
168
|
-
]),
|
|
171
|
+
]), _e = /* @__PURE__ */ new Set([
|
|
169
172
|
"stackalign",
|
|
170
173
|
"charalign",
|
|
171
174
|
"charspacing",
|
|
172
175
|
"longdivstyle"
|
|
173
176
|
]);
|
|
174
|
-
function
|
|
175
|
-
let i = e.createElementNS(
|
|
177
|
+
function T(e, t, n = [], r = {}) {
|
|
178
|
+
let i = e.createElementNS(x, t);
|
|
176
179
|
for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
|
|
177
180
|
for (let e of n) e && i.appendChild(e);
|
|
178
181
|
return i;
|
|
179
182
|
}
|
|
180
|
-
function
|
|
181
|
-
let n =
|
|
183
|
+
function E(e, t) {
|
|
184
|
+
let n = T(e.document, "mo");
|
|
182
185
|
return n.textContent = t, n;
|
|
183
186
|
}
|
|
184
|
-
function
|
|
185
|
-
let t =
|
|
186
|
-
return t.textContent = "0",
|
|
187
|
+
function D(e) {
|
|
188
|
+
let t = T(e.document, "mn");
|
|
189
|
+
return t.textContent = "0", T(e.document, "mphantom", [t]);
|
|
187
190
|
}
|
|
188
|
-
function
|
|
191
|
+
function O(e, t) {
|
|
189
192
|
return e.getAttribute(t)?.trim().toLowerCase() || void 0;
|
|
190
193
|
}
|
|
191
|
-
function
|
|
194
|
+
function k(e, t) {
|
|
192
195
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
193
196
|
return Number.isFinite(n) ? n : 0;
|
|
194
197
|
}
|
|
195
|
-
function
|
|
198
|
+
function A(e) {
|
|
196
199
|
return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
|
|
197
200
|
}
|
|
198
|
-
function
|
|
201
|
+
function j(e, t, n = e) {
|
|
199
202
|
switch (t) {
|
|
200
203
|
case "left": return 0;
|
|
201
204
|
case "center": return Math.floor(e / 2);
|
|
@@ -203,14 +206,14 @@ function D(e, t, n = e) {
|
|
|
203
206
|
default: return n;
|
|
204
207
|
}
|
|
205
208
|
}
|
|
206
|
-
function
|
|
209
|
+
function M(e, t, n) {
|
|
207
210
|
let r = [], i, a, o = (e, t) => {
|
|
208
211
|
let s = (e) => t.reduceRight((e, t) => {
|
|
209
212
|
let n = t.cloneNode(!1);
|
|
210
213
|
return n.appendChild(e), n;
|
|
211
214
|
}, e);
|
|
212
215
|
if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
|
|
213
|
-
else if (
|
|
216
|
+
else if (A(e)) r.push(null);
|
|
214
217
|
else if (e.localName === "mn" && e.children.length === 0) {
|
|
215
218
|
let t = [...(e.textContent ?? "").trim()];
|
|
216
219
|
for (let a of t) {
|
|
@@ -219,28 +222,28 @@ function O(e, t, n) {
|
|
|
219
222
|
t.textContent = a, r.push(s(t));
|
|
220
223
|
}
|
|
221
224
|
t.length && (a ??= r.length);
|
|
222
|
-
} else
|
|
225
|
+
} else ge.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
|
|
223
226
|
};
|
|
224
227
|
for (let t of e) o(t, []);
|
|
225
228
|
return {
|
|
226
229
|
kind: "digits",
|
|
227
230
|
cells: r,
|
|
228
|
-
anchor:
|
|
231
|
+
anchor: j(r.length, n.stackAlign, i ?? a),
|
|
229
232
|
position: t
|
|
230
233
|
};
|
|
231
234
|
}
|
|
232
|
-
function
|
|
235
|
+
function N(e) {
|
|
233
236
|
return (e ?? "").toLowerCase().split(/\s+/).filter((e) => fe.has(e));
|
|
234
237
|
}
|
|
235
|
-
function
|
|
236
|
-
let n = [...e.children].filter((e) => !
|
|
237
|
-
return n.length <= 1 ? n[0] ?? null :
|
|
238
|
+
function ve(e, t) {
|
|
239
|
+
let n = [...e.children].filter((e) => !A(e));
|
|
240
|
+
return n.length <= 1 ? n[0] ?? null : T(t.document, "mrow", n);
|
|
238
241
|
}
|
|
239
|
-
function
|
|
240
|
-
let r =
|
|
241
|
-
content:
|
|
242
|
-
location:
|
|
243
|
-
crossout: e.hasAttribute("crossout") ?
|
|
242
|
+
function ye(e, t, n) {
|
|
243
|
+
let r = O(e, "location") ?? "n", i = N(e.getAttribute("crossout")), a = [...e.children].map((e) => A(e) ? null : e.localName === "mscarry" ? {
|
|
244
|
+
content: ve(e, n),
|
|
245
|
+
location: O(e, "location") ?? r,
|
|
246
|
+
crossout: e.hasAttribute("crossout") ? N(e.getAttribute("crossout")) : i
|
|
244
247
|
} : {
|
|
245
248
|
content: e,
|
|
246
249
|
location: r,
|
|
@@ -249,60 +252,60 @@ function Se(e, t, n) {
|
|
|
249
252
|
return {
|
|
250
253
|
kind: "carries",
|
|
251
254
|
carries: a,
|
|
252
|
-
anchor:
|
|
255
|
+
anchor: j(a.length, n.stackAlign),
|
|
253
256
|
position: t,
|
|
254
|
-
scale:
|
|
257
|
+
scale: he.test(o) ? o : "0.6"
|
|
255
258
|
};
|
|
256
259
|
}
|
|
257
|
-
function
|
|
258
|
-
let t =
|
|
259
|
-
return `${n} solid ${
|
|
260
|
+
function P(e) {
|
|
261
|
+
let t = O(e, "mslinethickness") ?? "medium", n = pe[t] ?? (w.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
|
|
262
|
+
return `${n} solid ${me.test(r) ? r : "currentColor"}`;
|
|
260
263
|
}
|
|
261
|
-
function
|
|
262
|
-
let r = Math.max(0,
|
|
264
|
+
function be(e, t, n) {
|
|
265
|
+
let r = Math.max(0, k(e, "length"));
|
|
263
266
|
return {
|
|
264
267
|
kind: "line",
|
|
265
268
|
length: r,
|
|
266
|
-
anchor:
|
|
269
|
+
anchor: j(r, n.stackAlign),
|
|
267
270
|
position: t,
|
|
268
|
-
border:
|
|
271
|
+
border: P(e)
|
|
269
272
|
};
|
|
270
273
|
}
|
|
271
|
-
function
|
|
274
|
+
function F(e, t, n, r, i) {
|
|
272
275
|
e.forEach((e, a) => {
|
|
273
|
-
let o = t + a * n +
|
|
276
|
+
let o = t + a * n + k(e, "position");
|
|
274
277
|
switch (e.localName) {
|
|
275
278
|
case "msgroup":
|
|
276
|
-
|
|
279
|
+
F([...e.children], o, k(e, "shift"), r, i);
|
|
277
280
|
break;
|
|
278
281
|
case "msline":
|
|
279
|
-
i.push(
|
|
282
|
+
i.push(be(e, o, r));
|
|
280
283
|
break;
|
|
281
284
|
case "mscarries":
|
|
282
|
-
i.push(
|
|
285
|
+
i.push(ye(e, o, r));
|
|
283
286
|
break;
|
|
284
287
|
case "msrow":
|
|
285
288
|
case "mrow":
|
|
286
|
-
i.push(
|
|
289
|
+
i.push(M([...e.children], o, r));
|
|
287
290
|
break;
|
|
288
|
-
default: i.push(
|
|
291
|
+
default: i.push(M([e], o, r));
|
|
289
292
|
}
|
|
290
293
|
});
|
|
291
294
|
}
|
|
292
|
-
function
|
|
295
|
+
function I(e) {
|
|
293
296
|
return -e.anchor - e.position;
|
|
294
297
|
}
|
|
295
|
-
function
|
|
298
|
+
function xe(e) {
|
|
296
299
|
return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
|
|
297
300
|
}
|
|
298
|
-
function
|
|
299
|
-
return
|
|
301
|
+
function Se(e) {
|
|
302
|
+
return I(e) + xe(e) - 1;
|
|
300
303
|
}
|
|
301
|
-
function
|
|
302
|
-
let i = (e) =>
|
|
304
|
+
function Ce(e, t, n, r) {
|
|
305
|
+
let i = (e) => T(r.document, "mpadded", [t], {
|
|
303
306
|
width: "0",
|
|
304
307
|
...e ? { lspace: e } : {}
|
|
305
|
-
}), a = (e, t) =>
|
|
308
|
+
}), a = (e, t) => T(r.document, e, t);
|
|
306
309
|
switch (n) {
|
|
307
310
|
case "s": return a("munder", [e, i("-0.5width")]);
|
|
308
311
|
case "ne": return a("msup", [e, i()]);
|
|
@@ -324,47 +327,47 @@ function we(e, t, n, r) {
|
|
|
324
327
|
default: return a("mover", [e, i("-0.5width")]);
|
|
325
328
|
}
|
|
326
329
|
}
|
|
327
|
-
function
|
|
328
|
-
let r =
|
|
330
|
+
function we(e, t, n) {
|
|
331
|
+
let r = T(n.document, "menclose", [e], {
|
|
329
332
|
notation: t.join(" "),
|
|
330
333
|
"data-padding": "0.1em",
|
|
331
334
|
"data-thickness": "0.067em"
|
|
332
335
|
}), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
|
|
333
|
-
return i ?
|
|
336
|
+
return i ? T(n.document, "mpadded", [r], {
|
|
334
337
|
lspace: `-${i}em`,
|
|
335
338
|
width: `-${2 * i}em`
|
|
336
339
|
}) : r;
|
|
337
340
|
}
|
|
338
|
-
function
|
|
339
|
-
let a = e && t.crossout.length ?
|
|
341
|
+
function Te(e, t, n, r, i) {
|
|
342
|
+
let a = e && t.crossout.length ? we(e, t.crossout, i) : e;
|
|
340
343
|
if (!t.content) return a;
|
|
341
|
-
let o =
|
|
342
|
-
return
|
|
344
|
+
let o = T(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
|
|
345
|
+
return Ce(a ?? D(i), o, n, i);
|
|
343
346
|
}
|
|
344
|
-
function
|
|
345
|
-
return e.carries[t -
|
|
347
|
+
function Ee(e, t) {
|
|
348
|
+
return e.carries[t - I(e)] ?? null;
|
|
346
349
|
}
|
|
347
350
|
function De(e, t, n, r) {
|
|
348
351
|
let i = e.content;
|
|
349
352
|
n.forEach((e, a) => {
|
|
350
|
-
let o = n.length - 1 - a, s = n[o], c =
|
|
353
|
+
let o = n.length - 1 - a, s = n[o], c = Ee(s, t), l = n.slice(0, o).some((e) => Ee(e, t));
|
|
351
354
|
if (!c && !l) return;
|
|
352
355
|
let u = c ?? {
|
|
353
|
-
content:
|
|
356
|
+
content: D(r),
|
|
354
357
|
location: "n",
|
|
355
358
|
crossout: []
|
|
356
359
|
}, d = a === 0 ? u.location : "n";
|
|
357
|
-
i =
|
|
360
|
+
i = Te(i, u, d, s.scale, r);
|
|
358
361
|
}), e.content = i;
|
|
359
362
|
}
|
|
360
|
-
function
|
|
361
|
-
let n = e.filter((e) =>
|
|
363
|
+
function Oe(e, t) {
|
|
364
|
+
let n = e.filter((e) => xe(e) > 0), r = Math.min(0, ...n.map(I)), i = Math.max(r, ...n.map(Se)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
|
|
362
365
|
content: null,
|
|
363
366
|
borders: {}
|
|
364
|
-
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a +
|
|
367
|
+
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a + I(e) + n), u = [], d = [], f = (e) => {
|
|
365
368
|
let n = c();
|
|
366
369
|
e.cells.forEach((t, r) => {
|
|
367
|
-
n[a +
|
|
370
|
+
n[a + I(e) + r].content = t;
|
|
368
371
|
}), u.length && n.forEach((e, n) => {
|
|
369
372
|
De(e, n - a, u, t);
|
|
370
373
|
});
|
|
@@ -386,44 +389,44 @@ function I(e, t) {
|
|
|
386
389
|
origin: a
|
|
387
390
|
};
|
|
388
391
|
}
|
|
389
|
-
function
|
|
390
|
-
let r =
|
|
392
|
+
function ke(e, { rows: t }, n) {
|
|
393
|
+
let r = T(n.document, "mtable", t.map((e) => T(n.document, "mtr", e.map((e) => {
|
|
391
394
|
let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
|
|
392
|
-
return
|
|
395
|
+
return T(n.document, "mtd", [e.content], {
|
|
393
396
|
...t ? { style: t } : {},
|
|
394
397
|
...e.align ? { columnalign: e.align } : {}
|
|
395
398
|
});
|
|
396
399
|
}))));
|
|
397
|
-
for (let { name: t, value: n } of [...e.attributes])
|
|
398
|
-
let i =
|
|
399
|
-
return r.setAttribute("columnspacing",
|
|
400
|
+
for (let { name: t, value: n } of [...e.attributes]) _e.has(t) || r.setAttribute(t, n);
|
|
401
|
+
let i = O(e, "charspacing") ?? "medium", a = O(e, "charalign");
|
|
402
|
+
return r.setAttribute("columnspacing", C[i] ?? (w.test(i) ? i : C.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
|
|
400
403
|
}
|
|
401
|
-
function
|
|
404
|
+
function Ae(e) {
|
|
402
405
|
return {
|
|
403
406
|
document: e.ownerDocument,
|
|
404
|
-
stackAlign:
|
|
407
|
+
stackAlign: O(e, "stackalign") ?? "decimalpoint",
|
|
405
408
|
decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
|
|
406
409
|
};
|
|
407
410
|
}
|
|
408
|
-
function
|
|
409
|
-
let t =
|
|
410
|
-
return
|
|
411
|
+
function je(e) {
|
|
412
|
+
let t = Ae(e), n = [];
|
|
413
|
+
return F([...e.children], 0, 0, t, n), ke(e, Oe(n, t), t);
|
|
411
414
|
}
|
|
412
|
-
function
|
|
415
|
+
function L(e, t, n, r, i, a) {
|
|
413
416
|
for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
|
|
414
417
|
}
|
|
415
|
-
function
|
|
416
|
-
let n =
|
|
417
|
-
return n.setAttribute("minsize", "1.2em"), [
|
|
418
|
+
function Me(e, t) {
|
|
419
|
+
let n = E(t, ")");
|
|
420
|
+
return n.setAttribute("minsize", "1.2em"), [T(t.document, "mrow", [e, T(t.document, "mspace", [], { width: "0.2em" })]), T(t.document, "mpadded", [n], {
|
|
418
421
|
voffset: "0.1em",
|
|
419
422
|
lspace: "-0.15em",
|
|
420
423
|
depth: "-0.2em",
|
|
421
424
|
height: "-0.2em"
|
|
422
425
|
})];
|
|
423
426
|
}
|
|
424
|
-
function
|
|
425
|
-
let t =
|
|
426
|
-
|
|
427
|
+
function Ne(e) {
|
|
428
|
+
let t = Ae(e), [n, r, ...i] = [...e.children], a = n && !A(n) ? n : null, o = r && !A(r) ? r : null, s = O(e, "longdivstyle") ?? "lefttop", c = P(e), l = [];
|
|
429
|
+
F(i, 0, 0, t, l);
|
|
427
430
|
let u = l.find((e) => e.kind === "digits");
|
|
428
431
|
u || (u = {
|
|
429
432
|
kind: "digits",
|
|
@@ -435,51 +438,51 @@ function Ae(e) {
|
|
|
435
438
|
u.cells.unshift(...e), u.anchor += e.length;
|
|
436
439
|
}, p = (...e) => {
|
|
437
440
|
let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
|
|
438
|
-
u.cells.push(...
|
|
441
|
+
u.cells.push(...M(n, 0, t).cells);
|
|
439
442
|
};
|
|
440
443
|
switch (s) {
|
|
441
444
|
case "left/\\right":
|
|
442
|
-
f(a,
|
|
445
|
+
f(a, E(t, "/")), p(E(t, "\\"), o);
|
|
443
446
|
break;
|
|
444
447
|
case "left)(right":
|
|
445
|
-
f(a,
|
|
448
|
+
f(a, E(t, ")")), p(E(t, "("), o);
|
|
446
449
|
break;
|
|
447
450
|
case ":right=right":
|
|
448
|
-
p(
|
|
451
|
+
p(E(t, ":"), a, E(t, "="), o);
|
|
449
452
|
break;
|
|
450
453
|
case "righttop":
|
|
451
454
|
case "stackedleftlinetop":
|
|
452
455
|
case "lefttop":
|
|
453
|
-
o &&
|
|
456
|
+
o && F([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...Me(a, t));
|
|
454
457
|
break;
|
|
455
458
|
}
|
|
456
|
-
let m =
|
|
459
|
+
let m = Oe(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + I(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + Se(e)));
|
|
457
460
|
switch (s) {
|
|
458
461
|
case "left/\\right":
|
|
459
462
|
case "left)(right":
|
|
460
463
|
case ":right=right": break;
|
|
461
464
|
case "righttop": {
|
|
462
465
|
let e = h[g][_(u.cells.length - 1)];
|
|
463
|
-
e.borders.left = c, e.borders.bottom = c,
|
|
466
|
+
e.borders.left = c, e.borders.bottom = c, L(h, g, _(0), _(u.cells.length - 1), "top", c);
|
|
464
467
|
break;
|
|
465
468
|
}
|
|
466
469
|
case "stackedleftlinetop": {
|
|
467
470
|
let e = h[g][_(0)];
|
|
468
|
-
e.borders.right = c, e.borders.bottom = c,
|
|
471
|
+
e.borders.right = c, e.borders.bottom = c, L(h, g, _(1), v, "top", c);
|
|
469
472
|
break;
|
|
470
473
|
}
|
|
471
474
|
case "stackedrightright":
|
|
472
475
|
case "mediumstackedrightright":
|
|
473
476
|
case "shortstackedrightright":
|
|
474
477
|
case "stackedleftleft":
|
|
475
|
-
|
|
478
|
+
Pe(h, g, s, a, o, c, t);
|
|
476
479
|
break;
|
|
477
|
-
default:
|
|
480
|
+
default: L(h, g, _(1), v, "top", c);
|
|
478
481
|
}
|
|
479
|
-
return
|
|
482
|
+
return ke(e, m, t);
|
|
480
483
|
}
|
|
481
|
-
function
|
|
482
|
-
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e &&
|
|
484
|
+
function Pe(e, t, n, r, i, a, o) {
|
|
485
|
+
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && T(o.document, "mpadded", [e], {
|
|
483
486
|
lspace: "0.2em",
|
|
484
487
|
width: "+0.4em"
|
|
485
488
|
});
|
|
@@ -498,64 +501,64 @@ function je(e, t, n, r, i, a, o) {
|
|
|
498
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);
|
|
499
502
|
});
|
|
500
503
|
}
|
|
501
|
-
function
|
|
502
|
-
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ?
|
|
504
|
+
function Fe(e) {
|
|
505
|
+
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? je(t) : Ne(t));
|
|
503
506
|
}
|
|
504
|
-
var
|
|
507
|
+
var Ie = "PIE-MJX-explorer-styles", R = "var(--pie-text, black)", Le = "var(--pie-background, #ffffff)", Re = "var(--pie-border-dark, #66686A)", z = "var(--pie-focus-outline, var(--pie-button-focus-outline, var(--pie-focus-checked-border, #1565C0)))", B = `color-mix(in srgb, ${z} 15%, transparent)`, ze = `
|
|
505
508
|
:root mjx-container [data-sre-highlight-1]:not([data-mjx-collapsed], rect) {
|
|
506
|
-
color: ${
|
|
507
|
-
fill: ${
|
|
509
|
+
color: ${R} !important;
|
|
510
|
+
fill: ${R} !important;
|
|
508
511
|
}
|
|
509
512
|
:root mjx-container:not([data-mjx-clone-container]) [data-sre-highlight-1]:not([data-sre-enclosed], rect) {
|
|
510
|
-
background-color: ${
|
|
513
|
+
background-color: ${B} !important;
|
|
511
514
|
}
|
|
512
515
|
:root mjx-container rect[data-sre-highlight-1]:not([data-sre-enclosed]) {
|
|
513
|
-
fill: ${
|
|
516
|
+
fill: ${B} !important;
|
|
514
517
|
}
|
|
515
518
|
:root mjx-container .mjx-selected {
|
|
516
|
-
outline: 2px solid ${
|
|
519
|
+
outline: 2px solid ${z} !important;
|
|
517
520
|
}
|
|
518
521
|
:root mjx-container [data-sre-highlight-2] {
|
|
519
|
-
color: ${
|
|
522
|
+
color: ${R} !important;
|
|
520
523
|
background-color: transparent !important;
|
|
521
|
-
fill: ${
|
|
522
|
-
outline: 2px dashed ${
|
|
524
|
+
fill: ${R} !important;
|
|
525
|
+
outline: 2px dashed ${z} !important;
|
|
523
526
|
}
|
|
524
527
|
:root mjx-container rect[data-sre-highlight-2] {
|
|
525
528
|
fill: transparent !important;
|
|
526
|
-
stroke: ${
|
|
529
|
+
stroke: ${z} !important;
|
|
527
530
|
stroke-width: 2px !important;
|
|
528
531
|
vector-effect: non-scaling-stroke;
|
|
529
532
|
}
|
|
530
533
|
:root .MJX_LiveRegion, :root .MJX_HoverRegion, :root .MJX_ToolTip {
|
|
531
|
-
color: ${
|
|
532
|
-
background-color: ${
|
|
533
|
-
border-color: ${
|
|
534
|
+
color: ${R} !important;
|
|
535
|
+
background-color: ${Le} !important;
|
|
536
|
+
border-color: ${Re} !important;
|
|
534
537
|
}
|
|
535
538
|
:root .MJX_LiveRegion > div, :root .MJX_HoverRegion > div {
|
|
536
|
-
color: ${
|
|
537
|
-
background-color: ${
|
|
539
|
+
color: ${R} !important;
|
|
540
|
+
background-color: ${B} !important;
|
|
538
541
|
}
|
|
539
542
|
`;
|
|
540
|
-
function
|
|
543
|
+
function Be(e = document) {
|
|
541
544
|
if (e.getElementById("PIE-MJX-explorer-styles")) return;
|
|
542
545
|
let t = e.createElement("style");
|
|
543
|
-
t.id =
|
|
546
|
+
t.id = Ie, t.textContent = ze, e.head.appendChild(t);
|
|
544
547
|
}
|
|
545
|
-
var
|
|
548
|
+
var Ve = /[-]/g, V = {
|
|
546
549
|
"+": "positive",
|
|
547
550
|
"-": "negative",
|
|
548
551
|
"−": "negative",
|
|
549
552
|
"±": "plus or minus",
|
|
550
553
|
"∓": "minus or plus"
|
|
551
|
-
},
|
|
554
|
+
}, He = {
|
|
552
555
|
"(": "open parenthesis",
|
|
553
556
|
"[": "open bracket",
|
|
554
557
|
"{": "open brace",
|
|
555
558
|
"⟨": "open angle bracket",
|
|
556
559
|
"⌊": "open floor",
|
|
557
560
|
"⌈": "open ceiling"
|
|
558
|
-
},
|
|
561
|
+
}, H = {
|
|
559
562
|
")": "close parenthesis",
|
|
560
563
|
"]": "close bracket",
|
|
561
564
|
"}": "close brace",
|
|
@@ -568,7 +571,7 @@ var Re = /[-]/g, ze = {
|
|
|
568
571
|
"°": "degrees",
|
|
569
572
|
"′": "prime",
|
|
570
573
|
"″": "double prime"
|
|
571
|
-
},
|
|
574
|
+
}, Ue = {
|
|
572
575
|
"+": "plus",
|
|
573
576
|
"-": "minus",
|
|
574
577
|
"−": "minus",
|
|
@@ -612,16 +615,16 @@ var Re = /[-]/g, ze = {
|
|
|
612
615
|
":": "colon",
|
|
613
616
|
"|": "vertical bar",
|
|
614
617
|
"‖": "double vertical bar",
|
|
615
|
-
...
|
|
616
|
-
...
|
|
618
|
+
...He,
|
|
619
|
+
...H,
|
|
617
620
|
...U
|
|
618
|
-
},
|
|
621
|
+
}, We = /* @__PURE__ */ new Set(["|", "‖"]), Ge = /* @__PURE__ */ new Set([
|
|
619
622
|
"∑",
|
|
620
623
|
"∏",
|
|
621
624
|
"∫",
|
|
622
625
|
"∪",
|
|
623
626
|
"∩"
|
|
624
|
-
]),
|
|
627
|
+
]), Ke = {
|
|
625
628
|
α: "alpha",
|
|
626
629
|
β: "beta",
|
|
627
630
|
γ: "gamma",
|
|
@@ -648,7 +651,7 @@ var Re = /[-]/g, ze = {
|
|
|
648
651
|
cot: "cotangent",
|
|
649
652
|
ln: "natural log",
|
|
650
653
|
lim: "limit"
|
|
651
|
-
},
|
|
654
|
+
}, qe = {
|
|
652
655
|
"¯": "bar",
|
|
653
656
|
"‾": "bar",
|
|
654
657
|
"―": "bar",
|
|
@@ -659,7 +662,7 @@ var Re = /[-]/g, ze = {
|
|
|
659
662
|
"→": "vector",
|
|
660
663
|
"⃗": "vector",
|
|
661
664
|
"˙": "dot"
|
|
662
|
-
}, W = (e) => (e.textContent ?? "").replace(
|
|
665
|
+
}, W = (e) => (e.textContent ?? "").replace(Ve, "").replace(/\s+/g, " ").trim(), G = (e) => e.replace(/\s+/g, " ").trim(), K = (e) => [...e.children];
|
|
663
666
|
function q(e) {
|
|
664
667
|
return !e || [
|
|
665
668
|
"mn",
|
|
@@ -668,22 +671,22 @@ function q(e) {
|
|
|
668
671
|
"mo"
|
|
669
672
|
].includes(e.localName) ? !0 : ["mrow", "mstyle"].includes(e.localName) && e.children.length === 1 ? q(e.children[0]) : !1;
|
|
670
673
|
}
|
|
671
|
-
function
|
|
674
|
+
function Je(e) {
|
|
672
675
|
let t = e ? W(e) : "";
|
|
673
676
|
return /^\d{1,3}$/.test(t) ? Number(t) : void 0;
|
|
674
677
|
}
|
|
675
|
-
function
|
|
678
|
+
function Ye(e) {
|
|
676
679
|
return `${e}${e % 100 >= 11 && e % 100 <= 13 ? "th" : {
|
|
677
680
|
1: "st",
|
|
678
681
|
2: "nd",
|
|
679
682
|
3: "rd"
|
|
680
683
|
}[e % 10] ?? "th"}`;
|
|
681
684
|
}
|
|
682
|
-
function
|
|
683
|
-
return
|
|
685
|
+
function Xe(e) {
|
|
686
|
+
return Ke[e] ?? e;
|
|
684
687
|
}
|
|
685
688
|
function J(e) {
|
|
686
|
-
return
|
|
689
|
+
return Ue[e] ?? e;
|
|
687
690
|
}
|
|
688
691
|
function Y(e) {
|
|
689
692
|
let t = [], n = !1;
|
|
@@ -693,11 +696,11 @@ function Y(e) {
|
|
|
693
696
|
continue;
|
|
694
697
|
}
|
|
695
698
|
let e = W(r);
|
|
696
|
-
e && (!n &&
|
|
699
|
+
e && (!n && V[e] ? t.push(V[e]) : e in U ? t.push(U[e]) : (t.push(J(e)), n = e in H || We.has(e) && n));
|
|
697
700
|
}
|
|
698
701
|
return t.filter(Boolean).join(" ");
|
|
699
702
|
}
|
|
700
|
-
function
|
|
703
|
+
function Ze(e) {
|
|
701
704
|
let [t, ...n] = e, r = n[n.length - 1], i = (e) => e?.localName === "mo" && ["|", "‖"].includes(W(e)), a = n.slice(0, -1);
|
|
702
705
|
if (a.length && i(t) && i(r) && W(t) === W(r) && !a.some(i)) {
|
|
703
706
|
let e = G(Y(a));
|
|
@@ -705,14 +708,14 @@ function Xe(e) {
|
|
|
705
708
|
}
|
|
706
709
|
return Y(e);
|
|
707
710
|
}
|
|
708
|
-
function
|
|
711
|
+
function Qe(e, t) {
|
|
709
712
|
let n = e ? X(e) : "", r = t ? X(t) : "";
|
|
710
713
|
return q(e) && q(t) ? `${n} over ${r}` : `the fraction with numerator ${n} and denominator ${r}`;
|
|
711
714
|
}
|
|
712
|
-
function
|
|
715
|
+
function $e(e, t, n) {
|
|
713
716
|
return n ? `${t} of ${e}` : `${t} of ${e} end root`;
|
|
714
717
|
}
|
|
715
|
-
function
|
|
718
|
+
function et(e, t) {
|
|
716
719
|
let n = t ? W(t) : "";
|
|
717
720
|
if (t && q(t)) {
|
|
718
721
|
if (n === "2") return `${e} squared`;
|
|
@@ -722,22 +725,22 @@ function $e(e, t) {
|
|
|
722
725
|
let r = t ? X(t) : "";
|
|
723
726
|
return q(t) ? `${e} to the power of ${r}` : `${e} to the power of ${r} end power`;
|
|
724
727
|
}
|
|
725
|
-
function
|
|
728
|
+
function tt(e, t) {
|
|
726
729
|
let n = t ? X(t) : "";
|
|
727
730
|
return q(t) ? `${e} sub ${n}` : `${e} sub ${n} end sub`;
|
|
728
731
|
}
|
|
729
|
-
function
|
|
732
|
+
function nt(e, t, n) {
|
|
730
733
|
let r = W(e);
|
|
731
734
|
if (r === "lim") return `limit as ${t ? X(t) : ""} of`;
|
|
732
|
-
if (!
|
|
735
|
+
if (!Ge.has(r)) return;
|
|
733
736
|
let i = t ? `from ${X(t)}` : "", a = n ? `to ${X(n)}` : "";
|
|
734
737
|
return `${J(r)} ${i} ${a} of`;
|
|
735
738
|
}
|
|
736
|
-
function
|
|
739
|
+
function rt(e) {
|
|
737
740
|
let t = K(e).filter((e) => ["mtr", "mlabeledtr"].includes(e.localName)), n = t.map((e) => K(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) => G(Y(K(e)))).join(", ")}`);
|
|
738
741
|
return `table with ${t.length} ${t.length === 1 ? "row" : "rows"} and ${r} ${r === 1 ? "column" : "columns"}. ${i.join(". ")}`;
|
|
739
742
|
}
|
|
740
|
-
function
|
|
743
|
+
function it(e) {
|
|
741
744
|
let t = e.getAttribute("open") ?? "(", n = e.getAttribute("close") ?? ")", r = (e.getAttribute("separators") ?? ",").replace(/\s+/g, "").split(""), i = K(e).map((e, t, n) => t < n.length - 1 ? `${X(e)} ${J(r[Math.min(t, r.length - 1)] ?? ",")}` : X(e));
|
|
742
745
|
return [
|
|
743
746
|
J(t),
|
|
@@ -748,7 +751,7 @@ function rt(e) {
|
|
|
748
751
|
function X(e) {
|
|
749
752
|
let t = K(e);
|
|
750
753
|
switch (e.localName) {
|
|
751
|
-
case "mi": return
|
|
754
|
+
case "mi": return Xe(W(e));
|
|
752
755
|
case "mn":
|
|
753
756
|
case "mtext":
|
|
754
757
|
case "ms": return W(e);
|
|
@@ -758,38 +761,38 @@ function X(e) {
|
|
|
758
761
|
case "annotation":
|
|
759
762
|
case "annotation-xml": return "";
|
|
760
763
|
case "semantics": return t[0] ? X(t[0]) : "";
|
|
761
|
-
case "mfrac": return
|
|
762
|
-
case "msqrt": return
|
|
764
|
+
case "mfrac": return Qe(t[0], t[1]);
|
|
765
|
+
case "msqrt": return $e(G(Y(t)), "square root", t.length === 1 && q(t[0]));
|
|
763
766
|
case "mroot": {
|
|
764
|
-
let e =
|
|
765
|
-
return
|
|
767
|
+
let e = Je(t[1]), n = e === 2 ? "square root" : e === 3 ? "cube root" : e ? `${Ye(e)} root` : `root with index ${t[1] ? X(t[1]) : ""}`;
|
|
768
|
+
return $e(t[0] ? X(t[0]) : "", n, q(t[0]));
|
|
766
769
|
}
|
|
767
|
-
case "msup": return
|
|
768
|
-
case "msub": return
|
|
769
|
-
case "msubsup": return (t[0] ?
|
|
770
|
+
case "msup": return et(t[0] ? X(t[0]) : "", t[1]);
|
|
771
|
+
case "msub": return tt(t[0] ? X(t[0]) : "", t[1]);
|
|
772
|
+
case "msubsup": return (t[0] ? nt(t[0], t[1], t[2]) : void 0) || et(tt(t[0] ? X(t[0]) : "", t[1]), t[2]);
|
|
770
773
|
case "munder":
|
|
771
774
|
case "mover":
|
|
772
775
|
case "munderover": {
|
|
773
|
-
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 ? nt(n, a, o) : void 0;
|
|
774
777
|
if (s) return s;
|
|
775
|
-
let c = n ? X(n) : "", l = e.localName === "mover" && r ?
|
|
778
|
+
let c = n ? X(n) : "", l = e.localName === "mover" && r ? qe[W(r)] : void 0;
|
|
776
779
|
return l ? l === "vector" ? `vector ${c}` : `${c} ${l}` : [
|
|
777
780
|
c,
|
|
778
781
|
a ? `with ${X(a)} below` : "",
|
|
779
782
|
o ? `with ${X(o)} above` : ""
|
|
780
783
|
].filter(Boolean).join(" ");
|
|
781
784
|
}
|
|
782
|
-
case "mfenced": return
|
|
783
|
-
case "mtable": return
|
|
785
|
+
case "mfenced": return it(e);
|
|
786
|
+
case "mtable": return rt(e);
|
|
784
787
|
case "mrow":
|
|
785
|
-
case "math": return
|
|
788
|
+
case "math": return Ze(t);
|
|
786
789
|
default: return t.length ? Y(t) : W(e);
|
|
787
790
|
}
|
|
788
791
|
}
|
|
789
|
-
function
|
|
792
|
+
function at(e) {
|
|
790
793
|
return G(X(e));
|
|
791
794
|
}
|
|
792
|
-
var
|
|
795
|
+
var ot = [
|
|
793
796
|
"a[href]",
|
|
794
797
|
"button",
|
|
795
798
|
"label",
|
|
@@ -809,70 +812,70 @@ var at = [
|
|
|
809
812
|
"treeitem"
|
|
810
813
|
].map((e) => `[role="${e}"]`)
|
|
811
814
|
].join(", ");
|
|
812
|
-
function
|
|
813
|
-
if (e.hasAttribute("aria-label") || !e.closest(
|
|
814
|
-
let t = e.querySelector("math"), n = t ?
|
|
815
|
+
function st(e) {
|
|
816
|
+
if (e.hasAttribute("aria-label") || !e.closest(ot)) return;
|
|
817
|
+
let t = e.querySelector("math"), n = t ? at(t) : "";
|
|
815
818
|
n && e.setAttribute("aria-label", n);
|
|
816
819
|
}
|
|
817
|
-
function
|
|
818
|
-
for (let t of e.querySelectorAll("mjx-container"))
|
|
820
|
+
function ct(e) {
|
|
821
|
+
for (let t of e.querySelectorAll("mjx-container")) st(t);
|
|
819
822
|
}
|
|
820
|
-
var
|
|
821
|
-
function
|
|
823
|
+
var lt = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
|
|
824
|
+
function ut() {
|
|
822
825
|
let e = globalThis;
|
|
823
|
-
e[
|
|
826
|
+
e[lt] || (e[lt] = !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}`));
|
|
824
827
|
}
|
|
825
|
-
function
|
|
828
|
+
function dt(e) {
|
|
826
829
|
let t = e.webworker;
|
|
827
830
|
if (!t || t.ready) return;
|
|
828
831
|
e.options ??= {};
|
|
829
832
|
let n = e.options;
|
|
830
|
-
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(),
|
|
833
|
+
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), ut();
|
|
831
834
|
}
|
|
832
|
-
function
|
|
835
|
+
function ft(e) {
|
|
833
836
|
let t = e?.adaptor, n = t?.createWorker;
|
|
834
837
|
!e || !t || !n || (t.createWorker = async (r, i) => {
|
|
835
838
|
let a = await n.call(t, r, i);
|
|
836
|
-
return a.addEventListener("error", () =>
|
|
839
|
+
return a.addEventListener("error", () => dt(e), { once: !0 }), a;
|
|
837
840
|
});
|
|
838
841
|
}
|
|
839
842
|
`${i}`;
|
|
840
|
-
var
|
|
843
|
+
var pt = {
|
|
841
844
|
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
842
845
|
overarc: "\\overparen",
|
|
843
846
|
napprox: "\\not\\approx",
|
|
844
847
|
longdiv: "\\enclose{longdiv}",
|
|
845
848
|
abs: ["\\left|#1\\right|", 1]
|
|
846
|
-
},
|
|
849
|
+
}, mt = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", ht = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, gt = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, _t = /\\embed\{newLine\}\[\]/g, vt = [
|
|
847
850
|
["$$", "$$"],
|
|
848
851
|
["$", "$"],
|
|
849
852
|
["\\[", "\\]"],
|
|
850
853
|
["\\(", "\\)"]
|
|
851
|
-
],
|
|
854
|
+
], yt = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), bt = "MJX-CHTML-styles", xt = "PIE-MJX-SVG-styles", Z = "PIE-MathJax-Menu-Settings", St = { "mjx-container[overflow=\"linebreak\"][display]": {
|
|
852
855
|
overflow: "auto clip",
|
|
853
856
|
"min-width": "initial !important"
|
|
854
|
-
} },
|
|
857
|
+
} }, Ct = 200, wt = 201, Tt = 202;
|
|
855
858
|
function Q(e) {
|
|
856
859
|
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
857
860
|
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");
|
|
858
861
|
}
|
|
859
|
-
function
|
|
860
|
-
for (let [t, n] of
|
|
862
|
+
function Et(e) {
|
|
863
|
+
for (let [t, n] of vt) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
861
864
|
return e;
|
|
862
865
|
}
|
|
863
|
-
function
|
|
864
|
-
return
|
|
866
|
+
function Dt(e) {
|
|
867
|
+
return Et(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
865
868
|
}
|
|
866
|
-
var
|
|
869
|
+
var Ot = "mathjax_ignore", $ = "mathjax_process";
|
|
867
870
|
function kt(e, t) {
|
|
868
|
-
let n = e.closest(`.${
|
|
869
|
-
return n !== null && t.contains(n) && !n.classList.contains(
|
|
871
|
+
let n = e.closest(`.${Ot}, .${$}`);
|
|
872
|
+
return n !== null && t.contains(n) && !n.classList.contains($);
|
|
870
873
|
}
|
|
871
874
|
function At(e) {
|
|
872
875
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
873
876
|
if (t.dataset.mathHandled || t.closest("mjx-container") || kt(t, e)) continue;
|
|
874
877
|
let n = t.textContent;
|
|
875
|
-
n && (t.textContent = `\\(${
|
|
878
|
+
n && (t.textContent = `\\(${Dt(n)}\\)`.replace(_t, "\\newline "), t.dataset.mathHandled = "true");
|
|
876
879
|
}
|
|
877
880
|
}
|
|
878
881
|
function jt(e) {
|
|
@@ -880,41 +883,41 @@ function jt(e) {
|
|
|
880
883
|
}
|
|
881
884
|
function Mt(e, t) {
|
|
882
885
|
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
883
|
-
return (t ?
|
|
886
|
+
return (t ? gt : ht).test(e.textContent ?? "");
|
|
884
887
|
}
|
|
885
888
|
function Nt(e) {
|
|
886
889
|
return new Promise((t, n) => {
|
|
887
|
-
let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s =
|
|
890
|
+
let { useSingleDollar: r = !1, accessibility: i = !0, loadFonts: a = !0, srcUrl: o } = e, s = f(e, import.meta.url), l = c(), u = {
|
|
888
891
|
loader: {
|
|
889
892
|
load: i ? ["a11y/assistive-mml"] : [],
|
|
890
893
|
failed: (e) => n(e),
|
|
891
894
|
"output/svg": { ready: (e) => {
|
|
892
|
-
let t =
|
|
893
|
-
return
|
|
895
|
+
let t = y();
|
|
896
|
+
return Pt(t) && Ft(t), e;
|
|
894
897
|
} }
|
|
895
898
|
},
|
|
896
899
|
startup: {
|
|
897
900
|
typeset: !1,
|
|
898
901
|
ready: () => {
|
|
899
|
-
let e =
|
|
900
|
-
i && (
|
|
902
|
+
let e = y(), r = e?.startup, i = Pt(e);
|
|
903
|
+
i && (Ft(e), It(e, s.speechLocales), p(e?._?.a11y?.sre_ts?.locales, s.speechLocales)), r?.defaultReady?.(), i && (Lt(r?.document), Rt(r?.document), r?.document?.addStyles?.(St), ft(r?.document)), Promise.resolve(r?.promise).then(() => t(), n);
|
|
901
904
|
}
|
|
902
905
|
},
|
|
903
|
-
tex: { macros: { ...
|
|
906
|
+
tex: { macros: { ...pt } },
|
|
904
907
|
output: { displayOverflow: "linebreak" },
|
|
905
908
|
options: {
|
|
906
909
|
enableMenu: i,
|
|
907
910
|
menuOptions: { settings: {
|
|
908
911
|
assistiveMml: i,
|
|
909
912
|
enrich: !1,
|
|
910
|
-
inTabOrder:
|
|
913
|
+
inTabOrder: l
|
|
911
914
|
} },
|
|
912
|
-
a11y: { inTabOrder:
|
|
915
|
+
a11y: { inTabOrder: l }
|
|
913
916
|
}
|
|
914
917
|
};
|
|
915
|
-
r &&
|
|
916
|
-
let
|
|
917
|
-
|
|
918
|
+
r && u.tex && (console.warn(mt), u.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], u.tex.processEscapes = !0), a || (u.chtml = { fontURL: "" });
|
|
919
|
+
let d = m(s.speechLocales);
|
|
920
|
+
d && u.options && (u.options.sre = { locale: d }), ae(u, {
|
|
918
921
|
...s,
|
|
919
922
|
srcUrl: o
|
|
920
923
|
}).then((e) => {
|
|
@@ -922,16 +925,16 @@ function Nt(e) {
|
|
|
922
925
|
}, n);
|
|
923
926
|
});
|
|
924
927
|
}
|
|
925
|
-
function
|
|
928
|
+
function Pt(e) {
|
|
926
929
|
return !!e?.version?.startsWith("4.");
|
|
927
930
|
}
|
|
928
|
-
function
|
|
931
|
+
function Ft(e) {
|
|
929
932
|
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
930
|
-
n && (n.STYLESHEETID =
|
|
933
|
+
n && (n.STYLESHEETID = b);
|
|
931
934
|
let r = t?.svg_ts?.SVG;
|
|
932
|
-
r && (r.STYLESHEETID =
|
|
935
|
+
r && (r.STYLESHEETID = xt);
|
|
933
936
|
}
|
|
934
|
-
function
|
|
937
|
+
function It(e, t) {
|
|
935
938
|
let n = e?._?.ui?.menu?.Menu?.Menu;
|
|
936
939
|
if (n) {
|
|
937
940
|
n.MENU_STORAGE = Z;
|
|
@@ -944,13 +947,13 @@ function Ft(e, t) {
|
|
|
944
947
|
} catch {}
|
|
945
948
|
}
|
|
946
949
|
}
|
|
947
|
-
function
|
|
950
|
+
function Lt(e) {
|
|
948
951
|
if (!e) return;
|
|
949
952
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
950
953
|
let n = e.typesetRoot;
|
|
951
954
|
!n || t.has(n) || (Q(n), t.add(n));
|
|
952
955
|
};
|
|
953
|
-
e.addRenderAction?.("pie-strip-latex",
|
|
956
|
+
e.addRenderAction?.("pie-strip-latex", wt, (e) => {
|
|
954
957
|
for (let t of e.math ?? []) n(t);
|
|
955
958
|
return !1;
|
|
956
959
|
}, (e) => {
|
|
@@ -958,97 +961,97 @@ function It(e) {
|
|
|
958
961
|
return t && Q(t), !1;
|
|
959
962
|
});
|
|
960
963
|
let r = e.outputJax?.chtmlStyles;
|
|
961
|
-
r?.id ===
|
|
964
|
+
r?.id === bt && (r.id = b), Vt();
|
|
962
965
|
}
|
|
963
|
-
function
|
|
966
|
+
function Rt(e) {
|
|
964
967
|
let t = (e) => {
|
|
965
|
-
e.typesetRoot &&
|
|
968
|
+
e.typesetRoot && st(e.typesetRoot);
|
|
966
969
|
};
|
|
967
|
-
e?.addRenderAction?.("pie-name-math",
|
|
970
|
+
e?.addRenderAction?.("pie-name-math", Tt, (e) => {
|
|
968
971
|
for (let n of e.math ?? []) t(n);
|
|
969
972
|
return !1;
|
|
970
973
|
}, (e) => (t(e), !1));
|
|
971
974
|
}
|
|
972
|
-
function Rt(e) {
|
|
973
|
-
return e instanceof HTMLStyleElement && ae.includes(e.id);
|
|
974
|
-
}
|
|
975
975
|
function zt(e) {
|
|
976
|
-
|
|
976
|
+
return e instanceof HTMLStyleElement && se.includes(e.id);
|
|
977
977
|
}
|
|
978
|
-
function Bt() {
|
|
979
|
-
|
|
978
|
+
function Bt(e) {
|
|
979
|
+
ne("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
980
|
+
}
|
|
981
|
+
function Vt() {
|
|
982
|
+
let e = document.head, t = [...e.children].find(zt);
|
|
980
983
|
if (t) {
|
|
981
|
-
|
|
984
|
+
Bt(t);
|
|
982
985
|
return;
|
|
983
986
|
}
|
|
984
987
|
let n = new MutationObserver((e) => {
|
|
985
988
|
for (let t of e) {
|
|
986
|
-
let e = [...t.addedNodes].find(
|
|
989
|
+
let e = [...t.addedNodes].find(zt);
|
|
987
990
|
if (e) {
|
|
988
|
-
|
|
991
|
+
Bt(e), n.disconnect();
|
|
989
992
|
return;
|
|
990
993
|
}
|
|
991
994
|
}
|
|
992
995
|
});
|
|
993
996
|
n.observe(e, { childList: !0 });
|
|
994
997
|
}
|
|
995
|
-
function
|
|
998
|
+
function Ht(e) {
|
|
996
999
|
let t = e?.math;
|
|
997
1000
|
if (!t?.remove) return;
|
|
998
|
-
let n = [...t].filter((e) => (e.state?.() ?? 0) >=
|
|
1001
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= Ct && e.typesetRoot?.isConnected === !1);
|
|
999
1002
|
if (n.length !== 0) {
|
|
1000
1003
|
for (let e of [...n].reverse()) e.clear?.();
|
|
1001
1004
|
t.remove(...n);
|
|
1002
1005
|
}
|
|
1003
1006
|
}
|
|
1004
|
-
function
|
|
1007
|
+
function Ut(e) {
|
|
1005
1008
|
return new Promise((t, n) => {
|
|
1006
1009
|
let r = e.startup ?? {};
|
|
1007
1010
|
e.startup = r;
|
|
1008
1011
|
let i = r.ready;
|
|
1009
1012
|
r.ready = () => {
|
|
1010
|
-
let e =
|
|
1013
|
+
let e = y()?.startup;
|
|
1011
1014
|
i ? i.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
1012
1015
|
};
|
|
1013
1016
|
});
|
|
1014
1017
|
}
|
|
1015
|
-
function Ut(e) {
|
|
1016
|
-
let t = b();
|
|
1017
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Ht(t) : Nt(e);
|
|
1018
|
-
}
|
|
1019
1018
|
function Wt(e) {
|
|
1020
|
-
|
|
1021
|
-
|
|
1019
|
+
let t = y();
|
|
1020
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Ut(t) : Nt(e);
|
|
1021
|
+
}
|
|
1022
|
+
function Gt(e) {
|
|
1023
|
+
return Wt(e).then(() => {
|
|
1024
|
+
let e = y();
|
|
1022
1025
|
e && typeof e.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
1023
1026
|
});
|
|
1024
1027
|
}
|
|
1025
|
-
function
|
|
1026
|
-
let t =
|
|
1027
|
-
return n || (n =
|
|
1028
|
+
function Kt(e) {
|
|
1029
|
+
let t = oe, n = t[yt];
|
|
1030
|
+
return n || (n = Gt(e), t[yt] = n), n;
|
|
1028
1031
|
}
|
|
1029
|
-
function
|
|
1032
|
+
function qt(e = {}) {
|
|
1030
1033
|
let t = e.useSingleDollar ?? !1;
|
|
1031
1034
|
return async (n) => {
|
|
1032
1035
|
if (typeof window > "u") return;
|
|
1033
|
-
let r =
|
|
1034
|
-
r &&
|
|
1035
|
-
let i =
|
|
1036
|
+
let r = ce();
|
|
1037
|
+
r && ne("mathjax-3-global", `window.MathJax is MathJax ${r}`), At(n), de(n), jt(n), Fe(n);
|
|
1038
|
+
let i = Kt(e);
|
|
1036
1039
|
if (!Mt(n, t)) {
|
|
1037
1040
|
i.catch(() => {});
|
|
1038
1041
|
return;
|
|
1039
1042
|
}
|
|
1040
1043
|
await i;
|
|
1041
|
-
let a =
|
|
1044
|
+
let a = y();
|
|
1042
1045
|
if (await a?.startup?.promise, typeof a?.typesetPromise == "function") {
|
|
1043
|
-
|
|
1046
|
+
Be(), Ht(a.startup?.document);
|
|
1044
1047
|
try {
|
|
1045
1048
|
await a.typesetPromise([n]);
|
|
1046
1049
|
} catch (e) {
|
|
1047
1050
|
throw a.typesetClear?.([n]), e;
|
|
1048
1051
|
}
|
|
1049
|
-
Q(n),
|
|
1052
|
+
Q(n), ct(n);
|
|
1050
1053
|
}
|
|
1051
1054
|
};
|
|
1052
1055
|
}
|
|
1053
1056
|
//#endregion
|
|
1054
|
-
export {
|
|
1057
|
+
export { qt as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./math-mathjax-
|
|
1
|
+
import { t as e } from "./math-mathjax-AUjbtAPf.js";
|
|
2
2
|
//#region ../../node_modules/.bun/svelte@5.57.1/node_modules/svelte/src/internal/disclose-version.js
|
|
3
3
|
typeof window < "u" && ((window.__svelte ??= {}).v ??= /* @__PURE__ */ new Set()).add("5");
|
|
4
4
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/element-player",
|
|
3
|
-
"version": "0.1.6
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Shared PIE element player web component",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"unpkg": "./dist/pie-element-player.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dev": "vite"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@pie-element/shared-math-rendering-mathjax": "0.1.5
|
|
29
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.5"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"publishConfig": {
|