@pie-element/shared-math-rendering-mathjax 0.1.5-next.20261008072957 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as e,
|
|
1
|
+
import { i as e, n as t, o as n, r, u as i } from "./speech-worker-CTpOB9m5.js";
|
|
2
2
|
import { A as a, C as o, D as s, E as c, O as l, S as u, T as d, _ as f, a as p, b as m, c as h, d as g, f as ee, h as te, i as _, j as ne, k as v, l as re, m as y, n as b, o as ie, p as ae, r as x, s as oe, t as se, u as ce, v as le, w as ue, x as de, y as fe } from "./chtml-CbqemTOM.js";
|
|
3
3
|
//#region \0rolldown/runtime.js
|
|
4
4
|
var pe = Object.create, me = Object.defineProperty, he = Object.getOwnPropertyDescriptor, ge = Object.getOwnPropertyNames, _e = Object.getPrototypeOf, ve = Object.prototype.hasOwnProperty, S = (e, t, n) => () => {
|
|
@@ -36995,24 +36995,24 @@ function U_(t) {
|
|
|
36995
36995
|
}
|
|
36996
36996
|
var W_ = ["mathjax-newcm-font", "mathjax-mhchem-font-extension"].map(U_), G_ = /%%URL%%\/([^"')]+)/g;
|
|
36997
36997
|
function K_(e) {
|
|
36998
|
-
let
|
|
36999
|
-
V_ = !!
|
|
36998
|
+
let r = t(e);
|
|
36999
|
+
V_ = !!r;
|
|
37000
37000
|
let a = se.addFontURLs.bind(se);
|
|
37001
|
-
se.addFontURLs = (t,
|
|
37002
|
-
if (!W_.includes(i)) return a(t,
|
|
37003
|
-
for (let [a, o] of Object.entries(
|
|
37004
|
-
let
|
|
37005
|
-
let o =
|
|
37006
|
-
return o || (
|
|
37001
|
+
se.addFontURLs = (t, r, i) => {
|
|
37002
|
+
if (!W_.includes(i)) return a(t, r, i);
|
|
37003
|
+
for (let [a, o] of Object.entries(r)) {
|
|
37004
|
+
let r = !0, s = String(o.src).replace(G_, (t, a) => {
|
|
37005
|
+
let o = n(e, `${i}/${a}`);
|
|
37006
|
+
return o || (r = !1), o ?? "";
|
|
37007
37007
|
});
|
|
37008
|
-
|
|
37008
|
+
r && (t[a] = {
|
|
37009
37009
|
...o,
|
|
37010
37010
|
src: s
|
|
37011
37011
|
});
|
|
37012
37012
|
}
|
|
37013
37013
|
};
|
|
37014
37014
|
let o = [...e.urls?.keys() ?? []];
|
|
37015
|
-
return e.root || o.some((e) => W_.some((t) => e.startsWith(`${t}/`))) ||
|
|
37015
|
+
return e.root || o.some((e) => W_.some((t) => e.startsWith(`${t}/`))) || i(V_ ? "no-web-fonts" : "no-web-fonts-or-speech"), r;
|
|
37016
37016
|
}
|
|
37017
37017
|
function q_() {
|
|
37018
37018
|
return new Promise((e) => {
|
|
@@ -37029,7 +37029,7 @@ function J_(e) {
|
|
|
37029
37029
|
function Y_(e, t, n) {
|
|
37030
37030
|
if (Sm.startup) throw Error("[math-rendering] The bundled MathJax starts once");
|
|
37031
37031
|
R_(e), ue.asyncLoad = B_, J_(n);
|
|
37032
|
-
let
|
|
37032
|
+
let i = K_(t), a = e.loader?.load?.includes("a11y/assistive-mml") ?? !1;
|
|
37033
37033
|
Sm.config = e, Sm._ = {
|
|
37034
37034
|
a11y: {
|
|
37035
37035
|
explorer: { Region: Dc },
|
|
@@ -37058,11 +37058,11 @@ function Y_(e, t, n) {
|
|
|
37058
37058
|
fontData: se,
|
|
37059
37059
|
fontURL: U_("mathjax-newcm-font")
|
|
37060
37060
|
})), u = El();
|
|
37061
|
-
|
|
37061
|
+
i && (u.createWorker = async (e) => r(i, e));
|
|
37062
37062
|
let d = new Zl(u, 5);
|
|
37063
37063
|
d = ac(d, new cu({ allowHtmlInTokenNodes: !0 })), d = Ec(d, null), d = yl(d), a && (d = Xt(d)), d = Jh(d), ue.handlers.register(d);
|
|
37064
37064
|
let f = { ...e.options };
|
|
37065
|
-
|
|
37065
|
+
i || (f.enableEnrichment = !1);
|
|
37066
37066
|
let p = ue.document(document, {
|
|
37067
37067
|
...f,
|
|
37068
37068
|
MenuClass: H_,
|
|
@@ -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,56 +34,56 @@ 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({ root: e, urls: t }, n) {
|
|
57
60
|
return t?.get(n) ?? (e ? `${e}/${n}` : void 0);
|
|
58
61
|
}
|
|
59
|
-
function
|
|
62
|
+
function m({ speechPath: e, urls: t }, n) {
|
|
60
63
|
return t?.get(`${i}/${n}`) ?? (e ? `${e}/${n}` : void 0);
|
|
61
64
|
}
|
|
62
|
-
function
|
|
65
|
+
function h(e, t) {
|
|
63
66
|
if (!(!e || !t)) {
|
|
64
67
|
for (let n of [...e.keys()]) !t.has(n) && !r.includes(n) && e.delete(n);
|
|
65
68
|
for (let [n, r] of t) (r || !e.has(n)) && e.set(n, r ?? n);
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
|
-
function
|
|
71
|
+
function g(e) {
|
|
69
72
|
if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !r.includes(e));
|
|
70
73
|
}
|
|
71
|
-
var
|
|
74
|
+
var _ = "pie-mathjax-no-asset-root", v = {
|
|
72
75
|
untypeset: "no MathJax loads, so math stays untypeset",
|
|
73
76
|
"no-web-fonts": "math renders without web fonts",
|
|
74
77
|
"no-web-fonts-or-speech": "math renders without web fonts and speech"
|
|
75
|
-
},
|
|
76
|
-
function
|
|
78
|
+
}, y = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
|
|
79
|
+
function b(e) {
|
|
77
80
|
let r = globalThis;
|
|
78
|
-
r[
|
|
79
|
-
let i = r[
|
|
81
|
+
r[y] ??= [];
|
|
82
|
+
let i = r[y];
|
|
80
83
|
if (i.includes(e)) return;
|
|
81
84
|
i.push(e);
|
|
82
|
-
let a = `[math-rendering] No asset root for MathJax: ${
|
|
83
|
-
e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent(
|
|
85
|
+
let a = `[math-rendering] No asset root for MathJax: ${v[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;
|
|
86
|
+
e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent(_, { detail: {
|
|
84
87
|
effect: e,
|
|
85
88
|
message: a,
|
|
86
89
|
docsUrl: t
|
|
@@ -88,35 +91,35 @@ function y(e) {
|
|
|
88
91
|
}
|
|
89
92
|
//#endregion
|
|
90
93
|
//#region src/speech-worker.ts
|
|
91
|
-
var
|
|
92
|
-
function
|
|
94
|
+
var x = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
|
|
95
|
+
function S() {
|
|
93
96
|
let e = globalThis;
|
|
94
|
-
e[
|
|
97
|
+
e[x] || (e[x] = !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}`));
|
|
95
98
|
}
|
|
96
|
-
function
|
|
99
|
+
function C(e) {
|
|
97
100
|
let t = e.webworker;
|
|
98
101
|
if (!t || t.ready) return;
|
|
99
102
|
e.options ??= {};
|
|
100
103
|
let n = e.options;
|
|
101
|
-
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(),
|
|
104
|
+
n.enableSpeech = !1, n.enableBraille = !1, n.speechError = () => {}, t.Post = () => Promise.reject(/* @__PURE__ */ Error("The speech worker did not start")), t.Terminate(), S();
|
|
102
105
|
}
|
|
103
|
-
function
|
|
106
|
+
function w(e) {
|
|
104
107
|
let t = e?.adaptor, n = t?.createWorker;
|
|
105
108
|
!e || !t || !n || (t.createWorker = async (r, i) => {
|
|
106
109
|
let a = await n.call(t, r, i);
|
|
107
|
-
return a.addEventListener("error", () =>
|
|
110
|
+
return a.addEventListener("error", () => C(e), { once: !0 }), a;
|
|
108
111
|
});
|
|
109
112
|
}
|
|
110
|
-
var
|
|
111
|
-
function
|
|
112
|
-
let t =
|
|
113
|
+
var T = `${i}/mathmaps/`;
|
|
114
|
+
function E(e) {
|
|
115
|
+
let t = m(e, "speech-worker.js");
|
|
113
116
|
if (!t) return;
|
|
114
117
|
let n = e.speechPath ? `${e.speechPath}/mathmaps` : "mathmaps", r = {};
|
|
115
|
-
for (let [t, i] of e.urls ?? []) t.startsWith(
|
|
118
|
+
for (let [t, i] of e.urls ?? []) t.startsWith(T) && (r[`${n}/${t.slice(T.length)}`] = i);
|
|
116
119
|
let i = [`self.maps = ${JSON.stringify(n)};`];
|
|
117
120
|
return Object.keys(r).length && i.push("{", ` const urls = new Map(Object.entries(${JSON.stringify(r)}));`, " const fetchFile = self.fetch.bind(self);", " self.fetch = (input, init) => fetchFile(urls.get(input) ?? input, init);", "}"), i.push(`importScripts(${JSON.stringify(t)});`), i.join("\n");
|
|
118
121
|
}
|
|
119
|
-
function
|
|
122
|
+
function D(e, t) {
|
|
120
123
|
let n = URL.createObjectURL(new Blob([e], { type: "text/javascript" }));
|
|
121
124
|
try {
|
|
122
125
|
let e = new Worker(n);
|
|
@@ -126,4 +129,4 @@ function E(e, t) {
|
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
//#endregion
|
|
129
|
-
export {
|
|
132
|
+
export { _ as a, h as c, f as d, e as i, c as l, E as n, p as o, D as r, g as s, w as t, b as u };
|