@banou/media-player 0.10.21 → 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/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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-C4Gj_4zs.js";
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
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
3
  import { css as _, keyframes as v } from "@emotion/react";
4
4
  import { createPlayer as y, useContainerAttach as b, useMediaAttach as x } from "@videojs/react";
@@ -7,9 +7,9 @@ import { makeRemuxer as w } from "libav-wasm";
7
7
  import { createMediaElementSource as T } from "@banou/ponyfill/web-audio";
8
8
  import { Fragment as E, jsx as D, jsxs as O } from "@emotion/react/jsx-runtime";
9
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 U } from "react-tooltip";
10
+ import { Tooltip as ne } from "react-tooltip";
11
11
  //#region src/lib/react/source-feature.ts
12
- var W = {
12
+ var U = {
13
13
  indexes: [],
14
14
  chapters: [],
15
15
  thumbnails: [],
@@ -34,19 +34,19 @@ var W = {
34
34
  playbackErrors: [],
35
35
  ready: !1,
36
36
  setSourceState: () => {}
37
- }, G = S({
37
+ }, W = S({
38
38
  name: "source",
39
- state: () => ({ ...W }),
39
+ state: () => ({ ...U }),
40
40
  attach({ set: e }) {
41
41
  e({
42
42
  setSourceState: (t) => e(t),
43
43
  setHideUI: (t) => e({ hideUI: t })
44
44
  });
45
45
  }
46
- }), K = y({
47
- features: [...C, G],
46
+ }), G = y({
47
+ features: [...C, W],
48
48
  displayName: "MediaPlayer"
49
- }), q = K.usePlayer, ne = (e) => {
49
+ }), K = G.usePlayer, re = (e) => {
50
50
  if (e && e !== "und") try {
51
51
  return new Intl.DisplayNames([navigator.language || "en"], {
52
52
  type: "language",
@@ -55,28 +55,28 @@ var W = {
55
55
  } catch {
56
56
  return;
57
57
  }
58
- }, J = (e) => e?.replace(/_/g, " ").trim() || void 0, Y = (e) => {
59
- let t = e.map((e) => ne(e.language) ?? J(e.title) ?? `Track ${e.streamIndex}`), n = t.reduce((e, t) => ({
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) => ({
60
60
  ...e,
61
61
  [t]: (e[t] ?? 0) + 1
62
62
  }), {});
63
63
  return e.map((e, r) => {
64
- let i = t[r], a = J(e.title);
64
+ let i = t[r], a = ie(e.title);
65
65
  return {
66
66
  track: e,
67
67
  label: (n[i] ?? 0) > 1 && a && a !== i ? `${i} (${a})` : i
68
68
  };
69
69
  });
70
- }, re = (e) => Y(e).map(({ track: e, label: t }) => ({
70
+ }, J = (e) => q(e).map(({ track: e, label: t }) => ({
71
71
  id: e.streamIndex,
72
72
  label: t
73
- })), X = [
73
+ })), Y = [
74
74
  0,
75
75
  250,
76
76
  1e3,
77
77
  3e3,
78
78
  1e4
79
- ], ie = 6e4, ae = 500, oe = 15e3, se = (e) => e instanceof Error ? e.message : String(e), ce = (e) => {
79
+ ], ae = 6e4, X = 500, oe = 15e3, se = (e) => e instanceof Error ? e.message : String(e), ce = (e) => {
80
80
  let t = [], n = e?.cause;
81
81
  for (let e = 0; n != null && e < 8; e++) {
82
82
  if (typeof MediaError < "u" && n instanceof MediaError) {
@@ -86,82 +86,84 @@ var W = {
86
86
  t.push(se(n)), n = n?.cause;
87
87
  }
88
88
  return t.length ? t.join("\n") : void 0;
89
- }, le = (e, t, n) => {
90
- let i = q(), { read: o, size: s, publicPath: c = "", libavWorkerUrl: l = "", jassubWorkerUrl: u = "", jassubWasmUrl: p = "", jassubLegacyWasmUrl: g, defaultFontUrl: _, bufferSize: v, autoplay: y = !1, chapters: b, seekPrepareBudgetMs: x = ae } = n ?? {}, S = m(b);
91
- S.current = b;
92
- let [C, w] = h(void 0), [T, E] = h(0), D = m({
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({
93
93
  count: 0,
94
94
  at: 0
95
- }), O = m(void 0);
96
- f(() => (D.current = {
95
+ }), k = m(void 0);
96
+ f(() => (O.current = {
97
97
  count: 0,
98
98
  at: 0
99
- }, i.setSourceState({ playbackErrors: [] }), () => {
100
- O.current && clearTimeout(O.current);
101
- }), [s]);
102
- let k = m(null), A = m(null), j = m(!1), M = m(o);
103
- M.current = o;
104
- let N = m(n?.onSeek);
105
- N.current = n?.onSeek;
106
- let P = m(n?.onPlaybackError);
107
- P.current = n?.onPlaybackError;
108
- let F = d((e) => {
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) => {
109
111
  let t = typeof e == "number" ? e : void 0;
110
- j.current = !0, i.setSourceState({ selectedSubtitleTrack: t }), k.current?.selectSubtitleStream(t);
111
- }, [i]), I = d((e) => {
112
- let t = k.current;
113
- if (!t || x <= 0) {
114
- i.seek(e);
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);
115
117
  return;
116
118
  }
117
- let n = typeof window < "u" && window.__mediaPlayerSeekDebug, r = performance.now(), a = !1, o = "prepared", s = () => {
118
- if (!a && (a = !0, i.seek(e), n)) {
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)) {
119
121
  let n = t.videoElement, i = 0;
120
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);
121
- console.warn(`[media-player] seek to ${e.toFixed(2)} moved after ${Math.round(performance.now() - r)}ms via ${o}, runway ${i.toFixed(1)}s${o === "deadline" ? " (EXPOSED: moved before its data was ready)" : ""}`);
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)" : ""}`);
122
124
  }
123
125
  };
124
- i.setSourceState({ seekingTo: e });
126
+ o.setSourceState({ seekingTo: e });
125
127
  let c = t.videoElement, l = () => {
126
- c?.removeEventListener("seeked", l), clearTimeout(u), i.setSourceState({ seekingTo: void 0 });
128
+ c?.removeEventListener("seeked", l), clearTimeout(u), o.setSourceState({ seekingTo: void 0 });
127
129
  }, u = setTimeout(l, oe);
128
130
  c?.addEventListener("seeked", l);
129
131
  let d = setTimeout(() => {
130
- o = "deadline", s();
131
- }, x);
132
+ a = "deadline", s();
133
+ }, S);
132
134
  t.prepareSeek(e).catch(() => {}).finally(() => {
133
135
  clearTimeout(d), s();
134
136
  });
135
- }, [i, x]), L = d((e) => {
136
- typeof e == "number" && (i.setSourceState({ selectedAudioTrack: e }), w(e));
137
- }, [i]), R = q((e) => e.setSourceState);
137
+ }, [o, S]), z = d((e) => {
138
+ typeof e == "number" && (o.setSourceState({ selectedAudioTrack: e }), T(e));
139
+ }, [o]), B = K((e) => e.setSourceState);
138
140
  f(() => {
139
- R({
140
- selectSubtitleTrack: F,
141
- selectAudioTrack: L,
142
- requestSeek: I
141
+ B({
142
+ selectSubtitleTrack: L,
143
+ selectAudioTrack: z,
144
+ requestSeek: R
143
145
  });
144
146
  }, [
145
- R,
146
- F,
147
+ B,
147
148
  L,
148
- I
149
+ z,
150
+ R
149
151
  ]), f(() => {
150
- if (!e || !t || !s || !o) return;
152
+ if (!e || !t || !c || !s) return;
151
153
  let n = !1;
152
- i.setSourceState({
154
+ o.setSourceState({
153
155
  playbackError: null,
154
156
  ready: !1
155
157
  });
156
- let d = (t, n) => {
157
- let r = Date.now(), a = se(t), o = ce(t), s = i.playbackErrors, c = s[s.length - 1];
158
- if (c && c.message === a && c.detail === o && c.recovered === n) {
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) {
159
161
  let e = {
160
162
  ...c,
161
163
  count: c.count + 1,
162
164
  lastAt: r
163
165
  };
164
- i.setSourceState({ playbackErrors: [...s.slice(0, -1), e] });
166
+ o.setSourceState({ playbackErrors: [...s.slice(0, -1), e] });
165
167
  return;
166
168
  }
167
169
  let l = {
@@ -169,64 +171,65 @@ var W = {
169
171
  lastAt: r,
170
172
  count: 1,
171
173
  atMediaTime: Number.isFinite(e.currentTime) ? e.currentTime : void 0,
172
- message: a,
173
- detail: o,
174
+ message: i,
175
+ detail: a,
174
176
  recovered: n
175
177
  };
176
- i.setSourceState({ playbackErrors: [...s, l] });
177
- }, f = (e) => {
178
+ o.setSourceState({ playbackErrors: [...s, l] });
179
+ }, d = (e) => {
178
180
  if (n) return;
179
181
  let t = r(e);
180
- if (d(e, t), t) {
182
+ if (i(e, t), t) {
181
183
  let t = performance.now();
182
- t - D.current.at > ie && (D.current = {
184
+ t - O.current.at > ae && (O.current = {
183
185
  count: 0,
184
186
  at: t
185
187
  });
186
- let n = X[Math.min(D.current.count, X.length - 1)];
187
- D.current = {
188
- count: D.current.count + 1,
188
+ let n = Y[Math.min(O.current.count, Y.length - 1)];
189
+ O.current = {
190
+ count: O.current.count + 1,
189
191
  at: t
190
- }, console.warn(`the media element failed; rebuilding the pipeline${n ? ` in ${n}ms` : ""}`, e), O.current && clearTimeout(O.current), O.current = setTimeout(() => E((e) => e + 1), n);
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);
191
193
  return;
192
194
  }
193
- console.error("playback failed", e), i.setSourceState({ playbackError: e }), P.current?.(e);
195
+ console.error("playback failed", e), o.setSourceState({ playbackError: e }), F.current?.(e);
194
196
  };
195
197
  return (async () => {
196
198
  try {
197
199
  let r = await a({
198
200
  videoElement: e,
199
201
  subtitleContainer: t,
200
- read: (e, t) => M.current(e, t),
201
- length: s,
202
- publicPath: c,
203
- libavWorkerUrl: l,
204
- jassubWorkerUrl: u,
205
- jassubWasmUrl: p,
206
- jassubLegacyWasmUrl: g,
207
- defaultFontUrl: _,
208
- bufferSize: v,
209
- audioStreamIndex: C,
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,
210
212
  onReady: () => {
211
213
  if (n) return;
212
- i.setSourceState({ ready: !0 });
213
- let t = A.current;
214
- A.current = null, t && t.size === s && t.time > 0 && (e.currentTime = t.time), y && e.play().catch(() => {});
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(() => {});
215
217
  },
216
- onError: f,
218
+ onError: d,
217
219
  onRecovered: () => {
218
- n || i.setSourceState({ playbackError: null });
220
+ n || o.setSourceState({ playbackError: null });
219
221
  },
220
- onSeek: (e) => N.current?.(e),
222
+ onSeek: (e) => P.current?.(e),
223
+ onOutput: (e) => I.current?.(e),
221
224
  onSubtitleStreams: (e) => {
222
- n || i.setSourceState({
223
- subtitleTracks: re(e),
224
- ...j.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
225
+ n || o.setSourceState({
226
+ subtitleTracks: J(e),
227
+ ...M.current ? {} : { selectedSubtitleTrack: e[0]?.streamIndex }
225
228
  });
226
229
  },
227
230
  onAudioStreams: (e, t) => {
228
- n || i.setSourceState({
229
- audioTracks: re(e),
231
+ n || o.setSourceState({
232
+ audioTracks: J(e),
230
233
  selectedAudioTrack: t
231
234
  });
232
235
  }
@@ -235,26 +238,25 @@ var W = {
235
238
  r.destroy();
236
239
  return;
237
240
  }
238
- k.current = r, i.setSourceState({
241
+ A.current = r, o.setSourceState({
239
242
  indexes: r.indexes,
240
- chapters: S.current ?? r.chapters
243
+ chapters: C.current ?? r.chapters
241
244
  });
242
- let o = i.selectedSubtitleTrack;
243
- typeof o == "number" && r.selectSubtitleStream(o);
245
+ let i = o.selectedSubtitleTrack;
246
+ typeof i == "number" && r.selectSubtitleStream(i);
244
247
  } catch (e) {
245
- f(e);
248
+ d(e);
246
249
  }
247
250
  })(), () => {
248
- n = !0, A.current = {
251
+ n = !0, j.current = {
249
252
  time: e.currentTime,
250
- size: s
251
- }, k.current?.destroy(), k.current = null, i.setSourceState({ ready: !1 });
253
+ size: c
254
+ }, A.current?.destroy(), A.current = null, o.setSourceState({ ready: !1 });
252
255
  };
253
256
  }, [
254
- i,
257
+ o,
255
258
  e,
256
259
  t,
257
- s,
258
260
  c,
259
261
  l,
260
262
  u,
@@ -262,9 +264,10 @@ var W = {
262
264
  g,
263
265
  _,
264
266
  v,
265
- C,
266
267
  y,
267
- T
268
+ w,
269
+ b,
270
+ E
268
271
  ]);
269
272
  }, ue = 5e3, de = 6e4, fe = ({ publicPath: e, workerUrl: t, length: n, read: r, downloadedRanges: a }) => {
270
273
  let [o, s] = h([]), c = m(null), l = m(r);
@@ -459,49 +462,50 @@ var W = {
459
462
  let a = !1, o, s = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Set(), l = () => {
460
463
  for (let e of [...c]) e();
461
464
  c.clear();
462
- }, u = () => new Promise((e) => c.add(e)), d = (e, t) => !o || o.some(([n, r]) => n <= e && Math.min(e + t, i.length) <= r), f = async (e, t) => {
463
- for (; !d(e, t);) if (a || await new Promise((e) => s.add(e))) throw Error("Cancelled");
464
- return i.read(e, t);
465
- }, p = (e) => {
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) => {
466
470
  for (let t of [...s]) t(e);
467
471
  s.clear();
468
- }, m;
472
+ }, p;
469
473
  try {
470
- m = new Worker(r, { type: "module" });
474
+ p = new Worker(r, { type: "module" });
471
475
  } catch (e) {
472
476
  return console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), {
473
477
  update: () => {},
474
478
  stop: () => {}
475
479
  };
476
480
  }
477
- let h = new MessageChannel();
478
- m.postMessage({
481
+ let m = new MessageChannel();
482
+ p.postMessage({
479
483
  type: "port",
480
- port: h.port1
481
- }, [h.port1]), t.port.postMessage({ analysis: h.port2 }, [h.port2]);
482
- let g = {
484
+ port: m.port1
485
+ }, [m.port1]), t.port.postMessage({ analysis: m.port2 }, [m.port2]);
486
+ let h = {
483
487
  spans: [],
484
488
  end: null
485
- }, _ = 0, v = /* @__PURE__ */ new Map(), y = (e, t) => new Promise((n) => v.set(`${e}:${t}`, n)), b = -1;
486
- m.onmessage = ({ data: e }) => {
489
+ }, g = 0, _ = /* @__PURE__ */ new Map(), v = (e, t) => new Promise((n) => _.set(`${e}:${t}`, n)), y = -1;
490
+ p.onmessage = ({ data: e }) => {
487
491
  if (e.type === "unsupported") {
488
492
  U();
489
493
  return;
490
494
  }
491
- e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(g.spans) || e.end !== g.end) && _++, g = {
495
+ e.spans && ((JSON.stringify(e.spans) !== JSON.stringify(h.spans) || e.end !== h.end) && g++, h = {
492
496
  spans: e.spans,
493
497
  end: e.end
494
- }), e.type === "merged" && (b = e.run), v.get(`${e.type}:${e.run}`)?.(g), v.delete(`${e.type}:${e.run}`), l();
498
+ }), e.type === "merged" && (y = e.run), _.get(`${e.type}:${e.run}`)?.(h), _.delete(`${e.type}:${e.run}`), l();
495
499
  };
496
- let x = t.context, S = () => t.port.postMessage({
500
+ let b = t.context, x = () => t.port.postMessage({
497
501
  media: n.currentTime,
498
- ctx: x.currentTime,
502
+ ctx: b.currentTime,
499
503
  rate: n.playbackRate,
500
504
  paused: n.paused || n.seeking || n.readyState < 3
501
- }), C = () => m.postMessage({
505
+ }), S = () => p.postMessage({
502
506
  type: "playhead",
503
507
  time: n.currentTime
504
- }), T = setInterval(S, De), E = [
508
+ }), C = setInterval(x, De), T = [
505
509
  "play",
506
510
  "playing",
507
511
  "pause",
@@ -511,64 +515,64 @@ var W = {
511
515
  "waiting",
512
516
  "ended"
513
517
  ];
514
- for (let e of E) n.addEventListener(e, S);
515
- let D = Infinity, O = !1, k = 0, A = !1, j = 0, M = 0, N = /* @__PURE__ */ new Map(), P = (e) => {
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) => {
516
520
  let t = e;
517
- for (let [e, n] of g.spans) e <= t && t < n && (t = n);
518
- return t >= (g.end ?? D) - .05 ? null : t;
519
- }, F = (e) => N.get(Math.round(e * 10)) === _ ? "idle" : e, I = () => {
520
- let e = n.currentTime, t = P(e), r = A && b !== k;
521
- if (t !== null && t < e + we) return r && j <= t + 1 && t <= M + Te ? "read" : F(t);
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);
522
526
  if (r) return "read";
523
- let i = t ?? P(0);
524
- return i === null ? "done" : F(i);
525
- }, L = () => {}, R = (e) => (e.catch(() => {}), Promise.race([e, new Promise((e) => {
526
- L = () => e(void 0);
527
- })])), z = () => {
528
- C(), O && s.size && typeof I() == "number" && L(), l();
529
- }, B = () => {
530
- C(), l();
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();
531
535
  };
532
- n.addEventListener("seeking", z), n.addEventListener("seeked", B), n.addEventListener("timeupdate", B);
533
- let V, H = async (e) => {
534
- if (!A) return;
535
- A = !1;
536
- let t = y("ended", k);
537
- m.postMessage({
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({
538
542
  type: "end",
539
- run: k,
543
+ run: O,
540
544
  finished: e
541
545
  }), await t;
542
- }, ee = async (e) => {
543
- if (M = e.pts + e.duration, !e.data.byteLength) return;
544
- let t = y("ack", k);
545
- m.postMessage({
546
+ }, H = async (e) => {
547
+ if (j = e.pts + e.duration, !e.data.byteLength) return;
548
+ let t = v("ack", O);
549
+ p.postMessage({
546
550
  type: "fragment",
547
- run: k,
551
+ run: O,
548
552
  data: e.data
549
553
  }, [e.data]), await t;
550
- }, te = async () => {
551
- if (V = await w({
552
- publicPath: i.publicPath,
553
- workerUrl: i.libavWorkerUrl,
554
+ }, ee = async (t) => {
555
+ if (B = await w({
556
+ publicPath: t.publicPath,
557
+ workerUrl: t.libavWorkerUrl,
554
558
  workerOptions: { type: "module" },
555
- length: i.length,
556
- read: f,
557
- audioStreamIndex: i.audioStreamIndex
558
- }), a) return e(V);
559
- let t = await V.init();
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();
560
564
  if (!a) {
561
- for (D = t.info.input.duration || Infinity, m.postMessage({
565
+ for (E = n.info.input.duration || Infinity, p.postMessage({
562
566
  type: "init",
563
- data: t.data,
564
- codec: t.info.output.audioMimeType
565
- }, [t.data]), A = !0, O = !0, m.postMessage({
567
+ data: n.data,
568
+ codec: n.info.output.audioMimeType
569
+ }, [n.data]), k = !0, D = !0, p.postMessage({
566
570
  type: "run",
567
- run: k,
571
+ run: O,
568
572
  pts: 0,
569
573
  start: !0
570
574
  }); !a;) {
571
- let e = I();
575
+ let e = F();
572
576
  if (e === "done") break;
573
577
  if (e === "idle") {
574
578
  await u();
@@ -576,45 +580,79 @@ var W = {
576
580
  }
577
581
  try {
578
582
  if (e === "read") {
579
- let e = await R(V.read());
583
+ let e = await L(B.read());
580
584
  if (a) return;
581
585
  if (!e) continue;
582
- await ee(e), e.finished && await H(!0);
586
+ await H(e), e.finished && await V(!0);
583
587
  } else {
584
- await H(!1), N.set(Math.round(e * 10), _);
585
- let t = V.seek(Math.max(0, e - Ee));
586
- p(!0);
587
- let n = await R(t);
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);
588
592
  if (a) return;
589
593
  if (!n) continue;
590
- k++, A = !0, j = n.pts, m.postMessage({
594
+ O++, k = !0, A = n.pts, p.postMessage({
591
595
  type: "run",
592
- run: k,
596
+ run: O,
593
597
  pts: n.pts,
594
598
  start: n.pts <= 0
595
- }), await ee(n), n.finished && await H(!0);
599
+ }), await H(n), n.finished && await V(!0);
596
600
  }
597
601
  } catch {
598
602
  if (a) return;
599
- await H(!1), typeof I() != "number" && await u();
603
+ await V(!1), typeof F() != "number" && await u();
600
604
  }
601
605
  }
602
- e(V), V = void 0;
606
+ e(B), B = void 0;
603
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
+ });
604
642
  }, U = () => {
605
643
  if (!a) {
606
- a = !0, p(!0), l(), clearInterval(T);
607
- for (let e of E) n.removeEventListener(e, S);
608
- n.removeEventListener("seeking", z), n.removeEventListener("seeked", B), n.removeEventListener("timeupdate", B), V && e(V), m.terminate(), t.port.postMessage({ analysis: null });
609
- for (let e of v.values()) e(g);
610
- v.clear();
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();
611
649
  }
612
650
  };
613
- return te().catch((e) => {
651
+ return "tap" in i ? ne(i.tap, i.audioStreamIndex) : ee(i).catch((e) => {
614
652
  a || (console.warn("[media-player] the volume normalizer cannot analyse ahead:", e), U());
615
- }), C(), {
653
+ }), S(), {
616
654
  update: (e) => {
617
- o = e, p(!1);
655
+ o = e, f(!1);
618
656
  },
619
657
  stop: U
620
658
  };
@@ -643,7 +681,7 @@ var W = {
643
681
  u.current = i;
644
682
  let d = m(null), p = m(r);
645
683
  p.current = r;
646
- let { length: g, publicPath: _, libavWorkerUrl: v, audioStreamIndex: y } = 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;
647
685
  return f(() => {
648
686
  let r = p.current;
649
687
  if (!c || !e || !t || !n || !r) return;
@@ -664,10 +702,33 @@ var W = {
664
702
  g,
665
703
  _,
666
704
  v,
705
+ b,
667
706
  y
668
707
  ]), f(() => {
669
708
  d.current?.update(i);
670
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
+ };
671
732
  }, Z = {
672
733
  headings: {
673
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 ",
@@ -695,7 +756,7 @@ var W = {
695
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 ",
696
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 "
697
758
  }
698
- }, Ae = _`
759
+ }, je = _`
699
760
  display: flex;
700
761
  justify-content: center;
701
762
  align-items: center;
@@ -708,7 +769,7 @@ var W = {
708
769
  margin: auto;
709
770
  pointer-events: none;
710
771
  }
711
- `, je = _`
772
+ `, Me = _`
712
773
  position: absolute;
713
774
  top: 0;
714
775
  left: 0;
@@ -737,9 +798,9 @@ var W = {
737
798
 
738
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%);
739
800
  transition: opacity 0.1s cubic-bezier(.4,0,1,1);
740
- `, Me = v`
801
+ `, Ne = v`
741
802
  to { transform: rotate(360deg); }
742
- `, Ne = _`
803
+ `, Pe = _`
743
804
  position: absolute;
744
805
  inset: 0;
745
806
  z-index: 2;
@@ -755,9 +816,9 @@ var W = {
755
816
  border-radius: 50%;
756
817
  border: 3px solid rgba(255, 255, 255, 0.25);
757
818
  border-top-color: #fff;
758
- animation: ${Me} 0.8s linear infinite;
819
+ animation: ${Ne} 0.8s linear infinite;
759
820
  }
760
- `, Pe = _`
821
+ `, Fe = _`
761
822
  position: absolute;
762
823
  inset: auto 0 20%;
763
824
  z-index: 3;
@@ -767,34 +828,34 @@ var W = {
767
828
  ${Z.bLarge.regular}
768
829
  text-shadow: 0 0 4px rgba(0, 0, 0, 1);
769
830
  pointer-events: none;
770
- `, Fe = (e) => e instanceof Error ? e.message : typeof e == "string" ? e : "Playback failed", Ie = ({ onSubtitleRef: e }) => {
771
- let t = q((e) => e.title), n = q((e) => e.hideUI), r = q((e) => e.playbackError), i = q((e) => e.ready), a = q((e) => e.size), o = q((e) => e.waiting), s = q((e) => e.seekingTo);
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);
772
833
  return /* @__PURE__ */ O(E, { children: [
773
834
  t ? /* @__PURE__ */ D("div", {
774
835
  className: "title",
775
- css: je,
836
+ css: Me,
776
837
  style: { ...n ? {
777
838
  opacity: "0",
778
839
  pointerEvents: "none"
779
840
  } : {} },
780
841
  children: t
781
842
  }) : void 0,
782
- ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Ne }) : void 0,
843
+ ((a ? !i : o) || s !== void 0) && !r ? /* @__PURE__ */ D("div", { css: Pe }) : void 0,
783
844
  r ? /* @__PURE__ */ D("div", {
784
- css: Pe,
785
- children: Fe(r)
845
+ css: Fe,
846
+ children: Ie(r)
786
847
  }) : void 0,
787
848
  /* @__PURE__ */ D("div", {
788
849
  className: "subtitles",
789
850
  ref: e,
790
- css: Ae
851
+ css: je
791
852
  })
792
853
  ] });
793
- }, Le = 1e-4, Re = 1, ze = (e) => Math.max(Le, Math.min(Re, e)) ** 2, Be = (e) => Math.max(Le, Math.min(Re, e)) ** (Re / 2), Ve = (e) => {
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) => {
794
855
  if (e === void 0) return "0:00";
795
856
  let t = Math.floor(e / 3600), n = Math.floor(e % 3600 / 60), r = Math.floor(e % 60);
796
857
  return t > 0 ? `${t}:${n < 10 ? "0" : ""}${n}:${r < 10 ? "0" : ""}${r}` : `${n}:${r < 10 ? "0" : ""}${r}`;
797
- }, He = (e, t) => `${Ve(e)} / ${Ve(t)}`, Ue = (e) => _`
858
+ }, Ue = (e, t) => `${He(e)} / ${He(t)}`, We = (e) => _`
798
859
  display: flex;
799
860
  justify-content: flex-start;
800
861
 
@@ -842,17 +903,17 @@ var W = {
842
903
  x: -1,
843
904
  y: -1,
844
905
  anchors: 0
845
- }, We = (e) => {
906
+ }, Ge = (e) => {
846
907
  Q.x = e.clientX, Q.y = e.clientY;
847
- }, Ge = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", We, {
908
+ }, Ke = () => (Q.anchors++ === 0 && window.addEventListener("pointermove", Ge, {
848
909
  capture: !0,
849
910
  passive: !0
850
911
  }), () => {
851
- --Q.anchors === 0 && window.removeEventListener("pointermove", We, { capture: !0 });
912
+ --Q.anchors === 0 && window.removeEventListener("pointermove", Ge, { capture: !0 });
852
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" }) => {
853
914
  let l = m(null), u = m(null);
854
915
  return f(() => {
855
- let e = Ge(), t = () => {
916
+ let e = Ke(), t = () => {
856
917
  let e = l.current;
857
918
  if (!e) return;
858
919
  let { left: t, right: n, top: r, bottom: i } = e.getBoundingClientRect();
@@ -872,14 +933,14 @@ var W = {
872
933
  "data-tooltip-delay-hide": i,
873
934
  "data-tooltip-place": o,
874
935
  children: n
875
- }), !s && /* @__PURE__ */ D(U, {
936
+ }), !s && /* @__PURE__ */ D(ne, {
876
937
  ref: u,
877
- css: Ue(c),
938
+ css: We(c),
878
939
  id: e,
879
940
  noArrow: !0,
880
941
  children: t
881
942
  })] });
882
- }, Ke = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
943
+ }, qe = ({ ref: e, onChange: t, orientation: n = "horizontal", disabled: r = !1 }) => {
883
944
  let [i, a] = h(!1), o = m(t);
884
945
  o.current = t;
885
946
  let s = m(null), c = d((t, r) => {
@@ -918,26 +979,26 @@ var W = {
918
979
  style: { touchAction: "none" }
919
980
  }
920
981
  };
921
- }, qe = 2, Je = .005, Ye = "#000", Xe = "#0000", Ze = (e, t) => {
982
+ }, Je = 2, Ye = .005, Xe = "#000", Ze = "#0000", Qe = (e, t) => {
922
983
  if (!t) return [];
923
984
  let n = /* @__PURE__ */ new Set();
924
985
  for (let { start: r, end: i } of e) for (let e of [r, i]) {
925
986
  let r = e / t;
926
- r <= Je || r >= .995 || n.add(Number((r * 100).toFixed(4)));
987
+ r <= Ye || r >= .995 || n.add(Number((r * 100).toFixed(4)));
927
988
  }
928
989
  return n.size ? [
929
990
  0,
930
991
  ...[...n].sort((e, t) => e - t),
931
992
  100
932
993
  ] : [];
933
- }, Qe = (e, t) => {
934
- let n = qe / 2, r = e.length - 2, i = [];
994
+ }, $e = (e, t) => {
995
+ let n = Je / 2, r = e.length - 2, i = [];
935
996
  for (let a = 0; a <= r; a += 1) {
936
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)`;
937
- i.push(`${t(a) ? Ye : Xe} ${c} ${l}`), a !== r && i.push(`${Xe} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
998
+ i.push(`${t(a) ? Xe : Ze} ${c} ${l}`), a !== r && i.push(`${Ze} calc(${s}% - ${n}px) calc(${s}% + ${n}px)`);
938
999
  }
939
1000
  return `linear-gradient(90deg, ${i.join(", ")})`;
940
- }, $e = /* @__PURE__ */ new Set([
1001
+ }, et = /* @__PURE__ */ new Set([
941
1002
  "op",
942
1003
  "ops",
943
1004
  "opening",
@@ -945,7 +1006,7 @@ var W = {
945
1006
  "ncop",
946
1007
  "オープニング",
947
1008
  "op主題歌"
948
- ]), et = /* @__PURE__ */ new Set([
1009
+ ]), tt = /* @__PURE__ */ new Set([
949
1010
  "ed",
950
1011
  "eds",
951
1012
  "ending",
@@ -958,13 +1019,13 @@ var W = {
958
1019
  "エンドカード",
959
1020
  "エンドロール",
960
1021
  "ed主題歌"
961
- ]), tt = /* @__PURE__ */ new Set(["intro", "イントロ"]), nt = /* @__PURE__ */ new Set(["outro", "アウトロ"]), rt = {
1022
+ ]), nt = /* @__PURE__ */ new Set(["intro", "イントロ"]), rt = /* @__PURE__ */ new Set(["outro", "アウトロ"]), it = {
962
1023
  "credits start": "ending",
963
1024
  "credits end": null,
964
1025
  "preview end": null,
965
1026
  "end credits": "ending",
966
1027
  "closing credits": "ending"
967
- }, it = /* @__PURE__ */ new Set([
1028
+ }, at = /* @__PURE__ */ new Set([
968
1029
  "theme",
969
1030
  "themes",
970
1031
  "song",
@@ -983,53 +1044,53 @@ var W = {
983
1044
  "the",
984
1045
  "主題歌",
985
1046
  "ノンクレジット"
986
- ]), at = /* @__PURE__ */ new Set([
1047
+ ]), ot = /* @__PURE__ */ new Set([
987
1048
  "post",
988
1049
  "pre",
989
1050
  "after",
990
1051
  "before",
991
1052
  "non"
992
- ]), ot = /[-:|~/\\[\]()「」『』【】,.!?"'’]|\s+by\s+/u, st = (e) => !e.trim() || /^chapter\s*\d+$/i.test(e.trim()) || /^\d{1,2}:\d{2}:\d{2}([.,]\d+)?$/.test(e.trim()), ct = (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) && !it.has(e)), lt = (e, t) => {
993
- if ($e.has(e)) return "opening";
994
- if (et.has(e)) return "ending";
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";
995
1056
  if (t) {
996
- if (tt.has(e)) return "opening";
997
- if (nt.has(e)) return "ending";
1057
+ if (nt.has(e)) return "opening";
1058
+ if (rt.has(e)) return "ending";
998
1059
  }
999
- }, ut = (e, t) => {
1000
- if (st(e)) return;
1060
+ }, dt = (e, t) => {
1061
+ if (ct(e)) return;
1001
1062
  let n = e.trim().toLowerCase().replace(/\s+/gu, " ");
1002
- if (n in rt) return rt[n] ?? void 0;
1003
- let r = n.split(ot).map((e) => e.trim()).filter(Boolean);
1004
- if (r.some((e) => e.split(/[\s_]+/u).some((e) => at.has(e)))) return;
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;
1005
1066
  let i = r.length > 1 ? [r[0], r.at(-1)] : r;
1006
1067
  for (let e of i) {
1007
- let n = ct(e);
1068
+ let n = lt(e);
1008
1069
  if (n.length !== 1) continue;
1009
- let r = lt(n[0], t);
1070
+ let r = ut(n[0], t);
1010
1071
  if (r) return r;
1011
1072
  }
1012
- }, dt = 15, ft = 87, pt = 93, mt = (e) => {
1073
+ }, ft = 15, pt = 87, mt = 93, ht = (e) => {
1013
1074
  let t = e.map(() => void 0), n = e.at(-1)?.end ?? 0;
1014
1075
  if (!n) return t;
1015
1076
  let r = e.map((e, t) => ({
1016
1077
  index: t,
1017
1078
  start: e.start,
1018
1079
  length: e.end - e.start
1019
- })).filter(({ length: e }) => e >= ft && e <= pt), i = n / 2, a = r.filter(({ start: e }) => e < i), o = r.filter(({ start: e }) => e >= i);
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);
1020
1081
  return a.length === 1 && (t[a[0].index] = "opening"), o.length === 1 && (t[o[0].index] = "ending"), t;
1021
- }, ht = (e) => {
1022
- let t = e.map(({ title: e }) => ut(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);
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);
1023
1084
  if (r > 0 && n * 2 > r) return e.map(() => void 0);
1024
1085
  let i = e.map((e, n) => {
1025
- if (e.end - e.start < dt) return;
1086
+ if (e.end - e.start < ft) return;
1026
1087
  let r = t[n];
1027
1088
  if (r) return r;
1028
- let i = ut(e.title, !0);
1089
+ let i = dt(e.title, !0);
1029
1090
  return i && !t.includes(i) ? i : void 0;
1030
1091
  });
1031
- return e.every(({ title: e }) => st(e)) ? mt(e) : i;
1032
- }, gt = _`
1092
+ return e.every(({ title: e }) => ct(e)) ? ht(e) : i;
1093
+ }, _t = _`
1033
1094
  position: relative;
1034
1095
  height: calc(.4 * var(--mp-unit));
1035
1096
 
@@ -1248,8 +1309,8 @@ var W = {
1248
1309
  --thumbnail-width: calc(18 * var(--mp-unit));
1249
1310
  --thumbnail-half: calc(9 * var(--mp-unit));
1250
1311
  }
1251
- `, _t = 4, vt = () => {
1252
- let e = q(), t = q((e) => e.currentTime), n = q((e) => e.requestSeek), r = q((e) => e.duration), i = q((e) => e.size), a = q((e) => e.downloadedRanges), o = q((e) => e.buffered), s = q((e) => e.indexes), c = q((e) => e.thumbnails), l = q((e) => e.thumbnailAt), u = q((e) => e.requestThumbnail), d = q((e) => e.chapters), g = q((e) => e.seekingTo), _ = q((e) => e.setSourceState), v = q((e) => e.hideUI), y = m(null), [b, x] = h(void 0), [S, C] = h(void 0), w = (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) => {
1253
1314
  C(e), u(e);
1254
1315
  }, T = !!S;
1255
1316
  f(() => {
@@ -1257,13 +1318,13 @@ var W = {
1257
1318
  }, [_, T]), f(() => {
1258
1319
  v && w(void 0);
1259
1320
  }, [v]);
1260
- let E = m(void 0), k = m(0), A = m(void 0), j = m(void 0), M = m(!1), { dragging: N, handlers: P } = Ke({
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({
1261
1322
  ref: y,
1262
1323
  onChange: (e) => {
1263
1324
  if (k.current += 1, A.current = e, j.current === void 0) j.current = e;
1264
1325
  else if (!M.current) {
1265
1326
  let t = y.current?.getBoundingClientRect().width ?? 0;
1266
- Math.abs(e - j.current) * t > _t && (M.current = !0);
1327
+ Math.abs(e - j.current) * t > vt && (M.current = !0);
1267
1328
  }
1268
1329
  x(e), E.current !== "mouse" && w(e * r);
1269
1330
  }
@@ -1315,7 +1376,7 @@ var W = {
1315
1376
  b,
1316
1377
  r
1317
1378
  ]);
1318
- let U = p(() => {
1379
+ let ne = p(() => {
1319
1380
  if (!r) return 0;
1320
1381
  if (N && b !== void 0) return b;
1321
1382
  let e = g ?? t;
@@ -1326,22 +1387,22 @@ var W = {
1326
1387
  N,
1327
1388
  b,
1328
1389
  g
1329
- ]), W = p(() => Ze(d, r), [d, r]), G = W.length > 0, K = p(() => {
1330
- if (!G || S === void 0 || !r) return -1;
1331
- let e = S / r * 100, t = W.findIndex((t, n) => n < W.length - 1 && e >= t && e < W[n + 1]);
1332
- return t >= 0 ? t : W.length - 2;
1390
+ ]), U = p(() => Qe(d, r), [d, r]), W = U.length > 0, G = p(() => {
1391
+ if (!W || S === void 0 || !r) return -1;
1392
+ let e = S / r * 100, t = U.findIndex((t, n) => n < U.length - 1 && e >= t && e < U[n + 1]);
1393
+ return t >= 0 ? t : U.length - 2;
1333
1394
  }, [
1334
- G,
1335
1395
  W,
1396
+ U,
1336
1397
  S,
1337
1398
  r
1338
- ]), ne = p(() => G ? Qe(W, (e) => e !== K) : void 0, [
1339
- G,
1399
+ ]), re = p(() => W ? $e(U, (e) => e !== G) : void 0, [
1340
1400
  W,
1341
- K
1342
- ]), J = p(() => K >= 0 ? Qe(W, (e) => e === K) : void 0, [W, K]), Y = p(() => {
1401
+ U,
1402
+ G
1403
+ ]), ie = p(() => G >= 0 ? $e(U, (e) => e === G) : void 0, [U, G]), q = p(() => {
1343
1404
  if (S !== void 0) return d.find(({ start: e, end: t }) => e <= S && S < t);
1344
- }, [d, S]), re = p(() => {
1405
+ }, [d, S]), J = p(() => {
1345
1406
  if (S) {
1346
1407
  if (l) return l(S);
1347
1408
  if (c.length) return c.find(({ startTime: e, endTime: t }) => e <= S && S < t);
@@ -1350,7 +1411,7 @@ var W = {
1350
1411
  c,
1351
1412
  l,
1352
1413
  S
1353
- ]), X = (e, t) => /* @__PURE__ */ O("div", {
1414
+ ]), Y = (e, t) => /* @__PURE__ */ O("div", {
1354
1415
  className: e ? `track ${e}` : "track",
1355
1416
  style: t ? { maskImage: t } : void 0,
1356
1417
  children: [
@@ -1363,42 +1424,42 @@ var W = {
1363
1424
  className: "play-container",
1364
1425
  children: /* @__PURE__ */ D("div", {
1365
1426
  className: "play",
1366
- style: { transform: `scaleX(${U})` }
1427
+ style: { transform: `scaleX(${ne})` }
1367
1428
  })
1368
1429
  })
1369
1430
  ]
1370
1431
  });
1371
1432
  return /* @__PURE__ */ O("div", {
1372
- css: gt,
1433
+ css: _t,
1373
1434
  ref: y,
1374
1435
  className: [
1375
1436
  "progress-bar",
1376
1437
  N ? "dragging" : "",
1377
- G ? "segmented" : ""
1438
+ W ? "segmented" : ""
1378
1439
  ].filter(Boolean).join(" "),
1379
1440
  onPointerDown: z,
1380
1441
  onPointerMove: z,
1381
1442
  onMouseMove: B,
1382
1443
  onMouseOut: V,
1383
1444
  children: [
1384
- X(void 0, ne),
1445
+ Y(void 0, re),
1385
1446
  S ? /* @__PURE__ */ O("div", {
1386
1447
  className: "cursor-time",
1387
1448
  style: {
1388
- left: Y ? `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))))`,
1389
- maxWidth: Y ? "var(--thumbnail-width)" : void 0
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
1390
1451
  },
1391
1452
  children: [/* @__PURE__ */ D("span", {
1392
1453
  className: "cursor-time-value",
1393
- children: Ve(S)
1394
- }), Y ? /* @__PURE__ */ D("span", {
1454
+ children: He(S)
1455
+ }), q ? /* @__PURE__ */ D("span", {
1395
1456
  className: "chapter-title",
1396
- children: Y.title
1457
+ children: q.title
1397
1458
  }) : void 0]
1398
1459
  }) : void 0,
1399
1460
  /* @__PURE__ */ D("div", { className: "progress" }),
1400
1461
  /* @__PURE__ */ D("div", { className: "hover" }),
1401
- J ? X("focus", J) : void 0,
1462
+ ie ? Y("focus", ie) : void 0,
1402
1463
  /* @__PURE__ */ D("div", { className: "scrubber" }),
1403
1464
  /* @__PURE__ */ D("div", {
1404
1465
  className: "padding",
@@ -1410,11 +1471,11 @@ var W = {
1410
1471
  /* @__PURE__ */ D("div", {
1411
1472
  className: "thumbnail",
1412
1473
  style: { left: `clamp(var(--thumbnail-half), ${H(S ?? 1)}%, calc(100% - var(--thumbnail-half)))` },
1413
- children: re?.url ? /* @__PURE__ */ D("img", { src: re.url }) : void 0
1474
+ children: J?.url ? /* @__PURE__ */ D("img", { src: J.url }) : void 0
1414
1475
  })
1415
1476
  ]
1416
1477
  });
1417
- }, yt = "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", bt = {
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 = {
1418
1479
  xmlns: "http://www.w3.org/2000/svg",
1419
1480
  width: 24,
1420
1481
  height: 24,
@@ -1424,8 +1485,8 @@ var W = {
1424
1485
  strokeWidth: 2,
1425
1486
  strokeLinecap: "round",
1426
1487
  strokeLinejoin: "round"
1427
- }, xt = (e) => /* @__PURE__ */ O("svg", {
1428
- ...bt,
1488
+ }, St = (e) => /* @__PURE__ */ O("svg", {
1489
+ ...xt,
1429
1490
  ...e,
1430
1491
  children: [
1431
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" }),
@@ -1439,8 +1500,8 @@ var W = {
1439
1500
  }),
1440
1501
  /* @__PURE__ */ D("path", { d: "M14.5 18.5h2m2 0h1" })
1441
1502
  ]
1442
- }), St = (e) => /* @__PURE__ */ O("svg", {
1443
- ...bt,
1503
+ }), Ct = (e) => /* @__PURE__ */ O("svg", {
1504
+ ...xt,
1444
1505
  ...e,
1445
1506
  children: [
1446
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" }),
@@ -1454,7 +1515,7 @@ var W = {
1454
1515
  }),
1455
1516
  /* @__PURE__ */ D("path", { d: "M6 9h3m2 0h2" })
1456
1517
  ]
1457
- }), Ct = _`
1518
+ }), wt = _`
1458
1519
  .popover {
1459
1520
  position: absolute;
1460
1521
  /* Anchored to the PLAYER's right edge, never to the gear. The gear is not the last control in the
@@ -1581,7 +1642,7 @@ var W = {
1581
1642
  ${Z.bSmall.regular}
1582
1643
  }
1583
1644
  }
1584
- `, wt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1645
+ `, Tt = ({ title: e, tracks: t, selected: n, onSelect: r, onBack: i, offLabel: a, pending: o, failed: s }) => {
1585
1646
  let c = o !== void 0, l = (e, i, a) => {
1586
1647
  let s = c && o === e, l = c || t.find((t) => t.id === e)?.disabled;
1587
1648
  return /* @__PURE__ */ O("div", {
@@ -1608,7 +1669,7 @@ var W = {
1608
1669
  t.map(({ id: e, label: t }) => l(e, t, "description"))
1609
1670
  ]
1610
1671
  });
1611
- }, Tt = ({ onReset: e } = {}) => {
1672
+ }, Et = ({ onReset: e } = {}) => {
1612
1673
  let t = m(null), [n, r] = h(!1), [i, a] = h(void 0), [o, s] = h(!1), c = m(e);
1613
1674
  c.current = e;
1614
1675
  let l = () => {
@@ -1649,7 +1710,7 @@ var W = {
1649
1710
  });
1650
1711
  }
1651
1712
  };
1652
- }, Et = _`
1713
+ }, Dt = _`
1653
1714
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
1654
1715
  which is the width of the player box, so it can be clamped to it. */
1655
1716
  position: static;
@@ -1665,7 +1726,7 @@ position: static;
1665
1726
  }
1666
1727
  }
1667
1728
 
1668
- ${Ct}
1729
+ ${wt}
1669
1730
 
1670
1731
  .popover.error-list {
1671
1732
  /* Wider than a track menu and taller, because these rows are sentences rather than labels, and a
@@ -1737,23 +1798,23 @@ ${Ct}
1737
1798
  }
1738
1799
  }
1739
1800
  }
1740
- `, Dt = (e) => new Date(e).toLocaleTimeString(), Ot = (e) => e === void 0 || !Number.isFinite(e) ? void 0 : Ve(Math.max(0, e)), kt = (e) => e.reduce((e, t) => e + t.count, 0), At = (e) => e.map((e, t) => {
1741
- let n = Ot(e.atMediaTime), r = e.count > 1 ? `${new Date(e.at).toISOString()} to ${new Date(e.lastAt).toISOString()} ×${e.count}` : new Date(e.at).toISOString();
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();
1742
1803
  return [
1743
1804
  `${t + 1}. ${r}${n ? ` (at ${n})` : ""}${e.recovered ? " [recovered]" : ""}`,
1744
1805
  e.message,
1745
1806
  e.detail
1746
1807
  ].filter(Boolean).join("\n");
1747
- }).join("\n\n"), jt = () => {
1748
- let e = q((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Tt(), [i, a] = h(!1);
1808
+ }).join("\n\n"), Mt = () => {
1809
+ let e = K((e) => e.playbackErrors), { open: t, toggle: n, containerRef: r } = Et(), [i, a] = h(!1);
1749
1810
  if (e.length === 0) return null;
1750
1811
  let o = () => {
1751
- navigator.clipboard?.writeText(At(e)).then(() => {
1812
+ navigator.clipboard?.writeText(jt(e)).then(() => {
1752
1813
  a(!0), setTimeout(() => a(!1), 2e3);
1753
1814
  }, (e) => console.warn("[media-player] could not copy the errors:", e));
1754
- }, s = `Playback errors (${kt(e)})`;
1815
+ }, s = `Playback errors (${At(e)})`;
1755
1816
  return /* @__PURE__ */ O("div", {
1756
- css: Et,
1817
+ css: Dt,
1757
1818
  ref: r,
1758
1819
  children: [/* @__PURE__ */ D($, {
1759
1820
  id: "errors",
@@ -1784,9 +1845,9 @@ ${Ct}
1784
1845
  /* @__PURE__ */ O("span", {
1785
1846
  className: "when",
1786
1847
  children: [
1787
- Dt(e.at),
1788
- e.count > 1 ? ` to ${Dt(e.lastAt)}` : "",
1789
- Ot(e.atMediaTime) ? ` at ${Ot(e.atMediaTime)}` : "",
1848
+ Ot(e.at),
1849
+ e.count > 1 ? ` to ${Ot(e.lastAt)}` : "",
1850
+ kt(e.atMediaTime) ? ` at ${kt(e.atMediaTime)}` : "",
1790
1851
  e.recovered ? " recovered" : "",
1791
1852
  e.count > 1 ? /* @__PURE__ */ D("span", {
1792
1853
  className: "count",
@@ -1806,7 +1867,7 @@ ${Ct}
1806
1867
  }, `${e.at}-${t}`))]
1807
1868
  })]
1808
1869
  });
1809
- }, Mt = _`
1870
+ }, Nt = _`
1810
1871
  display: flex;
1811
1872
  align-items: center;
1812
1873
  justify-content: center;
@@ -1859,8 +1920,8 @@ width: 100%;
1859
1920
  }
1860
1921
  }
1861
1922
  }
1862
- `, Nt = () => {
1863
- let e = q(), t = q((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 } = Ke({
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({
1864
1925
  ref: r,
1865
1926
  onChange: (t) => e.setPlaybackRate(l(t))
1866
1927
  }), d = (t) => {
@@ -1876,7 +1937,7 @@ width: 100%;
1876
1937
  }, [t]);
1877
1938
  let p = c(s);
1878
1939
  return /* @__PURE__ */ O("div", {
1879
- css: Mt,
1940
+ css: Nt,
1880
1941
  children: [/* @__PURE__ */ O("div", { children: [s.toFixed(2), "x"] }), /* @__PURE__ */ D("div", {
1881
1942
  className: "playback-slider",
1882
1943
  ref: n,
@@ -1894,7 +1955,7 @@ width: 100%;
1894
1955
  })
1895
1956
  })]
1896
1957
  });
1897
- }, Pt = _`
1958
+ }, Ft = _`
1898
1959
  /* Deliberately NOT a containing block. The menu anchors to the control bar instead, which is exactly
1899
1960
  as wide as the player box and can therefore be clamped to it. The outside-click check uses
1900
1961
  \`contains\` on the ref, which is DOM containment and needs no position, and the bar's other
@@ -1912,7 +1973,7 @@ position: static;
1912
1973
  }
1913
1974
  }
1914
1975
 
1915
- ${Ct}
1976
+ ${wt}
1916
1977
 
1917
1978
  .switch {
1918
1979
  position: relative;
@@ -1988,8 +2049,8 @@ ${Ct}
1988
2049
  }
1989
2050
  }
1990
2051
 
1991
- `, Ft = () => {
1992
- let e = q(), t = q((e) => e.playbackRate), n = q((e) => e.audioTracks), r = q((e) => e.selectedAudioTrack), i = q((e) => e.selectAudioTrack), a = q((e) => e.quality), o = q((e) => e.volumeNormalizer), [s, c] = h(0), { open: l, toggle: u, containerRef: d, pending: f, failed: p, runSelect: m } = Tt({ onReset: () => c(0) }), g = (t) => {
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) => {
1993
2054
  e.setPlaybackRate(t), c(0);
1994
2055
  }, _ = (e) => {
1995
2056
  e !== void 0 && m(e, () => i(e));
@@ -1999,7 +2060,7 @@ ${Ct}
1999
2060
  c(e);
2000
2061
  };
2001
2062
  return /* @__PURE__ */ O("div", {
2002
- css: Pt,
2063
+ css: Ft,
2003
2064
  ref: d,
2004
2065
  children: [
2005
2066
  /* @__PURE__ */ D($, {
@@ -2061,7 +2122,7 @@ ${Ct}
2061
2122
  }),
2062
2123
  /* @__PURE__ */ D("div", {
2063
2124
  className: "slider no-hover",
2064
- children: /* @__PURE__ */ D(Nt, {})
2125
+ children: /* @__PURE__ */ D(Pt, {})
2065
2126
  }),
2066
2127
  /* @__PURE__ */ O("div", {
2067
2128
  className: "options no-hover",
@@ -2086,7 +2147,7 @@ ${Ct}
2086
2147
  })
2087
2148
  ]
2088
2149
  }),
2089
- l && s === 2 && /* @__PURE__ */ D(wt, {
2150
+ l && s === 2 && /* @__PURE__ */ D(Tt, {
2090
2151
  title: "Audio",
2091
2152
  tracks: n,
2092
2153
  selected: r,
@@ -2095,7 +2156,7 @@ ${Ct}
2095
2156
  pending: f,
2096
2157
  failed: p
2097
2158
  }),
2098
- l && s === 3 && a && /* @__PURE__ */ D(wt, {
2159
+ l && s === 3 && a && /* @__PURE__ */ D(Tt, {
2099
2160
  title: "Quality",
2100
2161
  tracks: a.options,
2101
2162
  selected: a.selectedId ?? void 0,
@@ -2107,7 +2168,7 @@ ${Ct}
2107
2168
  })
2108
2169
  ]
2109
2170
  });
2110
- }, It = _`
2171
+ }, Lt = _`
2111
2172
  /* Not a containing block, for the reason given on popoverStyle: the menu anchors to the control bar,
2112
2173
  which is the width of the player box, so it can be clamped to it. */
2113
2174
  position: static;
@@ -2123,13 +2184,13 @@ position: static;
2123
2184
  }
2124
2185
  }
2125
2186
 
2126
- ${Ct}
2127
- `, Lt = () => {
2128
- let e = q((e) => e.subtitleTracks), t = q((e) => e.selectedSubtitleTrack), n = q((e) => e.selectSubtitleTrack), r = q((e) => e.subtitleOffLabel), { open: i, toggle: a, containerRef: o, pending: s, failed: c, runSelect: l } = Tt();
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();
2129
2190
  if (e.length === 0) return null;
2130
2191
  let u = t !== void 0;
2131
2192
  return /* @__PURE__ */ O("div", {
2132
- css: It,
2193
+ css: Lt,
2133
2194
  ref: o,
2134
2195
  children: [/* @__PURE__ */ D($, {
2135
2196
  id: "subtitles",
@@ -2144,7 +2205,7 @@ ${Ct}
2144
2205
  children: u ? /* @__PURE__ */ D(k, { className: "captions" }) : /* @__PURE__ */ D(A, { className: "captions-off" })
2145
2206
  }),
2146
2207
  toolTipText: /* @__PURE__ */ D("span", { children: "Subtitles" })
2147
- }), i && /* @__PURE__ */ D(wt, {
2208
+ }), i && /* @__PURE__ */ D(Tt, {
2148
2209
  title: "Subtitles",
2149
2210
  tracks: e,
2150
2211
  selected: t,
@@ -2154,13 +2215,13 @@ ${Ct}
2154
2215
  failed: c
2155
2216
  })]
2156
2217
  });
2157
- }, Rt = {
2218
+ }, zt = {
2158
2219
  primary: "#EAEBEE",
2159
2220
  secondary: "#D0D0D9",
2160
2221
  hover: "rgba(255, 255, 255, 0.13)",
2161
2222
  borderPrimary: "#384F70",
2162
2223
  backgroundTooltip: "#222222"
2163
- }, zt = _`
2224
+ }, Bt = _`
2164
2225
  display: flex;
2165
2226
  align-items: center;
2166
2227
 
@@ -2203,8 +2264,8 @@ ${Ct}
2203
2264
  width: 10px;
2204
2265
  height: 10px;
2205
2266
  }
2206
- `, Bt = ({ value: e, onChange: t }) => {
2207
- let n = q((e) => e.volume), r = q((e) => e.muted), i = m(null), a = m(null), { handlers: o } = Ke({
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({
2208
2269
  ref: a,
2209
2270
  onChange: t
2210
2271
  }), s = (n) => {
@@ -2218,12 +2279,12 @@ ${Ct}
2218
2279
  e && e.removeEventListener("wheel", s);
2219
2280
  };
2220
2281
  }, [e]);
2221
- let c = e * 100, l = p(() => Math.round(r ? 0 : Be(n) * 100), [n, r]);
2282
+ let c = e * 100, l = p(() => Math.round(r ? 0 : Ve(n) * 100), [n, r]);
2222
2283
  return /* @__PURE__ */ D($, {
2223
2284
  id: "volume-slider",
2224
2285
  text: /* @__PURE__ */ D("div", {
2225
2286
  ref: i,
2226
- css: zt,
2287
+ css: Bt,
2227
2288
  ...o,
2228
2289
  children: /* @__PURE__ */ D("div", {
2229
2290
  ref: a,
@@ -2242,7 +2303,7 @@ ${Ct}
2242
2303
  children: [l, "%"]
2243
2304
  })
2244
2305
  });
2245
- }, Vt = _`
2306
+ }, Ht = _`
2246
2307
  position: relative;
2247
2308
  display: flex;
2248
2309
  align-items: center;
@@ -2305,10 +2366,10 @@ ${Ct}
2305
2366
  }
2306
2367
  }
2307
2368
 
2308
- `, Ht = ({ ref: e }) => {
2309
- let t = q(), n = q((e) => e.volume), r = q((e) => e.muted), i = p(() => Be(n), [n]);
2369
+ `, Ut = ({ ref: e }) => {
2370
+ let t = K(), n = K((e) => e.volume), r = K((e) => e.muted), i = p(() => Ve(n), [n]);
2310
2371
  return /* @__PURE__ */ O("div", {
2311
- css: Vt,
2372
+ css: Ht,
2312
2373
  children: [/* @__PURE__ */ D($, {
2313
2374
  id: "sound",
2314
2375
  text: /* @__PURE__ */ D("button", {
@@ -2328,16 +2389,16 @@ ${Ct}
2328
2389
  className: "volume-slider-container",
2329
2390
  children: /* @__PURE__ */ D("div", {
2330
2391
  className: "volume-slider-background",
2331
- children: /* @__PURE__ */ D(Bt, {
2392
+ children: /* @__PURE__ */ D(Vt, {
2332
2393
  value: r ? 0 : i,
2333
2394
  onChange: (e) => {
2334
- t.setVolume(ze(e));
2395
+ t.setVolume(Be(e));
2335
2396
  }
2336
2397
  })
2337
2398
  })
2338
2399
  })]
2339
2400
  });
2340
- }, Ut = .05, Wt = 5, Gt = 50, Kt = 1e3, qt = _`
2401
+ }, Wt = .05, Gt = 5, Kt = 50, qt = 1e3, Jt = _`
2341
2402
  position: absolute;
2342
2403
  bottom: 0;
2343
2404
  width: 100%;
@@ -2429,7 +2490,7 @@ ${Ct}
2429
2490
  /* .armed is the hover of a control letting its click through, which takes no pointer events
2430
2491
  of its own and so is never :hover */
2431
2492
  :hover, &.armed {
2432
- background-color: ${Rt.hover};
2493
+ background-color: ${zt.hover};
2433
2494
  }
2434
2495
 
2435
2496
  /* the hit area grows, the icon does not, keyed on the pointer because a narrow desktop
@@ -2467,10 +2528,10 @@ ${Ct}
2467
2528
  }
2468
2529
  }
2469
2530
  }
2470
- `, Jt = ({ shortcuts: e = "window", root: t }) => {
2471
- let n = q(), r = q((e) => e.paused), i = q((e) => e.currentTime), a = q((e) => e.duration), o = q((e) => e.seekingTo), s = q((e) => e.fullscreen), c = q((e) => e.hideUI), l = q((e) => e.togglePictureInPicture), u = q((e) => e.pictureInPictureMode), p = q((e) => e.burnedInSubtitles), g = q((e) => e.passThroughPictureInPicture), _ = q((e) => e.subtitleTracks), v = q((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 }) => {
2472
- let r = Be(n.volume), i = e === "up" ? t : -t, a = Math.max(0, Math.min(1, r + i)), o = n.muted;
2473
- n.setVolume(ze(a)), o && !n.muted && n.toggleMuted();
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();
2474
2535
  }, [n]), k = m(!1);
2475
2536
  f(() => {
2476
2537
  let r = (e) => v ? v(e) : n.seek(e), i = (e) => e.composedPath()[0], a = (e) => {
@@ -2487,16 +2548,16 @@ ${Ct}
2487
2548
  else if (a.key === "m") n.toggleMuted();
2488
2549
  else if (a.key === "ArrowUp") E({
2489
2550
  direction: "up",
2490
- stepSize: Ut
2551
+ stepSize: Wt
2491
2552
  });
2492
2553
  else if (a.key === "ArrowDown") E({
2493
2554
  direction: "down",
2494
- stepSize: Ut
2555
+ stepSize: Wt
2495
2556
  });
2496
2557
  else if (a.key === "ArrowRight") {
2497
2558
  if (!n.duration) return;
2498
- r(Math.min(n.currentTime + Wt, n.duration));
2499
- } else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Wt, 0)) : c = !1;
2559
+ r(Math.min(n.currentTime + Gt, n.duration));
2560
+ } else a.key === "ArrowLeft" ? r(Math.max(n.currentTime - Gt, 0)) : c = !1;
2500
2561
  c && a.preventDefault();
2501
2562
  };
2502
2563
  return window.addEventListener("keydown", o), window.addEventListener("pointerdown", a, !0), window.addEventListener("focusin", a, !0), () => {
@@ -2512,10 +2573,10 @@ ${Ct}
2512
2573
  let A = d((e) => {
2513
2574
  e.preventDefault(), e.deltaY < 0 ? E({
2514
2575
  direction: "up",
2515
- stepSize: Ut
2576
+ stepSize: Wt
2516
2577
  }) : E({
2517
2578
  direction: "down",
2518
- stepSize: Ut
2579
+ stepSize: Wt
2519
2580
  });
2520
2581
  }, [E]);
2521
2582
  f(() => {
@@ -2541,18 +2602,18 @@ ${Ct}
2541
2602
  }
2542
2603
  let n = x.current, r = document.activeElement;
2543
2604
  n && r?.tagName === "IFRAME" && r.closest(".video")?.parentElement?.contains(n) && n.focus({ preventScroll: !0 });
2544
- }, Gt);
2605
+ }, Kt);
2545
2606
  return S.current = t, () => {
2546
- e = Date.now() + Kt;
2607
+ e = Date.now() + qt;
2547
2608
  };
2548
2609
  }, [M]), f(() => () => clearInterval(S.current), []), /* @__PURE__ */ O("div", {
2549
2610
  className: "control-bar",
2550
- css: qt,
2611
+ css: Jt,
2551
2612
  style: { ...c ? {
2552
2613
  opacity: "0",
2553
2614
  pointerEvents: "none"
2554
2615
  } : M ? { pointerEvents: "none" } : {} },
2555
- children: [/* @__PURE__ */ D(vt, {}), /* @__PURE__ */ O("div", {
2616
+ children: [/* @__PURE__ */ D(yt, {}), /* @__PURE__ */ O("div", {
2556
2617
  className: "actions",
2557
2618
  children: [/* @__PURE__ */ O("div", {
2558
2619
  className: "left",
@@ -2569,18 +2630,18 @@ ${Ct}
2569
2630
  }),
2570
2631
  toolTipText: /* @__PURE__ */ D("span", { children: T ? "Replay (k)" : r ? "Play (k)" : "Pause (k)" })
2571
2632
  }),
2572
- /* @__PURE__ */ D(Ht, { ref: b }),
2633
+ /* @__PURE__ */ D(Ut, { ref: b }),
2573
2634
  /* @__PURE__ */ D("div", {
2574
2635
  className: "time",
2575
- children: He(o ?? i, a)
2636
+ children: Ue(o ?? i, a)
2576
2637
  })
2577
2638
  ]
2578
2639
  }), /* @__PURE__ */ O("div", {
2579
2640
  className: "right",
2580
2641
  children: [
2581
- /* @__PURE__ */ D(jt, {}),
2582
- /* @__PURE__ */ D(Lt, {}),
2583
- /* @__PURE__ */ D(Ft, {}),
2642
+ /* @__PURE__ */ D(Mt, {}),
2643
+ /* @__PURE__ */ D(Rt, {}),
2644
+ /* @__PURE__ */ D(It, {}),
2584
2645
  g ? /* @__PURE__ */ D($, {
2585
2646
  id: "picture-in-picture",
2586
2647
  tooltipPlace: "top-end",
@@ -2594,7 +2655,7 @@ ${Ct}
2594
2655
  "aria-label": "Picture in picture",
2595
2656
  "aria-pressed": g.active,
2596
2657
  children: /* @__PURE__ */ D("img", {
2597
- src: yt,
2658
+ src: bt,
2598
2659
  alt: ""
2599
2660
  })
2600
2661
  }),
@@ -2609,8 +2670,8 @@ ${Ct}
2609
2670
  disabled: C && !w,
2610
2671
  "aria-label": C ? "Put the subtitles in the video" : "Picture in picture",
2611
2672
  "aria-pressed": C ? p : void 0,
2612
- children: C ? D(p ? xt : St, {}) : /* @__PURE__ */ D("img", {
2613
- src: yt,
2673
+ children: C ? D(p ? St : Ct, {}) : /* @__PURE__ */ D("img", {
2674
+ src: bt,
2614
2675
  alt: ""
2615
2676
  })
2616
2677
  }),
@@ -2633,7 +2694,7 @@ ${Ct}
2633
2694
  })]
2634
2695
  })]
2635
2696
  });
2636
- }, Yt = 9e3, Xt = _`
2697
+ }, Xt = 9e3, Zt = _`
2637
2698
  position: absolute;
2638
2699
  inset: 0;
2639
2700
  z-index: 2;
@@ -2676,18 +2737,18 @@ ${Ct}
2676
2737
  line-height: 1;
2677
2738
  color: #fff;
2678
2739
  }
2679
- `, Zt = () => {
2680
- let e = q((e) => e.burnedInSubtitles), t = q((e) => e.pictureInPictureMode), [n, r] = h(!1);
2740
+ `, Qt = () => {
2741
+ let e = K((e) => e.burnedInSubtitles), t = K((e) => e.pictureInPictureMode), [n, r] = h(!1);
2681
2742
  return f(() => {
2682
2743
  if (t !== "burn-in" || !e) {
2683
2744
  r(!1);
2684
2745
  return;
2685
2746
  }
2686
2747
  r(!0);
2687
- let n = setTimeout(() => r(!1), Yt);
2748
+ let n = setTimeout(() => r(!1), Xt);
2688
2749
  return () => clearTimeout(n);
2689
2750
  }, [t, e]), t !== "burn-in" || !e ? null : /* @__PURE__ */ D("div", {
2690
- css: Xt,
2751
+ css: Zt,
2691
2752
  className: n ? "show" : "",
2692
2753
  role: "status",
2693
2754
  children: /* @__PURE__ */ O("div", {
@@ -2702,10 +2763,10 @@ ${Ct}
2702
2763
  })]
2703
2764
  })
2704
2765
  });
2705
- }, Qt = 1, $t = 6e3, en = 1, tn = {
2766
+ }, $t = 1, en = 6e3, tn = 1, nn = {
2706
2767
  opening: "Skip Opening",
2707
2768
  ending: "Skip Ending"
2708
- }, nn = _`
2769
+ }, rn = _`
2709
2770
  position: absolute;
2710
2771
  inset: 0;
2711
2772
  z-index: 2;
@@ -2756,10 +2817,10 @@ ${Ct}
2756
2817
  bottom: calc(9 * var(--mp-unit));
2757
2818
  }
2758
2819
  }
2759
- `, rn = () => {
2760
- let e = q((e) => e.chapters), t = q((e) => e.currentTime), n = q((e) => e.requestSeek), r = q((e) => e.seekPreview), i = q(), a = p(() => ht(e), [e]), o = p(() => {
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(() => {
2761
2822
  if (typeof t != "number") return;
2762
- let n = e.findIndex((e, n) => a[n] !== void 0 && e.start - Qt <= t && t < e.end), r = n >= 0 ? a[n] : void 0;
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;
2763
2824
  return r ? {
2764
2825
  kind: r,
2765
2826
  end: e[n].end
@@ -2771,7 +2832,7 @@ ${Ct}
2771
2832
  ]), s = m(0), [c, l] = h(0);
2772
2833
  f(() => {
2773
2834
  let e = typeof t == "number" ? t : 0, n = s.current;
2774
- s.current = e, e < n - en && l((e) => e + 1);
2835
+ s.current = e, e < n - tn && l((e) => e + 1);
2775
2836
  }, [t]);
2776
2837
  let [u, d] = h(!1), g = o ? `${o.kind}@${o.end}` : "";
2777
2838
  return f(() => {
@@ -2780,12 +2841,12 @@ ${Ct}
2780
2841
  return;
2781
2842
  }
2782
2843
  d(!0);
2783
- let e = setTimeout(() => d(!1), $t);
2844
+ let e = setTimeout(() => d(!1), en);
2784
2845
  return () => clearTimeout(e);
2785
2846
  }, [g, c]), f(() => {
2786
2847
  o || d(!1);
2787
2848
  }, [o]), o ? /* @__PURE__ */ D("div", {
2788
- css: nn,
2849
+ css: rn,
2789
2850
  className: u && !r ? "show" : "",
2790
2851
  children: /* @__PURE__ */ D("button", {
2791
2852
  type: "button",
@@ -2793,10 +2854,10 @@ ${Ct}
2793
2854
  onClick: () => {
2794
2855
  d(!1), n ? n(o.end) : i.seek(o.end);
2795
2856
  },
2796
- children: tn[o.kind]
2857
+ children: nn[o.kind]
2797
2858
  })
2798
2859
  }) : null;
2799
- }, an = 3e3, on = _`
2860
+ }, on = 3e3, sn = _`
2800
2861
  position: absolute;
2801
2862
  inset: 0;
2802
2863
  z-index: 2;
@@ -2807,10 +2868,10 @@ ${Ct}
2807
2868
  hoverable while faded out, popping a tooltip over nothing. It cascades where pointer-events does
2808
2869
  not, and transitioning it holds the item on screen for the length of the fade. */
2809
2870
  transition: opacity 0.1s cubic-bezier(.4,0,1,1), visibility 0.1s;
2810
- `, sn = (e, t) => {
2871
+ `, cn = (e, t) => {
2811
2872
  let n = e.left - t.left, r = e.top - t.top;
2812
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')`;
2813
- }, cn = _`
2874
+ }, ln = _`
2814
2875
  position: relative;
2815
2876
  background-color: black;
2816
2877
  display: flex;
@@ -2867,14 +2928,14 @@ ${Ct}
2867
2928
  &.hide {
2868
2929
  cursor: none;
2869
2930
  }
2870
- `, ln = (e, t = "") => c.toArray(e).flatMap((e, n) => {
2931
+ `, un = (e, t = "") => c.toArray(e).flatMap((e, n) => {
2871
2932
  let r = `${t}${u(e) && e.key != null ? e.key : n}`;
2872
- return u(e) && e.type === l ? ln(e.props.children, `${r}/`) : [{
2933
+ return u(e) && e.type === l ? un(e.props.children, `${r}/`) : [{
2873
2934
  key: r,
2874
2935
  item: e
2875
2936
  }];
2876
- }), un = ({ ref: e, onVideoRef: t, onSubtitleRef: n, overlay: r, controls: i, shortcuts: a, children: o }) => {
2877
- let s = q(), c = q((e) => e.hideUI), l = q((e) => e.setHideUI), u = q((e) => e.hasMedia), d = q((e) => e.passThroughPictureInPicture), p = m(void 0), h = m("mouse"), g = m({
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({
2878
2939
  x: -1,
2879
2940
  y: -1
2880
2941
  }), _ = m(!1), v = m(null);
@@ -2894,12 +2955,12 @@ ${Ct}
2894
2955
  return !n || !v.current.contains(n) || n.closest(".video") ? !1 : !n.closest(".control-bar") || _.current || !!v.current.querySelector(".control-bar [aria-expanded=\"true\"]");
2895
2956
  }, S = () => {
2896
2957
  if (x()) {
2897
- p.current = setTimeout(S, an);
2958
+ p.current = setTimeout(S, on);
2898
2959
  return;
2899
2960
  }
2900
2961
  y();
2901
2962
  }, C = () => {
2902
- l(!1), clearTimeout(p.current), p.current = setTimeout(S, an);
2963
+ l(!1), clearTimeout(p.current), p.current = setTimeout(S, on);
2903
2964
  }, w = (e) => {
2904
2965
  h.current = e.pointerType, e.pointerType === "mouse" && (g.current = {
2905
2966
  x: e.clientX,
@@ -2911,7 +2972,7 @@ ${Ct}
2911
2972
  _.current = !1;
2912
2973
  }, k = m(!0);
2913
2974
  return /* @__PURE__ */ O("div", {
2914
- css: cn,
2975
+ css: ln,
2915
2976
  ref: b,
2916
2977
  onPointerMove: w,
2917
2978
  onPointerDown: T,
@@ -2926,9 +2987,9 @@ ${Ct}
2926
2987
  className: c ? "hide" : "",
2927
2988
  tabIndex: a === "player" ? -1 : void 0,
2928
2989
  children: [
2929
- /* @__PURE__ */ D(Ie, { onSubtitleRef: n }),
2930
- ln(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
2931
- css: on,
2990
+ /* @__PURE__ */ D(Le, { onSubtitleRef: n }),
2991
+ un(r).map(({ key: e, item: t }) => /* @__PURE__ */ D("div", {
2992
+ css: sn,
2932
2993
  style: { ...c ? {
2933
2994
  opacity: "0",
2934
2995
  visibility: "hidden",
@@ -2936,15 +2997,15 @@ ${Ct}
2936
2997
  } : {} },
2937
2998
  children: t
2938
2999
  }, e)),
2939
- i === !1 ? null : /* @__PURE__ */ D(Jt, {
3000
+ i === !1 ? null : /* @__PURE__ */ D(Yt, {
2940
3001
  shortcuts: a,
2941
3002
  root: v
2942
3003
  }),
2943
- /* @__PURE__ */ D(Zt, {}),
2944
- /* @__PURE__ */ D(rn, {}),
3004
+ /* @__PURE__ */ D(Qt, {}),
3005
+ /* @__PURE__ */ D(an, {}),
2945
3006
  d?.armed && v.current ? /* @__PURE__ */ D("div", {
2946
3007
  className: "pass-through",
2947
- style: { clipPath: sn(d.armed, v.current.getBoundingClientRect()) },
3008
+ style: { clipPath: cn(d.armed, v.current.getBoundingClientRect()) },
2948
3009
  onPointerOver: d.disarm
2949
3010
  }) : null,
2950
3011
  /* @__PURE__ */ O("div", {
@@ -2967,64 +3028,71 @@ ${Ct}
2967
3028
  })
2968
3029
  ]
2969
3030
  });
2970
- }, dn = ({ options: e, children: t }) => {
2971
- 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 } = r ?? {}, _ = x(), v = b(), [y, S] = h(null), [C, w] = h(null), T = n?.media ?? y;
2972
- f(() => (_?.(T), () => _?.(null)), [T, _]);
2973
- let { expose: E } = e, O = E === !0 ? {} : E || void 0, k = m(O);
2974
- k.current = O;
2975
- let A = O ? O.id : void 0, j = O ? O.origin : void 0, M = O ? O.channel : void 0;
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;
2976
3037
  f(() => {
2977
- if (!E || !T) return;
3038
+ if (!O || !E) return;
2978
3039
  let e, t = !1;
2979
3040
  return import("./remote/index.js").then(({ exposePlayer: n }) => {
2980
- t || (e = n(T, k.current ?? {}));
3041
+ t || (e = n(E, A.current ?? {}));
2981
3042
  }).catch(() => {}), () => {
2982
3043
  t = !0, e?.();
2983
3044
  };
2984
3045
  }, [
2985
- T,
2986
- !!E,
2987
- A,
3046
+ E,
3047
+ !!O,
2988
3048
  j,
2989
- M
2990
- ]), le(y, C, r);
2991
- let N = r?.normalizeVolume ?? !0, [P, F] = h(N);
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);
2992
3055
  f(() => {
2993
- F(N);
2994
- }, [N]);
2995
- let I = m(r?.onNormalizeVolumeChange);
2996
- I.current = r?.onNormalizeVolumeChange;
2997
- let L = r?.normalizerWorkletUrl, R = m(d ?? u);
2998
- R.current = d ?? u;
2999
- let z = q((e) => e.selectedAudioTrack), B = !!u, { refused: V } = ke(y, L, P, p(() => B && o && c && l && typeof z == "number" && z >= 0 ? {
3000
- read: (e, t) => R.current(e, t),
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),
3001
3067
  length: o,
3002
3068
  publicPath: c,
3003
3069
  libavWorkerUrl: l,
3004
- audioStreamIndex: z
3070
+ audioStreamIndex: V
3005
3071
  } : void 0, [
3006
- B,
3072
+ H,
3007
3073
  o,
3008
3074
  c,
3009
3075
  l,
3010
- z
3011
- ]), p(() => s?.map(({ startByteOffset: e, endByteOffset: t }) => [e, t]), [s?.map(({ startByteOffset: e, endByteOffset: t }) => `${e}-${t}`).join(",")])), H = p(() => L && typeof AudioWorkletNode == "function" ? {
3012
- enabled: P,
3013
- available: !V,
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,
3014
3082
  setEnabled: (e) => {
3015
- F(e), I.current?.(e);
3083
+ L(e), R.current?.(e);
3016
3084
  }
3017
3085
  } : null, [
3018
- L,
3019
- P,
3020
- V
3021
- ]), { thumbnails: ee, requestThumbnail: te } = fe({
3086
+ z,
3087
+ I,
3088
+ ee
3089
+ ]), { thumbnails: ne, requestThumbnail: U } = fe({
3022
3090
  publicPath: c,
3023
3091
  workerUrl: l,
3024
3092
  length: g === !1 ? void 0 : o,
3025
3093
  read: d ?? u,
3026
3094
  downloadedRanges: s
3027
- }), U = n?.thumbnails?.all ?? ee, { toggle: W, mode: G, burnedIn: K } = pe(y, C), ne = ye(n?.media ?? null, n?.pictureInPicture), J = q((e) => e.setSourceState), Y = n ? !!n.media : o !== void 0;
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;
3028
3096
  f(() => {
3029
3097
  J({
3030
3098
  title: i,
@@ -3039,30 +3107,30 @@ ${Ct}
3039
3107
  s,
3040
3108
  Y
3041
3109
  ]);
3042
- let re = n?.thumbnails?.at;
3110
+ let ae = n?.thumbnails?.at;
3043
3111
  f(() => {
3044
3112
  J({
3045
- thumbnails: U,
3046
- thumbnailAt: re,
3047
- requestThumbnail: te,
3048
- togglePictureInPicture: W,
3049
- pictureInPictureMode: G,
3050
- burnedInSubtitles: K
3113
+ thumbnails: W,
3114
+ thumbnailAt: ae,
3115
+ requestThumbnail: U,
3116
+ togglePictureInPicture: G,
3117
+ pictureInPictureMode: re,
3118
+ burnedInSubtitles: ie
3051
3119
  });
3052
3120
  }, [
3053
3121
  J,
3054
- U,
3055
- re,
3056
- te,
3057
3122
  W,
3123
+ ae,
3124
+ U,
3058
3125
  G,
3059
- K
3126
+ re,
3127
+ ie
3060
3128
  ]), f(() => {
3061
- J({ volumeNormalizer: H });
3062
- }, [J, H]), f(() => {
3063
- J({ passThroughPictureInPicture: ne });
3064
- }, [J, ne]);
3065
- let X = n?.subtitles?.selection, ie = n?.audioTracks?.selection;
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;
3066
3134
  f(() => {
3067
3135
  X && J({
3068
3136
  subtitleTracks: X.options.map(({ id: e, label: t, disabled: n }) => ({
@@ -3075,31 +3143,31 @@ ${Ct}
3075
3143
  subtitleOffLabel: X.offLabel
3076
3144
  });
3077
3145
  }, [J, X]), f(() => {
3078
- ie && J({
3079
- audioTracks: ie.options.map(({ id: e, label: t, disabled: n }) => ({
3146
+ oe && J({
3147
+ audioTracks: oe.options.map(({ id: e, label: t, disabled: n }) => ({
3080
3148
  id: e,
3081
3149
  label: t,
3082
3150
  disabled: n
3083
3151
  })),
3084
- selectedAudioTrack: ie.selectedId ?? void 0,
3085
- selectAudioTrack: (e) => ie.select(String(e))
3152
+ selectedAudioTrack: oe.selectedId ?? void 0,
3153
+ selectAudioTrack: (e) => oe.select(String(e))
3086
3154
  });
3087
- }, [J, ie]);
3088
- let ae = n?.quality?.selection ?? null;
3155
+ }, [J, oe]);
3156
+ let se = n?.quality?.selection ?? null;
3089
3157
  return f(() => {
3090
- J({ quality: ae });
3091
- }, [J, ae]), f(() => {
3158
+ J({ quality: se });
3159
+ }, [J, se]), f(() => {
3092
3160
  a && J({ chapters: a });
3093
- }, [J, a]), /* @__PURE__ */ D(un, {
3094
- ref: v,
3095
- onVideoRef: n ? void 0 : S,
3096
- onSubtitleRef: w,
3161
+ }, [J, a]), /* @__PURE__ */ D(dn, {
3162
+ ref: y,
3163
+ onVideoRef: n ? void 0 : C,
3164
+ onSubtitleRef: T,
3097
3165
  overlay: e.overlay,
3098
3166
  controls: e.controls,
3099
3167
  shortcuts: e.shortcuts,
3100
3168
  children: t
3101
3169
  });
3102
- }, fn = _`
3170
+ }, pn = _`
3103
3171
  /**
3104
3172
  * The chrome's whole scale, in one place.
3105
3173
  *
@@ -3169,17 +3237,17 @@ ${Ct}
3169
3237
  height: 100%;
3170
3238
  width: 100%;
3171
3239
  overflow: hidden;
3172
- `, pn = (e) => /* @__PURE__ */ D("div", {
3173
- css: fn,
3174
- children: /* @__PURE__ */ D(K.Provider, { children: /* @__PURE__ */ D(dn, {
3240
+ `, mn = (e) => /* @__PURE__ */ D("div", {
3241
+ css: pn,
3242
+ children: /* @__PURE__ */ D(G.Provider, { children: /* @__PURE__ */ D(fn, {
3175
3243
  options: e,
3176
3244
  children: e.children
3177
3245
  }) })
3178
- }), mn = (e) => !!e && typeof e == "object" && "at" in e, hn = (e) => !!e && typeof e == "object" && "selection" in e, gn = ({ blob: e, name: t }) => ({
3246
+ }), hn = (e) => !!e && typeof e == "object" && "at" in e, gn = (e) => !!e && typeof e == "object" && "selection" in e, _n = ({ blob: e, name: t }) => ({
3179
3247
  length: e.size,
3180
3248
  name: t ?? (e instanceof File ? e.name : void 0),
3181
3249
  read: (t, n) => e.slice(t, t + n).arrayBuffer()
3182
- }), _n = async (e, t) => {
3250
+ }), vn = async (e, t) => {
3183
3251
  let n = await fetch(e, {
3184
3252
  headers: { Range: "bytes=0-1" },
3185
3253
  credentials: t
@@ -3189,8 +3257,8 @@ ${Ct}
3189
3257
  if (!Number.isFinite(i) || i <= 0) throw Error("The source did not report its length");
3190
3258
  if (!r && n.status !== 206) throw Error("The source does not support range requests");
3191
3259
  return i;
3192
- }, vn = async ({ url: e, length: t, name: n, credentials: r }) => {
3193
- let i = t ?? await _n(e, r);
3260
+ }, yn = async ({ url: e, length: t, name: n, credentials: r }) => {
3261
+ let i = t ?? await vn(e, r);
3194
3262
  return {
3195
3263
  length: i,
3196
3264
  name: n,
@@ -3203,11 +3271,12 @@ ${Ct}
3203
3271
  });
3204
3272
  if (!o.ok) throw Error(`The source could not be read: HTTP ${o.status}`);
3205
3273
  return o.arrayBuffer();
3206
- }
3274
+ },
3275
+ readsDownload: !0
3207
3276
  };
3208
- }, yn = async (e) => {
3209
- if ("blob" in e) return gn(e);
3210
- if ("url" in e) return vn(e);
3277
+ }, bn = async (e) => {
3278
+ if ("blob" in e) return _n(e);
3279
+ if ("url" in e) return yn(e);
3211
3280
  if ("read" in e) return {
3212
3281
  length: e.length,
3213
3282
  name: e.name,
@@ -3216,4 +3285,4 @@ ${Ct}
3216
3285
  throw Error(`Unknown source type: ${e}`);
3217
3286
  };
3218
3287
  //#endregion
3219
- export { pn as MediaPlayer, pn as default, K as Player, t as SUBTITLES_OFF, o as createPictureInPicture, s as createSubtitleRenderer, i as createThumbnailGenerator, yn as inputToRemuxerInput, hn as isDelegatedTracks, mn as isExternalThumbnails, G as sourceFeature, a as startPlayback, pe as usePictureInPicture, q as usePlayer, fe as useSeekThumbnails };
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 };