@vocalstack/player 0.1.0-alpha.27 → 0.1.0-alpha.28
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/dist/index.js +440 -440
- package/dist/index.js.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104,16 +104,16 @@ function hr({ value: t, onChange: e, options: n, size: r, bordered: s = !0, fill
|
|
|
104
104
|
return Bt(() => {
|
|
105
105
|
const d = o.current;
|
|
106
106
|
if (!d) return;
|
|
107
|
-
const
|
|
108
|
-
|
|
107
|
+
const g = d.querySelectorAll(".vs-switch__opt")[u];
|
|
108
|
+
g && c({ left: g.offsetLeft, width: g.offsetWidth });
|
|
109
109
|
}, [u, n.length]), U(() => {
|
|
110
110
|
const d = o.current;
|
|
111
111
|
if (!d || typeof ResizeObserver > "u") return;
|
|
112
|
-
const
|
|
113
|
-
const
|
|
114
|
-
|
|
112
|
+
const g = new ResizeObserver(() => {
|
|
113
|
+
const M = d.querySelectorAll(".vs-switch__opt")[u];
|
|
114
|
+
M && c({ left: M.offsetLeft, width: M.offsetWidth });
|
|
115
115
|
});
|
|
116
|
-
return
|
|
116
|
+
return g.observe(d), () => g.disconnect();
|
|
117
117
|
}, [u]), /* @__PURE__ */ h("div", { ref: o, role: "tablist", className: `vs-switch${r === "sm" ? " vs-switch--sm" : ""}${s ? "" : " vs-switch--borderless"}${a ? " vs-switch--fill" : ""}`, children: [
|
|
118
118
|
l && /* @__PURE__ */ i("span", { className: "vs-switch__thumb", style: { left: l.left, width: l.width }, "aria-hidden": "true" }),
|
|
119
119
|
n.map((d) => /* @__PURE__ */ h("button", { type: "button", role: "tab", "aria-selected": d.value === t, className: "vs-switch__opt", onClick: () => e(d.value), children: [
|
|
@@ -184,28 +184,28 @@ function Mr({ children: t, ms: e = 220 }) {
|
|
|
184
184
|
if (!o || !l) return;
|
|
185
185
|
let c;
|
|
186
186
|
const u = () => {
|
|
187
|
-
const
|
|
188
|
-
return !
|
|
187
|
+
const M = l.closest(".vs-sheet"), N = M ? parseFloat(getComputedStyle(M).maxHeight) : NaN;
|
|
188
|
+
return !M || !Number.isFinite(N) ? 1 / 0 : Math.max(0, N - (M.offsetHeight - l.offsetHeight));
|
|
189
189
|
}, d = () => {
|
|
190
|
-
const
|
|
191
|
-
clearTimeout(c), a(Math.min(
|
|
190
|
+
const M = o.offsetHeight;
|
|
191
|
+
clearTimeout(c), a(Math.min(M, u())), M > u() && (c = setTimeout(() => a(M), e));
|
|
192
192
|
};
|
|
193
193
|
if (d(), typeof ResizeObserver > "u") return () => clearTimeout(c);
|
|
194
|
-
const
|
|
195
|
-
return
|
|
196
|
-
|
|
194
|
+
const g = new ResizeObserver(d);
|
|
195
|
+
return g.observe(o), () => {
|
|
196
|
+
g.disconnect(), clearTimeout(c);
|
|
197
197
|
};
|
|
198
198
|
}, [e]), /* @__PURE__ */ i("div", { ref: n, style: { height: s ?? void 0, overflow: "clip", transition: s == null ? void 0 : `height ${e}ms cubic-bezier(.32,.72,0,1)` }, children: /* @__PURE__ */ i("div", { ref: r, children: t }) });
|
|
199
199
|
}
|
|
200
200
|
function Vt({ open: t, onClose: e, title: n, titleNode: r, note: s, doneLabel: a = "Done", children: o, drawer: l = !1, header: c, kind: u, sticky: d = !1 }) {
|
|
201
|
-
const
|
|
202
|
-
return Ia(
|
|
201
|
+
const g = v(null);
|
|
202
|
+
return Ia(g, t), U(() => {
|
|
203
203
|
if (!t) return;
|
|
204
|
-
const
|
|
204
|
+
const M = (N) => {
|
|
205
205
|
N.key === "Escape" && e();
|
|
206
206
|
};
|
|
207
|
-
return window.addEventListener("keydown",
|
|
208
|
-
}, [t, e]), t ? /* @__PURE__ */ i("div", { ref:
|
|
207
|
+
return window.addEventListener("keydown", M), () => window.removeEventListener("keydown", M);
|
|
208
|
+
}, [t, e]), t ? /* @__PURE__ */ i("div", { ref: g, className: `vs-sheet-scrim${l ? " drawer" : ""}${d ? " vs-sheet-scrim--sticky" : ""}`, onClick: d ? void 0 : e, children: /* @__PURE__ */ h("div", { className: `vs-sheet${u ? ` vs-sheet--${u}` : ""}`, role: "dialog", "aria-modal": "true", "aria-label": n, onClick: (M) => M.stopPropagation(), children: [
|
|
209
209
|
/* @__PURE__ */ i("div", { className: "vs-sheet__grip" }),
|
|
210
210
|
/* @__PURE__ */ h("div", { className: "vs-sheet__head", children: [
|
|
211
211
|
r ?? /* @__PURE__ */ i("span", { className: "vs-sheet__title", children: n }),
|
|
@@ -697,16 +697,16 @@ const nt = class nt {
|
|
|
697
697
|
let o = 0;
|
|
698
698
|
if (a)
|
|
699
699
|
if (this.within = null, r.total > 1) {
|
|
700
|
-
const c = Array.from({ length: r.total }, (d,
|
|
701
|
-
var
|
|
702
|
-
return ((
|
|
703
|
-
}), u = c.reduce((d,
|
|
700
|
+
const c = Array.from({ length: r.total }, (d, g) => {
|
|
701
|
+
var M;
|
|
702
|
+
return ((M = r.got.get(g)) == null ? void 0 : M.durationS) ?? 0;
|
|
703
|
+
}), u = c.reduce((d, g) => d + g, 0);
|
|
704
704
|
if (u > 0 && c.every((d) => d > 0)) {
|
|
705
705
|
const d = a.frac * u;
|
|
706
|
-
let
|
|
707
|
-
for (;
|
|
708
|
-
if (o = -(d -
|
|
709
|
-
this.partBase =
|
|
706
|
+
let g = 0, M = 0;
|
|
707
|
+
for (; g < c.length - 1 && M + c[g] <= d; ) M += c[g++];
|
|
708
|
+
if (o = -(d - M), g !== n) {
|
|
709
|
+
this.partBase = M, this.startPartAt(e, g, d - M);
|
|
710
710
|
return;
|
|
711
711
|
}
|
|
712
712
|
}
|
|
@@ -739,9 +739,9 @@ const nt = class nt {
|
|
|
739
739
|
if (this.rank(c) <= l || !this.speakable(c)) continue;
|
|
740
740
|
const u = this.clips.get(c);
|
|
741
741
|
if (u)
|
|
742
|
-
for (const d of [...u.got.keys()].sort((
|
|
743
|
-
const
|
|
744
|
-
r.push(
|
|
742
|
+
for (const d of [...u.got.keys()].sort((g, M) => g - M)) {
|
|
743
|
+
const g = u.got.get(d);
|
|
744
|
+
r.push(g), s += g.durationS || 0;
|
|
745
745
|
}
|
|
746
746
|
}
|
|
747
747
|
return r;
|
|
@@ -881,19 +881,19 @@ function Ya(t, e, n, r = {}, s) {
|
|
|
881
881
|
if (!(a != null && a.length)) return [];
|
|
882
882
|
const o = Oa(r), l = o ? `&${o}` : "", c = t.voiceKey ? `&voice=${encodeURIComponent(t.voiceKey)}` : "";
|
|
883
883
|
return a.flatMap((u) => {
|
|
884
|
-
var
|
|
885
|
-
const d = (
|
|
886
|
-
return Array.from({ length:
|
|
884
|
+
var M, N;
|
|
885
|
+
const d = (M = t.clipRev) == null ? void 0 : M[String(u)], g = Math.max(1, ((N = t.clipParts) == null ? void 0 : N[String(u)]) ?? 1);
|
|
886
|
+
return Array.from({ length: g }, (p, y) => {
|
|
887
887
|
var L;
|
|
888
888
|
return {
|
|
889
889
|
sentenceId: u,
|
|
890
890
|
lang: t.lang,
|
|
891
891
|
src: `${n}/v1/recordings/${e}/voice/${u}?lang=${encodeURIComponent(t.lang)}${c}&format=${xn()}${y > 0 ? `&part=${y}` : ""}${d ? `&v=${encodeURIComponent(d)}` : ""}${l}`,
|
|
892
|
-
durationS:
|
|
892
|
+
durationS: g === 1 ? ((L = t.clipDur) == null ? void 0 : L[String(u)]) ?? 0 : 0,
|
|
893
893
|
voice: t.voice ?? null,
|
|
894
894
|
cloned: !1,
|
|
895
895
|
part: y,
|
|
896
|
-
parts:
|
|
896
|
+
parts: g
|
|
897
897
|
};
|
|
898
898
|
});
|
|
899
899
|
});
|
|
@@ -967,21 +967,21 @@ function Qa(t) {
|
|
|
967
967
|
const [e, n] = Ir(t === "ga" ? "vs.colW.ga" : "vs.colW", null);
|
|
968
968
|
return [typeof e == "number" && e > 0 ? e : t === "ga" ? 560 : Pa, n];
|
|
969
969
|
}
|
|
970
|
-
function Or({ open: t, onClose: e, value: n, onSelect: r, languages: s, searchPlaceholder: a = "Search languages", none: o, pinned: l = [], recent: c = [], requireVoice: u, keepOpen: d, busy:
|
|
971
|
-
const [
|
|
970
|
+
function Or({ open: t, onClose: e, value: n, onSelect: r, languages: s, searchPlaceholder: a = "Search languages", none: o, pinned: l = [], recent: c = [], requireVoice: u, keepOpen: d, busy: g }) {
|
|
971
|
+
const [M, N] = z(""), [p, y] = z(!1), [L, m] = z(null);
|
|
972
972
|
U(() => {
|
|
973
973
|
t && (N(""), y(!1), m(null));
|
|
974
974
|
}, [t]);
|
|
975
975
|
const f = Ie(() => {
|
|
976
|
-
const E =
|
|
976
|
+
const E = M.trim().toLowerCase();
|
|
977
977
|
return [...E ? s.filter((O) => O.label.toLowerCase().includes(E) || O.native.toLowerCase().includes(E) || O.code.toLowerCase().includes(E)) : s].sort((O, S) => {
|
|
978
978
|
const re = l.indexOf(O.code), K = l.indexOf(S.code);
|
|
979
979
|
return re !== -1 || K !== -1 ? (re === -1 ? 999 : re) - (K === -1 ? 999 : K) : O.label.localeCompare(S.label);
|
|
980
980
|
});
|
|
981
|
-
}, [s,
|
|
982
|
-
() =>
|
|
983
|
-
[c, f,
|
|
984
|
-
),
|
|
981
|
+
}, [s, M, l]), I = Ie(
|
|
982
|
+
() => M ? [] : c.map((E) => f.find((Q) => Q.code === E)).filter((E) => !!E).sort((E, Q) => E.label.localeCompare(Q.label)),
|
|
983
|
+
[c, f, M]
|
|
984
|
+
), b = Ie(() => I.length ? f.filter((E) => !I.some((Q) => Q.code === E.code)) : f, [f, I]), D = p || M ? b : b.slice(0, 12), V = b.length - D.length, _ = (E, Q = !1) => {
|
|
985
985
|
const T = !!u && !E.voice;
|
|
986
986
|
return /* @__PURE__ */ h(
|
|
987
987
|
"button",
|
|
@@ -1008,16 +1008,16 @@ function Or({ open: t, onClose: e, value: n, onSelect: r, languages: s, searchPl
|
|
|
1008
1008
|
(O.key === "Enter" || O.key === " ") && (O.preventDefault(), O.stopPropagation(), Ys(E.code));
|
|
1009
1009
|
}, children: /* @__PURE__ */ i(oe, { d: X.close, size: 16 }) }) }),
|
|
1010
1010
|
/* @__PURE__ */ i("span", { className: `vs-picker__slot${T ? " vs-picker__slot--wide" : ""}`, title: E.voice ? "Voice available" : T ? "No voice speaks this language yet" : void 0, children: T ? L === E.code && /* @__PURE__ */ i("span", { className: "vs-picker__off", children: "UNAVAILABLE" }) : E.voice && /* @__PURE__ */ i(oe, { d: X.headphones, size: 16 }) }),
|
|
1011
|
-
/* @__PURE__ */ i("span", { className: "vs-picker__check", children: n === E.code && (
|
|
1011
|
+
/* @__PURE__ */ i("span", { className: "vs-picker__check", children: n === E.code && (g === E.code ? /* @__PURE__ */ i(at, { size: 15, color: "var(--vs-link-hover)", track: "var(--vs-border)" }) : /* @__PURE__ */ i(oe, { d: X.check, size: 16, sw: 2.2 })) })
|
|
1012
1012
|
]
|
|
1013
1013
|
},
|
|
1014
1014
|
E.code
|
|
1015
1015
|
);
|
|
1016
1016
|
}, ee = /* @__PURE__ */ h("div", { className: "vs-picker__search", children: [
|
|
1017
1017
|
/* @__PURE__ */ i(oe, { d: X.search, size: 16, sw: 1.7, style: { color: "var(--vs-text-muted)" } }),
|
|
1018
|
-
/* @__PURE__ */ i("input", { value:
|
|
1018
|
+
/* @__PURE__ */ i("input", { value: M, onChange: (E) => N(E.target.value), placeholder: a, "aria-label": a })
|
|
1019
1019
|
] }), j = /* @__PURE__ */ h("div", { className: "vs-picker__list", children: [
|
|
1020
|
-
o && !
|
|
1020
|
+
o && !M && /* @__PURE__ */ h("button", { type: "button", className: "vs-picker__row", "data-vs-original": "", "aria-selected": n === null, onClick: () => {
|
|
1021
1021
|
r(null), d || e();
|
|
1022
1022
|
}, children: [
|
|
1023
1023
|
/* @__PURE__ */ i("span", { className: "vs-picker__flag", children: /* @__PURE__ */ i(oe, { d: X.mic, size: 19, sw: 1.6, style: { color: "var(--vs-text-muted)" } }) }),
|
|
@@ -1042,7 +1042,7 @@ function Or({ open: t, onClose: e, value: n, onSelect: r, languages: s, searchPl
|
|
|
1042
1042
|
] }),
|
|
1043
1043
|
f.length === 0 && /* @__PURE__ */ h("div", { className: "vs-picker__more", children: [
|
|
1044
1044
|
"No match for “",
|
|
1045
|
-
|
|
1045
|
+
M,
|
|
1046
1046
|
"”"
|
|
1047
1047
|
] })
|
|
1048
1048
|
] });
|
|
@@ -1119,22 +1119,22 @@ function rr(t) {
|
|
|
1119
1119
|
t && (t.pause(), t.removeAttribute("src"), t.load());
|
|
1120
1120
|
}
|
|
1121
1121
|
function pi(t, e) {
|
|
1122
|
-
const [n, r] = z("off"), [s, a] = z([]), [o, l] = z(!1), c = v(null), u = v([null, null]), d = v([NaN, NaN]),
|
|
1122
|
+
const [n, r] = z("off"), [s, a] = z([]), [o, l] = z(!1), c = v(null), u = v([null, null]), d = v([NaN, NaN]), g = v(0);
|
|
1123
1123
|
return U(() => {
|
|
1124
1124
|
if (a([]), l(!1), !t) {
|
|
1125
1125
|
r("off");
|
|
1126
1126
|
return;
|
|
1127
1127
|
}
|
|
1128
|
-
let
|
|
1128
|
+
let M = !1, N;
|
|
1129
1129
|
r("making");
|
|
1130
1130
|
const p = () => {
|
|
1131
1131
|
to(t).then((y) => {
|
|
1132
|
-
if (!
|
|
1132
|
+
if (!M) {
|
|
1133
1133
|
if (y.ready) {
|
|
1134
1134
|
const L = new Audio();
|
|
1135
1135
|
L.preload = "auto";
|
|
1136
1136
|
const m = () => {
|
|
1137
|
-
!
|
|
1137
|
+
!M && c.current === L && r("ready");
|
|
1138
1138
|
};
|
|
1139
1139
|
L.addEventListener("canplay", m, { once: !0 }), L.addEventListener("error", m, { once: !0 }), L.src = t, c.current = L;
|
|
1140
1140
|
return;
|
|
@@ -1146,31 +1146,31 @@ function pi(t, e) {
|
|
|
1146
1146
|
a((L) => L.length === y.parts.length && L.every((m, f) => m.startS === y.parts[f].startS) ? L : y.parts), N = setTimeout(p, y.retryS * 1e3);
|
|
1147
1147
|
}
|
|
1148
1148
|
}).catch(() => {
|
|
1149
|
-
|
|
1149
|
+
M || (N = setTimeout(p, 5e3));
|
|
1150
1150
|
});
|
|
1151
1151
|
};
|
|
1152
1152
|
return p(), () => {
|
|
1153
|
-
|
|
1153
|
+
M = !0, N && clearTimeout(N), rr(c.current), c.current = null, rr(u.current[0]), rr(u.current[1]), u.current = [null, null], d.current = [NaN, NaN];
|
|
1154
1154
|
};
|
|
1155
1155
|
}, [t]), U(() => {
|
|
1156
|
-
const
|
|
1156
|
+
const M = () => {
|
|
1157
1157
|
for (const m of u.current) m && !m.paused && m.pause();
|
|
1158
1158
|
};
|
|
1159
1159
|
if (n === "ready" && c.current) {
|
|
1160
|
-
|
|
1160
|
+
M(), Us(c.current, e), l(!0);
|
|
1161
1161
|
return;
|
|
1162
1162
|
}
|
|
1163
1163
|
const N = n === "making" ? Xa(s, e.t) : -1;
|
|
1164
1164
|
if (N < 0) {
|
|
1165
|
-
|
|
1165
|
+
M(), l(!1);
|
|
1166
1166
|
return;
|
|
1167
1167
|
}
|
|
1168
|
-
const p = eo(s, N, d.current,
|
|
1168
|
+
const p = eo(s, N, d.current, g.current);
|
|
1169
1169
|
for (const [m, f] of p.load) {
|
|
1170
1170
|
let I = u.current[m];
|
|
1171
1171
|
I || (I = new Audio(), I.preload = "auto", u.current[m] = I), I.pause(), I.src = s[f].url, d.current[m] = s[f].startS;
|
|
1172
1172
|
}
|
|
1173
|
-
|
|
1173
|
+
g.current = p.play;
|
|
1174
1174
|
const y = u.current[p.play], L = u.current[1 - p.play];
|
|
1175
1175
|
L && !L.paused && L.pause(), Us(y, { ...e, t: e.t - s[N].startS }), l(!e.playing || y.readyState >= 3);
|
|
1176
1176
|
}, [n, s, e.t, e.playing, e.muted]), { state: n, on: o, untilS: n === "ready" ? 1 / 0 : s.length ? s[s.length - 1].endS : 0 };
|
|
@@ -1194,7 +1194,7 @@ function io(t, e, n) {
|
|
|
1194
1194
|
const o = Math.max(1, ...a.map((c) => c.parts));
|
|
1195
1195
|
let l = Math.max(0, n - s.start);
|
|
1196
1196
|
for (let c = 0; c < o; c++) {
|
|
1197
|
-
const u = a.find((
|
|
1197
|
+
const u = a.find((g) => g.part === c);
|
|
1198
1198
|
if (!u) return { kind: "missing", sid: s.sid };
|
|
1199
1199
|
const d = u.durationS && u.durationS > 0 ? u.durationS : 1 / 0;
|
|
1200
1200
|
if (l < d) return { kind: "play", sid: s.sid, src: u.src, offset: l };
|
|
@@ -1240,31 +1240,31 @@ function lo(t) {
|
|
|
1240
1240
|
}
|
|
1241
1241
|
const c = io(t.lines, e, t.t), u = c.kind === "missing" ? c.sid : null, d = c.kind === "none" ? null : c.sid;
|
|
1242
1242
|
a((p) => p.missing === u && p.sid === d ? p : { missing: u, sid: d });
|
|
1243
|
-
const
|
|
1244
|
-
for (const p of
|
|
1245
|
-
const
|
|
1246
|
-
|
|
1247
|
-
for (const [p, y] of n.current) !
|
|
1243
|
+
const g = new Set(oo(t.lines, e, t.t));
|
|
1244
|
+
for (const p of g) o(p);
|
|
1245
|
+
const M = r.current;
|
|
1246
|
+
M && g.add(M.src);
|
|
1247
|
+
for (const [p, y] of n.current) !g.has(p) && (!M || M.el !== y) && (y.pause(), n.current.delete(p));
|
|
1248
1248
|
if (!t.playing) {
|
|
1249
|
-
|
|
1249
|
+
M == null || M.el.pause();
|
|
1250
1250
|
return;
|
|
1251
1251
|
}
|
|
1252
1252
|
if (c.kind !== "play") {
|
|
1253
|
-
if (
|
|
1254
|
-
|
|
1253
|
+
if (M && !M.el.paused && !M.el.ended && ao(t.lines, t.t, M.sid)) return;
|
|
1254
|
+
M && M.el.pause(), r.current = null;
|
|
1255
1255
|
return;
|
|
1256
1256
|
}
|
|
1257
|
-
if (
|
|
1258
|
-
if (
|
|
1257
|
+
if (M && M.src === c.src) {
|
|
1258
|
+
if (M.el.muted = t.muted, !M.el.ended && Math.abs(M.el.currentTime - c.offset) > ro)
|
|
1259
1259
|
try {
|
|
1260
|
-
|
|
1260
|
+
M.el.currentTime = c.offset;
|
|
1261
1261
|
} catch {
|
|
1262
1262
|
}
|
|
1263
|
-
|
|
1263
|
+
M.el.paused && !M.el.ended && M.el.play().catch(() => {
|
|
1264
1264
|
});
|
|
1265
1265
|
return;
|
|
1266
1266
|
}
|
|
1267
|
-
|
|
1267
|
+
M == null || M.el.pause();
|
|
1268
1268
|
const N = o(c.src);
|
|
1269
1269
|
N.muted = t.muted;
|
|
1270
1270
|
try {
|
|
@@ -1497,7 +1497,7 @@ function fo(t, e) {
|
|
|
1497
1497
|
if ((n = e.scriptWords) != null && n.length) {
|
|
1498
1498
|
const a = (c) => c.toLowerCase().replace(/[^\p{L}\p{N}]/gu, ""), o = (e.fixes ?? []).filter((c) => String(c.kind ?? "").endsWith("script") && String(c.orig ?? "").trim()), l = (c) => {
|
|
1499
1499
|
var u, d;
|
|
1500
|
-
return c.recognized ?? ((d = (u = o.find((
|
|
1500
|
+
return c.recognized ?? ((d = (u = o.find((g) => String(g.repl ?? "").split(/\s+/).map(a).includes(a(c.text)))) == null ? void 0 : u.orig) == null ? void 0 : d.trim());
|
|
1501
1501
|
};
|
|
1502
1502
|
r.words = r.words.map((c, u) => {
|
|
1503
1503
|
if (!e.scriptWords.includes(u)) return c;
|
|
@@ -1789,12 +1789,12 @@ function Ao(t, e) {
|
|
|
1789
1789
|
const [n, r] = z(null), [s, a] = z(!1), [o, l] = z(null), [c, u] = z(0);
|
|
1790
1790
|
return U(() => {
|
|
1791
1791
|
let d = !0;
|
|
1792
|
-
return So(t, e).then((
|
|
1793
|
-
d && (r(
|
|
1794
|
-
}).catch((
|
|
1792
|
+
return So(t, e).then((g) => {
|
|
1793
|
+
d && (r(g), a(!1), l(null));
|
|
1794
|
+
}).catch((g) => {
|
|
1795
1795
|
if (!d) return;
|
|
1796
|
-
const
|
|
1797
|
-
|
|
1796
|
+
const M = Tt(g);
|
|
1797
|
+
M.code === "not_found" || M.status === 404 ? a(!0) : l(M);
|
|
1798
1798
|
}), () => {
|
|
1799
1799
|
d = !1;
|
|
1800
1800
|
};
|
|
@@ -1856,7 +1856,7 @@ const _o = (t) => new Promise((e) => setTimeout(e, t)), Yo = 2500, Uo = 72;
|
|
|
1856
1856
|
function Ro(t, e) {
|
|
1857
1857
|
const n = Et(), r = v(n);
|
|
1858
1858
|
r.current = n;
|
|
1859
|
-
const [s, a] = z($t), o = v($t()), l = v(null), c = v(e.lang ?? null), [u, d] = z(!1), [
|
|
1859
|
+
const [s, a] = z($t), o = v($t()), l = v(null), c = v(e.lang ?? null), [u, d] = z(!1), [g, M] = z(null), [N, p] = z(!1), y = Ke(() => {
|
|
1860
1860
|
const Q = o.current;
|
|
1861
1861
|
a({ ...Q });
|
|
1862
1862
|
}, []), L = v(e);
|
|
@@ -1881,7 +1881,7 @@ function Ro(t, e) {
|
|
|
1881
1881
|
G.close();
|
|
1882
1882
|
return;
|
|
1883
1883
|
}
|
|
1884
|
-
T = 0, l.current = G, c.current !== pe && G.setLanguage(c.current), d(!0),
|
|
1884
|
+
T = 0, l.current = G, c.current !== pe && G.setLanguage(c.current), d(!0), M(null), o.current = sr(G.snapshot, o.current), y(), re();
|
|
1885
1885
|
for await (const le of G) {
|
|
1886
1886
|
if (!Q) break;
|
|
1887
1887
|
if (le.type === "snapshot")
|
|
@@ -1896,7 +1896,7 @@ function Ro(t, e) {
|
|
|
1896
1896
|
if (!Q) return;
|
|
1897
1897
|
const le = Tt(pe);
|
|
1898
1898
|
if (le.code === "not_found" || le.status === 404) {
|
|
1899
|
-
p(!0),
|
|
1899
|
+
p(!0), M(le);
|
|
1900
1900
|
return;
|
|
1901
1901
|
}
|
|
1902
1902
|
try {
|
|
@@ -1904,19 +1904,19 @@ function Ro(t, e) {
|
|
|
1904
1904
|
} catch (Te) {
|
|
1905
1905
|
const je = Tt(Te);
|
|
1906
1906
|
if (je.code === "not_found" || je.status === 404) {
|
|
1907
|
-
p(!0),
|
|
1907
|
+
p(!0), M(je);
|
|
1908
1908
|
return;
|
|
1909
1909
|
}
|
|
1910
1910
|
if (je.code === "forbidden" || je.code === "invalid_token" || je.code === "password_required" || je.status === 401 || je.status === 403) {
|
|
1911
|
-
|
|
1911
|
+
M(je);
|
|
1912
1912
|
return;
|
|
1913
1913
|
}
|
|
1914
1914
|
}
|
|
1915
1915
|
if (le.code === "forbidden" || le.code === "invalid_token" || le.code === "password_required" || le.status === 401 || le.status === 403) {
|
|
1916
|
-
|
|
1916
|
+
M(le);
|
|
1917
1917
|
return;
|
|
1918
1918
|
}
|
|
1919
|
-
|
|
1919
|
+
M(le);
|
|
1920
1920
|
} finally {
|
|
1921
1921
|
l.current === G && (l.current = null), d(!1);
|
|
1922
1922
|
}
|
|
@@ -1929,11 +1929,11 @@ function Ro(t, e) {
|
|
|
1929
1929
|
Q = !1, (K = l.current) == null || K.close(), l.current = null, d(!1);
|
|
1930
1930
|
};
|
|
1931
1931
|
}, [t, n, e.voice]);
|
|
1932
|
-
const [m, f] = z(!1), [I,
|
|
1932
|
+
const [m, f] = z(!1), [I, b] = z(null), D = v(0), [V, _] = z(null), ee = Ke((Q) => {
|
|
1933
1933
|
var re;
|
|
1934
1934
|
if (c.current = Q, (re = l.current) == null || re.setLanguage(Q), !t) return;
|
|
1935
1935
|
const T = r.current.client, O = ++D.current;
|
|
1936
|
-
f(!0),
|
|
1936
|
+
f(!0), b(null);
|
|
1937
1937
|
const S = (K) => T.recordings.transcript(t, { lang: Q ?? void 0, ...r.current.readAs, asListener: !r.current.owner }).then((k) => {
|
|
1938
1938
|
O === D.current && (o.current = sr(k, o.current), _(Q), y(), k.translationPending && K > 0 && window.setTimeout(() => {
|
|
1939
1939
|
O === D.current && S(K - 1).catch(() => {
|
|
@@ -1941,7 +1941,7 @@ function Ro(t, e) {
|
|
|
1941
1941
|
}, Yo));
|
|
1942
1942
|
});
|
|
1943
1943
|
S(Uo).catch(() => {
|
|
1944
|
-
O === D.current && Q &&
|
|
1944
|
+
O === D.current && Q && b(Q);
|
|
1945
1945
|
}).finally(() => {
|
|
1946
1946
|
O === D.current && f(!1);
|
|
1947
1947
|
});
|
|
@@ -1953,8 +1953,8 @@ function Ro(t, e) {
|
|
|
1953
1953
|
k && (k.translations = { ...k.translations, [Q]: K }, S = !0);
|
|
1954
1954
|
}
|
|
1955
1955
|
S && y();
|
|
1956
|
-
}, [y]), E = Ke(() =>
|
|
1957
|
-
return { model: s, connected: u, error:
|
|
1956
|
+
}, [y]), E = Ke(() => M(null), []);
|
|
1957
|
+
return { model: s, connected: u, error: g, notFound: N, clearError: E, setLanguage: ee, mergeTranslations: j, translating: m, translateFailed: I, shownLang: V };
|
|
1958
1958
|
}
|
|
1959
1959
|
const Vs = {
|
|
1960
1960
|
English: { vcFor: "Voice for", vcMute: "Mute", vcUnmute: "Unmute", vcMuted: "MUTED", vcShared: "Also used by", vcUsedBy: "Used by", vcUnknownSpk: "Unknown", vcUse: "Use this voice", vcGetting: "Downloading…", vcSample: "Here’s how it sounds.", vcPreview: "PREVIEW", vcMale: "Male", vcFemale: "Female", vcSynth: "SYNTHETIC", origAudio: "ORIGINAL AUDIO", vcCloned: "VOICES", vcBadge: "CLONED", vcNone: "TEXT ONLY", vcNoVoice: "No voice for ", vcSheet: "VOICE", vcNeutral: "SYNTHETIC VOICE", vcWarm: "SYNTHETIC VOICE", searchPlaceholder: "Search this broadcast", noise: "Audio unclear", newLines: "new", live: "LIVE", ended: "ENDED", waiting: "WAITING", corrected: "CORRECTED", hostLine: "Hosted by Marcus Reed · 4 speakers", langLabel: "LANGUAGE", langCount: "100+ languages", read: "Read", listen: "Listen", watch: "Watch", waitTitle: "The broadcast hasn’t started yet", waitBody: "The transcript appears here as soon as the host starts speaking.", english: "ENGLISH", playing: "Playing the live audio", ready: "Tap to start audio", readyNote: "Set your volume first", voiceMeta: "ORIGINAL AUDIO", voice: "Voice", sheetTitle: "APP LANGUAGE", done: "Done", search: "Search 100+ languages", sheetNote: "Follow along in your language.", moreLangs: "more", confTitle: "Some words weren't heard clearly", confBody: "The transcript marks words the model is unsure about with a dashed underline. The words keep their colour, so only the underline tells you where to look.", confMid: "Slightly unsure — probably right", confHigh: "Low confidence — may be wrong", settings: "BROADCAST", setOrig: "Show original language", setTheme: "Appearance", light: "Light", dark: "Dark", setConf: "Show uncertain words", setConfHint1: "Colours words the model is unsure about — ", setConfMid: "amber", setConfSep: " or ", setConfLow: "red", setConfHint2: "", behindLive: "TRANSLATION LATENCY", behindNote: "How far the translation trails the speaker right now.", shareLabel: "LIVE TRANSLATION LINK", copy: "Copy", copied: "Copied" },
|
|
@@ -2020,14 +2020,14 @@ async function Bo(t) {
|
|
|
2020
2020
|
Sr(t);
|
|
2021
2021
|
}
|
|
2022
2022
|
async function Vo(t, e, n, r = {}) {
|
|
2023
|
-
var
|
|
2023
|
+
var M, N;
|
|
2024
2024
|
const s = await t.client.recordings.export(e, n, { lang: r.lang ?? void 0, ...t.readAs });
|
|
2025
2025
|
if (!s.ok) throw await ji(s);
|
|
2026
|
-
const a = await s.blob(), o = s.headers.get("content-disposition") ?? "", l = (
|
|
2027
|
-
|
|
2026
|
+
const a = await s.blob(), o = s.headers.get("content-disposition") ?? "", l = (M = /filename\*=UTF-8''([^;]+)/i.exec(o)) == null ? void 0 : M[1], c = (N = /filename="([^"]+)"/i.exec(o)) == null ? void 0 : N[1], u = l ? decodeURIComponent(l) : c ?? `transcript.${n}`, d = URL.createObjectURL(a), g = document.createElement("a");
|
|
2027
|
+
g.href = d, g.download = u, g.style.display = "none", document.body.appendChild(g), g.click(), g.remove(), window.setTimeout(() => URL.revokeObjectURL(d), 6e4);
|
|
2028
2028
|
}
|
|
2029
2029
|
async function Ho(t, e) {
|
|
2030
|
-
const { recordingId: n, lang: r, voiceKey: s, cred: a } = e, o = async () => (await t.client.recordings.voice(n, r, t.readAs)).filter((
|
|
2030
|
+
const { recordingId: n, lang: r, voiceKey: s, cred: a } = e, o = async () => (await t.client.recordings.voice(n, r, t.readAs)).filter((g) => g.lang === r), l = (d) => di(d, s);
|
|
2031
2031
|
let c = l(await o());
|
|
2032
2032
|
(!c || c.state === "clips" || c.state === "failed") && await e.request();
|
|
2033
2033
|
const u = Date.now() + (e.timeoutMs ?? 10 * 6e4);
|
|
@@ -2089,7 +2089,7 @@ function qo(t, e, n = 0) {
|
|
|
2089
2089
|
const _ = o(), ee = _ ? _.offsetHeight : 0, j = s.clientHeight - ee - 36, E = s.scrollHeight - s.clientHeight, Q = j > 0 ? Math.max(30, Math.round(j * (s.clientHeight - ee) / s.scrollHeight)) : 0;
|
|
2090
2090
|
return { vis: j, max: E, size: Q };
|
|
2091
2091
|
};
|
|
2092
|
-
let c = -1, u = null, d = !1,
|
|
2092
|
+
let c = -1, u = null, d = !1, g = 0, M = 0;
|
|
2093
2093
|
const N = () => {
|
|
2094
2094
|
const _ = o();
|
|
2095
2095
|
if (!_) return;
|
|
@@ -2116,19 +2116,19 @@ function qo(t, e, n = 0) {
|
|
|
2116
2116
|
a.style.pointerEvents = "auto", a.style.height = j.size + "px", a.style.transform = "translateY(" + Math.round(s.scrollTop / j.max * (j.vis - j.size)) + "px)", _ && p();
|
|
2117
2117
|
}, f = parseFloat(getComputedStyle(s).paddingRight) || 0;
|
|
2118
2118
|
a.style.right = (f >= 12 ? -(f - 6) : 2) + "px";
|
|
2119
|
-
const I = () => m(!0),
|
|
2119
|
+
const I = () => m(!0), b = (_) => {
|
|
2120
2120
|
const ee = l();
|
|
2121
|
-
ee.vis - ee.size <= 0 || (_.preventDefault(), _.stopPropagation(), a.setPointerCapture(_.pointerId), d = !0,
|
|
2121
|
+
ee.vis - ee.size <= 0 || (_.preventDefault(), _.stopPropagation(), a.setPointerCapture(_.pointerId), d = !0, g = _.clientY, M = s.scrollTop, a.style.cursor = "grabbing", p());
|
|
2122
2122
|
}, D = (_) => {
|
|
2123
2123
|
if (!d) return;
|
|
2124
2124
|
const ee = l();
|
|
2125
|
-
s.scrollTop =
|
|
2125
|
+
s.scrollTop = M + (_.clientY - g) / (ee.vis - ee.size) * ee.max, p();
|
|
2126
2126
|
}, V = () => {
|
|
2127
2127
|
d && (d = !1, a.style.cursor = "grab", p());
|
|
2128
2128
|
};
|
|
2129
|
-
return s.addEventListener("scroll", I, { passive: !0 }), a.addEventListener("pointerdown",
|
|
2129
|
+
return s.addEventListener("scroll", I, { passive: !0 }), a.addEventListener("pointerdown", b), a.addEventListener("pointermove", D), a.addEventListener("pointerup", V), a.addEventListener("pointercancel", V), typeof ResizeObserver < "u" && (y = new ResizeObserver(() => m()), y.observe(s)), r.current = () => m(), m(), () => {
|
|
2130
2130
|
r.current = () => {
|
|
2131
|
-
}, s.removeEventListener("scroll", I), a.removeEventListener("pointerdown",
|
|
2131
|
+
}, s.removeEventListener("scroll", I), a.removeEventListener("pointerdown", b), a.removeEventListener("pointermove", D), a.removeEventListener("pointerup", V), a.removeEventListener("pointercancel", V), y == null || y.disconnect(), clearTimeout(u);
|
|
2132
2132
|
};
|
|
2133
2133
|
}, []);
|
|
2134
2134
|
}
|
|
@@ -2176,9 +2176,9 @@ function Zc({ chip: t, note: e, scrub: n, mute: r, voice: s, prev: a, play: o, n
|
|
|
2176
2176
|
] });
|
|
2177
2177
|
}
|
|
2178
2178
|
function Xo({ index: t, total: e, atLabel: n, durLabel: r, stepLabel: s, onSeek: a, onSeekFrac: o, onScrubStart: l, onScrubEnd: c, frac: u, glideMs: d = 260 }) {
|
|
2179
|
-
const
|
|
2179
|
+
const g = v(null), M = v(!1), [N, p] = z(null), y = Math.max(1, e), L = N ?? u, m = L != null ? Math.min(100, Math.max(0, L * 100)) : t / Math.max(1, y - 1) * 100, f = u != null && d > 0 && N == null ? `width ${d}ms linear, left ${d}ms linear` : "none", I = (D) => {
|
|
2180
2180
|
var j;
|
|
2181
|
-
const V = (j =
|
|
2181
|
+
const V = (j = g.current) == null ? void 0 : j.getBoundingClientRect();
|
|
2182
2182
|
if (!V) return;
|
|
2183
2183
|
const _ = Math.min(1, Math.max(0, (D.clientX - V.left) / Math.max(1, V.width)));
|
|
2184
2184
|
if (o) {
|
|
@@ -2187,24 +2187,24 @@ function Xo({ index: t, total: e, atLabel: n, durLabel: r, stepLabel: s, onSeek:
|
|
|
2187
2187
|
}
|
|
2188
2188
|
const ee = Math.round(_ * (y - 1));
|
|
2189
2189
|
ee !== t && a(ee);
|
|
2190
|
-
},
|
|
2191
|
-
|
|
2190
|
+
}, b = () => {
|
|
2191
|
+
M.current && (M.current = !1, p(null), c == null || c());
|
|
2192
2192
|
};
|
|
2193
2193
|
return /* @__PURE__ */ h("div", { className: "rscrub", children: [
|
|
2194
2194
|
/* @__PURE__ */ h(
|
|
2195
2195
|
"div",
|
|
2196
2196
|
{
|
|
2197
|
-
ref:
|
|
2197
|
+
ref: g,
|
|
2198
2198
|
className: "rscrub__track",
|
|
2199
2199
|
onPointerDown: (D) => {
|
|
2200
2200
|
var V;
|
|
2201
|
-
|
|
2201
|
+
M.current = !0, (V = g.current) == null || V.setPointerCapture(D.pointerId), l == null || l(), I(D), D.preventDefault();
|
|
2202
2202
|
},
|
|
2203
2203
|
onPointerMove: (D) => {
|
|
2204
|
-
|
|
2204
|
+
M.current && I(D);
|
|
2205
2205
|
},
|
|
2206
|
-
onPointerUp:
|
|
2207
|
-
onPointerCancel:
|
|
2206
|
+
onPointerUp: b,
|
|
2207
|
+
onPointerCancel: b,
|
|
2208
2208
|
children: [
|
|
2209
2209
|
/* @__PURE__ */ i("div", { className: "rscrub__rail" }),
|
|
2210
2210
|
/* @__PURE__ */ i("div", { className: "rscrub__fill", style: { width: `${m}%`, transition: f } }),
|
|
@@ -2250,15 +2250,15 @@ function nl({ onOpen: t, alone: e }) {
|
|
|
2250
2250
|
] });
|
|
2251
2251
|
}
|
|
2252
2252
|
function rl(t, e, n, r) {
|
|
2253
|
-
const s = Et(), [a, o] = z([]), [l, c] = z(0), u = v(/* @__PURE__ */ new Set()), d = v(!1),
|
|
2253
|
+
const s = Et(), [a, o] = z([]), [l, c] = z(0), u = v(/* @__PURE__ */ new Set()), d = v(!1), g = Ie(() => new Map(n.filter((N) => N.sentenceId != null).map((N) => [N.sentenceId, N])), [n]);
|
|
2254
2254
|
U(() => {
|
|
2255
2255
|
u.current = /* @__PURE__ */ new Set();
|
|
2256
2256
|
}, [t, e]);
|
|
2257
|
-
const
|
|
2257
|
+
const M = Ke((N) => o(N), []);
|
|
2258
2258
|
return U(() => {
|
|
2259
2259
|
if (!t || !e || !a.length || d.current) return;
|
|
2260
2260
|
const N = a.filter((p) => {
|
|
2261
|
-
const y =
|
|
2261
|
+
const y = g.get(p);
|
|
2262
2262
|
return !y || !y.text.trim() || !y.settled || y.translations[e] || y.language && y.language.slice(0, 2).toLowerCase() === e.slice(0, 2).toLowerCase() ? !1 : !u.current.has(`${e}:${p}`);
|
|
2263
2263
|
}).slice(0, 40);
|
|
2264
2264
|
if (N.length) {
|
|
@@ -2274,7 +2274,7 @@ function rl(t, e, n, r) {
|
|
|
2274
2274
|
d.current = !1, c((p) => p + 1);
|
|
2275
2275
|
});
|
|
2276
2276
|
}
|
|
2277
|
-
}, [t, e, a, l,
|
|
2277
|
+
}, [t, e, a, l, g, r]), M;
|
|
2278
2278
|
}
|
|
2279
2279
|
function sl(t) {
|
|
2280
2280
|
return t.live || t.auto ? "From this session" : t.cloned ? t.library === !1 ? "This transcription only" : "Saved in Voices" : "";
|
|
@@ -2333,28 +2333,28 @@ function Fs(t) {
|
|
|
2333
2333
|
function Gs(t, e, n = !0) {
|
|
2334
2334
|
const r = e.filter((o) => !o.cloned), s = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Map();
|
|
2335
2335
|
for (const o of t) {
|
|
2336
|
-
const c = (o.voiceId ? e.find((
|
|
2336
|
+
const c = (o.voiceId ? e.find((M) => M.cloned && !M.auto && M.consent !== "pending" && M.id === `clone:${o.voiceId}`) : void 0) ?? (n ? (o.voiceId ? e.find((M) => M.cloned && M.consent !== "pending" && M.id === `clone:${o.voiceId}`) : void 0) ?? (o.key >= 0 ? e.find((M) => M.cloned && M.auto && M.consent !== "pending" && M.speaker === o.key) : void 0) : void 0);
|
|
2337
2337
|
if (c) {
|
|
2338
2338
|
a.set(o.key, c.id), s.add(c.id);
|
|
2339
2339
|
continue;
|
|
2340
2340
|
}
|
|
2341
|
-
const u = r.filter((
|
|
2342
|
-
|
|
2341
|
+
const u = r.filter((M) => !s.has(M.id)), g = (o.sex ? u.filter((M) => M.gender === o.sex) : [])[0] ?? u[0] ?? r[0];
|
|
2342
|
+
g && (a.set(o.key, g.id), s.add(g.id));
|
|
2343
2343
|
}
|
|
2344
2344
|
return a;
|
|
2345
2345
|
}
|
|
2346
2346
|
function ol({ roster: t, selected: e, onSelect: n, noClone: r, building: s, short: a, warn: o, sexOf: l, t: c }) {
|
|
2347
2347
|
const u = t.find((d) => d.key === e) ?? t[0] ?? null;
|
|
2348
2348
|
return u ? /* @__PURE__ */ i("div", { style: { display: "flex", flexWrap: "wrap", gap: 6, padding: "0 2px 9px", margin: "0 -2px" }, children: t.map((d) => {
|
|
2349
|
-
const
|
|
2349
|
+
const g = d.key === u.key, M = d.key >= 0 ? (o == null ? void 0 : o(d)) ?? null : null, N = d.key >= 0 && !M && !!(s != null && s(d)), p = d.key >= 0 && !M && !N && r(d), y = d.key >= 0 && !M && !N && !p && !d.hasVoice && !!(a != null && a(d));
|
|
2350
2350
|
return /* @__PURE__ */ h(
|
|
2351
2351
|
"button",
|
|
2352
2352
|
{
|
|
2353
2353
|
type: "button",
|
|
2354
|
-
"aria-selected":
|
|
2354
|
+
"aria-selected": g,
|
|
2355
2355
|
onClick: () => n(d.key),
|
|
2356
2356
|
title: d.name,
|
|
2357
|
-
style: { flex: "none", boxSizing: "border-box", display: "flex", alignItems: "center", gap: 7, minHeight: 34, padding: "5px 11px", borderRadius: 9, font: "inherit", background:
|
|
2357
|
+
style: { flex: "none", boxSizing: "border-box", display: "flex", alignItems: "center", gap: 7, minHeight: 34, padding: "5px 11px", borderRadius: 9, font: "inherit", background: g ? "var(--brand-tint)" : "var(--fill-05)", border: `1px solid ${g ? "var(--brand-line)" : "transparent"}`, cursor: "pointer" },
|
|
2358
2358
|
children: [
|
|
2359
2359
|
/* @__PURE__ */ i(
|
|
2360
2360
|
"span",
|
|
@@ -2364,10 +2364,10 @@ function ol({ roster: t, selected: e, onSelect: n, noClone: r, building: s, shor
|
|
|
2364
2364
|
children: d.initial
|
|
2365
2365
|
}
|
|
2366
2366
|
),
|
|
2367
|
-
/* @__PURE__ */ i("span", { style: { fontSize: 12.5, fontWeight: 500, color:
|
|
2368
|
-
d.hasVoice && !
|
|
2369
|
-
|
|
2370
|
-
y && /* @__PURE__ */ i("span", { title: "Not enough audio to clone", "aria-label": "Not enough audio to clone", style: { flex: "none", display: "flex", marginRight: -2, color:
|
|
2367
|
+
/* @__PURE__ */ i("span", { style: { fontSize: 12.5, fontWeight: 500, color: g ? "var(--ink-96)" : "var(--ink-62)", whiteSpace: "nowrap" }, children: d.name }),
|
|
2368
|
+
d.hasVoice && !M && /* @__PURE__ */ i(Oi, { color: d.fg ?? (g ? "var(--ink-62)" : "var(--ink-45)") }),
|
|
2369
|
+
M && /* @__PURE__ */ i("span", { title: M, "aria-label": M, style: { flex: "none", width: 15, height: 15, marginRight: -2, borderRadius: "50%", background: "#c27c00", color: "#fff", font: "900 10.5px/1 system-ui, sans-serif", display: "flex", alignItems: "center", justifyContent: "center" }, children: "!" }),
|
|
2370
|
+
y && /* @__PURE__ */ i("span", { title: "Not enough audio to clone", "aria-label": "Not enough audio to clone", style: { flex: "none", display: "flex", marginRight: -2, color: g ? "var(--ink-45)" : "var(--ink-35)" }, children: /* @__PURE__ */ i(oe, { d: X.micOff, size: 13, sw: 1.7 }) }),
|
|
2371
2371
|
(p || N) && /* @__PURE__ */ i("span", { title: N ? "Cloning this voice…" : "No voice clone yet", "aria-label": N ? "Cloning this voice" : "No voice clone yet", style: { flex: "none", width: 10, height: 10, marginRight: -2, display: "flex", alignItems: "center", justifyContent: "center" }, children: N ? /* @__PURE__ */ i(at, { size: 10, color: "var(--brand)", track: "var(--fill-10)", sw: 1.6 }) : /* @__PURE__ */ i("span", { style: { width: 7, height: 7, borderRadius: "50%", background: "var(--brand)" } }) })
|
|
2372
2372
|
]
|
|
2373
2373
|
},
|
|
@@ -2375,21 +2375,21 @@ function ol({ roster: t, selected: e, onSelect: n, noClone: r, building: s, shor
|
|
|
2375
2375
|
);
|
|
2376
2376
|
}) }) : null;
|
|
2377
2377
|
}
|
|
2378
|
-
function ll({ cast: t, voices: e, currentId: n, armedId: r = null, sampleId: s = null, dlId: a = null, onPick: o, onAdd: l, onUse: c, usedBy: u, foldKey: d, foldFor:
|
|
2378
|
+
function ll({ cast: t, voices: e, currentId: n, armedId: r = null, sampleId: s = null, dlId: a = null, onPick: o, onAdd: l, onUse: c, usedBy: u, foldKey: d, foldFor: g = null, problem: M, noClone: N = null, t: p }) {
|
|
2379
2379
|
const y = Ie(() => il(e, p), [e, p]), [L, m] = z({});
|
|
2380
2380
|
U(() => {
|
|
2381
2381
|
m({});
|
|
2382
|
-
}, [d,
|
|
2382
|
+
}, [d, g]);
|
|
2383
2383
|
const f = (D) => D === p.vcMale.toUpperCase() || D === p.vcFemale.toUpperCase(), I = (D) => {
|
|
2384
2384
|
if (D === p.vcSheet) return !0;
|
|
2385
2385
|
const V = L[D];
|
|
2386
|
-
return V != null ? !V : !
|
|
2387
|
-
},
|
|
2386
|
+
return V != null ? !V : !g || !f(D) ? !0 : D === (g === "female" ? p.vcFemale : p.vcMale).toUpperCase();
|
|
2387
|
+
}, b = !!r && r !== n;
|
|
2388
2388
|
return /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
2389
|
-
|
|
2389
|
+
M && /* @__PURE__ */ h("div", { style: { display: "flex", alignItems: "flex-start", gap: 9, padding: "10px 11px", marginBottom: 10, borderRadius: 11, background: "var(--conf-low-soft)" }, children: [
|
|
2390
2390
|
/* @__PURE__ */ i(oe, { d: X.warnTri, size: 15, sw: 1.7, style: { flex: "none", marginTop: 1, color: "var(--conf-low)" } }),
|
|
2391
|
-
/* @__PURE__ */ i("span", { style: { flex: 1, minWidth: 0, fontSize: 12.5, fontWeight: 300, lineHeight: 1.45, color: "var(--ink-80)", textWrap: "pretty" }, children:
|
|
2392
|
-
/* @__PURE__ */ i("span", { style: { flex: "none", marginTop: -1 }, children: /* @__PURE__ */ i(za, { value:
|
|
2391
|
+
/* @__PURE__ */ i("span", { style: { flex: 1, minWidth: 0, fontSize: 12.5, fontWeight: 300, lineHeight: 1.45, color: "var(--ink-80)", textWrap: "pretty" }, children: M }),
|
|
2392
|
+
/* @__PURE__ */ i("span", { style: { flex: "none", marginTop: -1 }, children: /* @__PURE__ */ i(za, { value: M, label: "Copy this error" }) })
|
|
2393
2393
|
] }),
|
|
2394
2394
|
t,
|
|
2395
2395
|
N && /* @__PURE__ */ h(xe, { children: [
|
|
@@ -2462,7 +2462,7 @@ function ll({ cast: t, voices: e, currentId: n, armedId: r = null, sampleId: s =
|
|
|
2462
2462
|
)
|
|
2463
2463
|
] }, D.id);
|
|
2464
2464
|
}),
|
|
2465
|
-
|
|
2465
|
+
b && /* @__PURE__ */ i("div", { style: { position: "sticky", bottom: 0, zIndex: 3, marginTop: 6, padding: "11px 0 3px", animation: "vs-slide-up .18s ease-out" }, children: /* @__PURE__ */ i("button", { type: "button", className: "vcuse", title: "Apply this voice", onClick: () => r && c(r), children: /* @__PURE__ */ i("span", { children: p.vcUse }) }) })
|
|
2466
2466
|
] });
|
|
2467
2467
|
}
|
|
2468
2468
|
function cl({ height: t, width: e = 2 }) {
|
|
@@ -2503,7 +2503,7 @@ function Ml({ recordingId: t, lang: e, ended: n, cred: r, pickedVoice: s, senten
|
|
|
2503
2503
|
}, [t, e, o, n]), u = Ie(
|
|
2504
2504
|
() => l && l.lang === e && l.recordingId === t ? l.rows : [],
|
|
2505
2505
|
[l, e, t]
|
|
2506
|
-
), d = Ie(() => di(u, s), [u, s]),
|
|
2506
|
+
), d = Ie(() => di(u, s), [u, s]), g = d ? d.voiceKey || null : s, [M, N] = z(null), [p, y] = z(null), L = v(/* @__PURE__ */ new Set()), m = `${t ?? ""}|${e ?? ""}|${g ?? ""}`, f = Ke(async (K, k) => {
|
|
2507
2507
|
if (!t || !e || !n) return;
|
|
2508
2508
|
const ae = k != null && k.size ? null : Fs(K), te = k != null && k.size ? k : ae, G = te && te.size ? Object.fromEntries([...te].map(([Te, je]) => [String(Te), je])) : null, J = `${t}|${e}|${G ? JSON.stringify(G) : K ?? ""}`;
|
|
2509
2509
|
if (L.current.has(J)) return;
|
|
@@ -2522,19 +2522,19 @@ function Ml({ recordingId: t, lang: e, ended: n, cred: r, pickedVoice: s, senten
|
|
|
2522
2522
|
const K = `${t ?? ""}|${e ?? ""}|`;
|
|
2523
2523
|
for (const k of [...L.current]) k.startsWith(K) && L.current.delete(k);
|
|
2524
2524
|
y(null);
|
|
2525
|
-
}, [t, e]),
|
|
2525
|
+
}, [t, e]), b = !!d && (d.state === "queued" || d.state === "running") || M === m, D = (d == null ? void 0 : d.state) === "failed" ? d.error || "the render failed" : p, V = (a == null ? void 0 : a.join(",")) ?? "", [_, ee] = z(null), j = Ie(() => new Set((d == null ? void 0 : d.clips) ?? []), [d]), E = Ie(() => n && V ? V.split(",").map(Number).filter((K) => !j.has(K)) : [], [n, V, j]), Q = v(null);
|
|
2526
2526
|
U(() => {
|
|
2527
2527
|
if (!n || !t || !e || !E.length) return;
|
|
2528
|
-
const K = _ ?? E[0], k = E.find((pe) => pe >= K) ?? E[0], ae = `${t}|${e}|${
|
|
2528
|
+
const K = _ ?? E[0], k = E.find((pe) => pe >= K) ?? E[0], ae = `${t}|${e}|${g ?? ""}`, te = Q.current;
|
|
2529
2529
|
if (te && te.key === ae && Math.abs(te.near - k) < 12 && Date.now() - te.at < 6e4) return;
|
|
2530
2530
|
Q.current = { key: ae, near: k, at: Date.now() };
|
|
2531
|
-
const G = Fs(
|
|
2532
|
-
G && G.size ? J.voiceBySpeaker = Object.fromEntries([...G].map(([pe, le]) => [String(pe), le])) :
|
|
2531
|
+
const G = Fs(g), J = { langs: [e], near: k };
|
|
2532
|
+
G && G.size ? J.voiceBySpeaker = Object.fromEntries([...G].map(([pe, le]) => [String(pe), le])) : g && (J.voice = g), Bs(o, `/v1/recordings/${t}/voice`, { method: "POST", body: J }).then((pe) => {
|
|
2533
2533
|
pe.ok || (Q.current = null);
|
|
2534
2534
|
}).catch(() => {
|
|
2535
2535
|
Q.current = null;
|
|
2536
2536
|
});
|
|
2537
|
-
}, [n, t, e,
|
|
2537
|
+
}, [n, t, e, g, _, E, o]);
|
|
2538
2538
|
const T = E.length > 0, O = v({ n: -1, at: 0 });
|
|
2539
2539
|
U(() => {
|
|
2540
2540
|
if (!T) return;
|
|
@@ -2549,13 +2549,13 @@ function Ml({ recordingId: t, lang: e, ended: n, cred: r, pickedVoice: s, senten
|
|
|
2549
2549
|
const K = V ? V.split(",").map(Number).filter((ae) => !n || j.has(ae)) : void 0, k = d ?? (K != null && K.length && e ? { lang: e, voiceKey: s ?? "", clips: [], voice: null } : null);
|
|
2550
2550
|
return Ya(k, t, o.origin, r, K);
|
|
2551
2551
|
}, [d, t, o, r, V, e, s, n, j]), re = Ie(() => new Set(E), [E]);
|
|
2552
|
-
return { listed: l, rows: u, track: d, renderVoiceId:
|
|
2552
|
+
return { listed: l, rows: u, track: d, renderVoiceId: g, rendering: b, failed: D, clips: S, requestRender: f, forget: I, reload: c, setNear: ee, missing: E.length, coming: re };
|
|
2553
2553
|
}
|
|
2554
2554
|
const gl = { share: X.share, delay: X.tabGauge, video: X.video, source: X.tabSources, script: X.tabScript, fix: X.tabFix, ending: X.tabEnding, summary: X.tabSummary, export: X.tabExport, settings: X.tabSettings, sources: X.tabSources, recs: X.mic };
|
|
2555
2555
|
function Ci({ tabs: t, current: e, onPick: n, gap: r, fold: s = !0, side: a = !s }) {
|
|
2556
|
-
const o = s && t.length <= 3, l = t.some((L) => L.key === e), [c, u] = z(null), d = v(null), [
|
|
2556
|
+
const o = s && t.length <= 3, l = t.some((L) => L.key === e), [c, u] = z(null), d = v(null), [g, M] = z(0);
|
|
2557
2557
|
U(() => {
|
|
2558
|
-
d.current &&
|
|
2558
|
+
d.current && M(d.current.offsetWidth);
|
|
2559
2559
|
}, [c == null ? void 0 : c.k]);
|
|
2560
2560
|
const N = (L, m) => {
|
|
2561
2561
|
const f = L.currentTarget.querySelector(".tabbar__label");
|
|
@@ -2564,12 +2564,12 @@ function Ci({ tabs: t, current: e, onPick: n, gap: r, fold: s = !0, side: a = !s
|
|
|
2564
2564
|
return;
|
|
2565
2565
|
}
|
|
2566
2566
|
if ((c == null ? void 0 : c.k) === m.key) return;
|
|
2567
|
-
const I = L.currentTarget.getBoundingClientRect(),
|
|
2568
|
-
u({ k: m.key, label: m.label, x: I.left + I.width / 2, y:
|
|
2567
|
+
const I = L.currentTarget.getBoundingClientRect(), b = L.currentTarget.parentElement.getBoundingClientRect();
|
|
2568
|
+
u({ k: m.key, label: m.label, x: I.left + I.width / 2, y: b.top });
|
|
2569
2569
|
}, p = () => u(null);
|
|
2570
2570
|
let y = null;
|
|
2571
2571
|
if (c) {
|
|
2572
|
-
const L = { l: 0, r: typeof window < "u" ? window.innerWidth : 0 }, m =
|
|
2572
|
+
const L = { l: 0, r: typeof window < "u" ? window.innerWidth : 0 }, m = g || 80, f = Math.max(L.l + 8, Math.min(L.r - m - 8, c.x - m / 2));
|
|
2573
2573
|
y = Na(
|
|
2574
2574
|
/* @__PURE__ */ i("div", { className: "vsp vsp-portal", "data-theme": "dark", children: /* @__PURE__ */ h("div", { ref: d, "data-theme": "dark", className: "vs-tip__bubble vs-tip__bubble--top tabtip", style: { position: "fixed", left: f, top: c.y - 8, bottom: "auto", width: "auto", whiteSpace: "nowrap", transform: "translateY(-100%)", zIndex: 2147483e3, pointerEvents: "none" }, children: [
|
|
2575
2575
|
/* @__PURE__ */ i("span", { className: "vs-tip__row", children: /* @__PURE__ */ i("span", { className: "vs-tip__copy", children: c.label }) }),
|
|
@@ -2580,15 +2580,15 @@ function Ci({ tabs: t, current: e, onPick: n, gap: r, fold: s = !0, side: a = !s
|
|
|
2580
2580
|
}
|
|
2581
2581
|
return /* @__PURE__ */ h("div", { role: "tablist", className: `tabbar tabbar--icons${s ? "" : " tabbar--desk"}`, "data-desk-tabs": a ? "" : void 0, "data-tab-n": a ? t.length : void 0, style: { marginBottom: r ? 12 : 0 }, onMouseLeave: p, children: [
|
|
2582
2582
|
t.map((L) => {
|
|
2583
|
-
const m = e === L.key, f = o || m, I = o ? "1 1 0" : m ? "1 1 auto" : s && !l ? "1 1 0" : "0 0 auto",
|
|
2583
|
+
const m = e === L.key, f = o || m, I = o ? "1 1 0" : m ? "1 1 auto" : s && !l ? "1 1 0" : "0 0 auto", b = L.icon ?? gl[L.key], D = () => {
|
|
2584
2584
|
p(), n(s && m ? "none" : L.key);
|
|
2585
2585
|
};
|
|
2586
2586
|
return s ? /* @__PURE__ */ h("button", { type: "button", role: "tab", "aria-selected": m, title: L.label, className: `tabbar__tab${m ? " is-on" : ""}`, style: { flex: I }, onClick: D, children: [
|
|
2587
|
-
|
|
2587
|
+
b && /* @__PURE__ */ i(oe, { d: b, size: 15, sw: L.sw ?? 2, style: { flex: "none" } }),
|
|
2588
2588
|
f && /* @__PURE__ */ i("span", { className: "tabbar__label", children: L.label })
|
|
2589
2589
|
] }, L.key) : /* @__PURE__ */ i("div", { className: "tabbar__slot", "data-tab-cell": "", style: { flex: I }, onMouseEnter: (V) => N(V, L), onMouseMove: (V) => N(V, L), onClick: D, children: /* @__PURE__ */ h("button", { type: "button", role: "tab", "aria-selected": m, "aria-label": L.label, className: `tabbar__tab${m ? " is-on" : ""}${(c == null ? void 0 : c.k) === L.key ? " is-tip" : ""}`, children: [
|
|
2590
|
-
|
|
2591
|
-
/* @__PURE__ */ i("span", { className: "tabbar__grow", "data-tab-lw": "", style: { gridTemplateColumns: f ? "1fr" : "0fr", marginLeft: f &&
|
|
2590
|
+
b && /* @__PURE__ */ i(oe, { d: b, size: 15, sw: L.sw ?? 2, className: "tabbar__icon", style: { flex: "none", transform: m && !o ? "scale(1.12)" : "none" } }),
|
|
2591
|
+
/* @__PURE__ */ i("span", { className: "tabbar__grow", "data-tab-lw": "", style: { gridTemplateColumns: f ? "1fr" : "0fr", marginLeft: f && b ? 6 : 0 }, children: /* @__PURE__ */ i("span", { className: "tabbar__label", "data-tab-l": "", style: { opacity: f ? 1 : 0, transform: f ? "none" : "translateX(-6px)" }, children: L.label }) })
|
|
2592
2592
|
] }) }, L.key);
|
|
2593
2593
|
}),
|
|
2594
2594
|
y
|
|
@@ -2602,14 +2602,14 @@ function Nl({ audio: t, video: e, formats: n, onExport: r }) {
|
|
|
2602
2602
|
}), []);
|
|
2603
2603
|
const d = (p) => {
|
|
2604
2604
|
window.clearTimeout(c.current), a(p), c.current = window.setTimeout(() => a(null), 1600);
|
|
2605
|
-
},
|
|
2605
|
+
}, g = (p) => {
|
|
2606
2606
|
o || (l(p), Promise.resolve().then(() => r(p)).then(() => {
|
|
2607
2607
|
u.current && d(p);
|
|
2608
2608
|
}).catch(() => {
|
|
2609
2609
|
}).finally(() => {
|
|
2610
2610
|
u.current && l(null);
|
|
2611
2611
|
}));
|
|
2612
|
-
},
|
|
2612
|
+
}, M = (p, y) => {
|
|
2613
2613
|
o || (l(p), Promise.resolve().then(() => y.onClick()).then(() => {
|
|
2614
2614
|
u.current && d(p);
|
|
2615
2615
|
}).catch(() => {
|
|
@@ -2618,7 +2618,7 @@ function Nl({ audio: t, video: e, formats: n, onExport: r }) {
|
|
|
2618
2618
|
}));
|
|
2619
2619
|
}, N = (p, y, L, m) => /* @__PURE__ */ h(xe, { children: [
|
|
2620
2620
|
/* @__PURE__ */ i(gr, { style: { letterSpacing: ".12em", color: "var(--ink-35)" }, children: m }),
|
|
2621
|
-
/* @__PURE__ */ h("button", { type: "button", className: "dlrow", disabled: o != null, "aria-busy": o === p || void 0, onClick: () =>
|
|
2621
|
+
/* @__PURE__ */ h("button", { type: "button", className: "dlrow", disabled: o != null, "aria-busy": o === p || void 0, onClick: () => M(p, y), style: o && o !== p ? { opacity: 0.45 } : void 0, children: [
|
|
2622
2622
|
o === p ? /* @__PURE__ */ i(at, { size: 17, color: "var(--brand)", track: "var(--fill-12)" }) : /* @__PURE__ */ i(oe, { d: L, size: 17, sw: 1.5, style: { flex: "none", color: "var(--ink-70)" } }),
|
|
2623
2623
|
/* @__PURE__ */ h("span", { style: { flex: 1, minWidth: 0, display: "flex", flexDirection: "column", gap: 1, textAlign: "left" }, children: [
|
|
2624
2624
|
/* @__PURE__ */ i("span", { style: { fontSize: 13, fontWeight: 500, color: "var(--ink-96)", whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }, children: y.name }),
|
|
@@ -2632,7 +2632,7 @@ function Nl({ audio: t, video: e, formats: n, onExport: r }) {
|
|
|
2632
2632
|
e && N("video", e, X.video, "DOWNLOAD VIDEO"),
|
|
2633
2633
|
n !== !1 && /* @__PURE__ */ h(xe, { children: [
|
|
2634
2634
|
/* @__PURE__ */ i(gr, { style: { letterSpacing: ".12em", color: "var(--ink-35)" }, children: "EXPORT AS" }),
|
|
2635
|
-
/* @__PURE__ */ i("div", { className: "fmtgrid", children: Tr.map((p) => /* @__PURE__ */ h("button", { type: "button", className: "fmtgrid__cell", title: o === p.key ? `Building the ${p.name}…` : p.note, disabled: o != null, "aria-busy": o === p.key || void 0, onClick: () =>
|
|
2635
|
+
/* @__PURE__ */ i("div", { className: "fmtgrid", children: Tr.map((p) => /* @__PURE__ */ h("button", { type: "button", className: "fmtgrid__cell", title: o === p.key ? `Building the ${p.name}…` : p.note, disabled: o != null, "aria-busy": o === p.key || void 0, onClick: () => g(p.key), style: o && o !== p.key ? { opacity: 0.45 } : void 0, children: [
|
|
2636
2636
|
o === p.key ? /* @__PURE__ */ i(at, { size: 16, color: "var(--brand)", track: "var(--fill-12)" }) : /* @__PURE__ */ i(oe, { d: s === p.key ? X.check : p.icon, size: 16, sw: 1.6, style: { color: s === p.key ? "var(--brand)" : "var(--ink-62)" } }),
|
|
2637
2637
|
/* @__PURE__ */ i("span", { children: p.name })
|
|
2638
2638
|
] }, p.key)) })
|
|
@@ -2719,13 +2719,13 @@ function Ll(t = !0, e) {
|
|
|
2719
2719
|
const s = r.current;
|
|
2720
2720
|
if (!s || !t) return;
|
|
2721
2721
|
let a = 0, o = 0, l = !1;
|
|
2722
|
-
const c = (
|
|
2723
|
-
|
|
2724
|
-
}, u = (
|
|
2722
|
+
const c = (g) => {
|
|
2723
|
+
g.button !== 0 || g.target.closest("button,a,input,textarea,select") || (l = !0, a = g.clientY, o = s.scrollTop, s.classList.add("is-dragging"));
|
|
2724
|
+
}, u = (g) => {
|
|
2725
2725
|
var N;
|
|
2726
2726
|
if (!l) return;
|
|
2727
|
-
const
|
|
2728
|
-
Math.abs(
|
|
2727
|
+
const M = g.clientY - a;
|
|
2728
|
+
Math.abs(M) > 2 && ((N = s.setPointerCapture) == null || N.call(s, g.pointerId)), s.scrollTop = o - M;
|
|
2729
2729
|
}, d = () => {
|
|
2730
2730
|
l = !1, s.classList.remove("is-dragging");
|
|
2731
2731
|
};
|
|
@@ -2745,34 +2745,34 @@ function kl(t, e) {
|
|
|
2745
2745
|
(e.forcePin ?? []).forEach((f) => {
|
|
2746
2746
|
l = l.filter((I) => I !== `!${f}`), s.includes(f) && !l.includes(f) && (l = [f, ...l]);
|
|
2747
2747
|
});
|
|
2748
|
-
const u = (f) => (e.forcePin ?? []).includes(f) && !c.includes(f), d = a ? l.filter((f) => s.includes(f) && o.includes(f)) : [],
|
|
2749
|
-
const I =
|
|
2750
|
-
return I[
|
|
2748
|
+
const u = (f) => (e.forcePin ?? []).includes(f) && !c.includes(f), d = a ? l.filter((f) => s.includes(f) && o.includes(f)) : [], g = s.filter((f) => !d.includes(f)), M = e.cur && e.cur !== "none" && g.includes(e.cur) ? e.cur : e.pref && g.includes(e.pref) ? e.pref : g[0] ?? null, N = (f) => {
|
|
2749
|
+
const I = g.filter((b) => b !== f);
|
|
2750
|
+
return I[g.indexOf(f)] ?? I[I.length - 1] ?? null;
|
|
2751
2751
|
}, p = (f, I) => {
|
|
2752
2752
|
if (!o.includes(f)) return;
|
|
2753
|
-
const
|
|
2754
|
-
if (
|
|
2753
|
+
const b = d.filter((D) => D !== f);
|
|
2754
|
+
if (b.splice(I ?? b.length, 0, f), M === f) {
|
|
2755
2755
|
const D = N(f);
|
|
2756
2756
|
D && e.onPick(D);
|
|
2757
2757
|
}
|
|
2758
|
-
r([...
|
|
2758
|
+
r([...b.filter((D) => !u(D) || D === f), ...c.filter((D) => !b.includes(D) && D !== `!${f}`)]);
|
|
2759
2759
|
}, y = (f) => {
|
|
2760
2760
|
r([...c.filter((I) => I !== f && I !== `!${f}`), ...(e.autoPin ?? []).includes(f) ? [`!${f}`] : []]), e.onPick(f);
|
|
2761
2761
|
}, L = (f) => {
|
|
2762
2762
|
var I;
|
|
2763
|
-
return ((I = e.tabs.find((
|
|
2763
|
+
return ((I = e.tabs.find((b) => b.key === f)) == null ? void 0 : I.label) ?? f;
|
|
2764
2764
|
}, m = (f) => {
|
|
2765
|
-
const I = d.includes(f),
|
|
2765
|
+
const I = d.includes(f), b = s.includes(f);
|
|
2766
2766
|
return {
|
|
2767
|
-
show:
|
|
2767
|
+
show: b && (!a || I || M === f),
|
|
2768
2768
|
pinned: I,
|
|
2769
2769
|
order: I ? d.indexOf(f) + 1 : 1e3,
|
|
2770
|
-
pill: a &&
|
|
2770
|
+
pill: a && b && o.includes(f) && g.length > 0 && (I || g.length > 1),
|
|
2771
2771
|
title: I ? `Unpin — return ${L(f)} to the tabs` : `Pin ${L(f)} open above the tabs`,
|
|
2772
2772
|
toggle: () => I ? y(f) : p(f)
|
|
2773
2773
|
};
|
|
2774
2774
|
};
|
|
2775
|
-
return { id: t, tabbed: a &&
|
|
2775
|
+
return { id: t, tabbed: a && g.length > 1, cur: M, seq: d, pinnable: o, tabKeys: g, stripTabs: e.tabs.filter((f) => g.includes(f.key)), panel: m, pin: p, unpin: y };
|
|
2776
2776
|
}
|
|
2777
2777
|
function jl({ col: t, order: e, render: n, grip: r, onPick: s, wrapClass: a }) {
|
|
2778
2778
|
return zl(t), /* @__PURE__ */ h(xe, { children: [
|
|
@@ -2808,12 +2808,12 @@ function zl(t) {
|
|
|
2808
2808
|
const E = document.createElement("div");
|
|
2809
2809
|
E.style.cssText = "width:100%;height:100%;background:#000", j.replaceWith(E);
|
|
2810
2810
|
}), I.removeAttribute("data-panel-key"), I.querySelectorAll("[data-panel-key],[data-pin-pill]").forEach((j) => j.hasAttribute("data-pin-pill") ? j.remove() : j.removeAttribute("data-panel-key")), Object.assign(I.style, { position: "fixed", left: `${f.left}px`, top: `${f.top}px`, width: `${f.width}px`, height: `${f.height}px`, margin: "0", zIndex: "1000", pointerEvents: "none", opacity: ".95", borderRadius: "14px", boxShadow: "0 14px 36px rgba(0,0,0,.3)", animation: "none", transition: "none", cursor: "move", willChange: "transform", contain: "layout paint", overflow: "hidden" });
|
|
2811
|
-
const
|
|
2812
|
-
for (let j = 0; j <
|
|
2813
|
-
const E =
|
|
2814
|
-
E.startsWith("--") && I.style.setProperty(E,
|
|
2811
|
+
const b = getComputedStyle(m.el);
|
|
2812
|
+
for (let j = 0; j < b.length; j++) {
|
|
2813
|
+
const E = b[j];
|
|
2814
|
+
E.startsWith("--") && I.style.setProperty(E, b.getPropertyValue(E));
|
|
2815
2815
|
}
|
|
2816
|
-
I.style.fontFamily =
|
|
2816
|
+
I.style.fontFamily = b.fontFamily, I.style.color = b.color;
|
|
2817
2817
|
let D = m.el.parentElement, V = "";
|
|
2818
2818
|
for (; D && !V; ) {
|
|
2819
2819
|
const j = getComputedStyle(D).backgroundColor;
|
|
@@ -2828,7 +2828,7 @@ function zl(t) {
|
|
|
2828
2828
|
const m = s;
|
|
2829
2829
|
if (!m || !m.on || m.px == null || m.py == null) return;
|
|
2830
2830
|
m.raf = 0, m.clone.style.transform = `translate3d(${m.px - m.x0}px,${m.py - m.y0}px,0)`;
|
|
2831
|
-
const f = e.current, I = m.key,
|
|
2831
|
+
const f = e.current, I = m.key, b = o(m), D = f.seq.includes(I), V = D || f.tabKeys.length > 1, _ = b && m.tabsSnap, ee = !_ || m.py < _.top + _.height / 2 ? V ? "pin" : null : "tabs";
|
|
2832
2832
|
let j = null;
|
|
2833
2833
|
if (ee === "pin") {
|
|
2834
2834
|
const Q = f.seq.filter((O) => O !== I).map((O) => m.snap[O]).filter(Boolean), T = m.grid ? Q.filter((O) => O.bottom < m.py || O.top <= m.py && O.left + O.width / 2 < m.px).length : Q.filter((O) => O.top + O.height / 2 < m.py).length;
|
|
@@ -2845,21 +2845,21 @@ function zl(t) {
|
|
|
2845
2845
|
S && (S.style.order = String(O + 1));
|
|
2846
2846
|
});
|
|
2847
2847
|
} else (j == null ? void 0 : j.zone) === "tabs" && (m.el.style.order = "998");
|
|
2848
|
-
|
|
2848
|
+
b && ((j == null ? void 0 : j.zone) === "tabs" ? b.setAttribute("data-drop-hot", "") : b.removeAttribute("data-drop-hot"));
|
|
2849
2849
|
}
|
|
2850
2850
|
}, u = (m) => {
|
|
2851
2851
|
var I;
|
|
2852
2852
|
const f = s;
|
|
2853
|
-
if (s = null, !(!f || !f.on) && (f.raf && cancelAnimationFrame(f.raf), f.clone.remove(), f.orig.forEach(([
|
|
2854
|
-
|
|
2853
|
+
if (s = null, !(!f || !f.on) && (f.raf && cancelAnimationFrame(f.raf), f.clone.remove(), f.orig.forEach(([b, D]) => {
|
|
2854
|
+
b.style.order = D;
|
|
2855
2855
|
}), f.el.classList.remove("is-dragging"), document.documentElement.style.cursor = "", document.body.style.userSelect = "", document.body.style.webkitUserSelect = "", (I = o(f)) == null || I.removeAttribute("data-drop-hot"), m && f.target)) {
|
|
2856
|
-
const
|
|
2857
|
-
f.target.zone === "tabs" ?
|
|
2856
|
+
const b = e.current;
|
|
2857
|
+
f.target.zone === "tabs" ? b.seq.includes(f.key) && b.unpin(f.key) : b.pin(f.key, f.target.idx);
|
|
2858
2858
|
}
|
|
2859
2859
|
}, d = (m) => {
|
|
2860
2860
|
const f = m instanceof Element ? m.closest("[data-tab-col]") : null;
|
|
2861
2861
|
return f && f.getAttribute("data-tab-col") === n ? f : null;
|
|
2862
|
-
},
|
|
2862
|
+
}, g = (m) => {
|
|
2863
2863
|
var _;
|
|
2864
2864
|
if (s) {
|
|
2865
2865
|
if (!s.on) {
|
|
@@ -2874,11 +2874,11 @@ function zl(t) {
|
|
|
2874
2874
|
r && ((_ = r.closest("[data-tab-col]")) == null ? void 0 : _.getAttribute("data-tab-col")) === n && a(null);
|
|
2875
2875
|
return;
|
|
2876
2876
|
}
|
|
2877
|
-
const I = f.closest("[data-panel-key]"),
|
|
2878
|
-
if (!I || !
|
|
2879
|
-
const D =
|
|
2877
|
+
const I = f.closest("[data-panel-key]"), b = I == null ? void 0 : I.firstElementChild;
|
|
2878
|
+
if (!I || !b || !e.current.tabbed || !e.current.pinnable.includes(I.getAttribute("data-panel-key")) || f.closest("[role=button],[role=tab],button,a,input,textarea,select,iframe,[data-pin-pill],[contenteditable=true]")) return a(null);
|
|
2879
|
+
const D = b.getBoundingClientRect(), V = parseFloat(getComputedStyle(I).getPropertyValue("--grip-h")) || 30;
|
|
2880
2880
|
a(m.clientY >= D.top && m.clientY <= D.top + V ? I : null);
|
|
2881
|
-
},
|
|
2881
|
+
}, M = (m) => {
|
|
2882
2882
|
if (!r || m.button !== 0) return;
|
|
2883
2883
|
const f = d(r);
|
|
2884
2884
|
f && (m.preventDefault(), m.stopImmediatePropagation(), s = { el: r, col: f, key: r.getAttribute("data-panel-key"), x0: m.clientX, y0: m.clientY, on: !1 });
|
|
@@ -2887,8 +2887,8 @@ function zl(t) {
|
|
|
2887
2887
|
}, L = () => {
|
|
2888
2888
|
s || a(null);
|
|
2889
2889
|
};
|
|
2890
|
-
return document.addEventListener("pointermove",
|
|
2891
|
-
u(!1), a(null), document.removeEventListener("pointermove",
|
|
2890
|
+
return document.addEventListener("pointermove", g, !0), document.addEventListener("pointerdown", M, !0), window.addEventListener("pointerup", N), window.addEventListener("pointercancel", p), window.addEventListener("keydown", y, !0), document.addEventListener("pointerleave", L), () => {
|
|
2891
|
+
u(!1), a(null), document.removeEventListener("pointermove", g, !0), document.removeEventListener("pointerdown", M, !0), window.removeEventListener("pointerup", N), window.removeEventListener("pointercancel", p), window.removeEventListener("keydown", y, !0), document.removeEventListener("pointerleave", L);
|
|
2892
2892
|
};
|
|
2893
2893
|
}, [n]);
|
|
2894
2894
|
}
|
|
@@ -2897,25 +2897,25 @@ function Il({ id: t, className: e, gap: n, hidden: r, plain: s, children: a }) {
|
|
|
2897
2897
|
Ol(u), U(() => {
|
|
2898
2898
|
document.documentElement.style.setProperty("--colw", `${o}px`);
|
|
2899
2899
|
}, [o]);
|
|
2900
|
-
const d = (
|
|
2900
|
+
const d = (M) => {
|
|
2901
2901
|
const N = c.current, p = N == null ? void 0 : N.parentElement;
|
|
2902
|
-
if (
|
|
2903
|
-
|
|
2904
|
-
const y =
|
|
2902
|
+
if (M.button !== 0 || !N || !p) return;
|
|
2903
|
+
M.preventDefault();
|
|
2904
|
+
const y = M.currentTarget, L = getComputedStyle(p), m = p.clientWidth - parseFloat(L.paddingLeft) - parseFloat(L.paddingRight) - (parseFloat(L.columnGap) || 0), f = 320, I = 320, b = Math.max(f, m - I), D = M.clientX, V = N.getBoundingClientRect().width;
|
|
2905
2905
|
let _ = V;
|
|
2906
2906
|
y.classList.add("is-on");
|
|
2907
2907
|
const ee = { cur: document.body.style.cursor, sel: document.body.style.userSelect };
|
|
2908
2908
|
document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
2909
2909
|
const j = (Q) => {
|
|
2910
|
-
_ = Math.round(Math.min(
|
|
2910
|
+
_ = Math.round(Math.min(b, Math.max(f, V + (D - Q.clientX)))), N.style.flexBasis = `${_}px`, document.documentElement.style.setProperty("--colw", `${_}px`);
|
|
2911
2911
|
}, E = () => {
|
|
2912
2912
|
window.removeEventListener("pointermove", j), window.removeEventListener("pointerup", E), window.removeEventListener("pointercancel", E), document.body.style.cursor = ee.cur, document.body.style.userSelect = ee.sel, y.classList.remove("is-on"), l(_);
|
|
2913
2913
|
};
|
|
2914
2914
|
window.addEventListener("pointermove", j), window.addEventListener("pointerup", E), window.addEventListener("pointercancel", E);
|
|
2915
|
-
},
|
|
2915
|
+
}, g = r ? { display: "none" } : void 0;
|
|
2916
2916
|
return /* @__PURE__ */ h(xe, { children: [
|
|
2917
|
-
/* @__PURE__ */ i("div", { "aria-hidden": "true", className: "colgrip", style: { marginRight: -n, ...
|
|
2918
|
-
/* @__PURE__ */ i("div", { ref: c, "data-tab-col": t, className: `${e} sidecol`, style: { flex: `0 0 ${o}px`, ...
|
|
2917
|
+
/* @__PURE__ */ i("div", { "aria-hidden": "true", className: "colgrip", style: { marginRight: -n, ...g }, children: /* @__PURE__ */ i("div", { className: "colgrip__bar", style: { left: -(n / 2 + 6) }, title: "Drag to resize · double-click to reset", onPointerDown: d, onDoubleClick: () => l(null) }) }),
|
|
2918
|
+
/* @__PURE__ */ i("div", { ref: c, "data-tab-col": t, className: `${e} sidecol`, style: { flex: `0 0 ${o}px`, ...g }, children: s ? a : /* @__PURE__ */ i("div", { ref: u, "data-panel-grid": "", className: "panelgrid", children: a }) })
|
|
2919
2919
|
] });
|
|
2920
2920
|
}
|
|
2921
2921
|
function Ol(t) {
|
|
@@ -2928,13 +2928,13 @@ function Ol(t) {
|
|
|
2928
2928
|
r = 0;
|
|
2929
2929
|
const u = getComputedStyle(e).display === "grid";
|
|
2930
2930
|
[...e.children].forEach((d) => {
|
|
2931
|
-
const
|
|
2931
|
+
const g = d;
|
|
2932
2932
|
if (!u) {
|
|
2933
|
-
|
|
2933
|
+
g.style.gridRowEnd && (g.style.gridRowEnd = "");
|
|
2934
2934
|
return;
|
|
2935
2935
|
}
|
|
2936
|
-
const
|
|
2937
|
-
|
|
2936
|
+
const M = g.getBoundingClientRect().height, N = M > 0 ? `span ${Math.ceil(M + n)}` : "span 1";
|
|
2937
|
+
g.style.gridRowEnd !== N && (g.style.gridRowEnd = N);
|
|
2938
2938
|
});
|
|
2939
2939
|
}, a = () => {
|
|
2940
2940
|
r || (r = requestAnimationFrame(s));
|
|
@@ -2951,8 +2951,8 @@ function Cl(t) {
|
|
|
2951
2951
|
}
|
|
2952
2952
|
const bl = 1500, xl = 3e5;
|
|
2953
2953
|
function Dl(t) {
|
|
2954
|
-
const e = Et(), [n, r] = z(null), [s, a] = z(null), [o, l] = z(null), [c, u] = z(null), d = v(null),
|
|
2955
|
-
|
|
2954
|
+
const e = Et(), [n, r] = z(null), [s, a] = z(null), [o, l] = z(null), [c, u] = z(null), d = v(null), g = v(null), M = v(null), N = v(0), p = Ke(() => {
|
|
2955
|
+
M.current && (clearTimeout(M.current), M.current = null), d.current && (d.current.pause(), d.current.removeAttribute("src"), d.current.load(), d.current = null), g.current && (URL.revokeObjectURL(g.current), g.current = null);
|
|
2956
2956
|
}, []), y = Ke(() => {
|
|
2957
2957
|
N.current += 1, p(), a(null), l(null);
|
|
2958
2958
|
}, [p]), L = Ke(() => {
|
|
@@ -2965,16 +2965,16 @@ function Dl(t) {
|
|
|
2965
2965
|
N.current += 1;
|
|
2966
2966
|
const I = N.current;
|
|
2967
2967
|
if (p(), r(f.id), a(null), l(null), u(null), !t) return;
|
|
2968
|
-
let
|
|
2969
|
-
xn() === "caf" && (
|
|
2968
|
+
let b = f.previewUrl ? `${e.origin}${f.previewUrl}` : `${e.origin}/v1/voices/preview?voice=${encodeURIComponent(f.id)}&lang=${encodeURIComponent(t)}`;
|
|
2969
|
+
xn() === "caf" && (b += `${b.includes("?") ? "&" : "?"}format=caf`);
|
|
2970
2970
|
const D = Date.now();
|
|
2971
|
-
e.shareCode &&
|
|
2971
|
+
e.shareCode && b.includes("recording=") && (b += `&shareCode=${encodeURIComponent(e.shareCode)}`);
|
|
2972
2972
|
const V = async () => {
|
|
2973
2973
|
if (N.current !== I) return;
|
|
2974
2974
|
let _;
|
|
2975
2975
|
try {
|
|
2976
2976
|
const Q = e.owner ? await e.bearer() : void 0;
|
|
2977
|
-
_ = await fetch(
|
|
2977
|
+
_ = await fetch(b, { headers: Q ? { Authorization: `Bearer ${Q}` } : {} });
|
|
2978
2978
|
} catch (Q) {
|
|
2979
2979
|
if (N.current !== I) return;
|
|
2980
2980
|
l(null), u(Tt(Q));
|
|
@@ -2986,7 +2986,7 @@ function Dl(t) {
|
|
|
2986
2986
|
l(null), u({ message: "This voice is still being fetched. Try it again in a moment." });
|
|
2987
2987
|
return;
|
|
2988
2988
|
}
|
|
2989
|
-
l(f.id),
|
|
2989
|
+
l(f.id), M.current = setTimeout(() => {
|
|
2990
2990
|
V();
|
|
2991
2991
|
}, bl);
|
|
2992
2992
|
return;
|
|
@@ -2999,8 +2999,8 @@ function Dl(t) {
|
|
|
2999
2999
|
}
|
|
3000
3000
|
const ee = await _.blob();
|
|
3001
3001
|
if (N.current !== I) return;
|
|
3002
|
-
l(null),
|
|
3003
|
-
const j = new Audio(
|
|
3002
|
+
l(null), g.current = URL.createObjectURL(ee);
|
|
3003
|
+
const j = new Audio(g.current);
|
|
3004
3004
|
j.playsInline = !0;
|
|
3005
3005
|
const E = () => {
|
|
3006
3006
|
N.current === I && (p(), a(null));
|
|
@@ -3063,17 +3063,17 @@ function At(t, e, n) {
|
|
|
3063
3063
|
const r = (s = t == null ? void 0 : t.words[t.words.length - 1]) == null ? void 0 : s.end;
|
|
3064
3064
|
return r != null && r > e ? r : (t == null ? void 0 : t.end) != null && t.end > e ? t.end : n > e ? n : e + 4;
|
|
3065
3065
|
}
|
|
3066
|
-
function Al({ ytId: t, title: e, t: n, playing: r, seekN: s, onToggle: a, onAd: o, endT: l, onGone: c, onKnown: u, lead: d, onTime:
|
|
3066
|
+
function Al({ ytId: t, title: e, t: n, playing: r, seekN: s, onToggle: a, onAd: o, endT: l, onGone: c, onKnown: u, lead: d, onTime: g, waiting: M = !1 }) {
|
|
3067
3067
|
const N = v(null), [p, y] = z(!1);
|
|
3068
3068
|
U(() => {
|
|
3069
|
-
if (!
|
|
3069
|
+
if (!M) {
|
|
3070
3070
|
y(!1);
|
|
3071
3071
|
return;
|
|
3072
3072
|
}
|
|
3073
3073
|
const F = setTimeout(() => y(!0), 300);
|
|
3074
3074
|
return () => clearTimeout(F);
|
|
3075
|
-
}, [
|
|
3076
|
-
const L = r && !p, m = v(!1), [f, I] = z(!1),
|
|
3075
|
+
}, [M]);
|
|
3076
|
+
const L = r && !p, m = v(!1), [f, I] = z(!1), b = (F, me = []) => {
|
|
3077
3077
|
var Z, ve;
|
|
3078
3078
|
if (!(m.current && (F === "pauseVideo" || F === "seekTo" || F === "setPlaybackRate")))
|
|
3079
3079
|
try {
|
|
@@ -3091,15 +3091,15 @@ function Al({ ytId: t, title: e, t: n, playing: r, seekN: s, onToggle: a, onAd:
|
|
|
3091
3091
|
const F = _.current || ee.current;
|
|
3092
3092
|
if (F !== m.current)
|
|
3093
3093
|
if (m.current = F, I(F), (me = Q.current) == null || me.call(Q, F), F) {
|
|
3094
|
-
if (
|
|
3094
|
+
if (b("playVideo"), E.current) return;
|
|
3095
3095
|
we.current && j.current && (T.current = !0, j.current());
|
|
3096
3096
|
} else T.current && !E.current && (T.current = !1, we.current || (Z = j.current) == null || Z.call(j));
|
|
3097
3097
|
}, S = v(n);
|
|
3098
3098
|
S.current = n;
|
|
3099
|
-
const re = v(
|
|
3100
|
-
re.current =
|
|
3099
|
+
const re = v(g);
|
|
3100
|
+
re.current = g;
|
|
3101
3101
|
const K = v(null), k = v(null), [ae, te] = z(!0), [G, J] = z(!1), pe = () => {
|
|
3102
|
-
|
|
3102
|
+
b("unloadModule", ["captions"]), b("unloadModule", ["cc"]);
|
|
3103
3103
|
}, le = v([]), Te = () => {
|
|
3104
3104
|
pe(), le.current.forEach(clearTimeout), le.current = [400, 1200, 2500, 5e3].map((F) => window.setTimeout(pe, F));
|
|
3105
3105
|
};
|
|
@@ -3110,10 +3110,10 @@ function Al({ ytId: t, title: e, t: n, playing: r, seekN: s, onToggle: a, onAd:
|
|
|
3110
3110
|
(me = (F = N.current) == null ? void 0 : F.contentWindow) == null || me.postMessage(JSON.stringify({ event: "listening", id: "reader" }), "*");
|
|
3111
3111
|
} catch {
|
|
3112
3112
|
}
|
|
3113
|
-
(!E.current || E.current.muted) &&
|
|
3113
|
+
(!E.current || E.current.muted) && b("mute"), J(!0);
|
|
3114
3114
|
};
|
|
3115
|
-
U(() => (d == null || d.bind(
|
|
3116
|
-
!d && G &&
|
|
3115
|
+
U(() => (d == null || d.bind(b), () => d == null ? void 0 : d.bind(null)), [!!d]), U(() => {
|
|
3116
|
+
!d && G && b("mute");
|
|
3117
3117
|
}, [!!d]);
|
|
3118
3118
|
const Ee = v(null), Le = v(l);
|
|
3119
3119
|
Le.current = l;
|
|
@@ -3123,11 +3123,11 @@ function Al({ ytId: t, title: e, t: n, playing: r, seekN: s, onToggle: a, onAd:
|
|
|
3123
3123
|
Pe.current = c;
|
|
3124
3124
|
const Se = v(u);
|
|
3125
3125
|
Se.current = u;
|
|
3126
|
-
const B = v(!1), [W, A] = z(!1),
|
|
3126
|
+
const B = v(!1), [W, A] = z(!1), C = (F) => {
|
|
3127
3127
|
const me = Ee.current;
|
|
3128
3128
|
return !!me && (F < me.start - 1 || F > me.end + 5);
|
|
3129
3129
|
}, H = () => {
|
|
3130
|
-
|
|
3130
|
+
C(S.current) || b("seekTo", [S.current, !0]);
|
|
3131
3131
|
}, ce = () => K.current;
|
|
3132
3132
|
return U(() => {
|
|
3133
3133
|
const F = (me) => {
|
|
@@ -3141,35 +3141,35 @@ function Al({ ytId: t, title: e, t: n, playing: r, seekN: s, onToggle: a, onAd:
|
|
|
3141
3141
|
}
|
|
3142
3142
|
(ge = (Ae = Z == null ? void 0 : Z.info) == null ? void 0 : Ae.videoData) != null && ge.isLive && (V.current = !0);
|
|
3143
3143
|
const ve = (Ye = Z == null ? void 0 : Z.info) == null ? void 0 : Ye.duration;
|
|
3144
|
-
typeof ve == "number" && ve > 0 && !V.current && (D.current == null ? D.current = ve : (_.current = Math.abs(ve - D.current) > 1.5, O())), (Z == null ? void 0 : Z.event) === "onReady" && ((!E.current || E.current.muted) &&
|
|
3144
|
+
typeof ve == "number" && ve > 0 && !V.current && (D.current == null ? D.current = ve : (_.current = Math.abs(ve - D.current) > 1.5, O())), (Z == null ? void 0 : Z.event) === "onReady" && ((!E.current || E.current.muted) && b("mute"), Te(), (Ve = E.current) == null || Ve.onInfo({ ready: !0 })), typeof (($ = Z == null ? void 0 : Z.info) == null ? void 0 : $.playerState) == "number" && (Z.info.playerState !== k.current && (Z.info.playerState === 1 || Z.info.playerState === 2) && Te(), k.current = Z.info.playerState, te(Z.info.playerState !== 1 && Z.info.playerState !== 3), (he = E.current) == null || he.onInfo({ state: Z.info.playerState }));
|
|
3145
3145
|
const ze = (ue = Z == null ? void 0 : Z.info) == null ? void 0 : ue.progressState;
|
|
3146
3146
|
if (ze && typeof ze.seekableStart == "number" && typeof ze.seekableEnd == "number" && ze.seekableEnd > ze.seekableStart) {
|
|
3147
3147
|
const Oe = Ee.current == null;
|
|
3148
|
-
if (Ee.current = { start: ze.seekableStart, end: ze.seekableEnd }, Oe && !we.current && (
|
|
3148
|
+
if (Ee.current = { start: ze.seekableStart, end: ze.seekableEnd }, Oe && !we.current && (b("pauseVideo"), C(S.current) || b("seekTo", [S.current, !0])), !B.current && Le.current != null) {
|
|
3149
3149
|
B.current = !0;
|
|
3150
3150
|
const ye = Le.current < ze.seekableStart - 1;
|
|
3151
3151
|
(ie = Se.current) == null || ie.call(Se, ye), ye && ((fe = Pe.current) == null || fe.call(Pe));
|
|
3152
3152
|
}
|
|
3153
3153
|
}
|
|
3154
|
-
typeof ((Ue = Z == null ? void 0 : Z.info) == null ? void 0 : Ue.currentTime) == "number" && (K.current = Z.info.currentTime, (Y = E.current) == null || Y.onInfo({ t: Z.info.currentTime }), !m.current && k.current === 1 && ((R = re.current) == null || R.call(re, Z.info.currentTime))), ((q = Z == null ? void 0 : Z.info) == null ? void 0 : q.muted) === !1 && !E.current &&
|
|
3154
|
+
typeof ((Ue = Z == null ? void 0 : Z.info) == null ? void 0 : Ue.currentTime) == "number" && (K.current = Z.info.currentTime, (Y = E.current) == null || Y.onInfo({ t: Z.info.currentTime }), !m.current && k.current === 1 && ((R = re.current) == null || R.call(re, Z.info.currentTime))), ((q = Z == null ? void 0 : Z.info) == null ? void 0 : q.muted) === !1 && !E.current && b("mute"), typeof ((ne = Z == null ? void 0 : Z.info) == null ? void 0 : ne.muted) == "boolean" && ((de = E.current) == null || de.onInfo({ muted: Z.info.muted }));
|
|
3155
3155
|
};
|
|
3156
3156
|
return window.addEventListener("message", F), () => window.removeEventListener("message", F);
|
|
3157
3157
|
}, []), U(() => {
|
|
3158
3158
|
if (d) return;
|
|
3159
|
-
const F =
|
|
3160
|
-
F !== W && (A(F), F ?
|
|
3159
|
+
const F = C(n);
|
|
3160
|
+
F !== W && (A(F), F ? b("pauseVideo") : G && (b("seekTo", [n, !0]), L && b("playVideo")));
|
|
3161
3161
|
}), U(() => {
|
|
3162
3162
|
if (!G || W || d) return;
|
|
3163
3163
|
if (!L && Ee.current == null && !_e.current) {
|
|
3164
|
-
_e.current = !0,
|
|
3164
|
+
_e.current = !0, b("seekTo", [S.current, !0]), b("playVideo");
|
|
3165
3165
|
return;
|
|
3166
3166
|
}
|
|
3167
3167
|
const F = ce();
|
|
3168
|
-
L && (F == null || Math.abs(F - S.current) > 1.5) && H(),
|
|
3168
|
+
L && (F == null || Math.abs(F - S.current) > 1.5) && H(), b(L ? "playVideo" : "pauseVideo");
|
|
3169
3169
|
}, [L, G, W]), U(() => {
|
|
3170
3170
|
if (!G || s === 0 || W || d) return;
|
|
3171
3171
|
const F = ce();
|
|
3172
|
-
(F == null || Math.abs(F - S.current) > 0.5) && H(), L ||
|
|
3172
|
+
(F == null || Math.abs(F - S.current) > 0.5) && H(), L || b("pauseVideo");
|
|
3173
3173
|
}, [s, G]), U(() => {
|
|
3174
3174
|
if (!G) return;
|
|
3175
3175
|
let F = null, me = 0;
|
|
@@ -3212,10 +3212,10 @@ function $l(t, e) {
|
|
|
3212
3212
|
const r = v(0), s = v(1), a = Ke((o, l) => {
|
|
3213
3213
|
cancelAnimationFrame(r.current);
|
|
3214
3214
|
const c = s.current, u = performance.now(), d = () => {
|
|
3215
|
-
const
|
|
3216
|
-
s.current = c + (o - c) *
|
|
3217
|
-
for (const
|
|
3218
|
-
|
|
3215
|
+
const g = l > 0 ? Math.min(1, (performance.now() - u) / l) : 1;
|
|
3216
|
+
s.current = c + (o - c) * g;
|
|
3217
|
+
for (const M of n.current) M.setVolume(s.current);
|
|
3218
|
+
g < 1 && (r.current = requestAnimationFrame(d));
|
|
3219
3219
|
};
|
|
3220
3220
|
d();
|
|
3221
3221
|
}, []);
|
|
@@ -3228,14 +3228,14 @@ function $l(t, e) {
|
|
|
3228
3228
|
}
|
|
3229
3229
|
function Bl(t, e, n, r) {
|
|
3230
3230
|
var Se;
|
|
3231
|
-
const s = v(null), a = v(!1), o = v(!1), [l, c] = z(null), [u, d] = z(!0),
|
|
3231
|
+
const s = v(null), a = v(!1), o = v(!1), [l, c] = z(null), [u, d] = z(!0), g = v(!0), M = v(!1), [N, p] = z(0), y = v(0);
|
|
3232
3232
|
y.current = N;
|
|
3233
3233
|
const L = v({ t: 0, at: 0 }), m = v(n);
|
|
3234
3234
|
m.current = n;
|
|
3235
3235
|
const f = v(r);
|
|
3236
3236
|
f.current = r;
|
|
3237
|
-
const [I,
|
|
3238
|
-
D.current = B,
|
|
3237
|
+
const [I, b] = z(!1), D = v(!1), V = (B) => {
|
|
3238
|
+
D.current = B, b(B);
|
|
3239
3239
|
}, _ = (B, W) => {
|
|
3240
3240
|
var A;
|
|
3241
3241
|
return (A = s.current) == null ? void 0 : A.call(s, B, W);
|
|
@@ -3251,16 +3251,16 @@ function Bl(t, e, n, r) {
|
|
|
3251
3251
|
}
|
|
3252
3252
|
}
|
|
3253
3253
|
}), []);
|
|
3254
|
-
Q.muted =
|
|
3254
|
+
Q.muted = g.current || M.current, U(() => {
|
|
3255
3255
|
if (l !== 1) return;
|
|
3256
3256
|
let B = 0;
|
|
3257
3257
|
const W = () => {
|
|
3258
|
-
const A = L.current,
|
|
3259
|
-
if (f.current != null &&
|
|
3260
|
-
V(!0), _("pauseVideo"), p(
|
|
3258
|
+
const A = L.current, C = A.t + Math.min(1.2, (performance.now() - A.at) / 1e3);
|
|
3259
|
+
if (f.current != null && C >= f.current) {
|
|
3260
|
+
V(!0), _("pauseVideo"), p(C);
|
|
3261
3261
|
return;
|
|
3262
3262
|
}
|
|
3263
|
-
|
|
3263
|
+
C > y.current && p(C), B = requestAnimationFrame(W);
|
|
3264
3264
|
};
|
|
3265
3265
|
return B = requestAnimationFrame(W), () => cancelAnimationFrame(B);
|
|
3266
3266
|
}, [l]), U(() => {
|
|
@@ -3308,24 +3308,24 @@ function Bl(t, e, n, r) {
|
|
|
3308
3308
|
const W = t[Math.max(0, Math.min(t.length - 1, B))];
|
|
3309
3309
|
W && k(W.start);
|
|
3310
3310
|
}, je = v(!1), Ee = () => {
|
|
3311
|
-
const B =
|
|
3311
|
+
const B = g.current || M.current;
|
|
3312
3312
|
Q.muted = B, _(B ? "mute" : "unMute");
|
|
3313
3313
|
}, Le = (B) => {
|
|
3314
|
-
|
|
3314
|
+
g.current = B, d(B), Ee();
|
|
3315
3315
|
}, we = (B) => {
|
|
3316
|
-
|
|
3316
|
+
M.current !== !B && (M.current = !B, Ee());
|
|
3317
3317
|
};
|
|
3318
3318
|
return { player: {
|
|
3319
3319
|
autoplay: async () => {
|
|
3320
|
-
const B = (A) => new Promise((
|
|
3321
|
-
for (let H = 0; H <
|
|
3320
|
+
const B = (A) => new Promise((C) => setTimeout(C, A)), W = async (A, C) => {
|
|
3321
|
+
for (let H = 0; H < C / 250 && !A(); H++) await B(250);
|
|
3322
3322
|
return A();
|
|
3323
3323
|
};
|
|
3324
3324
|
if (!await W(() => a.current, 1e4)) return null;
|
|
3325
3325
|
Le(!0);
|
|
3326
3326
|
for (let A = 0; A < 5 && j.current !== 1; A++)
|
|
3327
3327
|
_("playVideo"), await W(() => j.current === 1, 1500);
|
|
3328
|
-
return j.current !== 1 ? null :
|
|
3328
|
+
return j.current !== 1 ? null : M.current ? (Le(!0), !1) : (Le(!1), await B(1200), j.current === 1 && E.current === !1 ? !0 : (Le(!0), _("playVideo"), !1));
|
|
3329
3329
|
},
|
|
3330
3330
|
playing: ee,
|
|
3331
3331
|
ended: l === 0,
|
|
@@ -3337,9 +3337,9 @@ function Bl(t, e, n, r) {
|
|
|
3337
3337
|
toggle: le,
|
|
3338
3338
|
seekRow: Te,
|
|
3339
3339
|
toggleMute: () => {
|
|
3340
|
-
const B = !
|
|
3341
|
-
Le(B), !B && !
|
|
3342
|
-
j.current === 2 && !
|
|
3340
|
+
const B = !g.current;
|
|
3341
|
+
Le(B), !B && !M.current && j.current === 1 && setTimeout(() => {
|
|
3342
|
+
j.current === 2 && !g.current && (Le(!0), _("playVideo"));
|
|
3343
3343
|
}, 900);
|
|
3344
3344
|
},
|
|
3345
3345
|
seekFrac: (B) => k(Math.max(0, Math.min(1, B)) * O),
|
|
@@ -3371,22 +3371,22 @@ function Bl(t, e, n, r) {
|
|
|
3371
3371
|
}
|
|
3372
3372
|
function Vl(t, e, n, r, s = 0, a = null) {
|
|
3373
3373
|
var A;
|
|
3374
|
-
const o = v(null), [l, c] = z(!1), [u, d] = z(0), [
|
|
3375
|
-
N.current =
|
|
3374
|
+
const o = v(null), [l, c] = z(!1), [u, d] = z(0), [g, M] = z(!1), N = v(g);
|
|
3375
|
+
N.current = g;
|
|
3376
3376
|
const p = v(!1), [y, L] = z(null), [m, f] = z(!1), I = v(s);
|
|
3377
3377
|
I.current = s;
|
|
3378
|
-
const
|
|
3378
|
+
const b = v(null), [D, V] = z(0);
|
|
3379
3379
|
U(() => {
|
|
3380
3380
|
f(!1);
|
|
3381
|
-
const
|
|
3382
|
-
if (
|
|
3381
|
+
const C = b.current;
|
|
3382
|
+
if (b.current = null, C || d(0), !t) {
|
|
3383
3383
|
c(!1), o.current = null;
|
|
3384
3384
|
return;
|
|
3385
3385
|
}
|
|
3386
3386
|
const H = ci(t), ce = I.current;
|
|
3387
3387
|
return H.preload = "metadata", H.muted = N.current || p.current, H.onplay = () => c(!0), H.onpause = () => c(!1), H.onended = () => c(!1), H.onloadedmetadata = () => {
|
|
3388
|
-
f(!0), H.currentTime = ((
|
|
3389
|
-
|
|
3388
|
+
f(!0), H.currentTime = ((C == null ? void 0 : C.t) ?? 0) + ce, C != null && C.playing && H.play().catch((F) => {
|
|
3389
|
+
C.asked && (F == null ? void 0 : F.name) === "NotAllowedError" || L(Tt(F));
|
|
3390
3390
|
});
|
|
3391
3391
|
}, H.onerror = () => {
|
|
3392
3392
|
c(!1);
|
|
@@ -3395,10 +3395,10 @@ function Vl(t, e, n, r, s = 0, a = null) {
|
|
|
3395
3395
|
Cl(Z == null ? void 0 : Z.message) || oi(F), o.current === H && (L({ message: (Z == null ? void 0 : Z.message) ?? me }), Z != null && Z.permanent || (o.current = null));
|
|
3396
3396
|
});
|
|
3397
3397
|
}, o.current = H, () => {
|
|
3398
|
-
|
|
3398
|
+
b.current = { t: Math.max(0, H.currentTime - ce), playing: !H.paused && !H.ended }, H.pause(), H.onplay = H.onpause = H.onended = H.onloadedmetadata = H.onerror = null, o.current = null;
|
|
3399
3399
|
};
|
|
3400
3400
|
}, [t, D]), U(() => () => {
|
|
3401
|
-
|
|
3401
|
+
b.current = null;
|
|
3402
3402
|
}, []);
|
|
3403
3403
|
const _ = n.length ? ((A = n[n.length - 1].words[n[n.length - 1].words.length - 1]) == null ? void 0 : A.end) ?? n[n.length - 1].start + 4 : 0, ee = s > 0 || r != null && m && o.current != null && Number.isFinite(o.current.duration) && o.current.duration > r + 1, j = !ee && m && o.current && Number.isFinite(o.current.duration) && o.current.duration || r || _ || 1, E = v(j);
|
|
3404
3404
|
E.current = j;
|
|
@@ -3406,20 +3406,20 @@ function Vl(t, e, n, r, s = 0, a = null) {
|
|
|
3406
3406
|
Q.current = ee;
|
|
3407
3407
|
const T = v(a);
|
|
3408
3408
|
T.current = a;
|
|
3409
|
-
const [O, S] = z(!1), re = v(!1), K = (
|
|
3410
|
-
re.current =
|
|
3409
|
+
const [O, S] = z(!1), re = v(!1), K = (C) => {
|
|
3410
|
+
re.current = C, S(C);
|
|
3411
3411
|
};
|
|
3412
3412
|
U(() => {
|
|
3413
|
-
var
|
|
3414
|
-
a == null && re.current && (K(!1), (
|
|
3413
|
+
var C;
|
|
3414
|
+
a == null && re.current && (K(!1), (C = o.current) == null || C.play().catch(() => {
|
|
3415
3415
|
}));
|
|
3416
3416
|
}, [a]), U(() => {
|
|
3417
|
-
var
|
|
3418
|
-
!O || a == null || a < u + 1.5 || (K(!1), (
|
|
3417
|
+
var C;
|
|
3418
|
+
!O || a == null || a < u + 1.5 || (K(!1), (C = o.current) == null || C.play().catch(() => {
|
|
3419
3419
|
}));
|
|
3420
3420
|
}, [O, a, u]), U(() => {
|
|
3421
3421
|
if (!l) return;
|
|
3422
|
-
let
|
|
3422
|
+
let C = 0;
|
|
3423
3423
|
const H = () => {
|
|
3424
3424
|
const ce = o.current;
|
|
3425
3425
|
if (ce) {
|
|
@@ -3434,45 +3434,45 @@ function Vl(t, e, n, r, s = 0, a = null) {
|
|
|
3434
3434
|
}
|
|
3435
3435
|
d(F);
|
|
3436
3436
|
}
|
|
3437
|
-
|
|
3437
|
+
C = requestAnimationFrame(H);
|
|
3438
3438
|
};
|
|
3439
|
-
return
|
|
3439
|
+
return C = requestAnimationFrame(H), () => cancelAnimationFrame(C);
|
|
3440
3440
|
}, [l]);
|
|
3441
3441
|
const k = Ie(() => {
|
|
3442
3442
|
if (!n.length) return 0;
|
|
3443
|
-
let
|
|
3444
|
-
for (let H = 0; H < n.length; H++) n[H].start <= u + 0.05 && (
|
|
3445
|
-
return
|
|
3446
|
-
}, [n, u]), [ae, te] = z(0), G = (
|
|
3447
|
-
const H = T.current != null ? Math.min(
|
|
3443
|
+
let C = 0;
|
|
3444
|
+
for (let H = 0; H < n.length; H++) n[H].start <= u + 0.05 && (C = H);
|
|
3445
|
+
return C;
|
|
3446
|
+
}, [n, u]), [ae, te] = z(0), G = (C) => {
|
|
3447
|
+
const H = T.current != null ? Math.min(C, Math.max(0, T.current - 0.5)) : C, ce = o.current;
|
|
3448
3448
|
d(H), ce && (ce.currentTime = H + I.current), te((F) => F + 1);
|
|
3449
|
-
}, J = (
|
|
3450
|
-
(
|
|
3449
|
+
}, J = (C) => {
|
|
3450
|
+
(C == null ? void 0 : C.name) !== "AbortError" && L(Tt(C));
|
|
3451
3451
|
}, pe = () => {
|
|
3452
3452
|
var H;
|
|
3453
|
-
const
|
|
3454
|
-
if (!
|
|
3453
|
+
const C = o.current;
|
|
3454
|
+
if (!C) {
|
|
3455
3455
|
if (!t && e) {
|
|
3456
|
-
|
|
3456
|
+
b.current = (H = b.current) != null && H.asked ? null : { t: u, playing: !0, asked: !0 };
|
|
3457
3457
|
return;
|
|
3458
3458
|
}
|
|
3459
3459
|
t && V((ce) => ce + 1), L({ message: e ? "The audio player is not ready yet — try again in a moment." : "There is no audio for this transcription." });
|
|
3460
3460
|
return;
|
|
3461
3461
|
}
|
|
3462
3462
|
if (l) {
|
|
3463
|
-
|
|
3463
|
+
C.pause();
|
|
3464
3464
|
return;
|
|
3465
3465
|
}
|
|
3466
3466
|
if (re.current) {
|
|
3467
3467
|
K(!1);
|
|
3468
3468
|
return;
|
|
3469
3469
|
}
|
|
3470
|
-
|
|
3471
|
-
}, le = (
|
|
3472
|
-
const H = n[Math.max(0, Math.min(n.length - 1,
|
|
3470
|
+
C.currentTime < I.current && (C.currentTime = I.current), u >= j - 0.25 && G(0), C.play().catch(J);
|
|
3471
|
+
}, le = (C) => {
|
|
3472
|
+
const H = n[Math.max(0, Math.min(n.length - 1, C))];
|
|
3473
3473
|
H && G(H.start);
|
|
3474
|
-
}, Te = (
|
|
3475
|
-
const H = Ln(
|
|
3474
|
+
}, Te = (C) => G(Math.max(0, Math.min(1, C)) * j), je = (C) => {
|
|
3475
|
+
const H = Ln(C, n, j);
|
|
3476
3476
|
G(H.t);
|
|
3477
3477
|
const ce = o.current;
|
|
3478
3478
|
if (ce) {
|
|
@@ -3482,33 +3482,33 @@ function Vl(t, e, n, r, s = 0, a = null) {
|
|
|
3482
3482
|
}
|
|
3483
3483
|
K(!1), ce.play().catch(J);
|
|
3484
3484
|
}
|
|
3485
|
-
}, Ee = (
|
|
3486
|
-
le(
|
|
3485
|
+
}, Ee = (C) => G(C.start), Le = (C) => {
|
|
3486
|
+
le(C);
|
|
3487
3487
|
const H = o.current;
|
|
3488
3488
|
H && H.paused && H.play().catch(J);
|
|
3489
3489
|
}, we = v(!1), _e = v(0), Pe = () => {
|
|
3490
|
-
var
|
|
3491
|
-
l && ((
|
|
3490
|
+
var C;
|
|
3491
|
+
l && ((C = o.current) == null || C.pause(), we.current = !0);
|
|
3492
3492
|
}, Se = () => {
|
|
3493
|
-
var
|
|
3494
|
-
we.current && (we.current = !1, (
|
|
3493
|
+
var C;
|
|
3494
|
+
we.current && (we.current = !1, (C = o.current) == null || C.play().catch(J));
|
|
3495
3495
|
};
|
|
3496
3496
|
return {
|
|
3497
3497
|
autoplay: async () => {
|
|
3498
|
-
const
|
|
3499
|
-
if (!
|
|
3500
|
-
|
|
3498
|
+
const C = o.current;
|
|
3499
|
+
if (!C) return null;
|
|
3500
|
+
C.currentTime < I.current && (C.currentTime = I.current);
|
|
3501
3501
|
const H = (ce) => {
|
|
3502
|
-
N.current = ce,
|
|
3502
|
+
N.current = ce, C.muted = ce || p.current, M(ce);
|
|
3503
3503
|
};
|
|
3504
3504
|
try {
|
|
3505
|
-
return H(!1), await
|
|
3505
|
+
return H(!1), await C.play(), !0;
|
|
3506
3506
|
} catch (ce) {
|
|
3507
3507
|
if ((ce == null ? void 0 : ce.name) !== "NotAllowedError")
|
|
3508
3508
|
return H(!0), null;
|
|
3509
3509
|
}
|
|
3510
3510
|
try {
|
|
3511
|
-
return H(!0), await
|
|
3511
|
+
return H(!0), await C.play(), !1;
|
|
3512
3512
|
} catch {
|
|
3513
3513
|
return null;
|
|
3514
3514
|
}
|
|
@@ -3517,10 +3517,10 @@ function Vl(t, e, n, r, s = 0, a = null) {
|
|
|
3517
3517
|
t: u,
|
|
3518
3518
|
idx: k,
|
|
3519
3519
|
dur: j,
|
|
3520
|
-
muted:
|
|
3520
|
+
muted: g,
|
|
3521
3521
|
toggleMute: () => {
|
|
3522
|
-
const
|
|
3523
|
-
N.current =
|
|
3522
|
+
const C = !N.current;
|
|
3523
|
+
N.current = C, o.current && (o.current.muted = C || p.current), M(C);
|
|
3524
3524
|
},
|
|
3525
3525
|
toggle: pe,
|
|
3526
3526
|
seekRow: le,
|
|
@@ -3530,13 +3530,13 @@ function Vl(t, e, n, r, s = 0, a = null) {
|
|
|
3530
3530
|
playRow: Le,
|
|
3531
3531
|
seekN: ae,
|
|
3532
3532
|
stop: () => {
|
|
3533
|
-
const
|
|
3534
|
-
|
|
3533
|
+
const C = o.current;
|
|
3534
|
+
C && (C.pause(), C.currentTime = I.current), d(0);
|
|
3535
3535
|
},
|
|
3536
|
-
videoAt: (
|
|
3536
|
+
videoAt: (C) => {
|
|
3537
3537
|
const H = o.current;
|
|
3538
3538
|
if (!H || H.paused || H.ended || we.current || Date.now() - _e.current < 3e3) return;
|
|
3539
|
-
const ce =
|
|
3539
|
+
const ce = C + I.current;
|
|
3540
3540
|
Math.abs(H.currentTime - ce) <= 0.2 || (_e.current = Date.now(), H.currentTime = ce);
|
|
3541
3541
|
},
|
|
3542
3542
|
engaged: l || u > 0,
|
|
@@ -3550,23 +3550,23 @@ function Vl(t, e, n, r, s = 0, a = null) {
|
|
|
3550
3550
|
edgeWait: O,
|
|
3551
3551
|
wordSync: !0,
|
|
3552
3552
|
pause: () => {
|
|
3553
|
-
var
|
|
3554
|
-
K(!1), (
|
|
3553
|
+
var C;
|
|
3554
|
+
K(!1), (C = o.current) == null || C.pause();
|
|
3555
3555
|
},
|
|
3556
|
-
setVolume: (
|
|
3557
|
-
o.current && (o.current.volume =
|
|
3556
|
+
setVolume: (C) => {
|
|
3557
|
+
o.current && (o.current.volume = C);
|
|
3558
3558
|
},
|
|
3559
|
-
silence: (
|
|
3560
|
-
p.current =
|
|
3559
|
+
silence: (C) => {
|
|
3560
|
+
p.current = C, o.current && (o.current.muted = N.current || C);
|
|
3561
3561
|
}
|
|
3562
3562
|
};
|
|
3563
3563
|
}
|
|
3564
3564
|
function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
3565
3565
|
const c = v(/* @__PURE__ */ new Set());
|
|
3566
3566
|
c.current = l ?? c.current;
|
|
3567
|
-
const u = v(null), [d,
|
|
3567
|
+
const u = v(null), [d, g] = z(!1), [M, N] = z(0), [p, y] = z(0), [L, m] = z(!1), f = v(L);
|
|
3568
3568
|
f.current = L;
|
|
3569
|
-
const [I,
|
|
3569
|
+
const [I, b] = z(null), [D, V] = z(null), [_, ee] = z(null), [j, E] = z(null), Q = v(j);
|
|
3570
3570
|
Q.current = j;
|
|
3571
3571
|
const [T, O] = z(null), [S, re] = z(null), [K, k] = z(null), [ae, te] = z(!1), G = v(e);
|
|
3572
3572
|
G.current = e;
|
|
@@ -3578,11 +3578,11 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3578
3578
|
je.current = a;
|
|
3579
3579
|
const Ee = Ke((Y) => {
|
|
3580
3580
|
Y.finite = !0, Y.coming = (R) => c.current.has(R), Y.readAhead = 6, Y.readAheadS = 45, Y.onWaiting = (R) => V(R), Y.onStarting = (R) => ee(R), Y.onSentence = (R) => {
|
|
3581
|
-
if (
|
|
3581
|
+
if (g(Y.playing), R == null) return;
|
|
3582
3582
|
const q = G.current.findIndex((ne) => ne.sentenceId === R);
|
|
3583
3583
|
q >= 0 && N(q);
|
|
3584
3584
|
}, Y.onError = (R) => {
|
|
3585
|
-
|
|
3585
|
+
g(Y.playing), b(R instanceof ui ? { message: "The voice could not be started. Press Play to try again.", code: "voice_not_started" } : { message: "A line of this reading could not be played." });
|
|
3586
3586
|
}, Y.gapBefore = (R, q) => {
|
|
3587
3587
|
if (!J.current) return 0;
|
|
3588
3588
|
const ne = G.current, de = ne.find((Ce) => Ce.sentenceId === R), Oe = ne.find((Ce) => Ce.sentenceId === q);
|
|
@@ -3615,7 +3615,7 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3615
3615
|
var q;
|
|
3616
3616
|
if (Le.current !== r) {
|
|
3617
3617
|
const ne = Le.current != null ? we.current : null;
|
|
3618
|
-
Le.current = r, (q = u.current) == null || q.stop(), u.current = new fr(), Ee(u.current), u.current.setSequence(pe.current),
|
|
3618
|
+
Le.current = r, (q = u.current) == null || q.stop(), u.current = new fr(), Ee(u.current), u.current.setSequence(pe.current), g(!1), N(0), b(null), ee(null), E(null), W(ne && (ne.playing || ne.t > 0) ? ne : null);
|
|
3619
3619
|
}
|
|
3620
3620
|
const Y = u.current;
|
|
3621
3621
|
Y.setMuted(f.current);
|
|
@@ -3623,11 +3623,11 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3623
3623
|
const R = _e.current;
|
|
3624
3624
|
R && (J.current || t.some((ne) => ne.sentenceId >= (R.sentenceId ?? 0))) && (W(null), B.current(R));
|
|
3625
3625
|
}, [r, t]);
|
|
3626
|
-
const
|
|
3627
|
-
pe.current =
|
|
3626
|
+
const C = Ie(() => o ? e.map((Y) => Y.sentenceId).filter((Y) => Y != null) : [], [e, o]);
|
|
3627
|
+
pe.current = C, U(() => {
|
|
3628
3628
|
var Y;
|
|
3629
|
-
(Y = u.current) == null || Y.setSequence(
|
|
3630
|
-
}, [
|
|
3629
|
+
(Y = u.current) == null || Y.setSequence(C);
|
|
3630
|
+
}, [C, r]), U(() => () => {
|
|
3631
3631
|
var Y;
|
|
3632
3632
|
(Y = u.current) == null || Y.stop(), u.current = null, Le.current = null;
|
|
3633
3633
|
}, []);
|
|
@@ -3657,15 +3657,15 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3657
3657
|
}, me = (Y, R) => {
|
|
3658
3658
|
for (let q = Y; q >= 0 && q < e.length; q += R) if (F(q)) return q;
|
|
3659
3659
|
return null;
|
|
3660
|
-
}, Z = Math.max(0, Math.min(
|
|
3661
|
-
Ae.current =
|
|
3660
|
+
}, Z = Math.max(0, Math.min(M, Math.max(0, e.length - 1))), ve = e.length ? e[e.length - 1].start + 4 : 0, ze = n || ve || 1, Ge = v(!1), Ae = v(M);
|
|
3661
|
+
Ae.current = M;
|
|
3662
3662
|
const ge = (Y) => {
|
|
3663
3663
|
var R, q, ne;
|
|
3664
|
-
(q = u.current) == null || q.play(((R = e[Y]) == null ? void 0 : R.sentenceId) ?? null),
|
|
3664
|
+
(q = u.current) == null || q.play(((R = e[Y]) == null ? void 0 : R.sentenceId) ?? null), g(!!((ne = u.current) != null && ne.playing));
|
|
3665
3665
|
}, Ye = (Y) => {
|
|
3666
3666
|
var q, ne, de;
|
|
3667
3667
|
const R = Math.max(0, Math.min(Math.max(0, e.length - 1), Y));
|
|
3668
|
-
N(R), Ae.current = R, y((Oe) => Oe + 1), (ne = u.current) == null || ne.seek(((q = e[R]) == null ? void 0 : q.sentenceId) ?? null),
|
|
3668
|
+
N(R), Ae.current = R, y((Oe) => Oe + 1), (ne = u.current) == null || ne.seek(((q = e[R]) == null ? void 0 : q.sentenceId) ?? null), g(!!((de = u.current) != null && de.playing));
|
|
3669
3669
|
}, Ve = (Y) => {
|
|
3670
3670
|
var R;
|
|
3671
3671
|
A(), E(null), (R = u.current) == null || R.startWithin(-1, 0), Ye(Y);
|
|
@@ -3708,24 +3708,24 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3708
3708
|
return;
|
|
3709
3709
|
}
|
|
3710
3710
|
if (A(), d) {
|
|
3711
|
-
(R = u.current) == null || R.pause(),
|
|
3711
|
+
(R = u.current) == null || R.pause(), g(!1);
|
|
3712
3712
|
return;
|
|
3713
3713
|
}
|
|
3714
|
-
|
|
3714
|
+
b(null);
|
|
3715
3715
|
const Y = Ae.current;
|
|
3716
3716
|
if (!Q.current && ((ne = u.current) != null && ne.resume(((q = e[Y]) == null ? void 0 : q.sentenceId) ?? null))) {
|
|
3717
|
-
|
|
3717
|
+
g(!0);
|
|
3718
3718
|
return;
|
|
3719
3719
|
}
|
|
3720
3720
|
ge(Y);
|
|
3721
3721
|
},
|
|
3722
3722
|
pause: () => {
|
|
3723
3723
|
var Y;
|
|
3724
|
-
A(), (Y = u.current) == null || Y.pause(),
|
|
3724
|
+
A(), (Y = u.current) == null || Y.pause(), g(!1);
|
|
3725
3725
|
},
|
|
3726
3726
|
stop: () => {
|
|
3727
3727
|
var Y, R, q;
|
|
3728
|
-
A(), (Y = u.current) == null || Y.pause(),
|
|
3728
|
+
A(), (Y = u.current) == null || Y.pause(), g(!1), N(0), O(null), (q = u.current) == null || q.seek(((R = e[0]) == null ? void 0 : R.sentenceId) ?? null);
|
|
3729
3729
|
},
|
|
3730
3730
|
seekRow: Ve,
|
|
3731
3731
|
resumeAt: (Y) => {
|
|
@@ -3784,7 +3784,7 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3784
3784
|
release: () => {
|
|
3785
3785
|
Ge.current && (Ge.current = !1, ge(Ae.current));
|
|
3786
3786
|
},
|
|
3787
|
-
clearError: () =>
|
|
3787
|
+
clearError: () => b(null),
|
|
3788
3788
|
setVolume: (Y) => {
|
|
3789
3789
|
var R;
|
|
3790
3790
|
return (R = u.current) == null ? void 0 : R.setVolume(Y);
|
|
@@ -3796,7 +3796,7 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3796
3796
|
if (R == null) return;
|
|
3797
3797
|
N(Y), Ae.current = Y, E(null), Q.current = null, (de = u.current) == null || de.joinSilently(R);
|
|
3798
3798
|
const q = ((Oe = u.current) == null ? void 0 : Oe.resting()) ?? null;
|
|
3799
|
-
re((q == null ? void 0 : q.s) ?? null), te(!!(q != null && q.silent)),
|
|
3799
|
+
re((q == null ? void 0 : q.s) ?? null), te(!!(q != null && q.silent)), g(!!((ye = u.current) != null && ye.playing));
|
|
3800
3800
|
}
|
|
3801
3801
|
return fe.joinAt = o ? (Y) => {
|
|
3802
3802
|
A(), Ue(Ln({ t: Y, playing: !0, sentenceId: null, offset: 0, ended: !1 }, e, ze).index);
|
|
@@ -3812,17 +3812,17 @@ function Hl(t, e, n, r, s, a, o = !1, l) {
|
|
|
3812
3812
|
}
|
|
3813
3813
|
const Wl = () => {
|
|
3814
3814
|
}, Fl = "The language this recording is read aloud in.", Gl = { title: "READ IN", note: "The transcript and its voice switch to this language." };
|
|
3815
|
-
function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, langs: o, srcLang: l, canTranslate: c, pickedLang: u, setPickedLang: d, side:
|
|
3815
|
+
function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, langs: o, srcLang: l, canTranslate: c, pickedLang: u, setPickedLang: d, side: g, hearOriginal: M = !1, timed: N = !1, stockVoices: p = !1, stickyPicker: y = !1, pickerBusy: L = null, voiceSheet: m, forcedVoice: f = null }) {
|
|
3816
3816
|
var on, Gt, Zt, qt;
|
|
3817
|
-
const { onAddVoice: I, onPickVoice:
|
|
3817
|
+
const { onAddVoice: I, onPickVoice: b, onSelectSpeaker: D, noCloneFor: V, castNoClone: _, castShort: ee, castBuilding: j, castWarn: E, badge: Q, titleNode: T } = m ?? {}, O = !!m, S = !!(m != null && m.pendingClones), [re, K] = gi(), [k, ae] = z(null), [te, G] = z(!1), [J, pe] = z(!1), [le, Te] = z(!1), [je, Ee] = z(!1), Le = u ?? l, we = u === null, _e = u != null || k != null, Se = ((P) => !!P && !!(o != null && o.voice.includes(P)))(we ? l : Le) ? we ? l : Le : "en", B = Dl(Se), W = (m == null ? void 0 : m.cloneOn) ?? !0, [A, C] = z(0), H = v(W);
|
|
3818
3818
|
U(() => {
|
|
3819
|
-
H.current !== W && (H.current = W,
|
|
3819
|
+
H.current !== W && (H.current = W, C((P) => P + 1));
|
|
3820
3820
|
}, [W]);
|
|
3821
3821
|
const ce = dl(Se, _e || s || J, hl(e) * 1e3 + A, { id: t ?? null, shareCode: a.shareCode ?? null }), F = Ie(() => ((ce == null ? void 0 : ce.voices) ?? []).filter((P) => O || !P.cloned || P.speaker != null), [ce, O]), me = F.length > 1, Z = wr(o, Le), ve = ki(), ze = Ie(() => fi(o, "translation"), [o]), [Ge, Ae] = z(null), [ge] = z(() => /* @__PURE__ */ new Set()), [Ye, Ve] = z({}), $ = Ie(() => al(n, e, ve.vcUnknownSpk), [n, e, ve]), he = me && $.filter((P) => P.key >= 0).length > 1, ue = Ge != null && $.some((P) => P.key === Ge) ? Ge : ((on = $[0]) == null ? void 0 : on.key) ?? null, ie = Ie(() => {
|
|
3822
3822
|
const P = Gs($, F, W);
|
|
3823
3823
|
for (const [De, Be] of Object.entries(Ye[Se ?? ""] ?? {})) P.set(Number(De), Be);
|
|
3824
3824
|
return P;
|
|
3825
|
-
}, [$, F, Ye, Se, W]), fe = he && Object.keys(Ye[Se ?? ""] ?? {}).length > 0, Ue = Ie(() => p && !fe ? Gs($, F, !1) : null, [p, fe, $, F]), Y = Ie(() => fe ? Ws(ie) || null : Ue && Ws(Ue) || null, [fe, ie, Ue]), R = fe ? ie : Ue, q = F.some((P) => P.cloned && P.consent !== "pending"), ne = !!Le && !!(o != null && o.voice.includes(Le)), de = ne && !
|
|
3825
|
+
}, [$, F, Ye, Se, W]), fe = he && Object.keys(Ye[Se ?? ""] ?? {}).length > 0, Ue = Ie(() => p && !fe ? Gs($, F, !1) : null, [p, fe, $, F]), Y = Ie(() => fe ? Ws(ie) || null : Ue && Ws(Ue) || null, [fe, ie, Ue]), R = fe ? ie : Ue, q = F.some((P) => P.cloned && P.consent !== "pending"), ne = !!Le && !!(o != null && o.voice.includes(Le)), de = ne && !M, Oe = Ie(
|
|
3826
3826
|
() => n.filter((P) => !P.suppressed && !P.unclear).map((P) => P.sentenceId).filter((P) => P != null),
|
|
3827
3827
|
[n]
|
|
3828
3828
|
), ye = Ml({ recordingId: t, lang: Le, ended: s, cred: a, pickedVoice: f || (Y ?? k), sentenceIds: s && de ? Oe : void 0 }), ke = F.find((P) => P.id === k) ?? F.find((P) => {
|
|
@@ -3855,7 +3855,7 @@ function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, lan
|
|
|
3855
3855
|
}, it = () => G(!0), lt = () => {
|
|
3856
3856
|
G(!1), pe(le), Te(!1);
|
|
3857
3857
|
}, Ht = (P) => {
|
|
3858
|
-
if (d(P), K(P), !((
|
|
3858
|
+
if (d(P), K(P), !((g || y) && !le)) {
|
|
3859
3859
|
if (P != null) {
|
|
3860
3860
|
lt();
|
|
3861
3861
|
return;
|
|
@@ -3885,7 +3885,7 @@ function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, lan
|
|
|
3885
3885
|
return;
|
|
3886
3886
|
}
|
|
3887
3887
|
ae(P);
|
|
3888
|
-
}, ct = we ? { ...wr(o, null), flag: /* @__PURE__ */ i(oe, { d: X.langAuto, size: 21, sw: 1.7, style: { color: "currentColor", display: "block" } }) } : Z, nn = c ?
|
|
3888
|
+
}, ct = we ? { ...wr(o, null), flag: /* @__PURE__ */ i(oe, { d: X.langAuto, size: 21, sw: 1.7, style: { color: "currentColor", display: "block" } }) } : Z, nn = c ? g ? /* @__PURE__ */ i("span", { className: "barchip", style: x ? { background: "var(--brand-tint)", boxShadow: "0 0 0 1.5px var(--brand)" } : void 0, children: /* @__PURE__ */ i(zn, { flag: ct.flag, code: ct.code, bordered: !1, onClick: Lt, flagOnly: !0, label: ct.label }) }) : /* @__PURE__ */ i(zn, { flag: ct.flag, code: ct.code, bordered: !1, onClick: it, flagOnly: !0, label: ct.label }) : null, Je = X.voiceClone, ut = _e && (!!ye.track || ot), Ft = rt ? "var(--conf-low)" : ut || g && wt ? "var(--brand)" : "var(--ink-55)", dt = ot || !!$e.preparing && _e, vt = $e.preparing ? `Speaking this line in ${(ke == null ? void 0 : ke.name) ?? "this voice"}…` : ot ? `Preparing this recording in ${(ke == null ? void 0 : ke.name) ?? "this voice"} — it will play as soon as it is ready` : rt ? `This voice could not be prepared: ${rt}` : ne ? me ? "Choose a voice" : ke ? ke.name : ve.vcNoVoice + Z.label : `${ve.vcNoVoice}${Z.label}`, rn = /* @__PURE__ */ i($a, { open: te, onClose: lt, keepOpen: (!!g || y) && !le, value: we ? null : Le, onSelect: Ht, languages: ze, title: (g == null ? void 0 : g.title) ?? "SPOKEN LANGUAGE", note: (g == null ? void 0 : g.note) ?? Fl, searchPlaceholder: ve.search, none: "Original", pinned: (we ? l : Le) ? [we ? l : Le] : [], recent: re, requireVoice: le, sticky: y, busy: L }), bt = Ie(() => F.filter((P) => P.cloned && !P.auto), [F]), _t = (P) => P.voiceId ? bt.find((De) => De.id === `clone:${P.voiceId}`) ?? null : null, ht = Ie(() => $.filter((P) => P.key >= 0), [$]), Yt = Ie(() => {
|
|
3889
3889
|
const P = F.filter((Be) => !Be.cloned);
|
|
3890
3890
|
if (!he) return [...P, ...s && ht.length === 1 ? bt.filter((Be) => Be.id === `clone:${ht[0].voiceId}`) : []];
|
|
3891
3891
|
const De = [];
|
|
@@ -3898,7 +3898,7 @@ function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, lan
|
|
|
3898
3898
|
}, [F, bt, he, ht, S, s]), Xe = he ? ht.find((P) => P.key === ue) ?? null : null, qe = (P) => {
|
|
3899
3899
|
var De;
|
|
3900
3900
|
return P ? ((De = F.find((Be) => Be.id === P)) == null ? void 0 : De.gender) ?? null : null;
|
|
3901
|
-
}, Ut = Xe ? Xe.sex ?? qe(ie.get(Xe.key)) : null, sn = Ie(() => Xe ? Yt.filter((P) => P.cloned ? P.live ? P.speaker === Xe.key : P.id === `clone:${Xe.voiceId}` : !0) : Yt, [Yt, Xe, Ut, ht]), Rt = (P) => F.find((De) => De.cloned && De.auto && De.speaker === P) ?? null, We = { people: ht, gvList: F, autoOf: Rt, savedFor: _t }, xt = (Q == null ? void 0 : Q(We)) ?? 0, kt = E ? ht.map((P) => E(P, We)).filter((P) => !!P) : [], Dn = /* @__PURE__ */ h("button", { type: "button", className: "txvoice", "aria-label": "Voice", "aria-pressed":
|
|
3901
|
+
}, Ut = Xe ? Xe.sex ?? qe(ie.get(Xe.key)) : null, sn = Ie(() => Xe ? Yt.filter((P) => P.cloned ? P.live ? P.speaker === Xe.key : P.id === `clone:${Xe.voiceId}` : !0) : Yt, [Yt, Xe, Ut, ht]), Rt = (P) => F.find((De) => De.cloned && De.auto && De.speaker === P) ?? null, We = { people: ht, gvList: F, autoOf: Rt, savedFor: _t }, xt = (Q == null ? void 0 : Q(We)) ?? 0, kt = E ? ht.map((P) => E(P, We)).filter((P) => !!P) : [], Dn = /* @__PURE__ */ h("button", { type: "button", className: "txvoice", "aria-label": "Voice", "aria-pressed": g ? wt : void 0, title: dt || rt ? vt : void 0, style: { cursor: "pointer", background: ut || dt || g && wt ? "var(--brand-tint)" : "var(--fill-06)", boxShadow: g && wt ? "inset 0 0 0 1.5px var(--brand)" : void 0 }, onClick: g ? Ot : se, children: [
|
|
3902
3902
|
dt ? /* @__PURE__ */ i("span", { style: { width: 16, height: 16, borderRadius: "50%", border: "2px solid var(--fill-10)", borderTopColor: "var(--brand)", animation: "vs-spin .7s linear infinite" } }) : /* @__PURE__ */ i(oe, { d: Je, size: 17, sw: 1.6, style: { color: Ft } }),
|
|
3903
3903
|
kt.length > 0 ? /* @__PURE__ */ i("span", { className: "txvoice__warn", title: kt.join(" · "), children: "!" }) : !!xt && /* @__PURE__ */ i("span", { className: "txvoice__n", title: `${xt} speaker${xt === 1 ? "" : "s"} can get a cloned voice`, children: xt })
|
|
3904
3904
|
] }), an = /* @__PURE__ */ i(Vt, { open: J, onClose: Wt, title: ve.vcSheet, titleNode: T, doneLabel: ve.done, children: /* @__PURE__ */ i(
|
|
@@ -3941,7 +3941,7 @@ function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, lan
|
|
|
3941
3941
|
B.stop();
|
|
3942
3942
|
return;
|
|
3943
3943
|
}
|
|
3944
|
-
if ((
|
|
3944
|
+
if ((b == null ? void 0 : b(P)) === !1) {
|
|
3945
3945
|
B.reset();
|
|
3946
3946
|
return;
|
|
3947
3947
|
}
|
|
@@ -3949,12 +3949,12 @@ function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, lan
|
|
|
3949
3949
|
},
|
|
3950
3950
|
onUse: Ct
|
|
3951
3951
|
}
|
|
3952
|
-
) }), jt =
|
|
3952
|
+
) }), jt = g ? null : /* @__PURE__ */ h(xe, { children: [
|
|
3953
3953
|
rn,
|
|
3954
3954
|
an
|
|
3955
|
-
] }), Sn =
|
|
3955
|
+
] }), Sn = g && (te || J) ? /* @__PURE__ */ i("div", { className: "vs-side", children: te ? rn : an }) : null, An = be && rt ? `This voice could not be prepared: ${rt}` : null, En = gt;
|
|
3956
3956
|
return {
|
|
3957
|
-
barChip: { flag: ct.flag, code: ct.code, label: ct.label, onClick:
|
|
3957
|
+
barChip: { flag: ct.flag, code: ct.code, label: ct.label, onClick: g || y ? Lt : it, active: !!((g || y) && x), can: c },
|
|
3958
3958
|
sheetsOpen: te || J,
|
|
3959
3959
|
on: be,
|
|
3960
3960
|
player: He,
|
|
@@ -3975,7 +3975,7 @@ function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, lan
|
|
|
3975
3975
|
openVoices: se,
|
|
3976
3976
|
openPicker: it,
|
|
3977
3977
|
original: we,
|
|
3978
|
-
reloadVoices: () =>
|
|
3978
|
+
reloadVoices: () => C((P) => P + 1),
|
|
3979
3979
|
voicesVer: A,
|
|
3980
3980
|
people: ht,
|
|
3981
3981
|
gvList: F,
|
|
@@ -4003,7 +4003,7 @@ function Zl({ recordingId: t, model: e, rows: n, lenS: r, ended: s, cred: a, lan
|
|
|
4003
4003
|
langList: { value: we ? null : Le, onSelect: Ht, languages: ze, searchPlaceholder: ve.search, none: "Original", pinned: (we ? l : Le) ? [we ? l : Le] : [], recent: re }
|
|
4004
4004
|
};
|
|
4005
4005
|
}
|
|
4006
|
-
function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a, onWord: o, onFix: l, fixMode: c, fixingId: u, marks: d = !0, fixBadges:
|
|
4006
|
+
function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a, onWord: o, onFix: l, fixMode: c, fixingId: u, marks: d = !0, fixBadges: g = !0, tail: M, tailFg: N, running: p, desk: y, feedRef: L, listener: m, showLabels: f, find: I, findOpen: b, lang: D, warm: V, onVisible: _, wordHl: ee = !0 }) {
|
|
4007
4007
|
const { playing: j, engaged: E, t: Q, idx: T, seekN: O, wordSync: S, clipPos: re } = n;
|
|
4008
4008
|
Ll(!0, L);
|
|
4009
4009
|
const K = v(null);
|
|
@@ -4023,30 +4023,30 @@ function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a,
|
|
|
4023
4023
|
}
|
|
4024
4024
|
const Z = me.join(",");
|
|
4025
4025
|
Z !== Ee.current && (Ee.current = Z, _(me));
|
|
4026
|
-
},
|
|
4026
|
+
}, C = window.setTimeout(A, 120);
|
|
4027
4027
|
let H;
|
|
4028
4028
|
const ce = () => {
|
|
4029
4029
|
window.clearTimeout(H), H = window.setTimeout(A, 120);
|
|
4030
4030
|
};
|
|
4031
4031
|
return W.addEventListener("scroll", ce, { passive: !0 }), () => {
|
|
4032
|
-
window.clearTimeout(
|
|
4032
|
+
window.clearTimeout(C), window.clearTimeout(H), W.removeEventListener("scroll", ce);
|
|
4033
4033
|
};
|
|
4034
4034
|
}, [e, _, L]);
|
|
4035
4035
|
const Le = (W) => {
|
|
4036
|
-
const A = L.current,
|
|
4037
|
-
if (!A || !
|
|
4038
|
-
const H =
|
|
4036
|
+
const A = L.current, C = je(W);
|
|
4037
|
+
if (!A || !C) return;
|
|
4038
|
+
const H = C.getBoundingClientRect().top - A.getBoundingClientRect().top + A.scrollTop, ce = A.scrollHeight - A.clientHeight, F = lr(A), me = Math.max(80, A.clientHeight - F.top - F.bottom), Z = C.offsetHeight > me ? 8 : (me - C.offsetHeight) / 2;
|
|
4039
4039
|
A.scrollTop = Math.max(0, Math.min(ce, H - F.top - Z));
|
|
4040
4040
|
}, we = (W) => {
|
|
4041
|
-
const A = L.current,
|
|
4042
|
-
if (!A || !A.clientHeight || !A.offsetParent || !
|
|
4043
|
-
const H =
|
|
4041
|
+
const A = L.current, C = je(W);
|
|
4042
|
+
if (!A || !A.clientHeight || !A.offsetParent || !C) return 0;
|
|
4043
|
+
const H = C.getBoundingClientRect(), ce = A.getBoundingClientRect(), F = lr(A), me = ce.top + F.top, Z = ce.bottom - F.bottom;
|
|
4044
4044
|
return H.height > Z - me ? H.top < me - 4 ? -1 : H.top > Z - 60 ? 1 : 0 : H.bottom < me + 10 ? -1 : H.bottom > Z - 4 ? 1 : 0;
|
|
4045
4045
|
}, _e = (W) => {
|
|
4046
4046
|
pe.current = performance.now() + 420;
|
|
4047
|
-
const A = L.current,
|
|
4048
|
-
if (!A || !A.clientHeight || !
|
|
4049
|
-
const H =
|
|
4047
|
+
const A = L.current, C = je(W);
|
|
4048
|
+
if (!A || !A.clientHeight || !C) return;
|
|
4049
|
+
const H = C.getBoundingClientRect(), ce = A.getBoundingClientRect(), F = A.scrollHeight - A.clientHeight, me = A.scrollTop, Z = lr(A), ve = Math.max(80, A.clientHeight - Z.top - Z.bottom), ze = H.height > ve ? 8 : (ve - H.height) / 2, Ge = Math.max(0, Math.min(F, me + (H.top - ce.top) - Z.top - ze));
|
|
4050
4050
|
if (le.current && cancelAnimationFrame(le.current), Math.abs(Ge - me) < 2) {
|
|
4051
4051
|
A.scrollTop = Ge, le.current = null;
|
|
4052
4052
|
return;
|
|
@@ -4067,10 +4067,10 @@ function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a,
|
|
|
4067
4067
|
return;
|
|
4068
4068
|
}
|
|
4069
4069
|
const W = () => {
|
|
4070
|
-
const
|
|
4070
|
+
const C = T !== Te.current;
|
|
4071
4071
|
Te.current = T;
|
|
4072
4072
|
let H = performance.now() < pe.current ? 0 : we(T);
|
|
4073
|
-
|
|
4073
|
+
C && H && !Pe.current && (Le(T), H = 0), Pe.current = H, J(H);
|
|
4074
4074
|
};
|
|
4075
4075
|
W();
|
|
4076
4076
|
const A = setInterval(W, 200);
|
|
@@ -4084,14 +4084,14 @@ function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a,
|
|
|
4084
4084
|
/* @__PURE__ */ i(oe, { d: W === "up" ? "m4.5 15.75 7.5-7.5 7.5 7.5" : "m19.5 8.25-7.5 7.5-7.5-7.5", size: 15, sw: 2 }),
|
|
4085
4085
|
"Now playing"
|
|
4086
4086
|
] }) });
|
|
4087
|
-
return /* @__PURE__ */ h("div", { ref: L, "data-tx-feed": "1", className: `txfeed${y ? " txfeed--desk" : ""}${
|
|
4087
|
+
return /* @__PURE__ */ h("div", { ref: L, "data-tx-feed": "1", className: `txfeed${y ? " txfeed--desk" : ""}${b && !p ? " is-find" : ""}`, children: [
|
|
4088
4088
|
/* @__PURE__ */ i(Ko, { thumbRef: K }),
|
|
4089
4089
|
j && G === -1 && B("up"),
|
|
4090
4090
|
e.map((W, A) => {
|
|
4091
4091
|
var he;
|
|
4092
|
-
const
|
|
4093
|
-
j && !
|
|
4094
|
-
} : j &&
|
|
4092
|
+
const C = j && A === T, H = E && A === T, ce = !!u && u === W.id, F = te && !W.text.toLowerCase().includes(te) && !(D && ((he = W.translations[D]) != null && he.toLowerCase().includes(te))) ? 0.22 : !E || A <= T || ce ? 1 : 0.38, me = m ? () => n.playRow(A) : c && l ? () => {
|
|
4093
|
+
j && !C && n.seekRow(A), l(W);
|
|
4094
|
+
} : j && C ? void 0 : () => n.playRow(A), Z = m ? null : el(W, s, r), ve = !!Z && (Z.script > 0 || Z.manual), ze = y && !!a && k === W.id && !!Z && !ve, Ge = br(t, W.speaker), Ae = xr(t, W.speaker), ge = Ae.lane, Ye = D && W.translations[D] && W.language !== D ? W.translations[D] : null, Ve = xi(e, A, D), $ = H && !S && re ? hi(Ve.map((ue) => ({ t: ue.text, sp: " " })), re) : null;
|
|
4095
4095
|
return /* @__PURE__ */ h("div", { "data-tx-row": A, "data-sentence": W.sentenceId, className: `txline${V ? " txline--warm" : ""}${ce ? " txline--fixing" : ""}`, "aria-current": ce || void 0, style: { opacity: F }, onClick: me, onMouseEnter: y && a ? () => ae(W.id) : void 0, onMouseLeave: y && a ? () => ae(null) : void 0, children: [
|
|
4096
4096
|
/* @__PURE__ */ h("div", { className: "txline__meta", children: [
|
|
4097
4097
|
/* @__PURE__ */ i("span", { className: "txline__at", children: yt(W.start) }),
|
|
@@ -4100,8 +4100,8 @@ function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a,
|
|
|
4100
4100
|
/* @__PURE__ */ i("span", { className: `txline__who lane-${ge}`, style: Ae.fg ? { color: Ae.fg } : void 0, children: Ge }),
|
|
4101
4101
|
Ae.hasVoice && /* @__PURE__ */ i(Oi, { color: Ae.fg ?? `var(--lane-${ge})` })
|
|
4102
4102
|
] }),
|
|
4103
|
-
|
|
4104
|
-
Z &&
|
|
4103
|
+
C && /* @__PURE__ */ i("span", { title: "Playing", style: { flex: "none", display: "inline-flex", alignItems: "center" }, children: /* @__PURE__ */ i(oe, { d: X.headphones, size: y ? 15 : 14, sw: 1.6, stroke: f && W.speaker >= 0 ? Ae.fg ?? `var(--lane-${ge})` : "var(--ink-45)" }) }),
|
|
4104
|
+
Z && g && /* @__PURE__ */ i(tl, { f: Z, desk: y, onOpen: a ? () => a(W, !0) : void 0 }),
|
|
4105
4105
|
ze && /* @__PURE__ */ i(nl, { alone: !0, onOpen: () => a == null ? void 0 : a(W, !1) })
|
|
4106
4106
|
] }),
|
|
4107
4107
|
/* @__PURE__ */ i("div", { className: "txline__text", children: Ve.map((ue, ie) => {
|
|
@@ -4111,20 +4111,20 @@ function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a,
|
|
|
4111
4111
|
"span",
|
|
4112
4112
|
{
|
|
4113
4113
|
className: "txw",
|
|
4114
|
-
title: o && !Ye ? c ? "Correct this word" :
|
|
4114
|
+
title: o && !Ye ? c ? "Correct this word" : C && j && n.seekWord ? "Play from this word" : "Play from this line" : C ? "" : "Play from this line",
|
|
4115
4115
|
onClick: o && !Ye ? (ke) => {
|
|
4116
4116
|
var Ce;
|
|
4117
4117
|
if (ke.stopPropagation(), c) {
|
|
4118
4118
|
o(W, ue);
|
|
4119
4119
|
return;
|
|
4120
4120
|
}
|
|
4121
|
-
if (j &&
|
|
4121
|
+
if (j && C) {
|
|
4122
4122
|
(Ce = n.seekWord) == null || Ce.call(n, ue);
|
|
4123
4123
|
return;
|
|
4124
4124
|
}
|
|
4125
4125
|
n.playRow(A);
|
|
4126
4126
|
} : void 0,
|
|
4127
|
-
style: { color: ye, opacity: q ? 0.45 : 1, fontWeight: 300, cursor: o && !Ye ? c || !
|
|
4127
|
+
style: { color: ye, opacity: q ? 0.45 : 1, fontWeight: 300, cursor: o && !Ye ? c || !C || !j || n.seekWord ? "pointer" : "default" : C ? "default" : "pointer", textShadow: R ? "0 0 2px currentColor, 0 0 4px currentColor" : "none", textDecorationLine: de || ne ? "underline" : "none", textDecorationStyle: ne ? "solid" : "dotted", textDecorationColor: ne ? "var(--brand)" : Oe ?? "currentColor", textDecorationThickness: de || ne ? "1.5px" : void 0, textUnderlineOffset: de || ne ? "3px" : void 0 },
|
|
4128
4128
|
children: ue.text
|
|
4129
4129
|
}
|
|
4130
4130
|
),
|
|
@@ -4137,7 +4137,7 @@ function ql({ model: t, rows: e, player: n, fixed: r, applied: s, onFixOpen: a,
|
|
|
4137
4137
|
/* @__PURE__ */ i("span", {}),
|
|
4138
4138
|
/* @__PURE__ */ i("span", {}),
|
|
4139
4139
|
/* @__PURE__ */ i("span", {})
|
|
4140
|
-
] }) }) : /* @__PURE__ */ i("div", { className: "txtail", style: { color: N }, children:
|
|
4140
|
+
] }) }) : /* @__PURE__ */ i("div", { className: "txtail", style: { color: N }, children: M }),
|
|
4141
4141
|
j && G === 1 && B("down")
|
|
4142
4142
|
] });
|
|
4143
4143
|
}
|
|
@@ -4166,18 +4166,18 @@ function Jl(t, e, n, r, s) {
|
|
|
4166
4166
|
}, [e, u]), U(() => {
|
|
4167
4167
|
const d = t.current;
|
|
4168
4168
|
if (!d) return;
|
|
4169
|
-
let
|
|
4169
|
+
let g = d.scrollTop, M = 0, N = 0;
|
|
4170
4170
|
const p = () => {
|
|
4171
4171
|
N = Date.now() + 1500;
|
|
4172
4172
|
}, y = (m) => {
|
|
4173
4173
|
m.buttons && p();
|
|
4174
4174
|
}, L = () => {
|
|
4175
|
-
const m = d.scrollTop, f = m -
|
|
4176
|
-
if (
|
|
4177
|
-
|
|
4175
|
+
const m = d.scrollTop, f = m - g;
|
|
4176
|
+
if (g = m, Date.now() > N) {
|
|
4177
|
+
M = 0;
|
|
4178
4178
|
return;
|
|
4179
4179
|
}
|
|
4180
|
-
|
|
4180
|
+
M = f < 0 == M < 0 ? M + f : f, M < -14 && !a.current ? (M = 0, s(!0)) : M > 56 && a.current && !o.current.trim() && (M = 0, s(!1));
|
|
4181
4181
|
};
|
|
4182
4182
|
return d.addEventListener("wheel", p, { passive: !0 }), d.addEventListener("touchmove", p, { passive: !0 }), d.addEventListener("pointermove", y), d.addEventListener("scroll", L, { passive: !0 }), () => {
|
|
4183
4183
|
d.removeEventListener("wheel", p), d.removeEventListener("touchmove", p), d.removeEventListener("pointermove", y), d.removeEventListener("scroll", L);
|
|
@@ -4241,16 +4241,16 @@ function nc(t) {
|
|
|
4241
4241
|
for (let T = 236; a.length < s; T ^= 253) o(T, 8);
|
|
4242
4242
|
const l = [];
|
|
4243
4243
|
for (let T = 0; T < a.length; T += 8) l.push(a.slice(T, T + 8).reduce((O, S) => O << 1 | S, 0));
|
|
4244
|
-
const c = tn.blocks[n], u = tn.perBlock[n], d = Math.floor(Di(n) / 8),
|
|
4244
|
+
const c = tn.blocks[n], u = tn.perBlock[n], d = Math.floor(Di(n) / 8), g = c - d % c, M = Math.floor(d / c), N = [], p = Xl(u);
|
|
4245
4245
|
for (let T = 0, O = 0; T < c; T++) {
|
|
4246
|
-
const S = l.slice(O, O +
|
|
4246
|
+
const S = l.slice(O, O + M - u + (T < g ? 0 : 1));
|
|
4247
4247
|
O += S.length;
|
|
4248
4248
|
const re = ec(S, p);
|
|
4249
|
-
T <
|
|
4249
|
+
T < g && S.push(0), N.push(S.concat(re));
|
|
4250
4250
|
}
|
|
4251
4251
|
const y = [];
|
|
4252
4252
|
for (let T = 0; T < N[0].length; T++) N.forEach((O, S) => {
|
|
4253
|
-
(T !==
|
|
4253
|
+
(T !== M - u || S >= g) && y.push(O[T]);
|
|
4254
4254
|
});
|
|
4255
4255
|
const L = Array.from({ length: r }, () => new Array(r).fill(!1)), m = Array.from({ length: r }, () => new Array(r).fill(!1)), f = (T, O, S) => {
|
|
4256
4256
|
L[O][T] = S, m[O][T] = !0;
|
|
@@ -4264,10 +4264,10 @@ function nc(t) {
|
|
|
4264
4264
|
}
|
|
4265
4265
|
};
|
|
4266
4266
|
I(3, 3), I(r - 4, 3), I(3, r - 4);
|
|
4267
|
-
const
|
|
4268
|
-
for (let T = 0; T <
|
|
4269
|
-
if (!(T === 0 && O === 0 || T === 0 && O ===
|
|
4270
|
-
for (let S = -2; S <= 2; S++) for (let re = -2; re <= 2; re++) f(
|
|
4267
|
+
const b = tc(n);
|
|
4268
|
+
for (let T = 0; T < b.length; T++) for (let O = 0; O < b.length; O++)
|
|
4269
|
+
if (!(T === 0 && O === 0 || T === 0 && O === b.length - 1 || T === b.length - 1 && O === 0))
|
|
4270
|
+
for (let S = -2; S <= 2; S++) for (let re = -2; re <= 2; re++) f(b[T] + re, b[O] + S, Math.max(Math.abs(re), Math.abs(S)) !== 1);
|
|
4271
4271
|
const D = (T) => {
|
|
4272
4272
|
const O = tn.formatBits << 3 | T;
|
|
4273
4273
|
let S = O;
|
|
@@ -4538,7 +4538,7 @@ function oc({ pos: t, transport: e, chip: n, voices: r, onShare: s, onFull: a, c
|
|
|
4538
4538
|
] });
|
|
4539
4539
|
}
|
|
4540
4540
|
const lc = { color: "rgba(255,255,255,.4)" };
|
|
4541
|
-
function Ei({ compact: t = !1, noFull: e = !1, page: n = !0, picture: r, title: s, desk: a, pos: o, sub: l, wait: c, pct: u, mute: d, cc:
|
|
4541
|
+
function Ei({ compact: t = !1, noFull: e = !1, page: n = !0, picture: r, title: s, desk: a, pos: o, sub: l, wait: c, pct: u, mute: d, cc: g, ad: M, chip: N, transport: p, picker: y, sheet: L, voices: m, voicesBtn: f, sheetOpen: I, onShare: b, onSettings: D, paused: V, copied: _, onTouch: ee, onClose: j }) {
|
|
4542
4542
|
const [E, Q] = z(() => !!ur());
|
|
4543
4543
|
U(() => {
|
|
4544
4544
|
const $ = () => Q(!!ur());
|
|
@@ -4614,7 +4614,7 @@ function Ei({ compact: t = !1, noFull: e = !1, page: n = !0, picture: r, title:
|
|
|
4614
4614
|
if ($.pointerType !== "mouse") return;
|
|
4615
4615
|
const he = Date.now();
|
|
4616
4616
|
!Pe.current && he - Se.current < 1e3 || (Se.current = he, k((ue) => ue + 1));
|
|
4617
|
-
}, W = !we && le, A = v(null),
|
|
4617
|
+
}, W = !we && le, A = v(null), C = l ? l.words.map(($) => $.dim ? 0 : 1).join("") + l.words.length + ":" + (l.cursor ?? "") : "";
|
|
4618
4618
|
Bt(() => {
|
|
4619
4619
|
const $ = A.current;
|
|
4620
4620
|
if (!$) return;
|
|
@@ -4625,7 +4625,7 @@ function Ei({ compact: t = !1, noFull: e = !1, page: n = !0, picture: r, title:
|
|
|
4625
4625
|
}
|
|
4626
4626
|
const Y = (de) => Math.round((de.getBoundingClientRect().top - $.getBoundingClientRect().top + $.scrollTop) / ie), R = Math.max(1, Math.round($.clientHeight / ie)), q = he ? ue.length ? Math.floor(Y(ue[ue.length - 1]) / R) * R * ie : 0 : Ue, ne = Math.max(0, Math.min(Ue, q));
|
|
4627
4627
|
Math.abs(ne - $.scrollTop) > 1 && ($.scrollTop = ne);
|
|
4628
|
-
}, [
|
|
4628
|
+
}, [C, W]);
|
|
4629
4629
|
const [H, ce] = z(!0), [F, me] = z(!1), Z = v(void 0);
|
|
4630
4630
|
U(() => () => window.clearTimeout(Z.current), []);
|
|
4631
4631
|
const ve = V != null && V.share ? V.share.url(H && V.share.at >= 1 ? Math.floor(V.share.at) : null) : "", ze = Ie(() => we && ve && !p.playing ? rc(ve) : "", [we, ve, p.playing]), Ge = () => {
|
|
@@ -4657,19 +4657,19 @@ function Ei({ compact: t = !1, noFull: e = !1, page: n = !0, picture: r, title:
|
|
|
4657
4657
|
] })
|
|
4658
4658
|
] }), ge = ($, he, ue, ie, fe, Ue = 0) => /* @__PURE__ */ i("button", { type: "button", className: "gfull__btn", title: $, "aria-label": $, onClick: ie, children: /* @__PURE__ */ i(oe, { d: he, size: (we ? 20 : _e ? 15 : 18) + Ue, sw: ue, style: fe }) }), Ye = /* @__PURE__ */ h("div", { className: "gfull__acts", children: [
|
|
4659
4659
|
f && /* @__PURE__ */ i(Ai, { v: f, size: we ? 20 : _e ? 15 : 18 }),
|
|
4660
|
-
|
|
4660
|
+
b && ge("Share", X.share, 1.6, b),
|
|
4661
4661
|
Js() && !e && ge(E ? "Exit full screen" : "Full screen", E ? sc : Si, 1.7, () => vn(!E)),
|
|
4662
4662
|
j && ge("Close player", X.close, 1.7, j)
|
|
4663
|
-
] }), Ve = (d ||
|
|
4663
|
+
] }), Ve = (d || g || D) && /* @__PURE__ */ h("div", { className: "gfull__top", children: [
|
|
4664
4664
|
d && ge(d.muted ? "Unmute" : "Mute", d.muted ? X.volumeOff : X.volume, 1.6, d.onToggle),
|
|
4665
|
-
|
|
4665
|
+
g && ge(g.on ? "Hide subtitles" : "Show subtitles", g.on ? X.cc : X.ccOff, 1.7, g.onToggle, void 0, 4),
|
|
4666
4666
|
D && ge("Settings", X.cog, 1.6, D)
|
|
4667
4667
|
] });
|
|
4668
4668
|
return /* @__PURE__ */ h(
|
|
4669
4669
|
"div",
|
|
4670
4670
|
{
|
|
4671
4671
|
ref: Te,
|
|
4672
|
-
className: `gfull${we ? " gfull--desk" : ""}${_e ? " gfull--mini" : ""}${Le ? " gfull--small" : ""}${te ? " gfull--swipe" : ""}${
|
|
4672
|
+
className: `gfull${we ? " gfull--desk" : ""}${_e ? " gfull--mini" : ""}${Le ? " gfull--small" : ""}${te ? " gfull--swipe" : ""}${M ? " gfull--ad" : ""}${S ? " gfull--calm" : ""}`,
|
|
4673
4673
|
"data-theme": "dark",
|
|
4674
4674
|
role: "dialog",
|
|
4675
4675
|
"aria-label": s,
|
|
@@ -4689,7 +4689,7 @@ function Ei({ compact: t = !1, noFull: e = !1, page: n = !0, picture: r, title:
|
|
|
4689
4689
|
/* @__PURE__ */ h("div", { className: `gfull__frame${W ? " gfull__frame--land" : ""}`, children: [
|
|
4690
4690
|
r,
|
|
4691
4691
|
/* @__PURE__ */ i("div", { className: "gfull__shade", "aria-hidden": "true" }),
|
|
4692
|
-
V && !
|
|
4692
|
+
V && !M && /* @__PURE__ */ h("div", { className: `gfull__pausedinfo${p.playing ? "" : " gfull__pausedinfo--on"}`, "aria-hidden": p.playing, children: [
|
|
4693
4693
|
/* @__PURE__ */ h("div", { className: "gfull__pausedtext", children: [
|
|
4694
4694
|
/* @__PURE__ */ h("div", { className: "gfull__pausedhead", children: [
|
|
4695
4695
|
(_e || Le) && /* @__PURE__ */ i("span", { className: "gfull__pausedmark", "aria-hidden": "true", children: /* @__PURE__ */ i(zr, { dark: !0, size: 20 }) }),
|
|
@@ -4853,7 +4853,7 @@ function _i(t, e, n) {
|
|
|
4853
4853
|
const r = new URL(t ?? _r), s = Nc(), a = new URL(pc, r);
|
|
4854
4854
|
e.url && a.searchParams.set("url", e.url), e.transcription && a.searchParams.set("transcription", e.transcription), e.ask && a.searchParams.set("ask", "1"), e.connect && a.searchParams.set("connect", "1"), a.searchParams.set("origin", window.location.origin), a.searchParams.set("nonce", s);
|
|
4855
4855
|
const o = 480, l = 640, c = Math.max(0, (window.screenX ?? 0) + ((window.outerWidth ?? o) - o) / 2), u = Math.max(0, (window.screenY ?? 0) + ((window.outerHeight ?? l) - l) / 2), d = window.open(a.toString(), "vocalstack-connect", `popup=yes,width=${o},height=${l},left=${Math.round(c)},top=${Math.round(u)}`);
|
|
4856
|
-
return d ? new Promise((
|
|
4856
|
+
return d ? new Promise((g, M) => {
|
|
4857
4857
|
let N = !1;
|
|
4858
4858
|
const p = (m) => {
|
|
4859
4859
|
N || (N = !0, window.removeEventListener("message", y), clearInterval(L), m());
|
|
@@ -4870,23 +4870,23 @@ function _i(t, e, n) {
|
|
|
4870
4870
|
return;
|
|
4871
4871
|
}
|
|
4872
4872
|
if (f.type === "vocalstack:started" || f.type === "vocalstack:token" || f.type === "vocalstack:found") {
|
|
4873
|
-
p(() =>
|
|
4873
|
+
p(() => g({ transcriptionId: String(f.transcriptionId), recordingId: String(f.recordingId), token: String(f.token), expiresAt: f.expiresAt ?? null }));
|
|
4874
4874
|
return;
|
|
4875
4875
|
}
|
|
4876
4876
|
if (f.type === "vocalstack:connected") {
|
|
4877
|
-
p(() =>
|
|
4877
|
+
p(() => g("connected"));
|
|
4878
4878
|
return;
|
|
4879
4879
|
}
|
|
4880
4880
|
if (f.type === "vocalstack:declined") {
|
|
4881
|
-
p(() =>
|
|
4881
|
+
p(() => g(null));
|
|
4882
4882
|
return;
|
|
4883
4883
|
}
|
|
4884
|
-
f.type === "vocalstack:error" && p(() =>
|
|
4884
|
+
f.type === "vocalstack:error" && p(() => M(new Error(typeof f.message == "string" && f.message ? f.message : "VocalStack could not start this transcription.")));
|
|
4885
4885
|
}
|
|
4886
4886
|
};
|
|
4887
4887
|
window.addEventListener("message", y);
|
|
4888
4888
|
const L = setInterval(() => {
|
|
4889
|
-
d.closed && p(() =>
|
|
4889
|
+
d.closed && p(() => g(null));
|
|
4890
4890
|
}, 500);
|
|
4891
4891
|
}) : Promise.reject(new Error("Your browser blocked the VocalStack window. Allow pop-ups for this site and try again."));
|
|
4892
4892
|
}
|
|
@@ -4917,23 +4917,23 @@ const wc = {
|
|
|
4917
4917
|
starting: "Starting the transcription…"
|
|
4918
4918
|
}, Lc = /^(https?:\/\/)?([\w-]+\.)+[a-z]{2,}(\/\S*)?$/i;
|
|
4919
4919
|
function vc({ options: t, onStarted: e, onReplay: n, onClose: r }) {
|
|
4920
|
-
const [s, a] = z(""), [o, l] = z(!1), [c, u] = z(null), [d,
|
|
4920
|
+
const [s, a] = z(""), [o, l] = z(!1), [c, u] = z(null), [d, g] = z(null);
|
|
4921
4921
|
U(() => {
|
|
4922
4922
|
const y = (L) => {
|
|
4923
4923
|
L.key === "Escape" && r();
|
|
4924
4924
|
};
|
|
4925
4925
|
return window.addEventListener("keydown", y), () => window.removeEventListener("keydown", y);
|
|
4926
4926
|
}, [r]);
|
|
4927
|
-
const
|
|
4927
|
+
const M = s.trim(), N = Lc.test(M), p = async () => {
|
|
4928
4928
|
if (!(!N || o)) {
|
|
4929
4929
|
l(!0), u(null);
|
|
4930
4930
|
try {
|
|
4931
|
-
const y = await mc(t.appUrl, /^https?:\/\//i.test(
|
|
4931
|
+
const y = await mc(t.appUrl, /^https?:\/\//i.test(M) ? M : `https://${M}`, g);
|
|
4932
4932
|
y && e(y);
|
|
4933
4933
|
} catch (y) {
|
|
4934
4934
|
u(y instanceof Error ? y.message : "Something went wrong. Please try again.");
|
|
4935
4935
|
} finally {
|
|
4936
|
-
l(!1),
|
|
4936
|
+
l(!1), g(null);
|
|
4937
4937
|
}
|
|
4938
4938
|
}
|
|
4939
4939
|
};
|
|
@@ -4973,9 +4973,9 @@ function Ui(t) {
|
|
|
4973
4973
|
}
|
|
4974
4974
|
const kc = { lang: null, subtitles: !0, speakerLabels: !1, wordHighlight: !0, translateAudio: !0, voices: "cloned", removeBackground: !1, muted: !1 };
|
|
4975
4975
|
function jc(t, e) {
|
|
4976
|
-
const n = Li(), [r, s] = gi(), [a, o] = z(null), [l, c] = z("main"), u = wr(n, t.lang), d = Ie(() => fi(n, "translation"), [n]),
|
|
4976
|
+
const n = Li(), [r, s] = gi(), [a, o] = z(null), [l, c] = z("main"), u = wr(n, t.lang), d = Ie(() => fi(n, "translation"), [n]), g = (_) => {
|
|
4977
4977
|
e({ lang: _ }), s(_);
|
|
4978
|
-
},
|
|
4978
|
+
}, M = Or({ open: a === "lang" || a === "settings" && l === "lang", onClose: () => a === "lang" ? o(null) : c("main"), value: t.lang, onSelect: g, languages: d, none: "As spoken", pinned: t.lang ? [t.lang] : [], recent: r, keepOpen: !0 }), N = () => {
|
|
4979
4979
|
o(null), c("main");
|
|
4980
4980
|
}, p = t.lang ? /* @__PURE__ */ i("span", { style: { fontSize: 19, lineHeight: 1 }, children: u.flag }) : /* @__PURE__ */ i(oe, { d: X.langAuto, size: 19, sw: 1.7 }), y = /* @__PURE__ */ i("button", { type: "button", className: "gfull__btn", "aria-label": `Language: ${t.lang ? u.label : "As spoken"}`, title: t.lang ? u.label : "As spoken", onClick: (_) => {
|
|
4981
4981
|
_.stopPropagation(), c("main"), o((ee) => ee === "lang" ? null : "lang");
|
|
@@ -4991,10 +4991,10 @@ function jc(t, e) {
|
|
|
4991
4991
|
/* @__PURE__ */ i("div", { className: "srow__s", children: ee })
|
|
4992
4992
|
] }),
|
|
4993
4993
|
j
|
|
4994
|
-
] }),
|
|
4995
|
-
/* @__PURE__ */ i("div", { style: { position: "sticky", top: 0, zIndex: 1, padding: "4px 14px 10px", background: "var(--vs-surface-raised)" }, children:
|
|
4996
|
-
|
|
4997
|
-
] }), D = l === "lang" ?
|
|
4994
|
+
] }), b = /* @__PURE__ */ h("div", { style: { display: "flex", flexDirection: "column" }, children: [
|
|
4995
|
+
/* @__PURE__ */ i("div", { style: { position: "sticky", top: 0, zIndex: 1, padding: "4px 14px 10px", background: "var(--vs-surface-raised)" }, children: M.search }),
|
|
4996
|
+
M.list
|
|
4997
|
+
] }), D = l === "lang" ? b : l === "subs" ? /* @__PURE__ */ h("div", { style: f, children: [
|
|
4998
4998
|
I("Show subtitles", "Captions over the video", /* @__PURE__ */ i(Nt, { checked: t.subtitles, onChange: (_) => e({ subtitles: _ }), label: "Show subtitles" })),
|
|
4999
4999
|
I("Show speaker labels", "Who is speaking, before each line", /* @__PURE__ */ i(Nt, { checked: t.speakerLabels, onChange: (_) => e({ speakerLabels: _ }), label: "Show speaker labels" })),
|
|
5000
5000
|
I("Highlight words", "Follow each word as it is spoken", /* @__PURE__ */ i(Nt, { checked: t.wordHighlight, onChange: (_) => e({ wordHighlight: _ }), label: "Highlight words" }))
|
|
@@ -5028,7 +5028,7 @@ function jc(t, e) {
|
|
|
5028
5028
|
L
|
|
5029
5029
|
] })
|
|
5030
5030
|
] }), V = /* @__PURE__ */ h(xe, { children: [
|
|
5031
|
-
/* @__PURE__ */ i(Vt, { open: a === "lang", onClose: N, title: "LANGUAGE", kind: "picker", sticky: !0, children: /* @__PURE__ */ i(Mr, { children:
|
|
5031
|
+
/* @__PURE__ */ i(Vt, { open: a === "lang", onClose: N, title: "LANGUAGE", kind: "picker", header: M.search, sticky: !0, children: /* @__PURE__ */ i(Mr, { children: M.list }) }),
|
|
5032
5032
|
/* @__PURE__ */ i(Vt, { open: a === "settings", onClose: N, title: { main: "SETTINGS", lang: "LANGUAGE", subs: "SUBTITLES", audio: "AUDIO" }[l], titleNode: l === "main" ? void 0 : m, kind: l === "main" ? "settings" : "settings vs-sheet--page", sticky: !0, children: /* @__PURE__ */ i(Mr, { children: D }) })
|
|
5033
5033
|
] });
|
|
5034
5034
|
return {
|
|
@@ -5114,7 +5114,7 @@ function bc() {
|
|
|
5114
5114
|
};
|
|
5115
5115
|
}, []), /* @__PURE__ */ i("div", { ref: t, className: `vsp-prov${e && r ? "" : " vsp-prov--still"}`, "aria-hidden": "true", children: /* @__PURE__ */ i("div", { className: "vsp-prov__plane", children: Array.from({ length: zc }, (a, o) => {
|
|
5116
5116
|
const l = Oc(o);
|
|
5117
|
-
return /* @__PURE__ */ i("div", { className: `vsp-prov__row${o % 2 ? " vsp-prov__row--rev" : ""}`, style: { animationDuration: `${80 + o * 11}s`, animationDelay: `-${o * 17}s` }, children: Array.from({ length: Ic }, (c, u) => l.map((d,
|
|
5117
|
+
return /* @__PURE__ */ i("div", { className: `vsp-prov__row${o % 2 ? " vsp-prov__row--rev" : ""}`, style: { animationDuration: `${80 + o * 11}s`, animationDelay: `-${o * 17}s` }, children: Array.from({ length: Ic }, (c, u) => l.map((d, g) => /* @__PURE__ */ i(Cc, { t: d }, `${u}-${g}`))) }, o);
|
|
5118
5118
|
}) }) });
|
|
5119
5119
|
}
|
|
5120
5120
|
const Ri = {
|
|
@@ -5147,8 +5147,8 @@ function xc(t, e) {
|
|
|
5147
5147
|
}).catch((y) => l(y instanceof Error ? y.message : "Something went wrong. Please try again.")).finally(() => {
|
|
5148
5148
|
r(!1), a(null);
|
|
5149
5149
|
});
|
|
5150
|
-
}, [t, n, e]),
|
|
5151
|
-
return { busy: n, status: s, err: o, connected: c, connect:
|
|
5150
|
+
}, [t, n, e]), g = Ke(() => d({ connect: !0 }), [d]), M = Ke((N, p) => d({ url: N, ask: p }), [d]);
|
|
5151
|
+
return { busy: n, status: s, err: o, connected: c, connect: g, start: M };
|
|
5152
5152
|
}
|
|
5153
5153
|
function Dc(t) {
|
|
5154
5154
|
return /\.(mp4|webm|mov|m4v|ogv|mkv)(\?|#|$)/i.test(t);
|
|
@@ -5163,21 +5163,21 @@ function Sc({ poster: t, src: e }) {
|
|
|
5163
5163
|
const Ac = { live: !1, atEdge: !1, edgeFrac: null, pct: 0, atLabel: "0:00", labelAt: () => "0:00", endLabel: "0:00", onSeek: () => {
|
|
5164
5164
|
} };
|
|
5165
5165
|
function Cn({ idle: t, poster: e, src: n, title: r, page: s, onAct: a, children: o }) {
|
|
5166
|
-
const l = jc(t.prefs, t.set), c = Ui(), u = v(null), [d,
|
|
5166
|
+
const l = jc(t.prefs, t.set), c = Ui(), u = v(null), [d, g] = z(!1);
|
|
5167
5167
|
Bt(() => {
|
|
5168
5168
|
var L;
|
|
5169
5169
|
const N = (L = u.current) == null ? void 0 : L.parentElement;
|
|
5170
5170
|
if (!N) return;
|
|
5171
|
-
const p = () =>
|
|
5171
|
+
const p = () => g(N.getBoundingClientRect().width < 560);
|
|
5172
5172
|
if (p(), typeof ResizeObserver > "u") return;
|
|
5173
5173
|
const y = new ResizeObserver(p);
|
|
5174
5174
|
return y.observe(N), () => y.disconnect();
|
|
5175
5175
|
}, []);
|
|
5176
|
-
const
|
|
5176
|
+
const M = { prevOn: !1, nextOn: !1, onPrev: () => {
|
|
5177
5177
|
}, onNext: () => {
|
|
5178
5178
|
}, playing: !1, playable: !0, playTitle: "Connect to play", onPlay: a };
|
|
5179
5179
|
return /* @__PURE__ */ h("div", { ref: u, className: `vsp-idleroot${d ? " vsp-idleroot--small" : ""}`, children: [
|
|
5180
|
-
/* @__PURE__ */ i(Ei, { page: s, picture: /* @__PURE__ */ i(Sc, { poster: e, src: n }), title: r, desk: c, pos: Ac, sub: null, mute: { muted: t.prefs.muted, onToggle: () => t.set({ muted: !t.prefs.muted }) }, cc: { on: t.prefs.subtitles, onToggle: () => t.set({ subtitles: !t.prefs.subtitles }) }, chip: l.chip, transport:
|
|
5180
|
+
/* @__PURE__ */ i(Ei, { page: s, picture: /* @__PURE__ */ i(Sc, { poster: e, src: n }), title: r, desk: c, pos: Ac, sub: null, mute: { muted: t.prefs.muted, onToggle: () => t.set({ muted: !t.prefs.muted }) }, cc: { on: t.prefs.subtitles, onToggle: () => t.set({ subtitles: !t.prefs.subtitles }) }, chip: l.chip, transport: M, picker: l.sheets, sheet: null, voices: null, voicesBtn: null, sheetOpen: l.sheetOpen, onSettings: l.openSettings, onShare: () => Ar(t.shareUrl ?? window.location.href, r), copied: null, onTouch: () => {
|
|
5181
5181
|
} }),
|
|
5182
5182
|
!l.sheetOpen && /* @__PURE__ */ i("div", { className: "vsp-idle", "data-theme": "dark", children: /* @__PURE__ */ i("div", { className: "vsp-idle__box", children: o }) })
|
|
5183
5183
|
] });
|
|
@@ -5201,7 +5201,7 @@ function Ec({ idle: t, src: e, ask: n, connect: r, page: s, poster: a = null, on
|
|
|
5201
5201
|
] });
|
|
5202
5202
|
}
|
|
5203
5203
|
function _c({ idle: t, connect: e, page: n, poster: r = null, onPick: s }) {
|
|
5204
|
-
const [a, o] = z(""), l = v(null), c = v(null), u = a.trim(), d = ei.test(u),
|
|
5204
|
+
const [a, o] = z(""), l = v(null), c = v(null), u = a.trim(), d = ei.test(u), g = () => {
|
|
5205
5205
|
if (!d || e.busy) return;
|
|
5206
5206
|
const p = /^https?:\/\//i.test(u) ? u : `https://${u}`;
|
|
5207
5207
|
s(p), e.start(p, !1);
|
|
@@ -5211,9 +5211,9 @@ function _c({ idle: t, connect: e, page: n, poster: r = null, onPick: s }) {
|
|
|
5211
5211
|
/* @__PURE__ */ i(Pi, { connect: e, onClick: e.connect, label: "Connect to VocalStack" }),
|
|
5212
5212
|
!e.busy && /* @__PURE__ */ i("div", { className: "vsp-idle__note", children: "Connect your VocalStack account to watch any video with subtitles and spoken translations." })
|
|
5213
5213
|
] });
|
|
5214
|
-
const
|
|
5214
|
+
const M = () => {
|
|
5215
5215
|
var p;
|
|
5216
|
-
d ?
|
|
5216
|
+
d ? g() : (p = l.current) == null || p.focus();
|
|
5217
5217
|
}, N = (p) => {
|
|
5218
5218
|
const y = p.trim();
|
|
5219
5219
|
if (!ei.test(y) || e.busy || y === c.current) return;
|
|
@@ -5221,9 +5221,9 @@ function _c({ idle: t, connect: e, page: n, poster: r = null, onPick: s }) {
|
|
|
5221
5221
|
const L = /^https?:\/\//i.test(y) ? y : `https://${y}`;
|
|
5222
5222
|
s(L), e.start(L, !1);
|
|
5223
5223
|
};
|
|
5224
|
-
return /* @__PURE__ */ h(Cn, { idle: t, poster: r, src: null, title: "VocalStack", page: n, onAct:
|
|
5224
|
+
return /* @__PURE__ */ h(Cn, { idle: t, poster: r, src: null, title: "VocalStack", page: n, onAct: M, children: [
|
|
5225
5225
|
/* @__PURE__ */ i("form", { className: "vsp-idle__form", onSubmit: (p) => {
|
|
5226
|
-
p.preventDefault(),
|
|
5226
|
+
p.preventDefault(), g();
|
|
5227
5227
|
}, children: /* @__PURE__ */ h("span", { className: "vsp-idle__field", children: [
|
|
5228
5228
|
/* @__PURE__ */ i(oe, { d: X.link, size: 16, sw: 1.8 }),
|
|
5229
5229
|
/* @__PURE__ */ i("input", { ref: l, className: "vsp-idle__input", type: "url", inputMode: "url", enterKeyHint: "go", autoComplete: "off", spellCheck: !1, placeholder: "Paste a video link", value: a, onChange: (p) => o(p.target.value), onPaste: (p) => {
|
|
@@ -5322,30 +5322,30 @@ const Kc = fa(function(e, n) {
|
|
|
5322
5322
|
U(() => {
|
|
5323
5323
|
o != null && o.id && a({ id: o.id, token: e.token });
|
|
5324
5324
|
}, [o == null ? void 0 : o.id]);
|
|
5325
|
-
const [l, c] = z(null), [u, d] = z(() => ({ ...kc, ...Object.fromEntries(Object.entries({ ...e.initial ?? {}, ...e.settings ?? {} }).filter(([, k]) => k !== void 0)) })), [
|
|
5326
|
-
d((ae) => ({ ...ae, ...k })),
|
|
5327
|
-
}, shareUrl: (K = e.shareUrl) == null ? void 0 : K.call(e, null) }, { muted: p, ...y } =
|
|
5325
|
+
const [l, c] = z(null), [u, d] = z(() => ({ ...kc, ...Object.fromEntries(Object.entries({ ...e.initial ?? {}, ...e.settings ?? {} }).filter(([, k]) => k !== void 0)) })), [g, M] = z({}), N = { prefs: u, set: (k) => {
|
|
5326
|
+
d((ae) => ({ ...ae, ...k })), M((ae) => ({ ...ae, ...k }));
|
|
5327
|
+
}, shareUrl: (K = e.shareUrl) == null ? void 0 : K.call(e, null) }, { muted: p, ...y } = g;
|
|
5328
5328
|
U(() => {
|
|
5329
5329
|
c(null);
|
|
5330
5330
|
}, [e.id, e.src]);
|
|
5331
|
-
const L = e.src ?? l, m = !s.id && !!L && (l != null || o !== void 0), f = !s.id && !e.src && !l, I = wi({ id: s.id, token: s.token, baseUrl: e.baseUrl, listen: s.listen }), { source:
|
|
5331
|
+
const L = e.src ?? l, m = !s.id && !!L && (l != null || o !== void 0), f = !s.id && !e.src && !l, I = wi({ id: s.id, token: s.token, baseUrl: e.baseUrl, listen: s.listen }), { source: b, gone: D, error: V, reload: _ } = Ao(I, s.id), ee = Eo(I, (b == null ? void 0 : b.recording.id) ?? null), j = Ie(() => Do(I, ee), [I, ee]);
|
|
5332
5332
|
U(() => {
|
|
5333
5333
|
var k;
|
|
5334
|
-
|
|
5335
|
-
}, [
|
|
5334
|
+
b && ((k = e.onSource) == null || k.call(e, b));
|
|
5335
|
+
}, [b]), U(() => {
|
|
5336
5336
|
var k;
|
|
5337
5337
|
V && ((k = e.onError) == null || k.call(e, V));
|
|
5338
5338
|
}, [V]);
|
|
5339
5339
|
const E = Ui(e.desk), Q = (e.layout ?? "embed") === "embed", T = e.appUrl ?? (e.endCard ? e.endCard.appUrl : void 0), O = Ke((k) => a({ id: k.transcriptionId, token: null, listen: { transcriptionId: k.transcriptionId, recordingId: k.recordingId, token: k.token } }), []), S = xc(T, O), re = v(null);
|
|
5340
|
-
return U(() => (Ks(Q ? re.current : null), () => Ks(null)), [Q]), /* @__PURE__ */ i(Oo, { value: j, children: /* @__PURE__ */ i("div", { ref: re, className: `vsp${Q ? " vsp--embed" : ""}${e.className ? ` ${e.className}` : ""}`, "data-theme": (e.mode ?? "video") === "video" || e.dark ? "dark" : "light", "data-mode": (e.mode ?? "video") === "video" ? "video" : "transcript", children: f ? /* @__PURE__ */ i(_c, { idle: N, connect: S, page: !Q, poster: e.poster ?? null, onPick: c }) : m ? /* @__PURE__ */ i(Ec, { idle: N, src: L, ask: !l, connect: S, page: !Q, poster: e.poster ?? null, onClear: l ? () => c(null) : void 0 }) : s.id ? V && !
|
|
5340
|
+
return U(() => (Ks(Q ? re.current : null), () => Ks(null)), [Q]), /* @__PURE__ */ i(Oo, { value: j, children: /* @__PURE__ */ i("div", { ref: re, className: `vsp${Q ? " vsp--embed" : ""}${e.className ? ` ${e.className}` : ""}`, "data-theme": (e.mode ?? "video") === "video" || e.dark ? "dark" : "light", "data-mode": (e.mode ?? "video") === "video" ? "video" : "transcript", children: f ? /* @__PURE__ */ i(_c, { idle: N, connect: S, page: !Q, poster: e.poster ?? null, onPick: c }) : m ? /* @__PURE__ */ i(Ec, { idle: N, src: L, ask: !l, connect: S, page: !Q, poster: e.poster ?? null, onClear: l ? () => c(null) : void 0 }) : s.id ? V && !b ? /* @__PURE__ */ i(Yc, { idle: N, message: V.message, onRetry: _, page: !Q }) : /* @__PURE__ */ i(Qc, { ...e, initial: { ...e.initial ?? {}, ...y }, startMuted: p === !0, handle: r, id: s.id, api: j, shared: b, gone: D, loadError: V, reread: _, desk: E, dark: (e.mode ?? "video") === "video" || !!e.dark, onStarted: (k) => a({ id: k.transcriptionId, token: null, listen: { transcriptionId: k.transcriptionId, recordingId: k.recordingId, token: k.token } }) }, s.id) : /* @__PURE__ */ i("div", { className: "vsp-gate", "data-theme": "dark", children: /* @__PURE__ */ i("span", { className: "gfull__spin gfull__holdspin", "aria-label": "Loading" }) }) }) });
|
|
5341
5341
|
});
|
|
5342
5342
|
function Qc(t) {
|
|
5343
5343
|
var Ms, gs, fs, ps, Ns, ms, ys, Ts, ws, Ls, vs, ks, js, zs, Is, Os, Cs, bs, xs, Ds, Ss, As;
|
|
5344
|
-
const { api: e, shared: n, gone: r, desk: s, dark: a } = t, o = t.id ?? "", l = Ie(() => Pc(t), []), u = (t.mode ?? "video") === "video", [d,
|
|
5344
|
+
const { api: e, shared: n, gone: r, desk: s, dark: a } = t, o = t.id ?? "", l = Ie(() => Pc(t), []), u = (t.mode ?? "video") === "video", [d, g] = z(t.loadError);
|
|
5345
5345
|
U(() => {
|
|
5346
|
-
t.loadError &&
|
|
5346
|
+
t.loadError && g(t.loadError);
|
|
5347
5347
|
}, [t.loadError]);
|
|
5348
|
-
const [
|
|
5348
|
+
const [M, N] = z("none"), [p, y] = z(!1), [L, m] = z(""), [f, I] = Ul(), [b, D] = z(null), [V, _] = z(u ? "listen" : "read"), [ee, j] = z(!1), E = v(null), Q = v(/* @__PURE__ */ new Map()), [T, O] = z("main"), S = (w) => {
|
|
5349
5349
|
const Ne = document.querySelector(".vs-sheet--settings"), Qe = Ne == null ? void 0 : Ne.parentElement;
|
|
5350
5350
|
Ne && Qe && T === "main" && w !== "main" && Qe.style.setProperty("--vs-sheet-top", `${Math.round(Ne.getBoundingClientRect().top - Qe.getBoundingClientRect().top)}px`), O(w);
|
|
5351
5351
|
};
|
|
@@ -5368,7 +5368,7 @@ function Qc(t) {
|
|
|
5368
5368
|
}, [A == null ? void 0 : A.voices]), U(() => {
|
|
5369
5369
|
(A == null ? void 0 : A.removeBackground) !== void 0 && W(A.removeBackground);
|
|
5370
5370
|
}, [A == null ? void 0 : A.removeBackground]);
|
|
5371
|
-
const
|
|
5371
|
+
const C = { language: !0, subtitles: !0, audio: !0, export: !0, share: !0, fullscreen: !0, settings: !0, ...t.controls ?? {} }, H = u && !we;
|
|
5372
5372
|
U(() => {
|
|
5373
5373
|
if (!t.syncUrl) return;
|
|
5374
5374
|
const w = new URL(window.location.href);
|
|
@@ -5381,10 +5381,10 @@ function Qc(t) {
|
|
|
5381
5381
|
onFrame: (w) => {
|
|
5382
5382
|
w.type === "job.progress" && D({ state: w.state, processedS: w.processedS ?? 0, totalS: w.totalS ?? null, segmentsDone: w.segmentsDone ?? 0, segmentsTotal: w.segmentsTotal ?? null, pct: w.pct ?? 0, error: w.error ?? null });
|
|
5383
5383
|
}
|
|
5384
|
-
}), ge = Ie(() => po(ce).filter((w) => !w.suppressed), [ce]), Ye = Po((n == null ? void 0 : n.job) ?? null), Ve = ["done", "failed", "stopped"].includes(or((Ye == null ? void 0 : Ye.state) ?? ((Ms = n == null ? void 0 : n.job) == null ? void 0 : Ms.state))), $ = Ve ? Ye :
|
|
5384
|
+
}), ge = Ie(() => po(ce).filter((w) => !w.suppressed), [ce]), Ye = Po((n == null ? void 0 : n.job) ?? null), Ve = ["done", "failed", "stopped"].includes(or((Ye == null ? void 0 : Ye.state) ?? ((Ms = n == null ? void 0 : n.job) == null ? void 0 : Ms.state))), $ = Ve ? Ye : b ?? Ye, he = !!b && !["done", "failed", "stopped"].includes(or(b.state)), ue = v(0);
|
|
5385
5385
|
U(() => {
|
|
5386
5386
|
!Ve || !he || Date.now() - ue.current < 1e4 || (ue.current = Date.now(), t.reread());
|
|
5387
|
-
}, [Ve, he,
|
|
5387
|
+
}, [Ve, he, b == null ? void 0 : b.state, b == null ? void 0 : b.processedS, o]);
|
|
5388
5388
|
const ie = or(($ == null ? void 0 : $.state) ?? ((gs = n == null ? void 0 : n.job) == null ? void 0 : gs.state)), fe = !!ae && (ie === "transcribing" || ie === "queued"), Ue = u && !r && (!n || (fe || ie === "cropping") && ge.length === 0), Y = fe ? ($ == null ? void 0 : $.pct) ?? 0 : 100, R = $o(n == null ? void 0 : n.job, $) ?? (k == null ? void 0 : k.mediaDurationS) ?? null, q = ((fs = ce.segments.values().next().value) == null ? void 0 : fs.language) ?? (k == null ? void 0 : k.spokenLanguage) ?? null, ne = n != null && n.sharedBy ? `Shared by ${n.sharedBy}` : "", de = ((ms = (Ns = (ps = n == null ? void 0 : n.job) == null ? void 0 : ps.source) == null ? void 0 : Ns.name) == null ? void 0 : ms.trim()) || null, Oe = n ? ((ys = n.name) == null ? void 0 : ys.trim()) || de : null, ye = !!((Ts = n == null ? void 0 : n.job) != null && Ts.hasAudio), ke = (ws = n == null ? void 0 : n.job) == null ? void 0 : ws.source, Ce = !ye && !!ke && (ke.kind !== "url" || ke.bytes != null) && (ie === "transcribing" || ie === "queued" || ie === "done"), Ze = ae && (n != null && n.allowDownload) && ye ? ba(e.origin, ae, e.cred) : ae && (n != null && n.allowDownload) && Ce ? nr(e.origin, ae, "source", e.cred) : null, $e = ge[ge.length - 1], ot = $e ? ((Ls = $e.words[$e.words.length - 1]) == null ? void 0 : Ls.end) ?? $e.start : 0, rt = u && fe ? Math.max(ot, ($ == null ? void 0 : $.processedS) ?? 0) : null, gt = Vl(Ze, (ye || Ce) && !!(n != null && n.allowDownload), ge, R, Ce ? ((ks = (vs = n == null ? void 0 : n.job) == null ? void 0 : vs.crop) == null ? void 0 : ks.startS) ?? 0 : 0, rt), be = ((zs = (js = n == null ? void 0 : n.job) == null ? void 0 : js.source) == null ? void 0 : zs.kind) === "url" ? zi(n.job.source.url) : null, st = Bl(ge, R, ((Os = (Is = n == null ? void 0 : n.job) == null ? void 0 : Is.crop) == null ? void 0 : Os.startS) ?? 0, rt), He = !!be, it = He ? st.player : gt, lt = Li(), Ht = v(null), se = Zl({ forcedVoice: t.voice ?? null, recordingId: ae, model: ce, rows: ge, lenS: R, ended: !!ae && !fe, cred: e.cred, langs: lt, srcLang: q, canTranslate: !!(n != null && n.allowTranslate), pickedLang: te, setPickedLang: G, side: s && !re ? Gl : void 0, hearOriginal: H, timed: !!be, stockVoices: u && !Pe, stickyPicker: u, pickerBusy: Ht.current }), Wt = v(null);
|
|
5389
5389
|
U(() => {
|
|
5390
5390
|
!ae || Wt.current === J || (Wt.current = J, Z(J));
|
|
@@ -5421,13 +5421,13 @@ function Qc(t) {
|
|
|
5421
5421
|
}
|
|
5422
5422
|
Sr(nr(e.origin, ae, "source", e.cred)), I(`Downloading ${Je} — the full audio, since the transcript is still being written.`);
|
|
5423
5423
|
} catch (w) {
|
|
5424
|
-
throw
|
|
5424
|
+
throw g(Tt(w)), w;
|
|
5425
5425
|
}
|
|
5426
5426
|
}, bt = (w) => {
|
|
5427
5427
|
if (!ae) return;
|
|
5428
5428
|
const Ne = Tr.find((Fe) => Fe.key === w).name, Qe = vt ? ` in ${vt}` : "";
|
|
5429
5429
|
return Vo(e, ae, w, { lang: dt }).then(() => I(fe ? `${Ne} exported${Qe} for the first ${ge.length} segments — the rest is still transcribing.` : `${Ne} exported${Qe}.`)).catch((Fe) => {
|
|
5430
|
-
throw
|
|
5430
|
+
throw g(Tt(Fe)), Fe;
|
|
5431
5431
|
});
|
|
5432
5432
|
}, _t = fe ? "MORE TO COME…" : "END OF TRANSCRIPT", ht = fe ? "var(--brand)" : "var(--ink-28)", Yt = Qo($, ge.length), Xe = x.has && (!se.relang || !!be), qe = v(x);
|
|
5433
5433
|
qe.current = x;
|
|
@@ -5528,7 +5528,7 @@ function Qc(t) {
|
|
|
5528
5528
|
ho(Xe ? { playing: x.playing, toggle: () => {
|
|
5529
5529
|
We.current = !0, x.toggle();
|
|
5530
5530
|
}, next: x.next, prev: x.prev } : null, Oe);
|
|
5531
|
-
const Vn = { background: "transparent", color: "#eef0f8", width: 74, justifyContent: "center", boxSizing: "border-box" }, Hn = (w, Ne) => !Re.can || !
|
|
5531
|
+
const Vn = { background: "transparent", color: "#eef0f8", width: 74, justifyContent: "center", boxSizing: "border-box" }, Hn = (w, Ne) => !Re.can || !C.language ? null : u ? /* @__PURE__ */ h("button", { type: "button", className: "gfull__btn", title: Ot ? `${Re.label ?? Re.code}: still being prepared` : Re.label ?? Re.code, "aria-label": `Language: ${Re.label ?? Re.code}`, "aria-busy": Ot || void 0, onClick: () => {
|
|
5532
5532
|
j(!1), Re.onClick();
|
|
5533
5533
|
}, style: { position: "relative" }, children: [
|
|
5534
5534
|
/* @__PURE__ */ i("span", { style: { fontSize: Ne === "sm" ? 17 : 21, lineHeight: 1 }, children: Re.flag }),
|
|
@@ -5691,7 +5691,7 @@ function Qc(t) {
|
|
|
5691
5691
|
as("srt", "Subtitles", "SRT / VTT caption cues, ready for a video editor or a player"),
|
|
5692
5692
|
as("pdf", "PDF", "Formatted transcript in paragraphs, with timestamps and speaker labels")
|
|
5693
5693
|
] }) : /* @__PURE__ */ i("div", { style: Nn, children: [
|
|
5694
|
-
Re.can &&
|
|
5694
|
+
Re.can && C.language && /* @__PURE__ */ h("div", { className: "srow srow--tap", role: "button", onClick: () => S("lang"), children: [
|
|
5695
5695
|
/* @__PURE__ */ h("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5696
5696
|
/* @__PURE__ */ i("div", { className: "srow__t", children: "Language" }),
|
|
5697
5697
|
/* @__PURE__ */ i("div", { className: "srow__s", children: J ? `Translated to ${Re.label ?? J.toUpperCase()}` : "Original language" })
|
|
@@ -5699,21 +5699,21 @@ function Qc(t) {
|
|
|
5699
5699
|
/* @__PURE__ */ i("span", { style: { fontSize: 18, lineHeight: 1 }, children: Re.flag }),
|
|
5700
5700
|
pn
|
|
5701
5701
|
] }, "lang"),
|
|
5702
|
-
|
|
5702
|
+
C.subtitles && /* @__PURE__ */ h("div", { className: "srow srow--tap", role: "button", onClick: () => S("subs"), children: [
|
|
5703
5703
|
/* @__PURE__ */ h("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5704
5704
|
/* @__PURE__ */ i("div", { className: "srow__t", children: "Subtitles" }),
|
|
5705
5705
|
/* @__PURE__ */ i("div", { className: "srow__s", children: Ee ? "On · speaker labels and word highlighting" : "Off" })
|
|
5706
5706
|
] }),
|
|
5707
5707
|
pn
|
|
5708
5708
|
] }, "subs"),
|
|
5709
|
-
|
|
5709
|
+
C.audio && /* @__PURE__ */ h("div", { className: "srow srow--tap", role: "button", onClick: () => S("audio"), children: [
|
|
5710
5710
|
/* @__PURE__ */ h("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5711
5711
|
/* @__PURE__ */ i("div", { className: "srow__t", children: "Audio" }),
|
|
5712
5712
|
/* @__PURE__ */ i("div", { className: "srow__s", children: Fi })
|
|
5713
5713
|
] }),
|
|
5714
5714
|
pn
|
|
5715
5715
|
] }, "audio"),
|
|
5716
|
-
|
|
5716
|
+
C.export && Ft && !!ae && /* @__PURE__ */ h("div", { className: "srow srow--tap", role: "button", onClick: () => S("export"), children: [
|
|
5717
5717
|
/* @__PURE__ */ h("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
5718
5718
|
/* @__PURE__ */ h("div", { className: "srow__t", children: [
|
|
5719
5719
|
"Export",
|
|
@@ -5748,8 +5748,8 @@ function Qc(t) {
|
|
|
5748
5748
|
desk: s,
|
|
5749
5749
|
pos: Rr,
|
|
5750
5750
|
mute: { muted: x.muted, onToggle: An },
|
|
5751
|
-
cc:
|
|
5752
|
-
noFull: !
|
|
5751
|
+
cc: C.subtitles ? { on: Ee, onToggle: () => Le((w) => !w) } : void 0,
|
|
5752
|
+
noFull: !C.fullscreen,
|
|
5753
5753
|
ad: Dn,
|
|
5754
5754
|
wait: tt && !Rn ? /* @__PURE__ */ i(fc, { state: tt, line: cn ? Kr.map((w) => w.t + w.sp).join("") : null, onRetry: Gi, onOriginal: Zi }) : x.edgeWait ? `Transcribing ${Math.round(Y)}% — it plays on as more is written` : null,
|
|
5755
5755
|
pct: fe ? Math.round(Y) : null,
|
|
@@ -5761,12 +5761,12 @@ function Qc(t) {
|
|
|
5761
5761
|
voices: null,
|
|
5762
5762
|
voicesBtn: u ? null : Hr,
|
|
5763
5763
|
sheetOpen: se.sheetsOpen || ee,
|
|
5764
|
-
onShare: u &&
|
|
5765
|
-
onSettings: u &&
|
|
5764
|
+
onShare: u && C.share ? ra : void 0,
|
|
5765
|
+
onSettings: u && C.settings ? () => {
|
|
5766
5766
|
se.closePicker(), j((w) => !w);
|
|
5767
5767
|
} : void 0,
|
|
5768
5768
|
compact: !!t.compact,
|
|
5769
|
-
paused: { title: Je, summary: Be.state === "ready" ? Be.summary ?? null : null, share:
|
|
5769
|
+
paused: { title: Je, summary: Be.state === "ready" ? Be.summary ?? null : null, share: C.share && (t.shareUrl || !t.onShare) ? { url: ns, at: x.t } : null },
|
|
5770
5770
|
copied: ea ? /* @__PURE__ */ h("div", { className: "gfull__toast", "aria-live": "polite", children: [
|
|
5771
5771
|
/* @__PURE__ */ i(oe, { d: X.check, size: 13, sw: 2 }),
|
|
5772
5772
|
"Link copied"
|
|
@@ -5800,7 +5800,7 @@ function Qc(t) {
|
|
|
5800
5800
|
] }),
|
|
5801
5801
|
!s && /* @__PURE__ */ i("div", { className: "pubprog__bar", style: { marginTop: 8 }, children: /* @__PURE__ */ i("div", { style: { width: `${Y}%` } }) })
|
|
5802
5802
|
] }), Jn = r && /* @__PURE__ */ i("div", { className: "hint", style: { padding: "30px 20px", textAlign: "center", fontSize: 13 }, children: "This link is no longer shared. Ask the person who sent it for a new one." }), ls = /* @__PURE__ */ i(ql, { model: ce, rows: ge, player: x, tail: _t, tailFg: ht, running: fe, desk: s, feedRef: Ct, listener: !0, showLabels: hn, find: L, findOpen: !s && p, lang: P, warm: Zt, onVisible: De, wordHl: dn }), Xn = /* @__PURE__ */ i(Jo, { error: d ?? F ?? (Yn && re ? null : x.error) ?? se.error, onClose: () => {
|
|
5803
|
-
|
|
5803
|
+
g(null), me(), x.clearError(), se.clearError();
|
|
5804
5804
|
} }), cs = [R ? yt(R) : null, q ? q.toUpperCase() : null, ne || "Read-only copy"].filter(Boolean).join(" · "), us = (w) => /* @__PURE__ */ i("div", { className: "ctrans", children: se.noVoice ? se.noVoiceNote : /* @__PURE__ */ h(xe, { children: [
|
|
5805
5805
|
/* @__PURE__ */ h("div", { className: "ctrans__row", children: [
|
|
5806
5806
|
/* @__PURE__ */ i("span", { className: "ctrans__sp", "aria-hidden": "true" }),
|
|
@@ -5812,7 +5812,7 @@ function Qc(t) {
|
|
|
5812
5812
|
/* @__PURE__ */ i("span", { className: "ctrans__mute", children: on(36) })
|
|
5813
5813
|
] }),
|
|
5814
5814
|
/* @__PURE__ */ i("div", { className: "ctrans__scrub", children: $i(w) })
|
|
5815
|
-
] }) }), aa = kl("ga", { tabs: Qt, cur:
|
|
5815
|
+
] }) }), aa = kl("ga", { tabs: Qt, cur: M, pref: (As = Qt[0]) == null ? void 0 : As.key, onPick: N }), ds = Math.max(0, Math.min(100, Math.round(Y))), oa = Ue && /* @__PURE__ */ h("div", { className: "gfull gfull--hold", "data-theme": "dark", role: "status", "aria-live": "polite", children: [
|
|
5816
5816
|
be && /* @__PURE__ */ i("div", { className: "gfull__holdbg", style: { backgroundImage: `url(https://i.ytimg.com/vi/${be}/hqdefault.jpg)` } }),
|
|
5817
5817
|
/* @__PURE__ */ i("div", { className: "gfull__hold", children: n ? /* @__PURE__ */ h(xe, { children: [
|
|
5818
5818
|
Je && /* @__PURE__ */ i("div", { className: "gfull__holdt", children: Je }),
|
|
@@ -5880,8 +5880,8 @@ function Qc(t) {
|
|
|
5880
5880
|
] });
|
|
5881
5881
|
}
|
|
5882
5882
|
const ua = Qt.length > 0 && !p && /* @__PURE__ */ i("div", { className: "txwidget", children: /* @__PURE__ */ h(Es, { panel: !0, children: [
|
|
5883
|
-
/* @__PURE__ */ i(Ci, { tabs: Qt, current:
|
|
5884
|
-
|
|
5883
|
+
/* @__PURE__ */ i(Ci, { tabs: Qt, current: M, onPick: N, gap: M !== "none" }),
|
|
5884
|
+
M !== "none" && Ur(M)
|
|
5885
5885
|
] }) });
|
|
5886
5886
|
return /* @__PURE__ */ h(xe, { children: [
|
|
5887
5887
|
/* @__PURE__ */ i(cc, { dark: a, title: n ? Je : "", subline: n ? cs : "", onOptions: () => j(!0), optionsActive: ee }),
|