@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, l as t, n, o as r, r as i } from "./speech-worker-CP5P4gRS.js";
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 i = n(e);
36999
- V_ = !!i;
36998
+ let r = t(e);
36999
+ V_ = !!r;
37000
37000
  let a = se.addFontURLs.bind(se);
37001
- se.addFontURLs = (t, n, i) => {
37002
- if (!W_.includes(i)) return a(t, n, i);
37003
- for (let [a, o] of Object.entries(n)) {
37004
- let n = !0, s = String(o.src).replace(G_, (t, a) => {
37005
- let o = r(e, `${i}/${a}`);
37006
- return o || (n = !1), 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
- n && (t[a] = {
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}/`))) || t(V_ ? "no-web-fonts" : "no-web-fonts-or-speech"), i;
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 r = K_(t), a = e.loader?.load?.includes("a11y/assistive-mml") ?? !1;
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
- r && (u.createWorker = async (e) => i(r, e));
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
- r || (f.enableEnrichment = !1);
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(e) {
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 l(e) {
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 = c(r);
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 u(e) {
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 d(e, t) {
48
- let n = s(), r = c(e.assetRoot ?? n.assetRoot) ?? o(t);
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: c(e.speechPath ?? n.speechPath) ?? (r ? `${r}/${i}` : void 0),
52
- speechLocales: u(e.speechLocales ?? n.speechLocales),
53
- urls: l(e.assetUrls ?? n.assetUrls)
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 f({ root: e, urls: t }, n) {
59
+ function p({ root: e, urls: t }, n) {
57
60
  return t?.get(n) ?? (e ? `${e}/${n}` : void 0);
58
61
  }
59
- function p({ speechPath: e, urls: t }, n) {
62
+ function m({ speechPath: e, urls: t }, n) {
60
63
  return t?.get(`${i}/${n}`) ?? (e ? `${e}/${n}` : void 0);
61
64
  }
62
- function m(e, t) {
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 h(e) {
71
+ function g(e) {
69
72
  if (!(!e || e.has("en"))) return [...e.keys()].find((e) => !r.includes(e));
70
73
  }
71
- var g = "pie-mathjax-no-asset-root", _ = {
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
- }, v = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
76
- function y(e) {
78
+ }, y = Symbol.for("@pie-element/shared-math-rendering-mathjax/no-assets");
79
+ function b(e) {
77
80
  let r = globalThis;
78
- r[v] ??= [];
79
- let i = r[v];
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: ${_[e]}. Set window['${n}'].opts.assetRoot to an npm root. See ${t}`;
83
- e === "untypeset" ? console.error(a) : console.warn(a), !(typeof window > "u") && window.dispatchEvent(new CustomEvent(g, { detail: {
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 b = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
92
- function x() {
94
+ var x = Symbol.for("@pie-element/shared-math-rendering-mathjax/speech-worker-failed");
95
+ function S() {
93
96
  let e = globalThis;
94
- e[b] || (e[b] = !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}`));
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 S(e) {
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(), x();
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 C(e) {
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", () => S(e), { once: !0 }), a;
110
+ return a.addEventListener("error", () => C(e), { once: !0 }), a;
108
111
  });
109
112
  }
110
- var w = `${i}/mathmaps/`;
111
- function T(e) {
112
- let t = p(e, "speech-worker.js");
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(w) && (r[`${n}/${t.slice(w.length)}`] = i);
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 E(e, t) {
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 { g as a, m as c, e as i, y as l, T as n, f as o, E as r, h as s, C as t, d as u };
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 };