@readium/speech 0.17.0 → 0.18.0
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/build/index.js +735 -709
- package/build/preferences/SpeechDefaults.d.ts +2 -0
- package/build/preferences/SpeechPreferences.d.ts +2 -0
- package/build/preferences/SpeechPreferencesEditor.d.ts +2 -1
- package/build/preferences/SpeechSettings.d.ts +1 -0
- package/build/speechNavigator.d.ts +1 -0
- package/build/utterances/types.d.ts +1 -0
- package/build/utterances/walkContext.d.ts +1 -0
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { DecorationController as
|
|
1
|
+
import { DecorationController as Ps, DirectCommsChannel as As, Decorator as Ls } from "@readium/decorator";
|
|
2
2
|
export * from "@readium/decorator";
|
|
3
|
-
import { LocatorText as
|
|
4
|
-
import { Locator as
|
|
5
|
-
import { startsWithBindingPunct as fe, ssmlTextEscape as
|
|
6
|
-
import
|
|
7
|
-
import { substitutedOwnSelector as
|
|
8
|
-
import { DomRange as
|
|
3
|
+
import { LocatorText as Os, LocatorLocations as Vs, Locator as Ts } from "@readium/shared";
|
|
4
|
+
import { Locator as jr, LocatorLocations as Fr, LocatorText as _r } from "@readium/shared";
|
|
5
|
+
import { startsWithBindingPunct as fe, ssmlTextEscape as M, BINDING_PUNCT_CLASS as re, ssmlAttrEscape as wn } from "@readium/helpers";
|
|
6
|
+
import Us from "i18next";
|
|
7
|
+
import { substitutedOwnSelector as xs, isAriaSubstituted as H, decodeTextref as Bt, combineDomRangeTextrefs as Ns } from "@readium/guided-navigation";
|
|
8
|
+
import { DomRange as zs, DomRangePoint as Dt } from "@readium/shared/html";
|
|
9
9
|
const R = (n) => {
|
|
10
10
|
if (!n) return ["", void 0];
|
|
11
11
|
const e = n.replace(/_/g, "-");
|
|
@@ -28,7 +28,7 @@ const R = (n) => {
|
|
|
28
28
|
const r = i.find(([o]) => o.toLowerCase().replace(/_/g, "-") === a);
|
|
29
29
|
if (r) return r[1];
|
|
30
30
|
}
|
|
31
|
-
},
|
|
31
|
+
}, kn = (n, e) => {
|
|
32
32
|
const t = e.toLowerCase().replace(/_/g, "-"), [s] = R(e);
|
|
33
33
|
let i;
|
|
34
34
|
for (const a of [s, t])
|
|
@@ -422,16 +422,16 @@ const R = (n) => {
|
|
|
422
422
|
],
|
|
423
423
|
testUtterance: "你好,我叫 {name},係越中文聲。"
|
|
424
424
|
}
|
|
425
|
-
},
|
|
426
|
-
async function
|
|
425
|
+
}, Fe = /* @__PURE__ */ new Map(), Ms = /* @__PURE__ */ Object.assign({ "../../json/ar.json": () => import("./ar-BGKtJRyt.js"), "../../json/bg.json": () => import("./bg-D9Q1JriY.js"), "../../json/bho.json": () => import("./bho-CpuLBMN3.js"), "../../json/bn.json": () => import("./bn-Bpn_lzoe.js"), "../../json/ca.json": () => import("./ca-5hzouNcE.js"), "../../json/cmn.json": () => import("./cmn-DlnYMCd8.js"), "../../json/cs.json": () => import("./cs-CDpMkMNO.js"), "../../json/da.json": () => import("./da-XWCfWAwB.js"), "../../json/de.json": () => import("./de-DU0USiOh.js"), "../../json/el.json": () => import("./el-ClBwbIAW.js"), "../../json/en.json": () => import("./en-l3wcpTw3.js"), "../../json/es.json": () => import("./es-DwOFJY07.js"), "../../json/eu.json": () => import("./eu-DxWirHU-.js"), "../../json/fa.json": () => import("./fa-Ml9KtIw1.js"), "../../json/fi.json": () => import("./fi-Dk-5Fhhl.js"), "../../json/fr.json": () => import("./fr-MfhjukJ4.js"), "../../json/gl.json": () => import("./gl-DwtzWds9.js"), "../../json/he.json": () => import("./he-CfajFNE_.js"), "../../json/hi.json": () => import("./hi-pv2ttBoh.js"), "../../json/hr.json": () => import("./hr-MRApcEKR.js"), "../../json/hu.json": () => import("./hu-DGRDZdHH.js"), "../../json/id.json": () => import("./id-DZUuUiTG.js"), "../../json/it.json": () => import("./it-DJUYnjyj.js"), "../../json/ja.json": () => import("./ja-BpFcZRMu.js"), "../../json/kk.json": () => import("./kk-C480t1iH.js"), "../../json/kn.json": () => import("./kn-BVqs26qv.js"), "../../json/ko.json": () => import("./ko-TNoPZd6N.js"), "../../json/mr.json": () => import("./mr-DstAHTvT.js"), "../../json/ms.json": () => import("./ms-BceBSD-j.js"), "../../json/nb.json": () => import("./nb-CwPbwG-i.js"), "../../json/nl.json": () => import("./nl-BmW-Dmw5.js"), "../../json/pl.json": () => import("./pl-CH8qoDu8.js"), "../../json/pt.json": () => import("./pt-CjCENn24.js"), "../../json/ro.json": () => import("./ro-BlJN7qkA.js"), "../../json/ru.json": () => import("./ru-udzq1D5e.js"), "../../json/sk.json": () => import("./sk-VAEHsTWJ.js"), "../../json/sl.json": () => import("./sl-DaZQ1gp0.js"), "../../json/sv.json": () => import("./sv-CicHwXe4.js"), "../../json/ta.json": () => import("./ta-CvpRY89g.js"), "../../json/te.json": () => import("./te-D5TcdW9V.js"), "../../json/th.json": () => import("./th-CYakoFVa.js"), "../../json/tr.json": () => import("./tr-BfYrcAz7.js"), "../../json/uk.json": () => import("./uk-BVs6lQbX.js"), "../../json/vi.json": () => import("./vi-DP1xN9KL.js"), "../../json/wuu.json": () => import("./wuu-C6uQvT6g.js"), "../../json/yue.json": () => import("./yue-C8kEWdfv.js") });
|
|
426
|
+
async function Bs(n) {
|
|
427
427
|
try {
|
|
428
|
-
const e = n.split("-")[0], t =
|
|
428
|
+
const e = n.split("-")[0], t = Ms[`../../json/${e}.json`];
|
|
429
429
|
if (!t)
|
|
430
430
|
throw new Error(`No voice data found for language: ${n}`);
|
|
431
431
|
const i = (await t()).default;
|
|
432
432
|
return {
|
|
433
433
|
...i,
|
|
434
|
-
voices: i.voices.map(
|
|
434
|
+
voices: i.voices.map(Fs)
|
|
435
435
|
};
|
|
436
436
|
} catch (e) {
|
|
437
437
|
return console.warn(`Failed to load voice data for ${n}:`, e), {
|
|
@@ -442,13 +442,13 @@ async function Ns(n) {
|
|
|
442
442
|
};
|
|
443
443
|
}
|
|
444
444
|
}
|
|
445
|
-
function
|
|
446
|
-
return
|
|
445
|
+
function jt(n) {
|
|
446
|
+
return Fe.has(n) || Fe.set(n, Bs(n)), Fe.get(n);
|
|
447
447
|
}
|
|
448
|
-
const
|
|
448
|
+
const Ds = ["veryLow", "low", "normal", "high", "veryHigh"], js = ["android", "apple"], Fs = (n) => ({
|
|
449
449
|
...n,
|
|
450
|
-
quality: n.quality?.filter((e) =>
|
|
451
|
-
localizedName: n.localizedName &&
|
|
450
|
+
quality: n.quality?.filter((e) => Ds.includes(e)),
|
|
451
|
+
localizedName: n.localizedName && js.includes(n.localizedName) ? n.localizedName : void 0
|
|
452
452
|
}), ce = {
|
|
453
453
|
cmn: "cmn",
|
|
454
454
|
"cmn-CN": "cmn-CN",
|
|
@@ -469,12 +469,12 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
469
469
|
e = `${t.toLowerCase()}-${s.toUpperCase()}`;
|
|
470
470
|
}
|
|
471
471
|
return ce[e] || e;
|
|
472
|
-
},
|
|
472
|
+
}, We = async (n) => {
|
|
473
473
|
if (!n) return [];
|
|
474
474
|
try {
|
|
475
475
|
const e = T(n);
|
|
476
476
|
try {
|
|
477
|
-
const s = await
|
|
477
|
+
const s = await jt(e);
|
|
478
478
|
if (s?.voices?.length)
|
|
479
479
|
return s.voices;
|
|
480
480
|
} catch (s) {
|
|
@@ -483,7 +483,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
483
483
|
const [t] = R(e);
|
|
484
484
|
if (t !== e)
|
|
485
485
|
try {
|
|
486
|
-
const s = await
|
|
486
|
+
const s = await jt(t);
|
|
487
487
|
if (s?.voices?.length)
|
|
488
488
|
return s.voices;
|
|
489
489
|
} catch (s) {
|
|
@@ -493,7 +493,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
493
493
|
} catch (e) {
|
|
494
494
|
return console.error(`Error in getVoices for ${n}:`, e), [];
|
|
495
495
|
}
|
|
496
|
-
},
|
|
496
|
+
}, Qe = (n, e) => {
|
|
497
497
|
try {
|
|
498
498
|
return new Intl.DisplayNames(
|
|
499
499
|
e ? [e] : [],
|
|
@@ -502,7 +502,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
502
502
|
} catch {
|
|
503
503
|
return n.toUpperCase();
|
|
504
504
|
}
|
|
505
|
-
},
|
|
505
|
+
}, Ft = (n) => {
|
|
506
506
|
if (!n) return "";
|
|
507
507
|
try {
|
|
508
508
|
const e = T(n), t = j[e];
|
|
@@ -518,7 +518,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
518
518
|
} catch (e) {
|
|
519
519
|
return console.error(`Error in getTestUtterance for ${n}:`, e), "";
|
|
520
520
|
}
|
|
521
|
-
},
|
|
521
|
+
}, Ue = (n) => {
|
|
522
522
|
if (!n) return "";
|
|
523
523
|
try {
|
|
524
524
|
const e = T(n), t = j[e];
|
|
@@ -542,7 +542,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
542
542
|
} catch (e) {
|
|
543
543
|
return console.error(`Failed to get default region for ${n}:`, e), "";
|
|
544
544
|
}
|
|
545
|
-
},
|
|
545
|
+
}, xe = (n) => {
|
|
546
546
|
if (!n?.length) return [];
|
|
547
547
|
const e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
548
548
|
for (const [i, a] of n.entries()) {
|
|
@@ -560,7 +560,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
560
560
|
return h - f;
|
|
561
561
|
});
|
|
562
562
|
if (c.length === 0) {
|
|
563
|
-
const u =
|
|
563
|
+
const u = Ue(i), [, d] = R(u);
|
|
564
564
|
d && c.push(d);
|
|
565
565
|
}
|
|
566
566
|
return {
|
|
@@ -577,7 +577,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
577
577
|
}
|
|
578
578
|
const t = /* @__PURE__ */ new Map();
|
|
579
579
|
for (const [s, i] of e.entries()) {
|
|
580
|
-
const a = /* @__PURE__ */ new Map(), r = await
|
|
580
|
+
const a = /* @__PURE__ */ new Map(), r = await We(s), o = /* @__PURE__ */ new Map();
|
|
581
581
|
r.forEach((l, c) => {
|
|
582
582
|
o.set(l.name.toLowerCase(), c), l.altNames?.forEach((u) => {
|
|
583
583
|
o.set(u.toLowerCase(), c);
|
|
@@ -590,13 +590,13 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
590
590
|
a.size > 0 && t.set(s, a);
|
|
591
591
|
}
|
|
592
592
|
return t;
|
|
593
|
-
},
|
|
593
|
+
}, _s = {
|
|
594
594
|
veryLow: 1,
|
|
595
595
|
low: 2,
|
|
596
596
|
normal: 3,
|
|
597
597
|
high: 4,
|
|
598
598
|
veryHigh: 5
|
|
599
|
-
}, ke = (n) => n ?
|
|
599
|
+
}, ke = (n) => n ? _s[n] ?? 0 : 0, Q = (n, e, t, s) => {
|
|
600
600
|
const i = ke(n.quality), a = ke(e.quality);
|
|
601
601
|
if (t && s && n.source === "json" && e.source === "json") {
|
|
602
602
|
const r = t.get(s);
|
|
@@ -607,14 +607,14 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
607
607
|
}
|
|
608
608
|
}
|
|
609
609
|
return a !== i ? a - i : n.name.localeCompare(e.name);
|
|
610
|
-
},
|
|
610
|
+
}, Ne = (n, e) => {
|
|
611
611
|
const t = new Map(e.map((a) => [a.baseLang, a])), s = /* @__PURE__ */ new Map(), i = [];
|
|
612
612
|
for (const a of n) {
|
|
613
613
|
const [r] = R(a.language);
|
|
614
614
|
t.get(r) ? (s.has(r) || s.set(r, []), s.get(r).push(a)) : i.push(a);
|
|
615
615
|
}
|
|
616
616
|
return { voicesByLang: s, otherLangVoices: i };
|
|
617
|
-
},
|
|
617
|
+
}, Cn = (n, e, t, s) => {
|
|
618
618
|
const [, i] = R(n.language), [, a] = R(e.language), r = i && t.regions.includes(i), o = a && t.regions.includes(a);
|
|
619
619
|
if (r && o) {
|
|
620
620
|
const h = t.regions.indexOf(i), f = t.regions.indexOf(a);
|
|
@@ -622,7 +622,7 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
622
622
|
}
|
|
623
623
|
if (r) return -1;
|
|
624
624
|
if (o) return 1;
|
|
625
|
-
const l =
|
|
625
|
+
const l = Ue(t.baseLang), [, c] = R(l), u = !!c && i === c, d = !!c && a === c;
|
|
626
626
|
if (u && !d) return -1;
|
|
627
627
|
if (!u && d) return 1;
|
|
628
628
|
if (i && a) {
|
|
@@ -630,15 +630,15 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
630
630
|
return h !== 0 ? h : Q(n, e, s, t.baseLang);
|
|
631
631
|
}
|
|
632
632
|
return i ? -1 : a ? 1 : Q(n, e, s, t.baseLang);
|
|
633
|
-
},
|
|
633
|
+
}, $s = async (n, e, t) => {
|
|
634
634
|
const s = t ?? await ee(n);
|
|
635
|
-
n.sort((i, a) =>
|
|
636
|
-
},
|
|
637
|
-
const [s] = R(n.language), [i] = R(e.language), a =
|
|
635
|
+
n.sort((i, a) => Cn(i, a, e, s));
|
|
636
|
+
}, En = (n, e, t) => {
|
|
637
|
+
const [s] = R(n.language), [i] = R(e.language), a = Qe(s).toLowerCase(), r = Qe(i).toLowerCase(), o = a.localeCompare(r);
|
|
638
638
|
if (o !== 0)
|
|
639
639
|
return o;
|
|
640
640
|
if (s === i) {
|
|
641
|
-
const l =
|
|
641
|
+
const l = Ue(s), [, c] = R(n.language), [, u] = R(e.language), d = l && c === l.split("-")[1], h = l && u === l.split("-")[1];
|
|
642
642
|
if (d && !h) return -1;
|
|
643
643
|
if (!d && h) return 1;
|
|
644
644
|
if (c && u) {
|
|
@@ -649,33 +649,33 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
649
649
|
return c && !u ? -1 : !c && u ? 1 : Q(n, e, t, s);
|
|
650
650
|
}
|
|
651
651
|
return Q(n, e, t, s);
|
|
652
|
-
},
|
|
652
|
+
}, Je = async (n, e) => {
|
|
653
653
|
const t = e ?? await ee(n);
|
|
654
|
-
n.sort((s, i) =>
|
|
655
|
-
},
|
|
654
|
+
n.sort((s, i) => En(s, i, t));
|
|
655
|
+
}, Rn = async (n, e) => {
|
|
656
656
|
if (!e?.length) return [];
|
|
657
|
-
const t =
|
|
657
|
+
const t = xe(n || []), { voicesByLang: s, otherLangVoices: i } = Ne(e, t), a = await ee(e), r = [];
|
|
658
658
|
for (const o of t) {
|
|
659
659
|
const l = s.get(o.baseLang);
|
|
660
|
-
l && (await
|
|
660
|
+
l && (await $s(l, o, a), r.push(...l));
|
|
661
661
|
}
|
|
662
|
-
return await
|
|
663
|
-
},
|
|
662
|
+
return await Je(i, a), r.push(...i), r;
|
|
663
|
+
}, In = async (n, e) => {
|
|
664
664
|
if (!e.length) return null;
|
|
665
|
-
const [t] =
|
|
665
|
+
const [t] = xe([n]), { voicesByLang: s, otherLangVoices: i } = Ne(e, [t]), a = s.get(t.baseLang), r = a?.length ? a : i, o = await ee(e), l = a?.length ? (c, u) => Cn(c, u, t, o) : (c, u) => En(c, u, o);
|
|
666
666
|
return r.reduce((c, u) => l(u, c) < 0 ? u : c);
|
|
667
667
|
}, ht = (n, e) => {
|
|
668
668
|
const t = n.filter((s) => s.controls?.boundary !== !1 === e);
|
|
669
669
|
return t.length > 0 ? t : n;
|
|
670
|
-
},
|
|
671
|
-
voices:
|
|
672
|
-
},
|
|
673
|
-
voices:
|
|
674
|
-
},
|
|
670
|
+
}, qs = [{ name: "Albert", nativeID: ["com.apple.speech.synthesis.voice.Albert"], note: "This novelty voice is part of a pack preloaded by Apple.", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Bad News", nativeID: ["com.apple.speech.synthesis.voice.BadNews"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Mauvaises nouvelles", "Malas noticias", "Brutte notizie"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Bahh", nativeID: ["com.apple.speech.synthesis.voice.Bahh"], note: "This novelty voice is part of a pack preloaded by Apple.", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Bells", nativeID: ["com.apple.speech.synthesis.voice.Bells"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Cloches", "Campanas", "Campane"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Boing", nativeID: ["com.apple.speech.synthesis.voice.Boing"], note: "This novelty voice is part of a pack preloaded by Apple.", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Bubbles", nativeID: ["com.apple.speech.synthesis.voice.Bubbles"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Bulles", "Burbujas", "Bollicine"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Cellos", nativeID: ["com.apple.speech.synthesis.voice.Cellos"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Violoncelles", "Violonchelos", "Violoncelli"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Good News", nativeID: ["com.apple.speech.synthesis.voice.GoodNews"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Bonnes nouvelles", "Buenas noticias", "Buone notizie"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Jester", nativeID: ["com.apple.speech.synthesis.voice.Hysterical"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Bouffon", "Bufón", "Giullare"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Organ", nativeID: ["com.apple.speech.synthesis.voice.Organ"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Orgue", "Órgano", "Organo"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Superstar", nativeID: ["com.apple.speech.synthesis.voice.Princess"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Superestrella"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Trinoids", nativeID: ["com.apple.speech.synthesis.voice.Trinoids"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Trinoïdes"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Whisper", nativeID: ["com.apple.speech.synthesis.voice.Whisper"], note: "This novelty voice is part of a pack preloaded by Apple.", altNames: ["Murmure", "Susurro", "Sussurro"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Wobble", nativeID: ["com.apple.speech.synthesis.voice.Deranged"], note: "This novelty voice is part of a pack preloaded by Apple.", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Zarvox", nativeID: ["com.apple.speech.synthesis.voice.Zarvox"], note: "This novelty voice is part of a pack preloaded by Apple.", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }], Gs = {
|
|
671
|
+
voices: qs
|
|
672
|
+
}, Hs = [{ name: "Eddy", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Flo", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Grandma", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Grandpa", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Jacques", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Reed", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Rocko", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Sandy", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Shelley", localizedName: "apple", note: "Eloquence voices are preloaded by default on Apple devices.", language: "en-US", otherLanguages: ["en-GB", "de-DE", "fr-FR", "fr-CA", "es-ES", "es-MX", "fi-FI", "it-IT", "ja-JP", "ko-KR", "pt-BR", "zh-CN", "zh-HK"], os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Fred", language: "en-US", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Junior", language: "en-US", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Kathy", language: "en-US", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "Ralph", language: "en-US", os: ["macOS", "iOS", "iPadOS"], preloaded: !0 }, { name: "eSpeak Arabic", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ar", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Bulgarian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "bg", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Bengali", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "bn", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Catalan", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ca", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Chinese (Mandarin, latin as English)", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "cmn", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Czech", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "cs", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Danish", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "da", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak German", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "de", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Greek", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "el", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Spanish (Spain)", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "es", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Estonian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "et", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Finnish", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "fi", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Gujarati", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "gu", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Croatian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "hr", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Hungarian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "hu", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Indonesian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "id", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Italian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "it", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Kannada", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "kn", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Korean", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ko", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Lithuanian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "lt", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Latvian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "lv", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Malayalm", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ml", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Marathi", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "mr", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Malay", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ms", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Norwegian Bokmål", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "nb", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Polish", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "pl", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Portuguese (Brazil)", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "pt-br", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Romanian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ro", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Russian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ru", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Slovak", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "sk", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Slovenian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "sl", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Serbian", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "sv", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Swedish", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "sv", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Swahili", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "sw", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Tamil", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "ta", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Telugu", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "te", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Turkish", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "tr", os: ["ChromeOS"], preloaded: !0 }, { name: "eSpeak Vietnamese (Northern)", note: "eSpeak voices are preloaded by default on Chrome OS.", language: "vi", os: ["ChromeOS"], preloaded: !0 }], Ks = {
|
|
673
|
+
voices: Hs
|
|
674
|
+
}, Ws = Gs, Qs = Ks, Ze = (n, e) => Ws.voices.some(
|
|
675
675
|
(t) => n.includes(t.name) || e && t.nativeID?.some((s) => e.includes(s)) || t.altNames?.some((s) => n.includes(s))
|
|
676
|
-
),
|
|
676
|
+
), Xe = (n, e) => Qs.voices.some(
|
|
677
677
|
(t) => n.includes(t.name)
|
|
678
|
-
) || e === "veryLow",
|
|
678
|
+
) || e === "veryLow", _t = (n) => n?.length ? n.filter((e) => !(e.isNovelty || Ze(e.name, e.voiceURI))) : [], $t = (n) => n?.length ? n.filter((e) => !Xe(e.name, e.quality)) : [], Js = (n, e) => {
|
|
679
679
|
const t = Array.isArray(e) ? e : [e];
|
|
680
680
|
return n.filter((s) => t.some((i) => {
|
|
681
681
|
const a = i.toLowerCase(), r = s.language?.toLowerCase(), o = s.altLanguage?.toLowerCase();
|
|
@@ -684,17 +684,17 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
684
684
|
const [l] = a.split("-");
|
|
685
685
|
return r && r.startsWith(l) || o && o.startsWith(l);
|
|
686
686
|
}));
|
|
687
|
-
},
|
|
688
|
-
quality:
|
|
689
|
-
},
|
|
690
|
-
apple:
|
|
687
|
+
}, Zs = { ar: { normal: "محسن", high: "استثنائي" }, ca: { normal: "millorada", high: "prèmium" }, "cmn-CN": { normal: "优化音质", high: "高音质" }, "cmn-TW": { normal: "增強音質", high: "高音質" }, cs: { normal: "vylepšená verze", high: "prémiový" }, da: { normal: "forbedret", high: "høj kvalitet" }, de: { normal: "erweitert", high: "premium" }, el: { normal: "βελτιωμένη", high: "υψηλής ποιότητας" }, en: { normal: "Enhanced", high: "Premium" }, es: { normal: "mejorada", high: "premium" }, fi: { normal: "parannettu", high: "korkealaatuinen" }, fr: { normal: "premium", high: "de qualité" }, he: { normal: "משופר", high: "פרימיום" }, hi: { normal: "बेहतर", high: "प्रीमियम" }, hr: { normal: "poboljšani", high: "vrhunski" }, hu: { normal: "továbbfejlesztett", high: "prémium" }, id: { normal: "Ditingkatkan", high: "Premium" }, it: { normal: "ottimizzata", high: "premium" }, ja: { normal: "拡張", high: "プレミアム" }, ko: { normal: "고품질", high: "프리미엄" }, ms: { normal: "Dipertingkat", high: "Premium" }, nb: { normal: "forbedret", high: "premium" }, nl: { normal: "verbeterd", high: "premium" }, pl: { normal: "rozszerzony", high: "premium" }, pt: { normal: "melhorada", high: "premium" }, ro: { normal: "îmbunătățită", high: "premium" }, ru: { normal: "улучшенный", high: "высшее качество" }, sk: { normal: "vylepšený", high: "prémiový" }, sl: { normal: "izboljšano", high: "prvovrsten" }, sv: { normal: "förbättrad", high: "premium" }, th: { normal: "คุณภาพสูง", high: "คุณภาพสูง" }, tr: { normal: "Geliştirilmiş", high: "Yüksek Kaliteli" }, uk: { normal: "вдосконалений", high: "високої якості" }, vi: { normal: "Nâng cao", high: "Cao cấp" } }, Xs = {
|
|
688
|
+
quality: Zs
|
|
689
|
+
}, Ye = {
|
|
690
|
+
apple: Xs.quality
|
|
691
691
|
// android: androidQualities.quality
|
|
692
|
-
},
|
|
692
|
+
}, Ys = (n, e, t) => {
|
|
693
693
|
if (!n) return;
|
|
694
694
|
const s = Array.isArray(t) ? t : t ? [t] : [];
|
|
695
695
|
for (const i of s)
|
|
696
|
-
if (i &&
|
|
697
|
-
const a =
|
|
696
|
+
if (i && Ye[i]) {
|
|
697
|
+
const a = Ye[i], r = R(e)[0], o = a[e] || a[r];
|
|
698
698
|
if (o) {
|
|
699
699
|
const l = n.toLowerCase(), { normal: c, high: u } = o;
|
|
700
700
|
if (u && l.includes(u.toLowerCase()))
|
|
@@ -703,15 +703,15 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
703
703
|
return "normal";
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
},
|
|
707
|
-
const t =
|
|
706
|
+
}, ei = (n, e) => {
|
|
707
|
+
const t = Ye[e];
|
|
708
708
|
if (t)
|
|
709
709
|
for (const [s, { high: i, normal: a }] of Object.entries(t)) {
|
|
710
710
|
const r = i && n.some((l) => l.includes(i)), o = a && n.some((l) => l.includes(a));
|
|
711
711
|
if (r && o)
|
|
712
712
|
return s;
|
|
713
713
|
}
|
|
714
|
-
},
|
|
714
|
+
}, ti = {
|
|
715
715
|
low: {
|
|
716
716
|
values: ["super-compact", "compact"],
|
|
717
717
|
quality: "low"
|
|
@@ -724,26 +724,26 @@ const zs = ["veryLow", "low", "normal", "high", "veryHigh"], Ms = ["android", "a
|
|
|
724
724
|
values: ["premium"],
|
|
725
725
|
quality: "high"
|
|
726
726
|
}
|
|
727
|
-
},
|
|
727
|
+
}, qt = (n) => {
|
|
728
728
|
if (!n) return;
|
|
729
729
|
const t = n.toLowerCase().split(/[._-]/);
|
|
730
|
-
for (const s of Object.values(
|
|
730
|
+
for (const s of Object.values(ti))
|
|
731
731
|
if (s.values.some((i) => t.includes(i)))
|
|
732
732
|
return s.quality;
|
|
733
733
|
};
|
|
734
|
-
function
|
|
734
|
+
function ni(n, e) {
|
|
735
735
|
if (n.name === n.originalName) return n;
|
|
736
736
|
if (e.name === e.originalName) return e;
|
|
737
737
|
const t = [n.originalName, ...n.altNames || []], s = [e.originalName, ...e.altNames || []], i = t.findIndex((r) => s.includes(r)), a = s.findIndex((r) => t.includes(r));
|
|
738
738
|
return i === -1 && a === -1 || i !== -1 && (a === -1 || i <= a) ? n : e;
|
|
739
739
|
}
|
|
740
|
-
function
|
|
740
|
+
function si(n, e) {
|
|
741
741
|
if (!n.altNames && !e.altNames)
|
|
742
742
|
return !1;
|
|
743
743
|
const t = n.originalName, s = e.originalName, i = n.altNames || [], a = e.altNames || [];
|
|
744
744
|
return a.includes(t) || i.includes(s) ? !0 : i.filter((o) => a.includes(o)).length > 0;
|
|
745
745
|
}
|
|
746
|
-
const
|
|
746
|
+
const Pn = () => {
|
|
747
747
|
const e = typeof window < "u" && (window.navigator || {}).userAgent || "", t = () => /android/i.test(e), s = () => /kaios/i.test(e), i = () => typeof window.InstallTrigger < "u" ? !0 : /firefox/i.test(e), a = () => /AppleWebKit/i.test(e) && !/Chrome|Chromium|Edg\/|OPR|Android/i.test(e);
|
|
748
748
|
return {
|
|
749
749
|
isAndroid: t(),
|
|
@@ -766,7 +766,7 @@ class P {
|
|
|
766
766
|
constructor() {
|
|
767
767
|
if (typeof window > "u" || !window.speechSynthesis)
|
|
768
768
|
throw new Error("Web Speech API is not available in this environment");
|
|
769
|
-
this.systemLocale = navigator.languages?.[0]?.split("-")[0] || "en", this.isAndroid =
|
|
769
|
+
this.systemLocale = navigator.languages?.[0]?.split("-")[0] || "en", this.isAndroid = Pn().isAndroid;
|
|
770
770
|
}
|
|
771
771
|
/**
|
|
772
772
|
* Initialize voice manager, or broaden an already-initialized singleton to
|
|
@@ -886,7 +886,7 @@ class P {
|
|
|
886
886
|
*/
|
|
887
887
|
updateSystemLocale(e) {
|
|
888
888
|
if (!e?.length) return;
|
|
889
|
-
const t = e.map((i) => i.name), s =
|
|
889
|
+
const t = e.map((i) => i.name), s = ei(t, "apple");
|
|
890
890
|
s && (this.systemLocale = s);
|
|
891
891
|
}
|
|
892
892
|
/**
|
|
@@ -895,15 +895,15 @@ class P {
|
|
|
895
895
|
* @private
|
|
896
896
|
*/
|
|
897
897
|
inferVoiceQuality(e, t, s) {
|
|
898
|
-
const i = e.voiceURI ?
|
|
898
|
+
const i = e.voiceURI ? qt(e.voiceURI) : void 0;
|
|
899
899
|
if (i) return i;
|
|
900
900
|
if (t?.nativeID && Array.isArray(t.nativeID))
|
|
901
901
|
for (const a of t.nativeID) {
|
|
902
|
-
const r =
|
|
902
|
+
const r = qt(a);
|
|
903
903
|
if (r) return r;
|
|
904
904
|
}
|
|
905
905
|
if (t?.localizedName && e.voiceURI && e.lang) {
|
|
906
|
-
const a =
|
|
906
|
+
const a = Ys(
|
|
907
907
|
e.voiceURI,
|
|
908
908
|
this.systemLocale,
|
|
909
909
|
t.localizedName
|
|
@@ -937,8 +937,8 @@ class P {
|
|
|
937
937
|
const i = `${s.language.toLowerCase()}_${this.normalizeVoiceName(s.name)}`, a = t.get(i);
|
|
938
938
|
if (!a)
|
|
939
939
|
t.set(i, s);
|
|
940
|
-
else if (
|
|
941
|
-
const r =
|
|
940
|
+
else if (si(s, a)) {
|
|
941
|
+
const r = ni(s, a);
|
|
942
942
|
t.set(i, r);
|
|
943
943
|
} else {
|
|
944
944
|
const r = ke(a.quality);
|
|
@@ -954,11 +954,11 @@ class P {
|
|
|
954
954
|
*/
|
|
955
955
|
getTestUtterance(e) {
|
|
956
956
|
if (!e) return "";
|
|
957
|
-
const t =
|
|
957
|
+
const t = Ft(e);
|
|
958
958
|
if (t) return t;
|
|
959
959
|
const [s] = P.extractLangRegionFromBCP47(e);
|
|
960
960
|
if (s && s !== e) {
|
|
961
|
-
const i =
|
|
961
|
+
const i = Ft(s);
|
|
962
962
|
if (i) return i;
|
|
963
963
|
}
|
|
964
964
|
return "";
|
|
@@ -1002,7 +1002,7 @@ class P {
|
|
|
1002
1002
|
const a = T(i).split("-")[0];
|
|
1003
1003
|
s.set(a, (s.get(a) ?? 0) + 1);
|
|
1004
1004
|
}
|
|
1005
|
-
return [...s].map(([i, a]) => ({ code: i, label:
|
|
1005
|
+
return [...s].map(([i, a]) => ({ code: i, label: Qe(i, t), count: a }));
|
|
1006
1006
|
}
|
|
1007
1007
|
/**
|
|
1008
1008
|
* Get available regions with voice counts
|
|
@@ -1083,8 +1083,8 @@ class P {
|
|
|
1083
1083
|
return await Promise.all(
|
|
1084
1084
|
e.filter((i) => i?.name && i?.lang).map(async (i) => {
|
|
1085
1085
|
const a = T(i.lang), [r] = P.extractLangRegionFromBCP47(a), o = this.normalizeVoiceName(i.name), l = `${i.lang.toLowerCase()}_${o}`, c = t.get(l) || 1;
|
|
1086
|
-
let u = await
|
|
1087
|
-
(!u || u.length === 0) && (u = await
|
|
1086
|
+
let u = await We(a);
|
|
1087
|
+
(!u || u.length === 0) && (u = await We(r));
|
|
1088
1088
|
const d = this.findMatchingJsonVoice(u, o), h = this.inferVoiceQuality(i, d, c), f = this.isAndroid ? { ...d?.controls, boundary: !1 } : d?.controls;
|
|
1089
1089
|
return d ? {
|
|
1090
1090
|
...d,
|
|
@@ -1097,8 +1097,8 @@ class P {
|
|
|
1097
1097
|
quality: h,
|
|
1098
1098
|
isDefault: i.default || !1,
|
|
1099
1099
|
offlineAvailability: i.localService || !1,
|
|
1100
|
-
isNovelty:
|
|
1101
|
-
isLowQuality:
|
|
1100
|
+
isNovelty: Ze(i.name, i.voiceURI),
|
|
1101
|
+
isLowQuality: Xe(i.name, h)
|
|
1102
1102
|
} : {
|
|
1103
1103
|
source: "browser",
|
|
1104
1104
|
label: this.cleanVoiceName(i.name),
|
|
@@ -1110,8 +1110,8 @@ class P {
|
|
|
1110
1110
|
quality: h,
|
|
1111
1111
|
isDefault: i.default || !1,
|
|
1112
1112
|
offlineAvailability: i.localService || !1,
|
|
1113
|
-
isNovelty:
|
|
1114
|
-
isLowQuality:
|
|
1113
|
+
isNovelty: Ze(i.name, i.voiceURI),
|
|
1114
|
+
isLowQuality: Xe(i.name, h)
|
|
1115
1115
|
};
|
|
1116
1116
|
})
|
|
1117
1117
|
);
|
|
@@ -1138,13 +1138,13 @@ class P {
|
|
|
1138
1138
|
...e
|
|
1139
1139
|
// Let explicit options override the defaults
|
|
1140
1140
|
};
|
|
1141
|
-
if (i.languages && (s =
|
|
1141
|
+
if (i.languages && (s = Js(s, i.languages)), i.source && (s = s.filter((a) => a.source === i.source)), i.gender && (s = s.filter((a) => a.gender === i.gender)), i.quality) {
|
|
1142
1142
|
const a = Array.isArray(i.quality) ? i.quality : [i.quality];
|
|
1143
1143
|
s = s.filter((r) => r.quality && a.includes(r.quality));
|
|
1144
1144
|
}
|
|
1145
1145
|
return i.offlineOnly && (s = s.filter((a) => a.offlineAvailability === !0)), i.provider && (s = s.filter(
|
|
1146
1146
|
(a) => a.provider?.toLowerCase() === i.provider?.toLowerCase()
|
|
1147
|
-
)), i.excludeNovelty && (s =
|
|
1147
|
+
)), i.excludeNovelty && (s = _t(s)), i.excludeVeryLowQuality && (s = $t(s)), i.removeDuplicates && (s = this.removeDuplicates(s)), s;
|
|
1148
1148
|
}
|
|
1149
1149
|
/**
|
|
1150
1150
|
* Filter out novelty voices
|
|
@@ -1153,7 +1153,7 @@ class P {
|
|
|
1153
1153
|
*/
|
|
1154
1154
|
filterOutNoveltyVoices(e) {
|
|
1155
1155
|
const t = e ?? this.voices;
|
|
1156
|
-
return
|
|
1156
|
+
return _t(t);
|
|
1157
1157
|
}
|
|
1158
1158
|
/**
|
|
1159
1159
|
* Filter out very low quality voices
|
|
@@ -1162,7 +1162,7 @@ class P {
|
|
|
1162
1162
|
*/
|
|
1163
1163
|
filterOutVeryLowQualityVoices(e) {
|
|
1164
1164
|
const t = e ?? this.voices;
|
|
1165
|
-
return
|
|
1165
|
+
return $t(t);
|
|
1166
1166
|
}
|
|
1167
1167
|
/**
|
|
1168
1168
|
* Sort voices by quality, respecting JSON name order, then alphabetically for undefined/null quality
|
|
@@ -1179,7 +1179,7 @@ class P {
|
|
|
1179
1179
|
* Sort regions by default then alphabetically, sort voices by quality
|
|
1180
1180
|
*/
|
|
1181
1181
|
static async sortByDefaultRegion(e, t) {
|
|
1182
|
-
const s = await ee(e), i =
|
|
1182
|
+
const s = await ee(e), i = Ue(t);
|
|
1183
1183
|
e.sort((a, r) => {
|
|
1184
1184
|
const [, o] = P.extractLangRegionFromBCP47(a.language), [, l] = P.extractLangRegionFromBCP47(r.language), c = i && o === i.split("-")[1], u = i && l === i.split("-")[1];
|
|
1185
1185
|
return c && !u ? -1 : !c && u ? 1 : Q(a, r, s, t);
|
|
@@ -1196,14 +1196,14 @@ class P {
|
|
|
1196
1196
|
if (!s?.length) return [];
|
|
1197
1197
|
if (!e?.length) {
|
|
1198
1198
|
const l = [...s];
|
|
1199
|
-
return await
|
|
1199
|
+
return await Je(l), l;
|
|
1200
1200
|
}
|
|
1201
|
-
const i =
|
|
1201
|
+
const i = xe(e), { voicesByLang: a, otherLangVoices: r } = Ne(s, i), o = [];
|
|
1202
1202
|
for (const l of i) {
|
|
1203
1203
|
const c = a.get(l.baseLang);
|
|
1204
1204
|
c && (await P.sortByDefaultRegion(c, l.baseLang), o.push(...c));
|
|
1205
1205
|
}
|
|
1206
|
-
return await
|
|
1206
|
+
return await Je(r), o.push(...r), o;
|
|
1207
1207
|
}
|
|
1208
1208
|
/**
|
|
1209
1209
|
* Sort voices by region preference, then alphabetically
|
|
@@ -1212,7 +1212,7 @@ class P {
|
|
|
1212
1212
|
* @returns Sorted array of voices
|
|
1213
1213
|
*/
|
|
1214
1214
|
async sortVoicesByRegions(e, t) {
|
|
1215
|
-
return
|
|
1215
|
+
return Rn(e, t || this.voices);
|
|
1216
1216
|
}
|
|
1217
1217
|
/**
|
|
1218
1218
|
* Group voices by the specified criteria
|
|
@@ -1244,10 +1244,10 @@ class P {
|
|
|
1244
1244
|
return s;
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
1247
|
-
const
|
|
1247
|
+
const An = (n, e) => {
|
|
1248
1248
|
const [t, s] = R(e), [i, a] = R(n.language);
|
|
1249
1249
|
return i === t && (!s || a === s);
|
|
1250
|
-
},
|
|
1250
|
+
}, et = (n, e) => !!n && R(n.language)[0] === R(e)[0], ii = ["webKit", "moz", "ms", "o"], ai = [
|
|
1251
1251
|
"boundary",
|
|
1252
1252
|
"end",
|
|
1253
1253
|
"error",
|
|
@@ -1255,10 +1255,10 @@ const In = (n, e) => {
|
|
|
1255
1255
|
"pause",
|
|
1256
1256
|
"resume",
|
|
1257
1257
|
"start"
|
|
1258
|
-
],
|
|
1259
|
-
const e =
|
|
1258
|
+
], ri = (n) => `${n.charAt(0).toUpperCase()}${n.slice(1)}`, ie = (n = {}, e) => Object.hasOwnProperty.call(n, e) || e in n || !!n[e], oi = (n) => typeof window < "u" && n in window, li = (n) => {
|
|
1259
|
+
const e = ri(n), t = ii.map((i) => `${i}${e}`), s = [n, e].concat(t).find(oi);
|
|
1260
1260
|
return s && typeof window < "u" ? window[s] : void 0;
|
|
1261
|
-
},
|
|
1261
|
+
}, ci = () => {
|
|
1262
1262
|
const n = {};
|
|
1263
1263
|
[
|
|
1264
1264
|
"speechSynthesis",
|
|
@@ -1267,15 +1267,15 @@ const In = (n, e) => {
|
|
|
1267
1267
|
"speechSynthesisEvent",
|
|
1268
1268
|
"speechSynthesisErrorEvent"
|
|
1269
1269
|
].forEach((t) => {
|
|
1270
|
-
n[t] =
|
|
1270
|
+
n[t] = li(t);
|
|
1271
1271
|
}), n.onvoiceschanged = ie(n.speechSynthesis, "onvoiceschanged"), n.speechSynthesisSpeaking = ie(n.speechSynthesis, "speaking"), n.speechSynthesisPaused = ie(n.speechSynthesis, "paused");
|
|
1272
1272
|
const e = n.speechSynthesisUtterance ? ie(n.speechSynthesisUtterance, "prototype") : !1;
|
|
1273
|
-
return
|
|
1273
|
+
return ai.forEach((t) => {
|
|
1274
1274
|
const s = `on${t}`;
|
|
1275
1275
|
n[s] = e && n.speechSynthesisUtterance ? ie(n.speechSynthesisUtterance.prototype, s) : !1;
|
|
1276
1276
|
}), n;
|
|
1277
1277
|
};
|
|
1278
|
-
class
|
|
1278
|
+
class ze {
|
|
1279
1279
|
listeners = /* @__PURE__ */ new Map();
|
|
1280
1280
|
on(e, t) {
|
|
1281
1281
|
return this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(t), () => {
|
|
@@ -1304,45 +1304,45 @@ const we = (n, e) => Math.min(Math.max(n, 0), Math.max(e - 1, 0));
|
|
|
1304
1304
|
function J(n, e, t, s) {
|
|
1305
1305
|
return Number.isFinite(n) ? Math.max(e, Math.min(t, n)) : s;
|
|
1306
1306
|
}
|
|
1307
|
-
const Ce = "\\p{Ps}\\p{Pi}¿¡",
|
|
1308
|
-
function
|
|
1309
|
-
return
|
|
1307
|
+
const Ce = "\\p{Ps}\\p{Pi}¿¡", ui = new RegExp(`^[${Ce}]`, "u"), hi = new RegExp(`[${Ce}]$`, "u"), di = new RegExp("^\\p{P}$", "u");
|
|
1308
|
+
function gi(n) {
|
|
1309
|
+
return ui.test(n);
|
|
1310
1310
|
}
|
|
1311
|
-
function
|
|
1312
|
-
return
|
|
1311
|
+
function fi(n) {
|
|
1312
|
+
return hi.test(n);
|
|
1313
1313
|
}
|
|
1314
|
-
function
|
|
1315
|
-
return
|
|
1314
|
+
function pi(n) {
|
|
1315
|
+
return di.test(n);
|
|
1316
1316
|
}
|
|
1317
|
-
function
|
|
1317
|
+
function Ln(n) {
|
|
1318
1318
|
return n.replace(/[<>]/g, "");
|
|
1319
1319
|
}
|
|
1320
|
-
function
|
|
1320
|
+
function mi(n) {
|
|
1321
1321
|
return n.replace(/"/g, '"').replace(/'/g, "'").replace(/ /g, " ").replace(/&#(\d+);/g, (e, t) => String.fromCodePoint(Number(t))).replace(/&#x([0-9a-fA-F]+);/g, (e, t) => String.fromCodePoint(parseInt(t, 16)));
|
|
1322
1322
|
}
|
|
1323
|
-
const
|
|
1324
|
-
function
|
|
1325
|
-
return n.replace(
|
|
1323
|
+
const vi = /\s*<readium:[a-zA-Z][\w-]*\s+id="[^"]*"\s*\/>\s*/g;
|
|
1324
|
+
function yi(n) {
|
|
1325
|
+
return n.replace(vi, (t, s, i) => {
|
|
1326
1326
|
const a = i.slice(s + t.length);
|
|
1327
1327
|
return a.length === 0 || fe(a) ? "" : " ";
|
|
1328
1328
|
}).replace(/ {2,}/g, " ").trim();
|
|
1329
1329
|
}
|
|
1330
|
-
function
|
|
1330
|
+
function Si(n) {
|
|
1331
1331
|
return n.includes("<");
|
|
1332
1332
|
}
|
|
1333
|
-
function
|
|
1333
|
+
function Me(n) {
|
|
1334
1334
|
if (n === void 0) return;
|
|
1335
1335
|
const e = {};
|
|
1336
1336
|
if (n.language !== void 0 && (e.language = n.language), n.ssml) {
|
|
1337
|
-
const t =
|
|
1338
|
-
|
|
1337
|
+
const t = yi(n.ssml);
|
|
1338
|
+
Si(t) && (e.ssml = t);
|
|
1339
1339
|
}
|
|
1340
1340
|
return n.plain && (e.plain = n.plain), e.plain || e.ssml ? e : void 0;
|
|
1341
1341
|
}
|
|
1342
1342
|
function U(n) {
|
|
1343
|
-
return
|
|
1343
|
+
return On(n).plain;
|
|
1344
1344
|
}
|
|
1345
|
-
function
|
|
1345
|
+
function On(n) {
|
|
1346
1346
|
let e = "";
|
|
1347
1347
|
const t = [];
|
|
1348
1348
|
let s = !1, i = 0;
|
|
@@ -1370,7 +1370,7 @@ function An(n) {
|
|
|
1370
1370
|
for (; r > a && /\s/.test(e[r - 1]); ) r--;
|
|
1371
1371
|
return { plain: e.slice(a, r), map: t.slice(a, r) };
|
|
1372
1372
|
}
|
|
1373
|
-
function
|
|
1373
|
+
function Gt(n, e) {
|
|
1374
1374
|
let t = 0, s = n.length;
|
|
1375
1375
|
for (; t < s; ) {
|
|
1376
1376
|
const i = t + s >> 1;
|
|
@@ -1378,27 +1378,27 @@ function qt(n, e) {
|
|
|
1378
1378
|
}
|
|
1379
1379
|
return t;
|
|
1380
1380
|
}
|
|
1381
|
-
const
|
|
1382
|
-
function
|
|
1381
|
+
const Ht = /* @__PURE__ */ new WeakMap();
|
|
1382
|
+
function bi(n) {
|
|
1383
1383
|
return n.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1384
1384
|
}
|
|
1385
|
-
function
|
|
1386
|
-
const e =
|
|
1385
|
+
function wi(n) {
|
|
1386
|
+
const e = bi(n), t = /\w/.test(n[0]) ? "(?<!\\w)" : "", s = /\w/.test(n[n.length - 1]) ? "(?!\\w)" : "";
|
|
1387
1387
|
return `${t}${e}${s}`;
|
|
1388
1388
|
}
|
|
1389
|
-
function
|
|
1389
|
+
function ki(n, e) {
|
|
1390
1390
|
if (typeof e == "string")
|
|
1391
|
-
return { regex: new RegExp(
|
|
1391
|
+
return { regex: new RegExp(wi(n), "g"), replace: e };
|
|
1392
1392
|
const t = e.pattern.flags.includes("g") ? e.pattern.flags : `${e.pattern.flags}g`;
|
|
1393
1393
|
return { regex: new RegExp(e.pattern.source, t), replace: e.replace };
|
|
1394
1394
|
}
|
|
1395
|
-
function
|
|
1396
|
-
let e =
|
|
1397
|
-
return e || (e = Object.entries(n).map(([t, s]) =>
|
|
1395
|
+
function Ci(n) {
|
|
1396
|
+
let e = Ht.get(n);
|
|
1397
|
+
return e || (e = Object.entries(n).map(([t, s]) => ki(t, s)), Ht.set(n, e)), e;
|
|
1398
1398
|
}
|
|
1399
|
-
function
|
|
1399
|
+
function Vn(n, e) {
|
|
1400
1400
|
const t = [];
|
|
1401
|
-
for (const a of
|
|
1401
|
+
for (const a of Ci(e))
|
|
1402
1402
|
for (const r of n.matchAll(a.regex)) {
|
|
1403
1403
|
const o = r.index, l = typeof a.replace == "string" ? a.replace : a.replace(...r);
|
|
1404
1404
|
t.push({ start: o, end: o + r[0].length, replacement: l });
|
|
@@ -1410,11 +1410,11 @@ function Ln(n, e) {
|
|
|
1410
1410
|
a.start < i || (s.push(a), i = a.end);
|
|
1411
1411
|
return s;
|
|
1412
1412
|
}
|
|
1413
|
-
function
|
|
1413
|
+
function Ei(n, e) {
|
|
1414
1414
|
let t = "";
|
|
1415
1415
|
const s = [];
|
|
1416
1416
|
let i = 0;
|
|
1417
|
-
for (const a of
|
|
1417
|
+
for (const a of Vn(n, e)) {
|
|
1418
1418
|
for (; i < a.start; )
|
|
1419
1419
|
t += n[i], s.push(i), i++;
|
|
1420
1420
|
for (let r = 0; r < a.replacement.length; r++)
|
|
@@ -1425,21 +1425,21 @@ function wi(n, e) {
|
|
|
1425
1425
|
t += n[i], s.push(i), i++;
|
|
1426
1426
|
return { text: t, map: s };
|
|
1427
1427
|
}
|
|
1428
|
-
function
|
|
1428
|
+
function Kt(n, e) {
|
|
1429
1429
|
return n.length ? e <= 0 ? n[0] : e >= n.length ? n[n.length - 1] + 1 : n[e] : e;
|
|
1430
1430
|
}
|
|
1431
|
-
const
|
|
1431
|
+
const Ri = /<([a-zA-Z][\w-]*)([^>]*)>([\s\S]*?)<\/\1>|<[a-zA-Z][\w-]*\b[^>]*\/>|[^<]+/g;
|
|
1432
1432
|
function Ee(n) {
|
|
1433
1433
|
return n.replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
1434
1434
|
}
|
|
1435
|
-
function
|
|
1435
|
+
function Tn(n) {
|
|
1436
1436
|
const e = [];
|
|
1437
|
-
for (const t of n.matchAll(
|
|
1437
|
+
for (const t of n.matchAll(Ri))
|
|
1438
1438
|
t[1] !== void 0 ? e.push({ kind: "paired", raw: t[0], tag: t[1], attrs: t[2], innerText: Ee(t[3]) }) : t[0][0] === "<" ? e.push({ kind: "selfClosing", raw: t[0] }) : e.push({ kind: "text", raw: t[0], text: Ee(t[0]) });
|
|
1439
1439
|
return e;
|
|
1440
1440
|
}
|
|
1441
|
-
function
|
|
1442
|
-
const t =
|
|
1441
|
+
function Ii(n, e) {
|
|
1442
|
+
const t = Tn(n);
|
|
1443
1443
|
let s = "", i = !1;
|
|
1444
1444
|
const a = [], r = t.map(() => []);
|
|
1445
1445
|
t.forEach((b, k) => {
|
|
@@ -1452,7 +1452,7 @@ function Ci(n, e) {
|
|
|
1452
1452
|
const E = s.length;
|
|
1453
1453
|
s += w, r[k].push(a.length), a.push({ start: E, end: s.length, atomIndex: k }), w.length > 0 && (i = /\s$/.test(w));
|
|
1454
1454
|
});
|
|
1455
|
-
const o =
|
|
1455
|
+
const o = Vn(s, e);
|
|
1456
1456
|
let l = "", c = "";
|
|
1457
1457
|
const u = [];
|
|
1458
1458
|
let d = -2, h = "", f = 0;
|
|
@@ -1475,19 +1475,19 @@ function Ci(n, e) {
|
|
|
1475
1475
|
for (; I < E.end; ) {
|
|
1476
1476
|
const A = f < o.length ? o[f] : void 0;
|
|
1477
1477
|
if (A && A.start <= I && A.end > I) {
|
|
1478
|
-
const
|
|
1479
|
-
if (
|
|
1478
|
+
const N = A.start === I, ne = A.end > E.end;
|
|
1479
|
+
if (N) {
|
|
1480
1480
|
c += A.replacement;
|
|
1481
1481
|
for (let D = 0; D < A.replacement.length; D++) u.push(A.start);
|
|
1482
|
-
E.atomIndex === -1 || ne ? (p(), l +=
|
|
1482
|
+
E.atomIndex === -1 || ne ? (p(), l += M(A.replacement)) : (d !== E.atomIndex && (p(), d = E.atomIndex), h += M(A.replacement));
|
|
1483
1483
|
}
|
|
1484
1484
|
I = Math.min(A.end, E.end), A.end <= E.end && f++;
|
|
1485
1485
|
continue;
|
|
1486
1486
|
}
|
|
1487
1487
|
const L = A ? Math.min(A.start, E.end) : E.end, K = s.slice(I, L);
|
|
1488
1488
|
c += K;
|
|
1489
|
-
for (let
|
|
1490
|
-
E.atomIndex === -1 ? (p(), l +=
|
|
1489
|
+
for (let N = 0; N < K.length; N++) u.push(I + N);
|
|
1490
|
+
E.atomIndex === -1 ? (p(), l += M(K)) : (d !== E.atomIndex && (p(), d = E.atomIndex), h += M(K)), I = L;
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
@@ -1503,24 +1503,24 @@ function Ci(n, e) {
|
|
|
1503
1503
|
const C = s.slice(g, v), y = u.slice(S, m).map((b) => Math.min(Math.max(b - g, 0), Math.max(C.length - 1, 0)));
|
|
1504
1504
|
return { ssml: l, plain: C, map: y };
|
|
1505
1505
|
}
|
|
1506
|
-
const
|
|
1507
|
-
function
|
|
1508
|
-
return new RegExp(
|
|
1506
|
+
const Un = /<lang xml:lang="([^"]*)">([\s\S]*?)<\/lang>/g;
|
|
1507
|
+
function xn(n) {
|
|
1508
|
+
return new RegExp(Un).test(n);
|
|
1509
1509
|
}
|
|
1510
|
-
function
|
|
1510
|
+
function Wt(n) {
|
|
1511
1511
|
return n.replace(/<[^>]+>/g, "").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&").replace(/ {2,}/g, " ");
|
|
1512
1512
|
}
|
|
1513
|
-
const
|
|
1513
|
+
const Pi = new RegExp(
|
|
1514
1514
|
`\\s+|[${Ce}]+|[${re}]+|[^\\s${Ce}${re}]+`,
|
|
1515
1515
|
"gu"
|
|
1516
1516
|
);
|
|
1517
|
-
function
|
|
1517
|
+
function _e(n) {
|
|
1518
1518
|
const e = [];
|
|
1519
|
-
for (const [t] of n.matchAll(
|
|
1520
|
-
/^\s/.test(t) ? e.push({ kind: "space" }) :
|
|
1519
|
+
for (const [t] of n.matchAll(Pi))
|
|
1520
|
+
/^\s/.test(t) ? e.push({ kind: "space" }) : gi(t) ? e.push({ kind: "open", text: t }) : fe(t) ? e.push({ kind: "close", text: t }) : e.push({ kind: "word", text: t });
|
|
1521
1521
|
return e;
|
|
1522
1522
|
}
|
|
1523
|
-
function
|
|
1523
|
+
function Ai(n) {
|
|
1524
1524
|
let e = "", t = !1;
|
|
1525
1525
|
for (const s of n) {
|
|
1526
1526
|
if (s.kind === "space") {
|
|
@@ -1531,12 +1531,12 @@ function Ri(n) {
|
|
|
1531
1531
|
}
|
|
1532
1532
|
return e;
|
|
1533
1533
|
}
|
|
1534
|
-
function
|
|
1534
|
+
function Li(n) {
|
|
1535
1535
|
let e = n.length;
|
|
1536
1536
|
for (; e > 0 && (n[e - 1].kind === "space" || n[e - 1].kind === "open"); ) e--;
|
|
1537
1537
|
return n.slice(e).some((t) => t.kind === "open") ? n.splice(e) : [];
|
|
1538
1538
|
}
|
|
1539
|
-
function
|
|
1539
|
+
function Oi(n) {
|
|
1540
1540
|
let e = 0;
|
|
1541
1541
|
for (; e < n.length && (n[e].kind === "space" || n[e].kind === "close"); ) e++;
|
|
1542
1542
|
return n.slice(0, e).some((t) => t.kind === "close") ? n.splice(0, e) : [];
|
|
@@ -1544,45 +1544,45 @@ function Pi(n) {
|
|
|
1544
1544
|
function dt(n, e) {
|
|
1545
1545
|
const t = [];
|
|
1546
1546
|
let s = 0;
|
|
1547
|
-
for (const r of n.matchAll(
|
|
1547
|
+
for (const r of n.matchAll(Un))
|
|
1548
1548
|
t.push({
|
|
1549
|
-
tokens:
|
|
1549
|
+
tokens: _e(Wt(n.slice(s, r.index))),
|
|
1550
1550
|
language: e,
|
|
1551
1551
|
tagged: !1
|
|
1552
|
-
}), t.push({ tokens:
|
|
1552
|
+
}), t.push({ tokens: _e(U(r[2])), language: r[1], tagged: !0 }), s = r.index + r[0].length;
|
|
1553
1553
|
t.push({
|
|
1554
|
-
tokens:
|
|
1554
|
+
tokens: _e(Wt(n.slice(s))),
|
|
1555
1555
|
language: e,
|
|
1556
1556
|
tagged: !1
|
|
1557
1557
|
});
|
|
1558
1558
|
for (let r = 0; r < t.length - 1; r++)
|
|
1559
|
-
!t[r].tagged && t[r + 1].tagged ? t[r + 1].tokens.unshift(...
|
|
1559
|
+
!t[r].tagged && t[r + 1].tagged ? t[r + 1].tokens.unshift(...Li(t[r].tokens)) : t[r].tagged && !t[r + 1].tagged && t[r].tokens.push(...Oi(t[r + 1].tokens));
|
|
1560
1560
|
const i = [];
|
|
1561
1561
|
let a = 0;
|
|
1562
1562
|
for (const r of t) {
|
|
1563
|
-
const o =
|
|
1563
|
+
const o = Ai(r.tokens);
|
|
1564
1564
|
o && (i.push({ plain: o, language: r.language, start: a, end: a + o.length }), a += o.length);
|
|
1565
1565
|
}
|
|
1566
1566
|
return i;
|
|
1567
1567
|
}
|
|
1568
|
-
const
|
|
1569
|
-
function
|
|
1568
|
+
const Vi = /<readium:[a-zA-Z][\w-]*\s+id="([^"]*)"\s*\/>/g, Ti = /(<lang\b[^>]*>)<sub\s+alias="([^"]*)"\s*>([\s\S]*?)<\/sub><\/lang>|<sub\s+alias="([^"]*)"\s*>([\s\S]*?)<\/sub>/, Nn = new RegExp(`${Vi.source}|${Ti.source}`, "g"), Ui = /[\p{L}\p{N}\p{Pd}]+$/u, xi = /^[\p{L}\p{N}\p{Pd}]+/u;
|
|
1569
|
+
function Ni(n) {
|
|
1570
1570
|
return Ee(n.replace(/"/g, '"').replace(/'/g, "'"));
|
|
1571
1571
|
}
|
|
1572
|
-
function
|
|
1573
|
-
return new RegExp(
|
|
1572
|
+
function zi(n) {
|
|
1573
|
+
return new RegExp(Nn).test(n);
|
|
1574
1574
|
}
|
|
1575
|
-
function
|
|
1575
|
+
function Mi(n) {
|
|
1576
1576
|
const e = [];
|
|
1577
1577
|
let t = 0;
|
|
1578
|
-
for (const i of n.matchAll(
|
|
1579
|
-
const a = i[1] === void 0, r = i.index + i[0].length, o = a ? n.slice(t, i.index).match(
|
|
1578
|
+
for (const i of n.matchAll(Nn)) {
|
|
1579
|
+
const a = i[1] === void 0, r = i.index + i[0].length, o = a ? n.slice(t, i.index).match(Ui)?.[0] ?? "" : "", l = a ? n.slice(r).match(xi)?.[0] ?? "" : "", c = n.slice(t, i.index - o.length).trim();
|
|
1580
1580
|
if (c && e.push({ ssml: c }), !a)
|
|
1581
1581
|
e.push({ placeholderId: i[1] });
|
|
1582
1582
|
else {
|
|
1583
1583
|
const u = i[2], d = i[3] ?? i[5], h = i[4] ?? i[6], f = (v) => u ? `${u}${v}</lang>` : v, p = (v) => f(`${o}${v}${l}`);
|
|
1584
1584
|
e.push({ ssml: p(h), abbreviation: "text" });
|
|
1585
|
-
const g =
|
|
1585
|
+
const g = M(Ni(d));
|
|
1586
1586
|
e.push({
|
|
1587
1587
|
ssml: p(g),
|
|
1588
1588
|
abbreviation: "alias",
|
|
@@ -1595,8 +1595,8 @@ function xi(n) {
|
|
|
1595
1595
|
const s = n.slice(t).trim();
|
|
1596
1596
|
return s && e.push({ ssml: s }), e;
|
|
1597
1597
|
}
|
|
1598
|
-
const
|
|
1599
|
-
class
|
|
1598
|
+
const Bi = 250;
|
|
1599
|
+
class Qt {
|
|
1600
1600
|
speechSynthesis;
|
|
1601
1601
|
speechSynthesisUtterance;
|
|
1602
1602
|
currentVoice = null;
|
|
@@ -1605,7 +1605,7 @@ class Wt {
|
|
|
1605
1605
|
currentUtterances = [];
|
|
1606
1606
|
currentUtteranceIndex = 0;
|
|
1607
1607
|
playbackState = "idle";
|
|
1608
|
-
events = new
|
|
1608
|
+
events = new ze();
|
|
1609
1609
|
voiceManager = null;
|
|
1610
1610
|
defaultVoice = null;
|
|
1611
1611
|
// Keyed by `${language}:${needsBoundary}` — the boundary requirement rides in the key
|
|
@@ -1639,7 +1639,7 @@ class Wt {
|
|
|
1639
1639
|
features;
|
|
1640
1640
|
patches;
|
|
1641
1641
|
constructor() {
|
|
1642
|
-
if (this.features =
|
|
1642
|
+
if (this.features = ci(), this.patches = Pn(), !this.features.speechSynthesis || !this.features.speechSynthesisUtterance)
|
|
1643
1643
|
throw new Error("Web Speech API is not available in this environment");
|
|
1644
1644
|
this.speechSynthesis = this.features.speechSynthesis, this.speechSynthesisUtterance = this.features.speechSynthesisUtterance;
|
|
1645
1645
|
}
|
|
@@ -1716,7 +1716,7 @@ class Wt {
|
|
|
1716
1716
|
if (!e.language)
|
|
1717
1717
|
return s;
|
|
1718
1718
|
const i = T(e.language);
|
|
1719
|
-
if (
|
|
1719
|
+
if (et(s, i))
|
|
1720
1720
|
return s;
|
|
1721
1721
|
const a = s?.controls?.boundary !== !1, r = this.languageCacheKey(i, a);
|
|
1722
1722
|
if (this.languageVoiceCache.has(r))
|
|
@@ -1742,11 +1742,11 @@ class Wt {
|
|
|
1742
1742
|
if (!this.voiceManager)
|
|
1743
1743
|
return;
|
|
1744
1744
|
const t = this.getCurrentVoiceForUtterance(this.currentVoice), s = t?.controls?.boundary !== !1, i = new Set(
|
|
1745
|
-
e.filter((l) => !this.ownVoice(l)).map((l) => l.language).filter((l) => !!l).map((l) => T(l)).filter((l) => !
|
|
1745
|
+
e.filter((l) => !this.ownVoice(l)).map((l) => l.language).filter((l) => !!l).map((l) => T(l)).filter((l) => !et(t, l)).filter((l) => !this.languageVoiceCache.has(this.languageCacheKey(l, s)))
|
|
1746
1746
|
), a = [...i].filter((l) => this.warmingLanguages.has(this.languageCacheKey(l, s))), o = [...i].filter((l) => !this.warmingLanguages.has(this.languageCacheKey(l, s))).map((l) => {
|
|
1747
1747
|
const c = this.languageCacheKey(l, s), u = (async () => {
|
|
1748
1748
|
await P.initialize({ languages: [l] });
|
|
1749
|
-
const d = this.voices.filter((g) =>
|
|
1749
|
+
const d = this.voices.filter((g) => An(g, l)), h = ht(d, s), p = (await this.voiceManager.sortVoicesByQuality(h))[0] ?? null;
|
|
1750
1750
|
this.languageVoiceCache.set(c, p), p || this.emitEvent({ type: "languagefallback", detail: { language: l, reason: "no-matching-voice" } });
|
|
1751
1751
|
})();
|
|
1752
1752
|
return this.warmingLanguages.set(c, u.finally(() => this.warmingLanguages.delete(c))), this.warmingLanguages.get(c);
|
|
@@ -1766,7 +1766,7 @@ class Wt {
|
|
|
1766
1766
|
toPlainText(e) {
|
|
1767
1767
|
return e.map((t) => ({
|
|
1768
1768
|
...t,
|
|
1769
|
-
plain: t.plain ?? (t.ssml ? U(
|
|
1769
|
+
plain: t.plain ?? (t.ssml ? U(mi(t.ssml)) : "")
|
|
1770
1770
|
}));
|
|
1771
1771
|
}
|
|
1772
1772
|
// Queue Management
|
|
@@ -1810,7 +1810,7 @@ class Wt {
|
|
|
1810
1810
|
this.patches.isSafari && this.speakGeneration++, this.cancelCurrentSpeech();
|
|
1811
1811
|
const t = ++this.speakGeneration;
|
|
1812
1812
|
this.isSpeakingInternal = !0, this.isPausedInternal = !1, this.setState("playing"), this.stopResumeInfinity(), this.currentUtteranceIndex >= this.currentUtterances.length && (this.currentUtteranceIndex = 0);
|
|
1813
|
-
const s = this.lastCancelAt +
|
|
1813
|
+
const s = this.lastCancelAt + Bi - Date.now();
|
|
1814
1814
|
if (this.patches.isSafari && s > 0) {
|
|
1815
1815
|
this.speakNextTask(t, 1, s);
|
|
1816
1816
|
return;
|
|
@@ -1841,7 +1841,7 @@ class Wt {
|
|
|
1841
1841
|
}
|
|
1842
1842
|
const s = this.currentUtterances[this.currentUtteranceIndex], i = s.plain ?? "";
|
|
1843
1843
|
this.validateText(i);
|
|
1844
|
-
const a = this.createUtterance(
|
|
1844
|
+
const a = this.createUtterance(Ln(i)), r = await this.voiceForUtterance(s);
|
|
1845
1845
|
if (e !== this.speakGeneration)
|
|
1846
1846
|
return;
|
|
1847
1847
|
if (this.lacksNativePauseEvents = !1, this.speakingVoice = r, r && this.voiceManager) {
|
|
@@ -2007,27 +2007,27 @@ class Wt {
|
|
|
2007
2007
|
this.stop(), this.stopResumeInfinity(), this.events.clear(), this.currentUtterances = [], this.currentVoice = null, this.speakingVoice = null, this.voiceManager = null, this.defaultVoice = null, this.languageVoiceCache.clear(), this.warmingLanguages.clear(), this.initialized = !1;
|
|
2008
2008
|
}
|
|
2009
2009
|
}
|
|
2010
|
-
class
|
|
2010
|
+
class Ar {
|
|
2011
2011
|
id = "webspeech";
|
|
2012
2012
|
name = "Web Speech API";
|
|
2013
2013
|
voiceEngine = null;
|
|
2014
2014
|
// No cache to bypass here — local API, no network cost to re-checking.
|
|
2015
2015
|
async getVoices() {
|
|
2016
|
-
return this.voiceEngine || (this.voiceEngine = new
|
|
2016
|
+
return this.voiceEngine || (this.voiceEngine = new Qt(), await this.voiceEngine.initialize()), this.voiceEngine.getAvailableVoices();
|
|
2017
2017
|
}
|
|
2018
2018
|
async createEngine(e) {
|
|
2019
|
-
const t = new
|
|
2019
|
+
const t = new Qt();
|
|
2020
2020
|
return await t.initialize(), e && await t.setVoice(e), t;
|
|
2021
2021
|
}
|
|
2022
2022
|
async destroy() {
|
|
2023
2023
|
this.voiceEngine && (await this.voiceEngine.destroy(), this.voiceEngine = null);
|
|
2024
2024
|
}
|
|
2025
2025
|
}
|
|
2026
|
-
function
|
|
2026
|
+
function zn(n, e) {
|
|
2027
2027
|
const t = [];
|
|
2028
2028
|
let s = -1, i = -1;
|
|
2029
2029
|
const a = () => {
|
|
2030
|
-
s !== -1 && (t.push({ text:
|
|
2030
|
+
s !== -1 && (t.push({ text: Di(n, s, i), offset: n[s].offset }), s = -1, i = -1);
|
|
2031
2031
|
};
|
|
2032
2032
|
for (let r = 0; r < n.length; r++) {
|
|
2033
2033
|
const o = n[r];
|
|
@@ -2040,14 +2040,14 @@ function xn(n, e) {
|
|
|
2040
2040
|
}
|
|
2041
2041
|
return a(), t;
|
|
2042
2042
|
}
|
|
2043
|
-
function
|
|
2043
|
+
function Di(n, e, t) {
|
|
2044
2044
|
const s = n[e], i = n[t];
|
|
2045
2045
|
return s === i ? s.text : n.slice(e, t + 1).map((a) => a.text).join("");
|
|
2046
2046
|
}
|
|
2047
|
-
const
|
|
2047
|
+
const Mn = new RegExp(
|
|
2048
2048
|
`[^${re}]*[${re}]+\\s*|[^${re}]+$`,
|
|
2049
2049
|
"gu"
|
|
2050
|
-
),
|
|
2050
|
+
), ji = /\S+\s*|\s+/g;
|
|
2051
2051
|
function gt(n, e, t) {
|
|
2052
2052
|
const s = [];
|
|
2053
2053
|
for (const i of n.matchAll(t))
|
|
@@ -2057,7 +2057,7 @@ function gt(n, e, t) {
|
|
|
2057
2057
|
function ft(n, e) {
|
|
2058
2058
|
if (n.text.length <= e || n.atomic)
|
|
2059
2059
|
return [n];
|
|
2060
|
-
const t = gt(n.text, n.offset,
|
|
2060
|
+
const t = gt(n.text, n.offset, ji);
|
|
2061
2061
|
if (t.length > 1)
|
|
2062
2062
|
return t.flatMap((r) => ft(r, e));
|
|
2063
2063
|
const s = [];
|
|
@@ -2066,23 +2066,23 @@ function ft(n, e) {
|
|
|
2066
2066
|
a.length > 0 && a.length + r.length > e && (s.push({ text: a, offset: i, atomic: !1 }), i += a.length, a = ""), a += r;
|
|
2067
2067
|
return a.length > 0 && s.push({ text: a, offset: i, atomic: !1 }), s;
|
|
2068
2068
|
}
|
|
2069
|
-
function
|
|
2069
|
+
function Fi(n, e) {
|
|
2070
2070
|
if (n.length <= e)
|
|
2071
2071
|
return [{ text: n, offset: 0 }];
|
|
2072
|
-
const s = gt(n, 0,
|
|
2073
|
-
return
|
|
2072
|
+
const s = gt(n, 0, Mn).flatMap((i) => ft(i, e));
|
|
2073
|
+
return zn(s, e);
|
|
2074
2074
|
}
|
|
2075
|
-
const
|
|
2076
|
-
function
|
|
2075
|
+
const _i = /<([a-zA-Z][\w-]*)\b[^>]*>[\s\S]*?<\/\1>|<[a-zA-Z][\w-]*\b[^>]*\/>|[^<]+/g;
|
|
2076
|
+
function $i(n, e) {
|
|
2077
2077
|
if (n.length <= e)
|
|
2078
2078
|
return [{ text: n, offset: 0 }];
|
|
2079
2079
|
const t = [];
|
|
2080
|
-
for (const i of n.matchAll(
|
|
2081
|
-
i[0][0] === "<" ? t.push({ text: i[0], offset: i.index, atomic: !0 }) : t.push(...gt(i[0], i.index,
|
|
2080
|
+
for (const i of n.matchAll(_i))
|
|
2081
|
+
i[0][0] === "<" ? t.push({ text: i[0], offset: i.index, atomic: !0 }) : t.push(...gt(i[0], i.index, Mn));
|
|
2082
2082
|
const s = t.flatMap((i) => ft(i, e));
|
|
2083
|
-
return
|
|
2083
|
+
return zn(s, e);
|
|
2084
2084
|
}
|
|
2085
|
-
const
|
|
2085
|
+
const qi = {
|
|
2086
2086
|
wav: "audio/wav",
|
|
2087
2087
|
mp3: "audio/mpeg",
|
|
2088
2088
|
opus: "audio/ogg",
|
|
@@ -2092,31 +2092,31 @@ const Fi = {
|
|
|
2092
2092
|
webm: "audio/webm",
|
|
2093
2093
|
m4a: "audio/mp4"
|
|
2094
2094
|
};
|
|
2095
|
-
function
|
|
2096
|
-
return
|
|
2095
|
+
function Gi(n) {
|
|
2096
|
+
return qi[n] ?? `audio/${n}`;
|
|
2097
2097
|
}
|
|
2098
|
-
const
|
|
2099
|
-
function
|
|
2100
|
-
const s = (o) => t(
|
|
2098
|
+
const Hi = ["flac", "wav", "opus", "aac", "ogg", "webm", "mp3"], Ki = ["opus", "aac", "webm", "ogg", "mp3", "wav", "flac"];
|
|
2099
|
+
function Wi(n, e, t) {
|
|
2100
|
+
const s = (o) => t(Gi(o)) !== "", i = n.formats.filter(s);
|
|
2101
2101
|
if (e.preferredFormat && i.includes(e.preferredFormat))
|
|
2102
2102
|
return e.preferredFormat;
|
|
2103
|
-
const a = e.strategy === "bandwidth" ?
|
|
2103
|
+
const a = e.strategy === "bandwidth" ? Ki : Hi, r = [...a, ...i.filter((o) => !a.includes(o))];
|
|
2104
2104
|
for (const o of r)
|
|
2105
2105
|
if (i.includes(o))
|
|
2106
2106
|
return o;
|
|
2107
2107
|
return n.default;
|
|
2108
2108
|
}
|
|
2109
|
-
const
|
|
2109
|
+
const Qi = /* @__PURE__ */ new Set(["wav", "flac"]), Ji = {
|
|
2110
2110
|
mp3: 48e3,
|
|
2111
2111
|
opus: 24e3,
|
|
2112
2112
|
aac: 48e3,
|
|
2113
2113
|
ogg: 48e3,
|
|
2114
2114
|
webm: 32e3
|
|
2115
2115
|
};
|
|
2116
|
-
function
|
|
2117
|
-
return
|
|
2116
|
+
function Zi(n, e, t) {
|
|
2117
|
+
return Qi.has(n) || !e || !t ? void 0 : t.saveData === !0 || /2g/.test(t.effectiveType ?? "") ? Ji[n] : void 0;
|
|
2118
2118
|
}
|
|
2119
|
-
function
|
|
2119
|
+
function Bn(n, e) {
|
|
2120
2120
|
return {
|
|
2121
2121
|
source: "server",
|
|
2122
2122
|
label: n.name,
|
|
@@ -2140,17 +2140,17 @@ class ue extends Error {
|
|
|
2140
2140
|
super(e), this.name = "SpeechServerError", this.status = t.status, this.type = t.type, this.title = t.title, this.instance = t.instance;
|
|
2141
2141
|
}
|
|
2142
2142
|
}
|
|
2143
|
-
class
|
|
2143
|
+
class Dn extends ue {
|
|
2144
2144
|
constructor(e) {
|
|
2145
2145
|
super(e, { status: 408, type: "https://readium.org/speech-server/error#stall", title: "Synthesis Stalled" }), this.name = "SpeechServerStallError";
|
|
2146
2146
|
}
|
|
2147
2147
|
}
|
|
2148
|
-
class
|
|
2148
|
+
class jn extends Error {
|
|
2149
2149
|
constructor(e) {
|
|
2150
2150
|
super(e), this.name = "SpeechServerAudioDecodeError";
|
|
2151
2151
|
}
|
|
2152
2152
|
}
|
|
2153
|
-
class
|
|
2153
|
+
class Fn extends Error {
|
|
2154
2154
|
constructor(e) {
|
|
2155
2155
|
super(e), this.name = "SpeechServerNetworkError";
|
|
2156
2156
|
}
|
|
@@ -2169,23 +2169,23 @@ async function oe(n) {
|
|
|
2169
2169
|
}
|
|
2170
2170
|
return new ue(`Request failed with status ${n.status}`, { status: n.status });
|
|
2171
2171
|
}
|
|
2172
|
-
const
|
|
2173
|
-
function
|
|
2172
|
+
const Xi = 3, Yi = 400;
|
|
2173
|
+
function ea(n) {
|
|
2174
2174
|
const e = atob(n), t = new Uint8Array(e.length);
|
|
2175
2175
|
for (let s = 0; s < e.length; s++)
|
|
2176
2176
|
t[s] = e.charCodeAt(s);
|
|
2177
2177
|
return t.buffer;
|
|
2178
2178
|
}
|
|
2179
|
-
function
|
|
2179
|
+
function ta(n) {
|
|
2180
2180
|
return J(n, 0.25, 4, 1);
|
|
2181
2181
|
}
|
|
2182
2182
|
function ve(n) {
|
|
2183
2183
|
return n?.plain ?? n?.ssml ?? void 0;
|
|
2184
2184
|
}
|
|
2185
|
-
function
|
|
2186
|
-
return n instanceof
|
|
2185
|
+
function Jt(n) {
|
|
2186
|
+
return n instanceof Dn ? { message: n.message, status: n.status, type: n.type, title: n.title, instance: n.instance, recoverable: !0 } : n instanceof ue ? { message: n.message, status: n.status, type: n.type, title: n.title, instance: n.instance, recoverable: !1 } : n instanceof jn ? { message: n.message, recoverable: !1 } : n instanceof Fn ? { message: n.message, recoverable: !0 } : n instanceof Error ? { message: n.message, recoverable: !1 } : { message: String(n), recoverable: !1 };
|
|
2187
2187
|
}
|
|
2188
|
-
class
|
|
2188
|
+
class na {
|
|
2189
2189
|
endpoints;
|
|
2190
2190
|
fetchImpl;
|
|
2191
2191
|
currentVoice = null;
|
|
@@ -2200,7 +2200,7 @@ class Yi {
|
|
|
2200
2200
|
currentUtterances = [];
|
|
2201
2201
|
currentUtteranceIndex = 0;
|
|
2202
2202
|
playbackState = "idle";
|
|
2203
|
-
events = new
|
|
2203
|
+
events = new ze();
|
|
2204
2204
|
speakGeneration = 0;
|
|
2205
2205
|
loadGeneration = 0;
|
|
2206
2206
|
// Rolling buffer of upcoming utterances' audio, fetched one at a time via prefetchChainTail.
|
|
@@ -2229,7 +2229,7 @@ class Yi {
|
|
|
2229
2229
|
pitch = 1;
|
|
2230
2230
|
volume = 1;
|
|
2231
2231
|
constructor(e) {
|
|
2232
|
-
this.endpoints = e.endpoints, this.fetchImpl = e.fetch ?? fetch.bind(globalThis), this.prefetchWindow = e.prefetchWindow ??
|
|
2232
|
+
this.endpoints = e.endpoints, this.fetchImpl = e.fetch ?? fetch.bind(globalThis), this.prefetchWindow = e.prefetchWindow ?? Xi, this.readyBufferChars = e.readyBufferChars ?? Yi, this.overLengthText = e.overLengthText ?? "split", this.timeoutMs = e.timeoutMs, this.formatOptions = e.format ?? {}, this.canPlayType = typeof Audio < "u" ? (t) => new Audio().canPlayType(t) : () => "";
|
|
2233
2233
|
}
|
|
2234
2234
|
// Lets a provider that already fetched /voices seed this engine without a second request.
|
|
2235
2235
|
setAvailableVoices(e) {
|
|
@@ -2239,7 +2239,7 @@ class Yi {
|
|
|
2239
2239
|
async initialize() {
|
|
2240
2240
|
this.initializing = (async () => {
|
|
2241
2241
|
const e = await this.getAvailableVoices(), t = typeof navigator < "u" && navigator.languages?.length ? [...navigator.languages] : ["en"];
|
|
2242
|
-
return this.defaultVoice = (await
|
|
2242
|
+
return this.defaultVoice = (await Rn(t, e))[0] ?? null, !0;
|
|
2243
2243
|
})();
|
|
2244
2244
|
try {
|
|
2245
2245
|
return await this.initializing;
|
|
@@ -2253,7 +2253,7 @@ class Yi {
|
|
|
2253
2253
|
try {
|
|
2254
2254
|
return await this.fetchImpl(e, t);
|
|
2255
2255
|
} catch (s) {
|
|
2256
|
-
throw s instanceof TypeError ? new
|
|
2256
|
+
throw s instanceof TypeError ? new Fn(s.message) : s;
|
|
2257
2257
|
}
|
|
2258
2258
|
}
|
|
2259
2259
|
loadUtterances(e, t) {
|
|
@@ -2293,14 +2293,14 @@ class Yi {
|
|
|
2293
2293
|
if (t)
|
|
2294
2294
|
return t;
|
|
2295
2295
|
const s = this.currentVoice ?? this.defaultVoice;
|
|
2296
|
-
if (!e?.language || this.voices.length === 0 ||
|
|
2296
|
+
if (!e?.language || this.voices.length === 0 || et(s, e.language))
|
|
2297
2297
|
return s;
|
|
2298
2298
|
const i = T(e.language), a = s?.controls?.boundary !== !1, r = `${i}:${a}`;
|
|
2299
2299
|
let o = this.languageVoiceCache.get(r);
|
|
2300
2300
|
return o || (o = this.pickLanguageVoice(i, a), this.languageVoiceCache.set(r, o)), await o ?? s;
|
|
2301
2301
|
}
|
|
2302
2302
|
async pickLanguageVoice(e, t) {
|
|
2303
|
-
const s = this.voices.filter((a) =>
|
|
2303
|
+
const s = this.voices.filter((a) => An(a, e)), i = s.length > 0 ? await In(e, ht(s, t)) : null;
|
|
2304
2304
|
return i || this.emitEvent({ type: "languagefallback", detail: { language: e, reason: "no-matching-voice" } }), i;
|
|
2305
2305
|
}
|
|
2306
2306
|
setVoice(e) {
|
|
@@ -2339,7 +2339,7 @@ class Yi {
|
|
|
2339
2339
|
if (!e.ok)
|
|
2340
2340
|
throw await oe(e);
|
|
2341
2341
|
const s = await e.json(), i = new Map(t.providers.map((a) => [a.id, a.controls]));
|
|
2342
|
-
return this.voices = s.map((a) =>
|
|
2342
|
+
return this.voices = s.map((a) => Bn(a, i.get(a.provider))), this.voices;
|
|
2343
2343
|
}
|
|
2344
2344
|
// Cached after the first successful fetch; a failed fetch isn't cached, so the next
|
|
2345
2345
|
// synthesize() call retries rather than being stuck on a transient network error.
|
|
@@ -2383,7 +2383,7 @@ class Yi {
|
|
|
2383
2383
|
return;
|
|
2384
2384
|
this.isSpeakingInternal = !1, this.setState("idle"), this.emitEvent({
|
|
2385
2385
|
type: "error",
|
|
2386
|
-
detail:
|
|
2386
|
+
detail: Jt(s)
|
|
2387
2387
|
});
|
|
2388
2388
|
}
|
|
2389
2389
|
}
|
|
@@ -2430,7 +2430,7 @@ class Yi {
|
|
|
2430
2430
|
this.liveControllers.forEach((e) => e.abort()), this.liveControllers.clear();
|
|
2431
2431
|
}
|
|
2432
2432
|
async synthesizeStream(e, t) {
|
|
2433
|
-
const s = this.currentUtterances[e], i = !s.plain && !!s.ssml, a = s.language, r = ve(s) ?? "", o = i ?
|
|
2433
|
+
const s = this.currentUtterances[e], i = !s.plain && !!s.ssml, a = s.language, r = ve(s) ?? "", o = i ? On(r).map : void 0, l = ve(this.currentUtterances[e - 1]), c = ve(this.currentUtterances[e + 1]), u = await this.getServiceInfo(), d = Wi(u.output, this.formatOptions, this.canPlayType), h = navigator.connection, f = Zi(d, this.formatOptions.adaptBitrateToNetwork ?? !1, h);
|
|
2434
2434
|
if (r.length <= u.limits.maxTextLength) {
|
|
2435
2435
|
const m = new AbortController();
|
|
2436
2436
|
return (t ? this.activeControllers : this.liveControllers).add(m), [{
|
|
@@ -2447,7 +2447,7 @@ class Yi {
|
|
|
2447
2447
|
title: "Payload Too Large"
|
|
2448
2448
|
}
|
|
2449
2449
|
);
|
|
2450
|
-
const p = Math.min(u.limits.maxTextLength, this.readyBufferChars), g = i ?
|
|
2450
|
+
const p = Math.min(u.limits.maxTextLength, this.readyBufferChars), g = i ? $i(r, p) : Fi(r, p), v = [];
|
|
2451
2451
|
let S = Promise.resolve();
|
|
2452
2452
|
for (let m = 0; m < g.length; m++) {
|
|
2453
2453
|
const C = m === 0 ? l : g[m - 1].text, y = m === g.length - 1 ? c : g[m + 1].text, b = g[m], k = new AbortController();
|
|
@@ -2467,7 +2467,7 @@ class Yi {
|
|
|
2467
2467
|
headers: { "Content-Type": "application/json" },
|
|
2468
2468
|
body: JSON.stringify({
|
|
2469
2469
|
id: t.id,
|
|
2470
|
-
text: a ? s :
|
|
2470
|
+
text: a ? s : Ln(s),
|
|
2471
2471
|
ssml: a,
|
|
2472
2472
|
language: o,
|
|
2473
2473
|
voice: f?.identifier ?? f?.name,
|
|
@@ -2480,12 +2480,12 @@ class Yi {
|
|
|
2480
2480
|
});
|
|
2481
2481
|
if (!p.ok)
|
|
2482
2482
|
throw await oe(p);
|
|
2483
|
-
const g = await p.json(), v =
|
|
2483
|
+
const g = await p.json(), v = ea(g.audio);
|
|
2484
2484
|
let S;
|
|
2485
2485
|
try {
|
|
2486
2486
|
S = await this.ensureAudioContext().decodeAudioData(v);
|
|
2487
2487
|
} catch {
|
|
2488
|
-
throw new
|
|
2488
|
+
throw new jn("Audio playback failed");
|
|
2489
2489
|
}
|
|
2490
2490
|
return { audioBuffer: S, format: g.format, boundaries: g.boundaries, textOffset: i, ssmlMap: r };
|
|
2491
2491
|
} finally {
|
|
@@ -2506,7 +2506,7 @@ class Yi {
|
|
|
2506
2506
|
const i = s + this.timeoutMs;
|
|
2507
2507
|
return new Promise((a, r) => {
|
|
2508
2508
|
const o = setTimeout(() => {
|
|
2509
|
-
t.abort(), r(new
|
|
2509
|
+
t.abort(), r(new Dn(`No audio chunk arrived within ${i.toFixed(0)}ms of the playback buffer running dry`));
|
|
2510
2510
|
}, i);
|
|
2511
2511
|
e.then(
|
|
2512
2512
|
(l) => {
|
|
@@ -2523,7 +2523,7 @@ class Yi {
|
|
|
2523
2523
|
const i = await this.awaitWithStallDeadline(e[0].promise, e[0].controller, 0);
|
|
2524
2524
|
if (t !== this.speakGeneration)
|
|
2525
2525
|
return;
|
|
2526
|
-
const a = this.ensureAudioContext(), r = this.masterGain, l = s?.controls?.speed === !0 ? 1 :
|
|
2526
|
+
const a = this.ensureAudioContext(), r = this.masterGain, l = s?.controls?.speed === !0 ? 1 : ta(this.rate);
|
|
2527
2527
|
this.scheduledChunks = [], this.setState("playing"), this.emitEvent({ type: "start", detail: { voice: s } });
|
|
2528
2528
|
let c = a.currentTime, u = null;
|
|
2529
2529
|
const d = (h) => {
|
|
@@ -2537,7 +2537,7 @@ class Yi {
|
|
|
2537
2537
|
const p = Math.max(0, (c - a.currentTime) * 1e3);
|
|
2538
2538
|
f = await this.awaitWithStallDeadline(e[h].promise, e[h].controller, p);
|
|
2539
2539
|
} catch (p) {
|
|
2540
|
-
t === this.speakGeneration && this.emitEvent({ type: "error", detail:
|
|
2540
|
+
t === this.speakGeneration && this.emitEvent({ type: "error", detail: Jt(p) });
|
|
2541
2541
|
return;
|
|
2542
2542
|
}
|
|
2543
2543
|
if (t !== this.speakGeneration)
|
|
@@ -2568,7 +2568,7 @@ class Yi {
|
|
|
2568
2568
|
let r = a, o = i.charLength;
|
|
2569
2569
|
if (t.chunk.ssmlMap) {
|
|
2570
2570
|
const l = t.chunk.ssmlMap;
|
|
2571
|
-
r =
|
|
2571
|
+
r = Gt(l, a), o = Math.max(0, Gt(l, a + i.charLength) - r);
|
|
2572
2572
|
}
|
|
2573
2573
|
this.emitEvent({
|
|
2574
2574
|
type: "boundary",
|
|
@@ -2688,7 +2688,7 @@ class Yi {
|
|
|
2688
2688
|
this.stop(), await this.audioContext?.close(), this.audioContext = null, this.masterGain = null, this.events.clear(), this.currentUtterances = [], this.currentVoice = null, this.defaultVoice = null, this.voices = [], this.voicesRequest = null, this.languageVoiceCache.clear();
|
|
2689
2689
|
}
|
|
2690
2690
|
}
|
|
2691
|
-
class
|
|
2691
|
+
class Lr {
|
|
2692
2692
|
id = "speech-server";
|
|
2693
2693
|
name = "Readium Speech Server";
|
|
2694
2694
|
options;
|
|
@@ -2709,20 +2709,20 @@ class Ir {
|
|
|
2709
2709
|
if (!s.ok)
|
|
2710
2710
|
throw await oe(s);
|
|
2711
2711
|
const i = await t.json(), a = await s.json(), r = new Map(a.providers.map((o) => [o.id, o.controls]));
|
|
2712
|
-
return this.voices = i.map((o) =>
|
|
2712
|
+
return this.voices = i.map((o) => Bn(o, r.get(o.provider))), this.voices;
|
|
2713
2713
|
}
|
|
2714
2714
|
async createEngine(e) {
|
|
2715
|
-
const t = new
|
|
2715
|
+
const t = new na(this.options);
|
|
2716
2716
|
return this.voices.length > 0 && t.setAvailableVoices(this.voices), e && t.setVoice(e), t;
|
|
2717
2717
|
}
|
|
2718
2718
|
async destroy() {
|
|
2719
2719
|
this.voices = [];
|
|
2720
2720
|
}
|
|
2721
2721
|
}
|
|
2722
|
-
function
|
|
2722
|
+
function sa(n) {
|
|
2723
2723
|
return n.detail?.recoverable === !0;
|
|
2724
2724
|
}
|
|
2725
|
-
const
|
|
2725
|
+
const ia = 3e4, aa = [
|
|
2726
2726
|
"start",
|
|
2727
2727
|
"pause",
|
|
2728
2728
|
"resume",
|
|
@@ -2737,7 +2737,7 @@ const ta = 3e4, na = [
|
|
|
2737
2737
|
"voiceschanged",
|
|
2738
2738
|
"languagefallback"
|
|
2739
2739
|
];
|
|
2740
|
-
class
|
|
2740
|
+
class ra {
|
|
2741
2741
|
activeEngine;
|
|
2742
2742
|
primaryProvider;
|
|
2743
2743
|
fallbackProvider;
|
|
@@ -2769,10 +2769,10 @@ class sa {
|
|
|
2769
2769
|
teardownEpoch = 0;
|
|
2770
2770
|
// Bumped by every loadUtterances() call, so startEngineWhenReady() can tell its queue is stale.
|
|
2771
2771
|
loadToken = 0;
|
|
2772
|
-
events = new
|
|
2772
|
+
events = new ze();
|
|
2773
2773
|
unbindActiveEngine = null;
|
|
2774
2774
|
constructor(e) {
|
|
2775
|
-
this.activeEngine = e.primaryEngine, this.primaryProvider = e.primaryProvider, this.fallbackProvider = e.fallbackProvider, this.onFailure = e.onFailure ?? "fallback", this.healthCheckIntervalMs = e.healthCheckIntervalMs ??
|
|
2775
|
+
this.activeEngine = e.primaryEngine, this.primaryProvider = e.primaryProvider, this.fallbackProvider = e.fallbackProvider, this.onFailure = e.onFailure ?? "fallback", this.healthCheckIntervalMs = e.healthCheckIntervalMs ?? ia, this.lastVoiceRequest = e.primaryEngine.getCurrentVoice() ?? void 0, this.bindActiveEngine();
|
|
2776
2776
|
}
|
|
2777
2777
|
async initialize() {
|
|
2778
2778
|
return this.activeEngine.initialize?.();
|
|
@@ -2866,13 +2866,13 @@ class sa {
|
|
|
2866
2866
|
this.events.emit(e.type, e);
|
|
2867
2867
|
}
|
|
2868
2868
|
bindActiveEngine() {
|
|
2869
|
-
const e = this.activeEngine, t =
|
|
2869
|
+
const e = this.activeEngine, t = aa.map((s) => e.on(s, (i) => {
|
|
2870
2870
|
this.emitEvent(i), this.maybeRecoverNow();
|
|
2871
2871
|
}));
|
|
2872
2872
|
t.push(e.on("error", (s) => this.handleError(s))), this.unbindActiveEngine = () => t.forEach((s) => s());
|
|
2873
2873
|
}
|
|
2874
2874
|
handleError(e) {
|
|
2875
|
-
if (this.hasFallenBack || this.swapInFlight || this.onFailure === "error" || !
|
|
2875
|
+
if (this.hasFallenBack || this.swapInFlight || this.onFailure === "error" || !sa(e)) {
|
|
2876
2876
|
this.emitEvent(e);
|
|
2877
2877
|
return;
|
|
2878
2878
|
}
|
|
@@ -2964,14 +2964,14 @@ class sa {
|
|
|
2964
2964
|
async pickBestFallbackVoice(e, t, s) {
|
|
2965
2965
|
const i = await this.fallbackProvider.getVoices(), r = typeof navigator < "u" && navigator.onLine === !0 ? i : i.filter((p) => p.offlineAvailability === !0);
|
|
2966
2966
|
if (r.length === 0) return null;
|
|
2967
|
-
const [o] =
|
|
2968
|
-
return
|
|
2967
|
+
const [o] = xe([e]), { voicesByLang: l } = Ne(r, [o]), c = l.get(o.baseLang) ?? [], u = c.length > 0 ? c : r, d = t ? u.filter((p) => p.gender === t) : [], h = d.length > 0 ? d : u, f = ht(h, s);
|
|
2968
|
+
return In(e, f);
|
|
2969
2969
|
}
|
|
2970
2970
|
async destroy() {
|
|
2971
2971
|
this.teardownEpoch++, this.healthCheckTimer !== null && (clearTimeout(this.healthCheckTimer), this.healthCheckTimer = null), this.unbindActiveEngine?.(), this.events.clear(), await this.activeEngine.destroy();
|
|
2972
2972
|
}
|
|
2973
2973
|
}
|
|
2974
|
-
class
|
|
2974
|
+
class Or {
|
|
2975
2975
|
id = "fallback";
|
|
2976
2976
|
name = "Fallback";
|
|
2977
2977
|
primary;
|
|
@@ -2999,7 +2999,7 @@ class Pr {
|
|
|
2999
2999
|
throw s;
|
|
3000
3000
|
return this.fallback.createEngine(e);
|
|
3001
3001
|
}
|
|
3002
|
-
return new
|
|
3002
|
+
return new ra({
|
|
3003
3003
|
primaryEngine: t,
|
|
3004
3004
|
primaryProvider: this.primary,
|
|
3005
3005
|
fallbackProvider: this.fallback,
|
|
@@ -3011,27 +3011,27 @@ class Pr {
|
|
|
3011
3011
|
await Promise.all([this.primary.destroy(), this.fallback.destroy()]);
|
|
3012
3012
|
}
|
|
3013
3013
|
}
|
|
3014
|
-
function
|
|
3015
|
-
return new
|
|
3016
|
-
start: new
|
|
3017
|
-
end: n.end ? new
|
|
3014
|
+
function oa(n) {
|
|
3015
|
+
return new zs({
|
|
3016
|
+
start: new Dt(n.start),
|
|
3017
|
+
end: n.end ? new Dt(n.end) : void 0
|
|
3018
3018
|
});
|
|
3019
3019
|
}
|
|
3020
|
-
function
|
|
3021
|
-
const { href: t, text: s, cssSelector: i, domRange: a, fragment: r } = n, o = s ? new
|
|
3022
|
-
l && (i && l.set("cssSelector", i), a && l.set("domRange",
|
|
3023
|
-
const u = l !== void 0 || r !== void 0 ? new
|
|
3020
|
+
function la(n, e = window) {
|
|
3021
|
+
const { href: t, text: s, cssSelector: i, domRange: a, fragment: r } = n, o = s ? new Os(s) : void 0, l = i || a ? /* @__PURE__ */ new Map() : void 0;
|
|
3022
|
+
l && (i && l.set("cssSelector", i), a && l.set("domRange", oa(a).serialize()));
|
|
3023
|
+
const u = l !== void 0 || r !== void 0 ? new Vs({
|
|
3024
3024
|
fragments: r ? [r] : void 0,
|
|
3025
3025
|
otherLocations: l
|
|
3026
3026
|
}) : void 0;
|
|
3027
|
-
return new
|
|
3027
|
+
return new Ts({
|
|
3028
3028
|
href: t ?? e.location.href,
|
|
3029
3029
|
type: "text/html",
|
|
3030
3030
|
text: o,
|
|
3031
3031
|
locations: u
|
|
3032
3032
|
});
|
|
3033
3033
|
}
|
|
3034
|
-
class
|
|
3034
|
+
class ca extends Ps {
|
|
3035
3035
|
constructor(e, t, s, i = {}) {
|
|
3036
3036
|
super(e.host, i), this.channel = e, this.wnd = t, this.decorator = s;
|
|
3037
3037
|
}
|
|
@@ -3047,7 +3047,7 @@ class ra extends Es {
|
|
|
3047
3047
|
e.map(({ id: s, style: i, ...a }) => ({
|
|
3048
3048
|
id: s,
|
|
3049
3049
|
style: i,
|
|
3050
|
-
locator:
|
|
3050
|
+
locator: la(a, this.wnd)
|
|
3051
3051
|
})),
|
|
3052
3052
|
t
|
|
3053
3053
|
);
|
|
@@ -3056,12 +3056,12 @@ class ra extends Es {
|
|
|
3056
3056
|
super.destroy(), this.decorator.unmount(this.wnd, this.channel.frame), this.channel.frame.destroy();
|
|
3057
3057
|
}
|
|
3058
3058
|
}
|
|
3059
|
-
function
|
|
3060
|
-
const t = new
|
|
3061
|
-
return s.mount(n, t.frame), new
|
|
3059
|
+
function Vr(n = window, e = {}) {
|
|
3060
|
+
const t = new As(), s = new Ls();
|
|
3061
|
+
return s.mount(n, t.frame), new ca(t, n, s, e);
|
|
3062
3062
|
}
|
|
3063
|
-
const
|
|
3064
|
-
class
|
|
3063
|
+
const _n = (n) => n.voiceURI ?? n.identifier ?? n.name;
|
|
3064
|
+
class Tr {
|
|
3065
3065
|
providers = /* @__PURE__ */ new Map();
|
|
3066
3066
|
register(e) {
|
|
3067
3067
|
if (this.providers.has(e.id))
|
|
@@ -3101,7 +3101,7 @@ class Lr {
|
|
|
3101
3101
|
return t;
|
|
3102
3102
|
}
|
|
3103
3103
|
}
|
|
3104
|
-
const
|
|
3104
|
+
const Be = (n, e, t) => Object.freeze({ range: Object.freeze([n, e]), step: t }), Re = Be(0, 5e3, 100), Ie = Be(0.1, 10, 0.1), Pe = Be(0, 2, 0.1), Ae = Be(0, 1, 0.05), pt = Object.freeze(["none", "few", "some", "most", "custom"]), mt = Object.freeze(["none", "block-level", "always"]), vt = Object.freeze(["plain", "ssml"]), yt = Object.freeze(["none", "utterance", "block"]), St = Object.freeze(["structure", "sentence"]), $n = Object.freeze(["never", "inline", "after"]), Zt = Object.freeze([
|
|
3105
3105
|
"format",
|
|
3106
3106
|
"interruptions",
|
|
3107
3107
|
"verbosity",
|
|
@@ -3109,9 +3109,10 @@ const Me = (n, e, t) => Object.freeze({ range: Object.freeze([n, e]), step: t })
|
|
|
3109
3109
|
"contextualize",
|
|
3110
3110
|
"language",
|
|
3111
3111
|
"languageOverrides",
|
|
3112
|
-
"segmentation"
|
|
3112
|
+
"segmentation",
|
|
3113
|
+
"reconstruct"
|
|
3113
3114
|
]);
|
|
3114
|
-
function
|
|
3115
|
+
function bt(n) {
|
|
3115
3116
|
return n == null || typeof n == "boolean" ? n : void 0;
|
|
3116
3117
|
}
|
|
3117
3118
|
function V(n, e) {
|
|
@@ -3123,23 +3124,23 @@ function F(n, e) {
|
|
|
3123
3124
|
const t = Math.min(...e), s = Math.max(...e);
|
|
3124
3125
|
return n >= t && n <= s ? n : void 0;
|
|
3125
3126
|
}
|
|
3126
|
-
function
|
|
3127
|
+
function wt(n) {
|
|
3127
3128
|
if (n == null) return n;
|
|
3128
3129
|
if (!(typeof n != "object" || Array.isArray(n)))
|
|
3129
3130
|
return Object.values(n).every((e) => typeof e == "string") ? { ...n } : void 0;
|
|
3130
3131
|
}
|
|
3131
|
-
function
|
|
3132
|
+
function qn(n, e) {
|
|
3132
3133
|
if (n == null) return n;
|
|
3133
3134
|
if (!(typeof n != "object" || Array.isArray(n)))
|
|
3134
3135
|
return Object.values(n).every((t) => t !== void 0 && e.includes(t)) ? { ...n } : void 0;
|
|
3135
3136
|
}
|
|
3136
|
-
function
|
|
3137
|
-
return typeof n == "string" ? n :
|
|
3137
|
+
function Gn(n) {
|
|
3138
|
+
return typeof n == "string" ? n : wt(n);
|
|
3138
3139
|
}
|
|
3139
3140
|
function he(n) {
|
|
3140
3141
|
return n == null ? n : Array.isArray(n) && n.every((e) => typeof e == "string") ? [...n] : void 0;
|
|
3141
3142
|
}
|
|
3142
|
-
class
|
|
3143
|
+
class ua {
|
|
3143
3144
|
format;
|
|
3144
3145
|
interruptions;
|
|
3145
3146
|
verbosity;
|
|
@@ -3148,6 +3149,7 @@ class la {
|
|
|
3148
3149
|
language;
|
|
3149
3150
|
languageOverrides;
|
|
3150
3151
|
segmentation;
|
|
3152
|
+
reconstruct;
|
|
3151
3153
|
voice;
|
|
3152
3154
|
pauseDuration;
|
|
3153
3155
|
autoPause;
|
|
@@ -3155,7 +3157,7 @@ class la {
|
|
|
3155
3157
|
pitch;
|
|
3156
3158
|
volume;
|
|
3157
3159
|
constructor(e = {}) {
|
|
3158
|
-
this.format = V(e.format, vt) ?? "plain", this.interruptions =
|
|
3160
|
+
this.format = V(e.format, vt) ?? "plain", this.interruptions = qn(e.interruptions, $n) ?? {}, this.verbosity = V(e.verbosity, pt) ?? "few", this.skip = he(e.skip) ?? [], this.contextualize = he(e.contextualize) ?? [], this.language = V(e.language, mt) ?? "block-level", this.languageOverrides = wt(e.languageOverrides) ?? {}, this.segmentation = V(e.segmentation, St) ?? "structure", this.reconstruct = bt(e.reconstruct) ?? !1, this.voice = Gn(e.voice) ?? null, this.pauseDuration = F(e.pauseDuration, Re.range) ?? 300, this.autoPause = V(e.autoPause, yt) ?? "none", this.rate = F(e.rate, Ie.range) ?? 1, this.pitch = F(e.pitch, Pe.range) ?? 1, this.volume = F(e.volume, Ae.range) ?? 1;
|
|
3159
3161
|
}
|
|
3160
3162
|
}
|
|
3161
3163
|
class de {
|
|
@@ -3167,6 +3169,7 @@ class de {
|
|
|
3167
3169
|
language;
|
|
3168
3170
|
languageOverrides;
|
|
3169
3171
|
segmentation;
|
|
3172
|
+
reconstruct;
|
|
3170
3173
|
voice;
|
|
3171
3174
|
pauseDuration;
|
|
3172
3175
|
autoPause;
|
|
@@ -3174,7 +3177,7 @@ class de {
|
|
|
3174
3177
|
pitch;
|
|
3175
3178
|
volume;
|
|
3176
3179
|
constructor(e = {}) {
|
|
3177
|
-
this.format = V(e.format, vt), this.interruptions =
|
|
3180
|
+
this.format = V(e.format, vt), this.interruptions = qn(e.interruptions, $n), this.verbosity = V(e.verbosity, pt), this.skip = he(e.skip), this.contextualize = he(e.contextualize), this.language = V(e.language, mt), this.languageOverrides = wt(e.languageOverrides), this.segmentation = V(e.segmentation, St), this.reconstruct = bt(e.reconstruct), this.voice = Gn(e.voice), this.pauseDuration = F(e.pauseDuration, Re.range), this.autoPause = V(e.autoPause, yt), this.rate = F(e.rate, Ie.range), this.pitch = F(e.pitch, Pe.range), this.volume = F(e.volume, Ae.range);
|
|
3178
3181
|
}
|
|
3179
3182
|
merging(e) {
|
|
3180
3183
|
const t = { ...this };
|
|
@@ -3235,9 +3238,9 @@ class ae extends Z {
|
|
|
3235
3238
|
return this._supportedValues;
|
|
3236
3239
|
}
|
|
3237
3240
|
}
|
|
3238
|
-
class
|
|
3241
|
+
class ha extends Z {
|
|
3239
3242
|
set value(e) {
|
|
3240
|
-
if (e != null &&
|
|
3243
|
+
if (e != null && bt(e) === void 0)
|
|
3241
3244
|
throw new Error(`Value '${String(e)}' is not a boolean.`);
|
|
3242
3245
|
this._value = e, this._onChange(this._value);
|
|
3243
3246
|
}
|
|
@@ -3245,7 +3248,7 @@ class Or extends Z {
|
|
|
3245
3248
|
return this._value;
|
|
3246
3249
|
}
|
|
3247
3250
|
}
|
|
3248
|
-
class
|
|
3251
|
+
class Xt extends Z {
|
|
3249
3252
|
set value(e) {
|
|
3250
3253
|
if (e != null && he(e) === void 0)
|
|
3251
3254
|
throw new Error(`Value '${String(e)}' is not an array of strings.`);
|
|
@@ -3299,7 +3302,7 @@ class ye extends Z {
|
|
|
3299
3302
|
return e.toString();
|
|
3300
3303
|
}
|
|
3301
3304
|
}
|
|
3302
|
-
class
|
|
3305
|
+
class Yt {
|
|
3303
3306
|
preferences;
|
|
3304
3307
|
settings;
|
|
3305
3308
|
// Cloned rather than aliased: edits made through this editor's setters
|
|
@@ -3321,6 +3324,7 @@ class Xt {
|
|
|
3321
3324
|
language: null,
|
|
3322
3325
|
languageOverrides: null,
|
|
3323
3326
|
segmentation: null,
|
|
3327
|
+
reconstruct: null,
|
|
3324
3328
|
voice: null,
|
|
3325
3329
|
pauseDuration: null,
|
|
3326
3330
|
autoPause: null,
|
|
@@ -3359,7 +3363,7 @@ class Xt {
|
|
|
3359
3363
|
});
|
|
3360
3364
|
}
|
|
3361
3365
|
get skip() {
|
|
3362
|
-
return new
|
|
3366
|
+
return new Xt({
|
|
3363
3367
|
initialValue: this.preferences.skip,
|
|
3364
3368
|
effectiveValue: this.settings.skip,
|
|
3365
3369
|
isEffective: this.preferences.skip != null,
|
|
@@ -3367,7 +3371,7 @@ class Xt {
|
|
|
3367
3371
|
});
|
|
3368
3372
|
}
|
|
3369
3373
|
get contextualize() {
|
|
3370
|
-
return new
|
|
3374
|
+
return new Xt({
|
|
3371
3375
|
initialValue: this.preferences.contextualize,
|
|
3372
3376
|
effectiveValue: this.settings.contextualize,
|
|
3373
3377
|
isEffective: this.preferences.contextualize != null,
|
|
@@ -3400,6 +3404,14 @@ class Xt {
|
|
|
3400
3404
|
supportedValues: St
|
|
3401
3405
|
});
|
|
3402
3406
|
}
|
|
3407
|
+
get reconstruct() {
|
|
3408
|
+
return new ha({
|
|
3409
|
+
initialValue: this.preferences.reconstruct,
|
|
3410
|
+
effectiveValue: this.settings.reconstruct,
|
|
3411
|
+
isEffective: this.settings.segmentation === "sentence" && this.preferences.reconstruct != null,
|
|
3412
|
+
onChange: (e) => this.updatePreference("reconstruct", e ?? null)
|
|
3413
|
+
});
|
|
3414
|
+
}
|
|
3403
3415
|
get voice() {
|
|
3404
3416
|
return new Z({
|
|
3405
3417
|
initialValue: this.preferences.voice,
|
|
@@ -3458,8 +3470,8 @@ class Xt {
|
|
|
3458
3470
|
});
|
|
3459
3471
|
}
|
|
3460
3472
|
}
|
|
3461
|
-
const
|
|
3462
|
-
...
|
|
3473
|
+
const Hn = ["audio", "figure", "image", "math", "table", "video"], Kn = [
|
|
3474
|
+
...Hn,
|
|
3463
3475
|
"blockquote",
|
|
3464
3476
|
"chapter",
|
|
3465
3477
|
"cover",
|
|
@@ -3472,8 +3484,8 @@ const qn = ["audio", "figure", "image", "math", "table", "video"], Gn = [
|
|
|
3472
3484
|
"rowheader",
|
|
3473
3485
|
"subtitle",
|
|
3474
3486
|
"tip"
|
|
3475
|
-
],
|
|
3476
|
-
...
|
|
3487
|
+
], da = [
|
|
3488
|
+
...Kn,
|
|
3477
3489
|
"abstract",
|
|
3478
3490
|
"acknowledgments",
|
|
3479
3491
|
"afterword",
|
|
@@ -3517,7 +3529,7 @@ const qn = ["audio", "figure", "image", "math", "table", "video"], Gn = [
|
|
|
3517
3529
|
"separator",
|
|
3518
3530
|
"summary",
|
|
3519
3531
|
"term"
|
|
3520
|
-
],
|
|
3532
|
+
], ga = {
|
|
3521
3533
|
none: /* @__PURE__ */ new Set([
|
|
3522
3534
|
"aside",
|
|
3523
3535
|
"audio",
|
|
@@ -3573,28 +3585,28 @@ const qn = ["audio", "figure", "image", "math", "table", "video"], Gn = [
|
|
|
3573
3585
|
"toc"
|
|
3574
3586
|
]),
|
|
3575
3587
|
most: /* @__PURE__ */ new Set(["landmarks", "loa", "loi", "lot", "lov", "toc"])
|
|
3576
|
-
},
|
|
3588
|
+
}, fa = {
|
|
3577
3589
|
none: /* @__PURE__ */ new Set(),
|
|
3578
|
-
few: new Set(
|
|
3579
|
-
some: new Set(
|
|
3580
|
-
most: new Set(
|
|
3581
|
-
},
|
|
3590
|
+
few: new Set(Hn),
|
|
3591
|
+
some: new Set(Kn),
|
|
3592
|
+
most: new Set(da)
|
|
3593
|
+
}, tt = {
|
|
3582
3594
|
table: { few: "inline", some: "block", most: "block" }
|
|
3583
3595
|
};
|
|
3584
3596
|
function Se(n) {
|
|
3585
3597
|
const e = {};
|
|
3586
|
-
for (const t of Object.keys(
|
|
3587
|
-
e[t] =
|
|
3598
|
+
for (const t of Object.keys(tt))
|
|
3599
|
+
e[t] = tt[t]?.[n] ?? "inline";
|
|
3588
3600
|
return e;
|
|
3589
3601
|
}
|
|
3590
|
-
const
|
|
3602
|
+
const pa = {
|
|
3591
3603
|
none: Se("none"),
|
|
3592
3604
|
few: Se("few"),
|
|
3593
3605
|
some: Se("some"),
|
|
3594
3606
|
most: Se("most")
|
|
3595
|
-
},
|
|
3596
|
-
function
|
|
3597
|
-
const t = n === "custom" ? {} :
|
|
3607
|
+
}, Ur = Object.keys(tt);
|
|
3608
|
+
function ma(n, e) {
|
|
3609
|
+
const t = n === "custom" ? {} : pa[n];
|
|
3598
3610
|
if (!e) return t;
|
|
3599
3611
|
const s = { ...t };
|
|
3600
3612
|
for (const i of Object.keys(e)) {
|
|
@@ -3603,12 +3615,12 @@ function ga(n, e) {
|
|
|
3603
3615
|
}
|
|
3604
3616
|
return s;
|
|
3605
3617
|
}
|
|
3606
|
-
const
|
|
3618
|
+
const va = (n, e) => {
|
|
3607
3619
|
if (!e || typeof n == "string") return n;
|
|
3608
3620
|
const [t] = R(e.language);
|
|
3609
|
-
return !t || n && ut(n, t) !== void 0 ? n : { ...n, [t]:
|
|
3621
|
+
return !t || n && ut(n, t) !== void 0 ? n : { ...n, [t]: _n(e) };
|
|
3610
3622
|
};
|
|
3611
|
-
class
|
|
3623
|
+
class $e {
|
|
3612
3624
|
format;
|
|
3613
3625
|
interruptions;
|
|
3614
3626
|
verbosity;
|
|
@@ -3617,6 +3629,7 @@ class _e {
|
|
|
3617
3629
|
language;
|
|
3618
3630
|
languageOverrides;
|
|
3619
3631
|
segmentation;
|
|
3632
|
+
reconstruct;
|
|
3620
3633
|
voice;
|
|
3621
3634
|
pauseDuration;
|
|
3622
3635
|
autoPause;
|
|
@@ -3627,26 +3640,26 @@ class _e {
|
|
|
3627
3640
|
* @param engineVoice The engine's voice, which `voice` falls back to: when unset, or for its language in a record without it.
|
|
3628
3641
|
*/
|
|
3629
3642
|
constructor(e, t, s) {
|
|
3630
|
-
this.format = e.format ?? t.format, this.interruptions = e.interruptions ?? t.interruptions, this.verbosity = e.verbosity ?? t.verbosity, this.verbosity === "custom" ? (this.skip = e.skip ?? t.skip, this.contextualize = e.contextualize ?? t.contextualize) : (this.skip = [...
|
|
3643
|
+
this.format = e.format ?? t.format, this.interruptions = e.interruptions ?? t.interruptions, this.verbosity = e.verbosity ?? t.verbosity, this.verbosity === "custom" ? (this.skip = e.skip ?? t.skip, this.contextualize = e.contextualize ?? t.contextualize) : (this.skip = [...ga[this.verbosity]], this.contextualize = [...fa[this.verbosity]]), this.language = e.language ?? t.language, this.languageOverrides = e.languageOverrides ?? t.languageOverrides, this.segmentation = e.segmentation ?? t.segmentation, this.reconstruct = e.reconstruct ?? t.reconstruct, this.voice = va(e.voice ?? t.voice, s), this.pauseDuration = e.pauseDuration ?? t.pauseDuration, this.autoPause = e.autoPause ?? t.autoPause, this.rate = e.rate ?? t.rate, this.pitch = e.pitch ?? t.pitch, this.volume = e.volume ?? t.volume;
|
|
3631
3644
|
}
|
|
3632
3645
|
}
|
|
3633
|
-
const
|
|
3634
|
-
function
|
|
3635
|
-
|
|
3646
|
+
const en = /* @__PURE__ */ new WeakMap(), Wn = /* @__PURE__ */ new WeakMap();
|
|
3647
|
+
function tn(n, e) {
|
|
3648
|
+
Wn.set(n, e);
|
|
3636
3649
|
}
|
|
3637
|
-
const
|
|
3638
|
-
function
|
|
3639
|
-
return
|
|
3650
|
+
const nt = /* @__PURE__ */ new WeakSet();
|
|
3651
|
+
function st(n) {
|
|
3652
|
+
return nt.add(n), n;
|
|
3640
3653
|
}
|
|
3641
|
-
function
|
|
3642
|
-
const s =
|
|
3654
|
+
function ya(n, e, t) {
|
|
3655
|
+
const s = Wn.get(n);
|
|
3643
3656
|
if (s) {
|
|
3644
|
-
const d =
|
|
3657
|
+
const d = Kt(s.map, e), h = Kt(s.map, e + t);
|
|
3645
3658
|
e = d, t = Math.max(0, h - d);
|
|
3646
3659
|
}
|
|
3647
3660
|
const i = n.offsets, a = !n.plain && !!n.ssml, r = s?.plain ?? n.plain ?? (n.ssml ? U(n.ssml) : "");
|
|
3648
3661
|
if (!i?.length || !r) return;
|
|
3649
|
-
const o =
|
|
3662
|
+
const o = en.get(n), l = o !== void 0 && e >= o.cursor;
|
|
3650
3663
|
let c = l ? o.cursor : 0;
|
|
3651
3664
|
const u = (d) => {
|
|
3652
3665
|
const h = d.locate.text?.highlight;
|
|
@@ -3654,8 +3667,8 @@ function pa(n, e, t) {
|
|
|
3654
3667
|
};
|
|
3655
3668
|
for (let d = l ? o.pieceIndex : 0; d < i.length; d++) {
|
|
3656
3669
|
const h = i[d];
|
|
3657
|
-
if (
|
|
3658
|
-
const v = i.slice(d + 1).find((b) => !
|
|
3670
|
+
if (nt.has(h.locate)) {
|
|
3671
|
+
const v = i.slice(d + 1).find((b) => !nt.has(b.locate) && u(b)), S = v && u(v), m = S ? r.indexOf(S, c + h.end - h.start) : -1, C = S && m === -1 ? r.indexOf(S, c) : m, y = C === -1 ? r.length : C;
|
|
3659
3672
|
if (e >= c && e < y) return;
|
|
3660
3673
|
c = y;
|
|
3661
3674
|
continue;
|
|
@@ -3666,7 +3679,7 @@ function pa(n, e, t) {
|
|
|
3666
3679
|
if (p === -1) continue;
|
|
3667
3680
|
const g = p + f.length;
|
|
3668
3681
|
if (e >= p && e < g) {
|
|
3669
|
-
|
|
3682
|
+
en.set(n, { pieceIndex: d, cursor: c });
|
|
3670
3683
|
const v = e - p, S = f.substring(v, Math.min(v + t, f.length));
|
|
3671
3684
|
return { locate: {
|
|
3672
3685
|
...h.locate,
|
|
@@ -3681,13 +3694,13 @@ function pa(n, e, t) {
|
|
|
3681
3694
|
c = g;
|
|
3682
3695
|
}
|
|
3683
3696
|
}
|
|
3684
|
-
function
|
|
3697
|
+
function Sa(n, e) {
|
|
3685
3698
|
return e === "sentence" && n.offsets?.length ? n.offsets.map((t) => t.locate) : n.locate ? [n.locate] : [];
|
|
3686
3699
|
}
|
|
3687
|
-
function
|
|
3700
|
+
function z(n) {
|
|
3688
3701
|
return { pattern: new RegExp(`(\\d+)\\s?u${n}\\b`, "g"), replace: (e, t) => `${t}µ${n}` };
|
|
3689
3702
|
}
|
|
3690
|
-
const
|
|
3703
|
+
const ba = {
|
|
3691
3704
|
"1/4": "¼",
|
|
3692
3705
|
"1/2": "½",
|
|
3693
3706
|
"3/4": "¾",
|
|
@@ -3707,8 +3720,8 @@ const va = {
|
|
|
3707
3720
|
"5/8": "⅝",
|
|
3708
3721
|
"7/8": "⅞",
|
|
3709
3722
|
"0/3": "↉"
|
|
3710
|
-
},
|
|
3711
|
-
...
|
|
3723
|
+
}, wa = {
|
|
3724
|
+
...ba,
|
|
3712
3725
|
// Rejects "(c)" directly preceded by "(a)"/"(b)" (a lettered list, not a copyright notice).
|
|
3713
3726
|
"(c)": { pattern: new RegExp("(?<!\\([ab]\\)\\s{0,3})\\(c\\)", "g"), replace: "©" },
|
|
3714
3727
|
"(C)": { pattern: new RegExp("(?<!\\([AB]\\)\\s{0,3})\\(C\\)", "g"), replace: "©" },
|
|
@@ -3718,37 +3731,37 @@ const va = {
|
|
|
3718
3731
|
"(TM)": "™",
|
|
3719
3732
|
deg: { pattern: /(\d+)\s?deg\b/g, replace: (n, e) => `${e}°` },
|
|
3720
3733
|
x: { pattern: /(\d+)\s?[xX]\s?(?=\d)/g, replace: (n, e) => `${e}×` },
|
|
3721
|
-
ug:
|
|
3722
|
-
um:
|
|
3723
|
-
us:
|
|
3724
|
-
uL:
|
|
3725
|
-
uF:
|
|
3726
|
-
uA:
|
|
3727
|
-
uV:
|
|
3728
|
-
uW:
|
|
3729
|
-
uN:
|
|
3730
|
-
umol:
|
|
3734
|
+
ug: z("g"),
|
|
3735
|
+
um: z("m"),
|
|
3736
|
+
us: z("s"),
|
|
3737
|
+
uL: z("L"),
|
|
3738
|
+
uF: z("F"),
|
|
3739
|
+
uA: z("A"),
|
|
3740
|
+
uV: z("V"),
|
|
3741
|
+
uW: z("W"),
|
|
3742
|
+
uN: z("N"),
|
|
3743
|
+
umol: z("mol"),
|
|
3731
3744
|
"->": "→",
|
|
3732
3745
|
"<-": "←",
|
|
3733
3746
|
// Reversed from every other entry: engines pattern-match the ASCII foot/inch
|
|
3734
3747
|
// convention for pronunciation, but drop the real prime marks silently.
|
|
3735
3748
|
"′": "'",
|
|
3736
3749
|
"″": '"'
|
|
3737
|
-
},
|
|
3738
|
-
speech:
|
|
3739
|
-
},
|
|
3740
|
-
function
|
|
3741
|
-
return
|
|
3742
|
-
}
|
|
3743
|
-
async function
|
|
3744
|
-
const e =
|
|
3750
|
+
}, ka = { contextualizations: { abstract: { block: { start: "Start of the abstract.", end: "End of the abstract." } }, acknowledgments: { block: { start: "Start of the acknowledgments.", end: "End of the acknowledgments." } }, afterword: { block: { start: "Start of the afterword.", end: "End of the afterword." } }, appendix: { block: { start: "Start of the appendix.", end: "End of the appendix." } }, aside: { block: { start: "Start of the aside.", end: "End of the aside." } }, audio: { inline: { labelled: "Audio with a label: {{ description }}", unlabelled: "Audio with no label." } }, bibliography: { block: { start: "Start of the bibliography.", end: "End of the bibliography." } }, biblioref: { inline: "Bibliographic reference." }, blockquote: { inline: "Blockquote." }, cell: { inline: { withHeader: "{{ header }}: {{ value }}", withoutHeader: "{{ value }}" } }, chapter: { block: { start: "Start of the chapter.", end: "End of the chapter." } }, colophon: { inline: "Colophon." }, complementary: { block: { start: "Start of the complementary content.", end: "End of the complementary content." } }, conclusion: { block: { start: "Start of the conclusion.", end: "End of the conclusion." } }, cover: { inline: { labelled: "Cover with a label: {{ description }}", unlabelled: "Cover with no label." } }, credit: { inline: "Credit." }, credits: { block: { start: "Start of the credits.", end: "End of the credits." } }, dedication: { inline: "Dedication." }, definition: { inline: "Definition." }, details: { block: { start: "Start of the disclosure.", end: "End of the disclosure." } }, endnotes: { block: { start: "Start of the endnotes.", end: "End of the endnotes." } }, epigraph: { inline: "Epigraph." }, epilogue: { block: { start: "Start of the epilogue.", end: "End of the epilogue." } }, errata: { block: { start: "Start of the errata.", end: "End of the errata." } }, example: { block: { start: "Start of the example.", end: "End of the example." } }, figure: { inline: "Figure: {{ description }}" }, footnote: { block: { start: "Start of the footnote.", end: "End of the footnote." } }, foreword: { block: { start: "Start of the foreword.", end: "End of the foreword." } }, glossary: { block: { start: "Start of the glossary.", end: "End of the glossary." } }, glossref: { inline: "Glossary definition.", term: "{{ term }}: {{ value }}" }, heading1: { inline: "Heading level 1." }, heading2: { inline: "Heading level 2." }, heading3: { inline: "Heading level 3." }, heading4: { inline: "Heading level 4." }, heading5: { inline: "Heading level 5." }, heading6: { inline: "Heading level 6." }, image: { inline: { labelled: "Image with a label: {{ description }}", unlabelled: "Image with no label." } }, index: { block: { start: "Start of the index.", end: "End of the index." } }, introduction: { block: { start: "Start of the introduction.", end: "End of the introduction." } }, list: { block: { start: "Start of the list.", end: "End of the list." } }, listItem: { inline: "List item." }, math: { inline: { labelled: "{{ description }}", unlabelled: "Math formula with no label." } }, notice: { inline: "Notice." }, pagebreak: { inline: "Pagebreak.", number: "Page {{ number }}" }, pagelist: { block: { start: "Start of the page list.", end: "End of the page list." } }, part: { inline: "Part." }, preface: { block: { start: "Start of the preface.", end: "End of the preface." } }, prologue: { block: { start: "Start of the prologue.", end: "End of the prologue." } }, pullquote: { inline: "Pullquote." }, qna: { block: { start: "Start of the questions and answers.", end: "End of the questions and answers." } }, row: { inline: "Row: {{ count }}" }, rowheader: { inline: { withHeader: "{{ header }}: {{ value }}", withoutHeader: "{{ value }}" } }, separator: { inline: "Separator." }, subtitle: { inline: "Subtitle." }, summary: { inline: "Summary." }, table: { block: { end: "End of the table.", start: { labelled: "Table: {{ description }}. {{ lines }}. {{ columns }}.", unlabelled: "Table. {{ lines }}. {{ columns }}." } }, inline: { labelled: "Table: {{ description }}. {{ lines }}. {{ columns }}.", unlabelled: "Table. {{ lines }}. {{ columns }}." }, parts: { columns_one: "1 column", columns_other: "{{ count }} columns", lines_one: "1 line", lines_other: "{{ count }} lines" } }, term: { inline: "Term." }, tip: { inline: "Tip." }, video: { inline: { labelled: "Video with a label: {{ description }}", unlabelled: "Video with no label." } } } }, Ca = {
|
|
3751
|
+
speech: ka
|
|
3752
|
+
}, Qn = Ca.speech.contextualizations, it = { en: Qn }, Jn = {};
|
|
3753
|
+
function Ea(n) {
|
|
3754
|
+
return it[n] || Jn[n] ? n : "en";
|
|
3755
|
+
}
|
|
3756
|
+
async function Ra(n) {
|
|
3757
|
+
const e = it[n];
|
|
3745
3758
|
if (e) return e;
|
|
3746
|
-
const t =
|
|
3747
|
-
if (!t) return
|
|
3759
|
+
const t = Jn[n];
|
|
3760
|
+
if (!t) return Qn;
|
|
3748
3761
|
const s = (await t()).speech.contextualizations;
|
|
3749
|
-
return
|
|
3762
|
+
return it[n] = s, s;
|
|
3750
3763
|
}
|
|
3751
|
-
const
|
|
3764
|
+
const Ia = {
|
|
3752
3765
|
de: ["A.", "A.M.", "Abs.", "Abt.", "Abw.", "Adj.", "Adr.", "Akt.", "Allg.", "Alt.", "App.", "Apr.", "Art.", "Aug.", "Ausg.", "Ausschl.", "B.", "Bed.", "Ben.", "Ber.", "Best.", "Bibl.", "C.", "Ca.", "Chin.", "Chr.", "Co.", "D.", "D. h.", "Dat.", "Dez.", "Di.", "Dim.", "Dipl.-Ing.", "Dipl.-Kfm.", "Dir.", "Do.", "Dr.", "Dtzd.", "Einh.", "Erf.", "Evtl.", "F.", "F.f.", "Fa.", "Fam.", "Feb.", "Fn.", "Folg.", "Forts. f.", "Fr.", "Frl.", "G.", "Gebr.", "Gem.", "Geograph.", "Ges.", "Gesch.", "Ggf.", "Hbf.", "Hptst.", "Hr.", "Hrn.", "Hrsg.", "I.", "Inc.", "Ing.", "Inh.", "Int.", "J.", "J.D.", "Jahrh.", "Jan.", "Jr.", "Kap.", "Kfm.", "Kl.", "Konv.", "Kop.", "L.", "Ltd.", "M.", "Max.", "Mi.", "Min.", "Mind.", "Mio.", "Mo.", "Mod.", "Mrd.", "Msp.", "N.", "Nov.", "Nr.", "O.", "Obj.", "Okt.", "Op.", "P.", "P.M.", "PIN.", "Pfd.", "Phys.", "Port.", "Prot.", "Proz.", "Qu.", "R.", "Rd.", "Reg.", "Reg.-Bez.", "Rel.", "Rep.", "S.A.", "Sa.", "Schr.", "Sek.", "Sep.", "Sept.", "So.", "Spezif.", "St.", "StR.", "Std.", "Str.", "T.", "Tel.", "Temp.", "Test.", "Trans.", "Tägl.", "U.", "U. U.", "U.S.", "U.S.A.", "U.U.", "Urspr.", "Ursprüngl.", "Verf.", "Vgl.", "W.", "Wg.", "Y.", "Z.", "Z. B.", "Z. Zt.", "Ztr.", "a.D.", "a.M.", "a.Rh.", "a.a.O.", "a.a.S.", "am.", "amtl.", "b.", "beil.", "d.J.", "d.Ä.", "e.V.", "e.Wz.", "e.h.", "ehem.", "eigtl.", "einschl.", "entspr.", "erw.", "ev.", "evtl.", "exkl.", "frz.", "geb.", "gedr.", "gek.", "gesch.", "gest.", "ggf.", "ggfs.", "hpts.", "i.A.", "i.B.", "i.H.", "i.J.", "i.R.", "i.V.", "inkl.", "jew.", "jhrl.", "k. u. k.", "k.u.k.", "kath.", "kfm.", "kgl.", "led.", "m.E.", "m.W.", "mtl.", "möbl.", "n. Chr.", "n.u.Z.", "näml.", "o.A.", "o.B.", "o.g.", "od.", "p.Adr.", "r.", "röm.", "röm.-kath.", "s.", "s.a.", "schles.", "schweiz.", "schwäb.", "sog.", "südd.", "tägl.", "u.", "u. Z.", "u.A.w.g.", "u.U.", "u.a.", "u.v.a.", "u.Ä.", "u.ä.", "v. Chr.", "v. H.", "v. u. Z.", "v.Chr.", "v.H.", "v.R.w.", "v.T.", "v.u.Z.", "verh.", "verw.", "vgl.", "z.", "z.B.", "z.Hd.", "z.Z.", "zzgl.", "österr."],
|
|
3753
3766
|
en: ["A.D.", "A.I.", "A.M.", "A.S.", "AA.", "AB.", "Abs.", "Adj.", "Adv.", "Alt.", "Approx.", "Aug.", "B.V.", "C.F.", "C.O.D.", "Capt.", "Col.", "Comm.", "Conn.", "Cont.", "D.A.", "D.C.", "DC.", "DR.", "Dec.", "Def.", "Dept.", "Diff.", "Dr.", "E.G.", "E.g.", "Ed.", "Est.", "Etc.", "Ex.", "Exec.", "Feb.", "Fn.", "Fri.", "Hon.B.A.", "I.", "I.D.", "I.T.", "I.e.", "J.B.", "J.D.", "J.K.", "Jan.", "Jun.", "K.R.", "L.A.", "L.P.", "Lev.", "Lib.", "Lt.", "Lt.Cdr.", "M.", "M.I.T.", "M.R.", "M.T.", "MR.", "Maj.", "Mar.", "Mart.", "Mb.", "Md.", "Mgr.", "Min.", "Misc.", "Mr.", "Mrs.", "Ms.", "Mt.", "N.V.", "N.Y.", "Nov.", "Nr.", "Num.", "Op.", "Org.", "P.M.", "P.O.", "P.V.", "PP.", "Ph.D.", "Phys.", "Prof.", "Pvt.", "R.L.", "R.T.", "Rep.", "Rev.", "S.A.", "S.A.R.", "S.E.", "S.p.A.", "Sep.", "Sept.", "Sgt.", "Sq.", "St.", "U.S.", "U.S.A.", "U.S.C.", "VS.", "Yr.", "a.m.", "d.", "dr.", "exec.", "pp.", "vs."],
|
|
3754
3767
|
es: ["A.C.", "AA.", "All.", "Ant.", "Av.", "Avda.", "Bien.", "C.", "C.P.", "C.S.", "C.V.", "CA.", "Col.", "Comm.", "Corp.", "Cía.", "D.", "DC.", "Da.", "Desc.", "Desv.", "Dr.", "Dra.", "Drs.", "Dto.", "Dª.", "Dña.", "Em.", "Emm.", "Exc.", "Excma.", "Excmas.", "Excmo.", "Excmos.", "Exma.", "Exmas.", "Exmo.", "Exmos.", "FF.CC.", "Fabric.", "Fr.", "H.P.", "Id.", "Ilma.", "Ilmas.", "Ilmo.", "Ilmos.", "Inc.", "JJ.OO.", "K.", "Kit.", "Korn.", "L.", "Lcda.", "Lcdo.", "Lda.", "Ldo.", "Lic.", "Ltd.", "Ltda.", "Ltdo.", "M.", "MM.", "Mons.", "Mr.", "Mrs.", "O.M.", "PP.", "R.D.", "R.U.", "RAM.", "RR.HH.", "Rdo.", "Rdos.", "Reg.", "Rev.", "Rol.", "Rvdmo.", "Rvdmos.", "Rvdo.", "Rvdos.", "SA.", "SS.AA.", "SS.MM.", "Sdad.", "Seg.", "Sol.", "Sr.", "Sra.", "Sras.", "Sres.", "Srta.", "Srtas.", "Sta.", "Sto.", "Trab.", "U.S.", "U.S.A.", "Var.", "Vda.", "a. C.", "a. e. c.", "abr.", "afma.", "afmas.", "afmo.", "afmos.", "ago.", "bco.", "bol.", "c/c.", "cap.", "cf.", "cfr.", "col.", "d. C.", "depto.", "deptos.", "dic.", "doc.", "dom.", "dpto.", "dptos.", "dtor.", "e. c.", "e.g.", "ed.", "ej.", "ene.", "feb.", "fig.", "figs.", "fund.", "hnos.", "jue.", "jul.", "jun.", "licda.", "licdo.", "lun.", "mar.", "may.", "mié.", "ms.", "mss.", "mtro.", "nov.", "ntra.", "ntro.", "oct.", "p.ej.", "prof.", "prov.", "sept.", "sras.", "sres.", "srs.", "ss.", "sáb.", "trad.", "v.gr.", "vid.", "vie.", "vs."],
|
|
@@ -3758,39 +3771,39 @@ const Ca = {
|
|
|
3758
3771
|
ru: ["авг.", "апр.", "дек.", "до н. э.", "кв.", "н. э.", "н.э.", "нояб.", "окт.", "отд.", "проф.", "руб.", "сент.", "тел.", "тыс.", "ул.", "февр.", "янв."],
|
|
3759
3772
|
th: ["ค.ศ."]
|
|
3760
3773
|
};
|
|
3761
|
-
function
|
|
3774
|
+
function qe(n, e, t) {
|
|
3762
3775
|
let s = t;
|
|
3763
3776
|
for (; s > e && /\s/.test(n[s - 1]); ) s--;
|
|
3764
3777
|
return s;
|
|
3765
3778
|
}
|
|
3766
|
-
const
|
|
3767
|
-
function
|
|
3779
|
+
const Pa = /[\s([{"'“‘]/;
|
|
3780
|
+
function Aa(n, e) {
|
|
3768
3781
|
for (const t of e) {
|
|
3769
3782
|
if (n.length < t.length || !n.endsWith(t)) continue;
|
|
3770
3783
|
const s = n.length - t.length - 1;
|
|
3771
|
-
if (s < 0 ||
|
|
3784
|
+
if (s < 0 || Pa.test(n[s])) return !0;
|
|
3772
3785
|
}
|
|
3773
3786
|
return !1;
|
|
3774
3787
|
}
|
|
3775
|
-
function
|
|
3788
|
+
function La(n) {
|
|
3776
3789
|
let e = 0;
|
|
3777
3790
|
for (const t of n)
|
|
3778
3791
|
if (new RegExp("\\p{L}", "u").test(t) && e++, e >= 2) return !0;
|
|
3779
3792
|
return !1;
|
|
3780
3793
|
}
|
|
3781
|
-
function
|
|
3794
|
+
function Oa(n) {
|
|
3782
3795
|
return /\.{3,}$/.test(n);
|
|
3783
3796
|
}
|
|
3784
|
-
function
|
|
3797
|
+
function Va(n, e, t, s) {
|
|
3785
3798
|
if (s === "“") return !0;
|
|
3786
3799
|
if (s !== '"') return !1;
|
|
3787
3800
|
let i = 0;
|
|
3788
3801
|
for (let a = e; a < t; a++) n[a] === '"' && i++;
|
|
3789
3802
|
return i % 2 === 1;
|
|
3790
3803
|
}
|
|
3791
|
-
const
|
|
3792
|
-
function
|
|
3793
|
-
const t = [...n.matchAll(
|
|
3804
|
+
const Ta = new RegExp(`[.!?][”"'’)\\]]*\\s+—\\s+(?=\\p{Lu})`, "gu");
|
|
3805
|
+
function Ua(n, e) {
|
|
3806
|
+
const t = [...n.matchAll(Ta)].map((i) => i.index + i[0].length);
|
|
3794
3807
|
if (t.length === 0) return e;
|
|
3795
3808
|
const s = [];
|
|
3796
3809
|
for (const i of e) {
|
|
@@ -3801,8 +3814,8 @@ function Oa(n, e) {
|
|
|
3801
3814
|
}
|
|
3802
3815
|
return s;
|
|
3803
3816
|
}
|
|
3804
|
-
const
|
|
3805
|
-
function
|
|
3817
|
+
const xa = { "»": "«", "«": "»", "›": "‹", "‹": "›" };
|
|
3818
|
+
function Na(n, e) {
|
|
3806
3819
|
const t = [], s = /* @__PURE__ */ new Map();
|
|
3807
3820
|
let i = 0;
|
|
3808
3821
|
const a = (r, o) => {
|
|
@@ -3814,7 +3827,7 @@ function Ta(n, e) {
|
|
|
3814
3827
|
let c = o.start;
|
|
3815
3828
|
for (; l && c < o.end; ) {
|
|
3816
3829
|
for (; c < o.end && /\s/.test(n[c]); ) c++;
|
|
3817
|
-
const u =
|
|
3830
|
+
const u = xa[n[c]];
|
|
3818
3831
|
if (u === void 0 || a(l.end, u) <= a(l.end, n[c])) break;
|
|
3819
3832
|
for (c++; c < o.end && /\s/.test(n[c]); ) c++;
|
|
3820
3833
|
l.end = o.start = c;
|
|
@@ -3823,32 +3836,32 @@ function Ta(n, e) {
|
|
|
3823
3836
|
}
|
|
3824
3837
|
return t;
|
|
3825
3838
|
}
|
|
3826
|
-
function
|
|
3827
|
-
const s =
|
|
3839
|
+
function za(n, e, t) {
|
|
3840
|
+
const s = Na(n, Ua(n, e));
|
|
3828
3841
|
for (let a = 0; a < s.length - 1; a++) {
|
|
3829
|
-
const r =
|
|
3842
|
+
const r = qe(n, s[a].start, s[a].end);
|
|
3830
3843
|
if (r !== s[a].end || r <= s[a].start) continue;
|
|
3831
3844
|
const o = n[r - 1];
|
|
3832
|
-
|
|
3845
|
+
Va(n, s[a].start, r, o) && (s[a].end -= 1, s[a + 1].start -= 1);
|
|
3833
3846
|
}
|
|
3834
3847
|
const i = [];
|
|
3835
3848
|
for (const a of s) {
|
|
3836
3849
|
let r = a;
|
|
3837
3850
|
for (; i.length > 0; ) {
|
|
3838
|
-
const o = i[i.length - 1], l =
|
|
3839
|
-
if (!
|
|
3851
|
+
const o = i[i.length - 1], l = qe(n, o.start, o.end), c = n.slice(o.start, l);
|
|
3852
|
+
if (!Aa(c, t) && La(c) && !Oa(c)) break;
|
|
3840
3853
|
i.pop(), r = { start: o.start, end: r.end };
|
|
3841
3854
|
}
|
|
3842
3855
|
i.push(r);
|
|
3843
3856
|
}
|
|
3844
3857
|
return i.map((a) => {
|
|
3845
|
-
const r =
|
|
3858
|
+
const r = qe(n, a.start, a.end);
|
|
3846
3859
|
return { text: n.slice(a.start, r), start: a.start, end: a.end, contentEnd: r };
|
|
3847
3860
|
});
|
|
3848
3861
|
}
|
|
3849
|
-
const
|
|
3850
|
-
function
|
|
3851
|
-
let e =
|
|
3862
|
+
const nn = /* @__PURE__ */ new Map();
|
|
3863
|
+
function Zn(n) {
|
|
3864
|
+
let e = nn.get(n);
|
|
3852
3865
|
if (!e) {
|
|
3853
3866
|
try {
|
|
3854
3867
|
const [t, s] = R(n), i = s ? `${t}-${s}` : t;
|
|
@@ -3856,19 +3869,19 @@ function Qn(n) {
|
|
|
3856
3869
|
} catch {
|
|
3857
3870
|
e = { segmenter: new Intl.Segmenter("en", { granularity: "sentence" }), language: "en" };
|
|
3858
3871
|
}
|
|
3859
|
-
|
|
3872
|
+
nn.set(n, e);
|
|
3860
3873
|
}
|
|
3861
3874
|
return e;
|
|
3862
3875
|
}
|
|
3863
|
-
function
|
|
3864
|
-
return
|
|
3876
|
+
function Ma(n) {
|
|
3877
|
+
return Zn(n).language;
|
|
3865
3878
|
}
|
|
3866
|
-
async function
|
|
3879
|
+
async function Xn(n, e, t) {
|
|
3867
3880
|
if (e === "") return [];
|
|
3868
|
-
const { segmenter: s, language: i } =
|
|
3869
|
-
return
|
|
3881
|
+
const { segmenter: s, language: i } = Zn(n), r = [...s.segment(e)].map((c) => ({ start: c.index, end: c.index + c.segment.length })), o = kn(Ia, i) ?? [], l = t ? [...o, ...t] : o;
|
|
3882
|
+
return za(e, r, l);
|
|
3870
3883
|
}
|
|
3871
|
-
const
|
|
3884
|
+
const xr = [
|
|
3872
3885
|
"aside",
|
|
3873
3886
|
"audio",
|
|
3874
3887
|
"bibliography",
|
|
@@ -3891,7 +3904,7 @@ const Tr = [
|
|
|
3891
3904
|
"table",
|
|
3892
3905
|
"toc",
|
|
3893
3906
|
"video"
|
|
3894
|
-
],
|
|
3907
|
+
], Ba = [
|
|
3895
3908
|
// Headings
|
|
3896
3909
|
"heading1",
|
|
3897
3910
|
"heading2",
|
|
@@ -3949,50 +3962,50 @@ const Tr = [
|
|
|
3949
3962
|
"section",
|
|
3950
3963
|
"summary",
|
|
3951
3964
|
"tip"
|
|
3952
|
-
],
|
|
3965
|
+
], Da = {
|
|
3953
3966
|
footnote: { drops: ["aside"], unconditional: !0 },
|
|
3954
3967
|
cover: { drops: ["image"] },
|
|
3955
3968
|
pullquote: { drops: ["blockquote", "aside"] },
|
|
3956
3969
|
epigraph: { drops: ["blockquote"] }
|
|
3957
|
-
},
|
|
3958
|
-
function
|
|
3959
|
-
const t =
|
|
3970
|
+
}, ja = ["abbreviation", "biblioref", "glossref", "noteref", "pagebreak"], Fa = ["biblioref", "glossref"], _a = ["audio", "video", "image", "figure", "math", "table", "cover"], $a = ["cell", "rowheader"], qa = ["separator"], Le = new Set(Ba), kt = new Set(ja), Ga = new Set(_a), Yn = new Set($a), Ha = new Set(qa), le = new Set(Fa);
|
|
3971
|
+
function Ka(n, e) {
|
|
3972
|
+
const t = Us.createInstance();
|
|
3960
3973
|
return t.init({
|
|
3961
3974
|
lng: n,
|
|
3962
3975
|
resources: { [n]: { translation: e } },
|
|
3963
3976
|
interpolation: { escapeValue: !1 }
|
|
3964
3977
|
}), t;
|
|
3965
3978
|
}
|
|
3966
|
-
function
|
|
3979
|
+
function Wa(n, e, t) {
|
|
3967
3980
|
if (!e) return n;
|
|
3968
3981
|
const s = { ...n };
|
|
3969
3982
|
for (const i of Object.keys(e))
|
|
3970
3983
|
s[i] = t(n[i], e[i]);
|
|
3971
3984
|
return s;
|
|
3972
3985
|
}
|
|
3973
|
-
function
|
|
3986
|
+
function es(n, e) {
|
|
3974
3987
|
if (typeof e == "string" || typeof n != "object") return e;
|
|
3975
3988
|
const t = { ...n };
|
|
3976
3989
|
for (const s of Object.keys(e))
|
|
3977
|
-
t[s] =
|
|
3990
|
+
t[s] = es(n[s], e[s]);
|
|
3978
3991
|
return t;
|
|
3979
3992
|
}
|
|
3980
|
-
function
|
|
3981
|
-
return
|
|
3993
|
+
function Qa(n, e) {
|
|
3994
|
+
return Wa(n, e, es);
|
|
3982
3995
|
}
|
|
3983
|
-
function
|
|
3996
|
+
function ts(n, e = [], t = /* @__PURE__ */ new Map()) {
|
|
3984
3997
|
for (const s of n)
|
|
3985
|
-
t.set(s, e), s.children &&
|
|
3998
|
+
t.set(s, e), s.children && ts(s.children, [s, ...e], t);
|
|
3986
3999
|
return t;
|
|
3987
4000
|
}
|
|
3988
|
-
async function
|
|
3989
|
-
const t = e.contextualizationLocale ?? "en", s =
|
|
3990
|
-
await
|
|
4001
|
+
async function ns(n, e) {
|
|
4002
|
+
const t = e.contextualizationLocale ?? "en", s = Qa(
|
|
4003
|
+
await Ra(t),
|
|
3991
4004
|
e.contextualization?.contextualizations
|
|
3992
4005
|
);
|
|
3993
4006
|
return {
|
|
3994
|
-
i18n:
|
|
3995
|
-
contextualizationLanguage:
|
|
4007
|
+
i18n: Ka(t, s),
|
|
4008
|
+
contextualizationLanguage: Ea(t),
|
|
3996
4009
|
skip: new Set(e.skip ?? []),
|
|
3997
4010
|
contextualize: new Set(e.contextualize ?? []),
|
|
3998
4011
|
contextualizationShapes: e.contextualization?.shapes ?? {},
|
|
@@ -4003,35 +4016,36 @@ async function es(n, e) {
|
|
|
4003
4016
|
languageOverrides: e.languageOverrides ?? {},
|
|
4004
4017
|
contentLanguage: e.contentLanguage,
|
|
4005
4018
|
segmentation: e.segmentation?.mode ?? "structure",
|
|
4019
|
+
segmentationReconstruct: e.segmentation?.reconstruct ?? !1,
|
|
4006
4020
|
// segmentSentences() already applies builtInSuppressions internally
|
|
4007
4021
|
// (Intl.Segmenter has no built-in equivalent of its own) — this is only
|
|
4008
4022
|
// the caller's own additive extras, per `SegmentationOptions.suppressions`.
|
|
4009
4023
|
segmentationSuppressions: e.segmentation?.suppressions ?? {},
|
|
4010
|
-
segmenter: e.segmentation?.segmenter ??
|
|
4024
|
+
segmenter: e.segmentation?.segmenter ?? Xn,
|
|
4011
4025
|
// Per-key override, not an additive union — each key holds one whole rule.
|
|
4012
|
-
substitutions: { ...
|
|
4026
|
+
substitutions: { ...wa, ...e.substitutions },
|
|
4013
4027
|
blockStarts: /* @__PURE__ */ new Set(),
|
|
4014
4028
|
tableRowNumbers: /* @__PURE__ */ new Map(),
|
|
4015
4029
|
tableCellHeaders: /* @__PURE__ */ new Map(),
|
|
4016
4030
|
synthetic: /* @__PURE__ */ new Set(),
|
|
4017
|
-
ancestorChains:
|
|
4031
|
+
ancestorChains: ts(n),
|
|
4018
4032
|
pendingRange: /* @__PURE__ */ new Map(),
|
|
4019
4033
|
edgeSubstitutedLocate: /* @__PURE__ */ new WeakMap(),
|
|
4020
4034
|
aliasLocates: /* @__PURE__ */ new WeakSet(),
|
|
4021
4035
|
placeholderPieces: /* @__PURE__ */ new Map()
|
|
4022
4036
|
};
|
|
4023
4037
|
}
|
|
4024
|
-
const
|
|
4025
|
-
function
|
|
4026
|
-
return n.replace(
|
|
4038
|
+
const Ja = /<lang xml:lang="[^"]*">([\s\S]*?)<\/lang>/g;
|
|
4039
|
+
function ss(n) {
|
|
4040
|
+
return n.replace(Ja, "$1");
|
|
4027
4041
|
}
|
|
4028
|
-
function
|
|
4042
|
+
function is(n, e) {
|
|
4029
4043
|
return n === void 0 ? void 0 : ut(e, n) ?? n;
|
|
4030
4044
|
}
|
|
4031
4045
|
function $(n, e) {
|
|
4032
|
-
return
|
|
4046
|
+
return is(e.language === "none" ? e.contentLanguage : n ?? e.contentLanguage, e.languageOverrides);
|
|
4033
4047
|
}
|
|
4034
|
-
function
|
|
4048
|
+
function Ct(n, e) {
|
|
4035
4049
|
return n === e || n !== void 0 && e !== void 0 && n.toLowerCase() === e.toLowerCase();
|
|
4036
4050
|
}
|
|
4037
4051
|
function at(n, e) {
|
|
@@ -4039,80 +4053,80 @@ function at(n, e) {
|
|
|
4039
4053
|
}
|
|
4040
4054
|
function rt(n, e, t, s) {
|
|
4041
4055
|
const { language: i } = e;
|
|
4042
|
-
return i === void 0 ? !0 :
|
|
4056
|
+
return i === void 0 ? !0 : rs(e, t) ? os(e) ? (n.wordless = i, !0) : !s && n.content !== void 0 && !at(n.content, i) ? !1 : (n.entry = i, !0) : n.content !== void 0 && !Ct(n.content, i) || !s && n.entry !== void 0 && !at(i, n.entry) ? !1 : (n.content = i, !0);
|
|
4043
4057
|
}
|
|
4044
|
-
function
|
|
4058
|
+
function as(n, e, t) {
|
|
4045
4059
|
const s = {};
|
|
4046
4060
|
for (const i of n)
|
|
4047
4061
|
if (!rt(s, i, e, t)) return null;
|
|
4048
4062
|
return s.content ?? s.entry ?? s.wordless;
|
|
4049
4063
|
}
|
|
4050
|
-
function
|
|
4051
|
-
return
|
|
4064
|
+
function Za(n, e) {
|
|
4065
|
+
return as(n, e, !1);
|
|
4052
4066
|
}
|
|
4053
|
-
function
|
|
4054
|
-
return e.synthetic.has(n) &&
|
|
4067
|
+
function rs(n, e) {
|
|
4068
|
+
return e.synthetic.has(n) && Ct(n.language, e.contextualizationLanguage);
|
|
4055
4069
|
}
|
|
4056
|
-
function
|
|
4070
|
+
function os(n) {
|
|
4057
4071
|
return !/[\p{L}\p{N}]/u.test(n.plain ?? Ee(n.ssml ?? ""));
|
|
4058
4072
|
}
|
|
4059
|
-
function
|
|
4060
|
-
return
|
|
4073
|
+
function ls(n, e) {
|
|
4074
|
+
return as(n, e, e.format === "ssml");
|
|
4061
4075
|
}
|
|
4062
|
-
function
|
|
4076
|
+
function cs(n, e, t) {
|
|
4063
4077
|
const s = n.ssml ?? "";
|
|
4064
|
-
return !e || !n.language || !
|
|
4078
|
+
return !e || !n.language || !rs(n, t) || os(n) || at(n.language, e) ? s : `<lang xml:lang="${wn(n.language)}">${s}</lang>`;
|
|
4065
4079
|
}
|
|
4066
|
-
function
|
|
4080
|
+
function Et(n, e) {
|
|
4067
4081
|
const t = e.format === "ssml", s = [];
|
|
4068
4082
|
let i = 0, a = {};
|
|
4069
4083
|
return n.forEach((r, o) => {
|
|
4070
4084
|
rt(a, r, e, t) || (s.push([i, o]), i = o, a = {}, rt(a, r, e, t));
|
|
4071
4085
|
}), n.length > 0 && s.push([i, n.length]), s;
|
|
4072
4086
|
}
|
|
4073
|
-
function
|
|
4087
|
+
function us(n, e) {
|
|
4074
4088
|
return n.replace(/<lang xml:lang="([^"]*)">/g, (t, s) => {
|
|
4075
|
-
const i =
|
|
4089
|
+
const i = is(s, e);
|
|
4076
4090
|
return i === s ? t : `<lang xml:lang="${i}">`;
|
|
4077
4091
|
});
|
|
4078
4092
|
}
|
|
4079
|
-
function
|
|
4093
|
+
function x(n) {
|
|
4080
4094
|
return n.role ? [...n.role] : [];
|
|
4081
4095
|
}
|
|
4082
|
-
function
|
|
4096
|
+
function Oe(n) {
|
|
4083
4097
|
return n.role?.has("math") ? void 0 : n.text;
|
|
4084
4098
|
}
|
|
4085
|
-
function
|
|
4099
|
+
function De(n) {
|
|
4086
4100
|
const e = n.description?.text;
|
|
4087
4101
|
if (e)
|
|
4088
4102
|
return e.plain ?? (e.ssml !== void 0 ? U(e.ssml) : void 0);
|
|
4089
4103
|
}
|
|
4090
|
-
function
|
|
4104
|
+
function hs(n) {
|
|
4091
4105
|
return n.description?.text?.language;
|
|
4092
4106
|
}
|
|
4093
|
-
function
|
|
4107
|
+
function Ve(n, e = n) {
|
|
4094
4108
|
let t = "", s = "";
|
|
4095
4109
|
const i = [];
|
|
4096
4110
|
return n.forEach((a, r) => {
|
|
4097
4111
|
const o = e[r];
|
|
4098
|
-
if (o.length === 1 &&
|
|
4112
|
+
if (o.length === 1 && pi(o) && s.endsWith(o)) {
|
|
4099
4113
|
i.push({ start: t.length, end: t.length });
|
|
4100
4114
|
return;
|
|
4101
4115
|
}
|
|
4102
|
-
s && !fe(o) && !
|
|
4116
|
+
s && !fe(o) && !fi(s) && !/\s$/.test(s) && !/^\s/.test(o) && (t += " ", s += " ");
|
|
4103
4117
|
const l = t.length;
|
|
4104
4118
|
t += a, s += o, i.push({ start: l, end: t.length });
|
|
4105
4119
|
}), { joined: t, ranges: i };
|
|
4106
4120
|
}
|
|
4107
4121
|
function X(n, e) {
|
|
4108
|
-
const t =
|
|
4122
|
+
const t = xs(n), s = O(n, e.ancestorChains)?.ref;
|
|
4109
4123
|
if (t) {
|
|
4110
4124
|
const i = { cssSelector: t };
|
|
4111
|
-
return s?.href !== void 0 && (i.href = s.href),
|
|
4125
|
+
return s?.href !== void 0 && (i.href = s.href), st(i);
|
|
4112
4126
|
}
|
|
4113
|
-
return s &&
|
|
4127
|
+
return s && st(s);
|
|
4114
4128
|
}
|
|
4115
|
-
function
|
|
4129
|
+
function ds(n, e, t) {
|
|
4116
4130
|
const s = [];
|
|
4117
4131
|
return n.forEach((i, a) => {
|
|
4118
4132
|
if (i.offsets) {
|
|
@@ -4130,13 +4144,13 @@ function us(n, e, t) {
|
|
|
4130
4144
|
s.push({ start: c?.start ?? 0, end: c?.end ?? l.length, locate: u });
|
|
4131
4145
|
}), s;
|
|
4132
4146
|
}
|
|
4133
|
-
function
|
|
4147
|
+
function sn(n, e, t, s) {
|
|
4134
4148
|
const i = s.edgeSubstitutedLocate.get(n);
|
|
4135
4149
|
if (i) return i[t];
|
|
4136
4150
|
if (!(!e || Array.isArray(e) || !H(e)))
|
|
4137
4151
|
return X(e, s);
|
|
4138
4152
|
}
|
|
4139
|
-
function
|
|
4153
|
+
function Xa(n, e, t) {
|
|
4140
4154
|
const s = n.map((l, c) => {
|
|
4141
4155
|
if (l.locate) return l.locate;
|
|
4142
4156
|
if (t.synthetic.has(l)) return;
|
|
@@ -4144,7 +4158,7 @@ function Qa(n, e, t) {
|
|
|
4144
4158
|
if (!u || Array.isArray(u)) return;
|
|
4145
4159
|
const d = t.format === "ssml" ? l.ssml : l.plain;
|
|
4146
4160
|
if (d)
|
|
4147
|
-
return H(u) ? O(u, t.ancestorChains) && X(u, t) :
|
|
4161
|
+
return H(u) ? O(u, t.ancestorChains) && X(u, t) : It(O(u, t.ancestorChains), d);
|
|
4148
4162
|
}), i = s.findIndex((l) => l !== void 0);
|
|
4149
4163
|
if (i === -1) return;
|
|
4150
4164
|
let a = s.length - 1;
|
|
@@ -4153,36 +4167,36 @@ function Qa(n, e, t) {
|
|
|
4153
4167
|
const r = e[i], o = e[a];
|
|
4154
4168
|
if (r && o && !Array.isArray(r) && !Array.isArray(o)) {
|
|
4155
4169
|
const l = O(r, t.ancestorChains), c = O(o, t.ancestorChains);
|
|
4156
|
-
return
|
|
4170
|
+
return Pt(l, c, s[i]);
|
|
4157
4171
|
}
|
|
4158
4172
|
return s[i];
|
|
4159
4173
|
}
|
|
4160
|
-
function
|
|
4174
|
+
function je(n, e, t) {
|
|
4161
4175
|
const s = [], i = [], a = [];
|
|
4162
4176
|
for (let f = 0; f < n.length; f++) {
|
|
4163
4177
|
const p = n[f], g = t.format === "ssml" ? p.ssml : p.plain;
|
|
4164
4178
|
g && (s.push(g), i.push(p), a.push(e[f]));
|
|
4165
4179
|
}
|
|
4166
4180
|
if (s.length === 0) return;
|
|
4167
|
-
const r =
|
|
4181
|
+
const r = ls(i, t);
|
|
4168
4182
|
if (r === null) return;
|
|
4169
|
-
const { joined: o } =
|
|
4183
|
+
const { joined: o } = Ve(t.format === "ssml" ? i.map((f) => cs(f, r, t)) : s), l = t.format === "ssml" ? { ssml: o } : { plain: o };
|
|
4170
4184
|
r && (l.language = r), n.some((f) => t.synthetic.has(f)) && t.synthetic.add(l);
|
|
4171
|
-
const c =
|
|
4185
|
+
const c = ds(i, a, t);
|
|
4172
4186
|
c.length > 0 && (l.offsets = c);
|
|
4173
|
-
const u =
|
|
4187
|
+
const u = Xa(i, a, t);
|
|
4174
4188
|
u && (l.locate = u);
|
|
4175
|
-
const d =
|
|
4189
|
+
const d = sn(i[0], a[0], "leading", t), h = sn(i[i.length - 1], a[i.length - 1], "trailing", t);
|
|
4176
4190
|
return (d || h) && t.edgeSubstitutedLocate.set(l, { leading: d, trailing: h }), l;
|
|
4177
4191
|
}
|
|
4178
|
-
function
|
|
4179
|
-
if (e === "plain" && t !== "block-level" && t !== "none" && n.ssml &&
|
|
4192
|
+
function Rt(n, e, t, s) {
|
|
4193
|
+
if (e === "plain" && t !== "block-level" && t !== "none" && n.ssml && xn(n.ssml))
|
|
4180
4194
|
return dt(n.ssml, n.language).map((r) => {
|
|
4181
4195
|
const o = { plain: r.plain }, l = $(r.language, s);
|
|
4182
4196
|
return l && (o.language = l), s.pendingRange.set(o, { start: r.start, end: r.end }), o;
|
|
4183
4197
|
});
|
|
4184
4198
|
const i = {}, a = $(n.language, s);
|
|
4185
|
-
return a && (i.language = a), e === "ssml" ? i.ssml = n.ssml ?
|
|
4199
|
+
return a && (i.language = a), e === "ssml" ? i.ssml = n.ssml ? us(n.ssml, s.languageOverrides) : M(n.plain ?? "") : i.plain = n.plain ?? U(n.ssml ?? ""), (t === "block-level" || t === "none") && i.ssml && (i.ssml = ss(i.ssml)), [i];
|
|
4186
4200
|
}
|
|
4187
4201
|
function pe(n, e) {
|
|
4188
4202
|
return e !== "ssml" ? n : n.replace(/<[^>]+>/g, "").replace(/</g, "<").replace(/>/g, ">").replace(/&/g, "&");
|
|
@@ -4194,21 +4208,21 @@ function Y(n, e) {
|
|
|
4194
4208
|
return n.href !== void 0 && (s.href = n.href), s;
|
|
4195
4209
|
}
|
|
4196
4210
|
function O(n, e) {
|
|
4197
|
-
const t =
|
|
4211
|
+
const t = Bt(n);
|
|
4198
4212
|
if (t) return { own: !0, ref: t };
|
|
4199
4213
|
for (const s of e.get(n) ?? []) {
|
|
4200
|
-
const i =
|
|
4214
|
+
const i = Bt(s);
|
|
4201
4215
|
if (i) return { own: !1, ref: i };
|
|
4202
4216
|
}
|
|
4203
4217
|
}
|
|
4204
|
-
function
|
|
4218
|
+
function It(n, e) {
|
|
4205
4219
|
if (n)
|
|
4206
4220
|
return n.own ? n.ref : Y(n.ref, e);
|
|
4207
4221
|
}
|
|
4208
|
-
function
|
|
4209
|
-
return (n && e ?
|
|
4222
|
+
function Pt(n, e, t) {
|
|
4223
|
+
return (n && e ? Ns(n.ref, e.ref) : void 0) ?? t;
|
|
4210
4224
|
}
|
|
4211
|
-
function
|
|
4225
|
+
function gs(n, e, t) {
|
|
4212
4226
|
const { ancestorChains: s } = t, i = /* @__PURE__ */ new Map();
|
|
4213
4227
|
for (const a of e)
|
|
4214
4228
|
a && !Array.isArray(a) && i.set(a, (i.get(a) ?? 0) + 1);
|
|
@@ -4216,7 +4230,7 @@ function hs(n, e, t) {
|
|
|
4216
4230
|
if (a.offsets) return a;
|
|
4217
4231
|
const o = e[r], l = a.plain ?? a.ssml ?? "";
|
|
4218
4232
|
if (Array.isArray(o)) {
|
|
4219
|
-
const [h, f] = o, p = O(h, s), g = O(f, s), v =
|
|
4233
|
+
const [h, f] = o, p = O(h, s), g = O(f, s), v = Pt(p, g, It(p, l));
|
|
4220
4234
|
return v ? { ...a, locate: v } : a;
|
|
4221
4235
|
}
|
|
4222
4236
|
const c = o, u = c ? O(c, s) : void 0;
|
|
@@ -4229,18 +4243,18 @@ function hs(n, e, t) {
|
|
|
4229
4243
|
return d;
|
|
4230
4244
|
});
|
|
4231
4245
|
}
|
|
4232
|
-
function
|
|
4233
|
-
const e =
|
|
4246
|
+
function At(n) {
|
|
4247
|
+
const e = Me(Oe(n));
|
|
4234
4248
|
return e ? e.plain ?? (e.ssml ? U(e.ssml) : "") : "";
|
|
4235
4249
|
}
|
|
4236
|
-
function
|
|
4250
|
+
function Ya(n) {
|
|
4237
4251
|
const e = /* @__PURE__ */ new Map(), t = /* @__PURE__ */ new Map();
|
|
4238
4252
|
let s = 0, i;
|
|
4239
4253
|
return n.forEach((a, r) => {
|
|
4240
4254
|
e.set(a, r + 1);
|
|
4241
4255
|
const o = a.children ?? [];
|
|
4242
4256
|
if (s = Math.max(s, o.length), o.some((l) => l.role?.has("columnheader"))) {
|
|
4243
|
-
i = o.map(
|
|
4257
|
+
i = o.map(At);
|
|
4244
4258
|
return;
|
|
4245
4259
|
}
|
|
4246
4260
|
i && o.forEach((l, c) => {
|
|
@@ -4250,23 +4264,23 @@ function Ja(n) {
|
|
|
4250
4264
|
});
|
|
4251
4265
|
}), { lines: n.length, columns: s, rowNumbers: e, cellHeaders: t };
|
|
4252
4266
|
}
|
|
4253
|
-
function
|
|
4254
|
-
const t = e.format === "ssml" ? { ssml:
|
|
4267
|
+
function fs(n, e) {
|
|
4268
|
+
const t = e.format === "ssml" ? { ssml: M(n) } : { plain: n };
|
|
4255
4269
|
return e.synthetic.add(t), t;
|
|
4256
4270
|
}
|
|
4257
|
-
function
|
|
4258
|
-
const t =
|
|
4271
|
+
function B(n, e) {
|
|
4272
|
+
const t = fs(n, e), s = e.language === "none" ? $(void 0, e) : e.contextualizationLanguage;
|
|
4259
4273
|
return s && (t.language = s), t;
|
|
4260
4274
|
}
|
|
4261
4275
|
function ot(n, e, t) {
|
|
4262
|
-
const s =
|
|
4276
|
+
const s = fs(n, t), i = $(hs(e), t);
|
|
4263
4277
|
return i && (s.language = i), s;
|
|
4264
4278
|
}
|
|
4265
4279
|
function W(n, e, t, s) {
|
|
4266
4280
|
n.push(...s);
|
|
4267
4281
|
for (let i = 0; i < s.length; i++) e.push(t);
|
|
4268
4282
|
}
|
|
4269
|
-
function
|
|
4283
|
+
function Te(n, e, t, s, i, a, r) {
|
|
4270
4284
|
r ? (i.some((o) => t.blockStarts.has(o)) && t.blockStarts.add(r), W(n, e, a[0] ?? s, [r])) : (n.push(...i), e.push(...a));
|
|
4271
4285
|
}
|
|
4272
4286
|
function G(n, e, t, s) {
|
|
@@ -4274,13 +4288,13 @@ function G(n, e, t, s) {
|
|
|
4274
4288
|
if (i && n.i18n.exists(i)) return n.i18n.t(i, s);
|
|
4275
4289
|
if (n.i18n.exists(e)) return n.i18n.t(e, s);
|
|
4276
4290
|
}
|
|
4277
|
-
function
|
|
4278
|
-
return
|
|
4291
|
+
function Lt(n, e) {
|
|
4292
|
+
return Yn.has(n) ? !0 : e.contextualize.has(n);
|
|
4279
4293
|
}
|
|
4280
|
-
function
|
|
4294
|
+
function ps(n, e, t) {
|
|
4281
4295
|
return e.some((s) => {
|
|
4282
|
-
const i =
|
|
4283
|
-
return i?.drops.includes(n) ? i.unconditional ||
|
|
4296
|
+
const i = Da[s];
|
|
4297
|
+
return i?.drops.includes(n) ? i.unconditional || Lt(s, t) : !1;
|
|
4284
4298
|
});
|
|
4285
4299
|
}
|
|
4286
4300
|
function ge(n, e, t, s, i) {
|
|
@@ -4291,216 +4305,216 @@ function ge(n, e, t, s, i) {
|
|
|
4291
4305
|
const o = Y(r.ref, t);
|
|
4292
4306
|
n.offsets = [{ start: a, end: a + t.length, locate: o }], n.locate = r.own ? r.ref : o;
|
|
4293
4307
|
}
|
|
4294
|
-
function
|
|
4308
|
+
function Ge(n, e, t, s, i, a) {
|
|
4295
4309
|
const r = a?.value;
|
|
4296
|
-
if (r !== void 0 && r ===
|
|
4310
|
+
if (r !== void 0 && r === At(t)) {
|
|
4297
4311
|
const l = $(t.text?.language, s);
|
|
4298
4312
|
l && (n.language = l), s.synthetic.delete(n), ge(n, e, r, t, s);
|
|
4299
4313
|
return;
|
|
4300
4314
|
}
|
|
4301
4315
|
const o = a?.description;
|
|
4302
|
-
o !== void 0 && o ===
|
|
4316
|
+
o !== void 0 && o === De(t) && (i === "figure" || i === "table") && ge(n, e, o, t, s);
|
|
4303
4317
|
}
|
|
4304
|
-
function
|
|
4305
|
-
if (!
|
|
4318
|
+
function an(n, e, t, s, i, a, r, o) {
|
|
4319
|
+
if (!Lt(i, s)) return;
|
|
4306
4320
|
if ((s.i18n.exists(`${i}.block.start`) || s.i18n.exists(`${i}.block.end`)) && s.contextualizationShapes[i] !== "inline") {
|
|
4307
4321
|
const c = a === "before" ? `${i}.block.start` : `${i}.block.end`;
|
|
4308
|
-
W(n, e, t,
|
|
4322
|
+
W(n, e, t, on(c, r, o, t, i, s));
|
|
4309
4323
|
return;
|
|
4310
4324
|
}
|
|
4311
|
-
a === "before" && W(n, e, t,
|
|
4325
|
+
a === "before" && W(n, e, t, on(`${i}.inline`, r, o, t, i, s));
|
|
4312
4326
|
}
|
|
4313
|
-
const
|
|
4314
|
-
function
|
|
4327
|
+
const rn = "\0";
|
|
4328
|
+
function on(n, e, t, s, i, a) {
|
|
4315
4329
|
const r = G(a, n, e, t);
|
|
4316
4330
|
if (!r) return [];
|
|
4317
|
-
const o = t?.description, l = a.language !== "none" && o !== void 0 && o ===
|
|
4331
|
+
const o = t?.description, l = a.language !== "none" && o !== void 0 && o === De(s) ? $(hs(s), a) : void 0, c = l ? G(a, n, e, { ...t, description: rn })?.split(rn) : void 0;
|
|
4318
4332
|
if (!l || !c || c.length < 2) {
|
|
4319
|
-
const h =
|
|
4320
|
-
return
|
|
4333
|
+
const h = B(r, a);
|
|
4334
|
+
return Ge(h, r, s, a, i, t), [h];
|
|
4321
4335
|
}
|
|
4322
4336
|
if (R(l)[0] === R(a.contextualizationLanguage)[0]) {
|
|
4323
|
-
const h =
|
|
4324
|
-
return h.language = l,
|
|
4337
|
+
const h = B(r, a);
|
|
4338
|
+
return h.language = l, Ge(h, r, s, a, i, t), [h];
|
|
4325
4339
|
}
|
|
4326
|
-
const u = `<lang xml:lang="${
|
|
4340
|
+
const u = `<lang xml:lang="${wn(l)}">${M(o)}</lang>`, d = c.map((h) => M(h)).join(u);
|
|
4327
4341
|
if (a.format === "ssml") {
|
|
4328
|
-
const h =
|
|
4329
|
-
return h.ssml = d,
|
|
4342
|
+
const h = B(r, a);
|
|
4343
|
+
return h.ssml = d, Ge(h, r, s, a, i, t), [h];
|
|
4330
4344
|
}
|
|
4331
4345
|
return dt(d, a.contextualizationLanguage).map((h) => {
|
|
4332
|
-
if (h.language !== l) return
|
|
4346
|
+
if (h.language !== l) return B(h.plain, a);
|
|
4333
4347
|
const f = ot(h.plain, s, a);
|
|
4334
4348
|
return (i === "figure" || i === "table") && ge(f, h.plain, o, s, a), f;
|
|
4335
4349
|
});
|
|
4336
4350
|
}
|
|
4337
|
-
function
|
|
4351
|
+
function ln(n, e, t, s) {
|
|
4338
4352
|
const i = `${e}.parts.${t}`;
|
|
4339
4353
|
return n.i18n.exists(i, { count: s }) ? n.i18n.t(i, { count: s }) : String(s);
|
|
4340
4354
|
}
|
|
4341
|
-
function
|
|
4342
|
-
const e =
|
|
4355
|
+
function er(n) {
|
|
4356
|
+
const e = De(n);
|
|
4343
4357
|
return e === void 0 ? { variantKey: "unlabelled" } : { variantKey: "labelled", params: { description: e } };
|
|
4344
4358
|
}
|
|
4345
|
-
function
|
|
4359
|
+
function cn(n, e) {
|
|
4346
4360
|
const t = e.tableCellHeaders.get(n);
|
|
4347
4361
|
return {
|
|
4348
4362
|
variantKey: t !== void 0 ? "withHeader" : "withoutHeader",
|
|
4349
|
-
params: { header: t ?? "", value:
|
|
4363
|
+
params: { header: t ?? "", value: At(n) }
|
|
4350
4364
|
};
|
|
4351
4365
|
}
|
|
4352
|
-
const
|
|
4366
|
+
const tr = {
|
|
4353
4367
|
table: (n, e) => {
|
|
4354
|
-
const t = (n.children ?? []).filter((i) => i.role?.has("row")), s =
|
|
4368
|
+
const t = (n.children ?? []).filter((i) => i.role?.has("row")), s = Ya(t);
|
|
4355
4369
|
for (const [i, a] of s.rowNumbers) e.tableRowNumbers.set(i, a);
|
|
4356
4370
|
for (const [i, a] of s.cellHeaders) e.tableCellHeaders.set(i, a);
|
|
4357
4371
|
return {
|
|
4358
4372
|
params: {
|
|
4359
|
-
lines:
|
|
4360
|
-
columns:
|
|
4373
|
+
lines: ln(e, "table", "lines", s.lines),
|
|
4374
|
+
columns: ln(e, "table", "columns", s.columns)
|
|
4361
4375
|
}
|
|
4362
4376
|
};
|
|
4363
4377
|
},
|
|
4364
4378
|
row: (n, e) => ({ params: { count: String(e.tableRowNumbers.get(n) ?? "") } }),
|
|
4365
|
-
cell:
|
|
4366
|
-
rowheader:
|
|
4379
|
+
cell: cn,
|
|
4380
|
+
rowheader: cn
|
|
4367
4381
|
};
|
|
4368
|
-
function
|
|
4369
|
-
const s =
|
|
4382
|
+
function un(n, e, t) {
|
|
4383
|
+
const s = er(e);
|
|
4370
4384
|
let i = s.variantKey, a = s.params;
|
|
4371
|
-
const r =
|
|
4385
|
+
const r = tr[n]?.(e, t);
|
|
4372
4386
|
r && (r.variantKey && (i = r.variantKey), a = { ...a, ...r.params });
|
|
4373
4387
|
const o = t.contextualizationParams?.(n, e);
|
|
4374
4388
|
return o && (a = { ...a, ...o }), { variantKey: i, params: a };
|
|
4375
4389
|
}
|
|
4376
|
-
const
|
|
4390
|
+
const hn = "[\\u0391-\\u03A9\\u03B1-\\u03C9\\u03D8-\\u03E1]", nr = "[\\u0374\\u02B9\\u0384']", He = "[\\u05D0-\\u05EA]", dn = "[\\u0400-\\u0481\\u048A-\\u04FF]", sr = [
|
|
4377
4391
|
new RegExp("^\\p{Nd}+$", "u"),
|
|
4378
4392
|
new RegExp("^\\p{Nl}+$", "u"),
|
|
4379
4393
|
/^(?=[MDCLXVI])M{0,4}(CM|CD|D?C{0,3})(XC|XL|L?X{0,3})(IX|IV|V?I{0,3})$/i,
|
|
4380
4394
|
/^[〇零一二三四五六七八九十百千万]+$/u,
|
|
4381
4395
|
/^[፩-፼]+$/u,
|
|
4382
|
-
new RegExp(`^${
|
|
4383
|
-
new RegExp(`^${
|
|
4384
|
-
new RegExp(`^(?:\\u0375${
|
|
4396
|
+
new RegExp(`^${He}[\\u05F3']$`, "u"),
|
|
4397
|
+
new RegExp(`^${He}+[\\u05F4"]${He}$`, "u"),
|
|
4398
|
+
new RegExp(`^(?:\\u0375${hn})*${hn}+${nr}$`, "u"),
|
|
4385
4399
|
/^(?:[Ա-Ֆա-և]̅)+$/u,
|
|
4386
|
-
new RegExp(`^\\u0482?${
|
|
4400
|
+
new RegExp(`^\\u0482?${dn}+\\u0483${dn}*$`, "u")
|
|
4387
4401
|
];
|
|
4388
|
-
function
|
|
4402
|
+
function ir(n) {
|
|
4389
4403
|
const e = n.trim();
|
|
4390
|
-
return e.length > 0 &&
|
|
4404
|
+
return e.length > 0 && sr.some((t) => t.test(e));
|
|
4391
4405
|
}
|
|
4392
|
-
function
|
|
4393
|
-
return e.skip.size > 0 && n.some((t) => e.skip.has(t) && !
|
|
4406
|
+
function gn(n, e) {
|
|
4407
|
+
return e.skip.size > 0 && n.some((t) => e.skip.has(t) && !kt.has(t) && !ps(t, n, e));
|
|
4394
4408
|
}
|
|
4395
|
-
function
|
|
4396
|
-
const t = n.find((s) =>
|
|
4409
|
+
function Ot(n, e) {
|
|
4410
|
+
const t = n.find((s) => kt.has(s));
|
|
4397
4411
|
return t === void 0 ? void 0 : e.interruptions[t] ?? "after";
|
|
4398
4412
|
}
|
|
4399
|
-
function
|
|
4400
|
-
const t =
|
|
4413
|
+
function ar(n, e) {
|
|
4414
|
+
const t = Me(n.text);
|
|
4401
4415
|
if (!t) return [];
|
|
4402
4416
|
const s = t.plain ?? U(t.ssml ?? "");
|
|
4403
|
-
if (
|
|
4417
|
+
if (ir(s)) {
|
|
4404
4418
|
const i = G(e, "pagebreak.number", void 0, { number: s.trim() });
|
|
4405
|
-
if (i !== void 0) return [
|
|
4419
|
+
if (i !== void 0) return [B(i, e)];
|
|
4406
4420
|
}
|
|
4407
|
-
return
|
|
4421
|
+
return Rt(t, e.format, e.language, e);
|
|
4408
4422
|
}
|
|
4409
|
-
function
|
|
4423
|
+
function fn(n) {
|
|
4410
4424
|
n.plain !== void 0 && (n.plain += "."), n.ssml !== void 0 && (n.ssml += ".");
|
|
4411
4425
|
}
|
|
4412
|
-
function
|
|
4413
|
-
const t =
|
|
4426
|
+
function rr(n, e) {
|
|
4427
|
+
const t = ar(n, e);
|
|
4414
4428
|
if (!e.contextualize.has("pagebreak")) return t;
|
|
4415
4429
|
const s = e.i18n.exists("pagebreak.block.start") ? "pagebreak.block.start" : "pagebreak.inline", i = G(e, s);
|
|
4416
4430
|
if (i === void 0) return t;
|
|
4417
|
-
const a =
|
|
4431
|
+
const a = B(i, e);
|
|
4418
4432
|
if (t.length === 0) return [a];
|
|
4419
|
-
const r =
|
|
4420
|
-
return r ? (
|
|
4433
|
+
const r = je([a, ...t], [void 0, ...t.map(() => n)], e);
|
|
4434
|
+
return r ? (fn(r), [r]) : (fn(t[t.length - 1]), [a, ...t]);
|
|
4421
4435
|
}
|
|
4422
|
-
function
|
|
4423
|
-
const t =
|
|
4424
|
-
return t ?
|
|
4436
|
+
function or(n, e) {
|
|
4437
|
+
const t = Me(Oe(n));
|
|
4438
|
+
return t ? Rt(t, e.format, e.language, e) : [];
|
|
4425
4439
|
}
|
|
4426
|
-
const
|
|
4427
|
-
function
|
|
4428
|
-
return
|
|
4440
|
+
const Ke = "", be = "";
|
|
4441
|
+
function Vt(n) {
|
|
4442
|
+
return x(n).includes("term") || (n.children ?? []).some(Vt);
|
|
4429
4443
|
}
|
|
4430
4444
|
const lt = /* @__PURE__ */ new Set();
|
|
4431
|
-
function
|
|
4432
|
-
return
|
|
4445
|
+
function ms(n) {
|
|
4446
|
+
return Vt(n) ? [n, ...(n.children ?? []).flatMap(ms)] : [];
|
|
4433
4447
|
}
|
|
4434
|
-
function
|
|
4448
|
+
function vs(n, e, t, s, i, a, r) {
|
|
4435
4449
|
if (e.length === 0) return;
|
|
4436
|
-
const o =
|
|
4450
|
+
const o = x(n).find((m) => le.has(m)), l = e.length > 1 ? e.find(Vt) : void 0, c = e.filter((m) => m !== l), u = o && i.contextualize.has(o) ? G(i, `${o}.inline`) : void 0, d = o && r && l ? G(i, `${o}.term`, void 0, { term: Ke, value: be }) : void 0, h = r ? e : c;
|
|
4437
4451
|
if (u === void 0 && !d) {
|
|
4438
4452
|
_(h, t, s, i, a);
|
|
4439
4453
|
return;
|
|
4440
4454
|
}
|
|
4441
|
-
const f =
|
|
4442
|
-
u !== void 0 && (p.push(
|
|
4443
|
-
const v = a || f, S = [...h, ...l ?
|
|
4455
|
+
const f = x(h[0]).some((m) => Le.has(m)) && !a, p = [], g = [];
|
|
4456
|
+
u !== void 0 && (p.push(B(u, i)), g.push(n));
|
|
4457
|
+
const v = a || f, S = [...h, ...l ? ms(l) : []];
|
|
4444
4458
|
S.forEach((m) => lt.add(m));
|
|
4445
|
-
for (const m of (d ?? be).split(new RegExp(`(${
|
|
4446
|
-
m ===
|
|
4459
|
+
for (const m of (d ?? be).split(new RegExp(`(${Ke}|${be})`)))
|
|
4460
|
+
m === Ke ? _([l], p, g, i, v) : m === be ? _(c, p, g, i, v) : m && (p.push(B(m, i)), g.push(n));
|
|
4447
4461
|
S.forEach((m) => lt.delete(m)), f && p.length > 0 && i.blockStarts.add(p[0]);
|
|
4448
|
-
for (const [m, C] of
|
|
4449
|
-
const y = p.slice(m, C), b = g.slice(m, C), k = y.length > 1 ?
|
|
4450
|
-
|
|
4462
|
+
for (const [m, C] of Et(p, i)) {
|
|
4463
|
+
const y = p.slice(m, C), b = g.slice(m, C), k = y.length > 1 ? je(y, b, i) : void 0;
|
|
4464
|
+
Te(t, s, i, n, y, b, k);
|
|
4451
4465
|
}
|
|
4452
4466
|
}
|
|
4453
|
-
function
|
|
4467
|
+
function ys(n, e, t, s, i) {
|
|
4454
4468
|
n.forEach((a, r) => {
|
|
4455
4469
|
const o = r === 0 ? i : !1;
|
|
4456
|
-
"ref" in a ?
|
|
4470
|
+
"ref" in a ? vs(a.ref, a.targets, e, t, s, o, !0) : Tt(a.node, e, t, s, o);
|
|
4457
4471
|
});
|
|
4458
4472
|
}
|
|
4459
|
-
function
|
|
4460
|
-
const t =
|
|
4473
|
+
function Ss(n, e) {
|
|
4474
|
+
const t = Ot(x(n), e);
|
|
4461
4475
|
return t !== void 0 && t !== "inline";
|
|
4462
4476
|
}
|
|
4463
|
-
function
|
|
4477
|
+
function lr(n, e, t, s) {
|
|
4464
4478
|
const i = O(t, s.ancestorChains);
|
|
4465
4479
|
if (!i) return;
|
|
4466
|
-
const a =
|
|
4480
|
+
const a = st(Y(i.ref, U(e)));
|
|
4467
4481
|
s.aliasLocates.add(a);
|
|
4468
4482
|
for (const r of n) {
|
|
4469
4483
|
const o = s.format === "ssml" ? U(r.ssml ?? "") : r.plain;
|
|
4470
4484
|
r.locate = a, r.offsets = [{ start: 0, end: o?.length ?? 0, locate: a }], s.edgeSubstitutedLocate.set(r, { leading: a, trailing: a });
|
|
4471
4485
|
}
|
|
4472
4486
|
}
|
|
4473
|
-
function
|
|
4487
|
+
function cr(n, e, t, s, i, a, r) {
|
|
4474
4488
|
const o = n.text?.language, l = $(o, i), c = new Map((n.children ?? []).map((y) => [y.id, y])), u = [], d = [], h = [], f = /* @__PURE__ */ new Set(), p = /* @__PURE__ */ new Set(), g = /* @__PURE__ */ new Set(), v = i.segmentation === "sentence", S = i.interruptions.abbreviation === "never", m = i.interruptions.abbreviation === "inline", C = (y, b) => {
|
|
4475
4489
|
if (y.abbreviation !== "alias") return;
|
|
4476
4490
|
const k = u.slice(b);
|
|
4477
|
-
|
|
4491
|
+
lr(k, y.abbreviationText, n, i), k.forEach((w) => g.add(w));
|
|
4478
4492
|
};
|
|
4479
|
-
for (let y of
|
|
4493
|
+
for (let y of Mi(e)) {
|
|
4480
4494
|
if (y.abbreviation && (y.abbreviation === "text" ? m : S)) continue;
|
|
4481
4495
|
if (y.abbreviation === "alias" && !m && (y = { ...y, ssml: y.parenthesizedSsml }), y.placeholderId !== void 0) {
|
|
4482
4496
|
const w = c.get(y.placeholderId);
|
|
4483
4497
|
if (!w) continue;
|
|
4484
|
-
if (
|
|
4485
|
-
const E =
|
|
4498
|
+
if (Ss(w, i)) {
|
|
4499
|
+
const E = x(w), I = E.some((L) => le.has(L));
|
|
4486
4500
|
if (I)
|
|
4487
|
-
for (const L of
|
|
4501
|
+
for (const L of or(w, i))
|
|
4488
4502
|
u.push(L), d.push(w);
|
|
4489
|
-
const A = I ?
|
|
4503
|
+
const A = I ? Ot(E, i) === "never" || !w.children?.length ? [] : [{ ref: w, targets: w.children }] : [{ node: w }];
|
|
4490
4504
|
for (const L of A)
|
|
4491
4505
|
if (h.push(L), v) {
|
|
4492
4506
|
const K = u.length;
|
|
4493
|
-
|
|
4507
|
+
ys([L], u, d, i, h.length === 1 && (a || r)), u.slice(K).forEach((N) => p.add(N));
|
|
4494
4508
|
}
|
|
4495
4509
|
} else {
|
|
4496
4510
|
const E = u.length;
|
|
4497
|
-
|
|
4511
|
+
Tt(w, u, d, i, a), x(w).some((I) => kt.has(I)) && u.slice(E).forEach((I) => f.add(I));
|
|
4498
4512
|
}
|
|
4499
4513
|
continue;
|
|
4500
4514
|
}
|
|
4501
4515
|
if (!y.ssml) continue;
|
|
4502
4516
|
const b = u.length;
|
|
4503
|
-
if (i.format === "plain" && i.language !== "block-level" && i.language !== "none" &&
|
|
4517
|
+
if (i.format === "plain" && i.language !== "block-level" && i.language !== "none" && xn(y.ssml)) {
|
|
4504
4518
|
for (const w of dt(y.ssml, o)) {
|
|
4505
4519
|
const E = { plain: w.plain }, I = $(w.language, i);
|
|
4506
4520
|
I && (E.language = I), u.push(E), d.push(n);
|
|
@@ -4509,69 +4523,69 @@ function rr(n, e, t, s, i, a, r) {
|
|
|
4509
4523
|
continue;
|
|
4510
4524
|
}
|
|
4511
4525
|
const k = {};
|
|
4512
|
-
l && (k.language = l), i.format === "ssml" ? k.ssml =
|
|
4526
|
+
l && (k.language = l), i.format === "ssml" ? k.ssml = us(y.ssml, i.languageOverrides) : k.plain = U(y.ssml), (i.language === "block-level" || i.language === "none") && k.ssml && (k.ssml = ss(k.ssml)), u.push(k), d.push(n), C(y, b);
|
|
4513
4527
|
}
|
|
4514
4528
|
if (v && h.length + f.size + g.size > 0)
|
|
4515
4529
|
return u.forEach((y) => {
|
|
4516
4530
|
const b = f.has(y) ? "inline" : p.has(y) ? "after" : g.has(y) ? "alias" : void 0;
|
|
4517
4531
|
i.placeholderPieces.set(y, { node: n, placement: b });
|
|
4518
|
-
}),
|
|
4519
|
-
for (const [y, b] of
|
|
4520
|
-
const k = u.slice(y, b), w = d.slice(y, b), E = k.length > 1 ?
|
|
4521
|
-
|
|
4532
|
+
}), Te(t, s, i, n, u, d, void 0), [];
|
|
4533
|
+
for (const [y, b] of Et(u, i)) {
|
|
4534
|
+
const k = u.slice(y, b), w = d.slice(y, b), E = k.length > 1 ? je(k, w, i) : void 0;
|
|
4535
|
+
Te(t, s, i, n, k, w, E);
|
|
4522
4536
|
}
|
|
4523
4537
|
return h;
|
|
4524
4538
|
}
|
|
4525
|
-
function
|
|
4526
|
-
const a =
|
|
4527
|
-
if (
|
|
4528
|
-
const c = a.some((g) =>
|
|
4529
|
-
(g) => g !== "footnote" && g !== "pagebreak" && !le.has(g) && !
|
|
4530
|
-
), f = a.some((g) =>
|
|
4539
|
+
function Tt(n, e, t, s, i) {
|
|
4540
|
+
const a = x(n), r = De(n), o = Ot(a, s) === "never", l = o && a.some((g) => le.has(g));
|
|
4541
|
+
if (gn(a, s) || o && !l) return;
|
|
4542
|
+
const c = a.some((g) => Le.has(g)), u = c && !i, d = e.length, h = lt.has(n) ? [] : a.filter(
|
|
4543
|
+
(g) => g !== "footnote" && g !== "pagebreak" && !le.has(g) && !ps(g, a, s)
|
|
4544
|
+
), f = a.some((g) => Ga.has(g) && s.contextualize.has(g)), p = a.includes("table") && r !== void 0 && !f;
|
|
4531
4545
|
if (p) {
|
|
4532
4546
|
const g = ot(r, n, s);
|
|
4533
4547
|
ge(g, r, r, n, s), W(e, t, n, [g]);
|
|
4534
4548
|
}
|
|
4535
4549
|
for (const g of h) {
|
|
4536
4550
|
if (g === "figure" && r === void 0) continue;
|
|
4537
|
-
const { variantKey: v, params: S } =
|
|
4538
|
-
|
|
4551
|
+
const { variantKey: v, params: S } = un(g, n, s);
|
|
4552
|
+
an(e, t, n, s, g, "before", v, S);
|
|
4539
4553
|
}
|
|
4540
4554
|
if (a.includes("noteref"))
|
|
4541
4555
|
for (const g of n.children ?? []) {
|
|
4542
|
-
const v =
|
|
4543
|
-
if (!
|
|
4556
|
+
const v = x(g);
|
|
4557
|
+
if (!gn(v, s))
|
|
4544
4558
|
if (v.includes("footnote")) {
|
|
4545
|
-
const S = s.contextualize.has("footnote"), m = s.i18n.exists("footnote.block.start") || s.i18n.exists("footnote.block.end"), C = v.some((L) =>
|
|
4546
|
-
y !== void 0 && (k.push(
|
|
4559
|
+
const S = s.contextualize.has("footnote"), m = s.i18n.exists("footnote.block.start") || s.i18n.exists("footnote.block.end"), C = v.some((L) => Le.has(L)) && !i && s.interruptions.noteref !== "inline", y = S ? G(s, m ? "footnote.block.start" : "footnote.inline") : void 0, b = S && (y !== void 0 || m), k = [], w = [];
|
|
4560
|
+
y !== void 0 && (k.push(B(y, s)), w.push(g));
|
|
4547
4561
|
const E = [], I = [];
|
|
4548
4562
|
if (_([g], E, I, s, i || C), C && E.length > 0 && s.blockStarts.add(E[0]), k.push(...E), w.push(...I), b && m) {
|
|
4549
4563
|
const L = G(s, "footnote.block.end");
|
|
4550
|
-
L !== void 0 && (k.push(
|
|
4564
|
+
L !== void 0 && (k.push(B(L, s)), w.push(g));
|
|
4551
4565
|
}
|
|
4552
|
-
const A = b && k.length > 1 ?
|
|
4553
|
-
|
|
4566
|
+
const A = b && k.length > 1 ? je(k, w, s) : void 0;
|
|
4567
|
+
Te(e, t, s, g, k, w, A);
|
|
4554
4568
|
} else
|
|
4555
4569
|
_([g], e, t, s, i);
|
|
4556
4570
|
}
|
|
4557
|
-
else if (!a.some((g) =>
|
|
4558
|
-
const g =
|
|
4559
|
-
if (g &&
|
|
4560
|
-
const S =
|
|
4571
|
+
else if (!a.some((g) => Ha.has(g))) {
|
|
4572
|
+
const g = Oe(n)?.ssml, v = a.some((S) => Yn.has(S) && Lt(S, s));
|
|
4573
|
+
if (g && zi(g) && !v) {
|
|
4574
|
+
const S = cr(n, g, e, t, s, i, c);
|
|
4561
4575
|
if (S.length > 0) {
|
|
4562
4576
|
const m = i || c && e.length > d;
|
|
4563
|
-
|
|
4577
|
+
ys(S, e, t, s, m);
|
|
4564
4578
|
}
|
|
4565
4579
|
} else if (a.includes("pagebreak")) {
|
|
4566
|
-
if (W(e, t, n,
|
|
4580
|
+
if (W(e, t, n, rr(n, s)), n.children) {
|
|
4567
4581
|
const S = i || c && e.length > d;
|
|
4568
4582
|
_(n.children, e, t, s, S);
|
|
4569
4583
|
}
|
|
4570
4584
|
} else {
|
|
4571
|
-
const S = v ? void 0 :
|
|
4572
|
-
if (S && W(e, t, n,
|
|
4585
|
+
const S = v ? void 0 : Me(Oe(n));
|
|
4586
|
+
if (S && W(e, t, n, Rt(S, s.format, s.language, s)), n.children && !l) {
|
|
4573
4587
|
const m = i || c && e.length > d;
|
|
4574
|
-
a.some((C) => le.has(C)) ?
|
|
4588
|
+
a.some((C) => le.has(C)) ? vs(n, n.children, e, t, s, m, Ss(n, s)) : _(n.children, e, t, s, m);
|
|
4575
4589
|
}
|
|
4576
4590
|
}
|
|
4577
4591
|
}
|
|
@@ -4581,16 +4595,16 @@ function Vt(n, e, t, s, i) {
|
|
|
4581
4595
|
}
|
|
4582
4596
|
for (const g of h) {
|
|
4583
4597
|
if (g === "figure" && r === void 0) continue;
|
|
4584
|
-
const { variantKey: v, params: S } =
|
|
4585
|
-
|
|
4598
|
+
const { variantKey: v, params: S } = un(g, n, s);
|
|
4599
|
+
an(e, t, n, s, g, "after", v, S);
|
|
4586
4600
|
}
|
|
4587
4601
|
}
|
|
4588
4602
|
function _(n, e, t, s, i) {
|
|
4589
|
-
n.forEach((a, r) =>
|
|
4603
|
+
n.forEach((a, r) => Tt(a, e, t, s, r === 0 ? i : !1));
|
|
4590
4604
|
}
|
|
4591
|
-
const
|
|
4592
|
-
async function
|
|
4593
|
-
const i =
|
|
4605
|
+
const ur = Tn;
|
|
4606
|
+
async function bs(n, e, t, s) {
|
|
4607
|
+
const i = ur(n);
|
|
4594
4608
|
let a = "";
|
|
4595
4609
|
const r = [];
|
|
4596
4610
|
for (const h of i)
|
|
@@ -4607,7 +4621,7 @@ async function ys(n, e, t, s) {
|
|
|
4607
4621
|
const S = o[u], m = Math.min(v, S.end), C = m >= S.end && u < o.length - 1;
|
|
4608
4622
|
let y = h.slice(g - f, m - f);
|
|
4609
4623
|
C && (y = y.replace(/[ \t\r\n]+$/, ""));
|
|
4610
|
-
const b =
|
|
4624
|
+
const b = M(y);
|
|
4611
4625
|
c += p ? p(b) : b, g = m, C && (l.push(c), c = "", u++);
|
|
4612
4626
|
}
|
|
4613
4627
|
}
|
|
@@ -4622,21 +4636,21 @@ async function ys(n, e, t, s) {
|
|
|
4622
4636
|
}
|
|
4623
4637
|
}), c && l.push(c.replace(/[ \t\r\n]+$/, "")), l;
|
|
4624
4638
|
}
|
|
4625
|
-
function
|
|
4626
|
-
const t = e.segmenter ===
|
|
4627
|
-
return
|
|
4639
|
+
function Ut(n, e) {
|
|
4640
|
+
const t = e.segmenter === Xn ? Ma(n) : n;
|
|
4641
|
+
return kn(e.segmentationSuppressions, t);
|
|
4628
4642
|
}
|
|
4629
|
-
async function
|
|
4630
|
-
const t = n.language ?? "en", s =
|
|
4643
|
+
async function hr(n, e) {
|
|
4644
|
+
const t = n.language ?? "en", s = Ut(t, e), i = e.format === "ssml" ? n.ssml : n.plain;
|
|
4631
4645
|
if (!i) return;
|
|
4632
4646
|
const a = await e.segmenter(t, pe(i, e.format), s);
|
|
4633
4647
|
if (a.length <= 1) return;
|
|
4634
4648
|
if (e.format !== "ssml") return a.map((o) => ({ text: o.text, start: o.start, end: o.contentEnd }));
|
|
4635
|
-
const r = await
|
|
4649
|
+
const r = await bs(i, t, e.segmenter, s);
|
|
4636
4650
|
if (r)
|
|
4637
4651
|
return a.map((o, l) => ({ text: r[l], start: o.start, end: o.contentEnd }));
|
|
4638
4652
|
}
|
|
4639
|
-
const
|
|
4653
|
+
const pn = /* @__PURE__ */ new Set([
|
|
4640
4654
|
"cell",
|
|
4641
4655
|
"rowheader",
|
|
4642
4656
|
"columnheader",
|
|
@@ -4651,30 +4665,37 @@ const fn = /* @__PURE__ */ new Set([
|
|
|
4651
4665
|
"heading5",
|
|
4652
4666
|
"heading6"
|
|
4653
4667
|
]);
|
|
4654
|
-
function
|
|
4655
|
-
return n ?
|
|
4668
|
+
function mn(n) {
|
|
4669
|
+
return n ? x(Array.isArray(n) ? n[1] : n) : [];
|
|
4670
|
+
}
|
|
4671
|
+
function ws(n, e) {
|
|
4672
|
+
return Array.isArray(n) ? n[e === "leading" ? 0 : 1] : n;
|
|
4673
|
+
}
|
|
4674
|
+
function vn(n, e, t) {
|
|
4675
|
+
const s = ws(n, e);
|
|
4676
|
+
return (t.ancestorChains.get(s) ?? []).filter((i) => x(i).some((a) => a !== "presentation"));
|
|
4656
4677
|
}
|
|
4657
|
-
function
|
|
4658
|
-
const s =
|
|
4659
|
-
return
|
|
4678
|
+
function yn(n, e, t) {
|
|
4679
|
+
const s = ws(n, e);
|
|
4680
|
+
return [s, ...t.ancestorChains.get(s) ?? []].find((i) => x(i).some((a) => Le.has(a)));
|
|
4660
4681
|
}
|
|
4661
|
-
function
|
|
4682
|
+
function dr(n, e) {
|
|
4662
4683
|
return n.length === e.length && n.every((t, s) => t === e[s]);
|
|
4663
4684
|
}
|
|
4664
|
-
function
|
|
4685
|
+
function Sn(n, e, t, s) {
|
|
4665
4686
|
const i = s.edgeSubstitutedLocate.get(e)?.[t];
|
|
4666
4687
|
return i && !s.aliasLocates.has(i) ? !0 : !!n && !Array.isArray(n) && H(n);
|
|
4667
4688
|
}
|
|
4668
4689
|
function te(n, e) {
|
|
4669
4690
|
return e.placeholderPieces.get(n)?.placement === "inline";
|
|
4670
4691
|
}
|
|
4671
|
-
function
|
|
4692
|
+
function ks(n, e) {
|
|
4672
4693
|
return e.placeholderPieces.get(n)?.placement === "alias";
|
|
4673
4694
|
}
|
|
4674
|
-
function
|
|
4695
|
+
function gr(n, e) {
|
|
4675
4696
|
return e.placeholderPieces.get(n)?.placement === "after";
|
|
4676
4697
|
}
|
|
4677
|
-
function
|
|
4698
|
+
function Cs(n, e, t, s) {
|
|
4678
4699
|
for (const { piece: i, source: a } of n.get(e) ?? [])
|
|
4679
4700
|
t.push(i), s.push(a);
|
|
4680
4701
|
n.delete(e);
|
|
@@ -4683,12 +4704,12 @@ function ct(n, e, t) {
|
|
|
4683
4704
|
const s = t.placeholderPieces.get(n)?.node;
|
|
4684
4705
|
return s !== void 0 && s === t.placeholderPieces.get(e)?.node;
|
|
4685
4706
|
}
|
|
4686
|
-
function
|
|
4707
|
+
function fr(n, e, t, s, i) {
|
|
4687
4708
|
const a = i.format === "ssml" ? n.ssml : n.plain, r = i.format === "ssml" ? t.ssml : t.plain;
|
|
4688
|
-
return !a || !r ? !1 : ct(n, t, i) ? !0 : !(!
|
|
4709
|
+
return !a || !r ? !1 : ct(n, t, i) ? !0 : !(!Ct(n.language ?? "en", t.language ?? "en") || i.synthetic.has(n) || i.synthetic.has(t) || !e || !s || !i.segmentationReconstruct && yn(e, "trailing", i) !== yn(s, "leading", i) || mn(e).some((o) => pn.has(o)) || mn(s).some((o) => pn.has(o)) || !dr(vn(e, "trailing", i), vn(s, "leading", i)) || Sn(e, n, "trailing", i) || Sn(s, t, "leading", i));
|
|
4689
4710
|
}
|
|
4690
|
-
async function
|
|
4691
|
-
const a = t.synthetic.has(n) ? void 0 : await
|
|
4711
|
+
async function bn(n, e, t, s, i) {
|
|
4712
|
+
const a = t.synthetic.has(n) ? void 0 : await hr(n, t);
|
|
4692
4713
|
if (!a) {
|
|
4693
4714
|
s.push(n), i.push(e);
|
|
4694
4715
|
return;
|
|
@@ -4712,15 +4733,15 @@ function q(n, e) {
|
|
|
4712
4733
|
for (; t < n.length - 1 && n[t + 1].start <= e; ) t++;
|
|
4713
4734
|
return t;
|
|
4714
4735
|
}
|
|
4715
|
-
async function
|
|
4716
|
-
const i = n.map((c) => pe(e.format === "ssml" ? c.ssml : c.plain, e.format)), { joined: a, ranges: r } =
|
|
4736
|
+
async function pr(n, e, t, s) {
|
|
4737
|
+
const i = n.map((c) => pe(e.format === "ssml" ? c.ssml : c.plain, e.format)), { joined: a, ranges: r } = Ve(i), o = await e.segmenter(t, a, s), l = new Array(n.length - 1).fill(!1);
|
|
4717
4738
|
for (const c of o) {
|
|
4718
4739
|
const u = q(r, c.start), d = c.end > c.start ? q(r, c.end - 1) : u;
|
|
4719
4740
|
for (let h = u; h < d; h++) l[h] = !0;
|
|
4720
4741
|
}
|
|
4721
4742
|
return l;
|
|
4722
4743
|
}
|
|
4723
|
-
function
|
|
4744
|
+
function mr(n, e, t) {
|
|
4724
4745
|
const s = [...e];
|
|
4725
4746
|
return n.forEach((i, a) => {
|
|
4726
4747
|
if (!te(i, t)) return;
|
|
@@ -4728,8 +4749,8 @@ function gr(n, e, t) {
|
|
|
4728
4749
|
r && !s[a - 1] ? s[a - 1] = !0 : o && (s[a] = !0);
|
|
4729
4750
|
}), s;
|
|
4730
4751
|
}
|
|
4731
|
-
function
|
|
4732
|
-
const a = (c) => te(t[q(s, c)], i), r = (c, u) => q(s, c) === q(s, u) &&
|
|
4752
|
+
function vr(n, e, t, s, i) {
|
|
4753
|
+
const a = (c) => te(t[q(s, c)], i), r = (c, u) => q(s, c) === q(s, u) && ks(t[q(s, c)], i), o = [];
|
|
4733
4754
|
let l;
|
|
4734
4755
|
return e.forEach((c, u) => {
|
|
4735
4756
|
l ??= c;
|
|
@@ -4737,11 +4758,11 @@ function fr(n, e, t, s, i) {
|
|
|
4737
4758
|
d && (a(c.contentEnd - 1) || a(d.start) || r(c.contentEnd - 1, d.start)) || (o.push({ text: n.slice(l.start, c.contentEnd), start: l.start, end: c.end, contentEnd: c.contentEnd }), l = void 0);
|
|
4738
4759
|
}), o;
|
|
4739
4760
|
}
|
|
4740
|
-
function
|
|
4761
|
+
function yr(n, e, t, s, i, a, r) {
|
|
4741
4762
|
const o = [];
|
|
4742
4763
|
for (let l = i; l <= a; l++) {
|
|
4743
|
-
if (te(n[l], r) ||
|
|
4744
|
-
o.push(...
|
|
4764
|
+
if (te(n[l], r) || ks(n[l], r)) {
|
|
4765
|
+
o.push(...ds([n[l]], [e[l]], r));
|
|
4745
4766
|
continue;
|
|
4746
4767
|
}
|
|
4747
4768
|
const c = O(e[l], r.ancestorChains);
|
|
@@ -4753,31 +4774,31 @@ function pr(n, e, t, s, i, a, r) {
|
|
|
4753
4774
|
}
|
|
4754
4775
|
return o;
|
|
4755
4776
|
}
|
|
4756
|
-
function
|
|
4757
|
-
const t =
|
|
4777
|
+
function Es(n, e) {
|
|
4778
|
+
const t = Za(n, e);
|
|
4758
4779
|
return t !== null ? t ?? "en" : n.find((s) => !te(s, e))?.language ?? n[0].language ?? "en";
|
|
4759
4780
|
}
|
|
4760
|
-
function
|
|
4761
|
-
const a = q(t, n.start), r = n.end > n.start ? q(t, n.end - 1) : a, o =
|
|
4781
|
+
function Sr(n, e, t, s, i) {
|
|
4782
|
+
const a = q(t, n.start), r = n.end > n.start ? q(t, n.end - 1) : a, o = Et(e.slice(a, r + 1), i);
|
|
4762
4783
|
return o.map(([l, c], u) => {
|
|
4763
|
-
const d = a + l, h = a + c - 1, f = u === o.length - 1, p = u === 0 ? n.start : t[d].start, g = f ? n.contentEnd : t[h].end, v = f ? n.end : t[h + 1].start, S =
|
|
4784
|
+
const d = a + l, h = a + c - 1, f = u === o.length - 1, p = u === 0 ? n.start : t[d].start, g = f ? n.contentEnd : t[h].end, v = f ? n.end : t[h + 1].start, S = ls(e.slice(d, h + 1), i) ?? void 0, m = { text: s.slice(p, g), start: p, end: v, contentEnd: g }, C = o.length > 1 && d === h && te(e[d], i);
|
|
4764
4785
|
return { boundary: m, startIdx: d, endIdx: h, language: S, sentenceEnd: f ? n.end : void 0, isolated: C };
|
|
4765
4786
|
});
|
|
4766
4787
|
}
|
|
4767
|
-
async function
|
|
4768
|
-
const r =
|
|
4788
|
+
async function br(n, e, t, s, i, a) {
|
|
4789
|
+
const r = Es(n, t), o = Ut(r, t), l = n.map((m) => pe(t.format === "ssml" ? m.ssml : m.plain, t.format)), { joined: c, ranges: u } = Ve(l), d = vr(c, await t.segmenter(r, c, o), n, u, t), f = (d.length > 0 ? d : [{ text: c, start: 0, end: c.length, contentEnd: c.length }]).flatMap((m) => Sr(m, n, u, c, t));
|
|
4769
4790
|
let p, g;
|
|
4770
4791
|
if (t.format === "ssml") {
|
|
4771
4792
|
const m = /* @__PURE__ */ new Map();
|
|
4772
4793
|
for (const y of f) for (let b = y.startIdx; b <= y.endIdx; b++) m.set(b, y.language);
|
|
4773
|
-
g =
|
|
4794
|
+
g = Ve(n.map((y, b) => cs(y, m.get(b), t)), l).joined;
|
|
4774
4795
|
const C = f.map((y) => y.boundary);
|
|
4775
|
-
p = f.length > 1 ? await
|
|
4796
|
+
p = f.length > 1 ? await bs(g, r, async () => C, o) : void 0;
|
|
4776
4797
|
}
|
|
4777
4798
|
const v = new Set(n.filter((m) => t.blockStarts.has(m))), S = (m, C) => {
|
|
4778
4799
|
if (m !== void 0)
|
|
4779
4800
|
for (let y = 0; y < n.length; y++)
|
|
4780
|
-
(u[y].end <= m || C === f.length - 1) &&
|
|
4801
|
+
(u[y].end <= m || C === f.length - 1) && Cs(a, y, s, i);
|
|
4781
4802
|
};
|
|
4782
4803
|
f.forEach(({ boundary: m, startIdx: C, endIdx: y, language: b, sentenceEnd: k, isolated: w }, E) => {
|
|
4783
4804
|
if (w) {
|
|
@@ -4786,26 +4807,26 @@ async function vr(n, e, t, s, i, a) {
|
|
|
4786
4807
|
}
|
|
4787
4808
|
const I = t.format === "ssml" ? p ? p[E] : g : m.text, A = { [t.format]: I }, L = t.language === "none" ? $(void 0, t) : b ?? "en";
|
|
4788
4809
|
L && (A.language = L), n.slice(C, y + 1).filter((se) => v.delete(se)).length > 0 && t.blockStarts.add(A);
|
|
4789
|
-
const
|
|
4790
|
-
|
|
4791
|
-
const ne = [...Array(y - C + 1).keys()].map((se) => C + se).filter((se) => !te(n[se], t)), D = ne[0] ?? C, me = ne[ne.length - 1] ?? y,
|
|
4792
|
-
|
|
4810
|
+
const N = yr(n, e, u, m, C, y, t);
|
|
4811
|
+
N.length > 0 && (A.offsets = N);
|
|
4812
|
+
const ne = [...Array(y - C + 1).keys()].map((se) => C + se).filter((se) => !te(n[se], t)), D = ne[0] ?? C, me = ne[ne.length - 1] ?? y, xt = O(e[D], t.ancestorChains), Nt = e[D], zt = (H(Nt) ? X(Nt, t) : void 0) ?? It(xt, I), Mt = D !== me ? Pt(xt, O(e[me], t.ancestorChains), zt) : zt;
|
|
4813
|
+
Mt && (A.locate = Mt), s.push(A), i.push(D === me ? e[D] : [e[D], e[me]]), S(k, E);
|
|
4793
4814
|
});
|
|
4794
4815
|
}
|
|
4795
|
-
async function
|
|
4816
|
+
async function Rs(n, e, t) {
|
|
4796
4817
|
if (t.segmentation !== "sentence") return { out: n, sources: e };
|
|
4797
4818
|
const s = [], i = [];
|
|
4798
4819
|
let a = 0;
|
|
4799
4820
|
for (; a < n.length; ) {
|
|
4800
4821
|
let r = a;
|
|
4801
|
-
for (; r + 1 < n.length &&
|
|
4822
|
+
for (; r + 1 < n.length && fr(n[r], e[r], n[r + 1], e[r + 1], t); ) r++;
|
|
4802
4823
|
if (r === a) {
|
|
4803
|
-
await
|
|
4824
|
+
await bn(n[a], e[a], t, s, i), a = r + 1;
|
|
4804
4825
|
continue;
|
|
4805
4826
|
}
|
|
4806
4827
|
const o = [], l = [], c = /* @__PURE__ */ new Map();
|
|
4807
4828
|
for (let p = a; p <= r; p++)
|
|
4808
|
-
if (!
|
|
4829
|
+
if (!gr(n[p], t))
|
|
4809
4830
|
o.push(n[p]), l.push(e[p]);
|
|
4810
4831
|
else if (o.length === 0)
|
|
4811
4832
|
s.push(n[p]), i.push(e[p]);
|
|
@@ -4817,16 +4838,16 @@ async function ks(n, e, t) {
|
|
|
4817
4838
|
a = r + 1;
|
|
4818
4839
|
continue;
|
|
4819
4840
|
}
|
|
4820
|
-
const u =
|
|
4841
|
+
const u = Es(o, t), d = await pr(o, t, u, Ut(u, t)), h = mr(o, d, t);
|
|
4821
4842
|
let f = 0;
|
|
4822
4843
|
for (let p = 0; p < o.length; p++)
|
|
4823
4844
|
if (!(p < o.length - 1 && h[p])) {
|
|
4824
4845
|
if (f === p)
|
|
4825
|
-
await
|
|
4846
|
+
await bn(o[f], l[f], t, s, i), Cs(c, f, s, i);
|
|
4826
4847
|
else {
|
|
4827
4848
|
const g = /* @__PURE__ */ new Map();
|
|
4828
4849
|
for (let v = f; v <= p; v++) c.has(v) && g.set(v - f, c.get(v));
|
|
4829
|
-
await
|
|
4850
|
+
await br(o.slice(f, p + 1), l.slice(f, p + 1), t, s, i, g);
|
|
4830
4851
|
}
|
|
4831
4852
|
f = p + 1;
|
|
4832
4853
|
}
|
|
@@ -4834,40 +4855,40 @@ async function ks(n, e, t) {
|
|
|
4834
4855
|
}
|
|
4835
4856
|
return { out: s, sources: i };
|
|
4836
4857
|
}
|
|
4837
|
-
function
|
|
4858
|
+
function Is(n, e) {
|
|
4838
4859
|
return Object.keys(e.substitutions).length === 0 ? n : n.map((t) => {
|
|
4839
4860
|
if (t.ssml) {
|
|
4840
|
-
const { ssml: o, plain: l, map: c } =
|
|
4861
|
+
const { ssml: o, plain: l, map: c } = Ii(t.ssml, e.substitutions);
|
|
4841
4862
|
if (o === t.ssml) return t;
|
|
4842
4863
|
const u = { ...t, ssml: o };
|
|
4843
|
-
return
|
|
4864
|
+
return tn(u, { plain: l, map: c }), u;
|
|
4844
4865
|
}
|
|
4845
4866
|
const s = t.plain;
|
|
4846
4867
|
if (!s) return t;
|
|
4847
|
-
const { text: i, map: a } =
|
|
4868
|
+
const { text: i, map: a } = Ei(s, e.substitutions);
|
|
4848
4869
|
if (i === s) return t;
|
|
4849
4870
|
const r = { ...t, plain: i };
|
|
4850
|
-
return
|
|
4871
|
+
return tn(r, { plain: s, map: a }), r;
|
|
4851
4872
|
});
|
|
4852
4873
|
}
|
|
4853
|
-
async function
|
|
4854
|
-
const t = [], s = [], i = await
|
|
4874
|
+
async function Nr(n, e = {}) {
|
|
4875
|
+
const t = [], s = [], i = await ns(n, e);
|
|
4855
4876
|
_(n, t, s, i, !1);
|
|
4856
|
-
const a = await
|
|
4857
|
-
return
|
|
4877
|
+
const a = await Rs(t, s, i);
|
|
4878
|
+
return Is(gs(a.out, a.sources, i), i);
|
|
4858
4879
|
}
|
|
4859
|
-
async function
|
|
4860
|
-
const t = [], s = [], i = await
|
|
4880
|
+
async function wr(n, e = {}) {
|
|
4881
|
+
const t = [], s = [], i = await ns(n, e);
|
|
4861
4882
|
_(n, t, s, i, !1);
|
|
4862
|
-
const a = await
|
|
4863
|
-
return { utterances:
|
|
4883
|
+
const a = await Rs(t, s, i), r = a.out.map((l) => i.blockStarts.has(l)), o = gs(a.out, a.sources, i);
|
|
4884
|
+
return { utterances: Is(o, i), sources: a.sources, blockStarts: r };
|
|
4864
4885
|
}
|
|
4865
|
-
class
|
|
4886
|
+
class zr {
|
|
4866
4887
|
engine;
|
|
4867
4888
|
contentQueue = [];
|
|
4868
4889
|
// `contentQueue` as loaded, before `voice` stamped it — re-stamped when that changes.
|
|
4869
4890
|
loadedQueue = [];
|
|
4870
|
-
events = new
|
|
4891
|
+
events = new ze();
|
|
4871
4892
|
// Navigator owns the state, not the engine
|
|
4872
4893
|
navigatorState = "idle";
|
|
4873
4894
|
// Scheduled by the "end" handler's pauseDuration delay — cleared on
|
|
@@ -4903,7 +4924,7 @@ class xr {
|
|
|
4903
4924
|
// Index to speak() on the next play() when autoPause has stopped playback between utterances.
|
|
4904
4925
|
pendingAutoPauseIndex = null;
|
|
4905
4926
|
constructor(e, t = {}) {
|
|
4906
|
-
this.engine = e, this._defaults = new
|
|
4927
|
+
this.engine = e, this._defaults = new ua(t.defaults), this._preferences = new de(t.preferences), this._settings = new $e(this._preferences, this._defaults), this.contextualizationOverrides = t.contextualizationOverrides, this.segmentationOverrides = t.segmentationOverrides, this.setupEngineListeners(), this.applyEngineParameters(), this.initializeEngine();
|
|
4907
4928
|
}
|
|
4908
4929
|
// Unlike pauseDuration/autoPause (read live off settings), the engine owns rate/pitch/volume and must be pushed.
|
|
4909
4930
|
applyEngineParameters() {
|
|
@@ -4955,7 +4976,7 @@ class xr {
|
|
|
4955
4976
|
this.setNavigatorState("ready"), this.emitEvent({ type: "ready" });
|
|
4956
4977
|
}
|
|
4957
4978
|
}), this.engine.on("boundary", (e) => {
|
|
4958
|
-
const { charIndex: t, charLength: s } = e.detail ?? {}, i = this.loadedQueue[this.getCurrentUtteranceIndex()], a = i && typeof t == "number" && typeof s == "number" ?
|
|
4979
|
+
const { charIndex: t, charLength: s } = e.detail ?? {}, i = this.loadedQueue[this.getCurrentUtteranceIndex()], a = i && typeof t == "number" && typeof s == "number" ? ya(i, t, s) : void 0;
|
|
4959
4980
|
this.emitEvent(a ? { ...e, detail: { ...e.detail, ...a } } : e);
|
|
4960
4981
|
}), this.engine.on("mark", (e) => {
|
|
4961
4982
|
this.emitEvent(e);
|
|
@@ -5004,14 +5025,14 @@ class xr {
|
|
|
5004
5025
|
// Re-runs extraction from `this.source`, resuming near the old position if playback was underway.
|
|
5005
5026
|
async reextract() {
|
|
5006
5027
|
if (!this.source) return;
|
|
5007
|
-
const { index: e, state: t } = this.resumeTarget(), s = this.contentSources, { utterances: i, sources: a, blockStarts: r } = await
|
|
5028
|
+
const { index: e, state: t } = this.resumeTarget(), s = this.contentSources, { utterances: i, sources: a, blockStarts: r } = await wr(this.source, {
|
|
5008
5029
|
format: this._settings.format,
|
|
5009
5030
|
interruptions: this._settings.interruptions,
|
|
5010
5031
|
skip: this._settings.skip,
|
|
5011
5032
|
contextualize: this._settings.contextualize,
|
|
5012
5033
|
contextualization: {
|
|
5013
5034
|
contextualizations: this.contextualizationOverrides?.contextualizations,
|
|
5014
|
-
shapes:
|
|
5035
|
+
shapes: ma(this._settings.verbosity, this.contextualizationOverrides?.shapes),
|
|
5015
5036
|
params: this.contextualizationOverrides?.params
|
|
5016
5037
|
},
|
|
5017
5038
|
language: this._settings.language,
|
|
@@ -5019,6 +5040,7 @@ class xr {
|
|
|
5019
5040
|
languageOverrides: this._settings.languageOverrides,
|
|
5020
5041
|
segmentation: {
|
|
5021
5042
|
mode: this._settings.segmentation,
|
|
5043
|
+
reconstruct: this._settings.reconstruct,
|
|
5022
5044
|
suppressions: this.segmentationOverrides?.suppressions,
|
|
5023
5045
|
segmenter: this.segmentationOverrides?.segmenter
|
|
5024
5046
|
}
|
|
@@ -5131,7 +5153,7 @@ class xr {
|
|
|
5131
5153
|
// LocatorOptions there — and the same "resolve, then skip if there's nothing
|
|
5132
5154
|
// to show" shape, since there's no raw engine event to fall back to unenriched.
|
|
5133
5155
|
emitUtteranceBoundary(e) {
|
|
5134
|
-
const t = this._settings.segmentation, s =
|
|
5156
|
+
const t = this._settings.segmentation, s = Sa(e, t);
|
|
5135
5157
|
if (!s.length) return;
|
|
5136
5158
|
const i = t === "sentence" ? "sentence" : "structure";
|
|
5137
5159
|
this.emitEvent({
|
|
@@ -5145,27 +5167,31 @@ class xr {
|
|
|
5145
5167
|
// Preferences API (Configurable<SpeechSettings, SpeechPreferences>)
|
|
5146
5168
|
// With the engine's voice, which content without its own is spoken with; utterances are stamped from the preference alone.
|
|
5147
5169
|
get settings() {
|
|
5148
|
-
return new
|
|
5170
|
+
return new $e(this._preferences, this._defaults, this.engine.getCurrentVoice());
|
|
5149
5171
|
}
|
|
5150
5172
|
// Rebuilt, staged edits kept, once the engine's voice changes, e.g. when it picks its default after being read.
|
|
5151
5173
|
get preferencesEditor() {
|
|
5152
|
-
const e = this.engine.getCurrentVoice(), t = e ?
|
|
5153
|
-
return (this._preferencesEditor === null || t !== this.preferencesEditorEngineVoice) && (this._preferencesEditor = new
|
|
5174
|
+
const e = this.engine.getCurrentVoice(), t = e ? _n(e) : null;
|
|
5175
|
+
return (this._preferencesEditor === null || t !== this.preferencesEditorEngineVoice) && (this._preferencesEditor = new Yt(this._preferencesEditor?.preferences ?? this._preferences, this.settings), this.preferencesEditorEngineVoice = t), this._preferencesEditor;
|
|
5154
5176
|
}
|
|
5155
5177
|
async submitPreferences(e) {
|
|
5156
|
-
!this.source && this.contentQueue.length > 0 &&
|
|
5157
|
-
"submitPreferences(): extraction-affecting preferences (format, interruptions, verbosity, skip, contextualize, language, languageOverrides, segmentation) have no effect on content loaded via loadContent() — use loadGndContent() to re-extract on submission."
|
|
5178
|
+
!this.source && this.contentQueue.length > 0 && Zt.some((t) => e[t] !== void 0) && console.warn(
|
|
5179
|
+
"submitPreferences(): extraction-affecting preferences (format, interruptions, verbosity, skip, contextualize, language, languageOverrides, segmentation, reconstruct) have no effect on content loaded via loadContent() — use loadGndContent() to re-extract on submission."
|
|
5158
5180
|
), this._preferences = this._preferences.merging(e), await this.applyPreferences();
|
|
5159
5181
|
}
|
|
5160
5182
|
async applyPreferences() {
|
|
5161
5183
|
const e = this._settings;
|
|
5162
|
-
if (this._settings = new
|
|
5184
|
+
if (this._settings = new $e(this._preferences, this._defaults), this.applyEngineParameters(), this._preferencesEditor !== null && (this._preferencesEditor = new Yt(this._preferences, this.settings)), Zt.some((t) => !this.sameSettingValue(this.extractionValue(e, t), this.extractionValue(this._settings, t))))
|
|
5163
5185
|
await this.reextract();
|
|
5164
5186
|
else if (this.loadedQueue.length > 0 && !this.sameSettingValue(e.voice, this._settings.voice)) {
|
|
5165
5187
|
const { index: t, state: s } = this.resumeTarget();
|
|
5166
5188
|
this.setContentQueue(this.loadedQueue, t, s);
|
|
5167
5189
|
}
|
|
5168
5190
|
}
|
|
5191
|
+
// `reconstruct` only shapes extraction in sentence segmentation.
|
|
5192
|
+
extractionValue(e, t) {
|
|
5193
|
+
return t === "reconstruct" ? e.segmentation === "sentence" && e.reconstruct : e[t];
|
|
5194
|
+
}
|
|
5169
5195
|
// Arrays (skip/contextualize) compare as sets and records (languageOverrides) by entries, not by reference.
|
|
5170
5196
|
sameSettingValue(e, t) {
|
|
5171
5197
|
if (Array.isArray(e) && Array.isArray(t))
|
|
@@ -5181,80 +5207,80 @@ class xr {
|
|
|
5181
5207
|
}
|
|
5182
5208
|
}
|
|
5183
5209
|
export {
|
|
5184
|
-
|
|
5210
|
+
ha as BooleanPreference,
|
|
5185
5211
|
ae as EnumPreference,
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5212
|
+
Or as FallbackEngineProvider,
|
|
5213
|
+
ra as FallbackSpeechEngine,
|
|
5214
|
+
jr as Locator,
|
|
5215
|
+
Fr as LocatorLocations,
|
|
5216
|
+
_r as LocatorText,
|
|
5191
5217
|
Z as Preference,
|
|
5192
5218
|
ye as RangePreference,
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5219
|
+
ca as ReadiumSpeechDecorationController,
|
|
5220
|
+
zr as ReadiumSpeechNavigator,
|
|
5221
|
+
Tr as ReadiumSpeechProviderRegistry,
|
|
5222
|
+
ua as SpeechDefaults,
|
|
5197
5223
|
de as SpeechPreferences,
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
|
|
5201
|
-
|
|
5224
|
+
Yt as SpeechPreferencesEditor,
|
|
5225
|
+
jn as SpeechServerAudioDecodeError,
|
|
5226
|
+
na as SpeechServerEngine,
|
|
5227
|
+
Lr as SpeechServerEngineProvider,
|
|
5202
5228
|
ue as SpeechServerError,
|
|
5203
|
-
|
|
5204
|
-
|
|
5205
|
-
|
|
5206
|
-
|
|
5207
|
-
|
|
5208
|
-
|
|
5229
|
+
Fn as SpeechServerNetworkError,
|
|
5230
|
+
Dn as SpeechServerStallError,
|
|
5231
|
+
$e as SpeechSettings,
|
|
5232
|
+
Xt as StringArrayPreference,
|
|
5233
|
+
Qt as WebSpeechEngine,
|
|
5234
|
+
Ar as WebSpeechEngineProvider,
|
|
5209
5235
|
P as WebSpeechVoiceManager,
|
|
5210
5236
|
yt as autoPauseScopes,
|
|
5211
|
-
|
|
5237
|
+
Ba as blockLevelRoles,
|
|
5212
5238
|
ce as chineseVariantMap,
|
|
5213
|
-
|
|
5214
|
-
|
|
5215
|
-
|
|
5216
|
-
|
|
5217
|
-
|
|
5218
|
-
|
|
5239
|
+
Fi as chunkPlainText,
|
|
5240
|
+
$i as chunkSsmlText,
|
|
5241
|
+
En as compareAlphabetically,
|
|
5242
|
+
Cn as compareByPreferredRegion,
|
|
5243
|
+
pa as contextualizationShapesAtVerbosity,
|
|
5244
|
+
fa as contextualizedAtVerbosity,
|
|
5219
5245
|
ee as createJsonOrderMap,
|
|
5220
|
-
|
|
5221
|
-
|
|
5246
|
+
la as createLocator,
|
|
5247
|
+
Qn as defaultContextualizations,
|
|
5222
5248
|
R as extractLangRegionFromBCP47,
|
|
5223
|
-
|
|
5249
|
+
Nr as extractUtterances,
|
|
5224
5250
|
vt as extractionFormats,
|
|
5225
|
-
|
|
5251
|
+
Zt as extractionPreferenceKeys,
|
|
5226
5252
|
ht as filterByBoundarySupport,
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5253
|
+
Js as filterByLanguages,
|
|
5254
|
+
_t as filterOutNoveltyVoices,
|
|
5255
|
+
$t as filterOutVeryLowQualityVoices,
|
|
5256
|
+
Qe as getLanguageDisplayName,
|
|
5231
5257
|
ke as getQualityValue,
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5236
|
-
|
|
5237
|
-
|
|
5258
|
+
_n as getVoiceId,
|
|
5259
|
+
Ne as groupVoicesByLanguage,
|
|
5260
|
+
ja as interruptionRoles,
|
|
5261
|
+
Ze as isNoveltyVoice,
|
|
5262
|
+
sa as isRecoverableFailure,
|
|
5263
|
+
Xe as isVeryLowQualityVoice,
|
|
5238
5264
|
mt as languageModes,
|
|
5239
|
-
|
|
5240
|
-
|
|
5265
|
+
Bn as mapServerVoice,
|
|
5266
|
+
Gi as mimeTypeForFormat,
|
|
5241
5267
|
Re as pauseDurationRangeConfig,
|
|
5242
|
-
|
|
5268
|
+
In as pickBestVoiceByRegion,
|
|
5243
5269
|
Pe as pitchRangeConfig,
|
|
5244
5270
|
Ie as rateRangeConfig,
|
|
5245
|
-
|
|
5246
|
-
|
|
5271
|
+
ya as resolveBoundaryLocate,
|
|
5272
|
+
Sa as resolveUtteranceLocate,
|
|
5247
5273
|
St as segmentationModes,
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
|
|
5274
|
+
Zi as selectBitrate,
|
|
5275
|
+
Wi as selectFormat,
|
|
5276
|
+
Vr as setupDecorations,
|
|
5277
|
+
Ur as shapeableRoles,
|
|
5278
|
+
xr as skippableRoles,
|
|
5279
|
+
ga as skippedAtVerbosity,
|
|
5280
|
+
Je as sortAlphabetically,
|
|
5281
|
+
$s as sortByPreferredRegion,
|
|
5256
5282
|
Q as sortByQuality,
|
|
5257
|
-
|
|
5283
|
+
Rn as sortVoicesByRegions,
|
|
5258
5284
|
oe as toSpeechServerError,
|
|
5259
5285
|
ut as valueForLanguage,
|
|
5260
5286
|
pt as verbosityPresets,
|