@pie-element/element-player 0.1.3-next.20261003064518 → 0.1.3-next.20261004003105
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.
|
@@ -1,71 +1,103 @@
|
|
|
1
1
|
//#region ../shared/math-rendering-mathjax/dist/index.js
|
|
2
|
-
var e = "
|
|
3
|
-
function r
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
var e = "https://github.com/pie-framework/pie-players/blob/develop/docs/item-player/loading-strategies.md#one-mathjax-version-per-page", t = Symbol.for("@pie-element/shared-math-rendering-mathjax/unsupported-page");
|
|
3
|
+
function n(n, r) {
|
|
4
|
+
if (typeof window > "u") return;
|
|
5
|
+
let i = globalThis;
|
|
6
|
+
i[t] ??= {
|
|
7
|
+
logged: !1,
|
|
8
|
+
conditions: []
|
|
9
|
+
};
|
|
10
|
+
let a = i[t];
|
|
11
|
+
if (a.conditions.includes(n)) return;
|
|
12
|
+
a.conditions.push(n);
|
|
13
|
+
let o = `[math-rendering] Unsupported page (${n}): ${r}. 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 ${e}`;
|
|
14
|
+
a.logged || (a.logged = !0, console.error(o)), window.dispatchEvent(new CustomEvent("pie-mathjax-version-conflict", { detail: {
|
|
15
|
+
condition: n,
|
|
16
|
+
message: o,
|
|
17
|
+
docsUrl: e
|
|
18
|
+
} }));
|
|
19
|
+
}
|
|
20
|
+
function r() {
|
|
21
|
+
let e = window.MathJax?.version;
|
|
22
|
+
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
23
|
+
}
|
|
24
|
+
function i() {
|
|
25
|
+
return window.MathJax;
|
|
26
|
+
}
|
|
27
|
+
function a(e, t) {
|
|
28
|
+
return new Promise((n, r) => {
|
|
29
|
+
window.MathJax = e;
|
|
30
|
+
let i = document.createElement("script");
|
|
31
|
+
i.src = t, i.async = !0, i.onload = () => n(), i.onerror = () => r(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(i);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
var o = globalThis, s = "PIE-MJX-CHTML-styles", c = ["MJX-CHTML-styles", "MJX-SVG-styles"], l = r, u = "http://www.w3.org/1998/Math/MathML", d = /^([a-z_][\w.-]*):math$/, f = /^[a-z][a-z0-9-]*$/;
|
|
35
|
+
function p(e) {
|
|
36
|
+
for (let t of e.querySelectorAll("*")) {
|
|
37
|
+
let n = d.exec(t.tagName.toLowerCase())?.[1];
|
|
38
|
+
!n || !e.contains(t) || t.closest("mjx-container") || t.replaceWith(m(t, `${n}:`));
|
|
7
39
|
}
|
|
8
40
|
}
|
|
9
|
-
function
|
|
10
|
-
let
|
|
11
|
-
if (!
|
|
12
|
-
let
|
|
13
|
-
for (let
|
|
14
|
-
for (let
|
|
15
|
-
let
|
|
16
|
-
|
|
41
|
+
function m(e, t) {
|
|
42
|
+
let n = e.tagName.toLowerCase().slice(t.length);
|
|
43
|
+
if (!f.test(n)) return e;
|
|
44
|
+
let r = e.ownerDocument.createElementNS(u, n);
|
|
45
|
+
for (let t of e.attributes) r.setAttribute(t.name, t.value);
|
|
46
|
+
for (let n of [...e.childNodes]) {
|
|
47
|
+
let e = n instanceof Element && n.tagName.toLowerCase().startsWith(t);
|
|
48
|
+
r.appendChild(e ? m(n, t) : n);
|
|
17
49
|
}
|
|
18
|
-
return
|
|
50
|
+
return r;
|
|
19
51
|
}
|
|
20
|
-
var
|
|
52
|
+
var h = /* @__PURE__ */ new Set([
|
|
21
53
|
"updiagonalstrike",
|
|
22
54
|
"downdiagonalstrike",
|
|
23
55
|
"verticalstrike",
|
|
24
56
|
"horizontalstrike"
|
|
25
|
-
]),
|
|
57
|
+
]), g = {
|
|
26
58
|
thin: "0.035em",
|
|
27
59
|
medium: "0.07em",
|
|
28
60
|
thick: "0.14em"
|
|
29
|
-
},
|
|
61
|
+
}, _ = {
|
|
30
62
|
tight: "0em",
|
|
31
63
|
medium: "0.1em",
|
|
32
64
|
loose: "0.2em"
|
|
33
|
-
},
|
|
65
|
+
}, v = /^(\d+(\.\d*)?|\.\d+)(em|ex|px|pt|pc|in|cm|mm)$/, ee = /^(#[0-9a-f]{3,8}|[a-z]+)$/i, te = /^(\d+(\.\d*)?|\.\d+)$/, ne = /* @__PURE__ */ new Set([
|
|
34
66
|
"mn",
|
|
35
67
|
"mo",
|
|
36
68
|
"mi",
|
|
37
69
|
"mtext"
|
|
38
|
-
]),
|
|
70
|
+
]), y = /* @__PURE__ */ new Set([
|
|
39
71
|
"stackalign",
|
|
40
72
|
"charalign",
|
|
41
73
|
"charspacing",
|
|
42
74
|
"longdivstyle"
|
|
43
75
|
]);
|
|
44
|
-
function
|
|
45
|
-
let
|
|
46
|
-
for (let [e, t] of Object.entries(
|
|
47
|
-
for (let e of
|
|
48
|
-
return
|
|
49
|
-
}
|
|
50
|
-
function
|
|
51
|
-
let n =
|
|
76
|
+
function b(e, t, n = [], r = {}) {
|
|
77
|
+
let i = e.createElementNS(u, t);
|
|
78
|
+
for (let [e, t] of Object.entries(r)) i.setAttribute(e, t);
|
|
79
|
+
for (let e of n) e && i.appendChild(e);
|
|
80
|
+
return i;
|
|
81
|
+
}
|
|
82
|
+
function x(e, t) {
|
|
83
|
+
let n = b(e.document, "mo");
|
|
52
84
|
return n.textContent = t, n;
|
|
53
85
|
}
|
|
54
|
-
function
|
|
55
|
-
let t =
|
|
56
|
-
return t.textContent = "0",
|
|
86
|
+
function S(e) {
|
|
87
|
+
let t = b(e.document, "mn");
|
|
88
|
+
return t.textContent = "0", b(e.document, "mphantom", [t]);
|
|
57
89
|
}
|
|
58
|
-
function
|
|
90
|
+
function C(e, t) {
|
|
59
91
|
return e.getAttribute(t)?.trim().toLowerCase() || void 0;
|
|
60
92
|
}
|
|
61
|
-
function
|
|
93
|
+
function w(e, t) {
|
|
62
94
|
let n = Number.parseInt(e.getAttribute(t) ?? "", 10);
|
|
63
95
|
return Number.isFinite(n) ? n : 0;
|
|
64
96
|
}
|
|
65
|
-
function
|
|
97
|
+
function T(e) {
|
|
66
98
|
return e.localName === "none" || e.localName === "mrow" && e.children.length === 0 && !e.textContent?.trim();
|
|
67
99
|
}
|
|
68
|
-
function
|
|
100
|
+
function E(e, t, n = e) {
|
|
69
101
|
switch (t) {
|
|
70
102
|
case "left": return 0;
|
|
71
103
|
case "center": return Math.floor(e / 2);
|
|
@@ -73,14 +105,14 @@ function y(e, t, n = e) {
|
|
|
73
105
|
default: return n;
|
|
74
106
|
}
|
|
75
107
|
}
|
|
76
|
-
function
|
|
108
|
+
function D(e, t, n) {
|
|
77
109
|
let r = [], i, a, o = (e, t) => {
|
|
78
110
|
let s = (e) => t.reduceRight((e, t) => {
|
|
79
111
|
let n = t.cloneNode(!1);
|
|
80
112
|
return n.appendChild(e), n;
|
|
81
113
|
}, e);
|
|
82
114
|
if (e.localName === "mstyle") for (let n of [...e.children]) o(n, [...t, e]);
|
|
83
|
-
else if (
|
|
115
|
+
else if (T(e)) r.push(null);
|
|
84
116
|
else if (e.localName === "mn" && e.children.length === 0) {
|
|
85
117
|
let t = [...(e.textContent ?? "").trim()];
|
|
86
118
|
for (let a of t) {
|
|
@@ -89,28 +121,28 @@ function b(e, t, n) {
|
|
|
89
121
|
t.textContent = a, r.push(s(t));
|
|
90
122
|
}
|
|
91
123
|
t.length && (a ??= r.length);
|
|
92
|
-
} else
|
|
124
|
+
} else ne.has(e.localName) && e.textContent?.trim() === n.decimalPoint && (i ??= r.length), r.push(s(e));
|
|
93
125
|
};
|
|
94
126
|
for (let t of e) o(t, []);
|
|
95
127
|
return {
|
|
96
128
|
kind: "digits",
|
|
97
129
|
cells: r,
|
|
98
|
-
anchor:
|
|
130
|
+
anchor: E(r.length, n.stackAlign, i ?? a),
|
|
99
131
|
position: t
|
|
100
132
|
};
|
|
101
133
|
}
|
|
102
|
-
function
|
|
103
|
-
return (e ?? "").toLowerCase().split(/\s+/).filter((e) =>
|
|
134
|
+
function O(e) {
|
|
135
|
+
return (e ?? "").toLowerCase().split(/\s+/).filter((e) => h.has(e));
|
|
104
136
|
}
|
|
105
|
-
function
|
|
106
|
-
let n = [...e.children].filter((e) => !
|
|
107
|
-
return n.length <= 1 ? n[0] ?? null :
|
|
137
|
+
function re(e, t) {
|
|
138
|
+
let n = [...e.children].filter((e) => !T(e));
|
|
139
|
+
return n.length <= 1 ? n[0] ?? null : b(t.document, "mrow", n);
|
|
108
140
|
}
|
|
109
|
-
function
|
|
110
|
-
let r =
|
|
111
|
-
content:
|
|
112
|
-
location:
|
|
113
|
-
crossout: e.hasAttribute("crossout") ?
|
|
141
|
+
function ie(e, t, n) {
|
|
142
|
+
let r = C(e, "location") ?? "n", i = O(e.getAttribute("crossout")), a = [...e.children].map((e) => T(e) ? null : e.localName === "mscarry" ? {
|
|
143
|
+
content: re(e, n),
|
|
144
|
+
location: C(e, "location") ?? r,
|
|
145
|
+
crossout: e.hasAttribute("crossout") ? O(e.getAttribute("crossout")) : i
|
|
114
146
|
} : {
|
|
115
147
|
content: e,
|
|
116
148
|
location: r,
|
|
@@ -119,60 +151,60 @@ function ee(e, t, n) {
|
|
|
119
151
|
return {
|
|
120
152
|
kind: "carries",
|
|
121
153
|
carries: a,
|
|
122
|
-
anchor:
|
|
154
|
+
anchor: E(a.length, n.stackAlign),
|
|
123
155
|
position: t,
|
|
124
|
-
scale:
|
|
156
|
+
scale: te.test(o) ? o : "0.6"
|
|
125
157
|
};
|
|
126
158
|
}
|
|
127
|
-
function
|
|
128
|
-
let t =
|
|
129
|
-
return `${n} solid ${
|
|
159
|
+
function k(e) {
|
|
160
|
+
let t = C(e, "mslinethickness") ?? "medium", n = g[t] ?? (v.test(t) ? t : "0.07em"), r = e.getAttribute("mathcolor")?.trim() ?? "";
|
|
161
|
+
return `${n} solid ${ee.test(r) ? r : "currentColor"}`;
|
|
130
162
|
}
|
|
131
|
-
function
|
|
132
|
-
let r = Math.max(0,
|
|
163
|
+
function ae(e, t, n) {
|
|
164
|
+
let r = Math.max(0, w(e, "length"));
|
|
133
165
|
return {
|
|
134
166
|
kind: "line",
|
|
135
167
|
length: r,
|
|
136
|
-
anchor:
|
|
168
|
+
anchor: E(r, n.stackAlign),
|
|
137
169
|
position: t,
|
|
138
|
-
border:
|
|
170
|
+
border: k(e)
|
|
139
171
|
};
|
|
140
172
|
}
|
|
141
|
-
function
|
|
173
|
+
function A(e, t, n, r, i) {
|
|
142
174
|
e.forEach((e, a) => {
|
|
143
|
-
let o = t + a * n +
|
|
175
|
+
let o = t + a * n + w(e, "position");
|
|
144
176
|
switch (e.localName) {
|
|
145
177
|
case "msgroup":
|
|
146
|
-
|
|
178
|
+
A([...e.children], o, w(e, "shift"), r, i);
|
|
147
179
|
break;
|
|
148
180
|
case "msline":
|
|
149
|
-
i.push(
|
|
181
|
+
i.push(ae(e, o, r));
|
|
150
182
|
break;
|
|
151
183
|
case "mscarries":
|
|
152
|
-
i.push(
|
|
184
|
+
i.push(ie(e, o, r));
|
|
153
185
|
break;
|
|
154
186
|
case "msrow":
|
|
155
187
|
case "mrow":
|
|
156
|
-
i.push(
|
|
188
|
+
i.push(D([...e.children], o, r));
|
|
157
189
|
break;
|
|
158
|
-
default: i.push(
|
|
190
|
+
default: i.push(D([e], o, r));
|
|
159
191
|
}
|
|
160
192
|
});
|
|
161
193
|
}
|
|
162
|
-
function
|
|
194
|
+
function j(e) {
|
|
163
195
|
return -e.anchor - e.position;
|
|
164
196
|
}
|
|
165
|
-
function
|
|
197
|
+
function M(e) {
|
|
166
198
|
return e.kind === "digits" ? e.cells.length : e.kind === "carries" ? e.carries.length : e.length;
|
|
167
199
|
}
|
|
168
|
-
function
|
|
169
|
-
return
|
|
200
|
+
function N(e) {
|
|
201
|
+
return j(e) + M(e) - 1;
|
|
170
202
|
}
|
|
171
|
-
function
|
|
172
|
-
let i = (e) =>
|
|
203
|
+
function oe(e, t, n, r) {
|
|
204
|
+
let i = (e) => b(r.document, "mpadded", [t], {
|
|
173
205
|
width: "0",
|
|
174
206
|
...e ? { lspace: e } : {}
|
|
175
|
-
}), a = (e, t) =>
|
|
207
|
+
}), a = (e, t) => b(r.document, e, t);
|
|
176
208
|
switch (n) {
|
|
177
209
|
case "s": return a("munder", [e, i("-0.5width")]);
|
|
178
210
|
case "ne": return a("msup", [e, i()]);
|
|
@@ -194,49 +226,49 @@ function ne(e, t, n, r) {
|
|
|
194
226
|
default: return a("mover", [e, i("-0.5width")]);
|
|
195
227
|
}
|
|
196
228
|
}
|
|
197
|
-
function
|
|
198
|
-
let r =
|
|
229
|
+
function se(e, t, n) {
|
|
230
|
+
let r = b(n.document, "menclose", [e], {
|
|
199
231
|
notation: t.join(" "),
|
|
200
232
|
"data-padding": "0.1em",
|
|
201
233
|
"data-thickness": "0.067em"
|
|
202
234
|
}), i = t.some((e) => e.endsWith("diagonalstrike")) ? .167 : t.includes("horizontalstrike") ? .1 : 0;
|
|
203
|
-
return i ?
|
|
235
|
+
return i ? b(n.document, "mpadded", [r], {
|
|
204
236
|
lspace: `-${i}em`,
|
|
205
237
|
width: `-${2 * i}em`
|
|
206
238
|
}) : r;
|
|
207
239
|
}
|
|
208
|
-
function
|
|
209
|
-
let a = e && t.crossout.length ?
|
|
240
|
+
function ce(e, t, n, r, i) {
|
|
241
|
+
let a = e && t.crossout.length ? se(e, t.crossout, i) : e;
|
|
210
242
|
if (!t.content) return a;
|
|
211
|
-
let o =
|
|
212
|
-
return
|
|
243
|
+
let o = b(i.document, "mstyle", [t.content], { scriptsizemultiplier: r });
|
|
244
|
+
return oe(a ?? S(i), o, n, i);
|
|
213
245
|
}
|
|
214
|
-
function
|
|
215
|
-
return e.carries[t -
|
|
246
|
+
function P(e, t) {
|
|
247
|
+
return e.carries[t - j(e)] ?? null;
|
|
216
248
|
}
|
|
217
|
-
function
|
|
249
|
+
function le(e, t, n, r) {
|
|
218
250
|
let i = e.content;
|
|
219
251
|
n.forEach((e, a) => {
|
|
220
|
-
let o = n.length - 1 - a, s = n[o], c =
|
|
252
|
+
let o = n.length - 1 - a, s = n[o], c = P(s, t), l = n.slice(0, o).some((e) => P(e, t));
|
|
221
253
|
if (!c && !l) return;
|
|
222
254
|
let u = c ?? {
|
|
223
|
-
content:
|
|
255
|
+
content: S(r),
|
|
224
256
|
location: "n",
|
|
225
257
|
crossout: []
|
|
226
258
|
}, d = a === 0 ? u.location : "n";
|
|
227
|
-
i =
|
|
259
|
+
i = ce(i, u, d, s.scale, r);
|
|
228
260
|
}), e.content = i;
|
|
229
261
|
}
|
|
230
|
-
function
|
|
231
|
-
let n = e.filter((e) =>
|
|
262
|
+
function F(e, t) {
|
|
263
|
+
let n = e.filter((e) => M(e) > 0), r = Math.min(0, ...n.map(j)), i = Math.max(r, ...n.map(N)) - r + 1, a = -r, o = [], s = /* @__PURE__ */ new Map(), c = () => Array.from({ length: i }, () => ({
|
|
232
264
|
content: null,
|
|
233
265
|
borders: {}
|
|
234
|
-
})), l = (e) => e.length === 0 ? Array.from({ length: i }, (e, t) => t) : Array.from({ length: e.length }, (t, n) => a +
|
|
266
|
+
})), 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) => {
|
|
235
267
|
let n = c();
|
|
236
268
|
e.cells.forEach((t, r) => {
|
|
237
|
-
n[a +
|
|
269
|
+
n[a + j(e) + r].content = t;
|
|
238
270
|
}), u.length && n.forEach((e, n) => {
|
|
239
|
-
|
|
271
|
+
le(e, n - a, u, t);
|
|
240
272
|
});
|
|
241
273
|
for (let e of d) for (let t of l(e)) n[t].borders.top = e.border;
|
|
242
274
|
u = [], d = [], s.set(e, o.length), o.push(n);
|
|
@@ -256,44 +288,44 @@ function k(e, t) {
|
|
|
256
288
|
origin: a
|
|
257
289
|
};
|
|
258
290
|
}
|
|
259
|
-
function
|
|
260
|
-
let r =
|
|
291
|
+
function I(e, { rows: t }, n) {
|
|
292
|
+
let r = b(n.document, "mtable", t.map((e) => b(n.document, "mtr", e.map((e) => {
|
|
261
293
|
let t = Object.entries(e.borders).map(([e, t]) => `border-${e}:${t}`).join(";");
|
|
262
|
-
return
|
|
294
|
+
return b(n.document, "mtd", [e.content], {
|
|
263
295
|
...t ? { style: t } : {},
|
|
264
296
|
...e.align ? { columnalign: e.align } : {}
|
|
265
297
|
});
|
|
266
298
|
}))));
|
|
267
|
-
for (let { name: t, value: n } of [...e.attributes])
|
|
268
|
-
let i =
|
|
269
|
-
return r.setAttribute("columnspacing",
|
|
299
|
+
for (let { name: t, value: n } of [...e.attributes]) y.has(t) || r.setAttribute(t, n);
|
|
300
|
+
let i = C(e, "charspacing") ?? "medium", a = C(e, "charalign");
|
|
301
|
+
return r.setAttribute("columnspacing", _[i] ?? (v.test(i) ? i : _.medium)), r.setAttribute("columnalign", a === "left" || a === "center" ? a : "right"), r.setAttribute("rowspacing", "0"), r.setAttribute("align", e.getAttribute("align") ?? "baseline"), r;
|
|
270
302
|
}
|
|
271
|
-
function
|
|
303
|
+
function L(e) {
|
|
272
304
|
return {
|
|
273
305
|
document: e.ownerDocument,
|
|
274
|
-
stackAlign:
|
|
306
|
+
stackAlign: C(e, "stackalign") ?? "decimalpoint",
|
|
275
307
|
decimalPoint: e.closest("[decimalpoint]")?.getAttribute("decimalpoint")?.trim().charAt(0) || "."
|
|
276
308
|
};
|
|
277
309
|
}
|
|
278
|
-
function
|
|
279
|
-
let t =
|
|
280
|
-
return
|
|
310
|
+
function R(e) {
|
|
311
|
+
let t = L(e), n = [];
|
|
312
|
+
return A([...e.children], 0, 0, t, n), I(e, F(n, t), t);
|
|
281
313
|
}
|
|
282
|
-
function
|
|
314
|
+
function z(e, t, n, r, i, a) {
|
|
283
315
|
for (let o = n; o <= r; o++) e[t][o].borders[i] = a;
|
|
284
316
|
}
|
|
285
|
-
function
|
|
286
|
-
let n =
|
|
287
|
-
return n.setAttribute("minsize", "1.2em"), [
|
|
317
|
+
function B(e, t) {
|
|
318
|
+
let n = x(t, ")");
|
|
319
|
+
return n.setAttribute("minsize", "1.2em"), [b(t.document, "mrow", [e, b(t.document, "mspace", [], { width: "0.2em" })]), b(t.document, "mpadded", [n], {
|
|
288
320
|
voffset: "0.1em",
|
|
289
321
|
lspace: "-0.15em",
|
|
290
322
|
depth: "-0.2em",
|
|
291
323
|
height: "-0.2em"
|
|
292
324
|
})];
|
|
293
325
|
}
|
|
294
|
-
function
|
|
295
|
-
let t =
|
|
296
|
-
|
|
326
|
+
function V(e) {
|
|
327
|
+
let t = L(e), [n, r, ...i] = [...e.children], a = n && !T(n) ? n : null, o = r && !T(r) ? r : null, s = C(e, "longdivstyle") ?? "lefttop", c = k(e), l = [];
|
|
328
|
+
A(i, 0, 0, t, l);
|
|
297
329
|
let u = l.find((e) => e.kind === "digits");
|
|
298
330
|
u || (u = {
|
|
299
331
|
kind: "digits",
|
|
@@ -305,51 +337,51 @@ function ce(e) {
|
|
|
305
337
|
u.cells.unshift(...e), u.anchor += e.length;
|
|
306
338
|
}, p = (...e) => {
|
|
307
339
|
let n = e.flatMap((e) => e ? e.localName === "mrow" ? [...e.children] : [e] : []);
|
|
308
|
-
u.cells.push(...
|
|
340
|
+
u.cells.push(...D(n, 0, t).cells);
|
|
309
341
|
};
|
|
310
342
|
switch (s) {
|
|
311
343
|
case "left/\\right":
|
|
312
|
-
f(a,
|
|
344
|
+
f(a, x(t, "/")), p(x(t, "\\"), o);
|
|
313
345
|
break;
|
|
314
346
|
case "left)(right":
|
|
315
|
-
f(a,
|
|
347
|
+
f(a, x(t, ")")), p(x(t, "("), o);
|
|
316
348
|
break;
|
|
317
349
|
case ":right=right":
|
|
318
|
-
p(
|
|
350
|
+
p(x(t, ":"), a, x(t, "="), o);
|
|
319
351
|
break;
|
|
320
352
|
case "righttop":
|
|
321
353
|
case "stackedleftlinetop":
|
|
322
354
|
case "lefttop":
|
|
323
|
-
o &&
|
|
355
|
+
o && A([o], 0, 0, t, d), l.splice(l.indexOf(u), 0, ...d), s === "righttop" ? p(a) : s === "stackedleftlinetop" ? f(a) : f(...B(a, t));
|
|
324
356
|
break;
|
|
325
357
|
}
|
|
326
|
-
let
|
|
358
|
+
let m = F(l, t), h = m.rows, g = m.rowOf.get(u) ?? 0, _ = (e) => m.origin + j(u) + e, v = Math.max(_(u.cells.length - 1), ...d.map((e) => m.origin + N(e)));
|
|
327
359
|
switch (s) {
|
|
328
360
|
case "left/\\right":
|
|
329
361
|
case "left)(right":
|
|
330
362
|
case ":right=right": break;
|
|
331
363
|
case "righttop": {
|
|
332
|
-
let e =
|
|
333
|
-
e.borders.left = c, e.borders.bottom = c,
|
|
364
|
+
let e = h[g][_(u.cells.length - 1)];
|
|
365
|
+
e.borders.left = c, e.borders.bottom = c, z(h, g, _(0), _(u.cells.length - 1), "top", c);
|
|
334
366
|
break;
|
|
335
367
|
}
|
|
336
368
|
case "stackedleftlinetop": {
|
|
337
|
-
let e =
|
|
338
|
-
e.borders.right = c, e.borders.bottom = c,
|
|
369
|
+
let e = h[g][_(0)];
|
|
370
|
+
e.borders.right = c, e.borders.bottom = c, z(h, g, _(1), v, "top", c);
|
|
339
371
|
break;
|
|
340
372
|
}
|
|
341
373
|
case "stackedrightright":
|
|
342
374
|
case "mediumstackedrightright":
|
|
343
375
|
case "shortstackedrightright":
|
|
344
376
|
case "stackedleftleft":
|
|
345
|
-
|
|
377
|
+
H(h, g, s, a, o, c, t);
|
|
346
378
|
break;
|
|
347
|
-
default:
|
|
379
|
+
default: z(h, g, _(1), v, "top", c);
|
|
348
380
|
}
|
|
349
|
-
return
|
|
381
|
+
return I(e, m, t);
|
|
350
382
|
}
|
|
351
|
-
function
|
|
352
|
-
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e &&
|
|
383
|
+
function H(e, t, n, r, i, a, o) {
|
|
384
|
+
let s = n === "stackedleftleft", c = s ? "right" : "left", l = (e) => e && b(o.document, "mpadded", [e], {
|
|
353
385
|
lspace: "0.2em",
|
|
354
386
|
width: "+0.4em"
|
|
355
387
|
});
|
|
@@ -368,112 +400,85 @@ function le(e, t, n, r, i, a, o) {
|
|
|
368
400
|
}) : 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);
|
|
369
401
|
});
|
|
370
402
|
}
|
|
371
|
-
function
|
|
372
|
-
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ?
|
|
403
|
+
function U(e) {
|
|
404
|
+
for (let t of [...e.querySelectorAll("mstack, mlongdiv")]) !t.closest("math") || t.closest("mjx-container") || t.replaceWith(t.localName === "mstack" ? R(t) : V(t));
|
|
373
405
|
}
|
|
374
|
-
var
|
|
375
|
-
function F(e, t) {
|
|
376
|
-
if (typeof window > "u") return;
|
|
377
|
-
let n = globalThis;
|
|
378
|
-
n[P] ??= {
|
|
379
|
-
logged: !1,
|
|
380
|
-
conditions: []
|
|
381
|
-
};
|
|
382
|
-
let r = n[P];
|
|
383
|
-
if (r.conditions.includes(e)) return;
|
|
384
|
-
r.conditions.push(e);
|
|
385
|
-
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 ${N}`;
|
|
386
|
-
r.logged || (r.logged = !0, console.error(i)), window.dispatchEvent(new CustomEvent(de, { detail: {
|
|
387
|
-
condition: e,
|
|
388
|
-
message: i,
|
|
389
|
-
docsUrl: N
|
|
390
|
-
} }));
|
|
391
|
-
}
|
|
392
|
-
function fe() {
|
|
393
|
-
let e = window.MathJax?.version;
|
|
394
|
-
return typeof e == "string" && e.startsWith("3.") ? e : void 0;
|
|
395
|
-
}
|
|
396
|
-
var I = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", L = {
|
|
406
|
+
var W = "https://cdn.jsdelivr.net/npm/mathjax@4.1.3/tex-mml-chtml.js", ue = {
|
|
397
407
|
parallelogram: "\\lower.2em{\\Huge\\unicode{x25B1}}",
|
|
398
408
|
overarc: "\\overparen",
|
|
399
409
|
napprox: "\\not\\approx",
|
|
400
410
|
longdiv: "\\enclose{longdiv}",
|
|
401
411
|
abs: ["\\left|#1\\right|", 1]
|
|
402
|
-
},
|
|
412
|
+
}, de = "[math-rendering] using $ is not advisable, please use $$..$$ or \\(...\\)", fe = /\\\(|\\\[|\$\$|\\\$|\\begin\{|\\(?:eq)?ref\{/, pe = /\\\(|\\\[|\$|\\begin\{|\\(?:eq)?ref\{/, me = /\\embed\{newLine\}\[\]/g, he = [
|
|
403
413
|
["$$", "$$"],
|
|
404
414
|
["$", "$"],
|
|
405
415
|
["\\[", "\\]"],
|
|
406
416
|
["\\(", "\\)"]
|
|
407
|
-
],
|
|
417
|
+
], G = Symbol.for("@pie-element/shared-math-rendering-mathjax/loading"), ge = "MJX-CHTML-styles", _e = "PIE-MJX-SVG-styles", K = "PIE-MathJax-Menu-Settings", ve = { "mjx-container[overflow=\"linebreak\"][display]": {
|
|
408
418
|
overflow: "auto clip",
|
|
409
419
|
"min-width": "initial !important"
|
|
410
|
-
} },
|
|
411
|
-
function
|
|
420
|
+
} }, ye = 200, be = 201;
|
|
421
|
+
function q(e) {
|
|
412
422
|
let t = [...e.matches("mjx-container") ? [e] : [], ...e.querySelectorAll("mjx-container")];
|
|
413
423
|
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");
|
|
414
424
|
}
|
|
415
|
-
function
|
|
416
|
-
return
|
|
417
|
-
}
|
|
418
|
-
function be(e) {
|
|
419
|
-
for (let [t, n] of pe) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
425
|
+
function xe(e) {
|
|
426
|
+
for (let [t, n] of he) if (e.startsWith(t) && e.endsWith(n)) return e.substring(t.length, e.length - n.length);
|
|
420
427
|
return e;
|
|
421
428
|
}
|
|
422
|
-
function
|
|
423
|
-
return
|
|
429
|
+
function Se(e) {
|
|
430
|
+
return xe(e.includes("\\displaystyle") ? e.replace("\\displaystyle", "").trim() : e);
|
|
424
431
|
}
|
|
425
|
-
var
|
|
426
|
-
function
|
|
427
|
-
let n = e.closest(`.${
|
|
432
|
+
var Ce = "mathjax_ignore", J = "mathjax_process";
|
|
433
|
+
function we(e, t) {
|
|
434
|
+
let n = e.closest(`.${Ce}, .${J}`);
|
|
428
435
|
return n !== null && t.contains(n) && !n.classList.contains(J);
|
|
429
436
|
}
|
|
430
|
-
function
|
|
437
|
+
function Te(e) {
|
|
431
438
|
for (let t of e.querySelectorAll("[data-latex]")) {
|
|
432
|
-
if (t.dataset.mathHandled || t.closest("mjx-container") ||
|
|
439
|
+
if (t.dataset.mathHandled || t.closest("mjx-container") || we(t, e)) continue;
|
|
433
440
|
let n = t.textContent;
|
|
434
|
-
n && (t.textContent = `\\(${
|
|
441
|
+
n && (t.textContent = `\\(${Se(n)}\\)`.replace(me, "\\newline "), t.dataset.mathHandled = "true");
|
|
435
442
|
}
|
|
436
443
|
}
|
|
437
|
-
function
|
|
444
|
+
function Ee(e) {
|
|
438
445
|
for (let t of e.querySelectorAll("math")) t.closest("mjx-container") || t.setAttribute("displaystyle", "true");
|
|
439
446
|
}
|
|
440
|
-
function
|
|
447
|
+
function De(e, t) {
|
|
441
448
|
for (let t of e.querySelectorAll("math")) if (!t.closest("mjx-assistive-mml")) return !0;
|
|
442
|
-
return (t ?
|
|
449
|
+
return (t ? pe : fe).test(e.textContent ?? "");
|
|
443
450
|
}
|
|
444
|
-
function
|
|
451
|
+
function Oe(e) {
|
|
445
452
|
return new Promise((t, n) => {
|
|
446
|
-
let { useSingleDollar: r = !1, accessibility:
|
|
453
|
+
let { useSingleDollar: r = !1, accessibility: o = !0, loadFonts: s = !0, srcUrl: c } = e, l = {
|
|
447
454
|
loader: {
|
|
448
|
-
load:
|
|
455
|
+
load: o ? ["a11y/assistive-mml"] : [],
|
|
449
456
|
failed: (e) => n(e),
|
|
450
457
|
"output/svg": { ready: (e) => {
|
|
451
|
-
let t =
|
|
458
|
+
let t = i();
|
|
452
459
|
return Y(t) && X(t), e;
|
|
453
460
|
} }
|
|
454
461
|
},
|
|
455
462
|
startup: {
|
|
456
463
|
typeset: !1,
|
|
457
464
|
ready: () => {
|
|
458
|
-
let e =
|
|
459
|
-
|
|
465
|
+
let e = i(), r = e?.startup, a = Y(e);
|
|
466
|
+
a && (X(e), ke(e)), r?.defaultReady?.(), a && (Z(r?.document), r?.document?.addStyles?.(ve)), Promise.resolve(r?.promise).then(() => t(), n);
|
|
460
467
|
}
|
|
461
468
|
},
|
|
462
|
-
tex: { macros: { ...
|
|
469
|
+
tex: { macros: { ...ue } },
|
|
463
470
|
output: { displayOverflow: "linebreak" },
|
|
464
471
|
options: {
|
|
465
|
-
enableMenu:
|
|
472
|
+
enableMenu: o,
|
|
466
473
|
menuOptions: { settings: {
|
|
467
|
-
assistiveMml:
|
|
474
|
+
assistiveMml: o,
|
|
468
475
|
enrich: !1,
|
|
469
476
|
inTabOrder: !1
|
|
470
477
|
} },
|
|
471
478
|
a11y: { inTabOrder: !1 }
|
|
472
479
|
}
|
|
473
480
|
};
|
|
474
|
-
r &&
|
|
475
|
-
let c = document.createElement("script");
|
|
476
|
-
c.src = o || I, c.async = !0, c.onerror = () => n(/* @__PURE__ */ Error("Failed to load MathJax")), document.head.appendChild(c);
|
|
481
|
+
r && l.tex && (console.warn(de), l.tex.inlineMath = [["$", "$"], ["\\(", "\\)"]], l.tex.processEscapes = !0), s || (l.chtml = { fontURL: "" }), a(l, c || W).catch(n);
|
|
477
482
|
});
|
|
478
483
|
}
|
|
479
484
|
function Y(e) {
|
|
@@ -481,46 +486,46 @@ function Y(e) {
|
|
|
481
486
|
}
|
|
482
487
|
function X(e) {
|
|
483
488
|
let t = e?._?.output, n = t?.chtml_ts?.CHTML;
|
|
484
|
-
n && (n.STYLESHEETID =
|
|
489
|
+
n && (n.STYLESHEETID = s);
|
|
485
490
|
let r = t?.svg_ts?.SVG;
|
|
486
|
-
r && (r.STYLESHEETID =
|
|
491
|
+
r && (r.STYLESHEETID = _e);
|
|
487
492
|
}
|
|
488
|
-
function
|
|
493
|
+
function ke(e) {
|
|
489
494
|
let t = e?._?.ui?.menu?.Menu?.Menu;
|
|
490
495
|
if (t) {
|
|
491
|
-
t.MENU_STORAGE =
|
|
496
|
+
t.MENU_STORAGE = K;
|
|
492
497
|
try {
|
|
493
|
-
let e = localStorage.getItem(
|
|
498
|
+
let e = localStorage.getItem(K);
|
|
494
499
|
if (!e) return;
|
|
495
500
|
let { assistiveMml: t, ...n } = JSON.parse(e);
|
|
496
501
|
if (t === void 0) return;
|
|
497
|
-
Object.keys(n).length ? localStorage.setItem(
|
|
502
|
+
Object.keys(n).length ? localStorage.setItem(K, JSON.stringify(n)) : localStorage.removeItem(K);
|
|
498
503
|
} catch {}
|
|
499
504
|
}
|
|
500
505
|
}
|
|
501
|
-
function
|
|
506
|
+
function Z(e) {
|
|
502
507
|
if (!e) return;
|
|
503
508
|
let t = /* @__PURE__ */ new WeakSet(), n = (e) => {
|
|
504
509
|
let n = e.typesetRoot;
|
|
505
|
-
!n || t.has(n) || (
|
|
510
|
+
!n || t.has(n) || (q(n), t.add(n));
|
|
506
511
|
};
|
|
507
|
-
e.addRenderAction?.("pie-strip-latex",
|
|
512
|
+
e.addRenderAction?.("pie-strip-latex", be, (e) => {
|
|
508
513
|
for (let t of e.math ?? []) n(t);
|
|
509
514
|
return !1;
|
|
510
515
|
}, (e) => {
|
|
511
516
|
let t = e.typesetRoot;
|
|
512
|
-
return t &&
|
|
517
|
+
return t && q(t), !1;
|
|
513
518
|
});
|
|
514
519
|
let r = e.outputJax?.chtmlStyles;
|
|
515
|
-
r?.id ===
|
|
520
|
+
r?.id === ge && (r.id = s), Ae();
|
|
516
521
|
}
|
|
517
522
|
function Q(e) {
|
|
518
|
-
return e instanceof HTMLStyleElement &&
|
|
523
|
+
return e instanceof HTMLStyleElement && c.includes(e.id);
|
|
519
524
|
}
|
|
520
525
|
function $(e) {
|
|
521
|
-
|
|
526
|
+
n("foreign-output-stylesheet", `another MathJax added <style id="${e.id}"> to <head>`);
|
|
522
527
|
}
|
|
523
|
-
function
|
|
528
|
+
function Ae() {
|
|
524
529
|
let e = document.head, t = [...e.children].find(Q);
|
|
525
530
|
if (t) {
|
|
526
531
|
$(t);
|
|
@@ -537,62 +542,62 @@ function ke() {
|
|
|
537
542
|
});
|
|
538
543
|
n.observe(e, { childList: !0 });
|
|
539
544
|
}
|
|
540
|
-
function
|
|
545
|
+
function je(e) {
|
|
541
546
|
let t = e?.math;
|
|
542
547
|
if (!t?.remove) return;
|
|
543
|
-
let n = [...t].filter((e) => (e.state?.() ?? 0) >=
|
|
548
|
+
let n = [...t].filter((e) => (e.state?.() ?? 0) >= ye && e.typesetRoot?.isConnected === !1);
|
|
544
549
|
if (n.length !== 0) {
|
|
545
550
|
for (let e of [...n].reverse()) e.clear?.();
|
|
546
551
|
t.remove(...n);
|
|
547
552
|
}
|
|
548
553
|
}
|
|
549
|
-
function
|
|
554
|
+
function Me(e) {
|
|
550
555
|
return new Promise((t, n) => {
|
|
551
556
|
let r = e.startup ?? {};
|
|
552
557
|
e.startup = r;
|
|
553
|
-
let
|
|
558
|
+
let a = r.ready;
|
|
554
559
|
r.ready = () => {
|
|
555
|
-
let e =
|
|
556
|
-
|
|
560
|
+
let e = i()?.startup;
|
|
561
|
+
a ? a.call(r) : e?.defaultReady?.(), Promise.resolve(e?.promise).then(() => t(), n);
|
|
557
562
|
};
|
|
558
563
|
});
|
|
559
564
|
}
|
|
560
|
-
function Me(e) {
|
|
561
|
-
let t = q();
|
|
562
|
-
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : je(t) : De(e);
|
|
563
|
-
}
|
|
564
565
|
function Ne(e) {
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
});
|
|
566
|
+
let t = i();
|
|
567
|
+
return t ? t.version ? t.startup?.promise ? Promise.resolve(t.startup.promise).then(() => void 0) : Promise.resolve() : Me(t) : Oe(e);
|
|
568
568
|
}
|
|
569
569
|
function Pe(e) {
|
|
570
|
-
|
|
571
|
-
|
|
570
|
+
return Ne(e).then(() => {
|
|
571
|
+
typeof i()?.typesetPromise != "function" && console.warn("[mathjax-renderer] MathJax on this page has no typesetPromise; math stays untypeset.");
|
|
572
|
+
});
|
|
573
|
+
}
|
|
574
|
+
function Fe(e) {
|
|
575
|
+
let t = o, n = t[G];
|
|
576
|
+
return n || (n = Pe(e), t[G] = n), n;
|
|
572
577
|
}
|
|
573
|
-
function
|
|
578
|
+
function Ie(e = {}) {
|
|
574
579
|
let t = e.useSingleDollar ?? !1;
|
|
575
|
-
return async (
|
|
580
|
+
return async (r) => {
|
|
576
581
|
if (typeof window > "u") return;
|
|
577
|
-
let
|
|
578
|
-
|
|
579
|
-
let
|
|
580
|
-
if (!
|
|
581
|
-
|
|
582
|
+
let a = l();
|
|
583
|
+
a && n("mathjax-3-global", `window.MathJax is MathJax ${a}`), Te(r), p(r), Ee(r), U(r);
|
|
584
|
+
let o = Fe(e);
|
|
585
|
+
if (!De(r, t)) {
|
|
586
|
+
o.catch(() => {});
|
|
582
587
|
return;
|
|
583
588
|
}
|
|
584
|
-
await
|
|
585
|
-
let
|
|
586
|
-
if (await
|
|
587
|
-
|
|
589
|
+
await o;
|
|
590
|
+
let s = i();
|
|
591
|
+
if (await s?.startup?.promise, typeof s?.typesetPromise == "function") {
|
|
592
|
+
je(s.startup?.document);
|
|
588
593
|
try {
|
|
589
|
-
await
|
|
594
|
+
await s.typesetPromise([r]);
|
|
590
595
|
} catch (e) {
|
|
591
|
-
throw
|
|
596
|
+
throw s.typesetClear?.([r]), e;
|
|
592
597
|
}
|
|
593
|
-
|
|
598
|
+
q(r);
|
|
594
599
|
}
|
|
595
600
|
};
|
|
596
601
|
}
|
|
597
602
|
//#endregion
|
|
598
|
-
export {
|
|
603
|
+
export { Ie as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "./math-mathjax-
|
|
1
|
+
import { t as e } from "./math-mathjax-XOw_ragY.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
|
|
@@ -3035,10 +3035,7 @@ customElements.define("pie-element-player", Or(ki, {
|
|
|
3035
3035
|
reflect: !0,
|
|
3036
3036
|
type: "String"
|
|
3037
3037
|
},
|
|
3038
|
-
role: {
|
|
3039
|
-
reflect: !0,
|
|
3040
|
-
type: "String"
|
|
3041
|
-
},
|
|
3038
|
+
role: { type: "String" },
|
|
3042
3039
|
cdnUrl: {
|
|
3043
3040
|
attribute: "cdn-url",
|
|
3044
3041
|
reflect: !0,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-element/element-player",
|
|
3
|
-
"version": "0.1.3-next.
|
|
3
|
+
"version": "0.1.3-next.20261004003105",
|
|
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.2-next.
|
|
29
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.2-next.20261003161149"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"publishConfig": {
|