@pie-qti/player-elements 0.1.18 → 0.1.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +122 -127
- package/dist/{define-CLdVOnMl.js → define-BwFVHv-A.js} +4160 -3090
- package/dist/define-BwFVHv-A.js.map +1 -0
- package/dist/dist-DswyTalX.js +6731 -0
- package/dist/dist-DswyTalX.js.map +1 -0
- package/dist/{dist-CHcxiby5.js → dist-oe9UH-A2.js} +628 -583
- package/dist/dist-oe9UH-A2.js.map +1 -0
- package/dist/{element-Bekvepqe.js → element-BiInkn5Q.js} +2 -2
- package/dist/{element-Bekvepqe.js.map → element-BiInkn5Q.js.map} +1 -1
- package/dist/{element-class-C8OTgYHE-DsvwOAOP.js → element-class-CILJ4Ls7-rJWb-Gwb.js} +12421 -11624
- package/dist/element-class-CILJ4Ls7-rJWb-Gwb.js.map +1 -0
- package/dist/elements.js +3 -3
- package/dist/index.js +3 -3
- package/dist/item-toolbar-element-t_zI1vE6.js +1892 -0
- package/dist/item-toolbar-element-t_zI1vE6.js.map +1 -0
- package/dist/{mathlive.min-DeR46YTX-DamfKay_.js → mathlive.min-DeR46YTX-D-KAmiue.js} +1 -1
- package/dist/{mathlive.min-DeR46YTX-DamfKay_.js.map → mathlive.min-DeR46YTX-D-KAmiue.js.map} +1 -1
- package/dist/pie-assessment-toolkit-element-RzBk8WVs.js +7113 -0
- package/dist/pie-assessment-toolkit-element-RzBk8WVs.js.map +1 -0
- package/dist/pie-tool-calculator-GW-LhvB_.js +6905 -0
- package/dist/pie-tool-calculator-GW-LhvB_.js.map +1 -0
- package/dist/public/api.d.ts +25 -11
- package/dist/public/elements.d.ts +1 -1
- package/dist/public/index.d.ts +1 -1
- package/dist/register-players.js +1 -1
- package/dist/register.js +50707 -49652
- package/dist/register.js.map +1 -1
- package/dist/resolveItems-DHNyVysE.js +7627 -0
- package/dist/resolveItems-DHNyVysE.js.map +1 -0
- package/dist/{root--0fyaoNu.js → root-CYGgRw16.js} +3 -3
- package/dist/root-CYGgRw16.js.map +1 -0
- package/dist/sre-CgK32OcY.js +17228 -0
- package/dist/sre-CgK32OcY.js.map +1 -0
- package/dist/{tag-names-ClLtKtXt.js → tag-names-OgMDHLpx.js} +2 -2
- package/dist/tag-names-OgMDHLpx.js.map +1 -0
- package/dist/tool-tts-inline-drDEIti_.js +3724 -0
- package/dist/tool-tts-inline-drDEIti_.js.map +1 -0
- package/package.json +11 -9
- package/dist/define-CLdVOnMl.js.map +0 -1
- package/dist/dist-CHcxiby5.js.map +0 -1
- package/dist/dist-DjmdIRjq.js +0 -1241
- package/dist/dist-DjmdIRjq.js.map +0 -1
- package/dist/element-class-C8OTgYHE-DsvwOAOP.js.map +0 -1
- package/dist/item-toolbar-element-CjJkgFQ3.js +0 -6086
- package/dist/item-toolbar-element-CjJkgFQ3.js.map +0 -1
- package/dist/pie-assessment-toolkit-element-DMRNOwrK.js +0 -28516
- package/dist/pie-assessment-toolkit-element-DMRNOwrK.js.map +0 -1
- package/dist/pie-tool-calculator-DBfkllu3.js +0 -2309
- package/dist/pie-tool-calculator-DBfkllu3.js.map +0 -1
- package/dist/resolveItems-Bp65Mj_Z.js +0 -7030
- package/dist/resolveItems-Bp65Mj_Z.js.map +0 -1
- package/dist/root--0fyaoNu.js.map +0 -1
- package/dist/tag-names-ClLtKtXt.js.map +0 -1
- package/dist/tool-tts-inline-BNjR51Di.js +0 -2641
- package/dist/tool-tts-inline-BNjR51Di.js.map +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { o as e } from "./chunk-foFoljWS.js";
|
|
2
|
-
import { n as t, r as n, t as r } from "./tag-names-
|
|
3
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
2
|
+
import { n as t, r as n, t as r } from "./tag-names-OgMDHLpx.js";
|
|
3
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/context/assessment-toolkit-context.js
|
|
4
4
|
var i = t(Symbol.for("pie.assessmentToolkit.runtimeContext"));
|
|
5
5
|
t(Symbol.for("pie.assessmentToolkit.hostRuntimeContext"));
|
|
6
6
|
var a = t(Symbol.for("pie.assessmentToolkit.shellContext")), o = t(Symbol.for("pie.assessmentToolkit.regionScopeContext"));
|
|
7
7
|
//#endregion
|
|
8
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
8
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/context/runtime-context-consumer.js
|
|
9
9
|
function s(e, t, r) {
|
|
10
10
|
let i = !1, a = new n(e, {
|
|
11
11
|
context: t,
|
|
@@ -40,7 +40,7 @@ function u(e, t) {
|
|
|
40
40
|
return s(e, o, t);
|
|
41
41
|
}
|
|
42
42
|
//#endregion
|
|
43
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
43
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/runtime/tool-host-contract.js
|
|
44
44
|
function d(e, t) {
|
|
45
45
|
return c(e, t);
|
|
46
46
|
}
|
|
@@ -51,7 +51,7 @@ function p(e, t) {
|
|
|
51
51
|
return u(e, t);
|
|
52
52
|
}
|
|
53
53
|
//#endregion
|
|
54
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
54
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/SSMLExtractor.js
|
|
55
55
|
var m = new Set([
|
|
56
56
|
"speak",
|
|
57
57
|
"break",
|
|
@@ -76,7 +76,7 @@ var m = new Set([
|
|
|
76
76
|
"foreignobject",
|
|
77
77
|
"noscript",
|
|
78
78
|
"template"
|
|
79
|
-
]),
|
|
79
|
+
]), g = new Set([
|
|
80
80
|
"alphabet",
|
|
81
81
|
"ph",
|
|
82
82
|
"time",
|
|
@@ -93,20 +93,20 @@ var m = new Set([
|
|
|
93
93
|
"lang",
|
|
94
94
|
"gender",
|
|
95
95
|
"src"
|
|
96
|
-
]),
|
|
96
|
+
]), ee = new Set([
|
|
97
97
|
"break",
|
|
98
98
|
"mark",
|
|
99
99
|
"lexicon"
|
|
100
100
|
]);
|
|
101
|
-
function
|
|
101
|
+
function te(e) {
|
|
102
102
|
let t = e;
|
|
103
|
-
for (let e of
|
|
103
|
+
for (let e of ee) {
|
|
104
104
|
let n = RegExp(`<${e}\\b([^>/]*?)\\s*/>`, "gi");
|
|
105
105
|
t = t.replace(n, (t, n) => `<${e}${n ? n.replace(/\s+$/, "") : ""}></${e}>`);
|
|
106
106
|
}
|
|
107
107
|
return t;
|
|
108
108
|
}
|
|
109
|
-
var
|
|
109
|
+
var _ = [
|
|
110
110
|
/^localhost$/i,
|
|
111
111
|
/^127(?:\.\d{1,3}){3}$/,
|
|
112
112
|
/^0(?:\.\d{1,3}){3}$/,
|
|
@@ -122,7 +122,7 @@ var g = [
|
|
|
122
122
|
/^metadata\.azure\.internal$/i,
|
|
123
123
|
/^metadata\.packet\.net$/i
|
|
124
124
|
];
|
|
125
|
-
function
|
|
125
|
+
function ne(e) {
|
|
126
126
|
if (typeof e != "string" || e.length === 0) return !1;
|
|
127
127
|
let t;
|
|
128
128
|
try {
|
|
@@ -132,9 +132,9 @@ function re(e) {
|
|
|
132
132
|
}
|
|
133
133
|
if (t.protocol !== "http:" && t.protocol !== "https:") return !1;
|
|
134
134
|
let n = t.hostname.replace(/^\[|\]$/g, "").replace(/\.$/, "");
|
|
135
|
-
return !
|
|
135
|
+
return !_.some((e) => e.test(n));
|
|
136
136
|
}
|
|
137
|
-
function
|
|
137
|
+
function re(e) {
|
|
138
138
|
let t = Array.from(e.children);
|
|
139
139
|
for (let n of t) {
|
|
140
140
|
let t = n.tagName.toLowerCase();
|
|
@@ -142,54 +142,54 @@ function ie(e) {
|
|
|
142
142
|
n.remove();
|
|
143
143
|
continue;
|
|
144
144
|
}
|
|
145
|
-
if (
|
|
145
|
+
if (re(n), !m.has(t)) {
|
|
146
146
|
let t = e.ownerDocument.createTextNode(n.textContent ?? "");
|
|
147
147
|
n.replaceWith(t);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
let n = Array.from(e.attributes).map((e) => e.name);
|
|
151
|
-
for (let t of n)
|
|
151
|
+
for (let t of n) g.has(t.toLowerCase()) || e.removeAttribute(t);
|
|
152
152
|
if (e.tagName.toLowerCase() === "audio") {
|
|
153
153
|
let t = e.getAttribute("src");
|
|
154
|
-
t !== null && !
|
|
154
|
+
t !== null && !ne(t) && e.removeAttribute("src");
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
let t = e.tagName.toLowerCase(), n = Array.from(e.attributes).filter((e) =>
|
|
159
|
-
if (
|
|
157
|
+
function ie(e) {
|
|
158
|
+
let t = e.tagName.toLowerCase(), n = Array.from(e.attributes).filter((e) => g.has(e.name.toLowerCase())).map((e) => ` ${e.name}="${se(e.value)}"`).join("");
|
|
159
|
+
if (ee.has(t)) return `<${t}${n}/>`;
|
|
160
160
|
let r = [];
|
|
161
|
-
for (let t of Array.from(e.childNodes)) if (t.nodeType === 3) r.push(
|
|
161
|
+
for (let t of Array.from(e.childNodes)) if (t.nodeType === 3) r.push(oe(t.nodeValue ?? ""));
|
|
162
162
|
else if (t.nodeType === 1) {
|
|
163
163
|
let e = t, n = e.tagName.toLowerCase();
|
|
164
164
|
if (h.has(n)) continue;
|
|
165
|
-
m.has(n) ? r.push(
|
|
165
|
+
m.has(n) ? r.push(ie(e)) : r.push(oe(e.textContent ?? ""));
|
|
166
166
|
}
|
|
167
167
|
return `<${t}${n}>${r.join("")}</${t}>`;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
169
|
+
function ae(e) {
|
|
170
170
|
let t = String(e || "").trim();
|
|
171
171
|
if (!t || !t.includes("<") || typeof DOMParser > "u") return e;
|
|
172
|
-
let n = new DOMParser().parseFromString(
|
|
173
|
-
if (r) return
|
|
172
|
+
let n = new DOMParser().parseFromString(te(t), "text/html"), r = n.querySelector("speak");
|
|
173
|
+
if (r) return re(r), ie(r);
|
|
174
174
|
let i = n.createElement("speak");
|
|
175
175
|
for (let e of Array.from(n.body.childNodes)) i.appendChild(e);
|
|
176
|
-
return
|
|
177
|
-
if (e.nodeType === 3) return
|
|
176
|
+
return re(i), Array.from(i.childNodes).map((e) => {
|
|
177
|
+
if (e.nodeType === 3) return oe(e.nodeValue ?? "");
|
|
178
178
|
if (e.nodeType === 1) {
|
|
179
179
|
let t = e;
|
|
180
|
-
return m.has(t.tagName.toLowerCase()) ?
|
|
180
|
+
return m.has(t.tagName.toLowerCase()) ? ie(t) : oe(t.textContent ?? "");
|
|
181
181
|
}
|
|
182
182
|
return "";
|
|
183
183
|
}).join("");
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function oe(e) {
|
|
186
186
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
187
187
|
}
|
|
188
188
|
function se(e) {
|
|
189
189
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
190
190
|
}
|
|
191
191
|
//#endregion
|
|
192
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
192
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/AccessibilityCatalogResolver.js
|
|
193
193
|
var ce = class {
|
|
194
194
|
assessmentCatalogs = /* @__PURE__ */ new Map();
|
|
195
195
|
itemCatalogs = /* @__PURE__ */ new Map();
|
|
@@ -282,7 +282,7 @@ var ce = class {
|
|
|
282
282
|
ensureSpokenSanitized(e) {
|
|
283
283
|
let t = this.sanitizedSpokenCache.get(e);
|
|
284
284
|
if (t !== void 0) return t;
|
|
285
|
-
let n =
|
|
285
|
+
let n = ae(e);
|
|
286
286
|
return this.sanitizedSpokenCache.set(e, n), n;
|
|
287
287
|
}
|
|
288
288
|
getOwnerKey(e) {
|
|
@@ -312,7 +312,7 @@ var ce = class {
|
|
|
312
312
|
...e,
|
|
313
313
|
cards: e.cards.map((e) => ({
|
|
314
314
|
...e,
|
|
315
|
-
content: e.catalog === "spoken" ?
|
|
315
|
+
content: e.catalog === "spoken" ? ae(e.content) : e.content
|
|
316
316
|
}))
|
|
317
317
|
}));
|
|
318
318
|
}
|
|
@@ -662,7 +662,7 @@ var de = class e {
|
|
|
662
662
|
}
|
|
663
663
|
i > d && (d = i, u = e);
|
|
664
664
|
}
|
|
665
|
-
let f = Math.max(.24, Math.min(.85, u * .55)), p = Math.max(.55, Math.min(.95, u + .2)), m = Math.max(.22, Math.min(.6, u * .45)), h = s,
|
|
665
|
+
let f = Math.max(.24, Math.min(.85, u * .55)), p = Math.max(.55, Math.min(.95, u + .2)), m = Math.max(.22, Math.min(.6, u * .45)), h = s, g = this.blend(h, o, p), ee = this.contrastRatio(g, o), te = this.relativeLuminance(o) > .45 ? [
|
|
666
666
|
0,
|
|
667
667
|
0,
|
|
668
668
|
0
|
|
@@ -670,12 +670,12 @@ var de = class e {
|
|
|
670
670
|
255,
|
|
671
671
|
255,
|
|
672
672
|
255
|
|
673
|
-
],
|
|
673
|
+
], _ = ee >= 1.35 ? h : te;
|
|
674
674
|
return {
|
|
675
675
|
wordHighlight: `rgba(${c[0]}, ${c[1]}, ${c[2]}, ${u})`,
|
|
676
676
|
sentenceHighlight: `rgba(${c[0]}, ${c[1]}, ${c[2]}, ${f})`,
|
|
677
|
-
wordUnderline: `rgba(${
|
|
678
|
-
wordShadow: `rgba(${
|
|
677
|
+
wordUnderline: `rgba(${_[0]}, ${_[1]}, ${_[2]}, ${p})`,
|
|
678
|
+
wordShadow: `rgba(${_[0]}, ${_[1]}, ${_[2]}, ${m})`
|
|
679
679
|
};
|
|
680
680
|
}
|
|
681
681
|
applyAdaptiveTTSStyle(e) {
|
|
@@ -695,7 +695,7 @@ var de = class e {
|
|
|
695
695
|
registerStyles() {
|
|
696
696
|
if (!this.supported || typeof document > "u" || document.getElementById("pie-highlight-styles")) return;
|
|
697
697
|
let e = document.createElement("style");
|
|
698
|
-
e.id = "pie-highlight-styles", e.textContent = "\n /* TTS highlights - temporary */\n ::highlight(tts-word) {\n background-color: var(--pie-tts-word-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 68%, transparent));\n text-decoration: underline 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));\n text-underline-offset: 2px;\n text-shadow: 0 0 1px var(--pie-tts-word-shadow, color-mix(in srgb, var(--pie-text, #111827) 35%, transparent));\n color: inherit;\n }\n\n /* tts-sentence registry id: coarse read-along band (visual line boxes in layout) */\n ::highlight(tts-sentence) {\n background-color: var(--pie-tts-line-highlight, var(--pie-tts-sentence-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 38%, transparent)));\n color: inherit;\n }\n\n [data-pie-tts-sentence-element=\"true\"] {\n background-color: var(--pie-tts-line-highlight, var(--pie-tts-sentence-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 38%, transparent)));\n border-radius: 0.12em;\n box-decoration-break: clone;\n -webkit-box-decoration-break: clone;\n }\n\n [data-pie-tts-word-element=\"true\"] {\n background-color: var(--pie-tts-word-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 68%, transparent));\n text-decoration: underline 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));\n text-underline-offset: 2px;\n text-shadow: 0 0 1px var(--pie-tts-word-shadow, color-mix(in srgb, var(--pie-text, #111827) 35%, transparent));\n border-bottom: 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));\n padding-bottom: 1px;\n border-radius: 0.12em;\n box-decoration-break: clone;\n -webkit-box-decoration-break: clone;\n }\n\n /* Annotation highlights - persistent */\n ::highlight(annotation-yellow) {\n background-color: var(--pie-annotation-yellow-highlight, rgba(253, 233, 149, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-green) {\n background-color: var(--pie-annotation-green-highlight, rgba(166, 225, 197, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-blue) {\n background-color: var(--pie-annotation-blue-highlight, rgba(167, 224, 246, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-pink) {\n background-color: var(--pie-annotation-pink-highlight, rgba(255, 159, 174, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-orange) {\n background-color: var(--pie-annotation-orange-highlight, rgba(255, 165, 0, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-underline) {\n background-color: transparent;\n text-decoration: underline 2px solid var(--pie-primary, #0066cc);\n text-underline-offset: 2px;\n color: inherit;\n }\n ", document.head.appendChild(e);
|
|
698
|
+
e.id = "pie-highlight-styles", e.textContent = "\n /* TTS highlights - temporary */\n ::highlight(tts-word) {\n background-color: var(--pie-tts-word-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 68%, transparent));\n text-decoration: underline 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));\n text-underline-offset: 2px;\n text-shadow: 0 0 1px var(--pie-tts-word-shadow, color-mix(in srgb, var(--pie-text, #111827) 35%, transparent));\n color: inherit;\n }\n\n /* tts-sentence registry id: coarse read-along band (visual line boxes in layout) */\n ::highlight(tts-sentence) {\n background-color: var(--pie-tts-line-highlight, var(--pie-tts-sentence-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 38%, transparent)));\n color: inherit;\n }\n\n [data-pie-tts-sentence-element=\"true\"] {\n background-color: var(--pie-tts-line-highlight, var(--pie-tts-sentence-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 38%, transparent)));\n border-radius: 0.12em;\n box-decoration-break: clone;\n -webkit-box-decoration-break: clone;\n }\n\n [data-pie-tts-word-element=\"true\"] {\n background-color: var(--pie-tts-word-highlight, color-mix(in srgb, var(--pie-missing, #ffeb3b) 68%, transparent));\n text-decoration: underline 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));\n text-underline-offset: 2px;\n text-shadow: 0 0 1px var(--pie-tts-word-shadow, color-mix(in srgb, var(--pie-text, #111827) 35%, transparent));\n border-bottom: 2px solid var(--pie-tts-word-underline, color-mix(in srgb, var(--pie-text, #111827) 70%, transparent));\n padding-bottom: 1px;\n border-radius: 0.12em;\n box-decoration-break: clone;\n -webkit-box-decoration-break: clone;\n }\n\n /* Annotation highlights - persistent */\n ::highlight(annotation-yellow) {\n background-color: var(--pie-annotation-yellow-highlight, rgba(253, 233, 149, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-green) {\n background-color: var(--pie-annotation-green-highlight, rgba(166, 225, 197, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-blue) {\n background-color: var(--pie-annotation-blue-highlight, rgba(167, 224, 246, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-pink) {\n background-color: var(--pie-annotation-pink-highlight, rgba(255, 159, 174, 0.5));\n color: inherit;\n }\n\n ::highlight(annotation-orange) {\n background-color: var(--pie-annotation-orange-highlight, rgba(255, 165, 0, 0.5));\n color: inherit;\n }\n\n /* The base light/dark pair is fixed: #4221d5 on light, #9c89ec on dark.\n One value cannot serve both -- #4221d5 is 2.41:1 on black and #9c89ec is\n 2.85:1 on white -- so neither of those two consults the theme accent,\n which is chosen against one background and illegible on the other.\n\n Each state has its own token so overriding one never silently moves the\n other, and so either can beat a host-set pie-primary: a var() fallback\n can never override a value the host actually set. */\n ::highlight(annotation-underline) {\n background-color: transparent;\n text-decoration: underline 2px solid var(--pie-annotation-underline, #4221d5);\n text-underline-offset: 2px;\n color: inherit;\n }\n\n /* The blocks below cover annotation swatches, print, and reduced motion.\n They deliberately do NOT retune the TTS layers: applyAdaptiveTTSStyle()\n writes the pie-tts custom properties inline on documentElement on every\n paint and on theme change, so a media query that only varies a var()\n fallback for those can never take effect. Annotation colours have no such\n adaptive path -- they are fixed swatches a student chose -- so a media\n query is the only way to adjust them, and each keeps its var() so a host\n override still wins.\n\n The names above are spelled without their leading dashes on purpose.\n check-theme-tokens scans comments, and its token pattern stops at the\n first non-alphanumeric character, so writing the wildcard form reads as\n consumption of a shorter token that is not in the registry and fails the\n check. Spell property names in full, or omit the dashes. */\n\n @media (prefers-color-scheme: dark) {\n ::highlight(annotation-yellow) {\n background-color: var(--pie-annotation-yellow-highlight, rgba(139, 117, 0, 0.6));\n }\n ::highlight(annotation-green) {\n background-color: var(--pie-annotation-green-highlight, rgba(45, 92, 63, 0.6));\n }\n ::highlight(annotation-blue) {\n background-color: var(--pie-annotation-blue-highlight, rgba(0, 102, 170, 0.6));\n }\n ::highlight(annotation-pink) {\n background-color: var(--pie-annotation-pink-highlight, rgba(139, 51, 74, 0.6));\n }\n ::highlight(annotation-orange) {\n background-color: var(--pie-annotation-orange-highlight, rgba(154, 99, 0, 0.6));\n }\n ::highlight(annotation-underline) {\n text-decoration-color: var(--pie-annotation-underline-dark, #9c89ec);\n }\n }\n\n /* The media query above reports the OS preference, which is only a guess\n at what the page is actually showing. An app that declares a theme has\n the final say, so the rules below override it. pie-theme always stamps\n data-theme on documentElement (scope=\"document\") or on its own host, and\n resolves to a dark palette only for the literal value \"dark\" -- every\n other value, including DaisyUI theme ids, maps to a light base.\n\n The three cases are mutually exclusive, so they never fight each other.\n All carry attribute selectors, which outrank the bare ::highlight() rules\n above -- including the one inside the media query, since a media query\n adds no specificity -- whatever the source order. */\n [data-theme=\"light\"] ::highlight(annotation-underline) {\n text-decoration-color: var(--pie-annotation-underline, #4221d5);\n }\n\n [data-theme=\"dark\"] ::highlight(annotation-underline) {\n text-decoration-color: var(--pie-annotation-underline-dark, #9c89ec);\n }\n\n /* A host or DaisyUI palette: follow its accent so the mark belongs to that\n theme, falling back to the light default when it declares none. */\n [data-theme]:not([data-theme=\"light\"]):not([data-theme=\"dark\"]) ::highlight(annotation-underline) {\n text-decoration-color: var(--pie-annotation-underline, var(--pie-primary, #4221d5));\n }\n\n /* WCAG 2.2 SC 1.4.11 non-text contrast: a highlight is the only indication\n that text is annotated, so the swatches saturate and the underline\n thickens when the user asks for more contrast.\n\n The value is \"more\", not \"high\". The stylesheet this was recovered from\n used prefers-contrast: high, which is not a valid value for the feature\n -- the keywords are no-preference, more, less, custom. An invalid query\n evaluates to \"not all\", so that block could never have matched in any\n browser even had the file been loaded. Verified with matchMedia under\n emulation: \"high\" stays false where \"more\" flips true. */\n @media (prefers-contrast: more) {\n ::highlight(annotation-yellow) {\n background-color: var(--pie-annotation-yellow-highlight, rgba(255, 255, 0, 0.7));\n }\n ::highlight(annotation-green) {\n background-color: var(--pie-annotation-green-highlight, rgba(0, 255, 127, 0.7));\n }\n ::highlight(annotation-blue) {\n background-color: var(--pie-annotation-blue-highlight, rgba(0, 191, 255, 0.7));\n }\n ::highlight(annotation-pink) {\n background-color: var(--pie-annotation-pink-highlight, rgba(255, 105, 180, 0.7));\n }\n ::highlight(annotation-orange) {\n background-color: var(--pie-annotation-orange-highlight, rgba(255, 165, 0, 0.85));\n }\n ::highlight(annotation-underline) {\n text-decoration-thickness: 3px;\n }\n }\n\n @media print {\n /* TTS highlighting is a transient read-along cue, not content. */\n ::highlight(tts-word),\n ::highlight(tts-sentence),\n [data-pie-tts-word-element=\"true\"],\n [data-pie-tts-sentence-element=\"true\"] {\n background-color: transparent;\n text-decoration: none;\n text-shadow: none;\n border-bottom: none;\n }\n\n /* Annotations are student work and must survive printing, but a fill\n that reads fine on screen can print as an illegible wash, so each\n becomes an underline that keeps its colour coding. */\n ::highlight(annotation-yellow),\n ::highlight(annotation-green),\n ::highlight(annotation-blue),\n ::highlight(annotation-pink),\n ::highlight(annotation-orange) {\n background-color: transparent;\n border-bottom: 2px solid currentColor;\n }\n ::highlight(annotation-yellow) { border-bottom-color: #ffeb3b; }\n ::highlight(annotation-green) { border-bottom-color: #a6e1c5; }\n ::highlight(annotation-blue) { border-bottom-color: #a7e0f6; }\n ::highlight(annotation-pink) { border-bottom-color: #ff9fae; }\n ::highlight(annotation-orange) { border-bottom-color: #ffa500; }\n ::highlight(annotation-underline) {\n text-decoration-color: #000;\n border-bottom: none;\n }\n }\n\n /* text-shadow is a direct property rather than a var(), so unlike the\n other TTS rules this one is not overridden by the adaptive path. */\n @media (prefers-reduced-motion: reduce) {\n ::highlight(tts-word),\n [data-pie-tts-word-element=\"true\"] {\n text-shadow: none;\n }\n }\n ", document.head.appendChild(e);
|
|
699
699
|
}
|
|
700
700
|
highlightTTSWord(e, t, n) {
|
|
701
701
|
if (!this.ttsWordHighlight) return;
|
|
@@ -887,14 +887,14 @@ var de = class e {
|
|
|
887
887
|
}
|
|
888
888
|
};
|
|
889
889
|
//#endregion
|
|
890
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
890
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/utils/logger.js
|
|
891
891
|
function fe(e) {
|
|
892
892
|
return (...t) => {
|
|
893
893
|
console.debug(`[${e}]`, ...t);
|
|
894
894
|
};
|
|
895
895
|
}
|
|
896
896
|
//#endregion
|
|
897
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
897
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/tool-config-defaults.js
|
|
898
898
|
var pe = {
|
|
899
899
|
assessment: [],
|
|
900
900
|
section: [],
|
|
@@ -980,7 +980,7 @@ function xe(e) {
|
|
|
980
980
|
return i && (a.pnpEnforcement = i), a;
|
|
981
981
|
}
|
|
982
982
|
//#endregion
|
|
983
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
983
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/ToolRegistry.js
|
|
984
984
|
var Se = [
|
|
985
985
|
"assessment",
|
|
986
986
|
"section",
|
|
@@ -1172,7 +1172,7 @@ var Ee = class {
|
|
|
1172
1172
|
}
|
|
1173
1173
|
};
|
|
1174
1174
|
//#endregion
|
|
1175
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
1175
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/tool-context.js
|
|
1176
1176
|
function De(e) {
|
|
1177
1177
|
return e.level === "item";
|
|
1178
1178
|
}
|
|
@@ -1251,9 +1251,11 @@ function Me(e) {
|
|
|
1251
1251
|
"pie-multiple-choice",
|
|
1252
1252
|
"pie-inline-choice",
|
|
1253
1253
|
"pie-select-text",
|
|
1254
|
+
"pie-ebsr",
|
|
1254
1255
|
"multiple-choice",
|
|
1255
1256
|
"inline-choice",
|
|
1256
|
-
"select-text"
|
|
1257
|
+
"select-text",
|
|
1258
|
+
"ebsr"
|
|
1257
1259
|
];
|
|
1258
1260
|
if (Ae(e)) {
|
|
1259
1261
|
let n = e.item.config;
|
|
@@ -1304,7 +1306,7 @@ function Ie(e, t, n) {
|
|
|
1304
1306
|
return `${r}:${t}:${i}`;
|
|
1305
1307
|
}
|
|
1306
1308
|
//#endregion
|
|
1307
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
1309
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/tool-providers/ToolProviderRegistry.js
|
|
1308
1310
|
var Le = class {
|
|
1309
1311
|
providers = /* @__PURE__ */ new Map();
|
|
1310
1312
|
configs = /* @__PURE__ */ new Map();
|
|
@@ -1455,7 +1457,7 @@ var Le = class {
|
|
|
1455
1457
|
providerId = "desmos-calculator";
|
|
1456
1458
|
providerName = "Desmos Calculator";
|
|
1457
1459
|
category = "calculator";
|
|
1458
|
-
version = "1.
|
|
1460
|
+
version = "1.12";
|
|
1459
1461
|
requiresAuth = !0;
|
|
1460
1462
|
desmosProvider = null;
|
|
1461
1463
|
config = null;
|
|
@@ -1947,7 +1949,11 @@ var nt = {
|
|
|
1947
1949
|
minWidth: 380,
|
|
1948
1950
|
minHeight: 420,
|
|
1949
1951
|
initialAlign: "bottom-right",
|
|
1950
|
-
initialMargin: 16
|
|
1952
|
+
initialMargin: 16,
|
|
1953
|
+
content: {
|
|
1954
|
+
overflowY: "auto",
|
|
1955
|
+
preserveMinHeight: !0
|
|
1956
|
+
}
|
|
1951
1957
|
}
|
|
1952
1958
|
}],
|
|
1953
1959
|
button: d,
|
|
@@ -2035,7 +2041,7 @@ var nt = {
|
|
|
2035
2041
|
text: d,
|
|
2036
2042
|
map: n
|
|
2037
2043
|
};
|
|
2038
|
-
}, ot = null, st = Promise.resolve(), ct = (e) => (e || "en").split("-")[0].toLowerCase() || "en", lt = async () => (ot ||= import("./sre-
|
|
2044
|
+
}, ot = null, st = Promise.resolve(), ct = (e) => (e || "en").split("-")[0].toLowerCase() || "en", lt = async () => (ot ||= import("./sre-CgK32OcY.js").then((t) => /* @__PURE__ */ e(t.default, 1)).then((e) => {
|
|
2039
2045
|
let t = e.default || e;
|
|
2040
2046
|
if (!t || typeof t.toSpeech != "function") throw Error("speech-rule-engine did not expose toSpeech");
|
|
2041
2047
|
return t;
|
|
@@ -2103,52 +2109,71 @@ var nt = {
|
|
|
2103
2109
|
"expanding-row",
|
|
2104
2110
|
"floating-overlay",
|
|
2105
2111
|
"left-aligned"
|
|
2106
|
-
]), bt = (e) => e && typeof e == "object" ? e : {}, xt = (e) => e === "polly" || e === "google" || e === "server", j = (e, t) => e === void 0 ? t : e, St = (e, t = "left-aligned") => typeof e == "string" && yt.has(e) ? e : t
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2112
|
+
]), bt = (e) => e && typeof e == "object" ? e : {}, xt = (e) => e === "polly" || e === "google" || e === "server", j = (e, t) => e === void 0 ? t : e, St = (e, t = "left-aligned") => typeof e == "string" && yt.has(e) ? e : t;
|
|
2113
|
+
Object.freeze([.8, 1.25]);
|
|
2114
|
+
var Ct = Object.freeze([
|
|
2115
|
+
{
|
|
2116
|
+
rate: .8,
|
|
2117
|
+
label: "Slow",
|
|
2118
|
+
ariaLabel: "Slow speed"
|
|
2119
|
+
},
|
|
2120
|
+
{
|
|
2121
|
+
rate: 1,
|
|
2122
|
+
label: "Normal",
|
|
2123
|
+
ariaLabel: "Normal speed",
|
|
2124
|
+
default: !0
|
|
2125
|
+
},
|
|
2126
|
+
{
|
|
2127
|
+
rate: 1.25,
|
|
2128
|
+
label: "Fast",
|
|
2129
|
+
ariaLabel: "Fast speed"
|
|
2130
|
+
}
|
|
2131
|
+
]), wt = (e) => {
|
|
2132
|
+
if (!(typeof e != "number" || !Number.isFinite(e) || e <= 0)) return Math.round(e * 100) / 100;
|
|
2110
2133
|
}, Tt = (e) => {
|
|
2111
2134
|
if (typeof e != "string") return;
|
|
2112
2135
|
let t = e.trim();
|
|
2113
2136
|
return t.length ? t : void 0;
|
|
2114
|
-
}, Et = (e) => `${e}x`, Dt = (e, t) => t ? `Speed ${e}` : `${e} speed`, Ot = (e, t, n) => t ? t.toLowerCase().includes(e.toLowerCase()) ? t : `${e} ${t}` : Dt(e, n),
|
|
2115
|
-
|
|
2116
|
-
if (
|
|
2117
|
-
let
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
|
|
2130
|
-
let e = kt(r);
|
|
2131
|
-
if (e === void 0) continue;
|
|
2132
|
-
let i = typeof e == "number" ? e : e.rate;
|
|
2133
|
-
t.has(i) || (t.add(i), n.push(e));
|
|
2134
|
-
}
|
|
2135
|
-
return n.length ? n : [...Ct];
|
|
2136
|
-
}, jt = (e) => At(e).map((e) => {
|
|
2137
|
-
if (typeof e == "number") {
|
|
2138
|
-
let t = Et(e);
|
|
2139
|
-
return {
|
|
2140
|
-
rate: e,
|
|
2141
|
-
label: t,
|
|
2142
|
-
ariaLabel: Dt(t, !0)
|
|
2143
|
-
};
|
|
2137
|
+
}, Et = (e) => `${e}x`, Dt = (e, t) => e.toLowerCase() === "normal" ? "Normal speed" : t ? `Speed ${e}` : `${e} speed`, Ot = (e, t, n) => t ? t.toLowerCase().includes(e.toLowerCase()) ? t : `${e} ${t}` : Dt(e, n), M = (e) => {
|
|
2138
|
+
let t = Array.isArray(e) ? e : [...Ct];
|
|
2139
|
+
if (t.length === 0) return [];
|
|
2140
|
+
let n = /* @__PURE__ */ new Set(), r = [];
|
|
2141
|
+
for (let e of t) {
|
|
2142
|
+
let t = bt(e), i = wt(typeof e == "number" ? e : t.rate);
|
|
2143
|
+
if (i === void 0 || n.has(i)) continue;
|
|
2144
|
+
n.add(i);
|
|
2145
|
+
let a = i === 1 ? "Normal" : Et(i), o = typeof e == "number" ? a : Tt(t.label) || a, s = typeof e == "number" ? i === 1 ? "Normal speed" : Dt(o, !0) : Ot(o, Tt(t.ariaLabel), o === a);
|
|
2146
|
+
r.push({
|
|
2147
|
+
rate: i,
|
|
2148
|
+
label: o,
|
|
2149
|
+
ariaLabel: s,
|
|
2150
|
+
isDefault: !1,
|
|
2151
|
+
requestedDefault: t.default === !0 || t.isDefault === !0
|
|
2152
|
+
});
|
|
2144
2153
|
}
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2154
|
+
if (!r.length) return M(Ct);
|
|
2155
|
+
if (!n.has(1)) {
|
|
2156
|
+
let e = {
|
|
2157
|
+
rate: 1,
|
|
2158
|
+
label: "Normal",
|
|
2159
|
+
ariaLabel: "Normal speed",
|
|
2160
|
+
isDefault: !1,
|
|
2161
|
+
requestedDefault: !1
|
|
2162
|
+
}, t = r.findIndex((e) => e.rate > 1);
|
|
2163
|
+
t >= 0 ? r.splice(t, 0, e) : r.push(e);
|
|
2164
|
+
}
|
|
2165
|
+
let i = r.findIndex((e) => e.requestedDefault), a = i >= 0 ? i : r.findIndex((e) => e.rate === 1);
|
|
2166
|
+
return r.map(({ requestedDefault: e, ...t }, n) => ({
|
|
2167
|
+
...t,
|
|
2168
|
+
isDefault: n === a
|
|
2169
|
+
}));
|
|
2170
|
+
};
|
|
2171
|
+
Object.freeze([
|
|
2172
|
+
.8,
|
|
2173
|
+
1,
|
|
2174
|
+
1.25
|
|
2175
|
+
]);
|
|
2176
|
+
var kt = (e) => {
|
|
2152
2177
|
let t = {
|
|
2153
2178
|
...e,
|
|
2154
2179
|
layoutMode: St(e.layoutMode)
|
|
@@ -2174,14 +2199,14 @@ var nt = {
|
|
|
2174
2199
|
...r,
|
|
2175
2200
|
defaultVoice: j(r.defaultVoice, "en-US-Wavenet-A")
|
|
2176
2201
|
} : r;
|
|
2177
|
-
},
|
|
2202
|
+
}, At = (e) => {
|
|
2178
2203
|
let t = bt(e), n = bt(t.settings);
|
|
2179
|
-
return
|
|
2204
|
+
return kt({
|
|
2180
2205
|
...t,
|
|
2181
2206
|
...n
|
|
2182
2207
|
});
|
|
2183
|
-
},
|
|
2184
|
-
let t =
|
|
2208
|
+
}, jt = (e) => e.backend || "browser", Mt = (e, t) => t === "polly" || t === "google" ? t : e.serverProvider || e.provider, Nt = (e, t) => e.transportMode || (t === "custom" ? "custom" : "pie"), Pt = (e) => {
|
|
2209
|
+
let t = jt(e), n = Mt(e, t), r = Nt(e, n), i = A(e.mathSpeech);
|
|
2185
2210
|
return {
|
|
2186
2211
|
voice: e.defaultVoice,
|
|
2187
2212
|
rate: e.rate,
|
|
@@ -2207,45 +2232,56 @@ var nt = {
|
|
|
2207
2232
|
validateEndpoint: e.validateEndpoint,
|
|
2208
2233
|
...typeof e.mathTokenHighlighting == "boolean" ? { mathTokenHighlighting: e.mathTokenHighlighting } : {}
|
|
2209
2234
|
};
|
|
2210
|
-
},
|
|
2211
|
-
switch (
|
|
2235
|
+
}, Ft = (e) => St(e.layoutMode), It = (e) => {
|
|
2236
|
+
switch (Ft(e)) {
|
|
2212
2237
|
case "reserved-row": return {
|
|
2213
2238
|
mount: "before-buttons",
|
|
2214
2239
|
controlsRow: {
|
|
2215
2240
|
reserveSpace: !0,
|
|
2216
2241
|
expandWhenToolActive: !1
|
|
2217
|
-
}
|
|
2242
|
+
},
|
|
2243
|
+
headerOverlay: { expandWhenToolActive: !1 }
|
|
2218
2244
|
};
|
|
2219
2245
|
case "expanding-row": return {
|
|
2220
2246
|
mount: "before-buttons",
|
|
2221
2247
|
controlsRow: {
|
|
2222
2248
|
reserveSpace: !1,
|
|
2223
2249
|
expandWhenToolActive: !0
|
|
2224
|
-
}
|
|
2250
|
+
},
|
|
2251
|
+
headerOverlay: { expandWhenToolActive: !1 }
|
|
2252
|
+
};
|
|
2253
|
+
case "floating-overlay": return {
|
|
2254
|
+
mount: "before-buttons",
|
|
2255
|
+
controlsRow: {
|
|
2256
|
+
reserveSpace: !1,
|
|
2257
|
+
expandWhenToolActive: !1
|
|
2258
|
+
},
|
|
2259
|
+
headerOverlay: { expandWhenToolActive: !1 }
|
|
2225
2260
|
};
|
|
2226
2261
|
default: return {
|
|
2227
2262
|
mount: "before-buttons",
|
|
2228
2263
|
controlsRow: {
|
|
2229
2264
|
reserveSpace: !1,
|
|
2230
2265
|
expandWhenToolActive: !1
|
|
2231
|
-
}
|
|
2266
|
+
},
|
|
2267
|
+
headerOverlay: { expandWhenToolActive: !0 }
|
|
2232
2268
|
};
|
|
2233
2269
|
}
|
|
2234
|
-
},
|
|
2270
|
+
}, N = /* @__PURE__ */ new Map(), Lt = "__pieToolElementUnmount", Rt = "pie-tool-active-change", zt = {
|
|
2235
2271
|
toolId: "textToSpeech",
|
|
2236
2272
|
name: "Text to Speech",
|
|
2237
2273
|
description: "Read content aloud",
|
|
2238
2274
|
icon: "volume-up",
|
|
2239
2275
|
provider: {
|
|
2240
2276
|
getProviderId: () => "tts",
|
|
2241
|
-
createProvider: (e) => new Ke(
|
|
2277
|
+
createProvider: (e) => new Ke(jt(At(e))),
|
|
2242
2278
|
getInitConfig: (e) => {
|
|
2243
|
-
let t =
|
|
2279
|
+
let t = At(e), n = jt(t), r = Mt(t, n);
|
|
2244
2280
|
return {
|
|
2245
2281
|
backend: n,
|
|
2246
2282
|
serverProvider: r,
|
|
2247
|
-
transportMode:
|
|
2248
|
-
...
|
|
2283
|
+
transportMode: Nt(t, r),
|
|
2284
|
+
...Pt(t)
|
|
2249
2285
|
};
|
|
2250
2286
|
},
|
|
2251
2287
|
getAuthFetcher: (e) => {
|
|
@@ -2254,9 +2290,9 @@ var nt = {
|
|
|
2254
2290
|
},
|
|
2255
2291
|
sanitizeConfig: (e) => {
|
|
2256
2292
|
let t = e.settings && typeof e.settings == "object" ? { ...e.settings } : void 0;
|
|
2257
|
-
t && "layoutMode" in t && (t.layoutMode = St(t.layoutMode)), t && "speedOptions" in t && (t.speedOptions =
|
|
2293
|
+
t && "layoutMode" in t && (t.layoutMode = St(t.layoutMode)), t && "speedOptions" in t && (t.speedOptions = M(t.speedOptions));
|
|
2258
2294
|
let n = { ...e };
|
|
2259
|
-
return "layoutMode" in n && (n.layoutMode = St(n.layoutMode)), "speedOptions" in n && (n.speedOptions =
|
|
2295
|
+
return "layoutMode" in n && (n.layoutMode = St(n.layoutMode)), "speedOptions" in n && (n.speedOptions = M(n.speedOptions)), t && (n.settings = t), n;
|
|
2260
2296
|
},
|
|
2261
2297
|
lazy: !0
|
|
2262
2298
|
},
|
|
@@ -2271,14 +2307,14 @@ var nt = {
|
|
|
2271
2307
|
return T(e);
|
|
2272
2308
|
},
|
|
2273
2309
|
renderToolbar(e, t) {
|
|
2274
|
-
let n = () =>
|
|
2310
|
+
let n = () => At(t.toolkitCoordinator?.getToolConfig(this.toolId) || void 0), r = () => M(n().speedOptions), i = () => Ft(n()), a = () => It(n()), o = Ie(this.toolId, t.scope.level, t.scope.scopeId), s = () => {
|
|
2275
2311
|
let e = t.ui?.size;
|
|
2276
2312
|
return e === "sm" || e === "lg" ? e : "md";
|
|
2277
2313
|
}, c = () => {
|
|
2278
|
-
let e =
|
|
2279
|
-
return e && typeof e.isConnected == "boolean" && !e.isConnected && (
|
|
2280
|
-
|
|
2281
|
-
},
|
|
2314
|
+
let e = N.get(o);
|
|
2315
|
+
return e && typeof e.isConnected == "boolean" && !e.isConnected && (N.delete(o), e = void 0), e || (e = document.createElement("pie-tool-tts-inline"), e[Lt] = () => {
|
|
2316
|
+
N.get(o) === e && N.delete(o);
|
|
2317
|
+
}, N.set(o, e)), e.setAttribute("tool-id", o), e.setAttribute("catalog-id", t.catalogId || t.itemId), e.setAttribute("language", t.language || "en-US"), e.setAttribute("size", s()), e.setAttribute("layout-mode", i()), e.speedOptions = r(), e.showSingleSpeedOption = n().showSingleSpeedOption === !0, e;
|
|
2282
2318
|
}, l = a();
|
|
2283
2319
|
return {
|
|
2284
2320
|
toolId: this.toolId,
|
|
@@ -2286,30 +2322,33 @@ var nt = {
|
|
|
2286
2322
|
elements: [{
|
|
2287
2323
|
element: c(),
|
|
2288
2324
|
mount: l.mount,
|
|
2289
|
-
layoutHints: {
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2325
|
+
layoutHints: {
|
|
2326
|
+
controlsRow: {
|
|
2327
|
+
reserveSpace: l.controlsRow.reserveSpace,
|
|
2328
|
+
showWhenToolActive: l.controlsRow.expandWhenToolActive
|
|
2329
|
+
},
|
|
2330
|
+
headerOverlay: { showWhenToolActive: l.headerOverlay.expandWhenToolActive }
|
|
2331
|
+
}
|
|
2293
2332
|
}],
|
|
2294
2333
|
subscribeActive: (e) => {
|
|
2295
2334
|
let t = c(), n = (t) => {
|
|
2296
2335
|
let n = t.detail;
|
|
2297
2336
|
e(n?.active === !0);
|
|
2298
2337
|
};
|
|
2299
|
-
return t.addEventListener(
|
|
2300
|
-
t.removeEventListener(
|
|
2338
|
+
return t.addEventListener(Rt, n), () => {
|
|
2339
|
+
t.removeEventListener(Rt, n);
|
|
2301
2340
|
};
|
|
2302
2341
|
},
|
|
2303
2342
|
sync: () => {
|
|
2304
2343
|
let e = c();
|
|
2305
|
-
e.setAttribute("tool-id", o), e.setAttribute("catalog-id", t.catalogId || t.itemId), e.setAttribute("language", t.language || "en-US"), e.setAttribute("size", s()), e.setAttribute("layout-mode", i()), e.speedOptions = r();
|
|
2344
|
+
e.setAttribute("tool-id", o), e.setAttribute("catalog-id", t.catalogId || t.itemId), e.setAttribute("language", t.language || "en-US"), e.setAttribute("size", s()), e.setAttribute("layout-mode", i()), e.speedOptions = r(), e.showSingleSpeedOption = n().showSingleSpeedOption === !0;
|
|
2306
2345
|
}
|
|
2307
2346
|
};
|
|
2308
2347
|
}
|
|
2309
2348
|
};
|
|
2310
2349
|
//#endregion
|
|
2311
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
2312
|
-
function
|
|
2350
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/tools/registrations/toolbar-registration-helpers.js
|
|
2351
|
+
function P(e, t) {
|
|
2313
2352
|
let n = Ie(e, t.scope.level, t.scope.scopeId);
|
|
2314
2353
|
return {
|
|
2315
2354
|
fullToolId: n,
|
|
@@ -2319,18 +2358,18 @@ function F(e, t) {
|
|
|
2319
2358
|
}) : () => {}
|
|
2320
2359
|
};
|
|
2321
2360
|
}
|
|
2322
|
-
function
|
|
2361
|
+
function F(e) {
|
|
2323
2362
|
let t = e.isActive();
|
|
2324
2363
|
e.button.active = t, e.overlay.visible = t, e.onActiveChange?.(t);
|
|
2325
2364
|
}
|
|
2326
|
-
function
|
|
2365
|
+
function Bt(e, t) {
|
|
2327
2366
|
e.setAttribute("data-pie-tool-surface", t);
|
|
2328
2367
|
}
|
|
2329
2368
|
//#endregion
|
|
2330
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
2331
|
-
var
|
|
2369
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/createDefaultToolRegistry.js
|
|
2370
|
+
var Vt = [
|
|
2332
2371
|
nt,
|
|
2333
|
-
|
|
2372
|
+
zt,
|
|
2334
2373
|
{
|
|
2335
2374
|
toolId: "ruler",
|
|
2336
2375
|
name: "Ruler",
|
|
@@ -2346,7 +2385,7 @@ var Ht = [
|
|
|
2346
2385
|
return w(e);
|
|
2347
2386
|
},
|
|
2348
2387
|
renderToolbar(e, t) {
|
|
2349
|
-
let n =
|
|
2388
|
+
let n = P(this.toolId, t), r = {
|
|
2350
2389
|
toolId: this.toolId,
|
|
2351
2390
|
label: this.name,
|
|
2352
2391
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2356,7 +2395,7 @@ var Ht = [
|
|
|
2356
2395
|
onClick: () => t.toggleTool(this.toolId),
|
|
2357
2396
|
active: n.isActive()
|
|
2358
2397
|
}, i = t.componentOverrides ?? {}, a = E(this.toolId, e, t, i);
|
|
2359
|
-
return a.setAttribute("tool-id", n.fullToolId),
|
|
2398
|
+
return a.setAttribute("tool-id", n.fullToolId), Bt(a, "frameless"), {
|
|
2360
2399
|
toolId: this.toolId,
|
|
2361
2400
|
button: r,
|
|
2362
2401
|
elements: [{
|
|
@@ -2364,7 +2403,7 @@ var Ht = [
|
|
|
2364
2403
|
mount: "after-buttons"
|
|
2365
2404
|
}],
|
|
2366
2405
|
sync: () => {
|
|
2367
|
-
|
|
2406
|
+
F({
|
|
2368
2407
|
button: r,
|
|
2369
2408
|
overlay: a,
|
|
2370
2409
|
isActive: n.isActive
|
|
@@ -2389,7 +2428,7 @@ var Ht = [
|
|
|
2389
2428
|
return w(e);
|
|
2390
2429
|
},
|
|
2391
2430
|
renderToolbar(e, t) {
|
|
2392
|
-
let n =
|
|
2431
|
+
let n = P(this.toolId, t), r = {
|
|
2393
2432
|
toolId: this.toolId,
|
|
2394
2433
|
label: this.name,
|
|
2395
2434
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2399,7 +2438,7 @@ var Ht = [
|
|
|
2399
2438
|
onClick: () => t.toggleTool(this.toolId),
|
|
2400
2439
|
active: n.isActive()
|
|
2401
2440
|
}, i = t.componentOverrides ?? {}, a = E(this.toolId, e, t, i);
|
|
2402
|
-
return a.setAttribute("tool-id", n.fullToolId),
|
|
2441
|
+
return a.setAttribute("tool-id", n.fullToolId), Bt(a, "frameless"), {
|
|
2403
2442
|
toolId: this.toolId,
|
|
2404
2443
|
button: r,
|
|
2405
2444
|
elements: [{
|
|
@@ -2407,7 +2446,7 @@ var Ht = [
|
|
|
2407
2446
|
mount: "after-buttons"
|
|
2408
2447
|
}],
|
|
2409
2448
|
sync: () => {
|
|
2410
|
-
|
|
2449
|
+
F({
|
|
2411
2450
|
button: r,
|
|
2412
2451
|
overlay: a,
|
|
2413
2452
|
isActive: n.isActive
|
|
@@ -2433,7 +2472,7 @@ var Ht = [
|
|
|
2433
2472
|
return Me(e);
|
|
2434
2473
|
},
|
|
2435
2474
|
renderToolbar(e, t) {
|
|
2436
|
-
let n =
|
|
2475
|
+
let n = P(this.toolId, t), r = t.componentOverrides ?? {}, i = E(this.toolId, e, t, r);
|
|
2437
2476
|
i.setAttribute("tool-id", n.fullToolId), i.setAttribute("strategy", "strikethrough"), i.setAttribute("button-alignment", "inline");
|
|
2438
2477
|
let a = {
|
|
2439
2478
|
toolId: this.toolId,
|
|
@@ -2453,7 +2492,7 @@ var Ht = [
|
|
|
2453
2492
|
mount: "after-buttons"
|
|
2454
2493
|
}],
|
|
2455
2494
|
sync: () => {
|
|
2456
|
-
|
|
2495
|
+
F({
|
|
2457
2496
|
button: a,
|
|
2458
2497
|
overlay: i,
|
|
2459
2498
|
isActive: n.isActive
|
|
@@ -2486,7 +2525,7 @@ var Ht = [
|
|
|
2486
2525
|
return T(e);
|
|
2487
2526
|
},
|
|
2488
2527
|
renderToolbar(e, t) {
|
|
2489
|
-
let n =
|
|
2528
|
+
let n = P(this.toolId, t), r = {
|
|
2490
2529
|
toolId: this.toolId,
|
|
2491
2530
|
label: this.name,
|
|
2492
2531
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2504,7 +2543,7 @@ var Ht = [
|
|
|
2504
2543
|
mount: "after-buttons"
|
|
2505
2544
|
}],
|
|
2506
2545
|
sync: () => {
|
|
2507
|
-
|
|
2546
|
+
F({
|
|
2508
2547
|
button: r,
|
|
2509
2548
|
overlay: a,
|
|
2510
2549
|
isActive: n.isActive,
|
|
@@ -2539,7 +2578,7 @@ var Ht = [
|
|
|
2539
2578
|
return T(e);
|
|
2540
2579
|
},
|
|
2541
2580
|
renderToolbar(e, t) {
|
|
2542
|
-
let n =
|
|
2581
|
+
let n = P(this.toolId, t), r = {
|
|
2543
2582
|
toolId: this.toolId,
|
|
2544
2583
|
label: this.name,
|
|
2545
2584
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2549,7 +2588,7 @@ var Ht = [
|
|
|
2549
2588
|
onClick: () => t.toggleTool(this.toolId),
|
|
2550
2589
|
active: n.isActive()
|
|
2551
2590
|
}, i = t.componentOverrides ?? {}, a = E(this.toolId, e, t, i);
|
|
2552
|
-
return a.setAttribute("tool-id", n.fullToolId),
|
|
2591
|
+
return a.setAttribute("tool-id", n.fullToolId), Bt(a, "frameless"), {
|
|
2553
2592
|
toolId: this.toolId,
|
|
2554
2593
|
button: r,
|
|
2555
2594
|
elements: [{
|
|
@@ -2557,7 +2596,7 @@ var Ht = [
|
|
|
2557
2596
|
mount: "after-buttons"
|
|
2558
2597
|
}],
|
|
2559
2598
|
sync: () => {
|
|
2560
|
-
|
|
2599
|
+
F({
|
|
2561
2600
|
button: r,
|
|
2562
2601
|
overlay: a,
|
|
2563
2602
|
isActive: n.isActive
|
|
@@ -2585,7 +2624,7 @@ var Ht = [
|
|
|
2585
2624
|
return !0;
|
|
2586
2625
|
},
|
|
2587
2626
|
renderToolbar(e, t) {
|
|
2588
|
-
let n =
|
|
2627
|
+
let n = P(this.toolId, t), r = {
|
|
2589
2628
|
toolId: this.toolId,
|
|
2590
2629
|
label: this.name,
|
|
2591
2630
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2613,7 +2652,7 @@ var Ht = [
|
|
|
2613
2652
|
}
|
|
2614
2653
|
}],
|
|
2615
2654
|
sync: () => {
|
|
2616
|
-
|
|
2655
|
+
F({
|
|
2617
2656
|
button: r,
|
|
2618
2657
|
overlay: a,
|
|
2619
2658
|
isActive: n.isActive
|
|
@@ -2647,7 +2686,7 @@ var Ht = [
|
|
|
2647
2686
|
return T(e);
|
|
2648
2687
|
},
|
|
2649
2688
|
renderToolbar(e, t) {
|
|
2650
|
-
let n =
|
|
2689
|
+
let n = P(this.toolId, t), r = {
|
|
2651
2690
|
toolId: this.toolId,
|
|
2652
2691
|
label: this.name,
|
|
2653
2692
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2665,7 +2704,7 @@ var Ht = [
|
|
|
2665
2704
|
mount: "after-buttons"
|
|
2666
2705
|
}],
|
|
2667
2706
|
sync: () => {
|
|
2668
|
-
|
|
2707
|
+
F({
|
|
2669
2708
|
button: r,
|
|
2670
2709
|
overlay: a,
|
|
2671
2710
|
isActive: n.isActive
|
|
@@ -2691,7 +2730,7 @@ var Ht = [
|
|
|
2691
2730
|
return w(e);
|
|
2692
2731
|
},
|
|
2693
2732
|
renderToolbar(e, t) {
|
|
2694
|
-
let n =
|
|
2733
|
+
let n = P(this.toolId, t), r = {
|
|
2695
2734
|
toolId: this.toolId,
|
|
2696
2735
|
label: this.name,
|
|
2697
2736
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2719,7 +2758,7 @@ var Ht = [
|
|
|
2719
2758
|
}
|
|
2720
2759
|
}],
|
|
2721
2760
|
sync: () => {
|
|
2722
|
-
|
|
2761
|
+
F({
|
|
2723
2762
|
button: r,
|
|
2724
2763
|
overlay: a,
|
|
2725
2764
|
isActive: n.isActive
|
|
@@ -2744,7 +2783,7 @@ var Ht = [
|
|
|
2744
2783
|
return Ne(e);
|
|
2745
2784
|
},
|
|
2746
2785
|
renderToolbar(e, t) {
|
|
2747
|
-
let n =
|
|
2786
|
+
let n = P(this.toolId, t), r = {
|
|
2748
2787
|
toolId: this.toolId,
|
|
2749
2788
|
label: this.name,
|
|
2750
2789
|
icon: typeof this.icon == "function" ? this.icon(e) : this.icon,
|
|
@@ -2772,7 +2811,7 @@ var Ht = [
|
|
|
2772
2811
|
}
|
|
2773
2812
|
}],
|
|
2774
2813
|
sync: () => {
|
|
2775
|
-
|
|
2814
|
+
F({
|
|
2776
2815
|
button: r,
|
|
2777
2816
|
overlay: a,
|
|
2778
2817
|
isActive: n.isActive
|
|
@@ -2783,7 +2822,7 @@ var Ht = [
|
|
|
2783
2822
|
}
|
|
2784
2823
|
}
|
|
2785
2824
|
];
|
|
2786
|
-
function
|
|
2825
|
+
function Ht(e = {}) {
|
|
2787
2826
|
let t = new Ee(), n = {
|
|
2788
2827
|
toolTagMap: {
|
|
2789
2828
|
...qe,
|
|
@@ -2792,24 +2831,24 @@ function Ut(e = {}) {
|
|
|
2792
2831
|
toolComponentFactory: e.toolComponentFactory,
|
|
2793
2832
|
toolComponentFactories: e.toolComponentFactories
|
|
2794
2833
|
};
|
|
2795
|
-
return e.includePackagedTools &&
|
|
2834
|
+
return e.includePackagedTools && Ut(t, {
|
|
2796
2835
|
toolIds: e.toolIds,
|
|
2797
2836
|
applyOverrides: (t) => e.overrides?.[t.toolId] || t
|
|
2798
2837
|
}), e.toolModuleLoaders && Object.keys(e.toolModuleLoaders).length > 0 && t.setToolModuleLoaders(e.toolModuleLoaders), t.setComponentOverrides(n), t;
|
|
2799
2838
|
}
|
|
2800
|
-
function
|
|
2839
|
+
function Ut(e, t = {}) {
|
|
2801
2840
|
let n = t.toolIds && t.toolIds.length > 0 ? new Set(t.toolIds) : null, r = t.applyOverrides || ((e) => e);
|
|
2802
|
-
for (let t of
|
|
2841
|
+
for (let t of Vt) n && !n.has(t.toolId) || e.register(r(t));
|
|
2803
2842
|
}
|
|
2804
|
-
function
|
|
2805
|
-
return
|
|
2843
|
+
function I(e = {}) {
|
|
2844
|
+
return Ht({
|
|
2806
2845
|
...e,
|
|
2807
2846
|
includePackagedTools: !0
|
|
2808
2847
|
});
|
|
2809
2848
|
}
|
|
2810
2849
|
//#endregion
|
|
2811
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
2812
|
-
function
|
|
2850
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/framework-error.js
|
|
2851
|
+
function Wt(e) {
|
|
2813
2852
|
return {
|
|
2814
2853
|
kind: e.kind,
|
|
2815
2854
|
severity: e.severity ?? "error",
|
|
@@ -2820,9 +2859,9 @@ function Gt(e) {
|
|
|
2820
2859
|
cause: e.cause
|
|
2821
2860
|
};
|
|
2822
2861
|
}
|
|
2823
|
-
function
|
|
2862
|
+
function Gt(e) {
|
|
2824
2863
|
let t = e.error instanceof Error && e.error.message.trim().length > 0 ? e.error.message : String(e.error || "Unknown framework error");
|
|
2825
|
-
return
|
|
2864
|
+
return Wt({
|
|
2826
2865
|
kind: e.kind,
|
|
2827
2866
|
source: e.source,
|
|
2828
2867
|
message: t,
|
|
@@ -2830,7 +2869,7 @@ function Kt(e) {
|
|
|
2830
2869
|
cause: e.error
|
|
2831
2870
|
});
|
|
2832
2871
|
}
|
|
2833
|
-
var
|
|
2872
|
+
var Kt = {
|
|
2834
2873
|
"coordinator-ready": "coordinator-init",
|
|
2835
2874
|
"state-load": "tool-state-load",
|
|
2836
2875
|
"state-save": "tool-state-save",
|
|
@@ -2840,9 +2879,9 @@ var qt = {
|
|
|
2840
2879
|
"section-controller-init": "section-controller-init",
|
|
2841
2880
|
"section-controller-dispose": "section-controller-dispose"
|
|
2842
2881
|
};
|
|
2843
|
-
function
|
|
2844
|
-
let t =
|
|
2845
|
-
return
|
|
2882
|
+
function qt(e) {
|
|
2883
|
+
let t = Kt[e.context.phase];
|
|
2884
|
+
return Gt({
|
|
2846
2885
|
kind: t,
|
|
2847
2886
|
source: e.context.providerId ? `pie-toolkit-coordinator/${e.context.providerId}` : `pie-toolkit-coordinator:${e.context.phase}`,
|
|
2848
2887
|
error: e.error,
|
|
@@ -2850,22 +2889,22 @@ function Jt(e) {
|
|
|
2850
2889
|
});
|
|
2851
2890
|
}
|
|
2852
2891
|
//#endregion
|
|
2853
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
2854
|
-
var
|
|
2855
|
-
function
|
|
2856
|
-
return e === "off" || e === "warn" || e === "error" ? e :
|
|
2892
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/tool-config-validation.js
|
|
2893
|
+
var Jt = "error";
|
|
2894
|
+
function Yt(e) {
|
|
2895
|
+
return e === "off" || e === "warn" || e === "error" ? e : Jt;
|
|
2857
2896
|
}
|
|
2858
|
-
function
|
|
2897
|
+
function L(e) {
|
|
2859
2898
|
return e;
|
|
2860
2899
|
}
|
|
2861
|
-
function
|
|
2900
|
+
function Xt(e) {
|
|
2862
2901
|
return e ? new Map(e.getAllTools().slice().sort((e, t) => e.toolId.localeCompare(t.toolId)).map((e) => [e.toolId, e])) : /* @__PURE__ */ new Map();
|
|
2863
2902
|
}
|
|
2864
|
-
function
|
|
2903
|
+
function Zt(e, t, n, r) {
|
|
2865
2904
|
if (!t || !n?.provider?.sanitizeConfig) return t;
|
|
2866
2905
|
try {
|
|
2867
2906
|
let i = n.provider.sanitizeConfig(t);
|
|
2868
|
-
return !i || typeof i != "object" || Array.isArray(i) ? (r.push(
|
|
2907
|
+
return !i || typeof i != "object" || Array.isArray(i) ? (r.push(L({
|
|
2869
2908
|
code: "tools.providerSanitizeFailed",
|
|
2870
2909
|
severity: "error",
|
|
2871
2910
|
path: `providers.${e}`,
|
|
@@ -2874,7 +2913,7 @@ function Qt(e, t, n, r) {
|
|
|
2874
2913
|
toolId: e
|
|
2875
2914
|
})), t) : i;
|
|
2876
2915
|
} catch (n) {
|
|
2877
|
-
return r.push(
|
|
2916
|
+
return r.push(L({
|
|
2878
2917
|
code: "tools.providerSanitizeFailed",
|
|
2879
2918
|
severity: "error",
|
|
2880
2919
|
path: `providers.${e}`,
|
|
@@ -2884,11 +2923,11 @@ function Qt(e, t, n, r) {
|
|
|
2884
2923
|
})), t;
|
|
2885
2924
|
}
|
|
2886
2925
|
}
|
|
2887
|
-
function
|
|
2926
|
+
function Qt(e, t, n, r) {
|
|
2888
2927
|
if (!(!t || !n?.provider?.validateConfig)) try {
|
|
2889
2928
|
let i = n.provider.validateConfig(t);
|
|
2890
2929
|
if (!Array.isArray(i)) {
|
|
2891
|
-
r.push(
|
|
2930
|
+
r.push(L({
|
|
2892
2931
|
code: "tools.invalidProviderValidation",
|
|
2893
2932
|
severity: "error",
|
|
2894
2933
|
path: `providers.${e}`,
|
|
@@ -2905,7 +2944,7 @@ function $t(e, t, n, r) {
|
|
|
2905
2944
|
toolId: t.toolId || e
|
|
2906
2945
|
});
|
|
2907
2946
|
} catch (t) {
|
|
2908
|
-
r.push(
|
|
2947
|
+
r.push(L({
|
|
2909
2948
|
code: "tools.providerValidateFailed",
|
|
2910
2949
|
severity: "error",
|
|
2911
2950
|
path: `providers.${e}`,
|
|
@@ -2915,7 +2954,7 @@ function $t(e, t, n, r) {
|
|
|
2915
2954
|
}));
|
|
2916
2955
|
}
|
|
2917
2956
|
}
|
|
2918
|
-
function
|
|
2957
|
+
function $t(e, t, n) {
|
|
2919
2958
|
if (t.size !== 0) for (let r of [
|
|
2920
2959
|
"section",
|
|
2921
2960
|
"item",
|
|
@@ -2923,7 +2962,7 @@ function en(e, t, n) {
|
|
|
2923
2962
|
]) for (let i of e.placement[r]) {
|
|
2924
2963
|
let e = t.get(i);
|
|
2925
2964
|
if (!e) {
|
|
2926
|
-
n.push(
|
|
2965
|
+
n.push(L({
|
|
2927
2966
|
code: "tools.unknownToolId",
|
|
2928
2967
|
severity: "error",
|
|
2929
2968
|
path: `placement.${r}`,
|
|
@@ -2933,7 +2972,7 @@ function en(e, t, n) {
|
|
|
2933
2972
|
continue;
|
|
2934
2973
|
}
|
|
2935
2974
|
let a = e.supportedLevels.includes(r), o = r === "item" && e.supportedLevels.includes("section");
|
|
2936
|
-
!a && !o && n.push(
|
|
2975
|
+
!a && !o && n.push(L({
|
|
2937
2976
|
code: "tools.unsupportedLevel",
|
|
2938
2977
|
severity: "error",
|
|
2939
2978
|
path: `placement.${r}`,
|
|
@@ -2942,16 +2981,16 @@ function en(e, t, n) {
|
|
|
2942
2981
|
}));
|
|
2943
2982
|
}
|
|
2944
2983
|
}
|
|
2945
|
-
function
|
|
2984
|
+
function en(e, t, n) {
|
|
2946
2985
|
if (t.size !== 0) {
|
|
2947
|
-
for (let r of e.policy.allowed || []) t.has(r) || n.push(
|
|
2986
|
+
for (let r of e.policy.allowed || []) t.has(r) || n.push(L({
|
|
2948
2987
|
code: "tools.unknownToolId",
|
|
2949
2988
|
severity: "error",
|
|
2950
2989
|
path: "policy.allowed",
|
|
2951
2990
|
message: `Unknown tool id "${r}" in policy.allowed.`,
|
|
2952
2991
|
toolId: r
|
|
2953
2992
|
}));
|
|
2954
|
-
for (let r of e.policy.blocked || []) t.has(r) || n.push(
|
|
2993
|
+
for (let r of e.policy.blocked || []) t.has(r) || n.push(L({
|
|
2955
2994
|
code: "tools.unknownToolId",
|
|
2956
2995
|
severity: "error",
|
|
2957
2996
|
path: "policy.blocked",
|
|
@@ -2960,8 +2999,8 @@ function tn(e, t, n) {
|
|
|
2960
2999
|
}));
|
|
2961
3000
|
}
|
|
2962
3001
|
}
|
|
2963
|
-
function
|
|
2964
|
-
n && r.push(
|
|
3002
|
+
function tn(e, t, n, r) {
|
|
3003
|
+
n && r.push(L({
|
|
2965
3004
|
code: "tools.removedProviderKey",
|
|
2966
3005
|
severity: "error",
|
|
2967
3006
|
path: "providers.tts",
|
|
@@ -2969,7 +3008,7 @@ function nn(e, t, n, r) {
|
|
|
2969
3008
|
providerId: "tts",
|
|
2970
3009
|
toolId: "textToSpeech"
|
|
2971
3010
|
}));
|
|
2972
|
-
for (let n of Object.keys(e.providers).sort()) t.size === 0 || t.has(n) || r.push(
|
|
3011
|
+
for (let n of Object.keys(e.providers).sort()) t.size === 0 || t.has(n) || r.push(L({
|
|
2973
3012
|
code: "tools.unknownProviderKey",
|
|
2974
3013
|
severity: "error",
|
|
2975
3014
|
path: `providers.${n}`,
|
|
@@ -2978,43 +3017,43 @@ function nn(e, t, n, r) {
|
|
|
2978
3017
|
toolId: n
|
|
2979
3018
|
}));
|
|
2980
3019
|
}
|
|
2981
|
-
function
|
|
3020
|
+
function nn(e, t) {
|
|
2982
3021
|
if (e.length !== 0) for (let n of e) {
|
|
2983
3022
|
let e = `[tool-config-validation:${t}]`;
|
|
2984
3023
|
console.warn(`${e} ${n.path} - ${n.message}`);
|
|
2985
3024
|
}
|
|
2986
3025
|
}
|
|
2987
|
-
function
|
|
3026
|
+
function rn(e, t) {
|
|
2988
3027
|
let n = e.map((e) => `- ${e.path}: ${e.message}`).join("\n");
|
|
2989
3028
|
throw Error(`[tool-config-validation:${t}] Invalid tools config:\n${n}`);
|
|
2990
3029
|
}
|
|
2991
|
-
function
|
|
2992
|
-
let n =
|
|
3030
|
+
function R(e, t = {}) {
|
|
3031
|
+
let n = Yt(t.strictness), r = t.source ?? "tools", i = Xt(t.toolRegistry ?? I()), a = xe(e), o = [], s = Object.hasOwn(a.providers, "tts"), c = { ...a.providers || {} };
|
|
2993
3032
|
for (let e of Object.keys(c).sort()) {
|
|
2994
3033
|
if (e === "tts") {
|
|
2995
3034
|
delete c.tts;
|
|
2996
3035
|
continue;
|
|
2997
3036
|
}
|
|
2998
3037
|
let t = i.get(e);
|
|
2999
|
-
c[e] =
|
|
3038
|
+
c[e] = Zt(e, c[e], t, o), Qt(e, c[e], t, o);
|
|
3000
3039
|
}
|
|
3001
3040
|
let l = {
|
|
3002
3041
|
...a,
|
|
3003
3042
|
providers: c
|
|
3004
3043
|
};
|
|
3005
|
-
return
|
|
3044
|
+
return $t(l, i, o), en(l, i, o), tn(l, i, s, o), s && rn(o.filter((e) => e.code === "tools.removedProviderKey"), r), n === "warn" && nn(o, r), n === "error" && o.length > 0 && rn(o, r), {
|
|
3006
3045
|
config: l,
|
|
3007
3046
|
diagnostics: o
|
|
3008
3047
|
};
|
|
3009
3048
|
}
|
|
3010
3049
|
//#endregion
|
|
3011
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
3012
|
-
function
|
|
3013
|
-
let e =
|
|
3050
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/defaultPersonalNeedsProfile.js
|
|
3051
|
+
function an() {
|
|
3052
|
+
let e = I(), t = /* @__PURE__ */ new Set();
|
|
3014
3053
|
for (let n of e.getAllTools()) for (let e of n.pnpSupportIds || []) t.add(e);
|
|
3015
3054
|
return [...t].sort();
|
|
3016
3055
|
}
|
|
3017
|
-
[...
|
|
3056
|
+
[...an()], Object.values({
|
|
3018
3057
|
visual: {
|
|
3019
3058
|
magnification: "magnification",
|
|
3020
3059
|
screenMagnifier: "screenMagnifier",
|
|
@@ -3129,18 +3168,19 @@ function on() {
|
|
|
3129
3168
|
}
|
|
3130
3169
|
}).flatMap((e) => Object.values(e));
|
|
3131
3170
|
//#endregion
|
|
3132
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
3133
|
-
var
|
|
3171
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/services/ToolCoordinator.js
|
|
3172
|
+
var z = fe("ToolCoordinator"), B;
|
|
3134
3173
|
(function(e) {
|
|
3135
3174
|
e[e.BASE = 0] = "BASE", e[e.TOOL = 1e3] = "TOOL", e[e.MODAL = 2e3] = "MODAL", e[e.CONTROL = 3e3] = "CONTROL", e[e.HIGHLIGHT = 4e3] = "HIGHLIGHT";
|
|
3136
|
-
})(
|
|
3137
|
-
var
|
|
3175
|
+
})(B ||= {});
|
|
3176
|
+
var on = class {
|
|
3138
3177
|
config;
|
|
3139
3178
|
tools = /* @__PURE__ */ new Map();
|
|
3140
3179
|
layerCounters = /* @__PURE__ */ new Map();
|
|
3141
3180
|
listeners = /* @__PURE__ */ new Set();
|
|
3181
|
+
visibilityState = /* @__PURE__ */ new Map();
|
|
3142
3182
|
constructor(e = {}) {
|
|
3143
|
-
this.config = e, this.layerCounters.set(
|
|
3183
|
+
this.config = e, this.layerCounters.set(B.BASE, 0), this.layerCounters.set(B.TOOL, 0), this.layerCounters.set(B.MODAL, 0), this.layerCounters.set(B.CONTROL, 0), this.layerCounters.set(B.HIGHLIGHT, 0);
|
|
3144
3184
|
}
|
|
3145
3185
|
subscribe(e) {
|
|
3146
3186
|
return this.listeners.add(e), () => {
|
|
@@ -3150,71 +3190,76 @@ var sn = class {
|
|
|
3150
3190
|
notifyListeners() {
|
|
3151
3191
|
this.listeners.forEach((e) => e());
|
|
3152
3192
|
}
|
|
3153
|
-
registerTool(e, t, n, r =
|
|
3154
|
-
if (
|
|
3193
|
+
registerTool(e, t, n, r = B.MODAL) {
|
|
3194
|
+
if (z("registerTool called:", {
|
|
3155
3195
|
id: e,
|
|
3156
3196
|
name: t,
|
|
3157
3197
|
hasElement: !!n,
|
|
3158
3198
|
layer: r
|
|
3159
3199
|
}), this.tools.has(e)) {
|
|
3160
|
-
|
|
3200
|
+
z(`Tool ${e} is already registered`);
|
|
3161
3201
|
return;
|
|
3162
3202
|
}
|
|
3203
|
+
let i = this.visibilityState.get(e) ?? !1;
|
|
3163
3204
|
if (!n) {
|
|
3164
3205
|
this.tools.set(e, {
|
|
3165
3206
|
id: e,
|
|
3166
3207
|
name: t,
|
|
3167
3208
|
element: null,
|
|
3168
3209
|
layer: r,
|
|
3169
|
-
isVisible:
|
|
3210
|
+
isVisible: i,
|
|
3170
3211
|
baseZIndex: r
|
|
3171
|
-
}),
|
|
3212
|
+
}), z("Tool registered without element:", e);
|
|
3172
3213
|
return;
|
|
3173
3214
|
}
|
|
3174
|
-
let
|
|
3175
|
-
n.style.zIndex = String(i
|
|
3176
|
-
let
|
|
3177
|
-
n.addEventListener("mousedown",
|
|
3215
|
+
let a = r + this.getNextLayerOffset(r);
|
|
3216
|
+
n.style.zIndex = String(a), n.style.display = i ? "" : "none";
|
|
3217
|
+
let o = () => this.bringToFront(n);
|
|
3218
|
+
n.addEventListener("mousedown", o), this.tools.set(e, {
|
|
3178
3219
|
id: e,
|
|
3179
3220
|
name: t,
|
|
3180
3221
|
element: n,
|
|
3181
3222
|
layer: r,
|
|
3182
|
-
isVisible:
|
|
3183
|
-
baseZIndex:
|
|
3184
|
-
mouseDownHandler:
|
|
3185
|
-
}),
|
|
3223
|
+
isVisible: i,
|
|
3224
|
+
baseZIndex: a,
|
|
3225
|
+
mouseDownHandler: o
|
|
3226
|
+
}), i && this.bringToFront(n), z("Tool registered with element:", e);
|
|
3186
3227
|
}
|
|
3187
3228
|
unregisterTool(e) {
|
|
3188
3229
|
let t = this.tools.get(e);
|
|
3189
3230
|
t && (t.element && t.mouseDownHandler && t.element.removeEventListener("mousedown", t.mouseDownHandler), this.tools.delete(e));
|
|
3190
3231
|
}
|
|
3232
|
+
releaseTool(e) {
|
|
3233
|
+
this.unregisterTool(e), this.visibilityState.delete(e);
|
|
3234
|
+
}
|
|
3191
3235
|
showTool(e) {
|
|
3192
3236
|
let t = this.tools.get(e);
|
|
3193
3237
|
if (!t) {
|
|
3194
|
-
|
|
3238
|
+
z(`Tool ${e} not found`);
|
|
3195
3239
|
return;
|
|
3196
3240
|
}
|
|
3197
|
-
t.element && (t.element.style.display = "", this.bringToFront(t.element)), t.isVisible = !0, this.notifyListeners();
|
|
3241
|
+
t.element && (t.element.style.display = "", this.bringToFront(t.element)), t.isVisible = !0, this.visibilityState.set(e, !0), this.notifyListeners();
|
|
3198
3242
|
}
|
|
3199
3243
|
hideTool(e) {
|
|
3200
3244
|
let t = this.tools.get(e);
|
|
3201
3245
|
if (!t) {
|
|
3202
|
-
|
|
3246
|
+
z(`Tool ${e} not found`);
|
|
3203
3247
|
return;
|
|
3204
3248
|
}
|
|
3205
|
-
t.element && (t.element.style.display = "none"), t.isVisible = !1, this.notifyListeners();
|
|
3249
|
+
t.element && (t.element.style.display = "none"), t.isVisible = !1, this.visibilityState.set(e, !1), this.notifyListeners();
|
|
3206
3250
|
}
|
|
3207
3251
|
toggleTool(e) {
|
|
3208
|
-
|
|
3252
|
+
z("toggleTool called for:", e);
|
|
3209
3253
|
let t = this.tools.get(e);
|
|
3210
3254
|
if (!t) {
|
|
3211
|
-
|
|
3255
|
+
z(`Tool ${e} not found. Registered tools:`, Array.from(this.tools.keys()));
|
|
3212
3256
|
return;
|
|
3213
3257
|
}
|
|
3214
|
-
|
|
3258
|
+
z("Tool found, current visibility:", t.isVisible), t.isVisible ? this.hideTool(e) : this.showTool(e);
|
|
3215
3259
|
}
|
|
3216
3260
|
isToolVisible(e) {
|
|
3217
|
-
|
|
3261
|
+
let t = this.tools.get(e);
|
|
3262
|
+
return t ? t.isVisible : this.visibilityState.get(e) ?? !1;
|
|
3218
3263
|
}
|
|
3219
3264
|
bringToFront(e) {
|
|
3220
3265
|
let t = Array.from(this.tools.values()).find((t) => t.element === e);
|
|
@@ -3243,7 +3288,7 @@ var sn = class {
|
|
|
3243
3288
|
updateToolElement(e, t) {
|
|
3244
3289
|
let n = this.tools.get(e);
|
|
3245
3290
|
if (!n) {
|
|
3246
|
-
|
|
3291
|
+
z(`Tool ${e} not found`);
|
|
3247
3292
|
return;
|
|
3248
3293
|
}
|
|
3249
3294
|
n.element && n.mouseDownHandler && n.element.removeEventListener("mousedown", n.mouseDownHandler);
|
|
@@ -3273,7 +3318,7 @@ var sn = class {
|
|
|
3273
3318
|
layer: e.layer
|
|
3274
3319
|
}));
|
|
3275
3320
|
}
|
|
3276
|
-
},
|
|
3321
|
+
}, sn = class {
|
|
3277
3322
|
listeners = /* @__PURE__ */ new Set();
|
|
3278
3323
|
subscribeFrameworkErrors(e) {
|
|
3279
3324
|
this.listeners.add(e);
|
|
@@ -3296,7 +3341,7 @@ var sn = class {
|
|
|
3296
3341
|
getListenerCount() {
|
|
3297
3342
|
return this.listeners.size;
|
|
3298
3343
|
}
|
|
3299
|
-
},
|
|
3344
|
+
}, cn = new Set([
|
|
3300
3345
|
"speak",
|
|
3301
3346
|
"p",
|
|
3302
3347
|
"s",
|
|
@@ -3305,20 +3350,20 @@ var sn = class {
|
|
|
3305
3350
|
"say-as",
|
|
3306
3351
|
"voice",
|
|
3307
3352
|
"lang"
|
|
3308
|
-
]),
|
|
3353
|
+
]), ln = new Set(["audio", "phoneme"]), un = (e) => e.replace(/"/g, "\"").replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">").replace(/ /g, "\xA0").replace(/ /g, "\xA0").replace(/&/g, "&"), V = (e, t, n) => {
|
|
3309
3354
|
for (let r = 0; r < t.length; r++) e.push({
|
|
3310
3355
|
char: t[r],
|
|
3311
3356
|
rawOffset: n === null ? null : n + r
|
|
3312
3357
|
});
|
|
3313
|
-
},
|
|
3358
|
+
}, dn = (e, t, n) => {
|
|
3314
3359
|
let r = t.slice(n).match(/^&(quot|apos|lt|gt|nbsp|amp|#160);/i);
|
|
3315
|
-
return r ? (
|
|
3316
|
-
},
|
|
3360
|
+
return r ? (V(e, un(r[0]), n), r[0].length) : 0;
|
|
3361
|
+
}, fn = (e) => {
|
|
3317
3362
|
e.push({
|
|
3318
3363
|
char: " ",
|
|
3319
3364
|
rawOffset: null
|
|
3320
3365
|
});
|
|
3321
|
-
},
|
|
3366
|
+
}, pn = (e) => {
|
|
3322
3367
|
let t = /* @__PURE__ */ new Map(), n = [], r = !0;
|
|
3323
3368
|
for (let i of e) {
|
|
3324
3369
|
if (/\s/.test(i.char)) {
|
|
@@ -3333,60 +3378,60 @@ var sn = class {
|
|
|
3333
3378
|
text: n.join(""),
|
|
3334
3379
|
rawToSpokenOffsetMap: t
|
|
3335
3380
|
};
|
|
3336
|
-
},
|
|
3381
|
+
}, mn = (e) => e.match(/^<\/?\s*([A-Za-z0-9:-]+)/)?.[1]?.toLowerCase() || "", hn = (e, t) => {
|
|
3337
3382
|
let n = RegExp(`${t}\\s*=\\s*("([^"]*)"|'([^']*)')`, "i"), r = e.match(n);
|
|
3338
|
-
return
|
|
3339
|
-
},
|
|
3383
|
+
return un(r?.[2] ?? r?.[3] ?? "") || null;
|
|
3384
|
+
}, gn = (e) => {
|
|
3340
3385
|
let t = [], n = !1, r = !1, i = 0;
|
|
3341
3386
|
for (; i < e.length;) {
|
|
3342
3387
|
let a = e[i];
|
|
3343
3388
|
if (a !== "<") {
|
|
3344
3389
|
if (a === "&") {
|
|
3345
|
-
let n =
|
|
3390
|
+
let n = dn(t, e, i);
|
|
3346
3391
|
if (n > 0) {
|
|
3347
3392
|
i += n;
|
|
3348
3393
|
continue;
|
|
3349
3394
|
}
|
|
3350
3395
|
}
|
|
3351
|
-
|
|
3396
|
+
V(t, a, i), i++;
|
|
3352
3397
|
continue;
|
|
3353
3398
|
}
|
|
3354
3399
|
let o = e.indexOf(">", i + 1);
|
|
3355
3400
|
if (o < 0) {
|
|
3356
|
-
|
|
3401
|
+
V(t, a, i), i++;
|
|
3357
3402
|
continue;
|
|
3358
3403
|
}
|
|
3359
3404
|
r = !0;
|
|
3360
|
-
let s = e.slice(i, o + 1), c =
|
|
3405
|
+
let s = e.slice(i, o + 1), c = mn(s), l = /^<\s*\//.test(s), u = /\/\s*>$/.test(s);
|
|
3361
3406
|
if (!l && c === "sub") {
|
|
3362
|
-
let r =
|
|
3407
|
+
let r = hn(s, "alias");
|
|
3363
3408
|
if (!r) {
|
|
3364
3409
|
n = !0, i = o + 1;
|
|
3365
3410
|
continue;
|
|
3366
3411
|
}
|
|
3367
|
-
|
|
3412
|
+
V(t, r, null);
|
|
3368
3413
|
let a = e.toLowerCase().indexOf("</sub>", o + 1);
|
|
3369
3414
|
i = a >= 0 ? a + 6 : o + 1;
|
|
3370
3415
|
continue;
|
|
3371
3416
|
}
|
|
3372
3417
|
if (!l && c === "break") {
|
|
3373
|
-
|
|
3418
|
+
fn(t), i = o + 1;
|
|
3374
3419
|
continue;
|
|
3375
3420
|
}
|
|
3376
|
-
if (!l &&
|
|
3421
|
+
if (!l && ln.has(c) && (n = !0, u)) {
|
|
3377
3422
|
i = o + 1;
|
|
3378
3423
|
continue;
|
|
3379
3424
|
}
|
|
3380
|
-
c && !
|
|
3425
|
+
c && !cn.has(c) && !ln.has(c) && c !== "break" && c !== "sub" && (n = !0), !l && (c === "p" || c === "s") && fn(t), i = o + 1;
|
|
3381
3426
|
}
|
|
3382
|
-
let a =
|
|
3427
|
+
let a = pn(t);
|
|
3383
3428
|
return {
|
|
3384
3429
|
spokenText: D(a.text),
|
|
3385
3430
|
rawToSpokenOffsetMap: a.rawToSpokenOffsetMap,
|
|
3386
3431
|
unsupportedSemantic: n,
|
|
3387
3432
|
hasMarkup: r
|
|
3388
3433
|
};
|
|
3389
|
-
},
|
|
3434
|
+
}, _n = rt(), vn = new Map([
|
|
3390
3435
|
["zero", "0"],
|
|
3391
3436
|
["one", "1"],
|
|
3392
3437
|
["two", "2"],
|
|
@@ -3398,7 +3443,7 @@ var sn = class {
|
|
|
3398
3443
|
["eight", "8"],
|
|
3399
3444
|
["nine", "9"],
|
|
3400
3445
|
["ten", "10"]
|
|
3401
|
-
]),
|
|
3446
|
+
]), yn = [
|
|
3402
3447
|
{
|
|
3403
3448
|
phrase: [
|
|
3404
3449
|
"plus",
|
|
@@ -3473,9 +3518,9 @@ var sn = class {
|
|
|
3473
3518
|
visible: "+",
|
|
3474
3519
|
score: 5
|
|
3475
3520
|
}
|
|
3476
|
-
],
|
|
3521
|
+
], bn = (e) => {
|
|
3477
3522
|
let t = [];
|
|
3478
|
-
for (let n of e.matchAll(
|
|
3523
|
+
for (let n of e.matchAll(_n)) {
|
|
3479
3524
|
let e = n[0], r = n.index ?? 0;
|
|
3480
3525
|
t.push({
|
|
3481
3526
|
text: e,
|
|
@@ -3485,16 +3530,16 @@ var sn = class {
|
|
|
3485
3530
|
});
|
|
3486
3531
|
}
|
|
3487
3532
|
return t;
|
|
3488
|
-
},
|
|
3533
|
+
}, xn = (e) => vn.get(e.normalized) || e.normalized, Sn = (e, t) => {
|
|
3489
3534
|
let n = [];
|
|
3490
3535
|
for (let r = 0; r < e.length; r++) {
|
|
3491
|
-
for (let i = 0; i < t.length; i++)
|
|
3536
|
+
for (let i = 0; i < t.length; i++) xn(e[r]) === xn(t[i]) && n.push({
|
|
3492
3537
|
spokenStartToken: r,
|
|
3493
3538
|
spokenEndToken: r + 1,
|
|
3494
3539
|
visibleToken: i,
|
|
3495
3540
|
score: 10
|
|
3496
3541
|
});
|
|
3497
|
-
for (let i of
|
|
3542
|
+
for (let i of yn) {
|
|
3498
3543
|
let a = e.slice(r, r + i.phrase.length);
|
|
3499
3544
|
if (a.length === i.phrase.length && a.every((e, t) => e.normalized === i.phrase[t])) for (let e = 0; e < t.length; e++) t[e].normalized === i.visible && n.push({
|
|
3500
3545
|
spokenStartToken: r,
|
|
@@ -3505,8 +3550,8 @@ var sn = class {
|
|
|
3505
3550
|
}
|
|
3506
3551
|
}
|
|
3507
3552
|
return n;
|
|
3508
|
-
},
|
|
3509
|
-
let n =
|
|
3553
|
+
}, Cn = (e, t) => {
|
|
3554
|
+
let n = Sn(e, t).sort((n, r) => e[n.spokenStartToken].start - e[r.spokenStartToken].start || t[n.visibleToken].start - t[r.visibleToken].start), r = Array(n.length).fill(0), i = Array(n.length).fill(-1);
|
|
3510
3555
|
for (let e = 0; e < n.length; e++) {
|
|
3511
3556
|
let t = n[e];
|
|
3512
3557
|
r[e] = t.score;
|
|
@@ -3533,12 +3578,12 @@ var sn = class {
|
|
|
3533
3578
|
score: n.score
|
|
3534
3579
|
};
|
|
3535
3580
|
});
|
|
3536
|
-
},
|
|
3581
|
+
}, wn = (e, t, n) => {
|
|
3537
3582
|
if (e.length === 0) return 0;
|
|
3538
3583
|
let r = e.length / Math.max(1, Math.min(t.length, n.length)), i = e.reduce((e, t) => e + t.score, 0) / e.length / 10;
|
|
3539
3584
|
return Math.min(1, r * i);
|
|
3540
|
-
},
|
|
3541
|
-
let t =
|
|
3585
|
+
}, Tn = (e) => {
|
|
3586
|
+
let t = gn(e.speechText), n = D(e.visibleText), r = t.spokenText, i = bn(r), a = bn(n), o = t.unsupportedSemantic ? [] : Cn(i, a), s = wn(o, i, a), c = r === n && r.length > 0, l = o.length === 1 && o[0].score === 10 && i.length <= 2 && a.length <= 2, u = t.unsupportedSemantic ? "region-fallback" : c ? "exact-word" : (o.length >= 2 || l) && s >= .12 ? "anchor-span" : "region-fallback", d = t.unsupportedSemantic ? "unsupported" : t.hasMarkup ? "raw-ssml" : "plain-spoken-text";
|
|
3542
3587
|
return {
|
|
3543
3588
|
speechText: e.speechText,
|
|
3544
3589
|
spokenText: r,
|
|
@@ -3551,16 +3596,16 @@ var sn = class {
|
|
|
3551
3596
|
visibleTokens: a,
|
|
3552
3597
|
rawToSpokenOffsetMap: t.rawToSpokenOffsetMap
|
|
3553
3598
|
};
|
|
3554
|
-
},
|
|
3599
|
+
}, En = (e, t) => e.find((e) => e.start <= t && t < e.end) || null, Dn = (e) => {
|
|
3555
3600
|
if (!e || /^<[^>]+>$/.test(e.trim())) return null;
|
|
3556
|
-
let t =
|
|
3557
|
-
return t ?
|
|
3558
|
-
},
|
|
3559
|
-
let r =
|
|
3601
|
+
let t = bn(e)[0];
|
|
3602
|
+
return t ? vn.get(t.normalized) || t.normalized : null;
|
|
3603
|
+
}, On = (e, t, n) => {
|
|
3604
|
+
let r = Dn(n);
|
|
3560
3605
|
if (!t || !r) return !1;
|
|
3561
|
-
let i =
|
|
3562
|
-
return i ?
|
|
3563
|
-
},
|
|
3606
|
+
let i = En(e.spokenTokens, t.start);
|
|
3607
|
+
return i ? xn(i) === r : !1;
|
|
3608
|
+
}, kn = (e, t) => {
|
|
3564
3609
|
let n = e.rawToSpokenOffsetMap.get(t);
|
|
3565
3610
|
if (n !== void 0) return n;
|
|
3566
3611
|
for (let n = t; n < e.speechText.length; n++) {
|
|
@@ -3569,36 +3614,36 @@ var sn = class {
|
|
|
3569
3614
|
if (e.speechText[n] === ">") break;
|
|
3570
3615
|
}
|
|
3571
3616
|
return null;
|
|
3572
|
-
},
|
|
3573
|
-
let r =
|
|
3617
|
+
}, An = (e, t, n) => {
|
|
3618
|
+
let r = kn(e, t);
|
|
3574
3619
|
if (r === null) return null;
|
|
3575
|
-
let i =
|
|
3620
|
+
let i = kn(e, Math.max(t, t + n - 1)), a = En(e.spokenTokens, r), o = i !== null && i >= r ? i - r + 1 : a ? a.end - r : n;
|
|
3576
3621
|
return {
|
|
3577
3622
|
start: r,
|
|
3578
3623
|
length: Math.max(1, o)
|
|
3579
3624
|
};
|
|
3580
|
-
},
|
|
3625
|
+
}, jn = (e, t, n) => {
|
|
3581
3626
|
if (t < 0 || t >= e.spokenText.length) return null;
|
|
3582
|
-
let r =
|
|
3627
|
+
let r = En(e.spokenTokens, t);
|
|
3583
3628
|
return r ? {
|
|
3584
3629
|
start: t,
|
|
3585
3630
|
length: Math.min(n, r.end - t)
|
|
3586
3631
|
} : null;
|
|
3587
|
-
},
|
|
3632
|
+
}, Mn = (e, t, n = 1, r) => {
|
|
3588
3633
|
if (e.boundaryOffsetMode === "unsupported" || !Number.isFinite(t)) return null;
|
|
3589
3634
|
let i = Math.max(1, Number.isFinite(n) ? n : 1);
|
|
3590
3635
|
if (r && /^<[^>]+>$/.test(r.trim())) return null;
|
|
3591
3636
|
if (e.boundaryOffsetMode === "raw-ssml") {
|
|
3592
|
-
let n =
|
|
3637
|
+
let n = An(e, t, i), a = jn(e, t, i);
|
|
3593
3638
|
if (r) {
|
|
3594
|
-
if (
|
|
3595
|
-
if (
|
|
3596
|
-
if (
|
|
3639
|
+
if (On(e, n, r)) return n;
|
|
3640
|
+
if (On(e, a, r)) return a;
|
|
3641
|
+
if (Dn(r)) return null;
|
|
3597
3642
|
}
|
|
3598
3643
|
return n || a;
|
|
3599
3644
|
}
|
|
3600
|
-
return
|
|
3601
|
-
},
|
|
3645
|
+
return jn(e, t, i) || An(e, t, i);
|
|
3646
|
+
}, Nn = (e, t) => {
|
|
3602
3647
|
if (e.playbackMode === "region-fallback") return null;
|
|
3603
3648
|
let n = e.anchors.find((e) => e.spokenStart <= t && t < e.spokenEnd);
|
|
3604
3649
|
if (n) return {
|
|
@@ -3620,7 +3665,7 @@ var sn = class {
|
|
|
3620
3665
|
start: Math.min(r.visibleStart, i.visibleStart),
|
|
3621
3666
|
end: Math.max(r.visibleEnd, i.visibleEnd)
|
|
3622
3667
|
} : null;
|
|
3623
|
-
},
|
|
3668
|
+
}, Pn = new Map([
|
|
3624
3669
|
["+", ["plus"]],
|
|
3625
3670
|
["-", ["minus", "negative"]],
|
|
3626
3671
|
["−", ["minus", "negative"]],
|
|
@@ -3644,12 +3689,12 @@ var sn = class {
|
|
|
3644
3689
|
["•", ["times"]],
|
|
3645
3690
|
["·", ["times"]],
|
|
3646
3691
|
["", ["times", "multiplied by"]]
|
|
3647
|
-
]),
|
|
3692
|
+
]), Fn = new Map([
|
|
3648
3693
|
["", "function-application"],
|
|
3649
3694
|
["", "implicit-multiply"],
|
|
3650
3695
|
["", "invisible-separator"],
|
|
3651
3696
|
["", "invisible-plus"]
|
|
3652
|
-
]),
|
|
3697
|
+
]), In = new Map([["2", ["squared"]], ["3", ["cubed"]]]), Ln = new Map([
|
|
3653
3698
|
["msqrt", "radical"],
|
|
3654
3699
|
["mroot", "radical"],
|
|
3655
3700
|
["msub", "subscript"],
|
|
@@ -3659,11 +3704,11 @@ var sn = class {
|
|
|
3659
3704
|
["munderover", "underoverscript"],
|
|
3660
3705
|
["mmultiscripts", "multiscript"],
|
|
3661
3706
|
["menclose", "enclosure"]
|
|
3662
|
-
]),
|
|
3707
|
+
]), Rn = (e) => e.replace(/\s+/g, " ").trim(), H = (e) => (e.localName || e.tagName || "").toLowerCase(), zn = (e) => e.nodeType === Node.ELEMENT_NODE, U = (e) => Array.from(e.childNodes).filter(zn), Bn = (e) => Rn(e.textContent || ""), W = (e, t) => ({
|
|
3663
3708
|
type: "element-range",
|
|
3664
3709
|
quality: t,
|
|
3665
3710
|
element: e
|
|
3666
|
-
}),
|
|
3711
|
+
}), Vn = (e) => {
|
|
3667
3712
|
switch (e) {
|
|
3668
3713
|
case "mi": return "identifier";
|
|
3669
3714
|
case "mn": return "number";
|
|
@@ -3673,62 +3718,62 @@ var sn = class {
|
|
|
3673
3718
|
case "mspace": return "space";
|
|
3674
3719
|
default: return "unknown";
|
|
3675
3720
|
}
|
|
3676
|
-
},
|
|
3677
|
-
let t = e.normalized ??
|
|
3721
|
+
}, Hn = (e, t) => t === "operator" ? e === "−" ? "-" : e : e.toLowerCase(), Un = (e, t, n) => n === "fraction" ? ["over", "divided by"] : n === "superscript" ? In.get(e) ?? [] : e === "|" ? ["absolute value"] : t === "operator" && Pn.get(e) || [], G = (e) => {
|
|
3722
|
+
let t = e.normalized ?? Hn(e.text, e.kind || "unknown");
|
|
3678
3723
|
return {
|
|
3679
3724
|
id: `math-token-${e.state.nextId++}`,
|
|
3680
3725
|
kind: e.kind,
|
|
3681
3726
|
role: e.role,
|
|
3682
3727
|
text: e.text,
|
|
3683
3728
|
normalized: t,
|
|
3684
|
-
spokenAliases:
|
|
3729
|
+
spokenAliases: Un(e.text, e.kind, e.role),
|
|
3685
3730
|
sourceElement: e.sourceElement,
|
|
3686
3731
|
path: e.path,
|
|
3687
|
-
target: e.target ||
|
|
3732
|
+
target: e.target || W(e.sourceElement, "element-range"),
|
|
3688
3733
|
optional: e.optional
|
|
3689
3734
|
};
|
|
3690
|
-
},
|
|
3735
|
+
}, K = (e, t, n = "tokens") => {
|
|
3691
3736
|
e[n].push(t);
|
|
3737
|
+
}, Wn = (e, t, n) => {
|
|
3738
|
+
U(e).forEach((e, r) => q(e, t, `${n}/${H(e)}[${r}]`));
|
|
3692
3739
|
}, Gn = (e, t, n) => {
|
|
3693
|
-
|
|
3694
|
-
|
|
3695
|
-
let r = W(e);
|
|
3696
|
-
r[0] && J(r[0], t, `${n}/numerator`), q(t, K({
|
|
3740
|
+
let r = U(e);
|
|
3741
|
+
r[0] && q(r[0], t, `${n}/numerator`), K(t, G({
|
|
3697
3742
|
state: t,
|
|
3698
3743
|
kind: "structure",
|
|
3699
3744
|
role: "fraction",
|
|
3700
3745
|
text: "/",
|
|
3701
3746
|
sourceElement: e,
|
|
3702
3747
|
path: n,
|
|
3703
|
-
target:
|
|
3704
|
-
})), r[1] &&
|
|
3705
|
-
},
|
|
3748
|
+
target: W(e, "element-range")
|
|
3749
|
+
})), r[1] && q(r[1], t, `${n}/denominator`);
|
|
3750
|
+
}, Kn = (e, t, n) => {
|
|
3706
3751
|
let r = e.getAttribute("open") || "(", i = e.getAttribute("close") || ")";
|
|
3707
|
-
|
|
3752
|
+
K(t, G({
|
|
3708
3753
|
state: t,
|
|
3709
3754
|
kind: "operator",
|
|
3710
3755
|
role: r === "|" ? "absolute-value-fence" : "open-fence",
|
|
3711
3756
|
text: r,
|
|
3712
3757
|
sourceElement: e,
|
|
3713
3758
|
path: `${n}/open`,
|
|
3714
|
-
target:
|
|
3715
|
-
})),
|
|
3759
|
+
target: W(e, "element-range")
|
|
3760
|
+
})), Wn(e, t, n), K(t, G({
|
|
3716
3761
|
state: t,
|
|
3717
3762
|
kind: "operator",
|
|
3718
3763
|
role: i === "|" ? "absolute-value-fence" : "close-fence",
|
|
3719
3764
|
text: i,
|
|
3720
3765
|
sourceElement: e,
|
|
3721
3766
|
path: `${n}/close`,
|
|
3722
|
-
target:
|
|
3767
|
+
target: W(e, "element-range")
|
|
3723
3768
|
}));
|
|
3724
|
-
},
|
|
3725
|
-
let r =
|
|
3726
|
-
r[0] &&
|
|
3769
|
+
}, qn = (e, t, n) => {
|
|
3770
|
+
let r = U(e);
|
|
3771
|
+
r[0] && q(r[0], t, `${n}/base`);
|
|
3727
3772
|
let i = r[1];
|
|
3728
3773
|
if (!i) return;
|
|
3729
|
-
let a =
|
|
3730
|
-
if (
|
|
3731
|
-
|
|
3774
|
+
let a = Bn(i);
|
|
3775
|
+
if (In.has(a)) {
|
|
3776
|
+
K(t, G({
|
|
3732
3777
|
state: t,
|
|
3733
3778
|
kind: "structure",
|
|
3734
3779
|
role: "superscript",
|
|
@@ -3736,25 +3781,25 @@ var sn = class {
|
|
|
3736
3781
|
normalized: a,
|
|
3737
3782
|
sourceElement: i,
|
|
3738
3783
|
path: `${n}/exponent`,
|
|
3739
|
-
target:
|
|
3784
|
+
target: W(e, "element-range")
|
|
3740
3785
|
}));
|
|
3741
3786
|
return;
|
|
3742
3787
|
}
|
|
3743
|
-
|
|
3744
|
-
},
|
|
3745
|
-
|
|
3788
|
+
q(i, t, `${n}/exponent`);
|
|
3789
|
+
}, Jn = (e, t, n, r) => {
|
|
3790
|
+
K(t, G({
|
|
3746
3791
|
state: t,
|
|
3747
3792
|
kind: "structure",
|
|
3748
3793
|
role: r,
|
|
3749
|
-
text:
|
|
3794
|
+
text: Bn(e) || r,
|
|
3750
3795
|
normalized: `\u0000${r}`,
|
|
3751
3796
|
sourceElement: e,
|
|
3752
3797
|
path: n,
|
|
3753
|
-
target:
|
|
3798
|
+
target: W(e, "element-range")
|
|
3754
3799
|
}));
|
|
3755
|
-
},
|
|
3800
|
+
}, Yn = (e, t, n) => {
|
|
3756
3801
|
let r = 0;
|
|
3757
|
-
for (let i of
|
|
3802
|
+
for (let i of U(e)) (H(i) === "mtr" || H(i) === "mlabeledtr") && (r++, K(t, G({
|
|
3758
3803
|
state: t,
|
|
3759
3804
|
kind: "layout",
|
|
3760
3805
|
role: "table-row",
|
|
@@ -3762,33 +3807,33 @@ var sn = class {
|
|
|
3762
3807
|
normalized: `row-${r}`,
|
|
3763
3808
|
sourceElement: i,
|
|
3764
3809
|
path: `${n}/row[${r}]`,
|
|
3765
|
-
target:
|
|
3766
|
-
}), "layoutTargets")),
|
|
3767
|
-
},
|
|
3768
|
-
let r =
|
|
3810
|
+
target: W(i, "region-fallback")
|
|
3811
|
+
}), "layoutTargets")), q(i, t, `${n}/${H(i)}[${r}]`);
|
|
3812
|
+
}, Xn = (e, t, n) => {
|
|
3813
|
+
let r = Bn(e);
|
|
3769
3814
|
if (!r) return;
|
|
3770
|
-
let i =
|
|
3771
|
-
|
|
3815
|
+
let i = Vn(H(e)), a = i === "operator" ? Fn.get(r) : void 0, o = a ?? (i === "operator" && (r === "(" || r === ")") ? "grouping-fence" : i);
|
|
3816
|
+
K(t, G({
|
|
3772
3817
|
state: t,
|
|
3773
3818
|
kind: i,
|
|
3774
3819
|
role: o,
|
|
3775
3820
|
text: r,
|
|
3776
3821
|
sourceElement: e,
|
|
3777
3822
|
path: n,
|
|
3778
|
-
target: a && e.parentElement ?
|
|
3823
|
+
target: a && e.parentElement ? W(e.parentElement, "region-fallback") : void 0,
|
|
3779
3824
|
optional: !!a || o === "grouping-fence"
|
|
3780
3825
|
}));
|
|
3781
|
-
},
|
|
3782
|
-
let r =
|
|
3826
|
+
}, q = (e, t, n) => {
|
|
3827
|
+
let r = H(e);
|
|
3783
3828
|
switch (r) {
|
|
3784
3829
|
case "annotation":
|
|
3785
3830
|
case "annotation-xml": return;
|
|
3786
3831
|
case "semantics": {
|
|
3787
|
-
let r =
|
|
3788
|
-
let t =
|
|
3832
|
+
let r = U(e).find((e) => {
|
|
3833
|
+
let t = H(e);
|
|
3789
3834
|
return t !== "annotation" && t !== "annotation-xml";
|
|
3790
3835
|
});
|
|
3791
|
-
r &&
|
|
3836
|
+
r && q(r, t, `${n}/presentation`);
|
|
3792
3837
|
return;
|
|
3793
3838
|
}
|
|
3794
3839
|
case "mi":
|
|
@@ -3797,47 +3842,47 @@ var sn = class {
|
|
|
3797
3842
|
case "mtext":
|
|
3798
3843
|
case "ms":
|
|
3799
3844
|
case "mspace":
|
|
3800
|
-
|
|
3845
|
+
Xn(e, t, n);
|
|
3801
3846
|
return;
|
|
3802
3847
|
case "mfrac":
|
|
3803
|
-
|
|
3848
|
+
Gn(e, t, n);
|
|
3804
3849
|
return;
|
|
3805
3850
|
case "msup":
|
|
3806
|
-
|
|
3851
|
+
qn(e, t, n);
|
|
3807
3852
|
return;
|
|
3808
3853
|
case "mfenced":
|
|
3809
|
-
|
|
3854
|
+
Kn(e, t, n);
|
|
3810
3855
|
return;
|
|
3811
3856
|
case "mtable":
|
|
3812
|
-
|
|
3857
|
+
Yn(e, t, n);
|
|
3813
3858
|
return;
|
|
3814
3859
|
case "mphantom": return;
|
|
3815
3860
|
case "maction": {
|
|
3816
|
-
let r =
|
|
3817
|
-
r &&
|
|
3861
|
+
let r = U(e)[0];
|
|
3862
|
+
r && q(r, t, `${n}/action`);
|
|
3818
3863
|
return;
|
|
3819
3864
|
}
|
|
3820
3865
|
default: {
|
|
3821
|
-
let i =
|
|
3866
|
+
let i = Ln.get(r);
|
|
3822
3867
|
if (i) {
|
|
3823
|
-
|
|
3868
|
+
Jn(e, t, n, i);
|
|
3824
3869
|
return;
|
|
3825
3870
|
}
|
|
3826
|
-
|
|
3871
|
+
Wn(e, t, n);
|
|
3827
3872
|
}
|
|
3828
3873
|
}
|
|
3829
|
-
},
|
|
3874
|
+
}, Zn = (e) => {
|
|
3830
3875
|
let t = {
|
|
3831
3876
|
tokens: [],
|
|
3832
3877
|
layoutTargets: [],
|
|
3833
3878
|
nextId: 0
|
|
3834
3879
|
};
|
|
3835
|
-
return
|
|
3880
|
+
return q(e, t, "/math"), {
|
|
3836
3881
|
tokens: t.tokens,
|
|
3837
3882
|
layoutTargets: t.layoutTargets,
|
|
3838
|
-
expressionTarget:
|
|
3883
|
+
expressionTarget: W(e, "region-fallback")
|
|
3839
3884
|
};
|
|
3840
|
-
},
|
|
3885
|
+
}, Qn = (e) => e.boundary && e.alignment.segments.find((t) => t.speechTokenIds.includes(e.boundary.token.id))?.target || null, $n = .95, er = (e) => {
|
|
3841
3886
|
let t = [], n = /* @__PURE__ */ new Set(), r = (e) => {
|
|
3842
3887
|
let r = e.toLowerCase().trim().split(/\s+/).filter(Boolean);
|
|
3843
3888
|
if (r.length === 0) return;
|
|
@@ -3847,7 +3892,7 @@ var sn = class {
|
|
|
3847
3892
|
r(e.normalized);
|
|
3848
3893
|
for (let t of e.spokenAliases) r(t);
|
|
3849
3894
|
return t;
|
|
3850
|
-
},
|
|
3895
|
+
}, tr = (e, t, n) => {
|
|
3851
3896
|
let r = 0;
|
|
3852
3897
|
for (let i of n) {
|
|
3853
3898
|
if (i.length <= r) continue;
|
|
@@ -3862,12 +3907,12 @@ var sn = class {
|
|
|
3862
3907
|
n && (r = i.length);
|
|
3863
3908
|
}
|
|
3864
3909
|
return r;
|
|
3865
|
-
},
|
|
3910
|
+
}, nr = (e, t) => {
|
|
3866
3911
|
let n = [], r = 0;
|
|
3867
3912
|
for (let i of t) {
|
|
3868
|
-
let t =
|
|
3913
|
+
let t = er(i);
|
|
3869
3914
|
if (i.optional) {
|
|
3870
|
-
let a =
|
|
3915
|
+
let a = tr(e, r, t);
|
|
3871
3916
|
a > 0 && (n.push({
|
|
3872
3917
|
speechTokens: e.slice(r, r + a),
|
|
3873
3918
|
math: i
|
|
@@ -3875,7 +3920,7 @@ var sn = class {
|
|
|
3875
3920
|
continue;
|
|
3876
3921
|
}
|
|
3877
3922
|
for (; r < e.length;) {
|
|
3878
|
-
let a =
|
|
3923
|
+
let a = tr(e, r, t);
|
|
3879
3924
|
if (a > 0) {
|
|
3880
3925
|
n.push({
|
|
3881
3926
|
speechTokens: e.slice(r, r + a),
|
|
@@ -3887,23 +3932,23 @@ var sn = class {
|
|
|
3887
3932
|
}
|
|
3888
3933
|
}
|
|
3889
3934
|
return n;
|
|
3890
|
-
},
|
|
3935
|
+
}, rr = (e, t, n) => {
|
|
3891
3936
|
let r = n.filter((e) => !e.optional).length, i = e.filter((e) => !e.math.optional).length, a = e.reduce((e, t) => e + t.speechTokens.length, 0);
|
|
3892
3937
|
return r > 0 && i === r && a === t.length;
|
|
3893
|
-
},
|
|
3938
|
+
}, ir = (e) => e.map(({ speechTokens: e, math: t }) => ({
|
|
3894
3939
|
speechTokenIds: e.map((e) => e.id),
|
|
3895
3940
|
mathTokenIds: [t.id],
|
|
3896
3941
|
score: 1,
|
|
3897
3942
|
confidence: 1,
|
|
3898
3943
|
target: t.target
|
|
3899
|
-
})),
|
|
3900
|
-
let t = e.minExactWordConfidence ??
|
|
3944
|
+
})), ar = (e) => {
|
|
3945
|
+
let t = e.minExactWordConfidence ?? $n, n = nr(e.speech.tokens, e.math.tokens), r = +!!rr(n, e.speech.tokens, e.math.tokens);
|
|
3901
3946
|
return {
|
|
3902
|
-
segments: r >= t ?
|
|
3947
|
+
segments: r >= t ? ir(n) : [],
|
|
3903
3948
|
confidence: r,
|
|
3904
3949
|
fallbackTarget: e.math.expressionTarget
|
|
3905
3950
|
};
|
|
3906
|
-
},
|
|
3951
|
+
}, or = rt(), sr = new Map([
|
|
3907
3952
|
["zero", "0"],
|
|
3908
3953
|
["one", "1"],
|
|
3909
3954
|
["two", "2"],
|
|
@@ -3915,17 +3960,17 @@ var sn = class {
|
|
|
3915
3960
|
["eight", "8"],
|
|
3916
3961
|
["nine", "9"],
|
|
3917
3962
|
["ten", "10"]
|
|
3918
|
-
]),
|
|
3963
|
+
]), cr = (e) => {
|
|
3919
3964
|
let t = e.toLowerCase();
|
|
3920
|
-
return
|
|
3921
|
-
},
|
|
3965
|
+
return sr.get(t) || t;
|
|
3966
|
+
}, lr = (e) => {
|
|
3922
3967
|
let t = [];
|
|
3923
|
-
for (let n of e.matchAll(
|
|
3968
|
+
for (let n of e.matchAll(or)) {
|
|
3924
3969
|
let e = n[0], r = n.index ?? 0;
|
|
3925
3970
|
t.push({
|
|
3926
3971
|
id: `speech-token-${t.length}`,
|
|
3927
3972
|
text: e,
|
|
3928
|
-
normalized:
|
|
3973
|
+
normalized: cr(e),
|
|
3929
3974
|
start: r,
|
|
3930
3975
|
end: r + e.length,
|
|
3931
3976
|
sourceStart: r,
|
|
@@ -3934,22 +3979,22 @@ var sn = class {
|
|
|
3934
3979
|
});
|
|
3935
3980
|
}
|
|
3936
3981
|
return t;
|
|
3937
|
-
},
|
|
3938
|
-
let t =
|
|
3982
|
+
}, J = (e) => {
|
|
3983
|
+
let t = gn(e.speechText);
|
|
3939
3984
|
return {
|
|
3940
3985
|
speechText: e.speechText,
|
|
3941
3986
|
spokenText: t.spokenText,
|
|
3942
|
-
tokens:
|
|
3987
|
+
tokens: lr(t.spokenText),
|
|
3943
3988
|
rawToSpokenOffsetMap: t.rawToSpokenOffsetMap,
|
|
3944
3989
|
boundaryOffsetSpace: t.unsupportedSemantic ? "unsupported" : t.hasMarkup ? "raw-ssml" : "plain-spoken-text",
|
|
3945
3990
|
unsupportedSemantic: t.unsupportedSemantic,
|
|
3946
3991
|
hasMarkup: t.hasMarkup
|
|
3947
3992
|
};
|
|
3948
|
-
},
|
|
3993
|
+
}, ur = (e) => {
|
|
3949
3994
|
if (!e || /^<[^>]+>$/.test(e.trim())) return null;
|
|
3950
|
-
let t = e.match(
|
|
3951
|
-
return t?.[0] ?
|
|
3952
|
-
},
|
|
3995
|
+
let t = e.match(or);
|
|
3996
|
+
return t?.[0] ? cr(t[0]) : null;
|
|
3997
|
+
}, dr = (e, t) => e.find((e) => e.start <= t && t < e.end) || null, fr = (e, t) => {
|
|
3953
3998
|
let n = e.rawToSpokenOffsetMap.get(t);
|
|
3954
3999
|
if (n !== void 0) return n;
|
|
3955
4000
|
for (let n = t; n < e.speechText.length; n++) {
|
|
@@ -3958,103 +4003,103 @@ var sn = class {
|
|
|
3958
4003
|
if (e.speechText[n] === ">") break;
|
|
3959
4004
|
}
|
|
3960
4005
|
return null;
|
|
3961
|
-
},
|
|
4006
|
+
}, pr = (e, t, n) => {
|
|
3962
4007
|
if (t === null) return null;
|
|
3963
|
-
let r =
|
|
4008
|
+
let r = dr(e.tokens, t);
|
|
3964
4009
|
return r ? {
|
|
3965
4010
|
token: r,
|
|
3966
4011
|
start: t,
|
|
3967
4012
|
length: Math.max(1, Math.min(n, r.end - t)),
|
|
3968
4013
|
confidence: .75
|
|
3969
4014
|
} : null;
|
|
3970
|
-
},
|
|
3971
|
-
let n =
|
|
4015
|
+
}, mr = (e, t) => {
|
|
4016
|
+
let n = ur(t);
|
|
3972
4017
|
return !!(e && n && e.token.normalized === n);
|
|
3973
|
-
},
|
|
4018
|
+
}, hr = (e) => {
|
|
3974
4019
|
if (e.tokenization.boundaryOffsetSpace === "unsupported" || !Number.isFinite(e.position) || e.boundaryWord && /^<[^>]+>$/.test(e.boundaryWord.trim())) return null;
|
|
3975
|
-
let t = Math.max(1, Number.isFinite(e.length) ? e.length : 1), n =
|
|
3976
|
-
return
|
|
4020
|
+
let t = Math.max(1, Number.isFinite(e.length) ? e.length : 1), n = pr(e.tokenization, fr(e.tokenization, e.position), t), r = pr(e.tokenization, e.position >= 0 && e.position < e.tokenization.spokenText.length ? e.position : null, t);
|
|
4021
|
+
return mr(n, e.boundaryWord) ? {
|
|
3977
4022
|
...n,
|
|
3978
4023
|
confidence: 1
|
|
3979
|
-
} :
|
|
4024
|
+
} : mr(r, e.boundaryWord) ? {
|
|
3980
4025
|
...r,
|
|
3981
4026
|
confidence: 1
|
|
3982
|
-
} : e.boundaryWord &&
|
|
3983
|
-
},
|
|
4027
|
+
} : e.boundaryWord && ur(e.boundaryWord) ? null : e.tokenization.boundaryOffsetSpace === "raw-ssml" ? n || r : r || n;
|
|
4028
|
+
}, gr = (e) => {
|
|
3984
4029
|
if (e.tokenization.boundaryOffsetSpace === "unsupported" || !Number.isFinite(e.position) || e.boundaryWord && /^<[^>]+>$/.test(e.boundaryWord.trim())) return null;
|
|
3985
|
-
let t = Math.max(1, Number.isFinite(e.length) ? e.length : 1), n =
|
|
3986
|
-
return
|
|
4030
|
+
let t = Math.max(1, Number.isFinite(e.length) ? e.length : 1), n = pr(e.tokenization, e.position >= 0 && e.position < e.tokenization.spokenText.length ? e.position : null, t);
|
|
4031
|
+
return mr(n, e.boundaryWord) ? {
|
|
3987
4032
|
...n,
|
|
3988
4033
|
confidence: 1
|
|
3989
|
-
} : e.boundaryWord &&
|
|
3990
|
-
},
|
|
3991
|
-
let t =
|
|
4034
|
+
} : e.boundaryWord && ur(e.boundaryWord) ? null : n;
|
|
4035
|
+
}, Y = (e) => {
|
|
4036
|
+
let t = J({ speechText: e.speechText }), n = Zn(e.mathElement);
|
|
3992
4037
|
return {
|
|
3993
4038
|
speech: t,
|
|
3994
4039
|
math: n,
|
|
3995
|
-
result:
|
|
4040
|
+
result: ar({
|
|
3996
4041
|
speech: t,
|
|
3997
4042
|
math: n
|
|
3998
4043
|
})
|
|
3999
4044
|
};
|
|
4000
|
-
},
|
|
4001
|
-
let n =
|
|
4045
|
+
}, _r = (e, t) => {
|
|
4046
|
+
let n = gr({
|
|
4002
4047
|
tokenization: e.speech,
|
|
4003
4048
|
position: t.position,
|
|
4004
4049
|
length: t.length,
|
|
4005
4050
|
boundaryWord: t.boundaryWord
|
|
4006
4051
|
});
|
|
4007
|
-
return
|
|
4052
|
+
return Qn({
|
|
4008
4053
|
alignment: e.result,
|
|
4009
4054
|
boundary: n
|
|
4010
4055
|
});
|
|
4011
|
-
},
|
|
4056
|
+
}, vr = (e, t) => {
|
|
4012
4057
|
if (!t.boundaryWord || /^<[^>]+>$/.test(t.boundaryWord.trim())) return null;
|
|
4013
|
-
let n =
|
|
4058
|
+
let n = J({ speechText: t.boundaryWord }).tokens[0];
|
|
4014
4059
|
if (!n) return null;
|
|
4015
4060
|
let r = e.math.tokens.filter((e) => {
|
|
4016
4061
|
let t = n.normalized.toLowerCase();
|
|
4017
4062
|
return e.normalized.toLowerCase() === t || e.spokenAliases.some((e) => e.toLowerCase() === t);
|
|
4018
4063
|
});
|
|
4019
4064
|
return r.length === 1 ? r[0].target : null;
|
|
4020
|
-
},
|
|
4065
|
+
}, yr = "http://www.w3.org/1998/Math/MathML", br = new Set(/* @__PURE__ */ "math.maction.menclose.merror.mfenced.mfrac.mi.mmultiscripts.mn.mo.mover.mpadded.mphantom.mprescripts.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msubsup.msup.mtable.mtd.mtext.mtr.munder.munderover.none.semantics.annotation.annotation-xml".split(".")), xr = new Set(/* @__PURE__ */ "accent.accentunder.align.bevelled.class.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.encoding.fence.height.href.id.largeop.length.linethickness.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.width.xmlns.xml:lang".split(".")), Sr = (e) => e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">"), Cr = (e) => Sr(e).replace(/"/g, """), wr = (e, t) => {
|
|
4021
4066
|
let n = e.toLowerCase(), r = t.trim().toLowerCase();
|
|
4022
|
-
return !!(n.startsWith("on") || !
|
|
4023
|
-
},
|
|
4067
|
+
return !!(n.startsWith("on") || !xr.has(n) || r.includes("javascript:") || r.includes("data:text/html"));
|
|
4068
|
+
}, Tr = (e) => {
|
|
4024
4069
|
let t = e.localName.toLowerCase();
|
|
4025
|
-
if (!
|
|
4070
|
+
if (!br.has(t)) return !1;
|
|
4026
4071
|
let n = e.namespaceURI;
|
|
4027
|
-
return !n || n ===
|
|
4028
|
-
},
|
|
4029
|
-
if (e.nodeType === Node.TEXT_NODE) return
|
|
4072
|
+
return !n || n === yr || n === "http://www.w3.org/1999/xhtml";
|
|
4073
|
+
}, Er = (e) => {
|
|
4074
|
+
if (e.nodeType === Node.TEXT_NODE) return Sr(e.textContent || "");
|
|
4030
4075
|
if (e.nodeType === Node.COMMENT_NODE) return "";
|
|
4031
4076
|
if (e.nodeType !== Node.ELEMENT_NODE) return null;
|
|
4032
4077
|
let t = e;
|
|
4033
|
-
if (!
|
|
4078
|
+
if (!Tr(t)) return null;
|
|
4034
4079
|
let n = t.localName.toLowerCase(), r = [];
|
|
4035
4080
|
for (let e of Array.from(t.attributes)) {
|
|
4036
4081
|
let t = e.name.toLowerCase();
|
|
4037
|
-
if (!
|
|
4038
|
-
if (t === "xmlns" && e.value !==
|
|
4039
|
-
r.push(`${t}="${
|
|
4082
|
+
if (!wr(t, e.value)) {
|
|
4083
|
+
if (t === "xmlns" && e.value !== yr) return null;
|
|
4084
|
+
r.push(`${t}="${Cr(e.value)}"`);
|
|
4040
4085
|
}
|
|
4041
4086
|
}
|
|
4042
|
-
n === "math" && !r.some((e) => e.startsWith("xmlns=")) && r.unshift(`xmlns="${
|
|
4087
|
+
n === "math" && !r.some((e) => e.startsWith("xmlns=")) && r.unshift(`xmlns="${yr}"`);
|
|
4043
4088
|
let i = [];
|
|
4044
4089
|
for (let e of Array.from(t.childNodes)) {
|
|
4045
|
-
let t =
|
|
4090
|
+
let t = Er(e);
|
|
4046
4091
|
if (t === null) return null;
|
|
4047
4092
|
i.push(t);
|
|
4048
4093
|
}
|
|
4049
4094
|
return `<${n}${r.length > 0 ? ` ${r.join(" ")}` : ""}>${i.join("")}</${n}>`;
|
|
4050
|
-
},
|
|
4095
|
+
}, Dr = (e) => typeof DOMParser < "u" ? new DOMParser().parseFromString(e, "application/xml") : null, Or = (e) => {
|
|
4051
4096
|
let t = String(e || "").trim();
|
|
4052
4097
|
if (!t) return null;
|
|
4053
|
-
let n =
|
|
4098
|
+
let n = Dr(t);
|
|
4054
4099
|
if (!n || n.getElementsByTagName("parsererror").length > 0) return null;
|
|
4055
4100
|
let r = n.documentElement;
|
|
4056
|
-
return !r || r.localName.toLowerCase() !== "math" ? null :
|
|
4057
|
-
},
|
|
4101
|
+
return !r || r.localName.toLowerCase() !== "math" ? null : Er(r);
|
|
4102
|
+
}, kr = (e) => ({
|
|
4058
4103
|
chars: [],
|
|
4059
4104
|
map: /* @__PURE__ */ new Map(),
|
|
4060
4105
|
position: 0,
|
|
@@ -4062,28 +4107,28 @@ var sn = class {
|
|
|
4062
4107
|
lastCharWasWhitespace: !1,
|
|
4063
4108
|
lastMapped: null,
|
|
4064
4109
|
options: e
|
|
4065
|
-
}),
|
|
4110
|
+
}), Ar = (e) => e.classList?.contains("MathJax") || e.tagName?.toLowerCase() === "mjx-container", jr = (e) => e.tagName?.toLowerCase() === "mjx-assistive-mml", Mr = (e) => {
|
|
4066
4111
|
let t = e.tagName?.toLowerCase();
|
|
4067
4112
|
return t === "annotation" || t === "annotation-xml";
|
|
4068
|
-
},
|
|
4113
|
+
}, Nr = (e) => {
|
|
4069
4114
|
let t = e.getAttribute("data-mathml");
|
|
4070
4115
|
return t && t.trim() ? t : null;
|
|
4071
|
-
},
|
|
4072
|
-
if (e.tagName.toLowerCase() === "math") return
|
|
4073
|
-
let t =
|
|
4116
|
+
}, Pr = (e) => e.querySelector("mjx-assistive-mml math")?.outerHTML || null, Fr = (e) => {
|
|
4117
|
+
if (e.tagName.toLowerCase() === "math") return Or(e.outerHTML);
|
|
4118
|
+
let t = Nr(e);
|
|
4074
4119
|
if (t) {
|
|
4075
|
-
let e =
|
|
4120
|
+
let e = Or(t);
|
|
4076
4121
|
if (e) return e;
|
|
4077
4122
|
}
|
|
4078
|
-
if (
|
|
4079
|
-
let t =
|
|
4123
|
+
if (Ar(e)) {
|
|
4124
|
+
let t = Pr(e);
|
|
4080
4125
|
if (t) {
|
|
4081
|
-
let e =
|
|
4126
|
+
let e = Or(t);
|
|
4082
4127
|
if (e) return e;
|
|
4083
4128
|
}
|
|
4084
4129
|
}
|
|
4085
4130
|
return null;
|
|
4086
|
-
},
|
|
4131
|
+
}, Ir = new Set([
|
|
4087
4132
|
"P",
|
|
4088
4133
|
"H1",
|
|
4089
4134
|
"H2",
|
|
@@ -4099,7 +4144,7 @@ var sn = class {
|
|
|
4099
4144
|
"FIGCAPTION",
|
|
4100
4145
|
"LABEL",
|
|
4101
4146
|
"BUTTON"
|
|
4102
|
-
]),
|
|
4147
|
+
]), Lr = new Set([
|
|
4103
4148
|
"heading",
|
|
4104
4149
|
"listitem",
|
|
4105
4150
|
"option",
|
|
@@ -4108,24 +4153,24 @@ var sn = class {
|
|
|
4108
4153
|
"cell",
|
|
4109
4154
|
"columnheader",
|
|
4110
4155
|
"rowheader"
|
|
4111
|
-
]),
|
|
4156
|
+
]), Rr = (e, t) => {
|
|
4112
4157
|
let n = e.parentElement, r = null;
|
|
4113
4158
|
for (; n && n !== t;) {
|
|
4114
4159
|
let e = (n.getAttribute("role") || "").toLowerCase(), t = n.tagName.toUpperCase();
|
|
4115
|
-
if (
|
|
4160
|
+
if (Ir.has(t) || Lr.has(e)) {
|
|
4116
4161
|
r = n;
|
|
4117
4162
|
break;
|
|
4118
4163
|
}
|
|
4119
4164
|
n = n.parentElement;
|
|
4120
4165
|
}
|
|
4121
4166
|
return r || t;
|
|
4122
|
-
},
|
|
4167
|
+
}, zr = (e) => !!(typeof e.querySelector == "function" && e.querySelector("math, [data-mathml], .MathJax, mjx-container, mjx-assistive-mml")) || e.tagName?.toLowerCase() === "math" || e.hasAttribute?.("data-mathml") || Ar(e), X = (e, t, n) => {
|
|
4123
4168
|
/[.,;:!?]/.test(t) && e.chars.length > 0 && e.chars[e.chars.length - 1] === " " && (e.chars.pop(), e.position--, e.map.delete(e.position)), e.chars.push(t), n ? (e.map.set(e.position, n), e.lastMapped = n) : e.lastMapped && e.map.set(e.position, e.lastMapped), e.position++;
|
|
4124
|
-
},
|
|
4169
|
+
}, Br = (e, t) => {
|
|
4125
4170
|
if (e.inLeadingWhitespace || e.lastCharWasWhitespace || e.chars.length === 0) return !1;
|
|
4126
4171
|
let n = e.chars[e.chars.length - 1];
|
|
4127
4172
|
return at(n, t, e.options);
|
|
4128
|
-
},
|
|
4173
|
+
}, Vr = (e, t) => {
|
|
4129
4174
|
let n = t.textContent || "", r = !1;
|
|
4130
4175
|
for (let i = 0; i < n.length; i++) {
|
|
4131
4176
|
let a = n[i], o = /\s/.test(a);
|
|
@@ -4143,7 +4188,7 @@ var sn = class {
|
|
|
4143
4188
|
}), e.lastCharWasWhitespace = !0;
|
|
4144
4189
|
continue;
|
|
4145
4190
|
}
|
|
4146
|
-
!r &&
|
|
4191
|
+
!r && Br(e, a) && X(e, " ", {
|
|
4147
4192
|
node: t,
|
|
4148
4193
|
offset: i
|
|
4149
4194
|
}), X(e, a, {
|
|
@@ -4151,7 +4196,7 @@ var sn = class {
|
|
|
4151
4196
|
offset: i
|
|
4152
4197
|
}), r = !0, e.lastCharWasWhitespace = !1;
|
|
4153
4198
|
}
|
|
4154
|
-
},
|
|
4199
|
+
}, Hr = (e, t) => {
|
|
4155
4200
|
for (let n = 0; n < t.text.length; n++) {
|
|
4156
4201
|
let r = t.text[n], i = /\s/.test(r), a = t.map.get(n) || null, o = a?.node || e.lastMapped?.node || null, s = a?.offset ?? e.lastMapped?.offset ?? 0, c = a ? {
|
|
4157
4202
|
node: a.node,
|
|
@@ -4168,7 +4213,7 @@ var sn = class {
|
|
|
4168
4213
|
e.lastCharWasWhitespace || X(e, " ", c), e.lastCharWasWhitespace = !0;
|
|
4169
4214
|
continue;
|
|
4170
4215
|
}
|
|
4171
|
-
n === 0 &&
|
|
4216
|
+
n === 0 && Br(e, r) && X(e, " ", c), X(e, r, c), e.lastCharWasWhitespace = !1, a ? (e.map.set(e.position - 1, {
|
|
4172
4217
|
node: a.node,
|
|
4173
4218
|
offset: a.offset
|
|
4174
4219
|
}), e.lastMapped = {
|
|
@@ -4179,7 +4224,7 @@ var sn = class {
|
|
|
4179
4224
|
offset: s
|
|
4180
4225
|
});
|
|
4181
4226
|
}
|
|
4182
|
-
},
|
|
4227
|
+
}, Ur = (e) => {
|
|
4183
4228
|
if (typeof DOMParser > "u") return "";
|
|
4184
4229
|
let t = new DOMParser().parseFromString(e, "application/xml");
|
|
4185
4230
|
if (t.getElementsByTagName("parsererror").length > 0) return "";
|
|
@@ -4191,35 +4236,35 @@ var sn = class {
|
|
|
4191
4236
|
}
|
|
4192
4237
|
if (e.nodeType !== 1) return;
|
|
4193
4238
|
let t = e;
|
|
4194
|
-
if (!
|
|
4239
|
+
if (!Mr(t)) for (let e of Array.from(t.childNodes)) r(e);
|
|
4195
4240
|
};
|
|
4196
4241
|
return r(t.documentElement), D(n.join(" "));
|
|
4197
|
-
},
|
|
4198
|
-
let r =
|
|
4242
|
+
}, Wr = (e, t, n) => {
|
|
4243
|
+
let r = kr(n), i = (t) => {
|
|
4199
4244
|
if (O(t, e)) return;
|
|
4200
4245
|
if (t.nodeType === 3) {
|
|
4201
|
-
|
|
4246
|
+
Vr(r, t);
|
|
4202
4247
|
return;
|
|
4203
4248
|
}
|
|
4204
4249
|
if (t.nodeType !== 1) return;
|
|
4205
4250
|
let n = t;
|
|
4206
|
-
if (!(
|
|
4251
|
+
if (!(jr(n) || Mr(n))) for (let e of Array.from(n.childNodes)) i(e);
|
|
4207
4252
|
};
|
|
4208
|
-
i(e),
|
|
4253
|
+
i(e), Gr(r);
|
|
4209
4254
|
let a = D(r.chars.join(""));
|
|
4210
4255
|
if (a) return {
|
|
4211
4256
|
text: a,
|
|
4212
4257
|
map: r.map
|
|
4213
4258
|
};
|
|
4214
|
-
let o =
|
|
4259
|
+
let o = Ur(t);
|
|
4215
4260
|
return o ? {
|
|
4216
4261
|
text: o,
|
|
4217
4262
|
map: /* @__PURE__ */ new Map()
|
|
4218
4263
|
} : k(e, n);
|
|
4219
|
-
},
|
|
4264
|
+
}, Gr = (e) => {
|
|
4220
4265
|
for (; e.chars.length > 0 && /\s/.test(e.chars[e.chars.length - 1]);) e.chars.pop(), e.position--, e.map.delete(e.position);
|
|
4221
|
-
},
|
|
4222
|
-
let n =
|
|
4266
|
+
}, Kr = (e, t) => {
|
|
4267
|
+
let n = kr(t), r = [], i = 0, a, o = !1, s = () => {
|
|
4223
4268
|
let e = D(n.chars.slice(i, n.chars.length).join(""));
|
|
4224
4269
|
e && r.push({
|
|
4225
4270
|
type: "text",
|
|
@@ -4229,18 +4274,18 @@ var sn = class {
|
|
|
4229
4274
|
}, c = (l) => {
|
|
4230
4275
|
if (O(l, e)) return;
|
|
4231
4276
|
if (l.nodeType === Node.TEXT_NODE) {
|
|
4232
|
-
let t =
|
|
4233
|
-
a && t !== a && s(), a = t,
|
|
4277
|
+
let t = Rr(l, e);
|
|
4278
|
+
a && t !== a && s(), a = t, Vr(n, l);
|
|
4234
4279
|
return;
|
|
4235
4280
|
}
|
|
4236
4281
|
if (l.nodeType !== Node.ELEMENT_NODE) return;
|
|
4237
4282
|
let u = l;
|
|
4238
|
-
if (
|
|
4239
|
-
let d =
|
|
4283
|
+
if (jr(u)) return;
|
|
4284
|
+
let d = Fr(u);
|
|
4240
4285
|
if (d) {
|
|
4241
4286
|
s();
|
|
4242
|
-
let e =
|
|
4243
|
-
|
|
4287
|
+
let e = Wr(u, d, t);
|
|
4288
|
+
Hr(n, e);
|
|
4244
4289
|
let a = D(e.text);
|
|
4245
4290
|
r.push({
|
|
4246
4291
|
type: "math",
|
|
@@ -4253,7 +4298,7 @@ var sn = class {
|
|
|
4253
4298
|
for (let e of Array.from(u.childNodes)) c(e);
|
|
4254
4299
|
};
|
|
4255
4300
|
for (let t of Array.from(e.childNodes)) c(t);
|
|
4256
|
-
|
|
4301
|
+
Gr(n), s();
|
|
4257
4302
|
let l = n.chars.join("");
|
|
4258
4303
|
for (; n.map.has(l.length);) n.map.delete(l.length);
|
|
4259
4304
|
return {
|
|
@@ -4263,7 +4308,7 @@ var sn = class {
|
|
|
4263
4308
|
containsMathMarkup: o
|
|
4264
4309
|
};
|
|
4265
4310
|
}, Z = (e, t) => {
|
|
4266
|
-
if (!
|
|
4311
|
+
if (!zr(e)) {
|
|
4267
4312
|
let { text: n, map: r } = k(e, t);
|
|
4268
4313
|
return {
|
|
4269
4314
|
visibleText: n,
|
|
@@ -4275,8 +4320,8 @@ var sn = class {
|
|
|
4275
4320
|
containsMathMarkup: !1
|
|
4276
4321
|
};
|
|
4277
4322
|
}
|
|
4278
|
-
return
|
|
4279
|
-
},
|
|
4323
|
+
return Kr(e, t);
|
|
4324
|
+
}, qr = (e, t) => vt([e], t), Jr = (e) => (e || "en").split("-")[0].toLowerCase() || "en", Yr = new Set([
|
|
4280
4325
|
"H1",
|
|
4281
4326
|
"H2",
|
|
4282
4327
|
"H3",
|
|
@@ -4286,17 +4331,17 @@ var sn = class {
|
|
|
4286
4331
|
"LI",
|
|
4287
4332
|
"LABEL",
|
|
4288
4333
|
"BUTTON"
|
|
4289
|
-
]),
|
|
4334
|
+
]), Xr = new Set([
|
|
4290
4335
|
"heading",
|
|
4291
4336
|
"listitem",
|
|
4292
4337
|
"option",
|
|
4293
4338
|
"radio"
|
|
4294
|
-
]),
|
|
4339
|
+
]), Zr = (e) => {
|
|
4295
4340
|
if (e.type !== "text" || !e.sourceElement) return !1;
|
|
4296
4341
|
let t = e.sourceElement.tagName.toUpperCase(), n = (e.sourceElement.getAttribute("role") || "").toLowerCase();
|
|
4297
|
-
return
|
|
4298
|
-
},
|
|
4299
|
-
let t = e.resolveMathSpeech ??
|
|
4342
|
+
return Yr.has(t) || Xr.has(n);
|
|
4343
|
+
}, Qr = async (e) => {
|
|
4344
|
+
let t = e.resolveMathSpeech ?? qr, { visibleText: n } = e, r = [], i = 0, a = (e) => {
|
|
4300
4345
|
let t = D(e), r = n.indexOf(t, i), a = r >= 0 ? r : i, o = a + t.length;
|
|
4301
4346
|
return i = o, {
|
|
4302
4347
|
start: a,
|
|
@@ -4306,7 +4351,7 @@ var sn = class {
|
|
|
4306
4351
|
for (let n = 0; n < e.chunks.length; n++) {
|
|
4307
4352
|
let i = e.chunks[n];
|
|
4308
4353
|
if (i.type === "text") {
|
|
4309
|
-
let t =
|
|
4354
|
+
let t = Zr(i) ? [{
|
|
4310
4355
|
text: i.text,
|
|
4311
4356
|
offset: 0
|
|
4312
4357
|
}] : ze(i.text, { locale: e.language });
|
|
@@ -4346,37 +4391,37 @@ var sn = class {
|
|
|
4346
4391
|
}
|
|
4347
4392
|
return {
|
|
4348
4393
|
segments: r,
|
|
4349
|
-
locale:
|
|
4394
|
+
locale: Jr(e.language),
|
|
4350
4395
|
visibleText: n,
|
|
4351
4396
|
plainSpeechText: D(o.join(" "))
|
|
4352
4397
|
};
|
|
4353
|
-
},
|
|
4354
|
-
let t = Math.max(1, e.maxEntries ??
|
|
4398
|
+
}, $r = (e) => (e || "en").split("-")[0].toLowerCase() || "en", ei = "sre-v1", ti = 256, ni = (e) => Array.isArray(e) ? `array:[${e.map(ni).join(",")}]` : e && typeof e == "object" ? `object:{${Object.entries(e).sort(([e], [t]) => e.localeCompare(t)).map(([e, t]) => `${JSON.stringify(e)}:${ni(t)}`).join(",")}}` : e === null ? "null:null" : e === void 0 ? "undefined:" : typeof e == "function" ? `function:${e.name || "anonymous"}` : typeof e == "symbol" ? `symbol:${String(e)}` : typeof e == "bigint" ? `bigint:${e.toString()}` : typeof e == "number" ? Number.isFinite(e) ? `number:${e}` : `number:${String(e)}` : `${typeof e}:${JSON.stringify(e)}`, ri = (e, t, n, r) => `${ei}\u0000${$r(e)}\u0000${t ? "ssml" : "plain"}\u0000${ni(n ?? null)}\u0000${r}`, ii = (e = {}) => {
|
|
4399
|
+
let t = Math.max(1, e.maxEntries ?? ti), n = e.resolve ?? ((e, t) => vt([e], t)), r = /* @__PURE__ */ new Map(), i = (e, n) => {
|
|
4355
4400
|
for (r.delete(e), r.set(e, n); r.size > t;) {
|
|
4356
4401
|
let e = r.keys().next().value;
|
|
4357
4402
|
e !== void 0 && r.delete(e);
|
|
4358
4403
|
}
|
|
4359
4404
|
};
|
|
4360
4405
|
return async (e, a) => {
|
|
4361
|
-
let o = A(a.mathSpeech), s = a.produceSsml === !0, c =
|
|
4406
|
+
let o = A(a.mathSpeech), s = a.produceSsml === !0, c = ri(a.language, s, o, e.mathml), l = r.get(c);
|
|
4362
4407
|
if (l) return r.delete(c), r.set(c, l), l;
|
|
4363
4408
|
let u = await n(e, {
|
|
4364
4409
|
...a,
|
|
4365
4410
|
mathSpeech: o
|
|
4366
4411
|
});
|
|
4367
|
-
return s && u.ssml && t > 1 && i(
|
|
4412
|
+
return s && u.ssml && t > 1 && i(ri(a.language, !1, o, e.mathml), {
|
|
4368
4413
|
speechText: u.speechText,
|
|
4369
4414
|
usedMathSpeech: u.usedMathSpeech,
|
|
4370
4415
|
usedFallback: u.usedFallback
|
|
4371
4416
|
}), i(c, u), u;
|
|
4372
4417
|
};
|
|
4373
|
-
},
|
|
4374
|
-
let n =
|
|
4418
|
+
}, ai = (e) => !e || /^<[^>]+>$/.test(e.trim()) ? null : J({ speechText: e }).tokens[0]?.normalized || null, oi = (e, t) => {
|
|
4419
|
+
let n = J({ speechText: e.speechText });
|
|
4375
4420
|
if (!Number.isFinite(t.position)) return {
|
|
4376
4421
|
boundary: null,
|
|
4377
4422
|
spokenText: n.spokenText
|
|
4378
4423
|
};
|
|
4379
|
-
let r =
|
|
4424
|
+
let r = hr({
|
|
4380
4425
|
tokenization: n,
|
|
4381
4426
|
position: t.position,
|
|
4382
4427
|
length: t.length,
|
|
@@ -4389,8 +4434,8 @@ var sn = class {
|
|
|
4389
4434
|
} : null,
|
|
4390
4435
|
spokenText: n.spokenText
|
|
4391
4436
|
};
|
|
4392
|
-
},
|
|
4393
|
-
let n =
|
|
4437
|
+
}, si = (e, t, n) => n ? J({ speechText: e }).tokens.find((e) => e.start <= t && t < e.end)?.normalized === n : !0, ci = (e, t) => {
|
|
4438
|
+
let n = ai(t.word);
|
|
4394
4439
|
if (e.id !== t.chunkId) return {
|
|
4395
4440
|
chunkId: t.chunkId,
|
|
4396
4441
|
normalizedWord: n,
|
|
@@ -4408,12 +4453,12 @@ var sn = class {
|
|
|
4408
4453
|
reason: "boundary offset space is unsupported"
|
|
4409
4454
|
};
|
|
4410
4455
|
let r, i;
|
|
4411
|
-
if (e.catalogAlignment) r =
|
|
4456
|
+
if (e.catalogAlignment) r = Mn(e.catalogAlignment, t.position, t.length, t.word), i = e.catalogAlignment.spokenText;
|
|
4412
4457
|
else {
|
|
4413
|
-
let n =
|
|
4458
|
+
let n = oi(e, t);
|
|
4414
4459
|
r = n.boundary, i = n.spokenText;
|
|
4415
4460
|
}
|
|
4416
|
-
return r ?
|
|
4461
|
+
return r ? si(i, r.start, n) ? {
|
|
4417
4462
|
chunkId: e.id,
|
|
4418
4463
|
normalizedWord: n,
|
|
4419
4464
|
chunkSpokenStart: r.start,
|
|
@@ -4453,12 +4498,12 @@ var sn = class {
|
|
|
4453
4498
|
quality: "region",
|
|
4454
4499
|
confidence: e.confidence,
|
|
4455
4500
|
reason: e.reason
|
|
4456
|
-
},
|
|
4501
|
+
}, li = new Map([
|
|
4457
4502
|
["mi", "mjx-mi"],
|
|
4458
4503
|
["mn", "mjx-mn"],
|
|
4459
4504
|
["mo", "mjx-mo"],
|
|
4460
4505
|
["mtext", "mjx-mtext"]
|
|
4461
|
-
]),
|
|
4506
|
+
]), ui = "mi,mn,mo,mtext", di = "mjx-mi,mjx-mn,mjx-mo,mjx-mtext", fi = [
|
|
4462
4507
|
"mjx-mfrac",
|
|
4463
4508
|
"mjx-msqrt",
|
|
4464
4509
|
"mjx-mroot",
|
|
@@ -4466,55 +4511,55 @@ var sn = class {
|
|
|
4466
4511
|
"mjx-munder",
|
|
4467
4512
|
"mjx-mover",
|
|
4468
4513
|
"mjx-munderover"
|
|
4469
|
-
].join(","),
|
|
4514
|
+
].join(","), pi = (e) => e.type === "text-range" ? e.node.parentElement : e.element, mi = (e) => {
|
|
4470
4515
|
let t = e;
|
|
4471
4516
|
for (; t;) {
|
|
4472
4517
|
if (t.localName?.toLowerCase() === "mjx-container") return t;
|
|
4473
4518
|
t = t.parentElement;
|
|
4474
4519
|
}
|
|
4475
4520
|
return null;
|
|
4476
|
-
},
|
|
4521
|
+
}, hi = (e) => !e || mi(e) ? !1 : !O(e), gi = (e) => {
|
|
4477
4522
|
let t = e.getBoundingClientRect?.();
|
|
4478
4523
|
return !!(t && t.width > 0 && t.height > 0);
|
|
4479
|
-
},
|
|
4524
|
+
}, _i = (e) => {
|
|
4480
4525
|
let t = e;
|
|
4481
4526
|
for (; t;) {
|
|
4482
4527
|
if (t.localName?.toLowerCase() === "math") return t;
|
|
4483
4528
|
t = t.parentElement;
|
|
4484
4529
|
}
|
|
4485
4530
|
return null;
|
|
4486
|
-
},
|
|
4531
|
+
}, vi = (e, t) => {
|
|
4487
4532
|
if (e.length === 0 || e.length !== t.length) return !1;
|
|
4488
4533
|
for (let n = 0; n < e.length; n += 1) {
|
|
4489
|
-
let r =
|
|
4534
|
+
let r = li.get(e[n].localName.toLowerCase());
|
|
4490
4535
|
if (!r || t[n].localName.toLowerCase() !== r) return !1;
|
|
4491
4536
|
}
|
|
4492
4537
|
return !0;
|
|
4493
|
-
},
|
|
4494
|
-
if (!e || !
|
|
4495
|
-
let n =
|
|
4538
|
+
}, yi = (e, t) => {
|
|
4539
|
+
if (!e || !li.has(e.localName.toLowerCase()) || t.querySelector(fi)) return null;
|
|
4540
|
+
let n = _i(e), r = t.querySelector("mjx-math");
|
|
4496
4541
|
if (!n || !r) return null;
|
|
4497
|
-
let i = Array.from(n.querySelectorAll(
|
|
4542
|
+
let i = Array.from(n.querySelectorAll(ui)), a = i.indexOf(e);
|
|
4498
4543
|
if (a < 0) return null;
|
|
4499
|
-
let o = Array.from(r.querySelectorAll(
|
|
4500
|
-
if (!
|
|
4544
|
+
let o = Array.from(r.querySelectorAll(di));
|
|
4545
|
+
if (!vi(i, o)) return null;
|
|
4501
4546
|
let s = o[a];
|
|
4502
|
-
return !s || !
|
|
4503
|
-
},
|
|
4504
|
-
let t =
|
|
4547
|
+
return !s || !gi(s) ? null : s;
|
|
4548
|
+
}, bi = (e) => {
|
|
4549
|
+
let t = mi(e);
|
|
4505
4550
|
if (t) {
|
|
4506
|
-
if (t.querySelector(
|
|
4507
|
-
let n =
|
|
4551
|
+
if (t.querySelector(fi)) return "expression";
|
|
4552
|
+
let n = _i(e) ?? e, r = t.querySelector("mjx-math");
|
|
4508
4553
|
if (!r) return "expression";
|
|
4509
|
-
let i = Array.from(n.querySelectorAll(
|
|
4510
|
-
return
|
|
4554
|
+
let i = Array.from(n.querySelectorAll(ui)), a = Array.from(r.querySelectorAll(di));
|
|
4555
|
+
return vi(i, a) && a.some((e) => gi(e)) ? "token" : "expression";
|
|
4511
4556
|
}
|
|
4512
|
-
let n =
|
|
4513
|
-
return Array.from(n.querySelectorAll(
|
|
4514
|
-
},
|
|
4515
|
-
let t =
|
|
4557
|
+
let n = _i(e) ?? e;
|
|
4558
|
+
return Array.from(n.querySelectorAll(ui)).some((e) => !O(e)) ? "token" : "expression";
|
|
4559
|
+
}, xi = (e) => {
|
|
4560
|
+
let t = pi(e), n = mi(t);
|
|
4516
4561
|
if (n) {
|
|
4517
|
-
let e =
|
|
4562
|
+
let e = yi(t, n);
|
|
4518
4563
|
return e ? {
|
|
4519
4564
|
type: "element",
|
|
4520
4565
|
quality: "semantic-token",
|
|
@@ -4525,35 +4570,35 @@ var sn = class {
|
|
|
4525
4570
|
element: n
|
|
4526
4571
|
};
|
|
4527
4572
|
}
|
|
4528
|
-
return e.type === "text-range" ?
|
|
4573
|
+
return e.type === "text-range" ? hi(e.node.parentElement) ? {
|
|
4529
4574
|
type: "text-range",
|
|
4530
4575
|
quality: "semantic-token",
|
|
4531
4576
|
node: e.node,
|
|
4532
4577
|
startOffset: e.startOffset,
|
|
4533
4578
|
endOffset: e.endOffset
|
|
4534
|
-
} : null :
|
|
4579
|
+
} : null : hi(e.element) ? {
|
|
4535
4580
|
type: "element",
|
|
4536
4581
|
quality: e.quality === "region-fallback" ? "expression" : "semantic-token",
|
|
4537
4582
|
element: e.element
|
|
4538
4583
|
} : null;
|
|
4539
|
-
},
|
|
4584
|
+
}, Si = xi, Ci = () => {
|
|
4540
4585
|
let e = /* @__PURE__ */ new WeakMap();
|
|
4541
4586
|
return (t) => {
|
|
4542
|
-
let n =
|
|
4543
|
-
if (!n || !r) return
|
|
4587
|
+
let n = pi(t), r = mi(n);
|
|
4588
|
+
if (!n || !r) return xi(t);
|
|
4544
4589
|
if (e.has(n)) return e.get(n) ?? null;
|
|
4545
|
-
let i =
|
|
4590
|
+
let i = xi(t);
|
|
4546
4591
|
return e.set(n, i), i;
|
|
4547
4592
|
};
|
|
4548
|
-
},
|
|
4593
|
+
}, wi = (e, t, n, r = e.mathAlignments, i = Si) => {
|
|
4549
4594
|
if (t.chunkSpokenStart === null || t.chunkSpokenEnd === null) return null;
|
|
4550
4595
|
let a = null;
|
|
4551
4596
|
for (let e of r) {
|
|
4552
|
-
let r =
|
|
4597
|
+
let r = _r(e.alignment, {
|
|
4553
4598
|
position: t.chunkSpokenStart,
|
|
4554
4599
|
length: Math.max(1, t.chunkSpokenEnd - t.chunkSpokenStart),
|
|
4555
4600
|
boundaryWord: n.word
|
|
4556
|
-
}) ||
|
|
4601
|
+
}) || vr(e.alignment, { boundaryWord: n.word });
|
|
4557
4602
|
if (!r) continue;
|
|
4558
4603
|
let o = i(r);
|
|
4559
4604
|
if (o) {
|
|
@@ -4562,7 +4607,7 @@ var sn = class {
|
|
|
4562
4607
|
}
|
|
4563
4608
|
}
|
|
4564
4609
|
return a;
|
|
4565
|
-
},
|
|
4610
|
+
}, Ti = (e, t, n) => {
|
|
4566
4611
|
if (!e || typeof document > "u" || n <= t) return null;
|
|
4567
4612
|
let r = e.get(t), i = e.get(Math.max(t, n - 1));
|
|
4568
4613
|
if (!r) return null;
|
|
@@ -4573,17 +4618,17 @@ var sn = class {
|
|
|
4573
4618
|
} catch {
|
|
4574
4619
|
return null;
|
|
4575
4620
|
}
|
|
4576
|
-
},
|
|
4621
|
+
}, Ei = (e, t) => {
|
|
4577
4622
|
if (!e.catalogAlignment || t.chunkSpokenStart === null) return null;
|
|
4578
|
-
let n =
|
|
4623
|
+
let n = Nn(e.catalogAlignment, t.chunkSpokenStart);
|
|
4579
4624
|
if (!n) return null;
|
|
4580
|
-
let r =
|
|
4625
|
+
let r = Ti(e.visibleMap, n.start, n.end);
|
|
4581
4626
|
return r ? {
|
|
4582
4627
|
type: "range",
|
|
4583
4628
|
quality: e.catalogAlignment.playbackMode === "exact-word" ? "exact-word" : "semantic-token",
|
|
4584
4629
|
range: r
|
|
4585
4630
|
} : null;
|
|
4586
|
-
},
|
|
4631
|
+
}, Di = (e) => e.regionRange ? {
|
|
4587
4632
|
type: "range",
|
|
4588
4633
|
quality: "region",
|
|
4589
4634
|
range: e.regionRange
|
|
@@ -4591,43 +4636,43 @@ var sn = class {
|
|
|
4591
4636
|
type: "element",
|
|
4592
4637
|
quality: "region",
|
|
4593
4638
|
element: e.regionElement
|
|
4594
|
-
} : null,
|
|
4639
|
+
} : null, Oi = (e, t = e.chunk.mathAlignments) => {
|
|
4595
4640
|
if (t.length !== 1) return null;
|
|
4596
4641
|
let n = t[0]?.alignment.result.fallbackTarget;
|
|
4597
4642
|
return n ? e.renderedMathTargetResolver(n) : null;
|
|
4598
|
-
},
|
|
4643
|
+
}, ki = (e, t) => e ? t.mathAlignments.filter(({ element: t }) => {
|
|
4599
4644
|
try {
|
|
4600
4645
|
return e.type === "range" ? e.range.intersectsNode(t) : e.type === "element" ? e.element === t || e.element.contains(t) : e.node.parentElement?.contains(t) || !1;
|
|
4601
4646
|
} catch {
|
|
4602
4647
|
return !1;
|
|
4603
4648
|
}
|
|
4604
|
-
}) : t.mathAlignments,
|
|
4649
|
+
}) : t.mathAlignments, Ai = () => ({
|
|
4605
4650
|
activeTarget: null,
|
|
4606
4651
|
regionTarget: null,
|
|
4607
4652
|
quality: "region",
|
|
4608
4653
|
confidence: 0,
|
|
4609
4654
|
reason: "boundary chunk id was not found"
|
|
4610
|
-
}),
|
|
4655
|
+
}), ji = (e) => e.length === 1 ? e[0].element : null, Mi = (e, t) => t.length > 0 && t.every(({ element: t }) => e.mathCapabilityByElement.get(t) === "token"), Ni = 3, Pi = (e, t, n) => {
|
|
4611
4656
|
if (!t || t.type !== "range") return !1;
|
|
4612
4657
|
let { startContainer: r, endContainer: i } = t.range;
|
|
4613
|
-
return r === i && r.nodeType ===
|
|
4614
|
-
},
|
|
4658
|
+
return r === i && r.nodeType === Ni ? !1 : n.some(({ element: t }) => e.mathCapabilityByElement.get(t) === "token" && t.contains(r) && t.contains(i));
|
|
4659
|
+
}, Fi = (e, t) => ({
|
|
4615
4660
|
chunk: e,
|
|
4616
|
-
regionTarget:
|
|
4617
|
-
renderedMathTargetResolver:
|
|
4618
|
-
mathCapabilityByElement: new Map(e.mathAlignments.map(({ element: e }) => [e, t ?
|
|
4661
|
+
regionTarget: Di(e),
|
|
4662
|
+
renderedMathTargetResolver: Ci(),
|
|
4663
|
+
mathCapabilityByElement: new Map(e.mathAlignments.map(({ element: e }) => [e, t ? bi(e) : "expression"])),
|
|
4619
4664
|
heldTokenByElement: /* @__PURE__ */ new Map()
|
|
4620
|
-
}),
|
|
4621
|
-
let t = e.mathTokenHighlighting !== !1, n = new Map(e.chunks.map((e) => [e.id,
|
|
4665
|
+
}), Ii = (e) => {
|
|
4666
|
+
let t = e.mathTokenHighlighting !== !1, n = new Map(e.chunks.map((e) => [e.id, Fi(e, t)]));
|
|
4622
4667
|
return {
|
|
4623
4668
|
chunks: e.chunks,
|
|
4624
4669
|
resolveInitial(e) {
|
|
4625
4670
|
let t = n.get(e);
|
|
4626
|
-
if (!t) return
|
|
4671
|
+
if (!t) return Ai();
|
|
4627
4672
|
let r = t.chunk.mathAlignments, i = r.length === 1 ? r[0].element : null, a = i ? t.mathCapabilityByElement.get(i) : null;
|
|
4628
4673
|
return Q(a === "expression" ? {
|
|
4629
4674
|
semanticTarget: null,
|
|
4630
|
-
expressionTarget:
|
|
4675
|
+
expressionTarget: Oi(t),
|
|
4631
4676
|
regionTarget: t.regionTarget,
|
|
4632
4677
|
confidence: .5,
|
|
4633
4678
|
reason: "initial expression (sticky expression mode)"
|
|
@@ -4641,10 +4686,10 @@ var sn = class {
|
|
|
4641
4686
|
},
|
|
4642
4687
|
resolveBoundary(e) {
|
|
4643
4688
|
let r = n.get(e.chunkId);
|
|
4644
|
-
if (!r) return
|
|
4645
|
-
let { chunk: i } = r, a =
|
|
4689
|
+
if (!r) return Ai();
|
|
4690
|
+
let { chunk: i } = r, a = ci(i, e), o = Ei(i, a), s = ki(o, i), c = (!o || s.length > 0 ? wi(i, a, e, s, r.renderedMathTargetResolver) : null) || null, l = t && c && c.quality !== "expression" ? c : null, u = c && c.quality === "expression" ? c : null;
|
|
4646
4691
|
if (l) {
|
|
4647
|
-
let e =
|
|
4692
|
+
let e = ji(s);
|
|
4648
4693
|
return e && r.heldTokenByElement.set(e, l), Q({
|
|
4649
4694
|
semanticTarget: l,
|
|
4650
4695
|
expressionTarget: null,
|
|
@@ -4653,15 +4698,15 @@ var sn = class {
|
|
|
4653
4698
|
reason: a.reason
|
|
4654
4699
|
});
|
|
4655
4700
|
}
|
|
4656
|
-
if (o && (t ? !
|
|
4701
|
+
if (o && (t ? !Pi(r, o, s) : s.length === 0)) return Q({
|
|
4657
4702
|
semanticTarget: o,
|
|
4658
4703
|
expressionTarget: null,
|
|
4659
4704
|
regionTarget: r.regionTarget,
|
|
4660
4705
|
confidence: a.confidence,
|
|
4661
4706
|
reason: a.reason
|
|
4662
4707
|
});
|
|
4663
|
-
if (
|
|
4664
|
-
let e =
|
|
4708
|
+
if (Mi(r, s)) {
|
|
4709
|
+
let e = ji(s), t = e ? r.heldTokenByElement.get(e) ?? null : null;
|
|
4665
4710
|
return Q({
|
|
4666
4711
|
semanticTarget: t,
|
|
4667
4712
|
expressionTarget: null,
|
|
@@ -4672,17 +4717,17 @@ var sn = class {
|
|
|
4672
4717
|
}
|
|
4673
4718
|
return Q({
|
|
4674
4719
|
semanticTarget: null,
|
|
4675
|
-
expressionTarget: u ??
|
|
4720
|
+
expressionTarget: u ?? Oi(r, s),
|
|
4676
4721
|
regionTarget: r.regionTarget,
|
|
4677
4722
|
confidence: a.confidence,
|
|
4678
4723
|
reason: a.reason
|
|
4679
4724
|
});
|
|
4680
4725
|
}
|
|
4681
4726
|
};
|
|
4682
|
-
},
|
|
4727
|
+
}, Li = (e) => e.alignment?.boundaryOffsetMode ? e.alignment.boundaryOffsetMode : e.mathAlignment?.speech.boundaryOffsetSpace || "plain-spoken-text", Ri = (e) => e.mathAlignments?.length ? e.mathAlignments : e.mathAlignment && e.sourceElement ? [{
|
|
4683
4728
|
element: e.sourceElement,
|
|
4684
4729
|
alignment: e.mathAlignment
|
|
4685
|
-
}] : [],
|
|
4730
|
+
}] : [], zi = (e) => (e.chunks && e.chunks.length ? e.chunks : [{
|
|
4686
4731
|
speechText: e.speechText || "",
|
|
4687
4732
|
visibleText: e.visibleText || e.speechText || "",
|
|
4688
4733
|
sourceElement: e.sourceElement || e.contentRoot,
|
|
@@ -4699,9 +4744,9 @@ var sn = class {
|
|
|
4699
4744
|
regionRange: t.regionRange,
|
|
4700
4745
|
visibleMap: t.visibleMap,
|
|
4701
4746
|
catalogAlignment: t.alignment,
|
|
4702
|
-
mathAlignments:
|
|
4703
|
-
offsetSpace:
|
|
4704
|
-
})),
|
|
4747
|
+
mathAlignments: Ri(t),
|
|
4748
|
+
offsetSpace: Li(t)
|
|
4749
|
+
})), Bi = [
|
|
4705
4750
|
"[data-pie-tts-region]",
|
|
4706
4751
|
"[data-catalog-region]",
|
|
4707
4752
|
"li",
|
|
@@ -4711,18 +4756,18 @@ var sn = class {
|
|
|
4711
4756
|
"[role='group']",
|
|
4712
4757
|
"[role='region']",
|
|
4713
4758
|
"div"
|
|
4714
|
-
].join(","),
|
|
4715
|
-
let n = e.closest(
|
|
4759
|
+
].join(","), Vi = (e, t) => {
|
|
4760
|
+
let n = e.closest(Bi);
|
|
4716
4761
|
return n && t.contains(n) ? n : e;
|
|
4717
|
-
},
|
|
4762
|
+
}, Hi = (e, t, n) => {
|
|
4718
4763
|
let r = /* @__PURE__ */ new Map();
|
|
4719
4764
|
for (let i = t; i < n; i++) {
|
|
4720
4765
|
let n = e.get(i);
|
|
4721
4766
|
n && r.set(i - t, n);
|
|
4722
4767
|
}
|
|
4723
4768
|
return r;
|
|
4724
|
-
},
|
|
4725
|
-
let t = Z(e.contentRoot, e.textProcessingOptions), n = await
|
|
4769
|
+
}, Ui = async (e) => {
|
|
4770
|
+
let t = Z(e.contentRoot, e.textProcessingOptions), n = await Qr({
|
|
4726
4771
|
chunks: t.chunks,
|
|
4727
4772
|
visibleText: t.visibleText,
|
|
4728
4773
|
language: e.language,
|
|
@@ -4740,8 +4785,8 @@ var sn = class {
|
|
|
4740
4785
|
segment: n,
|
|
4741
4786
|
anchor: {
|
|
4742
4787
|
sourceElement: r,
|
|
4743
|
-
regionElement:
|
|
4744
|
-
visibleMap:
|
|
4788
|
+
regionElement: Vi(r, e.contentRoot),
|
|
4789
|
+
visibleMap: Hi(t.map, n.visibleSpan.start, n.visibleSpan.end)
|
|
4745
4790
|
}
|
|
4746
4791
|
};
|
|
4747
4792
|
}
|
|
@@ -4761,8 +4806,8 @@ var sn = class {
|
|
|
4761
4806
|
containsMathMarkup: t.containsMathMarkup,
|
|
4762
4807
|
visibleText: t.visibleText
|
|
4763
4808
|
};
|
|
4764
|
-
},
|
|
4765
|
-
let n =
|
|
4809
|
+
}, Wi = (e, t) => {
|
|
4810
|
+
let n = Tn({
|
|
4766
4811
|
speechText: e.spokenText,
|
|
4767
4812
|
visibleText: e.spokenText
|
|
4768
4813
|
});
|
|
@@ -4771,13 +4816,13 @@ var sn = class {
|
|
|
4771
4816
|
visibleText: e.visibleText,
|
|
4772
4817
|
sourceElement: t.sourceElement,
|
|
4773
4818
|
regionElement: t.regionElement,
|
|
4774
|
-
regionRange:
|
|
4819
|
+
regionRange: Ti(t.visibleMap, 0, e.visibleText.length) ?? void 0,
|
|
4775
4820
|
speechMatchesVisibleText: !0,
|
|
4776
4821
|
playbackMode: n.playbackMode,
|
|
4777
4822
|
alignment: n,
|
|
4778
4823
|
visibleMap: t.visibleMap
|
|
4779
4824
|
};
|
|
4780
|
-
},
|
|
4825
|
+
}, Gi = (e, t) => {
|
|
4781
4826
|
let n = t.sourceElement;
|
|
4782
4827
|
return {
|
|
4783
4828
|
speechText: e.spokenText,
|
|
@@ -4785,12 +4830,12 @@ var sn = class {
|
|
|
4785
4830
|
sourceElement: n,
|
|
4786
4831
|
regionElement: t.regionElement,
|
|
4787
4832
|
speechMatchesVisibleText: e.spokenText === e.fallbackText,
|
|
4788
|
-
mathAlignment: n ?
|
|
4833
|
+
mathAlignment: n ? Y({
|
|
4789
4834
|
mathElement: n,
|
|
4790
4835
|
speechText: e.spokenText
|
|
4791
4836
|
}) : void 0
|
|
4792
4837
|
};
|
|
4793
|
-
},
|
|
4838
|
+
}, Ki = (e, t, n) => {
|
|
4794
4839
|
let r = t.sourceElement;
|
|
4795
4840
|
return {
|
|
4796
4841
|
speechText: n,
|
|
@@ -4798,17 +4843,17 @@ var sn = class {
|
|
|
4798
4843
|
sourceElement: r,
|
|
4799
4844
|
regionElement: t.regionElement,
|
|
4800
4845
|
speechMatchesVisibleText: !1,
|
|
4801
|
-
mathAlignment: r ?
|
|
4846
|
+
mathAlignment: r ? Y({
|
|
4802
4847
|
mathElement: r,
|
|
4803
4848
|
speechText: n
|
|
4804
4849
|
}) : void 0,
|
|
4805
|
-
plainFallback:
|
|
4850
|
+
plainFallback: Gi(e, t)
|
|
4806
4851
|
};
|
|
4807
|
-
},
|
|
4852
|
+
}, qi = (e, t = {}) => e.items.map(({ segment: e, anchor: n }) => e.kind === "prose" ? Wi(e, n) : t.format === "ssml" && e.ssml ? Ki(e, n, e.ssml) : Gi(e, n)), Ji = "pie-tts-control-handoff", $;
|
|
4808
4853
|
(function(e) {
|
|
4809
4854
|
e.IDLE = "idle", e.LOADING = "loading", e.PLAYING = "playing", e.PAUSED = "paused", e.ERROR = "error";
|
|
4810
4855
|
})($ ||= {});
|
|
4811
|
-
var
|
|
4856
|
+
var Yi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOffset === t.startOffset && e.endContainer === t.endContainer && e.endOffset === t.endOffset, Xi = (e, t) => e === t ? !0 : !e || !t || e.type !== t.type || e.quality !== t.quality ? !1 : e.type === "range" && t.type === "range" ? Yi(e.range, t.range) : e.type === "element" && t.type === "element" ? e.element === t.element : e.type === "text-range" && t.type === "text-range" ? e.node === t.node && e.startOffset === t.startOffset && e.endOffset === t.endOffset : !1, Zi = class e {
|
|
4812
4857
|
currentProvider = null;
|
|
4813
4858
|
provider = null;
|
|
4814
4859
|
highlightCoordinator = null;
|
|
@@ -4832,7 +4877,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
4832
4877
|
activeHighlightMode = "word";
|
|
4833
4878
|
lastRenderedRegionTarget = null;
|
|
4834
4879
|
telemetryReporter = null;
|
|
4835
|
-
generatedMathSpeechResolver =
|
|
4880
|
+
generatedMathSpeechResolver = ii();
|
|
4836
4881
|
static debugEnabled = (() => {
|
|
4837
4882
|
try {
|
|
4838
4883
|
if (typeof process < "u" && process.env?.PIE_TTS_DEBUG === "1") return !0;
|
|
@@ -4920,7 +4965,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
4920
4965
|
let i = n?.resolveWordRange?.(e, t);
|
|
4921
4966
|
if (i && this.isRangeWithinScope(i, r)) return {
|
|
4922
4967
|
range: i,
|
|
4923
|
-
remapped: !
|
|
4968
|
+
remapped: !Yi(e, i)
|
|
4924
4969
|
};
|
|
4925
4970
|
} catch {}
|
|
4926
4971
|
return {
|
|
@@ -5499,15 +5544,15 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5499
5544
|
let u = l, d = a(u);
|
|
5500
5545
|
if (d) {
|
|
5501
5546
|
i();
|
|
5502
|
-
let r = Z(u, this.getTextProcessingOptions(t.language)), a = r.visibleText || D(u.textContent || ""), c =
|
|
5547
|
+
let r = Z(u, this.getTextProcessingOptions(t.language)), a = r.visibleText || D(u.textContent || ""), c = Tn({
|
|
5503
5548
|
speechText: d.content,
|
|
5504
5549
|
visibleText: a
|
|
5505
|
-
}), l = o(u, a), f = l ?
|
|
5550
|
+
}), l = o(u, a), f = l ? Y({
|
|
5506
5551
|
mathElement: l,
|
|
5507
5552
|
speechText: d.content
|
|
5508
5553
|
}) : void 0, p = f ? void 0 : s(u).map((e) => ({
|
|
5509
5554
|
element: e,
|
|
5510
|
-
alignment:
|
|
5555
|
+
alignment: Y({
|
|
5511
5556
|
mathElement: e,
|
|
5512
5557
|
speechText: d.content
|
|
5513
5558
|
})
|
|
@@ -5516,7 +5561,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5516
5561
|
speechText: d.content,
|
|
5517
5562
|
visibleText: a,
|
|
5518
5563
|
sourceElement: u,
|
|
5519
|
-
regionElement:
|
|
5564
|
+
regionElement: Vi(u, e),
|
|
5520
5565
|
speechMatchesVisibleText: m === a,
|
|
5521
5566
|
playbackMode: c.playbackMode,
|
|
5522
5567
|
alignment: c,
|
|
@@ -5535,7 +5580,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5535
5580
|
return !e || e.providerId?.toLowerCase() === "browser" ? "plain" : e.getCapabilities?.().supportsSSML ? "ssml" : "plain";
|
|
5536
5581
|
}
|
|
5537
5582
|
async resolveGeneratedSpeechContent(e, t, n) {
|
|
5538
|
-
let r = this.resolveGeneratedPlaybackFormat(), { plan: i, containsMathMarkup: a, visibleText: o } = await
|
|
5583
|
+
let r = this.resolveGeneratedPlaybackFormat(), { plan: i, containsMathMarkup: a, visibleText: o } = await Ui({
|
|
5539
5584
|
contentRoot: e,
|
|
5540
5585
|
language: n,
|
|
5541
5586
|
mathSpeech: this.getMathSpeechOptions(),
|
|
@@ -5552,7 +5597,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5552
5597
|
containsMathMarkup: !1,
|
|
5553
5598
|
speechMatchesVisibleText: !0
|
|
5554
5599
|
};
|
|
5555
|
-
let c =
|
|
5600
|
+
let c = qi(i, { format: r }), l = i.plainSpeechText;
|
|
5556
5601
|
return {
|
|
5557
5602
|
contentToSpeak: l,
|
|
5558
5603
|
speechText: l,
|
|
@@ -5617,7 +5662,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5617
5662
|
this.highlightCoordinator && this.paintTTSWordRange(this.resolveWordHighlightRange(e).range);
|
|
5618
5663
|
}
|
|
5619
5664
|
highlightRenderableRegionTarget(e) {
|
|
5620
|
-
if (!(!this.highlightCoordinator || !e || typeof document > "u") && !(!this.highlightTargetResolverProvider &&
|
|
5665
|
+
if (!(!this.highlightCoordinator || !e || typeof document > "u") && !(!this.highlightTargetResolverProvider && Xi(this.lastRenderedRegionTarget, e))) try {
|
|
5621
5666
|
let t = document.createRange();
|
|
5622
5667
|
if (e.type === "element") t.selectNodeContents(e.element);
|
|
5623
5668
|
else if (e.type === "range") {
|
|
@@ -5673,10 +5718,10 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5673
5718
|
async speakCatalogChunkOnce(e, t) {
|
|
5674
5719
|
if (!this.provider) return;
|
|
5675
5720
|
this.lastRenderedRegionTarget = null;
|
|
5676
|
-
let n = e.regionElement || e.sourceElement || this.currentContentElement, r = n ?
|
|
5721
|
+
let n = e.regionElement || e.sourceElement || this.currentContentElement, r = n ? zi({
|
|
5677
5722
|
contentRoot: n,
|
|
5678
5723
|
chunks: [e]
|
|
5679
|
-
})[0] : null, i = this.ttsConfig.mathTokenHighlighting !== !1, a = r ?
|
|
5724
|
+
})[0] : null, i = this.ttsConfig.mathTokenHighlighting !== !1, a = r ? Ii({
|
|
5680
5725
|
chunks: [r],
|
|
5681
5726
|
mathTokenHighlighting: i
|
|
5682
5727
|
}) : null;
|
|
@@ -5813,7 +5858,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5813
5858
|
this.provider && (this.speakRunId += 1, this.provider.onWordBoundary = void 0, this.provider.stop(), this.highlightTargetResolverProvider = null, this.setState($.IDLE), this.currentText = null, this.highlightCoordinator && this.highlightCoordinator.clearTTS(), this.lastRenderedRegionTarget = null, this.currentContentElement = null, this.normalizedToDOM.clear(), this.currentBoundaryOffset = 0, this.activeWordBoundaryOffset = 0, this.seekSegments = [], this.playbackChunks = [], this.sentenceHighlightSegments = [], this.currentSeekSegmentIndex = 0, this.activeSentenceStartOffset = null);
|
|
5814
5859
|
}
|
|
5815
5860
|
requestControlHandoff() {
|
|
5816
|
-
typeof window > "u" || window.dispatchEvent(new CustomEvent(
|
|
5861
|
+
typeof window > "u" || window.dispatchEvent(new CustomEvent(Ji, { detail: { source: "host" } }));
|
|
5817
5862
|
}
|
|
5818
5863
|
isPlaying() {
|
|
5819
5864
|
return this.state === $.PLAYING;
|
|
@@ -5883,7 +5928,7 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5883
5928
|
state: e
|
|
5884
5929
|
});
|
|
5885
5930
|
}
|
|
5886
|
-
},
|
|
5931
|
+
}, Qi = class {
|
|
5887
5932
|
provenance;
|
|
5888
5933
|
stepCounter = 0;
|
|
5889
5934
|
constructor(e) {
|
|
@@ -5995,12 +6040,12 @@ var Zi = (e, t) => e === t || e.startContainer === t.startContainer && e.startOf
|
|
|
5995
6040
|
return this;
|
|
5996
6041
|
}
|
|
5997
6042
|
build() {
|
|
5998
|
-
for (let e of this.provenance.features.values()) e.explanation =
|
|
6043
|
+
for (let e of this.provenance.features.values()) e.explanation = $i(e);
|
|
5999
6044
|
for (let e of this.provenance.features.values()) this.provenance.summary.totalFeatures++, e.finalState === "enabled" ? this.provenance.summary.enabled++ : e.finalState === "blocked" ? this.provenance.summary.blocked++ : this.provenance.summary.notConfigured++;
|
|
6000
6045
|
return this.provenance;
|
|
6001
6046
|
}
|
|
6002
6047
|
};
|
|
6003
|
-
function
|
|
6048
|
+
function $i(e) {
|
|
6004
6049
|
if (!e.winningDecision) {
|
|
6005
6050
|
if (e.finalState === "advisory-only") {
|
|
6006
6051
|
let t = e.allDecisions.find((e) => e.action === "advisory");
|
|
@@ -6018,9 +6063,9 @@ function ta(e) {
|
|
|
6018
6063
|
return r;
|
|
6019
6064
|
}
|
|
6020
6065
|
//#endregion
|
|
6021
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
6022
|
-
function
|
|
6023
|
-
let { request: t, tools: n, pnpPolicy: r, customSources: i, contextId: a } = e, o = new
|
|
6066
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/policy/core/compose-decision.js
|
|
6067
|
+
function ea(e) {
|
|
6068
|
+
let { request: t, tools: n, pnpPolicy: r, customSources: i, contextId: a } = e, o = new Qi(a);
|
|
6024
6069
|
o.addSource("host", {
|
|
6025
6070
|
id: t.scope.scopeId,
|
|
6026
6071
|
name: `${t.level}:${t.scope.scopeId}`,
|
|
@@ -6088,7 +6133,7 @@ function na(e) {
|
|
|
6088
6133
|
for (let e of Array.from(f.keys())) m.blockedToolIds.has(e) && f.delete(e);
|
|
6089
6134
|
for (let e of m.mandatedToolIds) {
|
|
6090
6135
|
if (p.has(e)) continue;
|
|
6091
|
-
let r = m.perToolFlags.get(e)?.rule ?? "required-tool", i =
|
|
6136
|
+
let r = m.perToolFlags.get(e)?.rule ?? "required-tool", i = ta(e, {
|
|
6092
6137
|
placement: s,
|
|
6093
6138
|
allowed: c,
|
|
6094
6139
|
blocked: l,
|
|
@@ -6160,7 +6205,7 @@ function na(e) {
|
|
|
6160
6205
|
}
|
|
6161
6206
|
for (let e of r) s.has(e) || f.delete(e);
|
|
6162
6207
|
}
|
|
6163
|
-
let h = new Set(u),
|
|
6208
|
+
let h = new Set(u), g = u.map((e) => {
|
|
6164
6209
|
let t = m?.perToolFlags.get(e);
|
|
6165
6210
|
return {
|
|
6166
6211
|
toolId: e,
|
|
@@ -6171,12 +6216,12 @@ function na(e) {
|
|
|
6171
6216
|
};
|
|
6172
6217
|
});
|
|
6173
6218
|
return o.reconcileFinalStates(h), {
|
|
6174
|
-
visibleTools:
|
|
6219
|
+
visibleTools: g,
|
|
6175
6220
|
diagnostics: d,
|
|
6176
6221
|
provenance: o.build()
|
|
6177
6222
|
};
|
|
6178
6223
|
}
|
|
6179
|
-
function
|
|
6224
|
+
function ta(e, t) {
|
|
6180
6225
|
return t.placement.includes(e) ? t.providers?.[e]?.enabled === !1 ? {
|
|
6181
6226
|
hostRule: "provider-disabled",
|
|
6182
6227
|
hostValue: !1
|
|
@@ -6195,8 +6240,8 @@ function ra(e, t) {
|
|
|
6195
6240
|
};
|
|
6196
6241
|
}
|
|
6197
6242
|
//#endregion
|
|
6198
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
6199
|
-
function
|
|
6243
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/policy/core/pnp-policy-inputs.js
|
|
6244
|
+
function na(e) {
|
|
6200
6245
|
if (!e) return !1;
|
|
6201
6246
|
let t = e.personalNeedsProfile;
|
|
6202
6247
|
if (t && (Array.isArray(t.supports) && t.supports.length > 0 || Array.isArray(t.prohibitedSupports) && t.prohibitedSupports.length > 0 || Array.isArray(t.activateAtInit) && t.activateAtInit.length > 0)) return !0;
|
|
@@ -6212,16 +6257,16 @@ function ia(e) {
|
|
|
6212
6257
|
}
|
|
6213
6258
|
return !1;
|
|
6214
6259
|
}
|
|
6215
|
-
function
|
|
6260
|
+
function ra(e) {
|
|
6216
6261
|
let t = e?.settings;
|
|
6217
6262
|
return t ? !!(Array.isArray(t.requiredTools) && t.requiredTools.length > 0 || Array.isArray(t.restrictedTools) && t.restrictedTools.length > 0 || t.toolParameters && typeof t.toolParameters == "object" && Object.keys(t.toolParameters).length > 0) : !1;
|
|
6218
6263
|
}
|
|
6219
|
-
function
|
|
6220
|
-
return
|
|
6264
|
+
function ia(e) {
|
|
6265
|
+
return na(e.assessment) || ra(e.currentItemRef) ? "on" : "off";
|
|
6221
6266
|
}
|
|
6222
6267
|
//#endregion
|
|
6223
|
-
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.
|
|
6224
|
-
var
|
|
6268
|
+
//#region ../../node_modules/.bun/@pie-players+pie-assessment-toolkit@0.3.63+aad50156ca4f9ae2/node_modules/@pie-players/pie-assessment-toolkit/dist/policy/sources/PnpPolicySource.js
|
|
6269
|
+
var aa = class {
|
|
6225
6270
|
id = "pnp";
|
|
6226
6271
|
toolRegistry;
|
|
6227
6272
|
constructor(e) {
|
|
@@ -6388,7 +6433,7 @@ var sa = class {
|
|
|
6388
6433
|
resolveToolSettings(e, t) {
|
|
6389
6434
|
return t.itemSettings?.toolParameters?.[e] ?? t.toolConfigs?.[e];
|
|
6390
6435
|
}
|
|
6391
|
-
},
|
|
6436
|
+
}, oa = xe({
|
|
6392
6437
|
policy: {
|
|
6393
6438
|
allowed: [],
|
|
6394
6439
|
blocked: []
|
|
@@ -6399,7 +6444,7 @@ var sa = class {
|
|
|
6399
6444
|
passage: []
|
|
6400
6445
|
},
|
|
6401
6446
|
providers: {}
|
|
6402
|
-
}),
|
|
6447
|
+
}), sa = class {
|
|
6403
6448
|
toolRegistry;
|
|
6404
6449
|
contextId;
|
|
6405
6450
|
pnpPolicySource;
|
|
@@ -6411,9 +6456,9 @@ var sa = class {
|
|
|
6411
6456
|
pnpEnforcement;
|
|
6412
6457
|
disposed = !1;
|
|
6413
6458
|
constructor(e) {
|
|
6414
|
-
this.toolRegistry = e.toolRegistry, this.contextId = e.contextId ?? "tool-policy", this.pnpPolicySource = new
|
|
6459
|
+
this.toolRegistry = e.toolRegistry, this.contextId = e.contextId ?? "tool-policy", this.pnpPolicySource = new aa(this.toolRegistry), this.customSources = e.customSources ? [...e.customSources] : [];
|
|
6415
6460
|
let t = e.inputs ?? {};
|
|
6416
|
-
this.tools = t.tools ??
|
|
6461
|
+
this.tools = t.tools ?? oa, this.assessment = t.assessment ?? null, this.currentItemRef = t.currentItemRef ?? null, this.pnpEnforcement = t.pnpEnforcement ?? ia({
|
|
6417
6462
|
assessment: this.assessment,
|
|
6418
6463
|
currentItemRef: this.currentItemRef
|
|
6419
6464
|
});
|
|
@@ -6421,7 +6466,7 @@ var sa = class {
|
|
|
6421
6466
|
decide(e) {
|
|
6422
6467
|
this.assertNotDisposed();
|
|
6423
6468
|
let t = e.scope.scopeId ? `${this.contextId}:${e.level}:${e.scope.scopeId}` : `${this.contextId}:${e.level}`;
|
|
6424
|
-
return
|
|
6469
|
+
return ea({
|
|
6425
6470
|
request: e,
|
|
6426
6471
|
tools: this.tools,
|
|
6427
6472
|
pnpPolicy: {
|
|
@@ -6447,7 +6492,7 @@ var sa = class {
|
|
|
6447
6492
|
this.assertNotDisposed();
|
|
6448
6493
|
let t = !1, n = !1;
|
|
6449
6494
|
if ("tools" in e) {
|
|
6450
|
-
let n = e.tools ??
|
|
6495
|
+
let n = e.tools ?? oa;
|
|
6451
6496
|
Object.is(this.tools, n) || (this.tools = n, t = !0);
|
|
6452
6497
|
}
|
|
6453
6498
|
if ("assessment" in e) {
|
|
@@ -6505,32 +6550,32 @@ var sa = class {
|
|
|
6505
6550
|
assertNotDisposed() {
|
|
6506
6551
|
if (this.disposed) throw Error("ToolPolicyEngine has been disposed.");
|
|
6507
6552
|
}
|
|
6508
|
-
},
|
|
6553
|
+
}, ca = (e) => !!e && typeof e == "object" && !Array.isArray(e), la = (e, t, n) => {
|
|
6509
6554
|
let r = {
|
|
6510
6555
|
...t,
|
|
6511
6556
|
...n
|
|
6512
6557
|
};
|
|
6513
|
-
return e === "textToSpeech" &&
|
|
6558
|
+
return e === "textToSpeech" && ca(t.settings) && ca(n.settings) && (r.settings = {
|
|
6514
6559
|
...t.settings,
|
|
6515
6560
|
...n.settings
|
|
6516
|
-
},
|
|
6561
|
+
}, ca(t.settings.mathSpeech) && ca(n.settings.mathSpeech) && (r.settings.mathSpeech = {
|
|
6517
6562
|
...t.settings.mathSpeech,
|
|
6518
6563
|
...n.settings.mathSpeech
|
|
6519
6564
|
})), r;
|
|
6520
|
-
},
|
|
6565
|
+
}, ua = [
|
|
6521
6566
|
"item-selected",
|
|
6522
6567
|
"item-session-data-changed",
|
|
6523
6568
|
"item-session-meta-changed",
|
|
6524
6569
|
"item-complete-changed",
|
|
6525
6570
|
"content-loaded",
|
|
6526
6571
|
"item-player-error"
|
|
6527
|
-
],
|
|
6572
|
+
], da = [
|
|
6528
6573
|
"section-navigation-change",
|
|
6529
6574
|
"section-session-applied",
|
|
6530
6575
|
"section-loading-complete",
|
|
6531
6576
|
"section-items-complete-changed",
|
|
6532
6577
|
"section-error"
|
|
6533
|
-
],
|
|
6578
|
+
], fa = class e {
|
|
6534
6579
|
assessmentId;
|
|
6535
6580
|
config;
|
|
6536
6581
|
ttsService;
|
|
@@ -6568,7 +6613,7 @@ var sa = class {
|
|
|
6568
6613
|
boundAssessment = null;
|
|
6569
6614
|
boundCurrentItemRef = null;
|
|
6570
6615
|
static resolveConfig(e) {
|
|
6571
|
-
let t =
|
|
6616
|
+
let t = Yt(e.toolConfigStrictness), n = e.toolRegistry ?? I(), r = e.deferToolConfigValidation === !0 ? xe(e.tools) : R(e.tools, {
|
|
6572
6617
|
strictness: t,
|
|
6573
6618
|
source: "ToolkitCoordinator.init",
|
|
6574
6619
|
toolRegistry: n
|
|
@@ -6600,7 +6645,7 @@ var sa = class {
|
|
|
6600
6645
|
constructor(t) {
|
|
6601
6646
|
if (!t.assessmentId) throw Error("ToolkitCoordinator requires assessmentId in config");
|
|
6602
6647
|
let n = e.resolveConfig(t);
|
|
6603
|
-
this.assessmentId = n.assessmentId, this.config = n, this.toolRegistry = n.toolRegistry ??
|
|
6648
|
+
this.assessmentId = n.assessmentId, this.config = n, this.toolRegistry = n.toolRegistry ?? I(), this.installToolContextResolvers(n.toolContextResolvers), this.hooks = n.hooks ?? {}, this.lazyInit = t.lazyInit === !0, this.pnpEnforcementOverride = this.resolveConfiguredPnpEnforcement(), this.frameworkErrorBus = t.frameworkErrorBus ?? new sn(), this.ownsFrameworkErrorBus = !t.frameworkErrorBus, this.subscribeFrameworkErrorHookAdapters(), this.toolCoordinator = new on(), this.highlightCoordinator = new de(), this.elementToolStateStore = new le(), this.catalogResolver = new ce(n.accessibility?.catalogs || [], n.accessibility?.language || "en-US"), this.toolProviderRegistry = new Le(), this._registerToolProviders(), this.ttsService = new Zi(), this.setupStatePersistenceHooks(), this.policyEngine = new sa({
|
|
6604
6649
|
toolRegistry: this.toolRegistry,
|
|
6605
6650
|
contextId: `toolkit-coordinator:${this.assessmentId}`,
|
|
6606
6651
|
inputs: {
|
|
@@ -6647,7 +6692,7 @@ var sa = class {
|
|
|
6647
6692
|
}
|
|
6648
6693
|
}
|
|
6649
6694
|
handleError(e, t) {
|
|
6650
|
-
let n =
|
|
6695
|
+
let n = qt({
|
|
6651
6696
|
error: e,
|
|
6652
6697
|
context: t
|
|
6653
6698
|
});
|
|
@@ -6929,14 +6974,14 @@ var sa = class {
|
|
|
6929
6974
|
}
|
|
6930
6975
|
subscribeItemEvents(e) {
|
|
6931
6976
|
return this.subscribeSectionEvents({
|
|
6932
|
-
eventTypes: e.eventTypes ||
|
|
6977
|
+
eventTypes: e.eventTypes || ua,
|
|
6933
6978
|
itemIds: e.itemIds,
|
|
6934
6979
|
listener: e.listener
|
|
6935
6980
|
});
|
|
6936
6981
|
}
|
|
6937
6982
|
subscribeSectionLifecycleEvents(e) {
|
|
6938
6983
|
return this.subscribeSectionEvents({
|
|
6939
|
-
eventTypes: e.eventTypes ||
|
|
6984
|
+
eventTypes: e.eventTypes || da,
|
|
6940
6985
|
listener: e.listener
|
|
6941
6986
|
});
|
|
6942
6987
|
}
|
|
@@ -7078,7 +7123,7 @@ var sa = class {
|
|
|
7078
7123
|
}
|
|
7079
7124
|
async _initializeTTS(e) {
|
|
7080
7125
|
if (this.ttsInitialized) return;
|
|
7081
|
-
let t =
|
|
7126
|
+
let t = At(this.resolveTTSToolConfig(e)), n = jt(t), r = Pt(t);
|
|
7082
7127
|
if (await this.hooks.onBeforeTTSInit?.({
|
|
7083
7128
|
phase: "tts-init",
|
|
7084
7129
|
details: { backend: n }
|
|
@@ -7241,15 +7286,15 @@ var sa = class {
|
|
|
7241
7286
|
updateToolConfig(e, t) {
|
|
7242
7287
|
this.assertCanonicalToolId(e);
|
|
7243
7288
|
let n = this.getToolConfig(e) || {};
|
|
7244
|
-
this.config.tools || (this.config.tools =
|
|
7289
|
+
this.config.tools || (this.config.tools = R(void 0, {
|
|
7245
7290
|
strictness: this.config.toolConfigStrictness ?? "error",
|
|
7246
7291
|
source: "ToolkitCoordinator.updateToolConfig",
|
|
7247
7292
|
toolRegistry: this.toolRegistry
|
|
7248
7293
|
}).config), this.config.tools.providers || (this.config.tools.providers = {});
|
|
7249
7294
|
let r = {
|
|
7250
7295
|
...this.config.tools.providers || {},
|
|
7251
|
-
[e]:
|
|
7252
|
-
}, i =
|
|
7296
|
+
[e]: la(e, n, t)
|
|
7297
|
+
}, i = R({
|
|
7253
7298
|
...this.config.tools,
|
|
7254
7299
|
providers: r
|
|
7255
7300
|
}, {
|
|
@@ -7263,7 +7308,7 @@ var sa = class {
|
|
|
7263
7308
|
this.updateToolsPlacement({ [e]: [...t] });
|
|
7264
7309
|
}
|
|
7265
7310
|
updateToolsPlacement(e) {
|
|
7266
|
-
this.config.tools || (this.config.tools =
|
|
7311
|
+
this.config.tools || (this.config.tools = R(void 0, {
|
|
7267
7312
|
strictness: this.config.toolConfigStrictness ?? "error",
|
|
7268
7313
|
source: "ToolkitCoordinator.updateToolsPlacement",
|
|
7269
7314
|
toolRegistry: this.toolRegistry
|
|
@@ -7276,7 +7321,7 @@ var sa = class {
|
|
|
7276
7321
|
section: [...e.section ?? t.section ?? []],
|
|
7277
7322
|
item: [...e.item ?? t.item ?? []],
|
|
7278
7323
|
passage: [...e.passage ?? t.passage ?? []]
|
|
7279
|
-
}, r =
|
|
7324
|
+
}, r = R({
|
|
7280
7325
|
...this.config.tools,
|
|
7281
7326
|
placement: n
|
|
7282
7327
|
}, {
|
|
@@ -7356,7 +7401,7 @@ var sa = class {
|
|
|
7356
7401
|
};
|
|
7357
7402
|
}
|
|
7358
7403
|
resolveEffectivePnpEnforcement() {
|
|
7359
|
-
return this.pnpEnforcementOverride === null ?
|
|
7404
|
+
return this.pnpEnforcementOverride === null ? ia({
|
|
7360
7405
|
assessment: this.boundAssessment,
|
|
7361
7406
|
currentItemRef: this.boundCurrentItemRef
|
|
7362
7407
|
}) : this.pnpEnforcementOverride;
|
|
@@ -7390,6 +7435,6 @@ var sa = class {
|
|
|
7390
7435
|
}
|
|
7391
7436
|
};
|
|
7392
7437
|
//#endregion
|
|
7393
|
-
export {
|
|
7438
|
+
export { p as a, o as c, M as i, a as l, Ji as n, d as o, I as r, f as s, fa as t };
|
|
7394
7439
|
|
|
7395
|
-
//# sourceMappingURL=dist-
|
|
7440
|
+
//# sourceMappingURL=dist-oe9UH-A2.js.map
|