@banou/media-player 0.10.20 → 0.10.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -22
- package/dist/audio/loudness-analysis.d.ts +38 -0
- package/dist/audio/playback-tap.d.ts +11 -0
- package/dist/audio/volume-normalizer.d.ts +4 -2
- package/dist/engine/index.d.ts +1 -1
- package/dist/engine/index.js +1 -1
- package/dist/engine/playback.d.ts +21 -0
- package/dist/{engine-C4Gj_4zs.js → engine-Cr_7OImR.js} +120 -103
- package/dist/index.d.ts +1 -1
- package/dist/index.js +929 -651
- package/dist/react/hooks/use-playback.d.ts +2 -1
- package/dist/react/hooks/use-volume-normalizer.d.ts +9 -1
- package/dist/react/video-player.d.ts +19 -7
- package/dist/utils/source.d.ts +6 -1
- package/dist/volume-normalizer-worklet.js +1200 -78
- package/package.json +3 -3
- package/src/lib/audio/loudness-analysis.ts +307 -0
- package/src/lib/audio/playback-tap.ts +37 -0
- package/src/lib/audio/volume-normalizer-worklet.d.ts +49 -0
- package/src/lib/audio/volume-normalizer-worklet.js +1200 -78
- package/src/lib/audio/volume-normalizer.ts +5 -3
- package/src/lib/engine/index.ts +1 -1
- package/src/lib/engine/playback.ts +21 -1
- package/src/lib/index.tsx +1 -0
- package/src/lib/react/hooks/use-playback.ts +5 -1
- package/src/lib/react/hooks/use-volume-normalizer.ts +40 -2
- package/src/lib/react/video-player.tsx +55 -15
- package/src/lib/utils/source.ts +6 -2
package/dist/index.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Children as
|
|
3
|
-
import { css as
|
|
4
|
-
import { createPlayer as
|
|
5
|
-
import { definePlayerFeature as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
1
|
+
import { c as e, l as t, n, o as r, r as i, s as a, t as o, u as s } from "./engine-Cr_7OImR.js";
|
|
2
|
+
import { Children as c, Fragment as l, isValidElement as u, useCallback as d, useEffect as f, useMemo as p, useRef as m, useState as h, useSyncExternalStore as g } from "react";
|
|
3
|
+
import { css as _, keyframes as v } from "@emotion/react";
|
|
4
|
+
import { createPlayer as y, useContainerAttach as b, useMediaAttach as x } from "@videojs/react";
|
|
5
|
+
import { definePlayerFeature as S, videoFeatures as C } from "@videojs/core/dom";
|
|
6
|
+
import { makeRemuxer as w } from "libav-wasm";
|
|
7
|
+
import { createMediaElementSource as T } from "@banou/ponyfill/web-audio";
|
|
8
|
+
import { Fragment as E, jsx as D, jsxs as O } from "@emotion/react/jsx-runtime";
|
|
9
|
+
import { Captions as k, CaptionsOff as A, Check as j, ChevronLeft as M, ChevronRight as N, Copy as P, Maximize as F, Minimize as I, Pause as L, Play as R, RotateCcw as z, Settings as B, TriangleAlert as V, Volume1 as H, Volume2 as ee, VolumeX as te } from "lucide-react";
|
|
10
|
+
import { Tooltip as ne } from "react-tooltip";
|
|
10
11
|
//#region src/lib/react/source-feature.ts
|
|
11
|
-
var
|
|
12
|
+
var U = {
|
|
12
13
|
indexes: [],
|
|
13
14
|
chapters: [],
|
|
14
15
|
thumbnails: [],
|
|
@@ -33,19 +34,19 @@ var ne = {
|
|
|
33
34
|
playbackErrors: [],
|
|
34
35
|
ready: !1,
|
|
35
36
|
setSourceState: () => {}
|
|
36
|
-
},
|
|
37
|
+
}, W = S({
|
|
37
38
|
name: "source",
|
|
38
|
-
state: () => ({ ...
|
|
39
|
+
state: () => ({ ...U }),
|
|
39
40
|
attach({ set: e }) {
|
|
40
41
|
e({
|
|
41
42
|
setSourceState: (t) => e(t),
|
|
42
43
|
setHideUI: (t) => e({ hideUI: t })
|
|
43
44
|
});
|
|
44
45
|
}
|
|
45
|
-
}),
|
|
46
|
-
features: [...
|
|
46
|
+
}), G = y({
|
|
47
|
+
features: [...C, W],
|
|
47
48
|
displayName: "MediaPlayer"
|
|
48
|
-
}),
|
|
49
|
+
}), K = G.usePlayer, re = (e) => {
|
|
49
50
|
if (e && e !== "und") try {
|
|
50
51
|
return new Intl.DisplayNames([navigator.language || "en"], {
|
|
51
52
|
type: "language",
|
|
@@ -54,13 +55,13 @@ var ne = {
|
|
|
54
55
|
} catch {
|
|
55
56
|
return;
|
|
56
57
|
}
|
|
57
|
-
},
|
|
58
|
-
let t = e.map((e) =>
|
|
58
|
+
}, ie = (e) => e?.replace(/_/g, " ").trim() || void 0, q = (e) => {
|
|
59
|
+
let t = e.map((e) => re(e.language) ?? ie(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
|
|
59
60
|
...e,
|
|
60
61
|
[t]: (e[t] ?? 0) + 1
|
|
61
62
|
}), {});
|
|
62
63
|
return e.map((e, r) => {
|
|
63
|
-
let i = t[r], a =
|
|
64
|
+
let i = t[r], a = ie(e.title);
|
|
64
65
|
return {
|
|
65
66
|
track: e,
|
|
66
67
|
label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
|
|
@@ -75,92 +76,94 @@ var ne = {
|
|
|
75
76
|
1e3,
|
|
76
77
|
3e3,
|
|
77
78
|
1e4
|
|
78
|
-
],
|
|
79
|
+
], ae = 6e4, X = 500, oe = 15e3, se = (e) => e instanceof Error ? e.message : String(e), ce = (e) => {
|
|
79
80
|
let t = [], n = e?.cause;
|
|
80
81
|
for (let e = 0; n != null && e < 8; e++) {
|
|
81
82
|
if (typeof MediaError < "u" && n instanceof MediaError) {
|
|
82
83
|
t.push(`MediaError code ${n.code}${n.message ? `: ${n.message}` : ""}`);
|
|
83
84
|
break;
|
|
84
85
|
}
|
|
85
|
-
t.push(
|
|
86
|
+
t.push(se(n)), n = n?.cause;
|
|
86
87
|
}
|
|
87
88
|
return t.length ? t.join("\n") : void 0;
|
|
88
|
-
},
|
|
89
|
-
let
|
|
90
|
-
|
|
91
|
-
let [
|
|
89
|
+
}, le = (e, t, n, i) => {
|
|
90
|
+
let o = K(), { read: s, size: c, publicPath: l = "", libavWorkerUrl: u = "", jassubWorkerUrl: p = "", jassubWasmUrl: g = "", jassubLegacyWasmUrl: _, defaultFontUrl: v, bufferSize: y, autoplay: b = !1, chapters: x, seekPrepareBudgetMs: S = X } = n ?? {}, C = m(x);
|
|
91
|
+
C.current = x;
|
|
92
|
+
let [w, T] = h(void 0), [E, D] = h(0), O = m({
|
|
92
93
|
count: 0,
|
|
93
94
|
at: 0
|
|
94
|
-
}),
|
|
95
|
-
|
|
95
|
+
}), k = m(void 0);
|
|
96
|
+
f(() => (O.current = {
|
|
96
97
|
count: 0,
|
|
97
98
|
at: 0
|
|
98
|
-
},
|
|
99
|
-
|
|
100
|
-
}), [
|
|
101
|
-
let
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
let
|
|
106
|
-
|
|
107
|
-
let
|
|
99
|
+
}, o.setSourceState({ playbackErrors: [] }), () => {
|
|
100
|
+
k.current && clearTimeout(k.current);
|
|
101
|
+
}), [c]);
|
|
102
|
+
let A = m(null), j = m(null), M = m(!1), N = m(s);
|
|
103
|
+
N.current = s;
|
|
104
|
+
let P = m(n?.onSeek);
|
|
105
|
+
P.current = n?.onSeek;
|
|
106
|
+
let F = m(n?.onPlaybackError);
|
|
107
|
+
F.current = n?.onPlaybackError;
|
|
108
|
+
let I = m(i);
|
|
109
|
+
I.current = i;
|
|
110
|
+
let L = d((e) => {
|
|
108
111
|
let t = typeof e == "number" ? e : void 0;
|
|
109
|
-
|
|
110
|
-
}, [
|
|
111
|
-
let t =
|
|
112
|
-
if (!t ||
|
|
113
|
-
|
|
112
|
+
M.current = !0, o.setSourceState({ selectedSubtitleTrack: t }), A.current?.selectSubtitleStream(t);
|
|
113
|
+
}, [o]), R = d((e) => {
|
|
114
|
+
let t = A.current;
|
|
115
|
+
if (!t || S <= 0) {
|
|
116
|
+
o.seek(e);
|
|
114
117
|
return;
|
|
115
118
|
}
|
|
116
|
-
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(), i = !1,
|
|
117
|
-
if (!i && (i = !0,
|
|
119
|
+
let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(), i = !1, a = "prepared", s = () => {
|
|
120
|
+
if (!i && (i = !0, o.seek(e), n)) {
|
|
118
121
|
let n = t.videoElement, i = 0;
|
|
119
122
|
if (n) for (let t = 0; t < n.buffered.length; t++) n.buffered.start(t) <= e + 1 && e < n.buffered.end(t) && (i = n.buffered.end(t) - e);
|
|
120
|
-
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${
|
|
123
|
+
console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${a}, runway ${i.toFixed(1)}s${a === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
|
|
121
124
|
}
|
|
122
125
|
};
|
|
123
|
-
|
|
126
|
+
o.setSourceState({ seekingTo: e });
|
|
124
127
|
let c = t.videoElement, l = () => {
|
|
125
|
-
c?.removeEventListener("seeked", l), clearTimeout(u),
|
|
126
|
-
}, u = setTimeout(l,
|
|
128
|
+
c?.removeEventListener("seeked", l), clearTimeout(u), o.setSourceState({ seekingTo: void 0 });
|
|
129
|
+
}, u = setTimeout(l, oe);
|
|
127
130
|
c?.addEventListener("seeked", l);
|
|
128
131
|
let d = setTimeout(() => {
|
|
129
|
-
|
|
130
|
-
},
|
|
132
|
+
a = "deadline", s();
|
|
133
|
+
}, S);
|
|
131
134
|
t.prepareSeek(e).catch(() => {}).finally(() => {
|
|
132
135
|
clearTimeout(d), s();
|
|
133
136
|
});
|
|
134
|
-
}, [
|
|
135
|
-
typeof e == "number" && (
|
|
136
|
-
}, [
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
selectSubtitleTrack:
|
|
140
|
-
selectAudioTrack:
|
|
141
|
-
requestSeek:
|
|
137
|
+
}, [o, S]), z = d((e) => {
|
|
138
|
+
typeof e == "number" && (o.setSourceState({ selectedAudioTrack: e }), T(e));
|
|
139
|
+
}, [o]), B = K((e) => e.setSourceState);
|
|
140
|
+
f(() => {
|
|
141
|
+
B({
|
|
142
|
+
selectSubtitleTrack: L,
|
|
143
|
+
selectAudioTrack: z,
|
|
144
|
+
requestSeek: R
|
|
142
145
|
});
|
|
143
146
|
}, [
|
|
144
|
-
|
|
145
|
-
F,
|
|
147
|
+
B,
|
|
146
148
|
L,
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
149
|
+
z,
|
|
150
|
+
R
|
|
151
|
+
]), f(() => {
|
|
152
|
+
if (!e || !t || !c || !s) return;
|
|
153
|
+
let n = !1;
|
|
154
|
+
o.setSourceState({
|
|
152
155
|
playbackError: null,
|
|
153
156
|
ready: !1
|
|
154
157
|
});
|
|
155
|
-
let
|
|
156
|
-
let r = Date.now(), i =
|
|
157
|
-
if (c && c.message === i && c.detail ===
|
|
158
|
+
let i = (t, n) => {
|
|
159
|
+
let r = Date.now(), i = se(t), a = ce(t), s = o.playbackErrors, c = s[s.length - 1];
|
|
160
|
+
if (c && c.message === i && c.detail === a && c.recovered === n) {
|
|
158
161
|
let e = {
|
|
159
162
|
...c,
|
|
160
163
|
count: c.count + 1,
|
|
161
164
|
lastAt: r
|
|
162
165
|
};
|
|
163
|
-
|
|
166
|
+
o.setSourceState({ playbackErrors: [...s.slice(0, -1), e] });
|
|
164
167
|
return;
|
|
165
168
|
}
|
|
166
169
|
let l = {
|
|
@@ -169,110 +172,111 @@ var ne = {
|
|
|
169
172
|
count: 1,
|
|
170
173
|
atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
|
|
171
174
|
message: i,
|
|
172
|
-
detail:
|
|
175
|
+
detail: a,
|
|
173
176
|
recovered: n
|
|
174
177
|
};
|
|
175
|
-
|
|
178
|
+
o.setSourceState({ playbackErrors: [...s, l] });
|
|
176
179
|
}, d = (e) => {
|
|
177
|
-
if (
|
|
178
|
-
let t =
|
|
179
|
-
if (
|
|
180
|
+
if (n) return;
|
|
181
|
+
let t = r(e);
|
|
182
|
+
if (i(e, t), t) {
|
|
180
183
|
let t = performance.now();
|
|
181
|
-
t -
|
|
184
|
+
t - O.current.at > ae && (O.current = {
|
|
182
185
|
count: 0,
|
|
183
186
|
at: t
|
|
184
187
|
});
|
|
185
|
-
let n = Y[Math.min(
|
|
186
|
-
|
|
187
|
-
count:
|
|
188
|
+
let n = Y[Math.min(O.current.count, Y.length - 1)];
|
|
189
|
+
O.current = {
|
|
190
|
+
count: O.current.count + 1,
|
|
188
191
|
at: t
|
|
189
|
-
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e),
|
|
192
|
+
}, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), k.current && clearTimeout(k.current), k.current = setTimeout(() => D((e) => e + 1), n);
|
|
190
193
|
return;
|
|
191
194
|
}
|
|
192
|
-
console.error("playback failed", e),
|
|
195
|
+
console.error("playback failed", e), o.setSourceState({ playbackError: e }), F.current?.(e);
|
|
193
196
|
};
|
|
194
197
|
return (async () => {
|
|
195
198
|
try {
|
|
196
|
-
let
|
|
199
|
+
let r = await a({
|
|
197
200
|
videoElement: e,
|
|
198
201
|
subtitleContainer: t,
|
|
199
|
-
read: (e, t) =>
|
|
200
|
-
length:
|
|
201
|
-
publicPath:
|
|
202
|
-
libavWorkerUrl:
|
|
203
|
-
jassubWorkerUrl:
|
|
204
|
-
jassubWasmUrl:
|
|
205
|
-
jassubLegacyWasmUrl:
|
|
206
|
-
defaultFontUrl:
|
|
207
|
-
bufferSize:
|
|
208
|
-
audioStreamIndex:
|
|
202
|
+
read: (e, t) => N.current(e, t),
|
|
203
|
+
length: c,
|
|
204
|
+
publicPath: l,
|
|
205
|
+
libavWorkerUrl: u,
|
|
206
|
+
jassubWorkerUrl: p,
|
|
207
|
+
jassubWasmUrl: g,
|
|
208
|
+
jassubLegacyWasmUrl: _,
|
|
209
|
+
defaultFontUrl: v,
|
|
210
|
+
bufferSize: y,
|
|
211
|
+
audioStreamIndex: w,
|
|
209
212
|
onReady: () => {
|
|
210
|
-
if (
|
|
211
|
-
|
|
212
|
-
let t =
|
|
213
|
-
|
|
213
|
+
if (n) return;
|
|
214
|
+
o.setSourceState({ ready: !0 });
|
|
215
|
+
let t = j.current;
|
|
216
|
+
j.current = null, t && t.size === c && t.time > 0 && (e.currentTime = t.time), b && e.play().catch(() => {});
|
|
214
217
|
},
|
|
215
218
|
onError: d,
|
|
216
219
|
onRecovered: () => {
|
|
217
|
-
|
|
220
|
+
n || o.setSourceState({ playbackError: null });
|
|
218
221
|
},
|
|
219
|
-
onSeek: (e) =>
|
|
222
|
+
onSeek: (e) => P.current?.(e),
|
|
223
|
+
onOutput: (e) => I.current?.(e),
|
|
220
224
|
onSubtitleStreams: (e) => {
|
|
221
|
-
|
|
225
|
+
n || o.setSourceState({
|
|
222
226
|
subtitleTracks: J(e),
|
|
223
|
-
...
|
|
227
|
+
...M.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
|
|
224
228
|
});
|
|
225
229
|
},
|
|
226
230
|
onAudioStreams: (e, t) => {
|
|
227
|
-
|
|
231
|
+
n || o.setSourceState({
|
|
228
232
|
audioTracks: J(e),
|
|
229
233
|
selectedAudioTrack: t
|
|
230
234
|
});
|
|
231
235
|
}
|
|
232
236
|
});
|
|
233
|
-
if (
|
|
234
|
-
|
|
237
|
+
if (n) {
|
|
238
|
+
r.destroy();
|
|
235
239
|
return;
|
|
236
240
|
}
|
|
237
|
-
|
|
238
|
-
indexes:
|
|
239
|
-
chapters:
|
|
241
|
+
A.current = r, o.setSourceState({
|
|
242
|
+
indexes: r.indexes,
|
|
243
|
+
chapters: C.current ?? r.chapters
|
|
240
244
|
});
|
|
241
|
-
let
|
|
242
|
-
typeof
|
|
245
|
+
let i = o.selectedSubtitleTrack;
|
|
246
|
+
typeof i == "number" && r.selectSubtitleStream(i);
|
|
243
247
|
} catch (e) {
|
|
244
248
|
d(e);
|
|
245
249
|
}
|
|
246
250
|
})(), () => {
|
|
247
|
-
|
|
251
|
+
n = !0, j.current = {
|
|
248
252
|
time: e.currentTime,
|
|
249
|
-
size:
|
|
250
|
-
},
|
|
253
|
+
size: c
|
|
254
|
+
}, A.current?.destroy(), A.current = null, o.setSourceState({ ready: !1 });
|
|
251
255
|
};
|
|
252
256
|
}, [
|
|
253
|
-
|
|
257
|
+
o,
|
|
254
258
|
e,
|
|
255
259
|
t,
|
|
256
|
-
s,
|
|
257
260
|
c,
|
|
258
261
|
l,
|
|
259
|
-
|
|
260
|
-
|
|
262
|
+
u,
|
|
263
|
+
p,
|
|
261
264
|
g,
|
|
262
265
|
_,
|
|
263
266
|
v,
|
|
264
|
-
C,
|
|
265
267
|
y,
|
|
266
|
-
|
|
268
|
+
w,
|
|
269
|
+
b,
|
|
270
|
+
E
|
|
267
271
|
]);
|
|
268
|
-
},
|
|
269
|
-
let [o, s] =
|
|
270
|
-
l.current =
|
|
271
|
-
let
|
|
272
|
-
return g.current =
|
|
273
|
-
if (!n || !
|
|
274
|
-
let a = !1, o = null, u, d =
|
|
275
|
-
|
|
272
|
+
}, ue = 5e3, de = 6e4, fe = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
|
|
273
|
+
let [o, s] = h([]), c = m(null), l = m(r);
|
|
274
|
+
l.current = r;
|
|
275
|
+
let u = p(() => a?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")]), g = m(u);
|
|
276
|
+
return g.current = u, f(() => {
|
|
277
|
+
if (!n || !r || !e || !t) return;
|
|
278
|
+
let a = !1, o = null, u, d = ue, f = () => {
|
|
279
|
+
i({
|
|
276
280
|
publicPath: e,
|
|
277
281
|
workerUrl: t,
|
|
278
282
|
length: n,
|
|
@@ -287,7 +291,7 @@ var ne = {
|
|
|
287
291
|
}
|
|
288
292
|
o = e, c.current = e, e.update(g.current);
|
|
289
293
|
}, () => {
|
|
290
|
-
a || (u = setTimeout(f, d), d = Math.min(d * 2,
|
|
294
|
+
a || (u = setTimeout(f, d), d = Math.min(d * 2, de));
|
|
291
295
|
});
|
|
292
296
|
};
|
|
293
297
|
return f(), () => {
|
|
@@ -297,70 +301,70 @@ var ne = {
|
|
|
297
301
|
n,
|
|
298
302
|
e,
|
|
299
303
|
t
|
|
300
|
-
]),
|
|
301
|
-
c.current?.update(
|
|
302
|
-
}, [
|
|
304
|
+
]), f(() => {
|
|
305
|
+
c.current?.update(u);
|
|
306
|
+
}, [u]), {
|
|
303
307
|
thumbnails: o,
|
|
304
|
-
requestThumbnail:
|
|
308
|
+
requestThumbnail: d((e) => {
|
|
305
309
|
c.current?.prioritize(e);
|
|
306
310
|
}, [])
|
|
307
311
|
};
|
|
308
|
-
},
|
|
309
|
-
let r =
|
|
310
|
-
|
|
311
|
-
if (!e || !
|
|
312
|
-
let
|
|
312
|
+
}, pe = (e, t) => {
|
|
313
|
+
let r = m(null), [i, a] = h(!1), [s] = h(() => n());
|
|
314
|
+
f(() => {
|
|
315
|
+
if (!e || !t || !s) return;
|
|
316
|
+
let n = o({
|
|
313
317
|
video: e,
|
|
314
|
-
subtitles:
|
|
318
|
+
subtitles: t,
|
|
315
319
|
mode: s,
|
|
316
|
-
onBurnedInChange:
|
|
320
|
+
onBurnedInChange: a
|
|
317
321
|
});
|
|
318
|
-
return r.current =
|
|
319
|
-
|
|
322
|
+
return r.current = n, () => {
|
|
323
|
+
n.destroy(), r.current = null, a(!1);
|
|
320
324
|
};
|
|
321
325
|
}, [
|
|
322
326
|
e,
|
|
323
|
-
|
|
327
|
+
t,
|
|
324
328
|
s
|
|
325
329
|
]);
|
|
326
|
-
let c =
|
|
330
|
+
let c = d(() => {
|
|
327
331
|
r.current?.toggle().catch((e) => {
|
|
328
332
|
console.warn("picture in picture was refused", e);
|
|
329
333
|
});
|
|
330
334
|
}, []);
|
|
331
335
|
return {
|
|
332
|
-
toggle: e &&
|
|
336
|
+
toggle: e && t && s ? c : null,
|
|
333
337
|
mode: s,
|
|
334
338
|
burnedIn: i
|
|
335
339
|
};
|
|
336
|
-
},
|
|
337
|
-
let t =
|
|
340
|
+
}, me = "(hover: hover) and (pointer: fine)", he = () => typeof matchMedia == "function" ? matchMedia(me) : void 0, ge = (e) => {
|
|
341
|
+
let t = he();
|
|
338
342
|
return t?.addEventListener("change", e), () => t?.removeEventListener("change", e);
|
|
339
|
-
},
|
|
340
|
-
let [n, r] =
|
|
343
|
+
}, _e = () => !!he()?.matches, ve = () => !1, ye = (e, t) => {
|
|
344
|
+
let [n, r] = h(!1), [i, a] = h(), o = m(t);
|
|
341
345
|
t && (o.current = t);
|
|
342
|
-
let s =
|
|
346
|
+
let s = m(!1), c = d((e) => {
|
|
343
347
|
s.current !== e && (s.current = e, o.current?.onArmedChange(e));
|
|
344
|
-
}, []), l =
|
|
348
|
+
}, []), l = d((t) => {
|
|
345
349
|
!e || e.readyState < 1 || e.error || (a(t), c(!0));
|
|
346
|
-
}, [e, c]),
|
|
350
|
+
}, [e, c]), u = d(() => {
|
|
347
351
|
a(void 0), c(!1);
|
|
348
352
|
}, [c]), _ = !!t && !!e;
|
|
349
|
-
|
|
353
|
+
f(() => {
|
|
350
354
|
if (!_ || !e) return;
|
|
351
355
|
let t = () => {
|
|
352
|
-
r(!0),
|
|
356
|
+
r(!0), u();
|
|
353
357
|
}, n = () => r(!1);
|
|
354
358
|
return e.addEventListener("enterpictureinpicture", t), e.addEventListener("leavepictureinpicture", n), () => {
|
|
355
|
-
e.removeEventListener("enterpictureinpicture", t), e.removeEventListener("leavepictureinpicture", n), r(!1),
|
|
359
|
+
e.removeEventListener("enterpictureinpicture", t), e.removeEventListener("leavepictureinpicture", n), r(!1), u();
|
|
356
360
|
};
|
|
357
361
|
}, [
|
|
358
362
|
e,
|
|
359
363
|
_,
|
|
360
|
-
|
|
364
|
+
u
|
|
361
365
|
]);
|
|
362
|
-
let v =
|
|
363
|
-
|
|
366
|
+
let v = g(ge, _e, ve), [y, b] = h(!1);
|
|
367
|
+
f(() => {
|
|
364
368
|
if (!_) return;
|
|
365
369
|
let e = (e) => {
|
|
366
370
|
e.pointerType === "touch" && b(!0);
|
|
@@ -378,38 +382,38 @@ var ne = {
|
|
|
378
382
|
};
|
|
379
383
|
}, [_]);
|
|
380
384
|
let x = _ && v && !y;
|
|
381
|
-
|
|
382
|
-
x ||
|
|
383
|
-
}, [x,
|
|
384
|
-
let S =
|
|
385
|
+
f(() => {
|
|
386
|
+
x || u();
|
|
387
|
+
}, [x, u]);
|
|
388
|
+
let S = d(() => {
|
|
385
389
|
Promise.resolve(e?.exitPictureInPicture?.()).catch((e) => {
|
|
386
390
|
console.warn("leaving picture in picture was refused", e);
|
|
387
391
|
});
|
|
388
392
|
}, [e]);
|
|
389
|
-
return
|
|
393
|
+
return p(() => x ? {
|
|
390
394
|
active: n,
|
|
391
395
|
armed: i,
|
|
392
396
|
arm: l,
|
|
393
|
-
disarm:
|
|
397
|
+
disarm: u,
|
|
394
398
|
exit: S
|
|
395
399
|
} : null, [
|
|
396
400
|
x,
|
|
397
401
|
n,
|
|
398
402
|
i,
|
|
399
403
|
l,
|
|
400
|
-
|
|
404
|
+
u,
|
|
401
405
|
S
|
|
402
406
|
]);
|
|
403
|
-
},
|
|
407
|
+
}, be = async (e, t, n = {}) => (await e.audioWorklet.addModule(t), new AudioWorkletNode(e, "banou-volume-normalizer", {
|
|
404
408
|
channelCountMode: "max",
|
|
405
409
|
processorOptions: n
|
|
406
|
-
})),
|
|
410
|
+
})), xe = /* @__PURE__ */ new WeakMap(), Se = (e) => new Promise((t, n) => {
|
|
407
411
|
let r = () => {
|
|
408
412
|
(e.state === "running" || e.state === "closed") && (e.removeEventListener("statechange", r), e.state === "running" ? t() : n(new DOMException("The AudioContext closed before it ran", "InvalidStateError")));
|
|
409
413
|
};
|
|
410
414
|
e.addEventListener("statechange", r), r();
|
|
411
|
-
}),
|
|
412
|
-
let r =
|
|
415
|
+
}), Ce = (e, t, n = {}) => {
|
|
416
|
+
let r = xe.get(e);
|
|
413
417
|
if (r) return r.wake(), r;
|
|
414
418
|
let i = new AudioContext(), a = n.enabled !== !1, o, s = !1, c = () => 20 * Math.log10(Math.max(e.volume, 1e-6)), l = e.ownerDocument, u = () => {
|
|
415
419
|
i.state === "suspended" && i.resume().catch(() => {});
|
|
@@ -425,13 +429,13 @@ var ne = {
|
|
|
425
429
|
};
|
|
426
430
|
i.addEventListener("statechange", f), f();
|
|
427
431
|
let p = (async () => {
|
|
428
|
-
let r = await
|
|
432
|
+
let r = await be(i, t, {
|
|
429
433
|
...n,
|
|
430
434
|
enabled: a,
|
|
431
435
|
inputGainDb: c()
|
|
432
436
|
});
|
|
433
|
-
await
|
|
434
|
-
let s =
|
|
437
|
+
await Se(i);
|
|
438
|
+
let s = T(i, e);
|
|
435
439
|
return r.port.postMessage({
|
|
436
440
|
enabled: a,
|
|
437
441
|
inputGainDb: c()
|
|
@@ -447,32 +451,284 @@ var ne = {
|
|
|
447
451
|
a = e, o?.port.postMessage({ enabled: a });
|
|
448
452
|
},
|
|
449
453
|
release: () => {
|
|
450
|
-
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (
|
|
454
|
+
s = !0, d(!1), e.isConnected ? i.state === "running" && i.suspend().catch(() => {}) : (xe.delete(e), i.close().catch(() => {}));
|
|
451
455
|
},
|
|
452
456
|
wake: () => {
|
|
453
457
|
i.state !== "closed" && (s = !1, u(), f());
|
|
454
458
|
}
|
|
455
459
|
};
|
|
456
|
-
return
|
|
457
|
-
},
|
|
458
|
-
let
|
|
459
|
-
|
|
460
|
+
return xe.set(e, m), m;
|
|
461
|
+
}, we = 20, Te = 5, Ee = 1, De = 50, Oe = ({ node: t, element: n, scriptUrl: r, source: i }) => {
|
|
462
|
+
let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
|
|
463
|
+
for (let e of [...c]) e();
|
|
464
|
+
c.clear();
|
|
465
|
+
}, u = () => new Promise((e) => c.add(e)), d = async (e, t, n) => {
|
|
466
|
+
let r = Math.min(t + n, e.length);
|
|
467
|
+
for (; o && !o.some(([e, n]) => e <= t && r <= n);) if (a || await new Promise((e) => s.add(e))) throw Error("Cancelled");
|
|
468
|
+
return e.read(t, n);
|
|
469
|
+
}, f = (e) => {
|
|
470
|
+
for (let t of [...s]) t(e);
|
|
471
|
+
s.clear();
|
|
472
|
+
}, p;
|
|
473
|
+
try {
|
|
474
|
+
p = new Worker(r, { type: "module" });
|
|
475
|
+
} catch (e) {
|
|
476
|
+
return console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), {
|
|
477
|
+
update: () => {},
|
|
478
|
+
stop: () => {}
|
|
479
|
+
};
|
|
480
|
+
}
|
|
481
|
+
let m = new MessageChannel();
|
|
482
|
+
p.postMessage({
|
|
483
|
+
type: "port",
|
|
484
|
+
port: m.port1
|
|
485
|
+
}, [m.port1]), t.port.postMessage({ analysis: m.port2 }, [m.port2]);
|
|
486
|
+
let h = {
|
|
487
|
+
spans: [],
|
|
488
|
+
end: null
|
|
489
|
+
}, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
|
|
490
|
+
p.onmessage = ({ data: e }) => {
|
|
491
|
+
if (e.type === "unsupported") {
|
|
492
|
+
U();
|
|
493
|
+
return;
|
|
494
|
+
}
|
|
495
|
+
e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
|
|
496
|
+
spans: e.spans,
|
|
497
|
+
end: e.end
|
|
498
|
+
}), e.type === "merged" && (y = e.run), _.get(`${e.type}:${e.run}`)?.(h), _.delete(`${e.type}:${e.run}`), l();
|
|
499
|
+
};
|
|
500
|
+
let b = t.context, x = () => t.port.postMessage({
|
|
501
|
+
media: n.currentTime,
|
|
502
|
+
ctx: b.currentTime,
|
|
503
|
+
rate: n.playbackRate,
|
|
504
|
+
paused: n.paused || n.seeking || n.readyState < 3
|
|
505
|
+
}), S = () => p.postMessage({
|
|
506
|
+
type: "playhead",
|
|
507
|
+
time: n.currentTime
|
|
508
|
+
}), C = setInterval(x, De), T = [
|
|
509
|
+
"play",
|
|
510
|
+
"playing",
|
|
511
|
+
"pause",
|
|
512
|
+
"seeking",
|
|
513
|
+
"seeked",
|
|
514
|
+
"ratechange",
|
|
515
|
+
"waiting",
|
|
516
|
+
"ended"
|
|
517
|
+
];
|
|
518
|
+
for (let e of T) n.addEventListener(e, x);
|
|
519
|
+
let E = Infinity, D = !1, O = 0, k = !1, A = 0, j = 0, M = /* @__PURE__ */ new Map(), N = (e) => {
|
|
520
|
+
let t = e;
|
|
521
|
+
for (let [e, n] of h.spans) e <= t && t < n && (t = n);
|
|
522
|
+
return t >= (h.end ?? E) - .05 ? null : t;
|
|
523
|
+
}, P = (e) => M.get(Math.round(e * 10)) === g ? "idle" : e, F = () => {
|
|
524
|
+
let e = n.currentTime, t = N(e), r = k && y !== O;
|
|
525
|
+
if (t !== null && t < e + we) return r && A <= t + 1 && t <= j + Te ? "read" : P(t);
|
|
526
|
+
if (r) return "read";
|
|
527
|
+
let i = t ?? N(0);
|
|
528
|
+
return i === null ? "done" : P(i);
|
|
529
|
+
}, I = () => {}, L = (e) => (e.catch(() => {}), Promise.race([e, new Promise((e) => {
|
|
530
|
+
I = () => e(void 0);
|
|
531
|
+
})])), R = () => {
|
|
532
|
+
S(), D && s.size && typeof F() == "number" && I(), l();
|
|
533
|
+
}, z = () => {
|
|
534
|
+
S(), l();
|
|
535
|
+
};
|
|
536
|
+
n.addEventListener("seeking", R), n.addEventListener("seeked", z), n.addEventListener("timeupdate", z);
|
|
537
|
+
let B, V = async (e) => {
|
|
538
|
+
if (!k) return;
|
|
539
|
+
k = !1;
|
|
540
|
+
let t = v("ended", O);
|
|
541
|
+
p.postMessage({
|
|
542
|
+
type: "end",
|
|
543
|
+
run: O,
|
|
544
|
+
finished: e
|
|
545
|
+
}), await t;
|
|
546
|
+
}, H = async (e) => {
|
|
547
|
+
if (j = e.pts + e.duration, !e.data.byteLength) return;
|
|
548
|
+
let t = v("ack", O);
|
|
549
|
+
p.postMessage({
|
|
550
|
+
type: "fragment",
|
|
551
|
+
run: O,
|
|
552
|
+
data: e.data
|
|
553
|
+
}, [e.data]), await t;
|
|
554
|
+
}, ee = async (t) => {
|
|
555
|
+
if (B = await w({
|
|
556
|
+
publicPath: t.publicPath,
|
|
557
|
+
workerUrl: t.libavWorkerUrl,
|
|
558
|
+
workerOptions: { type: "module" },
|
|
559
|
+
length: t.length,
|
|
560
|
+
read: (e, n) => d(t, e, n),
|
|
561
|
+
audioStreamIndex: t.audioStreamIndex
|
|
562
|
+
}), a) return e(B);
|
|
563
|
+
let n = await B.init();
|
|
564
|
+
if (!a) {
|
|
565
|
+
for (E = n.info.input.duration || Infinity, p.postMessage({
|
|
566
|
+
type: "init",
|
|
567
|
+
data: n.data,
|
|
568
|
+
codec: n.info.output.audioMimeType
|
|
569
|
+
}, [n.data]), k = !0, D = !0, p.postMessage({
|
|
570
|
+
type: "run",
|
|
571
|
+
run: O,
|
|
572
|
+
pts: 0,
|
|
573
|
+
start: !0
|
|
574
|
+
}); !a;) {
|
|
575
|
+
let e = F();
|
|
576
|
+
if (e === "done") break;
|
|
577
|
+
if (e === "idle") {
|
|
578
|
+
await u();
|
|
579
|
+
continue;
|
|
580
|
+
}
|
|
581
|
+
try {
|
|
582
|
+
if (e === "read") {
|
|
583
|
+
let e = await L(B.read());
|
|
584
|
+
if (a) return;
|
|
585
|
+
if (!e) continue;
|
|
586
|
+
await H(e), e.finished && await V(!0);
|
|
587
|
+
} else {
|
|
588
|
+
await V(!1), M.set(Math.round(e * 10), g);
|
|
589
|
+
let t = B.seek(Math.max(0, e - Ee));
|
|
590
|
+
f(!0);
|
|
591
|
+
let n = await L(t);
|
|
592
|
+
if (a) return;
|
|
593
|
+
if (!n) continue;
|
|
594
|
+
O++, k = !0, A = n.pts, p.postMessage({
|
|
595
|
+
type: "run",
|
|
596
|
+
run: O,
|
|
597
|
+
pts: n.pts,
|
|
598
|
+
start: n.pts <= 0
|
|
599
|
+
}), await H(n), n.finished && await V(!0);
|
|
600
|
+
}
|
|
601
|
+
} catch {
|
|
602
|
+
if (a) return;
|
|
603
|
+
await V(!1), typeof F() != "number" && await u();
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
e(B), B = void 0;
|
|
607
|
+
}
|
|
608
|
+
}, te = () => {}, ne = (e, t) => {
|
|
609
|
+
let n = !1, r = (e) => {
|
|
610
|
+
n && p.postMessage({
|
|
611
|
+
type: "end",
|
|
612
|
+
run: O,
|
|
613
|
+
finished: e
|
|
614
|
+
}), n = !1;
|
|
615
|
+
};
|
|
616
|
+
te = e.attach(t, (e, t) => {
|
|
617
|
+
if (e.type === "init") {
|
|
618
|
+
r(!1);
|
|
619
|
+
let t = e.data.slice(0);
|
|
620
|
+
p.postMessage({
|
|
621
|
+
type: "init",
|
|
622
|
+
data: t,
|
|
623
|
+
codec: e.audioMimeType
|
|
624
|
+
}, [t]);
|
|
625
|
+
} else if (e.type === "run") r(!1), n = !0, p.postMessage({
|
|
626
|
+
type: "run",
|
|
627
|
+
run: ++O,
|
|
628
|
+
pts: e.pts,
|
|
629
|
+
start: !t && e.pts <= 0,
|
|
630
|
+
join: t
|
|
631
|
+
});
|
|
632
|
+
else if (e.type === "end") r(!0);
|
|
633
|
+
else if (n) {
|
|
634
|
+
let t = e.data.slice(0);
|
|
635
|
+
p.postMessage({
|
|
636
|
+
type: "fragment",
|
|
637
|
+
run: O,
|
|
638
|
+
data: t
|
|
639
|
+
}, [t]);
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
}, U = () => {
|
|
643
|
+
if (!a) {
|
|
644
|
+
a = !0, f(!0), l(), clearInterval(C);
|
|
645
|
+
for (let e of T) n.removeEventListener(e, x);
|
|
646
|
+
n.removeEventListener("seeking", R), n.removeEventListener("seeked", z), n.removeEventListener("timeupdate", z), te(), B && e(B), p.terminate(), t.port.postMessage({ analysis: null });
|
|
647
|
+
for (let e of _.values()) e(h);
|
|
648
|
+
_.clear();
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
return "tap" in i ? ne(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
|
|
652
|
+
a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), U());
|
|
653
|
+
}), S(), {
|
|
654
|
+
update: (e) => {
|
|
655
|
+
o = e, f(!1);
|
|
656
|
+
},
|
|
657
|
+
stop: U
|
|
658
|
+
};
|
|
659
|
+
}, ke = (e, t, n, r, i) => {
|
|
660
|
+
let a = m(null), [o, s] = h(!1), [c, l] = h(null);
|
|
661
|
+
f(() => {
|
|
460
662
|
if (e && t) {
|
|
461
|
-
if (n && !
|
|
462
|
-
let
|
|
463
|
-
|
|
464
|
-
|
|
663
|
+
if (n && !a.current) {
|
|
664
|
+
let r = Ce(e, t, { enabled: n });
|
|
665
|
+
a.current = r, r.routed.then((e) => {
|
|
666
|
+
a.current === r && l(e);
|
|
667
|
+
}, (e) => {
|
|
668
|
+
a.current === r && (console.warn("[media-player] the volume normalizer is unavailable:", e), s(!0));
|
|
465
669
|
});
|
|
466
670
|
}
|
|
467
|
-
|
|
671
|
+
a.current?.setEnabled(n);
|
|
468
672
|
}
|
|
469
673
|
}, [
|
|
470
674
|
e,
|
|
471
675
|
t,
|
|
472
676
|
n
|
|
473
|
-
]),
|
|
474
|
-
|
|
475
|
-
}, [e])
|
|
677
|
+
]), f(() => () => {
|
|
678
|
+
a.current?.release(), a.current = null, l(null);
|
|
679
|
+
}, [e]);
|
|
680
|
+
let u = m(i);
|
|
681
|
+
u.current = i;
|
|
682
|
+
let d = m(null), p = m(r);
|
|
683
|
+
p.current = r;
|
|
684
|
+
let { length: g, publicPath: _, libavWorkerUrl: v } = r && "read" in r ? r : {}, y = r && "tap" in r ? r.tap : void 0, b = r?.audioStreamIndex;
|
|
685
|
+
return f(() => {
|
|
686
|
+
let r = p.current;
|
|
687
|
+
if (!c || !e || !t || !n || !r) return;
|
|
688
|
+
let i = Oe({
|
|
689
|
+
node: c,
|
|
690
|
+
element: e,
|
|
691
|
+
scriptUrl: t,
|
|
692
|
+
source: r
|
|
693
|
+
});
|
|
694
|
+
return i.update(u.current), d.current = i, () => {
|
|
695
|
+
i.stop(), d.current = null;
|
|
696
|
+
};
|
|
697
|
+
}, [
|
|
698
|
+
c,
|
|
699
|
+
e,
|
|
700
|
+
t,
|
|
701
|
+
n,
|
|
702
|
+
g,
|
|
703
|
+
_,
|
|
704
|
+
v,
|
|
705
|
+
b,
|
|
706
|
+
y
|
|
707
|
+
]), f(() => {
|
|
708
|
+
d.current?.update(i);
|
|
709
|
+
}, [i]), { refused: o };
|
|
710
|
+
}, Ae = () => {
|
|
711
|
+
let e, t, n, r = () => n && e?.audioStreamIndex === n.audioStreamIndex ? n : void 0;
|
|
712
|
+
return {
|
|
713
|
+
push: (n) => {
|
|
714
|
+
n.type === "init" ? (e = n, t = void 0) : n.type === "run" ? t = {
|
|
715
|
+
pts: n.pts,
|
|
716
|
+
begun: !1
|
|
717
|
+
} : n.type === "fragment" && t && (t.begun = !0), r()?.take(n);
|
|
718
|
+
},
|
|
719
|
+
attach: (i, a) => {
|
|
720
|
+
let o = {
|
|
721
|
+
audioStreamIndex: i,
|
|
722
|
+
take: a
|
|
723
|
+
};
|
|
724
|
+
return n = o, r() && e && (a(e), t && a({
|
|
725
|
+
type: "run",
|
|
726
|
+
pts: t.pts
|
|
727
|
+
}, t.begun)), () => {
|
|
728
|
+
n === o && (n = void 0);
|
|
729
|
+
};
|
|
730
|
+
}
|
|
731
|
+
};
|
|
476
732
|
}, Z = {
|
|
477
733
|
headings: {
|
|
478
734
|
large: "\n font-weight: 600;\n font-size: calc(2.8 * var(--mp-unit));\n line-height: calc(3.4 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(3.4 * var(--mp-unit));\n line-height: calc(4.1 * var(--mp-unit));\n }\n ",
|
|
@@ -500,7 +756,7 @@ var ne = {
|
|
|
500
756
|
medium: "\n font-weight: 500;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n ",
|
|
501
757
|
regular: "\n font-weight: 400;\n font-size: calc(0.8 * var(--mp-unit));\n line-height: calc(1.1 * var(--mp-unit));\n @media (min-width: 960px) {\n font-size: calc(1 * var(--mp-unit));\n line-height: calc(1.4 * var(--mp-unit));\n }\n "
|
|
502
758
|
}
|
|
503
|
-
},
|
|
759
|
+
}, je = _`
|
|
504
760
|
display: flex;
|
|
505
761
|
justify-content: center;
|
|
506
762
|
align-items: center;
|
|
@@ -513,7 +769,7 @@ var ne = {
|
|
|
513
769
|
margin: auto;
|
|
514
770
|
pointer-events: none;
|
|
515
771
|
}
|
|
516
|
-
`,
|
|
772
|
+
`, Me = _`
|
|
517
773
|
position: absolute;
|
|
518
774
|
top: 0;
|
|
519
775
|
left: 0;
|
|
@@ -542,9 +798,9 @@ var ne = {
|
|
|
542
798
|
|
|
543
799
|
background: linear-gradient(180deg, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.3) 30%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0.1) 80%, transparent 100%);
|
|
544
800
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1);
|
|
545
|
-
`,
|
|
801
|
+
`, Ne = v`
|
|
546
802
|
to { transform: rotate(360deg); }
|
|
547
|
-
`,
|
|
803
|
+
`, Pe = _`
|
|
548
804
|
position: absolute;
|
|
549
805
|
inset: 0;
|
|
550
806
|
z-index: 2;
|
|
@@ -560,9 +816,9 @@ var ne = {
|
|
|
560
816
|
border-radius: 50%;
|
|
561
817
|
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
562
818
|
border-top-color: #fff;
|
|
563
|
-
animation: ${
|
|
819
|
+
animation: ${Ne} 0.8s linear infinite;
|
|
564
820
|
}
|
|
565
|
-
`,
|
|
821
|
+
`, Fe = _`
|
|
566
822
|
position: absolute;
|
|
567
823
|
inset: auto 0 20%;
|
|
568
824
|
z-index: 3;
|
|
@@ -572,34 +828,34 @@ var ne = {
|
|
|
572
828
|
${Z.bLarge.regular}
|
|
573
829
|
text-shadow: 0 0 4px rgba(0, 0, 0, 1);
|
|
574
830
|
pointer-events: none;
|
|
575
|
-
`,
|
|
576
|
-
let t =
|
|
577
|
-
return /* @__PURE__ */ E
|
|
578
|
-
t ? /* @__PURE__ */
|
|
831
|
+
`, Ie = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Le = ({ onSubtitleRef: e }) => {
|
|
832
|
+
let t = K((e) => e.title), n = K((e) => e.hideUI), r = K((e) => e.playbackError), i = K((e) => e.ready), a = K((e) => e.size), o = K((e) => e.waiting), s = K((e) => e.seekingTo);
|
|
833
|
+
return /* @__PURE__ */ O(E, { children: [
|
|
834
|
+
t ? /* @__PURE__ */ D("div", {
|
|
579
835
|
className: "title",
|
|
580
|
-
css:
|
|
836
|
+
css: Me,
|
|
581
837
|
style: { ...n ? {
|
|
582
838
|
opacity: "0",
|
|
583
839
|
pointerEvents: "none"
|
|
584
840
|
} : {} },
|
|
585
841
|
children: t
|
|
586
842
|
}) : void 0,
|
|
587
|
-
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */
|
|
588
|
-
r ? /* @__PURE__ */
|
|
589
|
-
css:
|
|
590
|
-
children:
|
|
843
|
+
((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Pe }) : void 0,
|
|
844
|
+
r ? /* @__PURE__ */ D("div", {
|
|
845
|
+
css: Fe,
|
|
846
|
+
children: Ie(r)
|
|
591
847
|
}) : void 0,
|
|
592
|
-
/* @__PURE__ */
|
|
848
|
+
/* @__PURE__ */ D("div", {
|
|
593
849
|
className: "subtitles",
|
|
594
850
|
ref: e,
|
|
595
|
-
css:
|
|
851
|
+
css: je
|
|
596
852
|
})
|
|
597
853
|
] });
|
|
598
|
-
},
|
|
854
|
+
}, Re = 1e-4, ze = 1, Be = (e) => Math.max(Re, Math.min(ze, e)) ** 2, Ve = (e) => Math.max(Re, Math.min(ze, e)) ** (ze / 2), He = (e) => {
|
|
599
855
|
if (e === void 0) return "0:00";
|
|
600
856
|
let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
|
|
601
857
|
return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
|
|
602
|
-
},
|
|
858
|
+
}, Ue = (e, t) => `${He(e)} / ${He(t)}`, We = (e) => _`
|
|
603
859
|
display: flex;
|
|
604
860
|
justify-content: flex-start;
|
|
605
861
|
|
|
@@ -634,30 +890,30 @@ var ne = {
|
|
|
634
890
|
${Z.bMedium.regular}
|
|
635
891
|
}
|
|
636
892
|
|
|
637
|
-
${e === "sm" &&
|
|
893
|
+
${e === "sm" && _`
|
|
638
894
|
padding: calc(0.4 * var(--mp-unit))!important;
|
|
639
895
|
`}
|
|
640
|
-
${e === "md" &&
|
|
896
|
+
${e === "md" && _`
|
|
641
897
|
padding: calc(0.6 * var(--mp-unit))!important;
|
|
642
898
|
`}
|
|
643
|
-
${e === "lg" &&
|
|
899
|
+
${e === "lg" && _`
|
|
644
900
|
padding: calc(1.2 * var(--mp-unit))!important;
|
|
645
901
|
`}
|
|
646
902
|
`, Q = {
|
|
647
903
|
x: -1,
|
|
648
904
|
y: -1,
|
|
649
905
|
anchors: 0
|
|
650
|
-
},
|
|
906
|
+
}, Ge = (e) => {
|
|
651
907
|
Q.x = e.clientX, Q.y = e.clientY;
|
|
652
|
-
},
|
|
908
|
+
}, Ke = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Ge, {
|
|
653
909
|
capture: !0,
|
|
654
910
|
passive: !0
|
|
655
911
|
}), () => {
|
|
656
|
-
--Q.anchors === 0 && window.removeEventListener("pointermove",
|
|
912
|
+
--Q.anchors === 0 && window.removeEventListener("pointermove", Ge, { capture: !0 });
|
|
657
913
|
}), $ = ({ id: e, toolTipText: t, text: n, delayShow: r = 0, closeDelay: i = 0, offset: a = 20, tooltipPlace: o = "top", disabled: s = !1, size: c = "md" }) => {
|
|
658
|
-
let l =
|
|
659
|
-
return
|
|
660
|
-
let e =
|
|
914
|
+
let l = m(null), u = m(null);
|
|
915
|
+
return f(() => {
|
|
916
|
+
let e = Ke(), t = () => {
|
|
661
917
|
let e = l.current;
|
|
662
918
|
if (!e) return;
|
|
663
919
|
let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
|
|
@@ -668,7 +924,7 @@ var ne = {
|
|
|
668
924
|
e();
|
|
669
925
|
for (let e of n) document.removeEventListener(e, t);
|
|
670
926
|
};
|
|
671
|
-
}, []), /* @__PURE__ */ E
|
|
927
|
+
}, []), /* @__PURE__ */ O(E, { children: [/* @__PURE__ */ D("div", {
|
|
672
928
|
ref: l,
|
|
673
929
|
"data-tooltip-id": e,
|
|
674
930
|
"data-open": !0,
|
|
@@ -677,22 +933,22 @@ var ne = {
|
|
|
677
933
|
"data-tooltip-delay-hide": i,
|
|
678
934
|
"data-tooltip-place": o,
|
|
679
935
|
children: n
|
|
680
|
-
}), !s && /* @__PURE__ */
|
|
936
|
+
}), !s && /* @__PURE__ */ D(ne, {
|
|
681
937
|
ref: u,
|
|
682
|
-
css:
|
|
938
|
+
css: We(c),
|
|
683
939
|
id: e,
|
|
684
940
|
noArrow: !0,
|
|
685
941
|
children: t
|
|
686
942
|
})] });
|
|
687
|
-
},
|
|
688
|
-
let [i, a] =
|
|
943
|
+
}, qe = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
|
|
944
|
+
let [i, a] = h(!1), o = m(t);
|
|
689
945
|
o.current = t;
|
|
690
|
-
let s =
|
|
946
|
+
let s = m(null), c = d((t, r) => {
|
|
691
947
|
let i = e.current;
|
|
692
948
|
if (!i) return 0;
|
|
693
949
|
let { left: a, right: o, top: s, bottom: c } = i.getBoundingClientRect(), l = n === "horizontal" ? (t - a) / (o - a) : (c - r) / (c - s);
|
|
694
950
|
return Math.min(Math.max(l, 0), 1);
|
|
695
|
-
}, [e, n]), l =
|
|
951
|
+
}, [e, n]), l = d((e) => {
|
|
696
952
|
if (!(r || e.button > 0)) {
|
|
697
953
|
s.current = e.pointerId;
|
|
698
954
|
try {
|
|
@@ -700,9 +956,9 @@ var ne = {
|
|
|
700
956
|
} catch {}
|
|
701
957
|
a(!0), o.current(c(e.clientX, e.clientY));
|
|
702
958
|
}
|
|
703
|
-
}, [r, c]),
|
|
959
|
+
}, [r, c]), u = d((e) => {
|
|
704
960
|
s.current === e.pointerId && o.current(c(e.clientX, e.clientY));
|
|
705
|
-
}, [c]),
|
|
961
|
+
}, [c]), p = d((e) => {
|
|
706
962
|
if (s.current === e.pointerId) {
|
|
707
963
|
s.current = null;
|
|
708
964
|
try {
|
|
@@ -711,38 +967,38 @@ var ne = {
|
|
|
711
967
|
a(!1);
|
|
712
968
|
}
|
|
713
969
|
}, []);
|
|
714
|
-
return
|
|
970
|
+
return f(() => {
|
|
715
971
|
r && (s.current = null, a(!1));
|
|
716
972
|
}, [r]), {
|
|
717
973
|
dragging: i,
|
|
718
974
|
handlers: {
|
|
719
975
|
onPointerDown: l,
|
|
720
|
-
onPointerMove:
|
|
721
|
-
onPointerUp:
|
|
722
|
-
onPointerCancel:
|
|
976
|
+
onPointerMove: u,
|
|
977
|
+
onPointerUp: p,
|
|
978
|
+
onPointerCancel: p,
|
|
723
979
|
style: { touchAction: "none" }
|
|
724
980
|
}
|
|
725
981
|
};
|
|
726
|
-
},
|
|
982
|
+
}, Je = 2, Ye = .005, Xe = "#000", Ze = "#0000", Qe = (e, t) => {
|
|
727
983
|
if (!t) return [];
|
|
728
984
|
let n = /* @__PURE__ */ new Set();
|
|
729
985
|
for (let { start: r, end: i } of e) for (let e of [r, i]) {
|
|
730
986
|
let r = e / t;
|
|
731
|
-
r <=
|
|
987
|
+
r <= Ye || r >= .995 || n.add(Number((r * 100).toFixed(4)));
|
|
732
988
|
}
|
|
733
989
|
return n.size ? [
|
|
734
990
|
0,
|
|
735
991
|
...[...n].sort((e, t) => e - t),
|
|
736
992
|
100
|
|
737
993
|
] : [];
|
|
738
|
-
},
|
|
739
|
-
let n =
|
|
994
|
+
}, $e = (e, t) => {
|
|
995
|
+
let n = Je / 2, r = e.length - 2, i = [];
|
|
740
996
|
for (let a = 0; a <= r; a += 1) {
|
|
741
997
|
let o = e[a], s = e[a + 1], c = a === 0 ? "0%" : `calc(${o}% + ${n}px)`, l = a === r ? "100%" : `calc(${s}% - ${n}px)`;
|
|
742
|
-
i.push(`${t(a) ?
|
|
998
|
+
i.push(`${t(a) ? Xe : Ze} ${c} ${l}`), a !== r && i.push(`${Ze} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
|
|
743
999
|
}
|
|
744
1000
|
return `linear-gradient(90deg, ${i.join(", ")})`;
|
|
745
|
-
},
|
|
1001
|
+
}, et = /* @__PURE__ */ new Set([
|
|
746
1002
|
"op",
|
|
747
1003
|
"ops",
|
|
748
1004
|
"opening",
|
|
@@ -750,7 +1006,7 @@ var ne = {
|
|
|
750
1006
|
"ncop",
|
|
751
1007
|
"オープニング",
|
|
752
1008
|
"op主題歌"
|
|
753
|
-
]),
|
|
1009
|
+
]), tt = /* @__PURE__ */ new Set([
|
|
754
1010
|
"ed",
|
|
755
1011
|
"eds",
|
|
756
1012
|
"ending",
|
|
@@ -763,13 +1019,13 @@ var ne = {
|
|
|
763
1019
|
"エンドカード",
|
|
764
1020
|
"エンドロール",
|
|
765
1021
|
"ed主題歌"
|
|
766
|
-
]),
|
|
1022
|
+
]), nt = /* @__PURE__ */ new Set(["intro", "イントロ"]), rt = /* @__PURE__ */ new Set(["outro", "アウトロ"]), it = {
|
|
767
1023
|
"credits start": "ending",
|
|
768
1024
|
"credits end": null,
|
|
769
1025
|
"preview end": null,
|
|
770
1026
|
"end credits": "ending",
|
|
771
1027
|
"closing credits": "ending"
|
|
772
|
-
},
|
|
1028
|
+
}, at = /* @__PURE__ */ new Set([
|
|
773
1029
|
"theme",
|
|
774
1030
|
"themes",
|
|
775
1031
|
"song",
|
|
@@ -788,53 +1044,53 @@ var ne = {
|
|
|
788
1044
|
"the",
|
|
789
1045
|
"主題歌",
|
|
790
1046
|
"ノンクレジット"
|
|
791
|
-
]),
|
|
1047
|
+
]), ot = /* @__PURE__ */ new Set([
|
|
792
1048
|
"post",
|
|
793
1049
|
"pre",
|
|
794
1050
|
"after",
|
|
795
1051
|
"before",
|
|
796
1052
|
"non"
|
|
797
|
-
]),
|
|
798
|
-
if (
|
|
799
|
-
if (
|
|
1053
|
+
]), st = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, ct = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), lt = (e) => e.replace(/([a-z-ヿ一-鿿])\s*\d+\s*$/u, "$1").split(/[\s_]+/u).map((e) => e.replace(/^[^\w-ヿ一-鿿]+|[^\w-ヿ一-鿿]+$/gu, "")).filter((e) => e && !/^\d+$/.test(e) && !at.has(e)), ut = (e, t) => {
|
|
1054
|
+
if (et.has(e)) return "opening";
|
|
1055
|
+
if (tt.has(e)) return "ending";
|
|
800
1056
|
if (t) {
|
|
801
|
-
if (
|
|
802
|
-
if (
|
|
1057
|
+
if (nt.has(e)) return "opening";
|
|
1058
|
+
if (rt.has(e)) return "ending";
|
|
803
1059
|
}
|
|
804
|
-
},
|
|
805
|
-
if (
|
|
1060
|
+
}, dt = (e, t) => {
|
|
1061
|
+
if (ct(e)) return;
|
|
806
1062
|
let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
|
|
807
|
-
if (n in
|
|
808
|
-
let r = n.split(
|
|
809
|
-
if (r.some((e) => e.split(/[\s_]+/u).some((e) =>
|
|
1063
|
+
if (n in it) return it[n] ?? void 0;
|
|
1064
|
+
let r = n.split(st).map((e) => e.trim()).filter(Boolean);
|
|
1065
|
+
if (r.some((e) => e.split(/[\s_]+/u).some((e) => ot.has(e)))) return;
|
|
810
1066
|
let i = r.length > 1 ? [r[0], r.at(-1)] : r;
|
|
811
1067
|
for (let e of i) {
|
|
812
|
-
let n =
|
|
1068
|
+
let n = lt(e);
|
|
813
1069
|
if (n.length !== 1) continue;
|
|
814
|
-
let r =
|
|
1070
|
+
let r = ut(n[0], t);
|
|
815
1071
|
if (r) return r;
|
|
816
1072
|
}
|
|
817
|
-
},
|
|
1073
|
+
}, ft = 15, pt = 87, mt = 93, ht = (e) => {
|
|
818
1074
|
let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
|
|
819
1075
|
if (!n) return t;
|
|
820
1076
|
let r = e.map((e, t) => ({
|
|
821
1077
|
index: t,
|
|
822
1078
|
start: e.start,
|
|
823
1079
|
length: e.end - e.start
|
|
824
|
-
})).filter(({ length: e }) => e >=
|
|
1080
|
+
})).filter(({ length: e }) => e >= pt && e <= mt), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
|
|
825
1081
|
return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
|
|
826
|
-
},
|
|
827
|
-
let t = e.map(({ title: e }) =>
|
|
1082
|
+
}, gt = (e) => {
|
|
1083
|
+
let t = e.map(({ title: e }) => dt(e, !1)), n = e.reduce((e, n, r) => e + (t[r] ? n.end - n.start : 0), 0), r = e.reduce((e, t) => e + (t.end - t.start), 0);
|
|
828
1084
|
if (r > 0 && n * 2 > r) return e.map(() => void 0);
|
|
829
1085
|
let i = e.map((e, n) => {
|
|
830
|
-
if (e.end - e.start <
|
|
1086
|
+
if (e.end - e.start < ft) return;
|
|
831
1087
|
let r = t[n];
|
|
832
1088
|
if (r) return r;
|
|
833
|
-
let i =
|
|
1089
|
+
let i = dt(e.title, !0);
|
|
834
1090
|
return i && !t.includes(i) ? i : void 0;
|
|
835
1091
|
});
|
|
836
|
-
return e.every(({ title: e }) =>
|
|
837
|
-
},
|
|
1092
|
+
return e.every(({ title: e }) => ct(e)) ? ht(e) : i;
|
|
1093
|
+
}, _t = _`
|
|
838
1094
|
position: relative;
|
|
839
1095
|
height: calc(.4 * var(--mp-unit));
|
|
840
1096
|
|
|
@@ -1053,27 +1309,27 @@ var ne = {
|
|
|
1053
1309
|
--thumbnail-width: calc(18 * var(--mp-unit));
|
|
1054
1310
|
--thumbnail-half: calc(9 * var(--mp-unit));
|
|
1055
1311
|
}
|
|
1056
|
-
`,
|
|
1057
|
-
let e =
|
|
1312
|
+
`, vt = 4, yt = () => {
|
|
1313
|
+
let e = K(), t = K((e) => e.currentTime), n = K((e) => e.requestSeek), r = K((e) => e.duration), i = K((e) => e.size), a = K((e) => e.downloadedRanges), o = K((e) => e.buffered), s = K((e) => e.indexes), c = K((e) => e.thumbnails), l = K((e) => e.thumbnailAt), u = K((e) => e.requestThumbnail), d = K((e) => e.chapters), g = K((e) => e.seekingTo), _ = K((e) => e.setSourceState), v = K((e) => e.hideUI), y = m(null), [b, x] = h(void 0), [S, C] = h(void 0), w = (e) => {
|
|
1058
1314
|
C(e), u(e);
|
|
1059
|
-
},
|
|
1060
|
-
|
|
1061
|
-
if (
|
|
1062
|
-
}, [_,
|
|
1315
|
+
}, T = !!S;
|
|
1316
|
+
f(() => {
|
|
1317
|
+
if (T) return _({ seekPreview: !0 }), () => _({ seekPreview: !1 });
|
|
1318
|
+
}, [_, T]), f(() => {
|
|
1063
1319
|
v && w(void 0);
|
|
1064
1320
|
}, [v]);
|
|
1065
|
-
let
|
|
1321
|
+
let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } = qe({
|
|
1066
1322
|
ref: y,
|
|
1067
1323
|
onChange: (e) => {
|
|
1068
1324
|
if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
|
|
1069
1325
|
else if (!M.current) {
|
|
1070
1326
|
let t = y.current?.getBoundingClientRect().width ?? 0;
|
|
1071
|
-
Math.abs(e - j.current) * t >
|
|
1327
|
+
Math.abs(e - j.current) * t > vt && (M.current = !0);
|
|
1072
1328
|
}
|
|
1073
|
-
x(e),
|
|
1329
|
+
x(e), E.current !== "mouse" && w(e * r);
|
|
1074
1330
|
}
|
|
1075
1331
|
}), F = (e) => {
|
|
1076
|
-
|
|
1332
|
+
E.current = e.pointerType, k.current = 0, j.current = void 0, M.current = !1, P.onPointerDown(e);
|
|
1077
1333
|
}, I = (t) => {
|
|
1078
1334
|
P.onPointerUp(t);
|
|
1079
1335
|
let i = k.current > 0 ? A.current : void 0;
|
|
@@ -1086,25 +1342,25 @@ var ne = {
|
|
|
1086
1342
|
if (!y.current) return;
|
|
1087
1343
|
let { left: t, right: n } = y.current.getBoundingClientRect();
|
|
1088
1344
|
return Math.min(Math.max((e - t) / (n - t), 0), 1) * r;
|
|
1089
|
-
}, R =
|
|
1345
|
+
}, R = m("mouse"), z = (e) => {
|
|
1090
1346
|
R.current = e.pointerType;
|
|
1091
|
-
},
|
|
1347
|
+
}, B = (e) => {
|
|
1092
1348
|
R.current !== "touch" && w(L(e.clientX));
|
|
1093
|
-
},
|
|
1349
|
+
}, V = () => {
|
|
1094
1350
|
y.current && w(void 0);
|
|
1095
|
-
},
|
|
1351
|
+
}, H = (e) => r ? e / r * 100 : 0, ee = (e, t, n) => {
|
|
1096
1352
|
let r = Number((n - t).toFixed(4)), i = t * 100;
|
|
1097
|
-
return /* @__PURE__ */
|
|
1353
|
+
return /* @__PURE__ */ D("div", {
|
|
1098
1354
|
className: "loaded-part",
|
|
1099
1355
|
style: {
|
|
1100
1356
|
transform: `scaleX(${r})`,
|
|
1101
1357
|
marginLeft: `${i}%`
|
|
1102
1358
|
}
|
|
1103
1359
|
}, e);
|
|
1104
|
-
},
|
|
1360
|
+
}, te = p(() => i === void 0 ? r ? o.map(([e, t], n) => ee(n, e / r, t / r)) : [] : a?.map((e, t) => {
|
|
1105
1361
|
if (!i || !r) return null;
|
|
1106
1362
|
let n = s.filter((t) => e.startByteOffset <= t.pos && t.pos <= e.endByteOffset), a = n.at(0), o = n.at(-1);
|
|
1107
|
-
return !a || !o ? null :
|
|
1363
|
+
return !a || !o ? null : ee(t, a.timestamp / r, o.timestamp / r);
|
|
1108
1364
|
}) ?? [], [
|
|
1109
1365
|
r,
|
|
1110
1366
|
i,
|
|
@@ -1112,7 +1368,7 @@ var ne = {
|
|
|
1112
1368
|
s.length,
|
|
1113
1369
|
a?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}/${t}`).join(",")
|
|
1114
1370
|
]);
|
|
1115
|
-
|
|
1371
|
+
f(() => {
|
|
1116
1372
|
b !== void 0 && r && N && M.current && e.seek(b * r);
|
|
1117
1373
|
}, [
|
|
1118
1374
|
e,
|
|
@@ -1120,7 +1376,7 @@ var ne = {
|
|
|
1120
1376
|
b,
|
|
1121
1377
|
r
|
|
1122
1378
|
]);
|
|
1123
|
-
let
|
|
1379
|
+
let ne = p(() => {
|
|
1124
1380
|
if (!r) return 0;
|
|
1125
1381
|
if (N && b !== void 0) return b;
|
|
1126
1382
|
let e = g ?? t;
|
|
@@ -1131,22 +1387,22 @@ var ne = {
|
|
|
1131
1387
|
N,
|
|
1132
1388
|
b,
|
|
1133
1389
|
g
|
|
1134
|
-
]), U =
|
|
1135
|
-
if (!
|
|
1390
|
+
]), U = p(() => Qe(d, r), [d, r]), W = U.length > 0, G = p(() => {
|
|
1391
|
+
if (!W || S === void 0 || !r) return -1;
|
|
1136
1392
|
let e = S / r * 100, t = U.findIndex((t, n) => n < U.length - 1 && e >= t && e < U[n + 1]);
|
|
1137
1393
|
return t >= 0 ? t : U.length - 2;
|
|
1138
1394
|
}, [
|
|
1139
|
-
|
|
1395
|
+
W,
|
|
1140
1396
|
U,
|
|
1141
1397
|
S,
|
|
1142
1398
|
r
|
|
1143
|
-
]),
|
|
1144
|
-
|
|
1399
|
+
]), re = p(() => W ? $e(U, (e) => e !== G) : void 0, [
|
|
1400
|
+
W,
|
|
1145
1401
|
U,
|
|
1146
|
-
|
|
1147
|
-
]),
|
|
1148
|
-
if (S !== void 0) return
|
|
1149
|
-
}, [
|
|
1402
|
+
G
|
|
1403
|
+
]), ie = p(() => G >= 0 ? $e(U, (e) => e === G) : void 0, [U, G]), q = p(() => {
|
|
1404
|
+
if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
|
|
1405
|
+
}, [d, S]), J = p(() => {
|
|
1150
1406
|
if (S) {
|
|
1151
1407
|
if (l) return l(S);
|
|
1152
1408
|
if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
|
|
@@ -1155,71 +1411,71 @@ var ne = {
|
|
|
1155
1411
|
c,
|
|
1156
1412
|
l,
|
|
1157
1413
|
S
|
|
1158
|
-
]),
|
|
1414
|
+
]), Y = (e, t) => /* @__PURE__ */ O("div", {
|
|
1159
1415
|
className: e ? `track ${e}` : "track",
|
|
1160
1416
|
style: t ? { maskImage: t } : void 0,
|
|
1161
1417
|
children: [
|
|
1162
|
-
/* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
1418
|
+
/* @__PURE__ */ D("div", { className: "background-bar" }),
|
|
1419
|
+
/* @__PURE__ */ D("div", {
|
|
1164
1420
|
className: "loaded",
|
|
1165
|
-
children:
|
|
1421
|
+
children: te
|
|
1166
1422
|
}),
|
|
1167
|
-
/* @__PURE__ */
|
|
1423
|
+
/* @__PURE__ */ D("div", {
|
|
1168
1424
|
className: "play-container",
|
|
1169
|
-
children: /* @__PURE__ */
|
|
1425
|
+
children: /* @__PURE__ */ D("div", {
|
|
1170
1426
|
className: "play",
|
|
1171
|
-
style: { transform: `scaleX(${
|
|
1427
|
+
style: { transform: `scaleX(${ne})` }
|
|
1172
1428
|
})
|
|
1173
1429
|
})
|
|
1174
1430
|
]
|
|
1175
1431
|
});
|
|
1176
|
-
return /* @__PURE__ */
|
|
1177
|
-
css:
|
|
1432
|
+
return /* @__PURE__ */ O("div", {
|
|
1433
|
+
css: _t,
|
|
1178
1434
|
ref: y,
|
|
1179
1435
|
className: [
|
|
1180
1436
|
"progress-bar",
|
|
1181
1437
|
N ? "dragging" : "",
|
|
1182
|
-
|
|
1438
|
+
W ? "segmented" : ""
|
|
1183
1439
|
].filter(Boolean).join(" "),
|
|
1184
1440
|
onPointerDown: z,
|
|
1185
1441
|
onPointerMove: z,
|
|
1186
|
-
onMouseMove:
|
|
1187
|
-
onMouseOut:
|
|
1442
|
+
onMouseMove: B,
|
|
1443
|
+
onMouseOut: V,
|
|
1188
1444
|
children: [
|
|
1189
|
-
|
|
1190
|
-
S ? /* @__PURE__ */
|
|
1445
|
+
Y(void 0, re),
|
|
1446
|
+
S ? /* @__PURE__ */ O("div", {
|
|
1191
1447
|
className: "cursor-time",
|
|
1192
1448
|
style: {
|
|
1193
|
-
left:
|
|
1194
|
-
maxWidth:
|
|
1449
|
+
left: q ? `clamp(var(--thumbnail-half), ${H(S)}%, calc(100% - var(--thumbnail-half)))` : `clamp(calc(3 * var(--mp-unit)), ${H(S)}%, calc(100% - calc(3 * var(--mp-unit))))`,
|
|
1450
|
+
maxWidth: q ? "var(--thumbnail-width)" : void 0
|
|
1195
1451
|
},
|
|
1196
|
-
children: [/* @__PURE__ */
|
|
1452
|
+
children: [/* @__PURE__ */ D("span", {
|
|
1197
1453
|
className: "cursor-time-value",
|
|
1198
|
-
children:
|
|
1199
|
-
}),
|
|
1454
|
+
children: He(S)
|
|
1455
|
+
}), q ? /* @__PURE__ */ D("span", {
|
|
1200
1456
|
className: "chapter-title",
|
|
1201
|
-
children:
|
|
1457
|
+
children: q.title
|
|
1202
1458
|
}) : void 0]
|
|
1203
1459
|
}) : void 0,
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1206
|
-
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1460
|
+
/* @__PURE__ */ D("div", { className: "progress" }),
|
|
1461
|
+
/* @__PURE__ */ D("div", { className: "hover" }),
|
|
1462
|
+
ie ? Y("focus", ie) : void 0,
|
|
1463
|
+
/* @__PURE__ */ D("div", { className: "scrubber" }),
|
|
1464
|
+
/* @__PURE__ */ D("div", {
|
|
1209
1465
|
className: "padding",
|
|
1210
1466
|
...P,
|
|
1211
1467
|
onPointerDown: F,
|
|
1212
1468
|
onPointerUp: I,
|
|
1213
1469
|
onPointerCancel: I
|
|
1214
1470
|
}),
|
|
1215
|
-
/* @__PURE__ */
|
|
1471
|
+
/* @__PURE__ */ D("div", {
|
|
1216
1472
|
className: "thumbnail",
|
|
1217
|
-
style: { left: `clamp(var(--thumbnail-half), ${
|
|
1218
|
-
children:
|
|
1473
|
+
style: { left: `clamp(var(--thumbnail-half), ${H(S ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
|
|
1474
|
+
children: J?.url ? /* @__PURE__ */ D("img", { src: J.url }) : void 0
|
|
1219
1475
|
})
|
|
1220
1476
|
]
|
|
1221
1477
|
});
|
|
1222
|
-
},
|
|
1478
|
+
}, bt = "data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='24'%20height='24'%20viewBox='0%200%2024%2024'%20fill='none'%20stroke='%23fff'%20stroke-width='2'%20stroke-linecap='round'%20stroke-linejoin='round'%20class='icon%20icon-tabler%20icons-tabler-outline%20icon-tabler-picture-in-picture'%3e%3cpath%20stroke='none'%20d='M0%200h24v24H0z'%20fill='none'%20/%3e%3cpath%20d='M11%2019h-6a2%202%200%200%201%20-2%20-2v-10a2%202%200%200%201%202%20-2h14a2%202%200%200%201%202%202v4'%20/%3e%3cpath%20d='M14%2014m0%201a1%201%200%200%201%201%20-1h5a1%201%200%200%201%201%201v3a1%201%200%200%201%20-1%201h-5a1%201%200%200%201%20-1%20-1z'%20/%3e%3c/svg%3e", xt = {
|
|
1223
1479
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1224
1480
|
width: 24,
|
|
1225
1481
|
height: 24,
|
|
@@ -1229,12 +1485,12 @@ var ne = {
|
|
|
1229
1485
|
strokeWidth: 2,
|
|
1230
1486
|
strokeLinecap: "round",
|
|
1231
1487
|
strokeLinejoin: "round"
|
|
1232
|
-
},
|
|
1233
|
-
...
|
|
1488
|
+
}, St = (e) => /* @__PURE__ */ O("svg", {
|
|
1489
|
+
...xt,
|
|
1234
1490
|
...e,
|
|
1235
1491
|
children: [
|
|
1236
|
-
/* @__PURE__ */
|
|
1237
|
-
/* @__PURE__ */
|
|
1492
|
+
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1493
|
+
/* @__PURE__ */ D("rect", {
|
|
1238
1494
|
x: "12",
|
|
1239
1495
|
y: "13",
|
|
1240
1496
|
width: "10",
|
|
@@ -1242,14 +1498,14 @@ var ne = {
|
|
|
1242
1498
|
rx: "1",
|
|
1243
1499
|
ry: "1"
|
|
1244
1500
|
}),
|
|
1245
|
-
/* @__PURE__ */
|
|
1501
|
+
/* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
|
|
1246
1502
|
]
|
|
1247
|
-
}),
|
|
1248
|
-
...
|
|
1503
|
+
}), Ct = (e) => /* @__PURE__ */ O("svg", {
|
|
1504
|
+
...xt,
|
|
1249
1505
|
...e,
|
|
1250
1506
|
children: [
|
|
1251
|
-
/* @__PURE__ */
|
|
1252
|
-
/* @__PURE__ */
|
|
1507
|
+
/* @__PURE__ */ D("path", { d: "M21 11V7a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h5" }),
|
|
1508
|
+
/* @__PURE__ */ D("rect", {
|
|
1253
1509
|
x: "12",
|
|
1254
1510
|
y: "13",
|
|
1255
1511
|
width: "10",
|
|
@@ -1257,9 +1513,9 @@ var ne = {
|
|
|
1257
1513
|
rx: "1",
|
|
1258
1514
|
ry: "1"
|
|
1259
1515
|
}),
|
|
1260
|
-
/* @__PURE__ */
|
|
1516
|
+
/* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
|
|
1261
1517
|
]
|
|
1262
|
-
}),
|
|
1518
|
+
}), wt = _`
|
|
1263
1519
|
.popover {
|
|
1264
1520
|
position: absolute;
|
|
1265
1521
|
/* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
|
|
@@ -1386,26 +1642,26 @@ var ne = {
|
|
|
1386
1642
|
${Z.bSmall.regular}
|
|
1387
1643
|
}
|
|
1388
1644
|
}
|
|
1389
|
-
`,
|
|
1645
|
+
`, Tt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
|
|
1390
1646
|
let c = o !== void 0, l = (e, i, a) => {
|
|
1391
1647
|
let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
|
|
1392
|
-
return /* @__PURE__ */
|
|
1648
|
+
return /* @__PURE__ */ O("div", {
|
|
1393
1649
|
onClick: () => {
|
|
1394
1650
|
l || r(e ?? void 0);
|
|
1395
1651
|
},
|
|
1396
1652
|
className: [a, l ? "unavailable" : null].filter(Boolean).join(" ") || void 0,
|
|
1397
|
-
children: [/* @__PURE__ */
|
|
1653
|
+
children: [/* @__PURE__ */ D("span", { children: i }), /* @__PURE__ */ D("span", { children: s ? "…" : (n ?? null) === e ? "✓" : "" })]
|
|
1398
1654
|
}, e ?? "__off__");
|
|
1399
1655
|
};
|
|
1400
|
-
return /* @__PURE__ */
|
|
1656
|
+
return /* @__PURE__ */ O("div", {
|
|
1401
1657
|
className: "popover track-list",
|
|
1402
1658
|
children: [
|
|
1403
|
-
/* @__PURE__ */
|
|
1659
|
+
/* @__PURE__ */ O("div", {
|
|
1404
1660
|
className: i ? "back" : "back no-hover",
|
|
1405
1661
|
onClick: i,
|
|
1406
|
-
children: [i ? /* @__PURE__ */
|
|
1662
|
+
children: [i ? /* @__PURE__ */ D(M, {}) : null, /* @__PURE__ */ D("span", { children: e })]
|
|
1407
1663
|
}),
|
|
1408
|
-
s ? /* @__PURE__ */
|
|
1664
|
+
s ? /* @__PURE__ */ D("div", {
|
|
1409
1665
|
className: "no-hover failed",
|
|
1410
1666
|
children: "Could not switch. Try again."
|
|
1411
1667
|
}) : null,
|
|
@@ -1413,13 +1669,13 @@ var ne = {
|
|
|
1413
1669
|
t.map(({ id: e, label: t }) => l(e, t, "description"))
|
|
1414
1670
|
]
|
|
1415
1671
|
});
|
|
1416
|
-
},
|
|
1417
|
-
let t =
|
|
1672
|
+
}, Et = ({ onReset: e } = {}) => {
|
|
1673
|
+
let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
|
|
1418
1674
|
c.current = e;
|
|
1419
1675
|
let l = () => {
|
|
1420
1676
|
r(!1), c.current?.();
|
|
1421
1677
|
};
|
|
1422
|
-
return
|
|
1678
|
+
return f(() => {
|
|
1423
1679
|
let e = (e) => {
|
|
1424
1680
|
n && t.current && !t.current.contains(e.target) && l();
|
|
1425
1681
|
};
|
|
@@ -1454,7 +1710,7 @@ var ne = {
|
|
|
1454
1710
|
});
|
|
1455
1711
|
}
|
|
1456
1712
|
};
|
|
1457
|
-
},
|
|
1713
|
+
}, Dt = _`
|
|
1458
1714
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1459
1715
|
which is the width of the player box, so it can be clamped to it. */
|
|
1460
1716
|
position: static;
|
|
@@ -1470,7 +1726,7 @@ position: static;
|
|
|
1470
1726
|
}
|
|
1471
1727
|
}
|
|
1472
1728
|
|
|
1473
|
-
${
|
|
1729
|
+
${wt}
|
|
1474
1730
|
|
|
1475
1731
|
.popover.error-list {
|
|
1476
1732
|
/* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
|
|
@@ -1542,68 +1798,68 @@ ${gt}
|
|
|
1542
1798
|
}
|
|
1543
1799
|
}
|
|
1544
1800
|
}
|
|
1545
|
-
`,
|
|
1546
|
-
let n =
|
|
1801
|
+
`, Ot = (e) => new Date(e).toLocaleTimeString(), kt = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : He(Math.max(0, e)), At = (e) => e.reduce((e, t) => e + t.count, 0), jt = (e) => e.map((e, t) => {
|
|
1802
|
+
let n = kt(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
|
|
1547
1803
|
return [
|
|
1548
1804
|
`${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
|
|
1549
1805
|
e.message,
|
|
1550
1806
|
e.detail
|
|
1551
1807
|
].filter(Boolean).join("\n");
|
|
1552
|
-
}).join("\n\n"),
|
|
1553
|
-
let e =
|
|
1808
|
+
}).join("\n\n"), Mt = () => {
|
|
1809
|
+
let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Et(), [i, a] = h(!1);
|
|
1554
1810
|
if (e.length === 0) return null;
|
|
1555
1811
|
let o = () => {
|
|
1556
|
-
navigator.clipboard?.writeText(
|
|
1812
|
+
navigator.clipboard?.writeText(jt(e)).then(() => {
|
|
1557
1813
|
a(!0), setTimeout(() => a(!1), 2e3);
|
|
1558
1814
|
}, (e) => console.warn("[media-player] could not copy the errors:", e));
|
|
1559
|
-
}, s = `Playback errors (${
|
|
1560
|
-
return /* @__PURE__ */
|
|
1561
|
-
css:
|
|
1815
|
+
}, s = `Playback errors (${At(e)})`;
|
|
1816
|
+
return /* @__PURE__ */ O("div", {
|
|
1817
|
+
css: Dt,
|
|
1562
1818
|
ref: r,
|
|
1563
|
-
children: [/* @__PURE__ */
|
|
1819
|
+
children: [/* @__PURE__ */ D($, {
|
|
1564
1820
|
id: "errors",
|
|
1565
1821
|
disabled: t,
|
|
1566
|
-
text: /* @__PURE__ */
|
|
1822
|
+
text: /* @__PURE__ */ D("button", {
|
|
1567
1823
|
className: "errors",
|
|
1568
1824
|
type: "button",
|
|
1569
1825
|
onClick: n,
|
|
1570
1826
|
"aria-label": s,
|
|
1571
1827
|
"aria-expanded": t,
|
|
1572
|
-
children: /* @__PURE__ */
|
|
1828
|
+
children: /* @__PURE__ */ D(V, { className: "alert-triangle" })
|
|
1573
1829
|
}),
|
|
1574
|
-
toolTipText: /* @__PURE__ */
|
|
1575
|
-
}), t && /* @__PURE__ */
|
|
1830
|
+
toolTipText: /* @__PURE__ */ D("span", { children: s })
|
|
1831
|
+
}), t && /* @__PURE__ */ O("div", {
|
|
1576
1832
|
className: "popover error-list",
|
|
1577
|
-
children: [/* @__PURE__ */
|
|
1833
|
+
children: [/* @__PURE__ */ O("div", {
|
|
1578
1834
|
className: "back no-hover",
|
|
1579
|
-
children: [/* @__PURE__ */
|
|
1835
|
+
children: [/* @__PURE__ */ D("span", { children: s }), /* @__PURE__ */ O("button", {
|
|
1580
1836
|
className: "copy",
|
|
1581
1837
|
type: "button",
|
|
1582
1838
|
onClick: o,
|
|
1583
1839
|
"aria-label": "Copy the errors",
|
|
1584
|
-
children: [
|
|
1840
|
+
children: [D(i ? j : P, {}), /* @__PURE__ */ D("span", { children: i ? "Copied" : "Copy" })]
|
|
1585
1841
|
})]
|
|
1586
|
-
}), e.map((e, t) => /* @__PURE__ */
|
|
1842
|
+
}), e.map((e, t) => /* @__PURE__ */ O("div", {
|
|
1587
1843
|
className: "entry no-hover",
|
|
1588
1844
|
children: [
|
|
1589
|
-
/* @__PURE__ */
|
|
1845
|
+
/* @__PURE__ */ O("span", {
|
|
1590
1846
|
className: "when",
|
|
1591
1847
|
children: [
|
|
1592
|
-
|
|
1593
|
-
e.count > 1 ? ` to ${
|
|
1594
|
-
|
|
1848
|
+
Ot(e.at),
|
|
1849
|
+
e.count > 1 ? ` to ${Ot(e.lastAt)}` : "",
|
|
1850
|
+
kt(e.atMediaTime) ? ` at ${kt(e.atMediaTime)}` : "",
|
|
1595
1851
|
e.recovered ? " recovered" : "",
|
|
1596
|
-
e.count > 1 ? /* @__PURE__ */
|
|
1852
|
+
e.count > 1 ? /* @__PURE__ */ D("span", {
|
|
1597
1853
|
className: "count",
|
|
1598
1854
|
children: `×${e.count}`
|
|
1599
1855
|
}) : null
|
|
1600
1856
|
]
|
|
1601
1857
|
}),
|
|
1602
|
-
/* @__PURE__ */
|
|
1858
|
+
/* @__PURE__ */ D("span", {
|
|
1603
1859
|
className: "what",
|
|
1604
1860
|
children: e.message
|
|
1605
1861
|
}),
|
|
1606
|
-
e.detail ? /* @__PURE__ */
|
|
1862
|
+
e.detail ? /* @__PURE__ */ D("span", {
|
|
1607
1863
|
className: "cause",
|
|
1608
1864
|
children: e.detail
|
|
1609
1865
|
}) : null
|
|
@@ -1611,7 +1867,7 @@ ${gt}
|
|
|
1611
1867
|
}, `${e.at}-${t}`))]
|
|
1612
1868
|
})]
|
|
1613
1869
|
});
|
|
1614
|
-
},
|
|
1870
|
+
}, Nt = _`
|
|
1615
1871
|
display: flex;
|
|
1616
1872
|
align-items: center;
|
|
1617
1873
|
justify-content: center;
|
|
@@ -1664,42 +1920,42 @@ width: 100%;
|
|
|
1664
1920
|
}
|
|
1665
1921
|
}
|
|
1666
1922
|
}
|
|
1667
|
-
`,
|
|
1668
|
-
let e =
|
|
1923
|
+
`, Pt = () => {
|
|
1924
|
+
let e = K(), t = K((e) => e.playbackRate), n = m(null), r = m(null), i = .25, a = 2.75, o = (e, t = .05) => Math.round(e / t) * t, s = o(t || 1), c = (e) => (e - i) / a * 100, l = (e) => o(i + e * a), { handlers: u } = qe({
|
|
1669
1925
|
ref: r,
|
|
1670
1926
|
onChange: (t) => e.setPlaybackRate(l(t))
|
|
1671
|
-
}),
|
|
1927
|
+
}), d = (t) => {
|
|
1672
1928
|
t.preventDefault();
|
|
1673
1929
|
let n = .05, r = s;
|
|
1674
1930
|
r = t.deltaY < 0 ? Math.min(3, r + n) : Math.max(i, r - n), e.setPlaybackRate(r);
|
|
1675
1931
|
};
|
|
1676
|
-
|
|
1932
|
+
f(() => {
|
|
1677
1933
|
let e = n.current;
|
|
1678
|
-
return e && e.addEventListener("wheel",
|
|
1679
|
-
e && e.removeEventListener("wheel",
|
|
1934
|
+
return e && e.addEventListener("wheel", d, { passive: !1 }), () => {
|
|
1935
|
+
e && e.removeEventListener("wheel", d);
|
|
1680
1936
|
};
|
|
1681
1937
|
}, [t]);
|
|
1682
|
-
let
|
|
1683
|
-
return /* @__PURE__ */
|
|
1684
|
-
css:
|
|
1685
|
-
children: [/* @__PURE__ */
|
|
1938
|
+
let p = c(s);
|
|
1939
|
+
return /* @__PURE__ */ O("div", {
|
|
1940
|
+
css: Nt,
|
|
1941
|
+
children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
|
|
1686
1942
|
className: "playback-slider",
|
|
1687
1943
|
ref: n,
|
|
1688
1944
|
...u,
|
|
1689
|
-
children: /* @__PURE__ */
|
|
1945
|
+
children: /* @__PURE__ */ D("div", {
|
|
1690
1946
|
ref: r,
|
|
1691
1947
|
style: { background: `linear-gradient(to right,
|
|
1692
|
-
#fff 0% ${
|
|
1693
|
-
#3A3A3A ${
|
|
1948
|
+
#fff 0% ${p}%,
|
|
1949
|
+
#3A3A3A ${p}% 100%
|
|
1694
1950
|
)` },
|
|
1695
|
-
children: /* @__PURE__ */
|
|
1951
|
+
children: /* @__PURE__ */ D("div", {
|
|
1696
1952
|
className: "playback-handle",
|
|
1697
|
-
style: { left: `${
|
|
1953
|
+
style: { left: `${p}%` }
|
|
1698
1954
|
})
|
|
1699
1955
|
})
|
|
1700
1956
|
})]
|
|
1701
1957
|
});
|
|
1702
|
-
},
|
|
1958
|
+
}, Ft = _`
|
|
1703
1959
|
/* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
|
|
1704
1960
|
as wide as the player box and can therefore be clamped to it. The outside-click check uses
|
|
1705
1961
|
\`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
|
|
@@ -1717,7 +1973,7 @@ position: static;
|
|
|
1717
1973
|
}
|
|
1718
1974
|
}
|
|
1719
1975
|
|
|
1720
|
-
${
|
|
1976
|
+
${wt}
|
|
1721
1977
|
|
|
1722
1978
|
.switch {
|
|
1723
1979
|
position: relative;
|
|
@@ -1793,55 +2049,55 @@ ${gt}
|
|
|
1793
2049
|
}
|
|
1794
2050
|
}
|
|
1795
2051
|
|
|
1796
|
-
`,
|
|
1797
|
-
let e =
|
|
2052
|
+
`, It = () => {
|
|
2053
|
+
let e = K(), t = K((e) => e.playbackRate), n = K((e) => e.audioTracks), r = K((e) => e.selectedAudioTrack), i = K((e) => e.selectAudioTrack), a = K((e) => e.quality), o = K((e) => e.volumeNormalizer), [s, c] = h(0), { open: l, toggle: u, containerRef: d, pending: f, failed: p, runSelect: m } = Et({ onReset: () => c(0) }), g = (t) => {
|
|
1798
2054
|
e.setPlaybackRate(t), c(0);
|
|
1799
2055
|
}, _ = (e) => {
|
|
1800
|
-
e !== void 0 &&
|
|
2056
|
+
e !== void 0 && m(e, () => i(e));
|
|
1801
2057
|
}, v = (e) => {
|
|
1802
|
-
a &&
|
|
2058
|
+
a && m(e ?? null, () => a.select(e === void 0 ? null : String(e)));
|
|
1803
2059
|
}, y = a ? a.options.length + +!!a.offLabel : 0, b = a?.selectedId == null ? a?.offLabel : a.options.find(({ id: e }) => e === a.selectedId)?.label, x = (e) => () => {
|
|
1804
2060
|
c(e);
|
|
1805
2061
|
};
|
|
1806
|
-
return /* @__PURE__ */
|
|
1807
|
-
css:
|
|
2062
|
+
return /* @__PURE__ */ O("div", {
|
|
2063
|
+
css: Ft,
|
|
1808
2064
|
ref: d,
|
|
1809
2065
|
children: [
|
|
1810
|
-
/* @__PURE__ */
|
|
2066
|
+
/* @__PURE__ */ D($, {
|
|
1811
2067
|
id: "settings",
|
|
1812
2068
|
disabled: l,
|
|
1813
|
-
text: /* @__PURE__ */
|
|
2069
|
+
text: /* @__PURE__ */ D("button", {
|
|
1814
2070
|
className: "settings",
|
|
1815
2071
|
type: "button",
|
|
1816
2072
|
onClick: u,
|
|
1817
2073
|
"aria-label": "Settings",
|
|
1818
2074
|
"aria-expanded": l,
|
|
1819
|
-
children: /* @__PURE__ */
|
|
2075
|
+
children: /* @__PURE__ */ D(B, {})
|
|
1820
2076
|
}),
|
|
1821
|
-
toolTipText: /* @__PURE__ */
|
|
2077
|
+
toolTipText: /* @__PURE__ */ D("span", { children: "Settings" })
|
|
1822
2078
|
}),
|
|
1823
|
-
l && s === 0 && /* @__PURE__ */
|
|
2079
|
+
l && s === 0 && /* @__PURE__ */ O("div", {
|
|
1824
2080
|
className: "popover menu",
|
|
1825
2081
|
children: [
|
|
1826
|
-
n.length > 1 ? /* @__PURE__ */
|
|
2082
|
+
n.length > 1 ? /* @__PURE__ */ O("div", {
|
|
1827
2083
|
onClick: x(2),
|
|
1828
|
-
children: [/* @__PURE__ */
|
|
2084
|
+
children: [/* @__PURE__ */ D("div", { children: "Audio" }), /* @__PURE__ */ D("div", { children: /* @__PURE__ */ D(N, {}) })]
|
|
1829
2085
|
}) : null,
|
|
1830
|
-
y > 1 ? /* @__PURE__ */
|
|
2086
|
+
y > 1 ? /* @__PURE__ */ O("div", {
|
|
1831
2087
|
onClick: x(3),
|
|
1832
|
-
children: [/* @__PURE__ */
|
|
2088
|
+
children: [/* @__PURE__ */ D("div", { children: "Quality" }), /* @__PURE__ */ O("div", { children: [b ? /* @__PURE__ */ D("span", {
|
|
1833
2089
|
className: "secondary",
|
|
1834
2090
|
children: b
|
|
1835
|
-
}) : null, /* @__PURE__ */
|
|
2091
|
+
}) : null, /* @__PURE__ */ D(N, {})] })]
|
|
1836
2092
|
}) : null,
|
|
1837
|
-
/* @__PURE__ */
|
|
2093
|
+
/* @__PURE__ */ O("div", {
|
|
1838
2094
|
onClick: x(1),
|
|
1839
|
-
children: [/* @__PURE__ */
|
|
2095
|
+
children: [/* @__PURE__ */ D("div", { children: "Playback speed" }), /* @__PURE__ */ O("div", { children: [/* @__PURE__ */ D("span", {
|
|
1840
2096
|
className: "secondary",
|
|
1841
2097
|
children: t === 1 ? "(Default)" : t.toFixed(2)
|
|
1842
|
-
}), /* @__PURE__ */
|
|
2098
|
+
}), /* @__PURE__ */ D(N, {})] })]
|
|
1843
2099
|
}),
|
|
1844
|
-
o ? /* @__PURE__ */
|
|
2100
|
+
o ? /* @__PURE__ */ O("div", {
|
|
1845
2101
|
role: "switch",
|
|
1846
2102
|
"aria-checked": o.available && o.enabled,
|
|
1847
2103
|
"aria-disabled": !o.available,
|
|
@@ -1849,41 +2105,41 @@ ${gt}
|
|
|
1849
2105
|
onClick: () => {
|
|
1850
2106
|
o.available && o.setEnabled(!o.enabled);
|
|
1851
2107
|
},
|
|
1852
|
-
children: [/* @__PURE__ */
|
|
2108
|
+
children: [/* @__PURE__ */ D("div", { children: "Normalize volume" }), /* @__PURE__ */ D("div", { children: o.available ? /* @__PURE__ */ D("span", { className: o.enabled ? "switch on" : "switch" }) : /* @__PURE__ */ D("span", {
|
|
1853
2109
|
className: "secondary",
|
|
1854
2110
|
children: "Unavailable"
|
|
1855
2111
|
}) })]
|
|
1856
2112
|
}) : null
|
|
1857
2113
|
]
|
|
1858
2114
|
}),
|
|
1859
|
-
l && s === 1 && /* @__PURE__ */
|
|
2115
|
+
l && s === 1 && /* @__PURE__ */ O("div", {
|
|
1860
2116
|
className: "popover playback-rate",
|
|
1861
2117
|
children: [
|
|
1862
|
-
/* @__PURE__ */
|
|
2118
|
+
/* @__PURE__ */ O("div", {
|
|
1863
2119
|
className: "back",
|
|
1864
2120
|
onClick: x(0),
|
|
1865
|
-
children: [/* @__PURE__ */
|
|
2121
|
+
children: [/* @__PURE__ */ D(M, {}), /* @__PURE__ */ D("span", { children: "Playback speed" })]
|
|
1866
2122
|
}),
|
|
1867
|
-
/* @__PURE__ */
|
|
2123
|
+
/* @__PURE__ */ D("div", {
|
|
1868
2124
|
className: "slider no-hover",
|
|
1869
|
-
children: /* @__PURE__ */
|
|
2125
|
+
children: /* @__PURE__ */ D(Pt, {})
|
|
1870
2126
|
}),
|
|
1871
|
-
/* @__PURE__ */
|
|
2127
|
+
/* @__PURE__ */ O("div", {
|
|
1872
2128
|
className: "options no-hover",
|
|
1873
2129
|
children: [
|
|
1874
|
-
/* @__PURE__ */
|
|
2130
|
+
/* @__PURE__ */ D("div", {
|
|
1875
2131
|
onClick: () => g(.5),
|
|
1876
2132
|
children: "0.5x"
|
|
1877
2133
|
}),
|
|
1878
|
-
/* @__PURE__ */
|
|
2134
|
+
/* @__PURE__ */ D("div", {
|
|
1879
2135
|
onClick: () => g(1),
|
|
1880
2136
|
children: "1x"
|
|
1881
2137
|
}),
|
|
1882
|
-
/* @__PURE__ */
|
|
2138
|
+
/* @__PURE__ */ D("div", {
|
|
1883
2139
|
onClick: () => g(1.5),
|
|
1884
2140
|
children: "1.5x"
|
|
1885
2141
|
}),
|
|
1886
|
-
/* @__PURE__ */
|
|
2142
|
+
/* @__PURE__ */ D("div", {
|
|
1887
2143
|
onClick: () => g(2),
|
|
1888
2144
|
children: "2x"
|
|
1889
2145
|
})
|
|
@@ -1891,7 +2147,7 @@ ${gt}
|
|
|
1891
2147
|
})
|
|
1892
2148
|
]
|
|
1893
2149
|
}),
|
|
1894
|
-
l && s === 2 && /* @__PURE__ */
|
|
2150
|
+
l && s === 2 && /* @__PURE__ */ D(Tt, {
|
|
1895
2151
|
title: "Audio",
|
|
1896
2152
|
tracks: n,
|
|
1897
2153
|
selected: r,
|
|
@@ -1900,7 +2156,7 @@ ${gt}
|
|
|
1900
2156
|
pending: f,
|
|
1901
2157
|
failed: p
|
|
1902
2158
|
}),
|
|
1903
|
-
l && s === 3 && a && /* @__PURE__ */
|
|
2159
|
+
l && s === 3 && a && /* @__PURE__ */ D(Tt, {
|
|
1904
2160
|
title: "Quality",
|
|
1905
2161
|
tracks: a.options,
|
|
1906
2162
|
selected: a.selectedId ?? void 0,
|
|
@@ -1912,7 +2168,7 @@ ${gt}
|
|
|
1912
2168
|
})
|
|
1913
2169
|
]
|
|
1914
2170
|
});
|
|
1915
|
-
},
|
|
2171
|
+
}, Lt = _`
|
|
1916
2172
|
/* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
|
|
1917
2173
|
which is the width of the player box, so it can be clamped to it. */
|
|
1918
2174
|
position: static;
|
|
@@ -1928,28 +2184,28 @@ position: static;
|
|
|
1928
2184
|
}
|
|
1929
2185
|
}
|
|
1930
2186
|
|
|
1931
|
-
${
|
|
1932
|
-
`,
|
|
1933
|
-
let e =
|
|
2187
|
+
${wt}
|
|
2188
|
+
`, Rt = () => {
|
|
2189
|
+
let e = K((e) => e.subtitleTracks), t = K((e) => e.selectedSubtitleTrack), n = K((e) => e.selectSubtitleTrack), r = K((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Et();
|
|
1934
2190
|
if (e.length === 0) return null;
|
|
1935
2191
|
let u = t !== void 0;
|
|
1936
|
-
return /* @__PURE__ */
|
|
1937
|
-
css:
|
|
2192
|
+
return /* @__PURE__ */ O("div", {
|
|
2193
|
+
css: Lt,
|
|
1938
2194
|
ref: o,
|
|
1939
|
-
children: [/* @__PURE__ */
|
|
2195
|
+
children: [/* @__PURE__ */ D($, {
|
|
1940
2196
|
id: "subtitles",
|
|
1941
2197
|
disabled: i,
|
|
1942
|
-
text: /* @__PURE__ */
|
|
2198
|
+
text: /* @__PURE__ */ D("button", {
|
|
1943
2199
|
className: "subtitles",
|
|
1944
2200
|
type: "button",
|
|
1945
2201
|
onClick: a,
|
|
1946
2202
|
"aria-label": "Subtitles",
|
|
1947
2203
|
"aria-expanded": i,
|
|
1948
2204
|
"aria-pressed": u,
|
|
1949
|
-
children: u ? /* @__PURE__ */
|
|
2205
|
+
children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
|
|
1950
2206
|
}),
|
|
1951
|
-
toolTipText: /* @__PURE__ */
|
|
1952
|
-
}), i && /* @__PURE__ */
|
|
2207
|
+
toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
|
|
2208
|
+
}), i && /* @__PURE__ */ D(Tt, {
|
|
1953
2209
|
title: "Subtitles",
|
|
1954
2210
|
tracks: e,
|
|
1955
2211
|
selected: t,
|
|
@@ -1959,13 +2215,13 @@ ${gt}
|
|
|
1959
2215
|
failed: c
|
|
1960
2216
|
})]
|
|
1961
2217
|
});
|
|
1962
|
-
},
|
|
2218
|
+
}, zt = {
|
|
1963
2219
|
primary: "#EAEBEE",
|
|
1964
2220
|
secondary: "#D0D0D9",
|
|
1965
2221
|
hover: "rgba(255, 255, 255, 0.13)",
|
|
1966
2222
|
borderPrimary: "#384F70",
|
|
1967
2223
|
backgroundTooltip: "#222222"
|
|
1968
|
-
},
|
|
2224
|
+
}, Bt = _`
|
|
1969
2225
|
display: flex;
|
|
1970
2226
|
align-items: center;
|
|
1971
2227
|
|
|
@@ -2008,8 +2264,8 @@ ${gt}
|
|
|
2008
2264
|
width: 10px;
|
|
2009
2265
|
height: 10px;
|
|
2010
2266
|
}
|
|
2011
|
-
`,
|
|
2012
|
-
let n =
|
|
2267
|
+
`, Vt = ({ value: e, onChange: t }) => {
|
|
2268
|
+
let n = K((e) => e.volume), r = K((e) => e.muted), i = m(null), a = m(null), { handlers: o } = qe({
|
|
2013
2269
|
ref: a,
|
|
2014
2270
|
onChange: t
|
|
2015
2271
|
}), s = (n) => {
|
|
@@ -2017,37 +2273,37 @@ ${gt}
|
|
|
2017
2273
|
let r = .05, i = e;
|
|
2018
2274
|
i = n.deltaY < 0 ? Math.min(1, i + r) : Math.max(0, i - r), t(i);
|
|
2019
2275
|
};
|
|
2020
|
-
|
|
2276
|
+
f(() => {
|
|
2021
2277
|
let e = i.current;
|
|
2022
2278
|
return e && e.addEventListener("wheel", s, { passive: !1 }), () => {
|
|
2023
2279
|
e && e.removeEventListener("wheel", s);
|
|
2024
2280
|
};
|
|
2025
2281
|
}, [e]);
|
|
2026
|
-
let c = e * 100, l =
|
|
2027
|
-
return /* @__PURE__ */
|
|
2282
|
+
let c = e * 100, l = p(() => Math.round(r ? 0 : Ve(n) * 100), [n, r]);
|
|
2283
|
+
return /* @__PURE__ */ D($, {
|
|
2028
2284
|
id: "volume-slider",
|
|
2029
|
-
text: /* @__PURE__ */
|
|
2285
|
+
text: /* @__PURE__ */ D("div", {
|
|
2030
2286
|
ref: i,
|
|
2031
|
-
css:
|
|
2287
|
+
css: Bt,
|
|
2032
2288
|
...o,
|
|
2033
|
-
children: /* @__PURE__ */
|
|
2289
|
+
children: /* @__PURE__ */ D("div", {
|
|
2034
2290
|
ref: a,
|
|
2035
2291
|
style: { background: `linear-gradient(to right,
|
|
2036
2292
|
#fff 0% ${c}%,
|
|
2037
2293
|
#3A3A3A ${c}% 100%
|
|
2038
2294
|
)` },
|
|
2039
|
-
children: /* @__PURE__ */
|
|
2295
|
+
children: /* @__PURE__ */ D("div", {
|
|
2040
2296
|
className: "volume-handle",
|
|
2041
2297
|
style: { left: `${e * 100}%` }
|
|
2042
2298
|
})
|
|
2043
2299
|
})
|
|
2044
2300
|
}),
|
|
2045
|
-
toolTipText: /* @__PURE__ */
|
|
2301
|
+
toolTipText: /* @__PURE__ */ O("div", {
|
|
2046
2302
|
className: "volume-value",
|
|
2047
2303
|
children: [l, "%"]
|
|
2048
2304
|
})
|
|
2049
2305
|
});
|
|
2050
|
-
},
|
|
2306
|
+
}, Ht = _`
|
|
2051
2307
|
position: relative;
|
|
2052
2308
|
display: flex;
|
|
2053
2309
|
align-items: center;
|
|
@@ -2110,39 +2366,39 @@ ${gt}
|
|
|
2110
2366
|
}
|
|
2111
2367
|
}
|
|
2112
2368
|
|
|
2113
|
-
`,
|
|
2114
|
-
let t =
|
|
2115
|
-
return /* @__PURE__ */
|
|
2116
|
-
css:
|
|
2117
|
-
children: [/* @__PURE__ */
|
|
2369
|
+
`, Ut = ({ ref: e }) => {
|
|
2370
|
+
let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() => Ve(n), [n]);
|
|
2371
|
+
return /* @__PURE__ */ O("div", {
|
|
2372
|
+
css: Ht,
|
|
2373
|
+
children: [/* @__PURE__ */ D($, {
|
|
2118
2374
|
id: "sound",
|
|
2119
|
-
text: /* @__PURE__ */
|
|
2375
|
+
text: /* @__PURE__ */ D("button", {
|
|
2120
2376
|
className: "sound",
|
|
2121
2377
|
type: "button",
|
|
2122
2378
|
onClick: () => t.toggleMuted(),
|
|
2123
2379
|
ref: e,
|
|
2124
2380
|
"aria-label": "Mute",
|
|
2125
2381
|
"aria-pressed": r || n === 0,
|
|
2126
|
-
children:
|
|
2382
|
+
children: D(r || n === 0 ? te : n <= .5 ? H : ee, {
|
|
2127
2383
|
size: 18,
|
|
2128
2384
|
color: "#fff"
|
|
2129
2385
|
})
|
|
2130
2386
|
}),
|
|
2131
|
-
toolTipText: /* @__PURE__ */
|
|
2132
|
-
}), /* @__PURE__ */
|
|
2387
|
+
toolTipText: /* @__PURE__ */ D("span", { children: r ? "Unmute (m)" : "Mute (m)" })
|
|
2388
|
+
}), /* @__PURE__ */ D("div", {
|
|
2133
2389
|
className: "volume-slider-container",
|
|
2134
|
-
children: /* @__PURE__ */
|
|
2390
|
+
children: /* @__PURE__ */ D("div", {
|
|
2135
2391
|
className: "volume-slider-background",
|
|
2136
|
-
children: /* @__PURE__ */
|
|
2392
|
+
children: /* @__PURE__ */ D(Vt, {
|
|
2137
2393
|
value: r ? 0 : i,
|
|
2138
2394
|
onChange: (e) => {
|
|
2139
|
-
t.setVolume(
|
|
2395
|
+
t.setVolume(Be(e));
|
|
2140
2396
|
}
|
|
2141
2397
|
})
|
|
2142
2398
|
})
|
|
2143
2399
|
})]
|
|
2144
2400
|
});
|
|
2145
|
-
},
|
|
2401
|
+
}, Wt = .05, Gt = 5, Kt = 50, qt = 1e3, Jt = _`
|
|
2146
2402
|
position: absolute;
|
|
2147
2403
|
bottom: 0;
|
|
2148
2404
|
width: 100%;
|
|
@@ -2234,7 +2490,7 @@ ${gt}
|
|
|
2234
2490
|
/* .armed is the hover of a control letting its click through, which takes no pointer events
|
|
2235
2491
|
of its own and so is never :hover */
|
|
2236
2492
|
:hover, &.armed {
|
|
2237
|
-
background-color: ${
|
|
2493
|
+
background-color: ${zt.hover};
|
|
2238
2494
|
}
|
|
2239
2495
|
|
|
2240
2496
|
/* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
|
|
@@ -2272,12 +2528,12 @@ ${gt}
|
|
|
2272
2528
|
}
|
|
2273
2529
|
}
|
|
2274
2530
|
}
|
|
2275
|
-
`,
|
|
2276
|
-
let n =
|
|
2277
|
-
let r =
|
|
2278
|
-
n.setVolume(
|
|
2279
|
-
}, [n]), k =
|
|
2280
|
-
|
|
2531
|
+
`, Yt = ({ shortcuts: e = "window", root: t }) => {
|
|
2532
|
+
let n = K(), r = K((e) => e.paused), i = K((e) => e.currentTime), a = K((e) => e.duration), o = K((e) => e.seekingTo), s = K((e) => e.fullscreen), c = K((e) => e.hideUI), l = K((e) => e.togglePictureInPicture), u = K((e) => e.pictureInPictureMode), p = K((e) => e.burnedInSubtitles), g = K((e) => e.passThroughPictureInPicture), _ = K((e) => e.subtitleTracks), v = K((e) => e.requestSeek), [y, b] = h(null), x = m(null), S = m(void 0), C = u === "burn-in", w = _.length > 0, T = a > 0 && i === a, E = d(({ direction: e, stepSize: t }) => {
|
|
2533
|
+
let r = Ve(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
|
|
2534
|
+
n.setVolume(Be(a)), o && !n.muted && n.toggleMuted();
|
|
2535
|
+
}, [n]), k = m(!1);
|
|
2536
|
+
f(() => {
|
|
2281
2537
|
let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
|
|
2282
2538
|
k.current = !!t.current?.contains(i(e) ?? null);
|
|
2283
2539
|
}, o = (a) => {
|
|
@@ -2290,18 +2546,18 @@ ${gt}
|
|
|
2290
2546
|
else if (a.key === "k") n.togglePaused();
|
|
2291
2547
|
else if (a.key === " ") n.togglePaused();
|
|
2292
2548
|
else if (a.key === "m") n.toggleMuted();
|
|
2293
|
-
else if (a.key === "ArrowUp")
|
|
2549
|
+
else if (a.key === "ArrowUp") E({
|
|
2294
2550
|
direction: "up",
|
|
2295
|
-
stepSize:
|
|
2551
|
+
stepSize: Wt
|
|
2296
2552
|
});
|
|
2297
|
-
else if (a.key === "ArrowDown")
|
|
2553
|
+
else if (a.key === "ArrowDown") E({
|
|
2298
2554
|
direction: "down",
|
|
2299
|
-
stepSize:
|
|
2555
|
+
stepSize: Wt
|
|
2300
2556
|
});
|
|
2301
2557
|
else if (a.key === "ArrowRight") {
|
|
2302
2558
|
if (!n.duration) return;
|
|
2303
|
-
r(Math.min(n.currentTime +
|
|
2304
|
-
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime -
|
|
2559
|
+
r(Math.min(n.currentTime + Gt, n.duration));
|
|
2560
|
+
} else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Gt, 0)) : c = !1;
|
|
2305
2561
|
c && a.preventDefault();
|
|
2306
2562
|
};
|
|
2307
2563
|
return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
|
|
@@ -2309,21 +2565,21 @@ ${gt}
|
|
|
2309
2565
|
};
|
|
2310
2566
|
}, [
|
|
2311
2567
|
n,
|
|
2312
|
-
|
|
2568
|
+
E,
|
|
2313
2569
|
v,
|
|
2314
2570
|
e,
|
|
2315
2571
|
t
|
|
2316
2572
|
]);
|
|
2317
|
-
let A =
|
|
2318
|
-
e.preventDefault(), e.deltaY < 0 ?
|
|
2573
|
+
let A = d((e) => {
|
|
2574
|
+
e.preventDefault(), e.deltaY < 0 ? E({
|
|
2319
2575
|
direction: "up",
|
|
2320
|
-
stepSize:
|
|
2321
|
-
}) :
|
|
2576
|
+
stepSize: Wt
|
|
2577
|
+
}) : E({
|
|
2322
2578
|
direction: "down",
|
|
2323
|
-
stepSize:
|
|
2579
|
+
stepSize: Wt
|
|
2324
2580
|
});
|
|
2325
|
-
}, [
|
|
2326
|
-
|
|
2581
|
+
}, [E]);
|
|
2582
|
+
f(() => {
|
|
2327
2583
|
if (y) return y.addEventListener("wheel", A, { passive: !1 }), () => y.removeEventListener("wheel", A);
|
|
2328
2584
|
}, [y, A]);
|
|
2329
2585
|
let j = (e) => {
|
|
@@ -2336,7 +2592,7 @@ ${gt}
|
|
|
2336
2592
|
height: i
|
|
2337
2593
|
});
|
|
2338
2594
|
}, M = !!g?.armed;
|
|
2339
|
-
return
|
|
2595
|
+
return f(() => {
|
|
2340
2596
|
if (!M) return;
|
|
2341
2597
|
clearInterval(S.current);
|
|
2342
2598
|
let e = Infinity, t = setInterval(() => {
|
|
@@ -2346,50 +2602,50 @@ ${gt}
|
|
|
2346
2602
|
}
|
|
2347
2603
|
let n = x.current, r = document.activeElement;
|
|
2348
2604
|
n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
|
|
2349
|
-
},
|
|
2605
|
+
}, Kt);
|
|
2350
2606
|
return S.current = t, () => {
|
|
2351
|
-
e = Date.now() +
|
|
2607
|
+
e = Date.now() + qt;
|
|
2352
2608
|
};
|
|
2353
|
-
}, [M]),
|
|
2609
|
+
}, [M]), f(() => () => clearInterval(S.current), []), /* @__PURE__ */ O("div", {
|
|
2354
2610
|
className: "control-bar",
|
|
2355
|
-
css:
|
|
2611
|
+
css: Jt,
|
|
2356
2612
|
style: { ...c ? {
|
|
2357
2613
|
opacity: "0",
|
|
2358
2614
|
pointerEvents: "none"
|
|
2359
2615
|
} : M ? { pointerEvents: "none" } : {} },
|
|
2360
|
-
children: [/* @__PURE__ */
|
|
2616
|
+
children: [/* @__PURE__ */ D(yt, {}), /* @__PURE__ */ O("div", {
|
|
2361
2617
|
className: "actions",
|
|
2362
|
-
children: [/* @__PURE__ */
|
|
2618
|
+
children: [/* @__PURE__ */ O("div", {
|
|
2363
2619
|
className: "left",
|
|
2364
2620
|
children: [
|
|
2365
|
-
/* @__PURE__ */
|
|
2621
|
+
/* @__PURE__ */ D($, {
|
|
2366
2622
|
id: "play",
|
|
2367
2623
|
tooltipPlace: "top-start",
|
|
2368
|
-
text: /* @__PURE__ */
|
|
2624
|
+
text: /* @__PURE__ */ D("button", {
|
|
2369
2625
|
className: "play",
|
|
2370
2626
|
type: "button",
|
|
2371
2627
|
onClick: () => n.togglePaused(),
|
|
2372
|
-
"aria-label":
|
|
2373
|
-
children: T
|
|
2628
|
+
"aria-label": T ? "Replay" : r ? "Play" : "Pause",
|
|
2629
|
+
children: D(T ? z : r ? R : L, {})
|
|
2374
2630
|
}),
|
|
2375
|
-
toolTipText: /* @__PURE__ */
|
|
2631
|
+
toolTipText: /* @__PURE__ */ D("span", { children: T ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
|
|
2376
2632
|
}),
|
|
2377
|
-
/* @__PURE__ */
|
|
2378
|
-
/* @__PURE__ */
|
|
2633
|
+
/* @__PURE__ */ D(Ut, { ref: b }),
|
|
2634
|
+
/* @__PURE__ */ D("div", {
|
|
2379
2635
|
className: "time",
|
|
2380
|
-
children:
|
|
2636
|
+
children: Ue(o ?? i, a)
|
|
2381
2637
|
})
|
|
2382
2638
|
]
|
|
2383
|
-
}), /* @__PURE__ */
|
|
2639
|
+
}), /* @__PURE__ */ O("div", {
|
|
2384
2640
|
className: "right",
|
|
2385
2641
|
children: [
|
|
2386
|
-
/* @__PURE__ */
|
|
2387
|
-
/* @__PURE__ */
|
|
2388
|
-
/* @__PURE__ */
|
|
2389
|
-
g ? /* @__PURE__ */
|
|
2642
|
+
/* @__PURE__ */ D(Mt, {}),
|
|
2643
|
+
/* @__PURE__ */ D(Rt, {}),
|
|
2644
|
+
/* @__PURE__ */ D(It, {}),
|
|
2645
|
+
g ? /* @__PURE__ */ D($, {
|
|
2390
2646
|
id: "picture-in-picture",
|
|
2391
2647
|
tooltipPlace: "top-end",
|
|
2392
|
-
text: /* @__PURE__ */
|
|
2648
|
+
text: /* @__PURE__ */ D("button", {
|
|
2393
2649
|
ref: x,
|
|
2394
2650
|
className: g.armed ? "picture-in-picture armed" : "picture-in-picture",
|
|
2395
2651
|
type: "button",
|
|
@@ -2398,47 +2654,47 @@ ${gt}
|
|
|
2398
2654
|
onClick: g.active ? g.exit : void 0,
|
|
2399
2655
|
"aria-label": "Picture in picture",
|
|
2400
2656
|
"aria-pressed": g.active,
|
|
2401
|
-
children: /* @__PURE__ */
|
|
2402
|
-
src:
|
|
2657
|
+
children: /* @__PURE__ */ D("img", {
|
|
2658
|
+
src: bt,
|
|
2403
2659
|
alt: ""
|
|
2404
2660
|
})
|
|
2405
2661
|
}),
|
|
2406
|
-
toolTipText: /* @__PURE__ */
|
|
2407
|
-
}) : l ? /* @__PURE__ */
|
|
2662
|
+
toolTipText: /* @__PURE__ */ D("span", { children: g.active ? "Exit picture in picture" : "Picture in picture" })
|
|
2663
|
+
}) : l ? /* @__PURE__ */ D($, {
|
|
2408
2664
|
id: "picture-in-picture",
|
|
2409
2665
|
tooltipPlace: "top-end",
|
|
2410
|
-
text: /* @__PURE__ */
|
|
2666
|
+
text: /* @__PURE__ */ D("button", {
|
|
2411
2667
|
className: "picture-in-picture",
|
|
2412
2668
|
type: "button",
|
|
2413
2669
|
onClick: l,
|
|
2414
2670
|
disabled: C && !w,
|
|
2415
2671
|
"aria-label": C ? "Put the subtitles in the video" : "Picture in picture",
|
|
2416
|
-
"aria-pressed": C ?
|
|
2417
|
-
children: C ?
|
|
2418
|
-
src:
|
|
2672
|
+
"aria-pressed": C ? p : void 0,
|
|
2673
|
+
children: C ? D(p ? St : Ct, {}) : /* @__PURE__ */ D("img", {
|
|
2674
|
+
src: bt,
|
|
2419
2675
|
alt: ""
|
|
2420
2676
|
})
|
|
2421
2677
|
}),
|
|
2422
|
-
toolTipText: /* @__PURE__ */
|
|
2678
|
+
toolTipText: /* @__PURE__ */ D("span", { children: C ? w ? p ? "Subtitles are in the picture" : "Put the subtitles in the picture" : "This file has no subtitles" : "Picture in picture" })
|
|
2423
2679
|
}) : null,
|
|
2424
|
-
/* @__PURE__ */
|
|
2680
|
+
/* @__PURE__ */ D($, {
|
|
2425
2681
|
id: "full-screen",
|
|
2426
2682
|
tooltipPlace: "top-end",
|
|
2427
|
-
text: /* @__PURE__ */
|
|
2683
|
+
text: /* @__PURE__ */ D("button", {
|
|
2428
2684
|
className: "full-screen",
|
|
2429
2685
|
type: "button",
|
|
2430
2686
|
onClick: () => n.toggleFullscreen(),
|
|
2431
2687
|
"aria-label": "Full screen",
|
|
2432
2688
|
"aria-pressed": s,
|
|
2433
|
-
children:
|
|
2689
|
+
children: D(s ? I : F, {})
|
|
2434
2690
|
}),
|
|
2435
|
-
toolTipText: /* @__PURE__ */
|
|
2691
|
+
toolTipText: /* @__PURE__ */ D("span", { children: s ? "Exit full screen (f)" : "Full screen (f)" })
|
|
2436
2692
|
})
|
|
2437
2693
|
]
|
|
2438
2694
|
})]
|
|
2439
2695
|
})]
|
|
2440
2696
|
});
|
|
2441
|
-
},
|
|
2697
|
+
}, Xt = 9e3, Zt = _`
|
|
2442
2698
|
position: absolute;
|
|
2443
2699
|
inset: 0;
|
|
2444
2700
|
z-index: 2;
|
|
@@ -2481,36 +2737,36 @@ ${gt}
|
|
|
2481
2737
|
line-height: 1;
|
|
2482
2738
|
color: #fff;
|
|
2483
2739
|
}
|
|
2484
|
-
`,
|
|
2485
|
-
let e =
|
|
2486
|
-
return
|
|
2740
|
+
`, Qt = () => {
|
|
2741
|
+
let e = K((e) => e.burnedInSubtitles), t = K((e) => e.pictureInPictureMode), [n, r] = h(!1);
|
|
2742
|
+
return f(() => {
|
|
2487
2743
|
if (t !== "burn-in" || !e) {
|
|
2488
2744
|
r(!1);
|
|
2489
2745
|
return;
|
|
2490
2746
|
}
|
|
2491
2747
|
r(!0);
|
|
2492
|
-
let n = setTimeout(() => r(!1),
|
|
2748
|
+
let n = setTimeout(() => r(!1), Xt);
|
|
2493
2749
|
return () => clearTimeout(n);
|
|
2494
|
-
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */
|
|
2495
|
-
css:
|
|
2750
|
+
}, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
|
|
2751
|
+
css: Zt,
|
|
2496
2752
|
className: n ? "show" : "",
|
|
2497
2753
|
role: "status",
|
|
2498
|
-
children: /* @__PURE__ */
|
|
2754
|
+
children: /* @__PURE__ */ O("div", {
|
|
2499
2755
|
className: "card",
|
|
2500
|
-
children: [/* @__PURE__ */
|
|
2756
|
+
children: [/* @__PURE__ */ D("div", {
|
|
2501
2757
|
className: "text",
|
|
2502
2758
|
children: "Now click your browser's pop out button"
|
|
2503
|
-
}), /* @__PURE__ */
|
|
2759
|
+
}), /* @__PURE__ */ D("div", {
|
|
2504
2760
|
className: "arrow",
|
|
2505
2761
|
"aria-hidden": "true",
|
|
2506
2762
|
children: "→"
|
|
2507
2763
|
})]
|
|
2508
2764
|
})
|
|
2509
2765
|
});
|
|
2510
|
-
},
|
|
2766
|
+
}, $t = 1, en = 6e3, tn = 1, nn = {
|
|
2511
2767
|
opening: "Skip Opening",
|
|
2512
2768
|
ending: "Skip Ending"
|
|
2513
|
-
},
|
|
2769
|
+
}, rn = _`
|
|
2514
2770
|
position: absolute;
|
|
2515
2771
|
inset: 0;
|
|
2516
2772
|
z-index: 2;
|
|
@@ -2561,10 +2817,10 @@ ${gt}
|
|
|
2561
2817
|
bottom: calc(9 * var(--mp-unit));
|
|
2562
2818
|
}
|
|
2563
2819
|
}
|
|
2564
|
-
`,
|
|
2565
|
-
let e =
|
|
2820
|
+
`, an = () => {
|
|
2821
|
+
let e = K((e) => e.chapters), t = K((e) => e.currentTime), n = K((e) => e.requestSeek), r = K((e) => e.seekPreview), i = K(), a = p(() => gt(e), [e]), o = p(() => {
|
|
2566
2822
|
if (typeof t != "number") return;
|
|
2567
|
-
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start -
|
|
2823
|
+
let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - $t <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
|
|
2568
2824
|
return r ? {
|
|
2569
2825
|
kind: r,
|
|
2570
2826
|
end: e[n].end
|
|
@@ -2573,35 +2829,35 @@ ${gt}
|
|
|
2573
2829
|
e,
|
|
2574
2830
|
a,
|
|
2575
2831
|
t
|
|
2576
|
-
]), s =
|
|
2577
|
-
|
|
2832
|
+
]), s = m(0), [c, l] = h(0);
|
|
2833
|
+
f(() => {
|
|
2578
2834
|
let e = typeof t == "number" ? t : 0, n = s.current;
|
|
2579
|
-
s.current = e, e < n -
|
|
2835
|
+
s.current = e, e < n - tn && l((e) => e + 1);
|
|
2580
2836
|
}, [t]);
|
|
2581
|
-
let [u,
|
|
2582
|
-
return
|
|
2837
|
+
let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
|
|
2838
|
+
return f(() => {
|
|
2583
2839
|
if (!g) {
|
|
2584
|
-
|
|
2840
|
+
d(!1);
|
|
2585
2841
|
return;
|
|
2586
2842
|
}
|
|
2587
|
-
|
|
2588
|
-
let e = setTimeout(() =>
|
|
2843
|
+
d(!0);
|
|
2844
|
+
let e = setTimeout(() => d(!1), en);
|
|
2589
2845
|
return () => clearTimeout(e);
|
|
2590
|
-
}, [g, c]),
|
|
2591
|
-
o ||
|
|
2592
|
-
}, [o]), o ? /* @__PURE__ */
|
|
2593
|
-
css:
|
|
2846
|
+
}, [g, c]), f(() => {
|
|
2847
|
+
o || d(!1);
|
|
2848
|
+
}, [o]), o ? /* @__PURE__ */ D("div", {
|
|
2849
|
+
css: rn,
|
|
2594
2850
|
className: u && !r ? "show" : "",
|
|
2595
|
-
children: /* @__PURE__ */
|
|
2851
|
+
children: /* @__PURE__ */ D("button", {
|
|
2596
2852
|
type: "button",
|
|
2597
2853
|
className: "skip-chapter",
|
|
2598
2854
|
onClick: () => {
|
|
2599
|
-
|
|
2855
|
+
d(!1), n ? n(o.end) : i.seek(o.end);
|
|
2600
2856
|
},
|
|
2601
|
-
children:
|
|
2857
|
+
children: nn[o.kind]
|
|
2602
2858
|
})
|
|
2603
2859
|
}) : null;
|
|
2604
|
-
},
|
|
2860
|
+
}, on = 3e3, sn = _`
|
|
2605
2861
|
position: absolute;
|
|
2606
2862
|
inset: 0;
|
|
2607
2863
|
z-index: 2;
|
|
@@ -2612,10 +2868,10 @@ ${gt}
|
|
|
2612
2868
|
hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
|
|
2613
2869
|
not, and transitioning it holds the item on screen for the length of the fade. */
|
|
2614
2870
|
transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
|
|
2615
|
-
`,
|
|
2871
|
+
`, cn = (e, t) => {
|
|
2616
2872
|
let n = e.left - t.left, r = e.top - t.top;
|
|
2617
2873
|
return `path(evenodd, 'M0 0H${t.width}V${t.height}H0Z M${n} ${r}H${n + e.width}V${r + e.height}H${n}Z')`;
|
|
2618
|
-
},
|
|
2874
|
+
}, ln = _`
|
|
2619
2875
|
position: relative;
|
|
2620
2876
|
background-color: black;
|
|
2621
2877
|
display: flex;
|
|
@@ -2672,19 +2928,19 @@ ${gt}
|
|
|
2672
2928
|
&.hide {
|
|
2673
2929
|
cursor: none;
|
|
2674
2930
|
}
|
|
2675
|
-
`,
|
|
2676
|
-
let r = `${t}${
|
|
2677
|
-
return
|
|
2931
|
+
`, un = (e, t = "") => c.toArray(e).flatMap((e, n) => {
|
|
2932
|
+
let r = `${t}${u(e) && e.key != null ? e.key : n}`;
|
|
2933
|
+
return u(e) && e.type === l ? un(e.props.children, `${r}/`) : [{
|
|
2678
2934
|
key: r,
|
|
2679
2935
|
item: e
|
|
2680
2936
|
}];
|
|
2681
|
-
}),
|
|
2682
|
-
let s =
|
|
2937
|
+
}), dn = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
|
|
2938
|
+
let s = K(), c = K((e) => e.hideUI), l = K((e) => e.setHideUI), u = K((e) => e.hasMedia), d = K((e) => e.passThroughPictureInPicture), p = m(void 0), h = m("mouse"), g = m({
|
|
2683
2939
|
x: -1,
|
|
2684
2940
|
y: -1
|
|
2685
|
-
}), _ =
|
|
2686
|
-
|
|
2687
|
-
u || (clearTimeout(
|
|
2941
|
+
}), _ = m(!1), v = m(null);
|
|
2942
|
+
f(() => () => clearTimeout(p.current), []), f(() => {
|
|
2943
|
+
u || (clearTimeout(p.current), l(!1));
|
|
2688
2944
|
}, [u, l]);
|
|
2689
2945
|
let y = () => {
|
|
2690
2946
|
u && l(!0);
|
|
@@ -2699,41 +2955,41 @@ ${gt}
|
|
|
2699
2955
|
return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
|
|
2700
2956
|
}, S = () => {
|
|
2701
2957
|
if (x()) {
|
|
2702
|
-
|
|
2958
|
+
p.current = setTimeout(S, on);
|
|
2703
2959
|
return;
|
|
2704
2960
|
}
|
|
2705
2961
|
y();
|
|
2706
2962
|
}, C = () => {
|
|
2707
|
-
l(!1), clearTimeout(
|
|
2963
|
+
l(!1), clearTimeout(p.current), p.current = setTimeout(S, on);
|
|
2708
2964
|
}, w = (e) => {
|
|
2709
2965
|
h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
|
|
2710
2966
|
x: e.clientX,
|
|
2711
2967
|
y: e.clientY
|
|
2712
2968
|
}, C());
|
|
2713
|
-
},
|
|
2969
|
+
}, T = (e) => {
|
|
2714
2970
|
h.current = e.pointerType, _.current = !0;
|
|
2715
|
-
},
|
|
2971
|
+
}, E = () => {
|
|
2716
2972
|
_.current = !1;
|
|
2717
|
-
}, k =
|
|
2718
|
-
return /* @__PURE__ */
|
|
2719
|
-
css:
|
|
2973
|
+
}, k = m(!0);
|
|
2974
|
+
return /* @__PURE__ */ O("div", {
|
|
2975
|
+
css: ln,
|
|
2720
2976
|
ref: b,
|
|
2721
2977
|
onPointerMove: w,
|
|
2722
|
-
onPointerDown:
|
|
2723
|
-
onPointerUp:
|
|
2724
|
-
onPointerCancel:
|
|
2978
|
+
onPointerDown: T,
|
|
2979
|
+
onPointerUp: E,
|
|
2980
|
+
onPointerCancel: E,
|
|
2725
2981
|
onMouseOut: (e) => {
|
|
2726
2982
|
let t = e.relatedTarget;
|
|
2727
2983
|
if (t && e.currentTarget.contains(t)) return;
|
|
2728
2984
|
let { left: n, right: r, top: i, bottom: a } = e.currentTarget.getBoundingClientRect();
|
|
2729
|
-
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(
|
|
2985
|
+
e.clientX >= n && e.clientX < r && e.clientY >= i && e.clientY < a || (clearTimeout(p.current), y());
|
|
2730
2986
|
},
|
|
2731
2987
|
className: c ? "hide" : "",
|
|
2732
2988
|
tabIndex: a === "player" ? -1 : void 0,
|
|
2733
2989
|
children: [
|
|
2734
|
-
/* @__PURE__ */
|
|
2735
|
-
|
|
2736
|
-
css:
|
|
2990
|
+
/* @__PURE__ */ D(Le, { onSubtitleRef: n }),
|
|
2991
|
+
un(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
|
|
2992
|
+
css: sn,
|
|
2737
2993
|
style: { ...c ? {
|
|
2738
2994
|
opacity: "0",
|
|
2739
2995
|
visibility: "hidden",
|
|
@@ -2741,18 +2997,18 @@ ${gt}
|
|
|
2741
2997
|
} : {} },
|
|
2742
2998
|
children: t
|
|
2743
2999
|
}, e)),
|
|
2744
|
-
i === !1 ? null : /* @__PURE__ */
|
|
3000
|
+
i === !1 ? null : /* @__PURE__ */ D(Yt, {
|
|
2745
3001
|
shortcuts: a,
|
|
2746
3002
|
root: v
|
|
2747
3003
|
}),
|
|
2748
|
-
/* @__PURE__ */
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
|
|
3004
|
+
/* @__PURE__ */ D(Qt, {}),
|
|
3005
|
+
/* @__PURE__ */ D(an, {}),
|
|
3006
|
+
d?.armed && v.current ? /* @__PURE__ */ D("div", {
|
|
2751
3007
|
className: "pass-through",
|
|
2752
|
-
style: { clipPath:
|
|
2753
|
-
onPointerOver:
|
|
3008
|
+
style: { clipPath: cn(d.armed, v.current.getBoundingClientRect()) },
|
|
3009
|
+
onPointerOver: d.disarm
|
|
2754
3010
|
}) : null,
|
|
2755
|
-
/* @__PURE__ */
|
|
3011
|
+
/* @__PURE__ */ O("div", {
|
|
2756
3012
|
className: "video",
|
|
2757
3013
|
onClick: (e) => {
|
|
2758
3014
|
if (h.current === "mouse") {
|
|
@@ -2760,137 +3016,158 @@ ${gt}
|
|
|
2760
3016
|
k.current = s.paused, s.togglePaused();
|
|
2761
3017
|
return;
|
|
2762
3018
|
}
|
|
2763
|
-
c ? C() : (clearTimeout(
|
|
3019
|
+
c ? C() : (clearTimeout(p.current), y());
|
|
2764
3020
|
},
|
|
2765
3021
|
onDoubleClick: () => {
|
|
2766
3022
|
h.current === "mouse" && (k.current ? s.pause() : s.play().catch(() => {}), s.toggleFullscreen());
|
|
2767
3023
|
},
|
|
2768
|
-
children: [t ? /* @__PURE__ */
|
|
3024
|
+
children: [t ? /* @__PURE__ */ D("video", {
|
|
2769
3025
|
ref: t,
|
|
2770
3026
|
playsInline: !0
|
|
2771
3027
|
}) : null, o]
|
|
2772
3028
|
})
|
|
2773
3029
|
]
|
|
2774
3030
|
});
|
|
2775
|
-
},
|
|
2776
|
-
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead:
|
|
2777
|
-
|
|
2778
|
-
let { expose:
|
|
2779
|
-
|
|
2780
|
-
let
|
|
2781
|
-
|
|
2782
|
-
if (!
|
|
3031
|
+
}, fn = ({ options: e, children: t }) => {
|
|
3032
|
+
let n = "media" in e ? e : null, r = n ? null : e, { title: i, chapters: a } = e, { size: o, downloadedRanges: s, publicPath: c, libavWorkerUrl: l, read: u, thumbnailRead: d, thumbnailsEnabled: g, readsDownload: _ } = r ?? {}, v = x(), y = b(), [S, C] = h(null), [w, T] = h(null), E = n?.media ?? S;
|
|
3033
|
+
f(() => (v?.(E), () => v?.(null)), [E, v]);
|
|
3034
|
+
let { expose: O } = e, k = O === !0 ? {} : O || void 0, A = m(k);
|
|
3035
|
+
A.current = k;
|
|
3036
|
+
let j = k ? k.id : void 0, M = k ? k.origin : void 0, N = k ? k.channel : void 0;
|
|
3037
|
+
f(() => {
|
|
3038
|
+
if (!O || !E) return;
|
|
2783
3039
|
let e, t = !1;
|
|
2784
3040
|
return import("./remote/index.js").then(({ exposePlayer: n }) => {
|
|
2785
|
-
t || (e = n(E,
|
|
3041
|
+
t || (e = n(E, A.current ?? {}));
|
|
2786
3042
|
}).catch(() => {}), () => {
|
|
2787
3043
|
t = !0, e?.();
|
|
2788
3044
|
};
|
|
2789
3045
|
}, [
|
|
2790
3046
|
E,
|
|
2791
|
-
!!
|
|
2792
|
-
A,
|
|
3047
|
+
!!O,
|
|
2793
3048
|
j,
|
|
2794
|
-
M
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
3049
|
+
M,
|
|
3050
|
+
N
|
|
3051
|
+
]);
|
|
3052
|
+
let P = p(() => Ae(), [o]);
|
|
3053
|
+
le(S, w, r, _ ? P.push : void 0);
|
|
3054
|
+
let F = r?.normalizeVolume ?? !0, [I, L] = h(F);
|
|
3055
|
+
f(() => {
|
|
3056
|
+
L(F);
|
|
3057
|
+
}, [F]);
|
|
3058
|
+
let R = m(r?.onNormalizeVolumeChange);
|
|
3059
|
+
R.current = r?.onNormalizeVolumeChange;
|
|
3060
|
+
let z = r?.normalizerWorkletUrl, B = m(d ?? u);
|
|
3061
|
+
B.current = d ?? u;
|
|
3062
|
+
let V = K((e) => e.selectedAudioTrack), H = !!u, { refused: ee } = ke(S, z, I, p(() => H && o && c && l && typeof V == "number" && V >= 0 ? _ ? {
|
|
3063
|
+
tap: P,
|
|
3064
|
+
audioStreamIndex: V
|
|
3065
|
+
} : {
|
|
3066
|
+
read: (e, t) => B.current(e, t),
|
|
3067
|
+
length: o,
|
|
3068
|
+
publicPath: c,
|
|
3069
|
+
libavWorkerUrl: l,
|
|
3070
|
+
audioStreamIndex: V
|
|
3071
|
+
} : void 0, [
|
|
3072
|
+
H,
|
|
3073
|
+
o,
|
|
3074
|
+
c,
|
|
3075
|
+
l,
|
|
3076
|
+
V,
|
|
3077
|
+
_,
|
|
3078
|
+
P
|
|
3079
|
+
]), p(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), te = p(() => z && typeof AudioWorkletNode == "function" ? {
|
|
3080
|
+
enabled: I,
|
|
3081
|
+
available: !ee,
|
|
2805
3082
|
setEnabled: (e) => {
|
|
2806
|
-
|
|
3083
|
+
L(e), R.current?.(e);
|
|
2807
3084
|
}
|
|
2808
3085
|
} : null, [
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
]), { thumbnails:
|
|
3086
|
+
z,
|
|
3087
|
+
I,
|
|
3088
|
+
ee
|
|
3089
|
+
]), { thumbnails: ne, requestThumbnail: U } = fe({
|
|
2813
3090
|
publicPath: c,
|
|
2814
3091
|
workerUrl: l,
|
|
2815
3092
|
length: g === !1 ? void 0 : o,
|
|
2816
|
-
read:
|
|
3093
|
+
read: d ?? u,
|
|
2817
3094
|
downloadedRanges: s
|
|
2818
|
-
}),
|
|
2819
|
-
|
|
2820
|
-
|
|
3095
|
+
}), W = n?.thumbnails?.all ?? ne, { toggle: G, mode: re, burnedIn: ie } = pe(S, w), q = ye(n?.media ?? null, n?.pictureInPicture), J = K((e) => e.setSourceState), Y = n ? !!n.media : o !== void 0;
|
|
3096
|
+
f(() => {
|
|
3097
|
+
J({
|
|
2821
3098
|
title: i,
|
|
2822
3099
|
size: o,
|
|
2823
3100
|
downloadedRanges: s,
|
|
2824
|
-
hasMedia:
|
|
3101
|
+
hasMedia: Y
|
|
2825
3102
|
});
|
|
2826
3103
|
}, [
|
|
2827
|
-
|
|
3104
|
+
J,
|
|
2828
3105
|
i,
|
|
2829
3106
|
o,
|
|
2830
3107
|
s,
|
|
2831
|
-
|
|
3108
|
+
Y
|
|
2832
3109
|
]);
|
|
2833
|
-
let
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
thumbnails:
|
|
2837
|
-
thumbnailAt:
|
|
2838
|
-
requestThumbnail:
|
|
2839
|
-
togglePictureInPicture:
|
|
2840
|
-
pictureInPictureMode:
|
|
2841
|
-
burnedInSubtitles:
|
|
3110
|
+
let ae = n?.thumbnails?.at;
|
|
3111
|
+
f(() => {
|
|
3112
|
+
J({
|
|
3113
|
+
thumbnails: W,
|
|
3114
|
+
thumbnailAt: ae,
|
|
3115
|
+
requestThumbnail: U,
|
|
3116
|
+
togglePictureInPicture: G,
|
|
3117
|
+
pictureInPictureMode: re,
|
|
3118
|
+
burnedInSubtitles: ie
|
|
2842
3119
|
});
|
|
2843
3120
|
}, [
|
|
3121
|
+
J,
|
|
3122
|
+
W,
|
|
3123
|
+
ae,
|
|
3124
|
+
U,
|
|
2844
3125
|
G,
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
let J = n?.subtitles?.selection, Y = n?.audioTracks?.selection;
|
|
2857
|
-
d(() => {
|
|
2858
|
-
J && G({
|
|
2859
|
-
subtitleTracks: J.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
3126
|
+
re,
|
|
3127
|
+
ie
|
|
3128
|
+
]), f(() => {
|
|
3129
|
+
J({ volumeNormalizer: te });
|
|
3130
|
+
}, [J, te]), f(() => {
|
|
3131
|
+
J({ passThroughPictureInPicture: q });
|
|
3132
|
+
}, [J, q]);
|
|
3133
|
+
let X = n?.subtitles?.selection, oe = n?.audioTracks?.selection;
|
|
3134
|
+
f(() => {
|
|
3135
|
+
X && J({
|
|
3136
|
+
subtitleTracks: X.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2860
3137
|
id: e,
|
|
2861
3138
|
label: t,
|
|
2862
3139
|
disabled: n
|
|
2863
3140
|
})),
|
|
2864
|
-
selectedSubtitleTrack:
|
|
2865
|
-
selectSubtitleTrack: (e) =>
|
|
2866
|
-
subtitleOffLabel:
|
|
3141
|
+
selectedSubtitleTrack: X.selectedId ?? void 0,
|
|
3142
|
+
selectSubtitleTrack: (e) => X.select(e == null ? null : String(e)),
|
|
3143
|
+
subtitleOffLabel: X.offLabel
|
|
2867
3144
|
});
|
|
2868
|
-
}, [
|
|
2869
|
-
|
|
2870
|
-
audioTracks:
|
|
3145
|
+
}, [J, X]), f(() => {
|
|
3146
|
+
oe && J({
|
|
3147
|
+
audioTracks: oe.options.map(({ id: e, label: t, disabled: n }) => ({
|
|
2871
3148
|
id: e,
|
|
2872
3149
|
label: t,
|
|
2873
3150
|
disabled: n
|
|
2874
3151
|
})),
|
|
2875
|
-
selectedAudioTrack:
|
|
2876
|
-
selectAudioTrack: (e) =>
|
|
3152
|
+
selectedAudioTrack: oe.selectedId ?? void 0,
|
|
3153
|
+
selectAudioTrack: (e) => oe.select(String(e))
|
|
2877
3154
|
});
|
|
2878
|
-
}, [
|
|
2879
|
-
let
|
|
2880
|
-
return
|
|
2881
|
-
|
|
2882
|
-
}, [
|
|
2883
|
-
a &&
|
|
2884
|
-
}, [
|
|
2885
|
-
ref:
|
|
2886
|
-
onVideoRef: n ? void 0 :
|
|
2887
|
-
onSubtitleRef:
|
|
3155
|
+
}, [J, oe]);
|
|
3156
|
+
let se = n?.quality?.selection ?? null;
|
|
3157
|
+
return f(() => {
|
|
3158
|
+
J({ quality: se });
|
|
3159
|
+
}, [J, se]), f(() => {
|
|
3160
|
+
a && J({ chapters: a });
|
|
3161
|
+
}, [J, a]), /* @__PURE__ */ D(dn, {
|
|
3162
|
+
ref: y,
|
|
3163
|
+
onVideoRef: n ? void 0 : C,
|
|
3164
|
+
onSubtitleRef: T,
|
|
2888
3165
|
overlay: e.overlay,
|
|
2889
3166
|
controls: e.controls,
|
|
2890
3167
|
shortcuts: e.shortcuts,
|
|
2891
3168
|
children: t
|
|
2892
3169
|
});
|
|
2893
|
-
},
|
|
3170
|
+
}, pn = _`
|
|
2894
3171
|
/**
|
|
2895
3172
|
* The chrome's whole scale, in one place.
|
|
2896
3173
|
*
|
|
@@ -2960,17 +3237,17 @@ ${gt}
|
|
|
2960
3237
|
height: 100%;
|
|
2961
3238
|
width: 100%;
|
|
2962
3239
|
overflow: hidden;
|
|
2963
|
-
`,
|
|
2964
|
-
css:
|
|
2965
|
-
children: /* @__PURE__ */
|
|
3240
|
+
`, mn = (e) => /* @__PURE__ */ D("div", {
|
|
3241
|
+
css: pn,
|
|
3242
|
+
children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(fn, {
|
|
2966
3243
|
options: e,
|
|
2967
3244
|
children: e.children
|
|
2968
3245
|
}) })
|
|
2969
|
-
}),
|
|
3246
|
+
}), hn = (e) => !!e && typeof e == "object" && "at" in e, gn = (e) => !!e && typeof e == "object" && "selection" in e, _n = ({ blob: e, name: t }) => ({
|
|
2970
3247
|
length: e.size,
|
|
2971
3248
|
name: t ?? (e instanceof File ? e.name : void 0),
|
|
2972
3249
|
read: (t, n) => e.slice(t, t + n).arrayBuffer()
|
|
2973
|
-
}),
|
|
3250
|
+
}), vn = async (e, t) => {
|
|
2974
3251
|
let n = await fetch(e, {
|
|
2975
3252
|
headers: { Range: "bytes=0-1" },
|
|
2976
3253
|
credentials: t
|
|
@@ -2980,8 +3257,8 @@ ${gt}
|
|
|
2980
3257
|
if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
|
|
2981
3258
|
if (!r && n.status !== 206) throw Error("The source does not support range requests");
|
|
2982
3259
|
return i;
|
|
2983
|
-
},
|
|
2984
|
-
let i = t ?? await
|
|
3260
|
+
}, yn = async ({ url: e, length: t, name: n, credentials: r }) => {
|
|
3261
|
+
let i = t ?? await vn(e, r);
|
|
2985
3262
|
return {
|
|
2986
3263
|
length: i,
|
|
2987
3264
|
name: n,
|
|
@@ -2994,11 +3271,12 @@ ${gt}
|
|
|
2994
3271
|
});
|
|
2995
3272
|
if (!o.ok) throw Error(`The source could not be read: HTTP ${o.status}`);
|
|
2996
3273
|
return o.arrayBuffer();
|
|
2997
|
-
}
|
|
3274
|
+
},
|
|
3275
|
+
readsDownload: !0
|
|
2998
3276
|
};
|
|
2999
|
-
},
|
|
3000
|
-
if ("blob" in e) return
|
|
3001
|
-
if ("url" in e) return
|
|
3277
|
+
}, bn = async (e) => {
|
|
3278
|
+
if ("blob" in e) return _n(e);
|
|
3279
|
+
if ("url" in e) return yn(e);
|
|
3002
3280
|
if ("read" in e) return {
|
|
3003
3281
|
length: e.length,
|
|
3004
3282
|
name: e.name,
|
|
@@ -3007,4 +3285,4 @@ ${gt}
|
|
|
3007
3285
|
throw Error(`Unknown source type: ${e}`);
|
|
3008
3286
|
};
|
|
3009
3287
|
//#endregion
|
|
3010
|
-
export {
|
|
3288
|
+
export { mn as MediaPlayer, mn as default, G as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, bn as inputToRemuxerInput, gn as isDelegatedTracks, hn as isExternalThumbnails, W as sourceFeature, a as startPlayback, pe as usePictureInPicture, K as usePlayer, fe as useSeekThumbnails };
|